本文整理汇总了TypeScript中ag-grid/main.Utils类的典型用法代码示例。如果您正苦于以下问题:TypeScript Utils类的具体用法?TypeScript Utils怎么用?TypeScript Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Utils类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setState
public setState(value: any, selected: boolean): void {
if (Utils.exists(this.cellRenderer)) {
this.populateWithRenderer(value);
} else {
this.populateWithoutRenderer(value);
}
Utils.addOrRemoveCssClass(this.getGui(), 'ag-rich-select-row-selected', selected);
}
示例2: getMenuItems
private getMenuItems(node: RowNode, column: Column, value: any): (MenuItem|string)[] {
var defaultMenuOptions: string[];
if (Utils.exists(node)) {
// if user clicks a cell
defaultMenuOptions = ['copy','copyWithHeaders','paste','separator','toolPanel'];
} else {
// if user clicks outside of a cell (eg below the rows, or not rows present)
defaultMenuOptions = ['toolPanel'];
}
if (this.gridOptionsWrapper.getContextMenuItemsFunc()) {
var userFunc: GetContextMenuItems = this.gridOptionsWrapper.getContextMenuItemsFunc();
var params: GetContextMenuItemsParams = {
node: node,
column: column,
value: value,
defaultItems: defaultMenuOptions,
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
context: this.gridOptionsWrapper.getContext()
};
var menuItemsFromUser = userFunc(params);
return menuItemsFromUser;
} else {
return defaultMenuOptions;
}
}
示例3: showMenu
public showMenu(node: RowNode, column: Column, value: any, mouseEvent: MouseEvent): void {
var menuItems = this.getMenuItems(node, column, value);
if (Utils.missingOrEmpty(menuItems)) { return; }
var menu = new ContextMenu(menuItems);
this.context.wireBean(menu);
var 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
var hidePopup = this.popupService.addAsModalPopup(
eMenuGui,
true,
()=> menu.destroy()
);
this.popupService.positionPopupUnderMouseEvent({
mouseEvent: mouseEvent,
ePopup: eMenuGui
});
menu.afterGuiAttached(hidePopup);
}
示例4: populateWithoutRenderer
private populateWithoutRenderer(value: any) {
if (Utils.exists(value) && value !== '') {
// not using innerHTML to prevent injection of HTML
// https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#Security_considerations
this.getGui().textContent = value.toString();
}
}
示例5: setState
public setState(value: any, selected: boolean): void {
var childComponent = this.cellRendererService.useCellRenderer(this.cellRenderer, this.getGui(), { value: value });
if (childComponent && childComponent.destroy) {
this.addDestroyFunc(childComponent.destroy.bind(childComponent));
}
Utils.addOrRemoveCssClass(this.getGui(), 'ag-rich-select-row-selected', selected);
}
示例6: recursivelyAddGroup
// parentChildren - the list of colDefs we are adding to
// @index - how far the column is from the top (also same as pivotKeys.length)
// @uniqueValues - the values for which we should create a col for
// @pivotKeys - the keys for the pivot, eg if pivoting on {Language,Country} then could be {English,Ireland}
private recursivelyAddGroup(parentChildren: (ColGroupDef|ColDef)[], pivotColumnDefs: ColDef[], index: number, uniqueValues: any,
pivotKeys: string[], columnIdSequence: NumberSequence, levelsDeep: number): void {
Utils.iterateObject(uniqueValues, (key: string, value: any)=> {
var newPivotKeys = pivotKeys.slice(0);
newPivotKeys.push(key);
var createGroup = index !== levelsDeep;
if (createGroup) {
var groupDef: ColGroupDef = {
children: [],
headerName: key
};
parentChildren.push(groupDef);
this.recursivelyAddGroup(groupDef.children, pivotColumnDefs, index+1, value, newPivotKeys, columnIdSequence, levelsDeep);
} else {
var measureColumns = this.columnController.getAggregationColumns();
var valueGroup: ColGroupDef = {
children: [],
headerName: key
};
parentChildren.push(valueGroup);
measureColumns.forEach( measureColumn => {
var colDef = this.createColDef(measureColumn, measureColumn.getColDef().headerName, newPivotKeys, columnIdSequence);
valueGroup.children.push(colDef);
pivotColumnDefs.push(colDef);
});
valueGroup.children.sort(this.headerNameComparator.bind(this));
}
parentChildren.sort(this.headerNameComparator.bind(this));
});
}
示例7: removeColumns
protected removeColumns(columns: Column[]): void {
if (this.gridOptionsWrapper.isFunctionsPassive()) {
this.eventService.dispatchEvent(Events.EVENT_COLUMN_PIVOT_REMOVE_REQUEST, {columns: columns} );
} else {
var columnsPivoted = Utils.filter(columns, (column: Column) => column.isPivotActive() );
this.columnController.removePivotColumns(columnsPivoted);
}
}
示例8: removeColumns
protected removeColumns(columns: Column[]): void {
if (this.gridOptionsWrapper.isFunctionsPassive()) {
this.eventService.dispatchEvent(Events.EVENT_COLUMN_VALUE_REMOVE_REQUEST, {columns: columns} );
} else {
var columnsCurrentlyValueColumns = Utils.filter(columns, (column: Column) => column.isValueActive() );
this.columnController.removeValueColumns(columnsCurrentlyValueColumns);
}
}
示例9: createGui
private createGui() {
var _this = this;
this.setTemplate(this.createTemplate());
this.eListContainer = this.queryForHtmlElement(".ag-filter-list-container");
this.eFilterValueTemplate = this.queryForHtmlElement("#itemForRepeat");
this.eSelectAll = this.queryForHtmlElement("#selectAll");
this.eListViewport = this.queryForHtmlElement(".ag-filter-list-viewport");
this.eMiniFilter = this.queryForHtmlElement(".ag-filter-filter");
this.eListContainer.style.height = (this.model.getUniqueValueCount() * this.rowHeight) + "px";
this.setContainerHeight();
this.eMiniFilter.value = this.model.getMiniFilter();
_.addChangeListener(this.eMiniFilter, function () {
_this.onMiniFilterChanged();
});
_.removeAllChildren(this.eListContainer);
this.eSelectAll.onclick = this.onSelectAll.bind(this);
if (this.model.isEverythingSelected()) {
this.eSelectAll.indeterminate = false;
this.eSelectAll.checked = true;
} else if (this.model.isNothingSelected()) {
this.eSelectAll.indeterminate = false;
this.eSelectAll.checked = false;
} else {
this.eSelectAll.indeterminate = true;
}
this.setupApply();
}
示例10: doesFilterPass
public doesFilterPass(node: any): boolean {
// if no filter, always pass
if (this.model.isEverythingSelected()) {
return true;
}
// if nothing selected in filter, always fail
if (this.model.isNothingSelected()) {
return false;
}
var value = this.valueGetter(node);
value = _.makeNull(value);
if (Array.isArray(value)) {
for (var i = 0; i < value.length; i++) {
if (this.model.isValueSelected(value[i])) {
return true
}
}
return false
} else {
return this.model.isValueSelected(value);
}
}