@weitutech/by-components 1.0.30 → 1.1.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.
package/.babelrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "presets": ["@babel/preset-env"],
3
+ "plugins": [
4
+ "@babel/plugin-proposal-nullish-coalescing-operator",
5
+ "@babel/plugin-proposal-optional-chaining"
6
+ ]
7
+ }
package/.editorconfig ADDED
@@ -0,0 +1,19 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.md]
12
+ trim_trailing_whitespace = false
13
+
14
+ [*.vue]
15
+ indent_size = 2
16
+
17
+ [*.vue:script]
18
+ indent_style = space
19
+ indent_size = 0
package/.eslintignore ADDED
@@ -0,0 +1,9 @@
1
+ /dist/
2
+ /lib/
3
+ /node_modules/
4
+ .DS_Store
5
+ .env.local
6
+ .env.*.local
7
+ npm-debug.log*
8
+ yarn-debug.log*
9
+ yarn-error.log*
package/.eslintrc.cjs ADDED
@@ -0,0 +1,65 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ node: true,
5
+ browser: true,
6
+ },
7
+ extends: ['plugin:vue/essential', 'eslint:recommended', 'plugin:prettier/recommended'],
8
+ parser: 'vue-eslint-parser',
9
+ rules: {
10
+ 'vue/max-attributes-per-line': [
11
+ 'error',
12
+ {
13
+ singleline: 5,
14
+ multiline: {
15
+ max: 1,
16
+ allowFirstLine: false,
17
+ },
18
+ },
19
+ ],
20
+ 'vue/html-self-closing': [
21
+ 'error',
22
+ {
23
+ html: {
24
+ void: 'always',
25
+ normal: 'never',
26
+ component: 'always',
27
+ },
28
+ },
29
+ ],
30
+ 'vue/html-closing-bracket-newline': [
31
+ 'error',
32
+ {
33
+ singleline: 'never',
34
+ multiline: 'always',
35
+ },
36
+ ],
37
+ 'vue/multiline-html-element-content-newline': [
38
+ 'error',
39
+ {
40
+ ignoreWhenEmpty: true,
41
+ ignores: ['pre', 'textarea'],
42
+ },
43
+ ],
44
+ // "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
45
+ // "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
46
+ 'no-unused-vars': ['warn', { args: 'none' }],
47
+ 'prefer-const': 'warn',
48
+ // "no-var": "error",
49
+ 'prettier/prettier': ['error', {}, { usePrettierrc: true }],
50
+
51
+ 'vue/no-lone-template': 'off',
52
+ 'vue/singleline-html-element-content-newline': 'off',
53
+ 'require-atomic-updates': 'off',
54
+ 'no-prototype-builtins': 'off',
55
+ 'no-restricted-syntax': 'off',
56
+ 'no-useless-catch': 'off',
57
+ 'no-useless-escape': 'off',
58
+ 'no-useless-return': 'off',
59
+ 'no-case-declarations': 'off',
60
+
61
+ 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
62
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
63
+ 'vue/multi-word-component-names': 'off',
64
+ },
65
+ }
@@ -0,0 +1,9 @@
1
+ /dist/
2
+ /lib/
3
+ /node_modules/
4
+ .DS_Store
5
+ .env.local
6
+ .env.*.local
7
+ npm-debug.log*
8
+ yarn-debug.log*
9
+ yarn-error.log*
package/.prettierrc ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "printWidth": 120,
3
+ "tabWidth": 2,
4
+ "useTabs": false,
5
+ "semi": false,
6
+ "singleQuote": true,
7
+ "trailingComma": "none",
8
+ "bracketSpacing": true,
9
+ "arrowParens": "avoid",
10
+ "endOfLine": "lf",
11
+ "htmlWhitespaceSensitivity": "ignore",
12
+ "bracketSameLine": false,
13
+ "overrides": [
14
+ {
15
+ "files": "*.vue",
16
+ "options": {
17
+ "parser": "vue",
18
+ "vueIndentScriptAndStyle": false
19
+ }
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "recommendations": [
3
+ "dbaeumer.vscode-eslint",
4
+ "octref.vetur",
5
+ "esbenp.prettier-vscode"
6
+ ]
7
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": null,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": "explicit"
6
+ },
7
+ "[javascript]": {
8
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
9
+ },
10
+ "[vue]": {
11
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
12
+ },
13
+ "[json]": {
14
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
15
+ },
16
+ "[html]": {
17
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
18
+ },
19
+ "[css]": {
20
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
21
+ },
22
+ "eslint.validate": [
23
+ "javascript",
24
+ "javascriptreact",
25
+ "vue"
26
+ ]
27
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # 1.1.0 (2025-05-20)
2
+
3
+ ### feat
4
+
5
+ - 增加table表格列宽缓存功能
6
+ - 增加table表格行高自适应功能
7
+ - 增加form表单按钮区域(重置、搜索按钮)
8
+
9
+ # 1.0.31 (2025-05-14)
10
+
11
+ ### feat
12
+
13
+ - 自定义时间组件,支持绑定开始时间和结束时间
14
+
15
+ # 1.0.30 (2025-04-17)
16
+
17
+ ### feat
18
+
19
+ - 增加表格列表的保存
20
+
1
21
  # 1.0.27 (2024-12-04)
2
22
 
3
23
  ### 🍏 Perf
package/README.md CHANGED
@@ -298,11 +298,36 @@ export default {
298
298
 
299
299
  ```
300
300
 
301
+ #### 自定义时间选择器'customDatePicker'特别说明
302
+
303
+ 自定义时间选择器同时支持时间段方式绑定值 和 单独时间方式绑定值
304
+
305
+ ```
306
+ // 时间段方式绑定值
307
+ {
308
+ type: 'customDatePicker',
309
+ field: 'report_time',
310
+ label: '报表时间'
311
+ }
312
+ ```
313
+
314
+ ```
315
+ // 单独时间方式绑定值
316
+ {
317
+ type: 'customDatePicker',
318
+ field: 'report_time', // 仍然保留原来的字段,保证兼容性
319
+ startTimeField: 'start_time', // 新增开始时间字段
320
+ endTimeField: 'end_time', // 新增结束时间字段
321
+ label: '报表时间'
322
+ }
323
+ ```
324
+
301
325
  ### 表格 by-table
302
326
 
303
327
  [vxe-table 文档](https://vxetable.cn/v3.8/#/table/start/install)
304
328
 
305
329
  ###### 通用配置
330
+
306
331
  ```
307
332
  <template>
308
333
  <by-table
@@ -372,7 +397,7 @@ export default {
372
397
  }
373
398
  },
374
399
 
375
- customColumnConfig: { // 自定义列
400
+ customColumnConfig: { // 自定义列
376
401
  showCustomColumn: true, // 是否显示自定义列
377
402
  infoMethod: getCustomTableList, // 回显用的接口
378
403
  submitMethod: setCustomTableList, // 保存用的接口
@@ -411,7 +436,9 @@ export default {
411
436
  </script>
412
437
 
413
438
  ```
439
+
414
440
  ###### 自定义列支持多级表头
441
+
415
442
  ```
416
443
  <template>
417
444
  <by-table
@@ -450,7 +477,7 @@ export default {
450
477
  },
451
478
  { field: 'address', title: 'Address', sortable: true, showOverflow: true }
452
479
  ],
453
- }
480
+ }
454
481
  }
455
482
  },
456
483
  methods: {
@@ -467,4 +494,4 @@ export default {
467
494
  }
468
495
  }
469
496
  </script>
470
- ```
497
+ ```
package/docs/form.md CHANGED
@@ -1,4 +1,5 @@
1
- ### 类型(没有注册看Element的组件使用方法)
1
+ ### 类型(没有注册看 Element 的组件使用方法)
2
+
2
3
  ```
3
4
  | 'input'
4
5
  | 'inputNumber'
@@ -12,15 +13,81 @@
12
13
  | 'upload'
13
14
  | 'customDatePicker' // 自定义的时间选择器
14
15
  | 'search' // 搜索按钮区域
16
+ | 'formButtons' // 表单按钮区域
15
17
  | 'custom' // 自定义
16
18
  ```
17
19
 
18
20
  #### Event
19
21
 
20
- | 事件 | 参数 |
21
- | ---- | ---- |
22
- | change | context: IFormItems |
23
- | queryBtnClick | 无 |
22
+ | 事件 | 参数 |
23
+ | ------------- | ------------------- |
24
+ | change | context: IFormItems |
25
+ | queryBtnClick | 无 |
24
26
 
25
27
  完整案列见 [表单 by-form](../README.md)
26
-
28
+
29
+ #### 表单按钮区域(重置、搜索按钮)
30
+
31
+ - formItem使用'formButtons'类型
32
+ - @submit 触发搜索事件
33
+ - @reset 触发重置事件 (内部已实现重置逻辑,如无需其他逻辑,可不实现)
34
+
35
+ ```
36
+ // 示例:
37
+ //formItems中使用示例:
38
+ {
39
+ //重置、搜索 按钮
40
+ type: 'formButtons',
41
+ labelWidth: '10px',
42
+ otherOptions: {
43
+ submit: true, // 是否显示搜索按钮,默认显示
44
+ reset: false, // 是否显示重置按钮,默认显示
45
+ submitText: '搜索', // 搜索按钮文字
46
+ resetText: '重置' // 重置按钮文字
47
+ showSubmitIcon: true, // 是否显示搜索按钮图标,默认显示
48
+ }
49
+ }
50
+
51
+ //form使用示例:(by-form & by-page-search组件使用示例)
52
+ <by-form
53
+ ref="BFormRef"
54
+ v-model="formData"
55
+ v-bind="formConfig"
56
+ @submit="handleSubmit"
57
+ @reset="handleReset"
58
+ ></by-form>
59
+
60
+ <by-page-search
61
+ v-model="searchQuery"
62
+ :search-form-config="formConfig"
63
+ @change="handleFormChange"
64
+ @submit="handleSubmit"
65
+ @reset="handleReset"
66
+ ></by-page-search>
67
+ ```
68
+
69
+ ### 特殊说明
70
+
71
+ #### 自定义时间选中器'customDatePicker'特别说明
72
+
73
+ 自定义时间选中器同时支持时间段方式绑定值 和 单独时间方式绑定值
74
+
75
+ ```
76
+ // 时间段方式绑定值
77
+ {
78
+ type: 'customDatePicker',
79
+ field: 'report_time',
80
+ label: '报表时间'
81
+ }
82
+ ```
83
+
84
+ ```
85
+ // 单独时间方式绑定值
86
+ {
87
+ type: 'customDatePicker',
88
+ field: 'report_time', // 仍然保留原来的字段,保证兼容性
89
+ startTimeField: 'start_time', // 新增开始时间字段
90
+ endTimeField: 'end_time', // 新增结束时间字段
91
+ label: '报表时间'
92
+ }
93
+ ```
package/docs/table.md CHANGED
@@ -1,10 +1,25 @@
1
1
  ### table
2
- #### 自定义列宽
3
- 注意📢: 一个项目中的name属性千万不能重名、一个项目中的name属性千万不能重名、一个项目中的name属性千万不能重名
4
- 给table组件设置name值属性、类型为String格式、表格会自动缓存用户拖拽之后的结果
5
- #### 自定义列
2
+
3
+ #### 列宽缓存
4
+
5
+ - 列宽缓存会根据 name 属性进行缓存; 所以如果业务中表格需要缓存列宽,请务必给table组件设置name属性(类型为String)
6
+
7
+ - name属性值不能重复,最好根据当前业务场景进行命名(如: name='adManage_headline2_account'),能保证不重名即可
8
+
9
+ - 当新增列、删除列时,会实时更新列宽缓存
10
+
11
+ - 注意📢: 一个项目中的name属性千万不能重名、一个项目中的name属性千万不能重名、一个项目中的name属性千万不能重名
12
+
13
+ #### 行高自适应
14
+
15
+ - 如果需要行高自适应,请设置属性::auto-height="true"
16
+
17
+ - 如果某个单元格的内容超出单元格显示,会自动撑高单元格
18
+
19
+ #### 自定义列
20
+
6
21
  给table组件设置以下对象
7
- customColumnConfig: { // 自定义列
22
+ customColumnConfig: { // 自定义列
8
23
  showCustomColumn: true, // 是否显示自定义列
9
24
  infoMethod: getCustomTableList, // 回显用的接口
10
25
  infoMethodParams: {}, // 回显用的接口参数
@@ -21,6 +36,8 @@
21
36
  { title: "操作", width: 80, fixed: "right", slots: { default: "operate" }}
22
37
  ]
23
38
  }
24
- #### Event
25
- 见[第三方插件vxe-table](./extension.md)
26
- 完整案列见 [表格 by-table](../README.md)
39
+
40
+ #### Event
41
+
42
+ 见[第三方插件vxe-table](./extension.md)
43
+ 完整案列见 [表格 by-table](../README.md)