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.
@@ -3,7 +3,7 @@ import 'element-plus/es/components/base/style/css';
3
3
  import 'element-plus/es/components/form/style/css';
4
4
  import 'element-plus/es/components/form-item/style/css';
5
5
  import { defineComponent, getCurrentInstance, ref, onMounted, openBlock, createElementBlock, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, toRaw } from 'vue';
6
- import { _ as _export_sfc } from './main-a797684b.mjs';
6
+ import { _ as _export_sfc } from './main-0192f89c.mjs';
7
7
  import 'element-plus/es/components/icon/style/css';
8
8
  import 'element-plus/es/components/input/style/css';
9
9
  import 'element-plus/es/components/checkbox/style/css';
@@ -27,6 +27,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
27
27
  import 'element-plus/es/components/color-picker/style/css';
28
28
  import 'element-plus/es/components/date-picker/style/css';
29
29
  import 'element-plus/es/components/radio/style/css';
30
+ import 'remixicon/fonts/remixicon.symbol.svg';
30
31
  import 'element-plus/es/components/slider/style/css';
31
32
  import 'element-plus/es/components/switch/style/css';
32
33
  import 'element-plus/es/components/time-select/style/css';
@@ -1,4 +1,4 @@
1
- export { D as Dynamicform, m as default } from './main-a797684b.mjs';
1
+ export { D as Dynamicform, m as default } from './main-0192f89c.mjs';
2
2
  import 'vue';
3
3
  import 'element-plus/es';
4
4
  import 'element-plus/es/components/base/style/css';
@@ -25,6 +25,7 @@ import 'element-plus/es/components/checkbox-group/style/css';
25
25
  import 'element-plus/es/components/color-picker/style/css';
26
26
  import 'element-plus/es/components/date-picker/style/css';
27
27
  import 'element-plus/es/components/radio/style/css';
28
+ import 'remixicon/fonts/remixicon.symbol.svg';
28
29
  import 'element-plus/es/components/slider/style/css';
29
30
  import 'element-plus/es/components/switch/style/css';
30
31
  import 'element-plus/es/components/time-select/style/css';
package/dist/style.css CHANGED
@@ -12,7 +12,50 @@
12
12
  .control > div[data-v-4ce4907e] {
13
13
  display: flex;
14
14
  align-items: center;
15
- }.starfish-editor .el-form-item__content,
15
+ }
16
+ .menu-item[data-v-083dc03b] {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ width: 32px;
21
+ height: 32px;
22
+ background: white;
23
+ border: 1px solid #ddd;
24
+ border-radius: 4px;
25
+ cursor: pointer;
26
+ transition: all 0.2s ease;
27
+ }
28
+ .menu-item[data-v-083dc03b]:hover {
29
+ background-color: #f0f0f0;
30
+ border-color: #999;
31
+ }
32
+ .menu-item.is-active[data-v-083dc03b] {
33
+ background-color: #e0e0e0;
34
+ border-color: #666;
35
+ }
36
+ .remix[data-v-083dc03b] {
37
+ width: 16px;
38
+ height: 16px;
39
+ }
40
+
41
+ .editor__header[data-v-45d3fb0a] {
42
+ display: flex;
43
+ align-items: center;
44
+ gap: 4px;
45
+ padding: 8px 12px;
46
+ border: 1px solid #DCDFE6;
47
+ border-bottom: none;
48
+ border-radius: 4px 4px 0 0;
49
+ background-color: #f8f9fa;
50
+ flex-wrap: wrap;
51
+ }
52
+ .divider[data-v-45d3fb0a] {
53
+ width: 1px;
54
+ height: 20px;
55
+ background-color: #DCDFE6;
56
+ margin: 0 4px;
57
+ }
58
+ .starfish-editor .el-form-item__content,
16
59
  .starfish-form .el-form-item__content,
17
60
  .starfish-dynamicform .el-form-item__content {
18
61
  margin-left: 0 !important;
@@ -424,7 +467,93 @@
424
467
  width: 100%;
425
468
  min-height: 60px;
426
469
  height: 100%;
427
- }.cm-gutters.cm-gutters-before {
470
+ }
471
+ .rich-text-editor[data-v-544977e4] {
472
+ min-height: 200px;
473
+ }
474
+ [data-v-544977e4] .editor-content {
475
+ min-height: 200px;
476
+ }
477
+ [data-v-544977e4] .ProseMirror {
478
+ min-height: 180px;
479
+ outline: none;
480
+ padding: 12px;
481
+ }
482
+ [data-v-544977e4] .ProseMirror p.is-editor-empty:first-child::before {
483
+ color: #adb5bd;
484
+ content: attr(data-placeholder);
485
+ float: left;
486
+ height: 0;
487
+ pointer-events: none;
488
+ }
489
+
490
+ /* 行内代码样式 */
491
+ [data-v-544977e4] .ProseMirror .inline-code {
492
+ background-color: #f3f4f6;
493
+ color: #e53e3e;
494
+ padding: 2px 6px;
495
+ border-radius: 4px;
496
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
497
+ font-size: 0.875em;
498
+ border: 1px solid #e5e7eb;
499
+ }
500
+
501
+ /* 代码块样式 */
502
+ [data-v-544977e4] .ProseMirror code {
503
+ background-color: #1f2937;
504
+ color: #f9fafb;
505
+ padding: 16px;
506
+ border-radius: 8px;
507
+ margin: 12px 0;
508
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
509
+ font-size: 0.875em;
510
+ line-height: 1.5;
511
+ position: relative;
512
+ border: 1px solid #374151;
513
+ }
514
+
515
+
516
+ /* 引用块样式 */
517
+ [data-v-544977e4] .ProseMirror blockquote {
518
+ border-left: 4px solid #3b82f6;
519
+ background-color: #f8fafc;
520
+ padding: 12px 16px;
521
+ margin: 12px 0;
522
+ border-radius: 0 8px 8px 0;
523
+ font-style: italic;
524
+ color: #4b5563;
525
+ }
526
+
527
+ /* 水平分割线样式 */
528
+ [data-v-544977e4] .ProseMirror hr {
529
+ border: none;
530
+ border-top: 2px solid #e5e7eb;
531
+ margin: 24px 0;
532
+ }
533
+
534
+ /* 列表样式 */
535
+ [data-v-544977e4] .ProseMirror ul,[data-v-544977e4] .ProseMirror ol {
536
+ padding-left: 24px;
537
+ margin: 12px 0;
538
+ }
539
+ [data-v-544977e4] .ProseMirror li {
540
+ margin: 4px 0;
541
+ }
542
+
543
+ /* 标题样式 */
544
+ [data-v-544977e4] .ProseMirror h1 {
545
+ font-size: 1.875em;
546
+ font-weight: bold;
547
+ margin: 24px 0 16px 0;
548
+ color: #111827;
549
+ }
550
+ [data-v-544977e4] .ProseMirror h2 {
551
+ font-size: 1.5em;
552
+ font-weight: bold;
553
+ margin: 20px 0 12px 0;
554
+ color: #111827;
555
+ }
556
+ .cm-gutters.cm-gutters-before {
428
557
  background: #133F63;
429
558
  }.el-collapse-item {
430
559
  border: 1px solid #ebeef5;
@@ -76,8 +76,8 @@ declare const _sfc_main: DefineComponent<{
76
76
  default: boolean;
77
77
  };
78
78
  }>>, {
79
- drag: boolean;
80
79
  data: Record<string, any>;
80
+ drag: boolean;
81
81
  item: Record<string, any>;
82
82
  labelalign: string;
83
83
  isForm: boolean;
@@ -0,0 +1,34 @@
1
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from '@vue/runtime-core';
2
+ import { PropType } from 'vue';
3
+ declare const _sfc_main: DefineComponent<{
4
+ editor: {
5
+ type: PropType<any>;
6
+ required: true;
7
+ };
8
+ }, {
9
+ items: ({
10
+ icon: string;
11
+ title: string;
12
+ action: () => any;
13
+ isActive: () => any;
14
+ type?: undefined;
15
+ } | {
16
+ type: string;
17
+ icon?: undefined;
18
+ title?: undefined;
19
+ action?: undefined;
20
+ isActive?: undefined;
21
+ } | {
22
+ icon: string;
23
+ title: string;
24
+ action: () => any;
25
+ isActive?: undefined;
26
+ type?: undefined;
27
+ })[];
28
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
29
+ editor: {
30
+ type: PropType<any>;
31
+ required: true;
32
+ };
33
+ }>>, {}>;
34
+ export default _sfc_main;
@@ -0,0 +1,43 @@
1
+ import type { ComputedRef } from '@vue/reactivity';
2
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes } from '@vue/runtime-core';
3
+ declare const _sfc_main: DefineComponent<{
4
+ icon: {
5
+ type: StringConstructor;
6
+ required: true;
7
+ };
8
+ title: {
9
+ type: StringConstructor;
10
+ required: true;
11
+ };
12
+ action: {
13
+ type: FunctionConstructor;
14
+ required: true;
15
+ };
16
+ isActive: {
17
+ type: FunctionConstructor;
18
+ default: null;
19
+ };
20
+ }, {
21
+ remixiconUrl: string;
22
+ chineseTitle: ComputedRef<string>;
23
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
24
+ icon: {
25
+ type: StringConstructor;
26
+ required: true;
27
+ };
28
+ title: {
29
+ type: StringConstructor;
30
+ required: true;
31
+ };
32
+ action: {
33
+ type: FunctionConstructor;
34
+ required: true;
35
+ };
36
+ isActive: {
37
+ type: FunctionConstructor;
38
+ default: null;
39
+ };
40
+ }>>, {
41
+ isActive: Function;
42
+ }>;
43
+ export default _sfc_main;
package/package.json CHANGED
@@ -1,42 +1,51 @@
1
- {
2
- "name": "starfish-form-custom",
3
- "version": "1.0.32",
4
- "main": "dist/starfish-form.mjs",
5
- "style": "dist/style.css",
6
- "module": "dist/starfish-form.mjs",
7
- "types": "dist/types/starfish-form.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/starfish-form.mjs"
11
- },
12
- "./dist/style.css": {
13
- "import": "./dist/style.css"
14
- },
15
- "./*": "./*"
16
- },
17
- "scripts": {
18
- "build": "vite build",
19
- "prepublish": "npm version && npm run build"
20
- },
21
- "dependencies": {
22
- "element-plus": "^2.2.12",
23
- "jsoneditor": "^9.9.0",
24
- "vue": "^3.2.25",
25
- "@element-plus/icons-vue": "^2.0.8",
26
- "wangeditor": "^4.7.15",
27
- "vue-codemirror": "6.1.1",
28
- "codemirror": "6.0.1",
29
- "@codemirror/lang-javascript": "6.0.2"
30
- },
31
- "devDependencies": {
32
- "@vitejs/plugin-vue": "^2.3.3",
33
- "sass": "^1.35.1",
34
- "typescript": "^4.5.4",
35
- "rollup-plugin-visualizer": "^5.8.3",
36
- "unplugin-auto-import": "^0.17.5",
37
- "unplugin-vue-components": "^0.26.0",
38
- "vite": "^4.5.2",
39
- "vite-plugin-dts": "^1.2.0",
40
- "vue-tsc": "^0.34.7"
41
- }
42
- }
1
+ {
2
+ "name": "starfish-form-custom",
3
+ "version": "1.0.34",
4
+ "main": "dist/starfish-form.mjs",
5
+ "style": "dist/style.css",
6
+ "module": "dist/starfish-form.mjs",
7
+ "types": "dist/types/starfish-form.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/starfish-form.mjs"
11
+ },
12
+ "./dist/style.css": {
13
+ "import": "./dist/style.css"
14
+ },
15
+ "./*": "./*"
16
+ },
17
+ "scripts": {
18
+ "build": "vite build",
19
+ "prepublish": "npm version && npm run build"
20
+ },
21
+ "dependencies": {
22
+ "@codemirror/lang-javascript": "6.0.2",
23
+ "@element-plus/icons-vue": "^2.0.8",
24
+ "@tiptap/extension-blockquote": "^3.10.7",
25
+ "@tiptap/extension-code": "^3.10.7",
26
+ "@tiptap/extension-code-block-lowlight": "^3.10.7",
27
+ "@tiptap/extension-horizontal-rule": "^3.10.7",
28
+ "@tiptap/extension-underline": "^3.10.7",
29
+ "@tiptap/pm": "^3.10.7",
30
+ "@tiptap/starter-kit": "^3.10.7",
31
+ "@tiptap/vue-3": "^3.10.7",
32
+ "codemirror": "6.0.1",
33
+ "element-plus": "^2.2.12",
34
+ "jsoneditor": "^9.9.0",
35
+ "lowlight": "^3.3.0",
36
+ "remixicon": "^4.7.0",
37
+ "vue": "^3.2.25",
38
+ "vue-codemirror": "6.1.1"
39
+ },
40
+ "devDependencies": {
41
+ "@vitejs/plugin-vue": "^2.3.3",
42
+ "rollup-plugin-visualizer": "^5.8.3",
43
+ "sass": "^1.35.1",
44
+ "typescript": "^4.5.4",
45
+ "unplugin-auto-import": "^0.17.5",
46
+ "unplugin-vue-components": "^0.26.0",
47
+ "vite": "^4.5.2",
48
+ "vite-plugin-dts": "^1.2.0",
49
+ "vue-tsc": "^0.34.7"
50
+ }
51
+ }
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <div class="editor__header">
3
+ <template v-for="(item, index) in items" :key="index">
4
+ <div v-if="item.type === 'divider'" class="divider" />
5
+ <MenuItem v-else :icon="item.icon" :title="item.title" :action="item.action" :is-active="item.isActive" />
6
+ </template>
7
+ </div>
8
+ </template>
9
+
10
+ <script lang="ts">
11
+ import { defineComponent, PropType } from 'vue'
12
+ import MenuItem from './MenuItem.vue'
13
+
14
+ export default defineComponent({
15
+ name: 'MenuBar',
16
+ components: {
17
+ MenuItem
18
+ },
19
+ props: {
20
+ editor: {
21
+ type: Object as PropType<any>,
22
+ required: true
23
+ }
24
+ },
25
+ setup(props) {
26
+ const items = [
27
+ {
28
+ icon: 'bold',
29
+ title: 'Bold',
30
+ action: () => props.editor.chain().focus().toggleBold().run(),
31
+ isActive: () => props.editor.isActive('bold'),
32
+ },
33
+ {
34
+ icon: 'italic',
35
+ title: 'Italic',
36
+ action: () => props.editor.chain().focus().toggleItalic().run(),
37
+ isActive: () => props.editor.isActive('italic'),
38
+ },
39
+ {
40
+ icon: 'strikethrough',
41
+ title: 'Strike',
42
+ action: () => props.editor.chain().focus().toggleStrike().run(),
43
+ isActive: () => props.editor.isActive('strike'),
44
+ },
45
+ {
46
+ icon: 'code-view',
47
+ title: 'Code',
48
+ action: () => props.editor.chain().focus().toggleCode().run(),
49
+ isActive: () => props.editor.isActive('code'),
50
+ },
51
+ {
52
+ type: 'divider',
53
+ },
54
+ {
55
+ icon: 'h-1',
56
+ title: 'Heading 1',
57
+ action: () => props.editor.chain().focus().toggleHeading({ level: 1 }).run(),
58
+ isActive: () => props.editor.isActive('heading', { level: 1 }),
59
+ },
60
+ {
61
+ icon: 'h-2',
62
+ title: 'Heading 2',
63
+ action: () => props.editor.chain().focus().toggleHeading({ level: 2 }).run(),
64
+ isActive: () => props.editor.isActive('heading', { level: 2 }),
65
+ },
66
+ {
67
+ icon: 'paragraph',
68
+ title: 'Paragraph',
69
+ action: () => props.editor.chain().focus().setParagraph().run(),
70
+ isActive: () => props.editor.isActive('paragraph'),
71
+ },
72
+ {
73
+ icon: 'list-unordered',
74
+ title: 'Bullet list',
75
+ action: () => props.editor.chain().focus().toggleBulletList().run(),
76
+ isActive: () => props.editor.isActive('bulletList'),
77
+ },
78
+ {
79
+ icon: 'list-ordered',
80
+ title: 'Ordered list',
81
+ action: () => props.editor.chain().focus().toggleOrderedList().run(),
82
+ isActive: () => props.editor.isActive('orderedList'),
83
+ },
84
+ {
85
+ icon: 'code-box-line',
86
+ title: 'Code block',
87
+ action: () => props.editor.chain().focus().toggleCodeBlock().run(),
88
+ isActive: () => props.editor.isActive('codeBlock'),
89
+ },
90
+ {
91
+ type: 'divider',
92
+ },
93
+ {
94
+ icon: 'double-quotes-l',
95
+ title: 'Blockquote',
96
+ action: () => props.editor.chain().focus().toggleBlockquote().run(),
97
+ isActive: () => props.editor.isActive('blockquote'),
98
+ },
99
+ {
100
+ icon: 'separator',
101
+ title: 'Horizontal rule',
102
+ action: () => props.editor.chain().focus().setHorizontalRule().run(),
103
+ },
104
+ {
105
+ type: 'divider',
106
+ },
107
+ {
108
+ icon: 'arrow-go-back-line',
109
+ title: 'Undo',
110
+ action: () => props.editor.chain().focus().undo().run(),
111
+ },
112
+ {
113
+ icon: 'arrow-go-forward-line',
114
+ title: 'Redo',
115
+ action: () => props.editor.chain().focus().redo().run(),
116
+ },
117
+ ]
118
+
119
+ return {
120
+ items
121
+ }
122
+ }
123
+ })
124
+ </script>
125
+
126
+ <style scoped>
127
+ .editor__header {
128
+ display: flex;
129
+ align-items: center;
130
+ gap: 4px;
131
+ padding: 8px 12px;
132
+ border: 1px solid #DCDFE6;
133
+ border-bottom: none;
134
+ border-radius: 4px 4px 0 0;
135
+ background-color: #f8f9fa;
136
+ flex-wrap: wrap;
137
+ }
138
+
139
+ .divider {
140
+ width: 1px;
141
+ height: 20px;
142
+ background-color: #DCDFE6;
143
+ margin: 0 4px;
144
+ }
145
+ </style>
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <el-tooltip
3
+ effect="dark"
4
+ :content="chineseTitle"
5
+ placement="top"
6
+ >
7
+ <button
8
+ class="menu-item"
9
+ :class="{ 'is-active': isActive && isActive() }"
10
+ @click="action"
11
+ >
12
+ <svg class="remix">
13
+ <use :xlink:href="`${remixiconUrl}#ri-${icon}`" />
14
+ </svg>
15
+ </button>
16
+ </el-tooltip>
17
+ </template>
18
+
19
+ <script lang="ts">
20
+ import { defineComponent, computed } from 'vue'
21
+ import remixiconUrl from 'remixicon/fonts/remixicon.symbol.svg'
22
+
23
+ export default defineComponent({
24
+ name: 'MenuItem',
25
+ props: {
26
+ icon: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ title: {
31
+ type: String,
32
+ required: true
33
+ },
34
+ action: {
35
+ type: Function,
36
+ required: true
37
+ },
38
+ isActive: {
39
+ type: Function,
40
+ default: null
41
+ }
42
+ },
43
+ setup(props) {
44
+ // 英文标题到中文的映射
45
+ const titleMap: Record<string, string> = {
46
+ 'Bold': '粗体',
47
+ 'Italic': '斜体',
48
+ 'Strike': '删除线',
49
+ 'Code': '行内代码',
50
+ 'Heading 1': '标题 1',
51
+ 'Heading 2': '标题 2',
52
+ 'Paragraph': '段落',
53
+ 'Bullet list': '无序列表',
54
+ 'Ordered list': '有序列表',
55
+ 'Code block': '代码块',
56
+ 'Blockquote': '引用块',
57
+ 'Horizontal rule': '水平分割线',
58
+ 'Undo': '撤销',
59
+ 'Redo': '重做'
60
+ }
61
+
62
+ const chineseTitle = computed(() => {
63
+ return titleMap[props.title] || props.title
64
+ })
65
+
66
+ return {
67
+ remixiconUrl,
68
+ chineseTitle
69
+ }
70
+ }
71
+ })
72
+ </script>
73
+
74
+ <style scoped>
75
+ .menu-item {
76
+ display: flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ width: 32px;
80
+ height: 32px;
81
+ background: white;
82
+ border: 1px solid #ddd;
83
+ border-radius: 4px;
84
+ cursor: pointer;
85
+ transition: all 0.2s ease;
86
+ }
87
+
88
+ .menu-item:hover {
89
+ background-color: #f0f0f0;
90
+ border-color: #999;
91
+ }
92
+
93
+ .menu-item.is-active {
94
+ background-color: #e0e0e0;
95
+ border-color: #666;
96
+ }
97
+
98
+ .remix {
99
+ width: 16px;
100
+ height: 16px;
101
+ }
102
+ </style>