starfish-editor-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/auto-imports.d.ts +10 -0
- package/babel.config.js +8 -0
- package/components.d.ts +46 -0
- package/dist/ConditionModule.js +892 -0
- package/dist/ConditionSelect.js +483 -0
- package/dist/CustomDialog.js +105 -0
- package/dist/formStyle.js +245 -0
- package/dist/globalFormList.js +59 -0
- package/dist/jsonCode.js +74 -0
- package/dist/jsonEditor.js +71 -0
- package/dist/main.js +3319 -0
- package/dist/starfish-editor.es.js +30 -0
- package/dist/style.css +1 -0
- package/dist/types/editor/src/common/ConditionSelect/ConditionGroup.vue.d.ts +61 -0
- package/dist/types/editor/src/common/ConditionSelect/ConditionModule.vue.d.ts +43 -0
- package/dist/types/editor/src/common/ConditionSelect/ConditionTanc.vue.d.ts +48 -0
- package/dist/types/editor/src/common/ConditionSelect.vue.d.ts +72 -0
- package/dist/types/editor/src/common/CustomDialog.vue.d.ts +25 -0
- package/dist/types/editor/src/common/Loading.vue.d.ts +3 -0
- package/dist/types/editor/src/common/formJson.d.ts +80 -0
- package/dist/types/editor/src/common/jsonCode.vue.d.ts +110 -0
- package/dist/types/editor/src/components/ComponentList.vue.d.ts +32 -0
- package/dist/types/editor/src/components/FormPreview.vue.d.ts +25 -0
- package/dist/types/editor/src/components/Nav.vue.d.ts +9 -0
- package/dist/types/editor/src/components/PropsPanel.vue.d.ts +53 -0
- package/dist/types/editor/src/components/Shape.vue.d.ts +40 -0
- package/dist/types/editor/src/components/Workspace.vue.d.ts +22 -0
- package/dist/types/editor/src/components/globalFormList.vue.d.ts +6 -0
- package/dist/types/editor/src/components/jsonEditor.vue.d.ts +6 -0
- package/dist/types/editor/src/controller/action.d.ts +18 -0
- package/dist/types/editor/src/controller/form.d.ts +24 -0
- package/dist/types/editor/src/controller/history.d.ts +12 -0
- package/dist/types/editor/src/controller/shortcut.d.ts +20 -0
- package/dist/types/editor/src/controller/ui.d.ts +10 -0
- package/dist/types/editor/src/layouts/ControlEditSize.vue.d.ts +17 -0
- package/dist/types/editor/src/layouts/Framework.vue.d.ts +33 -0
- package/dist/types/editor/src/layouts/Resizer.vue.d.ts +13 -0
- package/dist/types/editor/src/layouts/ShortcutKey.vue.d.ts +8 -0
- package/dist/types/editor/src/main.d.ts +5 -0
- package/dist/types/editor/src/shims-vue.d.ts +23 -0
- package/dist/types/editor/src/starfish-editor.vue.d.ts +109 -0
- package/dist/types/editor/src/type.d.ts +224 -0
- package/dist/types/editor/src/utils/_.d.ts +33 -0
- package/dist/types/editor/src/utils/formKeycon.d.ts +18 -0
- package/dist/types/editor/src/utils/shortcutKey.d.ts +3 -0
- package/dist/types/editor/src/utils/vm.d.ts +3 -0
- package/dist/types/starfish-editor.d.ts +3 -0
- package/package.json +55 -0
- package/src/common/ConditionSelect/ConditionGroup.vue +167 -0
- package/src/common/ConditionSelect/ConditionModule.vue +118 -0
- package/src/common/ConditionSelect/ConditionTanc.vue +319 -0
- package/src/common/ConditionSelect.vue +268 -0
- package/src/common/CustomDialog.vue +77 -0
- package/src/common/Loading.vue +10 -0
- package/src/common/formJson.ts +143 -0
- package/src/common/formStyle.vue +170 -0
- package/src/common/jsonCode.vue +45 -0
- package/src/components/ComponentList.vue +156 -0
- package/src/components/FormPreview.vue +197 -0
- package/src/components/Nav.vue +128 -0
- package/src/components/NavList.vue +560 -0
- package/src/components/PropsPanel.vue +376 -0
- package/src/components/Shape.vue +178 -0
- package/src/components/Workspace.vue +258 -0
- package/src/components/globalFormList.vue +30 -0
- package/src/components/jsonEditor.vue +41 -0
- package/src/controller/action.ts +37 -0
- package/src/controller/form.ts +207 -0
- package/src/controller/history.ts +57 -0
- package/src/controller/shortcut.ts +81 -0
- package/src/controller/ui.ts +91 -0
- package/src/layouts/ControlEditSize.vue +52 -0
- package/src/layouts/Framework.vue +76 -0
- package/src/layouts/Resizer.vue +54 -0
- package/src/layouts/ShortcutKey.vue +61 -0
- package/src/main.ts +56 -0
- package/src/shims-vue.d.ts +23 -0
- package/src/starfish-editor.vue +176 -0
- package/src/styles/common/normalize.css +455 -0
- package/src/styles/component-list.scss +64 -0
- package/src/styles/condition-select.scss +176 -0
- package/src/styles/control_edit_size.scss +36 -0
- package/src/styles/custom-dialog.scss +110 -0
- package/src/styles/form-preview.scss +47 -0
- package/src/styles/framework.scss +150 -0
- package/src/styles/iconfont/iconfont.css +247 -0
- package/src/styles/iconfont/iconfont.js +1 -0
- package/src/styles/iconfont/iconfont.json +415 -0
- package/src/styles/iconfont/iconfont.ttf +0 -0
- package/src/styles/iconfont/iconfont.woff +0 -0
- package/src/styles/iconfont/iconfont.woff2 +0 -0
- package/src/styles/index.scss +18 -0
- package/src/styles/nav-list.scss +59 -0
- package/src/styles/nav.scss +46 -0
- package/src/styles/props-panel.scss +115 -0
- package/src/styles/resizer.scss +15 -0
- package/src/styles/shape.scss +101 -0
- package/src/styles/shortcutkey.scss +44 -0
- package/src/styles/variables.scss +36 -0
- package/src/styles/work-space.scss +126 -0
- package/src/type.ts +240 -0
- package/src/utils/_.ts +349 -0
- package/src/utils/formKeycon.ts +42 -0
- package/src/utils/shortcutKey.ts +46 -0
- package/src/utils/vm.ts +3 -0
- package/stats.html +4949 -0
- package/tsconfig.json +19 -0
- package/vite.config.ts +111 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { ElTooltip, ElButton, ElFooter } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/footer/style/css";
|
|
4
|
+
import "element-plus/es/components/button/style/css";
|
|
5
|
+
import "element-plus/es/components/tooltip/style/css";
|
|
6
|
+
import { defineComponent, ref, getCurrentInstance, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, createBlock, withCtx, createVNode, createTextVNode } from "vue";
|
|
7
|
+
import { css } from "@codemirror/lang-css";
|
|
8
|
+
import { Codemirror } from "vue-codemirror";
|
|
9
|
+
import { _ as _export_sfc } from "./main.js";
|
|
10
|
+
import "element-plus/dist/index.css";
|
|
11
|
+
import "jsoneditor/dist/jsoneditor.min.css";
|
|
12
|
+
import "starfish-form";
|
|
13
|
+
import "mitt";
|
|
14
|
+
import "element-plus";
|
|
15
|
+
import "nanoid";
|
|
16
|
+
import "starfish-form/dist/style.css";
|
|
17
|
+
import "clipboard";
|
|
18
|
+
import "element-plus/es/components/message/style/css";
|
|
19
|
+
import "element-plus/es/components/tabs/style/css";
|
|
20
|
+
import "element-plus/es/components/tab-pane/style/css";
|
|
21
|
+
import "element-plus/es/components/scrollbar/style/css";
|
|
22
|
+
import "element-plus/es/components/empty/style/css";
|
|
23
|
+
import "element-plus/es/components/form/style/css";
|
|
24
|
+
import "element-plus/es/components/form-item/style/css";
|
|
25
|
+
import "element-plus/es/components/loading/style/css";
|
|
26
|
+
import "element-plus/es/components/notification/style/css";
|
|
27
|
+
import "element-plus/es/components/input/style/css";
|
|
28
|
+
import "element-plus/es/components/upload/style/css";
|
|
29
|
+
import "element-plus/es/components/drawer/style/css";
|
|
30
|
+
import "element-plus/es/components/tree/style/css";
|
|
31
|
+
import "gesto";
|
|
32
|
+
import "keycon";
|
|
33
|
+
const _sfc_main = defineComponent({
|
|
34
|
+
ControlType: "FormStyle",
|
|
35
|
+
isHide: true,
|
|
36
|
+
props: {
|
|
37
|
+
item: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: () => ({})
|
|
40
|
+
},
|
|
41
|
+
data: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: () => ({})
|
|
44
|
+
},
|
|
45
|
+
controlItems: {
|
|
46
|
+
type: Array,
|
|
47
|
+
default: () => []
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
components: {
|
|
51
|
+
Codemirror
|
|
52
|
+
},
|
|
53
|
+
setup(props) {
|
|
54
|
+
const extensions = [css()];
|
|
55
|
+
const codeDialog = ref();
|
|
56
|
+
const code = ref();
|
|
57
|
+
const { proxy } = getCurrentInstance();
|
|
58
|
+
return {
|
|
59
|
+
code,
|
|
60
|
+
extensions,
|
|
61
|
+
codeDialog,
|
|
62
|
+
onStyleSet() {
|
|
63
|
+
codeDialog.value.init("\u8868\u5355\u6837\u5F0F\u8868", "icon-biaodan");
|
|
64
|
+
codeDialog.value.show();
|
|
65
|
+
},
|
|
66
|
+
saveCssStyle() {
|
|
67
|
+
props.data[props.item.data.fieldName] = code.value;
|
|
68
|
+
proxy.extractCssClass();
|
|
69
|
+
proxy.insertCustomCssToHead(code.value);
|
|
70
|
+
codeDialog.value.close();
|
|
71
|
+
},
|
|
72
|
+
closeCodeDialog() {
|
|
73
|
+
codeDialog.value.close();
|
|
74
|
+
},
|
|
75
|
+
extractCssClass() {
|
|
76
|
+
const regExp = /\..*{/g;
|
|
77
|
+
const result = code.value.match(regExp);
|
|
78
|
+
const cssNameArray = [];
|
|
79
|
+
if (!!result && result.length > 0) {
|
|
80
|
+
result.forEach((rItem) => {
|
|
81
|
+
const classArray = rItem.split(",");
|
|
82
|
+
if (classArray.length > 0) {
|
|
83
|
+
classArray.forEach((cItem) => {
|
|
84
|
+
const caItem = cItem.trim();
|
|
85
|
+
if (caItem.indexOf(".", 1) !== -1) {
|
|
86
|
+
const newClass = caItem.substring(
|
|
87
|
+
caItem.indexOf(".") + 1,
|
|
88
|
+
caItem.indexOf(".", 1)
|
|
89
|
+
);
|
|
90
|
+
if (newClass) {
|
|
91
|
+
cssNameArray.push(newClass.trim());
|
|
92
|
+
}
|
|
93
|
+
} else if (caItem.indexOf(" ") !== -1) {
|
|
94
|
+
const newClass = caItem.substring(
|
|
95
|
+
caItem.indexOf(".") + 1,
|
|
96
|
+
caItem.indexOf(" ")
|
|
97
|
+
);
|
|
98
|
+
if (newClass) {
|
|
99
|
+
cssNameArray.push(newClass.trim());
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (caItem.indexOf("{") !== -1) {
|
|
103
|
+
const newClass = caItem.substring(
|
|
104
|
+
caItem.indexOf(".") + 1,
|
|
105
|
+
caItem.indexOf("{")
|
|
106
|
+
);
|
|
107
|
+
cssNameArray.push(newClass.trim());
|
|
108
|
+
} else {
|
|
109
|
+
const newClass = caItem.substring(caItem.indexOf(".") + 1);
|
|
110
|
+
cssNameArray.push(newClass.trim());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
props.controlItems.find((item) => {
|
|
118
|
+
if (item.data.fieldName == "csslist") {
|
|
119
|
+
item.data.itemConfig.items = [];
|
|
120
|
+
cssNameArray.forEach((cssName, index) => {
|
|
121
|
+
item.data.itemConfig.items.push({
|
|
122
|
+
label: cssName,
|
|
123
|
+
value: cssName,
|
|
124
|
+
select: false,
|
|
125
|
+
id: index + 1
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
return item;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
insertCustomCssToHead(cssCode) {
|
|
133
|
+
const head = document.getElementsByTagName("head")[0];
|
|
134
|
+
const oldStyle = document.getElementById("starfish-custom-css");
|
|
135
|
+
if (oldStyle) {
|
|
136
|
+
head.removeChild(oldStyle);
|
|
137
|
+
}
|
|
138
|
+
const newStyle = document.createElement("style");
|
|
139
|
+
newStyle.type = "text/css";
|
|
140
|
+
newStyle.rel = "stylesheet";
|
|
141
|
+
newStyle.id = "starfish-custom-css";
|
|
142
|
+
try {
|
|
143
|
+
newStyle.appendChild(document.createTextNode(cssCode));
|
|
144
|
+
} catch (ex) {
|
|
145
|
+
newStyle.styleSheet.cssText = cssCode;
|
|
146
|
+
}
|
|
147
|
+
head.appendChild(newStyle);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
const _hoisted_1 = { class: "starfish-formitem" };
|
|
153
|
+
const _hoisted_2 = { class: "label" };
|
|
154
|
+
const _hoisted_3 = {
|
|
155
|
+
key: 0,
|
|
156
|
+
class: "item_require"
|
|
157
|
+
};
|
|
158
|
+
const _hoisted_4 = { class: "control" };
|
|
159
|
+
const _hoisted_5 = { class: "custom_code" };
|
|
160
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
161
|
+
const _component_el_tooltip = ElTooltip;
|
|
162
|
+
const _component_el_button = ElButton;
|
|
163
|
+
const _component_codemirror = resolveComponent("codemirror");
|
|
164
|
+
const _component_el_footer = ElFooter;
|
|
165
|
+
const _component_custom_dialog = resolveComponent("custom-dialog");
|
|
166
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
167
|
+
createElementVNode("div", _hoisted_2, [
|
|
168
|
+
createElementVNode("label", null, toDisplayString(_ctx.item.data.label), 1),
|
|
169
|
+
_ctx.item.data.required ? (openBlock(), createElementBlock("span", _hoisted_3, "*")) : createCommentVNode("", true),
|
|
170
|
+
_ctx.item.data.tip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
171
|
+
key: 1,
|
|
172
|
+
class: "item",
|
|
173
|
+
effect: "dark",
|
|
174
|
+
content: _ctx.item.data.tip,
|
|
175
|
+
placement: "top"
|
|
176
|
+
}, {
|
|
177
|
+
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
178
|
+
createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1)
|
|
179
|
+
])),
|
|
180
|
+
_: 1,
|
|
181
|
+
__: [1]
|
|
182
|
+
}, 8, ["content"])) : createCommentVNode("", true)
|
|
183
|
+
]),
|
|
184
|
+
createElementVNode("div", _hoisted_4, [
|
|
185
|
+
createVNode(_component_el_button, {
|
|
186
|
+
style: { "width": "100%" },
|
|
187
|
+
onClick: _ctx.onStyleSet,
|
|
188
|
+
type: _ctx.code ? "primary" : ""
|
|
189
|
+
}, {
|
|
190
|
+
default: withCtx(() => [
|
|
191
|
+
createTextVNode(toDisplayString(_ctx.code ? "\u5DF2\u8BBE\u7F6E" : "\u8BBE\u7F6E"), 1)
|
|
192
|
+
]),
|
|
193
|
+
_: 1
|
|
194
|
+
}, 8, ["onClick", "type"]),
|
|
195
|
+
createVNode(_component_custom_dialog, {
|
|
196
|
+
ref: "codeDialog",
|
|
197
|
+
dialogclass: "codeDialog",
|
|
198
|
+
width: "1000"
|
|
199
|
+
}, {
|
|
200
|
+
default: withCtx(() => [
|
|
201
|
+
createElementVNode("div", _hoisted_5, [
|
|
202
|
+
createVNode(_component_codemirror, {
|
|
203
|
+
modelValue: _ctx.code,
|
|
204
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.code = $event),
|
|
205
|
+
placeholder: ".starfish-form-css{}",
|
|
206
|
+
style: { height: "400px" },
|
|
207
|
+
autofocus: true,
|
|
208
|
+
extensions: _ctx.extensions,
|
|
209
|
+
"indent-with-tab": true,
|
|
210
|
+
"tab-size": 2
|
|
211
|
+
}, null, 8, ["modelValue", "extensions"])
|
|
212
|
+
]),
|
|
213
|
+
createVNode(_component_el_footer, {
|
|
214
|
+
class: "my-Footer",
|
|
215
|
+
style: { "text-align": "center" }
|
|
216
|
+
}, {
|
|
217
|
+
default: withCtx(() => [
|
|
218
|
+
createVNode(_component_el_button, {
|
|
219
|
+
type: "primary",
|
|
220
|
+
onClick: _ctx.saveCssStyle
|
|
221
|
+
}, {
|
|
222
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
223
|
+
createTextVNode("\u786E\u5B9A", -1)
|
|
224
|
+
])),
|
|
225
|
+
_: 1,
|
|
226
|
+
__: [2]
|
|
227
|
+
}, 8, ["onClick"]),
|
|
228
|
+
createVNode(_component_el_button, { onClick: _ctx.closeCodeDialog }, {
|
|
229
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
230
|
+
createTextVNode("\u5173\u95ED", -1)
|
|
231
|
+
])),
|
|
232
|
+
_: 1,
|
|
233
|
+
__: [3]
|
|
234
|
+
}, 8, ["onClick"])
|
|
235
|
+
]),
|
|
236
|
+
_: 1
|
|
237
|
+
})
|
|
238
|
+
]),
|
|
239
|
+
_: 1
|
|
240
|
+
}, 512)
|
|
241
|
+
])
|
|
242
|
+
]);
|
|
243
|
+
}
|
|
244
|
+
var formStyle = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
245
|
+
export { formStyle as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, resolveDynamicComponent } from "vue";
|
|
2
|
+
import { _ as _export_sfc } from "./main.js";
|
|
3
|
+
import "element-plus/dist/index.css";
|
|
4
|
+
import "jsoneditor/dist/jsoneditor.min.css";
|
|
5
|
+
import "starfish-form";
|
|
6
|
+
import "mitt";
|
|
7
|
+
import "element-plus";
|
|
8
|
+
import "nanoid";
|
|
9
|
+
import "starfish-form/dist/style.css";
|
|
10
|
+
import "element-plus/es";
|
|
11
|
+
import "element-plus/es/components/base/style/css";
|
|
12
|
+
import "element-plus/es/components/footer/style/css";
|
|
13
|
+
import "element-plus/es/components/button/style/css";
|
|
14
|
+
import "clipboard";
|
|
15
|
+
import "element-plus/es/components/message/style/css";
|
|
16
|
+
import "element-plus/es/components/tabs/style/css";
|
|
17
|
+
import "element-plus/es/components/tab-pane/style/css";
|
|
18
|
+
import "element-plus/es/components/scrollbar/style/css";
|
|
19
|
+
import "element-plus/es/components/empty/style/css";
|
|
20
|
+
import "element-plus/es/components/form/style/css";
|
|
21
|
+
import "element-plus/es/components/form-item/style/css";
|
|
22
|
+
import "element-plus/es/components/loading/style/css";
|
|
23
|
+
import "element-plus/es/components/notification/style/css";
|
|
24
|
+
import "element-plus/es/components/input/style/css";
|
|
25
|
+
import "element-plus/es/components/upload/style/css";
|
|
26
|
+
import "element-plus/es/components/drawer/style/css";
|
|
27
|
+
import "element-plus/es/components/tree/style/css";
|
|
28
|
+
import "element-plus/es/components/tooltip/style/css";
|
|
29
|
+
import "gesto";
|
|
30
|
+
import "keycon";
|
|
31
|
+
const _sfc_main = defineComponent({
|
|
32
|
+
setup() {
|
|
33
|
+
const { formStore } = inject("control") || {};
|
|
34
|
+
const globalFormLists = computed(() => formStore == null ? void 0 : formStore.get("globalFormList"));
|
|
35
|
+
const globalDatas = computed(() => formStore == null ? void 0 : formStore.get("globalDatas"));
|
|
36
|
+
return {
|
|
37
|
+
globalFormLists,
|
|
38
|
+
globalDatas
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
43
|
+
return openBlock(), createElementBlock("div", null, [
|
|
44
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.globalFormLists, (item, index) => {
|
|
45
|
+
return openBlock(), createElementBlock("div", {
|
|
46
|
+
key: index,
|
|
47
|
+
class: "form_tab3_list"
|
|
48
|
+
}, [
|
|
49
|
+
(openBlock(), createBlock(resolveDynamicComponent(item.ControlType), {
|
|
50
|
+
item,
|
|
51
|
+
data: _ctx.globalDatas,
|
|
52
|
+
controlItems: _ctx.globalFormLists
|
|
53
|
+
}, null, 8, ["item", "data", "controlItems"]))
|
|
54
|
+
]);
|
|
55
|
+
}), 128))
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
var globalFormList = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
59
|
+
export { globalFormList as default };
|
package/dist/jsonCode.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, createVNode } from "vue";
|
|
2
|
+
import { json } from "@codemirror/lang-json";
|
|
3
|
+
import { Codemirror } from "vue-codemirror";
|
|
4
|
+
import { _ as _export_sfc } from "./main.js";
|
|
5
|
+
import "element-plus/dist/index.css";
|
|
6
|
+
import "jsoneditor/dist/jsoneditor.min.css";
|
|
7
|
+
import "starfish-form";
|
|
8
|
+
import "mitt";
|
|
9
|
+
import "element-plus";
|
|
10
|
+
import "nanoid";
|
|
11
|
+
import "starfish-form/dist/style.css";
|
|
12
|
+
import "element-plus/es";
|
|
13
|
+
import "element-plus/es/components/base/style/css";
|
|
14
|
+
import "element-plus/es/components/footer/style/css";
|
|
15
|
+
import "element-plus/es/components/button/style/css";
|
|
16
|
+
import "clipboard";
|
|
17
|
+
import "element-plus/es/components/message/style/css";
|
|
18
|
+
import "element-plus/es/components/tabs/style/css";
|
|
19
|
+
import "element-plus/es/components/tab-pane/style/css";
|
|
20
|
+
import "element-plus/es/components/scrollbar/style/css";
|
|
21
|
+
import "element-plus/es/components/empty/style/css";
|
|
22
|
+
import "element-plus/es/components/form/style/css";
|
|
23
|
+
import "element-plus/es/components/form-item/style/css";
|
|
24
|
+
import "element-plus/es/components/loading/style/css";
|
|
25
|
+
import "element-plus/es/components/notification/style/css";
|
|
26
|
+
import "element-plus/es/components/input/style/css";
|
|
27
|
+
import "element-plus/es/components/upload/style/css";
|
|
28
|
+
import "element-plus/es/components/drawer/style/css";
|
|
29
|
+
import "element-plus/es/components/tree/style/css";
|
|
30
|
+
import "element-plus/es/components/tooltip/style/css";
|
|
31
|
+
import "gesto";
|
|
32
|
+
import "keycon";
|
|
33
|
+
const _sfc_main = defineComponent({
|
|
34
|
+
components: {
|
|
35
|
+
Codemirror
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
value: String
|
|
39
|
+
},
|
|
40
|
+
emits: ["update:value"],
|
|
41
|
+
setup(props, context) {
|
|
42
|
+
const extensions = [json()];
|
|
43
|
+
const internalValue = ref(props.value);
|
|
44
|
+
function updateInternalValue(newVal) {
|
|
45
|
+
internalValue.value = newVal;
|
|
46
|
+
if (context.attrs["onUpdate"]) {
|
|
47
|
+
context.attrs["onUpdate"](newVal);
|
|
48
|
+
} else {
|
|
49
|
+
context.emit("update:value", newVal);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
extensions,
|
|
54
|
+
internalValue,
|
|
55
|
+
onUpdateValue: updateInternalValue
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
60
|
+
const _component_codemirror = resolveComponent("codemirror");
|
|
61
|
+
return openBlock(), createElementBlock("div", null, [
|
|
62
|
+
createVNode(_component_codemirror, {
|
|
63
|
+
modelValue: _ctx.internalValue,
|
|
64
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.internalValue = $event),
|
|
65
|
+
onInput: _cache[1] || (_cache[1] = ($event) => _ctx.onUpdateValue($event.target.innerText)),
|
|
66
|
+
placeholder: "json\u5BFC\u5165",
|
|
67
|
+
mode: "text/json",
|
|
68
|
+
style: { height: "400px" },
|
|
69
|
+
extensions: _ctx.extensions
|
|
70
|
+
}, null, 8, ["modelValue", "extensions"])
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
var jsonCode = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
74
|
+
export { jsonCode as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineComponent, ref, inject, computed, onMounted, openBlock, createElementBlock, toRaw } from "vue";
|
|
2
|
+
import JSONEditor from "jsoneditor";
|
|
3
|
+
import { _ as _export_sfc } from "./main.js";
|
|
4
|
+
import "element-plus/dist/index.css";
|
|
5
|
+
import "jsoneditor/dist/jsoneditor.min.css";
|
|
6
|
+
import "starfish-form";
|
|
7
|
+
import "mitt";
|
|
8
|
+
import "element-plus";
|
|
9
|
+
import "nanoid";
|
|
10
|
+
import "starfish-form/dist/style.css";
|
|
11
|
+
import "element-plus/es";
|
|
12
|
+
import "element-plus/es/components/base/style/css";
|
|
13
|
+
import "element-plus/es/components/footer/style/css";
|
|
14
|
+
import "element-plus/es/components/button/style/css";
|
|
15
|
+
import "clipboard";
|
|
16
|
+
import "element-plus/es/components/message/style/css";
|
|
17
|
+
import "element-plus/es/components/tabs/style/css";
|
|
18
|
+
import "element-plus/es/components/tab-pane/style/css";
|
|
19
|
+
import "element-plus/es/components/scrollbar/style/css";
|
|
20
|
+
import "element-plus/es/components/empty/style/css";
|
|
21
|
+
import "element-plus/es/components/form/style/css";
|
|
22
|
+
import "element-plus/es/components/form-item/style/css";
|
|
23
|
+
import "element-plus/es/components/loading/style/css";
|
|
24
|
+
import "element-plus/es/components/notification/style/css";
|
|
25
|
+
import "element-plus/es/components/input/style/css";
|
|
26
|
+
import "element-plus/es/components/upload/style/css";
|
|
27
|
+
import "element-plus/es/components/drawer/style/css";
|
|
28
|
+
import "element-plus/es/components/tree/style/css";
|
|
29
|
+
import "element-plus/es/components/tooltip/style/css";
|
|
30
|
+
import "gesto";
|
|
31
|
+
import "keycon";
|
|
32
|
+
const _sfc_main = defineComponent({
|
|
33
|
+
setup(props, context) {
|
|
34
|
+
const jsonCenter = ref();
|
|
35
|
+
let jsonEditor2 = void 0;
|
|
36
|
+
const { formStore } = inject("control") || {};
|
|
37
|
+
const allmainList = computed(() => formStore == null ? void 0 : formStore.get("allFormList"));
|
|
38
|
+
const initFormToJson = (formlist) => {
|
|
39
|
+
return window.VueContext.$Flex.initFormToJson(toRaw(formlist));
|
|
40
|
+
};
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
const result = initJsonCenter();
|
|
43
|
+
context.emit("editor", result);
|
|
44
|
+
});
|
|
45
|
+
function initJsonCenter() {
|
|
46
|
+
const jsonDom = jsonCenter.value;
|
|
47
|
+
if (jsonEditor2) {
|
|
48
|
+
jsonEditor2 == null ? void 0 : jsonEditor2.set(initFormToJson(allmainList.value));
|
|
49
|
+
} else {
|
|
50
|
+
const options = {
|
|
51
|
+
modes: ["text", "code", "view"],
|
|
52
|
+
mode: "code",
|
|
53
|
+
search: false
|
|
54
|
+
};
|
|
55
|
+
jsonEditor2 = new JSONEditor(jsonDom, options);
|
|
56
|
+
jsonEditor2 == null ? void 0 : jsonEditor2.set(initFormToJson(allmainList.value));
|
|
57
|
+
}
|
|
58
|
+
return jsonEditor2;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
initJsonCenter,
|
|
62
|
+
jsonCenter
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const _hoisted_1 = { ref: "jsonCenter" };
|
|
67
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
68
|
+
return openBlock(), createElementBlock("div", _hoisted_1, null, 512);
|
|
69
|
+
}
|
|
70
|
+
var jsonEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
71
|
+
export { jsonEditor as default };
|