lew-ui 1.0.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/components/base/LewAvatar.vue +107 -0
- package/components/base/LewBadge.vue +126 -0
- package/components/base/LewButton.vue +193 -0
- package/components/base/LewTitle.vue +34 -0
- package/components/feedback/LewAlert.vue +150 -0
- package/components/feedback/LewMessage.vue +7 -0
- package/components/feedback/LewModal.vue +75 -0
- package/components/form/FormItem.vue +51 -0
- package/components/form/LewCheckbox.vue +153 -0
- package/components/form/LewCheckboxGroup.vue +99 -0
- package/components/form/LewInput.vue +73 -0
- package/components/form/LewRadio.vue +126 -0
- package/components/form/LewRadioGroup.vue +82 -0
- package/components/form/LewSelect.vue +141 -0
- package/components/form/LewSwitch.vue +108 -0
- package/components/form/LewTabs.vue +108 -0
- package/components/form/LewTextarea.vue +90 -0
- package/components/index.ts +35 -0
- package/directives/index.ts +3 -0
- package/directives/tooltips.ts +23 -0
- package/hooks/index.ts +3 -0
- package/hooks/useDOMCreate.ts +13 -0
- package/index.ts +3 -0
- package/package.json +29 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
round: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
default: false,
|
|
6
|
+
},
|
|
7
|
+
status: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: '',
|
|
10
|
+
},
|
|
11
|
+
statusPosition: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: '',
|
|
14
|
+
},
|
|
15
|
+
src: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
alt: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: '',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div class="lew-avatar">
|
|
28
|
+
<img :src="src" :class="{ round: round }" :alt="alt" />
|
|
29
|
+
<span
|
|
30
|
+
v-if="status"
|
|
31
|
+
class="dot"
|
|
32
|
+
:class="`dot-${status} dot-${statusPosition}`"
|
|
33
|
+
>
|
|
34
|
+
</span>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style lang="scss" scoped>
|
|
39
|
+
.lew-avatar {
|
|
40
|
+
position: relative;
|
|
41
|
+
display: inline-block;
|
|
42
|
+
width: 40px;
|
|
43
|
+
height: 40px;
|
|
44
|
+
|
|
45
|
+
img {
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
border-radius: 5px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.round {
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.dot {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: -0.25rem;
|
|
58
|
+
left: -0.25rem;
|
|
59
|
+
content: '';
|
|
60
|
+
width: 0.6rem;
|
|
61
|
+
height: 0.6rem;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
z-index: 99;
|
|
64
|
+
border: 2px #fff solid;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dot-online {
|
|
68
|
+
background-color: var(--success-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dot-busy {
|
|
72
|
+
background-color: var(--danger-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dot-offline {
|
|
76
|
+
background-color: var(--normal-color-dark);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dot-away {
|
|
80
|
+
background-color: var(--warning-color);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dot-top-left {
|
|
84
|
+
top: -0.25rem;
|
|
85
|
+
left: -0.25rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dot-top-right {
|
|
89
|
+
top: -0.25rem;
|
|
90
|
+
left: auto;
|
|
91
|
+
right: -0.25rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dot-bottom-left {
|
|
95
|
+
top: auto;
|
|
96
|
+
bottom: -0.25rem;
|
|
97
|
+
left: -0.25rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.dot-bottom-right {
|
|
101
|
+
top: auto;
|
|
102
|
+
bottom: -0.25rem;
|
|
103
|
+
left: auto;
|
|
104
|
+
right: -0.25rem;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useRouter } from 'vue-router';
|
|
3
|
+
const router = useRouter();
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
type: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: 'primary',
|
|
8
|
+
},
|
|
9
|
+
round: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false,
|
|
12
|
+
},
|
|
13
|
+
bold: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 400,
|
|
16
|
+
},
|
|
17
|
+
dot: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
href: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const toLink = () => {
|
|
27
|
+
if (props.href) {
|
|
28
|
+
if (props.href.includes('http')) {
|
|
29
|
+
window.open(props.href, '_blank');
|
|
30
|
+
} else {
|
|
31
|
+
router.push(props.href);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<span
|
|
39
|
+
class="lew-badge"
|
|
40
|
+
:class="`${dot ? 'lew-badge-dot' : ''} ${
|
|
41
|
+
round ? 'lew-badge-round' : ''
|
|
42
|
+
} ${href ? 'lew-badge-href' : ''} lew-badge-${type} `"
|
|
43
|
+
:style="` font-weight:${bold}`"
|
|
44
|
+
@click="toLink()"
|
|
45
|
+
>
|
|
46
|
+
<slot></slot>
|
|
47
|
+
</span>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style lang="scss">
|
|
51
|
+
.lew-badge {
|
|
52
|
+
min-width: 14px;
|
|
53
|
+
border-radius: 0.25rem;
|
|
54
|
+
padding: 2px 8px 3px 8px;
|
|
55
|
+
font-size: 0.75rem;
|
|
56
|
+
margin-right: 10px;
|
|
57
|
+
cursor: default;
|
|
58
|
+
color: var(--primary-text-color);
|
|
59
|
+
background-color: var(--primary-color-light);
|
|
60
|
+
font-weight: normal;
|
|
61
|
+
}
|
|
62
|
+
.lew-badge-bold {
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.lew-badge-round {
|
|
67
|
+
border-radius: 30px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.lew-badge-href {
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.lew-badge-dot {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
max-width: 4px;
|
|
77
|
+
max-height: 4px;
|
|
78
|
+
min-width: 4px;
|
|
79
|
+
min-height: 4px;
|
|
80
|
+
width: 4px;
|
|
81
|
+
height: 4px;
|
|
82
|
+
padding: 2px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.lew-badge-dot.lew-badge-primary {
|
|
86
|
+
background-color: var(--primary-color-hover);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.lew-badge-dot.lew-badge-success {
|
|
90
|
+
background-color: var(--success-color-hover);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.lew-badge-dot.lew-badge-warning {
|
|
94
|
+
background-color: var(--warning-color-hover);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.lew-badge-dot.lew-badge-danger {
|
|
98
|
+
background-color: var(--danger-color-hover);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.lew-badge-dot.lew-badge-normal {
|
|
102
|
+
background-color: var(--normal-color-hover);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.lew-badge-primary {
|
|
106
|
+
color: var(--primary-text-color);
|
|
107
|
+
background-color: var(--primary-color-light);
|
|
108
|
+
}
|
|
109
|
+
.lew-badge-success {
|
|
110
|
+
color: var(--success-text-color);
|
|
111
|
+
background-color: var(--success-color-light);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.lew-badge-warning {
|
|
115
|
+
color: var(--warning-text-color);
|
|
116
|
+
background-color: var(--warning-color-light);
|
|
117
|
+
}
|
|
118
|
+
.lew-badge-danger {
|
|
119
|
+
color: var(--danger-text-color);
|
|
120
|
+
background-color: var(--danger-color-light);
|
|
121
|
+
}
|
|
122
|
+
.lew-badge-normal {
|
|
123
|
+
color: var(--normal-text-color);
|
|
124
|
+
background-color: var(--normal-color-light);
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
type: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: 'primary',
|
|
6
|
+
},
|
|
7
|
+
loading: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
round: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
disabled: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<button
|
|
24
|
+
class="lew-button"
|
|
25
|
+
:class="`lew-button-${type} ${round ? 'lew-button-round' : ''} ${
|
|
26
|
+
disabled ? 'lew-button-disabled' : ''
|
|
27
|
+
} ${loading ? 'lew-button-loading' : ''}`"
|
|
28
|
+
:disabled="disabled"
|
|
29
|
+
>
|
|
30
|
+
<slot></slot>
|
|
31
|
+
</button>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style lang="scss" scoped>
|
|
35
|
+
.lew-button {
|
|
36
|
+
position: relative;
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
text-align: center;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
user-select: none;
|
|
43
|
+
width: auto;
|
|
44
|
+
min-width: 76px;
|
|
45
|
+
height: 32px;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
transition: all 0.15s;
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
border: none;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
padding: 0px 13px;
|
|
53
|
+
border-radius: var(--border-radius);
|
|
54
|
+
|
|
55
|
+
svg {
|
|
56
|
+
font-size: 15px;
|
|
57
|
+
width: 20px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.lew-button::after {
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: 50%;
|
|
65
|
+
left: 50%;
|
|
66
|
+
content: '';
|
|
67
|
+
border: 3px solid rgba(0, 0, 0, 0.25);
|
|
68
|
+
border-left-color: rgba(255, 255, 255, 0.85);
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
width: 11px;
|
|
71
|
+
height: 11px;
|
|
72
|
+
opacity: 0;
|
|
73
|
+
animation: donut-spin 0.8s linear infinite;
|
|
74
|
+
transition: all 0.15s;
|
|
75
|
+
transform: translate(-50%, -50%);
|
|
76
|
+
}
|
|
77
|
+
.lew-button-round {
|
|
78
|
+
border-radius: 50px;
|
|
79
|
+
}
|
|
80
|
+
.lew-button-round::before {
|
|
81
|
+
border-radius: 50px;
|
|
82
|
+
}
|
|
83
|
+
.lew-button-primary {
|
|
84
|
+
background: var(--primary-color);
|
|
85
|
+
color: var(--text-color-invert);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.lew-button-primary:hover {
|
|
89
|
+
background-color: var(--primary-color-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.lew-button-primary:active {
|
|
93
|
+
background-color: var(--primary-color-active);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.lew-button-success {
|
|
97
|
+
background: var(--success-color);
|
|
98
|
+
color: var(--text-color-invert);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.lew-button-success:hover {
|
|
102
|
+
background-color: var(--success-color-hover);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.lew-button-success:active {
|
|
106
|
+
background-color: var(--success-color-active);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.lew-button-danger {
|
|
110
|
+
background: var(--danger-color);
|
|
111
|
+
color: var(--text-color-invert);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.lew-button-danger:hover {
|
|
115
|
+
background-color: var(--danger-color-hover);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.lew-button-danger:active {
|
|
119
|
+
background-color: var(--danger-color-active);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.lew-button-normal {
|
|
123
|
+
background: var(--normal-color);
|
|
124
|
+
color: var(--text-color);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.lew-button-normal:hover {
|
|
128
|
+
background-color: var(--normal-color-hover);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.lew-button-normal:active {
|
|
132
|
+
background-color: var(--normal-color-active);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.lew-button-warning {
|
|
136
|
+
background: var(--warning-color);
|
|
137
|
+
color: var(--text-color-invert);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.lew-button-warning:hover {
|
|
141
|
+
background-color: var(--warning-color-hover);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.lew-button-warning:active {
|
|
145
|
+
background-color: var(--warning-color-active);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@keyframes donut-spin {
|
|
149
|
+
0% {
|
|
150
|
+
transform: translate(-50%, -50%) rotate(0deg);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
100% {
|
|
154
|
+
transform: translate(-50%, -50%) rotate(360deg);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.lew-button-loading {
|
|
159
|
+
font-size: 0px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.lew-button-loading:hover {
|
|
163
|
+
font-size: 0px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.lew-button-loading::after {
|
|
167
|
+
opacity: 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.lew-button-disabled {
|
|
171
|
+
cursor: not-allowed;
|
|
172
|
+
font-size: 14px;
|
|
173
|
+
background: #eee;
|
|
174
|
+
color: #999;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.lew-button-disabled:hover {
|
|
178
|
+
font-size: 14px;
|
|
179
|
+
background: #eee;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.lew-button-disabled::after {
|
|
183
|
+
opacity: 0;
|
|
184
|
+
}
|
|
185
|
+
</style>
|
|
186
|
+
<style>
|
|
187
|
+
.lew-button svg {
|
|
188
|
+
font-size: 15px;
|
|
189
|
+
width: 18px;
|
|
190
|
+
height: 18px;
|
|
191
|
+
margin-right: 5px;
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
bold: {
|
|
4
|
+
type: Number,
|
|
5
|
+
default: 600,
|
|
6
|
+
},
|
|
7
|
+
size: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: '24px',
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div
|
|
16
|
+
class="lew-title"
|
|
17
|
+
:class="`${bold ? 'lew-title-bold' : ''}`"
|
|
18
|
+
:style="`font-weight:${bold};font-size:${size}`"
|
|
19
|
+
>
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style lang="scss" scoped>
|
|
25
|
+
.lew-title {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
text-overflow: ellipsis;
|
|
31
|
+
color: var(--title-color);
|
|
32
|
+
margin-bottom: 10px;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
Info24Regular,
|
|
5
|
+
Warning24Regular,
|
|
6
|
+
CheckmarkCircle24Regular,
|
|
7
|
+
ErrorCircle24Regular,
|
|
8
|
+
Alert24Regular,
|
|
9
|
+
Dismiss20Filled,
|
|
10
|
+
} from '@vicons/fluent';
|
|
11
|
+
import { Icon } from '@vicons/utils';
|
|
12
|
+
type Alert = {
|
|
13
|
+
type: string;
|
|
14
|
+
title: string;
|
|
15
|
+
content: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
defineProps({
|
|
19
|
+
alertList: {
|
|
20
|
+
type: Array as PropType<Alert[]>,
|
|
21
|
+
default() {
|
|
22
|
+
return [];
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits(['close']);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div class="lew-alert-group">
|
|
32
|
+
<div
|
|
33
|
+
v-for="(item, i) in alertList"
|
|
34
|
+
:key="i"
|
|
35
|
+
class="lew-alert"
|
|
36
|
+
:class="`lew-alert-${item.type}`"
|
|
37
|
+
>
|
|
38
|
+
<div class="alert-icon">
|
|
39
|
+
<Icon v-if="item.type == `normal`" size="24">
|
|
40
|
+
<Info24Regular />
|
|
41
|
+
</Icon>
|
|
42
|
+
<Icon v-if="item.type == `warning`" size="24">
|
|
43
|
+
<Warning24Regular />
|
|
44
|
+
</Icon>
|
|
45
|
+
<Icon v-if="item.type == `success`" size="24">
|
|
46
|
+
<CheckmarkCircle24Regular />
|
|
47
|
+
</Icon>
|
|
48
|
+
<Icon v-if="item.type == `danger`" size="24">
|
|
49
|
+
<ErrorCircle24Regular />
|
|
50
|
+
</Icon>
|
|
51
|
+
<Icon v-if="item.type == `primary`" size="24">
|
|
52
|
+
<Alert24Regular />
|
|
53
|
+
</Icon>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="message">
|
|
57
|
+
<div class="title">{{ item.title }}</div>
|
|
58
|
+
<div v-show="item.content" class="content">
|
|
59
|
+
{{ item.content }}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="close" @click="emit('close', i)">
|
|
63
|
+
<Icon size="20"> <Dismiss20Filled /> </Icon>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<style lang="scss">
|
|
70
|
+
.lew-alert-group {
|
|
71
|
+
width: 100%;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
font-size: 0px;
|
|
75
|
+
.lew-alert {
|
|
76
|
+
position: relative;
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: flex-start;
|
|
79
|
+
width: 100%;
|
|
80
|
+
min-height: 40px;
|
|
81
|
+
background-color: var(--normal-color);
|
|
82
|
+
border-radius: 8px;
|
|
83
|
+
margin-bottom: 10px;
|
|
84
|
+
padding: 12px;
|
|
85
|
+
box-shadow: 0 5px 15px -3px rgba(0, 0, 0, 0.1),
|
|
86
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
opacity: 0.8;
|
|
89
|
+
transition: all 0.25s ease;
|
|
90
|
+
.alert-icon {
|
|
91
|
+
margin-right: 5px;
|
|
92
|
+
}
|
|
93
|
+
.close {
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 8px;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
width: 25px;
|
|
100
|
+
height: 25px;
|
|
101
|
+
right: 10px;
|
|
102
|
+
border-radius: 8px;
|
|
103
|
+
box-sizing: border-box;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
user-select: none;
|
|
106
|
+
}
|
|
107
|
+
.close:hover {
|
|
108
|
+
background: rgba($color: #000000, $alpha: 0.05);
|
|
109
|
+
}
|
|
110
|
+
.close:active {
|
|
111
|
+
background: rgba($color: #000000, $alpha: 0.15);
|
|
112
|
+
}
|
|
113
|
+
.message {
|
|
114
|
+
width: calc(100% - 100px);
|
|
115
|
+
.title {
|
|
116
|
+
font-size: 15px;
|
|
117
|
+
width: 100%;
|
|
118
|
+
}
|
|
119
|
+
.content {
|
|
120
|
+
margin-top: 7px;
|
|
121
|
+
font-size: 14px;
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
.lew-alert-normal {
|
|
127
|
+
color: var(--normal-text-color);
|
|
128
|
+
background-color: var(--normal-color-light);
|
|
129
|
+
}
|
|
130
|
+
.lew-alert-success {
|
|
131
|
+
color: var(--success-text-color);
|
|
132
|
+
background-color: var(--success-color-light);
|
|
133
|
+
}
|
|
134
|
+
.lew-alert-warning {
|
|
135
|
+
color: var(--warning-text-color);
|
|
136
|
+
background-color: var(--warning-color-light);
|
|
137
|
+
}
|
|
138
|
+
.lew-alert-danger {
|
|
139
|
+
color: var(--danger-text-color);
|
|
140
|
+
background-color: var(--danger-color-light);
|
|
141
|
+
}
|
|
142
|
+
.lew-alert-primary {
|
|
143
|
+
color: var(--primary-text-color);
|
|
144
|
+
background-color: var(--primary-color-light);
|
|
145
|
+
}
|
|
146
|
+
.lew-alert:hover {
|
|
147
|
+
opacity: 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<teleport to="#lew-modal">
|
|
3
|
+
<transition name="fade">
|
|
4
|
+
<div v-if="visible" class="lew-modal" @click="maskClick">
|
|
5
|
+
<div
|
|
6
|
+
v-if="visible"
|
|
7
|
+
class="lew-modal-box"
|
|
8
|
+
:style="`width:${width};height:${height}`"
|
|
9
|
+
@click.stop
|
|
10
|
+
>
|
|
11
|
+
<slot></slot>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</transition>
|
|
15
|
+
</teleport>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts" setup name="Modal">
|
|
18
|
+
import { useDOMCreate } from '@/packages/lew';
|
|
19
|
+
useDOMCreate('lew-modal');
|
|
20
|
+
|
|
21
|
+
defineProps({
|
|
22
|
+
title: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: '',
|
|
25
|
+
},
|
|
26
|
+
width: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
height: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
visible: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const emit = defineEmits(['maskClick', 'confirm']);
|
|
41
|
+
|
|
42
|
+
const maskClick = () => {
|
|
43
|
+
emit('maskClick');
|
|
44
|
+
};
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<style lang="scss" scoped>
|
|
48
|
+
.lew-modal {
|
|
49
|
+
position: fixed;
|
|
50
|
+
top: 0px;
|
|
51
|
+
left: 0px;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
background-color: rgba($color: #000000, $alpha: 0.35);
|
|
55
|
+
outline: 1000000px solid rgba($color: #000000, $alpha: 0.35);
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
align-items: center;
|
|
59
|
+
z-index: 2001;
|
|
60
|
+
.lew-modal-box {
|
|
61
|
+
border-radius: 8px;
|
|
62
|
+
background-color: #fff;
|
|
63
|
+
box-shadow: 0px 15px 50px rgba($color: #000000, $alpha: 0.05);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
.fade-enter-active,
|
|
67
|
+
.fade-leave-active {
|
|
68
|
+
transition: all 0.2s ease;
|
|
69
|
+
}
|
|
70
|
+
.fade-enter-from,
|
|
71
|
+
.fade-leave-to {
|
|
72
|
+
opacity: 0;
|
|
73
|
+
transform: translateY(10px);
|
|
74
|
+
}
|
|
75
|
+
</style>
|