kui-vue 3.2.3-rc3 → 3.2.6
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/_tool/utils.js +11 -5
- package/components/affix/affix.jsx +20 -7
- package/components/affix/index.md +6 -5
- package/components/alert/styles/index.less +19 -19
- package/components/avatar/avatar.jsx +63 -0
- package/components/avatar/demo/base.md +24 -0
- package/components/avatar/demo/change.md +40 -0
- package/components/avatar/demo/index.vue +20 -0
- package/components/avatar/demo/info.md +7 -0
- package/components/avatar/demo/types.md +23 -0
- package/components/avatar/index.js +2 -0
- package/components/avatar/index.md +7 -0
- package/components/avatar/styles/index.less +61 -0
- package/components/backtop/styles/index.less +2 -2
- package/components/badge/demo/dot.md +1 -1
- package/components/badge/demo/dynamic.md +1 -1
- package/components/badge/demo/max.md +1 -1
- package/components/badge/styles/index.less +21 -21
- package/components/base/input.jsx +16 -10
- package/components/base/pop.jsx +7 -4
- package/components/breadcrumb/styles/index.less +4 -4
- package/components/button/button.jsx +14 -8
- package/components/button/buttonGroup.jsx +6 -6
- package/components/button/demo/base.md +2 -1
- package/components/button/demo/disabled.md +14 -16
- package/components/button/demo/group.md +2 -2
- package/components/button/demo/index.vue +6 -2
- package/components/button/demo/light.md +26 -0
- package/components/button/demo/loading.md +1 -1
- package/components/button/demo/normal.md +25 -0
- package/components/button/demo/size.md +2 -2
- package/components/button/demo/solid.md +16 -0
- package/components/button/demo/with-icon.md +4 -3
- package/components/button/index.md +3 -3
- package/components/button/styles/index.less +113 -51
- package/components/card/demo/base.md +1 -1
- package/components/card/demo/border.md +2 -2
- package/components/card/styles/index.less +6 -6
- package/components/carousel/styles/index.less +1 -1
- package/components/checkbox/demo/group-vertical.md +47 -0
- package/components/checkbox/demo/index.vue +4 -0
- package/components/checkbox/demo/options.md +46 -0
- package/components/checkbox/group.jsx +9 -3
- package/components/checkbox/index.md +8 -7
- package/components/checkbox/styles/index.less +35 -21
- package/components/collapse/styles/index.less +10 -10
- package/components/colorPicker/colorpicker.jsx +27 -15
- package/components/colorPicker/demo/base.md +1 -1
- package/components/colorPicker/demo/index.vue +2 -0
- package/components/colorPicker/demo/shape.md +33 -0
- package/components/colorPicker/index.md +10 -7
- package/components/colorPicker/styles/index.less +42 -25
- package/components/datePicker/datecalendar.jsx +14 -12
- package/components/datePicker/datepicker.jsx +17 -6
- package/components/datePicker/demo/index.vue +2 -0
- package/components/datePicker/demo/theme.md +34 -0
- package/components/datePicker/index.md +4 -1
- package/components/datePicker/styles/calendar.less +39 -38
- package/components/datePicker/styles/datepicker.less +39 -22
- package/components/divider/styles/index.less +6 -6
- package/components/drawer/demo/custom.md +1 -1
- package/components/drawer/demo/form.md +1 -1
- package/components/drawer/drawer.jsx +5 -4
- package/components/drawer/styles/index.less +12 -10
- package/components/dropdown/demo/base.md +4 -4
- package/components/dropdown/demo/cascading.md +3 -3
- package/components/dropdown/demo/divider.md +3 -3
- package/components/dropdown/dropdown.jsx +0 -1
- package/components/dropdown/styles/index.less +4 -4
- package/components/empty/empty.jsx +2 -1
- package/components/empty/styles/index.less +2 -2
- package/components/form/demo/base.md +25 -2
- package/components/form/demo/index.vue +1 -1
- package/components/form/demo/valid.md +9 -0
- package/components/form/form.jsx +3 -1
- package/components/form/formitem.jsx +18 -10
- package/components/form/styles/index.less +17 -13
- package/components/grid/styles/index.less +1 -1
- package/components/icon/demo/base.md +4 -4
- package/components/icon/demo/search.vue +7 -10
- package/components/icon/index.md +1 -1
- package/components/image/styles/index.less +18 -18
- package/components/index.js +19 -3
- package/components/input/demo/index.vue +3 -1
- package/components/input/demo/size.md +3 -3
- package/components/input/demo/theme.md +39 -0
- package/components/input/index.md +9 -6
- package/components/input/input.jsx +10 -3
- package/components/input/styles/index.less +124 -82
- package/components/input/textarea.jsx +1 -0
- package/components/layout/demo/base.md +5 -3
- package/components/layout/demo/index.vue +0 -2
- package/components/layout/demo/info.md +0 -2
- package/components/layout/demo/layout1.md +40 -47
- package/components/layout/demo/layout2.md +42 -49
- package/components/layout/demo/layout3.md +44 -22
- package/components/layout/demo/layout4.md +19 -18
- package/components/layout/demo/layout5.md +47 -44
- package/components/layout/styles/index.less +1 -6
- package/components/loading/styles/index.less +4 -4
- package/components/locale/index.js +74 -0
- package/components/locale/lang/de.js +54 -0
- package/components/locale/lang/el.js +71 -0
- package/components/locale/lang/en.js +54 -0
- package/components/locale/lang/fr.js +71 -0
- package/components/locale/lang/it.js +71 -0
- package/components/locale/lang/ja.js +71 -0
- package/components/locale/lang/ko.js +71 -0
- package/components/locale/lang/ru.js +54 -0
- package/components/locale/lang/th.js +71 -0
- package/components/locale/lang/ua.js +54 -0
- package/components/locale/lang/vi.js +54 -0
- package/components/locale/lang/zh-CN.js +54 -0
- package/components/locale/lang/zh-TW.js +54 -0
- package/components/menu/demo/accrodion.md +2 -2
- package/components/menu/demo/base.md +5 -13
- package/components/menu/demo/collapsed.md +2 -2
- package/components/menu/demo/index.vue +0 -2
- package/components/menu/demo/inline.md +6 -10
- package/components/menu/demo/mode.md +2 -2
- package/components/menu/demo/theme.md +2 -2
- package/components/menu/demo/vertical.md +2 -2
- package/components/menu/index.md +0 -3
- package/components/menu/menu.jsx +4 -4
- package/components/menu/menuitem.jsx +1 -13
- package/components/menu/styles/dropmenu.less +28 -20
- package/components/menu/styles/index.less +148 -251
- package/components/menu/submenu.jsx +4 -64
- package/components/message/group.jsx +1 -1
- package/components/message/styles/index.less +13 -8
- package/components/modal/demo/base.md +15 -2
- package/components/modal/demo/custom.md +3 -3
- package/components/modal/demo/more.md +6 -6
- package/components/modal/index.js +3 -3
- package/components/modal/modal.jsx +17 -10
- package/components/modal/styles/index.less +24 -17
- package/components/notice/styles/index.less +14 -13
- package/components/page/page.jsx +4 -3
- package/components/page/styles/index.less +29 -29
- package/components/popconfirm/popconfirm.jsx +2 -2
- package/components/popconfirm/styles/index.less +6 -6
- package/components/poptip/styles/index.less +10 -9
- package/components/progress/styles/index.less +13 -13
- package/components/radio/button.jsx +2 -2
- package/components/radio/demo/button.md +3 -3
- package/components/radio/demo/group-vertical.md +46 -0
- package/components/radio/demo/index.vue +4 -0
- package/components/radio/demo/options.md +43 -0
- package/components/radio/group.jsx +14 -8
- package/components/radio/index.md +11 -9
- package/components/radio/styles/index.less +37 -23
- package/components/rate/styles/index.less +2 -2
- package/components/select/demo/filterable.md +6 -14
- package/components/select/demo/icon.md +40 -0
- package/components/select/demo/index.vue +4 -0
- package/components/select/demo/search.md +6 -4
- package/components/select/demo/size.md +5 -5
- package/components/select/demo/theme.md +46 -0
- package/components/select/index.md +21 -17
- package/components/select/select.jsx +26 -16
- package/components/select/styles/index.less +125 -51
- package/components/slider/demo/base.md +35 -0
- package/components/slider/demo/index.vue +18 -0
- package/components/slider/demo/info.md +7 -0
- package/components/slider/demo/vertical.md +13 -0
- package/components/slider/index.md +7 -0
- package/components/slider/slider.jsx +65 -0
- package/components/slider/styles/index.less +60 -32
- package/components/space/demo/align.md +46 -0
- package/components/space/demo/base.md +20 -0
- package/components/space/demo/custom-size.md +35 -0
- package/components/space/demo/index.vue +25 -0
- package/components/space/demo/info.md +11 -0
- package/components/space/demo/size.md +35 -0
- package/components/space/demo/vertical.md +19 -0
- package/components/space/index.js +2 -0
- package/components/space/index.md +6 -0
- package/components/space/space.jsx +57 -0
- package/components/space/styles/index.less +23 -0
- package/components/spin/styles/index.less +7 -11
- package/components/steps/styles/index.less +11 -11
- package/components/styles/color.less +158 -0
- package/components/styles/index.less +6 -1
- package/components/styles/sys.less +34 -0
- package/components/styles/var.less +150 -0
- package/components/switch/styles/index.less +11 -11
- package/components/table/index.md +4 -3
- package/components/table/styles/index.less +29 -32
- package/components/table/table.jsx +2 -1
- package/components/tabs/styles/index.less +20 -19
- package/components/tabs/tabs.jsx +1 -1
- package/components/tag/styles/index.less +45 -45
- package/components/timeline/demo/base.md +3 -3
- package/components/timeline/demo/icon.md +5 -5
- package/components/timeline/demo/mode.md +12 -6
- package/components/timeline/index.md +7 -6
- package/components/timeline/styles/index.less +43 -16
- package/components/timeline/timeline.jsx +5 -1
- package/components/timeline/timelineitem.jsx +9 -5
- package/components/tooltip/styles/index.less +19 -18
- package/components/tree/styles/index.less +15 -15
- package/components/treeselect/styles/index.less +5 -5
- package/components/upload/demo/accept.md +68 -0
- package/components/upload/demo/avatar.md +40 -0
- package/components/upload/demo/base.md +40 -0
- package/components/upload/demo/custom.md +47 -0
- package/components/upload/demo/directory.md +36 -0
- package/components/upload/demo/drag.md +0 -0
- package/components/upload/demo/draggable.md +45 -0
- package/components/upload/demo/exceed.md +42 -0
- package/components/upload/demo/file-list.md +42 -0
- package/components/upload/demo/form.md +120 -0
- package/components/upload/demo/index.vue +37 -0
- package/components/upload/demo/info.md +10 -0
- package/components/upload/demo/picture.md +54 -0
- package/components/upload/index.md +26 -0
- package/components/upload/styles/index.less +258 -0
- package/components/upload/upload.jsx +337 -0
- package/dist/k-ui.css +7 -1
- package/dist/k-ui.js +2 -2
- package/package.json +11 -5
- package/components/button/demo/hollow.md +0 -15
- package/components/layout/demo/layout6.md +0 -142
- package/components/menu/demo/vertical-affix.md +0 -69
- package/components/slider/demo/slider.js +0 -5
- package/components/slider/slider.vue +0 -21
- package/components/slider/sliderButton.vue +0 -76
- package/components/styles/dark.less +0 -67
- package/components/styles/global-dark.less +0 -36
- package/components/styles/global.less +0 -44
- package/components/upload/upload.vue +0 -137
- package/dist/k-ui-dark.css +0 -1
|
@@ -146,12 +146,12 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
146
146
|
let hasTop = placement.slice(0, 3) == 'top'
|
|
147
147
|
let hasLeft = placement.slice(0, 4) == 'left'
|
|
148
148
|
let hasRight = placement.slice(0, 5) == 'right'
|
|
149
|
-
|
|
149
|
+
// debugger
|
|
150
150
|
if (hasBottom || hasTop) {
|
|
151
151
|
if ((hasBottom && showInBottom) || (hasTop && !showInTop)) { //正常在底部显示
|
|
152
152
|
if (transfer) {
|
|
153
153
|
top = selectionRect.bottom + offset + scrollTop;
|
|
154
|
-
left = selectionRect.left + scrollLeft
|
|
154
|
+
left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
155
155
|
if (placement == 'bottom' || placement == 'top') {
|
|
156
156
|
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
157
157
|
}
|
|
@@ -161,13 +161,16 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
161
161
|
if (hasTop) {
|
|
162
162
|
placement = placement.replace('top', 'bottom')
|
|
163
163
|
}
|
|
164
|
+
if (!showInRight) {
|
|
165
|
+
placement = placement.replace('left', 'right') //右边放不下去
|
|
166
|
+
}
|
|
164
167
|
} else {
|
|
165
168
|
top = selectionRect.height + offset;
|
|
166
169
|
left = 0;
|
|
167
170
|
}
|
|
168
171
|
} else if ((hasBottom && !showInBottom) || (hasTop && showInTop)) {
|
|
169
172
|
if (transfer) {
|
|
170
|
-
left = selectionRect.left + scrollLeft
|
|
173
|
+
left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
171
174
|
top = selectionRect.top - pickerHeight - offset + scrollTop
|
|
172
175
|
if (placement == 'top' || placement == 'bottom') {
|
|
173
176
|
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
@@ -178,6 +181,9 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
178
181
|
if (hasBottom) {
|
|
179
182
|
placement = placement.replace('bottom', 'top')
|
|
180
183
|
}
|
|
184
|
+
if (!showInRight) {
|
|
185
|
+
placement = placement.replace('left', 'right')
|
|
186
|
+
}
|
|
181
187
|
} else {
|
|
182
188
|
top = -(pickerHeight + offset);
|
|
183
189
|
left = 0;
|
|
@@ -237,10 +243,10 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
237
243
|
}
|
|
238
244
|
export function getOffset(el) {
|
|
239
245
|
// const rect = el.getBoundingClientRect();
|
|
240
|
-
const pos = {
|
|
246
|
+
const pos = el ? {
|
|
241
247
|
left: el.offsetLeft,//rect.left,
|
|
242
248
|
top: el.offsetTop,
|
|
243
|
-
}
|
|
249
|
+
} : { left: 0, top: 0 }
|
|
244
250
|
return pos;
|
|
245
251
|
}
|
|
246
252
|
|
|
@@ -25,13 +25,15 @@ export default {
|
|
|
25
25
|
offsetTopValue: 0,
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
beforeDestory() {
|
|
29
|
+
if (this.target() == window) {
|
|
30
|
+
target.removeEventListener('scroll', this.updatePosition)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
29
33
|
mounted() {
|
|
30
34
|
let target = this.target()
|
|
31
35
|
if (target) {
|
|
32
|
-
target.addEventListener('scroll',
|
|
33
|
-
this.updatePosition(e)
|
|
34
|
-
})
|
|
36
|
+
target.addEventListener('scroll', this.updatePosition)
|
|
35
37
|
}
|
|
36
38
|
},
|
|
37
39
|
methods: {
|
|
@@ -41,18 +43,29 @@ export default {
|
|
|
41
43
|
if (!$refs.blob || !target) return;
|
|
42
44
|
|
|
43
45
|
let rect = $refs.blob.getBoundingClientRect();
|
|
44
|
-
let
|
|
46
|
+
let container = (target != window && target != document) ? target.getBoundingClientRect() : { top: 0, bottom: document.documentElement.clientHeight }
|
|
45
47
|
|
|
46
48
|
let hasbottom = typeof offsetBottom == 'number' && offsetBottom >= 0
|
|
47
|
-
let fx = hasbottom ?
|
|
49
|
+
let fx = hasbottom ? container.bottom - rect.bottom >= offsetBottom : rect.top - container.top <= offsetTop
|
|
50
|
+
|
|
48
51
|
if (!fx) {
|
|
49
52
|
this.offsetTopValue = rect.top
|
|
53
|
+
if (target == window || target == document) {
|
|
54
|
+
if (this.offsetTopValue > offsetTop && !hasbottom) {
|
|
55
|
+
this.offsetTopValue = offsetTop
|
|
56
|
+
}
|
|
57
|
+
if (hasbottom && container.bottom - rect.bottom < offsetBottom) {
|
|
58
|
+
this.offsetTopValue = container.bottom - offsetBottom - rect.height
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
//todo:
|
|
62
|
+
}
|
|
50
63
|
}
|
|
51
64
|
if (this.fixed != fx) {
|
|
52
65
|
this.fixed = fx
|
|
53
|
-
this.$emit('change', this.fixed)
|
|
54
66
|
this.width = rect.width
|
|
55
67
|
this.height = rect.height
|
|
68
|
+
this.$emit('change', this.fixed)
|
|
56
69
|
}
|
|
57
70
|
}
|
|
58
71
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
## API
|
|
2
2
|
|
|
3
|
-
| 属性 | 说明
|
|
4
|
-
| ------------ |
|
|
5
|
-
| offsetTop | 距离窗口顶部达到指定偏移量后触发
|
|
6
|
-
| offsetBottom | 距离窗口底部达到指定偏移量后触发
|
|
7
|
-
| change | 在固定状态发生改变时触发, 返回当前固定状态 `false` , `true`
|
|
3
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
4
|
+
| ------------ | -------------------------------------------------------------------- | -------------- | ------ |
|
|
5
|
+
| offsetTop | 距离窗口顶部达到指定偏移量后触发 | String, Number | 0 |
|
|
6
|
+
| offsetBottom | 距离窗口底部达到指定偏移量后触发 | String, Number | - |
|
|
7
|
+
| change | 在固定状态发生改变时触发, 返回当前固定状态 `false` , `true` | Function | - |
|
|
8
|
+
| target | 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | HTMLElement | window |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@import '../../styles/
|
|
1
|
+
@import '../../styles/var.less';
|
|
2
2
|
.k-alert {
|
|
3
|
-
border-radius:
|
|
3
|
+
border-radius: var(--kui-border-radius);
|
|
4
4
|
margin-bottom: 16px;
|
|
5
5
|
padding: 8px 15px;
|
|
6
6
|
box-sizing: border-box;
|
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
font-size: 12px;
|
|
10
10
|
transition: all .3s;
|
|
11
11
|
overflow: hidden;
|
|
12
|
-
background:
|
|
13
|
-
border: 1px solid
|
|
12
|
+
background: var(--kui-color-warning-90);
|
|
13
|
+
border: 1px solid var(--kui-color-warning-80);
|
|
14
14
|
&-icon {
|
|
15
|
-
color:
|
|
15
|
+
color: var(--kui-color-warning);
|
|
16
16
|
position: absolute;
|
|
17
17
|
top: 8px;
|
|
18
18
|
left: 10px;
|
|
19
19
|
font-size: 20px;
|
|
20
20
|
}
|
|
21
21
|
&-message {
|
|
22
|
-
color:
|
|
22
|
+
color: var(--kui-color-font);
|
|
23
23
|
}
|
|
24
24
|
&-has-icon {
|
|
25
25
|
padding-left: 38px;
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
font-size: 14px;
|
|
41
41
|
font-weight: 500;
|
|
42
42
|
margin-bottom: 5px;
|
|
43
|
-
color:
|
|
43
|
+
color: var(--kui-color-font);
|
|
44
44
|
}
|
|
45
45
|
.k-alert-description {
|
|
46
46
|
font-size: 14px;
|
|
47
|
-
color:
|
|
47
|
+
color: var(--kui-color-font);
|
|
48
48
|
}
|
|
49
49
|
&.k-alert-has-icon {
|
|
50
50
|
padding-left: 50px;
|
|
@@ -60,32 +60,32 @@
|
|
|
60
60
|
top: 8px;
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
text-decoration: none;
|
|
63
|
-
color:
|
|
63
|
+
color: var(--kui-color-font);
|
|
64
64
|
padding: 0px 5px;
|
|
65
65
|
&:hover {
|
|
66
66
|
text-decoration: none;
|
|
67
|
-
color:
|
|
67
|
+
color: var(--kui-color-danger);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
&-success {
|
|
71
|
-
background:
|
|
72
|
-
border-color:
|
|
71
|
+
background: var(--kui-color-success-90);
|
|
72
|
+
border-color: var(--kui-color-success-80);
|
|
73
73
|
.k-alert-icon {
|
|
74
|
-
color:
|
|
74
|
+
color: var(--kui-color-success);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
&-error {
|
|
78
|
-
background:
|
|
79
|
-
border-color:
|
|
78
|
+
background: var(--kui-color-danger-90);
|
|
79
|
+
border-color: var(--kui-color-danger-80);
|
|
80
80
|
.k-alert-icon {
|
|
81
|
-
color:
|
|
81
|
+
color: var(--kui-color-danger);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
&-info {
|
|
85
|
-
background:
|
|
86
|
-
border-color:
|
|
85
|
+
background: var(--kui-color-main-90);
|
|
86
|
+
border-color: var(--kui-color-main-80);
|
|
87
87
|
.k-alert-icon {
|
|
88
|
-
color:
|
|
88
|
+
color: var(--kui-color-main);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
&-slide-leave-to {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Icon from '../icon'
|
|
2
|
+
import { getChild, isVnode } from '../_tool/utils'
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
icon: String,
|
|
6
|
+
shape: { type: String, },
|
|
7
|
+
size: {
|
|
8
|
+
type: [Number, String],
|
|
9
|
+
default: 'default',
|
|
10
|
+
validator: (val) => typeof val == 'number' ? 1 : ['large', 'small', 'default'].indexOf(val) >= 0
|
|
11
|
+
},
|
|
12
|
+
src: String
|
|
13
|
+
},
|
|
14
|
+
updated() {
|
|
15
|
+
this.udpateSize()
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
udpateSize() {
|
|
19
|
+
let inner = this.$refs.inner
|
|
20
|
+
if (inner) {
|
|
21
|
+
let scale = 1, max = this.$el.offsetWidth - 8;
|
|
22
|
+
if (inner.scrollWidth > max)
|
|
23
|
+
scale = (max) / inner.scrollWidth
|
|
24
|
+
inner.style = 'transform: scale(' + scale + ') translateX(-50%);'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
mounted() {
|
|
29
|
+
this.udpateSize()
|
|
30
|
+
},
|
|
31
|
+
render() {
|
|
32
|
+
let { size, shape, src, icon } = this
|
|
33
|
+
let styles = {}
|
|
34
|
+
if (typeof size == 'number') {
|
|
35
|
+
styles = {
|
|
36
|
+
width: `${size}px`,
|
|
37
|
+
height: `${size}px`,
|
|
38
|
+
lineHeight: `${size}px`,
|
|
39
|
+
fontSize: `${size / 2}px`,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
let child = getChild(this.$slots.default)
|
|
43
|
+
let hasIcon = child.filter(x => (x.componentOptions || {}).tag == 'Icon').length
|
|
44
|
+
let text = child.filter(x => !x.context).length == child.length
|
|
45
|
+
|
|
46
|
+
let cls = ['k-avatar', {
|
|
47
|
+
'k-avatar-lg': size == 'large',
|
|
48
|
+
'k-avatar-sm': size == 'small',
|
|
49
|
+
'k-avatar-image': src,
|
|
50
|
+
'k-avatar-icon': icon || hasIcon,
|
|
51
|
+
'k-avatar-square': shape == 'square'
|
|
52
|
+
}]
|
|
53
|
+
return <div class={cls} style={styles} >
|
|
54
|
+
{
|
|
55
|
+
icon ?
|
|
56
|
+
<Icon type={icon} /> :
|
|
57
|
+
(
|
|
58
|
+
src ? <img src={src} /> : (text ? <span class="k-avatar-string" ref="inner">{child}</span> : child)
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
</div >
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 基本
|
|
3
|
+
头像有三种尺寸,两种形状可选。
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<div>
|
|
10
|
+
<Avatar :size="64" icon="person-outline" />
|
|
11
|
+
<Avatar size="large" icon="person-outline" />
|
|
12
|
+
<Avatar icon="person-outline" />
|
|
13
|
+
<Avatar size="small" icon="person-outline" />
|
|
14
|
+
</div>
|
|
15
|
+
<br />
|
|
16
|
+
<div>
|
|
17
|
+
<Avatar shape="square" :size="64" icon="person-outline" />
|
|
18
|
+
<Avatar shape="square" size="large" icon="person-outline" />
|
|
19
|
+
<Avatar shape="square" icon="person-outline" />
|
|
20
|
+
<Avatar shape="square" size="small" icon="person-outline" />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 自动调整字符大小
|
|
3
|
+
对于字符型的头像,当字符串较长时,字体大小可以根据头像宽度自动调整。
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<Avatar
|
|
10
|
+
size="large"
|
|
11
|
+
:style="{ backgroundColor: color, verticalAlign: 'middle' }"
|
|
12
|
+
>
|
|
13
|
+
{{ text }}
|
|
14
|
+
</Avatar>
|
|
15
|
+
<Button size="small" @click="changeValue">改变</Button>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
<script>
|
|
19
|
+
function ran(min, max) {
|
|
20
|
+
return parseInt((Math.random() * (max - min)) + min)
|
|
21
|
+
}
|
|
22
|
+
const userList = ['K', '王','邱先生', 'Jack', 'Jone'];
|
|
23
|
+
const colorList = ['#3a95ff', '#00bb5d', '#ff3300', '#ffa500'];
|
|
24
|
+
export default {
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
text: userList[0],
|
|
28
|
+
color: colorList[0],
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
changeValue() {
|
|
33
|
+
this.text = userList[ran(0,3)]
|
|
34
|
+
this.color = colorList[ran(0,3)]
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Info from './info.md'
|
|
3
|
+
import Base from './base.md'
|
|
4
|
+
import Types from './types.md'
|
|
5
|
+
import Change from './change.md'
|
|
6
|
+
import CN from '../index.md'
|
|
7
|
+
export default {
|
|
8
|
+
render() {
|
|
9
|
+
return (
|
|
10
|
+
<div>
|
|
11
|
+
<Info class="typo" />
|
|
12
|
+
<Base />
|
|
13
|
+
<Types />
|
|
14
|
+
<Change />
|
|
15
|
+
<CN class="typo" />
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 类型
|
|
3
|
+
支持三种类型:图片、Icon 以及字符,其中 Icon 和字符型可以自定义图标颜色及背景色。
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<Avatar icon="person-outline" />
|
|
10
|
+
<Avatar>
|
|
11
|
+
<Icon type="person-outline" />
|
|
12
|
+
</Avatar>
|
|
13
|
+
<Avatar>U</Avatar>
|
|
14
|
+
<Avatar>USER</Avatar>
|
|
15
|
+
<Avatar src="https://chuchur.com/img/icons/apple-icon-57x57.png" />
|
|
16
|
+
<Avatar style="color: #f51212; background-color: #ffc57d">
|
|
17
|
+
U
|
|
18
|
+
</Avatar>
|
|
19
|
+
<Avatar style="background-color:#d06868" icon="person-outline" />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## API
|
|
2
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
3
|
+
| ----- | ---------------------------- | -------------------------- | ------- |
|
|
4
|
+
| icon | 设置头像的图标类型 | String,Number | 400 |
|
|
5
|
+
| shape | 指定头像的形状 circle,square | String | circle |
|
|
6
|
+
| size | 设置头像的大小 | large,small,default,Number | default |
|
|
7
|
+
| src | 图片类头像的资源地址 | String | - |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@import '../../styles/var.less';
|
|
2
|
+
.k-avatar {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
color: #fff;
|
|
6
|
+
background-color: var(--kui-color-border);
|
|
7
|
+
border-radius: 50%;
|
|
8
|
+
height: 32px;
|
|
9
|
+
width: 32px;
|
|
10
|
+
line-height: 32px;
|
|
11
|
+
text-align: center;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
vertical-align: middle;
|
|
17
|
+
position: relative;
|
|
18
|
+
zoom: 1;
|
|
19
|
+
&>img {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
-o-object-fit: cover;
|
|
24
|
+
object-fit: cover;
|
|
25
|
+
}
|
|
26
|
+
&.k-avatar-icon {
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.k-avatar-lg {
|
|
32
|
+
width: 40px;
|
|
33
|
+
height: 40px;
|
|
34
|
+
line-height: 40px;
|
|
35
|
+
&.k-avatar-icon {
|
|
36
|
+
font-size: 24px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.k-avatar-sm {
|
|
41
|
+
width: 24px;
|
|
42
|
+
height: 24px;
|
|
43
|
+
line-height: 24px;
|
|
44
|
+
&.k-avatar-icon {
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.k-avatar-square {
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.k-avatar-image {
|
|
54
|
+
background-color: transparent;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.k-avatar-string {
|
|
58
|
+
position: absolute;
|
|
59
|
+
left: 50%;
|
|
60
|
+
transform-origin: 0 center;
|
|
61
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '../../styles/
|
|
1
|
+
@import '../../styles/var.less';
|
|
2
2
|
.k-backtop {
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
margin: 0;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
display: block;
|
|
15
15
|
overflow: hidden;
|
|
16
|
-
border-radius:
|
|
16
|
+
border-radius: var(--kui-border-radius);
|
|
17
17
|
&-content {
|
|
18
18
|
background-color: rgba(0, 0, 0, .45);
|
|
19
19
|
opacity: .5;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '../../styles/
|
|
1
|
+
@import '../../styles/var.less';
|
|
2
2
|
.k-badge {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: inline-block;
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
min-width: 20px;
|
|
16
16
|
background: #ed3f14;
|
|
17
17
|
color: #fff;
|
|
18
|
-
line-height:
|
|
18
|
+
line-height: 20px;
|
|
19
19
|
text-align: center;
|
|
20
20
|
padding: 0 6px;
|
|
21
21
|
font-size: 12px;
|
|
22
22
|
white-space: nowrap;
|
|
23
23
|
z-index: 10;
|
|
24
|
-
box-shadow: 0 0 0 1px
|
|
24
|
+
box-shadow: 0 0 0 1px var(--kui-color-back);
|
|
25
25
|
box-sizing: border-box;
|
|
26
26
|
}
|
|
27
27
|
&-mark {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
height: 6px;
|
|
55
55
|
width: 6px;
|
|
56
56
|
border-radius: 50%;
|
|
57
|
-
background:
|
|
57
|
+
background: var(--kui-color-danger);
|
|
58
58
|
z-index: 10;
|
|
59
59
|
box-shadow: 0 0 0 1px #fff;
|
|
60
60
|
}
|
|
@@ -68,18 +68,18 @@
|
|
|
68
68
|
border-radius: 50%;
|
|
69
69
|
}
|
|
70
70
|
&-status-text {
|
|
71
|
-
color:
|
|
71
|
+
color: var(--kui-color-font);
|
|
72
72
|
font-size: 14px;
|
|
73
73
|
margin-left: 8px;
|
|
74
74
|
}
|
|
75
75
|
&-status-success {
|
|
76
|
-
background-color:
|
|
76
|
+
background-color: var(--kui-color-success);
|
|
77
77
|
}
|
|
78
78
|
&-status-error {
|
|
79
|
-
background-color:
|
|
79
|
+
background-color: var(--kui-color-danger);
|
|
80
80
|
}
|
|
81
81
|
&-status-warning {
|
|
82
|
-
background-color:
|
|
82
|
+
background-color: var(--kui-color-warning);
|
|
83
83
|
}
|
|
84
84
|
&-status-default {
|
|
85
85
|
background-color: #ddd;
|
|
@@ -87,42 +87,42 @@
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
&-status-pink {
|
|
90
|
-
background-color:
|
|
90
|
+
background-color: var(--kui-color-pink);
|
|
91
91
|
}
|
|
92
92
|
&-status-red {
|
|
93
|
-
background-color:
|
|
93
|
+
background-color: var(--kui-color-red);
|
|
94
94
|
}
|
|
95
95
|
&-status-yellow {
|
|
96
|
-
background-color:
|
|
96
|
+
background-color: var(--kui-color-yellow);
|
|
97
97
|
}
|
|
98
98
|
&-status-orange {
|
|
99
|
-
background-color:
|
|
99
|
+
background-color: var(--kui-color-orange);
|
|
100
100
|
}
|
|
101
101
|
&-status-cyan {
|
|
102
|
-
background-color:
|
|
102
|
+
background-color: var(--kui-color-cyan);
|
|
103
103
|
}
|
|
104
104
|
&-status-green {
|
|
105
|
-
background-color:
|
|
105
|
+
background-color: var(--kui-color-green);
|
|
106
106
|
}
|
|
107
107
|
&-status-blue {
|
|
108
|
-
background-color:
|
|
108
|
+
background-color: var(--kui-color-blue);
|
|
109
109
|
}
|
|
110
110
|
&-status-purple {
|
|
111
|
-
background-color:
|
|
111
|
+
background-color: var(--kui-color-purple);
|
|
112
112
|
}
|
|
113
113
|
&-status-geekblue {
|
|
114
|
-
background-color:
|
|
114
|
+
background-color: var(--kui-color-geekblue);
|
|
115
115
|
}
|
|
116
116
|
&-status-magenta {
|
|
117
|
-
background-color:
|
|
117
|
+
background-color: var(--kui-color-magenta);
|
|
118
118
|
}
|
|
119
119
|
&-status-volcano {
|
|
120
|
-
background-color:
|
|
120
|
+
background-color: var(--kui-color-volcano);
|
|
121
121
|
}
|
|
122
122
|
&-status-gold {
|
|
123
|
-
background-color:
|
|
123
|
+
background-color: var(--kui-color-gold);
|
|
124
124
|
}
|
|
125
125
|
&-status-lime {
|
|
126
|
-
background-color:
|
|
126
|
+
background-color: var(--kui-color-lime);
|
|
127
127
|
}
|
|
128
128
|
}
|