@sincpro/web-ui 1.4.0 → 1.6.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/dist/components/lines/LineItems.d.ts +14 -3
- package/dist/components/lines/LineItems.js +6 -4
- package/dist/components/listing/Row.d.ts +5 -4
- package/dist/components/listing/Row.js +5 -4
- package/dist/foundations/copy.d.ts +4 -0
- package/dist/foundations/copy.es.js +2 -0
- package/dist/foundations/copy.js +2 -0
- package/dist/foundations/form.d.ts +18 -1
- package/dist/foundations/form.js +6 -3
- package/dist/foundations/grouping.d.ts +28 -0
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -1
- package/dist/primitives/picker/MatchedText.d.ts +3 -2
- package/dist/primitives/picker/MatchedText.js +3 -2
- package/dist/primitives/picker/Picker.d.ts +18 -1
- package/dist/primitives/picker/Picker.js +5 -5
- package/dist/primitives/picker/TagsField.d.ts +10 -0
- package/dist/primitives/picker/TagsField.js +2 -2
- package/dist/primitives/picker/index.d.ts +2 -1
- package/dist/primitives/picker/index.js +2 -0
- package/dist/primitives/picker/tagChoices.d.ts +7 -0
- package/dist/primitives/picker/tagChoices.js +9 -4
- package/dist/primitives/table/DataTable.js +10 -11
- package/dist/primitives/table/EditableTable.d.ts +49 -7
- package/dist/primitives/table/EditableTable.js +321 -82
- package/dist/primitives/table/PileFootLine.d.ts +14 -0
- package/dist/primitives/table/PileFootLine.js +22 -0
- package/dist/primitives/table/index.d.ts +2 -1
- package/dist/primitives/table/index.js +1 -0
- package/dist/primitives/table/rowWindow.d.ts +3 -0
- package/dist/primitives/table/rowWindow.js +4 -0
- package/dist/views/list/List.d.ts +3 -2
- package/dist/views/list/ListView.js +13 -6
- package/dist/views/list/index.d.ts +1 -1
- package/dist/views/list/types.d.ts +16 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Grouping } from "../../foundations/grouping.js";
|
|
2
2
|
import { type FlagProps } from "../notice/Flag.js";
|
|
3
|
+
import { type WindowedRow } from "./rowWindow.js";
|
|
3
4
|
import { type ReactNode } from "react";
|
|
4
5
|
/** Where a column goes when the row is drawn as a stacked card (a narrow box).
|
|
5
6
|
* `trail` sits at the top right, beside the title — a state, the row's buttons. */
|
|
@@ -46,6 +47,37 @@ export type EditBands<T> = {
|
|
|
46
47
|
* column does not add up. The lines are the ones under it until the next section. */
|
|
47
48
|
total?: (column: EditColumn<T>, lines: readonly T[]) => ReactNode | null;
|
|
48
49
|
};
|
|
50
|
+
/** A warning drawn as a `Flag`: on a row (`flag`) or on one cell (`EditCellState.flag`). */
|
|
51
|
+
export type EditFlag = Omit<FlagProps, "children"> & {
|
|
52
|
+
detail?: ReactNode;
|
|
53
|
+
owner?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* What ONE cell of one row is right now — said by whoever knows the record: the states the
|
|
57
|
+
* backend sends per line and field. Every key left out keeps the column as declared.
|
|
58
|
+
*
|
|
59
|
+
* Context: a column declares what it is for every row (`edit`), but an ERP line decides
|
|
60
|
+
* per row — a delivered line keeps its quantity, a service line has no lot, a discount is
|
|
61
|
+
* required only past a threshold. The table does not know why; it is told, cell by cell.
|
|
62
|
+
*/
|
|
63
|
+
export type EditCellState = {
|
|
64
|
+
/** Not written in on this row: the cell reads while the row is edited. */
|
|
65
|
+
readonly?: boolean;
|
|
66
|
+
/** Has to have a value: marked while the row is edited, and said to its control. */
|
|
67
|
+
required?: boolean;
|
|
68
|
+
/** Not there on this row (Odoo's per-row `invisible`): the cell is drawn empty. */
|
|
69
|
+
hidden?: boolean;
|
|
70
|
+
/** What is wrong with this value, said as what to put — under the value, with an icon,
|
|
71
|
+
* and the control is `aria-invalid` and described by it. `null` when nothing is. */
|
|
72
|
+
error?: string | null;
|
|
73
|
+
/** A warning about THIS value — «precio bajo el costo» on the price, not on the line. */
|
|
74
|
+
flag?: EditFlag | null;
|
|
75
|
+
};
|
|
76
|
+
/** What a whole row is right now. A row that should not be seen is not passed at all. */
|
|
77
|
+
export type EditRowState = {
|
|
78
|
+
/** Read, not written: walked with the arrows, never opened to edit. */
|
|
79
|
+
readonly?: boolean;
|
|
80
|
+
};
|
|
49
81
|
/** One more way to add, beside «add a line»: a section, a note. */
|
|
50
82
|
export type EditAdd = {
|
|
51
83
|
label: string;
|
|
@@ -97,7 +129,7 @@ export type RowKey = "ArrowDown" | "ArrowUp" | "Home" | "End";
|
|
|
97
129
|
* of a new record in `DataTable`: one keyboard model, three shapes. Exported for that
|
|
98
130
|
* family sibling only; it is not in the barrel.
|
|
99
131
|
*/
|
|
100
|
-
export declare function EditRow({ as, rowId, rowRef, editable, editing, tabbable, className, onStart, onCommit, onCancel, onMove, onFocusRow, onTabOut, children, }: {
|
|
132
|
+
export declare function EditRow({ as, rowId, rowRef, editable, editing, tabbable, className, onStart, onCommit, onCancel, onMove, onFocusRow, onTabOut, windowed, children, }: {
|
|
101
133
|
as: "tr" | "li";
|
|
102
134
|
rowId: string;
|
|
103
135
|
rowRef: (node: HTMLElement | null) => void;
|
|
@@ -113,6 +145,9 @@ export declare function EditRow({ as, rowId, rowRef, editable, editing, tabbable
|
|
|
113
145
|
/** `Tab` left the row by one of its edges. `true` = the table took it (opened another
|
|
114
146
|
* row, added one); `false` = the browser moves the focus as usual. */
|
|
115
147
|
onTabOut: (direction: "next" | "prev") => boolean;
|
|
148
|
+
/** Past a few hundred rows the table draws only the ones in view (`rowWindow`): this row's
|
|
149
|
+
* measure, its index, and the focus that keeps it drawn. */
|
|
150
|
+
windowed?: WindowedRow | undefined;
|
|
116
151
|
children: ReactNode;
|
|
117
152
|
}): import("react").JSX.Element;
|
|
118
153
|
/**
|
|
@@ -135,15 +170,19 @@ totals, empty, grouping,
|
|
|
135
170
|
/** El total de una columna DENTRO de un montón, ya formateado. Lo calcula quien
|
|
136
171
|
* compone, por el mismo motivo que `totals`: sumar significa cosas distintas
|
|
137
172
|
* según el dominio, y un porcentaje se promedia, no se suma. */
|
|
138
|
-
groupTotal, height, layout, onOpen, onDiscard, bands, adds, flag, onReorder, }: {
|
|
173
|
+
groupTotal, height, layout, onOpen, onDiscard, bands, adds, flag, onReorder, cellState, rowState, }: {
|
|
139
174
|
rows: readonly T[];
|
|
140
175
|
columns: readonly EditColumn<T>[];
|
|
176
|
+
/** The row's key on this screen, stable for as long as the row is drawn — a local key for
|
|
177
|
+
* a row the backend has not made yet, kept after it is saved. A key that changes is a new
|
|
178
|
+
* row to React: the row being written is unmounted and loses the focus. */
|
|
141
179
|
getRowId: (row: T) => string;
|
|
142
180
|
onChange?: (id: string, next: T) => void;
|
|
143
181
|
onRemove?: (id: string) => void;
|
|
144
182
|
/** «Add a line». Return the new row's id —or a promise of it, when the backend makes
|
|
145
183
|
* the record— and the table opens that row with the focus on its first control.
|
|
146
|
-
* Return nothing and the row just appears, closed.
|
|
184
|
+
* Return nothing and the row just appears, closed. The id is the row's KEY (`getRowId`):
|
|
185
|
+
* give a line the backend has not made a local one, and keep it after the save. */
|
|
147
186
|
onAdd?: () => string | void | Promise<string | void>;
|
|
148
187
|
addLabel?: string;
|
|
149
188
|
totals?: readonly (ReactNode | null)[];
|
|
@@ -184,10 +223,13 @@ groupTotal, height, layout, onOpen, onDiscard, bands, adds, flag, onReorder, }:
|
|
|
184
223
|
* `null` for the rows with nothing to say, which should be most of them. `owner` is what
|
|
185
224
|
* the record's activity says it belongs to («Línea 3 · Impresora…»); without it, the
|
|
186
225
|
* row's first value. */
|
|
187
|
-
flag?: (row: T) =>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
226
|
+
flag?: (row: T) => EditFlag | null;
|
|
227
|
+
/** What each cell is on each row — readonly, required, hidden, its error, its warning —
|
|
228
|
+
* as the backend says it per line. `null` keeps the column as declared. See
|
|
229
|
+
* `EditCellState`. */
|
|
230
|
+
cellState?: (row: T, columnId: string) => EditCellState | null;
|
|
231
|
+
/** What a whole row is: `readonly` is read, not opened. See `EditRowState`. */
|
|
232
|
+
rowState?: (row: T) => EditRowState | null;
|
|
191
233
|
/** The rows have an order of their own — the lines of an order, Odoo's `sequence` — and it
|
|
192
234
|
* is changed by dragging the grip at the start of a row, or with Alt + ↑ / ↓ on it. `before`
|
|
193
235
|
* is the row it lands in front of; `null`, the end. Off while grouped (the piles decide the
|