@cratis/components 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/CommandDialog/CommandStepper.js +23 -15
- package/dist/cjs/CommandDialog/CommandStepper.js.map +1 -1
- package/dist/cjs/CommandDialog/StepperCommandDialog.js +17 -8
- package/dist/cjs/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/cjs/CommandDialog/stepChildren.js +31 -0
- package/dist/cjs/CommandDialog/stepChildren.js.map +1 -0
- package/dist/cjs/DataPage/DataPage.js +54 -10
- package/dist/cjs/DataPage/DataPage.js.map +1 -1
- package/dist/cjs/DataPage/DataPageLayout.js +34 -0
- package/dist/cjs/DataPage/DataPageLayout.js.map +1 -0
- package/dist/cjs/tailwind-utilities.css +3 -0
- package/dist/esm/CommandDialog/CommandStepper.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandStepper.js +23 -15
- package/dist/esm/CommandDialog/CommandStepper.js.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.js +18 -9
- package/dist/esm/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/esm/CommandDialog/stepChildren.d.ts +3 -0
- package/dist/esm/CommandDialog/stepChildren.d.ts.map +1 -0
- package/dist/esm/CommandDialog/stepChildren.js +29 -0
- package/dist/esm/CommandDialog/stepChildren.js.map +1 -0
- package/dist/esm/DataPage/DataPage.d.ts +1 -0
- package/dist/esm/DataPage/DataPage.d.ts.map +1 -1
- package/dist/esm/DataPage/DataPage.js +54 -10
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/dist/esm/DataPage/DataPageLayout.d.ts +6 -0
- package/dist/esm/DataPage/DataPageLayout.d.ts.map +1 -0
- package/dist/esm/DataPage/DataPageLayout.js +32 -0
- package/dist/esm/DataPage/DataPageLayout.js.map +1 -0
- package/dist/esm/tailwind-utilities.css +3 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/vite.config.d.ts.map +1 -1
- package/dist/esm/vite.config.js +1 -0
- package/dist/esm/vite.config.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,10 +2,11 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useDialogContext, DialogResult } from '@cratis/arc.react/dialogs';
|
|
3
3
|
import { Dialog } from 'primereact/dialog';
|
|
4
4
|
import { Button } from 'primereact/button';
|
|
5
|
-
import
|
|
5
|
+
import { useState } from 'react';
|
|
6
6
|
import { CommandForm, useCommandFormContext, useCommandInstance } from '@cratis/arc.react/commands';
|
|
7
7
|
import { CommandStepperContent } from './CommandStepper.js';
|
|
8
8
|
import { applyBeforeExecute } from './applyBeforeExecute.js';
|
|
9
|
+
import { getStepPanels } from './stepChildren.js';
|
|
9
10
|
|
|
10
11
|
const StepperCommandDialogWrapper = ({ title, visible = true, width = '600px', style, contentStyle, resizable = false, isValid, onClose, onConfirm, onCancel, onSuccess, onValidationFailure, onFailed, onBeforeExecute, okLabel = 'Submit', nextLabel = 'Next', previousLabel = 'Previous', orientation = 'horizontal', headerPosition, linear = true, onChangeStep, start, end, pt, ptOptions, unstyled, dialogClassName, dialogPt, dialogPtOptions, dialogUnstyled, children }) => {
|
|
11
12
|
const { setCommandValues, setCommandResult, isValid: isCommandFormValid, getFieldError } = useCommandFormContext();
|
|
@@ -25,11 +26,19 @@ const StepperCommandDialogWrapper = ({ title, visible = true, width = '600px', s
|
|
|
25
26
|
catch {
|
|
26
27
|
contextCloseDialog = undefined;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// Only the steps that actually render count. That count is not fixed: a conditional step
|
|
30
|
+
// (`{condition && <StepperPanel/>}`) can disappear after the user has already advanced past
|
|
31
|
+
// it — a late-resolving query or a `currentValues` overlay flipping the condition is enough.
|
|
32
|
+
// The step the wizard is on is therefore clamped into the set that still renders, and the
|
|
33
|
+
// last/first tests are inequalities, so an index left stranded above the end still resolves
|
|
34
|
+
// to the last surviving step instead of a step that is neither last nor navigable. Same
|
|
35
|
+
// shape as CommandStepperContent, which this dialog's body is.
|
|
36
|
+
const stepCount = getStepPanels(children).length;
|
|
37
|
+
const currentStep = Math.min(Math.max(activeStep, 0), Math.max(stepCount - 1, 0));
|
|
38
|
+
const isLastStep = currentStep >= stepCount - 1;
|
|
39
|
+
const isFirstStep = currentStep <= 0;
|
|
31
40
|
const isDialogValid = isValid !== false && isCommandFormValid;
|
|
32
|
-
const isCurrentStepInvalid = stepErrors[
|
|
41
|
+
const isCurrentStepInvalid = stepErrors[currentStep] ?? false;
|
|
33
42
|
const handleClose = async (result) => {
|
|
34
43
|
let shouldCloseThroughContext = true;
|
|
35
44
|
if (result === DialogResult.Ok || result === DialogResult.Yes) {
|
|
@@ -83,11 +92,11 @@ const StepperCommandDialogWrapper = ({ title, visible = true, width = '600px', s
|
|
|
83
92
|
await handleClose(DialogResult.Ok);
|
|
84
93
|
};
|
|
85
94
|
const headerElement = (jsx("div", { className: "inline-flex items-center justify-center gap-2", children: jsx("span", { className: "font-bold whitespace-nowrap", children: title }) }));
|
|
86
|
-
const footer = (jsxs("div", { className: "flex items-center w-full gap-3", children: [!isFirstStep && (jsx(Button, { label: previousLabel, icon: "pi pi-arrow-left", onClick: () => setActiveStep(
|
|
87
|
-
setVisitedSteps(prev => new Set(prev).add(
|
|
88
|
-
setActiveStep(
|
|
95
|
+
const footer = (jsxs("div", { className: "flex items-center w-full gap-3", children: [!isFirstStep && (jsx(Button, { label: previousLabel, icon: "pi pi-arrow-left", onClick: () => setActiveStep(Math.max(0, currentStep - 1)), disabled: isBusy, outlined: true })), jsx("div", { className: "flex-1" }), !isLastStep && (jsx(Button, { label: nextLabel, icon: "pi pi-arrow-right", iconPos: "right", onClick: () => {
|
|
96
|
+
setVisitedSteps(prev => new Set(prev).add(currentStep));
|
|
97
|
+
setActiveStep(Math.min(stepCount - 1, currentStep + 1));
|
|
89
98
|
}, disabled: isBusy || isCurrentStepInvalid })), isLastStep && isDialogValid && (jsx(Button, { label: okLabel, icon: "pi pi-check", onClick: handleSubmit, loading: isBusy, disabled: isBusy, autoFocus: true }))] }));
|
|
90
|
-
return (jsx(Dialog, { header: headerElement, modal: true, footer: footer, onHide: () => handleClose(DialogResult.Cancelled), visible: visible, style: { width, ...style }, contentStyle: contentStyle, resizable: resizable, closable: true, className: dialogClassName, pt: dialogPt, ptOptions: dialogPtOptions, unstyled: dialogUnstyled, children: jsx(CommandStepperContent, { activeStep:
|
|
99
|
+
return (jsx(Dialog, { header: headerElement, modal: true, footer: footer, onHide: () => handleClose(DialogResult.Cancelled), visible: visible, style: { width, ...style }, contentStyle: contentStyle, resizable: resizable, closable: true, className: dialogClassName, pt: dialogPt, ptOptions: dialogPtOptions, unstyled: dialogUnstyled, children: jsx(CommandStepperContent, { activeStep: currentStep, visitedSteps: visitedSteps, getFieldError: getFieldError, onActiveStepChange: setActiveStep, onVisitedStepsChange: setVisitedSteps, onStepErrorsChange: setStepErrors, showNavigation: false, showSubmit: false, linear: linear, orientation: orientation, headerPosition: headerPosition, onChangeStep: onChangeStep, start: start, end: end, pt: pt, ptOptions: ptOptions, unstyled: unstyled, children: children }) }));
|
|
91
100
|
};
|
|
92
101
|
/**
|
|
93
102
|
* A multi-step wizard dialog backed by a single Cratis Arc command. Wraps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepperCommandDialog.js","sources":["../../../CommandDialog/StepperCommandDialog.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","PrimeDialog"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StepperCommandDialog.js","sources":["../../../CommandDialog/StepperCommandDialog.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","PrimeDialog"],"mappings":";;;;;;;;;;AAwFA,MAAM,2BAA2B,GAAG,CAA8C,EAC9E,KAAK,EACL,OAAO,GAAG,IAAI,EACd,KAAK,GAAG,OAAO,EACf,K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,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAAA,QAAA,EAE7B,QAAQ,EAAA,CACiB,EAAA,CACpB;AAEtB,CAAC;AAEM,MAAM,oBAAoB,GAAG;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepChildren.d.ts","sourceRoot":"","sources":["../../../CommandDialog/stepChildren.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqB1B,wBAAgB,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,EAAE,CAE7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Gets the step panels a stepper will actually render, in render order.
|
|
7
|
+
*
|
|
8
|
+
* A conditional step is written as `{condition && <StepperPanel/>}` — which yields
|
|
9
|
+
* `false` when the condition does not hold — and explicit `null` / `undefined` children
|
|
10
|
+
* are just as common. `React.Children.count` counts those, so anything deriving a step
|
|
11
|
+
* count from it believes the wizard has more steps than it renders: navigation runs past
|
|
12
|
+
* the last real panel and the per-step validation gate reads off the end of its array.
|
|
13
|
+
*
|
|
14
|
+
* `React.Children.toArray` already drops `null`, `undefined` and booleans; filtering to
|
|
15
|
+
* valid elements additionally drops bare text children, which are not steps either.
|
|
16
|
+
*
|
|
17
|
+
* Fragments are deliberately **not** flattened — a `<>…</>` wrapping several panels stays
|
|
18
|
+
* one entry, which is the behavior the stepper has always had. Supporting fragments as a
|
|
19
|
+
* container for multiple steps is a separate, additive change.
|
|
20
|
+
*
|
|
21
|
+
* @param children - The stepper children to inspect.
|
|
22
|
+
* @returns The child elements that render as steps.
|
|
23
|
+
*/
|
|
24
|
+
function getStepPanels(children) {
|
|
25
|
+
return React.Children.toArray(children).filter((child) => React.isValidElement(child));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { getStepPanels };
|
|
29
|
+
//# sourceMappingURL=stepChildren.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepChildren.js","sources":["../../../CommandDialog/stepChildren.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AAIA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,aAAa,CAAC,QAAyB,EAAA;IACnD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAkC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AACvH;;;;"}
|
|
@@ -5,6 +5,7 @@ import { type MenubarProps } from 'primereact/menubar';
|
|
|
5
5
|
import { IObservableQueryFor, IQueryFor } from '@cratis/arc/queries';
|
|
6
6
|
import { DataTableFilterMeta, DataTableSelectionSingleChangeEvent, type DataTableProps as PrimeDataTableProps } from 'primereact/datatable';
|
|
7
7
|
import { Constructor } from '@cratis/fundamentals';
|
|
8
|
+
import 'allotment/dist/style.css';
|
|
8
9
|
export interface MenuItemProps extends PrimeMenuItem {
|
|
9
10
|
disableOnUnselected?: boolean;
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"DataPage.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,SAAS,EAAW,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,KAAK,cAAc,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG5I,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAUnD,OAAO,0BAA0B,CAAC;AAQlC,MAAM,WAAW,aAAc,SAAQ,aAAa;IAMhD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAOD,eAAO,MAAM,QAAQ,GAAI,GAAG,aAAa,SAExC,CAAC;AAKF,MAAM,WAAW,cAAc;IAE3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAKD,MAAM,WAAW,WAAW;IAExB,QAAQ,EAAE,SAAS,CAAC;CACvB;AAgCD,eAAO,MAAM,SAAS,GAAI,cAAc,cAAc,sBAiCrD,CAAC;AAWF,eAAO,MAAM,OAAO,GAAI,cAAc,WAAW,sBA+BhD,CAAC;AAQF,MAAM,WAAW,sBAAsB,CAAC,SAAS;IAE7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AC,CAAC;IAG7C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AA2GD,QAAA,MAAM,QAAQ;KAAI,MAAM,SAAS,SAAS,CAAC,SAAS,CAAC,GAAG,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,SAAS,SAAS,MAAM,EAAE,UAAU,SAAS,MAAM,SAAS,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC;8BA7TpK,cAAc;4BA4ChB,WAAW;CA+ShD,CAAC;AAKF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -6,16 +6,37 @@ import { QueryFor } from '@cratis/arc/queries';
|
|
|
6
6
|
import { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery.js';
|
|
7
7
|
import { DataTableForQuery } from '../DataTables/DataTableForQuery.js';
|
|
8
8
|
import { Allotment } from 'allotment';
|
|
9
|
+
import { DataPageLayout } from './DataPageLayout.js';
|
|
10
|
+
import 'allotment/dist/style.css';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Declarative menu item for use inside `<DataPage.MenuItems>`. Renders nothing
|
|
12
14
|
* directly; the surrounding {@link MenuItems} component reads its props and
|
|
13
15
|
* forwards them to the action `Menubar`.
|
|
14
16
|
*/
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
17
|
const MenuItem = (_) => {
|
|
17
18
|
return null;
|
|
18
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* The action bar is an intrinsically sized item in the page's layout column —
|
|
22
|
+
* it takes the height its menubar needs and never gives any of it up, so the
|
|
23
|
+
* table region below it is the only part that has to adapt to the space left.
|
|
24
|
+
*/
|
|
25
|
+
const actionsStyle = { flexShrink: 0 };
|
|
26
|
+
/**
|
|
27
|
+
* The table region takes every pixel the action bar leaves and no more.
|
|
28
|
+
* `minHeight: 0` is the load-bearing half: without it the region's automatic
|
|
29
|
+
* minimum keeps it at content height, the column grows past the page, and the
|
|
30
|
+
* table's paginator ends up below the clipped edge.
|
|
31
|
+
*/
|
|
32
|
+
const tableRegionStyle = { flexGrow: 1, flexBasis: 0, minHeight: 0 };
|
|
33
|
+
/**
|
|
34
|
+
* The floor a `DataPage` falls back to when its ancestors give it no height at
|
|
35
|
+
* all. A page that renders as an empty sliver is indistinguishable from a
|
|
36
|
+
* broken one, so a contract-violating consumer gets a small but usable page
|
|
37
|
+
* instead of nothing.
|
|
38
|
+
*/
|
|
39
|
+
const pageStyle = { minHeight: '20rem' };
|
|
19
40
|
/**
|
|
20
41
|
* Renders an action `Menubar` at the top of a {@link DataPage}, populated from
|
|
21
42
|
* `<DataPage.MenuItem>` children. Each menu item's `disableOnUnselected` flag
|
|
@@ -41,7 +62,7 @@ const MenuItems = ({ children }) => {
|
|
|
41
62
|
});
|
|
42
63
|
return menuItems;
|
|
43
64
|
}, [children, context.selectedItem]);
|
|
44
|
-
return (jsx("div", { className: "px-4 py-2", children: jsx(Menubar, { "aria-label": "Actions", model: items, className: context.menubarClassName, pt: context.menubarPt, ptOptions: context.menubarPtOptions, unstyled: context.menubarUnstyled }) }));
|
|
65
|
+
return (jsx("div", { className: "cratis-data-page-actions px-4 py-2", style: actionsStyle, children: jsx(Menubar, { "aria-label": "Actions", model: items, className: context.menubarClassName, pt: context.menubarPt, ptOptions: context.menubarPtOptions, unstyled: context.menubarUnstyled }) }));
|
|
45
66
|
};
|
|
46
67
|
/**
|
|
47
68
|
* Renders the data table at the body of a {@link DataPage}. Automatically
|
|
@@ -54,12 +75,10 @@ const MenuItems = ({ children }) => {
|
|
|
54
75
|
*/
|
|
55
76
|
const Columns = ({ children }) => {
|
|
56
77
|
const context = useDataPageContext();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return (jsx(DataTableForObservableQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, className: context.tableClassName, pt: context.tablePt, ptOptions: context.tablePtOptions, unstyled: context.tableUnstyled, children: children }));
|
|
62
|
-
}
|
|
78
|
+
const isSnapshotQuery = context.query.prototype instanceof QueryFor;
|
|
79
|
+
return (jsx("div", { className: "cratis-data-page-table", style: tableRegionStyle, children: isSnapshotQuery
|
|
80
|
+
? jsx(DataTableForQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, className: context.tableClassName, pt: context.tablePt, ptOptions: context.tablePtOptions, unstyled: context.tableUnstyled, children: children })
|
|
81
|
+
: jsx(DataTableForObservableQuery, { ...context, selection: context.selectedItem, onSelectionChange: context.onSelectionChanged, clientFiltering: context.clientFiltering, className: context.tableClassName, pt: context.tablePt, ptOptions: context.tablePtOptions, unstyled: context.tableUnstyled, children: children }) }));
|
|
63
82
|
};
|
|
64
83
|
const DataPageContext = React.createContext(null);
|
|
65
84
|
function useDataPageContext() {
|
|
@@ -138,6 +157,29 @@ function useDataPageContext() {
|
|
|
138
157
|
* </DataPage>
|
|
139
158
|
* ```
|
|
140
159
|
*
|
|
160
|
+
* ## Height — `DataPage` needs a bounded ancestor
|
|
161
|
+
*
|
|
162
|
+
* `DataPage` fills the height it is given and divides it between the action
|
|
163
|
+
* bar and the table region, so the table's paginator always sits at the
|
|
164
|
+
* bottom of the page rather than below its edge. It cannot invent that height:
|
|
165
|
+
* every element from the page root down sizes as a percentage of its parent,
|
|
166
|
+
* so **some ancestor has to have a definite height**.
|
|
167
|
+
*
|
|
168
|
+
* ```tsx
|
|
169
|
+
* // ✅ the router outlet, a sized container, or a flex child with min-height
|
|
170
|
+
* <div style={{ height: '100vh' }}>
|
|
171
|
+
* <DataPage … />
|
|
172
|
+
* </div>
|
|
173
|
+
*
|
|
174
|
+
* // ❌ nothing above resolves to a height — the table grows to its content
|
|
175
|
+
* <div>
|
|
176
|
+
* <DataPage … />
|
|
177
|
+
* </div>
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* Without one, the page falls back to a small fixed height so it stays
|
|
181
|
+
* usable instead of collapsing to nothing.
|
|
182
|
+
*
|
|
141
183
|
* ## Styling
|
|
142
184
|
*
|
|
143
185
|
* The inner DataTable and Menubar each have their own per-slot props:
|
|
@@ -160,8 +202,10 @@ const DataPage = (props) => {
|
|
|
160
202
|
}
|
|
161
203
|
};
|
|
162
204
|
const context = { ...props, selectedItem, onSelectionChanged: selectionChanged };
|
|
163
|
-
return (jsx(DataPageContext.Provider, { value: context, children: jsx(Page, { title: props.title, panel: true,
|
|
164
|
-
|
|
205
|
+
return (jsx(DataPageContext.Provider, { value: context, children: jsx(Page, { title: props.title, panel: true, style: pageStyle, children: props.detailsComponent
|
|
206
|
+
? jsxs(Allotment, { className: "h-full", proportionalLayout: false, children: [jsx(Allotment.Pane, { children: jsx(DataPageLayout, { children: props.children }) }), selectedItem &&
|
|
207
|
+
jsx(Allotment.Pane, { preferredSize: "450px", children: jsx(props.detailsComponent, { item: selectedItem, onRefresh: props.onRefresh }) })] })
|
|
208
|
+
: jsx(DataPageLayout, { children: props.children }) }) }));
|
|
165
209
|
};
|
|
166
210
|
DataPage.MenuItems = MenuItems;
|
|
167
211
|
DataPage.Columns = Columns;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AAwCA;;;;AAIG;AACI,MAAM,QAAQ,GAAG,CAAC,CAAgB,KAAI;AACzC,IAAA,OAAO,IAAI;AACf;AAkBA;;;;AAIG;AACH,MAAM,YAAY,GAAkB,EAAE,UAAU,EAAE,CAAC,EAAE;AAErD;;;;;AAKG;AACH,MAAM,gBAAgB,GAAkB,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;AAEnF;;;;;AAKG;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YAAY;4BACTA,GAAA,CAAC,SAAS,CAAC,IAAI,EAAA,EAAC,aAAa,EAAC,OAAO,EAAA,QAAA,EACjCA,GAAA,CAAC,KAAK,CAAC,gBAAgB,IAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAA,CAAI,EAAA,CAC7D,CAAA,EAAA;kBAGvBA,GAAA,CAAC,cAAc,EAAA,EAAA,QAAA,EAAE,KAAK,CAAC,QAAQ,EAAA,CAAkB,EAAA,CACpD,EAAA,CACgB;AAEnC;AAEA,QAAQ,CAAC,SAAS,GAAG,SAAS;AAC9B,QAAQ,CAAC,OAAO,GAAG,OAAO;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataPageLayout.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPageLayout.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjD,MAAM,WAAW,mBAAmB;IAEhC,QAAQ,EAAE,SAAS,CAAC;CACvB;AA6BD,eAAO,MAAM,cAAc,GAAI,cAAc,mBAAmB,gCAI/D,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The layout root's own style. Declared inline rather than in a stylesheet on
|
|
5
|
+
* purpose: a consumer that never imports a stylesheet from this package still
|
|
6
|
+
* has to get a working page out of `DataPage`, and the height allocation is
|
|
7
|
+
* what the whole component depends on.
|
|
8
|
+
*
|
|
9
|
+
* `minHeight: 0` is what lets the column shrink inside the flex parent that
|
|
10
|
+
* `Page` renders — without it the default `min-height: auto` keeps the column
|
|
11
|
+
* at content height and everything below the available space is clipped.
|
|
12
|
+
*/
|
|
13
|
+
const layoutStyle = {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
height: '100%',
|
|
17
|
+
minHeight: 0
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The vertical layout inside a `DataPage`'s primary pane.
|
|
21
|
+
*
|
|
22
|
+
* It is a definite-height flex column, so the action bar can be an intrinsic
|
|
23
|
+
* item while the table region absorbs whatever height is left. That is what
|
|
24
|
+
* keeps the table's own paginator inside the page instead of pushing it past
|
|
25
|
+
* the bottom edge, where the surrounding `overflow: hidden` clips it away.
|
|
26
|
+
*
|
|
27
|
+
* @param props - {@link DataPageLayoutProps}.
|
|
28
|
+
*/
|
|
29
|
+
const DataPageLayout = ({ children }) => (jsx("div", { className: 'cratis-data-page-layout', style: layoutStyle, children: children }));
|
|
30
|
+
|
|
31
|
+
export { DataPageLayout };
|
|
32
|
+
//# sourceMappingURL=DataPageLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataPageLayout.js","sources":["../../../DataPage/DataPageLayout.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;AAaA;;;;;;;;;AASG;AACH,MAAM,WAAW,GAAkB;AAC/B,IAAA,OAAO,EAAE,MAAM;AACf,IAAA,aAAa,EAAE,QAAQ;AACvB,IAAA,MAAM,EAAE,MAAM;AACd,IAAA,SAAS,EAAE;CACd;AAED;;;;;;;;;AASG;AACI,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAuB,MAC5DA,aAAK,SAAS,EAAC,yBAAyB,EAAC,KAAK,EAAE,WAAW,EAAA,QAAA,EACtD,QAAQ,EAAA,CACP;;;;"}
|