@cratis/components 4.31.0 → 4.33.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/compat-manifest.json +11 -11
- package/dist/esm/CommandDialog/CommandDialog.d.ts +3 -2
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +10 -0
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/DataPage/DataPage.d.ts +8 -0
- package/dist/esm/DataPage/DataPage.d.ts.map +1 -1
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/dist/esm/DataTables/DataTableBody.d.ts +3 -1
- package/dist/esm/DataTables/DataTableBody.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableBody.js +2 -2
- package/dist/esm/DataTables/DataTableBody.js.map +1 -1
- package/dist/esm/DataTables/DataTableCore.d.ts +7 -1
- package/dist/esm/DataTables/DataTableCore.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableCore.js +8 -3
- package/dist/esm/DataTables/DataTableCore.js.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +8 -0
- package/dist/esm/DataTables/DataTableForObservableQuery.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.js +2 -2
- package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.d.ts +8 -0
- package/dist/esm/DataTables/DataTableForQuery.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.js +2 -2
- package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
- package/dist/esm/DataTables/DataTableMessageOverrides.d.ts +1 -0
- package/dist/esm/DataTables/DataTableMessageOverrides.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableMessageOverrides.js.map +1 -1
- package/dist/esm/DataTables/DataTableMessages.d.ts +2 -0
- package/dist/esm/DataTables/DataTableMessages.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableMessages.js.map +1 -1
- package/dist/esm/DataTables/matchesFilterEntry.d.ts +7 -0
- package/dist/esm/DataTables/matchesFilterEntry.d.ts.map +1 -1
- package/dist/esm/DataTables/matchesFilterEntry.js +3 -1
- package/dist/esm/DataTables/matchesFilterEntry.js.map +1 -1
- package/dist/esm/DataTables/useDataTableMessages.d.ts +2 -1
- package/dist/esm/DataTables/useDataTableMessages.d.ts.map +1 -1
- package/dist/esm/DataTables/useDataTableMessages.js +6 -1
- package/dist/esm/DataTables/useDataTableMessages.js.map +1 -1
- package/dist/esm/DataTables/useServerQuery.d.ts +2 -1
- package/dist/esm/DataTables/useServerQuery.d.ts.map +1 -1
- package/dist/esm/DataTables/useServerQuery.js +2 -1
- package/dist/esm/DataTables/useServerQuery.js.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts +2 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +60 -2
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/package.json +1 -1
package/compat-manifest.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{
|
|
69
69
|
"name": "@cratis/components",
|
|
70
70
|
"role": "core",
|
|
71
|
-
"version": "4.
|
|
71
|
+
"version": "4.33.0",
|
|
72
72
|
"releaseMajorRange": ">=4 <5",
|
|
73
73
|
"independentRelease": false,
|
|
74
74
|
"private": false,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
{
|
|
93
93
|
"name": "@cratis/eslint-plugin-components",
|
|
94
94
|
"role": "eslint",
|
|
95
|
-
"version": "4.
|
|
95
|
+
"version": "4.33.0",
|
|
96
96
|
"releaseMajorRange": ">=4 <5",
|
|
97
97
|
"independentRelease": false,
|
|
98
98
|
"private": false,
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
{
|
|
106
106
|
"name": "@cratis/components.migrator",
|
|
107
107
|
"role": "migrator",
|
|
108
|
-
"version": "4.
|
|
108
|
+
"version": "4.33.0",
|
|
109
109
|
"releaseMajorRange": ">=4 <5",
|
|
110
110
|
"independentRelease": false,
|
|
111
111
|
"private": false,
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
{
|
|
117
117
|
"name": "@cratis/components.conformance",
|
|
118
118
|
"role": "conformance",
|
|
119
|
-
"version": "4.
|
|
119
|
+
"version": "4.33.0",
|
|
120
120
|
"releaseMajorRange": ">=4 <5",
|
|
121
121
|
"independentRelease": false,
|
|
122
122
|
"private": false,
|
|
123
123
|
"packageAccess": "public",
|
|
124
124
|
"peerDependencies": {
|
|
125
|
-
"@cratis/components": "4.
|
|
125
|
+
"@cratis/components": "4.33.0",
|
|
126
126
|
"react": "^19.0.0",
|
|
127
127
|
"react-dom": "^19.0.0"
|
|
128
128
|
},
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
{
|
|
133
133
|
"name": "@cratis/components.mui",
|
|
134
134
|
"role": "renderer-adapter",
|
|
135
|
-
"version": "4.
|
|
135
|
+
"version": "4.33.0",
|
|
136
136
|
"releaseMajorRange": ">=4 <5",
|
|
137
137
|
"independentRelease": false,
|
|
138
138
|
"private": false,
|
|
139
139
|
"packageAccess": "public",
|
|
140
140
|
"peerDependencies": {
|
|
141
|
-
"@cratis/components": "4.
|
|
141
|
+
"@cratis/components": "4.33.0",
|
|
142
142
|
"@emotion/react": ">=11.5 <12",
|
|
143
143
|
"@emotion/styled": ">=11.11 <12",
|
|
144
144
|
"@mui/material": ">=9 <10",
|
|
@@ -188,13 +188,13 @@
|
|
|
188
188
|
{
|
|
189
189
|
"name": "@cratis/components.primereact",
|
|
190
190
|
"role": "renderer-adapter",
|
|
191
|
-
"version": "4.
|
|
191
|
+
"version": "4.33.0",
|
|
192
192
|
"releaseMajorRange": ">=4 <5",
|
|
193
193
|
"independentRelease": false,
|
|
194
194
|
"private": false,
|
|
195
195
|
"packageAccess": "public",
|
|
196
196
|
"peerDependencies": {
|
|
197
|
-
"@cratis/components": "4.
|
|
197
|
+
"@cratis/components": "4.33.0",
|
|
198
198
|
"@primereact/core": ">=11 <12",
|
|
199
199
|
"@primereact/ui": ">=11 <12",
|
|
200
200
|
"@primeuix/themes": ">=3 <4",
|
|
@@ -256,13 +256,13 @@
|
|
|
256
256
|
{
|
|
257
257
|
"name": "@cratis/components.primereact10",
|
|
258
258
|
"role": "renderer-adapter",
|
|
259
|
-
"version": "4.
|
|
259
|
+
"version": "4.33.0",
|
|
260
260
|
"releaseMajorRange": ">=4 <5",
|
|
261
261
|
"independentRelease": false,
|
|
262
262
|
"private": false,
|
|
263
263
|
"packageAccess": "public",
|
|
264
264
|
"peerDependencies": {
|
|
265
|
-
"@cratis/components": "4.
|
|
265
|
+
"@cratis/components": "4.33.0",
|
|
266
266
|
"primereact": ">=10.9.9 <11",
|
|
267
267
|
"react": "^19.0.0",
|
|
268
268
|
"react-dom": "^19.0.0"
|
|
@@ -75,8 +75,9 @@ export interface CommandDialogProps<TCommand extends object, TResponse = object>
|
|
|
75
75
|
* stays open and the `CommandResult` is set on the form context so the
|
|
76
76
|
* UI can surface the error to the user.
|
|
77
77
|
*
|
|
78
|
-
* Throughout, the dialog is in the `isBusy` state —
|
|
79
|
-
* disabled and
|
|
78
|
+
* Throughout, the dialog is in the `isBusy` state — the confirm button keeps
|
|
79
|
+
* focus but is `aria-disabled` and ignores activation, the other action
|
|
80
|
+
* buttons are disabled, and the confirm button shows a spinner.
|
|
80
81
|
*
|
|
81
82
|
* ## Destructive commands and initial focus
|
|
82
83
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.d.ts","sourceRoot":"","sources":["../../../CommandDialog/CommandDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,sBAAmB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAA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3E,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5C;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAElD;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAoHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,QAAA,MAAM,sBAAsB;KAAI,QAAQ,SAAS,MAAM,WAAW,SAAS,kBAChE,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC;;CA8EjD,CAAC;AAEF,QAAA,MAAM,0BAA0B,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,sBAE9E,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,+BAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';\nimport { Dialog, type DialogProps } from '../Dialogs/Dialog';\nimport React from 'react';\nimport {\n CommandForm,\n CommandFormFieldWrapper,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport {\n isCommandFormField,\n markAsCommandFormColumn,\n} from '../CommandForm/commandFormMarkers';\n\n/**\n * Props for {@link CommandDialog}. Combines the props of a `CommandForm`\n * (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,\n * `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,\n * `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props\n * such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.\n *\n * @typeParam TCommand - The command record type (must extend `object`).\n * @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.\n */\nexport interface CommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n Omit<DialogProps, 'children' | 'isBusy'> {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on confirm. It **must return** the values to run with\n * (mutated or not) — a callback that returns nothing does not execute the\n * command with `undefined`; the current values are kept and a warning is\n * logged. May be async.\n *\n * ⚠️ It runs **only on submit**, after the form has already been validated,\n * so a value produced here can never satisfy required-field validation — the\n * submit button stays disabled if a required value is only seeded here. Seed\n * required values through `initialValues`; reserve `onBeforeExecute` for\n * transforms that do not affect validity (for example a generated id).\n */\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n\n /**\n * Ask whether to run the command after validation and `onBeforeExecute`.\n * Receives the transformed values. Only `true` executes; all other outcomes\n * keep the dialog open. May return a promise (for example from a confirmation dialog).\n * If command values change while confirmation is pending, execution is skipped\n * and the dialog stays open; confirm the new values again.\n * Unlike `onConfirm`, this runs before execution, not after success.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n\n /**\n * Form fields and arbitrary content for the dialog body. Children that are\n * `CommandFormField` instances are automatically wrapped so they bind to\n * the command instance.\n */\n children?: React.ReactNode;\n}\n\n// Requiring each key here makes a newly added Dialog prop fail compilation until it is routed.\ntype ForwardedDialogProps = Omit<DialogProps, 'children' | 'isBusy'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy'>, unknown>;\n\nconst CommandDialogWrapper = <TCommand extends object, TResponse = object>({\n isValid,\n onClose,\n onConfirm,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n children,\n ...dialogProps\n}: Omit<DialogProps, 'isBusy'> & {\n onSuccess?: CommandFormProps<TCommand, TResponse>['onSuccess'];\n onValidationFailure?: CommandFormProps<TCommand, TResponse>['onValidationFailure'];\n onFailed?: CommandFormProps<TCommand, TResponse>['onFailed'];\n onException?: CommandFormProps<TCommand, TResponse>['onException'];\n onUnauthorized?: CommandFormProps<TCommand, TResponse>['onUnauthorized'];\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n}) => {\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n\n const handleConfirm = async () => {\n const result = await submission.run();\n if (!result) return false;\n\n if (!result.isSuccess) {\n await onFailed?.(result);\n if (result.hasExceptions) {\n await onException?.(result.exceptionMessages, result.exceptionStackTrace);\n }\n if (!result.isAuthorized) await onUnauthorized?.();\n if (!result.isValid) {\n await onValidationFailure?.(result.validationResults);\n }\n if (submission.isMounted()) setCommandResult(result);\n return false;\n }\n\n await onSuccess?.(result.response as TResponse);\n if (onConfirm) {\n const closeResult = await onConfirm();\n return closeResult === true;\n }\n if (onClose) {\n const closeResult = await onClose(DialogResult.Ok);\n return closeResult !== false;\n }\n return true;\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n type FieldElement = Parameters<\n typeof CommandFormFieldWrapper\n >[0]['field'];\n // SAFETY: isCommandFormField guards that child.type is a command form field component.\n return (\n <CommandFormFieldWrapper field={child as unknown as FieldElement} />\n );\n }\n\n const childProps = child.props as Record<string, unknown>;\n // A function child is a render prop, not a node: mapping it would replace the\n // function with its mapped result and break the component that calls it.\n if (childProps.children != null && typeof childProps.children !== 'function') {\n return React.cloneElement(\n child as React.ReactElement<Record<string, unknown>>,\n {\n children: processChildren(childProps.children as React.ReactNode),\n },\n );\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n const isDialogValid = isValid !== false && isCommandFormValid;\n\n return (\n <Dialog\n {...dialogProps}\n onClose={onClose}\n onConfirm={handleConfirm}\n isValid={isDialogValid}\n isBusy={submission.isSubmitting}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * ## Where `TCommand` comes from\n *\n * `TCommand` is an auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# `[Command]` record. `dotnet build` writes a `.ts` file\n * per command with the right property types and a typed `execute()` method;\n * importing the class is all the connection-to-the-backend you need. The\n * class also exposes a `.use()` hook for direct (non-dialog) usage and a\n * `useWithChangeTracking()` variant.\n *\n * ## What happens on confirm\n *\n * 1. If `onBeforeExecute` is supplied, it transforms the command values.\n * Used for generated IDs (`Guid.create()`) that the user did not type in.\n * 2. The command's `execute()` runs through Arc's command pipeline. The\n * backend handler returns either a typed response (mapped to `TResponse`)\n * or a `ValidationResult[]`.\n * 3. On `IsSuccess: true`, `onSuccess(response)` fires and the dialog closes\n * through the dialog host context.\n * 4. On a validation failure, `onValidationFailure(errors)` fires and the\n * form's per-field error display is updated. The dialog stays open.\n * 5. On a domain or transport failure, `onFailed(result)` fires. The dialog\n * stays open and the `CommandResult` is set on the form context so the\n * UI can surface the error to the user.\n *\n * Throughout, the dialog is in the `isBusy` state — every action button is\n * disabled and the confirm button shows a spinner.\n *\n * ## Destructive commands and initial focus\n *\n * The confirm button is focused when the dialog opens, and a focused native\n * button fires `click` from the `keydown` of `Enter`. A command whose form\n * has required fields is protected from a held or double-tapped `Enter` for\n * free, because `isCommandFormValid` keeps confirm disabled until something\n * is filled in. A command that takes **no** input — the typical \"delete\n * this, permanently\" command — has no such gate, so its confirm button is\n * armed the instant the dialog appears.\n *\n * Pass `initialFocus` (forwarded straight to {@link Dialog}) for those:\n *\n * ```tsx\n * <CommandDialog<DeletePerson>\n * command={DeletePerson}\n * title=\"Delete personal data?\"\n * okLabel=\"Delete\"\n * initialFocus={DialogInitialFocus.Cancel}\n * onSuccess={() => closeDialog(DialogResult.Ok)}>\n * This cannot be undone.\n * </CommandDialog>\n * ```\n *\n * Everything else — the footer, the close (X), `Escape`, and the confirm\n * wiring that runs the command — is untouched.\n *\n * ## Field binding\n *\n * Children that are `CommandFormField` instances (`InputTextField`,\n * `NumberField`, `DropdownField`, every `@cratis/components/CommandForm/fields`\n * widget) bind to a property on the command via the `value` accessor:\n *\n * ```tsx\n * <InputTextField value={c => c.name} title=\"Name\" />\n * ```\n *\n * The accessor's argument is the command instance — TypeScript infers\n * `c.name` is a string and the field type-checks against that. Arbitrary\n * non-field children (custom layout, additional text, decorative elements)\n * are rendered as plain content.\n *\n * ## Typed dialog host usage\n *\n * Combine with `useDialog<CommandResult<TResponse>>()` from\n * `@cratis/arc.react/dialogs` to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { CommandDialog } from '@cratis/components/CommandDialog';\n * import { RegisterAuthor } from './RegisterAuthor'; // proxy from C#\n *\n * type RegisterAuthorResponse = { authorId: string };\n *\n * const RegisterAuthorDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterAuthorResponse>>();\n * return (\n * <CommandDialog<RegisterAuthor, RegisterAuthorResponse>\n * command={RegisterAuthor}\n * title=\"Register author\"\n * okLabel=\"Register\"\n * onSuccess={(response) => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <InputTextField value={c => c.name} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </CommandDialog>\n * );\n * };\n * ```\n *\n * ## What's special vs. raw Dialog + CommandForm\n *\n * - Confirm wiring (`onConfirm` → `commandInstance.execute()`) is handled\n * internally; you only supply `onSuccess` / `onValidationFailure` / `onFailed`.\n * - The dialog's `isBusy` state tracks the in-flight command without manual\n * `useState`.\n * - Field error propagation from `CommandResult.validationResults` to the\n * form context is automatic.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n * @param props - {@link CommandDialogProps}.\n */\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(\n props: CommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons = DialogButtons.OkCancel,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n className,\n pt,\n ptOptions,\n unstyled,\n children,\n ...commandFormProps\n } = props;\n\n const dialogProps = {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n className,\n pt,\n ptOptions,\n unstyled,\n } satisfies ForwardedDialogProps;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <CommandDialogWrapper<TCommand, TResponse>\n {...dialogProps}\n onSuccess={props.onSuccess}\n onValidationFailure={props.onValidationFailure}\n onFailed={props.onFailed}\n onException={props.onException}\n onUnauthorized={props.onUnauthorized}\n onBeforeExecute={onBeforeExecute}\n confirmBeforeExecute={confirmBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nmarkAsCommandFormColumn(CommandDialogColumnWrapper);\n\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * See {@link CommandDialogComponent} for full documentation.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n */\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAwEA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,GAAG,WAAW,EASjB,KAAI;AACD,IAAA,MAAM,EACF,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAAE,kBAAkB,GAC9B,GAAG,qBAAqB,EAAY;AACrC,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAY;AACtD,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAClC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,CACxF;AAED,IAAA,MAAM,aAAa,GAAG,YAAW;AAC7B,QAAA,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE;AACrC,QAAA,IAAI,C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T,QAAQ,EACR,QAAQ,EACR,GAAG,gBAAgB,EACtB,GAAG,KAAK;AAET,IAAA,MAAM,WAAW,GAAG;QAChB,KAAK;QACL,QAAQ;QACR,SAAS;QACT,SAAS;QACT,OAAO;QACP,KAAK;QACL,KAAK;QACL,YAAY;QACZ,SAAS;QACT,OAAO;QACP,YAAY;QACZ,OAAO;QACP,WAAW;QACX,QAAQ;QACR,OAAO;QACP,WAAW;QACX,cAAc;QACd,OAAO;QACP,OAAO;QACP,SAAS;QACT,QAAQ;QACR,SAAS;QACT,EAAE;QACF,SAAS;QACT,QAAQ;KACoB;IAEhC,QACIA,GAAA,CAAC,WAAW,EAAA,EAAA,GAA0B,gBAAgB,YAClDA,GAAA,CAAC,oBAAoB,EAAA,EAAA,GACb,WAAW,EACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAAA,QAAA,EAEzC,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;;"}
|
|
1
|
+
{"version":3,"file":"CommandDialog.js","sources":["../../../CommandDialog/CommandDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogButtons, DialogResult } from '@cratis/arc.react/dialogs';\nimport { Dialog, type DialogProps } from '../Dialogs/Dialog';\nimport React from 'react';\nimport {\n CommandForm,\n CommandFormFieldWrapper,\n useCommandFormContext,\n useCommandInstance,\n type CommandFormProps,\n} from '@cratis/arc.react/commands';\nimport type { BeforeExecuteCallback } from './applyBeforeExecute';\nimport type { ConfirmBeforeExecute } from './confirmBeforeExecute';\nimport { useCommandExecution } from './useCommandExecution';\nimport {\n isCommandFormField,\n markAsCommandFormColumn,\n} from '../CommandForm/commandFormMarkers';\n\n/**\n * Props for {@link CommandDialog}. Combines the props of a `CommandForm`\n * (`command`, `initialValues`, `onSuccess`, `onValidationFailure`, `onFailed`,\n * `onBeforeExecute`, etc.) with the props of a {@link Dialog} (`title`,\n * `buttons`, `width`, `pt`, `unstyled`, …). Dialog presentation props\n * such as `subtitle`, `placement`, and `closeIcon` are forwarded to the dialog.\n *\n * @typeParam TCommand - The command record type (must extend `object`).\n * @typeParam TResponse - The response payload type returned by a successful command. Defaults to `object`.\n */\nexport interface CommandDialogProps<TCommand extends object, TResponse = object>\n extends\n Omit<CommandFormProps<TCommand, TResponse>, 'children' | 'onBeforeExecute'>,\n Omit<DialogProps, 'children' | 'isBusy'> {\n /**\n * A transformer invoked with the current command values immediately before\n * the command executes on confirm. It **must return** the values to run with\n * (mutated or not) — a callback that returns nothing does not execute the\n * command with `undefined`; the current values are kept and a warning is\n * logged. May be async.\n *\n * ⚠️ It runs **only on submit**, after the form has already been validated,\n * so a value produced here can never satisfy required-field validation — the\n * submit button stays disabled if a required value is only seeded here. Seed\n * required values through `initialValues`; reserve `onBeforeExecute` for\n * transforms that do not affect validity (for example a generated id).\n */\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n\n /**\n * Ask whether to run the command after validation and `onBeforeExecute`.\n * Receives the transformed values. Only `true` executes; all other outcomes\n * keep the dialog open. May return a promise (for example from a confirmation dialog).\n * If command values change while confirmation is pending, execution is skipped\n * and the dialog stays open; confirm the new values again.\n * Unlike `onConfirm`, this runs before execution, not after success.\n */\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n\n /**\n * Form fields and arbitrary content for the dialog body. Children that are\n * `CommandFormField` instances are automatically wrapped so they bind to\n * the command instance.\n */\n children?: React.ReactNode;\n}\n\n// Requiring each key here makes a newly added Dialog prop fail compilation until it is routed.\ntype ForwardedDialogProps = Omit<DialogProps, 'children' | 'isBusy'> &\n Record<keyof Omit<DialogProps, 'children' | 'isBusy'>, unknown>;\n\nconst CommandDialogWrapper = <TCommand extends object, TResponse = object>({\n isValid,\n onClose,\n onConfirm,\n onSuccess,\n onValidationFailure,\n onFailed,\n onException,\n onUnauthorized,\n onBeforeExecute,\n confirmBeforeExecute,\n children,\n ...dialogProps\n}: Omit<DialogProps, 'isBusy'> & {\n onSuccess?: CommandFormProps<TCommand, TResponse>['onSuccess'];\n onValidationFailure?: CommandFormProps<TCommand, TResponse>['onValidationFailure'];\n onFailed?: CommandFormProps<TCommand, TResponse>['onFailed'];\n onException?: CommandFormProps<TCommand, TResponse>['onException'];\n onUnauthorized?: CommandFormProps<TCommand, TResponse>['onUnauthorized'];\n onBeforeExecute?: BeforeExecuteCallback<TCommand>;\n confirmBeforeExecute?: ConfirmBeforeExecute<TCommand>;\n}) => {\n const {\n setCommandValues,\n setCommandResult,\n isValid: isCommandFormValid,\n } = useCommandFormContext<TCommand>();\n const commandInstance = useCommandInstance<TCommand>();\n const submission = useCommandExecution<TCommand, TResponse>(\n commandInstance, setCommandValues, onBeforeExecute, confirmBeforeExecute, onException,\n );\n\n const handleConfirm = async () => {\n const result = await submission.run();\n if (!result) return false;\n\n if (!result.isSuccess) {\n await onFailed?.(result);\n if (result.hasExceptions) {\n await onException?.(result.exceptionMessages, result.exceptionStackTrace);\n }\n if (!result.isAuthorized) await onUnauthorized?.();\n if (!result.isValid) {\n await onValidationFailure?.(result.validationResults);\n }\n if (submission.isMounted()) setCommandResult(result);\n return false;\n }\n\n await onSuccess?.(result.response as TResponse);\n if (onConfirm) {\n const closeResult = await onConfirm();\n return closeResult === true;\n }\n if (onClose) {\n const closeResult = await onClose(DialogResult.Ok);\n return closeResult !== false;\n }\n return true;\n };\n\n const processChildren = (nodes: React.ReactNode): React.ReactNode => {\n return React.Children.map(nodes, (child) => {\n if (!React.isValidElement(child)) return child;\n\n const component = child.type as React.ComponentType<unknown>;\n if (isCommandFormField(component)) {\n type FieldElement = Parameters<\n typeof CommandFormFieldWrapper\n >[0]['field'];\n // SAFETY: isCommandFormField guards that child.type is a command form field component.\n return (\n <CommandFormFieldWrapper field={child as unknown as FieldElement} />\n );\n }\n\n const childProps = child.props as Record<string, unknown>;\n // A function child is a render prop, not a node: mapping it would replace the\n // function with its mapped result and break the component that calls it.\n if (childProps.children != null && typeof childProps.children !== 'function') {\n return React.cloneElement(\n child as React.ReactElement<Record<string, unknown>>,\n {\n children: processChildren(childProps.children as React.ReactNode),\n },\n );\n }\n\n return child;\n });\n };\n\n const processedChildren = processChildren(children);\n const isDialogValid = isValid !== false && isCommandFormValid;\n\n return (\n <Dialog\n {...dialogProps}\n onClose={onClose}\n onConfirm={handleConfirm}\n isValid={isDialogValid}\n isBusy={submission.isSubmitting}\n >\n <div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>\n {processedChildren}\n </div>\n </Dialog>\n );\n};\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * ## Where `TCommand` comes from\n *\n * `TCommand` is an auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# `[Command]` record. `dotnet build` writes a `.ts` file\n * per command with the right property types and a typed `execute()` method;\n * importing the class is all the connection-to-the-backend you need. The\n * class also exposes a `.use()` hook for direct (non-dialog) usage and a\n * `useWithChangeTracking()` variant.\n *\n * ## What happens on confirm\n *\n * 1. If `onBeforeExecute` is supplied, it transforms the command values.\n * Used for generated IDs (`Guid.create()`) that the user did not type in.\n * 2. The command's `execute()` runs through Arc's command pipeline. The\n * backend handler returns either a typed response (mapped to `TResponse`)\n * or a `ValidationResult[]`.\n * 3. On `IsSuccess: true`, `onSuccess(response)` fires and the dialog closes\n * through the dialog host context.\n * 4. On a validation failure, `onValidationFailure(errors)` fires and the\n * form's per-field error display is updated. The dialog stays open.\n * 5. On a domain or transport failure, `onFailed(result)` fires. The dialog\n * stays open and the `CommandResult` is set on the form context so the\n * UI can surface the error to the user.\n *\n * Throughout, the dialog is in the `isBusy` state — the confirm button keeps\n * focus but is `aria-disabled` and ignores activation, the other action\n * buttons are disabled, and the confirm button shows a spinner.\n *\n * ## Destructive commands and initial focus\n *\n * The confirm button is focused when the dialog opens, and a focused native\n * button fires `click` from the `keydown` of `Enter`. A command whose form\n * has required fields is protected from a held or double-tapped `Enter` for\n * free, because `isCommandFormValid` keeps confirm disabled until something\n * is filled in. A command that takes **no** input — the typical \"delete\n * this, permanently\" command — has no such gate, so its confirm button is\n * armed the instant the dialog appears.\n *\n * Pass `initialFocus` (forwarded straight to {@link Dialog}) for those:\n *\n * ```tsx\n * <CommandDialog<DeletePerson>\n * command={DeletePerson}\n * title=\"Delete personal data?\"\n * okLabel=\"Delete\"\n * initialFocus={DialogInitialFocus.Cancel}\n * onSuccess={() => closeDialog(DialogResult.Ok)}>\n * This cannot be undone.\n * </CommandDialog>\n * ```\n *\n * Everything else — the footer, the close (X), `Escape`, and the confirm\n * wiring that runs the command — is untouched.\n *\n * ## Field binding\n *\n * Children that are `CommandFormField` instances (`InputTextField`,\n * `NumberField`, `DropdownField`, every `@cratis/components/CommandForm/fields`\n * widget) bind to a property on the command via the `value` accessor:\n *\n * ```tsx\n * <InputTextField value={c => c.name} title=\"Name\" />\n * ```\n *\n * The accessor's argument is the command instance — TypeScript infers\n * `c.name` is a string and the field type-checks against that. Arbitrary\n * non-field children (custom layout, additional text, decorative elements)\n * are rendered as plain content.\n *\n * ## Typed dialog host usage\n *\n * Combine with `useDialog<CommandResult<TResponse>>()` from\n * `@cratis/arc.react/dialogs` to get a fully-typed result at the call site:\n *\n * ```tsx\n * import { useDialog, DialogResult } from '@cratis/arc.react/dialogs';\n * import { CommandDialog } from '@cratis/components/CommandDialog';\n * import { RegisterAuthor } from './RegisterAuthor'; // proxy from C#\n *\n * type RegisterAuthorResponse = { authorId: string };\n *\n * const RegisterAuthorDialog = () => {\n * const { closeDialog } = useDialogContext<CommandResult<RegisterAuthorResponse>>();\n * return (\n * <CommandDialog<RegisterAuthor, RegisterAuthorResponse>\n * command={RegisterAuthor}\n * title=\"Register author\"\n * okLabel=\"Register\"\n * onSuccess={(response) => closeDialog(DialogResult.Ok)}\n * onCancel={() => closeDialog(DialogResult.Cancelled)}>\n * <InputTextField value={c => c.name} title=\"Name\" />\n * <InputTextField value={c => c.email} title=\"Email\" />\n * </CommandDialog>\n * );\n * };\n * ```\n *\n * ## What's special vs. raw Dialog + CommandForm\n *\n * - Confirm wiring (`onConfirm` → `commandInstance.execute()`) is handled\n * internally; you only supply `onSuccess` / `onValidationFailure` / `onFailed`.\n * - The dialog's `isBusy` state tracks the in-flight command without manual\n * `useState`.\n * - Field error propagation from `CommandResult.validationResults` to the\n * form context is automatic.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n * @param props - {@link CommandDialogProps}.\n */\nconst CommandDialogComponent = <TCommand extends object = object, TResponse = object>(\n props: CommandDialogProps<TCommand, TResponse>,\n) => {\n const {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons = DialogButtons.OkCancel,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n onBeforeExecute,\n confirmBeforeExecute,\n className,\n pt,\n ptOptions,\n unstyled,\n children,\n ...commandFormProps\n } = props;\n\n const dialogProps = {\n title,\n subtitle,\n placement,\n closeIcon,\n visible,\n width,\n style,\n contentStyle,\n resizable,\n buttons,\n initialFocus,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n dismissable,\n closeAriaLabel,\n isValid,\n onClose,\n onConfirm,\n onCancel,\n className,\n pt,\n ptOptions,\n unstyled,\n } satisfies ForwardedDialogProps;\n\n return (\n <CommandForm<TCommand, TResponse> {...commandFormProps}>\n <CommandDialogWrapper<TCommand, TResponse>\n {...dialogProps}\n onSuccess={props.onSuccess}\n onValidationFailure={props.onValidationFailure}\n onFailed={props.onFailed}\n onException={props.onException}\n onUnauthorized={props.onUnauthorized}\n onBeforeExecute={onBeforeExecute}\n confirmBeforeExecute={confirmBeforeExecute}\n >\n {children}\n </CommandDialogWrapper>\n </CommandForm>\n );\n};\n\nconst CommandDialogColumnWrapper = ({ children }: { children: React.ReactNode }) => (\n <CommandForm.Column>{children}</CommandForm.Column>\n);\nmarkAsCommandFormColumn(CommandDialogColumnWrapper);\n\nCommandDialogComponent.Column = CommandDialogColumnWrapper;\n\n/**\n * A {@link Dialog} that hosts a Cratis Arc `CommandForm`, runs the bound\n * command on confirm, and only closes when the command succeeds. This is\n * the standard pattern for \"user fills in a form, clicks OK, command runs\n * server-side, dialog dismisses\" — `CommandDialog` collapses about thirty\n * lines of orchestration into the props on a single component.\n *\n * See {@link CommandDialogComponent} for full documentation.\n *\n * @typeParam TCommand - The command class (proxy generated from C# `[Command]`).\n * @typeParam TResponse - The success payload type returned by the command's `Handle()` method on the backend.\n */\nexport const CommandDialog = CommandDialogComponent;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAwEA,MAAM,oBAAoB,GAAG,CAA8C,EACvE,OAAO,EACP,OAAO,EACP,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,GAAG,WAAW,EASjB,KAAI;AACD,IAAA,MAAM,EACF,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAA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AAC,0BAA0B,CAAC;AAEnD,sBAAsB,CAAC,MAAM,GAAG,0BAA0B;AAcnD,MAAM,aAAa,GAAG;;"}
|
|
@@ -62,6 +62,12 @@ export interface CratisDialogMessages {
|
|
|
62
62
|
no?: string;
|
|
63
63
|
/** Accessible name for the header close (×) action. */
|
|
64
64
|
close?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Polite announcement made when a confirm is refused and the dialog stays open
|
|
67
|
+
* (validation failure or business rule). Defaults to
|
|
68
|
+
* 'The action was not completed. Review the dialog and try again.'
|
|
69
|
+
*/
|
|
70
|
+
refused?: string;
|
|
65
71
|
}
|
|
66
72
|
/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */
|
|
67
73
|
export interface CratisStepperMessages {
|
|
@@ -95,6 +101,10 @@ export interface CratisDataTableMessages {
|
|
|
95
101
|
failed?: string;
|
|
96
102
|
/** Message shown when a query denies access. */
|
|
97
103
|
unauthorized?: string;
|
|
104
|
+
/** Message shown when a search or filter leaves no rows on the loaded page. */
|
|
105
|
+
filteredEmpty?: string;
|
|
106
|
+
/** Message shown when a search or filter leaves no rows in server mode. */
|
|
107
|
+
filteredEmptyServer?: string;
|
|
98
108
|
}
|
|
99
109
|
/** Localizable accessible names for the Cratis filter panel and its searches. */
|
|
100
110
|
export interface CratisFilterMessages {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratisComponentsProvider.d.ts","sourceRoot":"","sources":["../../../Common/CratisComponentsProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,6BAA0B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAgC,CAAC;AAM/E,OAAO,EAAE,cAAc,EAAE,MAAM,8CA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qEAAqE;AACrE,MAAM,WAAW,sBAAsB;IACnC,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,oFAAoF;IACpF,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CAClD;AAED,0DAA0D;AAC1D,MAAM,WAAW,6BAA6B;IAC1C,4CAA4C;IAC5C,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,kBAAkB,EAAE,CAAC;IAC7D,iEAAiE;IACjE,WAAW,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACnC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;IAC9C;;;OAGG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,UAC7B,sBAAsB,GAAG,SAAS,KAC1C,sBAIF,CAAC;AAoEF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,6GASlC,6BAA6B,gCAyB/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst withLegacyLocaleMessages = (\n config: CratisComponentsConfig,\n explicitMessages: CratisComponentsMessages | undefined,\n): CratisComponentsConfig => {\n const legacy = config.locale ? config.locales?.[config.locale] : undefined;\n if (!legacy) return config;\n return {\n ...config,\n messages: {\n ...config.messages,\n paginator: {\n ...config.messages?.paginator,\n navigation:\n explicitMessages?.paginator?.navigation ??\n legacy.aria?.navigation ??\n config.messages?.paginator?.navigation,\n first:\n explicitMessages?.paginator?.first ??\n legacy.aria?.firstPageLabel ??\n config.messages?.paginator?.first,\n previous:\n explicitMessages?.paginator?.previous ??\n legacy.aria?.prevPageLabel ??\n config.messages?.paginator?.previous,\n next:\n explicitMessages?.paginator?.next ??\n legacy.aria?.nextPageLabel ??\n config.messages?.paginator?.next,\n last:\n explicitMessages?.paginator?.last ??\n legacy.aria?.lastPageLabel ??\n config.messages?.paginator?.last,\n },\n datePicker: {\n ...config.messages?.datePicker,\n today:\n explicitMessages?.datePicker?.today ??\n legacy.today ??\n config.messages?.datePicker?.today,\n clear:\n explicitMessages?.datePicker?.clear ??\n legacy.clear ??\n config.messages?.datePicker?.clear,\n openCalendar:\n explicitMessages?.datePicker?.openCalendar ??\n config.messages?.datePicker?.openCalendar,\n previousMonth:\n explicitMessages?.datePicker?.previousMonth ??\n config.messages?.datePicker?.previousMonth,\n nextMonth:\n explicitMessages?.datePicker?.nextMonth ??\n config.messages?.datePicker?.nextMonth,\n },\n },\n };\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(\n () =>\n withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages),\n [value],\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && (\n <Toaster {...(typeof toaster === 'object' ? toaster : {})} />\n )}\n </I18nProvider>\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;AAqQnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAA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I;IAChC,MAAM,QAAQ,GAAG,OAAO,CACpB,MACI,wBAAwB,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,EACjF,CAAC,KAAK,CAAC,CACV;AAED,IAAA,QACIA,GAAA,CAAC,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;;"}
|
|
1
|
+
{"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n /**\n * Polite announcement made when a confirm is refused and the dialog stays open\n * (validation failure or business rule). Defaults to\n * 'The action was not completed. Review the dialog and try again.'\n */\n refused?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst withLegacyLocaleMessages = (\n config: CratisComponentsConfig,\n explicitMessages: CratisComponentsMessages | undefined,\n): CratisComponentsConfig => {\n const legacy = config.locale ? config.locales?.[config.locale] : undefined;\n if (!legacy) return config;\n return {\n ...config,\n messages: {\n ...config.messages,\n paginator: {\n ...config.messages?.paginator,\n navigation:\n explicitMessages?.paginator?.navigation ??\n legacy.aria?.navigation ??\n config.messages?.paginator?.navigation,\n first:\n explicitMessages?.paginator?.first ??\n legacy.aria?.firstPageLabel ??\n config.messages?.paginator?.first,\n previous:\n explicitMessages?.paginator?.previous ??\n legacy.aria?.prevPageLabel ??\n config.messages?.paginator?.previous,\n next:\n explicitMessages?.paginator?.next ??\n legacy.aria?.nextPageLabel ??\n config.messages?.paginator?.next,\n last:\n explicitMessages?.paginator?.last ??\n legacy.aria?.lastPageLabel ??\n config.messages?.paginator?.last,\n },\n datePicker: {\n ...config.messages?.datePicker,\n today:\n explicitMessages?.datePicker?.today ??\n legacy.today ??\n config.messages?.datePicker?.today,\n clear:\n explicitMessages?.datePicker?.clear ??\n legacy.clear ??\n config.messages?.datePicker?.clear,\n openCalendar:\n explicitMessages?.datePicker?.openCalendar ??\n config.messages?.datePicker?.openCalendar,\n previousMonth:\n explicitMessages?.datePicker?.previousMonth ??\n config.messages?.datePicker?.previousMonth,\n nextMonth:\n explicitMessages?.datePicker?.nextMonth ??\n config.messages?.datePicker?.nextMonth,\n },\n },\n };\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(\n () =>\n withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages),\n [value],\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && (\n <Toaster {...(typeof toaster === 'object' ? toaster : {})} />\n )}\n </I18nProvider>\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,qBAAqB;AA+QnC,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,GAAG,KAAK,EA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K,CAAC,CACV;AAED,IAAA,QACIA,GAAA,CAAC,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;;"}
|
|
@@ -115,6 +115,14 @@ export interface DataPageProps<TQuery extends IQueryFor<TDataType, TArguments> |
|
|
|
115
115
|
* The message to show when there is no data
|
|
116
116
|
*/
|
|
117
117
|
emptyMessage: string;
|
|
118
|
+
/**
|
|
119
|
+
* The message to show instead of {@link emptyMessage} when a search or column filter is active
|
|
120
|
+
* and no rows are shown. Defaults to a localizable message that says only the loaded page was
|
|
121
|
+
* searched, or, with `serverQuery`, a neutral "No rows match the search.".
|
|
122
|
+
*/
|
|
123
|
+
filteredEmptyMessage?: ReactNode;
|
|
124
|
+
/** Notified of every change to the search text, as typed. */
|
|
125
|
+
onGlobalFilterChange?: (globalFilter: string) => void;
|
|
118
126
|
/** Message shown while loading without rows. */
|
|
119
127
|
loadingMessage?: ReactNode;
|
|
120
128
|
/** Message shown when the query fails. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,MAAM,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AAS,EAAE,UAAU,CAAC;;;;;;AA+DvD,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { type CSSProperties, type ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { ActionMenubar, type ActionMenuItem } from '../Common/ActionMenubar';\nimport type { ButtonParts } from '../Common/Button';\nimport { type IObservableQueryFor, type IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport type { DataTableParts } from '../DataTables/DataTableCore';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport type {\n TablePaginatorParts,\n TablePaginatorProps,\n} from '../DataTables/TablePaginator';\nimport type { DataTableFilterMeta } from '../DataTables/DataTableFilterMeta';\nimport type { DataTableSelectionChangeEvent } from '../DataTables/DataTableSelectionChangeEvent';\nimport type { DataTableServerQuery } from '../DataTables/DataTableServerQuery';\nimport { Allotment } from 'allotment';\nimport type { Constructor } from '@cratis/fundamentals';\nimport { DataPageLayout } from './DataPageLayout';\n\n// Allotment ships its layout as a stylesheet rather than inline styles, and a pane only becomes\n// the absolutely positioned, full-height box the split view assumes once that stylesheet is on\n// the page. It used to be pulled in here with a bare `import 'allotment/dist/style.css'`, but a\n// CSS import inside the JS graph is precisely what stops the published ESM from loading in Node\n// (Cratis/Components#118). The rules now ship inside this package's own `./styles` entry point,\n// which the build concatenates from every component stylesheet plus this third-party one — so a\n// consumer still gets a working split view, from the single stylesheet they already import.\n\n/**\n * Props for {@link MenuItem} — a single action in a {@link DataPage}'s\n * action bar.\n */\nexport interface MenuItemProps {\n /** Icon component rendered before the label (e.g. a react-icons icon). */\n icon?: React.ComponentType<{ className?: string }>;\n /** The visible label. */\n label?: string;\n /** Invoked when the item is activated. */\n command?: () => void;\n /** When true, the item is greyed out regardless of selection. */\n disabled?: boolean;\n /**\n * When true, the menu item is disabled while no row is selected in the\n * surrounding {@link DataPage}. Use it for context-sensitive actions like\n * \"Edit\" or \"Delete\" that require a selection.\n */\n disableOnUnselected?: boolean;\n}\n\n/**\n * Declarative menu item for use inside `<DataPage.MenuItems>`. Renders nothing\n * directly; the surrounding {@link MenuItems} component reads its props and\n * forwards them to the action menubar.\n */\nexport const MenuItem = (_props: MenuItemProps) => {\n return null;\n};\n\n/**\n * Props for {@link MenuItems}.\n */\nexport interface MenuItemsProps {\n /** One or more `<DataPage.MenuItem>` elements. */\n children: ReactNode;\n}\n\n/**\n * Props for {@link Columns}.\n */\nexport interface ColumnsProps {\n /** Cratis-owned `<Column>` markers describing each visible column. */\n children: ReactNode;\n}\n\n/**\n * The action bar is an intrinsically sized item in the page's layout column —\n * it takes the height its menubar needs and never gives any of it up, so the\n * table region below it is the only part that has to adapt to the space left.\n */\nconst actionsStyle: CSSProperties = { flexShrink: 0 };\n\n/**\n * The table region takes every pixel the action bar leaves and no more.\n * `minHeight: 0` is the load-bearing half: without it the region's automatic\n * minimum keeps it at content height, the column grows past the page, and the\n * table's paginator ends up below the clipped edge.\n */\nconst tableRegionStyle: CSSProperties = { flexGrow: 1, flexBasis: 0, minHeight: 0 };\n\n/**\n * The floor a `DataPage` falls back to when its ancestors give it no height at\n * all. A page that renders as an empty sliver is indistinguishable from a\n * broken one, so a contract-violating consumer gets a small but usable page\n * instead of nothing.\n */\nconst pageStyle: CSSProperties = { minHeight: '20rem' };\n\n/**\n * Renders an action menubar at the top of a {@link DataPage}, populated from\n * `<DataPage.MenuItem>` children. Each menu item's `disableOnUnselected` flag\n * is automatically honored against the current row selection.\n *\n * Use as `<DataPage.MenuItems>` inside a `<DataPage>`.\n */\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = useDataPageContext();\n const isDisabled =\n context.selectionMode === 'multiple'\n ? context.selectedItems.length === 0\n : !context.selectedItem;\n\n const items = useMemo(() => {\n const menuItems: ActionMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type === MenuItem) {\n const Icon = child.props.icon;\n menuItems.push({\n label: child.props.label,\n command: child.props.command,\n icon: Icon ? <Icon className='cratis:mr-2' /> : undefined,\n disabled:\n (child.props.disabled ?? false) ||\n (isDisabled && (child.props.disableOnUnselected ?? false)),\n });\n }\n });\n\n return menuItems;\n }, [children, isDisabled]);\n\n return (\n <div\n className='cratis-data-page-actions cratis:px-4 cratis:py-2'\n style={actionsStyle}\n >\n <ActionMenubar\n aria-label={context.actionsAriaLabel ?? 'Actions'}\n model={items}\n className={context.menubarClassName}\n pt={context.menubarPt}\n ptOptions={context.menubarPtOptions}\n unstyled={context.menubarUnstyled}\n />\n </div>\n );\n};\n\n/**\n * Renders the data table at the body of a {@link DataPage}. Automatically\n * selects between {@link DataTableForQuery} (snapshot query) and\n * {@link DataTableForObservableQuery} (real-time observable) based on the\n * `query` type provided to the surrounding `<DataPage>`.\n *\n * Use as `<DataPage.Columns>` inside a `<DataPage>`, with Cratis-owned `<Column>`\n * children defining the table columns.\n */\nexport const Columns = ({ children }: ColumnsProps) => {\n const context = useDataPageContext();\n const isSnapshotQuery = context.query.prototype instanceof QueryFor;\n // SAFETY: The runtime prototype check above narrows a constructor shape that\n // TypeScript cannot discriminate after the generic DataPage context is erased.\n const snapshotQuery = context.query as Constructor<\n IQueryFor<object, object> | IQueryFor<object[], object>\n >;\n const observableQuery = context.query as Constructor<\n IObservableQueryFor<object, object> | IObservableQueryFor<object[], object>\n >;\n\n return (\n <div className='cratis-data-page-table' style={tableRegionStyle}>\n {isSnapshotQuery ? (\n <DataTableForQuery\n {...context}\n query={snapshotQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForQuery>\n ) : (\n <DataTableForObservableQuery\n {...context}\n query={observableQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForObservableQuery>\n )}\n </div>\n );\n};\n\n/**\n * Props passed to the optional details component rendered on the right pane\n * of a {@link DataPage} when a row is selected.\n *\n * @typeParam TDataType - The type of the selected item.\n */\nexport interface IDetailsComponentProps<TDataType> {\n /** The currently-selected row. */\n item: TDataType;\n\n /**\n * The caller's {@link DataPageProps.onRefresh} callback, forwarded unchanged\n * to the details component. Invoking it does not make DataPage refetch.\n */\n onRefresh?: () => void;\n}\n\ninterface IDataPageContext extends DataPageProps<\n IQueryFor<object, object> | IObservableQueryFor<object, object>,\n object,\n object\n> {\n selectedItem: object | null | undefined;\n onSelectionChanged: (event: DataTableSelectionChangeEvent<object>) => void;\n selectedItems: object[];\n onSelectedItemsChange: (items: object[]) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext | null>(null);\n\nfunction useDataPageContext(): IDataPageContext {\n const context = React.useContext(DataPageContext);\n if (!context) {\n throw new Error('useDataPageContext must be used within a DataPage component');\n }\n return context;\n}\n\n/**\n * Props for {@link DataPage}.\n *\n * @typeParam TQuery - The query class — either a snapshot `IQueryFor` or a real-time `IObservableQueryFor`.\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type, or `object` if the query takes none.\n */\nexport interface DataPageProps<\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<TDataType>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /** Message shown while loading without rows. */\n loadingMessage?: ReactNode;\n /** Message shown when the query fails. */\n failureMessage?: ReactNode;\n /** Message shown when access is denied. */\n unauthorizedMessage?: ReactNode;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: TDataType | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionChangeEvent<TDataType>): void;\n\n /**\n * The row selection mode. Defaults to `'single'`. Use `'multiple'` for a page whose actions\n * operate on a set of rows - it adds per-row checkboxes and a select-all header checkbox, and\n * reports through {@link onSelectedItemsChange}.\n */\n selectionMode?: 'single' | 'multiple';\n\n /**\n * The currently selected rows, for `selectionMode='multiple'`. Leave undefined to let the page\n * own the selection.\n */\n selectedItems?: TDataType[];\n\n /**\n * Callback for when a multiple selection changes, with the full selected set.\n */\n onSelectedItemsChange?(items: TDataType[]): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /** Placeholder for the loaded-page search input. */\n globalSearchPlaceholder?: string;\n\n /** Accessible name for the loaded-page search input. */\n globalSearchAriaLabel?: string;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n\n /**\n * @deprecated Filtering is always applied to the currently loaded page.\n * This compatibility prop no longer toggles behavior and does not change\n * server-reported pagination totals. Retained for source compatibility only.\n */\n clientFiltering?: boolean;\n\n /**\n * Opts the page's table into server mode: the query sorts, filters and searches the complete\n * result before paging, and the table renders the rows as returned. Leave undefined to sort,\n * filter and search the loaded page. See {@link DataTableServerQuery}.\n */\n serverQuery?: DataTableServerQuery<TArguments>;\n\n /** Optional callback forwarded to the details component as `onRefresh`; DataPage does not invoke it or refetch when it is called. */\n onRefresh?(): void;\n\n /**\n * Extra CSS class name forwarded to the inner DataTable root.\n */\n tableClassName?: string;\n\n /** Cratis-owned per-part attributes applied to the inner table. */\n tablePt?: DataTableParts;\n\n /**\n * @deprecated Cratis table parts always merge. Remove this renderer-era option.\n */\n tablePtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `tablePt` and CSS instead.\n */\n tableUnstyled?: boolean;\n\n /** Shows numbered page buttons in the query table paginator. Defaults to false. */\n pageLinks?: TablePaginatorProps['pageLinks'];\n\n /** Extra CSS class name forwarded to the query table paginator. */\n paginatorClassName?: string;\n\n /** Cratis-owned attributes applied to the query table paginator. */\n paginatorPt?: TablePaginatorParts;\n\n /**\n * @deprecated Cratis paginator parts always merge. Remove this renderer-era option.\n */\n paginatorPtOptions?: object;\n\n /** Accessible paginator labels. Override any value to localize it. */\n paginatorAriaLabels?: TablePaginatorProps['ariaLabels'];\n\n /**\n * Extra CSS class name forwarded to the action menubar root.\n */\n menubarClassName?: string;\n\n /** Cratis-owned part attributes applied to the action menubar's buttons. */\n menubarPt?: ButtonParts;\n\n /**\n * @deprecated Cratis menubar parts always merge. Remove this renderer-era option.\n */\n menubarPtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `menubarPt` and CSS instead.\n */\n menubarUnstyled?: boolean;\n\n /**\n * Accessible name for the action menubar (toolbar). Override to localize.\n * Defaults to `'Actions'`.\n */\n actionsAriaLabel?: string;\n}\n\n/**\n * A page primitive that combines an action menubar, a query-backed data\n * table, and an optional details pane into one layout. Designed as the\n * default rendering for \"list view\" pages in an Arc app.\n *\n * ## What `TQuery` is\n *\n * `TQuery` is the auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# read model query. Two flavors are accepted and\n * **selected automatically at runtime** based on the class hierarchy:\n *\n * - **`IQueryFor<TDataType, TArguments>`** — a snapshot query. Re-fetched\n * when `queryArguments` change or when the page is mounted. Rendered\n * through {@link DataTableForQuery} internally.\n * - **`IObservableQueryFor<TDataType, TArguments>`** — a real-time\n * subscription. Connects to the backend over WebSocket and re-renders\n * automatically whenever the underlying read model changes server-side.\n * Rendered through {@link DataTableForObservableQuery} internally.\n *\n * You don't pick which inner table to use — `DataPage` inspects the\n * prototype chain (`context.query.prototype instanceof QueryFor`) and\n * mounts the correct one.\n *\n * ## Declarative composition\n *\n * Three children build up the page:\n *\n * - **`<DataPage.MenuItems>`** wraps `<DataPage.MenuItem>` elements that\n * become the action `Menubar` at the top. Each item declares its `icon`,\n * `label`, and `command` (an `onClick` handler). Items can be marked\n * `disableOnUnselected` so they automatically grey out until the user\n * picks a row — useful for Edit / Delete actions that need a target.\n *\n * - **`<DataPage.Columns>`** wraps Cratis-owned `<Column>` markers that\n * describe the visible columns. The columns themselves are\n * Cratis-owned — the documented `ColumnProps` surface is\n * supported here (sorting, filtering, custom body templates, …).\n *\n * - **`detailsComponent`** (optional) is a React component rendered in a\n * right-hand pane via Allotment when a row is selected. It receives the\n * selected item as `item` and the caller's `onRefresh` callback, if\n * supplied. DataPage does not refetch when the details component invokes it.\n *\n * ## Selection lifecycle\n *\n * `DataPage` keeps the current selection in local state and threads it to\n * the inner table, the menubar (`disableOnUnselected` items follow it),\n * and the optional details pane. The `onSelectionChange` prop is invoked\n * after every change if the consumer also needs to react to it.\n *\n * ```tsx\n * <DataPage<AllAuthors, Author, never>\n * title=\"Authors\"\n * query={AllAuthors} // proxy from C#\n * detailsComponent={AuthorDetails}>\n * <DataPage.MenuItems>\n * <DataPage.MenuItem icon={FaPlus} label=\"Add\" command={onAdd} />\n * <DataPage.MenuItem icon={FaPencil} label=\"Edit\" command={onEdit}\n * disableOnUnselected />\n * <DataPage.MenuItem icon={FaTrash} label=\"Delete\" command={onDelete}\n * disableOnUnselected />\n * </DataPage.MenuItems>\n * <DataPage.Columns>\n * <Column field=\"name\" header=\"Name\" sortable />\n * <Column field=\"email\" header=\"Email\" />\n * </DataPage.Columns>\n * </DataPage>\n * ```\n *\n * ## Height — `DataPage` needs a bounded ancestor\n *\n * `DataPage` fills the height it is given and divides it between the action\n * bar and the table region, so the table's paginator always sits at the\n * bottom of the page rather than below its edge. It cannot invent that height:\n * every element from the page root down sizes as a percentage of its parent,\n * so **some ancestor has to have a definite height**.\n *\n * ```tsx\n * // ✅ the router outlet, a sized container, or a flex child with min-height\n * <div style={{ height: '100vh' }}>\n * <DataPage … />\n * </div>\n *\n * // ❌ nothing above resolves to a height — the table grows to its content\n * <div>\n * <DataPage … />\n * </div>\n * ```\n *\n * Without one, the page falls back to a small fixed height so it stays\n * usable instead of collapsing to nothing.\n *\n * ## Styling\n *\n * The inner DataTable and action toolbar each have their own per-slot props:\n * `tablePt` / `tableUnstyled` / `tableClassName` for the table;\n * `paginatorPt` / `paginatorClassName` / `paginatorAriaLabels` for paging;\n * `menubarPt` / `menubarPtOptions` / `menubarUnstyled` / `menubarClassName` for\n * the action toolbar's stable button parts (the action bar is implemented as\n * a button toolbar, so `menubarPt` targets the stable Cratis button parts). See the\n * [pass-through cheat sheet](../../Documentation/Styling/pass-through.md) for\n * the full slot reference.\n *\n * @typeParam TQuery - The query class (proxy generated from a C# read model query).\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type.\n * @param props - {@link DataPageProps}.\n */\nconst DataPage = <\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n>(\n props: DataPageProps<TQuery, TDataType, TArguments>,\n) => {\n const [internalSelection, setInternalSelection] = React.useState<\n TDataType | null | undefined\n >(props.selection);\n const selectedItem =\n props.selection === undefined ? internalSelection : props.selection;\n\n const selectionChanged = (event: DataTableSelectionChangeEvent<TDataType>) => {\n if (props.selection === undefined) setInternalSelection(event.value);\n props.onSelectionChange?.(event);\n };\n\n const [internalSelectedItems, setInternalSelectedItems] = React.useState<TDataType[]>(\n props.selectedItems ?? [],\n );\n const selectedItems = props.selectedItems ?? internalSelectedItems;\n\n const selectedItemsChanged = (items: TDataType[]) => {\n if (props.selectedItems === undefined) setInternalSelectedItems(items);\n props.onSelectedItemsChange?.(items);\n };\n\n // SAFETY: React context cannot retain this component's generic parameters. The\n // provider and every consumer are nested in the same DataPage invocation, so the\n // erased object-level context never crosses between differently typed pages.\n const context = {\n ...props,\n selectedItem,\n onSelectionChanged: selectionChanged,\n selectedItems,\n onSelectedItemsChange: selectedItemsChanged,\n } as unknown as IDataPageContext;\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true} style={pageStyle}>\n {props.detailsComponent ? (\n <Allotment className='cratis:h-full' proportionalLayout={false}>\n <Allotment.Pane>\n <DataPageLayout>{props.children}</DataPageLayout>\n </Allotment.Pane>\n {selectedItem && (\n <Allotment.Pane preferredSize='450px'>\n <props.detailsComponent\n item={selectedItem}\n onRefresh={props.onRefresh}\n />\n </Allotment.Pane>\n )}\n </Allotment>\n ) : (\n <DataPageLayout>{props.children}</DataPageLayout>\n )}\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItem = MenuItem;\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAyDO,MAAM,QAAQ,GAAG,CAAC,MAAqB,KAAI;AAC9C,IAAA,OAAO,IAAI;AACf;AAuBA,MAAM,YAAY,GAAkB,EAAE,UAAU,EAAE,CAAC,EAAE;AAQrD,MAAM,gBAAgB,GAAkB,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;AAQnF,MAAM,SAAS,GAAkB,EAAE,SAAS,EAAE,OAAO,EAAE;MAS1C,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,KAAI;AACtD,IAAA,MAAM,OAAO,GAAG,kBAAkB,EAAE;AACpC,IAAA,MAAM,UAAU,GACZ,OAAO,CAAC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,KAAK,EAAE,OAAO,EAAA,QAAA,EACpCA,GAAA,CAAC,IAAI,EAAA,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAA,QAAA,EAClD,KAAK,CAAC,gBAAgB,IACnBC,IAAA,CAAC,SAAS,EAAA,EAAC,SAAS,EAAC,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
|
+
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { type CSSProperties, type ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { ActionMenubar, type ActionMenuItem } from '../Common/ActionMenubar';\nimport type { ButtonParts } from '../Common/Button';\nimport { type IObservableQueryFor, type IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport type { DataTableParts } from '../DataTables/DataTableCore';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport type {\n TablePaginatorParts,\n TablePaginatorProps,\n} from '../DataTables/TablePaginator';\nimport type { DataTableFilterMeta } from '../DataTables/DataTableFilterMeta';\nimport type { DataTableSelectionChangeEvent } from '../DataTables/DataTableSelectionChangeEvent';\nimport type { DataTableServerQuery } from '../DataTables/DataTableServerQuery';\nimport { Allotment } from 'allotment';\nimport type { Constructor } from '@cratis/fundamentals';\nimport { DataPageLayout } from './DataPageLayout';\n\n// Allotment ships its layout as a stylesheet rather than inline styles, and a pane only becomes\n// the absolutely positioned, full-height box the split view assumes once that stylesheet is on\n// the page. It used to be pulled in here with a bare `import 'allotment/dist/style.css'`, but a\n// CSS import inside the JS graph is precisely what stops the published ESM from loading in Node\n// (Cratis/Components#118). The rules now ship inside this package's own `./styles` entry point,\n// which the build concatenates from every component stylesheet plus this third-party one — so a\n// consumer still gets a working split view, from the single stylesheet they already import.\n\n/**\n * Props for {@link MenuItem} — a single action in a {@link DataPage}'s\n * action bar.\n */\nexport interface MenuItemProps {\n /** Icon component rendered before the label (e.g. a react-icons icon). */\n icon?: React.ComponentType<{ className?: string }>;\n /** The visible label. */\n label?: string;\n /** Invoked when the item is activated. */\n command?: () => void;\n /** When true, the item is greyed out regardless of selection. */\n disabled?: boolean;\n /**\n * When true, the menu item is disabled while no row is selected in the\n * surrounding {@link DataPage}. Use it for context-sensitive actions like\n * \"Edit\" or \"Delete\" that require a selection.\n */\n disableOnUnselected?: boolean;\n}\n\n/**\n * Declarative menu item for use inside `<DataPage.MenuItems>`. Renders nothing\n * directly; the surrounding {@link MenuItems} component reads its props and\n * forwards them to the action menubar.\n */\nexport const MenuItem = (_props: MenuItemProps) => {\n return null;\n};\n\n/**\n * Props for {@link MenuItems}.\n */\nexport interface MenuItemsProps {\n /** One or more `<DataPage.MenuItem>` elements. */\n children: ReactNode;\n}\n\n/**\n * Props for {@link Columns}.\n */\nexport interface ColumnsProps {\n /** Cratis-owned `<Column>` markers describing each visible column. */\n children: ReactNode;\n}\n\n/**\n * The action bar is an intrinsically sized item in the page's layout column —\n * it takes the height its menubar needs and never gives any of it up, so the\n * table region below it is the only part that has to adapt to the space left.\n */\nconst actionsStyle: CSSProperties = { flexShrink: 0 };\n\n/**\n * The table region takes every pixel the action bar leaves and no more.\n * `minHeight: 0` is the load-bearing half: without it the region's automatic\n * minimum keeps it at content height, the column grows past the page, and the\n * table's paginator ends up below the clipped edge.\n */\nconst tableRegionStyle: CSSProperties = { flexGrow: 1, flexBasis: 0, minHeight: 0 };\n\n/**\n * The floor a `DataPage` falls back to when its ancestors give it no height at\n * all. A page that renders as an empty sliver is indistinguishable from a\n * broken one, so a contract-violating consumer gets a small but usable page\n * instead of nothing.\n */\nconst pageStyle: CSSProperties = { minHeight: '20rem' };\n\n/**\n * Renders an action menubar at the top of a {@link DataPage}, populated from\n * `<DataPage.MenuItem>` children. Each menu item's `disableOnUnselected` flag\n * is automatically honored against the current row selection.\n *\n * Use as `<DataPage.MenuItems>` inside a `<DataPage>`.\n */\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = useDataPageContext();\n const isDisabled =\n context.selectionMode === 'multiple'\n ? context.selectedItems.length === 0\n : !context.selectedItem;\n\n const items = useMemo(() => {\n const menuItems: ActionMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type === MenuItem) {\n const Icon = child.props.icon;\n menuItems.push({\n label: child.props.label,\n command: child.props.command,\n icon: Icon ? <Icon className='cratis:mr-2' /> : undefined,\n disabled:\n (child.props.disabled ?? false) ||\n (isDisabled && (child.props.disableOnUnselected ?? false)),\n });\n }\n });\n\n return menuItems;\n }, [children, isDisabled]);\n\n return (\n <div\n className='cratis-data-page-actions cratis:px-4 cratis:py-2'\n style={actionsStyle}\n >\n <ActionMenubar\n aria-label={context.actionsAriaLabel ?? 'Actions'}\n model={items}\n className={context.menubarClassName}\n pt={context.menubarPt}\n ptOptions={context.menubarPtOptions}\n unstyled={context.menubarUnstyled}\n />\n </div>\n );\n};\n\n/**\n * Renders the data table at the body of a {@link DataPage}. Automatically\n * selects between {@link DataTableForQuery} (snapshot query) and\n * {@link DataTableForObservableQuery} (real-time observable) based on the\n * `query` type provided to the surrounding `<DataPage>`.\n *\n * Use as `<DataPage.Columns>` inside a `<DataPage>`, with Cratis-owned `<Column>`\n * children defining the table columns.\n */\nexport const Columns = ({ children }: ColumnsProps) => {\n const context = useDataPageContext();\n const isSnapshotQuery = context.query.prototype instanceof QueryFor;\n // SAFETY: The runtime prototype check above narrows a constructor shape that\n // TypeScript cannot discriminate after the generic DataPage context is erased.\n const snapshotQuery = context.query as Constructor<\n IQueryFor<object, object> | IQueryFor<object[], object>\n >;\n const observableQuery = context.query as Constructor<\n IObservableQueryFor<object, object> | IObservableQueryFor<object[], object>\n >;\n\n return (\n <div className='cratis-data-page-table' style={tableRegionStyle}>\n {isSnapshotQuery ? (\n <DataTableForQuery\n {...context}\n query={snapshotQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForQuery>\n ) : (\n <DataTableForObservableQuery\n {...context}\n query={observableQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForObservableQuery>\n )}\n </div>\n );\n};\n\n/**\n * Props passed to the optional details component rendered on the right pane\n * of a {@link DataPage} when a row is selected.\n *\n * @typeParam TDataType - The type of the selected item.\n */\nexport interface IDetailsComponentProps<TDataType> {\n /** The currently-selected row. */\n item: TDataType;\n\n /**\n * The caller's {@link DataPageProps.onRefresh} callback, forwarded unchanged\n * to the details component. Invoking it does not make DataPage refetch.\n */\n onRefresh?: () => void;\n}\n\ninterface IDataPageContext extends DataPageProps<\n IQueryFor<object, object> | IObservableQueryFor<object, object>,\n object,\n object\n> {\n selectedItem: object | null | undefined;\n onSelectionChanged: (event: DataTableSelectionChangeEvent<object>) => void;\n selectedItems: object[];\n onSelectedItemsChange: (items: object[]) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext | null>(null);\n\nfunction useDataPageContext(): IDataPageContext {\n const context = React.useContext(DataPageContext);\n if (!context) {\n throw new Error('useDataPageContext must be used within a DataPage component');\n }\n return context;\n}\n\n/**\n * Props for {@link DataPage}.\n *\n * @typeParam TQuery - The query class — either a snapshot `IQueryFor` or a real-time `IObservableQueryFor`.\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type, or `object` if the query takes none.\n */\nexport interface DataPageProps<\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<TDataType>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The message to show instead of {@link emptyMessage} when a search or column filter is active\n * and no rows are shown. Defaults to a localizable message that says only the loaded page was\n * searched, or, with `serverQuery`, a neutral \"No rows match the search.\".\n */\n filteredEmptyMessage?: ReactNode;\n\n /** Notified of every change to the search text, as typed. */\n onGlobalFilterChange?: (globalFilter: string) => void;\n\n /** Message shown while loading without rows. */\n loadingMessage?: ReactNode;\n /** Message shown when the query fails. */\n failureMessage?: ReactNode;\n /** Message shown when access is denied. */\n unauthorizedMessage?: ReactNode;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: TDataType | undefined | null;\n\n /**\n * Callback for when the selection changes\n */\n onSelectionChange?(event: DataTableSelectionChangeEvent<TDataType>): void;\n\n /**\n * The row selection mode. Defaults to `'single'`. Use `'multiple'` for a page whose actions\n * operate on a set of rows - it adds per-row checkboxes and a select-all header checkbox, and\n * reports through {@link onSelectedItemsChange}.\n */\n selectionMode?: 'single' | 'multiple';\n\n /**\n * The currently selected rows, for `selectionMode='multiple'`. Leave undefined to let the page\n * own the selection.\n */\n selectedItems?: TDataType[];\n\n /**\n * Callback for when a multiple selection changes, with the full selected set.\n */\n onSelectedItemsChange?(items: TDataType[]): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /** Placeholder for the loaded-page search input. */\n globalSearchPlaceholder?: string;\n\n /** Accessible name for the loaded-page search input. */\n globalSearchAriaLabel?: string;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n\n /**\n * @deprecated Filtering is always applied to the currently loaded page.\n * This compatibility prop no longer toggles behavior and does not change\n * server-reported pagination totals. Retained for source compatibility only.\n */\n clientFiltering?: boolean;\n\n /**\n * Opts the page's table into server mode: the query sorts, filters and searches the complete\n * result before paging, and the table renders the rows as returned. Leave undefined to sort,\n * filter and search the loaded page. See {@link DataTableServerQuery}.\n */\n serverQuery?: DataTableServerQuery<TArguments>;\n\n /** Optional callback forwarded to the details component as `onRefresh`; DataPage does not invoke it or refetch when it is called. */\n onRefresh?(): void;\n\n /**\n * Extra CSS class name forwarded to the inner DataTable root.\n */\n tableClassName?: string;\n\n /** Cratis-owned per-part attributes applied to the inner table. */\n tablePt?: DataTableParts;\n\n /**\n * @deprecated Cratis table parts always merge. Remove this renderer-era option.\n */\n tablePtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `tablePt` and CSS instead.\n */\n tableUnstyled?: boolean;\n\n /** Shows numbered page buttons in the query table paginator. Defaults to false. */\n pageLinks?: TablePaginatorProps['pageLinks'];\n\n /** Extra CSS class name forwarded to the query table paginator. */\n paginatorClassName?: string;\n\n /** Cratis-owned attributes applied to the query table paginator. */\n paginatorPt?: TablePaginatorParts;\n\n /**\n * @deprecated Cratis paginator parts always merge. Remove this renderer-era option.\n */\n paginatorPtOptions?: object;\n\n /** Accessible paginator labels. Override any value to localize it. */\n paginatorAriaLabels?: TablePaginatorProps['ariaLabels'];\n\n /**\n * Extra CSS class name forwarded to the action menubar root.\n */\n menubarClassName?: string;\n\n /** Cratis-owned part attributes applied to the action menubar's buttons. */\n menubarPt?: ButtonParts;\n\n /**\n * @deprecated Cratis menubar parts always merge. Remove this renderer-era option.\n */\n menubarPtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `menubarPt` and CSS instead.\n */\n menubarUnstyled?: boolean;\n\n /**\n * Accessible name for the action menubar (toolbar). Override to localize.\n * Defaults to `'Actions'`.\n */\n actionsAriaLabel?: string;\n}\n\n/**\n * A page primitive that combines an action menubar, a query-backed data\n * table, and an optional details pane into one layout. Designed as the\n * default rendering for \"list view\" pages in an Arc app.\n *\n * ## What `TQuery` is\n *\n * `TQuery` is the auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# read model query. Two flavors are accepted and\n * **selected automatically at runtime** based on the class hierarchy:\n *\n * - **`IQueryFor<TDataType, TArguments>`** — a snapshot query. Re-fetched\n * when `queryArguments` change or when the page is mounted. Rendered\n * through {@link DataTableForQuery} internally.\n * - **`IObservableQueryFor<TDataType, TArguments>`** — a real-time\n * subscription. Connects to the backend over WebSocket and re-renders\n * automatically whenever the underlying read model changes server-side.\n * Rendered through {@link DataTableForObservableQuery} internally.\n *\n * You don't pick which inner table to use — `DataPage` inspects the\n * prototype chain (`context.query.prototype instanceof QueryFor`) and\n * mounts the correct one.\n *\n * ## Declarative composition\n *\n * Three children build up the page:\n *\n * - **`<DataPage.MenuItems>`** wraps `<DataPage.MenuItem>` elements that\n * become the action `Menubar` at the top. Each item declares its `icon`,\n * `label`, and `command` (an `onClick` handler). Items can be marked\n * `disableOnUnselected` so they automatically grey out until the user\n * picks a row — useful for Edit / Delete actions that need a target.\n *\n * - **`<DataPage.Columns>`** wraps Cratis-owned `<Column>` markers that\n * describe the visible columns. The columns themselves are\n * Cratis-owned — the documented `ColumnProps` surface is\n * supported here (sorting, filtering, custom body templates, …).\n *\n * - **`detailsComponent`** (optional) is a React component rendered in a\n * right-hand pane via Allotment when a row is selected. It receives the\n * selected item as `item` and the caller's `onRefresh` callback, if\n * supplied. DataPage does not refetch when the details component invokes it.\n *\n * ## Selection lifecycle\n *\n * `DataPage` keeps the current selection in local state and threads it to\n * the inner table, the menubar (`disableOnUnselected` items follow it),\n * and the optional details pane. The `onSelectionChange` prop is invoked\n * after every change if the consumer also needs to react to it.\n *\n * ```tsx\n * <DataPage<AllAuthors, Author, never>\n * title=\"Authors\"\n * query={AllAuthors} // proxy from C#\n * detailsComponent={AuthorDetails}>\n * <DataPage.MenuItems>\n * <DataPage.MenuItem icon={FaPlus} label=\"Add\" command={onAdd} />\n * <DataPage.MenuItem icon={FaPencil} label=\"Edit\" command={onEdit}\n * disableOnUnselected />\n * <DataPage.MenuItem icon={FaTrash} label=\"Delete\" command={onDelete}\n * disableOnUnselected />\n * </DataPage.MenuItems>\n * <DataPage.Columns>\n * <Column field=\"name\" header=\"Name\" sortable />\n * <Column field=\"email\" header=\"Email\" />\n * </DataPage.Columns>\n * </DataPage>\n * ```\n *\n * ## Height — `DataPage` needs a bounded ancestor\n *\n * `DataPage` fills the height it is given and divides it between the action\n * bar and the table region, so the table's paginator always sits at the\n * bottom of the page rather than below its edge. It cannot invent that height:\n * every element from the page root down sizes as a percentage of its parent,\n * so **some ancestor has to have a definite height**.\n *\n * ```tsx\n * // ✅ the router outlet, a sized container, or a flex child with min-height\n * <div style={{ height: '100vh' }}>\n * <DataPage … />\n * </div>\n *\n * // ❌ nothing above resolves to a height — the table grows to its content\n * <div>\n * <DataPage … />\n * </div>\n * ```\n *\n * Without one, the page falls back to a small fixed height so it stays\n * usable instead of collapsing to nothing.\n *\n * ## Styling\n *\n * The inner DataTable and action toolbar each have their own per-slot props:\n * `tablePt` / `tableUnstyled` / `tableClassName` for the table;\n * `paginatorPt` / `paginatorClassName` / `paginatorAriaLabels` for paging;\n * `menubarPt` / `menubarPtOptions` / `menubarUnstyled` / `menubarClassName` for\n * the action toolbar's stable button parts (the action bar is implemented as\n * a button toolbar, so `menubarPt` targets the stable Cratis button parts). See the\n * [pass-through cheat sheet](../../Documentation/Styling/pass-through.md) for\n * the full slot reference.\n *\n * @typeParam TQuery - The query class (proxy generated from a C# read model query).\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type.\n * @param props - {@link DataPageProps}.\n */\nconst DataPage = <\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n>(\n props: DataPageProps<TQuery, TDataType, TArguments>,\n) => {\n const [internalSelection, setInternalSelection] = React.useState<\n TDataType | null | undefined\n >(props.selection);\n const selectedItem =\n props.selection === undefined ? internalSelection : props.selection;\n\n const selectionChanged = (event: DataTableSelectionChangeEvent<TDataType>) => {\n if (props.selection === undefined) setInternalSelection(event.value);\n props.onSelectionChange?.(event);\n };\n\n const [internalSelectedItems, setInternalSelectedItems] = React.useState<TDataType[]>(\n props.selectedItems ?? [],\n );\n const selectedItems = props.selectedItems ?? internalSelectedItems;\n\n const selectedItemsChanged = (items: TDataType[]) => {\n if (props.selectedItems === undefined) setInternalSelectedItems(items);\n props.onSelectedItemsChange?.(items);\n };\n\n // SAFETY: React context cannot retain this component's generic parameters. The\n // provider and every consumer are nested in the same DataPage invocation, so the\n // erased object-level context never crosses between differently typed pages.\n const context = {\n ...props,\n selectedItem,\n onSelectionChanged: selectionChanged,\n selectedItems,\n onSelectedItemsChange: selectedItemsChanged,\n } as unknown as IDataPageContext;\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true} style={pageStyle}>\n {props.detailsComponent ? (\n <Allotment className='cratis:h-full' proportionalLayout={false}>\n <Allotment.Pane>\n <DataPageLayout>{props.children}</DataPageLayout>\n </Allotment.Pane>\n {selectedItem && (\n <Allotment.Pane preferredSize='450px'>\n <props.detailsComponent\n item={selectedItem}\n onRefresh={props.onRefresh}\n />\n </Allotment.Pane>\n )}\n </Allotment>\n ) : (\n <DataPageLayout>{props.children}</DataPageLayout>\n )}\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItem = MenuItem;\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAyDO,MAAM,QAAQ,GAAG,CAAC,MAAqB,KAAI;AAC9C,IAAA,OAAO,IAAI;AACf;AAuBA,MAAM,YAAY,GAAkB,EAAE,UAAU,EAAE,CAAC,EAAE;AAQrD,MAAM,gBAAgB,GAAkB,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;AAQnF,MAAM,SAAS,GAAkB,EAAE,SAAS,EAAE,OAAO,EAAE;MAS1C,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAkB,KAAI;AACtD,IAAA,MAAM,OAAO,GAAG,kBAAkB,EAAE;AACpC,IAAA,MAAM,UAAU,GACZ,OAAO,CAAC,aAAa,KAAK;AACtB,UAAE,OAAO,CAAC,aAAa,CAAC,MAAM,KAAK;AACnC,UAAE,CAAC,OAAO,CAAC,YAAY;AAE/B,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,MAAK;QACvB,MAAM,SAAS,GAAqB,EAAE;QACtC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,K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AAC,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;;"}
|
|
@@ -14,9 +14,11 @@ export interface DataTableBodyProps {
|
|
|
14
14
|
parts?: DataTableParts;
|
|
15
15
|
messages: DataTableMessages;
|
|
16
16
|
emptyMessage: ReactNode;
|
|
17
|
+
/** Whether a search or filter is active, so an empty result is a filtered one. */
|
|
18
|
+
isFiltered?: boolean;
|
|
17
19
|
/** Renders the data rows; called only when there are rows to show. */
|
|
18
20
|
renderRows: () => ReactNode;
|
|
19
21
|
}
|
|
20
22
|
/** The table body: a failure, loading or empty message row, or the data rows. */
|
|
21
|
-
export declare const DataTableBody: ({ status, hasLoadedRows, rowCount, columnCount, parts: pt, messages, emptyMessage, renderRows, }: DataTableBodyProps) => import("react").JSX.Element;
|
|
23
|
+
export declare const DataTableBody: ({ status, hasLoadedRows, rowCount, columnCount, parts: pt, messages, emptyMessage, isFiltered, renderRows, }: DataTableBodyProps) => import("react").JSX.Element;
|
|
22
24
|
//# sourceMappingURL=DataTableBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableBody.d.ts","sourceRoot":"","sources":["../../../DataTables/DataTableBody.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAEpD,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,8DAA8D;IAC9D,aAAa,EAAE,OAAO,CAAC;IACvB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,YAAY,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,UAAU,EAAE,MAAM,SAAS,CAAC;CAC/B;AAED,iFAAiF;AACjF,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"DataTableBody.d.ts","sourceRoot":"","sources":["../../../DataTables/DataTableBody.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAEpD,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,8DAA8D;IAC9D,aAAa,EAAE,OAAO,CAAC;IACvB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,YAAY,EAAE,SAAS,CAAC;IACxB,kFAAkF;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,UAAU,EAAE,MAAM,SAAS,CAAC;CAC/B;AAED,iFAAiF;AACjF,eAAO,MAAM,aAAa,iHAUvB,kBAAkB,gCAgFpB,CAAC"}
|
|
@@ -2,9 +2,9 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { classNames } from '../ClassNames/classNames.js';
|
|
3
3
|
import { DataTableStatus } from './DataTableStatus.js';
|
|
4
4
|
|
|
5
|
-
const DataTableBody = ({ status, hasLoadedRows, rowCount, columnCount, parts: pt, messages, emptyMessage, renderRows, }) => (jsx("tbody", { ...pt?.body, className: classNames('cratis-datatable__body', pt?.body?.className), "data-cratis-part": 'body', children: status === DataTableStatus.Failed || status === DataTableStatus.Unauthorized ? (jsx("tr", { ...pt?.failureRow, className: classNames('cratis-datatable__failure-row', pt?.failureRow?.className), "data-cratis-part": 'failure-row', "data-reason": status, children: jsx("td", { ...pt?.failureCell, colSpan: Math.max(columnCount, 1), className: classNames('cratis-datatable__failure-cell', pt?.failureCell?.className), "data-cratis-part": 'failure-cell', children: jsx("div", { role: 'alert', children: status === DataTableStatus.Failed
|
|
5
|
+
const DataTableBody = ({ status, hasLoadedRows, rowCount, columnCount, parts: pt, messages, emptyMessage, isFiltered = false, renderRows, }) => (jsx("tbody", { ...pt?.body, className: classNames('cratis-datatable__body', pt?.body?.className), "data-cratis-part": 'body', children: status === DataTableStatus.Failed || status === DataTableStatus.Unauthorized ? (jsx("tr", { ...pt?.failureRow, className: classNames('cratis-datatable__failure-row', pt?.failureRow?.className), "data-cratis-part": 'failure-row', "data-reason": status, children: jsx("td", { ...pt?.failureCell, colSpan: Math.max(columnCount, 1), className: classNames('cratis-datatable__failure-cell', pt?.failureCell?.className), "data-cratis-part": 'failure-cell', children: jsx("div", { role: 'alert', children: status === DataTableStatus.Failed
|
|
6
6
|
? messages.resolvedFailureMessage
|
|
7
|
-
: messages.resolvedUnauthorizedMessage }) }) }, status)) : status === DataTableStatus.Loading && !hasLoadedRows ? (jsx("tr", { ...pt?.loadingRow, className: classNames('cratis-datatable__loading-row', pt?.loadingRow?.className), "data-cratis-part": 'loading-row', children: jsx("td", { ...pt?.loadingCell, colSpan: Math.max(columnCount, 1), className: classNames('cratis-datatable__loading-cell', pt?.loadingCell?.className), "data-cratis-part": 'loading-cell', children: jsx("div", { role: 'status', children: messages.resolvedLoadingMessage }) }) }, status)) : rowCount === 0 ? (jsx("tr", { ...pt?.emptyRow, className: classNames('cratis-datatable__empty-row', pt?.emptyRow?.className), "data-cratis-part": 'empty-row', children: jsx("td", { ...pt?.emptyCell, colSpan: Math.max(columnCount, 1), className: classNames('cratis-datatable__empty-cell', pt?.emptyCell?.className), "data-cratis-part": 'empty-cell', children: emptyMessage }) })) : (renderRows()) }));
|
|
7
|
+
: messages.resolvedUnauthorizedMessage }) }) }, status)) : status === DataTableStatus.Loading && !hasLoadedRows ? (jsx("tr", { ...pt?.loadingRow, className: classNames('cratis-datatable__loading-row', pt?.loadingRow?.className), "data-cratis-part": 'loading-row', children: jsx("td", { ...pt?.loadingCell, colSpan: Math.max(columnCount, 1), className: classNames('cratis-datatable__loading-cell', pt?.loadingCell?.className), "data-cratis-part": 'loading-cell', children: jsx("div", { role: 'status', children: messages.resolvedLoadingMessage }) }) }, status)) : rowCount === 0 ? (jsx("tr", { ...pt?.emptyRow, className: classNames('cratis-datatable__empty-row', pt?.emptyRow?.className), "data-cratis-part": 'empty-row', children: jsx("td", { ...pt?.emptyCell, colSpan: Math.max(columnCount, 1), className: classNames('cratis-datatable__empty-cell', pt?.emptyCell?.className), "data-cratis-part": 'empty-cell', children: isFiltered ? messages.resolvedFilteredEmptyMessage : emptyMessage }) })) : (renderRows()) }));
|
|
8
8
|
|
|
9
9
|
export { DataTableBody };
|
|
10
10
|
//# sourceMappingURL=DataTableBody.js.map
|