@cratis/scene.primereact 4.21.0 → 4.22.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/dist/cjs/primeReactDescriptors.js +217 -14
- package/dist/cjs/primeReactDescriptors.js.map +1 -1
- package/dist/esm/primeReactDescriptors.d.ts.map +1 -1
- package/dist/esm/primeReactDescriptors.js +218 -15
- package/dist/esm/primeReactDescriptors.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/primeReactDescriptors.ts +93 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene.primereact",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.22.0",
|
|
4
4
|
"description": "The PrimeReact component package: maps Scene's abstract component names onto real PrimeReact components, and PrimeReact's free themes onto Scene themes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cratis",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"build-storybook": "storybook build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cratis/scene.engine": "4.
|
|
63
|
-
"@cratis/scene.model": "4.
|
|
64
|
-
"@cratis/scene.react": "4.
|
|
62
|
+
"@cratis/scene.engine": "4.22.0",
|
|
63
|
+
"@cratis/scene.model": "4.22.0",
|
|
64
|
+
"@cratis/scene.react": "4.22.0",
|
|
65
65
|
"@primeuix/themes": "^3.0.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@cratis/scene.engine": "4.
|
|
69
|
-
"@cratis/scene.model": "4.
|
|
70
|
-
"@cratis/scene.react": "4.
|
|
68
|
+
"@cratis/scene.engine": "4.22.0",
|
|
69
|
+
"@cratis/scene.model": "4.22.0",
|
|
70
|
+
"@cratis/scene.react": "4.22.0",
|
|
71
71
|
"@primereact/core": "11.2.0",
|
|
72
72
|
"@primereact/headless": "11.2.0",
|
|
73
73
|
"@primereact/types": "11.2.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@storybook/react-vite": "^10.6.1",
|
|
77
77
|
"chart.js": "4.5.1",
|
|
78
78
|
"esbuild": "0.28.2",
|
|
79
|
-
"playwright-core": "1.
|
|
79
|
+
"playwright-core": "1.64.0",
|
|
80
80
|
"primeicons": "8.0.2",
|
|
81
81
|
"primereact": "11.2.0",
|
|
82
82
|
"quill": "2.0.3",
|
package/primeReactDescriptors.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import { ComponentDescriptor, PropertyValueType } from '@cratis/scene.model';
|
|
4
|
+
import { BindingSourceKind, ComponentDescriptor, PropertyDescriptor, PropertyEditorKind, PropertyValueType } from '@cratis/scene.model';
|
|
5
5
|
import { componentRegistryKey } from '@cratis/scene.react';
|
|
6
6
|
import { chartTypeChoices } from './chart/chartTypeChoices';
|
|
7
7
|
import { legacyEnumerationChoices } from './legacyEnumerationChoices';
|
|
@@ -12,6 +12,82 @@ import { primeReactInputDescriptors } from './inputDescriptors';
|
|
|
12
12
|
|
|
13
13
|
const key = (name: string) => componentRegistryKey('PrimeReact', name);
|
|
14
14
|
|
|
15
|
+
/** Structured values keep accepting what a screen binds them to - a query's rows, a data context - as they did when they were any JSON. */
|
|
16
|
+
const bindable = [BindingSourceKind.DataContext, BindingSourceKind.QueryResult, BindingSourceKind.ComponentProperty];
|
|
17
|
+
const choice = (...values: string[]) => values.map(value => ({ value, label: value }));
|
|
18
|
+
const text = (path: string, label: string, description?: string): PropertyDescriptor => ({ path, label, group: 'Content', valueType: PropertyValueType.String, ...(description ? { description } : {}) });
|
|
19
|
+
const flag = (path: string, label: string, description?: string): PropertyDescriptor => ({ path, label, group: 'Content', valueType: PropertyValueType.Boolean, ...(description ? { description } : {}) });
|
|
20
|
+
const numeric = (path: string, label: string, description?: string): PropertyDescriptor => ({ path, label, group: 'Content', valueType: PropertyValueType.Number, ...(description ? { description } : {}) });
|
|
21
|
+
const list = (path: string, label: string, editorKind: PropertyEditorKind, description?: string): PropertyDescriptor => ({ path, label, group: 'Content', valueType: PropertyValueType.Json, editorKind, ...(description ? { description } : {}) });
|
|
22
|
+
|
|
23
|
+
/** The Chart.js data object: its labels and its datasets, with the fields of a dataset that authors set most. Anything else a dataset carries is kept. */
|
|
24
|
+
const chartData: PropertyDescriptor['properties'] = [
|
|
25
|
+
list('labels', 'Labels', PropertyEditorKind.StringList, 'One label for each point of every dataset, in order.'),
|
|
26
|
+
{
|
|
27
|
+
path: 'datasets', label: 'Datasets', group: 'Content', valueType: PropertyValueType.Collection,
|
|
28
|
+
item: {
|
|
29
|
+
label: 'Dataset',
|
|
30
|
+
open: true,
|
|
31
|
+
positional: true,
|
|
32
|
+
properties: [
|
|
33
|
+
text('label', 'Label'),
|
|
34
|
+
list('data', 'Values', PropertyEditorKind.NumberList, 'One value for each label, in order.'),
|
|
35
|
+
list('backgroundColor', 'Fill colour', PropertyEditorKind.StringOrList, 'One CSS colour for the whole dataset, or one for each point.'),
|
|
36
|
+
list('borderColor', 'Border colour', PropertyEditorKind.StringOrList, 'One CSS colour for the whole dataset, or one for each point.'),
|
|
37
|
+
numeric('borderWidth', 'Border width'),
|
|
38
|
+
flag('fill', 'Fill under the line'),
|
|
39
|
+
numeric('tension', 'Line tension', 'How much a line curves between points: 0 is straight.'),
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/** The Chart.js options authors set most; any other option the stored value carries is kept. */
|
|
46
|
+
const chartOptions: PropertyDescriptor['properties'] = [
|
|
47
|
+
flag('responsive', 'Responsive'),
|
|
48
|
+
flag('maintainAspectRatio', 'Keep the aspect ratio'),
|
|
49
|
+
numeric('aspectRatio', 'Aspect ratio', 'Width divided by height.'),
|
|
50
|
+
{ path: 'indexAxis', label: 'Index axis', group: 'Content', valueType: PropertyValueType.Enum, choices: choice('x', 'y'), description: 'The axis the labels run along; y draws horizontal bars.' },
|
|
51
|
+
{
|
|
52
|
+
path: 'plugins', label: 'Plugins', group: 'Content', valueType: PropertyValueType.Object, open: true,
|
|
53
|
+
properties: [
|
|
54
|
+
{
|
|
55
|
+
path: 'legend', label: 'Legend', group: 'Content', valueType: PropertyValueType.Object, open: true,
|
|
56
|
+
properties: [flag('display', 'Show the legend'), { path: 'position', label: 'Position', group: 'Content', valueType: PropertyValueType.Enum, choices: choice('top', 'left', 'bottom', 'right') }],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.Object, open: true,
|
|
60
|
+
properties: [flag('display', 'Show the title'), text('text', 'Text')],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/** The CSS sizes that shape the surface a chart is drawn on. */
|
|
67
|
+
const chartStyle: PropertyDescriptor['properties'] = ['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'].map(name => text(name, name.replace(/([A-Z])/g, ' $1').replace(/^./, first => first.toUpperCase()), 'A CSS length such as 320px or 100%.'));
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A tree node: the fields of Scene's tree model. Children are the same shape; the description goes as deep as a tree is authored by hand,
|
|
71
|
+
* and a node below that keeps its own children without editing them.
|
|
72
|
+
*/
|
|
73
|
+
function treeNode(depth: number): PropertyDescriptor[] {
|
|
74
|
+
const fields: PropertyDescriptor[] = [
|
|
75
|
+
text('key', 'Key', 'Identity across the whole tree. Derived from the node\'s position when it is not set.'),
|
|
76
|
+
text('label', 'Label'),
|
|
77
|
+
text('icon', 'Icon', 'A PrimeIcons class name such as pi pi-folder.'),
|
|
78
|
+
flag('leaf', 'Leaf'),
|
|
79
|
+
flag('expanded', 'Expanded'),
|
|
80
|
+
flag('selectable', 'Selectable'),
|
|
81
|
+
{ path: 'data', label: 'Data', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap, description: 'The values the node shows, under the field names the columns use.' },
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
if (depth > 0) {
|
|
85
|
+
fields.push({ path: 'children', label: 'Children', group: 'Content', valueType: PropertyValueType.Collection, item: { label: 'Node', open: true, positional: true, properties: treeNode(depth - 1) } });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return fields;
|
|
89
|
+
}
|
|
90
|
+
|
|
15
91
|
/** Design-time descriptors for PrimeReact controls whose authored data has structured configuration. */
|
|
16
92
|
export const primeReactDescriptors: ComponentDescriptor[] = [
|
|
17
93
|
...primeReactInputDescriptors,
|
|
@@ -24,11 +100,11 @@ export const primeReactDescriptors: ComponentDescriptor[] = [
|
|
|
24
100
|
path: 'type', label: 'Type', group: 'Chart', valueType: PropertyValueType.Enum, default: ChartType.Bar,
|
|
25
101
|
choices: chartTypeChoices,
|
|
26
102
|
},
|
|
27
|
-
{ path: 'data', label: 'Data', group: 'Data', valueType: PropertyValueType.
|
|
28
|
-
{ path: 'options', label: 'Options', group: 'Chart', valueType: PropertyValueType.
|
|
103
|
+
{ path: 'data', label: 'Data', group: 'Data', valueType: PropertyValueType.Object, open: true, properties: chartData, acceptedBindingKinds: bindable, description: 'The Chart.js data object, including labels and datasets in their authored order.' },
|
|
104
|
+
{ path: 'options', label: 'Options', group: 'Chart', valueType: PropertyValueType.Object, open: true, properties: chartOptions, acceptedBindingKinds: bindable, description: 'The Chart.js options object. The options listed here are the ones authors set most; any other option it holds is kept.' },
|
|
29
105
|
{ path: 'emptyLabel', label: 'No data label', group: 'Accessibility', valueType: PropertyValueType.String, default: 'No chart data', description: 'Shown instead of the chart while it has no data points. Data is never invented.' },
|
|
30
106
|
{ path: 'responsive', label: 'Responsive', group: 'Layout', valueType: PropertyValueType.Boolean, default: true },
|
|
31
|
-
{ path: 'style', label: 'Style', group: 'Layout', valueType: PropertyValueType.
|
|
107
|
+
{ path: 'style', label: 'Style', group: 'Layout', valueType: PropertyValueType.Object, open: true, properties: chartStyle, acceptedBindingKinds: bindable, description: 'The CSS style object applied to the chart surface.' },
|
|
32
108
|
{ path: 'ariaLabel', label: 'Accessible name', group: 'Accessibility', valueType: PropertyValueType.String },
|
|
33
109
|
],
|
|
34
110
|
},
|
|
@@ -54,7 +130,7 @@ export const primeReactDescriptors: ComponentDescriptor[] = [
|
|
|
54
130
|
displayName: 'Data scroller',
|
|
55
131
|
description: 'A list that loads a chunk at a time as its end is reached. Items are strings, numbers or records, plus any child elements in the items slot; serialized legacy UI elements are refused.',
|
|
56
132
|
properties: [
|
|
57
|
-
{ path: 'items', label: 'Items', group: 'Data', valueType: PropertyValueType.Json, description: '
|
|
133
|
+
{ path: 'items', label: 'Items', group: 'Data', valueType: PropertyValueType.Json, editorKind: PropertyEditorKind.StringList, description: 'The text of each item, in order. A record is titled by its label, title, name, text or header field; records authored in a file are kept but not edited here.' },
|
|
58
134
|
{ path: 'rows', label: 'Rows per load', group: 'Behavior', valueType: PropertyValueType.Number, default: 10, constraints: { minimum: 1, integer: true } },
|
|
59
135
|
{ path: 'inline', label: 'Scroll inline', group: 'Layout', valueType: PropertyValueType.Boolean, default: false, description: 'Scroll inside the control (true) or load as the page scrolls the end of the list into view (false).' },
|
|
60
136
|
{ path: 'scrollHeight', label: 'Inline scroll height', group: 'Layout', valueType: PropertyValueType.Number, constraints: { minimum: 1 }, description: 'The height in pixels of an inline scroller. 320 when omitted.' },
|
|
@@ -67,13 +143,16 @@ export const primeReactDescriptors: ComponentDescriptor[] = [
|
|
|
67
143
|
displayName: 'Tree table',
|
|
68
144
|
description: 'A hierarchical table with authored columns, selection, and optional pagination. Items are nodes (strings, numbers or records with key, label, data, children); serialized legacy UI elements are refused.',
|
|
69
145
|
properties: [
|
|
70
|
-
{
|
|
71
|
-
|
|
146
|
+
{
|
|
147
|
+
path: 'columns', label: 'Columns', group: 'Data', valueType: PropertyValueType.Collection, acceptedBindingKinds: bindable, description: 'Column definitions with field and header, or nested column elements. Inferred from the first row when absent.',
|
|
148
|
+
item: { label: 'Column', open: true, positional: true, properties: [text('field', 'Field', 'The name in a node\'s data that the column shows.'), text('header', 'Header', 'The column heading. The field name when it is not set.'), flag('sortable', 'Sortable')] },
|
|
149
|
+
},
|
|
150
|
+
{ path: 'items', label: 'Items', group: 'Data', valueType: PropertyValueType.Collection, item: { label: 'Node', open: true, positional: true, properties: treeNode(3) }, acceptedBindingKinds: bindable, description: 'The nodes: records with key, label, data, children, expanded and selectable.' },
|
|
72
151
|
{
|
|
73
152
|
path: 'selectionMode', label: 'Selection mode', group: 'Behavior', valueType: PropertyValueType.Enum, default: TreeTableSelectionMode.None,
|
|
74
153
|
choices: legacyEnumerationChoices(TreeTableSelectionMode, { [TreeTableSelectionMode.None]: 'None', [TreeTableSelectionMode.Single]: 'Single', [TreeTableSelectionMode.Multiple]: 'Multiple', [TreeTableSelectionMode.Checkbox]: 'Checkbox' }),
|
|
75
154
|
},
|
|
76
|
-
{ path: 'selection', label: 'Selection', group: 'Behavior', valueType: PropertyValueType.Json, description: 'The
|
|
155
|
+
{ path: 'selection', label: 'Selection', group: 'Behavior', valueType: PropertyValueType.Json, editorKind: PropertyEditorKind.StringOrList, description: 'The key of the selected node, or the keys of the selected nodes.' },
|
|
77
156
|
{ path: 'paginator', label: 'Show pagination', group: 'Behavior', valueType: PropertyValueType.Boolean, default: false },
|
|
78
157
|
{ path: 'rows', label: 'Rows per page', group: 'Behavior', valueType: PropertyValueType.Number, default: 10, constraints: { minimum: 1, integer: true } },
|
|
79
158
|
{ path: 'emptyLabel', label: 'No records label', group: 'Accessibility', valueType: PropertyValueType.String, default: 'No records found' },
|
|
@@ -97,13 +176,16 @@ export const primeReactDescriptors: ComponentDescriptor[] = [
|
|
|
97
176
|
displayName: 'Multi-state checkbox',
|
|
98
177
|
description: 'An accessible button that cycles through its authored states in order, showing the current state as a checkbox-style glyph.',
|
|
99
178
|
properties: [
|
|
100
|
-
{ path: 'value', label: 'Value', group: 'State', valueType: PropertyValueType.Json, description: 'The selected value
|
|
101
|
-
{
|
|
179
|
+
{ path: 'value', label: 'Value', group: 'State', valueType: PropertyValueType.Json, editorKind: PropertyEditorKind.Scalar, description: 'The selected value: a word, a number or a flag. Not set when the empty state is selected.' },
|
|
180
|
+
{
|
|
181
|
+
path: 'options', label: 'Options', group: 'State', valueType: PropertyValueType.Collection, acceptedBindingKinds: bindable, description: 'The ordered state options. Each may provide label, value, and icon fields.',
|
|
182
|
+
item: { label: 'State', open: true, positional: true, properties: [text('label', 'Label'), text('value', 'Value'), text('icon', 'Icon', 'A PrimeIcons class name such as pi pi-check.')] },
|
|
183
|
+
},
|
|
102
184
|
{ path: 'optionLabel', label: 'Option label field', group: 'State', valueType: PropertyValueType.String, default: 'label' },
|
|
103
185
|
{ path: 'optionValue', label: 'Option value field', group: 'State', valueType: PropertyValueType.String, default: 'value' },
|
|
104
186
|
{ path: 'empty', label: 'Allow empty state', group: 'State', valueType: PropertyValueType.Boolean, default: true },
|
|
105
187
|
{ path: 'emptyLabel', label: 'Empty state label', group: 'Accessibility', valueType: PropertyValueType.String, default: 'No selection' },
|
|
106
|
-
{ path: 'icons', label: 'Icons', group: 'Appearance', valueType: PropertyValueType.Json, description: '
|
|
188
|
+
{ path: 'icons', label: 'Icons', group: 'Appearance', valueType: PropertyValueType.Json, editorKind: PropertyEditorKind.StringList, description: 'One icon for each option, in the order of the options. Each is a PrimeIcons class name or a qualified icon reference. Icons inside this value are not tracked by the icon library diagnostics; use the empty state icon where a tracked icon is needed.' },
|
|
107
189
|
{ path: 'emptyIcon', label: 'Empty state icon', group: 'Appearance', valueType: PropertyValueType.Icon },
|
|
108
190
|
{ path: 'readOnly', label: 'Read only', group: 'Behavior', valueType: PropertyValueType.Boolean, default: false },
|
|
109
191
|
{ path: 'disabled', label: 'Disabled', group: 'Behavior', valueType: PropertyValueType.Boolean, default: false },
|