@king-design/react 3.1.4-beta.2 → 3.1.5

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 (553) hide show
  1. package/__tests__/__snapshots__/Dialog.md +1 -1
  2. package/__tests__/__snapshots__/React Demos.md +260 -254
  3. package/__tests__/components/cascader.spec.tsx +1 -1
  4. package/components/affix/index.d.ts +2 -2
  5. package/components/affix/index.js +0 -5
  6. package/components/affix/index.spec.js +84 -108
  7. package/components/affix/index.vdt.js +7 -10
  8. package/components/affix/styles.js +1 -1
  9. package/components/affix/useStyle.js +8 -19
  10. package/components/badge/index.js +0 -5
  11. package/components/badge/index.vdt.js +7 -11
  12. package/components/badge/styles.js +1 -3
  13. package/components/breadcrumb/index.js +0 -7
  14. package/components/breadcrumb/index.spec.js +6 -6
  15. package/components/breadcrumb/index.vdt.js +5 -14
  16. package/components/breadcrumb/item.js +0 -8
  17. package/components/breadcrumb/item.vdt.js +3 -6
  18. package/components/breadcrumb/styles.js +1 -4
  19. package/components/button/dynamicButton.d.ts +1 -1
  20. package/components/button/dynamicButton.js +2 -5
  21. package/components/button/group.js +2 -13
  22. package/components/button/group.vdt.js +5 -8
  23. package/components/button/index.js +3 -27
  24. package/components/button/index.spec.js +74 -96
  25. package/components/button/index.vdt.js +21 -31
  26. package/components/button/styles.d.ts +2 -2
  27. package/components/button/styles.js +8 -53
  28. package/components/card/column.js +0 -5
  29. package/components/card/column.vdt.js +5 -10
  30. package/components/card/index.js +0 -7
  31. package/components/card/index.vdt.js +5 -17
  32. package/components/card/styles.js +3 -6
  33. package/components/carousel/index.js +1 -19
  34. package/components/carousel/index.spec.js +127 -163
  35. package/components/carousel/index.vdt.js +12 -16
  36. package/components/carousel/item.js +0 -5
  37. package/components/carousel/item.vdt.js +4 -7
  38. package/components/carousel/styles.js +2 -3
  39. package/components/carousel/useAutoplay.js +0 -4
  40. package/components/carousel/useItems.js +4 -20
  41. package/components/carousel/useSlide.js +57 -89
  42. package/components/cascader/index.js +3 -18
  43. package/components/cascader/index.spec.js +365 -379
  44. package/components/cascader/index.vdt.js +15 -33
  45. package/components/cascader/styles.js +2 -8
  46. package/components/cascader/useFields.js +1 -4
  47. package/components/cascader/useFilterable.js +2 -19
  48. package/components/cascader/useLabel.js +1 -9
  49. package/components/cascader/useLoad.js +22 -35
  50. package/components/cascader/useValue.d.ts +2 -2
  51. package/components/cascader/useValue.js +6 -27
  52. package/components/checkbox/index.js +5 -27
  53. package/components/checkbox/index.spec.js +129 -171
  54. package/components/checkbox/index.vdt.js +12 -16
  55. package/components/checkbox/styles.js +1 -13
  56. package/components/code/crossDomain.js +2 -9
  57. package/components/code/index.js +0 -9
  58. package/components/code/index.spec.js +46 -55
  59. package/components/code/index.vdt.js +6 -14
  60. package/components/code/styles.js +0 -1
  61. package/components/code/useEditor.js +5 -10
  62. package/components/collapse/index.d.ts +1 -1
  63. package/components/collapse/index.js +3 -17
  64. package/components/collapse/index.spec.js +47 -60
  65. package/components/collapse/index.vdt.js +4 -12
  66. package/components/collapse/item.js +0 -10
  67. package/components/collapse/item.vdt.js +7 -14
  68. package/components/collapse/styles.js +2 -5
  69. package/components/colorpicker/drag.js +0 -5
  70. package/components/colorpicker/index.js +0 -7
  71. package/components/colorpicker/index.spec.js +211 -259
  72. package/components/colorpicker/index.vdt.js +8 -11
  73. package/components/colorpicker/panel.js +0 -5
  74. package/components/colorpicker/panel.vdt.js +21 -26
  75. package/components/colorpicker/styles.js +4 -15
  76. package/components/colorpicker/useDrag.js +22 -26
  77. package/components/colorpicker/useInput.js +0 -16
  78. package/components/colorpicker/usePointer.js +15 -18
  79. package/components/colorpicker/useValue.js +2 -7
  80. package/components/config/index.js +3 -8
  81. package/components/config/index.spec.js +37 -50
  82. package/components/context.d.ts +2 -2
  83. package/components/context.js +2 -21
  84. package/components/copy/index.js +0 -7
  85. package/components/copy/index.spec.js +64 -86
  86. package/components/copy/index.vdt.js +4 -7
  87. package/components/copy/styles.js +0 -1
  88. package/components/copy/useCopy.js +13 -23
  89. package/components/datepicker/basepicker.d.ts +8 -8
  90. package/components/datepicker/basepicker.js +20 -90
  91. package/components/datepicker/calendar.js +0 -11
  92. package/components/datepicker/calendar.vdt.js +11 -15
  93. package/components/datepicker/constants.js +0 -1
  94. package/components/datepicker/dayjs.js +1 -1
  95. package/components/datepicker/helpers.js +3 -15
  96. package/components/datepicker/index.js +6 -32
  97. package/components/datepicker/index.spec.js +1154 -1464
  98. package/components/datepicker/index.vdt.js +20 -34
  99. package/components/datepicker/shortcuts.d.ts +1 -1
  100. package/components/datepicker/shortcuts.js +0 -4
  101. package/components/datepicker/styles.js +3 -12
  102. package/components/datepicker/time.d.ts +1 -1
  103. package/components/datepicker/time.js +3 -23
  104. package/components/datepicker/time.vdt.js +4 -5
  105. package/components/datepicker/useDays.js +2 -9
  106. package/components/datepicker/useDisabled.js +6 -23
  107. package/components/datepicker/useFocusDate.js +0 -2
  108. package/components/datepicker/useFormats.js +6 -15
  109. package/components/datepicker/useKeyboards.js +20 -36
  110. package/components/datepicker/useMonths.js +0 -6
  111. package/components/datepicker/usePanel.js +0 -10
  112. package/components/datepicker/useShowDate.js +10 -37
  113. package/components/datepicker/useStatus.js +3 -15
  114. package/components/datepicker/useValue.js +20 -38
  115. package/components/datepicker/useYears.js +4 -15
  116. package/components/diagram/diagram.js +17 -43
  117. package/components/diagram/diagram.vdt.js +2 -5
  118. package/components/diagram/graph.js +6 -6
  119. package/components/diagram/index.d.ts +1 -1
  120. package/components/diagram/index.js +7 -7
  121. package/components/diagram/index.spec.js +369 -495
  122. package/components/diagram/layouts/circle.js +6 -14
  123. package/components/diagram/layouts/flow.js +7 -15
  124. package/components/diagram/layouts/layout.js +6 -28
  125. package/components/diagram/layouts/organic.js +3 -11
  126. package/components/diagram/layouts/partition.js +4 -12
  127. package/components/diagram/layouts/radial.js +6 -18
  128. package/components/diagram/layouts/stack.js +6 -14
  129. package/components/diagram/layouts/tree.js +11 -21
  130. package/components/diagram/mxgraph/handler/mxConnectionHandler.js +15 -22
  131. package/components/diagram/mxgraph/handler/mxConstraintHandler.js +4 -4
  132. package/components/diagram/mxgraph/handler/mxEdgeHandler.js +11 -15
  133. package/components/diagram/mxgraph/handler/mxGraphHandler.js +6 -9
  134. package/components/diagram/mxgraph/handler/mxRubberband.js +4 -4
  135. package/components/diagram/mxgraph/handler/mxVertexHandler.js +7 -10
  136. package/components/diagram/mxgraph/index.js +0 -2
  137. package/components/diagram/mxgraph/mx.js +3 -3
  138. package/components/diagram/mxgraph/shape/mxCloud.js +2 -2
  139. package/components/diagram/mxgraph/shape/mxCylinder.js +4 -9
  140. package/components/diagram/mxgraph/shape/mxEllipse.js +2 -2
  141. package/components/diagram/mxgraph/shape/mxHexagon.js +2 -2
  142. package/components/diagram/mxgraph/shape/mxLine.js +2 -2
  143. package/components/diagram/mxgraph/shape/mxRectangleShape.js +2 -2
  144. package/components/diagram/mxgraph/shape/mxRhombus.js +6 -12
  145. package/components/diagram/mxgraph/shape/mxShape.js +0 -1
  146. package/components/diagram/mxgraph/shape/mxTriangle.js +2 -2
  147. package/components/diagram/mxgraph/util/mxConstants.js +2 -2
  148. package/components/diagram/mxgraph/util/mxGuide.js +5 -7
  149. package/components/diagram/mxgraph/view/mxCellEditor.js +16 -29
  150. package/components/diagram/mxgraph/view/mxCellRenderer.js +0 -2
  151. package/components/diagram/mxgraph/view/mxGraph.js +14 -32
  152. package/components/diagram/shapes/base.d.ts +1 -1
  153. package/components/diagram/shapes/base.js +9 -39
  154. package/components/diagram/shapes/callout.js +10 -23
  155. package/components/diagram/shapes/circle.js +3 -10
  156. package/components/diagram/shapes/document.js +5 -16
  157. package/components/diagram/shapes/ellipse.js +0 -5
  158. package/components/diagram/shapes/generateShapes.d.ts +1 -1
  159. package/components/diagram/shapes/generateShapes.js +0 -9
  160. package/components/diagram/shapes/hexagon.js +9 -26
  161. package/components/diagram/shapes/image.js +1 -9
  162. package/components/diagram/shapes/line.d.ts +2 -2
  163. package/components/diagram/shapes/line.js +13 -48
  164. package/components/diagram/shapes/parallelogram.js +9 -26
  165. package/components/diagram/shapes/rectangle.js +1 -9
  166. package/components/diagram/shapes/shape.js +6 -35
  167. package/components/diagram/shapes/square.js +3 -11
  168. package/components/diagram/shapes/text.js +0 -5
  169. package/components/diagram/styles.js +0 -1
  170. package/components/dialog/alert.vdt.js +9 -20
  171. package/components/dialog/base.js +1 -29
  172. package/components/dialog/base.vdt.js +14 -31
  173. package/components/dialog/index.js +6 -31
  174. package/components/dialog/index.spec.js +456 -627
  175. package/components/dialog/staticMethods.d.ts +1 -1
  176. package/components/dialog/staticMethods.js +2 -13
  177. package/components/dialog/styles.js +3 -14
  178. package/components/dialog/useDraggable.js +0 -6
  179. package/components/dialog/useEscClosable.js +4 -12
  180. package/components/dialog/useFixBody.d.ts +1 -1
  181. package/components/dialog/useFixBody.js +0 -11
  182. package/components/dialog/usePosition.js +0 -5
  183. package/components/drawer/index.js +0 -5
  184. package/components/drawer/index.spec.js +128 -170
  185. package/components/drawer/index.vdt.js +3 -9
  186. package/components/drawer/styles.d.ts +2 -2
  187. package/components/drawer/styles.js +1 -4
  188. package/components/dropdown/dropdown.d.ts +2 -2
  189. package/components/dropdown/dropdown.js +33 -90
  190. package/components/dropdown/index.js +2 -6
  191. package/components/dropdown/index.spec.js +388 -496
  192. package/components/dropdown/item.js +4 -25
  193. package/components/dropdown/item.vdt.js +5 -8
  194. package/components/dropdown/menu.js +14 -29
  195. package/components/dropdown/menu.vdt.js +5 -13
  196. package/components/dropdown/styles.js +2 -11
  197. package/components/dropdown/useKeyboard.d.ts +2 -2
  198. package/components/dropdown/useKeyboard.js +8 -30
  199. package/components/dropdown/usePosition.d.ts +2 -1
  200. package/components/dropdown/usePosition.js +24 -22
  201. package/components/dropdown/useTransition.js +0 -8
  202. package/components/editable/index.d.ts +1 -1
  203. package/components/editable/index.js +4 -28
  204. package/components/editable/index.spec.js +152 -189
  205. package/components/editable/index.vdt.js +8 -11
  206. package/components/editable/styles.js +1 -2
  207. package/components/form/form.js +0 -18
  208. package/components/form/form.vdt.js +4 -7
  209. package/components/form/index.spec.js +1082 -1316
  210. package/components/form/item.d.ts +1 -1
  211. package/components/form/item.js +0 -12
  212. package/components/form/item.vdt.js +17 -31
  213. package/components/form/methods.d.ts +5 -5
  214. package/components/form/methods.js +2 -12
  215. package/components/form/styles.js +2 -10
  216. package/components/form/useDirty.js +2 -8
  217. package/components/form/useError.js +2 -10
  218. package/components/form/useValidate.d.ts +1 -1
  219. package/components/form/useValidate.js +8 -24
  220. package/components/grid/col.d.ts +3 -3
  221. package/components/grid/col.js +0 -7
  222. package/components/grid/col.vdt.js +8 -13
  223. package/components/grid/constants.d.ts +6 -6
  224. package/components/grid/row.js +0 -5
  225. package/components/grid/row.vdt.js +5 -8
  226. package/components/grid/styles.js +2 -8
  227. package/components/grid/useBreakpoints.js +0 -5
  228. package/components/grid/useGutter.js +9 -27
  229. package/components/icon/index.js +0 -10
  230. package/components/icon/index.vdt.js +8 -14
  231. package/components/icon/styles.js +1 -4
  232. package/components/input/index.d.ts +3 -3
  233. package/components/input/index.js +0 -13
  234. package/components/input/index.spec.js +185 -239
  235. package/components/input/index.vdt.js +46 -57
  236. package/components/input/search.js +0 -20
  237. package/components/input/search.vdt.js +6 -9
  238. package/components/input/styles.js +2 -29
  239. package/components/input/useAutoRows.js +6 -18
  240. package/components/input/useAutoWidth.js +0 -5
  241. package/components/input/useFocus.js +0 -2
  242. package/components/input/useFrozen.js +0 -6
  243. package/components/input/useShowPassword.js +2 -5
  244. package/components/layout/aside.js +6 -18
  245. package/components/layout/aside.vdt.js +5 -9
  246. package/components/layout/body.js +5 -18
  247. package/components/layout/footer.js +1 -10
  248. package/components/layout/header.js +9 -23
  249. package/components/layout/index.spec.js +24 -34
  250. package/components/layout/layout.js +9 -24
  251. package/components/layout/styles.js +6 -17
  252. package/components/layout/template.vdt.js +2 -4
  253. package/components/layout/useParse.js +0 -7
  254. package/components/menu/index.spec.js +189 -242
  255. package/components/menu/item.js +3 -16
  256. package/components/menu/item.vdt.js +22 -38
  257. package/components/menu/menu.js +2 -11
  258. package/components/menu/menu.vdt.js +6 -12
  259. package/components/menu/styles.js +4 -23
  260. package/components/menu/useDropdown.js +4 -10
  261. package/components/menu/useExpanded.js +0 -14
  262. package/components/menu/useHighlight.js +26 -36
  263. package/components/message/index.spec.js +58 -73
  264. package/components/message/message.js +0 -19
  265. package/components/message/message.vdt.js +6 -9
  266. package/components/message/messages.js +0 -12
  267. package/components/message/messages.vdt.js +0 -1
  268. package/components/message/styles.js +2 -11
  269. package/components/pagination/index.d.ts +1 -1
  270. package/components/pagination/index.js +10 -46
  271. package/components/pagination/index.spec.js +133 -173
  272. package/components/pagination/index.vdt.js +14 -32
  273. package/components/pagination/styles.js +3 -9
  274. package/components/popover/content.js +1 -5
  275. package/components/popover/content.vdt.js +4 -14
  276. package/components/popover/index.js +5 -10
  277. package/components/popover/index.spec.js +113 -150
  278. package/components/popover/styles.js +1 -1
  279. package/components/portal.d.ts +1 -1
  280. package/components/portal.js +2 -30
  281. package/components/position.d.ts +12 -12
  282. package/components/position.js +32 -88
  283. package/components/progress/index.d.ts +6 -6
  284. package/components/progress/index.js +0 -12
  285. package/components/progress/index.spec.js +143 -191
  286. package/components/progress/index.vdt.js +8 -17
  287. package/components/progress/styles.js +1 -7
  288. package/components/progress/useColor.js +2 -7
  289. package/components/progress/useStatus.d.ts +1 -1
  290. package/components/progress/useStatus.js +2 -5
  291. package/components/radio/index.js +3 -18
  292. package/components/radio/index.spec.js +111 -149
  293. package/components/radio/index.vdt.js +14 -17
  294. package/components/radio/styles.js +1 -13
  295. package/components/rate/index.js +0 -7
  296. package/components/rate/index.spec.js +64 -79
  297. package/components/rate/index.vdt.js +8 -21
  298. package/components/rate/styles.js +1 -4
  299. package/components/rate/useActiveValue.js +2 -7
  300. package/components/scrollSelect/index.d.ts +2 -2
  301. package/components/scrollSelect/index.js +0 -7
  302. package/components/scrollSelect/index.spec.js +100 -131
  303. package/components/scrollSelect/index.vdt.js +6 -12
  304. package/components/scrollSelect/styles.js +1 -8
  305. package/components/scrollSelect/useList.js +3 -17
  306. package/components/scrollSelect/useMouseEvents.js +31 -49
  307. package/components/scrollSelect/useTranslate.js +1 -11
  308. package/components/select/base.d.ts +2 -2
  309. package/components/select/base.js +3 -33
  310. package/components/select/base.vdt.js +27 -46
  311. package/components/select/group.js +0 -5
  312. package/components/select/group.vdt.js +4 -10
  313. package/components/select/index.spec.js +370 -464
  314. package/components/select/menu.js +0 -5
  315. package/components/select/menu.vdt.js +18 -33
  316. package/components/select/option.js +2 -16
  317. package/components/select/option.vdt.js +7 -14
  318. package/components/select/select.js +3 -20
  319. package/components/select/select.vdt.js +9 -17
  320. package/components/select/styles.js +3 -34
  321. package/components/select/useBaseLabel.d.ts +1 -1
  322. package/components/select/useBaseLabel.js +4 -17
  323. package/components/select/useCard.js +0 -4
  324. package/components/select/useDraggble.js +2 -2
  325. package/components/select/useEqualWidth.js +0 -1
  326. package/components/select/useFilterable.js +9 -27
  327. package/components/select/useFocusout.d.ts +1 -1
  328. package/components/select/useFocusout.js +1 -9
  329. package/components/select/useInput.js +6 -10
  330. package/components/select/useLabel.js +3 -13
  331. package/components/select/useSearchable.js +0 -10
  332. package/components/skeleton/item.d.ts +1 -1
  333. package/components/skeleton/item.js +0 -7
  334. package/components/skeleton/item.vdt.js +1 -6
  335. package/components/skeleton/skeleton.js +0 -7
  336. package/components/skeleton/skeleton.vdt.js +6 -12
  337. package/components/skeleton/styles.d.ts +1 -1
  338. package/components/skeleton/styles.js +2 -3
  339. package/components/slider/index.d.ts +1 -1
  340. package/components/slider/index.js +0 -7
  341. package/components/slider/index.spec.js +502 -624
  342. package/components/slider/index.vdt.js +35 -50
  343. package/components/slider/styles.js +1 -19
  344. package/components/slider/useClick.js +2 -11
  345. package/components/slider/useDraggable.js +23 -34
  346. package/components/slider/useKeyboard.js +7 -18
  347. package/components/slider/useMarks.d.ts +5 -5
  348. package/components/slider/useMarks.js +5 -13
  349. package/components/slider/usePoints.d.ts +2 -2
  350. package/components/slider/usePoints.js +7 -21
  351. package/components/slider/useStyles.d.ts +1 -1
  352. package/components/slider/useStyles.js +5 -10
  353. package/components/slider/useTooltip.js +2 -10
  354. package/components/slider/useValue.d.ts +1 -1
  355. package/components/slider/useValue.js +7 -24
  356. package/components/spin/index.js +0 -7
  357. package/components/spin/index.vdt.js +4 -11
  358. package/components/spin/styles.js +1 -3
  359. package/components/spinner/index.d.ts +4 -4
  360. package/components/spinner/index.js +6 -18
  361. package/components/spinner/index.spec.js +359 -460
  362. package/components/spinner/index.vdt.js +12 -15
  363. package/components/spinner/styles.js +1 -11
  364. package/components/spinner/useChange.js +4 -16
  365. package/components/spinner/useFormatter.js +6 -16
  366. package/components/spinner/useStep.d.ts +3 -3
  367. package/components/spinner/useStep.js +2 -20
  368. package/components/spinner/useValue.js +14 -32
  369. package/components/split/index.js +0 -7
  370. package/components/split/index.spec.js +223 -267
  371. package/components/split/index.vdt.js +8 -17
  372. package/components/split/memo.js +0 -6
  373. package/components/split/styles.d.ts +1 -1
  374. package/components/split/styles.js +1 -9
  375. package/components/split/useDraggable.js +11 -35
  376. package/components/split/useSize.js +2 -5
  377. package/components/steps/context.d.ts +3 -3
  378. package/components/steps/index.js +2 -13
  379. package/components/steps/index.spec.js +21 -27
  380. package/components/steps/index.vdt.js +9 -12
  381. package/components/steps/step.js +0 -5
  382. package/components/steps/step.vdt.js +8 -12
  383. package/components/steps/styles.js +1 -38
  384. package/components/switch/index.js +2 -23
  385. package/components/switch/index.spec.js +194 -234
  386. package/components/switch/index.vdt.js +16 -32
  387. package/components/switch/styles.js +4 -12
  388. package/components/switch/useDraggable.js +10 -18
  389. package/components/table/cell.js +0 -9
  390. package/components/table/cell.vdt.js +14 -21
  391. package/components/table/column.d.ts +1 -1
  392. package/components/table/column.js +0 -5
  393. package/components/table/column.vdt.js +25 -37
  394. package/components/table/exportTable.js +41 -55
  395. package/components/table/index.spec.js +817 -1026
  396. package/components/table/row.d.ts +1 -1
  397. package/components/table/row.js +12 -44
  398. package/components/table/row.vdt.js +27 -38
  399. package/components/table/styles.js +2 -18
  400. package/components/table/table.d.ts +5 -5
  401. package/components/table/table.js +18 -50
  402. package/components/table/table.vdt.js +61 -86
  403. package/components/table/useChecked.d.ts +1 -1
  404. package/components/table/useChecked.js +20 -61
  405. package/components/table/useColumns.js +3 -16
  406. package/components/table/useDisableRow.js +2 -12
  407. package/components/table/useDraggable.js +4 -8
  408. package/components/table/useExpandable.js +2 -5
  409. package/components/table/useFixedColumns.d.ts +1 -1
  410. package/components/table/useFixedColumns.js +3 -20
  411. package/components/table/useGroup.d.ts +1 -1
  412. package/components/table/useGroup.js +7 -25
  413. package/components/table/useMerge.d.ts +4 -4
  414. package/components/table/useMerge.js +2 -14
  415. package/components/table/usePagination.js +4 -18
  416. package/components/table/useResetRowStatus.js +2 -6
  417. package/components/table/useResizable.js +4 -21
  418. package/components/table/useScroll.d.ts +1 -1
  419. package/components/table/useScroll.js +0 -3
  420. package/components/table/useSelected.js +2 -5
  421. package/components/table/useSortable.js +2 -8
  422. package/components/table/useStickyHeader.js +3 -7
  423. package/components/table/useStickyScrollbar.js +6 -16
  424. package/components/table/useTree.js +1 -12
  425. package/components/table/useWidth.js +14 -30
  426. package/components/tabs/index.js +29 -51
  427. package/components/tabs/index.spec.js +97 -129
  428. package/components/tabs/index.vdt.js +13 -16
  429. package/components/tabs/styles.js +1 -23
  430. package/components/tabs/tab.js +0 -10
  431. package/components/tabs/tab.vdt.js +6 -10
  432. package/components/tabs/useActiveBar.js +2 -11
  433. package/components/tabs/useScroll.js +10 -30
  434. package/components/tag/base.js +0 -11
  435. package/components/tag/index.js +2 -4
  436. package/components/tag/index.spec.js +123 -156
  437. package/components/tag/index.vdt.js +8 -15
  438. package/components/tag/styles.d.ts +1 -1
  439. package/components/tag/styles.js +2 -18
  440. package/components/tag/tags.d.ts +2 -2
  441. package/components/tag/tags.js +0 -7
  442. package/components/tag/tags.vdt.js +10 -18
  443. package/components/tag/useChildren.js +0 -5
  444. package/components/tag/useDraggable.js +6 -15
  445. package/components/tag/useNowrap.js +10 -27
  446. package/components/timeline/item.js +0 -7
  447. package/components/timeline/item.vdt.js +4 -9
  448. package/components/timeline/styles.d.ts +2 -2
  449. package/components/timeline/styles.js +2 -6
  450. package/components/timeline/timeline.js +0 -5
  451. package/components/timeline/timeline.vdt.js +2 -5
  452. package/components/timepicker/index.js +2 -7
  453. package/components/timepicker/index.spec.js +293 -368
  454. package/components/timepicker/panelPicker.js +2 -11
  455. package/components/timepicker/panelPicker.vdt.js +14 -24
  456. package/components/timepicker/selectPicker.js +0 -5
  457. package/components/timepicker/selectPicker.vdt.js +5 -10
  458. package/components/timepicker/styles.js +1 -2
  459. package/components/timepicker/useDisabled.js +2 -4
  460. package/components/timepicker/useFormats.js +4 -13
  461. package/components/timepicker/useStep.d.ts +1 -1
  462. package/components/timepicker/useStep.js +8 -17
  463. package/components/timepicker/useValue.js +16 -21
  464. package/components/tip/index.js +0 -2
  465. package/components/tip/index.vdt.js +5 -17
  466. package/components/tip/styles.js +1 -4
  467. package/components/tooltip/content.js +0 -28
  468. package/components/tooltip/content.vdt.js +15 -27
  469. package/components/tooltip/index.js +3 -7
  470. package/components/tooltip/index.spec.js +400 -527
  471. package/components/tooltip/styles.d.ts +1 -1
  472. package/components/tooltip/styles.js +3 -13
  473. package/components/tooltip/tooltip.js +2 -15
  474. package/components/tooltip/useArrow.js +11 -14
  475. package/components/transfer/index.d.ts +1 -1
  476. package/components/transfer/index.js +1 -13
  477. package/components/transfer/index.spec.js +159 -194
  478. package/components/transfer/index.vdt.js +17 -36
  479. package/components/transfer/styles.js +1 -11
  480. package/components/transfer/useCheck.d.ts +1 -1
  481. package/components/transfer/useCheck.js +1 -16
  482. package/components/transfer/useFilter.d.ts +1 -1
  483. package/components/transfer/useFilter.js +9 -30
  484. package/components/transfer/useTransfer.js +10 -26
  485. package/components/tree/index.d.ts +3 -3
  486. package/components/tree/index.js +3 -22
  487. package/components/tree/index.spec.js +310 -388
  488. package/components/tree/index.vdt.js +12 -24
  489. package/components/tree/styles.js +3 -17
  490. package/components/tree/useChecked.js +3 -27
  491. package/components/tree/useDraggable.js +14 -44
  492. package/components/tree/useExpanded.js +28 -46
  493. package/components/tree/useFilter.js +3 -10
  494. package/components/tree/useNodes.d.ts +3 -3
  495. package/components/tree/useNodes.js +0 -4
  496. package/components/tree/useSelected.js +21 -38
  497. package/components/tree/useTransitionEvent.js +3 -5
  498. package/components/treeSelect/index.js +9 -37
  499. package/components/treeSelect/index.spec.js +123 -160
  500. package/components/treeSelect/index.vdt.js +14 -20
  501. package/components/treeSelect/styles.js +1 -2
  502. package/components/treeSelect/useValue.js +0 -11
  503. package/components/types.d.ts +3 -3
  504. package/components/upload/ajaxUploader.d.ts +1 -1
  505. package/components/upload/ajaxUploader.js +0 -17
  506. package/components/upload/index.d.ts +4 -4
  507. package/components/upload/index.js +0 -14
  508. package/components/upload/index.spec.js +142 -248
  509. package/components/upload/index.vdt.js +12 -28
  510. package/components/upload/styles.js +2 -28
  511. package/components/upload/useAccept.js +2 -10
  512. package/components/upload/useDrag.js +0 -7
  513. package/components/upload/useFiles.js +103 -148
  514. package/components/upload/useShowImage.js +0 -3
  515. package/components/upload/useUpload.js +47 -69
  516. package/components/utils.d.ts +6 -6
  517. package/components/utils.js +12 -56
  518. package/components/virtual.js +9 -37
  519. package/components/wave/index.js +5 -32
  520. package/components/wave/styles.js +1 -1
  521. package/hooks/useDelayClose.js +2 -7
  522. package/hooks/useDocumentClick.js +8 -16
  523. package/hooks/useDraggable.d.ts +1 -1
  524. package/hooks/useDraggable.js +0 -9
  525. package/hooks/useKeyboard.d.ts +3 -3
  526. package/hooks/useKeyboard.js +0 -10
  527. package/hooks/useMouseOutsidable.js +0 -8
  528. package/hooks/useReceive.d.ts +1 -1
  529. package/hooks/useReceive.js +0 -4
  530. package/hooks/useRecordComponent.js +0 -6
  531. package/hooks/useResizeObserver.js +0 -2
  532. package/hooks/useRouter.js +7 -18
  533. package/hooks/useShowHideEvents.js +0 -3
  534. package/hooks/useState.d.ts +2 -2
  535. package/hooks/useState.js +2 -6
  536. package/i18n/en-US.js +0 -1
  537. package/i18n/index.d.ts +1 -1
  538. package/i18n/index.js +0 -7
  539. package/index.d.ts +2 -2
  540. package/index.js +2 -3
  541. package/package.json +2 -2
  542. package/styles/global.js +2 -5
  543. package/styles/keyframes.js +0 -1
  544. package/styles/theme.d.ts +1 -1
  545. package/styles/theme.js +2 -5
  546. package/styles/utils.d.ts +1 -1
  547. package/styles/utils.js +3 -17
  548. package/yarn-error.log +528 -0
  549. package/components/cascader/index.d.ts +0 -45
  550. package/components/datepicker/index.d.ts +0 -63
  551. package/components/select/select.d.ts +0 -33
  552. package/components/timepicker/panelPicker.d.ts +0 -54
  553. package/components/treeSelect/index.d.ts +0 -28
@@ -17,664 +17,559 @@ describe('Slider', function () {
17
17
  });
18
18
  it('basic test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
19
19
  var _mount, instance, element, _element$querySelecto, slider, handle, wrapper, width, bar;
20
-
21
20
  return _regeneratorRuntime.wrap(function _callee$(_context) {
22
- while (1) {
23
- switch (_context.prev = _context.next) {
24
- case 0:
25
- _mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
26
- _element$querySelecto = element.querySelectorAll('.k-slider'), slider = _element$querySelecto[1]; // drag
27
-
28
- handle = slider.querySelector('.k-slider-thumb');
29
- dispatchEvent(handle, 'mousedown', {
30
- which: 1
31
- });
32
- dispatchEvent(handle, 'focusin');
33
- dispatchEvent(document, 'mousemove', {
34
- clientX: 0
35
- });
36
- expect(instance.get('value2')).eql(50); // move to boundary
37
-
38
- dispatchEvent(document, 'mousemove', {
39
- clientX: -10
40
- });
41
- expect(instance.get('value2')).eql(50);
42
- dispatchEvent(document, 'mousemove', {
43
- clientX: 999999
44
- });
45
- expect(instance.get('value2')).eql(500);
46
- dispatchEvent(document, 'mouseup'); // click
47
-
48
- wrapper = slider.querySelector('.k-slider-track-wrapper');
49
- width = wrapper.getBoundingClientRect().width;
50
- dispatchEvent(wrapper, 'click', {
51
- clientX: width / 2
52
- });
53
- expect(instance.get('value2')).eql((500 + 50) / 2); // set value
54
-
55
- bar = slider.querySelector('.k-slider-bar');
56
- instance.set('value2', 135 + 50);
57
- _context.next = 20;
58
- return wait();
59
-
60
- case 20:
61
- expect(bar.style.width).eql('30%');
62
- instance.set('value2', -10);
63
- _context.next = 24;
64
- return wait();
65
-
66
- case 24:
67
- expect(bar.style.width).eql('0%');
68
- instance.set('value2', 1000);
69
- _context.next = 28;
70
- return wait();
71
-
72
- case 28:
73
- expect(bar.style.width).eql('100%');
74
-
75
- case 29:
76
- case "end":
77
- return _context.stop();
78
- }
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ _mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
24
+ _element$querySelecto = element.querySelectorAll('.k-slider'), slider = _element$querySelecto[1]; // drag
25
+ handle = slider.querySelector('.k-slider-thumb');
26
+ dispatchEvent(handle, 'mousedown', {
27
+ which: 1
28
+ });
29
+ dispatchEvent(handle, 'focusin');
30
+ dispatchEvent(document, 'mousemove', {
31
+ clientX: 0
32
+ });
33
+ expect(instance.get('value2')).eql(50);
34
+ // move to boundary
35
+ dispatchEvent(document, 'mousemove', {
36
+ clientX: -10
37
+ });
38
+ expect(instance.get('value2')).eql(50);
39
+ dispatchEvent(document, 'mousemove', {
40
+ clientX: 999999
41
+ });
42
+ expect(instance.get('value2')).eql(500);
43
+ dispatchEvent(document, 'mouseup');
44
+ // click
45
+ wrapper = slider.querySelector('.k-slider-track-wrapper');
46
+ width = wrapper.getBoundingClientRect().width;
47
+ dispatchEvent(wrapper, 'click', {
48
+ clientX: width / 2
49
+ });
50
+ expect(instance.get('value2')).eql((500 + 50) / 2);
51
+ // set value
52
+ bar = slider.querySelector('.k-slider-bar');
53
+ instance.set('value2', 135 + 50);
54
+ _context.next = 20;
55
+ return wait();
56
+ case 20:
57
+ expect(bar.style.width).eql('30%');
58
+ instance.set('value2', -10);
59
+ _context.next = 24;
60
+ return wait();
61
+ case 24:
62
+ expect(bar.style.width).eql('0%');
63
+ instance.set('value2', 1000);
64
+ _context.next = 28;
65
+ return wait();
66
+ case 28:
67
+ expect(bar.style.width).eql('100%');
68
+ case 29:
69
+ case "end":
70
+ return _context.stop();
79
71
  }
80
72
  }, _callee);
81
73
  })));
82
74
  it('range test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
83
75
  var _mount2, instance, element, windowWidth, _element$querySelecto2, first, second, wrapper, increaseBtn, decreaseBtn, _element$querySelecto3, firstInput, secondInput;
84
-
85
76
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
86
- while (1) {
87
- switch (_context2.prev = _context2.next) {
88
- case 0:
89
- _mount2 = mount(RangeDemo), instance = _mount2[0], element = _mount2[1]; // const windowWidth = 800; //document.documentElement.clientWidth;
90
-
91
- windowWidth = element.querySelector('.k-slider-main').clientWidth;
92
- _element$querySelecto2 = element.querySelectorAll('.k-slider-thumb'), first = _element$querySelecto2[0], second = _element$querySelecto2[1]; // drag
93
-
94
- dispatchEvent(first, 'mousedown', {
95
- which: 1
96
- });
97
- dispatchEvent(first, 'focusin');
98
- dispatchEvent(first, 'mousemove', {
99
- clientX: windowWidth * 0.8
100
- });
101
- _context2.next = 8;
102
- return wait();
103
-
104
- case 8:
105
- expect(element.innerHTML).to.matchSnapshot();
106
- expect(instance.get('values')).eql([76, 80]);
107
- dispatchEvent(first, 'mouseup');
108
- dispatchEvent(second, 'mousedown', {
109
- which: 1
110
- });
111
- dispatchEvent(second, 'focusin');
112
- dispatchEvent(second, 'mousemove', {
113
- clientX: windowWidth * 0.6
114
- });
115
- _context2.next = 16;
116
- return wait();
117
-
118
- case 16:
119
- expect(element.innerHTML).to.matchSnapshot();
120
- expect(instance.get('values')).eql([60, 76]);
121
- dispatchEvent(first, 'mouseup'); // click
122
-
123
- wrapper = element.querySelector('.k-slider-track-wrapper');
124
- dispatchEvent(wrapper, 'click', {
125
- clientX: windowWidth * 0.5
126
- });
127
- _context2.next = 23;
128
- return wait();
129
-
130
- case 23:
131
- expect(element.innerHTML).to.matchSnapshot();
132
- expect(instance.get('values')).eql([50, 76]);
133
- dispatchEvent(wrapper, 'click', {
134
- clientX: windowWidth * 0.7
135
- });
136
- _context2.next = 28;
137
- return wait();
138
-
139
- case 28:
140
- expect(element.innerHTML).to.matchSnapshot();
141
- expect(instance.get('values')).eql([50, 70]); // set invalid value
142
-
143
- instance.set('values', 1);
144
- _context2.next = 33;
145
- return wait();
146
-
147
- case 33:
148
- expect(instance.get('values')).eql([1, 1]); // increase first value
149
-
150
- increaseBtn = element.querySelector('.k-right');
151
- increaseBtn.click();
152
- _context2.next = 38;
153
- return wait();
154
-
155
- case 38:
156
- expect(instance.get('values')).eql([2, 2]); // should disable second spinner's decrease button
157
-
158
- decreaseBtn = element.querySelector('.k-spinner:last-of-type .k-left');
159
- decreaseBtn.click();
160
- _context2.next = 43;
161
- return wait();
162
-
163
- case 43:
164
- expect(instance.get('values')).eql([2, 2]); // input value
165
-
166
- _element$querySelecto3 = element.querySelectorAll('.k-input-inner'), firstInput = _element$querySelecto3[0], secondInput = _element$querySelecto3[1];
167
- dispatchEvent(firstInput, 'focusin');
168
- firstInput.value = '5';
169
- dispatchEvent(firstInput, 'input');
170
- firstInput.value = '50';
171
- dispatchEvent(firstInput, 'input');
172
- dispatchEvent(firstInput, 'change');
173
- dispatchEvent(secondInput, 'focusin');
174
- _context2.next = 54;
175
- return wait();
176
-
177
- case 54:
178
- secondInput.value = '6';
179
- dispatchEvent(secondInput, 'input');
180
- secondInput.value = '60';
181
- dispatchEvent(secondInput, 'input');
182
- dispatchEvent(secondInput, 'change');
183
- _context2.next = 61;
184
- return wait();
185
-
186
- case 61:
187
- expect(instance.get('values')).eql([50, 60]);
188
-
189
- case 62:
190
- case "end":
191
- return _context2.stop();
192
- }
77
+ while (1) switch (_context2.prev = _context2.next) {
78
+ case 0:
79
+ _mount2 = mount(RangeDemo), instance = _mount2[0], element = _mount2[1]; // const windowWidth = 800; //document.documentElement.clientWidth;
80
+ windowWidth = element.querySelector('.k-slider-main').clientWidth;
81
+ _element$querySelecto2 = element.querySelectorAll('.k-slider-thumb'), first = _element$querySelecto2[0], second = _element$querySelecto2[1]; // drag
82
+ dispatchEvent(first, 'mousedown', {
83
+ which: 1
84
+ });
85
+ dispatchEvent(first, 'focusin');
86
+ dispatchEvent(first, 'mousemove', {
87
+ clientX: windowWidth * 0.8
88
+ });
89
+ _context2.next = 8;
90
+ return wait();
91
+ case 8:
92
+ expect(element.innerHTML).to.matchSnapshot();
93
+ expect(instance.get('values')).eql([76, 80]);
94
+ dispatchEvent(first, 'mouseup');
95
+ dispatchEvent(second, 'mousedown', {
96
+ which: 1
97
+ });
98
+ dispatchEvent(second, 'focusin');
99
+ dispatchEvent(second, 'mousemove', {
100
+ clientX: windowWidth * 0.6
101
+ });
102
+ _context2.next = 16;
103
+ return wait();
104
+ case 16:
105
+ expect(element.innerHTML).to.matchSnapshot();
106
+ expect(instance.get('values')).eql([60, 76]);
107
+ dispatchEvent(first, 'mouseup');
108
+ // click
109
+ wrapper = element.querySelector('.k-slider-track-wrapper');
110
+ dispatchEvent(wrapper, 'click', {
111
+ clientX: windowWidth * 0.5
112
+ });
113
+ _context2.next = 23;
114
+ return wait();
115
+ case 23:
116
+ expect(element.innerHTML).to.matchSnapshot();
117
+ expect(instance.get('values')).eql([50, 76]);
118
+ dispatchEvent(wrapper, 'click', {
119
+ clientX: windowWidth * 0.7
120
+ });
121
+ _context2.next = 28;
122
+ return wait();
123
+ case 28:
124
+ expect(element.innerHTML).to.matchSnapshot();
125
+ expect(instance.get('values')).eql([50, 70]);
126
+ // set invalid value
127
+ instance.set('values', 1);
128
+ _context2.next = 33;
129
+ return wait();
130
+ case 33:
131
+ expect(instance.get('values')).eql([1, 1]);
132
+ // increase first value
133
+ increaseBtn = element.querySelector('.k-right');
134
+ increaseBtn.click();
135
+ _context2.next = 38;
136
+ return wait();
137
+ case 38:
138
+ expect(instance.get('values')).eql([2, 2]);
139
+ // should disable second spinner's decrease button
140
+ decreaseBtn = element.querySelector('.k-spinner:last-of-type .k-left');
141
+ decreaseBtn.click();
142
+ _context2.next = 43;
143
+ return wait();
144
+ case 43:
145
+ expect(instance.get('values')).eql([2, 2]);
146
+ // input value
147
+ _element$querySelecto3 = element.querySelectorAll('.k-input-inner'), firstInput = _element$querySelecto3[0], secondInput = _element$querySelecto3[1];
148
+ dispatchEvent(firstInput, 'focusin');
149
+ firstInput.value = '5';
150
+ dispatchEvent(firstInput, 'input');
151
+ firstInput.value = '50';
152
+ dispatchEvent(firstInput, 'input');
153
+ dispatchEvent(firstInput, 'change');
154
+ dispatchEvent(secondInput, 'focusin');
155
+ _context2.next = 54;
156
+ return wait();
157
+ case 54:
158
+ secondInput.value = '6';
159
+ dispatchEvent(secondInput, 'input');
160
+ secondInput.value = '60';
161
+ dispatchEvent(secondInput, 'input');
162
+ dispatchEvent(secondInput, 'change');
163
+ _context2.next = 61;
164
+ return wait();
165
+ case 61:
166
+ expect(instance.get('values')).eql([50, 60]);
167
+ case 62:
168
+ case "end":
169
+ return _context2.stop();
193
170
  }
194
171
  }, _callee2);
195
172
  })));
196
173
  it('keyboard operation for basic', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
197
174
  var _mount3, instance, element, _element$querySelecto4, slider, handle;
198
-
199
175
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
200
- while (1) {
201
- switch (_context3.prev = _context3.next) {
202
- case 0:
203
- _mount3 = mount(BasicDemo), instance = _mount3[0], element = _mount3[1];
204
- _element$querySelecto4 = element.querySelectorAll('.k-slider'), slider = _element$querySelecto4[1];
205
- handle = slider.querySelector('.k-slider-thumb');
206
- dispatchEvent(handle, 'focusin');
207
- dispatchEvent(handle, 'keydown', {
208
- keyCode: 37
209
- });
210
- _context3.next = 7;
211
- return wait();
212
-
213
- case 7:
214
- expect(slider.innerHTML).to.matchSnapshot();
215
- expect(instance.get('value2')).to.eql(276);
216
- dispatchEvent(handle, 'keydown', {
217
- keyCode: 39
218
- });
219
- _context3.next = 12;
220
- return wait();
221
-
222
- case 12:
223
- expect(slider.innerHTML).to.matchSnapshot();
224
- expect(instance.get('value2')).to.eql(277);
225
- dispatchEvent(handle, 'focusout');
226
- _context3.next = 17;
227
- return wait();
228
-
229
- case 17:
230
- expect(slider.innerHTML).to.matchSnapshot();
231
-
232
- case 18:
233
- case "end":
234
- return _context3.stop();
235
- }
176
+ while (1) switch (_context3.prev = _context3.next) {
177
+ case 0:
178
+ _mount3 = mount(BasicDemo), instance = _mount3[0], element = _mount3[1];
179
+ _element$querySelecto4 = element.querySelectorAll('.k-slider'), slider = _element$querySelecto4[1];
180
+ handle = slider.querySelector('.k-slider-thumb');
181
+ dispatchEvent(handle, 'focusin');
182
+ dispatchEvent(handle, 'keydown', {
183
+ keyCode: 37
184
+ });
185
+ _context3.next = 7;
186
+ return wait();
187
+ case 7:
188
+ expect(slider.innerHTML).to.matchSnapshot();
189
+ expect(instance.get('value2')).to.eql(276);
190
+ dispatchEvent(handle, 'keydown', {
191
+ keyCode: 39
192
+ });
193
+ _context3.next = 12;
194
+ return wait();
195
+ case 12:
196
+ expect(slider.innerHTML).to.matchSnapshot();
197
+ expect(instance.get('value2')).to.eql(277);
198
+ dispatchEvent(handle, 'focusout');
199
+ _context3.next = 17;
200
+ return wait();
201
+ case 17:
202
+ expect(slider.innerHTML).to.matchSnapshot();
203
+ case 18:
204
+ case "end":
205
+ return _context3.stop();
236
206
  }
237
207
  }, _callee3);
238
208
  })));
239
209
  it('keyboard operation for range', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
240
210
  var _mount4, instance, element, _element$querySelecto5, first, second;
241
-
242
211
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
243
- while (1) {
244
- switch (_context4.prev = _context4.next) {
245
- case 0:
246
- _mount4 = mount(RangeDemo), instance = _mount4[0], element = _mount4[1];
247
- _element$querySelecto5 = element.querySelectorAll('.k-slider-thumb'), first = _element$querySelecto5[0], second = _element$querySelecto5[1];
248
- instance.set('values', [50, 51]);
249
- _context4.next = 5;
250
- return wait();
251
-
252
- case 5:
253
- dispatchEvent(first, 'focusin');
254
- dispatchEvent(first, 'keydown', {
255
- keyCode: 39
256
- });
257
- _context4.next = 9;
258
- return wait();
259
-
260
- case 9:
261
- expect(element.innerHTML).to.matchSnapshot();
262
- expect(instance.get('values')).to.eql([51, 51]);
263
- dispatchEvent(first, 'keydown', {
264
- keyCode: 39
265
- });
266
- _context4.next = 14;
267
- return wait();
268
-
269
- case 14:
270
- expect(element.innerHTML).to.matchSnapshot();
271
- expect(instance.get('values')).to.eql([51, 52]);
272
- dispatchEvent(second, 'keydown', {
273
- keyCode: 39
274
- });
275
- _context4.next = 19;
276
- return wait();
277
-
278
- case 19:
279
- expect(element.innerHTML).to.matchSnapshot();
280
- expect(instance.get('values')).to.eql([51, 53]);
281
- dispatchEvent(second, 'focusout');
282
- instance.set('values', [50, 51]);
283
- _context4.next = 25;
284
- return wait();
285
-
286
- case 25:
287
- dispatchEvent(second, 'focusin');
288
- dispatchEvent(second, 'keydown', {
289
- keyCode: 37
290
- });
291
- _context4.next = 29;
292
- return wait();
293
-
294
- case 29:
295
- expect(instance.get('values')).to.eql([50, 50]);
296
- expect(element.innerHTML).to.matchSnapshot();
297
- dispatchEvent(second, 'keydown', {
298
- keyCode: 37
299
- });
300
- _context4.next = 34;
301
- return wait();
302
-
303
- case 34:
304
- expect(instance.get('values')).to.eql([49, 50]);
305
- expect(element.innerHTML).to.matchSnapshot();
306
- dispatchEvent(first, 'keydown', {
307
- keyCode: 37
308
- });
309
- _context4.next = 39;
310
- return wait();
311
-
312
- case 39:
313
- expect(instance.get('values')).to.eql([48, 50]);
314
- expect(element.innerHTML).to.matchSnapshot();
315
- dispatchEvent(first, 'focusout');
316
-
317
- case 42:
318
- case "end":
319
- return _context4.stop();
320
- }
212
+ while (1) switch (_context4.prev = _context4.next) {
213
+ case 0:
214
+ _mount4 = mount(RangeDemo), instance = _mount4[0], element = _mount4[1];
215
+ _element$querySelecto5 = element.querySelectorAll('.k-slider-thumb'), first = _element$querySelecto5[0], second = _element$querySelecto5[1];
216
+ instance.set('values', [50, 51]);
217
+ _context4.next = 5;
218
+ return wait();
219
+ case 5:
220
+ dispatchEvent(first, 'focusin');
221
+ dispatchEvent(first, 'keydown', {
222
+ keyCode: 39
223
+ });
224
+ _context4.next = 9;
225
+ return wait();
226
+ case 9:
227
+ expect(element.innerHTML).to.matchSnapshot();
228
+ expect(instance.get('values')).to.eql([51, 51]);
229
+ dispatchEvent(first, 'keydown', {
230
+ keyCode: 39
231
+ });
232
+ _context4.next = 14;
233
+ return wait();
234
+ case 14:
235
+ expect(element.innerHTML).to.matchSnapshot();
236
+ expect(instance.get('values')).to.eql([51, 52]);
237
+ dispatchEvent(second, 'keydown', {
238
+ keyCode: 39
239
+ });
240
+ _context4.next = 19;
241
+ return wait();
242
+ case 19:
243
+ expect(element.innerHTML).to.matchSnapshot();
244
+ expect(instance.get('values')).to.eql([51, 53]);
245
+ dispatchEvent(second, 'focusout');
246
+ instance.set('values', [50, 51]);
247
+ _context4.next = 25;
248
+ return wait();
249
+ case 25:
250
+ dispatchEvent(second, 'focusin');
251
+ dispatchEvent(second, 'keydown', {
252
+ keyCode: 37
253
+ });
254
+ _context4.next = 29;
255
+ return wait();
256
+ case 29:
257
+ expect(instance.get('values')).to.eql([50, 50]);
258
+ expect(element.innerHTML).to.matchSnapshot();
259
+ dispatchEvent(second, 'keydown', {
260
+ keyCode: 37
261
+ });
262
+ _context4.next = 34;
263
+ return wait();
264
+ case 34:
265
+ expect(instance.get('values')).to.eql([49, 50]);
266
+ expect(element.innerHTML).to.matchSnapshot();
267
+ dispatchEvent(first, 'keydown', {
268
+ keyCode: 37
269
+ });
270
+ _context4.next = 39;
271
+ return wait();
272
+ case 39:
273
+ expect(instance.get('values')).to.eql([48, 50]);
274
+ expect(element.innerHTML).to.matchSnapshot();
275
+ dispatchEvent(first, 'focusout');
276
+ case 42:
277
+ case "end":
278
+ return _context4.stop();
321
279
  }
322
280
  }, _callee4);
323
281
  })));
324
282
  it('disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
325
283
  var _mount5, instance, element, slider, sliderDom, handle, wrapper;
326
-
327
284
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
328
- while (1) {
329
- switch (_context5.prev = _context5.next) {
330
- case 0:
331
- _mount5 = mount(DisabledDemo), instance = _mount5[0], element = _mount5[1];
332
- slider = instance.refs.__test; // cannot drag
333
-
334
- sliderDom = element.querySelector('.k-slider');
335
- handle = sliderDom.querySelector('.k-slider-thumb');
336
- dispatchEvent(handle, 'mousedown', {
337
- which: 1
338
- });
339
- dispatchEvent(handle, 'focusin');
340
- dispatchEvent(document, 'mousemove', {
341
- clientX: 0
342
- });
343
- dispatchEvent(handle, 'mouseup', {
344
- clientX: 0
345
- });
346
- _context5.next = 10;
347
- return wait();
348
-
349
- case 10:
350
- expect(sliderDom.innerHTML).to.matchSnapshot();
351
- expect(slider.get('value')).to.eql(50); // keyboard
352
-
353
- dispatchEvent(handle, 'keydown', {
354
- keyCode: 37
355
- });
356
- dispatchEvent(handle, 'focusout');
357
- _context5.next = 16;
358
- return wait();
359
-
360
- case 16:
361
- expect(sliderDom.innerHTML).to.matchSnapshot();
362
- expect(slider.get('value')).to.eql(50); // click
363
-
364
- wrapper = sliderDom.querySelector('.k-slider-track-wrapper');
365
- dispatchEvent(wrapper, 'click', {
366
- clientX: 0
367
- });
368
- _context5.next = 22;
369
- return wait();
370
-
371
- case 22:
372
- expect(sliderDom.innerHTML).to.matchSnapshot();
373
- expect(slider.get('value')).to.eql(50);
374
-
375
- case 24:
376
- case "end":
377
- return _context5.stop();
378
- }
285
+ while (1) switch (_context5.prev = _context5.next) {
286
+ case 0:
287
+ _mount5 = mount(DisabledDemo), instance = _mount5[0], element = _mount5[1];
288
+ slider = instance.refs.__test; // cannot drag
289
+ sliderDom = element.querySelector('.k-slider');
290
+ handle = sliderDom.querySelector('.k-slider-thumb');
291
+ dispatchEvent(handle, 'mousedown', {
292
+ which: 1
293
+ });
294
+ dispatchEvent(handle, 'focusin');
295
+ dispatchEvent(document, 'mousemove', {
296
+ clientX: 0
297
+ });
298
+ dispatchEvent(handle, 'mouseup', {
299
+ clientX: 0
300
+ });
301
+ _context5.next = 10;
302
+ return wait();
303
+ case 10:
304
+ expect(sliderDom.innerHTML).to.matchSnapshot();
305
+ expect(slider.get('value')).to.eql(50);
306
+ // keyboard
307
+ dispatchEvent(handle, 'keydown', {
308
+ keyCode: 37
309
+ });
310
+ dispatchEvent(handle, 'focusout');
311
+ _context5.next = 16;
312
+ return wait();
313
+ case 16:
314
+ expect(sliderDom.innerHTML).to.matchSnapshot();
315
+ expect(slider.get('value')).to.eql(50);
316
+ // click
317
+ wrapper = sliderDom.querySelector('.k-slider-track-wrapper');
318
+ dispatchEvent(wrapper, 'click', {
319
+ clientX: 0
320
+ });
321
+ _context5.next = 22;
322
+ return wait();
323
+ case 22:
324
+ expect(sliderDom.innerHTML).to.matchSnapshot();
325
+ expect(slider.get('value')).to.eql(50);
326
+ case 24:
327
+ case "end":
328
+ return _context5.stop();
379
329
  }
380
330
  }, _callee5);
381
331
  })));
382
332
  it('min/max/step is undefined', function () {
383
333
  var Demo = /*#__PURE__*/function (_Component) {
384
334
  _inheritsLoose(Demo, _Component);
385
-
386
335
  function Demo() {
387
336
  var _context6;
388
-
389
337
  var _this;
390
-
391
338
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
392
339
  args[_key] = arguments[_key];
393
340
  }
394
-
395
341
  _this = _Component.call.apply(_Component, _concatInstanceProperty(_context6 = [this]).call(_context6, args)) || this;
396
342
  _this.Slider = Slider;
397
343
  return _this;
398
344
  }
399
-
400
345
  return Demo;
401
346
  }(Component);
402
-
403
347
  Demo.template = "const {Slider} = this; <Slider min={undefined}\n max={undefined}\n step={undefined}\n value={1}\n />";
404
-
405
348
  var _mount6 = mount(Demo),
406
- instance = _mount6[0],
407
- element = _mount6[1];
408
-
349
+ instance = _mount6[0],
350
+ element = _mount6[1];
409
351
  expect(element.innerHTML).to.matchSnapshot();
410
352
  });
411
353
  it('should log error when max < min', function () {
412
354
  var Demo = /*#__PURE__*/function (_Component2) {
413
355
  _inheritsLoose(Demo, _Component2);
414
-
415
356
  function Demo() {
416
357
  var _context7;
417
-
418
358
  var _this2;
419
-
420
359
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
421
360
  args[_key2] = arguments[_key2];
422
361
  }
423
-
424
362
  _this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
425
363
  _this2.Slider = Slider;
426
364
  return _this2;
427
365
  }
428
-
429
366
  return Demo;
430
367
  }(Component);
431
-
432
368
  Demo.template = "const {Slider} = this; <Slider min={20}\n max={0}\n step={undefined}\n value={1}\n />";
433
369
  var error = fakeError();
434
-
435
370
  var _mount7 = mount(Demo),
436
- instance = _mount7[0],
437
- element = _mount7[1];
438
-
371
+ instance = _mount7[0],
372
+ element = _mount7[1];
439
373
  expect(element.innerHTML).to.matchSnapshot();
440
374
  error('[Slider] min must less than or equal to max, but got min: 20 max: 0');
441
375
  });
442
376
  it('should input any value even if it has step', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
443
377
  var _mount8, instance, element, input, slider;
444
-
445
378
  return _regeneratorRuntime.wrap(function _callee6$(_context8) {
446
- while (1) {
447
- switch (_context8.prev = _context8.next) {
448
- case 0:
449
- _mount8 = mount(StepDemo), instance = _mount8[0], element = _mount8[1];
450
- input = element.querySelector('input');
451
- input.value = '1';
452
- dispatchEvent(input, 'input');
453
- _context8.next = 6;
454
- return wait();
455
-
456
- case 6:
457
- expect(input.value).to.eql('1');
458
- input.value = '11';
459
- dispatchEvent(input, 'input');
460
- _context8.next = 11;
461
- return wait();
462
-
463
- case 11:
464
- expect(input.value).to.eql('11');
465
- expect(instance.get('value1')).to.eql(10);
466
- dispatchEvent(input, 'change');
467
- _context8.next = 16;
468
- return wait();
469
-
470
- case 16:
471
- expect(input.value).to.eql('10');
472
- instance.set('value1', 13);
473
- _context8.next = 20;
474
- return wait();
475
-
476
- case 20:
477
- expect(instance.get('value1')).to.eql(15); // disable forceStep
478
-
479
- slider = instance.refs.__test;
480
- slider.set('forceStep', false);
481
- instance.set('value1', 13);
482
- _context8.next = 26;
483
- return wait();
484
-
485
- case 26:
486
- expect(instance.get('value1')).to.eql(13);
487
-
488
- case 27:
489
- case "end":
490
- return _context8.stop();
491
- }
379
+ while (1) switch (_context8.prev = _context8.next) {
380
+ case 0:
381
+ _mount8 = mount(StepDemo), instance = _mount8[0], element = _mount8[1];
382
+ input = element.querySelector('input');
383
+ input.value = '1';
384
+ dispatchEvent(input, 'input');
385
+ _context8.next = 6;
386
+ return wait();
387
+ case 6:
388
+ expect(input.value).to.eql('1');
389
+ input.value = '11';
390
+ dispatchEvent(input, 'input');
391
+ _context8.next = 11;
392
+ return wait();
393
+ case 11:
394
+ expect(input.value).to.eql('11');
395
+ expect(instance.get('value1')).to.eql(10);
396
+ dispatchEvent(input, 'change');
397
+ _context8.next = 16;
398
+ return wait();
399
+ case 16:
400
+ expect(input.value).to.eql('10');
401
+ instance.set('value1', 13);
402
+ _context8.next = 20;
403
+ return wait();
404
+ case 20:
405
+ expect(instance.get('value1')).to.eql(15);
406
+ // disable forceStep
407
+ slider = instance.refs.__test;
408
+ slider.set('forceStep', false);
409
+ instance.set('value1', 13);
410
+ _context8.next = 26;
411
+ return wait();
412
+ case 26:
413
+ expect(instance.get('value1')).to.eql(13);
414
+ case 27:
415
+ case "end":
416
+ return _context8.stop();
492
417
  }
493
418
  }, _callee6);
494
419
  })));
495
420
  it('should show tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
496
421
  var _mount9, instance, element, content;
497
-
498
422
  return _regeneratorRuntime.wrap(function _callee7$(_context9) {
499
- while (1) {
500
- switch (_context9.prev = _context9.next) {
501
- case 0:
502
- _mount9 = mount(TooltipDemo), instance = _mount9[0], element = _mount9[1];
503
- instance.set('value2', 11);
504
- _context9.next = 4;
505
- return wait();
506
-
507
- case 4:
508
- content = getElements('.k-tooltip-content')[0];
509
- expect(content.textContent).to.eql('满2年,优惠4个月');
510
- instance.set('value2', 5);
511
- _context9.next = 9;
512
- return wait();
513
-
514
- case 9:
515
- expect(content.textContent).to.eql('');
516
-
517
- case 10:
518
- case "end":
519
- return _context9.stop();
520
- }
423
+ while (1) switch (_context9.prev = _context9.next) {
424
+ case 0:
425
+ _mount9 = mount(TooltipDemo), instance = _mount9[0], element = _mount9[1];
426
+ instance.set('value2', 11);
427
+ _context9.next = 4;
428
+ return wait();
429
+ case 4:
430
+ content = getElements('.k-tooltip-content')[0];
431
+ expect(content.textContent).to.eql('满2年,优惠4个月');
432
+ instance.set('value2', 5);
433
+ _context9.next = 9;
434
+ return wait();
435
+ case 9:
436
+ expect(content.textContent).to.eql('');
437
+ case 10:
438
+ case "end":
439
+ return _context9.stop();
521
440
  }
522
441
  }, _callee7);
523
442
  })));
524
443
  it('should locate at the end if start value is equal to end value', function () {
525
444
  var Demo = /*#__PURE__*/function (_Component3) {
526
445
  _inheritsLoose(Demo, _Component3);
527
-
528
446
  function Demo() {
529
447
  var _context10;
530
-
531
448
  var _this3;
532
-
533
449
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
534
450
  args[_key3] = arguments[_key3];
535
451
  }
536
-
537
452
  _this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context10 = [this]).call(_context10, args)) || this;
538
453
  _this3.Slider = Slider;
539
454
  return _this3;
540
455
  }
541
-
542
456
  return Demo;
543
457
  }(Component);
544
-
545
458
  Demo.template = "const {Slider} = this; <div>\n <Slider min={1} max={1} value={1} />\n <Slider min={1} max={1} range />\n </div>";
546
-
547
459
  var _mount10 = mount(Demo),
548
- instance = _mount10[0],
549
- element = _mount10[1];
550
-
460
+ instance = _mount10[0],
461
+ element = _mount10[1];
551
462
  expect(element.innerHTML).to.matchSnapshot();
552
463
  });
553
464
  it('should trigger change event correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
554
465
  var spy, Demo, _mount11, instance, element, handle, bar, width, start, input, btn;
555
-
556
466
  return _regeneratorRuntime.wrap(function _callee8$(_context12) {
557
- while (1) {
558
- switch (_context12.prev = _context12.next) {
559
- case 0:
560
- spy = sinon.spy();
561
-
562
- Demo = /*#__PURE__*/function (_Component4) {
563
- _inheritsLoose(Demo, _Component4);
564
-
565
- function Demo() {
566
- var _context11;
567
-
568
- var _this4;
569
-
570
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
571
- args[_key4] = arguments[_key4];
572
- }
573
-
574
- _this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
575
- _this4.Slider = Slider;
576
- return _this4;
467
+ while (1) switch (_context12.prev = _context12.next) {
468
+ case 0:
469
+ spy = sinon.spy();
470
+ Demo = /*#__PURE__*/function (_Component4) {
471
+ _inheritsLoose(Demo, _Component4);
472
+ function Demo() {
473
+ var _context11;
474
+ var _this4;
475
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
476
+ args[_key4] = arguments[_key4];
577
477
  }
578
-
579
- Demo.defaults = function defaults() {
580
- return {
581
- value: 0
582
- };
583
- };
584
-
585
- var _proto = Demo.prototype;
586
-
587
- _proto._onChange = function _onChange(v) {
588
- console.log('change', v);
589
- spy(v);
478
+ _this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
479
+ _this4.Slider = Slider;
480
+ return _this4;
481
+ }
482
+ Demo.defaults = function defaults() {
483
+ return {
484
+ value: 0
590
485
  };
591
-
592
- return Demo;
593
- }(Component);
594
-
595
- Demo.template = "const Slider = this.Slider; <Slider ev-change={this._onChange} v-model=\"value\" />";
596
- _mount11 = mount(Demo), instance = _mount11[0], element = _mount11[1];
597
- handle = element.querySelector('.k-slider-thumb');
598
- bar = element.querySelector('.k-slider-track-wrapper'); // keyboard
599
-
600
- dispatchEvent(handle, 'focusin');
601
- dispatchEvent(handle, 'keydown', {
602
- keyCode: 39
603
- });
604
- expect(spy.callCount).to.eql(0);
605
- dispatchEvent(handle, 'keydown', {
606
- keyCode: 39
607
- });
608
- expect(spy.callCount).to.eql(0);
609
- dispatchEvent(handle, 'keyup', {
610
- keyCode: 13
611
- });
612
- expect(spy.callCount).to.eql(0);
613
- dispatchEvent(handle, 'keyup', {
614
- keyCode: 39
615
- });
616
- expect(spy.callCount).to.eql(1);
617
- expect(spy.calledWith(2)).to.be.true;
618
- dispatchEvent(handle, 'keydown', {
619
- keyCode: 39
620
- });
621
- expect(spy.callCount).to.eql(1);
622
- dispatchEvent(handle, 'keyup', {
623
- keyCode: 39
624
- });
625
- expect(spy.callCount).to.eql(2);
626
- expect(spy.calledWith(3)).to.be.true; // drag
627
-
628
- width = bar.getBoundingClientRect().width;
629
- dispatchEvent(handle, 'mousedown', {
630
- which: 1
631
- });
632
- dispatchEvent(document, 'mousemove', {
633
- clientX: 0.1 * width
634
- });
635
- expect(spy.callCount).to.eql(2);
636
- dispatchEvent(document, 'mouseup', {
637
- clientX: 0.1 * width
638
- });
639
- expect(spy.callCount).to.eql(3);
640
- expect(spy.calledWith(10)).to.be.true; // click
641
-
642
- dispatchEvent(bar, 'click', {
643
- clientX: 0.2 * width
644
- });
645
- expect(spy.callCount).to.eql(4);
646
- expect(spy.calledWith(20)).to.be.true; // click end
647
-
648
- start = element.querySelector('.k-slider-ends span');
649
- start.click();
650
- expect(spy.callCount).to.eql(5);
651
- expect(spy.calledWith(0)).to.be.true; // spinner
652
-
653
- input = element.querySelector('input');
654
- input.value = '1';
655
- dispatchEvent(input, 'input');
656
- _context12.next = 40;
657
- return wait();
658
-
659
- case 40:
660
- expect(spy.callCount).to.eql(6);
661
- expect(spy.calledWith(1)).to.be.true;
662
- btn = element.querySelector('.k-btn');
663
- btn.click();
664
- _context12.next = 46;
665
- return wait();
666
-
667
- case 46:
668
- expect(spy.callCount).to.eql(7);
669
- expect(spy.calledWith(0)).to.be.true;
670
-
671
- case 48:
672
- case "end":
673
- return _context12.stop();
674
- }
486
+ };
487
+ var _proto = Demo.prototype;
488
+ _proto._onChange = function _onChange(v) {
489
+ console.log('change', v);
490
+ spy(v);
491
+ };
492
+ return Demo;
493
+ }(Component);
494
+ Demo.template = "const Slider = this.Slider; <Slider ev-change={this._onChange} v-model=\"value\" />";
495
+ _mount11 = mount(Demo), instance = _mount11[0], element = _mount11[1];
496
+ handle = element.querySelector('.k-slider-thumb');
497
+ bar = element.querySelector('.k-slider-track-wrapper'); // keyboard
498
+ dispatchEvent(handle, 'focusin');
499
+ dispatchEvent(handle, 'keydown', {
500
+ keyCode: 39
501
+ });
502
+ expect(spy.callCount).to.eql(0);
503
+ dispatchEvent(handle, 'keydown', {
504
+ keyCode: 39
505
+ });
506
+ expect(spy.callCount).to.eql(0);
507
+ dispatchEvent(handle, 'keyup', {
508
+ keyCode: 13
509
+ });
510
+ expect(spy.callCount).to.eql(0);
511
+ dispatchEvent(handle, 'keyup', {
512
+ keyCode: 39
513
+ });
514
+ expect(spy.callCount).to.eql(1);
515
+ expect(spy.calledWith(2)).to.be.true;
516
+ dispatchEvent(handle, 'keydown', {
517
+ keyCode: 39
518
+ });
519
+ expect(spy.callCount).to.eql(1);
520
+ dispatchEvent(handle, 'keyup', {
521
+ keyCode: 39
522
+ });
523
+ expect(spy.callCount).to.eql(2);
524
+ expect(spy.calledWith(3)).to.be.true;
525
+ // drag
526
+ width = bar.getBoundingClientRect().width;
527
+ dispatchEvent(handle, 'mousedown', {
528
+ which: 1
529
+ });
530
+ dispatchEvent(document, 'mousemove', {
531
+ clientX: 0.1 * width
532
+ });
533
+ expect(spy.callCount).to.eql(2);
534
+ dispatchEvent(document, 'mouseup', {
535
+ clientX: 0.1 * width
536
+ });
537
+ expect(spy.callCount).to.eql(3);
538
+ expect(spy.calledWith(10)).to.be.true;
539
+ // click
540
+ dispatchEvent(bar, 'click', {
541
+ clientX: 0.2 * width
542
+ });
543
+ expect(spy.callCount).to.eql(4);
544
+ expect(spy.calledWith(20)).to.be.true;
545
+ // click end
546
+ start = element.querySelector('.k-slider-ends span');
547
+ start.click();
548
+ expect(spy.callCount).to.eql(5);
549
+ expect(spy.calledWith(0)).to.be.true;
550
+ // spinner
551
+ input = element.querySelector('input');
552
+ input.value = '1';
553
+ dispatchEvent(input, 'input');
554
+ _context12.next = 40;
555
+ return wait();
556
+ case 40:
557
+ expect(spy.callCount).to.eql(6);
558
+ expect(spy.calledWith(1)).to.be.true;
559
+ btn = element.querySelector('.k-btn');
560
+ btn.click();
561
+ _context12.next = 46;
562
+ return wait();
563
+ case 46:
564
+ expect(spy.callCount).to.eql(7);
565
+ expect(spy.calledWith(0)).to.be.true;
566
+ case 48:
567
+ case "end":
568
+ return _context12.stop();
675
569
  }
676
570
  }, _callee8);
677
- }))); // it('should set init value to min value', async () => {
571
+ })));
572
+ // it('should set init value to min value', async () => {
678
573
  // class Demo extends Component<{a: number, b: number}> {
679
574
  // static template = `const {Slider} = this; <div>
680
575
  // <Slider min={-1} max={1} v-model="a"/>
@@ -686,88 +581,71 @@ describe('Slider', function () {
686
581
  // expect(instance.get('a')).to.eql(-1);
687
582
  // expect(instance.get('b')).to.eql([-1, -1]);
688
583
  // });
689
-
690
584
  it('should set value by `min + step * n`', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
691
585
  var Demo, _mount12, instance, element;
692
-
693
586
  return _regeneratorRuntime.wrap(function _callee9$(_context14) {
694
- while (1) {
695
- switch (_context14.prev = _context14.next) {
696
- case 0:
697
- Demo = /*#__PURE__*/function (_Component5) {
698
- _inheritsLoose(Demo, _Component5);
699
-
700
- function Demo() {
701
- var _context13;
702
-
703
- var _this5;
704
-
705
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
706
- args[_key5] = arguments[_key5];
707
- }
708
-
709
- _this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
710
- _this5.Slider = Slider;
711
- return _this5;
587
+ while (1) switch (_context14.prev = _context14.next) {
588
+ case 0:
589
+ Demo = /*#__PURE__*/function (_Component5) {
590
+ _inheritsLoose(Demo, _Component5);
591
+ function Demo() {
592
+ var _context13;
593
+ var _this5;
594
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
595
+ args[_key5] = arguments[_key5];
712
596
  }
713
-
714
- return Demo;
715
- }(Component);
716
-
717
- Demo.template = "const {Slider} = this; <div>\n <Slider min={-6} max={20} v-model=\"value\" step={5} points />\n </div>";
718
- _mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
719
- instance.set('value', 0);
720
- _context14.next = 6;
721
- return wait();
722
-
723
- case 6:
724
- expect(instance.get('value')).to.eql(-1);
725
-
726
- case 7:
727
- case "end":
728
- return _context14.stop();
729
- }
597
+ _this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
598
+ _this5.Slider = Slider;
599
+ return _this5;
600
+ }
601
+ return Demo;
602
+ }(Component);
603
+ Demo.template = "const {Slider} = this; <div>\n <Slider min={-6} max={20} v-model=\"value\" step={5} points />\n </div>";
604
+ _mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
605
+ instance.set('value', 0);
606
+ _context14.next = 6;
607
+ return wait();
608
+ case 6:
609
+ expect(instance.get('value')).to.eql(-1);
610
+ case 7:
611
+ case "end":
612
+ return _context14.stop();
730
613
  }
731
614
  }, _callee9);
732
615
  })));
733
616
  it('dynamic step', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
734
617
  var _mount13, instance, element, handle, model;
735
-
736
618
  return _regeneratorRuntime.wrap(function _callee10$(_context15) {
737
- while (1) {
738
- switch (_context15.prev = _context15.next) {
739
- case 0:
740
- _mount13 = mount(DynamicStepDemo), instance = _mount13[0], element = _mount13[1];
741
- handle = element.querySelector('.k-slider-thumb');
742
- model = "value1";
743
- instance.set(model, 100);
744
- _context15.next = 6;
745
- return wait();
746
-
747
- case 6:
748
- dispatchEvent(handle, 'focusin');
749
- dispatchEvent(handle, 'keydown', {
750
- keyCode: 37
751
- });
752
- expect(instance.get(model)).to.eql(90);
753
- dispatchEvent(handle, 'keydown', {
754
- keyCode: 39
755
- });
756
- expect(instance.get(model)).to.eql(100);
757
- dispatchEvent(handle, 'keydown', {
758
- keyCode: 39
759
- });
760
- expect(instance.get(model)).to.eql(150);
761
- dispatchEvent(handle, 'keydown', {
762
- keyCode: 37
763
- });
764
- expect(instance.get(model)).to.eql(100);
765
- dispatchEvent(handle, 'focusout');
766
-
767
- case 16:
768
- case "end":
769
- return _context15.stop();
770
- }
619
+ while (1) switch (_context15.prev = _context15.next) {
620
+ case 0:
621
+ _mount13 = mount(DynamicStepDemo), instance = _mount13[0], element = _mount13[1];
622
+ handle = element.querySelector('.k-slider-thumb');
623
+ model = "value1";
624
+ instance.set(model, 100);
625
+ _context15.next = 6;
626
+ return wait();
627
+ case 6:
628
+ dispatchEvent(handle, 'focusin');
629
+ dispatchEvent(handle, 'keydown', {
630
+ keyCode: 37
631
+ });
632
+ expect(instance.get(model)).to.eql(90);
633
+ dispatchEvent(handle, 'keydown', {
634
+ keyCode: 39
635
+ });
636
+ expect(instance.get(model)).to.eql(100);
637
+ dispatchEvent(handle, 'keydown', {
638
+ keyCode: 39
639
+ });
640
+ expect(instance.get(model)).to.eql(150);
641
+ dispatchEvent(handle, 'keydown', {
642
+ keyCode: 37
643
+ });
644
+ expect(instance.get(model)).to.eql(100);
645
+ dispatchEvent(handle, 'focusout');
646
+ case 16:
647
+ case "end":
648
+ return _context15.stop();
771
649
  }
772
650
  }, _callee10);
773
651
  })));