@revolist/revogrid 4.9.41 → 4.9.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/dist/cjs/app-globals-c0b20747.js.map +1 -1
  2. package/dist/cjs/{column.drag.plugin-fcd892ec.js → column.drag.plugin-a6ef25bf.js} +1034 -149
  3. package/dist/cjs/column.drag.plugin-a6ef25bf.js.map +1 -0
  4. package/dist/cjs/column.service-831e1c92.js +1321 -0
  5. package/dist/cjs/column.service-831e1c92.js.map +1 -0
  6. package/dist/cjs/{column.service-26c61ed6.js → dimension.helpers-1927ad24.js} +490 -1273
  7. package/dist/cjs/dimension.helpers-1927ad24.js.map +1 -0
  8. package/dist/cjs/{edit.utils-179c0800.js → edit.utils-e51411f6.js} +3 -3
  9. package/dist/cjs/{edit.utils-179c0800.js.map → edit.utils-e51411f6.js.map} +1 -1
  10. package/dist/cjs/{header-cell-renderer-d879d95e.js → header-cell-renderer-53ecdcdb.js} +2 -2
  11. package/dist/cjs/{header-cell-renderer-d879d95e.js.map → header-cell-renderer-53ecdcdb.js.map} +1 -1
  12. package/dist/cjs/index.cjs.js +127 -69
  13. package/dist/cjs/index.cjs.js.map +1 -1
  14. package/dist/cjs/key.utils-96d0bc42.js +101 -0
  15. package/dist/cjs/key.utils-96d0bc42.js.map +1 -0
  16. package/dist/cjs/loader.cjs.js +1 -1
  17. package/dist/cjs/revo-grid.cjs.entry.js +310 -941
  18. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  19. package/dist/cjs/revo-grid.cjs.js +1 -1
  20. package/dist/cjs/revogr-attribution_7.cjs.entry.js +100 -70
  21. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  22. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +11 -10
  23. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  24. package/dist/cjs/revogr-data_4.cjs.entry.js +88 -78
  25. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  26. package/dist/cjs/revogr-filter-panel.cjs.entry.js +33 -13
  27. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  28. package/dist/cjs/{text-editor-b756d6b3.js → text-editor-1afffaf1.js} +6 -6
  29. package/dist/cjs/text-editor-1afffaf1.js.map +1 -0
  30. package/dist/cjs/{throttle-a57f51f9.js → throttle-bb713c73.js} +4 -4
  31. package/dist/cjs/{throttle-a57f51f9.js.map → throttle-bb713c73.js.map} +1 -1
  32. package/dist/cjs/{row-header-utils-c37f76e4.js → viewport.store-69b45f22.js} +15 -14
  33. package/dist/cjs/viewport.store-69b45f22.js.map +1 -0
  34. package/dist/collection/components/attribution/revogr-attribution.js +1 -1
  35. package/dist/collection/components/attribution/revogr-attribution.js.map +1 -1
  36. package/dist/collection/components/data/cell-renderer.js +11 -9
  37. package/dist/collection/components/data/cell-renderer.js.map +1 -1
  38. package/dist/collection/components/data/column.service.js +7 -19
  39. package/dist/collection/components/data/column.service.js.map +1 -1
  40. package/dist/collection/components/data/revogr-data-style.css +10 -5
  41. package/dist/collection/components/data/revogr-data.js +50 -28
  42. package/dist/collection/components/data/revogr-data.js.map +1 -1
  43. package/dist/collection/components/data/row-highlight.plugin.js.map +1 -1
  44. package/dist/collection/components/data/row-renderer.js.map +1 -1
  45. package/dist/collection/components/editors/revogr-edit-style.css +8 -5
  46. package/dist/collection/components/editors/revogr-edit.js +2 -2
  47. package/dist/collection/components/editors/revogr-edit.js.map +1 -1
  48. package/dist/collection/components/editors/text-editor.js +2 -2
  49. package/dist/collection/components/editors/text-editor.js.map +1 -1
  50. package/dist/collection/components/extra/revogr-extra.js +44 -6
  51. package/dist/collection/components/extra/revogr-extra.js.map +1 -1
  52. package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
  53. package/dist/collection/components/header/header-renderer.js.map +1 -1
  54. package/dist/collection/components/header/resizable.element.js.map +1 -1
  55. package/dist/collection/components/header/revogr-header-style.css +8 -5
  56. package/dist/collection/components/header/revogr-header.js +9 -9
  57. package/dist/collection/components/header/revogr-header.js.map +1 -1
  58. package/dist/collection/components/order/order-renderer.js.map +1 -1
  59. package/dist/collection/components/order/revogr-order-editor.js +12 -24
  60. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  61. package/dist/collection/components/overlay/autofill.service.js +7 -5
  62. package/dist/collection/components/overlay/autofill.service.js.map +1 -1
  63. package/dist/collection/components/overlay/keyboard.service.js +1 -4
  64. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  65. package/dist/collection/components/overlay/revogr-overlay-selection.js +88 -72
  66. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  67. package/dist/collection/components/overlay/revogr-overlay-style.css +8 -5
  68. package/dist/collection/components/overlay/selection.utils.js.map +1 -1
  69. package/dist/collection/components/revoGrid/plugin.service.js +81 -0
  70. package/dist/collection/components/revoGrid/plugin.service.js.map +1 -0
  71. package/dist/collection/components/revoGrid/revo-grid-style.css +18 -11
  72. package/dist/collection/components/revoGrid/revo-grid.js +289 -140
  73. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  74. package/dist/collection/components/revoGrid/viewport.service.js +9 -9
  75. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
  76. package/dist/collection/components/rowHeaders/revogr-row-headers.js +1 -1
  77. package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -1
  78. package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -1
  79. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +8 -5
  80. package/dist/collection/components/scroll/revogr-viewport-scroll.js +26 -20
  81. package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
  82. package/dist/collection/components/scrollable/revogr-scroll-style.css +10 -7
  83. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +10 -8
  84. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
  85. package/dist/collection/components/selectionFocus/revogr-focus-style.css +8 -5
  86. package/dist/collection/components/selectionFocus/revogr-focus.js +10 -10
  87. package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -1
  88. package/dist/collection/components/selectionTempRange/revogr-temp-range-style.css +8 -5
  89. package/dist/collection/components/selectionTempRange/revogr-temp-range.js +6 -6
  90. package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -1
  91. package/dist/collection/components/vnode/vnode-converter.js +1 -1
  92. package/dist/collection/components/vnode/vnode-converter.js.map +1 -1
  93. package/dist/collection/components/vnode/vnode.utils.js.map +1 -1
  94. package/dist/collection/index.js.map +1 -1
  95. package/dist/collection/plugins/add-rows-on-paste.plugin.js +40 -0
  96. package/dist/collection/plugins/add-rows-on-paste.plugin.js.map +1 -0
  97. package/dist/collection/plugins/base.plugin.js.map +1 -1
  98. package/dist/collection/plugins/column.auto-size.plugin.js +1 -1
  99. package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -1
  100. package/dist/collection/plugins/column.stretch.plugin.js +1 -1
  101. package/dist/collection/plugins/column.stretch.plugin.js.map +1 -1
  102. package/dist/collection/plugins/export/csv.js +1 -1
  103. package/dist/collection/plugins/export/csv.js.map +1 -1
  104. package/dist/collection/plugins/export/export.plugin.js +4 -2
  105. package/dist/collection/plugins/export/export.plugin.js.map +1 -1
  106. package/dist/collection/plugins/filter/filter.indexed.js +1 -0
  107. package/dist/collection/plugins/filter/filter.indexed.js.map +1 -1
  108. package/dist/collection/plugins/filter/filter.panel.js +35 -35
  109. package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
  110. package/dist/collection/plugins/filter/filter.plugin.js +117 -77
  111. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
  112. package/dist/collection/plugins/filter/filter.style.css +19 -5
  113. package/dist/collection/plugins/filter/filter.types.js.map +1 -1
  114. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js.map +1 -1
  115. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js.map +1 -1
  116. package/dist/collection/plugins/groupingRow/grouping.const.js +1 -0
  117. package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -1
  118. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +64 -79
  119. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
  120. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +3 -3
  121. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -1
  122. package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -1
  123. package/dist/collection/plugins/groupingRow/grouping.service.js +40 -6
  124. package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -1
  125. package/dist/collection/plugins/index.js +2 -0
  126. package/dist/collection/plugins/index.js.map +1 -1
  127. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +12 -6
  128. package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
  129. package/dist/collection/plugins/sorting/sorting.func.js +42 -0
  130. package/dist/collection/plugins/sorting/sorting.func.js.map +1 -0
  131. package/dist/collection/plugins/sorting/sorting.plugin.js +71 -69
  132. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  133. package/dist/collection/plugins/sorting/sorting.types.js +2 -0
  134. package/dist/collection/plugins/sorting/sorting.types.js.map +1 -0
  135. package/dist/collection/serve/controller.js +32 -15
  136. package/dist/collection/serve/data.js +18 -11
  137. package/dist/collection/services/column.data.provider.js +5 -2
  138. package/dist/collection/services/column.data.provider.js.map +1 -1
  139. package/dist/collection/services/data.provider.js +18 -7
  140. package/dist/collection/services/data.provider.js.map +1 -1
  141. package/dist/collection/services/dimension.provider.js +32 -33
  142. package/dist/collection/services/dimension.provider.js.map +1 -1
  143. package/dist/collection/services/selection.store.connector.js +1 -1
  144. package/dist/collection/services/selection.store.connector.js.map +1 -1
  145. package/dist/collection/store/dataSource/data.proxy.js +9 -15
  146. package/dist/collection/store/dataSource/data.proxy.js.map +1 -1
  147. package/dist/collection/store/dataSource/data.store.js +1 -1
  148. package/dist/collection/store/dataSource/data.store.js.map +1 -1
  149. package/dist/collection/store/dataSource/trimmed.plugin.js +5 -8
  150. package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
  151. package/dist/collection/store/dimension/dimension.helpers.js +7 -9
  152. package/dist/collection/store/dimension/dimension.helpers.js.map +1 -1
  153. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
  154. package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
  155. package/dist/collection/store/dimension/dimension.store.js +47 -67
  156. package/dist/collection/store/dimension/dimension.store.js.map +1 -1
  157. package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
  158. package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
  159. package/dist/collection/store/selection/selection.store.js +1 -1
  160. package/dist/collection/store/selection/selection.store.js.map +1 -1
  161. package/dist/collection/store/vp/viewport.store.js +4 -2
  162. package/dist/collection/store/vp/viewport.store.js.map +1 -1
  163. package/dist/collection/types/events.js +6 -2
  164. package/dist/collection/types/events.js.map +1 -1
  165. package/dist/collection/types/interfaces.js +4 -0
  166. package/dist/collection/types/interfaces.js.map +1 -1
  167. package/dist/collection/types/plugin.types.js.map +1 -1
  168. package/dist/collection/types/selection.js.map +1 -1
  169. package/dist/collection/types/viewport.interfaces.js.map +1 -1
  170. package/dist/collection/utils/column.utils.js +13 -3
  171. package/dist/collection/utils/column.utils.js.map +1 -1
  172. package/dist/esm/app-globals-3a760941.js.map +1 -1
  173. package/dist/esm/{column.drag.plugin-3cc77986.js → column.drag.plugin-50f49fa9.js} +1012 -130
  174. package/dist/esm/column.drag.plugin-50f49fa9.js.map +1 -0
  175. package/dist/esm/column.service-a6a7c415.js +1281 -0
  176. package/dist/esm/column.service-a6a7c415.js.map +1 -0
  177. package/dist/esm/{debounce-72878ced.js → debounce-b3166f78.js} +2 -2
  178. package/dist/esm/{debounce-72878ced.js.map → debounce-b3166f78.js.map} +1 -1
  179. package/dist/esm/{column.service-751345b2.js → dimension.helpers-d0d709c4.js} +450 -1234
  180. package/dist/esm/dimension.helpers-d0d709c4.js.map +1 -0
  181. package/dist/esm/{edit.utils-6fc686b9.js → edit.utils-0ae0db50.js} +2 -2
  182. package/dist/esm/{edit.utils-6fc686b9.js.map → edit.utils-0ae0db50.js.map} +1 -1
  183. package/dist/esm/{header-cell-renderer-32d2ed96.js → header-cell-renderer-36ecbdef.js} +2 -2
  184. package/dist/esm/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-36ecbdef.js.map} +1 -1
  185. package/dist/esm/index.js +52 -11
  186. package/dist/esm/index.js.map +1 -1
  187. package/dist/esm/{key.utils-17273f42.js → key.utils-7c3218d4.js} +2 -2
  188. package/dist/esm/{key.utils-17273f42.js.map → key.utils-7c3218d4.js.map} +1 -1
  189. package/dist/esm/loader.js +1 -1
  190. package/dist/esm/revo-grid.entry.js +246 -877
  191. package/dist/esm/revo-grid.entry.js.map +1 -1
  192. package/dist/esm/revo-grid.js +1 -1
  193. package/dist/esm/revogr-attribution_7.entry.js +63 -33
  194. package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
  195. package/dist/esm/revogr-clipboard_3.entry.js +7 -6
  196. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  197. package/dist/esm/revogr-data_4.entry.js +60 -50
  198. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  199. package/dist/esm/revogr-filter-panel.entry.js +34 -14
  200. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  201. package/dist/esm/{text-editor-901c3eb8.js → text-editor-148a17c1.js} +5 -5
  202. package/dist/esm/text-editor-148a17c1.js.map +1 -0
  203. package/dist/esm/{throttle-138d69c3.js → throttle-394e489c.js} +3 -3
  204. package/dist/esm/{throttle-138d69c3.js.map → throttle-394e489c.js.map} +1 -1
  205. package/dist/esm/{row-header-utils-3dfbb81f.js → viewport.store-afa8c4fe.js} +11 -10
  206. package/dist/esm/viewport.store-afa8c4fe.js.map +1 -0
  207. package/dist/revo-grid/app-globals-3a760941.js +8 -1
  208. package/dist/revo-grid/app-globals-3a760941.js.map +1 -1
  209. package/dist/revo-grid/column.drag.plugin-50f49fa9.js +2541 -0
  210. package/dist/revo-grid/column.drag.plugin-50f49fa9.js.map +1 -0
  211. package/dist/revo-grid/column.service-a6a7c415.js +1281 -0
  212. package/dist/revo-grid/column.service-a6a7c415.js.map +1 -0
  213. package/dist/revo-grid/debounce-b3166f78.js +495 -0
  214. package/dist/revo-grid/debounce-b3166f78.js.map +1 -0
  215. package/dist/revo-grid/dimension.helpers-d0d709c4.js +3611 -0
  216. package/dist/revo-grid/dimension.helpers-d0d709c4.js.map +1 -0
  217. package/dist/revo-grid/edit.utils-0ae0db50.js +17 -0
  218. package/dist/revo-grid/edit.utils-0ae0db50.js.map +1 -0
  219. package/dist/revo-grid/events-cf0893a3.js +38 -1
  220. package/dist/revo-grid/events-cf0893a3.js.map +1 -1
  221. package/dist/revo-grid/filter.button-d40ab17b.js +34 -1
  222. package/dist/revo-grid/filter.button-d40ab17b.js.map +1 -1
  223. package/dist/revo-grid/header-cell-renderer-36ecbdef.js +339 -0
  224. package/dist/revo-grid/header-cell-renderer-36ecbdef.js.map +1 -0
  225. package/dist/revo-grid/index-a61f225b.js +1845 -2
  226. package/dist/revo-grid/index-a61f225b.js.map +1 -1
  227. package/dist/revo-grid/index.esm.js +160 -1
  228. package/dist/revo-grid/index.esm.js.map +1 -1
  229. package/dist/revo-grid/key.utils-7c3218d4.js +89 -0
  230. package/dist/revo-grid/key.utils-7c3218d4.js.map +1 -0
  231. package/dist/revo-grid/resize-observer-83c9e167.js +501 -1
  232. package/dist/revo-grid/resize-observer-83c9e167.js.map +1 -1
  233. package/dist/revo-grid/revo-grid.entry.js +1934 -1
  234. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  235. package/dist/revo-grid/revo-grid.esm.js +21 -1
  236. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  237. package/dist/revo-grid/revogr-attribution_7.entry.js +1431 -1
  238. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
  239. package/dist/revo-grid/revogr-clipboard_3.entry.js +455 -1
  240. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  241. package/dist/revo-grid/revogr-data_4.entry.js +974 -1
  242. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  243. package/dist/revo-grid/revogr-filter-panel.entry.js +340 -1
  244. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  245. package/dist/revo-grid/sorting.sign-1a675bf7.js +9 -1
  246. package/dist/revo-grid/sorting.sign-1a675bf7.js.map +1 -1
  247. package/dist/revo-grid/text-editor-148a17c1.js +80 -0
  248. package/dist/revo-grid/text-editor-148a17c1.js.map +1 -0
  249. package/dist/revo-grid/throttle-394e489c.js +230 -0
  250. package/dist/revo-grid/throttle-394e489c.js.map +1 -0
  251. package/dist/revo-grid/viewport.helpers-7e7f9dad.js +48 -1
  252. package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -1
  253. package/dist/revo-grid/viewport.store-afa8c4fe.js +406 -0
  254. package/dist/revo-grid/viewport.store-afa8c4fe.js.map +1 -0
  255. package/dist/types/components/data/cell-renderer.d.ts +3 -5
  256. package/dist/types/components/data/column.service.d.ts +2 -3
  257. package/dist/types/components/data/revogr-data.d.ts +10 -6
  258. package/dist/types/components/data/row-highlight.plugin.d.ts +1 -1
  259. package/dist/types/components/data/row-renderer.d.ts +1 -1
  260. package/dist/types/components/editors/revogr-edit.d.ts +2 -2
  261. package/dist/types/components/editors/text-editor.d.ts +5 -6
  262. package/dist/types/components/extra/revogr-extra.d.ts +17 -3
  263. package/dist/types/components/header/header-cell-renderer.d.ts +1 -1
  264. package/dist/types/components/header/header-renderer.d.ts +2 -2
  265. package/dist/types/components/header/resizable.element.d.ts +1 -1
  266. package/dist/types/components/header/revogr-header.d.ts +2 -3
  267. package/dist/types/components/order/order-renderer.d.ts +1 -1
  268. package/dist/types/components/order/revogr-order-editor.d.ts +4 -10
  269. package/dist/types/components/overlay/autofill.service.d.ts +2 -2
  270. package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
  271. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +16 -13
  272. package/dist/types/components/overlay/selection.utils.d.ts +1 -1
  273. package/dist/types/components/revoGrid/plugin.service.d.ts +37 -0
  274. package/dist/types/components/revoGrid/revo-grid.d.ts +105 -61
  275. package/dist/types/components/revoGrid/viewport.service.d.ts +2 -2
  276. package/dist/types/components/rowHeaders/row-header-render.d.ts +2 -2
  277. package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +2 -5
  278. package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +2 -3
  279. package/dist/types/components/selectionFocus/revogr-focus.d.ts +2 -2
  280. package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +2 -3
  281. package/dist/types/components/vnode/vnode-converter.d.ts +1 -1
  282. package/dist/types/components/vnode/vnode.utils.d.ts +2 -2
  283. package/dist/types/components.d.ts +191 -108
  284. package/dist/types/index.d.ts +1 -1
  285. package/dist/types/plugins/add-rows-on-paste.plugin.d.ts +14 -0
  286. package/dist/types/plugins/base.plugin.d.ts +3 -4
  287. package/dist/types/plugins/column.auto-size.plugin.d.ts +1 -1
  288. package/dist/types/plugins/column.stretch.plugin.d.ts +1 -1
  289. package/dist/types/plugins/export/csv.d.ts +1 -1
  290. package/dist/types/plugins/export/export.plugin.d.ts +4 -3
  291. package/dist/types/plugins/filter/filter.panel.d.ts +2 -2
  292. package/dist/types/plugins/filter/filter.plugin.d.ts +25 -7
  293. package/dist/types/plugins/filter/filter.types.d.ts +32 -10
  294. package/dist/types/plugins/groupingColumn/columnGroupsRenderer.d.ts +2 -2
  295. package/dist/types/plugins/groupingColumn/headerGroupRenderer.d.ts +3 -4
  296. package/dist/types/plugins/groupingRow/grouping.const.d.ts +3 -1
  297. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +15 -10
  298. package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +38 -4
  299. package/dist/types/plugins/groupingRow/grouping.service.d.ts +9 -12
  300. package/dist/types/plugins/index.d.ts +2 -0
  301. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +2 -2
  302. package/dist/types/plugins/sorting/sorting.func.d.ts +3 -0
  303. package/dist/types/plugins/sorting/sorting.plugin.d.ts +14 -13
  304. package/dist/types/plugins/sorting/sorting.types.d.ts +13 -0
  305. package/dist/types/services/column.data.provider.d.ts +5 -2
  306. package/dist/types/services/data.provider.d.ts +3 -1
  307. package/dist/types/services/dimension.provider.d.ts +9 -4
  308. package/dist/types/services/selection.store.connector.d.ts +4 -4
  309. package/dist/types/store/dataSource/data.proxy.d.ts +7 -9
  310. package/dist/types/store/dataSource/data.store.d.ts +2 -3
  311. package/dist/types/store/dataSource/trimmed.plugin.d.ts +1 -1
  312. package/dist/types/store/dimension/dimension.helpers.d.ts +1 -4
  313. package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
  314. package/dist/types/store/dimension/dimension.store.d.ts +3 -2
  315. package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
  316. package/dist/types/store/selection/selection.store.d.ts +1 -1
  317. package/dist/types/store/vp/viewport.store.d.ts +1 -1
  318. package/dist/types/types/events.d.ts +1 -1
  319. package/dist/types/types/interfaces.d.ts +36 -12
  320. package/dist/types/types/plugin.types.d.ts +17 -1
  321. package/dist/types/types/selection.d.ts +23 -17
  322. package/dist/types/types/viewport.interfaces.d.ts +1 -3
  323. package/dist/types/utils/column.utils.d.ts +1 -0
  324. package/hydrate/index.js +2490 -2135
  325. package/hydrate/index.mjs +2490 -2135
  326. package/package.json +20 -19
  327. package/readme.md +15 -17
  328. package/standalone/column.service.js +192 -160
  329. package/standalone/column.service.js.map +1 -1
  330. package/standalone/data.store.js +36 -25
  331. package/standalone/data.store.js.map +1 -1
  332. package/standalone/dimension.helpers.js +8 -10
  333. package/standalone/dimension.helpers.js.map +1 -1
  334. package/standalone/index.js +46 -6
  335. package/standalone/index.js.map +1 -1
  336. package/standalone/revo-grid.js +1275 -1022
  337. package/standalone/revo-grid.js.map +1 -1
  338. package/standalone/revogr-attribution2.js +1 -1
  339. package/standalone/revogr-attribution2.js.map +1 -1
  340. package/standalone/revogr-data2.js +26 -22
  341. package/standalone/revogr-data2.js.map +1 -1
  342. package/standalone/revogr-edit2.js +3 -3
  343. package/standalone/revogr-edit2.js.map +1 -1
  344. package/standalone/revogr-extra2.js +25 -4
  345. package/standalone/revogr-extra2.js.map +1 -1
  346. package/standalone/revogr-filter-panel.js +34 -14
  347. package/standalone/revogr-filter-panel.js.map +1 -1
  348. package/standalone/revogr-focus2.js +2 -1
  349. package/standalone/revogr-focus2.js.map +1 -1
  350. package/standalone/revogr-header2.js +6 -5
  351. package/standalone/revogr-header2.js.map +1 -1
  352. package/standalone/revogr-order-editor2.js +3 -0
  353. package/standalone/revogr-order-editor2.js.map +1 -1
  354. package/standalone/revogr-overlay-selection2.js +29 -17
  355. package/standalone/revogr-overlay-selection2.js.map +1 -1
  356. package/standalone/revogr-row-headers2.js +12 -9
  357. package/standalone/revogr-row-headers2.js.map +1 -1
  358. package/standalone/revogr-scroll-virtual2.js +6 -4
  359. package/standalone/revogr-scroll-virtual2.js.map +1 -1
  360. package/standalone/revogr-temp-range2.js +1 -1
  361. package/standalone/revogr-temp-range2.js.map +1 -1
  362. package/standalone/revogr-viewport-scroll2.js +27 -21
  363. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  364. package/standalone/selection.utils.js +1 -0
  365. package/standalone/selection.utils.js.map +1 -1
  366. package/standalone/vnode-converter.js +1 -1
  367. package/standalone/vnode-converter.js.map +1 -1
  368. package/dist/cjs/column.drag.plugin-fcd892ec.js.map +0 -1
  369. package/dist/cjs/column.service-26c61ed6.js.map +0 -1
  370. package/dist/cjs/index-3ab26ab9.js +0 -513
  371. package/dist/cjs/index-3ab26ab9.js.map +0 -1
  372. package/dist/cjs/key.utils-f49d7bee.js +0 -101
  373. package/dist/cjs/key.utils-f49d7bee.js.map +0 -1
  374. package/dist/cjs/row-header-utils-c37f76e4.js.map +0 -1
  375. package/dist/cjs/text-editor-b756d6b3.js.map +0 -1
  376. package/dist/esm/column.drag.plugin-3cc77986.js.map +0 -1
  377. package/dist/esm/column.service-751345b2.js.map +0 -1
  378. package/dist/esm/index-1dcad6ef.js +0 -476
  379. package/dist/esm/index-1dcad6ef.js.map +0 -1
  380. package/dist/esm/row-header-utils-3dfbb81f.js.map +0 -1
  381. package/dist/esm/text-editor-901c3eb8.js.map +0 -1
  382. package/dist/revo-grid/column.drag.plugin-3cc77986.js +0 -5
  383. package/dist/revo-grid/column.drag.plugin-3cc77986.js.map +0 -1
  384. package/dist/revo-grid/column.service-751345b2.js +0 -5
  385. package/dist/revo-grid/column.service-751345b2.js.map +0 -1
  386. package/dist/revo-grid/debounce-72878ced.js +0 -5
  387. package/dist/revo-grid/debounce-72878ced.js.map +0 -1
  388. package/dist/revo-grid/edit.utils-6fc686b9.js +0 -5
  389. package/dist/revo-grid/edit.utils-6fc686b9.js.map +0 -1
  390. package/dist/revo-grid/header-cell-renderer-32d2ed96.js +0 -5
  391. package/dist/revo-grid/header-cell-renderer-32d2ed96.js.map +0 -1
  392. package/dist/revo-grid/index-1dcad6ef.js +0 -5
  393. package/dist/revo-grid/index-1dcad6ef.js.map +0 -1
  394. package/dist/revo-grid/key.utils-17273f42.js +0 -5
  395. package/dist/revo-grid/key.utils-17273f42.js.map +0 -1
  396. package/dist/revo-grid/row-header-utils-3dfbb81f.js +0 -5
  397. package/dist/revo-grid/row-header-utils-3dfbb81f.js.map +0 -1
  398. package/dist/revo-grid/text-editor-901c3eb8.js +0 -5
  399. package/dist/revo-grid/text-editor-901c3eb8.js.map +0 -1
  400. package/dist/revo-grid/throttle-138d69c3.js +0 -5
  401. package/dist/revo-grid/throttle-138d69c3.js.map +0 -1
  402. package/standalone/identity.js +0 -26
  403. package/standalone/identity.js.map +0 -1
@@ -1,20 +1,17 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { a as isObject, b as baseGetTag, r as root, S as Symbol, c as isObjectLike, f as freeGlobal, i as isSymbol, t as toNumber } from './debounce-72878ced.js';
5
- import { z as identity, G as GRID_INTERNALS, C as CELL_CLASS, h as DISABLED_CLASS } from './index-1dcad6ef.js';
4
+ import { a as isObject, b as baseGetTag, r as root, S as Symbol, i as isObjectLike, f as freeGlobal, c as isSymbol, t as toNumber } from './debounce-b3166f78.js';
6
5
  import { g as getRenderingRef, f as forceUpdate } from './index-a61f225b.js';
7
6
 
7
+ /**
8
+ * Todo:
9
+ * Refactor proxy plugin: when items changed outside proxy get recalculated
10
+ */
8
11
  /**
9
12
  * Proxy plugin for data source.
10
- * This plugin is used to sort the data source.
11
- * It keeps the order of the items but does not modify the final source.
12
- * It is also used to filter the items in the data source.
13
- * The `set` method takes a key and a new value as arguments.
14
- * If the key is 'proxyItems' it will filter the items in the data source according to the new value.
15
- * The new value should be an array of numbers representing the indexes of the items that should be visible.
16
- * The method will return a new array of numbers with the indexes of the items that should be visible.
17
- * The method will also update the 'items' property of the store with the new array.
13
+ *
14
+ * This plugin is used keep sortint in the data source, even when trimming is applied sorting has to be preserved.
18
15
  */
19
16
  const proxyPlugin = (store) => ({
20
17
  /**
@@ -25,11 +22,11 @@ const proxyPlugin = (store) => ({
25
22
  * The method will also update the 'items' property of the store with the new array.
26
23
  */
27
24
  set(k, newVal) {
28
- if (!isProxy(k)) {
25
+ if (k !== 'proxyItems') {
29
26
  return;
30
27
  }
31
28
  /**
32
- * Getting existing collection of items
29
+ * Getting existing collection of items (trimmed and filtered)
33
30
  * Mark indexes as visible
34
31
  */
35
32
  const oldItems = store.get('items').reduce((r, v) => {
@@ -37,8 +34,7 @@ const proxyPlugin = (store) => ({
37
34
  return r;
38
35
  }, new Set());
39
36
  /**
40
- * Check if new values where present in items
41
- * Filter item collection according presense
37
+ * Check if new values where present in items, keep filtering and trimming
42
38
  */
43
39
  const newItems = newVal.reduce((r, i) => {
44
40
  if (oldItems.has(i)) {
@@ -49,9 +45,6 @@ const proxyPlugin = (store) => ({
49
45
  store.set('items', newItems);
50
46
  },
51
47
  });
52
- function isProxy(k) {
53
- return k === 'proxyItems';
54
- }
55
48
 
56
49
  /**
57
50
  * The base implementation of `_.findIndex` and `_.findLastIndex` without
@@ -2460,6 +2453,26 @@ function baseMatchesProperty(path, srcValue) {
2460
2453
  };
2461
2454
  }
2462
2455
 
2456
+ /**
2457
+ * This method returns the first argument it receives.
2458
+ *
2459
+ * @static
2460
+ * @since 0.1.0
2461
+ * @memberOf _
2462
+ * @category Util
2463
+ * @param {*} value Any value.
2464
+ * @returns {*} Returns `value`.
2465
+ * @example
2466
+ *
2467
+ * var object = { 'a': 1 };
2468
+ *
2469
+ * console.log(_.identity(object) === object);
2470
+ * // => true
2471
+ */
2472
+ function identity(value) {
2473
+ return value;
2474
+ }
2475
+
2463
2476
  /**
2464
2477
  * The base implementation of `_.property` without support for deep paths.
2465
2478
  *
@@ -2775,9 +2788,9 @@ function createRange(fromRight) {
2775
2788
  * _.range(0);
2776
2789
  * // => []
2777
2790
  */
2778
- var range = createRange();
2791
+ var range$1 = createRange();
2779
2792
 
2780
- const range$1 = range;
2793
+ const range$2 = range$1;
2781
2794
 
2782
2795
  const appendToMap = (map, propName, value) => {
2783
2796
  const items = map.get(propName);
@@ -2977,18 +2990,15 @@ const createStore = (defaultState, shouldUpdate) => {
2977
2990
  const trimmedPlugin = (store) => ({
2978
2991
  set(k, newVal) {
2979
2992
  switch (k) {
2980
- case 'trimmed':
2993
+ case 'trimmed': {
2994
+ // full sorted items list
2981
2995
  const proxy = store.get('proxyItems');
2982
2996
  const trimmed = gatherTrimmedItems(newVal);
2983
- const newItems = proxy.reduce((result, v) => {
2984
- // check if present in new trimmed remove from items (filter)
2985
- if (!trimmed[v]) {
2986
- result.push(v);
2987
- }
2988
- return result;
2989
- }, []);
2997
+ const newItems = proxy.filter(v => !trimmed[v]);
2998
+ // set trimmed items in store
2990
2999
  store.set('items', newItems);
2991
3000
  break;
3001
+ }
2992
3002
  }
2993
3003
  },
2994
3004
  });
@@ -3015,6 +3025,233 @@ function setStore(store, data) {
3015
3025
  });
3016
3026
  }
3017
3027
 
3028
+ const MIN_COL_SIZE = 30;
3029
+ const RESIZE_INTERVAL = 40;
3030
+ const DATA_COL = 'data-rgCol';
3031
+ const DATA_ROW = 'data-rgRow';
3032
+ const DISABLED_CLASS = 'disabled';
3033
+ const CELL_CLASS = 'rgCell';
3034
+ const ROW_HEADER_TYPE = 'rowHeaders';
3035
+ const HEADER_CLASS = 'rgHeaderCell';
3036
+ const HEADER_SORTABLE_CLASS = 'sortable';
3037
+ const HEADER_ROW_CLASS = 'header-rgRow';
3038
+ const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
3039
+ const DRAG_ICON_CLASS = 'revo-drag-icon';
3040
+ const DRAGGABLE_CLASS = 'revo-draggable';
3041
+ const FOCUS_CLASS = 'focused-cell';
3042
+ const SELECTION_BORDER_CLASS = 'selection-border-range';
3043
+ const MOBILE_CLASS = 'mobile-handler';
3044
+ const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
3045
+ const CELL_HANDLER_CLASS = 'autofill-handle';
3046
+ const EDIT_INPUT_WR = 'edit-input-wrapper';
3047
+ const DRAGG_TEXT = 'Draggable item';
3048
+ const GRID_INTERNALS = '__rvgr';
3049
+ const ROW_FOCUSED_CLASS = 'focused-rgRow';
3050
+
3051
+ var codes;
3052
+ (function (codes) {
3053
+ codes[codes["MOUSE_LEFT"] = 1] = "MOUSE_LEFT";
3054
+ codes[codes["MOUSE_RIGHT"] = 3] = "MOUSE_RIGHT";
3055
+ codes[codes["MOUSE_MIDDLE"] = 2] = "MOUSE_MIDDLE";
3056
+ codes[codes["BACKSPACE"] = 8] = "BACKSPACE";
3057
+ codes[codes["COMMA"] = 188] = "COMMA";
3058
+ codes[codes["INSERT"] = 45] = "INSERT";
3059
+ codes[codes["DELETE"] = 46] = "DELETE";
3060
+ codes[codes["END"] = 35] = "END";
3061
+ codes[codes["ENTER"] = 13] = "ENTER";
3062
+ codes[codes["ESCAPE"] = 27] = "ESCAPE";
3063
+ codes[codes["CONTROL"] = 17] = "CONTROL";
3064
+ codes[codes["COMMAND_LEFT"] = 91] = "COMMAND_LEFT";
3065
+ codes[codes["COMMAND_RIGHT"] = 93] = "COMMAND_RIGHT";
3066
+ codes[codes["COMMAND_FIREFOX"] = 224] = "COMMAND_FIREFOX";
3067
+ codes[codes["ALT"] = 18] = "ALT";
3068
+ codes[codes["HOME"] = 36] = "HOME";
3069
+ codes[codes["PAGE_DOWN"] = 34] = "PAGE_DOWN";
3070
+ codes[codes["PAGE_UP"] = 33] = "PAGE_UP";
3071
+ codes[codes["PERIOD"] = 190] = "PERIOD";
3072
+ codes[codes["SPACE"] = 32] = "SPACE";
3073
+ codes[codes["SHIFT"] = 16] = "SHIFT";
3074
+ codes[codes["CAPS_LOCK"] = 20] = "CAPS_LOCK";
3075
+ codes[codes["TAB"] = 9] = "TAB";
3076
+ codes[codes["ARROW_RIGHT"] = 39] = "ARROW_RIGHT";
3077
+ codes[codes["ARROW_LEFT"] = 37] = "ARROW_LEFT";
3078
+ codes[codes["ARROW_UP"] = 38] = "ARROW_UP";
3079
+ codes[codes["ARROW_DOWN"] = 40] = "ARROW_DOWN";
3080
+ codes[codes["F1"] = 112] = "F1";
3081
+ codes[codes["F2"] = 113] = "F2";
3082
+ codes[codes["F3"] = 114] = "F3";
3083
+ codes[codes["F4"] = 115] = "F4";
3084
+ codes[codes["F5"] = 116] = "F5";
3085
+ codes[codes["F6"] = 117] = "F6";
3086
+ codes[codes["F7"] = 118] = "F7";
3087
+ codes[codes["F8"] = 119] = "F8";
3088
+ codes[codes["F9"] = 120] = "F9";
3089
+ codes[codes["F10"] = 121] = "F10";
3090
+ codes[codes["F11"] = 122] = "F11";
3091
+ codes[codes["F12"] = 123] = "F12";
3092
+ codes[codes["A"] = 65] = "A";
3093
+ codes[codes["C"] = 67] = "C";
3094
+ codes[codes["D"] = 68] = "D";
3095
+ codes[codes["F"] = 70] = "F";
3096
+ codes[codes["L"] = 76] = "L";
3097
+ codes[codes["O"] = 79] = "O";
3098
+ codes[codes["P"] = 80] = "P";
3099
+ codes[codes["S"] = 83] = "S";
3100
+ codes[codes["V"] = 86] = "V";
3101
+ codes[codes["X"] = 88] = "X";
3102
+ })(codes || (codes = {}));
3103
+ var codesLetter;
3104
+ (function (codesLetter) {
3105
+ codesLetter["ENTER"] = "Enter";
3106
+ codesLetter["ENTER_NUM"] = "NumpadEnter";
3107
+ codesLetter["A"] = "KeyA";
3108
+ codesLetter["C"] = "KeyC";
3109
+ codesLetter["X"] = "KeyX";
3110
+ codesLetter["V"] = "KeyV";
3111
+ codesLetter["ESCAPE"] = "Escape";
3112
+ codesLetter["TAB"] = "Tab";
3113
+ codesLetter["BACKSPACE"] = "Backspace";
3114
+ codesLetter["DELETE"] = "Delete";
3115
+ codesLetter["ARROW_RIGHT"] = "ArrowRight";
3116
+ codesLetter["ARROW_LEFT"] = "ArrowLeft";
3117
+ codesLetter["ARROW_UP"] = "ArrowUp";
3118
+ codesLetter["ARROW_DOWN"] = "ArrowDown";
3119
+ codesLetter["SHIFT"] = "Shift";
3120
+ })(codesLetter || (codesLetter = {}));
3121
+ var keyValues;
3122
+ (function (keyValues) {
3123
+ keyValues["ENTER"] = "Enter";
3124
+ keyValues["TAB"] = "Tab";
3125
+ })(keyValues || (keyValues = {}));
3126
+ const KeyCodesEnum = codes;
3127
+
3128
+ var osPlatform;
3129
+ (function (osPlatform) {
3130
+ osPlatform["mac"] = "Mac";
3131
+ })(osPlatform || (osPlatform = {}));
3132
+ const OsPlatform = osPlatform;
3133
+
3134
+ /* Generate range on size
3135
+ */
3136
+ function range(size, startAt = 0) {
3137
+ const res = [];
3138
+ const end = startAt + size;
3139
+ for (let i = startAt; i < end; i++) {
3140
+ res.push(i);
3141
+ }
3142
+ return res;
3143
+ }
3144
+ /* Find index position in array */
3145
+ function findPositionInArray(el, compareFn) {
3146
+ return (function (arr) {
3147
+ let m = 0;
3148
+ let n = arr.length - 1;
3149
+ while (m <= n) {
3150
+ const k = (n + m) >> 1;
3151
+ const cmp = compareFn(el, arr[k]);
3152
+ if (cmp > 0) {
3153
+ m = k + 1;
3154
+ }
3155
+ else if (cmp < 0) {
3156
+ n = k - 1;
3157
+ }
3158
+ else {
3159
+ return k;
3160
+ }
3161
+ }
3162
+ return -m - 1;
3163
+ })(this);
3164
+ }
3165
+ /**
3166
+ * Sorted push
3167
+ */
3168
+ function pushSorted(arr, el, fn) {
3169
+ arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
3170
+ return arr;
3171
+ }
3172
+ // (arr1[index1] < arr2[index2])
3173
+ function simpleCompare(el1, el2) {
3174
+ return el1 < el2;
3175
+ }
3176
+ /**
3177
+ * Merge sorted array helper function
3178
+ */
3179
+ function mergeSortedArray(arr1, arr2, compareFn = simpleCompare) {
3180
+ const merged = [];
3181
+ let index1 = 0;
3182
+ let index2 = 0;
3183
+ let current = 0;
3184
+ while (current < arr1.length + arr2.length) {
3185
+ let isArr1Depleted = index1 >= arr1.length;
3186
+ let isArr2Depleted = index2 >= arr2.length;
3187
+ if (!isArr1Depleted && (isArr2Depleted || compareFn(arr1[index1], arr2[index2]))) {
3188
+ merged[current] = arr1[index1];
3189
+ index1++;
3190
+ }
3191
+ else {
3192
+ merged[current] = arr2[index2];
3193
+ index2++;
3194
+ }
3195
+ current++;
3196
+ }
3197
+ return merged;
3198
+ }
3199
+ /**
3200
+ * Calculate system scrollbar size
3201
+ */
3202
+ function getScrollbarSize(document) {
3203
+ // Create a temporary div container and append it to the body
3204
+ const container = document.createElement('div');
3205
+ // Apply styling to ensure the div is scrollable
3206
+ container.style.overflow = 'scroll';
3207
+ container.style.visibility = 'hidden'; // make sure the container isn't visible
3208
+ container.style.position = 'absolute';
3209
+ container.style.top = '-9999px'; // move it out of the screen
3210
+ container.style.width = '50px'; // arbitrary width
3211
+ container.style.height = '50px'; // arbitrary height
3212
+ // Append the div to the body
3213
+ document.body.appendChild(container);
3214
+ // Calculate the width of the scrollbar
3215
+ const scrollbarWidth = container.offsetWidth - container.clientWidth;
3216
+ // Remove the div from the body after calculation
3217
+ document.body.removeChild(container);
3218
+ // Return the calculated width of the scrollbar
3219
+ return scrollbarWidth;
3220
+ }
3221
+ /* Scale a value between 2 ranges
3222
+ *
3223
+ * Sample:
3224
+ * // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
3225
+ * const n = scaleValue(55, [0,100], [0,1000]);
3226
+ *
3227
+ * Ranges of two values
3228
+ * @from
3229
+ * @to
3230
+ *
3231
+ * ~~ return value does the equivalent of Math.floor but faster.
3232
+ */
3233
+ function scaleValue(value, from, to) {
3234
+ return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
3235
+ }
3236
+ /**
3237
+ * Async timeout
3238
+ */
3239
+ async function timeout(delay = 0) {
3240
+ await new Promise((r) => {
3241
+ setTimeout(() => r(), delay);
3242
+ });
3243
+ }
3244
+ /**
3245
+ * Type script mixins
3246
+ */
3247
+ function applyMixins(derivedCtor, constructors) {
3248
+ constructors.forEach(baseCtor => {
3249
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
3250
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
3251
+ });
3252
+ });
3253
+ }
3254
+
3018
3255
  /**
3019
3256
  * Data store
3020
3257
  * Manage the state of a data source and provide methods for updating, adding, and refreshing the data.
@@ -3040,7 +3277,7 @@ class DataStore {
3040
3277
  }
3041
3278
  // clear items
3042
3279
  this.store.set('items', []);
3043
- const items = range$1(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
3280
+ const items = range$2(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
3044
3281
  // set proxy first
3045
3282
  setStore(this.store, {
3046
3283
  source,
@@ -3150,1246 +3387,225 @@ function getSourceItemVirtualIndexByProp(store, prop) {
3150
3387
  return items.indexOf(physicalIndex);
3151
3388
  }
3152
3389
 
3153
- /**
3154
- * A specialized version of `_.reduce` for arrays without support for
3155
- * iteratee shorthands.
3156
- *
3157
- * @private
3158
- * @param {Array} [array] The array to iterate over.
3159
- * @param {Function} iteratee The function invoked per iteration.
3160
- * @param {*} [accumulator] The initial value.
3161
- * @param {boolean} [initAccum] Specify using the first element of `array` as
3162
- * the initial value.
3163
- * @returns {*} Returns the accumulated value.
3164
- */
3165
- function arrayReduce(array, iteratee, accumulator, initAccum) {
3166
- var index = -1,
3167
- length = array == null ? 0 : array.length;
3168
-
3169
- if (initAccum && length) {
3170
- accumulator = array[++index];
3171
- }
3172
- while (++index < length) {
3173
- accumulator = iteratee(accumulator, array[index], index, array);
3174
- }
3175
- return accumulator;
3176
- }
3390
+ /** Used as references for the maximum length and index of an array. */
3391
+ var MAX_ARRAY_LENGTH$1 = 4294967295,
3392
+ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$1 - 1;
3177
3393
 
3178
- /**
3179
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
3180
- *
3181
- * @private
3182
- * @param {boolean} [fromRight] Specify iterating from right to left.
3183
- * @returns {Function} Returns the new base function.
3184
- */
3185
- function createBaseFor(fromRight) {
3186
- return function(object, iteratee, keysFunc) {
3187
- var index = -1,
3188
- iterable = Object(object),
3189
- props = keysFunc(object),
3190
- length = props.length;
3191
-
3192
- while (length--) {
3193
- var key = props[fromRight ? length : ++index];
3194
- if (iteratee(iterable[key], key, iterable) === false) {
3195
- break;
3196
- }
3394
+ /* Built-in method references for those with the same name as other `lodash` methods. */
3395
+ var nativeFloor = Math.floor,
3396
+ nativeMin = Math.min;
3397
+
3398
+ /**
3399
+ * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
3400
+ * which invokes `iteratee` for `value` and each element of `array` to compute
3401
+ * their sort ranking. The iteratee is invoked with one argument; (value).
3402
+ *
3403
+ * @private
3404
+ * @param {Array} array The sorted array to inspect.
3405
+ * @param {*} value The value to evaluate.
3406
+ * @param {Function} iteratee The iteratee invoked per element.
3407
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
3408
+ * @returns {number} Returns the index at which `value` should be inserted
3409
+ * into `array`.
3410
+ */
3411
+ function baseSortedIndexBy(array, value, iteratee, retHighest) {
3412
+ var low = 0,
3413
+ high = array == null ? 0 : array.length;
3414
+ if (high === 0) {
3415
+ return 0;
3416
+ }
3417
+
3418
+ value = iteratee(value);
3419
+ var valIsNaN = value !== value,
3420
+ valIsNull = value === null,
3421
+ valIsSymbol = isSymbol(value),
3422
+ valIsUndefined = value === undefined;
3423
+
3424
+ while (low < high) {
3425
+ var mid = nativeFloor((low + high) / 2),
3426
+ computed = iteratee(array[mid]),
3427
+ othIsDefined = computed !== undefined,
3428
+ othIsNull = computed === null,
3429
+ othIsReflexive = computed === computed,
3430
+ othIsSymbol = isSymbol(computed);
3431
+
3432
+ if (valIsNaN) {
3433
+ var setLow = retHighest || othIsReflexive;
3434
+ } else if (valIsUndefined) {
3435
+ setLow = othIsReflexive && (retHighest || othIsDefined);
3436
+ } else if (valIsNull) {
3437
+ setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
3438
+ } else if (valIsSymbol) {
3439
+ setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
3440
+ } else if (othIsNull || othIsSymbol) {
3441
+ setLow = false;
3442
+ } else {
3443
+ setLow = retHighest ? (computed <= value) : (computed < value);
3197
3444
  }
3198
- return object;
3199
- };
3445
+ if (setLow) {
3446
+ low = mid + 1;
3447
+ } else {
3448
+ high = mid;
3449
+ }
3450
+ }
3451
+ return nativeMin(high, MAX_ARRAY_INDEX);
3200
3452
  }
3201
3453
 
3202
- /**
3203
- * The base implementation of `baseForOwn` which iterates over `object`
3204
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
3205
- * Iteratee functions may exit iteration early by explicitly returning `false`.
3206
- *
3207
- * @private
3208
- * @param {Object} object The object to iterate over.
3209
- * @param {Function} iteratee The function invoked per iteration.
3210
- * @param {Function} keysFunc The function to get the keys of `object`.
3211
- * @returns {Object} Returns `object`.
3212
- */
3213
- var baseFor = createBaseFor();
3214
-
3215
- const baseFor$1 = baseFor;
3454
+ /** Used as references for the maximum length and index of an array. */
3455
+ var MAX_ARRAY_LENGTH = 4294967295,
3456
+ HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
3216
3457
 
3217
3458
  /**
3218
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
3459
+ * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
3460
+ * performs a binary search of `array` to determine the index at which `value`
3461
+ * should be inserted into `array` in order to maintain its sort order.
3219
3462
  *
3220
3463
  * @private
3221
- * @param {Object} object The object to iterate over.
3222
- * @param {Function} iteratee The function invoked per iteration.
3223
- * @returns {Object} Returns `object`.
3464
+ * @param {Array} array The sorted array to inspect.
3465
+ * @param {*} value The value to evaluate.
3466
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
3467
+ * @returns {number} Returns the index at which `value` should be inserted
3468
+ * into `array`.
3224
3469
  */
3225
- function baseForOwn(object, iteratee) {
3226
- return object && baseFor$1(object, iteratee, keys);
3227
- }
3470
+ function baseSortedIndex(array, value, retHighest) {
3471
+ var low = 0,
3472
+ high = array == null ? low : array.length;
3228
3473
 
3229
- /**
3230
- * Creates a `baseEach` or `baseEachRight` function.
3231
- *
3232
- * @private
3233
- * @param {Function} eachFunc The function to iterate over a collection.
3234
- * @param {boolean} [fromRight] Specify iterating from right to left.
3235
- * @returns {Function} Returns the new base function.
3236
- */
3237
- function createBaseEach(eachFunc, fromRight) {
3238
- return function(collection, iteratee) {
3239
- if (collection == null) {
3240
- return collection;
3241
- }
3242
- if (!isArrayLike(collection)) {
3243
- return eachFunc(collection, iteratee);
3244
- }
3245
- var length = collection.length,
3246
- index = fromRight ? length : -1,
3247
- iterable = Object(collection);
3474
+ if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
3475
+ while (low < high) {
3476
+ var mid = (low + high) >>> 1,
3477
+ computed = array[mid];
3248
3478
 
3249
- while ((fromRight ? index-- : ++index < length)) {
3250
- if (iteratee(iterable[index], index, iterable) === false) {
3251
- break;
3479
+ if (computed !== null && !isSymbol(computed) &&
3480
+ (retHighest ? (computed <= value) : (computed < value))) {
3481
+ low = mid + 1;
3482
+ } else {
3483
+ high = mid;
3252
3484
  }
3253
3485
  }
3254
- return collection;
3255
- };
3256
- }
3257
-
3258
- /**
3259
- * The base implementation of `_.forEach` without support for iteratee shorthands.
3260
- *
3261
- * @private
3262
- * @param {Array|Object} collection The collection to iterate over.
3263
- * @param {Function} iteratee The function invoked per iteration.
3264
- * @returns {Array|Object} Returns `collection`.
3265
- */
3266
- var baseEach = createBaseEach(baseForOwn);
3267
-
3268
- const baseEach$1 = baseEach;
3269
-
3270
- /**
3271
- * The base implementation of `_.reduce` and `_.reduceRight`, without support
3272
- * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
3273
- *
3274
- * @private
3275
- * @param {Array|Object} collection The collection to iterate over.
3276
- * @param {Function} iteratee The function invoked per iteration.
3277
- * @param {*} accumulator The initial value.
3278
- * @param {boolean} initAccum Specify using the first or last element of
3279
- * `collection` as the initial value.
3280
- * @param {Function} eachFunc The function to iterate over `collection`.
3281
- * @returns {*} Returns the accumulated value.
3282
- */
3283
- function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
3284
- eachFunc(collection, function(value, index, collection) {
3285
- accumulator = initAccum
3286
- ? (initAccum = false, value)
3287
- : iteratee(accumulator, value, index, collection);
3288
- });
3289
- return accumulator;
3486
+ return high;
3487
+ }
3488
+ return baseSortedIndexBy(array, value, identity, retHighest);
3290
3489
  }
3291
3490
 
3292
3491
  /**
3293
- * Reduces `collection` to a value which is the accumulated result of running
3294
- * each element in `collection` thru `iteratee`, where each successive
3295
- * invocation is supplied the return value of the previous. If `accumulator`
3296
- * is not given, the first element of `collection` is used as the initial
3297
- * value. The iteratee is invoked with four arguments:
3298
- * (accumulator, value, index|key, collection).
3299
- *
3300
- * Many lodash methods are guarded to work as iteratees for methods like
3301
- * `_.reduce`, `_.reduceRight`, and `_.transform`.
3302
- *
3303
- * The guarded methods are:
3304
- * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
3305
- * and `sortBy`
3492
+ * Uses a binary search to determine the lowest index at which `value`
3493
+ * should be inserted into `array` in order to maintain its sort order.
3306
3494
  *
3307
3495
  * @static
3308
3496
  * @memberOf _
3309
3497
  * @since 0.1.0
3310
- * @category Collection
3311
- * @param {Array|Object} collection The collection to iterate over.
3312
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
3313
- * @param {*} [accumulator] The initial value.
3314
- * @returns {*} Returns the accumulated value.
3315
- * @see _.reduceRight
3498
+ * @category Array
3499
+ * @param {Array} array The sorted array to inspect.
3500
+ * @param {*} value The value to evaluate.
3501
+ * @returns {number} Returns the index at which `value` should be inserted
3502
+ * into `array`.
3316
3503
  * @example
3317
3504
  *
3318
- * _.reduce([1, 2], function(sum, n) {
3319
- * return sum + n;
3320
- * }, 0);
3321
- * // => 3
3322
- *
3323
- * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
3324
- * (result[value] || (result[value] = [])).push(key);
3325
- * return result;
3326
- * }, {});
3327
- * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
3505
+ * _.sortedIndex([30, 50], 40);
3506
+ * // => 1
3328
3507
  */
3329
- function reduce(collection, iteratee, accumulator) {
3330
- var func = isArray$1(collection) ? arrayReduce : baseReduce,
3331
- initAccum = arguments.length < 3;
3332
-
3333
- return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
3508
+ function sortedIndex(array, value) {
3509
+ return baseSortedIndex(array, value);
3334
3510
  }
3335
3511
 
3336
3512
  /**
3337
- * Selection store
3513
+ * Pre-calculation
3514
+ * Dimension custom sizes for each cell
3515
+ * Keeps only changed sizes, skips origin size
3338
3516
  */
3339
- function defaultState() {
3340
- return {
3341
- range: null,
3342
- tempRange: null,
3343
- tempRangeType: null,
3344
- focus: null,
3345
- edit: null,
3346
- lastCell: null,
3347
- nextFocus: null,
3348
- };
3349
- }
3350
- class SelectionStore {
3351
- constructor() {
3352
- this.unsubscribe = [];
3353
- this.store = createStore(defaultState());
3354
- this.store.on('set', (key, newVal) => {
3355
- if (key === 'tempRange' && !newVal) {
3356
- this.store.set('tempRangeType', null);
3357
- }
3358
- });
3359
- }
3360
- onChange(propName, cb) {
3361
- this.unsubscribe.push(this.store.onChange(propName, cb));
3362
- }
3363
- clearFocus() {
3364
- setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
3365
- }
3366
- setFocus(focus, end) {
3367
- if (!end) {
3368
- setStore(this.store, { focus });
3369
- }
3370
- else {
3371
- setStore(this.store, {
3372
- focus,
3373
- range: getRange(focus, end),
3374
- edit: null,
3375
- tempRange: null,
3376
- });
3377
- }
3378
- }
3379
- setNextFocus(focus) {
3380
- setStore(this.store, { nextFocus: focus });
3381
- }
3382
- setTempArea(range) {
3383
- setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
3384
- }
3385
- clearTemp() {
3386
- setStore(this.store, { tempRange: null });
3387
- }
3388
- /** Can be applied from selection change or from simple keyboard change clicks */
3389
- setRangeArea(range) {
3390
- setStore(this.store, { range, edit: null, tempRange: null });
3391
- }
3392
- setRange(start, end) {
3393
- const range = getRange(start, end);
3394
- this.setRangeArea(range);
3395
- }
3396
- setLastCell(lastCell) {
3397
- setStore(this.store, { lastCell });
3398
- }
3399
- setEdit(val) {
3400
- const focus = this.store.get('focus');
3401
- if (focus && typeof val === 'string') {
3402
- setStore(this.store, {
3403
- edit: { x: focus.x, y: focus.y, val },
3404
- });
3405
- return;
3406
- }
3407
- setStore(this.store, { edit: null });
3408
- }
3409
- dispose() {
3410
- this.unsubscribe.forEach(f => f());
3411
- this.store.dispose();
3412
- }
3413
- }
3414
-
3415
- const EMPTY_INDEX = -1;
3416
- class SelectionStoreConnector {
3417
- constructor() {
3418
- // dirty flag required to cleanup whole store in case visibility of panels changed
3419
- this.dirty = false;
3420
- this.stores = {};
3421
- this.columnStores = {};
3422
- this.rowStores = {};
3423
- /**
3424
- * Helpers for data conversion
3425
- */
3426
- this.storesByType = {};
3427
- this.storesXToType = {};
3428
- this.storesYToType = {};
3429
- this.sections = [];
3430
- }
3431
- get focusedStore() {
3432
- var _a;
3433
- for (let y in this.stores) {
3434
- for (let x in this.stores[y]) {
3435
- const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
3436
- if (focused) {
3437
- return {
3438
- entity: this.stores[y][x],
3439
- cell: focused,
3440
- position: {
3441
- x: parseInt(x, 10),
3442
- y: parseInt(y, 10),
3443
- },
3444
- };
3445
- }
3446
- }
3447
- }
3448
- return null;
3449
- }
3450
- get edit() {
3451
- var _a;
3452
- return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
3453
- }
3454
- get focused() {
3455
- var _a;
3456
- return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
3457
- }
3458
- get selectedRange() {
3459
- var _a;
3460
- return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
3461
- }
3462
- registerSection(e) {
3463
- if (!e) {
3464
- this.sections.length = 0;
3465
- // some elements removed, rebuild stores
3466
- this.dirty = true;
3467
- return;
3468
- }
3469
- if (this.sections.indexOf(e) === -1) {
3470
- this.sections.push(e);
3471
- }
3472
- }
3473
- // check if require to cleanup all stores
3474
- beforeUpdate() {
3475
- if (this.dirty) {
3476
- for (let y in this.stores) {
3477
- for (let x in this.stores[y]) {
3478
- this.stores[y][x].dispose();
3479
- }
3480
- }
3481
- this.dirty = false;
3482
- }
3483
- }
3484
- registerColumn(x, type) {
3485
- // if hidden just create store but no operations needed
3486
- if (isHiddenStore(x)) {
3487
- return new SelectionStore();
3488
- }
3489
- if (this.columnStores[x]) {
3490
- return this.columnStores[x];
3491
- }
3492
- this.columnStores[x] = new SelectionStore();
3493
- // build cross-linking type to position
3494
- this.storesByType[type] = x;
3495
- this.storesXToType[x] = type;
3496
- return this.columnStores[x];
3497
- }
3498
- registerRow(y, type) {
3499
- // if hidden just create store
3500
- if (isHiddenStore(y)) {
3501
- return new SelectionStore();
3502
- }
3503
- if (this.rowStores[y]) {
3504
- return this.rowStores[y];
3505
- }
3506
- this.rowStores[y] = new SelectionStore();
3507
- // build cross linking type to position
3508
- this.storesByType[type] = y;
3509
- this.storesYToType[y] = type;
3510
- return this.rowStores[y];
3511
- }
3512
- /**
3513
- * Cross store proxy, based on multiple dimensions
3514
- */
3515
- register({ x, y }) {
3516
- var _a, _b;
3517
- // if hidden just create store
3518
- if (isHiddenStore(x) || isHiddenStore(y)) {
3519
- return new SelectionStore();
3520
- }
3521
- if (!this.stores[y]) {
3522
- this.stores[y] = {};
3523
- }
3524
- if (this.stores[y][x]) {
3525
- // Store already registered. Do not register twice
3526
- return this.stores[y][x];
3527
- }
3528
- this.stores[y][x] = new SelectionStore();
3529
- // proxy update, column store trigger only range area
3530
- (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
3531
- this.columnStores[x].setRangeArea(c);
3532
- this.rowStores[y].setRangeArea(c);
3533
- });
3534
- // clean up on remove
3535
- (_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
3536
- return this.stores[y][x];
3537
- }
3538
- destroy(x, y) {
3539
- var _a, _b;
3540
- (_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
3541
- (_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
3542
- delete this.rowStores[y];
3543
- delete this.columnStores[x];
3544
- // clear x cross-link
3545
- if (this.storesXToType[x]) {
3546
- const type = this.storesXToType[x];
3547
- delete this.storesXToType[x];
3548
- delete this.storesByType[type];
3549
- }
3550
- // clear y cross-link
3551
- if (this.storesYToType[y]) {
3552
- const type = this.storesYToType[y];
3553
- delete this.storesYToType[y];
3554
- delete this.storesByType[type];
3555
- }
3556
- if (this.stores[y]) {
3557
- delete this.stores[y][x];
3558
- }
3559
- // clear empty rows
3560
- if (!Object.keys(this.stores[y] || {}).length) {
3561
- delete this.stores[y];
3562
- }
3563
- }
3564
- setEditByCell(storePos, editCell) {
3565
- this.focusByCell(storePos, editCell, editCell);
3566
- this.setEdit('');
3567
- }
3568
- /**
3569
- * Sets the next focus cell before the current one.
3570
- *
3571
- * @param focus - The cell to set as the next focus.
3572
- */
3573
- beforeNextFocusCell(focus) {
3574
- var _a;
3575
- // If there is no focused store, return early.
3576
- if (!this.focusedStore) {
3577
- return;
3578
- }
3579
- // Get the next store based on the current focus and the last cell.
3580
- const lastCell = this.focusedStore.entity.store.get('lastCell');
3581
- const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
3582
- // Set the next focus cell in the store.
3583
- (_a = next === null || next === void 0 ? void 0 : next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
3584
- }
3585
- focusByCell(storePos, start, end) {
3586
- const store = this.stores[storePos.y][storePos.x];
3587
- this.focus(store, { focus: start, end });
3588
- }
3589
- focus(store, { focus, end }) {
3590
- const currentStorePointer = this.getCurrentStorePointer(store);
3591
- if (!currentStorePointer) {
3592
- return null;
3593
- }
3594
- // check for the focus in nearby store/viewport
3595
- const lastCell = store.store.get('lastCell');
3596
- const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
3597
- // if next store present - update
3598
- if (next === null || next === void 0 ? void 0 : next.store) {
3599
- const item = Object.assign(Object.assign({}, focus), next.item);
3600
- this.focus(next.store, { focus: item, end: item });
3601
- return null;
3602
- }
3603
- if (lastCell) {
3604
- focus = cropCellToMax(focus, lastCell);
3605
- end = cropCellToMax(end, lastCell);
3606
- }
3607
- store.setFocus(focus, end);
3608
- return focus;
3609
- }
3610
- /**
3611
- * Retrieves the current store pointer based on the active store.
3612
- * Clears focus from all stores except the active one.
3613
- */
3614
- getCurrentStorePointer(store) {
3615
- let currentStorePointer;
3616
- // Iterate through all stores
3617
- for (let y in this.stores) {
3618
- for (let x in this.stores[y]) {
3619
- const s = this.stores[y][x];
3620
- // Clear focus from stores other than the active one
3621
- if (s !== store) {
3622
- s.clearFocus();
3623
- }
3624
- else {
3625
- // Update the current store pointer with the active store coordinates
3626
- currentStorePointer = {
3627
- x: parseInt(x, 10),
3628
- y: parseInt(y, 10)
3629
- };
3630
- }
3631
- }
3632
- }
3633
- return currentStorePointer;
3634
- }
3635
- /**
3636
- * Retrieves the next store based on the focus cell and current store pointer.
3637
- * If the next store exists, returns an object with the next store and the item in the new store.
3638
- * If the next store does not exist, returns null.
3639
- */
3640
- getNextStore(focus, currentStorePointer, lastCell) {
3641
- // item in new store
3642
- const nextItem = nextCell(focus, lastCell);
3643
- let nextStore;
3644
- if (nextItem) {
3645
- Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
3646
- let stores;
3647
- switch (type) {
3648
- case 'x':
3649
- // Get the X stores for the current Y coordinate of the current store pointer
3650
- stores = this.getXStores(currentStorePointer.y);
3651
- break;
3652
- case 'y':
3653
- // Get the Y stores for the current X coordinate of the current store pointer
3654
- stores = this.getYStores(currentStorePointer.x);
3655
- break;
3656
- }
3657
- // Get the next store based on the item in the new store
3658
- if (nextItemCoord >= 0) {
3659
- nextStore = stores[++currentStorePointer[type]];
3660
- }
3661
- else {
3662
- nextStore = stores[--currentStorePointer[type]];
3663
- const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
3664
- if (nextLastCell) {
3665
- nextItem[type] = nextLastCell[type] + nextItemCoord;
3666
- }
3667
- }
3668
- });
3669
- }
3670
- return {
3671
- store: nextStore,
3672
- item: nextItem,
3517
+ function calculateDimensionData(originItemSize, newSizes = {}) {
3518
+ const positionIndexes = [];
3519
+ const positionIndexToItem = {};
3520
+ const indexToItem = {};
3521
+ // prepare order sorted new sizes and calculate changed real size
3522
+ const newIndexes = Object.keys(newSizes).map(Number).sort((a, b) => a - b);
3523
+ let previous;
3524
+ for (let i = 0; i < newIndexes.length; i++) {
3525
+ const itemIndex = newIndexes[i];
3526
+ const newItem = {
3527
+ itemIndex,
3528
+ start: 0,
3529
+ end: 0,
3673
3530
  };
3674
- }
3675
- clearAll() {
3676
- var _a;
3677
- for (let y in this.stores) {
3678
- for (let x in this.stores[y]) {
3679
- (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
3680
- }
3681
- }
3682
- }
3683
- setEdit(val) {
3684
- if (!this.focusedStore) {
3685
- return;
3686
- }
3687
- this.focusedStore.entity.setEdit(val);
3688
- }
3689
- /**
3690
- * Select all cells across all stores
3691
- */
3692
- selectAll() {
3693
- for (let y in this.stores) {
3694
- for (let x in this.stores[y]) {
3695
- const store = this.stores[y][x];
3696
- if (!store) {
3697
- continue;
3698
- }
3699
- const lastCell = store.store.get('lastCell');
3700
- if (lastCell) {
3701
- store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
3702
- }
3703
- }
3704
- }
3705
- }
3706
- getXStores(y) {
3707
- return this.stores[y];
3708
- }
3709
- getYStores(x) {
3710
- const stores = {};
3711
- for (let i in this.stores) {
3712
- stores[i] = this.stores[i][x];
3713
- }
3714
- return stores;
3715
- }
3716
- }
3717
-
3718
- function isHiddenStore(pos) {
3719
- return pos === EMPTY_INDEX;
3720
- }
3721
- function nextCell(cell, lastCell) {
3722
- const nextItem = {};
3723
- let types = ['x', 'y'];
3724
- // previous item check
3725
- for (let t of types) {
3726
- if (cell[t] < 0) {
3727
- nextItem[t] = cell[t];
3728
- return nextItem;
3729
- }
3730
- }
3731
- // next item check
3732
- for (let t of types) {
3733
- if (cell[t] >= lastCell[t]) {
3734
- nextItem[t] = cell[t] - lastCell[t];
3735
- return nextItem;
3736
- }
3737
- }
3738
- return null;
3739
- }
3740
- function cropCellToMax(cell, lastCell) {
3741
- const croppedCell = Object.assign({}, cell);
3742
- const cellCoordinates = ['x', 'y'];
3743
- for (const coordinate of cellCoordinates) {
3744
- if (cell[coordinate] < 0) {
3745
- croppedCell[coordinate] = 0;
3746
- }
3747
- else if (cell[coordinate] >= lastCell[coordinate]) {
3748
- croppedCell[coordinate] = lastCell[coordinate] - 1;
3749
- }
3750
- }
3751
- return croppedCell;
3752
- }
3753
- function getRange(start, end) {
3754
- return start && end
3755
- ? {
3756
- x: Math.min(start.x, end.x),
3757
- y: Math.min(start.y, end.y),
3758
- x1: Math.max(start.x, end.x),
3759
- y1: Math.max(start.y, end.y),
3760
- }
3761
- : null;
3762
- }
3763
- function isRangeSingleCell(a) {
3764
- return a.x === a.x1 && a.y === a.y1;
3765
- }
3766
-
3767
- function getCellData(val) {
3768
- if (typeof val === 'undefined' || val === null) {
3769
- return '';
3770
- }
3771
- return val;
3772
- }
3773
- function getCellDataParsed(model, column) {
3774
- const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
3775
- return getCellData(val);
3776
- }
3777
- /**
3778
- * Get column type from column data
3779
- */
3780
- function getColumnType(rgCol) {
3781
- if (rgCol.pin) {
3782
- return rgCol.pin;
3783
- }
3784
- return 'rgCol';
3785
- }
3786
- function getColumnSizes(cols) {
3787
- const res = {};
3788
- for (const [i, c] of cols.entries()) {
3789
- if (c.size) {
3790
- res[i] = c.size;
3791
- }
3792
- }
3793
- return res;
3794
- }
3795
- /**
3796
- * Check if column is grouping column
3797
- */
3798
- function isColGrouping(colData) {
3799
- return !!colData.children;
3800
- }
3801
- /**
3802
- * This function is used to create a collection of columns.
3803
- */
3804
- function getColumns(columns, level = 0, types) {
3805
- const collection = {
3806
- // columns as they are in stores per type
3807
- columns: {
3808
- rgCol: [],
3809
- colPinStart: [],
3810
- colPinEnd: [],
3811
- },
3812
- // columns indexed by prop for quick access
3813
- columnByProp: {},
3814
- // column grouping
3815
- columnGrouping: {
3816
- rgCol: [],
3817
- colPinStart: [],
3818
- colPinEnd: [],
3819
- },
3820
- // max depth level for column grouping
3821
- maxLevel: level,
3822
- // sorting
3823
- sort: {},
3824
- };
3825
- return reduce(columns, (res, colData) => {
3826
- // Grouped column
3827
- if (isColGrouping(colData)) {
3828
- return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
3829
- }
3830
- // Column type
3831
- const columnDefinitionFromType = colData.columnType && (types === null || types === void 0 ? void 0 : types[colData.columnType]);
3832
- // Regular column
3833
- const regularColumn = Object.assign(Object.assign({}, columnDefinitionFromType), colData);
3834
- // Regular column, no Pin
3835
- if (!regularColumn.pin) {
3836
- res.columns.rgCol.push(regularColumn);
3837
- // Pin
3531
+ // if previous item was changed too
3532
+ if (previous) {
3533
+ const itemsBetween = (itemIndex - previous.itemIndex - 1) * originItemSize;
3534
+ newItem.start = itemsBetween + previous.end;
3838
3535
  }
3839
3536
  else {
3840
- res.columns[regularColumn.pin].push(regularColumn);
3841
- }
3842
- if (regularColumn.order) {
3843
- res.sort[regularColumn.prop] = regularColumn;
3844
- }
3845
- // it's possible that some columns have same prop, but better to avoid it
3846
- if (!res.columnByProp[regularColumn.prop]) {
3847
- res.columnByProp[regularColumn.prop] = [];
3848
- }
3849
- res.columnByProp[regularColumn.prop].push(regularColumn);
3850
- // trigger setup hook if present
3851
- regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
3852
- return res;
3853
- }, collection);
3854
- }
3855
- function gatherGroup(res, colData, collection, level = 0) {
3856
- // group template
3857
- const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
3858
- // check columns for update
3859
- for (let k in collection.columns) {
3860
- const key = k;
3861
- const resultItem = res.columns[key];
3862
- const collectionItem = collection.columns[key];
3863
- // if column data
3864
- if (isArray$1(resultItem) && isArray$1(collectionItem)) {
3865
- // fill columns
3866
- resultItem.push(...collectionItem);
3867
- // fill grouping
3868
- if (collectionItem.length) {
3869
- res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
3870
- }
3537
+ newItem.start = itemIndex * originItemSize;
3871
3538
  }
3539
+ newItem.end = newItem.start + newSizes[itemIndex];
3540
+ positionIndexes.push(newItem.start);
3541
+ indexToItem[itemIndex] = positionIndexToItem[i] = newItem;
3542
+ previous = newItem;
3872
3543
  }
3873
- // merge column groupings
3874
- for (let k in collection.columnGrouping) {
3875
- const key = k;
3876
- const collectionItem = collection.columnGrouping[key];
3877
- res.columnGrouping[key].push(...collectionItem);
3878
- }
3879
- res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
3880
- res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
3881
- return res;
3882
- }
3883
- function findColumn(columns, prop) {
3884
- for (const c of columns) {
3885
- if (isColGrouping(c)) {
3886
- const found = findColumn(c.children, prop);
3887
- if (found) {
3888
- return found;
3889
- }
3890
- }
3891
- else if (c.prop === prop) {
3892
- return c;
3893
- }
3894
- }
3895
- return undefined;
3896
- }
3897
- function getColumnByProp(columns, prop) {
3898
- return findColumn(columns, prop);
3899
- }
3900
-
3901
- const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
3902
- const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
3903
- const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
3904
- const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
3905
- const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
3906
- const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
3907
- const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
3908
- const GROUP_EXPAND_BTN = `group-expand`;
3909
- const GROUP_EXPAND_EVENT = `groupexpandclick`;
3910
- const GROUPING_ROW_TYPE = 'rgRow';
3911
-
3912
- function getGroupValueDefault(item, prop) {
3913
- return item[prop] || null;
3914
- }
3915
- /**
3916
- * Gather data for grouping
3917
- * @param array - flat data array
3918
- * @param groupIds - ids of groups
3919
- * @param expanded - potentially expanded items if present
3920
- */
3921
- function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
3922
- const groupedItems = new Map();
3923
- array.forEach((item, originalIndex) => {
3924
- const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
3925
- const lastLevelValue = groupLevelValues.pop();
3926
- let currentGroupLevel = groupedItems;
3927
- groupLevelValues.forEach(value => {
3928
- if (!currentGroupLevel.has(value)) {
3929
- currentGroupLevel.set(value, new Map());
3930
- }
3931
- currentGroupLevel = currentGroupLevel.get(value);
3932
- });
3933
- if (!currentGroupLevel.has(lastLevelValue)) {
3934
- currentGroupLevel.set(lastLevelValue, []);
3935
- }
3936
- const lastLevelItems = currentGroupLevel.get(lastLevelValue);
3937
- lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
3938
- });
3939
- let itemIndex = -1;
3940
- const groupingDepth = groupIds.length;
3941
- // collapse all groups in the beginning
3942
- const trimmed = {};
3943
- // index mapping
3944
- const oldNewIndexMap = {};
3945
- // check if group header exists
3946
- const pseudoGroupTest = {};
3947
- const sourceWithGroups = [];
3948
- function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
3949
- const depth = parentIds.length;
3950
- groupedValues.forEach((innerGroupedValues, groupId) => {
3951
- const levelIds = [...parentIds, groupId];
3952
- const mergedIds = levelIds.join(',');
3953
- const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
3954
- sourceWithGroups.push({
3955
- [PSEUDO_GROUP_ITEM]: groupId,
3956
- [GROUP_DEPTH]: depth,
3957
- [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
3958
- [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
3959
- [GROUP_EXPANDED]: isGroupExpanded,
3960
- });
3961
- itemIndex += 1;
3962
- if (!isGroupExpanded && depth) {
3963
- trimmed[itemIndex] = true;
3964
- }
3965
- if (Array.isArray(innerGroupedValues)) {
3966
- innerGroupedValues.forEach(value => {
3967
- itemIndex += 1;
3968
- if (!isGroupExpanded) {
3969
- trimmed[itemIndex] = true;
3970
- }
3971
- oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
3972
- const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
3973
- pseudoGroupTestIds.forEach(pseudoGroupTestId => {
3974
- if (!pseudoGroupTest[pseudoGroupTestId]) {
3975
- pseudoGroupTest[pseudoGroupTestId] = [];
3976
- }
3977
- pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
3978
- });
3979
- });
3980
- sourceWithGroups.push(...innerGroupedValues);
3981
- }
3982
- else {
3983
- flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
3984
- }
3985
- });
3986
- }
3987
- flattenGroupMaps(groupedItems, [], true);
3988
3544
  return {
3989
- sourceWithGroups, // updates source mirror
3990
- depth: groupingDepth, // largest depth for grouping
3991
- trimmed, // used for expand/collapse grouping values
3992
- oldNewIndexMap, // used for mapping old values to new
3993
- childrenByGroup: pseudoGroupTest, // used to get child items in group
3545
+ indexes: newIndexes,
3546
+ positionIndexes: [...positionIndexes],
3547
+ positionIndexToItem: Object.assign({}, positionIndexToItem),
3548
+ indexToItem,
3994
3549
  };
3995
3550
  }
3996
- function getGroupingName(rgRow) {
3997
- return rgRow && rgRow[PSEUDO_GROUP_ITEM];
3998
- }
3999
- function isGrouping(rgRow) {
4000
- return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
4001
- }
4002
- function isGroupingColumn(column) {
4003
- return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
4004
- }
4005
- function measureEqualDepth(groupA, groupB) {
4006
- const ln = groupA.length;
4007
- let i = 0;
4008
- for (; i < ln; i++) {
4009
- if (groupA[i] !== groupB[i]) {
4010
- return i;
4011
- }
4012
- }
4013
- return i;
4014
- }
4015
- function getParsedGroup(id) {
4016
- const parseGroup = JSON.parse(id);
4017
- // extra precaution and type safeguard
4018
- if (!Array.isArray(parseGroup)) {
4019
- return null;
4020
- }
4021
- return parseGroup;
4022
- }
4023
- // check if items is child of current clicked group
4024
- function isSameGroup(currentGroup, currentModel, nextModel) {
4025
- const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
4026
- if (!nextGroup) {
4027
- return false;
4028
- }
4029
- const depth = measureEqualDepth(currentGroup, nextGroup);
4030
- return currentModel[GROUP_DEPTH] < depth;
4031
- }
4032
-
4033
- /**
4034
- * The base implementation of `_.slice` without an iteratee call guard.
4035
- *
4036
- * @private
4037
- * @param {Array} array The array to slice.
4038
- * @param {number} [start=0] The start position.
4039
- * @param {number} [end=array.length] The end position.
4040
- * @returns {Array} Returns the slice of `array`.
4041
- */
4042
- function baseSlice(array, start, end) {
4043
- var index = -1,
4044
- length = array.length;
4045
-
4046
- if (start < 0) {
4047
- start = -start > length ? 0 : (length + start);
4048
- }
4049
- end = end > length ? length : end;
4050
- if (end < 0) {
4051
- end += length;
4052
- }
4053
- length = start > end ? 0 : ((end - start) >>> 0);
4054
- start >>>= 0;
4055
-
4056
- var result = Array(length);
4057
- while (++index < length) {
4058
- result[index] = array[index + start];
4059
- }
4060
- return result;
4061
- }
4062
-
4063
- /**
4064
- * Creates a slice of `array` from `start` up to, but not including, `end`.
4065
- *
4066
- * **Note:** This method is used instead of
4067
- * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
4068
- * returned.
4069
- *
4070
- * @static
4071
- * @memberOf _
4072
- * @since 3.0.0
4073
- * @category Array
4074
- * @param {Array} array The array to slice.
4075
- * @param {number} [start=0] The start position.
4076
- * @param {number} [end=array.length] The end position.
4077
- * @returns {Array} Returns the slice of `array`.
4078
- */
4079
- function slice(array, start, end) {
4080
- var length = array == null ? 0 : array.length;
4081
- if (!length) {
4082
- return [];
4083
- }
4084
- if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
4085
- start = 0;
4086
- end = length;
4087
- }
4088
- else {
4089
- start = start == null ? 0 : toInteger(start);
4090
- end = end === undefined ? length : toInteger(end);
4091
- }
4092
- return baseSlice(array, start, end);
4093
- }
4094
-
4095
- class ColumnService {
4096
- get columns() {
4097
- return getVisibleSourceItem(this.source);
4098
- }
4099
- constructor(dataStore, source) {
4100
- this.dataStore = dataStore;
4101
- this.source = source;
4102
- this.unsubscribe = [];
4103
- this.hasGrouping = false;
4104
- this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
4105
- this.checkGrouping(source.get('source'));
4106
- this.type = source.get('type');
4107
- }
4108
- checkGrouping(cols) {
4109
- for (let rgCol of cols) {
4110
- if (isGroupingColumn(rgCol)) {
4111
- this.hasGrouping = true;
4112
- return;
4113
- }
4114
- this.hasGrouping = false;
4115
- }
4116
- }
4117
- isReadOnly(r, c) {
4118
- var _a;
4119
- const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
4120
- if (typeof readOnly === 'function') {
4121
- const data = this.rowDataModel(r, c);
4122
- return readOnly(data);
4123
- }
4124
- return !!readOnly;
4125
- }
4126
- mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
4127
- const props = Object.assign({}, defaultProps);
4128
- props.class = Object.assign(Object.assign({}, (typeof props.class === 'string'
4129
- ? { [props.class]: true }
4130
- : props.class)), { [CELL_CLASS]: true, [DISABLED_CLASS]: this.isReadOnly(r, c) });
4131
- const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
4132
- if (!extra) {
4133
- return props;
4134
- }
4135
- return doPropMerge(props, extra);
4136
- }
4137
- getRowClass(r, prop) {
4138
- const model = getSourceItem(this.dataStore, r) || {};
4139
- return model[prop] || '';
4140
- }
4141
- getCellData(r, c) {
4142
- const data = this.rowDataModel(r, c);
4143
- return getCellData(data.model[data.prop]);
4144
- }
4145
- getSaveData(rowIndex, colIndex, val) {
4146
- const data = this.rowDataModel(rowIndex, colIndex);
4147
- if (typeof val === 'undefined') {
4148
- val = getCellData(data.model[data.prop]);
4149
- }
4150
- return {
4151
- prop: data.prop,
4152
- rowIndex,
4153
- colIndex,
4154
- val,
4155
- model: data.model,
4156
- colType: this.type,
4157
- type: this.dataStore.get('type'),
4158
- };
4159
- }
4160
- getCellEditor(_r, c, editors) {
4161
- var _a;
4162
- const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
4163
- if (!editor) {
4164
- return undefined;
4165
- }
4166
- // reference
4167
- if (typeof editor === 'string') {
4168
- return editors[editor];
4169
- }
4170
- return editor;
4171
- }
4172
- /**
4173
- * Get cell data model for given rowIndex and colIndex
4174
- * Used to pass data to editor/renderer
4175
- */
4176
- rowDataModel(rowIndex, colIndex) {
4177
- const column = this.columns[colIndex];
4178
- const prop = column === null || column === void 0 ? void 0 : column.prop;
4179
- const model = getSourceItem(this.dataStore, rowIndex) || {};
4180
- const value = model[prop];
4181
- const type = this.dataStore.get('type');
4182
- return {
4183
- prop,
4184
- model,
4185
- data: this.dataStore.get('source'),
4186
- column,
4187
- rowIndex,
4188
- colIndex,
4189
- colType: this.type,
4190
- type,
4191
- value,
4192
- };
4193
- }
4194
- getRangeData(d, columns) {
4195
- var _a;
4196
- const changed = {};
4197
- // get original length sizes
4198
- const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
4199
- const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
4200
- const mapping = {};
4201
- // rows
4202
- for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
4203
- // copy original data link
4204
- const oldRowIndex = d.oldRange.y + (i % copyRowLength);
4205
- const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
4206
- // columns
4207
- for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
4208
- // check if old range area
4209
- if (rowIndex >= d.oldRange.y &&
4210
- rowIndex <= d.oldRange.y1 &&
4211
- colIndex >= d.oldRange.x &&
4212
- colIndex <= d.oldRange.x1) {
4213
- continue;
4214
- }
4215
- // requested column beyond range
4216
- if (!this.columns[colIndex]) {
4217
- continue;
4218
- }
4219
- const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
4220
- const copyColIndex = d.oldRange.x + (j % copyColLength);
4221
- const copyColumnProp = columns[copyColIndex].prop;
4222
- /** if can write */
4223
- if (!this.isReadOnly(rowIndex, colIndex)) {
4224
- /** to show before save */
4225
- if (!changed[rowIndex]) {
4226
- changed[rowIndex] = {};
4227
- }
4228
- changed[rowIndex][prop] = copyRow[copyColumnProp];
4229
- /** Generate mapping object */
4230
- if (!mapping[rowIndex]) {
4231
- mapping[rowIndex] = {};
4232
- }
4233
- mapping[rowIndex][prop] = {
4234
- colIndex: copyColIndex,
4235
- colProp: copyColumnProp,
4236
- rowIndex: oldRowIndex,
4237
- };
4238
- }
4239
- }
4240
- }
4241
- return {
4242
- changed,
4243
- mapping,
4244
- };
4245
- }
4246
- getTransformedDataToApply(start, data) {
4247
- const changed = {};
4248
- const copyRowLength = data.length;
4249
- const colLength = this.columns.length;
4250
- const rowLength = this.dataStore.get('items').length;
4251
- // rows
4252
- let rowIndex = start.y;
4253
- let maxCol = 0;
4254
- for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
4255
- // copy original data link
4256
- const copyRow = data[i % copyRowLength];
4257
- const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
4258
- // columns
4259
- let colIndex = start.x;
4260
- for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
4261
- const p = this.columns[colIndex].prop;
4262
- const currentCol = j % colLength;
4263
- /** if can write */
4264
- if (!this.isReadOnly(rowIndex, colIndex)) {
4265
- /** to show before save */
4266
- if (!changed[rowIndex]) {
4267
- changed[rowIndex] = {};
4268
- }
4269
- changed[rowIndex][p] = copyRow[currentCol];
4270
- }
4271
- }
4272
- maxCol = Math.max(maxCol, colIndex - 1);
4273
- }
4274
- const range = getRange(start, {
4275
- y: rowIndex - 1,
4276
- x: maxCol,
4277
- });
4278
- return {
4279
- changed,
4280
- range,
4281
- };
4282
- }
4283
- getRangeStaticData(d, value) {
4284
- const changed = {};
4285
- // rows
4286
- for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
4287
- // columns
4288
- for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
4289
- // requested column beyond range
4290
- if (!this.columns[colIndex]) {
4291
- continue;
4292
- }
4293
- const p = this.columns[colIndex].prop;
4294
- /** if can write */
4295
- if (!this.isReadOnly(rowIndex, colIndex)) {
4296
- /** to show before save */
4297
- if (!changed[rowIndex]) {
4298
- changed[rowIndex] = {};
4299
- }
4300
- changed[rowIndex][p] = value;
4301
- }
4302
- }
4303
- }
4304
- return changed;
4305
- }
4306
- getRangeTransformedToProps(d, store) {
4307
- var _a;
4308
- const area = [];
4309
- const type = this.dataStore.get('type');
4310
- // rows
4311
- for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
4312
- // columns
4313
- for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
4314
- const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
4315
- area.push({
4316
- prop,
4317
- rowIndex,
4318
- colIndex,
4319
- model: getSourceItem(store, rowIndex),
4320
- type,
4321
- colType: this.type,
4322
- });
4323
- }
4324
- }
4325
- return area;
4326
- }
4327
- copyRangeArray(range, store) {
4328
- const cols = [...this.columns];
4329
- const props = slice(cols, range.x, range.x1 + 1).map(v => v.prop);
4330
- const toCopy = [];
4331
- const mapping = {};
4332
- // rows indexes
4333
- for (let i = range.y; i <= range.y1; i++) {
4334
- const rgRow = [];
4335
- mapping[i] = {};
4336
- // columns indexes
4337
- for (let prop of props) {
4338
- const item = getSourceItem(store, i);
4339
- // if no item - skip
4340
- if (!item) {
4341
- continue;
4342
- }
4343
- const val = item[prop];
4344
- rgRow.push(val);
4345
- mapping[i][prop] = val;
4346
- }
4347
- toCopy.push(rgRow);
4348
- }
4349
- return {
4350
- data: toCopy,
4351
- mapping,
4352
- };
4353
- }
4354
- destroy() {
4355
- this.unsubscribe.forEach(f => f());
4356
- }
4357
- }
4358
3551
  /**
4359
- * Checks if the given rowDrag is a service for dragging rows.
3552
+ * Calculate item by position
4360
3553
  */
4361
- function isRowDragService(rowDrag, model) {
4362
- if (typeof rowDrag === 'function') {
4363
- return rowDrag(model);
4364
- }
4365
- return !!rowDrag;
4366
- }
4367
- function mergeClasses(class1 = {}, class2 = {}) {
4368
- if (typeof class1 === 'string') {
4369
- class1 = { [class1]: true };
4370
- }
4371
- if (typeof class2 === 'string') {
4372
- class2 = { [class2]: true };
4373
- }
4374
- return Object.assign(Object.assign({}, class1), class2);
4375
- }
4376
- function doPropMerge(existing, extra) {
4377
- // if className is provided - remove it from props it messing with stencil
4378
- if (extra.className) {
4379
- extra.class = mergeClasses(extra.class, extra.className);
4380
- delete extra.className;
4381
- }
4382
- let props = Object.assign(Object.assign({}, extra), existing);
4383
- // extend existing props
4384
- if (extra.class) {
4385
- props.class = mergeClasses(props.class, extra.class);
4386
- }
4387
- if (extra.style) {
4388
- props.style = Object.assign(Object.assign({}, extra.style), props.style);
4389
- }
4390
- return props;
4391
- }
4392
-
4393
- export { ColumnService as $, reduce as A, isArray$1 as B, baseEach$1 as C, DataStore as D, toInteger as E, isIterateeCall as F, isGrouping as G, getGroupingName as H, doPropMerge as I, GROUP_EXPANDED as J, getParsedGroup as K, isSameGroup as L, GROUP_DEPTH as M, PSEUDO_GROUP_ITEM_ID as N, GROUPING_ROW_TYPE as O, PSEUDO_GROUP_ITEM_VALUE as P, PSEUDO_GROUP_COLUMN as Q, GROUP_EXPAND_EVENT as R, SelectionStore as S, gatherGrouping as T, isGroupingColumn as U, baseProperty as V, isArrayLike as W, getTag$1 as X, baseKeys as Y, EMPTY_INDEX as Z, SelectionStoreConnector as _, getVisibleSourceItem as a, findIndex as a0, GROUP_EXPAND_BTN as a1, PSEUDO_GROUP_ITEM as a2, isRowDragService as a3, getNative as a4, baseIteratee as a5, getSourceItem as b, getSourcePhysicalIndex as c, setSourceByPhysicalIndex as d, setItems as e, getSourceItemVirtualIndexByProp as f, getPhysical as g, gatherTrimmedItems as h, isHiddenStore as i, cropCellToMax as j, getRange as k, isRangeSingleCell as l, setStore as m, nextCell as n, getCellData as o, proxyPlugin as p, getCellDataParsed as q, getColumnType as r, setSourceByVirtualIndex as s, trimmedPlugin as t, getColumnSizes as u, isColGrouping as v, getColumns as w, gatherGroup as x, getColumnByProp as y, createStore as z };
4394
-
4395
- //# sourceMappingURL=column.service-751345b2.js.map
3554
+ const getItemByPosition = ({ indexes, positionIndexes, originItemSize, positionIndexToItem, }, pos) => {
3555
+ const item = {
3556
+ itemIndex: 0,
3557
+ start: 0,
3558
+ end: 0,
3559
+ };
3560
+ const currentPlace = indexes.length ? sortedIndex(positionIndexes, pos) : 0;
3561
+ // not found or first index
3562
+ if (!currentPlace) {
3563
+ item.itemIndex = Math.floor(pos / originItemSize);
3564
+ item.start = item.itemIndex * originItemSize;
3565
+ item.end = item.start + originItemSize;
3566
+ return item;
3567
+ }
3568
+ const positionItem = positionIndexToItem[currentPlace - 1];
3569
+ // if item has specified size
3570
+ if (positionItem.end > pos) {
3571
+ return positionItem;
3572
+ }
3573
+ // special size item was present before
3574
+ const relativePos = pos - positionItem.end;
3575
+ const relativeIndex = Math.floor(relativePos / originItemSize);
3576
+ item.itemIndex = positionItem.itemIndex + 1 + relativeIndex;
3577
+ item.start = positionItem.end + relativeIndex * originItemSize;
3578
+ item.end = item.start + originItemSize;
3579
+ return item;
3580
+ };
3581
+ function getItemByIndex(dimension, index) {
3582
+ let item = {
3583
+ itemIndex: index,
3584
+ start: 0,
3585
+ end: 0,
3586
+ };
3587
+ // if item has specified size
3588
+ if (dimension.indexToItem[index]) {
3589
+ return dimension.indexToItem[index];
3590
+ }
3591
+ const currentPlace = dimension.indexes.length
3592
+ ? sortedIndex(dimension.indexes, index)
3593
+ : 0;
3594
+ // not found or first index
3595
+ if (!currentPlace) {
3596
+ item.start = item.itemIndex * dimension.originItemSize;
3597
+ item.end = item.start + dimension.originItemSize;
3598
+ return item;
3599
+ }
3600
+ // special size item was present before
3601
+ const positionItem = dimension.indexToItem[dimension.indexes[currentPlace - 1]];
3602
+ item.start =
3603
+ positionItem.end +
3604
+ (index - positionItem.itemIndex - 1) * dimension.originItemSize;
3605
+ item.end = item.start + dimension.originItemSize;
3606
+ return item;
3607
+ }
3608
+
3609
+ export { baseProperty as $, ROW_HEADER_TYPE as A, HEADER_SORTABLE_CLASS as B, CELL_CLASS as C, DataStore as D, HEADER_ROW_CLASS as E, HEADER_ACTUAL_ROW_CLASS as F, DRAG_ICON_CLASS as G, HEADER_CLASS as H, DRAGGABLE_CLASS as I, FOCUS_CLASS as J, MOBILE_CLASS as K, CELL_HANDLER_CLASS as L, MIN_COL_SIZE as M, EDIT_INPUT_WR as N, DRAGG_TEXT as O, GRID_INTERNALS as P, ROW_FOCUSED_CLASS as Q, RESIZE_INTERVAL as R, SELECTION_BORDER_CLASS as S, TMP_SELECTION_BG_CLASS as T, codesLetter as U, keyValues as V, createStore as W, identity as X, isArray$1 as Y, toInteger as Z, isIterateeCall as _, getVisibleSourceItem as a, isArrayLike as a0, getTag$1 as a1, baseKeys as a2, keys as a3, baseIteratee as a4, OsPlatform as a5, KeyCodesEnum as a6, findIndex as a7, getNative as a8, getSourceItem as b, getSourcePhysicalIndex as c, setSourceByPhysicalIndex as d, setItems as e, getSourceItemVirtualIndexByProp as f, getPhysical as g, gatherTrimmedItems as h, calculateDimensionData as i, getItemByPosition as j, getItemByIndex as k, findPositionInArray as l, pushSorted as m, mergeSortedArray as n, getScrollbarSize as o, proxyPlugin as p, scaleValue as q, range as r, setSourceByVirtualIndex as s, trimmedPlugin as t, timeout as u, applyMixins as v, setStore as w, DATA_COL as x, DATA_ROW as y, DISABLED_CLASS as z };
3610
+
3611
+ //# sourceMappingURL=dimension.helpers-d0d709c4.js.map