1- import { Filters , type Column , type GridOption as GridOptionUniversal , type TreeDataOption } from '@slickgrid-universal/common' ;
1+ import { GlobalGridOptions as UniversalGridOptions } from '@slickgrid-universal/common' ;
22import type { GridOption , RowDetailView } from './models/index' ;
33
44/** Global Grid Options Defaults */
55export const GlobalGridOptions : Partial < GridOption > = {
6- alwaysShowVerticalScroll : true ,
7- autoEdit : false ,
8- asyncEditorLoading : false ,
9- autoFitColumnsOnFirstLoad : true ,
10- autoResize : {
11- applyResizeToContainer : true ,
12- autoHeight : true ,
13- autoHeightRecalcRow : 100 ,
14- calculateAvailableSizeBy : 'window' ,
15- bottomPadding : 20 ,
16- minHeight : 250 ,
17- minWidth : 300 ,
18- rightPadding : 0 ,
19- } ,
20- cellHighlightCssClass : 'slick-cell-modified' ,
21- checkboxSelector : {
22- cssClass : 'slick-cell-checkboxsel' ,
23- } ,
24- columnPicker : {
25- hideForceFitButton : false ,
26- hideSyncResizeButton : true ,
27- headerColumnValueExtractor : pickerHeaderColumnValueExtractor ,
28- } ,
29- cellMenu : {
30- autoAdjustDrop : true ,
31- autoAlignSide : true ,
32- hideCloseButton : true ,
33- hideCommandSection : false ,
34- hideOptionSection : false ,
35- } ,
36- contextMenu : {
37- autoAdjustDrop : true ,
38- autoAlignSide : true ,
39- hideCloseButton : true ,
40- hideClearAllGrouping : false ,
41- hideCollapseAllGroups : false ,
42- hideCommandSection : false ,
43- hideCopyCellValueCommand : false ,
44- hideExpandAllGroups : false ,
45- hideExportCsvCommand : false ,
46- hideExportExcelCommand : false ,
47- hideExportPdfCommand : false ,
48- hideExportTextDelimitedCommand : true ,
49- hideMenuOnScroll : true ,
50- hideOptionSection : false ,
51- iconCollapseAllGroupsCommand : 'mdi mdi-arrow-collapse' ,
52- iconExpandAllGroupsCommand : 'mdi mdi-arrow-expand' ,
53- iconClearGroupingCommand : 'mdi mdi-close' ,
54- iconCopyCellValueCommand : 'mdi mdi-content-copy' ,
55- iconExportCsvCommand : 'mdi mdi-download' ,
56- iconExportExcelCommand : 'mdi mdi-file-excel-outline' ,
57- iconExportTextDelimitedCommand : 'mdi mdi-download' ,
58- showBulletWhenIconMissing : true ,
59- subItemChevronClass : 'mdi mdi-chevron-down mdi-rotate-270' ,
60- } ,
61- customFooterOptions : {
62- dateFormat : 'YYYY-MM-DD, hh:mm a' ,
63- hideRowSelectionCount : false ,
64- hideTotalItemCount : false ,
65- hideLastUpdateTimestamp : true ,
66- footerHeight : 25 ,
67- leftContainerClass : 'col-xs-12 col-sm-5' ,
68- rightContainerClass : 'col-xs-6 col-sm-7' ,
69- metricSeparator : '|' ,
70- metricTexts : {
71- items : 'items' ,
72- itemsKey : 'ITEMS' ,
73- itemsSelected : 'items selected' ,
74- itemsSelectedKey : 'ITEMS_SELECTED' ,
75- of : 'of' ,
76- ofKey : 'OF' ,
77- } ,
78- } ,
79- dataView : {
80- // when enabled, this will preserve the row selection even after filtering/sorting/grouping
81- syncGridSelection : {
82- preserveHidden : false ,
83- preserveHiddenOnSelectionChange : true ,
84- } ,
85- syncGridSelectionWithBackendService : false , // but disable it when using backend services
86- } ,
87- datasetIdPropertyName : 'id' ,
88- defaultFilter : Filters . input ,
89- defaultBackendServiceFilterTypingDebounce : 500 ,
90- defaultColumnSortFieldId : 'id' ,
91- defaultFilterPlaceholder : '🔎︎' ,
92- defaultFilterRangeOperator : 'RangeInclusive' ,
93- editable : false ,
94- enableAutoResize : true ,
95- enableAutoSizeColumns : true ,
96- enableCellNavigation : false ,
97- enableColumnPicker : true ,
98- enableColumnReorder : true ,
99- enableColumnResizeOnDoubleClick : true ,
100- enableContextMenu : true ,
101- enableExcelExport : false ,
102- enableTextExport : false , // CSV/Text with Tab Delimited
103- enableFilterTrimWhiteSpace : false , // do we want to trim white spaces on all Filters?
104- enableGridMenu : true ,
105- enableHeaderMenu : true ,
106- enableEmptyDataWarningMessage : true ,
107- emptyDataWarning : {
108- className : 'slick-empty-data-warning' ,
109- message : 'No data to display.' ,
110- messageKey : 'EMPTY_DATA_WARNING_MESSAGE' ,
111- hideFrozenLeftWarning : false ,
112- hideFrozenRightWarning : false ,
113- leftViewportMarginLeft : '40%' ,
114- rightViewportMarginLeft : '40%' ,
115- frozenLeftViewportMarginLeft : '0px' ,
116- frozenRightViewportMarginLeft : '40%' ,
117- } ,
118- enableMouseHoverHighlightRow : true ,
119- enableSorting : true ,
120- enableTextSelectionOnCells : true ,
6+ ...UniversalGridOptions ,
1217 eventNamingStyle : 'camelCase' ,
122- explicitInitialization : true ,
123- excelExportOptions : {
124- addGroupIndentation : true ,
125- exportWithFormatter : false ,
126- filename : 'export' ,
127- format : 'xlsx' ,
128- groupingColumnHeaderTitle : 'Group By' ,
129- groupCollapsedSymbol : '⮞' ,
130- groupExpandedSymbol : '⮟' ,
131- groupingAggregatorRowText : '' ,
132- sanitizeDataExport : false ,
133- } ,
134- pdfExportOptions : {
135- addGroupIndentation : true ,
136- exportWithFormatter : false ,
137- filename : 'export' ,
138- pageOrientation : 'portrait' ,
139- pageSize : 'a4' ,
140- fontSize : 10 ,
141- headerFontSize : 11 ,
142- includeColumnHeaders : true ,
143- htmlDecode : true ,
144- sanitizeDataExport : true ,
145- groupingColumnHeaderTitle : 'Group By' ,
146- groupCollapsedSymbol : '+' ,
147- groupExpandedSymbol : '-' ,
148- groupingAggregatorRowText : '' ,
149- repeatHeadersOnEachPage : true ,
150- } ,
151- textExportOptions : {
152- delimiter : ',' ,
153- exportWithFormatter : false ,
154- filename : 'export' ,
155- format : 'csv' ,
156- groupingColumnHeaderTitle : 'Group By' ,
157- groupingAggregatorRowText : '' ,
158- sanitizeDataExport : false ,
159- useUtf8WithBom : true ,
160- } ,
161- filterTypingDebounce : 0 ,
162- forceFitColumns : false ,
163- frozenHeaderWidthCalcDifferential : 0 ,
164- gridMenu : {
165- dropSide : 'left' ,
166- commandLabels : {
167- clearAllFiltersCommandKey : 'CLEAR_ALL_FILTERS' ,
168- clearAllSortingCommandKey : 'CLEAR_ALL_SORTING' ,
169- clearFrozenColumnsCommandKey : 'CLEAR_PINNING' ,
170- exportCsvCommandKey : 'EXPORT_TO_CSV' ,
171- exportExcelCommandKey : 'EXPORT_TO_EXCEL' ,
172- exportPdfCommandKey : 'EXPORT_TO_PDF' ,
173- exportTextDelimitedCommandKey : 'EXPORT_TO_TAB_DELIMITED' ,
174- refreshDatasetCommandKey : 'REFRESH_DATASET' ,
175- toggleDarkModeCommandKey : 'TOGGLE_DARK_MODE' ,
176- toggleFilterCommandKey : 'TOGGLE_FILTER_ROW' ,
177- togglePreHeaderCommandKey : 'TOGGLE_PRE_HEADER_ROW' ,
178- } ,
179- hideClearAllFiltersCommand : false ,
180- hideClearAllSortingCommand : false ,
181- hideClearFrozenColumnsCommand : true , // opt-in command
182- hideExportCsvCommand : false ,
183- hideExportExcelCommand : false ,
184- hideExportPdfCommand : false ,
185- hideExportTextDelimitedCommand : true ,
186- hideForceFitButton : false ,
187- hideRefreshDatasetCommand : false ,
188- hideSyncResizeButton : true ,
189- hideToggleDarkModeCommand : true ,
190- hideToggleFilterCommand : false ,
191- hideTogglePreHeaderCommand : false ,
192- iconCssClass : 'mdi mdi-menu' ,
193- iconClearAllFiltersCommand : 'mdi mdi-filter-remove-outline' ,
194- iconClearAllSortingCommand : 'mdi mdi-sort-variant-off' ,
195- iconClearFrozenColumnsCommand : 'mdi mdi-pin-off-outline' ,
196- iconExportCsvCommand : 'mdi mdi-download' ,
197- iconExportExcelCommand : 'mdi mdi-file-excel-outline' ,
198- iconExportTextDelimitedCommand : 'mdi mdi-download' ,
199- iconRefreshDatasetCommand : 'mdi mdi-sync' ,
200- iconToggleDarkModeCommand : 'mdi mdi-brightness-4' ,
201- iconToggleFilterCommand : 'mdi mdi-flip-vertical' ,
202- iconTogglePreHeaderCommand : 'mdi mdi-flip-vertical' ,
203- menuWidth : 16 ,
204- resizeOnShowHeaderRow : true ,
205- subItemChevronClass : 'mdi mdi-chevron-down mdi-rotate-270' ,
206- headerColumnValueExtractor : pickerHeaderColumnValueExtractor ,
207- } ,
208- headerMenu : {
209- autoAlign : true ,
210- autoAlignOffset : 12 ,
211- minWidth : 140 ,
212- iconClearFilterCommand : 'mdi mdi-filter-remove-outline' ,
213- iconClearSortCommand : 'mdi mdi-sort-variant-off' ,
214- iconFreezeColumns : 'mdi mdi-pin-outline' ,
215- iconUnfreezeColumns : 'mdi mdi-pin-off-outline' ,
216- iconSortAscCommand : 'mdi mdi-sort-ascending' ,
217- iconSortDescCommand : 'mdi mdi-sort-descending' ,
218- iconColumnHideCommand : 'mdi mdi-close' ,
219- iconColumnResizeByContentCommand : 'mdi mdi-arrow-expand-horizontal' ,
220- hideColumnResizeByContentCommand : false ,
221- hideColumnHideCommand : false ,
222- hideClearFilterCommand : false ,
223- hideClearSortCommand : false ,
224- hideFreezeColumnsCommand : true , // opt-in command
225- hideSortCommands : false ,
226- subItemChevronClass : 'mdi mdi-chevron-down mdi-rotate-270' ,
227- } ,
228- headerRowHeight : 35 ,
229- multiColumnSort : true ,
230- numberedMultiColumnSort : true ,
231- tristateMultiColumnSort : false ,
232- sortColNumberInSeparateSpan : true ,
233- suppressActiveCellChangeOnEdit : false ,
234- pagination : {
235- pageSizes : [ 10 , 15 , 20 , 25 , 30 , 40 , 50 , 75 , 100 ] ,
236- pageSize : 25 ,
237- totalItems : 0 ,
238- } ,
2398 // technically speaking the Row Detail requires the process & viewComponent but we'll ignore it just to set certain options
2409 rowDetailView : {
24110 collapseAllOnSort : true ,
@@ -245,42 +14,4 @@ export const GlobalGridOptions: Partial<GridOption> = {
24514 useRowClick : false ,
24615 saveDetailViewOnScroll : false ,
24716 } as RowDetailView ,
248- rowHeight : 35 ,
249- topPanelHeight : 35 ,
250- preHeaderPanelWidth : '100%' , // mostly useful for Draggable Grouping dropzone to take full width
251- translationNamespaceSeparator : ':' ,
252- resetFilterSearchValueAfterOnBeforeCancellation : true ,
253- resizeByContentOnlyOnFirstLoad : true ,
254- resizeByContentOptions : {
255- alwaysRecalculateColumnWidth : false ,
256- cellPaddingWidthInPx : 14 ,
257- defaultRatioForStringType : 0.88 ,
258- formatterPaddingWidthInPx : 0 ,
259- maxItemToInspectCellContentWidth : 1000 ,
260- maxItemToInspectSingleColumnWidthByContent : 5000 ,
261- widthToRemoveFromExceededWidthReadjustment : 50 ,
262- } ,
263- rowTopOffsetRenderType : 'transform' ,
264- treeDataOptions : {
265- exportIndentMarginLeft : 5 ,
266- exportIndentationLeadingChar : '͏͏͏͏͏͏͏͏͏·' ,
267- } as unknown as TreeDataOption ,
26817} ;
269-
270- /**
271- * Value Extractor for both ColumnPicker & GridMenu Picker
272- * when using Column Header Grouping, we'll prefix the column group title
273- * else we'll simply return the column name title
274- */
275- function pickerHeaderColumnValueExtractor ( column : Column , gridOptions ?: GridOptionUniversal ) {
276- let colName = column ?. columnPickerLabel ?? column ?. name ?? '' ;
277- if ( colName instanceof HTMLElement || colName instanceof DocumentFragment ) {
278- colName = colName . textContent || '' ;
279- }
280- const headerGroup = column ?. columnGroup || '' ;
281- const columnGroupSeparator = gridOptions ?. columnGroupSeparator ?? ' - ' ;
282- if ( headerGroup ) {
283- return headerGroup + columnGroupSeparator + colName ;
284- }
285- return colName ;
286- }
0 commit comments