diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/global-grid-options.ts b/aurelia-slickgrid/src/aurelia-slickgrid/global-grid-options.ts index 7a8984cb8..29f8340d3 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/global-grid-options.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/global-grid-options.ts @@ -51,7 +51,13 @@ export const GlobalGridOptions: GridOption = { }, forceFitColumns: false, gridMenu: { + hideClearAllFiltersCommand: false, + hideClearAllSortingCommand: false, + hideExportCsvCommand: false, + hideExportTextDelimitedCommand: true, hideForceFitButton: false, + hideRefreshDatasetCommand: false, + hideToggleFilterCommand: false, hideSyncResizeButton: true, iconCssClass: 'fa fa-bars', iconClearAllFiltersCommand: 'fa fa-filter text-danger', @@ -62,11 +68,6 @@ export const GlobalGridOptions: GridOption = { iconToggleFilterCommand: 'fa fa-random', menuWidth: 16, resizeOnShowHeaderRow: true, - showClearAllFiltersCommand: true, - showClearAllSortingCommand: true, - showExportCsvCommand: true, - showRefreshDatasetCommand: true, - showToggleFilterCommand: true }, headerMenu: { autoAlign: true, diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/models/gridMenu.interface.ts b/aurelia-slickgrid/src/aurelia-slickgrid/models/gridMenu.interface.ts index 539204d68..ff725e602 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/models/gridMenu.interface.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/models/gridMenu.interface.ts @@ -10,47 +10,35 @@ export interface GridMenu { /** Defaults to "Columns" which is the title that shows up over the columns */ columnTitle?: string; - /** Link for the displaying the Grid menu icon image (basically the hamburger menu) */ - iconImage?: string; - - /** CSS class for the displaying the Grid menu icon image (basically the hamburger menu) */ - iconCssClass?: string; - - /** Defaults to False, which leads to leaving the menu open after a click */ - leaveOpen?: boolean; - - /** Defaults to 16 pixels (only the number), which is the width in pixels of the Grid Menu icon */ - menuWidth?: number; - /** Defaults to "Force fit columns" which is 1 of the last 2 checkbox title shown at the end of the picker list */ forceFitTitle?: string; - /** Defaults to True, show/hide 1 of the last 2 checkbox at the end of the picker list */ - hideForceFitButton?: boolean; + /** Defaults to false, which will hide the "Clear All Filters" command in the Grid Menu (Grid Option "enableFiltering: true" has to be enabled) */ + hideClearAllFiltersCommand?: boolean; - /** Defaults to True, show/hide 1 of the last 2 checkbox at the end of the picker list */ - hideSyncResizeButton?: boolean; + /** Defaults to false, which will hide the "Clear All Sorting" command in the Grid Menu (Grid Option "enableSorting: true" has to be enabled) */ + hideClearAllSortingCommand?: boolean; - /** Defaults to False, which will resize the Header Row and remove the width of the Grid Menu icon from it's total width. */ - resizeOnShowHeaderRow?: boolean; + /** Defaults to false, which will hide the "Export to CSV" command in the Grid Menu (Grid Option "enableExport: true" has to be enabled) */ + hideExportCsvCommand?: boolean; - /** Defaults to True, which will show the "Clear All Filters" command in the Grid Menu (Grid Option "enableFiltering: true" has to be enabled) */ - showClearAllFiltersCommand?: boolean; + /** Defaults to false, which will hide the "Export to Text Delimited" command in the Grid Menu (Grid Option "enableExport: true" has to be enabled) */ + hideExportTextDelimitedCommand?: boolean; - /** Defaults to True, which will show the "Clear All Sorting" command in the Grid Menu (Grid Option "enableSorting: true" has to be enabled) */ - showClearAllSortingCommand?: boolean; + /** Defaults to false, show/hide 1 of the last 2 checkbox at the end of the picker list */ + hideForceFitButton?: boolean; - /** Defaults to True, which will show the "Export to CSV" command in the Grid Menu (Grid Option "enableExport: true" has to be enabled) */ - showExportCsvCommand?: boolean; + /** Defaults to false, which will hide the "Refresh Dataset" command in the Grid Menu (only works with a Backend Service API) */ + hideRefreshDatasetCommand?: boolean; - /** Defaults to True, which will show the "Export to Text Delimited" command in the Grid Menu (Grid Option "enableExport: true" has to be enabled) */ - showExportTextDelimitedCommand?: boolean; + /** Defaults to false, show/hide 1 of the last 2 checkbox at the end of the picker list */ + hideSyncResizeButton?: boolean; - /** Defaults to True, which will show the "Refresh Dataset" command in the Grid Menu (only works with a Backend Service API) */ - showRefreshDatasetCommand?: boolean; + /** Defaults to false, which will hide the "Toggle Filter Row" command in the Grid Menu (Grid Option "enableFiltering: true" has to be enabled) */ + hideToggleFilterCommand?: boolean; - /** Defaults to True, which will show the "Toggle Filter Row" command in the Grid Menu (Grid Option "enableFiltering: true" has to be enabled) */ - showToggleFilterCommand?: boolean; + /** CSS class for the displaying the Grid menu icon image (basically the hamburger menu) */ + iconCssClass?: string; /** icon for the "Clear All Filters" command */ iconClearAllFiltersCommand?: string; @@ -64,15 +52,30 @@ export interface GridMenu { /** icon for the "Export to Text Delimited" command */ iconExportTextDelimitedCommand?: string; + /** Link for the displaying the Grid menu icon image (basically the hamburger menu) */ + iconImage?: string; + /** icon for the "Refresh Dataset" command */ iconRefreshDatasetCommand?: string; /** icon for the "Toggle Filter Row" command */ iconToggleFilterCommand?: string; + /** Defaults to False, which leads to leaving the menu open after a click */ + leaveOpen?: boolean; + + /** Defaults to 16 pixels (only the number), which is the width in pixels of the Grid Menu icon */ + menuWidth?: number; + + /** Defaults to False, which will resize the Header Row and remove the width of the Grid Menu icon from it's total width. */ + resizeOnShowHeaderRow?: boolean; + /** Defaults to "Synchronous resize" which is 1 of the last 2 checkbox title shown at the end of the picker list */ syncResizeTitle?: string; + // + // Events + /** SlickGrid Event fired before the menu is shown. */ onBeforeMenuShow?: (e: Event, args: any) => void; diff --git a/aurelia-slickgrid/src/aurelia-slickgrid/services/controlAndPlugin.service.ts b/aurelia-slickgrid/src/aurelia-slickgrid/services/controlAndPlugin.service.ts index 1a17273c5..3dbb8065b 100644 --- a/aurelia-slickgrid/src/aurelia-slickgrid/services/controlAndPlugin.service.ts +++ b/aurelia-slickgrid/src/aurelia-slickgrid/services/controlAndPlugin.service.ts @@ -415,7 +415,7 @@ export class ControlAndPluginService { if (this._gridOptions && this._gridOptions.enableFiltering) { // show grid menu: clear all filters - if (this._gridOptions && this._gridOptions.gridMenu && this._gridOptions.gridMenu.showClearAllFiltersCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'clear-filter').length === 0) { + if (this._gridOptions && this._gridOptions.gridMenu && !this._gridOptions.gridMenu.hideClearAllFiltersCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'clear-filter').length === 0) { this._gridOptions.gridMenu.customItems.push( { iconCssClass: this._gridOptions.gridMenu.iconClearAllFiltersCommand || 'fa fa-filter text-danger', @@ -427,7 +427,7 @@ export class ControlAndPluginService { ); } // show grid menu: toggle filter row - if (this._gridOptions && this._gridOptions.gridMenu && this._gridOptions.gridMenu.showToggleFilterCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'toggle-filter').length === 0) { + if (this._gridOptions && this._gridOptions.gridMenu && !this._gridOptions.gridMenu.hideToggleFilterCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'toggle-filter').length === 0) { this._gridOptions.gridMenu.customItems.push( { iconCssClass: this._gridOptions.gridMenu.iconToggleFilterCommand || 'fa fa-random', @@ -440,7 +440,7 @@ export class ControlAndPluginService { } // show grid menu: refresh dataset - if (this._gridOptions && this._gridOptions.gridMenu && this._gridOptions.gridMenu.showRefreshDatasetCommand && backendApi && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'refresh-dataset').length === 0) { + if (this._gridOptions && this._gridOptions.gridMenu && !this._gridOptions.gridMenu.hideRefreshDatasetCommand && backendApi && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'refresh-dataset').length === 0) { this._gridOptions.gridMenu.customItems.push( { iconCssClass: this._gridOptions.gridMenu.iconRefreshDatasetCommand || 'fa fa-refresh', @@ -455,7 +455,7 @@ export class ControlAndPluginService { if (this._gridOptions.enableSorting) { // show grid menu: clear all sorting - if (this._gridOptions && this._gridOptions.gridMenu && this._gridOptions.gridMenu.showClearAllSortingCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'clear-sorting').length === 0) { + if (this._gridOptions && this._gridOptions.gridMenu && !this._gridOptions.gridMenu.hideClearAllSortingCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'clear-sorting').length === 0) { this._gridOptions.gridMenu.customItems.push( { iconCssClass: this._gridOptions.gridMenu.iconClearAllSortingCommand || 'fa fa-unsorted text-danger', @@ -469,7 +469,7 @@ export class ControlAndPluginService { } // show grid menu: export to file - if (this._gridOptions && this._gridOptions.enableExport && this._gridOptions.gridMenu && this._gridOptions.gridMenu.showExportCsvCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'export-csv').length === 0) { + if (this._gridOptions && this._gridOptions.enableExport && this._gridOptions.gridMenu && !this._gridOptions.gridMenu.hideExportCsvCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'export-csv').length === 0) { this._gridOptions.gridMenu.customItems.push( { iconCssClass: this._gridOptions.gridMenu.iconExportCsvCommand || 'fa fa-download', @@ -481,7 +481,7 @@ export class ControlAndPluginService { ); } // show grid menu: export to text file as tab delimited - if (this._gridOptions && this._gridOptions.enableExport && this._gridOptions.gridMenu && this._gridOptions.gridMenu.showExportTextDelimitedCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'export-text-delimited').length === 0) { + if (this._gridOptions && this._gridOptions.enableExport && this._gridOptions.gridMenu && !this._gridOptions.gridMenu.hideExportTextDelimitedCommand && this._gridOptions.gridMenu.customItems && this._gridOptions.gridMenu.customItems.filter((item: CustomGridMenu) => item.command === 'export-text-delimited').length === 0) { this._gridOptions.gridMenu.customItems.push( { iconCssClass: this._gridOptions.gridMenu.iconExportTextDelimitedCommand || 'fa fa-download', @@ -780,9 +780,9 @@ export class ControlAndPluginService { menuWidth: 18, customTitle: undefined, customItems: [], - showClearAllFiltersCommand: true, - showRefreshDatasetCommand: true, - showToggleFilterCommand: true + hideClearAllFiltersCommand: false, + hideRefreshDatasetCommand: false, + hideToggleFilterCommand: false }; } diff --git a/aurelia-slickgrid/src/examples/slickgrid/example12.ts b/aurelia-slickgrid/src/examples/slickgrid/example12.ts index 584c2c2ed..1e2e550d2 100644 --- a/aurelia-slickgrid/src/examples/slickgrid/example12.ts +++ b/aurelia-slickgrid/src/examples/slickgrid/example12.ts @@ -124,8 +124,8 @@ export class Example12 { sanitizeDataExport: true }, gridMenu: { - showExportCsvCommand: true, // true by default, so it's optional - showExportTextDelimitedCommand: true // false by default, so if you want it, you will need to enable it + hideExportCsvCommand: false, // false by default, so it's optional + hideExportTextDelimitedCommand: false // true by default, so if you want it, you will need to disable the flag }, params: { i18n: this.i18n