starfish-form-custom 1.0.32 → 1.0.33

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/components.d.ts CHANGED
@@ -48,6 +48,8 @@ declare module 'vue' {
48
48
  ElTooltip: typeof import('element-plus/es')['ElTooltip']
49
49
  InputNumber: typeof import('./src/components/InputNumber/index.vue')['default']
50
50
  JsonEditor: typeof import('./src/components/JsonEditor/index.vue')['default']
51
+ MenuBar: typeof import('./src/components/RichText/MenuBar.vue')['default']
52
+ MenuItem: typeof import('./src/components/RichText/MenuItem.vue')['default']
51
53
  Radio: typeof import('./src/components/Radio/index.vue')['default']
52
54
  RichText: typeof import('./src/components/RichText/index.vue')['default']
53
55
  RouterLink: typeof import('vue-router')['RouterLink']
@@ -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, createVNode, Fragment, renderList, withModifiers, createTextVNode } from 'vue';
13
13
  import { Codemirror } from 'vue-codemirror';
14
- import { _ as _export_sfc } from './main-a797684b.mjs';
14
+ import { _ as _export_sfc } from './main-8dad66de.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';
@@ -32,6 +32,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
32
32
  import 'element-plus/es/components/color-picker/style/css';
33
33
  import 'element-plus/es/components/date-picker/style/css';
34
34
  import 'element-plus/es/components/radio/style/css';
35
+ import 'remixicon/fonts/remixicon.symbol.svg';
35
36
  import 'element-plus/es/components/slider/style/css';
36
37
  import 'element-plus/es/components/switch/style/css';
37
38
  import 'element-plus/es/components/time-select/style/css';
@@ -1,9 +1,13 @@
1
+ import { _ as _export_sfc, g as getFormConfig, f as fieldProps, a as __unplugin_components_1, u as useWatch } from './main-8dad66de.mjs';
1
2
  import { ElTooltip } from 'element-plus/es';
2
3
  import 'element-plus/es/components/base/style/css';
3
4
  import 'element-plus/es/components/tooltip/style/css';
4
- import { defineComponent, ref, onMounted, onUnmounted, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createCommentVNode, toDisplayString, createBlock, withCtx } from 'vue';
5
- import E from 'wangeditor';
6
- import { _ as _export_sfc, g as getFormConfig, f as fieldProps, u as useWatch } from './main-a797684b.mjs';
5
+ import { defineComponent, watch, onUnmounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createCommentVNode, toDisplayString, createBlock, withCtx, createVNode, pushScopeId, popScopeId } from 'vue';
6
+ import { EditorContent, useEditor } from '@tiptap/vue-3';
7
+ import StarterKit from '@tiptap/starter-kit';
8
+ import Code from '@tiptap/extension-code';
9
+ import Blockquote from '@tiptap/extension-blockquote';
10
+ import HorizontalRule from '@tiptap/extension-horizontal-rule';
7
11
  import 'element-plus/es/components/icon/style/css';
8
12
  import 'element-plus/es/components/input/style/css';
9
13
  import 'element-plus/es/components/checkbox/style/css';
@@ -26,6 +30,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
26
30
  import 'element-plus/es/components/color-picker/style/css';
27
31
  import 'element-plus/es/components/date-picker/style/css';
28
32
  import 'element-plus/es/components/radio/style/css';
33
+ import 'remixicon/fonts/remixicon.symbol.svg';
29
34
  import 'element-plus/es/components/slider/style/css';
30
35
  import 'element-plus/es/components/switch/style/css';
31
36
  import 'element-plus/es/components/time-select/style/css';
@@ -36,60 +41,77 @@ import 'element-plus/es/components/tab-pane/style/css';
36
41
  import 'element-plus/es/components/form-item/style/css';
37
42
  import 'element-plus';
38
43
 
44
+ /* unplugin-vue-components disabled */const index_vue_vue_type_style_index_0_scoped_true_lang = '';
45
+
39
46
  const _sfc_main = defineComponent({
40
47
  ControlType: "RichText",
41
- // 必须与文件名匹配
42
48
  nameCn: "\u5BCC\u6587\u672C",
43
49
  icon: "icon-textEdit",
44
50
  formConfig: getFormConfig("RichText", [{ fieldName: "state", component: "Radio" }]),
45
51
  props: {
46
52
  ...fieldProps
47
53
  },
54
+ components: {
55
+ EditorContent,
56
+ MenuBar: __unplugin_components_1
57
+ },
48
58
  setup(props) {
49
- const richText = ref();
50
- let editor = null;
59
+ const editor = useEditor({
60
+ content: props.data[props.item.data.fieldName] || props.item.data.defaultValue || "",
61
+ extensions: [
62
+ StarterKit,
63
+ Code,
64
+ Blockquote,
65
+ HorizontalRule
66
+ ],
67
+ editable: !props.readonly,
68
+ editorProps: {
69
+ attributes: {
70
+ class: "prose focus:outline-none max-w-none",
71
+ style: "min-height: 200px; border: 1px solid #DCDFE6; border-radius: 4px; padding: 8px 12px;"
72
+ }
73
+ },
74
+ onUpdate: ({ editor: editor2 }) => {
75
+ const html = editor2.getHTML();
76
+ props.data[props.item.data.fieldName] = html;
77
+ },
78
+ onBlur: ({ editor: editor2 }) => {
79
+ const html = editor2.getHTML();
80
+ props.data[props.item.data.fieldName] = html;
81
+ }
82
+ });
51
83
  useWatch(props);
52
- onMounted(() => {
53
- if (props.drag) {
54
- editor = new E(richText.value);
55
- editor.config.focus = false;
56
- editor.create();
57
- } else {
58
- editor = new E(richText.value);
59
- editor.config.focus = false;
60
- editor.create();
61
- const data = props.data;
62
- const item = props.item;
63
- editor.config.onchange = function(newHtml) {
64
- console.log("onblur", newHtml);
65
- data[item.data.fieldName] = newHtml;
66
- };
84
+ watch(() => props.item.data.defaultValue, (newVal) => {
85
+ if (editor.value && newVal) {
86
+ editor.value.commands.setContent(newVal, false);
87
+ }
88
+ });
89
+ watch(() => props.readonly, (newVal) => {
90
+ if (editor.value) {
91
+ editor.value.setEditable(!newVal);
67
92
  }
68
93
  });
69
94
  onUnmounted(() => {
70
- editor.destroy();
71
- editor = null;
95
+ if (editor.value) {
96
+ editor.value.destroy();
97
+ }
72
98
  });
73
99
  return {
74
- richText
100
+ editor
75
101
  };
76
102
  }
77
103
  });
104
+ const _withScopeId = (n) => (pushScopeId("data-v-5e5c12c4"), n = n(), popScopeId(), n);
78
105
  const _hoisted_1 = {
79
106
  key: 0,
80
107
  class: "item_require"
81
108
  };
82
- const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
83
- const _hoisted_3 = {
84
- key: 0,
85
- ref: "richText"
86
- };
87
- const _hoisted_4 = {
88
- key: 1,
89
- ref: "richText"
90
- };
109
+ const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1));
110
+ const _hoisted_3 = { class: "rich-text-editor" };
91
111
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
112
  const _component_el_tooltip = ElTooltip;
113
+ const _component_MenuBar = __unplugin_components_1;
114
+ const _component_editor_content = resolveComponent("editor-content");
93
115
  return openBlock(), createElementBlock("div", {
94
116
  class: normalizeClass(["starfish-formitem", { formCover: _ctx.drag, "starfish-vertical": _ctx.labelalign != "top", [_ctx.item.data.csslist?.join(" ")]: !!_ctx.item.data.csslist }])
95
117
  }, [
@@ -116,11 +138,19 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
116
138
  class: "control",
117
139
  style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
118
140
  }, [
119
- _ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_3, null, 512)) : createCommentVNode("", true),
120
- !_ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_4, null, 512)) : createCommentVNode("", true)
141
+ createElementVNode("div", _hoisted_3, [
142
+ _ctx.editor && !_ctx.readonly ? (openBlock(), createBlock(_component_MenuBar, {
143
+ key: 0,
144
+ editor: _ctx.editor
145
+ }, null, 8, ["editor"])) : createCommentVNode("", true),
146
+ createVNode(_component_editor_content, {
147
+ editor: _ctx.editor,
148
+ class: "editor-content"
149
+ }, null, 8, ["editor"])
150
+ ])
121
151
  ], 4)
122
152
  ], 2);
123
153
  }
124
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
154
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5e5c12c4"]]);
125
155
 
126
156
  export { index as default };
@@ -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, Fragment, renderList, createTextVNode } from 'vue';
16
- import { _ as _export_sfc, a as _, f as fieldProps, r as ruleList, b as ruleJsonData } from './main-a797684b.mjs';
16
+ import { _ as _export_sfc, b as _, f as fieldProps, r as ruleList, c as ruleJsonData } from './main-8dad66de.mjs';
17
17
  import { Delete } from '@element-plus/icons-vue';
18
- import Dynamicform from './starfish-form-627ee711.mjs';
18
+ import Dynamicform from './starfish-form-4c2ab774.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';
@@ -31,6 +31,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
31
31
  import 'element-plus/es/components/color-picker/style/css';
32
32
  import 'element-plus/es/components/date-picker/style/css';
33
33
  import 'element-plus/es/components/radio/style/css';
34
+ import 'remixicon/fonts/remixicon.symbol.svg';
34
35
  import 'element-plus/es/components/slider/style/css';
35
36
  import 'element-plus/es/components/switch/style/css';
36
37
  import 'element-plus/es/components/time-select/style/css';
@@ -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-a797684b.mjs';
9
+ import { _ as _export_sfc, b as _, g as getFormConfig, f as fieldProps, u as useWatch } from './main-8dad66de.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';
@@ -29,6 +29,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
29
29
  import 'element-plus/es/components/color-picker/style/css';
30
30
  import 'element-plus/es/components/date-picker/style/css';
31
31
  import 'element-plus/es/components/radio/style/css';
32
+ import 'remixicon/fonts/remixicon.symbol.svg';
32
33
  import 'element-plus/es/components/slider/style/css';
33
34
  import 'element-plus/es/components/switch/style/css';
34
35
  import 'element-plus/es/components/time-select/style/css';