@revolist/revogrid 4.9.13 → 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 +23 -17
- 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 +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +7 -7
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +17 -10
- 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 +6 -6
- package/dist/collection/components/revoGrid/revo-grid.js.map +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 +32 -46
- 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 +18 -12
- 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 +6 -6
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +9 -9
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +17 -10
- 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 +1 -1
- 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 +1007 -949
- package/hydrate/index.mjs +1007 -949
- 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 +119 -186
- 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 +17 -11
- 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 +1 -1
- package/standalone/selection.utils.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
package/standalone/revo-grid.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h, proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { r as reduce_1,
|
|
6
|
-
import {
|
|
5
|
+
import { i as createStore, r as reduce_1, h as setStore, b as getSourceItem, j as toInteger_1, _ as _isIterateeCall, g as getPhysical, d as setItems, k as isArray_1, l as _baseProperty, m as _baseKeys, n as isArrayLike_1, o as range_1, q as _baseIteratee, u as keys_1, v as findIndex_1, D as DataStore, e as getSourceItemVirtualIndexByProp, s as setSourceByVirtualIndex, a as getVisibleSourceItem, f as gatherTrimmedItems } from './reduce.js';
|
|
6
|
+
import { c as calculateDimensionData, e as each, g as getItemByPosition, a as getItemByIndex } from './dimension.helpers.js';
|
|
7
7
|
import { _ as _getTag } from './_stringToPath.js';
|
|
8
8
|
import { _ as _baseGetTag, i as isObjectLike_1 } from './isObjectLike.js';
|
|
9
|
-
import {
|
|
9
|
+
import { e as getColumnType, m as isGrouping, o as getGroupingName, d as getCellDataParsed, G as GROUP_EXPANDED, p as getParsedGroup, q as isSameGroup, r as GROUP_DEPTH, P as PSEUDO_GROUP_ITEM_VALUE, s as PSEUDO_GROUP_ITEM_ID, t as GROUPING_ROW_TYPE, u as PSEUDO_GROUP_COLUMN, v as GROUP_EXPAND_EVENT, w as gatherGrouping, x as isGroupingColumn, h as isColGrouping, l as getColumnByProp, f as getColumnSizes, E as EMPTY_INDEX, j as getColumns, y as SelectionStoreConnector } from './column.service.js';
|
|
10
10
|
import { d as debounce_1 } from './debounce.js';
|
|
11
11
|
import { R as RESIZE_INTERVAL } from './consts.js';
|
|
12
12
|
import { f as calculateRowHeaderSize, V as ViewportStore, h as defineCustomElement$6 } from './revogr-row-headers2.js';
|
|
13
13
|
import { g as getScrollbarSize, t as timeout } from './index2.js';
|
|
14
14
|
import { F as FILTER_PROP, i as isFilterBtn } from './filter.button.js';
|
|
15
|
+
import './platform.js';
|
|
15
16
|
import { v as viewportDataPartition, H as HEADER_SLOT, C as CONTENT_SLOT, F as FOOTER_SLOT, D as DATA_SLOT, d as defineCustomElement$3 } from './revogr-viewport-scroll2.js';
|
|
16
17
|
import { d as dispatch, O as ON_COLUMN_CLICK, c as defineCustomElement$9 } from './revogr-header2.js';
|
|
17
18
|
import { g as getPropertyFromEvent } from './selection.utils.js';
|
|
@@ -68,7 +69,7 @@ class ThemeService {
|
|
|
68
69
|
this.register('default');
|
|
69
70
|
}
|
|
70
71
|
register(theme) {
|
|
71
|
-
const parsedTheme =
|
|
72
|
+
const parsedTheme = getTheme(theme);
|
|
72
73
|
switch (parsedTheme) {
|
|
73
74
|
case 'material':
|
|
74
75
|
case 'darkMaterial':
|
|
@@ -83,12 +84,12 @@ class ThemeService {
|
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return DEFAULT_THEME;
|
|
87
|
+
}
|
|
88
|
+
function getTheme(theme) {
|
|
89
|
+
if (theme && allowedThemes.indexOf(theme) > -1) {
|
|
90
|
+
return theme;
|
|
91
91
|
}
|
|
92
|
+
return DEFAULT_THEME;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
/**
|
|
@@ -295,125 +296,6 @@ class BasePlugin {
|
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
function getColumnType(rgCol) {
|
|
299
|
-
if (rgCol.pin) {
|
|
300
|
-
return rgCol.pin;
|
|
301
|
-
}
|
|
302
|
-
return 'rgCol';
|
|
303
|
-
}
|
|
304
|
-
function getColumnSizes(cols) {
|
|
305
|
-
const res = {};
|
|
306
|
-
for (const [i, c] of cols.entries()) {
|
|
307
|
-
if (c.size) {
|
|
308
|
-
res[i] = c.size;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return res;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Check if column is grouping column
|
|
315
|
-
*/
|
|
316
|
-
function isColGrouping(colData) {
|
|
317
|
-
return !!colData.children;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* This function is used to create a collection of columns.
|
|
321
|
-
*/
|
|
322
|
-
function getColumns(columns, level = 0, types) {
|
|
323
|
-
const collection = {
|
|
324
|
-
// columns as they are in stores per type
|
|
325
|
-
columns: {
|
|
326
|
-
rgCol: [],
|
|
327
|
-
colPinStart: [],
|
|
328
|
-
colPinEnd: [],
|
|
329
|
-
},
|
|
330
|
-
// columns indexed by prop for quick access
|
|
331
|
-
columnByProp: {},
|
|
332
|
-
// column grouping
|
|
333
|
-
columnGrouping: {
|
|
334
|
-
rgCol: [],
|
|
335
|
-
colPinStart: [],
|
|
336
|
-
colPinEnd: [],
|
|
337
|
-
},
|
|
338
|
-
// max depth level for column grouping
|
|
339
|
-
maxLevel: level,
|
|
340
|
-
// sorting
|
|
341
|
-
sort: {},
|
|
342
|
-
};
|
|
343
|
-
return reduce_1(columns, (res, colData) => {
|
|
344
|
-
// Grouped column
|
|
345
|
-
if (isColGrouping(colData)) {
|
|
346
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
347
|
-
}
|
|
348
|
-
// Regular column
|
|
349
|
-
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
350
|
-
// Regular column, no Pin
|
|
351
|
-
if (!regularColumn.pin) {
|
|
352
|
-
res.columns.rgCol.push(regularColumn);
|
|
353
|
-
// Pin
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
res.columns[regularColumn.pin].push(regularColumn);
|
|
357
|
-
}
|
|
358
|
-
if (regularColumn.order) {
|
|
359
|
-
res.sort[regularColumn.prop] = regularColumn;
|
|
360
|
-
}
|
|
361
|
-
// it's possible that some columns have same prop, but better to avoid it
|
|
362
|
-
if (!res.columnByProp[regularColumn.prop]) {
|
|
363
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
364
|
-
}
|
|
365
|
-
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
366
|
-
// trigger setup hook if present
|
|
367
|
-
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
368
|
-
return res;
|
|
369
|
-
}, collection);
|
|
370
|
-
}
|
|
371
|
-
function gatherGroup(res, colData, collection, level = 0) {
|
|
372
|
-
// group template
|
|
373
|
-
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
374
|
-
// check columns for update
|
|
375
|
-
for (let k in collection.columns) {
|
|
376
|
-
const key = k;
|
|
377
|
-
const resultItem = res.columns[key];
|
|
378
|
-
const collectionItem = collection.columns[key];
|
|
379
|
-
// if column data
|
|
380
|
-
if (isArray_1(resultItem) && isArray_1(collectionItem)) {
|
|
381
|
-
// fill columns
|
|
382
|
-
resultItem.push(...collectionItem);
|
|
383
|
-
// fill grouping
|
|
384
|
-
if (collectionItem.length) {
|
|
385
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
// merge column groupings
|
|
390
|
-
for (let k in collection.columnGrouping) {
|
|
391
|
-
const key = k;
|
|
392
|
-
const collectionItem = collection.columnGrouping[key];
|
|
393
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
394
|
-
}
|
|
395
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
396
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
397
|
-
return res;
|
|
398
|
-
}
|
|
399
|
-
function findColumn(columns, prop) {
|
|
400
|
-
for (const c of columns) {
|
|
401
|
-
if (isColGrouping(c)) {
|
|
402
|
-
const found = findColumn(c.children, prop);
|
|
403
|
-
if (found) {
|
|
404
|
-
return found;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
else if (c.prop === prop) {
|
|
408
|
-
return c;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return undefined;
|
|
412
|
-
}
|
|
413
|
-
function getColumnByProp(columns, prop) {
|
|
414
|
-
return findColumn(columns, prop);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
299
|
/**
|
|
418
300
|
* Plugin module for revo-grid grid system
|
|
419
301
|
* Add support for automatic column resize
|
|
@@ -1192,23 +1074,7 @@ const notContains = (value, extra) => {
|
|
|
1192
1074
|
notContains.extra = 'input';
|
|
1193
1075
|
contains.extra = 'input';
|
|
1194
1076
|
|
|
1195
|
-
const
|
|
1196
|
-
none: 'None',
|
|
1197
|
-
empty: 'Not set',
|
|
1198
|
-
notEmpty: 'Set',
|
|
1199
|
-
eq: 'Equal',
|
|
1200
|
-
notEq: 'Not equal',
|
|
1201
|
-
begins: 'Begins with',
|
|
1202
|
-
contains: 'Contains',
|
|
1203
|
-
notContains: 'Does not contain',
|
|
1204
|
-
eqN: '=',
|
|
1205
|
-
neqN: '!=',
|
|
1206
|
-
gt: '>',
|
|
1207
|
-
gte: '>=',
|
|
1208
|
-
lt: '<',
|
|
1209
|
-
lte: '<=',
|
|
1210
|
-
};
|
|
1211
|
-
const filterEntities = {
|
|
1077
|
+
const filterCoreFunctionsIndexedByType = {
|
|
1212
1078
|
none: () => true,
|
|
1213
1079
|
empty: notSet,
|
|
1214
1080
|
notEmpty: set,
|
|
@@ -1228,7 +1094,37 @@ const filterTypes = {
|
|
|
1228
1094
|
string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
|
|
1229
1095
|
number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
|
|
1230
1096
|
};
|
|
1097
|
+
const filterNames = {
|
|
1098
|
+
none: 'None',
|
|
1099
|
+
empty: 'Not set',
|
|
1100
|
+
notEmpty: 'Set',
|
|
1101
|
+
eq: 'Equal',
|
|
1102
|
+
notEq: 'Not equal',
|
|
1103
|
+
begins: 'Begins with',
|
|
1104
|
+
contains: 'Contains',
|
|
1105
|
+
notContains: 'Does not contain',
|
|
1106
|
+
eqN: '=',
|
|
1107
|
+
neqN: '!=',
|
|
1108
|
+
gt: '>',
|
|
1109
|
+
gte: '>=',
|
|
1110
|
+
lt: '<',
|
|
1111
|
+
lte: '<=',
|
|
1112
|
+
};
|
|
1231
1113
|
|
|
1114
|
+
/**
|
|
1115
|
+
* @typedef ColumnFilterConfig
|
|
1116
|
+
* @type {object}
|
|
1117
|
+
* @property {FilterCollection|undefined} collection - preserved filter data
|
|
1118
|
+
* @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
|
|
1119
|
+
* @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
|
|
1120
|
+
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
1121
|
+
* @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
|
|
1122
|
+
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.
|
|
1123
|
+
* A way to define your own filter types per column
|
|
1124
|
+
*/
|
|
1125
|
+
/**
|
|
1126
|
+
* @internal
|
|
1127
|
+
*/
|
|
1232
1128
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
1233
1129
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
1234
1130
|
class FilterPlugin extends BasePlugin {
|
|
@@ -1238,14 +1134,13 @@ class FilterPlugin extends BasePlugin {
|
|
|
1238
1134
|
this.revogrid = revogrid;
|
|
1239
1135
|
this.filterCollection = {};
|
|
1240
1136
|
this.multiFilterItems = {};
|
|
1241
|
-
this.
|
|
1242
|
-
this.
|
|
1243
|
-
this.
|
|
1137
|
+
this.filterByType = Object.assign({}, filterTypes);
|
|
1138
|
+
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
1139
|
+
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
1244
1140
|
this.filterProp = FILTER_PROP;
|
|
1245
1141
|
if (config) {
|
|
1246
1142
|
this.initConfig(config);
|
|
1247
1143
|
}
|
|
1248
|
-
const headerclick = (e) => this.headerclick(e);
|
|
1249
1144
|
const aftersourceset = async () => {
|
|
1250
1145
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
1251
1146
|
if (filterCollectionProps.length > 0) {
|
|
@@ -1265,7 +1160,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1265
1160
|
}
|
|
1266
1161
|
await this.runFiltering();
|
|
1267
1162
|
};
|
|
1268
|
-
this.addEventListener('headerclick', headerclick);
|
|
1163
|
+
this.addEventListener('headerclick', (e) => this.headerclick(e));
|
|
1269
1164
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
1270
1165
|
if (!detail) {
|
|
1271
1166
|
this.clearFiltering();
|
|
@@ -1278,27 +1173,29 @@ class FilterPlugin extends BasePlugin {
|
|
|
1278
1173
|
});
|
|
1279
1174
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
1280
1175
|
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
1281
|
-
const existingNodes = this.revogrid.registerVNode.filter(
|
|
1176
|
+
const existingNodes = this.revogrid.registerVNode.filter(n => n.$tag$ !== 'revogr-filter-panel');
|
|
1282
1177
|
this.revogrid.registerVNode = [
|
|
1283
1178
|
...existingNodes,
|
|
1284
|
-
h("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.
|
|
1179
|
+
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) }),
|
|
1285
1180
|
];
|
|
1286
1181
|
}
|
|
1287
1182
|
initConfig(config) {
|
|
1288
1183
|
if (config.multiFilterItems) {
|
|
1289
1184
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
1290
1185
|
}
|
|
1186
|
+
// Add custom filters
|
|
1291
1187
|
if (config.customFilters) {
|
|
1292
|
-
for (let
|
|
1293
|
-
const cFilter = config.customFilters[
|
|
1294
|
-
if (!this.
|
|
1295
|
-
this.
|
|
1188
|
+
for (let customFilterType in config.customFilters) {
|
|
1189
|
+
const cFilter = config.customFilters[customFilterType];
|
|
1190
|
+
if (!this.filterByType[cFilter.columnFilterType]) {
|
|
1191
|
+
this.filterByType[cFilter.columnFilterType] = [];
|
|
1296
1192
|
}
|
|
1297
|
-
this.
|
|
1298
|
-
this.
|
|
1299
|
-
this.
|
|
1193
|
+
this.filterByType[cFilter.columnFilterType].push(customFilterType);
|
|
1194
|
+
this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
|
|
1195
|
+
this.filterNameIndexByType[customFilterType] = cFilter.name;
|
|
1300
1196
|
}
|
|
1301
1197
|
}
|
|
1198
|
+
// Add filterProp if provided in config
|
|
1302
1199
|
if (config.filterProp) {
|
|
1303
1200
|
this.filterProp = config.filterProp;
|
|
1304
1201
|
}
|
|
@@ -1309,21 +1206,21 @@ class FilterPlugin extends BasePlugin {
|
|
|
1309
1206
|
const cfgInlcude = config.include;
|
|
1310
1207
|
if (cfgInlcude) {
|
|
1311
1208
|
const filters = {};
|
|
1312
|
-
for (let t in this.
|
|
1209
|
+
for (let t in this.filterByType) {
|
|
1313
1210
|
// validate filters, if appropriate function present
|
|
1314
|
-
const newTypes = this.
|
|
1211
|
+
const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
|
|
1315
1212
|
if (newTypes.length) {
|
|
1316
1213
|
filters[t] = newTypes;
|
|
1317
1214
|
}
|
|
1318
1215
|
}
|
|
1319
1216
|
// if any valid filters provided show them
|
|
1320
1217
|
if (Object.keys(filters).length > 0) {
|
|
1321
|
-
this.
|
|
1218
|
+
this.filterByType = filters;
|
|
1322
1219
|
}
|
|
1323
1220
|
}
|
|
1324
1221
|
if (config.collection) {
|
|
1325
1222
|
this.filterCollection = reduce_1(config.collection, (result, item, prop) => {
|
|
1326
|
-
if (this.
|
|
1223
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
1327
1224
|
result[prop] = item;
|
|
1328
1225
|
}
|
|
1329
1226
|
else {
|
|
@@ -1335,8 +1232,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
1335
1232
|
if (config.localization) {
|
|
1336
1233
|
if (config.localization.filterNames) {
|
|
1337
1234
|
Object.entries(config.localization.filterNames).forEach(([k, v]) => {
|
|
1338
|
-
if (this.
|
|
1339
|
-
this.
|
|
1235
|
+
if (this.filterNameIndexByType[k] != void 0) {
|
|
1236
|
+
this.filterNameIndexByType[k] = v;
|
|
1340
1237
|
}
|
|
1341
1238
|
});
|
|
1342
1239
|
}
|
|
@@ -1362,13 +1259,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
1362
1259
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
1363
1260
|
const buttonPos = el.getBoundingClientRect();
|
|
1364
1261
|
const prop = e.detail.prop;
|
|
1365
|
-
this.pop.filterTypes
|
|
1366
|
-
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 }));
|
|
1262
|
+
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) }));
|
|
1367
1263
|
}
|
|
1368
1264
|
getColumnFilter(type) {
|
|
1369
1265
|
let filterType = 'string';
|
|
1370
1266
|
if (!type) {
|
|
1371
|
-
return { [filterType]: this.
|
|
1267
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
1372
1268
|
}
|
|
1373
1269
|
// if custom column filter
|
|
1374
1270
|
if (this.isValidType(type)) {
|
|
@@ -1378,44 +1274,59 @@ class FilterPlugin extends BasePlugin {
|
|
|
1378
1274
|
else if (typeof type === 'object' && type.length) {
|
|
1379
1275
|
return type.reduce((r, multiType) => {
|
|
1380
1276
|
if (this.isValidType(multiType)) {
|
|
1381
|
-
r[multiType] = this.
|
|
1277
|
+
r[multiType] = this.filterByType[multiType];
|
|
1382
1278
|
}
|
|
1383
1279
|
return r;
|
|
1384
1280
|
}, {});
|
|
1385
1281
|
}
|
|
1386
|
-
return { [filterType]: this.
|
|
1282
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
1387
1283
|
}
|
|
1388
1284
|
isValidType(type) {
|
|
1389
|
-
return !!(typeof type === 'string' && this.
|
|
1285
|
+
return !!(typeof type === 'string' && this.filterByType[type]);
|
|
1390
1286
|
}
|
|
1391
|
-
|
|
1287
|
+
/**
|
|
1288
|
+
* Called on internal component change
|
|
1289
|
+
*/
|
|
1392
1290
|
async onFilterChange(filterItems) {
|
|
1291
|
+
// store the filter items
|
|
1393
1292
|
this.multiFilterItems = filterItems;
|
|
1293
|
+
// run the filtering when the items change
|
|
1394
1294
|
this.runFiltering();
|
|
1395
1295
|
}
|
|
1396
1296
|
/**
|
|
1397
1297
|
* Triggers grid filtering
|
|
1398
1298
|
*/
|
|
1399
|
-
async doFiltering(collection,
|
|
1299
|
+
async doFiltering(collection, source, columns, filterItems) {
|
|
1400
1300
|
const columnsToUpdate = [];
|
|
1301
|
+
/**
|
|
1302
|
+
* Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
|
|
1303
|
+
*/
|
|
1304
|
+
const columnByProp = {};
|
|
1401
1305
|
columns.forEach(rgCol => {
|
|
1402
1306
|
const column = Object.assign({}, rgCol);
|
|
1403
1307
|
const hasFilter = filterItems[column.prop];
|
|
1308
|
+
columnByProp[column.prop] = column;
|
|
1309
|
+
/**
|
|
1310
|
+
* If the column has a filter and it's not already marked as filtered, update the column.
|
|
1311
|
+
*/
|
|
1404
1312
|
if (column[this.filterProp] && !hasFilter) {
|
|
1405
1313
|
delete column[this.filterProp];
|
|
1406
1314
|
columnsToUpdate.push(column);
|
|
1407
1315
|
}
|
|
1316
|
+
/**
|
|
1317
|
+
* If the column does not have a filter and it's marked as filtered, update the column.
|
|
1318
|
+
*/
|
|
1408
1319
|
if (!column[this.filterProp] && hasFilter) {
|
|
1409
1320
|
columnsToUpdate.push(column);
|
|
1410
1321
|
column[this.filterProp] = true;
|
|
1411
1322
|
}
|
|
1412
1323
|
});
|
|
1413
|
-
const
|
|
1324
|
+
const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
|
|
1414
1325
|
// check is filter event prevented
|
|
1415
1326
|
const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
|
|
1416
1327
|
collection,
|
|
1417
|
-
itemsToFilter,
|
|
1418
|
-
source
|
|
1328
|
+
itemsToFilter: itemsToTrim,
|
|
1329
|
+
source,
|
|
1419
1330
|
filterItems,
|
|
1420
1331
|
});
|
|
1421
1332
|
if (defaultPrevented) {
|
|
@@ -1427,7 +1338,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1427
1338
|
return;
|
|
1428
1339
|
}
|
|
1429
1340
|
// applies the hasFilter to the columns to show filter icon
|
|
1430
|
-
|
|
1341
|
+
this.providers.column.updateColumns(columnsToUpdate);
|
|
1431
1342
|
this.emit('afterfilterapply');
|
|
1432
1343
|
}
|
|
1433
1344
|
async clearFiltering() {
|
|
@@ -1443,7 +1354,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1443
1354
|
if (this.multiFilterItems[prop].length > 0) {
|
|
1444
1355
|
const firstFilterItem = this.multiFilterItems[prop][0];
|
|
1445
1356
|
collection[prop] = {
|
|
1446
|
-
filter:
|
|
1357
|
+
filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
|
|
1447
1358
|
type: firstFilterItem.type,
|
|
1448
1359
|
value: firstFilterItem.value,
|
|
1449
1360
|
};
|
|
@@ -1468,52 +1379,68 @@ class FilterPlugin extends BasePlugin {
|
|
|
1468
1379
|
columns: await this.revogrid.getColumns(),
|
|
1469
1380
|
};
|
|
1470
1381
|
}
|
|
1471
|
-
|
|
1382
|
+
/**
|
|
1383
|
+
* Get trimmed rows based on filter
|
|
1384
|
+
*/
|
|
1385
|
+
getRowFilter(rows, filterItems, columnByProp) {
|
|
1472
1386
|
const propKeys = Object.keys(filterItems);
|
|
1473
1387
|
const trimmed = {};
|
|
1474
1388
|
let propFilterSatisfiedCount = 0;
|
|
1475
1389
|
let lastFilterResults = [];
|
|
1476
1390
|
// each rows
|
|
1477
1391
|
rows.forEach((model, rowIndex) => {
|
|
1478
|
-
//
|
|
1392
|
+
// check filter by column properties
|
|
1479
1393
|
for (const prop of propKeys) {
|
|
1480
1394
|
const propFilters = filterItems[prop];
|
|
1395
|
+
// reset the count of satisfied filters
|
|
1481
1396
|
propFilterSatisfiedCount = 0;
|
|
1397
|
+
// reset the array of last filter results
|
|
1482
1398
|
lastFilterResults = [];
|
|
1483
1399
|
// testing each filter for a prop
|
|
1484
1400
|
for (const [filterIndex, filterData] of propFilters.entries()) {
|
|
1485
1401
|
// the filter LogicFunction based on the type
|
|
1486
|
-
const
|
|
1402
|
+
const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
|
|
1487
1403
|
// THE MAGIC OF FILTERING IS HERE
|
|
1404
|
+
const column = columnByProp[prop];
|
|
1405
|
+
// If there is no column but user wants to filter by a property
|
|
1406
|
+
const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];
|
|
1407
|
+
// OR relation
|
|
1488
1408
|
if (filterData.relation === 'or') {
|
|
1409
|
+
// reset the array of last filter results
|
|
1489
1410
|
lastFilterResults = [];
|
|
1490
|
-
if
|
|
1411
|
+
// if the filter is satisfied, continue to the next filter
|
|
1412
|
+
if (filterFunc(value, filterData.value)) {
|
|
1491
1413
|
continue;
|
|
1492
1414
|
}
|
|
1415
|
+
// if the filter is not satisfied, count it
|
|
1493
1416
|
propFilterSatisfiedCount++;
|
|
1417
|
+
// AND relation
|
|
1494
1418
|
}
|
|
1495
1419
|
else {
|
|
1496
1420
|
// 'and' relation will need to know the next filter
|
|
1497
1421
|
// so we save this current filter to include it in the next filter
|
|
1498
|
-
lastFilterResults.push(!
|
|
1422
|
+
lastFilterResults.push(!filterFunc(value, filterData.value));
|
|
1499
1423
|
// check first if we have a filter on the next index to pair it with this current filter
|
|
1500
1424
|
const nextFilterData = propFilters[filterIndex + 1];
|
|
1501
1425
|
// stop the sequence if there is no next filter or if the next filter is not an 'and' relation
|
|
1502
1426
|
if (!nextFilterData || nextFilterData.relation !== 'and') {
|
|
1503
1427
|
// let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
|
|
1504
1428
|
if (lastFilterResults.indexOf(true) === -1) {
|
|
1429
|
+
// reset the array of last filter results
|
|
1505
1430
|
lastFilterResults = [];
|
|
1506
1431
|
continue;
|
|
1507
1432
|
}
|
|
1508
1433
|
// we need to add all of the lastFilterResults since we need to satisfy all
|
|
1509
1434
|
propFilterSatisfiedCount += lastFilterResults.length;
|
|
1435
|
+
// reset the array of last filter results
|
|
1510
1436
|
lastFilterResults = [];
|
|
1511
1437
|
}
|
|
1512
1438
|
}
|
|
1513
1439
|
} // end of propFilters forEach
|
|
1514
1440
|
// add to the list of removed/trimmed rows of filter condition is satisfied
|
|
1515
|
-
if (propFilterSatisfiedCount === propFilters.length)
|
|
1441
|
+
if (propFilterSatisfiedCount === propFilters.length) {
|
|
1516
1442
|
trimmed[rowIndex] = true;
|
|
1443
|
+
}
|
|
1517
1444
|
} // end of for-of propKeys
|
|
1518
1445
|
});
|
|
1519
1446
|
return trimmed;
|
|
@@ -3380,8 +3307,14 @@ class WCAGPlugin extends BasePlugin {
|
|
|
3380
3307
|
return result;
|
|
3381
3308
|
};
|
|
3382
3309
|
column.cellProperties = (...args) => {
|
|
3310
|
+
const wcagProps = {
|
|
3311
|
+
['role']: 'gridcell',
|
|
3312
|
+
['aria-colindex']: index,
|
|
3313
|
+
['aria-rowindex']: args[0].rowIndex,
|
|
3314
|
+
['tabindex']: -1,
|
|
3315
|
+
};
|
|
3383
3316
|
const columnProps = (cellProperties === null || cellProperties === void 0 ? void 0 : cellProperties(...args)) || {};
|
|
3384
|
-
return Object.assign({
|
|
3317
|
+
return Object.assign(Object.assign({}, wcagProps), columnProps);
|
|
3385
3318
|
};
|
|
3386
3319
|
});
|
|
3387
3320
|
});
|
|
@@ -4384,6 +4317,6 @@ function defineCustomElement$1() {
|
|
|
4384
4317
|
const RevoGrid = RevoGridComponent;
|
|
4385
4318
|
const defineCustomElement = defineCustomElement$1;
|
|
4386
4319
|
|
|
4387
|
-
export { BasePlugin as B, DimensionStore as D, FILTER_TRIMMED_TYPE as F, RevoGrid,
|
|
4320
|
+
export { BasePlugin as B, DimensionStore as D, FILTER_TRIMMED_TYPE as F, RevoGrid, isStretchPlugin as a, FILTER_CONFIG_CHANGED_EVENT as b, columnTypes as c, FilterPlugin as d, defineCustomElement, getLeftRelative as e, getTheme as g, isRowType as i, rowTypes as r };
|
|
4388
4321
|
|
|
4389
4322
|
//# sourceMappingURL=revo-grid.js.map
|