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.
Files changed (112) hide show
  1. package/README.md +40 -205
  2. package/dist/index.js +7590 -0
  3. package/dist/index.min.js +3 -7407
  4. package/dist/index.min.js.map +1 -0
  5. package/package.json +6 -19
  6. package/src/components/common/subform/LICENSE +21 -0
  7. package/src/components/common/subform/README.md +6 -0
  8. package/src/components/common/subform/package.json +48 -0
  9. package/src/components/common/subform/src/component.jsx +75 -0
  10. package/src/components/common/subform/src/index.js +3 -0
  11. package/src/components/common/wangeditor/LICENSE +21 -0
  12. package/src/components/common/wangeditor/README.md +14 -0
  13. package/src/components/common/wangeditor/package-lock.json +114 -0
  14. package/src/components/common/wangeditor/package.json +52 -0
  15. package/src/components/common/wangeditor/src/component.jsx +74 -0
  16. package/src/components/common/wangeditor/src/index.js +3 -0
  17. package/src/core/LICENSE +21 -0
  18. package/src/core/README.md +120 -0
  19. package/src/core/babel.config.js +13 -0
  20. package/src/core/bili.config.js +34 -0
  21. package/src/core/package-lock.json +13 -0
  22. package/src/core/package.json +61 -0
  23. package/src/core/src/components/formCreate.js +287 -0
  24. package/src/core/src/components/fragment.js +12 -0
  25. package/src/core/src/factory/context.js +264 -0
  26. package/src/core/src/factory/creator.js +63 -0
  27. package/src/core/src/factory/maker.js +17 -0
  28. package/src/core/src/factory/manager.js +87 -0
  29. package/src/core/src/factory/node.js +89 -0
  30. package/src/core/src/factory/parser.js +28 -0
  31. package/src/core/src/frame/api.js +691 -0
  32. package/src/core/src/frame/attrs.js +12 -0
  33. package/src/core/src/frame/dataDriver.js +76 -0
  34. package/src/core/src/frame/fetch.js +128 -0
  35. package/src/core/src/frame/index.js +792 -0
  36. package/src/core/src/frame/language.js +50 -0
  37. package/src/core/src/frame/provider.js +297 -0
  38. package/src/core/src/frame/util.js +311 -0
  39. package/src/core/src/handler/context.js +573 -0
  40. package/src/core/src/handler/effect.js +122 -0
  41. package/src/core/src/handler/index.js +143 -0
  42. package/src/core/src/handler/inject.js +199 -0
  43. package/src/core/src/handler/input.js +199 -0
  44. package/src/core/src/handler/lifecycle.js +55 -0
  45. package/src/core/src/handler/loader.js +375 -0
  46. package/src/core/src/handler/page.js +46 -0
  47. package/src/core/src/handler/render.js +29 -0
  48. package/src/core/src/index.js +12 -0
  49. package/src/core/src/parser/html.js +17 -0
  50. package/src/core/src/render/cache.js +47 -0
  51. package/src/core/src/render/index.js +33 -0
  52. package/src/core/src/render/render.js +418 -0
  53. package/src/core/types/index.d.ts +842 -0
  54. package/src/index.js +5 -0
  55. package/src/utils/LICENSE +21 -0
  56. package/src/utils/README.md +24 -0
  57. package/src/utils/lib/console.js +16 -0
  58. package/src/utils/lib/debounce.js +9 -0
  59. package/src/utils/lib/deepextend.js +51 -0
  60. package/src/utils/lib/deepset.js +14 -0
  61. package/src/utils/lib/extend.js +20 -0
  62. package/src/utils/lib/index.js +14 -0
  63. package/src/utils/lib/json.js +90 -0
  64. package/src/utils/lib/mergeprops.js +62 -0
  65. package/src/utils/lib/mitt.js +43 -0
  66. package/src/utils/lib/modify.js +8 -0
  67. package/src/utils/lib/slot.js +8 -0
  68. package/src/utils/lib/toarray.js +5 -0
  69. package/src/utils/lib/tocase.js +11 -0
  70. package/src/utils/lib/todate.js +10 -0
  71. package/src/utils/lib/toline.js +10 -0
  72. package/src/utils/lib/topromise.js +10 -0
  73. package/src/utils/lib/tostring.js +7 -0
  74. package/src/utils/lib/type.js +45 -0
  75. package/src/utils/lib/unique.js +6 -0
  76. package/src/utils/package.json +32 -0
  77. package/src/vant/LICENSE +21 -0
  78. package/src/vant/auto-import.d.ts +5 -0
  79. package/src/vant/auto-import.js +50 -0
  80. package/src/vant/babel.config.js +10 -0
  81. package/src/vant/bili.config.js +40 -0
  82. package/src/vant/examples/App.vue +96 -0
  83. package/src/vant/examples/main.js +13 -0
  84. package/src/vant/examples/rule.js +366 -0
  85. package/src/vant/package.json +83 -0
  86. package/src/vant/public/index.html +14 -0
  87. package/src/vant/src/components/calendar.jsx +128 -0
  88. package/src/vant/src/components/cascader.jsx +120 -0
  89. package/src/vant/src/components/checkbox.jsx +38 -0
  90. package/src/vant/src/components/datePicker.jsx +87 -0
  91. package/src/vant/src/components/group.jsx +384 -0
  92. package/src/vant/src/components/icon/IconWarning.vue +12 -0
  93. package/src/vant/src/components/index.js +26 -0
  94. package/src/vant/src/components/radio.jsx +38 -0
  95. package/src/vant/src/components/select.jsx +81 -0
  96. package/src/vant/src/components/timePicker.jsx +76 -0
  97. package/src/vant/src/components/uploader.jsx +99 -0
  98. package/src/vant/src/core/alias.js +31 -0
  99. package/src/vant/src/core/api.js +135 -0
  100. package/src/vant/src/core/config.js +35 -0
  101. package/src/vant/src/core/index.js +45 -0
  102. package/src/vant/src/core/manager.js +282 -0
  103. package/src/vant/src/core/provider.js +63 -0
  104. package/src/vant/src/core/utils.js +15 -0
  105. package/src/vant/src/index.js +13 -0
  106. package/src/vant/src/parsers/hidden.js +12 -0
  107. package/src/vant/src/parsers/index.js +59 -0
  108. package/src/vant/src/parsers/row.js +10 -0
  109. package/src/vant/src/style/index.css +495 -0
  110. package/src/vant/types/config.d.ts +99 -0
  111. package/src/vant/types/index.d.ts +27 -0
  112. 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-fc-vant
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
- ### 在Vue组件中使用
26
+ ### 基础用法
80
27
 
81
- #### 模板中使用组件
28
+ #### 方法1:在模板中使用组件
82
29
 
83
- ```vue
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
- <script>
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-fc-vant'
101
- import FormCreate from './components/FormCreate.vue'
36
+ import formCreate from '@icarys/fc-vant'
102
37
 
103
38
  Vue.use(Vant)
104
39
 
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>
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
- const option = reactive({
208
- // 配置选项
209
- })
61
+ // 创建表单实例
62
+ const $f = formCreate.create(rule)
210
63
 
211
- // 组件引用
212
- const formCreateRef = ref(null)
64
+ // 挂载到DOM
65
+ $f.mount('#form-container')
213
66
 
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>
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-fc-vant'
76
+ import formCreate from '@icarys/fc-vant'
230
77
 
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')
78
+ // 解析JSON规则
79
+ const rules = formCreate.jsonParse('[{"type":"input","field":"name"}]')
242
80
 
243
- // 3. 使用工具方法
244
- const jsonRules = formCreate.parseJson('[{"type":"input","field":"name"}]')
245
- const jsonString = formCreate.toJson(rules)
81
+ // 序列化对象为JSON
82
+ const jsonString = formCreate.jsonStringify(rules)
246
83
 
247
- // 4. 表单操作
248
- $f.submit().then(data => console.log(data))
249
- $f.validate().then(() => console.log('验证通过'))
250
- $f.resetFields()
84
+ // 创建表单
85
+ const $f = formCreate.create(rules)
251
86
  ```
252
87
 
253
88
  ### 在 Vue 组件中使用