@douyinfe/semi-foundation 2.36.0-beta.0 → 2.36.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 (415) hide show
  1. package/calendar/foundation.ts +2 -1
  2. package/lib/cjs/anchor/constants.js +0 -2
  3. package/lib/cjs/anchor/foundation.js +10 -73
  4. package/lib/cjs/anchor/linkFoundation.js +4 -16
  5. package/lib/cjs/autoComplete/constants.js +0 -3
  6. package/lib/cjs/autoComplete/foundation.d.ts +1 -1
  7. package/lib/cjs/autoComplete/foundation.js +25 -139
  8. package/lib/cjs/autoComplete/optionFoundation.js +4 -14
  9. package/lib/cjs/avatar/constants.js +0 -2
  10. package/lib/cjs/avatar/foundation.js +0 -17
  11. package/lib/cjs/backtop/constants.js +0 -2
  12. package/lib/cjs/backtop/foundation.d.ts +2 -2
  13. package/lib/cjs/backtop/foundation.js +0 -21
  14. package/lib/cjs/badge/constants.js +0 -2
  15. package/lib/cjs/banner/constants.js +0 -2
  16. package/lib/cjs/banner/foundation.js +0 -7
  17. package/lib/cjs/base/constants.js +2 -4
  18. package/lib/cjs/base/foundation.d.ts +1 -1
  19. package/lib/cjs/base/foundation.js +12 -46
  20. package/lib/cjs/base/index.js +0 -3
  21. package/lib/cjs/breadcrumb/constants.js +0 -2
  22. package/lib/cjs/breadcrumb/foundation.js +1 -12
  23. package/lib/cjs/breadcrumb/itemFoundation.js +0 -7
  24. package/lib/cjs/button/constants.js +0 -2
  25. package/lib/cjs/calendar/constants.js +0 -2
  26. package/lib/cjs/calendar/eventUtil.d.ts +1 -1
  27. package/lib/cjs/calendar/eventUtil.js +2 -74
  28. package/lib/cjs/calendar/foundation.d.ts +2 -2
  29. package/lib/cjs/calendar/foundation.js +28 -123
  30. package/lib/cjs/card/constants.js +0 -2
  31. package/lib/cjs/carousel/constants.js +0 -2
  32. package/lib/cjs/carousel/foundation.js +2 -52
  33. package/lib/cjs/cascader/constants.js +0 -3
  34. package/lib/cjs/cascader/foundation.d.ts +4 -4
  35. package/lib/cjs/cascader/foundation.js +28 -242
  36. package/lib/cjs/cascader/util.js +6 -24
  37. package/lib/cjs/checkbox/checkboxFoundation.js +2 -38
  38. package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -23
  39. package/lib/cjs/checkbox/constants.js +0 -2
  40. package/lib/cjs/collapse/constants.js +0 -2
  41. package/lib/cjs/collapse/foundation.d.ts +1 -1
  42. package/lib/cjs/collapse/foundation.js +2 -13
  43. package/lib/cjs/collapsible/constants.js +0 -2
  44. package/lib/cjs/collapsible/foundation.js +0 -9
  45. package/lib/cjs/datePicker/_utils/formatter.js +4 -10
  46. package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +1 -1
  47. package/lib/cjs/datePicker/_utils/getDayOfWeek.js +0 -4
  48. package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +0 -5
  49. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
  50. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +0 -15
  51. package/lib/cjs/datePicker/_utils/getFullDateOffset.js +0 -7
  52. package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +0 -5
  53. package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -6
  54. package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +1 -1
  55. package/lib/cjs/datePicker/_utils/getMonthTable.js +3 -14
  56. package/lib/cjs/datePicker/_utils/getMonthsInYear.js +0 -2
  57. package/lib/cjs/datePicker/_utils/getYears.js +0 -4
  58. package/lib/cjs/datePicker/_utils/index.js +0 -13
  59. package/lib/cjs/datePicker/_utils/isAfter.js +0 -4
  60. package/lib/cjs/datePicker/_utils/isBefore.js +0 -4
  61. package/lib/cjs/datePicker/_utils/isBetween.js +0 -4
  62. package/lib/cjs/datePicker/_utils/isDate.js +0 -1
  63. package/lib/cjs/datePicker/_utils/isSameDay.js +0 -4
  64. package/lib/cjs/datePicker/_utils/isTimestamp.js +0 -4
  65. package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +0 -4
  66. package/lib/cjs/datePicker/_utils/isValidDate.js +0 -1
  67. package/lib/cjs/datePicker/_utils/isValidTimeZone.js +0 -1
  68. package/lib/cjs/datePicker/_utils/isWithinInterval.js +0 -4
  69. package/lib/cjs/datePicker/_utils/parser.js +0 -10
  70. package/lib/cjs/datePicker/constants.js +0 -3
  71. package/lib/cjs/datePicker/foundation.d.ts +24 -24
  72. package/lib/cjs/datePicker/foundation.js +22 -333
  73. package/lib/cjs/datePicker/inputFoundation.d.ts +3 -3
  74. package/lib/cjs/datePicker/inputFoundation.js +5 -86
  75. package/lib/cjs/datePicker/monthFoundation.d.ts +1 -1
  76. package/lib/cjs/datePicker/monthFoundation.js +3 -28
  77. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +3 -3
  78. package/lib/cjs/datePicker/monthsGridFoundation.js +43 -238
  79. package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +1 -1
  80. package/lib/cjs/datePicker/yearAndMonthFoundation.js +12 -38
  81. package/lib/cjs/descriptions/constants.js +0 -2
  82. package/lib/cjs/divider/constants.js +0 -2
  83. package/lib/cjs/dropdown/constants.js +0 -3
  84. package/lib/cjs/dropdown/foundation.js +4 -23
  85. package/lib/cjs/dropdown/menuFoundation.js +8 -27
  86. package/lib/cjs/empty/constants.js +0 -2
  87. package/lib/cjs/form/constants.js +0 -2
  88. package/lib/cjs/form/foundation.js +75 -206
  89. package/lib/cjs/form/interface.d.ts +5 -5
  90. package/lib/cjs/form/utils.js +47 -77
  91. package/lib/cjs/grid/constants.js +0 -2
  92. package/lib/cjs/highlight/constants.js +0 -2
  93. package/lib/cjs/icons/constants.js +0 -2
  94. package/lib/cjs/image/constants.js +0 -2
  95. package/lib/cjs/image/imageFoundation.js +4 -18
  96. package/lib/cjs/image/previewFooterFoundation.js +0 -13
  97. package/lib/cjs/image/previewFoundation.js +0 -11
  98. package/lib/cjs/image/previewImageFoundation.js +6 -80
  99. package/lib/cjs/image/previewInnerFoundation.js +12 -77
  100. package/lib/cjs/image/utils.js +0 -14
  101. package/lib/cjs/input/constants.js +0 -2
  102. package/lib/cjs/input/foundation.js +17 -101
  103. package/lib/cjs/input/textareaFoundation.js +20 -85
  104. package/lib/cjs/input/util/calculateNodeHeight.js +6 -18
  105. package/lib/cjs/input/util/getSizingData.js +7 -11
  106. package/lib/cjs/inputNumber/constants.js +0 -2
  107. package/lib/cjs/inputNumber/foundation.js +29 -192
  108. package/lib/cjs/layout/constants.js +0 -2
  109. package/lib/cjs/list/constants.js +0 -2
  110. package/lib/cjs/modal/constants.js +0 -2
  111. package/lib/cjs/modal/modalContentFoundation.js +0 -20
  112. package/lib/cjs/modal/modalFoundation.d.ts +2 -2
  113. package/lib/cjs/modal/modalFoundation.js +2 -22
  114. package/lib/cjs/navigation/NavItem.js +0 -10
  115. package/lib/cjs/navigation/constants.js +0 -3
  116. package/lib/cjs/navigation/foundation.js +3 -67
  117. package/lib/cjs/navigation/itemFoundation.js +3 -21
  118. package/lib/cjs/navigation/subNavFoundation.js +4 -40
  119. package/lib/cjs/notification/constants.js +0 -3
  120. package/lib/cjs/notification/notificationFoundation.d.ts +3 -3
  121. package/lib/cjs/notification/notificationFoundation.js +0 -16
  122. package/lib/cjs/notification/notificationListFoundation.js +7 -17
  123. package/lib/cjs/overflowList/constants.js +0 -2
  124. package/lib/cjs/overflowList/foundation.js +11 -41
  125. package/lib/cjs/pagination/constants.js +0 -2
  126. package/lib/cjs/pagination/foundation.d.ts +3 -3
  127. package/lib/cjs/pagination/foundation.js +21 -90
  128. package/lib/cjs/popconfirm/constants.js +0 -2
  129. package/lib/cjs/popconfirm/popconfirmFoundation.js +1 -21
  130. package/lib/cjs/popover/constants.js +0 -3
  131. package/lib/cjs/progress/constants.js +0 -2
  132. package/lib/cjs/progress/generates.d.ts +2 -2
  133. package/lib/cjs/progress/generates.js +19 -60
  134. package/lib/cjs/radio/constants.js +0 -2
  135. package/lib/cjs/radio/radioFoundation.js +0 -14
  136. package/lib/cjs/radio/radioGroupFoundation.js +4 -23
  137. package/lib/cjs/radio/radioInnerFoundation.js +2 -19
  138. package/lib/cjs/rating/constants.js +0 -2
  139. package/lib/cjs/rating/foundation.js +11 -61
  140. package/lib/cjs/scrollList/constants.js +0 -2
  141. package/lib/cjs/scrollList/foundation.js +0 -4
  142. package/lib/cjs/scrollList/itemFoundation.js +8 -61
  143. package/lib/cjs/scrollList/scrollTo.js +2 -5
  144. package/lib/cjs/select/constants.js +0 -3
  145. package/lib/cjs/select/foundation.d.ts +2 -2
  146. package/lib/cjs/select/foundation.js +122 -425
  147. package/lib/cjs/select/optionFoundation.js +4 -14
  148. package/lib/cjs/sideSheet/constants.js +0 -2
  149. package/lib/cjs/sideSheet/sideSheetFoundation.js +0 -18
  150. package/lib/cjs/skeleton/constants.js +0 -2
  151. package/lib/cjs/slider/constants.js +0 -2
  152. package/lib/cjs/slider/foundation.d.ts +1 -1
  153. package/lib/cjs/slider/foundation.js +25 -204
  154. package/lib/cjs/space/constants.js +0 -2
  155. package/lib/cjs/spin/constants.js +0 -2
  156. package/lib/cjs/spin/foundation.js +3 -13
  157. package/lib/cjs/steps/constants.js +0 -2
  158. package/lib/cjs/switch/constants.js +0 -2
  159. package/lib/cjs/switch/foundation.js +2 -18
  160. package/lib/cjs/table/bodyFoundation.js +2 -34
  161. package/lib/cjs/table/cellFoundation.js +0 -5
  162. package/lib/cjs/table/constants.js +7 -8
  163. package/lib/cjs/table/foundation.d.ts +17 -14
  164. package/lib/cjs/table/foundation.js +71 -302
  165. package/lib/cjs/table/tableRowFoundation.js +0 -11
  166. package/lib/cjs/table/tableSelectionCellFoundation.js +0 -6
  167. package/lib/cjs/table/utils.d.ts +2 -2
  168. package/lib/cjs/table/utils.js +5 -118
  169. package/lib/cjs/tabs/constants.js +0 -2
  170. package/lib/cjs/tabs/foundation.js +2 -40
  171. package/lib/cjs/tag/constants.js +1 -2
  172. package/lib/cjs/tagInput/constants.js +0 -2
  173. package/lib/cjs/tagInput/foundation.d.ts +4 -4
  174. package/lib/cjs/tagInput/foundation.js +4 -94
  175. package/lib/cjs/tagInput/utils/getSplitedArray.js +0 -11
  176. package/lib/cjs/timePicker/ComboxFoundation.js +4 -39
  177. package/lib/cjs/timePicker/constants.js +0 -3
  178. package/lib/cjs/timePicker/foundation.d.ts +1 -1
  179. package/lib/cjs/timePicker/foundation.js +3 -97
  180. package/lib/cjs/timePicker/inputFoundation.js +6 -25
  181. package/lib/cjs/timePicker/utils/index.js +6 -45
  182. package/lib/cjs/timePicker/utils/localeDate.js +0 -10
  183. package/lib/cjs/timeline/constants.js +0 -2
  184. package/lib/cjs/toast/constants.js +0 -3
  185. package/lib/cjs/toast/toastFoundation.d.ts +3 -3
  186. package/lib/cjs/toast/toastFoundation.js +0 -14
  187. package/lib/cjs/toast/toastListFoundation.js +4 -22
  188. package/lib/cjs/tooltip/constants.js +0 -2
  189. package/lib/cjs/tooltip/foundation.d.ts +1 -1
  190. package/lib/cjs/tooltip/foundation.js +63 -291
  191. package/lib/cjs/transfer/constants.js +0 -2
  192. package/lib/cjs/transfer/foundation.d.ts +1 -1
  193. package/lib/cjs/transfer/foundation.js +4 -68
  194. package/lib/cjs/transfer/transferUtils.js +5 -27
  195. package/lib/cjs/tree/constants.js +0 -2
  196. package/lib/cjs/tree/foundation.d.ts +3 -3
  197. package/lib/cjs/tree/foundation.js +34 -150
  198. package/lib/cjs/tree/treeUtil.js +54 -173
  199. package/lib/cjs/treeSelect/constants.js +0 -2
  200. package/lib/cjs/treeSelect/foundation.d.ts +7 -7
  201. package/lib/cjs/treeSelect/foundation.js +18 -192
  202. package/lib/cjs/typography/constants.js +0 -2
  203. package/lib/cjs/typography/formatNumeral.d.ts +3 -3
  204. package/lib/cjs/typography/formatNumeral.js +16 -32
  205. package/lib/cjs/upload/constants.js +0 -2
  206. package/lib/cjs/upload/foundation.d.ts +5 -5
  207. package/lib/cjs/upload/foundation.js +36 -245
  208. package/lib/cjs/upload/utils.js +10 -29
  209. package/lib/cjs/utils/Event.js +2 -21
  210. package/lib/cjs/utils/FocusHandle.d.ts +1 -1
  211. package/lib/cjs/utils/FocusHandle.js +6 -35
  212. package/lib/cjs/utils/Logger.js +0 -21
  213. package/lib/cjs/utils/Store.js +0 -10
  214. package/lib/cjs/utils/a11y.js +18 -43
  215. package/lib/cjs/utils/array.d.ts +1 -1
  216. package/lib/cjs/utils/array.js +0 -7
  217. package/lib/cjs/utils/arrayMove.js +0 -1
  218. package/lib/cjs/utils/classnames.js +0 -12
  219. package/lib/cjs/utils/date-fns-extra.js +0 -35
  220. package/lib/cjs/utils/dom.d.ts +1 -1
  221. package/lib/cjs/utils/dom.js +0 -13
  222. package/lib/cjs/utils/function.js +0 -1
  223. package/lib/cjs/utils/getDataAttr.js +0 -2
  224. package/lib/cjs/utils/getHighlight.js +5 -26
  225. package/lib/cjs/utils/getMotionObjFromProps.js +0 -12
  226. package/lib/cjs/utils/index.js +0 -4
  227. package/lib/cjs/utils/isBothNaN.js +0 -2
  228. package/lib/cjs/utils/isElement.js +0 -1
  229. package/lib/cjs/utils/isEnterPress.js +0 -5
  230. package/lib/cjs/utils/isEscPress.js +0 -5
  231. package/lib/cjs/utils/isNullOrUndefined.js +0 -1
  232. package/lib/cjs/utils/isNumber.js +0 -1
  233. package/lib/cjs/utils/isObject.js +0 -1
  234. package/lib/cjs/utils/isPromise.js +0 -3
  235. package/lib/cjs/utils/isString.js +0 -1
  236. package/lib/cjs/utils/keyCode.js +0 -105
  237. package/lib/cjs/utils/log.js +0 -5
  238. package/lib/cjs/utils/number.js +0 -2
  239. package/lib/cjs/utils/object.d.ts +4 -4
  240. package/lib/cjs/utils/object.js +12 -34
  241. package/lib/cjs/utils/set.js +0 -8
  242. package/lib/cjs/utils/shallowEqualObjects.js +0 -7
  243. package/lib/cjs/utils/touchPolyfill.js +0 -7
  244. package/lib/cjs/utils/type.d.ts +3 -3
  245. package/lib/cjs/utils/uuid.js +2 -9
  246. package/lib/cjs/utils/warning.js +0 -1
  247. package/lib/es/anchor/foundation.js +10 -66
  248. package/lib/es/anchor/linkFoundation.js +4 -12
  249. package/lib/es/autoComplete/foundation.d.ts +1 -1
  250. package/lib/es/autoComplete/foundation.js +24 -132
  251. package/lib/es/autoComplete/optionFoundation.js +4 -10
  252. package/lib/es/avatar/foundation.js +0 -12
  253. package/lib/es/backtop/foundation.d.ts +2 -2
  254. package/lib/es/backtop/foundation.js +0 -16
  255. package/lib/es/banner/foundation.js +0 -3
  256. package/lib/es/base/constants.js +2 -2
  257. package/lib/es/base/foundation.d.ts +1 -1
  258. package/lib/es/base/foundation.js +11 -44
  259. package/lib/es/breadcrumb/foundation.js +0 -7
  260. package/lib/es/breadcrumb/itemFoundation.js +0 -3
  261. package/lib/es/calendar/eventUtil.d.ts +1 -1
  262. package/lib/es/calendar/eventUtil.js +2 -36
  263. package/lib/es/calendar/foundation.d.ts +2 -2
  264. package/lib/es/calendar/foundation.js +28 -117
  265. package/lib/es/carousel/foundation.js +2 -47
  266. package/lib/es/cascader/constants.js +0 -1
  267. package/lib/es/cascader/foundation.d.ts +4 -4
  268. package/lib/es/cascader/foundation.js +30 -226
  269. package/lib/es/cascader/util.js +6 -15
  270. package/lib/es/checkbox/checkboxFoundation.js +2 -34
  271. package/lib/es/checkbox/checkboxGroupFoundation.js +2 -20
  272. package/lib/es/collapse/foundation.d.ts +1 -1
  273. package/lib/es/collapse/foundation.js +2 -9
  274. package/lib/es/collapsible/foundation.js +0 -7
  275. package/lib/es/datePicker/_utils/formatter.js +4 -8
  276. package/lib/es/datePicker/_utils/getDayOfWeek.d.ts +1 -1
  277. package/lib/es/datePicker/_utils/getDayOfWeek.js +0 -3
  278. package/lib/es/datePicker/_utils/getDefaultFormatToken.js +0 -2
  279. package/lib/es/datePicker/_utils/getDefaultPickerDate.d.ts +1 -1
  280. package/lib/es/datePicker/_utils/getDefaultPickerDate.js +0 -10
  281. package/lib/es/datePicker/_utils/getFullDateOffset.js +0 -3
  282. package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +0 -4
  283. package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +0 -5
  284. package/lib/es/datePicker/_utils/getMonthTable.d.ts +1 -1
  285. package/lib/es/datePicker/_utils/getMonthTable.js +4 -14
  286. package/lib/es/datePicker/_utils/getMonthsInYear.js +0 -1
  287. package/lib/es/datePicker/_utils/getYears.js +0 -3
  288. package/lib/es/datePicker/_utils/isBetween.js +0 -1
  289. package/lib/es/datePicker/_utils/parser.js +0 -8
  290. package/lib/es/datePicker/foundation.d.ts +24 -24
  291. package/lib/es/datePicker/foundation.js +22 -318
  292. package/lib/es/datePicker/inputFoundation.d.ts +3 -3
  293. package/lib/es/datePicker/inputFoundation.js +5 -74
  294. package/lib/es/datePicker/monthFoundation.d.ts +1 -1
  295. package/lib/es/datePicker/monthFoundation.js +4 -22
  296. package/lib/es/datePicker/monthsGridFoundation.d.ts +3 -3
  297. package/lib/es/datePicker/monthsGridFoundation.js +42 -222
  298. package/lib/es/datePicker/yearAndMonthFoundation.d.ts +1 -1
  299. package/lib/es/datePicker/yearAndMonthFoundation.js +12 -36
  300. package/lib/es/dropdown/foundation.js +4 -18
  301. package/lib/es/dropdown/menuFoundation.js +8 -22
  302. package/lib/es/form/foundation.js +74 -195
  303. package/lib/es/form/interface.d.ts +5 -5
  304. package/lib/es/form/utils.js +47 -70
  305. package/lib/es/image/imageFoundation.js +4 -13
  306. package/lib/es/image/previewFooterFoundation.js +0 -9
  307. package/lib/es/image/previewFoundation.js +0 -7
  308. package/lib/es/image/previewImageFoundation.js +6 -72
  309. package/lib/es/image/previewInnerFoundation.js +12 -70
  310. package/lib/es/image/utils.js +0 -6
  311. package/lib/es/input/foundation.js +17 -93
  312. package/lib/es/input/textareaFoundation.js +20 -75
  313. package/lib/es/input/util/calculateNodeHeight.js +6 -18
  314. package/lib/es/input/util/getSizingData.js +7 -11
  315. package/lib/es/inputNumber/foundation.js +28 -183
  316. package/lib/es/modal/modalContentFoundation.js +0 -15
  317. package/lib/es/modal/modalFoundation.d.ts +2 -2
  318. package/lib/es/modal/modalFoundation.js +2 -17
  319. package/lib/es/navigation/NavItem.js +0 -6
  320. package/lib/es/navigation/constants.js +1 -1
  321. package/lib/es/navigation/foundation.js +2 -60
  322. package/lib/es/navigation/itemFoundation.js +3 -18
  323. package/lib/es/navigation/subNavFoundation.js +4 -36
  324. package/lib/es/notification/constants.js +1 -1
  325. package/lib/es/notification/notificationFoundation.d.ts +3 -3
  326. package/lib/es/notification/notificationFoundation.js +0 -11
  327. package/lib/es/notification/notificationListFoundation.js +6 -13
  328. package/lib/es/overflowList/foundation.js +11 -37
  329. package/lib/es/pagination/foundation.d.ts +3 -3
  330. package/lib/es/pagination/foundation.js +20 -87
  331. package/lib/es/popconfirm/popconfirmFoundation.js +1 -16
  332. package/lib/es/progress/generates.d.ts +2 -2
  333. package/lib/es/progress/generates.js +19 -59
  334. package/lib/es/radio/radioFoundation.js +0 -9
  335. package/lib/es/radio/radioGroupFoundation.js +4 -19
  336. package/lib/es/radio/radioInnerFoundation.js +2 -15
  337. package/lib/es/rating/foundation.js +10 -54
  338. package/lib/es/scrollList/itemFoundation.js +8 -60
  339. package/lib/es/scrollList/scrollTo.js +2 -4
  340. package/lib/es/select/foundation.d.ts +2 -2
  341. package/lib/es/select/foundation.js +122 -411
  342. package/lib/es/select/optionFoundation.js +4 -10
  343. package/lib/es/sideSheet/sideSheetFoundation.js +0 -12
  344. package/lib/es/slider/foundation.d.ts +1 -1
  345. package/lib/es/slider/foundation.js +24 -197
  346. package/lib/es/spin/foundation.js +3 -11
  347. package/lib/es/switch/foundation.js +2 -13
  348. package/lib/es/table/bodyFoundation.js +2 -25
  349. package/lib/es/table/cellFoundation.js +0 -1
  350. package/lib/es/table/constants.js +6 -6
  351. package/lib/es/table/foundation.d.ts +17 -14
  352. package/lib/es/table/foundation.js +71 -309
  353. package/lib/es/table/tableRowFoundation.js +2 -9
  354. package/lib/es/table/tableSelectionCellFoundation.js +0 -2
  355. package/lib/es/table/utils.d.ts +2 -2
  356. package/lib/es/table/utils.js +5 -81
  357. package/lib/es/tabs/foundation.js +2 -35
  358. package/lib/es/tagInput/foundation.d.ts +4 -4
  359. package/lib/es/tagInput/foundation.js +4 -84
  360. package/lib/es/tagInput/utils/getSplitedArray.js +0 -7
  361. package/lib/es/timePicker/ComboxFoundation.js +4 -30
  362. package/lib/es/timePicker/foundation.d.ts +1 -1
  363. package/lib/es/timePicker/foundation.js +4 -90
  364. package/lib/es/timePicker/inputFoundation.js +6 -22
  365. package/lib/es/timePicker/utils/index.js +6 -25
  366. package/lib/es/timePicker/utils/localeDate.js +0 -8
  367. package/lib/es/toast/constants.js +1 -1
  368. package/lib/es/toast/toastFoundation.d.ts +3 -3
  369. package/lib/es/toast/toastFoundation.js +0 -9
  370. package/lib/es/toast/toastListFoundation.js +4 -18
  371. package/lib/es/tooltip/foundation.d.ts +1 -1
  372. package/lib/es/tooltip/foundation.js +63 -288
  373. package/lib/es/transfer/foundation.d.ts +1 -1
  374. package/lib/es/transfer/foundation.js +6 -62
  375. package/lib/es/transfer/transferUtils.js +5 -21
  376. package/lib/es/tree/foundation.d.ts +3 -3
  377. package/lib/es/tree/foundation.js +34 -143
  378. package/lib/es/tree/treeUtil.js +54 -139
  379. package/lib/es/treeSelect/foundation.d.ts +7 -7
  380. package/lib/es/treeSelect/foundation.js +20 -179
  381. package/lib/es/typography/formatNumeral.d.ts +3 -3
  382. package/lib/es/typography/formatNumeral.js +16 -29
  383. package/lib/es/upload/foundation.d.ts +5 -5
  384. package/lib/es/upload/foundation.js +36 -238
  385. package/lib/es/upload/utils.js +10 -24
  386. package/lib/es/utils/Event.js +2 -17
  387. package/lib/es/utils/FocusHandle.d.ts +1 -1
  388. package/lib/es/utils/FocusHandle.js +6 -32
  389. package/lib/es/utils/Logger.js +0 -20
  390. package/lib/es/utils/Store.js +0 -9
  391. package/lib/es/utils/a11y.js +18 -31
  392. package/lib/es/utils/array.d.ts +1 -1
  393. package/lib/es/utils/array.js +0 -5
  394. package/lib/es/utils/classnames.js +0 -10
  395. package/lib/es/utils/date-fns-extra.js +0 -27
  396. package/lib/es/utils/dom.d.ts +1 -1
  397. package/lib/es/utils/dom.js +0 -9
  398. package/lib/es/utils/getDataAttr.js +0 -1
  399. package/lib/es/utils/getHighlight.js +5 -26
  400. package/lib/es/utils/getMotionObjFromProps.js +0 -8
  401. package/lib/es/utils/isBothNaN.js +0 -1
  402. package/lib/es/utils/isEnterPress.js +0 -2
  403. package/lib/es/utils/isEscPress.js +0 -2
  404. package/lib/es/utils/keyCode.js +0 -104
  405. package/lib/es/utils/log.js +0 -3
  406. package/lib/es/utils/object.d.ts +4 -4
  407. package/lib/es/utils/object.js +12 -28
  408. package/lib/es/utils/set.js +0 -5
  409. package/lib/es/utils/shallowEqualObjects.js +0 -6
  410. package/lib/es/utils/touchPolyfill.js +0 -5
  411. package/lib/es/utils/type.d.ts +3 -3
  412. package/lib/es/utils/uuid.js +2 -8
  413. package/package.json +2 -2
  414. package/table/foundation.ts +7 -10
  415. package/upload/foundation.ts +8 -8
@@ -31,33 +31,25 @@ exports.normalizeValue = normalizeValue;
31
31
  exports.normalizedArr = normalizedArr;
32
32
  exports.traverseDataNodes = traverseDataNodes;
33
33
  exports.updateKeys = updateKeys;
34
-
35
34
  var _get2 = _interopRequireDefault(require("lodash/get"));
36
-
37
35
  var _pick2 = _interopRequireDefault(require("lodash/pick"));
38
-
39
36
  var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
40
-
41
37
  var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
42
-
43
38
  var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
44
-
45
39
  var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
46
-
47
40
  var _max2 = _interopRequireDefault(require("lodash/max"));
48
-
49
41
  var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
50
-
51
42
  var _difference2 = _interopRequireDefault(require("lodash/difference"));
52
-
53
43
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
+ /**
45
+ * Part of the utils function implementation process reference
46
+ * https://github.com/react-component/tree/blob/master/src/util.tsx
47
+ */
54
48
 
55
49
  const DRAG_OFFSET = 0.45;
56
-
57
50
  function getPosition(level, index) {
58
51
  return `${level}-${index}`;
59
52
  }
60
-
61
53
  function isValid(val) {
62
54
  return !(0, _isNull2.default)(val) && !(0, _isUndefined2.default)(val);
63
55
  }
@@ -69,19 +61,16 @@ function isValid(val) {
69
61
  * need expanded keys, provides `true` means all expanded
70
62
  */
71
63
  // eslint-disable-next-line max-len
72
-
73
-
74
64
  function flattenTreeData(treeNodeList, expandedKeys) {
75
65
  let filteredShownKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
76
66
  const flattenList = [];
77
67
  const filterSearch = Boolean(filteredShownKeys);
78
-
79
68
  function flatten(list) {
80
69
  let parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
81
70
  return list.map((treeNode, index) => {
82
71
  const pos = getPosition(parent ? parent.pos : '0', index);
83
- const mergedKey = treeNode.key; // Add FlattenDataNode into list
84
-
72
+ const mergedKey = treeNode.key;
73
+ // Add FlattenDataNode into list
85
74
  const flattenNode = Object.assign(Object.assign({}, (0, _pick2.default)(treeNode, ['key', 'label', 'value', 'icon', 'disabled', 'isLeaf'])), {
86
75
  parent,
87
76
  pos,
@@ -90,30 +79,24 @@ function flattenTreeData(treeNodeList, expandedKeys) {
90
79
  _innerDataTag: true
91
80
  });
92
81
  const isBooleanFilteredShownKeys = typeof filteredShownKeys === 'boolean';
93
-
94
82
  if (!filterSearch || !isBooleanFilteredShownKeys && filteredShownKeys.has(mergedKey)) {
95
83
  flattenList.push(flattenNode);
96
- } // Loop treeNode children
84
+ }
85
+ // Loop treeNode children
97
86
  // eslint-disable-next-line max-len
98
-
99
-
100
87
  if (expandedKeys.has(mergedKey) && (!filterSearch || !isBooleanFilteredShownKeys && filteredShownKeys.has(mergedKey))) {
101
88
  flattenNode.children = flatten(treeNode.children || [], flattenNode);
102
89
  } else {
103
90
  flattenNode.children = [];
104
91
  }
105
-
106
92
  return flattenNode;
107
93
  });
108
94
  }
109
-
110
95
  flatten(treeNodeList);
111
96
  return flattenList;
112
97
  }
113
-
114
98
  function convertJsonToData(treeJson) {
115
99
  const treeData = [];
116
-
117
100
  const traverseNode = (key, children, path, res) => {
118
101
  const currPath = [...path, key];
119
102
  const itemKey = currPath.join('-');
@@ -122,7 +105,6 @@ function convertJsonToData(treeJson) {
122
105
  label: key,
123
106
  value: children
124
107
  };
125
-
126
108
  if ((0, _isObject2.default)(children)) {
127
109
  const newChildren = [];
128
110
  Object.entries(children).forEach(c => {
@@ -130,23 +112,19 @@ function convertJsonToData(treeJson) {
130
112
  });
131
113
  newNode.children = newChildren;
132
114
  }
133
-
134
115
  res.push(newNode);
135
116
  };
136
-
137
117
  Object.entries(treeJson).forEach(item => traverseNode(item[0], item[1], [], treeData));
138
118
  return treeData;
139
119
  }
140
120
  /**
141
121
  * Traverse all the data by `treeData`.
142
122
  */
143
-
144
-
145
123
  function traverseDataNodes(treeNodes, callback) {
146
124
  const processNode = (node, ind, parent) => {
147
125
  const children = node ? node.children : treeNodes;
148
- const pos = node ? getPosition(parent.pos, ind) : '0'; // Process node if is not root
149
-
126
+ const pos = node ? getPosition(parent.pos, ind) : '0';
127
+ // Process node if is not root
150
128
  if (node) {
151
129
  const data = {
152
130
  data: Object.assign({}, node),
@@ -157,9 +135,8 @@ function traverseDataNodes(treeNodes, callback) {
157
135
  level: Number(parent.level) + 1
158
136
  };
159
137
  callback(data);
160
- } // Process children node
161
-
162
-
138
+ }
139
+ // Process children node
163
140
  if (children) {
164
141
  children.forEach((subNode, subIndex) => {
165
142
  processNode(subNode, subIndex, {
@@ -170,12 +147,9 @@ function traverseDataNodes(treeNodes, callback) {
170
147
  });
171
148
  }
172
149
  };
173
-
174
150
  processNode(null);
175
151
  }
176
152
  /* Convert data to entities map */
177
-
178
-
179
153
  function convertDataToEntities(dataNodes) {
180
154
  const posEntities = {};
181
155
  const keyEntities = {};
@@ -193,16 +167,13 @@ function convertDataToEntities(dataNodes) {
193
167
  } = data;
194
168
  const entity = Object.assign({}, data);
195
169
  const value = (0, _get2.default)(entity, 'data.value', null);
196
-
197
170
  if (value !== null) {
198
171
  valueEntities[value] = key;
199
172
  }
200
-
201
173
  posEntities[pos] = entity;
202
- keyEntities[key] = entity; // Fill children
203
-
174
+ keyEntities[key] = entity;
175
+ // Fill children
204
176
  entity.parent = posEntities[parentPos];
205
-
206
177
  if (entity.parent) {
207
178
  entity.parent.children = entity.parent.children || [];
208
179
  entity.parent.children.push(entity);
@@ -211,25 +182,19 @@ function convertDataToEntities(dataNodes) {
211
182
  return wrapper;
212
183
  }
213
184
  /* Get key by value */
214
-
215
-
216
185
  function findKeysForValues(valueList, valueEntities) {
217
186
  let isMultiple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
218
-
219
187
  if (!isValid(valueList)) {
220
188
  return [];
221
189
  }
222
-
223
190
  if (!isMultiple && Array.isArray(valueList)) {
224
191
  valueList = valueList.length ? [valueList[0]] : [];
225
192
  } else if (!Array.isArray(valueList)) {
226
193
  valueList = [valueList];
227
194
  }
228
-
229
195
  if ((0, _isEmpty2.default)(valueEntities)) {
230
196
  return valueList;
231
197
  }
232
-
233
198
  const res = [];
234
199
  valueList.forEach(val => {
235
200
  if (val in valueEntities) {
@@ -241,21 +206,17 @@ function findKeysForValues(valueList, valueEntities) {
241
206
  });
242
207
  return res;
243
208
  }
244
-
245
209
  function findDescendantKeys(selectedKeys, options) {
246
210
  let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
247
211
  const res = [];
248
-
249
212
  const findChild = item => {
250
213
  if (!item) {
251
214
  return;
252
215
  }
253
-
254
216
  const {
255
217
  children
256
218
  } = item;
257
219
  const hasChildren = isValid(children);
258
-
259
220
  if (hasChildren) {
260
221
  children.forEach(child => {
261
222
  res.push(child.key);
@@ -263,17 +224,14 @@ function findDescendantKeys(selectedKeys, options) {
263
224
  });
264
225
  }
265
226
  };
266
-
267
227
  selectedKeys.forEach(item => {
268
228
  if (self) {
269
229
  res.push(item);
270
230
  }
271
-
272
231
  findChild(options[item]);
273
232
  });
274
233
  return res;
275
234
  }
276
-
277
235
  function findChildKeys(keys, options) {
278
236
  let omitKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
279
237
  const res = [];
@@ -288,21 +246,16 @@ function findChildKeys(keys, options) {
288
246
  return res;
289
247
  }
290
248
  /* istanbul ignore next */
291
-
292
-
293
249
  function findLeafKeys(keys, options) {
294
250
  const res = [];
295
-
296
251
  const findChild = item => {
297
252
  if (!item) {
298
253
  return;
299
254
  }
300
-
301
255
  const {
302
256
  children
303
257
  } = item;
304
258
  const isLeaf = !isValid(children);
305
-
306
259
  if (isLeaf) {
307
260
  res.push(item.key);
308
261
  } else {
@@ -311,13 +264,11 @@ function findLeafKeys(keys, options) {
311
264
  });
312
265
  }
313
266
  };
314
-
315
267
  keys.forEach(item => {
316
268
  findChild(options[item]);
317
269
  });
318
270
  return res;
319
271
  }
320
-
321
272
  function findSiblingKeys(selectedKeys, options) {
322
273
  let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
323
274
  const par = [];
@@ -329,39 +280,33 @@ function findSiblingKeys(selectedKeys, options) {
329
280
  const res = findChildKeys((0, _uniq2.default)(par), options, self ? [] : selectedKeys);
330
281
  return res;
331
282
  }
332
-
333
283
  function findAncestorKeys(selectedKeys, options) {
334
284
  let self = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
335
- const res = []; // Recursively find the parent element
336
-
285
+ const res = [];
286
+ // Recursively find the parent element
337
287
  const findPar = item => {
338
288
  if (item.parent) {
339
289
  res.push(item.parent.key);
340
290
  findPar(item.parent);
341
291
  }
342
292
  };
343
-
344
293
  selectedKeys.forEach(item => {
345
294
  options[item] && findPar(options[item]);
346
-
347
295
  if (self) {
348
296
  res.push(item);
349
297
  }
350
298
  });
351
299
  return res;
352
300
  }
353
-
354
301
  function getSortedKeyList(keyList, keyEntities) {
355
302
  const levelMap = {};
356
303
  keyList.forEach(key => {
357
304
  if (!keyEntities[key]) {
358
305
  return;
359
306
  }
360
-
361
307
  const {
362
308
  level
363
309
  } = keyEntities[key];
364
-
365
310
  if (levelMap[level]) {
366
311
  levelMap[level].push(key);
367
312
  } else {
@@ -370,7 +315,6 @@ function getSortedKeyList(keyList, keyEntities) {
370
315
  });
371
316
  return levelMap;
372
317
  }
373
-
374
318
  function calcCheckedKeys(values, keyEntities) {
375
319
  const keyList = Array.isArray(values) ? values : [values];
376
320
  const descendantKeys = findDescendantKeys(keyList, keyEntities, true);
@@ -379,103 +323,85 @@ function calcCheckedKeys(values, keyEntities) {
379
323
  * their descendants must be checked. That is to say, if the descendant nodes have
380
324
  * disabled+unchecked nodes, their ancestor nodes will definitely not be checked
381
325
  */
382
-
383
326
  const checkedKeys = new Set([...descendantKeys]);
384
327
  let halfCheckedKeys = new Set([]);
385
328
  let visited = [];
386
329
  const levelMap = getSortedKeyList(keyList, keyEntities);
387
-
388
330
  const calcCurrLevel = node => {
389
331
  const {
390
332
  key,
391
333
  parent,
392
334
  level
393
- } = node; // If the node does not have a parent node, or the node has been processed just now, no processing is done
394
-
335
+ } = node;
336
+ // If the node does not have a parent node, or the node has been processed just now, no processing is done
395
337
  if (!parent || visited.includes(key)) {
396
338
  return;
397
339
  }
398
-
399
- const siblingKeys = findSiblingKeys([key], keyEntities); // visited for caching to avoid double counting
400
-
340
+ const siblingKeys = findSiblingKeys([key], keyEntities);
341
+ // visited for caching to avoid double counting
401
342
  visited = [...visited, ...siblingKeys];
402
343
  const allChecked = siblingKeys.every(siblingKey => checkedKeys.has(siblingKey));
403
-
404
344
  if (!allChecked) {
405
345
  const ancestorKeys = findAncestorKeys([key], keyEntities, false);
406
346
  halfCheckedKeys = new Set([...halfCheckedKeys, ...ancestorKeys]);
407
347
  } else {
408
- checkedKeys.add(parent.key); // IMPORTANT! parent level may not exist in original level map; if add to the end directly may destroy the hierarchical order
409
-
348
+ checkedKeys.add(parent.key);
349
+ // IMPORTANT! parent level may not exist in original level map; if add to the end directly may destroy the hierarchical order
410
350
  if (level - 1 in levelMap && level) {
411
351
  levelMap[level - 1].push(parent.key);
412
352
  } else {
413
353
  levelMap[level - 1] = [parent.key];
414
354
  }
415
355
  }
416
- }; // Loop keyList from deepest Level to topLevel, bottom up
417
-
418
-
356
+ };
357
+ // Loop keyList from deepest Level to topLevel, bottom up
419
358
  while (!(0, _isEmpty2.default)(levelMap)) {
420
359
  const maxLevel = (0, _max2.default)(Object.keys(levelMap).map(key => Number(key)));
421
360
  levelMap[maxLevel].forEach(key => calcCurrLevel(keyEntities[key]));
422
361
  delete levelMap[maxLevel];
423
362
  }
424
-
425
363
  return {
426
364
  checkedKeys,
427
365
  halfCheckedKeys
428
366
  };
429
367
  }
430
368
  /* Calculate the expanded node by key */
431
-
432
-
433
369
  function calcExpandedKeys() {
434
370
  let keyList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
435
371
  let keyEntities = arguments.length > 1 ? arguments[1] : undefined;
436
372
  let autoExpandParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
437
-
438
373
  if (!Array.isArray(keyList)) {
439
374
  keyList = [keyList];
440
375
  }
441
-
442
376
  if (autoExpandParent) {
443
377
  const ancestorKeys = findAncestorKeys(keyList, keyEntities, true);
444
378
  return new Set(ancestorKeys);
445
379
  }
446
-
447
380
  return new Set(keyList);
448
381
  }
449
382
  /* Calculate the expanded node by value */
450
383
  // eslint-disable-next-line max-len
451
-
452
-
453
384
  function calcExpandedKeysForValues(value, keyEntities, isMultiple, valueEntities) {
454
385
  const keys = findKeysForValues(value, valueEntities, isMultiple);
455
386
  return new Set(findAncestorKeys(keys, keyEntities, false));
456
387
  }
457
-
458
388
  function calcMotionKeys(oldKeySet, newKeySet, keyEntities) {
459
389
  let motionType = 'show';
460
390
  const oldKeys = [...oldKeySet];
461
391
  const newKeys = [...newKeySet];
462
-
463
392
  if (Math.abs(oldKeys.length - newKeys.length) !== 1) {
464
393
  return {
465
394
  motionType,
466
395
  motionKeys: []
467
396
  };
468
397
  }
469
-
470
398
  let diffKeys = [];
471
-
472
399
  if (oldKeys.length > newKeys.length) {
473
400
  motionType = 'hide';
474
401
  diffKeys = (0, _difference2.default)(oldKeys, newKeys);
475
402
  } else {
476
403
  diffKeys = (0, _difference2.default)(newKeys, oldKeys);
477
404
  }
478
-
479
405
  return {
480
406
  motionType: diffKeys.length === 1 ? motionType : 'show',
481
407
  motionKeys: diffKeys.length === 1 ? findDescendantKeys(diffKeys, keyEntities, false) : []
@@ -486,121 +412,98 @@ function calcMotionKeys(oldKeySet, newKeySet, keyEntities) {
486
412
  * When filterTreeNode is a function,returns the result of filterTreeNode which called with (sugInput, target, option).
487
413
  * The filteredPath parameter will only be passed in when the Cascader calls the filter function
488
414
  */
489
-
490
-
491
415
  function filter(sugInput, option, filterTreeNode, filterProps, filteredPath) {
492
416
  if (!filterTreeNode) {
493
417
  return true;
494
418
  }
495
-
496
419
  let filterFn = filterTreeNode;
497
420
  let target = filteredPath !== null && filteredPath !== void 0 ? filteredPath : option;
498
-
499
421
  if (typeof filterTreeNode === 'boolean') {
500
422
  filterFn = (targetVal, val) => {
501
423
  const input = targetVal.toLowerCase();
502
424
  return val.toString().toLowerCase().includes(input);
503
425
  };
504
426
  }
505
-
506
427
  if (filterProps) {
507
428
  target = option[filterProps];
508
429
  }
509
-
510
430
  return filterFn(sugInput, target, option);
511
431
  }
512
-
513
432
  function normalizedArr(val) {
514
433
  if (!Array.isArray(val)) {
515
434
  return [val];
516
435
  } else {
517
436
  return val;
518
437
  }
519
- } // flag is used to determine whether to return when the key does not belong to the keys in keyEntities
438
+ }
439
+ // flag is used to determine whether to return when the key does not belong to the keys in keyEntities
520
440
  // export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
521
-
522
-
523
441
  function normalizeKeyList(keyList, keyEntities) {
524
442
  let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
525
443
  let flag = arguments.length > 3 ? arguments[3] : undefined;
526
444
  const res = [];
527
445
  const keyListSet = new Set(keyList);
528
-
529
446
  if (!leafOnly) {
530
447
  keyList.forEach(key => {
531
448
  if (!keyEntities[key]) {
532
449
  if (flag) {
533
450
  res.push(key);
534
451
  }
535
-
536
452
  return;
537
453
  }
538
-
539
454
  const {
540
455
  parent
541
456
  } = keyEntities[key];
542
-
543
457
  if (parent && keyListSet.has(parent.key)) {
544
458
  return;
545
459
  }
546
-
547
460
  res.push(key);
548
461
  });
549
462
  } else {
550
463
  keyList.forEach(key => {
551
464
  if (keyEntities[key] && !isValid(keyEntities[key].children)) {
552
465
  res.push(key);
553
- } // when key is not in keyEntities, if flag is true, key should be push in res
554
-
555
-
466
+ }
467
+ // when key is not in keyEntities, if flag is true, key should be push in res
556
468
  if (!keyEntities[key] && flag) {
557
469
  res.push(key);
558
470
  }
559
471
  });
560
472
  }
561
-
562
473
  return res;
563
474
  }
564
-
565
475
  function getMotionKeys(eventKey, expandedKeys, keyEntities) {
566
476
  const res = [];
567
-
568
477
  const getChild = itemKey => {
569
478
  keyEntities[itemKey].children && keyEntities[itemKey].children.forEach(item => {
570
479
  const {
571
480
  key
572
481
  } = item;
573
482
  res.push(key);
574
-
575
483
  if (expandedKeys.has(key)) {
576
484
  getChild(key);
577
485
  }
578
486
  });
579
487
  };
580
-
581
488
  getChild(eventKey);
582
489
  return res;
583
- } // eslint-disable-next-line max-len
584
-
585
-
490
+ }
491
+ // eslint-disable-next-line max-len
586
492
  function calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKeys) {
587
493
  const descendantKeys = findDescendantKeys([key], keyEntities, true);
588
494
  const nodeItem = keyEntities[key];
589
495
  checkedKeys = new Set([...checkedKeys, key]);
590
-
591
496
  const calcCurrLevel = node => {
592
497
  if (!node.parent) {
593
498
  return;
594
- } // eslint-disable-next-line @typescript-eslint/no-shadow
595
-
596
-
499
+ }
500
+ // eslint-disable-next-line @typescript-eslint/no-shadow
597
501
  const {
598
502
  key
599
503
  } = node;
600
- const siblingKeys = findSiblingKeys([key], keyEntities); // eslint-disable-next-line @typescript-eslint/no-shadow
601
-
504
+ const siblingKeys = findSiblingKeys([key], keyEntities);
505
+ // eslint-disable-next-line @typescript-eslint/no-shadow
602
506
  const allChecked = siblingKeys.every(key => checkedKeys.has(key));
603
-
604
507
  if (!allChecked) {
605
508
  const ancestorKeys = findAncestorKeys([key], keyEntities, false);
606
509
  halfCheckedKeys = new Set([...halfCheckedKeys, ...ancestorKeys]);
@@ -610,15 +513,13 @@ function calcCheckedKeysForChecked(key, keyEntities, checkedKeys, halfCheckedKey
610
513
  calcCurrLevel(par);
611
514
  }
612
515
  };
613
-
614
516
  calcCurrLevel(nodeItem);
615
517
  return {
616
518
  checkedKeys: new Set([...checkedKeys, ...descendantKeys]),
617
519
  halfCheckedKeys
618
520
  };
619
- } // eslint-disable-next-line max-len
620
-
621
-
521
+ }
522
+ // eslint-disable-next-line max-len
622
523
  function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedKeys) {
623
524
  const descendantKeys = findDescendantKeys([key], keyEntities, true);
624
525
  const nodeItem = keyEntities[key];
@@ -626,61 +527,54 @@ function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfCheckedK
626
527
  if (checkedKeys.has(descendantKey)) {
627
528
  checkedKeys.delete(descendantKey);
628
529
  }
629
-
630
530
  if (halfCheckedKeys.has(descendantKey)) {
631
531
  halfCheckedKeys.delete(descendantKey);
632
532
  }
633
533
  });
634
-
635
534
  const calcCurrLevel = node => {
636
- const par = node.parent; // no parent
637
-
535
+ const par = node.parent;
536
+ // no parent
638
537
  if (!par) {
639
538
  return;
640
- } // Has a parent node, and the parent node is not checked or halfChecked
641
-
642
-
539
+ }
540
+ // Has a parent node, and the parent node is not checked or halfChecked
643
541
  if (!checkedKeys.has(par.key) && !halfCheckedKeys.has(par.key)) {
644
542
  return;
645
- } // Has a parent node, and the parent node is checked or halfChecked
543
+ }
544
+ // Has a parent node, and the parent node is checked or halfChecked
646
545
  // eslint-disable-next-line @typescript-eslint/no-shadow
647
-
648
-
649
546
  const {
650
547
  key
651
548
  } = node;
652
- const siblingKeys = findSiblingKeys([key], keyEntities); // eslint-disable-next-line @typescript-eslint/no-shadow
653
-
549
+ const siblingKeys = findSiblingKeys([key], keyEntities);
550
+ // eslint-disable-next-line @typescript-eslint/no-shadow
654
551
  const anyChecked = siblingKeys.some(key => checkedKeys.has(key) || halfCheckedKeys.has(key));
655
- const ancestorKeys = findAncestorKeys([key], keyEntities, false); // If there is checked or halfChecked in the sibling node, you need to change the parent node to halfChecked
656
-
552
+ const ancestorKeys = findAncestorKeys([key], keyEntities, false);
553
+ // If there is checked or halfChecked in the sibling node, you need to change the parent node to halfChecked
657
554
  if (anyChecked) {
658
555
  ancestorKeys.forEach(itemKey => {
659
556
  if (checkedKeys.has(itemKey)) {
660
557
  checkedKeys.delete(itemKey);
661
558
  halfCheckedKeys.add(itemKey);
662
559
  }
663
- }); // If there is no checked or halfChecked in the sibling node, you need to change the parent node to unchecked
560
+ });
561
+ // If there is no checked or halfChecked in the sibling node, you need to change the parent node to unchecked
664
562
  } else {
665
563
  if (checkedKeys.has(par.key)) {
666
564
  checkedKeys.delete(par.key);
667
565
  }
668
-
669
566
  if (halfCheckedKeys.has(par.key)) {
670
567
  halfCheckedKeys.delete(par.key);
671
568
  }
672
-
673
569
  calcCurrLevel(par);
674
570
  }
675
571
  };
676
-
677
572
  nodeItem && calcCurrLevel(nodeItem);
678
573
  return {
679
574
  checkedKeys,
680
575
  halfCheckedKeys
681
576
  };
682
577
  }
683
-
684
578
  function filterTreeData(info) {
685
579
  const {
686
580
  showFilteredOnly,
@@ -694,12 +588,10 @@ function filterTreeData(info) {
694
588
  let filteredOptsKeys = [];
695
589
  filteredOptsKeys = Object.values(keyEntities).filter(item => filter(inputValue, item.data, filterTreeNode, filterProps)).map(item => item.key);
696
590
  let expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
697
-
698
591
  if (prevExpandedKeys.length) {
699
592
  const prevExpandedValidKeys = prevExpandedKeys.filter(key => Boolean(keyEntities[key]));
700
593
  expandedOptsKeys = expandedOptsKeys.concat(prevExpandedValidKeys);
701
594
  }
702
-
703
595
  const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
704
596
  const filteredShownKeys = new Set([...shownChildKeys, ...expandedOptsKeys]);
705
597
  const flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
@@ -709,19 +601,15 @@ function filterTreeData(info) {
709
601
  filteredExpandedKeys: new Set(expandedOptsKeys),
710
602
  filteredShownKeys
711
603
  };
712
- } // return data.value if data.value exist else fall back to key
713
-
714
-
604
+ }
605
+ // return data.value if data.value exist else fall back to key
715
606
  function getValueOrKey(data) {
716
607
  if (Array.isArray(data)) {
717
608
  return data.map(item => (0, _get2.default)(item, 'value', item.key));
718
609
  }
719
-
720
610
  return (0, _get2.default)(data, 'value', data.key);
721
611
  }
722
612
  /* Convert value to string */
723
-
724
-
725
613
  function normalizeValue(value, withObject) {
726
614
  if (withObject && isValid(value)) {
727
615
  return getValueOrKey(value);
@@ -729,12 +617,10 @@ function normalizeValue(value, withObject) {
729
617
  return value;
730
618
  }
731
619
  }
732
-
733
620
  function updateKeys(keySet, keyEntities) {
734
621
  const keyArr = [...keySet];
735
622
  return keyArr.filter(key => key in keyEntities);
736
623
  }
737
-
738
624
  function calcDisabledKeys(keyEntities) {
739
625
  const disabledKeys = Object.keys(keyEntities).filter(key => keyEntities[key].data.disabled);
740
626
  const {
@@ -742,7 +628,6 @@ function calcDisabledKeys(keyEntities) {
742
628
  } = calcCheckedKeys(disabledKeys, keyEntities);
743
629
  return checkedKeys;
744
630
  }
745
-
746
631
  function calcDropRelativePosition(event, treeNode) {
747
632
  const {
748
633
  clientY
@@ -751,25 +636,21 @@ function calcDropRelativePosition(event, treeNode) {
751
636
  top,
752
637
  bottom,
753
638
  height
754
- } = treeNode.nodeInstance.getBoundingClientRect(); // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
755
-
639
+ } = treeNode.nodeInstance.getBoundingClientRect();
640
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
756
641
  if (clientY <= top + height * DRAG_OFFSET) {
757
642
  return -1;
758
643
  }
759
-
760
644
  if (clientY >= bottom - height * DRAG_OFFSET) {
761
645
  return 1;
762
646
  }
763
-
764
647
  return 0;
765
648
  }
766
-
767
649
  function getDragNodesKeys(key, keyEntities) {
768
650
  return findDescendantKeys([key], keyEntities, true);
769
651
  }
770
-
771
652
  function calcDropActualPosition(pos, relativeDropPos) {
772
- const posArr = pos.split('-'); // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
773
-
653
+ const posArr = pos.split('-');
654
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
774
655
  return relativeDropPos + Number(posArr[posArr.length - 1]);
775
656
  }