@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
package/hydrate/index.js CHANGED
@@ -2439,55 +2439,6 @@ class Clipboard {
2439
2439
  }; }
2440
2440
  }
2441
2441
 
2442
- const FILTER_BUTTON_CLASS = 'rv-filter';
2443
- const FILTER_BUTTON_ACTIVE = 'active';
2444
- const FILTER_PROP = 'hasFilter';
2445
- const AND_OR_BUTTON = 'and-or-button';
2446
- const TRASH_BUTTON = 'trash-button';
2447
- const FilterButton = ({ column }) => {
2448
- return (hAsync("span", null,
2449
- hAsync("button", { class: {
2450
- [FILTER_BUTTON_CLASS]: true,
2451
- [FILTER_BUTTON_ACTIVE]: column && !!column[FILTER_PROP],
2452
- } },
2453
- hAsync("svg", { class: "filter-img", viewBox: "0 0 64 64" },
2454
- hAsync("g", { stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" },
2455
- hAsync("path", { d: "M43,48 L43,56 L21,56 L21,48 L43,48 Z M53,28 L53,36 L12,36 L12,28 L53,28 Z M64,8 L64,16 L0,16 L0,8 L64,8 Z", fill: "currentColor" }))))));
2456
- };
2457
- const TrashButton = () => {
2458
- return (hAsync("div", { class: { [TRASH_BUTTON]: true } },
2459
- hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
2460
- hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
2461
- };
2462
- const AndOrButton = ({ text }) => {
2463
- return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
2464
- };
2465
- function isFilterBtn(e) {
2466
- if (e.classList.contains(FILTER_BUTTON_CLASS)) {
2467
- return true;
2468
- }
2469
- return e === null || e === void 0 ? void 0 : e.closest(`.${FILTER_BUTTON_CLASS}`);
2470
- }
2471
-
2472
- (function closest() {
2473
- if (!Element.prototype.matches) {
2474
- Element.prototype.matches =
2475
- Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
2476
- }
2477
- if (!Element.prototype.closest) {
2478
- Element.prototype.closest = function (s) {
2479
- let el = this;
2480
- do {
2481
- if (Element.prototype.matches.call(el, s)) {
2482
- return el;
2483
- }
2484
- el = el.parentElement || el.parentNode;
2485
- } while (el !== null && el.nodeType === 1);
2486
- return null;
2487
- };
2488
- }
2489
- })();
2490
-
2491
2442
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2492
2443
 
2493
2444
  /**
@@ -3029,6 +2980,55 @@ function debounce$2(func, wait, options) {
3029
2980
 
3030
2981
  var debounce_1 = debounce$2;
3031
2982
 
2983
+ const FILTER_BUTTON_CLASS = 'rv-filter';
2984
+ const FILTER_BUTTON_ACTIVE = 'active';
2985
+ const FILTER_PROP = 'hasFilter';
2986
+ const AND_OR_BUTTON = 'and-or-button';
2987
+ const TRASH_BUTTON = 'trash-button';
2988
+ const FilterButton = ({ column }) => {
2989
+ return (hAsync("span", null,
2990
+ hAsync("button", { class: {
2991
+ [FILTER_BUTTON_CLASS]: true,
2992
+ [FILTER_BUTTON_ACTIVE]: column && !!column[FILTER_PROP],
2993
+ } },
2994
+ hAsync("svg", { class: "filter-img", viewBox: "0 0 64 64" },
2995
+ hAsync("g", { stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" },
2996
+ hAsync("path", { d: "M43,48 L43,56 L21,56 L21,48 L43,48 Z M53,28 L53,36 L12,36 L12,28 L53,28 Z M64,8 L64,16 L0,16 L0,8 L64,8 Z", fill: "currentColor" }))))));
2997
+ };
2998
+ const TrashButton = () => {
2999
+ return (hAsync("div", { class: { [TRASH_BUTTON]: true } },
3000
+ hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
3001
+ hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
3002
+ };
3003
+ const AndOrButton = ({ text }) => {
3004
+ return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
3005
+ };
3006
+ function isFilterBtn(e) {
3007
+ if (e.classList.contains(FILTER_BUTTON_CLASS)) {
3008
+ return true;
3009
+ }
3010
+ return e === null || e === void 0 ? void 0 : e.closest(`.${FILTER_BUTTON_CLASS}`);
3011
+ }
3012
+
3013
+ (function closest() {
3014
+ if (!Element.prototype.matches) {
3015
+ Element.prototype.matches =
3016
+ Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
3017
+ }
3018
+ if (!Element.prototype.closest) {
3019
+ Element.prototype.closest = function (s) {
3020
+ let el = this;
3021
+ do {
3022
+ if (Element.prototype.matches.call(el, s)) {
3023
+ return el;
3024
+ }
3025
+ el = el.parentElement || el.parentNode;
3026
+ } while (el !== null && el.nodeType === 1);
3027
+ return null;
3028
+ };
3029
+ }
3030
+ })();
3031
+
3032
3032
  const filterStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037;border:1px solid #00772d}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:1px solid #cedefa;line-height:32px;background:none;color:#000;box-shadow:none}revogr-filter-panel{position:absolute;display:block;top:0;left:0;z-index:100;opacity:1;transform:none;background-color:#fff;transform-origin:62px 0px;box-shadow:0 5px 18px -2px rgba(0, 0, 0, 0.2);padding:10px;border-radius:4px;min-width:220px;text-align:left}revogr-filter-panel .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel select{width:100%}revogr-filter-panel input[type=text]{border:0;min-height:34px;margin:5px 0;background:#f3f3f3;border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel button{margin-top:10px;margin-right:5px}revogr-filter-panel .filter-actions{text-align:right;margin-right:-5px}.rgHeaderCell:hover .rv-filter{transition:opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}.rgHeaderCell:hover .rv-filter,.rgHeaderCell .rv-filter.active{opacity:1}.rgHeaderCell .rv-filter{height:24px;width:24px;background:none;border:0;opacity:0;visibility:visible;cursor:pointer;border-radius:4px}.rgHeaderCell .rv-filter.active{color:#10224a}.rgHeaderCell .rv-filter .filter-img{color:gray;width:11px}.select-css{display:block;font-family:sans-serif;font-weight:600;color:#444;line-height:1.3;padding:0.6em 1.4em 0.5em 0.8em;width:100%;max-width:100%;box-sizing:border-box;margin:0;border:1px solid #f1f1f1;box-shadow:transparent;border-radius:0.5em;appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E\"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);background-repeat:no-repeat, repeat;background-position:right 0.7em top 50%, 0 0;background-size:0.65em auto, 100%;}.select-css::-ms-expand{display:none}.select-css:hover{border-color:rgb(197, 197, 197)}.select-css:focus{border-color:#f1f1f1;box-shadow:0 0 1px 3px rgba(59, 153, 252, 0.7);box-shadow:0 0 0 3px -moz-mac-focusring;color:#222;outline:none}.select-css option{font-weight:normal}.select-css:disabled,.select-css[aria-disabled=true]{color:gray;background-image:url(\"data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E\"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%)}.select-css:disabled:hover,.select-css[aria-disabled=true]{border-color:#f1f1f1}.multi-filter-list{margin-top:5px;margin-bottom:5px}.multi-filter-list div{white-space:nowrap}.multi-filter-list .multi-filter-list-action{display:flex;justify-content:space-between;align-items:center}.multi-filter-list .and-or-button{margin:0 0 0 10px;min-width:58px;cursor:pointer}.multi-filter-list .trash-button{margin:0 0 -2px 6px;cursor:pointer;width:22px;height:100%;font-size:16px}.multi-filter-list .trash-button .trash-img{width:1em}.add-filter-divider{display:block;margin:0 -10px 10px -10px;border-bottom:1px solid #d9d9d9;height:10px}.select-input{display:flex;justify-content:space-between;align-items:center}";
3033
3033
  var RevogrFilterPanelStyle0 = filterStyleCss;
3034
3034
 
@@ -3066,7 +3066,6 @@ class FilterPanel {
3066
3066
  this.currentFilterType = defaultType;
3067
3067
  this.changes = undefined;
3068
3068
  this.filterItems = {};
3069
- this.filterTypes = {};
3070
3069
  this.filterNames = {};
3071
3070
  this.filterEntities = {};
3072
3071
  this.filterCaptions = undefined;
@@ -3092,7 +3091,9 @@ class FilterPanel {
3092
3091
  }
3093
3092
  this.currentFilterId = -1;
3094
3093
  const isOutside = !path.includes(this.element);
3095
- if (e.target instanceof HTMLElement && isOutside && !isFilterBtn(e.target)) {
3094
+ if (e.target instanceof HTMLElement &&
3095
+ isOutside &&
3096
+ !isFilterBtn(e.target)) {
3096
3097
  this.changes = undefined;
3097
3098
  }
3098
3099
  }
@@ -3116,15 +3117,19 @@ class FilterPanel {
3116
3117
  }
3117
3118
  }
3118
3119
  renderSelectOptions(type, isDefaultTypeRemoved = false) {
3119
- var _a;
3120
+ if (!this.changes) {
3121
+ return;
3122
+ }
3120
3123
  const options = [];
3121
- const prop = (_a = this.changes) === null || _a === void 0 ? void 0 : _a.prop;
3124
+ const prop = this.changes.prop;
3122
3125
  if (!isDefaultTypeRemoved) {
3123
3126
  const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
3124
- options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0 ? capts.add : this.filterNames[defaultType]));
3127
+ options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
3128
+ ? capts.add
3129
+ : this.filterNames[defaultType]));
3125
3130
  }
3126
- for (let gIndex in this.filterTypes) {
3127
- options.push(...this.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
3131
+ for (let gIndex in this.changes.filterTypes) {
3132
+ options.push(...this.changes.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
3128
3133
  options.push(hAsync("option", { disabled: true }));
3129
3134
  }
3130
3135
  return options;
@@ -3175,8 +3180,10 @@ class FilterPanel {
3175
3180
  top: `${this.changes.y}px`,
3176
3181
  };
3177
3182
  const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
3178
- return (hAsync(Host, { style: style, ref: (el) => { var _a; ((_a = this.changes) === null || _a === void 0 ? void 0 : _a.autoCorrect) && this.autoCorrect(el); } }, hAsync("label", null, capts.title), hAsync("div", { class: "filter-holder" }, this.getFilterItemsList()), hAsync("div", { class: "add-filter" }, hAsync("select", { id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))), hAsync("div", { class: "filter-actions" }, this.disableDynamicFiltering &&
3179
- hAsync("button", { id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save), hAsync("button", { id: "revo-button-reset", "aria-label": "reset", class: "revo-button light", onClick: () => this.onReset() }, capts.reset), hAsync("button", { id: "revo-button-cancel", "aria-label": "cancel", class: "revo-button light", onClick: () => this.onCancel() }, capts.cancel))));
3183
+ return (hAsync(Host, { style: style, ref: el => {
3184
+ var _a;
3185
+ ((_a = this.changes) === null || _a === void 0 ? void 0 : _a.autoCorrect) && this.autoCorrect(el);
3186
+ } }, hAsync("label", null, capts.title), hAsync("div", { class: "filter-holder" }, this.getFilterItemsList()), hAsync("div", { class: "add-filter" }, hAsync("select", { id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))), hAsync("div", { class: "filter-actions" }, this.disableDynamicFiltering && (hAsync("button", { id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save)), hAsync("button", { id: "revo-button-reset", "aria-label": "reset", class: "revo-button light", onClick: () => this.onReset() }, capts.reset), hAsync("button", { id: "revo-button-cancel", "aria-label": "cancel", class: "revo-button light", onClick: () => this.onCancel() }, capts.cancel))));
3180
3187
  }
3181
3188
  onFilterTypeChange(e, prop, index) {
3182
3189
  if (!(e.target instanceof HTMLSelectElement)) {
@@ -3314,7 +3321,6 @@ class FilterPanel {
3314
3321
  "$tagName$": "revogr-filter-panel",
3315
3322
  "$members$": {
3316
3323
  "filterItems": [16],
3317
- "filterTypes": [16],
3318
3324
  "filterNames": [16],
3319
3325
  "filterEntities": [16],
3320
3326
  "filterCaptions": [16],
@@ -8648,507 +8654,133 @@ class OrderEditor {
8648
8654
  }; }
8649
8655
  }
8650
8656
 
8651
- const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
8652
- const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
8653
- const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
8654
- const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
8655
- const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
8656
- const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
8657
- const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
8658
- const GROUP_EXPAND_BTN = `group-expand`;
8659
- const GROUP_EXPAND_EVENT = `groupexpandclick`;
8660
- const GROUPING_ROW_TYPE = 'rgRow';
8661
-
8662
- function getGroupValueDefault(item, prop) {
8663
- return item[prop] || null;
8664
- }
8665
- /**
8666
- * Gather data for grouping
8667
- * @param array - flat data array
8668
- * @param groupIds - ids of groups
8669
- * @param expanded - potentially expanded items if present
8670
- */
8671
- function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
8672
- const groupedItems = new Map();
8673
- array.forEach((item, originalIndex) => {
8674
- const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
8675
- const lastLevelValue = groupLevelValues.pop();
8676
- let currentGroupLevel = groupedItems;
8677
- groupLevelValues.forEach(value => {
8678
- if (!currentGroupLevel.has(value)) {
8679
- currentGroupLevel.set(value, new Map());
8680
- }
8681
- currentGroupLevel = currentGroupLevel.get(value);
8682
- });
8683
- if (!currentGroupLevel.has(lastLevelValue)) {
8684
- currentGroupLevel.set(lastLevelValue, []);
8685
- }
8686
- const lastLevelItems = currentGroupLevel.get(lastLevelValue);
8687
- lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
8688
- });
8689
- let itemIndex = -1;
8690
- const groupingDepth = groupIds.length;
8691
- // collapse all groups in the beginning
8692
- const trimmed = {};
8693
- // index mapping
8694
- const oldNewIndexMap = {};
8695
- // check if group header exists
8696
- const pseudoGroupTest = {};
8697
- const sourceWithGroups = [];
8698
- function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
8699
- const depth = parentIds.length;
8700
- groupedValues.forEach((innerGroupedValues, groupId) => {
8701
- const levelIds = [...parentIds, groupId];
8702
- const mergedIds = levelIds.join(',');
8703
- const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
8704
- sourceWithGroups.push({
8705
- [PSEUDO_GROUP_ITEM]: groupId,
8706
- [GROUP_DEPTH]: depth,
8707
- [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
8708
- [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
8709
- [GROUP_EXPANDED]: isGroupExpanded,
8710
- });
8711
- itemIndex += 1;
8712
- if (!isGroupExpanded && depth) {
8713
- trimmed[itemIndex] = true;
8714
- }
8715
- if (Array.isArray(innerGroupedValues)) {
8716
- innerGroupedValues.forEach(value => {
8717
- itemIndex += 1;
8718
- if (!isGroupExpanded) {
8719
- trimmed[itemIndex] = true;
8720
- }
8721
- oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
8722
- const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
8723
- pseudoGroupTestIds.forEach(pseudoGroupTestId => {
8724
- if (!pseudoGroupTest[pseudoGroupTestId]) {
8725
- pseudoGroupTest[pseudoGroupTestId] = [];
8726
- }
8727
- pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
8728
- });
8729
- });
8730
- sourceWithGroups.push(...innerGroupedValues);
8731
- }
8732
- else {
8733
- flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
8734
- }
8735
- });
8657
+ function getCellData(val) {
8658
+ if (typeof val === 'undefined' || val === null) {
8659
+ return '';
8736
8660
  }
8737
- flattenGroupMaps(groupedItems, [], true);
8738
- return {
8739
- sourceWithGroups, // updates source mirror
8740
- depth: groupingDepth, // largest depth for grouping
8741
- trimmed, // used for expand/collapse grouping values
8742
- oldNewIndexMap, // used for mapping old values to new
8743
- childrenByGroup: pseudoGroupTest, // used to get child items in group
8744
- };
8745
- }
8746
- function getGroupingName(rgRow) {
8747
- return rgRow && rgRow[PSEUDO_GROUP_ITEM];
8748
- }
8749
- function isGrouping(rgRow) {
8750
- return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
8661
+ return val;
8751
8662
  }
8752
- function isGroupingColumn(column) {
8753
- return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
8663
+ function getCellDataParsed(model, column) {
8664
+ const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
8665
+ return getCellData(val);
8754
8666
  }
8755
- function measureEqualDepth(groupA, groupB) {
8756
- const ln = groupA.length;
8757
- let i = 0;
8758
- for (; i < ln; i++) {
8759
- if (groupA[i] !== groupB[i]) {
8760
- return i;
8761
- }
8667
+ function getColumnType(rgCol) {
8668
+ if (rgCol.pin) {
8669
+ return rgCol.pin;
8762
8670
  }
8763
- return i;
8671
+ return 'rgCol';
8764
8672
  }
8765
- function getParsedGroup(id) {
8766
- const parseGroup = JSON.parse(id);
8767
- // extra precaution and type safeguard
8768
- if (!Array.isArray(parseGroup)) {
8769
- return null;
8673
+ function getColumnSizes(cols) {
8674
+ const res = {};
8675
+ for (const [i, c] of cols.entries()) {
8676
+ if (c.size) {
8677
+ res[i] = c.size;
8678
+ }
8770
8679
  }
8771
- return parseGroup;
8680
+ return res;
8772
8681
  }
8773
- // check if items is child of current clicked group
8774
- function isSameGroup(currentGroup, currentModel, nextModel) {
8775
- const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
8776
- if (!nextGroup) {
8777
- return false;
8778
- }
8779
- const depth = measureEqualDepth(currentGroup, nextGroup);
8780
- return currentModel[GROUP_DEPTH] < depth;
8682
+ /**
8683
+ * Check if column is grouping column
8684
+ */
8685
+ function isColGrouping(colData) {
8686
+ return !!colData.children;
8781
8687
  }
8782
-
8783
8688
  /**
8784
- * The base implementation of `_.slice` without an iteratee call guard.
8785
- *
8786
- * @private
8787
- * @param {Array} array The array to slice.
8788
- * @param {number} [start=0] The start position.
8789
- * @param {number} [end=array.length] The end position.
8790
- * @returns {Array} Returns the slice of `array`.
8689
+ * This function is used to create a collection of columns.
8791
8690
  */
8792
-
8793
- function baseSlice$1(array, start, end) {
8794
- var index = -1,
8795
- length = array.length;
8796
-
8797
- if (start < 0) {
8798
- start = -start > length ? 0 : (length + start);
8799
- }
8800
- end = end > length ? length : end;
8801
- if (end < 0) {
8802
- end += length;
8803
- }
8804
- length = start > end ? 0 : ((end - start) >>> 0);
8805
- start >>>= 0;
8806
-
8807
- var result = Array(length);
8808
- while (++index < length) {
8809
- result[index] = array[index + start];
8810
- }
8811
- return result;
8812
- }
8813
-
8814
- var _baseSlice = baseSlice$1;
8815
-
8816
- var baseSlice = _baseSlice,
8817
- isIterateeCall$1 = _isIterateeCall,
8818
- toInteger$2 = toInteger_1;
8819
-
8820
- /**
8821
- * Creates a slice of `array` from `start` up to, but not including, `end`.
8822
- *
8823
- * **Note:** This method is used instead of
8824
- * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
8825
- * returned.
8826
- *
8827
- * @static
8828
- * @memberOf _
8829
- * @since 3.0.0
8830
- * @category Array
8831
- * @param {Array} array The array to slice.
8832
- * @param {number} [start=0] The start position.
8833
- * @param {number} [end=array.length] The end position.
8834
- * @returns {Array} Returns the slice of `array`.
8835
- */
8836
- function slice(array, start, end) {
8837
- var length = array == null ? 0 : array.length;
8838
- if (!length) {
8839
- return [];
8840
- }
8841
- if (end && typeof end != 'number' && isIterateeCall$1(array, start, end)) {
8842
- start = 0;
8843
- end = length;
8844
- }
8845
- else {
8846
- start = start == null ? 0 : toInteger$2(start);
8847
- end = end === undefined ? length : toInteger$2(end);
8848
- }
8849
- return baseSlice(array, start, end);
8850
- }
8851
-
8852
- var slice_1 = slice;
8853
-
8854
- class ColumnService {
8855
- get columns() {
8856
- return getVisibleSourceItem(this.source);
8857
- }
8858
- constructor(dataStore, source) {
8859
- this.dataStore = dataStore;
8860
- this.source = source;
8861
- this.unsubscribe = [];
8862
- this.hasGrouping = false;
8863
- this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
8864
- this.checkGrouping(source.get('source'));
8865
- this.type = source.get('type');
8866
- }
8867
- checkGrouping(cols) {
8868
- for (let rgCol of cols) {
8869
- if (isGroupingColumn(rgCol)) {
8870
- this.hasGrouping = true;
8871
- return;
8872
- }
8873
- this.hasGrouping = false;
8874
- }
8875
- }
8876
- isReadOnly(r, c) {
8877
- var _a;
8878
- const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
8879
- if (typeof readOnly === 'function') {
8880
- const data = this.rowDataModel(r, c);
8881
- return readOnly(data);
8882
- }
8883
- return !!readOnly;
8884
- }
8885
- mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
8886
- const cellClass = {
8887
- [CELL_CLASS]: true,
8888
- [DISABLED_CLASS]: this.isReadOnly(r, c),
8889
- };
8890
- let props = Object.assign(Object.assign({}, defaultProps), { class: cellClass });
8891
- const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
8892
- if (!extra) {
8893
- return props;
8691
+ function getColumns(columns, level = 0, types) {
8692
+ const collection = {
8693
+ // columns as they are in stores per type
8694
+ columns: {
8695
+ rgCol: [],
8696
+ colPinStart: [],
8697
+ colPinEnd: [],
8698
+ },
8699
+ // columns indexed by prop for quick access
8700
+ columnByProp: {},
8701
+ // column grouping
8702
+ columnGrouping: {
8703
+ rgCol: [],
8704
+ colPinStart: [],
8705
+ colPinEnd: [],
8706
+ },
8707
+ // max depth level for column grouping
8708
+ maxLevel: level,
8709
+ // sorting
8710
+ sort: {},
8711
+ };
8712
+ return reduce_1(columns, (res, colData) => {
8713
+ // Grouped column
8714
+ if (isColGrouping(colData)) {
8715
+ return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
8894
8716
  }
8895
- return doPropMerge(props, extra);
8896
- }
8897
- getRowClass(r, prop) {
8898
- const model = getSourceItem(this.dataStore, r) || {};
8899
- return model[prop] || '';
8900
- }
8901
- getCellData(r, c) {
8902
- const data = this.rowDataModel(r, c);
8903
- return getCellData(data.model[data.prop]);
8904
- }
8905
- getSaveData(rowIndex, colIndex, val) {
8906
- if (typeof val === 'undefined') {
8907
- val = this.getCellData(rowIndex, colIndex);
8717
+ // Regular column
8718
+ const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
8719
+ // Regular column, no Pin
8720
+ if (!regularColumn.pin) {
8721
+ res.columns.rgCol.push(regularColumn);
8722
+ // Pin
8908
8723
  }
8909
- const data = this.rowDataModel(rowIndex, colIndex);
8910
- return {
8911
- prop: data.prop,
8912
- rowIndex,
8913
- colIndex,
8914
- val,
8915
- model: data.model,
8916
- colType: this.type,
8917
- type: this.dataStore.get('type'),
8918
- };
8919
- }
8920
- getCellEditor(_r, c, editors) {
8921
- var _a;
8922
- const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
8923
- if (!editor) {
8924
- return undefined;
8724
+ else {
8725
+ res.columns[regularColumn.pin].push(regularColumn);
8925
8726
  }
8926
- // reference
8927
- if (typeof editor === 'string') {
8928
- return editors[editor];
8727
+ if (regularColumn.order) {
8728
+ res.sort[regularColumn.prop] = regularColumn;
8929
8729
  }
8930
- return editor;
8931
- }
8932
- /**
8933
- * Get cell data model for given rowIndex and colIndex
8934
- * Used to pass data to editor/renderer
8935
- */
8936
- rowDataModel(rowIndex, colIndex) {
8937
- const column = this.columns[colIndex];
8938
- const prop = column === null || column === void 0 ? void 0 : column.prop;
8939
- const model = getSourceItem(this.dataStore, rowIndex) || {};
8940
- const value = model[prop];
8941
- const type = this.dataStore.get('type');
8942
- return {
8943
- prop,
8944
- model,
8945
- data: this.dataStore.get('source'),
8946
- column,
8947
- rowIndex,
8948
- colIndex,
8949
- colType: this.type,
8950
- type,
8951
- value,
8952
- };
8953
- }
8954
- getRangeData(d, columns) {
8955
- var _a;
8956
- const changed = {};
8957
- // get original length sizes
8958
- const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
8959
- const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
8960
- const mapping = {};
8961
- // rows
8962
- for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
8963
- // copy original data link
8964
- const oldRowIndex = d.oldRange.y + (i % copyRowLength);
8965
- const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
8966
- // columns
8967
- for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
8968
- // check if old range area
8969
- if (rowIndex >= d.oldRange.y &&
8970
- rowIndex <= d.oldRange.y1 &&
8971
- colIndex >= d.oldRange.x &&
8972
- colIndex <= d.oldRange.x1) {
8973
- continue;
8974
- }
8975
- // requested column beyond range
8976
- if (!this.columns[colIndex]) {
8977
- continue;
8978
- }
8979
- const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
8980
- const copyColIndex = d.oldRange.x + (j % copyColLength);
8981
- const copyColumnProp = columns[copyColIndex].prop;
8982
- /** if can write */
8983
- if (!this.isReadOnly(rowIndex, colIndex)) {
8984
- /** to show before save */
8985
- if (!changed[rowIndex]) {
8986
- changed[rowIndex] = {};
8987
- }
8988
- changed[rowIndex][prop] = copyRow[copyColumnProp];
8989
- /** Generate mapping object */
8990
- if (!mapping[rowIndex]) {
8991
- mapping[rowIndex] = {};
8992
- }
8993
- mapping[rowIndex][prop] = {
8994
- colIndex: copyColIndex,
8995
- colProp: copyColumnProp,
8996
- rowIndex: oldRowIndex,
8997
- };
8998
- }
8999
- }
8730
+ // it's possible that some columns have same prop, but better to avoid it
8731
+ if (!res.columnByProp[regularColumn.prop]) {
8732
+ res.columnByProp[regularColumn.prop] = [];
9000
8733
  }
9001
- return {
9002
- changed,
9003
- mapping,
9004
- };
9005
- }
9006
- getTransformedDataToApply(start, data) {
9007
- const changed = {};
9008
- const copyRowLength = data.length;
9009
- const colLength = this.columns.length;
9010
- const rowLength = this.dataStore.get('items').length;
9011
- // rows
9012
- let rowIndex = start.y;
9013
- let maxCol = 0;
9014
- for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
9015
- // copy original data link
9016
- const copyRow = data[i % copyRowLength];
9017
- const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
9018
- // columns
9019
- let colIndex = start.x;
9020
- for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
9021
- const p = this.columns[colIndex].prop;
9022
- const currentCol = j % colLength;
9023
- /** if can write */
9024
- if (!this.isReadOnly(rowIndex, colIndex)) {
9025
- /** to show before save */
9026
- if (!changed[rowIndex]) {
9027
- changed[rowIndex] = {};
9028
- }
9029
- changed[rowIndex][p] = copyRow[currentCol];
9030
- }
8734
+ res.columnByProp[regularColumn.prop].push(regularColumn);
8735
+ // trigger setup hook if present
8736
+ regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
8737
+ return res;
8738
+ }, collection);
8739
+ }
8740
+ function gatherGroup(res, colData, collection, level = 0) {
8741
+ // group template
8742
+ const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
8743
+ // check columns for update
8744
+ for (let k in collection.columns) {
8745
+ const key = k;
8746
+ const resultItem = res.columns[key];
8747
+ const collectionItem = collection.columns[key];
8748
+ // if column data
8749
+ if (isArray_1(resultItem) && isArray_1(collectionItem)) {
8750
+ // fill columns
8751
+ resultItem.push(...collectionItem);
8752
+ // fill grouping
8753
+ if (collectionItem.length) {
8754
+ res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
9031
8755
  }
9032
- maxCol = Math.max(maxCol, colIndex - 1);
9033
8756
  }
9034
- const range = getRange(start, {
9035
- y: rowIndex - 1,
9036
- x: maxCol,
9037
- });
9038
- return {
9039
- changed,
9040
- range,
9041
- };
9042
8757
  }
9043
- getRangeStaticData(d, value) {
9044
- const changed = {};
9045
- // rows
9046
- for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
9047
- // columns
9048
- for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
9049
- // requested column beyond range
9050
- if (!this.columns[colIndex]) {
9051
- continue;
9052
- }
9053
- const p = this.columns[colIndex].prop;
9054
- /** if can write */
9055
- if (!this.isReadOnly(rowIndex, colIndex)) {
9056
- /** to show before save */
9057
- if (!changed[rowIndex]) {
9058
- changed[rowIndex] = {};
9059
- }
9060
- changed[rowIndex][p] = value;
9061
- }
9062
- }
9063
- }
9064
- return changed;
8758
+ // merge column groupings
8759
+ for (let k in collection.columnGrouping) {
8760
+ const key = k;
8761
+ const collectionItem = collection.columnGrouping[key];
8762
+ res.columnGrouping[key].push(...collectionItem);
9065
8763
  }
9066
- getRangeTransformedToProps(d, store) {
9067
- var _a;
9068
- const area = [];
9069
- const type = this.dataStore.get('type');
9070
- // rows
9071
- for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
9072
- // columns
9073
- for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
9074
- const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
9075
- area.push({
9076
- prop,
9077
- rowIndex,
9078
- colIndex,
9079
- model: getSourceItem(store, rowIndex),
9080
- type,
9081
- colType: this.type,
9082
- });
8764
+ res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
8765
+ res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
8766
+ return res;
8767
+ }
8768
+ function findColumn(columns, prop) {
8769
+ for (const c of columns) {
8770
+ if (isColGrouping(c)) {
8771
+ const found = findColumn(c.children, prop);
8772
+ if (found) {
8773
+ return found;
9083
8774
  }
9084
8775
  }
9085
- return area;
9086
- }
9087
- copyRangeArray(range, store) {
9088
- const cols = [...this.columns];
9089
- const props = slice_1(cols, range.x, range.x1 + 1).map(v => v.prop);
9090
- const toCopy = [];
9091
- const mapping = {};
9092
- // rows indexes
9093
- for (let i = range.y; i <= range.y1; i++) {
9094
- const rgRow = [];
9095
- mapping[i] = {};
9096
- // columns indexes
9097
- for (let prop of props) {
9098
- const item = getSourceItem(store, i);
9099
- // if no item - skip
9100
- if (!item) {
9101
- continue;
9102
- }
9103
- const val = item[prop];
9104
- rgRow.push(val);
9105
- mapping[i][prop] = val;
9106
- }
9107
- toCopy.push(rgRow);
8776
+ else if (c.prop === prop) {
8777
+ return c;
9108
8778
  }
9109
- return {
9110
- data: toCopy,
9111
- mapping,
9112
- };
9113
8779
  }
9114
- destroy() {
9115
- this.unsubscribe.forEach(f => f());
9116
- }
9117
- }
9118
- function getCellData(val) {
9119
- if (typeof val === 'undefined' || val === null) {
9120
- return '';
9121
- }
9122
- return val;
9123
- }
9124
- /**
9125
- * Checks if the given rowDrag is a service for dragging rows.
9126
- */
9127
- function isRowDragService(rowDrag, model) {
9128
- if (typeof rowDrag === 'function') {
9129
- return rowDrag(model);
9130
- }
9131
- return !!rowDrag;
8780
+ return undefined;
9132
8781
  }
9133
- function doPropMerge(existing, extra) {
9134
- let props = Object.assign(Object.assign({}, extra), existing);
9135
- // extend existing props
9136
- if (extra.class) {
9137
- if (typeof extra.class === 'object' && typeof props.class === 'object') {
9138
- props.class = Object.assign(Object.assign({}, extra.class), props.class);
9139
- }
9140
- else if (typeof extra.class === 'string' &&
9141
- typeof props.class === 'object') {
9142
- props.class[extra.class] = true;
9143
- }
9144
- else if (typeof props.class === 'string') {
9145
- props.class += ' ' + extra.class;
9146
- }
9147
- }
9148
- if (extra.style) {
9149
- props.style = Object.assign(Object.assign({}, extra.style), props.style);
9150
- }
9151
- return props;
8782
+ function getColumnByProp(columns, prop) {
8783
+ return findColumn(columns, prop);
9152
8784
  }
9153
8785
 
9154
8786
  var codes;
@@ -9227,386 +8859,761 @@ var keyValues;
9227
8859
  keyValues["TAB"] = "Tab";
9228
8860
  })(keyValues || (keyValues = {}));
9229
8861
 
9230
- function isTouch(e) {
9231
- return !!e.touches;
9232
- }
9233
- function verifyTouchTarget(touchEvent, focusClass) {
9234
- if (focusClass && touchEvent) {
9235
- if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
9236
- return false;
9237
- }
9238
- }
9239
- return true;
9240
- }
9241
- /**
9242
- * Function to get the value of a specific property from a MouseEvent or TouchEvent object.
9243
- */
9244
- function getPropertyFromEvent(e, prop, focusClass // for touch events
9245
- ) {
9246
- // Check if the event is a touch event
9247
- if (isTouch(e)) {
9248
- // If the event has touches, get the first touch
9249
- if (e.touches.length > 0) {
9250
- const touchEvent = e.touches[0];
9251
- // Check if the target of the touch event is the specified element
9252
- if (!verifyTouchTarget(touchEvent, focusClass)) {
9253
- // If not, return null
9254
- return null;
9255
- }
9256
- // Get the value of the specified property from the touch event and return it
9257
- return touchEvent[prop] || 0;
9258
- }
9259
- // If there are no touches, return null
9260
- return null;
9261
- }
9262
- // If the event is not a touch event, get the value of the specified property from the event and return it
9263
- return e[prop] || 0;
9264
- }
8862
+ var osPlatform;
8863
+ (function (osPlatform) {
8864
+ osPlatform["mac"] = "Mac";
8865
+ })(osPlatform || (osPlatform = {}));
9265
8866
 
9266
- function collectModelsOfRange(data, store) {
9267
- const models = {};
9268
- for (let i in data) {
9269
- const rowIndex = parseInt(i, 10);
9270
- models[rowIndex] = getSourceItem(store, rowIndex);
9271
- }
9272
- return models;
8867
+ function isClear(code) {
8868
+ return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;
9273
8869
  }
9274
- function getFocusCellBasedOnEvent(e, data) {
9275
- // If event default is prevented, return
9276
- if (e.defaultPrevented) {
9277
- return null;
9278
- }
9279
- // Get coordinates from event object
9280
- const x = getPropertyFromEvent(e, 'clientX');
9281
- const y = getPropertyFromEvent(e, 'clientY');
9282
- // If coordinates are not available, return
9283
- if (x === null || y === null) {
9284
- return null;
9285
- }
9286
- // Get current cell based on coordinates and data
9287
- const focusCell = getCurrentCell({ x, y }, data);
9288
- // If current cell is not available, return
9289
- if (isAfterLast(focusCell, data.lastCell)) {
9290
- return null;
9291
- }
9292
- return focusCell;
8870
+ function isTab(code) {
8871
+ return codesLetter.TAB === code;
8872
+ }
8873
+ function isEnterKeyValue(key) {
8874
+ return keyValues.ENTER === key;
8875
+ }
8876
+ function isCut(event) {
8877
+ return ((event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows
8878
+ (event.metaKey && event.code === 'KeyX')); // Cmd + X on Mac
8879
+ }
8880
+ function isCopy(event) {
8881
+ return ((event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows
8882
+ (event.metaKey && event.code === 'KeyC')); // Cmd + C on Mac
8883
+ }
8884
+ function isPaste(event) {
8885
+ return ((event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows
8886
+ (event.metaKey && event.code === 'KeyV')); // Cmd + V on Mac
8887
+ }
8888
+ function isAll(event) {
8889
+ return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
8890
+ (event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
9293
8891
  }
8892
+
8893
+ const LETTER_BLOCK_SIZE$1 = 10;
8894
+ const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
8895
+ return ((rowHeaderColumn === null || rowHeaderColumn === void 0 ? void 0 : rowHeaderColumn.size) ||
8896
+ Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE$1, minWidth));
8897
+ };
8898
+
9294
8899
  /**
9295
- * Calculate cell based on x, y position
8900
+ * Calculate system scrollbar size
9296
8901
  */
9297
- function getCurrentCell({ x, y }, { el, rows, cols }) {
9298
- // Get the bounding rectangle of the element
9299
- const { top, left, height, width } = el.getBoundingClientRect();
9300
- // Calculate the cell position relative to the element
9301
- let cellY = y - top;
9302
- let cellX = x - left;
9303
- // Limit the cell position to the element height
9304
- if (cellY >= height) {
9305
- cellY = height - 1;
9306
- }
9307
- // Limit the cell position to the element width
9308
- if (cellX >= width) {
9309
- cellX = width - 1;
9310
- }
9311
- // Get the row and column items based on the cell position
9312
- const rgRow = getItemByPosition(rows, cellY);
9313
- const rgCol = getItemByPosition(cols, cellX);
9314
- // Set the row and column index to 0 if they are before the first item
9315
- if (rgCol.itemIndex < 0) {
9316
- rgCol.itemIndex = 0;
9317
- }
9318
- if (rgRow.itemIndex < 0) {
9319
- rgRow.itemIndex = 0;
9320
- }
9321
- return { x: rgCol.itemIndex, y: rgRow.itemIndex };
8902
+ function getScrollbarSize(document) {
8903
+ // Create a temporary div container and append it to the body
8904
+ const container = document.createElement('div');
8905
+ // Apply styling to ensure the div is scrollable
8906
+ container.style.overflow = 'scroll';
8907
+ container.style.visibility = 'hidden'; // make sure the container isn't visible
8908
+ container.style.position = 'absolute';
8909
+ container.style.top = '-9999px'; // move it out of the screen
8910
+ container.style.width = '50px'; // arbitrary width
8911
+ container.style.height = '50px'; // arbitrary height
8912
+ // Append the div to the body
8913
+ document.body.appendChild(container);
8914
+ // Calculate the width of the scrollbar
8915
+ const scrollbarWidth = container.offsetWidth - container.clientWidth;
8916
+ // Remove the div from the body after calculation
8917
+ document.body.removeChild(container);
8918
+ // Return the calculated width of the scrollbar
8919
+ return scrollbarWidth;
9322
8920
  }
9323
- function getCoordinate(range, focus, changes, isMulti = false) {
9324
- const updateCoordinate = (c, pos = 0) => {
9325
- const start = { x: range.x, y: range.y };
9326
- const end = isMulti ? { x: range.x1, y: range.y1 } : start;
9327
- const point = end[c] > focus[c] ? end : start;
9328
- point[c] += pos;
9329
- return { start, end };
9330
- };
9331
- if (changes.x) {
9332
- return updateCoordinate('x', changes['x']);
9333
- }
9334
- if (changes.y) {
9335
- return updateCoordinate('y', changes['y']);
9336
- }
9337
- return null;
8921
+ /* Scale a value between 2 ranges
8922
+ *
8923
+ * Sample:
8924
+ * // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
8925
+ * const n = scaleValue(55, [0,100], [0,1000]);
8926
+ *
8927
+ * Ranges of two values
8928
+ * @from
8929
+ * @to
8930
+ *
8931
+ * ~~ return value does the equivalent of Math.floor but faster.
8932
+ */
8933
+ function scaleValue(value, from, to) {
8934
+ return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
9338
8935
  }
9339
8936
  /**
9340
- * Check if the x coordinate of the cell position is after or equal to the x coordinate of the last cell position
9341
- * or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
8937
+ * Async timeout
9342
8938
  */
9343
- function isAfterLast({ x, y }, lastCell) {
9344
- return x >= lastCell.x || y >= lastCell.y;
9345
- }
9346
- /** check if out of range */
9347
- function isBeforeFirst({ x, y }) {
9348
- return x < 0 || y < 0;
8939
+ async function timeout(delay = 0) {
8940
+ await new Promise((r) => {
8941
+ setTimeout(() => r(), delay);
8942
+ });
9349
8943
  }
9350
- /** Compare cells, only 1 coordinate difference is possible */
9351
- // export function getDirectionCoordinate(initial: Cell, last: Cell): Partial<Cell> | null {
9352
- // const c: (keyof Cell)[] = ['x', 'y'];
9353
- // for (let k of c) {
9354
- // if (initial[k] !== last[k]) {
9355
- // return { [k]: 1 };
9356
- // }
9357
- // }
9358
- // return null;
9359
- // }
9360
- // export function getLargestAxis(initial: Cell, last: Cell): Partial<Cell> | null {
9361
- // const cell: Partial<Cell> = {};
9362
- // const c: (keyof Cell)[] = ['x', 'y'];
9363
- // for (let k of c) {
9364
- // cell[k] = Math.abs(initial[k] - last[k]);
9365
- // }
9366
- // if (cell.x > cell.y) {
9367
- // return { x: 1 };
9368
- // }
9369
- // if (cell.y > cell.x) {
9370
- // return { y: 1 };
9371
- // }
9372
- // return null;
9373
- // }
9374
- function styleByCellProps(styles) {
9375
- return {
9376
- left: `${styles.left}px`,
9377
- top: `${styles.top}px`,
9378
- width: `${styles.width}px`,
9379
- height: `${styles.height}px`,
9380
- };
8944
+
8945
+ const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
8946
+ const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
8947
+ const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
8948
+ const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
8949
+ const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
8950
+ const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
8951
+ const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
8952
+ const GROUP_EXPAND_BTN = `group-expand`;
8953
+ const GROUP_EXPAND_EVENT = `groupexpandclick`;
8954
+ const GROUPING_ROW_TYPE = 'rgRow';
8955
+
8956
+ function getGroupValueDefault(item, prop) {
8957
+ return item[prop] || null;
9381
8958
  }
9382
- function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
9383
- const top = getItemByIndex(dimensionRow, y).start;
9384
- const left = getItemByIndex(dimensionCol, x).start;
9385
- const bottom = getItemByIndex(dimensionRow, y1).end;
9386
- const right = getItemByIndex(dimensionCol, x1).end;
8959
+ /**
8960
+ * Gather data for grouping
8961
+ * @param array - flat data array
8962
+ * @param groupIds - ids of groups
8963
+ * @param expanded - potentially expanded items if present
8964
+ */
8965
+ function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
8966
+ const groupedItems = new Map();
8967
+ array.forEach((item, originalIndex) => {
8968
+ const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
8969
+ const lastLevelValue = groupLevelValues.pop();
8970
+ let currentGroupLevel = groupedItems;
8971
+ groupLevelValues.forEach(value => {
8972
+ if (!currentGroupLevel.has(value)) {
8973
+ currentGroupLevel.set(value, new Map());
8974
+ }
8975
+ currentGroupLevel = currentGroupLevel.get(value);
8976
+ });
8977
+ if (!currentGroupLevel.has(lastLevelValue)) {
8978
+ currentGroupLevel.set(lastLevelValue, []);
8979
+ }
8980
+ const lastLevelItems = currentGroupLevel.get(lastLevelValue);
8981
+ lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
8982
+ });
8983
+ let itemIndex = -1;
8984
+ const groupingDepth = groupIds.length;
8985
+ // collapse all groups in the beginning
8986
+ const trimmed = {};
8987
+ // index mapping
8988
+ const oldNewIndexMap = {};
8989
+ // check if group header exists
8990
+ const pseudoGroupTest = {};
8991
+ const sourceWithGroups = [];
8992
+ function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
8993
+ const depth = parentIds.length;
8994
+ groupedValues.forEach((innerGroupedValues, groupId) => {
8995
+ const levelIds = [...parentIds, groupId];
8996
+ const mergedIds = levelIds.join(',');
8997
+ const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
8998
+ sourceWithGroups.push({
8999
+ [PSEUDO_GROUP_ITEM]: groupId,
9000
+ [GROUP_DEPTH]: depth,
9001
+ [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
9002
+ [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
9003
+ [GROUP_EXPANDED]: isGroupExpanded,
9004
+ });
9005
+ itemIndex += 1;
9006
+ if (!isGroupExpanded && depth) {
9007
+ trimmed[itemIndex] = true;
9008
+ }
9009
+ if (Array.isArray(innerGroupedValues)) {
9010
+ innerGroupedValues.forEach(value => {
9011
+ itemIndex += 1;
9012
+ if (!isGroupExpanded) {
9013
+ trimmed[itemIndex] = true;
9014
+ }
9015
+ oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
9016
+ const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
9017
+ pseudoGroupTestIds.forEach(pseudoGroupTestId => {
9018
+ if (!pseudoGroupTest[pseudoGroupTestId]) {
9019
+ pseudoGroupTest[pseudoGroupTestId] = [];
9020
+ }
9021
+ pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
9022
+ });
9023
+ });
9024
+ sourceWithGroups.push(...innerGroupedValues);
9025
+ }
9026
+ else {
9027
+ flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
9028
+ }
9029
+ });
9030
+ }
9031
+ flattenGroupMaps(groupedItems, [], true);
9387
9032
  return {
9388
- left,
9389
- right,
9390
- top,
9391
- bottom,
9392
- width: right - left,
9393
- height: bottom - top,
9394
- };
9395
- }
9396
- function getElStyle(range, dimensionRow, dimensionCol) {
9397
- const styles = getCell(range, dimensionRow, dimensionCol);
9398
- return styleByCellProps(styles);
9399
- }
9400
-
9401
- // is edit input
9402
- function isEditInput(el) {
9403
- return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
9033
+ sourceWithGroups, // updates source mirror
9034
+ depth: groupingDepth, // largest depth for grouping
9035
+ trimmed, // used for expand/collapse grouping values
9036
+ oldNewIndexMap, // used for mapping old values to new
9037
+ childrenByGroup: pseudoGroupTest, // used to get child items in group
9038
+ };
9404
9039
  }
9405
- // Type guard for EditorCtrConstructible
9406
- function isEditorCtrConstructible(editor) {
9407
- return typeof editor === 'function' && typeof editor.prototype === 'object';
9040
+ function getGroupingName(rgRow) {
9041
+ return rgRow && rgRow[PSEUDO_GROUP_ITEM];
9408
9042
  }
9409
-
9410
- var osPlatform;
9411
- (function (osPlatform) {
9412
- osPlatform["mac"] = "Mac";
9413
- })(osPlatform || (osPlatform = {}));
9414
-
9415
- function isClear(code) {
9416
- return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;
9043
+ function isGrouping(rgRow) {
9044
+ return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
9417
9045
  }
9418
- function isTab(code) {
9419
- return codesLetter.TAB === code;
9046
+ function isGroupingColumn(column) {
9047
+ return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
9420
9048
  }
9421
- function isEnterKeyValue(key) {
9422
- return keyValues.ENTER === key;
9049
+ function measureEqualDepth(groupA, groupB) {
9050
+ const ln = groupA.length;
9051
+ let i = 0;
9052
+ for (; i < ln; i++) {
9053
+ if (groupA[i] !== groupB[i]) {
9054
+ return i;
9055
+ }
9056
+ }
9057
+ return i;
9423
9058
  }
9424
- function isCut(event) {
9425
- return ((event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows
9426
- (event.metaKey && event.code === 'KeyX')); // Cmd + X on Mac
9059
+ function getParsedGroup(id) {
9060
+ const parseGroup = JSON.parse(id);
9061
+ // extra precaution and type safeguard
9062
+ if (!Array.isArray(parseGroup)) {
9063
+ return null;
9064
+ }
9065
+ return parseGroup;
9427
9066
  }
9428
- function isCopy(event) {
9429
- return ((event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows
9430
- (event.metaKey && event.code === 'KeyC')); // Cmd + C on Mac
9067
+ // check if items is child of current clicked group
9068
+ function isSameGroup(currentGroup, currentModel, nextModel) {
9069
+ const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
9070
+ if (!nextGroup) {
9071
+ return false;
9072
+ }
9073
+ const depth = measureEqualDepth(currentGroup, nextGroup);
9074
+ return currentModel[GROUP_DEPTH] < depth;
9431
9075
  }
9432
- function isPaste(event) {
9433
- return ((event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows
9434
- (event.metaKey && event.code === 'KeyV')); // Cmd + V on Mac
9076
+
9077
+ /**
9078
+ * The base implementation of `_.slice` without an iteratee call guard.
9079
+ *
9080
+ * @private
9081
+ * @param {Array} array The array to slice.
9082
+ * @param {number} [start=0] The start position.
9083
+ * @param {number} [end=array.length] The end position.
9084
+ * @returns {Array} Returns the slice of `array`.
9085
+ */
9086
+
9087
+ function baseSlice$1(array, start, end) {
9088
+ var index = -1,
9089
+ length = array.length;
9090
+
9091
+ if (start < 0) {
9092
+ start = -start > length ? 0 : (length + start);
9093
+ }
9094
+ end = end > length ? length : end;
9095
+ if (end < 0) {
9096
+ end += length;
9097
+ }
9098
+ length = start > end ? 0 : ((end - start) >>> 0);
9099
+ start >>>= 0;
9100
+
9101
+ var result = Array(length);
9102
+ while (++index < length) {
9103
+ result[index] = array[index + start];
9104
+ }
9105
+ return result;
9435
9106
  }
9436
- function isAll(event) {
9437
- return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
9438
- (event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
9107
+
9108
+ var _baseSlice = baseSlice$1;
9109
+
9110
+ var baseSlice = _baseSlice,
9111
+ isIterateeCall$1 = _isIterateeCall,
9112
+ toInteger$2 = toInteger_1;
9113
+
9114
+ /**
9115
+ * Creates a slice of `array` from `start` up to, but not including, `end`.
9116
+ *
9117
+ * **Note:** This method is used instead of
9118
+ * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
9119
+ * returned.
9120
+ *
9121
+ * @static
9122
+ * @memberOf _
9123
+ * @since 3.0.0
9124
+ * @category Array
9125
+ * @param {Array} array The array to slice.
9126
+ * @param {number} [start=0] The start position.
9127
+ * @param {number} [end=array.length] The end position.
9128
+ * @returns {Array} Returns the slice of `array`.
9129
+ */
9130
+ function slice(array, start, end) {
9131
+ var length = array == null ? 0 : array.length;
9132
+ if (!length) {
9133
+ return [];
9134
+ }
9135
+ if (end && typeof end != 'number' && isIterateeCall$1(array, start, end)) {
9136
+ start = 0;
9137
+ end = length;
9138
+ }
9139
+ else {
9140
+ start = start == null ? 0 : toInteger$2(start);
9141
+ end = end === undefined ? length : toInteger$2(end);
9142
+ }
9143
+ return baseSlice(array, start, end);
9439
9144
  }
9440
9145
 
9441
- function getColumnType(rgCol) {
9442
- if (rgCol.pin) {
9443
- return rgCol.pin;
9146
+ var slice_1 = slice;
9147
+
9148
+ class ColumnService {
9149
+ get columns() {
9150
+ return getVisibleSourceItem(this.source);
9151
+ }
9152
+ constructor(dataStore, source) {
9153
+ this.dataStore = dataStore;
9154
+ this.source = source;
9155
+ this.unsubscribe = [];
9156
+ this.hasGrouping = false;
9157
+ this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
9158
+ this.checkGrouping(source.get('source'));
9159
+ this.type = source.get('type');
9160
+ }
9161
+ checkGrouping(cols) {
9162
+ for (let rgCol of cols) {
9163
+ if (isGroupingColumn(rgCol)) {
9164
+ this.hasGrouping = true;
9165
+ return;
9166
+ }
9167
+ this.hasGrouping = false;
9168
+ }
9169
+ }
9170
+ isReadOnly(r, c) {
9171
+ var _a;
9172
+ const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
9173
+ if (typeof readOnly === 'function') {
9174
+ const data = this.rowDataModel(r, c);
9175
+ return readOnly(data);
9176
+ }
9177
+ return !!readOnly;
9178
+ }
9179
+ mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
9180
+ const props = Object.assign({}, defaultProps);
9181
+ props.class = Object.assign(Object.assign({}, (typeof props.class === 'string' ? { [props.class]: true } : props.class)), { [CELL_CLASS]: true, [DISABLED_CLASS]: this.isReadOnly(r, c) });
9182
+ const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
9183
+ if (!extra) {
9184
+ return props;
9185
+ }
9186
+ return doPropMerge(props, extra);
9187
+ }
9188
+ getRowClass(r, prop) {
9189
+ const model = getSourceItem(this.dataStore, r) || {};
9190
+ return model[prop] || '';
9191
+ }
9192
+ getCellData(r, c) {
9193
+ const data = this.rowDataModel(r, c);
9194
+ return getCellData(data.model[data.prop]);
9195
+ }
9196
+ getSaveData(rowIndex, colIndex, val) {
9197
+ const data = this.rowDataModel(rowIndex, colIndex);
9198
+ if (typeof val === 'undefined') {
9199
+ val = getCellData(data.model[data.prop]);
9200
+ }
9201
+ return {
9202
+ prop: data.prop,
9203
+ rowIndex,
9204
+ colIndex,
9205
+ val,
9206
+ model: data.model,
9207
+ colType: this.type,
9208
+ type: this.dataStore.get('type'),
9209
+ };
9210
+ }
9211
+ getCellEditor(_r, c, editors) {
9212
+ var _a;
9213
+ const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
9214
+ if (!editor) {
9215
+ return undefined;
9216
+ }
9217
+ // reference
9218
+ if (typeof editor === 'string') {
9219
+ return editors[editor];
9220
+ }
9221
+ return editor;
9222
+ }
9223
+ /**
9224
+ * Get cell data model for given rowIndex and colIndex
9225
+ * Used to pass data to editor/renderer
9226
+ */
9227
+ rowDataModel(rowIndex, colIndex) {
9228
+ const column = this.columns[colIndex];
9229
+ const prop = column === null || column === void 0 ? void 0 : column.prop;
9230
+ const model = getSourceItem(this.dataStore, rowIndex) || {};
9231
+ const value = model[prop];
9232
+ const type = this.dataStore.get('type');
9233
+ return {
9234
+ prop,
9235
+ model,
9236
+ data: this.dataStore.get('source'),
9237
+ column,
9238
+ rowIndex,
9239
+ colIndex,
9240
+ colType: this.type,
9241
+ type,
9242
+ value,
9243
+ };
9244
+ }
9245
+ getRangeData(d, columns) {
9246
+ var _a;
9247
+ const changed = {};
9248
+ // get original length sizes
9249
+ const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
9250
+ const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
9251
+ const mapping = {};
9252
+ // rows
9253
+ for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
9254
+ // copy original data link
9255
+ const oldRowIndex = d.oldRange.y + (i % copyRowLength);
9256
+ const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
9257
+ // columns
9258
+ for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
9259
+ // check if old range area
9260
+ if (rowIndex >= d.oldRange.y &&
9261
+ rowIndex <= d.oldRange.y1 &&
9262
+ colIndex >= d.oldRange.x &&
9263
+ colIndex <= d.oldRange.x1) {
9264
+ continue;
9265
+ }
9266
+ // requested column beyond range
9267
+ if (!this.columns[colIndex]) {
9268
+ continue;
9269
+ }
9270
+ const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
9271
+ const copyColIndex = d.oldRange.x + (j % copyColLength);
9272
+ const copyColumnProp = columns[copyColIndex].prop;
9273
+ /** if can write */
9274
+ if (!this.isReadOnly(rowIndex, colIndex)) {
9275
+ /** to show before save */
9276
+ if (!changed[rowIndex]) {
9277
+ changed[rowIndex] = {};
9278
+ }
9279
+ changed[rowIndex][prop] = copyRow[copyColumnProp];
9280
+ /** Generate mapping object */
9281
+ if (!mapping[rowIndex]) {
9282
+ mapping[rowIndex] = {};
9283
+ }
9284
+ mapping[rowIndex][prop] = {
9285
+ colIndex: copyColIndex,
9286
+ colProp: copyColumnProp,
9287
+ rowIndex: oldRowIndex,
9288
+ };
9289
+ }
9290
+ }
9291
+ }
9292
+ return {
9293
+ changed,
9294
+ mapping,
9295
+ };
9444
9296
  }
9445
- return 'rgCol';
9446
- }
9447
- function getColumnSizes(cols) {
9448
- const res = {};
9449
- for (const [i, c] of cols.entries()) {
9450
- if (c.size) {
9451
- res[i] = c.size;
9297
+ getTransformedDataToApply(start, data) {
9298
+ const changed = {};
9299
+ const copyRowLength = data.length;
9300
+ const colLength = this.columns.length;
9301
+ const rowLength = this.dataStore.get('items').length;
9302
+ // rows
9303
+ let rowIndex = start.y;
9304
+ let maxCol = 0;
9305
+ for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
9306
+ // copy original data link
9307
+ const copyRow = data[i % copyRowLength];
9308
+ const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
9309
+ // columns
9310
+ let colIndex = start.x;
9311
+ for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
9312
+ const p = this.columns[colIndex].prop;
9313
+ const currentCol = j % colLength;
9314
+ /** if can write */
9315
+ if (!this.isReadOnly(rowIndex, colIndex)) {
9316
+ /** to show before save */
9317
+ if (!changed[rowIndex]) {
9318
+ changed[rowIndex] = {};
9319
+ }
9320
+ changed[rowIndex][p] = copyRow[currentCol];
9321
+ }
9322
+ }
9323
+ maxCol = Math.max(maxCol, colIndex - 1);
9452
9324
  }
9325
+ const range = getRange(start, {
9326
+ y: rowIndex - 1,
9327
+ x: maxCol,
9328
+ });
9329
+ return {
9330
+ changed,
9331
+ range,
9332
+ };
9333
+ }
9334
+ getRangeStaticData(d, value) {
9335
+ const changed = {};
9336
+ // rows
9337
+ for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
9338
+ // columns
9339
+ for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
9340
+ // requested column beyond range
9341
+ if (!this.columns[colIndex]) {
9342
+ continue;
9343
+ }
9344
+ const p = this.columns[colIndex].prop;
9345
+ /** if can write */
9346
+ if (!this.isReadOnly(rowIndex, colIndex)) {
9347
+ /** to show before save */
9348
+ if (!changed[rowIndex]) {
9349
+ changed[rowIndex] = {};
9350
+ }
9351
+ changed[rowIndex][p] = value;
9352
+ }
9353
+ }
9354
+ }
9355
+ return changed;
9356
+ }
9357
+ getRangeTransformedToProps(d, store) {
9358
+ var _a;
9359
+ const area = [];
9360
+ const type = this.dataStore.get('type');
9361
+ // rows
9362
+ for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
9363
+ // columns
9364
+ for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
9365
+ const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
9366
+ area.push({
9367
+ prop,
9368
+ rowIndex,
9369
+ colIndex,
9370
+ model: getSourceItem(store, rowIndex),
9371
+ type,
9372
+ colType: this.type,
9373
+ });
9374
+ }
9375
+ }
9376
+ return area;
9377
+ }
9378
+ copyRangeArray(range, store) {
9379
+ const cols = [...this.columns];
9380
+ const props = slice_1(cols, range.x, range.x1 + 1).map(v => v.prop);
9381
+ const toCopy = [];
9382
+ const mapping = {};
9383
+ // rows indexes
9384
+ for (let i = range.y; i <= range.y1; i++) {
9385
+ const rgRow = [];
9386
+ mapping[i] = {};
9387
+ // columns indexes
9388
+ for (let prop of props) {
9389
+ const item = getSourceItem(store, i);
9390
+ // if no item - skip
9391
+ if (!item) {
9392
+ continue;
9393
+ }
9394
+ const val = item[prop];
9395
+ rgRow.push(val);
9396
+ mapping[i][prop] = val;
9397
+ }
9398
+ toCopy.push(rgRow);
9399
+ }
9400
+ return {
9401
+ data: toCopy,
9402
+ mapping,
9403
+ };
9404
+ }
9405
+ destroy() {
9406
+ this.unsubscribe.forEach(f => f());
9453
9407
  }
9454
- return res;
9455
9408
  }
9456
9409
  /**
9457
- * Check if column is grouping column
9410
+ * Checks if the given rowDrag is a service for dragging rows.
9458
9411
  */
9459
- function isColGrouping(colData) {
9460
- return !!colData.children;
9412
+ function isRowDragService(rowDrag, model) {
9413
+ if (typeof rowDrag === 'function') {
9414
+ return rowDrag(model);
9415
+ }
9416
+ return !!rowDrag;
9461
9417
  }
9462
- /**
9463
- * This function is used to create a collection of columns.
9464
- */
9465
- function getColumns(columns, level = 0, types) {
9466
- const collection = {
9467
- // columns as they are in stores per type
9468
- columns: {
9469
- rgCol: [],
9470
- colPinStart: [],
9471
- colPinEnd: [],
9472
- },
9473
- // columns indexed by prop for quick access
9474
- columnByProp: {},
9475
- // column grouping
9476
- columnGrouping: {
9477
- rgCol: [],
9478
- colPinStart: [],
9479
- colPinEnd: [],
9480
- },
9481
- // max depth level for column grouping
9482
- maxLevel: level,
9483
- // sorting
9484
- sort: {},
9485
- };
9486
- return reduce_1(columns, (res, colData) => {
9487
- // Grouped column
9488
- if (isColGrouping(colData)) {
9489
- return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
9490
- }
9491
- // Regular column
9492
- const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
9493
- // Regular column, no Pin
9494
- if (!regularColumn.pin) {
9495
- res.columns.rgCol.push(regularColumn);
9496
- // Pin
9497
- }
9498
- else {
9499
- res.columns[regularColumn.pin].push(regularColumn);
9418
+ function doPropMerge(existing, extra) {
9419
+ let props = Object.assign(Object.assign({}, extra), existing);
9420
+ // extend existing props
9421
+ if (extra.class) {
9422
+ if (typeof extra.class === 'object' && typeof props.class === 'object') {
9423
+ props.class = Object.assign(Object.assign({}, extra.class), props.class);
9500
9424
  }
9501
- if (regularColumn.order) {
9502
- res.sort[regularColumn.prop] = regularColumn;
9425
+ else if (typeof extra.class === 'string' &&
9426
+ typeof props.class === 'object') {
9427
+ props.class[extra.class] = true;
9503
9428
  }
9504
- // it's possible that some columns have same prop, but better to avoid it
9505
- if (!res.columnByProp[regularColumn.prop]) {
9506
- res.columnByProp[regularColumn.prop] = [];
9429
+ else if (typeof props.class === 'string') {
9430
+ props.class += ' ' + extra.class;
9507
9431
  }
9508
- res.columnByProp[regularColumn.prop].push(regularColumn);
9509
- // trigger setup hook if present
9510
- regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
9511
- return res;
9512
- }, collection);
9432
+ }
9433
+ if (extra.style) {
9434
+ props.style = Object.assign(Object.assign({}, extra.style), props.style);
9435
+ }
9436
+ return props;
9513
9437
  }
9514
- function gatherGroup(res, colData, collection, level = 0) {
9515
- // group template
9516
- const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
9517
- // check columns for update
9518
- for (let k in collection.columns) {
9519
- const key = k;
9520
- const resultItem = res.columns[key];
9521
- const collectionItem = collection.columns[key];
9522
- // if column data
9523
- if (isArray_1(resultItem) && isArray_1(collectionItem)) {
9524
- // fill columns
9525
- resultItem.push(...collectionItem);
9526
- // fill grouping
9527
- if (collectionItem.length) {
9528
- res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
9529
- }
9438
+
9439
+ function isTouch(e) {
9440
+ return !!e.touches;
9441
+ }
9442
+ function verifyTouchTarget(touchEvent, focusClass) {
9443
+ if (focusClass && touchEvent) {
9444
+ if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
9445
+ return false;
9530
9446
  }
9531
9447
  }
9532
- // merge column groupings
9533
- for (let k in collection.columnGrouping) {
9534
- const key = k;
9535
- const collectionItem = collection.columnGrouping[key];
9536
- res.columnGrouping[key].push(...collectionItem);
9537
- }
9538
- res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
9539
- res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
9540
- return res;
9448
+ return true;
9541
9449
  }
9542
- function findColumn(columns, prop) {
9543
- for (const c of columns) {
9544
- if (isColGrouping(c)) {
9545
- const found = findColumn(c.children, prop);
9546
- if (found) {
9547
- return found;
9450
+ /**
9451
+ * Function to get the value of a specific property from a MouseEvent or TouchEvent object.
9452
+ */
9453
+ function getPropertyFromEvent(e, prop, focusClass // for touch events
9454
+ ) {
9455
+ // Check if the event is a touch event
9456
+ if (isTouch(e)) {
9457
+ // If the event has touches, get the first touch
9458
+ if (e.touches.length > 0) {
9459
+ const touchEvent = e.touches[0];
9460
+ // Check if the target of the touch event is the specified element
9461
+ if (!verifyTouchTarget(touchEvent, focusClass)) {
9462
+ // If not, return null
9463
+ return null;
9548
9464
  }
9465
+ // Get the value of the specified property from the touch event and return it
9466
+ return touchEvent[prop] || 0;
9549
9467
  }
9550
- else if (c.prop === prop) {
9551
- return c;
9552
- }
9468
+ // If there are no touches, return null
9469
+ return null;
9553
9470
  }
9554
- return undefined;
9555
- }
9556
- function getColumnByProp(columns, prop) {
9557
- return findColumn(columns, prop);
9471
+ // If the event is not a touch event, get the value of the specified property from the event and return it
9472
+ return e[prop] || 0;
9558
9473
  }
9559
9474
 
9560
- const LETTER_BLOCK_SIZE$1 = 10;
9561
- const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
9562
- return ((rowHeaderColumn === null || rowHeaderColumn === void 0 ? void 0 : rowHeaderColumn.size) ||
9563
- Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE$1, minWidth));
9564
- };
9565
-
9475
+ function collectModelsOfRange(data, store) {
9476
+ const models = {};
9477
+ for (let i in data) {
9478
+ const rowIndex = parseInt(i, 10);
9479
+ models[rowIndex] = getSourceItem(store, rowIndex);
9480
+ }
9481
+ return models;
9482
+ }
9483
+ function getFocusCellBasedOnEvent(e, data) {
9484
+ // If event default is prevented, return
9485
+ if (e.defaultPrevented) {
9486
+ return null;
9487
+ }
9488
+ // Get coordinates from event object
9489
+ const x = getPropertyFromEvent(e, 'clientX');
9490
+ const y = getPropertyFromEvent(e, 'clientY');
9491
+ // If coordinates are not available, return
9492
+ if (x === null || y === null) {
9493
+ return null;
9494
+ }
9495
+ // Get current cell based on coordinates and data
9496
+ const focusCell = getCurrentCell({ x, y }, data);
9497
+ // If current cell is not available, return
9498
+ if (isAfterLast(focusCell, data.lastCell)) {
9499
+ return null;
9500
+ }
9501
+ return focusCell;
9502
+ }
9566
9503
  /**
9567
- * Calculate system scrollbar size
9504
+ * Calculate cell based on x, y position
9568
9505
  */
9569
- function getScrollbarSize(document) {
9570
- // Create a temporary div container and append it to the body
9571
- const container = document.createElement('div');
9572
- // Apply styling to ensure the div is scrollable
9573
- container.style.overflow = 'scroll';
9574
- container.style.visibility = 'hidden'; // make sure the container isn't visible
9575
- container.style.position = 'absolute';
9576
- container.style.top = '-9999px'; // move it out of the screen
9577
- container.style.width = '50px'; // arbitrary width
9578
- container.style.height = '50px'; // arbitrary height
9579
- // Append the div to the body
9580
- document.body.appendChild(container);
9581
- // Calculate the width of the scrollbar
9582
- const scrollbarWidth = container.offsetWidth - container.clientWidth;
9583
- // Remove the div from the body after calculation
9584
- document.body.removeChild(container);
9585
- // Return the calculated width of the scrollbar
9586
- return scrollbarWidth;
9506
+ function getCurrentCell({ x, y }, { el, rows, cols }) {
9507
+ // Get the bounding rectangle of the element
9508
+ const { top, left, height, width } = el.getBoundingClientRect();
9509
+ // Calculate the cell position relative to the element
9510
+ let cellY = y - top;
9511
+ let cellX = x - left;
9512
+ // Limit the cell position to the element height
9513
+ if (cellY >= height) {
9514
+ cellY = height - 1;
9515
+ }
9516
+ // Limit the cell position to the element width
9517
+ if (cellX >= width) {
9518
+ cellX = width - 1;
9519
+ }
9520
+ // Get the row and column items based on the cell position
9521
+ const rgRow = getItemByPosition(rows, cellY);
9522
+ const rgCol = getItemByPosition(cols, cellX);
9523
+ // Set the row and column index to 0 if they are before the first item
9524
+ if (rgCol.itemIndex < 0) {
9525
+ rgCol.itemIndex = 0;
9526
+ }
9527
+ if (rgRow.itemIndex < 0) {
9528
+ rgRow.itemIndex = 0;
9529
+ }
9530
+ return { x: rgCol.itemIndex, y: rgRow.itemIndex };
9587
9531
  }
9588
- /* Scale a value between 2 ranges
9589
- *
9590
- * Sample:
9591
- * // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
9592
- * const n = scaleValue(55, [0,100], [0,1000]);
9593
- *
9594
- * Ranges of two values
9595
- * @from
9596
- * @to
9597
- *
9598
- * ~~ return value does the equivalent of Math.floor but faster.
9599
- */
9600
- function scaleValue(value, from, to) {
9601
- return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
9532
+ function getCoordinate(range, focus, changes, isMulti = false) {
9533
+ const updateCoordinate = (c, pos = 0) => {
9534
+ const start = { x: range.x, y: range.y };
9535
+ const end = isMulti ? { x: range.x1, y: range.y1 } : start;
9536
+ const point = end[c] > focus[c] ? end : start;
9537
+ point[c] += pos;
9538
+ return { start, end };
9539
+ };
9540
+ if (changes.x) {
9541
+ return updateCoordinate('x', changes['x']);
9542
+ }
9543
+ if (changes.y) {
9544
+ return updateCoordinate('y', changes['y']);
9545
+ }
9546
+ return null;
9602
9547
  }
9603
9548
  /**
9604
- * Async timeout
9549
+ * Check if the x coordinate of the cell position is after or equal to the x coordinate of the last cell position
9550
+ * or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
9605
9551
  */
9606
- async function timeout(delay = 0) {
9607
- await new Promise((r) => {
9608
- setTimeout(() => r(), delay);
9609
- });
9552
+ function isAfterLast({ x, y }, lastCell) {
9553
+ return x >= lastCell.x || y >= lastCell.y;
9554
+ }
9555
+ /** check if out of range */
9556
+ function isBeforeFirst({ x, y }) {
9557
+ return x < 0 || y < 0;
9558
+ }
9559
+ /** Compare cells, only 1 coordinate difference is possible */
9560
+ // export function getDirectionCoordinate(initial: Cell, last: Cell): Partial<Cell> | null {
9561
+ // const c: (keyof Cell)[] = ['x', 'y'];
9562
+ // for (let k of c) {
9563
+ // if (initial[k] !== last[k]) {
9564
+ // return { [k]: 1 };
9565
+ // }
9566
+ // }
9567
+ // return null;
9568
+ // }
9569
+ // export function getLargestAxis(initial: Cell, last: Cell): Partial<Cell> | null {
9570
+ // const cell: Partial<Cell> = {};
9571
+ // const c: (keyof Cell)[] = ['x', 'y'];
9572
+ // for (let k of c) {
9573
+ // cell[k] = Math.abs(initial[k] - last[k]);
9574
+ // }
9575
+ // if (cell.x > cell.y) {
9576
+ // return { x: 1 };
9577
+ // }
9578
+ // if (cell.y > cell.x) {
9579
+ // return { y: 1 };
9580
+ // }
9581
+ // return null;
9582
+ // }
9583
+ function styleByCellProps(styles) {
9584
+ return {
9585
+ left: `${styles.left}px`,
9586
+ top: `${styles.top}px`,
9587
+ width: `${styles.width}px`,
9588
+ height: `${styles.height}px`,
9589
+ };
9590
+ }
9591
+ function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
9592
+ const top = getItemByIndex(dimensionRow, y).start;
9593
+ const left = getItemByIndex(dimensionCol, x).start;
9594
+ const bottom = getItemByIndex(dimensionRow, y1).end;
9595
+ const right = getItemByIndex(dimensionCol, x1).end;
9596
+ return {
9597
+ left,
9598
+ right,
9599
+ top,
9600
+ bottom,
9601
+ width: right - left,
9602
+ height: bottom - top,
9603
+ };
9604
+ }
9605
+ function getElStyle(range, dimensionRow, dimensionCol) {
9606
+ const styles = getCell(range, dimensionRow, dimensionCol);
9607
+ return styleByCellProps(styles);
9608
+ }
9609
+
9610
+ // is edit input
9611
+ function isEditInput(el) {
9612
+ return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
9613
+ }
9614
+ // Type guard for EditorCtrConstructible
9615
+ function isEditorCtrConstructible(editor) {
9616
+ return typeof editor === 'function' && typeof editor.prototype === 'object';
9610
9617
  }
9611
9618
 
9612
9619
  const DIRECTION_CODES = [
@@ -11191,7 +11198,7 @@ class ThemeService {
11191
11198
  this.register('default');
11192
11199
  }
11193
11200
  register(theme) {
11194
- const parsedTheme = ThemeService.getTheme(theme);
11201
+ const parsedTheme = getTheme(theme);
11195
11202
  switch (parsedTheme) {
11196
11203
  case 'material':
11197
11204
  case 'darkMaterial':
@@ -11206,12 +11213,12 @@ class ThemeService {
11206
11213
  break;
11207
11214
  }
11208
11215
  }
11209
- static getTheme(theme) {
11210
- if (theme && allowedThemes.indexOf(theme) > -1) {
11211
- return theme;
11212
- }
11213
- return DEFAULT_THEME;
11216
+ }
11217
+ function getTheme(theme) {
11218
+ if (theme && allowedThemes.indexOf(theme) > -1) {
11219
+ return theme;
11214
11220
  }
11221
+ return DEFAULT_THEME;
11215
11222
  }
11216
11223
 
11217
11224
  /**
@@ -11618,23 +11625,7 @@ const notContains = (value, extra) => {
11618
11625
  notContains.extra = 'input';
11619
11626
  contains.extra = 'input';
11620
11627
 
11621
- const filterNames = {
11622
- none: 'None',
11623
- empty: 'Not set',
11624
- notEmpty: 'Set',
11625
- eq: 'Equal',
11626
- notEq: 'Not equal',
11627
- begins: 'Begins with',
11628
- contains: 'Contains',
11629
- notContains: 'Does not contain',
11630
- eqN: '=',
11631
- neqN: '!=',
11632
- gt: '>',
11633
- gte: '>=',
11634
- lt: '<',
11635
- lte: '<=',
11636
- };
11637
- const filterEntities = {
11628
+ const filterCoreFunctionsIndexedByType = {
11638
11629
  none: () => true,
11639
11630
  empty: notSet,
11640
11631
  notEmpty: set,
@@ -11654,7 +11645,37 @@ const filterTypes = {
11654
11645
  string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
11655
11646
  number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
11656
11647
  };
11648
+ const filterNames = {
11649
+ none: 'None',
11650
+ empty: 'Not set',
11651
+ notEmpty: 'Set',
11652
+ eq: 'Equal',
11653
+ notEq: 'Not equal',
11654
+ begins: 'Begins with',
11655
+ contains: 'Contains',
11656
+ notContains: 'Does not contain',
11657
+ eqN: '=',
11658
+ neqN: '!=',
11659
+ gt: '>',
11660
+ gte: '>=',
11661
+ lt: '<',
11662
+ lte: '<=',
11663
+ };
11657
11664
 
11665
+ /**
11666
+ * @typedef ColumnFilterConfig
11667
+ * @type {object}
11668
+ * @property {FilterCollection|undefined} collection - preserved filter data
11669
+ * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
11670
+ * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
11671
+ * @property {FilterLocalization|undefined} localization - translation for filter popup captions.
11672
+ * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
11673
+ * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.
11674
+ * A way to define your own filter types per column
11675
+ */
11676
+ /**
11677
+ * @internal
11678
+ */
11658
11679
  const FILTER_TRIMMED_TYPE = 'filter';
11659
11680
  const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
11660
11681
  class FilterPlugin extends BasePlugin {
@@ -11664,14 +11685,13 @@ class FilterPlugin extends BasePlugin {
11664
11685
  this.revogrid = revogrid;
11665
11686
  this.filterCollection = {};
11666
11687
  this.multiFilterItems = {};
11667
- this.possibleFilters = Object.assign({}, filterTypes);
11668
- this.possibleFilterNames = Object.assign({}, filterNames);
11669
- this.possibleFilterEntities = Object.assign({}, filterEntities);
11688
+ this.filterByType = Object.assign({}, filterTypes);
11689
+ this.filterNameIndexByType = Object.assign({}, filterNames);
11690
+ this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
11670
11691
  this.filterProp = FILTER_PROP;
11671
11692
  if (config) {
11672
11693
  this.initConfig(config);
11673
11694
  }
11674
- const headerclick = (e) => this.headerclick(e);
11675
11695
  const aftersourceset = async () => {
11676
11696
  const filterCollectionProps = Object.keys(this.filterCollection);
11677
11697
  if (filterCollectionProps.length > 0) {
@@ -11691,7 +11711,7 @@ class FilterPlugin extends BasePlugin {
11691
11711
  }
11692
11712
  await this.runFiltering();
11693
11713
  };
11694
- this.addEventListener('headerclick', headerclick);
11714
+ this.addEventListener('headerclick', (e) => this.headerclick(e));
11695
11715
  this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
11696
11716
  if (!detail) {
11697
11717
  this.clearFiltering();
@@ -11704,27 +11724,29 @@ class FilterPlugin extends BasePlugin {
11704
11724
  });
11705
11725
  this.addEventListener('aftersourceset', aftersourceset);
11706
11726
  this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
11707
- const existingNodes = this.revogrid.registerVNode.filter((n) => n.$tag$ !== 'revogr-filter-panel');
11727
+ const existingNodes = this.revogrid.registerVNode.filter(n => n.$tag$ !== 'revogr-filter-panel');
11708
11728
  this.revogrid.registerVNode = [
11709
11729
  ...existingNodes,
11710
- hAsync("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) }),
11730
+ hAsync("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) }),
11711
11731
  ];
11712
11732
  }
11713
11733
  initConfig(config) {
11714
11734
  if (config.multiFilterItems) {
11715
11735
  this.multiFilterItems = Object.assign({}, config.multiFilterItems);
11716
11736
  }
11737
+ // Add custom filters
11717
11738
  if (config.customFilters) {
11718
- for (let cType in config.customFilters) {
11719
- const cFilter = config.customFilters[cType];
11720
- if (!this.possibleFilters[cFilter.columnFilterType]) {
11721
- this.possibleFilters[cFilter.columnFilterType] = [];
11739
+ for (let customFilterType in config.customFilters) {
11740
+ const cFilter = config.customFilters[customFilterType];
11741
+ if (!this.filterByType[cFilter.columnFilterType]) {
11742
+ this.filterByType[cFilter.columnFilterType] = [];
11722
11743
  }
11723
- this.possibleFilters[cFilter.columnFilterType].push(cType);
11724
- this.possibleFilterEntities[cType] = cFilter.func;
11725
- this.possibleFilterNames[cType] = cFilter.name;
11744
+ this.filterByType[cFilter.columnFilterType].push(customFilterType);
11745
+ this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
11746
+ this.filterNameIndexByType[customFilterType] = cFilter.name;
11726
11747
  }
11727
11748
  }
11749
+ // Add filterProp if provided in config
11728
11750
  if (config.filterProp) {
11729
11751
  this.filterProp = config.filterProp;
11730
11752
  }
@@ -11735,21 +11757,21 @@ class FilterPlugin extends BasePlugin {
11735
11757
  const cfgInlcude = config.include;
11736
11758
  if (cfgInlcude) {
11737
11759
  const filters = {};
11738
- for (let t in this.possibleFilters) {
11760
+ for (let t in this.filterByType) {
11739
11761
  // validate filters, if appropriate function present
11740
- const newTypes = this.possibleFilters[t].filter(f => cfgInlcude.indexOf(f) > -1);
11762
+ const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
11741
11763
  if (newTypes.length) {
11742
11764
  filters[t] = newTypes;
11743
11765
  }
11744
11766
  }
11745
11767
  // if any valid filters provided show them
11746
11768
  if (Object.keys(filters).length > 0) {
11747
- this.possibleFilters = filters;
11769
+ this.filterByType = filters;
11748
11770
  }
11749
11771
  }
11750
11772
  if (config.collection) {
11751
11773
  this.filterCollection = reduce_1(config.collection, (result, item, prop) => {
11752
- if (this.possibleFilterEntities[item.type]) {
11774
+ if (this.filterFunctionsIndexedByType[item.type]) {
11753
11775
  result[prop] = item;
11754
11776
  }
11755
11777
  else {
@@ -11761,8 +11783,8 @@ class FilterPlugin extends BasePlugin {
11761
11783
  if (config.localization) {
11762
11784
  if (config.localization.filterNames) {
11763
11785
  Object.entries(config.localization.filterNames).forEach(([k, v]) => {
11764
- if (this.possibleFilterNames[k] != void 0) {
11765
- this.possibleFilterNames[k] = v;
11786
+ if (this.filterNameIndexByType[k] != void 0) {
11787
+ this.filterNameIndexByType[k] = v;
11766
11788
  }
11767
11789
  });
11768
11790
  }
@@ -11788,13 +11810,12 @@ class FilterPlugin extends BasePlugin {
11788
11810
  const gridPos = this.revogrid.getBoundingClientRect();
11789
11811
  const buttonPos = el.getBoundingClientRect();
11790
11812
  const prop = e.detail.prop;
11791
- this.pop.filterTypes = this.getColumnFilter(e.detail.filter);
11792
- 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 }));
11813
+ 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) }));
11793
11814
  }
11794
11815
  getColumnFilter(type) {
11795
11816
  let filterType = 'string';
11796
11817
  if (!type) {
11797
- return { [filterType]: this.possibleFilters[filterType] };
11818
+ return { [filterType]: this.filterByType[filterType] };
11798
11819
  }
11799
11820
  // if custom column filter
11800
11821
  if (this.isValidType(type)) {
@@ -11804,44 +11825,59 @@ class FilterPlugin extends BasePlugin {
11804
11825
  else if (typeof type === 'object' && type.length) {
11805
11826
  return type.reduce((r, multiType) => {
11806
11827
  if (this.isValidType(multiType)) {
11807
- r[multiType] = this.possibleFilters[multiType];
11828
+ r[multiType] = this.filterByType[multiType];
11808
11829
  }
11809
11830
  return r;
11810
11831
  }, {});
11811
11832
  }
11812
- return { [filterType]: this.possibleFilters[filterType] };
11833
+ return { [filterType]: this.filterByType[filterType] };
11813
11834
  }
11814
11835
  isValidType(type) {
11815
- return !!(typeof type === 'string' && this.possibleFilters[type]);
11836
+ return !!(typeof type === 'string' && this.filterByType[type]);
11816
11837
  }
11817
- // called on internal component change
11838
+ /**
11839
+ * Called on internal component change
11840
+ */
11818
11841
  async onFilterChange(filterItems) {
11842
+ // store the filter items
11819
11843
  this.multiFilterItems = filterItems;
11844
+ // run the filtering when the items change
11820
11845
  this.runFiltering();
11821
11846
  }
11822
11847
  /**
11823
11848
  * Triggers grid filtering
11824
11849
  */
11825
- async doFiltering(collection, items, columns, filterItems) {
11850
+ async doFiltering(collection, source, columns, filterItems) {
11826
11851
  const columnsToUpdate = [];
11852
+ /**
11853
+ * Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
11854
+ */
11855
+ const columnByProp = {};
11827
11856
  columns.forEach(rgCol => {
11828
11857
  const column = Object.assign({}, rgCol);
11829
11858
  const hasFilter = filterItems[column.prop];
11859
+ columnByProp[column.prop] = column;
11860
+ /**
11861
+ * If the column has a filter and it's not already marked as filtered, update the column.
11862
+ */
11830
11863
  if (column[this.filterProp] && !hasFilter) {
11831
11864
  delete column[this.filterProp];
11832
11865
  columnsToUpdate.push(column);
11833
11866
  }
11867
+ /**
11868
+ * If the column does not have a filter and it's marked as filtered, update the column.
11869
+ */
11834
11870
  if (!column[this.filterProp] && hasFilter) {
11835
11871
  columnsToUpdate.push(column);
11836
11872
  column[this.filterProp] = true;
11837
11873
  }
11838
11874
  });
11839
- const itemsToFilter = this.getRowFilter(items, filterItems);
11875
+ const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
11840
11876
  // check is filter event prevented
11841
11877
  const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
11842
11878
  collection,
11843
- itemsToFilter,
11844
- source: items,
11879
+ itemsToFilter: itemsToTrim,
11880
+ source,
11845
11881
  filterItems,
11846
11882
  });
11847
11883
  if (defaultPrevented) {
@@ -11853,7 +11889,7 @@ class FilterPlugin extends BasePlugin {
11853
11889
  return;
11854
11890
  }
11855
11891
  // applies the hasFilter to the columns to show filter icon
11856
- await this.revogrid.updateColumns(columnsToUpdate);
11892
+ this.providers.column.updateColumns(columnsToUpdate);
11857
11893
  this.emit('afterfilterapply');
11858
11894
  }
11859
11895
  async clearFiltering() {
@@ -11869,7 +11905,7 @@ class FilterPlugin extends BasePlugin {
11869
11905
  if (this.multiFilterItems[prop].length > 0) {
11870
11906
  const firstFilterItem = this.multiFilterItems[prop][0];
11871
11907
  collection[prop] = {
11872
- filter: filterEntities[firstFilterItem.type],
11908
+ filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
11873
11909
  type: firstFilterItem.type,
11874
11910
  value: firstFilterItem.value,
11875
11911
  };
@@ -11894,52 +11930,68 @@ class FilterPlugin extends BasePlugin {
11894
11930
  columns: await this.revogrid.getColumns(),
11895
11931
  };
11896
11932
  }
11897
- getRowFilter(rows, filterItems) {
11933
+ /**
11934
+ * Get trimmed rows based on filter
11935
+ */
11936
+ getRowFilter(rows, filterItems, columnByProp) {
11898
11937
  const propKeys = Object.keys(filterItems);
11899
11938
  const trimmed = {};
11900
11939
  let propFilterSatisfiedCount = 0;
11901
11940
  let lastFilterResults = [];
11902
11941
  // each rows
11903
11942
  rows.forEach((model, rowIndex) => {
11904
- // working on all props
11943
+ // check filter by column properties
11905
11944
  for (const prop of propKeys) {
11906
11945
  const propFilters = filterItems[prop];
11946
+ // reset the count of satisfied filters
11907
11947
  propFilterSatisfiedCount = 0;
11948
+ // reset the array of last filter results
11908
11949
  lastFilterResults = [];
11909
11950
  // testing each filter for a prop
11910
11951
  for (const [filterIndex, filterData] of propFilters.entries()) {
11911
11952
  // the filter LogicFunction based on the type
11912
- const filter = this.possibleFilterEntities[filterData.type];
11953
+ const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
11913
11954
  // THE MAGIC OF FILTERING IS HERE
11955
+ const column = columnByProp[prop];
11956
+ // If there is no column but user wants to filter by a property
11957
+ const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];
11958
+ // OR relation
11914
11959
  if (filterData.relation === 'or') {
11960
+ // reset the array of last filter results
11915
11961
  lastFilterResults = [];
11916
- if (filter(model[prop], filterData.value)) {
11962
+ // if the filter is satisfied, continue to the next filter
11963
+ if (filterFunc(value, filterData.value)) {
11917
11964
  continue;
11918
11965
  }
11966
+ // if the filter is not satisfied, count it
11919
11967
  propFilterSatisfiedCount++;
11968
+ // AND relation
11920
11969
  }
11921
11970
  else {
11922
11971
  // 'and' relation will need to know the next filter
11923
11972
  // so we save this current filter to include it in the next filter
11924
- lastFilterResults.push(!filter(model[prop], filterData.value));
11973
+ lastFilterResults.push(!filterFunc(value, filterData.value));
11925
11974
  // check first if we have a filter on the next index to pair it with this current filter
11926
11975
  const nextFilterData = propFilters[filterIndex + 1];
11927
11976
  // stop the sequence if there is no next filter or if the next filter is not an 'and' relation
11928
11977
  if (!nextFilterData || nextFilterData.relation !== 'and') {
11929
11978
  // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
11930
11979
  if (lastFilterResults.indexOf(true) === -1) {
11980
+ // reset the array of last filter results
11931
11981
  lastFilterResults = [];
11932
11982
  continue;
11933
11983
  }
11934
11984
  // we need to add all of the lastFilterResults since we need to satisfy all
11935
11985
  propFilterSatisfiedCount += lastFilterResults.length;
11986
+ // reset the array of last filter results
11936
11987
  lastFilterResults = [];
11937
11988
  }
11938
11989
  }
11939
11990
  } // end of propFilters forEach
11940
11991
  // add to the list of removed/trimmed rows of filter condition is satisfied
11941
- if (propFilterSatisfiedCount === propFilters.length)
11992
+ if (propFilterSatisfiedCount === propFilters.length) {
11942
11993
  trimmed[rowIndex] = true;
11994
+ }
11943
11995
  } // end of for-of propKeys
11944
11996
  });
11945
11997
  return trimmed;
@@ -13931,34 +13983,33 @@ const ResizableElement = (props, children) => {
13931
13983
  const resizeEls = [];
13932
13984
  const directive = (props.canResize &&
13933
13985
  new ResizeDirective(props, e => {
13986
+ var _a;
13934
13987
  if (e.eventName === ResizeEvents.end) {
13935
- props.onResize && props.onResize(e);
13988
+ (_a = props.onResize) === null || _a === void 0 ? void 0 : _a.call(props, e);
13936
13989
  }
13937
13990
  })) ||
13938
13991
  null;
13939
- if (props.canResize) {
13940
- if (props.active) {
13992
+ if (props.active) {
13993
+ if (props.canResize) {
13941
13994
  for (let p in props.active) {
13942
13995
  resizeEls.push(hAsync("div", { onClick: e => e.preventDefault(), onDblClick: e => {
13943
13996
  var _a;
13944
13997
  e.preventDefault();
13945
- (_a = props.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
13998
+ (_a = props.onDblClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
13946
13999
  }, onMouseDown: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), onTouchStart: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), class: `resizable resizable-${props.active[p]}` }));
13947
14000
  }
13948
14001
  }
13949
- }
13950
- else {
13951
- if (props.active) {
14002
+ else {
13952
14003
  for (let p in props.active) {
13953
14004
  resizeEls.push(hAsync("div", { onClick: e => e.preventDefault(), onTouchStart: (e) => e.preventDefault(), onDblClick: e => {
13954
14005
  var _a;
13955
14006
  e.preventDefault();
13956
- (_a = props.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
14007
+ (_a = props.onDblClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
13957
14008
  }, class: `no-resize resizable resizable-${props.active[p]}` }));
13958
14009
  }
13959
14010
  }
13960
14011
  }
13961
- return (hAsync("div", Object.assign({}, props, { ref: (e) => e && (directive === null || directive === void 0 ? void 0 : directive.set(e)) }),
14012
+ return (hAsync("div", Object.assign({}, props, { ref: e => e && (directive === null || directive === void 0 ? void 0 : directive.set(e)) }),
13962
14013
  children,
13963
14014
  resizeEls));
13964
14015
  };
@@ -13972,16 +14023,17 @@ const HeaderCellRenderer = ({ data, props, additionalData }, children) => {
13972
14023
  }
13973
14024
  if (data === null || data === void 0 ? void 0 : data.columnProperties) {
13974
14025
  const extra = data.columnProperties(data);
13975
- if (extra && typeof extra === 'object') {
14026
+ if (extra) {
13976
14027
  cellProps = doPropMerge(props, extra);
13977
14028
  }
13978
14029
  }
13979
- return (hAsync(ResizableElement, Object.assign({}, cellProps, { onMouseDown: (e) => {
14030
+ const resizeProps = Object.assign(Object.assign({}, cellProps), { onMouseDown(e) {
13980
14031
  dispatch(e.currentTarget, ON_COLUMN_CLICK, {
13981
14032
  data,
13982
14033
  event: e,
13983
14034
  });
13984
- } }),
14035
+ } });
14036
+ return (hAsync(ResizableElement, Object.assign({}, resizeProps),
13985
14037
  hAsync("div", { class: "header-content" }, colTemplate),
13986
14038
  children));
13987
14039
  };
@@ -14194,8 +14246,14 @@ class WCAGPlugin extends BasePlugin {
14194
14246
  return result;
14195
14247
  };
14196
14248
  column.cellProperties = (...args) => {
14249
+ const wcagProps = {
14250
+ ['role']: 'gridcell',
14251
+ ['aria-colindex']: index,
14252
+ ['aria-rowindex']: args[0].rowIndex,
14253
+ ['tabindex']: -1,
14254
+ };
14197
14255
  const columnProps = (cellProperties === null || cellProperties === void 0 ? void 0 : cellProperties(...args)) || {};
14198
- return Object.assign({ role: 'gridcell', ['aria-colindex']: index, ['aria-rowindex']: args[0].rowIndex, ['tabindex']: -1 }, columnProps);
14256
+ return Object.assign(Object.assign({}, wcagProps), columnProps);
14199
14257
  };
14200
14258
  });
14201
14259
  });
@@ -15881,9 +15939,9 @@ const HeaderRenderer = (p) => {
15881
15939
  transform: `translateX(${p.column.start}px)`,
15882
15940
  },
15883
15941
  onResize: p.onResize,
15884
- onDoubleClick(originalEvent) {
15942
+ onDblClick(originalEvent) {
15885
15943
  var _a;
15886
- (_a = p.onDoubleClick) === null || _a === void 0 ? void 0 : _a.call(p, {
15944
+ (_a = p.onDblClick) === null || _a === void 0 ? void 0 : _a.call(p, {
15887
15945
  column: p.data,
15888
15946
  index: p.column.itemIndex,
15889
15947
  originalEvent,
@@ -16011,12 +16069,12 @@ class RevogrHeaderComponent {
16011
16069
  // render header columns
16012
16070
  for (let rgCol of cols) {
16013
16071
  const colData = this.colData[rgCol.itemIndex];
16014
- cells.push(hAsync(HeaderRenderer, { range: range, column: rgCol, data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }), canFilter: !!this.columnFilter, canResize: this.canResize, active: this.resizeHandler, onResize: e => this.onResize(e, rgCol.itemIndex), onDoubleClick: e => this.headerdblClick.emit(e), onClick: e => this.initialHeaderClick.emit(e), additionalData: this.additionalData }));
16072
+ cells.push(hAsync(HeaderRenderer, { range: range, column: rgCol, data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }), canFilter: !!this.columnFilter, canResize: this.canResize, active: this.resizeHandler, onResize: e => this.onResize(e, rgCol.itemIndex), onDblClick: e => this.headerdblClick.emit(e), onClick: e => this.initialHeaderClick.emit(e), additionalData: this.additionalData }));
16015
16073
  visibleProps[colData === null || colData === void 0 ? void 0 : colData.prop] = rgCol.itemIndex;
16016
16074
  }
16017
16075
  return [
16018
- hAsync("div", { key: '37efb5ee52fc8b9d0f01b20500fd3833a203a5ea', class: "group-rgRow" }, hAsync(ColumnGroupsRenderer, { key: '40dec7ff9834df9df36d48ef636628abf843b042', canResize: this.canResize, active: this.resizeHandler, visibleProps: visibleProps, providers: this.providers, groups: this.groups, dimensionCol: this.dimensionCol.state, depth: this.groupingDepth, onResize: (changedX, startIndex, endIndex) => this.onResizeGroup(changedX, startIndex, endIndex), additionalData: this.additionalData })),
16019
- hAsync("div", { key: '5b34d0eb754cdb57c152c6a01b6b7e1ccf10aff5', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
16076
+ hAsync("div", { key: 'fcfd687bcae987699e2c0c6dd2b403dc3bb36c3d', class: "group-rgRow" }, hAsync(ColumnGroupsRenderer, { key: 'e3dfe9c5cbdd3c3dbbcbd7301a1a8a97353abf4b', canResize: this.canResize, active: this.resizeHandler, visibleProps: visibleProps, providers: this.providers, groups: this.groups, dimensionCol: this.dimensionCol.state, depth: this.groupingDepth, onResize: (changedX, startIndex, endIndex) => this.onResizeGroup(changedX, startIndex, endIndex), additionalData: this.additionalData })),
16077
+ hAsync("div", { key: '6b373546cc50bd85c7458da556c987e1a556d81b', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
16020
16078
  ];
16021
16079
  }
16022
16080
  get providers() {