@revolist/revogrid 4.9.41 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{column.drag.plugin-fcd892ec.js → column.drag.plugin-08ca04f4.js} +129 -58
- 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-179c0800.js → edit.utils-4a790cf8.js} +2 -2
- package/dist/cjs/{edit.utils-179c0800.js.map → edit.utils-4a790cf8.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-d879d95e.js → header-cell-renderer-db089f54.js} +2 -2
- package/dist/cjs/{header-cell-renderer-d879d95e.js.map → header-cell-renderer-db089f54.js.map} +1 -1
- package/dist/cjs/{column.service-26c61ed6.js → index-91e92bea.js} +455 -1235
- package/dist/cjs/index-91e92bea.js.map +1 -0
- package/dist/cjs/index.cjs.js +21 -20
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{key.utils-f49d7bee.js → key.utils-e65c24e6.js} +2 -2
- package/dist/cjs/{key.utils-f49d7bee.js.map → key.utils-e65c24e6.js.map} +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +47 -56
- 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 +41 -18
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/{row-header-utils-c37f76e4.js → row-header-utils-dc3d3185.js} +5 -6
- package/dist/cjs/row-header-utils-dc3d3185.js.map +1 -0
- package/dist/cjs/{text-editor-b756d6b3.js → text-editor-a32a3993.js} +3 -3
- package/dist/cjs/{text-editor-b756d6b3.js.map → text-editor-a32a3993.js.map} +1 -1
- package/dist/cjs/{throttle-a57f51f9.js → throttle-da92b75d.js} +2 -2
- package/dist/cjs/{throttle-a57f51f9.js.map → throttle-da92b75d.js.map} +1 -1
- package/dist/collection/components/data/revogr-data.js +28 -3
- package/dist/collection/components/data/revogr-data.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 +7 -4
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +26 -8
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +3 -0
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/sorting/sorting.plugin.js +7 -4
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
- package/dist/collection/services/dimension.provider.js +7 -22
- package/dist/collection/services/dimension.provider.js.map +1 -1
- package/dist/collection/store/dataSource/trimmed.plugin.js +3 -8
- package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
- package/dist/collection/store/dimension/dimension.helpers.js +2 -5
- package/dist/collection/store/dimension/dimension.helpers.js.map +1 -1
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
- package/dist/collection/store/dimension/dimension.store.js +46 -66
- package/dist/collection/store/dimension/dimension.store.js.map +1 -1
- package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
- package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
- package/dist/collection/types/events.js +1 -0
- package/dist/collection/types/events.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/esm/{column.drag.plugin-3cc77986.js → column.drag.plugin-b7bba0da.js} +118 -47
- package/dist/esm/column.drag.plugin-b7bba0da.js.map +1 -0
- 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-6fc686b9.js → edit.utils-abcd0152.js} +2 -2
- package/dist/esm/{edit.utils-6fc686b9.js.map → edit.utils-abcd0152.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-32d2ed96.js → header-cell-renderer-fce020c3.js} +2 -2
- package/dist/esm/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-fce020c3.js.map} +1 -1
- package/dist/esm/{column.service-751345b2.js → index-b1e05212.js} +414 -1195
- package/dist/esm/index-b1e05212.js.map +1 -0
- package/dist/esm/index.js +9 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{key.utils-17273f42.js → key.utils-ea9aec31.js} +2 -2
- package/dist/esm/{key.utils-17273f42.js.map → key.utils-ea9aec31.js.map} +1 -1
- package/dist/esm/revo-grid.entry.js +27 -36
- 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 +37 -14
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +1 -1
- package/dist/esm/{row-header-utils-3dfbb81f.js → row-header-utils-7af8fcbf.js} +2 -3
- package/dist/esm/row-header-utils-7af8fcbf.js.map +1 -0
- package/dist/esm/{text-editor-901c3eb8.js → text-editor-fb3f24fe.js} +3 -3
- package/dist/esm/{text-editor-901c3eb8.js.map → text-editor-fb3f24fe.js.map} +1 -1
- package/dist/esm/{throttle-138d69c3.js → throttle-1f5772ef.js} +3 -3
- package/dist/esm/{throttle-138d69c3.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-b7bba0da.js.map +1 -0
- 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-6fc686b9.js → edit.utils-abcd0152.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-32d2ed96.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/index.esm.js.map +1 -1
- package/dist/revo-grid/key.utils-ea9aec31.js +5 -0
- package/dist/revo-grid/{key.utils-17273f42.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-3dfbb81f.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-138d69c3.js → throttle-1f5772ef.js} +2 -2
- package/dist/types/components/data/revogr-data.d.ts +6 -2
- package/dist/types/components/order/revogr-order-editor.d.ts +1 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +2 -6
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +1 -1
- package/dist/types/components.d.ts +9 -2
- package/dist/types/services/dimension.provider.d.ts +1 -1
- package/dist/types/store/dimension/dimension.helpers.d.ts +0 -3
- package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
- package/dist/types/store/dimension/dimension.store.d.ts +2 -1
- package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
- package/dist/types/types/events.d.ts +1 -1
- package/dist/types/types/interfaces.d.ts +6 -1
- package/hydrate/index.js +194 -116
- package/hydrate/index.mjs +194 -116
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +24 -10
- package/standalone/data.store.js.map +1 -1
- package/standalone/dimension.helpers.js +3 -6
- package/standalone/dimension.helpers.js.map +1 -1
- package/standalone/index.js +1 -0
- package/standalone/index.js.map +1 -1
- package/standalone/revo-grid.js +134 -73
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +6 -1
- package/standalone/revogr-data2.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/standalone/revogr-viewport-scroll2.js +26 -8
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/dist/cjs/column.drag.plugin-fcd892ec.js.map +0 -1
- package/dist/cjs/column.service-26c61ed6.js.map +0 -1
- package/dist/cjs/index-3ab26ab9.js +0 -513
- package/dist/cjs/index-3ab26ab9.js.map +0 -1
- package/dist/cjs/row-header-utils-c37f76e4.js.map +0 -1
- package/dist/esm/column.drag.plugin-3cc77986.js.map +0 -1
- package/dist/esm/column.service-751345b2.js.map +0 -1
- package/dist/esm/index-1dcad6ef.js +0 -476
- package/dist/esm/index-1dcad6ef.js.map +0 -1
- package/dist/esm/row-header-utils-3dfbb81f.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-3cc77986.js +0 -5
- package/dist/revo-grid/column.drag.plugin-3cc77986.js.map +0 -1
- package/dist/revo-grid/column.service-751345b2.js +0 -5
- package/dist/revo-grid/column.service-751345b2.js.map +0 -1
- package/dist/revo-grid/index-1dcad6ef.js +0 -5
- package/dist/revo-grid/index-1dcad6ef.js.map +0 -1
- package/dist/revo-grid/key.utils-17273f42.js +0 -5
- package/dist/revo-grid/row-header-utils-3dfbb81f.js +0 -5
- package/dist/revo-grid/text-editor-901c3eb8.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-6fc686b9.js.map → edit.utils-abcd0152.js.map} +0 -0
- /package/dist/revo-grid/{header-cell-renderer-32d2ed96.js.map → header-cell-renderer-fce020c3.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-901c3eb8.js.map → text-editor-fb3f24fe.js.map} +0 -0
- /package/dist/revo-grid/{throttle-138d69c3.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
|
};
|
|
@@ -2979,18 +2998,13 @@ const createStore = (defaultState, shouldUpdate) => {
|
|
|
2979
2998
|
const trimmedPlugin = (store) => ({
|
|
2980
2999
|
set(k, newVal) {
|
|
2981
3000
|
switch (k) {
|
|
2982
|
-
case 'trimmed':
|
|
3001
|
+
case 'trimmed': {
|
|
2983
3002
|
const proxy = store.get('proxyItems');
|
|
2984
3003
|
const trimmed = gatherTrimmedItems(newVal);
|
|
2985
|
-
const newItems = proxy.
|
|
2986
|
-
// check if present in new trimmed remove from items (filter)
|
|
2987
|
-
if (!trimmed[v]) {
|
|
2988
|
-
result.push(v);
|
|
2989
|
-
}
|
|
2990
|
-
return result;
|
|
2991
|
-
}, []);
|
|
3004
|
+
const newItems = proxy.filter(v => !trimmed[v]);
|
|
2992
3005
|
store.set('items', newItems);
|
|
2993
3006
|
break;
|
|
3007
|
+
}
|
|
2994
3008
|
}
|
|
2995
3009
|
},
|
|
2996
3010
|
});
|
|
@@ -3042,7 +3056,7 @@ class DataStore {
|
|
|
3042
3056
|
}
|
|
3043
3057
|
// clear items
|
|
3044
3058
|
this.store.set('items', []);
|
|
3045
|
-
const items = range$
|
|
3059
|
+
const items = range$2(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
|
|
3046
3060
|
// set proxy first
|
|
3047
3061
|
setStore(this.store, {
|
|
3048
3062
|
source,
|
|
@@ -3152,1305 +3166,511 @@ function getSourceItemVirtualIndexByProp(store, prop) {
|
|
|
3152
3166
|
return items.indexOf(physicalIndex);
|
|
3153
3167
|
}
|
|
3154
3168
|
|
|
3155
|
-
/**
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
*
|
|
3159
|
-
* @private
|
|
3160
|
-
* @param {Array} [array] The array to iterate over.
|
|
3161
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3162
|
-
* @param {*} [accumulator] The initial value.
|
|
3163
|
-
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
3164
|
-
* the initial value.
|
|
3165
|
-
* @returns {*} Returns the accumulated value.
|
|
3166
|
-
*/
|
|
3167
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
3168
|
-
var index = -1,
|
|
3169
|
-
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;
|
|
3170
3172
|
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
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
|
+
}
|
|
3176
3229
|
}
|
|
3177
|
-
return
|
|
3230
|
+
return nativeMin(high, MAX_ARRAY_INDEX);
|
|
3178
3231
|
}
|
|
3179
3232
|
|
|
3180
|
-
/**
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
* @private
|
|
3184
|
-
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
3185
|
-
* @returns {Function} Returns the new base function.
|
|
3186
|
-
*/
|
|
3187
|
-
function createBaseFor(fromRight) {
|
|
3188
|
-
return function(object, iteratee, keysFunc) {
|
|
3189
|
-
var index = -1,
|
|
3190
|
-
iterable = Object(object),
|
|
3191
|
-
props = keysFunc(object),
|
|
3192
|
-
length = props.length;
|
|
3193
|
-
|
|
3194
|
-
while (length--) {
|
|
3195
|
-
var key = props[fromRight ? length : ++index];
|
|
3196
|
-
if (iteratee(iterable[key], key, iterable) === false) {
|
|
3197
|
-
break;
|
|
3198
|
-
}
|
|
3199
|
-
}
|
|
3200
|
-
return object;
|
|
3201
|
-
};
|
|
3202
|
-
}
|
|
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;
|
|
3203
3236
|
|
|
3204
3237
|
/**
|
|
3205
|
-
* The base implementation of `
|
|
3206
|
-
*
|
|
3207
|
-
*
|
|
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.
|
|
3208
3241
|
*
|
|
3209
3242
|
* @private
|
|
3210
|
-
* @param {
|
|
3211
|
-
* @param {
|
|
3212
|
-
* @param {
|
|
3213
|
-
* @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`.
|
|
3214
3248
|
*/
|
|
3215
|
-
|
|
3249
|
+
function baseSortedIndex(array, value, retHighest) {
|
|
3250
|
+
var low = 0,
|
|
3251
|
+
high = array == null ? low : array.length;
|
|
3216
3252
|
|
|
3217
|
-
|
|
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];
|
|
3218
3257
|
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3225
|
-
* @returns {Object} Returns `object`.
|
|
3226
|
-
*/
|
|
3227
|
-
function baseForOwn(object, iteratee) {
|
|
3228
|
-
return object && baseFor$1(object, iteratee, keys);
|
|
3229
|
-
}
|
|
3230
|
-
|
|
3231
|
-
/**
|
|
3232
|
-
* Creates a `baseEach` or `baseEachRight` function.
|
|
3233
|
-
*
|
|
3234
|
-
* @private
|
|
3235
|
-
* @param {Function} eachFunc The function to iterate over a collection.
|
|
3236
|
-
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
3237
|
-
* @returns {Function} Returns the new base function.
|
|
3238
|
-
*/
|
|
3239
|
-
function createBaseEach(eachFunc, fromRight) {
|
|
3240
|
-
return function(collection, iteratee) {
|
|
3241
|
-
if (collection == null) {
|
|
3242
|
-
return collection;
|
|
3243
|
-
}
|
|
3244
|
-
if (!isArrayLike(collection)) {
|
|
3245
|
-
return eachFunc(collection, iteratee);
|
|
3246
|
-
}
|
|
3247
|
-
var length = collection.length,
|
|
3248
|
-
index = fromRight ? length : -1,
|
|
3249
|
-
iterable = Object(collection);
|
|
3250
|
-
|
|
3251
|
-
while ((fromRight ? index-- : ++index < length)) {
|
|
3252
|
-
if (iteratee(iterable[index], index, iterable) === false) {
|
|
3253
|
-
break;
|
|
3258
|
+
if (computed !== null && !debounce$1.isSymbol(computed) &&
|
|
3259
|
+
(retHighest ? (computed <= value) : (computed < value))) {
|
|
3260
|
+
low = mid + 1;
|
|
3261
|
+
} else {
|
|
3262
|
+
high = mid;
|
|
3254
3263
|
}
|
|
3255
3264
|
}
|
|
3256
|
-
return
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
/**
|
|
3261
|
-
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
3262
|
-
*
|
|
3263
|
-
* @private
|
|
3264
|
-
* @param {Array|Object} collection The collection to iterate over.
|
|
3265
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3266
|
-
* @returns {Array|Object} Returns `collection`.
|
|
3267
|
-
*/
|
|
3268
|
-
var baseEach = createBaseEach(baseForOwn);
|
|
3269
|
-
|
|
3270
|
-
const baseEach$1 = baseEach;
|
|
3271
|
-
|
|
3272
|
-
/**
|
|
3273
|
-
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
|
3274
|
-
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
|
3275
|
-
*
|
|
3276
|
-
* @private
|
|
3277
|
-
* @param {Array|Object} collection The collection to iterate over.
|
|
3278
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
3279
|
-
* @param {*} accumulator The initial value.
|
|
3280
|
-
* @param {boolean} initAccum Specify using the first or last element of
|
|
3281
|
-
* `collection` as the initial value.
|
|
3282
|
-
* @param {Function} eachFunc The function to iterate over `collection`.
|
|
3283
|
-
* @returns {*} Returns the accumulated value.
|
|
3284
|
-
*/
|
|
3285
|
-
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
|
3286
|
-
eachFunc(collection, function(value, index, collection) {
|
|
3287
|
-
accumulator = initAccum
|
|
3288
|
-
? (initAccum = false, value)
|
|
3289
|
-
: iteratee(accumulator, value, index, collection);
|
|
3290
|
-
});
|
|
3291
|
-
return accumulator;
|
|
3265
|
+
return high;
|
|
3266
|
+
}
|
|
3267
|
+
return baseSortedIndexBy(array, value, identity, retHighest);
|
|
3292
3268
|
}
|
|
3293
3269
|
|
|
3294
3270
|
/**
|
|
3295
|
-
*
|
|
3296
|
-
*
|
|
3297
|
-
* invocation is supplied the return value of the previous. If `accumulator`
|
|
3298
|
-
* is not given, the first element of `collection` is used as the initial
|
|
3299
|
-
* value. The iteratee is invoked with four arguments:
|
|
3300
|
-
* (accumulator, value, index|key, collection).
|
|
3301
|
-
*
|
|
3302
|
-
* Many lodash methods are guarded to work as iteratees for methods like
|
|
3303
|
-
* `_.reduce`, `_.reduceRight`, and `_.transform`.
|
|
3304
|
-
*
|
|
3305
|
-
* The guarded methods are:
|
|
3306
|
-
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
|
|
3307
|
-
* 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.
|
|
3308
3273
|
*
|
|
3309
3274
|
* @static
|
|
3310
3275
|
* @memberOf _
|
|
3311
3276
|
* @since 0.1.0
|
|
3312
|
-
* @category
|
|
3313
|
-
* @param {Array
|
|
3314
|
-
* @param {
|
|
3315
|
-
* @
|
|
3316
|
-
*
|
|
3317
|
-
* @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`.
|
|
3318
3282
|
* @example
|
|
3319
3283
|
*
|
|
3320
|
-
* _.
|
|
3321
|
-
*
|
|
3322
|
-
* }, 0);
|
|
3323
|
-
* // => 3
|
|
3324
|
-
*
|
|
3325
|
-
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
|
3326
|
-
* (result[value] || (result[value] = [])).push(key);
|
|
3327
|
-
* return result;
|
|
3328
|
-
* }, {});
|
|
3329
|
-
* // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
|
|
3284
|
+
* _.sortedIndex([30, 50], 40);
|
|
3285
|
+
* // => 1
|
|
3330
3286
|
*/
|
|
3331
|
-
function
|
|
3332
|
-
|
|
3333
|
-
initAccum = arguments.length < 3;
|
|
3334
|
-
|
|
3335
|
-
return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
|
|
3287
|
+
function sortedIndex(array, value) {
|
|
3288
|
+
return baseSortedIndex(array, value);
|
|
3336
3289
|
}
|
|
3337
3290
|
|
|
3338
3291
|
/**
|
|
3339
|
-
*
|
|
3292
|
+
* Pre-calculation
|
|
3293
|
+
* Dimension custom sizes for each cell
|
|
3294
|
+
* Keeps only changed sizes, skips origin size
|
|
3340
3295
|
*/
|
|
3341
|
-
function
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
this.store.set('tempRangeType', null);
|
|
3359
|
-
}
|
|
3360
|
-
});
|
|
3361
|
-
}
|
|
3362
|
-
onChange(propName, cb) {
|
|
3363
|
-
this.unsubscribe.push(this.store.onChange(propName, cb));
|
|
3364
|
-
}
|
|
3365
|
-
clearFocus() {
|
|
3366
|
-
setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
|
|
3367
|
-
}
|
|
3368
|
-
setFocus(focus, end) {
|
|
3369
|
-
if (!end) {
|
|
3370
|
-
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;
|
|
3371
3313
|
}
|
|
3372
3314
|
else {
|
|
3373
|
-
|
|
3374
|
-
focus,
|
|
3375
|
-
range: getRange(focus, end),
|
|
3376
|
-
edit: null,
|
|
3377
|
-
tempRange: null,
|
|
3378
|
-
});
|
|
3379
|
-
}
|
|
3380
|
-
}
|
|
3381
|
-
setNextFocus(focus) {
|
|
3382
|
-
setStore(this.store, { nextFocus: focus });
|
|
3383
|
-
}
|
|
3384
|
-
setTempArea(range) {
|
|
3385
|
-
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 });
|
|
3386
|
-
}
|
|
3387
|
-
clearTemp() {
|
|
3388
|
-
setStore(this.store, { tempRange: null });
|
|
3389
|
-
}
|
|
3390
|
-
/** Can be applied from selection change or from simple keyboard change clicks */
|
|
3391
|
-
setRangeArea(range) {
|
|
3392
|
-
setStore(this.store, { range, edit: null, tempRange: null });
|
|
3393
|
-
}
|
|
3394
|
-
setRange(start, end) {
|
|
3395
|
-
const range = getRange(start, end);
|
|
3396
|
-
this.setRangeArea(range);
|
|
3397
|
-
}
|
|
3398
|
-
setLastCell(lastCell) {
|
|
3399
|
-
setStore(this.store, { lastCell });
|
|
3400
|
-
}
|
|
3401
|
-
setEdit(val) {
|
|
3402
|
-
const focus = this.store.get('focus');
|
|
3403
|
-
if (focus && typeof val === 'string') {
|
|
3404
|
-
setStore(this.store, {
|
|
3405
|
-
edit: { x: focus.x, y: focus.y, val },
|
|
3406
|
-
});
|
|
3407
|
-
return;
|
|
3315
|
+
newItem.start = itemIndex * originItemSize;
|
|
3408
3316
|
}
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
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
|
+
};
|
|
3415
3328
|
}
|
|
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
|
-
|
|
3450
|
-
|
|
3451
|
-
}
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
return
|
|
3455
|
-
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
focusByCell(storePos, start, end) {
|
|
3588
|
-
const store = this.stores[storePos.y][storePos.x];
|
|
3589
|
-
this.focus(store, { focus: start, end });
|
|
3590
|
-
}
|
|
3591
|
-
focus(store, { focus, end }) {
|
|
3592
|
-
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
3593
|
-
if (!currentStorePointer) {
|
|
3594
|
-
return null;
|
|
3595
|
-
}
|
|
3596
|
-
// check for the focus in nearby store/viewport
|
|
3597
|
-
const lastCell = store.store.get('lastCell');
|
|
3598
|
-
const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
|
|
3599
|
-
// if next store present - update
|
|
3600
|
-
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
3601
|
-
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
3602
|
-
this.focus(next.store, { focus: item, end: item });
|
|
3603
|
-
return null;
|
|
3604
|
-
}
|
|
3605
|
-
if (lastCell) {
|
|
3606
|
-
focus = cropCellToMax(focus, lastCell);
|
|
3607
|
-
end = cropCellToMax(end, lastCell);
|
|
3608
|
-
}
|
|
3609
|
-
store.setFocus(focus, end);
|
|
3610
|
-
return focus;
|
|
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);
|
|
3611
3500
|
}
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
let
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
s.clearFocus();
|
|
3625
|
-
}
|
|
3626
|
-
else {
|
|
3627
|
-
// Update the current store pointer with the active store coordinates
|
|
3628
|
-
currentStorePointer = {
|
|
3629
|
-
x: parseInt(x, 10),
|
|
3630
|
-
y: parseInt(y, 10)
|
|
3631
|
-
};
|
|
3632
|
-
}
|
|
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;
|
|
3633
3513
|
}
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
}
|
|
3637
|
-
/**
|
|
3638
|
-
* Retrieves the next store based on the focus cell and current store pointer.
|
|
3639
|
-
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
3640
|
-
* If the next store does not exist, returns null.
|
|
3641
|
-
*/
|
|
3642
|
-
getNextStore(focus, currentStorePointer, lastCell) {
|
|
3643
|
-
// item in new store
|
|
3644
|
-
const nextItem = nextCell(focus, lastCell);
|
|
3645
|
-
let nextStore;
|
|
3646
|
-
if (nextItem) {
|
|
3647
|
-
Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
|
|
3648
|
-
let stores;
|
|
3649
|
-
switch (type) {
|
|
3650
|
-
case 'x':
|
|
3651
|
-
// Get the X stores for the current Y coordinate of the current store pointer
|
|
3652
|
-
stores = this.getXStores(currentStorePointer.y);
|
|
3653
|
-
break;
|
|
3654
|
-
case 'y':
|
|
3655
|
-
// Get the Y stores for the current X coordinate of the current store pointer
|
|
3656
|
-
stores = this.getYStores(currentStorePointer.x);
|
|
3657
|
-
break;
|
|
3658
|
-
}
|
|
3659
|
-
// Get the next store based on the item in the new store
|
|
3660
|
-
if (nextItemCoord >= 0) {
|
|
3661
|
-
nextStore = stores[++currentStorePointer[type]];
|
|
3662
|
-
}
|
|
3663
|
-
else {
|
|
3664
|
-
nextStore = stores[--currentStorePointer[type]];
|
|
3665
|
-
const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
3666
|
-
if (nextLastCell) {
|
|
3667
|
-
nextItem[type] = nextLastCell[type] + nextItemCoord;
|
|
3668
|
-
}
|
|
3669
|
-
}
|
|
3670
|
-
});
|
|
3671
|
-
}
|
|
3672
|
-
return {
|
|
3673
|
-
store: nextStore,
|
|
3674
|
-
item: nextItem,
|
|
3675
|
-
};
|
|
3676
|
-
}
|
|
3677
|
-
clearAll() {
|
|
3678
|
-
var _a;
|
|
3679
|
-
for (let y in this.stores) {
|
|
3680
|
-
for (let x in this.stores[y]) {
|
|
3681
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
|
|
3514
|
+
else if (cmp < 0) {
|
|
3515
|
+
n = k - 1;
|
|
3682
3516
|
}
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
setEdit(val) {
|
|
3686
|
-
if (!this.focusedStore) {
|
|
3687
|
-
return;
|
|
3688
|
-
}
|
|
3689
|
-
this.focusedStore.entity.setEdit(val);
|
|
3690
|
-
}
|
|
3691
|
-
/**
|
|
3692
|
-
* Select all cells across all stores
|
|
3693
|
-
*/
|
|
3694
|
-
selectAll() {
|
|
3695
|
-
for (let y in this.stores) {
|
|
3696
|
-
for (let x in this.stores[y]) {
|
|
3697
|
-
const store = this.stores[y][x];
|
|
3698
|
-
if (!store) {
|
|
3699
|
-
continue;
|
|
3700
|
-
}
|
|
3701
|
-
const lastCell = store.store.get('lastCell');
|
|
3702
|
-
if (lastCell) {
|
|
3703
|
-
store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
|
|
3704
|
-
}
|
|
3517
|
+
else {
|
|
3518
|
+
return k;
|
|
3705
3519
|
}
|
|
3706
3520
|
}
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
return this.stores[y];
|
|
3710
|
-
}
|
|
3711
|
-
getYStores(x) {
|
|
3712
|
-
const stores = {};
|
|
3713
|
-
for (let i in this.stores) {
|
|
3714
|
-
stores[i] = this.stores[i][x];
|
|
3715
|
-
}
|
|
3716
|
-
return stores;
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
function isHiddenStore(pos) {
|
|
3721
|
-
return pos === EMPTY_INDEX;
|
|
3722
|
-
}
|
|
3723
|
-
function nextCell(cell, lastCell) {
|
|
3724
|
-
const nextItem = {};
|
|
3725
|
-
let types = ['x', 'y'];
|
|
3726
|
-
// previous item check
|
|
3727
|
-
for (let t of types) {
|
|
3728
|
-
if (cell[t] < 0) {
|
|
3729
|
-
nextItem[t] = cell[t];
|
|
3730
|
-
return nextItem;
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
// next item check
|
|
3734
|
-
for (let t of types) {
|
|
3735
|
-
if (cell[t] >= lastCell[t]) {
|
|
3736
|
-
nextItem[t] = cell[t] - lastCell[t];
|
|
3737
|
-
return nextItem;
|
|
3738
|
-
}
|
|
3739
|
-
}
|
|
3740
|
-
return null;
|
|
3741
|
-
}
|
|
3742
|
-
function cropCellToMax(cell, lastCell) {
|
|
3743
|
-
const croppedCell = Object.assign({}, cell);
|
|
3744
|
-
const cellCoordinates = ['x', 'y'];
|
|
3745
|
-
for (const coordinate of cellCoordinates) {
|
|
3746
|
-
if (cell[coordinate] < 0) {
|
|
3747
|
-
croppedCell[coordinate] = 0;
|
|
3748
|
-
}
|
|
3749
|
-
else if (cell[coordinate] >= lastCell[coordinate]) {
|
|
3750
|
-
croppedCell[coordinate] = lastCell[coordinate] - 1;
|
|
3751
|
-
}
|
|
3752
|
-
}
|
|
3753
|
-
return croppedCell;
|
|
3754
|
-
}
|
|
3755
|
-
function getRange(start, end) {
|
|
3756
|
-
return start && end
|
|
3757
|
-
? {
|
|
3758
|
-
x: Math.min(start.x, end.x),
|
|
3759
|
-
y: Math.min(start.y, end.y),
|
|
3760
|
-
x1: Math.max(start.x, end.x),
|
|
3761
|
-
y1: Math.max(start.y, end.y),
|
|
3762
|
-
}
|
|
3763
|
-
: null;
|
|
3764
|
-
}
|
|
3765
|
-
function isRangeSingleCell(a) {
|
|
3766
|
-
return a.x === a.x1 && a.y === a.y1;
|
|
3767
|
-
}
|
|
3768
|
-
|
|
3769
|
-
function getCellData(val) {
|
|
3770
|
-
if (typeof val === 'undefined' || val === null) {
|
|
3771
|
-
return '';
|
|
3772
|
-
}
|
|
3773
|
-
return val;
|
|
3774
|
-
}
|
|
3775
|
-
function getCellDataParsed(model, column) {
|
|
3776
|
-
const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
|
|
3777
|
-
return getCellData(val);
|
|
3521
|
+
return -m - 1;
|
|
3522
|
+
})(this);
|
|
3778
3523
|
}
|
|
3779
3524
|
/**
|
|
3780
|
-
*
|
|
3525
|
+
* Sorted push
|
|
3781
3526
|
*/
|
|
3782
|
-
function
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
}
|
|
3786
|
-
return 'rgCol';
|
|
3527
|
+
function pushSorted(arr, el, fn) {
|
|
3528
|
+
arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
|
|
3529
|
+
return arr;
|
|
3787
3530
|
}
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
if (c.size) {
|
|
3792
|
-
res[i] = c.size;
|
|
3793
|
-
}
|
|
3794
|
-
}
|
|
3795
|
-
return res;
|
|
3531
|
+
// (arr1[index1] < arr2[index2])
|
|
3532
|
+
function simpleCompare(el1, el2) {
|
|
3533
|
+
return el1 < el2;
|
|
3796
3534
|
}
|
|
3797
3535
|
/**
|
|
3798
|
-
*
|
|
3536
|
+
* Merge sorted array helper function
|
|
3799
3537
|
*/
|
|
3800
|
-
function
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
colPinStart: [],
|
|
3812
|
-
colPinEnd: [],
|
|
3813
|
-
},
|
|
3814
|
-
// columns indexed by prop for quick access
|
|
3815
|
-
columnByProp: {},
|
|
3816
|
-
// column grouping
|
|
3817
|
-
columnGrouping: {
|
|
3818
|
-
rgCol: [],
|
|
3819
|
-
colPinStart: [],
|
|
3820
|
-
colPinEnd: [],
|
|
3821
|
-
},
|
|
3822
|
-
// max depth level for column grouping
|
|
3823
|
-
maxLevel: level,
|
|
3824
|
-
// sorting
|
|
3825
|
-
sort: {},
|
|
3826
|
-
};
|
|
3827
|
-
return reduce(columns, (res, colData) => {
|
|
3828
|
-
// Grouped column
|
|
3829
|
-
if (isColGrouping(colData)) {
|
|
3830
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
3831
|
-
}
|
|
3832
|
-
// Column type
|
|
3833
|
-
const columnDefinitionFromType = colData.columnType && (types === null || types === void 0 ? void 0 : types[colData.columnType]);
|
|
3834
|
-
// Regular column
|
|
3835
|
-
const regularColumn = Object.assign(Object.assign({}, columnDefinitionFromType), colData);
|
|
3836
|
-
// Regular column, no Pin
|
|
3837
|
-
if (!regularColumn.pin) {
|
|
3838
|
-
res.columns.rgCol.push(regularColumn);
|
|
3839
|
-
// 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++;
|
|
3840
3549
|
}
|
|
3841
3550
|
else {
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
if (regularColumn.order) {
|
|
3845
|
-
res.sort[regularColumn.prop] = regularColumn;
|
|
3846
|
-
}
|
|
3847
|
-
// it's possible that some columns have same prop, but better to avoid it
|
|
3848
|
-
if (!res.columnByProp[regularColumn.prop]) {
|
|
3849
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
3850
|
-
}
|
|
3851
|
-
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
3852
|
-
// trigger setup hook if present
|
|
3853
|
-
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
3854
|
-
return res;
|
|
3855
|
-
}, collection);
|
|
3856
|
-
}
|
|
3857
|
-
function gatherGroup(res, colData, collection, level = 0) {
|
|
3858
|
-
// group template
|
|
3859
|
-
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
3860
|
-
// check columns for update
|
|
3861
|
-
for (let k in collection.columns) {
|
|
3862
|
-
const key = k;
|
|
3863
|
-
const resultItem = res.columns[key];
|
|
3864
|
-
const collectionItem = collection.columns[key];
|
|
3865
|
-
// if column data
|
|
3866
|
-
if (isArray$1(resultItem) && isArray$1(collectionItem)) {
|
|
3867
|
-
// fill columns
|
|
3868
|
-
resultItem.push(...collectionItem);
|
|
3869
|
-
// fill grouping
|
|
3870
|
-
if (collectionItem.length) {
|
|
3871
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
3872
|
-
}
|
|
3873
|
-
}
|
|
3874
|
-
}
|
|
3875
|
-
// merge column groupings
|
|
3876
|
-
for (let k in collection.columnGrouping) {
|
|
3877
|
-
const key = k;
|
|
3878
|
-
const collectionItem = collection.columnGrouping[key];
|
|
3879
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
3880
|
-
}
|
|
3881
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
3882
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
3883
|
-
return res;
|
|
3884
|
-
}
|
|
3885
|
-
function findColumn(columns, prop) {
|
|
3886
|
-
for (const c of columns) {
|
|
3887
|
-
if (isColGrouping(c)) {
|
|
3888
|
-
const found = findColumn(c.children, prop);
|
|
3889
|
-
if (found) {
|
|
3890
|
-
return found;
|
|
3891
|
-
}
|
|
3892
|
-
}
|
|
3893
|
-
else if (c.prop === prop) {
|
|
3894
|
-
return c;
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3897
|
-
return undefined;
|
|
3898
|
-
}
|
|
3899
|
-
function getColumnByProp(columns, prop) {
|
|
3900
|
-
return findColumn(columns, prop);
|
|
3901
|
-
}
|
|
3902
|
-
|
|
3903
|
-
const GROUP_DEPTH = `${index.GRID_INTERNALS}-depth`;
|
|
3904
|
-
const PSEUDO_GROUP_ITEM = `${index.GRID_INTERNALS}-name`;
|
|
3905
|
-
const PSEUDO_GROUP_ITEM_ID = `${index.GRID_INTERNALS}-id`;
|
|
3906
|
-
const PSEUDO_GROUP_ITEM_VALUE = `${index.GRID_INTERNALS}-value`;
|
|
3907
|
-
const PSEUDO_GROUP_COLUMN = `${index.GRID_INTERNALS}-column`;
|
|
3908
|
-
const GROUP_EXPANDED = `${index.GRID_INTERNALS}-expanded`;
|
|
3909
|
-
const GROUP_ORIGINAL_INDEX = `${index.GRID_INTERNALS}-original-index`;
|
|
3910
|
-
const GROUP_EXPAND_BTN = `group-expand`;
|
|
3911
|
-
const GROUP_EXPAND_EVENT = `groupexpandclick`;
|
|
3912
|
-
const GROUPING_ROW_TYPE = 'rgRow';
|
|
3913
|
-
|
|
3914
|
-
function getGroupValueDefault(item, prop) {
|
|
3915
|
-
return item[prop] || null;
|
|
3916
|
-
}
|
|
3917
|
-
/**
|
|
3918
|
-
* Gather data for grouping
|
|
3919
|
-
* @param array - flat data array
|
|
3920
|
-
* @param groupIds - ids of groups
|
|
3921
|
-
* @param expanded - potentially expanded items if present
|
|
3922
|
-
*/
|
|
3923
|
-
function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
|
|
3924
|
-
const groupedItems = new Map();
|
|
3925
|
-
array.forEach((item, originalIndex) => {
|
|
3926
|
-
const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
|
|
3927
|
-
const lastLevelValue = groupLevelValues.pop();
|
|
3928
|
-
let currentGroupLevel = groupedItems;
|
|
3929
|
-
groupLevelValues.forEach(value => {
|
|
3930
|
-
if (!currentGroupLevel.has(value)) {
|
|
3931
|
-
currentGroupLevel.set(value, new Map());
|
|
3932
|
-
}
|
|
3933
|
-
currentGroupLevel = currentGroupLevel.get(value);
|
|
3934
|
-
});
|
|
3935
|
-
if (!currentGroupLevel.has(lastLevelValue)) {
|
|
3936
|
-
currentGroupLevel.set(lastLevelValue, []);
|
|
3551
|
+
merged[current] = arr2[index2];
|
|
3552
|
+
index2++;
|
|
3937
3553
|
}
|
|
3938
|
-
|
|
3939
|
-
lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
|
|
3940
|
-
});
|
|
3941
|
-
let itemIndex = -1;
|
|
3942
|
-
const groupingDepth = groupIds.length;
|
|
3943
|
-
// collapse all groups in the beginning
|
|
3944
|
-
const trimmed = {};
|
|
3945
|
-
// index mapping
|
|
3946
|
-
const oldNewIndexMap = {};
|
|
3947
|
-
// check if group header exists
|
|
3948
|
-
const pseudoGroupTest = {};
|
|
3949
|
-
const sourceWithGroups = [];
|
|
3950
|
-
function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
|
|
3951
|
-
const depth = parentIds.length;
|
|
3952
|
-
groupedValues.forEach((innerGroupedValues, groupId) => {
|
|
3953
|
-
const levelIds = [...parentIds, groupId];
|
|
3954
|
-
const mergedIds = levelIds.join(',');
|
|
3955
|
-
const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
|
|
3956
|
-
sourceWithGroups.push({
|
|
3957
|
-
[PSEUDO_GROUP_ITEM]: groupId,
|
|
3958
|
-
[GROUP_DEPTH]: depth,
|
|
3959
|
-
[PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
|
|
3960
|
-
[PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
|
|
3961
|
-
[GROUP_EXPANDED]: isGroupExpanded,
|
|
3962
|
-
});
|
|
3963
|
-
itemIndex += 1;
|
|
3964
|
-
if (!isGroupExpanded && depth) {
|
|
3965
|
-
trimmed[itemIndex] = true;
|
|
3966
|
-
}
|
|
3967
|
-
if (Array.isArray(innerGroupedValues)) {
|
|
3968
|
-
innerGroupedValues.forEach(value => {
|
|
3969
|
-
itemIndex += 1;
|
|
3970
|
-
if (!isGroupExpanded) {
|
|
3971
|
-
trimmed[itemIndex] = true;
|
|
3972
|
-
}
|
|
3973
|
-
oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
|
|
3974
|
-
const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
|
|
3975
|
-
pseudoGroupTestIds.forEach(pseudoGroupTestId => {
|
|
3976
|
-
if (!pseudoGroupTest[pseudoGroupTestId]) {
|
|
3977
|
-
pseudoGroupTest[pseudoGroupTestId] = [];
|
|
3978
|
-
}
|
|
3979
|
-
pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
|
|
3980
|
-
});
|
|
3981
|
-
});
|
|
3982
|
-
sourceWithGroups.push(...innerGroupedValues);
|
|
3983
|
-
}
|
|
3984
|
-
else {
|
|
3985
|
-
flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
|
|
3986
|
-
}
|
|
3987
|
-
});
|
|
3988
|
-
}
|
|
3989
|
-
flattenGroupMaps(groupedItems, [], true);
|
|
3990
|
-
return {
|
|
3991
|
-
sourceWithGroups, // updates source mirror
|
|
3992
|
-
depth: groupingDepth, // largest depth for grouping
|
|
3993
|
-
trimmed, // used for expand/collapse grouping values
|
|
3994
|
-
oldNewIndexMap, // used for mapping old values to new
|
|
3995
|
-
childrenByGroup: pseudoGroupTest, // used to get child items in group
|
|
3996
|
-
};
|
|
3997
|
-
}
|
|
3998
|
-
function getGroupingName(rgRow) {
|
|
3999
|
-
return rgRow && rgRow[PSEUDO_GROUP_ITEM];
|
|
4000
|
-
}
|
|
4001
|
-
function isGrouping(rgRow) {
|
|
4002
|
-
return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
|
|
4003
|
-
}
|
|
4004
|
-
function isGroupingColumn(column) {
|
|
4005
|
-
return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
|
|
4006
|
-
}
|
|
4007
|
-
function measureEqualDepth(groupA, groupB) {
|
|
4008
|
-
const ln = groupA.length;
|
|
4009
|
-
let i = 0;
|
|
4010
|
-
for (; i < ln; i++) {
|
|
4011
|
-
if (groupA[i] !== groupB[i]) {
|
|
4012
|
-
return i;
|
|
4013
|
-
}
|
|
4014
|
-
}
|
|
4015
|
-
return i;
|
|
4016
|
-
}
|
|
4017
|
-
function getParsedGroup(id) {
|
|
4018
|
-
const parseGroup = JSON.parse(id);
|
|
4019
|
-
// extra precaution and type safeguard
|
|
4020
|
-
if (!Array.isArray(parseGroup)) {
|
|
4021
|
-
return null;
|
|
4022
|
-
}
|
|
4023
|
-
return parseGroup;
|
|
4024
|
-
}
|
|
4025
|
-
// check if items is child of current clicked group
|
|
4026
|
-
function isSameGroup(currentGroup, currentModel, nextModel) {
|
|
4027
|
-
const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
|
|
4028
|
-
if (!nextGroup) {
|
|
4029
|
-
return false;
|
|
3554
|
+
current++;
|
|
4030
3555
|
}
|
|
4031
|
-
|
|
4032
|
-
return currentModel[GROUP_DEPTH] < depth;
|
|
3556
|
+
return merged;
|
|
4033
3557
|
}
|
|
4034
|
-
|
|
4035
3558
|
/**
|
|
4036
|
-
*
|
|
4037
|
-
*
|
|
4038
|
-
* @private
|
|
4039
|
-
* @param {Array} array The array to slice.
|
|
4040
|
-
* @param {number} [start=0] The start position.
|
|
4041
|
-
* @param {number} [end=array.length] The end position.
|
|
4042
|
-
* @returns {Array} Returns the slice of `array`.
|
|
3559
|
+
* Calculate system scrollbar size
|
|
4043
3560
|
*/
|
|
4044
|
-
function
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
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;
|
|
4063
3579
|
}
|
|
4064
|
-
|
|
4065
|
-
/**
|
|
4066
|
-
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
3580
|
+
/* Scale a value between 2 ranges
|
|
4067
3581
|
*
|
|
4068
|
-
*
|
|
4069
|
-
*
|
|
4070
|
-
*
|
|
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]);
|
|
4071
3585
|
*
|
|
4072
|
-
*
|
|
4073
|
-
* @
|
|
4074
|
-
* @
|
|
4075
|
-
*
|
|
4076
|
-
*
|
|
4077
|
-
* @param {number} [start=0] The start position.
|
|
4078
|
-
* @param {number} [end=array.length] The end position.
|
|
4079
|
-
* @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.
|
|
4080
3591
|
*/
|
|
4081
|
-
function
|
|
4082
|
-
|
|
4083
|
-
if (!length) {
|
|
4084
|
-
return [];
|
|
4085
|
-
}
|
|
4086
|
-
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
|
|
4087
|
-
start = 0;
|
|
4088
|
-
end = length;
|
|
4089
|
-
}
|
|
4090
|
-
else {
|
|
4091
|
-
start = start == null ? 0 : toInteger(start);
|
|
4092
|
-
end = end === undefined ? length : toInteger(end);
|
|
4093
|
-
}
|
|
4094
|
-
return baseSlice(array, start, end);
|
|
4095
|
-
}
|
|
4096
|
-
|
|
4097
|
-
class ColumnService {
|
|
4098
|
-
get columns() {
|
|
4099
|
-
return getVisibleSourceItem(this.source);
|
|
4100
|
-
}
|
|
4101
|
-
constructor(dataStore, source) {
|
|
4102
|
-
this.dataStore = dataStore;
|
|
4103
|
-
this.source = source;
|
|
4104
|
-
this.unsubscribe = [];
|
|
4105
|
-
this.hasGrouping = false;
|
|
4106
|
-
this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
|
|
4107
|
-
this.checkGrouping(source.get('source'));
|
|
4108
|
-
this.type = source.get('type');
|
|
4109
|
-
}
|
|
4110
|
-
checkGrouping(cols) {
|
|
4111
|
-
for (let rgCol of cols) {
|
|
4112
|
-
if (isGroupingColumn(rgCol)) {
|
|
4113
|
-
this.hasGrouping = true;
|
|
4114
|
-
return;
|
|
4115
|
-
}
|
|
4116
|
-
this.hasGrouping = false;
|
|
4117
|
-
}
|
|
4118
|
-
}
|
|
4119
|
-
isReadOnly(r, c) {
|
|
4120
|
-
var _a;
|
|
4121
|
-
const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
|
|
4122
|
-
if (typeof readOnly === 'function') {
|
|
4123
|
-
const data = this.rowDataModel(r, c);
|
|
4124
|
-
return readOnly(data);
|
|
4125
|
-
}
|
|
4126
|
-
return !!readOnly;
|
|
4127
|
-
}
|
|
4128
|
-
mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
|
|
4129
|
-
const props = Object.assign({}, defaultProps);
|
|
4130
|
-
props.class = Object.assign(Object.assign({}, (typeof props.class === 'string'
|
|
4131
|
-
? { [props.class]: true }
|
|
4132
|
-
: props.class)), { [index.CELL_CLASS]: true, [index.DISABLED_CLASS]: this.isReadOnly(r, c) });
|
|
4133
|
-
const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
|
|
4134
|
-
if (!extra) {
|
|
4135
|
-
return props;
|
|
4136
|
-
}
|
|
4137
|
-
return doPropMerge(props, extra);
|
|
4138
|
-
}
|
|
4139
|
-
getRowClass(r, prop) {
|
|
4140
|
-
const model = getSourceItem(this.dataStore, r) || {};
|
|
4141
|
-
return model[prop] || '';
|
|
4142
|
-
}
|
|
4143
|
-
getCellData(r, c) {
|
|
4144
|
-
const data = this.rowDataModel(r, c);
|
|
4145
|
-
return getCellData(data.model[data.prop]);
|
|
4146
|
-
}
|
|
4147
|
-
getSaveData(rowIndex, colIndex, val) {
|
|
4148
|
-
const data = this.rowDataModel(rowIndex, colIndex);
|
|
4149
|
-
if (typeof val === 'undefined') {
|
|
4150
|
-
val = getCellData(data.model[data.prop]);
|
|
4151
|
-
}
|
|
4152
|
-
return {
|
|
4153
|
-
prop: data.prop,
|
|
4154
|
-
rowIndex,
|
|
4155
|
-
colIndex,
|
|
4156
|
-
val,
|
|
4157
|
-
model: data.model,
|
|
4158
|
-
colType: this.type,
|
|
4159
|
-
type: this.dataStore.get('type'),
|
|
4160
|
-
};
|
|
4161
|
-
}
|
|
4162
|
-
getCellEditor(_r, c, editors) {
|
|
4163
|
-
var _a;
|
|
4164
|
-
const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
|
|
4165
|
-
if (!editor) {
|
|
4166
|
-
return undefined;
|
|
4167
|
-
}
|
|
4168
|
-
// reference
|
|
4169
|
-
if (typeof editor === 'string') {
|
|
4170
|
-
return editors[editor];
|
|
4171
|
-
}
|
|
4172
|
-
return editor;
|
|
4173
|
-
}
|
|
4174
|
-
/**
|
|
4175
|
-
* Get cell data model for given rowIndex and colIndex
|
|
4176
|
-
* Used to pass data to editor/renderer
|
|
4177
|
-
*/
|
|
4178
|
-
rowDataModel(rowIndex, colIndex) {
|
|
4179
|
-
const column = this.columns[colIndex];
|
|
4180
|
-
const prop = column === null || column === void 0 ? void 0 : column.prop;
|
|
4181
|
-
const model = getSourceItem(this.dataStore, rowIndex) || {};
|
|
4182
|
-
const value = model[prop];
|
|
4183
|
-
const type = this.dataStore.get('type');
|
|
4184
|
-
return {
|
|
4185
|
-
prop,
|
|
4186
|
-
model,
|
|
4187
|
-
data: this.dataStore.get('source'),
|
|
4188
|
-
column,
|
|
4189
|
-
rowIndex,
|
|
4190
|
-
colIndex,
|
|
4191
|
-
colType: this.type,
|
|
4192
|
-
type,
|
|
4193
|
-
value,
|
|
4194
|
-
};
|
|
4195
|
-
}
|
|
4196
|
-
getRangeData(d, columns) {
|
|
4197
|
-
var _a;
|
|
4198
|
-
const changed = {};
|
|
4199
|
-
// get original length sizes
|
|
4200
|
-
const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
|
|
4201
|
-
const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
|
|
4202
|
-
const mapping = {};
|
|
4203
|
-
// rows
|
|
4204
|
-
for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
|
|
4205
|
-
// copy original data link
|
|
4206
|
-
const oldRowIndex = d.oldRange.y + (i % copyRowLength);
|
|
4207
|
-
const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
|
|
4208
|
-
// columns
|
|
4209
|
-
for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
|
|
4210
|
-
// check if old range area
|
|
4211
|
-
if (rowIndex >= d.oldRange.y &&
|
|
4212
|
-
rowIndex <= d.oldRange.y1 &&
|
|
4213
|
-
colIndex >= d.oldRange.x &&
|
|
4214
|
-
colIndex <= d.oldRange.x1) {
|
|
4215
|
-
continue;
|
|
4216
|
-
}
|
|
4217
|
-
// requested column beyond range
|
|
4218
|
-
if (!this.columns[colIndex]) {
|
|
4219
|
-
continue;
|
|
4220
|
-
}
|
|
4221
|
-
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
4222
|
-
const copyColIndex = d.oldRange.x + (j % copyColLength);
|
|
4223
|
-
const copyColumnProp = columns[copyColIndex].prop;
|
|
4224
|
-
/** if can write */
|
|
4225
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
4226
|
-
/** to show before save */
|
|
4227
|
-
if (!changed[rowIndex]) {
|
|
4228
|
-
changed[rowIndex] = {};
|
|
4229
|
-
}
|
|
4230
|
-
changed[rowIndex][prop] = copyRow[copyColumnProp];
|
|
4231
|
-
/** Generate mapping object */
|
|
4232
|
-
if (!mapping[rowIndex]) {
|
|
4233
|
-
mapping[rowIndex] = {};
|
|
4234
|
-
}
|
|
4235
|
-
mapping[rowIndex][prop] = {
|
|
4236
|
-
colIndex: copyColIndex,
|
|
4237
|
-
colProp: copyColumnProp,
|
|
4238
|
-
rowIndex: oldRowIndex,
|
|
4239
|
-
};
|
|
4240
|
-
}
|
|
4241
|
-
}
|
|
4242
|
-
}
|
|
4243
|
-
return {
|
|
4244
|
-
changed,
|
|
4245
|
-
mapping,
|
|
4246
|
-
};
|
|
4247
|
-
}
|
|
4248
|
-
getTransformedDataToApply(start, data) {
|
|
4249
|
-
const changed = {};
|
|
4250
|
-
const copyRowLength = data.length;
|
|
4251
|
-
const colLength = this.columns.length;
|
|
4252
|
-
const rowLength = this.dataStore.get('items').length;
|
|
4253
|
-
// rows
|
|
4254
|
-
let rowIndex = start.y;
|
|
4255
|
-
let maxCol = 0;
|
|
4256
|
-
for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
|
|
4257
|
-
// copy original data link
|
|
4258
|
-
const copyRow = data[i % copyRowLength];
|
|
4259
|
-
const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
|
|
4260
|
-
// columns
|
|
4261
|
-
let colIndex = start.x;
|
|
4262
|
-
for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
|
|
4263
|
-
const p = this.columns[colIndex].prop;
|
|
4264
|
-
const currentCol = j % colLength;
|
|
4265
|
-
/** if can write */
|
|
4266
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
4267
|
-
/** to show before save */
|
|
4268
|
-
if (!changed[rowIndex]) {
|
|
4269
|
-
changed[rowIndex] = {};
|
|
4270
|
-
}
|
|
4271
|
-
changed[rowIndex][p] = copyRow[currentCol];
|
|
4272
|
-
}
|
|
4273
|
-
}
|
|
4274
|
-
maxCol = Math.max(maxCol, colIndex - 1);
|
|
4275
|
-
}
|
|
4276
|
-
const range = getRange(start, {
|
|
4277
|
-
y: rowIndex - 1,
|
|
4278
|
-
x: maxCol,
|
|
4279
|
-
});
|
|
4280
|
-
return {
|
|
4281
|
-
changed,
|
|
4282
|
-
range,
|
|
4283
|
-
};
|
|
4284
|
-
}
|
|
4285
|
-
getRangeStaticData(d, value) {
|
|
4286
|
-
const changed = {};
|
|
4287
|
-
// rows
|
|
4288
|
-
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
4289
|
-
// columns
|
|
4290
|
-
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
4291
|
-
// requested column beyond range
|
|
4292
|
-
if (!this.columns[colIndex]) {
|
|
4293
|
-
continue;
|
|
4294
|
-
}
|
|
4295
|
-
const p = this.columns[colIndex].prop;
|
|
4296
|
-
/** if can write */
|
|
4297
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
4298
|
-
/** to show before save */
|
|
4299
|
-
if (!changed[rowIndex]) {
|
|
4300
|
-
changed[rowIndex] = {};
|
|
4301
|
-
}
|
|
4302
|
-
changed[rowIndex][p] = value;
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4305
|
-
}
|
|
4306
|
-
return changed;
|
|
4307
|
-
}
|
|
4308
|
-
getRangeTransformedToProps(d, store) {
|
|
4309
|
-
var _a;
|
|
4310
|
-
const area = [];
|
|
4311
|
-
const type = this.dataStore.get('type');
|
|
4312
|
-
// rows
|
|
4313
|
-
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
4314
|
-
// columns
|
|
4315
|
-
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
4316
|
-
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
4317
|
-
area.push({
|
|
4318
|
-
prop,
|
|
4319
|
-
rowIndex,
|
|
4320
|
-
colIndex,
|
|
4321
|
-
model: getSourceItem(store, rowIndex),
|
|
4322
|
-
type,
|
|
4323
|
-
colType: this.type,
|
|
4324
|
-
});
|
|
4325
|
-
}
|
|
4326
|
-
}
|
|
4327
|
-
return area;
|
|
4328
|
-
}
|
|
4329
|
-
copyRangeArray(range, store) {
|
|
4330
|
-
const cols = [...this.columns];
|
|
4331
|
-
const props = slice(cols, range.x, range.x1 + 1).map(v => v.prop);
|
|
4332
|
-
const toCopy = [];
|
|
4333
|
-
const mapping = {};
|
|
4334
|
-
// rows indexes
|
|
4335
|
-
for (let i = range.y; i <= range.y1; i++) {
|
|
4336
|
-
const rgRow = [];
|
|
4337
|
-
mapping[i] = {};
|
|
4338
|
-
// columns indexes
|
|
4339
|
-
for (let prop of props) {
|
|
4340
|
-
const item = getSourceItem(store, i);
|
|
4341
|
-
// if no item - skip
|
|
4342
|
-
if (!item) {
|
|
4343
|
-
continue;
|
|
4344
|
-
}
|
|
4345
|
-
const val = item[prop];
|
|
4346
|
-
rgRow.push(val);
|
|
4347
|
-
mapping[i][prop] = val;
|
|
4348
|
-
}
|
|
4349
|
-
toCopy.push(rgRow);
|
|
4350
|
-
}
|
|
4351
|
-
return {
|
|
4352
|
-
data: toCopy,
|
|
4353
|
-
mapping,
|
|
4354
|
-
};
|
|
4355
|
-
}
|
|
4356
|
-
destroy() {
|
|
4357
|
-
this.unsubscribe.forEach(f => f());
|
|
4358
|
-
}
|
|
3592
|
+
function scaleValue(value, from, to) {
|
|
3593
|
+
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
4359
3594
|
}
|
|
4360
3595
|
/**
|
|
4361
|
-
*
|
|
3596
|
+
* Async timeout
|
|
4362
3597
|
*/
|
|
4363
|
-
function
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
}
|
|
4367
|
-
return !!rowDrag;
|
|
4368
|
-
}
|
|
4369
|
-
function mergeClasses(class1 = {}, class2 = {}) {
|
|
4370
|
-
if (typeof class1 === 'string') {
|
|
4371
|
-
class1 = { [class1]: true };
|
|
4372
|
-
}
|
|
4373
|
-
if (typeof class2 === 'string') {
|
|
4374
|
-
class2 = { [class2]: true };
|
|
4375
|
-
}
|
|
4376
|
-
return Object.assign(Object.assign({}, class1), class2);
|
|
3598
|
+
async function timeout(delay = 0) {
|
|
3599
|
+
await new Promise((r) => {
|
|
3600
|
+
setTimeout(() => r(), delay);
|
|
3601
|
+
});
|
|
4377
3602
|
}
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
props.class = mergeClasses(props.class, extra.class);
|
|
4388
|
-
}
|
|
4389
|
-
if (extra.style) {
|
|
4390
|
-
props.style = Object.assign(Object.assign({}, extra.style), props.style);
|
|
4391
|
-
}
|
|
4392
|
-
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
|
+
});
|
|
4393
3612
|
}
|
|
4394
3613
|
|
|
4395
|
-
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;
|
|
4396
3622
|
exports.DataStore = DataStore;
|
|
4397
|
-
exports.
|
|
4398
|
-
exports.
|
|
4399
|
-
exports.
|
|
4400
|
-
exports.
|
|
4401
|
-
exports.
|
|
4402
|
-
exports.
|
|
4403
|
-
exports.
|
|
4404
|
-
exports.
|
|
4405
|
-
exports.
|
|
4406
|
-
exports.
|
|
4407
|
-
exports.
|
|
4408
|
-
exports.
|
|
4409
|
-
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;
|
|
4410
3640
|
exports.baseIteratee = baseIteratee;
|
|
4411
3641
|
exports.baseKeys = baseKeys;
|
|
4412
3642
|
exports.baseProperty = baseProperty;
|
|
3643
|
+
exports.calculateDimensionData = calculateDimensionData;
|
|
4413
3644
|
exports.createStore = createStore;
|
|
4414
|
-
exports.cropCellToMax = cropCellToMax;
|
|
4415
|
-
exports.doPropMerge = doPropMerge;
|
|
4416
3645
|
exports.findIndex = findIndex;
|
|
4417
|
-
exports.
|
|
4418
|
-
exports.gatherGrouping = gatherGrouping;
|
|
3646
|
+
exports.findPositionInArray = findPositionInArray;
|
|
4419
3647
|
exports.gatherTrimmedItems = gatherTrimmedItems;
|
|
4420
|
-
exports.
|
|
4421
|
-
exports.
|
|
4422
|
-
exports.getColumnByProp = getColumnByProp;
|
|
4423
|
-
exports.getColumnSizes = getColumnSizes;
|
|
4424
|
-
exports.getColumnType = getColumnType;
|
|
4425
|
-
exports.getColumns = getColumns;
|
|
4426
|
-
exports.getGroupingName = getGroupingName;
|
|
3648
|
+
exports.getItemByIndex = getItemByIndex;
|
|
3649
|
+
exports.getItemByPosition = getItemByPosition;
|
|
4427
3650
|
exports.getNative = getNative;
|
|
4428
|
-
exports.getParsedGroup = getParsedGroup;
|
|
4429
3651
|
exports.getPhysical = getPhysical;
|
|
4430
|
-
exports.
|
|
3652
|
+
exports.getScrollbarSize = getScrollbarSize;
|
|
4431
3653
|
exports.getSourceItem = getSourceItem;
|
|
4432
3654
|
exports.getSourceItemVirtualIndexByProp = getSourceItemVirtualIndexByProp;
|
|
4433
3655
|
exports.getSourcePhysicalIndex = getSourcePhysicalIndex;
|
|
4434
3656
|
exports.getTag = getTag$1;
|
|
4435
3657
|
exports.getVisibleSourceItem = getVisibleSourceItem;
|
|
3658
|
+
exports.identity = identity;
|
|
4436
3659
|
exports.isArray = isArray$1;
|
|
4437
3660
|
exports.isArrayLike = isArrayLike;
|
|
4438
|
-
exports.isColGrouping = isColGrouping;
|
|
4439
|
-
exports.isGrouping = isGrouping;
|
|
4440
|
-
exports.isGroupingColumn = isGroupingColumn;
|
|
4441
|
-
exports.isHiddenStore = isHiddenStore;
|
|
4442
3661
|
exports.isIterateeCall = isIterateeCall;
|
|
4443
|
-
exports.
|
|
4444
|
-
exports.
|
|
4445
|
-
exports.isSameGroup = isSameGroup;
|
|
4446
|
-
exports.nextCell = nextCell;
|
|
3662
|
+
exports.keys = keys;
|
|
3663
|
+
exports.mergeSortedArray = mergeSortedArray;
|
|
4447
3664
|
exports.proxyPlugin = proxyPlugin;
|
|
4448
|
-
exports.
|
|
3665
|
+
exports.pushSorted = pushSorted;
|
|
3666
|
+
exports.range = range;
|
|
3667
|
+
exports.scaleValue = scaleValue;
|
|
4449
3668
|
exports.setItems = setItems;
|
|
4450
3669
|
exports.setSourceByPhysicalIndex = setSourceByPhysicalIndex;
|
|
4451
3670
|
exports.setSourceByVirtualIndex = setSourceByVirtualIndex;
|
|
4452
3671
|
exports.setStore = setStore;
|
|
3672
|
+
exports.timeout = timeout;
|
|
4453
3673
|
exports.toInteger = toInteger;
|
|
4454
3674
|
exports.trimmedPlugin = trimmedPlugin;
|
|
4455
3675
|
|
|
4456
|
-
//# sourceMappingURL=
|
|
3676
|
+
//# sourceMappingURL=index-91e92bea.js.map
|