@cratis/scene.components 1.1.0 → 2.0.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/.storybook/main.ts +0 -6
- package/.storybook/preview.tsx +33 -8
- package/README.md +21 -11
- package/common/SceneDropdown.tsx +10 -3
- package/cratisComponentsPackage.ts +18 -14
- package/data/SceneDataTable.tsx +7 -2
- package/data/SceneObservableDataTable.tsx +5 -2
- package/dialogs/SceneCommandDialog.tsx +11 -1
- package/dialogs/SceneDialog.tsx +13 -1
- package/dist/cjs/common/SceneDropdown.js +10 -3
- package/dist/cjs/common/SceneDropdown.js.map +1 -1
- package/dist/cjs/cratisComponentsPackage.js +18 -14
- package/dist/cjs/cratisComponentsPackage.js.map +1 -1
- package/dist/cjs/data/SceneDataTable.js +6 -1
- package/dist/cjs/data/SceneDataTable.js.map +1 -1
- package/dist/cjs/data/SceneObservableDataTable.js +4 -1
- package/dist/cjs/data/SceneObservableDataTable.js.map +1 -1
- package/dist/cjs/dialogs/SceneCommandDialog.js +11 -1
- package/dist/cjs/dialogs/SceneCommandDialog.js.map +1 -1
- package/dist/cjs/dialogs/SceneDialog.js +13 -1
- package/dist/cjs/dialogs/SceneDialog.js.map +1 -1
- package/dist/cjs/forms/fields/SceneChipsField.js +6 -1
- package/dist/cjs/forms/fields/SceneChipsField.js.map +1 -1
- package/dist/cjs/forms/fields/SceneMultiSelectField.js +7 -6
- package/dist/cjs/forms/fields/SceneMultiSelectField.js.map +1 -1
- package/dist/cjs/pages/SceneDataPage.js +5 -2
- package/dist/cjs/pages/SceneDataPage.js.map +1 -1
- package/dist/esm/common/SceneDropdown.d.ts.map +1 -1
- package/dist/esm/common/SceneDropdown.js +10 -3
- package/dist/esm/common/SceneDropdown.js.map +1 -1
- package/dist/esm/cratisComponentsPackage.d.ts.map +1 -1
- package/dist/esm/cratisComponentsPackage.js +18 -14
- package/dist/esm/cratisComponentsPackage.js.map +1 -1
- package/dist/esm/data/SceneDataTable.d.ts.map +1 -1
- package/dist/esm/data/SceneDataTable.js +7 -2
- package/dist/esm/data/SceneDataTable.js.map +1 -1
- package/dist/esm/data/SceneObservableDataTable.d.ts.map +1 -1
- package/dist/esm/data/SceneObservableDataTable.js +5 -2
- package/dist/esm/data/SceneObservableDataTable.js.map +1 -1
- package/dist/esm/dialogs/SceneCommandDialog.d.ts.map +1 -1
- package/dist/esm/dialogs/SceneCommandDialog.js +11 -1
- package/dist/esm/dialogs/SceneCommandDialog.js.map +1 -1
- package/dist/esm/dialogs/SceneDialog.d.ts.map +1 -1
- package/dist/esm/dialogs/SceneDialog.js +13 -1
- package/dist/esm/dialogs/SceneDialog.js.map +1 -1
- package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.js +2 -1
- package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.js.map +1 -1
- package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.js +5 -5
- package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.js.map +1 -1
- package/dist/esm/forms/fields/SceneChipsField.d.ts.map +1 -1
- package/dist/esm/forms/fields/SceneChipsField.js +6 -1
- package/dist/esm/forms/fields/SceneChipsField.js.map +1 -1
- package/dist/esm/forms/fields/SceneMultiSelectField.d.ts.map +1 -1
- package/dist/esm/forms/fields/SceneMultiSelectField.js +8 -7
- package/dist/esm/forms/fields/SceneMultiSelectField.js.map +1 -1
- package/dist/esm/pages/SceneDataPage.d.ts.map +1 -1
- package/dist/esm/pages/SceneDataPage.js +6 -3
- package/dist/esm/pages/SceneDataPage.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.tsx +13 -1
- package/for_cratisComponentsPackage/when_resolving_its_dependencies.ts +16 -6
- package/forms/fields/SceneChipsField.tsx +6 -1
- package/forms/fields/SceneMultiSelectField.tsx +8 -6
- package/package.json +19 -13
- package/pages/SceneDataPage.tsx +6 -3
|
@@ -2,13 +2,25 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
4
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
5
|
+
import { PrimeReactProvider } from '@primereact/core';
|
|
5
6
|
import { externalComponent } from '../../given';
|
|
6
7
|
import { SceneObjectNavigationalBar } from '../SceneObjectNavigationalBar';
|
|
7
8
|
|
|
8
9
|
describe('when navigating back up the trail', () => {
|
|
10
|
+
/**
|
|
11
|
+
* The `PrimeReactProvider` became mandatory with PrimeReact 11: every v11 component bottoms out in
|
|
12
|
+
* `usePrimeReact()`, which throws when the context is absent rather than falling back to a default
|
|
13
|
+
* configuration. The bar reaches one through the tooltip on its crumbs, so without this the spec fails
|
|
14
|
+
* at `render` with a provider error instead of exercising the trail at all. No preset is supplied -
|
|
15
|
+
* what is specified here is the navigation behavior, not how a crumb looks.
|
|
16
|
+
*/
|
|
9
17
|
beforeEach(() => {
|
|
10
18
|
const element = externalComponent('Cratis.Components:objectNavigationalBar', { navigationPath: ['shipping', 'address', 'street'] });
|
|
11
|
-
render(
|
|
19
|
+
render(
|
|
20
|
+
<PrimeReactProvider>
|
|
21
|
+
<SceneObjectNavigationalBar element={element} slots={{}} />
|
|
22
|
+
</PrimeReactProvider>
|
|
23
|
+
);
|
|
12
24
|
fireEvent.click(screen.getByText('address'));
|
|
13
25
|
});
|
|
14
26
|
|
|
@@ -21,17 +21,27 @@ const tailwind: ScenePackage = {
|
|
|
21
21
|
themes: [],
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The base component library `Cratis.Components` wraps, at the version this repository pins.
|
|
26
|
+
*
|
|
27
|
+
* The theme names are drawn from the catalog PrimeReact 11 actually has. Version 11 ships no theme
|
|
28
|
+
* stylesheets at all - a look is a `@primeuix/themes` preset applied at runtime - and the catalog was
|
|
29
|
+
* rebuilt on those presets, so names read `<family>-<light|dark>-<accent>` across the Aura, Lara and Nora
|
|
30
|
+
* families. Several version 10 names (`saga-*`, `vela-*`, `soho-*`, `nano`, `mira` and the rest) have no
|
|
31
|
+
* preset behind them any more and are simply gone; the Lara pair below survived the rebuild, and an Aura
|
|
32
|
+
* pair is listed alongside them so the stub is visibly the version 11 catalog rather than a version 10
|
|
33
|
+
* remnant that happens to still be valid.
|
|
34
|
+
*/
|
|
25
35
|
const primeReact: ScenePackage = {
|
|
26
36
|
name: 'PrimeReact',
|
|
27
|
-
version: '
|
|
37
|
+
version: '11.1.0',
|
|
28
38
|
kind: PackageKind.ComponentLibrary,
|
|
29
39
|
dependencies: [{ name: 'Tailwind' }],
|
|
30
40
|
components: ['button', 'table', 'dialog'],
|
|
31
41
|
layouts: [],
|
|
32
42
|
screenTemplates: [],
|
|
33
43
|
dialogTemplates: [],
|
|
34
|
-
themes: ['lara-light-blue', 'lara-dark-blue'],
|
|
44
|
+
themes: ['aura-light-blue', 'aura-dark-blue', 'lara-light-blue', 'lara-dark-blue'],
|
|
35
45
|
};
|
|
36
46
|
|
|
37
47
|
describe('when resolving its dependencies', () => {
|
|
@@ -57,12 +67,12 @@ describe('when resolving its dependencies', () => {
|
|
|
57
67
|
]));
|
|
58
68
|
});
|
|
59
69
|
|
|
60
|
-
describe('and PrimeReact is older than the
|
|
61
|
-
const older = resolvePackageDependencies(['Cratis.Components'], [tailwind, { ...primeReact, version: '10.8
|
|
70
|
+
describe('and PrimeReact is older than the major version the library is built against', () => {
|
|
71
|
+
const older = resolvePackageDependencies(['Cratis.Components'], [tailwind, { ...primeReact, version: '10.9.8' }, cratisComponentsPackageManifest]);
|
|
62
72
|
|
|
63
73
|
it('should report the version conflict', () =>
|
|
64
74
|
older.versionConflicts.should.deep.equal([
|
|
65
|
-
{ package: 'Cratis.Components', dependsOn: 'PrimeReact', requiredRange: '>=
|
|
75
|
+
{ package: 'Cratis.Components', dependsOn: 'PrimeReact', requiredRange: '>=11.0.0', actualVersion: '10.9.8' },
|
|
66
76
|
]));
|
|
67
77
|
});
|
|
68
78
|
});
|
|
@@ -14,6 +14,12 @@ const ChipsField = lazy(async () => ({ default: (await import('@cratis/component
|
|
|
14
14
|
* A free-form list of strings - tags, labels, recipients - where the values are typed rather than picked.
|
|
15
15
|
* `multiSelectField` is the right choice whenever the values come from a known set; this one exists for
|
|
16
16
|
* when they do not.
|
|
17
|
+
*
|
|
18
|
+
* There is no `separator` property. PrimeReact 11's `InputTags` commits exactly one tag per `Enter` and
|
|
19
|
+
* no longer splits pasted text, so `@cratis/components` keeps the prop only so existing call sites
|
|
20
|
+
* compile and never reads it. A screen that wrote `separator: ','` and watched a pasted comma-separated
|
|
21
|
+
* list arrive as a single tag would have no way to tell that from a bug, which is precisely why the
|
|
22
|
+
* property is withdrawn rather than passed through.
|
|
17
23
|
*/
|
|
18
24
|
export function SceneChipsField({ element }: RegisteredComponentProps) {
|
|
19
25
|
return (
|
|
@@ -23,7 +29,6 @@ export function SceneChipsField({ element }: RegisteredComponentProps) {
|
|
|
23
29
|
{...binding}
|
|
24
30
|
placeholder={stringProperty(element.properties, 'placeholder')}
|
|
25
31
|
max={numberProperty(element.properties, 'max')}
|
|
26
|
-
separator={stringProperty(element.properties, 'separator')}
|
|
27
32
|
addOnBlur={booleanProperty(element.properties, 'addOnBlur')}
|
|
28
33
|
allowDuplicate={booleanProperty(element.properties, 'allowDuplicate')}
|
|
29
34
|
className={stringProperty(element.properties, 'className')}
|
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
import { lazy } from 'react';
|
|
5
5
|
import { RegisteredComponentProps } from '@cratis/scene.react';
|
|
6
|
-
import { booleanProperty,
|
|
6
|
+
import { booleanProperty, objectArrayProperty, stringProperty } from '../../properties';
|
|
7
7
|
import { CommandFormField } from './CommandFormField';
|
|
8
8
|
|
|
9
9
|
const MultiSelectField = lazy(async () => ({ default: (await import('@cratis/components/CommandForm')).MultiSelectField }));
|
|
10
10
|
|
|
11
|
-
/** How the current selection is summarized in the closed control. */
|
|
12
|
-
const displayModes = ['comma', 'chip'] as const;
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* The `Cratis.Components:multiSelectField` component - `MultiSelectField` from
|
|
16
13
|
* `@cratis/components/CommandForm`.
|
|
17
14
|
*
|
|
18
15
|
* The many-valued counterpart to `dropdownField`, binding to a collection property on the command rather
|
|
19
16
|
* than a scalar one.
|
|
17
|
+
*
|
|
18
|
+
* The `display` and `maxSelectedLabels` properties this adapter used to expose are gone. In
|
|
19
|
+
* `@cratis/components` 3.0.0 the field is re-expressed over the library's own `Dropdown` in multiple
|
|
20
|
+
* mode, because PrimeReact 11's `Select` has no `multiple` prop of the version 10 shape and renders the
|
|
21
|
+
* selection through its own value slot - so there is no comma mode, no chip mode, and no label-collapse
|
|
22
|
+
* threshold left to choose between. Both props are still declared upstream so call sites compile, and
|
|
23
|
+
* neither is read. Passing them on would have let a screen state a preference the control cannot honor.
|
|
20
24
|
*/
|
|
21
25
|
export function SceneMultiSelectField({ element }: RegisteredComponentProps) {
|
|
22
26
|
return (
|
|
@@ -28,8 +32,6 @@ export function SceneMultiSelectField({ element }: RegisteredComponentProps) {
|
|
|
28
32
|
optionLabel={stringProperty(element.properties, 'optionLabel') ?? 'label'}
|
|
29
33
|
optionValue={stringProperty(element.properties, 'optionValue') ?? 'value'}
|
|
30
34
|
placeholder={stringProperty(element.properties, 'placeholder')}
|
|
31
|
-
display={unionProperty(element.properties, 'display', displayModes)}
|
|
32
|
-
maxSelectedLabels={numberProperty(element.properties, 'maxSelectedLabels')}
|
|
33
35
|
filter={booleanProperty(element.properties, 'filter')}
|
|
34
36
|
showClear={booleanProperty(element.properties, 'showClear')}
|
|
35
37
|
className={stringProperty(element.properties, 'className')}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene.components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "The Cratis Components package: exposes @cratis/components' Arc-bound data, form and dialog composites as Scene components. Built on PrimeReact and Tailwind, and declares both as dependencies.",
|
|
5
5
|
"author": "Cratis",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,27 +42,33 @@
|
|
|
42
42
|
"build-storybook": "storybook build"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@cratis/scene.engine": "
|
|
46
|
-
"@cratis/scene.model": "
|
|
47
|
-
"@cratis/scene.react": "
|
|
45
|
+
"@cratis/scene.engine": "2.0.0",
|
|
46
|
+
"@cratis/scene.model": "2.0.0",
|
|
47
|
+
"@cratis/scene.react": "2.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@cratis/components": "^
|
|
51
|
-
"@cratis/scene.engine": "
|
|
52
|
-
"@cratis/scene.model": "
|
|
53
|
-
"@cratis/scene.react": "
|
|
50
|
+
"@cratis/components": "^3.0.0",
|
|
51
|
+
"@cratis/scene.engine": "2.0.0",
|
|
52
|
+
"@cratis/scene.model": "2.0.0",
|
|
53
|
+
"@cratis/scene.react": "2.0.0",
|
|
54
|
+
"@primereact/core": "11.1.0",
|
|
55
|
+
"@primereact/headless": "11.1.0",
|
|
54
56
|
"@storybook/addon-links": "^10.4.1",
|
|
55
57
|
"@storybook/react": "^10.4.1",
|
|
56
58
|
"@storybook/react-vite": "^10.4.1",
|
|
57
|
-
"
|
|
59
|
+
"primeicons": "8.0.0",
|
|
60
|
+
"primereact": "11.1.0",
|
|
58
61
|
"react": "^19.2.6",
|
|
59
62
|
"react-dom": "^19.2.6",
|
|
60
63
|
"storybook": "^10.4.1"
|
|
61
64
|
},
|
|
62
65
|
"peerDependencies": {
|
|
63
|
-
"@cratis/components": "
|
|
64
|
-
"primereact": "^
|
|
65
|
-
"
|
|
66
|
-
"
|
|
66
|
+
"@cratis/components": "^3.0.0",
|
|
67
|
+
"@primereact/core": "^11.0.0",
|
|
68
|
+
"@primereact/headless": "^11.0.0",
|
|
69
|
+
"primeicons": "^8.0.0",
|
|
70
|
+
"primereact": "^11.0.0",
|
|
71
|
+
"react": "^19.0.0",
|
|
72
|
+
"react-dom": "^19.0.0"
|
|
67
73
|
}
|
|
68
74
|
}
|
package/pages/SceneDataPage.tsx
CHANGED
|
@@ -4,20 +4,24 @@
|
|
|
4
4
|
import { lazy } from 'react';
|
|
5
5
|
import { RegisteredComponentProps } from '@cratis/scene.react';
|
|
6
6
|
import { ArcRuntimeBoundary, BindingKind, MissingBinding, resolveElementBinding } from '../bindings';
|
|
7
|
-
import {
|
|
7
|
+
import { stringArrayProperty, stringProperty } from '../properties';
|
|
8
8
|
|
|
9
9
|
const DataPage = lazy(async () => ({ default: (await import('@cratis/components/DataPage')).DataPage }));
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The `Cratis.Components:dataPage` component - `DataPage` from `@cratis/components/DataPage`.
|
|
13
13
|
*
|
|
14
|
-
* The library's whole list-screen composite in one name: title bar,
|
|
14
|
+
* The library's whole list-screen composite in one name: title bar, action toolbar, filterable table and
|
|
15
15
|
* optional details pane, all driven from a single query. It is the single highest-leverage thing this
|
|
16
16
|
* package exposes, because reproducing it out of `table` and `toolbar` in a screen would be pages of
|
|
17
17
|
* modeling for a worse result.
|
|
18
18
|
*
|
|
19
19
|
* The `query` property names an Arc query proxy; the columns and menu items come from the `content`
|
|
20
20
|
* slot as `DataPage.Columns` / `DataPage.MenuItems` children.
|
|
21
|
+
*
|
|
22
|
+
* No `clientFiltering` property, for the same reason `dataTable` no longer exposes one: 3.0.0 keeps the
|
|
23
|
+
* prop so call sites compile but never reads it, and a screen setting that cannot take effect is a worse
|
|
24
|
+
* thing to offer than nothing.
|
|
21
25
|
*/
|
|
22
26
|
export function SceneDataPage({ element, slots }: RegisteredComponentProps) {
|
|
23
27
|
const { name, target } = resolveElementBinding(element, BindingKind.Query);
|
|
@@ -31,7 +35,6 @@ export function SceneDataPage({ element, slots }: RegisteredComponentProps) {
|
|
|
31
35
|
emptyMessage={stringProperty(element.properties, 'emptyMessage') ?? ''}
|
|
32
36
|
dataKey={stringProperty(element.properties, 'dataKey')}
|
|
33
37
|
globalFilterFields={stringArrayProperty(element.properties, 'globalFilterFields')}
|
|
34
|
-
clientFiltering={booleanProperty(element.properties, 'clientFiltering')}
|
|
35
38
|
>
|
|
36
39
|
{slots.content}
|
|
37
40
|
</DataPage>
|