@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplicitCommandField.js","sources":["../../../forms/ExplicitCommandField.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 { useId, useLayoutEffect, useRef, useState } from 'react';\nimport { asCommandFormField, useCommandFormContext } from '@cratis/arc.react/commands';\nimport { Guid } from '@cratis/fundamentals';\nimport type { CommandInput } from './commandInputs';\n\ninterface TextProps {\n value: unknown;\n onChange: (value: unknown) => void;\n onBlur?: () => void;\n invalid: boolean;\n required: boolean;\n errors: string[];\n label: string;\n property: string;\n guid: boolean;\n}\n\nfunction TextControl({ value, onChange, onBlur, invalid, required, errors, label, property, guid }: TextProps) {\n const id = useId();\n const context = useCommandFormContext();\n const { setCustomFieldError } = context;\n // Keep the latest native getter: the context snapshot can be stale when another field sets an\n // error and this field unmounts in the same event.\n const contextRef = useRef(context);\n contextRef.current = context;\n // The draft is intentionally independent of the typed proxy value: malformed text must never\n // reappear as a stale previously valid Guid in the command's serialized payload.\n const [draft, setDraft] = useState(() => value instanceof Guid && !value.equals(Guid.empty) ? value.toString() : '');\n const draftRef = useRef(draft);\n const ownedError = useRef<string | undefined>(undefined);\n const updateError = (error: string | undefined) => {\n const current = contextRef.current.getFieldError(property);\n // Do not replace or erase another producer's error for this field.\n if (ownedError.current !== undefined && current !== ownedError.current) {\n ownedError.current = undefined;\n return;\n }\n if (ownedError.current === undefined && Object.hasOwn(contextRef.current.customFieldErrors, property)) return;\n if (error === undefined && ownedError.current === undefined) return;\n ownedError.current = error;\n setCustomFieldError(property, error);\n };\n // A label/required change must recalculate the message without disposing the field's error.\n // Only a different field/type or an actual unmount relinquishes ownership.\n useLayoutEffect(() => () => {\n if (ownedError.current !== undefined && contextRef.current.getFieldError(property) === ownedError.current) {\n contextRef.current.setCustomFieldError(property, undefined);\n }\n ownedError.current = undefined;\n }, [property, guid]);\n useLayoutEffect(() => {\n if (guid) {\n const current = draftRef.current || (value instanceof Guid && !value.equals(Guid.empty) ? value.toString() : '');\n updateError(!current ? required ? `${label} is required` : undefined :\n !Guid.isGuid(current) ? `${label} must be a valid GUID` : undefined);\n }\n }, [guid, required, property, label, setCustomFieldError]);\n const text = guid ? draft : typeof value === 'string' ? value : '';\n return <div>\n <label htmlFor={id}>{label}</label>\n <input id={id} name={property} type='text' required={required} value={text}\n aria-invalid={invalid} aria-describedby={errors.length ? `${id}-error` : undefined}\n onBlur={onBlur} onChange={event => {\n const next = event.currentTarget.value;\n if (!guid) { onChange(next); return; }\n draftRef.current = next;\n setDraft(next);\n const error = !next ? required ? `${label} is required` : undefined : !Guid.isGuid(next) ? `${label} must be a valid GUID` : undefined;\n // A malformed draft clears the previously typed value, not just its display.\n onChange(error || !next ? undefined : Guid.parse(next));\n updateError(error);\n }} />\n {errors.length > 0 && <div id={`${id}-error`} role='alert'>{errors[0]}</div>}\n </div>;\n}\n\nconst NativeTextField = asCommandFormField<TextProps>(TextControl, { defaultValue: '' });\n\n/** Opaque child is self-bound by Arc's native runtime binding, with an exact fieldName. */\nexport function ExplicitCommandField({ input }: { input: CommandInput }) {\n return <NativeTextField fieldName={input.property} value={(command: Record<string, unknown>) => command[input.property]}\n
|
|
1
|
+
{"version":3,"file":"ExplicitCommandField.js","sources":["../../../forms/ExplicitCommandField.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 { useId, useLayoutEffect, useRef, useState } from 'react';\nimport { asCommandFormField, useCommandFormContext } from '@cratis/arc.react/commands';\nimport { Guid } from '@cratis/fundamentals';\nimport type { CommandInput } from './commandInputs';\n\ninterface TextProps {\n value: unknown;\n onChange: (value: unknown) => void;\n onBlur?: () => void;\n invalid: boolean;\n required: boolean;\n errors: string[];\n label: string;\n property: string;\n guid: boolean;\n}\n\nfunction TextControl({ value, onChange, onBlur, invalid, required, errors, label, property, guid }: TextProps) {\n const id = useId();\n const context = useCommandFormContext();\n const { setCustomFieldError } = context;\n // Keep the latest native getter: the context snapshot can be stale when another field sets an\n // error and this field unmounts in the same event.\n const contextRef = useRef(context);\n contextRef.current = context;\n // The draft is intentionally independent of the typed proxy value: malformed text must never\n // reappear as a stale previously valid Guid in the command's serialized payload.\n const [draft, setDraft] = useState(() => value instanceof Guid && !value.equals(Guid.empty) ? value.toString() : '');\n const draftRef = useRef(draft);\n const ownedError = useRef<string | undefined>(undefined);\n const updateError = (error: string | undefined) => {\n const current = contextRef.current.getFieldError(property);\n // Do not replace or erase another producer's error for this field.\n if (ownedError.current !== undefined && current !== ownedError.current) {\n ownedError.current = undefined;\n return;\n }\n if (ownedError.current === undefined && Object.hasOwn(contextRef.current.customFieldErrors, property)) return;\n if (error === undefined && ownedError.current === undefined) return;\n ownedError.current = error;\n setCustomFieldError(property, error);\n };\n // A label/required change must recalculate the message without disposing the field's error.\n // Only a different field/type or an actual unmount relinquishes ownership.\n useLayoutEffect(() => () => {\n if (ownedError.current !== undefined && contextRef.current.getFieldError(property) === ownedError.current) {\n contextRef.current.setCustomFieldError(property, undefined);\n }\n ownedError.current = undefined;\n }, [property, guid]);\n useLayoutEffect(() => {\n if (guid) {\n const current = draftRef.current || (value instanceof Guid && !value.equals(Guid.empty) ? value.toString() : '');\n updateError(!current ? required ? `${label} is required` : undefined :\n !Guid.isGuid(current) ? `${label} must be a valid GUID` : undefined);\n }\n }, [guid, required, property, label, setCustomFieldError]);\n const text = guid ? draft : typeof value === 'string' ? value : '';\n return <div>\n <label htmlFor={id}>{label}</label>\n <input id={id} name={property} type='text' required={required} value={text}\n aria-invalid={invalid} aria-describedby={errors.length ? `${id}-error` : undefined}\n onBlur={onBlur} onChange={event => {\n const next = event.currentTarget.value;\n if (!guid) { onChange(next); return; }\n draftRef.current = next;\n setDraft(next);\n const error = !next ? required ? `${label} is required` : undefined : !Guid.isGuid(next) ? `${label} must be a valid GUID` : undefined;\n // A malformed draft clears the previously typed value, not just its display.\n onChange(error || !next ? undefined : Guid.parse(next));\n updateError(error);\n }} />\n {errors.length > 0 && <div id={`${id}-error`} role='alert'>{errors[0]}</div>}\n </div>;\n}\n\nconst NativeTextField = asCommandFormField<TextProps>(TextControl, { defaultValue: '' });\n\n/** Opaque child is self-bound by Arc's native runtime binding, with an exact fieldName. */\nexport function ExplicitCommandField({ input }: { input: CommandInput }) {\n return <div style={{ gridColumn: input.column === undefined ? undefined : `${input.column}`, width: input.width }}>\n <NativeTextField fieldName={input.property} value={(command: Record<string, unknown>) => command[input.property]}\n property={input.property} guid={input.type === 'guid'} label={input.label} title={input.label} />\n </div>;\n}\n"],"names":["TextControl","value","onChange","onBlur","invalid","required","errors","label","property","guid","id","useId","context","useCommandFormContext","setCustomFieldError","contextRef","useRef","current","draft","setDraft","useState","Guid","equals","empty","toString","draftRef","ownedError","undefined","updateError","error","getFieldError","Object","hasOwn","customFieldErrors","useLayoutEffect","isGuid","text","_jsxs","div","_jsx","htmlFor","input","name","type","aria-invalid","aria-describedby","length","event","next","currentTarget","parse","role","NativeTextField","asCommandFormField","defaultValue","ExplicitCommandField","style","gridColumn","column","width","fieldName","command","title"],"mappings":";;;;;;;AAoBA,SAASA,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,IAAI,EAAa,EAAA;AACzG,IAAA,MAAMC,EAAAA,GAAKC,WAAAA,EAAAA;AACX,IAAA,MAAMC,OAAAA,GAAUC,8BAAAA,EAAAA;IAChB,MAAM,EAAEC,mBAAmB,EAAE,GAAGF,OAAAA;;;AAGhC,IAAA,MAAMG,aAAaC,YAAAA,CAAOJ,OAAAA,CAAAA;AAC1BG,IAAAA,UAAAA,CAAWE,OAAO,GAAGL,OAAAA;;;AAGrB,IAAA,MAAM,CAACM,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,cAAAA,CAAS,IAAMnB,KAAAA,YAAiBoB,iBAAAA,IAAQ,CAACpB,KAAAA,CAAMqB,MAAM,CAACD,iBAAAA,CAAKE,KAAK,CAAA,GAAItB,KAAAA,CAAMuB,QAAQ,EAAA,GAAK,EAAA,CAAA;AACjH,IAAA,MAAMC,WAAWT,YAAAA,CAAOE,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YAAAA,KAAAA,EAAOlB,MAAMkB;AAAM,SAAA;AAC5G,QAAA,QAAA,gBAAApB,cAAA,CAACa,eAAAA,EAAAA;AAAgBQ,YAAAA,SAAAA,EAAWnB,MAAMjC,QAAQ;AAAEP,YAAAA,KAAAA,EAAO,CAAC4D,OAAAA,GAAqCA,OAAO,CAACpB,KAAAA,CAAMjC,QAAQ,CAAC;AAC5GA,YAAAA,QAAAA,EAAUiC,MAAMjC,QAAQ;YAAEC,IAAAA,EAAMgC,KAAAA,CAAME,IAAI,KAAK,MAAA;AAAQpC,YAAAA,KAAAA,EAAOkC,MAAMlC,KAAK;AAAEuD,YAAAA,KAAAA,EAAOrB,MAAMlC;;;AAEpG;;"}
|
|
@@ -32,8 +32,12 @@ function commandKey(command) {
|
|
|
32
32
|
kind: BindingKind.BindingKind.Command,
|
|
33
33
|
name: name
|
|
34
34
|
});
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const mode = properties.unionProperty(element.properties, 'mode', [
|
|
36
|
+
'auto',
|
|
37
|
+
'manual'
|
|
38
|
+
]) ?? (Object.hasOwn(element.properties, 'inputs') ? 'manual' : 'auto');
|
|
39
|
+
const inputs = mode === 'manual' ? commandInputs.commandInputs(element.properties) : undefined;
|
|
40
|
+
if (mode === 'manual' && !inputs) return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
37
41
|
role: "alert",
|
|
38
42
|
children: "Invalid command form inputs declaration"
|
|
39
43
|
});
|
|
@@ -42,7 +46,10 @@ function commandKey(command) {
|
|
|
42
46
|
command: target,
|
|
43
47
|
inputs: inputs,
|
|
44
48
|
exclude: properties.stringArrayProperty(element.properties, 'exclude'),
|
|
45
|
-
submitLabel: properties.stringProperty(element.properties, 'submitLabel') ?? 'Submit'
|
|
49
|
+
submitLabel: properties.stringProperty(element.properties, 'submitLabel') ?? 'Submit',
|
|
50
|
+
...properties.numberProperty(element.properties, 'columns') === undefined ? {} : {
|
|
51
|
+
columns: properties.numberProperty(element.properties, 'columns')
|
|
52
|
+
}
|
|
46
53
|
}, commandKey(target))
|
|
47
54
|
});
|
|
48
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneCommandForm.js","sources":["../../../forms/SceneCommandForm.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 { lazy } from 'react';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { ArcRuntimeBoundary, BindingKind, MissingBinding, resolveElementBinding } from '../bindings';\nimport type { BoundConstructor } from '../bindings';\nimport { stringArrayProperty, stringProperty } from '../properties';\nimport { commandInputs } from './commandInputs';\n\nconst CommandFormRuntime = lazy(() => import('./CommandFormRuntime'));\n\n// Arc's useCommand constructs the proxy only on mount. Key by the actual registered class,\n// not its Scene name (which may be re-registered with a different route or roles).\nconst commandKeys = new WeakMap<BoundConstructor, number>();\nlet nextCommandKey = 0;\nfunction commandKey(command: BoundConstructor): number {\n let key = commandKeys.get(command);\n if (key === undefined) {\n key = ++nextCommandKey;\n commandKeys.set(command, key);\n }\n return key;\n}\n\n/**\n * Auto mode follows supported native proxy descriptors; opt-in inputs bind exactly named fields\n * inside a single native Arc form. Neither mode consumes the content slot.\n */\nexport function SceneCommandForm({ element }: RegisteredComponentProps) {\n const { name, target } = resolveElementBinding(element, BindingKind.Command);\n if (!target) return <MissingBinding element={element} kind={BindingKind.Command} name={name} />;\n\n const
|
|
1
|
+
{"version":3,"file":"SceneCommandForm.js","sources":["../../../forms/SceneCommandForm.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 { lazy } from 'react';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { ArcRuntimeBoundary, BindingKind, MissingBinding, resolveElementBinding } from '../bindings';\nimport type { BoundConstructor } from '../bindings';\nimport { numberProperty, stringArrayProperty, stringProperty, unionProperty } from '../properties';\nimport { commandInputs } from './commandInputs';\n\nconst CommandFormRuntime = lazy(() => import('./CommandFormRuntime'));\n\n// Arc's useCommand constructs the proxy only on mount. Key by the actual registered class,\n// not its Scene name (which may be re-registered with a different route or roles).\nconst commandKeys = new WeakMap<BoundConstructor, number>();\nlet nextCommandKey = 0;\nfunction commandKey(command: BoundConstructor): number {\n let key = commandKeys.get(command);\n if (key === undefined) {\n key = ++nextCommandKey;\n commandKeys.set(command, key);\n }\n return key;\n}\n\n/**\n * Auto mode follows supported native proxy descriptors; opt-in inputs bind exactly named fields\n * inside a single native Arc form. Neither mode consumes the content slot.\n */\nexport function SceneCommandForm({ element }: RegisteredComponentProps) {\n const { name, target } = resolveElementBinding(element, BindingKind.Command);\n if (!target) return <MissingBinding element={element} kind={BindingKind.Command} name={name} />;\n\n const mode = unionProperty(element.properties, 'mode', ['auto', 'manual'] as const) ?? (Object.hasOwn(element.properties, 'inputs') ? 'manual' : 'auto');\n const inputs = mode === 'manual' ? commandInputs(element.properties) : undefined;\n if (mode === 'manual' && !inputs) return <div role='alert'>Invalid command form inputs declaration</div>;\n\n return (\n <ArcRuntimeBoundary>\n <CommandFormRuntime\n key={commandKey(target)}\n command={target}\n inputs={inputs}\n exclude={stringArrayProperty(element.properties, 'exclude')}\n submitLabel={stringProperty(element.properties, 'submitLabel') ?? 'Submit'}\n {...(numberProperty(element.properties, 'columns') === undefined ? {} : { columns: numberProperty(element.properties, 'columns') })}\n />\n </ArcRuntimeBoundary>\n );\n}\n"],"names":["CommandFormRuntime","lazy","commandKeys","WeakMap","nextCommandKey","commandKey","command","key","get","undefined","set","SceneCommandForm","element","name","target","resolveElementBinding","BindingKind","Command","_jsx","MissingBinding","kind","mode","unionProperty","properties","Object","hasOwn","inputs","commandInputs","div","role","ArcRuntimeBoundary","exclude","stringArrayProperty","submitLabel","stringProperty","numberProperty","columns"],"mappings":";;;;;;;;;;;AAUA,MAAMA,kBAAAA,iBAAqBC,UAAAA,CAAK,IAAM,oDAAO,yBAAA,KAAA,CAAA;AAE7C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AAA;AACG,QAAA,QAAA,gBAAAZ,cAAA,CAAClB,kBAAAA,EAAAA;YAEGM,OAAAA,EAASQ,MAAAA;YACTY,MAAAA,EAAQA,MAAAA;YACRK,OAAAA,EAASC,8BAAAA,CAAoBpB,OAAAA,CAAQW,UAAU,EAAE,SAAA,CAAA;AACjDU,YAAAA,WAAAA,EAAaC,yBAAAA,CAAetB,OAAAA,CAAQW,UAAU,EAAE,aAAA,CAAA,IAAkB,QAAA;AACjE,YAAA,GAAIY,0BAAevB,OAAAA,CAAQW,UAAU,EAAE,SAAA,CAAA,KAAed,SAAAA,GAAY,EAAC,GAAI;gBAAE2B,OAAAA,EAASD,yBAAAA,CAAevB,OAAAA,CAAQW,UAAU,EAAE,SAAA;;WALjHlB,UAAAA,CAAWS,MAAAA,CAAAA;;AAShC;;"}
|
|
@@ -16,16 +16,22 @@ var properties = require('../properties.js');
|
|
|
16
16
|
if (!input || Object.keys(input).some((key)=>![
|
|
17
17
|
'property',
|
|
18
18
|
'type',
|
|
19
|
-
'label'
|
|
19
|
+
'label',
|
|
20
|
+
'column',
|
|
21
|
+
'width'
|
|
20
22
|
].includes(key))) return undefined;
|
|
21
23
|
const property = properties.stringProperty(input, 'property');
|
|
22
24
|
const label = properties.stringProperty(input, 'label');
|
|
23
25
|
if (!property?.trim() || !label?.trim() || input.type !== 'string' && input.type !== 'guid' || seen.has(property)) return undefined;
|
|
24
26
|
seen.add(property);
|
|
27
|
+
const column = properties.numberProperty(input, 'column');
|
|
28
|
+
const width = properties.stringProperty(input, 'width');
|
|
25
29
|
inputs.push({
|
|
26
30
|
property,
|
|
27
31
|
type: input.type,
|
|
28
|
-
label
|
|
32
|
+
label,
|
|
33
|
+
column,
|
|
34
|
+
width
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
37
|
return inputs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandInputs.js","sources":["../../../forms/commandInputs.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 { arrayProperty, objectProperty, stringProperty } from '../properties';\n\n/** Exact, case-sensitive names from a generated command's propertyDescriptors. */\nexport interface CommandInput {\n property: string;\n type: 'string' | 'guid';\n label: string;\n}\n\n/** An absent declaration selects legacy auto mode; a present but invalid declaration never does. */\nexport function commandInputs(properties: Record<string, unknown>): CommandInput[] | undefined {\n const values = arrayProperty(properties, 'inputs');\n if (!values?.length) return undefined;\n const inputs: CommandInput[] = [];\n const seen = new Set<string>();\n for (const value of values) {\n const input = objectProperty({ value }, 'value');\n if (!input || Object.keys(input).some(key => !['property', 'type', 'label'].includes(key))) return undefined;\n const property = stringProperty(input, 'property');\n const label = stringProperty(input, 'label');\n if (!property?.trim() || !label?.trim() || (input.type !== 'string' && input.type !== 'guid') || seen.has(property)) return undefined;\n seen.add(property);\n inputs.push({ property, type: input.type, label });\n }\n return inputs;\n}\n"],"names":["commandInputs","properties","values","arrayProperty","length","undefined","inputs","seen","Set","value","input","objectProperty","Object","keys","some","key","includes","property","stringProperty","label","trim","type","has","add","push"],"mappings":";;;;AAAA;AACA;
|
|
1
|
+
{"version":3,"file":"commandInputs.js","sources":["../../../forms/commandInputs.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 { arrayProperty, numberProperty, objectProperty, stringProperty } from '../properties';\n\n/** Exact, case-sensitive names from a generated command's propertyDescriptors. */\nexport interface CommandInput {\n property: string;\n type: 'string' | 'guid';\n label: string;\n column?: number;\n width?: string;\n}\n\n/** An absent declaration selects legacy auto mode; a present but invalid declaration never does. */\nexport function commandInputs(properties: Record<string, unknown>): CommandInput[] | undefined {\n const values = arrayProperty(properties, 'inputs');\n if (!values?.length) return undefined;\n const inputs: CommandInput[] = [];\n const seen = new Set<string>();\n for (const value of values) {\n const input = objectProperty({ value }, 'value');\n if (!input || Object.keys(input).some(key => !['property', 'type', 'label', 'column', 'width'].includes(key))) return undefined;\n const property = stringProperty(input, 'property');\n const label = stringProperty(input, 'label');\n if (!property?.trim() || !label?.trim() || (input.type !== 'string' && input.type !== 'guid') || seen.has(property)) return undefined;\n seen.add(property);\n const column = numberProperty(input, 'column');\n const width = stringProperty(input, 'width');\n inputs.push({ property, type: input.type, label, column, width });\n }\n return inputs;\n}\n"],"names":["commandInputs","properties","values","arrayProperty","length","undefined","inputs","seen","Set","value","input","objectProperty","Object","keys","some","key","includes","property","stringProperty","label","trim","type","has","add","column","numberProperty","width","push"],"mappings":";;;;AAAA;AACA;AAaA,qGACO,SAASA,aAAAA,CAAcC,YAAmC,EAAA;IAC7D,MAAMC,MAAAA,GAASC,yBAAcF,YAAAA,EAAY,QAAA,CAAA;IACzC,IAAI,CAACC,MAAAA,EAAQE,MAAAA,EAAQ,OAAOC,SAAAA;AAC5B,IAAA,MAAMC,SAAyB,EAAE;AACjC,IAAA,MAAMC,OAAO,IAAIC,GAAAA,EAAAA;IACjB,KAAK,MAAMC,SAASP,MAAAA,CAAQ;AACxB,QAAA,MAAMQ,QAAQC,yBAAAA,CAAe;AAAEF,YAAAA;SAAM,EAAG,OAAA,CAAA;QACxC,IAAI,CAACC,KAAAA,IAASE,MAAAA,CAAOC,IAAI,CAACH,OAAOI,IAAI,CAACC,CAAAA,GAAAA,GAAO,CAAC;AAAC,gBAAA,UAAA;AAAY,gBAAA,MAAA;AAAQ,gBAAA,OAAA;AAAS,gBAAA,QAAA;AAAU,gBAAA;aAAQ,CAACC,QAAQ,CAACD,GAAAA,CAAAA,CAAAA,EAAO,OAAOV,SAAAA;QACtH,MAAMY,QAAAA,GAAWC,0BAAeR,KAAAA,EAAO,UAAA,CAAA;QACvC,MAAMS,KAAAA,GAAQD,0BAAeR,KAAAA,EAAO,OAAA,CAAA;AACpC,QAAA,IAAI,CAACO,QAAAA,EAAUG,IAAAA,EAAAA,IAAU,CAACD,KAAAA,EAAOC,IAAAA,EAAAA,IAAWV,MAAMW,IAAI,KAAK,QAAA,IAAYX,KAAAA,CAAMW,IAAI,KAAK,MAAA,IAAWd,KAAKe,GAAG,CAACL,WAAW,OAAOZ,SAAAA;AAC5HE,QAAAA,IAAAA,CAAKgB,GAAG,CAACN,QAAAA,CAAAA;QACT,MAAMO,MAAAA,GAASC,0BAAef,KAAAA,EAAO,QAAA,CAAA;QACrC,MAAMgB,KAAAA,GAAQR,0BAAeR,KAAAA,EAAO,OAAA,CAAA;AACpCJ,QAAAA,MAAAA,CAAOqB,IAAI,CAAC;AAAEV,YAAAA,QAAAA;AAAUI,YAAAA,IAAAA,EAAMX,MAAMW,IAAI;AAAEF,YAAAA,KAAAA;AAAOK,YAAAA,MAAAA;AAAQE,YAAAA;AAAM,SAAA,CAAA;AACnE,IAAA;IACA,OAAOpB,MAAAA;AACX;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
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
|
+
const generateCommandFieldsAction = {
|
|
8
|
+
descriptor: {
|
|
9
|
+
id: 'Cratis.Components.commandForm.generateFields',
|
|
10
|
+
label: 'Generate fields',
|
|
11
|
+
placement: scene_model.DesignTimeActionPlacement.Toolbar,
|
|
12
|
+
availability: 'commandForm.canGenerateFields',
|
|
13
|
+
description: 'Creates a deterministic editable field layout from the selected command metadata.'
|
|
14
|
+
},
|
|
15
|
+
isVisible: (context)=>context.element.componentName.endsWith(':commandForm'),
|
|
16
|
+
isEnabled: (context)=>Array.isArray(context.commandMetadata?.properties) && !Array.isArray(context.element.properties.inputs),
|
|
17
|
+
execute: (context)=>generateCommandFields(context)
|
|
18
|
+
};
|
|
19
|
+
function generateCommandFields(context) {
|
|
20
|
+
const properties = context.commandMetadata?.properties ?? [];
|
|
21
|
+
if (!properties.length) return {
|
|
22
|
+
edits: [],
|
|
23
|
+
diagnostics: [
|
|
24
|
+
'No command metadata was supplied.'
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
if (Array.isArray(context.element.properties.inputs)) {
|
|
28
|
+
return {
|
|
29
|
+
edits: [],
|
|
30
|
+
diagnostics: [
|
|
31
|
+
'The form already has authored fields; Generate fields will not overwrite them.'
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
diagnostics: [],
|
|
37
|
+
edits: [
|
|
38
|
+
{
|
|
39
|
+
kind: scene_model.SceneEditKind.SetProperty,
|
|
40
|
+
nodeId: context.element.id,
|
|
41
|
+
path: 'inputs',
|
|
42
|
+
value: properties.map((property, index)=>({
|
|
43
|
+
property: property.name,
|
|
44
|
+
type: property.type === 'Guid' || property.type === 'guid' ? 'guid' : 'string',
|
|
45
|
+
label: property.label ?? humanize(property.name),
|
|
46
|
+
column: index % 2 + 1,
|
|
47
|
+
width: '1fr'
|
|
48
|
+
}))
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function humanize(name) {
|
|
54
|
+
return name.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/^./, (value)=>value.toUpperCase());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.generateCommandFieldsAction = generateCommandFieldsAction;
|
|
58
|
+
//# sourceMappingURL=generateCommandFieldsAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateCommandFieldsAction.js","sources":["../../../forms/generateCommandFieldsAction.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 { DesignTimeAction, DesignTimeActionContext, DesignTimeActionResult } from '@cratis/scene.react';\nimport { DesignTimeActionPlacement, SceneEditKind } from '@cratis/scene.model';\n\nexport const generateCommandFieldsAction: DesignTimeAction = {\n descriptor: {\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 isVisible: context => context.element.componentName.endsWith(':commandForm'),\n isEnabled: context => Array.isArray(context.commandMetadata?.properties) && !Array.isArray(context.element.properties.inputs),\n execute: context => generateCommandFields(context),\n};\n\nfunction generateCommandFields(context: DesignTimeActionContext): DesignTimeActionResult {\n const properties = context.commandMetadata?.properties ?? [];\n if (!properties.length) return { edits: [], diagnostics: ['No command metadata was supplied.'] };\n if (Array.isArray(context.element.properties.inputs)) {\n return { edits: [], diagnostics: ['The form already has authored fields; Generate fields will not overwrite them.'] };\n }\n\n return {\n diagnostics: [],\n edits: [{\n kind: SceneEditKind.SetProperty,\n nodeId: context.element.id,\n path: 'inputs',\n value: properties.map((property, index) => ({\n property: property.name,\n type: property.type === 'Guid' || property.type === 'guid' ? 'guid' : 'string',\n label: property.label ?? humanize(property.name),\n column: (index % 2) + 1,\n width: '1fr',\n })),\n }],\n };\n}\n\nfunction humanize(name: string): string {\n return name.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/^./, value => value.toUpperCase());\n}\n"],"names":["generateCommandFieldsAction","descriptor","id","label","placement","DesignTimeActionPlacement","Toolbar","availability","description","isVisible","context","element","componentName","endsWith","isEnabled","Array","isArray","commandMetadata","properties","inputs","execute","generateCommandFields","length","edits","diagnostics","kind","SceneEditKind","SetProperty","nodeId","path","value","map","property","index","name","type","humanize","column","width","replace","toUpperCase"],"mappings":";;;;AAAA;AACA;MAKaA,2BAAAA,GAAgD;IACzDC,UAAAA,EAAY;QACRC,EAAAA,EAAI,8CAAA;QACJC,KAAAA,EAAO,iBAAA;AACPC,QAAAA,SAAAA,EAAWC,sCAA0BC,OAAO;QAC5CC,YAAAA,EAAc,+BAAA;QACdC,WAAAA,EAAa;AACjB,KAAA;IACAC,SAAAA,EAAWC,CAAAA,UAAWA,OAAAA,CAAQC,OAAO,CAACC,aAAa,CAAC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AA,CAAS7B,KAAK,IAAIiC,QAAAA,CAASJ,SAASE,IAAI,CAAA;wBAC/CG,MAAAA,EAASJ,QAAQ,CAAA,GAAK,CAAA;wBACtBK,KAAAA,EAAO;qBACX,CAAA;AACJ;AAAE;AACN,KAAA;AACJ;AAEA,SAASF,SAASF,IAAY,EAAA;IAC1B,OAAOA,IAAAA,CAAKK,OAAO,CAAC,oBAAA,EAAsB,OAAA,CAAA,CAASA,OAAO,CAAC,IAAA,EAAMT,CAAAA,KAAAA,GAASA,KAAAA,CAAMU,WAAW,EAAA,CAAA;AAC/F;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsDescriptors.d.ts","sourceRoot":"","sources":["../../cratisComponentsDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"cratisComponentsDescriptors.d.ts","sourceRoot":"","sources":["../../cratisComponentsDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkC,mBAAmB,EAAsF,MAAM,qBAAqB,CAAC;AA+E9K,eAAO,MAAM,2BAA2B,EAAE,mBAAmB,EAiB5D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryResultShape, PropertyValueType } from '@cratis/scene.model';
|
|
1
|
+
import { QueryResultShape, PropertyValueType, BindingMode, BindingSourceKind, DesignTimeActionPlacement } from '@cratis/scene.model';
|
|
2
2
|
import { componentRegistryKey } from '@cratis/scene.react';
|
|
3
3
|
|
|
4
4
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -51,6 +51,141 @@ const key = (name)=>componentRegistryKey('Cratis.Components', name);
|
|
|
51
51
|
valueType: PropertyValueType.Object,
|
|
52
52
|
editorKind: 'resultFieldList',
|
|
53
53
|
description: 'The result fields the table\'s search box looks in.'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
path: 'selectedItem',
|
|
57
|
+
label: 'Selected item',
|
|
58
|
+
group: 'Outputs',
|
|
59
|
+
valueType: PropertyValueType.Object,
|
|
60
|
+
readOnly: true,
|
|
61
|
+
output: true,
|
|
62
|
+
bindingMode: BindingMode.OneWay,
|
|
63
|
+
description: 'The currently selected row, or null after selection is cleared.'
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
const commandFormProperties = [
|
|
67
|
+
{
|
|
68
|
+
path: 'command',
|
|
69
|
+
label: 'Command',
|
|
70
|
+
group: 'Command',
|
|
71
|
+
valueType: PropertyValueType.String,
|
|
72
|
+
editorKind: 'commandBinding',
|
|
73
|
+
constraints: {
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
description: 'The Arc command proxy rendered through the native command form runtime.'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
path: 'mode',
|
|
80
|
+
label: 'Mode',
|
|
81
|
+
group: 'Layout',
|
|
82
|
+
valueType: PropertyValueType.Enum,
|
|
83
|
+
choices: [
|
|
84
|
+
{
|
|
85
|
+
value: 'auto',
|
|
86
|
+
label: 'Auto'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
value: 'manual',
|
|
90
|
+
label: 'Manual'
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
default: 'auto',
|
|
94
|
+
description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
path: 'columns',
|
|
98
|
+
label: 'Columns',
|
|
99
|
+
group: 'Layout',
|
|
100
|
+
valueType: PropertyValueType.Number,
|
|
101
|
+
default: 1
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
path: 'fieldWidths',
|
|
105
|
+
label: 'Field widths',
|
|
106
|
+
group: 'Layout',
|
|
107
|
+
valueType: PropertyValueType.Object,
|
|
108
|
+
editorKind: 'fieldWidths'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
path: 'inputs',
|
|
112
|
+
label: 'Fields',
|
|
113
|
+
group: 'Layout',
|
|
114
|
+
valueType: PropertyValueType.Collection,
|
|
115
|
+
editorKind: 'commandFields',
|
|
116
|
+
acceptedBindingKinds: [
|
|
117
|
+
BindingSourceKind.DataContext,
|
|
118
|
+
BindingSourceKind.ComponentProperty
|
|
119
|
+
],
|
|
120
|
+
item: {
|
|
121
|
+
label: 'Field',
|
|
122
|
+
properties: [
|
|
123
|
+
{
|
|
124
|
+
path: 'property',
|
|
125
|
+
label: 'Property',
|
|
126
|
+
group: 'Field',
|
|
127
|
+
valueType: PropertyValueType.String
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
path: 'type',
|
|
131
|
+
label: 'Type',
|
|
132
|
+
group: 'Field',
|
|
133
|
+
valueType: PropertyValueType.Enum,
|
|
134
|
+
choices: [
|
|
135
|
+
{
|
|
136
|
+
value: 'string',
|
|
137
|
+
label: 'String'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
value: 'guid',
|
|
141
|
+
label: 'Guid'
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
path: 'label',
|
|
147
|
+
label: 'Label',
|
|
148
|
+
group: 'Field',
|
|
149
|
+
valueType: PropertyValueType.String
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
path: 'column',
|
|
153
|
+
label: 'Column',
|
|
154
|
+
group: 'Layout',
|
|
155
|
+
valueType: PropertyValueType.Number
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
path: 'width',
|
|
159
|
+
label: 'Width',
|
|
160
|
+
group: 'Layout',
|
|
161
|
+
valueType: PropertyValueType.String
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
path: 'exclude',
|
|
168
|
+
label: 'Excluded fields',
|
|
169
|
+
group: 'Command',
|
|
170
|
+
valueType: PropertyValueType.Collection,
|
|
171
|
+
item: {
|
|
172
|
+
label: 'Excluded field',
|
|
173
|
+
properties: [
|
|
174
|
+
{
|
|
175
|
+
path: 'property',
|
|
176
|
+
label: 'Property',
|
|
177
|
+
group: 'Field',
|
|
178
|
+
valueType: PropertyValueType.String
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
path: 'submitLabel',
|
|
185
|
+
label: 'Submit label',
|
|
186
|
+
group: 'Content',
|
|
187
|
+
valueType: PropertyValueType.String,
|
|
188
|
+
default: 'Submit'
|
|
54
189
|
}
|
|
55
190
|
];
|
|
56
191
|
/**
|
|
@@ -74,6 +209,21 @@ const key = (name)=>componentRegistryKey('Cratis.Components', name);
|
|
|
74
209
|
component: key('observableDataTable'),
|
|
75
210
|
displayName: 'Live data table',
|
|
76
211
|
properties: dataTableProperties
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
component: key('commandForm'),
|
|
215
|
+
displayName: 'Command form',
|
|
216
|
+
editorKind: 'commandFormDesigner',
|
|
217
|
+
properties: commandFormProperties,
|
|
218
|
+
actions: [
|
|
219
|
+
{
|
|
220
|
+
id: 'Cratis.Components.commandForm.generateFields',
|
|
221
|
+
label: 'Generate fields',
|
|
222
|
+
placement: DesignTimeActionPlacement.Toolbar,
|
|
223
|
+
availability: 'commandForm.canGenerateFields',
|
|
224
|
+
description: 'Creates a deterministic editable field layout from the selected command metadata.'
|
|
225
|
+
}
|
|
226
|
+
]
|
|
77
227
|
}
|
|
78
228
|
];
|
|
79
229
|
|
|
@@ -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,oBAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AA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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,oBAAAA,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,kBAAkBC,cAAc;QAAEC,UAAAA,EAAY,cAAA;QACvGC,WAAAA,EAAa,4CAAA;QACbC,WAAAA,EAAa;YAAEC,QAAAA,EAAU,IAAA;YAAMC,YAAAA,EAAc;AAACC,gBAAAA,gBAAAA,CAAiBC;AAAW;AAAC;AAC/E,KAAA;AACA,IAAA;QAAEZ,IAAAA,EAAM,cAAA;QAAgBC,KAAAA,EAAO,eAAA;QAAiBC,KAAAA,EAAO,SAA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UAAAA,EAAYhC;AAAoB,KAAA;AAC1F,IAAA;AAAEkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,OAAA,CAAA;QAAUsC,WAAAA,EAAa,OAAA;QAASH,UAAAA,EAAYhC;AAAoB,KAAA;AACjF,IAAA;AAAEkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,qBAAA,CAAA;QAAwBsC,WAAAA,EAAa,iBAAA;QAAmBH,UAAAA,EAAYhC;AAAoB,KAAA;AACzG,IAAA;AACIkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,aAAA,CAAA;QACfsC,WAAAA,EAAa,cAAA;QACb5B,UAAAA,EAAY,qBAAA;QACZyB,UAAAA,EAAYV,qBAAAA;QACZc,OAAAA,EAAS;AAAC,YAAA;gBACNC,EAAAA,EAAI,8CAAA;gBACJnC,KAAAA,EAAO,iBAAA;AACPoC,gBAAAA,SAAAA,EAAWC,0BAA0BC,OAAO;gBAC5CC,YAAAA,EAAc,+BAAA;gBACdjC,WAAAA,EAAa;AACjB;AAAE;AACN;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsPackage.d.ts","sourceRoot":"","sources":["../../cratisComponentsPackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"cratisComponentsPackage.d.ts","sourceRoot":"","sources":["../../cratisComponentsPackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA0BzD,eAAO,MAAM,+BAA+B,EAAE,YA+E7C,CAAC;AASF,eAAO,MAAM,uBAAuB,EAAE,kBAerC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { PackageKind } from '@cratis/scene.model';
|
|
2
2
|
import { cratisComponents, cratisComponentsPackageName } from './cratisComponents.js';
|
|
3
3
|
import { cratisComponentsDescriptors } from './cratisComponentsDescriptors.js';
|
|
4
|
+
import { CommandFieldPropertyEditor } from './forms/CommandFieldPropertyEditor.js';
|
|
5
|
+
import { CommandFormDesigner } from './forms/CommandFormDesigner.js';
|
|
6
|
+
import { generateCommandFieldsAction } from './forms/generateCommandFieldsAction.js';
|
|
4
7
|
|
|
5
8
|
// Copyright (c) Cratis. All rights reserved.
|
|
6
9
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -94,7 +97,31 @@ import { cratisComponentsDescriptors } from './cratisComponentsDescriptors.js';
|
|
|
94
97
|
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.",
|
|
95
98
|
module: '@cratis/scene.components',
|
|
96
99
|
license: 'MIT',
|
|
97
|
-
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE'
|
|
100
|
+
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',
|
|
101
|
+
designTime: {
|
|
102
|
+
previews: [],
|
|
103
|
+
designers: [
|
|
104
|
+
'commandFormDesigner'
|
|
105
|
+
],
|
|
106
|
+
propertyEditors: [
|
|
107
|
+
'commandBinding',
|
|
108
|
+
'commandFields',
|
|
109
|
+
'fieldWidths'
|
|
110
|
+
],
|
|
111
|
+
propertyDisplays: [],
|
|
112
|
+
actions: [
|
|
113
|
+
'Cratis.Components.commandForm.generateFields'
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
assets: [
|
|
117
|
+
'@cratis/components/styles',
|
|
118
|
+
'@cratis/components/tokens'
|
|
119
|
+
],
|
|
120
|
+
runtimeSingletons: [
|
|
121
|
+
'react',
|
|
122
|
+
'@cratis/arc',
|
|
123
|
+
'@cratis/components'
|
|
124
|
+
]
|
|
98
125
|
};
|
|
99
126
|
/**
|
|
100
127
|
* The `Cratis.Components` package as a loadable bundle - the manifest above, plus the React components
|
|
@@ -105,7 +132,18 @@ import { cratisComponentsDescriptors } from './cratisComponentsDescriptors.js';
|
|
|
105
132
|
*/ const cratisComponentsPackage = {
|
|
106
133
|
manifest: cratisComponentsPackageManifest,
|
|
107
134
|
components: cratisComponents,
|
|
108
|
-
descriptors: cratisComponentsDescriptors
|
|
135
|
+
descriptors: cratisComponentsDescriptors,
|
|
136
|
+
designTime: {
|
|
137
|
+
designers: {
|
|
138
|
+
commandFormDesigner: CommandFormDesigner
|
|
139
|
+
},
|
|
140
|
+
propertyEditors: {
|
|
141
|
+
commandBinding: CommandFieldPropertyEditor
|
|
142
|
+
},
|
|
143
|
+
actions: {
|
|
144
|
+
[generateCommandFieldsAction.descriptor.id]: generateCommandFieldsAction
|
|
145
|
+
}
|
|
146
|
+
}
|
|
109
147
|
};
|
|
110
148
|
|
|
111
149
|
export { cratisComponentsPackage, cratisComponentsPackageManifest };
|
|
@@ -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,2BAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,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;AACA,QAAA,cAAA;AACA,QAAA,gBAAA;AACA,QAAA,WAAA;AACA,QAAA,OAAA;AACA,QAAA,qBAAA;AACA,QAAA,aAAA;AACA,QAAA,gBAAA;AACA,QAAA,aAAA;AACA,QAAA,eAAA;AACA,QAAA,eAAA;AACA,QAAA,eAAA;AACA,QAAA,aAAA;AACA,QAAA,eAAA;AACA,QAAA,kBAAA;AACA,QAAA,kBAAA;AACA,QAAA,YAAA;AACA,QAAA,kBAAA;AACA,QAAA,iBAAA;AACA,QAAA,QAAA;AACA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AgBC;AACpB,SAAA;QACAX,OAAAA,EAAS;AACL,YAAA,CAACY,2BAAAA,CAA4BC,UAAU,CAACC,EAAE,GAAGF;AACjD;AACJ;AACJ;;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DesignTimePropertyEditorProps } from '@cratis/scene.react';
|
|
2
|
+
export declare function CommandFieldPropertyEditor({ context, property, value, setValue }: DesignTimePropertyEditorProps): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=CommandFieldPropertyEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandFieldPropertyEditor.d.ts","sourceRoot":"","sources":["../../../forms/CommandFieldPropertyEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAKpE,wBAAgB,0BAA0B,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,6BAA6B,+BAM/G"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SceneEditKind } from '@cratis/scene.model';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Package-side editor for a command form property. It writes through the generic Scene edit boundary.
|
|
6
|
+
*/ function CommandFieldPropertyEditor({ context, property, value, setValue }) {
|
|
7
|
+
return /*#__PURE__*/ jsx("input", {
|
|
8
|
+
"aria-label": property.label,
|
|
9
|
+
value: typeof value === 'string' ? value : '',
|
|
10
|
+
onChange: (event)=>{
|
|
11
|
+
const next = event.currentTarget.value;
|
|
12
|
+
setValue(next);
|
|
13
|
+
context.submitEdits([
|
|
14
|
+
{
|
|
15
|
+
kind: SceneEditKind.SetProperty,
|
|
16
|
+
nodeId: context.element.id,
|
|
17
|
+
path: property.path,
|
|
18
|
+
value: next
|
|
19
|
+
}
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { CommandFieldPropertyEditor };
|
|
26
|
+
//# 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,GAAA,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,cAAcC,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 @@
|
|
|
1
|
+
{"version":3,"file":"CommandFormDesigner.d.ts","sourceRoot":"","sources":["../../../forms/CommandFormDesigner.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAK/D,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAKxE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* Generic package-side command form designer. It reads only the shared design-time context and submits Scene edits.
|
|
7
|
+
*/ function CommandFormDesigner({ context }) {
|
|
8
|
+
const canGenerate = context.capabilities['commandForm.generateFields'] === true && context.permissions.edit !== false;
|
|
9
|
+
return /*#__PURE__*/ jsx("button", {
|
|
10
|
+
type: "button",
|
|
11
|
+
disabled: !canGenerate,
|
|
12
|
+
onClick: ()=>context.submitAction('Cratis.Components.commandForm.generateFields', []),
|
|
13
|
+
children: "Generate fields"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { CommandFormDesigner };
|
|
18
|
+
//# sourceMappingURL=CommandFormDesigner.js.map
|