starfish-form-custom 1.0.46 → 1.0.48

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.
@@ -11,7 +11,7 @@ import 'element-plus/es/components/button/style/css';
11
11
  import 'element-plus/es/components/tooltip/style/css';
12
12
  import { defineComponent, inject, ref, getCurrentInstance, reactive, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, toDisplayString, createCommentVNode, createBlock, withCtx, createTextVNode, createVNode, Fragment, renderList, withModifiers } from 'vue';
13
13
  import { Codemirror } from 'vue-codemirror';
14
- import { _ as _export_sfc } from './main-d99755be.mjs';
14
+ import { _ as _export_sfc } from './main-aab412b3.mjs';
15
15
  import 'element-plus/es/components/icon/style/css';
16
16
  import 'element-plus/es/components/checkbox/style/css';
17
17
  import '@element-plus/icons-vue';
@@ -13,9 +13,9 @@ import 'element-plus/es/components/dropdown-item/style/css';
13
13
  import 'element-plus/es/components/button/style/css';
14
14
  import 'element-plus/es/components/tooltip/style/css';
15
15
  import { defineComponent, getCurrentInstance, inject, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, createCommentVNode, createBlock, withCtx, createVNode, createTextVNode, Fragment, renderList } from 'vue';
16
- import { _ as _export_sfc, a as _, f as fieldProps, r as ruleList, b as ruleJsonData } from './main-d99755be.mjs';
16
+ import { _ as _export_sfc, a as _, f as fieldProps, r as ruleList, b as ruleJsonData } from './main-aab412b3.mjs';
17
17
  import { Delete } from '@element-plus/icons-vue';
18
- import Dynamicform from './starfish-form-0baee1df.mjs';
18
+ import Dynamicform from './starfish-form-a750924c.mjs';
19
19
  import { Codemirror } from 'vue-codemirror';
20
20
  import 'element-plus/es/components/input/style/css';
21
21
  import 'element-plus/es/components/checkbox/style/css';
@@ -0,0 +1,240 @@
1
+ import { ElTooltip } from 'element-plus/es';
2
+ import 'element-plus/es/components/base/style/css';
3
+ import 'element-plus/es/components/tooltip/style/css';
4
+ import { defineComponent, ref, computed, watch, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createCommentVNode, toDisplayString, createBlock, withCtx, withModifiers, createVNode } from 'vue';
5
+ import { QuillEditor } from '@vueup/vue-quill';
6
+ import '@vueup/vue-quill/dist/vue-quill.snow.css';
7
+ import { _ as _export_sfc, g as getFormConfig, f as fieldProps, u as useWatch } from './main-aab412b3.mjs';
8
+ import 'element-plus/es/components/icon/style/css';
9
+ import 'element-plus/es/components/input/style/css';
10
+ import 'element-plus/es/components/checkbox/style/css';
11
+ import '@element-plus/icons-vue';
12
+ import 'element-plus/es/components/loading/style/css';
13
+ import 'element-plus/es/components/dropdown/style/css';
14
+ import 'element-plus/es/components/dropdown-menu/style/css';
15
+ import 'element-plus/es/components/dropdown-item/style/css';
16
+ import 'element-plus/es/components/collapse/style/css';
17
+ import 'element-plus/es/components/collapse-item/style/css';
18
+ import 'element-plus/es/components/row/style/css';
19
+ import 'element-plus/es/components/button/style/css';
20
+ import 'element-plus/es/components/col/style/css';
21
+ import 'element-plus/es/components/select/style/css';
22
+ import 'element-plus/es/components/option/style/css';
23
+ import 'element-plus/es/components/input-number/style/css';
24
+ import 'element-plus/es/components/radio-group/style/css';
25
+ import 'element-plus/es/components/radio-button/style/css';
26
+ import 'element-plus/es/components/checkbox-group/style/css';
27
+ import 'element-plus/es/components/color-picker/style/css';
28
+ import 'element-plus/es/components/date-picker/style/css';
29
+ import 'element-plus/es/components/radio/style/css';
30
+ import 'element-plus/es/components/slider/style/css';
31
+ import 'element-plus/es/components/switch/style/css';
32
+ import 'element-plus/es/components/time-select/style/css';
33
+ import 'element-plus/es/components/divider/style/css';
34
+ import 'element-plus/es/components/alert/style/css';
35
+ import 'element-plus/es/components/tabs/style/css';
36
+ import 'element-plus/es/components/tab-pane/style/css';
37
+ import 'element-plus/es/components/form-item/style/css';
38
+ import 'element-plus';
39
+
40
+ /* unplugin-vue-components disabled */const index_vue_vue_type_style_index_0_scoped_true_lang = '';
41
+
42
+ const _sfc_main = defineComponent({
43
+ ControlType: "RichText",
44
+ nameCn: "\u5BCC\u6587\u672C",
45
+ icon: "icon-textEdit",
46
+ formConfig: getFormConfig("RichText", [
47
+ { fieldName: "state", component: "Radio" }
48
+ ]),
49
+ props: {
50
+ ...fieldProps
51
+ },
52
+ components: {
53
+ QuillEditor
54
+ },
55
+ setup(props) {
56
+ useWatch(props);
57
+ const quillEditorRef = ref();
58
+ const internalContent = ref(null);
59
+ const isEditorReady = ref(false);
60
+ const toolbarOptions = [
61
+ ["bold", "italic", "underline", "strike"],
62
+ ["blockquote", "code-block"],
63
+ ["link", "image", "formula"],
64
+ [{ header: 1 }, { header: 2 }],
65
+ [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
66
+ [{ script: "sub" }, { script: "super" }],
67
+ [{ indent: "-1" }, { indent: "+1" }],
68
+ [{ direction: "rtl" }],
69
+ [{ size: ["small", false, "large", "huge"] }],
70
+ [{ header: [1, 2, 3, 4, 5, 6, false] }],
71
+ [{ color: [] }, { background: [] }],
72
+ [{ font: [] }],
73
+ [{ align: [] }],
74
+ ["clean"]
75
+ ];
76
+ const isReadonly = computed(
77
+ () => props.readonly || props.item.data.state === "readonly"
78
+ );
79
+ const onEditorReady = () => {
80
+ isEditorReady.value = true;
81
+ initContentFromProps();
82
+ };
83
+ const initContentFromProps = () => {
84
+ if (!isEditorReady.value)
85
+ return;
86
+ const fieldName = props.item.data.fieldName;
87
+ const rawValue = props.data[fieldName];
88
+ const defaultValue = props.item.data.default || "";
89
+ if (rawValue === void 0 || rawValue === null || rawValue === "") {
90
+ internalContent.value = defaultValue;
91
+ return;
92
+ }
93
+ if (rawValue && typeof rawValue === "object" && Array.isArray(rawValue.ops)) {
94
+ internalContent.value = rawValue;
95
+ return;
96
+ }
97
+ if (typeof rawValue === "string") {
98
+ if (rawValue.trim().startsWith("{") || rawValue.trim().startsWith("[")) {
99
+ try {
100
+ const parsed = JSON.parse(rawValue);
101
+ if (parsed && Array.isArray(parsed.ops)) {
102
+ internalContent.value = parsed;
103
+ } else {
104
+ internalContent.value = rawValue;
105
+ }
106
+ } catch {
107
+ internalContent.value = rawValue;
108
+ }
109
+ } else {
110
+ internalContent.value = rawValue;
111
+ }
112
+ return;
113
+ }
114
+ internalContent.value = defaultValue;
115
+ };
116
+ const handleContentChange = (value) => {
117
+ internalContent.value = value;
118
+ if (!quillEditorRef.value)
119
+ return;
120
+ const quill = quillEditorRef.value.getQuill();
121
+ if (!quill)
122
+ return;
123
+ const fieldName = props.item.data.fieldName;
124
+ const htmlContent = quill.root.innerHTML;
125
+ props.data[fieldName] = htmlContent;
126
+ };
127
+ watch(
128
+ () => props.data[props.item.data.fieldName],
129
+ (newValue) => {
130
+ if (!isEditorReady.value)
131
+ return;
132
+ let newInternalValue = null;
133
+ if (newValue === void 0 || newValue === null || newValue === "") {
134
+ newInternalValue = props.item.data.default || "";
135
+ } else if (newValue && typeof newValue === "object" && Array.isArray(newValue.ops)) {
136
+ newInternalValue = newValue;
137
+ } else if (typeof newValue === "string") {
138
+ if (newValue.trim().startsWith("{") || newValue.trim().startsWith("[")) {
139
+ try {
140
+ const parsed = JSON.parse(newValue);
141
+ if (parsed && Array.isArray(parsed.ops)) {
142
+ newInternalValue = parsed;
143
+ } else {
144
+ newInternalValue = newValue;
145
+ }
146
+ } catch {
147
+ newInternalValue = newValue;
148
+ }
149
+ } else {
150
+ newInternalValue = newValue;
151
+ }
152
+ }
153
+ if (JSON.stringify(newInternalValue) !== JSON.stringify(internalContent.value)) {
154
+ internalContent.value = newInternalValue;
155
+ }
156
+ },
157
+ { immediate: true }
158
+ );
159
+ watch(isEditorReady, (ready) => {
160
+ if (ready) {
161
+ nextTick(() => {
162
+ initContentFromProps();
163
+ });
164
+ }
165
+ });
166
+ return {
167
+ content: internalContent,
168
+ quillEditorRef,
169
+ handleContentChange,
170
+ onEditorReady,
171
+ toolbarOptions,
172
+ isReadonly
173
+ };
174
+ }
175
+ });
176
+ const _hoisted_1 = ["data-control-type", "data-id"];
177
+ const _hoisted_2 = {
178
+ key: 0,
179
+ class: "item_require"
180
+ };
181
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
182
+ const _component_el_tooltip = ElTooltip;
183
+ const _component_QuillEditor = resolveComponent("QuillEditor");
184
+ return openBlock(), createElementBlock("div", {
185
+ class: normalizeClass(["starfish-formitem", {
186
+ formCover: _ctx.drag,
187
+ "starfish-vertical": _ctx.labelalign != "top",
188
+ [_ctx.item.data.csslist?.join(" ")]: !!_ctx.item.data.csslist
189
+ }]),
190
+ "data-control-type": _ctx.item.ControlType,
191
+ "data-id": _ctx.item.id
192
+ }, [
193
+ createElementVNode("div", {
194
+ class: normalizeClass(["label", "label_" + _ctx.labelalign]),
195
+ style: normalizeStyle({ width: _ctx.labelWidth + "px" })
196
+ }, [
197
+ _ctx.item.data.required && !_ctx.readonly && _ctx.item.data.state !== "readonly" ? (openBlock(), createElementBlock("span", _hoisted_2, "*")) : createCommentVNode("", true),
198
+ createElementVNode("label", null, toDisplayString(_ctx.item.data.label) + toDisplayString(_ctx.suffix), 1),
199
+ _ctx.item.data.tip && !_ctx.readonly ? (openBlock(), createBlock(_component_el_tooltip, {
200
+ key: 1,
201
+ class: "item",
202
+ effect: "dark",
203
+ content: _ctx.item.data.tip,
204
+ placement: "top"
205
+ }, {
206
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
207
+ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1)
208
+ ])]),
209
+ _: 1
210
+ }, 8, ["content"])) : createCommentVNode("", true)
211
+ ], 6),
212
+ createElementVNode("div", {
213
+ class: "control",
214
+ style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
215
+ }, [
216
+ createElementVNode("div", {
217
+ class: "rich-text-editor",
218
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
219
+ }, ["stop"]))
220
+ }, [
221
+ createVNode(_component_QuillEditor, {
222
+ ref: "quillEditorRef",
223
+ theme: "snow",
224
+ content: _ctx.internalContent,
225
+ "onUpdate:content": [
226
+ _cache[0] || (_cache[0] = ($event) => _ctx.internalContent = $event),
227
+ _ctx.handleContentChange
228
+ ],
229
+ onReady: _ctx.onEditorReady,
230
+ toolbar: _ctx.toolbarOptions,
231
+ "read-only": _ctx.isReadonly || _ctx.drag,
232
+ class: "editor-content"
233
+ }, null, 8, ["content", "onUpdate:content", "onReady", "toolbar", "read-only"])
234
+ ])
235
+ ], 4)
236
+ ], 10, _hoisted_1);
237
+ }
238
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-77a8db1a"]]);
239
+
240
+ export { index as default };
@@ -6,7 +6,7 @@ import 'element-plus/es/components/button/style/css';
6
6
  import 'element-plus/es/components/main/style/css';
7
7
  import 'element-plus/es/components/tooltip/style/css';
8
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-d99755be.mjs';
9
+ import { _ as _export_sfc, a as _, g as getFormConfig, f as fieldProps, u as useWatch } from './main-aab412b3.mjs';
10
10
  import JSONEditor from 'jsoneditor';
11
11
  import 'element-plus/es/components/icon/style/css';
12
12
  import 'element-plus/es/components/input/style/css';