@slickgrid-universal/vanilla-force-bundle 2.4.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/slickgrid-vanilla-bundle.js +1 -1
- package/dist/bundle/slickgrid-vanilla-bundle.js.LICENSE.txt +2 -2
- package/dist/commonjs/index.js +41 -41
- package/dist/commonjs/salesforce-global-grid-options.js +85 -86
- package/dist/commonjs/salesforce-global-grid-options.js.map +1 -1
- package/dist/commonjs/vanilla-force-bundle.js +103 -103
- package/dist/esm/index.js +27 -27
- package/dist/esm/salesforce-global-grid-options.js +82 -83
- package/dist/esm/salesforce-global-grid-options.js.map +1 -1
- package/dist/esm/vanilla-force-bundle.js +99 -99
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/{commonjs → types}/index.d.ts +248 -246
- package/dist/types/index.d.ts.map +1 -0
- package/dist/{esm → types}/salesforce-global-grid-options.d.ts +4 -3
- package/dist/types/salesforce-global-grid-options.d.ts.map +1 -0
- package/dist/{esm → types}/vanilla-force-bundle.d.ts +39 -38
- package/dist/types/vanilla-force-bundle.d.ts.map +1 -0
- package/package.json +19 -19
- package/dist/commonjs/salesforce-global-grid-options.d.ts +0 -3
- package/dist/commonjs/vanilla-force-bundle.d.ts +0 -38
- package/dist/esm/index.d.ts +0 -246
|
@@ -1,84 +1,83 @@
|
|
|
1
|
-
import { EventNamingStyle } from '@slickgrid-universal/event-pub-sub';
|
|
2
|
-
/** Global Grid Options Defaults for Salesforce */
|
|
3
|
-
export const SalesforceGlobalGridOptions = {
|
|
4
|
-
autoEdit: true,
|
|
5
|
-
autoCommitEdit: true,
|
|
6
|
-
autoFixResizeTimeout: 5 * 60 * 60,
|
|
7
|
-
autoFixResizeRequiredGoodCount: 5 * 60 * 60,
|
|
8
|
-
autoFixResizeWhenBrokenStyleDetected: true,
|
|
9
|
-
cellValueCouldBeUndefined: true,
|
|
10
|
-
contextMenu: {
|
|
11
|
-
hideCloseButton: false,
|
|
12
|
-
},
|
|
13
|
-
eventNamingStyle: EventNamingStyle.lowerCaseWithoutOnPrefix,
|
|
14
|
-
compositeEditorOptions: {
|
|
15
|
-
resetEditorButtonCssClass: 'mdi mdi-refresh mdi-15px mdi-v-align-text-top',
|
|
16
|
-
resetFormButtonIconCssClass: 'mdi mdi-refresh mdi-16px mdi-flip-h mdi-v-align-text-top',
|
|
17
|
-
shouldPreviewMassChangeDataset: true,
|
|
18
|
-
},
|
|
19
|
-
datasetIdPropertyName: 'Id',
|
|
20
|
-
emptyDataWarning: {
|
|
21
|
-
message: `<span class="mdi mdi-alert color-warning"></span> No data to display.`,
|
|
22
|
-
},
|
|
23
|
-
enableDeepCopyDatasetOnPageLoad: true,
|
|
24
|
-
enableTextExport: true,
|
|
25
|
-
textExportOptions: {
|
|
26
|
-
exportWithFormatter: true,
|
|
27
|
-
sanitizeDataExport: true,
|
|
28
|
-
},
|
|
29
|
-
enableCellNavigation: true,
|
|
30
|
-
customTooltip: {
|
|
31
|
-
tooltipTextMaxLength: 650,
|
|
32
|
-
},
|
|
33
|
-
enableExcelExport: true,
|
|
34
|
-
excelExportOptions: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
1
|
+
import { EventNamingStyle } from '@slickgrid-universal/event-pub-sub';
|
|
2
|
+
/** Global Grid Options Defaults for Salesforce */
|
|
3
|
+
export const SalesforceGlobalGridOptions = {
|
|
4
|
+
autoEdit: true,
|
|
5
|
+
autoCommitEdit: true,
|
|
6
|
+
autoFixResizeTimeout: 5 * 60 * 60,
|
|
7
|
+
autoFixResizeRequiredGoodCount: 5 * 60 * 60,
|
|
8
|
+
autoFixResizeWhenBrokenStyleDetected: true,
|
|
9
|
+
cellValueCouldBeUndefined: true,
|
|
10
|
+
contextMenu: {
|
|
11
|
+
hideCloseButton: false,
|
|
12
|
+
},
|
|
13
|
+
eventNamingStyle: EventNamingStyle.lowerCaseWithoutOnPrefix,
|
|
14
|
+
compositeEditorOptions: {
|
|
15
|
+
resetEditorButtonCssClass: 'mdi mdi-refresh mdi-15px mdi-v-align-text-top',
|
|
16
|
+
resetFormButtonIconCssClass: 'mdi mdi-refresh mdi-16px mdi-flip-h mdi-v-align-text-top',
|
|
17
|
+
shouldPreviewMassChangeDataset: true,
|
|
18
|
+
},
|
|
19
|
+
datasetIdPropertyName: 'Id',
|
|
20
|
+
emptyDataWarning: {
|
|
21
|
+
message: `<span class="mdi mdi-alert color-warning"></span> No data to display.`,
|
|
22
|
+
},
|
|
23
|
+
enableDeepCopyDatasetOnPageLoad: true,
|
|
24
|
+
enableTextExport: true,
|
|
25
|
+
textExportOptions: {
|
|
26
|
+
exportWithFormatter: true,
|
|
27
|
+
sanitizeDataExport: true,
|
|
28
|
+
},
|
|
29
|
+
enableCellNavigation: true,
|
|
30
|
+
customTooltip: {
|
|
31
|
+
tooltipTextMaxLength: 650,
|
|
32
|
+
},
|
|
33
|
+
enableExcelExport: true,
|
|
34
|
+
excelExportOptions: {
|
|
35
|
+
exportWithFormatter: true,
|
|
36
|
+
mimeType: '',
|
|
37
|
+
sanitizeDataExport: true
|
|
38
|
+
},
|
|
39
|
+
filterTypingDebounce: 250,
|
|
40
|
+
formatterOptions: {
|
|
41
|
+
thousandSeparator: ','
|
|
42
|
+
},
|
|
43
|
+
frozenHeaderWidthCalcDifferential: 2,
|
|
44
|
+
columnPicker: {
|
|
45
|
+
hideForceFitButton: true,
|
|
46
|
+
},
|
|
47
|
+
gridMenu: {
|
|
48
|
+
commandLabels: {
|
|
49
|
+
clearFrozenColumnsCommandKey: 'UNFREEZE_COLUMNS',
|
|
50
|
+
},
|
|
51
|
+
hideTogglePreHeaderCommand: true,
|
|
52
|
+
hideRefreshDatasetCommand: true,
|
|
53
|
+
hideClearFrozenColumnsCommand: false,
|
|
54
|
+
hideForceFitButton: true,
|
|
55
|
+
},
|
|
56
|
+
headerMenu: {
|
|
57
|
+
hideFreezeColumnsCommand: false,
|
|
58
|
+
iconSortAscCommand: 'fa fa-sort-amount-asc mdi mdi-arrow-up',
|
|
59
|
+
iconSortDescCommand: 'fa fa-sort-amount-desc mdi mdi-arrow-down',
|
|
60
|
+
},
|
|
61
|
+
sanitizer: (dirtyHtml) => typeof dirtyHtml === 'string' ? dirtyHtml.replace(/(\b)(on[a-z]+)(\s*)=|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(<)(\/*)(script|script defer)(.*)(>|>">)/gi, '') : dirtyHtml,
|
|
62
|
+
showCustomFooter: true,
|
|
63
|
+
customFooterOptions: {
|
|
64
|
+
hideMetrics: false,
|
|
65
|
+
hideTotalItemCount: false,
|
|
66
|
+
hideLastUpdateTimestamp: true,
|
|
67
|
+
metricTexts: {
|
|
68
|
+
itemsSelectedKey: 'RECORDS_SELECTED',
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
headerRowHeight: 35,
|
|
72
|
+
rowHeight: 33,
|
|
73
|
+
resizeByContentOnlyOnFirstLoad: false,
|
|
74
|
+
resizeByContentOptions: {
|
|
75
|
+
formatterPaddingWidthInPx: 8,
|
|
76
|
+
maxItemToInspectCellContentWidth: 500,
|
|
77
|
+
},
|
|
78
|
+
rowMoveManager: {
|
|
79
|
+
hideRowMoveShadow: false,
|
|
80
|
+
},
|
|
81
|
+
useSalesforceDefaultGridOptions: true,
|
|
82
|
+
};
|
|
84
83
|
//# sourceMappingURL=salesforce-global-grid-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salesforce-global-grid-options.js","sourceRoot":"","sources":["../../src/salesforce-global-grid-options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,kDAAkD;AAClD,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,IAAI;IACpB,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE;IACjC,8BAA8B,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE;IAC3C,oCAAoC,EAAE,IAAI;IAC1C,yBAAyB,EAAE,IAAI;IAC/B,WAAW,EAAE;QACX,eAAe,EAAE,KAAK;KACvB;IACD,gBAAgB,EAAE,gBAAgB,CAAC,wBAAwB;IAC3D,sBAAsB,EAAE;QACtB,yBAAyB,EAAE,+CAA+C;QAC1E,2BAA2B,EAAE,0DAA0D;QACvF,8BAA8B,EAAE,IAAI;KACrC;IACD,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE;QAChB,OAAO,EAAE,uEAAuE;KACjF;IACD,+BAA+B,EAAE,IAAI;IACrC,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE;QACjB,mBAAmB,EAAE,IAAI;QACzB,kBAAkB,EAAE,IAAI;KACzB;IACD,oBAAoB,EAAE,IAAI;IAC1B,aAAa,EAAE;QACb,oBAAoB,EAAE,GAAG;KAC1B;IACD,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE;QAClB,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,IAAI;KACzB;IACD,oBAAoB,EAAE,GAAG;IACzB,gBAAgB,EAAE;QAChB,
|
|
1
|
+
{"version":3,"file":"salesforce-global-grid-options.js","sourceRoot":"","sources":["../../src/salesforce-global-grid-options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,kDAAkD;AAClD,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,IAAI;IACpB,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE;IACjC,8BAA8B,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE;IAC3C,oCAAoC,EAAE,IAAI;IAC1C,yBAAyB,EAAE,IAAI;IAC/B,WAAW,EAAE;QACX,eAAe,EAAE,KAAK;KACvB;IACD,gBAAgB,EAAE,gBAAgB,CAAC,wBAAwB;IAC3D,sBAAsB,EAAE;QACtB,yBAAyB,EAAE,+CAA+C;QAC1E,2BAA2B,EAAE,0DAA0D;QACvF,8BAA8B,EAAE,IAAI;KACrC;IACD,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE;QAChB,OAAO,EAAE,uEAAuE;KACjF;IACD,+BAA+B,EAAE,IAAI;IACrC,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE;QACjB,mBAAmB,EAAE,IAAI;QACzB,kBAAkB,EAAE,IAAI;KACzB;IACD,oBAAoB,EAAE,IAAI;IAC1B,aAAa,EAAE;QACb,oBAAoB,EAAE,GAAG;KAC1B;IACD,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE;QAClB,mBAAmB,EAAE,IAAI;QACzB,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,IAAI;KACzB;IACD,oBAAoB,EAAE,GAAG;IACzB,gBAAgB,EAAE;QAChB,iBAAiB,EAAE,GAAG;KACvB;IACD,iCAAiC,EAAE,CAAC;IACpC,YAAY,EAAE;QACZ,kBAAkB,EAAE,IAAI;KACzB;IACD,QAAQ,EAAE;QACR,aAAa,EAAE;YACb,4BAA4B,EAAE,kBAAkB;SACjD;QACD,0BAA0B,EAAE,IAAI;QAChC,yBAAyB,EAAE,IAAI;QAC/B,6BAA6B,EAAE,KAAK;QACpC,kBAAkB,EAAE,IAAI;KACzB;IACD,UAAU,EAAE;QACV,wBAAwB,EAAE,KAAK;QAC/B,kBAAkB,EAAE,wCAAwC;QAC5D,mBAAmB,EAAE,2CAA2C;KACjE;IACD,SAAS,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,kJAAkJ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;IACvP,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE;QACnB,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,KAAK;QACzB,uBAAuB,EAAE,IAAI;QAC7B,WAAW,EAAE;YACX,gBAAgB,EAAE,kBAAkB;SACrC;KACF;IACD,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE,EAAE;IACb,8BAA8B,EAAE,KAAK;IACrC,sBAAsB,EAAE;QACtB,yBAAyB,EAAE,CAAC;QAC5B,gCAAgC,EAAE,GAAG;KACtC;IACD,cAAc,EAAE;QACd,iBAAiB,EAAE,KAAK;KACzB;IACD,+BAA+B,EAAE,IAAI;CACxB,CAAC"}
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { GlobalGridOptions, } from '@slickgrid-universal/common';
|
|
2
|
-
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
3
|
-
import { SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';
|
|
4
|
-
import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
|
|
5
|
-
import { SlickCustomTooltip } from '@slickgrid-universal/custom-tooltip-plugin';
|
|
6
|
-
import { TextExportService } from '@slickgrid-universal/text-export';
|
|
7
|
-
import { SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
|
|
8
|
-
import { SalesforceGlobalGridOptions } from './salesforce-global-grid-options';
|
|
9
|
-
export class VanillaForceGridBundle extends SlickVanillaGridBundle {
|
|
10
|
-
/**
|
|
11
|
-
* Salesforce Slicker Grid Bundle constructor
|
|
12
|
-
* @param {Object} gridParentContainerElm - div HTML DOM element container
|
|
13
|
-
* @param {Array<Column>} columnDefs - Column Definitions
|
|
14
|
-
* @param {Object} options - Grid Options
|
|
15
|
-
* @param {Array<Object>} dataset - Dataset
|
|
16
|
-
* @param {Array<Object>} hierarchicalDataset - Hierarchical Dataset
|
|
17
|
-
* @param {Object} services - Typically only used for Unit Testing when we want to pass Mocked/Stub Services
|
|
18
|
-
*/
|
|
19
|
-
constructor(gridParentContainerElm, columnDefs, options, dataset, hierarchicalDataset, services) {
|
|
20
|
-
super(gridParentContainerElm, columnDefs, options, dataset, hierarchicalDataset, services);
|
|
21
|
-
}
|
|
22
|
-
mergeGridOptions(gridOptions) {
|
|
23
|
-
var _a;
|
|
24
|
-
const extraOptions = (gridOptions.useSalesforceDefaultGridOptions || ((_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.useSalesforceDefaultGridOptions)) ? SalesforceGlobalGridOptions : {};
|
|
25
|
-
const options = $.extend(true, {}, GlobalGridOptions, extraOptions, gridOptions);
|
|
26
|
-
// also make sure to show the header row if user have enabled filtering
|
|
27
|
-
if (options.enableFiltering && !options.showHeaderRow) {
|
|
28
|
-
options.showHeaderRow = options.enableFiltering;
|
|
29
|
-
}
|
|
30
|
-
// using jQuery extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
|
|
31
|
-
// so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
|
|
32
|
-
// jQuery wrote this on their docs:: On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
|
|
33
|
-
if ((options === null || options === void 0 ? void 0 : options.pagination) && (gridOptions.enablePagination || gridOptions.backendServiceApi) && gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes)) {
|
|
34
|
-
options.pagination.pageSizes = gridOptions.pagination.pageSizes;
|
|
35
|
-
}
|
|
36
|
-
// when we use Pagination on Local Grid, it doesn't seem to work without enableFiltering
|
|
37
|
-
// so we'll enable the filtering but we'll keep the header row hidden
|
|
38
|
-
if (!options.enableFiltering && options.enablePagination && this._isLocalGrid) {
|
|
39
|
-
options.enableFiltering = true;
|
|
40
|
-
options.showHeaderRow = false;
|
|
41
|
-
this._hideHeaderRowAfterPageLoad = true;
|
|
42
|
-
if (this.sharedService) {
|
|
43
|
-
this.sharedService.hideHeaderRowAfterPageLoad = true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return options;
|
|
47
|
-
}
|
|
48
|
-
// --
|
|
49
|
-
// protected functions
|
|
50
|
-
// ------------------
|
|
51
|
-
registerResources() {
|
|
52
|
-
// when using Salesforce, we want the Export to CSV always enabled without registering it
|
|
53
|
-
if (this.gridOptions.enableTextExport) {
|
|
54
|
-
this._registeredResources.push(new TextExportService());
|
|
55
|
-
}
|
|
56
|
-
if (this.gridOptions.enableTextExport) {
|
|
57
|
-
this._registeredResources.push(new ExcelExportService());
|
|
58
|
-
}
|
|
59
|
-
this._registeredResources.push(new SlickCustomTooltip());
|
|
60
|
-
// at this point, we consider all the registered services as external services, anything else registered afterward aren't external
|
|
61
|
-
if (Array.isArray(this._registeredResources)) {
|
|
62
|
-
this.sharedService.externalRegisteredResources = this._registeredResources;
|
|
63
|
-
}
|
|
64
|
-
// push all other Services that we want to be registered
|
|
65
|
-
this._registeredResources.push(this.gridService, this.gridStateService);
|
|
66
|
-
// when using Grouping/DraggableGrouping/Colspan register its Service
|
|
67
|
-
if (this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping) {
|
|
68
|
-
this._registeredResources.push(this.groupingService);
|
|
69
|
-
}
|
|
70
|
-
// when using Tree Data View, register its Service
|
|
71
|
-
if (this.gridOptions.enableTreeData) {
|
|
72
|
-
this._registeredResources.push(this.treeDataService);
|
|
73
|
-
}
|
|
74
|
-
// when user enables translation, we need to translate Headers on first pass & subsequently in the bindDifferentHooks
|
|
75
|
-
if (this.gridOptions.enableTranslate) {
|
|
76
|
-
this.extensionService.translateColumnHeaders();
|
|
77
|
-
}
|
|
78
|
-
// also initialize (render) the empty warning component
|
|
79
|
-
this.slickEmptyWarning = new SlickEmptyWarningComponent();
|
|
80
|
-
this._registeredResources.push(this.slickEmptyWarning);
|
|
81
|
-
// also initialize (render) the pagination component when using the salesforce default options
|
|
82
|
-
// however before adding a new instance, just make sure there isn't one that might have been loaded by calling "registerExternalResources"
|
|
83
|
-
if (this.gridOptions.enableCompositeEditor) {
|
|
84
|
-
if (!this._registeredResources.some((resource => resource instanceof SlickCompositeEditorComponent))) {
|
|
85
|
-
this.slickCompositeEditor = new SlickCompositeEditorComponent();
|
|
86
|
-
this._registeredResources.push(this.slickCompositeEditor);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// bind & initialize all Components/Services that were tagged as enabled
|
|
90
|
-
// register all services by executing their init method and providing them with the Grid object
|
|
91
|
-
if (Array.isArray(this._registeredResources)) {
|
|
92
|
-
for (const resource of this._registeredResources) {
|
|
93
|
-
if (this.slickGrid && typeof resource.init === 'function') {
|
|
94
|
-
resource.init(this.slickGrid, this.universalContainerService);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
1
|
+
import { GlobalGridOptions, } from '@slickgrid-universal/common';
|
|
2
|
+
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
3
|
+
import { SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';
|
|
4
|
+
import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
|
|
5
|
+
import { SlickCustomTooltip } from '@slickgrid-universal/custom-tooltip-plugin';
|
|
6
|
+
import { TextExportService } from '@slickgrid-universal/text-export';
|
|
7
|
+
import { SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
|
|
8
|
+
import { SalesforceGlobalGridOptions } from './salesforce-global-grid-options';
|
|
9
|
+
export class VanillaForceGridBundle extends SlickVanillaGridBundle {
|
|
10
|
+
/**
|
|
11
|
+
* Salesforce Slicker Grid Bundle constructor
|
|
12
|
+
* @param {Object} gridParentContainerElm - div HTML DOM element container
|
|
13
|
+
* @param {Array<Column>} columnDefs - Column Definitions
|
|
14
|
+
* @param {Object} options - Grid Options
|
|
15
|
+
* @param {Array<Object>} dataset - Dataset
|
|
16
|
+
* @param {Array<Object>} hierarchicalDataset - Hierarchical Dataset
|
|
17
|
+
* @param {Object} services - Typically only used for Unit Testing when we want to pass Mocked/Stub Services
|
|
18
|
+
*/
|
|
19
|
+
constructor(gridParentContainerElm, columnDefs, options, dataset, hierarchicalDataset, services) {
|
|
20
|
+
super(gridParentContainerElm, columnDefs, options, dataset, hierarchicalDataset, services);
|
|
21
|
+
}
|
|
22
|
+
mergeGridOptions(gridOptions) {
|
|
23
|
+
var _a;
|
|
24
|
+
const extraOptions = (gridOptions.useSalesforceDefaultGridOptions || ((_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.useSalesforceDefaultGridOptions)) ? SalesforceGlobalGridOptions : {};
|
|
25
|
+
const options = $.extend(true, {}, GlobalGridOptions, extraOptions, gridOptions);
|
|
26
|
+
// also make sure to show the header row if user have enabled filtering
|
|
27
|
+
if (options.enableFiltering && !options.showHeaderRow) {
|
|
28
|
+
options.showHeaderRow = options.enableFiltering;
|
|
29
|
+
}
|
|
30
|
+
// using jQuery extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
|
|
31
|
+
// so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
|
|
32
|
+
// jQuery wrote this on their docs:: On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
|
|
33
|
+
if ((options === null || options === void 0 ? void 0 : options.pagination) && (gridOptions.enablePagination || gridOptions.backendServiceApi) && gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes)) {
|
|
34
|
+
options.pagination.pageSizes = gridOptions.pagination.pageSizes;
|
|
35
|
+
}
|
|
36
|
+
// when we use Pagination on Local Grid, it doesn't seem to work without enableFiltering
|
|
37
|
+
// so we'll enable the filtering but we'll keep the header row hidden
|
|
38
|
+
if (!options.enableFiltering && options.enablePagination && this._isLocalGrid) {
|
|
39
|
+
options.enableFiltering = true;
|
|
40
|
+
options.showHeaderRow = false;
|
|
41
|
+
this._hideHeaderRowAfterPageLoad = true;
|
|
42
|
+
if (this.sharedService) {
|
|
43
|
+
this.sharedService.hideHeaderRowAfterPageLoad = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return options;
|
|
47
|
+
}
|
|
48
|
+
// --
|
|
49
|
+
// protected functions
|
|
50
|
+
// ------------------
|
|
51
|
+
registerResources() {
|
|
52
|
+
// when using Salesforce, we want the Export to CSV always enabled without registering it
|
|
53
|
+
if (this.gridOptions.enableTextExport) {
|
|
54
|
+
this._registeredResources.push(new TextExportService());
|
|
55
|
+
}
|
|
56
|
+
if (this.gridOptions.enableTextExport) {
|
|
57
|
+
this._registeredResources.push(new ExcelExportService());
|
|
58
|
+
}
|
|
59
|
+
this._registeredResources.push(new SlickCustomTooltip());
|
|
60
|
+
// at this point, we consider all the registered services as external services, anything else registered afterward aren't external
|
|
61
|
+
if (Array.isArray(this._registeredResources)) {
|
|
62
|
+
this.sharedService.externalRegisteredResources = this._registeredResources;
|
|
63
|
+
}
|
|
64
|
+
// push all other Services that we want to be registered
|
|
65
|
+
this._registeredResources.push(this.gridService, this.gridStateService);
|
|
66
|
+
// when using Grouping/DraggableGrouping/Colspan register its Service
|
|
67
|
+
if (this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping) {
|
|
68
|
+
this._registeredResources.push(this.groupingService);
|
|
69
|
+
}
|
|
70
|
+
// when using Tree Data View, register its Service
|
|
71
|
+
if (this.gridOptions.enableTreeData) {
|
|
72
|
+
this._registeredResources.push(this.treeDataService);
|
|
73
|
+
}
|
|
74
|
+
// when user enables translation, we need to translate Headers on first pass & subsequently in the bindDifferentHooks
|
|
75
|
+
if (this.gridOptions.enableTranslate) {
|
|
76
|
+
this.extensionService.translateColumnHeaders();
|
|
77
|
+
}
|
|
78
|
+
// also initialize (render) the empty warning component
|
|
79
|
+
this.slickEmptyWarning = new SlickEmptyWarningComponent();
|
|
80
|
+
this._registeredResources.push(this.slickEmptyWarning);
|
|
81
|
+
// also initialize (render) the pagination component when using the salesforce default options
|
|
82
|
+
// however before adding a new instance, just make sure there isn't one that might have been loaded by calling "registerExternalResources"
|
|
83
|
+
if (this.gridOptions.enableCompositeEditor) {
|
|
84
|
+
if (!this._registeredResources.some((resource => resource instanceof SlickCompositeEditorComponent))) {
|
|
85
|
+
this.slickCompositeEditor = new SlickCompositeEditorComponent();
|
|
86
|
+
this._registeredResources.push(this.slickCompositeEditor);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// bind & initialize all Components/Services that were tagged as enabled
|
|
90
|
+
// register all services by executing their init method and providing them with the Grid object
|
|
91
|
+
if (Array.isArray(this._registeredResources)) {
|
|
92
|
+
for (const resource of this._registeredResources) {
|
|
93
|
+
if (this.slickGrid && typeof resource.init === 'function') {
|
|
94
|
+
resource.init(this.slickGrid, this.universalContainerService);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
100
|
//# sourceMappingURL=vanilla-force-bundle.js.map
|