@sincpro/web-ui 2.14.0 → 2.14.2
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 +1 -1
- package/dist/components/search/CriteriaChips.js +14 -5
- package/dist/components/search/criteria.d.ts +20 -4
- package/dist/components/search/criteria.js +42 -2
- package/dist/components/search/index.d.ts +1 -1
- package/dist/primitives/table/DataTable.js +2 -1
- package/dist/primitives/table/index.d.ts +1 -0
- package/dist/primitives/table/index.js +1 -0
- package/dist/primitives/table/levels.d.ts +13 -0
- package/dist/primitives/table/levels.js +11 -0
- package/dist/views/list/ListView.js +2 -1
- package/dist/views/list/derive.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -307,7 +307,7 @@ The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`
|
|
|
307
307
|
`empty.title`, `outcome`, `outcome.figure`, `receipt`,
|
|
308
308
|
`receipt.document`, `receipt.lines`, `receipt.totals`, `kiosk`, `kiosk.attract`,
|
|
309
309
|
`kiosk.content`, `kiosk.reach`, `board.tile`,
|
|
310
|
-
`board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `file-value`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
|
|
310
|
+
`board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `file-value`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`, `search.facet-mark`,
|
|
311
311
|
`search.panel`, `search.suggestions`, `search.suggestion`, `search.record`, `search.recent`,
|
|
312
312
|
`search.advanced`, `search.keys`, `search.completion`, `search.undo`, `search.slash`, `search-entry`, `search-entry.keys`, `table`, `table.pile`, `yes-no`,
|
|
313
313
|
`table.head`, `row.ways`, `topbar`, `topbar.brand`, `topbar.menus`, `topbar.actions`, `topbar.user`,
|
|
@@ -7,7 +7,7 @@ import { WordChoice } from "./WordChoice.js";
|
|
|
7
7
|
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
8
8
|
import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
9
9
|
import { chosenTone } from "../../primitives/tag/Tag.js";
|
|
10
|
-
import { ChevronRight, Layers, X } from "lucide-react";
|
|
10
|
+
import { ChevronRight, Layers, ListFilter, X } from "lucide-react";
|
|
11
11
|
import { Fragment, useEffect, useRef, useState } from "react";
|
|
12
12
|
export function CriteriaChips({ criteria, onOpen, onJoin, onRemove, onRemoveMany, open, collapseAfter = 4, fields, onReplace, marked, editing, onEdited, surface, }) {
|
|
13
13
|
const sup = useSurface(surface);
|
|
@@ -101,11 +101,20 @@ function Node({ node, path, onOpen, onJoin, onRemove, onReplace, open, fields, e
|
|
|
101
101
|
/* The open node is marked: it is where the next thing will land. A ring and not a
|
|
102
102
|
background, because inside there are chips that already have their own. */
|
|
103
103
|
const isOpen = open !== undefined && open.join(".") === path.join(".");
|
|
104
|
-
return (_jsxs("span", { className: `inline-flex min-w-0 flex-wrap items-center gap-1 rounded-control border px-1.5 py-0.5 ${bySurface(surface, "border-line bg-ink/4", "border-chrome-ink/25 bg-chrome-ink/8")} ${isOpen ? "ring-1 ring-primary/60" : ""}`, children: [_jsx(JoinWord, { join: node.join, ...(onJoin === undefined ? {} : { onChange: (next) => onJoin(path, next) }), surface: surface }), node.of.length === 0 ? (
|
|
104
|
+
return (_jsxs("span", { className: `inline-flex min-w-0 flex-wrap items-center gap-1 rounded-control border px-1.5 py-0.5 ${bySurface(surface, "border-line bg-ink/4", "border-chrome-ink/25 bg-chrome-ink/8")} ${isOpen ? "ring-1 ring-primary/60" : ""}`, children: [_jsx(FacetMark, { path: path, surface: surface }), _jsx(JoinWord, { join: node.join, ...(onJoin === undefined ? {} : { onChange: (next) => onJoin(path, next) }), surface: surface }), node.of.length === 0 ? (
|
|
105
105
|
/* A newly opened node has nothing inside, and an empty bracket reads
|
|
106
106
|
as an error. It says it is waiting. */
|
|
107
107
|
_jsx("span", { className: `shrink-0 text-micro italic ${bySurface(surface, "text-muted", "text-chrome-muted")}`, children: copy.search.landsHere })) : null, node.of.map((child, at) => (_jsx(Node, { node: child, path: [...path, at], ...(onOpen === undefined ? {} : { onOpen }), ...(onJoin === undefined ? {} : { onJoin }), ...(onRemove === undefined ? {} : { onRemove }), ...(onReplace === undefined ? {} : { onReplace }), ...(open === undefined ? {} : { open }), ...(fields === undefined ? {} : { fields }), surface: surface }, child.id)))] }));
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* What a facet IS, said once at its start: the funnel, as the grouping chain says ⧉. Only a
|
|
111
|
+
* facet of the bar carries it (`path` of one step) — inside a node the node already says it.
|
|
112
|
+
*/
|
|
113
|
+
function FacetMark({ path, surface }) {
|
|
114
|
+
if (path.length !== 1)
|
|
115
|
+
return null;
|
|
116
|
+
return (_jsx(ListFilter, { "data-ui": "search.facet-mark", className: `size-3 shrink-0 ${bySurface(surface, "text-muted", "text-chrome-muted")}`, strokeWidth: 2, "aria-hidden": true }));
|
|
117
|
+
}
|
|
109
118
|
/** A part of a chip that is touched: a quiet hover inside the chip's own tone, and the ring. */
|
|
110
119
|
const PART = "min-w-0 rounded-control px-0.5 text-left outline-0 transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary data-focus-visible:outline-2 data-focus-visible:outline-offset-1 data-focus-visible:outline-primary";
|
|
111
120
|
function Chip({ node, path, parts, onOpen, onRemove, onReplace, editing, onEdited, surface, }) {
|
|
@@ -123,16 +132,16 @@ function Chip({ node, path, parts, onOpen, onRemove, onReplace, editing, onEdite
|
|
|
123
132
|
if (parts !== undefined) {
|
|
124
133
|
return (
|
|
125
134
|
/* The whole sentence in the title: a long value is cut at the chip's width. */
|
|
126
|
-
_jsxs("span", { "data-ui": "search.chip", "data-parts": "", title: label, className: shell, children: [_jsx(PartsOf, { node: node, path: path, parts: parts, ...(onOpen === undefined ? {} : { onOpen }), ...(onReplace === undefined ? {} : { onReplace }), editing: editing, ...(onEdited === undefined ? {} : { onEdited }), surface: surface }), remove] }));
|
|
135
|
+
_jsxs("span", { "data-ui": "search.chip", "data-parts": "", title: label, className: shell, children: [_jsx(FacetMark, { path: path, surface: surface }), _jsx(PartsOf, { node: node, path: path, parts: parts, ...(onOpen === undefined ? {} : { onOpen }), ...(onReplace === undefined ? {} : { onReplace }), editing: editing, ...(onEdited === undefined ? {} : { onEdited }), surface: surface }), remove] }));
|
|
127
136
|
}
|
|
128
137
|
if (onOpen === undefined) {
|
|
129
|
-
return (_jsxs("span", { "data-ui": "search.chip", className: shell, children: [_jsx("span", { className: "min-w-0 truncate", children: label }), remove] }));
|
|
138
|
+
return (_jsxs("span", { "data-ui": "search.chip", className: shell, children: [_jsx(FacetMark, { path: path, surface: surface }), _jsx("span", { className: "min-w-0 truncate", children: label }), remove] }));
|
|
130
139
|
}
|
|
131
140
|
/* Two SIBLING buttons in the chip — open and remove — and never one inside the other. It
|
|
132
141
|
used to be a `span role="button"` holding the × button: an interactive control inside
|
|
133
142
|
another one, which a screen reader announces as one thing and axe flags
|
|
134
143
|
(`nested-interactive`). Siblings, each with its own name, are both reachable. */
|
|
135
|
-
return (_jsxs("span", { "data-ui": "search.chip", className: shell, children: [_jsx("button", { type: "button", onClick: () => onOpen(path), title: copy.search.openBuilderHere, className: "min-w-0 truncate rounded-control text-left hover:underline hover:underline-offset-4 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary", children: label }), remove] }));
|
|
144
|
+
return (_jsxs("span", { "data-ui": "search.chip", className: shell, children: [_jsx(FacetMark, { path: path, surface: surface }), _jsx("button", { type: "button", onClick: () => onOpen(path), title: copy.search.openBuilderHere, className: "min-w-0 truncate rounded-control text-left hover:underline hover:underline-offset-4 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary", children: label }), remove] }));
|
|
136
145
|
}
|
|
137
146
|
/**
|
|
138
147
|
* The three parts of a chip the bar wrote: «cliente · contiene · andina».
|
|
@@ -101,6 +101,16 @@ export type SearchCriteria = {
|
|
|
101
101
|
* lands here (`withValue`), and the chip says «Cliente: Andrés Pérez o Andrés Gutiérrez».
|
|
102
102
|
*/
|
|
103
103
|
values?: readonly RecordOption[];
|
|
104
|
+
/**
|
|
105
|
+
* The named filters of ONE group this chip holds, when they were declared with a `group`
|
|
106
|
+
* (`toggleNamed`): Odoo's rule — filters of the same group are OR'd, groups are AND'd.
|
|
107
|
+
* «Pedidos» + «Trabajando» are one chip, «Pedidos o Trabajando», whose `selection` is
|
|
108
|
+
* `{ any: [...] }`; ticking a third adds it there, unticking the last removes the chip.
|
|
109
|
+
*/
|
|
110
|
+
named?: {
|
|
111
|
+
group: string;
|
|
112
|
+
members: readonly NamedFilterSpec[];
|
|
113
|
+
};
|
|
104
114
|
} | {
|
|
105
115
|
id: string;
|
|
106
116
|
kind: "join";
|
|
@@ -195,6 +205,14 @@ export type { GroupGrain, GroupLevel };
|
|
|
195
205
|
* The group ones stay IN FRONT, which is where they are drawn.
|
|
196
206
|
*/
|
|
197
207
|
export declare function withLevels(all: readonly SearchCriteria[], levels: readonly GroupLevel[], labelOf: (level: GroupLevel) => string): SearchCriteria[];
|
|
208
|
+
/** A filter declared in code: its id, its words and what it keeps. With a `group`, it is OR'd
|
|
209
|
+
* with the others of its group that are set (one chip), and AND'd with everything else. */
|
|
210
|
+
export type NamedFilterSpec = {
|
|
211
|
+
id: string;
|
|
212
|
+
label: string;
|
|
213
|
+
selection?: BuiltCondition | BuiltFilter;
|
|
214
|
+
group?: string;
|
|
215
|
+
};
|
|
198
216
|
/**
|
|
199
217
|
* A NAMED filter, set or removed.
|
|
200
218
|
*
|
|
@@ -203,10 +221,8 @@ export declare function withLevels(all: readonly SearchCriteria[], levels: reado
|
|
|
203
221
|
* by its `id` — the one declared by whoever wrote it, so it survives
|
|
204
222
|
* being saved as a favourite and read back.
|
|
205
223
|
*/
|
|
206
|
-
export declare function toggleNamed(all: readonly SearchCriteria[], named: {
|
|
207
|
-
|
|
208
|
-
label: string;
|
|
209
|
-
selection?: BuiltCondition | BuiltFilter;
|
|
224
|
+
export declare function toggleNamed(all: readonly SearchCriteria[], named: NamedFilterSpec, words?: {
|
|
225
|
+
or?: string;
|
|
210
226
|
}): SearchCriteria[];
|
|
211
227
|
/** Whether that named filter is set. The panel uses it to draw the mark:
|
|
212
228
|
* the mark comes from what is SET and not from a separate state that could disagree. */
|
|
@@ -172,6 +172,30 @@ export function levelsOf(all) {
|
|
|
172
172
|
export function withLevels(all, levels, labelOf) {
|
|
173
173
|
return [...levels.map((level) => groupCriteria(level, labelOf(level))), ...filtersOf(all)];
|
|
174
174
|
}
|
|
175
|
+
/** The chip of a group of named filters: the members' words joined by `or`, and what any of
|
|
176
|
+
* them keeps. A member that carries no selection makes the chip one its declarer answers. */
|
|
177
|
+
function namedGroupChip(group, members, or) {
|
|
178
|
+
const asked = members.flatMap((one) => one.selection === undefined ? [] : [one.selection]);
|
|
179
|
+
const selection = asked.length !== members.length
|
|
180
|
+
? undefined
|
|
181
|
+
: asked.length === 1
|
|
182
|
+
? asked[0]
|
|
183
|
+
: { any: asked };
|
|
184
|
+
return {
|
|
185
|
+
id: `named:${group}`,
|
|
186
|
+
kind: "filter",
|
|
187
|
+
label: members.map((one) => one.label).join(` ${or} `),
|
|
188
|
+
...(selection === undefined ? {} : { selection }),
|
|
189
|
+
named: {
|
|
190
|
+
group,
|
|
191
|
+
members: members.map(({ id, label, selection: kept }) => ({
|
|
192
|
+
id,
|
|
193
|
+
label,
|
|
194
|
+
...(kept === undefined ? {} : { selection: kept }),
|
|
195
|
+
})),
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
175
199
|
/**
|
|
176
200
|
* A NAMED filter, set or removed.
|
|
177
201
|
*
|
|
@@ -180,7 +204,21 @@ export function withLevels(all, levels, labelOf) {
|
|
|
180
204
|
* by its `id` — the one declared by whoever wrote it, so it survives
|
|
181
205
|
* being saved as a favourite and read back.
|
|
182
206
|
*/
|
|
183
|
-
export function toggleNamed(all, named) {
|
|
207
|
+
export function toggleNamed(all, named, words = {}) {
|
|
208
|
+
if (named.group !== undefined) {
|
|
209
|
+
/* One chip per group: its members are OR'd («Pedidos o Trabajando»). */
|
|
210
|
+
const id = `named:${named.group}`;
|
|
211
|
+
const at = all.findIndex((one) => one.id === id);
|
|
212
|
+
const found = at >= 0 ? all[at] : undefined;
|
|
213
|
+
const members = found?.kind === "filter" ? (found.named?.members ?? []) : [];
|
|
214
|
+
const next = members.some((one) => one.id === named.id)
|
|
215
|
+
? members.filter((one) => one.id !== named.id)
|
|
216
|
+
: [...members, named];
|
|
217
|
+
if (next.length === 0)
|
|
218
|
+
return all.filter((_, index) => index !== at);
|
|
219
|
+
const chip = namedGroupChip(named.group, next, words.or ?? "or");
|
|
220
|
+
return at >= 0 ? all.map((one, index) => (index === at ? chip : one)) : [...all, chip];
|
|
221
|
+
}
|
|
184
222
|
const at = all.findIndex((one) => one.id === named.id);
|
|
185
223
|
if (at >= 0)
|
|
186
224
|
return all.filter((_, index) => index !== at);
|
|
@@ -189,5 +227,7 @@ export function toggleNamed(all, named) {
|
|
|
189
227
|
/** Whether that named filter is set. The panel uses it to draw the mark:
|
|
190
228
|
* the mark comes from what is SET and not from a separate state that could disagree. */
|
|
191
229
|
export function hasNamed(all, id) {
|
|
192
|
-
return all.some((one) => one.id === id
|
|
230
|
+
return all.some((one) => one.id === id ||
|
|
231
|
+
(one.kind === "filter" &&
|
|
232
|
+
(one.named?.members.some((member) => member.id === id) ?? false)));
|
|
193
233
|
}
|
|
@@ -7,7 +7,7 @@ export { formatJson } from "./formatJson.js";
|
|
|
7
7
|
export { JsonEditor } from "./JsonEditor.js";
|
|
8
8
|
export { createModelCache, type FieldPathStep, type FieldPathValue, isRelation, isToMany, type LoadModel, type ModelCache, pathLabel, peekLabels, resolvePath, } from "./paths.js";
|
|
9
9
|
export { SearchBar, type SearchBarProps, type SearchFacet, } from "./SearchBar.js";
|
|
10
|
-
export { at, criteriaId, type CriteriaJoin, type CriteriaPath, facetPaths, filterCriteria, filtersOf, type GroupCriteria, groupCriteria, groupsOf, hasNamed, levelsOf, nextJoin, type RecordKey, type RecordOption, type Removal, removeAt, replaceAt, restoreRemoval, type SearchCriteria, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
|
|
10
|
+
export { at, criteriaId, type CriteriaJoin, type CriteriaPath, facetPaths, filterCriteria, filtersOf, type GroupCriteria, groupCriteria, groupsOf, hasNamed, levelsOf, type NamedFilterSpec, nextJoin, type RecordKey, type RecordOption, type Removal, removeAt, replaceAt, restoreRemoval, type SearchCriteria, selectionOf, toggleNamed, withLevels, } from "./criteria.js";
|
|
11
11
|
export { CriteriaChips, type CriteriaChipsProps, } from "./CriteriaChips.js";
|
|
12
12
|
export { choiceLabel, type FieldDefinition, fieldLabel, filterableNames, isFilterable, isNumericType, type ModelDefinition, type ModelTranslations, } from "./model.js";
|
|
13
13
|
export { answers, type ChipParts, chipParts, choiceValues, conditionCriteria, defaultOp, describeCondition, fieldKey, globToLike, opLabel, type QueryDraft, type QueryField, queryField, queryFields, type QueryKind, type QuerySuggestion, readTyped, sayValues, suggest, type TypedValue, valueFor, valueLabel, valuesCriteria, type ValueShape, valuesSelection, withoutValue, withParts, withValue, } from "./query.js";
|
|
@@ -7,6 +7,7 @@ import { Switch } from "../choice/Switch.js";
|
|
|
7
7
|
import { CellCopy } from "./CellCopy.js";
|
|
8
8
|
import { CellEditor } from "./CellEditor.js";
|
|
9
9
|
import { EditRow, firstControl } from "./EditableTable.js";
|
|
10
|
+
import { levelNameOf } from "./levels.js";
|
|
10
11
|
import { PileFootLine } from "./PileFootLine.js";
|
|
11
12
|
import { RowActions } from "./RowActions.js";
|
|
12
13
|
import { useRowWindow } from "./rowWindow.js";
|
|
@@ -187,7 +188,7 @@ function entriesOfPiles(piles, columns, keyOf, collapsed, onToggle, onMore) {
|
|
|
187
188
|
kind: "pile",
|
|
188
189
|
id: `\u0000pile${key}`,
|
|
189
190
|
depth: pile.depth,
|
|
190
|
-
level: pile.field,
|
|
191
|
+
level: levelNameOf(pile.field, columns),
|
|
191
192
|
label: pile.label,
|
|
192
193
|
count: pile.count,
|
|
193
194
|
detail: pile.detail,
|
|
@@ -2,6 +2,7 @@ export { CELL_TONE } from "./cellTone.js";
|
|
|
2
2
|
export { type Aggregate, type DataColumn, DataTable, type DataTableCreate, type GroupColumn, type YesNoColumn, } from "./DataTable.js";
|
|
3
3
|
export { EditableTable, type EditAdd, type EditBands, type EditCellState, type EditColumn, type EditFlag, type EditLayout, type EditRowState, } from "./EditableTable.js";
|
|
4
4
|
export { sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget, } from "./editRules.js";
|
|
5
|
+
export { levelNameOf } from "./levels.js";
|
|
5
6
|
export { PileFootLine } from "./PileFootLine.js";
|
|
6
7
|
export { PivotTable, type PivotTableProps, } from "./PivotTable.js";
|
|
7
8
|
export { type ReportColumn, type ReportRow, type ReportRowKind, ReportTable, } from "./ReportTable.js";
|
|
@@ -4,6 +4,7 @@ export { CELL_TONE } from "./cellTone.js";
|
|
|
4
4
|
export { DataTable, } from "./DataTable.js";
|
|
5
5
|
export { EditableTable, } from "./EditableTable.js";
|
|
6
6
|
export { sectionLines, stackPlaces, tabTarget, } from "./editRules.js";
|
|
7
|
+
export { levelNameOf } from "./levels.js";
|
|
7
8
|
export { PileFootLine } from "./PileFootLine.js";
|
|
8
9
|
export { PivotTable, } from "./PivotTable.js";
|
|
9
10
|
export { ReportTable, } from "./ReportTable.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a level of a grouping reads: by the header of the column that answers for its field — the
|
|
3
|
+
* word the person reads over that column («Estado») —, never the field's key («status»). A field
|
|
4
|
+
* no column shows reads as itself. A table's pile, a list's group header and a report's group
|
|
5
|
+
* line all name their level this way.
|
|
6
|
+
*
|
|
7
|
+
* levelNameOf("status", [{ id: "status", header: "Estado", … }]) -> "Estado"
|
|
8
|
+
*/
|
|
9
|
+
export declare function levelNameOf(field: string, columns: readonly {
|
|
10
|
+
id: string;
|
|
11
|
+
field?: string | undefined;
|
|
12
|
+
header: string;
|
|
13
|
+
}[] | undefined): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a level of a grouping reads: by the header of the column that answers for its field — the
|
|
3
|
+
* word the person reads over that column («Estado») —, never the field's key («status»). A field
|
|
4
|
+
* no column shows reads as itself. A table's pile, a list's group header and a report's group
|
|
5
|
+
* line all name their level this way.
|
|
6
|
+
*
|
|
7
|
+
* levelNameOf("status", [{ id: "status", header: "Estado", … }]) -> "Estado"
|
|
8
|
+
*/
|
|
9
|
+
export function levelNameOf(field, columns) {
|
|
10
|
+
return (columns?.find((column) => column.id === field || column.field === field)?.header ?? field);
|
|
11
|
+
}
|
|
@@ -21,6 +21,7 @@ import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
|
21
21
|
import { useViewStyle } from "../../foundations/viewStyle.js";
|
|
22
22
|
import { Button } from "../../primitives/button/Button.js";
|
|
23
23
|
import { Empty, Failed, Skeleton } from "../../primitives/notice/Notice.js";
|
|
24
|
+
import { levelNameOf } from "../../primitives/table/levels.js";
|
|
24
25
|
import { PivotTable } from "../../primitives/table/PivotTable.js";
|
|
25
26
|
import { ReportTable } from "../../primitives/table/ReportTable.js";
|
|
26
27
|
import { Metric, Metrics } from "../../primitives/value/Metric.js";
|
|
@@ -364,7 +365,7 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
364
365
|
return list.map((pile) => {
|
|
365
366
|
const key = pathKey(pile.path);
|
|
366
367
|
const open = isOpen(pile);
|
|
367
|
-
return (_jsxs(Fragment, { children: [_jsx(GroupHeader, { field: pile.field, label: pile.label, count: pile.count, ...(pile.detail === undefined ? {} : { detail: pile.detail }), depth: pile.depth, open: open, ...(group?.onToggle === undefined
|
|
368
|
+
return (_jsxs(Fragment, { children: [_jsx(GroupHeader, { field: levelNameOf(pile.field, columns), label: pile.label, count: pile.count, ...(pile.detail === undefined ? {} : { detail: pile.detail }), depth: pile.depth, open: open, ...(group?.onToggle === undefined
|
|
368
369
|
? {}
|
|
369
370
|
: { onToggle: () => group.onToggle?.(key) }) }), !open
|
|
370
371
|
? null
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { levelKey, pathKey, pileCount, pileItems, pileLabel, } from "../../foundations/grouping.js";
|
|
2
2
|
import { aggregateFormat, aggregateOf, aggregateText, pileAggregate, } from "../../primitives/table/DataTable.js";
|
|
3
|
+
import { levelNameOf } from "../../primitives/table/levels.js";
|
|
3
4
|
/**
|
|
4
5
|
* Context: what a list DERIVES from its set, as pure functions — the table's group levels,
|
|
5
6
|
* the sheet drawn from the declared columns, the sheet's flattened band/row sequence and
|
|
@@ -103,7 +104,7 @@ export function sheetRowsOf(piles, isOpen, columns) {
|
|
|
103
104
|
const open = isOpen(pile);
|
|
104
105
|
out.push({
|
|
105
106
|
band: {
|
|
106
|
-
field: pile.field,
|
|
107
|
+
field: levelNameOf(pile.field, columns),
|
|
107
108
|
label: pile.label,
|
|
108
109
|
count: pile.count,
|
|
109
110
|
open,
|
|
@@ -158,7 +159,7 @@ export function reportRowsOf(piles, columns, row, totalLabel) {
|
|
|
158
159
|
/* A pile is named by the HEADER of the column that answers for its field — the word the
|
|
159
160
|
person reads in the table — not by the field's id: «stage · pedido» showed the
|
|
160
161
|
model's name for it. */
|
|
161
|
-
const fieldName = (field) =>
|
|
162
|
+
const fieldName = (field) => levelNameOf(field, columns);
|
|
162
163
|
/* Every pile is a GROUP — it opens and closes, and it says what it adds up to under each
|
|
163
164
|
column, the number the table's pile row says (`pileAggregate`). A `section` was tried for
|
|
164
165
|
the first level and it drew no amounts: a section is a title over what comes below
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-ui",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
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",
|