@next-libs/visual-builder 1.5.2 → 1.6.1
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/interfaces/brick-visualization.js.map +1 -1
- package/dist/cjs/visual-property-form/VisualPropertyForm.js +119 -9
- package/dist/cjs/visual-property-form/VisualPropertyForm.js.map +1 -1
- package/dist/cjs/visual-property-form/components/ColorEditor/ColorEditorItem.js +7 -2
- package/dist/cjs/visual-property-form/components/ColorEditor/ColorEditorItem.js.map +1 -1
- package/dist/cjs/visual-property-form/components/MessageEditor/MessageEditor.js +83 -0
- package/dist/cjs/visual-property-form/components/MessageEditor/MessageEditor.js.map +1 -0
- package/dist/cjs/visual-property-form/constant.js +13 -1
- package/dist/cjs/visual-property-form/constant.js.map +1 -1
- package/dist/esm/interfaces/brick-visualization.js.map +1 -1
- package/dist/esm/visual-property-form/VisualPropertyForm.js +117 -10
- package/dist/esm/visual-property-form/VisualPropertyForm.js.map +1 -1
- package/dist/esm/visual-property-form/VisualPropertyForm.module.css +20 -0
- package/dist/esm/visual-property-form/components/ColorEditor/ColorEditor.module.css +5 -5
- package/dist/esm/visual-property-form/components/ColorEditor/ColorEditorItem.js +7 -2
- package/dist/esm/visual-property-form/components/ColorEditor/ColorEditorItem.js.map +1 -1
- package/dist/esm/visual-property-form/components/MessageEditor/MessageEditor.js +77 -0
- package/dist/esm/visual-property-form/components/MessageEditor/MessageEditor.js.map +1 -0
- package/dist/esm/visual-property-form/components/MessageEditor/MessageEditor.module.css +19 -0
- package/dist/esm/visual-property-form/constant.js +13 -1
- package/dist/esm/visual-property-form/constant.js.map +1 -1
- package/dist/types/interfaces/brick-visualization.d.ts +2 -1
- package/dist/types/visual-property-form/components/MessageEditor/MessageEditor.d.ts +10 -0
- package/dist/types/visual-property-form/constant.d.ts +12 -0
- package/package.json +4 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Form, Input, Popover } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "./MessageEditor.module.css";
|
|
4
|
+
import { GeneralIcon } from "@next-libs/basic-components";
|
|
5
|
+
export function MessageEditor(_ref) {
|
|
6
|
+
var {
|
|
7
|
+
name,
|
|
8
|
+
label,
|
|
9
|
+
value = {},
|
|
10
|
+
required,
|
|
11
|
+
onChange
|
|
12
|
+
} = _ref;
|
|
13
|
+
var renderForm = value => {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
15
|
+
layout: "horizontal",
|
|
16
|
+
labelAlign: "left",
|
|
17
|
+
labelCol: {
|
|
18
|
+
style: {
|
|
19
|
+
minWidth: "112px"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
onValuesChange: onChange
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
24
|
+
name: "pattern",
|
|
25
|
+
label: "pattern"
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
27
|
+
defaultValue: value.pattern
|
|
28
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
29
|
+
name: "required",
|
|
30
|
+
label: "required"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
32
|
+
defaultValue: value.required
|
|
33
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
34
|
+
name: "max",
|
|
35
|
+
label: "max"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
37
|
+
defaultValue: value.max
|
|
38
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
39
|
+
name: "min",
|
|
40
|
+
label: "min"
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
42
|
+
defaultValue: value.min
|
|
43
|
+
})));
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: styles.messageEditorContainer
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
48
|
+
key: name,
|
|
49
|
+
name: name,
|
|
50
|
+
label: label,
|
|
51
|
+
rules: [{
|
|
52
|
+
required: required,
|
|
53
|
+
message: "\u8BF7\u8F93\u5165".concat(name)
|
|
54
|
+
}]
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
56
|
+
overlayStyle: {
|
|
57
|
+
zIndex: 999
|
|
58
|
+
},
|
|
59
|
+
content: renderForm(value),
|
|
60
|
+
title: "Detail",
|
|
61
|
+
trigger: "click",
|
|
62
|
+
placement: "left"
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: styles.editBtn
|
|
65
|
+
}, /*#__PURE__*/React.createElement(GeneralIcon, {
|
|
66
|
+
icon: {
|
|
67
|
+
lib: "easyops",
|
|
68
|
+
category: "default",
|
|
69
|
+
icon: "edit",
|
|
70
|
+
color: "gray"
|
|
71
|
+
},
|
|
72
|
+
style: {
|
|
73
|
+
padding: 4
|
|
74
|
+
}
|
|
75
|
+
})))));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=MessageEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageEditor.js","names":["Form","Input","Popover","React","styles","GeneralIcon","MessageEditor","name","label","value","required","onChange","renderForm","style","minWidth","pattern","max","min","messageEditorContainer","message","zIndex","editBtn","lib","category","icon","color","padding"],"sources":["../../../../../src/visual-property-form/components/MessageEditor/MessageEditor.tsx"],"sourcesContent":["import { Form, Input, Popover } from \"antd\";\nimport React from \"react\";\nimport styles from \"./MessageEditor.module.css\";\nimport { GeneralIcon } from \"@next-libs/basic-components\";\n\ninterface MessageEditorProps {\n name?: string;\n label?: string | React.ReactElement;\n value?: Record<string, any>;\n required?: boolean;\n onChange?: (data: any) => void;\n}\n\nexport function MessageEditor({\n name,\n label,\n value = {},\n required,\n onChange,\n}: MessageEditorProps): React.ReactElement {\n const renderForm = (value: Record<string, any>) => {\n return (\n <Form\n layout=\"horizontal\"\n labelAlign=\"left\"\n labelCol={{\n style: {\n minWidth: \"112px\",\n },\n }}\n onValuesChange={onChange}\n >\n <Form.Item name=\"pattern\" label=\"pattern\">\n <Input defaultValue={value.pattern} />\n </Form.Item>\n <Form.Item name=\"required\" label=\"required\">\n <Input defaultValue={value.required} />\n </Form.Item>\n <Form.Item name=\"max\" label=\"max\">\n <Input defaultValue={value.max} />\n </Form.Item>\n <Form.Item name=\"min\" label=\"min\">\n <Input defaultValue={value.min} />\n </Form.Item>\n </Form>\n );\n };\n\n return (\n <div className={styles.messageEditorContainer}>\n <Form.Item\n key={name}\n name={name}\n label={label}\n rules={[{ required: required, message: `请输入${name}` }]}\n >\n <Popover\n overlayStyle={{\n zIndex: 999,\n }}\n content={renderForm(value)}\n title=\"Detail\"\n trigger=\"click\"\n placement=\"left\"\n >\n <div className={styles.editBtn}>\n <GeneralIcon\n icon={{\n lib: \"easyops\",\n category: \"default\",\n icon: \"edit\",\n color: \"gray\",\n }}\n style={{\n padding: 4,\n }}\n />\n </div>\n </Popover>\n </Form.Item>\n </div>\n );\n}\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,KAAK,EAAEC,OAAO,QAAQ,MAAM;AAC3C,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,4BAA4B;AAC/C,SAASC,WAAW,QAAQ,6BAA6B;AAUzD,OAAO,SAASC,aAAa,OAMc;EAAA,IANb;IAC5BC,IAAI;IACJC,KAAK;IACLC,KAAK,GAAG,CAAC,CAAC;IACVC,QAAQ;IACRC;EACkB,CAAC;EACnB,IAAMC,UAAU,GAAIH,KAA0B,IAAK;IACjD,oBACE,oBAAC,IAAI;MACH,MAAM,EAAC,YAAY;MACnB,UAAU,EAAC,MAAM;MACjB,QAAQ,EAAE;QACRI,KAAK,EAAE;UACLC,QAAQ,EAAE;QACZ;MACF,CAAE;MACF,cAAc,EAAEH;IAAS,gBAEzB,oBAAC,IAAI,CAAC,IAAI;MAAC,IAAI,EAAC,SAAS;MAAC,KAAK,EAAC;IAAS,gBACvC,oBAAC,KAAK;M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0 +1,19 @@
|
|
|
1
|
+
.messageEditorContainer {
|
|
2
|
+
display: "flex";
|
|
3
|
+
align-items: "center";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.editBtn {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
padding: 4px;
|
|
10
|
+
outline-width: 1px;
|
|
11
|
+
outline-style: solid;
|
|
12
|
+
outline-offset: -1px;
|
|
13
|
+
outline-color: var(--antd-input-border-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.editBtn:hover {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
background: rgba(0, 0, 0, 0.5);
|
|
19
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export var groupI18nMap = {
|
|
2
2
|
basic: {
|
|
3
3
|
en: "Basic",
|
|
4
|
-
zh: "
|
|
4
|
+
zh: "基础"
|
|
5
5
|
},
|
|
6
6
|
ui: {
|
|
7
7
|
en: "UI",
|
|
8
8
|
zh: "外观"
|
|
9
9
|
},
|
|
10
|
+
style: {
|
|
11
|
+
en: "Style",
|
|
12
|
+
zh: "样式"
|
|
13
|
+
},
|
|
10
14
|
advanced: {
|
|
11
15
|
en: "Advanced",
|
|
12
16
|
zh: "高级"
|
|
@@ -19,6 +23,14 @@ export var groupI18nMap = {
|
|
|
19
23
|
en: "Advanced Form Item",
|
|
20
24
|
zh: "表单项高级"
|
|
21
25
|
},
|
|
26
|
+
formValidation: {
|
|
27
|
+
en: "Validation",
|
|
28
|
+
zh: "数据验证"
|
|
29
|
+
},
|
|
30
|
+
formLabel: {
|
|
31
|
+
en: "Label",
|
|
32
|
+
zh: "标签"
|
|
33
|
+
},
|
|
22
34
|
other: {
|
|
23
35
|
en: "Other",
|
|
24
36
|
zh: "其他"
|
|
@@ -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: \"
|
|
1
|
+
{"version":3,"file":"constant.js","names":["groupI18nMap","basic","en","zh","ui","style","advanced","basicFormItem","advancedFormItem","formValidation","formLabel","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 style: {\n en: \"Style\",\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 formValidation: {\n en: \"Validation\",\n zh: \"数据验证\",\n },\n formLabel: {\n en: \"Label\",\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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+
label?: string | React.ReactElement;
|
|
5
|
+
value?: Record<string, any>;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
onChange?: (data: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function MessageEditor({ name, label, value, required, onChange, }: MessageEditorProps): React.ReactElement;
|
|
10
|
+
export {};
|
|
@@ -8,6 +8,10 @@ export declare const groupI18nMap: {
|
|
|
8
8
|
en: string;
|
|
9
9
|
zh: string;
|
|
10
10
|
};
|
|
11
|
+
style: {
|
|
12
|
+
en: string;
|
|
13
|
+
zh: string;
|
|
14
|
+
};
|
|
11
15
|
advanced: {
|
|
12
16
|
en: string;
|
|
13
17
|
zh: string;
|
|
@@ -20,6 +24,14 @@ export declare const groupI18nMap: {
|
|
|
20
24
|
en: string;
|
|
21
25
|
zh: string;
|
|
22
26
|
};
|
|
27
|
+
formValidation: {
|
|
28
|
+
en: string;
|
|
29
|
+
zh: string;
|
|
30
|
+
};
|
|
31
|
+
formLabel: {
|
|
32
|
+
en: string;
|
|
33
|
+
zh: string;
|
|
34
|
+
};
|
|
23
35
|
other: {
|
|
24
36
|
en: string;
|
|
25
37
|
zh: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-libs/visual-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-libs/tree/master/libs/visual-builder",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@next-libs/basic-components": "^5.2.0",
|
|
33
|
-
"@next-libs/code-editor-components": "^4.8.
|
|
34
|
-
"@next-libs/forms": "^3.3.
|
|
33
|
+
"@next-libs/code-editor-components": "^4.8.4",
|
|
34
|
+
"@next-libs/forms": "^3.3.9",
|
|
35
35
|
"@types/react-color": "^3.0.6",
|
|
36
36
|
"react-color": "^2.19.3"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4d3f0f71e38ed935172d1759e1808ebd0382835b"
|
|
39
39
|
}
|