@cratis/scene.components 4.8.0 → 4.10.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/cratisComponentsDescriptors.ts +53 -1
- package/cratisComponentsPackage.ts +23 -0
- package/dist/cjs/cratisComponentsDescriptors.js +150 -0
- package/dist/cjs/cratisComponentsDescriptors.js.map +1 -1
- package/dist/cjs/cratisComponentsPackage.js +40 -2
- package/dist/cjs/cratisComponentsPackage.js.map +1 -1
- package/dist/cjs/forms/CommandFieldPropertyEditor.js +28 -0
- package/dist/cjs/forms/CommandFieldPropertyEditor.js.map +1 -0
- package/dist/cjs/forms/CommandFormDesigner.js +20 -0
- package/dist/cjs/forms/CommandFormDesigner.js.map +1 -0
- package/dist/cjs/forms/CommandFormRuntime.js +11 -4
- package/dist/cjs/forms/CommandFormRuntime.js.map +1 -1
- package/dist/cjs/forms/ExplicitCommandField.js +13 -7
- package/dist/cjs/forms/ExplicitCommandField.js.map +1 -1
- package/dist/cjs/forms/SceneCommandForm.js +10 -3
- package/dist/cjs/forms/SceneCommandForm.js.map +1 -1
- package/dist/cjs/forms/commandInputs.js +8 -2
- package/dist/cjs/forms/commandInputs.js.map +1 -1
- package/dist/cjs/forms/generateCommandFieldsAction.js +58 -0
- package/dist/cjs/forms/generateCommandFieldsAction.js.map +1 -0
- package/dist/esm/cratisComponentsDescriptors.d.ts.map +1 -1
- package/dist/esm/cratisComponentsDescriptors.js +151 -1
- package/dist/esm/cratisComponentsDescriptors.js.map +1 -1
- package/dist/esm/cratisComponentsPackage.d.ts.map +1 -1
- package/dist/esm/cratisComponentsPackage.js +40 -2
- package/dist/esm/cratisComponentsPackage.js.map +1 -1
- package/dist/esm/forms/CommandFieldPropertyEditor.d.ts +3 -0
- package/dist/esm/forms/CommandFieldPropertyEditor.d.ts.map +1 -0
- package/dist/esm/forms/CommandFieldPropertyEditor.js +26 -0
- package/dist/esm/forms/CommandFieldPropertyEditor.js.map +1 -0
- package/dist/esm/forms/CommandFormDesigner.d.ts +3 -0
- package/dist/esm/forms/CommandFormDesigner.d.ts.map +1 -0
- package/dist/esm/forms/CommandFormDesigner.js +18 -0
- package/dist/esm/forms/CommandFormDesigner.js.map +1 -0
- package/dist/esm/forms/CommandFormRuntime.d.ts +2 -1
- package/dist/esm/forms/CommandFormRuntime.d.ts.map +1 -1
- package/dist/esm/forms/CommandFormRuntime.js +11 -4
- package/dist/esm/forms/CommandFormRuntime.js.map +1 -1
- package/dist/esm/forms/ExplicitCommandField.d.ts.map +1 -1
- package/dist/esm/forms/ExplicitCommandField.js +13 -7
- package/dist/esm/forms/ExplicitCommandField.js.map +1 -1
- package/dist/esm/forms/SceneCommandForm.d.ts.map +1 -1
- package/dist/esm/forms/SceneCommandForm.js +11 -4
- package/dist/esm/forms/SceneCommandForm.js.map +1 -1
- package/dist/esm/forms/commandInputs.d.ts +2 -0
- package/dist/esm/forms/commandInputs.d.ts.map +1 -1
- package/dist/esm/forms/commandInputs.js +9 -3
- package/dist/esm/forms/commandInputs.js.map +1 -1
- package/dist/esm/forms/generateCommandFieldsAction.d.ts +3 -0
- package/dist/esm/forms/generateCommandFieldsAction.d.ts.map +1 -0
- package/dist/esm/forms/generateCommandFieldsAction.js +56 -0
- package/dist/esm/forms/generateCommandFieldsAction.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/forms/CommandFieldPropertyEditor.tsx +16 -0
- package/forms/CommandFormDesigner.tsx +14 -0
- package/forms/CommandFormRuntime.tsx +5 -2
- package/forms/ExplicitCommandField.tsx +4 -2
- package/forms/SceneCommandForm.tsx +5 -3
- package/forms/commandInputs.ts +7 -3
- package/forms/generateCommandFieldsAction.ts +46 -0
- package/package.json +7 -7
|
@@ -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, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';
|
|
4
|
+
import { BindingMode, BindingSourceKind, ComponentDescriptor, DesignTimeActionPlacement, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';
|
|
5
5
|
import { componentRegistryKey } from '@cratis/scene.react';
|
|
6
6
|
|
|
7
7
|
// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in
|
|
@@ -32,6 +32,45 @@ const dataTableProperties: PropertyDescriptor[] = [
|
|
|
32
32
|
path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',
|
|
33
33
|
description: 'The result fields the table\'s search box looks in.',
|
|
34
34
|
},
|
|
35
|
+
{
|
|
36
|
+
path: 'selectedItem', label: 'Selected item', group: 'Outputs', valueType: PropertyValueType.Object, readOnly: true,
|
|
37
|
+
output: true, bindingMode: BindingMode.OneWay,
|
|
38
|
+
description: 'The currently selected row, or null after selection is cleared.',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const commandFormProperties: PropertyDescriptor[] = [
|
|
43
|
+
{
|
|
44
|
+
path: 'command', label: 'Command', group: 'Command', valueType: PropertyValueType.String, editorKind: 'commandBinding',
|
|
45
|
+
constraints: { required: true },
|
|
46
|
+
description: 'The Arc command proxy rendered through the native command form runtime.',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
path: 'mode', label: 'Mode', group: 'Layout', valueType: PropertyValueType.Enum,
|
|
50
|
+
choices: [{ value: 'auto', label: 'Auto' }, { value: 'manual', label: 'Manual' }], default: 'auto',
|
|
51
|
+
description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.',
|
|
52
|
+
},
|
|
53
|
+
{ path: 'columns', label: 'Columns', group: 'Layout', valueType: PropertyValueType.Number, default: 1 },
|
|
54
|
+
{ path: 'fieldWidths', label: 'Field widths', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'fieldWidths' },
|
|
55
|
+
{
|
|
56
|
+
path: 'inputs', label: 'Fields', group: 'Layout', valueType: PropertyValueType.Collection, editorKind: 'commandFields',
|
|
57
|
+
acceptedBindingKinds: [BindingSourceKind.DataContext, BindingSourceKind.ComponentProperty],
|
|
58
|
+
item: {
|
|
59
|
+
label: 'Field',
|
|
60
|
+
properties: [
|
|
61
|
+
{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String },
|
|
62
|
+
{ path: 'type', label: 'Type', group: 'Field', valueType: PropertyValueType.Enum, choices: [{ value: 'string', label: 'String' }, { value: 'guid', label: 'Guid' }] },
|
|
63
|
+
{ path: 'label', label: 'Label', group: 'Field', valueType: PropertyValueType.String },
|
|
64
|
+
{ path: 'column', label: 'Column', group: 'Layout', valueType: PropertyValueType.Number },
|
|
65
|
+
{ path: 'width', label: 'Width', group: 'Layout', valueType: PropertyValueType.String },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
path: 'exclude', label: 'Excluded fields', group: 'Command', valueType: PropertyValueType.Collection,
|
|
71
|
+
item: { label: 'Excluded field', properties: [{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String }] },
|
|
72
|
+
},
|
|
73
|
+
{ path: 'submitLabel', label: 'Submit label', group: 'Content', valueType: PropertyValueType.String, default: 'Submit' },
|
|
35
74
|
];
|
|
36
75
|
|
|
37
76
|
/**
|
|
@@ -45,4 +84,17 @@ export const cratisComponentsDescriptors: ComponentDescriptor[] = [
|
|
|
45
84
|
{ component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },
|
|
46
85
|
{ component: key('table'), displayName: 'Table', properties: dataTableProperties },
|
|
47
86
|
{ component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },
|
|
87
|
+
{
|
|
88
|
+
component: key('commandForm'),
|
|
89
|
+
displayName: 'Command form',
|
|
90
|
+
editorKind: 'commandFormDesigner',
|
|
91
|
+
properties: commandFormProperties,
|
|
92
|
+
actions: [{
|
|
93
|
+
id: 'Cratis.Components.commandForm.generateFields',
|
|
94
|
+
label: 'Generate fields',
|
|
95
|
+
placement: DesignTimeActionPlacement.Toolbar,
|
|
96
|
+
availability: 'commandForm.canGenerateFields',
|
|
97
|
+
description: 'Creates a deterministic editable field layout from the selected command metadata.',
|
|
98
|
+
}],
|
|
99
|
+
},
|
|
48
100
|
];
|
|
@@ -5,6 +5,9 @@ import { PackageKind, ScenePackage } from '@cratis/scene.model';
|
|
|
5
5
|
import { ScenePackageBundle } from '@cratis/scene.react';
|
|
6
6
|
import { cratisComponents, cratisComponentsPackageName } from './cratisComponents';
|
|
7
7
|
import { cratisComponentsDescriptors } from './cratisComponentsDescriptors';
|
|
8
|
+
import { CommandFieldPropertyEditor } from './forms/CommandFieldPropertyEditor';
|
|
9
|
+
import { CommandFormDesigner } from './forms/CommandFormDesigner';
|
|
10
|
+
import { generateCommandFieldsAction } from './forms/generateCommandFieldsAction';
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* The `Cratis.Components` package's declaration - what a profile gets when it lists this package.
|
|
@@ -95,6 +98,15 @@ export const cratisComponentsPackageManifest: ScenePackage = {
|
|
|
95
98
|
module: '@cratis/scene.components',
|
|
96
99
|
license: 'MIT',
|
|
97
100
|
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',
|
|
101
|
+
designTime: {
|
|
102
|
+
previews: [],
|
|
103
|
+
designers: ['commandFormDesigner'],
|
|
104
|
+
propertyEditors: ['commandBinding', 'commandFields', 'fieldWidths'],
|
|
105
|
+
propertyDisplays: [],
|
|
106
|
+
actions: ['Cratis.Components.commandForm.generateFields'],
|
|
107
|
+
},
|
|
108
|
+
assets: ['@cratis/components/styles', '@cratis/components/tokens'],
|
|
109
|
+
runtimeSingletons: ['react', '@cratis/arc', '@cratis/components'],
|
|
98
110
|
};
|
|
99
111
|
|
|
100
112
|
/**
|
|
@@ -108,4 +120,15 @@ export const cratisComponentsPackage: ScenePackageBundle = {
|
|
|
108
120
|
manifest: cratisComponentsPackageManifest,
|
|
109
121
|
components: cratisComponents,
|
|
110
122
|
descriptors: cratisComponentsDescriptors,
|
|
123
|
+
designTime: {
|
|
124
|
+
designers: {
|
|
125
|
+
commandFormDesigner: CommandFormDesigner,
|
|
126
|
+
},
|
|
127
|
+
propertyEditors: {
|
|
128
|
+
commandBinding: CommandFieldPropertyEditor,
|
|
129
|
+
},
|
|
130
|
+
actions: {
|
|
131
|
+
[generateCommandFieldsAction.descriptor.id]: generateCommandFieldsAction,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
111
134
|
};
|
|
@@ -53,6 +53,141 @@ const key = (name)=>scene_react.componentRegistryKey('Cratis.Components', name);
|
|
|
53
53
|
valueType: scene_model.PropertyValueType.Object,
|
|
54
54
|
editorKind: 'resultFieldList',
|
|
55
55
|
description: 'The result fields the table\'s search box looks in.'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
path: 'selectedItem',
|
|
59
|
+
label: 'Selected item',
|
|
60
|
+
group: 'Outputs',
|
|
61
|
+
valueType: scene_model.PropertyValueType.Object,
|
|
62
|
+
readOnly: true,
|
|
63
|
+
output: true,
|
|
64
|
+
bindingMode: scene_model.BindingMode.OneWay,
|
|
65
|
+
description: 'The currently selected row, or null after selection is cleared.'
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
const commandFormProperties = [
|
|
69
|
+
{
|
|
70
|
+
path: 'command',
|
|
71
|
+
label: 'Command',
|
|
72
|
+
group: 'Command',
|
|
73
|
+
valueType: scene_model.PropertyValueType.String,
|
|
74
|
+
editorKind: 'commandBinding',
|
|
75
|
+
constraints: {
|
|
76
|
+
required: true
|
|
77
|
+
},
|
|
78
|
+
description: 'The Arc command proxy rendered through the native command form runtime.'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
path: 'mode',
|
|
82
|
+
label: 'Mode',
|
|
83
|
+
group: 'Layout',
|
|
84
|
+
valueType: scene_model.PropertyValueType.Enum,
|
|
85
|
+
choices: [
|
|
86
|
+
{
|
|
87
|
+
value: 'auto',
|
|
88
|
+
label: 'Auto'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: 'manual',
|
|
92
|
+
label: 'Manual'
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
default: 'auto',
|
|
96
|
+
description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
path: 'columns',
|
|
100
|
+
label: 'Columns',
|
|
101
|
+
group: 'Layout',
|
|
102
|
+
valueType: scene_model.PropertyValueType.Number,
|
|
103
|
+
default: 1
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
path: 'fieldWidths',
|
|
107
|
+
label: 'Field widths',
|
|
108
|
+
group: 'Layout',
|
|
109
|
+
valueType: scene_model.PropertyValueType.Object,
|
|
110
|
+
editorKind: 'fieldWidths'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
path: 'inputs',
|
|
114
|
+
label: 'Fields',
|
|
115
|
+
group: 'Layout',
|
|
116
|
+
valueType: scene_model.PropertyValueType.Collection,
|
|
117
|
+
editorKind: 'commandFields',
|
|
118
|
+
acceptedBindingKinds: [
|
|
119
|
+
scene_model.BindingSourceKind.DataContext,
|
|
120
|
+
scene_model.BindingSourceKind.ComponentProperty
|
|
121
|
+
],
|
|
122
|
+
item: {
|
|
123
|
+
label: 'Field',
|
|
124
|
+
properties: [
|
|
125
|
+
{
|
|
126
|
+
path: 'property',
|
|
127
|
+
label: 'Property',
|
|
128
|
+
group: 'Field',
|
|
129
|
+
valueType: scene_model.PropertyValueType.String
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
path: 'type',
|
|
133
|
+
label: 'Type',
|
|
134
|
+
group: 'Field',
|
|
135
|
+
valueType: scene_model.PropertyValueType.Enum,
|
|
136
|
+
choices: [
|
|
137
|
+
{
|
|
138
|
+
value: 'string',
|
|
139
|
+
label: 'String'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: 'guid',
|
|
143
|
+
label: 'Guid'
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
path: 'label',
|
|
149
|
+
label: 'Label',
|
|
150
|
+
group: 'Field',
|
|
151
|
+
valueType: scene_model.PropertyValueType.String
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
path: 'column',
|
|
155
|
+
label: 'Column',
|
|
156
|
+
group: 'Layout',
|
|
157
|
+
valueType: scene_model.PropertyValueType.Number
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
path: 'width',
|
|
161
|
+
label: 'Width',
|
|
162
|
+
group: 'Layout',
|
|
163
|
+
valueType: scene_model.PropertyValueType.String
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
path: 'exclude',
|
|
170
|
+
label: 'Excluded fields',
|
|
171
|
+
group: 'Command',
|
|
172
|
+
valueType: scene_model.PropertyValueType.Collection,
|
|
173
|
+
item: {
|
|
174
|
+
label: 'Excluded field',
|
|
175
|
+
properties: [
|
|
176
|
+
{
|
|
177
|
+
path: 'property',
|
|
178
|
+
label: 'Property',
|
|
179
|
+
group: 'Field',
|
|
180
|
+
valueType: scene_model.PropertyValueType.String
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
path: 'submitLabel',
|
|
187
|
+
label: 'Submit label',
|
|
188
|
+
group: 'Content',
|
|
189
|
+
valueType: scene_model.PropertyValueType.String,
|
|
190
|
+
default: 'Submit'
|
|
56
191
|
}
|
|
57
192
|
];
|
|
58
193
|
/**
|
|
@@ -76,6 +211,21 @@ const key = (name)=>scene_react.componentRegistryKey('Cratis.Components', name);
|
|
|
76
211
|
component: key('observableDataTable'),
|
|
77
212
|
displayName: 'Live data table',
|
|
78
213
|
properties: dataTableProperties
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
component: key('commandForm'),
|
|
217
|
+
displayName: 'Command form',
|
|
218
|
+
editorKind: 'commandFormDesigner',
|
|
219
|
+
properties: commandFormProperties,
|
|
220
|
+
actions: [
|
|
221
|
+
{
|
|
222
|
+
id: 'Cratis.Components.commandForm.generateFields',
|
|
223
|
+
label: 'Generate fields',
|
|
224
|
+
placement: scene_model.DesignTimeActionPlacement.Toolbar,
|
|
225
|
+
availability: 'commandForm.canGenerateFields',
|
|
226
|
+
description: 'Creates a deterministic editable field layout from the selected command metadata.'
|
|
227
|
+
}
|
|
228
|
+
]
|
|
79
229
|
}
|
|
80
230
|
];
|
|
81
231
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsDescriptors.js","sources":["../../cratisComponentsDescriptors.ts"],"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 { ComponentDescriptor, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\n\n// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in\n// with it; the bundle's validation checks each key against the manifest.\nconst key = (name: string) => componentRegistryKey('Cratis.Components', name);\n\n/**\n * The properties every query-bound data table shares: which query feeds it, and the few settings that shape how\n * it shows the result.\n *\n * `query` is a `QueryReference`, so an editor binds it to a host-supplied query candidate and validates the\n * arguments against it. What is stored is a `QueryBinding`; a plain query name - what screens carried before\n * bindings existed - is still read, as a binding with no explicit connections. The columns are not properties:\n * they are the `content` slot's children, edited as nodes.\n */\nconst dataTableProperties: PropertyDescriptor[] = [\n {\n path: 'query', label: 'Query', group: 'Data', valueType: PropertyValueType.QueryReference, editorKind: 'queryBinding',\n description: 'The collection query that feeds the table.',\n constraints: { required: true, resultShapes: [QueryResultShape.Collection] },\n },\n { path: 'emptyMessage', label: 'Empty message', group: 'Content', valueType: PropertyValueType.String, default: '' },\n {\n path: 'dataKey', label: 'Row identity', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField',\n description: 'The result field that identifies a row.',\n },\n {\n path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',\n description: 'The result fields the table\\'s search box looks in.',\n },\n];\n\n/**\n * What can be edited on the `Cratis.Components` package's components.\n *\n * Only the query-bound tables are described so far; the form, dialog and editor composites carry\n * Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the\n * same way it adds a component to the manifest.\n */\nexport const cratisComponentsDescriptors: ComponentDescriptor[] = [\n { component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },\n { component: key('table'), displayName: 'Table', properties: dataTableProperties },\n { component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },\n];\n"],"names":["key","name","componentRegistryKey","dataTableProperties","path","label","group","valueType","PropertyValueType","QueryReference","editorKind","description","constraints","required","resultShapes","QueryResultShape","Collection","String","default","Object","cratisComponentsDescriptors","component","displayName","properties"],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,gCAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AAExE;;;;;;;;AAQC,IACD,MAAME,mBAAAA,GAA4C;AAC9C,IAAA;QACIC,IAAAA,EAAM,OAAA;QAASC,KAAAA,EAAO,OAAA;QAASC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,8BAAkBC,cAAc;QAAEC,UAAAA,EAAY,cAAA;QACvGC,WAAAA,EAAa,4CAAA;QACbC,WAAAA,EAAa;YAAEC,QAAAA,EAAU,IAAA;YAAMC,YAAAA,EAAc;AAACC,gBAAAA,4BAAAA,CAAiBC;AAAW;AAAC;AAC/E,KAAA;AACA,IAAA;QAAEZ,IAAAA,EAAM,cAAA;QAAgBC,KAAAA,EAAO,eAAA;QAAiBC,KAAAA,EAAO,SAAA;AAAWC,QAAAA,SAAAA,EAAWC,8BAAkBS,MAAM;QAAEC,OAAAA,EAAS;AAAG,KAAA;AACnH,IAAA;QACId,IAAAA,EAAM,SAAA;QAAWC,KAAAA,EAAO,cAAA;QAAgBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,8BAAkBS,MAAM;QAAEP,UAAAA,EAAY,aAAA;QACxGC,WAAAA,EAAa;AACjB,KAAA;AACA,IAAA;QACIP,IAAAA,EAAM,oBAAA;QAAsBC,KAAAA,EAAO,mBAAA;QAAqBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,8BAAkBW,MAAM;QAAET,UAAAA,EAAY,iBAAA;QACxHC,WAAAA,EAAa;AACjB;AACH,CAAA;AAED;;;;;;UAOaS,2BAAAA,GAAqD;AAC9D,IAAA;AAAEC,QAAAA,SAAAA,EAAWrB,GAAAA,CAAI,WAAA,CAAA;QAAcsB,WAAAA,EAAa,YAAA;QAAcC,UAAAA,EAAYpB;AAAoB,KAAA;AAC1F,IAAA;AAAEkB,QAAAA,SAAAA,EAAWrB,GAAAA,CAAI,OAAA,CAAA;QAAUsB,WAAAA,EAAa,OAAA;QAASC,UAAAA,EAAYpB;AAAoB,KAAA;AACjF,IAAA;AAAEkB,QAAAA,SAAAA,EAAWrB,GAAAA,CAAI,qBAAA,CAAA;QAAwBsB,WAAAA,EAAa,iBAAA;QAAmBC,UAAAA,EAAYpB;AAAoB;;;"}
|
|
1
|
+
{"version":3,"file":"cratisComponentsDescriptors.js","sources":["../../cratisComponentsDescriptors.ts"],"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 { BindingMode, BindingSourceKind, ComponentDescriptor, DesignTimeActionPlacement, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\n\n// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in\n// with it; the bundle's validation checks each key against the manifest.\nconst key = (name: string) => componentRegistryKey('Cratis.Components', name);\n\n/**\n * The properties every query-bound data table shares: which query feeds it, and the few settings that shape how\n * it shows the result.\n *\n * `query` is a `QueryReference`, so an editor binds it to a host-supplied query candidate and validates the\n * arguments against it. What is stored is a `QueryBinding`; a plain query name - what screens carried before\n * bindings existed - is still read, as a binding with no explicit connections. The columns are not properties:\n * they are the `content` slot's children, edited as nodes.\n */\nconst dataTableProperties: PropertyDescriptor[] = [\n {\n path: 'query', label: 'Query', group: 'Data', valueType: PropertyValueType.QueryReference, editorKind: 'queryBinding',\n description: 'The collection query that feeds the table.',\n constraints: { required: true, resultShapes: [QueryResultShape.Collection] },\n },\n { path: 'emptyMessage', label: 'Empty message', group: 'Content', valueType: PropertyValueType.String, default: '' },\n {\n path: 'dataKey', label: 'Row identity', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField',\n description: 'The result field that identifies a row.',\n },\n {\n path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',\n description: 'The result fields the table\\'s search box looks in.',\n },\n {\n path: 'selectedItem', label: 'Selected item', group: 'Outputs', valueType: PropertyValueType.Object, readOnly: true,\n output: true, bindingMode: BindingMode.OneWay,\n description: 'The currently selected row, or null after selection is cleared.',\n },\n];\n\nconst commandFormProperties: PropertyDescriptor[] = [\n {\n path: 'command', label: 'Command', group: 'Command', valueType: PropertyValueType.String, editorKind: 'commandBinding',\n constraints: { required: true },\n description: 'The Arc command proxy rendered through the native command form runtime.',\n },\n {\n path: 'mode', label: 'Mode', group: 'Layout', valueType: PropertyValueType.Enum,\n choices: [{ value: 'auto', label: 'Auto' }, { value: 'manual', label: 'Manual' }], default: 'auto',\n description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.',\n },\n { path: 'columns', label: 'Columns', group: 'Layout', valueType: PropertyValueType.Number, default: 1 },\n { path: 'fieldWidths', label: 'Field widths', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'fieldWidths' },\n {\n path: 'inputs', label: 'Fields', group: 'Layout', valueType: PropertyValueType.Collection, editorKind: 'commandFields',\n acceptedBindingKinds: [BindingSourceKind.DataContext, BindingSourceKind.ComponentProperty],\n item: {\n label: 'Field',\n properties: [\n { path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String },\n { path: 'type', label: 'Type', group: 'Field', valueType: PropertyValueType.Enum, choices: [{ value: 'string', label: 'String' }, { value: 'guid', label: 'Guid' }] },\n { path: 'label', label: 'Label', group: 'Field', valueType: PropertyValueType.String },\n { path: 'column', label: 'Column', group: 'Layout', valueType: PropertyValueType.Number },\n { path: 'width', label: 'Width', group: 'Layout', valueType: PropertyValueType.String },\n ],\n },\n },\n {\n path: 'exclude', label: 'Excluded fields', group: 'Command', valueType: PropertyValueType.Collection,\n item: { label: 'Excluded field', properties: [{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String }] },\n },\n { path: 'submitLabel', label: 'Submit label', group: 'Content', valueType: PropertyValueType.String, default: 'Submit' },\n];\n\n/**\n * What can be edited on the `Cratis.Components` package's components.\n *\n * Only the query-bound tables are described so far; the form, dialog and editor composites carry\n * Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the\n * same way it adds a component to the manifest.\n */\nexport const cratisComponentsDescriptors: ComponentDescriptor[] = [\n { component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },\n { component: key('table'), displayName: 'Table', properties: dataTableProperties },\n { component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },\n {\n component: key('commandForm'),\n displayName: 'Command form',\n editorKind: 'commandFormDesigner',\n properties: commandFormProperties,\n actions: [{\n id: 'Cratis.Components.commandForm.generateFields',\n label: 'Generate fields',\n placement: DesignTimeActionPlacement.Toolbar,\n availability: 'commandForm.canGenerateFields',\n description: 'Creates a deterministic editable field layout from the selected command metadata.',\n }],\n },\n];\n"],"names":["key","name","componentRegistryKey","dataTableProperties","path","label","group","valueType","PropertyValueType","QueryReference","editorKind","description","constraints","required","resultShapes","QueryResultShape","Collection","String","default","Object","readOnly","output","bindingMode","BindingMode","OneWay","commandFormProperties","Enum","choices","value","Number","acceptedBindingKinds","BindingSourceKind","DataContext","ComponentProperty","item","properties","cratisComponentsDescriptors","component","displayName","actions","id","placement","DesignTimeActionPlacement","Toolbar","availability"],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,gCAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AAExE;;;;;;;;AAQC,IACD,MAAME,mBAAAA,GAA4C;AAC9C,IAAA;QACIC,IAAAA,EAAM,OAAA;QAASC,KAAAA,EAAO,OAAA;QAASC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,8BAAkBC,cAAc;QAAEC,UAAAA,EAAY,cAAA;QACvGC,WAAAA,EAAa,4CAAA;QACbC,WAAAA,EAAa;YAAEC,QAAAA,EAAU,IAAA;YAAMC,YAAAA,EAAc;AAACC,gBAAAA,4BAAAA,CAAiBC;AAAW;AAAC;AAC/E,KAAA;AACA,IAAA;QAAEZ,IAAAA,EAAM,cAAA;QAAgBC,KAAAA,EAAO,eAAA;QAAiBC,KAAAA,EAAO,SAAA;AAAWC,QAAAA,SAAAA,EAAWC,8BAAkBS,MAAM;QAAEC,OAAAA,EAAS;AAAG,KAAA;AACnH,IAAA;QACId,IAAAA,EAAM,SAAA;QAAWC,KAAAA,EAAO,cAAA;QAAgBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,8BAAkBS,MAAM;QAAEP,UAAAA,EAAY,aAAA;QACxGC,WAAAA,EAAa;AACjB,KAAA;AACA,IAAA;QACIP,IAAAA,EAAM,oBAAA;QAAsBC,KAAAA,EAAO,mBAAA;QAAqBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,8BAAkBW,MAAM;QAAET,UAAAA,EAAY,iBAAA;QACxHC,WAAAA,EAAa;AACjB,KAAA;A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AAC,YAAA;gBACNC,EAAAA,EAAI,8CAAA;gBACJnC,KAAAA,EAAO,iBAAA;AACPoC,gBAAAA,SAAAA,EAAWC,sCAA0BC,OAAO;gBAC5CC,YAAAA,EAAc,+BAAA;gBACdjC,WAAAA,EAAa;AACjB;AAAE;AACN;;;"}
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
var scene_model = require('@cratis/scene.model');
|
|
4
4
|
var cratisComponents = require('./cratisComponents.js');
|
|
5
5
|
var cratisComponentsDescriptors = require('./cratisComponentsDescriptors.js');
|
|
6
|
+
var CommandFieldPropertyEditor = require('./forms/CommandFieldPropertyEditor.js');
|
|
7
|
+
var CommandFormDesigner = require('./forms/CommandFormDesigner.js');
|
|
8
|
+
var generateCommandFieldsAction = require('./forms/generateCommandFieldsAction.js');
|
|
6
9
|
|
|
7
10
|
// Copyright (c) Cratis. All rights reserved.
|
|
8
11
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -96,7 +99,31 @@ var cratisComponentsDescriptors = require('./cratisComponentsDescriptors.js');
|
|
|
96
99
|
description: "Cratis' Arc-bound data, form and dialog composites, built on PrimeReact and Tailwind. dataTable and table accept optional object-valued queryArguments for collection queries. singleResult displays one read-only scalar own resultField of an optional model using an explicit query, object queryArguments and enabled: true. queryInputForm commits explicit string inputs on submit to the same optional-single runtime; drafts never execute a query.",
|
|
97
100
|
module: '@cratis/scene.components',
|
|
98
101
|
license: 'MIT',
|
|
99
|
-
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE'
|
|
102
|
+
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',
|
|
103
|
+
designTime: {
|
|
104
|
+
previews: [],
|
|
105
|
+
designers: [
|
|
106
|
+
'commandFormDesigner'
|
|
107
|
+
],
|
|
108
|
+
propertyEditors: [
|
|
109
|
+
'commandBinding',
|
|
110
|
+
'commandFields',
|
|
111
|
+
'fieldWidths'
|
|
112
|
+
],
|
|
113
|
+
propertyDisplays: [],
|
|
114
|
+
actions: [
|
|
115
|
+
'Cratis.Components.commandForm.generateFields'
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
assets: [
|
|
119
|
+
'@cratis/components/styles',
|
|
120
|
+
'@cratis/components/tokens'
|
|
121
|
+
],
|
|
122
|
+
runtimeSingletons: [
|
|
123
|
+
'react',
|
|
124
|
+
'@cratis/arc',
|
|
125
|
+
'@cratis/components'
|
|
126
|
+
]
|
|
100
127
|
};
|
|
101
128
|
/**
|
|
102
129
|
* The `Cratis.Components` package as a loadable bundle - the manifest above, plus the React components
|
|
@@ -107,7 +134,18 @@ var cratisComponentsDescriptors = require('./cratisComponentsDescriptors.js');
|
|
|
107
134
|
*/ const cratisComponentsPackage = {
|
|
108
135
|
manifest: cratisComponentsPackageManifest,
|
|
109
136
|
components: cratisComponents.cratisComponents,
|
|
110
|
-
descriptors: cratisComponentsDescriptors.cratisComponentsDescriptors
|
|
137
|
+
descriptors: cratisComponentsDescriptors.cratisComponentsDescriptors,
|
|
138
|
+
designTime: {
|
|
139
|
+
designers: {
|
|
140
|
+
commandFormDesigner: CommandFormDesigner.CommandFormDesigner
|
|
141
|
+
},
|
|
142
|
+
propertyEditors: {
|
|
143
|
+
commandBinding: CommandFieldPropertyEditor.CommandFieldPropertyEditor
|
|
144
|
+
},
|
|
145
|
+
actions: {
|
|
146
|
+
[generateCommandFieldsAction.generateCommandFieldsAction.descriptor.id]: generateCommandFieldsAction.generateCommandFieldsAction
|
|
147
|
+
}
|
|
148
|
+
}
|
|
111
149
|
};
|
|
112
150
|
|
|
113
151
|
exports.cratisComponentsPackage = cratisComponentsPackage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsPackage.js","sources":["../../cratisComponentsPackage.ts"],"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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '@cratis/scene.react';\nimport { cratisComponents, cratisComponentsPackageName } from './cratisComponents';\nimport { cratisComponentsDescriptors } from './cratisComponentsDescriptors';\n\n/**\n * The `Cratis.Components` package's declaration - what a profile gets when it lists this package.\n *\n * This is the concrete case the whole package-dependency mechanism exists for. `@cratis/components` is\n * not a self-contained library: every component in it is a wrapper over a PrimeReact widget, and its own\n * styling is a `--cratis-*` token layer (`@cratis/components/tokens`) plus the component stylesheets and\n * compiled Tailwind utilities in `@cratis/components/styles`. Activate it in a profile without PrimeReact\n * and nothing renders; activate it without Tailwind and everything renders unstyled. Both are stated as\n * dependencies so a package picker can say so while the profile is being configured, instead of leaving\n * it to be discovered when the page opens.\n *\n * The version ranges are the real ones the library carries. `>=11.0.0` for PrimeReact: version 3.0.0\n * declares `primereact@^11` as a peer dependency and is built against version 11's component set, so the\n * span across the major boundary that the previous `>=10.9.0` range described is over. The `--cratis-*`\n * tokens still resolve a version 10 theme variable as their last fallback, but that is an upgrade-window\n * courtesy for an application with a compiled version 10 stylesheet still on the page - not a version of\n * PrimeReact this package can be activated against. `^4.0.0` for Tailwind, because the utility sheet is\n * compiled against Tailwind 4.\n */\nexport const cratisComponentsPackageManifest: ScenePackage = {\n name: cratisComponentsPackageName,\n version: '3.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [\n { name: 'PrimeReact', versionRange: '>=11.0.0' },\n { name: 'Tailwind', versionRange: '^4.0.0' },\n ],\n components: [\n 'page',\n 'dataPage',\n 'formElement',\n 'singleResult',\n 'queryInputForm',\n 'dataTable',\n 'table',\n 'observableDataTable',\n 'commandForm',\n 'inputTextField',\n 'numberField',\n 'checkboxField',\n 'textAreaField',\n 'dropdownField',\n 'sliderField',\n 'calendarField',\n 'colorPickerField',\n 'multiSelectField',\n 'chipsField',\n 'radioButtonField',\n 'radioGroupField',\n 'dialog',\n 'confirmationDialog',\n 'busyIndicatorDialog',\n 'commandDialog',\n 'stepperCommandDialog',\n 'icon',\n 'tooltip',\n 'dropdown',\n 'errorBoundary',\n 'objectContentEditor',\n 'objectNavigationalBar',\n 'schemaEditor',\n 'timeMachine',\n 'filterPanel',\n 'toolbar',\n 'toolbarButton',\n 'toolbarGroup',\n 'toolbarSeparator',\n ],\n\n // A component library ships components, and nothing else. Layouts, screen templates and dialog\n // templates all belong to a Blueprint: they are decisions about what an application looks like as a\n // whole, and this package deliberately makes none of them - it provides the Arc-bound composites a\n // template is *built from*, so that a blueprint can place a `dataPage` in a slot and configure it,\n // rather than shipping one opinionated data page nobody can rearrange.\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n\n // No themes either, for a different reason: `@cratis/components` has no palette of its own. It reads\n // a `--cratis-*` variable layer that resolves whatever is in front of it - the `--p-*` properties a\n // PrimeReact 11 preset emits at runtime, or a Scene theme through this package's token bridge.\n // Shipping a theme here would be this library asserting a look it was specifically built not to have.\n themes: [],\n\n displayName: 'Cratis Components',\n description: \"Cratis' Arc-bound data, form and dialog composites, built on PrimeReact and Tailwind. dataTable and table accept optional object-valued queryArguments for collection queries. singleResult displays one read-only scalar own resultField of an optional model using an explicit query, object queryArguments and enabled: true. queryInputForm commits explicit string inputs on submit to the same optional-single runtime; drafts never execute a query.\",\n module: '@cratis/scene.components',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `Cratis.Components` package as a loadable bundle - the manifest above, plus the React components\n * behind the names it declares.\n *\n * No `layouts`, `screenTemplates`, `dialogTemplates` or `themes` are provided, matching a manifest that\n * declares none of them; `validatePackageBundle` is what proves the two halves agree.\n */\nexport const cratisComponentsPackage: ScenePackageBundle = {\n manifest: cratisComponentsPackageManifest,\n components: cratisComponents,\n descriptors: cratisComponentsDescriptors,\n};\n"],"names":["cratisComponentsPackageManifest","name","cratisComponentsPackageName","version","kind","PackageKind","ComponentLibrary","dependencies","versionRange","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","cratisComponentsPackage","manifest","cratisComponents","descriptors","cratisComponentsDescriptors"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cratisComponentsPackage.js","sources":["../../cratisComponentsPackage.ts"],"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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '@cratis/scene.react';\nimport { cratisComponents, cratisComponentsPackageName } from './cratisComponents';\nimport { cratisComponentsDescriptors } from './cratisComponentsDescriptors';\nimport { CommandFieldPropertyEditor } from './forms/CommandFieldPropertyEditor';\nimport { CommandFormDesigner } from './forms/CommandFormDesigner';\nimport { generateCommandFieldsAction } from './forms/generateCommandFieldsAction';\n\n/**\n * The `Cratis.Components` package's declaration - what a profile gets when it lists this package.\n *\n * This is the concrete case the whole package-dependency mechanism exists for. `@cratis/components` is\n * not a self-contained library: every component in it is a wrapper over a PrimeReact widget, and its own\n * styling is a `--cratis-*` token layer (`@cratis/components/tokens`) plus the component stylesheets and\n * compiled Tailwind utilities in `@cratis/components/styles`. Activate it in a profile without PrimeReact\n * and nothing renders; activate it without Tailwind and everything renders unstyled. Both are stated as\n * dependencies so a package picker can say so while the profile is being configured, instead of leaving\n * it to be discovered when the page opens.\n *\n * The version ranges are the real ones the library carries. `>=11.0.0` for PrimeReact: version 3.0.0\n * declares `primereact@^11` as a peer dependency and is built against version 11's component set, so the\n * span across the major boundary that the previous `>=10.9.0` range described is over. The `--cratis-*`\n * tokens still resolve a version 10 theme variable as their last fallback, but that is an upgrade-window\n * courtesy for an application with a compiled version 10 stylesheet still on the page - not a version of\n * PrimeReact this package can be activated against. `^4.0.0` for Tailwind, because the utility sheet is\n * compiled against Tailwind 4.\n */\nexport const cratisComponentsPackageManifest: ScenePackage = {\n name: cratisComponentsPackageName,\n version: '3.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [\n { name: 'PrimeReact', versionRange: '>=11.0.0' },\n { name: 'Tailwind', versionRange: '^4.0.0' },\n ],\n components: [\n 'page',\n 'dataPage',\n 'formElement',\n 'singleResult',\n 'queryInputForm',\n 'dataTable',\n 'table',\n 'observableDataTable',\n 'commandForm',\n 'inputTextField',\n 'numberField',\n 'checkboxField',\n 'textAreaField',\n 'dropdownField',\n 'sliderField',\n 'calendarField',\n 'colorPickerField',\n 'multiSelectField',\n 'chipsField',\n 'radioButtonField',\n 'radioGroupField',\n 'dialog',\n 'confirmationDialog',\n 'busyIndicatorDialog',\n 'commandDialog',\n 'stepperCommandDialog',\n 'icon',\n 'tooltip',\n 'dropdown',\n 'errorBoundary',\n 'objectContentEditor',\n 'objectNavigationalBar',\n 'schemaEditor',\n 'timeMachine',\n 'filterPanel',\n 'toolbar',\n 'toolbarButton',\n 'toolbarGroup',\n 'toolbarSeparator',\n ],\n\n // A component library ships components, and nothing else. Layouts, screen templates and dialog\n // templates all belong to a Blueprint: they are decisions about what an application looks like as a\n // whole, and this package deliberately makes none of them - it provides the Arc-bound composites a\n // template is *built from*, so that a blueprint can place a `dataPage` in a slot and configure it,\n // rather than shipping one opinionated data page nobody can rearrange.\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n\n // No themes either, for a different reason: `@cratis/components` has no palette of its own. It reads\n // a `--cratis-*` variable layer that resolves whatever is in front of it - the `--p-*` properties a\n // PrimeReact 11 preset emits at runtime, or a Scene theme through this package's token bridge.\n // Shipping a theme here would be this library asserting a look it was specifically built not to have.\n themes: [],\n\n displayName: 'Cratis Components',\n description: \"Cratis' Arc-bound data, form and dialog composites, built on PrimeReact and Tailwind. dataTable and table accept optional object-valued queryArguments for collection queries. singleResult displays one read-only scalar own resultField of an optional model using an explicit query, object queryArguments and enabled: true. queryInputForm commits explicit string inputs on submit to the same optional-single runtime; drafts never execute a query.\",\n module: '@cratis/scene.components',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n designTime: {\n previews: [],\n designers: ['commandFormDesigner'],\n propertyEditors: ['commandBinding', 'commandFields', 'fieldWidths'],\n propertyDisplays: [],\n actions: ['Cratis.Components.commandForm.generateFields'],\n },\n assets: ['@cratis/components/styles', '@cratis/components/tokens'],\n runtimeSingletons: ['react', '@cratis/arc', '@cratis/components'],\n};\n\n/**\n * The `Cratis.Components` package as a loadable bundle - the manifest above, plus the React components\n * behind the names it declares.\n *\n * No `layouts`, `screenTemplates`, `dialogTemplates` or `themes` are provided, matching a manifest that\n * declares none of them; `validatePackageBundle` is what proves the two halves agree.\n */\nexport const cratisComponentsPackage: ScenePackageBundle = {\n manifest: cratisComponentsPackageManifest,\n components: cratisComponents,\n descriptors: cratisComponentsDescriptors,\n designTime: {\n designers: {\n commandFormDesigner: CommandFormDesigner,\n },\n propertyEditors: {\n commandBinding: CommandFieldPropertyEditor,\n },\n actions: {\n [generateCommandFieldsAction.descriptor.id]: generateCommandFieldsAction,\n },\n },\n};\n"],"names":["cratisComponentsPackageManifest","name","cratisComponentsPackageName","version","kind","PackageKind","ComponentLibrary","dependencies","versionRange","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","designTime","previews","designers","propertyEditors","propertyDisplays","actions","assets","runtimeSingletons","cratisComponentsPackage","manifest","cratisComponents","descriptors","cratisComponentsDescriptors","commandFormDesigner","CommandFormDesigner","commandBinding","CommandFieldPropertyEditor","generateCommandFieldsAction","descriptor","id"],"mappings":";;;;;;;;;AAAA;AACA;AAUA;;;;;;;;;;;;;;;;;;UAmBaA,+BAAAA,GAAgD;IACzDC,IAAAA,EAAMC,4CAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,wBAAYC,gBAAgB;IAClCC,YAAAA,EAAc;AACV,QAAA;YAAEN,IAAAA,EAAM,YAAA;YAAcO,YAAAA,EAAc;AAAW,SAAA;AAC/C,QAAA;YAAEP,IAAAA,EAAM,UAAA;YAAYO,YAAAA,EAAc;AAAS;AAC9C,KAAA;IACDC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,UAAA;AACA,QAAA,aAAA;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AA4B,KAAA;IAClEC,iBAAAA,EAAmB;AAAC,QAAA,OAAA;AAAS,QAAA,aAAA;AAAe,QAAA;AAAqB;AACrE;AAEA;;;;;;UAOaC,uBAAAA,GAA8C;IACvDC,QAAAA,EAAU5B,+BAAAA;IACVS,UAAAA,EAAYoB,iCAAAA;IACZC,WAAAA,EAAaC,uDAAAA;IACbZ,UAAAA,EAAY;QACRE,SAAAA,EAAW;YACPW,mBAAAA,EAAqBC;AACzB,SAAA;QACAX,eAAAA,EAAiB;YACbY,cAAAA,EAAgBC;AACpB,SAAA;QACAX,OAAAA,EAAS;AACL,YAAA,CAACY,uDAAAA,CAA4BC,UAAU,CAACC,EAAE,GAAGF;AACjD;AACJ;AACJ;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var scene_model = require('@cratis/scene.model');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Package-side editor for a command form property. It writes through the generic Scene edit boundary.
|
|
8
|
+
*/ function CommandFieldPropertyEditor({ context, property, value, setValue }) {
|
|
9
|
+
return /*#__PURE__*/ jsxRuntime.jsx("input", {
|
|
10
|
+
"aria-label": property.label,
|
|
11
|
+
value: typeof value === 'string' ? value : '',
|
|
12
|
+
onChange: (event)=>{
|
|
13
|
+
const next = event.currentTarget.value;
|
|
14
|
+
setValue(next);
|
|
15
|
+
context.submitEdits([
|
|
16
|
+
{
|
|
17
|
+
kind: scene_model.SceneEditKind.SetProperty,
|
|
18
|
+
nodeId: context.element.id,
|
|
19
|
+
path: property.path,
|
|
20
|
+
value: next
|
|
21
|
+
}
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.CommandFieldPropertyEditor = CommandFieldPropertyEditor;
|
|
28
|
+
//# sourceMappingURL=CommandFieldPropertyEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandFieldPropertyEditor.js","sources":["../../../forms/CommandFieldPropertyEditor.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 { SceneEditKind } from '@cratis/scene.model';\nimport { DesignTimePropertyEditorProps } from '@cratis/scene.react';\n\n/**\n * Package-side editor for a command form property. It writes through the generic Scene edit boundary.\n */\nexport function CommandFieldPropertyEditor({ context, property, value, setValue }: DesignTimePropertyEditorProps) {\n return <input aria-label={property.label} value={typeof value === 'string' ? value : ''} onChange={event => {\n const next = event.currentTarget.value;\n setValue(next);\n context.submitEdits([{ kind: SceneEditKind.SetProperty, nodeId: context.element.id, path: property.path, value: next }]);\n }} />;\n}\n"],"names":["CommandFieldPropertyEditor","context","property","value","setValue","_jsx","input","aria-label","label","onChange","event","next","currentTarget","submitEdits","kind","SceneEditKind","SetProperty","nodeId","element","id","path"],"mappings":";;;;;AAMA;;IAGO,SAASA,0BAAAA,CAA2B,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,QAAQ,EAAiC,EAAA;AAC5G,IAAA,qBAAOC,cAAA,CAACC,OAAAA,EAAAA;AAAMC,QAAAA,YAAAA,EAAYL,SAASM,KAAK;QAAEL,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQ,EAAA;AAAIM,QAAAA,QAAAA,EAAUC,CAAAA,KAAAA,GAAAA;AAC/F,YAAA,MAAMC,IAAAA,GAAOD,KAAAA,CAAME,aAAa,CAACT,KAAK;YACtCC,QAAAA,CAASO,IAAAA,CAAAA;AACTV,YAAAA,OAAAA,CAAQY,WAAW,CAAC;AAAC,gBAAA;AAAEC,oBAAAA,IAAAA,EAAMC,0BAAcC,WAAW;oBAAEC,MAAAA,EAAQhB,OAAAA,CAAQiB,OAAO,CAACC,EAAE;AAAEC,oBAAAA,IAAAA,EAAMlB,SAASkB,IAAI;oBAAEjB,KAAAA,EAAOQ;AAAK;AAAE,aAAA,CAAA;AAC3H,QAAA;;AACJ;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
6
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
7
|
+
/**
|
|
8
|
+
* Generic package-side command form designer. It reads only the shared design-time context and submits Scene edits.
|
|
9
|
+
*/ function CommandFormDesigner({ context }) {
|
|
10
|
+
const canGenerate = context.capabilities['commandForm.generateFields'] === true && context.permissions.edit !== false;
|
|
11
|
+
return /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
disabled: !canGenerate,
|
|
14
|
+
onClick: ()=>context.submitAction('Cratis.Components.commandForm.generateFields', []),
|
|
15
|
+
children: "Generate fields"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.CommandFormDesigner = CommandFormDesigner;
|
|
20
|
+
//# sourceMappingURL=CommandFormDesigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandFormDesigner.js","sources":["../../../forms/CommandFormDesigner.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 { DesignTimeComponentProps } from '@cratis/scene.react';\n\n/**\n * Generic package-side command form designer. It reads only the shared design-time context and submits Scene edits.\n */\nexport function CommandFormDesigner({ context }: DesignTimeComponentProps) {\n const canGenerate = context.capabilities['commandForm.generateFields'] === true && context.permissions.edit !== false;\n return <button type='button' disabled={!canGenerate} onClick={() => context.submitAction('Cratis.Components.commandForm.generateFields', [])}>\n Generate fields\n </button>;\n}\n"],"names":["CommandFormDesigner","context","canGenerate","capabilities","permissions","edit","_jsx","button","type","disabled","onClick","submitAction"],"mappings":";;;;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAA4B,EAAA;IACrE,MAAMC,WAAAA,GAAcD,OAAAA,CAAQE,YAAY,CAAC,4BAAA,CAA6B,KAAK,IAAA,IAAQF,OAAAA,CAAQG,WAAW,CAACC,IAAI,KAAK,KAAA;AAChH,IAAA,qBAAOC,cAAA,CAACC,QAAAA,EAAAA;QAAOC,IAAAA,EAAK,QAAA;AAASC,QAAAA,QAAAA,EAAU,CAACP,WAAAA;AAAaQ,QAAAA,OAAAA,EAAS,IAAMT,OAAAA,CAAQU,YAAY,CAAC,gDAAgD,EAAE,CAAA;AAAG,QAAA,QAAA,EAAA;;AAGlJ;;"}
|
|
@@ -49,7 +49,7 @@ const NativeAutoCommandForm = CommandForm.AutoCommandForm;
|
|
|
49
49
|
}
|
|
50
50
|
return undefined;
|
|
51
51
|
}
|
|
52
|
-
/** Private lazy entry point: importing the Scene registry must not import Arc. */ function CommandFormRuntime({ command, inputs, exclude, submitLabel }) {
|
|
52
|
+
/** Private lazy entry point: importing the Scene registry must not import Arc. */ function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns = 1 }) {
|
|
53
53
|
const error = capability(command, inputs, exclude);
|
|
54
54
|
if (error) return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
55
55
|
role: "alert",
|
|
@@ -60,9 +60,16 @@ const NativeAutoCommandForm = CommandForm.AutoCommandForm;
|
|
|
60
60
|
command: command,
|
|
61
61
|
showTitles: false,
|
|
62
62
|
children: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
64
|
+
style: {
|
|
65
|
+
display: 'grid',
|
|
66
|
+
gridTemplateColumns: `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`,
|
|
67
|
+
gap: '1rem'
|
|
68
|
+
},
|
|
69
|
+
children: inputs.map((input)=>/*#__PURE__*/ jsxRuntime.jsx(ExplicitCommandField.ExplicitCommandField, {
|
|
70
|
+
input: input
|
|
71
|
+
}, input.property))
|
|
72
|
+
}),
|
|
66
73
|
/*#__PURE__*/ jsxRuntime.jsx(CommandFormSubmit.CommandFormSubmit, {
|
|
67
74
|
label: submitLabel
|
|
68
75
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandFormRuntime.js","sources":["../../../forms/CommandFormRuntime.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 { ComponentType, ReactNode } from 'react';\nimport { AutoCommandForm } from '@cratis/components/CommandForm';\nimport { CommandForm } from '@cratis/arc.react/commands';\nimport { Guid } from '@cratis/fundamentals';\nimport type { BoundConstructor } from '../bindings';\nimport type { CommandInput } from './commandInputs';\nimport { CommandFormSubmit } from './CommandFormSubmit';\nimport { ExplicitCommandField } from './ExplicitCommandField';\n\ninterface CommandFormRuntimeProps {\n command: BoundConstructor;\n inputs?: CommandInput[];\n exclude?: string[];\n submitLabel: string;\n}\n\n// Runtime bindings erase the proxy's keys; the optional footer is a Components >=4.13 contract.\nconst NativeAutoCommandForm = AutoCommandForm as unknown as ComponentType<{\n command: BoundConstructor;\n exclude?: string[];\n footer?: ReactNode;\n}>;\n\ntype Descriptor = { name: string; type: unknown; isOptional: boolean };\n\n/** Verify the whole command before mounting any native form: partial forms must never execute. */\nfunction capability(command: BoundConstructor, inputs?: CommandInput[], exclude?: string[]): string | undefined {\n let descriptors: unknown;\n try { descriptors = (new command() as { propertyDescriptors?: unknown }).propertyDescriptors; }\n catch { return 'Unable to inspect command proxy'; }\n if (!Array.isArray(descriptors)) return 'Command proxy has no property descriptors';\n const byName = new Map<string, Descriptor>();\n for (const descriptor of descriptors) {\n if (!descriptor || typeof descriptor.name !== 'string' || !descriptor.name ||\n typeof descriptor.isOptional !== 'boolean' || byName.has(descriptor.name)) return 'Ambiguous or invalid command property descriptors';\n byName.set(descriptor.name, descriptor);\n }\n if (inputs) {\n for (const input of inputs) {\n const descriptor = byName.get(input.property);\n if (!descriptor) return `Unknown command property '${input.property}'`;\n if (descriptor.type !== (input.type === 'guid' ? Guid : String)) return `Command property '${input.property}' type does not match '${input.type}'`;\n }\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && !inputs.some(input => input.property === descriptor.name)) return `Required command property '${descriptor.name}' has no input`;\n }\n } else {\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && (exclude?.includes(descriptor.name) ||\n ![String, Number, Boolean, Date].includes(descriptor.type as typeof String))) {\n return `Required command property '${descriptor.name}' has no supported automatic field; declare inputs`;\n }\n }\n }\n return undefined;\n}\n\n/** Private lazy entry point: importing the Scene registry must not import Arc. */\nexport default function CommandFormRuntime({ command, inputs, exclude, submitLabel }: CommandFormRuntimeProps) {\n const error = capability(command, inputs, exclude);\n if (error) return <div role='alert'>{error}</div>;\n // The registry's never-argument constructor is erased; Arc creates this checked proxy with no args.\n if (inputs) return <CommandForm command={command as unknown as new () => object} showTitles={false}>\n {inputs.map(input => <ExplicitCommandField key={input.property} input={input} />)}\n <CommandFormSubmit label={submitLabel} />\n </CommandForm>;\n return <NativeAutoCommandForm command={command} exclude={exclude} footer={<CommandFormSubmit label={submitLabel} />} />;\n}\n"],"names":["NativeAutoCommandForm","AutoCommandForm","capability","command","inputs","exclude","descriptors","propertyDescriptors","Array","isArray","byName","Map","descriptor","name","isOptional","has","set","input","get","property","type","Guid","String","values","some","includes","Number","Boolean","Date","undefined","CommandFormRuntime","submitLabel","error","_jsx","div","role","_jsxs","CommandForm","showTitles","map","ExplicitCommandField","CommandFormSubmit","label","footer"],"mappings":";;;;;;;;;;;AAAA;AACA;
|
|
1
|
+
{"version":3,"file":"CommandFormRuntime.js","sources":["../../../forms/CommandFormRuntime.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 { ComponentType, ReactNode } from 'react';\nimport { AutoCommandForm } from '@cratis/components/CommandForm';\nimport { CommandForm } from '@cratis/arc.react/commands';\nimport { Guid } from '@cratis/fundamentals';\nimport type { BoundConstructor } from '../bindings';\nimport type { CommandInput } from './commandInputs';\nimport { CommandFormSubmit } from './CommandFormSubmit';\nimport { ExplicitCommandField } from './ExplicitCommandField';\n\ninterface CommandFormRuntimeProps {\n command: BoundConstructor;\n inputs?: CommandInput[];\n exclude?: string[];\n submitLabel: string;\n columns?: number;\n}\n\n// Runtime bindings erase the proxy's keys; the optional footer is a Components >=4.13 contract.\nconst NativeAutoCommandForm = AutoCommandForm as unknown as ComponentType<{\n command: BoundConstructor;\n exclude?: string[];\n footer?: ReactNode;\n}>;\n\ntype Descriptor = { name: string; type: unknown; isOptional: boolean };\n\n/** Verify the whole command before mounting any native form: partial forms must never execute. */\nfunction capability(command: BoundConstructor, inputs?: CommandInput[], exclude?: string[]): string | undefined {\n let descriptors: unknown;\n try { descriptors = (new command() as { propertyDescriptors?: unknown }).propertyDescriptors; }\n catch { return 'Unable to inspect command proxy'; }\n if (!Array.isArray(descriptors)) return 'Command proxy has no property descriptors';\n const byName = new Map<string, Descriptor>();\n for (const descriptor of descriptors) {\n if (!descriptor || typeof descriptor.name !== 'string' || !descriptor.name ||\n typeof descriptor.isOptional !== 'boolean' || byName.has(descriptor.name)) return 'Ambiguous or invalid command property descriptors';\n byName.set(descriptor.name, descriptor);\n }\n if (inputs) {\n for (const input of inputs) {\n const descriptor = byName.get(input.property);\n if (!descriptor) return `Unknown command property '${input.property}'`;\n if (descriptor.type !== (input.type === 'guid' ? Guid : String)) return `Command property '${input.property}' type does not match '${input.type}'`;\n }\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && !inputs.some(input => input.property === descriptor.name)) return `Required command property '${descriptor.name}' has no input`;\n }\n } else {\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && (exclude?.includes(descriptor.name) ||\n ![String, Number, Boolean, Date].includes(descriptor.type as typeof String))) {\n return `Required command property '${descriptor.name}' has no supported automatic field; declare inputs`;\n }\n }\n }\n return undefined;\n}\n\n/** Private lazy entry point: importing the Scene registry must not import Arc. */\nexport default function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns = 1 }: CommandFormRuntimeProps) {\n const error = capability(command, inputs, exclude);\n if (error) return <div role='alert'>{error}</div>;\n // The registry's never-argument constructor is erased; Arc creates this checked proxy with no args.\n if (inputs) return <CommandForm command={command as unknown as new () => object} showTitles={false}>\n <div style={{ display: 'grid', gridTemplateColumns: `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`, gap: '1rem' }}>\n {inputs.map(input => <ExplicitCommandField key={input.property} input={input} />)}\n </div>\n <CommandFormSubmit label={submitLabel} />\n </CommandForm>;\n return <NativeAutoCommandForm command={command} exclude={exclude} footer={<CommandFormSubmit label={submitLabel} />} />;\n}\n"],"names":["NativeAutoCommandForm","AutoCommandForm","capability","command","inputs","exclude","descriptors","propertyDescriptors","Array","isArray","byName","Map","descriptor","name","isOptional","has","set","input","get","property","type","Guid","String","values","some","includes","Number","Boolean","Date","undefined","CommandFormRuntime","submitLabel","columns","error","_jsx","div","role","_jsxs","CommandForm","showTitles","style","display","gridTemplateColumns","Math","max","gap","map","ExplicitCommandField","CommandFormSubmit","label","footer"],"mappings":";;;;;;;;;;;AAAA;AACA;AAmBA;AACA,MAAMA,qBAAAA,GAAwBC,2BAAAA;AAQ9B,mGACA,SAASC,UAAAA,CAAWC,OAAyB,EAAEC,MAAuB,EAAEC,OAAkB,EAAA;IACtF,IAAIC,WAAAA;IACJ,IAAI;QAAEA,WAAAA,GAAe,IAAIH,OAAAA,EAAAA,CAAgDI,mBAAmB;AAAE,IAAA,CAAA,CAC9F,OAAM;QAAE,OAAO,iCAAA;AAAmC,IAAA;AAClD,IAAA,IAAI,CAACC,KAAAA,CAAMC,OAAO,CAACH,cAAc,OAAO,2CAAA;AACxC,IAAA,MAAMI,SAAS,IAAIC,GAAAA,EAAAA;IACnB,KAAK,MAAMC,cAAcN,WAAAA,CAAa;QAClC,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,CAAA;;0BAElEe,cAAA,CAACc,mCAAAA,EAAAA;gBAAkBC,KAAAA,EAAOlB;;;;AAE9B,IAAA,qBAAOG,cAAA,CAAClC,qBAAAA,EAAAA;QAAsBG,OAAAA,EAASA,OAAAA;QAASE,OAAAA,EAASA,OAAAA;AAAS6C,QAAAA,MAAAA,gBAAQhB,cAAA,CAACc,mCAAAA,EAAAA;YAAkBC,KAAAA,EAAOlB;;;AACxG;;"}
|
|
@@ -95,13 +95,19 @@ const NativeTextField = commands.asCommandFormField(TextControl, {
|
|
|
95
95
|
defaultValue: ''
|
|
96
96
|
});
|
|
97
97
|
/** Opaque child is self-bound by Arc's native runtime binding, with an exact fieldName. */ function ExplicitCommandField({ input }) {
|
|
98
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
99
|
+
style: {
|
|
100
|
+
gridColumn: input.column === undefined ? undefined : `${input.column}`,
|
|
101
|
+
width: input.width
|
|
102
|
+
},
|
|
103
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(NativeTextField, {
|
|
104
|
+
fieldName: input.property,
|
|
105
|
+
value: (command)=>command[input.property],
|
|
106
|
+
property: input.property,
|
|
107
|
+
guid: input.type === 'guid',
|
|
108
|
+
label: input.label,
|
|
109
|
+
title: input.label
|
|
110
|
+
})
|
|
105
111
|
});
|
|
106
112
|
}
|
|
107
113
|
|