@revolist/revogrid 4.10.0 → 4.10.2

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 (122) hide show
  1. package/dist/cjs/{column.drag.plugin-7098477f.js → column.drag.plugin-08ca04f4.js} +18 -18
  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-75fa1cab.js → edit.utils-4a790cf8.js} +2 -2
  6. package/dist/cjs/{edit.utils-75fa1cab.js.map → edit.utils-4a790cf8.js.map} +1 -1
  7. package/dist/cjs/{header-cell-renderer-aaaad4c8.js → header-cell-renderer-db089f54.js} +2 -2
  8. package/dist/cjs/{header-cell-renderer-aaaad4c8.js.map → header-cell-renderer-db089f54.js.map} +1 -1
  9. package/dist/cjs/{column.service-f1d5d924.js → index-91e92bea.js} +452 -1227
  10. package/dist/cjs/index-91e92bea.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +20 -20
  12. package/dist/cjs/{key.utils-8f1105f3.js → key.utils-e65c24e6.js} +2 -2
  13. package/dist/cjs/{key.utils-8f1105f3.js.map → key.utils-e65c24e6.js.map} +1 -1
  14. package/dist/cjs/revo-grid.cjs.entry.js +26 -26
  15. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  16. package/dist/cjs/revogr-attribution_7.cjs.entry.js +11 -11
  17. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  18. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +5 -4
  19. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  20. package/dist/cjs/revogr-data_4.cjs.entry.js +9 -9
  21. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  22. package/dist/cjs/{row-header-utils-208e4026.js → row-header-utils-dc3d3185.js} +5 -6
  23. package/dist/cjs/row-header-utils-dc3d3185.js.map +1 -0
  24. package/dist/cjs/{text-editor-b64a080e.js → text-editor-a32a3993.js} +3 -3
  25. package/dist/cjs/{text-editor-b64a080e.js.map → text-editor-a32a3993.js.map} +1 -1
  26. package/dist/cjs/{throttle-3b362440.js → throttle-da92b75d.js} +2 -2
  27. package/dist/cjs/{throttle-3b362440.js.map → throttle-da92b75d.js.map} +1 -1
  28. package/dist/collection/components/order/revogr-order-editor.js +4 -2
  29. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  30. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  31. package/dist/esm/{column.drag.plugin-813698d2.js → column.drag.plugin-b7bba0da.js} +6 -6
  32. package/dist/esm/{column.drag.plugin-813698d2.js.map → column.drag.plugin-b7bba0da.js.map} +1 -1
  33. package/dist/esm/column.service-9b0603f4.js +1249 -0
  34. package/dist/esm/column.service-9b0603f4.js.map +1 -0
  35. package/dist/esm/{debounce-72878ced.js → debounce-7b511afc.js} +2 -2
  36. package/dist/esm/{debounce-72878ced.js.map → debounce-7b511afc.js.map} +1 -1
  37. package/dist/esm/{edit.utils-cd6a3224.js → edit.utils-abcd0152.js} +2 -2
  38. package/dist/esm/{edit.utils-cd6a3224.js.map → edit.utils-abcd0152.js.map} +1 -1
  39. package/dist/esm/{header-cell-renderer-5939221a.js → header-cell-renderer-fce020c3.js} +2 -2
  40. package/dist/esm/{header-cell-renderer-5939221a.js.map → header-cell-renderer-fce020c3.js.map} +1 -1
  41. package/dist/esm/{column.service-aa142672.js → index-b1e05212.js} +411 -1187
  42. package/dist/esm/index-b1e05212.js.map +1 -0
  43. package/dist/esm/index.js +8 -8
  44. package/dist/esm/{key.utils-5ff2ec82.js → key.utils-ea9aec31.js} +2 -2
  45. package/dist/esm/{key.utils-5ff2ec82.js.map → key.utils-ea9aec31.js.map} +1 -1
  46. package/dist/esm/revo-grid.entry.js +6 -6
  47. package/dist/esm/revo-grid.entry.js.map +1 -1
  48. package/dist/esm/revogr-attribution_7.entry.js +7 -7
  49. package/dist/esm/revogr-clipboard_3.entry.js +6 -5
  50. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  51. package/dist/esm/revogr-data_4.entry.js +5 -5
  52. package/dist/esm/revogr-filter-panel.entry.js +1 -1
  53. package/dist/esm/{row-header-utils-5511678e.js → row-header-utils-7af8fcbf.js} +2 -3
  54. package/dist/esm/row-header-utils-7af8fcbf.js.map +1 -0
  55. package/dist/esm/{text-editor-81767dcb.js → text-editor-fb3f24fe.js} +3 -3
  56. package/dist/esm/{text-editor-81767dcb.js.map → text-editor-fb3f24fe.js.map} +1 -1
  57. package/dist/esm/{throttle-4eff5b3c.js → throttle-1f5772ef.js} +3 -3
  58. package/dist/esm/{throttle-4eff5b3c.js.map → throttle-1f5772ef.js.map} +1 -1
  59. package/dist/revo-grid/column.drag.plugin-b7bba0da.js +5 -0
  60. package/dist/revo-grid/{column.drag.plugin-813698d2.js.map → column.drag.plugin-b7bba0da.js.map} +1 -1
  61. package/dist/revo-grid/column.service-9b0603f4.js +5 -0
  62. package/dist/revo-grid/column.service-9b0603f4.js.map +1 -0
  63. package/dist/revo-grid/{debounce-72878ced.js → debounce-7b511afc.js} +2 -2
  64. package/dist/revo-grid/{edit.utils-cd6a3224.js → edit.utils-abcd0152.js} +2 -2
  65. package/dist/revo-grid/{header-cell-renderer-5939221a.js → header-cell-renderer-fce020c3.js} +2 -2
  66. package/dist/revo-grid/index-b1e05212.js +5 -0
  67. package/dist/revo-grid/index-b1e05212.js.map +1 -0
  68. package/dist/revo-grid/index.esm.js +1 -1
  69. package/dist/revo-grid/key.utils-ea9aec31.js +5 -0
  70. package/dist/revo-grid/{key.utils-5ff2ec82.js.map → key.utils-ea9aec31.js.map} +1 -1
  71. package/dist/revo-grid/revo-grid.entry.js +1 -1
  72. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  73. package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
  74. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  75. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  76. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  77. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  78. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  79. package/dist/revo-grid/row-header-utils-7af8fcbf.js +5 -0
  80. package/dist/revo-grid/{row-header-utils-5511678e.js.map → row-header-utils-7af8fcbf.js.map} +1 -1
  81. package/dist/revo-grid/text-editor-fb3f24fe.js +5 -0
  82. package/dist/revo-grid/{throttle-4eff5b3c.js → throttle-1f5772ef.js} +2 -2
  83. package/dist/types/components/order/revogr-order-editor.d.ts +1 -0
  84. package/dist/types/components/revoGrid/revo-grid.d.ts +1 -5
  85. package/dist/types/components.d.ts +2 -0
  86. package/hydrate/index.js +24 -23
  87. package/hydrate/index.mjs +24 -23
  88. package/package.json +1 -1
  89. package/readme.md +10 -12
  90. package/standalone/column.service.js +1 -1
  91. package/standalone/data.store.js +21 -2
  92. package/standalone/data.store.js.map +1 -1
  93. package/standalone/dimension.helpers.js +1 -1
  94. package/standalone/revo-grid.js +1 -2
  95. package/standalone/revo-grid.js.map +1 -1
  96. package/standalone/revogr-header2.js +1 -1
  97. package/standalone/revogr-order-editor2.js +2 -0
  98. package/standalone/revogr-order-editor2.js.map +1 -1
  99. package/dist/cjs/column.drag.plugin-7098477f.js.map +0 -1
  100. package/dist/cjs/column.service-f1d5d924.js.map +0 -1
  101. package/dist/cjs/index-aecb871a.js +0 -510
  102. package/dist/cjs/index-aecb871a.js.map +0 -1
  103. package/dist/cjs/row-header-utils-208e4026.js.map +0 -1
  104. package/dist/esm/column.service-aa142672.js.map +0 -1
  105. package/dist/esm/index-dbd1c020.js +0 -473
  106. package/dist/esm/index-dbd1c020.js.map +0 -1
  107. package/dist/esm/row-header-utils-5511678e.js.map +0 -1
  108. package/dist/revo-grid/column.drag.plugin-813698d2.js +0 -5
  109. package/dist/revo-grid/column.service-aa142672.js +0 -5
  110. package/dist/revo-grid/column.service-aa142672.js.map +0 -1
  111. package/dist/revo-grid/index-dbd1c020.js +0 -5
  112. package/dist/revo-grid/index-dbd1c020.js.map +0 -1
  113. package/dist/revo-grid/key.utils-5ff2ec82.js +0 -5
  114. package/dist/revo-grid/row-header-utils-5511678e.js +0 -5
  115. package/dist/revo-grid/text-editor-81767dcb.js +0 -5
  116. package/standalone/identity.js +0 -26
  117. package/standalone/identity.js.map +0 -1
  118. /package/dist/revo-grid/{debounce-72878ced.js.map → debounce-7b511afc.js.map} +0 -0
  119. /package/dist/revo-grid/{edit.utils-cd6a3224.js.map → edit.utils-abcd0152.js.map} +0 -0
  120. /package/dist/revo-grid/{header-cell-renderer-5939221a.js.map → header-cell-renderer-fce020c3.js.map} +0 -0
  121. /package/dist/revo-grid/{text-editor-81767dcb.js.map → text-editor-fb3f24fe.js.map} +0 -0
  122. /package/dist/revo-grid/{throttle-4eff5b3c.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-dbd1c020.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);
@@ -3035,7 +3054,7 @@ class DataStore {
3035
3054
  }
3036
3055
  // clear items
3037
3056
  this.store.set('items', []);
3038
- 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);
3039
3058
  // set proxy first
3040
3059
  setStore(this.store, {
3041
3060
  source,
@@ -3145,1246 +3164,451 @@ function getSourceItemVirtualIndexByProp(store, prop) {
3145
3164
  return items.indexOf(physicalIndex);
3146
3165
  }
3147
3166
 
3148
- /**
3149
- * A specialized version of `_.reduce` for arrays without support for
3150
- * iteratee shorthands.
3151
- *
3152
- * @private
3153
- * @param {Array} [array] The array to iterate over.
3154
- * @param {Function} iteratee The function invoked per iteration.
3155
- * @param {*} [accumulator] The initial value.
3156
- * @param {boolean} [initAccum] Specify using the first element of `array` as
3157
- * the initial value.
3158
- * @returns {*} Returns the accumulated value.
3159
- */
3160
- function arrayReduce(array, iteratee, accumulator, initAccum) {
3161
- var index = -1,
3162
- 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;
3163
3170
 
3164
- if (initAccum && length) {
3165
- accumulator = array[++index];
3166
- }
3167
- while (++index < length) {
3168
- 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
+ }
3169
3227
  }
3170
- return accumulator;
3228
+ return nativeMin(high, MAX_ARRAY_INDEX);
3171
3229
  }
3172
3230
 
3173
- /**
3174
- * Creates a base function for methods like `_.forIn` and `_.forOwn`.
3175
- *
3176
- * @private
3177
- * @param {boolean} [fromRight] Specify iterating from right to left.
3178
- * @returns {Function} Returns the new base function.
3179
- */
3180
- function createBaseFor(fromRight) {
3181
- return function(object, iteratee, keysFunc) {
3182
- var index = -1,
3183
- iterable = Object(object),
3184
- props = keysFunc(object),
3185
- length = props.length;
3186
-
3187
- while (length--) {
3188
- var key = props[fromRight ? length : ++index];
3189
- if (iteratee(iterable[key], key, iterable) === false) {
3190
- break;
3191
- }
3192
- }
3193
- return object;
3194
- };
3195
- }
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;
3196
3234
 
3197
3235
  /**
3198
- * The base implementation of `baseForOwn` which iterates over `object`
3199
- * properties returned by `keysFunc` and invokes `iteratee` for each property.
3200
- * 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.
3201
3239
  *
3202
3240
  * @private
3203
- * @param {Object} object The object to iterate over.
3204
- * @param {Function} iteratee The function invoked per iteration.
3205
- * @param {Function} keysFunc The function to get the keys of `object`.
3206
- * @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`.
3207
3246
  */
3208
- var baseFor = createBaseFor();
3247
+ function baseSortedIndex(array, value, retHighest) {
3248
+ var low = 0,
3249
+ high = array == null ? low : array.length;
3209
3250
 
3210
- 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];
3211
3255
 
3212
- /**
3213
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
3214
- *
3215
- * @private
3216
- * @param {Object} object The object to iterate over.
3217
- * @param {Function} iteratee The function invoked per iteration.
3218
- * @returns {Object} Returns `object`.
3219
- */
3220
- function baseForOwn(object, iteratee) {
3221
- return object && baseFor$1(object, iteratee, keys);
3222
- }
3223
-
3224
- /**
3225
- * Creates a `baseEach` or `baseEachRight` function.
3226
- *
3227
- * @private
3228
- * @param {Function} eachFunc The function to iterate over a collection.
3229
- * @param {boolean} [fromRight] Specify iterating from right to left.
3230
- * @returns {Function} Returns the new base function.
3231
- */
3232
- function createBaseEach(eachFunc, fromRight) {
3233
- return function(collection, iteratee) {
3234
- if (collection == null) {
3235
- return collection;
3236
- }
3237
- if (!isArrayLike(collection)) {
3238
- return eachFunc(collection, iteratee);
3239
- }
3240
- var length = collection.length,
3241
- index = fromRight ? length : -1,
3242
- iterable = Object(collection);
3243
-
3244
- while ((fromRight ? index-- : ++index < length)) {
3245
- if (iteratee(iterable[index], index, iterable) === false) {
3246
- break;
3256
+ if (computed !== null && !isSymbol(computed) &&
3257
+ (retHighest ? (computed <= value) : (computed < value))) {
3258
+ low = mid + 1;
3259
+ } else {
3260
+ high = mid;
3247
3261
  }
3248
3262
  }
3249
- return collection;
3250
- };
3251
- }
3252
-
3253
- /**
3254
- * The base implementation of `_.forEach` without support for iteratee shorthands.
3255
- *
3256
- * @private
3257
- * @param {Array|Object} collection The collection to iterate over.
3258
- * @param {Function} iteratee The function invoked per iteration.
3259
- * @returns {Array|Object} Returns `collection`.
3260
- */
3261
- var baseEach = createBaseEach(baseForOwn);
3262
-
3263
- const baseEach$1 = baseEach;
3264
-
3265
- /**
3266
- * The base implementation of `_.reduce` and `_.reduceRight`, without support
3267
- * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
3268
- *
3269
- * @private
3270
- * @param {Array|Object} collection The collection to iterate over.
3271
- * @param {Function} iteratee The function invoked per iteration.
3272
- * @param {*} accumulator The initial value.
3273
- * @param {boolean} initAccum Specify using the first or last element of
3274
- * `collection` as the initial value.
3275
- * @param {Function} eachFunc The function to iterate over `collection`.
3276
- * @returns {*} Returns the accumulated value.
3277
- */
3278
- function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
3279
- eachFunc(collection, function(value, index, collection) {
3280
- accumulator = initAccum
3281
- ? (initAccum = false, value)
3282
- : iteratee(accumulator, value, index, collection);
3283
- });
3284
- return accumulator;
3263
+ return high;
3264
+ }
3265
+ return baseSortedIndexBy(array, value, identity, retHighest);
3285
3266
  }
3286
3267
 
3287
3268
  /**
3288
- * Reduces `collection` to a value which is the accumulated result of running
3289
- * each element in `collection` thru `iteratee`, where each successive
3290
- * invocation is supplied the return value of the previous. If `accumulator`
3291
- * is not given, the first element of `collection` is used as the initial
3292
- * value. The iteratee is invoked with four arguments:
3293
- * (accumulator, value, index|key, collection).
3294
- *
3295
- * Many lodash methods are guarded to work as iteratees for methods like
3296
- * `_.reduce`, `_.reduceRight`, and `_.transform`.
3297
- *
3298
- * The guarded methods are:
3299
- * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
3300
- * 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.
3301
3271
  *
3302
3272
  * @static
3303
3273
  * @memberOf _
3304
3274
  * @since 0.1.0
3305
- * @category Collection
3306
- * @param {Array|Object} collection The collection to iterate over.
3307
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
3308
- * @param {*} [accumulator] The initial value.
3309
- * @returns {*} Returns the accumulated value.
3310
- * @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`.
3311
3280
  * @example
3312
3281
  *
3313
- * _.reduce([1, 2], function(sum, n) {
3314
- * return sum + n;
3315
- * }, 0);
3316
- * // => 3
3317
- *
3318
- * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
3319
- * (result[value] || (result[value] = [])).push(key);
3320
- * return result;
3321
- * }, {});
3322
- * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
3282
+ * _.sortedIndex([30, 50], 40);
3283
+ * // => 1
3323
3284
  */
3324
- function reduce(collection, iteratee, accumulator) {
3325
- var func = isArray$1(collection) ? arrayReduce : baseReduce,
3326
- initAccum = arguments.length < 3;
3327
-
3328
- return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
3285
+ function sortedIndex(array, value) {
3286
+ return baseSortedIndex(array, value);
3329
3287
  }
3330
3288
 
3331
3289
  /**
3332
- * Selection store
3290
+ * Pre-calculation
3291
+ * Dimension custom sizes for each cell
3292
+ * Keeps only changed sizes, skips origin size
3333
3293
  */
3334
- function defaultState() {
3335
- return {
3336
- range: null,
3337
- tempRange: null,
3338
- tempRangeType: null,
3339
- focus: null,
3340
- edit: null,
3341
- lastCell: null,
3342
- nextFocus: null,
3343
- };
3344
- }
3345
- class SelectionStore {
3346
- constructor() {
3347
- this.unsubscribe = [];
3348
- this.store = createStore(defaultState());
3349
- this.store.on('set', (key, newVal) => {
3350
- if (key === 'tempRange' && !newVal) {
3351
- this.store.set('tempRangeType', null);
3352
- }
3353
- });
3354
- }
3355
- onChange(propName, cb) {
3356
- this.unsubscribe.push(this.store.onChange(propName, cb));
3357
- }
3358
- clearFocus() {
3359
- setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
3360
- }
3361
- setFocus(focus, end) {
3362
- if (!end) {
3363
- 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;
3364
3311
  }
3365
3312
  else {
3366
- setStore(this.store, {
3367
- focus,
3368
- range: getRange(focus, end),
3369
- edit: null,
3370
- tempRange: null,
3371
- });
3372
- }
3373
- }
3374
- setNextFocus(focus) {
3375
- setStore(this.store, { nextFocus: focus });
3376
- }
3377
- setTempArea(range) {
3378
- 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 });
3379
- }
3380
- clearTemp() {
3381
- setStore(this.store, { tempRange: null });
3382
- }
3383
- /** Can be applied from selection change or from simple keyboard change clicks */
3384
- setRangeArea(range) {
3385
- setStore(this.store, { range, edit: null, tempRange: null });
3386
- }
3387
- setRange(start, end) {
3388
- const range = getRange(start, end);
3389
- this.setRangeArea(range);
3390
- }
3391
- setLastCell(lastCell) {
3392
- setStore(this.store, { lastCell });
3393
- }
3394
- setEdit(val) {
3395
- const focus = this.store.get('focus');
3396
- if (focus && typeof val === 'string') {
3397
- setStore(this.store, {
3398
- edit: { x: focus.x, y: focus.y, val },
3399
- });
3400
- return;
3313
+ newItem.start = itemIndex * originItemSize;
3401
3314
  }
3402
- setStore(this.store, { edit: null });
3403
- }
3404
- dispose() {
3405
- this.unsubscribe.forEach(f => f());
3406
- this.store.dispose();
3407
- }
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
+ };
3408
3326
  }
3409
-
3410
- const EMPTY_INDEX = -1;
3411
- class SelectionStoreConnector {
3412
- constructor() {
3413
- // dirty flag required to cleanup whole store in case visibility of panels changed
3414
- this.dirty = false;
3415
- this.stores = {};
3416
- this.columnStores = {};
3417
- this.rowStores = {};
3418
- /**
3419
- * Helpers for data conversion
3420
- */
3421
- this.storesByType = {};
3422
- this.storesXToType = {};
3423
- this.storesYToType = {};
3424
- this.sections = [];
3425
- }
3426
- get focusedStore() {
3427
- var _a;
3428
- for (let y in this.stores) {
3429
- for (let x in this.stores[y]) {
3430
- const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
3431
- if (focused) {
3432
- return {
3433
- entity: this.stores[y][x],
3434
- cell: focused,
3435
- position: {
3436
- x: parseInt(x, 10),
3437
- y: parseInt(y, 10),
3438
- },
3439
- };
3440
- }
3441
- }
3442
- }
3443
- return null;
3444
- }
3445
- get edit() {
3446
- var _a;
3447
- return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
3448
- }
3449
- get focused() {
3450
- var _a;
3451
- return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
3452
- }
3453
- get selectedRange() {
3454
- var _a;
3455
- return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
3456
- }
3457
- registerSection(e) {
3458
- if (!e) {
3459
- this.sections.length = 0;
3460
- // some elements removed, rebuild stores
3461
- this.dirty = true;
3462
- return;
3463
- }
3464
- if (this.sections.indexOf(e) === -1) {
3465
- this.sections.push(e);
3466
- }
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);
3467
3498
  }
3468
- // check if require to cleanup all stores
3469
- beforeUpdate() {
3470
- if (this.dirty) {
3471
- for (let y in this.stores) {
3472
- for (let x in this.stores[y]) {
3473
- this.stores[y][x].dispose();
3474
- }
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;
3475
3511
  }
3476
- this.dirty = false;
3477
- }
3478
- }
3479
- registerColumn(x, type) {
3480
- // if hidden just create store but no operations needed
3481
- if (isHiddenStore(x)) {
3482
- return new SelectionStore();
3483
- }
3484
- if (this.columnStores[x]) {
3485
- return this.columnStores[x];
3486
- }
3487
- this.columnStores[x] = new SelectionStore();
3488
- // build cross-linking type to position
3489
- this.storesByType[type] = x;
3490
- this.storesXToType[x] = type;
3491
- return this.columnStores[x];
3492
- }
3493
- registerRow(y, type) {
3494
- // if hidden just create store
3495
- if (isHiddenStore(y)) {
3496
- return new SelectionStore();
3497
- }
3498
- if (this.rowStores[y]) {
3499
- return this.rowStores[y];
3500
- }
3501
- this.rowStores[y] = new SelectionStore();
3502
- // build cross linking type to position
3503
- this.storesByType[type] = y;
3504
- this.storesYToType[y] = type;
3505
- return this.rowStores[y];
3506
- }
3507
- /**
3508
- * Cross store proxy, based on multiple dimensions
3509
- */
3510
- register({ x, y }) {
3511
- var _a, _b;
3512
- // if hidden just create store
3513
- if (isHiddenStore(x) || isHiddenStore(y)) {
3514
- return new SelectionStore();
3515
- }
3516
- if (!this.stores[y]) {
3517
- this.stores[y] = {};
3518
- }
3519
- if (this.stores[y][x]) {
3520
- // Store already registered. Do not register twice
3521
- return this.stores[y][x];
3522
- }
3523
- this.stores[y][x] = new SelectionStore();
3524
- // proxy update, column store trigger only range area
3525
- (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
3526
- this.columnStores[x].setRangeArea(c);
3527
- this.rowStores[y].setRangeArea(c);
3528
- });
3529
- // clean up on remove
3530
- (_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
3531
- return this.stores[y][x];
3532
- }
3533
- destroy(x, y) {
3534
- var _a, _b;
3535
- (_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
3536
- (_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
3537
- delete this.rowStores[y];
3538
- delete this.columnStores[x];
3539
- // clear x cross-link
3540
- if (this.storesXToType[x]) {
3541
- const type = this.storesXToType[x];
3542
- delete this.storesXToType[x];
3543
- delete this.storesByType[type];
3544
- }
3545
- // clear y cross-link
3546
- if (this.storesYToType[y]) {
3547
- const type = this.storesYToType[y];
3548
- delete this.storesYToType[y];
3549
- delete this.storesByType[type];
3550
- }
3551
- if (this.stores[y]) {
3552
- delete this.stores[y][x];
3553
- }
3554
- // clear empty rows
3555
- if (!Object.keys(this.stores[y] || {}).length) {
3556
- delete this.stores[y];
3557
- }
3558
- }
3559
- setEditByCell(storePos, editCell) {
3560
- this.focusByCell(storePos, editCell, editCell);
3561
- this.setEdit('');
3562
- }
3563
- /**
3564
- * Sets the next focus cell before the current one.
3565
- *
3566
- * @param focus - The cell to set as the next focus.
3567
- */
3568
- beforeNextFocusCell(focus) {
3569
- var _a;
3570
- // If there is no focused store, return early.
3571
- if (!this.focusedStore) {
3572
- return;
3573
- }
3574
- // Get the next store based on the current focus and the last cell.
3575
- const lastCell = this.focusedStore.entity.store.get('lastCell');
3576
- const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
3577
- // Set the next focus cell in the store.
3578
- (_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));
3579
- }
3580
- focusByCell(storePos, start, end) {
3581
- const store = this.stores[storePos.y][storePos.x];
3582
- this.focus(store, { focus: start, end });
3583
- }
3584
- focus(store, { focus, end }) {
3585
- const currentStorePointer = this.getCurrentStorePointer(store);
3586
- if (!currentStorePointer) {
3587
- return null;
3588
- }
3589
- // check for the focus in nearby store/viewport
3590
- const lastCell = store.store.get('lastCell');
3591
- const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
3592
- // if next store present - update
3593
- if (next === null || next === void 0 ? void 0 : next.store) {
3594
- const item = Object.assign(Object.assign({}, focus), next.item);
3595
- this.focus(next.store, { focus: item, end: item });
3596
- return null;
3597
- }
3598
- if (lastCell) {
3599
- focus = cropCellToMax(focus, lastCell);
3600
- end = cropCellToMax(end, lastCell);
3601
- }
3602
- store.setFocus(focus, end);
3603
- return focus;
3604
- }
3605
- /**
3606
- * Retrieves the current store pointer based on the active store.
3607
- * Clears focus from all stores except the active one.
3608
- */
3609
- getCurrentStorePointer(store) {
3610
- let currentStorePointer;
3611
- // Iterate through all stores
3612
- for (let y in this.stores) {
3613
- for (let x in this.stores[y]) {
3614
- const s = this.stores[y][x];
3615
- // Clear focus from stores other than the active one
3616
- if (s !== store) {
3617
- s.clearFocus();
3618
- }
3619
- else {
3620
- // Update the current store pointer with the active store coordinates
3621
- currentStorePointer = {
3622
- x: parseInt(x, 10),
3623
- y: parseInt(y, 10)
3624
- };
3625
- }
3512
+ else if (cmp < 0) {
3513
+ n = k - 1;
3626
3514
  }
3627
- }
3628
- return currentStorePointer;
3629
- }
3630
- /**
3631
- * Retrieves the next store based on the focus cell and current store pointer.
3632
- * If the next store exists, returns an object with the next store and the item in the new store.
3633
- * If the next store does not exist, returns null.
3634
- */
3635
- getNextStore(focus, currentStorePointer, lastCell) {
3636
- // item in new store
3637
- const nextItem = nextCell(focus, lastCell);
3638
- let nextStore;
3639
- if (nextItem) {
3640
- Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
3641
- let stores;
3642
- switch (type) {
3643
- case 'x':
3644
- // Get the X stores for the current Y coordinate of the current store pointer
3645
- stores = this.getXStores(currentStorePointer.y);
3646
- break;
3647
- case 'y':
3648
- // Get the Y stores for the current X coordinate of the current store pointer
3649
- stores = this.getYStores(currentStorePointer.x);
3650
- break;
3651
- }
3652
- // Get the next store based on the item in the new store
3653
- if (nextItemCoord >= 0) {
3654
- nextStore = stores[++currentStorePointer[type]];
3655
- }
3656
- else {
3657
- nextStore = stores[--currentStorePointer[type]];
3658
- const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
3659
- if (nextLastCell) {
3660
- nextItem[type] = nextLastCell[type] + nextItemCoord;
3661
- }
3662
- }
3663
- });
3664
- }
3665
- return {
3666
- store: nextStore,
3667
- item: nextItem,
3668
- };
3669
- }
3670
- clearAll() {
3671
- var _a;
3672
- for (let y in this.stores) {
3673
- for (let x in this.stores[y]) {
3674
- (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
3675
- }
3676
- }
3677
- }
3678
- setEdit(val) {
3679
- if (!this.focusedStore) {
3680
- return;
3681
- }
3682
- this.focusedStore.entity.setEdit(val);
3683
- }
3684
- /**
3685
- * Select all cells across all stores
3686
- */
3687
- selectAll() {
3688
- for (let y in this.stores) {
3689
- for (let x in this.stores[y]) {
3690
- const store = this.stores[y][x];
3691
- if (!store) {
3692
- continue;
3693
- }
3694
- const lastCell = store.store.get('lastCell');
3695
- if (lastCell) {
3696
- store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
3697
- }
3515
+ else {
3516
+ return k;
3698
3517
  }
3699
3518
  }
3700
- }
3701
- getXStores(y) {
3702
- return this.stores[y];
3703
- }
3704
- getYStores(x) {
3705
- const stores = {};
3706
- for (let i in this.stores) {
3707
- stores[i] = this.stores[i][x];
3708
- }
3709
- return stores;
3710
- }
3711
- }
3712
-
3713
- function isHiddenStore(pos) {
3714
- return pos === EMPTY_INDEX;
3715
- }
3716
- function nextCell(cell, lastCell) {
3717
- const nextItem = {};
3718
- let types = ['x', 'y'];
3719
- // previous item check
3720
- for (let t of types) {
3721
- if (cell[t] < 0) {
3722
- nextItem[t] = cell[t];
3723
- return nextItem;
3724
- }
3725
- }
3726
- // next item check
3727
- for (let t of types) {
3728
- if (cell[t] >= lastCell[t]) {
3729
- nextItem[t] = cell[t] - lastCell[t];
3730
- return nextItem;
3731
- }
3732
- }
3733
- return null;
3734
- }
3735
- function cropCellToMax(cell, lastCell) {
3736
- const croppedCell = Object.assign({}, cell);
3737
- const cellCoordinates = ['x', 'y'];
3738
- for (const coordinate of cellCoordinates) {
3739
- if (cell[coordinate] < 0) {
3740
- croppedCell[coordinate] = 0;
3741
- }
3742
- else if (cell[coordinate] >= lastCell[coordinate]) {
3743
- croppedCell[coordinate] = lastCell[coordinate] - 1;
3744
- }
3745
- }
3746
- return croppedCell;
3747
- }
3748
- function getRange(start, end) {
3749
- return start && end
3750
- ? {
3751
- x: Math.min(start.x, end.x),
3752
- y: Math.min(start.y, end.y),
3753
- x1: Math.max(start.x, end.x),
3754
- y1: Math.max(start.y, end.y),
3755
- }
3756
- : null;
3757
- }
3758
- function isRangeSingleCell(a) {
3759
- return a.x === a.x1 && a.y === a.y1;
3760
- }
3761
-
3762
- function getCellData(val) {
3763
- if (typeof val === 'undefined' || val === null) {
3764
- return '';
3765
- }
3766
- return val;
3767
- }
3768
- function getCellDataParsed(model, column) {
3769
- const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
3770
- return getCellData(val);
3519
+ return -m - 1;
3520
+ })(this);
3771
3521
  }
3772
3522
  /**
3773
- * Get column type from column data
3523
+ * Sorted push
3774
3524
  */
3775
- function getColumnType(rgCol) {
3776
- if (rgCol.pin) {
3777
- return rgCol.pin;
3778
- }
3779
- return 'rgCol';
3525
+ function pushSorted(arr, el, fn) {
3526
+ arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
3527
+ return arr;
3780
3528
  }
3781
- function getColumnSizes(cols) {
3782
- const res = {};
3783
- for (const [i, c] of cols.entries()) {
3784
- if (c.size) {
3785
- res[i] = c.size;
3786
- }
3787
- }
3788
- return res;
3529
+ // (arr1[index1] < arr2[index2])
3530
+ function simpleCompare(el1, el2) {
3531
+ return el1 < el2;
3789
3532
  }
3790
3533
  /**
3791
- * Check if column is grouping column
3534
+ * Merge sorted array helper function
3792
3535
  */
3793
- function isColGrouping(colData) {
3794
- return !!colData.children;
3795
- }
3796
- /**
3797
- * This function is used to create a collection of columns.
3798
- */
3799
- function getColumns(columns, level = 0, types) {
3800
- const collection = {
3801
- // columns as they are in stores per type
3802
- columns: {
3803
- rgCol: [],
3804
- colPinStart: [],
3805
- colPinEnd: [],
3806
- },
3807
- // columns indexed by prop for quick access
3808
- columnByProp: {},
3809
- // column grouping
3810
- columnGrouping: {
3811
- rgCol: [],
3812
- colPinStart: [],
3813
- colPinEnd: [],
3814
- },
3815
- // max depth level for column grouping
3816
- maxLevel: level,
3817
- // sorting
3818
- sort: {},
3819
- };
3820
- return reduce(columns, (res, colData) => {
3821
- // Grouped column
3822
- if (isColGrouping(colData)) {
3823
- return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
3824
- }
3825
- // Column type
3826
- const columnDefinitionFromType = colData.columnType && (types === null || types === void 0 ? void 0 : types[colData.columnType]);
3827
- // Regular column
3828
- const regularColumn = Object.assign(Object.assign({}, columnDefinitionFromType), colData);
3829
- // Regular column, no Pin
3830
- if (!regularColumn.pin) {
3831
- res.columns.rgCol.push(regularColumn);
3832
- // 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++;
3833
3547
  }
3834
3548
  else {
3835
- res.columns[regularColumn.pin].push(regularColumn);
3836
- }
3837
- if (regularColumn.order) {
3838
- res.sort[regularColumn.prop] = regularColumn;
3839
- }
3840
- // it's possible that some columns have same prop, but better to avoid it
3841
- if (!res.columnByProp[regularColumn.prop]) {
3842
- res.columnByProp[regularColumn.prop] = [];
3843
- }
3844
- res.columnByProp[regularColumn.prop].push(regularColumn);
3845
- // trigger setup hook if present
3846
- regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
3847
- return res;
3848
- }, collection);
3849
- }
3850
- function gatherGroup(res, colData, collection, level = 0) {
3851
- // group template
3852
- const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
3853
- // check columns for update
3854
- for (let k in collection.columns) {
3855
- const key = k;
3856
- const resultItem = res.columns[key];
3857
- const collectionItem = collection.columns[key];
3858
- // if column data
3859
- if (isArray$1(resultItem) && isArray$1(collectionItem)) {
3860
- // fill columns
3861
- resultItem.push(...collectionItem);
3862
- // fill grouping
3863
- if (collectionItem.length) {
3864
- res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
3865
- }
3549
+ merged[current] = arr2[index2];
3550
+ index2++;
3866
3551
  }
3552
+ current++;
3867
3553
  }
3868
- // merge column groupings
3869
- for (let k in collection.columnGrouping) {
3870
- const key = k;
3871
- const collectionItem = collection.columnGrouping[key];
3872
- res.columnGrouping[key].push(...collectionItem);
3873
- }
3874
- res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
3875
- res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
3876
- return res;
3877
- }
3878
- function findColumn(columns, prop) {
3879
- for (const c of columns) {
3880
- if (isColGrouping(c)) {
3881
- const found = findColumn(c.children, prop);
3882
- if (found) {
3883
- return found;
3884
- }
3885
- }
3886
- else if (c.prop === prop) {
3887
- return c;
3888
- }
3889
- }
3890
- return undefined;
3891
- }
3892
- function getColumnByProp(columns, prop) {
3893
- return findColumn(columns, prop);
3894
- }
3895
-
3896
- const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
3897
- const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
3898
- const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
3899
- const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
3900
- const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
3901
- const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
3902
- const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
3903
- const GROUP_EXPAND_BTN = `group-expand`;
3904
- const GROUP_EXPAND_EVENT = `groupexpandclick`;
3905
- const GROUPING_ROW_TYPE = 'rgRow';
3906
-
3907
- function getGroupValueDefault(item, prop) {
3908
- return item[prop] || null;
3554
+ return merged;
3909
3555
  }
3910
3556
  /**
3911
- * Gather data for grouping
3912
- * @param array - flat data array
3913
- * @param groupIds - ids of groups
3914
- * @param expanded - potentially expanded items if present
3915
- */
3916
- function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
3917
- const groupedItems = new Map();
3918
- array.forEach((item, originalIndex) => {
3919
- const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
3920
- const lastLevelValue = groupLevelValues.pop();
3921
- let currentGroupLevel = groupedItems;
3922
- groupLevelValues.forEach(value => {
3923
- if (!currentGroupLevel.has(value)) {
3924
- currentGroupLevel.set(value, new Map());
3925
- }
3926
- currentGroupLevel = currentGroupLevel.get(value);
3927
- });
3928
- if (!currentGroupLevel.has(lastLevelValue)) {
3929
- currentGroupLevel.set(lastLevelValue, []);
3930
- }
3931
- const lastLevelItems = currentGroupLevel.get(lastLevelValue);
3932
- lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
3933
- });
3934
- let itemIndex = -1;
3935
- const groupingDepth = groupIds.length;
3936
- // collapse all groups in the beginning
3937
- const trimmed = {};
3938
- // index mapping
3939
- const oldNewIndexMap = {};
3940
- // check if group header exists
3941
- const pseudoGroupTest = {};
3942
- const sourceWithGroups = [];
3943
- function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
3944
- const depth = parentIds.length;
3945
- groupedValues.forEach((innerGroupedValues, groupId) => {
3946
- const levelIds = [...parentIds, groupId];
3947
- const mergedIds = levelIds.join(',');
3948
- const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
3949
- sourceWithGroups.push({
3950
- [PSEUDO_GROUP_ITEM]: groupId,
3951
- [GROUP_DEPTH]: depth,
3952
- [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
3953
- [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
3954
- [GROUP_EXPANDED]: isGroupExpanded,
3955
- });
3956
- itemIndex += 1;
3957
- if (!isGroupExpanded && depth) {
3958
- trimmed[itemIndex] = true;
3959
- }
3960
- if (Array.isArray(innerGroupedValues)) {
3961
- innerGroupedValues.forEach(value => {
3962
- itemIndex += 1;
3963
- if (!isGroupExpanded) {
3964
- trimmed[itemIndex] = true;
3965
- }
3966
- oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
3967
- const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
3968
- pseudoGroupTestIds.forEach(pseudoGroupTestId => {
3969
- if (!pseudoGroupTest[pseudoGroupTestId]) {
3970
- pseudoGroupTest[pseudoGroupTestId] = [];
3971
- }
3972
- pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
3973
- });
3974
- });
3975
- sourceWithGroups.push(...innerGroupedValues);
3976
- }
3977
- else {
3978
- flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
3979
- }
3980
- });
3981
- }
3982
- flattenGroupMaps(groupedItems, [], true);
3983
- return {
3984
- sourceWithGroups, // updates source mirror
3985
- depth: groupingDepth, // largest depth for grouping
3986
- trimmed, // used for expand/collapse grouping values
3987
- oldNewIndexMap, // used for mapping old values to new
3988
- childrenByGroup: pseudoGroupTest, // used to get child items in group
3989
- };
3990
- }
3991
- function getGroupingName(rgRow) {
3992
- return rgRow && rgRow[PSEUDO_GROUP_ITEM];
3993
- }
3994
- function isGrouping(rgRow) {
3995
- return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
3996
- }
3997
- function isGroupingColumn(column) {
3998
- return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
3999
- }
4000
- function measureEqualDepth(groupA, groupB) {
4001
- const ln = groupA.length;
4002
- let i = 0;
4003
- for (; i < ln; i++) {
4004
- if (groupA[i] !== groupB[i]) {
4005
- return i;
4006
- }
4007
- }
4008
- return i;
4009
- }
4010
- function getParsedGroup(id) {
4011
- const parseGroup = JSON.parse(id);
4012
- // extra precaution and type safeguard
4013
- if (!Array.isArray(parseGroup)) {
4014
- return null;
4015
- }
4016
- return parseGroup;
4017
- }
4018
- // check if items is child of current clicked group
4019
- function isSameGroup(currentGroup, currentModel, nextModel) {
4020
- const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
4021
- if (!nextGroup) {
4022
- return false;
4023
- }
4024
- const depth = measureEqualDepth(currentGroup, nextGroup);
4025
- return currentModel[GROUP_DEPTH] < depth;
4026
- }
4027
-
4028
- /**
4029
- * The base implementation of `_.slice` without an iteratee call guard.
4030
- *
4031
- * @private
4032
- * @param {Array} array The array to slice.
4033
- * @param {number} [start=0] The start position.
4034
- * @param {number} [end=array.length] The end position.
4035
- * @returns {Array} Returns the slice of `array`.
3557
+ * Calculate system scrollbar size
4036
3558
  */
4037
- function baseSlice(array, start, end) {
4038
- var index = -1,
4039
- length = array.length;
4040
-
4041
- if (start < 0) {
4042
- start = -start > length ? 0 : (length + start);
4043
- }
4044
- end = end > length ? length : end;
4045
- if (end < 0) {
4046
- end += length;
4047
- }
4048
- length = start > end ? 0 : ((end - start) >>> 0);
4049
- start >>>= 0;
4050
-
4051
- var result = Array(length);
4052
- while (++index < length) {
4053
- result[index] = array[index + start];
4054
- }
4055
- 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;
4056
3577
  }
4057
-
4058
- /**
4059
- * Creates a slice of `array` from `start` up to, but not including, `end`.
3578
+ /* Scale a value between 2 ranges
4060
3579
  *
4061
- * **Note:** This method is used instead of
4062
- * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
4063
- * 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]);
4064
3583
  *
4065
- * @static
4066
- * @memberOf _
4067
- * @since 3.0.0
4068
- * @category Array
4069
- * @param {Array} array The array to slice.
4070
- * @param {number} [start=0] The start position.
4071
- * @param {number} [end=array.length] The end position.
4072
- * @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.
4073
3589
  */
4074
- function slice(array, start, end) {
4075
- var length = array == null ? 0 : array.length;
4076
- if (!length) {
4077
- return [];
4078
- }
4079
- if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
4080
- start = 0;
4081
- end = length;
4082
- }
4083
- else {
4084
- start = start == null ? 0 : toInteger(start);
4085
- end = end === undefined ? length : toInteger(end);
4086
- }
4087
- return baseSlice(array, start, end);
4088
- }
4089
-
4090
- class ColumnService {
4091
- get columns() {
4092
- return getVisibleSourceItem(this.source);
4093
- }
4094
- constructor(dataStore, source) {
4095
- this.dataStore = dataStore;
4096
- this.source = source;
4097
- this.unsubscribe = [];
4098
- this.hasGrouping = false;
4099
- this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
4100
- this.checkGrouping(source.get('source'));
4101
- this.type = source.get('type');
4102
- }
4103
- checkGrouping(cols) {
4104
- for (let rgCol of cols) {
4105
- if (isGroupingColumn(rgCol)) {
4106
- this.hasGrouping = true;
4107
- return;
4108
- }
4109
- this.hasGrouping = false;
4110
- }
4111
- }
4112
- isReadOnly(r, c) {
4113
- var _a;
4114
- const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
4115
- if (typeof readOnly === 'function') {
4116
- const data = this.rowDataModel(r, c);
4117
- return readOnly(data);
4118
- }
4119
- return !!readOnly;
4120
- }
4121
- mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
4122
- const props = Object.assign({}, defaultProps);
4123
- props.class = Object.assign(Object.assign({}, (typeof props.class === 'string'
4124
- ? { [props.class]: true }
4125
- : props.class)), { [CELL_CLASS]: true, [DISABLED_CLASS]: this.isReadOnly(r, c) });
4126
- const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
4127
- if (!extra) {
4128
- return props;
4129
- }
4130
- return doPropMerge(props, extra);
4131
- }
4132
- getRowClass(r, prop) {
4133
- const model = getSourceItem(this.dataStore, r) || {};
4134
- return model[prop] || '';
4135
- }
4136
- getCellData(r, c) {
4137
- const data = this.rowDataModel(r, c);
4138
- return getCellData(data.model[data.prop]);
4139
- }
4140
- getSaveData(rowIndex, colIndex, val) {
4141
- const data = this.rowDataModel(rowIndex, colIndex);
4142
- if (typeof val === 'undefined') {
4143
- val = getCellData(data.model[data.prop]);
4144
- }
4145
- return {
4146
- prop: data.prop,
4147
- rowIndex,
4148
- colIndex,
4149
- val,
4150
- model: data.model,
4151
- colType: this.type,
4152
- type: this.dataStore.get('type'),
4153
- };
4154
- }
4155
- getCellEditor(_r, c, editors) {
4156
- var _a;
4157
- const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
4158
- if (!editor) {
4159
- return undefined;
4160
- }
4161
- // reference
4162
- if (typeof editor === 'string') {
4163
- return editors[editor];
4164
- }
4165
- return editor;
4166
- }
4167
- /**
4168
- * Get cell data model for given rowIndex and colIndex
4169
- * Used to pass data to editor/renderer
4170
- */
4171
- rowDataModel(rowIndex, colIndex) {
4172
- const column = this.columns[colIndex];
4173
- const prop = column === null || column === void 0 ? void 0 : column.prop;
4174
- const model = getSourceItem(this.dataStore, rowIndex) || {};
4175
- const value = model[prop];
4176
- const type = this.dataStore.get('type');
4177
- return {
4178
- prop,
4179
- model,
4180
- data: this.dataStore.get('source'),
4181
- column,
4182
- rowIndex,
4183
- colIndex,
4184
- colType: this.type,
4185
- type,
4186
- value,
4187
- };
4188
- }
4189
- getRangeData(d, columns) {
4190
- var _a;
4191
- const changed = {};
4192
- // get original length sizes
4193
- const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
4194
- const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
4195
- const mapping = {};
4196
- // rows
4197
- for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
4198
- // copy original data link
4199
- const oldRowIndex = d.oldRange.y + (i % copyRowLength);
4200
- const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
4201
- // columns
4202
- for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
4203
- // check if old range area
4204
- if (rowIndex >= d.oldRange.y &&
4205
- rowIndex <= d.oldRange.y1 &&
4206
- colIndex >= d.oldRange.x &&
4207
- colIndex <= d.oldRange.x1) {
4208
- continue;
4209
- }
4210
- // requested column beyond range
4211
- if (!this.columns[colIndex]) {
4212
- continue;
4213
- }
4214
- const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
4215
- const copyColIndex = d.oldRange.x + (j % copyColLength);
4216
- const copyColumnProp = columns[copyColIndex].prop;
4217
- /** if can write */
4218
- if (!this.isReadOnly(rowIndex, colIndex)) {
4219
- /** to show before save */
4220
- if (!changed[rowIndex]) {
4221
- changed[rowIndex] = {};
4222
- }
4223
- changed[rowIndex][prop] = copyRow[copyColumnProp];
4224
- /** Generate mapping object */
4225
- if (!mapping[rowIndex]) {
4226
- mapping[rowIndex] = {};
4227
- }
4228
- mapping[rowIndex][prop] = {
4229
- colIndex: copyColIndex,
4230
- colProp: copyColumnProp,
4231
- rowIndex: oldRowIndex,
4232
- };
4233
- }
4234
- }
4235
- }
4236
- return {
4237
- changed,
4238
- mapping,
4239
- };
4240
- }
4241
- getTransformedDataToApply(start, data) {
4242
- const changed = {};
4243
- const copyRowLength = data.length;
4244
- const colLength = this.columns.length;
4245
- const rowLength = this.dataStore.get('items').length;
4246
- // rows
4247
- let rowIndex = start.y;
4248
- let maxCol = 0;
4249
- for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
4250
- // copy original data link
4251
- const copyRow = data[i % copyRowLength];
4252
- const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
4253
- // columns
4254
- let colIndex = start.x;
4255
- for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
4256
- const p = this.columns[colIndex].prop;
4257
- const currentCol = j % colLength;
4258
- /** if can write */
4259
- if (!this.isReadOnly(rowIndex, colIndex)) {
4260
- /** to show before save */
4261
- if (!changed[rowIndex]) {
4262
- changed[rowIndex] = {};
4263
- }
4264
- changed[rowIndex][p] = copyRow[currentCol];
4265
- }
4266
- }
4267
- maxCol = Math.max(maxCol, colIndex - 1);
4268
- }
4269
- const range = getRange(start, {
4270
- y: rowIndex - 1,
4271
- x: maxCol,
4272
- });
4273
- return {
4274
- changed,
4275
- range,
4276
- };
4277
- }
4278
- getRangeStaticData(d, value) {
4279
- const changed = {};
4280
- // rows
4281
- for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
4282
- // columns
4283
- for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
4284
- // requested column beyond range
4285
- if (!this.columns[colIndex]) {
4286
- continue;
4287
- }
4288
- const p = this.columns[colIndex].prop;
4289
- /** if can write */
4290
- if (!this.isReadOnly(rowIndex, colIndex)) {
4291
- /** to show before save */
4292
- if (!changed[rowIndex]) {
4293
- changed[rowIndex] = {};
4294
- }
4295
- changed[rowIndex][p] = value;
4296
- }
4297
- }
4298
- }
4299
- return changed;
4300
- }
4301
- getRangeTransformedToProps(d, store) {
4302
- var _a;
4303
- const area = [];
4304
- const type = this.dataStore.get('type');
4305
- // rows
4306
- for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
4307
- // columns
4308
- for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
4309
- const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
4310
- area.push({
4311
- prop,
4312
- rowIndex,
4313
- colIndex,
4314
- model: getSourceItem(store, rowIndex),
4315
- type,
4316
- colType: this.type,
4317
- });
4318
- }
4319
- }
4320
- return area;
4321
- }
4322
- copyRangeArray(range, store) {
4323
- const cols = [...this.columns];
4324
- const props = slice(cols, range.x, range.x1 + 1).map(v => v.prop);
4325
- const toCopy = [];
4326
- const mapping = {};
4327
- // rows indexes
4328
- for (let i = range.y; i <= range.y1; i++) {
4329
- const rgRow = [];
4330
- mapping[i] = {};
4331
- // columns indexes
4332
- for (let prop of props) {
4333
- const item = getSourceItem(store, i);
4334
- // if no item - skip
4335
- if (!item) {
4336
- continue;
4337
- }
4338
- const val = item[prop];
4339
- rgRow.push(val);
4340
- mapping[i][prop] = val;
4341
- }
4342
- toCopy.push(rgRow);
4343
- }
4344
- return {
4345
- data: toCopy,
4346
- mapping,
4347
- };
4348
- }
4349
- destroy() {
4350
- this.unsubscribe.forEach(f => f());
4351
- }
3590
+ function scaleValue(value, from, to) {
3591
+ return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
4352
3592
  }
4353
3593
  /**
4354
- * Checks if the given rowDrag is a service for dragging rows.
3594
+ * Async timeout
4355
3595
  */
4356
- function isRowDragService(rowDrag, model) {
4357
- if (typeof rowDrag === 'function') {
4358
- return rowDrag(model);
4359
- }
4360
- return !!rowDrag;
4361
- }
4362
- function mergeClasses(class1 = {}, class2 = {}) {
4363
- if (typeof class1 === 'string') {
4364
- class1 = { [class1]: true };
4365
- }
4366
- if (typeof class2 === 'string') {
4367
- class2 = { [class2]: true };
4368
- }
4369
- return Object.assign(Object.assign({}, class1), class2);
3596
+ async function timeout(delay = 0) {
3597
+ await new Promise((r) => {
3598
+ setTimeout(() => r(), delay);
3599
+ });
4370
3600
  }
4371
- function doPropMerge(existing, extra) {
4372
- // if className is provided - remove it from props it messing with stencil
4373
- if (extra.className) {
4374
- extra.class = mergeClasses(extra.class, extra.className);
4375
- delete extra.className;
4376
- }
4377
- let props = Object.assign(Object.assign({}, extra), existing);
4378
- // extend existing props
4379
- if (extra.class) {
4380
- props.class = mergeClasses(props.class, extra.class);
4381
- }
4382
- if (extra.style) {
4383
- props.style = Object.assign(Object.assign({}, extra.style), props.style);
4384
- }
4385
- 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
+ });
4386
3610
  }
4387
3611
 
4388
- 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 };
4389
3613
 
4390
- //# sourceMappingURL=column.service-aa142672.js.map
3614
+ //# sourceMappingURL=index-b1e05212.js.map