@getaster/elements 0.3.5 → 0.4.5
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/NOTICE +4 -0
- package/README.md +13 -4
- package/bin/aster-theme-check.js +35 -4
- package/dist/base/element.d.ts +8 -1
- package/dist/base/element.js +7 -2
- package/dist/button/button.d.ts +17 -2
- package/dist/button/button.js +42 -8
- package/dist/composition/builtins.d.ts +623 -1
- package/dist/composition/builtins.js +232 -4
- package/dist/date/calendar.d.ts +3 -0
- package/dist/date/calendar.js +8 -2
- package/dist/date/date-field.d.ts +23 -3
- package/dist/date/date-field.js +77 -9
- package/dist/date/dates.d.ts +10 -2
- package/dist/date/dates.js +23 -3
- package/dist/dialog/config.d.ts +4 -0
- package/dist/dialog/config.js +8 -0
- package/dist/dialog/dialog.d.ts +34 -6
- package/dist/dialog/dialog.js +151 -14
- package/dist/field/bound-field.d.ts +17 -1
- package/dist/field/bound-field.js +68 -7
- package/dist/field/check.js +1 -0
- package/dist/field/field.js +1 -1
- package/dist/field/input.d.ts +1 -0
- package/dist/field/input.js +2 -2
- package/dist/field/number-field.js +2 -2
- package/dist/filter/filter-builder.d.ts +7 -1
- package/dist/filter/filter-builder.js +8 -1
- package/dist/form/controls.d.ts +40 -8
- package/dist/form/controls.js +58 -15
- package/dist/form/custom-field.d.ts +1 -0
- package/dist/form/custom-field.js +23 -0
- package/dist/form/features.d.ts +27 -0
- package/dist/form/features.js +52 -0
- package/dist/form/form.d.ts +67 -7
- package/dist/form/form.js +267 -24
- package/dist/form/policy.d.ts +29 -0
- package/dist/form/policy.js +16 -0
- package/dist/grid/appearance.d.ts +365 -0
- package/dist/grid/appearance.js +814 -0
- package/dist/grid/features.d.ts +38 -0
- package/dist/grid/features.js +78 -0
- package/dist/grid/grid.d.ts +216 -4
- package/dist/grid/grid.js +1810 -308
- package/dist/grid/policy.d.ts +58 -0
- package/dist/grid/policy.js +17 -0
- package/dist/grid/view.d.ts +32 -2
- package/dist/grid/view.js +89 -4
- package/dist/index.d.ts +14 -11
- package/dist/index.js +2 -1
- package/dist/menu/config.d.ts +7 -0
- package/dist/menu/config.js +44 -0
- package/dist/menu/menu.d.ts +23 -0
- package/dist/menu/menu.js +69 -17
- package/dist/picker/picker.js +8 -3
- package/dist/section/accordion.d.ts +26 -0
- package/dist/section/accordion.js +86 -8
- package/dist/section/policy.d.ts +8 -0
- package/dist/section/policy.js +17 -0
- package/dist/section/section.d.ts +30 -0
- package/dist/section/section.js +106 -3
- package/dist/select/choice-element.d.ts +12 -0
- package/dist/select/choice-element.js +36 -0
- package/dist/select/choice.d.ts +12 -2
- package/dist/select/choice.js +93 -28
- package/dist/select/select.d.ts +12 -0
- package/dist/select/select.js +37 -1
- package/dist/styles/contract.d.ts +14 -0
- package/dist/styles/contract.js +15 -0
- package/dist/switch/switch.d.ts +16 -0
- package/dist/switch/switch.js +56 -6
- package/dist/tree/navigator.d.ts +3 -0
- package/dist/tree/navigator.js +26 -2
- package/dist/window/chrome.d.ts +5 -1
- package/dist/window/chrome.js +4 -3
- package/dist/window/config.d.ts +71 -0
- package/dist/window/config.js +40 -0
- package/dist/window/window.d.ts +51 -13
- package/dist/window/window.js +233 -38
- package/dist/yaml.d.ts +19 -0
- package/dist/yaml.js +57 -0
- package/package.json +10 -4
- package/styles/aster-ui.css +181 -10
- package/styles/base.css +14 -0
- package/styles/contract.ts +16 -0
- package/styles/elements.css +167 -10
- package/styles/fonts/OFL-bricolage-grotesque.txt +93 -0
- package/styles/fonts/OFL-fraunces.txt +93 -0
- package/styles/fonts/bricolage-grotesque-latin-opsz-normal.woff2 +0 -0
- package/styles/fonts/fraunces-latin-full-normal.woff2 +0 -0
- package/styles/fonts.css +17 -0
- package/styles/theme-harbour.css +5 -0
- package/styles/theme-lamplight.css +5 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a permitted capability behaves. A descriptor says how, never whether:
|
|
3
|
+
* switching a capability off is [[object:GridPolicy]]'s job, and whether it
|
|
4
|
+
* is shown is chrome's. Plain data, so a composition catalog can carry it.
|
|
5
|
+
*/
|
|
6
|
+
export type GridFeature = {
|
|
7
|
+
readonly kind: "sort";
|
|
8
|
+
readonly multi?: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "edit";
|
|
11
|
+
readonly mode?: "row" | "cell";
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "select";
|
|
14
|
+
readonly appearance?: "row" | "cell";
|
|
15
|
+
readonly column?: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "page";
|
|
18
|
+
};
|
|
19
|
+
/** One descriptor of `kind`, if the page gave one. */
|
|
20
|
+
export declare function feature<K extends GridFeature["kind"]>(features: readonly GridFeature[] | undefined, kind: K): Extract<GridFeature, {
|
|
21
|
+
kind: K;
|
|
22
|
+
}> | undefined;
|
|
23
|
+
/** The features with `next` replacing the first descriptor of its kind, or appended. */
|
|
24
|
+
export declare function withFeature(features: readonly GridFeature[] | undefined, next: GridFeature): GridFeature[];
|
|
25
|
+
/** The features without the descriptor of `kind`. */
|
|
26
|
+
export declare function withoutFeature(features: readonly GridFeature[] | undefined, kind: GridFeature["kind"]): GridFeature[];
|
|
27
|
+
/** Whether the grid loads a page at a time instead of scrolling through the whole set. */
|
|
28
|
+
export declare function paged(features: readonly GridFeature[] | undefined): boolean;
|
|
29
|
+
/** The sort descriptor's multi-key setting, on by default. */
|
|
30
|
+
export declare function multiSort(features: readonly GridFeature[] | undefined): boolean;
|
|
31
|
+
/** The edit descriptor's mode, row editing by default. */
|
|
32
|
+
export declare function editMode(features: readonly GridFeature[] | undefined): "row" | "cell";
|
|
33
|
+
/** How selected records are highlighted, the whole row by default. */
|
|
34
|
+
export declare function selectionAppearance(features: readonly GridFeature[] | undefined): "row" | "cell";
|
|
35
|
+
/** Whether selection gets a checkbox column of its own, off by default. */
|
|
36
|
+
export declare function selectionColumn(features: readonly GridFeature[] | undefined): boolean;
|
|
37
|
+
/** Checks a features value: known kinds, plain fields and valid unions. */
|
|
38
|
+
export declare function validateFeatures(value: unknown): asserts value is readonly GridFeature[];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** One descriptor of `kind`, if the page gave one. */
|
|
2
|
+
export function feature(features, kind) {
|
|
3
|
+
return features?.find((entry) => entry.kind === kind);
|
|
4
|
+
}
|
|
5
|
+
/** The features with `next` replacing the first descriptor of its kind, or appended. */
|
|
6
|
+
export function withFeature(features, next) {
|
|
7
|
+
const list = [...(features ?? [])];
|
|
8
|
+
const at = list.findIndex((entry) => entry.kind === next.kind);
|
|
9
|
+
if (at < 0)
|
|
10
|
+
list.push(next);
|
|
11
|
+
else
|
|
12
|
+
list[at] = next;
|
|
13
|
+
return list;
|
|
14
|
+
}
|
|
15
|
+
/** The features without the descriptor of `kind`. */
|
|
16
|
+
export function withoutFeature(features, kind) {
|
|
17
|
+
return (features ?? []).filter((entry) => entry.kind !== kind);
|
|
18
|
+
}
|
|
19
|
+
/** Whether the grid loads a page at a time instead of scrolling through the whole set. */
|
|
20
|
+
export function paged(features) {
|
|
21
|
+
return feature(features, "page") !== undefined;
|
|
22
|
+
}
|
|
23
|
+
/** The sort descriptor's multi-key setting, on by default. */
|
|
24
|
+
export function multiSort(features) {
|
|
25
|
+
return feature(features, "sort")?.multi ?? true;
|
|
26
|
+
}
|
|
27
|
+
/** The edit descriptor's mode, row editing by default. */
|
|
28
|
+
export function editMode(features) {
|
|
29
|
+
return feature(features, "edit")?.mode ?? "row";
|
|
30
|
+
}
|
|
31
|
+
/** How selected records are highlighted, the whole row by default. */
|
|
32
|
+
export function selectionAppearance(features) {
|
|
33
|
+
return feature(features, "select")?.appearance ?? "row";
|
|
34
|
+
}
|
|
35
|
+
/** Whether selection gets a checkbox column of its own, off by default. */
|
|
36
|
+
export function selectionColumn(features) {
|
|
37
|
+
return feature(features, "select")?.column ?? false;
|
|
38
|
+
}
|
|
39
|
+
/** Checks a features value: known kinds, plain fields and valid unions. */
|
|
40
|
+
export function validateFeatures(value) {
|
|
41
|
+
if (!Array.isArray(value))
|
|
42
|
+
throw new TypeError("features must be an array");
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
for (const entry of value) {
|
|
45
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
46
|
+
throw new TypeError("each feature must be a plain object");
|
|
47
|
+
const kind = entry.kind;
|
|
48
|
+
if (kind !== "sort" && kind !== "edit" && kind !== "select" && kind !== "page")
|
|
49
|
+
throw new TypeError(`unknown feature kind: ${String(kind)}`);
|
|
50
|
+
if (seen.has(kind))
|
|
51
|
+
throw new TypeError(`feature "${kind}" appears more than once`);
|
|
52
|
+
seen.add(kind);
|
|
53
|
+
switch (kind) {
|
|
54
|
+
case "sort": {
|
|
55
|
+
const multi = entry.multi;
|
|
56
|
+
if (multi !== undefined && typeof multi !== "boolean")
|
|
57
|
+
throw new TypeError("sort.multi must be a boolean");
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case "edit": {
|
|
61
|
+
const mode = entry.mode;
|
|
62
|
+
if (mode !== undefined && mode !== "row" && mode !== "cell")
|
|
63
|
+
throw new TypeError('edit.mode must be "row" or "cell"');
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "select": {
|
|
67
|
+
const { appearance, column } = entry;
|
|
68
|
+
if (appearance !== undefined && appearance !== "row" && appearance !== "cell")
|
|
69
|
+
throw new TypeError('select.appearance must be "row" or "cell"');
|
|
70
|
+
if (column !== undefined && typeof column !== "boolean")
|
|
71
|
+
throw new TypeError("select.column must be a boolean");
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case "page":
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
package/dist/grid/grid.d.ts
CHANGED
|
@@ -8,10 +8,16 @@ import "../select/choice-element.ts";
|
|
|
8
8
|
import "../filter/filter-builder.ts";
|
|
9
9
|
import "../dialog/dialog.ts";
|
|
10
10
|
import { type GridView } from "./view.ts";
|
|
11
|
+
import { type Capability, type CapabilityValue, type GridPolicy } from "./policy.ts";
|
|
12
|
+
import { type GridLabels, type GridPresentation } from "./appearance.ts";
|
|
13
|
+
import { type GridFeature } from "./features.ts";
|
|
14
|
+
export type { GridFeature } from "./features.ts";
|
|
11
15
|
/** Renders a cell's content; `entity` is the row's record. */
|
|
12
16
|
export type CellRenderer = (entity: Entity, key: KeyText) => View;
|
|
13
17
|
/** Text presentation of a typed value. Queries and exports retain the underlying value. */
|
|
14
18
|
export type CellFormatter = (value: Value | undefined, entity: Entity, field: Field | undefined) => string;
|
|
19
|
+
/** Where a non-focus scroll puts the requested row or cell. */
|
|
20
|
+
export type GridScrollAlign = "start" | "center" | "end" | "nearest";
|
|
15
21
|
/** How a column shows a foreign key: the related set and the field to show. */
|
|
16
22
|
export interface Lookup {
|
|
17
23
|
readonly set: string;
|
|
@@ -31,6 +37,38 @@ export interface GridCsvOptions extends Omit<CsvOptions, "keys"> {
|
|
|
31
37
|
/** All filtered results by default, or shared selection in pick order. */
|
|
32
38
|
readonly scope?: "query" | "selection";
|
|
33
39
|
}
|
|
40
|
+
/** Which grid chrome is shown. Every option preserves today's full grid by default. */
|
|
41
|
+
export interface GridChrome {
|
|
42
|
+
/** The toolbar above the table. Default `true`; hide it with `showToolbar`. */
|
|
43
|
+
readonly toolbar?: boolean;
|
|
44
|
+
/** The column header row. Default `true`. When hidden it stays in the accessibility tree. */
|
|
45
|
+
readonly header?: boolean;
|
|
46
|
+
/** The filter row: `"auto"` (default) follows the view and the Filters button; `true` forces it open; `false` removes it. */
|
|
47
|
+
readonly filterRow?: "auto" | boolean;
|
|
48
|
+
/** The per-header menu button. Default `true`; `false` removes it and the header's keyboard menu. */
|
|
49
|
+
readonly headerMenu?: boolean;
|
|
50
|
+
/** The paging bar. Default `true`; shown only when a `page` feature is configured. */
|
|
51
|
+
readonly pagingBar?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** Which controls the toolbar shows. Every option defaults to `true`. */
|
|
54
|
+
export interface GridToolbar {
|
|
55
|
+
/** The row count. Default `true`. */
|
|
56
|
+
readonly count?: boolean;
|
|
57
|
+
/** The Sort panel button. Default `true`. */
|
|
58
|
+
readonly sort?: boolean;
|
|
59
|
+
/** The filter-row toggle. Default `true`; hidden when `chrome.filterRow` is false. */
|
|
60
|
+
readonly filters?: boolean;
|
|
61
|
+
/** The advanced filter button. Default `true`. */
|
|
62
|
+
readonly advanced?: boolean;
|
|
63
|
+
/** The Columns panel button. Default `true`. */
|
|
64
|
+
readonly columns?: boolean;
|
|
65
|
+
/** The Views panel button, when `persist` is set. Default `true`. */
|
|
66
|
+
readonly views?: boolean;
|
|
67
|
+
/** Expand all / Collapse all in a tree grid. Default `true`. */
|
|
68
|
+
readonly expandAll?: boolean;
|
|
69
|
+
/** A host view placed at the end of the toolbar, after the built-in controls. */
|
|
70
|
+
readonly extra?: View;
|
|
71
|
+
}
|
|
34
72
|
/** A row as row controls and expansion content see it; read inside a render, it updates them. */
|
|
35
73
|
export interface RowState {
|
|
36
74
|
readonly key: KeyText;
|
|
@@ -77,6 +115,26 @@ export interface GridTree {
|
|
|
77
115
|
readonly filterMode?: FilterMode;
|
|
78
116
|
/** Rows can be dragged onto another row to move under it, or onto the header to the top level; a touch or pen holds a row still to lift it. */
|
|
79
117
|
readonly draggable?: boolean;
|
|
118
|
+
/** Whether a drop may change a row's parent. Default `true`; `false` leaves only a no-op drop. */
|
|
119
|
+
readonly reparent?: boolean;
|
|
120
|
+
/** Whether a row may be dropped on a leaf. Default `true`; `false` accepts folders and the top level. */
|
|
121
|
+
readonly dropOnLeaves?: boolean;
|
|
122
|
+
/** Levels opened when the tree first loads, below the top level. Default `0`; bounded by `openLimit`. */
|
|
123
|
+
readonly autoOpen?: number;
|
|
124
|
+
/** Openers in the first column. Default `true`. */
|
|
125
|
+
readonly showOpener?: boolean;
|
|
126
|
+
/** A template before a folder's title, when it has children. */
|
|
127
|
+
readonly folderIcon?: View;
|
|
128
|
+
/** A template before a leaf's title. */
|
|
129
|
+
readonly nodeIcon?: View;
|
|
130
|
+
/** Selecting a row applies to its loaded descendants too. Needs a multiple shared Selection. Default `false`. */
|
|
131
|
+
readonly cascadeSelection?: boolean;
|
|
132
|
+
/** Rows per level load. Default the data core's 100. */
|
|
133
|
+
readonly pageSize?: number;
|
|
134
|
+
/** Matches beyond this make keep-ancestors give up. Default the data core's 8000. */
|
|
135
|
+
readonly matchLimit?: number;
|
|
136
|
+
/** Folders opened at most to show where matches are; also bounds Expand all. Default 200. */
|
|
137
|
+
readonly openLimit?: number;
|
|
80
138
|
}
|
|
81
139
|
/**
|
|
82
140
|
* A virtualized grid over an entity set, shaped by a view the person can
|
|
@@ -120,6 +178,21 @@ export declare class Grid extends AsterElement {
|
|
|
120
178
|
/** Text-only display formatting by field; never changes server sorting or filtering. */
|
|
121
179
|
get formatters(): Readonly<Record<string, CellFormatter>>;
|
|
122
180
|
set formatters(value: Readonly<Record<string, CellFormatter>>);
|
|
181
|
+
/**
|
|
182
|
+
* Declarative presentation: per-column titles, alignment, value maps and
|
|
183
|
+
* formats, row and cell classes, and hilites. Default `{}`, which keeps
|
|
184
|
+
* today's rendering. Renderers and formatters (JavaScript) outrank these
|
|
185
|
+
* plain-data display overrides for cell content.
|
|
186
|
+
*/
|
|
187
|
+
get presentation(): GridPresentation;
|
|
188
|
+
set presentation(value: GridPresentation);
|
|
189
|
+
/**
|
|
190
|
+
* The grid's overridable strings. Every entry is optional; a missing entry
|
|
191
|
+
* keeps today's text, and `{name}` placeholders are filled by the grid.
|
|
192
|
+
* A stopgap before full i18n, not an i18n engine.
|
|
193
|
+
*/
|
|
194
|
+
get labels(): GridLabels;
|
|
195
|
+
set labels(value: GridLabels);
|
|
123
196
|
/** Exact overall totals and, when grouped, totals on each group header. */
|
|
124
197
|
get summaries(): readonly GridSummary[];
|
|
125
198
|
set summaries(value: readonly GridSummary[]);
|
|
@@ -131,6 +204,19 @@ export declare class Grid extends AsterElement {
|
|
|
131
204
|
/** The page's actions for a row, shown first in its menu (right-click, Shift+F10, the Menu key). */
|
|
132
205
|
get rowMenu(): (entity: Entity, key: KeyText) => readonly MenuItem[];
|
|
133
206
|
set rowMenu(v: (entity: Entity, key: KeyText) => readonly MenuItem[]);
|
|
207
|
+
/**
|
|
208
|
+
* The page's actions for a column, shown first in its menu. Read each time
|
|
209
|
+
* a menu opens. Default: no items.
|
|
210
|
+
*/
|
|
211
|
+
get columnMenu(): (field: string) => readonly MenuItem[];
|
|
212
|
+
set columnMenu(v: (field: string) => readonly MenuItem[]);
|
|
213
|
+
/**
|
|
214
|
+
* Per-field operator allowlists for filtering, by column field. Each entry
|
|
215
|
+
* narrows the operators the metadata offers; it can never add one. Default
|
|
216
|
+
* `{}`: the metadata's operators.
|
|
217
|
+
*/
|
|
218
|
+
get filterOperators(): Readonly<Record<string, readonly string[]>>;
|
|
219
|
+
set filterOperators(v: Readonly<Record<string, readonly string[]>>);
|
|
134
220
|
/**
|
|
135
221
|
* A tree grid: the first column shows each record's level with an opener;
|
|
136
222
|
* levels load as they open; a filter keeps the path to each match. Set it
|
|
@@ -170,9 +256,60 @@ export declare class Grid extends AsterElement {
|
|
|
170
256
|
* scrolls it to the top. Resolves to whether the record is in the tree.
|
|
171
257
|
*/
|
|
172
258
|
reveal(key: KeyText): Promise<boolean>;
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
|
|
259
|
+
/**
|
|
260
|
+
* What the page allows, by capability and field. Policy can only restrict:
|
|
261
|
+
* schema and structure refuse first, and a page rule's read-only reason
|
|
262
|
+
* outranks a policy reason. It is host configuration, never part of the
|
|
263
|
+
* saved [[object:GridView]].
|
|
264
|
+
*/
|
|
265
|
+
get policy(): GridPolicy;
|
|
266
|
+
set policy(value: GridPolicy);
|
|
267
|
+
/** Sugar for `policy.sortable`: no sorting, an allowlist, or a predicate. */
|
|
268
|
+
get sortable(): CapabilityValue | undefined;
|
|
269
|
+
set sortable(value: Capability | undefined);
|
|
270
|
+
/** Sugar for `policy.filterable`: no filtering, an allowlist, or a predicate. */
|
|
271
|
+
get filterable(): CapabilityValue | undefined;
|
|
272
|
+
set filterable(value: Capability | undefined);
|
|
273
|
+
/** Sugar for `policy.groupable`: no grouping, an allowlist, or a predicate. */
|
|
274
|
+
get groupable(): CapabilityValue | undefined;
|
|
275
|
+
set groupable(value: Capability | undefined);
|
|
276
|
+
/** Sugar for `policy.resizable`: no column resizing, an allowlist, or a predicate. */
|
|
277
|
+
get resizable(): CapabilityValue | undefined;
|
|
278
|
+
set resizable(value: Capability | undefined);
|
|
279
|
+
/** Sugar for `policy.movable`: no column moving, an allowlist, or a predicate. */
|
|
280
|
+
get movable(): CapabilityValue | undefined;
|
|
281
|
+
set movable(value: Capability | undefined);
|
|
282
|
+
/** Sugar for `policy.hideable`: no column hiding, an allowlist, or a predicate. */
|
|
283
|
+
get hideable(): CapabilityValue | undefined;
|
|
284
|
+
set hideable(value: Capability | undefined);
|
|
285
|
+
/** Sugar for `policy.freezable`: no column freezing, an allowlist, or a predicate. */
|
|
286
|
+
get freezable(): CapabilityValue | undefined;
|
|
287
|
+
set freezable(value: Capability | undefined);
|
|
288
|
+
/** Sugar for `policy.editable`: no editing, an allowlist, or a predicate. */
|
|
289
|
+
get editable(): CapabilityValue;
|
|
290
|
+
set editable(value: Capability);
|
|
291
|
+
/**
|
|
292
|
+
* How permitted capabilities behave, as [[type:GridFeature]] descriptors.
|
|
293
|
+
* The structured form is the contract; the matching properties are sugar.
|
|
294
|
+
* Default `[]`, which keeps today's grid.
|
|
295
|
+
*/
|
|
296
|
+
get features(): readonly GridFeature[];
|
|
297
|
+
set features(value: readonly GridFeature[]);
|
|
298
|
+
/**
|
|
299
|
+
* Sugar for a `sort` feature's `multi`: whether Shift adds another sort key.
|
|
300
|
+
* `false` makes every sort action replace the sort. Default `true`.
|
|
301
|
+
*/
|
|
302
|
+
get multiSort(): boolean;
|
|
303
|
+
set multiSort(value: boolean);
|
|
304
|
+
/** Sugar for an `edit` feature's `mode`: a whole row (`"row"`, the default) or one cell (`"cell"`). */
|
|
305
|
+
get editMode(): "row" | "cell";
|
|
306
|
+
set editMode(value: "row" | "cell");
|
|
307
|
+
/** Sugar for a `select` feature's `appearance`: how a selected record is highlighted. */
|
|
308
|
+
get selectionAppearance(): "row" | "cell";
|
|
309
|
+
set selectionAppearance(value: "row" | "cell");
|
|
310
|
+
/** Sugar for a `select` feature's `column`: whether selection gets a checkbox column. */
|
|
311
|
+
get selectionColumn(): boolean;
|
|
312
|
+
set selectionColumn(value: boolean);
|
|
176
313
|
/**
|
|
177
314
|
* Page rules for the cells of a row being edited. Each row has a child
|
|
178
315
|
* scope where it's published as `row`, so a rule reads its own record.
|
|
@@ -184,11 +321,75 @@ export declare class Grid extends AsterElement {
|
|
|
184
321
|
/** Shown when the query matches nothing. */
|
|
185
322
|
get empty(): View;
|
|
186
323
|
set empty(v: View);
|
|
324
|
+
/**
|
|
325
|
+
* Shown in the content area while the first page loads. Default: the
|
|
326
|
+
* built-in presentation with [[attr:Grid.loadingMessage]].
|
|
327
|
+
*/
|
|
328
|
+
get loading(): View;
|
|
329
|
+
set loading(v: View);
|
|
330
|
+
/** The built-in loading presentation's text. Default `"Loading…"`. */
|
|
331
|
+
get loadingMessage(): string;
|
|
332
|
+
set loadingMessage(v: string);
|
|
333
|
+
/**
|
|
334
|
+
* The root collection failure, as a template: the page says what happened
|
|
335
|
+
* and offers `retry`, which calls [[method:Grid.refresh]]. Default: a
|
|
336
|
+
* "Couldn’t load rows." message with a Retry button.
|
|
337
|
+
*/
|
|
338
|
+
get error(): ((error: unknown, retry: () => void) => View) | undefined;
|
|
339
|
+
set error(v: ((error: unknown, retry: () => void) => View) | undefined);
|
|
340
|
+
/**
|
|
341
|
+
* Load on connect (the default) or wait for [[method:Grid.refresh]] or the
|
|
342
|
+
* first interaction with the grid. Default `true`.
|
|
343
|
+
*/
|
|
344
|
+
get autoFetch(): boolean;
|
|
345
|
+
set autoFetch(v: boolean);
|
|
346
|
+
/**
|
|
347
|
+
* Rows per load, in either loading mode. Default `100`. In paged mode it is
|
|
348
|
+
* also the number of rows shown at once.
|
|
349
|
+
*/
|
|
350
|
+
get pageSize(): number;
|
|
351
|
+
set pageSize(v: number);
|
|
352
|
+
/** Loaded pages kept while scrolling; the data core's default (20) when unset. */
|
|
353
|
+
get keepPages(): number | undefined;
|
|
354
|
+
set keepPages(v: number | undefined);
|
|
355
|
+
/** Ask the server for an exact total where it would estimate or omit one. Default `false`. */
|
|
356
|
+
get exactCount(): boolean;
|
|
357
|
+
set exactCount(v: boolean);
|
|
358
|
+
/**
|
|
359
|
+
* Reloads the rows the grid shows, keeping them visible until the answer
|
|
360
|
+
* arrives. Rejects when the load fails; the error view or `collection.error`
|
|
361
|
+
* reports it. With `autoFetch` false it also starts the first load.
|
|
362
|
+
*/
|
|
363
|
+
refresh(): Promise<void>;
|
|
364
|
+
/** Which chrome the grid shows. Default `{}`: the full toolbar, header, automatic filter row and paging bar. */
|
|
365
|
+
get chrome(): GridChrome;
|
|
366
|
+
set chrome(v: GridChrome);
|
|
367
|
+
/** The toolbar's controls. Default `{}`: every control shown. Object-only; use `showToolbar` to hide the toolbar. */
|
|
368
|
+
get toolbar(): GridToolbar;
|
|
369
|
+
set toolbar(v: GridToolbar);
|
|
370
|
+
/** Sugar for `chrome.header`. Default `true`; false hides the header visually but keeps it for assistive technology. */
|
|
371
|
+
get showHeader(): boolean;
|
|
372
|
+
set showHeader(v: boolean);
|
|
373
|
+
/** Sugar for `chrome.toolbar`. Default `true`. */
|
|
374
|
+
get showToolbar(): boolean;
|
|
375
|
+
set showToolbar(v: boolean);
|
|
376
|
+
/** Sugar for `chrome.filterRow`: false removes the row, true forces it open, "auto" (the default) follows the view. */
|
|
377
|
+
get showFilterRow(): boolean;
|
|
378
|
+
set showFilterRow(v: boolean);
|
|
379
|
+
/** Sugar for `chrome.headerMenu`. Default `true`. */
|
|
380
|
+
get showHeaderMenu(): boolean;
|
|
381
|
+
set showHeaderMenu(v: boolean);
|
|
382
|
+
/** Sugar for `chrome.pagingBar`. Default `true`. */
|
|
383
|
+
get showPagingBar(): boolean;
|
|
384
|
+
set showPagingBar(v: boolean);
|
|
187
385
|
get collection(): Collection | undefined;
|
|
188
386
|
set collection(v: Collection | undefined);
|
|
189
387
|
/** Shared selection; without collection, its collection supplies the binding. */
|
|
190
388
|
get selection(): Selection | undefined;
|
|
191
|
-
/**
|
|
389
|
+
/**
|
|
390
|
+
* Allows this view to change selection; borrowed selection state remains
|
|
391
|
+
* visible. Sugar for `policy.selectable`, default on.
|
|
392
|
+
*/
|
|
192
393
|
get selectable(): boolean;
|
|
193
394
|
set selectable(value: boolean);
|
|
194
395
|
set selection(v: Selection | undefined);
|
|
@@ -202,6 +403,17 @@ export declare class Grid extends AsterElement {
|
|
|
202
403
|
focusIndex(index: number, column?: number): Promise<boolean>;
|
|
203
404
|
/** Reveals a key currently loaded in the flat collection. */
|
|
204
405
|
focusKey(key: KeyText, column?: number): Promise<boolean>;
|
|
406
|
+
/**
|
|
407
|
+
* Scrolls a flat row into view without moving focus or the active cell.
|
|
408
|
+
* Loads its page if needed. False for grouped/tree grids or a bad position.
|
|
409
|
+
*/
|
|
410
|
+
scrollToRow(index: number, align?: GridScrollAlign): Promise<boolean>;
|
|
411
|
+
/**
|
|
412
|
+
* Scrolls a flat row and visible column into view without moving focus or
|
|
413
|
+
* the active cell. A frozen column needs no sideways scroll. False like
|
|
414
|
+
* [[method:Grid.scrollToRow]].
|
|
415
|
+
*/
|
|
416
|
+
scrollToCell(index: number, column: number, align?: GridScrollAlign): Promise<boolean>;
|
|
205
417
|
connectedCallback(): void;
|
|
206
418
|
focus(options?: FocusOptions): void;
|
|
207
419
|
protected render(): View;
|