@revolist/revogrid 4.24.1 → 4.24.3
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/cjs/{cell-renderer-DfUCisis.js → cell-renderer-DnOCJ9ge.js} +58 -4
- package/dist/cjs/{column.drag.plugin-Cz-T4y3M.js → column.drag.plugin-0qtjk7uW.js} +38 -18
- package/dist/cjs/{column.service-BNWNiJW3.js → column.service-CD70rNL2.js} +8 -5
- package/dist/cjs/{dimension.helpers-B9HgANnM.js → dimension.helpers-CB5sNw5J.js} +2 -1
- package/dist/cjs/{edit.utils-pKeiYFLJ.js → edit.utils-DDxnq9lw.js} +1 -1
- package/dist/cjs/{header-cell-renderer-DyjOxArm.js → header-cell-renderer-JXYFwayd.js} +1 -1
- package/dist/cjs/{index-DxaSE5uZ.js → index-BF6JDcMr.js} +1 -1
- package/dist/cjs/index.cjs.js +10 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +12 -8
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +5 -5
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +4 -4
- package/dist/cjs/revogr-data_4.cjs.entry.js +6 -4
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +16 -3
- package/dist/cjs/{text-editor-B4W-m-r-.js → text-editor-CvgloQdG.js} +2 -2
- package/dist/cjs/{viewport.store-BscUCiUk.js → viewport.store-Ci8H1bI9.js} +1 -1
- package/dist/collection/components/data/revogr-data.js +2 -0
- package/dist/collection/components/revoGrid/revo-grid.js +1 -1
- package/dist/collection/plugins/filter/filter.panel.js +36 -3
- package/dist/collection/plugins/filter/filter.plugin.js +21 -6
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +12 -7
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +59 -3
- package/dist/collection/plugins/groupingRow/grouping.service.js +7 -4
- package/dist/collection/services/data.provider.js +6 -2
- package/dist/collection/store/dataSource/data.store.js +2 -1
- package/dist/{revo-grid/cell-renderer-CLTRlCa5.js → esm/cell-renderer-BQjko1zB.js} +58 -5
- package/dist/esm/{column.drag.plugin-DKkf7Zqb.js → column.drag.plugin-K0lXn2G3.js} +38 -18
- package/dist/esm/{column.service-C6hByxPy.js → column.service-BnFqXqQG.js} +8 -5
- package/dist/{revo-grid/dimension.helpers-CGKwSvw6.js → esm/dimension.helpers-CXrsUc6f.js} +2 -1
- package/dist/esm/{edit.utils-Dnnbd0xG.js → edit.utils-CXmmCnxE.js} +1 -1
- package/dist/{revo-grid/header-cell-renderer-BMmXRsd_.js → esm/header-cell-renderer-B3mYpZD3.js} +1 -1
- package/dist/{revo-grid/index-Db3qZoW5.js → esm/index-DBqlJITb.js} +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +12 -8
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +5 -5
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +6 -4
- package/dist/esm/revogr-filter-panel.entry.js +16 -3
- package/dist/{revo-grid/text-editor-C3RUSwH5.js → esm/text-editor-DQtz2Y7B.js} +2 -2
- package/dist/{revo-grid/viewport.store-_c579YyM.js → esm/viewport.store-D5jEuhLq.js} +1 -1
- package/dist/{esm/cell-renderer-CLTRlCa5.js → revo-grid/cell-renderer-BQjko1zB.js} +58 -5
- package/dist/revo-grid/{column.drag.plugin-DKkf7Zqb.js → column.drag.plugin-K0lXn2G3.js} +38 -18
- package/dist/revo-grid/{column.service-C6hByxPy.js → column.service-BnFqXqQG.js} +8 -5
- package/dist/{esm/dimension.helpers-CGKwSvw6.js → revo-grid/dimension.helpers-CXrsUc6f.js} +2 -1
- package/dist/revo-grid/{edit.utils-Dnnbd0xG.js → edit.utils-CXmmCnxE.js} +1 -1
- package/dist/{esm/header-cell-renderer-BMmXRsd_.js → revo-grid/header-cell-renderer-B3mYpZD3.js} +1 -1
- package/dist/{esm/index-Db3qZoW5.js → revo-grid/index-DBqlJITb.js} +1 -1
- package/dist/revo-grid/index.esm.js +10 -10
- package/dist/revo-grid/revo-grid.entry.js +12 -8
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +5 -5
- package/dist/revo-grid/revogr-clipboard_3.entry.js +4 -4
- package/dist/revo-grid/revogr-data_4.entry.js +6 -4
- package/dist/revo-grid/revogr-filter-panel.entry.js +16 -3
- package/dist/{esm/text-editor-C3RUSwH5.js → revo-grid/text-editor-DQtz2Y7B.js} +2 -2
- package/dist/{esm/viewport.store-_c579YyM.js → revo-grid/viewport.store-D5jEuhLq.js} +1 -1
- package/dist/types/components.d.ts +11 -0
- package/dist/types/plugins/filter/filter.panel.d.ts +4 -0
- package/dist/types/plugins/filter/filter.plugin.d.ts +1 -0
- package/dist/types/plugins/filter/filter.types.d.ts +5 -0
- package/dist/types/plugins/groupingRow/grouping.row.renderer.d.ts +6 -1
- package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +47 -1
- package/dist/types/plugins/groupingRow/grouping.service.d.ts +1 -1
- package/dist/types/services/data.provider.d.ts +5 -2
- package/dist/types/store/dataSource/data.store.d.ts +3 -1
- package/hydrate/index.js +122 -25
- package/hydrate/index.mjs +122 -25
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var edit_utils = require('./edit.utils-
|
|
7
|
-
var index = require('./index-
|
|
6
|
+
var edit_utils = require('./edit.utils-DDxnq9lw.js');
|
|
7
|
+
var index = require('./index-BF6JDcMr.js');
|
|
8
8
|
|
|
9
9
|
class TextEditor {
|
|
10
10
|
constructor(data, saveCallback) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var dimension_helpers = require('./dimension.helpers-
|
|
6
|
+
var dimension_helpers = require('./dimension.helpers-CB5sNw5J.js');
|
|
7
7
|
|
|
8
8
|
const LETTER_BLOCK_SIZE = 10;
|
|
9
9
|
const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
|
|
@@ -101,6 +101,7 @@ export class RevogrData {
|
|
|
101
101
|
const rowsEls = [];
|
|
102
102
|
const depth = this.dataStore.get('groupingDepth');
|
|
103
103
|
const groupingCustomRenderer = this.dataStore.get('groupingCustomRenderer');
|
|
104
|
+
const groupingCellRenderer = this.dataStore.get('groupingCellRenderer');
|
|
104
105
|
const groupDepth = this.columnService.hasGrouping ? depth : 0;
|
|
105
106
|
const rowRenderOffset = this.viewportRow.get('renderOffset') || 0;
|
|
106
107
|
const colRenderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
@@ -109,6 +110,7 @@ export class RevogrData {
|
|
|
109
110
|
// #region Grouping
|
|
110
111
|
if (isGrouping(dataItem)) {
|
|
111
112
|
const gmodel = Object.assign(Object.assign({}, rgRow), { start: rgRow.start - rowRenderOffset, index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
113
|
+
groupingCellRenderer, additionalData: this.additionalData,
|
|
112
114
|
// Only show expand button if grouping is enabled and not in row headers
|
|
113
115
|
hasExpand: this.columnService.hasGrouping && this.colType !== 'rowHeaders', columnItems: cols, providers: this.providers });
|
|
114
116
|
rowsEls.push(h(GroupingRowRenderer, Object.assign({}, gmodel)));
|
|
@@ -1776,7 +1776,7 @@ export class RevoGridComponent {
|
|
|
1776
1776
|
"mutable": false,
|
|
1777
1777
|
"complexType": {
|
|
1778
1778
|
"original": "GroupingOptions",
|
|
1779
|
-
"resolved": "{ props?: ColumnProp[] | undefined; preserveGroupingOnUpdate?: boolean | undefined; groupLabelTemplate?: GroupLabelTemplateFunc | undefined; } & ExpandedOptions",
|
|
1779
|
+
"resolved": "{ props?: ColumnProp[] | undefined; preserveGroupingOnUpdate?: boolean | undefined; groupLabelTemplate?: GroupLabelTemplateFunc | undefined; groupCellTemplate?: GroupCellTemplateFunc | undefined; } & ExpandedOptions",
|
|
1780
1780
|
"references": {
|
|
1781
1781
|
"GroupingOptions": {
|
|
1782
1782
|
"location": "import",
|
|
@@ -50,6 +50,10 @@ export class FilterPanel {
|
|
|
50
50
|
* If true, closes the filter panel when clicking outside
|
|
51
51
|
*/
|
|
52
52
|
this.closeOnOutsideClick = true;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the filter panel allows the same operator more than once per column.
|
|
55
|
+
*/
|
|
56
|
+
this.allowDuplicateOperators = true;
|
|
53
57
|
this.debouncedApplyFilter = debounce(() => {
|
|
54
58
|
this.filterChange.emit(this.filterItems);
|
|
55
59
|
}, 400);
|
|
@@ -363,11 +367,15 @@ export class FilterPanel {
|
|
|
363
367
|
}
|
|
364
368
|
}
|
|
365
369
|
renderSelectOptions(type, isDefaultTypeRemoved = false) {
|
|
370
|
+
var _a;
|
|
366
371
|
if (!this.changes) {
|
|
367
372
|
return;
|
|
368
373
|
}
|
|
369
374
|
const options = [];
|
|
370
375
|
const prop = this.changes.prop;
|
|
376
|
+
if (prop === undefined) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
371
379
|
const hidden = new Set();
|
|
372
380
|
Object.keys(this.filterItems).forEach((prop) => {
|
|
373
381
|
const values = this.filterItems[prop];
|
|
@@ -377,6 +385,9 @@ export class FilterPanel {
|
|
|
377
385
|
}
|
|
378
386
|
});
|
|
379
387
|
});
|
|
388
|
+
const selectedTypes = new Set(((_a = this.filterItems[prop]) !== null && _a !== void 0 ? _a : [])
|
|
389
|
+
.filter(filter => !filter.hidden)
|
|
390
|
+
.map(filter => filter.type));
|
|
380
391
|
if (!isDefaultTypeRemoved) {
|
|
381
392
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
382
393
|
options.push(h("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
|
|
@@ -384,7 +395,9 @@ export class FilterPanel {
|
|
|
384
395
|
: this.filterNames[defaultType]));
|
|
385
396
|
}
|
|
386
397
|
for (let gIndex in this.changes.filterTypes) {
|
|
387
|
-
const group = this.changes.filterTypes[gIndex].filter(k => !hidden.has(k)
|
|
398
|
+
const group = this.changes.filterTypes[gIndex].filter(k => !hidden.has(k) && (this.allowDuplicateOperators ||
|
|
399
|
+
!selectedTypes.has(k) ||
|
|
400
|
+
(isDefaultTypeRemoved && type === k)));
|
|
388
401
|
if (group.length) {
|
|
389
402
|
options.push(...group.map(k => (h("option", { value: k, selected: type === k }, this.filterNames[k]))));
|
|
390
403
|
options.push(h("option", { disabled: true }));
|
|
@@ -479,7 +492,7 @@ export class FilterPanel {
|
|
|
479
492
|
top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
|
|
480
493
|
};
|
|
481
494
|
const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
|
|
482
|
-
return (h(Host, { key: '
|
|
495
|
+
return (h(Host, { key: '8859c452eb08838f65f18efecbdde7f65fda2b49' }, h("dialog", { key: 'f603067ff0986a9f344cbbf816388d2bbac198bb', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
|
|
483
496
|
e.preventDefault();
|
|
484
497
|
this.onCancel();
|
|
485
498
|
} }, this.changes && [
|
|
@@ -488,7 +501,7 @@ export class FilterPanel {
|
|
|
488
501
|
((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
|
|
489
502
|
h("label", { key: "filter-title" }, capts.title),
|
|
490
503
|
h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
|
|
491
|
-
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '
|
|
504
|
+
h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '2ec0a66918edf91bdde3962b6ec84c89f6f1c8f1', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
|
|
492
505
|
],
|
|
493
506
|
h("slot", { key: "default-slot" }),
|
|
494
507
|
((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
|
|
@@ -634,6 +647,26 @@ export class FilterPanel {
|
|
|
634
647
|
"reflect": false,
|
|
635
648
|
"attribute": "close-on-outside-click",
|
|
636
649
|
"defaultValue": "true"
|
|
650
|
+
},
|
|
651
|
+
"allowDuplicateOperators": {
|
|
652
|
+
"type": "boolean",
|
|
653
|
+
"mutable": false,
|
|
654
|
+
"complexType": {
|
|
655
|
+
"original": "boolean",
|
|
656
|
+
"resolved": "boolean",
|
|
657
|
+
"references": {}
|
|
658
|
+
},
|
|
659
|
+
"required": false,
|
|
660
|
+
"optional": false,
|
|
661
|
+
"docs": {
|
|
662
|
+
"tags": [],
|
|
663
|
+
"text": "Whether the filter panel allows the same operator more than once per column."
|
|
664
|
+
},
|
|
665
|
+
"getter": false,
|
|
666
|
+
"setter": false,
|
|
667
|
+
"reflect": false,
|
|
668
|
+
"attribute": "allow-duplicate-operators",
|
|
669
|
+
"defaultValue": "true"
|
|
637
670
|
}
|
|
638
671
|
};
|
|
639
672
|
}
|
|
@@ -52,13 +52,14 @@ export class FilterPlugin extends BasePlugin {
|
|
|
52
52
|
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
53
53
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
54
54
|
this.filterProp = FILTER_PROP;
|
|
55
|
+
this.allowDuplicateOperators = true;
|
|
55
56
|
if (config) {
|
|
56
57
|
this.initConfig(config);
|
|
57
58
|
}
|
|
58
59
|
const existingNodes = this.revogrid.registerVNode.filter(n => typeof n === 'object' && n.$tag$ !== FILTE_PANEL);
|
|
59
60
|
this.revogrid.registerVNode = [
|
|
60
61
|
...existingNodes,
|
|
61
|
-
h("revogr-filter-panel", { filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, closeOnOutsideClick: config === null || config === void 0 ? void 0 : config.closeFilterPanelOnOutsideClick, ref: e => (this.pop = e) }, ' ', this.extraContent()),
|
|
62
|
+
h("revogr-filter-panel", { filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, closeOnOutsideClick: config === null || config === void 0 ? void 0 : config.closeFilterPanelOnOutsideClick, allowDuplicateOperators: this.allowDuplicateOperators, ref: e => (this.pop = e) }, ' ', this.extraContent()),
|
|
62
63
|
];
|
|
63
64
|
const aftersourceset = async () => {
|
|
64
65
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
@@ -85,15 +86,24 @@ export class FilterPlugin extends BasePlugin {
|
|
|
85
86
|
};
|
|
86
87
|
this.addEventListener('headerclick', e => this.headerclick(e));
|
|
87
88
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
88
|
-
if (!detail
|
|
89
|
-
(typeof detail === 'object' &&
|
|
90
|
-
(!detail.multiFilterItems ||
|
|
91
|
-
!Object.keys(detail.multiFilterItems).length))) {
|
|
89
|
+
if (!detail) {
|
|
92
90
|
this.clearFiltering();
|
|
93
91
|
return;
|
|
94
92
|
}
|
|
95
93
|
if (typeof detail === 'object') {
|
|
96
|
-
|
|
94
|
+
const detailKeys = Object.keys(detail);
|
|
95
|
+
const preserveCurrentFilters = !detailKeys.includes('multiFilterItems') &&
|
|
96
|
+
detailKeys.includes('allowDuplicateOperators');
|
|
97
|
+
this.initConfig(preserveCurrentFilters
|
|
98
|
+
? Object.assign(Object.assign({}, detail), { multiFilterItems: this.multiFilterItems }) : detail);
|
|
99
|
+
if (!detail.multiFilterItems || !Object.keys(detail.multiFilterItems).length) {
|
|
100
|
+
if (preserveCurrentFilters) {
|
|
101
|
+
aftersourceset();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.clearFiltering();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
97
107
|
}
|
|
98
108
|
aftersourceset();
|
|
99
109
|
});
|
|
@@ -107,6 +117,11 @@ export class FilterPlugin extends BasePlugin {
|
|
|
107
117
|
return null;
|
|
108
118
|
}
|
|
109
119
|
initConfig(config) {
|
|
120
|
+
var _a;
|
|
121
|
+
this.allowDuplicateOperators = (_a = config.allowDuplicateOperators) !== null && _a !== void 0 ? _a : true;
|
|
122
|
+
if (this.pop) {
|
|
123
|
+
this.pop.allowDuplicateOperators = this.allowDuplicateOperators;
|
|
124
|
+
}
|
|
110
125
|
if (config.multiFilterItems) {
|
|
111
126
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
112
127
|
}
|
|
@@ -126,7 +126,7 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
126
126
|
* Initiated when need to reapply grouping
|
|
127
127
|
*/
|
|
128
128
|
doSourceUpdate(options) {
|
|
129
|
-
var _a;
|
|
129
|
+
var _a, _b;
|
|
130
130
|
/**
|
|
131
131
|
* Get source without grouping
|
|
132
132
|
* @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
|
|
@@ -138,10 +138,11 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
138
138
|
* Group again
|
|
139
139
|
* @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
|
|
140
140
|
*/
|
|
141
|
-
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props)
|
|
141
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) !== null && _b !== void 0 ? _b : [], expanded);
|
|
142
142
|
const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
|
|
143
|
+
const cellRenderer = options === null || options === void 0 ? void 0 : options.groupCellTemplate;
|
|
143
144
|
// setup source
|
|
144
|
-
this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
|
|
145
|
+
this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer, cellRenderer }, true);
|
|
145
146
|
this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap, sourceWithGroups);
|
|
146
147
|
}
|
|
147
148
|
/**
|
|
@@ -150,17 +151,21 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
150
151
|
* If source came from other plugin
|
|
151
152
|
*/
|
|
152
153
|
onDataSet(data) {
|
|
153
|
-
var _a, _b;
|
|
154
|
+
var _a, _b, _c;
|
|
154
155
|
let preservedExpanded = {};
|
|
155
156
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.preserveGroupingOnUpdate) !== false) {
|
|
156
157
|
let { prevExpanded } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
|
|
157
158
|
preservedExpanded = prevExpanded;
|
|
158
159
|
}
|
|
159
160
|
const source = data.source.filter(s => !isGrouping(s));
|
|
160
|
-
const options = Object.assign(Object.assign({},
|
|
161
|
-
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props)
|
|
161
|
+
const options = Object.assign(Object.assign({}, this.options), { prevExpanded: preservedExpanded });
|
|
162
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, (_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : [], options);
|
|
162
163
|
data.source = sourceWithGroups;
|
|
163
|
-
this.providers.data.setGrouping({
|
|
164
|
+
this.providers.data.setGrouping({
|
|
165
|
+
depth,
|
|
166
|
+
customRenderer: options.groupLabelTemplate,
|
|
167
|
+
cellRenderer: options.groupCellTemplate,
|
|
168
|
+
});
|
|
164
169
|
this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups);
|
|
165
170
|
}
|
|
166
171
|
/**
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h } from "@stencil/core";
|
|
5
5
|
import RowRenderer from "../../components/data/row-renderer";
|
|
6
|
-
import { GROUP_DEPTH, GROUP_EXPANDED, GROUP_EXPAND_BTN, PSEUDO_GROUP_ITEM, GROUP_EXPAND_EVENT, } from "./grouping.const";
|
|
6
|
+
import { GROUP_DEPTH, GROUP_EXPANDED, GROUP_EXPAND_BTN, PSEUDO_GROUP_ITEM, GROUP_EXPAND_EVENT, GROUP_COLUMN_PROP, } from "./grouping.const";
|
|
7
|
+
import { getSourceItem } from "../../store/index";
|
|
8
|
+
import { CELL_CLASS, DATA_COL, DATA_ROW, getCellRaw } from "../../utils";
|
|
9
|
+
import { isGroupingColumn } from "./grouping.service";
|
|
7
10
|
export function expandEvent(e, model, virtualIndex) {
|
|
8
11
|
var _a;
|
|
9
12
|
const event = new CustomEvent(GROUP_EXPAND_EVENT, {
|
|
@@ -16,8 +19,58 @@ export function expandEvent(e, model, virtualIndex) {
|
|
|
16
19
|
});
|
|
17
20
|
(_a = e.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
|
|
18
21
|
}
|
|
22
|
+
export function renderGroupCells(props, { name, expanded, depth, }) {
|
|
23
|
+
const { additionalData, columnItems, groupingCellRenderer, hasExpand, itemIndex, model, providers, size, start, end, } = props;
|
|
24
|
+
if (!groupingCellRenderer) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const renderOffset = providers.viewport.get('renderOffset') || 0;
|
|
28
|
+
const data = providers.data.get('source');
|
|
29
|
+
const rowItem = { itemIndex, size, start, end };
|
|
30
|
+
const onExpand = (event) => expandEvent(event, model, itemIndex);
|
|
31
|
+
return columnItems.map(columnItem => {
|
|
32
|
+
const column = getSourceItem(providers.columns, columnItem.itemIndex);
|
|
33
|
+
if (!column) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const isLabelColumn = isGroupingColumn(column);
|
|
37
|
+
const templateProps = {
|
|
38
|
+
prop: column.prop,
|
|
39
|
+
model,
|
|
40
|
+
data,
|
|
41
|
+
column,
|
|
42
|
+
rowIndex: itemIndex,
|
|
43
|
+
colIndex: columnItem.itemIndex,
|
|
44
|
+
colType: providers.colType,
|
|
45
|
+
type: providers.type,
|
|
46
|
+
value: getCellRaw(model, column),
|
|
47
|
+
providers,
|
|
48
|
+
columnItem,
|
|
49
|
+
rowItem,
|
|
50
|
+
group: {
|
|
51
|
+
name,
|
|
52
|
+
depth,
|
|
53
|
+
expanded,
|
|
54
|
+
prop: model[GROUP_COLUMN_PROP],
|
|
55
|
+
isLabelColumn,
|
|
56
|
+
canExpand: hasExpand,
|
|
57
|
+
onExpand,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return (h("div", { key: columnItem.itemIndex, class: {
|
|
61
|
+
[CELL_CLASS]: true,
|
|
62
|
+
groupingCell: true,
|
|
63
|
+
groupingLabelCell: isLabelColumn,
|
|
64
|
+
}, [DATA_COL]: columnItem.itemIndex,
|
|
65
|
+
[DATA_ROW]: itemIndex, style: {
|
|
66
|
+
width: `${columnItem.size}px`,
|
|
67
|
+
transform: `translateX(${columnItem.start - renderOffset}px)`,
|
|
68
|
+
height: size ? `${size}px` : undefined,
|
|
69
|
+
} }, groupingCellRenderer(h, templateProps, additionalData)));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
19
72
|
export const GroupingRowRenderer = (props) => {
|
|
20
|
-
const { model, itemIndex, hasExpand, groupingCustomRenderer } = props;
|
|
73
|
+
const { model, itemIndex, hasExpand, groupingCustomRenderer, groupingCellRenderer, } = props;
|
|
21
74
|
const name = model[PSEUDO_GROUP_ITEM];
|
|
22
75
|
const expanded = model[GROUP_EXPANDED];
|
|
23
76
|
const depth = parseInt(model[GROUP_DEPTH], 10) || 0;
|
|
@@ -26,6 +79,9 @@ export const GroupingRowRenderer = (props) => {
|
|
|
26
79
|
depth,
|
|
27
80
|
expanded,
|
|
28
81
|
};
|
|
82
|
+
if (groupingCellRenderer) {
|
|
83
|
+
return (h(RowRenderer, Object.assign({ index: props.index, size: props.size, start: props.start }, groupRowAttrs), renderGroupCells(props, { name, expanded, depth })));
|
|
84
|
+
}
|
|
29
85
|
if (groupingCustomRenderer) {
|
|
30
86
|
return (h(RowRenderer, Object.assign({}, props, groupRowAttrs), h("div", { onClick: e => expandEvent(e, model, itemIndex) }, groupingCustomRenderer(h, Object.assign(Object.assign({}, props), { colType: props.providers.colType, name,
|
|
31
87
|
expanded,
|
|
@@ -33,7 +89,7 @@ export const GroupingRowRenderer = (props) => {
|
|
|
33
89
|
}
|
|
34
90
|
return (h(RowRenderer, Object.assign({}, props, groupRowAttrs), hasExpand && [
|
|
35
91
|
h("button", { class: { [GROUP_EXPAND_BTN]: true }, onClick: e => expandEvent(e, model, itemIndex) }, expandSvgIconVNode(expanded)),
|
|
36
|
-
name,
|
|
92
|
+
String(name),
|
|
37
93
|
]));
|
|
38
94
|
};
|
|
39
95
|
export const expandSvgIconVNode = (expanded = false) => {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { GROUP_DEPTH, GROUP_EXPANDED, PSEUDO_GROUP_COLUMN, PSEUDO_GROUP_ITEM, PSEUDO_GROUP_ITEM_ID, PSEUDO_GROUP_ITEM_VALUE, GROUP_ORIGINAL_INDEX, GROUP_COLUMN_PROP, } from "./grouping.const";
|
|
5
|
-
function getGroupValueDefault(item, prop) {
|
|
6
|
-
|
|
5
|
+
function getGroupValueDefault(item, prop, emptyGroupValue) {
|
|
6
|
+
var _a;
|
|
7
|
+
return (_a = item[prop]) !== null && _a !== void 0 ? _a : emptyGroupValue;
|
|
7
8
|
}
|
|
8
9
|
function isDataRow(item) {
|
|
9
10
|
return item != null;
|
|
@@ -109,13 +110,15 @@ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, exp
|
|
|
109
110
|
* @param columnProps - ids of groups
|
|
110
111
|
* @param expanded - potentially expanded items if present
|
|
111
112
|
*/
|
|
112
|
-
export function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue =
|
|
113
|
+
export function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue, emptyGroupValue = '', }) {
|
|
113
114
|
const groupedItems = new Map();
|
|
114
115
|
array.forEach((item, originalIndex) => {
|
|
115
116
|
if (!isDataRow(item)) {
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
|
-
const groupLevelValues = columnProps.map(groupId => getGroupValue
|
|
119
|
+
const groupLevelValues = columnProps.map(groupId => getGroupValue
|
|
120
|
+
? getGroupValue(item, groupId)
|
|
121
|
+
: getGroupValueDefault(item, groupId, emptyGroupValue));
|
|
119
122
|
const lastLevelValue = groupLevelValues.pop();
|
|
120
123
|
let currentGroupLevel = groupedItems;
|
|
121
124
|
groupLevelValues.forEach(value => {
|
|
@@ -93,8 +93,12 @@ export class DataProvider {
|
|
|
93
93
|
const items = this.stores[type].store.get('items');
|
|
94
94
|
this.stores[type].setData({ items: [...items] });
|
|
95
95
|
}
|
|
96
|
-
setGrouping({ depth }, type = 'rgRow') {
|
|
97
|
-
this.stores[type].setData({
|
|
96
|
+
setGrouping({ depth, customRenderer, cellRenderer, }, type = 'rgRow') {
|
|
97
|
+
this.stores[type].setData({
|
|
98
|
+
groupingDepth: depth,
|
|
99
|
+
groupingCustomRenderer: customRenderer,
|
|
100
|
+
groupingCellRenderer: cellRenderer,
|
|
101
|
+
});
|
|
98
102
|
}
|
|
99
103
|
setTrimmed(trimmed, type = 'rgRow') {
|
|
100
104
|
const store = this.stores[type];
|
|
@@ -16,7 +16,7 @@ export class DataStore {
|
|
|
16
16
|
return this.dataStore;
|
|
17
17
|
}
|
|
18
18
|
constructor(type, storeData) {
|
|
19
|
-
const store = (this.dataStore = createStore(Object.assign({ items: [], proxyItems: [], source: [], groupingDepth: 0, groups: {}, type, trimmed: {}, groupingCustomRenderer: undefined }, storeData)));
|
|
19
|
+
const store = (this.dataStore = createStore(Object.assign({ items: [], proxyItems: [], source: [], groupingDepth: 0, groups: {}, type, trimmed: {}, groupingCustomRenderer: undefined, groupingCellRenderer: undefined }, storeData)));
|
|
20
20
|
store.use(proxyPlugin(store));
|
|
21
21
|
store.use(trimmedPlugin(store));
|
|
22
22
|
}
|
|
@@ -56,6 +56,7 @@ export class DataStore {
|
|
|
56
56
|
// if groups are not provided, we will consider that there is only one group with all items
|
|
57
57
|
groups: grouping.groups,
|
|
58
58
|
groupingCustomRenderer: grouping.customRenderer,
|
|
59
|
+
groupingCellRenderer: grouping.cellRenderer,
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h, f as Build } from './index-Chp_81rd.js';
|
|
5
|
-
import { n as DATA_ROW, w as DRAG_ICON_CLASS, x as DRAGGABLE_CLASS } from './dimension.helpers-
|
|
6
|
-
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT,
|
|
5
|
+
import { n as DATA_ROW, b as getSourceItem, m as DATA_COL, C as CELL_CLASS, w as DRAG_ICON_CLASS, x as DRAGGABLE_CLASS } from './dimension.helpers-CXrsUc6f.js';
|
|
6
|
+
import { A as getCellRaw, v as isGroupingColumn, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, j as GROUP_COLUMN_PROP, P as PSEUDO_GROUP_ITEM, h as GROUP_EXPANDED, G as GROUP_DEPTH, O as isRowDragService, B as getCellDataParsed } from './column.service-BnFqXqQG.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders sorting direction and optional additive sorting rank.
|
|
@@ -53,8 +53,58 @@ function expandEvent(e, model, virtualIndex) {
|
|
|
53
53
|
});
|
|
54
54
|
(_a = e.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(event);
|
|
55
55
|
}
|
|
56
|
+
function renderGroupCells(props, { name, expanded, depth, }) {
|
|
57
|
+
const { additionalData, columnItems, groupingCellRenderer, hasExpand, itemIndex, model, providers, size, start, end, } = props;
|
|
58
|
+
if (!groupingCellRenderer) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
const renderOffset = providers.viewport.get('renderOffset') || 0;
|
|
62
|
+
const data = providers.data.get('source');
|
|
63
|
+
const rowItem = { itemIndex, size, start, end };
|
|
64
|
+
const onExpand = (event) => expandEvent(event, model, itemIndex);
|
|
65
|
+
return columnItems.map(columnItem => {
|
|
66
|
+
const column = getSourceItem(providers.columns, columnItem.itemIndex);
|
|
67
|
+
if (!column) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const isLabelColumn = isGroupingColumn(column);
|
|
71
|
+
const templateProps = {
|
|
72
|
+
prop: column.prop,
|
|
73
|
+
model,
|
|
74
|
+
data,
|
|
75
|
+
column,
|
|
76
|
+
rowIndex: itemIndex,
|
|
77
|
+
colIndex: columnItem.itemIndex,
|
|
78
|
+
colType: providers.colType,
|
|
79
|
+
type: providers.type,
|
|
80
|
+
value: getCellRaw(model, column),
|
|
81
|
+
providers,
|
|
82
|
+
columnItem,
|
|
83
|
+
rowItem,
|
|
84
|
+
group: {
|
|
85
|
+
name,
|
|
86
|
+
depth,
|
|
87
|
+
expanded,
|
|
88
|
+
prop: model[GROUP_COLUMN_PROP],
|
|
89
|
+
isLabelColumn,
|
|
90
|
+
canExpand: hasExpand,
|
|
91
|
+
onExpand,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
return (h("div", { key: columnItem.itemIndex, class: {
|
|
95
|
+
[CELL_CLASS]: true,
|
|
96
|
+
groupingCell: true,
|
|
97
|
+
groupingLabelCell: isLabelColumn,
|
|
98
|
+
}, [DATA_COL]: columnItem.itemIndex,
|
|
99
|
+
[DATA_ROW]: itemIndex, style: {
|
|
100
|
+
width: `${columnItem.size}px`,
|
|
101
|
+
transform: `translateX(${columnItem.start - renderOffset}px)`,
|
|
102
|
+
height: size ? `${size}px` : undefined,
|
|
103
|
+
} }, groupingCellRenderer(h, templateProps, additionalData)));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
56
106
|
const GroupingRowRenderer = (props) => {
|
|
57
|
-
const { model, itemIndex, hasExpand, groupingCustomRenderer } = props;
|
|
107
|
+
const { model, itemIndex, hasExpand, groupingCustomRenderer, groupingCellRenderer, } = props;
|
|
58
108
|
const name = model[PSEUDO_GROUP_ITEM];
|
|
59
109
|
const expanded = model[GROUP_EXPANDED];
|
|
60
110
|
const depth = parseInt(model[GROUP_DEPTH], 10) || 0;
|
|
@@ -63,6 +113,9 @@ const GroupingRowRenderer = (props) => {
|
|
|
63
113
|
depth,
|
|
64
114
|
expanded,
|
|
65
115
|
};
|
|
116
|
+
if (groupingCellRenderer) {
|
|
117
|
+
return (h(RowRenderer, Object.assign({ index: props.index, size: props.size, start: props.start }, groupRowAttrs), renderGroupCells(props, { name, expanded, depth })));
|
|
118
|
+
}
|
|
66
119
|
if (groupingCustomRenderer) {
|
|
67
120
|
return (h(RowRenderer, Object.assign({}, props, groupRowAttrs), h("div", { onClick: e => expandEvent(e, model, itemIndex) }, groupingCustomRenderer(h, Object.assign(Object.assign({}, props), { colType: props.providers.colType, name,
|
|
68
121
|
expanded,
|
|
@@ -70,7 +123,7 @@ const GroupingRowRenderer = (props) => {
|
|
|
70
123
|
}
|
|
71
124
|
return (h(RowRenderer, Object.assign({}, props, groupRowAttrs), hasExpand && [
|
|
72
125
|
h("button", { class: { [GROUP_EXPAND_BTN]: true }, onClick: e => expandEvent(e, model, itemIndex) }, expandSvgIconVNode(expanded)),
|
|
73
|
-
name,
|
|
126
|
+
String(name),
|
|
74
127
|
]));
|
|
75
128
|
};
|
|
76
129
|
const expandSvgIconVNode = (expanded = false) => {
|
|
@@ -115,4 +168,4 @@ const CellRenderer = ({ renderProps, cellProps, }) => {
|
|
|
115
168
|
return (h("div", Object.assign({}, cellProps, { redraw: render }), render()));
|
|
116
169
|
};
|
|
117
170
|
|
|
118
|
-
export { CellRenderer as C, GroupingRowRenderer as G, PADDING_DEPTH as P, RowRenderer as R, SortingSign as S, expandSvgIconVNode as a, expandEvent as e };
|
|
171
|
+
export { CellRenderer as C, GroupingRowRenderer as G, PADDING_DEPTH as P, RowRenderer as R, SortingSign as S, expandSvgIconVNode as a, expandEvent as e, renderGroupCells as r };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, j as GROUP_COLUMN_PROP, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-
|
|
5
|
-
import { K as createStore, l as setStore, i as calculateDimensionData, L as identity, N as isArray, b as getSourceItem, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-
|
|
6
|
-
import { j as calculateRowHeaderSize } from './viewport.store-
|
|
7
|
-
import { g as getScrollbarSize, t as timeout } from './index-
|
|
4
|
+
import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, j as GROUP_COLUMN_PROP, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-BnFqXqQG.js';
|
|
5
|
+
import { K as createStore, l as setStore, i as calculateDimensionData, L as identity, N as isArray, b as getSourceItem, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-CXrsUc6f.js';
|
|
6
|
+
import { j as calculateRowHeaderSize } from './viewport.store-D5jEuhLq.js';
|
|
7
|
+
import { g as getScrollbarSize, t as timeout } from './index-DBqlJITb.js';
|
|
8
8
|
import { h } from './index-Chp_81rd.js';
|
|
9
9
|
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-B-RBiF67.js';
|
|
10
10
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
11
|
-
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-
|
|
11
|
+
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-B3mYpZD3.js';
|
|
12
12
|
|
|
13
13
|
function calculateRealSize({ count, originItemSize, sizes, }) {
|
|
14
14
|
const safeCount = Math.max(0, count);
|
|
@@ -1274,13 +1274,14 @@ class FilterPlugin extends BasePlugin {
|
|
|
1274
1274
|
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
1275
1275
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
1276
1276
|
this.filterProp = FILTER_PROP;
|
|
1277
|
+
this.allowDuplicateOperators = true;
|
|
1277
1278
|
if (config) {
|
|
1278
1279
|
this.initConfig(config);
|
|
1279
1280
|
}
|
|
1280
1281
|
const existingNodes = this.revogrid.registerVNode.filter(n => typeof n === 'object' && n.$tag$ !== FILTE_PANEL);
|
|
1281
1282
|
this.revogrid.registerVNode = [
|
|
1282
1283
|
...existingNodes,
|
|
1283
|
-
h("revogr-filter-panel", { filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, closeOnOutsideClick: config === null || config === void 0 ? void 0 : config.closeFilterPanelOnOutsideClick, ref: e => (this.pop = e) }, ' ', this.extraContent()),
|
|
1284
|
+
h("revogr-filter-panel", { filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, closeOnOutsideClick: config === null || config === void 0 ? void 0 : config.closeFilterPanelOnOutsideClick, allowDuplicateOperators: this.allowDuplicateOperators, ref: e => (this.pop = e) }, ' ', this.extraContent()),
|
|
1284
1285
|
];
|
|
1285
1286
|
const aftersourceset = async () => {
|
|
1286
1287
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
@@ -1307,15 +1308,24 @@ class FilterPlugin extends BasePlugin {
|
|
|
1307
1308
|
};
|
|
1308
1309
|
this.addEventListener('headerclick', e => this.headerclick(e));
|
|
1309
1310
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
1310
|
-
if (!detail
|
|
1311
|
-
(typeof detail === 'object' &&
|
|
1312
|
-
(!detail.multiFilterItems ||
|
|
1313
|
-
!Object.keys(detail.multiFilterItems).length))) {
|
|
1311
|
+
if (!detail) {
|
|
1314
1312
|
this.clearFiltering();
|
|
1315
1313
|
return;
|
|
1316
1314
|
}
|
|
1317
1315
|
if (typeof detail === 'object') {
|
|
1318
|
-
|
|
1316
|
+
const detailKeys = Object.keys(detail);
|
|
1317
|
+
const preserveCurrentFilters = !detailKeys.includes('multiFilterItems') &&
|
|
1318
|
+
detailKeys.includes('allowDuplicateOperators');
|
|
1319
|
+
this.initConfig(preserveCurrentFilters
|
|
1320
|
+
? Object.assign(Object.assign({}, detail), { multiFilterItems: this.multiFilterItems }) : detail);
|
|
1321
|
+
if (!detail.multiFilterItems || !Object.keys(detail.multiFilterItems).length) {
|
|
1322
|
+
if (preserveCurrentFilters) {
|
|
1323
|
+
aftersourceset();
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
this.clearFiltering();
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1319
1329
|
}
|
|
1320
1330
|
aftersourceset();
|
|
1321
1331
|
});
|
|
@@ -1329,6 +1339,11 @@ class FilterPlugin extends BasePlugin {
|
|
|
1329
1339
|
return null;
|
|
1330
1340
|
}
|
|
1331
1341
|
initConfig(config) {
|
|
1342
|
+
var _a;
|
|
1343
|
+
this.allowDuplicateOperators = (_a = config.allowDuplicateOperators) !== null && _a !== void 0 ? _a : true;
|
|
1344
|
+
if (this.pop) {
|
|
1345
|
+
this.pop.allowDuplicateOperators = this.allowDuplicateOperators;
|
|
1346
|
+
}
|
|
1332
1347
|
if (config.multiFilterItems) {
|
|
1333
1348
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
1334
1349
|
}
|
|
@@ -2452,7 +2467,7 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2452
2467
|
* Initiated when need to reapply grouping
|
|
2453
2468
|
*/
|
|
2454
2469
|
doSourceUpdate(options) {
|
|
2455
|
-
var _a;
|
|
2470
|
+
var _a, _b;
|
|
2456
2471
|
/**
|
|
2457
2472
|
* Get source without grouping
|
|
2458
2473
|
* @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
|
|
@@ -2464,10 +2479,11 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2464
2479
|
* Group again
|
|
2465
2480
|
* @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
|
|
2466
2481
|
*/
|
|
2467
|
-
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props)
|
|
2482
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) !== null && _b !== void 0 ? _b : [], expanded);
|
|
2468
2483
|
const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
|
|
2484
|
+
const cellRenderer = options === null || options === void 0 ? void 0 : options.groupCellTemplate;
|
|
2469
2485
|
// setup source
|
|
2470
|
-
this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
|
|
2486
|
+
this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer, cellRenderer }, true);
|
|
2471
2487
|
this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap, sourceWithGroups);
|
|
2472
2488
|
}
|
|
2473
2489
|
/**
|
|
@@ -2476,17 +2492,21 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2476
2492
|
* If source came from other plugin
|
|
2477
2493
|
*/
|
|
2478
2494
|
onDataSet(data) {
|
|
2479
|
-
var _a, _b;
|
|
2495
|
+
var _a, _b, _c;
|
|
2480
2496
|
let preservedExpanded = {};
|
|
2481
2497
|
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.preserveGroupingOnUpdate) !== false) {
|
|
2482
2498
|
let { prevExpanded } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
|
|
2483
2499
|
preservedExpanded = prevExpanded;
|
|
2484
2500
|
}
|
|
2485
2501
|
const source = data.source.filter(s => !isGrouping(s));
|
|
2486
|
-
const options = Object.assign(Object.assign({},
|
|
2487
|
-
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props)
|
|
2502
|
+
const options = Object.assign(Object.assign({}, this.options), { prevExpanded: preservedExpanded });
|
|
2503
|
+
const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, (_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : [], options);
|
|
2488
2504
|
data.source = sourceWithGroups;
|
|
2489
|
-
this.providers.data.setGrouping({
|
|
2505
|
+
this.providers.data.setGrouping({
|
|
2506
|
+
depth,
|
|
2507
|
+
customRenderer: options.groupLabelTemplate,
|
|
2508
|
+
cellRenderer: options.groupCellTemplate,
|
|
2509
|
+
});
|
|
2490
2510
|
this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups);
|
|
2491
2511
|
}
|
|
2492
2512
|
/**
|