icarys-fc-vant 1.0.15 → 1.0.17
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 +40 -205
- package/dist/index.js +7590 -0
- package/dist/index.min.js +3 -7407
- package/dist/index.min.js.map +1 -0
- package/package.json +6 -19
- package/src/components/common/subform/LICENSE +21 -0
- package/src/components/common/subform/README.md +6 -0
- package/src/components/common/subform/package.json +48 -0
- package/src/components/common/subform/src/component.jsx +75 -0
- package/src/components/common/subform/src/index.js +3 -0
- package/src/components/common/wangeditor/LICENSE +21 -0
- package/src/components/common/wangeditor/README.md +14 -0
- package/src/components/common/wangeditor/package-lock.json +114 -0
- package/src/components/common/wangeditor/package.json +52 -0
- package/src/components/common/wangeditor/src/component.jsx +74 -0
- package/src/components/common/wangeditor/src/index.js +3 -0
- package/src/core/LICENSE +21 -0
- package/src/core/README.md +120 -0
- package/src/core/babel.config.js +13 -0
- package/src/core/bili.config.js +34 -0
- package/src/core/package-lock.json +13 -0
- package/src/core/package.json +61 -0
- package/src/core/src/components/formCreate.js +287 -0
- package/src/core/src/components/fragment.js +12 -0
- package/src/core/src/factory/context.js +264 -0
- package/src/core/src/factory/creator.js +63 -0
- package/src/core/src/factory/maker.js +17 -0
- package/src/core/src/factory/manager.js +87 -0
- package/src/core/src/factory/node.js +89 -0
- package/src/core/src/factory/parser.js +28 -0
- package/src/core/src/frame/api.js +691 -0
- package/src/core/src/frame/attrs.js +12 -0
- package/src/core/src/frame/dataDriver.js +76 -0
- package/src/core/src/frame/fetch.js +128 -0
- package/src/core/src/frame/index.js +792 -0
- package/src/core/src/frame/language.js +50 -0
- package/src/core/src/frame/provider.js +297 -0
- package/src/core/src/frame/util.js +311 -0
- package/src/core/src/handler/context.js +573 -0
- package/src/core/src/handler/effect.js +122 -0
- package/src/core/src/handler/index.js +143 -0
- package/src/core/src/handler/inject.js +199 -0
- package/src/core/src/handler/input.js +199 -0
- package/src/core/src/handler/lifecycle.js +55 -0
- package/src/core/src/handler/loader.js +375 -0
- package/src/core/src/handler/page.js +46 -0
- package/src/core/src/handler/render.js +29 -0
- package/src/core/src/index.js +12 -0
- package/src/core/src/parser/html.js +17 -0
- package/src/core/src/render/cache.js +47 -0
- package/src/core/src/render/index.js +33 -0
- package/src/core/src/render/render.js +418 -0
- package/src/core/types/index.d.ts +842 -0
- package/src/index.js +5 -0
- package/src/utils/LICENSE +21 -0
- package/src/utils/README.md +24 -0
- package/src/utils/lib/console.js +16 -0
- package/src/utils/lib/debounce.js +9 -0
- package/src/utils/lib/deepextend.js +51 -0
- package/src/utils/lib/deepset.js +14 -0
- package/src/utils/lib/extend.js +20 -0
- package/src/utils/lib/index.js +14 -0
- package/src/utils/lib/json.js +90 -0
- package/src/utils/lib/mergeprops.js +62 -0
- package/src/utils/lib/mitt.js +43 -0
- package/src/utils/lib/modify.js +8 -0
- package/src/utils/lib/slot.js +8 -0
- package/src/utils/lib/toarray.js +5 -0
- package/src/utils/lib/tocase.js +11 -0
- package/src/utils/lib/todate.js +10 -0
- package/src/utils/lib/toline.js +10 -0
- package/src/utils/lib/topromise.js +10 -0
- package/src/utils/lib/tostring.js +7 -0
- package/src/utils/lib/type.js +45 -0
- package/src/utils/lib/unique.js +6 -0
- package/src/utils/package.json +32 -0
- package/src/vant/LICENSE +21 -0
- package/src/vant/auto-import.d.ts +5 -0
- package/src/vant/auto-import.js +50 -0
- package/src/vant/babel.config.js +10 -0
- package/src/vant/bili.config.js +40 -0
- package/src/vant/examples/App.vue +96 -0
- package/src/vant/examples/main.js +13 -0
- package/src/vant/examples/rule.js +366 -0
- package/src/vant/package.json +83 -0
- package/src/vant/public/index.html +14 -0
- package/src/vant/src/components/calendar.jsx +128 -0
- package/src/vant/src/components/cascader.jsx +120 -0
- package/src/vant/src/components/checkbox.jsx +38 -0
- package/src/vant/src/components/datePicker.jsx +87 -0
- package/src/vant/src/components/group.jsx +384 -0
- package/src/vant/src/components/icon/IconWarning.vue +12 -0
- package/src/vant/src/components/index.js +26 -0
- package/src/vant/src/components/radio.jsx +38 -0
- package/src/vant/src/components/select.jsx +81 -0
- package/src/vant/src/components/timePicker.jsx +76 -0
- package/src/vant/src/components/uploader.jsx +99 -0
- package/src/vant/src/core/alias.js +31 -0
- package/src/vant/src/core/api.js +135 -0
- package/src/vant/src/core/config.js +35 -0
- package/src/vant/src/core/index.js +45 -0
- package/src/vant/src/core/manager.js +282 -0
- package/src/vant/src/core/provider.js +63 -0
- package/src/vant/src/core/utils.js +15 -0
- package/src/vant/src/index.js +13 -0
- package/src/vant/src/parsers/hidden.js +12 -0
- package/src/vant/src/parsers/index.js +59 -0
- package/src/vant/src/parsers/row.js +10 -0
- package/src/vant/src/style/index.css +495 -0
- package/src/vant/types/config.d.ts +99 -0
- package/src/vant/types/index.d.ts +27 -0
- package/src/vant/vue.config.js +21 -0
package/README.md
CHANGED
|
@@ -13,241 +13,76 @@
|
|
|
13
13
|
## 安装
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
#
|
|
17
|
-
npm install icarys
|
|
16
|
+
# 安装组件库
|
|
17
|
+
npm install @icarys/fc-vant
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# 安装必需的依赖(Vue 3 和 Vant)
|
|
20
20
|
npm install vue@^3.1.0 vant@^4.0.0
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
## 使用方式
|
|
24
|
-
|
|
25
|
-
### 在Vue模板中使用
|
|
26
|
-
|
|
27
|
-
```vue
|
|
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>
|
|
38
|
-
|
|
39
|
-
<script>
|
|
40
|
-
import formCreate from 'icarys-fc-vant'
|
|
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>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 编程式使用
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
66
|
-
import formCreate from 'icarys-fc-vant'
|
|
67
|
-
|
|
68
|
-
// 解析配置
|
|
69
|
-
const option = formCreate.parseJson(props.config.option)
|
|
70
|
-
const rule = formCreate.parseJson(props.config.rule)
|
|
71
|
-
|
|
72
|
-
// 创建表单实例
|
|
73
|
-
const $f = formCreate(rule, option)
|
|
74
|
-
$f.mount('#form-container')
|
|
75
|
-
```
|
|
76
23
|
|
|
77
24
|
## 使用
|
|
78
25
|
|
|
79
|
-
###
|
|
26
|
+
### 基础用法
|
|
80
27
|
|
|
81
|
-
####
|
|
28
|
+
#### 方法1:在模板中使用组件
|
|
82
29
|
|
|
83
|
-
|
|
84
|
-
<template>
|
|
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>
|
|
30
|
+
#### 导入使用
|
|
95
31
|
|
|
96
|
-
|
|
32
|
+
```javascript
|
|
97
33
|
import Vue from 'vue'
|
|
98
34
|
import Vant from 'vant'
|
|
99
35
|
import 'vant/lib/index.css'
|
|
100
|
-
import formCreate from 'icarys
|
|
101
|
-
import FormCreate from './components/FormCreate.vue'
|
|
36
|
+
import formCreate from '@icarys/fc-vant'
|
|
102
37
|
|
|
103
38
|
Vue.use(Vant)
|
|
104
39
|
|
|
105
|
-
|
|
106
|
-
|
|
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>
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
#### Composition API中使用
|
|
167
|
-
|
|
168
|
-
```vue
|
|
169
|
-
<template>
|
|
170
|
-
<div>
|
|
171
|
-
<FormCreate
|
|
172
|
-
ref="formCreateRef"
|
|
173
|
-
:rule="rule"
|
|
174
|
-
:option="option"
|
|
175
|
-
/>
|
|
176
|
-
</div>
|
|
177
|
-
</template>
|
|
178
|
-
|
|
179
|
-
<script setup>
|
|
180
|
-
import { ref, reactive } from 'vue'
|
|
181
|
-
import formCreate from 'icarys-fc-vant'
|
|
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([
|
|
40
|
+
// 创建表单规则
|
|
41
|
+
const rule = [
|
|
200
42
|
{
|
|
201
43
|
type: 'input',
|
|
202
44
|
field: 'name',
|
|
203
|
-
title: '姓名'
|
|
45
|
+
title: '姓名',
|
|
46
|
+
props: {
|
|
47
|
+
placeholder: '请输入姓名'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'select',
|
|
52
|
+
field: 'city',
|
|
53
|
+
title: '城市',
|
|
54
|
+
options: [
|
|
55
|
+
{ label: '北京', value: 'beijing' },
|
|
56
|
+
{ label: '上海', value: 'shanghai' }
|
|
57
|
+
]
|
|
204
58
|
}
|
|
205
|
-
]
|
|
59
|
+
]
|
|
206
60
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
})
|
|
61
|
+
// 创建表单实例
|
|
62
|
+
const $f = formCreate.create(rule)
|
|
210
63
|
|
|
211
|
-
//
|
|
212
|
-
|
|
64
|
+
// 挂载到DOM
|
|
65
|
+
$f.mount('#form-container')
|
|
213
66
|
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
console.log('提交成功:', data)
|
|
219
|
-
} catch (error) {
|
|
220
|
-
console.error('提交失败:', error)
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
</script>
|
|
67
|
+
// 或者提交表单
|
|
68
|
+
$f.submit().then(data => {
|
|
69
|
+
console.log('表单数据:', data)
|
|
70
|
+
})
|
|
224
71
|
```
|
|
225
72
|
|
|
226
|
-
|
|
73
|
+
#### 使用工具方法
|
|
227
74
|
|
|
228
75
|
```javascript
|
|
229
|
-
import formCreate from 'icarys
|
|
76
|
+
import formCreate from '@icarys/fc-vant'
|
|
230
77
|
|
|
231
|
-
//
|
|
232
|
-
const
|
|
233
|
-
{
|
|
234
|
-
type: 'input',
|
|
235
|
-
field: 'name',
|
|
236
|
-
title: '姓名'
|
|
237
|
-
}
|
|
238
|
-
])
|
|
239
|
-
|
|
240
|
-
// 2. 挂载到DOM
|
|
241
|
-
$f.mount('#form-container')
|
|
78
|
+
// 解析JSON规则
|
|
79
|
+
const rules = formCreate.jsonParse('[{"type":"input","field":"name"}]')
|
|
242
80
|
|
|
243
|
-
//
|
|
244
|
-
const
|
|
245
|
-
const jsonString = formCreate.toJson(rules)
|
|
81
|
+
// 序列化对象为JSON
|
|
82
|
+
const jsonString = formCreate.jsonStringify(rules)
|
|
246
83
|
|
|
247
|
-
//
|
|
248
|
-
$f
|
|
249
|
-
$f.validate().then(() => console.log('验证通过'))
|
|
250
|
-
$f.resetFields()
|
|
84
|
+
// 创建表单
|
|
85
|
+
const $f = formCreate.create(rules)
|
|
251
86
|
```
|
|
252
87
|
|
|
253
88
|
### 在 Vue 组件中使用
|