@ember-lattice/editing 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 +51 -0
- package/LICENSE.md +21 -0
- package/NOTICE +30 -0
- package/README.md +108 -2
- package/addon-main.cjs +4 -0
- package/declarations/cell-editor.d.ts +28 -0
- package/declarations/cell-editor.d.ts.map +1 -0
- package/declarations/controller.d.ts +121 -0
- package/declarations/controller.d.ts.map +1 -0
- package/declarations/index.d.ts +61 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/machine.d.ts +34 -0
- package/declarations/machine.d.ts.map +1 -0
- package/declarations/rich-select.d.ts +57 -0
- package/declarations/rich-select.d.ts.map +1 -0
- package/declarations/row-editor.d.ts +18 -0
- package/declarations/row-editor.d.ts.map +1 -0
- package/declarations/series.d.ts +3 -0
- package/declarations/series.d.ts.map +1 -0
- package/declarations/summary.d.ts +15 -0
- package/declarations/summary.d.ts.map +1 -0
- package/declarations/tsv.d.ts +3 -0
- package/declarations/tsv.d.ts.map +1 -0
- package/declarations/typed-editor.d.ts +32 -0
- package/declarations/typed-editor.d.ts.map +1 -0
- package/declarations/undo.d.ts +15 -0
- package/declarations/undo.d.ts.map +1 -0
- package/dist/index.js +890 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @ember-lattice/editing
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f931851: Configure a grid in its template (ADR 0028). `LatticeGrid` takes the rows as `@data` and makes the
|
|
8
|
+
table from the declarations in its block: `g.Column`, `g.ColumnGroup`, `g.SelectionColumn` and
|
|
9
|
+
`g.RowNumberColumn`. A column takes `<:cell>`, `<:header>`, `<:headerEnd>` and `<:editor>` blocks.
|
|
10
|
+
The grid also takes `@features`, `@initialState`, `@state`, `@onStateChange` and `@tableOptions`.
|
|
11
|
+
|
|
12
|
+
- `<:toolbar>`, `<:statusBar>` and `<:sideBar>` get the table and the grid root.
|
|
13
|
+
- `@rowModel` takes a function that makes the model from the table of the grid:
|
|
14
|
+
`ServerRowModel.forGrid({ source })`. The pivot columns of the server row model go after the
|
|
15
|
+
declared columns.
|
|
16
|
+
- `persistGridState` takes the `@stateHost` handle and waits for the table of the grid.
|
|
17
|
+
- The chrome blocks and the `@stateHost` handle give the table as `GridEngineTable`, the engine
|
|
18
|
+
table type. The components of `@ember-lattice/ui` and `persistGridState` take it.
|
|
19
|
+
- `GridRowModel<T>` has the row type, and `forGrid` of each row model keeps the row type of its
|
|
20
|
+
source. The grid gets its row type from `@rowModel`, as it does from `@data`.
|
|
21
|
+
- The grid disconnects a row model that it made from a `@rowModel` function: when the grid goes,
|
|
22
|
+
or when a new function replaces the model.
|
|
23
|
+
- `g.SelectionColumn` and `g.RowNumberColumn` take `@pinned` and `@hidden`.
|
|
24
|
+
- The editing args (`@editor`, `@editable`, `@schema`, `@parse`, `@options`) and the filter arg
|
|
25
|
+
(`@filter`) are args of `g.Column`.
|
|
26
|
+
|
|
27
|
+
`@table` and `constructTable` stay. Nothing is removed or deprecated.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [f931851]
|
|
32
|
+
- Updated dependencies [f931851]
|
|
33
|
+
- Updated dependencies [f931851]
|
|
34
|
+
- @ember-lattice/ember@1.1.0
|
|
35
|
+
- @ember-lattice/core@1.1.0
|
|
36
|
+
|
|
37
|
+
## 1.0.0
|
|
38
|
+
|
|
39
|
+
### Major Changes
|
|
40
|
+
|
|
41
|
+
- 7ce4af2: Lattice 1.0: one grid for every collection in Ember. Lists, feeds, tables, boards and
|
|
42
|
+
spreadsheets come from one headless engine, a port of TanStack Table. It has 80 of the 81
|
|
43
|
+
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,
|
|
44
|
+
Rails and Python, an IronCalc spreadsheet with live collaboration, themes, test harnesses, Jig
|
|
45
|
+
stories and Marquetry catalog entries.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [7ce4af2]
|
|
50
|
+
- @ember-lattice/core@1.0.0
|
|
51
|
+
- @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,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ember-lattice/editing
|
|
2
2
|
|
|
3
|
-
|
|
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>
|
|
23
|
+
<LatticeGrid @data={{orders}} @label='Orders' @editing={{editing}} as |g|>
|
|
24
|
+
<g.Column @id='customer' @label='Customer' @editor='input' />
|
|
25
|
+
<g.Column @id='total' @label='Total' @editor='number' />
|
|
26
|
+
</LatticeGrid>
|
|
27
|
+
</template>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
A `<:editor as |e|>` block of a column is the editor of its cells, in place of `@editor`.
|
|
31
|
+
|
|
32
|
+
With a data source from `@ember-lattice/data`, give its `mutate` in place of `onCellEdit`. The
|
|
33
|
+
controller sends one `update` op for each value. A result with `status: 'error'` rolls the
|
|
34
|
+
value back.
|
|
35
|
+
|
|
36
|
+
## Column options
|
|
37
|
+
|
|
38
|
+
Give these as args of `g.Column`. In the engine form, put them in `columnDef.meta.lattice`. A
|
|
39
|
+
column with no `editor` and no `<:editor>` block does not edit.
|
|
40
|
+
|
|
41
|
+
| Arg | Type | Meaning |
|
|
42
|
+
| ----------- | ---------------------------- | ----------------------------------------------------------------------- |
|
|
43
|
+
| `@editor` | control name or component | A Formwright control (`input`, `number`, `date`, `select`, `checkbox`). |
|
|
44
|
+
| `@schema` | Standard Schema or validator | Validates each value: a typed value, a paste and a fill. |
|
|
45
|
+
| `@parse` | `(text: string) => unknown` | Makes a value from a typed key or a pasted text. Default: the text. |
|
|
46
|
+
| `@options` | `readonly unknown[]` | The options of a `select` editor. |
|
|
47
|
+
| `@editMode` | `'cell' \| 'popup'` | `popup`: the editor opens under the cell. Default: `cell`. |
|
|
48
|
+
|
|
49
|
+
Any component with the Formwright `ControlSignature` is an editor. Put `@id` on its focusable
|
|
50
|
+
element and call `@onChange(value)`.
|
|
51
|
+
|
|
52
|
+
## Keys
|
|
53
|
+
|
|
54
|
+
| Key | Action |
|
|
55
|
+
| ---------------------- | ------------------------------------------------------------ |
|
|
56
|
+
| Enter or F2 | Open the editor on the active cell. |
|
|
57
|
+
| A printable key | Open the editor. The key replaces the value. |
|
|
58
|
+
| Enter (in the editor) | Validate and save. The active cell moves down. |
|
|
59
|
+
| Tab (in the editor) | Validate and save. The active cell moves to the inline end. |
|
|
60
|
+
| Escape (in the editor) | Cancel. Focus goes back to the cell. |
|
|
61
|
+
| Shift+arrows | Extend the range. |
|
|
62
|
+
| Ctrl+A | Select all cells. |
|
|
63
|
+
| Ctrl+C, Ctrl+X, Ctrl+V | Copy, cut and paste the ranges as TSV (and HTML for a copy). |
|
|
64
|
+
| Ctrl+Z | Undo. |
|
|
65
|
+
| Ctrl+Shift+Z or Ctrl+Y | Redo. |
|
|
66
|
+
|
|
67
|
+
A press on a cell selects it. Shift and a press extend the range. Ctrl and a press add a range.
|
|
68
|
+
A press on another cell while the editor is open saves the edit.
|
|
69
|
+
|
|
70
|
+
## Full-row edit
|
|
71
|
+
|
|
72
|
+
Give `rowEdit: true`. Enter or F2 opens one Formwright control over each editable cell of the
|
|
73
|
+
row. The field of the active cell gets the focus.
|
|
74
|
+
|
|
75
|
+
- Tab and Shift+Tab move between the fields.
|
|
76
|
+
- Enter validates all fields. When all values are valid, it saves the changed values as one undo
|
|
77
|
+
step, and the active cell moves down. When a value is not valid, the row stays open, and each
|
|
78
|
+
error shows with its column name.
|
|
79
|
+
- Escape cancels all fields.
|
|
80
|
+
|
|
81
|
+
## Saves
|
|
82
|
+
|
|
83
|
+
- Each edit runs an edit machine (Switchyard): `viewing`, `editing`, `validating`, `saving`,
|
|
84
|
+
then `saved` or `failed`. The editor shows the state as `data-lt-edit-state`.
|
|
85
|
+
- The save is optimistic. The cell shows the new value at once. When the save fails, the value
|
|
86
|
+
rolls back, `lastError` has the message, and the edit has no undo step.
|
|
87
|
+
- A paste, a cut and a fill are one undo step each. A value that the column schema refuses is
|
|
88
|
+
not written.
|
|
89
|
+
- `message` has the last result: `Saved Name`, `The save of Name failed: …`, or
|
|
90
|
+
`Pasted 3 cells. 1 value was refused.` The grid live region (`role="status"`) reads it.
|
|
91
|
+
- The editor follows its cell when the grid scrolls. When the cell is out of the view, the editor
|
|
92
|
+
is clipped, and its control keeps the focus.
|
|
93
|
+
|
|
94
|
+
## Batch edit
|
|
95
|
+
|
|
96
|
+
Give `batch: true`. The edits are staged: the cells show the new values and have `data-dirty`.
|
|
97
|
+
`dirtyCount` is the number of staged values. Call `commitAll()` to save all of them, or
|
|
98
|
+
`discard()` to drop them.
|
|
99
|
+
|
|
100
|
+
## Status bar data
|
|
101
|
+
|
|
102
|
+
`rangeSummary(table)` gives `count`, `numericCount`, `sum` and `average` of the selected cells.
|
|
103
|
+
It reads the table, so a template that calls it renders again when the ranges change.
|
|
104
|
+
|
|
105
|
+
## Not done yet
|
|
106
|
+
|
|
107
|
+
- The `enum` (real-enums) and `money` editors.
|
|
108
|
+
- The fill handle with a `@rowModel`.
|
|
109
|
+
- A row edit that saves when the focus leaves the row.
|
package/addon-main.cjs
ADDED
|
@@ -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,121 @@
|
|
|
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
|
+
/** A column with an editor, or with an `<:editor>` block (the template form). */
|
|
79
|
+
canEdit: ({ column }: EditCell) => boolean;
|
|
80
|
+
pendingValue: (rowId: string, columnId: string) => Pending | undefined;
|
|
81
|
+
isDirty: (rowId: string, columnId: string) => boolean;
|
|
82
|
+
/** The value that the cell shows: a staged or saving value, else the row value. */
|
|
83
|
+
valueOf(cell: EditCell): unknown;
|
|
84
|
+
/** A text (from a key, a paste) as a value of the column: its `parse`, else the text. */
|
|
85
|
+
parse(cell: EditCell, text: string): unknown;
|
|
86
|
+
begin(cell: EditCell, text?: string): void;
|
|
87
|
+
/** A new machine for each edit: a save in flight does not block the next edit. */
|
|
88
|
+
private newMachine;
|
|
89
|
+
setDraft: (value: unknown) => void;
|
|
90
|
+
cancel(): void;
|
|
91
|
+
/** Opens a full-row edit over the columns that it can edit. */
|
|
92
|
+
beginRow(row: GridRow, columns: ReadonlyArray<GridColumn>): void;
|
|
93
|
+
setRowValue: (columnId: string, value: unknown) => void;
|
|
94
|
+
/** Validates every field, then saves the changed values as one undo step. */
|
|
95
|
+
commitRow(): Promise<boolean>;
|
|
96
|
+
commit(): Promise<boolean>;
|
|
97
|
+
validate(cell: EditCell, value: unknown): Promise<string[]>;
|
|
98
|
+
undo(): Promise<void>;
|
|
99
|
+
redo(): Promise<void>;
|
|
100
|
+
paste(text: string, cellAt: (row: number, col: number) => EditCell | undefined): Promise<void>;
|
|
101
|
+
fill(lines: ReadonlyArray<{
|
|
102
|
+
source: EditCell[];
|
|
103
|
+
target: EditCell[];
|
|
104
|
+
}>): Promise<void>;
|
|
105
|
+
clear(cells: EditCell[]): Promise<void>;
|
|
106
|
+
/** Saves all staged values (batch edit). A failed save keeps its values staged. */
|
|
107
|
+
commitAll(): Promise<void>;
|
|
108
|
+
/** Drops all staged values (batch edit). */
|
|
109
|
+
discard(): void;
|
|
110
|
+
/** Many changes as one undo step. It gives the number of values that the schema let through. */
|
|
111
|
+
private write;
|
|
112
|
+
/** Writes one side of the changes: staged in a batch, else an optimistic save. */
|
|
113
|
+
private apply;
|
|
114
|
+
private save;
|
|
115
|
+
private send;
|
|
116
|
+
private mark;
|
|
117
|
+
/** Removes the entries. A newer value for the same cell stays. */
|
|
118
|
+
private drop;
|
|
119
|
+
}
|
|
120
|
+
export {};
|
|
121
|
+
//# 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,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,UAAU,MAAM,mBAAmB,CAAA;AAQ1C,kEAAkE;AAClE,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;CACnB;AAED,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA;AAEpF,kFAAkF;AAClF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,Q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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,61 @@
|
|
|
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
|
+
/** The args of editing on `<g.Column>`: each one goes to `meta.lattice` (ADR 0028). */
|
|
42
|
+
interface LatticeColumnArgs {
|
|
43
|
+
/** The editor: a Formwright control name, or a component with its `ControlSignature`. */
|
|
44
|
+
editor?: ControlName | ControlComponent;
|
|
45
|
+
/** With `@type` and no `@editor`: the column is editable with the control of its type. */
|
|
46
|
+
editable?: boolean;
|
|
47
|
+
/** A Standard Schema (or a Formwright validator function) for the value. */
|
|
48
|
+
schema?: Validator;
|
|
49
|
+
/** Makes a value from a text: a typed key, a paste. Default: the text. */
|
|
50
|
+
parse?: (text: string) => unknown;
|
|
51
|
+
/** The options of a `select` or `RichSelect` editor. */
|
|
52
|
+
options?: readonly unknown[];
|
|
53
|
+
/** `RichSelect`: loads the options for a text, from a server. */
|
|
54
|
+
search?: (text: string) => Promise<readonly unknown[]>;
|
|
55
|
+
/** `RichSelect`: the component of each option. */
|
|
56
|
+
optionComponent?: ComponentLike<RichSelectItemSignature>;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export { default as RichSelect } from './rich-select';
|
|
60
|
+
export type { RichSelectArgs, RichSelectItemSignature, RichSelectSignature, } from './rich-select';
|
|
61
|
+
//# 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,WAAW,EACX,gBAAgB,EAChB,SAAS,EACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,YAAY,EACV,QAAQ,EACR,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEzD;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAA;AACpE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OA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ClD,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,c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AAI,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 @@
|
|
|
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 @@
|
|
|
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"}
|