icarys-fc-vant 1.0.14 → 1.0.16
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/README.md +87 -278
- package/dist/components/common/subform/package.json +48 -0
- package/dist/components/common/subform/src/component.jsx +75 -0
- package/dist/components/common/subform/src/index.js +3 -0
- package/dist/components/common/wangeditor/package-lock.json +114 -0
- package/dist/components/common/wangeditor/package.json +52 -0
- package/dist/components/common/wangeditor/src/component.jsx +74 -0
- package/dist/components/common/wangeditor/src/index.js +3 -0
- package/dist/core/babel.config.js +13 -0
- package/dist/core/bili.config.js +34 -0
- package/dist/core/package-lock.json +13 -0
- package/dist/core/package.json +61 -0
- package/dist/core/src/components/formCreate.js +287 -0
- package/dist/core/src/components/fragment.js +12 -0
- package/dist/core/src/factory/context.js +264 -0
- package/dist/core/src/factory/creator.js +63 -0
- package/dist/core/src/factory/maker.js +17 -0
- package/dist/core/src/factory/manager.js +87 -0
- package/dist/core/src/factory/node.js +89 -0
- package/dist/core/src/factory/parser.js +28 -0
- package/dist/core/src/frame/api.js +691 -0
- package/dist/core/src/frame/attrs.js +12 -0
- package/dist/core/src/frame/dataDriver.js +76 -0
- package/dist/core/src/frame/fetch.js +128 -0
- package/dist/core/src/frame/index.js +792 -0
- package/dist/core/src/frame/language.js +50 -0
- package/dist/core/src/frame/provider.js +297 -0
- package/dist/core/src/frame/util.js +311 -0
- package/dist/core/src/handler/context.js +573 -0
- package/dist/core/src/handler/effect.js +122 -0
- package/dist/core/src/handler/index.js +143 -0
- package/dist/core/src/handler/inject.js +199 -0
- package/dist/core/src/handler/input.js +199 -0
- package/dist/core/src/handler/lifecycle.js +55 -0
- package/dist/core/src/handler/loader.js +375 -0
- package/dist/core/src/handler/page.js +46 -0
- package/dist/core/src/handler/render.js +29 -0
- package/dist/core/src/index.js +12 -0
- package/dist/core/src/parser/html.js +17 -0
- package/dist/core/src/render/cache.js +47 -0
- package/dist/core/src/render/index.js +33 -0
- package/dist/core/src/render/render.js +418 -0
- package/dist/core/types/index.d.ts +842 -0
- package/dist/icarys-fc-vant.umd.js +17 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.esm.js +39 -0
- package/dist/index.js +46 -0
- package/dist/utils/lib/console.js +16 -0
- package/dist/utils/lib/debounce.js +9 -0
- package/dist/utils/lib/deepextend.js +51 -0
- package/dist/utils/lib/deepset.js +14 -0
- package/dist/utils/lib/extend.js +20 -0
- package/dist/utils/lib/index.js +14 -0
- package/dist/utils/lib/json.js +90 -0
- package/dist/utils/lib/mergeprops.js +62 -0
- package/dist/utils/lib/mitt.js +43 -0
- package/dist/utils/lib/modify.js +8 -0
- package/dist/utils/lib/slot.js +8 -0
- package/dist/utils/lib/toarray.js +5 -0
- package/dist/utils/lib/tocase.js +11 -0
- package/dist/utils/lib/todate.js +10 -0
- package/dist/utils/lib/toline.js +10 -0
- package/dist/utils/lib/topromise.js +10 -0
- package/dist/utils/lib/tostring.js +7 -0
- package/dist/utils/lib/type.js +45 -0
- package/dist/utils/lib/unique.js +6 -0
- package/dist/utils/package.json +32 -0
- package/dist/vant/auto-import.d.ts +5 -0
- package/dist/vant/auto-import.js +50 -0
- package/dist/vant/babel.config.js +10 -0
- package/dist/vant/bili.config.js +40 -0
- package/dist/vant/examples/main.js +13 -0
- package/dist/vant/examples/rule.js +366 -0
- package/dist/vant/package.json +83 -0
- package/dist/vant/src/components/calendar.jsx +128 -0
- package/dist/vant/src/components/cascader.jsx +120 -0
- package/dist/vant/src/components/checkbox.jsx +38 -0
- package/dist/vant/src/components/datePicker.jsx +87 -0
- package/dist/vant/src/components/group.jsx +384 -0
- package/dist/vant/src/components/index.js +26 -0
- package/dist/vant/src/components/radio.jsx +38 -0
- package/dist/vant/src/components/select.jsx +81 -0
- package/dist/vant/src/components/timePicker.jsx +76 -0
- package/dist/vant/src/components/uploader.jsx +99 -0
- package/dist/vant/src/core/alias.js +31 -0
- package/dist/vant/src/core/api.js +135 -0
- package/dist/vant/src/core/config.js +35 -0
- package/dist/vant/src/core/index.js +45 -0
- package/dist/vant/src/core/manager.js +282 -0
- package/dist/vant/src/core/provider.js +63 -0
- package/dist/vant/src/core/utils.js +15 -0
- package/dist/vant/src/index.js +13 -0
- package/dist/vant/src/parsers/hidden.js +12 -0
- package/dist/vant/src/parsers/index.js +59 -0
- package/dist/vant/src/parsers/row.js +10 -0
- package/dist/vant/src/style/index.css +495 -0
- package/dist/vant/types/config.d.ts +99 -0
- package/dist/vant/types/index.d.ts +27 -0
- package/dist/vant/vue.config.js +21 -0
- package/package.json +29 -52
- package/dist/index.min.js +0 -7411
package/README.md
CHANGED
|
@@ -1,335 +1,144 @@
|
|
|
1
|
-
#
|
|
1
|
+
# icarys-fc-vant
|
|
2
2
|
|
|
3
|
-
基于 FormCreate 和 Vant
|
|
4
|
-
|
|
5
|
-
## 特性
|
|
6
|
-
|
|
7
|
-
- 🚀 基于 Vue 3 + Vant 4
|
|
8
|
-
- 📱 专为移动端优化
|
|
9
|
-
- 🎯 通过 JSON 配置生成表单
|
|
10
|
-
- 🔧 支持动态渲染、数据收集、验证和提交
|
|
11
|
-
- 📦 开箱即用,简单易集成
|
|
3
|
+
基于 FormCreate 和 Vant 的低代码表单生成器
|
|
12
4
|
|
|
13
5
|
## 安装
|
|
14
6
|
|
|
15
7
|
```bash
|
|
16
|
-
# 安装组件库(包含预构建文件)
|
|
17
8
|
npm install icarys-fc-vant
|
|
18
|
-
|
|
19
|
-
# 安装必需的依赖
|
|
20
|
-
npm install vue@^3.1.0 vant@^4.0.0
|
|
21
9
|
```
|
|
22
10
|
|
|
23
11
|
## 使用方式
|
|
24
12
|
|
|
25
|
-
###
|
|
13
|
+
### 1. 推荐使用方式(完整功能)
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
<template>
|
|
29
|
-
<form-create
|
|
30
|
-
:disabled="disabled"
|
|
31
|
-
:rule="rule"
|
|
32
|
-
v-model="_value"
|
|
33
|
-
:option="option"
|
|
34
|
-
ref="formRef"
|
|
35
|
-
v-model:api="fapi"
|
|
36
|
-
/>
|
|
37
|
-
</template>
|
|
15
|
+
由于复杂的JSX组件依赖,推荐直接使用官方包:
|
|
38
16
|
|
|
39
|
-
|
|
40
|
-
import formCreate from '
|
|
41
|
-
|
|
42
|
-
export default {
|
|
43
|
-
data() {
|
|
44
|
-
return {
|
|
45
|
-
disabled: false,
|
|
46
|
-
_value: {},
|
|
47
|
-
rule: [
|
|
48
|
-
{ type: 'input', field: 'name', title: '姓名' }
|
|
49
|
-
],
|
|
50
|
-
option: {},
|
|
51
|
-
fapi: null
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
created() {
|
|
55
|
-
// 解析配置 - 按照您的方式使用
|
|
56
|
-
this.option = formCreate.parseJson(this.config?.option || '{}')
|
|
57
|
-
this.rule = formCreate.parseJson(this.config?.rule || '[]')
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
</script>
|
|
17
|
+
```javascript
|
|
18
|
+
import formCreate from '@form-create/vant'
|
|
61
19
|
```
|
|
62
20
|
|
|
63
|
-
###
|
|
21
|
+
### 2. 工具函数使用
|
|
22
|
+
|
|
23
|
+
如果你只需要工具函数,可以使用这个包:
|
|
64
24
|
|
|
65
25
|
```javascript
|
|
66
|
-
|
|
26
|
+
// CommonJS
|
|
27
|
+
const { parseJson, toJson, toArray } = require('icarys-fc-vant');
|
|
67
28
|
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
29
|
+
// ESM
|
|
30
|
+
import { parseJson, toJson, toArray } from 'icarys-fc-vant';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 3. 基础API使用
|
|
71
34
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
35
|
+
```javascript
|
|
36
|
+
// 获取FormCreate实例
|
|
37
|
+
import { formCreateMobile, createFormCreate } from 'icarys-fc-vant';
|
|
38
|
+
|
|
39
|
+
const fc = createFormCreate();
|
|
40
|
+
// fc.component('custom-component', CustomComponent);
|
|
75
41
|
```
|
|
76
42
|
|
|
77
|
-
##
|
|
43
|
+
## API 参考
|
|
78
44
|
|
|
79
|
-
###
|
|
45
|
+
### FormCreate API
|
|
80
46
|
|
|
81
|
-
####
|
|
47
|
+
#### formCreateMobile
|
|
48
|
+
FormCreate移动端实例(基础实现)
|
|
82
49
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<div>
|
|
86
|
-
<!-- 在模板中使用组件 -->
|
|
87
|
-
<FormCreate
|
|
88
|
-
ref="formCreateRef"
|
|
89
|
-
:rule="rule"
|
|
90
|
-
:option="option"
|
|
91
|
-
/>
|
|
92
|
-
<van-button @click="handleSubmit">提交表单</van-button>
|
|
93
|
-
</div>
|
|
94
|
-
</template>
|
|
50
|
+
#### createFormCreate()
|
|
51
|
+
创建FormCreate工厂函数
|
|
95
52
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
import formCreate from 'icarys-fc-vant'
|
|
101
|
-
import FormCreate from './components/FormCreate.vue'
|
|
102
|
-
|
|
103
|
-
Vue.use(Vant)
|
|
104
|
-
|
|
105
|
-
export default {
|
|
106
|
-
components: {
|
|
107
|
-
FormCreate
|
|
108
|
-
},
|
|
109
|
-
data() {
|
|
110
|
-
return {
|
|
111
|
-
rule: [
|
|
112
|
-
{
|
|
113
|
-
type: 'input',
|
|
114
|
-
field: 'name',
|
|
115
|
-
title: '姓名',
|
|
116
|
-
props: {
|
|
117
|
-
placeholder: '请输入姓名'
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
type: 'select',
|
|
122
|
-
field: 'city',
|
|
123
|
-
title: '城市',
|
|
124
|
-
options: [
|
|
125
|
-
{ label: '北京', value: 'beijing' },
|
|
126
|
-
{ label: '上海', value: 'shanghai' }
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
option: {
|
|
131
|
-
// 表单配置选项
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
methods: {
|
|
136
|
-
handleSubmit() {
|
|
137
|
-
// 使用组件方法
|
|
138
|
-
this.$refs.formCreateRef.submit().then(data => {
|
|
139
|
-
console.log('表单数据:', data)
|
|
140
|
-
}).catch(error => {
|
|
141
|
-
console.error('验证失败:', error)
|
|
142
|
-
})
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
// 使用formCreate的工具方法
|
|
146
|
-
loadFormFromJson(jsonString) {
|
|
147
|
-
try {
|
|
148
|
-
const rules = formCreate.parseJson(jsonString)
|
|
149
|
-
this.rule = rules
|
|
150
|
-
} catch (error) {
|
|
151
|
-
console.error('解析JSON失败:', error)
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
// 序列化表单规则
|
|
156
|
-
saveFormToJson() {
|
|
157
|
-
const jsonString = formCreate.stringifyJson(this.rule)
|
|
158
|
-
console.log('表单JSON:', jsonString)
|
|
159
|
-
return jsonString
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
</script>
|
|
53
|
+
```javascript
|
|
54
|
+
const fc = createFormCreate();
|
|
55
|
+
fc.component('name', Component); // 注册组件
|
|
56
|
+
fc.componentAlias({ alias: 'realName' }); // 设置别名
|
|
164
57
|
```
|
|
165
58
|
|
|
166
|
-
|
|
59
|
+
### 工具函数
|
|
167
60
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<div>
|
|
171
|
-
<FormCreate
|
|
172
|
-
ref="formCreateRef"
|
|
173
|
-
:rule="rule"
|
|
174
|
-
:option="option"
|
|
175
|
-
/>
|
|
176
|
-
</div>
|
|
177
|
-
</template>
|
|
61
|
+
#### parseJson(str)
|
|
62
|
+
解析JSON字符串为对象
|
|
178
63
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
import FormCreate from './components/FormCreate.vue'
|
|
183
|
-
|
|
184
|
-
// 使用formCreate的工具方法
|
|
185
|
-
const loadForm = (jsonString) => {
|
|
186
|
-
try {
|
|
187
|
-
return formCreate.parseJson(jsonString)
|
|
188
|
-
} catch (error) {
|
|
189
|
-
console.error('解析失败:', error)
|
|
190
|
-
return []
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const saveForm = (rules) => {
|
|
195
|
-
return formCreate.stringifyJson(rules)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// 表单数据
|
|
199
|
-
const rule = ref([
|
|
200
|
-
{
|
|
201
|
-
type: 'input',
|
|
202
|
-
field: 'name',
|
|
203
|
-
title: '姓名'
|
|
204
|
-
}
|
|
205
|
-
])
|
|
206
|
-
|
|
207
|
-
const option = reactive({
|
|
208
|
-
// 配置选项
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
// 组件引用
|
|
212
|
-
const formCreateRef = ref(null)
|
|
213
|
-
|
|
214
|
-
// 提交表单
|
|
215
|
-
const handleSubmit = async () => {
|
|
216
|
-
try {
|
|
217
|
-
const data = await formCreateRef.value.submit()
|
|
218
|
-
console.log('提交成功:', data)
|
|
219
|
-
} catch (error) {
|
|
220
|
-
console.error('提交失败:', error)
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
</script>
|
|
64
|
+
```javascript
|
|
65
|
+
const option = parseJson('{"title": "表单标题"}');
|
|
66
|
+
// {title: "表单标题"}
|
|
224
67
|
```
|
|
225
68
|
|
|
226
|
-
|
|
69
|
+
#### toJson(obj)
|
|
70
|
+
将对象转换为JSON字符串
|
|
227
71
|
|
|
228
72
|
```javascript
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// 1. 创建表单实例
|
|
232
|
-
const $f = formCreate([
|
|
233
|
-
{
|
|
234
|
-
type: 'input',
|
|
235
|
-
field: 'name',
|
|
236
|
-
title: '姓名'
|
|
237
|
-
}
|
|
238
|
-
])
|
|
239
|
-
|
|
240
|
-
// 2. 挂载到DOM
|
|
241
|
-
$f.mount('#form-container')
|
|
242
|
-
|
|
243
|
-
// 3. 使用工具方法
|
|
244
|
-
const jsonRules = formCreate.parseJson('[{"type":"input","field":"name"}]')
|
|
245
|
-
const jsonString = formCreate.toJson(rules)
|
|
246
|
-
|
|
247
|
-
// 4. 表单操作
|
|
248
|
-
$f.submit().then(data => console.log(data))
|
|
249
|
-
$f.validate().then(() => console.log('验证通过'))
|
|
250
|
-
$f.resetFields()
|
|
73
|
+
const jsonString = toJson({title: "表单标题"});
|
|
74
|
+
// '{"title":"表单标题"}'
|
|
251
75
|
```
|
|
252
76
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
```vue
|
|
256
|
-
<template>
|
|
257
|
-
<div>
|
|
258
|
-
<div id="form-container"></div>
|
|
259
|
-
</div>
|
|
260
|
-
</template>
|
|
77
|
+
#### toArray(val)
|
|
78
|
+
将值转换为数组
|
|
261
79
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
export default {
|
|
266
|
-
mounted() {
|
|
267
|
-
const rule = [
|
|
268
|
-
{
|
|
269
|
-
type: 'input',
|
|
270
|
-
field: 'name',
|
|
271
|
-
title: '姓名',
|
|
272
|
-
props: {
|
|
273
|
-
placeholder: '请输入姓名'
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
]
|
|
277
|
-
|
|
278
|
-
const $f = formCreateMobile(rule)
|
|
279
|
-
$f.mount('#form-container')
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
</script>
|
|
80
|
+
```javascript
|
|
81
|
+
toArray('test'); // ['test']
|
|
82
|
+
toArray(['a', 'b']); // ['a', 'b']
|
|
283
83
|
```
|
|
284
84
|
|
|
285
|
-
|
|
85
|
+
#### toString(val)
|
|
86
|
+
将值转换为字符串
|
|
286
87
|
|
|
287
|
-
|
|
88
|
+
```javascript
|
|
89
|
+
toString(null); // ''
|
|
90
|
+
toString(123); // '123'
|
|
91
|
+
```
|
|
288
92
|
|
|
289
|
-
|
|
93
|
+
#### extend(target, ...sources)
|
|
94
|
+
对象扩展函数
|
|
290
95
|
|
|
291
|
-
|
|
292
|
-
|
|
96
|
+
```javascript
|
|
97
|
+
extend({}, {a: 1}, {b: 2}); // {a: 1, b: 2}
|
|
98
|
+
```
|
|
293
99
|
|
|
294
|
-
|
|
100
|
+
## 在Vue中使用
|
|
295
101
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
|
|
301
|
-
- `setValue(data)`: 设置表单值
|
|
102
|
+
```vue
|
|
103
|
+
<template>
|
|
104
|
+
<!-- 由于JSX复杂性,推荐使用 @form-create/vant -->
|
|
105
|
+
<div>使用 @form-create/vant 获取完整功能</div>
|
|
106
|
+
</template>
|
|
302
107
|
|
|
303
|
-
|
|
108
|
+
<script setup>
|
|
109
|
+
import { parseJson } from 'icarys-fc-vant'
|
|
304
110
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
- checkbox - 多选框
|
|
310
|
-
- switch - 开关
|
|
311
|
-
- datePicker - 日期选择器
|
|
312
|
-
- timePicker - 时间选择器
|
|
313
|
-
- calendar - 日历
|
|
314
|
-
- uploader - 文件上传
|
|
315
|
-
- cascader - 级联选择
|
|
111
|
+
// 仍然可以使用工具函数
|
|
112
|
+
const option = parseJson('{"title": "表单标题"}')
|
|
113
|
+
</script>
|
|
114
|
+
```
|
|
316
115
|
|
|
317
116
|
## 依赖要求
|
|
318
117
|
|
|
319
|
-
- Vue
|
|
320
|
-
- Vant
|
|
118
|
+
- Vue 3.1.0+
|
|
119
|
+
- Vant 4.9+
|
|
321
120
|
|
|
322
|
-
##
|
|
121
|
+
## 注意事项
|
|
122
|
+
|
|
123
|
+
1. **JSX组件支持**: 由于JSX组件的复杂依赖关系,这个包提供了基础的FormCreate API,但完整的表单组件功能需要使用 `@form-create/vant`
|
|
124
|
+
|
|
125
|
+
2. **完整功能**: 如需完整的表单生成功能,请直接使用 `@form-create/vant` 包
|
|
126
|
+
|
|
127
|
+
3. **工具函数**: 这个包的工具函数可以独立使用,无需依赖其他包
|
|
128
|
+
|
|
129
|
+
## 从源码构建
|
|
323
130
|
|
|
324
131
|
```bash
|
|
132
|
+
# 克隆源码
|
|
133
|
+
git clone <your-repo>
|
|
134
|
+
|
|
325
135
|
# 安装依赖
|
|
326
136
|
npm install
|
|
327
137
|
|
|
328
|
-
#
|
|
329
|
-
npm run
|
|
138
|
+
# 构建
|
|
139
|
+
npm run build
|
|
330
140
|
|
|
331
|
-
#
|
|
332
|
-
npm publish
|
|
141
|
+
# 构建产物在 dist/ 目录
|
|
333
142
|
```
|
|
334
143
|
|
|
335
144
|
## 许可证
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@form-create/component-subform",
|
|
3
|
+
"version": "3.2.34",
|
|
4
|
+
"description": "@form-create 内置组件",
|
|
5
|
+
"main": "./dist/index.min.js",
|
|
6
|
+
"module": "./dist/index.esm.js",
|
|
7
|
+
"unpkg": "./dist/index.min.js",
|
|
8
|
+
"jsdelivr": "./dist/index.min.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rimraf dist/",
|
|
11
|
+
"bili": "cross-env bili",
|
|
12
|
+
"build": "npm-run-all clean bili"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"README.md",
|
|
16
|
+
"package.json",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"src",
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"@form-create",
|
|
23
|
+
"form-create-component",
|
|
24
|
+
"form-create-common-component"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/xaboy/form-create.git"
|
|
29
|
+
},
|
|
30
|
+
"author": "xaboy",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/xaboy/form-create/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "http://www.form-create.com",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"buildFormCreateOptions": {
|
|
40
|
+
"name": "@form-create/component-subform",
|
|
41
|
+
"exportName": "FcSubForm",
|
|
42
|
+
"formats": [
|
|
43
|
+
"umd",
|
|
44
|
+
"esm"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "3d024534b3ee103a96da1d3629582c0cdf19d9a8"
|
|
48
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {defineComponent, reactive, markRaw, nextTick} from 'vue';
|
|
2
|
+
|
|
3
|
+
const NAME = 'fcSubForm';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: NAME,
|
|
8
|
+
props: {
|
|
9
|
+
rule: Array,
|
|
10
|
+
options: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default: () => reactive(({
|
|
13
|
+
submitBtn: false,
|
|
14
|
+
resetBtn: false,
|
|
15
|
+
}))
|
|
16
|
+
},
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: () => ({})
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
syncDisabled: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
formCreateInject: Object,
|
|
30
|
+
},
|
|
31
|
+
data() {
|
|
32
|
+
return {
|
|
33
|
+
cacheValue: {},
|
|
34
|
+
subApi: {},
|
|
35
|
+
form: markRaw(this.formCreateInject.form.$form())
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ['fc:subform', 'update:modelValue', 'change', 'itemMounted'],
|
|
39
|
+
watch: {
|
|
40
|
+
modelValue(n) {
|
|
41
|
+
this.setValue(n);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
formData(value) {
|
|
46
|
+
this.cacheValue = JSON.stringify(value);
|
|
47
|
+
this.$emit('update:modelValue', value);
|
|
48
|
+
this.$emit('change', value);
|
|
49
|
+
},
|
|
50
|
+
setValue(value) {
|
|
51
|
+
const str = JSON.stringify(value);
|
|
52
|
+
if (this.cacheValue === str) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.cacheValue = str;
|
|
56
|
+
this.subApi.coverValue(value || {});
|
|
57
|
+
},
|
|
58
|
+
add$f(api) {
|
|
59
|
+
this.subApi = api;
|
|
60
|
+
nextTick(() => {
|
|
61
|
+
this.$emit('itemMounted', api);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
render() {
|
|
66
|
+
const Type = this.form;
|
|
67
|
+
return <Type
|
|
68
|
+
disabled={this.disabled}
|
|
69
|
+
onUpdate:modelValue={this.formData}
|
|
70
|
+
modelValue={this.modelValue}
|
|
71
|
+
onUpdate:api={this.add$f}
|
|
72
|
+
rule={this.rule}
|
|
73
|
+
option={this.options} extendOption={true}/>
|
|
74
|
+
}
|
|
75
|
+
})
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@form-create/component-wangeditor",
|
|
3
|
+
"version": "3.2.14",
|
|
4
|
+
"lockfileVersion": 2,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "@form-create/component-wangeditor",
|
|
9
|
+
"version": "3.1.2",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"wangeditor": "^4.6.0"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"node_modules/@babel/runtime": {
|
|
16
|
+
"version": "7.15.4",
|
|
17
|
+
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.4.tgz",
|
|
18
|
+
"integrity": "sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"regenerator-runtime": "^0.13.4"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=6.9.0"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"node_modules/@babel/runtime-corejs3": {
|
|
27
|
+
"version": "7.15.4",
|
|
28
|
+
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.15.4.tgz",
|
|
29
|
+
"integrity": "sha512-lWcAqKeB624/twtTc3w6w/2o9RqJPaNBhPGK6DKLSiwuVWC7WFkypWyNg+CpZoyJH0jVzv1uMtXZ/5/lQOLtCg==",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"core-js-pure": "^3.16.0",
|
|
32
|
+
"regenerator-runtime": "^0.13.4"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=6.9.0"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"node_modules/core-js-pure": {
|
|
39
|
+
"version": "3.18.1",
|
|
40
|
+
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.1.tgz",
|
|
41
|
+
"integrity": "sha512-kmW/k8MaSuqpvA1xm2l3TVlBuvW+XBkcaOroFUpO3D4lsTGQWBTb/tBDCf/PNkkPLrwgrkQRIYNPB0CeqGJWGQ==",
|
|
42
|
+
"deprecated": "core-js-pure@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.",
|
|
43
|
+
"hasInstallScript": true,
|
|
44
|
+
"funding": {
|
|
45
|
+
"type": "opencollective",
|
|
46
|
+
"url": "https://opencollective.com/core-js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"node_modules/regenerator-runtime": {
|
|
50
|
+
"version": "0.13.9",
|
|
51
|
+
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
|
52
|
+
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
|
53
|
+
},
|
|
54
|
+
"node_modules/tslib": {
|
|
55
|
+
"version": "2.3.1",
|
|
56
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
|
57
|
+
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
|
58
|
+
},
|
|
59
|
+
"node_modules/wangeditor": {
|
|
60
|
+
"version": "4.7.8",
|
|
61
|
+
"resolved": "https://registry.npmjs.org/wangeditor/-/wangeditor-4.7.8.tgz",
|
|
62
|
+
"integrity": "sha512-x033FPrVDgqzaKHMp75B247w02VIR1vGwstSZnXeJhdFhgLH979G8SWkSpXCcCVAKdHP0gbSkYb5r0Lp3Erdag==",
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@babel/runtime": "^7.11.2",
|
|
65
|
+
"@babel/runtime-corejs3": "^7.11.2",
|
|
66
|
+
"tslib": "^2.1.0"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@babel/runtime": {
|
|
72
|
+
"version": "7.15.4",
|
|
73
|
+
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.4.tgz",
|
|
74
|
+
"integrity": "sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==",
|
|
75
|
+
"requires": {
|
|
76
|
+
"regenerator-runtime": "^0.13.4"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"@babel/runtime-corejs3": {
|
|
80
|
+
"version": "7.15.4",
|
|
81
|
+
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.15.4.tgz",
|
|
82
|
+
"integrity": "sha512-lWcAqKeB624/twtTc3w6w/2o9RqJPaNBhPGK6DKLSiwuVWC7WFkypWyNg+CpZoyJH0jVzv1uMtXZ/5/lQOLtCg==",
|
|
83
|
+
"requires": {
|
|
84
|
+
"core-js-pure": "^3.16.0",
|
|
85
|
+
"regenerator-runtime": "^0.13.4"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"core-js-pure": {
|
|
89
|
+
"version": "3.18.1",
|
|
90
|
+
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.1.tgz",
|
|
91
|
+
"integrity": "sha512-kmW/k8MaSuqpvA1xm2l3TVlBuvW+XBkcaOroFUpO3D4lsTGQWBTb/tBDCf/PNkkPLrwgrkQRIYNPB0CeqGJWGQ=="
|
|
92
|
+
},
|
|
93
|
+
"regenerator-runtime": {
|
|
94
|
+
"version": "0.13.9",
|
|
95
|
+
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
|
96
|
+
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
|
97
|
+
},
|
|
98
|
+
"tslib": {
|
|
99
|
+
"version": "2.3.1",
|
|
100
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
|
101
|
+
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
|
102
|
+
},
|
|
103
|
+
"wangeditor": {
|
|
104
|
+
"version": "4.7.8",
|
|
105
|
+
"resolved": "https://registry.npmjs.org/wangeditor/-/wangeditor-4.7.8.tgz",
|
|
106
|
+
"integrity": "sha512-x033FPrVDgqzaKHMp75B247w02VIR1vGwstSZnXeJhdFhgLH979G8SWkSpXCcCVAKdHP0gbSkYb5r0Lp3Erdag==",
|
|
107
|
+
"requires": {
|
|
108
|
+
"@babel/runtime": "^7.11.2",
|
|
109
|
+
"@babel/runtime-corejs3": "^7.11.2",
|
|
110
|
+
"tslib": "^2.1.0"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|