@minto-ai/mini-ui 1.0.1 → 1.0.102
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/icon/index.d.ts +80 -0
- package/dist/icon/src/icon.d.ts +34 -0
- package/dist/icon/src/icon.vue.d.ts +42 -0
- package/dist/image/index.d.ts +104 -0
- package/dist/image/src/image.d.ts +34 -0
- package/dist/image/src/image.vue.d.ts +66 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.es.js +216 -8
- package/dist/loading/index.d.ts +3 -3
- package/dist/loading/src/loading.vue.d.ts +1 -1
- package/dist/style.css +1035 -7
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare const MtIcon: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
3
|
+
readonly size: {
|
|
4
|
+
readonly type: import('vue').PropType<number | string>;
|
|
5
|
+
readonly validator: (value: number | string) => value is number | "inherit";
|
|
6
|
+
readonly default: "inherit";
|
|
7
|
+
};
|
|
8
|
+
readonly color: {
|
|
9
|
+
readonly type: StringConstructor;
|
|
10
|
+
readonly default: "inherit";
|
|
11
|
+
};
|
|
12
|
+
readonly name: {
|
|
13
|
+
readonly type: StringConstructor;
|
|
14
|
+
readonly required: true;
|
|
15
|
+
};
|
|
16
|
+
readonly rotate: {
|
|
17
|
+
readonly type: NumberConstructor;
|
|
18
|
+
readonly default: 0;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
21
|
+
readonly size: string | number;
|
|
22
|
+
readonly color: string;
|
|
23
|
+
readonly rotate: number;
|
|
24
|
+
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLElement, import('vue').ComponentProvideOptions, {
|
|
25
|
+
P: {};
|
|
26
|
+
B: {};
|
|
27
|
+
D: {};
|
|
28
|
+
C: {};
|
|
29
|
+
M: {};
|
|
30
|
+
Defaults: {};
|
|
31
|
+
}, Readonly<import('vue').ExtractPropTypes<{
|
|
32
|
+
readonly size: {
|
|
33
|
+
readonly type: import('vue').PropType<number | string>;
|
|
34
|
+
readonly validator: (value: number | string) => value is number | "inherit";
|
|
35
|
+
readonly default: "inherit";
|
|
36
|
+
};
|
|
37
|
+
readonly color: {
|
|
38
|
+
readonly type: StringConstructor;
|
|
39
|
+
readonly default: "inherit";
|
|
40
|
+
};
|
|
41
|
+
readonly name: {
|
|
42
|
+
readonly type: StringConstructor;
|
|
43
|
+
readonly required: true;
|
|
44
|
+
};
|
|
45
|
+
readonly rotate: {
|
|
46
|
+
readonly type: NumberConstructor;
|
|
47
|
+
readonly default: 0;
|
|
48
|
+
};
|
|
49
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, {
|
|
50
|
+
readonly size: string | number;
|
|
51
|
+
readonly color: string;
|
|
52
|
+
readonly rotate: number;
|
|
53
|
+
}>;
|
|
54
|
+
__isFragment?: never;
|
|
55
|
+
__isTeleport?: never;
|
|
56
|
+
__isSuspense?: never;
|
|
57
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
|
|
58
|
+
readonly size: {
|
|
59
|
+
readonly type: import('vue').PropType<number | string>;
|
|
60
|
+
readonly validator: (value: number | string) => value is number | "inherit";
|
|
61
|
+
readonly default: "inherit";
|
|
62
|
+
};
|
|
63
|
+
readonly color: {
|
|
64
|
+
readonly type: StringConstructor;
|
|
65
|
+
readonly default: "inherit";
|
|
66
|
+
};
|
|
67
|
+
readonly name: {
|
|
68
|
+
readonly type: StringConstructor;
|
|
69
|
+
readonly required: true;
|
|
70
|
+
};
|
|
71
|
+
readonly rotate: {
|
|
72
|
+
readonly type: NumberConstructor;
|
|
73
|
+
readonly default: 0;
|
|
74
|
+
};
|
|
75
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
76
|
+
readonly size: string | number;
|
|
77
|
+
readonly color: string;
|
|
78
|
+
readonly rotate: number;
|
|
79
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & import('vue').Plugin;
|
|
80
|
+
export default MtIcon;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
declare const iconProps: {
|
|
3
|
+
/**
|
|
4
|
+
* 图标大小
|
|
5
|
+
*/
|
|
6
|
+
readonly size: {
|
|
7
|
+
readonly type: PropType<number | string>;
|
|
8
|
+
readonly validator: (value: number | string) => value is number | "inherit";
|
|
9
|
+
readonly default: "inherit";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 图标颜色
|
|
13
|
+
*/
|
|
14
|
+
readonly color: {
|
|
15
|
+
readonly type: StringConstructor;
|
|
16
|
+
readonly default: "inherit";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 图标名称
|
|
20
|
+
*/
|
|
21
|
+
readonly name: {
|
|
22
|
+
readonly type: StringConstructor;
|
|
23
|
+
readonly required: true;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 图标旋转角度
|
|
27
|
+
*/
|
|
28
|
+
readonly rotate: {
|
|
29
|
+
readonly type: NumberConstructor;
|
|
30
|
+
readonly default: 0;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type IconProps = ExtractPropTypes<typeof iconProps>;
|
|
34
|
+
export { iconProps };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
readonly size: {
|
|
3
|
+
readonly type: import('vue').PropType<number | string>;
|
|
4
|
+
readonly validator: (value: number | string) => value is number | "inherit";
|
|
5
|
+
readonly default: "inherit";
|
|
6
|
+
};
|
|
7
|
+
readonly color: {
|
|
8
|
+
readonly type: StringConstructor;
|
|
9
|
+
readonly default: "inherit";
|
|
10
|
+
};
|
|
11
|
+
readonly name: {
|
|
12
|
+
readonly type: StringConstructor;
|
|
13
|
+
readonly required: true;
|
|
14
|
+
};
|
|
15
|
+
readonly rotate: {
|
|
16
|
+
readonly type: NumberConstructor;
|
|
17
|
+
readonly default: 0;
|
|
18
|
+
};
|
|
19
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
20
|
+
readonly size: {
|
|
21
|
+
readonly type: import('vue').PropType<number | string>;
|
|
22
|
+
readonly validator: (value: number | string) => value is number | "inherit";
|
|
23
|
+
readonly default: "inherit";
|
|
24
|
+
};
|
|
25
|
+
readonly color: {
|
|
26
|
+
readonly type: StringConstructor;
|
|
27
|
+
readonly default: "inherit";
|
|
28
|
+
};
|
|
29
|
+
readonly name: {
|
|
30
|
+
readonly type: StringConstructor;
|
|
31
|
+
readonly required: true;
|
|
32
|
+
};
|
|
33
|
+
readonly rotate: {
|
|
34
|
+
readonly type: NumberConstructor;
|
|
35
|
+
readonly default: 0;
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {
|
|
38
|
+
readonly size: string | number;
|
|
39
|
+
readonly color: string;
|
|
40
|
+
readonly rotate: number;
|
|
41
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLElement>;
|
|
42
|
+
export default _default;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export declare const MtImage: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
3
|
+
readonly src: {
|
|
4
|
+
readonly type: StringConstructor;
|
|
5
|
+
readonly default: "";
|
|
6
|
+
};
|
|
7
|
+
readonly width: {
|
|
8
|
+
readonly type: import('vue').PropType<number | string>;
|
|
9
|
+
readonly default: "100%";
|
|
10
|
+
};
|
|
11
|
+
readonly height: {
|
|
12
|
+
readonly type: import('vue').PropType<number | string>;
|
|
13
|
+
readonly default: "100%";
|
|
14
|
+
};
|
|
15
|
+
readonly fit: {
|
|
16
|
+
readonly type: import('vue').PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
17
|
+
readonly validator: (value: string) => boolean;
|
|
18
|
+
readonly default: "cover";
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{
|
|
21
|
+
onLoad?: (() => any) | undefined;
|
|
22
|
+
onError?: (() => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
|
+
load: () => any;
|
|
25
|
+
error: () => any;
|
|
26
|
+
}, import('vue').PublicProps, {
|
|
27
|
+
readonly src: string;
|
|
28
|
+
readonly width: string | number;
|
|
29
|
+
readonly height: string | number;
|
|
30
|
+
readonly fit: "fill" | "contain" | "cover" | "none" | "scale-down";
|
|
31
|
+
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
32
|
+
P: {};
|
|
33
|
+
B: {};
|
|
34
|
+
D: {};
|
|
35
|
+
C: {};
|
|
36
|
+
M: {};
|
|
37
|
+
Defaults: {};
|
|
38
|
+
}, Readonly<import('vue').ExtractPropTypes<{
|
|
39
|
+
readonly src: {
|
|
40
|
+
readonly type: StringConstructor;
|
|
41
|
+
readonly default: "";
|
|
42
|
+
};
|
|
43
|
+
readonly width: {
|
|
44
|
+
readonly type: import('vue').PropType<number | string>;
|
|
45
|
+
readonly default: "100%";
|
|
46
|
+
};
|
|
47
|
+
readonly height: {
|
|
48
|
+
readonly type: import('vue').PropType<number | string>;
|
|
49
|
+
readonly default: "100%";
|
|
50
|
+
};
|
|
51
|
+
readonly fit: {
|
|
52
|
+
readonly type: import('vue').PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
53
|
+
readonly validator: (value: string) => boolean;
|
|
54
|
+
readonly default: "cover";
|
|
55
|
+
};
|
|
56
|
+
}>> & Readonly<{
|
|
57
|
+
onLoad?: (() => any) | undefined;
|
|
58
|
+
onError?: (() => any) | undefined;
|
|
59
|
+
}>, {}, {}, {}, {}, {
|
|
60
|
+
readonly src: string;
|
|
61
|
+
readonly width: string | number;
|
|
62
|
+
readonly height: string | number;
|
|
63
|
+
readonly fit: "fill" | "contain" | "cover" | "none" | "scale-down";
|
|
64
|
+
}>;
|
|
65
|
+
__isFragment?: never;
|
|
66
|
+
__isTeleport?: never;
|
|
67
|
+
__isSuspense?: never;
|
|
68
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
|
|
69
|
+
readonly src: {
|
|
70
|
+
readonly type: StringConstructor;
|
|
71
|
+
readonly default: "";
|
|
72
|
+
};
|
|
73
|
+
readonly width: {
|
|
74
|
+
readonly type: import('vue').PropType<number | string>;
|
|
75
|
+
readonly default: "100%";
|
|
76
|
+
};
|
|
77
|
+
readonly height: {
|
|
78
|
+
readonly type: import('vue').PropType<number | string>;
|
|
79
|
+
readonly default: "100%";
|
|
80
|
+
};
|
|
81
|
+
readonly fit: {
|
|
82
|
+
readonly type: import('vue').PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
83
|
+
readonly validator: (value: string) => boolean;
|
|
84
|
+
readonly default: "cover";
|
|
85
|
+
};
|
|
86
|
+
}>> & Readonly<{
|
|
87
|
+
onLoad?: (() => any) | undefined;
|
|
88
|
+
onError?: (() => any) | undefined;
|
|
89
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
90
|
+
load: () => any;
|
|
91
|
+
error: () => any;
|
|
92
|
+
}, string, {
|
|
93
|
+
readonly src: string;
|
|
94
|
+
readonly width: string | number;
|
|
95
|
+
readonly height: string | number;
|
|
96
|
+
readonly fit: "fill" | "contain" | "cover" | "none" | "scale-down";
|
|
97
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
98
|
+
$slots: Readonly<{
|
|
99
|
+
error: any;
|
|
100
|
+
}> & {
|
|
101
|
+
error: any;
|
|
102
|
+
};
|
|
103
|
+
}) & import('vue').Plugin;
|
|
104
|
+
export default MtImage;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
declare const imageProps: {
|
|
3
|
+
/**
|
|
4
|
+
* 图片地址
|
|
5
|
+
*/
|
|
6
|
+
readonly src: {
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly default: "";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 图片的宽度(基于375px设计稿)
|
|
12
|
+
*/
|
|
13
|
+
readonly width: {
|
|
14
|
+
readonly type: PropType<number | string>;
|
|
15
|
+
readonly default: "100%";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 图片的高度(基于375px设计稿)
|
|
19
|
+
*/
|
|
20
|
+
readonly height: {
|
|
21
|
+
readonly type: PropType<number | string>;
|
|
22
|
+
readonly default: "100%";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* 图片缩放模式
|
|
26
|
+
*/
|
|
27
|
+
readonly fit: {
|
|
28
|
+
readonly type: PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
29
|
+
readonly validator: (value: string) => boolean;
|
|
30
|
+
readonly default: "cover";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type ImageProps = ExtractPropTypes<typeof imageProps>;
|
|
34
|
+
export { imageProps };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
attrs: Partial<{}>;
|
|
3
|
+
slots: Readonly<{
|
|
4
|
+
error: any;
|
|
5
|
+
}> & {
|
|
6
|
+
error: any;
|
|
7
|
+
};
|
|
8
|
+
refs: {};
|
|
9
|
+
rootEl: HTMLDivElement;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
13
|
+
readonly src: {
|
|
14
|
+
readonly type: StringConstructor;
|
|
15
|
+
readonly default: "";
|
|
16
|
+
};
|
|
17
|
+
readonly width: {
|
|
18
|
+
readonly type: import('vue').PropType<number | string>;
|
|
19
|
+
readonly default: "100%";
|
|
20
|
+
};
|
|
21
|
+
readonly height: {
|
|
22
|
+
readonly type: import('vue').PropType<number | string>;
|
|
23
|
+
readonly default: "100%";
|
|
24
|
+
};
|
|
25
|
+
readonly fit: {
|
|
26
|
+
readonly type: import('vue').PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
27
|
+
readonly validator: (value: string) => boolean;
|
|
28
|
+
readonly default: "cover";
|
|
29
|
+
};
|
|
30
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
31
|
+
load: () => any;
|
|
32
|
+
error: () => any;
|
|
33
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
|
+
readonly src: {
|
|
35
|
+
readonly type: StringConstructor;
|
|
36
|
+
readonly default: "";
|
|
37
|
+
};
|
|
38
|
+
readonly width: {
|
|
39
|
+
readonly type: import('vue').PropType<number | string>;
|
|
40
|
+
readonly default: "100%";
|
|
41
|
+
};
|
|
42
|
+
readonly height: {
|
|
43
|
+
readonly type: import('vue').PropType<number | string>;
|
|
44
|
+
readonly default: "100%";
|
|
45
|
+
};
|
|
46
|
+
readonly fit: {
|
|
47
|
+
readonly type: import('vue').PropType<"fill" | "contain" | "cover" | "none" | "scale-down">;
|
|
48
|
+
readonly validator: (value: string) => boolean;
|
|
49
|
+
readonly default: "cover";
|
|
50
|
+
};
|
|
51
|
+
}>> & Readonly<{
|
|
52
|
+
onLoad?: (() => any) | undefined;
|
|
53
|
+
onError?: (() => any) | undefined;
|
|
54
|
+
}>, {
|
|
55
|
+
readonly src: string;
|
|
56
|
+
readonly width: string | number;
|
|
57
|
+
readonly height: string | number;
|
|
58
|
+
readonly fit: "fill" | "contain" | "cover" | "none" | "scale-down";
|
|
59
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
60
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
61
|
+
export default _default;
|
|
62
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
63
|
+
new (): {
|
|
64
|
+
$slots: S;
|
|
65
|
+
};
|
|
66
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
+
import { MtIcon } from './icon';
|
|
3
|
+
import { MtImage } from './image';
|
|
2
4
|
import { MtLoading } from './loading';
|
|
3
5
|
declare const _default: {
|
|
4
6
|
install: (app: App) => void;
|
|
5
7
|
};
|
|
6
8
|
export default _default;
|
|
7
|
-
export { MtLoading, };
|
|
9
|
+
export { MtIcon, MtImage, MtLoading, };
|
|
8
10
|
declare module 'vue' {
|
|
9
11
|
interface GlobalComponents {
|
|
12
|
+
MtImage: typeof MtImage;
|
|
10
13
|
MtLoading: typeof MtLoading;
|
|
14
|
+
MtIcon: typeof MtIcon;
|
|
11
15
|
}
|
|
12
16
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNumber, isString, isArray, multiply, divide, beParsedAsNumber, checkEmpty } from "@minto-ai/tools";
|
|
2
|
-
import { defineComponent, computed, createElementBlock, openBlock,
|
|
2
|
+
import { defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, createCommentVNode, renderSlot, createTextVNode, toDisplayString, ref, watch, onMounted, createVNode, unref, Fragment } from "vue";
|
|
3
3
|
const VALID_CSS_KEYWORD_REGEX = /^(?:fit-content|min-content|max-content|auto|inherit|initial|unset)$/;
|
|
4
4
|
const NUMERIC_STRING_REGEX = /^\d+(?:\.\d+)?$/;
|
|
5
5
|
const PIXEL_UNIT_STRING_REGEX = /^\d+(?:\.\d+)?px$/;
|
|
@@ -48,6 +48,81 @@ function withInstall(component) {
|
|
|
48
48
|
};
|
|
49
49
|
return component;
|
|
50
50
|
}
|
|
51
|
+
const iconProps = {
|
|
52
|
+
/**
|
|
53
|
+
* 图标大小
|
|
54
|
+
*/
|
|
55
|
+
size: {
|
|
56
|
+
type: [Number, String],
|
|
57
|
+
validator: (value) => {
|
|
58
|
+
return isNumber(value) || isString(value) && value === "inherit";
|
|
59
|
+
},
|
|
60
|
+
default: "inherit"
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* 图标颜色
|
|
64
|
+
*/
|
|
65
|
+
color: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "inherit"
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* 图标名称
|
|
71
|
+
*/
|
|
72
|
+
name: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* 图标旋转角度
|
|
78
|
+
*/
|
|
79
|
+
rotate: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 0
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
85
|
+
...{
|
|
86
|
+
name: "MtIcon"
|
|
87
|
+
},
|
|
88
|
+
__name: "icon",
|
|
89
|
+
props: iconProps,
|
|
90
|
+
setup(__props) {
|
|
91
|
+
const props = __props;
|
|
92
|
+
const iconClasses = computed(() => {
|
|
93
|
+
const classes = [];
|
|
94
|
+
classes.push("mt-icon");
|
|
95
|
+
if (props.name) {
|
|
96
|
+
classes.push(props.name);
|
|
97
|
+
}
|
|
98
|
+
return classes;
|
|
99
|
+
});
|
|
100
|
+
const iconStyles = computed(() => {
|
|
101
|
+
const styles = {};
|
|
102
|
+
if (!checkEmpty(props.color)) {
|
|
103
|
+
styles["--mt-icon-color"] = props.color;
|
|
104
|
+
}
|
|
105
|
+
if (!checkEmpty(props.size)) {
|
|
106
|
+
if (typeof props.size === "number") {
|
|
107
|
+
styles["--mt-icon-font-size"] = `${props.size}px`;
|
|
108
|
+
} else {
|
|
109
|
+
styles["--mt-icon-font-size"] = props.size;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
Object.assign(styles, {
|
|
113
|
+
transform: `rotate(${props.rotate}deg)`
|
|
114
|
+
});
|
|
115
|
+
return styles;
|
|
116
|
+
});
|
|
117
|
+
return (_ctx, _cache) => {
|
|
118
|
+
return openBlock(), createElementBlock("i", {
|
|
119
|
+
class: normalizeClass(iconClasses.value),
|
|
120
|
+
style: normalizeStyle(iconStyles.value)
|
|
121
|
+
}, null, 6);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const MtIcon = withInstall(_sfc_main$2);
|
|
51
126
|
const loadingProps = {
|
|
52
127
|
/**
|
|
53
128
|
* 加载动画的类型
|
|
@@ -74,12 +149,12 @@ const loadingProps = {
|
|
|
74
149
|
default: ""
|
|
75
150
|
}
|
|
76
151
|
};
|
|
77
|
-
const _hoisted_1 = { class: "mt-loading" };
|
|
78
|
-
const _hoisted_2 = {
|
|
152
|
+
const _hoisted_1$1 = { class: "mt-loading" };
|
|
153
|
+
const _hoisted_2$1 = {
|
|
79
154
|
key: 0,
|
|
80
155
|
class: "mt-loading__text"
|
|
81
156
|
};
|
|
82
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
157
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
83
158
|
...{
|
|
84
159
|
name: "MtLoading"
|
|
85
160
|
},
|
|
@@ -101,12 +176,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
101
176
|
return styles;
|
|
102
177
|
});
|
|
103
178
|
return (_ctx, _cache) => {
|
|
104
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
179
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
105
180
|
createElementVNode("div", {
|
|
106
181
|
class: normalizeClass(iconClass.value),
|
|
107
182
|
style: normalizeStyle(iconStyles.value)
|
|
108
183
|
}, null, 6),
|
|
109
|
-
props.text || _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
184
|
+
props.text || _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
110
185
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
111
186
|
createTextVNode(toDisplayString(props.text), 1)
|
|
112
187
|
])
|
|
@@ -115,9 +190,140 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
115
190
|
};
|
|
116
191
|
}
|
|
117
192
|
});
|
|
118
|
-
const MtLoading = withInstall(_sfc_main);
|
|
193
|
+
const MtLoading = withInstall(_sfc_main$1);
|
|
194
|
+
const imageProps = {
|
|
195
|
+
/**
|
|
196
|
+
* 图片地址
|
|
197
|
+
*/
|
|
198
|
+
src: {
|
|
199
|
+
type: String,
|
|
200
|
+
default: ""
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* 图片的宽度(基于375px设计稿)
|
|
204
|
+
*/
|
|
205
|
+
width: {
|
|
206
|
+
type: [Number, String],
|
|
207
|
+
default: "100%"
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* 图片的高度(基于375px设计稿)
|
|
211
|
+
*/
|
|
212
|
+
height: {
|
|
213
|
+
type: [Number, String],
|
|
214
|
+
default: "100%"
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* 图片缩放模式
|
|
218
|
+
*/
|
|
219
|
+
fit: {
|
|
220
|
+
type: String,
|
|
221
|
+
validator: (value) => {
|
|
222
|
+
return ["fill", "contain", "cover", "none", "scale-down"].includes(value);
|
|
223
|
+
},
|
|
224
|
+
default: "cover"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
const _hoisted_1 = {
|
|
228
|
+
key: 0,
|
|
229
|
+
class: "mt-image__error"
|
|
230
|
+
};
|
|
231
|
+
const _hoisted_2 = { class: "mt-image__error-icon" };
|
|
232
|
+
const _hoisted_3 = ["src"];
|
|
233
|
+
const _hoisted_4 = {
|
|
234
|
+
key: 1,
|
|
235
|
+
class: "mt-image__loading"
|
|
236
|
+
};
|
|
237
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
238
|
+
...{
|
|
239
|
+
name: "MtImage"
|
|
240
|
+
},
|
|
241
|
+
__name: "image",
|
|
242
|
+
props: imageProps,
|
|
243
|
+
emits: ["load", "error"],
|
|
244
|
+
setup(__props, { emit: __emit }) {
|
|
245
|
+
const props = __props;
|
|
246
|
+
const emits = __emit;
|
|
247
|
+
const imageClasses = computed(() => {
|
|
248
|
+
const classes = ["mt-image"];
|
|
249
|
+
return classes;
|
|
250
|
+
});
|
|
251
|
+
const imageStyles = computed(() => {
|
|
252
|
+
const styles = {};
|
|
253
|
+
if (!checkEmpty(props.width)) {
|
|
254
|
+
styles["--mt-image-width"] = convertValueToViewportWidth(props.width);
|
|
255
|
+
}
|
|
256
|
+
if (!checkEmpty(props.height)) {
|
|
257
|
+
styles["--mt-image-height"] = convertValueToViewportWidth(props.height);
|
|
258
|
+
}
|
|
259
|
+
return styles;
|
|
260
|
+
});
|
|
261
|
+
const hasLoadError = ref(false);
|
|
262
|
+
const isLoading = ref(true);
|
|
263
|
+
const imageSrc = ref("");
|
|
264
|
+
function loadImage() {
|
|
265
|
+
isLoading.value = true;
|
|
266
|
+
hasLoadError.value = false;
|
|
267
|
+
imageSrc.value = props.src;
|
|
268
|
+
}
|
|
269
|
+
function handleLoad() {
|
|
270
|
+
isLoading.value = false;
|
|
271
|
+
hasLoadError.value = false;
|
|
272
|
+
emits("load");
|
|
273
|
+
}
|
|
274
|
+
function handleError() {
|
|
275
|
+
isLoading.value = false;
|
|
276
|
+
hasLoadError.value = true;
|
|
277
|
+
emits("error");
|
|
278
|
+
}
|
|
279
|
+
watch(
|
|
280
|
+
() => props.src,
|
|
281
|
+
() => {
|
|
282
|
+
loadImage();
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
onMounted(() => {
|
|
286
|
+
loadImage();
|
|
287
|
+
});
|
|
288
|
+
return (_ctx, _cache) => {
|
|
289
|
+
return openBlock(), createElementBlock("div", {
|
|
290
|
+
class: normalizeClass(imageClasses.value),
|
|
291
|
+
style: normalizeStyle(imageStyles.value)
|
|
292
|
+
}, [
|
|
293
|
+
hasLoadError.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
294
|
+
renderSlot(_ctx.$slots, "error", {}, () => [
|
|
295
|
+
createElementVNode("div", _hoisted_2, [
|
|
296
|
+
createVNode(unref(MtIcon), {
|
|
297
|
+
name: "icon-image-error",
|
|
298
|
+
size: 50,
|
|
299
|
+
color: "#ccc"
|
|
300
|
+
})
|
|
301
|
+
])
|
|
302
|
+
])
|
|
303
|
+
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
304
|
+
imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", {
|
|
305
|
+
key: 0,
|
|
306
|
+
src: imageSrc.value,
|
|
307
|
+
class: "mt-image__img",
|
|
308
|
+
style: normalizeStyle({
|
|
309
|
+
objectFit: _ctx.fit
|
|
310
|
+
}),
|
|
311
|
+
onLoad: handleLoad,
|
|
312
|
+
onError: handleError
|
|
313
|
+
}, null, 44, _hoisted_3)) : createCommentVNode("", true),
|
|
314
|
+
isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
315
|
+
createVNode(unref(MtLoading), { size: 38 })
|
|
316
|
+
])) : createCommentVNode("", true)
|
|
317
|
+
], 64))
|
|
318
|
+
], 6);
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
const MtImage = withInstall(_sfc_main);
|
|
119
323
|
const components = [
|
|
120
|
-
|
|
324
|
+
MtImage,
|
|
325
|
+
MtLoading,
|
|
326
|
+
MtIcon
|
|
121
327
|
];
|
|
122
328
|
const index = {
|
|
123
329
|
install: (app) => {
|
|
@@ -125,6 +331,8 @@ const index = {
|
|
|
125
331
|
}
|
|
126
332
|
};
|
|
127
333
|
export {
|
|
334
|
+
MtIcon,
|
|
335
|
+
MtImage,
|
|
128
336
|
MtLoading,
|
|
129
337
|
index as default
|
|
130
338
|
};
|
package/dist/loading/index.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare const MtLoading: {
|
|
|
14
14
|
readonly default: "";
|
|
15
15
|
};
|
|
16
16
|
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
17
|
-
readonly type: "spinner";
|
|
18
17
|
readonly size: number;
|
|
18
|
+
readonly type: "spinner";
|
|
19
19
|
readonly text: string;
|
|
20
20
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
21
21
|
P: {};
|
|
@@ -39,8 +39,8 @@ export declare const MtLoading: {
|
|
|
39
39
|
readonly default: "";
|
|
40
40
|
};
|
|
41
41
|
}>> & Readonly<{}>, {}, {}, {}, {}, {
|
|
42
|
-
readonly type: "spinner";
|
|
43
42
|
readonly size: number;
|
|
43
|
+
readonly type: "spinner";
|
|
44
44
|
readonly text: string;
|
|
45
45
|
}>;
|
|
46
46
|
__isFragment?: never;
|
|
@@ -61,8 +61,8 @@ export declare const MtLoading: {
|
|
|
61
61
|
readonly default: "";
|
|
62
62
|
};
|
|
63
63
|
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
64
|
-
readonly type: "spinner";
|
|
65
64
|
readonly size: number;
|
|
65
|
+
readonly type: "spinner";
|
|
66
66
|
readonly text: string;
|
|
67
67
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
68
68
|
$slots: {
|
|
@@ -36,8 +36,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
36
36
|
readonly default: "";
|
|
37
37
|
};
|
|
38
38
|
}>> & Readonly<{}>, {
|
|
39
|
-
readonly type: "spinner";
|
|
40
39
|
readonly size: number;
|
|
40
|
+
readonly type: "spinner";
|
|
41
41
|
readonly text: string;
|
|
42
42
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
43
43
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|