@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
@@ -11,19 +11,69 @@ import _each from "lodash/each";
11
11
  import _isFunction from "lodash/isFunction";
12
12
  import _merge from "lodash/merge";
13
13
  import _get from "lodash/get";
14
+ /* eslint-disable prefer-destructuring */
15
+ /* eslint-disable max-depth */
16
+ /* eslint-disable max-nested-callbacks */
17
+ /* eslint-disable max-len */
18
+ /* eslint-disable no-param-reassign */
19
+ /* eslint-disable eqeqeq */
20
+ /* eslint-disable @typescript-eslint/no-empty-function */
14
21
  import memoizeOne from 'memoize-one';
15
22
  import BaseFoundation from '../base/foundation';
16
23
  import { strings, numbers } from './constants';
17
24
  import { mergeQueries, flattenColumns, filterColumns } from './utils';
18
25
  import { pullAll, withOrderSort } from '../utils/array';
19
-
20
26
  class TableFoundation extends BaseFoundation {
27
+ /**
28
+ * update columns in place, and use default values as initial values if the sorting and filtering columns have no values
29
+ */
30
+ static initColumnsFilteredValueAndSorterOrder(columns) {
31
+ columns.forEach(column => {
32
+ TableFoundation.initFilteredValue(column);
33
+ TableFoundation.initSorterOrder(column);
34
+ });
35
+ return columns;
36
+ }
37
+ /**
38
+ * init filteredValue of filtering column, use defaultFilteredValue or [] when it is undefined
39
+ */
40
+ static initFilteredValue(column) {
41
+ const {
42
+ defaultFilteredValue,
43
+ filteredValue
44
+ } = column;
45
+ // There may be cases where onFilter is empty, such as server-side filtering
46
+ // Because filterValue affects the output of filters, it needs to be initialized here
47
+ if (_isUndefined(filteredValue)) {
48
+ if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
49
+ column.filteredValue = defaultFilteredValue;
50
+ } else {
51
+ column.filteredValue = [];
52
+ }
53
+ }
54
+ }
55
+ /**
56
+ * init sortOrder of sorting column, use defaultSortOrder or [] when it is undefined
57
+ */
58
+ static initSorterOrder(column) {
59
+ const {
60
+ defaultSortOrder,
61
+ sortOrder,
62
+ sorter
63
+ } = column;
64
+ if (sorter && _isUndefined(sortOrder)) {
65
+ if (!_isUndefined(defaultSortOrder)) {
66
+ column.sortOrder = defaultSortOrder;
67
+ } else {
68
+ column.sortOrder = false;
69
+ }
70
+ }
71
+ }
21
72
  constructor(adapter) {
22
73
  super(Object.assign({}, adapter));
23
74
  /**
24
75
  * set page number
25
76
  */
26
-
27
77
  this.setPage = (currentPage, currentPageSize) => {
28
78
  currentPage = currentPage || this._adapter.getCurrentPage();
29
79
  const currentPagination = this.getState('pagination');
@@ -36,121 +86,49 @@ class TableFoundation extends BaseFoundation {
36
86
  currentPage,
37
87
  pageSize: currentPageSize
38
88
  }));
39
-
40
89
  if (!this._pagerIsControlled() && currentPage > 0) {
41
90
  this._adapter.setDisabledRowKeys(disabledRowKeys);
42
-
43
91
  this._adapter.setAllRowKeys(allRowKeys);
44
-
45
92
  this._adapter.setPagination(pagination);
46
-
47
93
  this._adapter.setDataSource(dataSource);
48
94
  }
49
-
50
95
  this._notifyChange(pagination);
51
96
  };
52
97
  /**
53
98
  * Cache related data when initializing or updating the calculated dataSource
54
99
  * @param {*} filteredSortedDataSource
55
100
  */
56
-
57
-
58
101
  this.setCachedFilteredSortedDataSource = filteredSortedDataSource => {
59
102
  this._adapter.setCachedFilteredSortedDataSource(filteredSortedDataSource);
60
-
61
103
  const filteredSortedRowKeys = this.getAllRowKeys(filteredSortedDataSource);
62
-
63
104
  this._adapter.setCachedFilteredSortedRowKeys(filteredSortedRowKeys);
64
105
  };
65
-
66
106
  this.isSortOrderValid = sortOrder => strings.SORT_DIRECTIONS.includes(sortOrder) || sortOrder === false;
67
107
  /**
68
108
  * memoized function list
69
109
  */
70
-
71
-
72
110
  const handleColumns = this._adapter.getHandleColumns();
73
-
74
111
  const mergePagination = this._adapter.getMergePagination();
75
-
76
112
  this.memoizedWithFnsColumns = memoizeOne(handleColumns, _isEqual);
77
113
  this.memoizedFilterColumns = memoizeOne(filterColumns);
78
114
  this.memoizedFlattenFnsColumns = memoizeOne(flattenColumns);
79
115
  this.memoizedPagination = memoizeOne(mergePagination, _isEqual);
80
116
  }
81
- /**
82
- * update columns in place, and use default values as initial values if the sorting and filtering columns have no values
83
- */
84
-
85
-
86
- static initColumnsFilteredValueAndSorterOrder(columns) {
87
- columns.forEach(column => {
88
- TableFoundation.initFilteredValue(column);
89
- TableFoundation.initSorterOrder(column);
90
- });
91
- return columns;
92
- }
93
- /**
94
- * init filteredValue of filtering column, use defaultFilteredValue or [] when it is undefined
95
- */
96
-
97
-
98
- static initFilteredValue(column) {
99
- const {
100
- defaultFilteredValue,
101
- filteredValue,
102
- onFilter
103
- } = column;
104
-
105
- const hasFilter = _isFunction(onFilter);
106
-
107
- if (hasFilter && _isUndefined(filteredValue)) {
108
- if (Array.isArray(defaultFilteredValue) && defaultFilteredValue.length) {
109
- column.filteredValue = defaultFilteredValue;
110
- } else {
111
- column.filteredValue = [];
112
- }
113
- }
114
- }
115
- /**
116
- * init sortOrder of sorting column, use defaultSortOrder or [] when it is undefined
117
- */
118
-
119
-
120
- static initSorterOrder(column) {
121
- const {
122
- defaultSortOrder,
123
- sortOrder,
124
- sorter
125
- } = column;
126
-
127
- if (sorter && _isUndefined(sortOrder)) {
128
- if (!_isUndefined(defaultSortOrder)) {
129
- column.sortOrder = defaultSortOrder;
130
- } else {
131
- column.sortOrder = false;
132
- }
133
- }
134
- }
135
-
136
117
  init() {
137
118
  const dataSource = [...this.getProp('dataSource')];
138
-
139
119
  const {
140
120
  queries
141
121
  } = this._adapter.getStates();
142
-
143
122
  const filteredSortedDataSource = this.getFilteredSortedDataSource(dataSource, queries);
144
123
  const allDataDisabledRowKeys = this.getAllDisabledRowKeys(filteredSortedDataSource);
145
124
  const pageData = this.getCurrentPageData(filteredSortedDataSource);
146
125
  this.setAdapterPageData(pageData);
147
126
  this.initExpandedRowKeys(pageData);
148
- this.initSelectedRowKeys(pageData); // cache dataSource after mount, and then calculate it on demand
149
-
127
+ this.initSelectedRowKeys(pageData);
128
+ // cache dataSource after mount, and then calculate it on demand
150
129
  this.setCachedFilteredSortedDataSource(filteredSortedDataSource);
151
130
  this.setAllDisabledRowKeys(allDataDisabledRowKeys);
152
131
  }
153
-
154
132
  initExpandedRowKeys() {
155
133
  let {
156
134
  groups
@@ -165,7 +143,6 @@ class TableFoundation extends BaseFoundation {
165
143
  expandAllGroupRows
166
144
  } = this.getProps();
167
145
  const expandedRowKeys = [];
168
-
169
146
  if (defaultExpandAllRows || expandAllRows) {
170
147
  this._addNoDuplicatedItemsToArr(expandedRowKeys, this.getAllRowKeys(dataSource), groups && _isMap(groups) && groups.size ? Array.from(groups.keys()) : []);
171
148
  } else if (defaultExpandAllGroupRows || expandAllGroupRows) {
@@ -175,32 +152,25 @@ class TableFoundation extends BaseFoundation {
175
152
  } else if (Array.isArray(propExpandedRowKeys) && propExpandedRowKeys.length) {
176
153
  this._addNoDuplicatedItemsToArr(expandedRowKeys, propExpandedRowKeys);
177
154
  }
178
-
179
155
  this._adapter.setExpandedRowKeys(expandedRowKeys);
180
156
  }
181
-
182
157
  initSelectedRowKeys(_ref) {
183
158
  let {
184
159
  disabledRowKeys
185
160
  } = _ref;
186
161
  const rowSelection = this.getProp('rowSelection');
187
162
  const rowKeys = [];
188
-
189
163
  if (rowSelection) {
190
164
  const selectedRowKeys = _get(rowSelection, 'selectedRowKeys');
191
-
192
165
  const defaultSelectedRowKeys = _get(rowSelection, 'defaultSelectedRowKeys');
193
-
194
166
  if (Array.isArray(selectedRowKeys)) {
195
167
  this._addNoDuplicatedItemsToArr(rowKeys, selectedRowKeys);
196
168
  } else if (Array.isArray(defaultSelectedRowKeys)) {
197
169
  this._addNoDuplicatedItemsToArr(rowKeys, defaultSelectedRowKeys);
198
170
  }
199
-
200
171
  if (Array.isArray(disabledRowKeys) && disabledRowKeys.length) {
201
172
  _pull(rowKeys, ...disabledRowKeys);
202
173
  }
203
-
204
174
  this._adapter.setSelectedRowKeys(rowKeys);
205
175
  }
206
176
  }
@@ -210,17 +180,8 @@ class TableFoundation extends BaseFoundation {
210
180
  * @param {Object[]} queries
211
181
  * @returns {Object[]} sortedDataSource
212
182
  */
213
-
214
-
215
183
  getFilteredSortedDataSource(dataSource, queries) {
216
184
  const filteredDataSource = this.filterDataSource(dataSource, queries.filter(query => {
217
- /**
218
- * 这里无需判断 filteredValue 是否为数组,初始化时它是 `undefined`,点击选择空时为 `[]`
219
- * 初始化时我们应该用 `defaultFilteredValue`,点击后我们应该用 `filteredValue`
220
- *
221
- * There is no need to judge whether `filteredValue` is an array here, because it is `undefined` when initialized, and `[]` when you click to select empty
222
- * When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
223
- */
224
185
  const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
225
186
  return _isFunction(query.onFilter) && Array.isArray(currentFilteredValue) && currentFilteredValue.length;
226
187
  }));
@@ -235,16 +196,12 @@ class TableFoundation extends BaseFoundation {
235
196
  * @param {object} queries
236
197
  * @returns {{dataSource: RecordType[], groups: Map<string, Set<string>>, pagination: object, disabledRowKeys: string[], queries: BaseColumnProps[], allRowKeys: string[]}}
237
198
  */
238
-
239
-
240
199
  getCurrentPageData(dataSource, pagination, queries) {
241
200
  const filteredSortedDataSource = this._adapter.getCachedFilteredSortedDataSource();
242
-
243
201
  dataSource = dataSource == null ? [...filteredSortedDataSource] : dataSource;
244
202
  pagination = pagination == null ? this.getState('pagination') && Object.assign({}, this.getState('pagination')) : pagination;
245
203
  queries = queries == null ? [...this.getState('queries')] : queries;
246
204
  let groups;
247
-
248
205
  if (this.getProp('groupBy') != null) {
249
206
  const {
250
207
  groups: groupedGroups,
@@ -253,7 +210,6 @@ class TableFoundation extends BaseFoundation {
253
210
  dataSource = groupedData;
254
211
  groups = groupedGroups;
255
212
  }
256
-
257
213
  pagination = this.normalizePagination(pagination, dataSource);
258
214
  dataSource = this.limitPageDataSource(dataSource, pagination);
259
215
  const disabledRowKeys = this.getAllDisabledRowKeys(dataSource);
@@ -274,21 +230,16 @@ class TableFoundation extends BaseFoundation {
274
230
  * @param {*[]} dataSource
275
231
  * @param {Function|string} groupBy
276
232
  */
277
-
278
-
279
233
  groupDataSource(dataSource, groupBy) {
280
234
  groupBy = groupBy == null ? this.getProp('groupBy') : groupBy;
281
235
  const groups = new Map();
282
236
  const newDataSource = [];
283
-
284
237
  if (groupBy != null) {
285
238
  _each(dataSource, (record, index) => {
286
239
  const groupKey = typeof groupBy === 'function' ? groupBy(record) : _get(record, groupBy);
287
-
288
240
  if (groupKey != null && groupKey !== '') {
289
241
  const recordKey = this.getRecordKey(record);
290
242
  let group = groups.get(groupKey);
291
-
292
243
  if (!_isSet(group)) {
293
244
  group = new Set([recordKey]);
294
245
  groups.set(groupKey, group);
@@ -298,7 +249,6 @@ class TableFoundation extends BaseFoundation {
298
249
  }
299
250
  });
300
251
  }
301
-
302
252
  if (groups && groups.size) {
303
253
  groups.forEach((set, key) => {
304
254
  if (_isSet(set)) {
@@ -310,7 +260,6 @@ class TableFoundation extends BaseFoundation {
310
260
  } else {
311
261
  newDataSource.push(...dataSource);
312
262
  }
313
-
314
263
  return {
315
264
  groups,
316
265
  dataSource: newDataSource
@@ -323,8 +272,6 @@ class TableFoundation extends BaseFoundation {
323
272
  * @param {Array} sorters
324
273
  * @returns {Array}
325
274
  */
326
-
327
-
328
275
  sortDataSource(dataSource, sorters) {
329
276
  _each(sorters, sorterObj => {
330
277
  // const sorterObj = last(sorters) || {};
@@ -335,30 +282,24 @@ class TableFoundation extends BaseFoundation {
335
282
  sortChildrenRecord
336
283
  } = sorterObj;
337
284
  const currentSortOrder = this.isSortOrderValid(sortOrder) ? sortOrder : defaultSortOrder;
338
-
339
285
  if (_isFunction(sorter) && currentSortOrder && strings.SORT_DIRECTIONS.includes(currentSortOrder)) {
340
286
  if (sortChildrenRecord) {
341
287
  const childrenRecordName = this.getProp('childrenRecordName');
342
288
  dataSource = dataSource && dataSource.map(record => {
343
289
  const children = this._getRecordChildren(record);
344
-
345
290
  if (Array.isArray(children) && children.length) {
346
291
  return Object.assign(Object.assign({}, record), {
347
292
  [childrenRecordName]: this.sortDataSource(children, [sorterObj])
348
293
  });
349
294
  }
350
-
351
295
  return record;
352
296
  });
353
297
  }
354
-
355
298
  dataSource.sort(withOrderSort(sorter, currentSortOrder));
356
299
  return false;
357
300
  }
358
-
359
301
  return undefined;
360
302
  });
361
-
362
303
  return dataSource;
363
304
  }
364
305
  /**
@@ -368,13 +309,10 @@ class TableFoundation extends BaseFoundation {
368
309
  * @param {*[]} filters
369
310
  * @returns {*[]}
370
311
  */
371
-
372
-
373
312
  filterDataSource(dataSource, filters) {
374
313
  let filteredData = null;
375
314
  let hasValidFilters = false;
376
315
  const childrenRecordName = this.getProp('childrenRecordName');
377
-
378
316
  _each(filters, filterObj => {
379
317
  const {
380
318
  onFilter,
@@ -383,40 +321,33 @@ class TableFoundation extends BaseFoundation {
383
321
  defaultFilteredValue
384
322
  } = filterObj;
385
323
  const currentFilteredValue = Array.isArray(filteredValue) ? filteredValue : defaultFilteredValue;
386
-
387
324
  if (typeof onFilter === 'function' && Array.isArray(currentFilteredValue) && currentFilteredValue.length) {
388
325
  hasValidFilters = true;
389
-
390
326
  if (filteredData === null) {
391
327
  filteredData = new Map();
392
328
  } else {
393
329
  dataSource = Array.from(filteredData && filteredData.values());
394
330
  filteredData = new Map();
395
331
  }
396
-
397
332
  _each(dataSource, record => {
398
333
  _each(currentFilteredValue, value => {
399
334
  const childrenRecords = _get(record, childrenRecordName);
400
-
401
335
  const recordKey = this.getRecordKey(record);
402
336
  let filteredChildren;
403
-
404
337
  if (Array.isArray(childrenRecords) && childrenRecords.length && filterChildrenRecord) {
405
338
  filteredChildren = this.filterDataSource(childrenRecords, [filterObj]);
406
339
  }
407
-
408
340
  if (Array.isArray(filteredChildren) && filteredChildren.length) {
409
341
  if (recordKey != null) {
410
342
  const children = _get(filteredData.get(recordKey), childrenRecordName, []);
411
-
412
343
  filteredData.set(recordKey, Object.assign(Object.assign({}, record), {
413
344
  [childrenRecordName]: filteredChildren.reduce((arr, cur) => {
414
345
  if (arr.find(item => this.getRecordKey(item) === this.getRecordKey(cur)) == null) {
415
346
  arr.push(cur);
416
347
  }
417
-
418
348
  return arr;
419
- }, // @ts-ignore
349
+ },
350
+ // @ts-ignore
420
351
  [...children])
421
352
  }));
422
353
  }
@@ -427,21 +358,16 @@ class TableFoundation extends BaseFoundation {
427
358
  });
428
359
  }
429
360
  });
430
-
431
361
  if (hasValidFilters) {
432
362
  dataSource = Array.from(filteredData && filteredData.values());
433
363
  }
434
-
435
364
  return dataSource;
436
365
  }
437
-
438
366
  limitPageDataSource(dataSource, pagination) {
439
367
  dataSource = dataSource == null ? this.getProp('dataSource') : dataSource;
440
368
  pagination = pagination == null ? this.getState('pagination') : pagination;
441
369
  let pageData = dataSource;
442
-
443
370
  const pageNo = _get(pagination, 'currentPage');
444
-
445
371
  if (this.getProp('pagination') !== false && pageNo && dataSource && pagination && !this._pagerIsControlled()) {
446
372
  const {
447
373
  pageSize = numbers.DEFAULT_PAGE_SIZE
@@ -450,15 +376,12 @@ class TableFoundation extends BaseFoundation {
450
376
  const end = pageNo * pageSize;
451
377
  pageData = _slice(dataSource, start, end);
452
378
  }
453
-
454
379
  return pageData;
455
380
  }
456
-
457
381
  normalizePagination(pagination, dataSource) {
458
382
  pagination = pagination == null ? this._getPagination() : pagination;
459
383
  dataSource = dataSource == null ? this._getDataSource() : dataSource;
460
384
  const propPagination = this.getProp('pagination');
461
-
462
385
  if (pagination) {
463
386
  pagination = typeof pagination === 'object' ? Object.assign({}, pagination) : {};
464
387
  pagination = _merge({
@@ -467,27 +390,21 @@ class TableFoundation extends BaseFoundation {
467
390
  currentPage: _get(propPagination, 'defaultCurrentPage', 1),
468
391
  position: strings.PAGINATION_POSITIONS[0]
469
392
  }, pagination);
470
-
471
393
  if (!this._pagerIsControlled()) {
472
394
  const total = _get(propPagination, 'total', dataSource.length);
473
-
474
395
  const pageSize = _get(propPagination, 'pageSize', pagination.pageSize);
475
-
476
396
  const {
477
397
  currentPage
478
398
  } = pagination;
479
399
  const realTotalPage = Math.ceil(total / pageSize);
480
400
  pagination.total = total;
481
-
482
401
  if (currentPage > realTotalPage) {
483
402
  pagination.currentPage = 1;
484
403
  }
485
404
  }
486
405
  }
487
-
488
406
  return pagination;
489
407
  }
490
-
491
408
  setAdapterPageData() {
492
409
  let pageData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
493
410
  const {
@@ -497,30 +414,19 @@ class TableFoundation extends BaseFoundation {
497
414
  allRowKeys,
498
415
  groups
499
416
  } = pageData;
500
-
501
417
  this._adapter.setDisabledRowKeys(disabledRowKeys);
502
-
503
418
  this._adapter.setAllRowKeys(allRowKeys);
504
-
505
419
  this._adapter.setPagination(pagination);
506
-
507
420
  this._adapter.setGroups(groups);
508
-
509
421
  this._adapter.setDataSource(dataSource);
510
422
  }
511
-
512
423
  destroy() {}
513
-
514
424
  setAllDisabledRowKeys(disabledRowKeys) {
515
425
  this._adapter.setAllDisabledRowKeys(disabledRowKeys);
516
426
  }
517
-
518
427
  handleClick(e) {}
519
-
520
428
  handleMouseEnter(e) {}
521
-
522
429
  handleMouseLeave(e) {}
523
-
524
430
  stopPropagation(e) {
525
431
  this._adapter.stopPropagation(e);
526
432
  }
@@ -529,15 +435,11 @@ class TableFoundation extends BaseFoundation {
529
435
  * @param {Array} srcArr
530
436
  * @param {Object} objArrs
531
437
  */
532
-
533
-
534
438
  _addNoDuplicatedItemsToArr() {
535
439
  let srcArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
536
-
537
440
  for (var _len = arguments.length, objArrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
538
441
  objArrs[_key - 1] = arguments[_key];
539
442
  }
540
-
541
443
  for (const objArr of objArrs) {
542
444
  if (Array.isArray(objArr)) {
543
445
  for (const item of objArr) {
@@ -547,19 +449,15 @@ class TableFoundation extends BaseFoundation {
547
449
  }
548
450
  }
549
451
  }
550
-
551
452
  return srcArr;
552
453
  }
553
-
554
454
  _notifyChange(pagination, filters, sorter, extra) {
555
455
  pagination = pagination == null ? this._getPagination() : pagination;
556
456
  filters = filters == null ? this._getAllFilters() : filters;
557
457
  sorter = sorter == null ? this._getAllSorters()[0] : sorter;
558
-
559
458
  if (_get(this.getProp('scroll'), 'scrollToFirstRowOnChange')) {
560
459
  this._adapter.resetScrollY();
561
460
  }
562
-
563
461
  this._adapter.notifyChange({
564
462
  pagination: Object.assign({}, pagination),
565
463
  filters: [...filters],
@@ -567,15 +465,12 @@ class TableFoundation extends BaseFoundation {
567
465
  extra: Object.assign({}, extra)
568
466
  });
569
467
  }
570
-
571
468
  _rowExpansionIsControlled() {
572
469
  return Array.isArray(this.getProp('expandedRowKeys'));
573
470
  }
574
-
575
471
  _pagerIsControlled() {
576
472
  return _get(this.getProp('pagination'), 'currentPage') != null;
577
473
  }
578
-
579
474
  _selectionIsControlled() {
580
475
  return Array.isArray(_get(this.getProp('rowSelection'), 'selectedRowKeys'));
581
476
  }
@@ -585,8 +480,6 @@ class TableFoundation extends BaseFoundation {
585
480
  * @param {String} dataIndex
586
481
  * @returns {Boolean}
587
482
  */
588
-
589
-
590
483
  _sorterIsControlled(dataIndex) {
591
484
  // The basis for judgment should be props columns instead of cachedColumns fix#1141
592
485
  const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
@@ -598,105 +491,83 @@ class TableFoundation extends BaseFoundation {
598
491
  * @param {String} dataIndex
599
492
  * @returns {Boolean}
600
493
  */
601
-
602
-
603
494
  _filterIsControlled(dataIndex) {
604
495
  const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
605
496
  return Boolean(query && Array.isArray(query.filteredValue));
606
497
  }
607
-
608
498
  _filterShowIsControlled(dataIndex) {
609
499
  const query = dataIndex && this.getQuery(dataIndex, this.getState('flattenColumns'));
610
500
  return Boolean(query && (query.filterDropdownVisible === true || query.filterDropdownVisible === false));
611
501
  }
612
-
613
502
  _getSelectedRowKeys() {
614
503
  const rowSelection = this.getState('rowSelection');
615
-
616
504
  const selectedRowKeys = _get(rowSelection, 'selectedRowKeys', []);
617
-
618
505
  return [...selectedRowKeys];
619
506
  }
620
-
621
507
  _getSelectedRowKeysSet() {
622
508
  const rowSelection = this.getState('rowSelection');
623
-
624
509
  const selectedRowKeysSet = _get(rowSelection, 'selectedRowKeysSet', new Set());
625
-
626
510
  return selectedRowKeysSet;
627
511
  }
628
-
629
512
  _getDataSource() {
630
513
  return this.getProp('dataSource') || [];
631
514
  }
632
-
633
515
  _getRecord(realKey) {
634
516
  return _find(this.getProp('dataSource'), record => realKey != null && realKey !== '' && this.getRecordKey(record) === realKey);
635
517
  }
636
-
637
518
  _getRecordChildren(record) {
638
519
  return _get(record, this.getProp('childrenRecordName'));
639
520
  }
640
-
641
521
  _getPagination() {
642
522
  return this.getState('pagination') || {};
643
523
  }
644
-
524
+ /**
525
+ * Filters are considered valid if filteredValue exists
526
+ */
645
527
  _getAllFilters(queries) {
646
528
  queries = queries || this.getState('queries');
647
529
  const filters = [];
648
-
649
530
  _each(queries, query => {
650
531
  if (Array.isArray(query.filteredValue) && (query.filteredValue.length || this._filterIsControlled(query.dataIndex))) {
651
532
  filters.push(query);
652
533
  }
653
534
  });
654
-
655
535
  return filters;
656
536
  }
657
-
658
537
  _getAllSorters(queries) {
659
538
  queries = queries || this.getState('queries');
660
539
  return _filter(queries, query => query.sorter && query.sortOrder);
661
540
  }
662
-
663
541
  _filterQueries(targetQuery, queries) {
664
542
  let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['dataIndex'];
665
543
  queries = queries == null ? this.getState('queries') : queries;
666
544
  const filteredQueries = [];
667
545
  const filteredIndexes = [];
668
-
669
546
  _each(queries, (itQuery, index) => {
670
547
  const flag = _some(keys, k => k && targetQuery[k] != null && targetQuery[k] === itQuery[k]);
671
-
672
548
  if (flag) {
673
549
  filteredQueries.push(itQuery);
674
550
  filteredIndexes.push(index);
675
551
  }
676
552
  });
677
-
678
553
  return {
679
554
  filteredQueries,
680
555
  filteredIndexes
681
556
  };
682
557
  }
683
-
684
558
  _mergeToQueries(query, queries) {
685
559
  let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['dataIndex'];
686
560
  queries = queries == null ? this.getState('queries') : queries;
687
561
  queries = [...queries];
688
562
  query = Object.assign({}, query);
689
-
690
563
  const {
691
564
  filteredQueries,
692
565
  filteredIndexes
693
566
  } = this._filterQueries(query, queries, keys);
694
-
695
567
  _each(filteredQueries, (curQuery, idx) => {
696
568
  // assign(curQuery, query);
697
569
  queries[filteredIndexes[idx]] = Object.assign({}, query);
698
570
  });
699
-
700
571
  return queries;
701
572
  }
702
573
  /**
@@ -704,53 +575,39 @@ class TableFoundation extends BaseFoundation {
704
575
  * @param {RecordType} record
705
576
  * @returns {string}
706
577
  */
707
-
708
-
709
578
  getRecordKey(record) {
710
579
  if (!record) {
711
580
  return undefined;
712
581
  }
713
-
714
582
  const rowKey = this.getProp('rowKey');
715
583
  return typeof rowKey === 'function' ? rowKey(record) : _get(record, rowKey);
716
584
  }
717
-
718
585
  isEmpty(dataSource) {
719
586
  dataSource = dataSource == null ? this.getProp('dataSource') : dataSource;
720
587
  return !(Array.isArray(dataSource) && dataSource.length > 0);
721
588
  }
722
-
723
589
  handleSelectRow(realKey, selected, e) {
724
590
  this.stopPropagation(e);
725
-
726
591
  if (typeof selected === 'boolean' && realKey != null) {
727
592
  const selectedRowKeys = this._getSelectedRowKeys();
728
-
729
593
  let foundIdx = -1;
730
594
  const selectedRow = this.getSelectedRows(null, [realKey])[0];
731
595
  let selectedRows;
732
-
733
596
  if ((foundIdx = selectedRowKeys.indexOf(realKey)) > -1 && selected === false) {
734
597
  selectedRowKeys.splice(foundIdx, 1);
735
598
  selectedRows = this.getSelectedRows(null, selectedRowKeys);
736
-
737
599
  if (!this._selectionIsControlled()) {
738
600
  this._adapter.setSelectedRowKeys(selectedRowKeys);
739
601
  }
740
-
741
602
  this._adapter.notifySelect(selectedRow, selected, selectedRows, e);
742
-
743
603
  this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
744
604
  } else if (selectedRowKeys.indexOf(realKey) === -1 && selected === true) {
745
605
  selectedRowKeys.push(realKey);
746
606
  selectedRows = this.getSelectedRows(null, selectedRowKeys);
747
-
748
607
  if (!this._selectionIsControlled()) {
749
608
  this._adapter.setSelectedRowKeys(selectedRowKeys);
750
609
  }
751
-
752
610
  this._adapter.notifySelect(selectedRow, selected, selectedRows, e);
753
-
754
611
  this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
755
612
  }
756
613
  }
@@ -760,49 +617,35 @@ class TableFoundation extends BaseFoundation {
760
617
  * @param {*} selected The future state of the select all button
761
618
  * @param {*} e
762
619
  */
763
-
764
-
765
620
  handleSelectAllRow(selected, e) {
766
621
  this.stopPropagation(e);
767
-
768
622
  if (typeof selected === 'boolean') {
769
623
  const curSelectedRowKeys = this._getSelectedRowKeys();
770
-
771
624
  let selectedRowKeys = [...curSelectedRowKeys];
772
-
773
625
  const selectedRowKeysSet = this._getSelectedRowKeysSet();
774
-
775
626
  let allRowKeys = [...this._adapter.getCachedFilteredSortedRowKeys()];
776
-
777
627
  const disabledRowKeys = this._adapter.getAllDisabledRowKeys();
778
-
779
628
  const disabledRowKeysSet = this._adapter.getAllDisabledRowKeysSet();
780
-
781
- let changedRowKeys; // Select all, if not disabled && not in selectedRowKeys
782
-
629
+ let changedRowKeys;
630
+ // Select all, if not disabled && not in selectedRowKeys
783
631
  if (selected) {
784
632
  for (const key of allRowKeys) {
785
633
  if (!disabledRowKeysSet.has(key) && !selectedRowKeysSet.has(key)) {
786
634
  selectedRowKeys.push(key);
787
635
  }
788
636
  }
789
-
790
637
  allRowKeys = pullAll(allRowKeys, [...disabledRowKeys, ...curSelectedRowKeys]);
791
638
  changedRowKeys = [...allRowKeys];
792
639
  } else {
793
640
  selectedRowKeys = pullAll(selectedRowKeys, allRowKeys);
794
641
  changedRowKeys = [...curSelectedRowKeys];
795
642
  }
796
-
797
643
  const changedRows = this.getSelectedRows(null, changedRowKeys || []);
798
644
  const selectedRows = this.getSelectedRows(null, selectedRowKeys || []);
799
-
800
645
  if (!this._selectionIsControlled()) {
801
646
  this._adapter.setSelectedRowKeys(selectedRowKeys);
802
647
  }
803
-
804
648
  this._adapter.notifySelectAll(selected, selectedRows, changedRows, e);
805
-
806
649
  this._adapter.notifySelectionChange(selectedRowKeys, selectedRows);
807
650
  }
808
651
  }
@@ -812,27 +655,20 @@ class TableFoundation extends BaseFoundation {
812
655
  * @param {*} selectedRowKeys
813
656
  * @param {*} selectedRowKeysSet Recursive optimization
814
657
  */
815
-
816
-
817
658
  getSelectedRows(dataSource, selectedRowKeys, selectedRowKeysSet) {
818
659
  dataSource = dataSource == null ? this._getDataSource() : dataSource;
819
660
  selectedRowKeys = selectedRowKeys == null ? this._getSelectedRowKeys() : selectedRowKeys;
820
-
821
661
  if (!_isSet(selectedRowKeysSet)) {
822
662
  selectedRowKeysSet = new Set(selectedRowKeys);
823
663
  }
824
-
825
664
  const childrenRecordName = this.getProp('childrenRecordName');
826
665
  const selectedRows = [];
827
-
828
666
  if (_isSet(selectedRowKeysSet) && selectedRowKeysSet.size && Array.isArray(dataSource) && dataSource.length) {
829
667
  // Time complexity optimization, replace the includes operation of array with has of set
830
668
  selectedRows.push(...dataSource.filter(data => selectedRowKeysSet.has(this.getRecordKey(data))));
831
-
832
669
  if (selectedRows.length < selectedRowKeys.length) {
833
670
  for (const item of dataSource) {
834
671
  const children = _get(item, childrenRecordName);
835
-
836
672
  if (Array.isArray(children) && children.length) {
837
673
  const rows = this.getSelectedRows(children, selectedRowKeys, selectedRowKeysSet);
838
674
  selectedRows.push(...rows);
@@ -840,55 +676,42 @@ class TableFoundation extends BaseFoundation {
840
676
  }
841
677
  }
842
678
  }
843
-
844
679
  return selectedRows;
845
680
  }
846
-
847
681
  getAllDisabledRowKeys(dataSource, getCheckboxProps) {
848
682
  dataSource = dataSource == null ? this._getDataSource() : dataSource;
849
683
  getCheckboxProps = getCheckboxProps == null ? _get(this.getProp('rowSelection'), 'getCheckboxProps') : getCheckboxProps;
850
684
  const childrenRecordName = this.getProp('childrenRecordName');
851
685
  const disabledRowKeys = [];
852
-
853
686
  if (Array.isArray(dataSource) && dataSource.length && typeof getCheckboxProps === 'function') {
854
687
  for (const record of dataSource) {
855
688
  const props = getCheckboxProps(record);
856
-
857
689
  if (props && props.disabled) {
858
690
  disabledRowKeys.push(this.getRecordKey(record));
859
691
  }
860
-
861
692
  const children = _get(record, childrenRecordName);
862
-
863
693
  if (Array.isArray(children) && children.length) {
864
694
  const keys = this.getAllDisabledRowKeys(children, getCheckboxProps);
865
695
  disabledRowKeys.push(...keys);
866
696
  }
867
697
  }
868
698
  }
869
-
870
699
  return disabledRowKeys;
871
700
  }
872
-
873
701
  getAllRowKeys(dataSource) {
874
702
  dataSource = dataSource == null ? this._getDataSource() : dataSource;
875
703
  const childrenRecordName = this.getProp('childrenRecordName');
876
704
  const allRowKeys = [];
877
-
878
705
  if (Array.isArray(dataSource) && dataSource.length) {
879
706
  for (const record of dataSource) {
880
707
  const childrenRowKeys = [];
881
-
882
708
  const children = _get(record, childrenRecordName);
883
-
884
709
  if (Array.isArray(children) && children.length) {
885
710
  childrenRowKeys.push(...this.getAllRowKeys(children));
886
711
  }
887
-
888
712
  allRowKeys.push(this.getRecordKey(record), ...childrenRowKeys);
889
713
  }
890
714
  }
891
-
892
715
  return allRowKeys;
893
716
  }
894
717
  /**
@@ -896,8 +719,6 @@ class TableFoundation extends BaseFoundation {
896
719
  * @param {Array} selectedRowKeys
897
720
  * @param {Set} allRowKeysSet
898
721
  */
899
-
900
-
901
722
  hasRowSelected(selectedRowKeys, allRowKeysSet) {
902
723
  return Boolean(Array.isArray(selectedRowKeys) && selectedRowKeys.length && _isSet(allRowKeysSet) && allRowKeysSet.size && selectedRowKeys.filter(key => allRowKeysSet.has(key)).length);
903
724
  }
@@ -907,38 +728,31 @@ class TableFoundation extends BaseFoundation {
907
728
  * @param {String} realKey
908
729
  * @param {Event} domEvent
909
730
  */
910
-
911
-
912
731
  handleRowExpanded(expanded, realKey, domEvent) {
913
732
  this.stopPropagation(domEvent);
914
733
  const expandedRowKeys = [...this.getState('expandedRowKeys')];
915
734
  const index = expandedRowKeys.indexOf(realKey);
916
735
  const keyIsValid = typeof realKey === 'string' || typeof realKey === 'number';
917
-
918
736
  if (keyIsValid && expanded && index === -1) {
919
737
  expandedRowKeys.push(realKey);
920
738
  } else if (keyIsValid && !expanded && index > -1) {
921
739
  expandedRowKeys.splice(index, 1);
922
740
  }
923
-
924
741
  if (!this._rowExpansionIsControlled()) {
925
742
  this._adapter.setExpandedRowKeys(expandedRowKeys);
926
743
  }
927
-
928
744
  const expandedRows = this.getSelectedRows(null, expandedRowKeys);
929
- let expandedRow = this.getSelectedRows(null, [realKey])[0]; // groups record processing
930
-
745
+ let expandedRow = this.getSelectedRows(null, [realKey])[0];
746
+ // groups record processing
931
747
  const groups = this._getGroups();
932
-
933
748
  if (groups) {
934
749
  // Construct group expandRow
935
750
  if (groups.has(realKey)) {
936
751
  expandedRow = {
937
752
  groupKey: realKey
938
753
  };
939
- } // If expandedRowKeys includes groupKey, add to expandedRows
940
-
941
-
754
+ }
755
+ // If expandedRowKeys includes groupKey, add to expandedRows
942
756
  for (let i = 0, len = expandedRowKeys.length; i < len; i++) {
943
757
  if (groups.has(realKey)) {
944
758
  expandedRows.push({
@@ -947,26 +761,19 @@ class TableFoundation extends BaseFoundation {
947
761
  }
948
762
  }
949
763
  }
950
-
951
764
  this._adapter.notifyExpand(expanded, expandedRow, domEvent);
952
-
953
765
  this._adapter.notifyExpandedRowsChange(expandedRows);
954
766
  }
955
767
  /**
956
768
  * get state.groups
957
769
  * @returns {Map|Null}
958
770
  */
959
-
960
-
961
771
  _getGroups() {
962
772
  const groupBy = this._adapter.getProp('groupBy');
963
-
964
773
  if (groupBy !== null) {
965
774
  const groups = this._adapter.getState('groups');
966
-
967
775
  return groups;
968
776
  }
969
-
970
777
  return null;
971
778
  }
972
779
  /**
@@ -975,18 +782,14 @@ class TableFoundation extends BaseFoundation {
975
782
  * @param {Set} disabledRowKeysSet
976
783
  * @param {Array} allKeys keys after sorted and filtered
977
784
  */
978
-
979
-
980
785
  allIsSelected(selectedRowKeysSet, disabledRowKeysSet, allKeys) {
981
786
  const filteredAllKeys = _filter(allKeys, key => key != null && !disabledRowKeysSet.has(key));
982
-
983
787
  if (filteredAllKeys && filteredAllKeys.length) {
984
788
  for (const key of filteredAllKeys) {
985
789
  if (key != null && !selectedRowKeysSet.has(key)) {
986
790
  return false;
987
791
  }
988
792
  }
989
-
990
793
  return true;
991
794
  } else {
992
795
  return false;
@@ -997,25 +800,19 @@ class TableFoundation extends BaseFoundation {
997
800
  * @param {*} selectedRowKeys
998
801
  * @param {*} allKeys
999
802
  */
1000
-
1001
-
1002
803
  allIsNotSelected(selectedRowKeys, allKeys) {
1003
804
  for (const key of allKeys) {
1004
805
  if (key != null && Array.isArray(selectedRowKeys) && selectedRowKeys.includes(key)) {
1005
806
  return true;
1006
807
  }
1007
808
  }
1008
-
1009
809
  return false;
1010
810
  }
1011
-
1012
811
  formatPaginationInfo() {
1013
812
  let pagination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1014
813
  let defaultPageText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1015
814
  let info = '';
1016
-
1017
815
  const formatPageText = _get(this.getProp('pagination'), 'formatPageText');
1018
-
1019
816
  const {
1020
817
  total,
1021
818
  pageSize,
@@ -1023,7 +820,6 @@ class TableFoundation extends BaseFoundation {
1023
820
  } = pagination;
1024
821
  const currentStart = Math.min((currentPage - 1) * pageSize + 1, total);
1025
822
  const currentEnd = Math.min(currentPage * pageSize, total);
1026
-
1027
823
  if (formatPageText || formatPageText !== false && defaultPageText && total > 0) {
1028
824
  info = typeof formatPageText === 'function' ? formatPageText({
1029
825
  currentStart,
@@ -1031,24 +827,21 @@ class TableFoundation extends BaseFoundation {
1031
827
  total
1032
828
  }) : defaultPageText.replace('${currentStart}', currentStart).replace('${currentEnd}', currentEnd).replace('${total}', total);
1033
829
  }
1034
-
1035
830
  return info;
1036
831
  }
1037
-
1038
832
  toggleShowFilter(dataIndex, visible) {
1039
833
  let filterObj = this.getQuery(dataIndex);
1040
- const filterDropdownVisible = visible; // eslint-disable-next-line @typescript-eslint/no-unused-vars
1041
-
834
+ const filterDropdownVisible = visible;
835
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1042
836
  filterObj = Object.assign(Object.assign({}, filterObj), {
1043
837
  filterDropdownVisible
1044
838
  });
1045
-
1046
- if (!this._filterShowIsControlled()) {// this._adapter.setQuery({
839
+ if (!this._filterShowIsControlled()) {
840
+ // this._adapter.setQuery({
1047
841
  // ...filterObj,
1048
842
  // filterDropdownVisible,
1049
843
  // });
1050
844
  }
1051
-
1052
845
  this._adapter.notifyFilterDropdownVisibleChange(filterDropdownVisible, dataIndex);
1053
846
  }
1054
847
  /**
@@ -1056,8 +849,6 @@ class TableFoundation extends BaseFoundation {
1056
849
  * @param {*} dataIndex
1057
850
  * @param {*} data
1058
851
  */
1059
-
1060
-
1061
852
  handleFilterSelect(dataIndex) {
1062
853
  let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1063
854
  let query = this.getQuery(dataIndex);
@@ -1069,17 +860,12 @@ class TableFoundation extends BaseFoundation {
1069
860
  filteredValue
1070
861
  });
1071
862
  queries = mergeQueries(query, queries);
1072
-
1073
863
  const mergedQueries = this._mergeToQueries(query, null);
1074
-
1075
864
  const filters = this._getAllFilters(mergedQueries);
1076
-
1077
865
  if (!this._filterIsControlled(dataIndex)) {
1078
866
  this._adapter.setQueries(queries);
1079
-
1080
867
  this.handleClickFilterOrSorter(queries);
1081
868
  }
1082
-
1083
869
  this._notifyChange(null, filters);
1084
870
  }
1085
871
  /**
@@ -1087,8 +873,6 @@ class TableFoundation extends BaseFoundation {
1087
873
  * @param {*} column
1088
874
  * @param {*} e
1089
875
  */
1090
-
1091
-
1092
876
  handleSort() {
1093
877
  let column = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1094
878
  let e = arguments.length > 1 ? arguments[1] : undefined;
@@ -1099,17 +883,12 @@ class TableFoundation extends BaseFoundation {
1099
883
  let queries = this.getState('queries');
1100
884
  let curQuery = null;
1101
885
  queries = [...queries];
1102
-
1103
886
  _each(queries, (query, idx, arr) => {
1104
887
  if (query.sorter) {
1105
888
  const sorterObj = Object.assign({}, query);
1106
-
1107
889
  const stateSortOrder = _get(sorterObj, 'sortOrder');
1108
-
1109
890
  const defaultSortOrder = _get(sorterObj, 'defaultSortOrder', false);
1110
-
1111
891
  let querySortOrder = this.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
1112
-
1113
892
  if (dataIndex && dataIndex === sorterObj.dataIndex) {
1114
893
  if (querySortOrder === strings.SORT_DIRECTIONS[0]) {
1115
894
  querySortOrder = strings.SORT_DIRECTIONS[1];
@@ -1122,32 +901,25 @@ class TableFoundation extends BaseFoundation {
1122
901
  // This results in the current click only supports single column sorting
1123
902
  querySortOrder = false;
1124
903
  }
1125
-
1126
904
  arr[idx] = Object.assign(Object.assign({}, sorterObj), {
1127
905
  sortOrder: querySortOrder
1128
906
  });
1129
-
1130
907
  if (dataIndex === sorterObj.dataIndex) {
1131
908
  curQuery = arr[idx];
1132
909
  }
1133
910
  }
1134
911
  });
1135
-
1136
912
  if (!this._sorterIsControlled(dataIndex)) {
1137
913
  this._adapter.setQueries(queries);
1138
-
1139
914
  this.handleClickFilterOrSorter(queries);
1140
- } // notify sort event
1141
-
1142
-
915
+ }
916
+ // notify sort event
1143
917
  this._notifyChange(null, null, curQuery, null);
1144
918
  }
1145
919
  /**
1146
920
  * Recalculate the cached data after clicking filter or sorter
1147
921
  * @param {*} queries
1148
922
  */
1149
-
1150
-
1151
923
  handleClickFilterOrSorter(queries) {
1152
924
  const dataSource = [...this.getProp('dataSource')];
1153
925
  const sortedDataSource = this.getFilteredSortedDataSource(dataSource, queries);
@@ -1157,37 +929,27 @@ class TableFoundation extends BaseFoundation {
1157
929
  const pageData = this.getCurrentPageData(sortedDataSource);
1158
930
  this.setAdapterPageData(pageData);
1159
931
  }
1160
-
1161
932
  getQuery(dataIndex, queries) {
1162
933
  queries = queries || this.getState('queries');
1163
-
1164
934
  if (dataIndex != null) {
1165
935
  return _find(queries, query => query.dataIndex === dataIndex);
1166
936
  }
1167
-
1168
937
  return undefined;
1169
938
  }
1170
-
1171
939
  getCellWidths(flattenedColumns, flattenedWidths, ignoreScrollBarKey) {
1172
940
  return this._adapter.getCellWidths(flattenedColumns, flattenedWidths, ignoreScrollBarKey);
1173
941
  }
1174
-
1175
942
  setHeadWidths(headWidths, index) {
1176
943
  return this._adapter.setHeadWidths(headWidths, index);
1177
944
  }
1178
-
1179
945
  getHeadWidths(index) {
1180
946
  return this._adapter.getHeadWidths(index);
1181
947
  }
1182
-
1183
948
  mergedRowExpandable(record) {
1184
949
  return this._adapter.mergedRowExpandable(record);
1185
950
  }
1186
-
1187
951
  setBodyHasScrollbar(bodyHasScrollbar) {
1188
952
  this._adapter.setBodyHasScrollbar(bodyHasScrollbar);
1189
953
  }
1190
-
1191
954
  }
1192
-
1193
955
  export default TableFoundation;