@cratis/components 4.12.0 → 4.13.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.
|
@@ -10,6 +10,11 @@ export interface AutoCommandFormProps<TCommand extends object, TResponse = objec
|
|
|
10
10
|
* be user-editable, or one a custom field placed elsewhere on the page already covers.
|
|
11
11
|
*/
|
|
12
12
|
exclude?: (keyof TCommand)[];
|
|
13
|
+
/**
|
|
14
|
+
* Optional content rendered after the generated fields, inside the native Arc form and
|
|
15
|
+
* command context. Supply a submit control here when needed; no action is added by default.
|
|
16
|
+
*/
|
|
17
|
+
footer?: React.ReactNode;
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
20
|
* A `CommandForm` that generates its field list from the command's own properties, choosing each
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoCommandForm.d.ts","sourceRoot":"","sources":["../../../CommandForm/AutoCommandForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAMhF;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CACjC,QAAQ,SAAS,MAAM,EACvB,SAAS,GAAG,MAAM,CACpB,SAAQ,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC;IAC7D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,QAAQ,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"AutoCommandForm.d.ts","sourceRoot":"","sources":["../../../CommandForm/AutoCommandForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAMhF;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CACjC,QAAQ,SAAS,MAAM,EACvB,SAAS,GAAG,MAAM,CACpB,SAAQ,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,UAAU,CAAC;IAC7D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,QAAQ,CAAC,EAAE,CAAC;IAE7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAAE,SAAS,GAAG,MAAM,EAChF,KAAK,EAAE,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,GACjD,KAAK,CAAC,YAAY,CA6CpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { CommandForm } from '@cratis/arc.react/commands';
|
|
4
4
|
import { registerDefaultFieldTypeProviders } from './defaultFieldTypeProviders.js';
|
|
@@ -12,7 +12,7 @@ function formatTitle(propertyName) {
|
|
|
12
12
|
.trim();
|
|
13
13
|
}
|
|
14
14
|
function AutoCommandForm(props) {
|
|
15
|
-
const { exclude, ...commandFormProps } = props;
|
|
15
|
+
const { exclude, footer, ...commandFormProps } = props;
|
|
16
16
|
const propertyDescriptors = useMemo(() => new props.command().propertyDescriptors, [props.command]);
|
|
17
17
|
const excluded = useMemo(() => new Set((exclude ?? [])), [exclude]);
|
|
18
18
|
const fields = propertyDescriptors
|
|
@@ -28,7 +28,7 @@ function AutoCommandForm(props) {
|
|
|
28
28
|
}, title: formatTitle(descriptor.name) }, descriptor.name));
|
|
29
29
|
})
|
|
30
30
|
.filter((field) => field !== null);
|
|
31
|
-
return
|
|
31
|
+
return (jsxs(CommandForm, { ...commandFormProps, children: [fields, footer] }));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { AutoCommandForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoCommandForm.js","sources":["../../../CommandForm/AutoCommandForm.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;AAUA,iCAAiC,EAAE;
|
|
1
|
+
{"version":3,"file":"AutoCommandForm.js","sources":["../../../CommandForm/AutoCommandForm.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAUA,iCAAiC,EAAE;AAuBnC,SAAS,WAAW,CAAC,YAAoB,EAAA;AACrC,IAAA,OAAO;AACF,SAAA,OAAO,CAAC,UAAU,EAAE,KAAK;AACzB,SAAA,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,WAAW,EAAE;AACpD,SAAA,IAAI,EAAE;AACf;AAiBM,SAAU,eAAe,CAC3B,KAAgD,EAAA;IAEhD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK;IAEtD,MAAM,mBAAmB,GAAG,OAAO,CAC/B,MAAO,IAAI,KAAK,CAAC,OAAO,EAAyB,CAAC,mBAAmB,EACrE,CAAC,KAAK,CAAC,OAAO,CAAC,CAClB;IACD,MAAM,QAAQ,GAAG,OAAO,CACpB,MAAM,IAAI,GAAG,EAAU,OAAO,IAAI,EAAE,EAAc,EAClD,CAAC,OAAO,CAAC,CACZ;IAED,MAAM,MAAM,GAAG;AACV,SAAA,MAAM,CAAC,CAAC,UAAU,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;AACrD,SAAA,GAAG,CAAC,CAAC,UAAU,KAAI;AAChB,QAAA,MAAM,QAAQ,GAAG,wBAAwB,CAAC,UAAU,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE;AACX,YAAA,OAAO,IAAI;QACf;AAEA,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS;AAChC,QAAA,QACIA,GAAA,CAAC,KAAK,EAAA,EAIF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