@revolist/revogrid 4.23.0 → 4.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cell-renderer-DWJ9Px9f.js → cell-renderer-Dcz022q7.js} +1 -1
- package/dist/cjs/{column.drag.plugin-CaEBDG-Q.js → column.drag.plugin-DJueWxN_.js} +2 -2
- package/dist/cjs/{column.service-f612L4ql.js → column.service-C1Qvcf5l.js} +9 -0
- package/dist/cjs/{header-cell-renderer-4yq9_WbM.js → header-cell-renderer-QrcXXSkF.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/revo-grid.cjs.entry.js +92 -6
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +55 -20
- package/dist/collection/components/header/revogr-header.js +49 -16
- package/dist/collection/components/revoGrid/revo-grid.js +63 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +4 -2
- package/dist/collection/plugins/groupingRow/grouping.service.js +9 -0
- package/dist/collection/services/selection.store.connector.js +26 -3
- package/dist/esm/{cell-renderer-8UiGd-s7.js → cell-renderer-BtN-NGCk.js} +1 -1
- package/dist/esm/{column.drag.plugin-BsfhsfmB.js → column.drag.plugin-DCZW62Uc.js} +2 -2
- package/dist/esm/{column.service-DbpulTog.js → column.service-CC_SD8W3.js} +9 -0
- package/dist/esm/{header-cell-renderer-DGI2FAD8.js → header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/revo-grid.entry.js +92 -6
- package/dist/esm/revogr-attribution_7.entry.js +1 -1
- package/dist/esm/revogr-data_4.entry.js +55 -20
- package/dist/revo-grid/{cell-renderer-8UiGd-s7.js → cell-renderer-BtN-NGCk.js} +1 -1
- package/dist/revo-grid/{column.drag.plugin-BsfhsfmB.js → column.drag.plugin-DCZW62Uc.js} +2 -2
- package/dist/revo-grid/{column.service-DbpulTog.js → column.service-CC_SD8W3.js} +9 -0
- package/dist/revo-grid/{header-cell-renderer-DGI2FAD8.js → header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/revo-grid/index.esm.js +5 -5
- package/dist/revo-grid/revo-grid.entry.js +92 -6
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +55 -20
- package/dist/types/components/header/header-group-renderer.d.ts +1 -0
- package/dist/types/components/header/revogr-header.d.ts +2 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +12 -0
- package/dist/types/services/selection.store.connector.d.ts +6 -0
- package/dist/types/types/selection.d.ts +13 -0
- package/hydrate/index.js +150 -20
- package/hydrate/index.mjs +150 -20
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
package/hydrate/index.mjs
CHANGED
|
@@ -12643,6 +12643,9 @@ const GROUPING_ROW_TYPE = 'rgRow';
|
|
|
12643
12643
|
function getGroupValueDefault(item, prop) {
|
|
12644
12644
|
return item[prop] || null;
|
|
12645
12645
|
}
|
|
12646
|
+
function isDataRow(item) {
|
|
12647
|
+
return item != null;
|
|
12648
|
+
}
|
|
12646
12649
|
// get source based on proxy item collection to preserve rgRow order
|
|
12647
12650
|
function getSource(source, items, withoutGrouping = false) {
|
|
12648
12651
|
let index = 0;
|
|
@@ -12664,6 +12667,9 @@ function getSource(source, items, withoutGrouping = false) {
|
|
|
12664
12667
|
result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
|
|
12665
12668
|
}
|
|
12666
12669
|
}
|
|
12670
|
+
else if (!isDataRow(model)) {
|
|
12671
|
+
return;
|
|
12672
|
+
}
|
|
12667
12673
|
else {
|
|
12668
12674
|
result.source.push(model);
|
|
12669
12675
|
result.oldNewIndexes[i] = index;
|
|
@@ -12744,6 +12750,9 @@ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, exp
|
|
|
12744
12750
|
function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue = getGroupValueDefault, }) {
|
|
12745
12751
|
const groupedItems = new Map();
|
|
12746
12752
|
array.forEach((item, originalIndex) => {
|
|
12753
|
+
if (!isDataRow(item)) {
|
|
12754
|
+
return;
|
|
12755
|
+
}
|
|
12747
12756
|
const groupLevelValues = columnProps.map(groupId => getGroupValue(item, groupId));
|
|
12748
12757
|
const lastLevelValue = groupLevelValues.pop();
|
|
12749
12758
|
let currentGroupLevel = groupedItems;
|
|
@@ -17652,13 +17661,11 @@ class SelectionStoreConnector {
|
|
|
17652
17661
|
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
17653
17662
|
}
|
|
17654
17663
|
registerColumn(x, type) {
|
|
17664
|
+
this.updateColumnTypeMapping(x, type);
|
|
17655
17665
|
if (this.columnStores[x]) {
|
|
17656
17666
|
return this.columnStores[x];
|
|
17657
17667
|
}
|
|
17658
17668
|
this.columnStores[x] = new SelectionStore();
|
|
17659
|
-
// build cross-linking type to position
|
|
17660
|
-
this.storesByType[type] = x;
|
|
17661
|
-
this.storesXToType[x] = type;
|
|
17662
17669
|
return this.columnStores[x];
|
|
17663
17670
|
}
|
|
17664
17671
|
registerRow(y, type) {
|
|
@@ -17879,6 +17886,31 @@ class SelectionStoreConnector {
|
|
|
17879
17886
|
}
|
|
17880
17887
|
return stores;
|
|
17881
17888
|
}
|
|
17889
|
+
/**
|
|
17890
|
+
* Keep column viewport positions and types in sync across pin/unpin rerenders.
|
|
17891
|
+
* Regression case: when a selected rgCol cell was pinned left, colPinStart
|
|
17892
|
+
* could take over x=0 and render the stale rgCol focus store in the pinned area.
|
|
17893
|
+
*/
|
|
17894
|
+
updateColumnTypeMapping(x, type) {
|
|
17895
|
+
const previousType = this.storesXToType[x];
|
|
17896
|
+
const previousX = this.storesByType[type];
|
|
17897
|
+
let shouldClearFocus = false;
|
|
17898
|
+
this.storesByType[type] = x;
|
|
17899
|
+
this.storesXToType[x] = type;
|
|
17900
|
+
if (previousType && previousType !== type) {
|
|
17901
|
+
shouldClearFocus = true;
|
|
17902
|
+
if (this.storesByType[previousType] === x) {
|
|
17903
|
+
delete this.storesByType[previousType];
|
|
17904
|
+
}
|
|
17905
|
+
}
|
|
17906
|
+
if (typeof previousX === 'number' && previousX !== x && this.storesXToType[previousX] === type) {
|
|
17907
|
+
delete this.storesXToType[previousX];
|
|
17908
|
+
shouldClearFocus = true;
|
|
17909
|
+
}
|
|
17910
|
+
if (shouldClearFocus) {
|
|
17911
|
+
this.clearAll();
|
|
17912
|
+
}
|
|
17913
|
+
}
|
|
17882
17914
|
}
|
|
17883
17915
|
|
|
17884
17916
|
/**
|
|
@@ -19475,6 +19507,7 @@ class RevoGridComponent {
|
|
|
19475
19507
|
if (!this.dimensionProvider || !this.columnProvider) {
|
|
19476
19508
|
return;
|
|
19477
19509
|
}
|
|
19510
|
+
const focusToRestore = init ? undefined : this.getColumnFocusRestore();
|
|
19478
19511
|
const beforeGatherEvent = this.beforecolumnsgather.emit({
|
|
19479
19512
|
columns: [...newVal],
|
|
19480
19513
|
});
|
|
@@ -19492,6 +19525,9 @@ class RevoGridComponent {
|
|
|
19492
19525
|
return;
|
|
19493
19526
|
}
|
|
19494
19527
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
19528
|
+
if (focusToRestore) {
|
|
19529
|
+
this.pendingColumnFocusRestore = focusToRestore;
|
|
19530
|
+
}
|
|
19495
19531
|
const order = {};
|
|
19496
19532
|
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
19497
19533
|
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
@@ -19501,6 +19537,64 @@ class RevoGridComponent {
|
|
|
19501
19537
|
order,
|
|
19502
19538
|
});
|
|
19503
19539
|
}
|
|
19540
|
+
/**
|
|
19541
|
+
* Capture logical focus before columns are repartitioned by pin state.
|
|
19542
|
+
* Regression case: selecting a regular cell, then pinning that column left,
|
|
19543
|
+
* used to let the new pinned viewport reuse the old rgCol selection store.
|
|
19544
|
+
*/
|
|
19545
|
+
getColumnFocusRestore() {
|
|
19546
|
+
var _a, _b, _c, _d;
|
|
19547
|
+
const focused = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getFocused();
|
|
19548
|
+
const prevStoreX = (_c = (_b = this.selectionStoreConnector) === null || _b === void 0 ? void 0 : _b.focusedStore) === null || _c === void 0 ? void 0 : _c.position.x;
|
|
19549
|
+
const prop = (_d = focused === null || focused === void 0 ? void 0 : focused.column) === null || _d === void 0 ? void 0 : _d.prop;
|
|
19550
|
+
if (!focused || prop === undefined || prevStoreX === undefined) {
|
|
19551
|
+
return;
|
|
19552
|
+
}
|
|
19553
|
+
return {
|
|
19554
|
+
prop,
|
|
19555
|
+
colType: focused.colType,
|
|
19556
|
+
colIndex: focused.cell.x,
|
|
19557
|
+
prevStoreX,
|
|
19558
|
+
rowType: focused.rowType,
|
|
19559
|
+
rowIndex: focused.cell.y,
|
|
19560
|
+
};
|
|
19561
|
+
}
|
|
19562
|
+
/**
|
|
19563
|
+
* Reapply focus by column prop after render, once pinning has moved the
|
|
19564
|
+
* column to its new viewport and virtual index.
|
|
19565
|
+
*/
|
|
19566
|
+
restoreColumnFocusAfterRender() {
|
|
19567
|
+
var _a, _b, _c, _d;
|
|
19568
|
+
const pending = this.pendingColumnFocusRestore;
|
|
19569
|
+
if (!pending) {
|
|
19570
|
+
return;
|
|
19571
|
+
}
|
|
19572
|
+
this.pendingColumnFocusRestore = undefined;
|
|
19573
|
+
if (!this.viewport || !this.columnProvider) {
|
|
19574
|
+
return;
|
|
19575
|
+
}
|
|
19576
|
+
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);
|
|
19577
|
+
if (!column) {
|
|
19578
|
+
return;
|
|
19579
|
+
}
|
|
19580
|
+
const colType = column.pin || 'rgCol';
|
|
19581
|
+
const columnIndex = this.columnProvider.getColumnIndexByProp(pending.prop, colType);
|
|
19582
|
+
if (columnIndex < 0) {
|
|
19583
|
+
return;
|
|
19584
|
+
}
|
|
19585
|
+
// Header-only column refreshes should not collapse an existing range.
|
|
19586
|
+
// Replay focus only when pin/unpin or repartitioning moved the logical column.
|
|
19587
|
+
if (colType === pending.colType &&
|
|
19588
|
+
columnIndex === pending.colIndex &&
|
|
19589
|
+
pending.prevStoreX === ((_d = (_c = this.selectionStoreConnector) === null || _c === void 0 ? void 0 : _c.focusedStore) === null || _d === void 0 ? void 0 : _d.position.x)) {
|
|
19590
|
+
return;
|
|
19591
|
+
}
|
|
19592
|
+
const cell = {
|
|
19593
|
+
x: columnIndex,
|
|
19594
|
+
y: pending.rowIndex,
|
|
19595
|
+
};
|
|
19596
|
+
this.viewport.setFocus(colType, pending.rowType, cell, cell);
|
|
19597
|
+
}
|
|
19504
19598
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
19505
19599
|
if (newVal === prevVal) {
|
|
19506
19600
|
return;
|
|
@@ -19813,6 +19907,7 @@ class RevoGridComponent {
|
|
|
19813
19907
|
return Promise.all(this.jobsBeforeRender);
|
|
19814
19908
|
}
|
|
19815
19909
|
componentDidRender() {
|
|
19910
|
+
this.restoreColumnFocusAfterRender();
|
|
19816
19911
|
this.aftergridrender.emit();
|
|
19817
19912
|
}
|
|
19818
19913
|
render() {
|
|
@@ -20834,22 +20929,13 @@ class RevogrHeaderComponent {
|
|
|
20834
20929
|
];
|
|
20835
20930
|
}
|
|
20836
20931
|
renderGroupColumn(group, level, visibleGroupRange) {
|
|
20837
|
-
|
|
20838
|
-
const
|
|
20839
|
-
if (groupStartIndex < 0) {
|
|
20840
|
-
return;
|
|
20841
|
-
}
|
|
20842
|
-
const groupEndIndex = groupStartIndex + group.indexes.length - 1;
|
|
20843
|
-
if (!visibleGroupRange ||
|
|
20844
|
-
!isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleGroupRange)) {
|
|
20845
|
-
return;
|
|
20846
|
-
}
|
|
20847
|
-
const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
|
|
20848
|
-
const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
|
|
20932
|
+
const groupRange = this.getGroupIndexRange(group);
|
|
20933
|
+
const groupBounds = this.getGroupBounds(groupRange);
|
|
20849
20934
|
const props = {
|
|
20935
|
+
level,
|
|
20850
20936
|
providers: this.providers,
|
|
20851
|
-
start:
|
|
20852
|
-
end:
|
|
20937
|
+
start: groupBounds.start,
|
|
20938
|
+
end: groupBounds.end,
|
|
20853
20939
|
group,
|
|
20854
20940
|
renderOffset: this.viewportCol.get('renderOffset') || 0,
|
|
20855
20941
|
active: this.resizeHandler,
|
|
@@ -20857,15 +20943,57 @@ class RevogrHeaderComponent {
|
|
|
20857
20943
|
additionalData: this.additionalData,
|
|
20858
20944
|
onResize: e => {
|
|
20859
20945
|
var _a;
|
|
20860
|
-
return
|
|
20946
|
+
return groupRange
|
|
20947
|
+
? this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupRange.startIndex, groupRange.endIndex)
|
|
20948
|
+
: undefined;
|
|
20861
20949
|
},
|
|
20862
20950
|
};
|
|
20863
20951
|
const event = this.beforeGroupHeaderRender.emit(props);
|
|
20864
20952
|
if (event.defaultPrevented) {
|
|
20865
20953
|
return;
|
|
20866
20954
|
}
|
|
20955
|
+
const renderRange = this.getGroupIndexRange(event.detail.group);
|
|
20956
|
+
if (!renderRange ||
|
|
20957
|
+
!visibleGroupRange ||
|
|
20958
|
+
!isGroupInVisibleRange(renderRange.startIndex, renderRange.endIndex, visibleGroupRange)) {
|
|
20959
|
+
return;
|
|
20960
|
+
}
|
|
20961
|
+
if (event.detail.onResize === props.onResize) {
|
|
20962
|
+
event.detail.onResize = e => {
|
|
20963
|
+
var _a;
|
|
20964
|
+
return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, renderRange.startIndex, renderRange.endIndex);
|
|
20965
|
+
};
|
|
20966
|
+
}
|
|
20967
|
+
const renderBounds = this.getGroupBounds(renderRange);
|
|
20968
|
+
if (event.detail.start === props.start) {
|
|
20969
|
+
event.detail.start = renderBounds.start;
|
|
20970
|
+
}
|
|
20971
|
+
if (event.detail.end === props.end) {
|
|
20972
|
+
event.detail.end = renderBounds.end;
|
|
20973
|
+
}
|
|
20867
20974
|
return hAsync(HeaderGroupRenderer, Object.assign({ key: this.getGroupHeaderCellKey(event.detail.group, level) }, event.detail));
|
|
20868
20975
|
}
|
|
20976
|
+
getGroupIndexRange(group) {
|
|
20977
|
+
var _a;
|
|
20978
|
+
const startIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
|
|
20979
|
+
if (startIndex < 0) {
|
|
20980
|
+
return;
|
|
20981
|
+
}
|
|
20982
|
+
const endIndex = group.indexes[group.indexes.length - 1];
|
|
20983
|
+
return {
|
|
20984
|
+
startIndex,
|
|
20985
|
+
endIndex,
|
|
20986
|
+
};
|
|
20987
|
+
}
|
|
20988
|
+
getGroupBounds(range) {
|
|
20989
|
+
if (!range) {
|
|
20990
|
+
return { start: 0, end: 0 };
|
|
20991
|
+
}
|
|
20992
|
+
return {
|
|
20993
|
+
start: getItemByIndex(this.dimensionCol.state, range.startIndex).start,
|
|
20994
|
+
end: getItemByIndex(this.dimensionCol.state, range.endIndex).end,
|
|
20995
|
+
};
|
|
20996
|
+
}
|
|
20869
20997
|
getVisibleGroupRange() {
|
|
20870
20998
|
const visibleColumns = this.viewportCol.get('items');
|
|
20871
20999
|
if (!visibleColumns.length) {
|
|
@@ -21689,8 +21817,10 @@ class RevogrViewportScroll {
|
|
|
21689
21817
|
render() {
|
|
21690
21818
|
var _a, _b, _c, _d;
|
|
21691
21819
|
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
21692
|
-
const physicalContentWidth =
|
|
21693
|
-
|
|
21820
|
+
const physicalContentWidth = this.colType === 'colPinStart' || this.colType === 'colPinEnd'
|
|
21821
|
+
? this.contentWidth
|
|
21822
|
+
: getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
21823
|
+
return (hAsync(Host, { key: '9b23f5c3c18924a25ecd3e1ee0909ebd03b25048', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: '144f5c79d0a99e6423c1ca448917aedf514f0ae3', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, hAsync("div", { key: '10db0971f2db6acf8510cf21d736c82f0d0e5632', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '77e0cd002ccda4a9e420de50648b711cde412a34', name: HEADER_SLOT })), hAsync("div", { key: 'a78167dc52a24005a35dd94c5a9a43eb7dd289dd', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'c277d9d1ffc54452b584eb55b1a29d2a10672fb6', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, hAsync("slot", { key: '01fb5630a3d40e231a3aead9ad1c07aa06e69004', name: CONTENT_SLOT }))), hAsync("div", { key: 'ff7389e77b500b97ea1fc38228da9fc3d6514e30', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: '3aa725e0a8f38ef5d4bc4dce53037ff55a6c25b3', name: FOOTER_SLOT })))));
|
|
21694
21824
|
}
|
|
21695
21825
|
/**
|
|
21696
21826
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import{m as t,n,o as e,q as r,l as o,r as s,a as i,b as c}from"./data.store.js";import"@stencil/core/internal/client";import"./platform.js";import{G as u,b as a,C as l}from"./consts.js";function
|
|
4
|
+
import{m as t,n,o as e,q as r,l as o,r as s,a as i,b as c}from"./data.store.js";import"@stencil/core/internal/client";import"./platform.js";import{G as u,b as a,C as l}from"./consts.js";function f(n){var e=t(n),r=e%1;return e==e?r?e-r:e:0}function d(t,n,e,r){var o=-1,s=null==t?0:t.length;for(r&&s&&(e=t[++o]);++o<s;)e=n(e,t[o],o,t);return e}var p,v=(p=function(t,e){return t&&function(t,n,e){for(var r=-1,o=Object(t),s=e(t),i=s.length;i--;){var c=s[++r];if(!1===n(o[c],c,o))break}return t}(t,e,n)},function(t,n){if(null==t)return t;if(!e(t))return p(t,n);for(var r=t.length,o=-1,s=Object(t);++o<r&&!1!==n(s[o],o,s););return t});function h(t,n,e,r,o){return o(t,(function(t,o,s){e=r?(r=!1,t):n(e,t,o,s)})),e}function x(t,n,e){var s=o(t)?d:h,i=arguments.length<3;return s(t,r(n),e,i,v)}function m(t){return null==t?"":t}function b(t={},n){if(n)return n.cellParser?n.cellParser(t,n):t[n.prop]}function g(t,n){return m(b(t,n))}function j(t){return t.pin?t.pin:"rgCol"}function O(t){const n={};for(const[e,r]of t.entries())r.size&&(n[e]=r.size);return n}function y(t){return!!t.children}function I(t,n=0,e,r){return x(t,((t,o)=>{var s;if(y(o))return w(t,o,I(o.children,n+1,e,t),null==r?void 0:r.columns,n);const i=Object.assign(Object.assign({},o.columnType&&(null==e?void 0:e[o.columnType])),o);return i.pin?t.columns[i.pin].push(i):t.columns.rgCol.push(i),i.order&&(t.sort[i.prop]=i),t.columnByProp[i.prop]||(t.columnByProp[i.prop]=[]),t.columnByProp[i.prop].push(i),null===(s=i.beforeSetup)||void 0===s||s.call(i,i),t}),{columns:{rgCol:[],colPinStart:[],colPinEnd:[]},columnByProp:{},columnGrouping:{rgCol:[],colPinStart:[],colPinEnd:[]},sort:{},maxLevel:n})}function w(t,n,e,r,s=0){const i=Object.assign(Object.assign({},n),{level:s,indexes:[]});C.forEach((n=>{const s=t.columns[n],c=e.columns[n];if(o(s)&&o(c)){const e=c.length;if(e){const o=[...(null==r?void 0:r[n])||[],...s].length;s.push(...c),t.columnGrouping[n].push(Object.assign(Object.assign({},i),{indexes:Array(e).fill(o).map(((t,n)=>t+n))}))}}}));for(let n in e.columnGrouping){const o=n,s=e.columnGrouping[o],i=((null==r?void 0:r[o])||[]).length,c=i>0?s.map((t=>Object.assign(Object.assign({},t),{indexes:t.indexes.map((t=>t+i))}))):s;t.columnGrouping[o].push(...c)}return t.maxLevel=Math.max(t.maxLevel,e.maxLevel),t.sort=Object.assign(Object.assign({},t.sort),e.sort),t.columnByProp=Object.assign(Object.assign({},t.columnByProp),e.columnByProp),t}function P(t,n){for(const e of t)if(y(e)){const t=P(e.children,n);if(t)return t}else if(e.prop===n)return e}function E(t,n){return P(t,n)}function M(t,n){const e={};let r=["x","y"];for(let n of r)if(t[n]<0)return e[n]=t[n],e;for(let o of r)if(t[o]>=n[o])return e[o]=t[o]-n[o],e;return null}function A(t,n){const e=Object.assign({},t),r=["x","y"];for(const o of r)t[o]<0?e[o]=0:t[o]>=n[o]&&(e[o]=n[o]-1);return e}function R(t,n){return t&&n?{x:Math.min(t.x,n.x),y:Math.min(t.y,n.y),x1:Math.max(t.x,n.x),y1:Math.max(t.y,n.y)}:null}function S(t){return t.x===t.x1&&t.y===t.y1}const $=["rowPinStart","rgRow","rowPinEnd"],C=["colPinStart","rgCol","colPinEnd"];function N(t){return $.indexOf(t)>-1}const D=`${u}-depth`,G=`${u}-name`,T=`${u}-id`,k=`${u}-value`,V=`${u}-column`,J=`${u}-expanded`,q=`${u}-prop`,B=`${u}-original-index`,L="group-expand",z="groupexpandclick",F="rgRow";function H(t,n){return t[n]||null}function K(t){return null!=t}function Q(t,n,e=!1){let r=0;const o={source:[],prevExpanded:{},oldNewIndexes:{}};return n.forEach((n=>{const s=t[n];if(e)if(Z(s))W(s)&&(o.prevExpanded[s[k]]=!0);else{if(!K(s))return;o.source.push(s),o.oldNewIndexes[n]=r,r++}else o.source.push(s)})),o}function W(t={}){return t[J]}function U({groupedValues:t,parentIds:n,isExpanded:e,itemIndex:r,expandedAll:o,prevExpanded:s,columnProps:i}){const c=n.length,u=[];let a={},l={};return t.forEach(((t,f)=>{const d=[...n,f],p=d.join(","),v=e&&(!!o||!!s[p]);if(u.push({[G]:f,[D]:c,[T]:JSON.stringify(d),[k]:p,[J]:v,[q]:i[c],[i[c]]:f}),r+=1,!e&&c&&(a[r]=!0),Array.isArray(t))t.forEach((t=>{r+=1,v||(a[r]=!0),l[t[B]]=r})),u.push(...t);else{const n=U({groupedValues:t,parentIds:d,isExpanded:v,itemIndex:r,expandedAll:o,prevExpanded:s,columnProps:i});u.push(...n.source),a=Object.assign(Object.assign({},n.trimmed),a),l=Object.assign(Object.assign({},n.oldNewIndexMap),l),r=n.itemIndex}})),{source:u,oldNewIndexMap:l,trimmed:a,itemIndex:r}}function X(t,n,{prevExpanded:e={},expandedAll:r=!1,getGroupValue:o=H}){const s=new Map;t.forEach(((t,e)=>{if(!K(t))return;const r=n.map((n=>o(t,n))),i=r.pop();let c=s;r.forEach((t=>{c.has(t)||c.set(t,new Map),c=c.get(t)})),c.has(i)||c.set(i,[]),c.get(i).push(Object.assign(Object.assign({},t),{[B]:e}))}));const i=n.length,{source:c,trimmed:u,oldNewIndexMap:a}=U({groupedValues:s,parentIds:[],isExpanded:!0,itemIndex:-1,expandedAll:r,prevExpanded:e,columnProps:n});return{sourceWithGroups:c,depth:i,trimmed:u,oldNewIndexMap:a}}function Y(t){return null==t?void 0:t[G]}function Z(t){return void 0!==(null==t?void 0:t[G])}function _(t){return void 0!==(null==t?void 0:t[V])}function tt(t,n){const e=t.length;let r=0;for(;r<e;r++)if(t[r]!==n[r])return r;return r}function nt(t){const n=JSON.parse(t);return Array.isArray(n)?n:null}function et(t,n,e){const r=nt(e[T]);if(!r)return!1;const o=tt(t,r);return n[D]<o}function rt(t,n={}){const e=null==t?void 0:t.editor;if(e)return"string"==typeof e?n[e]:e}class ot{get columns(){return i(this.source)}constructor(t,n){this.dataStore=t,this.source=n,this.unsubscribe=[],this.hasGrouping=!1,this.unsubscribe.push(n.onChange("source",(t=>this.checkGrouping(t)))),this.checkGrouping(n.get("source")),this.type=n.get("type")}checkGrouping(t){for(let n of t){if(_(n))return void(this.hasGrouping=!0);this.hasGrouping=!1}}isReadOnly(t,n){var e;const r=null===(e=this.columns[n])||void 0===e?void 0:e.readonly;return"function"==typeof r?r(this.rowDataModel(t,n)):!!r}mergeProperties(t,n,e,r){var o,s;const i=Object.assign({},e);i.class=Object.assign(Object.assign({},"string"==typeof i.class?{[i.class]:!0}:i.class),{[l]:!0,[a]:this.isReadOnly(t,n)});const c=null===(s=null===(o=r.column)||void 0===o?void 0:o.cellProperties)||void 0===s?void 0:s.call(o,r);return c?ct(i,c):i}getRowClass(t,n){return(c(this.dataStore,t)||{})[n]||""}getSaveData(t,n,e){const r=this.rowDataModel(t,n);return void 0===e&&(e=m(r.value)),Object.assign(Object.assign({},r),{val:e})}rowDataModel(t,n){const e=this.columns[n],r=null==e?void 0:e.prop,o=c(this.dataStore,t)||{},s=this.dataStore.get("type");return{prop:r,model:o,data:this.dataStore.get("source"),column:e,rowIndex:t,colIndex:n,colType:this.type,type:s,value:b(o,e)}}getRangeData(t,n){var e;const r={},o=t.oldRange.x1-t.oldRange.x+1,s=t.oldRange.y1-t.oldRange.y+1,i={};for(let u=t.newRange.y,a=0;u<t.newRange.y1+1;u++,a++){const l=t.oldRange.y+a%s,f=c(this.dataStore,l)||{};for(let s=t.newRange.x,c=0;s<t.newRange.x1+1;s++,c++){if(u>=t.oldRange.y&&u<=t.oldRange.y1&&s>=t.oldRange.x&&s<=t.oldRange.x1)continue;if(!this.columns[s])continue;const a=null===(e=this.columns[s])||void 0===e?void 0:e.prop,d=t.oldRange.x+c%o,p=n[d].prop;this.isReadOnly(u,s)||(r[u]||(r[u]={}),r[u][a]=f[p],i[u]||(i[u]={}),i[u][a]={colIndex:d,colProp:p,rowIndex:l})}}return{changed:r,mapping:i}}getTransformedDataToApply(t,n){const e={},r=n.length,o=this.columns.length,s=this.dataStore.get("items").length;let i=t.y,c=0;for(let u=0;i<s&&u<r;i++,u++){const s=n[u%r],a=(null==s?void 0:s.length)||0;let l=t.x;for(let t=0;l<o&&t<a;l++,t++){const n=this.columns[l].prop,r=t%o;this.isReadOnly(i,l)||(e[i]||(e[i]={}),e[i][n]=s[r])}c=Math.max(c,l-1)}return{changed:e,range:R(t,{y:i-1,x:c})}}getRangeStaticData(t,n){const e={};for(let r=t.y,o=0;r<t.y1+1;r++,o++)for(let o=t.x,s=0;o<t.x1+1;o++,s++){if(!this.columns[o])continue;const t=this.columns[o].prop;this.isReadOnly(r,o)||(e[r]||(e[r]={}),e[r][t]=n)}return e}getRangeTransformedToProps(t,n){var e;const r=[],o=this.dataStore.get("type");for(let s=t.y,i=0;s<t.y1+1;s++,i++)for(let i=t.x,u=0;i<t.x1+1;i++,u++){const t=null===(e=this.columns[i])||void 0===e?void 0:e.prop;r.push({prop:t,rowIndex:s,colIndex:i,model:c(n,s),type:o,colType:this.type})}return r}copyRangeArray(t,n){const e=(i=[...this.columns],u=t.x,a=t.x1+1,l=null==i?0:i.length,l?(a&&"number"!=typeof a&&s(i,u,a)?(u=0,a=l):(u=null==u?0:f(u),a=void 0===a?l:f(a)),function(t,n,e){var r=-1,o=t.length;n<0&&(n=-n>o?0:o+n),(e=e>o?o:e)<0&&(e+=o),o=n>e?0:e-n>>>0,n>>>=0;for(var s=Array(o);++r<o;)s[r]=t[r+n];return s}(i,u,a)):[]).map((t=>t.prop)),r=[],o={};var i,u,a,l;for(let s=t.y;s<=t.y1;s++){const t=[];o[s]={};for(let r of e){const e=c(n,s);if(!e)continue;const i=e[r];t.push(i),o[s][r]=i}r.push(t)}return{data:r,mapping:o}}destroy(){this.unsubscribe.forEach((t=>t()))}}function st(t,n){return"function"==typeof t?t(n):!!t}function it(t={},n={}){return"string"==typeof t&&(t={[t]:!0}),"string"==typeof n&&(n={[n]:!0}),Object.assign(Object.assign({},t),n)}function ct(t,n){n.className&&(n.class=it(n.class,n.className),delete n.className);let e=Object.assign(Object.assign({},n),t);return n.class&&(e.class=it(e.class,n.class)),n.style&&(e.style=Object.assign(Object.assign({},n.style),e.style)),e}export{b as A,g as B,j as C,O as D,y as E,I as F,D as G,w as H,E as I,x as J,v as K,f as L,ot as M,rt as N,st as O,G as P,ct as Q,A as a,S as b,C as c,T as d,k as e,V as f,R as g,J as h,N as i,q as j,B as k,L as l,z as m,M as n,F as o,Q as p,W as q,$ as r,X as s,Y as t,Z as u,_ as v,tt as w,nt as x,et as y,m as z}
|