@houaoran/designer 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.
Files changed (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/components.es.js +11424 -0
  4. package/dist/components.umd.js +878 -0
  5. package/dist/index.es.js +39113 -0
  6. package/dist/index.umd.js +1187 -0
  7. package/package.json +96 -0
  8. package/src/components/DragBox.vue +49 -0
  9. package/src/components/DragTool.vue +235 -0
  10. package/src/components/EventConfig.vue +557 -0
  11. package/src/components/FcDesigner.vue +2569 -0
  12. package/src/components/FcTitle.vue +69 -0
  13. package/src/components/FetchConfig.vue +415 -0
  14. package/src/components/FieldInput.vue +371 -0
  15. package/src/components/FnConfig.vue +315 -0
  16. package/src/components/FnEditor.vue +327 -0
  17. package/src/components/FnInput.vue +103 -0
  18. package/src/components/FormLabel.vue +47 -0
  19. package/src/components/HtmlEditor.vue +125 -0
  20. package/src/components/JsonPreview.vue +146 -0
  21. package/src/components/OptionsTextInput.vue +151 -0
  22. package/src/components/PropsInput.vue +72 -0
  23. package/src/components/Required.vue +75 -0
  24. package/src/components/Row.vue +26 -0
  25. package/src/components/SignaturePad.vue +176 -0
  26. package/src/components/Struct.vue +153 -0
  27. package/src/components/StructEditor.vue +121 -0
  28. package/src/components/StructTree.vue +209 -0
  29. package/src/components/TableOptions.vue +164 -0
  30. package/src/components/TreeOptions.vue +167 -0
  31. package/src/components/TypeSelect.vue +144 -0
  32. package/src/components/Validate.vue +302 -0
  33. package/src/components/ValueInput.vue +89 -0
  34. package/src/components/Warning.vue +46 -0
  35. package/src/components/ai/AiPanel.vue +1122 -0
  36. package/src/components/ai/MarkdownRenderer.vue +548 -0
  37. package/src/components/language/LanguageConfig.vue +174 -0
  38. package/src/components/language/LanguageInput.vue +191 -0
  39. package/src/components/style/BackgroundInput.vue +315 -0
  40. package/src/components/style/BorderInput.vue +242 -0
  41. package/src/components/style/BoxSizeInput.vue +166 -0
  42. package/src/components/style/BoxSpaceInput.vue +269 -0
  43. package/src/components/style/ColorInput.vue +90 -0
  44. package/src/components/style/ConfigItem.vue +118 -0
  45. package/src/components/style/FontInput.vue +197 -0
  46. package/src/components/style/PositionInput.vue +146 -0
  47. package/src/components/style/RadiusInput.vue +164 -0
  48. package/src/components/style/ShadowContent.vue +335 -0
  49. package/src/components/style/ShadowInput.vue +91 -0
  50. package/src/components/style/SizeInput.vue +118 -0
  51. package/src/components/style/StyleConfig.vue +307 -0
  52. package/src/components/table/Table.vue +252 -0
  53. package/src/components/table/TableView.vue +1058 -0
  54. package/src/components/tableForm/TableForm.vue +471 -0
  55. package/src/components/tableForm/TableFormColumnView.vue +103 -0
  56. package/src/components/tableForm/TableFormView.vue +46 -0
  57. package/src/components/tree/FcTree.vue +713 -0
  58. package/src/components/tree/FcTreeNode.vue +216 -0
  59. package/src/config/base/field.js +43 -0
  60. package/src/config/base/form.js +132 -0
  61. package/src/config/base/style.js +26 -0
  62. package/src/config/base/validate.js +15 -0
  63. package/src/config/index.js +70 -0
  64. package/src/config/menu.js +24 -0
  65. package/src/config/rule/alert.js +45 -0
  66. package/src/config/rule/button.js +49 -0
  67. package/src/config/rule/card.js +40 -0
  68. package/src/config/rule/cascader.js +121 -0
  69. package/src/config/rule/checkbox.js +68 -0
  70. package/src/config/rule/col.js +86 -0
  71. package/src/config/rule/collapse.js +30 -0
  72. package/src/config/rule/collapseItem.js +36 -0
  73. package/src/config/rule/color.js +53 -0
  74. package/src/config/rule/date.js +66 -0
  75. package/src/config/rule/dateRange.js +60 -0
  76. package/src/config/rule/divider.js +31 -0
  77. package/src/config/rule/editor.js +31 -0
  78. package/src/config/rule/group.js +86 -0
  79. package/src/config/rule/html.js +43 -0
  80. package/src/config/rule/image.js +32 -0
  81. package/src/config/rule/input.js +62 -0
  82. package/src/config/rule/number.js +49 -0
  83. package/src/config/rule/password.js +52 -0
  84. package/src/config/rule/radio.js +43 -0
  85. package/src/config/rule/rate.js +44 -0
  86. package/src/config/rule/row.js +46 -0
  87. package/src/config/rule/select.js +70 -0
  88. package/src/config/rule/signaturePad.js +59 -0
  89. package/src/config/rule/slider.js +53 -0
  90. package/src/config/rule/space.js +44 -0
  91. package/src/config/rule/subForm.js +47 -0
  92. package/src/config/rule/switch.js +46 -0
  93. package/src/config/rule/tabPane.js +29 -0
  94. package/src/config/rule/table.js +37 -0
  95. package/src/config/rule/tableForm.js +115 -0
  96. package/src/config/rule/tableFormColumn.js +55 -0
  97. package/src/config/rule/tabs.js +38 -0
  98. package/src/config/rule/tag.js +69 -0
  99. package/src/config/rule/text.js +41 -0
  100. package/src/config/rule/textarea.js +63 -0
  101. package/src/config/rule/time.js +58 -0
  102. package/src/config/rule/timeRange.js +49 -0
  103. package/src/config/rule/title.js +37 -0
  104. package/src/config/rule/transfer.js +59 -0
  105. package/src/config/rule/tree.js +70 -0
  106. package/src/config/rule/treeSelect.js +77 -0
  107. package/src/config/rule/upload.js +107 -0
  108. package/src/form/index.js +19 -0
  109. package/src/index.js +173 -0
  110. package/src/locale/en.js +981 -0
  111. package/src/locale/zh-cn.js +983 -0
  112. package/src/style/fonts/fc-icons.woff +0 -0
  113. package/src/style/icon.css +1052 -0
  114. package/src/style/index.css +836 -0
  115. package/src/utils/form.js +9 -0
  116. package/src/utils/highlight/highlight.min.js +307 -0
  117. package/src/utils/highlight/javascript.min.js +80 -0
  118. package/src/utils/highlight/style.css +1 -0
  119. package/src/utils/highlight/xml.min.js +29 -0
  120. package/src/utils/hintStubs.js +120 -0
  121. package/src/utils/index.js +544 -0
  122. package/src/utils/jsonDiff.js +173 -0
  123. package/src/utils/locale.js +23 -0
  124. package/src/utils/message.js +19 -0
  125. package/src/utils/template.js +105 -0
  126. package/types/index.d.ts +575 -0
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@houaoran/designer",
3
+ "version": "1.0.0",
4
+ "description": "好用的Vue低代码可视化表单设计器,可以通过拖拽的方式快速创建表单,提高开发者对表单的开发效率。",
5
+ "unpkg": "./dist/index.umd.js",
6
+ "jsdelivr": "./dist/index.umd.js",
7
+ "typings": "./types/index.d.ts",
8
+ "main": "./dist/index.umd.js",
9
+ "module": "./dist/index.es.js",
10
+ "scripts": {
11
+ "clean": "rimraf dist/",
12
+ "dev": "vue-cli-service serve",
13
+ "build": "vite build --config ./vite.config.build.js && vite build --config ./vite.config.form.js",
14
+ "build:form": "vite build --config ./vite.config.form.js",
15
+ "build:locale": "gulp -f gulpfile.js",
16
+ "build:preview": "vite build --config ./vite.config.preview.js"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/xaboy/form-create-designer.git"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "keywords": [
26
+ "AI",
27
+ "可视化表单设计器",
28
+ "form-create",
29
+ "form-builder",
30
+ "form-designer",
31
+ "draggable",
32
+ "form",
33
+ "components",
34
+ "vue",
35
+ "element-plus",
36
+ "json-form",
37
+ "dynamic-form"
38
+ ],
39
+ "files": [
40
+ "README.md",
41
+ "package.json",
42
+ "LICENSE",
43
+ "src",
44
+ "types",
45
+ "dist",
46
+ "locale"
47
+ ],
48
+ "author": "xaboy",
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/xaboy/form-create-designer/issues"
52
+ },
53
+ "homepage": "https://form-create.com",
54
+ "devDependencies": {
55
+ "@element-plus/icons-vue": "^0.2.6",
56
+ "@vitejs/plugin-vue": "^3.1.2",
57
+ "@vitejs/plugin-vue-jsx": "^2.0.1",
58
+ "@vue/babel-plugin-jsx": "^1.0.7",
59
+ "@vue/cli-plugin-babel": "^4.5.13",
60
+ "@vue/cli-service": "^4.5.3",
61
+ "@vue/compiler-sfc": "^3.0.11",
62
+ "babel-eslint": "^10.1.0",
63
+ "gulp": "^4.0.2",
64
+ "html-webpack-plugin": "^4.3.0",
65
+ "jsonlint-mod": "^1.7.6",
66
+ "lint-staged": "^10.2.11",
67
+ "rimraf": "^3.0.2",
68
+ "vite": "^3.1.4"
69
+ },
70
+ "husky": {
71
+ "hooks": {
72
+ "pre-commit": "lint-staged"
73
+ }
74
+ },
75
+ "lint-staged": {
76
+ "*.{js,jsx,vue}": [
77
+ "eslint --fix",
78
+ "git add"
79
+ ]
80
+ },
81
+ "peerDependencies": {
82
+ "vue": "^3.5"
83
+ },
84
+ "dependencies": {
85
+ "@form-create/component-wangeditor": "^3.3.0",
86
+ "@form-create/element-ui": "^3.3.1",
87
+ "@form-create/utils": "^3.3.0",
88
+ "codemirror": "^6.65.7",
89
+ "element-plus": "^2.11.1",
90
+ "js-beautify": "^1.15.1",
91
+ "marked": "^17.0.0",
92
+ "signature_pad": "^5.0.10",
93
+ "sortablejs": "1.14.0",
94
+ "vuedraggable": "4.1.0"
95
+ }
96
+ }
@@ -0,0 +1,49 @@
1
+ <script>
2
+ import {defineComponent, h} from 'vue';
3
+ import draggable from 'vuedraggable/src/vuedraggable';
4
+
5
+ export default defineComponent({
6
+ name: 'DragBox',
7
+ props: ['rule', 'tag', 'formCreateInject', 'list'],
8
+ render(ctx) {
9
+ const attrs = {...ctx.$props.rule.props, ...ctx.$attrs};
10
+ let _class = '_fd-' + ctx.$props.tag + '-drag _fd-drag-box';
11
+ if (!Object.keys(ctx.$slots).length) {
12
+ _class += ' drag-holder';
13
+ }
14
+ attrs.class = _class;
15
+ attrs.modelValue = ctx.$props.list || [...ctx.$props.formCreateInject.children];
16
+
17
+ const keys = {};
18
+ if (ctx.$slots.default) {
19
+ const children = ctx.$slots.default();
20
+ children.forEach(v => {
21
+ if (v.key) {
22
+ keys[v.key] = v;
23
+ }
24
+ })
25
+ }
26
+ return h(draggable, attrs, {
27
+ item: ({element, index}) => {
28
+ const key = element?.__fc__?.key;
29
+ if (key) {
30
+ let vnode = keys['_' + element.slot];
31
+ if (vnode) {
32
+ vnode.children.forEach(v => {
33
+ if (v.key === key + 'fc') {
34
+ vnode = v
35
+ }
36
+ });
37
+ } else {
38
+ vnode = keys[key + 'fc'];
39
+ }
40
+ if (vnode) {
41
+ return h('div', {class: '_fc-' + ctx.$props.tag + '-item _fd-drag-item', key}, vnode);
42
+ }
43
+ }
44
+ return h('div', {class: '_fc-' + ctx.$props.tag + '-item _fd-drag-item', key: index}, null);
45
+ }
46
+ });
47
+ }
48
+ });
49
+ </script>
@@ -0,0 +1,235 @@
1
+ <template>
2
+ <div class="_fd-drag-tool" @click.stop="active" :class="{active: fcx.active === id}">
3
+ <div class="_fd-drag-mask" v-if="mask"></div>
4
+ <div class="_fd-drag-hidden" v-if="hidden"><i class="fc-icon icon-eye-close"></i> {{ t('props.hide') }}</div>
5
+ <div class="_fd-drag-l" v-if="!hiddenBtn && permission.move !== false" @click.stop>
6
+ <div class="_fd-drag-btn" v-if="dragBtn !== false" v-show="fcx.active === id" style="cursor: move;">
7
+ <i class="fc-icon icon-move"></i>
8
+ </div>
9
+ </div>
10
+ <div class="_fd-drag-r" v-if="btns !== false && !hiddenMenu && permission.dragMenu !== false">
11
+ <slot name="handle">
12
+ <div class="_fd-drag-btn" v-if="permission.create !== false && isCreate && (btns === true || btns.indexOf('create') > -1)"
13
+ @click.stop="$emit('create')">
14
+ <i class="fc-icon icon-add"></i>
15
+ </div>
16
+ <div class="_fd-drag-btn" v-if="permission.copy !== false && !only && (btns === true || btns.indexOf('copy') > -1)"
17
+ @click.stop="$emit('copy')">
18
+ <i class="fc-icon icon-copy"></i>
19
+ </div>
20
+ <div class="_fd-drag-btn" v-if="permission.addChild !== false && children && (btns === true || btns.indexOf('addChild') > -1)"
21
+ @click.stop="$emit('addChild')">
22
+ <i class="fc-icon icon-add-child"></i>
23
+ </div>
24
+ <div class="_fd-drag-btn _fd-drag-danger" v-if="permission.delete !== false && (btns === true || btns.indexOf('delete') > -1)"
25
+ @click.stop="$emit('delete')">
26
+ <i class="fc-icon icon-delete"></i>
27
+ </div>
28
+ </slot>
29
+ </div>
30
+ <slot name="default"></slot>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import {defineComponent} from 'vue';
36
+
37
+ export default defineComponent({
38
+ name: 'DragTool',
39
+ emits: ['create', 'copy', 'addChild', 'delete', 'active', 'fc.el'],
40
+ props: {
41
+ dragBtn: Boolean,
42
+ children: String,
43
+ mask: Boolean,
44
+ hidden: Boolean,
45
+ handleBtn: [Boolean, Array],
46
+ formCreateInject: Object,
47
+ unique: String,
48
+ only: Boolean
49
+ },
50
+ inject: {
51
+ fcx: {
52
+ default: null
53
+ },
54
+ designer: {
55
+ default: null
56
+ },
57
+ dragTool: {
58
+ default: null
59
+ },
60
+ },
61
+ provide() {
62
+ return {
63
+ dragTool: this
64
+ }
65
+ },
66
+ computed: {
67
+ isCreate() {
68
+ return this.dragTool ? !!this.dragTool.children : false;
69
+ },
70
+ btns() {
71
+ if (Array.isArray(this.handleBtn)) {
72
+ return this.handleBtn.length ? this.handleBtn : false;
73
+ }
74
+ return this.handleBtn !== false;
75
+ },
76
+ id() {
77
+ return this.unique || this.formCreateInject.id;
78
+ },
79
+ hiddenMenu() {
80
+ return this.designer.ctx.hiddenDragMenu;
81
+ },
82
+ hiddenBtn() {
83
+ return this.designer.ctx.hiddenDragBtn;
84
+ },
85
+ rule() {
86
+ return this.formCreateInject?.rule?._config._get();
87
+ },
88
+ t() {
89
+ return this.designer.setupState.t;
90
+ },
91
+ permission() {
92
+ if (!this.rule) {
93
+ return {};
94
+ } else {
95
+ return this.designer.setupState.getPermission(this.rule);
96
+ }
97
+ },
98
+ },
99
+ methods: {
100
+ active() {
101
+ if (this.fcx.active === this.id) return;
102
+ this.fcx.active = this.id;
103
+ this.$emit('active');
104
+ }
105
+ },
106
+ mounted() {
107
+ this.$emit('fc.el', this);
108
+ },
109
+ });
110
+ </script>
111
+
112
+ <style>
113
+ ._fd-drag-tool {
114
+ position: relative;
115
+ display: block;
116
+ min-height: 20px;
117
+ box-sizing: border-box;
118
+ padding: 2px;
119
+ outline: 1px dashed var(--fc-tool-border-color);
120
+ overflow: hidden;
121
+ word-wrap: break-word;
122
+ word-break: break-all;
123
+ z-index: 0;
124
+ }
125
+
126
+ ._fd-drag-tool ._fd-drag-tool {
127
+ height: calc(100% - 6px);
128
+ margin: 3px;
129
+ }
130
+
131
+ ._fd-drag-tool + ._fd-drag-tool {
132
+ margin-top: 5px;
133
+ }
134
+
135
+ ._fd-drag-tool.active {
136
+ outline: 1px solid #2E73FF;
137
+ }
138
+
139
+ ._fd-drag-tool.active > div > ._fd-drag-btn {
140
+ display: flex;
141
+ }
142
+
143
+ ._fd-drag-tool:not(.active):hover > div > ._fd-drag-btn {
144
+ display: flex !important;
145
+ opacity: 0.7;
146
+ }
147
+
148
+ ._fd-drag-tool._fd-drop-hover ._fd-drag-box {
149
+ padding-top: 15px !important;
150
+ padding-bottom: 15px !important;
151
+ }
152
+
153
+ ._fd-drag-tool ._fd-drag-btn {
154
+ display: none;
155
+ }
156
+
157
+ ._fd-drag-r {
158
+ position: absolute;
159
+ right: 2px;
160
+ top: calc(100% - 20px);
161
+ z-index: 1904;
162
+ }
163
+
164
+ ._fd-drag-l {
165
+ position: absolute;
166
+ top: 0;
167
+ left: 0;
168
+ z-index: 1904
169
+
170
+ }
171
+
172
+ ._fd-drag-btn {
173
+ height: 18px;
174
+ width: 18px;
175
+ color: #fff;
176
+ background-color: #2E73FF;
177
+ text-align: center;
178
+ line-height: 20px;
179
+ padding-bottom: 1px;
180
+ float: left;
181
+ cursor: pointer;
182
+ justify-content: center;
183
+ }
184
+
185
+ ._fd-drag-btn + ._fd-drag-btn {
186
+ margin-left: 2px;
187
+ }
188
+
189
+ ._fd-drag-danger {
190
+ background-color: #FF2E2E;
191
+ }
192
+
193
+ ._fd-drag-btn i {
194
+ font-size: 14px;
195
+ }
196
+
197
+ ._fd-drag-mask,
198
+ ._fd-drag-hidden {
199
+ z-index: 1900;
200
+ position: absolute;
201
+ top: 0;
202
+ left: 0;
203
+ right: 0;
204
+ bottom: 0;
205
+ }
206
+
207
+ ._fd-drag-hidden {
208
+ display: flex;
209
+ align-items: center;
210
+ justify-content: center;
211
+ background: rgba(51, 51, 51, 0.7);
212
+ color: #ffffff;
213
+ font-size: 14px;
214
+ }
215
+
216
+ ._fd-drag-tool:hover ._fd-drag-hidden,
217
+ ._fd-drag-tool.active ._fd-drag-hidden,
218
+ ._fd-drag-tool:has(._fd-drag-tool.active) ._fd-drag-hidden {
219
+ display: none;
220
+ }
221
+
222
+ ._fd-drag-hidden .fc-icon {
223
+ margin-right: 5px;
224
+ }
225
+
226
+ ._fd-drag-tool:hover {
227
+ outline-color: rgba(46, 115, 255, 0.5);
228
+ outline-style: solid;
229
+ z-index: 1;
230
+ }
231
+
232
+ ._fd-drag-tool:has(._fd-drag-tool:not(.active):hover, ._fd-drag-tool.active:hover) > div > ._fd-drag-btn {
233
+ display: none !important;
234
+ }
235
+ </style>