kui-vue 3.4.9 → 3.5.0

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 (366) hide show
  1. package/LICENSE +1 -1
  2. package/components/affix/affix.jsx +42 -42
  3. package/components/alert/alert.jsx +12 -7
  4. package/components/avatar/AvatarGroup.jsx +8 -5
  5. package/components/avatar/avatar.jsx +10 -7
  6. package/components/avatar/demo/base.md +1 -0
  7. package/components/avatar/demo/info.md +2 -5
  8. package/components/backtop/backtop.jsx +39 -32
  9. package/components/badge/badge.jsx +7 -7
  10. package/components/badge/demo/color.md +0 -1
  11. package/components/badge/styles/index.less +0 -4
  12. package/components/base/{collapse.js → collapse.jsx} +2 -7
  13. package/components/base/drop.jsx +181 -195
  14. package/components/base/input.jsx +27 -46
  15. package/components/base/pop.jsx +21 -17
  16. package/components/base/transition.js +1 -4
  17. package/components/breadcrumb/breadcrumb.jsx +6 -3
  18. package/components/breadcrumb/breadcrumbItem.jsx +4 -2
  19. package/components/breadcrumb/styles/index.less +1 -1
  20. package/components/button/button.jsx +95 -56
  21. package/components/button/buttonGroup.jsx +5 -3
  22. package/components/button/demo/base.md +3 -3
  23. package/components/button/demo/block.md +1 -1
  24. package/components/button/demo/color.md +30 -0
  25. package/components/button/demo/disabled.md +2 -2
  26. package/components/button/demo/index.vue +4 -4
  27. package/components/button/demo/light.md +8 -8
  28. package/components/button/demo/loading.md +10 -7
  29. package/components/button/demo/outline.md +22 -0
  30. package/components/button/demo/size.md +3 -4
  31. package/components/button/demo/with-icon.md +5 -5
  32. package/components/button/styles/index.less +269 -44
  33. package/components/card/card.jsx +4 -2
  34. package/components/carousel/carousel.jsx +143 -97
  35. package/components/carousel/carouselItem.jsx +13 -14
  36. package/components/carousel/styles/index.less +1 -1
  37. package/components/checkbox/checkbox.jsx +6 -4
  38. package/components/checkbox/demo/disabled.md +1 -3
  39. package/components/checkbox/group.jsx +6 -3
  40. package/components/collapse/collapse.jsx +14 -12
  41. package/components/collapse/demo/{accrodion.md → accordion.md} +2 -2
  42. package/components/collapse/demo/index.vue +2 -2
  43. package/components/collapse/panel.jsx +15 -16
  44. package/components/collapse/styles/index.less +3 -3
  45. package/components/colorPicker/alpha.jsx +107 -0
  46. package/components/colorPicker/colorpicker.jsx +177 -384
  47. package/components/colorPicker/demo/base.md +1 -3
  48. package/components/colorPicker/demo/customTriggle.md +34 -0
  49. package/components/colorPicker/demo/disabled.md +22 -0
  50. package/components/colorPicker/demo/disabledAlpha.md +20 -0
  51. package/components/colorPicker/demo/index.vue +11 -5
  52. package/components/colorPicker/demo/mode.md +16 -18
  53. package/components/colorPicker/demo/placement.md +25 -0
  54. package/components/colorPicker/demo/{colors.md → presets.md} +2 -2
  55. package/components/colorPicker/demo/size.md +14 -13
  56. package/components/colorPicker/hue.jsx +114 -0
  57. package/components/colorPicker/index.md +11 -11
  58. package/components/colorPicker/mode.jsx +176 -0
  59. package/components/colorPicker/paint.jsx +126 -0
  60. package/components/colorPicker/presets.jsx +69 -0
  61. package/components/colorPicker/styles/index.less +144 -46
  62. package/components/components.js +155 -0
  63. package/components/const/var.js +3 -0
  64. package/components/datePicker/datecalendar.jsx +34 -34
  65. package/components/datePicker/datepicker.jsx +24 -23
  66. package/components/datePicker/styles/calendar.less +3 -3
  67. package/components/descriptions/descriptions.jsx +12 -8
  68. package/components/descriptions/descriptionsItem.jsx +5 -2
  69. package/components/divider/divider.jsx +4 -2
  70. package/components/drawer/drawer.jsx +74 -69
  71. package/components/dropdown/dropdown.jsx +5 -2
  72. package/components/dropdown/styles/index.less +14 -3
  73. package/components/empty/empty.jsx +5 -5
  74. package/components/flex/demo/align.md +1 -1
  75. package/components/flex/demo/size.md +1 -1
  76. package/components/flex/flex.jsx +12 -4
  77. package/components/form/demo/length.md +1 -1
  78. package/components/form/demo/valid.md +1 -1
  79. package/components/form/form.jsx +9 -8
  80. package/components/form/formitem.jsx +14 -11
  81. package/components/grid/col.jsx +5 -2
  82. package/components/grid/row.jsx +11 -8
  83. package/components/icon/demo/base.md +8 -7
  84. package/components/icon/demo/index.vue +3 -1
  85. package/components/icon/demo/info.md +1 -38
  86. package/components/icon/demo/search.vue +16 -15
  87. package/components/icon/demo/use.md +30 -0
  88. package/components/icon/icon.jsx +5 -2
  89. package/components/image/group.jsx +4 -2
  90. package/components/image/image.jsx +16 -13
  91. package/components/image/index.js +6 -9
  92. package/components/image/{instance.js → instance.jsx} +6 -6
  93. package/components/image/preview.jsx +219 -195
  94. package/components/image/styles/index.less +1 -1
  95. package/components/index.js +36 -142
  96. package/components/input/input.jsx +6 -4
  97. package/components/input/inputGroup.jsx +16 -14
  98. package/components/input/textarea.jsx +16 -7
  99. package/components/inputNumber/demo/base.md +16 -8
  100. package/components/inputNumber/demo/format.md +7 -19
  101. package/components/inputNumber/demo/size.md +2 -6
  102. package/components/inputNumber/inputNumber.jsx +112 -104
  103. package/components/inputNumber/styles/index.less +47 -11
  104. package/components/layout/demo/base.md +11 -6
  105. package/components/layout/demo/layout1.md +82 -63
  106. package/components/layout/demo/layout2.md +93 -56
  107. package/components/layout/demo/layout3.md +95 -53
  108. package/components/layout/demo/layout4.md +97 -45
  109. package/components/layout/demo/layout5.md +81 -80
  110. package/components/layout/index.js +0 -4
  111. package/components/layout/layout.jsx +3 -2
  112. package/components/loading/demo/info.md +3 -3
  113. package/components/loading/{index.js → index.jsx} +29 -24
  114. package/components/locale/index.js +27 -69
  115. package/components/locale/lang/de.js +1 -1
  116. package/components/locale/lang/el.js +1 -1
  117. package/components/locale/lang/en.js +1 -1
  118. package/components/locale/lang/fr.js +2 -2
  119. package/components/locale/lang/it.js +1 -1
  120. package/components/locale/lang/ja.js +1 -1
  121. package/components/locale/lang/ko.js +1 -1
  122. package/components/locale/lang/ru.js +1 -1
  123. package/components/locale/lang/th.js +1 -1
  124. package/components/locale/lang/ua.js +1 -1
  125. package/components/locale/lang/vi.js +1 -1
  126. package/components/locale/lang/zh-CN.js +1 -1
  127. package/components/locale/lang/zh-TW.js +1 -1
  128. package/components/menu/demo/index.vue +2 -2
  129. package/components/menu/menu.jsx +6 -3
  130. package/components/menu/menudivider.jsx +5 -3
  131. package/components/menu/menugroup.jsx +4 -2
  132. package/components/menu/menuitem.jsx +6 -4
  133. package/components/menu/styles/index.less +88 -20
  134. package/components/menu/submenu.jsx +11 -28
  135. package/components/message/group.jsx +31 -28
  136. package/components/message/index.js +2 -2
  137. package/components/modal/demo/index.vue +2 -3
  138. package/components/modal/demo/info.md +5 -4
  139. package/components/modal/index.js +5 -7
  140. package/components/modal/modal.jsx +116 -121
  141. package/components/notice/index.js +2 -1
  142. package/components/page/page.jsx +15 -12
  143. package/components/page/styles/index.less +4 -4
  144. package/components/popconfirm/popconfirm.jsx +9 -8
  145. package/components/popconfirm/styles/index.less +15 -8
  146. package/components/poptip/poptip.jsx +7 -6
  147. package/components/poptip/styles/index.less +10 -4
  148. package/components/progress/progress.jsx +11 -8
  149. package/components/radio/button.jsx +4 -1
  150. package/components/radio/demo/button.md +1 -2
  151. package/components/radio/group.jsx +10 -19
  152. package/components/radio/radio.jsx +7 -9
  153. package/components/radio/styles/index.less +1 -1
  154. package/components/rate/rate.jsx +7 -10
  155. package/components/select/demo/base.md +5 -2
  156. package/components/select/demo/info.md +3 -1
  157. package/components/select/demo/multiple.md +1 -1
  158. package/components/select/demo/theme.md +0 -5
  159. package/components/select/index.md +4 -0
  160. package/components/select/option.jsx +8 -5
  161. package/components/select/select.jsx +70 -43
  162. package/components/select/styles/index.less +7 -13
  163. package/components/skeleton/demo/items.md +3 -3
  164. package/components/skeleton/skeleton.jsx +6 -2
  165. package/components/skeleton/skeletonAvatar.jsx +6 -2
  166. package/components/skeleton/skeletonButton.jsx +6 -2
  167. package/components/skeleton/skeletonImage.jsx +6 -2
  168. package/components/skeleton/skeletonText.jsx +6 -2
  169. package/components/slider/slider.jsx +15 -11
  170. package/components/slider/thumb.jsx +9 -8
  171. package/components/space/demo/align.md +5 -6
  172. package/components/space/demo/size.md +8 -8
  173. package/components/space/space.jsx +19 -17
  174. package/components/spin/demo/container.md +10 -10
  175. package/components/spin/spin.jsx +5 -2
  176. package/components/styles/color.less +57 -37
  177. package/components/styles/sys.less +31 -0
  178. package/components/styles/var.less +40 -11
  179. package/components/switch/styles/index.less +2 -2
  180. package/components/switch/switch.jsx +11 -8
  181. package/components/table/demo/edit.md +4 -4
  182. package/components/table/demo/expand.md +1 -2
  183. package/components/table/demo/filter.md +1 -1
  184. package/components/table/extend.jsx +172 -157
  185. package/components/table/styles/index.less +2 -1
  186. package/components/table/table.jsx +8 -6
  187. package/components/tabs/demo/base.md +6 -6
  188. package/components/tabs/demo/card.md +6 -6
  189. package/components/tabs/demo/centered.md +6 -6
  190. package/components/tabs/demo/closable.md +3 -3
  191. package/components/tabs/demo/disabled.md +6 -6
  192. package/components/tabs/demo/extra.md +6 -6
  193. package/components/tabs/demo/icon.md +4 -4
  194. package/components/tabs/demo/index.vue +3 -4
  195. package/components/tabs/demo/sample.md +6 -6
  196. package/components/tabs/index.js +2 -2
  197. package/components/tabs/index.md +1 -1
  198. package/components/tabs/styles/index.less +47 -9
  199. package/components/tabs/tabpanel.jsx +28 -0
  200. package/components/tabs/tabs.jsx +198 -151
  201. package/components/tag/demo/color.md +0 -1
  202. package/components/tag/styles/index.less +0 -6
  203. package/components/tag/tag.jsx +6 -3
  204. package/components/timeline/timeline.jsx +3 -1
  205. package/components/timeline/timelineitem.jsx +5 -2
  206. package/components/tooltip/demo/color.md +2 -3
  207. package/components/tooltip/styles/index.less +15 -26
  208. package/components/tooltip/tooltip.jsx +8 -6
  209. package/components/tree/demo/directory.md +3 -3
  210. package/components/tree/node.jsx +39 -50
  211. package/components/tree/styles/index.less +3 -3
  212. package/components/tree/tree.jsx +18 -28
  213. package/components/treeselect/styles/index.less +1 -1
  214. package/components/treeselect/treeselect.jsx +21 -22
  215. package/components/upload/demo/form.md +1 -1
  216. package/components/upload/upload.jsx +13 -27
  217. package/components/{_tool → utils}/animate.js +1 -1
  218. package/components/{_tool → utils}/clone.js +2 -2
  219. package/components/utils/color.js +5 -0
  220. package/components/{_tool/utils.js → utils/element.js} +8 -5
  221. package/components/utils/number.js +81 -0
  222. package/components/utils/theme.js +62 -0
  223. package/components/utils/vue.js +7 -0
  224. package/dist/k-ui.cjs.js +7 -0
  225. package/dist/k-ui.css +6 -7
  226. package/dist/k-ui.d.ts +162 -0
  227. package/dist/k-ui.esm.js +7 -0
  228. package/dist/k-ui.umd.js +7 -0
  229. package/dist/locale/de.js +5 -7
  230. package/dist/locale/el.js +5 -7
  231. package/dist/locale/en.js +5 -7
  232. package/dist/locale/fr.js +5 -7
  233. package/dist/locale/it.js +5 -7
  234. package/dist/locale/ja.js +5 -7
  235. package/dist/locale/ko.js +5 -7
  236. package/dist/locale/ru.js +5 -7
  237. package/dist/locale/th.js +5 -7
  238. package/dist/locale/ua.js +5 -7
  239. package/dist/locale/vi.js +5 -7
  240. package/dist/locale/zh-CN.js +7 -0
  241. package/dist/locale/zh-TW.js +7 -0
  242. package/package.json +54 -22
  243. package/readme.md +105 -0
  244. package/test/i18n@8.x.html +65 -0
  245. package/types/affix/Affix.d.ts +17 -0
  246. package/types/alert/Alert.d.ts +18 -0
  247. package/types/anchor/Anchor.d.ts +16 -0
  248. package/types/anchor/Link.d.ts +15 -0
  249. package/types/avatar/Avatar.d.ts +17 -0
  250. package/types/avatar/AvatarGroup.d.ts +15 -0
  251. package/types/backtop/BackTop.d.ts +16 -0
  252. package/types/badge/Badge.d.ts +20 -0
  253. package/types/base/BasePop.d.ts +24 -0
  254. package/types/base/Collapse.d.ts +15 -0
  255. package/types/base/Drop.d.ts +27 -0
  256. package/types/base/baseInput.d.ts +32 -0
  257. package/types/base/input.d.ts +32 -0
  258. package/types/base/pop.d.ts +36 -0
  259. package/types/breadcrumb/Breadcrumb.d.ts +11 -0
  260. package/types/breadcrumb/BreadcrumbItem.d.ts +17 -0
  261. package/types/button/Button.d.ts +27 -0
  262. package/types/button/ButtonGroup.d.ts +15 -0
  263. package/types/card/Card.d.ts +16 -0
  264. package/types/carousel/Carousel.d.ts +22 -0
  265. package/types/carousel/CarouselItem.d.ts +11 -0
  266. package/types/checkbox/Checkbox.d.ts +19 -0
  267. package/types/checkbox/CheckboxGroup.d.ts +20 -0
  268. package/types/collapse/Collapse.d.ts +15 -0
  269. package/types/collapse/Panel.d.ts +14 -0
  270. package/types/colorPicker/Alpha.d.ts +13 -0
  271. package/types/colorPicker/ColorPicker.d.ts +26 -0
  272. package/types/colorPicker/Hue.d.ts +13 -0
  273. package/types/colorPicker/Mode.d.ts +15 -0
  274. package/types/colorPicker/Paint.d.ts +14 -0
  275. package/types/colorPicker/Presets.d.ts +15 -0
  276. package/types/datePicker/DateCalendar.d.ts +27 -0
  277. package/types/datePicker/DatePicker.d.ts +36 -0
  278. package/types/descriptions/Descriptions.d.ts +21 -0
  279. package/types/descriptions/DescriptionsItem.d.ts +18 -0
  280. package/types/divider/Divider.d.ts +18 -0
  281. package/types/drawer/Drawer.d.ts +35 -0
  282. package/types/dropdown/Dropdown.d.ts +21 -0
  283. package/types/empty/Empty.d.ts +15 -0
  284. package/types/flex/Flex.d.ts +17 -0
  285. package/types/form/Form.d.ts +25 -0
  286. package/types/form/FormItem.d.ts +17 -0
  287. package/types/grid/Col.d.ts +15 -0
  288. package/types/grid/Row.d.ts +17 -0
  289. package/types/icon/Icon.d.ts +17 -0
  290. package/types/image/ImageGroup.d.ts +11 -0
  291. package/types/image/ImagePreview.d.ts +24 -0
  292. package/types/image/KImage.d.ts +21 -0
  293. package/types/image/imageProps.d.ts +19 -0
  294. package/types/image/instance.d.ts +19 -0
  295. package/types/index.d.ts +188 -0
  296. package/types/input/Input.d.ts +31 -0
  297. package/types/input/InputGroup.d.ts +17 -0
  298. package/types/input/TextArea.d.ts +16 -0
  299. package/types/inputNumber/InputNumber.d.ts +33 -0
  300. package/types/layout/layout.d.ts +13 -0
  301. package/types/layout/prop.d.ts +13 -0
  302. package/types/loading/Loading.d.ts +11 -0
  303. package/types/menu/Menu.d.ts +21 -0
  304. package/types/menu/MenuDivider.d.ts +11 -0
  305. package/types/menu/MenuGroup.d.ts +13 -0
  306. package/types/menu/MenuItem.d.ts +15 -0
  307. package/types/menu/SubMenu.d.ts +15 -0
  308. package/types/menu/show.d.ts +15 -0
  309. package/types/message/group.d.ts +13 -0
  310. package/types/message/inner.d.ts +24 -0
  311. package/types/modal/Modal.d.ts +31 -0
  312. package/types/page/Page.d.ts +26 -0
  313. package/types/popconfirm/Popconfirm.d.ts +21 -0
  314. package/types/poptip/Poptip.d.ts +22 -0
  315. package/types/progress/Progress.d.ts +33 -0
  316. package/types/radio/Radio.d.ts +19 -0
  317. package/types/radio/RadioButton.d.ts +18 -0
  318. package/types/radio/RadioGroup.d.ts +23 -0
  319. package/types/rate/Rate.d.ts +26 -0
  320. package/types/rate/Star.d.ts +22 -0
  321. package/types/select/Option.d.ts +15 -0
  322. package/types/select/Select.d.ts +38 -0
  323. package/types/skeleton/Skeleton.d.ts +21 -0
  324. package/types/skeleton/SkeletonAvatar.d.ts +19 -0
  325. package/types/skeleton/SkeletonButton.d.ts +20 -0
  326. package/types/skeleton/SkeletonImage.d.ts +18 -0
  327. package/types/skeleton/SkeletonText.d.ts +18 -0
  328. package/types/slider/Slider.d.ts +29 -0
  329. package/types/slider/thumb.d.ts +24 -0
  330. package/types/space/Space.d.ts +18 -0
  331. package/types/spin/Spin.d.ts +20 -0
  332. package/types/switch/KSwitch.d.ts +20 -0
  333. package/types/switch/Switch.d.ts +20 -0
  334. package/types/table/ExtendTable.d.ts +21 -0
  335. package/types/table/Table.d.ts +24 -0
  336. package/types/table/extend.d.ts +21 -0
  337. package/types/tabs/TabPanel.d.ts +17 -0
  338. package/types/tabs/Tabs.d.ts +18 -0
  339. package/types/tag/Tag.d.ts +18 -0
  340. package/types/timeline/TimeLine.d.ts +14 -0
  341. package/types/timeline/TimeLineItem.d.ts +16 -0
  342. package/types/tooltip/Tooltip.d.ts +23 -0
  343. package/types/tree/Tree.d.ts +28 -0
  344. package/types/tree/TreeNode.d.ts +17 -0
  345. package/types/treeselect/TreeSelect.d.ts +41 -0
  346. package/types/upload/Upload.d.ts +39 -0
  347. package/README.md +0 -106
  348. package/components/_tool/directives.js +0 -31
  349. package/components/_tool/number.js +0 -177
  350. package/components/bin/index.js +0 -3
  351. package/components/button/demo/normal.md +0 -41
  352. package/components/button/demo/solid.md +0 -16
  353. package/components/colorPicker/canvasHelper.js +0 -274
  354. package/components/colorPicker/demo/shape.md +0 -36
  355. package/components/tabs/tabpane.jsx +0 -25
  356. package/dist/k-ui.js +0 -9
  357. package/dist/locale/zhCN.js +0 -9
  358. package/dist/locale/zhTW.js +0 -9
  359. package/test/i18n@6.x.html +0 -52
  360. /package/components/{_tool → directives}/outsiteclick.js +0 -0
  361. /package/components/{_tool → directives}/resize.js +0 -0
  362. /package/components/{_tool → directives}/scroll.js +0 -0
  363. /package/components/{_tool → directives}/transfer.js +0 -0
  364. /package/components/menu/demo/{accrodion.md → accordion.md} +0 -0
  365. /package/components/modal/demo/{confrim.md → confirm.md} +0 -0
  366. /package/components/{_tool → utils}/docClick.js +0 -0
@@ -1,5 +1,6 @@
1
1
  import { Button } from '../button';
2
- export default {
2
+ import { withInstall } from '../utils/vue'
3
+ const RadioButton = {
3
4
  name: "RadioButton",
4
5
  props: {
5
6
  value: { type: [String, Number, Boolean], default: false },
@@ -49,3 +50,5 @@ export default {
49
50
  )
50
51
  }
51
52
  };
53
+
54
+ export default withInstall(RadioButton);
@@ -14,7 +14,6 @@
14
14
  <br/>
15
15
  Theme : <RadioGroup v-model="theme" size="small">
16
16
  <RadioButton value="default" label="Default" />
17
- <RadioButton value="solid" label="Solid" />
18
17
  <RadioButton value="light" label="Light" />
19
18
  <RadioButton value="card" label="Card" />
20
19
  </RadioGroup>
@@ -40,7 +39,7 @@ export default{
40
39
  return {
41
40
  size:'default',
42
41
  shape:'default',
43
- theme:'solid',
42
+ theme:'default',
44
43
  date:0,
45
44
  dates:[
46
45
  { label:'7天' ,value:0 },
@@ -1,8 +1,8 @@
1
- import { getChild } from '../_tool/utils'
1
+ import { getChildren } from '../utils/element'
2
2
  import Radio from './radio.jsx';
3
3
  import Button from './button.jsx';
4
- import cloneVNode from '../_tool/clone'
5
- export default {
4
+ import { withInstall } from '../utils/vue'
5
+ const RadioGroup = {
6
6
  name: "RadioGroup",
7
7
  props: {
8
8
  value: { type: [String, Number], default: "" },
@@ -34,7 +34,7 @@ export default {
34
34
  }
35
35
  },
36
36
  watch: {
37
- value(val, Oval) {
37
+ value(val) {
38
38
  this.defaultValue = val
39
39
  }
40
40
  },
@@ -48,9 +48,9 @@ export default {
48
48
  },
49
49
  render() {
50
50
  const { options, $slots, type, direction, theme, shape, size } = this
51
- let childs = getChild($slots.default)
51
+ let children = getChildren($slots.default)
52
52
  if (options && options.length) {
53
- childs = options.map(option => {
53
+ children = options.map(option => {
54
54
  return type == 'button' ?
55
55
  <Button
56
56
  theme={theme}
@@ -71,27 +71,18 @@ export default {
71
71
  disabled={option.disabled}
72
72
  />
73
73
  })
74
- } else {
75
- // let newChilds = []
76
- // for (let i = 0; i < childs.length; i++) {
77
- // let child = cloneVNode(childs[i], {
78
- // props: {
79
- // size, theme, shape,
80
- // },
81
- // })
82
- // newChilds.push(child)
83
- // }
84
- // childs = newChilds
85
74
  }
86
75
  const classes = [
87
76
  'k-radio-group',
88
- { 'k-radio-cirle': shape == 'circle' },
77
+ { 'k-radio-circle': shape == 'circle' },
89
78
  { 'k-radio-group-light': theme == 'light' && type == 'button' },
90
79
  { 'k-radio-group-card': theme == 'card' && type == 'button' },
91
80
  { 'k-radio-group-vertical': direction == 'vertical' }
92
81
  ]
93
82
  return (
94
- <div class={classes}>{childs}</div>
83
+ <div class={classes}>{children}</div>
95
84
  )
96
85
  }
97
86
  };
87
+
88
+ export default withInstall(RadioGroup);
@@ -1,5 +1,6 @@
1
- import { hasProp } from '../_tool/utils'
2
- export default {
1
+ import { hasProp } from '../utils/element'
2
+ import { withInstall } from '../utils/vue'
3
+ const Radio = {
3
4
  name: "Radio",
4
5
  props: {
5
6
  value: { type: [String, Number, Boolean], default: false },
@@ -25,11 +26,6 @@ export default {
25
26
  defaultChecked: checked,
26
27
  }
27
28
  },
28
- // watch: {
29
- // checked(checked) {
30
- // this.$emit("input", checked);
31
- // }
32
- // },
33
29
  methods: {
34
30
  change(e) {
35
31
  let { disabled, value, $slots, label, groupContext } = this
@@ -59,7 +55,7 @@ export default {
59
55
  checked = defaultChecked
60
56
  }
61
57
  }
62
- const wpclasses = [
58
+ const classes = [
63
59
  "k-radio", {
64
60
  ["k-radio-disabled"]: disabled,
65
61
  ["k-radio-checked"]: checked,
@@ -70,7 +66,7 @@ export default {
70
66
 
71
67
  const labelNode = label || $slots.default
72
68
  return (
73
- <label class={wpclasses} onClick={e => e.stopPropagation()}>
69
+ <label class={classes} onClick={e => e.stopPropagation()}>
74
70
  <span class="k-radio-symbol">
75
71
  <input type="radio" class="k-radio-input" disabled={disabled} checked={checked} onChange={change} />
76
72
  <span class="k-radio-inner"></span>
@@ -80,3 +76,5 @@ export default {
80
76
  )
81
77
  }
82
78
  };
79
+
80
+ export default withInstall(Radio);
@@ -59,7 +59,7 @@
59
59
  // }
60
60
  }
61
61
 
62
- .k-radio-cirle:not(.k-radio-group-card) {
62
+ .k-radio-circle:not(.k-radio-group-card) {
63
63
  .k-btn:first-child {
64
64
  border-top-left-radius: 30px;
65
65
  border-bottom-left-radius: 30px;
@@ -1,6 +1,6 @@
1
- import Tooltip from "../tooltip"
2
1
  import Star from './star'
3
- export default {
2
+ import { withInstall } from '../utils/vue'
3
+ const Rate = {
4
4
  name: 'Rate',
5
5
  props: {
6
6
  value: { type: Number, default: 0 },
@@ -30,7 +30,7 @@ export default {
30
30
  render() {
31
31
  let { count, tempValue, allowHalf, character, disabled, tooltips = [], icon, showScore, size, color } = this
32
32
  const stars = []
33
- if (Number(count) == NaN || count <= 0) {
33
+ if (isNaN(Number(count)) || count <= 0) {
34
34
  count = 5
35
35
  }
36
36
  if (count > 15) count = 15
@@ -56,7 +56,7 @@ export default {
56
56
  on: {
57
57
  click: this.click,
58
58
  mouseenter: this.mouseenter,
59
- mouseleave: this.mouseleave,
59
+ // mouseleave: this.mouseleave,
60
60
  }
61
61
  }
62
62
  stars.push(<Star {...props} />)
@@ -81,7 +81,6 @@ export default {
81
81
  },
82
82
  click(index) {
83
83
  index = index + 1
84
- // console.log(index, this.defaultValue)
85
84
  if (this.defaultValue && this.allowClear && index == this.defaultValue) {
86
85
  index = 0
87
86
  }
@@ -94,11 +93,9 @@ export default {
94
93
  this.$emit('input', index)
95
94
  },
96
95
  mouseenter(index) {
97
- // index = index + 1
98
96
  this.tempValue = index + 1
99
97
  },
100
- mouseleave(index) {
101
- // console.log(this.value)
102
- }
103
98
  }
104
- }
99
+ }
100
+
101
+ export default withInstall(Rate)
@@ -15,11 +15,13 @@
15
15
  </Space>
16
16
  <br />
17
17
  <Space vertical style="margin-top:10px;">
18
- <Select :width="200" placeholder="Please Choose">
18
+ <Select :width="300" multiple v-model="data2" clearable :max-tag-count="2">
19
19
  <Option :value="1" label="Apple" />
20
20
  <Option :value="2" label="Orange" />
21
- <Option :value="3" label="Banana" disabled/>
21
+ <Option :value="3" label="Banana"/>
22
22
  <Option :value="4" label="Pear" />
23
+ <Option :value="5" label="Peach" />
24
+ <Option :value="6" label="Grape" />
23
25
  </Select>
24
26
  <Select :width="200" value="1" disabled>
25
27
  <Option value="1" label="disabled" />
@@ -32,6 +34,7 @@ export default {
32
34
  data() {
33
35
  return {
34
36
  select: 2,
37
+ data2:[1,2,3],
35
38
  data: [
36
39
  { label: "Apple", value: 0 },
37
40
  { label: "Orange", value: 1 },
@@ -1,8 +1,10 @@
1
1
  # Select 选择器
2
+
2
3
  下拉选择器。
3
4
 
4
5
  ## 何时使用
6
+
5
7
  - 弹出一个下拉菜单给用户选择操作,用于代替原生的选择器,或者需要一个更优雅的多选器时。
6
8
  - 当选项少时(少于 5 项),建议直接将选项平铺,使用 Radio 是更好的选择。
7
9
 
8
- ## 代码演示
10
+ ## 代码演示
@@ -20,7 +20,7 @@
20
20
  </Space>
21
21
  <br/>
22
22
  <Space vertical style="margin-top:10px">
23
- <Select :width="300" multiple v-model="data2" clearable>
23
+ <Select :width="300" multiple v-model="data2" clearable :max-tag-count="2">
24
24
  <Option value="1" label="Apple" />
25
25
  <Option value="2" label="Orange" />
26
26
  <Option value="3" label="Banana"/>
@@ -31,11 +31,6 @@ export default{
31
31
  ]
32
32
  }
33
33
  },
34
- methods:{
35
- setSize({value}){
36
- this.size = value
37
- }
38
- }
39
34
  }
40
35
  </script>
41
36
  ```
@@ -1,4 +1,5 @@
1
1
  ## Select API
2
+
2
3
  | 属性 | 说明 | 类型 | 默认值 |
3
4
  | ----------- | ---------------------------------------------------------- | ------------------------------ | ---------- |
4
5
  | value | 指定选中项目的 `value` 值,可以使用 `v-model` 双向绑定数据 | String,Number | - |
@@ -7,10 +8,12 @@
7
8
  | disabled | 是否禁用当前项 | Boolean | false |
8
9
  | size | 组件尺寸大小,提供`small`,`large`两种尺寸,默认为正常 | String | - |
9
10
  | emptyText | 没有数据时展示的提示 | String | '赞无数据' |
11
+ | maxTagCount | 最多展示多少个tag,超出部分以点点点展示 | Number | - |
10
12
  | multiple | 是否呈现多选模式 | Boolean | false |
11
13
  | loading | 是否显示异步加载 | Boolean | false |
12
14
  | clearable | 是否可以清空选项 | Boolean | false |
13
15
  | bordered | 是否显示边框 | Boolean | true |
16
+ | extendWidth | 下拉框的宽度是否与input一致 | Boolean | true |
14
17
  | showArrow | 是否显示下拉按钮 | Boolean | true |
15
18
  | change | 在选项状态发生改变时触发,返回选择项{value:xx,label:xx} | Function | - |
16
19
  | open-change | 下拉框展开或收起时触发 | Function | - |
@@ -20,6 +23,7 @@
20
23
  | shape | shape='circle' 时呈现圆角 | String | - |
21
24
 
22
25
  ## Option API
26
+
23
27
  | 属性 | 说明 | 类型 | 默认值 |
24
28
  | -------- | -------------------------------------------------------------------------------------------- | ------------- | ------ |
25
29
  | key | 和 value 含义一致。如果 Vue 需要你设置此项,此项值与 value 的值相同,然后可以省略 value 设置 | String,Number | - |
@@ -1,7 +1,8 @@
1
- import { isNotEmpty } from "../_tool/utils";
1
+ import { isNotEmpty } from "../utils/element";
2
2
  import Icon from '../icon'
3
3
  import { Checkmark } from 'kui-icons'
4
- export default {
4
+ import { withInstall } from '../utils/vue'
5
+ const Option = {
5
6
  name: "Option",
6
7
  props: {
7
8
  value: { type: [String, Number], required: true },
@@ -44,10 +45,12 @@ export default {
44
45
  ["k-select-item-disabled"]: disabled
45
46
  }
46
47
  ];
47
- const childs = <span>{label}{iconNode}</span>
48
+ const children = <span>{label}{iconNode}</span>
48
49
 
49
50
  return (
50
- <li class={classes} onClick={select}>{childs}</li>
51
+ <li class={classes} onClick={select}>{children}</li>
51
52
  )
52
53
  }
53
- }
54
+ }
55
+
56
+ export default withInstall(Option);
@@ -1,13 +1,14 @@
1
1
  import Option from "./option";
2
2
  import Icon from "../icon";
3
3
  import Empty from "../empty";
4
- import { hasProp, getChild, isNotEmpty } from "../_tool/utils";
4
+ import { hasProp, getChildren, isNotEmpty, isEmpty } from "../utils/element";
5
5
 
6
6
  import Drop from "../base/drop";
7
7
  import { t } from "../locale";
8
- import { Sync, Close, CloseCircle, ChevronDown } from "kui-icons";
8
+ import { Loading, Close, CloseCircle, ChevronDown } from "kui-icons";
9
+ import { withInstall } from '../utils/vue'
9
10
 
10
- export default {
11
+ const Select = {
11
12
  name: "Select",
12
13
  props: {
13
14
  placeholder: String,
@@ -20,7 +21,7 @@ export default {
20
21
  transfer: { type: Boolean, default: true },
21
22
  width: Number,
22
23
  value: [String, Number, Array],
23
- clearable: Boolean,
24
+ clearable: { type: Boolean, default: false },
24
25
  filterable: Boolean,
25
26
  disabled: Boolean,
26
27
  multiple: Boolean,
@@ -33,6 +34,8 @@ export default {
33
34
  icon: [String, Array],
34
35
  shape: String,
35
36
  arrowIcon: [String, Array],
37
+ maxTagCount: Number,
38
+ extendWidth: { type: Boolean, default: true },
36
39
  },
37
40
  provide() {
38
41
  return {
@@ -68,9 +71,9 @@ export default {
68
71
  }
69
72
  this.showSearch = false;
70
73
  },
71
- getLabel(childs, labelValue) {
74
+ getLabel(children, labelValue) {
72
75
  let Label = null;
73
- childs.forEach((c) => {
76
+ children.forEach((c) => {
74
77
  let { value, label } = c.componentOptions.propsData;
75
78
  if (labelValue === value) {
76
79
  Label = label || (c.componentOptions.children[0].text || "").trim();
@@ -95,7 +98,7 @@ export default {
95
98
  if (this.filterable || isSearch) {
96
99
  this.showSearch = this.opened;
97
100
  if (this.opened) {
98
- this.$nextTick((e) => {
101
+ this.$nextTick(() => {
99
102
  this.isFocus = true;
100
103
  this.$refs.search.focus();
101
104
  });
@@ -118,7 +121,7 @@ export default {
118
121
  let isSearch = "search" in this.$listeners;
119
122
  if (isSearch) {
120
123
  this.showSearch = true;
121
- this.$nextTick((e) => {
124
+ this.$nextTick(() => {
122
125
  this.$refs.search.focus();
123
126
  this.isFocus = true;
124
127
  });
@@ -136,15 +139,17 @@ export default {
136
139
  // console.log(value, currentValue)
137
140
 
138
141
  if (this.showSearch) {
139
- this.queryKey = "";
140
- this.$refs.search.value = "";
141
- this.$refs.search.style.width = "";
142
+ setTimeout(() => {
143
+ this.queryKey = "";
144
+ this.$refs.search.value = "";
145
+ this.$refs.search.style.width = "";
146
+ }, 300);
142
147
  }
143
148
  if (!multiple) {
144
149
  this.opened = false;
145
150
  this.showSearch = false;
146
151
  } else if ("search" in this.$listeners || this.filterable) {
147
- this.$nextTick((e) => {
152
+ this.$nextTick(() => {
148
153
  this.$refs.search.focus();
149
154
  this.isFocus = true;
150
155
  });
@@ -168,7 +173,7 @@ export default {
168
173
 
169
174
  //set label
170
175
 
171
- this.$nextTick((e) => this.setPosition());
176
+ this.$nextTick(() => this.setPosition());
172
177
  this.$emit("input", value);
173
178
  this.$emit("change", item);
174
179
  },
@@ -180,7 +185,7 @@ export default {
180
185
  searchInput(e) {
181
186
  this.queryKey = e.target.value;
182
187
  //todo:
183
- this.$nextTick((k) => {
188
+ this.$nextTick(() => {
184
189
  // let max = this.selectWidth - 15 - (this.showArrow ? 25 : 0)
185
190
  e.target.style.width = this.$refs.mirror.offsetWidth + "px";
186
191
  this.setPosition();
@@ -193,9 +198,9 @@ export default {
193
198
  }, 500);
194
199
  }
195
200
  },
196
- emptyClick(e) {
201
+ emptyClick() {
197
202
  if (this.showSearch) {
198
- this.$nextTick((e) => {
203
+ this.$nextTick(() => {
199
204
  this.$refs.search.focus();
200
205
  this.isFocus = true;
201
206
  });
@@ -203,9 +208,9 @@ export default {
203
208
  },
204
209
  getOptions(filterable) {
205
210
  let { queryKey, options, $slots } = this;
206
- let childs = null;
211
+ let children = null;
207
212
  if (Array.isArray(options)) {
208
- childs = options.map((k, i) => {
213
+ children = options.map((k) => {
209
214
  let prop = {
210
215
  props: { ...k },
211
216
  key: k.key || k.label + k.value,
@@ -213,20 +218,20 @@ export default {
213
218
  return <Option {...prop} />;
214
219
  });
215
220
  } else {
216
- childs = getChild($slots.default);
221
+ children = getChildren($slots.default);
217
222
  }
218
- if (!filterable) return childs;
223
+ if (!filterable) return children;
219
224
 
220
225
  if (this.filterable && queryKey && !this.$listeners.search) {
221
226
  let parsedQuery = String(queryKey).replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, "\\$1");
222
227
  let Reg = new RegExp(parsedQuery, "i");
223
228
 
224
- childs = childs.filter((c) => {
229
+ children = children.filter((c) => {
225
230
  let label = c.componentOptions.propsData.label || c.componentOptions.children[0].text;
226
231
  return Reg.test(label);
227
232
  });
228
233
  }
229
- return childs;
234
+ return children;
230
235
  },
231
236
  },
232
237
  render() {
@@ -236,7 +241,7 @@ export default {
236
241
  arrowIcon = ChevronDown;
237
242
  }
238
243
 
239
- let childs = this.getOptions();
244
+ let children = this.getOptions();
240
245
 
241
246
  let label = null;
242
247
  let values = isNotEmpty(currentValue) ? currentValue : multiple ? [] : "";
@@ -244,7 +249,7 @@ export default {
244
249
  if (currentValue.length) {
245
250
  let labels = [];
246
251
  values.forEach((value) => {
247
- let label = this.getLabel(childs, value);
252
+ let label = this.getLabel(children, value);
248
253
  if (!label) return;
249
254
  labels.push({ label, key: `label_${value}`, value });
250
255
  });
@@ -253,7 +258,7 @@ export default {
253
258
  label = [];
254
259
  }
255
260
  } else {
256
- label = this.getLabel(childs, values);
261
+ label = this.getLabel(children, values);
257
262
  }
258
263
 
259
264
  const classes = [
@@ -289,7 +294,7 @@ export default {
289
294
  };
290
295
  const queryNode = (
291
296
  <div v-show={this.showSearch} key="search" class="k-select-search-wrap">
292
- <input {...queryProps} />
297
+ <input {...queryProps} type="text" />
293
298
  <span class="k-select-search-mirror" ref="mirror">
294
299
  {queryKey}
295
300
  </span>
@@ -298,7 +303,7 @@ export default {
298
303
 
299
304
  const loadingNode = (
300
305
  <div class="k-select-loading">
301
- <Icon type={Sync} spin />
306
+ <Icon type={Loading} spin />
302
307
  <span>{t("k.select.loading")}</span>
303
308
  </div>
304
309
  );
@@ -309,7 +314,7 @@ export default {
309
314
  value: opened,
310
315
  selection: this.$el,
311
316
  transfer: true,
312
- extendWidth: true,
317
+ extendWidth: this.extendWidth,
313
318
  transitionName: "k-select",
314
319
  className: [
315
320
  "k-select-dropdown",
@@ -331,32 +336,51 @@ export default {
331
336
  },
332
337
  },
333
338
  };
334
- childs = this.getOptions(true);
339
+ children = this.getOptions(true);
335
340
 
336
- let overlay = <Drop {...props}>{this.loading ? loadingNode : !childs.length ? <Empty onClick={this.emptyClick} description={this.emptyText} /> : <ul>{childs}</ul>}</Drop>;
341
+ let overlay = <Drop {...props}>{this.loading ? loadingNode : !children.length ? <Empty onClick={this.emptyClick} description={this.emptyText} /> : <ul>{children}</ul>}</Drop>;
337
342
 
338
343
  label = multiple ? label || [] : label;
339
344
  placeholder = placeholder || t("k.select.placeholder");
340
- const placeNode = placeholder && !isNotEmpty(label) && !queryKey ? <div class="k-select-placeholder">{placeholder}</div> : null;
341
- const tags = multiple
342
- ? label.map((c, i) => {
343
- return (
344
- <span class="k-select-tag" key={c.key}>
345
- {c.label}
346
- <Icon type={Close} onClick={(e) => removeTag(e, c)} />
347
- </span>
348
- );
349
- })
350
- : null;
345
+ // console.log('placeholder:', placeholder)
346
+ // console.log('label:', label)
347
+ // console.log('queryKey:', queryKey)
348
+ const placeNode = (placeholder && isEmpty(label) && !queryKey) ? <div class="k-select-placeholder">{placeholder}</div> : null;
349
+ // console.log('???:', placeholder, !isEmpty(label), !queryKey)
350
+ // console.log('placeNode:', placeNode)
351
+ const renderTags = () => {
352
+ if (!multiple) return null;
353
+ let tags = label.map((c) => {
354
+ return (
355
+ <span class="k-select-tag" key={c.key}>
356
+ {c.label}
357
+ <Icon type={Close} onClick={(e) => removeTag(e, c)} />
358
+ </span>
359
+ );
360
+ })
361
+ if (
362
+ this.maxTagCount &&
363
+ this.maxTagCount > 0 &&
364
+ tags.length > this.maxTagCount
365
+ ) {
366
+ tags = tags.slice(0, this.maxTagCount);
367
+ tags.push(
368
+ <span class="k-select-tag">
369
+ +{label.length - this.maxTagCount}...
370
+ </span>
371
+ );
372
+ }
373
+ return tags;
374
+
375
+ }
351
376
 
352
377
  const labelStyle = {
353
- // opacity: this.showSearch ? .4 : 1,
354
378
  display: queryKey.length ? "none" : "",
355
379
  };
356
380
  const labelsNode = multiple ? (
357
381
  [
358
382
  <div class="k-select-labels" name="k-select-tag">
359
- {tags}
383
+ {renderTags()}
360
384
  {queryNode}
361
385
  </div>,
362
386
  ]
@@ -367,6 +391,7 @@ export default {
367
391
  ) : null;
368
392
  let isSearch = "search" in this.$listeners;
369
393
  childNode.push(labelsNode);
394
+ // console.log(placeNode)
370
395
  placeNode && childNode.push(placeNode);
371
396
 
372
397
  if ((filterable || isSearch) && !multiple) {
@@ -398,3 +423,5 @@ export default {
398
423
  );
399
424
  },
400
425
  };
426
+
427
+ export default withInstall(Select);
@@ -82,7 +82,7 @@
82
82
  margin: 3px 0;
83
83
 
84
84
  .k-select-tag {
85
- padding: 2px 22px 2px 5px;
85
+ padding: 2px 5px;
86
86
  border: 1px solid var(--kui-color-border);
87
87
  background-color: var(--kui-color-border);
88
88
  border-radius: var(--kui-border-radius);
@@ -94,14 +94,8 @@
94
94
  transition: all .25s ease-in-out;
95
95
 
96
96
  .k-icon {
97
- position: absolute;
98
- right: 3px;
99
97
  font-size: 16px;
100
- text-align: center;
101
- display: block;
102
- top: 50%;
103
- transform: translateY(-50%);
104
-
98
+ margin-right: -2px;
105
99
  &:hover {
106
100
  color: var(--kui-color-danger);
107
101
  }
@@ -307,7 +301,7 @@
307
301
  }
308
302
 
309
303
  &:active {
310
- background: var(--kui-color-actived);
304
+ background: var(--kui-color-active);
311
305
  }
312
306
 
313
307
  .k-icon {
@@ -393,7 +387,7 @@
393
387
  .k-select-label {
394
388
  line-height: 22px;
395
389
  height: 22px;
396
- padding-right: 23px;
390
+ // padding-right: 23px;
397
391
  font-size: 12px;
398
392
  }
399
393
 
@@ -413,7 +407,7 @@
413
407
  margin: 2px 0;
414
408
 
415
409
  .k-select-tag {
416
- padding: 2px 20px 2px 5px;
410
+ padding: 1px 4px;
417
411
  line-height: 1;
418
412
 
419
413
  .k-icon {
@@ -478,12 +472,12 @@
478
472
  .k-select-labels {
479
473
 
480
474
  .k-select-tag {
481
- padding: 7px 20px 7px 5px;
475
+ padding: 6px 7px;
482
476
  font-size: 14px;
483
477
  line-height: 1;
484
478
 
485
479
  .k-icon {
486
- font-size: 16px;
480
+ font-size: 18px;
487
481
  }
488
482
  }
489
483
 
@@ -18,11 +18,11 @@
18
18
  </Space>
19
19
  <br/>
20
20
  <br/>
21
- <Space :size="15" style="width:300px;">
22
- Image radius: <Slider v-model="radius" />
21
+ <Space :size="15" style="width:300px;" block>
22
+ Image radius: <Slider v-model="radius" style="width:200px"/>
23
23
  </Space>
24
24
  <Space :size="15" style="width:300px;">
25
- Image Size: <Slider v-model="imgSize" range :min="80" :max="320"/>
25
+ Image Size: <Slider v-model="imgSize" range :min="80" :max="320" style="width:200px"/>
26
26
  </Space>
27
27
  <br/>
28
28
  <br/>