starfish-form-custom 1.0.32 → 1.0.34

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-0192f89c.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';
@@ -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-0192f89c.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';
@@ -1,9 +1,14 @@
1
+ import { _ as _export_sfc, g as getFormConfig, f as fieldProps, a as __unplugin_components_1, u as useWatch } from './main-0192f89c.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';
11
+ import CodeBlock from '@tiptap/extension-code-block';
7
12
  import 'element-plus/es/components/icon/style/css';
8
13
  import 'element-plus/es/components/input/style/css';
9
14
  import 'element-plus/es/components/checkbox/style/css';
@@ -26,6 +31,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
26
31
  import 'element-plus/es/components/color-picker/style/css';
27
32
  import 'element-plus/es/components/date-picker/style/css';
28
33
  import 'element-plus/es/components/radio/style/css';
34
+ import 'remixicon/fonts/remixicon.symbol.svg';
29
35
  import 'element-plus/es/components/slider/style/css';
30
36
  import 'element-plus/es/components/switch/style/css';
31
37
  import 'element-plus/es/components/time-select/style/css';
@@ -36,60 +42,96 @@ import 'element-plus/es/components/tab-pane/style/css';
36
42
  import 'element-plus/es/components/form-item/style/css';
37
43
  import 'element-plus';
38
44
 
45
+ /* unplugin-vue-components disabled */const index_vue_vue_type_style_index_0_scoped_true_lang = '';
46
+
39
47
  const _sfc_main = defineComponent({
40
48
  ControlType: "RichText",
41
- // 必须与文件名匹配
42
49
  nameCn: "\u5BCC\u6587\u672C",
43
50
  icon: "icon-textEdit",
44
51
  formConfig: getFormConfig("RichText", [{ fieldName: "state", component: "Radio" }]),
45
52
  props: {
46
53
  ...fieldProps
47
54
  },
55
+ components: {
56
+ EditorContent,
57
+ MenuBar: __unplugin_components_1
58
+ },
48
59
  setup(props) {
49
- const richText = ref();
50
- let editor = null;
60
+ const editor = useEditor({
61
+ content: props.data[props.item.data.fieldName] || props.item.data.defaultValue || "",
62
+ extensions: [
63
+ StarterKit.configure({
64
+ codeBlock: {
65
+ HTMLAttributes: {
66
+ class: "code-block"
67
+ }
68
+ }
69
+ }),
70
+ Code.configure({
71
+ HTMLAttributes: {
72
+ class: "inline-code"
73
+ }
74
+ }),
75
+ CodeBlock.configure({
76
+ HTMLAttributes: {
77
+ class: "code-block"
78
+ }
79
+ }),
80
+ Blockquote.configure({
81
+ HTMLAttributes: {
82
+ class: "blockquote"
83
+ }
84
+ }),
85
+ HorizontalRule
86
+ ],
87
+ editable: !props.readonly,
88
+ editorProps: {
89
+ attributes: {
90
+ class: "prose focus:outline-none max-w-none",
91
+ style: "min-height: 200px; border: 1px solid #DCDFE6; border-radius: 4px; padding: 8px 12px;"
92
+ }
93
+ },
94
+ onUpdate: ({ editor: editor2 }) => {
95
+ const html = editor2.getHTML();
96
+ props.data[props.item.data.fieldName] = html;
97
+ },
98
+ onBlur: ({ editor: editor2 }) => {
99
+ const html = editor2.getHTML();
100
+ props.data[props.item.data.fieldName] = html;
101
+ }
102
+ });
51
103
  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
- };
104
+ watch(() => props.item.data.defaultValue, (newVal) => {
105
+ if (editor.value && newVal) {
106
+ editor.value.commands.setContent(newVal, false);
107
+ }
108
+ });
109
+ watch(() => props.readonly, (newVal) => {
110
+ if (editor.value) {
111
+ editor.value.setEditable(!newVal);
67
112
  }
68
113
  });
69
114
  onUnmounted(() => {
70
- editor.destroy();
71
- editor = null;
115
+ if (editor.value) {
116
+ editor.value.destroy();
117
+ }
72
118
  });
73
119
  return {
74
- richText
120
+ editor
75
121
  };
76
122
  }
77
123
  });
124
+ const _withScopeId = (n) => (pushScopeId("data-v-544977e4"), n = n(), popScopeId(), n);
78
125
  const _hoisted_1 = {
79
126
  key: 0,
80
127
  class: "item_require"
81
128
  };
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
- };
129
+ const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1));
130
+ const _hoisted_3 = { class: "rich-text-editor" };
91
131
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
132
  const _component_el_tooltip = ElTooltip;
133
+ const _component_MenuBar = __unplugin_components_1;
134
+ const _component_editor_content = resolveComponent("editor-content");
93
135
  return openBlock(), createElementBlock("div", {
94
136
  class: normalizeClass(["starfish-formitem", { formCover: _ctx.drag, "starfish-vertical": _ctx.labelalign != "top", [_ctx.item.data.csslist?.join(" ")]: !!_ctx.item.data.csslist }])
95
137
  }, [
@@ -116,11 +158,19 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
116
158
  class: "control",
117
159
  style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
118
160
  }, [
119
- _ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_3, null, 512)) : createCommentVNode("", true),
120
- !_ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_4, null, 512)) : createCommentVNode("", true)
161
+ createElementVNode("div", _hoisted_3, [
162
+ _ctx.editor && !_ctx.readonly ? (openBlock(), createBlock(_component_MenuBar, {
163
+ key: 0,
164
+ editor: _ctx.editor
165
+ }, null, 8, ["editor"])) : createCommentVNode("", true),
166
+ createVNode(_component_editor_content, {
167
+ editor: _ctx.editor,
168
+ class: "editor-content"
169
+ }, null, 8, ["editor"])
170
+ ])
121
171
  ], 4)
122
172
  ], 2);
123
173
  }
124
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
174
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-544977e4"]]);
125
175
 
126
176
  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-0192f89c.mjs';
17
17
  import { Delete } from '@element-plus/icons-vue';
18
- import Dynamicform from './starfish-form-627ee711.mjs';
18
+ import Dynamicform from './starfish-form-12edcb0d.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';