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