auto-vue-manual 0.0.21 → 0.0.25

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 (31) hide show
  1. package/README.md +309 -22
  2. package/dist/auto-vue-manual.es.js +1443 -597
  3. package/dist/auto-vue-manual.umd.js +3 -3
  4. package/dist/index.css +1 -1
  5. package/dist/types/components/index.d.ts +7 -0
  6. package/dist/types/components/modal/basicDialog.vue.d.ts +85 -0
  7. package/dist/types/components/modal/basicDrawer.vue.d.ts +74 -0
  8. package/dist/types/components/modal/formDialog.vue.d.ts +133 -0
  9. package/dist/types/components/modal/tableDialog.vue.d.ts +100 -0
  10. package/dist/types/components/table/components/Pagination.vue.d.ts +1 -1
  11. package/dist/types/components/table/components/TableColumn.vue.d.ts +1 -1
  12. package/dist/types/components/table/components/TableColumnV2.d.ts +15 -0
  13. package/dist/types/components/table/hook/useAutoHeight.d.ts +1 -1
  14. package/dist/types/components/table/hook/useTable.d.ts +1 -1
  15. package/dist/types/components/table/index.vue.d.ts +24 -13
  16. package/dist/types/components/table/list.vue.d.ts +13 -9
  17. package/dist/types/components/table/summary.vue.d.ts +7 -5
  18. package/dist/types/components/table/utils/table.d.ts +1 -1
  19. package/dist/types/components/upload/uploadAvatar.d.ts +66 -0
  20. package/dist/types/components/upload/uploadImage.d.ts +66 -0
  21. package/dist/types/components/upload/uploadImages.d.ts +80 -0
  22. package/dist/types/index.d.ts +2 -2
  23. package/dist/types/store/modules/cache.d.ts +1 -1
  24. package/dist/types/types/index.d.ts +2 -1
  25. package/dist/types/types/install.d.ts +2 -1
  26. package/dist/types/{components/table/interface/index.d.ts → types/table.d.ts} +10 -2
  27. package/dist/types/types/upload.d.ts +16 -0
  28. package/dist/types/utils/index.d.ts +1 -0
  29. package/dist/types/utils/mittBus.d.ts +9 -5
  30. package/dist/version.js +1 -1
  31. package/package.json +2 -2
package/README.md CHANGED
@@ -1,8 +1,56 @@
1
1
  # 自用组件库
2
2
 
3
- ## ProTable / ProTableSummary 属性说明
3
+ ## 安装
4
4
 
5
- ### ColumnProps 列配置说明
5
+ ```bash
6
+ npm install auto-vue-manual
7
+ ```
8
+
9
+ ## 使用
10
+
11
+ ```js
12
+ import AutoVueManual from "auto-vue-manual";
13
+ import type { InstallOptions } from 'auto-vue-manual';
14
+ import 'auto-vue-manual/dist/index.css';
15
+
16
+ import request from "@/global/request";
17
+ import { Translate } from "@/languages/index";
18
+
19
+ const options: InstallOptions = {
20
+ request,
21
+ translate: Translate
22
+ }
23
+
24
+ const app = createApp(App);
25
+ app.use(AutoVueManual, options);
26
+ app.mount('#app');
27
+ ```
28
+
29
+ ## 目录
30
+
31
+ #### Table
32
+ [ProTable/ProTableSummary](#protable--protablesummary)
33
+ [ProTableList](#protablelist)
34
+
35
+ #### Modal
36
+ [BasicDialog](#basicdialog)
37
+ [BasicDrawer](#basicdrawer)
38
+ [FormDialog](#formdialog)
39
+ [TableDialog](#tabledialog)
40
+
41
+ #### Upload
42
+ [UploadAvatar](#uploadavatar)
43
+ [UploadImage](#uploadimage)
44
+ [UploadImages](#uploadimages)
45
+
46
+
47
+ # Document
48
+
49
+ ## Table
50
+
51
+ ### ProTable / ProTableSummary
52
+
53
+ #### ColumnProps
6
54
 
7
55
  | 属性名 | 类型 | 说明 | 默认值 |
8
56
  | ------ | ---- | ---- | ------ |
@@ -15,12 +63,13 @@
15
63
  | **search** | `{ defaultValue }` | 搜索项配置, defaultValue可以设置默认的init-param | - |
16
64
  | **headerRender** | `(scope: HeaderRenderScope<T>) => VNode` | 自定义表头内容渲染(tsx语法) | - |
17
65
  | **render** | `(scope: RenderScope<T>) => VNode string` | 自定义单元格内容渲染(tsx语法),Basic和list的scope略有不同,请注意 | - |
66
+ | **props** | `{ api?: string, activeValue?: any, inactiveValue?: any, refresh?: boolean }` | type = switch 时,props 配置 (TODO 更新其他type) | - |
18
67
 
19
- ### Props 参数说明
68
+ #### Props 参数说明
20
69
 
21
70
  | 属性名 | 类型 | 说明 | 默认值 |
22
71
  | ------ | ---- | ---- | ------ |
23
- | **columns** | `ColumnProps[]` | 必填,列配置项 | - |
72
+ | **columns** | [`ColumnProps[]`](#columnprops) | 必填,列配置项 | - |
24
73
  | **data** | `any[]` | 静态 table data 数据,若存在则不会使用 request url 返回的 data | - |
25
74
  | **url** | `string` | 实际请求接口 | - |
26
75
  | **auto-search** | `boolean` | 是否自动执行请求 api | true |
@@ -39,14 +88,15 @@
39
88
  | **sum-text** | `string` | 汇总文本,仅 ProTableSummary 有效 | Total |
40
89
  | **sum-text-format** | `string` | 汇总文本格式,仅 ProTableSummary 有效 | * |
41
90
 
42
- ### Event 事件说明
91
+ #### Event 事件说明
43
92
 
44
93
  | 事件名 | 说明 | 参数 |
45
94
  | ------ | ---- | ---- |
46
- | **@row-click** | 行点击事件,已排除 status / operation 列 | `({ row: any, column: any }) => void` |
47
- | **@row-dblclick** | 行双击事件,已排除 status / operation 列 | `({ row: any, column: any }) => void` |
95
+ | **@row-click** | 行点击事件,已排除 status / operation 列 | `(row: any, column: any) => void` |
96
+ | **@row-dblclick** | 行双击事件,已排除 status / operation 列 | `(row: any, column: any) => void` |
97
+ | **@switch-change** | 开关切换事件 | `(value, scope, column) => void` |
48
98
 
49
- ### Expose 暴露方法说明
99
+ #### Expose 暴露方法说明
50
100
 
51
101
  | 方法名 | 说明 | 参数 |
52
102
  | ------ | ---- | ---- |
@@ -54,7 +104,7 @@
54
104
  | **@reset** | 重置事件 | `() => void` |
55
105
  | **@getTableList** | 获取表格数据,不更新搜索参数及分页参数 | `() => void` |
56
106
 
57
- ### 示例代码
107
+ #### 示例代码
58
108
 
59
109
  ```vue
60
110
  <template>
@@ -84,10 +134,12 @@ import { ProTable } from "auto-vue-manual";
84
134
 
85
135
  const proTableRef = ref<InstanceType<typeof ProTable>>();
86
136
  const columns: ColumnProps[] = [
87
- { prop: "code", label: "代号", width: 100 },
137
+ { label: "index", type: 'index' },
138
+ { prop: "code", label: "代号", width: 100, type: 'tag' },
88
139
  { prop: "logo", label: "标志", width: 100 },
89
- { prop: "status", label: "状态", width: 100, search: { defaultValue: 1 } },
140
+ { prop: "status", label: "状态", width: 100, type: 'switch', props: { activeValue: 1, inactiveValue: 2, api: '/league/change_status', refresh: true } },
90
141
  { prop: "name", label: "名称", width: 0, align: "right",
142
+ search: { defaultValue: "League" },
91
143
  headerRender: ({ column }: HeaderRenderScope<any>) => {
92
144
  return (<span>headerRender: {column.label}</span>)
93
145
  },
@@ -117,22 +169,26 @@ const onRowDblclick = (row: any, column: any, event: any) => {
117
169
  </script>
118
170
  ```
119
171
 
120
- ## ProTableList 属性说明
172
+ ## ProTableList
121
173
 
122
- ### Props 参数说明
123
- ProTable 相同,但多了 `row-key` 属性,用于指定行数据的唯一标识。
174
+ #### Props 参数说明
175
+ | 属性名 | 类型 | 说明 | 默认值 |
176
+ | ------ | ---- | ---- | ------ |
177
+ | **row-key** | `string` | 行数据的 Key,用来优化 Table 的渲染,当表格数据多选时,所指定的 id ) | id |
178
+
179
+ 其余同 [ProTable](#protable--protablesummary)
124
180
 
125
- ### Event 事件说明
181
+ #### Event 事件说明
126
182
 
127
183
  | 事件名 | 说明 | 参数 |
128
184
  | ------ | ---- | ---- |
129
185
  | **@row-click** | 行点击事件,未排除 status / operation 列,需添加 e.stopPropagation() 阻止事件冒泡 | `({ row: any, column: any }) => void` |
130
186
  | **@row-dblclick** | 行双击事件,未排除 status / operation 列,需添加 e.stopPropagation() 阻止事件冒泡 | `({ row: any, column: any }) => void` |
131
187
 
132
- ### Expose 暴露方法说明
188
+ #### Expose 暴露方法说明
133
189
  与 ProTable 相同。
134
190
 
135
- ### 示例代码
191
+ #### 示例代码
136
192
 
137
193
  ```vue
138
194
  <template>
@@ -153,16 +209,16 @@ import ProTableList from "auto-vue-manual";
153
209
 
154
210
  const proTableRef = ref<InstanceType<typeof ProTableList>>();
155
211
  const columns: ColumnProps[] = [
156
- { prop: "label", label: "Label", width: 100 },
157
- { prop: "key", label: "Key", width: 100 },
212
+ { label: "index", type: 'index' },
213
+ { prop: "label", label: "Label", width: 100, type: 'tag' },
214
+ { prop: "key", label: "Key", width: 100, type: 'copy' },
158
215
  { prop: "value", label: "Value", width: 200, headerRender: (scope: HeaderRenderScope<any>) => {
159
- console.log('headerRender', scope)
160
216
  return (
161
217
  <span>HeaderRender: {scope.column.label}</span>
162
218
  )
163
219
  }},
220
+ { prop: "status", label: "Status", width: 100, type: 'switch', props: { activeValue: 1, inactiveValue: 2, api: '/league/change_status', refresh: true } },
164
221
  { prop: "action", label: "Action", width: 60, align: "center", render: (scope: RenderScope<any>) => {
165
- console.log('render', scope)
166
222
  return (
167
223
  <el-button type="primary" size="small" link icon={Plus} onClick={(e: Event) => {
168
224
  e.stopPropagation();
@@ -192,4 +248,235 @@ const onRowDblclick = (row: RowEventHandlerParams) => {
192
248
  console.log("onRowDblclick", row);
193
249
  };
194
250
  </script>
195
- ```
251
+ ```
252
+
253
+ ## Modal
254
+
255
+ ### BasicDialog
256
+
257
+ #### Props 参数说明
258
+
259
+ | 属性名 | 类型 | 说明 | 默认值 |
260
+ | ------ | ---- | ---- | ------ |
261
+ | **visible** | `boolean` | 是否显示 | false |
262
+ | **show-close** | `boolean` | 是否显示关闭按钮 | true |
263
+ | **title** | `string` | 标题 | Title |
264
+ | **width** | `string` | 宽度 | 520px |
265
+ | **top** | `string` | 顶部距离 | 15vh |
266
+ | **dialog-props** | `object` | 对话框属性 | {} |
267
+
268
+ #### Event 事件说明
269
+
270
+ | 事件名 | 说明 | 参数 |
271
+ | ------ | ---- | ---- |
272
+ | **@closed** | 关闭事件 | - |
273
+ | **@submit** | 确定事件 | - |
274
+
275
+ #### 示例代码
276
+
277
+ ```vue
278
+ <template>
279
+ <BasicDialog ref="basicDialogRef" :visible="visible" title="user.name" width="520px" @closed="onClosed" @submit="onSubmit" />
280
+ </template>
281
+ <script setup lang="ts">
282
+ import { ref } from "vue";
283
+ import BasicDialog from "auto-vue-manual";
284
+
285
+ const basicDialogRef = ref<InstanceType<typeof BasicDialog>>();
286
+ const visible = ref(false);
287
+
288
+ const onClosed = () => {
289
+ console.log("onClosed");
290
+ };
291
+ const onSubmit = () => {
292
+ console.log("onSubmit");
293
+ };
294
+ </script>
295
+ ```
296
+
297
+ ## BasicDrawer
298
+
299
+ #### Props 参数说明
300
+
301
+ | 属性名 | 类型 | 说明 | 默认值 |
302
+ | ------ | ---- | ---- | ------ |
303
+ | **visible** | `boolean` | 是否显示 | false |
304
+ | **show-close** | `boolean` | 是否显示关闭按钮 | true |
305
+ | **title** | `string` | 标题 | Title |
306
+ | **width** | `string` | 宽度 | 520px |
307
+ | **dialog-props** | `object` | 对话框属性 | {} |
308
+
309
+ #### Event 事件说明
310
+
311
+ | 事件名 | 说明 | 参数 |
312
+ | ------ | ---- | ---- |
313
+ | **@closed** | 关闭事件 | - |
314
+
315
+ #### 示例代码
316
+
317
+ ```vue
318
+ <template>
319
+ <BasicDrawer ref="basicDrawerRef" :visible="visible" title="user.name" width="520px" @closed="onClosed" />
320
+ </template>
321
+ <script setup lang="ts">
322
+ import { ref } from "vue";
323
+ import BasicDrawer from "auto-vue-manual";
324
+
325
+ const basicDrawerRef = ref<InstanceType<typeof BasicDrawer>>();
326
+ const visible = ref(false);
327
+
328
+ const onClosed = () => {
329
+ console.log("onClosed");
330
+ };
331
+ </script>
332
+ ```
333
+
334
+ ## FormDialog
335
+
336
+ #### Props 参数说明
337
+
338
+ | 属性名 | 类型 | 说明 | 默认值 |
339
+ | ------ | ---- | ---- | ------ |
340
+ | **executing** | `boolean` | 是否执行中 | false |
341
+ | **footer** | `boolean` | 是否显示底部 | true |
342
+ | **btn-size** | `string` | 按钮大小 | default |
343
+ | **ok-text** | `string` | 确定按钮文本 | base.submit |
344
+ | **cancel-text** | `string` | 取消按钮文本 | base.cancel |
345
+
346
+ 其余同 [BasicDialog](#basicdialog)
347
+
348
+ #### Event 事件说明
349
+
350
+ | 事件名 | 说明 | 参数 |
351
+ | ------ | ---- | ---- |
352
+ | **@closed** | 关闭事件 | - |
353
+ | **@submit** | 确定事件 | - |
354
+ | **@before-close** | 关闭前事件 | - |
355
+
356
+ #### 示例代码
357
+
358
+ ```vue
359
+ <template>
360
+ <FormDialog ref="formDialogRef" :visible="visible" title="user.name" width="520px" @closed="onClosed" @submit="onSubmit" @before-close="onBeforeClose" />
361
+ </template>
362
+ <script setup lang="ts">
363
+ import { ref } from "vue";
364
+ import FormDialog from "auto-vue-manual";
365
+
366
+ const formDialogRef = ref<InstanceType<typeof FormDialog>>();
367
+ const visible = ref(false);
368
+
369
+ const onClosed = () => {
370
+ console.log("onClosed");
371
+ };
372
+ const onSubmit = () => {
373
+ console.log("onSubmit");
374
+ };
375
+ const onBeforeClose = () => {
376
+ console.log("onBeforeClose");
377
+ };
378
+ </script>
379
+ ```
380
+
381
+ ## TableDialog
382
+
383
+ #### Props 参数说明
384
+
385
+ | 属性名 | 类型 | 说明 | 默认值 |
386
+ | ------ | ---- | ---- | ------ |
387
+ | **requesting** | `boolean` | 是否请求中 | false |
388
+
389
+ 其余同 [BasicDialog](#basicdialog)
390
+
391
+ #### Event 事件说明
392
+
393
+ | 事件名 | 说明 | 参数 |
394
+ | ------ | ---- | ---- |
395
+ | **@closed** | 关闭事件 | - |
396
+
397
+ #### 示例代码
398
+
399
+ ```vue
400
+ <template>
401
+ <TableDialog ref="tableDialogRef" :visible="visible" title="user.name" width="520px" @closed="onClosed" />
402
+ </template>
403
+ <script setup lang="ts">
404
+ import { ref } from "vue";
405
+ import TableDialog from "auto-vue-manual";
406
+
407
+ const tableDialogRef = ref<InstanceType<typeof TableDialog>>();
408
+ const visible = ref(false);
409
+
410
+ const onClosed = () => {
411
+ console.log("onClosed");
412
+ };
413
+ </script>
414
+ ```
415
+
416
+ ## Upload
417
+
418
+ ### UploadAvatar
419
+
420
+ #### Props 参数说明
421
+
422
+ | 属性名 | 类型 | 说明 | 默认值 |
423
+ | ------ | ---- | ---- | ------ |
424
+ | **url** | `string` | 上传地址 | - |
425
+ | **avatar** | `string` | 头像地址 | - |
426
+ | **text** | `string` | 上传提示 | - |
427
+ | **path** | `string` | 保存路径 | - |
428
+ | **preview** | `boolean` | 是否显示预览 | false |
429
+ | **disabled** | `boolean` | 是否禁用 | false |
430
+ | **size** | `number` | 大小(KB) | 5120 |
431
+
432
+ ### UploadImage
433
+
434
+ #### Props 参数说明
435
+
436
+ | 属性名 | 类型 | 说明 | 默认值 |
437
+ | ------ | ---- | ---- | ------ |
438
+ | **image** | `string` | 图片地址 | - |
439
+
440
+ 其余同 [UploadAvatar](#uploadavatar)
441
+
442
+ #### 示例代码
443
+
444
+ ```vue
445
+ <template>
446
+ <UploadAvatar ref="uploadAvatarRef" url="/upload/image" :avatar="avatar" text="上传头像" path="/avatar" preview :size="1024" />
447
+ </template>
448
+ <script setup lang="ts">
449
+ import { ref } from "vue";
450
+ import UploadAvatar from "auto-vue-manual";
451
+
452
+ const uploadAvatarRef = ref<InstanceType<typeof UploadAvatar>>();
453
+ const avatar = ref("");
454
+ </script>
455
+ ```
456
+
457
+ ### UploadImages
458
+
459
+ #### Props 参数说明
460
+
461
+ | 属性名 | 类型 | 说明 | 默认值 |
462
+ | ------ | ---- | ---- | ------ |
463
+ | **images** | `FileList[]` | 图片地址 | - |
464
+ | **limit** | `number` | 限制数量 | 10 |
465
+
466
+ 其余同 [UploadAvatar](#uploadavatar)
467
+
468
+ #### 示例代码
469
+
470
+ ```vue
471
+ <template>
472
+ <UploadImages ref="uploadImagesRef" url="/upload/image" :images="images" text="上传图片" path="/image" preview :size="1024" />
473
+ </template>
474
+ <script setup lang="ts">
475
+ import type { FileList } from "auto-vue-manual";
476
+
477
+ import { ref } from "vue";
478
+ import UploadImages from "auto-vue-manual";
479
+
480
+ const uploadImagesRef = ref<InstanceType<typeof UploadImages>>();
481
+ const images = ref<FileList[]>([]);
482
+ </script>