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