@ember-lattice/ember 0.0.0-stage → 1.1.0
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/CHANGELOG.md +71 -0
- package/LICENSE.md +21 -0
- package/NOTICE +30 -0
- package/README.md +176 -2
- package/addon-main.cjs +4 -0
- package/declarations/board/declarations.d.ts +129 -0
- package/declarations/board/declarations.d.ts.map +1 -0
- package/declarations/board/lattice-board.d.ts +153 -0
- package/declarations/board/lattice-board.d.ts.map +1 -0
- package/declarations/grid/alignment.d.ts +30 -0
- package/declarations/grid/alignment.d.ts.map +1 -0
- package/declarations/grid/auto-columns.d.ts +22 -0
- package/declarations/grid/auto-columns.d.ts.map +1 -0
- package/declarations/grid/cell-state.d.ts +17 -0
- package/declarations/grid/cell-state.d.ts.map +1 -0
- package/declarations/grid/clipboard.d.ts +7 -0
- package/declarations/grid/clipboard.d.ts.map +1 -0
- package/declarations/grid/columns/column-def.d.ts +120 -0
- package/declarations/grid/columns/column-def.d.ts.map +1 -0
- package/declarations/grid/columns/declarations.d.ts +212 -0
- package/declarations/grid/columns/declarations.d.ts.map +1 -0
- package/declarations/grid/columns/memo.d.ts +32 -0
- package/declarations/grid/columns/memo.d.ts.map +1 -0
- package/declarations/grid/columns/owned-table.d.ts +40 -0
- package/declarations/grid/columns/owned-table.d.ts.map +1 -0
- package/declarations/grid/columns/registry.d.ts +13 -0
- package/declarations/grid/columns/registry.d.ts.map +1 -0
- package/declarations/grid/keyboard.d.ts +24 -0
- package/declarations/grid/keyboard.d.ts.map +1 -0
- package/declarations/grid/lattice-grid.d.ts +854 -0
- package/declarations/grid/lattice-grid.d.ts.map +1 -0
- package/declarations/grid/row-number.d.ts +24 -0
- package/declarations/grid/row-number.d.ts.map +1 -0
- package/declarations/grid/selection.d.ts +24 -0
- package/declarations/grid/selection.d.ts.map +1 -0
- package/declarations/grid/state-host.d.ts +66 -0
- package/declarations/grid/state-host.d.ts.map +1 -0
- package/declarations/grid/types.d.ts +417 -0
- package/declarations/grid/types.d.ts.map +1 -0
- package/declarations/index.d.ts +27 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/list/lattice-list.d.ts +184 -0
- package/declarations/list/lattice-list.d.ts.map +1 -0
- package/dist/index.js +5031 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GridColumnType } from './types.ts';
|
|
2
|
+
/** A column def that `autoColumns` makes. */
|
|
3
|
+
export interface AutoColumnDef {
|
|
4
|
+
id: string;
|
|
5
|
+
accessorKey: string;
|
|
6
|
+
header: string;
|
|
7
|
+
meta?: {
|
|
8
|
+
columnType: GridColumnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface AutoColumnsOptions {
|
|
12
|
+
/** The number of rows to read the keys from. Default: 10. */
|
|
13
|
+
sample?: number;
|
|
14
|
+
/** Column types, the first one first: a key gets the first type whose `isValue` takes its value. */
|
|
15
|
+
types?: ReadonlyArray<GridColumnType>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Column defs from the keys of the first rows, in the order the keys come. The type of a key is
|
|
19
|
+
* from its first value that is not null or undefined.
|
|
20
|
+
*/
|
|
21
|
+
export declare function autoColumns(rows: ReadonlyArray<unknown>, options?: AutoColumnsOptions): AutoColumnDef[];
|
|
22
|
+
//# sourceMappingURL=auto-columns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-columns.d.ts","sourceRoot":"","sources":["../../src/grid/auto-columns.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE;QAAE,UAAU,EAAE,cAAc,CAAA;KAAE,CAAA;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oGAAoG;IACpG,KAAK,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;CACtC;AAYD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,EAC5B,OAAO,GAAE,kBAAuB,GAC/B,aAAa,EAAE,CAmBjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The state of one cell. A cell component keeps its state here, not in its own `@tracked`
|
|
3
|
+
* fields, because row slots recycle (ADR 0002). Each change replaces the record, so a template
|
|
4
|
+
* that reads a value renders again.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CellState {
|
|
7
|
+
private _values;
|
|
8
|
+
get(key: string): unknown;
|
|
9
|
+
set(key: string, value: unknown): void;
|
|
10
|
+
}
|
|
11
|
+
/** `cell.state`: the cell states, keyed by row ID and column ID. */
|
|
12
|
+
export declare class CellStateStore {
|
|
13
|
+
private _states;
|
|
14
|
+
/** The state of a cell. The first read makes it; this is not a tracked write. */
|
|
15
|
+
for(rowId: string, columnId: string): CellState;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=cell-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell-state.d.ts","sourceRoot":"","sources":["../../src/grid/cell-state.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,SAAS;IACX,OAAO,CAAC,OAAO,CAAwC;IAEhE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;CAGvC;AAED,oEAAoE;AACpE,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA+B;IAE9C,iFAAiF;IACjF,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS;CAMhD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GridRange } from './types.ts';
|
|
2
|
+
export declare const toTsv: (rows: ReadonlyArray<readonly string[]>) => string;
|
|
3
|
+
export declare const toHtml: (rows: ReadonlyArray<readonly string[]>) => string;
|
|
4
|
+
export declare const inRange: (range: GridRange, row: number, col: number) => boolean;
|
|
5
|
+
/** The number of rows in a TSV text: line ends outside quotes; a last line end adds no row. */
|
|
6
|
+
export declare function tsvRowCount(text: string): number;
|
|
7
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/grid/clipboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAK3C,eAAO,MAAM,KAAK,GAAI,MAAM,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,WACL,CAAA;AAIvD,eAAO,MAAM,MAAM,GAAI,MAAM,aAAa,CAAC,SAAS,MAAM,EAAE,CAAC,WAGtC,CAAA;AAEvB,eAAO,MAAM,OAAO,GAAI,OAAO,SAAS,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,YAIrC,CAAA;AAE7B,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAShD"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { ComponentLike } from '@glint/template';
|
|
2
|
+
import type { GridColumn, GridColumnType, GridEditTrigger, GridRow, LatticeCellSignature, LatticeColumnMeta, LatticeHeaderLabelSignature, LatticeHeaderSignature } from '../types.ts';
|
|
3
|
+
/** A column def that the grid gives to `constructTable`. A structural type, as `GridTable`. */
|
|
4
|
+
export interface GridColumnDef {
|
|
5
|
+
id: string;
|
|
6
|
+
header?: unknown;
|
|
7
|
+
accessorKey?: string;
|
|
8
|
+
accessorFn?: (row: never, index: number) => unknown;
|
|
9
|
+
columns?: ReadonlyArray<GridColumnDef>;
|
|
10
|
+
meta?: {
|
|
11
|
+
lattice?: LatticeColumnMeta;
|
|
12
|
+
columnType?: GridColumnType;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
[option: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The args of `<g.Column>`. Each arg maps to one option of the column def. The interface is open:
|
|
19
|
+
* `@ember-lattice/editing` and `@ember-lattice/ui` add their args to it (declaration merging),
|
|
20
|
+
* and `columnDefOf` puts them in the `meta` key of their package.
|
|
21
|
+
*/
|
|
22
|
+
export interface LatticeColumnArgs {
|
|
23
|
+
/** The column ID: the key of the column in the table state and in a saved view. */
|
|
24
|
+
id: string;
|
|
25
|
+
/** The header text. Export, menus, filters, the editor and the wire request read it. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** The key of the value in a data row (`accessorKey`). Default: `@id`. */
|
|
28
|
+
field?: string;
|
|
29
|
+
/** The value of a data row (`accessorFn`), in place of `@field`. */
|
|
30
|
+
value?: (row: never, index: number) => unknown;
|
|
31
|
+
size?: number;
|
|
32
|
+
minSize?: number;
|
|
33
|
+
maxSize?: number;
|
|
34
|
+
/** The share of the free width (the flex column feature). */
|
|
35
|
+
flex?: number;
|
|
36
|
+
/** True: the user can sort the column (`enableSorting`). Default: false. */
|
|
37
|
+
sortable?: boolean;
|
|
38
|
+
/** The sort function, or the name of one in the `sortFns` of the features (`sortFn`). */
|
|
39
|
+
sortFn?: unknown;
|
|
40
|
+
/** True: the user can resize the column (`enableResizing`). Default: false. */
|
|
41
|
+
resizable?: boolean;
|
|
42
|
+
/** False: the user cannot hide the column (`enableHiding`). */
|
|
43
|
+
hideable?: boolean;
|
|
44
|
+
/** False: the user cannot pin the column (`enablePinning`). */
|
|
45
|
+
pinnable?: boolean;
|
|
46
|
+
/** The filter function, or the name of one in the `filterFns` of the features (`filterFn`). */
|
|
47
|
+
filterFn?: unknown;
|
|
48
|
+
/** False: the user cannot filter the column (`enableColumnFilter`). */
|
|
49
|
+
filterable?: boolean;
|
|
50
|
+
/** True: the user can group by the column (`enableGrouping`). */
|
|
51
|
+
groupable?: boolean;
|
|
52
|
+
/** The aggregation function, or the name of one (`aggregationFn`). */
|
|
53
|
+
aggregate?: unknown;
|
|
54
|
+
/** A column type of `@ember-lattice/column-types` (`meta.columnType`). */
|
|
55
|
+
type?: GridColumnType;
|
|
56
|
+
/** The pin of the column in the first render: `start` or `end`. */
|
|
57
|
+
pinned?: 'start' | 'end';
|
|
58
|
+
/** True: the column is hidden in the first render. */
|
|
59
|
+
hidden?: boolean;
|
|
60
|
+
/** The text of a cell with no cell block (`meta.lattice.format`). */
|
|
61
|
+
format?: (value: unknown) => string;
|
|
62
|
+
align?: 'start' | 'end' | 'center';
|
|
63
|
+
/** `cheap`: a cell reuses its row slot. `full` (default): a cell is keyed by row ID (ADR 0002). */
|
|
64
|
+
cellKind?: 'cheap' | 'full';
|
|
65
|
+
tooltip?: (value: unknown, row: GridRow) => string | undefined;
|
|
66
|
+
editMode?: 'cell' | 'popup';
|
|
67
|
+
editTrigger?: GridEditTrigger;
|
|
68
|
+
rowDrag?: boolean;
|
|
69
|
+
cellDescription?: (row: GridRow, column: GridColumn) => string | undefined;
|
|
70
|
+
cellInvalid?: (row: GridRow, column: GridColumn) => boolean;
|
|
71
|
+
/** A cell component, in place of a cell block (`meta.lattice.cell`). */
|
|
72
|
+
cell?: ComponentLike<LatticeCellSignature>;
|
|
73
|
+
/** A component in place of the header text (`meta.lattice.headerLabel`). */
|
|
74
|
+
headerLabel?: ComponentLike<LatticeHeaderLabelSignature>;
|
|
75
|
+
/** A component after the header text (`meta.lattice.header`). */
|
|
76
|
+
headerEnd?: ComponentLike<LatticeHeaderSignature>;
|
|
77
|
+
/** More `meta`: the keys of other packages. */
|
|
78
|
+
meta?: Record<string, unknown>;
|
|
79
|
+
/** More column def options, for a feature that has no arg. The args win. */
|
|
80
|
+
columnDef?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The key of a data row, for `@field`. With no row type (`unknown`, or `never` inside the grid),
|
|
84
|
+
* any text.
|
|
85
|
+
*/
|
|
86
|
+
export type FieldOf<T> = [T] extends [never] ? string : unknown extends T ? string : keyof T & string;
|
|
87
|
+
/**
|
|
88
|
+
* The args of `<g.Column>` for the rows of type `T`: `@field` is a key of `T`, and `@value` takes a
|
|
89
|
+
* `T`. `LatticeGrid` infers `T` from `@data`, so Glint checks a field name.
|
|
90
|
+
*/
|
|
91
|
+
export type TypedColumnArgs<T> = Omit<LatticeColumnArgs, 'field' | 'value'> & {
|
|
92
|
+
field?: FieldOf<T>;
|
|
93
|
+
value?: (row: T, index: number) => unknown;
|
|
94
|
+
};
|
|
95
|
+
/** The named blocks of a declaration. */
|
|
96
|
+
export interface DeclaredBlocks {
|
|
97
|
+
cell: boolean;
|
|
98
|
+
header: boolean;
|
|
99
|
+
headerEnd: boolean;
|
|
100
|
+
editor?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export declare const NO_BLOCKS: DeclaredBlocks;
|
|
103
|
+
/** The column def of one `<g.Column>`. An arg that the app does not give is not in the def. */
|
|
104
|
+
export declare function columnDefOf(args: LatticeColumnArgs, blocks: DeclaredBlocks): GridColumnDef;
|
|
105
|
+
/** The initial pinning and visibility of the declarations (`@pinned`, `@hidden`). */
|
|
106
|
+
export declare function initialStateOf(args: ReadonlyArray<LatticeColumnArgs>): Record<string, unknown>;
|
|
107
|
+
/** The IDs that two or more declarations have. */
|
|
108
|
+
export declare function duplicateIds(args: ReadonlyArray<LatticeColumnArgs>): string[];
|
|
109
|
+
/** A column arg whose engine feature the table does not have. */
|
|
110
|
+
export interface MissingFeature {
|
|
111
|
+
id: string;
|
|
112
|
+
arg: string;
|
|
113
|
+
feature: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The args of the declarations that need a feature that is not in `features` (the keys of the
|
|
117
|
+
* table features). With no feature, the engine ignores the option, so the grid warns.
|
|
118
|
+
*/
|
|
119
|
+
export declare function missingFeatures(args: ReadonlyArray<LatticeColumnArgs>, features: ReadonlyArray<string>): MissingFeature[];
|
|
120
|
+
//# sourceMappingURL=column-def.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-def.d.ts","sourceRoot":"","sources":["../../../src/grid/columns/column-def.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,OAAO,EACP,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,aAAa,CAAA;AAEpB,+FAA+F;AAC/F,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACnD,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAA;IACtC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAAC,UAAU,CAAC,EAAE,cAAc,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;IAC3F,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,EAAE,EAAE,MAAM,CAAA;IACV,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KA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O,MAAM,SAAS,EAAE,cAAiE,CAAA;AA0CzF,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,GAAG,aAAa,CAwC1F;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAC,2BASpE;AAED,kDAAkD;AAClD,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,MAAM,EAAE,CAQ7E;AAUD,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAC,EACtC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,cAAc,EAAE,CAQlB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { TOC } from '@ember/component/template-only';
|
|
3
|
+
import type Owner from '@ember/owner';
|
|
4
|
+
import type { ComponentLike, WithBoundArgs } from '@glint/template';
|
|
5
|
+
import type { LatticeLocale } from '@ember-lattice/core';
|
|
6
|
+
import { ColumnRegistry } from './registry.ts';
|
|
7
|
+
import type { GridColumnDef, LatticeColumnArgs, TypedColumnArgs } from './column-def.ts';
|
|
8
|
+
import type { CellState } from '../cell-state.ts';
|
|
9
|
+
import type { GridCell, GridColumn, GridEditorSignature, GridHeaderApi, GridRow } from '../types.ts';
|
|
10
|
+
/** What a `<:cell>` block gets. */
|
|
11
|
+
export interface GridCellBlock<T = unknown> {
|
|
12
|
+
/**
|
|
13
|
+
* The text of the cell, as the grid shows it with no block: `@format`, the format of `@type`,
|
|
14
|
+
* or the value as text.
|
|
15
|
+
*/
|
|
16
|
+
text: string;
|
|
17
|
+
/** The value of the cell. Use `text` to show it, or `data` for a typed field of the row. */
|
|
18
|
+
value: unknown;
|
|
19
|
+
/** The data row: the item of `@data`. */
|
|
20
|
+
data: T;
|
|
21
|
+
row: GridRow;
|
|
22
|
+
column: GridColumn;
|
|
23
|
+
cell: GridCell;
|
|
24
|
+
/** The state of the cell (ADR 0002). With `@cellKind='cheap'`, it moves with the row slot. */
|
|
25
|
+
state: CellState;
|
|
26
|
+
}
|
|
27
|
+
/** What a `<:header>` or `<:headerEnd>` block gets. */
|
|
28
|
+
export interface GridHeaderBlock {
|
|
29
|
+
column: GridColumn;
|
|
30
|
+
/** The header text: `@label`. */
|
|
31
|
+
label: string;
|
|
32
|
+
grid: GridHeaderApi;
|
|
33
|
+
}
|
|
34
|
+
/** What an `<:editor>` block gets: the args of an `@editing` editor. */
|
|
35
|
+
export type GridEditorBlock = GridEditorSignature['Args'];
|
|
36
|
+
/** A declaration in a registry. */
|
|
37
|
+
export interface Declaration {
|
|
38
|
+
readonly marker: Node;
|
|
39
|
+
readonly columnDef: GridColumnDef;
|
|
40
|
+
/** The args, for the initial state (`@pinned`, `@hidden`). Null for a group. */
|
|
41
|
+
readonly columnArgs: LatticeColumnArgs | null;
|
|
42
|
+
readonly children: ColumnRegistry<Declaration> | null;
|
|
43
|
+
}
|
|
44
|
+
export interface LatticeColumnSignature<T = unknown> {
|
|
45
|
+
Args: TypedColumnArgs<T>;
|
|
46
|
+
Blocks: {
|
|
47
|
+
/** The content of each cell of the column. */
|
|
48
|
+
cell: [GridCellBlock<T>];
|
|
49
|
+
/** The content of the header cell, in place of the label text. */
|
|
50
|
+
header: [GridHeaderBlock];
|
|
51
|
+
/** Content after the label in the header cell: a menu button, for example. */
|
|
52
|
+
headerEnd: [GridHeaderBlock];
|
|
53
|
+
/**
|
|
54
|
+
* The editor of a cell, in place of the editor of `@editing`. Put `id` on its focusable
|
|
55
|
+
* element, and call `onChange` with each new value. The grid needs `@editing`.
|
|
56
|
+
*/
|
|
57
|
+
editor: [GridEditorBlock];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export interface LatticeColumnGroupSignature<T = unknown> {
|
|
61
|
+
Args: {
|
|
62
|
+
id: string;
|
|
63
|
+
label: string;
|
|
64
|
+
};
|
|
65
|
+
Blocks: {
|
|
66
|
+
default: [GridColumns<T>];
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface LatticeBuiltInColumnSignature {
|
|
70
|
+
Args: {
|
|
71
|
+
label?: string;
|
|
72
|
+
size?: number;
|
|
73
|
+
/** Pins the column at the start or the end, at the first render (`columnPinning`). */
|
|
74
|
+
pinned?: 'start' | 'end';
|
|
75
|
+
/** Hides the column at the first render (`columnVisibility`). */
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** The declarations that the grid yields. */
|
|
80
|
+
export interface GridColumns<T = unknown> {
|
|
81
|
+
/** One column. */
|
|
82
|
+
Column: ComponentLike<LatticeColumnSignature<T>>;
|
|
83
|
+
/** A header over the columns in its block. */
|
|
84
|
+
ColumnGroup: ComponentLike<LatticeColumnGroupSignature<T>>;
|
|
85
|
+
/** The row selection column (`selectionColumn()`). The grid needs the row selection feature. */
|
|
86
|
+
SelectionColumn: ComponentLike<LatticeBuiltInColumnSignature>;
|
|
87
|
+
/** The row number column (`rowNumberColumn()`). */
|
|
88
|
+
RowNumberColumn: ComponentLike<LatticeBuiltInColumnSignature>;
|
|
89
|
+
}
|
|
90
|
+
interface Registers {
|
|
91
|
+
registry: ColumnRegistry<Declaration>;
|
|
92
|
+
}
|
|
93
|
+
export declare class ColumnDeclaration extends Component<{
|
|
94
|
+
Args: TypedColumnArgs<never> & Registers;
|
|
95
|
+
Blocks: LatticeColumnSignature<never>['Blocks'];
|
|
96
|
+
}> implements Declaration {
|
|
97
|
+
readonly marker: Comment;
|
|
98
|
+
readonly children: null;
|
|
99
|
+
/** Plain fields: the template sets them before the grid reads `columnDef`. */
|
|
100
|
+
private blocks;
|
|
101
|
+
constructor(owner: Owner, args: TypedColumnArgs<never> & Registers);
|
|
102
|
+
willDestroy(): void;
|
|
103
|
+
get columnArgs(): LatticeColumnArgs;
|
|
104
|
+
/** The blocks are fixed for one invocation, so the first render sets them once. */
|
|
105
|
+
noteBlocks: (cell: boolean, header: boolean, headerEnd: boolean, editor: boolean) => void;
|
|
106
|
+
get columnDef(): GridColumnDef;
|
|
107
|
+
}
|
|
108
|
+
export declare class ColumnGroupDeclaration extends Component<{
|
|
109
|
+
Args: LatticeColumnGroupSignature['Args'] & Registers & {
|
|
110
|
+
locale: LatticeLocale | undefined;
|
|
111
|
+
};
|
|
112
|
+
Blocks: LatticeColumnGroupSignature<never>['Blocks'];
|
|
113
|
+
}> implements Declaration {
|
|
114
|
+
readonly marker: Comment;
|
|
115
|
+
readonly children: ColumnRegistry<Declaration>;
|
|
116
|
+
readonly columnArgs: null;
|
|
117
|
+
constructor(owner: Owner, args: LatticeColumnGroupSignature['Args'] & Registers & {
|
|
118
|
+
locale: LatticeLocale | undefined;
|
|
119
|
+
});
|
|
120
|
+
willDestroy(): void;
|
|
121
|
+
get columnDef(): GridColumnDef;
|
|
122
|
+
}
|
|
123
|
+
type BuiltInArgs = LatticeBuiltInColumnSignature['Args'] & Registers & {
|
|
124
|
+
locale: LatticeLocale | undefined;
|
|
125
|
+
};
|
|
126
|
+
declare class BuiltInDeclaration extends Component<{
|
|
127
|
+
Args: BuiltInArgs;
|
|
128
|
+
}> implements Declaration {
|
|
129
|
+
readonly marker: Comment;
|
|
130
|
+
readonly children: null;
|
|
131
|
+
/** The args for the initial state: `@pinned` and `@hidden`. */
|
|
132
|
+
get columnArgs(): LatticeColumnArgs;
|
|
133
|
+
constructor(owner: Owner, args: BuiltInArgs);
|
|
134
|
+
willDestroy(): void;
|
|
135
|
+
get options(): {
|
|
136
|
+
header: string | undefined;
|
|
137
|
+
size: number | undefined;
|
|
138
|
+
locale: LatticeLocale;
|
|
139
|
+
};
|
|
140
|
+
get columnDef(): GridColumnDef;
|
|
141
|
+
}
|
|
142
|
+
export declare class SelectionColumnDeclaration extends BuiltInDeclaration {
|
|
143
|
+
get columnDef(): GridColumnDef;
|
|
144
|
+
}
|
|
145
|
+
export declare class RowNumberColumnDeclaration extends BuiltInDeclaration {
|
|
146
|
+
get columnDef(): GridColumnDef;
|
|
147
|
+
}
|
|
148
|
+
/** The declarations of declare mode, curried with a registry. */
|
|
149
|
+
export type DeclareColumns = {
|
|
150
|
+
Column: WithBoundArgs<typeof ColumnDeclaration, 'registry'>;
|
|
151
|
+
ColumnGroup: WithBoundArgs<typeof ColumnGroupDeclaration, 'registry' | 'locale'>;
|
|
152
|
+
SelectionColumn: WithBoundArgs<typeof SelectionColumnDeclaration, 'registry' | 'locale'>;
|
|
153
|
+
RowNumberColumn: WithBoundArgs<typeof RowNumberColumnDeclaration, 'registry' | 'locale'>;
|
|
154
|
+
};
|
|
155
|
+
/** Yields the declarations of declare mode. */
|
|
156
|
+
export declare const DeclareMode: TOC<{
|
|
157
|
+
Args: {
|
|
158
|
+
registry: ColumnRegistry<Declaration>;
|
|
159
|
+
locale: LatticeLocale | undefined;
|
|
160
|
+
};
|
|
161
|
+
Blocks: {
|
|
162
|
+
default: [DeclareColumns];
|
|
163
|
+
};
|
|
164
|
+
}>;
|
|
165
|
+
/** A cell of a column with a `<:cell>` block: the block renders into `anchor`. */
|
|
166
|
+
export interface BlockCell {
|
|
167
|
+
key: string;
|
|
168
|
+
anchor: HTMLElement;
|
|
169
|
+
row: GridRow;
|
|
170
|
+
column: GridColumn;
|
|
171
|
+
}
|
|
172
|
+
/** What portal mode reads from the grid. */
|
|
173
|
+
export interface BlockHost {
|
|
174
|
+
blockCellsOf(id: string): ReadonlyArray<BlockCell>;
|
|
175
|
+
valueFor(row: GridRow, column: GridColumn): unknown;
|
|
176
|
+
textFor(row: GridRow, column: GridColumn): string;
|
|
177
|
+
stateFor(rowId: string, column: GridColumn): CellState;
|
|
178
|
+
cellFor(row: GridRow, column: GridColumn): GridCell;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Yields the declarations of portal mode: each column with a `<:cell>` block renders the block
|
|
182
|
+
* into the anchor of each of its rendered cells.
|
|
183
|
+
*/
|
|
184
|
+
export declare const PortalMode: TOC<{
|
|
185
|
+
Args: {
|
|
186
|
+
host: BlockHost;
|
|
187
|
+
};
|
|
188
|
+
Blocks: {
|
|
189
|
+
default: [GridColumns<never>];
|
|
190
|
+
};
|
|
191
|
+
}>;
|
|
192
|
+
type Part = 'header' | 'headerEnd' | 'editor';
|
|
193
|
+
type PartBlock = GridHeaderBlock | GridEditorBlock;
|
|
194
|
+
/**
|
|
195
|
+
* Yields the declarations of part mode: only the column `@target` renders its `@part` block, the
|
|
196
|
+
* header, the header end or the editor.
|
|
197
|
+
*/
|
|
198
|
+
export declare const PartMode: TOC<{
|
|
199
|
+
Args: {
|
|
200
|
+
target: string;
|
|
201
|
+
part: Part;
|
|
202
|
+
ctx: PartBlock;
|
|
203
|
+
};
|
|
204
|
+
Blocks: {
|
|
205
|
+
default: [GridColumns<never>];
|
|
206
|
+
};
|
|
207
|
+
}>;
|
|
208
|
+
/** The column defs of a registry, and the args of its columns, in template order. */
|
|
209
|
+
export declare function declaredColumns(registry: ColumnRegistry<Declaration>): GridColumnDef[];
|
|
210
|
+
export declare function declaredArgs(registry: ColumnRegistry<Declaration>): LatticeColumnArgs[];
|
|
211
|
+
export {};
|
|
212
|
+
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../../src/grid/columns/declarations.gts"],"names":[],"mappings":"AAicA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAG1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE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,EAAE,cAAc,CAAC,WAAW,CAAC,mBAEpE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG,iBAAiB,EAAE,CAIvF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** A value that the first read makes. */
|
|
2
|
+
export declare class Once<T> {
|
|
3
|
+
#private;
|
|
4
|
+
get(make: () => T): T;
|
|
5
|
+
}
|
|
6
|
+
/** The same value while the key is the same: the memos of the table then hold. */
|
|
7
|
+
export declare class SameForKey<T> {
|
|
8
|
+
#private;
|
|
9
|
+
get(key: string, value: T): T;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The value that `make` gives for a key. A new key makes the value again. `release` gets the old
|
|
13
|
+
* value when a new key replaces it, and at `clear`.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ForRef<K, T> {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(release?: (value: T) => void);
|
|
18
|
+
get(key: K, make: () => T): T;
|
|
19
|
+
/** Releases the value, if there is one. The next `get` makes a new value. */
|
|
20
|
+
clear(): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The anchor elements of the `<:cell>` blocks, by key. The block content of a cell renders into
|
|
24
|
+
* its anchor. An anchor has no box: the content is the content of the cell.
|
|
25
|
+
*/
|
|
26
|
+
export declare class Anchors {
|
|
27
|
+
#private;
|
|
28
|
+
get(key: string): HTMLElement;
|
|
29
|
+
/** Keeps only the anchors of these keys. */
|
|
30
|
+
keep(keys: ReadonlySet<string>): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=memo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../../src/grid/columns/memo.ts"],"names":[],"mappings":"AAGA,yCAAyC;AACzC,qBAAa,IAAI,CAAC,CAAC;;IAIjB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC;CAOtB;AAED,kFAAkF;AAClF,qBAAa,UAAU,CAAC,CAAC;;IAIvB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;CAO9B;AAED;;;GAGG;AACH,qBAAa,MAAM,CAAC,CAAC,EAAE,CAAC;;gBAMV,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI;IAIxC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC;IAU7B,6EAA6E;IAC7E,KAAK,IAAI,IAAI;CAMd;AAED;;;GAGG;AACH,qBAAa,OAAO;;IAGlB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAW7B,4CAA4C;IAC5C,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI;CAGtC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { GridTable } from '../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The features of a template-form grid with no `@features` (DEC-4 of the template form PRD):
|
|
4
|
+
* sizing, resizing, sorting, visibility, ordering, pinning and row selection. `@features` adds
|
|
5
|
+
* more, for example grouping or filtering, with their row models.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_GRID_FEATURES: {
|
|
8
|
+
coreReactivityFeature: import("@ember-lattice/core").TableReactivityBindings;
|
|
9
|
+
columnOrderingFeature: import("@ember-lattice/core").TableFeature;
|
|
10
|
+
columnPinningFeature: import("@ember-lattice/core").TableFeature;
|
|
11
|
+
columnResizingFeature: import("@ember-lattice/core").TableFeature;
|
|
12
|
+
columnSizingFeature: import("@ember-lattice/core").TableFeature;
|
|
13
|
+
columnVisibilityFeature: import("@ember-lattice/core").TableFeature;
|
|
14
|
+
rowSelectionFeature: import("@ember-lattice/core").TableFeature;
|
|
15
|
+
rowSortingFeature: import("@ember-lattice/core").TableFeature;
|
|
16
|
+
sortedRowModel: (table: import("@ember-lattice/core").Table<import("@ember-lattice/core").TableFeatures, object>) => () => import("@ember-lattice/core").RowModel<import("@ember-lattice/core").TableFeatures, object>;
|
|
17
|
+
sortFns: {
|
|
18
|
+
alphanumeric: import("@ember-lattice/core").CreatedSortFn<import("@ember-lattice/core").TableFeatures, object, string>;
|
|
19
|
+
alphanumericCaseSensitive: import("@ember-lattice/core").CreatedSortFn<import("@ember-lattice/core").TableFeatures, object, string>;
|
|
20
|
+
basic: import("@ember-lattice/core").CreatedSortFn<import("@ember-lattice/core").TableFeatures, object, unknown>;
|
|
21
|
+
datetime: import("@ember-lattice/core").CreatedSortFn<import("@ember-lattice/core").TableFeatures, object, unknown>;
|
|
22
|
+
text: import("@ember-lattice/core").CreatedSortFn<import("@ember-lattice/core").TableFeatures, object, string>;
|
|
23
|
+
textCaseSensitive: import("@ember-lattice/core").CreatedSortFn<import("@ember-lattice/core").TableFeatures, object, string>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** The table state, by slice. */
|
|
27
|
+
export type GridState = Record<string, unknown>;
|
|
28
|
+
export interface OwnedTableSource {
|
|
29
|
+
data(): ReadonlyArray<unknown>;
|
|
30
|
+
columns(): ReadonlyArray<object>;
|
|
31
|
+
state(): GridState | undefined;
|
|
32
|
+
features: Record<string, unknown> | undefined;
|
|
33
|
+
/** More table options, for a feature that has no arg (`@tableOptions`). */
|
|
34
|
+
options: Record<string, unknown> | undefined;
|
|
35
|
+
initialState: GridState;
|
|
36
|
+
getRowId: ((data: never, index: number) => string) | undefined;
|
|
37
|
+
onStateChange(): ((state: GridState) => void) | undefined;
|
|
38
|
+
}
|
|
39
|
+
export declare function makeOwnedTable(source: OwnedTableSource): GridTable;
|
|
40
|
+
//# sourceMappingURL=owned-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned-table.d.ts","sourceRoot":"","sources":["../../../src/grid/columns/owned-table.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;CAWjC,CAAA;AAED,iCAAiC;AACjC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;IAC9B,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IAChC,KAAK,IAAI,SAAS,GAAG,SAAS,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC7C,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC5C,YAAY,EAAE,SAAS,CAAA;IACvB,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;IAC9D,aAAa,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;CAC1D;AAkBD,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAwClE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A declaration in a registry: a comment node in the DOM gives its template order. */
|
|
2
|
+
export interface Registered {
|
|
3
|
+
readonly marker: Node;
|
|
4
|
+
}
|
|
5
|
+
export declare class ColumnRegistry<T extends Registered> {
|
|
6
|
+
#private;
|
|
7
|
+
private revision;
|
|
8
|
+
/** The declarations, in template order. */
|
|
9
|
+
get items(): readonly T[];
|
|
10
|
+
add(item: T): void;
|
|
11
|
+
remove(item: T): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/grid/columns/registry.ts"],"names":[],"mappings":"AAaA,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CACtB;AAeD,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU;;IAKrC,OAAO,CAAC,QAAQ,CAAI;IAE7B,2CAA2C;IAC3C,IAAI,KAAK,IAAI,SAAS,CAAC,EAAE,CAOxB;IAED,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAKlB,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;CAKtB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A cell position, as 1-based `aria-rowindex` and `aria-colindex`. */
|
|
2
|
+
export interface CellPosition {
|
|
3
|
+
row: number;
|
|
4
|
+
col: number;
|
|
5
|
+
}
|
|
6
|
+
export interface GridBounds {
|
|
7
|
+
/** The first row that the keys can go to: the leaf header row. */
|
|
8
|
+
firstRow: number;
|
|
9
|
+
/** The last row: the header rows plus the data rows. */
|
|
10
|
+
lastRow: number;
|
|
11
|
+
colCount: number;
|
|
12
|
+
/** The number of data rows in view, for PageUp and PageDown. */
|
|
13
|
+
pageRows: number;
|
|
14
|
+
rtl: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface Keys {
|
|
17
|
+
key: string;
|
|
18
|
+
ctrlKey: boolean;
|
|
19
|
+
metaKey: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** The next active cell for a key, or null when the key does not move the active cell. */
|
|
22
|
+
export declare function moveCell(event: Keys, from: CellPosition, bounds: GridBounds): CellPosition | null;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/grid/keyboard.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAA;IAChB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;CACb;AAED,UAAU,IAAI;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;CACjB;AAID,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI,CA6BjG"}
|