@revolist/revogrid 4.22.1 → 4.23.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/{cell-renderer-BQdEGQXP.js → cell-renderer-Dcz022q7.js} +9 -3
- package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-DJueWxN_.js} +391 -256
- package/dist/cjs/{column.service-DXYMehqK.js → column.service-C1Qvcf5l.js} +10 -1
- package/dist/cjs/{dimension.helpers-CiiNnlLa.js → dimension.helpers-B9HgANnM.js} +14 -145
- package/dist/cjs/{edit.utils-CecCfA4E.js → edit.utils-pKeiYFLJ.js} +1 -1
- package/dist/cjs/{header-cell-renderer-DGyBrK8I.js → header-cell-renderer-QrcXXSkF.js} +1 -1
- package/dist/cjs/index-DxaSE5uZ.js +136 -0
- package/dist/cjs/index.cjs.js +37 -32
- package/dist/cjs/revo-grid.cjs.entry.js +124 -18
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +43 -25
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +10 -8
- package/dist/cjs/revogr-data_4.cjs.entry.js +74 -32
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
- package/dist/cjs/{text-editor-DnLZW1a-.js → text-editor-B4W-m-r-.js} +3 -3
- package/dist/cjs/{throttle-CfgQFkfR.js → throttle-BCwEuJJq.js} +59 -24
- package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
- package/dist/cjs/{viewport.store-q6YdR9mg.js → viewport.store-BlKQ4x9H.js} +16 -16
- package/dist/collection/components/data/revogr-data.js +5 -3
- package/dist/collection/components/header/header-group-renderer.js +1 -1
- package/dist/collection/components/header/header-renderer.js +1 -1
- package/dist/collection/components/header/revogr-header-style.css +13 -3
- package/dist/collection/components/header/revogr-header.js +53 -17
- package/dist/collection/components/order/order-row.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js +23 -1
- package/dist/collection/components/overlay/selection.utils.js +8 -6
- package/dist/collection/components/revoGrid/revo-grid.js +69 -5
- package/dist/collection/components/revoGrid/viewport.service.js +2 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
- package/dist/collection/plugins/filter/filter.panel.js +2 -1
- package/dist/collection/plugins/filter/filter.plugin.js +11 -4
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js +9 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
- package/dist/collection/plugins/sorting/sorting.func.js +173 -15
- package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
- package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
- package/dist/collection/serve/controller.js +98 -37
- package/dist/collection/serve/data.js +273 -144
- package/dist/collection/services/dimension.provider.js +16 -1
- package/dist/collection/services/local.scroll.service.js +59 -24
- package/dist/collection/services/scroll.dimension.helpers.js +83 -0
- package/dist/collection/services/selection.store.connector.js +30 -4
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
- package/dist/collection/store/dimension/dimension.store.js +4 -2
- package/dist/collection/store/vp/viewport.helpers.js +9 -0
- package/dist/collection/store/vp/viewport.store.js +5 -16
- package/dist/collection/utils/store.utils.js +3 -3
- package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-BtN-NGCk.js} +9 -3
- package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
- package/dist/esm/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
- package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
- package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/esm/index-Db3qZoW5.js +127 -0
- package/dist/esm/index.js +11 -10
- package/dist/esm/revo-grid.entry.js +123 -17
- package/dist/esm/revogr-attribution_7.entry.js +42 -24
- package/dist/esm/revogr-clipboard_3.entry.js +11 -9
- package/dist/esm/revogr-data_4.entry.js +75 -33
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
- package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-BtN-NGCk.js} +9 -3
- package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
- package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
- package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
- package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/revo-grid/index-Db3qZoW5.js +127 -0
- package/dist/revo-grid/index.esm.js +11 -10
- package/dist/revo-grid/revo-grid.entry.js +123 -17
- package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
- package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
- package/dist/revo-grid/revogr-data_4.entry.js +75 -33
- package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
- package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
- package/dist/types/components/header/header-group-renderer.d.ts +2 -0
- package/dist/types/components/header/header-renderer.d.ts +1 -0
- package/dist/types/components/header/revogr-header.d.ts +2 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +12 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
- package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
- package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
- package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
- package/dist/types/services/local.scroll.service.d.ts +10 -2
- package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
- package/dist/types/services/selection.store.connector.d.ts +6 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
- package/dist/types/types/interfaces.d.ts +11 -0
- package/dist/types/types/selection.d.ts +13 -0
- package/hydrate/index.js +795 -383
- package/hydrate/index.mjs +795 -383
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +1 -1
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/local.scroll.timer.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-row-headers.js +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/revogr-scroll-virtual2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
- package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
- package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Q as toFinite, U as keys, V as isArrayLike, W as baseIteratee, N as isArray, G as GRID_INTERNALS, X as isIterateeCall, a as getVisibleSourceItem, o as DISABLED_CLASS, C as CELL_CLASS, b as getSourceItem } from './dimension.helpers-CGKwSvw6.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Converts `value` to an integer.
|
|
@@ -437,6 +437,9 @@ const GROUPING_ROW_TYPE = 'rgRow';
|
|
|
437
437
|
function getGroupValueDefault(item, prop) {
|
|
438
438
|
return item[prop] || null;
|
|
439
439
|
}
|
|
440
|
+
function isDataRow(item) {
|
|
441
|
+
return item != null;
|
|
442
|
+
}
|
|
440
443
|
// get source based on proxy item collection to preserve rgRow order
|
|
441
444
|
function getSource(source, items, withoutGrouping = false) {
|
|
442
445
|
let index = 0;
|
|
@@ -458,6 +461,9 @@ function getSource(source, items, withoutGrouping = false) {
|
|
|
458
461
|
result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
|
|
459
462
|
}
|
|
460
463
|
}
|
|
464
|
+
else if (!isDataRow(model)) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
461
467
|
else {
|
|
462
468
|
result.source.push(model);
|
|
463
469
|
result.oldNewIndexes[i] = index;
|
|
@@ -538,6 +544,9 @@ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, exp
|
|
|
538
544
|
function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue = getGroupValueDefault, }) {
|
|
539
545
|
const groupedItems = new Map();
|
|
540
546
|
array.forEach((item, originalIndex) => {
|
|
547
|
+
if (!isDataRow(item)) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
541
550
|
const groupLevelValues = columnProps.map(groupId => getGroupValue(item, groupId));
|
|
542
551
|
const lastLevelValue = groupLevelValues.pop();
|
|
543
552
|
let currentGroupLevel = groupedItems;
|
|
@@ -482,4 +482,4 @@ function debounce(func, wait, options) {
|
|
|
482
482
|
return debounced;
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
-
export { Symbol as S,
|
|
485
|
+
export { Symbol as S, isObjectLike as a, baseGetTag as b, isSymbol as c, debounce as d, freeGlobal as f, isObject as i, root as r, toNumber as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { i as isObject, b as baseGetTag, r as root, S as Symbol, a as isObjectLike, f as freeGlobal, c as isSymbol, t as toNumber } from './debounce-PCRWZliA.js';
|
|
5
5
|
import { S as StencilCore } from './index-Chp_81rd.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -2706,7 +2706,7 @@ function createRange(fromRight) {
|
|
|
2706
2706
|
* _.range(0);
|
|
2707
2707
|
* // => []
|
|
2708
2708
|
*/
|
|
2709
|
-
var range
|
|
2709
|
+
var range = createRange();
|
|
2710
2710
|
|
|
2711
2711
|
const appendToMap = (map, propName, value) => {
|
|
2712
2712
|
let refs = map.get(propName);
|
|
@@ -3021,9 +3021,9 @@ function gatherTrimmedItems(trimmedItems) {
|
|
|
3021
3021
|
* @param data - The data to set on the store.
|
|
3022
3022
|
*/
|
|
3023
3023
|
function setStore(store, data) {
|
|
3024
|
-
Object.
|
|
3025
|
-
store.set(key,
|
|
3026
|
-
}
|
|
3024
|
+
for (const key of Object.keys(data)) {
|
|
3025
|
+
store.set(key, data[key]);
|
|
3026
|
+
}
|
|
3027
3027
|
}
|
|
3028
3028
|
|
|
3029
3029
|
const MIN_COL_SIZE = 30;
|
|
@@ -3132,127 +3132,6 @@ var osPlatform;
|
|
|
3132
3132
|
})(osPlatform || (osPlatform = {}));
|
|
3133
3133
|
var OsPlatform = osPlatform;
|
|
3134
3134
|
|
|
3135
|
-
/* Generate range on size
|
|
3136
|
-
*/
|
|
3137
|
-
function range(size, startAt = 0) {
|
|
3138
|
-
const res = [];
|
|
3139
|
-
const end = startAt + size;
|
|
3140
|
-
for (let i = startAt; i < end; i++) {
|
|
3141
|
-
res.push(i);
|
|
3142
|
-
}
|
|
3143
|
-
return res;
|
|
3144
|
-
}
|
|
3145
|
-
/* Find index position in array */
|
|
3146
|
-
function findPositionInArray(el, compareFn) {
|
|
3147
|
-
return (function (arr) {
|
|
3148
|
-
let m = 0;
|
|
3149
|
-
let n = arr.length - 1;
|
|
3150
|
-
while (m <= n) {
|
|
3151
|
-
const k = (n + m) >> 1;
|
|
3152
|
-
const cmp = compareFn(el, arr[k]);
|
|
3153
|
-
if (cmp > 0) {
|
|
3154
|
-
m = k + 1;
|
|
3155
|
-
}
|
|
3156
|
-
else if (cmp < 0) {
|
|
3157
|
-
n = k - 1;
|
|
3158
|
-
}
|
|
3159
|
-
else {
|
|
3160
|
-
return k;
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
return -m - 1;
|
|
3164
|
-
})(this);
|
|
3165
|
-
}
|
|
3166
|
-
/**
|
|
3167
|
-
* Sorted push
|
|
3168
|
-
*/
|
|
3169
|
-
function pushSorted(arr, el, fn) {
|
|
3170
|
-
arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
|
|
3171
|
-
return arr;
|
|
3172
|
-
}
|
|
3173
|
-
// (arr1[index1] < arr2[index2])
|
|
3174
|
-
function simpleCompare(el1, el2) {
|
|
3175
|
-
return el1 < el2;
|
|
3176
|
-
}
|
|
3177
|
-
/**
|
|
3178
|
-
* Merge sorted array helper function
|
|
3179
|
-
*/
|
|
3180
|
-
function mergeSortedArray(arr1, arr2, compareFn = simpleCompare) {
|
|
3181
|
-
const merged = [];
|
|
3182
|
-
let index1 = 0;
|
|
3183
|
-
let index2 = 0;
|
|
3184
|
-
let current = 0;
|
|
3185
|
-
while (current < arr1.length + arr2.length) {
|
|
3186
|
-
let isArr1Depleted = index1 >= arr1.length;
|
|
3187
|
-
let isArr2Depleted = index2 >= arr2.length;
|
|
3188
|
-
if (!isArr1Depleted && (isArr2Depleted || compareFn(arr1[index1], arr2[index2]))) {
|
|
3189
|
-
merged[current] = arr1[index1];
|
|
3190
|
-
index1++;
|
|
3191
|
-
}
|
|
3192
|
-
else {
|
|
3193
|
-
merged[current] = arr2[index2];
|
|
3194
|
-
index2++;
|
|
3195
|
-
}
|
|
3196
|
-
current++;
|
|
3197
|
-
}
|
|
3198
|
-
return merged;
|
|
3199
|
-
}
|
|
3200
|
-
/**
|
|
3201
|
-
* Calculate system scrollbar size
|
|
3202
|
-
*/
|
|
3203
|
-
function getScrollbarSize(document) {
|
|
3204
|
-
// Create a temporary div container and append it to the body
|
|
3205
|
-
const container = document.createElement('div');
|
|
3206
|
-
// Apply styling to ensure the div is scrollable
|
|
3207
|
-
container.style.overflow = 'scroll';
|
|
3208
|
-
container.style.visibility = 'hidden'; // make sure the container isn't visible
|
|
3209
|
-
container.style.position = 'absolute';
|
|
3210
|
-
container.style.top = '-9999px'; // move it out of the screen
|
|
3211
|
-
container.style.width = '50px'; // arbitrary width
|
|
3212
|
-
container.style.height = '50px'; // arbitrary height
|
|
3213
|
-
// Append the div to the body
|
|
3214
|
-
document.body.appendChild(container);
|
|
3215
|
-
// Calculate the width of the scrollbar
|
|
3216
|
-
const scrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
3217
|
-
// Remove the div from the body after calculation
|
|
3218
|
-
document.body.removeChild(container);
|
|
3219
|
-
// Return the calculated width of the scrollbar
|
|
3220
|
-
return scrollbarWidth;
|
|
3221
|
-
}
|
|
3222
|
-
/* Scale a value between 2 ranges
|
|
3223
|
-
*
|
|
3224
|
-
* Sample:
|
|
3225
|
-
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
3226
|
-
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
3227
|
-
*
|
|
3228
|
-
* Ranges of two values
|
|
3229
|
-
* @from
|
|
3230
|
-
* @to
|
|
3231
|
-
*
|
|
3232
|
-
* ~~ return value does the equivalent of Math.floor but faster.
|
|
3233
|
-
*/
|
|
3234
|
-
function scaleValue(value, from, to) {
|
|
3235
|
-
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
3236
|
-
}
|
|
3237
|
-
/**
|
|
3238
|
-
* Async timeout
|
|
3239
|
-
*/
|
|
3240
|
-
async function timeout(delay = 0) {
|
|
3241
|
-
await new Promise((r) => {
|
|
3242
|
-
setTimeout(() => r(), delay);
|
|
3243
|
-
});
|
|
3244
|
-
}
|
|
3245
|
-
/**
|
|
3246
|
-
* Type script mixins
|
|
3247
|
-
*/
|
|
3248
|
-
function applyMixins(derivedCtor, constructors) {
|
|
3249
|
-
constructors.forEach(baseCtor => {
|
|
3250
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
3251
|
-
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
|
|
3252
|
-
});
|
|
3253
|
-
});
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
3135
|
/**
|
|
3257
3136
|
* Data store
|
|
3258
3137
|
* Manage the state of a data source and provide methods for updating, adding, and refreshing the data.
|
|
@@ -3286,7 +3165,7 @@ class DataStore {
|
|
|
3286
3165
|
}
|
|
3287
3166
|
// clear items
|
|
3288
3167
|
this.store.set('items', []);
|
|
3289
|
-
const items = range
|
|
3168
|
+
const items = range(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
|
|
3290
3169
|
// set proxy first
|
|
3291
3170
|
setStore(this.store, {
|
|
3292
3171
|
source,
|
|
@@ -3617,4 +3496,4 @@ function getItemByIndex(dimension, index) {
|
|
|
3617
3496
|
return item;
|
|
3618
3497
|
}
|
|
3619
3498
|
|
|
3620
|
-
export {
|
|
3499
|
+
export { DRAGG_TEXT as A, ROW_FOCUSED_CLASS as B, CELL_CLASS as C, DataStore as D, EDIT_INPUT_WR as E, FOCUS_CLASS as F, GRID_INTERNALS as G, HEADER_CLASS as H, codesLetter as I, keyValues as J, createStore as K, identity as L, MIN_COL_SIZE as M, isArray as N, KeyCodesEnum as O, OsPlatform as P, toFinite as Q, RESIZE_INTERVAL as R, SELECTION_BORDER_CLASS as S, TMP_SELECTION_BG_CLASS as T, keys as U, isArrayLike as V, baseIteratee as W, isIterateeCall as X, getVisibleSourceItem as a, getSourceItem as b, getSourcePhysicalIndex as c, setSourceByPhysicalIndex as d, setItems as e, getSourceItemVirtualIndexByProp as f, getPhysical as g, gatherTrimmedItems as h, calculateDimensionData as i, getItemByPosition as j, getItemByIndex as k, setStore as l, DATA_COL as m, DATA_ROW as n, DISABLED_CLASS as o, proxyPlugin as p, ROW_HEADER_TYPE as q, HEADER_SORTABLE_CLASS as r, setSourceByVirtualIndex as s, trimmedPlugin as t, HEADER_ROW_CLASS as u, HEADER_ACTUAL_ROW_CLASS as v, DRAG_ICON_CLASS as w, DRAGGABLE_CLASS as x, MOBILE_CLASS as y, CELL_HANDLER_CLASS as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { O as KeyCodesEnum, P as OsPlatform, I as codesLetter, J as keyValues, E as EDIT_INPUT_WR } from './dimension.helpers-CGKwSvw6.js';
|
|
5
5
|
|
|
6
6
|
function isMetaKey(code) {
|
|
7
7
|
const keys = [
|
package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-BsvUQ8GS.js}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h } from './index-Chp_81rd.js';
|
|
5
|
-
import { Q as doPropMerge } from './column.service-
|
|
5
|
+
import { Q as doPropMerge } from './column.service-CC_SD8W3.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Dispatches a custom event to a specified target element.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist OU ❤️
|
|
3
|
+
*/
|
|
4
|
+
import './dimension.helpers-CGKwSvw6.js';
|
|
5
|
+
|
|
6
|
+
/* Generate range on size
|
|
7
|
+
*/
|
|
8
|
+
function range(size, startAt = 0) {
|
|
9
|
+
const res = [];
|
|
10
|
+
const end = startAt + size;
|
|
11
|
+
for (let i = startAt; i < end; i++) {
|
|
12
|
+
res.push(i);
|
|
13
|
+
}
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
/* Find index position in array */
|
|
17
|
+
function findPositionInArray(el, compareFn) {
|
|
18
|
+
return (function (arr) {
|
|
19
|
+
let m = 0;
|
|
20
|
+
let n = arr.length - 1;
|
|
21
|
+
while (m <= n) {
|
|
22
|
+
const k = (n + m) >> 1;
|
|
23
|
+
const cmp = compareFn(el, arr[k]);
|
|
24
|
+
if (cmp > 0) {
|
|
25
|
+
m = k + 1;
|
|
26
|
+
}
|
|
27
|
+
else if (cmp < 0) {
|
|
28
|
+
n = k - 1;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return k;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return -m - 1;
|
|
35
|
+
})(this);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sorted push
|
|
39
|
+
*/
|
|
40
|
+
function pushSorted(arr, el, fn) {
|
|
41
|
+
arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
|
|
42
|
+
return arr;
|
|
43
|
+
}
|
|
44
|
+
// (arr1[index1] < arr2[index2])
|
|
45
|
+
function simpleCompare(el1, el2) {
|
|
46
|
+
return el1 < el2;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Merge sorted array helper function
|
|
50
|
+
*/
|
|
51
|
+
function mergeSortedArray(arr1, arr2, compareFn = simpleCompare) {
|
|
52
|
+
const merged = [];
|
|
53
|
+
let index1 = 0;
|
|
54
|
+
let index2 = 0;
|
|
55
|
+
let current = 0;
|
|
56
|
+
while (current < arr1.length + arr2.length) {
|
|
57
|
+
let isArr1Depleted = index1 >= arr1.length;
|
|
58
|
+
let isArr2Depleted = index2 >= arr2.length;
|
|
59
|
+
if (!isArr1Depleted && (isArr2Depleted || compareFn(arr1[index1], arr2[index2]))) {
|
|
60
|
+
merged[current] = arr1[index1];
|
|
61
|
+
index1++;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
merged[current] = arr2[index2];
|
|
65
|
+
index2++;
|
|
66
|
+
}
|
|
67
|
+
current++;
|
|
68
|
+
}
|
|
69
|
+
return merged;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Calculate system scrollbar size
|
|
73
|
+
*/
|
|
74
|
+
function getScrollbarSize(document) {
|
|
75
|
+
// Create a temporary div container and append it to the body
|
|
76
|
+
const container = document.createElement('div');
|
|
77
|
+
// Apply styling to ensure the div is scrollable
|
|
78
|
+
container.style.overflow = 'scroll';
|
|
79
|
+
container.style.visibility = 'hidden'; // make sure the container isn't visible
|
|
80
|
+
container.style.position = 'absolute';
|
|
81
|
+
container.style.top = '-9999px'; // move it out of the screen
|
|
82
|
+
container.style.width = '50px'; // arbitrary width
|
|
83
|
+
container.style.height = '50px'; // arbitrary height
|
|
84
|
+
// Append the div to the body
|
|
85
|
+
document.body.appendChild(container);
|
|
86
|
+
// Calculate the width of the scrollbar
|
|
87
|
+
const scrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
88
|
+
// Remove the div from the body after calculation
|
|
89
|
+
document.body.removeChild(container);
|
|
90
|
+
// Return the calculated width of the scrollbar
|
|
91
|
+
return scrollbarWidth;
|
|
92
|
+
}
|
|
93
|
+
/* Scale a value between 2 ranges
|
|
94
|
+
*
|
|
95
|
+
* Sample:
|
|
96
|
+
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
97
|
+
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
98
|
+
*
|
|
99
|
+
* Ranges of two values
|
|
100
|
+
* @from
|
|
101
|
+
* @to
|
|
102
|
+
*
|
|
103
|
+
* ~~ return value does the equivalent of Math.floor but faster.
|
|
104
|
+
*/
|
|
105
|
+
function scaleValue(value, from, to) {
|
|
106
|
+
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Async timeout
|
|
110
|
+
*/
|
|
111
|
+
async function timeout(delay = 0) {
|
|
112
|
+
await new Promise((r) => {
|
|
113
|
+
setTimeout(() => r(), delay);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Type script mixins
|
|
118
|
+
*/
|
|
119
|
+
function applyMixins(derivedCtor, constructors) {
|
|
120
|
+
constructors.forEach(baseCtor => {
|
|
121
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
122
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { applyMixins as a, findPositionInArray as f, getScrollbarSize as g, mergeSortedArray as m, pushSorted as p, range as r, scaleValue as s, timeout as t };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
export { o as GROUPING_ROW_TYPE, j as GROUP_COLUMN_PROP, G as GROUP_DEPTH, h as GROUP_EXPANDED, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, k as GROUP_ORIGINAL_INDEX, f as PSEUDO_GROUP_COLUMN, P as PSEUDO_GROUP_ITEM, d as PSEUDO_GROUP_ITEM_ID, e as PSEUDO_GROUP_ITEM_VALUE, c as columnTypes, a as cropCellToMax, H as gatherGroup, s as gatherGrouping, z as getCellData, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, D as getColumnSizes, C as getColumnType, F as getColumns, q as getExpanded, t as getGroupingName, x as getParsedGroup, g as getRange, p as getSource, E as isColGrouping, u as isGrouping, v as isGroupingColumn, b as isRangeSingleCell, i as isRowType, y as isSameGroup, w as measureEqualDepth, n as nextCell, r as rowTypes } from './column.service-
|
|
5
|
-
import { B as BasePlugin } from './column.drag.plugin-
|
|
6
|
-
export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, r as SortingPlugin, a as StretchColumn,
|
|
7
|
-
export { d as dispatch, a as dispatchByEvent } from './header-cell-renderer-
|
|
8
|
-
export { C as CellRenderer, G as GroupingRowRenderer, S as SortingSign, e as expandEvent, a as expandSvgIconVNode } from './cell-renderer-
|
|
9
|
-
export {
|
|
10
|
-
export { T as TextEditor } from './text-editor-
|
|
11
|
-
export { k as isAll, c as isClear, h as isCopy, a as isCtrlKey, b as isCtrlMetaKey, g as isCut, m as isEditInput, n as isEditorCtrConstructible, f as isEnterKeyValue, i as isMetaKey, j as isPaste, l as isShortcutModifier, d as isTab, e as isTabKeyValue } from './edit.utils-
|
|
4
|
+
export { o as GROUPING_ROW_TYPE, j as GROUP_COLUMN_PROP, G as GROUP_DEPTH, h as GROUP_EXPANDED, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, k as GROUP_ORIGINAL_INDEX, f as PSEUDO_GROUP_COLUMN, P as PSEUDO_GROUP_ITEM, d as PSEUDO_GROUP_ITEM_ID, e as PSEUDO_GROUP_ITEM_VALUE, c as columnTypes, a as cropCellToMax, H as gatherGroup, s as gatherGrouping, z as getCellData, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, D as getColumnSizes, C as getColumnType, F as getColumns, q as getExpanded, t as getGroupingName, x as getParsedGroup, g as getRange, p as getSource, E as isColGrouping, u as isGrouping, v as isGroupingColumn, b as isRangeSingleCell, i as isRowType, y as isSameGroup, w as measureEqualDepth, n as nextCell, r as rowTypes } from './column.service-CC_SD8W3.js';
|
|
5
|
+
import { B as BasePlugin } from './column.drag.plugin-DCZW62Uc.js';
|
|
6
|
+
export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, r as SortingPlugin, a as StretchColumn, v as defaultCellCompare, w as descCellCompare, j as doCollapse, k as doExpand, f as filterCoreFunctionsIndexedByType, h as filterNames, g as filterTypes, y as getComparer, q as getLeftRelative, x as getNextOrder, t as getSortingIndex, s as hasActiveSorting, i as isStretchPlugin, u as sortIndexByItems } from './column.drag.plugin-DCZW62Uc.js';
|
|
7
|
+
export { d as dispatch, a as dispatchByEvent } from './header-cell-renderer-BsvUQ8GS.js';
|
|
8
|
+
export { C as CellRenderer, G as GroupingRowRenderer, S as SortingSign, e as expandEvent, a as expandSvgIconVNode } from './cell-renderer-BtN-NGCk.js';
|
|
9
|
+
export { a as applyMixins, f as findPositionInArray, g as getScrollbarSize, m as mergeSortedArray, p as pushSorted, r as range, s as scaleValue, t as timeout } from './index-Db3qZoW5.js';
|
|
10
|
+
export { T as TextEditor } from './text-editor-C3RUSwH5.js';
|
|
11
|
+
export { k as isAll, c as isClear, h as isCopy, a as isCtrlKey, b as isCtrlMetaKey, g as isCut, m as isEditInput, n as isEditorCtrConstructible, f as isEnterKeyValue, i as isMetaKey, j as isPaste, l as isShortcutModifier, d as isTab, e as isTabKeyValue } from './edit.utils-Dnnbd0xG.js';
|
|
12
12
|
export { h } from './index-Chp_81rd.js';
|
|
13
|
-
export {
|
|
13
|
+
export { C as CELL_CLASS, z as CELL_HANDLER_CLASS, m as DATA_COL, n as DATA_ROW, o as DISABLED_CLASS, x as DRAGGABLE_CLASS, A as DRAGG_TEXT, w as DRAG_ICON_CLASS, D as DataStore, E as EDIT_INPUT_WR, F as FOCUS_CLASS, G as GRID_INTERNALS, v as HEADER_ACTUAL_ROW_CLASS, H as HEADER_CLASS, u as HEADER_ROW_CLASS, r as HEADER_SORTABLE_CLASS, M as MIN_COL_SIZE, y as MOBILE_CLASS, R as RESIZE_INTERVAL, B as ROW_FOCUSED_CLASS, q as ROW_HEADER_TYPE, S as SELECTION_BORDER_CLASS, T as TMP_SELECTION_BG_CLASS, i as calculateDimensionData, I as codesLetter, h as gatherTrimmedItems, k as getItemByIndex, j as getItemByPosition, g as getPhysical, b as getSourceItem, f as getSourceItemVirtualIndexByProp, c as getSourcePhysicalIndex, a as getVisibleSourceItem, J as keyValues, p as proxyPlugin, e as setItems, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, l as setStore, t as trimmedPlugin } from './dimension.helpers-CGKwSvw6.js';
|
|
14
|
+
export { V as ViewportStore, b as addMissingItems, j as calculateRowHeaderSize, c as clampViewportCoordinate, f as getFirstItem, d as getItems, h as getLastItem, a as getUpdatedItemsByPosition, g as getViewportMaxCoordinate, i as isActiveRange, e as isActiveRangeOutsideLastItem, r as recombineByOffset, s as setItemSizes, u as updateMissingAndRange } from './viewport.store-COAfzAyu.js';
|
|
14
15
|
export { A as AND_OR_BUTTON, e as AndOrButton, a as FILTER_BUTTON_ACTIVE, F as FILTER_BUTTON_CLASS, b as FILTER_PROP, c as FilterButton, T as TRASH_BUTTON, d as TrashButton, i as isFilterBtn } from './filter.button-C8XTWPU2.js';
|
|
15
|
-
import './debounce-
|
|
16
|
+
import './debounce-PCRWZliA.js';
|
|
16
17
|
|
|
17
18
|
const REVOGRID_EVENTS = new Map([
|
|
18
19
|
['contentsizechanged', 'contentsizechanged'],
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h, r as registerInstance, d as createEvent, e as Host, g as getElement } from './index-Chp_81rd.js';
|
|
5
|
-
import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as isRowType, D as getColumnSizes, a as cropCellToMax, n as nextCell, I as getColumnByProp, F as getColumns } from './column.service-
|
|
6
|
-
import { D as DataStore, b as getSourceItem, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems, k as getItemByIndex, R as RESIZE_INTERVAL
|
|
7
|
-
import { d as debounce } from './debounce-
|
|
8
|
-
import {
|
|
9
|
-
import { V as ViewportStore } from './viewport.store-
|
|
5
|
+
import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as isRowType, D as getColumnSizes, a as cropCellToMax, n as nextCell, I as getColumnByProp, F as getColumns } from './column.service-CC_SD8W3.js';
|
|
6
|
+
import { D as DataStore, b as getSourceItem, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems, k as getItemByIndex, R as RESIZE_INTERVAL } from './dimension.helpers-CGKwSvw6.js';
|
|
7
|
+
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
8
|
+
import { g as getScrollDimension, v as viewportDataPartition, F as FOOTER_SLOT, C as CONTENT_SLOT, H as HEADER_SLOT, D as DATA_SLOT } from './viewport.helpers-CoCAvmZs.js';
|
|
9
|
+
import { c as clampViewportCoordinate, V as ViewportStore } from './viewport.store-COAfzAyu.js';
|
|
10
|
+
import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, r as SortingPlugin, p as ColumnMovePlugin } from './column.drag.plugin-DCZW62Uc.js';
|
|
10
11
|
import { T as ThemeService } from './theme.service-BmnDvr6P.js';
|
|
11
|
-
import {
|
|
12
|
+
import { t as timeout } from './index-Db3qZoW5.js';
|
|
12
13
|
import { g as getPropertyFromEvent } from './events-BvSmBueA.js';
|
|
13
14
|
import './filter.button-C8XTWPU2.js';
|
|
14
|
-
import './header-cell-renderer-
|
|
15
|
+
import './header-cell-renderer-BsvUQ8GS.js';
|
|
15
16
|
|
|
16
17
|
class ColumnDataProvider {
|
|
17
18
|
get stores() {
|
|
@@ -363,6 +364,20 @@ class DimensionProvider {
|
|
|
363
364
|
}
|
|
364
365
|
setViewPortCoordinate({ type, coordinate = this.viewports.stores[type].lastCoordinate, force = false, }) {
|
|
365
366
|
const dimension = this.stores[type].getCurrentState();
|
|
367
|
+
const viewport = this.viewports.stores[type].store;
|
|
368
|
+
const clientSize = viewport.get('clientSize');
|
|
369
|
+
const viewportSize = viewport.get('virtualSize');
|
|
370
|
+
const scrollDimension = getScrollDimension({
|
|
371
|
+
contentSize: dimension.realSize,
|
|
372
|
+
clientSize,
|
|
373
|
+
virtualSize: viewportSize,
|
|
374
|
+
});
|
|
375
|
+
const renderCoordinate = clampViewportCoordinate(coordinate, dimension, viewportSize);
|
|
376
|
+
const renderOffset = clientSize && viewportSize
|
|
377
|
+
? scrollDimension.getRenderOffset(renderCoordinate)
|
|
378
|
+
: 0;
|
|
379
|
+
this.stores[type].setStore({ renderOffset });
|
|
380
|
+
this.viewports.stores[type].setViewport({ renderOffset });
|
|
366
381
|
this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
|
|
367
382
|
}
|
|
368
383
|
getViewPortPos(e) {
|
|
@@ -511,7 +526,8 @@ class ViewportService {
|
|
|
511
526
|
(_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
|
|
512
527
|
// set resize event
|
|
513
528
|
const changedItems = {};
|
|
514
|
-
for (const
|
|
529
|
+
for (const i of Object.keys(detail || {})) {
|
|
530
|
+
const size = detail[i];
|
|
515
531
|
const virtualIndex = parseInt(i, 10);
|
|
516
532
|
const item = getSourceItem(store, virtualIndex);
|
|
517
533
|
if (item) {
|
|
@@ -766,13 +782,11 @@ class SelectionStoreConnector {
|
|
|
766
782
|
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
767
783
|
}
|
|
768
784
|
registerColumn(x, type) {
|
|
785
|
+
this.updateColumnTypeMapping(x, type);
|
|
769
786
|
if (this.columnStores[x]) {
|
|
770
787
|
return this.columnStores[x];
|
|
771
788
|
}
|
|
772
789
|
this.columnStores[x] = new SelectionStore();
|
|
773
|
-
// build cross-linking type to position
|
|
774
|
-
this.storesByType[type] = x;
|
|
775
|
-
this.storesXToType[x] = type;
|
|
776
790
|
return this.columnStores[x];
|
|
777
791
|
}
|
|
778
792
|
registerRow(y, type) {
|
|
@@ -914,7 +928,10 @@ class SelectionStoreConnector {
|
|
|
914
928
|
const nextItem = nextCell(focus, lastCell);
|
|
915
929
|
let nextStore;
|
|
916
930
|
if (nextItem) {
|
|
917
|
-
Object.
|
|
931
|
+
Object.keys(nextItem).forEach((t) => {
|
|
932
|
+
var _a;
|
|
933
|
+
const type = t;
|
|
934
|
+
const nextItemCoord = (_a = nextItem[type]) !== null && _a !== void 0 ? _a : 0;
|
|
918
935
|
let stores;
|
|
919
936
|
switch (type) {
|
|
920
937
|
case 'x':
|
|
@@ -990,6 +1007,31 @@ class SelectionStoreConnector {
|
|
|
990
1007
|
}
|
|
991
1008
|
return stores;
|
|
992
1009
|
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Keep column viewport positions and types in sync across pin/unpin rerenders.
|
|
1012
|
+
* Regression case: when a selected rgCol cell was pinned left, colPinStart
|
|
1013
|
+
* could take over x=0 and render the stale rgCol focus store in the pinned area.
|
|
1014
|
+
*/
|
|
1015
|
+
updateColumnTypeMapping(x, type) {
|
|
1016
|
+
const previousType = this.storesXToType[x];
|
|
1017
|
+
const previousX = this.storesByType[type];
|
|
1018
|
+
let shouldClearFocus = false;
|
|
1019
|
+
this.storesByType[type] = x;
|
|
1020
|
+
this.storesXToType[x] = type;
|
|
1021
|
+
if (previousType && previousType !== type) {
|
|
1022
|
+
shouldClearFocus = true;
|
|
1023
|
+
if (this.storesByType[previousType] === x) {
|
|
1024
|
+
delete this.storesByType[previousType];
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (typeof previousX === 'number' && previousX !== x && this.storesXToType[previousX] === type) {
|
|
1028
|
+
delete this.storesXToType[previousX];
|
|
1029
|
+
shouldClearFocus = true;
|
|
1030
|
+
}
|
|
1031
|
+
if (shouldClearFocus) {
|
|
1032
|
+
this.clearAll();
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
993
1035
|
}
|
|
994
1036
|
|
|
995
1037
|
/**
|
|
@@ -1939,6 +1981,7 @@ const RevoGridComponent = class {
|
|
|
1939
1981
|
if (!this.dimensionProvider || !this.columnProvider) {
|
|
1940
1982
|
return;
|
|
1941
1983
|
}
|
|
1984
|
+
const focusToRestore = init ? undefined : this.getColumnFocusRestore();
|
|
1942
1985
|
const beforeGatherEvent = this.beforecolumnsgather.emit({
|
|
1943
1986
|
columns: [...newVal],
|
|
1944
1987
|
});
|
|
@@ -1956,14 +1999,76 @@ const RevoGridComponent = class {
|
|
|
1956
1999
|
return;
|
|
1957
2000
|
}
|
|
1958
2001
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
2002
|
+
if (focusToRestore) {
|
|
2003
|
+
this.pendingColumnFocusRestore = focusToRestore;
|
|
2004
|
+
}
|
|
2005
|
+
const order = {};
|
|
2006
|
+
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
2007
|
+
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
2008
|
+
}
|
|
1959
2009
|
this.aftercolumnsset.emit({
|
|
1960
2010
|
columns,
|
|
1961
|
-
order
|
|
1962
|
-
acc[prop] = column.order;
|
|
1963
|
-
return acc;
|
|
1964
|
-
}, {}),
|
|
2011
|
+
order,
|
|
1965
2012
|
});
|
|
1966
2013
|
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Capture logical focus before columns are repartitioned by pin state.
|
|
2016
|
+
* Regression case: selecting a regular cell, then pinning that column left,
|
|
2017
|
+
* used to let the new pinned viewport reuse the old rgCol selection store.
|
|
2018
|
+
*/
|
|
2019
|
+
getColumnFocusRestore() {
|
|
2020
|
+
var _a, _b, _c, _d;
|
|
2021
|
+
const focused = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getFocused();
|
|
2022
|
+
const prevStoreX = (_c = (_b = this.selectionStoreConnector) === null || _b === void 0 ? void 0 : _b.focusedStore) === null || _c === void 0 ? void 0 : _c.position.x;
|
|
2023
|
+
const prop = (_d = focused === null || focused === void 0 ? void 0 : focused.column) === null || _d === void 0 ? void 0 : _d.prop;
|
|
2024
|
+
if (!focused || prop === undefined || prevStoreX === undefined) {
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
return {
|
|
2028
|
+
prop,
|
|
2029
|
+
colType: focused.colType,
|
|
2030
|
+
colIndex: focused.cell.x,
|
|
2031
|
+
prevStoreX,
|
|
2032
|
+
rowType: focused.rowType,
|
|
2033
|
+
rowIndex: focused.cell.y,
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* Reapply focus by column prop after render, once pinning has moved the
|
|
2038
|
+
* column to its new viewport and virtual index.
|
|
2039
|
+
*/
|
|
2040
|
+
restoreColumnFocusAfterRender() {
|
|
2041
|
+
var _a, _b, _c, _d;
|
|
2042
|
+
const pending = this.pendingColumnFocusRestore;
|
|
2043
|
+
if (!pending) {
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
this.pendingColumnFocusRestore = undefined;
|
|
2047
|
+
if (!this.viewport || !this.columnProvider) {
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
const column = (_b = (_a = this.columnProvider.getColumnByProp(pending.prop)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : getColumnByProp(this.columns, pending.prop);
|
|
2051
|
+
if (!column) {
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
const colType = column.pin || 'rgCol';
|
|
2055
|
+
const columnIndex = this.columnProvider.getColumnIndexByProp(pending.prop, colType);
|
|
2056
|
+
if (columnIndex < 0) {
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
// Header-only column refreshes should not collapse an existing range.
|
|
2060
|
+
// Replay focus only when pin/unpin or repartitioning moved the logical column.
|
|
2061
|
+
if (colType === pending.colType &&
|
|
2062
|
+
columnIndex === pending.colIndex &&
|
|
2063
|
+
pending.prevStoreX === ((_d = (_c = this.selectionStoreConnector) === null || _c === void 0 ? void 0 : _c.focusedStore) === null || _d === void 0 ? void 0 : _d.position.x)) {
|
|
2064
|
+
return;
|
|
2065
|
+
}
|
|
2066
|
+
const cell = {
|
|
2067
|
+
x: columnIndex,
|
|
2068
|
+
y: pending.rowIndex,
|
|
2069
|
+
};
|
|
2070
|
+
this.viewport.setFocus(colType, pending.rowType, cell, cell);
|
|
2071
|
+
}
|
|
1967
2072
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
1968
2073
|
if (newVal === prevVal) {
|
|
1969
2074
|
return;
|
|
@@ -2250,7 +2355,7 @@ const RevoGridComponent = class {
|
|
|
2250
2355
|
if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
|
|
2251
2356
|
this.trimmedRowsChanged(this.trimmedRows);
|
|
2252
2357
|
}
|
|
2253
|
-
this.rowDefChanged(this.rowDefinitions);
|
|
2358
|
+
this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
|
|
2254
2359
|
// init grouping
|
|
2255
2360
|
if (this.grouping && Object.keys(this.grouping).length > 0) {
|
|
2256
2361
|
this.groupingChanged(this.grouping);
|
|
@@ -2276,6 +2381,7 @@ const RevoGridComponent = class {
|
|
|
2276
2381
|
return Promise.all(this.jobsBeforeRender);
|
|
2277
2382
|
}
|
|
2278
2383
|
componentDidRender() {
|
|
2384
|
+
this.restoreColumnFocusAfterRender();
|
|
2279
2385
|
this.aftergridrender.emit();
|
|
2280
2386
|
}
|
|
2281
2387
|
render() {
|