@taocompany/magic-grid 0.12.2 → 0.12.3
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/README.md +1 -1
- package/dist/core/api/gridApi.d.ts +5 -2
- package/dist/core/api/gridApi.d.ts.map +1 -1
- package/dist/core/event/projectGridEvent.d.ts.map +1 -1
- package/dist/core/grid/grid.d.ts.map +1 -1
- package/dist/core/grid/gridSelection.d.ts +11 -0
- package/dist/core/grid/gridSelection.d.ts.map +1 -1
- package/dist/core/types/events.d.ts +8 -0
- package/dist/core/types/events.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +33 -5
- package/dist/index.es.js.map +1 -1
- package/dist/token-catalog.json +2 -2
- package/dist/types/core.d.ts +20 -8
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -7748,7 +7748,8 @@ function v_(e, t, n) {
|
|
|
7748
7748
|
let e = t;
|
|
7749
7749
|
return {
|
|
7750
7750
|
selectedRowIds: g_(e.selectedRowIds, r),
|
|
7751
|
-
selectedRows: me(e.selectedRowIds, n)
|
|
7751
|
+
selectedRows: me(e.selectedRowIds, n),
|
|
7752
|
+
...e.from == null ? {} : { from: e.from }
|
|
7752
7753
|
};
|
|
7753
7754
|
}
|
|
7754
7755
|
case "indexFocusChanged": {
|
|
@@ -23487,11 +23488,27 @@ var GO = class {
|
|
|
23487
23488
|
selectableFn;
|
|
23488
23489
|
reserveSelection;
|
|
23489
23490
|
pendingDefaultSelection = null;
|
|
23491
|
+
presetSelectionEmitQueued = !1;
|
|
23492
|
+
presetSelectionEmitRevision = 0;
|
|
23493
|
+
presetTransientNotifyPending = !1;
|
|
23490
23494
|
constructor(e, t, n, r) {
|
|
23491
23495
|
this.deps = e, this.getDefaultSelectedRowsRuntime = r, this.selectableFn = t, this.reserveSelection = n;
|
|
23492
23496
|
}
|
|
23493
23497
|
clearPendingDefaultSelectedRows() {
|
|
23494
|
-
this.pendingDefaultSelection = null;
|
|
23498
|
+
this.presetSelectionEmitRevision += 1, this.presetTransientNotifyPending = !1, this.pendingDefaultSelection = null;
|
|
23499
|
+
}
|
|
23500
|
+
flushPendingPresetTransientSelectionNotify() {
|
|
23501
|
+
!this.presetTransientNotifyPending || !this.pendingDefaultSelection || (this.presetTransientNotifyPending = !1, this.queuePresetSelectionChangedEmit());
|
|
23502
|
+
}
|
|
23503
|
+
queuePresetSelectionChangedEmit() {
|
|
23504
|
+
if (!this.pendingDefaultSelection || !this.deps.selectionService || this.presetSelectionEmitQueued) return;
|
|
23505
|
+
let e = this.presetSelectionEmitRevision;
|
|
23506
|
+
this.presetSelectionEmitQueued = !0, queueMicrotask(() => {
|
|
23507
|
+
this.presetSelectionEmitQueued = !1, !(e !== this.presetSelectionEmitRevision || !this.pendingDefaultSelection || !this.deps.selectionService) && (this.presetTransientNotifyPending = !1, this.deps.eventBus.emit("selectionChanged", {
|
|
23508
|
+
selectedRowIds: this.deps.selectionService.getSelectedRowIds(),
|
|
23509
|
+
from: "preset"
|
|
23510
|
+
}));
|
|
23511
|
+
});
|
|
23495
23512
|
}
|
|
23496
23513
|
setSelectable(e) {
|
|
23497
23514
|
this.selectableFn = C_(e), this.deps.rowRenderer.setIsRowNodeSelectable((e) => this.isRowNodeSelectable(e)), this.applySelectionVisuals();
|
|
@@ -23522,7 +23539,17 @@ var GO = class {
|
|
|
23522
23539
|
let s = [...o], c = this.deps.selectionService.getSelectedRowIds();
|
|
23523
23540
|
if (!(s.length !== c.length || s.some((e) => !c.includes(e)))) return;
|
|
23524
23541
|
let l = s.length > 0 ? this.deps.rowModel.getRowIndexById(s[0]) : -1;
|
|
23525
|
-
this.deps.selectionService.replaceWithRowIds(s, l), this.syncTreeSelectionCascade(), this.applySelectionVisuals(), this.
|
|
23542
|
+
this.deps.selectionService.replaceWithRowIds(s, l), this.syncTreeSelectionCascade(), this.applySelectionVisuals(), this.shouldDeferPresetSelectionChangedEmit(s) ? this.presetTransientNotifyPending = !0 : (this.presetTransientNotifyPending = !1, this.queuePresetSelectionChangedEmit());
|
|
23543
|
+
}
|
|
23544
|
+
shouldDeferPresetSelectionChangedEmit(e) {
|
|
23545
|
+
if (e.length === 0) return !1;
|
|
23546
|
+
for (let t of e) {
|
|
23547
|
+
let e = this.deps.rowModel.getRowById(t);
|
|
23548
|
+
if (!e) return !1;
|
|
23549
|
+
let n = e.data[this.deps.rowKey];
|
|
23550
|
+
if (n == null || n === "") return !0;
|
|
23551
|
+
}
|
|
23552
|
+
return !1;
|
|
23526
23553
|
}
|
|
23527
23554
|
resolvePresetTargetRowIds(e) {
|
|
23528
23555
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
@@ -23635,7 +23662,8 @@ var GO = class {
|
|
|
23635
23662
|
this.deps.selectionService?.removeRowIds(e) && (this.applySelectionVisuals(), this.deps.eventBus.emit("selectionChanged", { selectedRowIds: this.deps.selectionService.getSelectedRowIds() })), this.deps.indexFocusService?.removeRowIds(e) && (this.applyIndexFocusVisuals({ syncToSelectionColumn: !1 }), this.deps.eventBus.emit("indexFocusChanged", { focusedRowIds: this.deps.indexFocusService.getFocusedRowIds() }));
|
|
23636
23663
|
}
|
|
23637
23664
|
finalizePromoteRowId(e, t) {
|
|
23638
|
-
|
|
23665
|
+
let n = this.pendingDefaultSelection != null, r = !1;
|
|
23666
|
+
this.deps.selectionService?.migrateRowId(e, t) && (r = !0, this.applySelectionVisuals(), n || this.deps.eventBus.emit("selectionChanged", { selectedRowIds: this.deps.selectionService.getSelectedRowIds() })), this.deps.indexFocusService?.migrateRowId(e, t) && (this.applyIndexFocusVisuals({ syncToSelectionColumn: !1 }), this.deps.eventBus.emit("indexFocusChanged", { focusedRowIds: this.deps.indexFocusService.getFocusedRowIds() })), this.reconcilePendingDefaultSelectedRows(), n && r && this.queuePresetSelectionChangedEmit();
|
|
23639
23667
|
}
|
|
23640
23668
|
reconcileSelectionAfterSetData(e, t) {
|
|
23641
23669
|
let n = !this.reserveSelection && t;
|
|
@@ -26768,7 +26796,7 @@ var gA = class {
|
|
|
26768
26796
|
this.selectionOps.clearPendingDefaultSelectedRows();
|
|
26769
26797
|
}
|
|
26770
26798
|
reconcileDefaultSelectedRows() {
|
|
26771
|
-
this.selectionOps.reconcilePendingDefaultSelectedRows();
|
|
26799
|
+
this.selectionOps.reconcilePendingDefaultSelectedRows(), this.selectionOps.flushPendingPresetTransientSelectionNotify();
|
|
26772
26800
|
}
|
|
26773
26801
|
getSelectedRowIds() {
|
|
26774
26802
|
return this.selectionService ? f(this.selectionService.getSelectedRowIds(), this.businessRowIdCtx) : [];
|