本文整理匯總了TypeScript中ag-grid-community.Utils類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Utils類的具體用法?TypeScript Utils怎麽用?TypeScript Utils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Utils類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: workbook
private workbook(docProperties: XmlElement, eWorkbook: XmlElement, styles: ExcelStyle[], worksheets: ExcelWorksheet[]) : XmlElement {
const children : XmlElement [] = [
docProperties,
eWorkbook,
this.stylesXmlElement(styles)
].concat(Utils.map(worksheets, (it):XmlElement => worksheet.getTemplate(it)));
return Utils.assign({}, workbook.getTemplate(), {children});
}
示例2: styleXmlElement
private styleXmlElement(styleProperties:ExcelStyle):XmlElement {
const children = Utils.compose(
this.addProperty('alignment', styleProperties),
this.addProperty('borders', styleProperties),
this.addProperty('font', styleProperties),
this.addProperty('interior', styleProperties),
this.addProperty('protection', styleProperties),
this.addProperty('numberFormat', styleProperties)
)([]);
return Utils.assign({}, style.getTemplate(styleProperties), {children});
}
示例3: setState
public setState(value: any, valueFormatted: string, selected: boolean): void {
let rendererSuccessful = this.populateWithRenderer(value, valueFormatted);
if (!rendererSuccessful) {
this.populateWithoutRenderer(value, valueFormatted);
}
Utils.addOrRemoveCssClass(this.getGui(), 'ag-rich-select-row-selected', selected);
}
示例4: stylesXmlElement
private stylesXmlElement(styles:ExcelStyle[]):XmlElement {
return {
name:'Styles',
children:styles ? Utils.map(styles, (it) => {
return this.styleXmlElement (it);
}): []
};
}
示例5: populateWithoutRenderer
private populateWithoutRenderer(value: any, valueFormatted: string) {
let valueFormattedExits = valueFormatted !== null && valueFormatted !== undefined;
let valueToRender = valueFormattedExits ? valueFormatted : value;
if (Utils.exists(valueToRender) && valueToRender !== '') {
// not using innerHTML to prevent injection of HTML
// https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#Security_considerations
this.getGui().textContent = valueToRender.toString();
} else {
// putting in blank, so if missing, at least the user can click on it
this.getGui().innerHTML = ' ';
}
}
示例6: getMenuItems
private getMenuItems(node: RowNode, column: Column, value: any): (MenuItemDef|string)[] {
let defaultMenuOptions: string[];
if (Utils.exists(node)) {
defaultMenuOptions = [];
if (column) {
// only makes sense if column exists, could have originated from a row
defaultMenuOptions = ['copy','copyWithHeaders','paste', 'separator'];
}
// if user clicks a cell
let suppressExcel = this.gridOptionsWrapper.isSuppressExcelExport();
let suppressCsv = this.gridOptionsWrapper.isSuppressCsvExport();
let onIPad = _.isUserAgentIPad();
let anyExport: boolean = !onIPad && (!suppressExcel || !suppressCsv);
if (anyExport) {
defaultMenuOptions.push('export');
}
} else {
// if user clicks outside of a cell (eg below the rows, or not rows present)
// nothing to show, perhaps tool panels???
}
if (this.gridOptionsWrapper.getContextMenuItemsFunc()) {
let userFunc: GetContextMenuItems = this.gridOptionsWrapper.getContextMenuItemsFunc();
let params: GetContextMenuItemsParams = {
node: node,
column: column,
value: value,
defaultItems: defaultMenuOptions,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext()
};
let menuItemsFromUser = userFunc(params);
return menuItemsFromUser;
} else {
return defaultMenuOptions;
}
}
示例7: showMenu
public showMenu(node: RowNode, column: Column, value: any, mouseEvent: MouseEvent | Touch): void {
let menuItems = this.getMenuItems(node, column, value);
if (Utils.missingOrEmpty(menuItems)) { return; }
let menu = new ContextMenu(menuItems);
this.context.wireBean(menu);
let eMenuGui = menu.getGui();
// need to show filter before positioning, as only after filter
// is visible can we find out what the width of it is
let hidePopup = this.popupService.addAsModalPopup(
eMenuGui,
true,
()=> menu.destroy(),
mouseEvent
);
this.popupService.positionPopupUnderMouseEvent({
column: column,
rowNode: node,
type: 'contextMenu',
mouseEvent: mouseEvent,
ePopup: eMenuGui
});
menu.afterGuiAttached({
hidePopup: hidePopup
});
this.activeMenu = menu;
menu.addEventListener(BeanStub.EVENT_DESTROYED, ()=> {
if (this.activeMenu===menu) {
this.activeMenu = null;
}
});
}
示例8: getTemplate
import {XmlElement, Utils} from 'ag-grid-community';
import {ExcelXMLTemplate, ExcelWorksheet} from 'ag-grid-community';
import column from './column';
import row from './row';
const worksheet: ExcelXMLTemplate = {
getTemplate(ws: ExcelWorksheet): XmlElement {
const {table, name} = ws;
const {columns, rows} = table;
const c = Utils.map(columns, (it):XmlElement => column.getTemplate(it));
const r = Utils.map(rows, (it):XmlElement => row.getTemplate(it));
return {
name: "Worksheet",
children:[{
name:"Table",
children: c.concat(r)
}],
properties:{
prefixedAttributes: [{
prefix:"ss:",
map: {
Name: name
}
}]
}
};
}
};
示例9: getTemplate
import {XmlElement, Utils} from 'ag-grid-community';
import {ExcelCell, ExcelRow, ExcelXMLTemplate} from 'ag-grid-community';
import cell from './cell';
const row: ExcelXMLTemplate = {
getTemplate(r: ExcelRow): XmlElement {
const {cells} = r;
return {
name: "Row",
children: Utils.map(cells, (it:ExcelCell):XmlElement => {
return cell.getTemplate(it);
})
};
}
};
export default row;