@panneau/lists 5.0.0-alpha.0 → 5.0.0-alpha.10
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 +7 -3
- package/dist/ItemDetails.css +34 -0
- package/dist/ItemDetails.d.ts +18 -0
- package/dist/ItemDetails.d.ts.map +1 -0
- package/dist/ItemDetails.js +104 -0
- package/dist/ItemDetails.js.map +1 -0
- package/dist/ItemDetails.module.js +16 -0
- package/dist/ItemDetails.module.js.map +1 -0
- package/dist/List.d.ts +2 -2
- package/dist/List.js +54 -12
- package/dist/List.js.map +1 -1
- package/dist/ListSkeleton.d.ts +17 -0
- package/dist/ListSkeleton.d.ts.map +1 -0
- package/dist/ListSkeleton.js +111 -0
- package/dist/ListSkeleton.js.map +1 -0
- package/dist/ListView.css +16 -16
- package/dist/ListView.d.ts +40 -5
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +547 -211
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.module.js +10 -10
- package/dist/actions/ActionButton.d.ts +4 -1
- package/dist/actions/ActionButton.d.ts.map +1 -1
- package/dist/actions/ActionButton.js +91 -23
- package/dist/actions/ActionButton.js.map +1 -1
- package/dist/actions/Actions.css +9 -9
- package/dist/actions/Actions.module.js +6 -6
- package/dist/actions/ConfirmDialog.d.ts +15 -3
- package/dist/actions/ConfirmDialog.d.ts.map +1 -1
- package/dist/actions/ConfirmDialog.js +103 -89
- package/dist/actions/ConfirmDialog.js.map +1 -1
- package/dist/actions/RowActions.d.ts +8 -6
- package/dist/actions/RowActions.d.ts.map +1 -1
- package/dist/actions/RowActions.js +40 -30
- package/dist/actions/RowActions.js.map +1 -1
- package/dist/actions/actions.d.ts +5 -4
- package/dist/actions/actions.d.ts.map +1 -1
- package/dist/actions/actions.js +7 -14
- package/dist/actions/actions.js.map +1 -1
- package/dist/actions/icons.d.ts +8 -3
- package/dist/actions/icons.d.ts.map +1 -1
- package/dist/actions/icons.js +11 -7
- package/dist/actions/icons.js.map +1 -1
- package/dist/cx.js.map +1 -1
- package/dist/displays/Displays.css +25 -13
- package/dist/displays/Displays.module.js +18 -14
- package/dist/displays/Displays.module.js.map +1 -1
- package/dist/displays/displays.d.ts +18 -3
- package/dist/displays/displays.d.ts.map +1 -1
- package/dist/displays/displays.js +355 -12
- package/dist/displays/displays.js.map +1 -1
- package/dist/filters/Filters.css +34 -20
- package/dist/filters/Filters.d.ts +1 -1
- package/dist/filters/Filters.js.map +1 -1
- package/dist/filters/Filters.module.js +13 -9
- package/dist/filters/Filters.module.js.map +1 -1
- package/dist/filters/controls.d.ts +3 -3
- package/dist/filters/controls.d.ts.map +1 -1
- package/dist/filters/controls.js +171 -123
- package/dist/filters/controls.js.map +1 -1
- package/dist/filters/format.d.ts +1 -1
- package/dist/filters/format.d.ts.map +1 -1
- package/dist/filters/format.js +4 -1
- package/dist/filters/format.js.map +1 -1
- package/dist/index.d.ts +19 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/layouts/CardsLayout.css +22 -11
- package/dist/layouts/CardsLayout.d.ts +2 -2
- package/dist/layouts/CardsLayout.d.ts.map +1 -1
- package/dist/layouts/CardsLayout.js +39 -35
- package/dist/layouts/CardsLayout.js.map +1 -1
- package/dist/layouts/CardsLayout.module.js +8 -8
- package/dist/layouts/CardsLayout.module.js.map +1 -1
- package/dist/layouts/ItemTitle.d.ts +4 -2
- package/dist/layouts/ItemTitle.d.ts.map +1 -1
- package/dist/layouts/ItemTitle.js +12 -8
- package/dist/layouts/ItemTitle.js.map +1 -1
- package/dist/layouts/TableLayout.css +51 -35
- package/dist/layouts/TableLayout.d.ts +2 -2
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +38 -33
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/TableLayout.module.js +14 -14
- package/dist/layouts/TableLayout.module.js.map +1 -1
- package/dist/layouts/builtIn.d.ts +1 -1
- package/dist/layouts/builtIn.js.map +1 -1
- package/dist/layouts/link.css +3 -3
- package/dist/layouts/link.module.js +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/query.d.ts +3 -3
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +7 -2
- package/dist/query.js.map +1 -1
- package/dist/selection.d.ts +1 -1
- package/dist/selection.js.map +1 -1
- package/dist/toolbar/LayoutSwitch.js.map +1 -1
- package/dist/toolbar/Pagination.d.ts +33 -0
- package/dist/toolbar/Pagination.d.ts.map +1 -1
- package/dist/toolbar/Pagination.js +282 -42
- package/dist/toolbar/Pagination.js.map +1 -1
- package/dist/toolbar/SearchField.js.map +1 -1
- package/dist/toolbar/SortSelect.d.ts +1 -1
- package/dist/toolbar/SortSelect.js.map +1 -1
- package/dist/toolbar/Toolbar.css +12 -12
- package/dist/toolbar/Toolbar.module.js +7 -7
- package/dist/types.d.ts +18 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/useDraft.js.map +1 -1
- package/dist/useListState.js.map +1 -1
- package/dist/useRenderValue.d.ts +8 -0
- package/dist/useRenderValue.d.ts.map +1 -0
- package/dist/useRenderValue.js +64 -0
- package/dist/useRenderValue.js.map +1 -0
- package/dist/values.d.ts +3 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +6 -2
- package/dist/values.js.map +1 -1
- package/package.json +9 -9
package/dist/ListView.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { List } from '@panneau/core';
|
|
3
|
-
import type { Field, Filter } from '@panneau/protocol';
|
|
4
|
-
import { type ListActions } from './actions/actions';
|
|
5
|
-
import type {
|
|
3
|
+
import type { Action, Field, Filter } from '@panneau/protocol';
|
|
4
|
+
import { type ListActions } from './actions/actions.js';
|
|
5
|
+
import type { ActionIcons } from './actions/icons.js';
|
|
6
|
+
import type { DisplayEntry, FilterEntry, ListActionHandler, ListActionPreviewer, ListColumn, ListItem, ListLayoutEntry } from './types.js';
|
|
6
7
|
export interface ListViewProps {
|
|
7
8
|
/** The list state of `@panneau/core` (`useList()`): query and selection. */
|
|
8
9
|
list: List;
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The items of the current page. `undefined` while they load for the first time: the list
|
|
12
|
+
* draws a skeleton of its rows, from its columns and its page size.
|
|
13
|
+
*/
|
|
10
14
|
items: readonly ListItem[] | undefined;
|
|
11
15
|
columns: readonly ListColumn[];
|
|
12
16
|
/**
|
|
@@ -14,6 +18,15 @@ export interface ListViewProps {
|
|
|
14
18
|
* pagination and offers to select every matching item. Without it, `items` is the whole list.
|
|
15
19
|
*/
|
|
16
20
|
total?: number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The cursors of the page, for a list paged with cursors (`nextCursor` and `previousCursor`
|
|
23
|
+
* of its `meta`): the list then has buttons to the previous and next pages, without page
|
|
24
|
+
* numbers or a total, and doesn't offer to select every matching item.
|
|
25
|
+
*/
|
|
26
|
+
cursors?: {
|
|
27
|
+
next: string | null;
|
|
28
|
+
previous?: string | null | undefined;
|
|
29
|
+
} | undefined;
|
|
17
30
|
/** Shows that items are loading. Items already shown stay, dimmed. */
|
|
18
31
|
isLoading?: boolean;
|
|
19
32
|
/** An error while loading: an alert with a retry replaces the items. */
|
|
@@ -41,12 +54,34 @@ export interface ListViewProps {
|
|
|
41
54
|
actions?: ListActions;
|
|
42
55
|
/** Runs an action, after its confirmation. */
|
|
43
56
|
onAction?: ListActionHandler;
|
|
57
|
+
/**
|
|
58
|
+
* Asks the backend how many items of a query selection ("Select all N items") an action will
|
|
59
|
+
* skip, before the confirmation: the list only knows the abilities of the current page. Only
|
|
60
|
+
* for actions with `dryRun`. `useActionPreview()` of `@panneau/actions` is one.
|
|
61
|
+
*/
|
|
62
|
+
previewAction?: ListActionPreviewer;
|
|
63
|
+
/**
|
|
64
|
+
* Icons of actions by action id (`{ archive: Archive }`), for actions written in code. They
|
|
65
|
+
* win over the Lucide icon an action names (`"icon": "archive"`).
|
|
66
|
+
*/
|
|
67
|
+
actionIcons?: ActionIcons;
|
|
44
68
|
/** The field that titles items, for their label (`itemTitle` of the resource). */
|
|
45
69
|
itemTitle?: string;
|
|
46
70
|
/** The label of an item, for checkboxes and actions. Defaults to its title, then its id. */
|
|
47
71
|
getItemLabel?: (item: ListItem) => string;
|
|
48
72
|
/** A link to an item, on its title. */
|
|
49
73
|
getItemHref?: (item: ListItem) => string | null;
|
|
74
|
+
/**
|
|
75
|
+
* The link of a built-in `show` or `edit` action without a `url` or a `route` (decision 0040),
|
|
76
|
+
* which the caller resolves to its own routes. Without it, or when it answers `null`, the list
|
|
77
|
+
* leaves those links out.
|
|
78
|
+
*/
|
|
79
|
+
getLinkHref?: (action: Action, item: ListItem) => string | null;
|
|
80
|
+
/**
|
|
81
|
+
* The item shown next to the list, such as in a panel of its details: its row is marked, and
|
|
82
|
+
* the link of its title is the current page.
|
|
83
|
+
*/
|
|
84
|
+
currentItemId?: string | null;
|
|
50
85
|
/** Displays by name, over the built-in ones and those of the plugins. */
|
|
51
86
|
displays?: Readonly<Record<string, DisplayEntry>>;
|
|
52
87
|
/** Layouts by id, over the built-in ones and those of the plugins. */
|
|
@@ -66,5 +101,5 @@ export interface ListViewProps {
|
|
|
66
101
|
* cards), with sorting, search, filters and their chips, pagination, selection and actions. It
|
|
67
102
|
* fetches nothing: the caller gives the items of the list's query and their total.
|
|
68
103
|
*/
|
|
69
|
-
export declare function ListView({ list, items, columns, total, isLoading, error, onRetry, filters, fields, search, layouts: layoutsProp, layout: controlledLayout, onLayoutChange, perPageOptions, selectable: selectableProp, actions: actionsProp, onAction, itemTitle, getItemLabel: getItemLabelProp, getItemHref, displays, layoutComponents, filterControls, toolbar, emptyMessage, 'aria-label': ariaLabel, className, }: ListViewProps): import("react").JSX.Element;
|
|
104
|
+
export declare function ListView({ list, items, columns, total, cursors, isLoading, error, onRetry, filters, fields, search, layouts: layoutsProp, layout: controlledLayout, onLayoutChange, perPageOptions, selectable: selectableProp, actions: actionsProp, onAction, previewAction, actionIcons, itemTitle, getItemLabel: getItemLabelProp, getItemHref, getLinkHref, currentItemId, displays, layoutComponents, filterControls, toolbar, emptyMessage, 'aria-label': ariaLabel, className, }: ListViewProps): import("react").JSX.Element;
|
|
70
105
|
//# sourceMappingURL=ListView.d.ts.map
|
package/dist/ListView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../src/ListView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQ/D,OAAO,EACH,KAAK,WAAW,EAKnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAUnD,OAAO,KAAK,EACR,YAAY,EACZ,WAAW,EAEX,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,eAAe,EAClB,MAAM,SAAS,CAAC;AAKjB,MAAM,WAAW,aAAa;IAC1B,4EAA4E;IAC5E,IAAI,EAAE,IAAI,CAAC;IACX;;;OAGG;IACH,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE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