@ember-lattice/editing 0.0.0-stage → 1.0.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 ADDED
@@ -0,0 +1,17 @@
1
+ # @ember-lattice/editing
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 7ce4af2: Lattice 1.0: one grid for every collection in Ember. Lists, feeds, tables, boards and
8
+ spreadsheets come from one headless engine, a port of TanStack Table. It has 80 of the 81
9
+ AG Grid features in the parity matrix; the external filter runs after grouping. The release has the client row models, the Lattice wire protocol with servers for Node,
10
+ Rails and Python, an IronCalc spreadsheet with live collaboration, themes, test harnesses, Jig
11
+ stories and Marquetry catalog entries.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [7ce4af2]
16
+ - @ember-lattice/core@1.0.0
17
+ - @ember-lattice/ember@1.0.0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joe Gaudet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,30 @@
1
+ Lattice
2
+ Copyright (c) 2026 Joe Gaudet. MIT licensed; see LICENSE.md.
3
+
4
+ Lattice ports code from two MIT-licensed TanStack projects into Ember-native code. Lattice does
5
+ not depend on either package. PORT_MAP.md names each ported file and its source.
6
+
7
+ TanStack Table (@tanstack/table-core 9.3.1)
8
+ https://github.com/TanStack/table
9
+ Copyright (c) 2016 Tanner Linsley
10
+
11
+ TanStack Virtual (@tanstack/virtual-core 3.19.16)
12
+ https://github.com/TanStack/virtual
13
+ Copyright (c) 2021-present Tanner Linsley
14
+
15
+ Both are licensed under the MIT License:
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software
18
+ and associated documentation files (the "Software"), to deal in the Software without
19
+ restriction, including without limitation the rights to use, copy, modify, merge, publish,
20
+ distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
21
+ Software is furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all copies or
24
+ substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
27
+ BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
29
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # @ember-lattice/editing
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Cell editing for Lattice: Formwright controls as editors, batch edit, undo and redo, the
4
+ clipboard and the fill handle. Range selection is in the Grid (`@ember-lattice/ember`).
5
+
6
+ Part of [Lattice](https://joegaudet.com/ember-lattice/). Not released yet.
7
+
8
+ ## Use
9
+
10
+ Make an `EditController` and give it to the Grid as `@editing`. Put the table option
11
+ `cellSelectionFeature` in the table features, for ranges, the clipboard and the fill handle.
12
+
13
+ ```gts
14
+ import { LatticeGrid } from '@ember-lattice/ember'
15
+ import { EditController } from '@ember-lattice/editing'
16
+
17
+ const editing = new EditController({
18
+ // Save one value. Update your data, then give the new data to the table.
19
+ onCellEdit: (row, columnId, value) => api.save(row.id, { [columnId]: value }),
20
+ })
21
+
22
+ <template><LatticeGrid @table={{table}} @label='Orders' @editing={{editing}} /></template>
23
+ ```
24
+
25
+ With a data source from `@ember-lattice/data`, give its `mutate` in place of `onCellEdit`. The
26
+ controller sends one `update` op for each value. A result with `status: 'error'` rolls the
27
+ value back.
28
+
29
+ ## Column options
30
+
31
+ Put these in `columnDef.meta.lattice`. A column with no `editor` does not edit.
32
+
33
+ | Key | Type | Meaning |
34
+ | ---------- | ---------------------------- | ----------------------------------------------------------------------- |
35
+ | `editor` | control name or component | A Formwright control (`input`, `number`, `date`, `select`, `checkbox`). |
36
+ | `schema` | Standard Schema or validator | Validates each value: a typed value, a paste and a fill. |
37
+ | `parse` | `(text: string) => unknown` | Makes a value from a typed key or a pasted text. Default: the text. |
38
+ | `options` | `readonly unknown[]` | The options of a `select` editor. |
39
+ | `editMode` | `'cell' \| 'popup'` | `popup`: the editor opens under the cell. Default: `cell`. |
40
+
41
+ Any component with the Formwright `ControlSignature` is an editor. Put `@id` on its focusable
42
+ element and call `@onChange(value)`.
43
+
44
+ ## Keys
45
+
46
+ | Key | Action |
47
+ | ---------------------- | ------------------------------------------------------------ |
48
+ | Enter or F2 | Open the editor on the active cell. |
49
+ | A printable key | Open the editor. The key replaces the value. |
50
+ | Enter (in the editor) | Validate and save. The active cell moves down. |
51
+ | Tab (in the editor) | Validate and save. The active cell moves to the inline end. |
52
+ | Escape (in the editor) | Cancel. Focus goes back to the cell. |
53
+ | Shift+arrows | Extend the range. |
54
+ | Ctrl+A | Select all cells. |
55
+ | Ctrl+C, Ctrl+X, Ctrl+V | Copy, cut and paste the ranges as TSV (and HTML for a copy). |
56
+ | Ctrl+Z | Undo. |
57
+ | Ctrl+Shift+Z or Ctrl+Y | Redo. |
58
+
59
+ A press on a cell selects it. Shift and a press extend the range. Ctrl and a press add a range.
60
+ A press on another cell while the editor is open saves the edit.
61
+
62
+ ## Full-row edit
63
+
64
+ Give `rowEdit: true`. Enter or F2 opens one Formwright control over each editable cell of the
65
+ row. The field of the active cell gets the focus.
66
+
67
+ - Tab and Shift+Tab move between the fields.
68
+ - Enter validates all fields. When all values are valid, it saves the changed values as one undo
69
+ step, and the active cell moves down. When a value is not valid, the row stays open, and each
70
+ error shows with its column name.
71
+ - Escape cancels all fields.
72
+
73
+ ## Saves
74
+
75
+ - Each edit runs an edit machine (Switchyard): `viewing`, `editing`, `validating`, `saving`,
76
+ then `saved` or `failed`. The editor shows the state as `data-lt-edit-state`.
77
+ - The save is optimistic. The cell shows the new value at once. When the save fails, the value
78
+ rolls back, `lastError` has the message, and the edit has no undo step.
79
+ - A paste, a cut and a fill are one undo step each. A value that the column schema refuses is
80
+ not written.
81
+ - `message` has the last result: `Saved Name`, `The save of Name failed: …`, or
82
+ `Pasted 3 cells. 1 value was refused.` The grid live region (`role="status"`) reads it.
83
+ - The editor follows its cell when the grid scrolls. When the cell is out of the view, the editor
84
+ is clipped, and its control keeps the focus.
85
+
86
+ ## Batch edit
87
+
88
+ Give `batch: true`. The edits are staged: the cells show the new values and have `data-dirty`.
89
+ `dirtyCount` is the number of staged values. Call `commitAll()` to save all of them, or
90
+ `discard()` to drop them.
91
+
92
+ ## Status bar data
93
+
94
+ `rangeSummary(table)` gives `count`, `numericCount`, `sum` and `average` of the selected cells.
95
+ It reads the table, so a template that calls it renders again when the ranges change.
96
+
97
+ ## Not done yet
98
+
99
+ - The `enum` (real-enums) and `money` editors.
100
+ - The fill handle with a `@rowModel`.
101
+ - A row edit that saves when the focus leaves the row.
package/addon-main.cjs ADDED
@@ -0,0 +1,4 @@
1
+ 'use strict'
2
+
3
+ const { addonV1Shim } = require('@embroider/addon-shim')
4
+ module.exports = addonV1Shim(__dirname)
@@ -0,0 +1,28 @@
1
+ import Component from '@glimmer/component';
2
+ import type { EditCell } from './controller.ts';
3
+ /** The args that the grid gives its editor (the grid `GridEditorSignature`). */
4
+ export interface CellEditorSignature {
5
+ Args: {
6
+ cell: EditCell;
7
+ id: string;
8
+ label: string;
9
+ value: unknown;
10
+ onChange: (value: unknown) => void;
11
+ invalid: boolean;
12
+ };
13
+ }
14
+ export default class CellEditor extends Component<CellEditorSignature> {
15
+ get meta(): import("@ember-lattice/ember").LatticeColumnMeta | undefined;
16
+ get editor(): import("@ember-formwright/ember").ControlName | import("@ember-formwright/ember").ControlComponent | undefined;
17
+ get Control(): import("@ember-formwright/ember").ControlComponent | undefined;
18
+ /** The control name: Formwright controls such as `input` read their kind from it. */
19
+ get type(): import("@ember-formwright/ember").ControlName | "custom";
20
+ get columnType(): import("./typed-editor.ts").EditColumnType | undefined;
21
+ /** `meta.lattice.options`, else the values of a closed type (an enum). */
22
+ get options(): readonly unknown[] | undefined;
23
+ /** The label of an option of a closed type: the type format. */
24
+ get optionLabel(): ((option: unknown) => string) | undefined;
25
+ get value(): unknown;
26
+ onChange: (value: unknown) => void;
27
+ }
28
+ //# sourceMappingURL=cell-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell-editor.d.ts","sourceRoot":"","sources":["../src/cell-editor.gts"],"names":[],"mappings":"AA0FA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAK1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAG/C,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ,CAAA;QACd,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,OAAO,CAAA;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;QAClC,OAAO,EAAE,OAAO,CAAA;KACjB,CAAA;CACF;AAED,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS,CAAC,mBAAmB,CAAC;IACpE,IAAI,IAAI,iEAEP;IAED,IAAI,MAAM,mHAET;IAED,IAAI,OAAO,mEAGV;IAED,qFAAqF;IACrF,IAAI,IAAI,6DAGP;IAED,IAAI,UAAU,2DAEb;IAED,0EAA0E;IAC1E,IAAI,OAAO,mCAEV;IAED,gEAAgE;IAChE,IAAI,WAAW,cAGkB,OAAO,yBACvC;IAED,IAAI,KAAK,YAER;IAED,QAAQ,GAAI,OAAO,OAAO,UAGzB;CAwBF"}
@@ -0,0 +1,120 @@
1
+ import type { LatticeLocale, LatticeLocaleTextOverride } from '@ember-lattice/core';
2
+ import type { GridColumn, GridRow } from '@ember-lattice/ember';
3
+ import CellEditor from './cell-editor';
4
+ /** One cell: its row and its column (the grid `GridEditCell`). */
5
+ export interface EditCell {
6
+ row: GridRow;
7
+ column: GridColumn;
8
+ }
9
+ /** Saves one value. A rejected promise rolls the value back. */
10
+ export type OnCellEdit = (row: GridRow, columnId: string, value: unknown) => unknown;
11
+ /** An update op of the Lattice protocol (`RowOp`), for a data source `mutate`. */
12
+ export interface UpdateOp {
13
+ type: 'update';
14
+ id: string;
15
+ changes: Record<string, unknown>;
16
+ }
17
+ /** The result of a data source `mutate` (`MutateResult`): one result for each op. */
18
+ export interface UpdateResult {
19
+ results: ReadonlyArray<{
20
+ status: 'ok' | 'error';
21
+ message?: string;
22
+ }>;
23
+ }
24
+ export interface EditControllerOptions {
25
+ /** Saves one value. Give this or `mutate`. */
26
+ onCellEdit?: OnCellEdit;
27
+ /** A data source `mutate` (`@ember-lattice/data`). It gets one update op for each value. */
28
+ mutate?: (ops: UpdateOp[]) => Promise<UpdateResult>;
29
+ /** Stage the edits (`data-dirty`) until `commitAll()`. Default: false, each edit saves. */
30
+ batch?: boolean;
31
+ /** Full-row edit: Enter opens an editor for each editable column of the row. Default: false. */
32
+ rowEdit?: boolean;
33
+ /**
34
+ * The owner of the app (for example `getOwner(this)`): the messages take the locale text and
35
+ * the locale of `setLatticeLocale`. Without it, the messages are in English.
36
+ */
37
+ owner?: object;
38
+ /** Locale text that replaces the owner text for the messages of this controller. */
39
+ localeText?: LatticeLocaleTextOverride;
40
+ /** The locale of the messages and of the type parse. Default: the owner locale. */
41
+ locale?: string;
42
+ }
43
+ interface Pending {
44
+ cell: EditCell;
45
+ value: unknown;
46
+ /** True for a batch value that waits for `commitAll()`. */
47
+ staged: boolean;
48
+ }
49
+ /** Give it to `LatticeGrid` as `@editing`: it fits the grid `GridEditing` interface. */
50
+ export declare class EditController {
51
+ readonly Editor: typeof CellEditor;
52
+ readonly RowEditor: import("@ember/component/template-only").TOC<import('./row-editor').RowEditorSignature>;
53
+ active: EditCell | null;
54
+ draft: unknown;
55
+ state: string;
56
+ errors: readonly string[];
57
+ /** The message of the last failed save, or null. */
58
+ lastError: string | null;
59
+ /** The last result for the grid live region: a save, a failed save, a paste. */
60
+ message: string;
61
+ /** The row in a full-row edit, or null. */
62
+ activeRow: GridRow | null;
63
+ /** The values of a full-row edit, by column ID. Each change replaces the object. */
64
+ rowDraft: Readonly<Record<string, unknown>>;
65
+ private rowColumns;
66
+ /** The values that are staged or in a save, by cell. Each change replaces the map. */
67
+ private pending;
68
+ private machine;
69
+ private stack;
70
+ private options;
71
+ constructor(options: EditControllerOptions);
72
+ /** The locale of the messages and of the type parse. */
73
+ get locale(): LatticeLocale;
74
+ get batch(): boolean;
75
+ get mode(): 'cell' | 'row';
76
+ /** The number of staged values (batch edit). */
77
+ get dirtyCount(): number;
78
+ canEdit: ({ column }: EditCell) => boolean;
79
+ pendingValue: (rowId: string, columnId: string) => Pending | undefined;
80
+ isDirty: (rowId: string, columnId: string) => boolean;
81
+ /** The value that the cell shows: a staged or saving value, else the row value. */
82
+ valueOf(cell: EditCell): unknown;
83
+ /** A text (from a key, a paste) as a value of the column: its `parse`, else the text. */
84
+ parse(cell: EditCell, text: string): unknown;
85
+ begin(cell: EditCell, text?: string): void;
86
+ /** A new machine for each edit: a save in flight does not block the next edit. */
87
+ private newMachine;
88
+ setDraft: (value: unknown) => void;
89
+ cancel(): void;
90
+ /** Opens a full-row edit over the columns that it can edit. */
91
+ beginRow(row: GridRow, columns: ReadonlyArray<GridColumn>): void;
92
+ setRowValue: (columnId: string, value: unknown) => void;
93
+ /** Validates every field, then saves the changed values as one undo step. */
94
+ commitRow(): Promise<boolean>;
95
+ commit(): Promise<boolean>;
96
+ validate(cell: EditCell, value: unknown): Promise<string[]>;
97
+ undo(): Promise<void>;
98
+ redo(): Promise<void>;
99
+ paste(text: string, cellAt: (row: number, col: number) => EditCell | undefined): Promise<void>;
100
+ fill(lines: ReadonlyArray<{
101
+ source: EditCell[];
102
+ target: EditCell[];
103
+ }>): Promise<void>;
104
+ clear(cells: EditCell[]): Promise<void>;
105
+ /** Saves all staged values (batch edit). A failed save keeps its values staged. */
106
+ commitAll(): Promise<void>;
107
+ /** Drops all staged values (batch edit). */
108
+ discard(): void;
109
+ /** Many changes as one undo step. It gives the number of values that the schema let through. */
110
+ private write;
111
+ /** Writes one side of the changes: staged in a batch, else an optimistic save. */
112
+ private apply;
113
+ private save;
114
+ private send;
115
+ private mark;
116
+ /** Removes the entries. A newer value for the same cell stays. */
117
+ private drop;
118
+ }
119
+ export {};
120
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AACnF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,EAAE,MAAM;IAQnC,kFAAkF;IAClF,OAAO,CAAC,UAAU;IASlB,QAAQ,GAAI,OAAO,OAAO,UAEzB;IAED,MAAM;IAON,+DAA+D;IAC/D,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC;IAWzD,WAAW,GAAI,UAAU,MAAM,EAAE,OAAO,OAAO,UAE9C;IAED,6EAA6E;IACvE,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAwC7B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAoC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO3D,IAAI;IAKJ,IAAI;IAKJ,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS;IAkB9E,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC;QAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QAAC,MAAM,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC;IAcrE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE;IAQ7B,mFAAmF;IAC7E,SAAS;IAMf,4CAA4C;IAC5C,OAAO;IAIP,gGAAgG;YAClF,KAAK;IAUnB,kFAAkF;YACpE,KAAK;YAWL,IAAI;YAeJ,IAAI;IAalB,OAAO,CAAC,IAAI;IASZ,kEAAkE;IAClE,OAAO,CAAC,IAAI;CAQb"}
@@ -0,0 +1,44 @@
1
+ import type { ComponentLike } from '@glint/template';
2
+ import type { ControlComponent, ControlName, ControlSignature, Validator } from '@ember-formwright/ember';
3
+ import type { RichSelectItemSignature } from './rich-select';
4
+ export { EditController } from './controller.ts';
5
+ export type { EditCell, EditControllerOptions, OnCellEdit, UpdateOp, UpdateResult, } from './controller.ts';
6
+ export { default as CellEditor } from './cell-editor';
7
+ /**
8
+ * The signature of a component as `editor` in `meta.lattice`: the Formwright control args. The
9
+ * grid gives `@id` (put it on the real input), `@label`, `@value`, `@onChange` and `@invalid`.
10
+ */
11
+ export type CustomEditorSignature<V = unknown> = ControlSignature<V>;
12
+ export { default as RowEditor } from './row-editor';
13
+ export type { RowEditorSignature } from './row-editor';
14
+ export { EditMachine, EditState } from './machine.ts';
15
+ export { fillSeries } from './series.ts';
16
+ export { rangeSummary } from './summary.ts';
17
+ export type { RangeSummary } from './summary.ts';
18
+ export { parseTsv } from './tsv.ts';
19
+ export { UndoStack } from './undo.ts';
20
+ declare module '@ember-lattice/ember' {
21
+ /** The column options of editing, in `columnDef.meta.lattice`. */
22
+ interface LatticeColumnMeta {
23
+ /** The editor: a Formwright control name, or a component with its `ControlSignature`. */
24
+ editor?: ControlName | ControlComponent;
25
+ /**
26
+ * With `meta.columnType` and no `editor`: the column is editable with the control of its
27
+ * type (number, date, datetime, checkbox, a select of the enum values, an input for text).
28
+ */
29
+ editable?: boolean;
30
+ /** A Standard Schema (or a Formwright validator function) for the value. */
31
+ schema?: Validator;
32
+ /** Makes a value from a text: a typed key, a paste. Default: the text. */
33
+ parse?: (text: string) => unknown;
34
+ /** The options of a `select` or `RichSelect` editor. */
35
+ options?: readonly unknown[];
36
+ /** `RichSelect`: loads the options for a text, from a server. */
37
+ search?: (text: string) => Promise<readonly unknown[]>;
38
+ /** `RichSelect`: the component of each option. */
39
+ optionComponent?: ComponentLike<RichSelectItemSignature>;
40
+ }
41
+ }
42
+ export { default as RichSelect } from './rich-select';
43
+ export type { RichSelectArgs, RichSelectItemSignature, RichSelectSignature, } from './rich-select';
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EACV,gBAAgB,EAChB,W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C5B,iEAAiE;QACjE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;QACtD,kDAAkD;QAClD,eAAe,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAA;KACzD;CACF;AACD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACzD,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { Machine, State } from '@switchyard-ts/core';
2
+ export declare class EditState extends State {
3
+ private readonly brand;
4
+ static Viewing: EditState & {
5
+ readonly value: "viewing";
6
+ };
7
+ static Editing: EditState & {
8
+ readonly value: "editing";
9
+ };
10
+ static Validating: EditState & {
11
+ readonly value: "validating";
12
+ };
13
+ static Saving: EditState & {
14
+ readonly value: "saving";
15
+ };
16
+ static Saved: EditState & {
17
+ readonly value: "saved";
18
+ };
19
+ static Failed: EditState & {
20
+ readonly value: "failed";
21
+ };
22
+ }
23
+ export declare class EditMachine extends Machine<EditState> {
24
+ static strict: boolean;
25
+ begin(): void;
26
+ validate(): void;
27
+ /** The value is not valid: the editor stays open with the errors. */
28
+ invalid(): void;
29
+ save(): void;
30
+ resolve(): void;
31
+ reject(): void;
32
+ cancel(): void;
33
+ }
34
+ //# sourceMappingURL=machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAc,MAAM,qBAAqB,CAAA;AAEhE,qBAAa,SAAU,SAAQ,KAAK;IAClC,iBAAyB,KAAK,CAAO;IACrC,MAAM,CAAC,OAAO;;MAA0B;IACxC,MAAM,CAAC,OAAO;;MAA0B;IACxC,MAAM,CAAC,UAAU;;MAA6B;IAC9C,MAAM,CAAC,MAAM;;MAAyB;IACtC,MAAM,CAAC,KAAK;;MAAwB;IACpC,MAAM,CAAC,MAAM;;MAAyB;CACvC;AAED,qBAAa,WAAY,SAAQ,OAAO,CAAC,SAAS,CAAC;IACjD,OAAgB,MAAM,UAAO;IAG7B,KAAK;IAGL,QAAQ;IAER,qEAAqE;IAErE,OAAO;IAGP,IAAI;IAGJ,OAAO;IAGP,MAAM;IAGN,MAAM;CACP"}
@@ -0,0 +1,57 @@
1
+ import Component from '@glimmer/component';
2
+ import type Owner from '@ember/owner';
3
+ import type { ComponentLike } from '@glint/template';
4
+ import type { ControlSignature } from '@ember-formwright/ember';
5
+ export interface RichSelectItemSignature {
6
+ Args: {
7
+ option: unknown;
8
+ active: boolean;
9
+ };
10
+ }
11
+ export interface RichSelectArgs {
12
+ /** The values. They are filtered on the client by their label. */
13
+ options?: readonly unknown[];
14
+ /** Loads the values for a text (async). With it, `options` is not used. */
15
+ search?: (text: string) => Promise<readonly unknown[]>;
16
+ /** The text of a value. Default: `String(value)`. */
17
+ optionLabel?: (option: unknown) => string;
18
+ /** A component for each option. Default: the label. */
19
+ item?: ComponentLike<RichSelectItemSignature>;
20
+ }
21
+ export type RichSelectSignature = ControlSignature<unknown, RichSelectArgs, HTMLInputElement>;
22
+ export default class RichSelect extends Component<RichSelectSignature> {
23
+ get l(): import("@ember-lattice/core").LatticeLocale;
24
+ listId: string;
25
+ text: string;
26
+ private loaded;
27
+ loading: boolean;
28
+ private scrollTop;
29
+ private activeIndex;
30
+ private request;
31
+ constructor(owner: Owner, args: RichSelectSignature['Args']);
32
+ label: (option: unknown) => string;
33
+ get list(): readonly unknown[];
34
+ /** The active option: the one the keys moved to, else the current value. */
35
+ get active(): number;
36
+ get activeId(): string | undefined;
37
+ get spacerStyle(): import("@ember/template").TrustedHTML;
38
+ listStyle: import("@ember/template").TrustedHTML;
39
+ get rows(): {
40
+ option: unknown;
41
+ label: string;
42
+ id: string;
43
+ active: boolean;
44
+ selected: string;
45
+ posinset: number;
46
+ style: import("@ember/template").TrustedHTML;
47
+ }[];
48
+ private load;
49
+ private loadedFor;
50
+ /** Makes option `i` active and the value, and scrolls it into the window. */
51
+ private moveTo;
52
+ onInput: (event: Event) => void;
53
+ onKeyDown: (event: KeyboardEvent) => void;
54
+ onScroll: (event: Event) => number;
55
+ pick: (index: number) => void;
56
+ }
57
+ //# sourceMappingURL=rich-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-select.d.ts","sourceRoot":"","sources":["../src/rich-select.gts"],"names":[],"mappings":"AA4OA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAO1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAA;CAC3C;AAED,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;IAC5B,2EAA2E;IAC3E,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;IACtD,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAA;IACzC,uDAAuD;IACvD,IAAI,CAAC,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAA;CAC9C;AAED,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAA;AAU7F,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS,CAAC,mBAAmB,CAAC;IAEpE,IAAI,CAAC,gDAEJ;IAED,MAAM,SAA0B;IACvB,IAAI,SAAK;IACT,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,UAAQ;IACf,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,OAAO,CAAI;gBAEP,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC;IAK3D,KAAK,GAAI,QAAQ,OAAO,YACsD;IAE9E,IAAI,IAAI,IAAI,SAAS,OAAO,EAAE,CAK7B;IAED,4EAA4E;IAC5E,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,QAAQ,uBAEX;IAED,IAAI,WAAW,0CAEd;IAED,SAAS,wCAAa;IAGtB,IAAI,IAAI;;;;;;;;QAoBP;IAED,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,SAAS;IAOjB,6EAA6E;IAC7E,OAAO,CAAC,MAAM;IAgBd,OAAO,GAAI,OAAO,KAAK,UAQtB;IAED,SAAS,GAAI,OAAO,aAAa,UAahC;IAED,QAAQ,GAAI,OAAO,KAAK,YAA+D;IAEvF,IAAI,GAAI,OAAO,MAAM,UAA2B;CA6IjD"}
@@ -0,0 +1,18 @@
1
+ import type { TOC } from '@ember/component/template-only';
2
+ import type { GridColumn, GridRow } from '@ember-lattice/ember';
3
+ /** The args that the grid gives its row editor (the grid `GridRowEditorSignature`). */
4
+ export interface RowEditorSignature {
5
+ Args: {
6
+ row: GridRow;
7
+ fields: ReadonlyArray<{
8
+ column: GridColumn;
9
+ id: string;
10
+ label: string;
11
+ }>;
12
+ values: Readonly<Record<string, unknown>>;
13
+ onChange: (columnId: string, value: unknown) => void;
14
+ };
15
+ }
16
+ declare const RowEditor: TOC<RowEditorSignature>;
17
+ export default RowEditor;
18
+ //# sourceMappingURL=row-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-editor.d.ts","sourceRoot":"","sources":["../src/row-editor.gts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAG/D,uFAAuF;AACvF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE;QACJ,GAAG,EAAE,OAAO,CAAA;QACZ,MAAM,EAAE,aAAa,CAAC;YAAE,MAAM,EAAE,UAAU,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QACxE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;QACzC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;KACrD,CAAA;CACF;AAED,QAAA,MAAM,SAAS,EAAE,GAAG,CAAC,kBAAkB,CAgCrC,CAAA;AAEF,eAAe,SAAS,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** The `count` values after `source`. */
2
+ export declare function fillSeries(source: readonly unknown[], count: number): unknown[];
3
+ //# sourceMappingURL=series.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"series.d.ts","sourceRoot":"","sources":["../src/series.ts"],"names":[],"mappings":"AAuBA,yCAAyC;AACzC,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAyB/E"}
@@ -0,0 +1,15 @@
1
+ export interface RangeSummary {
2
+ /** The number of selected cells. */
3
+ count: number;
4
+ /** The number of selected cells with a number value. */
5
+ numericCount: number;
6
+ /** The sum of the numbers. */
7
+ sum: number;
8
+ /** The average of the numbers, or null when there is no number. */
9
+ average: number | null;
10
+ }
11
+ /** The count of the selected cells, and the sum and average of their numbers. */
12
+ export declare function rangeSummary(table: {
13
+ getSelectedCellRangesData(): ReadonlyArray<ReadonlyArray<readonly unknown[]>>;
14
+ }): RangeSummary;
15
+ //# sourceMappingURL=summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAA;IACpB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,mEAAmE;IACnE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,yBAAyB,IAAI,aAAa,CAAC,aAAa,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC,CAAA;CAC9E,GAAG,YAAY,CAYf"}
@@ -0,0 +1,3 @@
1
+ /** The rows of TSV text, each a list of cell texts. */
2
+ export declare function parseTsv(text: string): string[][];
3
+ //# sourceMappingURL=tsv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsv.d.ts","sourceRoot":"","sources":["../src/tsv.ts"],"names":[],"mappings":"AAGA,uDAAuD;AACvD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAyBjD"}
@@ -0,0 +1,32 @@
1
+ import type { ControlComponent, ControlName } from '@ember-formwright/ember';
2
+ import type { GridColumn } from '@ember-lattice/ember';
3
+ /** The part of a column type that editing reads. */
4
+ export interface EditColumnType {
5
+ readonly name: string;
6
+ format(value: unknown, locale?: string): string;
7
+ /** Reads a value from text. Bad text gives `undefined`. */
8
+ parse?(text: string, locale?: string): unknown;
9
+ /** Text of the value that is the same in all locales: ISO text for a date. */
10
+ plain?(value: unknown): string;
11
+ /** All the values of a closed type (an enum), in order. */
12
+ values?(): readonly unknown[];
13
+ }
14
+ export declare const columnTypeOf: (column: GridColumn) => EditColumnType | undefined;
15
+ /** The editor of a column: `meta.lattice.editor`, else the editor of its type when editable. */
16
+ export declare function editorOf(column: GridColumn): ControlName | ControlComponent | undefined;
17
+ /**
18
+ * A text (a typed key, a paste) as a value: `meta.lattice.parse`, else the type parse. Text that
19
+ * the type does not read stays text, as with no parse, so the schema can report it.
20
+ */
21
+ export declare function parserOf(column: GridColumn, locale?: string): ((text: string) => unknown) | undefined;
22
+ /**
23
+ * The value for the control: the plain text of a date (ISO text) or of a value object (money,
24
+ * decimal, percent). Other values, and text, go to the control as they are.
25
+ */
26
+ export declare function toControl(column: GridColumn, value: unknown): unknown;
27
+ /**
28
+ * The value from the control. Text from a plain-text control reads through the type parse when
29
+ * the row value is not text: the data keeps its form. Text that does not read stays text.
30
+ */
31
+ export declare function fromControl(column: GridColumn, rowValue: unknown, value: unknown): unknown;
32
+ //# sourceMappingURL=typed-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-editor.d.ts","sourceRoot":"","sources":["../src/typed-editor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/C,2DAA2D;IAC3D,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC9C,8EAA8E;IAC9E,KAAK,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAA;IAC9B,2DAA2D;IAC3D,MAAM,CAAC,IAAI,SAAS,OAAO,EAAE,CAAA;CAC9B;AA0BD,eAAO,MAAM,YAAY,GAAI,QAAQ,UAAU,KAAG,cAAc,GAAG,SAChC,CAAA;AAEnC,gGAAgG;AAChG,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,gBAAgB,GAAG,SAAS,CAKvF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,MAAM,GACd,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAKzC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAKrE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAK1F"}
@@ -0,0 +1,15 @@
1
+ export declare class UndoStack<Op> {
2
+ private done;
3
+ private undone;
4
+ get canUndo(): boolean;
5
+ get canRedo(): boolean;
6
+ /** A new op. It clears the redo list. */
7
+ push(op: Op): void;
8
+ /** Removes an op that did not apply (a failed save). */
9
+ remove(op: Op): void;
10
+ /** The op to undo: apply its inverse. */
11
+ undo(): Op | undefined;
12
+ /** The op to do again. */
13
+ redo(): Op | undefined;
14
+ }
15
+ //# sourceMappingURL=undo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undo.d.ts","sourceRoot":"","sources":["../src/undo.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS,CAAC,EAAE;IACvB,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,MAAM,CAAW;IAEzB,IAAI,OAAO,YAEV;IAED,IAAI,OAAO,YAEV;IAED,yCAAyC;IACzC,IAAI,CAAC,EAAE,EAAE,EAAE;IAKX,wDAAwD;IACxD,MAAM,CAAC,EAAE,EAAE,EAAE;IAKb,yCAAyC;IACzC,IAAI,IAAI,EAAE,GAAG,SAAS;IAMtB,0BAA0B;IAC1B,IAAI,IAAI,EAAE,GAAG,SAAS;CAKvB"}