@cratis/components 4.13.1 → 4.14.1
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/MIGRATION.md +6 -2
- package/README.md +17 -16
- package/dist/esm/CommandDialog/CommandDialog.d.ts +2 -1
- package/dist/esm/CommandDialog/CommandDialog.js +31 -4
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +2 -0
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/DataPage/DataPage.d.ts +15 -0
- package/dist/esm/DataPage/DataPage.js +12 -1
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/dist/esm/DataTables/Column.d.ts +13 -3
- package/dist/esm/DataTables/Column.js.map +1 -1
- package/dist/esm/DataTables/ColumnFilterMenu.d.ts +10 -1
- package/dist/esm/DataTables/ColumnFilterMenu.js +36 -30
- package/dist/esm/DataTables/ColumnFilterMenu.js.map +1 -1
- package/dist/esm/DataTables/DataTableCore.d.ts +15 -5
- package/dist/esm/DataTables/DataTableCore.js +47 -6
- package/dist/esm/DataTables/DataTableCore.js.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +12 -0
- package/dist/esm/DataTables/DataTableForObservableQuery.js +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.d.ts +12 -0
- package/dist/esm/DataTables/DataTableForQuery.js +1 -1
- package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
- package/dist/esm/configuration/CratisComponentsDefaults.js +1 -0
- package/dist/esm/configuration/CratisComponentsDefaults.js.map +1 -1
- package/dist/esm/styles.DataPage.css +8 -0
- package/dist/esm/styles.DataTables.css +8 -0
- package/dist/esm/styles.SchemaEditor.css +8 -0
- package/dist/esm/styles.css +8 -0
- package/dist/esm/styles.renderer.builtin.css +8 -0
- package/dist/esm/types/parts.d.ts +6 -3
- package/dist/esm/types/parts.d.ts.map +1 -1
- package/dist/esm/types/parts.js +6 -3
- package/dist/esm/types/parts.js.map +1 -1
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -5,7 +5,7 @@ Components 4 replaces the PrimeReact-backed Components 3 foundation with Compone
|
|
|
5
5
|
This is a major-version migration. Rendered markup, styling parts, provider configuration, date entry, root imports, and some deprecated props change.
|
|
6
6
|
|
|
7
7
|
:::note
|
|
8
|
-
An application that has not migrated remains on its Components 3 package profile, including the third-party dependencies declared by that version. Components `>=3 <4` is in maintenance/security-critical support
|
|
8
|
+
An application that has not migrated remains on its Components 3 package profile, including the third-party dependencies declared by that version. Components `>=4 <5` is the current release line and the migration target; Components `>=3 <4` is in maintenance/security-critical support. No Components 3 end-of-life date has been set yet; the support policy requires one to be set no later than 12 months after the Components 4.0.0 release. Components 4 does not provide a transparent Prime compatibility package. Its repository-versioned `@cratis/components.mui`, `@cratis/components.primereact` (PrimeReact 11), and `@cratis/components.primereact10` adapters are optional and cover only the nine `common.*` presentation slots; see the published [Renderer adapters and coexistence](https://cratis.io/components/renderers/) guide.
|
|
9
9
|
:::
|
|
10
10
|
|
|
11
11
|
The adapters do not replace complete Components widgets. Core continues to own Dialog, Dropdown, DatePicker, paginator, table, focus, overlay, selection, and keyboard behavior; an adapter only presents button, icon-button, text-input, text-area, checkbox, radio, switch, progress, and surface slots. Installing an adapter neither restores PrimeReact public APIs nor transfers key handling to the adapter.
|
|
@@ -77,6 +77,8 @@ import { Canvas, CanvasItem } from '@cratis/components/Canvas';
|
|
|
77
77
|
|
|
78
78
|
This is an intentional Components 4 breaking change. The package root now exposes setup APIs only; component namespaces no longer exist there. Every retained namespace maps mechanically: replace `import { X } from '@cratis/components'` with either an equivalent namespace import from the documented subpath, or named imports from that subpath. The removed renderer-only `Compatibility` namespace is the deliberate manual exception.
|
|
79
79
|
|
|
80
|
+
The `cratis-components-remove-root-namespace-imports` codemod always emits the namespace-preserving form (`import * as Canvas from '@cratis/components/Canvas'`), so existing member access such as `Canvas.Canvas` keeps resolving for every member Components 4 still exports. Switching to named imports, as in the example above, is optional cleanup you do by hand.
|
|
81
|
+
|
|
80
82
|
| Removed Components 3 root namespace | Components 4 subpath | Namespace-preserving migration | Named migration |
|
|
81
83
|
| ----------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
82
84
|
| `Canvas` | `@cratis/components/Canvas` | `import * as Canvas from '@cratis/components/Canvas'` | `import { Canvas, CanvasItem } from '@cratis/components/Canvas'` |
|
|
@@ -188,6 +190,8 @@ The callback transform rewrites only structurally-proven single forwarding callb
|
|
|
188
190
|
<CheckboxField onChange={(value) => setEnabled(value)} />
|
|
189
191
|
```
|
|
190
192
|
|
|
193
|
+
**CommandForm field `onChange` is not a typed prop.** The transform changes the callback's shape, not its location. With Arc 22.16.0, `CommandForm` calls an `onChange` placed on a field with the new value, so the rewritten callback runs. The Components 4 field types, which are built on Arc's `CommandFormFieldComponentProps`, do not declare `onChange`, so a type-checked TSX file reports TS2322 on a CommandForm field such as `InputTextField`, `CheckboxField`, `DropdownField`, or `MultiSelectField` that keeps it. In typed code, move the side effect to the `onFieldChange` callback on `CommandForm`, which receives the command, the field name, and the old and new values. The standalone `Dropdown` declares `onChange` and is not affected.
|
|
194
|
+
|
|
191
195
|
Dynamic Button props, JSX spreads, unknown new/legacy conflicts, duplicate props, multi-use callbacks, and native-event-dependent callbacks are not guessed. They stay semantically unchanged, produce a nonzero exit, and receive one syntax-safe `TODO(cratis-codemod)` annotation:
|
|
192
196
|
|
|
193
197
|
```tsx
|
|
@@ -503,7 +507,7 @@ Multiple selection uses a native multiple-select when filtering is off and an ac
|
|
|
503
507
|
- Complete-result filtering and sorting are not automatic table state. Model them in query arguments and implement them in the server query before paging.
|
|
504
508
|
- `clientFiltering` remains temporarily accepted as a deprecated no-op so staged source migrations compile. Remove it: filtering is always scoped to the loaded page, and complete-result filtering belongs on the server before paging.
|
|
505
509
|
- Legacy `{ operator, constraints }` filter entries remain accepted. `operator: 'or'` matches any constraint; all other values match every constraint.
|
|
506
|
-
- `Column` remains the declarative column marker.
|
|
510
|
+
- `Column` remains the declarative column marker. Components 4.0 through 4.13 typed only `selectionMode='single'`, because the Components 3 `'multiple'` value never provided checkbox selection. Components 4.14.0 restores `'multiple'` with working checkboxes and a select-all header, driven by the table's `selectionMode='multiple'`, `selectedItems`, and `onSelectedItemsChange` props.
|
|
507
511
|
- Table styling uses `DataTableParts` and `data-cratis-part`.
|
|
508
512
|
- Server totals remain authoritative for the paginator.
|
|
509
513
|
|
package/README.md
CHANGED
|
@@ -20,11 +20,6 @@ interaction primitives internally; consumers do not import or style React Aria.
|
|
|
20
20
|
npm install @cratis/components@^4
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
> **Publication status:** This install example targets the owner-authorized 4.0.0 npm release. When
|
|
24
|
-
> reading this README from repository source before that release, verify availability with
|
|
25
|
-
> `npm view @cratis/components@4.0.0 version`; source contributors use the repository workspace
|
|
26
|
-
> instead.
|
|
27
|
-
|
|
28
23
|
The current package manifest declares these peer dependencies:
|
|
29
24
|
|
|
30
25
|
- `@cratis/arc` and `@cratis/arc.react` `>=20.3.1 <23`
|
|
@@ -34,13 +29,13 @@ The current package manifest declares these peer dependencies:
|
|
|
34
29
|
- `reflect-metadata` `0.2.2`
|
|
35
30
|
- `tsyringe` `4.10.0`
|
|
36
31
|
|
|
37
|
-
Strict installers can declare them explicitly; keep both Arc packages on the
|
|
32
|
+
Strict installers can declare them explicitly; keep both Arc packages on the version your generated proxies were produced with. This repository builds and tests against Arc 22.16.0:
|
|
38
33
|
|
|
39
34
|
```bash
|
|
40
|
-
ARC_VERSION=22.
|
|
35
|
+
ARC_VERSION=22.16.0
|
|
41
36
|
npm install @cratis/components@^4 \
|
|
42
37
|
"@cratis/arc@$ARC_VERSION" "@cratis/arc.react@$ARC_VERSION" \
|
|
43
|
-
@cratis/fundamentals@^7.
|
|
38
|
+
@cratis/fundamentals@^7.19.2 react@^19 react-dom@^19 \
|
|
44
39
|
reflect-metadata@0.2.2 tsyringe@4.10.0
|
|
45
40
|
```
|
|
46
41
|
|
|
@@ -58,7 +53,7 @@ object; runtime behavior still requires `@cratis/components.conformance`. See th
|
|
|
58
53
|
[renderer-adapter documentation](https://github.com/Cratis/Components/blob/16dd95b7c894f3275b03714ffdc676d2d3505fd8/Documentation/renderers/index.md#adapter-package-metadata-schema)
|
|
59
54
|
for the boundary and limitations.
|
|
60
55
|
|
|
61
|
-
**Yarn PnP note:**
|
|
56
|
+
**Yarn PnP note:** `@cratis/arc.react@22.6.2` imports `rxjs` without declaring it. Strict PnP consumers that stay on that version install `rxjs@7.8.2` and add a `packageExtensions` entry for `@cratis/arc.react@22.6.2`; Arc React 22.16.0 does not need it. The canonical [getting-started guide](https://cratis.io/components/getting-started/) contains the exact YAML.
|
|
62
57
|
|
|
63
58
|
`pixi.js@^8.20.0` is an additional **optional** peer, required only by `Canvas` and `PivotViewer` (the Spatial capability profile — see [Import from explicit subpaths](#import-from-explicit-subpaths) below). Every other subpath needs nothing beyond the peers above:
|
|
64
59
|
|
|
@@ -93,13 +88,19 @@ Every JavaScript subpath publishes a matching `<subpath>/styles`, self-contained
|
|
|
93
88
|
|
|
94
89
|
## Provider
|
|
95
90
|
|
|
91
|
+
Import `reflect-metadata` once at the entry point, before the styles, and mount the Components provider inside Arc's `<Arc>` provider. `<Arc>` supplies the command and query runtime used by the generated proxies; `CratisComponentsProvider` does not replace it:
|
|
92
|
+
|
|
96
93
|
```tsx
|
|
94
|
+
import 'reflect-metadata';
|
|
95
|
+
import { Arc } from '@cratis/arc.react';
|
|
97
96
|
import { CratisComponentsProvider } from '@cratis/components';
|
|
98
97
|
|
|
99
98
|
export const App = () => (
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
99
|
+
<Arc>
|
|
100
|
+
<CratisComponentsProvider value={{ locale: 'en-US' }} toaster>
|
|
101
|
+
<Application />
|
|
102
|
+
</CratisComponentsProvider>
|
|
103
|
+
</Arc>
|
|
103
104
|
);
|
|
104
105
|
```
|
|
105
106
|
|
|
@@ -109,10 +110,10 @@ stable, nine-slot `stable-presentation/v1` primitive profile; they never replace
|
|
|
109
110
|
catalog. They share the Components repository release version and are selected with the provider's
|
|
110
111
|
`library` prop:
|
|
111
112
|
|
|
112
|
-
- `@cratis/components.mui
|
|
113
|
-
- `@cratis/components.primereact
|
|
113
|
+
- `@cratis/components.mui` — MUI 9.x / Emotion 11.x stable presentation slots;
|
|
114
|
+
- `@cratis/components.primereact` — PrimeReact 11.x stable presentation slots, with an
|
|
114
115
|
application-owned outer provider and license key;
|
|
115
|
-
- `@cratis/components.primereact10
|
|
116
|
+
- `@cratis/components.primereact10` — PrimeReact 10.9.9+ stable presentation slots, with its
|
|
116
117
|
separate MIT-era provider, global theme, and upstream-major boundary.
|
|
117
118
|
|
|
118
119
|
Adapter-specific themes, providers, SSR setup, peers, and license boundaries remain documented by
|
|
@@ -164,7 +165,7 @@ export const RegisterAuthorDialog = () => (
|
|
|
164
165
|
);
|
|
165
166
|
```
|
|
166
167
|
|
|
167
|
-
Fields bind directly to generated command properties and surface server validation through the Arc command-form context.
|
|
168
|
+
Fields bind directly to generated command properties and surface server validation through the Arc command-form context. Required command values the user does not type, such as a generated id, belong in `initialValues`; `onBeforeExecute` runs only after validation and cannot enable the confirm button.
|
|
168
169
|
|
|
169
170
|
## Query-backed tables
|
|
170
171
|
|
|
@@ -6,7 +6,8 @@ import { type BeforeExecuteCallback } from './applyBeforeExecute.js';
|
|
|
6
6
|
* Props for {@link CommandDialog}. Combines the props of a `CommandForm`
|
|
7
7
|
* (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,
|
|
8
8
|
* `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,
|
|
9
|
-
* `buttons`, `width`, `pt`, `unstyled`, …).
|
|
9
|
+
* `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props
|
|
10
|
+
* such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.
|
|
10
11
|
*
|
|
11
12
|
* @typeParam TCommand - The command record type (must extend `object`).
|
|
12
13
|
* @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.
|
|
@@ -6,7 +6,7 @@ import { CommandForm, useCommandFormContext, useCommandInstance, CommandFormFiel
|
|
|
6
6
|
import { applyBeforeExecute } from './applyBeforeExecute.js';
|
|
7
7
|
import { markAsCommandFormColumn, isCommandFormField } from '../CommandForm/commandFormMarkers.js';
|
|
8
8
|
|
|
9
|
-
const CommandDialogWrapper = ({
|
|
9
|
+
const CommandDialogWrapper = ({ isValid, onClose, onConfirm, onSuccess, onValidationFailure, onFailed, onException, onUnauthorized, onBeforeExecute, children, ...dialogProps }) => {
|
|
10
10
|
const { setCommandValues, setCommandResult, isValid: isCommandFormValid, } = useCommandFormContext();
|
|
11
11
|
const commandInstance = useCommandInstance();
|
|
12
12
|
const [isBusy, setIsBusy] = useState(false);
|
|
@@ -66,11 +66,38 @@ const CommandDialogWrapper = ({ title, visible, width, style, contentStyle, resi
|
|
|
66
66
|
};
|
|
67
67
|
const processedChildren = processChildren(children);
|
|
68
68
|
const isDialogValid = isValid !== false && isCommandFormValid;
|
|
69
|
-
return (jsx(Dialog, {
|
|
69
|
+
return (jsx(Dialog, { ...dialogProps, onClose: onClose, onConfirm: handleConfirm, isValid: isDialogValid, isBusy: isBusy, children: jsx("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: processedChildren }) }));
|
|
70
70
|
};
|
|
71
71
|
const CommandDialogComponent = (props) => {
|
|
72
|
-
const { title, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, initialFocus, okLabel, cancelLabel, yesLabel, noLabel, dismissable, closeAriaLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
73
|
-
|
|
72
|
+
const { title, subtitle, placement, closeIcon, visible, width, style, contentStyle, resizable, buttons = DialogButtons.OkCancel, initialFocus, okLabel, cancelLabel, yesLabel, noLabel, dismissable, closeAriaLabel, isValid, onClose, onConfirm, onCancel, onBeforeExecute, className, pt, ptOptions, unstyled, children, ...commandFormProps } = props;
|
|
73
|
+
const dialogProps = {
|
|
74
|
+
title,
|
|
75
|
+
subtitle,
|
|
76
|
+
placement,
|
|
77
|
+
closeIcon,
|
|
78
|
+
visible,
|
|
79
|
+
width,
|
|
80
|
+
style,
|
|
81
|
+
contentStyle,
|
|
82
|
+
resizable,
|
|
83
|
+
buttons,
|
|
84
|
+
initialFocus,
|
|
85
|
+
okLabel,
|
|
86
|
+
cancelLabel,
|
|
87
|
+
yesLabel,
|
|
88
|
+
noLabel,
|
|
89
|
+
dismissable,
|
|
90
|
+
closeAriaLabel,
|
|
91
|
+
isValid,
|
|
92
|
+
onClose,
|
|
93
|
+
onConfirm,
|
|
94
|
+
onCancel,
|
|
95
|
+
className,
|
|
96
|
+
pt,
|
|
97
|
+
ptOptions,
|
|
98
|
+
unstyled,
|
|
99
|
+
};
|
|
100
|
+
return (jsx(CommandForm, { ...commandFormProps, children: jsx(CommandDialogWrapper, { ...dialogProps, onSuccess: props.onSuccess, onValidationFailure: props.onValidationFailure, onFailed: props.onFailed, onException: props.onException, onUnauthorized: props.onUnauthorized, onBeforeExecute: onBeforeExecute, children: children }) }));
|
|
74
101
|
};
|
|
75
102
|
const CommandDialogColumnWrapper = ({ children }) => (jsx(CommandForm.Column, { children: children }));
|
|
76
103
|
markAsCommandFormColumn(CommandDialogColumnWrapper);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;;AA6DA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,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AAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,eAAe,YAE/B,QAAQ,EAAA,CACU,EAAA,CACb;AAEtB,CAAC;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAE,QAAQ,EAAiC,MAC3EA,GAAA,CAAC,WAAW,CAAC,MAAM,cAAE,QAAQ,EAAA,CAAsB,CACtD;AACD,uBAAuB,CAAC,0BAA0B,CAAC;AAEnD,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
|
|
@@ -79,6 +79,8 @@ export interface CratisNotificationsMessages {
|
|
|
79
79
|
export interface CratisDataTableMessages {
|
|
80
80
|
/** Accessible name for a single-selection row control. */
|
|
81
81
|
selectRow?: string;
|
|
82
|
+
/** Accessible name for the select-all control in a multiple-selection header. */
|
|
83
|
+
selectAllRows?: string;
|
|
82
84
|
/** Placeholder for the loaded-page search input. */
|
|
83
85
|
search?: string;
|
|
84
86
|
/** Accessible name for the loaded-page search input. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;
|
|
1
|
+
{"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;AA2OnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAA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,YAAY,EAAA,EACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,YAE5BA,GAAA,CAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,EAAA,QAAA,EAC7CC,KAAC,YAAY,EAAA,EAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAA,QAAA,EAAA,CAC7C,QAAQ,EACR,OAAO,KACJD,GAAA,CAAC,OAAO,QAAM,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,EAAE,CAAC,GAAI,CAChE,CAAA,EAAA,CACU,EAAA,CACgB,EAAA,CACxB;AAEvB;;"}
|
|
@@ -127,6 +127,21 @@ export interface DataPageProps<TQuery extends IQueryFor<TDataType, TArguments> |
|
|
|
127
127
|
* Callback for when the selection changes
|
|
128
128
|
*/
|
|
129
129
|
onSelectionChange?(event: DataTableSelectionChangeEvent<TDataType>): void;
|
|
130
|
+
/**
|
|
131
|
+
* The row selection mode. Defaults to `'single'`. Use `'multiple'` for a page whose actions
|
|
132
|
+
* operate on a set of rows - it adds per-row checkboxes and a select-all header checkbox, and
|
|
133
|
+
* reports through {@link onSelectedItemsChange}.
|
|
134
|
+
*/
|
|
135
|
+
selectionMode?: 'single' | 'multiple';
|
|
136
|
+
/**
|
|
137
|
+
* The currently selected rows, for `selectionMode='multiple'`. Leave undefined to let the page
|
|
138
|
+
* own the selection.
|
|
139
|
+
*/
|
|
140
|
+
selectedItems?: TDataType[];
|
|
141
|
+
/**
|
|
142
|
+
* Callback for when a multiple selection changes, with the full selected set.
|
|
143
|
+
*/
|
|
144
|
+
onSelectedItemsChange?(items: TDataType[]): void;
|
|
130
145
|
/**
|
|
131
146
|
* Fields to use for global filtering
|
|
132
147
|
*/
|
|
@@ -16,7 +16,9 @@ const tableRegionStyle = { flexGrow: 1, flexBasis: 0, minHeight: 0 };
|
|
|
16
16
|
const pageStyle = { minHeight: '20rem' };
|
|
17
17
|
const MenuItems = ({ children }) => {
|
|
18
18
|
const context = useDataPageContext();
|
|
19
|
-
const isDisabled =
|
|
19
|
+
const isDisabled = context.selectionMode === 'multiple'
|
|
20
|
+
? context.selectedItems.length === 0
|
|
21
|
+
: !context.selectedItem;
|
|
20
22
|
const items = useMemo(() => {
|
|
21
23
|
const menuItems = [];
|
|
22
24
|
React.Children.forEach(children, (child) => {
|
|
@@ -58,10 +60,19 @@ const DataPage = (props) => {
|
|
|
58
60
|
setInternalSelection(event.value);
|
|
59
61
|
props.onSelectionChange?.(event);
|
|
60
62
|
};
|
|
63
|
+
const [internalSelectedItems, setInternalSelectedItems] = React.useState(props.selectedItems ?? []);
|
|
64
|
+
const selectedItems = props.selectedItems ?? internalSelectedItems;
|
|
65
|
+
const selectedItemsChanged = (items) => {
|
|
66
|
+
if (props.selectedItems === undefined)
|
|
67
|
+
setInternalSelectedItems(items);
|
|
68
|
+
props.onSelectedItemsChange?.(items);
|
|
69
|
+
};
|
|
61
70
|
const context = {
|
|
62
71
|
...props,
|
|
63
72
|
selectedItem,
|
|
64
73
|
onSelectionChanged: selectionChanged,
|
|
74
|
+
selectedItems,
|
|
75
|
+
onSelectedItemsChange: selectedItemsChanged,
|
|
65
76
|
};
|
|
66
77
|
return (jsx(DataPageContext.Provider, { value: context, children: jsx(Page, { title: props.title, panel: true, style: pageStyle, children: props.detailsComponent ? (jsxs(Allotment, { className: 'cratis:h-full', proportionalLayout: false, children: [jsx(Allotment.Pane, { children: jsx(DataPageLayout, { children: props.children }) }), selectedItem && (jsx(Allotment.Pane, { preferredSize: '450px', children: jsx(props.detailsComponent, { item: selectedItem, onRefresh: props.onRefresh }) }))] })) : (jsx(DataPageLayout, { children: props.children })) }) }));
|
|
67
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.tsx"],"sourcesContent":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AAC,eAAe,EAAC,kBAAkB,EAAE,KAAK,EAAA,QAAA,EAAA,CAC1DD,IAAC,SAAS,CAAC,IAAI,EAAA,EAAA,QAAA,EACXA,GAAA,CAAC,cAAc,cAAE,KAAK,CAAC,QAAQ,EAAA,CAAkB,EAAA,CACpC,EAChB,YAAY,KACTA,GAAA,CAAC,SAAS,CAAC,IAAI,EAAA,EAAC,aAAa,EAAC,OAAO,EAAA,QAAA,EACjCA,GAAA,CAAC,KAAK,CAAC,gBAAgB,EAAA,EACnB,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,EAAA,CAC5B,GACW,CACpB,CAAA,EAAA,CACO,KAEZA,GAAA,CAAC,cAAc,EAAA,EAAA,QAAA,EAAE,KAAK,CAAC,QAAQ,GAAkB,CACpD,EAAA,CACE,EAAA,CACgB;AAEnC;AAEA,QAAQ,CAAC,QAAQ,GAAG,QAAQ;AAC5B,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,OAAO,GAAG,OAAO;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ColumnFilterDataType, ColumnFilterElement, ColumnFilterMenuLabels, ColumnFilterMenuParts } from './ColumnFilterMenu.js';
|
|
2
|
+
import type { ColumnFilterDataType, ColumnFilterElement, ColumnFilterMenuLabels, ColumnFilterMenuParts, ColumnFilterOption } from './ColumnFilterMenu.js';
|
|
3
3
|
/**
|
|
4
4
|
* Props for {@link Column}.
|
|
5
5
|
*
|
|
@@ -26,12 +26,22 @@ export interface ColumnProps<TData = unknown> {
|
|
|
26
26
|
showFilterMatchModes?: boolean;
|
|
27
27
|
/** Custom value editor rendered instead of the built-in column filter editor. */
|
|
28
28
|
filterElement?: ColumnFilterElement;
|
|
29
|
+
/**
|
|
30
|
+
* The values this column can be filtered by. Supply this for a column whose values come from a
|
|
31
|
+
* known set - a status, a kind, an enum rendered as text - so the filter offers those values
|
|
32
|
+
* instead of asking the user to type one. Takes precedence over {@link filterElement}, and
|
|
33
|
+
* narrows the match modes to equals/not equals.
|
|
34
|
+
*/
|
|
35
|
+
filterOptions?: ColumnFilterOption[];
|
|
29
36
|
/** Overrides the column filter menu's default English labels. */
|
|
30
37
|
filterLabels?: Partial<ColumnFilterMenuLabels>;
|
|
31
38
|
/** Stable part attributes for this column's filter popup. */
|
|
32
39
|
filterPt?: ColumnFilterMenuParts;
|
|
33
|
-
/**
|
|
34
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Renders a selection control instead of a data column - a radio for `'single'`, or a checkbox
|
|
42
|
+
* plus a select-all checkbox in the header for `'multiple'`.
|
|
43
|
+
*/
|
|
44
|
+
selectionMode?: 'single' | 'multiple';
|
|
35
45
|
/** Inline style for every body cell in the column. */
|
|
36
46
|
style?: React.CSSProperties;
|
|
37
47
|
/** Class name for every body cell in the column. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Column.js","sources":["../../../DataTables/Column.tsx"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Column.js","sources":["../../../DataTables/Column.tsx"],"sourcesContent":[null],"names":[],"mappings":"AAoFO,MAAM,MAAM,GAAG,CAClB,MAA0B,KACE;AAChC,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
|
|
@@ -5,6 +5,13 @@ import type { ChangeHandler } from '../types/ChangeHandler.js';
|
|
|
5
5
|
import { type DataTableFilterConstraint, type DataTableFilterMatchMode as FilterMatchMode } from './DataTableFilterMeta.js';
|
|
6
6
|
/** Value editor used by a built-in column filter. */
|
|
7
7
|
export type ColumnFilterDataType = 'text' | 'numeric' | 'date' | 'boolean';
|
|
8
|
+
/** One selectable value offered by a column filter that filters over a known set. */
|
|
9
|
+
export interface ColumnFilterOption {
|
|
10
|
+
/** The text shown for this value in the filter menu. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** The value written into the filter constraint when this option is picked. */
|
|
13
|
+
value: unknown;
|
|
14
|
+
}
|
|
8
15
|
/** Localizable labels owned by the column filter popup. */
|
|
9
16
|
export interface ColumnFilterMenuLabels {
|
|
10
17
|
/** Builds the filter-trigger accessible name from the effective field. */
|
|
@@ -85,6 +92,8 @@ export interface ColumnFilterMenuProps {
|
|
|
85
92
|
showMatchModes?: boolean;
|
|
86
93
|
/** Custom value editor replacing the built-in control. */
|
|
87
94
|
filterElement?: ColumnFilterElement;
|
|
95
|
+
/** The values this column can be filtered by, offered as a list instead of a free-form input. */
|
|
96
|
+
filterOptions?: ColumnFilterOption[];
|
|
88
97
|
/** Partial localization overrides. */
|
|
89
98
|
labels?: Partial<ColumnFilterMenuLabels>;
|
|
90
99
|
/** Stable part attributes. */
|
|
@@ -97,5 +106,5 @@ export interface ColumnFilterMenuProps {
|
|
|
97
106
|
onClear: () => void;
|
|
98
107
|
}
|
|
99
108
|
/** Cratis-owned column filter popup with draft/apply behavior. */
|
|
100
|
-
export declare const ColumnFilterMenu: ({ field, dataType, placeholder, showMatchModes, filterElement, labels, pt, constraint, onApply, onClear, }: ColumnFilterMenuProps) => import("react").JSX.Element;
|
|
109
|
+
export declare const ColumnFilterMenu: ({ field, dataType, placeholder, showMatchModes, filterElement, filterOptions, labels, pt, constraint, onApply, onClear, }: ColumnFilterMenuProps) => import("react").JSX.Element;
|
|
101
110
|
export {};
|
|
@@ -25,6 +25,10 @@ const defaultColumnFilterMenuLabels = {
|
|
|
25
25
|
true: 'True',
|
|
26
26
|
false: 'False',
|
|
27
27
|
};
|
|
28
|
+
const valueMatchModeOptions = [
|
|
29
|
+
{ label: 'Equals', value: DataTableFilterMatchMode.Equals },
|
|
30
|
+
{ label: 'Not equals', value: DataTableFilterMatchMode.NotEquals },
|
|
31
|
+
];
|
|
28
32
|
const optionsFor = (dataType) => {
|
|
29
33
|
switch (dataType) {
|
|
30
34
|
case 'numeric':
|
|
@@ -64,7 +68,7 @@ const defaultModeFor = (dataType) => {
|
|
|
64
68
|
return DataTableFilterMatchMode.DateIs;
|
|
65
69
|
return DataTableFilterMatchMode.Equals;
|
|
66
70
|
};
|
|
67
|
-
const ColumnFilterMenu = ({ field, dataType = 'text', placeholder, showMatchModes = true, filterElement, labels, pt, constraint, onApply, onClear, }) => {
|
|
71
|
+
const ColumnFilterMenu = ({ field, dataType = 'text', placeholder, showMatchModes = true, filterElement, filterOptions, labels, pt, constraint, onApply, onClear, }) => {
|
|
68
72
|
const [draftValue, setDraftValue] = useState(constraint?.value ?? null);
|
|
69
73
|
const [draftMode, setDraftMode] = useState(constraint?.matchMode ?? defaultModeFor(dataType));
|
|
70
74
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -115,7 +119,7 @@ const ColumnFilterMenu = ({ field, dataType = 'text', placeholder, showMatchMode
|
|
|
115
119
|
true: labels?.true ?? columnFilterMessages?.true ?? defaultColumnFilterMenuLabels.true,
|
|
116
120
|
false: labels?.false ?? columnFilterMessages?.false ?? defaultColumnFilterMenuLabels.false,
|
|
117
121
|
};
|
|
118
|
-
const modeOptions = optionsFor(dataType).map((option) => ({
|
|
122
|
+
const modeOptions = (filterOptions ? valueMatchModeOptions : optionsFor(dataType)).map((option) => ({
|
|
119
123
|
...option,
|
|
120
124
|
label: resolvedLabels.matchModeLabel(option.value, option.label),
|
|
121
125
|
}));
|
|
@@ -137,34 +141,36 @@ const ColumnFilterMenu = ({ field, dataType = 'text', placeholder, showMatchMode
|
|
|
137
141
|
onApply({ value: draftValue, matchMode: draftMode });
|
|
138
142
|
event?.preventDefault();
|
|
139
143
|
};
|
|
140
|
-
const valueInput =
|
|
141
|
-
?
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
144
|
+
const valueInput = filterOptions
|
|
145
|
+
? (jsx(Dropdown, { value: draftValue, options: filterOptions, optionLabel: 'label', optionValue: 'value', placeholder: placeholder, showClear: true, onChange: (value) => setDraftValue(() => value), "aria-label": resolvedLabels.valueAriaLabel(field), className: pt?.input?.className, style: pt?.input?.style }))
|
|
146
|
+
: filterElement
|
|
147
|
+
? filterElement({
|
|
148
|
+
field,
|
|
149
|
+
value: draftValue,
|
|
150
|
+
matchMode: draftMode,
|
|
151
|
+
onChange: (value) => setDraftValue(() => value),
|
|
152
|
+
onMatchModeChange: (matchMode) => setDraftMode(matchMode),
|
|
153
|
+
onApply: apply,
|
|
154
|
+
onClear: clear,
|
|
155
|
+
})
|
|
156
|
+
: (() => {
|
|
157
|
+
switch (dataType) {
|
|
158
|
+
case 'numeric':
|
|
159
|
+
return (jsx("input", { ...pt?.input, type: 'number', "aria-label": resolvedLabels.valueAriaLabel(field), value: typeof draftValue === 'number' ? draftValue : '', placeholder: placeholder, className: classNames('cratis-filter-menu__input', pt?.input?.className), onChange: (event) => setDraftValue(event.target.value === ''
|
|
160
|
+
? null
|
|
161
|
+
: event.target.valueAsNumber) }));
|
|
162
|
+
case 'date':
|
|
163
|
+
return (jsx(DatePickerInput, { value: draftValue instanceof Date ? draftValue : null, onChange: (value) => setDraftValue(value), showIcon: true, "aria-label": resolvedLabels.valueAriaLabel(field), className: pt?.input?.className, style: pt?.input?.style }));
|
|
164
|
+
case 'boolean':
|
|
165
|
+
return (jsx(Dropdown, { value: draftValue, options: [
|
|
166
|
+
{ label: resolvedLabels.true, value: true },
|
|
167
|
+
{ label: resolvedLabels.false, value: false },
|
|
168
|
+
], placeholder: placeholder, showClear: true, onChange: (value) => setDraftValue(value), "aria-label": resolvedLabels.valueAriaLabel(field), className: pt?.input?.className, style: pt?.input?.style }));
|
|
169
|
+
default:
|
|
170
|
+
return (jsx("input", { ...pt?.input, value: typeof draftValue === 'string' ? draftValue : '', "aria-label": resolvedLabels.valueAriaLabel(field), placeholder: placeholder, className: classNames('cratis-filter-menu__input', pt?.input?.className), onChange: (event) => setDraftValue(event.target.value) }));
|
|
171
|
+
}
|
|
172
|
+
})();
|
|
173
|
+
return (jsxs(DialogTrigger, { isOpen: isOpen, onOpenChange: setIsOpen, children: [jsx(Button, { ...asReactAriaButtonProps(pt?.trigger), ref: triggerRef, "aria-label": resolvedLabels.filterTriggerAriaLabel(field), className: classNames('cratis-filter-trigger', pt?.trigger?.className), "data-active": hasConstraint || undefined, "data-selected": hasConstraint || undefined, "data-open": isOpen || undefined, "data-cratis-part": 'filter-trigger', children: jsx("svg", { className: 'cratis-filter-trigger__icon', viewBox: '0 0 16 16', fill: 'currentColor', "aria-hidden": 'true', focusable: 'false', children: jsx("path", { d: 'M1.5 2.5A.5.5 0 0 1 2 2h12a.5.5 0 0 1 .38.82L10 8.1v4.52a.5.5 0 0 1-.24.43l-3 1.8A.5.5 0 0 1 6 14.42V8.1L1.62 2.82a.5.5 0 0 1-.12-.32Z' }) }) }), jsx(Popover, { ...pt?.popover, ref: capturePopover, className: classNames('cratis-filter-popover', pt?.popover?.className), "data-cratis-part": 'filter-popover', "data-open": isOpen || undefined, placement: 'bottom end', children: jsxs(Dialog, { ...pt?.menu, className: classNames('cratis-filter-menu', pt?.menu?.className), "data-cratis-part": 'filter-menu', "data-open": isOpen || undefined, "aria-label": resolvedLabels.filterTriggerAriaLabel(field), children: [showMatchModes && (jsx(Dropdown, { value: draftMode, options: modeOptions, optionLabel: 'label', optionValue: 'value', onChange: (value) => setDraftMode(value), "aria-label": resolvedLabels.matchModeAriaLabel, pt: pt?.matchMode })), valueInput, jsxs("div", { ...pt?.actions, className: classNames('cratis-filter-menu-actions', pt?.actions?.className), "data-cratis-part": 'filter-actions', children: [jsx(Button$1, { variant: 'outline', onClick: clear, label: resolvedLabels.clear, pt: pt?.clear }), jsx(Button$1, { onClick: apply, label: resolvedLabels.apply, pt: pt?.apply })] })] }) })] }));
|
|
168
174
|
};
|
|
169
175
|
|
|
170
176
|
export { ColumnFilterMenu, defaultColumnFilterMenuLabels };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnFilterMenu.js","sources":["../../../DataTables/ColumnFilterMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaButton","AriaDialog","Button"],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ColumnFilterMenu.js","sources":["../../../DataTables/ColumnFilterMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaButton","AriaDialog","Button"],"mappings":";;;;;;;;;;;;;;;;;AA4FO,MAAM,6BAA6B,GAA2B;IACjE,sBAAsB,EAAE,CAAC,KAAK,KAAK,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE;IACvD,cAAc,EAAE,CAAC,KAAK,KAAK,CAAA,iBAAA,EAAoB,KAAK,CAAA,CAAE;AACtD,IAAA,kBAAkB,EAAE,YAAY;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY;AACrD,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;;AAyDlB,MAAM,qBAAqB,GAAsB;IAC7C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,wBAAwB,CAAC,MAAM,EAAE;IAC3D,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,wBAAwB,CAAC,SAAS,EAAE;CACrE;AAED,MAAM,UAAU,GAAG,CAAC,QAA8B,KAAuB;IACrE,QAAQ,QAAQ;AACZ,QAAA,KAAK,SAAS;YACV,OAAO;AACH,gBAAA,CAAC,QAAQ,EAAE,wBAAwB,CAAC,MAAM,CAAC;AAC3C,gBAAA,CAAC,YAAY,EAAE,wBAAwB,CAAC,SAAS,CAAC;AAClD,gBAAA,CAAC,WAAW,EAAE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,CAAA,EAAA,CACE;AAExB;;"}
|
|
@@ -47,14 +47,24 @@ export interface DataTableCoreProps<TData extends object> {
|
|
|
47
47
|
dataKey?: string;
|
|
48
48
|
/** Content shown when the loaded page has no matching rows. */
|
|
49
49
|
emptyMessage: ReactNode;
|
|
50
|
-
/**
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Enables row selection. `'single'` selects one row at a time through row activation;
|
|
52
|
+
* `'multiple'` adds per-row checkboxes and a select-all header checkbox, and reports through
|
|
53
|
+
* {@link onSelectedItemsChange} rather than {@link onSelectionChange}.
|
|
54
|
+
*/
|
|
55
|
+
selectionMode?: 'single' | 'multiple';
|
|
52
56
|
/** Accessible name for row selection controls. Falls back to the provider's `dataTable.selectRow` message, then `'Select row'`. */
|
|
53
57
|
selectionAriaLabel?: string;
|
|
54
|
-
/**
|
|
58
|
+
/** Accessible name for the select-all control. Falls back to the provider's `dataTable.selectAllRows` message, then `'Select all rows'`. */
|
|
59
|
+
selectAllAriaLabel?: string;
|
|
60
|
+
/** Controlled selected row. Applies to `selectionMode='single'`. */
|
|
55
61
|
selection?: TData | null;
|
|
56
|
-
/** Invoked when row selection changes. */
|
|
62
|
+
/** Invoked when the single-row selection changes. */
|
|
57
63
|
onSelectionChange?: (event: DataTableSelectionChangeEvent<TData>) => void;
|
|
64
|
+
/** Controlled selected rows. Applies to `selectionMode='multiple'`. */
|
|
65
|
+
selectedItems?: TData[];
|
|
66
|
+
/** Invoked with the full set of selected rows when a multiple selection changes. */
|
|
67
|
+
onSelectedItemsChange?: (items: TData[]) => void;
|
|
58
68
|
/** Invoked when a row is clicked or keyboard activated. */
|
|
59
69
|
onRowClick?: (event: DataTableRowClickEvent<TData>) => void;
|
|
60
70
|
/** Builds an extra class name for one row. */
|
|
@@ -89,4 +99,4 @@ export interface DataTableCoreProps<TData extends object> {
|
|
|
89
99
|
unstyled?: boolean;
|
|
90
100
|
}
|
|
91
101
|
/** A semantic, renderer-independent data table over one already-loaded page. */
|
|
92
|
-
export declare const DataTableCore: <TData extends object>({ data, children, dataKey, emptyMessage, selectionMode, selectionAriaLabel, selection, onSelectionChange, onRowClick, rowClassName, globalFilterFields, globalSearchPlaceholder, globalSearchAriaLabel, defaultFilters, onFilter, scrollable, scrollHeight, className, style, pt, }: DataTableCoreProps<TData>) => React.JSX.Element;
|
|
102
|
+
export declare const DataTableCore: <TData extends object>({ data, children, dataKey, emptyMessage, selectionMode, selectionAriaLabel, selectAllAriaLabel, selection, onSelectionChange, selectedItems, onSelectedItemsChange, onRowClick, rowClassName, globalFilterFields, globalSearchPlaceholder, globalSearchAriaLabel, defaultFilters, onFilter, scrollable, scrollHeight, className, style, pt, }: DataTableCoreProps<TData>) => React.JSX.Element;
|