icarys-fc-vant 1.0.0 → 1.0.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- # icarys-fc-vant
1
+ # @icarys/fc-vant
2
2
 
3
3
  基于 FormCreate 和 Vant 的移动端低代码表单组件库
4
4
 
@@ -14,12 +14,76 @@
14
14
 
15
15
  ```bash
16
16
  # 安装组件库
17
- npm install icarys-fc-vant
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
+ ⚠️ **重要**: 此包包含源文件和JSX代码,您需要在项目中配置对JSX的支持:
26
+
27
+ ### Vue CLI 项目
28
+
29
+ 确保 `vue.config.js` 中配置了JSX:
30
+
31
+ ```javascript
32
+ // vue.config.js
33
+ module.exports = {
34
+ configureWebpack: {
35
+ resolve: {
36
+ extensions: ['.js', '.jsx', '.vue']
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ### Vite 项目
43
+
44
+ 确保 `vite.config.js` 中配置了对JSX的支持:
45
+
46
+ ```javascript
47
+ // vite.config.js
48
+ import { defineConfig } from 'vite'
49
+ import vue from '@vitejs/plugin-vue'
50
+ import vueJsx from '@vitejs/plugin-vue-jsx'
51
+
52
+ export default defineConfig({
53
+ plugins: [
54
+ vue(),
55
+ vueJsx() // 添加JSX支持
56
+ ]
57
+ })
58
+ ```
59
+
60
+ ### Webpack 项目
61
+
62
+ 在 `webpack.config.js` 中添加JSX支持:
63
+
64
+ ```javascript
65
+ module.exports = {
66
+ resolve: {
67
+ extensions: ['.js', '.jsx', '.vue']
68
+ },
69
+ module: {
70
+ rules: [
71
+ {
72
+ test: /\.jsx?$/,
73
+ exclude: /node_modules/,
74
+ use: {
75
+ loader: 'babel-loader',
76
+ options: {
77
+ presets: ['@babel/preset-env'],
78
+ plugins: ['@vue/babel-plugin-jsx']
79
+ }
80
+ }
81
+ }
82
+ ]
83
+ }
84
+ }
85
+ ```
86
+
23
87
  ## 使用
24
88
 
25
89
  ### 基础用法
@@ -32,7 +96,7 @@ npm install vue@^3.1.0 vant@^4.0.0
32
96
  import Vue from 'vue'
33
97
  import Vant from 'vant'
34
98
  import 'vant/lib/index.css'
35
- import formCreate from 'icarys-fc-vant'
99
+ import formCreate from '@icarys/fc-vant'
36
100
 
37
101
  Vue.use(Vant)
38
102
 
@@ -72,7 +136,7 @@ $f.submit().then(data => {
72
136
  #### 使用工具方法
73
137
 
74
138
  ```javascript
75
- import formCreate from 'icarys-fc-vant'
139
+ import formCreate from '@icarys/fc-vant'
76
140
 
77
141
  // 解析JSON规则
78
142
  const rules = formCreate.jsonParse('[{"type":"input","field":"name"}]')
@@ -94,7 +158,7 @@ const $f = formCreate.create(rules)
94
158
  </template>
95
159
 
96
160
  <script>
97
- import { formCreateMobile } from 'icarys-fc-vant'
161
+ import { formCreateMobile } from '@icarys/fc-vant'
98
162
 
99
163
  export default {
100
164
  mounted() {
@@ -162,11 +226,8 @@ npm install
162
226
  # 开发模式
163
227
  npm run dev
164
228
 
165
- # 构建
166
- npm run build
167
-
168
- # 发布
169
- npm run pub
229
+ # 发布(直接发布源文件,无需构建)
230
+ npm publish
170
231
  ```
171
232
 
172
233
  ## 许可证
package/package.json CHANGED
@@ -1,20 +1,15 @@
1
1
  {
2
2
  "name": "icarys-fc-vant",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "基于FormCreate和Vant的移动端低代码表单组件库,可以通过JSON生成具有动态渲染、数据收集、验证和提交功能的表单",
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
- "typings": "./types/index.d.ts",
5
+ "main": "./src/index.js",
6
+ "module": "./src/index.js",
7
+ "unpkg": "./src/index.js",
8
+ "jsdelivr": "./src/index.js",
10
9
  "scripts": {
11
- "clean": "rimraf dist/",
12
- "bili": "bili",
13
- "build": "npm-run-all clean bili",
14
10
  "dev": "vue-cli-service serve src/vant/examples",
15
- "pub": "npm run build && npm publish"
11
+ "pub": "npm publish"
16
12
  },
17
-
18
13
  "keywords": [
19
14
  "vue3",
20
15
  "vant",
@@ -30,8 +25,7 @@
30
25
  "package.json",
31
26
  "LICENSE",
32
27
  "src",
33
- "types",
34
- "dist"
28
+ "types"
35
29
  ],
36
30
  "author": "lvyanrui",
37
31
  "license": "MIT",
package/src/index.js CHANGED
@@ -1,56 +1,5 @@
1
1
  // 主入口文件
2
- import formCreateMobile from './vant/src/index';
3
- import formCreate from './core/src/index';
4
- import * as utils from './utils/lib';
5
-
6
- // 创建FormCreate实例工厂函数
7
- const createFormCreate = (rules = [], options = {}) => {
8
- return formCreateMobile(rules, options);
9
- };
10
-
11
- // 扩展createFormCreate,添加工具方法
12
- Object.assign(createFormCreate, {
13
- // 表单创建方法
14
- create: createFormCreate,
15
-
16
- // 工具方法
17
- ...utils,
18
-
19
- // JSON解析方法
20
- jsonParse: (jsonString) => {
21
- try {
22
- return JSON.parse(jsonString);
23
- } catch (error) {
24
- console.error('JSON parse error:', error);
25
- return null;
26
- }
27
- },
28
-
29
- // JSON序列化方法
30
- jsonStringify: (obj) => {
31
- try {
32
- return JSON.stringify(obj, null, 2);
33
- } catch (error) {
34
- console.error('JSON stringify error:', error);
35
- return null;
36
- }
37
- },
38
-
39
- // 表单验证器
40
- validator: formCreateMobile.validator || {},
41
-
42
- // 表单生成器
43
- maker: formCreateMobile.maker || {},
44
-
45
- // 版本信息
46
- version: '1.0.0'
47
- });
48
-
49
- // 默认导出
50
- export default createFormCreate;
51
-
52
- // 命名导出
53
- export { formCreateMobile };
54
- export { formCreate };
2
+ export { default as formCreateMobile } from './vant/src/index';
3
+ export { default as formCreate } from './core/src/index';
55
4
  export * from './utils/lib';
56
5
 
@@ -25,7 +25,7 @@ export default defineComponent({
25
25
  },
26
26
  render() {
27
27
  return <van-checkbox-group direction="horizontal" {...this.$attrs} modelValue={Array.isArray(this.modelValue) ? this.modelValue : []}
28
- onUpdateModelValue={this.onInput}>
28
+ onUpdate:modelValue={this.onInput}>
29
29
  {(this.options || []).map(opt => {
30
30
  const tmp = {...opt};
31
31
  const {text, value} = opt;
@@ -1,4 +1,4 @@
1
- import subForm from '@form-create/component-subform/dist/index';
1
+ import subForm from '@form-create/components/common/subform/src/index';
2
2
  import Calendar from './calendar';
3
3
  import Cascader from './cascader';
4
4
  import Checkbox from './checkbox';
@@ -25,7 +25,7 @@ export default defineComponent({
25
25
  },
26
26
  render() {
27
27
  return <van-radio-group direction="horizontal" {...this.$attrs} modelValue={this.modelValue}
28
- onUpdateModelValue={this.onInput}>
28
+ onUpdate:modelValue={this.onInput}>
29
29
  {(this.options || []).map(opt => {
30
30
  const tmp = {...opt};
31
31
  const {text, value} = opt;