@plasmicpkgs/antd5 0.0.59 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/antd.esm.js +47 -20
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +47 -20
- package/dist/index.js.map +1 -1
- package/dist/registerCheckbox.d.ts +1 -1
- package/package.json +3 -3
- package/skinny/registerCheckbox.cjs.js +2 -2
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +1 -1
- package/skinny/registerCheckbox.esm.js +2 -2
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerForm.cjs.js +37 -9
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.esm.js +37 -9
- package/skinny/registerForm.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +8 -9
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +8 -9
- package/skinny/registerSelect.esm.js.map +1 -1
|
@@ -11,5 +11,5 @@ export declare namespace AntdCheckbox {
|
|
|
11
11
|
}
|
|
12
12
|
export declare const AntdCheckboxGroup: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("antd/es/checkbox").CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>>;
|
|
13
13
|
export declare const checkboxComponentName = "plasmic-antd5-checkbox";
|
|
14
|
-
export declare const checkboxGroupComponentName = "plasmic-antd5-checkbox";
|
|
14
|
+
export declare const checkboxGroupComponentName = "plasmic-antd5-checkbox-group";
|
|
15
15
|
export declare function registerCheckbox(loader?: Registerable): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/antd5",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63",
|
|
4
4
|
"description": "Plasmic registration calls for antd components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"antd": "^5.1.6"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@plasmicapp/host": "1.0.
|
|
58
|
+
"@plasmicapp/host": "1.0.140",
|
|
59
59
|
"@plasmicapp/query": "0.1.64",
|
|
60
60
|
"@types/node": "^14.0.26",
|
|
61
61
|
"@types/react": "^18.0.27",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "a9f2eda1e2d7d4aa9bb169cee7bc1fb00061a941"
|
|
80
80
|
}
|
|
@@ -55,7 +55,7 @@ function AntdCheckbox(props) {
|
|
|
55
55
|
AntdCheckbox.__plasmicFormFieldMeta = { valueProp: "checked" };
|
|
56
56
|
const AntdCheckboxGroup = antd.Checkbox.Group;
|
|
57
57
|
const checkboxComponentName = "plasmic-antd5-checkbox";
|
|
58
|
-
const checkboxGroupComponentName = "plasmic-antd5-checkbox";
|
|
58
|
+
const checkboxGroupComponentName = "plasmic-antd5-checkbox-group";
|
|
59
59
|
function registerCheckbox(loader) {
|
|
60
60
|
utils.registerComponentHelper(loader, AntdCheckbox, {
|
|
61
61
|
name: checkboxComponentName,
|
|
@@ -138,7 +138,7 @@ function registerCheckbox(loader) {
|
|
|
138
138
|
},
|
|
139
139
|
children: {
|
|
140
140
|
type: "slot",
|
|
141
|
-
allowedComponents: [
|
|
141
|
+
allowedComponents: [checkboxComponentName]
|
|
142
142
|
// Error right now when using default slot content with stateful instances
|
|
143
143
|
// defaultValue: [
|
|
144
144
|
// {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerCheckbox.cjs.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import { Checkbox } from \"antd\";\nimport type { CheckboxChangeEvent } from \"antd/es/checkbox\";\nimport React from \"react\";\nimport {\n Registerable,\n registerComponentHelper,\n traverseReactEltTree,\n} from \"./utils\";\n\nexport function AntdCheckbox(\n props: Omit<React.ComponentProps<typeof Checkbox>, \"onChange\"> & {\n onChange?: (checked: boolean) => void;\n }\n) {\n const { onChange, ...rest } = props;\n const wrappedOnChange = React.useMemo(() => {\n if (onChange) {\n return (event: CheckboxChangeEvent) => onChange(event.target.checked);\n } else {\n return undefined;\n }\n }, [onChange]);\n return <Checkbox {...rest} onChange={wrappedOnChange} />;\n}\nAntdCheckbox.__plasmicFormFieldMeta = { valueProp: \"checked\" };\n\nexport const AntdCheckboxGroup = Checkbox.Group;\n\nexport const checkboxComponentName = \"plasmic-antd5-checkbox\";\nexport const checkboxGroupComponentName = \"plasmic-antd5-checkbox\";\n\nexport function registerCheckbox(loader?: Registerable) {\n registerComponentHelper(loader, AntdCheckbox, {\n name: checkboxComponentName,\n displayName: \"Checkbox\",\n props: {\n checked: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultChecked\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n hidden: (ps: any) => !!ps.__plasmicFormField,\n },\n disabled: {\n type: \"boolean\",\n description: \"If checkbox is disabled\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n advanced: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n ...({ mergeWithParent: true } as any),\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"checked\", type: \"boolean\" }],\n } as any,\n },\n states: {\n checked: {\n type: \"writable\",\n valueProp: \"checked\",\n onChangeProp: \"onChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerCheckbox\",\n importName: \"AntdCheckbox\",\n });\n\n registerComponentHelper(loader, AntdCheckboxGroup, {\n name: checkboxGroupComponentName,\n displayName: \"Checkbox Group\",\n props: {\n value: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultValue\",\n description: \"Default selected value\",\n multiSelect: true,\n options: (ps: any) => {\n const options = new Set<string>();\n traverseReactEltTree(ps.children, (elt) => {\n if (\n elt?.type === AntdCheckbox &&\n typeof elt?.props?.value === \"string\"\n ) {\n options.add(elt.props.value);\n }\n });\n return Array.from(options.keys());\n },\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables all checkboxes\",\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n allowedComponents: [
|
|
1
|
+
{"version":3,"file":"registerCheckbox.cjs.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import { Checkbox } from \"antd\";\nimport type { CheckboxChangeEvent } from \"antd/es/checkbox\";\nimport React from \"react\";\nimport {\n Registerable,\n registerComponentHelper,\n traverseReactEltTree,\n} from \"./utils\";\n\nexport function AntdCheckbox(\n props: Omit<React.ComponentProps<typeof Checkbox>, \"onChange\"> & {\n onChange?: (checked: boolean) => void;\n }\n) {\n const { onChange, ...rest } = props;\n const wrappedOnChange = React.useMemo(() => {\n if (onChange) {\n return (event: CheckboxChangeEvent) => onChange(event.target.checked);\n } else {\n return undefined;\n }\n }, [onChange]);\n return <Checkbox {...rest} onChange={wrappedOnChange} />;\n}\nAntdCheckbox.__plasmicFormFieldMeta = { valueProp: \"checked\" };\n\nexport const AntdCheckboxGroup = Checkbox.Group;\n\nexport const checkboxComponentName = \"plasmic-antd5-checkbox\";\nexport const checkboxGroupComponentName = \"plasmic-antd5-checkbox-group\";\n\nexport function registerCheckbox(loader?: Registerable) {\n registerComponentHelper(loader, AntdCheckbox, {\n name: checkboxComponentName,\n displayName: \"Checkbox\",\n props: {\n checked: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultChecked\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n hidden: (ps: any) => !!ps.__plasmicFormField,\n },\n disabled: {\n type: \"boolean\",\n description: \"If checkbox is disabled\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n advanced: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n ...({ mergeWithParent: true } as any),\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"checked\", type: \"boolean\" }],\n } as any,\n },\n states: {\n checked: {\n type: \"writable\",\n valueProp: \"checked\",\n onChangeProp: \"onChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerCheckbox\",\n importName: \"AntdCheckbox\",\n });\n\n registerComponentHelper(loader, AntdCheckboxGroup, {\n name: checkboxGroupComponentName,\n displayName: \"Checkbox Group\",\n props: {\n value: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultValue\",\n description: \"Default selected value\",\n multiSelect: true,\n options: (ps: any) => {\n const options = new Set<string>();\n traverseReactEltTree(ps.children, (elt) => {\n if (\n elt?.type === AntdCheckbox &&\n typeof elt?.props?.value === \"string\"\n ) {\n options.add(elt.props.value);\n }\n });\n return Array.from(options.keys());\n },\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables all checkboxes\",\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n allowedComponents: [checkboxComponentName],\n // Error right now when using default slot content with stateful instances\n // defaultValue: [\n // {\n // type: \"component\",\n // name: \"plasmic-antd5-checkbox\",\n // },\n // ],\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"object\" }],\n } as any,\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerCheckbox\",\n importName: \"AntdCheckboxGroup\",\n parentComponentName: checkboxComponentName,\n });\n}\n"],"names":["React","Checkbox","registerComponentHelper","traverseReactEltTree"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,aACd,KAGA,EAAA;AACA,EAAA,MAA8B,YAAtB,EAdV,QAAA,EAAA,GAcgC,EAAT,EAAA,IAAA,GAAA,SAAA,CAAS,IAAT,CAAb,UAAA,CAAA,CAAA,CAAA;AACR,EAAM,MAAA,eAAA,GAAkBA,sBAAM,CAAA,OAAA,CAAQ,MAAM;AAC1C,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,OAAO,CAAC,KAAA,KAA+B,QAAS,CAAA,KAAA,CAAM,OAAO,OAAO,CAAA,CAAA;AAAA,KAC/D,MAAA;AACL,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAAA,GACF,EAAG,CAAC,QAAQ,CAAC,CAAA,CAAA;AACb,EAAA,uBAAQA,sBAAA,CAAA,aAAA,CAAAC,aAAA,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAa,IAAb,CAAA,EAAA,EAAmB,UAAU,eAAiB,EAAA,CAAA,CAAA,CAAA;AACxD,CAAA;AACA,YAAa,CAAA,sBAAA,GAAyB,EAAE,SAAA,EAAW,SAAU,EAAA,CAAA;AAEtD,MAAM,oBAAoBA,aAAS,CAAA,MAAA;AAEnC,MAAM,qBAAwB,GAAA,yBAAA;AAC9B,MAAM,0BAA6B,GAAA,+BAAA;AAEnC,SAAS,iBAAiB,MAAuB,EAAA;AACtD,EAAAC,6BAAA,CAAwB,QAAQ,YAAc,EAAA;AAAA,IAC5C,IAAM,EAAA,qBAAA;AAAA,IACN,WAAa,EAAA,UAAA;AAAA,IACb,KAAO,EAAA;AAAA,MACL,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,SAAA;AAAA,QACN,QAAU,EAAA,IAAA;AAAA,QACV,gBAAkB,EAAA,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,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,OAC9C;AAAA,KACF;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,OAAA;AAAA,QACX,YAAc,EAAA,UAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,4CAAA;AAAA,IACZ,UAAY,EAAA,mBAAA;AAAA,IACZ,mBAAqB,EAAA,qBAAA;AAAA,GACtB,CAAA,CAAA;AACH;;;;;;;;"}
|
|
@@ -11,5 +11,5 @@ export declare namespace AntdCheckbox {
|
|
|
11
11
|
}
|
|
12
12
|
export declare const AntdCheckboxGroup: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("antd/es/checkbox").CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>>;
|
|
13
13
|
export declare const checkboxComponentName = "plasmic-antd5-checkbox";
|
|
14
|
-
export declare const checkboxGroupComponentName = "plasmic-antd5-checkbox";
|
|
14
|
+
export declare const checkboxGroupComponentName = "plasmic-antd5-checkbox-group";
|
|
15
15
|
export declare function registerCheckbox(loader?: Registerable): void;
|
|
@@ -49,7 +49,7 @@ function AntdCheckbox(props) {
|
|
|
49
49
|
AntdCheckbox.__plasmicFormFieldMeta = { valueProp: "checked" };
|
|
50
50
|
const AntdCheckboxGroup = Checkbox.Group;
|
|
51
51
|
const checkboxComponentName = "plasmic-antd5-checkbox";
|
|
52
|
-
const checkboxGroupComponentName = "plasmic-antd5-checkbox";
|
|
52
|
+
const checkboxGroupComponentName = "plasmic-antd5-checkbox-group";
|
|
53
53
|
function registerCheckbox(loader) {
|
|
54
54
|
registerComponentHelper(loader, AntdCheckbox, {
|
|
55
55
|
name: checkboxComponentName,
|
|
@@ -132,7 +132,7 @@ function registerCheckbox(loader) {
|
|
|
132
132
|
},
|
|
133
133
|
children: {
|
|
134
134
|
type: "slot",
|
|
135
|
-
allowedComponents: [
|
|
135
|
+
allowedComponents: [checkboxComponentName]
|
|
136
136
|
// Error right now when using default slot content with stateful instances
|
|
137
137
|
// defaultValue: [
|
|
138
138
|
// {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerCheckbox.esm.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import { Checkbox } from \"antd\";\nimport type { CheckboxChangeEvent } from \"antd/es/checkbox\";\nimport React from \"react\";\nimport {\n Registerable,\n registerComponentHelper,\n traverseReactEltTree,\n} from \"./utils\";\n\nexport function AntdCheckbox(\n props: Omit<React.ComponentProps<typeof Checkbox>, \"onChange\"> & {\n onChange?: (checked: boolean) => void;\n }\n) {\n const { onChange, ...rest } = props;\n const wrappedOnChange = React.useMemo(() => {\n if (onChange) {\n return (event: CheckboxChangeEvent) => onChange(event.target.checked);\n } else {\n return undefined;\n }\n }, [onChange]);\n return <Checkbox {...rest} onChange={wrappedOnChange} />;\n}\nAntdCheckbox.__plasmicFormFieldMeta = { valueProp: \"checked\" };\n\nexport const AntdCheckboxGroup = Checkbox.Group;\n\nexport const checkboxComponentName = \"plasmic-antd5-checkbox\";\nexport const checkboxGroupComponentName = \"plasmic-antd5-checkbox\";\n\nexport function registerCheckbox(loader?: Registerable) {\n registerComponentHelper(loader, AntdCheckbox, {\n name: checkboxComponentName,\n displayName: \"Checkbox\",\n props: {\n checked: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultChecked\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n hidden: (ps: any) => !!ps.__plasmicFormField,\n },\n disabled: {\n type: \"boolean\",\n description: \"If checkbox is disabled\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n advanced: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n ...({ mergeWithParent: true } as any),\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"checked\", type: \"boolean\" }],\n } as any,\n },\n states: {\n checked: {\n type: \"writable\",\n valueProp: \"checked\",\n onChangeProp: \"onChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerCheckbox\",\n importName: \"AntdCheckbox\",\n });\n\n registerComponentHelper(loader, AntdCheckboxGroup, {\n name: checkboxGroupComponentName,\n displayName: \"Checkbox Group\",\n props: {\n value: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultValue\",\n description: \"Default selected value\",\n multiSelect: true,\n options: (ps: any) => {\n const options = new Set<string>();\n traverseReactEltTree(ps.children, (elt) => {\n if (\n elt?.type === AntdCheckbox &&\n typeof elt?.props?.value === \"string\"\n ) {\n options.add(elt.props.value);\n }\n });\n return Array.from(options.keys());\n },\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables all checkboxes\",\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n allowedComponents: [
|
|
1
|
+
{"version":3,"file":"registerCheckbox.esm.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import { Checkbox } from \"antd\";\nimport type { CheckboxChangeEvent } from \"antd/es/checkbox\";\nimport React from \"react\";\nimport {\n Registerable,\n registerComponentHelper,\n traverseReactEltTree,\n} from \"./utils\";\n\nexport function AntdCheckbox(\n props: Omit<React.ComponentProps<typeof Checkbox>, \"onChange\"> & {\n onChange?: (checked: boolean) => void;\n }\n) {\n const { onChange, ...rest } = props;\n const wrappedOnChange = React.useMemo(() => {\n if (onChange) {\n return (event: CheckboxChangeEvent) => onChange(event.target.checked);\n } else {\n return undefined;\n }\n }, [onChange]);\n return <Checkbox {...rest} onChange={wrappedOnChange} />;\n}\nAntdCheckbox.__plasmicFormFieldMeta = { valueProp: \"checked\" };\n\nexport const AntdCheckboxGroup = Checkbox.Group;\n\nexport const checkboxComponentName = \"plasmic-antd5-checkbox\";\nexport const checkboxGroupComponentName = \"plasmic-antd5-checkbox-group\";\n\nexport function registerCheckbox(loader?: Registerable) {\n registerComponentHelper(loader, AntdCheckbox, {\n name: checkboxComponentName,\n displayName: \"Checkbox\",\n props: {\n checked: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultChecked\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n hidden: (ps: any) => !!ps.__plasmicFormField,\n },\n disabled: {\n type: \"boolean\",\n description: \"If checkbox is disabled\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n advanced: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n ...({ mergeWithParent: true } as any),\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"checked\", type: \"boolean\" }],\n } as any,\n },\n states: {\n checked: {\n type: \"writable\",\n valueProp: \"checked\",\n onChangeProp: \"onChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerCheckbox\",\n importName: \"AntdCheckbox\",\n });\n\n registerComponentHelper(loader, AntdCheckboxGroup, {\n name: checkboxGroupComponentName,\n displayName: \"Checkbox Group\",\n props: {\n value: {\n type: \"choice\",\n editOnly: true,\n uncontrolledProp: \"defaultValue\",\n description: \"Default selected value\",\n multiSelect: true,\n options: (ps: any) => {\n const options = new Set<string>();\n traverseReactEltTree(ps.children, (elt) => {\n if (\n elt?.type === AntdCheckbox &&\n typeof elt?.props?.value === \"string\"\n ) {\n options.add(elt.props.value);\n }\n });\n return Array.from(options.keys());\n },\n },\n disabled: {\n type: \"boolean\",\n description: \"Disables all checkboxes\",\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n allowedComponents: [checkboxComponentName],\n // Error right now when using default slot content with stateful instances\n // defaultValue: [\n // {\n // type: \"component\",\n // name: \"plasmic-antd5-checkbox\",\n // },\n // ],\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"value\", type: \"object\" }],\n } as any,\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerCheckbox\",\n importName: \"AntdCheckboxGroup\",\n parentComponentName: checkboxComponentName,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,aACd,KAGA,EAAA;AACA,EAAA,MAA8B,YAAtB,EAdV,QAAA,EAAA,GAcgC,EAAT,EAAA,IAAA,GAAA,SAAA,CAAS,IAAT,CAAb,UAAA,CAAA,CAAA,CAAA;AACR,EAAM,MAAA,eAAA,GAAkB,KAAM,CAAA,OAAA,CAAQ,MAAM;AAC1C,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,OAAO,CAAC,KAAA,KAA+B,QAAS,CAAA,KAAA,CAAM,OAAO,OAAO,CAAA,CAAA;AAAA,KAC/D,MAAA;AACL,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAAA,GACF,EAAG,CAAC,QAAQ,CAAC,CAAA,CAAA;AACb,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAa,IAAb,CAAA,EAAA,EAAmB,UAAU,eAAiB,EAAA,CAAA,CAAA,CAAA;AACxD,CAAA;AACA,YAAa,CAAA,sBAAA,GAAyB,EAAE,SAAA,EAAW,SAAU,EAAA,CAAA;AAEtD,MAAM,oBAAoB,QAAS,CAAA,MAAA;AAEnC,MAAM,qBAAwB,GAAA,yBAAA;AAC9B,MAAM,0BAA6B,GAAA,+BAAA;AAEnC,SAAS,iBAAiB,MAAuB,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OACpB;AAAA,MACA,QAAU,EAAA;AAAA,QACR,IAAM,EAAA,MAAA;AAAA,QACN,iBAAA,EAAmB,CAAC,qBAAqB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAQ3C;AAAA,MACA,QAAU,EAAA;AAAA,QACR,IAAM,EAAA,cAAA;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,OAAS,EAAA,IAAA,EAAM,UAAU,CAAA;AAAA,OAC9C;AAAA,KACF;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,OAAA;AAAA,QACX,YAAc,EAAA,UAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,4CAAA;AAAA,IACZ,UAAY,EAAA,mBAAA;AAAA,IACZ,mBAAqB,EAAA,qBAAA;AAAA,GACtB,CAAA,CAAA;AACH;;;;"}
|
|
@@ -185,7 +185,7 @@ const Internal = (props) => {
|
|
|
185
185
|
noLabel: formItem.inputType === "Checkbox" /* Checkbox */ || formItem.noLabel,
|
|
186
186
|
style: { width: "100%" }
|
|
187
187
|
}),
|
|
188
|
-
formItem.inputType === "Text" /* Text */ ? /* @__PURE__ */ React__default.default.createElement(antd.Input, null) : formItem.inputType === "Password" /* Password */ ? /* @__PURE__ */ React__default.default.createElement(antd.Input.Password, null) : formItem.inputType === "Text Area" /* TextArea */ ? /* @__PURE__ */ React__default.default.createElement(antd.Input.TextArea, null) : formItem.inputType === "Number" /* Number */ ? /* @__PURE__ */ React__default.default.createElement(antd.InputNumber, null) : formItem.inputType === "Checkbox" /* Checkbox */ ? /* @__PURE__ */ React__default.default.createElement(antd.Checkbox, null, formItem.label) : formItem.inputType === "Select" /* Select */ ? /* @__PURE__ */ React__default.default.createElement(antd.Select, { options: formItem.options }) : formItem.inputType === "Radio" /*
|
|
188
|
+
formItem.inputType === "Text" /* Text */ ? /* @__PURE__ */ React__default.default.createElement(antd.Input, null) : formItem.inputType === "Password" /* Password */ ? /* @__PURE__ */ React__default.default.createElement(antd.Input.Password, null) : formItem.inputType === "Text Area" /* TextArea */ ? /* @__PURE__ */ React__default.default.createElement(antd.Input.TextArea, null) : formItem.inputType === "Number" /* Number */ ? /* @__PURE__ */ React__default.default.createElement(antd.InputNumber, null) : formItem.inputType === "Checkbox" /* Checkbox */ ? /* @__PURE__ */ React__default.default.createElement(antd.Checkbox, null, formItem.label) : formItem.inputType === "Select" /* Select */ ? /* @__PURE__ */ React__default.default.createElement(antd.Select, { options: formItem.options }) : formItem.inputType === "Radio Group" /* RadioGroup */ ? /* @__PURE__ */ React__default.default.createElement(
|
|
189
189
|
antd.Radio.Group,
|
|
190
190
|
{
|
|
191
191
|
options: formItem.options,
|
|
@@ -268,7 +268,7 @@ const COMMON_ACTIONS = [
|
|
|
268
268
|
"children"
|
|
269
269
|
);
|
|
270
270
|
},
|
|
271
|
-
hidden: (props) => props.mode
|
|
271
|
+
hidden: (props) => props.mode === "simplified"
|
|
272
272
|
}
|
|
273
273
|
// {
|
|
274
274
|
// type: "button-action" as const,
|
|
@@ -344,7 +344,13 @@ function registerForm(loader) {
|
|
|
344
344
|
label: "string",
|
|
345
345
|
inputType: {
|
|
346
346
|
type: "choice",
|
|
347
|
-
options: Object.values(InputType)
|
|
347
|
+
options: Object.values(InputType).filter(
|
|
348
|
+
(inputType) => ![
|
|
349
|
+
"Option" /* Option */,
|
|
350
|
+
"Option Group" /* OptionGroup */,
|
|
351
|
+
"Radio" /* Radio */
|
|
352
|
+
].includes(inputType)
|
|
353
|
+
),
|
|
348
354
|
defaultValue: "Text" /* Text */
|
|
349
355
|
},
|
|
350
356
|
options: {
|
|
@@ -358,12 +364,25 @@ function registerForm(loader) {
|
|
|
358
364
|
{ value: "option", label: "Option" },
|
|
359
365
|
{ value: "option-group", label: "Option Group" }
|
|
360
366
|
],
|
|
361
|
-
defaultValue: "option"
|
|
367
|
+
defaultValue: "option",
|
|
368
|
+
hidden: (ps, _ctx, { path }) => {
|
|
369
|
+
var _a, _b;
|
|
370
|
+
if (((_b = (_a = ps.formItems) == null ? void 0 : _a[path[1]]) == null ? void 0 : _b.inputType) !== "Select" /* Select */) {
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
362
375
|
},
|
|
363
376
|
label: "string",
|
|
364
377
|
value: {
|
|
365
378
|
type: "string",
|
|
366
|
-
hidden: (ps) =>
|
|
379
|
+
hidden: (ps, _ctx, { path, item }) => {
|
|
380
|
+
var _a, _b;
|
|
381
|
+
if (((_b = (_a = ps.formItems) == null ? void 0 : _a[path[1]]) == null ? void 0 : _b.inputType) !== "Select" /* Select */) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
return item.type !== "option";
|
|
385
|
+
}
|
|
367
386
|
},
|
|
368
387
|
options: {
|
|
369
388
|
type: "array",
|
|
@@ -374,12 +393,21 @@ function registerForm(loader) {
|
|
|
374
393
|
value: "string",
|
|
375
394
|
label: "string"
|
|
376
395
|
}
|
|
396
|
+
},
|
|
397
|
+
hidden: (ps, _ctx, { path, item }) => {
|
|
398
|
+
var _a, _b;
|
|
399
|
+
if (((_b = (_a = ps.formItems) == null ? void 0 : _a[path[1]]) == null ? void 0 : _b.inputType) !== "Select" /* Select */) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
return item.type !== "option-group";
|
|
377
403
|
}
|
|
378
404
|
}
|
|
379
405
|
},
|
|
380
406
|
nameFunc: (item) => item == null ? void 0 : item.label
|
|
381
407
|
},
|
|
382
|
-
hidden: (
|
|
408
|
+
hidden: (_ps, _ctx, { item }) => !["Select" /* Select */, "Radio Group" /* RadioGroup */].includes(
|
|
409
|
+
item.inputType
|
|
410
|
+
)
|
|
383
411
|
},
|
|
384
412
|
optionType: {
|
|
385
413
|
type: "choice",
|
|
@@ -387,14 +415,14 @@ function registerForm(loader) {
|
|
|
387
415
|
{ value: "default", label: "Radio" },
|
|
388
416
|
{ value: "button", label: "Button" }
|
|
389
417
|
],
|
|
390
|
-
hidden: (
|
|
418
|
+
hidden: (_ps, _ctx, { item }) => "Radio Group" /* RadioGroup */ !== item.inputType,
|
|
391
419
|
defaultValueHint: "Radio",
|
|
392
420
|
displayName: "Option Type"
|
|
393
421
|
}
|
|
394
422
|
}, commonFormItemProps),
|
|
395
423
|
nameFunc: (item) => item.label
|
|
396
424
|
},
|
|
397
|
-
hidden: (props) => props.mode
|
|
425
|
+
hidden: (props) => props.mode !== "simplified"
|
|
398
426
|
},
|
|
399
427
|
submitSlot: __spreadValues({
|
|
400
428
|
type: "slot",
|
|
@@ -461,7 +489,7 @@ function registerForm(loader) {
|
|
|
461
489
|
}
|
|
462
490
|
}
|
|
463
491
|
],
|
|
464
|
-
hidden: (props) => props.mode
|
|
492
|
+
hidden: (props) => props.mode === "simplified"
|
|
465
493
|
},
|
|
466
494
|
initialValues: {
|
|
467
495
|
type: "object"
|