@revolist/revogrid 4.9.12 → 4.9.16
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/{column.drag.plugin-e636b5af.js → column.drag.plugin-a5cc161a.js} +106 -186
- package/dist/cjs/column.drag.plugin-a5cc161a.js.map +1 -0
- package/dist/cjs/{column.service-15c8352d.js → column.service-d45dbb3f.js} +141 -14
- package/dist/cjs/column.service-d45dbb3f.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-375a879f.js → header-cell-renderer-28f7f21d.js} +14 -14
- package/dist/cjs/header-cell-renderer-28f7f21d.js.map +1 -0
- package/dist/cjs/index.cjs.js +15 -13
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +87 -23
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +3 -3
- package/dist/cjs/revogr-data_4.cjs.entry.js +9 -9
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +43 -27
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/data/cell-renderer.js +2 -2
- package/dist/collection/components/data/cell-renderer.js.map +1 -1
- package/dist/collection/components/data/column.service.js +5 -14
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/header/header-cell-renderer.js +5 -4
- package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
- package/dist/collection/components/header/header-renderer.js +2 -2
- package/dist/collection/components/header/header-renderer.js.map +1 -1
- package/dist/collection/components/header/resizable.directive.js.map +1 -1
- package/dist/collection/components/header/resizable.element.js +9 -10
- package/dist/collection/components/header/resizable.element.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +3 -3
- package/dist/collection/components/header/revogr-header.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js +70 -12
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +1 -1
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +1 -1
- package/dist/collection/components/vnode/vnode-converter.js +1 -1
- package/dist/collection/global/global.js +2 -2
- package/dist/collection/global/global.js.map +1 -1
- package/dist/collection/plugins/filter/{filter.service.js → filter.indexed.js} +18 -18
- package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
- package/dist/collection/plugins/filter/filter.panel.js +58 -63
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +86 -40
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/plugins/wcag/index.js +7 -1
- package/dist/collection/plugins/wcag/index.js.map +1 -1
- package/dist/collection/serve/controller.js +1 -1
- package/dist/collection/themeManager/theme.compact.js +1 -1
- package/dist/collection/themeManager/theme.compact.js.map +1 -1
- package/dist/collection/themeManager/theme.default.js +1 -1
- package/dist/collection/themeManager/theme.default.js.map +1 -1
- package/dist/collection/themeManager/theme.material.js +1 -1
- package/dist/collection/themeManager/theme.material.js.map +1 -1
- package/dist/collection/themeManager/theme.service.js +9 -9
- package/dist/collection/themeManager/theme.service.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/utils/column.utils.js +10 -0
- package/dist/collection/utils/column.utils.js.map +1 -1
- package/dist/esm/{column.drag.plugin-30dc4e24.js → column.drag.plugin-18125693.js} +107 -181
- package/dist/esm/column.drag.plugin-18125693.js.map +1 -0
- package/dist/esm/{column.service-414e9cba.js → column.service-00a51837.js} +136 -16
- package/dist/esm/column.service-00a51837.js.map +1 -0
- package/dist/esm/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
- package/dist/esm/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +14 -14
- package/dist/esm/header-cell-renderer-6d89f141.js.map +1 -0
- package/dist/esm/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
- package/dist/esm/{index-74b9801b.js.map → index-00cb6ac1.js.map} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
- package/dist/esm/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +82 -18
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +8 -8
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +11 -11
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +43 -27
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
- package/dist/esm/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +1 -1
- package/dist/esm/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +3 -3
- package/dist/esm/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +1 -1
- package/dist/esm/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
- package/dist/esm/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +1 -1
- package/dist/revo-grid/column.drag.plugin-18125693.js +5 -0
- package/dist/revo-grid/column.drag.plugin-18125693.js.map +1 -0
- package/dist/revo-grid/column.service-00a51837.js +5 -0
- package/dist/revo-grid/column.service-00a51837.js.map +1 -0
- package/dist/revo-grid/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-6d89f141.js.map +1 -0
- package/dist/revo-grid/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
- package/dist/revo-grid/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +2 -2
- package/dist/revo-grid/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
- package/dist/types/components/data/column.service.d.ts +1 -2
- package/dist/types/components/header/header-cell-renderer.d.ts +7 -9
- package/dist/types/components/header/header-renderer.d.ts +2 -3
- package/dist/types/components/header/resizable.directive.d.ts +0 -1
- package/dist/types/components/header/resizable.element.d.ts +3 -2
- package/dist/types/components/revoGrid/revo-grid.d.ts +3 -3
- package/dist/types/components.d.ts +2 -8
- package/dist/types/plugins/filter/{filter.service.d.ts → filter.indexed.d.ts} +2 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +3 -27
- package/dist/types/plugins/filter/filter.plugin.d.ts +14 -47
- package/dist/types/plugins/filter/filter.types.d.ts +86 -1
- package/dist/types/themeManager/theme.compact.d.ts +1 -1
- package/dist/types/themeManager/theme.default.d.ts +1 -1
- package/dist/types/themeManager/theme.material.d.ts +1 -1
- package/dist/types/themeManager/theme.service.d.ts +2 -2
- package/dist/types/types/interfaces.d.ts +9 -12
- package/dist/types/utils/column.utils.d.ts +3 -1
- package/hydrate/index.js +823 -698
- package/hydrate/index.mjs +823 -698
- package/package.json +1 -1
- package/standalone/column.service.js +136 -15
- package/standalone/column.service.js.map +1 -1
- package/standalone/dimension.helpers.js +2 -216
- package/standalone/dimension.helpers.js.map +1 -1
- package/standalone/index.js +7 -6
- package/standalone/index.js.map +1 -1
- package/standalone/index2.js +2 -84
- package/standalone/index2.js.map +1 -1
- package/standalone/platform.js +89 -0
- package/standalone/platform.js.map +1 -0
- package/standalone/{data.store.js → reduce.js} +252 -38
- package/standalone/reduce.js.map +1 -0
- package/standalone/revo-grid.js +183 -192
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +3 -2
- package/standalone/revogr-data2.js.map +1 -1
- package/standalone/revogr-edit2.js +2 -1
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-filter-panel.js +43 -28
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-focus2.js +1 -1
- package/standalone/revogr-header2.js +20 -20
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +3 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +2 -2
- package/standalone/revogr-scroll-virtual2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/standalone/vnode-converter.js +1 -1
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +0 -1
- package/dist/cjs/column.service-15c8352d.js.map +0 -1
- package/dist/cjs/header-cell-renderer-375a879f.js.map +0 -1
- package/dist/collection/plugins/filter/filter.service.js.map +0 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/esm/column.service-414e9cba.js.map +0 -1
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +0 -5
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/revo-grid/column.service-414e9cba.js +0 -5
- package/dist/revo-grid/column.service-414e9cba.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +0 -1
- package/standalone/data.store.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +0 -0
- /package/dist/revo-grid/{index-74b9801b.js.map → index-00cb6ac1.js.map} +0 -0
- /package/dist/revo-grid/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +0 -0
- /package/dist/revo-grid/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +0 -0
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
const index = require('./index-28b6fdfb.js');
|
|
7
|
+
const column_service = require('./column.service-d45dbb3f.js');
|
|
7
8
|
const rowHeaderUtils = require('./row-header-utils-22ffee54.js');
|
|
8
9
|
const debounce = require('./debounce-cb5f4e35.js');
|
|
9
10
|
const index$1 = require('./index-10d10c55.js');
|
|
10
|
-
const column_service = require('./column.service-15c8352d.js');
|
|
11
11
|
const filter_button = require('./filter.button-afb16244.js');
|
|
12
|
-
const headerCellRenderer = require('./header-cell-renderer-
|
|
12
|
+
const headerCellRenderer = require('./header-cell-renderer-28f7f21d.js');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Storing pre-calculated
|
|
@@ -215,125 +215,6 @@ class BasePlugin {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
function getColumnType(rgCol) {
|
|
219
|
-
if (rgCol.pin) {
|
|
220
|
-
return rgCol.pin;
|
|
221
|
-
}
|
|
222
|
-
return 'rgCol';
|
|
223
|
-
}
|
|
224
|
-
function getColumnSizes(cols) {
|
|
225
|
-
const res = {};
|
|
226
|
-
for (const [i, c] of cols.entries()) {
|
|
227
|
-
if (c.size) {
|
|
228
|
-
res[i] = c.size;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return res;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Check if column is grouping column
|
|
235
|
-
*/
|
|
236
|
-
function isColGrouping(colData) {
|
|
237
|
-
return !!colData.children;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* This function is used to create a collection of columns.
|
|
241
|
-
*/
|
|
242
|
-
function getColumns(columns, level = 0, types) {
|
|
243
|
-
const collection = {
|
|
244
|
-
// columns as they are in stores per type
|
|
245
|
-
columns: {
|
|
246
|
-
rgCol: [],
|
|
247
|
-
colPinStart: [],
|
|
248
|
-
colPinEnd: [],
|
|
249
|
-
},
|
|
250
|
-
// columns indexed by prop for quick access
|
|
251
|
-
columnByProp: {},
|
|
252
|
-
// column grouping
|
|
253
|
-
columnGrouping: {
|
|
254
|
-
rgCol: [],
|
|
255
|
-
colPinStart: [],
|
|
256
|
-
colPinEnd: [],
|
|
257
|
-
},
|
|
258
|
-
// max depth level for column grouping
|
|
259
|
-
maxLevel: level,
|
|
260
|
-
// sorting
|
|
261
|
-
sort: {},
|
|
262
|
-
};
|
|
263
|
-
return index.reduce_1(columns, (res, colData) => {
|
|
264
|
-
// Grouped column
|
|
265
|
-
if (isColGrouping(colData)) {
|
|
266
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
267
|
-
}
|
|
268
|
-
// Regular column
|
|
269
|
-
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
270
|
-
// Regular column, no Pin
|
|
271
|
-
if (!regularColumn.pin) {
|
|
272
|
-
res.columns.rgCol.push(regularColumn);
|
|
273
|
-
// Pin
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
res.columns[regularColumn.pin].push(regularColumn);
|
|
277
|
-
}
|
|
278
|
-
if (regularColumn.order) {
|
|
279
|
-
res.sort[regularColumn.prop] = regularColumn;
|
|
280
|
-
}
|
|
281
|
-
// it's possible that some columns have same prop, but better to avoid it
|
|
282
|
-
if (!res.columnByProp[regularColumn.prop]) {
|
|
283
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
284
|
-
}
|
|
285
|
-
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
286
|
-
// trigger setup hook if present
|
|
287
|
-
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
288
|
-
return res;
|
|
289
|
-
}, collection);
|
|
290
|
-
}
|
|
291
|
-
function gatherGroup(res, colData, collection, level = 0) {
|
|
292
|
-
// group template
|
|
293
|
-
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
294
|
-
// check columns for update
|
|
295
|
-
for (let k in collection.columns) {
|
|
296
|
-
const key = k;
|
|
297
|
-
const resultItem = res.columns[key];
|
|
298
|
-
const collectionItem = collection.columns[key];
|
|
299
|
-
// if column data
|
|
300
|
-
if (index.isArray_1(resultItem) && index.isArray_1(collectionItem)) {
|
|
301
|
-
// fill columns
|
|
302
|
-
resultItem.push(...collectionItem);
|
|
303
|
-
// fill grouping
|
|
304
|
-
if (collectionItem.length) {
|
|
305
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
// merge column groupings
|
|
310
|
-
for (let k in collection.columnGrouping) {
|
|
311
|
-
const key = k;
|
|
312
|
-
const collectionItem = collection.columnGrouping[key];
|
|
313
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
314
|
-
}
|
|
315
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
316
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
317
|
-
return res;
|
|
318
|
-
}
|
|
319
|
-
function findColumn(columns, prop) {
|
|
320
|
-
for (const c of columns) {
|
|
321
|
-
if (isColGrouping(c)) {
|
|
322
|
-
const found = findColumn(c.children, prop);
|
|
323
|
-
if (found) {
|
|
324
|
-
return found;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
else if (c.prop === prop) {
|
|
328
|
-
return c;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return undefined;
|
|
332
|
-
}
|
|
333
|
-
function getColumnByProp(columns, prop) {
|
|
334
|
-
return findColumn(columns, prop);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
218
|
/**
|
|
338
219
|
* Plugin module for revo-grid grid system
|
|
339
220
|
* Add support for automatic column resize
|
|
@@ -376,7 +257,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
|
|
|
376
257
|
this.columnSet(columns);
|
|
377
258
|
};
|
|
378
259
|
const headerDblClick = ({ detail }) => {
|
|
379
|
-
const type = getColumnType(detail.column);
|
|
260
|
+
const type = column_service.getColumnType(detail.column);
|
|
380
261
|
const size = this.getColumnSize(detail.index, type);
|
|
381
262
|
if (size) {
|
|
382
263
|
this.providers.dimension.setCustomSizes(type, {
|
|
@@ -1112,23 +993,7 @@ const notContains = (value, extra) => {
|
|
|
1112
993
|
notContains.extra = 'input';
|
|
1113
994
|
contains.extra = 'input';
|
|
1114
995
|
|
|
1115
|
-
const
|
|
1116
|
-
none: 'None',
|
|
1117
|
-
empty: 'Not set',
|
|
1118
|
-
notEmpty: 'Set',
|
|
1119
|
-
eq: 'Equal',
|
|
1120
|
-
notEq: 'Not equal',
|
|
1121
|
-
begins: 'Begins with',
|
|
1122
|
-
contains: 'Contains',
|
|
1123
|
-
notContains: 'Does not contain',
|
|
1124
|
-
eqN: '=',
|
|
1125
|
-
neqN: '!=',
|
|
1126
|
-
gt: '>',
|
|
1127
|
-
gte: '>=',
|
|
1128
|
-
lt: '<',
|
|
1129
|
-
lte: '<=',
|
|
1130
|
-
};
|
|
1131
|
-
const filterEntities = {
|
|
996
|
+
const filterCoreFunctionsIndexedByType = {
|
|
1132
997
|
none: () => true,
|
|
1133
998
|
empty: notSet,
|
|
1134
999
|
notEmpty: set,
|
|
@@ -1148,7 +1013,37 @@ const filterTypes = {
|
|
|
1148
1013
|
string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
|
|
1149
1014
|
number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
|
|
1150
1015
|
};
|
|
1016
|
+
const filterNames = {
|
|
1017
|
+
none: 'None',
|
|
1018
|
+
empty: 'Not set',
|
|
1019
|
+
notEmpty: 'Set',
|
|
1020
|
+
eq: 'Equal',
|
|
1021
|
+
notEq: 'Not equal',
|
|
1022
|
+
begins: 'Begins with',
|
|
1023
|
+
contains: 'Contains',
|
|
1024
|
+
notContains: 'Does not contain',
|
|
1025
|
+
eqN: '=',
|
|
1026
|
+
neqN: '!=',
|
|
1027
|
+
gt: '>',
|
|
1028
|
+
gte: '>=',
|
|
1029
|
+
lt: '<',
|
|
1030
|
+
lte: '<=',
|
|
1031
|
+
};
|
|
1151
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* @typedef ColumnFilterConfig
|
|
1035
|
+
* @type {object}
|
|
1036
|
+
* @property {FilterCollection|undefined} collection - preserved filter data
|
|
1037
|
+
* @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
|
|
1038
|
+
* @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
|
|
1039
|
+
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
1040
|
+
* @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
|
|
1041
|
+
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.
|
|
1042
|
+
* A way to define your own filter types per column
|
|
1043
|
+
*/
|
|
1044
|
+
/**
|
|
1045
|
+
* @internal
|
|
1046
|
+
*/
|
|
1152
1047
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
1153
1048
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
1154
1049
|
class FilterPlugin extends BasePlugin {
|
|
@@ -1158,14 +1053,13 @@ class FilterPlugin extends BasePlugin {
|
|
|
1158
1053
|
this.revogrid = revogrid;
|
|
1159
1054
|
this.filterCollection = {};
|
|
1160
1055
|
this.multiFilterItems = {};
|
|
1161
|
-
this.
|
|
1162
|
-
this.
|
|
1163
|
-
this.
|
|
1056
|
+
this.filterByType = Object.assign({}, filterTypes);
|
|
1057
|
+
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
1058
|
+
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
1164
1059
|
this.filterProp = filter_button.FILTER_PROP;
|
|
1165
1060
|
if (config) {
|
|
1166
1061
|
this.initConfig(config);
|
|
1167
1062
|
}
|
|
1168
|
-
const headerclick = (e) => this.headerclick(e);
|
|
1169
1063
|
const aftersourceset = async () => {
|
|
1170
1064
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
1171
1065
|
if (filterCollectionProps.length > 0) {
|
|
@@ -1185,7 +1079,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1185
1079
|
}
|
|
1186
1080
|
await this.runFiltering();
|
|
1187
1081
|
};
|
|
1188
|
-
this.addEventListener('headerclick', headerclick);
|
|
1082
|
+
this.addEventListener('headerclick', (e) => this.headerclick(e));
|
|
1189
1083
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
1190
1084
|
if (!detail) {
|
|
1191
1085
|
this.clearFiltering();
|
|
@@ -1198,27 +1092,29 @@ class FilterPlugin extends BasePlugin {
|
|
|
1198
1092
|
});
|
|
1199
1093
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
1200
1094
|
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
1201
|
-
const existingNodes = this.revogrid.registerVNode.filter(
|
|
1095
|
+
const existingNodes = this.revogrid.registerVNode.filter(n => n.$tag$ !== 'revogr-filter-panel');
|
|
1202
1096
|
this.revogrid.registerVNode = [
|
|
1203
1097
|
...existingNodes,
|
|
1204
|
-
index$1.h("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.
|
|
1098
|
+
index$1.h("revogr-filter-panel", { filterItems: this.multiFilterItems, 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), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) }),
|
|
1205
1099
|
];
|
|
1206
1100
|
}
|
|
1207
1101
|
initConfig(config) {
|
|
1208
1102
|
if (config.multiFilterItems) {
|
|
1209
1103
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
1210
1104
|
}
|
|
1105
|
+
// Add custom filters
|
|
1211
1106
|
if (config.customFilters) {
|
|
1212
|
-
for (let
|
|
1213
|
-
const cFilter = config.customFilters[
|
|
1214
|
-
if (!this.
|
|
1215
|
-
this.
|
|
1107
|
+
for (let customFilterType in config.customFilters) {
|
|
1108
|
+
const cFilter = config.customFilters[customFilterType];
|
|
1109
|
+
if (!this.filterByType[cFilter.columnFilterType]) {
|
|
1110
|
+
this.filterByType[cFilter.columnFilterType] = [];
|
|
1216
1111
|
}
|
|
1217
|
-
this.
|
|
1218
|
-
this.
|
|
1219
|
-
this.
|
|
1112
|
+
this.filterByType[cFilter.columnFilterType].push(customFilterType);
|
|
1113
|
+
this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
|
|
1114
|
+
this.filterNameIndexByType[customFilterType] = cFilter.name;
|
|
1220
1115
|
}
|
|
1221
1116
|
}
|
|
1117
|
+
// Add filterProp if provided in config
|
|
1222
1118
|
if (config.filterProp) {
|
|
1223
1119
|
this.filterProp = config.filterProp;
|
|
1224
1120
|
}
|
|
@@ -1229,21 +1125,21 @@ class FilterPlugin extends BasePlugin {
|
|
|
1229
1125
|
const cfgInlcude = config.include;
|
|
1230
1126
|
if (cfgInlcude) {
|
|
1231
1127
|
const filters = {};
|
|
1232
|
-
for (let t in this.
|
|
1128
|
+
for (let t in this.filterByType) {
|
|
1233
1129
|
// validate filters, if appropriate function present
|
|
1234
|
-
const newTypes = this.
|
|
1130
|
+
const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
|
|
1235
1131
|
if (newTypes.length) {
|
|
1236
1132
|
filters[t] = newTypes;
|
|
1237
1133
|
}
|
|
1238
1134
|
}
|
|
1239
1135
|
// if any valid filters provided show them
|
|
1240
1136
|
if (Object.keys(filters).length > 0) {
|
|
1241
|
-
this.
|
|
1137
|
+
this.filterByType = filters;
|
|
1242
1138
|
}
|
|
1243
1139
|
}
|
|
1244
1140
|
if (config.collection) {
|
|
1245
1141
|
this.filterCollection = index.reduce_1(config.collection, (result, item, prop) => {
|
|
1246
|
-
if (this.
|
|
1142
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
1247
1143
|
result[prop] = item;
|
|
1248
1144
|
}
|
|
1249
1145
|
else {
|
|
@@ -1255,8 +1151,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
1255
1151
|
if (config.localization) {
|
|
1256
1152
|
if (config.localization.filterNames) {
|
|
1257
1153
|
Object.entries(config.localization.filterNames).forEach(([k, v]) => {
|
|
1258
|
-
if (this.
|
|
1259
|
-
this.
|
|
1154
|
+
if (this.filterNameIndexByType[k] != void 0) {
|
|
1155
|
+
this.filterNameIndexByType[k] = v;
|
|
1260
1156
|
}
|
|
1261
1157
|
});
|
|
1262
1158
|
}
|
|
@@ -1282,13 +1178,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
1282
1178
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
1283
1179
|
const buttonPos = el.getBoundingClientRect();
|
|
1284
1180
|
const prop = e.detail.prop;
|
|
1285
|
-
this.pop.filterTypes
|
|
1286
|
-
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop }));
|
|
1181
|
+
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop, filterTypes: this.getColumnFilter(e.detail.filter) }));
|
|
1287
1182
|
}
|
|
1288
1183
|
getColumnFilter(type) {
|
|
1289
1184
|
let filterType = 'string';
|
|
1290
1185
|
if (!type) {
|
|
1291
|
-
return { [filterType]: this.
|
|
1186
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
1292
1187
|
}
|
|
1293
1188
|
// if custom column filter
|
|
1294
1189
|
if (this.isValidType(type)) {
|
|
@@ -1298,44 +1193,59 @@ class FilterPlugin extends BasePlugin {
|
|
|
1298
1193
|
else if (typeof type === 'object' && type.length) {
|
|
1299
1194
|
return type.reduce((r, multiType) => {
|
|
1300
1195
|
if (this.isValidType(multiType)) {
|
|
1301
|
-
r[multiType] = this.
|
|
1196
|
+
r[multiType] = this.filterByType[multiType];
|
|
1302
1197
|
}
|
|
1303
1198
|
return r;
|
|
1304
1199
|
}, {});
|
|
1305
1200
|
}
|
|
1306
|
-
return { [filterType]: this.
|
|
1201
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
1307
1202
|
}
|
|
1308
1203
|
isValidType(type) {
|
|
1309
|
-
return !!(typeof type === 'string' && this.
|
|
1204
|
+
return !!(typeof type === 'string' && this.filterByType[type]);
|
|
1310
1205
|
}
|
|
1311
|
-
|
|
1206
|
+
/**
|
|
1207
|
+
* Called on internal component change
|
|
1208
|
+
*/
|
|
1312
1209
|
async onFilterChange(filterItems) {
|
|
1210
|
+
// store the filter items
|
|
1313
1211
|
this.multiFilterItems = filterItems;
|
|
1212
|
+
// run the filtering when the items change
|
|
1314
1213
|
this.runFiltering();
|
|
1315
1214
|
}
|
|
1316
1215
|
/**
|
|
1317
1216
|
* Triggers grid filtering
|
|
1318
1217
|
*/
|
|
1319
|
-
async doFiltering(collection,
|
|
1218
|
+
async doFiltering(collection, source, columns, filterItems) {
|
|
1320
1219
|
const columnsToUpdate = [];
|
|
1220
|
+
/**
|
|
1221
|
+
* Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
|
|
1222
|
+
*/
|
|
1223
|
+
const columnByProp = {};
|
|
1321
1224
|
columns.forEach(rgCol => {
|
|
1322
1225
|
const column = Object.assign({}, rgCol);
|
|
1323
1226
|
const hasFilter = filterItems[column.prop];
|
|
1227
|
+
columnByProp[column.prop] = column;
|
|
1228
|
+
/**
|
|
1229
|
+
* If the column has a filter and it's not already marked as filtered, update the column.
|
|
1230
|
+
*/
|
|
1324
1231
|
if (column[this.filterProp] && !hasFilter) {
|
|
1325
1232
|
delete column[this.filterProp];
|
|
1326
1233
|
columnsToUpdate.push(column);
|
|
1327
1234
|
}
|
|
1235
|
+
/**
|
|
1236
|
+
* If the column does not have a filter and it's marked as filtered, update the column.
|
|
1237
|
+
*/
|
|
1328
1238
|
if (!column[this.filterProp] && hasFilter) {
|
|
1329
1239
|
columnsToUpdate.push(column);
|
|
1330
1240
|
column[this.filterProp] = true;
|
|
1331
1241
|
}
|
|
1332
1242
|
});
|
|
1333
|
-
const
|
|
1243
|
+
const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
|
|
1334
1244
|
// check is filter event prevented
|
|
1335
1245
|
const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
|
|
1336
1246
|
collection,
|
|
1337
|
-
itemsToFilter,
|
|
1338
|
-
source
|
|
1247
|
+
itemsToFilter: itemsToTrim,
|
|
1248
|
+
source,
|
|
1339
1249
|
filterItems,
|
|
1340
1250
|
});
|
|
1341
1251
|
if (defaultPrevented) {
|
|
@@ -1347,7 +1257,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1347
1257
|
return;
|
|
1348
1258
|
}
|
|
1349
1259
|
// applies the hasFilter to the columns to show filter icon
|
|
1350
|
-
|
|
1260
|
+
this.providers.column.updateColumns(columnsToUpdate);
|
|
1351
1261
|
this.emit('afterfilterapply');
|
|
1352
1262
|
}
|
|
1353
1263
|
async clearFiltering() {
|
|
@@ -1363,7 +1273,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1363
1273
|
if (this.multiFilterItems[prop].length > 0) {
|
|
1364
1274
|
const firstFilterItem = this.multiFilterItems[prop][0];
|
|
1365
1275
|
collection[prop] = {
|
|
1366
|
-
filter:
|
|
1276
|
+
filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
|
|
1367
1277
|
type: firstFilterItem.type,
|
|
1368
1278
|
value: firstFilterItem.value,
|
|
1369
1279
|
};
|
|
@@ -1388,52 +1298,68 @@ class FilterPlugin extends BasePlugin {
|
|
|
1388
1298
|
columns: await this.revogrid.getColumns(),
|
|
1389
1299
|
};
|
|
1390
1300
|
}
|
|
1391
|
-
|
|
1301
|
+
/**
|
|
1302
|
+
* Get trimmed rows based on filter
|
|
1303
|
+
*/
|
|
1304
|
+
getRowFilter(rows, filterItems, columnByProp) {
|
|
1392
1305
|
const propKeys = Object.keys(filterItems);
|
|
1393
1306
|
const trimmed = {};
|
|
1394
1307
|
let propFilterSatisfiedCount = 0;
|
|
1395
1308
|
let lastFilterResults = [];
|
|
1396
1309
|
// each rows
|
|
1397
1310
|
rows.forEach((model, rowIndex) => {
|
|
1398
|
-
//
|
|
1311
|
+
// check filter by column properties
|
|
1399
1312
|
for (const prop of propKeys) {
|
|
1400
1313
|
const propFilters = filterItems[prop];
|
|
1314
|
+
// reset the count of satisfied filters
|
|
1401
1315
|
propFilterSatisfiedCount = 0;
|
|
1316
|
+
// reset the array of last filter results
|
|
1402
1317
|
lastFilterResults = [];
|
|
1403
1318
|
// testing each filter for a prop
|
|
1404
1319
|
for (const [filterIndex, filterData] of propFilters.entries()) {
|
|
1405
1320
|
// the filter LogicFunction based on the type
|
|
1406
|
-
const
|
|
1321
|
+
const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
|
|
1407
1322
|
// THE MAGIC OF FILTERING IS HERE
|
|
1323
|
+
const column = columnByProp[prop];
|
|
1324
|
+
// If there is no column but user wants to filter by a property
|
|
1325
|
+
const value = column ? column_service.getCellDataParsed(model, columnByProp[prop]) : model[prop];
|
|
1326
|
+
// OR relation
|
|
1408
1327
|
if (filterData.relation === 'or') {
|
|
1328
|
+
// reset the array of last filter results
|
|
1409
1329
|
lastFilterResults = [];
|
|
1410
|
-
if
|
|
1330
|
+
// if the filter is satisfied, continue to the next filter
|
|
1331
|
+
if (filterFunc(value, filterData.value)) {
|
|
1411
1332
|
continue;
|
|
1412
1333
|
}
|
|
1334
|
+
// if the filter is not satisfied, count it
|
|
1413
1335
|
propFilterSatisfiedCount++;
|
|
1336
|
+
// AND relation
|
|
1414
1337
|
}
|
|
1415
1338
|
else {
|
|
1416
1339
|
// 'and' relation will need to know the next filter
|
|
1417
1340
|
// so we save this current filter to include it in the next filter
|
|
1418
|
-
lastFilterResults.push(!
|
|
1341
|
+
lastFilterResults.push(!filterFunc(value, filterData.value));
|
|
1419
1342
|
// check first if we have a filter on the next index to pair it with this current filter
|
|
1420
1343
|
const nextFilterData = propFilters[filterIndex + 1];
|
|
1421
1344
|
// stop the sequence if there is no next filter or if the next filter is not an 'and' relation
|
|
1422
1345
|
if (!nextFilterData || nextFilterData.relation !== 'and') {
|
|
1423
1346
|
// let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
|
|
1424
1347
|
if (lastFilterResults.indexOf(true) === -1) {
|
|
1348
|
+
// reset the array of last filter results
|
|
1425
1349
|
lastFilterResults = [];
|
|
1426
1350
|
continue;
|
|
1427
1351
|
}
|
|
1428
1352
|
// we need to add all of the lastFilterResults since we need to satisfy all
|
|
1429
1353
|
propFilterSatisfiedCount += lastFilterResults.length;
|
|
1354
|
+
// reset the array of last filter results
|
|
1430
1355
|
lastFilterResults = [];
|
|
1431
1356
|
}
|
|
1432
1357
|
}
|
|
1433
1358
|
} // end of propFilters forEach
|
|
1434
1359
|
// add to the list of removed/trimmed rows of filter condition is satisfied
|
|
1435
|
-
if (propFilterSatisfiedCount === propFilters.length)
|
|
1360
|
+
if (propFilterSatisfiedCount === propFilters.length) {
|
|
1436
1361
|
trimmed[rowIndex] = true;
|
|
1362
|
+
}
|
|
1437
1363
|
} // end of for-of propKeys
|
|
1438
1364
|
});
|
|
1439
1365
|
return trimmed;
|
|
@@ -1561,7 +1487,7 @@ class ColumnPlugin extends BasePlugin {
|
|
|
1561
1487
|
return;
|
|
1562
1488
|
}
|
|
1563
1489
|
// no grouping drag and no row header column drag
|
|
1564
|
-
if (isColGrouping(data) || data.providers.type === 'rowHeaders') {
|
|
1490
|
+
if (column_service.isColGrouping(data) || data.providers.type === 'rowHeaders') {
|
|
1565
1491
|
return;
|
|
1566
1492
|
}
|
|
1567
1493
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
@@ -1672,15 +1598,9 @@ exports.FILTER_TRIMMED_TYPE = FILTER_TRIMMED_TYPE;
|
|
|
1672
1598
|
exports.FilterPlugin = FilterPlugin;
|
|
1673
1599
|
exports.StretchColumn = StretchColumn;
|
|
1674
1600
|
exports.columnTypes = columnTypes;
|
|
1675
|
-
exports.gatherGroup = gatherGroup;
|
|
1676
|
-
exports.getColumnByProp = getColumnByProp;
|
|
1677
|
-
exports.getColumnSizes = getColumnSizes;
|
|
1678
|
-
exports.getColumnType = getColumnType;
|
|
1679
|
-
exports.getColumns = getColumns;
|
|
1680
1601
|
exports.getLeftRelative = getLeftRelative;
|
|
1681
|
-
exports.isColGrouping = isColGrouping;
|
|
1682
1602
|
exports.isRowType = isRowType;
|
|
1683
1603
|
exports.isStretchPlugin = isStretchPlugin;
|
|
1684
1604
|
exports.rowTypes = rowTypes;
|
|
1685
1605
|
|
|
1686
|
-
//# sourceMappingURL=column.drag.plugin-
|
|
1606
|
+
//# sourceMappingURL=column.drag.plugin-a5cc161a.js.map
|