@taocompany/magic-grid 0.6.2 → 0.6.4
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 +270 -30
- package/dist/cellEditorCache-DmICiO9q.js.map +1 -1
- package/dist/cellEditorCache-ymzG_TG0.cjs.map +1 -1
- package/dist/components/MagicGrid/MagicGrid.vue.d.ts +1 -1
- package/dist/core/api/gridApi.d.ts +20 -2
- package/dist/core/api/gridApi.d.ts.map +1 -1
- package/dist/core/grid/grid.d.ts +6 -2
- package/dist/core/grid/grid.d.ts.map +1 -1
- package/dist/core/grid/gridSelection.d.ts +10 -6
- package/dist/core/grid/gridSelection.d.ts.map +1 -1
- package/dist/core/selection/selectionService.d.ts +10 -0
- package/dist/core/selection/selectionService.d.ts.map +1 -1
- package/dist/core/types/events.d.ts +14 -14
- package/dist/core/types/events.d.ts.map +1 -1
- package/dist/core/types/indexColumn.d.ts +14 -1
- package/dist/core/types/indexColumn.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 +37 -10
- package/dist/index.es.js.map +1 -1
- package/dist/types/core.d.ts +60 -17
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/magic-grid.d.ts +1 -1
- package/dist/types/magic-grid.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -355,7 +355,10 @@ function Ie(e) {
|
|
|
355
355
|
clearCellValidation: (t) => e.clearCellValidation(t),
|
|
356
356
|
toggleRowSelection: (t, n, r) => e.toggleRowSelection(t, n, r),
|
|
357
357
|
toggleAllSelection: (t) => e.toggleAllSelection(t),
|
|
358
|
-
|
|
358
|
+
clearRowSelection: (t) => e.clearRowSelection(t),
|
|
359
|
+
getSelectedRowIds: () => e.getSelectedRowIds(),
|
|
360
|
+
getIndexFocusedRowIds: () => e.getIndexFocusedRowIds(),
|
|
361
|
+
setIndexFocus: (t, n) => e.setIndexFocus(t, n),
|
|
359
362
|
destroy: () => e.destroy(),
|
|
360
363
|
on: (t, n) => e.on(t, n)
|
|
361
364
|
};
|
|
@@ -20046,22 +20049,34 @@ var GC = class {
|
|
|
20046
20049
|
});
|
|
20047
20050
|
WC(t, n), this.deps.selectionService.replaceWithRowIds([...n], r.length > 0 ? r[r.length - 1].rowIndex : -1);
|
|
20048
20051
|
}
|
|
20049
|
-
setIndexFocus(e) {
|
|
20052
|
+
setIndexFocus(e, t = {}) {
|
|
20050
20053
|
if (!this.deps.indexFocusService) return;
|
|
20051
|
-
let
|
|
20054
|
+
let n = Cu(e).map((e) => {
|
|
20052
20055
|
let t = this.deps.rowModel.getRowIndexById(e);
|
|
20053
20056
|
return t >= 0 ? {
|
|
20054
20057
|
id: e,
|
|
20055
20058
|
rowIndex: t
|
|
20056
20059
|
} : null;
|
|
20057
|
-
}).filter((e) => e != null),
|
|
20058
|
-
|
|
20060
|
+
}).filter((e) => e != null), r = !1;
|
|
20061
|
+
if (n.length === 0 ? (r = this.deps.indexFocusService.getFocusedRowIds().length > 0, r && this.deps.indexFocusService.clear()) : r = this.deps.indexFocusService.isMultiple() ? this.deps.indexFocusService.replaceWithRowIds(n.map((e) => e.id), n[0].rowIndex) : this.deps.indexFocusService.replaceWithRowIds([n[0].id], n[0].rowIndex), !r) return;
|
|
20062
|
+
let i = (t.mode ?? "default") === "manual" ? { syncToSelectionColumn: t.syncToSelectionColumn ?? !1 } : {};
|
|
20063
|
+
this.applyIndexFocusVisuals(i), this.deps.eventBus.emit("indexFocusChanged", { focusedRowIds: this.deps.indexFocusService.getFocusedRowIds() });
|
|
20059
20064
|
}
|
|
20060
20065
|
toggleAllSelection(e) {
|
|
20061
20066
|
if (!this.deps.selectionService) return;
|
|
20062
20067
|
let t = this.deps.rowModel.getRowCount(), n = (e) => this.getSelectableRowIdAt(e), r = !1;
|
|
20063
20068
|
r = e === void 0 ? this.deps.selectionService.toggleSelectAllVisibleRows(t, n) : e ? this.deps.selectionService.selectAllVisibleRows(t, n) : this.deps.selectionService.deselectAllVisibleRows(t, n), r && (this.syncTreeSelectionCascade(), this.applySelectionVisuals(), this.deps.eventBus.emit("selectionChanged", { selectedRowIds: this.deps.selectionService.getSelectedRowIds() }));
|
|
20064
20069
|
}
|
|
20070
|
+
clearRowSelection(e = {}) {
|
|
20071
|
+
if (!this.deps.selectionService) return;
|
|
20072
|
+
let t = e.scope ?? "all", n = !1;
|
|
20073
|
+
if (t === "all") n = this.deps.selectionService.getSelectedRowIds().length > 0, n && this.deps.selectionService.clear();
|
|
20074
|
+
else {
|
|
20075
|
+
let e = new Set(this.deps.rowModel.rowsToDisplay.map((e) => e.id)), t = this.deps.selectionService.getSelectedRowIds().filter((t) => e.has(t));
|
|
20076
|
+
t.length > 0 && (n = this.deps.selectionService.removeRowIds(t));
|
|
20077
|
+
}
|
|
20078
|
+
n && (this.syncTreeSelectionCascade(), this.applySelectionVisuals(), this.deps.eventBus.emit("selectionChanged", { selectedRowIds: this.deps.selectionService.getSelectedRowIds() }));
|
|
20079
|
+
}
|
|
20065
20080
|
isRowNodeSelectable(e) {
|
|
20066
20081
|
return hn(e) || ir(e) ? !1 : Ki(this.selectableFn, e, this.deps.rowKey);
|
|
20067
20082
|
}
|
|
@@ -20085,7 +20100,7 @@ var GC = class {
|
|
|
20085
20100
|
applyIndexFocusVisuals(e = {}) {
|
|
20086
20101
|
if (!this.deps.indexFocusService) return;
|
|
20087
20102
|
let t = new Set(this.deps.indexFocusService.getFocusedRowIds());
|
|
20088
|
-
this.deps.rowRenderer.refreshIndexFocus(t), e
|
|
20103
|
+
this.deps.rowRenderer.refreshIndexFocus(t), this.shouldSyncIndexFocusToSelection(e) && this.syncIndexFocusToSelection();
|
|
20089
20104
|
}
|
|
20090
20105
|
onRowsRemoved(e) {
|
|
20091
20106
|
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() }));
|
|
@@ -20101,8 +20116,11 @@ var GC = class {
|
|
|
20101
20116
|
}
|
|
20102
20117
|
return n;
|
|
20103
20118
|
}
|
|
20104
|
-
|
|
20105
|
-
|
|
20119
|
+
shouldSyncIndexFocusToSelection(e) {
|
|
20120
|
+
return e.syncToSelectionColumn === !1 ? !1 : e.syncToSelectionColumn === !0 || this.deps.indexColumnOptions.indexColumn.syncToSelectionColumn;
|
|
20121
|
+
}
|
|
20122
|
+
syncIndexFocusToSelection() {
|
|
20123
|
+
if (!this.deps.indexFocusService || !this.deps.selectionService) return;
|
|
20106
20124
|
let e = this.deps.indexColumnOptions.indexColumn.focusMode, t = this.deps.selectionColumnOptions.mode;
|
|
20107
20125
|
if (!Ji(e, t)) return;
|
|
20108
20126
|
let n = this.deps.indexFocusService.getFocusedRowIds();
|
|
@@ -21410,12 +21428,21 @@ var mw = class {
|
|
|
21410
21428
|
toggleRowSelection(e, t, n) {
|
|
21411
21429
|
this.selectionOps.toggleRowSelection(e, t, n);
|
|
21412
21430
|
}
|
|
21413
|
-
setIndexFocus(e) {
|
|
21414
|
-
this.selectionOps.setIndexFocus(e), this.cellSelectionOptions.enabled && this.indexColumnOptions.showIndexColumn && this.interaction.syncCellRangeFromIndexFocus();
|
|
21431
|
+
setIndexFocus(e, t) {
|
|
21432
|
+
this.selectionOps.setIndexFocus(e, t), this.cellSelectionOptions.enabled && this.indexColumnOptions.showIndexColumn && this.interaction.syncCellRangeFromIndexFocus();
|
|
21415
21433
|
}
|
|
21416
21434
|
toggleAllSelection(e) {
|
|
21417
21435
|
this.selectionOps.toggleAllSelection(e);
|
|
21418
21436
|
}
|
|
21437
|
+
clearRowSelection(e) {
|
|
21438
|
+
this.selectionOps.clearRowSelection(e);
|
|
21439
|
+
}
|
|
21440
|
+
getSelectedRowIds() {
|
|
21441
|
+
return this.selectionService ? Ni(this.selectionService.getSelectedRowIds(), this.businessRowIdCtx) : [];
|
|
21442
|
+
}
|
|
21443
|
+
getIndexFocusedRowIds() {
|
|
21444
|
+
return this.indexFocusService ? Ni(this.indexFocusService.getFocusedRowIds(), this.businessRowIdCtx) : [];
|
|
21445
|
+
}
|
|
21419
21446
|
isRowNodeSelectable(e) {
|
|
21420
21447
|
return this.selectionOps.isRowNodeSelectable(e);
|
|
21421
21448
|
}
|