@revolist/revogrid 4.9.41 → 4.10.1

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 (167) hide show
  1. package/dist/cjs/{column.drag.plugin-fcd892ec.js → column.drag.plugin-08ca04f4.js} +129 -58
  2. package/dist/cjs/column.drag.plugin-08ca04f4.js.map +1 -0
  3. package/dist/cjs/column.service-2670e6e7.js +1286 -0
  4. package/dist/cjs/column.service-2670e6e7.js.map +1 -0
  5. package/dist/cjs/{edit.utils-179c0800.js → edit.utils-4a790cf8.js} +2 -2
  6. package/dist/cjs/{edit.utils-179c0800.js.map → edit.utils-4a790cf8.js.map} +1 -1
  7. package/dist/cjs/{header-cell-renderer-d879d95e.js → header-cell-renderer-db089f54.js} +2 -2
  8. package/dist/cjs/{header-cell-renderer-d879d95e.js.map → header-cell-renderer-db089f54.js.map} +1 -1
  9. package/dist/cjs/{column.service-26c61ed6.js → index-91e92bea.js} +455 -1235
  10. package/dist/cjs/index-91e92bea.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +21 -20
  12. package/dist/cjs/index.cjs.js.map +1 -1
  13. package/dist/cjs/{key.utils-f49d7bee.js → key.utils-e65c24e6.js} +2 -2
  14. package/dist/cjs/{key.utils-f49d7bee.js.map → key.utils-e65c24e6.js.map} +1 -1
  15. package/dist/cjs/revo-grid.cjs.entry.js +47 -56
  16. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  17. package/dist/cjs/revogr-attribution_7.cjs.entry.js +11 -11
  18. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  19. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +5 -4
  20. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  21. package/dist/cjs/revogr-data_4.cjs.entry.js +41 -18
  22. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  23. package/dist/cjs/{row-header-utils-c37f76e4.js → row-header-utils-dc3d3185.js} +5 -6
  24. package/dist/cjs/row-header-utils-dc3d3185.js.map +1 -0
  25. package/dist/cjs/{text-editor-b756d6b3.js → text-editor-a32a3993.js} +3 -3
  26. package/dist/cjs/{text-editor-b756d6b3.js.map → text-editor-a32a3993.js.map} +1 -1
  27. package/dist/cjs/{throttle-a57f51f9.js → throttle-da92b75d.js} +2 -2
  28. package/dist/cjs/{throttle-a57f51f9.js.map → throttle-da92b75d.js.map} +1 -1
  29. package/dist/collection/components/data/revogr-data.js +28 -3
  30. package/dist/collection/components/data/revogr-data.js.map +1 -1
  31. package/dist/collection/components/order/revogr-order-editor.js +4 -2
  32. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  33. package/dist/collection/components/revoGrid/revo-grid.js +7 -4
  34. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  35. package/dist/collection/components/scroll/revogr-viewport-scroll.js +26 -8
  36. package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
  37. package/dist/collection/plugins/filter/filter.plugin.js +3 -0
  38. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
  39. package/dist/collection/plugins/sorting/sorting.plugin.js +7 -4
  40. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  41. package/dist/collection/services/dimension.provider.js +7 -22
  42. package/dist/collection/services/dimension.provider.js.map +1 -1
  43. package/dist/collection/store/dataSource/trimmed.plugin.js +3 -8
  44. package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
  45. package/dist/collection/store/dimension/dimension.helpers.js +2 -5
  46. package/dist/collection/store/dimension/dimension.helpers.js.map +1 -1
  47. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
  48. package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
  49. package/dist/collection/store/dimension/dimension.store.js +46 -66
  50. package/dist/collection/store/dimension/dimension.store.js.map +1 -1
  51. package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
  52. package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
  53. package/dist/collection/types/events.js +1 -0
  54. package/dist/collection/types/events.js.map +1 -1
  55. package/dist/collection/types/interfaces.js.map +1 -1
  56. package/dist/esm/{column.drag.plugin-3cc77986.js → column.drag.plugin-b7bba0da.js} +118 -47
  57. package/dist/esm/column.drag.plugin-b7bba0da.js.map +1 -0
  58. package/dist/esm/column.service-9b0603f4.js +1249 -0
  59. package/dist/esm/column.service-9b0603f4.js.map +1 -0
  60. package/dist/esm/{debounce-72878ced.js → debounce-7b511afc.js} +2 -2
  61. package/dist/esm/{debounce-72878ced.js.map → debounce-7b511afc.js.map} +1 -1
  62. package/dist/esm/{edit.utils-6fc686b9.js → edit.utils-abcd0152.js} +2 -2
  63. package/dist/esm/{edit.utils-6fc686b9.js.map → edit.utils-abcd0152.js.map} +1 -1
  64. package/dist/esm/{header-cell-renderer-32d2ed96.js → header-cell-renderer-fce020c3.js} +2 -2
  65. package/dist/esm/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-fce020c3.js.map} +1 -1
  66. package/dist/esm/{column.service-751345b2.js → index-b1e05212.js} +414 -1195
  67. package/dist/esm/index-b1e05212.js.map +1 -0
  68. package/dist/esm/index.js +9 -8
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/{key.utils-17273f42.js → key.utils-ea9aec31.js} +2 -2
  71. package/dist/esm/{key.utils-17273f42.js.map → key.utils-ea9aec31.js.map} +1 -1
  72. package/dist/esm/revo-grid.entry.js +27 -36
  73. package/dist/esm/revo-grid.entry.js.map +1 -1
  74. package/dist/esm/revogr-attribution_7.entry.js +7 -7
  75. package/dist/esm/revogr-clipboard_3.entry.js +6 -5
  76. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  77. package/dist/esm/revogr-data_4.entry.js +37 -14
  78. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  79. package/dist/esm/revogr-filter-panel.entry.js +1 -1
  80. package/dist/esm/{row-header-utils-3dfbb81f.js → row-header-utils-7af8fcbf.js} +2 -3
  81. package/dist/esm/row-header-utils-7af8fcbf.js.map +1 -0
  82. package/dist/esm/{text-editor-901c3eb8.js → text-editor-fb3f24fe.js} +3 -3
  83. package/dist/esm/{text-editor-901c3eb8.js.map → text-editor-fb3f24fe.js.map} +1 -1
  84. package/dist/esm/{throttle-138d69c3.js → throttle-1f5772ef.js} +3 -3
  85. package/dist/esm/{throttle-138d69c3.js.map → throttle-1f5772ef.js.map} +1 -1
  86. package/dist/revo-grid/column.drag.plugin-b7bba0da.js +5 -0
  87. package/dist/revo-grid/column.drag.plugin-b7bba0da.js.map +1 -0
  88. package/dist/revo-grid/column.service-9b0603f4.js +5 -0
  89. package/dist/revo-grid/column.service-9b0603f4.js.map +1 -0
  90. package/dist/revo-grid/{debounce-72878ced.js → debounce-7b511afc.js} +2 -2
  91. package/dist/revo-grid/{edit.utils-6fc686b9.js → edit.utils-abcd0152.js} +2 -2
  92. package/dist/revo-grid/{header-cell-renderer-32d2ed96.js → header-cell-renderer-fce020c3.js} +2 -2
  93. package/dist/revo-grid/index-b1e05212.js +5 -0
  94. package/dist/revo-grid/index-b1e05212.js.map +1 -0
  95. package/dist/revo-grid/index.esm.js +1 -1
  96. package/dist/revo-grid/index.esm.js.map +1 -1
  97. package/dist/revo-grid/key.utils-ea9aec31.js +5 -0
  98. package/dist/revo-grid/{key.utils-17273f42.js.map → key.utils-ea9aec31.js.map} +1 -1
  99. package/dist/revo-grid/revo-grid.entry.js +1 -1
  100. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  101. package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
  102. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  103. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  104. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  105. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  106. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  107. package/dist/revo-grid/row-header-utils-7af8fcbf.js +5 -0
  108. package/dist/revo-grid/{row-header-utils-3dfbb81f.js.map → row-header-utils-7af8fcbf.js.map} +1 -1
  109. package/dist/revo-grid/text-editor-fb3f24fe.js +5 -0
  110. package/dist/revo-grid/{throttle-138d69c3.js → throttle-1f5772ef.js} +2 -2
  111. package/dist/types/components/data/revogr-data.d.ts +6 -2
  112. package/dist/types/components/order/revogr-order-editor.d.ts +1 -0
  113. package/dist/types/components/revoGrid/revo-grid.d.ts +2 -6
  114. package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +1 -1
  115. package/dist/types/components.d.ts +9 -2
  116. package/dist/types/services/dimension.provider.d.ts +1 -1
  117. package/dist/types/store/dimension/dimension.helpers.d.ts +0 -3
  118. package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
  119. package/dist/types/store/dimension/dimension.store.d.ts +2 -1
  120. package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
  121. package/dist/types/types/events.d.ts +1 -1
  122. package/dist/types/types/interfaces.d.ts +6 -1
  123. package/hydrate/index.js +194 -116
  124. package/hydrate/index.mjs +194 -116
  125. package/package.json +1 -1
  126. package/standalone/column.service.js +1 -1
  127. package/standalone/data.store.js +24 -10
  128. package/standalone/data.store.js.map +1 -1
  129. package/standalone/dimension.helpers.js +3 -6
  130. package/standalone/dimension.helpers.js.map +1 -1
  131. package/standalone/index.js +1 -0
  132. package/standalone/index.js.map +1 -1
  133. package/standalone/revo-grid.js +134 -73
  134. package/standalone/revo-grid.js.map +1 -1
  135. package/standalone/revogr-data2.js +6 -1
  136. package/standalone/revogr-data2.js.map +1 -1
  137. package/standalone/revogr-header2.js +1 -1
  138. package/standalone/revogr-order-editor2.js +2 -0
  139. package/standalone/revogr-order-editor2.js.map +1 -1
  140. package/standalone/revogr-viewport-scroll2.js +26 -8
  141. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  142. package/dist/cjs/column.drag.plugin-fcd892ec.js.map +0 -1
  143. package/dist/cjs/column.service-26c61ed6.js.map +0 -1
  144. package/dist/cjs/index-3ab26ab9.js +0 -513
  145. package/dist/cjs/index-3ab26ab9.js.map +0 -1
  146. package/dist/cjs/row-header-utils-c37f76e4.js.map +0 -1
  147. package/dist/esm/column.drag.plugin-3cc77986.js.map +0 -1
  148. package/dist/esm/column.service-751345b2.js.map +0 -1
  149. package/dist/esm/index-1dcad6ef.js +0 -476
  150. package/dist/esm/index-1dcad6ef.js.map +0 -1
  151. package/dist/esm/row-header-utils-3dfbb81f.js.map +0 -1
  152. package/dist/revo-grid/column.drag.plugin-3cc77986.js +0 -5
  153. package/dist/revo-grid/column.drag.plugin-3cc77986.js.map +0 -1
  154. package/dist/revo-grid/column.service-751345b2.js +0 -5
  155. package/dist/revo-grid/column.service-751345b2.js.map +0 -1
  156. package/dist/revo-grid/index-1dcad6ef.js +0 -5
  157. package/dist/revo-grid/index-1dcad6ef.js.map +0 -1
  158. package/dist/revo-grid/key.utils-17273f42.js +0 -5
  159. package/dist/revo-grid/row-header-utils-3dfbb81f.js +0 -5
  160. package/dist/revo-grid/text-editor-901c3eb8.js +0 -5
  161. package/standalone/identity.js +0 -26
  162. package/standalone/identity.js.map +0 -1
  163. /package/dist/revo-grid/{debounce-72878ced.js.map → debounce-7b511afc.js.map} +0 -0
  164. /package/dist/revo-grid/{edit.utils-6fc686b9.js.map → edit.utils-abcd0152.js.map} +0 -0
  165. /package/dist/revo-grid/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-fce020c3.js.map} +0 -0
  166. /package/dist/revo-grid/{text-editor-901c3eb8.js.map → text-editor-fb3f24fe.js.map} +0 -0
  167. /package/dist/revo-grid/{throttle-138d69c3.js.map → throttle-1f5772ef.js.map} +0 -0
@@ -1,8 +1,7 @@
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 { i as isObject, b as baseGetTag, r as root, S as Symbol, a as isObjectLike, f as freeGlobal, c as isSymbol, t as toNumber } from './debounce-7b511afc.js';
6
5
  import { g as getRenderingRef, f as forceUpdate } from './index-a61f225b.js';
7
6
 
8
7
  /**
@@ -2460,6 +2459,26 @@ function baseMatchesProperty(path, srcValue) {
2460
2459
  };
2461
2460
  }
2462
2461
 
2462
+ /**
2463
+ * This method returns the first argument it receives.
2464
+ *
2465
+ * @static
2466
+ * @since 0.1.0
2467
+ * @memberOf _
2468
+ * @category Util
2469
+ * @param {*} value Any value.
2470
+ * @returns {*} Returns `value`.
2471
+ * @example
2472
+ *
2473
+ * var object = { 'a': 1 };
2474
+ *
2475
+ * console.log(_.identity(object) === object);
2476
+ * // => true
2477
+ */
2478
+ function identity(value) {
2479
+ return value;
2480
+ }
2481
+
2463
2482
  /**
2464
2483
  * The base implementation of `_.property` without support for deep paths.
2465
2484
  *
@@ -2775,9 +2794,9 @@ function createRange(fromRight) {
2775
2794
  * _.range(0);
2776
2795
  * // => []
2777
2796
  */
2778
- var range = createRange();
2797
+ var range$1 = createRange();
2779
2798
 
2780
- const range$1 = range;
2799
+ const range$2 = range$1;
2781
2800
 
2782
2801
  const appendToMap = (map, propName, value) => {
2783
2802
  const items = map.get(propName);
@@ -2977,18 +2996,13 @@ const createStore = (defaultState, shouldUpdate) => {
2977
2996
  const trimmedPlugin = (store) => ({
2978
2997
  set(k, newVal) {
2979
2998
  switch (k) {
2980
- case 'trimmed':
2999
+ case 'trimmed': {
2981
3000
  const proxy = store.get('proxyItems');
2982
3001
  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
- }, []);
3002
+ const newItems = proxy.filter(v => !trimmed[v]);
2990
3003
  store.set('items', newItems);
2991
3004
  break;
3005
+ }
2992
3006
  }
2993
3007
  },
2994
3008
  });
@@ -3040,7 +3054,7 @@ class DataStore {
3040
3054
  }
3041
3055
  // clear items
3042
3056
  this.store.set('items', []);
3043
- const items = range$1(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
3057
+ const items = range$2(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
3044
3058
  // set proxy first
3045
3059
  setStore(this.store, {
3046
3060
  source,
@@ -3150,1246 +3164,451 @@ function getSourceItemVirtualIndexByProp(store, prop) {
3150
3164
  return items.indexOf(physicalIndex);
3151
3165
  }
3152
3166
 
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;
3167
+ /** Used as references for the maximum length and index of an array. */
3168
+ var MAX_ARRAY_LENGTH$1 = 4294967295,
3169
+ MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$1 - 1;
3168
3170
 
3169
- if (initAccum && length) {
3170
- accumulator = array[++index];
3171
- }
3172
- while (++index < length) {
3173
- accumulator = iteratee(accumulator, array[index], index, array);
3171
+ /* Built-in method references for those with the same name as other `lodash` methods. */
3172
+ var nativeFloor = Math.floor,
3173
+ nativeMin = Math.min;
3174
+
3175
+ /**
3176
+ * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
3177
+ * which invokes `iteratee` for `value` and each element of `array` to compute
3178
+ * their sort ranking. The iteratee is invoked with one argument; (value).
3179
+ *
3180
+ * @private
3181
+ * @param {Array} array The sorted array to inspect.
3182
+ * @param {*} value The value to evaluate.
3183
+ * @param {Function} iteratee The iteratee invoked per element.
3184
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
3185
+ * @returns {number} Returns the index at which `value` should be inserted
3186
+ * into `array`.
3187
+ */
3188
+ function baseSortedIndexBy(array, value, iteratee, retHighest) {
3189
+ var low = 0,
3190
+ high = array == null ? 0 : array.length;
3191
+ if (high === 0) {
3192
+ return 0;
3193
+ }
3194
+
3195
+ value = iteratee(value);
3196
+ var valIsNaN = value !== value,
3197
+ valIsNull = value === null,
3198
+ valIsSymbol = isSymbol(value),
3199
+ valIsUndefined = value === undefined;
3200
+
3201
+ while (low < high) {
3202
+ var mid = nativeFloor((low + high) / 2),
3203
+ computed = iteratee(array[mid]),
3204
+ othIsDefined = computed !== undefined,
3205
+ othIsNull = computed === null,
3206
+ othIsReflexive = computed === computed,
3207
+ othIsSymbol = isSymbol(computed);
3208
+
3209
+ if (valIsNaN) {
3210
+ var setLow = retHighest || othIsReflexive;
3211
+ } else if (valIsUndefined) {
3212
+ setLow = othIsReflexive && (retHighest || othIsDefined);
3213
+ } else if (valIsNull) {
3214
+ setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
3215
+ } else if (valIsSymbol) {
3216
+ setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
3217
+ } else if (othIsNull || othIsSymbol) {
3218
+ setLow = false;
3219
+ } else {
3220
+ setLow = retHighest ? (computed <= value) : (computed < value);
3221
+ }
3222
+ if (setLow) {
3223
+ low = mid + 1;
3224
+ } else {
3225
+ high = mid;
3226
+ }
3174
3227
  }
3175
- return accumulator;
3228
+ return nativeMin(high, MAX_ARRAY_INDEX);
3176
3229
  }
3177
3230
 
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
- }
3197
- }
3198
- return object;
3199
- };
3200
- }
3231
+ /** Used as references for the maximum length and index of an array. */
3232
+ var MAX_ARRAY_LENGTH = 4294967295,
3233
+ HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
3201
3234
 
3202
3235
  /**
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`.
3236
+ * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
3237
+ * performs a binary search of `array` to determine the index at which `value`
3238
+ * should be inserted into `array` in order to maintain its sort order.
3206
3239
  *
3207
3240
  * @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`.
3241
+ * @param {Array} array The sorted array to inspect.
3242
+ * @param {*} value The value to evaluate.
3243
+ * @param {boolean} [retHighest] Specify returning the highest qualified index.
3244
+ * @returns {number} Returns the index at which `value` should be inserted
3245
+ * into `array`.
3212
3246
  */
3213
- var baseFor = createBaseFor();
3247
+ function baseSortedIndex(array, value, retHighest) {
3248
+ var low = 0,
3249
+ high = array == null ? low : array.length;
3214
3250
 
3215
- const baseFor$1 = baseFor;
3251
+ if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
3252
+ while (low < high) {
3253
+ var mid = (low + high) >>> 1,
3254
+ computed = array[mid];
3216
3255
 
3217
- /**
3218
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
3219
- *
3220
- * @private
3221
- * @param {Object} object The object to iterate over.
3222
- * @param {Function} iteratee The function invoked per iteration.
3223
- * @returns {Object} Returns `object`.
3224
- */
3225
- function baseForOwn(object, iteratee) {
3226
- return object && baseFor$1(object, iteratee, keys);
3227
- }
3228
-
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);
3248
-
3249
- while ((fromRight ? index-- : ++index < length)) {
3250
- if (iteratee(iterable[index], index, iterable) === false) {
3251
- break;
3256
+ if (computed !== null && !isSymbol(computed) &&
3257
+ (retHighest ? (computed <= value) : (computed < value))) {
3258
+ low = mid + 1;
3259
+ } else {
3260
+ high = mid;
3252
3261
  }
3253
3262
  }
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;
3263
+ return high;
3264
+ }
3265
+ return baseSortedIndexBy(array, value, identity, retHighest);
3290
3266
  }
3291
3267
 
3292
3268
  /**
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`
3269
+ * Uses a binary search to determine the lowest index at which `value`
3270
+ * should be inserted into `array` in order to maintain its sort order.
3306
3271
  *
3307
3272
  * @static
3308
3273
  * @memberOf _
3309
3274
  * @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
3275
+ * @category Array
3276
+ * @param {Array} array The sorted array to inspect.
3277
+ * @param {*} value The value to evaluate.
3278
+ * @returns {number} Returns the index at which `value` should be inserted
3279
+ * into `array`.
3316
3280
  * @example
3317
3281
  *
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)
3282
+ * _.sortedIndex([30, 50], 40);
3283
+ * // => 1
3328
3284
  */
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);
3285
+ function sortedIndex(array, value) {
3286
+ return baseSortedIndex(array, value);
3334
3287
  }
3335
3288
 
3336
3289
  /**
3337
- * Selection store
3290
+ * Pre-calculation
3291
+ * Dimension custom sizes for each cell
3292
+ * Keeps only changed sizes, skips origin size
3338
3293
  */
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 });
3294
+ function calculateDimensionData(originItemSize, newSizes = {}) {
3295
+ const positionIndexes = [];
3296
+ const positionIndexToItem = {};
3297
+ const indexToItem = {};
3298
+ // prepare order sorted new sizes and calculate changed real size
3299
+ const newIndexes = Object.keys(newSizes).map(Number).sort((a, b) => a - b);
3300
+ // fill new coordinates based on what is changed
3301
+ newIndexes.reduce((previous, itemIndex, i) => {
3302
+ const newItem = {
3303
+ itemIndex,
3304
+ start: 0,
3305
+ end: 0,
3306
+ };
3307
+ // if previous item was changed too
3308
+ if (previous) {
3309
+ const itemsBetween = (itemIndex - previous.itemIndex - 1) * originItemSize;
3310
+ newItem.start = itemsBetween + previous.end;
3369
3311
  }
3370
3312
  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;
3313
+ newItem.start = itemIndex * originItemSize;
3406
3314
  }
3407
- setStore(this.store, { edit: null });
3408
- }
3409
- dispose() {
3410
- this.unsubscribe.forEach(f => f());
3411
- this.store.dispose();
3412
- }
3315
+ newItem.end = newItem.start + newSizes[itemIndex];
3316
+ positionIndexes.push(newItem.start);
3317
+ indexToItem[itemIndex] = positionIndexToItem[i] = newItem;
3318
+ return newItem;
3319
+ }, undefined);
3320
+ return {
3321
+ indexes: newIndexes,
3322
+ positionIndexes: [...positionIndexes],
3323
+ positionIndexToItem: Object.assign({}, positionIndexToItem),
3324
+ indexToItem,
3325
+ };
3413
3326
  }
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;
3327
+ /**
3328
+ * Calculate item by position
3329
+ */
3330
+ const getItemByPosition = ({ indexes, positionIndexes, originItemSize, positionIndexToItem, }, pos) => {
3331
+ const item = {
3332
+ itemIndex: 0,
3333
+ start: 0,
3334
+ end: 0,
3335
+ };
3336
+ const currentPlace = indexes.length ? sortedIndex(positionIndexes, pos) : 0;
3337
+ // not found or first index
3338
+ if (!currentPlace) {
3339
+ item.itemIndex = Math.floor(pos / originItemSize);
3340
+ item.start = item.itemIndex * originItemSize;
3341
+ item.end = item.start + originItemSize;
3342
+ return item;
3343
+ }
3344
+ const positionItem = positionIndexToItem[currentPlace - 1];
3345
+ // if item has specified size
3346
+ if (positionItem.end > pos) {
3347
+ return positionItem;
3348
+ }
3349
+ // special size item was present before
3350
+ const relativePos = pos - positionItem.end;
3351
+ const relativeIndex = Math.floor(relativePos / originItemSize);
3352
+ item.itemIndex = positionItem.itemIndex + 1 + relativeIndex;
3353
+ item.start = positionItem.end + relativeIndex * originItemSize;
3354
+ item.end = item.start + originItemSize;
3355
+ return item;
3356
+ };
3357
+ function getItemByIndex(dimension, index) {
3358
+ let item = {
3359
+ itemIndex: index,
3360
+ start: 0,
3361
+ end: 0,
3362
+ };
3363
+ // if item has specified size
3364
+ if (dimension.indexToItem[index]) {
3365
+ return dimension.indexToItem[index];
3366
+ }
3367
+ const currentPlace = dimension.indexes.length
3368
+ ? sortedIndex(dimension.indexes, index)
3369
+ : 0;
3370
+ // not found or first index
3371
+ if (!currentPlace) {
3372
+ item.start = item.itemIndex * dimension.originItemSize;
3373
+ item.end = item.start + dimension.originItemSize;
3374
+ return item;
3375
+ }
3376
+ // special size item was present before
3377
+ const positionItem = dimension.indexToItem[dimension.indexes[currentPlace - 1]];
3378
+ item.start =
3379
+ positionItem.end +
3380
+ (index - positionItem.itemIndex - 1) * dimension.originItemSize;
3381
+ item.end = item.start + dimension.originItemSize;
3382
+ return item;
3383
+ }
3384
+
3385
+ const MIN_COL_SIZE = 30;
3386
+ const RESIZE_INTERVAL = 40;
3387
+ const DATA_COL = 'data-rgCol';
3388
+ const DATA_ROW = 'data-rgRow';
3389
+ const DISABLED_CLASS = 'disabled';
3390
+ const CELL_CLASS = 'rgCell';
3391
+ const ROW_HEADER_TYPE = 'rowHeaders';
3392
+ const HEADER_CLASS = 'rgHeaderCell';
3393
+ const HEADER_SORTABLE_CLASS = 'sortable';
3394
+ const HEADER_ROW_CLASS = 'header-rgRow';
3395
+ const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
3396
+ const DRAG_ICON_CLASS = 'revo-drag-icon';
3397
+ const DRAGGABLE_CLASS = 'revo-draggable';
3398
+ const FOCUS_CLASS = 'focused-cell';
3399
+ const SELECTION_BORDER_CLASS = 'selection-border-range';
3400
+ const MOBILE_CLASS = 'mobile-handler';
3401
+ const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
3402
+ const CELL_HANDLER_CLASS = 'autofill-handle';
3403
+ const EDIT_INPUT_WR = 'edit-input-wrapper';
3404
+ const DRAGG_TEXT = 'Draggable item';
3405
+ const GRID_INTERNALS = '__rvgr';
3406
+ const ROW_FOCUSED_CLASS = 'focused-rgRow';
3407
+
3408
+ var codes;
3409
+ (function (codes) {
3410
+ codes[codes["MOUSE_LEFT"] = 1] = "MOUSE_LEFT";
3411
+ codes[codes["MOUSE_RIGHT"] = 3] = "MOUSE_RIGHT";
3412
+ codes[codes["MOUSE_MIDDLE"] = 2] = "MOUSE_MIDDLE";
3413
+ codes[codes["BACKSPACE"] = 8] = "BACKSPACE";
3414
+ codes[codes["COMMA"] = 188] = "COMMA";
3415
+ codes[codes["INSERT"] = 45] = "INSERT";
3416
+ codes[codes["DELETE"] = 46] = "DELETE";
3417
+ codes[codes["END"] = 35] = "END";
3418
+ codes[codes["ENTER"] = 13] = "ENTER";
3419
+ codes[codes["ESCAPE"] = 27] = "ESCAPE";
3420
+ codes[codes["CONTROL"] = 17] = "CONTROL";
3421
+ codes[codes["COMMAND_LEFT"] = 91] = "COMMAND_LEFT";
3422
+ codes[codes["COMMAND_RIGHT"] = 93] = "COMMAND_RIGHT";
3423
+ codes[codes["COMMAND_FIREFOX"] = 224] = "COMMAND_FIREFOX";
3424
+ codes[codes["ALT"] = 18] = "ALT";
3425
+ codes[codes["HOME"] = 36] = "HOME";
3426
+ codes[codes["PAGE_DOWN"] = 34] = "PAGE_DOWN";
3427
+ codes[codes["PAGE_UP"] = 33] = "PAGE_UP";
3428
+ codes[codes["PERIOD"] = 190] = "PERIOD";
3429
+ codes[codes["SPACE"] = 32] = "SPACE";
3430
+ codes[codes["SHIFT"] = 16] = "SHIFT";
3431
+ codes[codes["CAPS_LOCK"] = 20] = "CAPS_LOCK";
3432
+ codes[codes["TAB"] = 9] = "TAB";
3433
+ codes[codes["ARROW_RIGHT"] = 39] = "ARROW_RIGHT";
3434
+ codes[codes["ARROW_LEFT"] = 37] = "ARROW_LEFT";
3435
+ codes[codes["ARROW_UP"] = 38] = "ARROW_UP";
3436
+ codes[codes["ARROW_DOWN"] = 40] = "ARROW_DOWN";
3437
+ codes[codes["F1"] = 112] = "F1";
3438
+ codes[codes["F2"] = 113] = "F2";
3439
+ codes[codes["F3"] = 114] = "F3";
3440
+ codes[codes["F4"] = 115] = "F4";
3441
+ codes[codes["F5"] = 116] = "F5";
3442
+ codes[codes["F6"] = 117] = "F6";
3443
+ codes[codes["F7"] = 118] = "F7";
3444
+ codes[codes["F8"] = 119] = "F8";
3445
+ codes[codes["F9"] = 120] = "F9";
3446
+ codes[codes["F10"] = 121] = "F10";
3447
+ codes[codes["F11"] = 122] = "F11";
3448
+ codes[codes["F12"] = 123] = "F12";
3449
+ codes[codes["A"] = 65] = "A";
3450
+ codes[codes["C"] = 67] = "C";
3451
+ codes[codes["D"] = 68] = "D";
3452
+ codes[codes["F"] = 70] = "F";
3453
+ codes[codes["L"] = 76] = "L";
3454
+ codes[codes["O"] = 79] = "O";
3455
+ codes[codes["P"] = 80] = "P";
3456
+ codes[codes["S"] = 83] = "S";
3457
+ codes[codes["V"] = 86] = "V";
3458
+ codes[codes["X"] = 88] = "X";
3459
+ })(codes || (codes = {}));
3460
+ var codesLetter;
3461
+ (function (codesLetter) {
3462
+ codesLetter["ENTER"] = "Enter";
3463
+ codesLetter["ENTER_NUM"] = "NumpadEnter";
3464
+ codesLetter["A"] = "KeyA";
3465
+ codesLetter["C"] = "KeyC";
3466
+ codesLetter["X"] = "KeyX";
3467
+ codesLetter["V"] = "KeyV";
3468
+ codesLetter["ESCAPE"] = "Escape";
3469
+ codesLetter["TAB"] = "Tab";
3470
+ codesLetter["BACKSPACE"] = "Backspace";
3471
+ codesLetter["DELETE"] = "Delete";
3472
+ codesLetter["ARROW_RIGHT"] = "ArrowRight";
3473
+ codesLetter["ARROW_LEFT"] = "ArrowLeft";
3474
+ codesLetter["ARROW_UP"] = "ArrowUp";
3475
+ codesLetter["ARROW_DOWN"] = "ArrowDown";
3476
+ codesLetter["SHIFT"] = "Shift";
3477
+ })(codesLetter || (codesLetter = {}));
3478
+ var keyValues;
3479
+ (function (keyValues) {
3480
+ keyValues["ENTER"] = "Enter";
3481
+ keyValues["TAB"] = "Tab";
3482
+ })(keyValues || (keyValues = {}));
3483
+ const KeyCodesEnum = codes;
3484
+
3485
+ var osPlatform;
3486
+ (function (osPlatform) {
3487
+ osPlatform["mac"] = "Mac";
3488
+ })(osPlatform || (osPlatform = {}));
3489
+ const OsPlatform = osPlatform;
3490
+
3491
+ /* Generate range on size
3492
+ */
3493
+ function range(size, startAt = 0) {
3494
+ const res = [];
3495
+ const end = startAt + size;
3496
+ for (let i = startAt; i < end; i++) {
3497
+ res.push(i);
3609
3498
  }
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
- }
3499
+ return res;
3500
+ }
3501
+ /* Find index position in array */
3502
+ function findPositionInArray(el, compareFn) {
3503
+ return (function (arr) {
3504
+ let m = 0;
3505
+ let n = arr.length - 1;
3506
+ while (m <= n) {
3507
+ const k = (n + m) >> 1;
3508
+ const cmp = compareFn(el, arr[k]);
3509
+ if (cmp > 0) {
3510
+ m = k + 1;
3631
3511
  }
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,
3673
- };
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();
3512
+ else if (cmp < 0) {
3513
+ n = k - 1;
3680
3514
  }
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
- }
3515
+ else {
3516
+ return k;
3703
3517
  }
3704
3518
  }
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);
3519
+ return -m - 1;
3520
+ })(this);
3776
3521
  }
3777
3522
  /**
3778
- * Get column type from column data
3523
+ * Sorted push
3779
3524
  */
3780
- function getColumnType(rgCol) {
3781
- if (rgCol.pin) {
3782
- return rgCol.pin;
3783
- }
3784
- return 'rgCol';
3525
+ function pushSorted(arr, el, fn) {
3526
+ arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
3527
+ return arr;
3785
3528
  }
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;
3529
+ // (arr1[index1] < arr2[index2])
3530
+ function simpleCompare(el1, el2) {
3531
+ return el1 < el2;
3794
3532
  }
3795
3533
  /**
3796
- * Check if column is grouping column
3534
+ * Merge sorted array helper function
3797
3535
  */
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
3536
+ function mergeSortedArray(arr1, arr2, compareFn = simpleCompare) {
3537
+ const merged = [];
3538
+ let index1 = 0;
3539
+ let index2 = 0;
3540
+ let current = 0;
3541
+ while (current < arr1.length + arr2.length) {
3542
+ let isArr1Depleted = index1 >= arr1.length;
3543
+ let isArr2Depleted = index2 >= arr2.length;
3544
+ if (!isArr1Depleted && (isArr2Depleted || compareFn(arr1[index1], arr2[index2]))) {
3545
+ merged[current] = arr1[index1];
3546
+ index1++;
3838
3547
  }
3839
3548
  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
- }
3871
- }
3872
- }
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, []);
3549
+ merged[current] = arr2[index2];
3550
+ index2++;
3935
3551
  }
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
- 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
3994
- };
3995
- }
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;
3552
+ current++;
4028
3553
  }
4029
- const depth = measureEqualDepth(currentGroup, nextGroup);
4030
- return currentModel[GROUP_DEPTH] < depth;
3554
+ return merged;
4031
3555
  }
4032
-
4033
3556
  /**
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`.
3557
+ * Calculate system scrollbar size
4041
3558
  */
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;
3559
+ function getScrollbarSize(document) {
3560
+ // Create a temporary div container and append it to the body
3561
+ const container = document.createElement('div');
3562
+ // Apply styling to ensure the div is scrollable
3563
+ container.style.overflow = 'scroll';
3564
+ container.style.visibility = 'hidden'; // make sure the container isn't visible
3565
+ container.style.position = 'absolute';
3566
+ container.style.top = '-9999px'; // move it out of the screen
3567
+ container.style.width = '50px'; // arbitrary width
3568
+ container.style.height = '50px'; // arbitrary height
3569
+ // Append the div to the body
3570
+ document.body.appendChild(container);
3571
+ // Calculate the width of the scrollbar
3572
+ const scrollbarWidth = container.offsetWidth - container.clientWidth;
3573
+ // Remove the div from the body after calculation
3574
+ document.body.removeChild(container);
3575
+ // Return the calculated width of the scrollbar
3576
+ return scrollbarWidth;
4061
3577
  }
4062
-
4063
- /**
4064
- * Creates a slice of `array` from `start` up to, but not including, `end`.
3578
+ /* Scale a value between 2 ranges
4065
3579
  *
4066
- * **Note:** This method is used instead of
4067
- * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
4068
- * returned.
3580
+ * Sample:
3581
+ * // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
3582
+ * const n = scaleValue(55, [0,100], [0,1000]);
4069
3583
  *
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`.
3584
+ * Ranges of two values
3585
+ * @from
3586
+ * @to
3587
+ *
3588
+ * ~~ return value does the equivalent of Math.floor but faster.
4078
3589
  */
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
- }
3590
+ function scaleValue(value, from, to) {
3591
+ return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
4357
3592
  }
4358
3593
  /**
4359
- * Checks if the given rowDrag is a service for dragging rows.
3594
+ * Async timeout
4360
3595
  */
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);
3596
+ async function timeout(delay = 0) {
3597
+ await new Promise((r) => {
3598
+ setTimeout(() => r(), delay);
3599
+ });
4375
3600
  }
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;
3601
+ /**
3602
+ * Type script mixins
3603
+ */
3604
+ function applyMixins(derivedCtor, constructors) {
3605
+ constructors.forEach(baseCtor => {
3606
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
3607
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
3608
+ });
3609
+ });
4391
3610
  }
4392
3611
 
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 };
3612
+ export { keys 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, baseIteratee as a1, OsPlatform as a2, KeyCodesEnum as a3, baseProperty as a4, getTag$1 as a5, baseKeys 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 };
4394
3613
 
4395
- //# sourceMappingURL=column.service-751345b2.js.map
3614
+ //# sourceMappingURL=index-b1e05212.js.map