@wyfex/ivue 0.19.4 → 0.21.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.
Files changed (57) hide show
  1. package/README.md +7 -1
  2. package/dist/index.es.js +10 -10
  3. package/dist/index.umd.cjs +10 -10
  4. package/dist/ivue.css +1 -1
  5. package/dist/types/UseCrud/defaultExtConfig.d.ts +4 -0
  6. package/dist/types/UseCrud/hook.d.ts +2 -22
  7. package/dist/types/UseCrud/index.vue.d.ts +11 -2
  8. package/dist/types/UseCrud/types.d.ts +47 -3
  9. package/dist/types/UseCrud/utils.d.ts +48 -2
  10. package/dist/types/UseEcharts/hook.d.ts +6 -0
  11. package/dist/types/UseEcharts/index.vue.d.ts +105 -0
  12. package/dist/types/UseEcharts/props.d.ts +46 -0
  13. package/dist/types/UseEcharts/types.d.ts +6 -0
  14. package/dist/types/UseElButton/index.vue.d.ts +16 -5
  15. package/dist/types/UseElButton/props.d.ts +2 -2
  16. package/dist/types/UseElCheckbox/hook.d.ts +3 -2
  17. package/dist/types/UseElCheckbox/index.vue.d.ts +14 -8
  18. package/dist/types/UseElCheckbox/props.d.ts +6 -2
  19. package/dist/types/UseElCheckbox/types.d.ts +1 -1
  20. package/dist/types/UseElDatePicker/index.vue.d.ts +4 -4
  21. package/dist/types/UseElDatePicker/types.d.ts +2 -2
  22. package/dist/types/UseElDialog/hook.d.ts +1 -0
  23. package/dist/types/UseElDialog/index.vue.d.ts +19 -1
  24. package/dist/types/UseElDialog/props.d.ts +8 -0
  25. package/dist/types/UseElDrawer/index.vue.d.ts +10 -1
  26. package/dist/types/UseElDrawer/props.d.ts +4 -0
  27. package/dist/types/UseElForm/types.d.ts +1 -2
  28. package/dist/types/UseElInput/index.vue.d.ts +4 -4
  29. package/dist/types/UseElSelect/index.vue.d.ts +4 -4
  30. package/dist/types/UseElTable/defaultExtConfig.d.ts +1 -1
  31. package/dist/types/UseElTable/types.d.ts +9 -10
  32. package/dist/types/UseElTimeSelect/index.vue.d.ts +28 -0
  33. package/dist/types/UseElTimeSelect/props.d.ts +13 -0
  34. package/dist/types/UseElTimeSelect/types.d.ts +6 -0
  35. package/dist/types/UseRender/index.vue.d.ts +1 -1
  36. package/dist/types/index.d.ts +2 -1
  37. package/package.json +12 -12
  38. package/src/components/UseCrud/defaultExtConfig.ts +1 -0
  39. package/src/components/UseCrud/props.ts +1 -1
  40. package/src/components/UseCrud/types.ts +97 -23
  41. package/src/components/UseEcharts/props.ts +77 -0
  42. package/src/components/UseEcharts/types.ts +14 -0
  43. package/src/components/UseElButton/props.ts +3 -3
  44. package/src/components/UseElButton/types.ts +12 -37
  45. package/src/components/UseElCheckbox/props.ts +7 -5
  46. package/src/components/UseElCheckbox/types.ts +5 -2
  47. package/src/components/UseElConfigProvider/types.ts +10 -18
  48. package/src/components/UseElDatePicker/types.ts +3 -3
  49. package/src/components/UseElDialog/props.ts +16 -2
  50. package/src/components/UseElDrawer/props.ts +7 -0
  51. package/src/components/UseElForm/types.ts +3 -10
  52. package/src/components/UseElTable/types.ts +92 -183
  53. package/src/components/UseElTimeSelect/props.ts +22 -0
  54. package/src/components/UseElTimeSelect/types.ts +15 -0
  55. package/src/components/UseLineTitle/defaultExtConfig.ts +1 -1
  56. package/dist/types/UseCrud/useCrudWithBusiness.d.ts +0 -46
  57. /package/dist/types/UseElForm/components/controls/{TimeSelect.vue.d.ts → TimeSelectRange.vue.d.ts} +0 -0
@@ -166,8 +166,7 @@ export interface IRequired {
166
166
  }
167
167
  export interface FormColumn {
168
168
  label?: string;
169
- prop: string;
170
- queryProp?: string | string[];
169
+ prop?: string;
171
170
  required?: boolean | IRequired;
172
171
  errorMessage?: string;
173
172
  disabled?: boolean;
@@ -102,17 +102,17 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
102
102
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
103
103
  }>, {
104
104
  useRender: boolean | import('../../types').RenderConfig;
105
- width: string;
106
105
  unit: string | Record<string, any>;
107
- modelValue: string | number;
106
+ clearable: boolean;
107
+ rows: number;
108
108
  resize: string;
109
109
  placeholder: string;
110
- clearable: boolean;
110
+ width: string;
111
111
  prefixContent: string | Record<string, any>;
112
112
  suffixContent: string | Record<string, any>;
113
113
  prependContent: string | Record<string, any>;
114
114
  appendContent: string | Record<string, any>;
115
- rows: number;
115
+ modelValue: string | number;
116
116
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
117
117
  declare const _default: typeof __VLS_export;
118
118
  export default _default;
@@ -81,13 +81,13 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
81
81
  }>, {
82
82
  useRender: boolean | import('../../types').RenderConfig;
83
83
  dictProps: import('../../types').DictProps;
84
- width: string;
85
- modelValue: string | number | boolean | unknown[];
86
- toJoin: boolean;
87
- placeholder: string;
88
84
  clearable: boolean;
85
+ placeholder: string;
86
+ width: string;
89
87
  options: Record<string, any>[];
90
88
  useV2: boolean;
89
+ toJoin: boolean;
90
+ modelValue: string | number | boolean | unknown[];
91
91
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
92
92
  declare const _default: typeof __VLS_export;
93
93
  export default _default;
@@ -30,7 +30,7 @@ declare const _default: {
30
30
  pagination: {
31
31
  total: number;
32
32
  marginTop: number;
33
- position: string;
33
+ position: "right";
34
34
  pageSizes: number[];
35
35
  background: true;
36
36
  layout: string;
@@ -24,14 +24,6 @@ export interface Edit {
24
24
  component: Component;
25
25
  attrs?: EditAttrs;
26
26
  }
27
- export interface TableColumnExtConfig {
28
- header?: Header;
29
- edit?: Edit;
30
- formatter?: Function;
31
- class?: string | string[];
32
- style?: string | Record<string, unknown>;
33
- slot?: boolean | string;
34
- }
35
27
  export interface TableColumn {
36
28
  label?: string;
37
29
  prop?: string;
@@ -43,7 +35,14 @@ export interface TableColumn {
43
35
  fixed?: boolean | string;
44
36
  sortable?: boolean;
45
37
  showOverflowTooltip?: boolean;
46
- extConfig?: TableColumnExtConfig;
38
+ extConfig?: {
39
+ header?: Header;
40
+ edit?: Edit;
41
+ formatter?: Function;
42
+ class?: string | string[];
43
+ style?: string | Record<string, unknown>;
44
+ slot?: boolean | string;
45
+ };
47
46
  children?: TableColumn[];
48
47
  }
49
48
  export interface Selection {
@@ -94,7 +93,7 @@ export interface ExtConfig {
94
93
  pagination?: {
95
94
  total?: number;
96
95
  marginTop?: number;
97
- position?: string;
96
+ position?: 'left' | 'center' | 'right';
98
97
  pageSizes?: number[];
99
98
  background?: boolean;
100
99
  layout?: string;
@@ -0,0 +1,28 @@
1
+ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ modelValue: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ useRender: {
7
+ type: import('vue').PropType<boolean | import('../../types').RenderConfig>;
8
+ default: boolean;
9
+ };
10
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
+ "update:modelValue": (value: string | number | any[]) => any;
12
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
13
+ modelValue: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
17
+ useRender: {
18
+ type: import('vue').PropType<boolean | import('../../types').RenderConfig>;
19
+ default: boolean;
20
+ };
21
+ }>> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: string | number | any[]) => any) | undefined;
23
+ }>, {
24
+ useRender: boolean | import('../../types').RenderConfig;
25
+ modelValue: string;
26
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { PropType } from 'vue';
2
+ import { RenderConfig } from '../../types';
3
+ declare const _default: {
4
+ modelValue: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ useRender: {
9
+ type: PropType<boolean | RenderConfig>;
10
+ default: boolean;
11
+ };
12
+ };
13
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { ExtractPropTypes } from 'vue';
2
+ import { default as componentProps } from './props';
3
+ export type Props = ExtractPropTypes<typeof componentProps>;
4
+ export type Emits = {
5
+ (e: 'update:modelValue', value: string | number | any[]): void;
6
+ };
@@ -50,9 +50,9 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
50
50
  };
51
51
  }>> & Readonly<{}>, {
52
52
  class: string;
53
+ separator: string;
53
54
  style: string | Record<string, any>;
54
55
  emptyText: string;
55
- separator: string;
56
56
  parseKey: string;
57
57
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
58
58
  declare const _default: typeof __VLS_export;
@@ -1,4 +1,5 @@
1
1
  export { default as UseCrud } from './UseCrud/index.vue';
2
+ export { default as UseEcharts } from './UseEcharts/index.vue';
2
3
  export { default as UseElButton } from './UseElButton/index.vue';
3
4
  export { default as UseElCheckbox } from './UseElCheckbox/index.vue';
4
5
  export { default as UseElConfigProvider } from './UseElConfigProvider/index.vue';
@@ -11,10 +12,10 @@ export { default as UseElInput } from './UseElInput/index.vue';
11
12
  export { default as UseElSelect } from './UseElSelect/index.vue';
12
13
  export { default as UseElSwitch } from './UseElSwitch/index.vue';
13
14
  export { default as UseElTable } from './UseElTable/index.vue';
15
+ export { default as UseElTimeSelect } from './UseElTimeSelect/index.vue';
14
16
  export { default as UseElTooltip } from './UseElTooltip/index.vue';
15
17
  export { default as UseElUpload } from './UseElUpload/index.vue';
16
18
  export { default as UseIconfont } from './UseIconfont/index.vue';
17
19
  export { default as UseLineTitle } from './UseLineTitle/index.vue';
18
20
  export { default as UseRender } from './UseRender/index.vue';
19
21
  export { default as UseSvgIcon } from './UseSvgIcon/index.vue';
20
- export { useCrud } from './UseCrud/useCrudWithBusiness';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wyfex/ivue",
3
- "version": "0.19.4",
4
- "description": "万有前端 X 体系下基于 Vite8 + Vue3 + Typescript6 + ElementPlus2 构建的 iVue 组件库",
3
+ "version": "0.21.0",
4
+ "description": "万有前端 X 体系下基于 Vite8 + Vue3 + Typescript6 + ElementPlus2 构建的高性能组件库",
5
5
  "homepage": "https://wyfex.top/idocs/ivue",
6
6
  "type": "module",
7
7
  "main": "dist/index.umd.cjs",
@@ -37,7 +37,7 @@
37
37
  "wyfex",
38
38
  "ivue",
39
39
  "wyfex-ivue",
40
- "万有前端",
40
+ "万有前端 X",
41
41
  "万有前端 X ·iVue"
42
42
  ],
43
43
  "author": "Symbol(王独秀) <963569210@qq.com>",
@@ -50,20 +50,20 @@
50
50
  "vue": ">=3.2.0 <4.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^26.1.2",
53
+ "@types/node": "^26.3.0",
54
54
  "@vitejs/plugin-vue": "^6.0.8",
55
55
  "@vue/tsconfig": "^0.9.1",
56
- "@wyfex/iutils": "^0.55.0",
57
- "dayjs": "^1.11.21",
58
- "element-plus": "^2.14.3",
59
- "sass-embedded": "^1.100.0",
56
+ "@wyfex/iutils": "^0.80.0",
57
+ "dayjs": "^1.11.23",
58
+ "element-plus": "^2.14.5",
59
+ "sass-embedded": "^1.103.1",
60
60
  "typescript": "~6.0.3",
61
- "unplugin-auto-import": "^21.0.0",
61
+ "unplugin-auto-import": "^21.1.0",
62
62
  "unplugin-dts": "^1.0.3",
63
63
  "unplugin-vue-components": "^32.1.0",
64
- "vite": "^8.1.5",
64
+ "vite": "^8.2.2",
65
65
  "vite-svg-loader": "^5.1.1",
66
- "vue": "^3.5.40",
67
- "vue-tsc": "^3.3.8"
66
+ "vue": "^3.5.41",
67
+ "vue-tsc": "^3.3.11"
68
68
  }
69
69
  }
@@ -4,6 +4,7 @@ import type { MergedExtConfig } from './types'
4
4
  * 默认扩展配置
5
5
  */
6
6
  export default {
7
+ crudFetch: { queryImmediate: true, autoCancelQueryStrategy: 'unmount' },
7
8
  mode: { type: 'PAGE' },
8
9
  actionBar: {
9
10
  margin: '20px 0',
@@ -8,7 +8,7 @@ export default {
8
8
  /**
9
9
  * 配置 必传
10
10
  * 1、该configs是【formColumns】和【tableColumns】的统一配置入口
11
- * 2、该configs在【formColumns】和【tableColumns】的配置基础上新增了【onlySearch】和【tableOrder】配置项用于兼容特殊应用场景
11
+ * 2、该configs在【formColumns】和【tableColumns】的配置基础上新增了【queryLabel】、【onlySearch】和【tableOrder】配置项用于兼容特殊应用场景
12
12
  */
13
13
  configs: {
14
14
  type: Array as PropType<Configs[]>,
@@ -1,4 +1,10 @@
1
- import type { Component, ExtractPropTypes } from 'vue'
1
+ import type {
2
+ Component,
3
+ ComputedRef,
4
+ ExtractPropTypes,
5
+ Ref,
6
+ ShallowRef
7
+ } from 'vue'
2
8
  import componentProps from './props'
3
9
  import type { FormColumn } from '../UseElForm/types'
4
10
  import type {
@@ -15,51 +21,54 @@ export type Props = ExtractPropTypes<typeof componentProps>
15
21
  * emits类型
16
22
  */
17
23
  export type Emits = {
18
- /**
19
- * dictKeys事件
20
- */
24
+ /** dictKeys事件 */
21
25
  (e: 'onDictKeys', value?: string[]): void
22
26
  }
23
27
 
24
28
  /**
25
29
  * 基础配置类型
26
30
  */
27
- export type BaseConfigs = Omit<FormColumn, 'prop'> & Omit<TableColumn, 'prop'>
31
+ export type BaseConfigs = FormColumn & TableColumn
28
32
 
29
33
  /**
30
34
  * 配置项接口
31
35
  */
32
36
  export interface Configs extends BaseConfigs {
33
- prop: string
37
+ /** 查询表单项标签 当查询表单项标签和表格项标签不一致使使用 */
38
+ queryLabel?: string
39
+ /** 查询表单项属性 当查询表单项属性和表格项属性不一致使使用,可传以逗号分隔的字符串,组件内部自动拆解*/
40
+ queryProp?: string
41
+ /** 是否仅搜索 */
34
42
  onlySearch?: boolean
43
+ /** 表格排序 */
35
44
  tableOrder?: number
36
45
  }
37
46
 
38
47
  /**
39
48
  * 分割线配置接口
40
- * show:是否显示分割线
41
- * borderStyle:分割线边框样式
42
49
  */
43
50
  export interface Divider {
51
+ /** 是否显示分割线 */
44
52
  show?: boolean
53
+ /** 分割线边框样式 */
45
54
  borderStyle?: 'none' | 'solid' | 'hidden' | 'dashed'
46
55
  }
47
56
 
48
57
  /**
49
58
  * 操作栏配置接口
50
- * margin:操作栏外边距
51
- * showControlFormDisplayBtn:是否显示【收起/展开查询】按钮
52
- * controlFormDisplayBtnWithOpenedIcon:【收起/展开查询】按钮展开时图标
53
- * controlFormDisplayBtnWithClosedIcon:【收起/展开查询】按钮收起时图标
54
- * reverse:是否反转操作栏按钮 仅showControlFormDisplayBtn为true时生效
55
- * divider:操作栏底部分割线
56
59
  */
57
60
  export interface ActionBar {
61
+ /** 操作栏外边距 */
58
62
  margin?: string
63
+ /** 是否显示【收起/展开查询】按钮 */
59
64
  showControlFormDisplayBtn?: boolean
65
+ /** 【收起/展开查询】按钮展开时图标 */
60
66
  controlFormDisplayBtnWithOpenedIcon?: Component
67
+ /** 【收起/展开查询】按钮收起时图标 */
61
68
  controlFormDisplayBtnWithClosedIcon?: Component
69
+ /** 是否反转操作栏按钮 仅showControlFormDisplayBtn为true时生效 */
62
70
  reverse?: boolean
71
+ /** 操作栏底部分割线 */
63
72
  divider?: Divider
64
73
  }
65
74
 
@@ -67,19 +76,84 @@ export interface ActionBar {
67
76
  * extConfig接口
68
77
  */
69
78
  export interface ExtConfig {
70
- /**
71
- * 操作栏配置项
72
- */
79
+ /** 增删改查请求配置项 */
80
+ crudFetch?: {
81
+ /** 查询api */
82
+ queryApi?: Function
83
+ /** 是否立即查询 */
84
+ queryImmediate?: boolean
85
+ /** 自动取消查询策略 配合signal实现接口取消请求 */
86
+ autoCancelQueryStrategy?: 'none' | 'unmount' | 'deactivate' | 'both'
87
+ /** 开始查询前钩子 用于注入字典数据等 */
88
+ onQueryBefore?: (done: () => void) => void
89
+ /** 查询错误钩子 */
90
+ onQueryError?: (err: any) => void
91
+ /** 删除api */
92
+ deleteApi?: Function
93
+ }
94
+ /** 操作栏配置项 */
73
95
  actionBar?: ActionBar
74
- /**
75
- * 弹窗配置项
76
- * type:弹窗类型 支持Drawer和Dialog
77
- * 其他配置项由于组件内部已进行v-bind透传,不不在此重复声明接口,详见UseElDrawer和UseElDialog组件types
78
- */
79
- modal?: { type?: 'Drawer' | 'Dialog' }
96
+ /** 弹窗配置项 */
97
+ modal?: {
98
+ /** 弹窗类型 支持Drawer和Dialog */
99
+ type?: 'Drawer' | 'Dialog'
100
+ /** 其他配置项由于组件内部已进行v-bind透传,故不在此重复声明接口,详见UseElDrawer和UseElDialog组件types */
101
+ }
80
102
  }
81
103
 
82
104
  /**
83
105
  * 合并后的extConfig类型 本组件ExtConfig和UseElTable组件ExtConfig合并
84
106
  */
85
107
  export type MergedExtConfig = ExtConfig & TableExtConfig
108
+
109
+ /**
110
+ * Crud状态类型
111
+ */
112
+ export interface UseCrudState {
113
+ /** 表单列配置 */
114
+ formColumns: FormColumn[]
115
+ /** 表格列配置 */
116
+ tableColumns: TableColumn[]
117
+ /** 表单模型 */
118
+ formModel: Record<string, any>
119
+ /** 表格loading */
120
+ tableLoading: boolean
121
+ /** 表格数据 */
122
+ tableData: any[]
123
+ /** 当前页码 */
124
+ currentPage: number
125
+ /** 分页大小 */
126
+ pageSize: number
127
+ /** 分页总数 */
128
+ total: number
129
+ /** 字典映射 */
130
+ dictMap: Record<string, any>
131
+ }
132
+
133
+ /**
134
+ * Crud返回类型
135
+ */
136
+ export interface UseCrudReturn {
137
+ state: Ref<UseCrudState>
138
+ heightComputed: ComputedRef<string>
139
+ fetchTableData: (
140
+ options?: { params?: Record<string, any>; isPageApi?: boolean },
141
+ cb?: () => void
142
+ ) => Promise<any>
143
+ onQuery: (e: Record<string, unknown>, done?: () => void) => void
144
+ onCancelQueryRequest: () => void
145
+ handleDelete: (
146
+ payload: { id?: string | number; ids?: string | Array<string | number> },
147
+ loadingConfig: { source?: Record<string, unknown>; key?: string },
148
+ successCb?: () => void,
149
+ errorCb?: (err: unknown) => void,
150
+ successMsg?: string
151
+ ) => Promise<void>
152
+ margin: ComputedRef<string | undefined>
153
+ actionBar: any
154
+ handleDisplayQueryForm: () => void
155
+ showModal: Ref<boolean>
156
+ modalComponent: ShallowRef<Component | null>
157
+ handleShowModal: () => Promise<void>
158
+ handleCloseModal: ComputedRef<() => void>
159
+ }
@@ -0,0 +1,77 @@
1
+ import type { PropType } from 'vue'
2
+
3
+ /**
4
+ * 组件props
5
+ */
6
+ export default {
7
+ /**
8
+ * Echarts实例(即import * as echarts from 'echarts') 可通过provide传入
9
+ */
10
+ echarts: {
11
+ type: Object as PropType<{ init: (...args: any[]) => any }>,
12
+ default: null
13
+ },
14
+ /**
15
+ * 配置项
16
+ */
17
+ options: {
18
+ type: Object as PropType<Record<string, any>>,
19
+ default: () => ({})
20
+ },
21
+ /**
22
+ * 容器宽度
23
+ */
24
+ width: {
25
+ type: String,
26
+ default: '100%'
27
+ },
28
+ /**
29
+ * 容器高度
30
+ */
31
+ height: {
32
+ type: String,
33
+ default: '100%'
34
+ },
35
+ /**
36
+ * 主题
37
+ */
38
+ theme: {
39
+ type: [String, Object] as PropType<string | Record<string, any>>,
40
+ default: ''
41
+ },
42
+ /**
43
+ * 是否不和options合并
44
+ */
45
+ notMerge: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ /**
50
+ * resize 防抖毫秒
51
+ */
52
+ resizeDelay: {
53
+ type: Number,
54
+ default: 100
55
+ },
56
+ /**
57
+ * 是否开启窗口自动resize
58
+ */
59
+ autoResize: {
60
+ type: Boolean,
61
+ default: true
62
+ },
63
+ /**
64
+ * 是否显示loading加载动画
65
+ */
66
+ loading: {
67
+ type: Boolean,
68
+ default: false
69
+ },
70
+ /**
71
+ * loading自定义样式配置,对应echarts showLoading参数
72
+ */
73
+ loadingConfig: {
74
+ type: Object as PropType<Record<string, any>>,
75
+ default: () => ({})
76
+ }
77
+ }
@@ -0,0 +1,14 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import componentProps from './props'
3
+
4
+ /**
5
+ * props类型
6
+ */
7
+ export type Props = ExtractPropTypes<typeof componentProps>
8
+
9
+ /**
10
+ * inject的echarts类型
11
+ */
12
+ export type InjectedEcharts = {
13
+ init: (dom: HTMLElement | null, theme?: string | object) => any
14
+ }
@@ -6,11 +6,11 @@ import type { ExtConfig } from './types'
6
6
  */
7
7
  export default {
8
8
  /**
9
- * 按钮文本 必传
9
+ * 按钮文本 未传时可使用自定义slot
10
10
  */
11
11
  btnText: {
12
- type: String,
13
- required: true
12
+ type: [String, Number, Boolean],
13
+ default: ''
14
14
  },
15
15
  /**
16
16
  * 按钮类型 同ElButton类型,默认为primary
@@ -10,9 +10,7 @@ export type Props = ExtractPropTypes<typeof componentProps>
10
10
  * emits类型
11
11
  */
12
12
  export type Emits = {
13
- /**
14
- * 点击事件 默认自带防抖
15
- */
13
+ /** 点击事件 默认自带防抖 */
16
14
  (e: 'click', value?: string | number | Record<string, unknown>): void
17
15
  }
18
16
 
@@ -20,31 +18,18 @@ export type Emits = {
20
18
  * extConfig接口
21
19
  */
22
20
  export interface ExtConfig {
23
- /**
24
- * 防抖配置项 无需防抖将delay设置为0即可
25
- */
21
+ /** 防抖配置项 无需防抖将delay设置为0即可 */
26
22
  debounce?: {
27
- /**
28
- * 防抖时间
29
- */
23
+ /** 防抖时间 */
30
24
  delay?: number
31
- /**
32
- * 是否立即开启防抖
33
- */
25
+ /** 是否立即开启防抖 */
34
26
  immediate?: boolean
35
27
  }
36
- /**
37
- * 二次确认配置项
38
- */
28
+ /** 二次确认配置项 */
39
29
  confirm?: {
40
- /**
41
- * 二次确认数据 显式设置则开启二次确认
42
- * 可为String、Number、Object、Array,无需传递数据则显式设置为null
43
- */
30
+ /** 二次确认数据 显式设置则开启二次确认,可为String、Number、Object、Array,无需传递数据则显式设置为null */
44
31
  data?: string | number | Record<string, unknown> | unknown[] | null
45
- /**
46
- * 二次确认类型 同ElButton类型
47
- */
32
+ /** 二次确认类型 同ElButton类型 */
48
33
  type?:
49
34
  | 'default'
50
35
  | 'primary'
@@ -53,25 +38,15 @@ export interface ExtConfig {
53
38
  | 'danger'
54
39
  | 'info'
55
40
  | ''
56
- /**
57
- * 二次确认数据主键key 对象或对象数组需要
58
- */
41
+ /** 二次确认数据主键key 对象或对象数组需要 */
59
42
  dataKey?: string
60
- /**
61
- * 是否将数组转换为以逗号分隔的字符串 如:[1,2] => '1,2'
62
- */
43
+ /** 是否将数组转换为以逗号分隔的字符串 如:[1,2] => '1,2' */
63
44
  toJoin?: boolean
64
- /**
65
- * 是否追加s到dataKey后面 如:id => ids
66
- */
45
+ /** 是否追加s到dataKey后面 如:id => ids */
67
46
  appendS?: boolean
68
- /**
69
- * 二次确认弹框标题
70
- */
47
+ /** 二次确认弹框标题 */
71
48
  title?: string
72
- /**
73
- * 二次确认弹框内容
74
- */
49
+ /** 二次确认弹框内容 */
75
50
  content?: string
76
51
  }
77
52
  }
@@ -1,3 +1,5 @@
1
+ import type { PropType } from 'vue'
2
+
1
3
  /**
2
4
  * 组件props
3
5
  */
@@ -6,16 +8,16 @@ export default {
6
8
  * 双向绑定数据源
7
9
  */
8
10
  modelValue: {
9
- type: [Array, String],
11
+ type: [Array, String, Number, Boolean],
10
12
  default: () => []
11
13
  },
12
14
  /**
13
- * 选项数据源
15
+ * 选项数据源 如不传则默认为单个复选框
14
16
  */
15
17
  data: {
16
- type: Array,
17
- required: true
18
- } as any,
18
+ type: Array as PropType<Record<string, any>[] | string[] | number[]>,
19
+ default: undefined
20
+ },
19
21
  /**
20
22
  * 选项默认配置
21
23
  */
@@ -10,6 +10,9 @@ export type Props = ExtractPropTypes<typeof componentProps>
10
10
  * emits类型
11
11
  */
12
12
  export type Emits = {
13
- // 更新value值
14
- (e: 'update:modelValue', value: string | number | (string | number)[]): void
13
+ /** 更新value值 */
14
+ (
15
+ e: 'update:modelValue',
16
+ value: string | number | boolean | (string | number)[]
17
+ ): void
15
18
  }