lsp-grid 1.0.0

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 (675) hide show
  1. package/README.md +34 -0
  2. package/dist/cjs/app-globals-Bfsg1bDt.js +16 -0
  3. package/dist/cjs/app-globals-Bfsg1bDt.js.map +1 -0
  4. package/dist/cjs/cell-renderer-DtuYp7tj.js +106 -0
  5. package/dist/cjs/cell-renderer-DtuYp7tj.js.map +1 -0
  6. package/dist/cjs/column.drag.plugin-BIptTmfz.js +2554 -0
  7. package/dist/cjs/column.drag.plugin-BIptTmfz.js.map +1 -0
  8. package/dist/cjs/column.service-BnVSAfcu.js +1391 -0
  9. package/dist/cjs/column.service-BnVSAfcu.js.map +1 -0
  10. package/dist/cjs/data.store-CrF4Nf9q.js +3615 -0
  11. package/dist/cjs/data.store-CrF4Nf9q.js.map +1 -0
  12. package/dist/cjs/debounce-DgeyTQM0.js +498 -0
  13. package/dist/cjs/debounce-DgeyTQM0.js.map +1 -0
  14. package/dist/cjs/edit.utils-Bw-E3Fj6.js +118 -0
  15. package/dist/cjs/edit.utils-Bw-E3Fj6.js.map +1 -0
  16. package/dist/cjs/events-D0Syn6ut.js +46 -0
  17. package/dist/cjs/events-D0Syn6ut.js.map +1 -0
  18. package/dist/cjs/filter.button-CaAAXq-6.js +49 -0
  19. package/dist/cjs/filter.button-CaAAXq-6.js.map +1 -0
  20. package/dist/cjs/header-cell-renderer-DhRJqZ-w.js +356 -0
  21. package/dist/cjs/header-cell-renderer-DhRJqZ-w.js.map +1 -0
  22. package/dist/cjs/index-VM40U6Gh.js +2549 -0
  23. package/dist/cjs/index-VM40U6Gh.js.map +1 -0
  24. package/dist/cjs/index.cjs.js +346 -0
  25. package/dist/cjs/index.cjs.js.map +1 -0
  26. package/dist/cjs/loader.cjs.js +19 -0
  27. package/dist/cjs/loader.cjs.js.map +1 -0
  28. package/dist/cjs/revo-grid.cjs.entry.js +2187 -0
  29. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -0
  30. package/dist/cjs/revo-grid.cjs.js +31 -0
  31. package/dist/cjs/revo-grid.cjs.js.map +1 -0
  32. package/dist/cjs/revo-grid.entry.cjs.js.map +1 -0
  33. package/dist/cjs/revogr-attribution.revogr-extra.revogr-focus.revogr-overlay-selection.revogr-row-headers.revogr-scroll-virtual.revogr-temp-range.entry.cjs.js.map +1 -0
  34. package/dist/cjs/revogr-attribution_7.cjs.entry.js +1463 -0
  35. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -0
  36. package/dist/cjs/revogr-clipboard.revogr-edit.revogr-order-editor.entry.cjs.js.map +1 -0
  37. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +456 -0
  38. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -0
  39. package/dist/cjs/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.cjs.js.map +1 -0
  40. package/dist/cjs/revogr-data_4.cjs.entry.js +948 -0
  41. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -0
  42. package/dist/cjs/revogr-filter-panel.cjs.entry.js +382 -0
  43. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -0
  44. package/dist/cjs/revogr-filter-panel.entry.cjs.js.map +1 -0
  45. package/dist/cjs/row-header-utils-DL640c7x.js +420 -0
  46. package/dist/cjs/row-header-utils-DL640c7x.js.map +1 -0
  47. package/dist/cjs/text-editor-DWChyeVV.js +81 -0
  48. package/dist/cjs/text-editor-DWChyeVV.js.map +1 -0
  49. package/dist/cjs/throttle-Bb1Bbfd1.js +278 -0
  50. package/dist/cjs/throttle-Bb1Bbfd1.js.map +1 -0
  51. package/dist/cjs/viewport.helpers-CI6uB8tu.js +59 -0
  52. package/dist/cjs/viewport.helpers-CI6uB8tu.js.map +1 -0
  53. package/dist/collection/collection-manifest.json +28 -0
  54. package/dist/collection/components/attribution/revogr-attribution.js +20 -0
  55. package/dist/collection/components/attribution/revogr-attribution.js.map +1 -0
  56. package/dist/collection/components/clipboard/revogr-clipboard.js +396 -0
  57. package/dist/collection/components/clipboard/revogr-clipboard.js.map +1 -0
  58. package/dist/collection/components/data/cell-renderer.js +44 -0
  59. package/dist/collection/components/data/cell-renderer.js.map +1 -0
  60. package/dist/collection/components/data/column.service.js +293 -0
  61. package/dist/collection/components/data/column.service.js.map +1 -0
  62. package/dist/collection/components/data/revogr-data-style.css +75 -0
  63. package/dist/collection/components/data/revogr-data.js +697 -0
  64. package/dist/collection/components/data/revogr-data.js.map +1 -0
  65. package/dist/collection/components/data/row-highlight.plugin.js +51 -0
  66. package/dist/collection/components/data/row-highlight.plugin.js.map +1 -0
  67. package/dist/collection/components/data/row-renderer.js +16 -0
  68. package/dist/collection/components/data/row-renderer.js.map +1 -0
  69. package/dist/collection/components/editors/edit.utils.js +13 -0
  70. package/dist/collection/components/editors/edit.utils.js.map +1 -0
  71. package/dist/collection/components/editors/revogr-edit-style.css +16 -0
  72. package/dist/collection/components/editors/revogr-edit.js +346 -0
  73. package/dist/collection/components/editors/revogr-edit.js.map +1 -0
  74. package/dist/collection/components/editors/text-editor.js +74 -0
  75. package/dist/collection/components/editors/text-editor.js.map +1 -0
  76. package/dist/collection/components/extra/revogr-extra.js +125 -0
  77. package/dist/collection/components/extra/revogr-extra.js.map +1 -0
  78. package/dist/collection/components/header/header-cell-renderer.js +34 -0
  79. package/dist/collection/components/header/header-cell-renderer.js.map +1 -0
  80. package/dist/collection/components/header/header-group-renderer.js +25 -0
  81. package/dist/collection/components/header/header-group-renderer.js.map +1 -0
  82. package/dist/collection/components/header/header-renderer.js +61 -0
  83. package/dist/collection/components/header/header-renderer.js.map +1 -0
  84. package/dist/collection/components/header/resizable.directive.js +237 -0
  85. package/dist/collection/components/header/resizable.directive.js.map +1 -0
  86. package/dist/collection/components/header/resizable.element.js +38 -0
  87. package/dist/collection/components/header/resizable.element.js.map +1 -0
  88. package/dist/collection/components/header/revogr-header-style.css +144 -0
  89. package/dist/collection/components/header/revogr-header.js +573 -0
  90. package/dist/collection/components/header/revogr-header.js.map +1 -0
  91. package/dist/collection/components/order/order-renderer.js +50 -0
  92. package/dist/collection/components/order/order-renderer.js.map +1 -0
  93. package/dist/collection/components/order/order-row.service.js +72 -0
  94. package/dist/collection/components/order/order-row.service.js.map +1 -0
  95. package/dist/collection/components/order/revogr-order-editor.js +461 -0
  96. package/dist/collection/components/order/revogr-order-editor.js.map +1 -0
  97. package/dist/collection/components/overlay/autofill.service.js +224 -0
  98. package/dist/collection/components/overlay/autofill.service.js.map +1 -0
  99. package/dist/collection/components/overlay/keyboard.service.js +158 -0
  100. package/dist/collection/components/overlay/keyboard.service.js.map +1 -0
  101. package/dist/collection/components/overlay/revogr-overlay-selection.js +1515 -0
  102. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -0
  103. package/dist/collection/components/overlay/revogr-overlay-style.css +95 -0
  104. package/dist/collection/components/overlay/selection.utils.js +136 -0
  105. package/dist/collection/components/overlay/selection.utils.js.map +1 -0
  106. package/dist/collection/components/revoGrid/grid.helpers.js +33 -0
  107. package/dist/collection/components/revoGrid/grid.helpers.js.map +1 -0
  108. package/dist/collection/components/revoGrid/plugin.service.js +81 -0
  109. package/dist/collection/components/revoGrid/plugin.service.js.map +1 -0
  110. package/dist/collection/components/revoGrid/revo-grid-style.css +567 -0
  111. package/dist/collection/components/revoGrid/revo-grid.js +3671 -0
  112. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -0
  113. package/dist/collection/components/revoGrid/viewport.helpers.js +49 -0
  114. package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -0
  115. package/dist/collection/components/revoGrid/viewport.resize.service.js +55 -0
  116. package/dist/collection/components/revoGrid/viewport.resize.service.js.map +1 -0
  117. package/dist/collection/components/revoGrid/viewport.scrolling.service.js +90 -0
  118. package/dist/collection/components/revoGrid/viewport.scrolling.service.js.map +1 -0
  119. package/dist/collection/components/revoGrid/viewport.service.js +237 -0
  120. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -0
  121. package/dist/collection/components/rowHeaders/revogr-row-headers.js +291 -0
  122. package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -0
  123. package/dist/collection/components/rowHeaders/row-header-render.js +5 -0
  124. package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -0
  125. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +69 -0
  126. package/dist/collection/components/scroll/revogr-viewport-scroll.js +601 -0
  127. package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -0
  128. package/dist/collection/components/scrollable/autohide-scroll.plugin.js +44 -0
  129. package/dist/collection/components/scrollable/autohide-scroll.plugin.js.map +1 -0
  130. package/dist/collection/components/scrollable/revogr-scroll-style.css +34 -0
  131. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +295 -0
  132. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -0
  133. package/dist/collection/components/selectionFocus/revogr-focus-style.css +7 -0
  134. package/dist/collection/components/selectionFocus/revogr-focus.js +400 -0
  135. package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -0
  136. package/dist/collection/components/selectionTempRange/revogr-temp-range-style.css +28 -0
  137. package/dist/collection/components/selectionTempRange/revogr-temp-range.js +171 -0
  138. package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -0
  139. package/dist/collection/components/vnode/vnode-converter.js +84 -0
  140. package/dist/collection/components/vnode/vnode-converter.js.map +1 -0
  141. package/dist/collection/components/vnode/vnode.utils.js +18 -0
  142. package/dist/collection/components/vnode/vnode.utils.js.map +1 -0
  143. package/dist/collection/global/global.js +19 -0
  144. package/dist/collection/global/global.js.map +1 -0
  145. package/dist/collection/index.js +13 -0
  146. package/dist/collection/index.js.map +1 -0
  147. package/dist/collection/plugins/add-rows-on-paste.plugin.js +40 -0
  148. package/dist/collection/plugins/add-rows-on-paste.plugin.js.map +1 -0
  149. package/dist/collection/plugins/base.plugin.js +90 -0
  150. package/dist/collection/plugins/base.plugin.js.map +1 -0
  151. package/dist/collection/plugins/column.auto-size.plugin.js +225 -0
  152. package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -0
  153. package/dist/collection/plugins/column.stretch.plugin.js +96 -0
  154. package/dist/collection/plugins/column.stretch.plugin.js.map +1 -0
  155. package/dist/collection/plugins/dispatcher.js +40 -0
  156. package/dist/collection/plugins/dispatcher.js.map +1 -0
  157. package/dist/collection/plugins/export/csv.js +72 -0
  158. package/dist/collection/plugins/export/csv.js.map +1 -0
  159. package/dist/collection/plugins/export/export.plugin.js +157 -0
  160. package/dist/collection/plugins/export/export.plugin.js.map +1 -0
  161. package/dist/collection/plugins/export/types.js +2 -0
  162. package/dist/collection/plugins/export/types.js.map +1 -0
  163. package/dist/collection/plugins/filter/conditions/equal.js +21 -0
  164. package/dist/collection/plugins/filter/conditions/equal.js.map +1 -0
  165. package/dist/collection/plugins/filter/conditions/number/greaterThan.js +14 -0
  166. package/dist/collection/plugins/filter/conditions/number/greaterThan.js.map +1 -0
  167. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +11 -0
  168. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js.map +1 -0
  169. package/dist/collection/plugins/filter/conditions/number/lessThan.js +16 -0
  170. package/dist/collection/plugins/filter/conditions/number/lessThan.js.map +1 -0
  171. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +11 -0
  172. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js.map +1 -0
  173. package/dist/collection/plugins/filter/conditions/set.js +7 -0
  174. package/dist/collection/plugins/filter/conditions/set.js.map +1 -0
  175. package/dist/collection/plugins/filter/conditions/string/beginswith.js +21 -0
  176. package/dist/collection/plugins/filter/conditions/string/beginswith.js.map +1 -0
  177. package/dist/collection/plugins/filter/conditions/string/contains.js +25 -0
  178. package/dist/collection/plugins/filter/conditions/string/contains.js.map +1 -0
  179. package/dist/collection/plugins/filter/filter.button.js +28 -0
  180. package/dist/collection/plugins/filter/filter.button.js.map +1 -0
  181. package/dist/collection/plugins/filter/filter.indexed.js +49 -0
  182. package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
  183. package/dist/collection/plugins/filter/filter.panel.js +610 -0
  184. package/dist/collection/plugins/filter/filter.panel.js.map +1 -0
  185. package/dist/collection/plugins/filter/filter.plugin.js +388 -0
  186. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -0
  187. package/dist/collection/plugins/filter/filter.style.css +165 -0
  188. package/dist/collection/plugins/filter/filter.types.js +9 -0
  189. package/dist/collection/plugins/filter/filter.types.js.map +1 -0
  190. package/dist/collection/plugins/groupingRow/grouping.const.js +16 -0
  191. package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -0
  192. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
  193. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js.map +1 -0
  194. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +245 -0
  195. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -0
  196. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +38 -0
  197. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -0
  198. package/dist/collection/plugins/groupingRow/grouping.row.types.js +2 -0
  199. package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -0
  200. package/dist/collection/plugins/groupingRow/grouping.service.js +178 -0
  201. package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -0
  202. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +61 -0
  203. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js.map +1 -0
  204. package/dist/collection/plugins/index.js +15 -0
  205. package/dist/collection/plugins/index.js.map +1 -0
  206. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +175 -0
  207. package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -0
  208. package/dist/collection/plugins/moveColumn/order-column.handler.js +71 -0
  209. package/dist/collection/plugins/moveColumn/order-column.handler.js.map +1 -0
  210. package/dist/collection/plugins/rtl/rtl.plugin.js +110 -0
  211. package/dist/collection/plugins/rtl/rtl.plugin.js.map +1 -0
  212. package/dist/collection/plugins/sorting/sorting.func.js +82 -0
  213. package/dist/collection/plugins/sorting/sorting.func.js.map +1 -0
  214. package/dist/collection/plugins/sorting/sorting.plugin.js +224 -0
  215. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -0
  216. package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
  217. package/dist/collection/plugins/sorting/sorting.sign.js.map +1 -0
  218. package/dist/collection/plugins/sorting/sorting.types.js +2 -0
  219. package/dist/collection/plugins/sorting/sorting.types.js.map +1 -0
  220. package/dist/collection/plugins/wcag/index.js +84 -0
  221. package/dist/collection/plugins/wcag/index.js.map +1 -0
  222. package/dist/collection/serve/controller.js +344 -0
  223. package/dist/collection/serve/data.js +201 -0
  224. package/dist/collection/services/cell.helpers.js +12 -0
  225. package/dist/collection/services/cell.helpers.js.map +1 -0
  226. package/dist/collection/services/column.data.provider.js +119 -0
  227. package/dist/collection/services/column.data.provider.js.map +1 -0
  228. package/dist/collection/services/data.provider.js +89 -0
  229. package/dist/collection/services/data.provider.js.map +1 -0
  230. package/dist/collection/services/dimension.provider.js +176 -0
  231. package/dist/collection/services/dimension.provider.js.map +1 -0
  232. package/dist/collection/services/local.scroll.service.js +124 -0
  233. package/dist/collection/services/local.scroll.service.js.map +1 -0
  234. package/dist/collection/services/local.scroll.timer.js +81 -0
  235. package/dist/collection/services/local.scroll.timer.js.map +1 -0
  236. package/dist/collection/services/selection.store.connector.js +307 -0
  237. package/dist/collection/services/selection.store.connector.js.map +1 -0
  238. package/dist/collection/services/viewport.provider.js +17 -0
  239. package/dist/collection/services/viewport.provider.js.map +1 -0
  240. package/dist/collection/store/dataSource/data.proxy.js +45 -0
  241. package/dist/collection/store/dataSource/data.proxy.js.map +1 -0
  242. package/dist/collection/store/dataSource/data.store.js +144 -0
  243. package/dist/collection/store/dataSource/data.store.js.map +1 -0
  244. package/dist/collection/store/dataSource/index.js +7 -0
  245. package/dist/collection/store/dataSource/index.js.map +1 -0
  246. package/dist/collection/store/dataSource/trimmed.plugin.js +34 -0
  247. package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -0
  248. package/dist/collection/store/dimension/dimension.helpers.js +101 -0
  249. package/dist/collection/store/dimension/dimension.helpers.js.map +1 -0
  250. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
  251. package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
  252. package/dist/collection/store/dimension/dimension.store.js +109 -0
  253. package/dist/collection/store/dimension/dimension.store.js.map +1 -0
  254. package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
  255. package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
  256. package/dist/collection/store/dimension/index.js +6 -0
  257. package/dist/collection/store/dimension/index.js.map +1 -0
  258. package/dist/collection/store/index.js +17 -0
  259. package/dist/collection/store/index.js.map +1 -0
  260. package/dist/collection/store/selection/index.js +6 -0
  261. package/dist/collection/store/selection/index.js.map +1 -0
  262. package/dist/collection/store/selection/selection.helpers.js +53 -0
  263. package/dist/collection/store/selection/selection.helpers.js.map +1 -0
  264. package/dist/collection/store/selection/selection.store.js +85 -0
  265. package/dist/collection/store/selection/selection.store.js.map +1 -0
  266. package/dist/collection/store/vp/index.js +6 -0
  267. package/dist/collection/store/vp/index.js.map +1 -0
  268. package/dist/collection/store/vp/viewport.helpers.js +251 -0
  269. package/dist/collection/store/vp/viewport.helpers.js.map +1 -0
  270. package/dist/collection/store/vp/viewport.store.js +151 -0
  271. package/dist/collection/store/vp/viewport.store.js.map +1 -0
  272. package/dist/collection/themeManager/theme.compact.js +9 -0
  273. package/dist/collection/themeManager/theme.compact.js.map +1 -0
  274. package/dist/collection/themeManager/theme.default.js +9 -0
  275. package/dist/collection/themeManager/theme.default.js.map +1 -0
  276. package/dist/collection/themeManager/theme.material.js +9 -0
  277. package/dist/collection/themeManager/theme.material.js.map +1 -0
  278. package/dist/collection/themeManager/theme.service.js +53 -0
  279. package/dist/collection/themeManager/theme.service.js.map +1 -0
  280. package/dist/collection/types/dimension.js +2 -0
  281. package/dist/collection/types/dimension.js.map +1 -0
  282. package/dist/collection/types/events.js +118 -0
  283. package/dist/collection/types/events.js.map +1 -0
  284. package/dist/collection/types/index.js +12 -0
  285. package/dist/collection/types/index.js.map +1 -0
  286. package/dist/collection/types/interfaces.js +2 -0
  287. package/dist/collection/types/interfaces.js.map +1 -0
  288. package/dist/collection/types/plugin.js +2 -0
  289. package/dist/collection/types/plugin.js.map +1 -0
  290. package/dist/collection/types/plugin.types.js +2 -0
  291. package/dist/collection/types/plugin.types.js.map +1 -0
  292. package/dist/collection/types/selection.js +2 -0
  293. package/dist/collection/types/selection.js.map +1 -0
  294. package/dist/collection/types/theme.js +2 -0
  295. package/dist/collection/types/theme.js.map +1 -0
  296. package/dist/collection/types/viewport.interfaces.js +2 -0
  297. package/dist/collection/types/viewport.interfaces.js.map +1 -0
  298. package/dist/collection/utils/browser.js +7 -0
  299. package/dist/collection/utils/browser.js.map +1 -0
  300. package/dist/collection/utils/closest.polifill.js +22 -0
  301. package/dist/collection/utils/closest.polifill.js.map +1 -0
  302. package/dist/collection/utils/column.utils.js +153 -0
  303. package/dist/collection/utils/column.utils.js.map +1 -0
  304. package/dist/collection/utils/consts.js +26 -0
  305. package/dist/collection/utils/consts.js.map +1 -0
  306. package/dist/collection/utils/events.js +39 -0
  307. package/dist/collection/utils/events.js.map +1 -0
  308. package/dist/collection/utils/header.utils.js +24 -0
  309. package/dist/collection/utils/header.utils.js.map +1 -0
  310. package/dist/collection/utils/index.js +140 -0
  311. package/dist/collection/utils/index.js.map +1 -0
  312. package/dist/collection/utils/key.codes.js +80 -0
  313. package/dist/collection/utils/key.codes.js.map +1 -0
  314. package/dist/collection/utils/key.utils.js +90 -0
  315. package/dist/collection/utils/key.utils.js.map +1 -0
  316. package/dist/collection/utils/mobile.js +7 -0
  317. package/dist/collection/utils/mobile.js.map +1 -0
  318. package/dist/collection/utils/platform.js +9 -0
  319. package/dist/collection/utils/platform.js.map +1 -0
  320. package/dist/collection/utils/row-header-utils.js +9 -0
  321. package/dist/collection/utils/row-header-utils.js.map +1 -0
  322. package/dist/collection/utils/store.types.js +2 -0
  323. package/dist/collection/utils/store.types.js.map +1 -0
  324. package/dist/collection/utils/store.utils.js +15 -0
  325. package/dist/collection/utils/store.utils.js.map +1 -0
  326. package/dist/esm/app-globals-FBz64o-g.js +14 -0
  327. package/dist/esm/app-globals-FBz64o-g.js.map +1 -0
  328. package/dist/esm/cell-renderer-Ca_PCGjJ.js +98 -0
  329. package/dist/esm/cell-renderer-Ca_PCGjJ.js.map +1 -0
  330. package/dist/esm/column.drag.plugin-BtuUyB-2.js +2528 -0
  331. package/dist/esm/column.drag.plugin-BtuUyB-2.js.map +1 -0
  332. package/dist/esm/column.service-CTqFIQUy.js +1343 -0
  333. package/dist/esm/column.service-CTqFIQUy.js.map +1 -0
  334. package/dist/esm/data.store-B-lvmoFH.js +3553 -0
  335. package/dist/esm/data.store-B-lvmoFH.js.map +1 -0
  336. package/dist/esm/debounce-DTUQ1fY7.js +488 -0
  337. package/dist/esm/debounce-DTUQ1fY7.js.map +1 -0
  338. package/dist/esm/edit.utils-CyCANCLB.js +103 -0
  339. package/dist/esm/edit.utils-CyCANCLB.js.map +1 -0
  340. package/dist/esm/events-CKtYJJSv.js +43 -0
  341. package/dist/esm/events-CKtYJJSv.js.map +1 -0
  342. package/dist/esm/filter.button-CjABZQgg.js +39 -0
  343. package/dist/esm/filter.button-CjABZQgg.js.map +1 -0
  344. package/dist/esm/header-cell-renderer-DnjpJuXq.js +351 -0
  345. package/dist/esm/header-cell-renderer-DnjpJuXq.js.map +1 -0
  346. package/dist/esm/index-BAoInZ4V.js +2519 -0
  347. package/dist/esm/index-BAoInZ4V.js.map +1 -0
  348. package/dist/esm/index.js +181 -0
  349. package/dist/esm/index.js.map +1 -0
  350. package/dist/esm/loader.js +17 -0
  351. package/dist/esm/loader.js.map +1 -0
  352. package/dist/esm/revo-grid.entry.js +2185 -0
  353. package/dist/esm/revo-grid.entry.js.map +1 -0
  354. package/dist/esm/revo-grid.js +27 -0
  355. package/dist/esm/revo-grid.js.map +1 -0
  356. package/dist/esm/revogr-attribution.revogr-extra.revogr-focus.revogr-overlay-selection.revogr-row-headers.revogr-scroll-virtual.revogr-temp-range.entry.js.map +1 -0
  357. package/dist/esm/revogr-attribution_7.entry.js +1455 -0
  358. package/dist/esm/revogr-attribution_7.entry.js.map +1 -0
  359. package/dist/esm/revogr-clipboard.revogr-edit.revogr-order-editor.entry.js.map +1 -0
  360. package/dist/esm/revogr-clipboard_3.entry.js +452 -0
  361. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -0
  362. package/dist/esm/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.js.map +1 -0
  363. package/dist/esm/revogr-data_4.entry.js +943 -0
  364. package/dist/esm/revogr-data_4.entry.js.map +1 -0
  365. package/dist/esm/revogr-filter-panel.entry.js +380 -0
  366. package/dist/esm/revogr-filter-panel.entry.js.map +1 -0
  367. package/dist/esm/row-header-utils-vnoLGj5A.js +407 -0
  368. package/dist/esm/row-header-utils-vnoLGj5A.js.map +1 -0
  369. package/dist/esm/text-editor-Cp7lwBZi.js +79 -0
  370. package/dist/esm/text-editor-Cp7lwBZi.js.map +1 -0
  371. package/dist/esm/throttle-DiUrHjcY.js +273 -0
  372. package/dist/esm/throttle-DiUrHjcY.js.map +1 -0
  373. package/dist/esm/viewport.helpers-Ch4AQMMg.js +53 -0
  374. package/dist/esm/viewport.helpers-Ch4AQMMg.js.map +1 -0
  375. package/dist/index.cjs.js +1 -0
  376. package/dist/index.d.ts +1 -0
  377. package/dist/index.js +1 -0
  378. package/dist/revo-grid/app-globals-FBz64o-g.js +14 -0
  379. package/dist/revo-grid/app-globals-FBz64o-g.js.map +1 -0
  380. package/dist/revo-grid/cell-renderer-Ca_PCGjJ.js +98 -0
  381. package/dist/revo-grid/cell-renderer-Ca_PCGjJ.js.map +1 -0
  382. package/dist/revo-grid/column.drag.plugin-BtuUyB-2.js +2528 -0
  383. package/dist/revo-grid/column.drag.plugin-BtuUyB-2.js.map +1 -0
  384. package/dist/revo-grid/column.service-CTqFIQUy.js +1343 -0
  385. package/dist/revo-grid/column.service-CTqFIQUy.js.map +1 -0
  386. package/dist/revo-grid/data.store-B-lvmoFH.js +3553 -0
  387. package/dist/revo-grid/data.store-B-lvmoFH.js.map +1 -0
  388. package/dist/revo-grid/debounce-DTUQ1fY7.js +488 -0
  389. package/dist/revo-grid/debounce-DTUQ1fY7.js.map +1 -0
  390. package/dist/revo-grid/edit.utils-CyCANCLB.js +103 -0
  391. package/dist/revo-grid/edit.utils-CyCANCLB.js.map +1 -0
  392. package/dist/revo-grid/events-CKtYJJSv.js +43 -0
  393. package/dist/revo-grid/events-CKtYJJSv.js.map +1 -0
  394. package/dist/revo-grid/filter.button-CjABZQgg.js +39 -0
  395. package/dist/revo-grid/filter.button-CjABZQgg.js.map +1 -0
  396. package/dist/revo-grid/header-cell-renderer-DnjpJuXq.js +351 -0
  397. package/dist/revo-grid/header-cell-renderer-DnjpJuXq.js.map +1 -0
  398. package/dist/revo-grid/index-BAoInZ4V.js +2490 -0
  399. package/dist/revo-grid/index-BAoInZ4V.js.map +1 -0
  400. package/dist/revo-grid/index.esm.js +181 -0
  401. package/dist/revo-grid/index.esm.js.map +1 -0
  402. package/dist/revo-grid/loader.esm.js.map +1 -0
  403. package/dist/revo-grid/revo-grid.entry.esm.js.map +1 -0
  404. package/dist/revo-grid/revo-grid.entry.js +2185 -0
  405. package/dist/revo-grid/revo-grid.entry.js.map +1 -0
  406. package/dist/revo-grid/revo-grid.esm.js +27 -0
  407. package/dist/revo-grid/revo-grid.esm.js.map +1 -0
  408. package/dist/revo-grid/revogr-attribution.revogr-extra.revogr-focus.revogr-overlay-selection.revogr-row-headers.revogr-scroll-virtual.revogr-temp-range.entry.esm.js.map +1 -0
  409. package/dist/revo-grid/revogr-attribution_7.entry.js +1455 -0
  410. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -0
  411. package/dist/revo-grid/revogr-clipboard.revogr-edit.revogr-order-editor.entry.esm.js.map +1 -0
  412. package/dist/revo-grid/revogr-clipboard_3.entry.js +452 -0
  413. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -0
  414. package/dist/revo-grid/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.esm.js.map +1 -0
  415. package/dist/revo-grid/revogr-data_4.entry.js +943 -0
  416. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -0
  417. package/dist/revo-grid/revogr-filter-panel.entry.esm.js.map +1 -0
  418. package/dist/revo-grid/revogr-filter-panel.entry.js +380 -0
  419. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -0
  420. package/dist/revo-grid/row-header-utils-vnoLGj5A.js +407 -0
  421. package/dist/revo-grid/row-header-utils-vnoLGj5A.js.map +1 -0
  422. package/dist/revo-grid/text-editor-Cp7lwBZi.js +79 -0
  423. package/dist/revo-grid/text-editor-Cp7lwBZi.js.map +1 -0
  424. package/dist/revo-grid/throttle-DiUrHjcY.js +273 -0
  425. package/dist/revo-grid/throttle-DiUrHjcY.js.map +1 -0
  426. package/dist/revo-grid/viewport.helpers-Ch4AQMMg.js +53 -0
  427. package/dist/revo-grid/viewport.helpers-Ch4AQMMg.js.map +1 -0
  428. package/dist/types/components/attribution/revogr-attribution.d.ts +12 -0
  429. package/dist/types/components/clipboard/revogr-clipboard.d.ts +89 -0
  430. package/dist/types/components/data/cell-renderer.d.ts +12 -0
  431. package/dist/types/components/data/column.service.d.ts +61 -0
  432. package/dist/types/components/data/revogr-data.d.ts +107 -0
  433. package/dist/types/components/data/row-highlight.plugin.d.ts +10 -0
  434. package/dist/types/components/data/row-renderer.d.ts +12 -0
  435. package/dist/types/components/editors/edit.utils.d.ts +3 -0
  436. package/dist/types/components/editors/revogr-edit.d.ts +63 -0
  437. package/dist/types/components/editors/text-editor.d.ts +43 -0
  438. package/dist/types/components/extra/revogr-extra.d.ts +38 -0
  439. package/dist/types/components/header/header-cell-renderer.d.ts +9 -0
  440. package/dist/types/components/header/header-group-renderer.d.ts +15 -0
  441. package/dist/types/components/header/header-renderer.d.ts +16 -0
  442. package/dist/types/components/header/resizable.directive.d.ts +55 -0
  443. package/dist/types/components/header/resizable.element.d.ts +5 -0
  444. package/dist/types/components/header/revogr-header.d.ts +90 -0
  445. package/dist/types/components/order/order-renderer.d.ts +29 -0
  446. package/dist/types/components/order/order-row.service.d.ts +27 -0
  447. package/dist/types/components/order/revogr-order-editor.d.ts +56 -0
  448. package/dist/types/components/overlay/autofill.service.d.ts +80 -0
  449. package/dist/types/components/overlay/keyboard.service.d.ts +28 -0
  450. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +278 -0
  451. package/dist/types/components/overlay/selection.utils.d.ts +47 -0
  452. package/dist/types/components/revoGrid/grid.helpers.d.ts +17 -0
  453. package/dist/types/components/revoGrid/plugin.service.d.ts +37 -0
  454. package/dist/types/components/revoGrid/revo-grid.d.ts +686 -0
  455. package/dist/types/components/revoGrid/viewport.helpers.d.ts +39 -0
  456. package/dist/types/components/revoGrid/viewport.resize.service.d.ts +17 -0
  457. package/dist/types/components/revoGrid/viewport.scrolling.service.d.ts +20 -0
  458. package/dist/types/components/revoGrid/viewport.service.d.ts +59 -0
  459. package/dist/types/components/rowHeaders/revogr-row-headers.d.ts +51 -0
  460. package/dist/types/components/rowHeaders/row-header-render.d.ts +9 -0
  461. package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +117 -0
  462. package/dist/types/components/scrollable/autohide-scroll.plugin.d.ts +22 -0
  463. package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +43 -0
  464. package/dist/types/components/selectionFocus/revogr-focus.d.ts +58 -0
  465. package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +28 -0
  466. package/dist/types/components/vnode/vnode-converter.d.ts +19 -0
  467. package/dist/types/components/vnode/vnode.utils.d.ts +9 -0
  468. package/dist/types/components.d.ts +2583 -0
  469. package/dist/types/global/global.d.ts +1 -0
  470. package/dist/types/index.d.ts +9 -0
  471. package/dist/types/plugins/add-rows-on-paste.plugin.d.ts +14 -0
  472. package/dist/types/plugins/base.plugin.d.ts +51 -0
  473. package/dist/types/plugins/column.auto-size.plugin.d.ts +55 -0
  474. package/dist/types/plugins/column.stretch.plugin.d.ts +20 -0
  475. package/dist/types/plugins/dispatcher.d.ts +20 -0
  476. package/dist/types/plugins/export/csv.d.ts +9 -0
  477. package/dist/types/plugins/export/export.plugin.d.ts +24 -0
  478. package/dist/types/plugins/export/types.d.ts +23 -0
  479. package/dist/types/plugins/filter/conditions/equal.d.ts +4 -0
  480. package/dist/types/plugins/filter/conditions/number/greaterThan.d.ts +3 -0
  481. package/dist/types/plugins/filter/conditions/number/greaterThanOrEqual.d.ts +3 -0
  482. package/dist/types/plugins/filter/conditions/number/lessThan.d.ts +3 -0
  483. package/dist/types/plugins/filter/conditions/number/lessThanOrEqual.d.ts +3 -0
  484. package/dist/types/plugins/filter/conditions/set.d.ts +4 -0
  485. package/dist/types/plugins/filter/conditions/string/beginswith.d.ts +3 -0
  486. package/dist/types/plugins/filter/conditions/string/contains.d.ts +4 -0
  487. package/dist/types/plugins/filter/filter.button.d.ts +14 -0
  488. package/dist/types/plugins/filter/filter.indexed.d.ts +20 -0
  489. package/dist/types/plugins/filter/filter.panel.d.ts +53 -0
  490. package/dist/types/plugins/filter/filter.plugin.d.ts +73 -0
  491. package/dist/types/plugins/filter/filter.types.d.ts +129 -0
  492. package/dist/types/plugins/groupingRow/grouping.const.d.ts +12 -0
  493. package/dist/types/plugins/groupingRow/grouping.row.expand.service.d.ts +15 -0
  494. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +39 -0
  495. package/dist/types/plugins/groupingRow/grouping.row.renderer.d.ts +6 -0
  496. package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +103 -0
  497. package/dist/types/plugins/groupingRow/grouping.service.d.ts +36 -0
  498. package/dist/types/plugins/groupingRow/grouping.trimmed.service.d.ts +10 -0
  499. package/dist/types/plugins/index.d.ts +11 -0
  500. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +42 -0
  501. package/dist/types/plugins/moveColumn/order-column.handler.d.ts +16 -0
  502. package/dist/types/plugins/rtl/rtl.plugin.d.ts +37 -0
  503. package/dist/types/plugins/sorting/sorting.func.d.ts +9 -0
  504. package/dist/types/plugins/sorting/sorting.plugin.d.ts +48 -0
  505. package/dist/types/plugins/sorting/sorting.sign.d.ts +6 -0
  506. package/dist/types/plugins/sorting/sorting.types.d.ts +14 -0
  507. package/dist/types/plugins/wcag/index.d.ts +26 -0
  508. package/dist/types/services/cell.helpers.d.ts +2 -0
  509. package/dist/types/services/column.data.provider.d.ts +27 -0
  510. package/dist/types/services/data.provider.d.ts +36 -0
  511. package/dist/types/services/dimension.provider.d.ts +66 -0
  512. package/dist/types/services/local.scroll.service.d.ts +36 -0
  513. package/dist/types/services/local.scroll.timer.d.ts +32 -0
  514. package/dist/types/services/selection.store.connector.d.ts +79 -0
  515. package/dist/types/services/viewport.provider.d.ts +7 -0
  516. package/dist/types/stencil-public-runtime.d.ts +1709 -0
  517. package/dist/types/store/dataSource/data.proxy.d.ts +14 -0
  518. package/dist/types/store/dataSource/data.store.d.ts +74 -0
  519. package/dist/types/store/dataSource/index.d.ts +3 -0
  520. package/dist/types/store/dataSource/trimmed.plugin.d.ts +12 -0
  521. package/dist/types/store/dimension/dimension.helpers.d.ts +24 -0
  522. package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
  523. package/dist/types/store/dimension/dimension.store.d.ts +21 -0
  524. package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
  525. package/dist/types/store/dimension/index.d.ts +2 -0
  526. package/dist/types/store/index.d.ts +8 -0
  527. package/dist/types/store/selection/index.d.ts +2 -0
  528. package/dist/types/store/selection/selection.helpers.d.ts +6 -0
  529. package/dist/types/store/selection/selection.store.d.ts +22 -0
  530. package/dist/types/store/vp/index.d.ts +7 -0
  531. package/dist/types/store/vp/viewport.helpers.d.ts +54 -0
  532. package/dist/types/store/vp/viewport.store.d.ts +26 -0
  533. package/dist/types/themeManager/theme.compact.d.ts +4 -0
  534. package/dist/types/themeManager/theme.default.d.ts +4 -0
  535. package/dist/types/themeManager/theme.material.d.ts +4 -0
  536. package/dist/types/themeManager/theme.service.d.ts +13 -0
  537. package/dist/types/types/dimension.d.ts +8 -0
  538. package/dist/types/types/events.d.ts +2 -0
  539. package/dist/types/types/index.d.ts +8 -0
  540. package/dist/types/types/interfaces.d.ts +768 -0
  541. package/dist/types/types/plugin.d.ts +9 -0
  542. package/dist/types/types/plugin.types.d.ts +48 -0
  543. package/dist/types/types/selection.d.ts +178 -0
  544. package/dist/types/types/theme.d.ts +7 -0
  545. package/dist/types/types/viewport.interfaces.d.ts +45 -0
  546. package/dist/types/utils/browser.d.ts +1 -0
  547. package/dist/types/utils/closest.polifill.d.ts +0 -0
  548. package/dist/types/utils/column.utils.d.ts +52 -0
  549. package/dist/types/utils/consts.d.ts +22 -0
  550. package/dist/types/utils/events.d.ts +5 -0
  551. package/dist/types/utils/header.utils.d.ts +2 -0
  552. package/dist/types/utils/index.d.ts +32 -0
  553. package/dist/types/utils/key.codes.d.ts +73 -0
  554. package/dist/types/utils/key.utils.d.ts +13 -0
  555. package/dist/types/utils/mobile.d.ts +1 -0
  556. package/dist/types/utils/platform.d.ts +4 -0
  557. package/dist/types/utils/row-header-utils.d.ts +2 -0
  558. package/dist/types/utils/store.types.d.ts +97 -0
  559. package/dist/types/utils/store.utils.d.ts +10 -0
  560. package/hydrate/index.d.ts +273 -0
  561. package/hydrate/index.js +33890 -0
  562. package/hydrate/index.mjs +33882 -0
  563. package/hydrate/package.json +12 -0
  564. package/loader/cdn.js +4 -0
  565. package/loader/index.cjs.js +4 -0
  566. package/loader/index.d.ts +24 -0
  567. package/loader/index.es2017.js +4 -0
  568. package/loader/index.js +5 -0
  569. package/package.json +101 -0
  570. package/react/dist/index.d.ts +6191 -0
  571. package/react/dist/react-datagrid.js +260 -0
  572. package/react/dist/react-datagrid.umd.cjs +272 -0
  573. package/standalone/column.service.js +1345 -0
  574. package/standalone/column.service.js.map +1 -0
  575. package/standalone/consts.js +30 -0
  576. package/standalone/consts.js.map +1 -0
  577. package/standalone/data.store.js +3099 -0
  578. package/standalone/data.store.js.map +1 -0
  579. package/standalone/debounce.js +215 -0
  580. package/standalone/debounce.js.map +1 -0
  581. package/standalone/dimension.helpers.js +229 -0
  582. package/standalone/dimension.helpers.js.map +1 -0
  583. package/standalone/filter.button.js +39 -0
  584. package/standalone/filter.button.js.map +1 -0
  585. package/standalone/index.d.ts +68 -0
  586. package/standalone/index.js +217 -0
  587. package/standalone/index.js.map +1 -0
  588. package/standalone/index2.js +140 -0
  589. package/standalone/index2.js.map +1 -0
  590. package/standalone/local.scroll.timer.js +207 -0
  591. package/standalone/local.scroll.timer.js.map +1 -0
  592. package/standalone/platform.js +90 -0
  593. package/standalone/platform.js.map +1 -0
  594. package/standalone/revo-grid.d.ts +11 -0
  595. package/standalone/revo-grid.js +4884 -0
  596. package/standalone/revo-grid.js.map +1 -0
  597. package/standalone/revogr-attribution.d.ts +11 -0
  598. package/standalone/revogr-attribution.js +12 -0
  599. package/standalone/revogr-attribution.js.map +1 -0
  600. package/standalone/revogr-attribution2.js +32 -0
  601. package/standalone/revogr-attribution2.js.map +1 -0
  602. package/standalone/revogr-clipboard.d.ts +11 -0
  603. package/standalone/revogr-clipboard.js +12 -0
  604. package/standalone/revogr-clipboard.js.map +1 -0
  605. package/standalone/revogr-clipboard2.js +164 -0
  606. package/standalone/revogr-clipboard2.js.map +1 -0
  607. package/standalone/revogr-data.d.ts +11 -0
  608. package/standalone/revogr-data.js +12 -0
  609. package/standalone/revogr-data.js.map +1 -0
  610. package/standalone/revogr-data2.js +378 -0
  611. package/standalone/revogr-data2.js.map +1 -0
  612. package/standalone/revogr-edit.d.ts +11 -0
  613. package/standalone/revogr-edit.js +12 -0
  614. package/standalone/revogr-edit.js.map +1 -0
  615. package/standalone/revogr-edit2.js +334 -0
  616. package/standalone/revogr-edit2.js.map +1 -0
  617. package/standalone/revogr-extra.d.ts +11 -0
  618. package/standalone/revogr-extra.js +12 -0
  619. package/standalone/revogr-extra.js.map +1 -0
  620. package/standalone/revogr-extra2.js +73 -0
  621. package/standalone/revogr-extra2.js.map +1 -0
  622. package/standalone/revogr-filter-panel.d.ts +11 -0
  623. package/standalone/revogr-filter-panel.js +411 -0
  624. package/standalone/revogr-filter-panel.js.map +1 -0
  625. package/standalone/revogr-focus.d.ts +11 -0
  626. package/standalone/revogr-focus.js +12 -0
  627. package/standalone/revogr-focus.js.map +1 -0
  628. package/standalone/revogr-focus2.js +112 -0
  629. package/standalone/revogr-focus2.js.map +1 -0
  630. package/standalone/revogr-header.d.ts +11 -0
  631. package/standalone/revogr-header.js +12 -0
  632. package/standalone/revogr-header.js.map +1 -0
  633. package/standalone/revogr-header2.js +707 -0
  634. package/standalone/revogr-header2.js.map +1 -0
  635. package/standalone/revogr-order-editor.d.ts +11 -0
  636. package/standalone/revogr-order-editor.js +12 -0
  637. package/standalone/revogr-order-editor.js.map +1 -0
  638. package/standalone/revogr-order-editor2.js +201 -0
  639. package/standalone/revogr-order-editor2.js.map +1 -0
  640. package/standalone/revogr-overlay-selection.d.ts +11 -0
  641. package/standalone/revogr-overlay-selection.js +12 -0
  642. package/standalone/revogr-overlay-selection.js.map +1 -0
  643. package/standalone/revogr-overlay-selection2.js +972 -0
  644. package/standalone/revogr-overlay-selection2.js.map +1 -0
  645. package/standalone/revogr-row-headers.d.ts +11 -0
  646. package/standalone/revogr-row-headers.js +12 -0
  647. package/standalone/revogr-row-headers.js.map +1 -0
  648. package/standalone/revogr-row-headers2.js +520 -0
  649. package/standalone/revogr-row-headers2.js.map +1 -0
  650. package/standalone/revogr-scroll-virtual.d.ts +11 -0
  651. package/standalone/revogr-scroll-virtual.js +12 -0
  652. package/standalone/revogr-scroll-virtual.js.map +1 -0
  653. package/standalone/revogr-scroll-virtual2.js +184 -0
  654. package/standalone/revogr-scroll-virtual2.js.map +1 -0
  655. package/standalone/revogr-temp-range.d.ts +11 -0
  656. package/standalone/revogr-temp-range.js +12 -0
  657. package/standalone/revogr-temp-range.js.map +1 -0
  658. package/standalone/revogr-temp-range2.js +93 -0
  659. package/standalone/revogr-temp-range2.js.map +1 -0
  660. package/standalone/revogr-viewport-scroll.d.ts +11 -0
  661. package/standalone/revogr-viewport-scroll.js +12 -0
  662. package/standalone/revogr-viewport-scroll.js.map +1 -0
  663. package/standalone/revogr-viewport-scroll2.js +421 -0
  664. package/standalone/revogr-viewport-scroll2.js.map +1 -0
  665. package/standalone/selection.utils.js +179 -0
  666. package/standalone/selection.utils.js.map +1 -0
  667. package/standalone/throttle.js +75 -0
  668. package/standalone/throttle.js.map +1 -0
  669. package/standalone/toNumber.js +282 -0
  670. package/standalone/toNumber.js.map +1 -0
  671. package/standalone/vnode-converter.js +46 -0
  672. package/standalone/vnode-converter.js.map +1 -0
  673. package/standalone/vnode-html.d.ts +11 -0
  674. package/standalone/vnode-html.js +12 -0
  675. package/standalone/vnode-html.js.map +1 -0
@@ -0,0 +1,2528 @@
1
+ /*!
2
+ * Built by LevelSkill.Pro
3
+ */
4
+ import { I as reduce, N as baseEach, A as getColumnType, H as columnTypes, O as toInteger, s as isGrouping, r as getGroupingName, J as rowTypes, z as getCellDataParsed, y as getCellRaw, F as getColumnByProp, f as GROUP_EXPANDED, v as getParsedGroup, w as isSameGroup, G as GROUP_DEPTH, d as PSEUDO_GROUP_ITEM_VALUE, b as PSEUDO_GROUP_ITEM_ID, m as GROUPING_ROW_TYPE, o as getSource, e as PSEUDO_GROUP_COLUMN, q as gatherGrouping, l as GROUP_EXPAND_EVENT, t as isGroupingColumn, p as getExpanded, C as isColGrouping } from './column.service-CTqFIQUy.js';
5
+ import { Y as createStore, y as setStore, i as calculateDimensionData, Z as identity, _ as isArray, b as getSourceItem, u as getScrollbarSize, w as timeout, $ as baseProperty, a0 as isArrayLike, a1 as getTag, a2 as baseKeys, g as getPhysical, e as setItems, j as getItemByPosition } from './data.store-B-lvmoFH.js';
6
+ import { f as calculateRowHeaderSize } from './row-header-utils-vnoLGj5A.js';
7
+ import { h } from './index-BAoInZ4V.js';
8
+ import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-CjABZQgg.js';
9
+ import { i as isObjectLike, b as baseGetTag, d as debounce } from './debounce-DTUQ1fY7.js';
10
+ import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-DnjpJuXq.js';
11
+
12
+ /**
13
+ * Plugin which recalculates realSize on changes of sizes, originItemSize and count
14
+ */
15
+ const recalculateRealSizePlugin = (storeService) => {
16
+ /**
17
+ * Recalculates realSize if size, origin size or count changes
18
+ */
19
+ return {
20
+ /**
21
+ * Reacts on changes of count, sizes and originItemSize
22
+ */
23
+ set(k) {
24
+ switch (k) {
25
+ case 'count':
26
+ case 'sizes':
27
+ case 'originItemSize': {
28
+ // recalculate realSize
29
+ let realSize = 0;
30
+ const count = storeService.store.get('count');
31
+ for (let i = 0; i < count; i++) {
32
+ realSize +=
33
+ storeService.store.get('sizes')[i] ||
34
+ storeService.store.get('originItemSize');
35
+ }
36
+ storeService.setStore({ realSize });
37
+ break;
38
+ }
39
+ }
40
+ },
41
+ };
42
+ };
43
+
44
+ /**
45
+ * Plugin for trimming
46
+ *
47
+ * 1.a. Retrieves the previous sizes value. Saves the resulting trimmed data as a new sizes value.
48
+ * 1.b. Stores a reference to the trimmed data to prevent further changes.
49
+ * 2. Removes multiple and shifts the data based on the trimmed value.
50
+ */
51
+ const trimmedPlugin = (storeService) => {
52
+ let trimmingObject = null;
53
+ let trimmedPreviousSizes = null;
54
+ return {
55
+ set(key, val) {
56
+ switch (key) {
57
+ case 'sizes': {
58
+ // prevent changes after trimming
59
+ if (trimmingObject && trimmingObject === val) {
60
+ trimmingObject = null;
61
+ return;
62
+ }
63
+ trimmedPreviousSizes = null;
64
+ break;
65
+ }
66
+ case 'trimmed': {
67
+ const trim = val;
68
+ if (!trimmedPreviousSizes) {
69
+ trimmedPreviousSizes = storeService.store.get('sizes');
70
+ }
71
+ trimmingObject = removeMultipleAndShift(trimmedPreviousSizes, trim || {});
72
+ // save a reference to the trimmed object to prevent changes after trimming
73
+ storeService.setSizes(trimmingObject);
74
+ break;
75
+ }
76
+ }
77
+ },
78
+ };
79
+ };
80
+ function removeMultipleAndShift(items, toRemove) {
81
+ const newItems = {};
82
+ const sortedIndexes = Object.keys(items || {})
83
+ .map(Number)
84
+ .sort((a, b) => a - b);
85
+ const lastIndex = sortedIndexes[sortedIndexes.length - 1];
86
+ let shift = 0;
87
+ for (let i = 0; i <= lastIndex; i++) {
88
+ if (toRemove[i] !== undefined) {
89
+ shift++;
90
+ // skip already removed
91
+ if (items[i] !== undefined) {
92
+ continue;
93
+ }
94
+ }
95
+ if (items[i] !== undefined) {
96
+ newItems[i - shift] = items[i];
97
+ }
98
+ }
99
+ return newItems;
100
+ }
101
+
102
+ /**
103
+ * Storing pre-calculated
104
+ * Dimension information and sizes
105
+ */
106
+ function initialBase() {
107
+ return {
108
+ indexes: [],
109
+ count: 0,
110
+ // hidden items
111
+ trimmed: null,
112
+ // virtual item index to size
113
+ sizes: {},
114
+ // order in indexes[] to coordinate
115
+ positionIndexToItem: {},
116
+ // initial element to coordinate ^
117
+ indexToItem: {},
118
+ positionIndexes: [],
119
+ };
120
+ }
121
+ function initialState() {
122
+ return Object.assign(Object.assign({}, initialBase()), {
123
+ // size which all items can take
124
+ realSize: 0,
125
+ // initial item size if it wasn't changed
126
+ originItemSize: 0 });
127
+ }
128
+ class DimensionStore {
129
+ constructor(type) {
130
+ this.type = type;
131
+ this.store = createStore(initialState());
132
+ this.store.use(trimmedPlugin({
133
+ store: this.store,
134
+ setSizes: this.setDimensionSize.bind(this),
135
+ }));
136
+ this.store.use(recalculateRealSizePlugin({
137
+ store: this.store,
138
+ setStore: this.setStore.bind(this),
139
+ }));
140
+ }
141
+ getCurrentState() {
142
+ const state = initialState();
143
+ const keys = Object.keys(state);
144
+ return reduce(keys, (r, k) => {
145
+ const data = this.store.get(k);
146
+ r[k] = data;
147
+ return r;
148
+ }, state);
149
+ }
150
+ dispose() {
151
+ setStore(this.store, initialState());
152
+ }
153
+ setStore(data) {
154
+ setStore(this.store, data);
155
+ }
156
+ drop() {
157
+ setStore(this.store, initialBase());
158
+ }
159
+ /**
160
+ * Set custom dimension sizes and overwrite old
161
+ * Generates new indexes based on sizes
162
+ * @param sizes - sizes to set
163
+ */
164
+ setDimensionSize(sizes = {}) {
165
+ const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
166
+ setStore(this.store, Object.assign(Object.assign({}, dimensionData), { sizes }));
167
+ }
168
+ updateSizesPositionByIndexes(newItemsOrder, prevItemsOrder = []) {
169
+ // Move custom sizes to new order
170
+ const customSizes = Object.assign({}, this.store.get('sizes'));
171
+ if (!Object.keys(customSizes).length) {
172
+ return;
173
+ }
174
+ // Step 1: Create a map of original indices, but allow duplicates by storing arrays of indices
175
+ const originalIndices = {};
176
+ prevItemsOrder.forEach((physIndex, virtIndex) => {
177
+ if (!originalIndices[physIndex]) {
178
+ originalIndices[physIndex] = [];
179
+ }
180
+ originalIndices[physIndex].push(virtIndex); // Store all indices for each value
181
+ });
182
+ // Step 2: Create new sizes based on new item order
183
+ const newSizes = {};
184
+ newItemsOrder.forEach((physIndex, virtIndex) => {
185
+ const indices = originalIndices[physIndex]; // Get all original indices for this value
186
+ if (indices && indices.length > 0) {
187
+ const originalIndex = indices.shift(); // Get the first available original index
188
+ if (originalIndex !== undefined && originalIndex !== virtIndex && customSizes[originalIndex]) {
189
+ newSizes[virtIndex] = customSizes[originalIndex];
190
+ delete customSizes[originalIndex];
191
+ }
192
+ }
193
+ });
194
+ // Step 3: Set new sizes if there are changes
195
+ if (Object.keys(newSizes).length) {
196
+ this.setDimensionSize(Object.assign(Object.assign({}, customSizes), newSizes));
197
+ }
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Base layer for plugins
203
+ * Provide minimal starting core for plugins to work
204
+ * Extend this class to create plugin
205
+ */
206
+ class BasePlugin {
207
+ constructor(revogrid, providers) {
208
+ this.revogrid = revogrid;
209
+ this.providers = providers;
210
+ this.h = h;
211
+ this.subscriptions = {};
212
+ }
213
+ /**
214
+ *
215
+ * @param eventName - event name to subscribe to in revo-grid component (e.g. 'beforeheaderclick')
216
+ * @param callback - callback function for event
217
+ */
218
+ addEventListener(eventName, callback) {
219
+ this.revogrid.addEventListener(eventName, callback);
220
+ this.subscriptions[eventName] = callback;
221
+ }
222
+ /**
223
+ * Subscribe to property change in revo-grid component
224
+ * You can return false in callback to prevent default value set
225
+ *
226
+ * @param prop - property name
227
+ * @param callback - callback function
228
+ * @param immediate - trigger callback immediately with current value
229
+ */
230
+ watch(prop, callback, { immediate } = { immediate: false }) {
231
+ const nativeValueDesc = Object.getOwnPropertyDescriptor(this.revogrid, prop) ||
232
+ Object.getOwnPropertyDescriptor(this.revogrid.constructor.prototype, prop);
233
+ // Overwrite property descriptor for this instance
234
+ Object.defineProperty(this.revogrid, prop, {
235
+ set(val) {
236
+ var _a;
237
+ const keepDefault = callback(val);
238
+ if (keepDefault === false) {
239
+ return;
240
+ }
241
+ // Continue with native behavior
242
+ return (_a = nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.set) === null || _a === void 0 ? void 0 : _a.call(this, val);
243
+ },
244
+ get() {
245
+ var _a;
246
+ // Continue with native behavior
247
+ return (_a = nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.get) === null || _a === void 0 ? void 0 : _a.call(this);
248
+ },
249
+ });
250
+ if (immediate) {
251
+ callback(nativeValueDesc === null || nativeValueDesc === void 0 ? void 0 : nativeValueDesc.value);
252
+ }
253
+ }
254
+ /**
255
+ * Remove event listener
256
+ * @param eventName
257
+ */
258
+ removeEventListener(eventName) {
259
+ this.revogrid.removeEventListener(eventName, this.subscriptions[eventName]);
260
+ delete this.subscriptions[eventName];
261
+ }
262
+ /**
263
+ * Emit event from revo-grid component
264
+ * Event can be cancelled by calling event.preventDefault() in callback
265
+ */
266
+ emit(eventName, detail) {
267
+ const event = new CustomEvent(eventName, { detail, cancelable: true });
268
+ this.revogrid.dispatchEvent(event);
269
+ return event;
270
+ }
271
+ /**
272
+ * Clear all subscriptions
273
+ */
274
+ clearSubscriptions() {
275
+ for (let type in this.subscriptions) {
276
+ this.removeEventListener(type);
277
+ }
278
+ }
279
+ /**
280
+ * Destroy plugin and clear all subscriptions
281
+ */
282
+ destroy() {
283
+ this.clearSubscriptions();
284
+ }
285
+ }
286
+
287
+ /**
288
+ * A specialized version of `_.forEach` for arrays without support for
289
+ * iteratee shorthands.
290
+ *
291
+ * @private
292
+ * @param {Array} [array] The array to iterate over.
293
+ * @param {Function} iteratee The function invoked per iteration.
294
+ * @returns {Array} Returns `array`.
295
+ */
296
+ function arrayEach(array, iteratee) {
297
+ var index = -1,
298
+ length = array == null ? 0 : array.length;
299
+
300
+ while (++index < length) {
301
+ if (iteratee(array[index], index, array) === false) {
302
+ break;
303
+ }
304
+ }
305
+ return array;
306
+ }
307
+
308
+ /**
309
+ * Casts `value` to `identity` if it's not a function.
310
+ *
311
+ * @private
312
+ * @param {*} value The value to inspect.
313
+ * @returns {Function} Returns cast function.
314
+ */
315
+ function castFunction(value) {
316
+ return typeof value == 'function' ? value : identity;
317
+ }
318
+
319
+ /**
320
+ * Iterates over elements of `collection` and invokes `iteratee` for each element.
321
+ * The iteratee is invoked with three arguments: (value, index|key, collection).
322
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
323
+ *
324
+ * **Note:** As with other "Collections" methods, objects with a "length"
325
+ * property are iterated like arrays. To avoid this behavior use `_.forIn`
326
+ * or `_.forOwn` for object iteration.
327
+ *
328
+ * @static
329
+ * @memberOf _
330
+ * @since 0.1.0
331
+ * @alias each
332
+ * @category Collection
333
+ * @param {Array|Object} collection The collection to iterate over.
334
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
335
+ * @returns {Array|Object} Returns `collection`.
336
+ * @see _.forEachRight
337
+ * @example
338
+ *
339
+ * _.forEach([1, 2], function(value) {
340
+ * console.log(value);
341
+ * });
342
+ * // => Logs `1` then `2`.
343
+ *
344
+ * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
345
+ * console.log(key);
346
+ * });
347
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
348
+ */
349
+ function forEach(collection, iteratee) {
350
+ var func = isArray(collection) ? arrayEach : baseEach;
351
+ return func(collection, castFunction(iteratee));
352
+ }
353
+
354
+ /**
355
+ * Plugin module for revo-grid grid system
356
+ * Add support for automatic column resize
357
+ */
358
+ const LETTER_BLOCK_SIZE = 7;
359
+ class AutoSizeColumnPlugin extends BasePlugin {
360
+ constructor(revogrid, providers, config) {
361
+ super(revogrid, providers);
362
+ this.providers = providers;
363
+ this.config = config;
364
+ this.autoSizeColumns = null;
365
+ /** for edge case when no columns defined before data */
366
+ this.dataResolve = null;
367
+ this.dataReject = null;
368
+ this.letterBlockSize = (config === null || config === void 0 ? void 0 : config.letterBlockSize) || LETTER_BLOCK_SIZE;
369
+ // create test container to check text width
370
+ if (config === null || config === void 0 ? void 0 : config.preciseSize) {
371
+ this.precsizeCalculationArea = this.initiatePresizeElement();
372
+ revogrid.appendChild(this.precsizeCalculationArea);
373
+ }
374
+ const aftersourceset = ({ detail: { source }, }) => {
375
+ this.setSource(source);
376
+ };
377
+ const beforecolumnsset = ({ detail: { columns }, }) => {
378
+ this.columnSet(columns);
379
+ };
380
+ this.addEventListener('beforecolumnsset', beforecolumnsset);
381
+ switch (config === null || config === void 0 ? void 0 : config.mode) {
382
+ case "autoSizeOnTextOverlap" /* ColumnAutoSizeMode.autoSizeOnTextOverlap */:
383
+ this.addEventListener('aftersourceset', aftersourceset);
384
+ this.addEventListener('afteredit', ({ detail }) => {
385
+ this.afteredit(detail);
386
+ });
387
+ break;
388
+ case "autoSizeAll" /* ColumnAutoSizeMode.autoSizeAll */:
389
+ this.addEventListener('aftersourceset', aftersourceset);
390
+ this.addEventListener('afteredit', ({ detail }) => {
391
+ this.afterEditAll(detail);
392
+ });
393
+ break;
394
+ default:
395
+ this.addEventListener('headerdblclick', ({ detail }) => {
396
+ const type = getColumnType(detail.column);
397
+ const size = this.getColumnSize(detail.index, type);
398
+ if (size) {
399
+ this.providers.dimension.setCustomSizes(type, {
400
+ [detail.index]: size,
401
+ }, true);
402
+ }
403
+ });
404
+ break;
405
+ }
406
+ }
407
+ async setSource(source) {
408
+ let autoSize = this.autoSizeColumns;
409
+ if (this.dataReject) {
410
+ this.dataReject();
411
+ this.clearPromise();
412
+ }
413
+ /** If data set first and no column provided await until get one */
414
+ if (!autoSize) {
415
+ const request = new Promise((resolve, reject) => {
416
+ this.dataResolve = resolve;
417
+ this.dataReject = reject;
418
+ });
419
+ try {
420
+ autoSize = await request;
421
+ }
422
+ catch (e) {
423
+ return;
424
+ }
425
+ }
426
+ // calculate sizes
427
+ forEach(autoSize, (_v, type) => {
428
+ const sizes = {};
429
+ forEach(autoSize[type], rgCol => {
430
+ // calculate size
431
+ rgCol.size = sizes[rgCol.index] = source.reduce((prev, rgRow) => Math.max(prev, this.getLength(rgRow[rgCol.prop])), this.getLength(rgCol.name || ''));
432
+ });
433
+ this.providers.dimension.setCustomSizes(type, sizes, true);
434
+ });
435
+ }
436
+ getLength(len) {
437
+ var _a;
438
+ const padding = 15;
439
+ if (!len) {
440
+ return 0;
441
+ }
442
+ try {
443
+ const str = len.toString();
444
+ /**if exact calculation required proxy with html element, slow operation */
445
+ if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.preciseSize) {
446
+ this.precsizeCalculationArea.innerText = str;
447
+ return this.precsizeCalculationArea.scrollWidth + padding * 2;
448
+ }
449
+ return str.length * this.letterBlockSize + padding * 2;
450
+ }
451
+ catch (e) {
452
+ return 0;
453
+ }
454
+ }
455
+ afteredit(e) {
456
+ let data;
457
+ if (this.isRangeEdit(e)) {
458
+ data = e.data;
459
+ }
460
+ else {
461
+ data = { 0: { [e.prop]: e.val } };
462
+ }
463
+ forEach(this.autoSizeColumns, (columns, type) => {
464
+ const sizes = {};
465
+ forEach(columns, rgCol => {
466
+ var _a;
467
+ // calculate size
468
+ const size = reduce(data, (prev, rgRow) => {
469
+ if (typeof rgRow[rgCol.prop] === 'undefined') {
470
+ return prev;
471
+ }
472
+ return Math.max(prev || 0, this.getLength(rgRow[rgCol.prop]));
473
+ }, undefined);
474
+ if (size && ((_a = rgCol.size) !== null && _a !== void 0 ? _a : 0) < size) {
475
+ rgCol.size = sizes[rgCol.index] = size;
476
+ }
477
+ });
478
+ this.providers.dimension.setCustomSizes(type, sizes, true);
479
+ });
480
+ }
481
+ afterEditAll(e) {
482
+ const props = {};
483
+ if (this.isRangeEdit(e)) {
484
+ forEach(e.data, r => forEach(r, (_v, p) => (props[p] = true)));
485
+ }
486
+ else {
487
+ props[e.prop] = true;
488
+ }
489
+ forEach(this.autoSizeColumns, (columns, type) => {
490
+ const sizes = {};
491
+ forEach(columns, rgCol => {
492
+ if (props[rgCol.prop]) {
493
+ const size = this.getColumnSize(rgCol.index, type);
494
+ if (size) {
495
+ sizes[rgCol.index] = size;
496
+ }
497
+ }
498
+ });
499
+ this.providers.dimension.setCustomSizes(type, sizes, true);
500
+ });
501
+ }
502
+ getColumnSize(index, type) {
503
+ var _a, _b;
504
+ const rgCol = (_b = (_a = this.autoSizeColumns) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b[index];
505
+ if (!rgCol) {
506
+ return 0;
507
+ }
508
+ return reduce(this.providers.data.stores, (r, s) => {
509
+ const perStore = reduce(s.store.get('items'), (prev, _row, i) => {
510
+ const item = getSourceItem(s.store, i);
511
+ return Math.max(prev || 0, this.getLength(item === null || item === void 0 ? void 0 : item[rgCol.prop]));
512
+ }, 0);
513
+ return Math.max(r, perStore);
514
+ }, rgCol.size || 0);
515
+ }
516
+ columnSet(columns) {
517
+ var _a;
518
+ for (let t of columnTypes) {
519
+ const type = t;
520
+ const cols = columns[type];
521
+ for (let i in cols) {
522
+ if (cols[i].autoSize || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.allColumns)) {
523
+ if (!this.autoSizeColumns) {
524
+ this.autoSizeColumns = {};
525
+ }
526
+ if (!this.autoSizeColumns[type]) {
527
+ this.autoSizeColumns[type] = {};
528
+ }
529
+ this.autoSizeColumns[type][i] = Object.assign(Object.assign({}, cols[i]), { index: parseInt(i, 10) });
530
+ }
531
+ }
532
+ }
533
+ if (this.dataResolve) {
534
+ this.dataResolve(this.autoSizeColumns || {});
535
+ this.clearPromise();
536
+ }
537
+ }
538
+ clearPromise() {
539
+ this.dataResolve = null;
540
+ this.dataReject = null;
541
+ }
542
+ isRangeEdit(e) {
543
+ return !!e.data;
544
+ }
545
+ initiatePresizeElement() {
546
+ var _a;
547
+ const styleForFontTest = {
548
+ position: 'absolute',
549
+ fontSize: '14px',
550
+ height: '0',
551
+ width: '0',
552
+ whiteSpace: 'nowrap',
553
+ top: '0',
554
+ overflowX: 'scroll',
555
+ display: 'block',
556
+ };
557
+ const el = document.createElement('div');
558
+ for (let s in styleForFontTest) {
559
+ el.style[s] = (_a = styleForFontTest[s]) !== null && _a !== void 0 ? _a : '';
560
+ }
561
+ el.classList.add('revo-test-container');
562
+ return el;
563
+ }
564
+ destroy() {
565
+ var _a;
566
+ super.destroy();
567
+ (_a = this.precsizeCalculationArea) === null || _a === void 0 ? void 0 : _a.remove();
568
+ }
569
+ }
570
+
571
+ class StretchColumn extends BasePlugin {
572
+ constructor(revogrid, providers) {
573
+ super(revogrid, providers);
574
+ this.providers = providers;
575
+ this.stretchedColumn = null;
576
+ // calculate scroll bar size for current user session
577
+ this.scrollSize = getScrollbarSize(document);
578
+ // subscribe to column changes
579
+ const beforecolumnapplied = ({ detail: { columns }, }) => this.applyStretch(columns);
580
+ this.addEventListener('beforecolumnapplied', beforecolumnapplied);
581
+ }
582
+ setScroll({ type, hasScroll }) {
583
+ var _a;
584
+ if (type === 'rgRow' &&
585
+ this.stretchedColumn &&
586
+ ((_a = this.stretchedColumn) === null || _a === void 0 ? void 0 : _a.initialSize) === this.stretchedColumn.size) {
587
+ if (hasScroll) {
588
+ this.stretchedColumn.size -= this.scrollSize;
589
+ this.apply();
590
+ this.dropChanges();
591
+ }
592
+ }
593
+ }
594
+ activateChanges() {
595
+ const setScroll = ({ detail }) => this.setScroll(detail);
596
+ this.addEventListener('scrollchange', setScroll);
597
+ }
598
+ dropChanges() {
599
+ this.stretchedColumn = null;
600
+ this.removeEventListener('scrollchange');
601
+ }
602
+ apply() {
603
+ if (!this.stretchedColumn) {
604
+ return;
605
+ }
606
+ const type = 'rgCol';
607
+ const sizes = this.providers.dimension.stores[type].store.get('sizes');
608
+ this.providers.dimension.setCustomSizes(type, Object.assign(Object.assign({}, sizes), { [this.stretchedColumn.index]: this.stretchedColumn.size }), true);
609
+ }
610
+ /**
611
+ * Apply stretch changes
612
+ */
613
+ applyStretch(columns) {
614
+ // unsubscribe from all events
615
+ this.dropChanges();
616
+ // calculate grid size
617
+ let sizeDifference = this.revogrid.clientWidth - 1;
618
+ forEach(columns, (_, type) => {
619
+ const realSize = this.providers.dimension.stores[type].store.get('realSize');
620
+ sizeDifference -= realSize;
621
+ });
622
+ if (this.revogrid.rowHeaders) {
623
+ const itemsLength = this.providers.data.stores.rgRow.store.get('source').length;
624
+ const header = this.revogrid.rowHeaders;
625
+ const rowHeaderSize = calculateRowHeaderSize(itemsLength, typeof header === 'object' ? header : undefined);
626
+ if (rowHeaderSize) {
627
+ sizeDifference -= rowHeaderSize;
628
+ }
629
+ }
630
+ if (sizeDifference > 0) {
631
+ // currently plugin accepts last column only
632
+ const index = columns.rgCol.length - 1;
633
+ const last = columns.rgCol[index];
634
+ /**
635
+ * has column
636
+ * no auto size applied
637
+ * size for column shouldn't be defined
638
+ */
639
+ const colSize = (last === null || last === void 0 ? void 0 : last.size) || this.revogrid.colSize || 0;
640
+ const size = sizeDifference + colSize - 1;
641
+ if (last && !last.autoSize && colSize < size) {
642
+ this.stretchedColumn = {
643
+ initialSize: size,
644
+ index,
645
+ size,
646
+ };
647
+ this.apply();
648
+ this.activateChanges();
649
+ }
650
+ }
651
+ }
652
+ }
653
+ /**
654
+ * Check plugin type is Stretch
655
+ */
656
+ function isStretchPlugin(plugin) {
657
+ return !!plugin.applyStretch;
658
+ }
659
+
660
+ /**
661
+ * The base implementation of `_.clamp` which doesn't coerce arguments.
662
+ *
663
+ * @private
664
+ * @param {number} number The number to clamp.
665
+ * @param {number} [lower] The lower bound.
666
+ * @param {number} upper The upper bound.
667
+ * @returns {number} Returns the clamped number.
668
+ */
669
+ function baseClamp(number, lower, upper) {
670
+ if (number === number) {
671
+ {
672
+ number = number <= upper ? number : upper;
673
+ }
674
+ {
675
+ number = number >= lower ? number : lower;
676
+ }
677
+ }
678
+ return number;
679
+ }
680
+
681
+ /** Used as references for the maximum length and index of an array. */
682
+ var MAX_ARRAY_LENGTH = 4294967295;
683
+
684
+ /**
685
+ * Converts `value` to an integer suitable for use as the length of an
686
+ * array-like object.
687
+ *
688
+ * **Note:** This method is based on
689
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
690
+ *
691
+ * @static
692
+ * @memberOf _
693
+ * @since 4.0.0
694
+ * @category Lang
695
+ * @param {*} value The value to convert.
696
+ * @returns {number} Returns the converted integer.
697
+ * @example
698
+ *
699
+ * _.toLength(3.2);
700
+ * // => 3
701
+ *
702
+ * _.toLength(Number.MIN_VALUE);
703
+ * // => 0
704
+ *
705
+ * _.toLength(Infinity);
706
+ * // => 4294967295
707
+ *
708
+ * _.toLength('3.2');
709
+ * // => 3
710
+ */
711
+ function toLength(value) {
712
+ return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
713
+ }
714
+
715
+ /**
716
+ * The base implementation of `_.fill` without an iteratee call guard.
717
+ *
718
+ * @private
719
+ * @param {Array} array The array to fill.
720
+ * @param {*} value The value to fill `array` with.
721
+ * @param {number} [start=0] The start position.
722
+ * @param {number} [end=array.length] The end position.
723
+ * @returns {Array} Returns `array`.
724
+ */
725
+ function baseFill(array, value, start, end) {
726
+ var length = array.length;
727
+
728
+ start = toInteger(start);
729
+ if (start < 0) {
730
+ start = -start > length ? 0 : (length + start);
731
+ }
732
+ end = (end === undefined || end > length) ? length : toInteger(end);
733
+ if (end < 0) {
734
+ end += length;
735
+ }
736
+ end = start > end ? 0 : toLength(end);
737
+ while (start < end) {
738
+ array[start++] = value;
739
+ }
740
+ return array;
741
+ }
742
+
743
+ /**
744
+ * Fills elements of `array` with `value` from `start` up to, but not
745
+ * including, `end`.
746
+ *
747
+ * **Note:** This method mutates `array`.
748
+ *
749
+ * @static
750
+ * @memberOf _
751
+ * @since 3.2.0
752
+ * @category Array
753
+ * @param {Array} array The array to fill.
754
+ * @param {*} value The value to fill `array` with.
755
+ * @param {number} [start=0] The start position.
756
+ * @param {number} [end=array.length] The end position.
757
+ * @returns {Array} Returns `array`.
758
+ * @example
759
+ *
760
+ * var array = [1, 2, 3];
761
+ *
762
+ * _.fill(array, 'a');
763
+ * console.log(array);
764
+ * // => ['a', 'a', 'a']
765
+ *
766
+ * _.fill(Array(3), 2);
767
+ * // => [2, 2, 2]
768
+ *
769
+ * _.fill([4, 6, 8, 10], '*', 1, 3);
770
+ * // => [4, '*', '*', 10]
771
+ */
772
+ function fill(array, value, start, end) {
773
+ var length = array == null ? 0 : array.length;
774
+ if (!length) {
775
+ return [];
776
+ }
777
+ return baseFill(array, value, start, end);
778
+ }
779
+
780
+ const INITIAL = {
781
+ mime: 'text/csv',
782
+ fileKind: 'csv',
783
+ // BOM signature
784
+ bom: true,
785
+ columnDelimiter: ',',
786
+ rowDelimiter: '\r\n',
787
+ encoding: '',
788
+ };
789
+ // The ASCII character code 13 is called a Carriage Return or CR.
790
+ const CARRIAGE_RETURN = String.fromCharCode(13);
791
+ // Chr(13) followed by a Chr(10) that compose a proper CRLF.
792
+ const LINE_FEED = String.fromCharCode(10);
793
+ const DOUBLE_QT = String.fromCharCode(34);
794
+ const NO_BREAK_SPACE = String.fromCharCode(0xfeff);
795
+ const escapeRegex = new RegExp('"', 'g');
796
+ class ExportCsv {
797
+ constructor(options = {}) {
798
+ this.options = Object.assign(Object.assign({}, INITIAL), options);
799
+ }
800
+ doExport({ data, headers, props }) {
801
+ let result = this.options.bom ? NO_BREAK_SPACE : '';
802
+ // any header
803
+ if ((headers === null || headers === void 0 ? void 0 : headers.length) > 0) {
804
+ headers.forEach(header => {
805
+ // ignore empty
806
+ if (!header.length) {
807
+ return;
808
+ }
809
+ result += this.prepareHeader(header, this.options.columnDelimiter);
810
+ result += this.options.rowDelimiter;
811
+ });
812
+ }
813
+ data.forEach((rgRow, index) => {
814
+ if (index > 0) {
815
+ result += this.options.rowDelimiter;
816
+ }
817
+ // support grouping
818
+ if (isGrouping(rgRow)) {
819
+ result += this.parseCell(getGroupingName(rgRow), this.options.columnDelimiter);
820
+ return;
821
+ }
822
+ result += props.map(p => this.parseCell(rgRow[p], this.options.columnDelimiter)).join(this.options.columnDelimiter);
823
+ });
824
+ return result;
825
+ }
826
+ prepareHeader(columnHeaders, columnDelimiter) {
827
+ let result = '';
828
+ const newColumnHeaders = columnHeaders.map(v => this.parseCell(v, columnDelimiter, true));
829
+ result += newColumnHeaders.join(columnDelimiter);
830
+ return result;
831
+ }
832
+ parseCell(value, columnDelimiter, force = false) {
833
+ let escape = value;
834
+ if (typeof value !== 'string') {
835
+ escape = JSON.stringify(value);
836
+ }
837
+ const toEscape = [CARRIAGE_RETURN, DOUBLE_QT, LINE_FEED, columnDelimiter];
838
+ if (typeof escape === 'undefined') {
839
+ return '';
840
+ }
841
+ if (escape !== '' && (force || toEscape.some(i => escape.indexOf(i) >= 0))) {
842
+ return `"${escape.replace(escapeRegex, '""')}"`;
843
+ }
844
+ return escape;
845
+ }
846
+ }
847
+
848
+ var ExportTypes;
849
+ (function (ExportTypes) {
850
+ ExportTypes["csv"] = "csv";
851
+ })(ExportTypes || (ExportTypes = {}));
852
+ class ExportFilePlugin extends BasePlugin {
853
+ /** Exports string */
854
+ async exportString(options = {}, t = ExportTypes.csv) {
855
+ const data = await this.beforeexport();
856
+ if (!data) {
857
+ return null;
858
+ }
859
+ return this.formatter(t, options).doExport(data);
860
+ }
861
+ /** Exports Blob */
862
+ async exportBlob(options = {}, t = ExportTypes.csv) {
863
+ return await this.getBlob(this.formatter(t, options));
864
+ }
865
+ /** Export file */
866
+ async exportFile(options = {}, t = ExportTypes.csv) {
867
+ const formatter = this.formatter(t, options);
868
+ // url
869
+ const URL = window.URL || window.webkitURL;
870
+ const a = document.createElement('a');
871
+ const { filename, fileKind } = formatter.options;
872
+ const name = `${filename}.${fileKind}`;
873
+ const blob = await this.getBlob(formatter);
874
+ const url = blob ? URL.createObjectURL(blob) : '';
875
+ a.style.display = 'none';
876
+ a.setAttribute('href', url);
877
+ a.setAttribute('download', name);
878
+ this.revogrid.appendChild(a);
879
+ a.dispatchEvent(new MouseEvent('click'));
880
+ this.revogrid.removeChild(a);
881
+ // delay for revoke, correct for some browsers
882
+ await timeout(120);
883
+ URL.revokeObjectURL(url);
884
+ }
885
+ /** Blob object */
886
+ async getBlob(formatter) {
887
+ const type = `${formatter.options.mime};charset=${formatter.options.encoding}`;
888
+ if (typeof Blob !== 'undefined') {
889
+ const data = await this.beforeexport();
890
+ if (!data) {
891
+ return null;
892
+ }
893
+ return new Blob([formatter.doExport(data)], { type });
894
+ }
895
+ return null;
896
+ }
897
+ // before event
898
+ async beforeexport() {
899
+ let data = await this.getData();
900
+ const event = this.emit('beforeexport', { data });
901
+ if (event.defaultPrevented) {
902
+ return null;
903
+ }
904
+ return event.detail.data;
905
+ }
906
+ async getData() {
907
+ const data = await this.getSource();
908
+ const colSource = [];
909
+ const colPromises = [];
910
+ columnTypes.forEach((t, i) => {
911
+ colPromises.push(this.getColPerSource(t).then(s => (colSource[i] = s)));
912
+ });
913
+ await Promise.all(colPromises);
914
+ const columns = {
915
+ headers: [],
916
+ props: [],
917
+ };
918
+ for (let source of colSource) {
919
+ source.headers.forEach((h, i) => {
920
+ if (!columns.headers[i]) {
921
+ columns.headers[i] = [];
922
+ }
923
+ columns.headers[i].push(...h);
924
+ });
925
+ columns.props.push(...source.props);
926
+ }
927
+ return Object.assign({ data }, columns);
928
+ }
929
+ async getColPerSource(t) {
930
+ const store = await this.revogrid.getColumnStore(t);
931
+ const source = store.get('source');
932
+ const virtualIndexes = store.get('items');
933
+ const depth = store.get('groupingDepth');
934
+ const groups = store.get('groups');
935
+ const colNames = [];
936
+ const colProps = [];
937
+ virtualIndexes.forEach((v) => {
938
+ const prop = source[v].prop;
939
+ colNames.push(source[v].name || '');
940
+ colProps.push(prop);
941
+ });
942
+ const rows = this.getGroupHeaders(depth, groups, virtualIndexes);
943
+ rows.push(colNames);
944
+ return {
945
+ headers: rows,
946
+ props: colProps,
947
+ };
948
+ }
949
+ getGroupHeaders(depth, groups, items) {
950
+ const rows = [];
951
+ const template = fill(new Array(items.length), '');
952
+ for (let d = 0; d < depth; d++) {
953
+ const rgRow = [...template];
954
+ rows.push(rgRow);
955
+ if (!groups[d]) {
956
+ continue;
957
+ }
958
+ const levelGroups = groups[d];
959
+ // add names of groups
960
+ levelGroups.forEach((group) => {
961
+ const minIndex = group.indexes[0];
962
+ if (typeof minIndex === 'number') {
963
+ rgRow[minIndex] = group.name;
964
+ }
965
+ });
966
+ }
967
+ return rows;
968
+ }
969
+ async getSource() {
970
+ const data = [];
971
+ const promisesData = [];
972
+ rowTypes.forEach(t => {
973
+ const dataPart = [];
974
+ data.push(dataPart);
975
+ const promise = this.revogrid.getVisibleSource(t).then((d) => dataPart.push(...d));
976
+ promisesData.push(promise);
977
+ });
978
+ await Promise.all(promisesData);
979
+ return data.reduce((r, v) => {
980
+ r.push(...v);
981
+ return r;
982
+ }, []);
983
+ }
984
+ // get correct class for future multiple types support
985
+ formatter(type, options = {}) {
986
+ switch (type) {
987
+ case ExportTypes.csv:
988
+ return new ExportCsv(options);
989
+ default:
990
+ throw new Error('Unknown format');
991
+ }
992
+ }
993
+ }
994
+
995
+ const eq = (value, extra) => {
996
+ if (typeof value === 'undefined' || (value === null && !extra)) {
997
+ return true;
998
+ }
999
+ if (typeof value !== 'string') {
1000
+ value = JSON.stringify(value);
1001
+ }
1002
+ const filterVal = extra === null || extra === void 0 ? void 0 : extra.toString().toLocaleLowerCase();
1003
+ if ((filterVal === null || filterVal === void 0 ? void 0 : filterVal.length) === 0) {
1004
+ return true;
1005
+ }
1006
+ return value.toLocaleLowerCase() === filterVal;
1007
+ };
1008
+ const notEq = (value, extra) => !eq(value, extra);
1009
+ notEq.extra = 'input';
1010
+ eq.extra = 'input';
1011
+
1012
+ const gtThan = function (value, extra) {
1013
+ let conditionValue;
1014
+ if (typeof value === 'number' && typeof extra !== 'undefined' && extra !== null) {
1015
+ conditionValue = parseFloat(extra === null || extra === void 0 ? void 0 : extra.toString());
1016
+ return value > conditionValue;
1017
+ }
1018
+ return false;
1019
+ };
1020
+ gtThan.extra = 'input';
1021
+
1022
+ const gtThanEq = function (value, extra) {
1023
+ return eq(value, extra) || gtThan(value, extra);
1024
+ };
1025
+ gtThanEq.extra = 'input';
1026
+
1027
+ const lt = function (value, extra) {
1028
+ let conditionValue;
1029
+ if (typeof value === 'number' && typeof extra !== 'undefined' && extra !== null) {
1030
+ conditionValue = parseFloat(extra.toString());
1031
+ return value < conditionValue;
1032
+ }
1033
+ else {
1034
+ return false;
1035
+ }
1036
+ };
1037
+ lt.extra = 'input';
1038
+
1039
+ const lsEq = function (value, extra) {
1040
+ return eq(value, extra) || lt(value, extra);
1041
+ };
1042
+ lsEq.extra = 'input';
1043
+
1044
+ const set = (value) => !(value === '' || value === null || value === void 0);
1045
+ const notSet = (value) => !set(value);
1046
+
1047
+ const beginsWith = (value, extra) => {
1048
+ if (!value) {
1049
+ return false;
1050
+ }
1051
+ if (!extra) {
1052
+ return true;
1053
+ }
1054
+ if (typeof value !== 'string') {
1055
+ value = JSON.stringify(value);
1056
+ }
1057
+ if (typeof extra !== 'string') {
1058
+ extra = JSON.stringify(extra);
1059
+ }
1060
+ return value.toLocaleLowerCase().indexOf(extra.toLocaleLowerCase()) === 0;
1061
+ };
1062
+ beginsWith.extra = 'input';
1063
+
1064
+ const contains = (value, extra) => {
1065
+ if (!extra) {
1066
+ return true;
1067
+ }
1068
+ if (!value) {
1069
+ return false;
1070
+ }
1071
+ if (extra) {
1072
+ if (typeof value !== 'string') {
1073
+ value = JSON.stringify(value);
1074
+ }
1075
+ return value.toLocaleLowerCase().indexOf(extra.toString().toLowerCase()) > -1;
1076
+ }
1077
+ return true;
1078
+ };
1079
+ const notContains = (value, extra) => {
1080
+ return !contains(value, extra);
1081
+ };
1082
+ notContains.extra = 'input';
1083
+ contains.extra = 'input';
1084
+
1085
+ // filter.indexed.ts
1086
+ const filterCoreFunctionsIndexedByType = {
1087
+ none: () => true,
1088
+ empty: notSet,
1089
+ notEmpty: set,
1090
+ eq: eq,
1091
+ notEq: notEq,
1092
+ begins: beginsWith,
1093
+ contains: contains,
1094
+ notContains: notContains,
1095
+ eqN: eq,
1096
+ neqN: notEq,
1097
+ gt: gtThan,
1098
+ gte: gtThanEq,
1099
+ lt: lt,
1100
+ lte: lsEq,
1101
+ };
1102
+ const filterTypes = {
1103
+ string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
1104
+ number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
1105
+ };
1106
+ const filterNames = {
1107
+ none: 'None',
1108
+ empty: 'Not set',
1109
+ notEmpty: 'Set',
1110
+ eq: 'Equal',
1111
+ notEq: 'Not equal',
1112
+ begins: 'Begins with',
1113
+ contains: 'Contains',
1114
+ notContains: 'Does not contain',
1115
+ eqN: '=',
1116
+ neqN: '!=',
1117
+ gt: '>',
1118
+ gte: '>=',
1119
+ lt: '<',
1120
+ lte: '<=',
1121
+ };
1122
+
1123
+ // filter.plugin.tsx
1124
+ const FILTER_TRIMMED_TYPE = 'filter';
1125
+ const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
1126
+ const FILTE_PANEL = 'revogr-filter-panel';
1127
+ /**
1128
+ * @typedef ColumnFilterConfig
1129
+ * @type {object}
1130
+ *
1131
+ * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering with relation
1132
+ *
1133
+ * @property {Record<ColumnProp, FilterCollectionItem>|undefined} collection - preserved filter data, relation for filters will be applied as 'and'
1134
+ *
1135
+ * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
1136
+ *
1137
+ * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
1138
+ *
1139
+ * @property {FilterLocalization|undefined} localization - translation for filter popup captions.
1140
+ *
1141
+ * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering. A way to apply filters on Save only.
1142
+ */
1143
+ /**
1144
+ * @internal
1145
+ */
1146
+ class FilterPlugin extends BasePlugin {
1147
+ constructor(revogrid, providers, config) {
1148
+ var _a;
1149
+ super(revogrid, providers);
1150
+ this.revogrid = revogrid;
1151
+ this.config = config;
1152
+ this.filterCollection = {};
1153
+ this.multiFilterItems = {};
1154
+ /**
1155
+ * Filter types
1156
+ * @example
1157
+ * {
1158
+ * string: ['contains', 'beginswith'],
1159
+ * number: ['eqN', 'neqN', 'gt']
1160
+ * }
1161
+ */
1162
+ this.filterByType = Object.assign({}, filterTypes);
1163
+ this.filterNameIndexByType = Object.assign({}, filterNames);
1164
+ this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
1165
+ this.filterProp = FILTER_PROP;
1166
+ if (config) {
1167
+ this.initConfig(config);
1168
+ }
1169
+ const existingNodes = this.revogrid.registerVNode.filter(n => typeof n === 'object' && n.$tag$ !== FILTE_PANEL);
1170
+ this.revogrid.registerVNode = [
1171
+ ...existingNodes,
1172
+ 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, closeOnOutsideClick: config === null || config === void 0 ? void 0 : config.closeFilterPanelOnOutsideClick, ref: e => (this.pop = e) },
1173
+ ' ',
1174
+ this.extraContent()),
1175
+ ];
1176
+ const aftersourceset = async () => {
1177
+ const filterCollectionProps = Object.keys(this.filterCollection);
1178
+ if (filterCollectionProps.length > 0) {
1179
+ // handle old way of filtering by reworking FilterCollection to new MultiFilterItem
1180
+ filterCollectionProps.forEach((prop, index) => {
1181
+ if (!this.multiFilterItems[prop]) {
1182
+ this.multiFilterItems[prop] = [
1183
+ {
1184
+ id: index,
1185
+ type: this.filterCollection[prop].type,
1186
+ value: this.filterCollection[prop].value,
1187
+ relation: 'and',
1188
+ },
1189
+ ];
1190
+ }
1191
+ });
1192
+ }
1193
+ if (Object.keys(this.multiFilterItems).length === 0) {
1194
+ return;
1195
+ }
1196
+ await this.runFiltering(this.multiFilterItems);
1197
+ };
1198
+ this.addEventListener('headerclick', e => this.headerclick(e));
1199
+ this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
1200
+ if (!detail ||
1201
+ (typeof detail === 'object' &&
1202
+ (!detail.multiFilterItems ||
1203
+ !Object.keys(detail.multiFilterItems).length))) {
1204
+ this.clearFiltering();
1205
+ return;
1206
+ }
1207
+ if (typeof detail === 'object') {
1208
+ this.initConfig(detail);
1209
+ }
1210
+ aftersourceset();
1211
+ });
1212
+ this.addEventListener('aftersourceset', aftersourceset);
1213
+ this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
1214
+ }
1215
+ beforeshow(_) {
1216
+ // used as hook for filter panel
1217
+ }
1218
+ extraContent() {
1219
+ return null;
1220
+ }
1221
+ initConfig(config) {
1222
+ if (config.multiFilterItems) {
1223
+ this.multiFilterItems = Object.assign({}, config.multiFilterItems);
1224
+ }
1225
+ else {
1226
+ this.multiFilterItems = {};
1227
+ }
1228
+ // Add custom filters
1229
+ if (config.customFilters) {
1230
+ for (let customFilterType in config.customFilters) {
1231
+ const cFilter = config.customFilters[customFilterType];
1232
+ if (!this.filterByType[cFilter.columnFilterType]) {
1233
+ this.filterByType[cFilter.columnFilterType] = [];
1234
+ }
1235
+ // add custom filter type
1236
+ this.filterByType[cFilter.columnFilterType].push(customFilterType);
1237
+ // add custom filter function
1238
+ this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
1239
+ // add custom filter name
1240
+ this.filterNameIndexByType[customFilterType] = cFilter.name;
1241
+ }
1242
+ }
1243
+ // Add filterProp if provided in config
1244
+ if (config.filterProp) {
1245
+ this.filterProp = config.filterProp;
1246
+ }
1247
+ /**
1248
+ * which filters has to be included/excluded
1249
+ * convenient way to exclude system filters
1250
+ */
1251
+ const cfgInlcude = config.include;
1252
+ if (cfgInlcude) {
1253
+ const filters = {};
1254
+ for (let t in this.filterByType) {
1255
+ // validate filters, if appropriate function present
1256
+ const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
1257
+ if (newTypes.length) {
1258
+ filters[t] = newTypes;
1259
+ }
1260
+ }
1261
+ // if any valid filters provided show them
1262
+ if (Object.keys(filters).length > 0) {
1263
+ this.filterByType = filters;
1264
+ }
1265
+ }
1266
+ if (config.collection) {
1267
+ const filtersWithFilterFunctionPresent = Object.entries(config.collection).filter(([, item]) => this.filterFunctionsIndexedByType[item.type]);
1268
+ this.filterCollection = Object.fromEntries(filtersWithFilterFunctionPresent);
1269
+ }
1270
+ else {
1271
+ this.filterCollection = {};
1272
+ }
1273
+ if (config.localization) {
1274
+ if (config.localization.filterNames) {
1275
+ Object.entries(config.localization.filterNames).forEach(([k, v]) => {
1276
+ if (this.filterNameIndexByType[k] != void 0) {
1277
+ this.filterNameIndexByType[k] = v;
1278
+ }
1279
+ });
1280
+ }
1281
+ }
1282
+ }
1283
+ async headerclick(e) {
1284
+ var _a, _b;
1285
+ const el = (_a = e.detail.originalEvent) === null || _a === void 0 ? void 0 : _a.target;
1286
+ if (!isFilterBtn(el)) {
1287
+ return;
1288
+ }
1289
+ e.preventDefault();
1290
+ if (!this.pop) {
1291
+ return;
1292
+ }
1293
+ // filter button clicked, open filter dialog
1294
+ const gridPos = this.revogrid.getBoundingClientRect();
1295
+ const buttonPos = el.getBoundingClientRect();
1296
+ const prop = e.detail.prop;
1297
+ 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 });
1298
+ (_b = this.beforeshow) === null || _b === void 0 ? void 0 : _b.call(this, data);
1299
+ this.pop.show(data);
1300
+ }
1301
+ getColumnFilter(type) {
1302
+ let filterType = 'string';
1303
+ if (!type) {
1304
+ return { [filterType]: this.filterByType[filterType] };
1305
+ }
1306
+ // if custom column filter
1307
+ if (this.isValidType(type)) {
1308
+ filterType = type;
1309
+ // if multiple filters applied
1310
+ }
1311
+ else if (typeof type === 'object' && type.length) {
1312
+ return type.reduce((r, multiType) => {
1313
+ if (this.isValidType(multiType)) {
1314
+ r[multiType] = this.filterByType[multiType];
1315
+ }
1316
+ return r;
1317
+ }, {});
1318
+ }
1319
+ return { [filterType]: this.filterByType[filterType] };
1320
+ }
1321
+ isValidType(type) {
1322
+ return !!(typeof type === 'string' && this.filterByType[type]);
1323
+ }
1324
+ /**
1325
+ * Called on internal component change
1326
+ */
1327
+ async onFilterChange(filterItems) {
1328
+ // store the filter items
1329
+ this.multiFilterItems = filterItems;
1330
+ // run the filtering when the items change
1331
+ this.runFiltering(this.multiFilterItems);
1332
+ }
1333
+ onFilterReset(prop) {
1334
+ delete this.multiFilterItems[prop !== null && prop !== void 0 ? prop : ''];
1335
+ this.onFilterChange(this.multiFilterItems);
1336
+ }
1337
+ /**
1338
+ * Triggers grid filtering
1339
+ */
1340
+ async doFiltering(collection, source, columns, filterItems) {
1341
+ const columnsToUpdate = [];
1342
+ /**
1343
+ * Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
1344
+ */
1345
+ const columnByProp = {};
1346
+ columns.forEach(rgCol => {
1347
+ const column = Object.assign({}, rgCol);
1348
+ const hasFilter = filterItems[column.prop];
1349
+ columnByProp[column.prop] = column;
1350
+ /**
1351
+ * If the column has a filter and it's not already marked as filtered, update the column.
1352
+ */
1353
+ if (column[this.filterProp] && !hasFilter) {
1354
+ delete column[this.filterProp];
1355
+ columnsToUpdate.push(column);
1356
+ }
1357
+ /**
1358
+ * If the column does not have a filter and it's marked as filtered, update the column.
1359
+ */
1360
+ if (!column[this.filterProp] && hasFilter) {
1361
+ columnsToUpdate.push(column);
1362
+ column[this.filterProp] = true;
1363
+ }
1364
+ });
1365
+ const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
1366
+ // check is filter event prevented
1367
+ const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
1368
+ collection,
1369
+ itemsToFilter: itemsToTrim,
1370
+ source,
1371
+ filterItems,
1372
+ });
1373
+ if (defaultPrevented) {
1374
+ return;
1375
+ }
1376
+ this.providers.data.setTrimmed({ [FILTER_TRIMMED_TYPE]: detail.itemsToFilter });
1377
+ // applies the hasFilter to the columns to show filter icon
1378
+ this.providers.column.updateColumns(columnsToUpdate);
1379
+ this.emit('afterfilterapply', {
1380
+ multiFilterItems: filterItems,
1381
+ source,
1382
+ collection,
1383
+ });
1384
+ }
1385
+ async clearFiltering() {
1386
+ this.multiFilterItems = {};
1387
+ await this.runFiltering(this.multiFilterItems);
1388
+ }
1389
+ async runFiltering(multiFilterItems) {
1390
+ const collection = {};
1391
+ // handle old filterCollection to return the first filter only (if any) from multiFilterItems
1392
+ const filterProps = Object.keys(multiFilterItems);
1393
+ for (const prop of filterProps) {
1394
+ // check if we have any filter for a column
1395
+ if (multiFilterItems[prop].length > 0) {
1396
+ const firstFilterItem = multiFilterItems[prop][0];
1397
+ collection[prop] = {
1398
+ type: firstFilterItem.type,
1399
+ value: firstFilterItem.value,
1400
+ };
1401
+ }
1402
+ }
1403
+ this.filterCollection = collection;
1404
+ const columns = this.providers.column.getColumns();
1405
+ // run the filtering on the main source only
1406
+ const source = this.providers.data.stores['rgRow'].store.get('source');
1407
+ const { defaultPrevented, detail } = this.emit('beforefilterapply', {
1408
+ collection: this.filterCollection,
1409
+ source,
1410
+ columns,
1411
+ filterItems: this.multiFilterItems,
1412
+ });
1413
+ if (defaultPrevented) {
1414
+ return;
1415
+ }
1416
+ this.doFiltering(detail.collection, detail.source, detail.columns, detail.filterItems);
1417
+ }
1418
+ /**
1419
+ * Get trimmed rows based on filter
1420
+ */
1421
+ getRowFilter(rows, filterItems, columnByProp) {
1422
+ const propKeys = Object.keys(filterItems);
1423
+ const trimmed = {};
1424
+ // each rows
1425
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
1426
+ // check filter by column properties
1427
+ for (const prop of propKeys) {
1428
+ // add to the list of removed/trimmed rows of filter condition is satisfied
1429
+ if (this.shouldTrimRow(filterItems[prop], prop, columnByProp[prop], rows[rowIndex])) {
1430
+ trimmed[rowIndex] = true;
1431
+ }
1432
+ } // end of for-of propKeys
1433
+ }
1434
+ return trimmed;
1435
+ }
1436
+ shouldTrimRow(propFilters, prop, column, model = {}) {
1437
+ // reset the count of satisfied filters
1438
+ let propFilterSatisfiedCount = 0;
1439
+ // reset the array of last filter results
1440
+ let lastFilterResults = [];
1441
+ // testing each filter for a prop
1442
+ for (const [filterIndex, filterData] of propFilters.entries()) {
1443
+ // the filter LogicFunction based on the type
1444
+ const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
1445
+ // THE MAGIC OF FILTERING IS HERE
1446
+ // If there is no column but user wants to filter by a property
1447
+ const value = column ? getCellDataParsed(model, column) : model[prop];
1448
+ // OR relation
1449
+ if (filterData.relation === 'or') {
1450
+ // reset the array of last filter results
1451
+ lastFilterResults = [];
1452
+ // if the filter is satisfied, continue to the next filter
1453
+ if (filterFunc(value, filterData.value)) {
1454
+ continue;
1455
+ }
1456
+ // if the filter is not satisfied, count it
1457
+ propFilterSatisfiedCount++;
1458
+ // AND relation
1459
+ }
1460
+ else {
1461
+ // 'and' relation will need to know the next filter
1462
+ // so we save this current filter to include it in the next filter
1463
+ lastFilterResults.push(!filterFunc(value, filterData.value));
1464
+ if (isFinalAndFilter(filterIndex, propFilters)) {
1465
+ // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1466
+ if (allAndConditionsSatisfied(lastFilterResults)) {
1467
+ // reset the array of last filter results
1468
+ lastFilterResults = [];
1469
+ continue;
1470
+ }
1471
+ // we need to add all of the lastFilterResults since we need to satisfy all
1472
+ propFilterSatisfiedCount += lastFilterResults.length;
1473
+ // reset the array of last filter results
1474
+ lastFilterResults = [];
1475
+ }
1476
+ }
1477
+ } // end of propFilters forEach
1478
+ return propFilterSatisfiedCount === propFilters.length;
1479
+ }
1480
+ }
1481
+ /**
1482
+ * Checks if the current filter is the final one in an AND sequence.
1483
+ * @param index - Current filter index in the list.
1484
+ * @param filters - Array of filters for the property.
1485
+ * @returns True if this is the last AND condition; false otherwise.
1486
+ */
1487
+ function isFinalAndFilter(index, filters) {
1488
+ const nextFilter = filters[index + 1]; // Get the next filter in the list.
1489
+ // Return true if there's no next filter or if the next filter defined and is not part of the AND sequence.
1490
+ return !nextFilter || (!!nextFilter.relation && nextFilter.relation !== 'and');
1491
+ }
1492
+ /**
1493
+ * Determines if all conditions in an AND sequence are satisfied.
1494
+ * @param pendingResults - An array of results from the AND conditions.
1495
+ * @returns True if all conditions are satisfied; false otherwise.
1496
+ */
1497
+ function allAndConditionsSatisfied(pendingResults) {
1498
+ // Check if there are any failed conditions in the pending results.
1499
+ return !pendingResults.includes(true);
1500
+ }
1501
+
1502
+ /** `Object#toString` result references. */
1503
+ var stringTag = '[object String]';
1504
+
1505
+ /**
1506
+ * Checks if `value` is classified as a `String` primitive or object.
1507
+ *
1508
+ * @static
1509
+ * @since 0.1.0
1510
+ * @memberOf _
1511
+ * @category Lang
1512
+ * @param {*} value The value to check.
1513
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
1514
+ * @example
1515
+ *
1516
+ * _.isString('abc');
1517
+ * // => true
1518
+ *
1519
+ * _.isString(1);
1520
+ * // => false
1521
+ */
1522
+ function isString(value) {
1523
+ return typeof value == 'string' ||
1524
+ (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
1525
+ }
1526
+
1527
+ /**
1528
+ * Gets the size of an ASCII `string`.
1529
+ *
1530
+ * @private
1531
+ * @param {string} string The string inspect.
1532
+ * @returns {number} Returns the string size.
1533
+ */
1534
+ var asciiSize = baseProperty('length');
1535
+
1536
+ /** Used to compose unicode character classes. */
1537
+ var rsAstralRange$1 = '\\ud800-\\udfff',
1538
+ rsComboMarksRange$1 = '\\u0300-\\u036f',
1539
+ reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
1540
+ rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
1541
+ rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
1542
+ rsVarRange$1 = '\\ufe0e\\ufe0f';
1543
+
1544
+ /** Used to compose unicode capture groups. */
1545
+ var rsZWJ$1 = '\\u200d';
1546
+
1547
+ /** 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/). */
1548
+ var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
1549
+
1550
+ /**
1551
+ * Checks if `string` contains Unicode symbols.
1552
+ *
1553
+ * @private
1554
+ * @param {string} string The string to inspect.
1555
+ * @returns {boolean} Returns `true` if a symbol is found, else `false`.
1556
+ */
1557
+ function hasUnicode(string) {
1558
+ return reHasUnicode.test(string);
1559
+ }
1560
+
1561
+ /** Used to compose unicode character classes. */
1562
+ var rsAstralRange = '\\ud800-\\udfff',
1563
+ rsComboMarksRange = '\\u0300-\\u036f',
1564
+ reComboHalfMarksRange = '\\ufe20-\\ufe2f',
1565
+ rsComboSymbolsRange = '\\u20d0-\\u20ff',
1566
+ rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
1567
+ rsVarRange = '\\ufe0e\\ufe0f';
1568
+
1569
+ /** Used to compose unicode capture groups. */
1570
+ var rsAstral = '[' + rsAstralRange + ']',
1571
+ rsCombo = '[' + rsComboRange + ']',
1572
+ rsFitz = '\\ud83c[\\udffb-\\udfff]',
1573
+ rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
1574
+ rsNonAstral = '[^' + rsAstralRange + ']',
1575
+ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
1576
+ rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
1577
+ rsZWJ = '\\u200d';
1578
+
1579
+ /** Used to compose unicode regexes. */
1580
+ var reOptMod = rsModifier + '?',
1581
+ rsOptVar = '[' + rsVarRange + ']?',
1582
+ rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
1583
+ rsSeq = rsOptVar + reOptMod + rsOptJoin,
1584
+ rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
1585
+
1586
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
1587
+ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
1588
+
1589
+ /**
1590
+ * Gets the size of a Unicode `string`.
1591
+ *
1592
+ * @private
1593
+ * @param {string} string The string inspect.
1594
+ * @returns {number} Returns the string size.
1595
+ */
1596
+ function unicodeSize(string) {
1597
+ var result = reUnicode.lastIndex = 0;
1598
+ while (reUnicode.test(string)) {
1599
+ ++result;
1600
+ }
1601
+ return result;
1602
+ }
1603
+
1604
+ /**
1605
+ * Gets the number of symbols in `string`.
1606
+ *
1607
+ * @private
1608
+ * @param {string} string The string to inspect.
1609
+ * @returns {number} Returns the string size.
1610
+ */
1611
+ function stringSize(string) {
1612
+ return hasUnicode(string)
1613
+ ? unicodeSize(string)
1614
+ : asciiSize(string);
1615
+ }
1616
+
1617
+ /** `Object#toString` result references. */
1618
+ var mapTag = '[object Map]',
1619
+ setTag = '[object Set]';
1620
+
1621
+ /**
1622
+ * Gets the size of `collection` by returning its length for array-like
1623
+ * values or the number of own enumerable string keyed properties for objects.
1624
+ *
1625
+ * @static
1626
+ * @memberOf _
1627
+ * @since 0.1.0
1628
+ * @category Collection
1629
+ * @param {Array|Object|string} collection The collection to inspect.
1630
+ * @returns {number} Returns the collection size.
1631
+ * @example
1632
+ *
1633
+ * _.size([1, 2, 3]);
1634
+ * // => 3
1635
+ *
1636
+ * _.size({ 'a': 1, 'b': 2 });
1637
+ * // => 2
1638
+ *
1639
+ * _.size('pebbles');
1640
+ * // => 7
1641
+ */
1642
+ function size(collection) {
1643
+ if (collection == null) {
1644
+ return 0;
1645
+ }
1646
+ if (isArrayLike(collection)) {
1647
+ return isString(collection) ? stringSize(collection) : collection.length;
1648
+ }
1649
+ var tag = getTag(collection);
1650
+ if (tag == mapTag || tag == setTag) {
1651
+ return collection.size;
1652
+ }
1653
+ return baseKeys(collection).length;
1654
+ }
1655
+
1656
+ function sortIndexByItems(indexes, source, sortingFunc = {}) {
1657
+ // if no sorting - return unsorted indexes
1658
+ if (Object.entries(sortingFunc).length === 0) {
1659
+ // Unsorted indexes
1660
+ return [...Array(indexes.length).keys()];
1661
+ }
1662
+ //
1663
+ /**
1664
+ * go through all indexes and align in new order
1665
+ * performs a multi-level sorting by applying multiple comparison functions to determine the order of the items based on different properties.
1666
+ */
1667
+ return indexes.sort((a, b) => {
1668
+ const itemA = source[a];
1669
+ const itemB = source[b];
1670
+ for (const [prop, cmp] of Object.entries(sortingFunc)) {
1671
+ if (isGrouping(itemA)) {
1672
+ if (itemA['__rvgr-prop'] !== prop) {
1673
+ return 0;
1674
+ }
1675
+ }
1676
+ if (isGrouping(itemB)) {
1677
+ if (itemB['__rvgr-prop'] !== prop) {
1678
+ return 0;
1679
+ }
1680
+ }
1681
+ /**
1682
+ * 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.
1683
+ * 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.
1684
+ */
1685
+ const sorted = cmp === null || cmp === void 0 ? void 0 : cmp(prop, itemA, itemB);
1686
+ if (sorted) {
1687
+ return sorted;
1688
+ }
1689
+ }
1690
+ return 0;
1691
+ });
1692
+ }
1693
+ function defaultCellCompare(prop, a, b) {
1694
+ const aRaw = this.column ? getCellRaw(a, this.column) : a === null || a === void 0 ? void 0 : a[prop];
1695
+ const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
1696
+ const av = typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
1697
+ const bv = typeof bRaw === 'number' ? bRaw : bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
1698
+ if (av === bv) {
1699
+ return 0;
1700
+ }
1701
+ if (av > bv) {
1702
+ return 1;
1703
+ }
1704
+ return -1;
1705
+ }
1706
+ function descCellCompare(cmp) {
1707
+ return (prop, a, b) => {
1708
+ return -1 * cmp(prop, a, b);
1709
+ };
1710
+ }
1711
+ function getNextOrder(currentOrder) {
1712
+ switch (currentOrder) {
1713
+ case undefined:
1714
+ return 'asc';
1715
+ case 'asc':
1716
+ return 'desc';
1717
+ case 'desc':
1718
+ return undefined;
1719
+ }
1720
+ }
1721
+ function getComparer(column, order) {
1722
+ var _a;
1723
+ const cellCmp = ((_a = column === null || column === void 0 ? void 0 : column.cellCompare) === null || _a === void 0 ? void 0 : _a.bind({ order })) || (defaultCellCompare === null || defaultCellCompare === void 0 ? void 0 : defaultCellCompare.bind({ column, order }));
1724
+ if (order == 'asc') {
1725
+ return cellCmp;
1726
+ }
1727
+ if (order == 'desc') {
1728
+ return descCellCompare(cellCmp);
1729
+ }
1730
+ return undefined;
1731
+ }
1732
+
1733
+ /**
1734
+ * Lifecycle
1735
+ * 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.
1736
+ * 2. @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.
1737
+ * 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.
1738
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
1739
+ *
1740
+ * Note: If you prevent an event, it will not proceed to the subsequent steps.
1741
+ */
1742
+ class SortingPlugin extends BasePlugin {
1743
+ constructor(revogrid, providers, config) {
1744
+ super(revogrid, providers);
1745
+ this.revogrid = revogrid;
1746
+ /**
1747
+ * Delayed sorting promise
1748
+ */
1749
+ this.sortingPromise = null;
1750
+ /**
1751
+ * We need to sort only so often
1752
+ */
1753
+ this.postponeSort = debounce((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
1754
+ const setConfig = (cfg) => {
1755
+ var _a;
1756
+ if (cfg) {
1757
+ const sortingFunc = {};
1758
+ const order = {};
1759
+ (_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
1760
+ sortingFunc[col.prop] = getComparer(col, col.order);
1761
+ order[col.prop] = col.order;
1762
+ });
1763
+ if (cfg.additive) {
1764
+ this.sorting = Object.assign(Object.assign({}, this.sorting), order);
1765
+ this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
1766
+ }
1767
+ else {
1768
+ // // set sorting
1769
+ this.sorting = order;
1770
+ this.sortingFunc = sortingFunc;
1771
+ }
1772
+ }
1773
+ };
1774
+ setConfig(config);
1775
+ this.addEventListener('sortingconfigchanged', ({ detail }) => {
1776
+ config = detail;
1777
+ setConfig(detail);
1778
+ this.startSorting(this.sorting, this.sortingFunc);
1779
+ });
1780
+ this.addEventListener('beforeheaderrender', ({ detail, }) => {
1781
+ var _a;
1782
+ const { data: column } = detail;
1783
+ if (column.sortable) {
1784
+ detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop] });
1785
+ }
1786
+ });
1787
+ this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
1788
+ // if sorting was provided - sort data
1789
+ if (!!this.sorting && this.sortingFunc) {
1790
+ const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
1791
+ if (event.defaultPrevented) {
1792
+ return;
1793
+ }
1794
+ this.startSorting(this.sorting, this.sortingFunc);
1795
+ }
1796
+ });
1797
+ this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
1798
+ // if config provided - do nothing, read from config
1799
+ if (config) {
1800
+ return;
1801
+ }
1802
+ const columns = this.providers.column.getColumns();
1803
+ const sortingFunc = {};
1804
+ for (let prop in order) {
1805
+ const cmp = getComparer(getColumnByProp(columns, prop), order[prop]);
1806
+ sortingFunc[prop] = cmp;
1807
+ }
1808
+ // set sorting
1809
+ this.sorting = order;
1810
+ this.sortingFunc = order && sortingFunc;
1811
+ });
1812
+ this.addEventListener('beforeheaderclick', (e) => {
1813
+ var _a, _b, _c, _d;
1814
+ if (e.defaultPrevented) {
1815
+ return;
1816
+ }
1817
+ if (!((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.sortable)) {
1818
+ return;
1819
+ }
1820
+ this.headerclick(e.detail.column, (_d = (_c = e.detail) === null || _c === void 0 ? void 0 : _c.originalEvent) === null || _d === void 0 ? void 0 : _d.shiftKey);
1821
+ });
1822
+ }
1823
+ /**
1824
+ * Entry point for sorting, waits for all delayes, registers jobs
1825
+ */
1826
+ startSorting(order, sortingFunc, ignoreViewportUpdate) {
1827
+ if (!this.sortingPromise) {
1828
+ // add job before render
1829
+ this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
1830
+ this.sortingPromise = resolve;
1831
+ }));
1832
+ }
1833
+ this.postponeSort(order, sortingFunc, ignoreViewportUpdate);
1834
+ }
1835
+ /**
1836
+ * Apply sorting to data on header click
1837
+ * If additive - add to existing sorting, multiple columns can be sorted
1838
+ */
1839
+ headerclick(column, additive) {
1840
+ var _a, _b, _c;
1841
+ const columnProp = column.prop;
1842
+ let order = getNextOrder((_a = this.sorting) === null || _a === void 0 ? void 0 : _a[columnProp]);
1843
+ const beforeEvent = this.emit('beforesorting', { column, order, additive });
1844
+ if (beforeEvent.defaultPrevented) {
1845
+ return;
1846
+ }
1847
+ order = beforeEvent.detail.order;
1848
+ // apply sort data
1849
+ const beforeApplyEvent = this.emit('beforesortingapply', {
1850
+ column: beforeEvent.detail.column,
1851
+ order,
1852
+ additive,
1853
+ });
1854
+ if (beforeApplyEvent.defaultPrevented) {
1855
+ return;
1856
+ }
1857
+ const cmp = getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
1858
+ if (beforeApplyEvent.detail.additive && this.sorting) {
1859
+ const sorting = {};
1860
+ const sortingFunc = {};
1861
+ if (columnProp in sorting && size(sorting) > 1 && order === undefined) {
1862
+ delete sorting[columnProp];
1863
+ delete sortingFunc[columnProp];
1864
+ }
1865
+ else {
1866
+ sorting[columnProp] = order;
1867
+ sortingFunc[columnProp] = cmp;
1868
+ }
1869
+ this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
1870
+ // extend sorting function with new sorting for multiple columns sorting
1871
+ this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
1872
+ }
1873
+ else {
1874
+ if (order) {
1875
+ // reset sorting
1876
+ this.sorting = { [columnProp]: order };
1877
+ this.sortingFunc = { [columnProp]: cmp };
1878
+ }
1879
+ else {
1880
+ (_b = this.sorting) === null || _b === void 0 ? true : delete _b[columnProp];
1881
+ (_c = this.sortingFunc) === null || _c === void 0 ? true : delete _c[columnProp];
1882
+ }
1883
+ }
1884
+ this.startSorting(this.sorting, this.sortingFunc);
1885
+ }
1886
+ runSorting(order, comparison, ignoreViewportUpdate) {
1887
+ var _a;
1888
+ this.sort(order, comparison, undefined, ignoreViewportUpdate);
1889
+ (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
1890
+ this.sortingPromise = null;
1891
+ }
1892
+ /**
1893
+ * Sort items by sorting function
1894
+ * @requires proxyItems applied to row store
1895
+ * @requires source applied to row store
1896
+ *
1897
+ * @param sorting - per column sorting
1898
+ * @param data - this.stores['rgRow'].store.get('source')
1899
+ */
1900
+ sort(sorting, sortingFunc, types = rowTypes, ignoreViewportUpdate = false) {
1901
+ // if no sorting - reset
1902
+ if (!Object.keys(sorting || {}).length) {
1903
+ for (let type of types) {
1904
+ const storeService = this.providers.data.stores[type];
1905
+ // row data
1906
+ const source = storeService.store.get('source');
1907
+ // row indexes
1908
+ const proxyItems = storeService.store.get('proxyItems');
1909
+ // row indexes
1910
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
1911
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
1912
+ storeService.setData({ proxyItems: newItemsOrder, source: [...source], });
1913
+ }
1914
+ }
1915
+ else {
1916
+ for (let type of types) {
1917
+ const storeService = this.providers.data.stores[type];
1918
+ // row data
1919
+ const source = storeService.store.get('source');
1920
+ // row indexes
1921
+ const proxyItems = storeService.store.get('proxyItems');
1922
+ const newItemsOrder = sortIndexByItems([...proxyItems], source, sortingFunc);
1923
+ // take row indexes before trim applied and proxy items
1924
+ const prevItems = storeService.store.get('items');
1925
+ storeService.setData({
1926
+ proxyItems: newItemsOrder,
1927
+ source: [...source],
1928
+ });
1929
+ // take currently visible row indexes
1930
+ const newItems = storeService.store.get('items');
1931
+ if (!ignoreViewportUpdate) {
1932
+ this.providers.dimension
1933
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
1934
+ }
1935
+ }
1936
+ }
1937
+ // refresh columns to redraw column headers and show correct icon
1938
+ columnTypes.forEach((type) => {
1939
+ this.providers.column.dataSources[type].refresh();
1940
+ });
1941
+ this.emit('aftersortingapply');
1942
+ }
1943
+ }
1944
+
1945
+ // provide collapse data
1946
+ function doCollapse(pIndex, source) {
1947
+ const model = source[pIndex];
1948
+ const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];
1949
+ const trimmed = {};
1950
+ let i = pIndex + 1;
1951
+ const total = source.length;
1952
+ while (i < total) {
1953
+ const currentModel = source[i];
1954
+ if (isGrouping(currentModel)) {
1955
+ const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];
1956
+ if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
1957
+ break;
1958
+ }
1959
+ currentModel[GROUP_EXPANDED] = false;
1960
+ }
1961
+ trimmed[i++] = true;
1962
+ }
1963
+ model[GROUP_EXPANDED] = false;
1964
+ return { trimmed };
1965
+ }
1966
+ /**
1967
+ *
1968
+ * @param pIndex - physical index
1969
+ * @param vIndex - virtual index, need to update item collection
1970
+ * @param source - data source
1971
+ * @param rowItemsIndexes - rgRow indexes
1972
+ */
1973
+ function doExpand(vIndex, source, rowItemsIndexes) {
1974
+ const physicalIndex = rowItemsIndexes[vIndex];
1975
+ const model = source[physicalIndex];
1976
+ const currentGroup = getParsedGroup(model[PSEUDO_GROUP_ITEM_ID]);
1977
+ const trimmed = {};
1978
+ // no group found
1979
+ if (!currentGroup) {
1980
+ return { trimmed };
1981
+ }
1982
+ const groupItems = [];
1983
+ model[GROUP_EXPANDED] = true;
1984
+ let i = physicalIndex + 1;
1985
+ const total = source.length;
1986
+ let groupLevelOnly = 0;
1987
+ // go through all rows
1988
+ while (i < total) {
1989
+ const currentModel = source[i];
1990
+ const isGroup = isGrouping(currentModel);
1991
+ // group found
1992
+ if (isGroup) {
1993
+ if (!isSameGroup(currentGroup, model, currentModel)) {
1994
+ break;
1995
+ }
1996
+ else if (!groupLevelOnly) {
1997
+ // if get group first it's group only level
1998
+ groupLevelOnly = currentModel[GROUP_DEPTH];
1999
+ }
2000
+ }
2001
+ // level 0 or same depth
2002
+ if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[GROUP_DEPTH])) {
2003
+ trimmed[i] = false;
2004
+ groupItems.push(i);
2005
+ }
2006
+ i++;
2007
+ }
2008
+ const result = {
2009
+ trimmed,
2010
+ };
2011
+ if (groupItems.length) {
2012
+ const items = [...rowItemsIndexes];
2013
+ items.splice(vIndex + 1, 0, ...groupItems);
2014
+ result.items = items;
2015
+ }
2016
+ return result;
2017
+ }
2018
+
2019
+ const TRIMMED_GROUPING = 'grouping';
2020
+ /**
2021
+ * Prepare trimming updated indexes for grouping
2022
+ * @param initiallyTrimed
2023
+ * @param firstLevelMap
2024
+ * @param secondLevelMap
2025
+ */
2026
+ function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
2027
+ const trimemedOptionsToUpgrade = {};
2028
+ /**
2029
+ * go through all groups except grouping
2030
+ */
2031
+ for (let type in initiallyTrimed) {
2032
+ if (type === TRIMMED_GROUPING) {
2033
+ continue;
2034
+ }
2035
+ const items = initiallyTrimed[type];
2036
+ const newItems = {};
2037
+ for (let initialIndex in items) {
2038
+ /**
2039
+ * if item exists we find it in collection
2040
+ * we support 2 level of conversions
2041
+ */
2042
+ let newConversionIndex = firstLevelMap[initialIndex];
2043
+ if (secondLevelMap) {
2044
+ newConversionIndex = secondLevelMap[newConversionIndex];
2045
+ }
2046
+ /**
2047
+ * if item was trimmed previously
2048
+ * trimming makes sense to apply
2049
+ */
2050
+ if (items[initialIndex]) {
2051
+ newItems[newConversionIndex] = true;
2052
+ /**
2053
+ * If changes present apply changes to new source
2054
+ */
2055
+ if (newConversionIndex !== parseInt(initialIndex, 10)) {
2056
+ trimemedOptionsToUpgrade[type] = newItems;
2057
+ }
2058
+ }
2059
+ }
2060
+ }
2061
+ return trimemedOptionsToUpgrade;
2062
+ }
2063
+
2064
+ class GroupingRowPlugin extends BasePlugin {
2065
+ getStore(type = GROUPING_ROW_TYPE) {
2066
+ return this.providers.data.stores[type].store;
2067
+ }
2068
+ constructor(revogrid, providers) {
2069
+ super(revogrid, providers);
2070
+ }
2071
+ // befoce cell focus
2072
+ onFocus(e) {
2073
+ if (isGrouping(e.detail.model)) {
2074
+ e.preventDefault();
2075
+ }
2076
+ }
2077
+ // expand event triggered
2078
+ onExpand({ virtualIndex }) {
2079
+ const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2080
+ let newTrimmed = this.getStore().get('trimmed')[TRIMMED_GROUPING];
2081
+ let i = getPhysical(this.getStore(), virtualIndex);
2082
+ const isExpanded = getExpanded(source[i]);
2083
+ if (!isExpanded) {
2084
+ const { trimmed, items } = doExpand(virtualIndex, source, this.getStore().get('items'));
2085
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2086
+ if (items) {
2087
+ setItems(this.getStore(), items);
2088
+ }
2089
+ }
2090
+ else {
2091
+ const { trimmed } = doCollapse(i, source);
2092
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2093
+ this.revogrid.clearFocus();
2094
+ }
2095
+ this.getStore().set('source', source);
2096
+ this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
2097
+ }
2098
+ setColumnGrouping(cols) {
2099
+ // if 0 column as holder
2100
+ if (cols === null || cols === void 0 ? void 0 : cols.length) {
2101
+ cols[0][PSEUDO_GROUP_COLUMN] = true;
2102
+ return true;
2103
+ }
2104
+ return false;
2105
+ }
2106
+ setColumns({ columns }) {
2107
+ for (let type of columnTypes) {
2108
+ if (this.setColumnGrouping(columns[type])) {
2109
+ break;
2110
+ }
2111
+ }
2112
+ }
2113
+ // evaluate drag between groups
2114
+ onDrag(e) {
2115
+ const { from, to } = e.detail;
2116
+ const isDown = to - from >= 0;
2117
+ const { source } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'));
2118
+ const items = this.getStore().get('items');
2119
+ let i = isDown ? from : to;
2120
+ const end = isDown ? to : from;
2121
+ for (; i < end; i++) {
2122
+ const model = source[items[i]];
2123
+ const isGroup = isGrouping(model);
2124
+ if (isGroup) {
2125
+ e.preventDefault();
2126
+ return;
2127
+ }
2128
+ }
2129
+ }
2130
+ beforeTrimmedApply(trimmed, type) {
2131
+ /** Before filter apply remove grouping filtering */
2132
+ if (type === FILTER_TRIMMED_TYPE) {
2133
+ const source = this.getStore().get('source');
2134
+ for (let index in trimmed) {
2135
+ if (trimmed[index] && isGrouping(source[index])) {
2136
+ trimmed[index] = false;
2137
+ }
2138
+ }
2139
+ }
2140
+ }
2141
+ isSortingRunning() {
2142
+ const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
2143
+ return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
2144
+ }
2145
+ /**
2146
+ * Starts global source update with group clearing and applying new one
2147
+ * Initiated when need to reapply grouping
2148
+ */
2149
+ doSourceUpdate(options) {
2150
+ var _a;
2151
+ /**
2152
+ * Get source without grouping
2153
+ * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
2154
+ */
2155
+ const store = this.getStore();
2156
+ const { source, prevExpanded, oldNewIndexes } = getSource(store.get('source'), store.get('proxyItems'), true);
2157
+ const expanded = Object.assign({ prevExpanded }, options);
2158
+ /**
2159
+ * Group again
2160
+ * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
2161
+ */
2162
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], expanded);
2163
+ const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
2164
+ // setup source
2165
+ this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
2166
+ this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
2167
+ }
2168
+ /**
2169
+ * Apply grouping on data set
2170
+ * Clear grouping from source
2171
+ * If source came from other plugin
2172
+ */
2173
+ onDataSet(data) {
2174
+ var _a, _b;
2175
+ let preservedExpanded = {};
2176
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.preserveGroupingOnUpdate) !== false) {
2177
+ let { prevExpanded } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2178
+ preservedExpanded = prevExpanded;
2179
+ }
2180
+ const source = data.source.filter(s => !isGrouping(s));
2181
+ const options = Object.assign(Object.assign({}, (this.revogrid.grouping || {})), { prevExpanded: preservedExpanded });
2182
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
2183
+ data.source = sourceWithGroups;
2184
+ this.providers.data.setGrouping({ depth });
2185
+ this.updateTrimmed(trimmed, oldNewIndexMap);
2186
+ }
2187
+ /**
2188
+ * External call to apply grouping. Called by revogrid when prop changed.
2189
+ */
2190
+ setGrouping(options) {
2191
+ var _a, _b;
2192
+ // unsubscribe from all events when group applied
2193
+ this.clearSubscriptions();
2194
+ this.options = options;
2195
+ // clear props, no grouping exists
2196
+ if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
2197
+ this.clearGrouping();
2198
+ return;
2199
+ }
2200
+ // props exist and source initd
2201
+ const store = this.getStore();
2202
+ const { source } = getSource(store.get('source'), store.get('proxyItems'));
2203
+ if (source.length) {
2204
+ this.doSourceUpdate(Object.assign({}, options));
2205
+ }
2206
+ // props exist and columns initd
2207
+ for (let t of columnTypes) {
2208
+ if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
2209
+ this.providers.column.refreshByType(t);
2210
+ break;
2211
+ }
2212
+ }
2213
+ // if has any grouping subscribe to events again
2214
+ /** if grouping present and new data source arrived */
2215
+ this.addEventListener('beforesourceset', ({ detail }) => {
2216
+ var _a, _b, _c;
2217
+ 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))) {
2218
+ return;
2219
+ }
2220
+ // if sorting is running don't apply grouping, wait for sorting, then it'll apply in @aftersortingapply
2221
+ if (this.isSortingRunning()) {
2222
+ return;
2223
+ }
2224
+ this.onDataSet(detail);
2225
+ });
2226
+ this.addEventListener('beforecolumnsset', ({ detail }) => {
2227
+ this.setColumns(detail);
2228
+ });
2229
+ /**
2230
+ * filter applied need to clear grouping and apply again
2231
+ * based on new results can be new grouping
2232
+ */
2233
+ this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
2234
+ /**
2235
+ * sorting applied need to clear grouping and apply again
2236
+ * based on new results whole grouping order will changed
2237
+ */
2238
+ this.addEventListener('aftersortingapply', () => {
2239
+ var _a, _b;
2240
+ if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
2241
+ return;
2242
+ }
2243
+ this.doSourceUpdate(Object.assign({}, this.options));
2244
+ });
2245
+ /**
2246
+ * Apply logic for focus inside of grouping
2247
+ * We can't focus on grouping rows, navigation only inside of groups for now
2248
+ */
2249
+ this.addEventListener('beforecellfocus', e => this.onFocus(e));
2250
+ /**
2251
+ * Prevent rgRow drag outside the group
2252
+ */
2253
+ this.addEventListener('roworderchanged', e => this.onDrag(e));
2254
+ /**
2255
+ * When grouping expand icon was clicked
2256
+ */
2257
+ this.addEventListener(GROUP_EXPAND_EVENT, e => this.onExpand(e.detail));
2258
+ }
2259
+ // clear grouping
2260
+ clearGrouping() {
2261
+ // clear columns
2262
+ columnTypes.forEach(t => {
2263
+ const cols = this.providers.column.getColumns(t);
2264
+ let deleted = false;
2265
+ cols.forEach(c => {
2266
+ if (isGroupingColumn(c)) {
2267
+ delete c[PSEUDO_GROUP_COLUMN];
2268
+ deleted = true;
2269
+ }
2270
+ });
2271
+ // if column store had grouping clear and refresh
2272
+ if (deleted) {
2273
+ this.providers.column.refreshByType(t);
2274
+ }
2275
+ });
2276
+ // clear rows
2277
+ const { source, oldNewIndexes } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2278
+ this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2279
+ this.updateTrimmed(undefined, undefined, oldNewIndexes);
2280
+ }
2281
+ updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap) {
2282
+ // map previously trimmed data
2283
+ const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
2284
+ for (let type in trimemedOptionsToUpgrade) {
2285
+ this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
2286
+ }
2287
+ // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
2288
+ // setup trimmed data for grouping
2289
+ this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
2290
+ }
2291
+ }
2292
+
2293
+ const COLUMN_DRAG_CLASS = 'column-drag-start';
2294
+ class ColumnOrderHandler {
2295
+ constructor() {
2296
+ this.offset = 0;
2297
+ }
2298
+ renderAutoscroll(_, parent) {
2299
+ if (!parent) {
2300
+ return;
2301
+ }
2302
+ this.autoscrollEl = document.createElement('div');
2303
+ this.autoscrollEl.classList.add('drag-auto-scroll-y');
2304
+ parent.appendChild(this.autoscrollEl);
2305
+ }
2306
+ autoscroll(pos, dataContainerSize, direction = 'translateX') {
2307
+ if (!this.autoscrollEl) {
2308
+ return;
2309
+ }
2310
+ const helperOffset = 10;
2311
+ // calculate current y position inside of the grid active holder
2312
+ // 3 - size of element + border
2313
+ const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);
2314
+ this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;
2315
+ this.autoscrollEl.scrollIntoView({
2316
+ block: 'nearest',
2317
+ inline: 'nearest',
2318
+ });
2319
+ }
2320
+ start(e, { dataEl, gridRect, scrollEl, gridEl, }, dir = 'left') {
2321
+ gridEl.classList.add(COLUMN_DRAG_CLASS);
2322
+ const scrollContainerRect = scrollEl.getBoundingClientRect();
2323
+ if (scrollContainerRect) {
2324
+ this.offset = scrollContainerRect[dir] - gridRect[dir];
2325
+ }
2326
+ this.renderAutoscroll(e, dataEl);
2327
+ }
2328
+ stop(gridEl) {
2329
+ var _a;
2330
+ gridEl.classList.remove(COLUMN_DRAG_CLASS);
2331
+ if (this.element) {
2332
+ this.element.hidden = true;
2333
+ }
2334
+ this.offset = 0;
2335
+ (_a = this.autoscrollEl) === null || _a === void 0 ? void 0 : _a.remove();
2336
+ this.autoscrollEl = undefined;
2337
+ }
2338
+ showHandler(pos, size, columnWidth, direction = 'translateX') {
2339
+ if (!this.element) {
2340
+ return;
2341
+ }
2342
+ // do not allow overcross top of the scrollable area, header excluded
2343
+ if (this.offset) {
2344
+ pos = Math.max(pos, this.offset);
2345
+ }
2346
+ // can not be bigger then grid end
2347
+ pos = Math.min(pos, size);
2348
+ this.element.style.transform = `${direction}(${pos}px)`;
2349
+ this.element.style.width = `${columnWidth}px`;
2350
+ this.element.style.opacity = `10%`;
2351
+ this.element.hidden = false;
2352
+ }
2353
+ render() {
2354
+ const el = (this.element = document.createElement('div'));
2355
+ el.classList.add('drag-position-y');
2356
+ el.hidden = true;
2357
+ return el;
2358
+ }
2359
+ }
2360
+
2361
+ /**
2362
+ * Plugin for column manual move
2363
+ */
2364
+ const COLUMN_CLICK = ON_COLUMN_CLICK;
2365
+ const MOVE = 'columndragmousemove';
2366
+ const DRAG_END = 'columndragend';
2367
+ const BEFORE_DRAG_END = 'beforecolumndragend';
2368
+ // use this event subscription to drop D&D for particular columns
2369
+ const DRAG_START = 'columndragstart';
2370
+ class ColumnMovePlugin extends BasePlugin {
2371
+ constructor(revogrid, providers) {
2372
+ super(revogrid, providers);
2373
+ this.revogrid = revogrid;
2374
+ this.providers = providers;
2375
+ this.moveFunc = debounce((e) => this.doMove(e), 5);
2376
+ this.staticDragData = null;
2377
+ this.dragData = null;
2378
+ this.localSubscriptions = {};
2379
+ this.orderUi = new ColumnOrderHandler();
2380
+ revogrid.appendChild(this.orderUi.render());
2381
+ revogrid.classList.add('column-draggable');
2382
+ // Register events
2383
+ this.localSubscriptions['mouseleave'] = {
2384
+ target: document,
2385
+ callback: (e) => this.onMouseOut(e),
2386
+ };
2387
+ this.localSubscriptions['mouseup'] = {
2388
+ target: document,
2389
+ callback: (e) => this.onMouseUp(e),
2390
+ };
2391
+ this.localSubscriptions['mousemove'] = {
2392
+ target: document,
2393
+ callback: (e) => this.move(e),
2394
+ };
2395
+ this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
2396
+ }
2397
+ dragStart({ event, data }) {
2398
+ if (event.defaultPrevented) {
2399
+ return;
2400
+ }
2401
+ const { defaultPrevented } = dispatch(this.revogrid, DRAG_START, data);
2402
+ // check if allowed to drag particulat column
2403
+ if (defaultPrevented) {
2404
+ return;
2405
+ }
2406
+ this.clearOrder();
2407
+ const { mouseleave, mouseup, mousemove } = this.localSubscriptions;
2408
+ mouseleave.target.addEventListener('mouseleave', mouseleave.callback);
2409
+ mouseup.target.addEventListener('mouseup', mouseup.callback);
2410
+ const dataEl = event.target.closest('revogr-header');
2411
+ const scrollEl = event.target.closest('revogr-viewport-scroll');
2412
+ if (!dataEl || !scrollEl) {
2413
+ return;
2414
+ }
2415
+ // no grouping drag and no row header column drag
2416
+ if (isColGrouping(data) || data.providers.type === 'rowHeaders') {
2417
+ return;
2418
+ }
2419
+ const cols = this.getDimension(data.pin || 'rgCol');
2420
+ const gridRect = this.revogrid.getBoundingClientRect();
2421
+ const elRect = dataEl.getBoundingClientRect();
2422
+ const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
2423
+ this.staticDragData = {
2424
+ startPos: event.x,
2425
+ startItem,
2426
+ data,
2427
+ dataEl,
2428
+ scrollEl,
2429
+ gridEl: this.revogrid,
2430
+ cols,
2431
+ };
2432
+ this.dragData = this.getData(this.staticDragData);
2433
+ mousemove.target.addEventListener('mousemove', mousemove.callback);
2434
+ this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
2435
+ }
2436
+ doMove(e) {
2437
+ if (!this.staticDragData) {
2438
+ return;
2439
+ }
2440
+ const dragData = (this.dragData = this.getData(this.staticDragData));
2441
+ if (!dragData) {
2442
+ return;
2443
+ }
2444
+ const start = this.staticDragData.startPos;
2445
+ if (Math.abs(start - e.x) > 10) {
2446
+ const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2447
+ const rgCol = getItemByPosition(this.staticDragData.cols, x);
2448
+ this.orderUi.autoscroll(x, dragData.elRect.width);
2449
+ // prevent position change if out of bounds
2450
+ if (rgCol.itemIndex >= this.staticDragData.cols.count) {
2451
+ return;
2452
+ }
2453
+ this.orderUi.showHandler(rgCol.start + dragData.scrollOffset, dragData.gridRect.width, Math.abs(rgCol.end - rgCol.start));
2454
+ }
2455
+ }
2456
+ move(e) {
2457
+ dispatch(this.revogrid, MOVE, e);
2458
+ // then do move
2459
+ this.moveFunc(e);
2460
+ }
2461
+ onMouseOut(_) {
2462
+ this.clearOrder();
2463
+ }
2464
+ onMouseUp(e) {
2465
+ // apply new positions
2466
+ if (this.dragData && this.staticDragData) {
2467
+ let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2468
+ if (relativePos < 0) {
2469
+ relativePos = 0;
2470
+ }
2471
+ const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
2472
+ const store = this.providers.column.stores[this.dragData.type].store;
2473
+ const newItems = [...store.get('items')];
2474
+ const allColumns = store.get('source');
2475
+ const onDropColumn = allColumns[newPosition.itemIndex];
2476
+ // prevent position change if needed
2477
+ 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]] }));
2478
+ if (!stopDrag && onDropColumn && onDropColumn.draggable !== false) {
2479
+ const prevItems = [...newItems];
2480
+ // todo: if move item out of group remove item from group
2481
+ const toMove = newItems.splice(this.staticDragData.startItem.itemIndex, 1);
2482
+ newItems.splice(newPosition.itemIndex, 0, ...toMove);
2483
+ store.set('items', newItems);
2484
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
2485
+ }
2486
+ dispatch(this.revogrid, DRAG_END, this.dragData);
2487
+ }
2488
+ this.clearOrder();
2489
+ }
2490
+ clearLocalSubscriptions() {
2491
+ forEach(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));
2492
+ }
2493
+ clearOrder() {
2494
+ this.staticDragData = null;
2495
+ this.dragData = null;
2496
+ this.clearLocalSubscriptions();
2497
+ this.orderUi.stop(this.revogrid);
2498
+ }
2499
+ /**
2500
+ * Clearing subscription
2501
+ */
2502
+ clearSubscriptions() {
2503
+ super.clearSubscriptions();
2504
+ this.clearLocalSubscriptions();
2505
+ }
2506
+ getData({ gridEl, dataEl, data }) {
2507
+ const gridRect = gridEl.getBoundingClientRect();
2508
+ const elRect = dataEl.getBoundingClientRect();
2509
+ const scrollOffset = elRect.left - gridRect.left;
2510
+ return {
2511
+ elRect,
2512
+ gridRect,
2513
+ type: data.pin || 'rgCol',
2514
+ scrollOffset,
2515
+ };
2516
+ }
2517
+ getDimension(type) {
2518
+ return this.providers.dimension.stores[type].getCurrentState();
2519
+ }
2520
+ }
2521
+ function getLeftRelative(absoluteX, gridPos, offset) {
2522
+ return absoluteX - gridPos - offset;
2523
+ }
2524
+
2525
+ export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnMovePlugin as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, StretchColumn as S, ExportCsv as a, FILTER_CONFIG_CHANGED_EVENT as b, FILTE_PANEL as c, FilterPlugin as d, filterTypes as e, filterCoreFunctionsIndexedByType as f, filterNames as g, doCollapse as h, isStretchPlugin as i, doExpand as j, getLeftRelative as k, SortingPlugin as l, defaultCellCompare as m, descCellCompare as n, getNextOrder as o, getComparer as p, sortIndexByItems as s };
2526
+ //# sourceMappingURL=column.drag.plugin-BtuUyB-2.js.map
2527
+
2528
+ //# sourceMappingURL=column.drag.plugin-BtuUyB-2.js.map