@vueye-table/core 3.0.0-alpha.8 → 3.0.0-alpha.9
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/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -287,6 +287,9 @@ interface GridKey {
|
|
|
287
287
|
}
|
|
288
288
|
/** What a key press asks a grid to do while no cell is being edited. */
|
|
289
289
|
type GridCommand = {
|
|
290
|
+
readonly type: "tree";
|
|
291
|
+
readonly action: "expand" | "collapse" | "child" | "parent" | "siblings";
|
|
292
|
+
} | {
|
|
290
293
|
readonly type: "move";
|
|
291
294
|
readonly direction: GridDirection;
|
|
292
295
|
readonly options: MoveOptions;
|
|
@@ -310,7 +313,12 @@ type GridCommand = {
|
|
|
310
313
|
* a printable character starts editing with that character, Delete and Backspace clear, Escape
|
|
311
314
|
* collapses the selection, and Ctrl or Cmd with A, Z, Y select all, undo, and redo.
|
|
312
315
|
*/
|
|
313
|
-
|
|
316
|
+
/** Hierarchy navigation is enabled only at the caller's designated tree column. */
|
|
317
|
+
interface GridTreeContext {
|
|
318
|
+
readonly canExpand: boolean;
|
|
319
|
+
readonly expanded: boolean;
|
|
320
|
+
}
|
|
321
|
+
declare function gridCommand(event: GridKey, tree?: GridTreeContext): GridCommand | undefined;
|
|
314
322
|
//#endregion
|
|
315
323
|
//#region src/undo-stack.d.ts
|
|
316
324
|
/**
|
|
@@ -567,6 +575,8 @@ interface SortInfo {
|
|
|
567
575
|
* frozen and replaced on each change, so comparing snapshots by identity detects a change.
|
|
568
576
|
*/
|
|
569
577
|
interface TableSnapshot<TRow> {
|
|
578
|
+
/** True when hierarchy options are configured, including an empty tree. */
|
|
579
|
+
readonly tree: boolean;
|
|
570
580
|
readonly loadState: LoadState;
|
|
571
581
|
readonly loadedRowCount: number;
|
|
572
582
|
readonly expectedRowCount: number | undefined;
|
|
@@ -775,5 +785,5 @@ interface PendingChanges<TRow> {
|
|
|
775
785
|
*/
|
|
776
786
|
declare function inferColumns<TRow>(rows: readonly TRow[], sample?: number): readonly ColumnDef<TRow>[];
|
|
777
787
|
//#endregion
|
|
778
|
-
export { type AnyColumnDef, type CellChange, type CellEdit, type CellInputEdit, type CellPosition, type CellRange, type CellValueEdit, type ChildStatus, type ColumnAlign, type ColumnDef, type ColumnOptions, type ColumnType, type ComputedColumnDef, type CopyOptions, DEFAULT_PAGE_SIZE, type DataIngestionResult, type DataTable, type DeepKeys, type EditOptions, type EditResult, type EditStatus, type EditorSpec, type ExpandMode, type ExpandedState, type ExportOptions, type GridBounds, type GridCommand, type GridDirection, type GridKey, type GridSelection, type InsertPosition, type LoadState, type MoveOptions, type PageItem, type PaginationState, type ParseResult, type PasteLimit, type PathColumnDef, type PathValue, type PendingCell, type PendingChanges, type RangeFilter, type RowChange, type RowItemKind, type RowKey, type SelectScope, type SelectionCoverage, type SelectionMode, type SortDirection, type SortInfo, type SortRule, type StreamOptions, type StreamResult, type StreamSignal, type TableColumn, type TableIssue, type TableIssueCode, type TableOptions, type TableRenderItem, type TableRow, type TableSnapshot, type TableState, type TableStatePatch, type TreeFilter, type TreeLoadController, type TreeLoadSignal, type TreeOptions, type TreePagination, type UndoStack, type UpdatedRow, type ValidationResult, type Validator, type VirtualAlign, type VirtualItem, type VirtualWindow, type Virtualizer, type VirtualizerOptions, clampPage, clampPosition, columnLabel, compareValues, countPages, createTable, createUndoStack, createVirtualizer, defineColumns, filterRows, formatValue, fromA1, getPath, getRowItemKey, gridCommand, humanize, inferColumns, matchesFilter, moveSelection, paginateRows, paginationItems, parseAs, parseDelimited, rangeContains, resolveColumn, selectCell, selectionRange, setPath, sortRows, toA1, toDelimited, typeOf };
|
|
788
|
+
export { type AnyColumnDef, type CellChange, type CellEdit, type CellInputEdit, type CellPosition, type CellRange, type CellValueEdit, type ChildStatus, type ColumnAlign, type ColumnDef, type ColumnOptions, type ColumnType, type ComputedColumnDef, type CopyOptions, DEFAULT_PAGE_SIZE, type DataIngestionResult, type DataTable, type DeepKeys, type EditOptions, type EditResult, type EditStatus, type EditorSpec, type ExpandMode, type ExpandedState, type ExportOptions, type GridBounds, type GridCommand, type GridDirection, type GridKey, type GridSelection, type GridTreeContext, type InsertPosition, type LoadState, type MoveOptions, type PageItem, type PaginationState, type ParseResult, type PasteLimit, type PathColumnDef, type PathValue, type PendingCell, type PendingChanges, type RangeFilter, type RowChange, type RowItemKind, type RowKey, type SelectScope, type SelectionCoverage, type SelectionMode, type SortDirection, type SortInfo, type SortRule, type StreamOptions, type StreamResult, type StreamSignal, type TableColumn, type TableIssue, type TableIssueCode, type TableOptions, type TableRenderItem, type TableRow, type TableSnapshot, type TableState, type TableStatePatch, type TreeFilter, type TreeLoadController, type TreeLoadSignal, type TreeOptions, type TreePagination, type UndoStack, type UpdatedRow, type ValidationResult, type Validator, type VirtualAlign, type VirtualItem, type VirtualWindow, type Virtualizer, type VirtualizerOptions, clampPage, clampPosition, columnLabel, compareValues, countPages, createTable, createUndoStack, createVirtualizer, defineColumns, filterRows, formatValue, fromA1, getPath, getRowItemKey, gridCommand, humanize, inferColumns, matchesFilter, moveSelection, paginateRows, paginationItems, parseAs, parseDelimited, rangeContains, resolveColumn, selectCell, selectionRange, setPath, sortRows, toA1, toDelimited, typeOf };
|
|
779
789
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/state.ts","../src/issues.ts","../src/path.ts","../src/validation.ts","../src/column.ts","../src/delimited.ts","../src/grid.ts","../src/undo-stack.ts","../src/virtualizer.ts","../src/humanize.ts","../src/tree.ts","../src/row.ts","../src/pipeline.ts","../src/stream.ts","../src/table.ts","../src/pending-changes.ts","../src/infer.ts"],"mappings":";;KAGY;KACA,yBAAyB;KAEzB;;UAGK;WACN;WACA,WAAW;;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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/state.ts","../src/issues.ts","../src/path.ts","../src/validation.ts","../src/column.ts","../src/delimited.ts","../src/grid.ts","../src/undo-stack.ts","../src/virtualizer.ts","../src/humanize.ts","../src/tree.ts","../src/row.ts","../src/pipeline.ts","../src/stream.ts","../src/table.ts","../src/pending-changes.ts","../src/infer.ts"],"mappings":";;KAGY;KACA,yBAAyB;KAEzB;;UAGK;WACN;WACA,WAAW;;;UAIL;WACN;WACA;;;;;;;;UASM;WACN,kBAAkB;;WAElB;;WAEA,SAAS,SAAS;WAClB,YAAY;WACZ,oBAAoB;;WAEpB,UAAU;WACV;;WAEA;;;KAIC,8BACA,WAAW,cAAc,WAAW;cAGnC;;;;KC3CD;;;;;UAiCK;WACN,MAAM;WACN;WACA;WACA,SAAS;WACT;;;;KChCN,wEAQD,iCAEK;KAEJ;;KAGO,SAAS,GAAG,8BAA8B,kCAElD,UAAU,kBAGL,WAAW,aACR,KACC,YAAY,EAAE,YAAY,kBAEpB,KAAK,SAAS,YAAY,EAAE,KAAK,MAAM,qBAC5C;;KAGF,UAAU,GAAG,wBAAwB,uBAAuB,eAAe,UACnF,oBAAoB,IAClB,UAAU,YAAY,EAAE,SAAS,4BAA4B,EAAE,0CAEjE,oBAAoB,IAClB,EAAE;;iBAiBQ,QAAQ,iBAAiB;;;;;;iBAmBzB,QAAQ,GACtB,QAAQ,GACR,cACA,gBACA,WAAW,SAAS,sBACnB;;;KChFS;WAA8C;WAA0B;;KACxE,UAAU,QAAQ,SAC5B,OAAO,QACP,KAAK,SACF,mBAAmB,QAAQ;UACf;WACN;WACA;WACA;WACA;WACA;WACA;;UAEM;WACN,QAAQ;WACR;WACA;;;;KCfC;;KAGA;;UAGK;WACN,wBAAwB;WACxB,wBAAwB;;;UAIlB,cAAc,MAAM;;WAE1B;WACA,QAAQ;;WAER;WACA;;WAEA;;WAEA;;WAEA;;;;;WAKA,OAAO;;WAEP,uBAAuB,KAAK;;W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@@ const ARROWS = {
|
|
|
465
465
|
ArrowLeft: "left",
|
|
466
466
|
ArrowRight: "right"
|
|
467
467
|
};
|
|
468
|
-
|
|
469
|
-
* Map a key press to a grid command, spreadsheet style: arrows move (Shift extends, Ctrl or Cmd
|
|
470
|
-
* jumps to the edge), Tab moves across, Home and End reach the row's ends, Enter or F2 edit,
|
|
471
|
-
* a printable character starts editing with that character, Delete and Backspace clear, Escape
|
|
472
|
-
* collapses the selection, and Ctrl or Cmd with A, Z, Y select all, undo, and redo.
|
|
473
|
-
*/
|
|
474
|
-
function gridCommand(event) {
|
|
468
|
+
function gridCommand(event, tree) {
|
|
475
469
|
const mod = event.ctrlKey === true || event.metaKey === true;
|
|
476
470
|
const shift = event.shiftKey === true;
|
|
471
|
+
if (tree && !mod && !event.altKey) {
|
|
472
|
+
if (event.key === "*") return {
|
|
473
|
+
type: "tree",
|
|
474
|
+
action: "siblings"
|
|
475
|
+
};
|
|
476
|
+
if (!shift && event.key === "ArrowRight" && tree.canExpand) return {
|
|
477
|
+
type: "tree",
|
|
478
|
+
action: tree.expanded ? "child" : "expand"
|
|
479
|
+
};
|
|
480
|
+
if (!shift && event.key === "ArrowLeft") return {
|
|
481
|
+
type: "tree",
|
|
482
|
+
action: tree.canExpand && tree.expanded ? "collapse" : "parent"
|
|
483
|
+
};
|
|
484
|
+
}
|
|
477
485
|
const direction = ARROWS[event.key];
|
|
478
486
|
if (direction) return {
|
|
479
487
|
type: "move",
|
|
@@ -1804,6 +1812,13 @@ function createTable(options) {
|
|
|
1804
1812
|
const manual = options.manual ?? false;
|
|
1805
1813
|
const treeEnabled = Boolean(options.getChildren || options.getParentKey || options.hasChildren || options.loadChildren);
|
|
1806
1814
|
const rootPagination = treeEnabled && (manual || (options.paginateBy ?? "root") === "root");
|
|
1815
|
+
const projectedRows = /* @__PURE__ */ new WeakMap();
|
|
1816
|
+
function shareRow(base, next) {
|
|
1817
|
+
const previous = projectedRows.get(base);
|
|
1818
|
+
if (previous && Object.keys(next).every((key) => previous[key] === next[key])) return previous;
|
|
1819
|
+
projectedRows.set(base, next);
|
|
1820
|
+
return next;
|
|
1821
|
+
}
|
|
1807
1822
|
let lazyVersion = 0;
|
|
1808
1823
|
const lazyChildren = /* @__PURE__ */ new Map();
|
|
1809
1824
|
const childStatuses = /* @__PURE__ */ new Map();
|
|
@@ -2022,11 +2037,11 @@ function createTable(options) {
|
|
|
2022
2037
|
const selected = new Set(selection);
|
|
2023
2038
|
const rows = mapList(indexed.rows, (row) => {
|
|
2024
2039
|
const isExpanded = row.canExpand && (expanded === true || (keys?.has(row.key) ?? false));
|
|
2025
|
-
return isExpanded || selected.has(row.key) ? Object.freeze({
|
|
2040
|
+
return isExpanded || selected.has(row.key) ? shareRow(row, Object.freeze({
|
|
2026
2041
|
...row,
|
|
2027
2042
|
isExpanded,
|
|
2028
2043
|
selection: selected.has(row.key) ? "all" : "none"
|
|
2029
|
-
}) : row;
|
|
2044
|
+
})) : row;
|
|
2030
2045
|
});
|
|
2031
2046
|
return {
|
|
2032
2047
|
rows,
|
|
@@ -2104,7 +2119,7 @@ function createTable(options) {
|
|
|
2104
2119
|
const status = statuses.get(key) ?? (node.children.length || !node.unloaded ? "loaded" : "idle");
|
|
2105
2120
|
const count = selected.get(node);
|
|
2106
2121
|
const canExpand = node.children.length > 0 || status !== "loaded" || (options.getRowCanExpand?.(node.row.original) ?? false);
|
|
2107
|
-
const result = Object.freeze({
|
|
2122
|
+
const result = shareRow(node.row, Object.freeze({
|
|
2108
2123
|
...node.row,
|
|
2109
2124
|
isDirty: dirty.has(key),
|
|
2110
2125
|
cellIssues: cellProblems.get(key),
|
|
@@ -2115,7 +2130,7 @@ function createTable(options) {
|
|
|
2115
2130
|
canExpand,
|
|
2116
2131
|
isExpanded: canExpand && (expandedState === true || (keys?.has(key) ?? false) || ancestors.has(key) || processed.autoExpanded.has(key)),
|
|
2117
2132
|
selection: coverage(count.selected, count.total)
|
|
2118
|
-
});
|
|
2133
|
+
}));
|
|
2119
2134
|
projected.set(key, result);
|
|
2120
2135
|
return result;
|
|
2121
2136
|
};
|
|
@@ -2188,6 +2203,7 @@ function createTable(options) {
|
|
|
2188
2203
|
priority
|
|
2189
2204
|
}]));
|
|
2190
2205
|
return Object.freeze({
|
|
2206
|
+
tree: treeEnabled,
|
|
2191
2207
|
loadState,
|
|
2192
2208
|
loadedRowCount: indexed.rows.length,
|
|
2193
2209
|
expectedRowCount,
|