@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.
- package/dist/cjs/{column.drag.plugin-7098477f.js → column.drag.plugin-08ca04f4.js} +18 -18
- package/dist/cjs/column.drag.plugin-08ca04f4.js.map +1 -0
- package/dist/cjs/column.service-2670e6e7.js +1286 -0
- package/dist/cjs/column.service-2670e6e7.js.map +1 -0
- package/dist/cjs/{edit.utils-75fa1cab.js → edit.utils-4a790cf8.js} +2 -2
- package/dist/cjs/{edit.utils-75fa1cab.js.map → edit.utils-4a790cf8.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-aaaad4c8.js → header-cell-renderer-db089f54.js} +2 -2
- package/dist/cjs/{header-cell-renderer-aaaad4c8.js.map → header-cell-renderer-db089f54.js.map} +1 -1
- package/dist/cjs/{column.service-f1d5d924.js → index-91e92bea.js} +452 -1227
- package/dist/cjs/index-91e92bea.js.map +1 -0
- package/dist/cjs/index.cjs.js +20 -20
- package/dist/cjs/{key.utils-8f1105f3.js → key.utils-e65c24e6.js} +2 -2
- package/dist/cjs/{key.utils-8f1105f3.js.map → key.utils-e65c24e6.js.map} +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +26 -26
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +11 -11
- package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +5 -4
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +9 -9
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/{row-header-utils-208e4026.js → row-header-utils-dc3d3185.js} +5 -6
- package/dist/cjs/row-header-utils-dc3d3185.js.map +1 -0
- package/dist/cjs/{text-editor-b64a080e.js → text-editor-a32a3993.js} +3 -3
- package/dist/cjs/{text-editor-b64a080e.js.map → text-editor-a32a3993.js.map} +1 -1
- package/dist/cjs/{throttle-3b362440.js → throttle-da92b75d.js} +2 -2
- package/dist/cjs/{throttle-3b362440.js.map → throttle-da92b75d.js.map} +1 -1
- package/dist/collection/components/order/revogr-order-editor.js +4 -2
- package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/esm/{column.drag.plugin-813698d2.js → column.drag.plugin-b7bba0da.js} +6 -6
- package/dist/esm/{column.drag.plugin-813698d2.js.map → column.drag.plugin-b7bba0da.js.map} +1 -1
- package/dist/esm/column.service-9b0603f4.js +1249 -0
- package/dist/esm/column.service-9b0603f4.js.map +1 -0
- package/dist/esm/{debounce-72878ced.js → debounce-7b511afc.js} +2 -2
- package/dist/esm/{debounce-72878ced.js.map → debounce-7b511afc.js.map} +1 -1
- package/dist/esm/{edit.utils-cd6a3224.js → edit.utils-abcd0152.js} +2 -2
- package/dist/esm/{edit.utils-cd6a3224.js.map → edit.utils-abcd0152.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-5939221a.js → header-cell-renderer-fce020c3.js} +2 -2
- package/dist/esm/{header-cell-renderer-5939221a.js.map → header-cell-renderer-fce020c3.js.map} +1 -1
- package/dist/esm/{column.service-aa142672.js → index-b1e05212.js} +411 -1187
- package/dist/esm/index-b1e05212.js.map +1 -0
- package/dist/esm/index.js +8 -8
- package/dist/esm/{key.utils-5ff2ec82.js → key.utils-ea9aec31.js} +2 -2
- package/dist/esm/{key.utils-5ff2ec82.js.map → key.utils-ea9aec31.js.map} +1 -1
- package/dist/esm/revo-grid.entry.js +6 -6
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +7 -7
- package/dist/esm/revogr-clipboard_3.entry.js +6 -5
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +5 -5
- package/dist/esm/revogr-filter-panel.entry.js +1 -1
- package/dist/esm/{row-header-utils-5511678e.js → row-header-utils-7af8fcbf.js} +2 -3
- package/dist/esm/row-header-utils-7af8fcbf.js.map +1 -0
- package/dist/esm/{text-editor-81767dcb.js → text-editor-fb3f24fe.js} +3 -3
- package/dist/esm/{text-editor-81767dcb.js.map → text-editor-fb3f24fe.js.map} +1 -1
- package/dist/esm/{throttle-4eff5b3c.js → throttle-1f5772ef.js} +3 -3
- package/dist/esm/{throttle-4eff5b3c.js.map → throttle-1f5772ef.js.map} +1 -1
- package/dist/revo-grid/column.drag.plugin-b7bba0da.js +5 -0
- package/dist/revo-grid/{column.drag.plugin-813698d2.js.map → column.drag.plugin-b7bba0da.js.map} +1 -1
- package/dist/revo-grid/column.service-9b0603f4.js +5 -0
- package/dist/revo-grid/column.service-9b0603f4.js.map +1 -0
- package/dist/revo-grid/{debounce-72878ced.js → debounce-7b511afc.js} +2 -2
- package/dist/revo-grid/{edit.utils-cd6a3224.js → edit.utils-abcd0152.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-5939221a.js → header-cell-renderer-fce020c3.js} +2 -2
- package/dist/revo-grid/index-b1e05212.js +5 -0
- package/dist/revo-grid/index-b1e05212.js.map +1 -0
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/key.utils-ea9aec31.js +5 -0
- package/dist/revo-grid/{key.utils-5ff2ec82.js.map → key.utils-ea9aec31.js.map} +1 -1
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/row-header-utils-7af8fcbf.js +5 -0
- package/dist/revo-grid/{row-header-utils-5511678e.js.map → row-header-utils-7af8fcbf.js.map} +1 -1
- package/dist/revo-grid/text-editor-fb3f24fe.js +5 -0
- package/dist/revo-grid/{throttle-4eff5b3c.js → throttle-1f5772ef.js} +2 -2
- package/dist/types/components/order/revogr-order-editor.d.ts +1 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +1 -5
- package/dist/types/components.d.ts +2 -0
- package/hydrate/index.js +24 -23
- package/hydrate/index.mjs +24 -23
- package/package.json +1 -1
- package/readme.md +10 -12
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +21 -2
- package/standalone/data.store.js.map +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/revo-grid.js +1 -2
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-order-editor2.js +2 -0
- package/standalone/revogr-order-editor2.js.map +1 -1
- package/dist/cjs/column.drag.plugin-7098477f.js.map +0 -1
- package/dist/cjs/column.service-f1d5d924.js.map +0 -1
- package/dist/cjs/index-aecb871a.js +0 -510
- package/dist/cjs/index-aecb871a.js.map +0 -1
- package/dist/cjs/row-header-utils-208e4026.js.map +0 -1
- package/dist/esm/column.service-aa142672.js.map +0 -1
- package/dist/esm/index-dbd1c020.js +0 -473
- package/dist/esm/index-dbd1c020.js.map +0 -1
- package/dist/esm/row-header-utils-5511678e.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-813698d2.js +0 -5
- package/dist/revo-grid/column.service-aa142672.js +0 -5
- package/dist/revo-grid/column.service-aa142672.js.map +0 -1
- package/dist/revo-grid/index-dbd1c020.js +0 -5
- package/dist/revo-grid/index-dbd1c020.js.map +0 -1
- package/dist/revo-grid/key.utils-5ff2ec82.js +0 -5
- package/dist/revo-grid/row-header-utils-5511678e.js +0 -5
- package/dist/revo-grid/text-editor-81767dcb.js +0 -5
- package/standalone/identity.js +0 -26
- package/standalone/identity.js.map +0 -1
- /package/dist/revo-grid/{debounce-72878ced.js.map → debounce-7b511afc.js.map} +0 -0
- /package/dist/revo-grid/{edit.utils-cd6a3224.js.map → edit.utils-abcd0152.js.map} +0 -0
- /package/dist/revo-grid/{header-cell-renderer-5939221a.js.map → header-cell-renderer-fce020c3.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-81767dcb.js.map → text-editor-fb3f24fe.js.map} +0 -0
- /package/dist/revo-grid/{throttle-4eff5b3c.js.map → throttle-1f5772ef.js.map} +0 -0
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
const debounce$1 = require('./debounce-ec7a04b4.js');
|
|
7
|
-
const index = require('./index-
|
|
8
|
-
const index$1 = require('./index-10d10c55.js');
|
|
7
|
+
const index = require('./index-10d10c55.js');
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Proxy plugin for data source.
|
|
@@ -2462,6 +2461,26 @@ function baseMatchesProperty(path, srcValue) {
|
|
|
2462
2461
|
};
|
|
2463
2462
|
}
|
|
2464
2463
|
|
|
2464
|
+
/**
|
|
2465
|
+
* This method returns the first argument it receives.
|
|
2466
|
+
*
|
|
2467
|
+
* @static
|
|
2468
|
+
* @since 0.1.0
|
|
2469
|
+
* @memberOf _
|
|
2470
|
+
* @category Util
|
|
2471
|
+
* @param {*} value Any value.
|
|
2472
|
+
* @returns {*} Returns `value`.
|
|
2473
|
+
* @example
|
|
2474
|
+
*
|
|
2475
|
+
* var object = { 'a': 1 };
|
|
2476
|
+
*
|
|
2477
|
+
* console.log(_.identity(object) === object);
|
|
2478
|
+
* // => true
|
|
2479
|
+
*/
|
|
2480
|
+
function identity(value) {
|
|
2481
|
+
return value;
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2465
2484
|
/**
|
|
2466
2485
|
* The base implementation of `_.property` without support for deep paths.
|
|
2467
2486
|
*
|
|
@@ -2528,7 +2547,7 @@ function baseIteratee(value) {
|
|
|
2528
2547
|
return value;
|
|
2529
2548
|
}
|
|
2530
2549
|
if (value == null) {
|
|
2531
|
-
return
|
|
2550
|
+
return identity;
|
|
2532
2551
|
}
|
|
2533
2552
|
if (typeof value == 'object') {
|
|
2534
2553
|
return isArray$1(value)
|
|
@@ -2777,9 +2796,9 @@ function createRange(fromRight) {
|
|
|
2777
2796
|
* _.range(0);
|
|
2778
2797
|
* // => []
|
|
2779
2798
|
*/
|
|
2780
|
-
var range = createRange();
|
|
2799
|
+
var range$1 = createRange();
|
|
2781
2800
|
|
|
2782
|
-
const range$
|
|
2801
|
+
const range$2 = range$1;
|
|
2783
2802
|
|
|
2784
2803
|
const appendToMap = (map, propName, value) => {
|
|
2785
2804
|
const items = map.get(propName);
|
|
@@ -2819,7 +2838,7 @@ const cleanupElements = debounce((map) => {
|
|
|
2819
2838
|
}
|
|
2820
2839
|
}, 2000);
|
|
2821
2840
|
const stencilSubscription = () => {
|
|
2822
|
-
if (typeof index
|
|
2841
|
+
if (typeof index.getRenderingRef !== 'function') {
|
|
2823
2842
|
// If we are not in a stencil project, we do nothing.
|
|
2824
2843
|
// This function is not really exported by @stencil/core.
|
|
2825
2844
|
return {};
|
|
@@ -2828,7 +2847,7 @@ const stencilSubscription = () => {
|
|
|
2828
2847
|
return {
|
|
2829
2848
|
dispose: () => elmsToUpdate.clear(),
|
|
2830
2849
|
get: (propName) => {
|
|
2831
|
-
const elm = index
|
|
2850
|
+
const elm = index.getRenderingRef();
|
|
2832
2851
|
if (elm) {
|
|
2833
2852
|
appendToMap(elmsToUpdate, propName, elm);
|
|
2834
2853
|
}
|
|
@@ -2836,12 +2855,12 @@ const stencilSubscription = () => {
|
|
|
2836
2855
|
set: (propName) => {
|
|
2837
2856
|
const elements = elmsToUpdate.get(propName);
|
|
2838
2857
|
if (elements) {
|
|
2839
|
-
elmsToUpdate.set(propName, elements.filter(index
|
|
2858
|
+
elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
|
|
2840
2859
|
}
|
|
2841
2860
|
cleanupElements(elmsToUpdate);
|
|
2842
2861
|
},
|
|
2843
2862
|
reset: () => {
|
|
2844
|
-
elmsToUpdate.forEach((elms) => elms.forEach(index
|
|
2863
|
+
elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
|
|
2845
2864
|
cleanupElements(elmsToUpdate);
|
|
2846
2865
|
},
|
|
2847
2866
|
};
|
|
@@ -3037,7 +3056,7 @@ class DataStore {
|
|
|
3037
3056
|
}
|
|
3038
3057
|
// clear items
|
|
3039
3058
|
this.store.set('items', []);
|
|
3040
|
-
const items = range$
|
|
3059
|
+
const items = range$2(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
|
|
3041
3060
|
// set proxy first
|
|
3042
3061
|
setStore(this.store, {
|
|
3043
3062
|
source,
|
|
@@ -3147,1305 +3166,511 @@ function getSourceItemVirtualIndexByProp(store, prop) {
|
|
|
3147
3166
|
return items.indexOf(physicalIndex);
|
|
3148
3167
|
}
|
|
3149
3168
|
|
|
3150
|
-
/**
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
*
|
|
3154
|
-
* @private
|
|
3155
|
-
* @param {Array} [array] The array to iterate over.
|
|
3156
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3157
|
-
* @param {*} [accumulator] The initial value.
|
|
3158
|
-
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
3159
|
-
* the initial value.
|
|
3160
|
-
* @returns {*} Returns the accumulated value.
|
|
3161
|
-
*/
|
|
3162
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
3163
|
-
var index = -1,
|
|
3164
|
-
length = array == null ? 0 : array.length;
|
|
3169
|
+
/** Used as references for the maximum length and index of an array. */
|
|
3170
|
+
var MAX_ARRAY_LENGTH$1 = 4294967295,
|
|
3171
|
+
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$1 - 1;
|
|
3165
3172
|
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3173
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3174
|
+
var nativeFloor = Math.floor,
|
|
3175
|
+
nativeMin = Math.min;
|
|
3176
|
+
|
|
3177
|
+
/**
|
|
3178
|
+
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
|
|
3179
|
+
* which invokes `iteratee` for `value` and each element of `array` to compute
|
|
3180
|
+
* their sort ranking. The iteratee is invoked with one argument; (value).
|
|
3181
|
+
*
|
|
3182
|
+
* @private
|
|
3183
|
+
* @param {Array} array The sorted array to inspect.
|
|
3184
|
+
* @param {*} value The value to evaluate.
|
|
3185
|
+
* @param {Function} iteratee The iteratee invoked per element.
|
|
3186
|
+
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
3187
|
+
* @returns {number} Returns the index at which `value` should be inserted
|
|
3188
|
+
* into `array`.
|
|
3189
|
+
*/
|
|
3190
|
+
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|
3191
|
+
var low = 0,
|
|
3192
|
+
high = array == null ? 0 : array.length;
|
|
3193
|
+
if (high === 0) {
|
|
3194
|
+
return 0;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
value = iteratee(value);
|
|
3198
|
+
var valIsNaN = value !== value,
|
|
3199
|
+
valIsNull = value === null,
|
|
3200
|
+
valIsSymbol = debounce$1.isSymbol(value),
|
|
3201
|
+
valIsUndefined = value === undefined;
|
|
3202
|
+
|
|
3203
|
+
while (low < high) {
|
|
3204
|
+
var mid = nativeFloor((low + high) / 2),
|
|
3205
|
+
computed = iteratee(array[mid]),
|
|
3206
|
+
othIsDefined = computed !== undefined,
|
|
3207
|
+
othIsNull = computed === null,
|
|
3208
|
+
othIsReflexive = computed === computed,
|
|
3209
|
+
othIsSymbol = debounce$1.isSymbol(computed);
|
|
3210
|
+
|
|
3211
|
+
if (valIsNaN) {
|
|
3212
|
+
var setLow = retHighest || othIsReflexive;
|
|
3213
|
+
} else if (valIsUndefined) {
|
|
3214
|
+
setLow = othIsReflexive && (retHighest || othIsDefined);
|
|
3215
|
+
} else if (valIsNull) {
|
|
3216
|
+
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
|
|
3217
|
+
} else if (valIsSymbol) {
|
|
3218
|
+
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
|
|
3219
|
+
} else if (othIsNull || othIsSymbol) {
|
|
3220
|
+
setLow = false;
|
|
3221
|
+
} else {
|
|
3222
|
+
setLow = retHighest ? (computed <= value) : (computed < value);
|
|
3223
|
+
}
|
|
3224
|
+
if (setLow) {
|
|
3225
|
+
low = mid + 1;
|
|
3226
|
+
} else {
|
|
3227
|
+
high = mid;
|
|
3228
|
+
}
|
|
3171
3229
|
}
|
|
3172
|
-
return
|
|
3230
|
+
return nativeMin(high, MAX_ARRAY_INDEX);
|
|
3173
3231
|
}
|
|
3174
3232
|
|
|
3175
|
-
/**
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
* @private
|
|
3179
|
-
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
3180
|
-
* @returns {Function} Returns the new base function.
|
|
3181
|
-
*/
|
|
3182
|
-
function createBaseFor(fromRight) {
|
|
3183
|
-
return function(object, iteratee, keysFunc) {
|
|
3184
|
-
var index = -1,
|
|
3185
|
-
iterable = Object(object),
|
|
3186
|
-
props = keysFunc(object),
|
|
3187
|
-
length = props.length;
|
|
3188
|
-
|
|
3189
|
-
while (length--) {
|
|
3190
|
-
var key = props[fromRight ? length : ++index];
|
|
3191
|
-
if (iteratee(iterable[key], key, iterable) === false) {
|
|
3192
|
-
break;
|
|
3193
|
-
}
|
|
3194
|
-
}
|
|
3195
|
-
return object;
|
|
3196
|
-
};
|
|
3197
|
-
}
|
|
3233
|
+
/** Used as references for the maximum length and index of an array. */
|
|
3234
|
+
var MAX_ARRAY_LENGTH = 4294967295,
|
|
3235
|
+
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
|
3198
3236
|
|
|
3199
3237
|
/**
|
|
3200
|
-
* The base implementation of `
|
|
3201
|
-
*
|
|
3202
|
-
*
|
|
3238
|
+
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
|
|
3239
|
+
* performs a binary search of `array` to determine the index at which `value`
|
|
3240
|
+
* should be inserted into `array` in order to maintain its sort order.
|
|
3203
3241
|
*
|
|
3204
3242
|
* @private
|
|
3205
|
-
* @param {
|
|
3206
|
-
* @param {
|
|
3207
|
-
* @param {
|
|
3208
|
-
* @returns {
|
|
3243
|
+
* @param {Array} array The sorted array to inspect.
|
|
3244
|
+
* @param {*} value The value to evaluate.
|
|
3245
|
+
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
3246
|
+
* @returns {number} Returns the index at which `value` should be inserted
|
|
3247
|
+
* into `array`.
|
|
3209
3248
|
*/
|
|
3210
|
-
|
|
3249
|
+
function baseSortedIndex(array, value, retHighest) {
|
|
3250
|
+
var low = 0,
|
|
3251
|
+
high = array == null ? low : array.length;
|
|
3211
3252
|
|
|
3212
|
-
|
|
3253
|
+
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
|
3254
|
+
while (low < high) {
|
|
3255
|
+
var mid = (low + high) >>> 1,
|
|
3256
|
+
computed = array[mid];
|
|
3213
3257
|
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3220
|
-
* @returns {Object} Returns `object`.
|
|
3221
|
-
*/
|
|
3222
|
-
function baseForOwn(object, iteratee) {
|
|
3223
|
-
return object && baseFor$1(object, iteratee, keys);
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
/**
|
|
3227
|
-
* Creates a `baseEach` or `baseEachRight` function.
|
|
3228
|
-
*
|
|
3229
|
-
* @private
|
|
3230
|
-
* @param {Function} eachFunc The function to iterate over a collection.
|
|
3231
|
-
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
3232
|
-
* @returns {Function} Returns the new base function.
|
|
3233
|
-
*/
|
|
3234
|
-
function createBaseEach(eachFunc, fromRight) {
|
|
3235
|
-
return function(collection, iteratee) {
|
|
3236
|
-
if (collection == null) {
|
|
3237
|
-
return collection;
|
|
3238
|
-
}
|
|
3239
|
-
if (!isArrayLike(collection)) {
|
|
3240
|
-
return eachFunc(collection, iteratee);
|
|
3241
|
-
}
|
|
3242
|
-
var length = collection.length,
|
|
3243
|
-
index = fromRight ? length : -1,
|
|
3244
|
-
iterable = Object(collection);
|
|
3245
|
-
|
|
3246
|
-
while ((fromRight ? index-- : ++index < length)) {
|
|
3247
|
-
if (iteratee(iterable[index], index, iterable) === false) {
|
|
3248
|
-
break;
|
|
3258
|
+
if (computed !== null && !debounce$1.isSymbol(computed) &&
|
|
3259
|
+
(retHighest ? (computed <= value) : (computed < value))) {
|
|
3260
|
+
low = mid + 1;
|
|
3261
|
+
} else {
|
|
3262
|
+
high = mid;
|
|
3249
3263
|
}
|
|
3250
3264
|
}
|
|
3251
|
-
return
|
|
3252
|
-
}
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
/**
|
|
3256
|
-
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
3257
|
-
*
|
|
3258
|
-
* @private
|
|
3259
|
-
* @param {Array|Object} collection The collection to iterate over.
|
|
3260
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3261
|
-
* @returns {Array|Object} Returns `collection`.
|
|
3262
|
-
*/
|
|
3263
|
-
var baseEach = createBaseEach(baseForOwn);
|
|
3264
|
-
|
|
3265
|
-
const baseEach$1 = baseEach;
|
|
3266
|
-
|
|
3267
|
-
/**
|
|
3268
|
-
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
|
3269
|
-
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
|
3270
|
-
*
|
|
3271
|
-
* @private
|
|
3272
|
-
* @param {Array|Object} collection The collection to iterate over.
|
|
3273
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3274
|
-
* @param {*} accumulator The initial value.
|
|
3275
|
-
* @param {boolean} initAccum Specify using the first or last element of
|
|
3276
|
-
* `collection` as the initial value.
|
|
3277
|
-
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
3278
|
-
* @returns {*} Returns the accumulated value.
|
|
3279
|
-
*/
|
|
3280
|
-
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
|
3281
|
-
eachFunc(collection, function(value, index, collection) {
|
|
3282
|
-
accumulator = initAccum
|
|
3283
|
-
? (initAccum = false, value)
|
|
3284
|
-
: iteratee(accumulator, value, index, collection);
|
|
3285
|
-
});
|
|
3286
|
-
return accumulator;
|
|
3265
|
+
return high;
|
|
3266
|
+
}
|
|
3267
|
+
return baseSortedIndexBy(array, value, identity, retHighest);
|
|
3287
3268
|
}
|
|
3288
3269
|
|
|
3289
3270
|
/**
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3292
|
-
* invocation is supplied the return value of the previous. If `accumulator`
|
|
3293
|
-
* is not given, the first element of `collection` is used as the initial
|
|
3294
|
-
* value. The iteratee is invoked with four arguments:
|
|
3295
|
-
* (accumulator, value, index|key, collection).
|
|
3296
|
-
*
|
|
3297
|
-
* Many lodash methods are guarded to work as iteratees for methods like
|
|
3298
|
-
* `_.reduce`, `_.reduceRight`, and `_.transform`.
|
|
3299
|
-
*
|
|
3300
|
-
* The guarded methods are:
|
|
3301
|
-
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
|
|
3302
|
-
* and `sortBy`
|
|
3271
|
+
* Uses a binary search to determine the lowest index at which `value`
|
|
3272
|
+
* should be inserted into `array` in order to maintain its sort order.
|
|
3303
3273
|
*
|
|
3304
3274
|
* @static
|
|
3305
3275
|
* @memberOf _
|
|
3306
3276
|
* @since 0.1.0
|
|
3307
|
-
* @category
|
|
3308
|
-
* @param {Array
|
|
3309
|
-
* @param {
|
|
3310
|
-
* @
|
|
3311
|
-
*
|
|
3312
|
-
* @see _.reduceRight
|
|
3277
|
+
* @category Array
|
|
3278
|
+
* @param {Array} array The sorted array to inspect.
|
|
3279
|
+
* @param {*} value The value to evaluate.
|
|
3280
|
+
* @returns {number} Returns the index at which `value` should be inserted
|
|
3281
|
+
* into `array`.
|
|
3313
3282
|
* @example
|
|
3314
3283
|
*
|
|
3315
|
-
* _.
|
|
3316
|
-
*
|
|
3317
|
-
* }, 0);
|
|
3318
|
-
* // => 3
|
|
3319
|
-
*
|
|
3320
|
-
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
|
3321
|
-
* (result[value] || (result[value] = [])).push(key);
|
|
3322
|
-
* return result;
|
|
3323
|
-
* }, {});
|
|
3324
|
-
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
|
3284
|
+
* _.sortedIndex([30, 50], 40);
|
|
3285
|
+
* // => 1
|
|
3325
3286
|
*/
|
|
3326
|
-
function
|
|
3327
|
-
|
|
3328
|
-
initAccum = arguments.length < 3;
|
|
3329
|
-
|
|
3330
|
-
return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
|
|
3287
|
+
function sortedIndex(array, value) {
|
|
3288
|
+
return baseSortedIndex(array, value);
|
|
3331
3289
|
}
|
|
3332
3290
|
|
|
3333
3291
|
/**
|
|
3334
|
-
*
|
|
3292
|
+
* Pre-calculation
|
|
3293
|
+
* Dimension custom sizes for each cell
|
|
3294
|
+
* Keeps only changed sizes, skips origin size
|
|
3335
3295
|
*/
|
|
3336
|
-
function
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
this.store.set('tempRangeType', null);
|
|
3354
|
-
}
|
|
3355
|
-
});
|
|
3356
|
-
}
|
|
3357
|
-
onChange(propName, cb) {
|
|
3358
|
-
this.unsubscribe.push(this.store.onChange(propName, cb));
|
|
3359
|
-
}
|
|
3360
|
-
clearFocus() {
|
|
3361
|
-
setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
|
|
3362
|
-
}
|
|
3363
|
-
setFocus(focus, end) {
|
|
3364
|
-
if (!end) {
|
|
3365
|
-
setStore(this.store, { focus });
|
|
3296
|
+
function calculateDimensionData(originItemSize, newSizes = {}) {
|
|
3297
|
+
const positionIndexes = [];
|
|
3298
|
+
const positionIndexToItem = {};
|
|
3299
|
+
const indexToItem = {};
|
|
3300
|
+
// prepare order sorted new sizes and calculate changed real size
|
|
3301
|
+
const newIndexes = Object.keys(newSizes).map(Number).sort((a, b) => a - b);
|
|
3302
|
+
// fill new coordinates based on what is changed
|
|
3303
|
+
newIndexes.reduce((previous, itemIndex, i) => {
|
|
3304
|
+
const newItem = {
|
|
3305
|
+
itemIndex,
|
|
3306
|
+
start: 0,
|
|
3307
|
+
end: 0,
|
|
3308
|
+
};
|
|
3309
|
+
// if previous item was changed too
|
|
3310
|
+
if (previous) {
|
|
3311
|
+
const itemsBetween = (itemIndex - previous.itemIndex - 1) * originItemSize;
|
|
3312
|
+
newItem.start = itemsBetween + previous.end;
|
|
3366
3313
|
}
|
|
3367
3314
|
else {
|
|
3368
|
-
|
|
3369
|
-
focus,
|
|
3370
|
-
range: getRange(focus, end),
|
|
3371
|
-
edit: null,
|
|
3372
|
-
tempRange: null,
|
|
3373
|
-
});
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
setNextFocus(focus) {
|
|
3377
|
-
setStore(this.store, { nextFocus: focus });
|
|
3378
|
-
}
|
|
3379
|
-
setTempArea(range) {
|
|
3380
|
-
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 });
|
|
3381
|
-
}
|
|
3382
|
-
clearTemp() {
|
|
3383
|
-
setStore(this.store, { tempRange: null });
|
|
3384
|
-
}
|
|
3385
|
-
/** Can be applied from selection change or from simple keyboard change clicks */
|
|
3386
|
-
setRangeArea(range) {
|
|
3387
|
-
setStore(this.store, { range, edit: null, tempRange: null });
|
|
3388
|
-
}
|
|
3389
|
-
setRange(start, end) {
|
|
3390
|
-
const range = getRange(start, end);
|
|
3391
|
-
this.setRangeArea(range);
|
|
3392
|
-
}
|
|
3393
|
-
setLastCell(lastCell) {
|
|
3394
|
-
setStore(this.store, { lastCell });
|
|
3395
|
-
}
|
|
3396
|
-
setEdit(val) {
|
|
3397
|
-
const focus = this.store.get('focus');
|
|
3398
|
-
if (focus && typeof val === 'string') {
|
|
3399
|
-
setStore(this.store, {
|
|
3400
|
-
edit: { x: focus.x, y: focus.y, val },
|
|
3401
|
-
});
|
|
3402
|
-
return;
|
|
3315
|
+
newItem.start = itemIndex * originItemSize;
|
|
3403
3316
|
}
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3317
|
+
newItem.end = newItem.start + newSizes[itemIndex];
|
|
3318
|
+
positionIndexes.push(newItem.start);
|
|
3319
|
+
indexToItem[itemIndex] = positionIndexToItem[i] = newItem;
|
|
3320
|
+
return newItem;
|
|
3321
|
+
}, undefined);
|
|
3322
|
+
return {
|
|
3323
|
+
indexes: newIndexes,
|
|
3324
|
+
positionIndexes: [...positionIndexes],
|
|
3325
|
+
positionIndexToItem: Object.assign({}, positionIndexToItem),
|
|
3326
|
+
indexToItem,
|
|
3327
|
+
};
|
|
3410
3328
|
}
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
}
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
return
|
|
3450
|
-
}
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3329
|
+
/**
|
|
3330
|
+
* Calculate item by position
|
|
3331
|
+
*/
|
|
3332
|
+
const getItemByPosition = ({ indexes, positionIndexes, originItemSize, positionIndexToItem, }, pos) => {
|
|
3333
|
+
const item = {
|
|
3334
|
+
itemIndex: 0,
|
|
3335
|
+
start: 0,
|
|
3336
|
+
end: 0,
|
|
3337
|
+
};
|
|
3338
|
+
const currentPlace = indexes.length ? sortedIndex(positionIndexes, pos) : 0;
|
|
3339
|
+
// not found or first index
|
|
3340
|
+
if (!currentPlace) {
|
|
3341
|
+
item.itemIndex = Math.floor(pos / originItemSize);
|
|
3342
|
+
item.start = item.itemIndex * originItemSize;
|
|
3343
|
+
item.end = item.start + originItemSize;
|
|
3344
|
+
return item;
|
|
3345
|
+
}
|
|
3346
|
+
const positionItem = positionIndexToItem[currentPlace - 1];
|
|
3347
|
+
// if item has specified size
|
|
3348
|
+
if (positionItem.end > pos) {
|
|
3349
|
+
return positionItem;
|
|
3350
|
+
}
|
|
3351
|
+
// special size item was present before
|
|
3352
|
+
const relativePos = pos - positionItem.end;
|
|
3353
|
+
const relativeIndex = Math.floor(relativePos / originItemSize);
|
|
3354
|
+
item.itemIndex = positionItem.itemIndex + 1 + relativeIndex;
|
|
3355
|
+
item.start = positionItem.end + relativeIndex * originItemSize;
|
|
3356
|
+
item.end = item.start + originItemSize;
|
|
3357
|
+
return item;
|
|
3358
|
+
};
|
|
3359
|
+
function getItemByIndex(dimension, index) {
|
|
3360
|
+
let item = {
|
|
3361
|
+
itemIndex: index,
|
|
3362
|
+
start: 0,
|
|
3363
|
+
end: 0,
|
|
3364
|
+
};
|
|
3365
|
+
// if item has specified size
|
|
3366
|
+
if (dimension.indexToItem[index]) {
|
|
3367
|
+
return dimension.indexToItem[index];
|
|
3368
|
+
}
|
|
3369
|
+
const currentPlace = dimension.indexes.length
|
|
3370
|
+
? sortedIndex(dimension.indexes, index)
|
|
3371
|
+
: 0;
|
|
3372
|
+
// not found or first index
|
|
3373
|
+
if (!currentPlace) {
|
|
3374
|
+
item.start = item.itemIndex * dimension.originItemSize;
|
|
3375
|
+
item.end = item.start + dimension.originItemSize;
|
|
3376
|
+
return item;
|
|
3377
|
+
}
|
|
3378
|
+
// special size item was present before
|
|
3379
|
+
const positionItem = dimension.indexToItem[dimension.indexes[currentPlace - 1]];
|
|
3380
|
+
item.start =
|
|
3381
|
+
positionItem.end +
|
|
3382
|
+
(index - positionItem.itemIndex - 1) * dimension.originItemSize;
|
|
3383
|
+
item.end = item.start + dimension.originItemSize;
|
|
3384
|
+
return item;
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
const MIN_COL_SIZE = 30;
|
|
3388
|
+
const RESIZE_INTERVAL = 40;
|
|
3389
|
+
const DATA_COL = 'data-rgCol';
|
|
3390
|
+
const DATA_ROW = 'data-rgRow';
|
|
3391
|
+
const DISABLED_CLASS = 'disabled';
|
|
3392
|
+
const CELL_CLASS = 'rgCell';
|
|
3393
|
+
const ROW_HEADER_TYPE = 'rowHeaders';
|
|
3394
|
+
const HEADER_CLASS = 'rgHeaderCell';
|
|
3395
|
+
const HEADER_SORTABLE_CLASS = 'sortable';
|
|
3396
|
+
const HEADER_ROW_CLASS = 'header-rgRow';
|
|
3397
|
+
const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
|
|
3398
|
+
const DRAG_ICON_CLASS = 'revo-drag-icon';
|
|
3399
|
+
const DRAGGABLE_CLASS = 'revo-draggable';
|
|
3400
|
+
const FOCUS_CLASS = 'focused-cell';
|
|
3401
|
+
const SELECTION_BORDER_CLASS = 'selection-border-range';
|
|
3402
|
+
const MOBILE_CLASS = 'mobile-handler';
|
|
3403
|
+
const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
|
|
3404
|
+
const CELL_HANDLER_CLASS = 'autofill-handle';
|
|
3405
|
+
const EDIT_INPUT_WR = 'edit-input-wrapper';
|
|
3406
|
+
const DRAGG_TEXT = 'Draggable item';
|
|
3407
|
+
const GRID_INTERNALS = '__rvgr';
|
|
3408
|
+
const ROW_FOCUSED_CLASS = 'focused-rgRow';
|
|
3409
|
+
|
|
3410
|
+
var codes;
|
|
3411
|
+
(function (codes) {
|
|
3412
|
+
codes[codes["MOUSE_LEFT"] = 1] = "MOUSE_LEFT";
|
|
3413
|
+
codes[codes["MOUSE_RIGHT"] = 3] = "MOUSE_RIGHT";
|
|
3414
|
+
codes[codes["MOUSE_MIDDLE"] = 2] = "MOUSE_MIDDLE";
|
|
3415
|
+
codes[codes["BACKSPACE"] = 8] = "BACKSPACE";
|
|
3416
|
+
codes[codes["COMMA"] = 188] = "COMMA";
|
|
3417
|
+
codes[codes["INSERT"] = 45] = "INSERT";
|
|
3418
|
+
codes[codes["DELETE"] = 46] = "DELETE";
|
|
3419
|
+
codes[codes["END"] = 35] = "END";
|
|
3420
|
+
codes[codes["ENTER"] = 13] = "ENTER";
|
|
3421
|
+
codes[codes["ESCAPE"] = 27] = "ESCAPE";
|
|
3422
|
+
codes[codes["CONTROL"] = 17] = "CONTROL";
|
|
3423
|
+
codes[codes["COMMAND_LEFT"] = 91] = "COMMAND_LEFT";
|
|
3424
|
+
codes[codes["COMMAND_RIGHT"] = 93] = "COMMAND_RIGHT";
|
|
3425
|
+
codes[codes["COMMAND_FIREFOX"] = 224] = "COMMAND_FIREFOX";
|
|
3426
|
+
codes[codes["ALT"] = 18] = "ALT";
|
|
3427
|
+
codes[codes["HOME"] = 36] = "HOME";
|
|
3428
|
+
codes[codes["PAGE_DOWN"] = 34] = "PAGE_DOWN";
|
|
3429
|
+
codes[codes["PAGE_UP"] = 33] = "PAGE_UP";
|
|
3430
|
+
codes[codes["PERIOD"] = 190] = "PERIOD";
|
|
3431
|
+
codes[codes["SPACE"] = 32] = "SPACE";
|
|
3432
|
+
codes[codes["SHIFT"] = 16] = "SHIFT";
|
|
3433
|
+
codes[codes["CAPS_LOCK"] = 20] = "CAPS_LOCK";
|
|
3434
|
+
codes[codes["TAB"] = 9] = "TAB";
|
|
3435
|
+
codes[codes["ARROW_RIGHT"] = 39] = "ARROW_RIGHT";
|
|
3436
|
+
codes[codes["ARROW_LEFT"] = 37] = "ARROW_LEFT";
|
|
3437
|
+
codes[codes["ARROW_UP"] = 38] = "ARROW_UP";
|
|
3438
|
+
codes[codes["ARROW_DOWN"] = 40] = "ARROW_DOWN";
|
|
3439
|
+
codes[codes["F1"] = 112] = "F1";
|
|
3440
|
+
codes[codes["F2"] = 113] = "F2";
|
|
3441
|
+
codes[codes["F3"] = 114] = "F3";
|
|
3442
|
+
codes[codes["F4"] = 115] = "F4";
|
|
3443
|
+
codes[codes["F5"] = 116] = "F5";
|
|
3444
|
+
codes[codes["F6"] = 117] = "F6";
|
|
3445
|
+
codes[codes["F7"] = 118] = "F7";
|
|
3446
|
+
codes[codes["F8"] = 119] = "F8";
|
|
3447
|
+
codes[codes["F9"] = 120] = "F9";
|
|
3448
|
+
codes[codes["F10"] = 121] = "F10";
|
|
3449
|
+
codes[codes["F11"] = 122] = "F11";
|
|
3450
|
+
codes[codes["F12"] = 123] = "F12";
|
|
3451
|
+
codes[codes["A"] = 65] = "A";
|
|
3452
|
+
codes[codes["C"] = 67] = "C";
|
|
3453
|
+
codes[codes["D"] = 68] = "D";
|
|
3454
|
+
codes[codes["F"] = 70] = "F";
|
|
3455
|
+
codes[codes["L"] = 76] = "L";
|
|
3456
|
+
codes[codes["O"] = 79] = "O";
|
|
3457
|
+
codes[codes["P"] = 80] = "P";
|
|
3458
|
+
codes[codes["S"] = 83] = "S";
|
|
3459
|
+
codes[codes["V"] = 86] = "V";
|
|
3460
|
+
codes[codes["X"] = 88] = "X";
|
|
3461
|
+
})(codes || (codes = {}));
|
|
3462
|
+
exports.codesLetter = void 0;
|
|
3463
|
+
(function (codesLetter) {
|
|
3464
|
+
codesLetter["ENTER"] = "Enter";
|
|
3465
|
+
codesLetter["ENTER_NUM"] = "NumpadEnter";
|
|
3466
|
+
codesLetter["A"] = "KeyA";
|
|
3467
|
+
codesLetter["C"] = "KeyC";
|
|
3468
|
+
codesLetter["X"] = "KeyX";
|
|
3469
|
+
codesLetter["V"] = "KeyV";
|
|
3470
|
+
codesLetter["ESCAPE"] = "Escape";
|
|
3471
|
+
codesLetter["TAB"] = "Tab";
|
|
3472
|
+
codesLetter["BACKSPACE"] = "Backspace";
|
|
3473
|
+
codesLetter["DELETE"] = "Delete";
|
|
3474
|
+
codesLetter["ARROW_RIGHT"] = "ArrowRight";
|
|
3475
|
+
codesLetter["ARROW_LEFT"] = "ArrowLeft";
|
|
3476
|
+
codesLetter["ARROW_UP"] = "ArrowUp";
|
|
3477
|
+
codesLetter["ARROW_DOWN"] = "ArrowDown";
|
|
3478
|
+
codesLetter["SHIFT"] = "Shift";
|
|
3479
|
+
})(exports.codesLetter || (exports.codesLetter = {}));
|
|
3480
|
+
exports.keyValues = void 0;
|
|
3481
|
+
(function (keyValues) {
|
|
3482
|
+
keyValues["ENTER"] = "Enter";
|
|
3483
|
+
keyValues["TAB"] = "Tab";
|
|
3484
|
+
})(exports.keyValues || (exports.keyValues = {}));
|
|
3485
|
+
const KeyCodesEnum = codes;
|
|
3486
|
+
|
|
3487
|
+
var osPlatform;
|
|
3488
|
+
(function (osPlatform) {
|
|
3489
|
+
osPlatform["mac"] = "Mac";
|
|
3490
|
+
})(osPlatform || (osPlatform = {}));
|
|
3491
|
+
const OsPlatform = osPlatform;
|
|
3492
|
+
|
|
3493
|
+
/* Generate range on size
|
|
3494
|
+
*/
|
|
3495
|
+
function range(size, startAt = 0) {
|
|
3496
|
+
const res = [];
|
|
3497
|
+
const end = startAt + size;
|
|
3498
|
+
for (let i = startAt; i < end; i++) {
|
|
3499
|
+
res.push(i);
|
|
3469
3500
|
}
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3501
|
+
return res;
|
|
3502
|
+
}
|
|
3503
|
+
/* Find index position in array */
|
|
3504
|
+
function findPositionInArray(el, compareFn) {
|
|
3505
|
+
return (function (arr) {
|
|
3506
|
+
let m = 0;
|
|
3507
|
+
let n = arr.length - 1;
|
|
3508
|
+
while (m <= n) {
|
|
3509
|
+
const k = (n + m) >> 1;
|
|
3510
|
+
const cmp = compareFn(el, arr[k]);
|
|
3511
|
+
if (cmp > 0) {
|
|
3512
|
+
m = k + 1;
|
|
3477
3513
|
}
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
}
|
|
3481
|
-
registerColumn(x, type) {
|
|
3482
|
-
// if hidden just create store but no operations needed
|
|
3483
|
-
if (isHiddenStore(x)) {
|
|
3484
|
-
return new SelectionStore();
|
|
3485
|
-
}
|
|
3486
|
-
if (this.columnStores[x]) {
|
|
3487
|
-
return this.columnStores[x];
|
|
3488
|
-
}
|
|
3489
|
-
this.columnStores[x] = new SelectionStore();
|
|
3490
|
-
// build cross-linking type to position
|
|
3491
|
-
this.storesByType[type] = x;
|
|
3492
|
-
this.storesXToType[x] = type;
|
|
3493
|
-
return this.columnStores[x];
|
|
3494
|
-
}
|
|
3495
|
-
registerRow(y, type) {
|
|
3496
|
-
// if hidden just create store
|
|
3497
|
-
if (isHiddenStore(y)) {
|
|
3498
|
-
return new SelectionStore();
|
|
3499
|
-
}
|
|
3500
|
-
if (this.rowStores[y]) {
|
|
3501
|
-
return this.rowStores[y];
|
|
3502
|
-
}
|
|
3503
|
-
this.rowStores[y] = new SelectionStore();
|
|
3504
|
-
// build cross linking type to position
|
|
3505
|
-
this.storesByType[type] = y;
|
|
3506
|
-
this.storesYToType[y] = type;
|
|
3507
|
-
return this.rowStores[y];
|
|
3508
|
-
}
|
|
3509
|
-
/**
|
|
3510
|
-
* Cross store proxy, based on multiple dimensions
|
|
3511
|
-
*/
|
|
3512
|
-
register({ x, y }) {
|
|
3513
|
-
var _a, _b;
|
|
3514
|
-
// if hidden just create store
|
|
3515
|
-
if (isHiddenStore(x) || isHiddenStore(y)) {
|
|
3516
|
-
return new SelectionStore();
|
|
3517
|
-
}
|
|
3518
|
-
if (!this.stores[y]) {
|
|
3519
|
-
this.stores[y] = {};
|
|
3520
|
-
}
|
|
3521
|
-
if (this.stores[y][x]) {
|
|
3522
|
-
// Store already registered. Do not register twice
|
|
3523
|
-
return this.stores[y][x];
|
|
3524
|
-
}
|
|
3525
|
-
this.stores[y][x] = new SelectionStore();
|
|
3526
|
-
// proxy update, column store trigger only range area
|
|
3527
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
|
|
3528
|
-
this.columnStores[x].setRangeArea(c);
|
|
3529
|
-
this.rowStores[y].setRangeArea(c);
|
|
3530
|
-
});
|
|
3531
|
-
// clean up on remove
|
|
3532
|
-
(_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
|
|
3533
|
-
return this.stores[y][x];
|
|
3534
|
-
}
|
|
3535
|
-
destroy(x, y) {
|
|
3536
|
-
var _a, _b;
|
|
3537
|
-
(_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
3538
|
-
(_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
3539
|
-
delete this.rowStores[y];
|
|
3540
|
-
delete this.columnStores[x];
|
|
3541
|
-
// clear x cross-link
|
|
3542
|
-
if (this.storesXToType[x]) {
|
|
3543
|
-
const type = this.storesXToType[x];
|
|
3544
|
-
delete this.storesXToType[x];
|
|
3545
|
-
delete this.storesByType[type];
|
|
3546
|
-
}
|
|
3547
|
-
// clear y cross-link
|
|
3548
|
-
if (this.storesYToType[y]) {
|
|
3549
|
-
const type = this.storesYToType[y];
|
|
3550
|
-
delete this.storesYToType[y];
|
|
3551
|
-
delete this.storesByType[type];
|
|
3552
|
-
}
|
|
3553
|
-
if (this.stores[y]) {
|
|
3554
|
-
delete this.stores[y][x];
|
|
3555
|
-
}
|
|
3556
|
-
// clear empty rows
|
|
3557
|
-
if (!Object.keys(this.stores[y] || {}).length) {
|
|
3558
|
-
delete this.stores[y];
|
|
3559
|
-
}
|
|
3560
|
-
}
|
|
3561
|
-
setEditByCell(storePos, editCell) {
|
|
3562
|
-
this.focusByCell(storePos, editCell, editCell);
|
|
3563
|
-
this.setEdit('');
|
|
3564
|
-
}
|
|
3565
|
-
/**
|
|
3566
|
-
* Sets the next focus cell before the current one.
|
|
3567
|
-
*
|
|
3568
|
-
* @param focus - The cell to set as the next focus.
|
|
3569
|
-
*/
|
|
3570
|
-
beforeNextFocusCell(focus) {
|
|
3571
|
-
var _a;
|
|
3572
|
-
// If there is no focused store, return early.
|
|
3573
|
-
if (!this.focusedStore) {
|
|
3574
|
-
return;
|
|
3575
|
-
}
|
|
3576
|
-
// Get the next store based on the current focus and the last cell.
|
|
3577
|
-
const lastCell = this.focusedStore.entity.store.get('lastCell');
|
|
3578
|
-
const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
|
|
3579
|
-
// Set the next focus cell in the store.
|
|
3580
|
-
(_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));
|
|
3581
|
-
}
|
|
3582
|
-
focusByCell(storePos, start, end) {
|
|
3583
|
-
const store = this.stores[storePos.y][storePos.x];
|
|
3584
|
-
this.focus(store, { focus: start, end });
|
|
3585
|
-
}
|
|
3586
|
-
focus(store, { focus, end }) {
|
|
3587
|
-
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
3588
|
-
if (!currentStorePointer) {
|
|
3589
|
-
return null;
|
|
3590
|
-
}
|
|
3591
|
-
// check for the focus in nearby store/viewport
|
|
3592
|
-
const lastCell = store.store.get('lastCell');
|
|
3593
|
-
const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
|
|
3594
|
-
// if next store present - update
|
|
3595
|
-
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
3596
|
-
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
3597
|
-
this.focus(next.store, { focus: item, end: item });
|
|
3598
|
-
return null;
|
|
3599
|
-
}
|
|
3600
|
-
if (lastCell) {
|
|
3601
|
-
focus = cropCellToMax(focus, lastCell);
|
|
3602
|
-
end = cropCellToMax(end, lastCell);
|
|
3603
|
-
}
|
|
3604
|
-
store.setFocus(focus, end);
|
|
3605
|
-
return focus;
|
|
3606
|
-
}
|
|
3607
|
-
/**
|
|
3608
|
-
* Retrieves the current store pointer based on the active store.
|
|
3609
|
-
* Clears focus from all stores except the active one.
|
|
3610
|
-
*/
|
|
3611
|
-
getCurrentStorePointer(store) {
|
|
3612
|
-
let currentStorePointer;
|
|
3613
|
-
// Iterate through all stores
|
|
3614
|
-
for (let y in this.stores) {
|
|
3615
|
-
for (let x in this.stores[y]) {
|
|
3616
|
-
const s = this.stores[y][x];
|
|
3617
|
-
// Clear focus from stores other than the active one
|
|
3618
|
-
if (s !== store) {
|
|
3619
|
-
s.clearFocus();
|
|
3620
|
-
}
|
|
3621
|
-
else {
|
|
3622
|
-
// Update the current store pointer with the active store coordinates
|
|
3623
|
-
currentStorePointer = {
|
|
3624
|
-
x: parseInt(x, 10),
|
|
3625
|
-
y: parseInt(y, 10)
|
|
3626
|
-
};
|
|
3627
|
-
}
|
|
3514
|
+
else if (cmp < 0) {
|
|
3515
|
+
n = k - 1;
|
|
3628
3516
|
}
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
}
|
|
3632
|
-
/**
|
|
3633
|
-
* Retrieves the next store based on the focus cell and current store pointer.
|
|
3634
|
-
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
3635
|
-
* If the next store does not exist, returns null.
|
|
3636
|
-
*/
|
|
3637
|
-
getNextStore(focus, currentStorePointer, lastCell) {
|
|
3638
|
-
// item in new store
|
|
3639
|
-
const nextItem = nextCell(focus, lastCell);
|
|
3640
|
-
let nextStore;
|
|
3641
|
-
if (nextItem) {
|
|
3642
|
-
Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
|
|
3643
|
-
let stores;
|
|
3644
|
-
switch (type) {
|
|
3645
|
-
case 'x':
|
|
3646
|
-
// Get the X stores for the current Y coordinate of the current store pointer
|
|
3647
|
-
stores = this.getXStores(currentStorePointer.y);
|
|
3648
|
-
break;
|
|
3649
|
-
case 'y':
|
|
3650
|
-
// Get the Y stores for the current X coordinate of the current store pointer
|
|
3651
|
-
stores = this.getYStores(currentStorePointer.x);
|
|
3652
|
-
break;
|
|
3653
|
-
}
|
|
3654
|
-
// Get the next store based on the item in the new store
|
|
3655
|
-
if (nextItemCoord >= 0) {
|
|
3656
|
-
nextStore = stores[++currentStorePointer[type]];
|
|
3657
|
-
}
|
|
3658
|
-
else {
|
|
3659
|
-
nextStore = stores[--currentStorePointer[type]];
|
|
3660
|
-
const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
3661
|
-
if (nextLastCell) {
|
|
3662
|
-
nextItem[type] = nextLastCell[type] + nextItemCoord;
|
|
3663
|
-
}
|
|
3664
|
-
}
|
|
3665
|
-
});
|
|
3666
|
-
}
|
|
3667
|
-
return {
|
|
3668
|
-
store: nextStore,
|
|
3669
|
-
item: nextItem,
|
|
3670
|
-
};
|
|
3671
|
-
}
|
|
3672
|
-
clearAll() {
|
|
3673
|
-
var _a;
|
|
3674
|
-
for (let y in this.stores) {
|
|
3675
|
-
for (let x in this.stores[y]) {
|
|
3676
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
|
|
3677
|
-
}
|
|
3678
|
-
}
|
|
3679
|
-
}
|
|
3680
|
-
setEdit(val) {
|
|
3681
|
-
if (!this.focusedStore) {
|
|
3682
|
-
return;
|
|
3683
|
-
}
|
|
3684
|
-
this.focusedStore.entity.setEdit(val);
|
|
3685
|
-
}
|
|
3686
|
-
/**
|
|
3687
|
-
* Select all cells across all stores
|
|
3688
|
-
*/
|
|
3689
|
-
selectAll() {
|
|
3690
|
-
for (let y in this.stores) {
|
|
3691
|
-
for (let x in this.stores[y]) {
|
|
3692
|
-
const store = this.stores[y][x];
|
|
3693
|
-
if (!store) {
|
|
3694
|
-
continue;
|
|
3695
|
-
}
|
|
3696
|
-
const lastCell = store.store.get('lastCell');
|
|
3697
|
-
if (lastCell) {
|
|
3698
|
-
store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
|
|
3699
|
-
}
|
|
3517
|
+
else {
|
|
3518
|
+
return k;
|
|
3700
3519
|
}
|
|
3701
3520
|
}
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
return this.stores[y];
|
|
3705
|
-
}
|
|
3706
|
-
getYStores(x) {
|
|
3707
|
-
const stores = {};
|
|
3708
|
-
for (let i in this.stores) {
|
|
3709
|
-
stores[i] = this.stores[i][x];
|
|
3710
|
-
}
|
|
3711
|
-
return stores;
|
|
3712
|
-
}
|
|
3713
|
-
}
|
|
3714
|
-
|
|
3715
|
-
function isHiddenStore(pos) {
|
|
3716
|
-
return pos === EMPTY_INDEX;
|
|
3717
|
-
}
|
|
3718
|
-
function nextCell(cell, lastCell) {
|
|
3719
|
-
const nextItem = {};
|
|
3720
|
-
let types = ['x', 'y'];
|
|
3721
|
-
// previous item check
|
|
3722
|
-
for (let t of types) {
|
|
3723
|
-
if (cell[t] < 0) {
|
|
3724
|
-
nextItem[t] = cell[t];
|
|
3725
|
-
return nextItem;
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
// next item check
|
|
3729
|
-
for (let t of types) {
|
|
3730
|
-
if (cell[t] >= lastCell[t]) {
|
|
3731
|
-
nextItem[t] = cell[t] - lastCell[t];
|
|
3732
|
-
return nextItem;
|
|
3733
|
-
}
|
|
3734
|
-
}
|
|
3735
|
-
return null;
|
|
3736
|
-
}
|
|
3737
|
-
function cropCellToMax(cell, lastCell) {
|
|
3738
|
-
const croppedCell = Object.assign({}, cell);
|
|
3739
|
-
const cellCoordinates = ['x', 'y'];
|
|
3740
|
-
for (const coordinate of cellCoordinates) {
|
|
3741
|
-
if (cell[coordinate] < 0) {
|
|
3742
|
-
croppedCell[coordinate] = 0;
|
|
3743
|
-
}
|
|
3744
|
-
else if (cell[coordinate] >= lastCell[coordinate]) {
|
|
3745
|
-
croppedCell[coordinate] = lastCell[coordinate] - 1;
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
return croppedCell;
|
|
3749
|
-
}
|
|
3750
|
-
function getRange(start, end) {
|
|
3751
|
-
return start && end
|
|
3752
|
-
? {
|
|
3753
|
-
x: Math.min(start.x, end.x),
|
|
3754
|
-
y: Math.min(start.y, end.y),
|
|
3755
|
-
x1: Math.max(start.x, end.x),
|
|
3756
|
-
y1: Math.max(start.y, end.y),
|
|
3757
|
-
}
|
|
3758
|
-
: null;
|
|
3759
|
-
}
|
|
3760
|
-
function isRangeSingleCell(a) {
|
|
3761
|
-
return a.x === a.x1 && a.y === a.y1;
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
|
-
function getCellData(val) {
|
|
3765
|
-
if (typeof val === 'undefined' || val === null) {
|
|
3766
|
-
return '';
|
|
3767
|
-
}
|
|
3768
|
-
return val;
|
|
3769
|
-
}
|
|
3770
|
-
function getCellDataParsed(model, column) {
|
|
3771
|
-
const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
|
|
3772
|
-
return getCellData(val);
|
|
3521
|
+
return -m - 1;
|
|
3522
|
+
})(this);
|
|
3773
3523
|
}
|
|
3774
3524
|
/**
|
|
3775
|
-
*
|
|
3525
|
+
* Sorted push
|
|
3776
3526
|
*/
|
|
3777
|
-
function
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
}
|
|
3781
|
-
return 'rgCol';
|
|
3527
|
+
function pushSorted(arr, el, fn) {
|
|
3528
|
+
arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
|
|
3529
|
+
return arr;
|
|
3782
3530
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
if (c.size) {
|
|
3787
|
-
res[i] = c.size;
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
|
-
return res;
|
|
3531
|
+
// (arr1[index1] < arr2[index2])
|
|
3532
|
+
function simpleCompare(el1, el2) {
|
|
3533
|
+
return el1 < el2;
|
|
3791
3534
|
}
|
|
3792
3535
|
/**
|
|
3793
|
-
*
|
|
3536
|
+
* Merge sorted array helper function
|
|
3794
3537
|
*/
|
|
3795
|
-
function
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
colPinStart: [],
|
|
3807
|
-
colPinEnd: [],
|
|
3808
|
-
},
|
|
3809
|
-
// columns indexed by prop for quick access
|
|
3810
|
-
columnByProp: {},
|
|
3811
|
-
// column grouping
|
|
3812
|
-
columnGrouping: {
|
|
3813
|
-
rgCol: [],
|
|
3814
|
-
colPinStart: [],
|
|
3815
|
-
colPinEnd: [],
|
|
3816
|
-
},
|
|
3817
|
-
// max depth level for column grouping
|
|
3818
|
-
maxLevel: level,
|
|
3819
|
-
// sorting
|
|
3820
|
-
sort: {},
|
|
3821
|
-
};
|
|
3822
|
-
return reduce(columns, (res, colData) => {
|
|
3823
|
-
// Grouped column
|
|
3824
|
-
if (isColGrouping(colData)) {
|
|
3825
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
3826
|
-
}
|
|
3827
|
-
// Column type
|
|
3828
|
-
const columnDefinitionFromType = colData.columnType && (types === null || types === void 0 ? void 0 : types[colData.columnType]);
|
|
3829
|
-
// Regular column
|
|
3830
|
-
const regularColumn = Object.assign(Object.assign({}, columnDefinitionFromType), colData);
|
|
3831
|
-
// Regular column, no Pin
|
|
3832
|
-
if (!regularColumn.pin) {
|
|
3833
|
-
res.columns.rgCol.push(regularColumn);
|
|
3834
|
-
// Pin
|
|
3538
|
+
function mergeSortedArray(arr1, arr2, compareFn = simpleCompare) {
|
|
3539
|
+
const merged = [];
|
|
3540
|
+
let index1 = 0;
|
|
3541
|
+
let index2 = 0;
|
|
3542
|
+
let current = 0;
|
|
3543
|
+
while (current < arr1.length + arr2.length) {
|
|
3544
|
+
let isArr1Depleted = index1 >= arr1.length;
|
|
3545
|
+
let isArr2Depleted = index2 >= arr2.length;
|
|
3546
|
+
if (!isArr1Depleted && (isArr2Depleted || compareFn(arr1[index1], arr2[index2]))) {
|
|
3547
|
+
merged[current] = arr1[index1];
|
|
3548
|
+
index1++;
|
|
3835
3549
|
}
|
|
3836
3550
|
else {
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
if (regularColumn.order) {
|
|
3840
|
-
res.sort[regularColumn.prop] = regularColumn;
|
|
3841
|
-
}
|
|
3842
|
-
// it's possible that some columns have same prop, but better to avoid it
|
|
3843
|
-
if (!res.columnByProp[regularColumn.prop]) {
|
|
3844
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
3845
|
-
}
|
|
3846
|
-
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
3847
|
-
// trigger setup hook if present
|
|
3848
|
-
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
3849
|
-
return res;
|
|
3850
|
-
}, collection);
|
|
3851
|
-
}
|
|
3852
|
-
function gatherGroup(res, colData, collection, level = 0) {
|
|
3853
|
-
// group template
|
|
3854
|
-
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
3855
|
-
// check columns for update
|
|
3856
|
-
for (let k in collection.columns) {
|
|
3857
|
-
const key = k;
|
|
3858
|
-
const resultItem = res.columns[key];
|
|
3859
|
-
const collectionItem = collection.columns[key];
|
|
3860
|
-
// if column data
|
|
3861
|
-
if (isArray$1(resultItem) && isArray$1(collectionItem)) {
|
|
3862
|
-
// fill columns
|
|
3863
|
-
resultItem.push(...collectionItem);
|
|
3864
|
-
// fill grouping
|
|
3865
|
-
if (collectionItem.length) {
|
|
3866
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
3867
|
-
}
|
|
3551
|
+
merged[current] = arr2[index2];
|
|
3552
|
+
index2++;
|
|
3868
3553
|
}
|
|
3554
|
+
current++;
|
|
3869
3555
|
}
|
|
3870
|
-
|
|
3871
|
-
for (let k in collection.columnGrouping) {
|
|
3872
|
-
const key = k;
|
|
3873
|
-
const collectionItem = collection.columnGrouping[key];
|
|
3874
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
3875
|
-
}
|
|
3876
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
3877
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
3878
|
-
return res;
|
|
3879
|
-
}
|
|
3880
|
-
function findColumn(columns, prop) {
|
|
3881
|
-
for (const c of columns) {
|
|
3882
|
-
if (isColGrouping(c)) {
|
|
3883
|
-
const found = findColumn(c.children, prop);
|
|
3884
|
-
if (found) {
|
|
3885
|
-
return found;
|
|
3886
|
-
}
|
|
3887
|
-
}
|
|
3888
|
-
else if (c.prop === prop) {
|
|
3889
|
-
return c;
|
|
3890
|
-
}
|
|
3891
|
-
}
|
|
3892
|
-
return undefined;
|
|
3893
|
-
}
|
|
3894
|
-
function getColumnByProp(columns, prop) {
|
|
3895
|
-
return findColumn(columns, prop);
|
|
3896
|
-
}
|
|
3897
|
-
|
|
3898
|
-
const GROUP_DEPTH = `${index.GRID_INTERNALS}-depth`;
|
|
3899
|
-
const PSEUDO_GROUP_ITEM = `${index.GRID_INTERNALS}-name`;
|
|
3900
|
-
const PSEUDO_GROUP_ITEM_ID = `${index.GRID_INTERNALS}-id`;
|
|
3901
|
-
const PSEUDO_GROUP_ITEM_VALUE = `${index.GRID_INTERNALS}-value`;
|
|
3902
|
-
const PSEUDO_GROUP_COLUMN = `${index.GRID_INTERNALS}-column`;
|
|
3903
|
-
const GROUP_EXPANDED = `${index.GRID_INTERNALS}-expanded`;
|
|
3904
|
-
const GROUP_ORIGINAL_INDEX = `${index.GRID_INTERNALS}-original-index`;
|
|
3905
|
-
const GROUP_EXPAND_BTN = `group-expand`;
|
|
3906
|
-
const GROUP_EXPAND_EVENT = `groupexpandclick`;
|
|
3907
|
-
const GROUPING_ROW_TYPE = 'rgRow';
|
|
3908
|
-
|
|
3909
|
-
function getGroupValueDefault(item, prop) {
|
|
3910
|
-
return item[prop] || null;
|
|
3556
|
+
return merged;
|
|
3911
3557
|
}
|
|
3912
3558
|
/**
|
|
3913
|
-
*
|
|
3914
|
-
* @param array - flat data array
|
|
3915
|
-
* @param groupIds - ids of groups
|
|
3916
|
-
* @param expanded - potentially expanded items if present
|
|
3917
|
-
*/
|
|
3918
|
-
function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
|
|
3919
|
-
const groupedItems = new Map();
|
|
3920
|
-
array.forEach((item, originalIndex) => {
|
|
3921
|
-
const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
|
|
3922
|
-
const lastLevelValue = groupLevelValues.pop();
|
|
3923
|
-
let currentGroupLevel = groupedItems;
|
|
3924
|
-
groupLevelValues.forEach(value => {
|
|
3925
|
-
if (!currentGroupLevel.has(value)) {
|
|
3926
|
-
currentGroupLevel.set(value, new Map());
|
|
3927
|
-
}
|
|
3928
|
-
currentGroupLevel = currentGroupLevel.get(value);
|
|
3929
|
-
});
|
|
3930
|
-
if (!currentGroupLevel.has(lastLevelValue)) {
|
|
3931
|
-
currentGroupLevel.set(lastLevelValue, []);
|
|
3932
|
-
}
|
|
3933
|
-
const lastLevelItems = currentGroupLevel.get(lastLevelValue);
|
|
3934
|
-
lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
|
|
3935
|
-
});
|
|
3936
|
-
let itemIndex = -1;
|
|
3937
|
-
const groupingDepth = groupIds.length;
|
|
3938
|
-
// collapse all groups in the beginning
|
|
3939
|
-
const trimmed = {};
|
|
3940
|
-
// index mapping
|
|
3941
|
-
const oldNewIndexMap = {};
|
|
3942
|
-
// check if group header exists
|
|
3943
|
-
const pseudoGroupTest = {};
|
|
3944
|
-
const sourceWithGroups = [];
|
|
3945
|
-
function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
|
|
3946
|
-
const depth = parentIds.length;
|
|
3947
|
-
groupedValues.forEach((innerGroupedValues, groupId) => {
|
|
3948
|
-
const levelIds = [...parentIds, groupId];
|
|
3949
|
-
const mergedIds = levelIds.join(',');
|
|
3950
|
-
const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
|
|
3951
|
-
sourceWithGroups.push({
|
|
3952
|
-
[PSEUDO_GROUP_ITEM]: groupId,
|
|
3953
|
-
[GROUP_DEPTH]: depth,
|
|
3954
|
-
[PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
|
|
3955
|
-
[PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
|
|
3956
|
-
[GROUP_EXPANDED]: isGroupExpanded,
|
|
3957
|
-
});
|
|
3958
|
-
itemIndex += 1;
|
|
3959
|
-
if (!isGroupExpanded && depth) {
|
|
3960
|
-
trimmed[itemIndex] = true;
|
|
3961
|
-
}
|
|
3962
|
-
if (Array.isArray(innerGroupedValues)) {
|
|
3963
|
-
innerGroupedValues.forEach(value => {
|
|
3964
|
-
itemIndex += 1;
|
|
3965
|
-
if (!isGroupExpanded) {
|
|
3966
|
-
trimmed[itemIndex] = true;
|
|
3967
|
-
}
|
|
3968
|
-
oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
|
|
3969
|
-
const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
|
|
3970
|
-
pseudoGroupTestIds.forEach(pseudoGroupTestId => {
|
|
3971
|
-
if (!pseudoGroupTest[pseudoGroupTestId]) {
|
|
3972
|
-
pseudoGroupTest[pseudoGroupTestId] = [];
|
|
3973
|
-
}
|
|
3974
|
-
pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
|
|
3975
|
-
});
|
|
3976
|
-
});
|
|
3977
|
-
sourceWithGroups.push(...innerGroupedValues);
|
|
3978
|
-
}
|
|
3979
|
-
else {
|
|
3980
|
-
flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
|
|
3981
|
-
}
|
|
3982
|
-
});
|
|
3983
|
-
}
|
|
3984
|
-
flattenGroupMaps(groupedItems, [], true);
|
|
3985
|
-
return {
|
|
3986
|
-
sourceWithGroups, // updates source mirror
|
|
3987
|
-
depth: groupingDepth, // largest depth for grouping
|
|
3988
|
-
trimmed, // used for expand/collapse grouping values
|
|
3989
|
-
oldNewIndexMap, // used for mapping old values to new
|
|
3990
|
-
childrenByGroup: pseudoGroupTest, // used to get child items in group
|
|
3991
|
-
};
|
|
3992
|
-
}
|
|
3993
|
-
function getGroupingName(rgRow) {
|
|
3994
|
-
return rgRow && rgRow[PSEUDO_GROUP_ITEM];
|
|
3995
|
-
}
|
|
3996
|
-
function isGrouping(rgRow) {
|
|
3997
|
-
return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
|
|
3998
|
-
}
|
|
3999
|
-
function isGroupingColumn(column) {
|
|
4000
|
-
return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
|
|
4001
|
-
}
|
|
4002
|
-
function measureEqualDepth(groupA, groupB) {
|
|
4003
|
-
const ln = groupA.length;
|
|
4004
|
-
let i = 0;
|
|
4005
|
-
for (; i < ln; i++) {
|
|
4006
|
-
if (groupA[i] !== groupB[i]) {
|
|
4007
|
-
return i;
|
|
4008
|
-
}
|
|
4009
|
-
}
|
|
4010
|
-
return i;
|
|
4011
|
-
}
|
|
4012
|
-
function getParsedGroup(id) {
|
|
4013
|
-
const parseGroup = JSON.parse(id);
|
|
4014
|
-
// extra precaution and type safeguard
|
|
4015
|
-
if (!Array.isArray(parseGroup)) {
|
|
4016
|
-
return null;
|
|
4017
|
-
}
|
|
4018
|
-
return parseGroup;
|
|
4019
|
-
}
|
|
4020
|
-
// check if items is child of current clicked group
|
|
4021
|
-
function isSameGroup(currentGroup, currentModel, nextModel) {
|
|
4022
|
-
const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
|
|
4023
|
-
if (!nextGroup) {
|
|
4024
|
-
return false;
|
|
4025
|
-
}
|
|
4026
|
-
const depth = measureEqualDepth(currentGroup, nextGroup);
|
|
4027
|
-
return currentModel[GROUP_DEPTH] < depth;
|
|
4028
|
-
}
|
|
4029
|
-
|
|
4030
|
-
/**
|
|
4031
|
-
* The base implementation of `_.slice` without an iteratee call guard.
|
|
4032
|
-
*
|
|
4033
|
-
* @private
|
|
4034
|
-
* @param {Array} array The array to slice.
|
|
4035
|
-
* @param {number} [start=0] The start position.
|
|
4036
|
-
* @param {number} [end=array.length] The end position.
|
|
4037
|
-
* @returns {Array} Returns the slice of `array`.
|
|
3559
|
+
* Calculate system scrollbar size
|
|
4038
3560
|
*/
|
|
4039
|
-
function
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
return result;
|
|
3561
|
+
function getScrollbarSize(document) {
|
|
3562
|
+
// Create a temporary div container and append it to the body
|
|
3563
|
+
const container = document.createElement('div');
|
|
3564
|
+
// Apply styling to ensure the div is scrollable
|
|
3565
|
+
container.style.overflow = 'scroll';
|
|
3566
|
+
container.style.visibility = 'hidden'; // make sure the container isn't visible
|
|
3567
|
+
container.style.position = 'absolute';
|
|
3568
|
+
container.style.top = '-9999px'; // move it out of the screen
|
|
3569
|
+
container.style.width = '50px'; // arbitrary width
|
|
3570
|
+
container.style.height = '50px'; // arbitrary height
|
|
3571
|
+
// Append the div to the body
|
|
3572
|
+
document.body.appendChild(container);
|
|
3573
|
+
// Calculate the width of the scrollbar
|
|
3574
|
+
const scrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
3575
|
+
// Remove the div from the body after calculation
|
|
3576
|
+
document.body.removeChild(container);
|
|
3577
|
+
// Return the calculated width of the scrollbar
|
|
3578
|
+
return scrollbarWidth;
|
|
4058
3579
|
}
|
|
4059
|
-
|
|
4060
|
-
/**
|
|
4061
|
-
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
3580
|
+
/* Scale a value between 2 ranges
|
|
4062
3581
|
*
|
|
4063
|
-
*
|
|
4064
|
-
*
|
|
4065
|
-
*
|
|
3582
|
+
* Sample:
|
|
3583
|
+
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
3584
|
+
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
4066
3585
|
*
|
|
4067
|
-
*
|
|
4068
|
-
* @
|
|
4069
|
-
* @
|
|
4070
|
-
*
|
|
4071
|
-
*
|
|
4072
|
-
* @param {number} [start=0] The start position.
|
|
4073
|
-
* @param {number} [end=array.length] The end position.
|
|
4074
|
-
* @returns {Array} Returns the slice of `array`.
|
|
3586
|
+
* Ranges of two values
|
|
3587
|
+
* @from
|
|
3588
|
+
* @to
|
|
3589
|
+
*
|
|
3590
|
+
* ~~ return value does the equivalent of Math.floor but faster.
|
|
4075
3591
|
*/
|
|
4076
|
-
function
|
|
4077
|
-
|
|
4078
|
-
if (!length) {
|
|
4079
|
-
return [];
|
|
4080
|
-
}
|
|
4081
|
-
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
|
|
4082
|
-
start = 0;
|
|
4083
|
-
end = length;
|
|
4084
|
-
}
|
|
4085
|
-
else {
|
|
4086
|
-
start = start == null ? 0 : toInteger(start);
|
|
4087
|
-
end = end === undefined ? length : toInteger(end);
|
|
4088
|
-
}
|
|
4089
|
-
return baseSlice(array, start, end);
|
|
4090
|
-
}
|
|
4091
|
-
|
|
4092
|
-
class ColumnService {
|
|
4093
|
-
get columns() {
|
|
4094
|
-
return getVisibleSourceItem(this.source);
|
|
4095
|
-
}
|
|
4096
|
-
constructor(dataStore, source) {
|
|
4097
|
-
this.dataStore = dataStore;
|
|
4098
|
-
this.source = source;
|
|
4099
|
-
this.unsubscribe = [];
|
|
4100
|
-
this.hasGrouping = false;
|
|
4101
|
-
this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
|
|
4102
|
-
this.checkGrouping(source.get('source'));
|
|
4103
|
-
this.type = source.get('type');
|
|
4104
|
-
}
|
|
4105
|
-
checkGrouping(cols) {
|
|
4106
|
-
for (let rgCol of cols) {
|
|
4107
|
-
if (isGroupingColumn(rgCol)) {
|
|
4108
|
-
this.hasGrouping = true;
|
|
4109
|
-
return;
|
|
4110
|
-
}
|
|
4111
|
-
this.hasGrouping = false;
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
|
-
isReadOnly(r, c) {
|
|
4115
|
-
var _a;
|
|
4116
|
-
const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
|
|
4117
|
-
if (typeof readOnly === 'function') {
|
|
4118
|
-
const data = this.rowDataModel(r, c);
|
|
4119
|
-
return readOnly(data);
|
|
4120
|
-
}
|
|
4121
|
-
return !!readOnly;
|
|
4122
|
-
}
|
|
4123
|
-
mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
|
|
4124
|
-
const props = Object.assign({}, defaultProps);
|
|
4125
|
-
props.class = Object.assign(Object.assign({}, (typeof props.class === 'string'
|
|
4126
|
-
? { [props.class]: true }
|
|
4127
|
-
: props.class)), { [index.CELL_CLASS]: true, [index.DISABLED_CLASS]: this.isReadOnly(r, c) });
|
|
4128
|
-
const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
|
|
4129
|
-
if (!extra) {
|
|
4130
|
-
return props;
|
|
4131
|
-
}
|
|
4132
|
-
return doPropMerge(props, extra);
|
|
4133
|
-
}
|
|
4134
|
-
getRowClass(r, prop) {
|
|
4135
|
-
const model = getSourceItem(this.dataStore, r) || {};
|
|
4136
|
-
return model[prop] || '';
|
|
4137
|
-
}
|
|
4138
|
-
getCellData(r, c) {
|
|
4139
|
-
const data = this.rowDataModel(r, c);
|
|
4140
|
-
return getCellData(data.model[data.prop]);
|
|
4141
|
-
}
|
|
4142
|
-
getSaveData(rowIndex, colIndex, val) {
|
|
4143
|
-
const data = this.rowDataModel(rowIndex, colIndex);
|
|
4144
|
-
if (typeof val === 'undefined') {
|
|
4145
|
-
val = getCellData(data.model[data.prop]);
|
|
4146
|
-
}
|
|
4147
|
-
return {
|
|
4148
|
-
prop: data.prop,
|
|
4149
|
-
rowIndex,
|
|
4150
|
-
colIndex,
|
|
4151
|
-
val,
|
|
4152
|
-
model: data.model,
|
|
4153
|
-
colType: this.type,
|
|
4154
|
-
type: this.dataStore.get('type'),
|
|
4155
|
-
};
|
|
4156
|
-
}
|
|
4157
|
-
getCellEditor(_r, c, editors) {
|
|
4158
|
-
var _a;
|
|
4159
|
-
const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
|
|
4160
|
-
if (!editor) {
|
|
4161
|
-
return undefined;
|
|
4162
|
-
}
|
|
4163
|
-
// reference
|
|
4164
|
-
if (typeof editor === 'string') {
|
|
4165
|
-
return editors[editor];
|
|
4166
|
-
}
|
|
4167
|
-
return editor;
|
|
4168
|
-
}
|
|
4169
|
-
/**
|
|
4170
|
-
* Get cell data model for given rowIndex and colIndex
|
|
4171
|
-
* Used to pass data to editor/renderer
|
|
4172
|
-
*/
|
|
4173
|
-
rowDataModel(rowIndex, colIndex) {
|
|
4174
|
-
const column = this.columns[colIndex];
|
|
4175
|
-
const prop = column === null || column === void 0 ? void 0 : column.prop;
|
|
4176
|
-
const model = getSourceItem(this.dataStore, rowIndex) || {};
|
|
4177
|
-
const value = model[prop];
|
|
4178
|
-
const type = this.dataStore.get('type');
|
|
4179
|
-
return {
|
|
4180
|
-
prop,
|
|
4181
|
-
model,
|
|
4182
|
-
data: this.dataStore.get('source'),
|
|
4183
|
-
column,
|
|
4184
|
-
rowIndex,
|
|
4185
|
-
colIndex,
|
|
4186
|
-
colType: this.type,
|
|
4187
|
-
type,
|
|
4188
|
-
value,
|
|
4189
|
-
};
|
|
4190
|
-
}
|
|
4191
|
-
getRangeData(d, columns) {
|
|
4192
|
-
var _a;
|
|
4193
|
-
const changed = {};
|
|
4194
|
-
// get original length sizes
|
|
4195
|
-
const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
|
|
4196
|
-
const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
|
|
4197
|
-
const mapping = {};
|
|
4198
|
-
// rows
|
|
4199
|
-
for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
|
|
4200
|
-
// copy original data link
|
|
4201
|
-
const oldRowIndex = d.oldRange.y + (i % copyRowLength);
|
|
4202
|
-
const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
|
|
4203
|
-
// columns
|
|
4204
|
-
for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
|
|
4205
|
-
// check if old range area
|
|
4206
|
-
if (rowIndex >= d.oldRange.y &&
|
|
4207
|
-
rowIndex <= d.oldRange.y1 &&
|
|
4208
|
-
colIndex >= d.oldRange.x &&
|
|
4209
|
-
colIndex <= d.oldRange.x1) {
|
|
4210
|
-
continue;
|
|
4211
|
-
}
|
|
4212
|
-
// requested column beyond range
|
|
4213
|
-
if (!this.columns[colIndex]) {
|
|
4214
|
-
continue;
|
|
4215
|
-
}
|
|
4216
|
-
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
4217
|
-
const copyColIndex = d.oldRange.x + (j % copyColLength);
|
|
4218
|
-
const copyColumnProp = columns[copyColIndex].prop;
|
|
4219
|
-
/** if can write */
|
|
4220
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
4221
|
-
/** to show before save */
|
|
4222
|
-
if (!changed[rowIndex]) {
|
|
4223
|
-
changed[rowIndex] = {};
|
|
4224
|
-
}
|
|
4225
|
-
changed[rowIndex][prop] = copyRow[copyColumnProp];
|
|
4226
|
-
/** Generate mapping object */
|
|
4227
|
-
if (!mapping[rowIndex]) {
|
|
4228
|
-
mapping[rowIndex] = {};
|
|
4229
|
-
}
|
|
4230
|
-
mapping[rowIndex][prop] = {
|
|
4231
|
-
colIndex: copyColIndex,
|
|
4232
|
-
colProp: copyColumnProp,
|
|
4233
|
-
rowIndex: oldRowIndex,
|
|
4234
|
-
};
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
}
|
|
4238
|
-
return {
|
|
4239
|
-
changed,
|
|
4240
|
-
mapping,
|
|
4241
|
-
};
|
|
4242
|
-
}
|
|
4243
|
-
getTransformedDataToApply(start, data) {
|
|
4244
|
-
const changed = {};
|
|
4245
|
-
const copyRowLength = data.length;
|
|
4246
|
-
const colLength = this.columns.length;
|
|
4247
|
-
const rowLength = this.dataStore.get('items').length;
|
|
4248
|
-
// rows
|
|
4249
|
-
let rowIndex = start.y;
|
|
4250
|
-
let maxCol = 0;
|
|
4251
|
-
for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
|
|
4252
|
-
// copy original data link
|
|
4253
|
-
const copyRow = data[i % copyRowLength];
|
|
4254
|
-
const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
|
|
4255
|
-
// columns
|
|
4256
|
-
let colIndex = start.x;
|
|
4257
|
-
for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
|
|
4258
|
-
const p = this.columns[colIndex].prop;
|
|
4259
|
-
const currentCol = j % colLength;
|
|
4260
|
-
/** if can write */
|
|
4261
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
4262
|
-
/** to show before save */
|
|
4263
|
-
if (!changed[rowIndex]) {
|
|
4264
|
-
changed[rowIndex] = {};
|
|
4265
|
-
}
|
|
4266
|
-
changed[rowIndex][p] = copyRow[currentCol];
|
|
4267
|
-
}
|
|
4268
|
-
}
|
|
4269
|
-
maxCol = Math.max(maxCol, colIndex - 1);
|
|
4270
|
-
}
|
|
4271
|
-
const range = getRange(start, {
|
|
4272
|
-
y: rowIndex - 1,
|
|
4273
|
-
x: maxCol,
|
|
4274
|
-
});
|
|
4275
|
-
return {
|
|
4276
|
-
changed,
|
|
4277
|
-
range,
|
|
4278
|
-
};
|
|
4279
|
-
}
|
|
4280
|
-
getRangeStaticData(d, value) {
|
|
4281
|
-
const changed = {};
|
|
4282
|
-
// rows
|
|
4283
|
-
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
4284
|
-
// columns
|
|
4285
|
-
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
4286
|
-
// requested column beyond range
|
|
4287
|
-
if (!this.columns[colIndex]) {
|
|
4288
|
-
continue;
|
|
4289
|
-
}
|
|
4290
|
-
const p = this.columns[colIndex].prop;
|
|
4291
|
-
/** if can write */
|
|
4292
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
4293
|
-
/** to show before save */
|
|
4294
|
-
if (!changed[rowIndex]) {
|
|
4295
|
-
changed[rowIndex] = {};
|
|
4296
|
-
}
|
|
4297
|
-
changed[rowIndex][p] = value;
|
|
4298
|
-
}
|
|
4299
|
-
}
|
|
4300
|
-
}
|
|
4301
|
-
return changed;
|
|
4302
|
-
}
|
|
4303
|
-
getRangeTransformedToProps(d, store) {
|
|
4304
|
-
var _a;
|
|
4305
|
-
const area = [];
|
|
4306
|
-
const type = this.dataStore.get('type');
|
|
4307
|
-
// rows
|
|
4308
|
-
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
4309
|
-
// columns
|
|
4310
|
-
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
4311
|
-
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
4312
|
-
area.push({
|
|
4313
|
-
prop,
|
|
4314
|
-
rowIndex,
|
|
4315
|
-
colIndex,
|
|
4316
|
-
model: getSourceItem(store, rowIndex),
|
|
4317
|
-
type,
|
|
4318
|
-
colType: this.type,
|
|
4319
|
-
});
|
|
4320
|
-
}
|
|
4321
|
-
}
|
|
4322
|
-
return area;
|
|
4323
|
-
}
|
|
4324
|
-
copyRangeArray(range, store) {
|
|
4325
|
-
const cols = [...this.columns];
|
|
4326
|
-
const props = slice(cols, range.x, range.x1 + 1).map(v => v.prop);
|
|
4327
|
-
const toCopy = [];
|
|
4328
|
-
const mapping = {};
|
|
4329
|
-
// rows indexes
|
|
4330
|
-
for (let i = range.y; i <= range.y1; i++) {
|
|
4331
|
-
const rgRow = [];
|
|
4332
|
-
mapping[i] = {};
|
|
4333
|
-
// columns indexes
|
|
4334
|
-
for (let prop of props) {
|
|
4335
|
-
const item = getSourceItem(store, i);
|
|
4336
|
-
// if no item - skip
|
|
4337
|
-
if (!item) {
|
|
4338
|
-
continue;
|
|
4339
|
-
}
|
|
4340
|
-
const val = item[prop];
|
|
4341
|
-
rgRow.push(val);
|
|
4342
|
-
mapping[i][prop] = val;
|
|
4343
|
-
}
|
|
4344
|
-
toCopy.push(rgRow);
|
|
4345
|
-
}
|
|
4346
|
-
return {
|
|
4347
|
-
data: toCopy,
|
|
4348
|
-
mapping,
|
|
4349
|
-
};
|
|
4350
|
-
}
|
|
4351
|
-
destroy() {
|
|
4352
|
-
this.unsubscribe.forEach(f => f());
|
|
4353
|
-
}
|
|
3592
|
+
function scaleValue(value, from, to) {
|
|
3593
|
+
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
4354
3594
|
}
|
|
4355
3595
|
/**
|
|
4356
|
-
*
|
|
3596
|
+
* Async timeout
|
|
4357
3597
|
*/
|
|
4358
|
-
function
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
}
|
|
4362
|
-
return !!rowDrag;
|
|
4363
|
-
}
|
|
4364
|
-
function mergeClasses(class1 = {}, class2 = {}) {
|
|
4365
|
-
if (typeof class1 === 'string') {
|
|
4366
|
-
class1 = { [class1]: true };
|
|
4367
|
-
}
|
|
4368
|
-
if (typeof class2 === 'string') {
|
|
4369
|
-
class2 = { [class2]: true };
|
|
4370
|
-
}
|
|
4371
|
-
return Object.assign(Object.assign({}, class1), class2);
|
|
3598
|
+
async function timeout(delay = 0) {
|
|
3599
|
+
await new Promise((r) => {
|
|
3600
|
+
setTimeout(() => r(), delay);
|
|
3601
|
+
});
|
|
4372
3602
|
}
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
props.class = mergeClasses(props.class, extra.class);
|
|
4383
|
-
}
|
|
4384
|
-
if (extra.style) {
|
|
4385
|
-
props.style = Object.assign(Object.assign({}, extra.style), props.style);
|
|
4386
|
-
}
|
|
4387
|
-
return props;
|
|
3603
|
+
/**
|
|
3604
|
+
* Type script mixins
|
|
3605
|
+
*/
|
|
3606
|
+
function applyMixins(derivedCtor, constructors) {
|
|
3607
|
+
constructors.forEach(baseCtor => {
|
|
3608
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
3609
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
|
|
3610
|
+
});
|
|
3611
|
+
});
|
|
4388
3612
|
}
|
|
4389
3613
|
|
|
4390
|
-
exports.
|
|
3614
|
+
exports.CELL_CLASS = CELL_CLASS;
|
|
3615
|
+
exports.CELL_HANDLER_CLASS = CELL_HANDLER_CLASS;
|
|
3616
|
+
exports.DATA_COL = DATA_COL;
|
|
3617
|
+
exports.DATA_ROW = DATA_ROW;
|
|
3618
|
+
exports.DISABLED_CLASS = DISABLED_CLASS;
|
|
3619
|
+
exports.DRAGGABLE_CLASS = DRAGGABLE_CLASS;
|
|
3620
|
+
exports.DRAGG_TEXT = DRAGG_TEXT;
|
|
3621
|
+
exports.DRAG_ICON_CLASS = DRAG_ICON_CLASS;
|
|
4391
3622
|
exports.DataStore = DataStore;
|
|
4392
|
-
exports.
|
|
4393
|
-
exports.
|
|
4394
|
-
exports.
|
|
4395
|
-
exports.
|
|
4396
|
-
exports.
|
|
4397
|
-
exports.
|
|
4398
|
-
exports.
|
|
4399
|
-
exports.
|
|
4400
|
-
exports.
|
|
4401
|
-
exports.
|
|
4402
|
-
exports.
|
|
4403
|
-
exports.
|
|
4404
|
-
exports.
|
|
3623
|
+
exports.EDIT_INPUT_WR = EDIT_INPUT_WR;
|
|
3624
|
+
exports.FOCUS_CLASS = FOCUS_CLASS;
|
|
3625
|
+
exports.GRID_INTERNALS = GRID_INTERNALS;
|
|
3626
|
+
exports.HEADER_ACTUAL_ROW_CLASS = HEADER_ACTUAL_ROW_CLASS;
|
|
3627
|
+
exports.HEADER_CLASS = HEADER_CLASS;
|
|
3628
|
+
exports.HEADER_ROW_CLASS = HEADER_ROW_CLASS;
|
|
3629
|
+
exports.HEADER_SORTABLE_CLASS = HEADER_SORTABLE_CLASS;
|
|
3630
|
+
exports.KeyCodesEnum = KeyCodesEnum;
|
|
3631
|
+
exports.MIN_COL_SIZE = MIN_COL_SIZE;
|
|
3632
|
+
exports.MOBILE_CLASS = MOBILE_CLASS;
|
|
3633
|
+
exports.OsPlatform = OsPlatform;
|
|
3634
|
+
exports.RESIZE_INTERVAL = RESIZE_INTERVAL;
|
|
3635
|
+
exports.ROW_FOCUSED_CLASS = ROW_FOCUSED_CLASS;
|
|
3636
|
+
exports.ROW_HEADER_TYPE = ROW_HEADER_TYPE;
|
|
3637
|
+
exports.SELECTION_BORDER_CLASS = SELECTION_BORDER_CLASS;
|
|
3638
|
+
exports.TMP_SELECTION_BG_CLASS = TMP_SELECTION_BG_CLASS;
|
|
3639
|
+
exports.applyMixins = applyMixins;
|
|
4405
3640
|
exports.baseIteratee = baseIteratee;
|
|
4406
3641
|
exports.baseKeys = baseKeys;
|
|
4407
3642
|
exports.baseProperty = baseProperty;
|
|
3643
|
+
exports.calculateDimensionData = calculateDimensionData;
|
|
4408
3644
|
exports.createStore = createStore;
|
|
4409
|
-
exports.cropCellToMax = cropCellToMax;
|
|
4410
|
-
exports.doPropMerge = doPropMerge;
|
|
4411
3645
|
exports.findIndex = findIndex;
|
|
4412
|
-
exports.
|
|
4413
|
-
exports.gatherGrouping = gatherGrouping;
|
|
3646
|
+
exports.findPositionInArray = findPositionInArray;
|
|
4414
3647
|
exports.gatherTrimmedItems = gatherTrimmedItems;
|
|
4415
|
-
exports.
|
|
4416
|
-
exports.
|
|
4417
|
-
exports.getColumnByProp = getColumnByProp;
|
|
4418
|
-
exports.getColumnSizes = getColumnSizes;
|
|
4419
|
-
exports.getColumnType = getColumnType;
|
|
4420
|
-
exports.getColumns = getColumns;
|
|
4421
|
-
exports.getGroupingName = getGroupingName;
|
|
3648
|
+
exports.getItemByIndex = getItemByIndex;
|
|
3649
|
+
exports.getItemByPosition = getItemByPosition;
|
|
4422
3650
|
exports.getNative = getNative;
|
|
4423
|
-
exports.getParsedGroup = getParsedGroup;
|
|
4424
3651
|
exports.getPhysical = getPhysical;
|
|
4425
|
-
exports.
|
|
3652
|
+
exports.getScrollbarSize = getScrollbarSize;
|
|
4426
3653
|
exports.getSourceItem = getSourceItem;
|
|
4427
3654
|
exports.getSourceItemVirtualIndexByProp = getSourceItemVirtualIndexByProp;
|
|
4428
3655
|
exports.getSourcePhysicalIndex = getSourcePhysicalIndex;
|
|
4429
3656
|
exports.getTag = getTag$1;
|
|
4430
3657
|
exports.getVisibleSourceItem = getVisibleSourceItem;
|
|
3658
|
+
exports.identity = identity;
|
|
4431
3659
|
exports.isArray = isArray$1;
|
|
4432
3660
|
exports.isArrayLike = isArrayLike;
|
|
4433
|
-
exports.isColGrouping = isColGrouping;
|
|
4434
|
-
exports.isGrouping = isGrouping;
|
|
4435
|
-
exports.isGroupingColumn = isGroupingColumn;
|
|
4436
|
-
exports.isHiddenStore = isHiddenStore;
|
|
4437
3661
|
exports.isIterateeCall = isIterateeCall;
|
|
4438
|
-
exports.
|
|
4439
|
-
exports.
|
|
4440
|
-
exports.isSameGroup = isSameGroup;
|
|
4441
|
-
exports.nextCell = nextCell;
|
|
3662
|
+
exports.keys = keys;
|
|
3663
|
+
exports.mergeSortedArray = mergeSortedArray;
|
|
4442
3664
|
exports.proxyPlugin = proxyPlugin;
|
|
4443
|
-
exports.
|
|
3665
|
+
exports.pushSorted = pushSorted;
|
|
3666
|
+
exports.range = range;
|
|
3667
|
+
exports.scaleValue = scaleValue;
|
|
4444
3668
|
exports.setItems = setItems;
|
|
4445
3669
|
exports.setSourceByPhysicalIndex = setSourceByPhysicalIndex;
|
|
4446
3670
|
exports.setSourceByVirtualIndex = setSourceByVirtualIndex;
|
|
4447
3671
|
exports.setStore = setStore;
|
|
3672
|
+
exports.timeout = timeout;
|
|
4448
3673
|
exports.toInteger = toInteger;
|
|
4449
3674
|
exports.trimmedPlugin = trimmedPlugin;
|
|
4450
3675
|
|
|
4451
|
-
//# sourceMappingURL=
|
|
3676
|
+
//# sourceMappingURL=index-91e92bea.js.map
|