@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.
Files changed (175) hide show
  1. package/dist/cjs/{column.drag.plugin-e636b5af.js → column.drag.plugin-a5cc161a.js} +106 -186
  2. package/dist/cjs/column.drag.plugin-a5cc161a.js.map +1 -0
  3. package/dist/cjs/{column.service-15c8352d.js → column.service-d45dbb3f.js} +141 -14
  4. package/dist/cjs/column.service-d45dbb3f.js.map +1 -0
  5. package/dist/cjs/{header-cell-renderer-375a879f.js → header-cell-renderer-28f7f21d.js} +14 -14
  6. package/dist/cjs/header-cell-renderer-28f7f21d.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +15 -13
  8. package/dist/cjs/index.cjs.js.map +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/revo-grid.cjs.entry.js +23 -17
  11. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  12. package/dist/cjs/revo-grid.cjs.js +1 -1
  13. package/dist/cjs/revogr-attribution_6.cjs.entry.js +1 -1
  14. package/dist/cjs/revogr-data_4.cjs.entry.js +7 -7
  15. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  16. package/dist/cjs/revogr-filter-panel.cjs.entry.js +17 -10
  17. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  18. package/dist/collection/collection-manifest.json +2 -2
  19. package/dist/collection/components/data/cell-renderer.js +2 -2
  20. package/dist/collection/components/data/cell-renderer.js.map +1 -1
  21. package/dist/collection/components/data/column.service.js +5 -14
  22. package/dist/collection/components/data/column.service.js.map +1 -1
  23. package/dist/collection/components/header/header-cell-renderer.js +5 -4
  24. package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
  25. package/dist/collection/components/header/header-renderer.js +2 -2
  26. package/dist/collection/components/header/header-renderer.js.map +1 -1
  27. package/dist/collection/components/header/resizable.directive.js.map +1 -1
  28. package/dist/collection/components/header/resizable.element.js +9 -10
  29. package/dist/collection/components/header/resizable.element.js.map +1 -1
  30. package/dist/collection/components/header/revogr-header.js +3 -3
  31. package/dist/collection/components/header/revogr-header.js.map +1 -1
  32. package/dist/collection/components/revoGrid/revo-grid.js +6 -6
  33. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  34. package/dist/collection/global/global.js +2 -2
  35. package/dist/collection/global/global.js.map +1 -1
  36. package/dist/collection/plugins/filter/{filter.service.js → filter.indexed.js} +18 -18
  37. package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
  38. package/dist/collection/plugins/filter/filter.panel.js +32 -46
  39. package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
  40. package/dist/collection/plugins/filter/filter.plugin.js +86 -40
  41. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
  42. package/dist/collection/plugins/filter/filter.types.js.map +1 -1
  43. package/dist/collection/plugins/wcag/index.js +7 -1
  44. package/dist/collection/plugins/wcag/index.js.map +1 -1
  45. package/dist/collection/serve/controller.js +1 -1
  46. package/dist/collection/themeManager/theme.compact.js +1 -1
  47. package/dist/collection/themeManager/theme.compact.js.map +1 -1
  48. package/dist/collection/themeManager/theme.default.js +1 -1
  49. package/dist/collection/themeManager/theme.default.js.map +1 -1
  50. package/dist/collection/themeManager/theme.material.js +1 -1
  51. package/dist/collection/themeManager/theme.material.js.map +1 -1
  52. package/dist/collection/themeManager/theme.service.js +9 -9
  53. package/dist/collection/themeManager/theme.service.js.map +1 -1
  54. package/dist/collection/types/interfaces.js.map +1 -1
  55. package/dist/collection/utils/column.utils.js +10 -0
  56. package/dist/collection/utils/column.utils.js.map +1 -1
  57. package/dist/esm/{column.drag.plugin-30dc4e24.js → column.drag.plugin-18125693.js} +107 -181
  58. package/dist/esm/column.drag.plugin-18125693.js.map +1 -0
  59. package/dist/esm/{column.service-414e9cba.js → column.service-00a51837.js} +136 -16
  60. package/dist/esm/column.service-00a51837.js.map +1 -0
  61. package/dist/esm/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
  62. package/dist/esm/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +1 -1
  63. package/dist/esm/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +14 -14
  64. package/dist/esm/header-cell-renderer-6d89f141.js.map +1 -0
  65. package/dist/esm/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
  66. package/dist/esm/{index-74b9801b.js.map → index-00cb6ac1.js.map} +1 -1
  67. package/dist/esm/index.js +7 -7
  68. package/dist/esm/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
  69. package/dist/esm/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/revo-grid.entry.js +18 -12
  72. package/dist/esm/revo-grid.entry.js.map +1 -1
  73. package/dist/esm/revo-grid.js +1 -1
  74. package/dist/esm/revogr-attribution_6.entry.js +6 -6
  75. package/dist/esm/revogr-clipboard_3.entry.js +4 -4
  76. package/dist/esm/revogr-data_4.entry.js +9 -9
  77. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  78. package/dist/esm/revogr-filter-panel.entry.js +17 -10
  79. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  80. package/dist/esm/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
  81. package/dist/esm/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +1 -1
  82. package/dist/esm/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +3 -3
  83. package/dist/esm/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +1 -1
  84. package/dist/esm/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
  85. package/dist/esm/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +1 -1
  86. package/dist/revo-grid/column.drag.plugin-18125693.js +5 -0
  87. package/dist/revo-grid/column.drag.plugin-18125693.js.map +1 -0
  88. package/dist/revo-grid/column.service-00a51837.js +5 -0
  89. package/dist/revo-grid/column.service-00a51837.js.map +1 -0
  90. package/dist/revo-grid/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
  91. package/dist/revo-grid/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +2 -2
  92. package/dist/revo-grid/header-cell-renderer-6d89f141.js.map +1 -0
  93. package/dist/revo-grid/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
  94. package/dist/revo-grid/index.esm.js +1 -1
  95. package/dist/revo-grid/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
  96. package/dist/revo-grid/revo-grid.entry.js +1 -1
  97. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  98. package/dist/revo-grid/revo-grid.esm.js +1 -1
  99. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  100. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  101. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  102. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  103. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  104. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  105. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  106. package/dist/revo-grid/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
  107. package/dist/revo-grid/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +2 -2
  108. package/dist/revo-grid/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
  109. package/dist/types/components/data/column.service.d.ts +1 -2
  110. package/dist/types/components/header/header-cell-renderer.d.ts +7 -9
  111. package/dist/types/components/header/header-renderer.d.ts +2 -3
  112. package/dist/types/components/header/resizable.directive.d.ts +0 -1
  113. package/dist/types/components/header/resizable.element.d.ts +3 -2
  114. package/dist/types/components/revoGrid/revo-grid.d.ts +1 -1
  115. package/dist/types/components.d.ts +2 -8
  116. package/dist/types/plugins/filter/{filter.service.d.ts → filter.indexed.d.ts} +2 -2
  117. package/dist/types/plugins/filter/filter.panel.d.ts +3 -27
  118. package/dist/types/plugins/filter/filter.plugin.d.ts +14 -47
  119. package/dist/types/plugins/filter/filter.types.d.ts +86 -1
  120. package/dist/types/themeManager/theme.compact.d.ts +1 -1
  121. package/dist/types/themeManager/theme.default.d.ts +1 -1
  122. package/dist/types/themeManager/theme.material.d.ts +1 -1
  123. package/dist/types/themeManager/theme.service.d.ts +2 -2
  124. package/dist/types/types/interfaces.d.ts +9 -12
  125. package/dist/types/utils/column.utils.d.ts +3 -1
  126. package/hydrate/index.js +1007 -949
  127. package/hydrate/index.mjs +1007 -949
  128. package/package.json +1 -1
  129. package/standalone/column.service.js +136 -15
  130. package/standalone/column.service.js.map +1 -1
  131. package/standalone/dimension.helpers.js +2 -216
  132. package/standalone/dimension.helpers.js.map +1 -1
  133. package/standalone/index.js +7 -6
  134. package/standalone/index.js.map +1 -1
  135. package/standalone/index2.js +2 -84
  136. package/standalone/index2.js.map +1 -1
  137. package/standalone/platform.js +89 -0
  138. package/standalone/platform.js.map +1 -0
  139. package/standalone/{data.store.js → reduce.js} +252 -38
  140. package/standalone/reduce.js.map +1 -0
  141. package/standalone/revo-grid.js +119 -186
  142. package/standalone/revo-grid.js.map +1 -1
  143. package/standalone/revogr-data2.js +3 -2
  144. package/standalone/revogr-data2.js.map +1 -1
  145. package/standalone/revogr-edit2.js +2 -1
  146. package/standalone/revogr-edit2.js.map +1 -1
  147. package/standalone/revogr-filter-panel.js +17 -11
  148. package/standalone/revogr-filter-panel.js.map +1 -1
  149. package/standalone/revogr-focus2.js +1 -1
  150. package/standalone/revogr-header2.js +20 -20
  151. package/standalone/revogr-header2.js.map +1 -1
  152. package/standalone/revogr-order-editor2.js +1 -1
  153. package/standalone/revogr-overlay-selection2.js +3 -2
  154. package/standalone/revogr-overlay-selection2.js.map +1 -1
  155. package/standalone/revogr-row-headers2.js +1 -1
  156. package/standalone/selection.utils.js +1 -1
  157. package/dist/cjs/column.drag.plugin-e636b5af.js.map +0 -1
  158. package/dist/cjs/column.service-15c8352d.js.map +0 -1
  159. package/dist/cjs/header-cell-renderer-375a879f.js.map +0 -1
  160. package/dist/collection/plugins/filter/filter.service.js.map +0 -1
  161. package/dist/esm/column.drag.plugin-30dc4e24.js.map +0 -1
  162. package/dist/esm/column.service-414e9cba.js.map +0 -1
  163. package/dist/esm/header-cell-renderer-ca570fcf.js.map +0 -1
  164. package/dist/revo-grid/column.drag.plugin-30dc4e24.js +0 -5
  165. package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +0 -1
  166. package/dist/revo-grid/column.service-414e9cba.js +0 -5
  167. package/dist/revo-grid/column.service-414e9cba.js.map +0 -1
  168. package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +0 -1
  169. package/standalone/data.store.js.map +0 -1
  170. /package/dist/revo-grid/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +0 -0
  171. /package/dist/revo-grid/{index-74b9801b.js.map → index-00cb6ac1.js.map} +0 -0
  172. /package/dist/revo-grid/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +0 -0
  173. /package/dist/revo-grid/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +0 -0
  174. /package/dist/revo-grid/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +0 -0
  175. /package/dist/revo-grid/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { V as createStore, W as reduce_1, v as setStore, h as calculateDimensionData, X as isArray_1, Y as each, b as getSourceItem, n as getScrollbarSize, Z as toInteger_1, _ as _isIterateeCall, q as timeout, i as getItemByPosition } from './index-74b9801b.js';
5
- import { f as calculateRowHeaderSize } from './row-header-utils-c7e3e2d5.js';
4
+ import { V as createStore, W as reduce_1, v as setStore, h as calculateDimensionData, X as each, b as getSourceItem, n as getScrollbarSize, Y as toInteger_1, _ as _isIterateeCall, q as timeout, i as getItemByPosition } from './index-00cb6ac1.js';
5
+ import { e as getColumnType, m as isGrouping, o as getGroupingName, d as getCellDataParsed, h as isColGrouping } from './column.service-00a51837.js';
6
+ import { f as calculateRowHeaderSize } from './row-header-utils-30750b8e.js';
6
7
  import { d as debounce_1 } from './debounce-e8e9464a.js';
7
8
  import { h } from './index-a61f225b.js';
8
- import { b as isGrouping, d as getGroupingName } from './column.service-414e9cba.js';
9
9
  import { F as FILTER_PROP, i as isFilterBtn } from './filter.button-37373672.js';
10
- import { d as dispatch, O as ON_COLUMN_CLICK } from './header-cell-renderer-ca570fcf.js';
10
+ import { d as dispatch, O as ON_COLUMN_CLICK } from './header-cell-renderer-6d89f141.js';
11
11
 
12
12
  /**
13
13
  * Storing pre-calculated
@@ -213,125 +213,6 @@ class BasePlugin {
213
213
  }
214
214
  }
215
215
 
216
- function getColumnType(rgCol) {
217
- if (rgCol.pin) {
218
- return rgCol.pin;
219
- }
220
- return 'rgCol';
221
- }
222
- function getColumnSizes(cols) {
223
- const res = {};
224
- for (const [i, c] of cols.entries()) {
225
- if (c.size) {
226
- res[i] = c.size;
227
- }
228
- }
229
- return res;
230
- }
231
- /**
232
- * Check if column is grouping column
233
- */
234
- function isColGrouping(colData) {
235
- return !!colData.children;
236
- }
237
- /**
238
- * This function is used to create a collection of columns.
239
- */
240
- function getColumns(columns, level = 0, types) {
241
- const collection = {
242
- // columns as they are in stores per type
243
- columns: {
244
- rgCol: [],
245
- colPinStart: [],
246
- colPinEnd: [],
247
- },
248
- // columns indexed by prop for quick access
249
- columnByProp: {},
250
- // column grouping
251
- columnGrouping: {
252
- rgCol: [],
253
- colPinStart: [],
254
- colPinEnd: [],
255
- },
256
- // max depth level for column grouping
257
- maxLevel: level,
258
- // sorting
259
- sort: {},
260
- };
261
- return reduce_1(columns, (res, colData) => {
262
- // Grouped column
263
- if (isColGrouping(colData)) {
264
- return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
265
- }
266
- // Regular column
267
- const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
268
- // Regular column, no Pin
269
- if (!regularColumn.pin) {
270
- res.columns.rgCol.push(regularColumn);
271
- // Pin
272
- }
273
- else {
274
- res.columns[regularColumn.pin].push(regularColumn);
275
- }
276
- if (regularColumn.order) {
277
- res.sort[regularColumn.prop] = regularColumn;
278
- }
279
- // it's possible that some columns have same prop, but better to avoid it
280
- if (!res.columnByProp[regularColumn.prop]) {
281
- res.columnByProp[regularColumn.prop] = [];
282
- }
283
- res.columnByProp[regularColumn.prop].push(regularColumn);
284
- // trigger setup hook if present
285
- regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
286
- return res;
287
- }, collection);
288
- }
289
- function gatherGroup(res, colData, collection, level = 0) {
290
- // group template
291
- const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
292
- // check columns for update
293
- for (let k in collection.columns) {
294
- const key = k;
295
- const resultItem = res.columns[key];
296
- const collectionItem = collection.columns[key];
297
- // if column data
298
- if (isArray_1(resultItem) && isArray_1(collectionItem)) {
299
- // fill columns
300
- resultItem.push(...collectionItem);
301
- // fill grouping
302
- if (collectionItem.length) {
303
- res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
304
- }
305
- }
306
- }
307
- // merge column groupings
308
- for (let k in collection.columnGrouping) {
309
- const key = k;
310
- const collectionItem = collection.columnGrouping[key];
311
- res.columnGrouping[key].push(...collectionItem);
312
- }
313
- res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
314
- res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
315
- return res;
316
- }
317
- function findColumn(columns, prop) {
318
- for (const c of columns) {
319
- if (isColGrouping(c)) {
320
- const found = findColumn(c.children, prop);
321
- if (found) {
322
- return found;
323
- }
324
- }
325
- else if (c.prop === prop) {
326
- return c;
327
- }
328
- }
329
- return undefined;
330
- }
331
- function getColumnByProp(columns, prop) {
332
- return findColumn(columns, prop);
333
- }
334
-
335
216
  /**
336
217
  * Plugin module for revo-grid grid system
337
218
  * Add support for automatic column resize
@@ -1110,23 +991,7 @@ const notContains = (value, extra) => {
1110
991
  notContains.extra = 'input';
1111
992
  contains.extra = 'input';
1112
993
 
1113
- const filterNames = {
1114
- none: 'None',
1115
- empty: 'Not set',
1116
- notEmpty: 'Set',
1117
- eq: 'Equal',
1118
- notEq: 'Not equal',
1119
- begins: 'Begins with',
1120
- contains: 'Contains',
1121
- notContains: 'Does not contain',
1122
- eqN: '=',
1123
- neqN: '!=',
1124
- gt: '>',
1125
- gte: '>=',
1126
- lt: '<',
1127
- lte: '<=',
1128
- };
1129
- const filterEntities = {
994
+ const filterCoreFunctionsIndexedByType = {
1130
995
  none: () => true,
1131
996
  empty: notSet,
1132
997
  notEmpty: set,
@@ -1146,7 +1011,37 @@ const filterTypes = {
1146
1011
  string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
1147
1012
  number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
1148
1013
  };
1014
+ const filterNames = {
1015
+ none: 'None',
1016
+ empty: 'Not set',
1017
+ notEmpty: 'Set',
1018
+ eq: 'Equal',
1019
+ notEq: 'Not equal',
1020
+ begins: 'Begins with',
1021
+ contains: 'Contains',
1022
+ notContains: 'Does not contain',
1023
+ eqN: '=',
1024
+ neqN: '!=',
1025
+ gt: '>',
1026
+ gte: '>=',
1027
+ lt: '<',
1028
+ lte: '<=',
1029
+ };
1149
1030
 
1031
+ /**
1032
+ * @typedef ColumnFilterConfig
1033
+ * @type {object}
1034
+ * @property {FilterCollection|undefined} collection - preserved filter data
1035
+ * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
1036
+ * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
1037
+ * @property {FilterLocalization|undefined} localization - translation for filter popup captions.
1038
+ * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
1039
+ * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.
1040
+ * A way to define your own filter types per column
1041
+ */
1042
+ /**
1043
+ * @internal
1044
+ */
1150
1045
  const FILTER_TRIMMED_TYPE = 'filter';
1151
1046
  const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
1152
1047
  class FilterPlugin extends BasePlugin {
@@ -1156,14 +1051,13 @@ class FilterPlugin extends BasePlugin {
1156
1051
  this.revogrid = revogrid;
1157
1052
  this.filterCollection = {};
1158
1053
  this.multiFilterItems = {};
1159
- this.possibleFilters = Object.assign({}, filterTypes);
1160
- this.possibleFilterNames = Object.assign({}, filterNames);
1161
- this.possibleFilterEntities = Object.assign({}, filterEntities);
1054
+ this.filterByType = Object.assign({}, filterTypes);
1055
+ this.filterNameIndexByType = Object.assign({}, filterNames);
1056
+ this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
1162
1057
  this.filterProp = FILTER_PROP;
1163
1058
  if (config) {
1164
1059
  this.initConfig(config);
1165
1060
  }
1166
- const headerclick = (e) => this.headerclick(e);
1167
1061
  const aftersourceset = async () => {
1168
1062
  const filterCollectionProps = Object.keys(this.filterCollection);
1169
1063
  if (filterCollectionProps.length > 0) {
@@ -1183,7 +1077,7 @@ class FilterPlugin extends BasePlugin {
1183
1077
  }
1184
1078
  await this.runFiltering();
1185
1079
  };
1186
- this.addEventListener('headerclick', headerclick);
1080
+ this.addEventListener('headerclick', (e) => this.headerclick(e));
1187
1081
  this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
1188
1082
  if (!detail) {
1189
1083
  this.clearFiltering();
@@ -1196,27 +1090,29 @@ class FilterPlugin extends BasePlugin {
1196
1090
  });
1197
1091
  this.addEventListener('aftersourceset', aftersourceset);
1198
1092
  this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
1199
- const existingNodes = this.revogrid.registerVNode.filter((n) => n.$tag$ !== 'revogr-filter-panel');
1093
+ const existingNodes = this.revogrid.registerVNode.filter(n => n.$tag$ !== 'revogr-filter-panel');
1200
1094
  this.revogrid.registerVNode = [
1201
1095
  ...existingNodes,
1202
- h("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.possibleFilterNames, filterEntities: this.possibleFilterEntities, 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) }),
1096
+ 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) }),
1203
1097
  ];
1204
1098
  }
1205
1099
  initConfig(config) {
1206
1100
  if (config.multiFilterItems) {
1207
1101
  this.multiFilterItems = Object.assign({}, config.multiFilterItems);
1208
1102
  }
1103
+ // Add custom filters
1209
1104
  if (config.customFilters) {
1210
- for (let cType in config.customFilters) {
1211
- const cFilter = config.customFilters[cType];
1212
- if (!this.possibleFilters[cFilter.columnFilterType]) {
1213
- this.possibleFilters[cFilter.columnFilterType] = [];
1105
+ for (let customFilterType in config.customFilters) {
1106
+ const cFilter = config.customFilters[customFilterType];
1107
+ if (!this.filterByType[cFilter.columnFilterType]) {
1108
+ this.filterByType[cFilter.columnFilterType] = [];
1214
1109
  }
1215
- this.possibleFilters[cFilter.columnFilterType].push(cType);
1216
- this.possibleFilterEntities[cType] = cFilter.func;
1217
- this.possibleFilterNames[cType] = cFilter.name;
1110
+ this.filterByType[cFilter.columnFilterType].push(customFilterType);
1111
+ this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
1112
+ this.filterNameIndexByType[customFilterType] = cFilter.name;
1218
1113
  }
1219
1114
  }
1115
+ // Add filterProp if provided in config
1220
1116
  if (config.filterProp) {
1221
1117
  this.filterProp = config.filterProp;
1222
1118
  }
@@ -1227,21 +1123,21 @@ class FilterPlugin extends BasePlugin {
1227
1123
  const cfgInlcude = config.include;
1228
1124
  if (cfgInlcude) {
1229
1125
  const filters = {};
1230
- for (let t in this.possibleFilters) {
1126
+ for (let t in this.filterByType) {
1231
1127
  // validate filters, if appropriate function present
1232
- const newTypes = this.possibleFilters[t].filter(f => cfgInlcude.indexOf(f) > -1);
1128
+ const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
1233
1129
  if (newTypes.length) {
1234
1130
  filters[t] = newTypes;
1235
1131
  }
1236
1132
  }
1237
1133
  // if any valid filters provided show them
1238
1134
  if (Object.keys(filters).length > 0) {
1239
- this.possibleFilters = filters;
1135
+ this.filterByType = filters;
1240
1136
  }
1241
1137
  }
1242
1138
  if (config.collection) {
1243
1139
  this.filterCollection = reduce_1(config.collection, (result, item, prop) => {
1244
- if (this.possibleFilterEntities[item.type]) {
1140
+ if (this.filterFunctionsIndexedByType[item.type]) {
1245
1141
  result[prop] = item;
1246
1142
  }
1247
1143
  else {
@@ -1253,8 +1149,8 @@ class FilterPlugin extends BasePlugin {
1253
1149
  if (config.localization) {
1254
1150
  if (config.localization.filterNames) {
1255
1151
  Object.entries(config.localization.filterNames).forEach(([k, v]) => {
1256
- if (this.possibleFilterNames[k] != void 0) {
1257
- this.possibleFilterNames[k] = v;
1152
+ if (this.filterNameIndexByType[k] != void 0) {
1153
+ this.filterNameIndexByType[k] = v;
1258
1154
  }
1259
1155
  });
1260
1156
  }
@@ -1280,13 +1176,12 @@ class FilterPlugin extends BasePlugin {
1280
1176
  const gridPos = this.revogrid.getBoundingClientRect();
1281
1177
  const buttonPos = el.getBoundingClientRect();
1282
1178
  const prop = e.detail.prop;
1283
- this.pop.filterTypes = this.getColumnFilter(e.detail.filter);
1284
- 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 }));
1179
+ 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) }));
1285
1180
  }
1286
1181
  getColumnFilter(type) {
1287
1182
  let filterType = 'string';
1288
1183
  if (!type) {
1289
- return { [filterType]: this.possibleFilters[filterType] };
1184
+ return { [filterType]: this.filterByType[filterType] };
1290
1185
  }
1291
1186
  // if custom column filter
1292
1187
  if (this.isValidType(type)) {
@@ -1296,44 +1191,59 @@ class FilterPlugin extends BasePlugin {
1296
1191
  else if (typeof type === 'object' && type.length) {
1297
1192
  return type.reduce((r, multiType) => {
1298
1193
  if (this.isValidType(multiType)) {
1299
- r[multiType] = this.possibleFilters[multiType];
1194
+ r[multiType] = this.filterByType[multiType];
1300
1195
  }
1301
1196
  return r;
1302
1197
  }, {});
1303
1198
  }
1304
- return { [filterType]: this.possibleFilters[filterType] };
1199
+ return { [filterType]: this.filterByType[filterType] };
1305
1200
  }
1306
1201
  isValidType(type) {
1307
- return !!(typeof type === 'string' && this.possibleFilters[type]);
1202
+ return !!(typeof type === 'string' && this.filterByType[type]);
1308
1203
  }
1309
- // called on internal component change
1204
+ /**
1205
+ * Called on internal component change
1206
+ */
1310
1207
  async onFilterChange(filterItems) {
1208
+ // store the filter items
1311
1209
  this.multiFilterItems = filterItems;
1210
+ // run the filtering when the items change
1312
1211
  this.runFiltering();
1313
1212
  }
1314
1213
  /**
1315
1214
  * Triggers grid filtering
1316
1215
  */
1317
- async doFiltering(collection, items, columns, filterItems) {
1216
+ async doFiltering(collection, source, columns, filterItems) {
1318
1217
  const columnsToUpdate = [];
1218
+ /**
1219
+ * Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
1220
+ */
1221
+ const columnByProp = {};
1319
1222
  columns.forEach(rgCol => {
1320
1223
  const column = Object.assign({}, rgCol);
1321
1224
  const hasFilter = filterItems[column.prop];
1225
+ columnByProp[column.prop] = column;
1226
+ /**
1227
+ * If the column has a filter and it's not already marked as filtered, update the column.
1228
+ */
1322
1229
  if (column[this.filterProp] && !hasFilter) {
1323
1230
  delete column[this.filterProp];
1324
1231
  columnsToUpdate.push(column);
1325
1232
  }
1233
+ /**
1234
+ * If the column does not have a filter and it's marked as filtered, update the column.
1235
+ */
1326
1236
  if (!column[this.filterProp] && hasFilter) {
1327
1237
  columnsToUpdate.push(column);
1328
1238
  column[this.filterProp] = true;
1329
1239
  }
1330
1240
  });
1331
- const itemsToFilter = this.getRowFilter(items, filterItems);
1241
+ const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
1332
1242
  // check is filter event prevented
1333
1243
  const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
1334
1244
  collection,
1335
- itemsToFilter,
1336
- source: items,
1245
+ itemsToFilter: itemsToTrim,
1246
+ source,
1337
1247
  filterItems,
1338
1248
  });
1339
1249
  if (defaultPrevented) {
@@ -1345,7 +1255,7 @@ class FilterPlugin extends BasePlugin {
1345
1255
  return;
1346
1256
  }
1347
1257
  // applies the hasFilter to the columns to show filter icon
1348
- await this.revogrid.updateColumns(columnsToUpdate);
1258
+ this.providers.column.updateColumns(columnsToUpdate);
1349
1259
  this.emit('afterfilterapply');
1350
1260
  }
1351
1261
  async clearFiltering() {
@@ -1361,7 +1271,7 @@ class FilterPlugin extends BasePlugin {
1361
1271
  if (this.multiFilterItems[prop].length > 0) {
1362
1272
  const firstFilterItem = this.multiFilterItems[prop][0];
1363
1273
  collection[prop] = {
1364
- filter: filterEntities[firstFilterItem.type],
1274
+ filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
1365
1275
  type: firstFilterItem.type,
1366
1276
  value: firstFilterItem.value,
1367
1277
  };
@@ -1386,52 +1296,68 @@ class FilterPlugin extends BasePlugin {
1386
1296
  columns: await this.revogrid.getColumns(),
1387
1297
  };
1388
1298
  }
1389
- getRowFilter(rows, filterItems) {
1299
+ /**
1300
+ * Get trimmed rows based on filter
1301
+ */
1302
+ getRowFilter(rows, filterItems, columnByProp) {
1390
1303
  const propKeys = Object.keys(filterItems);
1391
1304
  const trimmed = {};
1392
1305
  let propFilterSatisfiedCount = 0;
1393
1306
  let lastFilterResults = [];
1394
1307
  // each rows
1395
1308
  rows.forEach((model, rowIndex) => {
1396
- // working on all props
1309
+ // check filter by column properties
1397
1310
  for (const prop of propKeys) {
1398
1311
  const propFilters = filterItems[prop];
1312
+ // reset the count of satisfied filters
1399
1313
  propFilterSatisfiedCount = 0;
1314
+ // reset the array of last filter results
1400
1315
  lastFilterResults = [];
1401
1316
  // testing each filter for a prop
1402
1317
  for (const [filterIndex, filterData] of propFilters.entries()) {
1403
1318
  // the filter LogicFunction based on the type
1404
- const filter = this.possibleFilterEntities[filterData.type];
1319
+ const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
1405
1320
  // THE MAGIC OF FILTERING IS HERE
1321
+ const column = columnByProp[prop];
1322
+ // If there is no column but user wants to filter by a property
1323
+ const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];
1324
+ // OR relation
1406
1325
  if (filterData.relation === 'or') {
1326
+ // reset the array of last filter results
1407
1327
  lastFilterResults = [];
1408
- if (filter(model[prop], filterData.value)) {
1328
+ // if the filter is satisfied, continue to the next filter
1329
+ if (filterFunc(value, filterData.value)) {
1409
1330
  continue;
1410
1331
  }
1332
+ // if the filter is not satisfied, count it
1411
1333
  propFilterSatisfiedCount++;
1334
+ // AND relation
1412
1335
  }
1413
1336
  else {
1414
1337
  // 'and' relation will need to know the next filter
1415
1338
  // so we save this current filter to include it in the next filter
1416
- lastFilterResults.push(!filter(model[prop], filterData.value));
1339
+ lastFilterResults.push(!filterFunc(value, filterData.value));
1417
1340
  // check first if we have a filter on the next index to pair it with this current filter
1418
1341
  const nextFilterData = propFilters[filterIndex + 1];
1419
1342
  // stop the sequence if there is no next filter or if the next filter is not an 'and' relation
1420
1343
  if (!nextFilterData || nextFilterData.relation !== 'and') {
1421
1344
  // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1422
1345
  if (lastFilterResults.indexOf(true) === -1) {
1346
+ // reset the array of last filter results
1423
1347
  lastFilterResults = [];
1424
1348
  continue;
1425
1349
  }
1426
1350
  // we need to add all of the lastFilterResults since we need to satisfy all
1427
1351
  propFilterSatisfiedCount += lastFilterResults.length;
1352
+ // reset the array of last filter results
1428
1353
  lastFilterResults = [];
1429
1354
  }
1430
1355
  }
1431
1356
  } // end of propFilters forEach
1432
1357
  // add to the list of removed/trimmed rows of filter condition is satisfied
1433
- if (propFilterSatisfiedCount === propFilters.length)
1358
+ if (propFilterSatisfiedCount === propFilters.length) {
1434
1359
  trimmed[rowIndex] = true;
1360
+ }
1435
1361
  } // end of for-of propKeys
1436
1362
  });
1437
1363
  return trimmed;
@@ -1660,6 +1586,6 @@ function getLeftRelative(absoluteX, gridPos, offset) {
1660
1586
  return absoluteX - gridPos - offset;
1661
1587
  }
1662
1588
 
1663
- export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnPlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, StretchColumn as S, isStretchPlugin as a, FILTER_CONFIG_CHANGED_EVENT as b, columnTypes as c, FilterPlugin as d, getColumnType as e, getColumnSizes as f, getLeftRelative as g, isColGrouping as h, isRowType as i, getColumns as j, gatherGroup as k, getColumnByProp as l, rowTypes as r };
1589
+ export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnPlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, StretchColumn as S, isStretchPlugin as a, FILTER_CONFIG_CHANGED_EVENT as b, columnTypes as c, FilterPlugin as d, getLeftRelative as g, isRowType as i, rowTypes as r };
1664
1590
 
1665
- //# sourceMappingURL=column.drag.plugin-30dc4e24.js.map
1591
+ //# sourceMappingURL=column.drag.plugin-18125693.js.map