@sincpro/web-ui 2.0.0 → 2.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/dist/components/activity/Activity.d.ts +13 -14
- package/dist/components/activity/Activity.js +1 -1
- package/dist/components/activity/Messages.d.ts +5 -5
- package/dist/components/activity/Messages.js +8 -8
- package/dist/components/form/Form.js +6 -6
- package/dist/components/form/index.js +2 -2
- package/dist/components/frame/FrameView.d.ts +5 -5
- package/dist/components/frame/FrameView.js +4 -4
- package/dist/components/listing/GroupingLevels.d.ts +22 -22
- package/dist/components/listing/GroupingLevels.js +9 -9
- package/dist/components/listing/Listing.d.ts +11 -11
- package/dist/components/listing/Listing.js +11 -11
- package/dist/components/listing/ListingBar.js +11 -11
- package/dist/components/listing/Row.d.ts +19 -19
- package/dist/components/listing/Row.js +25 -25
- package/dist/components/listing/SortMenu.d.ts +36 -36
- package/dist/components/listing/SortMenu.js +6 -6
- package/dist/components/listing/grouping.d.ts +16 -16
- package/dist/components/listing/grouping.js +6 -6
- package/dist/components/listing/index.js +1 -1
- package/dist/components/listing/modelColumns.d.ts +25 -25
- package/dist/components/listing/modelColumns.js +24 -24
- package/dist/components/listing/pages.js +4 -4
- package/dist/components/listing/set.d.ts +18 -18
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/record/RecordSkeleton.js +7 -7
- package/dist/components/search/CriteriaBuilder.d.ts +22 -22
- package/dist/components/search/CriteriaBuilder.js +31 -31
- package/dist/components/search/CriteriaChips.d.ts +9 -9
- package/dist/components/search/CriteriaChips.js +12 -12
- package/dist/components/search/FilterBuilder.d.ts +67 -67
- package/dist/components/search/FilterBuilder.js +104 -104
- package/dist/components/search/JoinWord.d.ts +1 -1
- package/dist/components/search/JoinWord.js +14 -14
- package/dist/components/search/JsonEditor.d.ts +8 -8
- package/dist/components/search/JsonEditor.js +16 -16
- package/dist/components/search/SearchBar.d.ts +34 -34
- package/dist/components/search/SearchBar.js +110 -110
- package/dist/components/search/criteria.d.ts +61 -61
- package/dist/components/search/criteria.js +39 -39
- package/dist/components/search/datePeriods.d.ts +47 -48
- package/dist/components/search/datePeriods.js +29 -29
- package/dist/components/search/dateRanges.d.ts +27 -27
- package/dist/components/search/dateRanges.js +16 -16
- package/dist/components/search/index.js +13 -13
- package/dist/components/search/model.d.ts +28 -28
- package/dist/components/search/model.js +21 -21
- package/dist/components/search/query.d.ts +71 -71
- package/dist/components/search/query.js +119 -119
- package/dist/components/shell/AppFrame.js +3 -3
- package/dist/components/shell/index.js +1 -1
- package/dist/foundations/calendar.d.ts +27 -27
- package/dist/foundations/calendar.js +72 -72
- package/dist/foundations/chart.d.ts +57 -57
- package/dist/foundations/chart.js +27 -27
- package/dist/foundations/copy.d.ts +96 -94
- package/dist/foundations/copy.es.js +1 -0
- package/dist/foundations/copy.js +1 -0
- package/dist/foundations/grouping.d.ts +175 -175
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +21 -21
- package/dist/foundations/pivot.d.ts +133 -131
- package/dist/foundations/pivot.js +54 -54
- package/dist/foundations/pivotSheet.d.ts +36 -36
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/slots.d.ts +38 -38
- package/dist/foundations/slots.js +18 -18
- package/dist/foundations/sticky.d.ts +28 -28
- package/dist/foundations/sticky.js +59 -59
- package/dist/foundations/xlsx.d.ts +47 -47
- package/dist/foundations/xlsx.js +0 -0
- package/dist/primitives/block/Line.d.ts +4 -4
- package/dist/primitives/block/Line.js +28 -28
- package/dist/primitives/block/index.js +2 -2
- package/dist/primitives/cell/index.js +2 -2
- package/dist/primitives/choice/index.js +3 -3
- package/dist/primitives/date/Calendar.d.ts +7 -1
- package/dist/primitives/date/Calendar.js +13 -3
- package/dist/primitives/date/DatePicker.d.ts +4 -1
- package/dist/primitives/date/DatePicker.js +2 -2
- package/dist/primitives/date/index.js +3 -3
- package/dist/primitives/disclosure/index.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +3 -3
- package/dist/primitives/notice/Callout.d.ts +30 -30
- package/dist/primitives/notice/Callout.js +6 -6
- package/dist/primitives/overlay/index.js +3 -3
- package/dist/primitives/picker/Picker.d.ts +6 -0
- package/dist/primitives/picker/Picker.js +27 -4
- package/dist/primitives/picker/index.js +2 -2
- package/dist/primitives/table/DataTable.d.ts +32 -32
- package/dist/primitives/table/DataTable.js +24 -24
- package/dist/primitives/table/EditableTable.d.ts +10 -10
- package/dist/primitives/table/EditableTable.js +9 -9
- package/dist/primitives/table/ReportTable.js +7 -7
- package/dist/primitives/table/SheetTable.d.ts +13 -13
- package/dist/primitives/table/SheetTable.js +14 -14
- package/dist/primitives/table/Table.js +8 -8
- package/dist/primitives/tabs/Tabs.d.ts +46 -46
- package/dist/primitives/tabs/Tabs.js +7 -7
- package/dist/primitives/tag/index.js +2 -2
- package/dist/primitives/toolbar/index.js +1 -1
- package/dist/primitives/value/Copyable.d.ts +22 -22
- package/dist/primitives/value/Copyable.js +9 -9
- package/dist/tokens.css +17 -17
- package/dist/views/list/List.d.ts +36 -36
- package/dist/views/list/List.js +19 -19
- package/dist/views/list/ListView.js +74 -74
- package/dist/views/list/columns.d.ts +10 -10
- package/dist/views/list/columns.js +10 -10
- package/dist/views/list/derive.d.ts +30 -30
- package/dist/views/list/derive.js +49 -49
- package/dist/views/list/index.js +2 -2
- package/dist/views/list/presentations.js +3 -3
- package/dist/views/list/types.d.ts +109 -109
- package/dist/views/record/Record.d.ts +14 -14
- package/dist/views/record/Record.js +24 -24
- package/dist/views/record/index.js +1 -1
- package/package.json +1 -1
|
@@ -20,12 +20,12 @@ import type { SortState } from "../../primitives/table/sorting.js";
|
|
|
20
20
|
import type { LucideIcon } from "lucide-react";
|
|
21
21
|
import type { ReactNode } from "react";
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* The six ways of looking at a set. The union lives in `list/set.ts`, which
|
|
24
|
+
* is where its copy already lived.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* The six are the SAME set looked at differently, and that is why they share a bar.
|
|
27
|
+
* What changes between them is what the code knows about the columns — and, in the
|
|
28
|
+
* pivot, that the screen's rows are no longer the set's rows.
|
|
29
29
|
*/
|
|
30
30
|
export type { ListPresent };
|
|
31
31
|
/** What an item looks like when the presentation is rows. */
|
|
@@ -119,44 +119,44 @@ export type ListEmpty = {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* A list's grouping: the CONTRACT of `system/grouping.ts` plus the only thing
|
|
123
|
+
* a table needs on top.
|
|
124
124
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
125
|
+
* The six presentations split the set with the SAME tree and the same
|
|
126
|
+
* keys — the table included. The only thing a table adds is a question of
|
|
127
|
+
* VISIBILITY: grouping by a field whose column is hidden would leave buckets
|
|
128
|
+
* whose criterion is seen nowhere, so that column is restored, and to
|
|
129
|
+
* restore it we must know which one it is. That is `columnOf`, and nothing more: the bucket's
|
|
130
|
+
* key does not come from a column.
|
|
131
131
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
132
|
+
* It goes here and not in the contract so that a view with no columns does not have
|
|
133
|
+
* to pretend it has them.
|
|
134
134
|
*/
|
|
135
135
|
export type ListGroup<T extends object> = Grouping<T> & {
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
136
|
+
/** Which COLUMN answers for each level, to restore it when it is hidden.
|
|
137
|
+
* Without this, the one called like the field or the one that declares it in `field`. */
|
|
138
138
|
columnOf?: (level: GroupLevel) => string | undefined;
|
|
139
139
|
};
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
141
|
+
* A list's SHEET: the columns and how each cell is read.
|
|
142
142
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
143
|
+
* It is declared when the columns come from the FILE and the code does not know which
|
|
144
|
+
* they are. For a set of records it is not needed: it comes from the `columns` the
|
|
145
|
+
* list already declared.
|
|
146
146
|
*/
|
|
147
147
|
export type ListSheet<T> = {
|
|
148
148
|
columns: readonly SheetColumn[];
|
|
149
|
-
/**
|
|
150
|
-
*
|
|
149
|
+
/** A cell's value. `null` is a missing value and `""` an empty cell: they are
|
|
150
|
+
* different things and the engine tells them apart, so the interface does too. */
|
|
151
151
|
cell: (item: T, column: SheetColumn, columnIndex: number) => string | number | null;
|
|
152
|
-
/**
|
|
152
|
+
/** Which cells are painted and with what: an imputed value, an out-of-range one. */
|
|
153
153
|
tone?: (item: T, column: SheetColumn, columnIndex: number) => Tone | undefined;
|
|
154
154
|
note?: (item: T, column: SheetColumn, columnIndex: number) => string | undefined;
|
|
155
155
|
height?: number | "auto";
|
|
156
|
-
/**
|
|
156
|
+
/** What the fixed column on the left says. Without this, the row number. */
|
|
157
157
|
rowLabel?: (item: T, index: number) => string;
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
158
|
+
/** Present = the sheet is edited as a sheet. It receives the raw text;
|
|
159
|
+
* converting it to the column's type is the domain's job, not this layer's. */
|
|
160
160
|
onCommit?: (item: T, column: SheetColumn, columnIndex: number, next: string) => void;
|
|
161
161
|
editable?: (item: T, column: SheetColumn, columnIndex: number) => boolean;
|
|
162
162
|
/** Present = the sheet adds rows: «add a row» under it, and `Enter` on the last row.
|
|
@@ -164,65 +164,65 @@ export type ListSheet<T> = {
|
|
|
164
164
|
onAddRow?: () => void;
|
|
165
165
|
};
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
167
|
+
* A list's REPORT: the periods and the hierarchy that ends in totals.
|
|
168
168
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
169
|
+
* The rows go apart from `items` and that is deliberate: a balance is not the flat
|
|
170
|
+
* grouped list —«Total Activos» is a sum of sums— and the archetype cannot
|
|
171
|
+
* invent that hierarchy. Whoever knows the domain builds it, as they already build
|
|
172
172
|
* `columns`.
|
|
173
173
|
*/
|
|
174
174
|
export type ListReport = {
|
|
175
175
|
columns: readonly ReportColumn[];
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
177
|
+
* The report's lines, when the DOMAIN builds them.
|
|
178
178
|
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
179
|
+
* A balance is not the flat grouped list —«Total Activos» is a sum of
|
|
180
|
+
* sums— and the archetype cannot invent that hierarchy.
|
|
181
181
|
*
|
|
182
|
-
* **
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
182
|
+
* **Without this, the report is built from the buckets**: each level is a line
|
|
183
|
+
* with its aggregates, and the deepest are the rows. It is the same set the
|
|
184
|
+
* other four presentations see, counted — which is what someone expects
|
|
185
|
+
* when going from «tabla» to «informe» with two levels set.
|
|
186
186
|
*/
|
|
187
187
|
rows?: readonly ReportRow[];
|
|
188
|
-
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
188
|
+
/** Which groups start open. None by default: a balance with everything
|
|
189
|
+
* unfolded is four hundred lines and what is looked at first is the
|
|
190
|
+
* totals. */
|
|
191
191
|
defaultOpen?: readonly string[];
|
|
192
192
|
height?: number;
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* A list's PIVOT: the two axes and the measures folded at the crossing.
|
|
196
196
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
197
|
+
* It is the presentation in which **the screen's rows stop being the
|
|
198
|
+
* records**: a row is a bucket and so is a column, so there is nothing
|
|
199
|
+
* to choose or to open, and what is read is at the crossing.
|
|
200
200
|
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
201
|
+
* Hence it comes folded from two possible places, just like the buckets of
|
|
202
|
+
* a grouped list:
|
|
203
203
|
*
|
|
204
|
-
* folded
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* spec
|
|
204
|
+
* folded folded by whoever keeps the data. It is the normal case as soon as the
|
|
205
|
+
* set does not fit in the browser: counting 187 overdue ones cannot be
|
|
206
|
+
* answered by the twelve rows that were downloaded.
|
|
207
|
+
* spec folded by this machine, with the rows in hand.
|
|
208
208
|
*
|
|
209
|
-
*
|
|
209
|
+
* Both draw the same because they draw the same type.
|
|
210
210
|
*/
|
|
211
211
|
export type ListPivot<T> = {
|
|
212
|
-
/**
|
|
213
|
-
*
|
|
212
|
+
/** The already folded pivot. It wins over `spec` when both are present: if someone
|
|
213
|
+
* with the whole set already answered, there is nothing to recompute. */
|
|
214
214
|
folded?: Pivot;
|
|
215
215
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
216
|
+
* How to build it in here. The measures bring their fold, and the margins come
|
|
217
|
+
* from the BASE and not from summing cells — see `system/pivot.ts`.
|
|
218
218
|
*
|
|
219
|
-
*
|
|
220
|
-
* `downloadPivot`,
|
|
221
|
-
* `folded`:
|
|
222
|
-
*
|
|
219
|
+
* Whoever also needs the grid IN HAND —to download it as a sheet with
|
|
220
|
+
* `downloadPivot`, for example— folds it with `pivotFrom` and passes it through
|
|
221
|
+
* `folded`: that way the one drawn and the one downloaded are the same object, and not
|
|
222
|
+
* two that might not match.
|
|
223
223
|
*/
|
|
224
224
|
spec?: PivotSpec<T>;
|
|
225
|
-
/**
|
|
225
|
+
/** What happens when a crossing is pressed: open the rows that fell there. */
|
|
226
226
|
onCell?: (row: PivotKey, column: PivotKey) => void;
|
|
227
227
|
height?: number | string;
|
|
228
228
|
/** The fields the person may pivot by. With them (and `spec`) the pivot is EXPLORED — axes,
|
|
@@ -233,33 +233,33 @@ export type ListPivot<T> = {
|
|
|
233
233
|
defaultMeasures?: readonly string[];
|
|
234
234
|
};
|
|
235
235
|
/**
|
|
236
|
-
*
|
|
237
|
-
* `Pivot`,
|
|
238
|
-
*
|
|
239
|
-
*
|
|
236
|
+
* A list's CHART: Odoo's graph view. It reads the same as the pivot —a
|
|
237
|
+
* `Pivot`, folded here with `spec` or outside with `folded`— and draws it as bars, lines or
|
|
238
|
+
* a pie. Its levels FOLLOW the search's grouping: the first goes on the axis and the rest
|
|
239
|
+
* are the series, as in Odoo.
|
|
240
240
|
*/
|
|
241
241
|
export type ListChart<T> = {
|
|
242
|
-
/**
|
|
242
|
+
/** Folded by whoever keeps the data. Its axes are its own and are not edited here. */
|
|
243
243
|
folded?: Pivot;
|
|
244
|
-
/**
|
|
244
|
+
/** How to fold it here, with the rows in hand: `rows` is the axis, `columns` the series. */
|
|
245
245
|
spec?: PivotSpec<T>;
|
|
246
|
-
/**
|
|
246
|
+
/** Which fields it can be split by. With this the axes are chosen on the chart. */
|
|
247
247
|
fields?: readonly GroupableField[];
|
|
248
|
-
/**
|
|
248
|
+
/** The measure it opens with. The first of `spec.measures`; `COUNT_MEASURE` for the count. */
|
|
249
249
|
defaultMeasure?: string;
|
|
250
|
-
/**
|
|
250
|
+
/** Several measures, each its own chart (never two scales on one axis). */
|
|
251
251
|
defaultMeasures?: readonly string[];
|
|
252
252
|
kind?: ChartKind;
|
|
253
|
-
/**
|
|
253
|
+
/** How it opens: stacked (the default, as in Odoo), cumulative, ordered. */
|
|
254
254
|
stacked?: boolean;
|
|
255
255
|
cumulative?: boolean;
|
|
256
256
|
order?: ChartOrder;
|
|
257
|
-
/**
|
|
257
|
+
/** The previous period, to draw beside it: the records of then and their names. */
|
|
258
258
|
compare?: ChartComparison<T>;
|
|
259
|
-
/**
|
|
259
|
+
/** A bar, a point or a slice: open the records that fell there. */
|
|
260
260
|
onPoint?: (category: PivotKey, series?: PivotKey) => void;
|
|
261
261
|
height?: number | string;
|
|
262
|
-
/**
|
|
262
|
+
/** The name it is downloaded under. */
|
|
263
263
|
fileName?: string;
|
|
264
264
|
};
|
|
265
265
|
export type ListViewProps<T extends object> = {
|
|
@@ -289,13 +289,13 @@ export type ListViewProps<T extends object> = {
|
|
|
289
289
|
actions?: ReactNode;
|
|
290
290
|
row: (item: T) => RowOf;
|
|
291
291
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* —
|
|
292
|
+
* The labels of a row's zones, above all of them. Without this there is no
|
|
293
|
+
* header: `rows` is not a table and not every list has something to label
|
|
294
|
+
* —a list of five files with the name and nothing else does not need it.
|
|
295
295
|
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
296
|
+
* They are not columns. A row has a name, ONE already formatted `meta`
|
|
297
|
+
* string and a column of chips: that is what is labelled, and that is why the
|
|
298
|
+
* labels are written by the view and do not come from `columns`.
|
|
299
299
|
*/
|
|
300
300
|
rowHeader?: {
|
|
301
301
|
name: string;
|
|
@@ -314,13 +314,13 @@ export type ListViewProps<T extends object> = {
|
|
|
314
314
|
sort?: readonly SortState[];
|
|
315
315
|
onSortChange?: (next: SortState[]) => void;
|
|
316
316
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
317
|
+
* Which fields it can be sorted by, for the presentations that do NOT have
|
|
318
|
+
* headers to click on.
|
|
319
319
|
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
320
|
+
* Without this, sorting exists only in the table — and then switching to rows or to
|
|
321
|
+
* a board does not lose the order set, it loses the ability to sort. The
|
|
322
|
+
* table also keeps its headers: they are two doors to the same thing, and
|
|
323
|
+
* the headers' one is faster where it exists.
|
|
324
324
|
*/
|
|
325
325
|
sortable?: readonly SortField<T>[];
|
|
326
326
|
/** The footer with the aggregates of the columns that declared one. */
|
|
@@ -343,35 +343,35 @@ export type ListViewProps<T extends object> = {
|
|
|
343
343
|
/** The planning presentation: records grouped in rows across time (Odoo's Gantt). */
|
|
344
344
|
timeline?: ListTimeline<T>;
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
346
|
+
* The SHEET. With this, `present="sheet"` draws a `SheetTable`.
|
|
347
347
|
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
348
|
+
* It is the presentation of raw data, and that is why it does not receive `DataColumn`:
|
|
349
|
+
* the columns come from the file and the code does not know which they are or how many.
|
|
350
|
+
* The value is requested by index —like `SheetTable`, which is virtualised—
|
|
351
|
+
* so a million rows are not copied into any other structure.
|
|
352
352
|
*/
|
|
353
353
|
sheet?: ListSheet<T>;
|
|
354
354
|
/**
|
|
355
|
-
*
|
|
356
|
-
* `present="report"`
|
|
355
|
+
* The REPORT: a hierarchy that ends in totals. With this,
|
|
356
|
+
* `present="report"` draws a `ReportTable`.
|
|
357
357
|
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
358
|
+
* The rows go apart from `items` and that is deliberate: a balance is NOT the flat
|
|
359
|
+
* grouped list —«Total Activos» is not a bucket of accounts, it is a sum of
|
|
360
|
+
* sums— and the archetype cannot invent that hierarchy from the
|
|
361
|
+
* set. Whoever knows the domain builds it, as they already build `columns`.
|
|
362
362
|
*/
|
|
363
363
|
report?: ListReport;
|
|
364
364
|
/**
|
|
365
|
-
*
|
|
365
|
+
* The PIVOT: two axes at once. With this, `present="pivot"` draws a
|
|
366
366
|
* `PivotTable`.
|
|
367
367
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
368
|
+
* It goes apart from `group` and not derived from it although both split the set,
|
|
369
|
+
* because a pivot splits by TWO axes and a grouped list by one: the
|
|
370
|
+
* levels of `group` do not say which of them would be the horizontal axis, and
|
|
371
|
+
* choosing it here would be guessing the question.
|
|
372
372
|
*/
|
|
373
373
|
pivot?: ListPivot<T>;
|
|
374
|
-
/**
|
|
374
|
+
/** The CHART: the pivot drawn. With this, `present="chart"` draws a `ChartExplorer`. */
|
|
375
375
|
chart?: ListChart<T>;
|
|
376
376
|
/** The presentations the application wrote (`List.Present`), by id. */
|
|
377
377
|
faces?: readonly ListFace<T>[];
|
|
@@ -407,13 +407,13 @@ export type ListViewProps<T extends object> = {
|
|
|
407
407
|
/** The three states, in a single place. Every view used to re-assemble them
|
|
408
408
|
* with three nested ternaries, and that is why «empty because of a filter»
|
|
409
409
|
* and «really empty» got mixed up in half the screens. */
|
|
410
|
-
/**
|
|
410
|
+
/** The set's states, in a single place.
|
|
411
411
|
*
|
|
412
|
-
* `loading`
|
|
413
|
-
* `refreshing`
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
412
|
+
* `loading` is the FIRST reading: there are no rows yet, and the skeleton is drawn.
|
|
413
|
+
* `refreshing` is asking again with rows in hand —something was typed in the search, the
|
|
414
|
+
* page changed—: the rows stay and a discreet bar says that a question is
|
|
415
|
+
* being asked. Swapping them for a skeleton on every question made the table flicker, and a
|
|
416
|
+
* click could land on a row that was no longer there. */
|
|
417
417
|
state?: {
|
|
418
418
|
loading?: boolean;
|
|
419
419
|
refreshing?: boolean;
|
|
@@ -66,17 +66,17 @@ type ActionsProps = {
|
|
|
66
66
|
};
|
|
67
67
|
type StatusProps = {
|
|
68
68
|
stages?: readonly Stage[];
|
|
69
|
-
/**
|
|
69
|
+
/** Which of the stages is the current one. Without this, the first. */
|
|
70
70
|
current?: string;
|
|
71
71
|
failed?: boolean;
|
|
72
72
|
/** The stages can be chosen: pressing one moves the record there (a CRM's pipeline). */
|
|
73
73
|
onSelect?: (id: string) => void;
|
|
74
|
-
/**
|
|
74
|
+
/** The status escape hatch, for whatever is neither of the two. */
|
|
75
75
|
children?: ReactNode;
|
|
76
76
|
};
|
|
77
77
|
type PaperProps = {
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
78
|
+
/** How the fields inside place their label. `horizontal` is label |
|
|
79
|
+
* value, which is Odoo's form. */
|
|
80
80
|
layout?: SheetLayout;
|
|
81
81
|
columns?: 1 | 2 | 3 | 4;
|
|
82
82
|
/** `reading` (default): the sheet stops at a reading width, centred, with the rail lined
|
|
@@ -95,14 +95,14 @@ type PagesProps = {
|
|
|
95
95
|
type PageProps = {
|
|
96
96
|
id: string;
|
|
97
97
|
label: string;
|
|
98
|
-
/**
|
|
99
|
-
*
|
|
98
|
+
/** The face's mark. With three or more tabs, the icon is what is
|
|
99
|
+
* recognised without reading. */
|
|
100
100
|
icon?: LucideIcon;
|
|
101
|
-
/**
|
|
102
|
-
*
|
|
101
|
+
/** How many things there are behind. `0` is drawn muted: «no hay ninguna» is an
|
|
102
|
+
* answer, and hiding it forces opening the tab to find out. */
|
|
103
103
|
count?: number;
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
104
|
+
/** That something on this face ASKS you to look at it — it failed, changed, arrived. Separate from
|
|
105
|
+
* the counter, because they are two questions: see `TabNotice`. */
|
|
106
106
|
notice?: TabNotice;
|
|
107
107
|
children?: ReactNode;
|
|
108
108
|
};
|
|
@@ -125,11 +125,11 @@ export type RecordActivityProps = Omit<ActivityProps, "open" | "onToggle" | "ale
|
|
|
125
125
|
};
|
|
126
126
|
export type RecordProps = {
|
|
127
127
|
identity: RecordIdentity;
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
128
|
+
/** What failed when operating on the record. It goes with the blocking notices, first:
|
|
129
|
+
* between the rail and the paper, always in view (see `Record.Notice`). */
|
|
130
130
|
error?: string | null;
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
131
|
+
/** There are unsaved changes. Its presence REPLACES the action buttons with
|
|
132
|
+
* save and discard — see the note in `RecordHeader`. */
|
|
133
133
|
dirty?: DirtyState;
|
|
134
134
|
/**
|
|
135
135
|
* Where the record is mounted — and so whether it sits on paper.
|
|
@@ -17,24 +17,24 @@ import { createNoteRegistry, NoteRegistryContext, } from "../../primitives/field
|
|
|
17
17
|
import { Tabs, TabsPanel, TabsScope, } from "../../primitives/tabs/Tabs.js";
|
|
18
18
|
import { useEffect, useId, useState, useSyncExternalStore } from "react";
|
|
19
19
|
const pick = (nodes, name) => pickSlot(nodes, name);
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
20
|
+
/** The rail: my place in front of the record. Without it, there is no band — and that
|
|
21
|
+
* is exactly what a dialog wants. */
|
|
22
22
|
const Rail = slot("rail", (_props) => null);
|
|
23
23
|
const Crumbs = slot("crumbs", (_props) => null);
|
|
24
24
|
const PagerSlot = slot("pager", (_props) => null);
|
|
25
25
|
const Smart = slot("smart", (_props) => null);
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
/** The action buttons. At most three visible + a `Menu` with `iconOnly`, and
|
|
27
|
+
* the rule for which three: the ones that PRODUCE something new, never the ones that navigate.
|
|
28
|
+
* They go without `surface`: they take it from the rail (light by default; dark with `Rail surface="chrome"`).
|
|
29
29
|
*
|
|
30
30
|
* Context: on a narrow record (a phone, below `--container-handheld`) the one written
|
|
31
31
|
* with `role="primary"` leaves the rail for a bar stuck to the bottom of the screen,
|
|
32
32
|
* where the thumb is — and with `dirty`, Save and Discard take that bar instead. The
|
|
33
33
|
* rest stay here. Nothing to declare: see THE THUMB BAR in `RecordHeader`. */
|
|
34
34
|
const Actions = slot("actions", (_props) => null);
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
/** The status, as DATA and not as a node: the bar lives in the rail and
|
|
36
|
+
* whoever passed it already built had to remember the rail's surface. Forgetting it
|
|
37
|
+
* painted the canvas palette on top of the chrome, and it happened. */
|
|
38
38
|
const Status = slot("status", (_props) => null);
|
|
39
39
|
/** What has to be known about THIS record before acting on it: «este cliente tiene
|
|
40
40
|
* Bs. 1.200 en créditos pendientes · Aplicar», «posible factura duplicada», «vencida
|
|
@@ -58,14 +58,14 @@ const NoticeSlot = slot("notice", (_props) => null);
|
|
|
58
58
|
const RibbonSlot = slot("ribbon", (_props) => null);
|
|
59
59
|
/** Who created the record and who changed it last, on the paper's last line. */
|
|
60
60
|
const AuditSlot = slot("audit", (_props) => null);
|
|
61
|
-
/**
|
|
61
|
+
/** The paper: the record. The white `<sheet>` on the floor. */
|
|
62
62
|
const Paper = slot("paper", (_props) => null);
|
|
63
63
|
const ActivitySlot = slot("activity", (_props) => null);
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
64
|
+
/** The record's global facts. They are on ALL the pages, and that is why they go
|
|
65
|
+
* above the notebook and not inside one. */
|
|
66
66
|
const Facts = slot("facts", (_props) => null);
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
67
|
+
/** The notebook. The tabs come from the pages it holds: a page
|
|
68
|
+
* that is not written has no tab, and that is the whole declaration. */
|
|
69
69
|
const Pages = slot("pages", (_props) => null);
|
|
70
70
|
const Page = slot("page", (_props) => null);
|
|
71
71
|
/** The notebook's tabs and its page share an id — only when there are tabs. */
|
|
@@ -79,8 +79,8 @@ export function Record({ identity, error = null, dirty, placement, children }) {
|
|
|
79
79
|
const railNode = pick(top, "rail");
|
|
80
80
|
const paperNode = pick(top, "paper");
|
|
81
81
|
const activitySlot = propsOf(pick(top, "activity"));
|
|
82
|
-
/*
|
|
83
|
-
|
|
82
|
+
/* The escape hatch: what the archetype did not foresee is drawn anyway, on the paper.
|
|
83
|
+
Something showing up here is the sign that the archetype is missing a piece. */
|
|
84
84
|
const loose = top.filter((node) => slotOf(node) !== "rail" && slotOf(node) !== "paper" && slotOf(node) !== "activity");
|
|
85
85
|
const rail = flatten(propsOf(railNode)?.children);
|
|
86
86
|
const crumbs = propsOf(pick(rail, "crumbs"))?.crumbs;
|
|
@@ -88,8 +88,8 @@ export function Record({ identity, error = null, dirty, placement, children }) {
|
|
|
88
88
|
const smart = propsOf(pick(rail, "smart"))?.links;
|
|
89
89
|
const actions = propsOf(pick(rail, "actions"))?.children;
|
|
90
90
|
const status = propsOf(pick(rail, "status"));
|
|
91
|
-
/*
|
|
92
|
-
está?»
|
|
91
|
+
/* The status's two questions, with the surface already resolved: «¿dónde
|
|
92
|
+
está?» and «¿qué pasó para llegar acá?». */
|
|
93
93
|
/* The same question `RecordHeader` asks to draw the rail (`status` included): asked
|
|
94
94
|
differently here, a record with only a status drew a `chrome` rail light until the first
|
|
95
95
|
keystroke, and dark from then on. */
|
|
@@ -101,9 +101,9 @@ export function Record({ identity, error = null, dirty, placement, children }) {
|
|
|
101
101
|
const railSurface = propsOf(railNode)?.surface ?? "canvas";
|
|
102
102
|
const surface = onTheRail && d === "comfortable" ? railSurface : "canvas";
|
|
103
103
|
const statusBlock = status === undefined ? undefined : (
|
|
104
|
-
/*
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
/* Stacked in one block: above where it is, below what happened to get there.
|
|
105
|
+
Side by side they competed for width with the buttons and both ended up
|
|
106
|
+
truncated; one under the other, each has its whole line. */
|
|
107
107
|
_jsxs("div", { className: "flex min-w-0 flex-col items-end gap-1.5", children: [status.stages === undefined ? null : (_jsx(StatusBar, { stages: status.stages, current: status.current ?? status.stages[0]?.id ?? "", failed: status.failed ?? false, surface: surface, ...(status.onSelect === undefined ? {} : { onSelect: status.onSelect }) })), status.children] }));
|
|
108
108
|
const paper = propsOf(paperNode);
|
|
109
109
|
const inPaper = [...flatten(paper?.children), ...loose];
|
|
@@ -157,10 +157,10 @@ export function Record({ identity, error = null, dirty, placement, children }) {
|
|
|
157
157
|
const pageBody = pages
|
|
158
158
|
.map((node) => propsOf(node))
|
|
159
159
|
.find((page) => page?.id === current)?.children;
|
|
160
|
-
/*
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
/* The reading order is the screen order: what is written ABOVE the
|
|
161
|
+
notebook is drawn above —what used to be `sheetBody`—, what is written
|
|
162
|
+
below is drawn below the current page. With no notebook, the paper is
|
|
163
|
+
its children in order and there is no second rule. */
|
|
164
164
|
const notebookAt = inPaper.findIndex((node) => slotOf(node) === "pages");
|
|
165
165
|
const free = (nodes) => nodes.filter((node) => slotOf(node) === undefined);
|
|
166
166
|
const above = notebookAt === -1 ? [] : free(inPaper.slice(0, notebookAt));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* RECORD — a record and its form: the rail and its pieces, and the tree that composes them. */
|
|
2
2
|
export { Record, } from "./Record.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "An enterprise web design system for business software — ERPs, back offices, management tools — in React and Tailwind: tokens, primitives, components and the two views every management screen is made of.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|