本文整理汇总了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;