@teammodlr/ui-kit 1.0.2 → 1.0.4
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/package.json +1 -4
- package/src/__storybook__/argTypes.ts +0 -42
- package/src/__storybook__/createStory.ts +0 -15
- package/src/__storybook__/index.ts +0 -2
- package/src/components/avatar/Avatar.css +0 -69
- package/src/components/avatar/Avatar.vue +0 -102
- package/src/components/avatargroup/AvatarGroup.css +0 -8
- package/src/components/avatargroup/AvatarGroup.vue +0 -32
- package/src/components/breadcrumb/Breadcrumb.css +0 -46
- package/src/components/breadcrumb/Breadcrumb.vue +0 -51
- package/src/components/breadcrumbitem/BreadcrumbItem.vue +0 -66
- package/src/components/breadcrumbitem/index.ts +0 -1
- package/src/components/button/Button.css +0 -378
- package/src/components/button/Button.vue +0 -108
- package/src/components/buttongroup/ButtonGroup.vue +0 -47
- package/src/components/checkbox/Checkbox.css +0 -185
- package/src/components/checkbox/Checkbox.vue +0 -140
- package/src/components/dropdown/Dropdown.css +0 -68
- package/src/components/dropdown/Dropdown.vue +0 -237
- package/src/components/dropdown/DropdownItem.vue +0 -118
- package/src/components/dropdown/DropdownList.vue +0 -20
- package/src/components/dropdown/DropdownWrapper.vue +0 -17
- package/src/components/dropdown/hooks.ts +0 -30
- package/src/components/form/Form.vue +0 -141
- package/src/components/image/Image.vue +0 -71
- package/src/components/index.ts +0 -27
- package/src/components/input/Input.css +0 -173
- package/src/components/input/Input.vue +0 -176
- package/src/components/link/Link.css +0 -147
- package/src/components/link/Link.vue +0 -54
- package/src/components/messageprovider/Message.vue +0 -76
- package/src/components/messageprovider/MessageProvider.css +0 -36
- package/src/components/messageprovider/MessageProvider.vue +0 -142
- package/src/components/messageprovider/types.ts +0 -39
- package/src/components/messageprovider/useMessage.ts +0 -12
- package/src/components/select/Select.css +0 -226
- package/src/components/select/Select.vue +0 -474
- package/src/components/skeleton/Skeleton.css +0 -73
- package/src/components/skeleton/Skeleton.vue +0 -47
- package/src/components/tab/Tab.css +0 -113
- package/src/components/tab/Tab.vue +0 -98
- package/src/components/tab/TabGroup.vue +0 -90
- package/src/components/table/Table.css +0 -45
- package/src/components/table/Table.vue +0 -108
- package/src/components/table/TableBody.vue +0 -13
- package/src/components/table/TableCell.vue +0 -13
- package/src/components/table/TableHead.vue +0 -22
- package/src/components/table/TableHeadRow.vue +0 -15
- package/src/components/table/TableRow.vue +0 -13
- package/src/components/table/types/index.ts +0 -5
- package/src/components/tooltip/Tooltip.css +0 -49
- package/src/components/tooltip/Tooltip.vue +0 -85
- package/src/components/virtualscroll/VirtualScroll.css +0 -13
- package/src/components/virtualscroll/VirtualScroll.vue +0 -61
- package/src/composables/element.ts +0 -13
- package/src/composables/useCachedUid.ts +0 -48
- package/src/composables/useEventListener.ts +0 -14
- package/src/composables/useInput.ts +0 -134
- package/src/composables/useIsServer.ts +0 -7
- package/src/composables/useMount.ts +0 -43
- package/src/composables/usePopper.ts +0 -194
- package/src/create.ts +0 -34
- package/src/css/components.css +0 -14
- package/src/css/index.css +0 -4
- package/src/css/normalize.css +0 -379
- package/src/css/transitions.css +0 -40
- package/src/css/variables.css +0 -80
- package/src/exports/nuxt.js +0 -33
- package/src/exports/nuxt.plugin.js +0 -8
- package/src/index.ts +0 -5
- package/src/install.ts +0 -8
- package/src/shims-vue.d.ts +0 -6
- package/src/types/props.ts +0 -3
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
.m-link {
|
|
2
|
-
--link-color: var(--blue);
|
|
3
|
-
--link-color-hover: var(--blue-hover);
|
|
4
|
-
--link-color-focus: var(--blue-focus);
|
|
5
|
-
--link-color-visited: var(--blue-focus);
|
|
6
|
-
color: var(--link-color);
|
|
7
|
-
text-decoration: none;
|
|
8
|
-
transition: color .3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.m-link--underline {
|
|
12
|
-
text-decoration: underline;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.m-link--block {
|
|
16
|
-
display: flex;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.m-link:visited {
|
|
20
|
-
color: var(--link-color-visited);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.m-link:hover {
|
|
24
|
-
color: var(--link-color-hover);
|
|
25
|
-
text-decoration: underline;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.m-link:focus,
|
|
29
|
-
.m-link:active {
|
|
30
|
-
color: var(--link-color-focus);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.m-link--blue {
|
|
34
|
-
--link-color: var(--blue);
|
|
35
|
-
--link-color-hover: var(--blue-hover);
|
|
36
|
-
--link-color-focus: var(--blue-focus);
|
|
37
|
-
--link-color-visited: var(--blue-focus);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.m-link--blue:visited {
|
|
41
|
-
--link-color: var(--blue);
|
|
42
|
-
--link-color-hover: var(--blue-hover);
|
|
43
|
-
--link-color-focus: var(--blue-focus);
|
|
44
|
-
--link-color-visited: var(--blue-focus);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.m-link--blue:hover {
|
|
48
|
-
--link-color: var(--blue-hover);
|
|
49
|
-
--link-color-hover: var(--blue-hover);
|
|
50
|
-
--link-color-focus: var(--blue-focus);
|
|
51
|
-
--link-color-visited: var(--blue-focus);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.m-link--blue:focus,
|
|
55
|
-
.m-link--blue:active {
|
|
56
|
-
--link-color: var(--blue-focus);
|
|
57
|
-
--link-color-hover: var(--blue-focus);
|
|
58
|
-
--link-color-focus: var(--blue-focus);
|
|
59
|
-
--link-color-visited: var(--blue-focus);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.m-link--green {
|
|
63
|
-
--link-color: var(--green);
|
|
64
|
-
--link-color-hover: var(--green-hover);
|
|
65
|
-
--link-color-focus: var(--green-focus);
|
|
66
|
-
--link-color-visited: var(--green-focus);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.m-link--green:visited {
|
|
70
|
-
--link-color: var(--green);
|
|
71
|
-
--link-color-hover: var(--green-hover);
|
|
72
|
-
--link-color-focus: var(--green-focus);
|
|
73
|
-
--link-color-visited: var(--green-focus);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.m-link--green:hover {
|
|
77
|
-
--link-color: var(--green-hover);
|
|
78
|
-
--link-color-hover: var(--green-hover);
|
|
79
|
-
--link-color-focus: var(--green-focus);
|
|
80
|
-
--link-color-visited: var(--green-focus);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.m-link--green:focus,
|
|
84
|
-
.m-link--green:active {
|
|
85
|
-
--link-color: var(--green-focus);
|
|
86
|
-
--link-color-hover: var(--green-focus);
|
|
87
|
-
--link-color-focus: var(--green-focus);
|
|
88
|
-
--link-color-visited: var(--green-focus);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.m-link--red {
|
|
92
|
-
--link-color: var(--red);
|
|
93
|
-
--link-color-hover: var(--red-hover);
|
|
94
|
-
--link-color-focus: var(--red-focus);
|
|
95
|
-
--link-color-visited: var(--red-focus);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.m-link--red:visited {
|
|
99
|
-
--link-color: var(--red);
|
|
100
|
-
--link-color-hover: var(--red-hover);
|
|
101
|
-
--link-color-focus: var(--red-focus);
|
|
102
|
-
--link-color-visited: var(--red-focus);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.m-link--red:hover {
|
|
106
|
-
--link-color: var(--red-hover);
|
|
107
|
-
--link-color-hover: var(--red-hover);
|
|
108
|
-
--link-color-focus: var(--red-focus);
|
|
109
|
-
--link-color-visited: var(--red-focus);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.m-link--red:focus,
|
|
113
|
-
.m-link--red:active {
|
|
114
|
-
--link-color: var(--red-focus);
|
|
115
|
-
--link-color-hover: var(--red-focus);
|
|
116
|
-
--link-color-focus: var(--red-focus);
|
|
117
|
-
--link-color-visited: var(--red-focus);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.m-link--yellow {
|
|
121
|
-
--link-color: var(--yellow);
|
|
122
|
-
--link-color-hover: var(--yellow-hover);
|
|
123
|
-
--link-color-focus: var(--yellow-focus);
|
|
124
|
-
--link-color-visited: var(--yellow-focus);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.m-link--yellow:visited {
|
|
128
|
-
--link-color: var(--yellow);
|
|
129
|
-
--link-color-hover: var(--yellow-hover);
|
|
130
|
-
--link-color-focus: var(--yellow-focus);
|
|
131
|
-
--link-color-visited: var(--yellow-focus);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.m-link--yellow:hover {
|
|
135
|
-
--link-color: var(--yellow-hover);
|
|
136
|
-
--link-color-hover: var(--yellow-hover);
|
|
137
|
-
--link-color-focus: var(--yellow-focus);
|
|
138
|
-
--link-color-visited: var(--yellow-focus);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.m-link--yellow:focus,
|
|
142
|
-
.m-link--yellow:active {
|
|
143
|
-
--link-color: var(--yellow-focus);
|
|
144
|
-
--link-color-hover: var(--yellow-focus);
|
|
145
|
-
--link-color-focus: var(--yellow-focus);
|
|
146
|
-
--link-color-visited: var(--yellow-focus);
|
|
147
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component :is="tag" :to="to" :class="computedClasses" :disabled="disabled">
|
|
3
|
-
<slot />
|
|
4
|
-
</component>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import type { Color } from "@/types/props";
|
|
9
|
-
import { computed, defineComponent, type PropType } from "vue";
|
|
10
|
-
|
|
11
|
-
export default defineComponent({
|
|
12
|
-
name: "MLink",
|
|
13
|
-
props: {
|
|
14
|
-
color: {
|
|
15
|
-
type: String as PropType<Color>
|
|
16
|
-
},
|
|
17
|
-
disabled: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false
|
|
20
|
-
},
|
|
21
|
-
block: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false
|
|
24
|
-
},
|
|
25
|
-
underline: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: false
|
|
28
|
-
},
|
|
29
|
-
to: [String, Object]
|
|
30
|
-
},
|
|
31
|
-
setup(props) {
|
|
32
|
-
const computedClasses = computed(() => {
|
|
33
|
-
return [
|
|
34
|
-
'm-link',
|
|
35
|
-
{
|
|
36
|
-
[`m-link--${props.color}`]: props.color,
|
|
37
|
-
'm-link--underline': props.underline,
|
|
38
|
-
'm-link--block': props.block,
|
|
39
|
-
'm-link--disabled': props.disabled,
|
|
40
|
-
'm-link--external': tag.value === 'a'
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const tag = computed(() => (props.to ? 'router-link' : 'a'));
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
computedClasses,
|
|
49
|
-
tag
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
</script>
|
|
54
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="show"
|
|
4
|
-
class="m-message__wrapper"
|
|
5
|
-
>
|
|
6
|
-
<div class="m-message">
|
|
7
|
-
{{ content }}
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import { defineComponent, onMounted, ref } from 'vue';
|
|
14
|
-
import type { PropType } from 'vue';
|
|
15
|
-
|
|
16
|
-
export default defineComponent({
|
|
17
|
-
name: 'MMessage',
|
|
18
|
-
props: {
|
|
19
|
-
onInternalAfterLeave: Function as PropType<(key: string) => void>,
|
|
20
|
-
internalKey: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
24
|
-
content: {
|
|
25
|
-
type: [String]
|
|
26
|
-
},
|
|
27
|
-
type: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: 'default'
|
|
30
|
-
},
|
|
31
|
-
timeout: {
|
|
32
|
-
type: Number,
|
|
33
|
-
default: 10000
|
|
34
|
-
},
|
|
35
|
-
showClose: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: true
|
|
38
|
-
},
|
|
39
|
-
onClose: {
|
|
40
|
-
type: Function,
|
|
41
|
-
default: () => { }
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
setup(props) {
|
|
45
|
-
let timerId: number | null = null;
|
|
46
|
-
const showRef = ref<boolean>(true);
|
|
47
|
-
|
|
48
|
-
onMounted(() => {
|
|
49
|
-
setHideTimeout();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
function setHideTimeout(): void {
|
|
53
|
-
const { timeout } = props;
|
|
54
|
-
if (timeout) {
|
|
55
|
-
timerId = window.setTimeout(hide, timeout);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function hide(): void {
|
|
60
|
-
showRef.value = false
|
|
61
|
-
if (timerId) {
|
|
62
|
-
window.clearTimeout(timerId)
|
|
63
|
-
timerId = null
|
|
64
|
-
if (props.onInternalAfterLeave) {
|
|
65
|
-
props.onInternalAfterLeave(props.internalKey)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
show: showRef,
|
|
72
|
-
hide,
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
.m-message-provider__container {
|
|
2
|
-
z-index: 5000;
|
|
3
|
-
position: fixed;
|
|
4
|
-
height: 0;
|
|
5
|
-
overflow: visible;
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
align-items: center;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.m-message-provider__container--top {
|
|
12
|
-
top: 12px;
|
|
13
|
-
left: 0;
|
|
14
|
-
right: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.m-message__wrapper {
|
|
18
|
-
margin: 0 0 8px 0;
|
|
19
|
-
z-index: 0;
|
|
20
|
-
transform-origin: top center;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.m-message {
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
padding: 10px 20px;
|
|
30
|
-
border-radius: 3px;
|
|
31
|
-
flex-wrap: nowrap;
|
|
32
|
-
max-width: 720px;
|
|
33
|
-
color: var(--gray-700);
|
|
34
|
-
background-color: var(--white);
|
|
35
|
-
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
36
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot />
|
|
3
|
-
<template v-if="messageList.length">
|
|
4
|
-
<Teleport :to="teleportTo ?? 'body'">
|
|
5
|
-
<div :class="[
|
|
6
|
-
`m-message-provider__container`,
|
|
7
|
-
`m-message-provider__container--${placement}`
|
|
8
|
-
]">
|
|
9
|
-
<MMessage v-for="message in messageList"
|
|
10
|
-
:key="message.key"
|
|
11
|
-
:internalKey="message.key"
|
|
12
|
-
:content="message.content"
|
|
13
|
-
:timeout="message.timeout ?? timeout"
|
|
14
|
-
ref="messageRefs"
|
|
15
|
-
:on-internal-after-leave="onInternalAfterLeave" />
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
</Teleport>
|
|
19
|
-
</template>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script lang="ts">
|
|
23
|
-
import {
|
|
24
|
-
ref,
|
|
25
|
-
reactive,
|
|
26
|
-
Teleport,
|
|
27
|
-
defineComponent,
|
|
28
|
-
provide
|
|
29
|
-
} from 'vue';
|
|
30
|
-
import type { MessageType, MessageReactive, MessageOptions, MessageApiInjection, ContentType } from './types';
|
|
31
|
-
import type { PropType } from 'vue';
|
|
32
|
-
import MMessage from './Message.vue';
|
|
33
|
-
import { useCachedUid } from '@/composables/useCachedUid';
|
|
34
|
-
|
|
35
|
-
export type MessageProviderInst = MessageApiInjection;
|
|
36
|
-
|
|
37
|
-
interface PrivateMessageReactive extends MessageReactive {
|
|
38
|
-
key: string
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface PrivateMessageRef extends MessageReactive {
|
|
42
|
-
key: string
|
|
43
|
-
hide: () => void
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default defineComponent({
|
|
47
|
-
name: 'MMessageProvider',
|
|
48
|
-
components: {
|
|
49
|
-
MMessage
|
|
50
|
-
},
|
|
51
|
-
props: {
|
|
52
|
-
teleportTo: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: 'body'
|
|
55
|
-
},
|
|
56
|
-
placement: {
|
|
57
|
-
type: String as PropType<
|
|
58
|
-
| 'top'
|
|
59
|
-
| 'top-left'
|
|
60
|
-
| 'top-right'
|
|
61
|
-
| 'bottom'
|
|
62
|
-
| 'bottom-left'
|
|
63
|
-
| 'bottom-right'
|
|
64
|
-
>,
|
|
65
|
-
default: 'top'
|
|
66
|
-
},
|
|
67
|
-
timeout: {
|
|
68
|
-
type: Number,
|
|
69
|
-
default: 3000
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
setup(props, { slots }) {
|
|
73
|
-
const messageListRef = ref<PrivateMessageReactive[]>([]);
|
|
74
|
-
const messageRefs = ref<Record<string, PrivateMessageRef>>({});
|
|
75
|
-
const api: MessageApiInjection = {
|
|
76
|
-
create(content: ContentType, options?: MessageOptions) {
|
|
77
|
-
return create(content, { type: 'default', ...options })
|
|
78
|
-
},
|
|
79
|
-
info(content: ContentType, options?: MessageOptions) {
|
|
80
|
-
return create(content, { ...options, type: 'info' })
|
|
81
|
-
},
|
|
82
|
-
success(content: ContentType, options?: MessageOptions) {
|
|
83
|
-
return create(content, { ...options, type: 'success' })
|
|
84
|
-
},
|
|
85
|
-
warning(content: ContentType, options?: MessageOptions) {
|
|
86
|
-
return create(content, { ...options, type: 'warning' })
|
|
87
|
-
},
|
|
88
|
-
error(content: ContentType, options?: MessageOptions) {
|
|
89
|
-
return create(content, { ...options, type: 'error' })
|
|
90
|
-
},
|
|
91
|
-
loading(content: ContentType, options?: MessageOptions) {
|
|
92
|
-
return create(content, { ...options, type: 'loading' })
|
|
93
|
-
},
|
|
94
|
-
destroyAll
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
provide('m-message', api);
|
|
98
|
-
|
|
99
|
-
function create(
|
|
100
|
-
content: ContentType,
|
|
101
|
-
options: MessageOptions & { type: MessageType }
|
|
102
|
-
): MessageReactive {
|
|
103
|
-
const { id } = useCachedUid('m-message');
|
|
104
|
-
const key = id.value;
|
|
105
|
-
const messageReactive = reactive({
|
|
106
|
-
...options,
|
|
107
|
-
content,
|
|
108
|
-
key,
|
|
109
|
-
destroy: () => {
|
|
110
|
-
messageRefs.value[key].hide();
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
messageListRef.value.push(messageReactive);
|
|
115
|
-
return messageReactive;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function destroyAll(): void {
|
|
119
|
-
//@ts-ignore
|
|
120
|
-
Object.values(messageRefs.value).forEach((messageRef) => {
|
|
121
|
-
messageRef.hide();
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function onInternalAfterLeave(key: string): void {
|
|
126
|
-
messageListRef.value = messageListRef.value.filter(
|
|
127
|
-
(message) => message.key !== key
|
|
128
|
-
);
|
|
129
|
-
delete messageRefs.value[key];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return Object.assign(
|
|
133
|
-
{
|
|
134
|
-
messageRefs,
|
|
135
|
-
messageList: messageListRef,
|
|
136
|
-
onInternalAfterLeave
|
|
137
|
-
},
|
|
138
|
-
api
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { VNodeChild } from 'vue';
|
|
2
|
-
|
|
3
|
-
export type ContentType = string;
|
|
4
|
-
export type MessageType =
|
|
5
|
-
| 'info'
|
|
6
|
-
| 'success'
|
|
7
|
-
| 'warning'
|
|
8
|
-
| 'error'
|
|
9
|
-
| 'loading'
|
|
10
|
-
| 'default'
|
|
11
|
-
|
|
12
|
-
export type MessageRenderMessage = (props: any) => VNodeChild
|
|
13
|
-
|
|
14
|
-
export interface MessageOptions {
|
|
15
|
-
type?: MessageType
|
|
16
|
-
render?: MessageRenderMessage
|
|
17
|
-
timeout?: number
|
|
18
|
-
closable?: boolean
|
|
19
|
-
onClose?: () => void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface MessageReactive {
|
|
23
|
-
content: ContentType
|
|
24
|
-
timeout?: number
|
|
25
|
-
closable?: boolean
|
|
26
|
-
type: MessageType
|
|
27
|
-
onClose?: () => void
|
|
28
|
-
destroy: () => void
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface MessageApiInjection {
|
|
32
|
-
create: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
33
|
-
info: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
34
|
-
success: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
35
|
-
warning: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
36
|
-
error: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
37
|
-
loading: (content: ContentType, options?: MessageOptions) => MessageReactive
|
|
38
|
-
destroyAll: () => void
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { inject } from 'vue'
|
|
2
|
-
import type { MessageApiInjection } from './types'
|
|
3
|
-
|
|
4
|
-
export function useMessage(): MessageApiInjection {
|
|
5
|
-
const api = inject('m-message', null);
|
|
6
|
-
|
|
7
|
-
if(api === null) {
|
|
8
|
-
throw new Error('m-message api is not provided, ensure the component is wrapped in <m-message-provider />.');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return api;
|
|
12
|
-
}
|