@wyfex/ivue 0.10.0 → 0.12.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/dist/index.es.js +6 -11
- package/dist/index.umd.cjs +6 -11
- package/dist/ivue.css +1 -1
- package/dist/types/UseElButton/hook.d.ts +3 -7
- package/dist/types/UseElButton/index.vue.d.ts +2 -2
- package/dist/types/UseElButton/types.d.ts +1 -1
- package/dist/types/UseElSwitch/index.vue.d.ts +51 -0
- package/dist/types/UseElSwitch/props.d.ts +23 -0
- package/dist/types/UseElTable/hooks/useElTable.d.ts +3 -8
- package/dist/types/UseElTable/hooks/useTableColumnMinWidth.d.ts +5 -0
- package/dist/types/UseElTable/hooks/useTableHeightAdaptive.d.ts +4 -0
- package/dist/types/UseElTable/utils.d.ts +1 -3
- package/dist/types/UseSvgIcon/index.vue.d.ts +54 -0
- package/dist/types/UseSvgIcon/props.d.ts +27 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/UseElButton/types.ts +4 -4
- package/src/components/UseElSwitch/props.ts +40 -0
- package/src/components/UseElTable/props.ts +2 -0
- package/src/components/UseSvgIcon/props.ts +59 -0
- package/src/types/index.ts +1 -1
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { ComputedRef
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
2
|
import { Emits, Props } from './types';
|
|
3
|
-
export declare const useElButton: (
|
|
4
|
-
mergedProps: ComputedRef<Props>;
|
|
5
|
-
emits: Emits;
|
|
6
|
-
attrs: Attrs;
|
|
7
|
-
}) => {
|
|
3
|
+
export declare const useElButton: (mergedProps: ComputedRef<Props>, emits: Emits) => {
|
|
8
4
|
isConfirm: ComputedRef<boolean>;
|
|
9
|
-
|
|
5
|
+
handleElButtonClick: (event: Event) => void;
|
|
10
6
|
};
|
|
@@ -13,7 +13,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
13
13
|
default: () => {};
|
|
14
14
|
};
|
|
15
15
|
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
16
|
-
|
|
16
|
+
click: (value?: string | number | Record<string, unknown> | undefined) => any;
|
|
17
17
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
18
18
|
btnText: {
|
|
19
19
|
type: StringConstructor;
|
|
@@ -29,7 +29,7 @@ declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
29
29
|
default: () => {};
|
|
30
30
|
};
|
|
31
31
|
}>> & Readonly<{
|
|
32
|
-
|
|
32
|
+
onClick?: ((value?: string | number | Record<string, unknown> | undefined) => any) | undefined;
|
|
33
33
|
}>, {
|
|
34
34
|
type: string;
|
|
35
35
|
extConfig: import('./types').ExtConfig;
|
|
@@ -2,7 +2,7 @@ import { ExtractPropTypes } from 'vue';
|
|
|
2
2
|
import { default as componentProps } from './props';
|
|
3
3
|
export type Props = ExtractPropTypes<typeof componentProps>;
|
|
4
4
|
export interface Emits {
|
|
5
|
-
(e: '
|
|
5
|
+
(e: 'click', value?: string | number | Record<string, unknown>): void;
|
|
6
6
|
}
|
|
7
7
|
export interface ExtConfig {
|
|
8
8
|
debounce?: {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
activeValue: {
|
|
3
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
4
|
+
default: number;
|
|
5
|
+
};
|
|
6
|
+
inactiveValue: {
|
|
7
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
8
|
+
default: number;
|
|
9
|
+
};
|
|
10
|
+
activeText: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
inactiveText: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
inlinePrompt: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
23
|
+
activeValue: {
|
|
24
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
27
|
+
inactiveValue: {
|
|
28
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
activeText: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
inactiveText: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
inlinePrompt: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
}>> & Readonly<{}>, {
|
|
44
|
+
activeValue: string | number | boolean;
|
|
45
|
+
inactiveValue: string | number | boolean;
|
|
46
|
+
activeText: string;
|
|
47
|
+
inactiveText: string;
|
|
48
|
+
inlinePrompt: boolean;
|
|
49
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
activeValue: {
|
|
3
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
4
|
+
default: number;
|
|
5
|
+
};
|
|
6
|
+
inactiveValue: {
|
|
7
|
+
type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
8
|
+
default: number;
|
|
9
|
+
};
|
|
10
|
+
activeText: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
inactiveText: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
inlinePrompt: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { ComputedRef
|
|
2
|
-
import { TableInstance } from 'element-plus';
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
3
2
|
import { Emits, Props, TableColumn } from '../types';
|
|
4
3
|
import { GlobalConfig } from '../../../../types';
|
|
5
|
-
export declare const useElTable: ({ mergedProps, emits, globalConfig
|
|
4
|
+
export declare const useElTable: ({ mergedProps, emits, globalConfig }: {
|
|
6
5
|
mergedProps: ComputedRef<Props>;
|
|
7
6
|
emits: Emits;
|
|
8
7
|
globalConfig: ComputedRef<GlobalConfig>;
|
|
9
|
-
rootRef: Ref<HTMLDivElement | null>;
|
|
10
|
-
tableWrapperRef: Ref<HTMLDivElement | null>;
|
|
11
|
-
etRef: Ref<TableInstance | null>;
|
|
12
8
|
}) => {
|
|
13
|
-
tableRealHeight: Ref<string, string>;
|
|
14
9
|
processHeaderCellClassName: ({ column }: any) => "" | "hideAllSelection";
|
|
15
10
|
tableColumnsComputed: ComputedRef<TableColumn[]>;
|
|
16
|
-
processDictData: (item: TableColumn) => Record<string,
|
|
11
|
+
processDictData: (item: TableColumn) => Record<string, any>[];
|
|
17
12
|
validateRequired: (row: Record<string, any>) => boolean;
|
|
18
13
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { TableInstance } from 'element-plus';
|
|
3
|
+
import { Props } from '../types';
|
|
4
|
+
import { GlobalConfig } from '../../../../types';
|
|
5
|
+
export declare const useTableColumnMinWidth: (etRef: Ref<TableInstance | null>, mergedProps: ComputedRef<Props>, globalConfig: ComputedRef<GlobalConfig>) => void;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TableColumn, Props } from './types';
|
|
1
|
+
import { TableColumn } from './types';
|
|
3
2
|
import { GlobalConfig } from '../../../types';
|
|
4
3
|
export declare const processFieldProp: (row: Record<string, unknown>, item: TableColumn, globalConfig: GlobalConfig) => {
|
|
5
4
|
class: string;
|
|
6
5
|
style: string;
|
|
7
6
|
data: unknown;
|
|
8
7
|
};
|
|
9
|
-
export declare const handleMinWidth: (columns: TableColumn[], data: any, mergedProps: ComputedRef<Props>, globalConfig: GlobalConfig) => void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
name: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: boolean;
|
|
5
|
+
};
|
|
6
|
+
size: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
default: number;
|
|
9
|
+
validator(val: any): any;
|
|
10
|
+
};
|
|
11
|
+
color: {
|
|
12
|
+
type: import('vue').PropType<string | Record<string, any>[]>;
|
|
13
|
+
validator(val: any): any;
|
|
14
|
+
};
|
|
15
|
+
margin: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
};
|
|
18
|
+
clickable: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
hoverClass: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
26
|
+
name: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
required: boolean;
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
32
|
+
default: number;
|
|
33
|
+
validator(val: any): any;
|
|
34
|
+
};
|
|
35
|
+
color: {
|
|
36
|
+
type: import('vue').PropType<string | Record<string, any>[]>;
|
|
37
|
+
validator(val: any): any;
|
|
38
|
+
};
|
|
39
|
+
margin: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
};
|
|
42
|
+
clickable: {
|
|
43
|
+
type: BooleanConstructor;
|
|
44
|
+
default: boolean;
|
|
45
|
+
};
|
|
46
|
+
hoverClass: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
};
|
|
49
|
+
}>> & Readonly<{}>, {
|
|
50
|
+
size: string | number;
|
|
51
|
+
clickable: boolean;
|
|
52
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
53
|
+
declare const _default: typeof __VLS_export;
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
name: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
required: boolean;
|
|
6
|
+
};
|
|
7
|
+
size: {
|
|
8
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
9
|
+
default: number;
|
|
10
|
+
validator(val: any): any;
|
|
11
|
+
};
|
|
12
|
+
color: {
|
|
13
|
+
type: PropType<string | Record<string, any>[]>;
|
|
14
|
+
validator(val: any): any;
|
|
15
|
+
};
|
|
16
|
+
margin: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
};
|
|
19
|
+
clickable: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
hoverClass: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,5 +6,7 @@ export { default as UseElDialog } from './UseElDialog/index.vue';
|
|
|
6
6
|
export { default as UseElDrawer } from './UseElDrawer/index.vue';
|
|
7
7
|
export { default as UseElInput } from './UseElInput/index.vue';
|
|
8
8
|
export { default as UseElSelect } from './UseElSelect/index.vue';
|
|
9
|
+
export { default as UseElSwitch } from './UseElSwitch/index.vue';
|
|
9
10
|
export { default as UseElTable } from './UseElTable/index.vue';
|
|
10
11
|
export { default as UseRender } from './UseRender/index.vue';
|
|
12
|
+
export { default as UseSvgIcon } from './UseSvgIcon/index.vue';
|
package/package.json
CHANGED
|
@@ -11,9 +11,9 @@ export type Props = ExtractPropTypes<typeof componentProps>
|
|
|
11
11
|
*/
|
|
12
12
|
export interface Emits {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* 点击事件 默认自带防抖
|
|
15
15
|
*/
|
|
16
|
-
(e: '
|
|
16
|
+
(e: 'click', value?: string | number | Record<string, unknown>): void
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -22,7 +22,7 @@ export interface Emits {
|
|
|
22
22
|
export interface ExtConfig {
|
|
23
23
|
/**
|
|
24
24
|
* 防抖配置项
|
|
25
|
-
*
|
|
25
|
+
* 无需防抖将delay设置为0即可
|
|
26
26
|
*/
|
|
27
27
|
debounce?: {
|
|
28
28
|
/**
|
|
@@ -40,7 +40,7 @@ export interface ExtConfig {
|
|
|
40
40
|
confirm?: {
|
|
41
41
|
/**
|
|
42
42
|
* 二次确认数据 显式设置则开启二次确认
|
|
43
|
-
* 可为String、Number、Object、Array,无需传递数据则显式设置为null
|
|
43
|
+
* 可为String、Number、Object、Array,无需传递数据则显式设置为null
|
|
44
44
|
*/
|
|
45
45
|
data?: string | number | Record<string, unknown> | unknown[] | null
|
|
46
46
|
/**
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组件props
|
|
3
|
+
*/
|
|
4
|
+
export default {
|
|
5
|
+
/**
|
|
6
|
+
* switch 状态为 on 时的值
|
|
7
|
+
*/
|
|
8
|
+
activeValue: {
|
|
9
|
+
type: [Number, String, Boolean],
|
|
10
|
+
default: 1
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* switch的状态为 off 时的值
|
|
14
|
+
*/
|
|
15
|
+
inactiveValue: {
|
|
16
|
+
type: [Number, String, Boolean],
|
|
17
|
+
default: 0
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* switch 打开时的文字描述
|
|
21
|
+
*/
|
|
22
|
+
activeText: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '启用'
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* switch 的状态为 off 时的文字描述
|
|
28
|
+
*/
|
|
29
|
+
inactiveText: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '禁用'
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* 无论图标或文本是否显示在点内,只会呈现文本的第一个字符
|
|
35
|
+
*/
|
|
36
|
+
inlinePrompt: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -8,6 +8,8 @@ import type { DictMap, DictProps } from '@/types'
|
|
|
8
8
|
export default {
|
|
9
9
|
/**
|
|
10
10
|
* 表格列 必传
|
|
11
|
+
* 注意:常规场景下列配置为静态值无需响应式;但本组件提供了 minWidth 自动计算功能并会修改列对象,
|
|
12
|
+
* 因此 tableColumns 必须用 ref/reactive 包裹,否则视图无法同步更新宽度。
|
|
11
13
|
*/
|
|
12
14
|
tableColumns: {
|
|
13
15
|
type: Array as PropType<TableColumn[]>,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
import { isArray } from '@wyfex/iutils'
|
|
3
|
+
import { parseUnit, isValidUnit } from '@/utils'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 组件props
|
|
7
|
+
*/
|
|
8
|
+
export default {
|
|
9
|
+
/**
|
|
10
|
+
* 图标名称 必传
|
|
11
|
+
*/
|
|
12
|
+
name: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* 图标大小 默认类型为数字(单位为px);可传带单位的字符串,如:20px、0.2rem
|
|
18
|
+
*/
|
|
19
|
+
size: {
|
|
20
|
+
type: [Number, String],
|
|
21
|
+
default: 28,
|
|
22
|
+
validator(val: any) {
|
|
23
|
+
if (typeof val === 'number') return val
|
|
24
|
+
return isValidUnit(parseUnit(val)) && val
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* 图标颜色 可传String或Array
|
|
29
|
+
* 若传Array,只能传两项 第一项为默认图标颜色 第二项为暗黑模式下图标颜色
|
|
30
|
+
*/
|
|
31
|
+
color: {
|
|
32
|
+
type: [String, Array] as PropType<string | Record<string, any>[]>,
|
|
33
|
+
validator(val: any) {
|
|
34
|
+
if (!isArray(val)) return val
|
|
35
|
+
if (!val.length) throw new Error(`color类型为Array时length不能为0`)
|
|
36
|
+
if (val.length > 2) throw new Error(`color类型为Array时length最大为2`)
|
|
37
|
+
return val
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* 图标的margin外边距 同css的margin规则
|
|
42
|
+
*/
|
|
43
|
+
margin: {
|
|
44
|
+
type: String
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* 是否可点击
|
|
48
|
+
*/
|
|
49
|
+
clickable: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* hover类名
|
|
55
|
+
*/
|
|
56
|
+
hoverClass: {
|
|
57
|
+
type: String
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface DictProps {
|
|
|
48
48
|
*/
|
|
49
49
|
export interface DictMap {
|
|
50
50
|
// 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
|
|
51
|
-
[key: string]: Record<DictProps['label'] | DictProps['value'],
|
|
51
|
+
[key: string]: Record<DictProps['label'] | DictProps['value'], any>[]
|
|
52
52
|
}
|
|
53
53
|
// export interface DictMap {
|
|
54
54
|
// // 形如:{ 性别: [{ label: '男', value: 1 },{ label: '女', value: 2 }] }
|