afn-basic-components 1.1.2 → 1.1.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.
@@ -2,13 +2,18 @@
2
2
 
3
3
  #app {
4
4
  .main-container {
5
- min-height: 100%;
5
+ height: 100%;
6
6
  transition: margin-left 0.28s;
7
7
  margin-left: $base-sidebar-width;
8
8
  position: relative;
9
9
  }
10
10
 
11
+ .sidebarHide {
12
+ margin-left: 0 !important;
13
+ }
14
+
11
15
  .sidebar-container {
16
+ -webkit-transition: width 0.28s;
12
17
  transition: width 0.28s;
13
18
  width: $base-sidebar-width !important;
14
19
  background-color: $base-menu-background;
@@ -20,6 +25,8 @@
20
25
  left: 0;
21
26
  z-index: 1001;
22
27
  overflow: hidden;
28
+ /* -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
29
+ box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); */
23
30
 
24
31
  // reset element-ui css
25
32
  .horizontal-collapse-transition {
@@ -29,16 +36,22 @@
29
36
 
30
37
  .scrollbar-wrapper {
31
38
  overflow-x: hidden !important;
32
-
33
- .el-scrollbar__view {
34
- height: 100%;
35
- }
36
39
  }
37
40
 
38
41
  .el-scrollbar__bar.is-vertical {
39
42
  right: 0px;
40
43
  }
41
44
 
45
+ .el-scrollbar {
46
+ height: 100%;
47
+ }
48
+
49
+ &.has-logo {
50
+ .el-scrollbar {
51
+ height: calc(100% - 100px);
52
+ }
53
+ }
54
+
42
55
  .is-horizontal {
43
56
  display: none;
44
57
  }
@@ -50,12 +63,8 @@
50
63
  }
51
64
 
52
65
  .svg-icon {
53
- margin-right: 16px;
54
- }
55
-
56
- .sub-el-icon {
57
- margin-right: 12px;
58
- margin-left: -2px;
66
+ font-size: 16px;
67
+ margin-right: 8px;
59
68
  }
60
69
 
61
70
  .el-menu {
@@ -64,22 +73,77 @@
64
73
  width: 100% !important;
65
74
  }
66
75
 
67
- // menu hover
68
- .submenu-title-noDropdown,
76
+ .el-menu-item,
69
77
  .el-submenu__title {
78
+ overflow: hidden !important;
79
+ text-overflow: ellipsis !important;
80
+ white-space: nowrap !important;
81
+ border-radius: 8px !important;
82
+ margin: 4px 0; /* 添加上下间距 */
83
+ height: 40px;
84
+ line-height: 40px;
85
+ font-weight: 500;
86
+ font-family: PingFangSC, PingFang SC;
87
+ display: flex !important;
88
+ align-items: center !important; // 纵向居中
89
+ &:hover {
90
+ background-color: $base-sub-menu-hover !important;
91
+ }
92
+ }
93
+ // 菜单选中状态 - 白色效果 🌟
94
+ .el-menu-item.is-active {
95
+ background-color: $base-menu-active-background !important;
96
+ color: $base-menu-color-active !important;
97
+
70
98
  &:hover {
71
- background-color: $base-menu-hover !important;
99
+ background-color: $base-sub-menu-hover !important;
72
100
  }
73
101
  }
102
+ // 侧边栏收缩hover状态
103
+ .submenu-title-noDropdown,
104
+ .el-submenu__title {
105
+ /* &:hover {
106
+ background-color: rgba(0, 0, 0, 0.06) !important;
107
+ } */
108
+ }
74
109
 
75
- .is-active > .el-submenu__title {
76
- color: $base-sub-menu-active-text !important;
110
+ & .theme-dark .is-active > .el-submenu__title {
111
+ color: $base-menu-color-active !important;
112
+ // 二级菜单选中状态下箭头颜色
113
+ .el-submenu__icon-arrow.el-icon-arrow-down {
114
+ &::before {
115
+ color: #4a7ff8;
116
+ }
117
+ }
77
118
  }
78
119
 
79
120
  & .nest-menu .el-submenu > .el-submenu__title,
80
121
  & .el-submenu .el-menu-item {
81
- min-width: $base-sidebar-width !important;
82
- background-color: $base-sub-menu-background !important;
122
+ min-width: calc(#{$base-sidebar-width} - 32px) !important;
123
+ border-radius: 8px !important;
124
+ font-weight: 400;
125
+ font-family: PingFangSC, PingFang SC;
126
+ display: flex;
127
+ align-items: center;
128
+
129
+ &:hover {
130
+ background-color: rgba(202, 210, 228, 0.3) !important;
131
+ }
132
+ // 添加二级菜单选中样式 🌟
133
+ &.is-active {
134
+ background-color: $base-menu-active-background !important;
135
+ color: $base-menu-color-active !important;
136
+
137
+ &:hover {
138
+ background-color: darken($base-menu-active-background, 5%) !important;
139
+ }
140
+ }
141
+ }
142
+
143
+ & .theme-dark .nest-menu .el-submenu > .el-submenu__title,
144
+ & .theme-dark .el-submenu .el-menu-item {
145
+ background-color: $base-sub-menu-background;
146
+ border-radius: 8px !important;
83
147
 
84
148
  &:hover {
85
149
  background-color: $base-sub-menu-hover !important;
@@ -88,12 +152,48 @@
88
152
  }
89
153
 
90
154
  .hideSidebar {
155
+ .submenu-title-noDropdown {
156
+ // 具体样式
157
+ &:hover {
158
+ // 收缩状态下没有子菜单的悬停颜色
159
+ background-color: transparent !important;
160
+ }
161
+ }
91
162
  .sidebar-container {
92
- width: 54px !important;
163
+ width: 80px !important;
164
+ }
165
+ // 在这里添加收缩状态下二级菜单的样式 ✨
166
+ .el-submenu.is-active {
167
+ background-color: #fff !important; // 收缩状态下的背景色
168
+ .el-submenu__title {
169
+ &:hover {
170
+ // 收缩状态下选中菜单的悬停颜色
171
+ background-color: #fff !important;
172
+ }
173
+ }
174
+ }
175
+ .el-submenu {
176
+ border-radius: 8px;
177
+ .el-submenu__title {
178
+ &:hover {
179
+ // 收缩状态下有子菜单的悬停颜色
180
+ background: transparent !important;
181
+ }
182
+ }
93
183
  }
94
184
 
185
+ .nest-menu .el-submenu > .el-submenu__title,
186
+ .el-submenu .el-menu-item {
187
+ background-color: #fff !important; // 二级菜单普通状态背景色
188
+ border-radius: 8px !important;
189
+
190
+ &.is-active {
191
+ background-color: #fff !important; // 二级菜单选中状态背景色
192
+ color: #4a7ff8 !important;
193
+ }
194
+ }
95
195
  .main-container {
96
- margin-left: 54px;
196
+ margin-left: 68px;
97
197
  }
98
198
 
99
199
  .submenu-title-noDropdown {
@@ -104,11 +204,7 @@
104
204
  padding: 0 !important;
105
205
 
106
206
  .svg-icon {
107
- margin-left: 20px;
108
- }
109
-
110
- .sub-el-icon {
111
- margin-left: 19px;
207
+ margin-left: 17px;
112
208
  }
113
209
  }
114
210
  }
@@ -120,15 +216,7 @@
120
216
  padding: 0 !important;
121
217
 
122
218
  .svg-icon {
123
- margin-left: 20px;
124
- }
125
-
126
- .sub-el-icon {
127
- margin-left: 19px;
128
- }
129
-
130
- .el-submenu__icon-arrow {
131
- display: none;
219
+ margin-left: 17px;
132
220
  }
133
221
  }
134
222
  }
@@ -148,17 +236,80 @@
148
236
  }
149
237
  }
150
238
 
151
- .el-menu--collapse {
152
- width: 54px;
239
+ // 展开状态样式控制 ✨
240
+ .sidebar-container:not(.el-menu--collapse) {
241
+ // 一级菜单图标显示
242
+ & > .el-menu > .el-submenu > .el-submenu__title .svg-icon {
243
+ display: inline-block !important;
244
+ width: 1.2em;
245
+ height: 1.2em;
246
+ margin-right: 8px;
247
+ }
248
+
249
+ // 二级+菜单图标隐藏 🌈
250
+ .el-menu--inline {
251
+ .svg-icon {
252
+ display: none !important;
253
+ }
153
254
 
154
- .el-menu-item,
155
- .el-submenu__title {
156
- & > span {
157
- height: 0;
158
- width: 0;
159
- overflow: hidden;
160
- visibility: hidden;
161
- display: inline-block;
255
+ // 三级菜单特殊处理 🎯
256
+ .el-menu--inline {
257
+ .svg-icon {
258
+ display: none !important;
259
+ }
260
+ }
261
+ }
262
+ }
263
+
264
+ .el-menu--collapse .el-menu .el-submenu {
265
+ min-width: $base-sidebar-width !important;
266
+ }
267
+
268
+ // mobile responsive
269
+ .mobile {
270
+ .main-container {
271
+ margin-left: 0px;
272
+ }
273
+
274
+ .sidebar-container {
275
+ transition: transform 0.28s;
276
+ width: 80% !important; // 移动端侧边栏宽度为屏幕的80%
277
+ max-width: 280px; // 最大宽度限制
278
+ min-width: 200px; // 最小宽度限制
279
+ position: fixed;
280
+ top: 0;
281
+ left: 0;
282
+ height: 100vh;
283
+ z-index: 1000;
284
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
285
+ background-color: #fff !important; // 移动端侧边栏白色背景
286
+
287
+ // 覆盖菜单背景色
288
+ ::v-deep .el-menu {
289
+ background-color: #fff !important;
290
+ }
291
+
292
+ // 覆盖子菜单背景色
293
+ ::v-deep .el-submenu .el-menu {
294
+ background-color: #fff !important;
295
+ }
296
+
297
+ // 覆盖菜单项背景色
298
+ ::v-deep .el-menu-item,
299
+ ::v-deep .el-submenu__title {
300
+ background-color: #fff !important;
301
+
302
+ &:hover {
303
+ background-color: rgba(242, 242, 242, 1) !important;
304
+ }
305
+ }
306
+ }
307
+
308
+ &.hideSidebar {
309
+ .sidebar-container {
310
+ pointer-events: none;
311
+ transition-duration: 0.3s;
312
+ transform: translate3d(-100%, 0, 0); // 完全移出屏幕
162
313
  }
163
314
  }
164
315
  }
@@ -177,118 +328,109 @@
177
328
  .svg-icon {
178
329
  margin-right: 16px;
179
330
  }
180
-
181
- .sub-el-icon {
182
- margin-right: 12px;
183
- margin-left: -2px;
184
- }
331
+ }
332
+ // 设置整个弹出菜单容器的背景色 💖
333
+ & > .el-menu--popup {
334
+ background-color: #fff !important;
335
+ border-radius: 8px !important;
336
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
337
+ padding: 8px !important; // 上下12px,左右8px
338
+ width: max-content !important; // 改为真正的宽度自适应 ✨
339
+ min-width: 120px !important; // 设置最小宽度
340
+ max-width: 300px !important; // 设置最大宽度
185
341
  }
186
342
 
343
+ .nest-menu .el-submenu {
344
+ background-color: #fff !important;
345
+ }
187
346
  .nest-menu .el-submenu > .el-submenu__title,
188
347
  .el-menu-item {
348
+ height: auto !important; // 改为自动高度,让padding决定高度
349
+ line-height: 20px !important; // 调整行高
350
+ margin: 8px 0 !important; // 调整间距
351
+ padding: 5px 24px !important;
352
+ background-color: #fff !important;
353
+ border-radius: 8px !important;
354
+ span {
355
+ margin-right: 15px;
356
+ }
357
+ .el-submenu__icon-arrow.el-icon-arrow-right {
358
+ //收缩状态下箭头样式
359
+ font-size: 16px;
360
+ font-weight: 600;
361
+ }
189
362
  &:hover {
190
- // you can use $subMenuHover
191
- background-color: $base-menu-hover !important;
363
+ background-color: rgba(242, 242, 242, 1) !important;
364
+ .el-submenu__icon-arrow.el-icon-arrow-right {
365
+ transform: rotateZ(270deg);
366
+ &::before {
367
+ color: #4a7ff8 !important;
368
+ }
369
+ }
192
370
  }
193
- }
194
- }
195
-
196
- // the scrollBar style
197
- .el-scrollbar__wrap {
198
- overflow-x: scroll !important;
199
- }
200
371
 
201
- .el-scrollbar__bar.is-horizontal {
202
- display: none;
203
- }
204
-
205
- // 移动端样式
206
- @media (max-width: 768px) {
207
- .sidebar-container {
208
- width: 80% !important;
209
- background-color: $base-menu-background;
210
- height: 100%;
211
- position: fixed;
212
- font-size: 0px;
213
- top: 0;
214
- bottom: 0;
215
- left: 0;
216
- z-index: 1001;
217
- overflow: hidden;
218
- box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
372
+ &.is-active {
373
+ background-color: rgba(242, 242, 242, 1) !important; // 选中状态背景色
374
+ color: rgba(74, 127, 248, 1) !important; // 选中状态字体颜色
375
+ }
219
376
  }
220
377
 
221
- .main-container {
222
- margin-left: 0 !important;
223
- }
378
+ /* .el-menu-item.is-active {
379
+ background-color: $base-menu-active-background !important; // 🌈 使用变量设置选中背景色
380
+ color: $base-menu-color-active !important;
381
+ font-weight: 600;
224
382
 
225
- .hideSidebar {
226
- .sidebar-container {
227
- transform: translateX(-100%);
383
+ &:hover {
384
+ background-color: darken(
385
+ $base-menu-active-background,
386
+ 5%
387
+ ) !important; // 🎨 悬停时稍深
228
388
  }
229
389
  }
230
- }
231
-
232
- // 子菜单样式
233
- .el-submenu {
234
- .el-menu {
235
- background-color: $base-sub-menu-background !important;
236
- border-radius: 4px;
237
- padding: 4px 0;
390
+ */
391
+ // 子菜单选中状态
392
+ .el-submenu.is-active .el-submenu__title {
393
+ color: $base-menu-color-active !important;
238
394
  }
395
+ // the scroll bar appears when the subMenu is too long
396
+ > .el-menu--popup {
397
+ max-height: 100vh;
398
+ overflow-y: auto;
239
399
 
240
- .el-menu-item {
241
- padding-left: 50px !important;
242
- min-height: 40px;
243
- line-height: 40px;
244
- font-size: 13px;
245
- color: $base-menu-color;
246
- transition: all 0.3s;
247
-
248
- &:hover {
249
- background-color: $base-sub-menu-hover !important;
250
- color: $base-menu-active-color !important;
400
+ &::-webkit-scrollbar-track-piece {
401
+ background: #d3dce6;
251
402
  }
252
403
 
253
- &.is-active {
254
- background-color: $base-sub-menu-active !important;
255
- color: $base-menu-active-color !important;
256
- font-weight: 500;
404
+ &::-webkit-scrollbar {
405
+ width: 6px;
257
406
  }
258
- }
259
- }
260
-
261
- // 菜单项样式
262
- .el-menu-item {
263
- min-height: 50px;
264
- line-height: 50px;
265
- font-size: 14px;
266
- color: $base-menu-color;
267
- transition: all 0.3s;
268
-
269
- &:hover {
270
- background-color: $base-menu-hover !important;
271
- color: $base-menu-active-color !important;
272
- }
273
407
 
274
- &.is-active {
275
- background-color: $base-menu-active !important;
276
- color: $base-menu-active-color !important;
277
- font-weight: 500;
408
+ &::-webkit-scrollbar-thumb {
409
+ background: #99a9bf;
410
+ border-radius: 20px;
411
+ }
278
412
  }
279
413
  }
280
-
281
- // 滚动条样式
282
- .el-scrollbar__wrap::-webkit-scrollbar {
283
- width: 4px;
284
- height: 4px;
414
+ .sidebar-container {
415
+ padding: 0 16px; /* 添加这行来设置整体内边距 */
285
416
  }
286
-
287
- .el-scrollbar__wrap::-webkit-scrollbar-thumb {
288
- background: rgba(144, 147, 153, 0.3);
289
- border-radius: 4px;
417
+ // 添加子菜单箭头样式覆盖
418
+ .el-submenu__icon-arrow {
419
+ position: absolute;
420
+ top: 50%;
421
+ right: 16px !important; /* 修改为0,并添加!important确保覆盖 */
422
+ margin-top: -7px;
423
+ -webkit-transition: -webkit-transform 0.3s;
424
+ transition: -webkit-transform 0.3s;
425
+ transition: transform 0.3s;
426
+ transition: transform 0.3s, -webkit-transform 0.3s;
427
+ font-size: 16px;
428
+ color: #999;
429
+ transform: rotateZ(270deg);
290
430
  }
291
-
292
- .el-scrollbar__wrap::-webkit-scrollbar-track {
293
- background: transparent;
431
+ // 侧边栏收缩时隐藏箭头 ✨
432
+ .hideSidebar {
433
+ .el-submenu__icon-arrow {
434
+ display: none !important;
435
+ }
294
436
  }
@@ -20,11 +20,6 @@ $base-logo-light-title-color: #001529; // 🌅 浅色主题Logo标题颜色 -
20
20
 
21
21
  $base-sub-menu-background: transparent; // 🎨 子菜单背景色
22
22
  $base-sub-menu-hover: rgba(202, 210, 228, 0.3); // 🖱️ 子菜单悬停背景色
23
- $base-menu-hover: rgba(202, 210, 228, 0.3); // 🖱️ 菜单悬停背景色
24
- $base-sub-menu-active: rgba(202, 210, 228, 0.5); // ✨ 子菜单激活背景色
25
- $base-sub-menu-active-text: rgb(74, 127, 248); // 💫 子菜单激活文字颜色
26
- $base-menu-active: rgba(202, 210, 228, 0.5); // ✨ 菜单激活背景色
27
- $base-menu-active-color: rgb(74, 127, 248); // 💫 菜单激活文字颜色
28
23
 
29
24
  //自定义新增
30
25
  $base-menu-active-background: #fff; // 🌟 新增:菜单选中背景色 -
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 判断path是否为外链
3
+ * @param {string} path
4
+ * @returns {Boolean}
5
+ */
6
+ export function isExternal(path) {
7
+ return /^(https?:|mailto:|tel:)/.test(path);
8
+ }