@sincpro/web-ui 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/lines/LineItems.d.ts +14 -3
- package/dist/components/lines/LineItems.js +6 -4
- package/dist/components/listing/Row.d.ts +5 -4
- package/dist/components/listing/Row.js +5 -4
- package/dist/foundations/copy.d.ts +4 -0
- package/dist/foundations/copy.es.js +2 -0
- package/dist/foundations/copy.js +2 -0
- package/dist/foundations/form.d.ts +18 -1
- package/dist/foundations/form.js +6 -3
- package/dist/foundations/grouping.d.ts +28 -0
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -1
- package/dist/primitives/picker/MatchedText.d.ts +3 -2
- package/dist/primitives/picker/MatchedText.js +3 -2
- package/dist/primitives/picker/Picker.d.ts +18 -1
- package/dist/primitives/picker/Picker.js +5 -5
- package/dist/primitives/picker/TagsField.d.ts +10 -0
- package/dist/primitives/picker/TagsField.js +2 -2
- package/dist/primitives/picker/index.d.ts +2 -1
- package/dist/primitives/picker/index.js +2 -0
- package/dist/primitives/picker/tagChoices.d.ts +7 -0
- package/dist/primitives/picker/tagChoices.js +9 -4
- package/dist/primitives/table/DataTable.js +10 -11
- package/dist/primitives/table/EditableTable.d.ts +49 -7
- package/dist/primitives/table/EditableTable.js +321 -82
- package/dist/primitives/table/PileFootLine.d.ts +14 -0
- package/dist/primitives/table/PileFootLine.js +22 -0
- package/dist/primitives/table/index.d.ts +2 -1
- package/dist/primitives/table/index.js +1 -0
- package/dist/primitives/table/rowWindow.d.ts +3 -0
- package/dist/primitives/table/rowWindow.js +4 -0
- package/dist/views/list/List.d.ts +3 -2
- package/dist/views/list/ListView.js +13 -6
- package/dist/views/list/index.d.ts +1 -1
- package/dist/views/list/types.d.ts +16 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { type Aggregate, type DataColumn, DataTable, type DataTableCreate, type GroupColumn, } from "./DataTable.js";
|
|
2
|
-
export { EditableTable, type EditAdd, type EditBands, type EditColumn, type EditLayout, sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget, } from "./EditableTable.js";
|
|
2
|
+
export { EditableTable, type EditAdd, type EditBands, type EditCellState, type EditColumn, type EditFlag, type EditLayout, type EditRowState, sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget, } from "./EditableTable.js";
|
|
3
|
+
export { PileFootLine } from "./PileFootLine.js";
|
|
3
4
|
export { PivotTable, type PivotTableProps, } from "./PivotTable.js";
|
|
4
5
|
export { type ReportColumn, type ReportRow, type ReportRowKind, ReportTable, } from "./ReportTable.js";
|
|
5
6
|
export { type RowAction, RowActions } from "./RowActions.js";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
wiring to TanStack for grouping and sorting. See the note in `DataTable.tsx`. */
|
|
3
3
|
export { DataTable, } from "./DataTable.js";
|
|
4
4
|
export { EditableTable, sectionLines, stackPlaces, tabTarget, } from "./EditableTable.js";
|
|
5
|
+
export { PileFootLine } from "./PileFootLine.js";
|
|
5
6
|
export { PivotTable, } from "./PivotTable.js";
|
|
6
7
|
export { ReportTable, } from "./ReportTable.js";
|
|
7
8
|
export { RowActions } from "./RowActions.js";
|
|
@@ -36,4 +36,7 @@ export declare function useRowWindow({ count, rowsBefore, getKey, }: {
|
|
|
36
36
|
pad: (from: number, to: number, columns: number, key: string) => ReactNode;
|
|
37
37
|
/** The spacer after the last drawn row. */
|
|
38
38
|
tail: (columns: number) => ReactNode;
|
|
39
|
+
/** Scrolls row `index` into the window, so it gets drawn — for a jump past what is drawn
|
|
40
|
+
* (`Home`, `End`, «take me to it»). Nothing when the window is off: every row is there. */
|
|
41
|
+
reveal: (index: number) => void;
|
|
39
42
|
};
|
|
@@ -173,5 +173,9 @@ export function useRowWindow({ count, rowsBefore = 1, getKey, }) {
|
|
|
173
173
|
const end = rows.length === 0 ? 0 : rows[rows.length - 1].end;
|
|
174
174
|
return spacer(total - end, columns, "\u0000tail");
|
|
175
175
|
},
|
|
176
|
+
reveal: (index) => {
|
|
177
|
+
if (on && scroller !== null)
|
|
178
|
+
v.scrollToIndex(index, { align: "auto" });
|
|
179
|
+
},
|
|
176
180
|
};
|
|
177
181
|
}
|
|
@@ -6,7 +6,7 @@ import type { Surface } from "../../foundations/types.js";
|
|
|
6
6
|
import type { DataColumn, DataTableCreate } from "../../primitives/table/DataTable.js";
|
|
7
7
|
import type { RowAction } from "../../primitives/table/RowActions.js";
|
|
8
8
|
import type { SortState } from "../../primitives/table/Table.js";
|
|
9
|
-
import { type ListCalendar, type ListCrumb, type ListEmpty, type ListGantt, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type ListTimeline, type RowOf } from "./types.js";
|
|
9
|
+
import { type CardWays, type ListCalendar, type ListCrumb, type ListEmpty, type ListGantt, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type ListTimeline, type RowOf } from "./types.js";
|
|
10
10
|
import type { ReactNode } from "react";
|
|
11
11
|
type BarProps = {
|
|
12
12
|
children?: ReactNode;
|
|
@@ -51,7 +51,8 @@ type TableProps<T extends object> = {
|
|
|
51
51
|
* nombre, el `meta` y las fichas. Escribirla igual es declarar que ESTA lista
|
|
52
52
|
* se puede ver como tablero. */
|
|
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
|
+
card?: (item: T, ways: CardWays) => ReactNode;
|
|
55
56
|
/** One column per stage, with drag (and Alt + ← / →) to move a card between them. */
|
|
56
57
|
stages?: BoardStages<T>;
|
|
57
58
|
};
|
|
@@ -16,7 +16,7 @@ import { Breadcrumb } from "../../components/record/Breadcrumb.js";
|
|
|
16
16
|
import { RecordTimeline } from "../../components/timeline/RecordTimeline.js";
|
|
17
17
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
18
18
|
import { useDensity } from "../../foundations/density.js";
|
|
19
|
-
import { pathKey, pileIsOpen, pilesOf, } from "../../foundations/grouping.js";
|
|
19
|
+
import { pathKey, pileFoot, pileIsOpen, pilesOf, } from "../../foundations/grouping.js";
|
|
20
20
|
import { pivotFrom, pivotIsEmpty } from "../../foundations/pivot.js";
|
|
21
21
|
import { Button } from "../../primitives/button/Button.js";
|
|
22
22
|
import { Empty, Failed, Skeleton } from "../../primitives/notice/Notice.js";
|
|
@@ -242,6 +242,11 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
242
242
|
los decide la vista para la lista entera. */
|
|
243
243
|
const first = items[0];
|
|
244
244
|
const firstRow = first === undefined ? undefined : row(first);
|
|
245
|
+
/* The same foot the table draws: «Ver 50 más de 49.950», or «Se muestran 500 de …». */
|
|
246
|
+
function footOf(pile) {
|
|
247
|
+
const foot = pileFoot(pile, group?.onMore !== undefined);
|
|
248
|
+
return foot === null ? null : (_jsx(GroupMore, { foot: foot, depth: pile.depth, onMore: () => group?.onMore?.(pile) }));
|
|
249
|
+
}
|
|
245
250
|
/** Los montones, con sus filas adentro. Se llama a sí misma porque el árbol
|
|
246
251
|
* tiene N niveles: un montón dibuja su encabezado y, adentro, o bien los
|
|
247
252
|
* montones de abajo o bien las filas — nunca las dos cosas. */
|
|
@@ -255,10 +260,7 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
255
260
|
? null
|
|
256
261
|
: pile.piles.length > 0
|
|
257
262
|
? renderPiles(pile.piles, nodes)
|
|
258
|
-
: nodes(pile.items), open
|
|
259
|
-
pile.piles.length === 0 &&
|
|
260
|
-
pile.items.length < pile.count &&
|
|
261
|
-
group?.onMore !== undefined ? (_jsx(GroupMore, { left: pile.count - pile.items.length, depth: pile.depth, onMore: () => group.onMore?.(pile) })) : null] }, key));
|
|
263
|
+
: nodes(pile.items), open ? footOf(pile) : null] }, key));
|
|
262
264
|
});
|
|
263
265
|
}
|
|
264
266
|
const reportRows = useMemo(() => reportRowsOf(piles, columns, row), [piles, columns, row]);
|
|
@@ -267,9 +269,14 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
267
269
|
return nodes(ordered);
|
|
268
270
|
return renderPiles(piles, nodes);
|
|
269
271
|
}
|
|
272
|
+
const waysOf = (item) => ({
|
|
273
|
+
...(press === undefined ? {} : { press: () => press(item) }),
|
|
274
|
+
...(onPeek === undefined || choosing ? {} : { peek: () => onPeek(item) }),
|
|
275
|
+
...(onOpen === undefined || choosing ? {} : { open: () => onOpen(item) }),
|
|
276
|
+
});
|
|
270
277
|
const renderCard = (item) => {
|
|
271
278
|
if (card !== undefined) {
|
|
272
|
-
return _jsx(Fragment, { children: card(item) }, keyOf(item));
|
|
279
|
+
return _jsx(Fragment, { children: card(item, waysOf(item)) }, keyOf(item));
|
|
273
280
|
}
|
|
274
281
|
const d = row(item);
|
|
275
282
|
return (_jsx(RecordCard, { title: d.name, ...(d.tags === undefined ? {} : { tags: d.tags }), ...(d.meta === undefined ? {} : { meta: d.meta }), ...(press === undefined ? {} : { onOpen: () => press(item) }) }, keyOf(item)));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { List, type ListPresentProps, type ListProps } from "./List.js";
|
|
2
|
-
export { type ListCrumb, type ListEmpty, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type RowOf, } from "./types.js";
|
|
2
|
+
export { type CardWays, type ListCrumb, type ListEmpty, type ListGroup, type ListPivot, type ListPresent, type ListReport, type ListSet, type ListSheet, type RowOf, } from "./types.js";
|
|
@@ -41,6 +41,20 @@ export type RowOf = {
|
|
|
41
41
|
children?: ReactNode;
|
|
42
42
|
actions?: ReactNode;
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* What a press on ONE card does in this list, already bound to its record.
|
|
46
|
+
*
|
|
47
|
+
* Context: a board's own card replaced the built-in one and lost, with it, the rule of what
|
|
48
|
+
* a press does — the application had to pass it by hand. It gets the same three ways as a
|
|
49
|
+
* `List.Present` (`ListSet`), so a card written by the domain answers a click like the
|
|
50
|
+
* list's own: `press` is the rule (choose, look or open, as the list decided); `peek` and
|
|
51
|
+
* `open` are the two ways in, absent while the list is choosing.
|
|
52
|
+
*/
|
|
53
|
+
export type CardWays = {
|
|
54
|
+
press?: () => void;
|
|
55
|
+
peek?: () => void;
|
|
56
|
+
open?: () => void;
|
|
57
|
+
};
|
|
44
58
|
/**
|
|
45
59
|
* The set as a presentation receives it — what a `List.Present` draws from.
|
|
46
60
|
*
|
|
@@ -286,8 +300,8 @@ export type ListViewProps<T extends object> = {
|
|
|
286
300
|
* columns that declare `input` get a control in that row. See `DataTable`'s header.
|
|
287
301
|
* While a record is being written the table shows even if the set is empty. */
|
|
288
302
|
create?: DataTableCreate<T>;
|
|
289
|
-
/** The board presentation. */
|
|
290
|
-
card?: (item: T) => ReactNode;
|
|
303
|
+
/** The board presentation: the card of one record, with what a press on it does. */
|
|
304
|
+
card?: (item: T, ways: CardWays) => ReactNode;
|
|
291
305
|
/** The board by stages: one column each, cards moved between them. */
|
|
292
306
|
boardStages?: BoardStages<T>;
|
|
293
307
|
/** The calendar presentation: when each record happens. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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",
|