starfish-form-custom 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/auto-imports.d.ts +9 -0
- package/components.d.ts +68 -0
- package/dist/formAction-28d86b6a.mjs +446 -0
- package/dist/index-04830c0b.mjs +126 -0
- package/dist/index-eab8ef70.mjs +519 -0
- package/dist/index-f7ea052c.mjs +241 -0
- package/dist/main-96327b2e.mjs +5051 -0
- package/dist/starfish-form-a18a5409.mjs +328 -0
- package/dist/starfish-form.mjs +36 -0
- package/dist/style.css +377 -0
- package/dist/types/form/src/common/Loading.vue.d.ts +3 -0
- package/dist/types/form/src/env.d.ts +15 -0
- package/dist/types/form/src/main.d.ts +43 -0
- package/dist/types/form/src/starfish-form.vue.d.ts +40 -0
- package/dist/types/form/src/utils/customHooks.d.ts +2 -0
- package/dist/types/form/src/utils/fieldConfig.d.ts +78 -0
- package/dist/types/form/src/utils/fieldProps.d.ts +43 -0
- package/dist/types/starfish-form.d.ts +3 -0
- package/package.json +42 -0
- package/src/common/KeyValueConfig.vue +145 -0
- package/src/common/KeyValueConfigMult.vue +139 -0
- package/src/common/Loading.vue +14 -0
- package/src/common/action.vue +76 -0
- package/src/common/formAction.vue +298 -0
- package/src/common/listConfig.vue +45 -0
- package/src/common/panel.vue +61 -0
- package/src/common/radiogroup.vue +31 -0
- package/src/components/CheckBox/index.vue +42 -0
- package/src/components/ColorSelect/index.vue +49 -0
- package/src/components/Date/index.vue +39 -0
- package/src/components/DateTime/index.vue +39 -0
- package/src/components/InputNumber/index.vue +48 -0
- package/src/components/JsonEditor/index.vue +167 -0
- package/src/components/Radio/index.vue +42 -0
- package/src/components/RichText/index.vue +60 -0
- package/src/components/Rule/index.vue +365 -0
- package/src/components/Rule/ruleform.json +315 -0
- package/src/components/Rule/rules.js +91 -0
- package/src/components/Selected/index.vue +50 -0
- package/src/components/Selecteds/index.vue +50 -0
- package/src/components/ShowRule/index.vue +50 -0
- package/src/components/Slider/index.vue +38 -0
- package/src/components/Switch/index.vue +61 -0
- package/src/components/Text/index.vue +48 -0
- package/src/components/TextArea/index.vue +49 -0
- package/src/components/Time/index.vue +36 -0
- package/src/env.d.ts +15 -0
- package/src/layout/Divider.vue +30 -0
- package/src/layout/Info.vue +69 -0
- package/src/layout/Tabs.vue +75 -0
- package/src/layout/collapse.vue +78 -0
- package/src/layout/grid.vue +88 -0
- package/src/layout/table.vue +80 -0
- package/src/main.ts +62 -0
- package/src/starfish-form.vue +265 -0
- package/src/styles/action.scss +25 -0
- package/src/styles/collapse.scss +15 -0
- package/src/styles/custom-cpm.scss +5 -0
- package/src/styles/divider.scss +16 -0
- package/src/styles/form-action.scss +92 -0
- package/src/styles/formedit.scss +69 -0
- package/src/styles/grid.scss +12 -0
- package/src/styles/index.scss +12 -0
- package/src/styles/keyvalueConfig.scss +56 -0
- package/src/styles/rule.scss +17 -0
- package/src/styles/showrule.scss +5 -0
- package/src/styles/table.scss +19 -0
- package/src/styles/tabs.scss +5 -0
- package/src/utils/customHooks.ts +22 -0
- package/src/utils/fieldConfig.ts +961 -0
- package/src/utils/fieldProps.ts +50 -0
- package/stats.html +4949 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { ElTooltip, ElMain, ElButton, ElFooter, ElContainer } from 'element-plus/es';
|
|
2
|
+
import 'element-plus/es/components/base/style/css';
|
|
3
|
+
import 'element-plus/es/components/container/style/css';
|
|
4
|
+
import 'element-plus/es/components/footer/style/css';
|
|
5
|
+
import 'element-plus/es/components/button/style/css';
|
|
6
|
+
import 'element-plus/es/components/main/style/css';
|
|
7
|
+
import 'element-plus/es/components/tooltip/style/css';
|
|
8
|
+
import { defineComponent, ref, onMounted, watch, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, createCommentVNode, createBlock, withCtx, createVNode, createTextVNode } from 'vue';
|
|
9
|
+
import { _ as _export_sfc, a as _, g as getFormConfig, f as fieldProps, u as useWatch } from './main-96327b2e.mjs';
|
|
10
|
+
import JSONEditor from 'jsoneditor';
|
|
11
|
+
import 'element-plus/es/components/input/style/css';
|
|
12
|
+
import 'element-plus/es/components/checkbox/style/css';
|
|
13
|
+
import 'element-plus/es/components/loading/style/css';
|
|
14
|
+
import 'element-plus/es/components/dropdown/style/css';
|
|
15
|
+
import 'element-plus/es/components/dropdown-menu/style/css';
|
|
16
|
+
import 'element-plus/es/components/dropdown-item/style/css';
|
|
17
|
+
import 'element-plus/es/components/collapse/style/css';
|
|
18
|
+
import 'element-plus/es/components/collapse-item/style/css';
|
|
19
|
+
import 'element-plus/es/components/row/style/css';
|
|
20
|
+
import 'element-plus/es/components/icon/style/css';
|
|
21
|
+
import 'element-plus/es/components/col/style/css';
|
|
22
|
+
import 'element-plus/es/components/select/style/css';
|
|
23
|
+
import 'element-plus/es/components/option/style/css';
|
|
24
|
+
import '@element-plus/icons-vue';
|
|
25
|
+
import 'element-plus/es/components/input-number/style/css';
|
|
26
|
+
import 'element-plus/es/components/radio-group/style/css';
|
|
27
|
+
import 'element-plus/es/components/radio-button/style/css';
|
|
28
|
+
import 'element-plus/es/components/checkbox-group/style/css';
|
|
29
|
+
import 'element-plus/es/components/color-picker/style/css';
|
|
30
|
+
import 'element-plus/es/components/date-picker/style/css';
|
|
31
|
+
import 'element-plus/es/components/radio/style/css';
|
|
32
|
+
import 'element-plus/es/components/slider/style/css';
|
|
33
|
+
import 'element-plus/es/components/switch/style/css';
|
|
34
|
+
import 'element-plus/es/components/time-select/style/css';
|
|
35
|
+
import 'element-plus/es/components/divider/style/css';
|
|
36
|
+
import 'element-plus/es/components/alert/style/css';
|
|
37
|
+
import 'element-plus/es/components/tabs/style/css';
|
|
38
|
+
import 'element-plus/es/components/tab-pane/style/css';
|
|
39
|
+
import 'element-plus/es/components/form-item/style/css';
|
|
40
|
+
import 'element-plus';
|
|
41
|
+
|
|
42
|
+
const _sfc_main = defineComponent({
|
|
43
|
+
ControlType: "JsonEditor",
|
|
44
|
+
// 必须与文件名匹配
|
|
45
|
+
nameCn: "JSON\u7F16\u8F91",
|
|
46
|
+
icon: "icon-json-full",
|
|
47
|
+
rule: _.getJsonValidate(),
|
|
48
|
+
formConfig: getFormConfig("JsonEditor", [
|
|
49
|
+
{ fieldName: "default", component: "JsonEditor" }
|
|
50
|
+
]),
|
|
51
|
+
props: {
|
|
52
|
+
...fieldProps
|
|
53
|
+
},
|
|
54
|
+
actionType: ["onChange"],
|
|
55
|
+
setup(props) {
|
|
56
|
+
const jsoneditor = ref({});
|
|
57
|
+
let jsonEditorDialog = null;
|
|
58
|
+
let jsonEditors = null;
|
|
59
|
+
const JsonViewerDialogDom = ref();
|
|
60
|
+
const myDialog = ref();
|
|
61
|
+
useWatch(props);
|
|
62
|
+
function initJson() {
|
|
63
|
+
const container = jsoneditor.value;
|
|
64
|
+
const data = props.data;
|
|
65
|
+
const item = props.item;
|
|
66
|
+
const fieldName = item.data.fieldName;
|
|
67
|
+
const options = {
|
|
68
|
+
modes: ["text", "code", "view"],
|
|
69
|
+
mode: "code",
|
|
70
|
+
search: false,
|
|
71
|
+
onChange() {
|
|
72
|
+
data[fieldName] = jsonEditors?.getText();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
jsonEditors = new JSONEditor(container, options);
|
|
76
|
+
if (props.drag) {
|
|
77
|
+
jsonEditors?.set(_.tryParseJson(item.data.default));
|
|
78
|
+
} else {
|
|
79
|
+
jsonEditors?.set(_.tryParseJson(data[item.data.fieldName]));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
initJson();
|
|
84
|
+
});
|
|
85
|
+
watch(
|
|
86
|
+
() => props.item,
|
|
87
|
+
(newValue) => {
|
|
88
|
+
if (props.drag) {
|
|
89
|
+
jsonEditors?.set(_.tryParseJson(newValue.data.default));
|
|
90
|
+
} else {
|
|
91
|
+
const data = props.data;
|
|
92
|
+
const item = props.item;
|
|
93
|
+
jsonEditors?.set(_.tryParseJson(data[item.data.fieldName]));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
return {
|
|
98
|
+
myDialog,
|
|
99
|
+
jsoneditor,
|
|
100
|
+
JsonViewerDialogDom,
|
|
101
|
+
async showCustomDialog() {
|
|
102
|
+
const myDialogDom = myDialog.value;
|
|
103
|
+
myDialogDom.show();
|
|
104
|
+
myDialogDom.init("JSON\u7F16\u8F91", "icon-json-full");
|
|
105
|
+
await nextTick();
|
|
106
|
+
const container = JsonViewerDialogDom.value;
|
|
107
|
+
const options = {
|
|
108
|
+
modes: ["text", "code", "view"],
|
|
109
|
+
mode: "code",
|
|
110
|
+
search: false
|
|
111
|
+
};
|
|
112
|
+
jsonEditorDialog = new JSONEditor(container, options);
|
|
113
|
+
jsonEditorDialog?.set(_.tryParseJson(jsonEditors.getText()));
|
|
114
|
+
},
|
|
115
|
+
closeDialog() {
|
|
116
|
+
myDialog.value.close();
|
|
117
|
+
},
|
|
118
|
+
saveJson() {
|
|
119
|
+
jsonEditors?.set(_.tryParseJson(jsonEditorDialog.getText()));
|
|
120
|
+
const data = props.data;
|
|
121
|
+
const item = props.item;
|
|
122
|
+
const fieldName = item.data.fieldName;
|
|
123
|
+
data[fieldName] = jsonEditors?.getText();
|
|
124
|
+
myDialog.value.close();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const _hoisted_1 = {
|
|
130
|
+
key: 0,
|
|
131
|
+
class: "item_require"
|
|
132
|
+
};
|
|
133
|
+
const _hoisted_2 = {
|
|
134
|
+
id: "jsoneditor",
|
|
135
|
+
ref: "jsoneditor"
|
|
136
|
+
};
|
|
137
|
+
const _hoisted_3 = {
|
|
138
|
+
ref: "JsonViewerDialogDom",
|
|
139
|
+
style: { "height": "calc(100% - 24px)" }
|
|
140
|
+
};
|
|
141
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
142
|
+
const _component_el_tooltip = ElTooltip;
|
|
143
|
+
const _component_el_main = ElMain;
|
|
144
|
+
const _component_el_button = ElButton;
|
|
145
|
+
const _component_el_footer = ElFooter;
|
|
146
|
+
const _component_el_container = ElContainer;
|
|
147
|
+
const _component_CustomDialog = resolveComponent("CustomDialog");
|
|
148
|
+
return openBlock(), createElementBlock("div", {
|
|
149
|
+
class: normalizeClass(["starfish-formitem", {
|
|
150
|
+
formCover: _ctx.drag,
|
|
151
|
+
"starfish-vertical": _ctx.labelalign != "top",
|
|
152
|
+
[_ctx.item.data.csslist?.join(" ")]: !!_ctx.item.data.csslist
|
|
153
|
+
}])
|
|
154
|
+
}, [
|
|
155
|
+
createElementVNode("div", {
|
|
156
|
+
class: normalizeClass(["label", "label_" + _ctx.labelalign]),
|
|
157
|
+
style: normalizeStyle({ width: _ctx.labelWidth + "px" })
|
|
158
|
+
}, [
|
|
159
|
+
createElementVNode("label", null, toDisplayString(_ctx.item.data.label) + toDisplayString(_ctx.suffix), 1),
|
|
160
|
+
_ctx.item.data.required ? (openBlock(), createElementBlock("span", _hoisted_1, "*")) : createCommentVNode("", true),
|
|
161
|
+
_ctx.item.data.tip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
162
|
+
key: 1,
|
|
163
|
+
class: "item",
|
|
164
|
+
effect: "dark",
|
|
165
|
+
content: _ctx.item.data.tip,
|
|
166
|
+
placement: "top"
|
|
167
|
+
}, {
|
|
168
|
+
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
169
|
+
createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1)
|
|
170
|
+
])),
|
|
171
|
+
_: 1,
|
|
172
|
+
__: [1]
|
|
173
|
+
}, 8, ["content"])) : createCommentVNode("", true)
|
|
174
|
+
], 6),
|
|
175
|
+
createElementVNode("div", {
|
|
176
|
+
class: "control",
|
|
177
|
+
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
178
|
+
}, [
|
|
179
|
+
createElementVNode("div", _hoisted_2, [
|
|
180
|
+
createElementVNode("div", {
|
|
181
|
+
class: "fullScreen",
|
|
182
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.showCustomDialog && _ctx.showCustomDialog(...args))
|
|
183
|
+
}, _cache[2] || (_cache[2] = [
|
|
184
|
+
createElementVNode("i", { class: "iconfontui icon-quanping" }, null, -1)
|
|
185
|
+
]))
|
|
186
|
+
], 512)
|
|
187
|
+
], 4),
|
|
188
|
+
createVNode(_component_CustomDialog, {
|
|
189
|
+
ref: "myDialog",
|
|
190
|
+
width: "60%"
|
|
191
|
+
}, {
|
|
192
|
+
default: withCtx(() => [
|
|
193
|
+
createVNode(_component_el_main, { style: { "padding": "0" } }, {
|
|
194
|
+
default: withCtx(() => [
|
|
195
|
+
createVNode(_component_el_container, { style: { "height": "100%" } }, {
|
|
196
|
+
default: withCtx(() => [
|
|
197
|
+
createVNode(_component_el_main, { class: "my-pageMain" }, {
|
|
198
|
+
default: withCtx(() => [
|
|
199
|
+
createElementVNode("div", _hoisted_3, null, 512)
|
|
200
|
+
]),
|
|
201
|
+
_: 1
|
|
202
|
+
}),
|
|
203
|
+
createVNode(_component_el_footer, {
|
|
204
|
+
class: "my-Footer",
|
|
205
|
+
style: { "height": "60px", "padding-top": "10px", "text-align": "right" }
|
|
206
|
+
}, {
|
|
207
|
+
default: withCtx(() => [
|
|
208
|
+
createVNode(_component_el_button, {
|
|
209
|
+
type: "primary",
|
|
210
|
+
onClick: _ctx.saveJson
|
|
211
|
+
}, {
|
|
212
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
213
|
+
createTextVNode("\u4FDD\u5B58", -1)
|
|
214
|
+
])),
|
|
215
|
+
_: 1,
|
|
216
|
+
__: [3]
|
|
217
|
+
}, 8, ["onClick"]),
|
|
218
|
+
createVNode(_component_el_button, { onClick: _ctx.closeDialog }, {
|
|
219
|
+
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
220
|
+
createTextVNode("\u5173\u95ED", -1)
|
|
221
|
+
])),
|
|
222
|
+
_: 1,
|
|
223
|
+
__: [4]
|
|
224
|
+
}, 8, ["onClick"])
|
|
225
|
+
]),
|
|
226
|
+
_: 1
|
|
227
|
+
})
|
|
228
|
+
]),
|
|
229
|
+
_: 1
|
|
230
|
+
})
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
})
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
}, 512)
|
|
237
|
+
], 2);
|
|
238
|
+
}
|
|
239
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
240
|
+
|
|
241
|
+
export { index as default };
|