@next-libs/visual-builder 1.2.15 → 1.2.16
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/cjs/index.js +0 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/brick-visualization.js +0 -3
- package/dist/cjs/interfaces/brick-visualization.js.map +1 -1
- package/dist/cjs/interfaces/index.js +0 -4
- package/dist/cjs/interfaces/index.js.map +1 -1
- package/dist/cjs/utils/deepMatch.js +0 -7
- package/dist/cjs/utils/deepMatch.js.map +1 -1
- package/dist/cjs/utils/index.js +0 -2
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/visual-property-form/VisualPropertyForm.js +2 -48
- package/dist/cjs/visual-property-form/VisualPropertyForm.js.map +1 -1
- package/dist/cjs/visual-property-form/components/CodeEditor/CodeEditorFormItem.js +0 -11
- package/dist/cjs/visual-property-form/components/CodeEditor/CodeEditorFormItem.js.map +1 -1
- package/dist/cjs/visual-property-form/components/ColorEditor/ColorEditorItem.js +0 -19
- package/dist/cjs/visual-property-form/components/ColorEditor/ColorEditorItem.js.map +1 -1
- package/dist/cjs/visual-property-form/components/IconSelect/IconSelectFormItem.js +0 -5
- package/dist/cjs/visual-property-form/components/IconSelect/IconSelectFormItem.js.map +1 -1
- package/dist/cjs/visual-property-form/components/MenuEditor/MenuEditorItem.js +0 -9
- package/dist/cjs/visual-property-form/components/MenuEditor/MenuEditorItem.js.map +1 -1
- package/dist/cjs/visual-property-form/constant.js.map +1 -1
- package/dist/cjs/visual-property-form/processor.js +9 -45
- package/dist/cjs/visual-property-form/processor.js.map +1 -1
- package/dist/cjs/workbench-mini-action-bar/WorkbenchMiniActionBar.js +0 -11
- package/dist/cjs/workbench-mini-action-bar/WorkbenchMiniActionBar.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/brick-visualization.js +0 -3
- package/dist/esm/interfaces/brick-visualization.js.map +1 -1
- package/dist/esm/interfaces/index.js.map +1 -1
- package/dist/esm/utils/deepMatch.js +0 -5
- package/dist/esm/utils/deepMatch.js.map +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/visual-property-form/VisualPropertyForm.js +0 -25
- package/dist/esm/visual-property-form/VisualPropertyForm.js.map +1 -1
- package/dist/esm/visual-property-form/components/CodeEditor/CodeEditorFormItem.js +4 -9
- package/dist/esm/visual-property-form/components/CodeEditor/CodeEditorFormItem.js.map +1 -1
- package/dist/esm/visual-property-form/components/ColorEditor/ColorEditorItem.js +0 -9
- package/dist/esm/visual-property-form/components/ColorEditor/ColorEditorItem.js.map +1 -1
- package/dist/esm/visual-property-form/components/IconSelect/IconSelectFormItem.js.map +1 -1
- package/dist/esm/visual-property-form/components/MenuEditor/MenuEditorItem.js +0 -4
- package/dist/esm/visual-property-form/components/MenuEditor/MenuEditorItem.js.map +1 -1
- package/dist/esm/visual-property-form/constant.js.map +1 -1
- package/dist/esm/visual-property-form/processor.js +1 -27
- package/dist/esm/visual-property-form/processor.js.map +1 -1
- package/dist/esm/workbench-mini-action-bar/WorkbenchMiniActionBar.js +0 -3
- package/dist/esm/workbench-mini-action-bar/WorkbenchMiniActionBar.js.map +1 -1
- package/package.json +5 -5
- package/CHANGELOG.md +0 -145
|
@@ -17,7 +17,6 @@ import { matchNoramlMenuValue } from "./processor";
|
|
|
17
17
|
import { ItemModeType, Required } from "../interfaces";
|
|
18
18
|
export function LegacyVisualPropertyForm(props, ref) {
|
|
19
19
|
var _groupByType;
|
|
20
|
-
|
|
21
20
|
var theme = useCurrentTheme();
|
|
22
21
|
var {
|
|
23
22
|
projectId,
|
|
@@ -48,13 +47,11 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
48
47
|
var newValue = calculateValue(propertyTypeList, brickProperties, newTypeList);
|
|
49
48
|
form.setFieldsValue(newValue);
|
|
50
49
|
}, [propertyTypeList, brickProperties]);
|
|
51
|
-
|
|
52
50
|
var handleLabelClick = name => {
|
|
53
51
|
var selected = typeList.find(item => item.name === name);
|
|
54
52
|
var index = typeList.findIndex(item => item.name === name);
|
|
55
53
|
var nextMode = selected.mode === ItemModeType.Advanced ? ItemModeType.Normal : ItemModeType.Advanced;
|
|
56
54
|
var value = selected.value;
|
|
57
|
-
|
|
58
55
|
if (nextMode === ItemModeType.Normal) {
|
|
59
56
|
if (supportMenuType.includes(selected.type)) {
|
|
60
57
|
value = matchNoramlMenuValue(value);
|
|
@@ -64,7 +61,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
64
61
|
} else {
|
|
65
62
|
value = yamlStringify(selected.value);
|
|
66
63
|
}
|
|
67
|
-
|
|
68
64
|
form.setFieldsValue({
|
|
69
65
|
[name]: value
|
|
70
66
|
});
|
|
@@ -75,7 +71,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
75
71
|
});
|
|
76
72
|
setTypeList(newTypeList);
|
|
77
73
|
};
|
|
78
|
-
|
|
79
74
|
var renderLabel = (item, hideIcon) => {
|
|
80
75
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
81
76
|
title: item.description
|
|
@@ -86,10 +81,8 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
86
81
|
icon: item.mode === ItemModeType.Advanced ? labelIcon === null || labelIcon === void 0 ? void 0 : labelIcon.advanced : labelIcon.normal
|
|
87
82
|
})));
|
|
88
83
|
};
|
|
89
|
-
|
|
90
84
|
var renderEditorItem = (item, hideIcon) => {
|
|
91
85
|
var _item$editor;
|
|
92
|
-
|
|
93
86
|
return /*#__PURE__*/React.createElement(CodeEditorFormItem, {
|
|
94
87
|
key: item.name,
|
|
95
88
|
name: item.name,
|
|
@@ -101,7 +94,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
101
94
|
mode: (item === null || item === void 0 ? void 0 : (_item$editor = item.editor) === null || _item$editor === void 0 ? void 0 : _item$editor.model) || "brick_next_yaml"
|
|
102
95
|
});
|
|
103
96
|
};
|
|
104
|
-
|
|
105
97
|
var renderStringItem = item => {
|
|
106
98
|
return item.mode === ItemModeType.Advanced ? renderEditorItem(item) : /*#__PURE__*/React.createElement(Form.Item, {
|
|
107
99
|
key: item.name,
|
|
@@ -113,7 +105,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
113
105
|
}]
|
|
114
106
|
}, /*#__PURE__*/React.createElement(Input, null));
|
|
115
107
|
};
|
|
116
|
-
|
|
117
108
|
var renderBooleanItem = item => {
|
|
118
109
|
return item.mode === ItemModeType.Advanced ? renderEditorItem(item) : /*#__PURE__*/React.createElement(Form.Item, {
|
|
119
110
|
key: item.name,
|
|
@@ -129,7 +120,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
129
120
|
value: false
|
|
130
121
|
}, "false")));
|
|
131
122
|
};
|
|
132
|
-
|
|
133
123
|
var renderInputNumberItem = item => {
|
|
134
124
|
return item.mode === ItemModeType.Advanced ? renderEditorItem(item) : /*#__PURE__*/React.createElement(Form.Item, {
|
|
135
125
|
key: item.name,
|
|
@@ -141,7 +131,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
141
131
|
}]
|
|
142
132
|
}, /*#__PURE__*/React.createElement(InputNumber, null));
|
|
143
133
|
};
|
|
144
|
-
|
|
145
134
|
var renderStringListItem = item => {
|
|
146
135
|
return item.mode === ItemModeType.Advanced ? renderEditorItem(item) : /*#__PURE__*/React.createElement(Form.Item, {
|
|
147
136
|
key: item.name,
|
|
@@ -155,7 +144,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
155
144
|
mode: "tags"
|
|
156
145
|
}));
|
|
157
146
|
};
|
|
158
|
-
|
|
159
147
|
var renderIconItem = item => {
|
|
160
148
|
return /*#__PURE__*/React.createElement(IconSelectFormItem, {
|
|
161
149
|
key: item.name,
|
|
@@ -164,11 +152,9 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
164
152
|
required: item.required === Required.True
|
|
165
153
|
});
|
|
166
154
|
};
|
|
167
|
-
|
|
168
155
|
var renderCodeEditorItem = item => {
|
|
169
156
|
return renderEditorItem(item, true);
|
|
170
157
|
};
|
|
171
|
-
|
|
172
158
|
var renderColorItem = item => {
|
|
173
159
|
return /*#__PURE__*/React.createElement(ColorEditorItem, {
|
|
174
160
|
key: item.name,
|
|
@@ -177,7 +163,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
177
163
|
required: item.required === Required.True
|
|
178
164
|
});
|
|
179
165
|
};
|
|
180
|
-
|
|
181
166
|
var renderMenuItem = item => {
|
|
182
167
|
return item.mode === ItemModeType.Advanced ? renderEditorItem(item) : /*#__PURE__*/React.createElement(MenuEditorItem, {
|
|
183
168
|
projectId: projectId,
|
|
@@ -188,36 +173,27 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
188
173
|
menuSettingClick: menuSettingClick
|
|
189
174
|
});
|
|
190
175
|
};
|
|
191
|
-
|
|
192
176
|
var getFormItem = item => {
|
|
193
177
|
switch (item.type) {
|
|
194
178
|
case "string":
|
|
195
179
|
return renderStringItem(item);
|
|
196
|
-
|
|
197
180
|
case "string[]":
|
|
198
181
|
return renderStringListItem(item);
|
|
199
|
-
|
|
200
182
|
case "number":
|
|
201
183
|
return renderInputNumberItem(item);
|
|
202
|
-
|
|
203
184
|
case "boolean":
|
|
204
185
|
return renderBooleanItem(item);
|
|
205
|
-
|
|
206
186
|
case "MenuIcon":
|
|
207
187
|
return renderIconItem(item);
|
|
208
|
-
|
|
209
188
|
case "Color":
|
|
210
189
|
return renderColorItem(item);
|
|
211
|
-
|
|
212
190
|
case "Menu":
|
|
213
191
|
case "SidebarSubMenu":
|
|
214
192
|
return renderMenuItem(item);
|
|
215
|
-
|
|
216
193
|
default:
|
|
217
194
|
return renderCodeEditorItem(item);
|
|
218
195
|
}
|
|
219
196
|
};
|
|
220
|
-
|
|
221
197
|
var renderOthersItem = () => {
|
|
222
198
|
return /*#__PURE__*/React.createElement(CodeEditorFormItem, {
|
|
223
199
|
name: OTHER_FORM_ITEM_FIELD,
|
|
@@ -226,7 +202,6 @@ export function LegacyVisualPropertyForm(props, ref) {
|
|
|
226
202
|
maxLines: Infinity
|
|
227
203
|
});
|
|
228
204
|
};
|
|
229
|
-
|
|
230
205
|
return isEmpty(typeList) ? /*#__PURE__*/React.createElement(Empty, {
|
|
231
206
|
className: styles.empty,
|
|
232
207
|
description: emptyConfig === null || emptyConfig === void 0 ? void 0 : emptyConfig.description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualPropertyForm.js","names":["React","useEffect","useImperativeHandle","useState","Form","Input","InputNumber","Radio","Select","Tooltip","Collapse","Empty","useCurrentTheme","GeneralIcon","update","isNil","pick","upperFirst","isEmpty","styles","CodeEditorFormItem","IconSelectFormItem","ColorEditorItem","MenuEditorItem","ReactComponent","DarkEmpty","mergeProperties","calculateValue","groupByType","yamlStringify","OTHER_FORM_ITEM_FIELD","supportMenuType","matchNoramlMenuValue","ItemModeType","Required","LegacyVisualPropertyForm","props","ref","theme","projectId","labelIcon","propertyTypeList","brickProperties","brickInfo","emptyConfig","hiddenPropsCategory","menuSettingClick","form","useForm","typeList","setTypeList","validateFields","resetPropertyFields","properties","restValue","resetFields","getCurTypeList","map","item","newTypeList","newValue","setFieldsValue","handleLabelClick","name","selected","find","index","findIndex","nextMode","mode","Advanced","Normal","value","includes","type","$splice","renderLabel","hideIcon","description","iconContainer","advanced","normal","renderEditorItem","required","True","jsonSchema","schemaRef","editor","model","renderStringItem","message","renderBooleanItem","renderInputNumberItem","renderStringListItem","renderIconItem","renderCodeEditorItem","renderColorItem","renderMenuItem","getFormItem","renderOthersItem","Infinity","empty","PRESENTED_IMAGE_SIMPLE","imageStyle","onValuesChange","panelContainer","category","list","otherPanel","VisualPropertyForm","forwardRef"],"sources":["../../../src/visual-property-form/VisualPropertyForm.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from \"react\";\nimport {\n Form,\n Input,\n InputNumber,\n Radio,\n Select,\n Tooltip,\n Collapse,\n Empty,\n} from \"antd\";\nimport { EmptyProps } from \"antd/lib/empty\";\nimport { useCurrentTheme } from \"@next-core/brick-kit\";\nimport { MenuIcon } from \"@next-core/brick-types\";\nimport { GeneralIcon } from \"@next-libs/basic-components\";\nimport update from \"immutability-helper\";\nimport { isNil, pick, upperFirst, isEmpty } from \"lodash\";\nimport styles from \"./VisualPropertyForm.module.css\";\nimport { FormProps } from \"antd/lib/form\";\nimport { CodeEditorFormItem } from \"./components/CodeEditor/CodeEditorFormItem\";\nimport { IconSelectFormItem } from \"./components/IconSelect/IconSelectFormItem\";\nimport { ColorEditorItem } from \"./components/ColorEditor/ColorEditorItem\";\nimport { MenuEditorItem } from \"./components/MenuEditor/MenuEditorItem\";\nimport { ReactComponent as DarkEmpty } from \"./images/empty-dark.svg\";\nimport {\n mergeProperties,\n calculateValue,\n groupByType,\n yamlStringify,\n} from \"./processor\";\nimport { OTHER_FORM_ITEM_FIELD, supportMenuType } from \"./constant\";\nimport { matchNoramlMenuValue } from \"./processor\";\nimport {\n PropertyType,\n BrickProperties,\n visualFormUtils,\n ItemModeType,\n UnionPropertyType,\n Required,\n} from \"../interfaces\";\n\nexport interface VisualPropertyFormProps {\n projectId?: string;\n propertyTypeList: PropertyType[];\n labelIcon: {\n normal?: MenuIcon;\n advanced?: MenuIcon;\n };\n brickProperties: BrickProperties;\n onValuesChange?: FormProps[\"onValuesChange\"];\n brickInfo?: {\n type: \"brick\" | \"provider\" | \"template\";\n };\n emptyConfig?: EmptyProps;\n menuSettingClick?: () => void;\n hiddenPropsCategory?: boolean;\n}\n\nexport function LegacyVisualPropertyForm(\n props: VisualPropertyFormProps,\n ref: React.Ref<visualFormUtils>\n): React.ReactElement {\n const theme = useCurrentTheme();\n const {\n projectId,\n labelIcon,\n propertyTypeList,\n brickProperties,\n brickInfo,\n emptyConfig,\n hiddenPropsCategory,\n menuSettingClick,\n } = props;\n const [form] = Form.useForm();\n const [typeList, setTypeList] = useState<UnionPropertyType[]>(\n mergeProperties(propertyTypeList, brickProperties)\n );\n\n useImperativeHandle(ref, () => ({\n validateFields: form.validateFields,\n resetPropertyFields: (\n typeList: PropertyType[],\n properties: BrickProperties\n ) => {\n const restValue = mergeProperties(typeList, properties);\n setTypeList(restValue);\n form.resetFields();\n },\n getCurTypeList: (): UnionPropertyType[] => {\n return typeList?.map((item) => pick(item, [\"name\", \"type\", \"mode\"]));\n },\n }));\n\n useEffect(() => {\n const newTypeList = mergeProperties(propertyTypeList, brickProperties);\n setTypeList(newTypeList);\n\n const newValue = calculateValue(\n propertyTypeList,\n brickProperties,\n newTypeList\n );\n form.setFieldsValue(newValue);\n }, [propertyTypeList, brickProperties]);\n\n const handleLabelClick = (name: string): void => {\n const selected = typeList.find((item) => item.name === name);\n const index = typeList.findIndex((item) => item.name === name);\n const nextMode =\n selected.mode === ItemModeType.Advanced\n ? ItemModeType.Normal\n : ItemModeType.Advanced;\n\n let value = selected.value;\n if (nextMode === ItemModeType.Normal) {\n if (supportMenuType.includes(selected.type as string)) {\n value = matchNoramlMenuValue(value);\n }\n } else if (isNil(selected.value)) {\n value = \"\";\n } else {\n value = yamlStringify(selected.value);\n }\n form.setFieldsValue({\n [name]: value,\n });\n const newTypeList = update(typeList, {\n $splice: [[index, 1, { ...selected, mode: nextMode }]],\n });\n setTypeList(newTypeList);\n };\n\n const renderLabel = (\n item: UnionPropertyType,\n hideIcon?: boolean\n ): React.ReactElement => {\n return (\n <span>\n <Tooltip title={item.description}>{item.name}</Tooltip>{\" \"}\n {!hideIcon && labelIcon && (\n <span\n className={styles.iconContainer}\n onClick={() => handleLabelClick(item.name)}\n >\n <GeneralIcon\n icon={\n item.mode === ItemModeType.Advanced\n ? labelIcon?.advanced\n : labelIcon.normal\n }\n />\n </span>\n )}\n </span>\n );\n };\n\n const renderEditorItem = (\n item: UnionPropertyType,\n hideIcon?: boolean\n ): React.ReactElement => {\n return (\n <CodeEditorFormItem\n key={item.name}\n name={item.name}\n label={renderLabel(item, hideIcon) as any}\n required={item.required === Required.True}\n theme={theme === \"dark-v2\" ? \"monokai\" : \"tomorrow\"}\n jsonSchema={item?.jsonSchema}\n schemaRef={item?.schemaRef}\n mode={item?.editor?.model || \"brick_next_yaml\"}\n />\n );\n };\n\n const renderStringItem = (item: UnionPropertyType): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <Input />\n </Form.Item>\n );\n };\n\n const renderBooleanItem = (item: UnionPropertyType): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <Radio.Group>\n <Radio value={true}>true</Radio>\n <Radio value={false}>false</Radio>\n </Radio.Group>\n </Form.Item>\n );\n };\n\n const renderInputNumberItem = (\n item: UnionPropertyType\n ): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <InputNumber />\n </Form.Item>\n );\n };\n\n const renderStringListItem = (\n item: UnionPropertyType\n ): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <Select mode=\"tags\" />\n </Form.Item>\n );\n };\n\n const renderIconItem = (item: UnionPropertyType): React.ReactElement => {\n return (\n <IconSelectFormItem\n key={item.name}\n name={item.name}\n label={renderLabel(item, true) as any}\n required={item.required === Required.True}\n />\n );\n };\n\n const renderCodeEditorItem = (item: PropertyType): React.ReactElement => {\n return renderEditorItem(item, true);\n };\n\n const renderColorItem = (item: PropertyType): React.ReactElement => {\n return (\n <ColorEditorItem\n key={item.name}\n name={item.name}\n label={renderLabel(item, true)}\n required={item.required === Required.True}\n />\n );\n };\n\n const renderMenuItem = (item: UnionPropertyType): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <MenuEditorItem\n projectId={projectId}\n key={item.name}\n name={item.name}\n label={renderLabel(item)}\n required={item.required === Required.True}\n menuSettingClick={menuSettingClick}\n />\n );\n };\n\n const getFormItem = (item: PropertyType): React.ReactElement => {\n switch (item.type) {\n case \"string\":\n return renderStringItem(item);\n case \"string[]\":\n return renderStringListItem(item);\n case \"number\":\n return renderInputNumberItem(item);\n case \"boolean\":\n return renderBooleanItem(item);\n case \"MenuIcon\":\n return renderIconItem(item);\n case \"Color\":\n return renderColorItem(item);\n case \"Menu\":\n case \"SidebarSubMenu\":\n return renderMenuItem(item);\n default:\n return renderCodeEditorItem(item);\n }\n };\n\n const renderOthersItem = (): React.ReactElement => {\n return (\n <CodeEditorFormItem\n name={OTHER_FORM_ITEM_FIELD}\n label={\n brickInfo?.type === \"template\" ? \"other params\" : \"other properties\"\n }\n mode=\"brick_next_yaml\"\n maxLines={Infinity}\n />\n );\n };\n\n return isEmpty(typeList) ? (\n <Empty\n className={styles.empty}\n description={emptyConfig?.description}\n image={theme === \"dark-v2\" ? <DarkEmpty /> : Empty.PRESENTED_IMAGE_SIMPLE}\n imageStyle={emptyConfig?.imageStyle}\n />\n ) : (\n <Form\n name=\"propertyForm\"\n layout=\"vertical\"\n form={form}\n onValuesChange={props.onValuesChange}\n initialValues={calculateValue(\n propertyTypeList,\n brickProperties,\n typeList\n )}\n >\n {!hiddenPropsCategory ? (\n <Collapse ghost defaultActiveKey=\"0\" className={styles.panelContainer}>\n {groupByType(typeList)?.map(([category, list], index) => {\n return (\n <Collapse.Panel\n header={upperFirst(category)}\n key={index}\n forceRender={true}\n >\n {list.map((item) => getFormItem(item))}\n </Collapse.Panel>\n );\n })}\n\n <Collapse.Panel\n className={styles.otherPanel}\n forceRender={true}\n header={upperFirst(OTHER_FORM_ITEM_FIELD)}\n key={OTHER_FORM_ITEM_FIELD}\n >\n {renderOthersItem()}\n </Collapse.Panel>\n </Collapse>\n ) : (\n <>\n {typeList?.map((item) => {\n return getFormItem(item);\n })}\n <div className={styles.otherPanel}>{renderOthersItem()}</div>\n </>\n )}\n </Form>\n );\n}\n\nexport const VisualPropertyForm = React.forwardRef(LegacyVisualPropertyForm);\n"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,mBAA3B,EAAgDC,QAAhD,QAAgE,OAAhE;AACA,SACEC,IADF,EAEEC,KAFF,EAGEC,WAHF,EAIEC,KAJF,EAKEC,MALF,EAMEC,OANF,EAOEC,QAPF,EAQEC,KARF,QASO,MATP;AAWA,SAASC,eAAT,QAAgC,sBAAhC;AAEA,SAASC,WAAT,QAA4B,6BAA5B;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SAASC,KAAT,EAAgBC,IAAhB,EAAsBC,UAAtB,EAAkCC,OAAlC,QAAiD,QAAjD;AACA,OAAOC,MAAP,MAAmB,iCAAnB;AAEA,SAASC,kBAAT,QAAmC,4CAAnC;AACA,SAASC,kBAAT,QAAmC,4CAAnC;AACA,SAASC,eAAT,QAAgC,0CAAhC;AACA,SAASC,cAAT,QAA+B,wCAA/B;AACA,SAASC,cAAc,IAAIC,SAA3B,QAA4C,yBAA5C;AACA,SACEC,eADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,aAJF,QAKO,aALP;AAMA,SAASC,qBAAT,EAAgCC,eAAhC,QAAuD,YAAvD;AACA,SAASC,oBAAT,QAAqC,aAArC;AACA,SAIEC,YAJF,EAMEC,QANF,QAOO,eAPP;AA0BA,OAAO,SAASC,wBAAT,CACLC,KADK,EAELC,GAFK,EAGe;EAAA;;EACpB,IAA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;IAGE,MAAM,EAAE3F,UAAU,CAACa,qBAAD,CAHpB;IAIE,GAAG,EAAEA;EAJP,GAMGqE,gBAAgB,EANnB,CAbF,CADD,gBAwBC,0CACGlD,QADH,aACGA,QADH,uBACGA,QAAQ,CAAEQ,GAAV,CAAeC,IAAD,IAAU;IACvB,OAAOwC,WAAW,CAACxC,IAAD,CAAlB;EACD,CAFA,CADH,eAIE;IAAK,SAAS,EAAEvC,MAAM,CAACyF;EAAvB,GAAoCT,gBAAgB,EAApD,CAJF,CAnCJ,CARF;AAoDD;AAED,OAAO,IAAMU,kBAAkB,gBAAG7G,KAAK,CAAC8G,UAAN,CAAiB3E,wBAAjB,CAA3B"}
|
|
1
|
+
{"version":3,"file":"VisualPropertyForm.js","names":["React","useEffect","useImperativeHandle","useState","Form","Input","InputNumber","Radio","Select","Tooltip","Collapse","Empty","useCurrentTheme","GeneralIcon","update","isNil","pick","upperFirst","isEmpty","styles","CodeEditorFormItem","IconSelectFormItem","ColorEditorItem","MenuEditorItem","ReactComponent","DarkEmpty","mergeProperties","calculateValue","groupByType","yamlStringify","OTHER_FORM_ITEM_FIELD","supportMenuType","matchNoramlMenuValue","ItemModeType","Required","LegacyVisualPropertyForm","props","ref","theme","projectId","labelIcon","propertyTypeList","brickProperties","brickInfo","emptyConfig","hiddenPropsCategory","menuSettingClick","form","useForm","typeList","setTypeList","validateFields","resetPropertyFields","properties","restValue","resetFields","getCurTypeList","map","item","newTypeList","newValue","setFieldsValue","handleLabelClick","name","selected","find","index","findIndex","nextMode","mode","Advanced","Normal","value","includes","type","$splice","renderLabel","hideIcon","description","iconContainer","advanced","normal","renderEditorItem","required","True","jsonSchema","schemaRef","editor","model","renderStringItem","message","renderBooleanItem","renderInputNumberItem","renderStringListItem","renderIconItem","renderCodeEditorItem","renderColorItem","renderMenuItem","getFormItem","renderOthersItem","Infinity","empty","PRESENTED_IMAGE_SIMPLE","imageStyle","onValuesChange","panelContainer","category","list","otherPanel","VisualPropertyForm","forwardRef"],"sources":["../../../src/visual-property-form/VisualPropertyForm.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from \"react\";\nimport {\n Form,\n Input,\n InputNumber,\n Radio,\n Select,\n Tooltip,\n Collapse,\n Empty,\n} from \"antd\";\nimport { EmptyProps } from \"antd/lib/empty\";\nimport { useCurrentTheme } from \"@next-core/brick-kit\";\nimport { MenuIcon } from \"@next-core/brick-types\";\nimport { GeneralIcon } from \"@next-libs/basic-components\";\nimport update from \"immutability-helper\";\nimport { isNil, pick, upperFirst, isEmpty } from \"lodash\";\nimport styles from \"./VisualPropertyForm.module.css\";\nimport { FormProps } from \"antd/lib/form\";\nimport { CodeEditorFormItem } from \"./components/CodeEditor/CodeEditorFormItem\";\nimport { IconSelectFormItem } from \"./components/IconSelect/IconSelectFormItem\";\nimport { ColorEditorItem } from \"./components/ColorEditor/ColorEditorItem\";\nimport { MenuEditorItem } from \"./components/MenuEditor/MenuEditorItem\";\nimport { ReactComponent as DarkEmpty } from \"./images/empty-dark.svg\";\nimport {\n mergeProperties,\n calculateValue,\n groupByType,\n yamlStringify,\n} from \"./processor\";\nimport { OTHER_FORM_ITEM_FIELD, supportMenuType } from \"./constant\";\nimport { matchNoramlMenuValue } from \"./processor\";\nimport {\n PropertyType,\n BrickProperties,\n visualFormUtils,\n ItemModeType,\n UnionPropertyType,\n Required,\n} from \"../interfaces\";\n\nexport interface VisualPropertyFormProps {\n projectId?: string;\n propertyTypeList: PropertyType[];\n labelIcon: {\n normal?: MenuIcon;\n advanced?: MenuIcon;\n };\n brickProperties: BrickProperties;\n onValuesChange?: FormProps[\"onValuesChange\"];\n brickInfo?: {\n type: \"brick\" | \"provider\" | \"template\";\n };\n emptyConfig?: EmptyProps;\n menuSettingClick?: () => void;\n hiddenPropsCategory?: boolean;\n}\n\nexport function LegacyVisualPropertyForm(\n props: VisualPropertyFormProps,\n ref: React.Ref<visualFormUtils>\n): React.ReactElement {\n const theme = useCurrentTheme();\n const {\n projectId,\n labelIcon,\n propertyTypeList,\n brickProperties,\n brickInfo,\n emptyConfig,\n hiddenPropsCategory,\n menuSettingClick,\n } = props;\n const [form] = Form.useForm();\n const [typeList, setTypeList] = useState<UnionPropertyType[]>(\n mergeProperties(propertyTypeList, brickProperties)\n );\n\n useImperativeHandle(ref, () => ({\n validateFields: form.validateFields,\n resetPropertyFields: (\n typeList: PropertyType[],\n properties: BrickProperties\n ) => {\n const restValue = mergeProperties(typeList, properties);\n setTypeList(restValue);\n form.resetFields();\n },\n getCurTypeList: (): UnionPropertyType[] => {\n return typeList?.map((item) => pick(item, [\"name\", \"type\", \"mode\"]));\n },\n }));\n\n useEffect(() => {\n const newTypeList = mergeProperties(propertyTypeList, brickProperties);\n setTypeList(newTypeList);\n\n const newValue = calculateValue(\n propertyTypeList,\n brickProperties,\n newTypeList\n );\n form.setFieldsValue(newValue);\n }, [propertyTypeList, brickProperties]);\n\n const handleLabelClick = (name: string): void => {\n const selected = typeList.find((item) => item.name === name);\n const index = typeList.findIndex((item) => item.name === name);\n const nextMode =\n selected.mode === ItemModeType.Advanced\n ? ItemModeType.Normal\n : ItemModeType.Advanced;\n\n let value = selected.value;\n if (nextMode === ItemModeType.Normal) {\n if (supportMenuType.includes(selected.type as string)) {\n value = matchNoramlMenuValue(value);\n }\n } else if (isNil(selected.value)) {\n value = \"\";\n } else {\n value = yamlStringify(selected.value);\n }\n form.setFieldsValue({\n [name]: value,\n });\n const newTypeList = update(typeList, {\n $splice: [[index, 1, { ...selected, mode: nextMode }]],\n });\n setTypeList(newTypeList);\n };\n\n const renderLabel = (\n item: UnionPropertyType,\n hideIcon?: boolean\n ): React.ReactElement => {\n return (\n <span>\n <Tooltip title={item.description}>{item.name}</Tooltip>{\" \"}\n {!hideIcon && labelIcon && (\n <span\n className={styles.iconContainer}\n onClick={() => handleLabelClick(item.name)}\n >\n <GeneralIcon\n icon={\n item.mode === ItemModeType.Advanced\n ? labelIcon?.advanced\n : labelIcon.normal\n }\n />\n </span>\n )}\n </span>\n );\n };\n\n const renderEditorItem = (\n item: UnionPropertyType,\n hideIcon?: boolean\n ): React.ReactElement => {\n return (\n <CodeEditorFormItem\n key={item.name}\n name={item.name}\n label={renderLabel(item, hideIcon) as any}\n required={item.required === Required.True}\n theme={theme === \"dark-v2\" ? \"monokai\" : \"tomorrow\"}\n jsonSchema={item?.jsonSchema}\n schemaRef={item?.schemaRef}\n mode={item?.editor?.model || \"brick_next_yaml\"}\n />\n );\n };\n\n const renderStringItem = (item: UnionPropertyType): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <Input />\n </Form.Item>\n );\n };\n\n const renderBooleanItem = (item: UnionPropertyType): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <Radio.Group>\n <Radio value={true}>true</Radio>\n <Radio value={false}>false</Radio>\n </Radio.Group>\n </Form.Item>\n );\n };\n\n const renderInputNumberItem = (\n item: UnionPropertyType\n ): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <InputNumber />\n </Form.Item>\n );\n };\n\n const renderStringListItem = (\n item: UnionPropertyType\n ): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <Form.Item\n key={item.name}\n label={renderLabel(item)}\n name={item.name}\n rules={[\n {\n required: item.required === Required.True,\n message: `请输入${item.name}`,\n },\n ]}\n >\n <Select mode=\"tags\" />\n </Form.Item>\n );\n };\n\n const renderIconItem = (item: UnionPropertyType): React.ReactElement => {\n return (\n <IconSelectFormItem\n key={item.name}\n name={item.name}\n label={renderLabel(item, true) as any}\n required={item.required === Required.True}\n />\n );\n };\n\n const renderCodeEditorItem = (item: PropertyType): React.ReactElement => {\n return renderEditorItem(item, true);\n };\n\n const renderColorItem = (item: PropertyType): React.ReactElement => {\n return (\n <ColorEditorItem\n key={item.name}\n name={item.name}\n label={renderLabel(item, true)}\n required={item.required === Required.True}\n />\n );\n };\n\n const renderMenuItem = (item: UnionPropertyType): React.ReactElement => {\n return item.mode === ItemModeType.Advanced ? (\n renderEditorItem(item)\n ) : (\n <MenuEditorItem\n projectId={projectId}\n key={item.name}\n name={item.name}\n label={renderLabel(item)}\n required={item.required === Required.True}\n menuSettingClick={menuSettingClick}\n />\n );\n };\n\n const getFormItem = (item: PropertyType): React.ReactElement => {\n switch (item.type) {\n case \"string\":\n return renderStringItem(item);\n case \"string[]\":\n return renderStringListItem(item);\n case \"number\":\n return renderInputNumberItem(item);\n case \"boolean\":\n return renderBooleanItem(item);\n case \"MenuIcon\":\n return renderIconItem(item);\n case \"Color\":\n return renderColorItem(item);\n case \"Menu\":\n case \"SidebarSubMenu\":\n return renderMenuItem(item);\n default:\n return renderCodeEditorItem(item);\n }\n };\n\n const renderOthersItem = (): React.ReactElement => {\n return (\n <CodeEditorFormItem\n name={OTHER_FORM_ITEM_FIELD}\n label={\n brickInfo?.type === \"template\" ? \"other params\" : \"other properties\"\n }\n mode=\"brick_next_yaml\"\n maxLines={Infinity}\n />\n );\n };\n\n return isEmpty(typeList) ? (\n <Empty\n className={styles.empty}\n description={emptyConfig?.description}\n image={theme === \"dark-v2\" ? <DarkEmpty /> : Empty.PRESENTED_IMAGE_SIMPLE}\n imageStyle={emptyConfig?.imageStyle}\n />\n ) : (\n <Form\n name=\"propertyForm\"\n layout=\"vertical\"\n form={form}\n onValuesChange={props.onValuesChange}\n initialValues={calculateValue(\n propertyTypeList,\n brickProperties,\n typeList\n )}\n >\n {!hiddenPropsCategory ? (\n <Collapse ghost defaultActiveKey=\"0\" className={styles.panelContainer}>\n {groupByType(typeList)?.map(([category, list], index) => {\n return (\n <Collapse.Panel\n header={upperFirst(category)}\n key={index}\n forceRender={true}\n >\n {list.map((item) => getFormItem(item))}\n </Collapse.Panel>\n );\n })}\n\n <Collapse.Panel\n className={styles.otherPanel}\n forceRender={true}\n header={upperFirst(OTHER_FORM_ITEM_FIELD)}\n key={OTHER_FORM_ITEM_FIELD}\n >\n {renderOthersItem()}\n </Collapse.Panel>\n </Collapse>\n ) : (\n <>\n {typeList?.map((item) => {\n return getFormItem(item);\n })}\n <div className={styles.otherPanel}>{renderOthersItem()}</div>\n </>\n )}\n </Form>\n );\n}\n\nexport const VisualPropertyForm = React.forwardRef(LegacyVisualPropertyForm);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,mBAAmB,EAAEC,QAAQ,QAAQ,OAAO;AACvE,SACEC,IAAI,EACJC,KAAK,EACLC,WAAW,EACXC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,KAAK,QACA,MAAM;AAEb,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,WAAW,QAAQ,6BAA6B;AACzD,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,KAAK,EAAEC,IAAI,EAAEC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AACzD,OAAOC,MAAM,MAAM,iCAAiC;AAEpD,SAASC,kBAAkB,QAAQ,4CAA4C;AAC/E,SAASC,kBAAkB,QAAQ,4CAA4C;AAC/E,SAASC,eAAe,QAAQ,0CAA0C;AAC1E,SAASC,cAAc,QAAQ,wCAAwC;AACvE,SAASC,cAAc,IAAIC,SAAS,QAAQ,yBAAyB;AACrE,SACEC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,aAAa,QACR,aAAa;AACpB,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,YAAY;AACnE,SAASC,oBAAoB,Q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AC,QAAQ,CAAC,KAAK;IACb,SAAS,EAAEvC,MAAM,CAACyF,UAAW;IAC7B,WAAW,EAAE,IAAK;IAClB,MAAM,EAAE3F,UAAU,CAACa,qBAAqB,CAAE;IAC1C,GAAG,EAAEA;EAAsB,GAE1BqE,gBAAgB,EAAE,CACJ,CACR,gBAEX,0CACGlD,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEQ,GAAG,CAAEC,IAAI,IAAK;IACvB,OAAOwC,WAAW,CAACxC,IAAI,CAAC;EAC1B,CAAC,CAAC,eACF;IAAK,SAAS,EAAEvC,MAAM,CAACyF;EAAW,GAAET,gBAAgB,EAAE,CAAO,CAEhE,CAEJ;AACH;AAEA,OAAO,IAAMU,kBAAkB,gBAAG7G,KAAK,CAAC8G,UAAU,CAAC3E,wBAAwB,CAAC"}
|
|
@@ -8,18 +8,15 @@ import { Form } from "antd";
|
|
|
8
8
|
import { CodeEditorItem } from "@next-libs/code-editor-components";
|
|
9
9
|
export function CodeEditorFormItem(props) {
|
|
10
10
|
var {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
name,
|
|
12
|
+
label
|
|
13
|
+
} = props,
|
|
14
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
16
15
|
var [hasError, setHasError] = useState(false);
|
|
17
|
-
|
|
18
16
|
var handleValidate = err => {
|
|
19
17
|
var error = some(err, ["type", "error"]);
|
|
20
18
|
setHasError(error);
|
|
21
19
|
};
|
|
22
|
-
|
|
23
20
|
var validatorFn = /*#__PURE__*/function () {
|
|
24
21
|
var _ref = _asyncToGenerator(function* () {
|
|
25
22
|
if (!hasError) {
|
|
@@ -28,12 +25,10 @@ export function CodeEditorFormItem(props) {
|
|
|
28
25
|
return Promise.reject("请填写正确的 yaml 语法");
|
|
29
26
|
}
|
|
30
27
|
});
|
|
31
|
-
|
|
32
28
|
return function validatorFn() {
|
|
33
29
|
return _ref.apply(this, arguments);
|
|
34
30
|
};
|
|
35
31
|
}();
|
|
36
|
-
|
|
37
32
|
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
38
33
|
key: props.name,
|
|
39
34
|
name: props.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditorFormItem.js","names":["React","useState","some","Form","CodeEditorItem","CodeEditorFormItem","props","name","label","rest","hasError","setHasError","handleValidate","err","error","validatorFn","Promise","resolve","reject","required","message","validator"],"sources":["../../../../../src/visual-property-form/components/CodeEditor/CodeEditorFormItem.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { some } from \"lodash\";\nimport { Form } from \"antd\";\nimport { FormItemWrapperProps } from \"@next-libs/forms\";\nimport {\n CodeEditorProps,\n CodeEditorItem,\n Error,\n} from \"@next-libs/code-editor-components\";\n\ninterface CodeEditorItemProps extends CodeEditorProps, FormItemWrapperProps {}\n\nexport function CodeEditorFormItem(\n props: CodeEditorItemProps\n): React.ReactElement {\n const { name, label, ...rest } = props;\n const [hasError, setHasError] = useState(false);\n\n const handleValidate = (err: Error[\"err\"]): void => {\n const error = some(err, [\"type\", \"error\"]);\n setHasError(error);\n };\n\n const validatorFn = async () => {\n if (!hasError) {\n return Promise.resolve();\n } else {\n return Promise.reject(\"请填写正确的 yaml 语法\");\n }\n };\n\n return (\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[\n { required: props.required, message: `请输入${props.name}` },\n { validator: validatorFn },\n ]}\n >\n <CodeEditorItem\n tabSize={2}\n minLines={5}\n maxLines={12}\n printMargin={false}\n showLineNumbers={false}\n showCopyButton={true}\n showExpandButton={true}\n theme=\"tomorrow\"\n enableLiveAutocompletion={true}\n onValidate={handleValidate}\n {...rest}\n ></CodeEditorItem>\n </Form.Item>\n );\n}\n"],"mappings":";;;;AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"CodeEditorFormItem.js","names":["React","useState","some","Form","CodeEditorItem","CodeEditorFormItem","props","name","label","rest","hasError","setHasError","handleValidate","err","error","validatorFn","Promise","resolve","reject","required","message","validator"],"sources":["../../../../../src/visual-property-form/components/CodeEditor/CodeEditorFormItem.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { some } from \"lodash\";\nimport { Form } from \"antd\";\nimport { FormItemWrapperProps } from \"@next-libs/forms\";\nimport {\n CodeEditorProps,\n CodeEditorItem,\n Error,\n} from \"@next-libs/code-editor-components\";\n\ninterface CodeEditorItemProps extends CodeEditorProps, FormItemWrapperProps {}\n\nexport function CodeEditorFormItem(\n props: CodeEditorItemProps\n): React.ReactElement {\n const { name, label, ...rest } = props;\n const [hasError, setHasError] = useState(false);\n\n const handleValidate = (err: Error[\"err\"]): void => {\n const error = some(err, [\"type\", \"error\"]);\n setHasError(error);\n };\n\n const validatorFn = async () => {\n if (!hasError) {\n return Promise.resolve();\n } else {\n return Promise.reject(\"请填写正确的 yaml 语法\");\n }\n };\n\n return (\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[\n { required: props.required, message: `请输入${props.name}` },\n { validator: validatorFn },\n ]}\n >\n <CodeEditorItem\n tabSize={2}\n minLines={5}\n maxLines={12}\n printMargin={false}\n showLineNumbers={false}\n showCopyButton={true}\n showExpandButton={true}\n theme=\"tomorrow\"\n enableLiveAutocompletion={true}\n onValidate={handleValidate}\n {...rest}\n ></CodeEditorItem>\n </Form.Item>\n );\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,IAAI,QAAQ,MAAM;AAE3B,SAEEC,cAAc,QAET,mCAAmC;AAI1C,OAAO,SAASC,kBAAkB,CAChCC,KAA0B,EACN;EACpB,IAAM;MAAEC,IAAI;MAAEC;IAAe,CAAC,GAAGF,KAAK;IAAdG,IAAI,4BAAKH,KAAK;EACtC,IAAM,CAACI,QAAQ,EAAEC,WAAW,CAAC,GAAGV,QAAQ,CAAC,KAAK,CAAC;EAE/C,IAAMW,cAAc,GAAIC,GAAiB,IAAW;IAClD,IAAMC,KAAK,GAAGZ,IAAI,CAACW,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1CF,WAAW,CAACG,KAAK,CAAC;EACpB,CAAC;EAED,IAAMC,WAAW;IAAA,6BAAG,aAAY;MAC9B,IAAI,CAACL,QAAQ,EAAE;QACb,OAAOM,OAAO,CAACC,OAAO,EAAE;MAC1B,CAAC,MAAM;QACL,OAAOD,OAAO,CAACE,MAAM,CAAC,gBAAgB,CAAC;MACzC;IACF,CAAC;IAAA,gBANKH,WAAW;MAAA;IAAA;EAAA,GAMhB;EAED,oBACE,oBAAC,IAAI,CAAC,IAAI;IACR,GAAG,EAAET,KAAK,CAACC,IAAK;IAChB,IAAI,EAAED,KAAK,CAACC,IAAK;IACjB,KAAK,EAAED,KAAK,CAACE,KAAM;IACnB,KAAK,EAAE,CACL;MAAEW,QAAQ,EAAEb,KAAK,CAACa,QAAQ;MAAEC,OAAO,8BAAQd,KAAK,CAACC,IAAI;IAAG,CAAC,EACzD;MAAEc,SAAS,EAAEN;IAAY,CAAC;EAC1B,gBAEF,oBAAC,cAAc;IACb,OAAO,EAAE,CAAE;IACX,QAAQ,EAAE,CAAE;IACZ,QAAQ,EAAE,EAAG;IACb,WAAW,EAAE,KAAM;IACnB,eAAe,EAAE,KAAM;IACvB,cAAc,EAAE,IAAK;IACrB,gBAAgB,EAAE,IAAK;IACvB,KAAK,EAAC,UAAU;IAChB,wBAAwB,EAAE,IAAK;IAC/B,UAAU,EAAEH;EAAe,GACvBH,IAAI,EACQ,CACR;AAEhB"}
|
|
@@ -5,26 +5,20 @@ import React, { useEffect, useState, forwardRef } from "react";
|
|
|
5
5
|
import styles from "./ColorEditor.module.css";
|
|
6
6
|
export function getPresetColors(colorMap) {
|
|
7
7
|
var colorList = [];
|
|
8
|
-
|
|
9
8
|
var _loop = function (group) {
|
|
10
9
|
["color", "background", "borderColor"].forEach(name => {
|
|
11
10
|
var _name;
|
|
12
|
-
|
|
13
11
|
var result = (_name = group[name]) === null || _name === void 0 ? void 0 : _name.match(/^var\((.+)\)/);
|
|
14
|
-
|
|
15
12
|
if (result) {
|
|
16
13
|
var _window$getComputedSt;
|
|
17
|
-
|
|
18
14
|
var colorHex = (_window$getComputedSt = window.getComputedStyle(document.documentElement).getPropertyValue(result[1])) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.trim();
|
|
19
15
|
colorHex && colorList.push(colorHex);
|
|
20
16
|
}
|
|
21
17
|
});
|
|
22
18
|
};
|
|
23
|
-
|
|
24
19
|
for (var [, group] of Object.entries(colorMap)) {
|
|
25
20
|
_loop(group);
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
return colorList;
|
|
29
23
|
}
|
|
30
24
|
export function LegacyColorPick(props, ref) {
|
|
@@ -33,16 +27,13 @@ export function LegacyColorPick(props, ref) {
|
|
|
33
27
|
useEffect(() => {
|
|
34
28
|
setValue(props.value);
|
|
35
29
|
}, [props.value]);
|
|
36
|
-
|
|
37
30
|
var handleChangeComplete = color => {
|
|
38
31
|
setValue(color.hex);
|
|
39
32
|
props.onChange(color.hex);
|
|
40
33
|
};
|
|
41
|
-
|
|
42
34
|
var handleClick = () => {
|
|
43
35
|
setVisible(true);
|
|
44
36
|
};
|
|
45
|
-
|
|
46
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
38
|
className: styles.colorContainer
|
|
48
39
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorEditorItem.js","names":["SketchPicker","COLORS_MAP","Form","React","useEffect","useState","forwardRef","styles","getPresetColors","colorMap","colorList","group","forEach","name","result","match","colorHex","window","getComputedStyle","document","documentElement","getPropertyValue","trim","push","Object","entries","LegacyColorPick","props","ref","value","setValue","visible","setVisible","handleChangeComplete","color","hex","onChange","handleClick","colorContainer","colorCube","colorContent","backgroundColor","popover","cover","ColorPick","ColorEditorItem","label","required","message"],"sources":["../../../../../src/visual-property-form/components/ColorEditor/ColorEditorItem.tsx"],"sourcesContent":["import { ColorResult, SketchPicker } from \"react-color\";\nimport { COLORS_MAP, Colors } from \"@next-libs/basic-components\";\nimport { Form } from \"antd\";\nimport React, { useEffect, useState, forwardRef } from \"react\";\nimport styles from \"./ColorEditor.module.css\";\n\nexport interface ColorEditorItemProps {\n name?: string;\n label?: string | React.ReactElement;\n required?: boolean;\n value?: any;\n onChange?: (value: string) => void;\n}\n\nexport function getPresetColors(\n colorMap: Record<\n Colors,\n {\n color: string;\n background: string;\n borderColor: string;\n }\n >\n): string[] {\n const colorList: string[] = [];\n for (const [, group] of Object.entries(colorMap)) {\n [\"color\", \"background\", \"borderColor\"].forEach((name) => {\n const result = (group as Record<string, any>)[name]?.match(\n /^var\\((.+)\\)/\n );\n if (result) {\n const colorHex = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(result[1])\n ?.trim();\n colorHex && colorList.push(colorHex);\n }\n });\n }\n\n return colorList;\n}\n\nexport function LegacyColorPick(\n props: ColorEditorItemProps,\n ref: React.Ref<any>\n) {\n const [value, setValue] = useState(props.value);\n const [visible, setVisible] = useState(false);\n\n useEffect(() => {\n setValue(props.value);\n }, [props.value]);\n\n const handleChangeComplete = (color: ColorResult) => {\n setValue(color.hex);\n props.onChange(color.hex);\n };\n\n const handleClick = () => {\n setVisible(true);\n };\n\n return (\n <div className={styles.colorContainer}>\n <div className={styles.colorCube} onClick={handleClick}>\n <div\n className={styles.colorContent}\n style={{ backgroundColor: value }}\n />\n </div>\n {visible && (\n <div className={styles.popover}>\n <div className={styles.cover} onClick={() => setVisible(false)} />\n <SketchPicker\n width=\"230px\"\n ref={ref}\n color={value}\n onChangeComplete={handleChangeComplete}\n presetColors={getPresetColors(COLORS_MAP)}\n />\n </div>\n )}\n </div>\n );\n}\n\nexport const ColorPick = forwardRef(LegacyColorPick);\n\nexport function ColorEditorItem(props: ColorEditorItemProps) {\n return (\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[{ required: props.required, message: `请输入${props.name}` }]}\n >\n <ColorPick />\n </Form.Item>\n );\n}\n"],"mappings":"AAAA,SAAsBA,
|
|
1
|
+
{"version":3,"file":"ColorEditorItem.js","names":["SketchPicker","COLORS_MAP","Form","React","useEffect","useState","forwardRef","styles","getPresetColors","colorMap","colorList","group","forEach","name","result","match","colorHex","window","getComputedStyle","document","documentElement","getPropertyValue","trim","push","Object","entries","LegacyColorPick","props","ref","value","setValue","visible","setVisible","handleChangeComplete","color","hex","onChange","handleClick","colorContainer","colorCube","colorContent","backgroundColor","popover","cover","ColorPick","ColorEditorItem","label","required","message"],"sources":["../../../../../src/visual-property-form/components/ColorEditor/ColorEditorItem.tsx"],"sourcesContent":["import { ColorResult, SketchPicker } from \"react-color\";\nimport { COLORS_MAP, Colors } from \"@next-libs/basic-components\";\nimport { Form } from \"antd\";\nimport React, { useEffect, useState, forwardRef } from \"react\";\nimport styles from \"./ColorEditor.module.css\";\n\nexport interface ColorEditorItemProps {\n name?: string;\n label?: string | React.ReactElement;\n required?: boolean;\n value?: any;\n onChange?: (value: string) => void;\n}\n\nexport function getPresetColors(\n colorMap: Record<\n Colors,\n {\n color: string;\n background: string;\n borderColor: string;\n }\n >\n): string[] {\n const colorList: string[] = [];\n for (const [, group] of Object.entries(colorMap)) {\n [\"color\", \"background\", \"borderColor\"].forEach((name) => {\n const result = (group as Record<string, any>)[name]?.match(\n /^var\\((.+)\\)/\n );\n if (result) {\n const colorHex = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(result[1])\n ?.trim();\n colorHex && colorList.push(colorHex);\n }\n });\n }\n\n return colorList;\n}\n\nexport function LegacyColorPick(\n props: ColorEditorItemProps,\n ref: React.Ref<any>\n) {\n const [value, setValue] = useState(props.value);\n const [visible, setVisible] = useState(false);\n\n useEffect(() => {\n setValue(props.value);\n }, [props.value]);\n\n const handleChangeComplete = (color: ColorResult) => {\n setValue(color.hex);\n props.onChange(color.hex);\n };\n\n const handleClick = () => {\n setVisible(true);\n };\n\n return (\n <div className={styles.colorContainer}>\n <div className={styles.colorCube} onClick={handleClick}>\n <div\n className={styles.colorContent}\n style={{ backgroundColor: value }}\n />\n </div>\n {visible && (\n <div className={styles.popover}>\n <div className={styles.cover} onClick={() => setVisible(false)} />\n <SketchPicker\n width=\"230px\"\n ref={ref}\n color={value}\n onChangeComplete={handleChangeComplete}\n presetColors={getPresetColors(COLORS_MAP)}\n />\n </div>\n )}\n </div>\n );\n}\n\nexport const ColorPick = forwardRef(LegacyColorPick);\n\nexport function ColorEditorItem(props: ColorEditorItemProps) {\n return (\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[{ required: props.required, message: `请输入${props.name}` }]}\n >\n <ColorPick />\n </Form.Item>\n );\n}\n"],"mappings":"AAAA,SAAsBA,YAAY,QAAQ,aAAa;AACvD,SAASC,UAAU,QAAgB,6BAA6B;AAChE,SAASC,IAAI,QAAQ,MAAM;AAC3B,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,OAAO;AAC9D,OAAOC,MAAM,MAAM,0BAA0B;AAU7C,OAAO,SAASC,eAAe,CAC7BC,QAOC,EACS;EACV,IAAMC,SAAmB,GAAG,EAAE;EAAC,sBACjBC,KAAK;IACjB,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC,CAACC,OAAO,CAAEC,IAAI,IAAK;MAAA;MACvD,IAAMC,MAAM,YAAIH,KAAK,CAAyBE,IAAI,CAAC,0CAApC,MAAsCE,KAAK,CACxD,cAAc,CACf;MACD,IAAID,MAAM,EAAE;QAAA;QACV,IAAME,QAAQ,4BAAGC,MAAM,CACpBC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC,CAC1CC,gBAAgB,CAACP,MAAM,CAAC,CAAC,CAAC,CAAC,0DAFb,sBAGbQ,IAAI,EAAE;QACVN,QAAQ,IAAIN,SAAS,CAACa,IAAI,CAACP,QAAQ,CAAC;MACtC;IACF,CAAC,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AAgB,EAAEI,oBAAqB;IACvC,YAAY,EAAEzB,eAAe,CAACP,UAAU;EAAE,EAC1C,CAEL,CACG;AAEV;AAEA,OAAO,IAAM2C,SAAS,gBAAGtC,UAAU,CAACoB,eAAe,CAAC;AAEpD,OAAO,SAASmB,eAAe,CAAClB,KAA2B,EAAE;EAC3D,oBACE,oBAAC,IAAI,CAAC,IAAI;IACR,GAAG,EAAEA,KAAK,CAACd,IAAK;IAChB,IAAI,EAAEc,KAAK,CAACd,IAAK;IACjB,KAAK,EAAEc,KAAK,CAACmB,KAAM;IACnB,KAAK,EAAE,CAAC;MAAEC,QAAQ,EAAEpB,KAAK,CAACoB,QAAQ;MAAEC,OAAO,8BAAQrB,KAAK,CAACd,IAAI;IAAG,CAAC;EAAE,gBAEnE,oBAAC,SAAS,OAAG,CACH;AAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconSelectFormItem.js","names":["React","useState","Form","IconSelectItem","IconSelectFormItem","props","visible","setVisible","name","label","required","message"],"sources":["../../../../../src/visual-property-form/components/IconSelect/IconSelectFormItem.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { Form } from \"antd\";\nimport { IconSelectProps, IconSelectItem } from \"@next-libs/forms\";\n\nexport function IconSelectFormItem(props: IconSelectProps): React.ReactElement {\n const [visible, setVisible] = useState(false);\n\n return (\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[{ required: props.required, message: `请输入${props.name}` }]}\n >\n <IconSelectItem\n setColor={true}\n bg={true}\n visible={visible}\n openModal={() => setVisible(true)}\n handleCancel={() => setVisible(false)}\n onChange={() => setVisible(false)}\n />\n </Form.Item>\n );\n}\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"IconSelectFormItem.js","names":["React","useState","Form","IconSelectItem","IconSelectFormItem","props","visible","setVisible","name","label","required","message"],"sources":["../../../../../src/visual-property-form/components/IconSelect/IconSelectFormItem.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { Form } from \"antd\";\nimport { IconSelectProps, IconSelectItem } from \"@next-libs/forms\";\n\nexport function IconSelectFormItem(props: IconSelectProps): React.ReactElement {\n const [visible, setVisible] = useState(false);\n\n return (\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[{ required: props.required, message: `请输入${props.name}` }]}\n >\n <IconSelectItem\n setColor={true}\n bg={true}\n visible={visible}\n openModal={() => setVisible(true)}\n handleCancel={() => setVisible(false)}\n onChange={() => setVisible(false)}\n />\n </Form.Item>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,QAAQ,MAAM;AAC3B,SAA0BC,cAAc,QAAQ,kBAAkB;AAElE,OAAO,SAASC,kBAAkB,CAACC,KAAsB,EAAsB;EAC7E,IAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGN,QAAQ,CAAC,KAAK,CAAC;EAE7C,oBACE,oBAAC,IAAI,CAAC,IAAI;IACR,GAAG,EAAEI,KAAK,CAACG,IAAK;IAChB,IAAI,EAAEH,KAAK,CAACG,IAAK;IACjB,KAAK,EAAEH,KAAK,CAACI,KAAM;IACnB,KAAK,EAAE,CAAC;MAAEC,QAAQ,EAAEL,KAAK,CAACK,QAAQ;MAAEC,OAAO,8BAAQN,KAAK,CAACG,IAAI;IAAG,CAAC;EAAE,gBAEnE,oBAAC,cAAc;IACb,QAAQ,EAAE,IAAK;IACf,EAAE,EAAE,IAAK;IACT,OAAO,EAAEF,OAAQ;IACjB,SAAS,EAAE,MAAMC,UAAU,CAAC,IAAI,CAAE;IAClC,YAAY,EAAE,MAAMA,UAAU,CAAC,KAAK,CAAE;IACtC,QAAQ,EAAE,MAAMA,UAAU,CAAC,KAAK;EAAE,EAClC,CACQ;AAEhB"}
|
|
@@ -5,7 +5,6 @@ import { GeneralIcon } from "@next-libs/basic-components";
|
|
|
5
5
|
import { InstanceApi_getDetail } from "@next-sdk/cmdb-sdk";
|
|
6
6
|
export function MenuEditorItem(props) {
|
|
7
7
|
var [options, setOptions] = useState([]);
|
|
8
|
-
|
|
9
8
|
var getMenu = /*#__PURE__*/function () {
|
|
10
9
|
var _ref = _asyncToGenerator(function* () {
|
|
11
10
|
var result = yield InstanceApi_getDetail("PROJECT_MICRO_APP", props.projectId, {
|
|
@@ -17,16 +16,13 @@ export function MenuEditorItem(props) {
|
|
|
17
16
|
}));
|
|
18
17
|
setOptions(options);
|
|
19
18
|
});
|
|
20
|
-
|
|
21
19
|
return function getMenu() {
|
|
22
20
|
return _ref.apply(this, arguments);
|
|
23
21
|
};
|
|
24
22
|
}();
|
|
25
|
-
|
|
26
23
|
var handleMenuSettingClick = () => {
|
|
27
24
|
props.menuSettingClick();
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
useEffect(() => {
|
|
31
27
|
if (props.projectId) {
|
|
32
28
|
getMenu();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuEditorItem.js","names":["React","useState","useEffect","Form","Select","Tooltip","GeneralIcon","InstanceApi_getDetail","MenuEditorItem","props","options","setOptions","getMenu","result","projectId","fields","menus","map","item","value","menuId","label","handleMenuSettingClick","menuSettingClick","display","alignItems","name","required","message","width","input","option","toLocaleLowerCase","indexOf","fontSize","marginTop","marginLeft","cursor","category","color","icon","lib"],"sources":["../../../../../src/visual-property-form/components/MenuEditor/MenuEditorItem.tsx"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport { Form, Select, Tooltip } from \"antd\";\nimport { GeneralIcon } from \"@next-libs/basic-components\";\nimport { InstanceApi_getDetail } from \"@next-sdk/cmdb-sdk\";\n\ninterface MenuEditorItemProps {\n name?: string;\n label?: string | React.ReactElement;\n value?: string;\n required?: boolean;\n projectId?: string;\n menuSettingClick?: () => void;\n}\n\nexport function MenuEditorItem(props: MenuEditorItemProps): React.ReactElement {\n const [options, setOptions] = useState([]);\n\n const getMenu = async () => {\n const result = await InstanceApi_getDetail(\n \"PROJECT_MICRO_APP\",\n props.projectId,\n {\n fields: \"menus.menuId\",\n }\n );\n\n const options = result.menus.map((item: Record<string, any>) => ({\n value: item.menuId,\n label: item.menuId,\n }));\n setOptions(options);\n };\n\n const handleMenuSettingClick = () => {\n props.menuSettingClick();\n };\n\n useEffect(() => {\n if (props.projectId) {\n getMenu();\n }\n }, []);\n\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n }}\n >\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[{ required: props.required, message: `请输入${props.name}` }]}\n >\n <Select\n style={{\n width: \"300px\",\n }}\n options={options}\n showSearch\n allowClear\n placeholder=\"Select a menu id\"\n filterOption={(input, option) =>\n (option.label as string)\n .toLocaleLowerCase()\n .indexOf(input.toLocaleLowerCase()) >= 0 ||\n (option.value as string)\n .toLocaleLowerCase()\n .indexOf(input.toLocaleLowerCase()) >= 0\n }\n />\n </Form.Item>\n <div\n style={{\n fontSize: \"18px\",\n marginTop: \"10px\",\n marginLeft: \"10px\",\n cursor: \"pointer\",\n display: \"inline-block\",\n }}\n >\n <Tooltip title=\"配置菜单数据\">\n {\" \"}\n <GeneralIcon\n icon={{\n category: \"app\",\n color: \"blue\",\n icon: \"launchpad-setting\",\n lib: \"easyops\",\n }}\n onClick={handleMenuSettingClick}\n />\n </Tooltip>\n </div>\n </div>\n );\n}\n"],"mappings":";AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"MenuEditorItem.js","names":["React","useState","useEffect","Form","Select","Tooltip","GeneralIcon","InstanceApi_getDetail","MenuEditorItem","props","options","setOptions","getMenu","result","projectId","fields","menus","map","item","value","menuId","label","handleMenuSettingClick","menuSettingClick","display","alignItems","name","required","message","width","input","option","toLocaleLowerCase","indexOf","fontSize","marginTop","marginLeft","cursor","category","color","icon","lib"],"sources":["../../../../../src/visual-property-form/components/MenuEditor/MenuEditorItem.tsx"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport { Form, Select, Tooltip } from \"antd\";\nimport { GeneralIcon } from \"@next-libs/basic-components\";\nimport { InstanceApi_getDetail } from \"@next-sdk/cmdb-sdk\";\n\ninterface MenuEditorItemProps {\n name?: string;\n label?: string | React.ReactElement;\n value?: string;\n required?: boolean;\n projectId?: string;\n menuSettingClick?: () => void;\n}\n\nexport function MenuEditorItem(props: MenuEditorItemProps): React.ReactElement {\n const [options, setOptions] = useState([]);\n\n const getMenu = async () => {\n const result = await InstanceApi_getDetail(\n \"PROJECT_MICRO_APP\",\n props.projectId,\n {\n fields: \"menus.menuId\",\n }\n );\n\n const options = result.menus.map((item: Record<string, any>) => ({\n value: item.menuId,\n label: item.menuId,\n }));\n setOptions(options);\n };\n\n const handleMenuSettingClick = () => {\n props.menuSettingClick();\n };\n\n useEffect(() => {\n if (props.projectId) {\n getMenu();\n }\n }, []);\n\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n }}\n >\n <Form.Item\n key={props.name}\n name={props.name}\n label={props.label}\n rules={[{ required: props.required, message: `请输入${props.name}` }]}\n >\n <Select\n style={{\n width: \"300px\",\n }}\n options={options}\n showSearch\n allowClear\n placeholder=\"Select a menu id\"\n filterOption={(input, option) =>\n (option.label as string)\n .toLocaleLowerCase()\n .indexOf(input.toLocaleLowerCase()) >= 0 ||\n (option.value as string)\n .toLocaleLowerCase()\n .indexOf(input.toLocaleLowerCase()) >= 0\n }\n />\n </Form.Item>\n <div\n style={{\n fontSize: \"18px\",\n marginTop: \"10px\",\n marginLeft: \"10px\",\n cursor: \"pointer\",\n display: \"inline-block\",\n }}\n >\n <Tooltip title=\"配置菜单数据\">\n {\" \"}\n <GeneralIcon\n icon={{\n category: \"app\",\n color: \"blue\",\n icon: \"launchpad-setting\",\n lib: \"easyops\",\n }}\n onClick={handleMenuSettingClick}\n />\n </Tooltip>\n </div>\n </div>\n );\n}\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,SAASC,IAAI,EAAEC,MAAM,E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AAE;IACT,CAAE;IACF,OAAO,EAAEnB,OAAQ;IACjB,UAAU;IACV,UAAU;IACV,WAAW,EAAC,kBAAkB;IAC9B,YAAY,EAAE,CAACoB,KAAK,EAAEC,MAAM,KACzBA,MAAM,CAACV,KAAK,CACVW,iBAAiB,EAAE,CACnBC,OAAO,CAACH,KAAK,CAACE,iBAAiB,EAAE,CAAC,IAAI,CAAC,IACzCD,MAAM,CAACZ,KAAK,CACVa,iBAAiB,EAAE,CACnBC,OAAO,CAACH,KAAK,CAACE,iBAAiB,EAAE,CAAC,IAAI;EAC1C,EACD,CACQ,eACZ;IACE,KAAK,EAAE;MACLE,QAAQ,EAAE,MAAM;MAChBC,SAAS,EAAE,MAAM;MACjBC,UAAU,EAAE,MAAM;MAClBC,MAAM,EAAE,SAAS;MACjBb,OAAO,EAAE;IACX;EAAE,gBAEF,oBAAC,OAAO;IAAC,KAAK,EAAC;EAAQ,GACpB,GAAG,eACJ,oBAAC,WAAW;IACV,IAAI,EAAE;MACJc,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE,MAAM;MACbC,IAAI,EAAE,mBAAmB;MACzBC,GAAG,EAAE;IACP,CAAE;IACF,OAAO,EAAEnB;EAAuB,EAChC,CACM,CACN,CACF;AAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","names":["groupI18nMap","basic","en","zh","ui","advanced","basicFormItem","advancedFormItem","other","supportBasicType","supportMenuType","OTHER_FORM_ITEM_FIELD","defaultCommonProps","name","type","description","group","groupI18N"],"sources":["../../../src/visual-property-form/constant.ts"],"sourcesContent":["import { PropertyType } from \"../interfaces\";\n\nexport const groupI18nMap = {\n basic: {\n en: \"Basic\",\n zh: \"常用\",\n },\n ui: {\n en: \"UI\",\n zh: \"外观\",\n },\n advanced: {\n en: \"Advanced\",\n zh: \"高级\",\n },\n basicFormItem: {\n en: \"Basic Form Item\",\n zh: \"表单项常用\",\n },\n advancedFormItem: {\n en: \"Advanced Form Item\",\n zh: \"表单项高级\",\n },\n other: {\n en: \"Other\",\n zh: \"其他\",\n },\n};\n\nexport const supportBasicType = [\n \"boolean\",\n \"number\",\n \"string\",\n \"string[]\",\n \"MenuIcon\",\n \"Color\",\n];\n\nexport const supportMenuType = [\"Menu\", \"SidebarSubMenu\"];\n\nexport const OTHER_FORM_ITEM_FIELD = \"others\";\n\nexport const defaultCommonProps: PropertyType[] = [\n {\n name: \"id\",\n type: \"string\",\n description: \"构件 ID\",\n group: \"basic\",\n groupI18N: groupI18nMap,\n },\n {\n name: \"style\",\n type: \"Record<string, any>\",\n description: \"构件样式\",\n group: \"ui\",\n groupI18N: groupI18nMap,\n },\n];\n"],"mappings":"AAEA,OAAO,IAAMA,YAAY,GAAG;EAC1BC,KAAK,EAAE;IACLC,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"constant.js","names":["groupI18nMap","basic","en","zh","ui","advanced","basicFormItem","advancedFormItem","other","supportBasicType","supportMenuType","OTHER_FORM_ITEM_FIELD","defaultCommonProps","name","type","description","group","groupI18N"],"sources":["../../../src/visual-property-form/constant.ts"],"sourcesContent":["import { PropertyType } from \"../interfaces\";\n\nexport const groupI18nMap = {\n basic: {\n en: \"Basic\",\n zh: \"常用\",\n },\n ui: {\n en: \"UI\",\n zh: \"外观\",\n },\n advanced: {\n en: \"Advanced\",\n zh: \"高级\",\n },\n basicFormItem: {\n en: \"Basic Form Item\",\n zh: \"表单项常用\",\n },\n advancedFormItem: {\n en: \"Advanced Form Item\",\n zh: \"表单项高级\",\n },\n other: {\n en: \"Other\",\n zh: \"其他\",\n },\n};\n\nexport const supportBasicType = [\n \"boolean\",\n \"number\",\n \"string\",\n \"string[]\",\n \"MenuIcon\",\n \"Color\",\n];\n\nexport const supportMenuType = [\"Menu\", \"SidebarSubMenu\"];\n\nexport const OTHER_FORM_ITEM_FIELD = \"others\";\n\nexport const defaultCommonProps: PropertyType[] = [\n {\n name: \"id\",\n type: \"string\",\n description: \"构件 ID\",\n group: \"basic\",\n groupI18N: groupI18nMap,\n },\n {\n name: \"style\",\n type: \"Record<string, any>\",\n description: \"构件样式\",\n group: \"ui\",\n groupI18N: groupI18nMap,\n },\n];\n"],"mappings":"AAEA,OAAO,IAAMA,YAAY,GAAG;EAC1BC,KAAK,EAAE;IACLC,EAAE,EAAE,OAAO;IACXC,EAAE,EAAE;EACN,CAAC;EACDC,EAAE,EAAE;IACFF,EAAE,EAAE,IAAI;IACRC,EAAE,EAAE;EACN,CAAC;EACDE,QAAQ,EAAE;IACRH,EAAE,EAAE,UAAU;IACdC,EAAE,EAAE;EACN,CAAC;EACDG,aAAa,EAAE;IACbJ,EAAE,EAAE,iBAAiB;IACrBC,EAAE,EAAE;EACN,CAAC;EACDI,gBAAgB,EAAE;IAChBL,EAAE,EAAE,oBAAoB;IACxBC,EAAE,EAAE;EACN,CAAC;EACDK,KAAK,EAAE;IACLN,EAAE,EAAE,OAAO;IACXC,EAAE,EAAE;EACN;AACF,CAAC;AAED,OAAO,IAAMM,gBAAgB,GAAG,CAC9B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,OAAO,CACR;AAED,OAAO,IAAMC,eAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC;AAEzD,OAAO,IAAMC,qBAAqB,GAAG,QAAQ;AAE7C,OAAO,IAAMC,kBAAkC,GAAG,CAChD;EACEC,IAAI,EAAE,IAAI;EACVC,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,OAAO;EACpBC,KAAK,EAAE,OAAO;EACdC,SAAS,EAAEjB;AACb,CAAC,EACD;EACEa,IAAI,EAAE,OAAO;EACbC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EAAE,MAAM;EACnBC,KAAK,EAAE,IAAI;EACXC,SAAS,EAAEjB;AACb,CAAC,CACF"}
|