kui-vue 3.4.8 → 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 +247 -237
  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 +53 -20
  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,11 +1,11 @@
1
- import { hasChild, sortHeaderCols, findItem, } from './utils'
2
- import { measureScrollBar } from '../_tool/utils'
3
- import { Checkbox } from '../checkbox'
4
- import Icon from '../icon'
5
- import { CaretUp, CaretDown } from 'kui-icons'
1
+ import { hasChild, sortHeaderCols, findItem } from "./utils";
2
+ import { measureScrollBar } from "../utils/element";
3
+ import { Checkbox } from "../checkbox";
4
+ import Icon from "../icon";
5
+ import { CaretUp, CaretDown } from "kui-icons";
6
6
 
7
7
  export default {
8
- name: 'ExtendTable',
8
+ name: "ExtendTable",
9
9
  props: {
10
10
  body: Array,
11
11
  columns: Array,
@@ -22,132 +22,134 @@ export default {
22
22
  scrollBarHeight: 0,
23
23
  // type: 'left',
24
24
  theadSync: false,
25
- tbodySync: false
26
- }
25
+ tbodySync: false,
26
+ };
27
27
  },
28
28
  mounted() {
29
- let { thead } = this.$refs
30
- if (thead && !this.$isServer) {
29
+ let { thead } = this.$refs;
30
+ if (thead && typeof window !== "undefined") {
31
31
  // thead.style.marginBottom = `-${thead.offsetHeight - thead.scrollHeight}px`
32
- let size = measureScrollBar()
33
- this.scrollBarHeight = size
32
+ let size = measureScrollBar();
33
+ this.scrollBarHeight = size;
34
34
  if (this.height && this.width) {
35
- this.setColWidth()
35
+ this.setColWidth();
36
36
  }
37
37
  }
38
38
  },
39
39
  methods: {
40
40
  setColWidth() {
41
- const cols = this.$refs.colgroup.children//[0].children
41
+ const cols = this.$refs.colgroup.children; //[0].children
42
42
  // reset tbody's height
43
- let col = this.columns2 || this.columns
43
+ let col = this.columns2 || this.columns;
44
44
  for (let i = 0; i < cols.length; i++) {
45
45
  if (col[i] && !col[i].width) {
46
- col[i].width = cols[i].getBoundingClientRect().width
46
+ col[i].width = cols[i].getBoundingClientRect().width;
47
47
  }
48
48
  }
49
49
  },
50
50
  sorter(item) {
51
- let { _order, sorter } = item
51
+ let { _order, sorter } = item;
52
52
 
53
53
  if (sorter) {
54
54
  if (!_order) {
55
- _order = 'asc'
56
- } else if (_order == 'desc') {
57
- _order = null
55
+ _order = "asc";
56
+ } else if (_order == "desc") {
57
+ _order = null;
58
58
  } else {
59
- _order = 'desc'
59
+ _order = "desc";
60
60
  }
61
61
  if (hasChild(this.columns)) {
62
62
  //有子集的话,原来的数据结构被重新排序了,所以要判断当前的item 是原始数据的item再传回
63
- item = findItem(item, this.columns)
63
+ item = findItem(item, this.columns);
64
64
  }
65
- this.$set(item, '_order', _order)
66
- this.$emit('sorter', item)
65
+ this.$set(item, "_order", _order);
66
+ this.$emit("sorter", item);
67
67
  }
68
68
  },
69
69
  renderCol(hasHead) {
70
- const isFixedHeader = this.height !== undefined
71
- let cols = []
72
- let columns = this.columns2 || this.columns
73
- columns.forEach((col, i) => {
74
- let width = col.width || ''//(isFixedHeader ? 150 : '')
75
- let hasCheckbox = col.type == 'selection'
70
+ const isFixedHeader = this.height !== undefined;
71
+ let cols = [];
72
+ let columns = this.columns2 || this.columns;
73
+ columns.forEach((col,) => {
74
+ let width = col.width || ""; //(isFixedHeader ? 150 : '')
75
+ let hasCheckbox = col.type == "selection";
76
76
 
77
77
  // if (isFixedHeader && i == columns.length - 2 && columns.length > 2) width = ''
78
78
 
79
79
  // set Cols
80
80
  let colProps = {
81
81
  style: { width: `${width}px` },
82
- class: [{
83
- 'k-table-selection-col': hasCheckbox,
84
- // 'k-table-cell-fixed-left': col.fixed == 'left',
85
- // 'k-table-cell-fixed-right': col.fixed == 'right',
86
- }]
87
- }
82
+ class: [
83
+ {
84
+ "k-table-selection-col": hasCheckbox,
85
+ // 'k-table-cell-fixed-left': col.fixed == 'left',
86
+ // 'k-table-cell-fixed-right': col.fixed == 'right',
87
+ },
88
+ ],
89
+ };
88
90
  if (!width) {
89
- delete colProps.style.width
91
+ delete colProps.style.width;
90
92
  }
91
93
 
92
- if (col.fixed == 'right') {
94
+ if (col.fixed == "right") {
93
95
  // colProps.style = { width: `${width || 100}px`}
94
96
  }
95
- cols.push(<col {...colProps} />)
96
- })
97
+ cols.push(<col {...colProps} />);
98
+ });
97
99
  if (this.hasExpand) {
98
- cols.unshift(<col class="k-table-expand-icon-col"></col>)
100
+ cols.unshift(<col class="k-table-expand-icon-col"></col>);
99
101
  }
100
102
  if (isFixedHeader && hasHead) {
101
- cols.push(<col style={{ width: this.scrollBarHeight + 'px' }}></col>)
103
+ cols.push(<col style={{ width: this.scrollBarHeight + "px" }}></col>);
102
104
  }
103
- return <colgroup ref="colgroup">{cols}</colgroup>
105
+ return <colgroup ref="colgroup">{cols}</colgroup>;
104
106
  },
105
107
  renderSort(col) {
106
- return (col.sorter) ? (<span class="k-table-sorter">
107
- <Icon type={CaretUp} class={{ actived: col._order == 'asc' }} />
108
- <Icon type={CaretDown} class={{ actived: col._order == 'desc' }} />
109
- </span>) : null
108
+ return col.sorter ? (
109
+ <span class="k-table-sorter">
110
+ <Icon type={CaretUp} class={{ active: col._order == "asc" }} />
111
+ <Icon type={CaretDown} class={{ active: col._order == "desc" }} />
112
+ </span>
113
+ ) : null;
110
114
  },
111
115
  renderTH(col, left, right) {
112
- let hasCheckbox = col.type == 'selection'
113
- const hasSort = col.sorter
116
+ let hasCheckbox = col.type == "selection";
117
+ const hasSort = col.sorter;
114
118
  let props = {
115
119
  class: {
116
- 'k-table-cell-ellipsis': col.ellipsis,
117
- 'k-table-cell-selection': hasCheckbox,
118
- 'k-table-cell-fixed-left': col.fixed == 'left',
119
- 'k-table-cell-fixed-right': col.fixed == 'right',
120
- 'k-table-cell-fixed-left-last': col.last,
121
- 'k-table-cell-fixed-right-first': col.first,
122
- 'k-table-cell-sorter': hasSort,
123
- [col.className]: col.className
120
+ "k-table-cell-ellipsis": col.ellipsis,
121
+ "k-table-cell-selection": hasCheckbox,
122
+ "k-table-cell-fixed-left": col.fixed == "left",
123
+ "k-table-cell-fixed-right": col.fixed == "right",
124
+ "k-table-cell-fixed-left-last": col.last,
125
+ "k-table-cell-fixed-right-first": col.first,
126
+ "k-table-cell-sorter": hasSort,
127
+ [col.className]: col.className,
124
128
  },
125
129
  attrs: {
126
130
  key: col.key,
127
131
  colSpan: col.colSpan > 1 ? col.colSpan : null,
128
- rowSpan: col.rowSpan
132
+ rowSpan: col.rowSpan,
129
133
  },
130
134
  on: {},
131
- style: {}
135
+ style: {},
136
+ };
137
+ if (col.fixed == "left") {
138
+ props.style.left = left + "px";
132
139
  }
133
- if (col.fixed == 'left') {
134
- props.style.left = left + 'px'
135
- }
136
- if (col.fixed == 'right') {
137
- props.style.right = right + 'px'
140
+ if (col.fixed == "right") {
141
+ props.style.right = right + "px";
138
142
  }
139
143
 
140
144
  if (hasSort) {
141
- props.on.click = () => this.sorter(col)
145
+ props.on.click = () => this.sorter(col);
142
146
  }
143
147
 
144
148
  // if (hasCheckbox) {
145
149
  // console.log(this.checkAll, this.indeterminate)
146
150
  // }
147
151
 
148
- let inner = hasCheckbox && col.checkType !== 'radio' ?
149
- <Checkbox indeterminate={this.indeterminate} checked={this.checkAll} onChange={this.onSelectAll} /> :
150
- (col.$title || col.title)
152
+ let inner = hasCheckbox && col.checkType !== "radio" ? <Checkbox indeterminate={this.indeterminate} checked={this.checkAll} onChange={this.onSelectAll} /> : col.$title || col.title;
151
153
  return (
152
154
  <th {...props}>
153
155
  <span class="k-table-header-col">
@@ -155,196 +157,209 @@ export default {
155
157
  {hasSort ? this.renderSort(col) : null}
156
158
  </span>
157
159
  </th>
158
- )
160
+ );
159
161
  },
160
162
  renderHead() {
161
- let cols = []
163
+ let cols = [];
162
164
  if (hasChild(this.columns)) {
163
- cols = sortHeaderCols(this.columns)
165
+ cols = sortHeaderCols(this.columns);
164
166
  } else {
165
- cols = this.columns
167
+ cols = this.columns;
166
168
  }
167
169
  if (!cols || cols.length == 0) return null;
168
170
 
169
- let head = [], ths = [], hasFR = false, left = 0,
170
- right = cols.filter(c => c.fixed == 'right').map(c => c.width).reduce((a, b) => a + b, 0) + (this.height ? this.scrollBarHeight : 0)
171
+ let head = [],
172
+ ths = [],
173
+ left = 0,
174
+ right =
175
+ cols
176
+ .filter((c) => c.fixed == "right")
177
+ .map((c) => c.width)
178
+ .reduce((a, b) => a + b, 0) + (this.height ? this.scrollBarHeight : 0);
171
179
 
172
180
  cols.forEach((col, i) => {
173
181
  if (Array.isArray(col)) {
174
- let ths = [], r = col.filter(c => c.fixed == 'right').map(c => c.width).reduce((a, b) => a + b, 0) + (this.height ? this.scrollBarHeight : 0)
182
+ let ths = [],
183
+ r =
184
+ col
185
+ .filter((c) => c.fixed == "right")
186
+ .map((c) => c.width)
187
+ .reduce((a, b) => a + b, 0) + (this.height ? this.scrollBarHeight : 0);
175
188
 
176
189
  col.forEach((co, j) => {
177
- if (co.fixed == 'left' && j > 0) {
178
- left += col[j - 1].width
190
+ if (co.fixed == "left" && j > 0) {
191
+ left += col[j - 1].width;
179
192
  }
180
- if (co.fixed == 'right' && i < col.length) {
181
- r -= co.width
193
+ if (co.fixed == "right" && i < col.length) {
194
+ r -= co.width;
182
195
  }
183
196
 
184
- let th = this.renderTH(co, left, r)
185
- ths.push(th)
186
- })
197
+ let th = this.renderTH(co, left, r);
198
+ ths.push(th);
199
+ });
187
200
  if (i == 0 && this.width) {
188
- ths.push(<th rowSpan={col.length} class="k-table-cell-fixed-right" style={{ width: this.scrollBarHeight + 'px' }}></th>)
201
+ ths.push(<th rowSpan={col.length} class="k-table-cell-fixed-right" style={{ width: this.scrollBarHeight + "px" }}></th>);
189
202
  }
190
- head.push(<tr>{ths}</tr>)
203
+ head.push(<tr>{ths}</tr>);
191
204
  } else {
192
205
  // set Head
193
- hasFR = col.fixed == 'right'
194
206
  if (col.colSpan !== 0) {
195
- if (col.fixed == 'left' && i > 0) {
196
- left += cols[i - 1].width
207
+ if (col.fixed == "left" && i > 0) {
208
+ left += cols[i - 1].width;
197
209
  }
198
- if (col.fixed == 'right' && i < cols.length) {
199
- right -= col.width
210
+ if (col.fixed == "right" && i < cols.length) {
211
+ right -= col.width;
200
212
  }
201
- let th = this.renderTH(col, left, right)
202
- ths.push(th)
213
+ let th = this.renderTH(col, left, right);
214
+ ths.push(th);
203
215
  }
204
216
  }
205
- })
217
+ });
206
218
  if (this.hasExpand) {
207
- ths.unshift(<th></th>)
219
+ ths.unshift(<th></th>);
208
220
  }
209
221
  if (this.height != undefined) {
210
- let cls = []
211
- let hasFR = cols.filter(c => c.fixed == 'right')
222
+ let cls = [];
223
+ let hasFR = cols.filter((c) => c.fixed == "right");
212
224
  if (hasFR) {
213
- cls.push('k-table-cell-fixed-right')
225
+ cls.push("k-table-cell-fixed-right");
214
226
  }
215
- ths.push(<th style={{ width: this.scrollBarHeight + 'px' }} class={cls}></th>)
227
+ ths.push(<th style={{ width: this.scrollBarHeight + "px" }} class={cls}></th>);
216
228
  }
217
229
  if (!head.length) {
218
- head.push(<tr>{ths}</tr>)
230
+ head.push(<tr>{ths}</tr>);
219
231
  }
220
- let props = { style: {} }
232
+ let props = { style: {} };
221
233
  if (!this.height && this.sticky) {
222
- props.class = 'k-table-thead-sticky'
234
+ props.class = "k-table-thead-sticky";
223
235
  if (this.sticky > 0) {
224
- props.style.top = this.sticky + 'px'
236
+ props.style.top = this.sticky + "px";
225
237
  }
226
238
  }
227
- return <thead ref="head" {...props}>{head}</thead>
239
+ return (
240
+ <thead ref="head" {...props}>
241
+ {head}
242
+ </thead>
243
+ );
228
244
  },
229
245
  renderTable(hasHead, body) {
230
- let props = {}
231
- props.style = { width: `${this.width}px` }
246
+ let props = {};
247
+ props.style = { width: `${this.width}px` };
232
248
  return (
233
249
  <table {...props}>
234
250
  {this.renderCol(hasHead)}
235
251
  {hasHead ? this.renderHead(hasHead) : null}
236
252
  {body ? <tbody ref="tbody">{body}</tbody> : null}
237
253
  </table>
238
- )
254
+ );
239
255
  },
240
256
  onSelectAll(e) {
241
- this.$emit('select-all', e)
257
+ this.$emit("select-all", e);
242
258
  },
243
259
  asyncScroll(e, target) {
244
- let min = 0, max = e.target.scrollWidth - e.target.offsetWidth,
260
+ let min = 0,
261
+ max = e.target.scrollWidth - e.target.offsetWidth,
245
262
  scrollLeft = e.target.scrollLeft;
246
263
  scrollLeft = Math.round(scrollLeft);
247
264
 
248
265
  if (target) {
249
- if (target == 'tbody') {
266
+ if (target == "tbody") {
250
267
  if (!this.theadSync) {
251
- this.theadSync = true
252
- this.$refs[target].scrollLeft = scrollLeft
268
+ this.theadSync = true;
269
+ this.$refs[target].scrollLeft = scrollLeft;
253
270
  }
254
- this.theadSync = false
271
+ this.theadSync = false;
255
272
  }
256
- if (target == 'thead') {
273
+ if (target == "thead") {
257
274
  if (!this.tbodySync) {
258
- this.tbodySync = true
259
- this.$refs[target].scrollLeft = scrollLeft
275
+ this.tbodySync = true;
276
+ this.$refs[target].scrollLeft = scrollLeft;
260
277
  }
261
- this.tbodySync = false
278
+ this.tbodySync = false;
262
279
  }
263
280
  }
264
- let ping = 'left'
281
+ let ping = "left";
265
282
  // console.log(min, scrollLeft, max)
266
283
  if (scrollLeft > min && scrollLeft < max) {
267
- ping = 'middle'
284
+ ping = "middle";
268
285
  } else if (scrollLeft == min) {
269
- ping = 'left'
286
+ ping = "left";
270
287
  } else if (scrollLeft == max || scrollLeft - this.scrollBarHeight == max) {
271
- ping = 'right'
288
+ ping = "right";
272
289
  }
273
- this.$emit('ping', ping)
290
+ this.$emit("ping", ping);
274
291
  // this.$refs.table.setAttribute('class', `k-table11-ping-${ping}`)
275
- }
292
+ },
276
293
  },
277
294
  render() {
278
- let { height, width, body, scrollBarHeight, sticky } = this
295
+ let { height, width, body, sticky } = this;
279
296
  let rootProps = {
280
297
  // ref: 'table',
281
- class: [`k-table-container`,
298
+ class: [
299
+ `k-table-container`,
282
300
  // // { [`k-table-ping-${type}`]: width != undefined },
283
301
  ],
284
302
  style: {
285
- height: body && body.length ? '100%' : 'auto'
303
+ height: body && body.length ? "100%" : "auto",
286
304
  },
287
- on: {}
288
- }
289
- let has_sticky = sticky !== undefined && sticky > 0
305
+ on: {},
306
+ };
307
+ let has_sticky = sticky !== undefined && sticky > 0;
290
308
  if (width && !height && !has_sticky) {
291
- rootProps.style.overflow = 'auto';
292
- rootProps.on.scroll = e => this.asyncScroll(e) //只有左右,没有header scroll
309
+ rootProps.style.overflow = "auto";
310
+ rootProps.on.scroll = (e) => this.asyncScroll(e); //只有左右,没有header scroll
293
311
  }
294
- const content = []
312
+ const content = [];
295
313
  if (height || (width && has_sticky)) {
296
314
  let headProps = {
297
- class: [`k-table-thead`, { 'k-table-thead-sticky': has_sticky }],
315
+ class: [`k-table-thead`, { "k-table-thead-sticky": has_sticky }],
298
316
  on: {
299
- scroll: e => this.asyncScroll(e, 'tbody')
317
+ scroll: (e) => this.asyncScroll(e, "tbody"),
300
318
  },
301
- ref: 'thead',
319
+ ref: "thead",
302
320
  style: {
303
321
  // marginBottom: -scrollBarHeight + 'px'
304
- }
305
- }
322
+ },
323
+ };
306
324
  if (has_sticky) {
307
- headProps.style.top = sticky + 'px'
325
+ headProps.style.top = sticky + "px";
308
326
  }
309
327
  // if (width && height && !has_sticky) {
310
- // headProps.style.marginBottom = -scrollBarHeight + 'px'
328
+ // headProps.style.marginBottom = -scrollBarHeight + 'px'
311
329
  // }
312
330
 
313
331
  // if (has_sticky) {
314
- headProps.style.overflow = 'hidden'
332
+ headProps.style.overflow = "hidden";
315
333
  // } else if (height) {
316
- // headProps.style.overflow = 'auto'
334
+ // headProps.style.overflow = 'auto'
317
335
  // }
318
336
  if (this.columns && this.columns.length) {
319
- content.push(<div {...headProps}>{this.renderTable(true, false)}</div>)
337
+ content.push(<div {...headProps}>{this.renderTable(true, false)}</div>);
320
338
  }
321
339
  const props = {
322
340
  class: `k-table-body`,
323
- style: {
324
- },
341
+ style: {},
325
342
  on: {
326
- scroll: e => this.asyncScroll(e, 'thead')
343
+ scroll: (e) => this.asyncScroll(e, "thead"),
327
344
  },
328
- ref: "tbody"
329
- }
345
+ ref: "tbody",
346
+ };
330
347
  if (height) {
331
348
  props.style = {
332
- height: height + (typeof height === 'number' ? 'px' : ''),
333
- overflow: 'auto scroll'
334
- }
349
+ height: height + (typeof height === "number" ? "px" : ""),
350
+ overflow: "auto scroll",
351
+ };
335
352
  } else if (width || has_sticky) {
336
353
  props.style = {
337
- overflow: 'auto hidden'
338
- }
354
+ overflow: "auto hidden",
355
+ };
339
356
  }
340
357
  if (body && body.length) {
341
- content.push(<div {...props}>{this.renderTable(false, body)}</div>)
358
+ content.push(<div {...props}>{this.renderTable(false, body)}</div>);
342
359
  }
343
360
  } else {
344
- content.push(this.renderTable(true, body))
361
+ content.push(this.renderTable(true, body));
345
362
  }
346
- return (
347
- <div {...rootProps}>{content}</div >
348
- )
349
- }
350
- }
363
+ return <div {...rootProps}>{content}</div>;
364
+ },
365
+ };
@@ -151,7 +151,7 @@
151
151
  height: 7px;
152
152
  }
153
153
 
154
- .actived {
154
+ .active {
155
155
  color: var(--kui-color-main);
156
156
  }
157
157
  }
@@ -272,6 +272,7 @@
272
272
  height: calc(100% + 1px);
273
273
  width: 30px;
274
274
  top: 0;
275
+ pointer-events: none;
275
276
  }
276
277
  }
277
278
 
@@ -1,12 +1,12 @@
1
1
  import Empty from '../empty'
2
- import Icon from '../icon'
3
2
  import Spin from '../spin'
4
3
  import { Checkbox } from '../checkbox'
5
4
  import { Radio } from '../radio'
6
5
  import ExtendTable from './extend'
7
6
  import { sortFixedCol, hasChild, sortColumnsOnline } from './utils'
8
7
  import { Remove, Add } from 'kui-icons'
9
- export default {
8
+ import { withInstall } from '../utils/vue'
9
+ const Table = {
10
10
  name: 'Table',
11
11
  props: {
12
12
  bordered: Boolean,
@@ -31,7 +31,7 @@ export default {
31
31
  // scrollFocus: 'body',
32
32
  }
33
33
  },
34
- render() {
34
+ render(h) {
35
35
  let { $slots, data, $scopedSlots = {}, loading, height, width, sticky } = this
36
36
  // bordered = true
37
37
  const { header, footer } = $slots
@@ -70,7 +70,7 @@ export default {
70
70
  let indeterminate = data.filter(x => x._checked).length > 0 && !checkAll;
71
71
  //Set Data
72
72
  data.forEach((d, i) => {
73
- let tr = [], trL = [], trR = [];
73
+ let tr = [];
74
74
  // d._checked = d._checked || false
75
75
  // d._disabled = d._disabled || false
76
76
 
@@ -144,7 +144,7 @@ export default {
144
144
  }
145
145
  })
146
146
  if (expandNode) {
147
- tr.unshift(<td class="k-table-row-expand-icon-cell"><Button size="small" onClick={e => this.onExpand(d)} icon={d._expanded ? Remove : Add} /></td>)
147
+ tr.unshift(<td class="k-table-row-expand-icon-cell"><Button size="small" onClick={() => this.onExpand(d)} icon={d._expanded ? Remove : Add} /></td>)
148
148
  }
149
149
  let trProps = {
150
150
  class: { 'k-table-row-hover': d._hover },
@@ -268,4 +268,6 @@ export default {
268
268
  this.checkAll = checked
269
269
  }
270
270
  }
271
- }
271
+ }
272
+
273
+ export default withInstall(Table)
@@ -6,15 +6,15 @@
6
6
  ```vue
7
7
  <template>
8
8
  <Tabs v-model="current" @change="change">
9
- <TabPane key="1" title="Tab 1">
9
+ <TabPanel key="1" title="Tab 1">
10
10
  Content of Tab Pane 1
11
- </TabPane>
12
- <TabPane key="2" title="Tab 2">
11
+ </TabPanel>
12
+ <TabPanel key="2" title="Tab 2">
13
13
  Content of Tab Pane 2
14
- </TabPane>
15
- <TabPane key="3" title="Tab 3">
14
+ </TabPanel>
15
+ <TabPanel key="3" title="Tab 3">
16
16
  Content of Tab Pane 3
17
- </TabPane>
17
+ </TabPanel>
18
18
  </Tabs>
19
19
  </template>
20
20
  <script>
@@ -6,15 +6,15 @@
6
6
  ```vue
7
7
  <template>
8
8
  <Tabs v-model="current" card>
9
- <TabPane key="1" title="Tab 1">
9
+ <TabPanel key="1" title="Tab 1">
10
10
  Content of Tab Pane 1
11
- </TabPane>
12
- <TabPane key="2" title="Tab 2">
11
+ </TabPanel>
12
+ <TabPanel key="2" title="Tab 2">
13
13
  Content of Tab Pane 2
14
- </TabPane>
15
- <TabPane key="3" title="Tab 3">
14
+ </TabPanel>
15
+ <TabPanel key="3" title="Tab 3">
16
16
  Content of Tab Pane 3
17
- </TabPane>
17
+ </TabPanel>
18
18
  </Tabs>
19
19
  </template>
20
20
  <script>
@@ -6,15 +6,15 @@
6
6
  ```vue
7
7
  <template>
8
8
  <Tabs v-model="current" centered>
9
- <TabPane key="1" title="Tab 1">
9
+ <TabPanel key="1" title="Tab 1">
10
10
  Content of Tab Pane 1
11
- </TabPane>
12
- <TabPane key="2" title="Tab 2">
11
+ </TabPanel>
12
+ <TabPanel key="2" title="Tab 2">
13
13
  Content of Tab Pane 2
14
- </TabPane>
15
- <TabPane key="3" title="Tab 3">
14
+ </TabPanel>
15
+ <TabPanel key="3" title="Tab 3">
16
16
  Content of Tab Pane 3
17
- </TabPane>
17
+ </TabPanel>
18
18
  </Tabs>
19
19
  </template>
20
20
  <script>