@revolist/revogrid 4.9.41 → 4.9.42

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 (403) hide show
  1. package/dist/cjs/app-globals-c0b20747.js.map +1 -1
  2. package/dist/cjs/{column.drag.plugin-fcd892ec.js → column.drag.plugin-a6ef25bf.js} +1034 -149
  3. package/dist/cjs/column.drag.plugin-a6ef25bf.js.map +1 -0
  4. package/dist/cjs/column.service-831e1c92.js +1321 -0
  5. package/dist/cjs/column.service-831e1c92.js.map +1 -0
  6. package/dist/cjs/{column.service-26c61ed6.js → dimension.helpers-1927ad24.js} +490 -1273
  7. package/dist/cjs/dimension.helpers-1927ad24.js.map +1 -0
  8. package/dist/cjs/{edit.utils-179c0800.js → edit.utils-e51411f6.js} +3 -3
  9. package/dist/cjs/{edit.utils-179c0800.js.map → edit.utils-e51411f6.js.map} +1 -1
  10. package/dist/cjs/{header-cell-renderer-d879d95e.js → header-cell-renderer-53ecdcdb.js} +2 -2
  11. package/dist/cjs/{header-cell-renderer-d879d95e.js.map → header-cell-renderer-53ecdcdb.js.map} +1 -1
  12. package/dist/cjs/index.cjs.js +127 -69
  13. package/dist/cjs/index.cjs.js.map +1 -1
  14. package/dist/cjs/key.utils-96d0bc42.js +101 -0
  15. package/dist/cjs/key.utils-96d0bc42.js.map +1 -0
  16. package/dist/cjs/loader.cjs.js +1 -1
  17. package/dist/cjs/revo-grid.cjs.entry.js +310 -941
  18. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  19. package/dist/cjs/revo-grid.cjs.js +1 -1
  20. package/dist/cjs/revogr-attribution_7.cjs.entry.js +100 -70
  21. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  22. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +11 -10
  23. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  24. package/dist/cjs/revogr-data_4.cjs.entry.js +88 -78
  25. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  26. package/dist/cjs/revogr-filter-panel.cjs.entry.js +33 -13
  27. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  28. package/dist/cjs/{text-editor-b756d6b3.js → text-editor-1afffaf1.js} +6 -6
  29. package/dist/cjs/text-editor-1afffaf1.js.map +1 -0
  30. package/dist/cjs/{throttle-a57f51f9.js → throttle-bb713c73.js} +4 -4
  31. package/dist/cjs/{throttle-a57f51f9.js.map → throttle-bb713c73.js.map} +1 -1
  32. package/dist/cjs/{row-header-utils-c37f76e4.js → viewport.store-69b45f22.js} +15 -14
  33. package/dist/cjs/viewport.store-69b45f22.js.map +1 -0
  34. package/dist/collection/components/attribution/revogr-attribution.js +1 -1
  35. package/dist/collection/components/attribution/revogr-attribution.js.map +1 -1
  36. package/dist/collection/components/data/cell-renderer.js +11 -9
  37. package/dist/collection/components/data/cell-renderer.js.map +1 -1
  38. package/dist/collection/components/data/column.service.js +7 -19
  39. package/dist/collection/components/data/column.service.js.map +1 -1
  40. package/dist/collection/components/data/revogr-data-style.css +10 -5
  41. package/dist/collection/components/data/revogr-data.js +50 -28
  42. package/dist/collection/components/data/revogr-data.js.map +1 -1
  43. package/dist/collection/components/data/row-highlight.plugin.js.map +1 -1
  44. package/dist/collection/components/data/row-renderer.js.map +1 -1
  45. package/dist/collection/components/editors/revogr-edit-style.css +8 -5
  46. package/dist/collection/components/editors/revogr-edit.js +2 -2
  47. package/dist/collection/components/editors/revogr-edit.js.map +1 -1
  48. package/dist/collection/components/editors/text-editor.js +2 -2
  49. package/dist/collection/components/editors/text-editor.js.map +1 -1
  50. package/dist/collection/components/extra/revogr-extra.js +44 -6
  51. package/dist/collection/components/extra/revogr-extra.js.map +1 -1
  52. package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
  53. package/dist/collection/components/header/header-renderer.js.map +1 -1
  54. package/dist/collection/components/header/resizable.element.js.map +1 -1
  55. package/dist/collection/components/header/revogr-header-style.css +8 -5
  56. package/dist/collection/components/header/revogr-header.js +9 -9
  57. package/dist/collection/components/header/revogr-header.js.map +1 -1
  58. package/dist/collection/components/order/order-renderer.js.map +1 -1
  59. package/dist/collection/components/order/revogr-order-editor.js +12 -24
  60. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  61. package/dist/collection/components/overlay/autofill.service.js +7 -5
  62. package/dist/collection/components/overlay/autofill.service.js.map +1 -1
  63. package/dist/collection/components/overlay/keyboard.service.js +1 -4
  64. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  65. package/dist/collection/components/overlay/revogr-overlay-selection.js +88 -72
  66. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  67. package/dist/collection/components/overlay/revogr-overlay-style.css +8 -5
  68. package/dist/collection/components/overlay/selection.utils.js.map +1 -1
  69. package/dist/collection/components/revoGrid/plugin.service.js +81 -0
  70. package/dist/collection/components/revoGrid/plugin.service.js.map +1 -0
  71. package/dist/collection/components/revoGrid/revo-grid-style.css +18 -11
  72. package/dist/collection/components/revoGrid/revo-grid.js +289 -140
  73. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  74. package/dist/collection/components/revoGrid/viewport.service.js +9 -9
  75. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
  76. package/dist/collection/components/rowHeaders/revogr-row-headers.js +1 -1
  77. package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -1
  78. package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -1
  79. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +8 -5
  80. package/dist/collection/components/scroll/revogr-viewport-scroll.js +26 -20
  81. package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
  82. package/dist/collection/components/scrollable/revogr-scroll-style.css +10 -7
  83. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +10 -8
  84. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
  85. package/dist/collection/components/selectionFocus/revogr-focus-style.css +8 -5
  86. package/dist/collection/components/selectionFocus/revogr-focus.js +10 -10
  87. package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -1
  88. package/dist/collection/components/selectionTempRange/revogr-temp-range-style.css +8 -5
  89. package/dist/collection/components/selectionTempRange/revogr-temp-range.js +6 -6
  90. package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -1
  91. package/dist/collection/components/vnode/vnode-converter.js +1 -1
  92. package/dist/collection/components/vnode/vnode-converter.js.map +1 -1
  93. package/dist/collection/components/vnode/vnode.utils.js.map +1 -1
  94. package/dist/collection/index.js.map +1 -1
  95. package/dist/collection/plugins/add-rows-on-paste.plugin.js +40 -0
  96. package/dist/collection/plugins/add-rows-on-paste.plugin.js.map +1 -0
  97. package/dist/collection/plugins/base.plugin.js.map +1 -1
  98. package/dist/collection/plugins/column.auto-size.plugin.js +1 -1
  99. package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -1
  100. package/dist/collection/plugins/column.stretch.plugin.js +1 -1
  101. package/dist/collection/plugins/column.stretch.plugin.js.map +1 -1
  102. package/dist/collection/plugins/export/csv.js +1 -1
  103. package/dist/collection/plugins/export/csv.js.map +1 -1
  104. package/dist/collection/plugins/export/export.plugin.js +4 -2
  105. package/dist/collection/plugins/export/export.plugin.js.map +1 -1
  106. package/dist/collection/plugins/filter/filter.indexed.js +1 -0
  107. package/dist/collection/plugins/filter/filter.indexed.js.map +1 -1
  108. package/dist/collection/plugins/filter/filter.panel.js +35 -35
  109. package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
  110. package/dist/collection/plugins/filter/filter.plugin.js +117 -77
  111. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
  112. package/dist/collection/plugins/filter/filter.style.css +19 -5
  113. package/dist/collection/plugins/filter/filter.types.js.map +1 -1
  114. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js.map +1 -1
  115. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js.map +1 -1
  116. package/dist/collection/plugins/groupingRow/grouping.const.js +1 -0
  117. package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -1
  118. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +64 -79
  119. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
  120. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +3 -3
  121. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -1
  122. package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -1
  123. package/dist/collection/plugins/groupingRow/grouping.service.js +40 -6
  124. package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -1
  125. package/dist/collection/plugins/index.js +2 -0
  126. package/dist/collection/plugins/index.js.map +1 -1
  127. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +12 -6
  128. package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
  129. package/dist/collection/plugins/sorting/sorting.func.js +42 -0
  130. package/dist/collection/plugins/sorting/sorting.func.js.map +1 -0
  131. package/dist/collection/plugins/sorting/sorting.plugin.js +71 -69
  132. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  133. package/dist/collection/plugins/sorting/sorting.types.js +2 -0
  134. package/dist/collection/plugins/sorting/sorting.types.js.map +1 -0
  135. package/dist/collection/serve/controller.js +32 -15
  136. package/dist/collection/serve/data.js +18 -11
  137. package/dist/collection/services/column.data.provider.js +5 -2
  138. package/dist/collection/services/column.data.provider.js.map +1 -1
  139. package/dist/collection/services/data.provider.js +18 -7
  140. package/dist/collection/services/data.provider.js.map +1 -1
  141. package/dist/collection/services/dimension.provider.js +32 -33
  142. package/dist/collection/services/dimension.provider.js.map +1 -1
  143. package/dist/collection/services/selection.store.connector.js +1 -1
  144. package/dist/collection/services/selection.store.connector.js.map +1 -1
  145. package/dist/collection/store/dataSource/data.proxy.js +9 -15
  146. package/dist/collection/store/dataSource/data.proxy.js.map +1 -1
  147. package/dist/collection/store/dataSource/data.store.js +1 -1
  148. package/dist/collection/store/dataSource/data.store.js.map +1 -1
  149. package/dist/collection/store/dataSource/trimmed.plugin.js +5 -8
  150. package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
  151. package/dist/collection/store/dimension/dimension.helpers.js +7 -9
  152. package/dist/collection/store/dimension/dimension.helpers.js.map +1 -1
  153. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
  154. package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
  155. package/dist/collection/store/dimension/dimension.store.js +47 -67
  156. package/dist/collection/store/dimension/dimension.store.js.map +1 -1
  157. package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
  158. package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
  159. package/dist/collection/store/selection/selection.store.js +1 -1
  160. package/dist/collection/store/selection/selection.store.js.map +1 -1
  161. package/dist/collection/store/vp/viewport.store.js +4 -2
  162. package/dist/collection/store/vp/viewport.store.js.map +1 -1
  163. package/dist/collection/types/events.js +6 -2
  164. package/dist/collection/types/events.js.map +1 -1
  165. package/dist/collection/types/interfaces.js +4 -0
  166. package/dist/collection/types/interfaces.js.map +1 -1
  167. package/dist/collection/types/plugin.types.js.map +1 -1
  168. package/dist/collection/types/selection.js.map +1 -1
  169. package/dist/collection/types/viewport.interfaces.js.map +1 -1
  170. package/dist/collection/utils/column.utils.js +13 -3
  171. package/dist/collection/utils/column.utils.js.map +1 -1
  172. package/dist/esm/app-globals-3a760941.js.map +1 -1
  173. package/dist/esm/{column.drag.plugin-3cc77986.js → column.drag.plugin-50f49fa9.js} +1012 -130
  174. package/dist/esm/column.drag.plugin-50f49fa9.js.map +1 -0
  175. package/dist/esm/column.service-a6a7c415.js +1281 -0
  176. package/dist/esm/column.service-a6a7c415.js.map +1 -0
  177. package/dist/esm/{debounce-72878ced.js → debounce-b3166f78.js} +2 -2
  178. package/dist/esm/{debounce-72878ced.js.map → debounce-b3166f78.js.map} +1 -1
  179. package/dist/esm/{column.service-751345b2.js → dimension.helpers-d0d709c4.js} +450 -1234
  180. package/dist/esm/dimension.helpers-d0d709c4.js.map +1 -0
  181. package/dist/esm/{edit.utils-6fc686b9.js → edit.utils-0ae0db50.js} +2 -2
  182. package/dist/esm/{edit.utils-6fc686b9.js.map → edit.utils-0ae0db50.js.map} +1 -1
  183. package/dist/esm/{header-cell-renderer-32d2ed96.js → header-cell-renderer-36ecbdef.js} +2 -2
  184. package/dist/esm/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-36ecbdef.js.map} +1 -1
  185. package/dist/esm/index.js +52 -11
  186. package/dist/esm/index.js.map +1 -1
  187. package/dist/esm/{key.utils-17273f42.js → key.utils-7c3218d4.js} +2 -2
  188. package/dist/esm/{key.utils-17273f42.js.map → key.utils-7c3218d4.js.map} +1 -1
  189. package/dist/esm/loader.js +1 -1
  190. package/dist/esm/revo-grid.entry.js +246 -877
  191. package/dist/esm/revo-grid.entry.js.map +1 -1
  192. package/dist/esm/revo-grid.js +1 -1
  193. package/dist/esm/revogr-attribution_7.entry.js +63 -33
  194. package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
  195. package/dist/esm/revogr-clipboard_3.entry.js +7 -6
  196. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  197. package/dist/esm/revogr-data_4.entry.js +60 -50
  198. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  199. package/dist/esm/revogr-filter-panel.entry.js +34 -14
  200. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  201. package/dist/esm/{text-editor-901c3eb8.js → text-editor-148a17c1.js} +5 -5
  202. package/dist/esm/text-editor-148a17c1.js.map +1 -0
  203. package/dist/esm/{throttle-138d69c3.js → throttle-394e489c.js} +3 -3
  204. package/dist/esm/{throttle-138d69c3.js.map → throttle-394e489c.js.map} +1 -1
  205. package/dist/esm/{row-header-utils-3dfbb81f.js → viewport.store-afa8c4fe.js} +11 -10
  206. package/dist/esm/viewport.store-afa8c4fe.js.map +1 -0
  207. package/dist/revo-grid/app-globals-3a760941.js +8 -1
  208. package/dist/revo-grid/app-globals-3a760941.js.map +1 -1
  209. package/dist/revo-grid/column.drag.plugin-50f49fa9.js +2541 -0
  210. package/dist/revo-grid/column.drag.plugin-50f49fa9.js.map +1 -0
  211. package/dist/revo-grid/column.service-a6a7c415.js +1281 -0
  212. package/dist/revo-grid/column.service-a6a7c415.js.map +1 -0
  213. package/dist/revo-grid/debounce-b3166f78.js +495 -0
  214. package/dist/revo-grid/debounce-b3166f78.js.map +1 -0
  215. package/dist/revo-grid/dimension.helpers-d0d709c4.js +3611 -0
  216. package/dist/revo-grid/dimension.helpers-d0d709c4.js.map +1 -0
  217. package/dist/revo-grid/edit.utils-0ae0db50.js +17 -0
  218. package/dist/revo-grid/edit.utils-0ae0db50.js.map +1 -0
  219. package/dist/revo-grid/events-cf0893a3.js +38 -1
  220. package/dist/revo-grid/events-cf0893a3.js.map +1 -1
  221. package/dist/revo-grid/filter.button-d40ab17b.js +34 -1
  222. package/dist/revo-grid/filter.button-d40ab17b.js.map +1 -1
  223. package/dist/revo-grid/header-cell-renderer-36ecbdef.js +339 -0
  224. package/dist/revo-grid/header-cell-renderer-36ecbdef.js.map +1 -0
  225. package/dist/revo-grid/index-a61f225b.js +1845 -2
  226. package/dist/revo-grid/index-a61f225b.js.map +1 -1
  227. package/dist/revo-grid/index.esm.js +160 -1
  228. package/dist/revo-grid/index.esm.js.map +1 -1
  229. package/dist/revo-grid/key.utils-7c3218d4.js +89 -0
  230. package/dist/revo-grid/key.utils-7c3218d4.js.map +1 -0
  231. package/dist/revo-grid/resize-observer-83c9e167.js +501 -1
  232. package/dist/revo-grid/resize-observer-83c9e167.js.map +1 -1
  233. package/dist/revo-grid/revo-grid.entry.js +1934 -1
  234. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  235. package/dist/revo-grid/revo-grid.esm.js +21 -1
  236. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  237. package/dist/revo-grid/revogr-attribution_7.entry.js +1431 -1
  238. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
  239. package/dist/revo-grid/revogr-clipboard_3.entry.js +455 -1
  240. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  241. package/dist/revo-grid/revogr-data_4.entry.js +974 -1
  242. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  243. package/dist/revo-grid/revogr-filter-panel.entry.js +340 -1
  244. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  245. package/dist/revo-grid/sorting.sign-1a675bf7.js +9 -1
  246. package/dist/revo-grid/sorting.sign-1a675bf7.js.map +1 -1
  247. package/dist/revo-grid/text-editor-148a17c1.js +80 -0
  248. package/dist/revo-grid/text-editor-148a17c1.js.map +1 -0
  249. package/dist/revo-grid/throttle-394e489c.js +230 -0
  250. package/dist/revo-grid/throttle-394e489c.js.map +1 -0
  251. package/dist/revo-grid/viewport.helpers-7e7f9dad.js +48 -1
  252. package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -1
  253. package/dist/revo-grid/viewport.store-afa8c4fe.js +406 -0
  254. package/dist/revo-grid/viewport.store-afa8c4fe.js.map +1 -0
  255. package/dist/types/components/data/cell-renderer.d.ts +3 -5
  256. package/dist/types/components/data/column.service.d.ts +2 -3
  257. package/dist/types/components/data/revogr-data.d.ts +10 -6
  258. package/dist/types/components/data/row-highlight.plugin.d.ts +1 -1
  259. package/dist/types/components/data/row-renderer.d.ts +1 -1
  260. package/dist/types/components/editors/revogr-edit.d.ts +2 -2
  261. package/dist/types/components/editors/text-editor.d.ts +5 -6
  262. package/dist/types/components/extra/revogr-extra.d.ts +17 -3
  263. package/dist/types/components/header/header-cell-renderer.d.ts +1 -1
  264. package/dist/types/components/header/header-renderer.d.ts +2 -2
  265. package/dist/types/components/header/resizable.element.d.ts +1 -1
  266. package/dist/types/components/header/revogr-header.d.ts +2 -3
  267. package/dist/types/components/order/order-renderer.d.ts +1 -1
  268. package/dist/types/components/order/revogr-order-editor.d.ts +4 -10
  269. package/dist/types/components/overlay/autofill.service.d.ts +2 -2
  270. package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
  271. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +16 -13
  272. package/dist/types/components/overlay/selection.utils.d.ts +1 -1
  273. package/dist/types/components/revoGrid/plugin.service.d.ts +37 -0
  274. package/dist/types/components/revoGrid/revo-grid.d.ts +105 -61
  275. package/dist/types/components/revoGrid/viewport.service.d.ts +2 -2
  276. package/dist/types/components/rowHeaders/row-header-render.d.ts +2 -2
  277. package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +2 -5
  278. package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +2 -3
  279. package/dist/types/components/selectionFocus/revogr-focus.d.ts +2 -2
  280. package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +2 -3
  281. package/dist/types/components/vnode/vnode-converter.d.ts +1 -1
  282. package/dist/types/components/vnode/vnode.utils.d.ts +2 -2
  283. package/dist/types/components.d.ts +191 -108
  284. package/dist/types/index.d.ts +1 -1
  285. package/dist/types/plugins/add-rows-on-paste.plugin.d.ts +14 -0
  286. package/dist/types/plugins/base.plugin.d.ts +3 -4
  287. package/dist/types/plugins/column.auto-size.plugin.d.ts +1 -1
  288. package/dist/types/plugins/column.stretch.plugin.d.ts +1 -1
  289. package/dist/types/plugins/export/csv.d.ts +1 -1
  290. package/dist/types/plugins/export/export.plugin.d.ts +4 -3
  291. package/dist/types/plugins/filter/filter.panel.d.ts +2 -2
  292. package/dist/types/plugins/filter/filter.plugin.d.ts +25 -7
  293. package/dist/types/plugins/filter/filter.types.d.ts +32 -10
  294. package/dist/types/plugins/groupingColumn/columnGroupsRenderer.d.ts +2 -2
  295. package/dist/types/plugins/groupingColumn/headerGroupRenderer.d.ts +3 -4
  296. package/dist/types/plugins/groupingRow/grouping.const.d.ts +3 -1
  297. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +15 -10
  298. package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +38 -4
  299. package/dist/types/plugins/groupingRow/grouping.service.d.ts +9 -12
  300. package/dist/types/plugins/index.d.ts +2 -0
  301. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +2 -2
  302. package/dist/types/plugins/sorting/sorting.func.d.ts +3 -0
  303. package/dist/types/plugins/sorting/sorting.plugin.d.ts +14 -13
  304. package/dist/types/plugins/sorting/sorting.types.d.ts +13 -0
  305. package/dist/types/services/column.data.provider.d.ts +5 -2
  306. package/dist/types/services/data.provider.d.ts +3 -1
  307. package/dist/types/services/dimension.provider.d.ts +9 -4
  308. package/dist/types/services/selection.store.connector.d.ts +4 -4
  309. package/dist/types/store/dataSource/data.proxy.d.ts +7 -9
  310. package/dist/types/store/dataSource/data.store.d.ts +2 -3
  311. package/dist/types/store/dataSource/trimmed.plugin.d.ts +1 -1
  312. package/dist/types/store/dimension/dimension.helpers.d.ts +1 -4
  313. package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
  314. package/dist/types/store/dimension/dimension.store.d.ts +3 -2
  315. package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
  316. package/dist/types/store/selection/selection.store.d.ts +1 -1
  317. package/dist/types/store/vp/viewport.store.d.ts +1 -1
  318. package/dist/types/types/events.d.ts +1 -1
  319. package/dist/types/types/interfaces.d.ts +36 -12
  320. package/dist/types/types/plugin.types.d.ts +17 -1
  321. package/dist/types/types/selection.d.ts +23 -17
  322. package/dist/types/types/viewport.interfaces.d.ts +1 -3
  323. package/dist/types/utils/column.utils.d.ts +1 -0
  324. package/hydrate/index.js +2490 -2135
  325. package/hydrate/index.mjs +2490 -2135
  326. package/package.json +20 -19
  327. package/readme.md +15 -17
  328. package/standalone/column.service.js +192 -160
  329. package/standalone/column.service.js.map +1 -1
  330. package/standalone/data.store.js +36 -25
  331. package/standalone/data.store.js.map +1 -1
  332. package/standalone/dimension.helpers.js +8 -10
  333. package/standalone/dimension.helpers.js.map +1 -1
  334. package/standalone/index.js +46 -6
  335. package/standalone/index.js.map +1 -1
  336. package/standalone/revo-grid.js +1275 -1022
  337. package/standalone/revo-grid.js.map +1 -1
  338. package/standalone/revogr-attribution2.js +1 -1
  339. package/standalone/revogr-attribution2.js.map +1 -1
  340. package/standalone/revogr-data2.js +26 -22
  341. package/standalone/revogr-data2.js.map +1 -1
  342. package/standalone/revogr-edit2.js +3 -3
  343. package/standalone/revogr-edit2.js.map +1 -1
  344. package/standalone/revogr-extra2.js +25 -4
  345. package/standalone/revogr-extra2.js.map +1 -1
  346. package/standalone/revogr-filter-panel.js +34 -14
  347. package/standalone/revogr-filter-panel.js.map +1 -1
  348. package/standalone/revogr-focus2.js +2 -1
  349. package/standalone/revogr-focus2.js.map +1 -1
  350. package/standalone/revogr-header2.js +6 -5
  351. package/standalone/revogr-header2.js.map +1 -1
  352. package/standalone/revogr-order-editor2.js +3 -0
  353. package/standalone/revogr-order-editor2.js.map +1 -1
  354. package/standalone/revogr-overlay-selection2.js +29 -17
  355. package/standalone/revogr-overlay-selection2.js.map +1 -1
  356. package/standalone/revogr-row-headers2.js +12 -9
  357. package/standalone/revogr-row-headers2.js.map +1 -1
  358. package/standalone/revogr-scroll-virtual2.js +6 -4
  359. package/standalone/revogr-scroll-virtual2.js.map +1 -1
  360. package/standalone/revogr-temp-range2.js +1 -1
  361. package/standalone/revogr-temp-range2.js.map +1 -1
  362. package/standalone/revogr-viewport-scroll2.js +27 -21
  363. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  364. package/standalone/selection.utils.js +1 -0
  365. package/standalone/selection.utils.js.map +1 -1
  366. package/standalone/vnode-converter.js +1 -1
  367. package/standalone/vnode-converter.js.map +1 -1
  368. package/dist/cjs/column.drag.plugin-fcd892ec.js.map +0 -1
  369. package/dist/cjs/column.service-26c61ed6.js.map +0 -1
  370. package/dist/cjs/index-3ab26ab9.js +0 -513
  371. package/dist/cjs/index-3ab26ab9.js.map +0 -1
  372. package/dist/cjs/key.utils-f49d7bee.js +0 -101
  373. package/dist/cjs/key.utils-f49d7bee.js.map +0 -1
  374. package/dist/cjs/row-header-utils-c37f76e4.js.map +0 -1
  375. package/dist/cjs/text-editor-b756d6b3.js.map +0 -1
  376. package/dist/esm/column.drag.plugin-3cc77986.js.map +0 -1
  377. package/dist/esm/column.service-751345b2.js.map +0 -1
  378. package/dist/esm/index-1dcad6ef.js +0 -476
  379. package/dist/esm/index-1dcad6ef.js.map +0 -1
  380. package/dist/esm/row-header-utils-3dfbb81f.js.map +0 -1
  381. package/dist/esm/text-editor-901c3eb8.js.map +0 -1
  382. package/dist/revo-grid/column.drag.plugin-3cc77986.js +0 -5
  383. package/dist/revo-grid/column.drag.plugin-3cc77986.js.map +0 -1
  384. package/dist/revo-grid/column.service-751345b2.js +0 -5
  385. package/dist/revo-grid/column.service-751345b2.js.map +0 -1
  386. package/dist/revo-grid/debounce-72878ced.js +0 -5
  387. package/dist/revo-grid/debounce-72878ced.js.map +0 -1
  388. package/dist/revo-grid/edit.utils-6fc686b9.js +0 -5
  389. package/dist/revo-grid/edit.utils-6fc686b9.js.map +0 -1
  390. package/dist/revo-grid/header-cell-renderer-32d2ed96.js +0 -5
  391. package/dist/revo-grid/header-cell-renderer-32d2ed96.js.map +0 -1
  392. package/dist/revo-grid/index-1dcad6ef.js +0 -5
  393. package/dist/revo-grid/index-1dcad6ef.js.map +0 -1
  394. package/dist/revo-grid/key.utils-17273f42.js +0 -5
  395. package/dist/revo-grid/key.utils-17273f42.js.map +0 -1
  396. package/dist/revo-grid/row-header-utils-3dfbb81f.js +0 -5
  397. package/dist/revo-grid/row-header-utils-3dfbb81f.js.map +0 -1
  398. package/dist/revo-grid/text-editor-901c3eb8.js +0 -5
  399. package/dist/revo-grid/text-editor-901c3eb8.js.map +0 -1
  400. package/dist/revo-grid/throttle-138d69c3.js +0 -5
  401. package/dist/revo-grid/throttle-138d69c3.js.map +0 -1
  402. package/standalone/identity.js +0 -26
  403. package/standalone/identity.js.map +0 -1
@@ -3,45 +3,14 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const column_service = require('./column.service-26c61ed6.js');
7
- const index = require('./index-3ab26ab9.js');
8
- const rowHeaderUtils = require('./row-header-utils-c37f76e4.js');
9
- const index$1 = require('./index-10d10c55.js');
6
+ const column_service = require('./column.service-831e1c92.js');
7
+ const dimension_helpers = require('./dimension.helpers-1927ad24.js');
8
+ const viewport_store = require('./viewport.store-69b45f22.js');
9
+ const index = require('./index-10d10c55.js');
10
10
  const filter_button = require('./filter.button-b8debe72.js');
11
11
  const debounce = require('./debounce-ec7a04b4.js');
12
- const headerCellRenderer = require('./header-cell-renderer-d879d95e.js');
12
+ const headerCellRenderer = require('./header-cell-renderer-53ecdcdb.js');
13
13
 
14
- /**
15
- * Storing pre-calculated
16
- * Dimension information and sizes
17
- */
18
- const trimmedPlugin = (store) => {
19
- let trimmedSize = {};
20
- const setTrimmed = (sizes, trimmed) => {
21
- const newSize = Object.assign({}, sizes);
22
- trimmedSize = {};
23
- for (const [index, v] of Object.entries(trimmed)) {
24
- const i = index;
25
- if (v && newSize[i]) {
26
- trimmedSize[i] = newSize[i];
27
- delete newSize[i];
28
- }
29
- }
30
- store.setDimensionSize(newSize);
31
- };
32
- return {
33
- set(key, val) {
34
- switch (key) {
35
- case 'trimmed':
36
- const trim = val;
37
- const sizes = store.store.get('sizes');
38
- // recover trimmed, apply new trim
39
- setTrimmed(Object.assign(Object.assign({}, sizes), trimmedSize), trim);
40
- break;
41
- }
42
- },
43
- };
44
- };
45
14
  /**
46
15
  * Plugin which recalculates realSize on changes of sizes, originItemSize and count
47
16
  */
@@ -57,7 +26,7 @@ const recalculateRealSizePlugin = (storeService) => {
57
26
  switch (k) {
58
27
  case 'count':
59
28
  case 'sizes':
60
- case 'originItemSize':
29
+ case 'originItemSize': {
61
30
  // recalculate realSize
62
31
  let realSize = 0;
63
32
  const count = storeService.store.get('count');
@@ -68,19 +37,81 @@ const recalculateRealSizePlugin = (storeService) => {
68
37
  }
69
38
  storeService.setStore({ realSize });
70
39
  break;
40
+ }
71
41
  }
72
42
  },
73
43
  };
74
44
  };
45
+
46
+ /**
47
+ * Plugin for trimming
48
+ *
49
+ * 1.a. Retrieves the previous sizes value. Saves the resulting trimmed data as a new sizes value.
50
+ * 1.b. Stores a reference to the trimmed data to prevent further changes.
51
+ * 2. Removes multiple and shifts the data based on the trimmed value.
52
+ */
53
+ const trimmedPlugin = (storeService) => {
54
+ let trimmingObject = null;
55
+ let trimmedPreviousSizes = null;
56
+ return {
57
+ set(key, val) {
58
+ switch (key) {
59
+ case 'sizes': {
60
+ // prevent changes after trimming
61
+ if (trimmingObject && trimmingObject === val) {
62
+ trimmingObject = null;
63
+ return;
64
+ }
65
+ trimmedPreviousSizes = null;
66
+ break;
67
+ }
68
+ case 'trimmed': {
69
+ const trim = val;
70
+ if (!trimmedPreviousSizes) {
71
+ trimmedPreviousSizes = storeService.store.get('sizes');
72
+ }
73
+ trimmingObject = removeMultipleAndShift(trimmedPreviousSizes, trim || {});
74
+ // save a reference to the trimmed object to prevent changes after trimming
75
+ storeService.setSizes(trimmingObject);
76
+ break;
77
+ }
78
+ }
79
+ },
80
+ };
81
+ };
82
+ function removeMultipleAndShift(items, toRemove) {
83
+ const newItems = {};
84
+ const sortedIndexes = Object.keys(items || {})
85
+ .map(Number)
86
+ .sort((a, b) => a - b);
87
+ const lastIndex = sortedIndexes[sortedIndexes.length - 1];
88
+ let shift = 0;
89
+ for (let i = 0; i <= lastIndex; i++) {
90
+ if (toRemove[i] !== undefined) {
91
+ shift++;
92
+ // skip already removed
93
+ if (items[i] !== undefined) {
94
+ continue;
95
+ }
96
+ }
97
+ if (items[i] !== undefined) {
98
+ newItems[i - shift] = items[i];
99
+ }
100
+ }
101
+ return newItems;
102
+ }
103
+
104
+ /**
105
+ * Storing pre-calculated
106
+ * Dimension information and sizes
107
+ */
75
108
  function initialBase() {
76
109
  return {
77
110
  indexes: [],
78
111
  count: 0,
79
- // plugin support
80
- trimmed: {},
81
- // size operations, this provider stores only changed sizes, not all of them
82
- // same as indexes but for sizes and positions
83
- // item index to size
112
+ // hidden items
113
+ trimmed: null,
114
+ // virtual item index to size
84
115
  sizes: {},
85
116
  // order in indexes[] to coordinate
86
117
  positionIndexToItem: {},
@@ -99,9 +130,15 @@ function initialState() {
99
130
  class DimensionStore {
100
131
  constructor(type) {
101
132
  this.type = type;
102
- this.store = column_service.createStore(initialState());
103
- this.store.use(trimmedPlugin(this));
104
- this.store.use(recalculateRealSizePlugin(this));
133
+ this.store = dimension_helpers.createStore(initialState());
134
+ this.store.use(trimmedPlugin({
135
+ store: this.store,
136
+ setSizes: this.setDimensionSize.bind(this),
137
+ }));
138
+ this.store.use(recalculateRealSizePlugin({
139
+ store: this.store,
140
+ setStore: this.setStore.bind(this),
141
+ }));
105
142
  }
106
143
  getCurrentState() {
107
144
  const state = initialState();
@@ -113,22 +150,53 @@ class DimensionStore {
113
150
  }, state);
114
151
  }
115
152
  dispose() {
116
- column_service.setStore(this.store, initialState());
153
+ dimension_helpers.setStore(this.store, initialState());
117
154
  }
118
155
  setStore(data) {
119
- column_service.setStore(this.store, data);
156
+ dimension_helpers.setStore(this.store, data);
120
157
  }
121
158
  drop() {
122
- column_service.setStore(this.store, initialBase());
159
+ dimension_helpers.setStore(this.store, initialBase());
123
160
  }
124
161
  /**
125
162
  * Set custom dimension sizes and overwrite old
126
163
  * Generates new indexes based on sizes
127
164
  * @param sizes - sizes to set
128
165
  */
129
- setDimensionSize(sizes) {
130
- const dimensionData = index.calculateDimensionData(this.store.get('originItemSize'), sizes);
131
- column_service.setStore(this.store, dimensionData);
166
+ setDimensionSize(sizes = {}) {
167
+ const dimensionData = dimension_helpers.calculateDimensionData(this.store.get('originItemSize'), sizes);
168
+ dimension_helpers.setStore(this.store, Object.assign(Object.assign({}, dimensionData), { sizes }));
169
+ }
170
+ updateSizesPositionByIndexes(newItemsOrder, prevItemsOrder = []) {
171
+ // Move custom sizes to new order
172
+ const customSizes = Object.assign({}, this.store.get('sizes'));
173
+ if (!Object.keys(customSizes).length) {
174
+ return;
175
+ }
176
+ // Step 1: Create a map of original indices, but allow duplicates by storing arrays of indices
177
+ const originalIndices = {};
178
+ prevItemsOrder.forEach((physIndex, virtIndex) => {
179
+ if (!originalIndices[physIndex]) {
180
+ originalIndices[physIndex] = [];
181
+ }
182
+ originalIndices[physIndex].push(virtIndex); // Store all indices for each value
183
+ });
184
+ // Step 2: Create new sizes based on new item order
185
+ const newSizes = {};
186
+ newItemsOrder.forEach((physIndex, virtIndex) => {
187
+ const indices = originalIndices[physIndex]; // Get all original indices for this value
188
+ if (indices && indices.length > 0) {
189
+ const originalIndex = indices.shift(); // Get the first available original index
190
+ if (originalIndex !== undefined && originalIndex !== virtIndex && customSizes[originalIndex]) {
191
+ newSizes[virtIndex] = customSizes[originalIndex];
192
+ delete customSizes[originalIndex];
193
+ }
194
+ }
195
+ });
196
+ // Step 3: Set new sizes if there are changes
197
+ if (Object.keys(newSizes).length) {
198
+ this.setDimensionSize(Object.assign(Object.assign({}, customSizes), newSizes));
199
+ }
132
200
  }
133
201
  }
134
202
 
@@ -151,7 +219,7 @@ class BasePlugin {
151
219
  constructor(revogrid, providers) {
152
220
  this.revogrid = revogrid;
153
221
  this.providers = providers;
154
- this.h = index$1.h;
222
+ this.h = index.h;
155
223
  this.subscriptions = {};
156
224
  }
157
225
  /**
@@ -257,7 +325,7 @@ function arrayEach(array, iteratee) {
257
325
  * @returns {Function} Returns cast function.
258
326
  */
259
327
  function castFunction(value) {
260
- return typeof value == 'function' ? value : index.identity;
328
+ return typeof value == 'function' ? value : dimension_helpers.identity;
261
329
  }
262
330
 
263
331
  /**
@@ -291,7 +359,7 @@ function castFunction(value) {
291
359
  * // => Logs 'a' then 'b' (iteration order is not guaranteed).
292
360
  */
293
361
  function forEach(collection, iteratee) {
294
- var func = column_service.isArray(collection) ? arrayEach : column_service.baseEach;
362
+ var func = dimension_helpers.isArray(collection) ? arrayEach : column_service.baseEach;
295
363
  return func(collection, castFunction(iteratee));
296
364
  }
297
365
 
@@ -463,7 +531,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
463
531
  }
464
532
  return column_service.reduce(this.providers.data.stores, (r, s) => {
465
533
  const perStore = column_service.reduce(s.store.get('items'), (prev, _row, i) => {
466
- const item = column_service.getSourceItem(s.store, i);
534
+ const item = dimension_helpers.getSourceItem(s.store, i);
467
535
  return Math.max(prev || 0, this.getLength(item === null || item === void 0 ? void 0 : item[rgCol.prop]));
468
536
  }, 0);
469
537
  return Math.max(r, perStore);
@@ -529,7 +597,7 @@ class StretchColumn extends BasePlugin {
529
597
  this.providers = providers;
530
598
  this.stretchedColumn = null;
531
599
  // calculate scroll bar size for current user session
532
- this.scrollSize = index.getScrollbarSize(document);
600
+ this.scrollSize = dimension_helpers.getScrollbarSize(document);
533
601
  // subscribe to column changes
534
602
  const beforecolumnapplied = ({ detail: { columns }, }) => this.applyStretch(columns);
535
603
  this.addEventListener('beforecolumnapplied', beforecolumnapplied);
@@ -577,7 +645,7 @@ class StretchColumn extends BasePlugin {
577
645
  if (this.revogrid.rowHeaders) {
578
646
  const itemsLength = this.providers.data.stores.rgRow.store.get('source').length;
579
647
  const header = this.revogrid.rowHeaders;
580
- const rowHeaderSize = rowHeaderUtils.calculateRowHeaderSize(itemsLength, typeof header === 'object' ? header : undefined);
648
+ const rowHeaderSize = viewport_store.calculateRowHeaderSize(itemsLength, typeof header === 'object' ? header : undefined);
581
649
  if (rowHeaderSize) {
582
650
  sizeDifference -= rowHeaderSize;
583
651
  }
@@ -664,7 +732,7 @@ var MAX_ARRAY_LENGTH = 4294967295;
664
732
  * // => 3
665
733
  */
666
734
  function toLength(value) {
667
- return value ? baseClamp(column_service.toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
735
+ return value ? baseClamp(dimension_helpers.toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
668
736
  }
669
737
 
670
738
  /**
@@ -680,11 +748,11 @@ function toLength(value) {
680
748
  function baseFill(array, value, start, end) {
681
749
  var length = array.length;
682
750
 
683
- start = column_service.toInteger(start);
751
+ start = dimension_helpers.toInteger(start);
684
752
  if (start < 0) {
685
753
  start = -start > length ? 0 : (length + start);
686
754
  }
687
- end = (end === undefined || end > length) ? length : column_service.toInteger(end);
755
+ end = (end === undefined || end > length) ? length : dimension_helpers.toInteger(end);
688
756
  if (end < 0) {
689
757
  end += length;
690
758
  }
@@ -729,7 +797,7 @@ function fill(array, value, start, end) {
729
797
  if (!length) {
730
798
  return [];
731
799
  }
732
- if (start && typeof start != 'number' && column_service.isIterateeCall(array, value, start)) {
800
+ if (start && typeof start != 'number' && dimension_helpers.isIterateeCall(array, value, start)) {
733
801
  start = 0;
734
802
  end = length;
735
803
  }
@@ -838,7 +906,7 @@ class ExportFilePlugin extends BasePlugin {
838
906
  a.dispatchEvent(new MouseEvent('click'));
839
907
  this.revogrid.removeChild(a);
840
908
  // delay for revoke, correct for some browsers
841
- await index.timeout(120);
909
+ await dimension_helpers.timeout(120);
842
910
  URL.revokeObjectURL(url);
843
911
  }
844
912
  /** Blob object */
@@ -1055,6 +1123,7 @@ const notContains = (value, extra) => {
1055
1123
  notContains.extra = 'input';
1056
1124
  contains.extra = 'input';
1057
1125
 
1126
+ // filter.indexed.ts
1058
1127
  const filterCoreFunctionsIndexedByType = {
1059
1128
  none: () => true,
1060
1129
  empty: notSet,
@@ -1092,19 +1161,25 @@ const filterNames = {
1092
1161
  lte: '<=',
1093
1162
  };
1094
1163
 
1164
+ // filter.plugin.tsx
1095
1165
  const FILTER_TRIMMED_TYPE = 'filter';
1096
1166
  const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
1097
1167
  const FILTE_PANEL = 'revogr-filter-panel';
1098
1168
  /**
1099
1169
  * @typedef ColumnFilterConfig
1100
1170
  * @type {object}
1101
- * @property {FilterCollection|undefined} collection - preserved filter data
1171
+ *
1172
+ * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering with relation
1173
+ *
1174
+ * @property {Record<ColumnProp, FilterCollectionItem>|undefined} collection - preserved filter data, relation for filters will be applied as 'and'
1175
+ *
1102
1176
  * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
1177
+ *
1103
1178
  * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
1179
+ *
1104
1180
  * @property {FilterLocalization|undefined} localization - translation for filter popup captions.
1105
- * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
1181
+ *
1106
1182
  * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
1107
- * A way to define your own filter types per column
1108
1183
  */
1109
1184
  /**
1110
1185
  * @internal
@@ -1114,8 +1189,17 @@ class FilterPlugin extends BasePlugin {
1114
1189
  var _a;
1115
1190
  super(revogrid, providers);
1116
1191
  this.revogrid = revogrid;
1192
+ this.config = config;
1117
1193
  this.filterCollection = {};
1118
1194
  this.multiFilterItems = {};
1195
+ /**
1196
+ * Filter types
1197
+ * @example
1198
+ * {
1199
+ * string: ['contains', 'beginswith'],
1200
+ * number: ['eqN', 'neqN', 'gt']
1201
+ * }
1202
+ */
1119
1203
  this.filterByType = Object.assign({}, filterTypes);
1120
1204
  this.filterNameIndexByType = Object.assign({}, filterNames);
1121
1205
  this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
@@ -1126,8 +1210,8 @@ class FilterPlugin extends BasePlugin {
1126
1210
  const existingNodes = this.revogrid.registerVNode.filter(n => typeof n === 'object' && n.$tag$ !== FILTE_PANEL);
1127
1211
  this.revogrid.registerVNode = [
1128
1212
  ...existingNodes,
1129
- index$1.h("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) },
1130
- " ",
1213
+ index.h("revogr-filter-panel", { 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), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) },
1214
+ ' ',
1131
1215
  this.extraContent()),
1132
1216
  ];
1133
1217
  const aftersourceset = async () => {
@@ -1147,11 +1231,17 @@ class FilterPlugin extends BasePlugin {
1147
1231
  }
1148
1232
  });
1149
1233
  }
1234
+ if (Object.keys(this.multiFilterItems).length === 0) {
1235
+ return;
1236
+ }
1150
1237
  await this.runFiltering(this.multiFilterItems);
1151
1238
  };
1152
- this.addEventListener('headerclick', (e) => this.headerclick(e));
1239
+ this.addEventListener('headerclick', e => this.headerclick(e));
1153
1240
  this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
1154
- if (!detail) {
1241
+ if (!detail ||
1242
+ (typeof detail === 'object' &&
1243
+ (!detail.multiFilterItems ||
1244
+ !Object.keys(detail.multiFilterItems).length))) {
1155
1245
  this.clearFiltering();
1156
1246
  return;
1157
1247
  }
@@ -1163,6 +1253,9 @@ class FilterPlugin extends BasePlugin {
1163
1253
  this.addEventListener('aftersourceset', aftersourceset);
1164
1254
  this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
1165
1255
  }
1256
+ beforeshow(_) {
1257
+ // used as hook for filter panel
1258
+ }
1166
1259
  extraContent() {
1167
1260
  return null;
1168
1261
  }
@@ -1170,6 +1263,9 @@ class FilterPlugin extends BasePlugin {
1170
1263
  if (config.multiFilterItems) {
1171
1264
  this.multiFilterItems = Object.assign({}, config.multiFilterItems);
1172
1265
  }
1266
+ else {
1267
+ this.multiFilterItems = {};
1268
+ }
1173
1269
  // Add custom filters
1174
1270
  if (config.customFilters) {
1175
1271
  for (let customFilterType in config.customFilters) {
@@ -1177,8 +1273,11 @@ class FilterPlugin extends BasePlugin {
1177
1273
  if (!this.filterByType[cFilter.columnFilterType]) {
1178
1274
  this.filterByType[cFilter.columnFilterType] = [];
1179
1275
  }
1276
+ // add custom filter type
1180
1277
  this.filterByType[cFilter.columnFilterType].push(customFilterType);
1278
+ // add custom filter function
1181
1279
  this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
1280
+ // add custom filter name
1182
1281
  this.filterNameIndexByType[customFilterType] = cFilter.name;
1183
1282
  }
1184
1283
  }
@@ -1188,7 +1287,7 @@ class FilterPlugin extends BasePlugin {
1188
1287
  }
1189
1288
  /**
1190
1289
  * which filters has to be included/excluded
1191
- * convinient way to exclude system filters
1290
+ * convenient way to exclude system filters
1192
1291
  */
1193
1292
  const cfgInlcude = config.include;
1194
1293
  if (cfgInlcude) {
@@ -1206,15 +1305,11 @@ class FilterPlugin extends BasePlugin {
1206
1305
  }
1207
1306
  }
1208
1307
  if (config.collection) {
1209
- this.filterCollection = column_service.reduce(config.collection, (result, item, prop) => {
1210
- if (this.filterFunctionsIndexedByType[item.type]) {
1211
- result[prop] = item;
1212
- }
1213
- else {
1214
- console.warn(`${item.type} type is not found.`);
1215
- }
1216
- return result;
1217
- }, {});
1308
+ const filtersWithFilterFunctionPresent = Object.entries(config.collection).filter(([, item]) => this.filterFunctionsIndexedByType[item.type]);
1309
+ this.filterCollection = Object.fromEntries(filtersWithFilterFunctionPresent);
1310
+ }
1311
+ else {
1312
+ this.filterCollection = {};
1218
1313
  }
1219
1314
  if (config.localization) {
1220
1315
  if (config.localization.filterNames) {
@@ -1227,18 +1322,12 @@ class FilterPlugin extends BasePlugin {
1227
1322
  }
1228
1323
  }
1229
1324
  async headerclick(e) {
1230
- var _a, _b, _c;
1325
+ var _a, _b;
1231
1326
  const el = (_a = e.detail.originalEvent) === null || _a === void 0 ? void 0 : _a.target;
1232
1327
  if (!filter_button.isFilterBtn(el)) {
1233
1328
  return;
1234
1329
  }
1235
1330
  e.preventDefault();
1236
- // close if same
1237
- const changes = await ((_b = this.pop) === null || _b === void 0 ? void 0 : _b.getChanges());
1238
- if (changes && (changes === null || changes === void 0 ? void 0 : changes.prop) === e.detail.prop) {
1239
- (_c = this.pop) === null || _c === void 0 ? void 0 : _c.show();
1240
- return;
1241
- }
1242
1331
  if (!this.pop) {
1243
1332
  return;
1244
1333
  }
@@ -1246,7 +1335,9 @@ class FilterPlugin extends BasePlugin {
1246
1335
  const gridPos = this.revogrid.getBoundingClientRect();
1247
1336
  const buttonPos = el.getBoundingClientRect();
1248
1337
  const prop = e.detail.prop;
1249
- 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) }));
1338
+ const data = Object.assign(Object.assign(Object.assign({}, e.detail), this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, filterTypes: this.getColumnFilter(e.detail.filter), filterItems: this.multiFilterItems, extraContent: this.extraHyperContent });
1339
+ (_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
1340
+ this.pop.show(data);
1250
1341
  }
1251
1342
  getColumnFilter(type) {
1252
1343
  let filterType = 'string';
@@ -1330,7 +1421,11 @@ class FilterPlugin extends BasePlugin {
1330
1421
  }
1331
1422
  // applies the hasFilter to the columns to show filter icon
1332
1423
  this.providers.column.updateColumns(columnsToUpdate);
1333
- this.emit('afterfilterapply');
1424
+ this.emit('afterfilterapply', {
1425
+ multiFilterItems: filterItems,
1426
+ source,
1427
+ collection,
1428
+ });
1334
1429
  }
1335
1430
  async clearFiltering() {
1336
1431
  this.multiFilterItems = {};
@@ -1345,7 +1440,6 @@ class FilterPlugin extends BasePlugin {
1345
1440
  if (multiFilterItems[prop].length > 0) {
1346
1441
  const firstFilterItem = multiFilterItems[prop][0];
1347
1442
  collection[prop] = {
1348
- filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
1349
1443
  type: firstFilterItem.type,
1350
1444
  value: firstFilterItem.value,
1351
1445
  };
@@ -1372,65 +1466,847 @@ class FilterPlugin extends BasePlugin {
1372
1466
  getRowFilter(rows, filterItems, columnByProp) {
1373
1467
  const propKeys = Object.keys(filterItems);
1374
1468
  const trimmed = {};
1375
- let propFilterSatisfiedCount = 0;
1376
- let lastFilterResults = [];
1377
1469
  // each rows
1378
- rows.forEach((model, rowIndex) => {
1470
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
1379
1471
  // check filter by column properties
1380
1472
  for (const prop of propKeys) {
1381
- const propFilters = filterItems[prop];
1382
- // reset the count of satisfied filters
1383
- propFilterSatisfiedCount = 0;
1473
+ // add to the list of removed/trimmed rows of filter condition is satisfied
1474
+ if (this.shouldTrimRow(filterItems[prop], prop, columnByProp[prop], rows[rowIndex])) {
1475
+ trimmed[rowIndex] = true;
1476
+ }
1477
+ } // end of for-of propKeys
1478
+ }
1479
+ return trimmed;
1480
+ }
1481
+ shouldTrimRow(propFilters, prop, column, model = {}) {
1482
+ // reset the count of satisfied filters
1483
+ let propFilterSatisfiedCount = 0;
1484
+ // reset the array of last filter results
1485
+ let lastFilterResults = [];
1486
+ // testing each filter for a prop
1487
+ for (const [filterIndex, filterData] of propFilters.entries()) {
1488
+ // the filter LogicFunction based on the type
1489
+ const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
1490
+ // THE MAGIC OF FILTERING IS HERE
1491
+ // If there is no column but user wants to filter by a property
1492
+ const value = column ? column_service.getCellDataParsed(model, column) : model[prop];
1493
+ // OR relation
1494
+ if (filterData.relation === 'or') {
1384
1495
  // reset the array of last filter results
1385
1496
  lastFilterResults = [];
1386
- // testing each filter for a prop
1387
- for (const [filterIndex, filterData] of propFilters.entries()) {
1388
- // the filter LogicFunction based on the type
1389
- const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
1390
- // THE MAGIC OF FILTERING IS HERE
1391
- const column = columnByProp[prop];
1392
- // If there is no column but user wants to filter by a property
1393
- const value = column ? column_service.getCellDataParsed(model, columnByProp[prop]) : model[prop];
1394
- // OR relation
1395
- if (filterData.relation === 'or') {
1497
+ // if the filter is satisfied, continue to the next filter
1498
+ if (filterFunc(value, filterData.value)) {
1499
+ continue;
1500
+ }
1501
+ // if the filter is not satisfied, count it
1502
+ propFilterSatisfiedCount++;
1503
+ // AND relation
1504
+ }
1505
+ else {
1506
+ // 'and' relation will need to know the next filter
1507
+ // so we save this current filter to include it in the next filter
1508
+ lastFilterResults.push(!filterFunc(value, filterData.value));
1509
+ if (isFinalAndFilter(filterIndex, propFilters)) {
1510
+ // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1511
+ if (allAndConditionsSatisfied(lastFilterResults)) {
1396
1512
  // reset the array of last filter results
1397
1513
  lastFilterResults = [];
1398
- // if the filter is satisfied, continue to the next filter
1399
- if (filterFunc(value, filterData.value)) {
1400
- continue;
1401
- }
1402
- // if the filter is not satisfied, count it
1403
- propFilterSatisfiedCount++;
1404
- // AND relation
1405
- }
1406
- else {
1407
- // 'and' relation will need to know the next filter
1408
- // so we save this current filter to include it in the next filter
1409
- lastFilterResults.push(!filterFunc(value, filterData.value));
1410
- // check first if we have a filter on the next index to pair it with this current filter
1411
- const nextFilterData = propFilters[filterIndex + 1];
1412
- // stop the sequence if there is no next filter or if the next filter is not an 'and' relation
1413
- if (!nextFilterData || nextFilterData.relation !== 'and') {
1414
- // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1415
- if (lastFilterResults.indexOf(true) === -1) {
1416
- // reset the array of last filter results
1417
- lastFilterResults = [];
1418
- continue;
1419
- }
1420
- // we need to add all of the lastFilterResults since we need to satisfy all
1421
- propFilterSatisfiedCount += lastFilterResults.length;
1422
- // reset the array of last filter results
1423
- lastFilterResults = [];
1424
- }
1514
+ continue;
1425
1515
  }
1426
- } // end of propFilters forEach
1427
- // add to the list of removed/trimmed rows of filter condition is satisfied
1428
- if (propFilterSatisfiedCount === propFilters.length) {
1429
- trimmed[rowIndex] = true;
1516
+ // we need to add all of the lastFilterResults since we need to satisfy all
1517
+ propFilterSatisfiedCount += lastFilterResults.length;
1518
+ // reset the array of last filter results
1519
+ lastFilterResults = [];
1430
1520
  }
1431
- } // end of for-of propKeys
1521
+ }
1522
+ } // end of propFilters forEach
1523
+ return propFilterSatisfiedCount === propFilters.length;
1524
+ }
1525
+ }
1526
+ /**
1527
+ * Checks if the current filter is the final one in an AND sequence.
1528
+ * @param index - Current filter index in the list.
1529
+ * @param filters - Array of filters for the property.
1530
+ * @returns True if this is the last AND condition; false otherwise.
1531
+ */
1532
+ function isFinalAndFilter(index, filters) {
1533
+ const nextFilter = filters[index + 1]; // Get the next filter in the list.
1534
+ // Return true if there's no next filter or if the next filter defined and is not part of the AND sequence.
1535
+ return !nextFilter || (!!nextFilter.relation && nextFilter.relation !== 'and');
1536
+ }
1537
+ /**
1538
+ * Determines if all conditions in an AND sequence are satisfied.
1539
+ * @param pendingResults - An array of results from the AND conditions.
1540
+ * @returns True if all conditions are satisfied; false otherwise.
1541
+ */
1542
+ function allAndConditionsSatisfied(pendingResults) {
1543
+ // Check if there are any failed conditions in the pending results.
1544
+ return !pendingResults.includes(true);
1545
+ }
1546
+
1547
+ // provide collapse data
1548
+ function doCollapse(pIndex, source) {
1549
+ const model = source[pIndex];
1550
+ const collapseValue = model[column_service.PSEUDO_GROUP_ITEM_VALUE];
1551
+ const trimmed = {};
1552
+ let i = pIndex + 1;
1553
+ const total = source.length;
1554
+ while (i < total) {
1555
+ const currentModel = source[i];
1556
+ if (column_service.isGrouping(currentModel)) {
1557
+ const currentValue = currentModel[column_service.PSEUDO_GROUP_ITEM_VALUE];
1558
+ if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
1559
+ break;
1560
+ }
1561
+ currentModel[column_service.GROUP_EXPANDED] = false;
1562
+ }
1563
+ trimmed[i++] = true;
1564
+ }
1565
+ model[column_service.GROUP_EXPANDED] = false;
1566
+ return { trimmed };
1567
+ }
1568
+ /**
1569
+ *
1570
+ * @param pIndex - physical index
1571
+ * @param vIndex - virtual index, need to update item collection
1572
+ * @param source - data source
1573
+ * @param rowItemsIndexes - rgRow indexes
1574
+ */
1575
+ function doExpand(vIndex, source, rowItemsIndexes) {
1576
+ const physicalIndex = rowItemsIndexes[vIndex];
1577
+ const model = source[physicalIndex];
1578
+ const currentGroup = column_service.getParsedGroup(model[column_service.PSEUDO_GROUP_ITEM_ID]);
1579
+ const trimmed = {};
1580
+ // no group found
1581
+ if (!currentGroup) {
1582
+ return { trimmed };
1583
+ }
1584
+ const groupItems = [];
1585
+ model[column_service.GROUP_EXPANDED] = true;
1586
+ let i = physicalIndex + 1;
1587
+ const total = source.length;
1588
+ let groupLevelOnly = 0;
1589
+ // go through all rows
1590
+ while (i < total) {
1591
+ const currentModel = source[i];
1592
+ const isGroup = column_service.isGrouping(currentModel);
1593
+ // group found
1594
+ if (isGroup) {
1595
+ if (!column_service.isSameGroup(currentGroup, model, currentModel)) {
1596
+ break;
1597
+ }
1598
+ else if (!groupLevelOnly) {
1599
+ // if get group first it's group only level
1600
+ groupLevelOnly = currentModel[column_service.GROUP_DEPTH];
1601
+ }
1602
+ }
1603
+ // level 0 or same depth
1604
+ if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[column_service.GROUP_DEPTH])) {
1605
+ trimmed[i] = false;
1606
+ groupItems.push(i);
1607
+ }
1608
+ i++;
1609
+ }
1610
+ const result = {
1611
+ trimmed,
1612
+ };
1613
+ if (groupItems.length) {
1614
+ const items = [...rowItemsIndexes];
1615
+ items.splice(vIndex + 1, 0, ...groupItems);
1616
+ result.items = items;
1617
+ }
1618
+ return result;
1619
+ }
1620
+
1621
+ const TRIMMED_GROUPING = 'grouping';
1622
+ /**
1623
+ * Prepare trimming updated indexes for grouping
1624
+ * @param initiallyTrimed
1625
+ * @param firstLevelMap
1626
+ * @param secondLevelMap
1627
+ */
1628
+ function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
1629
+ const trimemedOptionsToUpgrade = {};
1630
+ /**
1631
+ * go through all groups except grouping
1632
+ */
1633
+ for (let type in initiallyTrimed) {
1634
+ if (type === TRIMMED_GROUPING) {
1635
+ continue;
1636
+ }
1637
+ const items = initiallyTrimed[type];
1638
+ const newItems = {};
1639
+ for (let initialIndex in items) {
1640
+ /**
1641
+ * if item exists we find it in collection
1642
+ * we support 2 level of conversions
1643
+ */
1644
+ let newConversionIndex = firstLevelMap[initialIndex];
1645
+ if (secondLevelMap) {
1646
+ newConversionIndex = secondLevelMap[newConversionIndex];
1647
+ }
1648
+ /**
1649
+ * if item was trimmed previously
1650
+ * trimming makes sense to apply
1651
+ */
1652
+ if (items[initialIndex]) {
1653
+ newItems[newConversionIndex] = true;
1654
+ /**
1655
+ * If changes present apply changes to new source
1656
+ */
1657
+ if (newConversionIndex !== parseInt(initialIndex, 10)) {
1658
+ trimemedOptionsToUpgrade[type] = newItems;
1659
+ }
1660
+ }
1661
+ }
1662
+ }
1663
+ return trimemedOptionsToUpgrade;
1664
+ }
1665
+
1666
+ /** `Object#toString` result references. */
1667
+ var stringTag = '[object String]';
1668
+
1669
+ /**
1670
+ * Checks if `value` is classified as a `String` primitive or object.
1671
+ *
1672
+ * @static
1673
+ * @since 0.1.0
1674
+ * @memberOf _
1675
+ * @category Lang
1676
+ * @param {*} value The value to check.
1677
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
1678
+ * @example
1679
+ *
1680
+ * _.isString('abc');
1681
+ * // => true
1682
+ *
1683
+ * _.isString(1);
1684
+ * // => false
1685
+ */
1686
+ function isString(value) {
1687
+ return typeof value == 'string' ||
1688
+ (!dimension_helpers.isArray(value) && debounce.isObjectLike(value) && debounce.baseGetTag(value) == stringTag);
1689
+ }
1690
+
1691
+ /**
1692
+ * Gets the size of an ASCII `string`.
1693
+ *
1694
+ * @private
1695
+ * @param {string} string The string inspect.
1696
+ * @returns {number} Returns the string size.
1697
+ */
1698
+ var asciiSize = dimension_helpers.baseProperty('length');
1699
+
1700
+ const asciiSize$1 = asciiSize;
1701
+
1702
+ /** Used to compose unicode character classes. */
1703
+ var rsAstralRange$1 = '\\ud800-\\udfff',
1704
+ rsComboMarksRange$1 = '\\u0300-\\u036f',
1705
+ reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
1706
+ rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
1707
+ rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
1708
+ rsVarRange$1 = '\\ufe0e\\ufe0f';
1709
+
1710
+ /** Used to compose unicode capture groups. */
1711
+ var rsZWJ$1 = '\\u200d';
1712
+
1713
+ /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
1714
+ var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
1715
+
1716
+ /**
1717
+ * Checks if `string` contains Unicode symbols.
1718
+ *
1719
+ * @private
1720
+ * @param {string} string The string to inspect.
1721
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
1722
+ */
1723
+ function hasUnicode(string) {
1724
+ return reHasUnicode.test(string);
1725
+ }
1726
+
1727
+ /** Used to compose unicode character classes. */
1728
+ var rsAstralRange = '\\ud800-\\udfff',
1729
+ rsComboMarksRange = '\\u0300-\\u036f',
1730
+ reComboHalfMarksRange = '\\ufe20-\\ufe2f',
1731
+ rsComboSymbolsRange = '\\u20d0-\\u20ff',
1732
+ rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
1733
+ rsVarRange = '\\ufe0e\\ufe0f';
1734
+
1735
+ /** Used to compose unicode capture groups. */
1736
+ var rsAstral = '[' + rsAstralRange + ']',
1737
+ rsCombo = '[' + rsComboRange + ']',
1738
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
1739
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
1740
+ rsNonAstral = '[^' + rsAstralRange + ']',
1741
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
1742
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
1743
+ rsZWJ = '\\u200d';
1744
+
1745
+ /** Used to compose unicode regexes. */
1746
+ var reOptMod = rsModifier + '?',
1747
+ rsOptVar = '[' + rsVarRange + ']?',
1748
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
1749
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
1750
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
1751
+
1752
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
1753
+ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
1754
+
1755
+ /**
1756
+ * Gets the size of a Unicode `string`.
1757
+ *
1758
+ * @private
1759
+ * @param {string} string The string inspect.
1760
+ * @returns {number} Returns the string size.
1761
+ */
1762
+ function unicodeSize(string) {
1763
+ var result = reUnicode.lastIndex = 0;
1764
+ while (reUnicode.test(string)) {
1765
+ ++result;
1766
+ }
1767
+ return result;
1768
+ }
1769
+
1770
+ /**
1771
+ * Gets the number of symbols in `string`.
1772
+ *
1773
+ * @private
1774
+ * @param {string} string The string to inspect.
1775
+ * @returns {number} Returns the string size.
1776
+ */
1777
+ function stringSize(string) {
1778
+ return hasUnicode(string)
1779
+ ? unicodeSize(string)
1780
+ : asciiSize$1(string);
1781
+ }
1782
+
1783
+ /** `Object#toString` result references. */
1784
+ var mapTag = '[object Map]',
1785
+ setTag = '[object Set]';
1786
+
1787
+ /**
1788
+ * Gets the size of `collection` by returning its length for array-like
1789
+ * values or the number of own enumerable string keyed properties for objects.
1790
+ *
1791
+ * @static
1792
+ * @memberOf _
1793
+ * @since 0.1.0
1794
+ * @category Collection
1795
+ * @param {Array|Object|string} collection The collection to inspect.
1796
+ * @returns {number} Returns the collection size.
1797
+ * @example
1798
+ *
1799
+ * _.size([1, 2, 3]);
1800
+ * // => 3
1801
+ *
1802
+ * _.size({ 'a': 1, 'b': 2 });
1803
+ * // => 2
1804
+ *
1805
+ * _.size('pebbles');
1806
+ * // => 7
1807
+ */
1808
+ function size(collection) {
1809
+ if (collection == null) {
1810
+ return 0;
1811
+ }
1812
+ if (dimension_helpers.isArrayLike(collection)) {
1813
+ return isString(collection) ? stringSize(collection) : collection.length;
1814
+ }
1815
+ var tag = dimension_helpers.getTag(collection);
1816
+ if (tag == mapTag || tag == setTag) {
1817
+ return collection.size;
1818
+ }
1819
+ return dimension_helpers.baseKeys(collection).length;
1820
+ }
1821
+
1822
+ function sortIndexByItems(indexes, source, sortingFunc = {}) {
1823
+ // if no sorting - return unsorted indexes
1824
+ if (Object.entries(sortingFunc).length === 0) {
1825
+ // Unsorted indexes
1826
+ return [...Array(indexes.length).keys()];
1827
+ }
1828
+ //
1829
+ /**
1830
+ * go through all indexes and align in new order
1831
+ * performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.
1832
+ */
1833
+ return indexes.sort((a, b) => {
1834
+ const itemA = source[a];
1835
+ const itemB = source[b];
1836
+ for (const [prop, cmp] of Object.entries(sortingFunc)) {
1837
+ if (column_service.isGrouping(itemA)) {
1838
+ if (itemA['__rvgr-prop'] !== prop) {
1839
+ return 0;
1840
+ }
1841
+ }
1842
+ if (column_service.isGrouping(itemB)) {
1843
+ if (itemB['__rvgr-prop'] !== prop) {
1844
+ return 0;
1845
+ }
1846
+ }
1847
+ /**
1848
+ * If the comparison function returns a non-zero value (sorted), it means that the items should be sorted based on the given property. In such a case, the function immediately returns the sorted value, indicating the order in which the items should be arranged.
1849
+ * If none of the comparison functions result in a non-zero value, indicating that the items are equal or should remain in the same order, the function eventually returns 0.
1850
+ */
1851
+ const sorted = cmp === null || cmp === void 0 ? void 0 : cmp(prop, itemA, itemB);
1852
+ if (sorted) {
1853
+ return sorted;
1854
+ }
1855
+ }
1856
+ return 0;
1857
+ });
1858
+ }
1859
+
1860
+ /**
1861
+ * Lifecycle
1862
+ * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
1863
+ * 1.1. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
1864
+ * 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
1865
+ * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
1866
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
1867
+ *
1868
+ * Note: If you prevent an event, it will not proceed to the subsequent steps.
1869
+ */
1870
+ class SortingPlugin extends BasePlugin {
1871
+ runSorting(order, comparison, ignoreViewportUpdate) {
1872
+ var _a;
1873
+ this.sort(order, comparison, undefined, ignoreViewportUpdate);
1874
+ (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
1875
+ this.sortingPromise = null;
1876
+ }
1877
+ constructor(revogrid, providers, config) {
1878
+ super(revogrid, providers);
1879
+ this.revogrid = revogrid;
1880
+ this.sortingPromise = null;
1881
+ this.postponeSort = debounce.debounce((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
1882
+ const setConfig = (cfg) => {
1883
+ var _a;
1884
+ if (cfg) {
1885
+ const sortingFunc = {};
1886
+ const order = {};
1887
+ (_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
1888
+ sortingFunc[col.prop] = this.getComparer(col, col.order);
1889
+ order[col.prop] = col.order;
1890
+ });
1891
+ // // set sorting
1892
+ this.sorting = order;
1893
+ this.sortingFunc = sortingFunc;
1894
+ }
1895
+ };
1896
+ setConfig(config);
1897
+ this.addEventListener('sortingconfigchanged', ({ detail }) => {
1898
+ config = detail;
1899
+ setConfig(detail);
1900
+ this.startSorting(this.sorting, this.sortingFunc);
1432
1901
  });
1433
- return trimmed;
1902
+ this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
1903
+ // if sorting was provided - sort data
1904
+ if (!!this.sorting && this.sortingFunc) {
1905
+ const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
1906
+ if (event.defaultPrevented) {
1907
+ return;
1908
+ }
1909
+ this.startSorting(this.sorting, this.sortingFunc);
1910
+ }
1911
+ });
1912
+ this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
1913
+ // if config provided - do nothing, read from config
1914
+ if (config) {
1915
+ return;
1916
+ }
1917
+ const columns = this.providers.column.getColumns();
1918
+ const sortingFunc = {};
1919
+ for (let prop in order) {
1920
+ const cmp = this.getComparer(column_service.getColumnByProp(columns, prop), order[prop]);
1921
+ sortingFunc[prop] = cmp;
1922
+ }
1923
+ // set sorting
1924
+ this.sorting = order;
1925
+ this.sortingFunc = order && sortingFunc;
1926
+ });
1927
+ this.addEventListener('beforeheaderclick', (e) => {
1928
+ var _a, _b, _c, _d;
1929
+ if (e.defaultPrevented) {
1930
+ return;
1931
+ }
1932
+ if (!((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.sortable)) {
1933
+ return;
1934
+ }
1935
+ this.headerclick(e.detail.column, e.detail.index, (_d = (_c = e.detail) === null || _c === void 0 ? void 0 : _c.originalEvent) === null || _d === void 0 ? void 0 : _d.shiftKey);
1936
+ });
1937
+ }
1938
+ startSorting(order, sortingFunc, ignoreViewportUpdate) {
1939
+ if (!this.sortingPromise) {
1940
+ // add job before render
1941
+ this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
1942
+ this.sortingPromise = resolve;
1943
+ }));
1944
+ }
1945
+ this.postponeSort(order, sortingFunc, ignoreViewportUpdate);
1946
+ }
1947
+ getComparer(column, order) {
1948
+ var _a, _b;
1949
+ const cellCmp = ((_a = column === null || column === void 0 ? void 0 : column.cellCompare) === null || _a === void 0 ? void 0 : _a.bind({ order })) || ((_b = this.defaultCellCompare) === null || _b === void 0 ? void 0 : _b.bind({ column, order }));
1950
+ if (order == 'asc') {
1951
+ return cellCmp;
1952
+ }
1953
+ if (order == 'desc') {
1954
+ return this.descCellCompare(cellCmp);
1955
+ }
1956
+ return undefined;
1957
+ }
1958
+ /**
1959
+ * Apply sorting to data on header click
1960
+ * If additive - add to existing sorting, multiple columns can be sorted
1961
+ */
1962
+ headerclick(column, index, additive) {
1963
+ var _a, _b;
1964
+ let order = this.getNextOrder(column.order);
1965
+ const beforeEvent = this.emit('beforesorting', { column, order, additive });
1966
+ if (beforeEvent.defaultPrevented) {
1967
+ return;
1968
+ }
1969
+ order = beforeEvent.detail.order;
1970
+ const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
1971
+ // apply sort data
1972
+ const beforeApplyEvent = this.emit('beforesortingapply', {
1973
+ column: newCol,
1974
+ order,
1975
+ additive,
1976
+ });
1977
+ if (beforeApplyEvent.defaultPrevented) {
1978
+ return;
1979
+ }
1980
+ const cmp = this.getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
1981
+ if (beforeApplyEvent.detail.additive && this.sorting) {
1982
+ const sorting = {};
1983
+ const sortingFunc = {};
1984
+ this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
1985
+ // extend sorting function with new sorting for multiple columns sorting
1986
+ this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
1987
+ if (column.prop in sorting && size(sorting) > 1 && order === undefined) {
1988
+ delete sorting[column.prop];
1989
+ delete sortingFunc[column.prop];
1990
+ }
1991
+ else {
1992
+ sorting[column.prop] = order;
1993
+ sortingFunc[column.prop] = cmp;
1994
+ }
1995
+ }
1996
+ else {
1997
+ if (order) {
1998
+ // reset sorting
1999
+ this.sorting = { [column.prop]: order };
2000
+ this.sortingFunc = { [column.prop]: cmp };
2001
+ }
2002
+ else {
2003
+ (_a = this.sorting) === null || _a === void 0 ? true : delete _a[column.prop];
2004
+ (_b = this.sortingFunc) === null || _b === void 0 ? true : delete _b[column.prop];
2005
+ }
2006
+ }
2007
+ this.startSorting(this.sorting, this.sortingFunc);
2008
+ }
2009
+ /**
2010
+ * Sort items by sorting function
2011
+ * @requires proxyItems applied to row store
2012
+ * @requires source applied to row store
2013
+ *
2014
+ * @param sorting - per column sorting
2015
+ * @param data - this.stores['rgRow'].store.get('source')
2016
+ */
2017
+ sort(sorting, sortingFunc, types = rowTypes, ignoreViewportUpdate = false) {
2018
+ // if no sorting - reset
2019
+ if (!Object.keys(sorting || {}).length) {
2020
+ for (let type of types) {
2021
+ const storeService = this.providers.data.stores[type];
2022
+ // row data
2023
+ const source = storeService.store.get('source');
2024
+ // row indexes
2025
+ const proxyItems = storeService.store.get('proxyItems');
2026
+ // row indexes
2027
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2028
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2029
+ storeService.setData({ proxyItems: newItemsOrder, source: [...source], });
2030
+ }
2031
+ }
2032
+ else {
2033
+ for (let type of types) {
2034
+ const storeService = this.providers.data.stores[type];
2035
+ // row data
2036
+ const source = storeService.store.get('source');
2037
+ // row indexes
2038
+ const proxyItems = storeService.store.get('proxyItems');
2039
+ const newItemsOrder = sortIndexByItems([...proxyItems], source, sortingFunc);
2040
+ // take row indexes before trim applied and proxy items
2041
+ const prevItems = storeService.store.get('items');
2042
+ storeService.setData({
2043
+ proxyItems: newItemsOrder,
2044
+ source: [...source],
2045
+ });
2046
+ // take currently visible row indexes
2047
+ const newItems = storeService.store.get('items');
2048
+ if (!ignoreViewportUpdate) {
2049
+ this.providers.dimension
2050
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2051
+ }
2052
+ }
2053
+ }
2054
+ this.emit('aftersortingapply');
2055
+ }
2056
+ defaultCellCompare(prop, a, b) {
2057
+ const aRaw = this.column ? column_service.getCellRaw(a, this.column) : a === null || a === void 0 ? void 0 : a[prop];
2058
+ const bRaw = this.column ? column_service.getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
2059
+ const av = aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
2060
+ const bv = bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
2061
+ return av == bv ? 0 : av > bv ? 1 : -1;
2062
+ }
2063
+ descCellCompare(cmp) {
2064
+ return (prop, a, b) => {
2065
+ return -1 * cmp(prop, a, b);
2066
+ };
2067
+ }
2068
+ getNextOrder(currentOrder) {
2069
+ switch (currentOrder) {
2070
+ case undefined:
2071
+ return 'asc';
2072
+ case 'asc':
2073
+ return 'desc';
2074
+ case 'desc':
2075
+ return undefined;
2076
+ }
2077
+ }
2078
+ }
2079
+
2080
+ class GroupingRowPlugin extends BasePlugin {
2081
+ getStore(type = column_service.GROUPING_ROW_TYPE) {
2082
+ return this.providers.data.stores[type].store;
2083
+ }
2084
+ constructor(revogrid, providers) {
2085
+ super(revogrid, providers);
2086
+ this.revogrid = revogrid;
2087
+ this.providers = providers;
2088
+ }
2089
+ // befoce cell focus
2090
+ onFocus(e) {
2091
+ if (column_service.isGrouping(e.detail.model)) {
2092
+ e.preventDefault();
2093
+ }
2094
+ }
2095
+ // expand event triggered
2096
+ onExpand({ virtualIndex }) {
2097
+ const { source } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2098
+ let newTrimmed = this.getStore().get('trimmed')[TRIMMED_GROUPING];
2099
+ let i = dimension_helpers.getPhysical(this.getStore(), virtualIndex);
2100
+ const isExpanded = column_service.getExpanded(source[i]);
2101
+ if (!isExpanded) {
2102
+ const { trimmed, items } = doExpand(virtualIndex, source, this.getStore().get('items'));
2103
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2104
+ if (items) {
2105
+ dimension_helpers.setItems(this.getStore(), items);
2106
+ }
2107
+ }
2108
+ else {
2109
+ const { trimmed } = doCollapse(i, source);
2110
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2111
+ this.revogrid.clearFocus();
2112
+ }
2113
+ this.getStore().set('source', source);
2114
+ this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
2115
+ }
2116
+ setColumnGrouping(cols) {
2117
+ // if 0 column as holder
2118
+ if (cols === null || cols === void 0 ? void 0 : cols.length) {
2119
+ cols[0][column_service.PSEUDO_GROUP_COLUMN] = true;
2120
+ return true;
2121
+ }
2122
+ return false;
2123
+ }
2124
+ setColumns({ columns }) {
2125
+ for (let type of columnTypes) {
2126
+ if (this.setColumnGrouping(columns[type])) {
2127
+ break;
2128
+ }
2129
+ }
2130
+ }
2131
+ // evaluate drag between groups
2132
+ onDrag(e) {
2133
+ const { from, to } = e.detail;
2134
+ const isDown = to - from >= 0;
2135
+ const { source } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2136
+ const items = this.getStore().get('items');
2137
+ let i = isDown ? from : to;
2138
+ const end = isDown ? to : from;
2139
+ for (; i < end; i++) {
2140
+ const model = source[items[i]];
2141
+ const isGroup = column_service.isGrouping(model);
2142
+ if (isGroup) {
2143
+ e.preventDefault();
2144
+ return;
2145
+ }
2146
+ }
2147
+ }
2148
+ beforeTrimmedApply(trimmed, type) {
2149
+ /** Before filter apply remove grouping filtering */
2150
+ if (type === FILTER_TRIMMED_TYPE) {
2151
+ const source = this.getStore().get('source');
2152
+ for (let index in trimmed) {
2153
+ if (trimmed[index] && column_service.isGrouping(source[index])) {
2154
+ trimmed[index] = false;
2155
+ }
2156
+ }
2157
+ }
2158
+ }
2159
+ isSortingRunning() {
2160
+ const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
2161
+ return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
2162
+ }
2163
+ // subscribe to grid events to process them accordingly
2164
+ subscribe() {
2165
+ /** if grouping present and new data source arrived */
2166
+ this.addEventListener('beforesourceset', ({ detail }) => {
2167
+ var _a, _b, _c;
2168
+ if (!(((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length) && ((_c = detail === null || detail === void 0 ? void 0 : detail.source) === null || _c === void 0 ? void 0 : _c.length))) {
2169
+ return;
2170
+ }
2171
+ // if sorting is running don't apply grouping, wait for sorting, then it'll apply in @aftersortingapply
2172
+ if (this.isSortingRunning()) {
2173
+ return;
2174
+ }
2175
+ this.onDataSet(detail);
2176
+ });
2177
+ this.addEventListener('beforecolumnsset', ({ detail }) => {
2178
+ this.setColumns(detail);
2179
+ });
2180
+ /**
2181
+ * filter applied need to clear grouping and apply again
2182
+ * based on new results can be new grouping
2183
+ */
2184
+ this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
2185
+ /**
2186
+ * sorting applied need to clear grouping and apply again
2187
+ * based on new results whole grouping order will changed
2188
+ */
2189
+ this.addEventListener('aftersortingapply', () => {
2190
+ var _a, _b;
2191
+ if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
2192
+ return;
2193
+ }
2194
+ this.doSourceUpdate(Object.assign({}, this.options));
2195
+ });
2196
+ /**
2197
+ * Apply logic for focus inside of grouping
2198
+ * We can't focus on grouping rows, navigation only inside of groups for now
2199
+ */
2200
+ this.addEventListener('beforecellfocus', e => this.onFocus(e));
2201
+ /**
2202
+ * Prevent rgRow drag outside the group
2203
+ */
2204
+ this.addEventListener('roworderchanged', e => this.onDrag(e));
2205
+ /**
2206
+ * When grouping expand icon was clicked
2207
+ */
2208
+ this.addEventListener('groupexpandclick', e => this.onExpand(e.detail));
2209
+ }
2210
+ /**
2211
+ * Starts global source update with group clearing and applying new one
2212
+ * Initiated when need to reapply grouping
2213
+ */
2214
+ doSourceUpdate(options) {
2215
+ var _a;
2216
+ /**
2217
+ * Get source without grouping
2218
+ * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
2219
+ */
2220
+ const { source, prevExpanded, oldNewIndexes } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2221
+ const expanded = Object.assign({ prevExpanded }, options);
2222
+ /**
2223
+ * Group again
2224
+ * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
2225
+ */
2226
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = column_service.gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], expanded);
2227
+ const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
2228
+ // setup source
2229
+ this.providers.data.setData(sourceWithGroups, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
2230
+ this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
2231
+ }
2232
+ /**
2233
+ * Apply grouping on data set
2234
+ * Clear grouping from source
2235
+ * If source came from other plugin
2236
+ */
2237
+ onDataSet(data) {
2238
+ var _a, _b;
2239
+ let preservedExpanded = {};
2240
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.preserveGroupingOnUpdate) !== false) {
2241
+ let { prevExpanded } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2242
+ preservedExpanded = prevExpanded;
2243
+ }
2244
+ const source = data.source.filter(s => !column_service.isGrouping(s));
2245
+ const options = Object.assign(Object.assign({}, (this.revogrid.grouping || {})), { prevExpanded: preservedExpanded });
2246
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = column_service.gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
2247
+ data.source = sourceWithGroups;
2248
+ this.providers.data.setGrouping({ depth });
2249
+ this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
2250
+ }
2251
+ /**
2252
+ * Externam call to apply grouping. Called by revogrid when prop changed.
2253
+ */
2254
+ setGrouping(options) {
2255
+ var _a, _b;
2256
+ // unsubscribe from all events when group applied
2257
+ this.clearSubscriptions();
2258
+ this.options = options;
2259
+ // clear props, no grouping exists
2260
+ if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
2261
+ this.clearGrouping();
2262
+ return;
2263
+ }
2264
+ // props exist and source inited
2265
+ const { source } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2266
+ if (source.length) {
2267
+ this.doSourceUpdate(Object.assign({}, options));
2268
+ }
2269
+ // props exist and columns inited
2270
+ for (let t of columnTypes) {
2271
+ if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
2272
+ this.providers.column.refreshByType(t);
2273
+ break;
2274
+ }
2275
+ }
2276
+ // if has any grouping subscribe to events again
2277
+ this.subscribe();
2278
+ }
2279
+ // clear grouping
2280
+ clearGrouping() {
2281
+ // clear columns
2282
+ columnTypes.forEach(t => {
2283
+ const cols = this.providers.column.getColumns(t);
2284
+ let deleted = false;
2285
+ cols.forEach(c => {
2286
+ if (column_service.isGroupingColumn(c)) {
2287
+ delete c[column_service.PSEUDO_GROUP_COLUMN];
2288
+ deleted = true;
2289
+ }
2290
+ });
2291
+ // if column store had grouping clear and refresh
2292
+ if (deleted) {
2293
+ this.providers.column.refreshByType(t);
2294
+ }
2295
+ });
2296
+ // clear rows
2297
+ const { source, oldNewIndexes } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2298
+ this.providers.data.setData(source, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2299
+ this.updateTrimmed(undefined, undefined, oldNewIndexes);
2300
+ }
2301
+ updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap = {}, secondLevelMap) {
2302
+ // map previously trimmed data
2303
+ const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
2304
+ for (let type in trimemedOptionsToUpgrade) {
2305
+ this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
2306
+ }
2307
+ // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
2308
+ // setup trimmed data for grouping
2309
+ this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
1434
2310
  }
1435
2311
  }
1436
2312
 
@@ -1509,7 +2385,7 @@ const DRAG_END = 'columndragend';
1509
2385
  const BEFORE_DRAG_END = 'beforecolumndragend';
1510
2386
  // use this event subscription to drop D&D for particular columns
1511
2387
  const DRAG_START = 'columndragstart';
1512
- class ColumnPlugin extends BasePlugin {
2388
+ class ColumnMovePlugin extends BasePlugin {
1513
2389
  constructor(revogrid, providers) {
1514
2390
  super(revogrid, providers);
1515
2391
  this.revogrid = revogrid;
@@ -1561,7 +2437,7 @@ class ColumnPlugin extends BasePlugin {
1561
2437
  const cols = this.getDimension(data.pin || 'rgCol');
1562
2438
  const gridRect = this.revogrid.getBoundingClientRect();
1563
2439
  const elRect = dataEl.getBoundingClientRect();
1564
- const startItem = index.getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
2440
+ const startItem = dimension_helpers.getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
1565
2441
  this.staticDragData = {
1566
2442
  startPos: event.x,
1567
2443
  startItem,
@@ -1586,8 +2462,12 @@ class ColumnPlugin extends BasePlugin {
1586
2462
  const start = this.staticDragData.startPos;
1587
2463
  if (Math.abs(start - e.x) > 10) {
1588
2464
  const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
1589
- const rgCol = index.getItemByPosition(this.staticDragData.cols, x);
2465
+ const rgCol = dimension_helpers.getItemByPosition(this.staticDragData.cols, x);
1590
2466
  this.orderUi.autoscroll(x, dragData.elRect.width);
2467
+ // prevent position change if out of bounds
2468
+ if (rgCol.itemIndex >= this.staticDragData.cols.count) {
2469
+ return;
2470
+ }
1591
2471
  this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
1592
2472
  }
1593
2473
  }
@@ -1606,16 +2486,18 @@ class ColumnPlugin extends BasePlugin {
1606
2486
  if (relativePos < 0) {
1607
2487
  relativePos = 0;
1608
2488
  }
1609
- const newPosition = index.getItemByPosition(this.staticDragData.cols, relativePos);
2489
+ const newPosition = dimension_helpers.getItemByPosition(this.staticDragData.cols, relativePos);
1610
2490
  const store = this.providers.column.stores[this.dragData.type].store;
1611
- const items = [...store.get('items')];
2491
+ const newItems = [...store.get('items')];
1612
2492
  // prevent position change if needed
1613
- const { defaultPrevented: stopDrag } = headerCellRenderer.dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[items[this.staticDragData.startItem.itemIndex]] }));
2493
+ const { defaultPrevented: stopDrag } = headerCellRenderer.dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[newItems[this.staticDragData.startItem.itemIndex]] }));
1614
2494
  if (!stopDrag) {
2495
+ const prevItems = [...newItems];
1615
2496
  // todo: if move item out of group remove item from group
1616
- const toMove = items.splice(this.staticDragData.startItem.itemIndex, 1);
1617
- items.splice(newPosition.itemIndex, 0, ...toMove);
1618
- store.set('items', items);
2497
+ const toMove = newItems.splice(this.staticDragData.startItem.itemIndex, 1);
2498
+ newItems.splice(newPosition.itemIndex, 0, ...toMove);
2499
+ store.set('items', newItems);
2500
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
1619
2501
  }
1620
2502
  headerCellRenderer.dispatch(this.revogrid, DRAG_END, this.dragData);
1621
2503
  }
@@ -1658,13 +2540,16 @@ function getLeftRelative(absoluteX, gridPos, offset) {
1658
2540
 
1659
2541
  exports.AutoSizeColumnPlugin = AutoSizeColumnPlugin;
1660
2542
  exports.BasePlugin = BasePlugin;
1661
- exports.ColumnPlugin = ColumnPlugin;
2543
+ exports.ColumnMovePlugin = ColumnMovePlugin;
1662
2544
  exports.DimensionStore = DimensionStore;
2545
+ exports.ExportCsv = ExportCsv;
1663
2546
  exports.ExportFilePlugin = ExportFilePlugin;
1664
2547
  exports.FILTER_CONFIG_CHANGED_EVENT = FILTER_CONFIG_CHANGED_EVENT;
1665
2548
  exports.FILTER_TRIMMED_TYPE = FILTER_TRIMMED_TYPE;
1666
2549
  exports.FILTE_PANEL = FILTE_PANEL;
1667
2550
  exports.FilterPlugin = FilterPlugin;
2551
+ exports.GroupingRowPlugin = GroupingRowPlugin;
2552
+ exports.SortingPlugin = SortingPlugin;
1668
2553
  exports.StretchColumn = StretchColumn;
1669
2554
  exports.columnTypes = columnTypes;
1670
2555
  exports.filterCoreFunctionsIndexedByType = filterCoreFunctionsIndexedByType;
@@ -1676,4 +2561,4 @@ exports.isRowType = isRowType;
1676
2561
  exports.isStretchPlugin = isStretchPlugin;
1677
2562
  exports.rowTypes = rowTypes;
1678
2563
 
1679
- //# sourceMappingURL=column.drag.plugin-fcd892ec.js.map
2564
+ //# sourceMappingURL=column.drag.plugin-a6ef25bf.js.map