@pinnacle0/web-ui 0.6.45 → 0.7.0-beta.1

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 (338) hide show
  1. package/admin/AdminApp/Default/NavigatorSide/index.js +1 -1
  2. package/admin/AdminApp/Default/NavigatorSide/index.js.map +1 -1
  3. package/core/Amount/AmountPercentage.d.ts +1 -4
  4. package/core/Amount/AmountPercentage.js +5 -8
  5. package/core/Amount/AmountPercentage.js.map +1 -1
  6. package/core/Amount/index.d.ts +3 -8
  7. package/core/Amount/index.js +27 -35
  8. package/core/Amount/index.js.map +1 -1
  9. package/core/AuthenticationCodeInput/index.less +1 -1
  10. package/core/AutoCompleteInput/index.d.ts +2 -5
  11. package/core/AutoCompleteInput/index.js +5 -7
  12. package/core/AutoCompleteInput/index.js.map +1 -1
  13. package/core/BoolSwitch/index.d.ts +5 -7
  14. package/core/BoolSwitch/index.js +11 -13
  15. package/core/BoolSwitch/index.js.map +1 -1
  16. package/core/Breadcrumb/index.d.ts +1 -5
  17. package/core/Breadcrumb/index.js +8 -16
  18. package/core/Breadcrumb/index.js.map +1 -1
  19. package/core/Button/index.d.ts +2 -2
  20. package/core/Button/index.js +3 -2
  21. package/core/Button/index.js.map +1 -1
  22. package/core/Card/index.d.ts +3 -6
  23. package/core/Card/index.js +4 -7
  24. package/core/Card/index.js.map +1 -1
  25. package/core/Carousel/index.d.ts +1 -4
  26. package/core/Carousel/index.js +4 -7
  27. package/core/Carousel/index.js.map +1 -1
  28. package/core/Carousel3D/index.d.ts +1 -21
  29. package/core/Carousel3D/index.js +76 -83
  30. package/core/Carousel3D/index.js.map +1 -1
  31. package/core/Cascader/InitialNullable.d.ts +1 -4
  32. package/core/Cascader/InitialNullable.js +5 -8
  33. package/core/Cascader/InitialNullable.js.map +1 -1
  34. package/core/Cascader/Nullable.d.ts +2 -7
  35. package/core/Cascader/Nullable.js +10 -12
  36. package/core/Cascader/Nullable.js.map +1 -1
  37. package/core/Cascader/index.d.ts +4 -13
  38. package/core/Cascader/index.js +18 -20
  39. package/core/Cascader/index.js.map +1 -1
  40. package/core/Checkbox/index.d.ts +4 -7
  41. package/core/Checkbox/index.js +4 -9
  42. package/core/Checkbox/index.js.map +1 -1
  43. package/core/Collapse/index.d.ts +2 -7
  44. package/core/Collapse/index.js +4 -6
  45. package/core/Collapse/index.js.map +1 -1
  46. package/core/Countdown/SlidingDigit.d.ts +1 -10
  47. package/core/Countdown/SlidingDigit.js +16 -21
  48. package/core/Countdown/SlidingDigit.js.map +1 -1
  49. package/core/Countdown/index.d.ts +1 -18
  50. package/core/Countdown/index.js +53 -74
  51. package/core/Countdown/index.js.map +1 -1
  52. package/core/DarkOverlay/index.d.ts +1 -4
  53. package/core/DarkOverlay/index.js +4 -7
  54. package/core/DarkOverlay/index.js.map +1 -1
  55. package/core/DateCalendar/index.d.ts +2 -13
  56. package/core/DateCalendar/index.js +12 -14
  57. package/core/DateCalendar/index.js.map +1 -1
  58. package/core/DatePicker/index.d.ts +1 -7
  59. package/core/DatePicker/index.js +9 -16
  60. package/core/DatePicker/index.js.map +1 -1
  61. package/core/DateRangePicker/index.d.ts +1 -14
  62. package/core/DateRangePicker/index.js +25 -34
  63. package/core/DateRangePicker/index.js.map +1 -1
  64. package/core/DateTimePicker/index.d.ts +1 -7
  65. package/core/DateTimePicker/index.js +12 -21
  66. package/core/DateTimePicker/index.js.map +1 -1
  67. package/core/DateTimeRangePicker/index.d.ts +1 -17
  68. package/core/DateTimeRangePicker/index.js +21 -31
  69. package/core/DateTimeRangePicker/index.js.map +1 -1
  70. package/core/Descriptions/index.d.ts +3 -8
  71. package/core/Descriptions/index.js +7 -13
  72. package/core/Descriptions/index.js.map +1 -1
  73. package/core/Descriptions/index.less +0 -8
  74. package/core/DocumentTitle/index.d.ts +4 -13
  75. package/core/DocumentTitle/index.js +18 -31
  76. package/core/DocumentTitle/index.js.map +1 -1
  77. package/core/Drawer/index.d.ts +1 -3
  78. package/core/Drawer/index.js +4 -5
  79. package/core/Drawer/index.js.map +1 -1
  80. package/core/Dropdown/index.d.ts +3 -4
  81. package/core/Dropdown/index.js +4 -3
  82. package/core/Dropdown/index.js.map +1 -1
  83. package/core/EnumCheckboxGroup/Map.d.ts +1 -4
  84. package/core/EnumCheckboxGroup/Map.js +5 -9
  85. package/core/EnumCheckboxGroup/Map.js.map +1 -1
  86. package/core/EnumCheckboxGroup/index.d.ts +3 -4
  87. package/core/EnumCheckboxGroup/index.js +11 -12
  88. package/core/EnumCheckboxGroup/index.js.map +1 -1
  89. package/core/EnumRadio/InitialNullable.d.ts +1 -5
  90. package/core/EnumRadio/InitialNullable.js +6 -9
  91. package/core/EnumRadio/InitialNullable.js.map +1 -1
  92. package/core/EnumRadio/Map.d.ts +1 -4
  93. package/core/EnumRadio/Map.js +6 -9
  94. package/core/EnumRadio/Map.js.map +1 -1
  95. package/core/EnumRadio/Nullable.d.ts +1 -5
  96. package/core/EnumRadio/Nullable.js +12 -14
  97. package/core/EnumRadio/Nullable.js.map +1 -1
  98. package/core/EnumRadio/index.d.ts +5 -12
  99. package/core/EnumRadio/index.js +9 -17
  100. package/core/EnumRadio/index.js.map +1 -1
  101. package/core/EnumSelect/InitialNullable.d.ts +1 -4
  102. package/core/EnumSelect/InitialNullable.js +4 -8
  103. package/core/EnumSelect/InitialNullable.js.map +1 -1
  104. package/core/EnumSelect/Map.d.ts +1 -4
  105. package/core/EnumSelect/Map.js +6 -9
  106. package/core/EnumSelect/Map.js.map +1 -1
  107. package/core/EnumSelect/Nullable.d.ts +1 -5
  108. package/core/EnumSelect/Nullable.js +12 -14
  109. package/core/EnumSelect/Nullable.js.map +1 -1
  110. package/core/EnumSelect/index.d.ts +5 -15
  111. package/core/EnumSelect/index.js +19 -27
  112. package/core/EnumSelect/index.js.map +1 -1
  113. package/core/EnumSelect/index.less +1 -1
  114. package/core/FlatList/Content/Footer/index.js +3 -2
  115. package/core/FlatList/Content/Footer/index.js.map +1 -1
  116. package/core/FlatList/Content/index.d.ts +1 -1
  117. package/core/FlatList/Content/index.js +10 -8
  118. package/core/FlatList/Content/index.js.map +1 -1
  119. package/core/FlatList/FloatingLoader/index.js +3 -2
  120. package/core/FlatList/FloatingLoader/index.js.map +1 -1
  121. package/core/FlatList/Refresh/index.js +3 -2
  122. package/core/FlatList/Refresh/index.js.map +1 -1
  123. package/core/FlatList/index.d.ts +1 -1
  124. package/core/FlatList/index.js +10 -9
  125. package/core/FlatList/index.js.map +1 -1
  126. package/core/FlatList/shared/Loader/index.js +3 -2
  127. package/core/FlatList/shared/Loader/index.js.map +1 -1
  128. package/core/Form/Item.d.ts +1 -16
  129. package/core/Form/Item.js +28 -40
  130. package/core/Form/Item.js.map +1 -1
  131. package/core/Form/index.d.ts +6 -17
  132. package/core/Form/index.js +29 -46
  133. package/core/Form/index.js.map +1 -1
  134. package/core/Form/index.less +1 -1
  135. package/core/Grid/index.d.ts +2 -2
  136. package/core/Grid/index.js +2 -1
  137. package/core/Grid/index.js.map +1 -1
  138. package/core/HTMLContent/index.d.ts +1 -4
  139. package/core/HTMLContent/index.js +4 -7
  140. package/core/HTMLContent/index.js.map +1 -1
  141. package/core/Image/index.d.ts +3 -6
  142. package/core/Image/index.js +6 -7
  143. package/core/Image/index.js.map +1 -1
  144. package/core/ImageUploader/index.d.ts +2 -11
  145. package/core/ImageUploader/index.js +17 -25
  146. package/core/ImageUploader/index.js.map +1 -1
  147. package/core/Input/index.d.ts +12 -18
  148. package/core/Input/index.js +37 -41
  149. package/core/Input/index.js.map +1 -1
  150. package/core/LabelledSelect/index.d.ts +3 -5
  151. package/core/LabelledSelect/index.js +4 -7
  152. package/core/LabelledSelect/index.js.map +1 -1
  153. package/core/Link/index.d.ts +1 -4
  154. package/core/Link/index.js +16 -19
  155. package/core/Link/index.js.map +1 -1
  156. package/core/LocalImporter/index.d.ts +1 -10
  157. package/core/LocalImporter/index.js +11 -18
  158. package/core/LocalImporter/index.js.map +1 -1
  159. package/core/LocaleSelect/index.d.ts +1 -10
  160. package/core/LocaleSelect/index.js +16 -18
  161. package/core/LocaleSelect/index.js.map +1 -1
  162. package/core/Markdown/index.d.ts +1 -7
  163. package/core/Markdown/index.js +13 -16
  164. package/core/Markdown/index.js.map +1 -1
  165. package/core/Modal/index.less +1 -1
  166. package/core/MultipleCascader/index.d.ts +1 -9
  167. package/core/MultipleCascader/index.js +15 -19
  168. package/core/MultipleCascader/index.js.map +1 -1
  169. package/core/MultipleEnumSelect/index.d.ts +1 -8
  170. package/core/MultipleEnumSelect/index.js +9 -15
  171. package/core/MultipleEnumSelect/index.js.map +1 -1
  172. package/core/MultipleSelector/TablePopover.d.ts +1 -7
  173. package/core/MultipleSelector/TablePopover.js +23 -26
  174. package/core/MultipleSelector/TablePopover.js.map +1 -1
  175. package/core/MultipleSelector/index.d.ts +1 -9
  176. package/core/MultipleSelector/index.js +18 -26
  177. package/core/MultipleSelector/index.js.map +1 -1
  178. package/core/MutableTable/index.d.ts +1 -13
  179. package/core/MutableTable/index.js +25 -35
  180. package/core/MutableTable/index.js.map +1 -1
  181. package/core/NumberInput/NumberInputPercentage.d.ts +1 -8
  182. package/core/NumberInput/NumberInputPercentage.js +8 -25
  183. package/core/NumberInput/NumberInputPercentage.js.map +1 -1
  184. package/core/NumberInput/index.d.ts +5 -33
  185. package/core/NumberInput/index.js +44 -72
  186. package/core/NumberInput/index.js.map +1 -1
  187. package/core/OverflowableText/index.d.ts +1 -12
  188. package/core/OverflowableText/index.js +11 -28
  189. package/core/OverflowableText/index.js.map +1 -1
  190. package/core/Pagination/index.d.ts +1 -7
  191. package/core/Pagination/index.js +17 -19
  192. package/core/Pagination/index.js.map +1 -1
  193. package/core/Popover/index.d.ts +0 -1
  194. package/core/Popover/index.js +2 -5
  195. package/core/Popover/index.js.map +1 -1
  196. package/core/Progress/index.d.ts +1 -4
  197. package/core/Progress/index.js +4 -6
  198. package/core/Progress/index.js.map +1 -1
  199. package/core/Radio/index.d.ts +5 -7
  200. package/core/Radio/index.js +2 -8
  201. package/core/Radio/index.js.map +1 -1
  202. package/core/RelativeTime/index.d.ts +1 -15
  203. package/core/RelativeTime/index.js +17 -31
  204. package/core/RelativeTime/index.js.map +1 -1
  205. package/core/Resizable/index.js +3 -2
  206. package/core/Resizable/index.js.map +1 -1
  207. package/core/SearchableSelect/index.d.ts +3 -5
  208. package/core/SearchableSelect/index.js +4 -7
  209. package/core/SearchableSelect/index.js.map +1 -1
  210. package/core/Select/index.d.ts +8 -7
  211. package/core/Select/index.js +8 -8
  212. package/core/Select/index.js.map +1 -1
  213. package/core/SignedAmountInput/index.d.ts +1 -8
  214. package/core/SignedAmountInput/index.js +16 -24
  215. package/core/SignedAmountInput/index.js.map +1 -1
  216. package/core/Skeleton/index.d.ts +1 -4
  217. package/core/Skeleton/index.js +4 -7
  218. package/core/Skeleton/index.js.map +1 -1
  219. package/core/Slider/RangeSlider.d.ts +2 -6
  220. package/core/Slider/RangeSlider.js +4 -7
  221. package/core/Slider/RangeSlider.js.map +1 -1
  222. package/core/Slider/index.d.ts +3 -7
  223. package/core/Slider/index.js +15 -20
  224. package/core/Slider/index.js.map +1 -1
  225. package/core/Space/index.d.ts +3 -5
  226. package/core/Space/index.js +4 -7
  227. package/core/Space/index.js.map +1 -1
  228. package/core/Spin/index.d.ts +3 -6
  229. package/core/Spin/index.js +4 -7
  230. package/core/Spin/index.js.map +1 -1
  231. package/core/StepFormContainer/index.d.ts +2 -7
  232. package/core/StepFormContainer/index.js +13 -17
  233. package/core/StepFormContainer/index.js.map +1 -1
  234. package/core/Steps/index.d.ts +3 -6
  235. package/core/Steps/index.js +4 -6
  236. package/core/Steps/index.js.map +1 -1
  237. package/core/Table/index.d.ts +6 -34
  238. package/core/Table/index.js +64 -80
  239. package/core/Table/index.js.map +1 -1
  240. package/core/Tabs/Single.d.ts +1 -4
  241. package/core/Tabs/Single.js +4 -7
  242. package/core/Tabs/Single.js.map +1 -1
  243. package/core/Tabs/index.d.ts +3 -13
  244. package/core/Tabs/index.js +27 -35
  245. package/core/Tabs/index.js.map +1 -1
  246. package/core/Tag/index.d.ts +2 -5
  247. package/core/Tag/index.js +4 -6
  248. package/core/Tag/index.js.map +1 -1
  249. package/core/TagInput/index.d.ts +2 -15
  250. package/core/TagInput/index.js +25 -41
  251. package/core/TagInput/index.js.map +1 -1
  252. package/core/Tags/index.d.ts +1 -6
  253. package/core/Tags/index.js +9 -13
  254. package/core/Tags/index.js.map +1 -1
  255. package/core/TimePicker/index.d.ts +1 -7
  256. package/core/TimePicker/index.js +8 -11
  257. package/core/TimePicker/index.js.map +1 -1
  258. package/core/TimeRangePicker/index.d.ts +1 -14
  259. package/core/TimeRangePicker/index.js +21 -27
  260. package/core/TimeRangePicker/index.js.map +1 -1
  261. package/core/Tooltip/index.d.ts +3 -4
  262. package/core/Tooltip/index.js +2 -5
  263. package/core/Tooltip/index.js.map +1 -1
  264. package/core/TypedTabs/index.d.ts +1 -4
  265. package/core/TypedTabs/index.js +16 -18
  266. package/core/TypedTabs/index.js.map +1 -1
  267. package/core/Uploader/index.d.ts +1 -17
  268. package/core/Uploader/index.js +25 -31
  269. package/core/Uploader/index.js.map +1 -1
  270. package/core/VirtualList/index.d.ts +1 -1
  271. package/core/VirtualList/index.js +3 -2
  272. package/core/VirtualList/index.js.map +1 -1
  273. package/core/VirtualTable/{TableHeader.js → OldVirtualTable/TableHeader.js} +2 -2
  274. package/core/VirtualTable/OldVirtualTable/TableHeader.js.map +1 -0
  275. package/core/VirtualTable/{TableRow.js → OldVirtualTable/TableRow.js} +2 -2
  276. package/core/VirtualTable/OldVirtualTable/TableRow.js.map +1 -0
  277. package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnWidths.js +1 -1
  278. package/core/VirtualTable/OldVirtualTable/hooks/useColumnWidths.js.map +1 -0
  279. package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnsStickyPosition.js +1 -1
  280. package/core/VirtualTable/OldVirtualTable/hooks/useColumnsStickyPosition.js.map +1 -0
  281. package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useRowSelection.d.ts +1 -1
  282. package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useRowSelection.js +2 -2
  283. package/core/VirtualTable/OldVirtualTable/hooks/useRowSelection.js.map +1 -0
  284. package/core/VirtualTable/OldVirtualTable/hooks/useScroll.js.map +1 -0
  285. package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScrollBarSize.js +1 -1
  286. package/core/VirtualTable/OldVirtualTable/hooks/useScrollBarSize.js.map +1 -0
  287. package/core/VirtualTable/OldVirtualTable/index.d.ts +28 -0
  288. package/core/VirtualTable/OldVirtualTable/index.js +58 -0
  289. package/core/VirtualTable/OldVirtualTable/index.js.map +1 -0
  290. package/core/VirtualTable/OldVirtualTable/index.old.less +160 -0
  291. package/core/VirtualTable/OldVirtualTable/type.js.map +1 -0
  292. package/core/VirtualTable/index.d.ts +24 -23
  293. package/core/VirtualTable/index.js +54 -50
  294. package/core/VirtualTable/index.js.map +1 -1
  295. package/core/VirtualTable/index.less +28 -140
  296. package/core/WithExplanation/index.d.ts +1 -6
  297. package/core/WithExplanation/index.js +11 -20
  298. package/core/WithExplanation/index.js.map +1 -1
  299. package/core/WithTooltipList/index.d.ts +1 -9
  300. package/core/WithTooltipList/index.js +28 -27
  301. package/core/WithTooltipList/index.js.map +1 -1
  302. package/core/YearMonthSelector/index.d.ts +1 -7
  303. package/core/YearMonthSelector/index.js +9 -15
  304. package/core/YearMonthSelector/index.js.map +1 -1
  305. package/css/global.less +0 -9
  306. package/hooks/useParentResizeObserver/index.d.ts +2 -0
  307. package/hooks/useParentResizeObserver/index.js +17 -0
  308. package/hooks/useParentResizeObserver/index.js.map +1 -0
  309. package/hooks/useResizeObserver/index.d.ts +1 -1
  310. package/hooks/useResizeObserver/index.js +6 -10
  311. package/hooks/useResizeObserver/index.js.map +1 -1
  312. package/package.json +9 -9
  313. package/util/ModalUtil/index.less +1 -1
  314. package/util/PromptUtil/PromptBody.d.ts +4 -13
  315. package/util/PromptUtil/PromptBody.js +19 -28
  316. package/util/PromptUtil/PromptBody.js.map +1 -1
  317. package/util/PromptUtil/index.js +1 -1
  318. package/util/PromptUtil/index.js.map +1 -1
  319. package/util/ReactUtil/index.d.ts +20 -0
  320. package/util/ReactUtil/index.js +35 -0
  321. package/util/ReactUtil/index.js.map +1 -1
  322. package/core/VirtualTable/TableHeader.js.map +0 -1
  323. package/core/VirtualTable/TableRow.js.map +0 -1
  324. package/core/VirtualTable/hooks/useColumnWidths.js.map +0 -1
  325. package/core/VirtualTable/hooks/useColumnsStickyPosition.js.map +0 -1
  326. package/core/VirtualTable/hooks/useRowSelection.js.map +0 -1
  327. package/core/VirtualTable/hooks/useScroll.js.map +0 -1
  328. package/core/VirtualTable/hooks/useScrollBarSize.js.map +0 -1
  329. package/core/VirtualTable/type.js.map +0 -1
  330. /package/core/VirtualTable/{TableHeader.d.ts → OldVirtualTable/TableHeader.d.ts} +0 -0
  331. /package/core/VirtualTable/{TableRow.d.ts → OldVirtualTable/TableRow.d.ts} +0 -0
  332. /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnWidths.d.ts +0 -0
  333. /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnsStickyPosition.d.ts +0 -0
  334. /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScroll.d.ts +0 -0
  335. /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScroll.js +0 -0
  336. /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScrollBarSize.d.ts +0 -0
  337. /package/core/VirtualTable/{type.d.ts → OldVirtualTable/type.d.ts} +0 -0
  338. /package/core/VirtualTable/{type.js → OldVirtualTable/type.js} +0 -0
@@ -2,16 +2,20 @@ import React from "react";
2
2
  import dayjs from "dayjs";
3
3
  import DatePicker from "antd/es/date-picker";
4
4
  import "./index.less";
5
- export class DateTimeRangePicker extends React.PureComponent {
6
- static displayName = "DateTimeRangePicker";
7
- static showTime = {
8
- defaultValue: [dayjs().startOf("day"), dayjs().endOf("day")],
9
- };
10
- constructor(props) {
11
- super(props);
12
- this.state = { shouldCheckDateRangeValid: false };
13
- }
14
- isDateDisabled = (current) => {
5
+ import { ReactUtil } from "../../util/ReactUtil";
6
+ export const DateTimeRangePicker = ReactUtil.memo("DateTimeRangePicker", (props) => {
7
+ const { value, allowNull, disabled, className, presets, showSecond, preserveInvalidOnBlur = true, disabledRange, onChange } = props;
8
+ const [shouldCheckDateRangeValid, setShouldCheckDateRangeValid] = React.useState(false);
9
+ React.useEffect(() => {
10
+ if (shouldCheckDateRangeValid && value[0] && value[1]) {
11
+ const typedOnChange = onChange;
12
+ if (dayjs(value[0]).isAfter(dayjs(value[1]))) {
13
+ typedOnChange([value[1], value[0]]);
14
+ }
15
+ setShouldCheckDateRangeValid(false);
16
+ }
17
+ }, [shouldCheckDateRangeValid, value, onChange]);
18
+ const isDateDisabled = (current) => {
15
19
  if (!current)
16
20
  return false;
17
21
  /**
@@ -22,10 +26,10 @@ export class DateTimeRangePicker extends React.PureComponent {
22
26
  if (current.valueOf() >= new Date(2038, 0).valueOf())
23
27
  return true;
24
28
  const diffToToday = Math.floor(current.diff(dayjs().startOf("day"), "day", true));
25
- return this.props.disabledRange?.(diffToToday, current.toDate()) || false;
29
+ return disabledRange?.(diffToToday, current.toDate()) || false;
26
30
  };
27
- onChange = (dates) => {
28
- const typedOnChange = this.props.onChange;
31
+ const onAntChange = (dates) => {
32
+ const typedOnChange = onChange;
29
33
  if (dates) {
30
34
  // need manually reset the min/max millisecond
31
35
  // otherwise, from/to will use now's millisecond value, which is inaccurate
@@ -39,23 +43,9 @@ export class DateTimeRangePicker extends React.PureComponent {
39
43
  typedOnChange([null, null]);
40
44
  }
41
45
  };
42
- onOpenChange = (open) => {
43
- this.setState({ shouldCheckDateRangeValid: !open });
46
+ const onOpenChange = (open) => {
47
+ setShouldCheckDateRangeValid(!open);
44
48
  };
45
- componentDidUpdate() {
46
- if (this.state.shouldCheckDateRangeValid && this.props.value[0] && this.props.value[1]) {
47
- const dates = this.props.value;
48
- const typedOnChange = this.props.onChange;
49
- if (dayjs(dates[0]).isAfter(dayjs(dates[1]))) {
50
- typedOnChange([dates[1], dates[0]]);
51
- }
52
- this.setState({ shouldCheckDateRangeValid: false });
53
- }
54
- }
55
- render() {
56
- const { value, allowNull, disabled, className, presets, showSecond, preserveInvalidOnBlur = true } = this.props;
57
- const parsedValue = [value[0] ? dayjs(value[0]) : null, value[1] ? dayjs(value[1]) : null];
58
- return (React.createElement(DatePicker.RangePicker, { className: className, value: parsedValue, onCalendarChange: this.onChange, disabledDate: this.isDateDisabled, allowClear: allowNull, disabled: disabled, presets: presets, showTime: DateTimeRangePicker.showTime, showSecond: showSecond, preserveInvalidOnBlur: preserveInvalidOnBlur, onOpenChange: this.onOpenChange, needConfirm: false }));
59
- }
60
- }
49
+ return (React.createElement(DatePicker.RangePicker, { className: className, value: [value[0] ? dayjs(value[0]) : null, value[1] ? dayjs(value[1]) : null], onCalendarChange: onAntChange, disabledDate: isDateDisabled, allowClear: allowNull, disabled: disabled, presets: presets, showTime: { defaultValue: [dayjs().startOf("day"), dayjs().endOf("day")] }, showSecond: showSecond, preserveInvalidOnBlur: preserveInvalidOnBlur, onOpenChange: onOpenChange, needConfirm: false }));
50
+ });
61
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateTimeRangePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAG7C,OAAO,cAAc,CAAC;AAgBtB,MAAM,OAAO,mBAAuC,SAAQ,KAAK,CAAC,aAA8B;IAC5F,MAAM,CAAC,WAAW,GAAG,qBAAqB,CAAC;IAC3C,MAAM,CAAC,QAAQ,GAAG;QACd,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,KAA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,EACxE,UAAU,EAAE,UAAU,EACtB,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,KAAK,GACpB,CACL,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import React from "react";
2
- import type { PickOptional } from "../../internal/type";
3
2
  import "./index.less";
4
3
  export interface Props {
5
4
  children: React.ReactNode;
@@ -17,10 +16,6 @@ export interface DescriptionsItemProps {
17
16
  style?: React.CSSProperties;
18
17
  span?: number;
19
18
  }
20
- export declare class Descriptions extends React.PureComponent<Props> {
21
- static defaultProps: PickOptional<Props>;
22
- static displayName: string;
23
- static Item: (props: DescriptionsItemProps) => React.JSX.Element;
24
- private readonly containerStyle;
25
- render(): React.JSX.Element;
26
- }
19
+ export declare const Descriptions: ((props: Props) => React.JSX.Element) & {
20
+ Item: (props: DescriptionsItemProps) => React.JSX.Element;
21
+ };
@@ -1,17 +1,11 @@
1
1
  import React from "react";
2
2
  import AntDescriptions from "antd/es/descriptions";
3
3
  import "./index.less";
4
- export class Descriptions extends React.PureComponent {
5
- static defaultProps = {
6
- bordered: true,
7
- };
8
- static displayName = "Descriptions";
9
- static Item = (props) => React.createElement(AntDescriptions.Item, { ...props });
10
- containerStyle = { marginBottom: 15 };
11
- render() {
12
- const { horizontal, column, title, children, className, style, bordered } = this.props;
13
- const columnCount = column || React.Children.count(children);
14
- return (React.createElement(AntDescriptions, { style: { ...this.containerStyle, ...style }, className: className, layout: horizontal ? "horizontal" : "vertical", bordered: bordered, title: title, column: columnCount }, children));
15
- }
16
- }
4
+ import { ReactUtil } from "../../util/ReactUtil";
5
+ const containerStyle = { marginBottom: 15 };
6
+ export const Descriptions = ReactUtil.compound("Descriptions", { Item: (props) => React.createElement(AntDescriptions.Item, { ...props }) }, (props) => {
7
+ const { horizontal, column, title, children, className, style, bordered = true } = props;
8
+ const columnCount = column || React.Children.count(children);
9
+ return (React.createElement(AntDescriptions, { style: { ...containerStyle, ...style }, className: className, layout: horizontal ? "horizontal" : "vertical", bordered: bordered, title: title, column: columnCount }, children));
10
+ });
17
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Descriptions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD,OAAO,cAAc,CAAC;AAoBtB,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAoB;IACxD,MAAM,CAAC,YAAY,GAAwB;QACvC,QAAQ,EAAE,IAAI;KACjB,CAAC;IAEF,MAAM,CAAC,WAAW,GAAG,cAAc,CAAC;IAEpC,MAAM,CAAC,IAAI,GAAG,CAAC,KAA4B,EAAE,EAAE,CAAC,oBAAC,eAAe,CAAC,IAAI,OAAK,KAAK,GAAI,CAAC;IAEnE,cAAc,GAAwB,EAAC,YAAY,EAAE,EAAE,EAAC,CAAC;IAE1E,MAAM;QACF,MAAM,EAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACrF,MAAM,WAAW,GAAG,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7D,OAAO,CACH,oBAAC,eAAe,IAAC,KAAK,EAAE,EAAC,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,KAAK,EAAC,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,IAClL,QAAQ,CACK,CACrB,CAAC;IACN,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Descriptions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAoB/C,MAAM,cAAc,GAAwB,EAAC,YAAY,EAAE,EAAE,EAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAC,IAAI,EAAE,CAAC,KAA4B,EAAE,EAAE,CAAC,oBAAC,eAAe,CAAC,IAAI,OAAK,KAAK,GAAI,EAAC,EAAE,CAAC,KAAY,EAAE,EAAE;IAC3J,MAAM,EAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAC,GAAG,KAAK,CAAC;IACvF,MAAM,WAAW,GAAG,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,OAAO,CACH,oBAAC,eAAe,IAAC,KAAK,EAAE,EAAC,GAAG,cAAc,EAAE,GAAG,KAAK,EAAC,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,IAC7K,QAAQ,CACK,CACrB,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1,21 +1,13 @@
1
1
  .ant-descriptions {
2
- padding: 0;
3
-
4
2
  .ant-descriptions-title {
5
- font-size: 24px;
6
3
  margin-bottom: 12px;
7
- color: #777;
8
4
  }
9
5
 
10
6
  .ant-descriptions-item-label {
11
- padding: 8px 10px;
12
7
  width: 120px;
13
- text-align: left;
14
8
  }
15
9
 
16
10
  .ant-descriptions-item-content {
17
- padding: 8px 10px;
18
11
  position: relative;
19
- color: inherit;
20
12
  }
21
13
  }
@@ -13,16 +13,7 @@ interface BaseOption {
13
13
  baseTitle: string;
14
14
  separator: string;
15
15
  }
16
- export declare class DocumentTitle extends React.PureComponent<Props> {
17
- static displayName: string;
18
- static baseOption: BaseOption;
19
- static register: <K extends keyof BaseOption>(option: Pick<BaseOption, K> | BaseOption) => BaseOption | (BaseOption & Pick<BaseOption, K>);
20
- private readonly prevTitle;
21
- constructor(props: Props);
22
- componentDidMount(): void;
23
- componentDidUpdate(prevProps: Readonly<Props>): void;
24
- componentWillUnmount(): void;
25
- updateTitle: () => void;
26
- render(): React.ReactNode;
27
- }
28
- export {};
16
+ declare const DocumentTitle: (({ title, children }: Props) => React.ReactNode) & {
17
+ register: <K extends keyof BaseOption>(option: Pick<BaseOption, K> | BaseOption) => BaseOption | (BaseOption & Pick<BaseOption, K>);
18
+ };
19
+ export { DocumentTitle };
@@ -1,35 +1,22 @@
1
1
  import React from "react";
2
- export class DocumentTitle extends React.PureComponent {
3
- static displayName = "DocumentTitle";
4
- static baseOption = {
5
- baseTitle: "<Document Title Unset>",
6
- separator: "-",
7
- };
8
- static register = (option) => Object.assign(DocumentTitle.baseOption, option);
9
- prevTitle;
10
- constructor(props) {
11
- super(props);
12
- this.prevTitle = document.title;
13
- }
14
- componentDidMount() {
15
- this.updateTitle();
16
- }
17
- componentDidUpdate(prevProps) {
18
- if (prevProps.title !== this.props.title) {
19
- this.updateTitle();
20
- }
21
- }
22
- componentWillUnmount() {
23
- document.title = this.prevTitle;
24
- }
25
- updateTitle = () => {
26
- const { title } = this.props;
27
- const { baseTitle, separator } = DocumentTitle.baseOption;
2
+ import { ReactUtil } from "../../util/ReactUtil";
3
+ import { useWillUnmountEffect } from "../../hooks/useWillUnmountEffect";
4
+ const baseOption = {
5
+ baseTitle: "<Document Title Unset>",
6
+ separator: "-",
7
+ };
8
+ const InternalDocumentTitle = ReactUtil.memo("DocumentTitle", ({ title, children }) => {
9
+ const prevTitle = React.useRef(document.title);
10
+ React.useEffect(() => {
11
+ const { baseTitle, separator } = baseOption;
28
12
  const fullTitle = title ? `${baseTitle} ${separator} ${title}` : baseTitle;
29
13
  document.title = fullTitle;
30
- };
31
- render() {
32
- return this.props.children;
33
- }
34
- }
14
+ }, [title]);
15
+ useWillUnmountEffect(() => {
16
+ document.title = prevTitle.current;
17
+ });
18
+ return children;
19
+ });
20
+ const DocumentTitle = Object.assign(InternalDocumentTitle, { register: (option) => Object.assign(baseOption, option) });
21
+ export { DocumentTitle };
35
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DocumentTitle/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,aAAoB;IACzD,MAAM,CAAC,WAAW,GAAG,eAAe,CAAC;IACrC,MAAM,CAAC,UAAU,GAAe;QAC5B,SAAS,EAAE,wBAAwB;QACnC,SAAS,EAAE,GAAG;KACjB,CAAC;IACF,MAAM,CAAC,QAAQ,GAAG,CAA6B,MAAwC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE3H,SAAS,CAAS;IAEnC,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;IACpC,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED,kBAAkB,CAAC,SAA0B;QACzC,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACvC,IAAI,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAED,oBAAoB;QAChB,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;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AK,CAAC,CAAC,CAAC;IAEZ,oBAAoB,CAAC,GAAG,EAAE;QACtB,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,EAAC,QAAQ,EAAE,CAA6B,MAAwC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,EAAC,CAAC,CAAC;AAEpL,OAAO,EAAC,aAAa,EAAC,CAAC"}
@@ -2,7 +2,5 @@ import React from "react";
2
2
  import type { DrawerProps, PushState } from "antd/es/drawer";
3
3
  export interface Props extends DrawerProps {
4
4
  }
5
- export declare class Drawer extends React.PureComponent<Props> {
6
- render(): React.JSX.Element;
7
- }
8
5
  export type { PushState };
6
+ export declare const Drawer: ({ ...props }: Props) => React.JSX.Element;
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
2
  import AntdDrawer from "antd/es/drawer";
3
- export class Drawer extends React.PureComponent {
4
- render() {
5
- return React.createElement(AntdDrawer, { ...this.props });
6
- }
7
- }
3
+ import { ReactUtil } from "../../util/ReactUtil";
4
+ export const Drawer = ReactUtil.memo("Drawer", ({ ...props }) => {
5
+ return React.createElement(AntdDrawer, { ...props });
6
+ });
8
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Drawer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,gBAAgB,CAAC;AAKxC,MAAM,OAAO,MAAO,SAAQ,KAAK,CAAC,aAAoB;IAClD,MAAM;QACF,OAAO,oBAAC,UAAU,OAAK,IAAI,CAAC,KAAK,GAAI,CAAC;IAC1C,CAAC;CACJ"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Drawer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAK/C,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAC,GAAG,KAAK,EAAQ,EAAE,EAAE;IACjE,OAAO,oBAAC,UAAU,OAAK,KAAK,GAAI,CAAC;AACrC,CAAC,CAAC,CAAC"}
@@ -1,8 +1,7 @@
1
- import AntdDropdown from "antd/es/dropdown";
2
1
  import type { DropdownProps } from "antd/es/dropdown";
3
2
  export type { DropdownButtonProps, DropdownButtonType } from "antd/es/dropdown";
4
3
  export interface Props extends DropdownProps {
5
4
  }
6
- export declare class Dropdown {
7
- static Button: typeof AntdDropdown.Button;
8
- }
5
+ export declare const Dropdown: {
6
+ Button: import("react").FC<import("antd/es/dropdown").DropdownButtonProps>;
7
+ };
@@ -1,5 +1,6 @@
1
1
  import AntdDropdown from "antd/es/dropdown";
2
- export class Dropdown {
3
- static Button = AntdDropdown.Button;
4
- }
2
+ import { ReactUtil } from "../../util/ReactUtil";
3
+ export const Dropdown = ReactUtil.statics("Dropdown", {
4
+ Button: AntdDropdown.Button,
5
+ });
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Dropdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAM5C,MAAM,OAAO,QAAQ;IACjB,MAAM,CAAC,MAAM,GAA+B,YAAY,CAAC,MAAM,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Dropdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAK/C,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE;IAClD,MAAM,EAAE,YAAY,CAAC,MAAM;CAC9B,CAAC,CAAC"}
@@ -4,7 +4,4 @@ export interface Props<Enum extends string> extends ControlledFormValue<Enum[]>
4
4
  map: Record<Enum, React.ReactElement | string | number | null>;
5
5
  disabledItems?: Enum[] | "all";
6
6
  }
7
- export declare class Map<Enum extends string> extends React.PureComponent<Props<Enum>> {
8
- static displayName: string;
9
- render(): React.JSX.Element;
10
- }
7
+ export declare const Map: <Enum extends string>({ map, ...restProps }: Props<Enum>) => React.JSX.Element;
@@ -1,12 +1,8 @@
1
1
  import React from "react";
2
2
  import { EnumCheckboxGroup } from "./index";
3
- export class Map extends React.PureComponent {
4
- static displayName = "EnumCheckboxGroup.Map";
5
- render() {
6
- const { map, ...restProps } = this.props;
7
- const list = Object.keys(map);
8
- const translator = (_) => map[_];
9
- return React.createElement(EnumCheckboxGroup, { list: list, translator: translator, ...restProps });
10
- }
11
- }
3
+ import { ReactUtil } from "../../util/ReactUtil";
4
+ export const Map = ReactUtil.memo("Map", ({ map, ...restProps }) => {
5
+ const list = Object.keys(map);
6
+ return React.createElement(EnumCheckboxGroup, { list: list, translator: _ => map[_], ...restProps });
7
+ });
12
8
  //# sourceMappingURL=Map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../src/core/EnumCheckboxGroup/Map.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAQ1C,MAAM,OAAO,GAAyB,SAAQ,KAAK,CAAC,aAA0B;IAC1E,MAAM,CAAC,WAAW,GAAG,uBAAuB,CAAC;IAE7C,MAAM;QACF,MAAM,EAAC,GAAG,EAAE,GAAG,SAAS,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAEvC,MAAM,IAAI,GAAW,MAAM,CAAC,IAAI,CAAC,GAAG,CAAW,CAAC;QAChD,MAAM,UAAU,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEvC,OAAO,oBAAC,iBAAiB,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,KAAM,SAAS,GAAI,CAAC;IACpF,CAAC"}
1
+ {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../src/core/EnumCheckboxGroup/Map.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAO/C,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAsB,EAAC,GAAG,EAAE,GAAG,SAAS,EAAc,EAAE,EAAE;IAC/F,MAAM,IAAI,GAAW,MAAM,CAAC,IAAI,CAAC,GAAG,CAAW,CAAC;IAChD,OAAO,oBAAC,iBAAiB,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,KAAM,SAAS,GAAI,CAAC;AACrF,CAAC,CAAC,CAAC"}
@@ -5,8 +5,7 @@ interface Props<Enum extends string | boolean | number> extends ControlledFormVa
5
5
  translator?: (enumValue: Enum) => React.ReactElement | string | number | null;
6
6
  disabledItems?: Enum[] | "all";
7
7
  }
8
- export declare class EnumCheckboxGroup<Enum extends string | boolean | number> extends React.PureComponent<Props<Enum>> {
9
- static displayName: string;
10
- render(): React.JSX.Element;
11
- }
8
+ export declare const EnumCheckboxGroup: (<Enum extends string | boolean | number>(props: Props<Enum>) => React.JSX.Element) & {
9
+ Map: <Enum extends string>({ map, ...restProps }: import("./Map").Props<Enum>) => React.JSX.Element;
10
+ };
12
11
  export {};
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
2
  import { Checkbox } from "../Checkbox";
3
- export class EnumCheckboxGroup extends React.PureComponent {
4
- static displayName = "EnumCheckboxGroup";
5
- render() {
6
- const { list, translator, disabledItems, value, onChange } = this.props;
7
- const options = list.map(_ => ({
8
- label: translator ? translator(_) : _.toString(),
9
- value: _,
10
- disabled: disabledItems ? disabledItems === "all" || disabledItems.includes(_) : false,
11
- }));
12
- return React.createElement(Checkbox.Group, { options: options, value: value, onChange: onChange });
13
- }
14
- }
3
+ import { ReactUtil } from "../../util/ReactUtil";
4
+ import { Map } from "./Map";
5
+ export const EnumCheckboxGroup = ReactUtil.compound("EnumCheckboxGroup", { Map }, (props) => {
6
+ const { list, translator, disabledItems, value, onChange } = props;
7
+ const options = list.map(_ => ({
8
+ label: translator ? translator(_) : _.toString(),
9
+ value: _,
10
+ disabled: disabledItems ? disabledItems === "all" || disabledItems.includes(_) : false,
11
+ }));
12
+ return React.createElement(Checkbox.Group, { options: options, value: value, onChange: onChange });
13
+ });
15
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/EnumCheckboxGroup/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AASrC,MAAM,OAAO,iBAA0D,SAAQ,KAAK,CAAC,aAA0B;IAC3G,MAAM,CAAC,WAAW,GAAG,mBAAmB,CAAC;IAEzC,MAAM;QACF,MAAM,EAAC,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACtE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3B,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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AK,IAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAe,GAAI,CAAC;AACzF,CAAC,CAAC,CAAC"}
@@ -4,8 +4,4 @@ export interface Props<Enum extends string | boolean | number> extends BaseProps
4
4
  value: Enum | null;
5
5
  onChange: (newValue: Enum) => void;
6
6
  }
7
- export declare class InitialNullable<Enum extends string | boolean | number> extends React.PureComponent<Props<Enum>> {
8
- static displayName: string;
9
- private readonly nullValue;
10
- render(): React.JSX.Element;
11
- }
7
+ export declare const InitialNullable: <Enum extends string | boolean | number>({ value, ...restProps }: Props<Enum>) => React.JSX.Element;
@@ -1,12 +1,9 @@
1
1
  import React from "react";
2
2
  import { EnumRadio } from "./index";
3
- export class InitialNullable extends React.PureComponent {
4
- static displayName = "EnumRadio.InitialNullable";
5
- nullValue = "@@NULL";
6
- render() {
7
- const { value, ...restProps } = this.props;
8
- const wrappedValue = (value === null ? this.nullValue : value); // nullValue does not exist in list, so no Radio will be selected
9
- return React.createElement(EnumRadio, { value: wrappedValue, ...restProps });
10
- }
11
- }
3
+ import { ReactUtil } from "../../util/ReactUtil";
4
+ const NULL_VALUE = "@@NULL";
5
+ export const InitialNullable = ReactUtil.memo("InitialNullable", ({ value, ...restProps }) => {
6
+ const wrappedValue = (value === null ? NULL_VALUE : value); // nullValue does not exist in list, so no Radio will be selected
7
+ return React.createElement(EnumRadio, { value: wrappedValue, ...restProps });
8
+ });
12
9
  //# sourceMappingURL=InitialNullable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InitialNullable.js","sourceRoot":"","sources":["../../../src/core/EnumRadio/InitialNullable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AASlC,MAAM,OAAO,eAAwD,SAAQ,KAAK,CAAC,aAA0B;IACzG,MAAM,CAAC,WAAW,GAAG,2BAA2B,CAAC;IAEhC,SAAS,GAAa,QAAQ,CAAC;IAEhD,MAAM;QACF,MAAM,EAAC,KAAK,EAAE,GAAG,SAAS,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzC,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAS,CAAC,CAAC,iEAAiE;QAEzI,OAAO,oBAAC,SAAS,IAAC,KAAK,EAAE,YAAY,KAAM,SAAS,GAAI,CAAC;IAC7D,CAAC"}
1
+ {"version":3,"file":"InitialNullable.js","sourceRoot":"","sources":["../../../src/core/EnumRadio/InitialNullable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAE/C,MAAM,UAAU,GAAG,QAAQ,CAAC;AAO5B,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAyC,EAAC,KAAK,EAAE,GAAG,SAAS,EAAc,EAAE,EAAE;IAC5I,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAS,CAAC,CAAC,iEAAiE;IACrI,OAAO,oBAAC,SAAS,IAAC,KAAK,EAAE,YAAY,KAAM,SAAS,GAAI,CAAC;AAC7D,CAAC,CAAC,CAAC"}
@@ -4,7 +4,4 @@ import type { ControlledFormValue } from "../../internal/type";
4
4
  export interface Props<Enum extends string> extends Omit<BaseProps<any>, "list" | "translator">, ControlledFormValue<Enum> {
5
5
  map: Record<Enum, React.ReactElement | string | number | null>;
6
6
  }
7
- export declare class Map<Enum extends string> extends React.PureComponent<Props<Enum>> {
8
- static displayName: string;
9
- render(): React.JSX.Element;
10
- }
7
+ export declare const Map: <Enum extends string>({ map, ...restProps }: Props<Enum>) => React.JSX.Element;
@@ -1,12 +1,9 @@
1
1
  import React from "react";
2
2
  import { EnumRadio } from "./index";
3
- export class Map extends React.PureComponent {
4
- static displayName = "EnumRadio.Map";
5
- render() {
6
- const { map, ...restProps } = this.props;
7
- const list = Object.keys(map);
8
- const translator = (_) => map[_];
9
- return React.createElement(EnumRadio, { list: list, translator: translator, ...restProps });
10
- }
11
- }
3
+ import { ReactUtil } from "../../util/ReactUtil";
4
+ export const Map = ReactUtil.memo("Map", ({ map, ...restProps }) => {
5
+ const list = Object.keys(map);
6
+ const translator = (_) => map[_];
7
+ return React.createElement(EnumRadio, { list: list, translator: translator, ...restProps });
8
+ });
12
9
  //# sourceMappingURL=Map.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../src/core/EnumRadio/Map.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAOlC,MAAM,OAAO,GAAyB,SAAQ,KAAK,CAAC,aAA0B;IAC1E,MAAM,CAAC,WAAW,GAAG,eAAe,CAAC;IAErC,MAAM;QACF,MAAM,EAAC,GAAG,EAAE,GAAG,SAAS,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAEvC,MAAM,IAAI,GAAW,MAAM,CAAC,IAAI,CAAC,GAAG,CAAW,CAAC;QAChD,MAAM,UAAU,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEvC,OAAO,oBAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,KAAM,SAAS,GAAI,CAAC;IAC5E,CAAC"}
1
+ {"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../src/core/EnumRadio/Map.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAM/C,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,CAAsB,EAAC,GAAG,EAAE,GAAG,SAAS,EAAc,EAAE,EAAE;IAC/F,MAAM,IAAI,GAAW,MAAM,CAAC,IAAI,CAAC,GAAG,CAAW,CAAC;IAChD,MAAM,UAAU,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,oBAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,KAAM,SAAS,GAAI,CAAC;AAC5E,CAAC,CAAC,CAAC"}
@@ -5,8 +5,4 @@ export interface Props<Enum extends string | boolean | number> extends BaseProps
5
5
  nullText?: React.ReactElement | string | number | null;
6
6
  nullPositionIndex?: number;
7
7
  }
8
- export declare class Nullable<Enum extends string | boolean | number> extends React.PureComponent<Props<Enum>> {
9
- static displayName: string;
10
- private readonly nullValue;
11
- render(): React.JSX.Element;
12
- }
8
+ export declare const Nullable: <Enum extends string | boolean | number>(props: Props<Enum>) => React.JSX.Element;
@@ -1,18 +1,16 @@
1
1
  import React from "react";
2
2
  import { EnumRadio } from "./index";
3
3
  import { i18n } from "../../internal/i18n/core";
4
- export class Nullable extends React.PureComponent {
5
- static displayName = "EnumRadio.Nullable";
6
- nullValue = "@@NULL";
7
- render() {
8
- const { value, onChange, nullText, nullPositionIndex, list, translator, ...restProps } = this.props;
9
- const t = i18n();
10
- const wrappedValue = value === null ? this.nullValue : value;
11
- const wrappedOnChange = (value) => onChange(value === this.nullValue ? null : value);
12
- const wrappedList = [...list];
13
- wrappedList.splice(nullPositionIndex || 0, 0, this.nullValue);
14
- const wrappedTranslator = (value) => (value === this.nullValue ? (nullText ?? t.all) : translator ? translator(value) : value.toString());
15
- return React.createElement(EnumRadio, { value: wrappedValue, onChange: wrappedOnChange, list: wrappedList, translator: wrappedTranslator, ...restProps });
16
- }
17
- }
4
+ import { ReactUtil } from "../../util/ReactUtil";
5
+ const NULL_VALUE = "@@NULL";
6
+ export const Nullable = ReactUtil.memo("Nullable", (props) => {
7
+ const { value, onChange, nullText, nullPositionIndex, list, translator, ...restProps } = props;
8
+ const t = i18n();
9
+ const wrappedValue = value === null ? NULL_VALUE : value;
10
+ const wrappedOnChange = (value) => onChange(value === NULL_VALUE ? null : value);
11
+ const wrappedList = [...list];
12
+ wrappedList.splice(nullPositionIndex || 0, 0, NULL_VALUE);
13
+ const wrappedTranslator = (value) => (value === NULL_VALUE ? (nullText ?? t.all) : translator ? translator(value) : value.toString());
14
+ return React.createElement(EnumRadio, { value: wrappedValue, onChange: wrappedOnChange, list: wrappedList, translator: wrappedTranslator, ...restProps });
15
+ });
18
16
  //# sourceMappingURL=Nullable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Nullable.js","sourceRoot":"","sources":["../../../src/core/EnumRadio/Nullable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAS9C,MAAM,OAAO,QAAiD,SAAQ,KAAK,CAAC,aAA0B;IAClG,MAAM,CAAC,WAAW,GAAG,oBAAoB,CAAC;IAEzB,SAAS,GAAa,QAAQ,CAAC;IAEhD,MAAM;QACF,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,SAAS,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAClG,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;QAEjB,MAAM,YAAY,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7D,MAAM,eAAe,GAAG,CAAC,KAAsB,EA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AAS,EAAC,GAAG,KAAK,CAAC;IAC7F,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IAEjB,MAAM,YAAY,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IACzD,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAElG,MAAM,WAAW,GAA2B,CAAC,GAAG,IAAI,CAAC,CAAC;IACtD,WAAW,CAAC,MAAM,CAAC,iBAAiB,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IAE1D,MAAM,iBAAiB,GAAG,CAAC,KAAsB,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEvJ,OAAO,oBAAC,SAAS,IAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,KAAM,SAAS,GAAI,CAAC;AAC1I,CAAC,CAAC,CAAC"}
@@ -1,9 +1,5 @@
1
1
  import React from "react";
2
- import type { RadioChangeEvent } from "../Radio";
3
2
  import type { ControlledFormValue } from "../../internal/type";
4
- import { Nullable } from "./Nullable";
5
- import { InitialNullable } from "./InitialNullable";
6
- import { Map } from "./Map";
7
3
  import type { RadioGroupButtonStyle } from "antd/es/radio";
8
4
  export interface BaseProps<Enum extends string | boolean | number> {
9
5
  list: readonly Enum[];
@@ -16,11 +12,8 @@ export interface BaseProps<Enum extends string | boolean | number> {
16
12
  }
17
13
  export interface Props<Enum extends string | boolean | number> extends BaseProps<Enum>, ControlledFormValue<Enum> {
18
14
  }
19
- export declare class EnumRadio<Enum extends string | boolean | number> extends React.PureComponent<Props<Enum>> {
20
- static displayName: string;
21
- static Nullable: typeof Nullable;
22
- static InitialNullable: typeof InitialNullable;
23
- static Map: typeof Map;
24
- onChange: (event: RadioChangeEvent) => void;
25
- render(): React.JSX.Element;
26
- }
15
+ export declare const EnumRadio: (<Enum extends string | boolean | number>(props: Props<Enum>) => React.JSX.Element) & {
16
+ Nullable: <Enum extends string | boolean | number>(props: import("./Nullable").Props<Enum>) => React.JSX.Element;
17
+ InitialNullable: <Enum extends string | boolean | number>({ value, ...restProps }: import("./InitialNullable").Props<Enum>) => React.JSX.Element;
18
+ Map: <Enum extends string>({ map, ...restProps }: import("./Map").Props<Enum>) => React.JSX.Element;
19
+ };
@@ -3,21 +3,13 @@ import { Radio } from "../Radio";
3
3
  import { Nullable } from "./Nullable";
4
4
  import { InitialNullable } from "./InitialNullable";
5
5
  import { Map } from "./Map";
6
- export class EnumRadio extends React.PureComponent {
7
- static displayName = "EnumRadio";
8
- static Nullable = Nullable;
9
- static InitialNullable = InitialNullable;
10
- static Map = Map;
11
- onChange = (event) => {
12
- const enumValue = event.target.value;
13
- this.props.onChange(enumValue);
14
- };
15
- render() {
16
- const { list, translator, value, useButtonMode, buttonStyle, disabled, className, style } = this.props;
17
- const RadioItem = useButtonMode ? Radio.Button : Radio;
18
- return (React.createElement(Radio.Group, { value: value, onChange: this.onChange, disabled: disabled, className: className, style: style, optionType: useButtonMode ? "button" : undefined, buttonStyle: buttonStyle }, list.map(_ => (
19
- // RadioItem can accept any type as value, and emit the exact type while onChange
20
- React.createElement(RadioItem, { key: _.toString(), value: _ }, translator ? translator(_) : _.toString())))));
21
- }
22
- }
6
+ import { ReactUtil } from "../../util/ReactUtil";
7
+ export const EnumRadio = ReactUtil.compound("EnumRadio", { Nullable, InitialNullable, Map }, (props) => {
8
+ const { list, translator, value, useButtonMode, buttonStyle, disabled, className, style, onChange } = props;
9
+ const RadioItem = useButtonMode ? Radio.Button : Radio;
10
+ const onAntChange = (event) => onChange(event.target.value);
11
+ return (React.createElement(Radio.Group, { value: value, onChange: onAntChange, disabled: disabled, className: className, style: style, optionType: useButtonMode ? "button" : undefined, buttonStyle: buttonStyle }, list.map(_ => (
12
+ // RadioItem can accept any type as value, and emit the exact type while onChange
13
+ React.createElement(RadioItem, { key: _.toString(), value: _ }, translator ? translator(_) : _.toString())))));
14
+ });
23
15
  //# sourceMappingURL=index.js.map