afn-basic-components 1.1.2 → 1.1.3

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