@sincpro/web-ui 2.0.0 → 2.2.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/README.md +45 -0
- 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/attachments/Attachments.d.ts +7 -1
- package/dist/components/attachments/Attachments.js +8 -2
- package/dist/components/board/Board.d.ts +32 -2
- package/dist/components/board/Board.js +27 -4
- package/dist/components/board/index.d.ts +1 -1
- package/dist/components/board/index.js +2 -1
- 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 +27 -27
- 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/NavigationTree.js +2 -2
- 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 +140 -117
- 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.d.ts +9 -2
- package/dist/components/shell/AppFrame.js +102 -14
- package/dist/components/shell/Sidebar.d.ts +34 -0
- package/dist/components/shell/Sidebar.js +32 -0
- package/dist/components/shell/TopBar.d.ts +2 -0
- package/dist/components/shell/TopBar.js +13 -9
- package/dist/components/shell/index.d.ts +2 -0
- package/dist/components/shell/index.js +5 -1
- package/dist/components/shell/sidebarDrawer.d.ts +26 -0
- package/dist/components/shell/sidebarDrawer.js +22 -0
- 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 +109 -94
- package/dist/foundations/copy.es.js +10 -2
- package/dist/foundations/copy.js +10 -2
- 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/field/DropZone.d.ts +22 -3
- package/dist/primitives/field/DropZone.js +33 -12
- package/dist/primitives/menu/Menu.d.ts +10 -6
- package/dist/primitives/menu/Menu.js +4 -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 +4 -30
- package/dist/primitives/tag/Count.d.ts +23 -0
- package/dist/primitives/tag/Count.js +59 -0
- package/dist/primitives/tag/index.d.ts +1 -0
- package/dist/primitives/tag/index.js +5 -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/primitives/value/Metric.d.ts +7 -2
- package/dist/primitives/value/Metric.js +12 -4
- package/dist/tokens.css +164 -57
- 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 @@ type NodeProps = {
|
|
|
20
20
|
type RowsProps<T> = {
|
|
21
21
|
row: (item: T) => RowOf;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* The labels of a row's zones, above all of them. Without this there is no
|
|
24
|
+
* header: a list of five files with the name and nothing else does not
|
|
25
|
+
* need it.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* They are not columns. A row has a name, ONE already formatted `meta` string
|
|
28
|
+
* and a column of chips: that is what is labelled.
|
|
29
29
|
*/
|
|
30
30
|
header?: {
|
|
31
31
|
name: string;
|
|
@@ -35,30 +35,30 @@ type RowsProps<T> = {
|
|
|
35
35
|
};
|
|
36
36
|
type TableProps<T extends object> = {
|
|
37
37
|
columns: readonly DataColumn<T>[];
|
|
38
|
-
/**
|
|
38
|
+
/** Which ones are on screen. Required ones stay even if omitted. */
|
|
39
39
|
visibleColumnIds?: readonly string[];
|
|
40
40
|
onVisibleColumnIdsChange?: (ids: readonly string[]) => void;
|
|
41
|
-
/**
|
|
41
|
+
/** The footer with the aggregates of the columns that declared one. */
|
|
42
42
|
totals?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
43
|
+
/** What is done to ONE row without entering it. They are drawn hidden and appear
|
|
44
|
+
* on the row being pointed at. */
|
|
45
45
|
rowActions?: (item: T) => readonly RowAction[];
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
46
|
+
/** Write a new record as one more row of the table (Odoo's editable
|
|
47
|
+
* list). See `DataTable`'s header. */
|
|
48
48
|
create?: DataTableCreate<T>;
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
/** The board. Without `card`, the card comes from what `List.Rows` already says: the
|
|
51
|
+
* name, the `meta` and the chips. Writing it anyway is declaring that THIS list
|
|
52
|
+
* can be seen as a board. */
|
|
53
53
|
type BoardProps<T> = {
|
|
54
54
|
/** `ways` carries the list's rule of what a press does — call `ways.press` from the card. */
|
|
55
55
|
card?: (item: T, ways: CardWays) => ReactNode;
|
|
56
56
|
/** One column per stage, with drag (and Alt + ← / →) to move a card between them. */
|
|
57
57
|
stages?: BoardStages<T>;
|
|
58
58
|
};
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
/** The sheet. Without columns of its own, it comes from those `List.Table` declared — the
|
|
60
|
+
* one for RAW data does bring them, because there they come from the file and the code does not know
|
|
61
|
+
* which they are. */
|
|
62
62
|
type SheetProps<T> = Partial<ListSheet<T>>;
|
|
63
63
|
export type ListPresentProps<T> = {
|
|
64
64
|
/** Its own name — not one of the nine the package draws. What `present` asks for. */
|
|
@@ -77,13 +77,13 @@ export type ListProps<T extends object> = {
|
|
|
77
77
|
/** The list is a FIELD of a record — a one2many / many2many — and not a screen: a
|
|
78
78
|
* one-line bar that does not stick. See «A list INSIDE a record» above. */
|
|
79
79
|
embedded?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
80
|
+
/** Which surface the BAR sits on. `canvas` (the default) is a light control
|
|
81
|
+
* bar; `chrome` turns it into a dark band, an explicit choice: the
|
|
82
|
+
* application bar is the screen's only dark band, same as a record's
|
|
83
|
+
* rail. */
|
|
84
84
|
surface?: Surface;
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
85
|
+
/** How the set is split. It belongs to the SET and not to a face: switching
|
|
86
|
+
* presentation cannot lose it. */
|
|
87
87
|
group?: ListGroup<T>;
|
|
88
88
|
selection?: {
|
|
89
89
|
has: (id: string) => boolean;
|
|
@@ -97,14 +97,14 @@ export type ListProps<T extends object> = {
|
|
|
97
97
|
onSelect: () => void;
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
100
|
+
/** The order, which also belongs to the set: a list of criteria, the first rules and the
|
|
101
|
+
* rest break ties. Empty is «como llegaron». */
|
|
102
102
|
sort?: readonly SortState[];
|
|
103
103
|
onSortChange?: (next: SortState[]) => void;
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
104
|
+
/** Which fields can be sorted by in the faces that do NOT have headers
|
|
105
|
+
* to click on. */
|
|
106
106
|
sortable?: readonly SortField<T>[];
|
|
107
|
-
/**
|
|
107
|
+
/** Which face is being looked at. Without this, the first one written. */
|
|
108
108
|
present?: ListPresent;
|
|
109
109
|
onPresentChange?: (next: ListPresent) => void;
|
|
110
110
|
onOpen?: (item: T) => void;
|
|
@@ -122,20 +122,20 @@ export type ListProps<T extends object> = {
|
|
|
122
122
|
* actions — a list to read, like the lines of a record in view mode. One switch, so whoever
|
|
123
123
|
* passes the handlers generically does not have to strip them one by one. */
|
|
124
124
|
readOnly?: boolean;
|
|
125
|
-
/**
|
|
125
|
+
/** The set's states, in a single place.
|
|
126
126
|
*
|
|
127
|
-
* `loading`
|
|
128
|
-
* `refreshing`
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
127
|
+
* `loading` is the FIRST reading: there are no rows yet, and the skeleton is drawn.
|
|
128
|
+
* `refreshing` is asking again with rows in hand —something was typed in the search, the
|
|
129
|
+
* page changed—: the rows stay and a discreet bar says that a question is
|
|
130
|
+
* being asked. Swapping them for a skeleton on every question made the table flicker, and a
|
|
131
|
+
* click could land on a row that was no longer there. */
|
|
132
132
|
state?: {
|
|
133
133
|
loading?: boolean;
|
|
134
134
|
refreshing?: boolean;
|
|
135
135
|
error?: string | null;
|
|
136
136
|
};
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
137
|
+
/** Empty BECAUSE OF A FILTER is another situation: content is not missing, a
|
|
138
|
+
* cut is in excess. */
|
|
139
139
|
filtered?: boolean;
|
|
140
140
|
empty?: ListEmpty;
|
|
141
141
|
children?: ReactNode;
|
package/dist/views/list/List.js
CHANGED
|
@@ -2,24 +2,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { flatten, loose, pick, propsOf, slot, slotOf, } from "../../foundations/slots.js";
|
|
3
3
|
import { ListView } from "./ListView.js";
|
|
4
4
|
import {} from "./types.js";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
5
|
+
/** The bar: everything that belongs to the SET and not to a row. Without it there is no
|
|
6
|
+
* band — which is what a list put inside a dialog wants. */
|
|
7
7
|
const Bar = slot("bar", (_props) => null);
|
|
8
|
-
/**
|
|
8
|
+
/** Where I came from. It goes above the bar, and only when the bar is chrome. */
|
|
9
9
|
const Crumbs = slot("crumbs", (_props) => null);
|
|
10
|
-
/**
|
|
10
|
+
/** What this list is called and how much it holds. */
|
|
11
11
|
const Identity = slot("identity", (_props) => null);
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
12
|
+
/** The search field, already assembled: it is assembled by whoever holds the domain's
|
|
13
|
+
* declarations — the system does not know what a NIT is. */
|
|
14
14
|
const Search = slot("search", (_props) => null);
|
|
15
|
-
/**
|
|
15
|
+
/** What STARTS something new. It stays visible when there is a selection. */
|
|
16
16
|
const Actions = slot("actions", (_props) => null);
|
|
17
17
|
const Pagination = slot("pagination", (_props) => null);
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
18
|
+
/** The switcher's escape hatch: a selector of one's own. Almost never needed —
|
|
19
|
+
* the written faces already draw it. */
|
|
20
20
|
const Views = slot("views", (_props) => null);
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
21
|
+
/** The metrics that also NARROW: «2 por confirmar». They go below the bar and
|
|
22
|
+
* above the rows, because they belong to the set and not to the frame. */
|
|
23
23
|
const Metrics = slot("metrics", (_props) => null);
|
|
24
24
|
const Rows = slot("rows", (_props) => null);
|
|
25
25
|
/* Through `unknown`: `create` both receives and hands back a `T` (`onChange`, `draft`),
|
|
@@ -33,9 +33,9 @@ const Pivot = slot("pivot", (_props) => null);
|
|
|
33
33
|
/** The pivot, drawn — Odoo's graph view (`ChartExplorer`). `unknown` in between: the
|
|
34
34
|
* comparison's records make the props invariant in `T`, and the slot never reads them. */
|
|
35
35
|
const ChartSlot = slot("chart", (_props) => null);
|
|
36
|
-
/*
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
/* The order in which they are OFFERED when written another way. The switcher
|
|
37
|
+
respects the tree's order; this only names which presentation each slot
|
|
38
|
+
corresponds to. */
|
|
39
39
|
const PRESENT_OF = {
|
|
40
40
|
rows: "rows",
|
|
41
41
|
table: "table",
|
|
@@ -106,9 +106,9 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
|
|
|
106
106
|
const calendar = propsOf(pick(top, "calendar"));
|
|
107
107
|
const gantt = propsOf(pick(top, "gantt"));
|
|
108
108
|
const timeline = propsOf(pick(top, "timeline"));
|
|
109
|
-
/*
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
/* The faces there are, are the ones written, IN THAT ORDER. The switcher
|
|
110
|
+
cannot offer one that cannot be drawn, because the one drawn and the
|
|
111
|
+
one offered are the same node. */
|
|
112
112
|
const faces = facesOf(top);
|
|
113
113
|
const presents = top.flatMap((node) => {
|
|
114
114
|
const name = slotOf(node);
|
|
@@ -117,8 +117,8 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
|
|
|
117
117
|
const builtIn = name === undefined ? undefined : PRESENT_OF[name];
|
|
118
118
|
return builtIn === undefined ? [] : [builtIn];
|
|
119
119
|
});
|
|
120
|
-
/*
|
|
121
|
-
|
|
120
|
+
/* The escape hatch: what the archetype did not foresee is drawn anyway, below.
|
|
121
|
+
Something showing up here is the sign that the archetype is missing a piece. */
|
|
122
122
|
const rest = loose(top, ["bar", "metrics", "present", ...FACES]);
|
|
123
123
|
return (_jsx(ListView, { items: items, keyOf: keyOf, row: rows === undefined
|
|
124
124
|
? () => ({ name: "" })
|
|
@@ -43,10 +43,10 @@ const ChartExplorer = lazy(() => import("../../components/listing/ChartExplorer.
|
|
|
43
43
|
default: module.ChartExplorer,
|
|
44
44
|
})));
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
46
|
+
* THE DRAWING of a list. **The door is `List`**, which is written as a tree and
|
|
47
|
+
* translates the slots into this — here everything comes in as props because here
|
|
48
|
+
* everything has already been decided: whoever composes does not choose between two ways of writing the same thing,
|
|
49
|
+
* because this is not published.
|
|
50
50
|
*
|
|
51
51
|
* Context: `invoices.view.tsx` has 349 lines and about 120 of them are
|
|
52
52
|
* re-assembling this: the bar, the search field, the grouping and the three
|
|
@@ -71,10 +71,10 @@ const PRESENT_ICONS = [
|
|
|
71
71
|
{ id: "table", icon: Table2 },
|
|
72
72
|
{ id: "board", icon: LayoutGrid },
|
|
73
73
|
{ id: "sheet", icon: Sheet },
|
|
74
|
-
/*
|
|
75
|
-
|
|
74
|
+
/* The sigma and not a table icon: what sets a report apart from the other
|
|
75
|
+
four is that it SUMS. */
|
|
76
76
|
{ id: "report", icon: Sigma },
|
|
77
|
-
/*
|
|
77
|
+
/* The grid: two axes, and what matters is inside. */
|
|
78
78
|
{ id: "pivot", icon: Grid3x3 },
|
|
79
79
|
/* El mismo pivote, dibujado. */
|
|
80
80
|
{ id: "chart", icon: ChartColumnBig },
|
|
@@ -100,18 +100,18 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
100
100
|
const columnSpecs = useMemo(() => specsFromColumns(columns ?? [], false), [columns]);
|
|
101
101
|
const columnControl = useColumnControl(columnSpecs, {
|
|
102
102
|
...(visibleColumnIds === undefined ? {} : { visibleIds: visibleColumnIds }),
|
|
103
|
-
/*
|
|
104
|
-
`onVisibleColumnIdsChange` —
|
|
105
|
-
`onVisibleIdsChange`,
|
|
106
|
-
|
|
103
|
+
/* The name has to be the one `useColumnControl` reads. It said
|
|
104
|
+
`onVisibleColumnIdsChange` —the name of the prop HERE— and the hook looks for
|
|
105
|
+
`onVisibleIdsChange`, so it never entered controlled mode: the list
|
|
106
|
+
silently ignored the columns it was given. */
|
|
107
107
|
...(onVisibleColumnIdsChange === undefined
|
|
108
108
|
? {}
|
|
109
109
|
: { onVisibleIdsChange: onVisibleColumnIdsChange }),
|
|
110
110
|
});
|
|
111
|
-
/*
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
/* Grouping by a hidden column would leave buckets whose criterion is not seen.
|
|
112
|
+
With N levels there are N columns, and all are restored. It is the ONLY thing for which
|
|
113
|
+
we need to know which column answers for a field: the table no longer groups
|
|
114
|
+
by columns, it groups by levels. */
|
|
115
115
|
const groupedIds = group === undefined ? [] : groupedColumnIds(group, columns);
|
|
116
116
|
const tableIds = groupedIds.every((id) => columnControl.visibleIds.includes(id))
|
|
117
117
|
? columnControl.visibleIds
|
|
@@ -135,30 +135,30 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
135
135
|
(options.length > 1 ? (_jsx(ViewSwitcher, { options: options, current: present, ...(onPresentChange === undefined ? {} : { onSelect: onPresentChange }), ...(surface === undefined ? {} : { surface }) })) : undefined);
|
|
136
136
|
const sheetFromDeclared = useMemo(() => sheetFromColumns(shownColumns), [shownColumns]);
|
|
137
137
|
const sheetSpec = sheet ?? sheetFromDeclared;
|
|
138
|
-
/*
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
/* The columns menu applies in `table` and in the DERIVED sheet —both
|
|
139
|
+
draw the columns the code declared—, and not in the raw-data sheet
|
|
140
|
+
nor in the report: there the columns come from the file or are the
|
|
141
|
+
periods, and there is none the code could offer to hide. */
|
|
142
142
|
const columnsMenu = (present === "table" || (present === "sheet" && sheet === undefined)) &&
|
|
143
143
|
columnControl.hasOptional ? (_jsx(ColumnsMenu, { control: columnControl, ...(surface === undefined ? {} : { surface }) })) : null;
|
|
144
|
-
/*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
/* SORTING. The control goes in the bar and not inside the table because the order
|
|
145
|
+
belongs to the SET, like the levels and what is folded: switching
|
|
146
|
+
presentation cannot lose it, and in rows, board and sheet there are no
|
|
147
|
+
headers to click on.
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
The only thing that is NOT sorted is a report whose rows the domain DECLARED: there
|
|
150
|
+
the order is the report —«Total activos» has to come after the
|
|
151
|
+
assets— and reordering it by amount destroys it.
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
A report built from the buckets is sorted, because it is not a
|
|
154
|
+
hierarchy someone wrote: it is this same set, counted. The rule
|
|
155
|
+
looks at `report.rows` and not at the presentation, which was the coarse version of this and
|
|
156
|
+
took the sorting away from a report that could have it. */
|
|
157
157
|
const declaredReport = present === "report" && report?.rows !== undefined;
|
|
158
|
-
/*
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
/* The pivot is not sorted from the bar either, for its own reason: its
|
|
159
|
+
rows are not the set's rows. Each axis is in the order of its
|
|
160
|
+
keys, and sorting the records below does not sort the buckets above —
|
|
161
|
+
offering it would be a control that moves and changes nothing. */
|
|
162
162
|
const sortMenu = sortable === undefined ||
|
|
163
163
|
sortable.length === 0 ||
|
|
164
164
|
declaredReport ||
|
|
@@ -209,22 +209,22 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
209
209
|
? {}
|
|
210
210
|
: { selected: selection.has(id), onSelectedChange: () => selection.toggle(id) }), children: d.children }, id));
|
|
211
211
|
};
|
|
212
|
-
/*
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
212
|
+
/* Sorting goes BEFORE grouping and not after, and it is not indifferent: grouping
|
|
213
|
+
preserves the order of appearance within each bucket, so sorting
|
|
214
|
+
first sorts the rows of each bucket. The other way round N
|
|
215
|
+
buckets would have to be reordered and the order among them would be left to chance.
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
The table sorts inside —it is TanStack— so there it is let through: sorting twice
|
|
218
|
+
breaks nothing, but it is pointless work on every render. */
|
|
219
219
|
const ordered = useMemo(() => present === "table" || sortable === undefined
|
|
220
220
|
? items
|
|
221
221
|
: sortItems(items, sortable, sort), [items, present, sortable, sort]);
|
|
222
222
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
223
|
+
* The grid to draw: the one handed in folded, or the one built
|
|
224
|
+
* with the rows in hand.
|
|
225
225
|
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
226
|
+
* It is the same decision `pilesOf` takes for the buckets, and for the same
|
|
227
|
+
* reason: who folded is not this layer's business.
|
|
228
228
|
*/
|
|
229
229
|
const pivotShown = useMemo(() => {
|
|
230
230
|
if (pivot?.folded !== undefined)
|
|
@@ -234,10 +234,10 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
234
234
|
return pivotFrom(ordered, pivot.spec);
|
|
235
235
|
}, [pivot, ordered]);
|
|
236
236
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
237
|
+
* Empty is having NOTHING to draw, and in the pivot that is not asked
|
|
238
|
+
* by counting `items`: when the grid was folded by whoever keeps the data, the
|
|
239
|
+
* screen's rows are buckets and the set may never have been
|
|
240
|
+
* downloaded. Counting the records there is covering a whole grid with «todavía no
|
|
241
241
|
* hay datos».
|
|
242
242
|
*/
|
|
243
243
|
const isEmpty = !loading &&
|
|
@@ -250,14 +250,14 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
250
250
|
/* The first record of an empty list is written in the table, not under a sentence
|
|
251
251
|
saying there is nothing. */
|
|
252
252
|
!(present === "table" && create?.draft != null);
|
|
253
|
-
/*
|
|
254
|
-
|
|
253
|
+
/* The one line that makes a view groupable: the tree it was handed, or the
|
|
254
|
+
one built with the rows in hand. */
|
|
255
255
|
const piles = useMemo(() => pilesOf(ordered, group), [group, ordered]);
|
|
256
256
|
const isOpen = useCallback((pile) => pileIsOpen(pile, group), [group]);
|
|
257
257
|
const sheetRows = useMemo(() => sheetRowsOf(piles, isOpen, columns), [piles, isOpen, columns]);
|
|
258
|
-
/*
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
/* The shape of a row of THIS list, so that the header reserves the
|
|
259
|
+
same spacers. The first is looked at and not all: the icon and the actions
|
|
260
|
+
are decided by the view for the whole list. */
|
|
261
261
|
const first = items[0];
|
|
262
262
|
const firstRow = first === undefined ? undefined : row(first);
|
|
263
263
|
/* The same foot the table draws: «Ver 50 más de 49.950», or «Se muestran 500 de …». */
|
|
@@ -265,9 +265,9 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
265
265
|
const foot = pileFoot(pile, group?.onMore !== undefined);
|
|
266
266
|
return foot === null ? null : (_jsx(GroupMore, { foot: foot, depth: pile.depth, onMore: () => group?.onMore?.(pile) }));
|
|
267
267
|
}
|
|
268
|
-
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
268
|
+
/** The buckets, with their rows inside. It calls itself because the tree
|
|
269
|
+
* has N levels: a bucket draws its header and, inside, either the buckets
|
|
270
|
+
* below or the rows — never both. */
|
|
271
271
|
function renderPiles(list, nodes) {
|
|
272
272
|
return list.map((pile) => {
|
|
273
273
|
const key = pathKey(pile.path);
|
|
@@ -317,13 +317,13 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
317
317
|
})) : present === "table" && shownColumns !== undefined ? (
|
|
318
318
|
/* The table receives EVERYTHING that belongs to the set: see `TablePresentation`. */
|
|
319
319
|
_jsx(TablePresentation, { items: items, columns: shownColumns, keyOf: keyOf, levels: groupLevels, ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(group === undefined ? {} : { group }), ...(selection === undefined ? {} : { selection }), totals: totals, ...(rowActions === undefined ? {} : { rowActions }), ...(create === undefined ? {} : { create }), ...(onPeek === undefined || choosing ? {} : { onPeek }), ...(onOpen === undefined || choosing ? {} : { onOpen }), ...(choosing ? { onChoose } : {}), rowClick: rowClick })) : present === "sheet" && sheetSpec !== undefined ? (
|
|
320
|
-
/*
|
|
320
|
+
/* The sheet receives the set by INDEX and not an already built matrix: see `SheetPresentation`. */
|
|
321
321
|
_jsx(SheetPresentation, { spec: sheetSpec, entries: sheetRows, ordered: ordered, ...(group === undefined ? {} : { group }) })) : present === "report" && report !== undefined ? (
|
|
322
|
-
/*
|
|
323
|
-
|
|
324
|
-
Activos»
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
/* The report declared by the domain is not SORTED from the bar: the
|
|
323
|
+
order IS the report, and sorting a balance by amount leaves «Total
|
|
324
|
+
Activos» in the middle. But it is GROUPED when the lines do not come
|
|
325
|
+
declared: there the report is this set counted by the levels that
|
|
326
|
+
are set. */
|
|
327
327
|
_jsx(ReportTable
|
|
328
328
|
/* Built from the piles, the numbers are the list's columns' — and so is how they
|
|
329
329
|
are written. Declared by the domain, the columns are the domain's. */
|
|
@@ -337,11 +337,11 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
337
337
|
_jsx("div", { className: "p-3", children: _jsx(PivotExplorer, { items: ordered, of: pivot.spec.of, fields: pivot.fields, measures: pivot.spec.measures, ...(pivot.defaultMeasures === undefined
|
|
338
338
|
? {}
|
|
339
339
|
: { defaultMeasures: pivot.defaultMeasures }), ...((group?.levels.length ?? 0) > 0 ? { rows: group.levels } : {}), defaultRows: pivot.spec.rows, defaultColumns: pivot.spec.columns, ...(pivot.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot.height === undefined ? {} : { height: pivot.height }) }) })) : present === "pivot" && pivotShown !== undefined ? (
|
|
340
|
-
/*
|
|
341
|
-
—
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
/* The pivot receives the grid and nothing else: there is no selection to pass it
|
|
341
|
+
—a checkbox per bucket would choose things that are not records—, no
|
|
342
|
+
order —each axis comes in the order of its keys— and no columns
|
|
343
|
+
menu, because the columns are an axis and not a list of fields that
|
|
344
|
+
can be hidden one by one. */
|
|
345
345
|
_jsx(PivotTable, { pivot: pivotShown, ...(pivot?.onCell === undefined ? {} : { onCell: pivot.onCell }), ...(pivot?.height === undefined ? {} : { height: pivot.height }) })) : present === "chart" &&
|
|
346
346
|
chart !== undefined &&
|
|
347
347
|
(chart.folded !== undefined || chart.spec !== undefined) ? (
|
|
@@ -365,12 +365,12 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
365
365
|
: { defaultMeasures: chart.defaultMeasures }), ...(chart.stacked === undefined ? {} : { defaultStacked: chart.stacked }), ...(chart.cumulative === undefined
|
|
366
366
|
? {}
|
|
367
367
|
: { defaultCumulative: chart.cumulative }), ...(chart.order === undefined ? {} : { defaultOrder: chart.order }), ...(chart.compare === undefined ? {} : { compare: chart.compare }), ...((group?.levels.length ?? 0) > 0 ? { levels: group.levels } : {}), ...(chart.onPoint === undefined ? {} : { onPoint: chart.onPoint }), ...(chart.height === undefined ? {} : { height: chart.height }), ...(chart.fileName === undefined ? {} : { fileName: chart.fileName }), ...(identity?.title === undefined ? {} : { label: identity.title }) }) }) })) : present === "calendar" && calendar !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordCalendar, { ...calendar, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "gantt" && gantt !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(Suspense, { fallback: _jsx(Skeleton, { label: copy.failed.loading }), children: _jsx(RecordGantt, { ...gantt, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) }) })) : present === "timeline" && timeline !== undefined ? (_jsx("div", { className: "p-3", children: _jsx(RecordTimeline, { ...timeline, items: ordered, keyOf: keyOf, ...(press === undefined ? {} : { onOpen: press }) }) })) : present === "board" && boardStages !== undefined ? (_jsx(BoardColumns, { items: ordered, keyOf: keyOf, stages: boardStages, card: renderCard })) : present === "board" ? (_jsx("div", { className: "flex flex-col", children: wrapGroups((inside) => (_jsx("div", { className: "grid gap-3 p-3 @2xl:grid-cols-2 @5xl:grid-cols-3", children: inside.map(renderCard) }))) })) : (
|
|
368
|
-
/*
|
|
369
|
-
|
|
368
|
+
/* The header goes BEFORE the buckets and not inside each one:
|
|
369
|
+
it labels the row, and the row is the same in all five buckets. */
|
|
370
370
|
_jsxs(_Fragment, { children: [rowHeader === undefined || items.length === 0 ? null : (_jsx(RowHeader, { name: rowHeader.name, ...(rowHeader.meta === undefined ? {} : { meta: rowHeader.meta }), ...(rowHeader.tags === undefined ? {} : { tags: rowHeader.tags }), withSelection: selection !== undefined,
|
|
371
|
-
/*
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
/* The spacers are asked about the FIRST row: the icon and the
|
|
372
|
+
actions belong to the whole list, not to a row — if the first has
|
|
373
|
+
no icon, none has. */
|
|
374
374
|
withIcon: firstRow?.icon !== undefined, withAvatar: firstRow?.avatar !== undefined, trail: {
|
|
375
375
|
...(firstRow?.actions === undefined ? {} : { actions: firstRow.actions }),
|
|
376
376
|
peek: onPeek !== undefined && !choosing,
|
|
@@ -381,8 +381,8 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
381
381
|
the LIST has, not the window) and fills the space it is given. Before, every page
|
|
382
382
|
wrapped it in a `div` to get both. */
|
|
383
383
|
_jsxs("div", { ref: frame, "aria-busy": refreshing || loading, className: "@container flex min-w-0 flex-1 flex-col bg-surface", children: [_jsxs(Listing, { bar: bar,
|
|
384
|
-
/*
|
|
385
|
-
|
|
384
|
+
/* The bar stays on top: with 187 rows, scrolling to see the last one
|
|
385
|
+
left you without search, without pager and without the switcher.
|
|
386
386
|
Embedded it does NOT: the record has its own sticky parts (its rail, its tabs),
|
|
387
387
|
and a second band stuck under them — or carried up into the frame's header slot,
|
|
388
388
|
which is what a sticky list bar does under a sidebar — would cover the record
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ListPresent } from "../../components/listing/set.js";
|
|
2
2
|
import type { DataColumn } from "../../primitives/table/DataTable.js";
|
|
3
3
|
import type { ListGroup } from "./types.js";
|
|
4
|
-
/**
|
|
4
|
+
/** The columns a grouped table has to SHOW, in order.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* They are not the ones it groups by —the levels do that, with the engine's key—
|
|
7
|
+
* but the ones that cannot stay hidden: a «Septiembre» bucket with the
|
|
8
|
+
* «registrado» column turned off is a cut whose criterion is not on
|
|
9
|
+
* screen.
|
|
10
10
|
*
|
|
11
|
-
* **
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* `DataColumn.field
|
|
15
|
-
*
|
|
11
|
+
* **A column's name and a field's name are not the same, and assuming so was
|
|
12
|
+
* what broke the table.** A column may be called `registered` and answer
|
|
13
|
+
* for the model's `registered_at` — which is exactly what
|
|
14
|
+
* `DataColumn.field` declares. It reads the columns in order —the one that IS CALLED like the field,
|
|
15
|
+
* then the one that declares it— and `columnOf` wins if the view knows more. */
|
|
16
16
|
export declare function groupedColumnIds<T extends object>(group: ListGroup<T>, columns: readonly DataColumn<T>[] | undefined): string[];
|
|
17
17
|
/** The presentations that need width: a grid of columns. */
|
|
18
18
|
export declare const WIDE_PRESENTS: readonly ListPresent[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The columns a grouped table has to SHOW, in order.
|
|
2
2
|
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* They are not the ones it groups by —the levels do that, with the engine's key—
|
|
4
|
+
* but the ones that cannot stay hidden: a «Septiembre» bucket with the
|
|
5
|
+
* «registrado» column turned off is a cut whose criterion is not on
|
|
6
|
+
* screen.
|
|
7
7
|
*
|
|
8
|
-
* **
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `DataColumn.field
|
|
12
|
-
*
|
|
8
|
+
* **A column's name and a field's name are not the same, and assuming so was
|
|
9
|
+
* what broke the table.** A column may be called `registered` and answer
|
|
10
|
+
* for the model's `registered_at` — which is exactly what
|
|
11
|
+
* `DataColumn.field` declares. It reads the columns in order —the one that IS CALLED like the field,
|
|
12
|
+
* then the one that declares it— and `columnOf` wins if the view knows more. */
|
|
13
13
|
export function groupedColumnIds(group, columns) {
|
|
14
14
|
return group.levels
|
|
15
15
|
.map((level) => group.columnOf?.(level) ?? columnAnswering(level.field, columns))
|