@mc-markets/ui 1.0.68 → 1.0.72

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 (44) hide show
  1. package/dist/components/Alert/Alert.vue.d.ts +8 -3
  2. package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
  3. package/dist/components/Dialog/Dialog.vue.d.ts.map +1 -1
  4. package/dist/components/NotifiMessage/NotifiMessage.vue.d.ts +30 -0
  5. package/dist/components/NotifiMessage/NotifiMessage.vue.d.ts.map +1 -0
  6. package/dist/components/Notification/Notification.vue.d.ts +1 -6
  7. package/dist/components/Notification/Notification.vue.d.ts.map +1 -1
  8. package/dist/images/alert/alert-error.png +0 -0
  9. package/dist/images/alert/alert-success.png +0 -0
  10. package/dist/images/alert/alert-warning.png +0 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +7 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.mjs +491 -358
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/style.css +1 -1
  18. package/package.json +1 -1
  19. package/packages/components/Alert/Alert.vue +117 -3
  20. package/packages/components/DatePicker/DatePicker.vue +1 -1
  21. package/packages/components/Dialog/Dialog.vue +0 -44
  22. package/packages/components/NotifiMessage/NotifiMessage.vue +292 -0
  23. package/packages/components/Notification/Notification.vue +11 -5
  24. package/packages/styles/components/dialog.scss +47 -0
  25. package/packages/styles/index.scss +2 -1
  26. package/dist/components/Card/Card.vue.d.ts +0 -8
  27. package/dist/components/Card/Card.vue.d.ts.map +0 -1
  28. package/packages/components/Card/Card.vue +0 -20
  29. package/packages/styles/images/empty/404.png +0 -0
  30. package/packages/styles/images/empty/billing.png +0 -0
  31. package/packages/styles/images/empty/cart.png +0 -0
  32. package/packages/styles/images/empty/comments.png +0 -0
  33. package/packages/styles/images/empty/dashboard.png +0 -0
  34. package/packages/styles/images/empty/files.png +0 -0
  35. package/packages/styles/images/empty/inbox.png +0 -0
  36. package/packages/styles/images/empty/location.png +0 -0
  37. package/packages/styles/images/empty/network.png +0 -0
  38. package/packages/styles/images/empty/notifications.png +0 -0
  39. package/packages/styles/images/empty/orders.png +0 -0
  40. package/packages/styles/images/empty/records.png +0 -0
  41. package/packages/styles/images/empty/session.png +0 -0
  42. package/packages/styles/images/empty/subscription.png +0 -0
  43. package/packages/styles/images/empty/todo.png +0 -0
  44. package/packages/styles/images/empty/wishlist.png +0 -0
@@ -1,13 +1,127 @@
1
1
  <template>
2
- <el-alert v-bind="$attrs">
2
+ <el-alert v-bind="mergedAttrs" class="mc-alert">
3
+ <!-- 自定义图标插槽 -->
4
+ <template v-if="iconUrl" #icon>
5
+ <img :src="iconUrl" :alt="`${type} icon`" class="mc-alert-icon" />
6
+ </template>
7
+
8
+ <!-- 其他插槽 -->
3
9
  <template v-for="(_, name) in $slots" :key="name" #[name]>
4
10
  <slot :name="name" />
5
11
  </template>
6
12
  </el-alert>
7
13
  </template>
8
14
 
9
- <script setup>
10
- defineOptions({
15
+ <script>
16
+ // 定义可选的Alert类型
17
+ const availableTypes = ['success', 'warning', 'error']
18
+
19
+ export default {
11
20
  name: 'MAlert'
21
+ }
22
+ </script>
23
+
24
+ <script setup>
25
+ import { computed, useAttrs } from 'vue'
26
+
27
+ const props = defineProps({
28
+ type: {
29
+ type: String,
30
+ default: 'success',
31
+ validator: (value) => availableTypes.includes(value)
32
+ },
33
+ useCustomIcon: {
34
+ type: Boolean,
35
+ default: true
36
+ }
37
+ })
38
+
39
+ const attrs = useAttrs()
40
+
41
+ // 排除已处理的属性,确保 type 属性正确传递
42
+ const mergedAttrs = computed(() => {
43
+ const { useCustomIcon, ...rest } = attrs
44
+ return {
45
+ ...rest,
46
+ type: props.type // 确保 type 属性正确传递给 el-alert
47
+ }
48
+ })
49
+
50
+ // 计算图标URL
51
+ const iconUrl = computed(() => {
52
+ if (!props.useCustomIcon) {
53
+ return null
54
+ }
55
+
56
+ return `/images/alert/alert-${props.type}.png`
12
57
  })
13
58
  </script>
59
+
60
+ <style lang="scss">
61
+ .mc-alert.el-alert {
62
+ --el-alert-padding: 14px 16px;
63
+ .mc-alert-icon {
64
+ width: 16px;
65
+ height: 16px;
66
+ object-fit: contain;
67
+ }
68
+ .el-alert__close-btn{
69
+ top: 50%;
70
+ transform: translateY(-50%);
71
+ }
72
+ // Error 类型样式
73
+ &.el-alert--error.is-light {
74
+ background-color: var(--all-red-10);
75
+ color: var(--text-error-primary);
76
+ border-color: var(--all-red-10);
77
+
78
+ .el-alert__title,
79
+ .el-alert__description,
80
+ .el-alert__close-btn {
81
+ color: var(--text-error-primary);
82
+ }
83
+
84
+ .el-alert__icon {
85
+ display: flex;
86
+ align-items: center;
87
+ }
88
+ }
89
+
90
+ // Warning 类型样式
91
+ &.el-alert--warning.is-light {
92
+ background-color: var(--all-orange-10);
93
+ color: var(--text-warning-primary);
94
+ border-color: var(--all-orange-10);
95
+
96
+ .el-alert__title,
97
+ .el-alert__description,
98
+ .el-alert__close-btn {
99
+ color: var(--text-warning-primary);
100
+ }
101
+
102
+ .el-alert__icon {
103
+ display: flex;
104
+ align-items: center;
105
+ }
106
+ }
107
+
108
+ // Success 类型样式
109
+ &.el-alert--success.is-light {
110
+ background-color: var(--all-green-10);
111
+ color: var(--all-green-4);
112
+ border-color: var(--all-green-10);
113
+
114
+ .el-alert__title,
115
+ .el-alert__description,
116
+ .el-alert__close-btn {
117
+ color: var(--all-green-4);
118
+ }
119
+
120
+ .el-alert__icon {
121
+ display: flex;
122
+ align-items: center;
123
+ }
124
+ }
125
+ }
126
+
127
+ </style>
@@ -34,7 +34,7 @@ const { mergedAttrs, className: popperClass } = useClassName(
34
34
  border-radius: 6px;
35
35
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
36
36
  .current,
37
- .today:not(.in-range),
37
+ // .today:not(.in-range),
38
38
  .start-date,
39
39
  .end-date {
40
40
  .el-date-table-cell {
@@ -54,49 +54,5 @@ const dialogVisible = defineModel('modelValue', {
54
54
  </script>
55
55
 
56
56
  <style scoped lang="scss">
57
- :deep(.m-dialog) {
58
- --el-dialog-padding-primary:24px;
59
- --el-dialog-title-font-size:24px;
60
- --el-dialog-border-radius:16px;
61
- --el-dialog-bg-color:var(--bg-tertiary);
62
- }
63
57
 
64
- :deep(.m-header) {
65
- padding-bottom: 24px;
66
- padding-right: 0;
67
-
68
- .el-dialog__title {
69
- line-height: 32px;
70
- font-weight: 600;
71
- color: var(--text-primary);
72
- }
73
-
74
- .el-dialog__headerbtn {
75
- width: 24px;
76
- height: 24px;
77
- right: 22px;
78
- top: 22px;
79
- display: flex;
80
- justify-content: center;
81
- align-items: center;
82
-
83
- .el-dialog__close {
84
- font-size: 20px;
85
- color: var(--icon-tertiary);
86
- }
87
-
88
- &:hover{
89
- .el-dialog__close{
90
- color: var(--bg-brand-hover);
91
- }
92
- }
93
- }
94
- }
95
-
96
- :deep(.el-dialog__footer) {
97
- display: flex;
98
- >.el-button{
99
- flex: 1;
100
- }
101
- }
102
58
  </style>
@@ -0,0 +1,292 @@
1
+ <template>
2
+ <teleport to="body">
3
+ <transition-group name="notification" tag="div" class="notification-container">
4
+ <div
5
+ v-for="notification in notifications"
6
+ :key="notification.id"
7
+ :class="[
8
+ 'custom-notification',
9
+ `notification-${notification.position}`
10
+ ]"
11
+ >
12
+ <!-- 图标 -->
13
+ <div class="notification-icon">
14
+ <img
15
+ src="https://cfdsaas-pre.oss-cn-hongkong.aliyuncs.com/mc-assets/MCImages/userCenter/icon-quota-tip.png"
16
+ alt="notification icon"
17
+ />
18
+ </div>
19
+
20
+ <!-- 内容区域 -->
21
+ <div class="notification-content">
22
+ <!-- 标题 -->
23
+ <div class="notification-title">{{ notification.title }}</div>
24
+
25
+ <!-- 消息内容 -->
26
+ <div class="notification-message">{{ notification.message }}</div>
27
+
28
+ <!-- 自定义插槽内容 -->
29
+ <div v-if="notification.slotContent" class="notification-action">
30
+ <component :is="notification.slotContent" />
31
+ </div>
32
+ </div>
33
+
34
+ <!-- 关闭按钮 -->
35
+ <button
36
+ v-if="notification.showClose"
37
+ class="notification-close"
38
+ @click="closeNotification(notification.id)"
39
+ >
40
+ ×
41
+ </button>
42
+ </div>
43
+ </transition-group>
44
+ </teleport>
45
+ </template>
46
+
47
+ <script>
48
+ import { ref } from 'vue'
49
+
50
+ // 全局通知列表
51
+ const notifications = ref([])
52
+ let notificationId = 0
53
+
54
+ // 创建 NotifiMessage 静态方法对象
55
+ const NotifiMessage = {
56
+ // 默认配置
57
+ defaultOptions: {
58
+ title: '',
59
+ message: '',
60
+ duration: 4500,
61
+ position: 'top-right',
62
+ showClose: true,
63
+ offset: 20
64
+ },
65
+
66
+ // 显示通知
67
+ show(options = {}) {
68
+ const config = {
69
+ ...this.defaultOptions,
70
+ ...options,
71
+ id: ++notificationId
72
+ }
73
+
74
+ // 添加到通知列表
75
+ notifications.value.push(config)
76
+
77
+ // 如果设置了自动关闭时间,则自动关闭
78
+ if (config.duration > 0) {
79
+ setTimeout(() => {
80
+ this.close(config.id)
81
+ }, config.duration)
82
+ }
83
+
84
+ return {
85
+ close: () => this.close(config.id)
86
+ }
87
+ },
88
+
89
+ // 关闭指定通知
90
+ close(id) {
91
+ const index = notifications.value.findIndex(n => n.id === id)
92
+ if (index > -1) {
93
+ notifications.value.splice(index, 1)
94
+ }
95
+ },
96
+
97
+ // 关闭所有通知
98
+ closeAll() {
99
+ notifications.value = []
100
+ },
101
+
102
+ // 便捷方法
103
+ success(options = {}) {
104
+ return this.show(options)
105
+ },
106
+
107
+ warning(options = {}) {
108
+ return this.show(options)
109
+ },
110
+
111
+ error(options = {}) {
112
+ return this.show(options)
113
+ }
114
+ }
115
+
116
+ // 关闭通知的方法
117
+ const closeNotification = (id) => {
118
+ const index = notifications.value.findIndex(n => n.id === id)
119
+ if (index > -1) {
120
+ notifications.value.splice(index, 1)
121
+ }
122
+ }
123
+
124
+
125
+ // Vue 组件定义
126
+ export default {
127
+ name: 'MNotifiMessage',
128
+ setup() {
129
+ return {
130
+ notifications,
131
+ closeNotification
132
+ }
133
+ }
134
+ }
135
+
136
+ // 导出类供直接使用
137
+ export { NotifiMessage }
138
+ </script>
139
+
140
+ <style lang="scss">
141
+ .notification-container {
142
+ position: fixed;
143
+ z-index: 9999;
144
+ pointer-events: none;
145
+ }
146
+
147
+ .custom-notification {
148
+ position: fixed;
149
+ top: 20px;
150
+ right: 20px;
151
+ width: 400px;
152
+ background: #201F24;
153
+ border-radius: 12px;
154
+ padding: 16px;
155
+ display: flex;
156
+ align-items: flex-start;
157
+ gap: 4px;
158
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
159
+ pointer-events: auto;
160
+ z-index: 9999;
161
+
162
+ // 多个通知的堆叠效果
163
+ &:nth-child(2) { top: 100px; }
164
+ &:nth-child(3) { top: 180px; }
165
+ &:nth-child(4) { top: 260px; }
166
+ &:nth-child(5) { top: 340px; }
167
+
168
+ .notification-icon {
169
+ flex-shrink: 0;
170
+ width: 40px;
171
+ height: 40px;
172
+ border-radius: 50%;
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ position: relative;
177
+ transform: translate(-9px, -8px);
178
+
179
+ img {
180
+ width: 100%;
181
+ height: 100%;
182
+ object-fit: contain;
183
+ }
184
+ }
185
+
186
+ .notification-content {
187
+ flex: 1;
188
+
189
+ .notification-title {
190
+ color: #FFFFFF;
191
+ font-size: 16px;
192
+ font-weight: 600;
193
+ margin-bottom: 8px;
194
+ }
195
+
196
+ .notification-message {
197
+ color: rgba(255, 255, 255, 0.8);
198
+ font-size: 14px;
199
+ line-height: 1.5;
200
+ margin-bottom: 16px;
201
+ }
202
+
203
+ .notification-action {
204
+ .custom-action-link {
205
+ color: #FFD905;
206
+ font-size: 14px;
207
+ font-weight: 500;
208
+ cursor: pointer;
209
+ display: flex;
210
+ align-items: center;
211
+ gap: 6px;
212
+ transition: all 0.2s ease;
213
+
214
+ &:hover {
215
+ color: #FFF;
216
+ }
217
+
218
+ span {
219
+ line-height: 1;
220
+ }
221
+
222
+ .arrow {
223
+ transition: transform 0.2s ease;
224
+ display: flex;
225
+ align-items: center;
226
+ line-height: 1;
227
+ }
228
+
229
+ &:hover .arrow {
230
+ transform: translateX(2px);
231
+ }
232
+ }
233
+ }
234
+ }
235
+
236
+ .notification-close {
237
+ position: absolute;
238
+ top: 12px;
239
+ right: 12px;
240
+ width: 24px;
241
+ height: 24px;
242
+ border: none;
243
+ background: rgba(255, 255, 255, 0.1);
244
+ color: rgba(255, 255, 255, 0.6);
245
+ border-radius: 50%;
246
+ cursor: pointer;
247
+ display: flex;
248
+ align-items: center;
249
+ justify-content: center;
250
+ font-size: 16px;
251
+ line-height: 1;
252
+ transition: all 0.2s ease;
253
+
254
+ &:hover {
255
+ background: rgba(255, 255, 255, 0.2);
256
+ color: rgba(255, 255, 255, 0.9);
257
+ }
258
+ }
259
+ }
260
+
261
+ // 动画效果
262
+ .notification-enter-active {
263
+ transition: all 0.3s ease;
264
+ }
265
+
266
+ .notification-leave-active {
267
+ transition: all 0.3s ease;
268
+ }
269
+
270
+ .notification-enter-from {
271
+ opacity: 0;
272
+ transform: translateX(100%);
273
+ }
274
+
275
+ .notification-leave-to {
276
+ opacity: 0;
277
+ transform: translateX(100%);
278
+ }
279
+
280
+ .notification-move {
281
+ transition: transform 0.3s ease;
282
+ }
283
+
284
+ // 响应式设计
285
+ @media (max-width: 480px) {
286
+ .custom-notification {
287
+ width: calc(100vw - 40px);
288
+ left: 20px !important;
289
+ right: 20px !important;
290
+ }
291
+ }
292
+ </style>
@@ -1,13 +1,19 @@
1
1
  <template>
2
- <el-notification v-bind="$attrs">
2
+ <el-notification v-bind="$attrs" class="mc-notification">
3
+ <!-- 其他插槽 -->
3
4
  <template v-for="(_, name) in $slots" :key="name" #[name]>
4
5
  <slot :name="name" />
5
6
  </template>
6
7
  </el-notification>
7
8
  </template>
8
9
 
9
- <script setup>
10
- defineOptions({
11
- name: 'MNotification'
12
- })
10
+ <script>
11
+ export default {
12
+ name: "MNotification",
13
+ };
13
14
  </script>
15
+
16
+ <style lang="scss">
17
+ // Notification 基础样式
18
+ // 如需自定义样式,可以在这里添加
19
+ </style>
@@ -0,0 +1,47 @@
1
+ .mc-ui-override {
2
+ .el-dialog {
3
+ --el-dialog-padding-primary: 24px;
4
+ --el-dialog-title-font-size: 24px;
5
+ --el-dialog-border-radius: 16px;
6
+ --el-dialog-bg-color: var(--bg-tertiary);
7
+ }
8
+
9
+ .el-dialog__header {
10
+ padding-bottom: 24px;
11
+ padding-right: 0;
12
+
13
+ .el-dialog__title {
14
+ line-height: 32px;
15
+ font-weight: 600;
16
+ color: var(--text-primary);
17
+ }
18
+
19
+ .el-dialog__headerbtn {
20
+ width: 24px;
21
+ height: 24px;
22
+ right: 22px;
23
+ top: 22px;
24
+ display: flex;
25
+ justify-content: center;
26
+ align-items: center;
27
+
28
+ .el-dialog__close {
29
+ font-size: 20px;
30
+ color: var(--icon-tertiary);
31
+ }
32
+
33
+ &:hover {
34
+ .el-dialog__close {
35
+ color: var(--bg-brand-hover);
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ .el-dialog__footer {
42
+ display: flex;
43
+ > .el-button {
44
+ flex: 1;
45
+ }
46
+ }
47
+ }
@@ -89,6 +89,7 @@
89
89
  @use './components/table.scss';
90
90
  @use './components/form.scss';
91
91
  @use './components/tabs.scss';
92
+ @use './components/dialog.scss';
92
93
 
93
94
 
94
95
 
@@ -100,4 +101,4 @@ html.dark{
100
101
 
101
102
  --el-text-color-placeholder:var(--text-tertiary);
102
103
  --el-border-radius-base:8px;
103
- }
104
+ }
@@ -1,8 +0,0 @@
1
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
2
- export default _default;
3
- type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
- $slots: S;
5
- });
6
- declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
7
- declare function __VLS_template(): Partial<Record<NonNullable<string | number>, (_: {}) => any>>;
8
- //# sourceMappingURL=Card.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Card.vue.d.ts","sourceRoot":"","sources":["../../../packages/components/Card/Card.vue.js"],"names":[],"mappings":"AAOA;wBAmFqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;;6BAC1E,CAAC,EAAE,CAAC;;;AAPjC,6SAKG;AAvEH,2FAuDsF,GAAG,GAIxF"}
@@ -1,20 +0,0 @@
1
- <template>
2
- <el-card v-bind="$attrs" class="m-card">
3
- <template v-for="(_, name) in $slots" :key="name" #[name]>
4
- <slot :name="name" />
5
- </template>
6
- </el-card>
7
- </template>
8
-
9
- <script setup>
10
- defineOptions({
11
- name: 'MCard'
12
- })
13
- </script>
14
-
15
- <style lang="scss">
16
- // Card 组件样式 - 使用 m-card 类名隔离样式
17
- .m-card {
18
- // 自定义样式可以在这里添加
19
- }
20
- </style>