@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
@@ -2,16 +2,15 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { h, proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, Host } from '@stencil/core/internal/client';
5
- import { r as reduce, m as baseEach, e as getColumnType, o as isGrouping, p as getGroupingName, d as getCellDataParsed, G as GROUP_EXPANDED, q as getParsedGroup, s as isSameGroup, t as GROUP_DEPTH, P as PSEUDO_GROUP_ITEM_VALUE, u as PSEUDO_GROUP_ITEM_ID, v as GROUPING_ROW_TYPE, w as PSEUDO_GROUP_COLUMN, x as GROUP_EXPAND_EVENT, y as gatherGrouping, z as isGroupingColumn, h as isColGrouping, l as getColumnByProp, f as getColumnSizes, E as EMPTY_INDEX, j as getColumns, A as SelectionStoreConnector } from './column.service.js';
6
- import { j as createStore, i as setStore, k as isArray, b as getSourceItem, l as toInteger, m as isIterateeCall, g as getPhysical, e as setItems, n as baseProperty, o as isArrayLike, q as getTag, r as baseKeys, D as DataStore, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems } from './data.store.js';
7
- import { i as identity } from './identity.js';
5
+ import { x as reduce, y as baseEach, r as getColumnType, h as isGrouping, f as getGroupingName, q as getCellDataParsed, G as GROUP_EXPANDED, k as getParsedGroup, P as PSEUDO_GROUP_ITEM_ID, l as isSameGroup, z as GROUP_DEPTH, A as PSEUDO_GROUP_ITEM_VALUE, w as getColumnByProp, p as getCellRaw, B as GROUPING_ROW_TYPE, b as getSource, C as PSEUDO_GROUP_COLUMN, e as gatherGrouping, j as isGroupingColumn, d as getExpanded, t as isColGrouping, s as getColumnSizes, E as EMPTY_INDEX, u as getColumns, D as SelectionStoreConnector } from './column.service.js';
6
+ import './platform.js';
7
+ import { j as createStore, i as setStore, k as identity, l as isArray, b as getSourceItem, m as toInteger, n as isIterateeCall, o as baseProperty, q as isArrayLike, r as getTag, u as baseKeys, g as getPhysical, e as setItems, D as DataStore, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems } from './data.store.js';
8
8
  import { d as debounce } from './debounce.js';
9
9
  import { R as RESIZE_INTERVAL } from './consts.js';
10
10
  import { c as calculateDimensionData, g as getItemByPosition, a as getItemByIndex } from './dimension.helpers.js';
11
11
  import { f as calculateRowHeaderSize, V as ViewportStore, h as defineCustomElement$6 } from './revogr-row-headers2.js';
12
12
  import { g as getScrollbarSize, t as timeout } from './index2.js';
13
13
  import { b as FILTER_PROP, i as isFilterBtn } from './filter.button.js';
14
- import './platform.js';
15
14
  import { i as isObjectLike, b as baseGetTag } from './toNumber.js';
16
15
  import { v as viewportDataPartition, H as HEADER_SLOT, C as CONTENT_SLOT, F as FOOTER_SLOT, D as DATA_SLOT, d as defineCustomElement$3 } from './revogr-viewport-scroll2.js';
17
16
  import { d as dispatch, O as ON_COLUMN_CLICK, b as defineCustomElement$9 } from './revogr-header2.js';
@@ -93,37 +92,6 @@ function getTheme(theme) {
93
92
  return DEFAULT_THEME;
94
93
  }
95
94
 
96
- /**
97
- * Storing pre-calculated
98
- * Dimension information and sizes
99
- */
100
- const trimmedPlugin = (store) => {
101
- let trimmedSize = {};
102
- const setTrimmed = (sizes, trimmed) => {
103
- const newSize = Object.assign({}, sizes);
104
- trimmedSize = {};
105
- for (const [index, v] of Object.entries(trimmed)) {
106
- const i = index;
107
- if (v && newSize[i]) {
108
- trimmedSize[i] = newSize[i];
109
- delete newSize[i];
110
- }
111
- }
112
- store.setDimensionSize(newSize);
113
- };
114
- return {
115
- set(key, val) {
116
- switch (key) {
117
- case 'trimmed':
118
- const trim = val;
119
- const sizes = store.store.get('sizes');
120
- // recover trimmed, apply new trim
121
- setTrimmed(Object.assign(Object.assign({}, sizes), trimmedSize), trim);
122
- break;
123
- }
124
- },
125
- };
126
- };
127
95
  /**
128
96
  * Plugin which recalculates realSize on changes of sizes, originItemSize and count
129
97
  */
@@ -139,7 +107,7 @@ const recalculateRealSizePlugin = (storeService) => {
139
107
  switch (k) {
140
108
  case 'count':
141
109
  case 'sizes':
142
- case 'originItemSize':
110
+ case 'originItemSize': {
143
111
  // recalculate realSize
144
112
  let realSize = 0;
145
113
  const count = storeService.store.get('count');
@@ -150,19 +118,81 @@ const recalculateRealSizePlugin = (storeService) => {
150
118
  }
151
119
  storeService.setStore({ realSize });
152
120
  break;
121
+ }
122
+ }
123
+ },
124
+ };
125
+ };
126
+
127
+ /**
128
+ * Plugin for trimming
129
+ *
130
+ * 1.a. Retrieves the previous sizes value. Saves the resulting trimmed data as a new sizes value.
131
+ * 1.b. Stores a reference to the trimmed data to prevent further changes.
132
+ * 2. Removes multiple and shifts the data based on the trimmed value.
133
+ */
134
+ const trimmedPlugin = (storeService) => {
135
+ let trimmingObject = null;
136
+ let trimmedPreviousSizes = null;
137
+ return {
138
+ set(key, val) {
139
+ switch (key) {
140
+ case 'sizes': {
141
+ // prevent changes after trimming
142
+ if (trimmingObject && trimmingObject === val) {
143
+ trimmingObject = null;
144
+ return;
145
+ }
146
+ trimmedPreviousSizes = null;
147
+ break;
148
+ }
149
+ case 'trimmed': {
150
+ const trim = val;
151
+ if (!trimmedPreviousSizes) {
152
+ trimmedPreviousSizes = storeService.store.get('sizes');
153
+ }
154
+ trimmingObject = removeMultipleAndShift(trimmedPreviousSizes, trim || {});
155
+ // save a reference to the trimmed object to prevent changes after trimming
156
+ storeService.setSizes(trimmingObject);
157
+ break;
158
+ }
153
159
  }
154
160
  },
155
161
  };
156
162
  };
163
+ function removeMultipleAndShift(items, toRemove) {
164
+ const newItems = {};
165
+ const sortedIndexes = Object.keys(items || {})
166
+ .map(Number)
167
+ .sort((a, b) => a - b);
168
+ const lastIndex = sortedIndexes[sortedIndexes.length - 1];
169
+ let shift = 0;
170
+ for (let i = 0; i <= lastIndex; i++) {
171
+ if (toRemove[i] !== undefined) {
172
+ shift++;
173
+ // skip already removed
174
+ if (items[i] !== undefined) {
175
+ continue;
176
+ }
177
+ }
178
+ if (items[i] !== undefined) {
179
+ newItems[i - shift] = items[i];
180
+ }
181
+ }
182
+ return newItems;
183
+ }
184
+
185
+ /**
186
+ * Storing pre-calculated
187
+ * Dimension information and sizes
188
+ */
157
189
  function initialBase() {
158
190
  return {
159
191
  indexes: [],
160
192
  count: 0,
161
- // plugin support
162
- trimmed: {},
163
- // size operations, this provider stores only changed sizes, not all of them
164
- // same as indexes but for sizes and positions
165
- // item index to size
193
+ // hidden items
194
+ trimmed: null,
195
+ // virtual item index to size
166
196
  sizes: {},
167
197
  // order in indexes[] to coordinate
168
198
  positionIndexToItem: {},
@@ -182,8 +212,14 @@ class DimensionStore {
182
212
  constructor(type) {
183
213
  this.type = type;
184
214
  this.store = createStore(initialState());
185
- this.store.use(trimmedPlugin(this));
186
- this.store.use(recalculateRealSizePlugin(this));
215
+ this.store.use(trimmedPlugin({
216
+ store: this.store,
217
+ setSizes: this.setDimensionSize.bind(this),
218
+ }));
219
+ this.store.use(recalculateRealSizePlugin({
220
+ store: this.store,
221
+ setStore: this.setStore.bind(this),
222
+ }));
187
223
  }
188
224
  getCurrentState() {
189
225
  const state = initialState();
@@ -208,9 +244,40 @@ class DimensionStore {
208
244
  * Generates new indexes based on sizes
209
245
  * @param sizes - sizes to set
210
246
  */
211
- setDimensionSize(sizes) {
247
+ setDimensionSize(sizes = {}) {
212
248
  const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
213
- setStore(this.store, dimensionData);
249
+ setStore(this.store, Object.assign(Object.assign({}, dimensionData), { sizes }));
250
+ }
251
+ updateSizesPositionByIndexes(newItemsOrder, prevItemsOrder = []) {
252
+ // Move custom sizes to new order
253
+ const customSizes = Object.assign({}, this.store.get('sizes'));
254
+ if (!Object.keys(customSizes).length) {
255
+ return;
256
+ }
257
+ // Step 1: Create a map of original indices, but allow duplicates by storing arrays of indices
258
+ const originalIndices = {};
259
+ prevItemsOrder.forEach((physIndex, virtIndex) => {
260
+ if (!originalIndices[physIndex]) {
261
+ originalIndices[physIndex] = [];
262
+ }
263
+ originalIndices[physIndex].push(virtIndex); // Store all indices for each value
264
+ });
265
+ // Step 2: Create new sizes based on new item order
266
+ const newSizes = {};
267
+ newItemsOrder.forEach((physIndex, virtIndex) => {
268
+ const indices = originalIndices[physIndex]; // Get all original indices for this value
269
+ if (indices && indices.length > 0) {
270
+ const originalIndex = indices.shift(); // Get the first available original index
271
+ if (originalIndex !== undefined && originalIndex !== virtIndex && customSizes[originalIndex]) {
272
+ newSizes[virtIndex] = customSizes[originalIndex];
273
+ delete customSizes[originalIndex];
274
+ }
275
+ }
276
+ });
277
+ // Step 3: Set new sizes if there are changes
278
+ if (Object.keys(newSizes).length) {
279
+ this.setDimensionSize(Object.assign(Object.assign({}, customSizes), newSizes));
280
+ }
214
281
  }
215
282
  }
216
283
 
@@ -1137,6 +1204,7 @@ const notContains = (value, extra) => {
1137
1204
  notContains.extra = 'input';
1138
1205
  contains.extra = 'input';
1139
1206
 
1207
+ // filter.indexed.ts
1140
1208
  const filterCoreFunctionsIndexedByType = {
1141
1209
  none: () => true,
1142
1210
  empty: notSet,
@@ -1174,19 +1242,25 @@ const filterNames = {
1174
1242
  lte: '<=',
1175
1243
  };
1176
1244
 
1245
+ // filter.plugin.tsx
1177
1246
  const FILTER_TRIMMED_TYPE = 'filter';
1178
1247
  const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
1179
1248
  const FILTE_PANEL = 'revogr-filter-panel';
1180
1249
  /**
1181
1250
  * @typedef ColumnFilterConfig
1182
1251
  * @type {object}
1183
- * @property {FilterCollection|undefined} collection - preserved filter data
1252
+ *
1253
+ * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering with relation
1254
+ *
1255
+ * @property {Record<ColumnProp, FilterCollectionItem>|undefined} collection - preserved filter data, relation for filters will be applied as 'and'
1256
+ *
1184
1257
  * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
1258
+ *
1185
1259
  * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
1260
+ *
1186
1261
  * @property {FilterLocalization|undefined} localization - translation for filter popup captions.
1187
- * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
1262
+ *
1188
1263
  * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
1189
- * A way to define your own filter types per column
1190
1264
  */
1191
1265
  /**
1192
1266
  * @internal
@@ -1196,8 +1270,17 @@ class FilterPlugin extends BasePlugin {
1196
1270
  var _a;
1197
1271
  super(revogrid, providers);
1198
1272
  this.revogrid = revogrid;
1273
+ this.config = config;
1199
1274
  this.filterCollection = {};
1200
1275
  this.multiFilterItems = {};
1276
+ /**
1277
+ * Filter types
1278
+ * @example
1279
+ * {
1280
+ * string: ['contains', 'beginswith'],
1281
+ * number: ['eqN', 'neqN', 'gt']
1282
+ * }
1283
+ */
1201
1284
  this.filterByType = Object.assign({}, filterTypes);
1202
1285
  this.filterNameIndexByType = Object.assign({}, filterNames);
1203
1286
  this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
@@ -1208,8 +1291,8 @@ class FilterPlugin extends BasePlugin {
1208
1291
  const existingNodes = this.revogrid.registerVNode.filter(n => typeof n === 'object' && n.$tag$ !== FILTE_PANEL);
1209
1292
  this.revogrid.registerVNode = [
1210
1293
  ...existingNodes,
1211
- 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) },
1212
- " ",
1294
+ 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) },
1295
+ ' ',
1213
1296
  this.extraContent()),
1214
1297
  ];
1215
1298
  const aftersourceset = async () => {
@@ -1229,11 +1312,17 @@ class FilterPlugin extends BasePlugin {
1229
1312
  }
1230
1313
  });
1231
1314
  }
1315
+ if (Object.keys(this.multiFilterItems).length === 0) {
1316
+ return;
1317
+ }
1232
1318
  await this.runFiltering(this.multiFilterItems);
1233
1319
  };
1234
- this.addEventListener('headerclick', (e) => this.headerclick(e));
1320
+ this.addEventListener('headerclick', e => this.headerclick(e));
1235
1321
  this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
1236
- if (!detail) {
1322
+ if (!detail ||
1323
+ (typeof detail === 'object' &&
1324
+ (!detail.multiFilterItems ||
1325
+ !Object.keys(detail.multiFilterItems).length))) {
1237
1326
  this.clearFiltering();
1238
1327
  return;
1239
1328
  }
@@ -1245,6 +1334,9 @@ class FilterPlugin extends BasePlugin {
1245
1334
  this.addEventListener('aftersourceset', aftersourceset);
1246
1335
  this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
1247
1336
  }
1337
+ beforeshow(_) {
1338
+ // used as hook for filter panel
1339
+ }
1248
1340
  extraContent() {
1249
1341
  return null;
1250
1342
  }
@@ -1252,6 +1344,9 @@ class FilterPlugin extends BasePlugin {
1252
1344
  if (config.multiFilterItems) {
1253
1345
  this.multiFilterItems = Object.assign({}, config.multiFilterItems);
1254
1346
  }
1347
+ else {
1348
+ this.multiFilterItems = {};
1349
+ }
1255
1350
  // Add custom filters
1256
1351
  if (config.customFilters) {
1257
1352
  for (let customFilterType in config.customFilters) {
@@ -1259,8 +1354,11 @@ class FilterPlugin extends BasePlugin {
1259
1354
  if (!this.filterByType[cFilter.columnFilterType]) {
1260
1355
  this.filterByType[cFilter.columnFilterType] = [];
1261
1356
  }
1357
+ // add custom filter type
1262
1358
  this.filterByType[cFilter.columnFilterType].push(customFilterType);
1359
+ // add custom filter function
1263
1360
  this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
1361
+ // add custom filter name
1264
1362
  this.filterNameIndexByType[customFilterType] = cFilter.name;
1265
1363
  }
1266
1364
  }
@@ -1270,7 +1368,7 @@ class FilterPlugin extends BasePlugin {
1270
1368
  }
1271
1369
  /**
1272
1370
  * which filters has to be included/excluded
1273
- * convinient way to exclude system filters
1371
+ * convenient way to exclude system filters
1274
1372
  */
1275
1373
  const cfgInlcude = config.include;
1276
1374
  if (cfgInlcude) {
@@ -1288,15 +1386,11 @@ class FilterPlugin extends BasePlugin {
1288
1386
  }
1289
1387
  }
1290
1388
  if (config.collection) {
1291
- this.filterCollection = reduce(config.collection, (result, item, prop) => {
1292
- if (this.filterFunctionsIndexedByType[item.type]) {
1293
- result[prop] = item;
1294
- }
1295
- else {
1296
- console.warn(`${item.type} type is not found.`);
1297
- }
1298
- return result;
1299
- }, {});
1389
+ const filtersWithFilterFunctionPresent = Object.entries(config.collection).filter(([, item]) => this.filterFunctionsIndexedByType[item.type]);
1390
+ this.filterCollection = Object.fromEntries(filtersWithFilterFunctionPresent);
1391
+ }
1392
+ else {
1393
+ this.filterCollection = {};
1300
1394
  }
1301
1395
  if (config.localization) {
1302
1396
  if (config.localization.filterNames) {
@@ -1309,18 +1403,12 @@ class FilterPlugin extends BasePlugin {
1309
1403
  }
1310
1404
  }
1311
1405
  async headerclick(e) {
1312
- var _a, _b, _c;
1406
+ var _a, _b;
1313
1407
  const el = (_a = e.detail.originalEvent) === null || _a === void 0 ? void 0 : _a.target;
1314
1408
  if (!isFilterBtn(el)) {
1315
1409
  return;
1316
1410
  }
1317
1411
  e.preventDefault();
1318
- // close if same
1319
- const changes = await ((_b = this.pop) === null || _b === void 0 ? void 0 : _b.getChanges());
1320
- if (changes && (changes === null || changes === void 0 ? void 0 : changes.prop) === e.detail.prop) {
1321
- (_c = this.pop) === null || _c === void 0 ? void 0 : _c.show();
1322
- return;
1323
- }
1324
1412
  if (!this.pop) {
1325
1413
  return;
1326
1414
  }
@@ -1328,7 +1416,9 @@ class FilterPlugin extends BasePlugin {
1328
1416
  const gridPos = this.revogrid.getBoundingClientRect();
1329
1417
  const buttonPos = el.getBoundingClientRect();
1330
1418
  const prop = e.detail.prop;
1331
- 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) }));
1419
+ 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 });
1420
+ (_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
1421
+ this.pop.show(data);
1332
1422
  }
1333
1423
  getColumnFilter(type) {
1334
1424
  let filterType = 'string';
@@ -1412,7 +1502,11 @@ class FilterPlugin extends BasePlugin {
1412
1502
  }
1413
1503
  // applies the hasFilter to the columns to show filter icon
1414
1504
  this.providers.column.updateColumns(columnsToUpdate);
1415
- this.emit('afterfilterapply');
1505
+ this.emit('afterfilterapply', {
1506
+ multiFilterItems: filterItems,
1507
+ source,
1508
+ collection,
1509
+ });
1416
1510
  }
1417
1511
  async clearFiltering() {
1418
1512
  this.multiFilterItems = {};
@@ -1427,7 +1521,6 @@ class FilterPlugin extends BasePlugin {
1427
1521
  if (multiFilterItems[prop].length > 0) {
1428
1522
  const firstFilterItem = multiFilterItems[prop][0];
1429
1523
  collection[prop] = {
1430
- filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
1431
1524
  type: firstFilterItem.type,
1432
1525
  value: firstFilterItem.value,
1433
1526
  };
@@ -1454,67 +1547,83 @@ class FilterPlugin extends BasePlugin {
1454
1547
  getRowFilter(rows, filterItems, columnByProp) {
1455
1548
  const propKeys = Object.keys(filterItems);
1456
1549
  const trimmed = {};
1457
- let propFilterSatisfiedCount = 0;
1458
- let lastFilterResults = [];
1459
1550
  // each rows
1460
- rows.forEach((model, rowIndex) => {
1551
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
1461
1552
  // check filter by column properties
1462
1553
  for (const prop of propKeys) {
1463
- const propFilters = filterItems[prop];
1464
- // reset the count of satisfied filters
1465
- propFilterSatisfiedCount = 0;
1554
+ // add to the list of removed/trimmed rows of filter condition is satisfied
1555
+ if (this.shouldTrimRow(filterItems[prop], prop, columnByProp[prop], rows[rowIndex])) {
1556
+ trimmed[rowIndex] = true;
1557
+ }
1558
+ } // end of for-of propKeys
1559
+ }
1560
+ return trimmed;
1561
+ }
1562
+ shouldTrimRow(propFilters, prop, column, model = {}) {
1563
+ // reset the count of satisfied filters
1564
+ let propFilterSatisfiedCount = 0;
1565
+ // reset the array of last filter results
1566
+ let lastFilterResults = [];
1567
+ // testing each filter for a prop
1568
+ for (const [filterIndex, filterData] of propFilters.entries()) {
1569
+ // the filter LogicFunction based on the type
1570
+ const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
1571
+ // THE MAGIC OF FILTERING IS HERE
1572
+ // If there is no column but user wants to filter by a property
1573
+ const value = column ? getCellDataParsed(model, column) : model[prop];
1574
+ // OR relation
1575
+ if (filterData.relation === 'or') {
1466
1576
  // reset the array of last filter results
1467
1577
  lastFilterResults = [];
1468
- // testing each filter for a prop
1469
- for (const [filterIndex, filterData] of propFilters.entries()) {
1470
- // the filter LogicFunction based on the type
1471
- const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
1472
- // THE MAGIC OF FILTERING IS HERE
1473
- const column = columnByProp[prop];
1474
- // If there is no column but user wants to filter by a property
1475
- const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];
1476
- // OR relation
1477
- if (filterData.relation === 'or') {
1578
+ // if the filter is satisfied, continue to the next filter
1579
+ if (filterFunc(value, filterData.value)) {
1580
+ continue;
1581
+ }
1582
+ // if the filter is not satisfied, count it
1583
+ propFilterSatisfiedCount++;
1584
+ // AND relation
1585
+ }
1586
+ else {
1587
+ // 'and' relation will need to know the next filter
1588
+ // so we save this current filter to include it in the next filter
1589
+ lastFilterResults.push(!filterFunc(value, filterData.value));
1590
+ if (isFinalAndFilter(filterIndex, propFilters)) {
1591
+ // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1592
+ if (allAndConditionsSatisfied(lastFilterResults)) {
1478
1593
  // reset the array of last filter results
1479
1594
  lastFilterResults = [];
1480
- // if the filter is satisfied, continue to the next filter
1481
- if (filterFunc(value, filterData.value)) {
1482
- continue;
1483
- }
1484
- // if the filter is not satisfied, count it
1485
- propFilterSatisfiedCount++;
1486
- // AND relation
1487
- }
1488
- else {
1489
- // 'and' relation will need to know the next filter
1490
- // so we save this current filter to include it in the next filter
1491
- lastFilterResults.push(!filterFunc(value, filterData.value));
1492
- // check first if we have a filter on the next index to pair it with this current filter
1493
- const nextFilterData = propFilters[filterIndex + 1];
1494
- // stop the sequence if there is no next filter or if the next filter is not an 'and' relation
1495
- if (!nextFilterData || nextFilterData.relation !== 'and') {
1496
- // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1497
- if (lastFilterResults.indexOf(true) === -1) {
1498
- // reset the array of last filter results
1499
- lastFilterResults = [];
1500
- continue;
1501
- }
1502
- // we need to add all of the lastFilterResults since we need to satisfy all
1503
- propFilterSatisfiedCount += lastFilterResults.length;
1504
- // reset the array of last filter results
1505
- lastFilterResults = [];
1506
- }
1595
+ continue;
1507
1596
  }
1508
- } // end of propFilters forEach
1509
- // add to the list of removed/trimmed rows of filter condition is satisfied
1510
- if (propFilterSatisfiedCount === propFilters.length) {
1511
- trimmed[rowIndex] = true;
1597
+ // we need to add all of the lastFilterResults since we need to satisfy all
1598
+ propFilterSatisfiedCount += lastFilterResults.length;
1599
+ // reset the array of last filter results
1600
+ lastFilterResults = [];
1512
1601
  }
1513
- } // end of for-of propKeys
1514
- });
1515
- return trimmed;
1602
+ }
1603
+ } // end of propFilters forEach
1604
+ return propFilterSatisfiedCount === propFilters.length;
1516
1605
  }
1517
1606
  }
1607
+ /**
1608
+ * Checks if the current filter is the final one in an AND sequence.
1609
+ * @param index - Current filter index in the list.
1610
+ * @param filters - Array of filters for the property.
1611
+ * @returns True if this is the last AND condition; false otherwise.
1612
+ */
1613
+ function isFinalAndFilter(index, filters) {
1614
+ const nextFilter = filters[index + 1]; // Get the next filter in the list.
1615
+ // Return true if there's no next filter or if the next filter defined and is not part of the AND sequence.
1616
+ return !nextFilter || (!!nextFilter.relation && nextFilter.relation !== 'and');
1617
+ }
1618
+ /**
1619
+ * Determines if all conditions in an AND sequence are satisfied.
1620
+ * @param pendingResults - An array of results from the AND conditions.
1621
+ * @returns True if all conditions are satisfied; false otherwise.
1622
+ */
1623
+ function allAndConditionsSatisfied(pendingResults) {
1624
+ // Check if there are any failed conditions in the pending results.
1625
+ return !pendingResults.includes(true);
1626
+ }
1518
1627
 
1519
1628
  // provide collapse data
1520
1629
  function doCollapse(pIndex, source) {
@@ -1635,852 +1744,880 @@ function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLe
1635
1744
  return trimemedOptionsToUpgrade;
1636
1745
  }
1637
1746
 
1638
- class GroupingRowPlugin extends BasePlugin {
1639
- get hasProps() {
1640
- var _a, _b, _c;
1641
- return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) && ((_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.length);
1642
- }
1643
- get store() {
1644
- return this.providers.data.stores[GROUPING_ROW_TYPE].store;
1645
- }
1646
- // proxy for items get
1647
- get rowItems() {
1648
- return this.store.get('items');
1649
- }
1650
- get trimmed() {
1651
- return this.store.get('trimmed');
1652
- }
1653
- constructor(revogrid, providers) {
1654
- super(revogrid, providers);
1655
- this.revogrid = revogrid;
1656
- this.providers = providers;
1657
- }
1658
- // befoce cell focus
1659
- onFocus(e) {
1660
- if (isGrouping(e.detail.model)) {
1661
- e.preventDefault();
1662
- }
1663
- }
1664
- // expand event triggered
1665
- onExpand({ virtualIndex }) {
1666
- const { source } = this.getSource();
1667
- let newTrimmed = this.trimmed[TRIMMED_GROUPING];
1668
- let i = getPhysical(this.store, virtualIndex);
1669
- const model = source[i];
1670
- const prevExpanded = model[GROUP_EXPANDED];
1671
- if (!prevExpanded) {
1672
- const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);
1673
- newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
1674
- if (items) {
1675
- setItems(this.store, items);
1676
- }
1677
- }
1678
- else {
1679
- const { trimmed } = doCollapse(i, source);
1680
- newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
1681
- this.revogrid.clearFocus();
1682
- }
1683
- this.store.set('source', source);
1684
- this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
1685
- }
1686
- // get source based on proxy item collection to preserve rgRow order
1687
- getSource(withoutGrouping = false) {
1688
- const source = this.store.get('source');
1689
- const items = this.store.get('proxyItems');
1690
- let index = 0;
1691
- // order important here, expected parent is first, then others
1692
- return items.reduce((result, i) => {
1693
- const model = source[i];
1694
- if (!withoutGrouping) {
1695
- result.source.push(model);
1696
- return result;
1697
- }
1698
- // grouping filter
1699
- if (isGrouping(model)) {
1700
- if (model[GROUP_EXPANDED]) {
1701
- result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
1702
- }
1703
- }
1704
- else {
1705
- result.source.push(model);
1706
- result.oldNewIndexes[i] = index;
1707
- index++;
1708
- }
1709
- return result;
1710
- }, {
1711
- source: [],
1712
- prevExpanded: {},
1713
- oldNewIndexes: {},
1714
- });
1715
- }
1716
- setColumnGrouping(cols) {
1717
- // if 0 column as holder
1718
- if (cols === null || cols === void 0 ? void 0 : cols.length) {
1719
- cols[0][PSEUDO_GROUP_COLUMN] = true;
1720
- return true;
1721
- }
1722
- return false;
1723
- }
1724
- setColumns({ columns }) {
1725
- for (let type of columnTypes) {
1726
- if (this.setColumnGrouping(columns[type])) {
1727
- break;
1728
- }
1729
- }
1730
- }
1731
- // evaluate drag between groups
1732
- onDrag(e) {
1733
- const { from, to } = e.detail;
1734
- const isDown = to - from >= 0;
1735
- const { source } = this.getSource();
1736
- const items = this.rowItems;
1737
- let i = isDown ? from : to;
1738
- const end = isDown ? to : from;
1739
- for (; i < end; i++) {
1740
- const model = source[items[i]];
1741
- const isGroup = isGrouping(model);
1742
- if (isGroup) {
1743
- e.preventDefault();
1744
- return;
1745
- }
1746
- }
1747
- }
1748
- beforeTrimmedApply(trimmed, type) {
1749
- /** Before filter apply remove grouping filtering */
1750
- if (type === FILTER_TRIMMED_TYPE) {
1751
- const source = this.store.get('source');
1752
- for (let index in trimmed) {
1753
- if (trimmed[index] && isGrouping(source[index])) {
1754
- trimmed[index] = false;
1755
- }
1756
- }
1757
- }
1758
- }
1759
- // subscribe to grid events to process them accordingly
1760
- subscribe() {
1761
- /** if grouping present and new data source arrived */
1762
- this.addEventListener('beforesourceset', ({ detail }) => this.onDataSet(detail));
1763
- this.addEventListener('beforecolumnsset', ({ detail }) => this.setColumns(detail));
1764
- /**
1765
- * filter applied need to clear grouping and apply again
1766
- * based on new results can be new grouping
1767
- */
1768
- this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
1769
- /**
1770
- * sorting applied need to clear grouping and apply again
1771
- * based on new results whole grouping order will changed
1772
- */
1773
- this.addEventListener('aftersortingapply', () => this.doSourceUpdate(Object.assign({}, this.options)));
1774
- /**
1775
- * Apply logic for focus inside of grouping
1776
- * We can't focus on grouping rows, navigation only inside of groups for now
1777
- */
1778
- this.addEventListener('beforecellfocus', e => this.onFocus(e));
1779
- /**
1780
- * Prevent rgRow drag outside the group
1781
- */
1782
- this.addEventListener('roworderchanged', e => this.onDrag(e));
1783
- /**
1784
- * When grouping expand icon was clicked
1785
- */
1786
- this.addEventListener(GROUP_EXPAND_EVENT, ({ detail }) => this.onExpand(detail));
1787
- }
1788
- /**
1789
- * Starts global source update with group clearing and applying new one
1790
- * Initiated when need to reapply grouping
1791
- */
1792
- doSourceUpdate(options) {
1793
- var _a;
1794
- if (!this.hasProps) {
1795
- return;
1796
- }
1797
- /**
1798
- * Get source without grouping
1799
- * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
1800
- */
1801
- const { source, prevExpanded, oldNewIndexes } = this.getSource(true);
1802
- /**
1803
- * Group again
1804
- * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
1805
- */
1806
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({ prevExpanded }, options));
1807
- // setup source
1808
- this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
1809
- this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
1810
- }
1811
- /**
1812
- * Apply grouping on data set
1813
- * Clear grouping from source
1814
- * If source came from other plugin
1815
- */
1816
- onDataSet(data) {
1817
- var _a;
1818
- if (!this.hasProps || !(data === null || data === void 0 ? void 0 : data.source) || !data.source.length) {
1819
- return;
1820
- }
1821
- const source = data.source.filter(s => !isGrouping(s));
1822
- const expanded = this.revogrid.grouping || {};
1823
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({}, (expanded || {})));
1824
- data.source = sourceWithGroups;
1825
- this.providers.data.setGrouping({ depth });
1826
- this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
1827
- }
1828
- // apply grouping
1829
- setGrouping(options) {
1830
- // unsubscribe from all events when group applied
1831
- this.clearSubscriptions();
1832
- this.options = options;
1833
- // clear props, no grouping exists
1834
- if (!options.props || !Object.keys(options.props).length) {
1835
- this.clearGrouping();
1836
- return;
1837
- }
1838
- // props exist and source inited
1839
- const { source } = this.getSource();
1840
- if (source.length) {
1841
- this.doSourceUpdate(Object.assign({}, options));
1842
- }
1843
- // props exist and columns inited
1844
- for (let t of columnTypes) {
1845
- if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
1846
- this.providers.column.refreshByType(t);
1847
- break;
1747
+ /** `Object#toString` result references. */
1748
+ var stringTag = '[object String]';
1749
+
1750
+ /**
1751
+ * Checks if `value` is classified as a `String` primitive or object.
1752
+ *
1753
+ * @static
1754
+ * @since 0.1.0
1755
+ * @memberOf _
1756
+ * @category Lang
1757
+ * @param {*} value The value to check.
1758
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
1759
+ * @example
1760
+ *
1761
+ * _.isString('abc');
1762
+ * // => true
1763
+ *
1764
+ * _.isString(1);
1765
+ * // => false
1766
+ */
1767
+ function isString(value) {
1768
+ return typeof value == 'string' ||
1769
+ (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
1770
+ }
1771
+
1772
+ /**
1773
+ * Gets the size of an ASCII `string`.
1774
+ *
1775
+ * @private
1776
+ * @param {string} string The string inspect.
1777
+ * @returns {number} Returns the string size.
1778
+ */
1779
+ var asciiSize = baseProperty('length');
1780
+
1781
+ const asciiSize$1 = asciiSize;
1782
+
1783
+ /** Used to compose unicode character classes. */
1784
+ var rsAstralRange$1 = '\\ud800-\\udfff',
1785
+ rsComboMarksRange$1 = '\\u0300-\\u036f',
1786
+ reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
1787
+ rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
1788
+ rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
1789
+ rsVarRange$1 = '\\ufe0e\\ufe0f';
1790
+
1791
+ /** Used to compose unicode capture groups. */
1792
+ var rsZWJ$1 = '\\u200d';
1793
+
1794
+ /** 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/). */
1795
+ var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
1796
+
1797
+ /**
1798
+ * Checks if `string` contains Unicode symbols.
1799
+ *
1800
+ * @private
1801
+ * @param {string} string The string to inspect.
1802
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
1803
+ */
1804
+ function hasUnicode(string) {
1805
+ return reHasUnicode.test(string);
1806
+ }
1807
+
1808
+ /** Used to compose unicode character classes. */
1809
+ var rsAstralRange = '\\ud800-\\udfff',
1810
+ rsComboMarksRange = '\\u0300-\\u036f',
1811
+ reComboHalfMarksRange = '\\ufe20-\\ufe2f',
1812
+ rsComboSymbolsRange = '\\u20d0-\\u20ff',
1813
+ rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
1814
+ rsVarRange = '\\ufe0e\\ufe0f';
1815
+
1816
+ /** Used to compose unicode capture groups. */
1817
+ var rsAstral = '[' + rsAstralRange + ']',
1818
+ rsCombo = '[' + rsComboRange + ']',
1819
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
1820
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
1821
+ rsNonAstral = '[^' + rsAstralRange + ']',
1822
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
1823
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
1824
+ rsZWJ = '\\u200d';
1825
+
1826
+ /** Used to compose unicode regexes. */
1827
+ var reOptMod = rsModifier + '?',
1828
+ rsOptVar = '[' + rsVarRange + ']?',
1829
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
1830
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
1831
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
1832
+
1833
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
1834
+ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
1835
+
1836
+ /**
1837
+ * Gets the size of a Unicode `string`.
1838
+ *
1839
+ * @private
1840
+ * @param {string} string The string inspect.
1841
+ * @returns {number} Returns the string size.
1842
+ */
1843
+ function unicodeSize(string) {
1844
+ var result = reUnicode.lastIndex = 0;
1845
+ while (reUnicode.test(string)) {
1846
+ ++result;
1847
+ }
1848
+ return result;
1849
+ }
1850
+
1851
+ /**
1852
+ * Gets the number of symbols in `string`.
1853
+ *
1854
+ * @private
1855
+ * @param {string} string The string to inspect.
1856
+ * @returns {number} Returns the string size.
1857
+ */
1858
+ function stringSize(string) {
1859
+ return hasUnicode(string)
1860
+ ? unicodeSize(string)
1861
+ : asciiSize$1(string);
1862
+ }
1863
+
1864
+ /** `Object#toString` result references. */
1865
+ var mapTag = '[object Map]',
1866
+ setTag = '[object Set]';
1867
+
1868
+ /**
1869
+ * Gets the size of `collection` by returning its length for array-like
1870
+ * values or the number of own enumerable string keyed properties for objects.
1871
+ *
1872
+ * @static
1873
+ * @memberOf _
1874
+ * @since 0.1.0
1875
+ * @category Collection
1876
+ * @param {Array|Object|string} collection The collection to inspect.
1877
+ * @returns {number} Returns the collection size.
1878
+ * @example
1879
+ *
1880
+ * _.size([1, 2, 3]);
1881
+ * // => 3
1882
+ *
1883
+ * _.size({ 'a': 1, 'b': 2 });
1884
+ * // => 2
1885
+ *
1886
+ * _.size('pebbles');
1887
+ * // => 7
1888
+ */
1889
+ function size(collection) {
1890
+ if (collection == null) {
1891
+ return 0;
1892
+ }
1893
+ if (isArrayLike(collection)) {
1894
+ return isString(collection) ? stringSize(collection) : collection.length;
1895
+ }
1896
+ var tag = getTag(collection);
1897
+ if (tag == mapTag || tag == setTag) {
1898
+ return collection.size;
1899
+ }
1900
+ return baseKeys(collection).length;
1901
+ }
1902
+
1903
+ function sortIndexByItems(indexes, source, sortingFunc = {}) {
1904
+ // if no sorting - return unsorted indexes
1905
+ if (Object.entries(sortingFunc).length === 0) {
1906
+ // Unsorted indexes
1907
+ return [...Array(indexes.length).keys()];
1908
+ }
1909
+ //
1910
+ /**
1911
+ * go through all indexes and align in new order
1912
+ * performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.
1913
+ */
1914
+ return indexes.sort((a, b) => {
1915
+ const itemA = source[a];
1916
+ const itemB = source[b];
1917
+ for (const [prop, cmp] of Object.entries(sortingFunc)) {
1918
+ if (isGrouping(itemA)) {
1919
+ if (itemA['__rvgr-prop'] !== prop) {
1920
+ return 0;
1921
+ }
1922
+ }
1923
+ if (isGrouping(itemB)) {
1924
+ if (itemB['__rvgr-prop'] !== prop) {
1925
+ return 0;
1926
+ }
1927
+ }
1928
+ /**
1929
+ * 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.
1930
+ * 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.
1931
+ */
1932
+ const sorted = cmp === null || cmp === void 0 ? void 0 : cmp(prop, itemA, itemB);
1933
+ if (sorted) {
1934
+ return sorted;
1848
1935
  }
1849
1936
  }
1850
- // if has any grouping subscribe to events again
1851
- this.subscribe();
1937
+ return 0;
1938
+ });
1939
+ }
1940
+
1941
+ /**
1942
+ * Lifecycle
1943
+ * 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.
1944
+ * 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.
1945
+ * 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
1946
+ * 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.
1947
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
1948
+ *
1949
+ * Note: If you prevent an event, it will not proceed to the subsequent steps.
1950
+ */
1951
+ class SortingPlugin extends BasePlugin {
1952
+ runSorting(order, comparison, ignoreViewportUpdate) {
1953
+ var _a;
1954
+ this.sort(order, comparison, undefined, ignoreViewportUpdate);
1955
+ (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
1956
+ this.sortingPromise = null;
1852
1957
  }
1853
- // clear grouping
1854
- clearGrouping() {
1855
- // clear columns
1856
- columnTypes.forEach(t => {
1857
- const cols = this.providers.column.getColumns(t);
1858
- let deleted = false;
1859
- cols.forEach(c => {
1860
- if (isGroupingColumn(c)) {
1861
- delete c[PSEUDO_GROUP_COLUMN];
1862
- deleted = true;
1958
+ constructor(revogrid, providers, config) {
1959
+ super(revogrid, providers);
1960
+ this.revogrid = revogrid;
1961
+ this.sortingPromise = null;
1962
+ this.postponeSort = debounce((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
1963
+ const setConfig = (cfg) => {
1964
+ var _a;
1965
+ if (cfg) {
1966
+ const sortingFunc = {};
1967
+ const order = {};
1968
+ (_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
1969
+ sortingFunc[col.prop] = this.getComparer(col, col.order);
1970
+ order[col.prop] = col.order;
1971
+ });
1972
+ // // set sorting
1973
+ this.sorting = order;
1974
+ this.sortingFunc = sortingFunc;
1975
+ }
1976
+ };
1977
+ setConfig(config);
1978
+ this.addEventListener('sortingconfigchanged', ({ detail }) => {
1979
+ config = detail;
1980
+ setConfig(detail);
1981
+ this.startSorting(this.sorting, this.sortingFunc);
1982
+ });
1983
+ this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
1984
+ // if sorting was provided - sort data
1985
+ if (!!this.sorting && this.sortingFunc) {
1986
+ const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
1987
+ if (event.defaultPrevented) {
1988
+ return;
1863
1989
  }
1864
- });
1865
- // if column store had grouping clear and refresh
1866
- if (deleted) {
1867
- this.providers.column.refreshByType(t);
1990
+ this.startSorting(this.sorting, this.sortingFunc);
1868
1991
  }
1869
1992
  });
1870
- // clear rows
1871
- const { source, oldNewIndexes } = this.getSource(true);
1872
- this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
1873
- this.updateTrimmed(undefined, undefined, oldNewIndexes);
1993
+ this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
1994
+ // if config provided - do nothing, read from config
1995
+ if (config) {
1996
+ return;
1997
+ }
1998
+ const columns = this.providers.column.getColumns();
1999
+ const sortingFunc = {};
2000
+ for (let prop in order) {
2001
+ const cmp = this.getComparer(getColumnByProp(columns, prop), order[prop]);
2002
+ sortingFunc[prop] = cmp;
2003
+ }
2004
+ // set sorting
2005
+ this.sorting = order;
2006
+ this.sortingFunc = order && sortingFunc;
2007
+ });
2008
+ this.addEventListener('beforeheaderclick', (e) => {
2009
+ var _a, _b, _c, _d;
2010
+ if (e.defaultPrevented) {
2011
+ return;
2012
+ }
2013
+ if (!((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.sortable)) {
2014
+ return;
2015
+ }
2016
+ 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);
2017
+ });
1874
2018
  }
1875
- updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap = {}, secondLevelMap) {
1876
- // map previously trimmed data
1877
- const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.trimmed, firstLevelMap, secondLevelMap);
1878
- for (let type in trimemedOptionsToUpgrade) {
1879
- this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
2019
+ startSorting(order, sortingFunc, ignoreViewportUpdate) {
2020
+ if (!this.sortingPromise) {
2021
+ // add job before render
2022
+ this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
2023
+ this.sortingPromise = resolve;
2024
+ }));
2025
+ }
2026
+ this.postponeSort(order, sortingFunc, ignoreViewportUpdate);
2027
+ }
2028
+ getComparer(column, order) {
2029
+ var _a, _b;
2030
+ 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 }));
2031
+ if (order == 'asc') {
2032
+ return cellCmp;
2033
+ }
2034
+ if (order == 'desc') {
2035
+ return this.descCellCompare(cellCmp);
2036
+ }
2037
+ return undefined;
2038
+ }
2039
+ /**
2040
+ * Apply sorting to data on header click
2041
+ * If additive - add to existing sorting, multiple columns can be sorted
2042
+ */
2043
+ headerclick(column, index, additive) {
2044
+ var _a, _b;
2045
+ let order = this.getNextOrder(column.order);
2046
+ const beforeEvent = this.emit('beforesorting', { column, order, additive });
2047
+ if (beforeEvent.defaultPrevented) {
2048
+ return;
2049
+ }
2050
+ order = beforeEvent.detail.order;
2051
+ const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
2052
+ // apply sort data
2053
+ const beforeApplyEvent = this.emit('beforesortingapply', {
2054
+ column: newCol,
2055
+ order,
2056
+ additive,
2057
+ });
2058
+ if (beforeApplyEvent.defaultPrevented) {
2059
+ return;
2060
+ }
2061
+ const cmp = this.getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
2062
+ if (beforeApplyEvent.detail.additive && this.sorting) {
2063
+ const sorting = {};
2064
+ const sortingFunc = {};
2065
+ this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
2066
+ // extend sorting function with new sorting for multiple columns sorting
2067
+ this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
2068
+ if (column.prop in sorting && size(sorting) > 1 && order === undefined) {
2069
+ delete sorting[column.prop];
2070
+ delete sortingFunc[column.prop];
2071
+ }
2072
+ else {
2073
+ sorting[column.prop] = order;
2074
+ sortingFunc[column.prop] = cmp;
2075
+ }
2076
+ }
2077
+ else {
2078
+ if (order) {
2079
+ // reset sorting
2080
+ this.sorting = { [column.prop]: order };
2081
+ this.sortingFunc = { [column.prop]: cmp };
2082
+ }
2083
+ else {
2084
+ (_a = this.sorting) === null || _a === void 0 ? true : delete _a[column.prop];
2085
+ (_b = this.sortingFunc) === null || _b === void 0 ? true : delete _b[column.prop];
2086
+ }
1880
2087
  }
1881
- // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
1882
- // setup trimmed data for grouping
1883
- this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
1884
- }
1885
- }
1886
-
1887
- const COLUMN_DRAG_CLASS = 'column-drag-start';
1888
- class ColumnOrderHandler {
1889
- constructor() {
1890
- this.offset = 0;
2088
+ this.startSorting(this.sorting, this.sortingFunc);
1891
2089
  }
1892
- renderAutoscroll(_, parent) {
1893
- if (!parent) {
1894
- return;
2090
+ /**
2091
+ * Sort items by sorting function
2092
+ * @requires proxyItems applied to row store
2093
+ * @requires source applied to row store
2094
+ *
2095
+ * @param sorting - per column sorting
2096
+ * @param data - this.stores['rgRow'].store.get('source')
2097
+ */
2098
+ sort(sorting, sortingFunc, types = rowTypes, ignoreViewportUpdate = false) {
2099
+ // if no sorting - reset
2100
+ if (!Object.keys(sorting || {}).length) {
2101
+ for (let type of types) {
2102
+ const storeService = this.providers.data.stores[type];
2103
+ // row data
2104
+ const source = storeService.store.get('source');
2105
+ // row indexes
2106
+ const proxyItems = storeService.store.get('proxyItems');
2107
+ // row indexes
2108
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2109
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2110
+ storeService.setData({ proxyItems: newItemsOrder, source: [...source], });
2111
+ }
1895
2112
  }
1896
- this.autoscrollEl = document.createElement('div');
1897
- this.autoscrollEl.classList.add('drag-auto-scroll-y');
1898
- parent.appendChild(this.autoscrollEl);
1899
- }
1900
- autoscroll(pos, dataContainerSize, direction = 'translateX') {
1901
- if (!this.autoscrollEl) {
1902
- return;
2113
+ else {
2114
+ for (let type of types) {
2115
+ const storeService = this.providers.data.stores[type];
2116
+ // row data
2117
+ const source = storeService.store.get('source');
2118
+ // row indexes
2119
+ const proxyItems = storeService.store.get('proxyItems');
2120
+ const newItemsOrder = sortIndexByItems([...proxyItems], source, sortingFunc);
2121
+ // take row indexes before trim applied and proxy items
2122
+ const prevItems = storeService.store.get('items');
2123
+ storeService.setData({
2124
+ proxyItems: newItemsOrder,
2125
+ source: [...source],
2126
+ });
2127
+ // take currently visible row indexes
2128
+ const newItems = storeService.store.get('items');
2129
+ if (!ignoreViewportUpdate) {
2130
+ this.providers.dimension
2131
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2132
+ }
2133
+ }
1903
2134
  }
1904
- const helperOffset = 10;
1905
- // calculate current y position inside of the grid active holder
1906
- // 3 - size of element + border
1907
- const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);
1908
- this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;
1909
- this.autoscrollEl.scrollIntoView({
1910
- block: 'nearest',
1911
- inline: 'nearest',
1912
- });
2135
+ this.emit('aftersortingapply');
1913
2136
  }
1914
- start(e, { dataEl, gridRect, scrollEl, gridEl }, dir = 'left') {
1915
- gridEl.classList.add(COLUMN_DRAG_CLASS);
1916
- const scrollContainerRect = scrollEl.getBoundingClientRect();
1917
- if (scrollContainerRect) {
1918
- this.offset = scrollContainerRect[dir] - gridRect[dir];
1919
- }
1920
- this.renderAutoscroll(e, dataEl);
2137
+ defaultCellCompare(prop, a, b) {
2138
+ const aRaw = this.column ? getCellRaw(a, this.column) : a === null || a === void 0 ? void 0 : a[prop];
2139
+ const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
2140
+ const av = aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
2141
+ const bv = bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
2142
+ return av == bv ? 0 : av > bv ? 1 : -1;
1921
2143
  }
1922
- stop(gridEl) {
1923
- var _a;
1924
- gridEl.classList.remove(COLUMN_DRAG_CLASS);
1925
- if (this.element) {
1926
- this.element.hidden = true;
1927
- }
1928
- this.offset = 0;
1929
- (_a = this.autoscrollEl) === null || _a === void 0 ? void 0 : _a.remove();
1930
- this.autoscrollEl = undefined;
2144
+ descCellCompare(cmp) {
2145
+ return (prop, a, b) => {
2146
+ return -1 * cmp(prop, a, b);
2147
+ };
1931
2148
  }
1932
- showHandler(pos, size, direction = 'translateX') {
1933
- if (!this.element) {
1934
- return;
1935
- }
1936
- // do not allow overcross top of the scrollable area, header excluded
1937
- if (this.offset) {
1938
- pos = Math.max(pos, this.offset);
2149
+ getNextOrder(currentOrder) {
2150
+ switch (currentOrder) {
2151
+ case undefined:
2152
+ return 'asc';
2153
+ case 'asc':
2154
+ return 'desc';
2155
+ case 'desc':
2156
+ return undefined;
1939
2157
  }
1940
- // can not be bigger then grid end
1941
- pos = Math.min(pos, size);
1942
- this.element.style.transform = `${direction}(${pos}px)`;
1943
- this.element.hidden = false;
1944
- }
1945
- render() {
1946
- const el = this.element = document.createElement('div');
1947
- el.classList.add('drag-position-y');
1948
- el.hidden = true;
1949
- return el;
1950
2158
  }
1951
2159
  }
1952
2160
 
1953
- /**
1954
- * Plugin for column manual move
1955
- */
1956
- const COLUMN_CLICK = ON_COLUMN_CLICK;
1957
- const MOVE = 'columndragmousemove';
1958
- const DRAG_END = 'columndragend';
1959
- const BEFORE_DRAG_END = 'beforecolumndragend';
1960
- // use this event subscription to drop D&D for particular columns
1961
- const DRAG_START = 'columndragstart';
1962
- class ColumnPlugin extends BasePlugin {
2161
+ class GroupingRowPlugin extends BasePlugin {
2162
+ getStore(type = GROUPING_ROW_TYPE) {
2163
+ return this.providers.data.stores[type].store;
2164
+ }
1963
2165
  constructor(revogrid, providers) {
1964
2166
  super(revogrid, providers);
1965
2167
  this.revogrid = revogrid;
1966
2168
  this.providers = providers;
1967
- this.moveFunc = debounce((e) => this.doMove(e), 5);
1968
- this.staticDragData = null;
1969
- this.dragData = null;
1970
- this.localSubscriptions = {};
1971
- this.orderUi = new ColumnOrderHandler();
1972
- revogrid.appendChild(this.orderUi.render());
1973
- revogrid.classList.add('column-draggable');
1974
- // Register events
1975
- this.localSubscriptions['mouseleave'] = {
1976
- target: document,
1977
- callback: (e) => this.onMouseOut(e),
1978
- };
1979
- this.localSubscriptions['mouseup'] = {
1980
- target: document,
1981
- callback: (e) => this.onMouseUp(e),
1982
- };
1983
- this.localSubscriptions['mousemove'] = {
1984
- target: document,
1985
- callback: (e) => this.move(e),
1986
- };
1987
- this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
1988
2169
  }
1989
- dragStart({ event, data }) {
1990
- if (event.defaultPrevented) {
1991
- return;
1992
- }
1993
- const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);
1994
- // check if allowed to drag particulat column
1995
- if (defaultPrevented) {
1996
- return;
2170
+ // befoce cell focus
2171
+ onFocus(e) {
2172
+ if (isGrouping(e.detail.model)) {
2173
+ e.preventDefault();
1997
2174
  }
1998
- this.clearOrder();
1999
- const { mouseleave, mouseup, mousemove } = this.localSubscriptions;
2000
- mouseleave.target.addEventListener('mouseleave', mouseleave.callback);
2001
- mouseup.target.addEventListener('mouseup', mouseup.callback);
2002
- const dataEl = event.target.closest('revogr-header');
2003
- const scrollEl = event.target.closest('revogr-viewport-scroll');
2004
- if (!dataEl || !scrollEl) {
2005
- return;
2175
+ }
2176
+ // expand event triggered
2177
+ onExpand({ virtualIndex }) {
2178
+ const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2179
+ let newTrimmed = this.getStore().get('trimmed')[TRIMMED_GROUPING];
2180
+ let i = getPhysical(this.getStore(), virtualIndex);
2181
+ const isExpanded = getExpanded(source[i]);
2182
+ if (!isExpanded) {
2183
+ const { trimmed, items } = doExpand(virtualIndex, source, this.getStore().get('items'));
2184
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2185
+ if (items) {
2186
+ setItems(this.getStore(), items);
2187
+ }
2006
2188
  }
2007
- // no grouping drag and no row header column drag
2008
- if (isColGrouping(data) || data.providers.type === 'rowHeaders') {
2009
- return;
2189
+ else {
2190
+ const { trimmed } = doCollapse(i, source);
2191
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2192
+ this.revogrid.clearFocus();
2010
2193
  }
2011
- const cols = this.getDimension(data.pin || 'rgCol');
2012
- const gridRect = this.revogrid.getBoundingClientRect();
2013
- const elRect = dataEl.getBoundingClientRect();
2014
- const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
2015
- this.staticDragData = {
2016
- startPos: event.x,
2017
- startItem,
2018
- data,
2019
- dataEl,
2020
- scrollEl,
2021
- gridEl: this.revogrid,
2022
- cols,
2023
- };
2024
- this.dragData = this.getData(this.staticDragData);
2025
- mousemove.target.addEventListener('mousemove', mousemove.callback);
2026
- this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
2194
+ this.getStore().set('source', source);
2195
+ this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
2027
2196
  }
2028
- doMove(e) {
2029
- if (!this.staticDragData) {
2030
- return;
2197
+ setColumnGrouping(cols) {
2198
+ // if 0 column as holder
2199
+ if (cols === null || cols === void 0 ? void 0 : cols.length) {
2200
+ cols[0][PSEUDO_GROUP_COLUMN] = true;
2201
+ return true;
2031
2202
  }
2032
- const dragData = (this.dragData = this.getData(this.staticDragData));
2033
- if (!dragData) {
2034
- return;
2203
+ return false;
2204
+ }
2205
+ setColumns({ columns }) {
2206
+ for (let type of columnTypes) {
2207
+ if (this.setColumnGrouping(columns[type])) {
2208
+ break;
2209
+ }
2035
2210
  }
2036
- const start = this.staticDragData.startPos;
2037
- if (Math.abs(start - e.x) > 10) {
2038
- const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2039
- const rgCol = getItemByPosition(this.staticDragData.cols, x);
2040
- this.orderUi.autoscroll(x, dragData.elRect.width);
2041
- this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
2211
+ }
2212
+ // evaluate drag between groups
2213
+ onDrag(e) {
2214
+ const { from, to } = e.detail;
2215
+ const isDown = to - from >= 0;
2216
+ const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2217
+ const items = this.getStore().get('items');
2218
+ let i = isDown ? from : to;
2219
+ const end = isDown ? to : from;
2220
+ for (; i < end; i++) {
2221
+ const model = source[items[i]];
2222
+ const isGroup = isGrouping(model);
2223
+ if (isGroup) {
2224
+ e.preventDefault();
2225
+ return;
2226
+ }
2042
2227
  }
2043
2228
  }
2044
- move(e) {
2045
- dispatch(this.revogrid, MOVE, e);
2046
- // then do move
2047
- this.moveFunc(e);
2229
+ beforeTrimmedApply(trimmed, type) {
2230
+ /** Before filter apply remove grouping filtering */
2231
+ if (type === FILTER_TRIMMED_TYPE) {
2232
+ const source = this.getStore().get('source');
2233
+ for (let index in trimmed) {
2234
+ if (trimmed[index] && isGrouping(source[index])) {
2235
+ trimmed[index] = false;
2236
+ }
2237
+ }
2238
+ }
2048
2239
  }
2049
- onMouseOut(_) {
2050
- this.clearOrder();
2240
+ isSortingRunning() {
2241
+ const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
2242
+ return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
2051
2243
  }
2052
- onMouseUp(e) {
2053
- // apply new positions
2054
- if (this.dragData && this.staticDragData) {
2055
- let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2056
- if (relativePos < 0) {
2057
- relativePos = 0;
2244
+ // subscribe to grid events to process them accordingly
2245
+ subscribe() {
2246
+ /** if grouping present and new data source arrived */
2247
+ this.addEventListener('beforesourceset', ({ detail }) => {
2248
+ var _a, _b, _c;
2249
+ 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))) {
2250
+ return;
2251
+ }
2252
+ // if sorting is running don't apply grouping, wait for sorting, then it'll apply in @aftersortingapply
2253
+ if (this.isSortingRunning()) {
2254
+ return;
2058
2255
  }
2059
- const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
2060
- const store = this.providers.column.stores[this.dragData.type].store;
2061
- const items = [...store.get('items')];
2062
- // prevent position change if needed
2063
- const { defaultPrevented: stopDrag } = 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]] }));
2064
- if (!stopDrag) {
2065
- // todo: if move item out of group remove item from group
2066
- const toMove = items.splice(this.staticDragData.startItem.itemIndex, 1);
2067
- items.splice(newPosition.itemIndex, 0, ...toMove);
2068
- store.set('items', items);
2256
+ this.onDataSet(detail);
2257
+ });
2258
+ this.addEventListener('beforecolumnsset', ({ detail }) => {
2259
+ this.setColumns(detail);
2260
+ });
2261
+ /**
2262
+ * filter applied need to clear grouping and apply again
2263
+ * based on new results can be new grouping
2264
+ */
2265
+ this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
2266
+ /**
2267
+ * sorting applied need to clear grouping and apply again
2268
+ * based on new results whole grouping order will changed
2269
+ */
2270
+ this.addEventListener('aftersortingapply', () => {
2271
+ var _a, _b;
2272
+ if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
2273
+ return;
2069
2274
  }
2070
- dispatch(this.revogrid, DRAG_END, this.dragData);
2071
- }
2072
- this.clearOrder();
2073
- }
2074
- clearLocalSubscriptions() {
2075
- forEach(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));
2275
+ this.doSourceUpdate(Object.assign({}, this.options));
2276
+ });
2277
+ /**
2278
+ * Apply logic for focus inside of grouping
2279
+ * We can't focus on grouping rows, navigation only inside of groups for now
2280
+ */
2281
+ this.addEventListener('beforecellfocus', e => this.onFocus(e));
2282
+ /**
2283
+ * Prevent rgRow drag outside the group
2284
+ */
2285
+ this.addEventListener('roworderchanged', e => this.onDrag(e));
2286
+ /**
2287
+ * When grouping expand icon was clicked
2288
+ */
2289
+ this.addEventListener('groupexpandclick', e => this.onExpand(e.detail));
2076
2290
  }
2077
- clearOrder() {
2078
- this.staticDragData = null;
2079
- this.dragData = null;
2080
- this.clearLocalSubscriptions();
2081
- this.orderUi.stop(this.revogrid);
2291
+ /**
2292
+ * Starts global source update with group clearing and applying new one
2293
+ * Initiated when need to reapply grouping
2294
+ */
2295
+ doSourceUpdate(options) {
2296
+ var _a;
2297
+ /**
2298
+ * Get source without grouping
2299
+ * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
2300
+ */
2301
+ const { source, prevExpanded, oldNewIndexes } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2302
+ const expanded = Object.assign({ prevExpanded }, options);
2303
+ /**
2304
+ * Group again
2305
+ * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
2306
+ */
2307
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], expanded);
2308
+ const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
2309
+ // setup source
2310
+ this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
2311
+ this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
2082
2312
  }
2083
2313
  /**
2084
- * Clearing subscription
2314
+ * Apply grouping on data set
2315
+ * Clear grouping from source
2316
+ * If source came from other plugin
2085
2317
  */
2086
- clearSubscriptions() {
2087
- super.clearSubscriptions();
2088
- this.clearLocalSubscriptions();
2318
+ onDataSet(data) {
2319
+ var _a, _b;
2320
+ let preservedExpanded = {};
2321
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.preserveGroupingOnUpdate) !== false) {
2322
+ let { prevExpanded } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2323
+ preservedExpanded = prevExpanded;
2324
+ }
2325
+ const source = data.source.filter(s => !isGrouping(s));
2326
+ const options = Object.assign(Object.assign({}, (this.revogrid.grouping || {})), { prevExpanded: preservedExpanded });
2327
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
2328
+ data.source = sourceWithGroups;
2329
+ this.providers.data.setGrouping({ depth });
2330
+ this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
2089
2331
  }
2090
- getData({ gridEl, dataEl, data, }) {
2091
- const gridRect = gridEl.getBoundingClientRect();
2092
- const elRect = dataEl.getBoundingClientRect();
2093
- const scrollOffset = elRect.left - gridRect.left;
2094
- return {
2095
- elRect,
2096
- gridRect,
2097
- type: data.pin || 'rgCol',
2098
- scrollOffset,
2099
- };
2332
+ /**
2333
+ * Externam call to apply grouping. Called by revogrid when prop changed.
2334
+ */
2335
+ setGrouping(options) {
2336
+ var _a, _b;
2337
+ // unsubscribe from all events when group applied
2338
+ this.clearSubscriptions();
2339
+ this.options = options;
2340
+ // clear props, no grouping exists
2341
+ if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
2342
+ this.clearGrouping();
2343
+ return;
2344
+ }
2345
+ // props exist and source inited
2346
+ const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2347
+ if (source.length) {
2348
+ this.doSourceUpdate(Object.assign({}, options));
2349
+ }
2350
+ // props exist and columns inited
2351
+ for (let t of columnTypes) {
2352
+ if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
2353
+ this.providers.column.refreshByType(t);
2354
+ break;
2355
+ }
2356
+ }
2357
+ // if has any grouping subscribe to events again
2358
+ this.subscribe();
2100
2359
  }
2101
- getDimension(type) {
2102
- return this.providers.dimension.stores[type].getCurrentState();
2360
+ // clear grouping
2361
+ clearGrouping() {
2362
+ // clear columns
2363
+ columnTypes.forEach(t => {
2364
+ const cols = this.providers.column.getColumns(t);
2365
+ let deleted = false;
2366
+ cols.forEach(c => {
2367
+ if (isGroupingColumn(c)) {
2368
+ delete c[PSEUDO_GROUP_COLUMN];
2369
+ deleted = true;
2370
+ }
2371
+ });
2372
+ // if column store had grouping clear and refresh
2373
+ if (deleted) {
2374
+ this.providers.column.refreshByType(t);
2375
+ }
2376
+ });
2377
+ // clear rows
2378
+ const { source, oldNewIndexes } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2379
+ this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2380
+ this.updateTrimmed(undefined, undefined, oldNewIndexes);
2381
+ }
2382
+ updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap = {}, secondLevelMap) {
2383
+ // map previously trimmed data
2384
+ const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
2385
+ for (let type in trimemedOptionsToUpgrade) {
2386
+ this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
2387
+ }
2388
+ // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
2389
+ // setup trimmed data for grouping
2390
+ this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
2103
2391
  }
2104
2392
  }
2105
- function getLeftRelative(absoluteX, gridPos, offset) {
2106
- return absoluteX - gridPos - offset;
2107
- }
2108
-
2109
- /** `Object#toString` result references. */
2110
- var stringTag = '[object String]';
2111
-
2112
- /**
2113
- * Checks if `value` is classified as a `String` primitive or object.
2114
- *
2115
- * @static
2116
- * @since 0.1.0
2117
- * @memberOf _
2118
- * @category Lang
2119
- * @param {*} value The value to check.
2120
- * @returns {boolean} Returns `true` if `value` is a string, else `false`.
2121
- * @example
2122
- *
2123
- * _.isString('abc');
2124
- * // => true
2125
- *
2126
- * _.isString(1);
2127
- * // => false
2128
- */
2129
- function isString(value) {
2130
- return typeof value == 'string' ||
2131
- (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
2132
- }
2133
-
2134
- /**
2135
- * Gets the size of an ASCII `string`.
2136
- *
2137
- * @private
2138
- * @param {string} string The string inspect.
2139
- * @returns {number} Returns the string size.
2140
- */
2141
- var asciiSize = baseProperty('length');
2142
-
2143
- const asciiSize$1 = asciiSize;
2144
-
2145
- /** Used to compose unicode character classes. */
2146
- var rsAstralRange$1 = '\\ud800-\\udfff',
2147
- rsComboMarksRange$1 = '\\u0300-\\u036f',
2148
- reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
2149
- rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
2150
- rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
2151
- rsVarRange$1 = '\\ufe0e\\ufe0f';
2152
-
2153
- /** Used to compose unicode capture groups. */
2154
- var rsZWJ$1 = '\\u200d';
2155
-
2156
- /** 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/). */
2157
- var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
2158
-
2159
- /**
2160
- * Checks if `string` contains Unicode symbols.
2161
- *
2162
- * @private
2163
- * @param {string} string The string to inspect.
2164
- * @returns {boolean} Returns `true` if a symbol is found, else `false`.
2165
- */
2166
- function hasUnicode(string) {
2167
- return reHasUnicode.test(string);
2168
- }
2169
-
2170
- /** Used to compose unicode character classes. */
2171
- var rsAstralRange = '\\ud800-\\udfff',
2172
- rsComboMarksRange = '\\u0300-\\u036f',
2173
- reComboHalfMarksRange = '\\ufe20-\\ufe2f',
2174
- rsComboSymbolsRange = '\\u20d0-\\u20ff',
2175
- rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
2176
- rsVarRange = '\\ufe0e\\ufe0f';
2177
-
2178
- /** Used to compose unicode capture groups. */
2179
- var rsAstral = '[' + rsAstralRange + ']',
2180
- rsCombo = '[' + rsComboRange + ']',
2181
- rsFitz = '\\ud83c[\\udffb-\\udfff]',
2182
- rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
2183
- rsNonAstral = '[^' + rsAstralRange + ']',
2184
- rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
2185
- rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
2186
- rsZWJ = '\\u200d';
2187
-
2188
- /** Used to compose unicode regexes. */
2189
- var reOptMod = rsModifier + '?',
2190
- rsOptVar = '[' + rsVarRange + ']?',
2191
- rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
2192
- rsSeq = rsOptVar + reOptMod + rsOptJoin,
2193
- rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
2194
-
2195
- /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
2196
- var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
2197
-
2198
- /**
2199
- * Gets the size of a Unicode `string`.
2200
- *
2201
- * @private
2202
- * @param {string} string The string inspect.
2203
- * @returns {number} Returns the string size.
2204
- */
2205
- function unicodeSize(string) {
2206
- var result = reUnicode.lastIndex = 0;
2207
- while (reUnicode.test(string)) {
2208
- ++result;
2209
- }
2210
- return result;
2211
- }
2212
-
2213
- /**
2214
- * Gets the number of symbols in `string`.
2215
- *
2216
- * @private
2217
- * @param {string} string The string to inspect.
2218
- * @returns {number} Returns the string size.
2219
- */
2220
- function stringSize(string) {
2221
- return hasUnicode(string)
2222
- ? unicodeSize(string)
2223
- : asciiSize$1(string);
2224
- }
2225
-
2226
- /** `Object#toString` result references. */
2227
- var mapTag = '[object Map]',
2228
- setTag = '[object Set]';
2229
2393
 
2230
- /**
2231
- * Gets the size of `collection` by returning its length for array-like
2232
- * values or the number of own enumerable string keyed properties for objects.
2233
- *
2234
- * @static
2235
- * @memberOf _
2236
- * @since 0.1.0
2237
- * @category Collection
2238
- * @param {Array|Object|string} collection The collection to inspect.
2239
- * @returns {number} Returns the collection size.
2240
- * @example
2241
- *
2242
- * _.size([1, 2, 3]);
2243
- * // => 3
2244
- *
2245
- * _.size({ 'a': 1, 'b': 2 });
2246
- * // => 2
2247
- *
2248
- * _.size('pebbles');
2249
- * // => 7
2250
- */
2251
- function size(collection) {
2252
- if (collection == null) {
2253
- return 0;
2254
- }
2255
- if (isArrayLike(collection)) {
2256
- return isString(collection) ? stringSize(collection) : collection.length;
2257
- }
2258
- var tag = getTag(collection);
2259
- if (tag == mapTag || tag == setTag) {
2260
- return collection.size;
2261
- }
2262
- return baseKeys(collection).length;
2394
+ const COLUMN_DRAG_CLASS = 'column-drag-start';
2395
+ class ColumnOrderHandler {
2396
+ constructor() {
2397
+ this.offset = 0;
2398
+ }
2399
+ renderAutoscroll(_, parent) {
2400
+ if (!parent) {
2401
+ return;
2402
+ }
2403
+ this.autoscrollEl = document.createElement('div');
2404
+ this.autoscrollEl.classList.add('drag-auto-scroll-y');
2405
+ parent.appendChild(this.autoscrollEl);
2406
+ }
2407
+ autoscroll(pos, dataContainerSize, direction = 'translateX') {
2408
+ if (!this.autoscrollEl) {
2409
+ return;
2410
+ }
2411
+ const helperOffset = 10;
2412
+ // calculate current y position inside of the grid active holder
2413
+ // 3 - size of element + border
2414
+ const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);
2415
+ this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;
2416
+ this.autoscrollEl.scrollIntoView({
2417
+ block: 'nearest',
2418
+ inline: 'nearest',
2419
+ });
2420
+ }
2421
+ start(e, { dataEl, gridRect, scrollEl, gridEl }, dir = 'left') {
2422
+ gridEl.classList.add(COLUMN_DRAG_CLASS);
2423
+ const scrollContainerRect = scrollEl.getBoundingClientRect();
2424
+ if (scrollContainerRect) {
2425
+ this.offset = scrollContainerRect[dir] - gridRect[dir];
2426
+ }
2427
+ this.renderAutoscroll(e, dataEl);
2428
+ }
2429
+ stop(gridEl) {
2430
+ var _a;
2431
+ gridEl.classList.remove(COLUMN_DRAG_CLASS);
2432
+ if (this.element) {
2433
+ this.element.hidden = true;
2434
+ }
2435
+ this.offset = 0;
2436
+ (_a = this.autoscrollEl) === null || _a === void 0 ? void 0 : _a.remove();
2437
+ this.autoscrollEl = undefined;
2438
+ }
2439
+ showHandler(pos, size, direction = 'translateX') {
2440
+ if (!this.element) {
2441
+ return;
2442
+ }
2443
+ // do not allow overcross top of the scrollable area, header excluded
2444
+ if (this.offset) {
2445
+ pos = Math.max(pos, this.offset);
2446
+ }
2447
+ // can not be bigger then grid end
2448
+ pos = Math.min(pos, size);
2449
+ this.element.style.transform = `${direction}(${pos}px)`;
2450
+ this.element.hidden = false;
2451
+ }
2452
+ render() {
2453
+ const el = this.element = document.createElement('div');
2454
+ el.classList.add('drag-position-y');
2455
+ el.hidden = true;
2456
+ return el;
2457
+ }
2263
2458
  }
2264
2459
 
2265
2460
  /**
2266
- * Lifecycle
2267
- * 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.
2268
- * 2. @method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
2269
- * 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.
2270
- * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
2271
- *
2272
- * Note: If you prevent an event, it will not proceed to the subsequent steps.
2461
+ * Plugin for column manual move
2273
2462
  */
2274
- class SortingPlugin extends BasePlugin {
2275
- runSorting(order, comparison) {
2276
- var _a;
2277
- this.sort(order, comparison);
2278
- (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
2279
- this.sortingPromise = null;
2280
- }
2463
+ const COLUMN_CLICK = ON_COLUMN_CLICK;
2464
+ const MOVE = 'columndragmousemove';
2465
+ const DRAG_END = 'columndragend';
2466
+ const BEFORE_DRAG_END = 'beforecolumndragend';
2467
+ // use this event subscription to drop D&D for particular columns
2468
+ const DRAG_START = 'columndragstart';
2469
+ class ColumnMovePlugin extends BasePlugin {
2281
2470
  constructor(revogrid, providers) {
2282
2471
  super(revogrid, providers);
2283
2472
  this.revogrid = revogrid;
2284
- this.sortingPromise = null;
2285
- this.postponeSort = debounce((order, comparison) => this.runSorting(order, comparison), 50);
2286
- const beforeanysource = ({ detail: { type }, }) => {
2287
- // if sorting was provided - sort data
2288
- if (!!this.sorting && this.sortingFunc) {
2289
- const beforeEvent = this.emit('beforesorting', { type });
2290
- if (beforeEvent.defaultPrevented) {
2291
- return;
2292
- }
2293
- this.startSorting(this.sorting, this.sortingFunc);
2294
- }
2473
+ this.providers = providers;
2474
+ this.moveFunc = debounce((e) => this.doMove(e), 5);
2475
+ this.staticDragData = null;
2476
+ this.dragData = null;
2477
+ this.localSubscriptions = {};
2478
+ this.orderUi = new ColumnOrderHandler();
2479
+ revogrid.appendChild(this.orderUi.render());
2480
+ revogrid.classList.add('column-draggable');
2481
+ // Register events
2482
+ this.localSubscriptions['mouseleave'] = {
2483
+ target: document,
2484
+ callback: (e) => this.onMouseOut(e),
2295
2485
  };
2296
- const aftercolumnsset = ({ detail: { order }, }) => {
2297
- const columns = this.providers.column.getColumns();
2298
- const sortingFunc = {};
2299
- for (let prop in order) {
2300
- const cmp = this.getComparer(getColumnByProp(columns, prop), order[prop]);
2301
- sortingFunc[prop] = cmp;
2302
- }
2303
- this.runSorting(order, sortingFunc);
2486
+ this.localSubscriptions['mouseup'] = {
2487
+ target: document,
2488
+ callback: (e) => this.onMouseUp(e),
2304
2489
  };
2305
- const headerclick = (e) => {
2306
- var _a, _b;
2307
- if (e.defaultPrevented) {
2308
- return;
2309
- }
2310
- if (!e.detail.column.sortable) {
2311
- return;
2312
- }
2313
- this.headerclick(e.detail.column, e.detail.index, (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.originalEvent) === null || _b === void 0 ? void 0 : _b.shiftKey);
2490
+ this.localSubscriptions['mousemove'] = {
2491
+ target: document,
2492
+ callback: (e) => this.move(e),
2314
2493
  };
2315
- this.addEventListener('beforeanysource', beforeanysource);
2316
- this.addEventListener('aftercolumnsset', aftercolumnsset);
2317
- this.addEventListener('beforeheaderclick', headerclick);
2494
+ this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
2318
2495
  }
2319
- startSorting(order, sortingFunc) {
2320
- if (!this.sortingPromise) {
2321
- this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
2322
- this.sortingPromise = resolve;
2323
- }));
2496
+ dragStart({ event, data }) {
2497
+ if (event.defaultPrevented) {
2498
+ return;
2324
2499
  }
2325
- this.postponeSort(order, sortingFunc);
2326
- }
2327
- getComparer(column, order) {
2328
- var _a;
2329
- const cellCmp = ((_a = column === null || column === void 0 ? void 0 : column.cellCompare) === null || _a === void 0 ? void 0 : _a.bind({ order })) || this.defaultCellCompare;
2330
- if (order == 'asc') {
2331
- return cellCmp;
2500
+ const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);
2501
+ // check if allowed to drag particulat column
2502
+ if (defaultPrevented) {
2503
+ return;
2332
2504
  }
2333
- if (order == 'desc') {
2334
- return this.descCellCompare(cellCmp);
2505
+ this.clearOrder();
2506
+ const { mouseleave, mouseup, mousemove } = this.localSubscriptions;
2507
+ mouseleave.target.addEventListener('mouseleave', mouseleave.callback);
2508
+ mouseup.target.addEventListener('mouseup', mouseup.callback);
2509
+ const dataEl = event.target.closest('revogr-header');
2510
+ const scrollEl = event.target.closest('revogr-viewport-scroll');
2511
+ if (!dataEl || !scrollEl) {
2512
+ return;
2335
2513
  }
2336
- return undefined;
2337
- }
2338
- /**
2339
- * Apply sorting to data on header click
2340
- * If additive - add to existing sorting, multiple columns can be sorted
2341
- */
2342
- headerclick(column, index, additive) {
2343
- var _a, _b;
2344
- let order = this.getNextOrder(column.order);
2345
- const beforeEvent = this.emit('beforesorting', { column, order, additive });
2346
- if (beforeEvent.defaultPrevented) {
2514
+ // no grouping drag and no row header column drag
2515
+ if (isColGrouping(data) || data.providers.type === 'rowHeaders') {
2347
2516
  return;
2348
2517
  }
2349
- order = beforeEvent.detail.order;
2350
- const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
2351
- // apply sort data
2352
- const beforeApplyEvent = this.emit('beforesortingapply', {
2353
- column: newCol,
2354
- order,
2355
- additive,
2356
- });
2357
- if (beforeApplyEvent.defaultPrevented) {
2518
+ const cols = this.getDimension(data.pin || 'rgCol');
2519
+ const gridRect = this.revogrid.getBoundingClientRect();
2520
+ const elRect = dataEl.getBoundingClientRect();
2521
+ const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
2522
+ this.staticDragData = {
2523
+ startPos: event.x,
2524
+ startItem,
2525
+ data,
2526
+ dataEl,
2527
+ scrollEl,
2528
+ gridEl: this.revogrid,
2529
+ cols,
2530
+ };
2531
+ this.dragData = this.getData(this.staticDragData);
2532
+ mousemove.target.addEventListener('mousemove', mousemove.callback);
2533
+ this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
2534
+ }
2535
+ doMove(e) {
2536
+ if (!this.staticDragData) {
2358
2537
  return;
2359
2538
  }
2360
- order = beforeApplyEvent.detail.order;
2361
- const cmp = this.getComparer(column, order);
2362
- if (additive && this.sorting) {
2363
- const sorting = {};
2364
- const sortingFunc = {};
2365
- this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
2366
- // extend sorting function with new sorting for multiple columns sorting
2367
- this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
2368
- if (column.prop in sorting && size(sorting) > 1 && order === undefined) {
2369
- delete sorting[column.prop];
2370
- delete sortingFunc[column.prop];
2371
- }
2372
- else {
2373
- sorting[column.prop] = order;
2374
- sortingFunc[column.prop] = cmp;
2375
- }
2539
+ const dragData = (this.dragData = this.getData(this.staticDragData));
2540
+ if (!dragData) {
2541
+ return;
2376
2542
  }
2377
- else {
2378
- if (order) {
2379
- // reset sorting
2380
- this.sorting = { [column.prop]: order };
2381
- this.sortingFunc = { [column.prop]: cmp };
2382
- }
2383
- else {
2384
- (_a = this.sorting) === null || _a === void 0 ? true : delete _a[column.prop];
2385
- (_b = this.sortingFunc) === null || _b === void 0 ? true : delete _b[column.prop];
2543
+ const start = this.staticDragData.startPos;
2544
+ if (Math.abs(start - e.x) > 10) {
2545
+ const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2546
+ const rgCol = getItemByPosition(this.staticDragData.cols, x);
2547
+ this.orderUi.autoscroll(x, dragData.elRect.width);
2548
+ // prevent position change if out of bounds
2549
+ if (rgCol.itemIndex >= this.staticDragData.cols.count) {
2550
+ return;
2386
2551
  }
2552
+ this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
2387
2553
  }
2388
- this.startSorting(this.sorting, this.sortingFunc);
2389
2554
  }
2390
- /**
2391
- * Sort items by sorting function
2392
- * @requires proxyItems applied to row store
2393
- * @requires source applied to row store
2394
- *
2395
- * @param sorting - per column sorting
2396
- * @param data - this.stores['rgRow'].store.get('source')
2397
- */
2398
- sort(sorting, sortingFunc, types = rowTypes) {
2399
- // if no sorting - reset
2400
- if (!size(sorting)) {
2401
- this.sorting = undefined;
2402
- this.sortingFunc = undefined;
2403
- for (let type of types) {
2404
- const storeService = this.providers.data.stores[type];
2405
- // row data
2406
- const source = storeService.store.get('source');
2407
- // row indexes
2408
- const proxyItems = storeService.store.get('proxyItems');
2409
- // row indexes
2410
- const newItemsOrder = storeService.store.get('items'); // recover indexes range(0, source.length)
2411
- this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2412
- storeService.setData({ proxyItems: newItemsOrder, source: [...source] });
2555
+ move(e) {
2556
+ dispatch(this.revogrid, MOVE, e);
2557
+ // then do move
2558
+ this.moveFunc(e);
2559
+ }
2560
+ onMouseOut(_) {
2561
+ this.clearOrder();
2562
+ }
2563
+ onMouseUp(e) {
2564
+ // apply new positions
2565
+ if (this.dragData && this.staticDragData) {
2566
+ let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2567
+ if (relativePos < 0) {
2568
+ relativePos = 0;
2413
2569
  }
2414
- }
2415
- else {
2416
- // set sorting
2417
- this.sorting = sorting;
2418
- this.sortingFunc = sortingFunc;
2419
- for (let type of types) {
2420
- const storeService = this.providers.data.stores[type];
2421
- // row data
2422
- const source = storeService.store.get('source');
2423
- // row indexes
2424
- const proxyItems = storeService.store.get('proxyItems');
2425
- const newItemsOrder = this.sortIndexByItems([...proxyItems], source, sortingFunc);
2426
- this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2427
- storeService.setData({
2428
- proxyItems: newItemsOrder,
2429
- source: [...source],
2430
- });
2570
+ const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
2571
+ const store = this.providers.column.stores[this.dragData.type].store;
2572
+ const newItems = [...store.get('items')];
2573
+ // prevent position change if needed
2574
+ const { defaultPrevented: stopDrag } = 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]] }));
2575
+ if (!stopDrag) {
2576
+ const prevItems = [...newItems];
2577
+ // todo: if move item out of group remove item from group
2578
+ const toMove = newItems.splice(this.staticDragData.startItem.itemIndex, 1);
2579
+ newItems.splice(newPosition.itemIndex, 0, ...toMove);
2580
+ store.set('items', newItems);
2581
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
2431
2582
  }
2583
+ dispatch(this.revogrid, DRAG_END, this.dragData);
2432
2584
  }
2433
- this.emit('aftersortingapply');
2585
+ this.clearOrder();
2434
2586
  }
2435
- defaultCellCompare(prop, a, b) {
2436
- var _a, _b;
2437
- const av = (_a = a === null || a === void 0 ? void 0 : a[prop]) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
2438
- const bv = (_b = b === null || b === void 0 ? void 0 : b[prop]) === null || _b === void 0 ? void 0 : _b.toString().toLowerCase();
2439
- return av == bv ? 0 : av > bv ? 1 : -1;
2587
+ clearLocalSubscriptions() {
2588
+ forEach(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));
2440
2589
  }
2441
- descCellCompare(cmp) {
2442
- return (prop, a, b) => {
2443
- return -1 * cmp(prop, a, b);
2444
- };
2590
+ clearOrder() {
2591
+ this.staticDragData = null;
2592
+ this.dragData = null;
2593
+ this.clearLocalSubscriptions();
2594
+ this.orderUi.stop(this.revogrid);
2445
2595
  }
2446
- sortIndexByItems(indexes, source, sortingFunc = {}) {
2447
- // if no sorting - return unsorted indexes
2448
- if (Object.entries(sortingFunc).length === 0) {
2449
- // Unsorted indexes
2450
- return [...Array(indexes.length).keys()];
2451
- }
2452
- //
2453
- /**
2454
- * go through all indexes and align in new order
2455
- * performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.
2456
- */
2457
- return indexes.sort((a, b) => {
2458
- for (const [prop, cmp] of Object.entries(sortingFunc)) {
2459
- const itemA = source[a];
2460
- const itemB = source[b];
2461
- /**
2462
- * 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.
2463
- * 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.
2464
- */
2465
- const sorted = cmp === null || cmp === void 0 ? void 0 : cmp(prop, itemA, itemB);
2466
- if (sorted) {
2467
- return sorted;
2468
- }
2469
- }
2470
- return 0;
2471
- });
2596
+ /**
2597
+ * Clearing subscription
2598
+ */
2599
+ clearSubscriptions() {
2600
+ super.clearSubscriptions();
2601
+ this.clearLocalSubscriptions();
2472
2602
  }
2473
- getNextOrder(currentOrder) {
2474
- switch (currentOrder) {
2475
- case undefined:
2476
- return 'asc';
2477
- case 'asc':
2478
- return 'desc';
2479
- case 'desc':
2480
- return undefined;
2481
- }
2603
+ getData({ gridEl, dataEl, data, }) {
2604
+ const gridRect = gridEl.getBoundingClientRect();
2605
+ const elRect = dataEl.getBoundingClientRect();
2606
+ const scrollOffset = elRect.left - gridRect.left;
2607
+ return {
2608
+ elRect,
2609
+ gridRect,
2610
+ type: data.pin || 'rgCol',
2611
+ scrollOffset,
2612
+ };
2613
+ }
2614
+ getDimension(type) {
2615
+ return this.providers.dimension.stores[type].getCurrentState();
2482
2616
  }
2483
2617
  }
2618
+ function getLeftRelative(absoluteX, gridPos, offset) {
2619
+ return absoluteX - gridPos - offset;
2620
+ }
2484
2621
 
2485
2622
  class ColumnDataProvider {
2486
2623
  get order() {
@@ -2504,8 +2641,8 @@ class ColumnDataProvider {
2504
2641
  return sources;
2505
2642
  }, {});
2506
2643
  }
2507
- column(c, pin) {
2508
- return this.getColumn(c, pin || 'rgCol');
2644
+ column(c, type = 'rgCol') {
2645
+ return this.getColumn(c, type);
2509
2646
  }
2510
2647
  getColumn(virtualIndex, type) {
2511
2648
  return getSourceItem(this.dataSources[type].store, virtualIndex);
@@ -2537,6 +2674,9 @@ class ColumnDataProvider {
2537
2674
  refreshByType(type) {
2538
2675
  this.dataSources[type].refresh();
2539
2676
  }
2677
+ /**
2678
+ * Main method to set columns
2679
+ */
2540
2680
  setColumns(data) {
2541
2681
  columnTypes.forEach(k => {
2542
2682
  // set columns data
@@ -2631,6 +2771,8 @@ class ColumnDataProvider {
2631
2771
 
2632
2772
  /**
2633
2773
  * Data source provider
2774
+ *
2775
+ * @dependsOn DimensionProvider
2634
2776
  */
2635
2777
  class DataProvider {
2636
2778
  constructor(dimensionProvider) {
@@ -2653,13 +2795,22 @@ class DataProvider {
2653
2795
  return getSourceItem(store, virtualIndex);
2654
2796
  }
2655
2797
  changeOrder({ rowType = 'rgRow', from, to }) {
2656
- const service = this.stores[rowType];
2657
- const items = [...service.store.get('items')];
2658
- const prevItems = [...items];
2659
- const toMove = items.splice(from, 1);
2660
- items.splice(to, 0, ...toMove);
2661
- this.dimensionProvider.updateSizesPositionByNewDataIndexes(rowType, items, prevItems);
2662
- service.setData({ items });
2798
+ const storeService = this.stores[rowType];
2799
+ // take currently visible row indexes
2800
+ const newItemsOrder = [...storeService.store.get('proxyItems')];
2801
+ const prevItems = storeService.store.get('items');
2802
+ // take out
2803
+ const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
2804
+ 1);
2805
+ // insert before
2806
+ newItemsOrder.splice(newItemsOrder.indexOf(prevItems[to]), // get index in proxy
2807
+ 0, ...toMove);
2808
+ storeService.setData({
2809
+ proxyItems: newItemsOrder,
2810
+ });
2811
+ // take currently visible row indexes
2812
+ const newItems = storeService.store.get('items');
2813
+ this.dimensionProvider.updateSizesPositionByNewDataIndexes(rowType, newItems, prevItems);
2663
2814
  }
2664
2815
  setCellData({ type, rowIndex, prop, val }, mutate = true) {
2665
2816
  const model = this.getModel(rowIndex, type);
@@ -2705,6 +2856,8 @@ class DataProvider {
2705
2856
  /**
2706
2857
  * Dimension provider
2707
2858
  * Stores dimension information and custom sizes
2859
+ *
2860
+ * @dependsOn ViewportProvider
2708
2861
  */
2709
2862
  class DimensionProvider {
2710
2863
  constructor(viewports, config) {
@@ -2740,7 +2893,11 @@ class DimensionProvider {
2740
2893
  newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
2741
2894
  }
2742
2895
  this.stores[type].setDimensionSize(newSizes);
2743
- this.updateViewport(type, true);
2896
+ this.setViewPortCoordinate({
2897
+ coordinate: this.viewports.stores[type].lastCoordinate,
2898
+ type,
2899
+ force: true,
2900
+ });
2744
2901
  }
2745
2902
  setItemCount(realCount, type) {
2746
2903
  this.viewports.stores[type].setViewport({ realCount });
@@ -2755,10 +2912,14 @@ class DimensionProvider {
2755
2912
  const allTrimmed = gatherTrimmedItems(trimmed);
2756
2913
  const dimStoreType = this.stores[type];
2757
2914
  dimStoreType.setStore({ trimmed: allTrimmed });
2758
- this.updateViewport(type, true);
2915
+ this.setViewPortCoordinate({
2916
+ coordinate: this.viewports.stores[type].lastCoordinate,
2917
+ type,
2918
+ force: true,
2919
+ });
2759
2920
  }
2760
2921
  /**
2761
- * Sets dimension data and view port coordinate
2922
+ * Sets dimension data and viewport coordinate
2762
2923
  * @param itemCount
2763
2924
  * @param type - dimension type
2764
2925
  * @param noVirtual - disable virtual data
@@ -2772,18 +2933,23 @@ class DimensionProvider {
2772
2933
  virtualSize: dimension.realSize,
2773
2934
  });
2774
2935
  }
2775
- this.updateViewport(type);
2936
+ this.setViewPortCoordinate({
2937
+ coordinate: this.viewports.stores[type].lastCoordinate,
2938
+ type,
2939
+ });
2776
2940
  }
2777
2941
  /**
2778
2942
  * Applies new columns to the dimension provider
2779
2943
  * @param columns - new columns data
2780
2944
  * @param disableVirtualX - disable virtual data for X axis
2781
2945
  */
2782
- applyNewColumns(columns, disableVirtualX) {
2946
+ applyNewColumns(columns, disableVirtualX, keepOld = false) {
2783
2947
  // Apply new columns to dimension provider
2784
2948
  for (let type of columnTypes) {
2785
- // Clear existing data in the dimension provider
2786
- this.stores[type].drop();
2949
+ if (!keepOld) {
2950
+ // Clear existing data in the dimension provider
2951
+ this.stores[type].drop();
2952
+ }
2787
2953
  // Get the new columns for the current type
2788
2954
  const items = columns[type];
2789
2955
  // Determine if virtual data should be disabled for the current type
@@ -2810,6 +2976,10 @@ class DimensionProvider {
2810
2976
  });
2811
2977
  }
2812
2978
  }
2979
+ /**
2980
+ * Gets the full size of the grid by summing up the sizes of all dimensions
2981
+ * Goes through all dimensions columnTypes (x) and rowTypes (y) and sums up their sizes
2982
+ */
2813
2983
  getFullSize() {
2814
2984
  var _a, _b;
2815
2985
  let x = 0;
@@ -2822,13 +2992,6 @@ class DimensionProvider {
2822
2992
  }
2823
2993
  return { y, x };
2824
2994
  }
2825
- updateViewport(type, force = false) {
2826
- this.setViewPortCoordinate({
2827
- coordinate: this.viewports.stores[type].lastCoordinate,
2828
- type,
2829
- force,
2830
- });
2831
- }
2832
2995
  setViewPortCoordinate({ coordinate, type, force = false, }) {
2833
2996
  const dimension = this.stores[type].getCurrentState();
2834
2997
  this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
@@ -2854,25 +3017,12 @@ class DimensionProvider {
2854
3017
  }
2855
3018
  updateSizesPositionByNewDataIndexes(type, newItemsOrder, prevItemsOrder = []) {
2856
3019
  // Move custom sizes to new order
2857
- const dimService = this.stores[type];
2858
- const customSizes = Object.assign({}, dimService.store.get('sizes'));
2859
- if (Object.keys(customSizes).length) {
2860
- const originalIndices = new Map();
2861
- prevItemsOrder.forEach((value, index) => {
2862
- originalIndices.set(value, index);
2863
- });
2864
- const newSizes = {};
2865
- newItemsOrder.forEach((value, newIndex) => {
2866
- const originalIndex = originalIndices.get(value);
2867
- if (originalIndex !== newIndex && customSizes[originalIndex]) {
2868
- newSizes[newIndex] = customSizes[originalIndex];
2869
- delete customSizes[originalIndex];
2870
- }
2871
- });
2872
- if (Object.keys(newSizes).length) {
2873
- this.setCustomSizes(type, Object.assign(Object.assign({}, customSizes), newSizes));
2874
- }
2875
- }
3020
+ this.stores[type].updateSizesPositionByIndexes(newItemsOrder, prevItemsOrder);
3021
+ this.setViewPortCoordinate({
3022
+ coordinate: this.viewports.stores[type].lastCoordinate,
3023
+ type,
3024
+ force: true,
3025
+ });
2876
3026
  }
2877
3027
  }
2878
3028
 
@@ -2949,15 +3099,15 @@ class ViewportService {
2949
3099
  if (val === 'rgCol') {
2950
3100
  column.onResizeviewport = (e) => {
2951
3101
  var _a;
2952
- if (config.disableVirtualY && e.detail.dimension === 'rgRow') {
2953
- return;
2954
- }
2955
- else if (config.disableVirtualX && e.detail.dimension === 'rgCol') {
2956
- return;
3102
+ const vpState = {
3103
+ clientSize: e.detail.size,
3104
+ };
3105
+ // virtual size will be handled by dimension provider if disabled
3106
+ if ((e.detail.dimension === 'rgRow' && !config.disableVirtualY)
3107
+ || (e.detail.dimension === 'rgCol' && !config.disableVirtualX)) {
3108
+ vpState.virtualSize = e.detail.size;
2957
3109
  }
2958
- (_a = config.viewportProvider) === null || _a === void 0 ? void 0 : _a.setViewport(e.detail.dimension, {
2959
- virtualSize: e.detail.size,
2960
- });
3110
+ (_a = config.viewportProvider) === null || _a === void 0 ? void 0 : _a.setViewport(e.detail.dimension, vpState);
2961
3111
  };
2962
3112
  }
2963
3113
  const colData = gatherColumnData(column);
@@ -2969,7 +3119,7 @@ class ViewportService {
2969
3119
  segmentSelection.setLastCell(rgRow.lastCell);
2970
3120
  // register selection store for Row
2971
3121
  const rowSelectionStore = this.registerRow(rgRow.position.y, rgRow.type);
2972
- const rowDef = Object.assign(Object.assign({ colType: val }, rgRow), { rowSelectionStore, segmentSelectionStore: segmentSelection.store, ref: (e) => config.selectionStoreConnector.registerSection(e), onSetrange: e => {
3122
+ const rowDef = Object.assign(Object.assign({ colType: val }, rgRow), { rowSelectionStore, selectionStore: segmentSelection.store, ref: (e) => config.selectionStoreConnector.registerSection(e), onSetrange: e => {
2973
3123
  segmentSelection.setRangeArea(e.detail);
2974
3124
  }, onSettemprange: e => segmentSelection.setTempArea(e.detail), onFocuscell: e => {
2975
3125
  // todo: multi focus
@@ -3356,7 +3506,85 @@ class WCAGPlugin extends BasePlugin {
3356
3506
  }
3357
3507
  }
3358
3508
 
3359
- const revoGridStyleCss = ".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:32px;line-height:32px;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:30px;background:none;color:#000;box-shadow:none}revo-grid[theme=default],revo-grid:not([theme]){border:1px solid #cecece;font-size:12px}revo-grid[theme=default] revogr-header,revo-grid:not([theme]) revogr-header{text-align:center;line-height:30px;background-color:#f8f9fa}revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{box-shadow:none}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{text-transform:uppercase;font-size:12px;color:#000}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow{height:30px;box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell,revo-grid:not([theme]) revogr-header .rgHeaderCell{box-shadow:-1px 0 0 0 #cecece inset, 0 -1px 0 0 #cecece, 0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell.focused-cell,revo-grid:not([theme]) revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] .rowHeaders,revo-grid:not([theme]) .rowHeaders{background-color:#f8f9fa}revo-grid[theme=default] .rowHeaders revogr-data .rgCell,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell{color:#000}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:first-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:first-child{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:not(:first-child),revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:not(:first-child){box-shadow:0 -1px 0 0 #cecece inset, 1px 0 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:last-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:last-child{border-right:1px solid #cecece}revo-grid[theme=default] .rowHeaders revogr-data revogr-header,revo-grid:not([theme]) .rowHeaders revogr-data revogr-header{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #cecece inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinEnd,revo-grid[theme=default] revogr-viewport-scroll.colPinEnd revogr-header,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd revogr-header{box-shadow:1px 0 0 #cecece inset}revo-grid[theme=default] .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset, 0 -1px 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data,revo-grid:not([theme]) revogr-data{text-align:center}revo-grid[theme=default] revogr-data .revo-draggable,revo-grid:not([theme]) revogr-data .revo-draggable{float:left}revo-grid[theme=default] revogr-data .rgRow,revo-grid:not([theme]) revogr-data .rgRow{line-height:27px}revo-grid[theme=default] revogr-data .rgRow.focused-rgRow,revo-grid:not([theme]) revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] revogr-data .rgCell,revo-grid:not([theme]) revogr-data .rgCell{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data .rgCell.disabled,revo-grid:not([theme]) revogr-data .rgCell.disabled{background-color:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=material]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=material] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=material] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=material] revogr-header .header-rgRow{height:50px}revo-grid[theme=material] revogr-data{text-align:left}revo-grid[theme=material] revogr-data .rgRow{line-height:42px}revo-grid[theme=material] revogr-data .rgCell{padding:0 15px}revo-grid[theme=material] .rowHeaders{background-color:#f7faff}revo-grid[theme=material] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=material] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=material] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=material] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=material] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=material] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=darkMaterial]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkMaterial] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkMaterial] revogr-header .header-rgRow{height:50px}revo-grid[theme=darkMaterial] revogr-data{text-align:left}revo-grid[theme=darkMaterial] revogr-data .rgRow{line-height:42px}revo-grid[theme=darkMaterial] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkMaterial] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkMaterial] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkMaterial] revogr-edit{background-color:#28272b}revo-grid[theme=darkMaterial] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkMaterial] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkMaterial] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=darkCompact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkCompact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkCompact] revogr-header .header-rgRow{height:45px}revo-grid[theme=darkCompact] revogr-data{text-align:left}revo-grid[theme=darkCompact] revogr-data .rgRow{line-height:32px}revo-grid[theme=darkCompact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkCompact] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkCompact] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkCompact] revogr-edit{background-color:#28272b}revo-grid[theme=darkCompact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkCompact] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkCompact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=compact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=compact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=compact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=compact] revogr-header .header-rgRow{height:45px}revo-grid[theme=compact] revogr-data{text-align:left}revo-grid[theme=compact] revogr-data .rgRow{line-height:32px}revo-grid[theme=compact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=compact] .rowHeaders{background-color:#f7faff}revo-grid[theme=compact] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=compact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=compact] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=compact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=compact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=compact] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=compact] revo-dropdown .rv-dr-root{padding:0px 9px}revo-grid{display:block;height:100%;min-height:300px;font-family:Helvetica, Arial, Sans-Serif, serif;font-size:14px;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column;width:100%;height:100%}revo-grid .attribution{position:absolute;top:0;left:0;right:0;z-index:100;width:0;height:0;border-left:4px solid rgba(38, 106, 232, 0.6);border-top:4px solid rgba(38, 106, 232, 0.6);border-bottom:4px solid transparent;border-right:4px solid transparent;cursor:pointer}revo-grid .attribution .value{position:absolute;top:0;left:0;background-color:rgba(255, 255, 255, 0.9);padding:4px;border-radius:4px;box-shadow:0 1px 10px rgba(0, 0, 0, 0.2);white-space:nowrap;text-decoration:none;color:black;letter-spacing:0.3px;font-size:11px;opacity:0;width:4px;overflow:hidden;transition:opacity 0.5s ease-in-out, width 0.3s ease-in-out}revo-grid .attribution:hover .value{width:63px;opacity:1}revo-grid.column-draggable.column-drag-start:hover,revo-grid.column-draggable.column-drag-start *:hover{cursor:grabbing}revo-grid .footer-wrapper,revo-grid .header-wrapper{width:100%}revo-grid .footer-wrapper revogr-data,revo-grid .header-wrapper revogr-data{z-index:3}revo-grid revo-dropdown{width:100%}revo-grid revo-dropdown .rv-dr-root{max-height:100%}revo-grid revo-dropdown.shrink label{opacity:0}revo-grid .viewports{max-width:100%;display:flex;flex-direction:row;align-items:flex-start;flex-grow:1}revo-grid .main-viewport{flex-grow:1;height:0;display:flex;justify-content:space-between;flex-direction:row}revo-grid .draggable{position:fixed;height:30px;line-height:30px;background:#fff;border-radius:3px;display:block;z-index:100;margin-top:5px;margin-right:-20px;box-shadow:0 4px 20px 0 rgba(0, 0, 0, 0.15);padding-left:20px;padding-right:5px}revo-grid .draggable.hidden{display:none}revo-grid .draggable .revo-alt-icon{background-color:black;position:absolute;left:5px;top:10px}revo-grid .draggable-wrapper.hidden{display:none}revo-grid .drag-position{position:absolute;left:0;right:0;height:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-position-y{position:absolute;top:0;left:0;bottom:0;width:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-auto-scroll-y{pointer-events:none;position:absolute;left:0;top:0;height:50px;width:1px}revo-grid .clipboard{position:absolute;left:0;top:0}revo-grid revogr-scroll-virtual{position:relative}revo-grid revogr-scroll-virtual.vertical,revo-grid revogr-scroll-virtual.horizontal{z-index:3}";
3509
+ /**
3510
+ * Plugin service
3511
+ * Manages plugins
3512
+ */
3513
+ class PluginService {
3514
+ constructor() {
3515
+ /**
3516
+ * Plugins
3517
+ * Define plugins collection
3518
+ */
3519
+ this.internalPlugins = [];
3520
+ }
3521
+ /**
3522
+ * Get all plugins
3523
+ */
3524
+ get() {
3525
+ return [...this.internalPlugins];
3526
+ }
3527
+ /**
3528
+ * Add plugin to collection
3529
+ */
3530
+ add(plugin) {
3531
+ this.internalPlugins.push(plugin);
3532
+ }
3533
+ /**
3534
+ * Add user plugins and create
3535
+ */
3536
+ addUserPluginsAndCreate(element, plugins = [], prevPlugins, pluginData) {
3537
+ if (!pluginData) {
3538
+ return;
3539
+ }
3540
+ // Step 1: Identify plugins to remove, compare new and old plugins
3541
+ const pluginsToRemove = (prevPlugins === null || prevPlugins === void 0 ? void 0 : prevPlugins.filter(prevPlugin => !plugins.some(userPlugin => userPlugin === prevPlugin))) || [];
3542
+ // Step 2: Remove old plugins
3543
+ pluginsToRemove.forEach(plugin => {
3544
+ var _a, _b;
3545
+ const index = this.internalPlugins.findIndex(createdPlugin => createdPlugin instanceof plugin);
3546
+ if (index !== -1) {
3547
+ (_b = (_a = this.internalPlugins[index]).destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
3548
+ this.internalPlugins.splice(index, 1); // Remove the plugin
3549
+ }
3550
+ });
3551
+ // Step 3: Register user plugins
3552
+ plugins === null || plugins === void 0 ? void 0 : plugins.forEach(userPlugin => {
3553
+ // check if plugin already exists, if so, skip
3554
+ const existingPlugin = this.internalPlugins.find(createdPlugin => createdPlugin instanceof userPlugin);
3555
+ if (existingPlugin) {
3556
+ return;
3557
+ }
3558
+ this.add(new userPlugin(element, pluginData));
3559
+ });
3560
+ }
3561
+ /**
3562
+ * Get plugin by class
3563
+ */
3564
+ getByClass(pluginClass) {
3565
+ return this.internalPlugins.find(p => p instanceof pluginClass);
3566
+ }
3567
+ /**
3568
+ * Remove plugin
3569
+ */
3570
+ remove(plugin) {
3571
+ var _a, _b;
3572
+ const index = this.internalPlugins.indexOf(plugin);
3573
+ if (index > -1) {
3574
+ (_b = (_a = this.internalPlugins[index]).destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
3575
+ this.internalPlugins.splice(index, 1);
3576
+ }
3577
+ }
3578
+ /**
3579
+ * Remove all plugins
3580
+ */
3581
+ destroy() {
3582
+ this.internalPlugins.forEach(p => { var _a; return (_a = p.destroy) === null || _a === void 0 ? void 0 : _a.call(p); });
3583
+ this.internalPlugins = [];
3584
+ }
3585
+ }
3586
+
3587
+ const revoGridStyleCss = ".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:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revo-grid[theme=default],revo-grid:not([theme]){border:1px solid #cecece;font-size:12px}revo-grid[theme=default] .rowHeaders revogr-header,revo-grid:not([theme]) .rowHeaders revogr-header{box-shadow:-1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-header,revo-grid:not([theme]) revogr-header{text-align:center;line-height:30px;background-color:#f8f9fa}revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{box-shadow:none}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{text-transform:uppercase;font-size:12px;color:#000}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow{height:30px;box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell,revo-grid:not([theme]) revogr-header .rgHeaderCell{box-shadow:-1px 0 0 0 #cecece inset, 0 -1px 0 0 #cecece, 0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell.focused-cell,revo-grid:not([theme]) revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] .rowHeaders,revo-grid:not([theme]) .rowHeaders{background-color:#f8f9fa}revo-grid[theme=default] .rowHeaders revogr-data .rgCell,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell{color:#000}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:first-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:first-child{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:not(:first-child),revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:not(:first-child){box-shadow:0 -1px 0 0 #cecece inset, 1px 0 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:last-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:last-child{border-right:1px solid #cecece}revo-grid[theme=default] .rowHeaders revogr-data revogr-header,revo-grid:not([theme]) .rowHeaders revogr-data revogr-header{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #cecece inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinEnd,revo-grid[theme=default] revogr-viewport-scroll.colPinEnd revogr-header,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd revogr-header{box-shadow:1px 0 0 #cecece inset}revo-grid[theme=default] .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset, 0 -1px 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data,revo-grid:not([theme]) revogr-data{text-align:center}revo-grid[theme=default] revogr-data .revo-draggable,revo-grid:not([theme]) revogr-data .revo-draggable{float:left}revo-grid[theme=default] revogr-data .rgRow,revo-grid:not([theme]) revogr-data .rgRow{line-height:27px}revo-grid[theme=default] revogr-data .rgRow.focused-rgRow,revo-grid:not([theme]) revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] revogr-data .rgCell,revo-grid:not([theme]) revogr-data .rgCell{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data .rgCell.disabled,revo-grid:not([theme]) revogr-data .rgCell.disabled{background-color:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=material]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=material] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=material] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=material] revogr-header .header-rgRow{height:50px}revo-grid[theme=material] revogr-data{text-align:left}revo-grid[theme=material] revogr-data .rgRow{line-height:42px}revo-grid[theme=material] revogr-data .rgCell{padding:0 15px}revo-grid[theme=material] .rowHeaders{background-color:#f7faff}revo-grid[theme=material] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=material] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=material] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=material] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=material] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=material] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=darkMaterial]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkMaterial] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkMaterial] revogr-header .header-rgRow{height:50px}revo-grid[theme=darkMaterial] revogr-data{text-align:left}revo-grid[theme=darkMaterial] revogr-data .rgRow{line-height:42px}revo-grid[theme=darkMaterial] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkMaterial] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkMaterial] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkMaterial] revogr-edit{background-color:#28272b}revo-grid[theme=darkMaterial] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkMaterial] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkMaterial] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=darkCompact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkCompact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkCompact] revogr-header .header-rgRow{height:45px}revo-grid[theme=darkCompact] revogr-data{text-align:left}revo-grid[theme=darkCompact] revogr-data .rgRow{line-height:32px}revo-grid[theme=darkCompact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkCompact] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkCompact] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkCompact] revogr-edit{background-color:#28272b}revo-grid[theme=darkCompact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkCompact] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkCompact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=compact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=compact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=compact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=compact] revogr-header .header-rgRow{height:45px}revo-grid[theme=compact] revogr-data{text-align:left}revo-grid[theme=compact] revogr-data .rgRow{line-height:32px}revo-grid[theme=compact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=compact] .rowHeaders{background-color:#f7faff}revo-grid[theme=compact] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=compact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=compact] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=compact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=compact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=compact] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=compact] revo-dropdown .rv-dr-root{padding:0px 9px}revo-grid{display:block;height:100%;min-height:300px;font-family:Helvetica, Arial, Sans-Serif, serif;font-size:14px;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column;width:100%;height:100%}revo-grid .attribution{position:absolute;bottom:0;left:0;right:0;z-index:1000;width:0;height:0;border-left:4px solid rgba(38, 106, 232, 0.9);border-bottom:4px solid rgba(38, 106, 232, 0.9);border-top:4px solid transparent;border-right:4px solid transparent;cursor:pointer}revo-grid .attribution .value{position:absolute;bottom:0;left:0;background-color:rgba(255, 255, 255, 0.9);padding:4px;border-radius:4px;box-shadow:0 1px 10px rgba(0, 0, 0, 0.2);white-space:nowrap;text-decoration:none;color:black;letter-spacing:0.3px;font-size:11px;opacity:0;width:4px;overflow:hidden;transition:opacity 0.5s ease-in-out, width 0.3s ease-in-out}revo-grid .attribution:hover .value{width:63px;opacity:1}revo-grid.column-draggable.column-drag-start:hover,revo-grid.column-draggable.column-drag-start *:hover{cursor:grabbing}revo-grid .footer-wrapper,revo-grid .header-wrapper{width:100%}revo-grid .footer-wrapper revogr-data,revo-grid .header-wrapper revogr-data{z-index:3}revo-grid revo-dropdown{width:100%}revo-grid revo-dropdown .rv-dr-root{max-height:100%}revo-grid revo-dropdown.shrink label{opacity:0}revo-grid .viewports{max-width:100%;display:flex;flex-direction:row;align-items:flex-start;flex-grow:1}revo-grid .main-viewport{flex-grow:1;height:0;display:flex;justify-content:space-between;flex-direction:row}revo-grid .draggable{position:fixed;height:30px;line-height:30px;background:#fff;border-radius:3px;display:block;z-index:100;margin-top:5px;margin-right:-20px;box-shadow:0 4px 20px 0 rgba(0, 0, 0, 0.15);padding-left:20px;padding-right:5px}revo-grid .draggable.hidden{display:none}revo-grid .draggable .revo-alt-icon{background-color:black;position:absolute;left:5px;top:10px}revo-grid .draggable-wrapper.hidden{display:none}revo-grid .drag-position{position:absolute;left:0;right:0;height:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-position-y{position:absolute;top:0;left:0;bottom:0;width:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-auto-scroll-y{pointer-events:none;position:absolute;left:0;top:0;height:50px;width:1px}revo-grid .clipboard{position:absolute;left:0;top:0}revo-grid revogr-scroll-virtual{position:relative}revo-grid revogr-scroll-virtual.vertical,revo-grid revogr-scroll-virtual.horizontal{z-index:3}";
3360
3588
  const RevoGridStyle0 = revoGridStyleCss;
3361
3589
 
3362
3590
  const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridComponent extends HTMLElement$1 {
@@ -3371,8 +3599,9 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3371
3599
  this.beforerange = createEvent(this, "beforerange", 7);
3372
3600
  this.afterfocus = createEvent(this, "afterfocus", 7);
3373
3601
  this.roworderchanged = createEvent(this, "roworderchanged", 7);
3374
- this.beforesortingapply = createEvent(this, "beforesortingapply", 7);
3375
3602
  this.beforesorting = createEvent(this, "beforesorting", 7);
3603
+ this.beforesourcesortingapply = createEvent(this, "beforesourcesortingapply", 7);
3604
+ this.beforesortingapply = createEvent(this, "beforesortingapply", 7);
3376
3605
  this.rowdragstart = createEvent(this, "rowdragstart", 7);
3377
3606
  this.headerclick = createEvent(this, "headerclick", 7);
3378
3607
  this.beforecellfocus = createEvent(this, "beforecellfocus", 7);
@@ -3394,20 +3623,18 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3394
3623
  this.aftercolumnresize = createEvent(this, "aftercolumnresize", 7);
3395
3624
  this.beforerowdefinition = createEvent(this, "beforerowdefinition", 7);
3396
3625
  this.filterconfigchanged = createEvent(this, "filterconfigchanged", 7);
3626
+ this.sortingconfigchanged = createEvent(this, "sortingconfigchanged", 7);
3397
3627
  this.rowheaderschanged = createEvent(this, "rowheaderschanged", 7);
3398
3628
  this.beforegridrender = createEvent(this, "beforegridrender", 7);
3399
3629
  this.aftergridrender = createEvent(this, "aftergridrender", 7);
3400
3630
  this.aftergridinit = createEvent(this, "aftergridinit", 7);
3401
3631
  this.additionaldatachanged = createEvent(this, "additionaldatachanged", 7);
3402
3632
  this.afterthemechanged = createEvent(this, "afterthemechanged", 7);
3633
+ this.created = createEvent(this, "created", 7);
3403
3634
  this.extraElements = [];
3635
+ this.pluginService = new PluginService();
3404
3636
  this.viewport = null;
3405
3637
  this.isInited = false;
3406
- /**
3407
- * Plugins
3408
- * Define plugins collection
3409
- */
3410
- this.internalPlugins = [];
3411
3638
  this.rowHeaders = undefined;
3412
3639
  this.frameSize = 1;
3413
3640
  this.rowSize = 0;
@@ -3430,6 +3657,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3430
3657
  this.rowClass = '';
3431
3658
  this.autoSizeColumn = false;
3432
3659
  this.filter = false;
3660
+ this.sorting = undefined;
3433
3661
  this.focusTemplate = undefined;
3434
3662
  this.canMoveColumns = false;
3435
3663
  this.trimmedRows = {};
@@ -3457,15 +3685,31 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3457
3685
  this.dataProvider.refresh(type);
3458
3686
  }
3459
3687
  /**
3460
- * Sets data at specified cell.
3688
+ * Refreshes data at specified cell.
3461
3689
  * Useful for performance optimization.
3462
3690
  * No viewport update will be triggered.
3691
+ *
3692
+ * @example
3693
+ * const grid = document.querySelector('revo-grid');
3694
+ * grid.setDataAt({ row: 0, col: 0, val: 'test' }); // refresh
3463
3695
  */
3464
- async setDataAt(data) {
3465
- const dataElement = this.element.querySelector(`revogr-data[type="${data.rowType}"][col-type="${data.colType}"]`);
3696
+ async setDataAt({ row, col, colType = 'rgCol', rowType = 'rgRow', val, skipDataUpdate = false }) {
3697
+ var _a;
3698
+ if (this.dataProvider && this.columnProvider && !skipDataUpdate) {
3699
+ const columnProp = (_a = this.columnProvider.getColumn(col, colType)) === null || _a === void 0 ? void 0 : _a.prop;
3700
+ if (typeof columnProp !== 'undefined') {
3701
+ this.dataProvider.setCellData({
3702
+ type: rowType,
3703
+ rowIndex: row,
3704
+ prop: columnProp,
3705
+ val,
3706
+ }, false);
3707
+ }
3708
+ }
3709
+ const dataElement = this.element.querySelector(`revogr-data[type="${rowType}"][col-type="${colType}"]`);
3466
3710
  return dataElement === null || dataElement === void 0 ? void 0 : dataElement.updateCell({
3467
- row: data.row,
3468
- col: data.col,
3711
+ row,
3712
+ col,
3469
3713
  });
3470
3714
  }
3471
3715
  /**
@@ -3633,19 +3877,19 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3633
3877
  * Clear current grid focus. Grid has no longer focus on it.
3634
3878
  */
3635
3879
  async clearFocus() {
3636
- var _a;
3880
+ var _a, _b;
3637
3881
  const focused = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getFocused();
3638
3882
  const event = this.beforefocuslost.emit(focused);
3639
3883
  if (event.defaultPrevented) {
3640
3884
  return;
3641
3885
  }
3642
- this.selectionStoreConnector.clearAll();
3886
+ (_b = this.selectionStoreConnector) === null || _b === void 0 ? void 0 : _b.clearAll();
3643
3887
  }
3644
3888
  /**
3645
3889
  * Get all active plugins instances
3646
3890
  */
3647
3891
  async getPlugins() {
3648
- return [...this.internalPlugins];
3892
+ return this.pluginService.get();
3649
3893
  }
3650
3894
  /**
3651
3895
  * Get the currently focused cell.
@@ -3672,6 +3916,15 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3672
3916
  var _a, _b;
3673
3917
  return (_b = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getSelectedRange()) !== null && _b !== void 0 ? _b : null;
3674
3918
  }
3919
+ /**
3920
+ * Refresh extra elements. Triggers re-rendering of extra elements and functions.
3921
+ * Part of extraElements and registerVNode methods.
3922
+ * Useful for plugins.
3923
+ */
3924
+ async refreshExtraElements() {
3925
+ var _a;
3926
+ (_a = this.extraService) === null || _a === void 0 ? void 0 : _a.refresh();
3927
+ }
3675
3928
  mousedownHandle(event) {
3676
3929
  const screenX = getPropertyFromEvent(event, 'screenX');
3677
3930
  const screenY = getPropertyFromEvent(event, 'screenY');
@@ -3800,7 +4053,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3800
4053
  // Column format change will trigger column structure update
3801
4054
  this.columnChanged(this.columns);
3802
4055
  }
3803
- columnChanged(newVal = []) {
4056
+ columnChanged(newVal = [], _prevVal = undefined, __watchName = 'columns', init = false) {
3804
4057
  if (!this.dimensionProvider || !this.columnProvider) {
3805
4058
  return;
3806
4059
  }
@@ -3809,7 +4062,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3809
4062
  if (beforeSetEvent.defaultPrevented) {
3810
4063
  return;
3811
4064
  }
3812
- this.dimensionProvider.applyNewColumns(beforeSetEvent.detail.columns, this.disableVirtualX);
4065
+ this.dimensionProvider.applyNewColumns(beforeSetEvent.detail.columns, this.disableVirtualX, init);
3813
4066
  const beforeApplyEvent = this.beforecolumnapplied.emit(columnGather);
3814
4067
  if (beforeApplyEvent.defaultPrevented) {
3815
4068
  return;
@@ -3865,7 +4118,9 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3865
4118
  break;
3866
4119
  case 'source':
3867
4120
  type = 'rgRow';
3868
- /** applied for source only for cross compatability between plugins */
4121
+ /**
4122
+ * Applied for source only for cross compatability between plugins
4123
+ */
3869
4124
  const beforesourceset = this.beforesourceset.emit({
3870
4125
  type,
3871
4126
  source: newVal,
@@ -3879,7 +4134,9 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3879
4134
  });
3880
4135
  const newSource = [...beforesourceset.detail.source];
3881
4136
  this.dataProvider.setData(newSource, type, this.disableVirtualY);
3882
- /** applied for source only for cross compatability between plugins */
4137
+ /**
4138
+ * Applied for source only for cross compatability between plugins
4139
+ */
3883
4140
  if (watchName === 'source') {
3884
4141
  this.aftersourceset.emit({
3885
4142
  type,
@@ -3938,15 +4195,8 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3938
4195
  * Grouping
3939
4196
  */
3940
4197
  groupingChanged(newVal = {}) {
3941
- let grPlugin;
3942
- for (let p of this.internalPlugins) {
3943
- const isGrouping = p;
3944
- if (!!isGrouping.setGrouping) {
3945
- grPlugin = isGrouping;
3946
- break;
3947
- }
3948
- }
3949
- grPlugin === null || grPlugin === void 0 ? void 0 : grPlugin.setGrouping(newVal || {});
4198
+ var _a;
4199
+ (_a = this.pluginService.getByClass(GroupingRowPlugin)) === null || _a === void 0 ? void 0 : _a.setGrouping(newVal || {});
3950
4200
  }
3951
4201
  /**
3952
4202
  * Stretch Plugin Apply
@@ -3958,30 +4208,29 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3958
4208
  if (isStretch === 'false') {
3959
4209
  isStretch = false;
3960
4210
  }
3961
- let stretch = this.internalPlugins.filter(p => isStretchPlugin(p))[0];
4211
+ const pluginData = this.getPluginData();
4212
+ if (!pluginData) {
4213
+ return;
4214
+ }
4215
+ const stretch = this.pluginService.getByClass(StretchColumn);
3962
4216
  if ((typeof isStretch === 'boolean' && isStretch) || isStretch === 'true') {
3963
4217
  if (!stretch) {
3964
- const pluginData = {
3965
- data: this.dataProvider,
3966
- column: this.columnProvider,
3967
- dimension: this.dimensionProvider,
3968
- viewport: this.viewportProvider,
3969
- selection: this.selectionStoreConnector,
3970
- };
3971
- this.internalPlugins.push(new StretchColumn(this.element, pluginData));
4218
+ this.pluginService.add(new StretchColumn(this.element, pluginData));
3972
4219
  }
3973
4220
  else if (isStretchPlugin(stretch)) {
3974
4221
  stretch.applyStretch(this.columnProvider.getRawColumns());
3975
4222
  }
3976
4223
  }
3977
4224
  else if (stretch) {
3978
- const index = this.internalPlugins.indexOf(stretch);
3979
- this.internalPlugins.splice(index, 1);
4225
+ this.pluginService.remove(stretch);
3980
4226
  }
3981
4227
  }
3982
4228
  applyFilter(cfg) {
3983
4229
  this.filterconfigchanged.emit(cfg);
3984
4230
  }
4231
+ applySorting(cfg) {
4232
+ this.sortingconfigchanged.emit(cfg);
4233
+ }
3985
4234
  rowHeadersChange(rowHeaders) {
3986
4235
  this.rowheaderschanged.emit(rowHeaders);
3987
4236
  }
@@ -3989,26 +4238,16 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3989
4238
  * Register external VNodes
3990
4239
  */
3991
4240
  registerOutsideVNodes(elements = []) {
3992
- this.extraElements = [...this.extraElements, ...elements];
4241
+ this.extraElements = elements;
3993
4242
  }
3994
4243
  additionalDataChanged(data) {
3995
4244
  this.additionaldatachanged.emit(data);
3996
4245
  }
3997
- pluginsChanged(plugins = [], _prevPlugins) {
3998
- // pass data provider to plugins
3999
- const pluginData = this.getPluginData();
4000
- if (!pluginData) {
4001
- return;
4002
- }
4003
- // todo: remove old plugins if any was removed based on _prevPlugins
4004
- // register user plugins
4005
- plugins === null || plugins === void 0 ? void 0 : plugins.forEach(userPlugin => {
4006
- const existingPlugin = this.internalPlugins.find(createdPlugin => createdPlugin instanceof userPlugin);
4007
- if (existingPlugin) {
4008
- return;
4009
- }
4010
- this.internalPlugins.push(new userPlugin(this.element, pluginData));
4011
- });
4246
+ /**
4247
+ * User can add plugins via plugins property
4248
+ */
4249
+ pluginsChanged(plugins = [], prevPlugins) {
4250
+ this.pluginService.addUserPluginsAndCreate(this.element, plugins, prevPlugins, this.getPluginData());
4012
4251
  }
4013
4252
  // #endregion
4014
4253
  // #region Plugins
@@ -4020,35 +4259,39 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4020
4259
  if (!pluginData) {
4021
4260
  return;
4022
4261
  }
4262
+ // register system plugins
4263
+ this.setCorePlugins(pluginData);
4264
+ // register user plugins
4265
+ this.pluginsChanged(this.plugins);
4266
+ }
4267
+ setCorePlugins(pluginData) {
4023
4268
  if (this.accessible) {
4024
- this.internalPlugins.push(new WCAGPlugin(this.element, pluginData));
4269
+ this.pluginService.add(new WCAGPlugin(this.element, pluginData));
4025
4270
  }
4026
4271
  // register auto size plugin
4027
4272
  if (this.autoSizeColumn) {
4028
- this.internalPlugins.push(new AutoSizeColumnPlugin(this.element, pluginData, typeof this.autoSizeColumn === 'object'
4273
+ this.pluginService.add(new AutoSizeColumnPlugin(this.element, pluginData, typeof this.autoSizeColumn === 'object'
4029
4274
  ? this.autoSizeColumn
4030
4275
  : undefined));
4031
4276
  }
4032
4277
  // register filter plugin
4033
4278
  if (this.filter) {
4034
- this.internalPlugins.push(new FilterPlugin(this.element, pluginData, typeof this.filter === 'object' ? this.filter : undefined));
4279
+ this.pluginService.add(new FilterPlugin(this.element, pluginData, typeof this.filter === 'object' ? this.filter : undefined));
4035
4280
  }
4036
4281
  // register export plugin
4037
4282
  if (this.exporting) {
4038
- this.internalPlugins.push(new ExportFilePlugin(this.element, pluginData));
4283
+ this.pluginService.add(new ExportFilePlugin(this.element, pluginData));
4039
4284
  }
4040
4285
  // register sorting plugin
4041
- this.internalPlugins.push(new SortingPlugin(this.element, pluginData));
4286
+ this.pluginService.add(new SortingPlugin(this.element, pluginData));
4042
4287
  // register grouping plugin
4043
- this.internalPlugins.push(new GroupingRowPlugin(this.element, pluginData));
4288
+ this.pluginService.add(new GroupingRowPlugin(this.element, pluginData));
4044
4289
  if (this.canMoveColumns) {
4045
- this.internalPlugins.push(new ColumnPlugin(this.element, pluginData));
4290
+ this.pluginService.add(new ColumnMovePlugin(this.element, pluginData));
4046
4291
  }
4047
- // register user plugins
4048
- this.pluginsChanged(this.plugins);
4049
4292
  }
4050
4293
  getPluginData() {
4051
- if (!this.dimensionProvider || !this.dataProvider || !this.columnProvider || !this.viewportProvider) {
4294
+ if (!this.dimensionProvider || !this.dataProvider || !this.columnProvider || !this.viewportProvider || !this.selectionStoreConnector) {
4052
4295
  return;
4053
4296
  }
4054
4297
  // pass data provider to plugins
@@ -4058,12 +4301,12 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4058
4301
  dimension: this.dimensionProvider,
4059
4302
  viewport: this.viewportProvider,
4060
4303
  selection: this.selectionStoreConnector,
4304
+ plugins: this.pluginService,
4061
4305
  };
4062
4306
  return pluginData;
4063
4307
  }
4064
4308
  removePlugins() {
4065
- this.internalPlugins.forEach(p => { var _a; return (_a = p.destroy) === null || _a === void 0 ? void 0 : _a.call(p); });
4066
- this.internalPlugins = [];
4309
+ this.pluginService.destroy();
4067
4310
  }
4068
4311
  // #endregion
4069
4312
  // if reconnect to dom we need to set up plugins
@@ -4071,6 +4314,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4071
4314
  if (this.isInited) {
4072
4315
  this.setPlugins();
4073
4316
  }
4317
+ this.created.emit();
4074
4318
  }
4075
4319
  /**
4076
4320
  * Called once just after the component is first connected to the DOM.
@@ -4098,7 +4342,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4098
4342
  // set data
4099
4343
  this.applyStretch(this.stretch);
4100
4344
  this.themeChanged(this.theme, undefined, undefined, true);
4101
- this.columnChanged(this.columns);
4345
+ this.columnChanged(this.columns, undefined, undefined, true);
4102
4346
  this.dataSourceChanged(this.source, undefined, 'source');
4103
4347
  this.dataSourceChanged(this.pinnedTopSource, undefined, 'pinnedTopSource');
4104
4348
  this.dataSourceChanged(this.pinnedBottomSource, undefined, 'pinnedBottomSource');
@@ -4106,7 +4350,10 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4106
4350
  this.trimmedRowsChanged(this.trimmedRows);
4107
4351
  }
4108
4352
  this.rowDefChanged(this.rowDefinitions);
4109
- this.groupingChanged(this.grouping);
4353
+ // init grouping
4354
+ if (this.grouping && Object.keys(this.grouping).length > 0) {
4355
+ this.groupingChanged(this.grouping);
4356
+ }
4110
4357
  // init scrolling service
4111
4358
  this.scrollingService = new GridScrollingService((e) => {
4112
4359
  var _a;
@@ -4131,7 +4378,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4131
4378
  this.aftergridrender.emit();
4132
4379
  }
4133
4380
  render() {
4134
- if (!this.dimensionProvider || !this.dataProvider || !this.columnProvider || !this.viewportProvider) {
4381
+ if (!this.dimensionProvider || !this.dataProvider || !this.columnProvider || !this.viewportProvider || !this.selectionStoreConnector) {
4135
4382
  return;
4136
4383
  }
4137
4384
  const contentHeight = this.dimensionProvider.stores['rgRow'].store.get('realSize');
@@ -4174,12 +4421,13 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4174
4421
  // Render viewport data (vertical sections)
4175
4422
  view.dataPorts.forEach(data => {
4176
4423
  const key = `${data.type}_${view.type}`;
4177
- const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { isMobileDevice: isMobile, selectionStore: data.segmentSelectionStore, onSelectall: () => this.selectionStoreConnector.selectAll(), editors: this.editors, readonly: this.readonly, range: this.range, useClipboard: this.useClipboard, applyChangesOnClose: this.applyOnClose, additionalData: this.additionalData, slot: data.slot, onBeforenextvpfocus: (e) => this.selectionStoreConnector.beforeNextFocusCell(e.detail), onCanceledit: () => this.selectionStoreConnector.setEdit(false), onSetedit: ({ detail }) => {
4424
+ const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { isMobileDevice: isMobile, onSelectall: () => { var _a; return (_a = this.selectionStoreConnector) === null || _a === void 0 ? void 0 : _a.selectAll(); }, editors: this.editors, readonly: this.readonly, range: this.range, useClipboard: this.useClipboard, applyChangesOnClose: this.applyOnClose, additionalData: this.additionalData, slot: data.slot, onBeforenextvpfocus: (e) => { var _a; return (_a = this.selectionStoreConnector) === null || _a === void 0 ? void 0 : _a.beforeNextFocusCell(e.detail); }, onCanceledit: () => { var _a; return (_a = this.selectionStoreConnector) === null || _a === void 0 ? void 0 : _a.setEdit(false); }, onSetedit: ({ detail }) => {
4425
+ var _a;
4178
4426
  const event = this.beforeeditstart.emit(detail);
4179
4427
  if (!event.defaultPrevented) {
4180
- this.selectionStoreConnector.setEdit(detail.val);
4428
+ (_a = this.selectionStoreConnector) === null || _a === void 0 ? void 0 : _a.setEdit(detail.val);
4181
4429
  }
4182
- } }), h("revogr-data", Object.assign({}, data, { colType: view.type, key: key, readonly: this.readonly, range: this.range, rowClass: this.rowClass, rowSelectionStore: data.rowSelectionStore, additionalData: this.additionalData, jobsBeforeRender: this.jobsBeforeRender, slot: DATA_SLOT }), h("slot", { name: `data-${view.type}-${data.type}` })), h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }), h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, focusTemplate: this.focusTemplate, rowType: data.type, colType: view.type, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }, h("slot", { name: `focus-${view.type}-${data.type}` }))));
4430
+ } }), h("revogr-data", Object.assign({}, data, { colType: view.type, key: key, readonly: this.readonly, range: this.range, rowClass: this.rowClass, rowSelectionStore: data.rowSelectionStore, additionalData: this.additionalData, jobsBeforeRender: this.jobsBeforeRender, slot: DATA_SLOT }), h("slot", { name: `data-${view.type}-${data.type}` })), h("revogr-temp-range", { selectionStore: data.selectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }), h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, focusTemplate: this.focusTemplate, rowType: data.type, colType: view.type, selectionStore: data.selectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }, h("slot", { name: `focus-${view.type}-${data.type}` }))));
4183
4431
  dataViews.push(dataView);
4184
4432
  });
4185
4433
  // Add viewport scroll in the end
@@ -4191,15 +4439,16 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4191
4439
  const typeCol = 'rgCol';
4192
4440
  const viewports = this.viewportProvider.stores;
4193
4441
  const dimensions = this.dimensionProvider.stores;
4194
- return (h(Host, null, this.hideAttribution ? null : (h("revogr-attribution", { class: "attribution" })), h("div", { class: "main-viewport", onClick: (e) => {
4442
+ return (h(Host, null, this.hideAttribution ? null : (h("revogr-attribution", { class: "attribution" })), h("slot", { name: "header" }), h("div", { class: "main-viewport", onClick: (e) => {
4195
4443
  var _a;
4196
4444
  if (e.currentTarget === e.target) {
4197
4445
  (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.clearEdit();
4198
4446
  }
4199
- } }, h("div", { class: "viewports" }, h("slot", { name: "viewport" }), viewportSections, h("revogr-scroll-virtual", { class: "vertical", dimension: typeRow, viewportStore: viewports[typeRow].store, dimensionStore: dimensions[typeRow].store, ref: el => this.scrollingService.registerElement(el, 'rowScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), h(OrderRenderer, { ref: e => (this.orderService = e) }))), h("revogr-scroll-virtual", { class: "horizontal", dimension: typeCol, viewportStore: viewports[typeCol].store, dimensionStore: dimensions[typeCol].store, ref: el => this.scrollingService.registerElement(el, 'colScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), h("revogr-extra", { nodes: this.extraElements })));
4447
+ } }, h("div", { class: "viewports" }, h("slot", { name: "viewport" }), viewportSections, h("revogr-scroll-virtual", { class: "vertical", dimension: typeRow, viewportStore: viewports[typeRow].store, dimensionStore: dimensions[typeRow].store, ref: el => this.scrollingService.registerElement(el, 'rowScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), h(OrderRenderer, { ref: e => (this.orderService = e) }))), h("revogr-scroll-virtual", { class: "horizontal", dimension: typeCol, viewportStore: viewports[typeCol].store, dimensionStore: dimensions[typeCol].store, ref: el => this.scrollingService.registerElement(el, 'colScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), h("revogr-extra", { ref: el => (this.extraService = el), nodes: this.extraElements }), h("slot", { name: "footer" })));
4200
4448
  }
4201
4449
  disconnectedCallback() {
4202
- // Remove all plugins, to avoid memory leaks and unexpected behaviour when the component is removed
4450
+ // Remove all plugins, to avoid memory leaks
4451
+ // and unexpected behaviour when the component is removed
4203
4452
  this.removePlugins();
4204
4453
  }
4205
4454
  get element() { return this; }
@@ -4218,6 +4467,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4218
4467
  "grouping": ["groupingChanged"],
4219
4468
  "stretch": ["applyStretch"],
4220
4469
  "filter": ["applyFilter"],
4470
+ "sorting": ["applySorting"],
4221
4471
  "rowHeaders": ["rowHeadersChange"],
4222
4472
  "registerVNode": ["registerOutsideVNodes"],
4223
4473
  "additionalData": ["additionalDataChanged"],
@@ -4247,6 +4497,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4247
4497
  "rowClass": [513, "row-class"],
4248
4498
  "autoSizeColumn": [4, "auto-size-column"],
4249
4499
  "filter": [4],
4500
+ "sorting": [16],
4250
4501
  "focusTemplate": [16],
4251
4502
  "canMoveColumns": [4, "can-move-columns"],
4252
4503
  "trimmedRows": [16],
@@ -4281,7 +4532,8 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4281
4532
  "getPlugins": [64],
4282
4533
  "getFocused": [64],
4283
4534
  "getContentSize": [64],
4284
- "getSelectedRange": [64]
4535
+ "getSelectedRange": [64],
4536
+ "refreshExtraElements": [64]
4285
4537
  }, [[5, "touchstart", "mousedownHandle"], [5, "mousedown", "mousedownHandle"], [5, "touchend", "mouseupHandle"], [5, "mouseup", "mouseupHandle"], [0, "rowdragstartinit", "onRowDragStarted"], [0, "rowdragendinit", "onRowDragEnd"], [0, "roworderchange", "onRowOrderChange"], [0, "rowdragmoveinit", "onRowDrag"], [0, "rowdragmousemove", "onRowMouseMove"], [0, "celleditapply", "onCellEdit"], [0, "rangeeditapply", "onRangeEdit"], [0, "selectionchangeinit", "onRangeChanged"], [0, "rowdropinit", "onRowDropped"], [0, "beforeheaderclick", "onHeaderClick"], [0, "beforecellfocusinit", "onCellFocus"]], {
4286
4538
  "columnTypes": ["columnTypesChanged"],
4287
4539
  "columns": ["columnChanged"],
@@ -4297,6 +4549,7 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
4297
4549
  "grouping": ["groupingChanged"],
4298
4550
  "stretch": ["applyStretch"],
4299
4551
  "filter": ["applyFilter"],
4552
+ "sorting": ["applySorting"],
4300
4553
  "rowHeaders": ["rowHeadersChange"],
4301
4554
  "registerVNode": ["registerOutsideVNodes"],
4302
4555
  "additionalData": ["additionalDataChanged"],
@@ -4389,6 +4642,6 @@ function defineCustomElement$1() {
4389
4642
  const RevoGrid = RevoGridComponent;
4390
4643
  const defineCustomElement = defineCustomElement$1;
4391
4644
 
4392
- export { BasePlugin as B, DimensionStore as D, FILTER_TRIMMED_TYPE as F, RevoGrid, isStretchPlugin as a, FILTER_CONFIG_CHANGED_EVENT as b, columnTypes as c, FILTE_PANEL as d, defineCustomElement, FilterPlugin as e, filterCoreFunctionsIndexedByType as f, getTheme as g, filterTypes as h, isRowType as i, filterNames as j, getLeftRelative as k, rowTypes as r };
4645
+ export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, RevoGrid, StretchColumn as S, isStretchPlugin as a, ExportCsv as b, columnTypes as c, FILTER_CONFIG_CHANGED_EVENT as d, defineCustomElement, FILTE_PANEL as e, FilterPlugin as f, getTheme as g, filterCoreFunctionsIndexedByType as h, isRowType as i, filterTypes as j, filterNames as k, getLeftRelative as l, SortingPlugin as m, rowTypes as r };
4393
4646
 
4394
4647
  //# sourceMappingURL=revo-grid.js.map