@plasmicpkgs/antd 2.0.66 → 2.0.68
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 +196 -64
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +196 -64
- package/dist/index.js.map +1 -1
- package/dist/registerSlider.d.ts +10 -10
- package/package.json +3 -3
- package/skinny/package.json +1 -3
- package/skinny/registerCheckbox.cjs.js +31 -10
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.esm.js +31 -10
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerCollapse.cjs.js +30 -9
- package/skinny/registerCollapse.cjs.js.map +1 -1
- package/skinny/registerCollapse.esm.js +30 -9
- package/skinny/registerCollapse.esm.js.map +1 -1
- package/skinny/registerMenu.cjs.js +30 -9
- package/skinny/registerMenu.cjs.js.map +1 -1
- package/skinny/registerMenu.esm.js +30 -9
- package/skinny/registerMenu.esm.js.map +1 -1
- package/skinny/registerRate.cjs.js +17 -1
- package/skinny/registerRate.cjs.js.map +1 -1
- package/skinny/registerRate.esm.js +17 -1
- package/skinny/registerRate.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +15 -1
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.esm.js +15 -1
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSlider.cjs.js +44 -25
- package/skinny/registerSlider.cjs.js.map +1 -1
- package/skinny/registerSlider.d.ts +10 -10
- package/skinny/registerSlider.esm.js +44 -25
- package/skinny/registerSlider.esm.js.map +1 -1
- package/skinny/registerTabs.cjs.js +29 -9
- package/skinny/registerTabs.cjs.js.map +1 -1
- package/skinny/registerTabs.esm.js +29 -9
- package/skinny/registerTabs.esm.js.map +1 -1
package/dist/registerSlider.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { ComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
|
2
2
|
import type { SliderRangeProps, SliderSingleProps } from "antd/es/slider";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Registerable } from "./registerable";
|
|
5
|
-
type SliderProps = Omit<SliderSingleProps | SliderRangeProps, "value" | "defaultValue"> & {
|
|
6
|
-
value
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
type SliderProps = Omit<SliderSingleProps | SliderRangeProps, "value" | "defaultValue" | "onChange"> & {
|
|
6
|
+
value: number;
|
|
7
|
+
value2: number;
|
|
8
|
+
onChange: (val: number) => void;
|
|
9
|
+
onChange2: (val: number) => void;
|
|
10
10
|
};
|
|
11
|
-
export declare const Slider: React.ForwardRefExoticComponent<Omit<SliderSingleProps | SliderRangeProps, "defaultValue" | "value"> & {
|
|
12
|
-
value
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export declare const Slider: React.ForwardRefExoticComponent<Omit<SliderSingleProps | SliderRangeProps, "defaultValue" | "onChange" | "value"> & {
|
|
12
|
+
value: number;
|
|
13
|
+
value2: number;
|
|
14
|
+
onChange: (val: number) => void;
|
|
15
|
+
onChange2: (val: number) => void;
|
|
16
16
|
} & React.RefAttributes<unknown>>;
|
|
17
17
|
export declare const sliderMeta: ComponentMeta<SliderProps>;
|
|
18
18
|
export declare function registerSlider(loader?: Registerable, customSliderMeta?: ComponentMeta<SliderProps>): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/antd",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.68",
|
|
4
4
|
"description": "Plasmic registration calls for antd components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"antd": "^4.19.5"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@plasmicapp/host": "1.0.
|
|
62
|
+
"@plasmicapp/host": "1.0.149",
|
|
63
63
|
"@size-limit/preset-small-lib": "^4.11.0",
|
|
64
64
|
"@types/node": "^14.0.26",
|
|
65
65
|
"react": "^18.2.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"@plasmicapp/host": ">=1.0.0",
|
|
74
74
|
"react": ">=16.8.0"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "f91db2d00fb1c08d0ae15c67551cad864f018515"
|
|
77
77
|
}
|
package/skinny/package.json
CHANGED
|
@@ -110,6 +110,16 @@ function registerCheckbox(loader, customCheckboxMeta) {
|
|
|
110
110
|
const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent__default.default(...args);
|
|
111
111
|
doRegisterComponent(CheckboxWrapper, customCheckboxMeta != null ? customCheckboxMeta : checkboxMeta);
|
|
112
112
|
}
|
|
113
|
+
function getGroupOptions(componentProps) {
|
|
114
|
+
const options = /* @__PURE__ */ new Set();
|
|
115
|
+
customControls.traverseReactEltTree(componentProps.children, (elt) => {
|
|
116
|
+
var _a;
|
|
117
|
+
if ((elt == null ? void 0 : elt.type) === CheckboxWrapper && typeof ((_a = elt == null ? void 0 : elt.props) == null ? void 0 : _a.value) === "string") {
|
|
118
|
+
options.add(elt.props.value);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return Array.from(options.keys());
|
|
122
|
+
}
|
|
113
123
|
const checkboxGroupMeta = {
|
|
114
124
|
name: "AntdCheckboxGroup",
|
|
115
125
|
displayName: "Antd Checkbox Group",
|
|
@@ -122,19 +132,22 @@ const checkboxGroupMeta = {
|
|
|
122
132
|
value: {
|
|
123
133
|
type: "choice",
|
|
124
134
|
editOnly: true,
|
|
125
|
-
uncontrolledProp: "defaultValue",
|
|
126
135
|
description: "Default selected value",
|
|
127
136
|
multiSelect: true,
|
|
128
|
-
options:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
options: getGroupOptions
|
|
138
|
+
},
|
|
139
|
+
onChange: {
|
|
140
|
+
type: "eventHandler",
|
|
141
|
+
argTypes: [
|
|
142
|
+
{
|
|
143
|
+
name: "value",
|
|
144
|
+
type: {
|
|
145
|
+
type: "choice",
|
|
146
|
+
multiSelect: true,
|
|
147
|
+
options: getGroupOptions
|
|
134
148
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
}
|
|
149
|
+
}
|
|
150
|
+
]
|
|
138
151
|
},
|
|
139
152
|
children: {
|
|
140
153
|
type: "slot",
|
|
@@ -147,6 +160,14 @@ const checkboxGroupMeta = {
|
|
|
147
160
|
]
|
|
148
161
|
}
|
|
149
162
|
},
|
|
163
|
+
states: {
|
|
164
|
+
value: {
|
|
165
|
+
type: "writable",
|
|
166
|
+
variableType: "array",
|
|
167
|
+
valueProp: "value",
|
|
168
|
+
onChangeProp: "onChange"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
150
171
|
importPath: "@plasmicpkgs/antd/skinny/registerCheckbox",
|
|
151
172
|
importName: "CheckboxGroup",
|
|
152
173
|
parentComponentName: "AntdCheckbox"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerCheckbox.cjs.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport { Checkbox as AntdCheckbox } from \"antd\";\nimport type { CheckboxProps } from \"antd/es/checkbox/Checkbox\";\nimport type { CheckboxGroupProps } from \"antd/es/checkbox/Group\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\n\nexport const Checkbox: typeof AntdCheckbox = AntdCheckbox;\nexport const CheckboxGroup = Checkbox.Group;\n\nclass CheckboxWrapper extends React.Component<CheckboxProps> {\n render() {\n return <Checkbox {...this.props} />;\n }\n}\n\nexport const checkboxHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (\n e: Parameters<NonNullable<CheckboxProps[\"onChange\"]>>[0]\n ) => e.target.checked,\n },\n },\n};\n\nexport const checkboxMeta: ComponentMeta<CheckboxProps> = {\n name: \"AntdCheckbox\",\n displayName: \"Antd Checkbox\",\n props: {\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n },\n checked: {\n type: \"boolean\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n },\n disabled: {\n type: \"boolean\",\n description: \"If disable checkbox\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n value: {\n type: \"string\",\n description: \"The checkbox value\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"event\",\n type: \"object\",\n },\n ],\n },\n },\n states: {\n value: {\n type: \"writable\",\n variableType: \"boolean\",\n onChangeProp: \"onChange\",\n valueProp: \"checked\",\n },\n },\n componentHelpers: {\n helpers: checkboxHelpers,\n importName: \"checkboxHelpers\",\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n importName: \"Checkbox\",\n defaultStyles: {\n marginLeft: 0,\n },\n};\n\nexport function registerCheckbox(\n loader?: Registerable,\n customCheckboxMeta?: ComponentMeta<CheckboxProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(CheckboxWrapper, customCheckboxMeta ?? checkboxMeta);\n}\n\nexport const checkboxGroupMeta: ComponentMeta<CheckboxGroupProps> = {\n name: \"AntdCheckboxGroup\",\n displayName: \"Antd Checkbox Group\",\n props: {\n disabled: {\n type: \"boolean\",\n description: \"If disable all checkboxes\",\n defaultValueHint: false,\n },\n value: {\n type: \"choice\",\n editOnly: true,\n
|
|
1
|
+
{"version":3,"file":"registerCheckbox.cjs.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport { Checkbox as AntdCheckbox } from \"antd\";\nimport type { CheckboxProps } from \"antd/es/checkbox/Checkbox\";\nimport type { CheckboxGroupProps } from \"antd/es/checkbox/Group\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\n\nexport const Checkbox: typeof AntdCheckbox = AntdCheckbox;\nexport const CheckboxGroup = Checkbox.Group;\n\nclass CheckboxWrapper extends React.Component<CheckboxProps> {\n render() {\n return <Checkbox {...this.props} />;\n }\n}\n\nexport const checkboxHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (\n e: Parameters<NonNullable<CheckboxProps[\"onChange\"]>>[0]\n ) => e.target.checked,\n },\n },\n};\n\nexport const checkboxMeta: ComponentMeta<CheckboxProps> = {\n name: \"AntdCheckbox\",\n displayName: \"Antd Checkbox\",\n props: {\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n },\n checked: {\n type: \"boolean\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n },\n disabled: {\n type: \"boolean\",\n description: \"If disable checkbox\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n value: {\n type: \"string\",\n description: \"The checkbox value\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"event\",\n type: \"object\",\n },\n ],\n },\n },\n states: {\n value: {\n type: \"writable\",\n variableType: \"boolean\",\n onChangeProp: \"onChange\",\n valueProp: \"checked\",\n },\n },\n componentHelpers: {\n helpers: checkboxHelpers,\n importName: \"checkboxHelpers\",\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n importName: \"Checkbox\",\n defaultStyles: {\n marginLeft: 0,\n },\n};\n\nexport function registerCheckbox(\n loader?: Registerable,\n customCheckboxMeta?: ComponentMeta<CheckboxProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(CheckboxWrapper, customCheckboxMeta ?? checkboxMeta);\n}\n\nfunction getGroupOptions(componentProps: CheckboxGroupProps) {\n const options = new Set<string>();\n traverseReactEltTree(componentProps.children, (elt) => {\n if (\n elt?.type === CheckboxWrapper &&\n typeof elt?.props?.value === \"string\"\n ) {\n options.add(elt.props.value);\n }\n });\n return Array.from(options.keys());\n}\n\nexport const checkboxGroupMeta: ComponentMeta<CheckboxGroupProps> = {\n name: \"AntdCheckboxGroup\",\n displayName: \"Antd Checkbox Group\",\n props: {\n disabled: {\n type: \"boolean\",\n description: \"If disable all checkboxes\",\n defaultValueHint: false,\n },\n value: {\n type: \"choice\",\n editOnly: true,\n description: \"Default selected value\",\n multiSelect: true,\n options: getGroupOptions,\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"value\",\n type: {\n type: \"choice\",\n multiSelect: true,\n options: getGroupOptions,\n },\n },\n ],\n },\n children: {\n type: \"slot\",\n allowedComponents: [\"AntdCheckbox\"],\n defaultValue: [\n {\n type: \"component\",\n name: \"AntdCheckbox\",\n },\n ],\n },\n },\n states: {\n value: {\n type: \"writable\",\n variableType: \"array\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n importName: \"CheckboxGroup\",\n parentComponentName: \"AntdCheckbox\",\n};\n\nexport function registerCheckboxGroup(\n loader?: Registerable,\n customCheckboxGroupMeta?: ComponentMeta<CheckboxGroupProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(\n CheckboxGroup,\n customCheckboxGroupMeta ?? checkboxGroupMeta\n );\n}\n"],"names":["AntdCheckbox","React","registerComponent","traverseReactEltTree"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,QAAgC,GAAAA,cAAA;AACtC,MAAM,gBAAgB,QAAS,CAAA,MAAA;AAEtC,MAAM,eAAA,SAAwBC,uBAAM,SAAyB,CAAA;AAAA,EAC3D,MAAS,GAAA;AACP,IAAO,uBAAAA,sBAAA,CAAA,aAAA,CAAC,QAAa,EAAA,cAAA,CAAA,EAAA,EAAA,IAAA,CAAK,KAAO,CAAA,CAAA,CAAA;AAAA,GACnC;AACF,CAAA;AAEO,MAAM,eAAkB,GAAA;AAAA,EAC7B,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,mBAAqB,EAAA,CACnB,CACG,KAAA,CAAA,CAAE,MAAO,CAAA,OAAA;AAAA,KAChB;AAAA,GACF;AACF,EAAA;AAEO,MAAM,YAA6C,GAAA;AAAA,EACxD,IAAM,EAAA,cAAA;AAAA,EACN,WAAa,EAAA,eAAA;AAAA,EACb,KAAO,EAAA;AAAA,IACL,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,WAAa,EAAA,qCAAA;AAAA,MACb,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,IAAM,EAAA,SAAA;AAAA,MACN,WACE,EAAA,sEAAA;AAAA,MACF,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,SAAA;AAAA,MACN,WAAa,EAAA,qBAAA;AAAA,MACb,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,aAAe,EAAA;AAAA,MACb,IAAM,EAAA,SAAA;AAAA,MACN,WAAa,EAAA,6CAAA;AAAA,MACb,gBAAk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,KACF;AAAA,IACA,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,MAAA;AAAA,MACN,iBAAA,EAAmB,CAAC,cAAc,CAAA;AAAA,MAClC,YAAc,EAAA;AAAA,QACZ;AAAA,UACE,IAAM,EAAA,WAAA;AAAA,UACN,IAAM,EAAA,cAAA;AAAA,SACR;AAAA,OACF;AAAA,KACF;AAAA,GACF;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,IAAM,EAAA,UAAA;AAAA,MACN,YAAc,EAAA,OAAA;AAAA,MACd,SAAW,EAAA,OAAA;AAAA,MACX,YAAc,EAAA,UAAA;AAAA,KAChB;AAAA,GACF;AAAA,EACA,UAAY,EAAA,2CAAA;AAAA,EACZ,UAAY,EAAA,eAAA;AAAA,EACZ,mBAAqB,EAAA,cAAA;AACvB,EAAA;AAEgB,SAAA,qBAAA,CACd,QACA,uBACA,EAAA;AACA,EAAM,MAAA,mBAAA,GAAgD,CAAI,GAAA,IAAA,KACxD,MAAS,GAAA,MAAA,CAAO,iBAAkB,CAAA,GAAG,IAAI,CAAA,GAAID,kCAAkB,CAAA,GAAG,IAAI,CAAA,CAAA;AACxE,EAAA,mBAAA;AAAA,IACE,aAAA;AAAA,IACA,uBAA2B,IAAA,IAAA,GAAA,uBAAA,GAAA,iBAAA;AAAA,GAC7B,CAAA;AACF;;;;;;;;;;"}
|
|
@@ -103,6 +103,16 @@ function registerCheckbox(loader, customCheckboxMeta) {
|
|
|
103
103
|
const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent(...args);
|
|
104
104
|
doRegisterComponent(CheckboxWrapper, customCheckboxMeta != null ? customCheckboxMeta : checkboxMeta);
|
|
105
105
|
}
|
|
106
|
+
function getGroupOptions(componentProps) {
|
|
107
|
+
const options = /* @__PURE__ */ new Set();
|
|
108
|
+
traverseReactEltTree(componentProps.children, (elt) => {
|
|
109
|
+
var _a;
|
|
110
|
+
if ((elt == null ? void 0 : elt.type) === CheckboxWrapper && typeof ((_a = elt == null ? void 0 : elt.props) == null ? void 0 : _a.value) === "string") {
|
|
111
|
+
options.add(elt.props.value);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return Array.from(options.keys());
|
|
115
|
+
}
|
|
106
116
|
const checkboxGroupMeta = {
|
|
107
117
|
name: "AntdCheckboxGroup",
|
|
108
118
|
displayName: "Antd Checkbox Group",
|
|
@@ -115,19 +125,22 @@ const checkboxGroupMeta = {
|
|
|
115
125
|
value: {
|
|
116
126
|
type: "choice",
|
|
117
127
|
editOnly: true,
|
|
118
|
-
uncontrolledProp: "defaultValue",
|
|
119
128
|
description: "Default selected value",
|
|
120
129
|
multiSelect: true,
|
|
121
|
-
options:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
options: getGroupOptions
|
|
131
|
+
},
|
|
132
|
+
onChange: {
|
|
133
|
+
type: "eventHandler",
|
|
134
|
+
argTypes: [
|
|
135
|
+
{
|
|
136
|
+
name: "value",
|
|
137
|
+
type: {
|
|
138
|
+
type: "choice",
|
|
139
|
+
multiSelect: true,
|
|
140
|
+
options: getGroupOptions
|
|
127
141
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
}
|
|
142
|
+
}
|
|
143
|
+
]
|
|
131
144
|
},
|
|
132
145
|
children: {
|
|
133
146
|
type: "slot",
|
|
@@ -140,6 +153,14 @@ const checkboxGroupMeta = {
|
|
|
140
153
|
]
|
|
141
154
|
}
|
|
142
155
|
},
|
|
156
|
+
states: {
|
|
157
|
+
value: {
|
|
158
|
+
type: "writable",
|
|
159
|
+
variableType: "array",
|
|
160
|
+
valueProp: "value",
|
|
161
|
+
onChangeProp: "onChange"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
143
164
|
importPath: "@plasmicpkgs/antd/skinny/registerCheckbox",
|
|
144
165
|
importName: "CheckboxGroup",
|
|
145
166
|
parentComponentName: "AntdCheckbox"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerCheckbox.esm.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport { Checkbox as AntdCheckbox } from \"antd\";\nimport type { CheckboxProps } from \"antd/es/checkbox/Checkbox\";\nimport type { CheckboxGroupProps } from \"antd/es/checkbox/Group\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\n\nexport const Checkbox: typeof AntdCheckbox = AntdCheckbox;\nexport const CheckboxGroup = Checkbox.Group;\n\nclass CheckboxWrapper extends React.Component<CheckboxProps> {\n render() {\n return <Checkbox {...this.props} />;\n }\n}\n\nexport const checkboxHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (\n e: Parameters<NonNullable<CheckboxProps[\"onChange\"]>>[0]\n ) => e.target.checked,\n },\n },\n};\n\nexport const checkboxMeta: ComponentMeta<CheckboxProps> = {\n name: \"AntdCheckbox\",\n displayName: \"Antd Checkbox\",\n props: {\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n },\n checked: {\n type: \"boolean\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n },\n disabled: {\n type: \"boolean\",\n description: \"If disable checkbox\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n value: {\n type: \"string\",\n description: \"The checkbox value\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"event\",\n type: \"object\",\n },\n ],\n },\n },\n states: {\n value: {\n type: \"writable\",\n variableType: \"boolean\",\n onChangeProp: \"onChange\",\n valueProp: \"checked\",\n },\n },\n componentHelpers: {\n helpers: checkboxHelpers,\n importName: \"checkboxHelpers\",\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n importName: \"Checkbox\",\n defaultStyles: {\n marginLeft: 0,\n },\n};\n\nexport function registerCheckbox(\n loader?: Registerable,\n customCheckboxMeta?: ComponentMeta<CheckboxProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(CheckboxWrapper, customCheckboxMeta ?? checkboxMeta);\n}\n\nexport const checkboxGroupMeta: ComponentMeta<CheckboxGroupProps> = {\n name: \"AntdCheckboxGroup\",\n displayName: \"Antd Checkbox Group\",\n props: {\n disabled: {\n type: \"boolean\",\n description: \"If disable all checkboxes\",\n defaultValueHint: false,\n },\n value: {\n type: \"choice\",\n editOnly: true,\n
|
|
1
|
+
{"version":3,"file":"registerCheckbox.esm.js","sources":["../src/registerCheckbox.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport { Checkbox as AntdCheckbox } from \"antd\";\nimport type { CheckboxProps } from \"antd/es/checkbox/Checkbox\";\nimport type { CheckboxGroupProps } from \"antd/es/checkbox/Group\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\n\nexport const Checkbox: typeof AntdCheckbox = AntdCheckbox;\nexport const CheckboxGroup = Checkbox.Group;\n\nclass CheckboxWrapper extends React.Component<CheckboxProps> {\n render() {\n return <Checkbox {...this.props} />;\n }\n}\n\nexport const checkboxHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (\n e: Parameters<NonNullable<CheckboxProps[\"onChange\"]>>[0]\n ) => e.target.checked,\n },\n },\n};\n\nexport const checkboxMeta: ComponentMeta<CheckboxProps> = {\n name: \"AntdCheckbox\",\n displayName: \"Antd Checkbox\",\n props: {\n autoFocus: {\n type: \"boolean\",\n description: \"If get focus when component mounted\",\n defaultValueHint: false,\n },\n checked: {\n type: \"boolean\",\n description:\n \"Specifies the initial state: whether or not the checkbox is selected\",\n defaultValueHint: false,\n },\n disabled: {\n type: \"boolean\",\n description: \"If disable checkbox\",\n defaultValueHint: false,\n },\n indeterminate: {\n type: \"boolean\",\n description: \"The indeterminate checked state of checkbox\",\n defaultValueHint: false,\n },\n value: {\n type: \"string\",\n description: \"The checkbox value\",\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Checkbox\",\n },\n ],\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"event\",\n type: \"object\",\n },\n ],\n },\n },\n states: {\n value: {\n type: \"writable\",\n variableType: \"boolean\",\n onChangeProp: \"onChange\",\n valueProp: \"checked\",\n },\n },\n componentHelpers: {\n helpers: checkboxHelpers,\n importName: \"checkboxHelpers\",\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n importName: \"Checkbox\",\n defaultStyles: {\n marginLeft: 0,\n },\n};\n\nexport function registerCheckbox(\n loader?: Registerable,\n customCheckboxMeta?: ComponentMeta<CheckboxProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(CheckboxWrapper, customCheckboxMeta ?? checkboxMeta);\n}\n\nfunction getGroupOptions(componentProps: CheckboxGroupProps) {\n const options = new Set<string>();\n traverseReactEltTree(componentProps.children, (elt) => {\n if (\n elt?.type === CheckboxWrapper &&\n typeof elt?.props?.value === \"string\"\n ) {\n options.add(elt.props.value);\n }\n });\n return Array.from(options.keys());\n}\n\nexport const checkboxGroupMeta: ComponentMeta<CheckboxGroupProps> = {\n name: \"AntdCheckboxGroup\",\n displayName: \"Antd Checkbox Group\",\n props: {\n disabled: {\n type: \"boolean\",\n description: \"If disable all checkboxes\",\n defaultValueHint: false,\n },\n value: {\n type: \"choice\",\n editOnly: true,\n description: \"Default selected value\",\n multiSelect: true,\n options: getGroupOptions,\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"value\",\n type: {\n type: \"choice\",\n multiSelect: true,\n options: getGroupOptions,\n },\n },\n ],\n },\n children: {\n type: \"slot\",\n allowedComponents: [\"AntdCheckbox\"],\n defaultValue: [\n {\n type: \"component\",\n name: \"AntdCheckbox\",\n },\n ],\n },\n },\n states: {\n value: {\n type: \"writable\",\n variableType: \"array\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCheckbox\",\n importName: \"CheckboxGroup\",\n parentComponentName: \"AntdCheckbox\",\n};\n\nexport function registerCheckboxGroup(\n loader?: Registerable,\n customCheckboxGroupMeta?: ComponentMeta<CheckboxGroupProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(\n CheckboxGroup,\n customCheckboxGroupMeta ?? checkboxGroupMeta\n );\n}\n"],"names":["AntdCheckbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,QAAgC,GAAAA,WAAA;AACtC,MAAM,gBAAgB,QAAS,CAAA,MAAA;AAEtC,MAAM,eAAA,SAAwB,MAAM,SAAyB,CAAA;AAAA,EAC3D,MAAS,GAAA;AACP,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAa,EAAA,cAAA,CAAA,EAAA,EAAA,IAAA,CAAK,KAAO,CAAA,CAAA,CAAA;AAAA,GACnC;AACF,CAAA;AAEO,MAAM,eAAkB,GAAA;AAAA,EAC7B,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,mBAAqB,EAAA,CACnB,CACG,KAAA,CAAA,CAAE,MAAO,CAAA,OAAA;AAAA,KAChB;AAAA,GACF;AACF,EAAA;AAEO,MAAM,YAA6C,GAAA;AAAA,EACxD,IAAM,EAAA,cAAA;AAAA,EACN,WAAa,EAAA,eAAA;AAAA,EACb,KAAO,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,aAAA;AAAA,IACA,uBAA2B,IAAA,IAAA,GAAA,uBAAA,GAAA,iBAAA;AAAA,GAC7B,CAAA;AACF;;;;"}
|
|
@@ -99,6 +99,15 @@ function registerCollapsePanel(loader, customCollapsePanelMeta) {
|
|
|
99
99
|
customCollapsePanelMeta != null ? customCollapsePanelMeta : collapstePanelMeta
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
+
function getOptions(componentProps) {
|
|
103
|
+
const options = /* @__PURE__ */ new Set();
|
|
104
|
+
customControls.traverseReactEltTree(componentProps.children, (elt) => {
|
|
105
|
+
if ((elt == null ? void 0 : elt.type) === CollapsePanel && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
106
|
+
options.add(elt.key);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return Array.from(options.keys());
|
|
110
|
+
}
|
|
102
111
|
const collapsteMeta = {
|
|
103
112
|
name: "AntdCollapse",
|
|
104
113
|
displayName: "Antd Collapse",
|
|
@@ -111,18 +120,22 @@ const collapsteMeta = {
|
|
|
111
120
|
activeKey: {
|
|
112
121
|
type: "choice",
|
|
113
122
|
editOnly: true,
|
|
114
|
-
uncontrolledProp: "defaultActiveKey",
|
|
115
123
|
description: "Key of the active panel",
|
|
116
124
|
multiSelect: true,
|
|
117
|
-
options:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
options: getOptions
|
|
126
|
+
},
|
|
127
|
+
onChange: {
|
|
128
|
+
type: "eventHandler",
|
|
129
|
+
argTypes: [
|
|
130
|
+
{
|
|
131
|
+
name: "value",
|
|
132
|
+
type: {
|
|
133
|
+
type: "choice",
|
|
134
|
+
multiSelect: true,
|
|
135
|
+
options: getOptions
|
|
122
136
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
}
|
|
137
|
+
}
|
|
138
|
+
]
|
|
126
139
|
},
|
|
127
140
|
bordered: {
|
|
128
141
|
type: "boolean",
|
|
@@ -167,6 +180,14 @@ const collapsteMeta = {
|
|
|
167
180
|
hidePlaceholder: true
|
|
168
181
|
}
|
|
169
182
|
},
|
|
183
|
+
states: {
|
|
184
|
+
activeKey: {
|
|
185
|
+
type: "writable",
|
|
186
|
+
variableType: "array",
|
|
187
|
+
valueProp: "activeKey",
|
|
188
|
+
onChangeProp: "onChange"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
170
191
|
importPath: "@plasmicpkgs/antd/skinny/registerCollapse",
|
|
171
192
|
importName: "Collapse"
|
|
172
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerCollapse.cjs.js","sources":["../src/registerCollapse.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport type {\n CollapsePanelProps,\n CollapseProps as AntdCollapseProps,\n} from \"antd/es/collapse\";\nimport { Collapse as AntdCollapse } from \"antd\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\nexport const CollapsePanel = AntdCollapse.Panel;\n\nexport const collapstePanelMeta: ComponentMeta<CollapsePanelProps> = {\n name: \"AntdCollapsePanel\",\n displayName: \"Antd Collapse Panel\",\n props: {\n collapsible: {\n type: \"choice\",\n options: [\"header\", \"disabled\"],\n description:\n \"Specify whether the panel be collapsible or the trigger area of collapsible\",\n },\n forceRender: {\n type: \"boolean\",\n description:\n \"Forced render of content on panel, instead of lazy rending after clicking on header\",\n defaultValueHint: false,\n },\n header: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Header\",\n },\n ],\n },\n key: {\n type: \"string\",\n description: \"Unique key identifying the panel from among its siblings\",\n },\n showArrow: {\n type: \"boolean\",\n description: \"If false, panel will not show arrow icon\",\n defaultValueHint: true,\n },\n extra: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Insert text here\",\n },\n ],\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCollapse\",\n importName: \"CollapsePanel\",\n parentComponentName: \"AntdCollapse\",\n};\n\nexport function registerCollapsePanel(\n loader?: Registerable,\n customCollapsePanelMeta?: ComponentMeta<CollapsePanelProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(\n CollapsePanel,\n customCollapsePanelMeta ?? collapstePanelMeta\n );\n}\n\ntype CollapseProps = {\n openIcon?: React.ReactNode;\n closeIcon?: React.ReactNode;\n} & AntdCollapseProps;\n\nexport const collapsteMeta: ComponentMeta<CollapseProps> = {\n name: \"AntdCollapse\",\n displayName: \"Antd Collapse\",\n props: {\n accordion: {\n type: \"boolean\",\n description: \"If true, Collapse renders as Accordion\",\n defaultValueHint: false,\n },\n activeKey: {\n type: \"choice\",\n editOnly: true,\n
|
|
1
|
+
{"version":3,"file":"registerCollapse.cjs.js","sources":["../src/registerCollapse.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport type {\n CollapsePanelProps,\n CollapseProps as AntdCollapseProps,\n} from \"antd/es/collapse\";\nimport { Collapse as AntdCollapse } from \"antd\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\nexport const CollapsePanel = AntdCollapse.Panel;\n\nexport const collapstePanelMeta: ComponentMeta<CollapsePanelProps> = {\n name: \"AntdCollapsePanel\",\n displayName: \"Antd Collapse Panel\",\n props: {\n collapsible: {\n type: \"choice\",\n options: [\"header\", \"disabled\"],\n description:\n \"Specify whether the panel be collapsible or the trigger area of collapsible\",\n },\n forceRender: {\n type: \"boolean\",\n description:\n \"Forced render of content on panel, instead of lazy rending after clicking on header\",\n defaultValueHint: false,\n },\n header: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Header\",\n },\n ],\n },\n key: {\n type: \"string\",\n description: \"Unique key identifying the panel from among its siblings\",\n },\n showArrow: {\n type: \"boolean\",\n description: \"If false, panel will not show arrow icon\",\n defaultValueHint: true,\n },\n extra: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Insert text here\",\n },\n ],\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCollapse\",\n importName: \"CollapsePanel\",\n parentComponentName: \"AntdCollapse\",\n};\n\nexport function registerCollapsePanel(\n loader?: Registerable,\n customCollapsePanelMeta?: ComponentMeta<CollapsePanelProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(\n CollapsePanel,\n customCollapsePanelMeta ?? collapstePanelMeta\n );\n}\n\ntype CollapseProps = {\n openIcon?: React.ReactNode;\n closeIcon?: React.ReactNode;\n} & AntdCollapseProps;\n\nfunction getOptions(componentProps: CollapseProps) {\n const options = new Set<string>();\n // `children` is not defined in the Collapse props\n traverseReactEltTree((componentProps as any).children, (elt) => {\n if (elt?.type === CollapsePanel && typeof elt?.key === \"string\") {\n options.add(elt.key);\n }\n });\n return Array.from(options.keys());\n}\n\nexport const collapsteMeta: ComponentMeta<CollapseProps> = {\n name: \"AntdCollapse\",\n displayName: \"Antd Collapse\",\n props: {\n accordion: {\n type: \"boolean\",\n description: \"If true, Collapse renders as Accordion\",\n defaultValueHint: false,\n },\n activeKey: {\n type: \"choice\",\n editOnly: true,\n description: \"Key of the active panel\",\n multiSelect: true,\n options: getOptions,\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"value\",\n type: {\n type: \"choice\",\n multiSelect: true,\n options: getOptions,\n },\n },\n ],\n },\n bordered: {\n type: \"boolean\",\n description: \"Toggles rendering of the border around the collapse block\",\n defaultValueHint: true,\n },\n collapsible: {\n type: \"choice\",\n options: [\"header\", \"disabled\"],\n description:\n \"Specify whether the panels of children be collapsible or the trigger area of collapsible\",\n },\n expandIconPosition: {\n type: \"choice\",\n options: [\"left\", \"right\"],\n description: \"Set expand icon position\",\n defaultValueHint: \"left\",\n },\n ghost: {\n type: \"boolean\",\n description:\n \"Make the collapse borderless and its background transparent\",\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n allowedComponents: [\"AntdCollapsePanel\"],\n defaultValue: [\n {\n type: \"component\",\n name: \"AntdCollapsePanel\",\n props: {\n key: \"1\",\n },\n },\n ],\n },\n openIcon: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n closeIcon: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n },\n states: {\n activeKey: {\n type: \"writable\",\n variableType: \"array\",\n valueProp: \"activeKey\",\n onChangeProp: \"onChange\",\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCollapse\",\n importName: \"Collapse\",\n};\n\nexport function Collapse(props: CollapseProps) {\n const { openIcon, closeIcon, ...rest } = props;\n return (\n <AntdCollapse\n {...rest}\n expandIcon={\n openIcon || closeIcon\n ? ({ isActive }) => (isActive ? openIcon : closeIcon)\n : undefined\n }\n />\n );\n}\n\nexport function registerCollapse(\n loader?: Registerable,\n customCollapseMeta?: ComponentMeta<CollapseProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(Collapse, customCollapseMeta ?? collapsteMeta);\n}\n"],"names":["AntdCollapse","registerComponent","traverseReactEltTree","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,gBAAgBA,aAAa,CAAA,MAAA;AAEnC,MAAM,kBAAwD,GAAA;AAAA,EACnE,IAAM,EAAA,mBAAA;AAAA,EACN,WAAa,EAAA,qBAAA;AAAA,EACb,KAAO,EAAA;AAAA,IACL,WAAa,EAAA;AAAA,MACX,IAAM,EAAA,QAAA;AAAA,MACN,OAAA,EAAS,CAAC,QAAA,EAAU,UAAU,CAAA;AAAA,MAC9B,WACE,EAAA,6EAAA;AAAA,KACJ;AAAA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;AACd,EAAA;AAEO,SAAS,SAAS,KAAsB,EAAA;AAC7C,EAAyC,MAAA,EAAA,GAAA,KAAA,EAAjC,YAAU,SArLpB,EAAA,GAqL2C,IAAT,IAAS,GAAA,SAAA,CAAA,EAAA,EAAT,CAAxB,UAAU,EAAA,WAAA,CAAA,CAAA,CAAA;AAClB,EACE,uBAAAC,sBAAA,CAAA,aAAA;AAAA,IAACH,aAAA;AAAA,IAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EACK,IADL,CAAA,EAAA;AAAA,MAEC,UAAA,EACE,YAAY,SACR,GAAA,CAAC,EAAE,QAAS,EAAA,KAAO,QAAW,GAAA,QAAA,GAAW,SACzC,GAAA,KAAA,CAAA;AAAA,KAAA,CAAA;AAAA,GAER,CAAA;AAEJ,CAAA;AAEgB,SAAA,gBAAA,CACd,QACA,kBACA,EAAA;AACA,EAAM,MAAA,mBAAA,GAAgD,CAAI,GAAA,IAAA,KACxD,MAAS,GAAA,MAAA,CAAO,iBAAkB,CAAA,GAAG,IAAI,CAAA,GAAIC,kCAAkB,CAAA,GAAG,IAAI,CAAA,CAAA;AACxE,EAAoB,mBAAA,CAAA,QAAA,EAAU,kDAAsB,aAAa,CAAA,CAAA;AACnE;;;;;;;;;"}
|
|
@@ -92,6 +92,15 @@ function registerCollapsePanel(loader, customCollapsePanelMeta) {
|
|
|
92
92
|
customCollapsePanelMeta != null ? customCollapsePanelMeta : collapstePanelMeta
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
|
+
function getOptions(componentProps) {
|
|
96
|
+
const options = /* @__PURE__ */ new Set();
|
|
97
|
+
traverseReactEltTree(componentProps.children, (elt) => {
|
|
98
|
+
if ((elt == null ? void 0 : elt.type) === CollapsePanel && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
99
|
+
options.add(elt.key);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return Array.from(options.keys());
|
|
103
|
+
}
|
|
95
104
|
const collapsteMeta = {
|
|
96
105
|
name: "AntdCollapse",
|
|
97
106
|
displayName: "Antd Collapse",
|
|
@@ -104,18 +113,22 @@ const collapsteMeta = {
|
|
|
104
113
|
activeKey: {
|
|
105
114
|
type: "choice",
|
|
106
115
|
editOnly: true,
|
|
107
|
-
uncontrolledProp: "defaultActiveKey",
|
|
108
116
|
description: "Key of the active panel",
|
|
109
117
|
multiSelect: true,
|
|
110
|
-
options:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
options: getOptions
|
|
119
|
+
},
|
|
120
|
+
onChange: {
|
|
121
|
+
type: "eventHandler",
|
|
122
|
+
argTypes: [
|
|
123
|
+
{
|
|
124
|
+
name: "value",
|
|
125
|
+
type: {
|
|
126
|
+
type: "choice",
|
|
127
|
+
multiSelect: true,
|
|
128
|
+
options: getOptions
|
|
115
129
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}
|
|
130
|
+
}
|
|
131
|
+
]
|
|
119
132
|
},
|
|
120
133
|
bordered: {
|
|
121
134
|
type: "boolean",
|
|
@@ -160,6 +173,14 @@ const collapsteMeta = {
|
|
|
160
173
|
hidePlaceholder: true
|
|
161
174
|
}
|
|
162
175
|
},
|
|
176
|
+
states: {
|
|
177
|
+
activeKey: {
|
|
178
|
+
type: "writable",
|
|
179
|
+
variableType: "array",
|
|
180
|
+
valueProp: "activeKey",
|
|
181
|
+
onChangeProp: "onChange"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
163
184
|
importPath: "@plasmicpkgs/antd/skinny/registerCollapse",
|
|
164
185
|
importName: "Collapse"
|
|
165
186
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerCollapse.esm.js","sources":["../src/registerCollapse.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport type {\n CollapsePanelProps,\n CollapseProps as AntdCollapseProps,\n} from \"antd/es/collapse\";\nimport { Collapse as AntdCollapse } from \"antd\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\nexport const CollapsePanel = AntdCollapse.Panel;\n\nexport const collapstePanelMeta: ComponentMeta<CollapsePanelProps> = {\n name: \"AntdCollapsePanel\",\n displayName: \"Antd Collapse Panel\",\n props: {\n collapsible: {\n type: \"choice\",\n options: [\"header\", \"disabled\"],\n description:\n \"Specify whether the panel be collapsible or the trigger area of collapsible\",\n },\n forceRender: {\n type: \"boolean\",\n description:\n \"Forced render of content on panel, instead of lazy rending after clicking on header\",\n defaultValueHint: false,\n },\n header: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Header\",\n },\n ],\n },\n key: {\n type: \"string\",\n description: \"Unique key identifying the panel from among its siblings\",\n },\n showArrow: {\n type: \"boolean\",\n description: \"If false, panel will not show arrow icon\",\n defaultValueHint: true,\n },\n extra: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Insert text here\",\n },\n ],\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCollapse\",\n importName: \"CollapsePanel\",\n parentComponentName: \"AntdCollapse\",\n};\n\nexport function registerCollapsePanel(\n loader?: Registerable,\n customCollapsePanelMeta?: ComponentMeta<CollapsePanelProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(\n CollapsePanel,\n customCollapsePanelMeta ?? collapstePanelMeta\n );\n}\n\ntype CollapseProps = {\n openIcon?: React.ReactNode;\n closeIcon?: React.ReactNode;\n} & AntdCollapseProps;\n\nexport const collapsteMeta: ComponentMeta<CollapseProps> = {\n name: \"AntdCollapse\",\n displayName: \"Antd Collapse\",\n props: {\n accordion: {\n type: \"boolean\",\n description: \"If true, Collapse renders as Accordion\",\n defaultValueHint: false,\n },\n activeKey: {\n type: \"choice\",\n editOnly: true,\n
|
|
1
|
+
{"version":3,"file":"registerCollapse.esm.js","sources":["../src/registerCollapse.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport type {\n CollapsePanelProps,\n CollapseProps as AntdCollapseProps,\n} from \"antd/es/collapse\";\nimport { Collapse as AntdCollapse } from \"antd\";\nimport React from \"react\";\nimport { traverseReactEltTree } from \"./customControls\";\nimport { Registerable } from \"./registerable\";\nexport const CollapsePanel = AntdCollapse.Panel;\n\nexport const collapstePanelMeta: ComponentMeta<CollapsePanelProps> = {\n name: \"AntdCollapsePanel\",\n displayName: \"Antd Collapse Panel\",\n props: {\n collapsible: {\n type: \"choice\",\n options: [\"header\", \"disabled\"],\n description:\n \"Specify whether the panel be collapsible or the trigger area of collapsible\",\n },\n forceRender: {\n type: \"boolean\",\n description:\n \"Forced render of content on panel, instead of lazy rending after clicking on header\",\n defaultValueHint: false,\n },\n header: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Header\",\n },\n ],\n },\n key: {\n type: \"string\",\n description: \"Unique key identifying the panel from among its siblings\",\n },\n showArrow: {\n type: \"boolean\",\n description: \"If false, panel will not show arrow icon\",\n defaultValueHint: true,\n },\n extra: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n children: {\n type: \"slot\",\n defaultValue: [\n {\n type: \"text\",\n value: \"Insert text here\",\n },\n ],\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCollapse\",\n importName: \"CollapsePanel\",\n parentComponentName: \"AntdCollapse\",\n};\n\nexport function registerCollapsePanel(\n loader?: Registerable,\n customCollapsePanelMeta?: ComponentMeta<CollapsePanelProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(\n CollapsePanel,\n customCollapsePanelMeta ?? collapstePanelMeta\n );\n}\n\ntype CollapseProps = {\n openIcon?: React.ReactNode;\n closeIcon?: React.ReactNode;\n} & AntdCollapseProps;\n\nfunction getOptions(componentProps: CollapseProps) {\n const options = new Set<string>();\n // `children` is not defined in the Collapse props\n traverseReactEltTree((componentProps as any).children, (elt) => {\n if (elt?.type === CollapsePanel && typeof elt?.key === \"string\") {\n options.add(elt.key);\n }\n });\n return Array.from(options.keys());\n}\n\nexport const collapsteMeta: ComponentMeta<CollapseProps> = {\n name: \"AntdCollapse\",\n displayName: \"Antd Collapse\",\n props: {\n accordion: {\n type: \"boolean\",\n description: \"If true, Collapse renders as Accordion\",\n defaultValueHint: false,\n },\n activeKey: {\n type: \"choice\",\n editOnly: true,\n description: \"Key of the active panel\",\n multiSelect: true,\n options: getOptions,\n },\n onChange: {\n type: \"eventHandler\",\n argTypes: [\n {\n name: \"value\",\n type: {\n type: \"choice\",\n multiSelect: true,\n options: getOptions,\n },\n },\n ],\n },\n bordered: {\n type: \"boolean\",\n description: \"Toggles rendering of the border around the collapse block\",\n defaultValueHint: true,\n },\n collapsible: {\n type: \"choice\",\n options: [\"header\", \"disabled\"],\n description:\n \"Specify whether the panels of children be collapsible or the trigger area of collapsible\",\n },\n expandIconPosition: {\n type: \"choice\",\n options: [\"left\", \"right\"],\n description: \"Set expand icon position\",\n defaultValueHint: \"left\",\n },\n ghost: {\n type: \"boolean\",\n description:\n \"Make the collapse borderless and its background transparent\",\n defaultValueHint: false,\n },\n children: {\n type: \"slot\",\n allowedComponents: [\"AntdCollapsePanel\"],\n defaultValue: [\n {\n type: \"component\",\n name: \"AntdCollapsePanel\",\n props: {\n key: \"1\",\n },\n },\n ],\n },\n openIcon: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n closeIcon: {\n type: \"slot\",\n hidePlaceholder: true,\n },\n },\n states: {\n activeKey: {\n type: \"writable\",\n variableType: \"array\",\n valueProp: \"activeKey\",\n onChangeProp: \"onChange\",\n },\n },\n importPath: \"@plasmicpkgs/antd/skinny/registerCollapse\",\n importName: \"Collapse\",\n};\n\nexport function Collapse(props: CollapseProps) {\n const { openIcon, closeIcon, ...rest } = props;\n return (\n <AntdCollapse\n {...rest}\n expandIcon={\n openIcon || closeIcon\n ? ({ isActive }) => (isActive ? openIcon : closeIcon)\n : undefined\n }\n />\n );\n}\n\nexport function registerCollapse(\n loader?: Registerable,\n customCollapseMeta?: ComponentMeta<CollapseProps>\n) {\n const doRegisterComponent: typeof registerComponent = (...args) =>\n loader ? loader.registerComponent(...args) : registerComponent(...args);\n doRegisterComponent(Collapse, customCollapseMeta ?? collapsteMeta);\n}\n"],"names":["AntdCollapse"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,gBAAgBA,UAAa,CAAA,MAAA;AAEnC,MAAM,kBAAwD,GAAA;AAAA,EACnE,IAAM,EAAA,mBAAA;AAAA,EACN,WAAa,EAAA,qBAAA;AAAA,EACb,KAAO,EAAA;AAAA,IACL,WAAa,EAAA;AAAA,MACX,IAAM,EAAA,QAAA;AAAA,MACN,OAAA,EAAS,CAAC,QAAA,EAAU,UAAU,CAAA;AAAA,MAC9B,WACE,EAAA,6EAAA;AAAA,KACJ;AAAA,IACA,WAAa,EAAA;AAAA,MACX,IAAM,EAAA,SAAA;AAAA,MACN,WACE,EAAA,qFAAA;AAAA,MACF,gBAAkB,EAAA,KAAA;AAAA,KACpB;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,IAAM,EAAA,MAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ;AAAA,UACE,IAAM,EAAA,MAAA;AAAA,UACN,KAAO,EAAA,QAAA;AAAA,SACT;AAAA,OACF;AAAA,KACF;AAAA,IACA,GAAK,EAAA;AAAA,MACH,IAAM,EAAA,QAAA;AAAA,MACN,WAAa,EAAA,0DAAA;AAAA,KACf;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,SAAA;AAAA,MACN,WAAa,EAAA,0CAAA;AAAA,MACb,gBAAkB,EAAA,IAAA;AAAA,KACpB;AAAA,IACA,KAAO,EAAA;AAAA,MACL,IAAM,EAAA,MAAA;AAAA,MACN,eAAiB,EAAA,IA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MAAA,CAAO,iBAAkB,CAAA,GAAG,IAAI,CAAA,GAAI,iBAAkB,CAAA,GAAG,IAAI,CAAA,CAAA;AACxE,EAAoB,mBAAA,CAAA,QAAA,EAAU,kDAAsB,aAAa,CAAA,CAAA;AACnE;;;;"}
|
|
@@ -165,6 +165,15 @@ function registerSubMenu(loader, customSubMenuMeta) {
|
|
|
165
165
|
const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent__default.default(...args);
|
|
166
166
|
doRegisterComponent(SubMenu, customSubMenuMeta != null ? customSubMenuMeta : subMenuMeta);
|
|
167
167
|
}
|
|
168
|
+
function getOpenKeysOptions(componentProps) {
|
|
169
|
+
const options = /* @__PURE__ */ new Set();
|
|
170
|
+
customControls.traverseReactEltTree(componentProps.children, (elt) => {
|
|
171
|
+
if ((elt == null ? void 0 : elt.type) === SubMenu && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
172
|
+
options.add(elt.key);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return Array.from(options.keys());
|
|
176
|
+
}
|
|
168
177
|
const menuMeta = {
|
|
169
178
|
name: "AntdMenu",
|
|
170
179
|
displayName: "Antd Menu",
|
|
@@ -197,18 +206,22 @@ const menuMeta = {
|
|
|
197
206
|
openKeys: {
|
|
198
207
|
type: "choice",
|
|
199
208
|
editOnly: true,
|
|
200
|
-
uncontrolledProp: "defaultOpenKeys",
|
|
201
209
|
description: "Array with the keys of default opened sub menus",
|
|
202
210
|
multiSelect: true,
|
|
203
|
-
options:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
options: getOpenKeysOptions
|
|
212
|
+
},
|
|
213
|
+
onOpenChange: {
|
|
214
|
+
type: "eventHandler",
|
|
215
|
+
argTypes: [
|
|
216
|
+
{
|
|
217
|
+
name: "openKeys",
|
|
218
|
+
type: {
|
|
219
|
+
type: "choice",
|
|
220
|
+
multiSelect: true,
|
|
221
|
+
options: getOpenKeysOptions
|
|
208
222
|
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
}
|
|
223
|
+
}
|
|
224
|
+
]
|
|
212
225
|
},
|
|
213
226
|
overflowedIndicator: {
|
|
214
227
|
type: "slot",
|
|
@@ -272,6 +285,14 @@ const menuMeta = {
|
|
|
272
285
|
]
|
|
273
286
|
}
|
|
274
287
|
},
|
|
288
|
+
states: {
|
|
289
|
+
openKeys: {
|
|
290
|
+
type: "writable",
|
|
291
|
+
variableType: "array",
|
|
292
|
+
valueProp: "openKeys",
|
|
293
|
+
onChangeProp: "onOpenChange"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
275
296
|
importPath: "@plasmicpkgs/antd/skinny/registerMenu",
|
|
276
297
|
importName: "Menu"
|
|
277
298
|
};
|