kui-vue 3.2.3-rc3 → 3.2.6-rc

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 (245) hide show
  1. package/components/_tool/utils.js +11 -5
  2. package/components/affix/affix.jsx +20 -7
  3. package/components/affix/index.md +6 -5
  4. package/components/alert/styles/index.less +19 -19
  5. package/components/avatar/avatar.jsx +63 -0
  6. package/components/avatar/demo/base.md +24 -0
  7. package/components/avatar/demo/change.md +40 -0
  8. package/components/avatar/demo/index.vue +20 -0
  9. package/components/avatar/demo/info.md +7 -0
  10. package/components/avatar/demo/types.md +23 -0
  11. package/components/avatar/index.js +2 -0
  12. package/components/avatar/index.md +7 -0
  13. package/components/avatar/styles/index.less +61 -0
  14. package/components/backtop/styles/index.less +2 -2
  15. package/components/badge/demo/dot.md +1 -1
  16. package/components/badge/demo/dynamic.md +1 -1
  17. package/components/badge/demo/max.md +1 -1
  18. package/components/badge/styles/index.less +21 -21
  19. package/components/base/input.jsx +16 -10
  20. package/components/base/pop.jsx +7 -4
  21. package/components/breadcrumb/styles/index.less +4 -4
  22. package/components/button/button.jsx +14 -8
  23. package/components/button/buttonGroup.jsx +6 -6
  24. package/components/button/demo/base.md +2 -1
  25. package/components/button/demo/disabled.md +14 -16
  26. package/components/button/demo/group.md +2 -2
  27. package/components/button/demo/index.vue +6 -2
  28. package/components/button/demo/light.md +26 -0
  29. package/components/button/demo/loading.md +1 -1
  30. package/components/button/demo/normal.md +25 -0
  31. package/components/button/demo/size.md +2 -2
  32. package/components/button/demo/solid.md +16 -0
  33. package/components/button/demo/with-icon.md +4 -3
  34. package/components/button/index.md +3 -3
  35. package/components/button/styles/index.less +113 -51
  36. package/components/card/demo/base.md +1 -1
  37. package/components/card/demo/border.md +2 -2
  38. package/components/card/styles/index.less +6 -6
  39. package/components/carousel/styles/index.less +1 -1
  40. package/components/checkbox/demo/group-vertical.md +47 -0
  41. package/components/checkbox/demo/index.vue +4 -0
  42. package/components/checkbox/demo/options.md +46 -0
  43. package/components/checkbox/group.jsx +9 -3
  44. package/components/checkbox/index.md +8 -7
  45. package/components/checkbox/styles/index.less +35 -21
  46. package/components/collapse/styles/index.less +10 -10
  47. package/components/colorPicker/colorpicker.jsx +27 -15
  48. package/components/colorPicker/demo/base.md +1 -1
  49. package/components/colorPicker/demo/index.vue +2 -0
  50. package/components/colorPicker/demo/shape.md +33 -0
  51. package/components/colorPicker/index.md +10 -7
  52. package/components/colorPicker/styles/index.less +42 -25
  53. package/components/datePicker/datecalendar.jsx +14 -12
  54. package/components/datePicker/datepicker.jsx +17 -6
  55. package/components/datePicker/demo/index.vue +2 -0
  56. package/components/datePicker/demo/theme.md +34 -0
  57. package/components/datePicker/index.md +4 -1
  58. package/components/datePicker/styles/calendar.less +39 -38
  59. package/components/datePicker/styles/datepicker.less +39 -22
  60. package/components/divider/styles/index.less +6 -6
  61. package/components/drawer/demo/custom.md +1 -1
  62. package/components/drawer/demo/form.md +1 -1
  63. package/components/drawer/drawer.jsx +5 -4
  64. package/components/drawer/styles/index.less +12 -10
  65. package/components/dropdown/demo/base.md +4 -4
  66. package/components/dropdown/demo/cascading.md +3 -3
  67. package/components/dropdown/demo/divider.md +3 -3
  68. package/components/dropdown/dropdown.jsx +0 -1
  69. package/components/dropdown/styles/index.less +4 -4
  70. package/components/empty/empty.jsx +2 -1
  71. package/components/empty/styles/index.less +2 -2
  72. package/components/form/demo/base.md +25 -2
  73. package/components/form/demo/index.vue +1 -1
  74. package/components/form/demo/valid.md +9 -0
  75. package/components/form/form.jsx +3 -1
  76. package/components/form/formitem.jsx +18 -10
  77. package/components/form/styles/index.less +17 -13
  78. package/components/grid/styles/index.less +1 -1
  79. package/components/icon/demo/base.md +4 -4
  80. package/components/icon/demo/search.vue +7 -10
  81. package/components/icon/index.md +1 -1
  82. package/components/image/styles/index.less +18 -18
  83. package/components/index.js +19 -3
  84. package/components/input/demo/index.vue +3 -1
  85. package/components/input/demo/size.md +3 -3
  86. package/components/input/demo/theme.md +39 -0
  87. package/components/input/index.md +9 -6
  88. package/components/input/input.jsx +10 -3
  89. package/components/input/styles/index.less +124 -82
  90. package/components/input/textarea.jsx +1 -0
  91. package/components/layout/demo/base.md +5 -3
  92. package/components/layout/demo/index.vue +0 -2
  93. package/components/layout/demo/info.md +0 -2
  94. package/components/layout/demo/layout1.md +40 -47
  95. package/components/layout/demo/layout2.md +42 -49
  96. package/components/layout/demo/layout3.md +44 -22
  97. package/components/layout/demo/layout4.md +19 -18
  98. package/components/layout/demo/layout5.md +47 -44
  99. package/components/layout/styles/index.less +1 -6
  100. package/components/loading/styles/index.less +4 -4
  101. package/components/locale/index.js +74 -0
  102. package/components/locale/lang/de.js +54 -0
  103. package/components/locale/lang/el.js +71 -0
  104. package/components/locale/lang/en.js +54 -0
  105. package/components/locale/lang/fr.js +71 -0
  106. package/components/locale/lang/it.js +71 -0
  107. package/components/locale/lang/ja.js +71 -0
  108. package/components/locale/lang/ko.js +71 -0
  109. package/components/locale/lang/ru.js +54 -0
  110. package/components/locale/lang/th.js +71 -0
  111. package/components/locale/lang/ua.js +54 -0
  112. package/components/locale/lang/vi.js +54 -0
  113. package/components/locale/lang/zh-CN.js +54 -0
  114. package/components/locale/lang/zh-TW.js +54 -0
  115. package/components/menu/demo/accrodion.md +2 -2
  116. package/components/menu/demo/base.md +5 -13
  117. package/components/menu/demo/collapsed.md +2 -2
  118. package/components/menu/demo/index.vue +0 -2
  119. package/components/menu/demo/inline.md +6 -10
  120. package/components/menu/demo/mode.md +2 -2
  121. package/components/menu/demo/theme.md +2 -2
  122. package/components/menu/demo/vertical.md +2 -2
  123. package/components/menu/index.md +0 -3
  124. package/components/menu/menu.jsx +4 -4
  125. package/components/menu/menuitem.jsx +1 -13
  126. package/components/menu/styles/dropmenu.less +28 -20
  127. package/components/menu/styles/index.less +148 -251
  128. package/components/menu/submenu.jsx +4 -64
  129. package/components/message/group.jsx +1 -1
  130. package/components/message/styles/index.less +13 -8
  131. package/components/modal/demo/base.md +15 -2
  132. package/components/modal/demo/custom.md +3 -3
  133. package/components/modal/demo/more.md +6 -6
  134. package/components/modal/index.js +3 -3
  135. package/components/modal/modal.jsx +17 -10
  136. package/components/modal/styles/index.less +24 -17
  137. package/components/notice/styles/index.less +14 -13
  138. package/components/page/page.jsx +4 -3
  139. package/components/page/styles/index.less +29 -29
  140. package/components/popconfirm/popconfirm.jsx +2 -2
  141. package/components/popconfirm/styles/index.less +6 -6
  142. package/components/poptip/styles/index.less +10 -9
  143. package/components/progress/styles/index.less +13 -13
  144. package/components/radio/button.jsx +2 -2
  145. package/components/radio/demo/button.md +3 -3
  146. package/components/radio/demo/group-vertical.md +46 -0
  147. package/components/radio/demo/index.vue +4 -0
  148. package/components/radio/demo/options.md +43 -0
  149. package/components/radio/group.jsx +14 -8
  150. package/components/radio/index.md +11 -9
  151. package/components/radio/styles/index.less +37 -23
  152. package/components/rate/styles/index.less +2 -2
  153. package/components/select/demo/filterable.md +6 -14
  154. package/components/select/demo/icon.md +40 -0
  155. package/components/select/demo/index.vue +4 -0
  156. package/components/select/demo/search.md +6 -4
  157. package/components/select/demo/size.md +5 -5
  158. package/components/select/demo/theme.md +46 -0
  159. package/components/select/index.md +21 -17
  160. package/components/select/select.jsx +26 -16
  161. package/components/select/styles/index.less +125 -51
  162. package/components/slider/demo/base.md +35 -0
  163. package/components/slider/demo/index.vue +18 -0
  164. package/components/slider/demo/info.md +7 -0
  165. package/components/slider/demo/vertical.md +13 -0
  166. package/components/slider/index.md +7 -0
  167. package/components/slider/slider.jsx +65 -0
  168. package/components/slider/styles/index.less +60 -32
  169. package/components/space/demo/align.md +46 -0
  170. package/components/space/demo/base.md +20 -0
  171. package/components/space/demo/custom-size.md +35 -0
  172. package/components/space/demo/index.vue +25 -0
  173. package/components/space/demo/info.md +11 -0
  174. package/components/space/demo/size.md +35 -0
  175. package/components/space/demo/vertical.md +19 -0
  176. package/components/space/index.js +2 -0
  177. package/components/space/index.md +6 -0
  178. package/components/space/space.jsx +57 -0
  179. package/components/space/styles/index.less +23 -0
  180. package/components/spin/styles/index.less +7 -11
  181. package/components/steps/styles/index.less +11 -11
  182. package/components/styles/color.less +158 -0
  183. package/components/styles/index.less +6 -1
  184. package/components/styles/sys.less +34 -0
  185. package/components/styles/var.less +150 -0
  186. package/components/switch/styles/index.less +11 -11
  187. package/components/table/index.md +4 -3
  188. package/components/table/styles/index.less +29 -32
  189. package/components/table/table.jsx +2 -1
  190. package/components/tabs/styles/index.less +20 -19
  191. package/components/tabs/tabs.jsx +1 -1
  192. package/components/tag/styles/index.less +45 -45
  193. package/components/timeline/demo/base.md +3 -3
  194. package/components/timeline/demo/icon.md +5 -5
  195. package/components/timeline/demo/mode.md +12 -6
  196. package/components/timeline/index.md +7 -6
  197. package/components/timeline/styles/index.less +43 -16
  198. package/components/timeline/timeline.jsx +5 -1
  199. package/components/timeline/timelineitem.jsx +9 -5
  200. package/components/tooltip/styles/index.less +19 -18
  201. package/components/tree/styles/index.less +15 -15
  202. package/components/treeselect/styles/index.less +5 -5
  203. package/components/upload/demo/accept.md +68 -0
  204. package/components/upload/demo/avatar.md +40 -0
  205. package/components/upload/demo/base.md +40 -0
  206. package/components/upload/demo/custom.md +47 -0
  207. package/components/upload/demo/directory.md +36 -0
  208. package/components/upload/demo/drag.md +0 -0
  209. package/components/upload/demo/draggable.md +45 -0
  210. package/components/upload/demo/exceed.md +42 -0
  211. package/components/upload/demo/file-list.md +42 -0
  212. package/components/upload/demo/form.md +120 -0
  213. package/components/upload/demo/index.vue +37 -0
  214. package/components/upload/demo/info.md +10 -0
  215. package/components/upload/demo/picture.md +54 -0
  216. package/components/upload/index.md +26 -0
  217. package/components/upload/styles/index.less +258 -0
  218. package/components/upload/upload.jsx +337 -0
  219. package/dist/k-ui.css +7 -1
  220. package/dist/k-ui.js +2 -2
  221. package/dist/locale/de.js +8 -0
  222. package/dist/locale/el.js +8 -0
  223. package/dist/locale/en.js +8 -0
  224. package/dist/locale/fr.js +8 -0
  225. package/dist/locale/it.js +8 -0
  226. package/dist/locale/ja.js +8 -0
  227. package/dist/locale/ko.js +8 -0
  228. package/dist/locale/ru.js +8 -0
  229. package/dist/locale/th.js +8 -0
  230. package/dist/locale/ua.js +8 -0
  231. package/dist/locale/vi.js +8 -0
  232. package/dist/locale/zhCN.js +8 -0
  233. package/dist/locale/zhTW.js +8 -0
  234. package/package.json +11 -5
  235. package/components/button/demo/hollow.md +0 -15
  236. package/components/layout/demo/layout6.md +0 -142
  237. package/components/menu/demo/vertical-affix.md +0 -69
  238. package/components/slider/demo/slider.js +0 -5
  239. package/components/slider/slider.vue +0 -21
  240. package/components/slider/sliderButton.vue +0 -76
  241. package/components/styles/dark.less +0 -67
  242. package/components/styles/global-dark.less +0 -36
  243. package/components/styles/global.less +0 -44
  244. package/components/upload/upload.vue +0 -137
  245. 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', e => {
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 rect2 = target != window && target != document ? target.getBoundingClientRect() : { top: 0, bottom: document.documentElement.clientHeight }
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 ? rect2.bottom - rect.bottom >= offsetBottom : rect.top - rect2.top <= offsetTop
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 | 距离窗口顶部达到指定偏移量后触发 | String, Number | 0 |
6
- | offsetBottom | 距离窗口底部达到指定偏移量后触发 | String, Number | - |
7
- | change | 在固定状态发生改变时触发, 返回当前固定状态 `false` , `true` | Function | - |
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/global.less';
1
+ @import '../../styles/var.less';
2
2
  .k-alert {
3
- border-radius: @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: fadeout(@warning, 90%);
13
- border: 1px solid fadeout(@warning, 70%);
12
+ background: var(--kui-color-warning-90);
13
+ border: 1px solid var(--kui-color-warning-80);
14
14
  &-icon {
15
- color: @warning;
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: @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: @color;
43
+ color: var(--kui-color-font);
44
44
  }
45
45
  .k-alert-description {
46
46
  font-size: 14px;
47
- color: @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: @color;
63
+ color: var(--kui-color-font);
64
64
  padding: 0px 5px;
65
65
  &:hover {
66
66
  text-decoration: none;
67
- color: @danger;
67
+ color: var(--kui-color-danger);
68
68
  }
69
69
  }
70
70
  &-success {
71
- background: fadeout(@success, 90%);
72
- border-color: fadeout(@success, 70%);
71
+ background: var(--kui-color-success-90);
72
+ border-color: var(--kui-color-success-80);
73
73
  .k-alert-icon {
74
- color: @success;
74
+ color: var(--kui-color-success);
75
75
  }
76
76
  }
77
77
  &-error {
78
- background: fadeout(@danger, 90%);
79
- border-color: fadeout(@danger, 70%);
78
+ background: var(--kui-color-danger-90);
79
+ border-color: var(--kui-color-danger-80);
80
80
  .k-alert-icon {
81
- color: @danger;
81
+ color: var(--kui-color-danger);
82
82
  }
83
83
  }
84
84
  &-info {
85
- background: fadeout(@main, 90%);
86
- border-color: fadeout(@main, 70%);
85
+ background: var(--kui-color-main-90);
86
+ border-color: var(--kui-color-main-80);
87
87
  .k-alert-icon {
88
- color: @main;
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,7 @@
1
+ # BackTop 回到顶部
2
+ 返回页面顶部的操作按钮。
3
+
4
+ ## 何时使用
5
+ - 当页面内容区域比较长时;
6
+ - 当用户需要频繁返回顶部查看相关内容时。
7
+ ## 代码演示
@@ -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,2 @@
1
+ import Avatar from './avatar'
2
+ export default Avatar
@@ -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/global.less';
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: @radius;
16
+ border-radius: var(--kui-border-radius);
17
17
  &-content {
18
18
  background-color: rgba(0, 0, 0, .45);
19
19
  opacity: .5;
@@ -21,7 +21,7 @@
21
21
  .demo-dot .box{
22
22
  width:50px;
23
23
  height:50px;
24
- background:#ddd;
24
+ background:#7f7f7f55;
25
25
  border-radius:5px;
26
26
  }
27
27
  .demo-dot .k-badge{
@@ -41,7 +41,7 @@ export default{
41
41
  .demo-dot .box{
42
42
  width:50px;
43
43
  height:50px;
44
- background:#ddd;
44
+ background:#7f7f7f55;
45
45
  border-radius:5px;
46
46
  }
47
47
  .demo-dot .k-badge{
@@ -30,7 +30,7 @@
30
30
  .demo-dot .box{
31
31
  width:50px;
32
32
  height:50px;
33
- background:#ddd;
33
+ background:#7f7f7f55;
34
34
  border-radius:5px;
35
35
  }
36
36
  .demo-dot .k-badge{
@@ -1,4 +1,4 @@
1
- @import '../../styles/global.less';
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: 18px;
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 @back-color;
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: @danger;
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: @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: @success;
76
+ background-color: var(--kui-color-success);
77
77
  }
78
78
  &-status-error {
79
- background-color: @danger;
79
+ background-color: var(--kui-color-danger);
80
80
  }
81
81
  &-status-warning {
82
- background-color: @warning;
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: @pink;
90
+ background-color: var(--kui-color-pink);
91
91
  }
92
92
  &-status-red {
93
- background-color: @red;
93
+ background-color: var(--kui-color-red);
94
94
  }
95
95
  &-status-yellow {
96
- background-color: @yellow;
96
+ background-color: var(--kui-color-yellow);
97
97
  }
98
98
  &-status-orange {
99
- background-color: @orange;
99
+ background-color: var(--kui-color-orange);
100
100
  }
101
101
  &-status-cyan {
102
- background-color: @cyan;
102
+ background-color: var(--kui-color-cyan);
103
103
  }
104
104
  &-status-green {
105
- background-color: @green;
105
+ background-color: var(--kui-color-green);
106
106
  }
107
107
  &-status-blue {
108
- background-color: @blue;
108
+ background-color: var(--kui-color-blue);
109
109
  }
110
110
  &-status-purple {
111
- background-color: @purple;
111
+ background-color: var(--kui-color-purple);
112
112
  }
113
113
  &-status-geekblue {
114
- background-color: @geekblue;
114
+ background-color: var(--kui-color-geekblue);
115
115
  }
116
116
  &-status-magenta {
117
- background-color: @magenta;
117
+ background-color: var(--kui-color-magenta);
118
118
  }
119
119
  &-status-volcano {
120
- background-color: @volcano;
120
+ background-color: var(--kui-color-volcano);
121
121
  }
122
122
  &-status-gold {
123
- background-color: @gold;
123
+ background-color: var(--kui-color-gold);
124
124
  }
125
125
  &-status-lime {
126
- background-color: @lime;
126
+ background-color: var(--kui-color-lime);
127
127
  }
128
128
  }