@freegridjs/core 1.9.3 → 1.9.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/dist/cdn/freegrid.css +542 -541
- package/dist/cdn/freegrid.esm.js +18 -18
- package/dist/cdn/freegrid.min.js +24 -24
- package/dist/index.d.ts +3 -3
- package/dist/index.js +226 -19
- package/dist/locales/de.d.ts +1 -1
- package/dist/locales/en.d.ts +1 -1
- package/dist/locales/es.d.ts +1 -1
- package/dist/locales/fr.d.ts +1 -1
- package/dist/locales/id.d.ts +1 -1
- package/dist/locales/it.d.ts +1 -1
- package/dist/locales/ja.d.ts +1 -1
- package/dist/locales/ko.d.ts +1 -1
- package/dist/locales/pt-BR.d.ts +1 -1
- package/dist/locales/ru.d.ts +1 -1
- package/dist/locales/th.d.ts +1 -1
- package/dist/locales/vi.d.ts +1 -1
- package/dist/locales/zh-CN.d.ts +1 -1
- package/dist/locales/zh-TW.d.ts +1 -1
- package/dist/styles.css +542 -541
- package/dist/{types-DloQYCt_.d.ts → types-CIOv3MoN.d.ts} +34 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, b as RowTransaction, L as LocalePack } from './types-
|
|
2
|
-
export { A as AdvancedFilter, c as AdvancedFilterCondition, d as Aggregator, e as AssistantAction, f as AssistantColumn, g as AssistantOptions, h as AssistantRequest, i as AssistantResult, C as CellEvent, j as CellParams, k as CellStyle, l as ChartHandle, m as ChartOptions, n as ColumnDef, o as ColumnState, p as ColumnType, q as CombinedFilterModel, r as ConditionalFormat, s as ConditionalFormatType, t as ConditionalOp, u as ContextMenuItem, v as ContextMenuParams, w as CustomEditor, x as DateFilterModel, y as DateOp, z as EditorParams, B as EditorSpec, F as FilterModel, H as FilterOp, I as FilterType, J as GridEvents, K as GridRange, M as InvalidCell, N as JsonExportOptions, O as KeyAction, P as
|
|
1
|
+
import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, b as RowTransaction, L as LocalePack } from './types-CIOv3MoN.js';
|
|
2
|
+
export { A as AdvancedFilter, c as AdvancedFilterCondition, d as Aggregator, e as AssistantAction, f as AssistantColumn, g as AssistantOptions, h as AssistantRequest, i as AssistantResult, C as CellEvent, j as CellParams, k as CellStyle, l as ChartHandle, m as ChartOptions, n as ColumnDef, o as ColumnState, p as ColumnType, q as CombinedFilterModel, r as ConditionalFormat, s as ConditionalFormatType, t as ConditionalOp, u as ContextMenuItem, v as ContextMenuParams, w as CustomEditor, x as DateFilterModel, y as DateOp, z as EditorParams, B as EditorSpec, F as FilterModel, H as FilterOp, I as FilterType, J as GridEvents, K as GridRange, M as InvalidCell, N as JsonExportOptions, O as KeyAction, P as MergeSelectionGroup, Q as Messages, S as NumberFilterModel, T as NumberOp, U as PdfOptions, V as PivotConfig, W as PrintOptions, X as Region, Y as RowDragOptions, Z as RowDropParams, _ as RowDropPosition, $ as SavedGridState, a0 as SavedStatePart, a1 as ScrollPosition, a2 as SelectOption, a3 as ServerParams, a4 as SetFilterModel, a5 as SortDir, a6 as SortItem, a7 as SpanParams, a8 as SummaryCell, a9 as SummaryOptions, aa as SummaryRowDef, ab as TextFilterModel, ac as TextOp, ad as TransactionResult, ae as XlsxCell, af as XlsxSheet, ag as readXlsx, ah as writeXlsx } from './types-CIOv3MoN.js';
|
|
3
3
|
export { default as en } from './locales/en.js';
|
|
4
4
|
|
|
5
5
|
declare function createGrid(host: HTMLElement, options: GridOptions): GridApi;
|
|
6
6
|
|
|
7
7
|
/** FreeGrid version (kept in sync with releases.json by scripts/release.mjs). */
|
|
8
|
-
declare const version = "1.9.
|
|
8
|
+
declare const version = "1.9.4";
|
|
9
9
|
|
|
10
10
|
interface LicenseInfo {
|
|
11
11
|
/** Licensed domains; each also covers every subdomain below it (`*.example.com` means the same as `example.com`). */
|
package/dist/index.js
CHANGED
|
@@ -1882,21 +1882,26 @@ function computeSpans(rows, def) {
|
|
|
1882
1882
|
}
|
|
1883
1883
|
return { start, end };
|
|
1884
1884
|
}
|
|
1885
|
+
function nestedSpans(list, n) {
|
|
1886
|
+
const start = new Int32Array(n);
|
|
1887
|
+
const end = new Int32Array(n);
|
|
1888
|
+
let s = 0;
|
|
1889
|
+
for (let i = 1; i <= n; i++) {
|
|
1890
|
+
if (i < n && !list.some((sp) => sp.start[i] === i)) continue;
|
|
1891
|
+
for (let k = s; k < i; k++) {
|
|
1892
|
+
start[k] = s;
|
|
1893
|
+
end[k] = i - 1;
|
|
1894
|
+
}
|
|
1895
|
+
s = i;
|
|
1896
|
+
}
|
|
1897
|
+
return { start, end };
|
|
1898
|
+
}
|
|
1885
1899
|
function mergeBlocks(rows, defs) {
|
|
1886
1900
|
const n = rows.length;
|
|
1887
1901
|
const block = new Int32Array(n);
|
|
1888
1902
|
if (!n || !defs.length) return block;
|
|
1889
|
-
const
|
|
1890
|
-
let
|
|
1891
|
-
for (let i = 1; i < n; i++) {
|
|
1892
|
-
for (let k = 0; k < starts.length; k++) {
|
|
1893
|
-
if (starts[k][i] === i) {
|
|
1894
|
-
b++;
|
|
1895
|
-
break;
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
block[i] = b;
|
|
1899
|
-
}
|
|
1903
|
+
const { start } = nestedSpans(defs.map((def) => computeSpans(rows, def)), n);
|
|
1904
|
+
for (let i = 1; i < n; i++) block[i] = block[i - 1] + (start[i] === i ? 1 : 0);
|
|
1900
1905
|
return block;
|
|
1901
1906
|
}
|
|
1902
1907
|
|
|
@@ -2464,6 +2469,7 @@ var Renderer = class {
|
|
|
2464
2469
|
const { selected, focus } = store.state;
|
|
2465
2470
|
const allBounds = this.grid.allRangeBounds();
|
|
2466
2471
|
const spans = this.grid.mergeSpans();
|
|
2472
|
+
const blocks = spans.has(SELECT_COL_ID);
|
|
2467
2473
|
const { geo } = this;
|
|
2468
2474
|
const top = Math.max(0, geo.top - this.topOffset);
|
|
2469
2475
|
const range = this.grid.options.autoHeight && !rowModel.server ? { first: 0, last: count - 1 } : this.offsets ? rowRangeByOffsets(this.offsets, top, geo.ch, count, ROW_OVERSCAN) : rowRange(top, geo.ch, this.opts.rowHeight, count, ROW_OVERSCAN);
|
|
@@ -2492,8 +2498,9 @@ var Renderer = class {
|
|
|
2492
2498
|
const hits = allBounds.filter((b) => i >= b.r1 && i <= b.r2);
|
|
2493
2499
|
const inRange = hits.map((b) => `${b.c1}-${b.c2}`).join(",");
|
|
2494
2500
|
const merge2 = this.mergeState(spans, cols, i, range.first);
|
|
2501
|
+
const block = blocks && !node.kind ? this.grid.blockSelection(i) ?? "" : "";
|
|
2495
2502
|
const pos = node.kind === "detail" ? `${geo.left}:${geo.cw}` : "";
|
|
2496
|
-
const base = `${node.id}|${this.version}.${this.rowVersions.get(node.id) ?? 0}|${isSel ? 1 : 0}${node.kind === "group" ? `:${this.grid.selectionVersion}` : ""}|${focusCol}|${inRange}|${merge2}|${pos}`;
|
|
2503
|
+
const base = `${node.id}|${this.version}.${this.rowVersions.get(node.id) ?? 0}|${isSel ? 1 : 0}${node.kind === "group" ? `:${this.grid.selectionVersion}` : ""}${block}|${focusCol}|${inRange}|${merge2}|${pos}`;
|
|
2497
2504
|
const key = `${colKey}|${base}`;
|
|
2498
2505
|
let row = map.get(i);
|
|
2499
2506
|
if (!row) {
|
|
@@ -2690,7 +2697,15 @@ var Renderer = class {
|
|
|
2690
2697
|
cell.className = `${cls} fg-cell-select`;
|
|
2691
2698
|
const box = el("input", "fg-checkbox", { type: "checkbox", tabindex: "-1", "aria-label": locale.selectRow });
|
|
2692
2699
|
box.checked = selected;
|
|
2693
|
-
|
|
2700
|
+
const block = i >= 0 && !node.kind ? this.grid.blockSelection(i) : null;
|
|
2701
|
+
if (block) {
|
|
2702
|
+
box.checked = block === "all";
|
|
2703
|
+
box.indeterminate = block === "some";
|
|
2704
|
+
if (block === "off") {
|
|
2705
|
+
box.disabled = true;
|
|
2706
|
+
cell.classList.add("fg-cell-select-locked");
|
|
2707
|
+
}
|
|
2708
|
+
} else if (i >= 0 && !node.kind && !this.grid.rowSelectable(node.data)) {
|
|
2694
2709
|
box.disabled = true;
|
|
2695
2710
|
cell.classList.add("fg-cell-select-locked");
|
|
2696
2711
|
}
|
|
@@ -7742,7 +7757,7 @@ var PAID_FEATURES = {
|
|
|
7742
7757
|
};
|
|
7743
7758
|
|
|
7744
7759
|
// src/version.ts
|
|
7745
|
-
var version = "1.9.
|
|
7760
|
+
var version = "1.9.4";
|
|
7746
7761
|
|
|
7747
7762
|
// src/license.ts
|
|
7748
7763
|
var PUBLIC_KEY = { kty: "EC", crv: "P-256", x: "sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE", y: "j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8" };
|
|
@@ -8290,6 +8305,8 @@ var RowModel = class {
|
|
|
8290
8305
|
this.full = [];
|
|
8291
8306
|
this.last = {};
|
|
8292
8307
|
this.nodes = [];
|
|
8308
|
+
/** Ids given to the current rows (repeats of a getRowId value made unique). */
|
|
8309
|
+
this.assignedIds = /* @__PURE__ */ new WeakMap();
|
|
8293
8310
|
this.filtered = [];
|
|
8294
8311
|
this.sorted = [];
|
|
8295
8312
|
this.display = [];
|
|
@@ -8308,7 +8325,23 @@ var RowModel = class {
|
|
|
8308
8325
|
const displayChanged = sortChanged || d?.version !== this.last.displayVersion || d?.groupBy !== this.last.display?.groupBy;
|
|
8309
8326
|
if (dataChanged) {
|
|
8310
8327
|
const getId = this.deps.getRowId;
|
|
8311
|
-
|
|
8328
|
+
if (getId) {
|
|
8329
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
8330
|
+
let dup = null;
|
|
8331
|
+
this.assignedIds = /* @__PURE__ */ new WeakMap();
|
|
8332
|
+
this.nodes = input.data.map((data, i) => {
|
|
8333
|
+
const raw = String(getId(data));
|
|
8334
|
+
let id = raw;
|
|
8335
|
+
if (seen2.has(id)) {
|
|
8336
|
+
dup ?? (dup = raw);
|
|
8337
|
+
for (let k = 2; seen2.has(id); k++) id = `${raw}#${k}`;
|
|
8338
|
+
}
|
|
8339
|
+
seen2.add(id);
|
|
8340
|
+
this.assignedIds.set(data, id);
|
|
8341
|
+
return { id, data, sourceIndex: i };
|
|
8342
|
+
});
|
|
8343
|
+
if (dup !== null) warn(`getRowId returned "${dup}" for more than one row; inside the grid the repeats are told apart as "${dup}#2" and so on, and updates by id reach the first of them. Return a unique id per row.`);
|
|
8344
|
+
} else this.nodes = input.data.map((data, i) => ({ id: autoId(data), data, sourceIndex: i }));
|
|
8312
8345
|
}
|
|
8313
8346
|
if (filterChanged) {
|
|
8314
8347
|
this.filtered = this.filter(input);
|
|
@@ -8361,7 +8394,8 @@ var RowModel = class {
|
|
|
8361
8394
|
}
|
|
8362
8395
|
/** Id of a row object as currently assigned. */
|
|
8363
8396
|
idOf(row) {
|
|
8364
|
-
|
|
8397
|
+
if (!this.deps.getRowId) return autoId(row);
|
|
8398
|
+
return this.assignedIds.get(row) ?? String(this.deps.getRowId(row));
|
|
8365
8399
|
}
|
|
8366
8400
|
indexOfId(id) {
|
|
8367
8401
|
if (!this.indexById) this.indexById = new Map(this.display.map((n, i) => [n.id, i]));
|
|
@@ -10040,6 +10074,11 @@ var Grid = class {
|
|
|
10040
10074
|
// ── merge, aggregates, fill, pinned rows ────────────────────
|
|
10041
10075
|
/** `sortWithinMerges` is on. */
|
|
10042
10076
|
this.sortWithin = false;
|
|
10077
|
+
// ── mergeSelection: one checkbox per merged block ───────────
|
|
10078
|
+
/** 'rows' or the merge level whose blocks get one checkbox each. */
|
|
10079
|
+
this.mergeSel = "rows";
|
|
10080
|
+
this.selBlockCache = null;
|
|
10081
|
+
this.blockStateCache = null;
|
|
10043
10082
|
/** Count / sum / min / max over the selected range (numbers only for the math). */
|
|
10044
10083
|
this.aggMemo = null;
|
|
10045
10084
|
/** Bumped on every selection change (group row checkboxes depend on their rows). */
|
|
@@ -10090,6 +10129,7 @@ var Grid = class {
|
|
|
10090
10129
|
sortBlocks: (sort) => this.sortBlocks(sort)
|
|
10091
10130
|
});
|
|
10092
10131
|
this.sortWithin = !!options.sortWithinMerges;
|
|
10132
|
+
this.mergeSel = this.validMergeSelection(options.mergeSelection);
|
|
10093
10133
|
if (this.sortWithin && this.rowModel.server) warn("sortWithinMerges is ignored with a datasource: the server sorts the rows");
|
|
10094
10134
|
if (options.groupBy?.length && this.allow(this.rowModel.server ? "serverGroups" : "grouping")) this.groupBy = this.validGroupBy(options.groupBy);
|
|
10095
10135
|
if (Array.isArray(options.conditionalFormats) && options.conditionalFormats.length && this.allow("conditional")) this.cfRules = options.conditionalFormats.filter((r) => r && typeof r === "object" && Array.isArray(r.columns)).map((r) => ({ ...r, columns: [...r.columns] }));
|
|
@@ -11357,16 +11397,173 @@ var Grid = class {
|
|
|
11357
11397
|
if (!this.allow("merge")) return NO_SPANS;
|
|
11358
11398
|
const rows = this.rowModel.rows();
|
|
11359
11399
|
const ver = this.editVersion * 1e6 + this.columns.displayed().length;
|
|
11360
|
-
|
|
11400
|
+
const sel = this.columns.getColumn(SELECT_COL_ID) ? this.selectionBlocks() : null;
|
|
11401
|
+
if (this.spanCache && this.spanCache.rows === rows && this.spanCache.ver === ver && this.spanCache.sel === sel) return this.spanCache.spans;
|
|
11361
11402
|
const spans = /* @__PURE__ */ new Map();
|
|
11362
11403
|
const merged = this.columns.displayed().filter((c) => c.def.merge || c.def.rowSpan);
|
|
11363
11404
|
if (merged.length && !rows.some((n) => n.kind)) {
|
|
11364
11405
|
const data = rows.map((n) => n.data);
|
|
11365
11406
|
for (const c of merged) spans.set(c.id, computeSpans(data, c.def));
|
|
11407
|
+
if (sel) {
|
|
11408
|
+
const n = rows.length, start = new Int32Array(n), end = new Int32Array(n);
|
|
11409
|
+
for (let i = 0; i < n; i++) {
|
|
11410
|
+
const g = sel.index.get(rows[i].id) ?? -1;
|
|
11411
|
+
start[i] = g < 0 ? i : Math.max(0, i - (g - sel.spans.start[g]));
|
|
11412
|
+
end[i] = g < 0 ? i : Math.min(n - 1, i + (sel.spans.end[g] - g));
|
|
11413
|
+
}
|
|
11414
|
+
spans.set(SELECT_COL_ID, { start, end });
|
|
11415
|
+
}
|
|
11366
11416
|
}
|
|
11367
|
-
this.spanCache = { rows, ver, spans };
|
|
11417
|
+
this.spanCache = { rows, ver, sel, spans };
|
|
11368
11418
|
return spans;
|
|
11369
11419
|
}
|
|
11420
|
+
validMergeSelection(v) {
|
|
11421
|
+
if (v === void 0 || v === null || v === "rows") return "rows";
|
|
11422
|
+
if (typeof v === "number" && Number.isInteger(v) && v >= 1) return v;
|
|
11423
|
+
warn("mergeSelection must be 'rows' or a whole number from 1; one checkbox per row is used");
|
|
11424
|
+
return "rows";
|
|
11425
|
+
}
|
|
11426
|
+
setMergeSelection(level) {
|
|
11427
|
+
const next = this.validMergeSelection(level);
|
|
11428
|
+
if (next === this.mergeSel) return;
|
|
11429
|
+
this.mergeSel = next;
|
|
11430
|
+
this.renderer.invalidate({ rows: true });
|
|
11431
|
+
}
|
|
11432
|
+
getMergeSelection() {
|
|
11433
|
+
return this.mergeSel;
|
|
11434
|
+
}
|
|
11435
|
+
/** The displayed merge columns that make the levels of `mergeSelection`, left to right. */
|
|
11436
|
+
mergeLevelColumns() {
|
|
11437
|
+
return this.columns.displayed().filter((c) => c.def.merge && !c.def.rowSpan && !isSystemCol(c.id));
|
|
11438
|
+
}
|
|
11439
|
+
/** Merge level whose blocks are checked together; 0 = one checkbox per row. */
|
|
11440
|
+
mergeSelectionLevel() {
|
|
11441
|
+
if (this.mergeSel === "rows") return 0;
|
|
11442
|
+
if (!this.options.rowSelection) {
|
|
11443
|
+
warn("mergeSelection needs rowSelection 'multiple' or 'single'");
|
|
11444
|
+
return 0;
|
|
11445
|
+
}
|
|
11446
|
+
if (!this.paid) return 0;
|
|
11447
|
+
if (this.rowModel.server || this.pivotCfg || this.options.treeData || this.groupBy.length) {
|
|
11448
|
+
warn("mergeSelection is ignored while rows are grouped, pivoted, shown as a tree or loaded from a datasource: one checkbox per row");
|
|
11449
|
+
return 0;
|
|
11450
|
+
}
|
|
11451
|
+
const m = this.mergeLevelColumns().length;
|
|
11452
|
+
if (!m) return 0;
|
|
11453
|
+
if (this.mergeSel > m) {
|
|
11454
|
+
warn(`mergeSelection: level ${this.mergeSel} asked for, but only ${m} merge column${m > 1 ? "s are" : " is"} shown; level ${m} is used`);
|
|
11455
|
+
return m;
|
|
11456
|
+
}
|
|
11457
|
+
return this.mergeSel;
|
|
11458
|
+
}
|
|
11459
|
+
/** Blocks of the selection level over every filtered, sorted row (not only the page); null for one checkbox per row. */
|
|
11460
|
+
selectionBlocks() {
|
|
11461
|
+
const level = this.mergeSelectionLevel();
|
|
11462
|
+
if (!level) return null;
|
|
11463
|
+
const rows = this.rowModel.dataRows(), disp = this.rowModel.rows();
|
|
11464
|
+
const cols = this.mergeLevelColumns().slice(0, level);
|
|
11465
|
+
const key = `${level}|${this.editVersion}|${cols.map((c2) => c2.id).join("")}`;
|
|
11466
|
+
const c = this.selBlockCache;
|
|
11467
|
+
if (c && c.rows === rows && c.disp === disp && c.key === key) return c.blocks;
|
|
11468
|
+
let blocks = null;
|
|
11469
|
+
if (!disp.some((n) => n.kind)) {
|
|
11470
|
+
const data = rows.map((n) => n.data);
|
|
11471
|
+
blocks = {
|
|
11472
|
+
level,
|
|
11473
|
+
cols,
|
|
11474
|
+
spans: nestedSpans(cols.map((col) => computeSpans(data, col.def)), rows.length),
|
|
11475
|
+
index: new Map(rows.map((n, i) => [n.id, i]))
|
|
11476
|
+
};
|
|
11477
|
+
}
|
|
11478
|
+
this.selBlockCache = { rows, disp, key, blocks };
|
|
11479
|
+
return blocks;
|
|
11480
|
+
}
|
|
11481
|
+
/** Checkbox of the block holding display row i: all, some or none of its selectable rows selected, or 'off' (none selectable). Null without block checkboxes. */
|
|
11482
|
+
blockSelection(i) {
|
|
11483
|
+
const sb = this.selectionBlocks();
|
|
11484
|
+
const node = sb && this.rowModel.getRow(i);
|
|
11485
|
+
const g = node ? sb.index.get(node.id) : void 0;
|
|
11486
|
+
if (!sb || g === void 0) return null;
|
|
11487
|
+
const sel = this.store.state.selected;
|
|
11488
|
+
let c = this.blockStateCache;
|
|
11489
|
+
if (!c || c.sel !== sel || c.blocks !== sb || c.ver !== this.editVersion) c = this.blockStateCache = { sel, blocks: sb, ver: this.editVersion, map: /* @__PURE__ */ new Map() };
|
|
11490
|
+
const a = sb.spans.start[g];
|
|
11491
|
+
let state = c.map.get(a);
|
|
11492
|
+
if (state === void 0) {
|
|
11493
|
+
const rows = this.rowModel.dataRows();
|
|
11494
|
+
let able = 0, on = 0;
|
|
11495
|
+
for (let k = a; k <= sb.spans.end[a]; k++) {
|
|
11496
|
+
if (!this.rowSelectable(rows[k].data)) continue;
|
|
11497
|
+
able++;
|
|
11498
|
+
if (sel.has(rows[k].id)) on++;
|
|
11499
|
+
}
|
|
11500
|
+
state = !able ? "off" : on === 0 ? "none" : on === able ? "all" : "some";
|
|
11501
|
+
c.map.set(a, state);
|
|
11502
|
+
}
|
|
11503
|
+
return state;
|
|
11504
|
+
}
|
|
11505
|
+
/** Selectable row ids from position a to b (inclusive) of the filtered rows. */
|
|
11506
|
+
blockIds(a, b) {
|
|
11507
|
+
const rows = this.rowModel.dataRows(), out = [];
|
|
11508
|
+
for (let k = a; k <= b; k++) if (this.rowSelectable(rows[k].data)) out.push(rows[k].id);
|
|
11509
|
+
return out;
|
|
11510
|
+
}
|
|
11511
|
+
/** selectFromClick with block checkboxes: the clicked row's whole block (Shift: every block from the anchor's). */
|
|
11512
|
+
selectBlockFromClick(sb, index, toggle, range) {
|
|
11513
|
+
const mode = this.options.rowSelection;
|
|
11514
|
+
const g = sb.index.get(this.rowModel.getRow(index).id);
|
|
11515
|
+
if (g === void 0) return;
|
|
11516
|
+
const { start, end } = sb.spans;
|
|
11517
|
+
const a = start[g], b = end[g];
|
|
11518
|
+
const ids = this.blockIds(a, b);
|
|
11519
|
+
if (!ids.length) return;
|
|
11520
|
+
const cur = this.store.state.selected;
|
|
11521
|
+
const anchorId = this.rowModel.dataRows()[a].id;
|
|
11522
|
+
if (mode === "single") {
|
|
11523
|
+
const all2 = ids.every((id) => cur.has(id));
|
|
11524
|
+
this.setSelected(toggle && all2 ? /* @__PURE__ */ new Set() : new Set(ids), anchorId);
|
|
11525
|
+
return;
|
|
11526
|
+
}
|
|
11527
|
+
const ag = this.store.state.anchorId == null ? void 0 : sb.index.get(this.store.state.anchorId);
|
|
11528
|
+
if (range && ag !== void 0) {
|
|
11529
|
+
const next = toggle ? new Set(cur) : /* @__PURE__ */ new Set();
|
|
11530
|
+
for (const id of this.blockIds(Math.min(start[ag], a), Math.max(end[ag], b))) next.add(id);
|
|
11531
|
+
this.setSelected(next);
|
|
11532
|
+
return;
|
|
11533
|
+
}
|
|
11534
|
+
if (toggle) {
|
|
11535
|
+
const next = new Set(cur);
|
|
11536
|
+
const all2 = ids.every((id) => next.has(id));
|
|
11537
|
+
for (const id of ids) all2 ? next.delete(id) : next.add(id);
|
|
11538
|
+
this.setSelected(next, anchorId);
|
|
11539
|
+
return;
|
|
11540
|
+
}
|
|
11541
|
+
this.setSelected(new Set(ids), anchorId);
|
|
11542
|
+
}
|
|
11543
|
+
/**
|
|
11544
|
+
* getSelectedGroups: blocks holding selected rows, in display order, with their merge values and selected rows.
|
|
11545
|
+
* allRows: every row of those blocks that passes the filters, selected or not (getSelectedGroupsAllRows).
|
|
11546
|
+
*/
|
|
11547
|
+
selectedGroups(allRows = false) {
|
|
11548
|
+
const sb = this.selectionBlocks();
|
|
11549
|
+
const sel = this.store.state.selected;
|
|
11550
|
+
if (!sb || !sel.size) return [];
|
|
11551
|
+
const rows = this.rowModel.dataRows(), out = [];
|
|
11552
|
+
for (let a = 0; a < rows.length; a = sb.spans.end[a] + 1) {
|
|
11553
|
+
const picked = [];
|
|
11554
|
+
let any = false;
|
|
11555
|
+
for (let k = a; k <= sb.spans.end[a]; k++) {
|
|
11556
|
+
const on = sel.has(rows[k].id);
|
|
11557
|
+
any || (any = on);
|
|
11558
|
+
if (on || allRows) picked.push(rows[k].data);
|
|
11559
|
+
}
|
|
11560
|
+
if (!any) continue;
|
|
11561
|
+
const values = {};
|
|
11562
|
+
for (const c of sb.cols) values[c.def.field ?? c.id] = getCellValue(c.def, rows[a].data);
|
|
11563
|
+
out.push({ level: sb.level, values, rows: picked });
|
|
11564
|
+
}
|
|
11565
|
+
return out;
|
|
11566
|
+
}
|
|
11370
11567
|
rangeAggregates() {
|
|
11371
11568
|
const all2 = this.allRangeBounds();
|
|
11372
11569
|
if (!all2.length || !this.paid) return null;
|
|
@@ -11802,7 +11999,13 @@ var Grid = class {
|
|
|
11802
11999
|
const mode = this.options.rowSelection;
|
|
11803
12000
|
if (!mode || index < 0 || index >= this.rowModel.getRowCount()) return;
|
|
11804
12001
|
const target = this.rowModel.getRow(index);
|
|
11805
|
-
if (target.kind
|
|
12002
|
+
if (target.kind) return;
|
|
12003
|
+
const blocks = this.selectionBlocks();
|
|
12004
|
+
if (blocks) {
|
|
12005
|
+
this.selectBlockFromClick(blocks, index, toggle, range);
|
|
12006
|
+
return;
|
|
12007
|
+
}
|
|
12008
|
+
if (!this.rowSelectable(target.data)) return;
|
|
11806
12009
|
const r = nextSelection({
|
|
11807
12010
|
selected: this.store.state.selected,
|
|
11808
12011
|
anchorIndex: this.anchorIndex(),
|
|
@@ -11992,6 +12195,10 @@ var Grid = class {
|
|
|
11992
12195
|
getDensity: guard(() => this.density),
|
|
11993
12196
|
setSortWithinMerges: guard((on) => this.setSortWithinMerges(on)),
|
|
11994
12197
|
getSortWithinMerges: guard(() => this.sortWithin),
|
|
12198
|
+
setMergeSelection: guard((level) => this.setMergeSelection(level)),
|
|
12199
|
+
getMergeSelection: guard(() => this.getMergeSelection()),
|
|
12200
|
+
getSelectedGroups: guard(() => this.selectedGroups()),
|
|
12201
|
+
getSelectedGroupsAllRows: guard(() => this.selectedGroups(true)),
|
|
11995
12202
|
showOverlay: guard((kind) => {
|
|
11996
12203
|
this.forcedOverlay = kind === "loading" || kind === "noRows" ? kind : null;
|
|
11997
12204
|
this.renderer.invalidate();
|
package/dist/locales/de.d.ts
CHANGED
package/dist/locales/en.d.ts
CHANGED
package/dist/locales/es.d.ts
CHANGED
package/dist/locales/fr.d.ts
CHANGED
package/dist/locales/id.d.ts
CHANGED
package/dist/locales/it.d.ts
CHANGED
package/dist/locales/ja.d.ts
CHANGED
package/dist/locales/ko.d.ts
CHANGED
package/dist/locales/pt-BR.d.ts
CHANGED
package/dist/locales/ru.d.ts
CHANGED
package/dist/locales/th.d.ts
CHANGED
package/dist/locales/vi.d.ts
CHANGED
package/dist/locales/zh-CN.d.ts
CHANGED
package/dist/locales/zh-TW.d.ts
CHANGED