@para-ui/core 2.2.4 → 2.2.5-beta

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 (353) hide show
  1. package/AutoBox/index.d.ts +12 -6
  2. package/AutoBox/index.js +203 -15
  3. package/AutoTips/index.d.ts +12 -6
  4. package/AutoTips/index.js +84 -15
  5. package/Breadcrumbs/index.d.ts +13 -7
  6. package/Breadcrumbs/index.js +227 -15
  7. package/Button/index.d.ts +92 -11
  8. package/Button/index.js +348 -14
  9. package/ButtonGroup/index.d.ts +21 -9
  10. package/ButtonGroup/index.js +128 -14
  11. package/Carousel/index.d.ts +17 -11
  12. package/Carousel/index.js +74 -15
  13. package/Cascader/index.d.ts +12 -7
  14. package/Cascader/index.js +166 -15
  15. package/Checkbox/index.d.ts +13 -7
  16. package/Checkbox/index.js +105 -14
  17. package/CheckboxGroup/index.d.ts +15 -9
  18. package/CheckboxGroup/index.js +138 -14
  19. package/Collapse/index.d.ts +49 -14
  20. package/Collapse/index.js +171 -15
  21. package/CollapseBox/index.d.ts +11 -5
  22. package/CollapseBox/index.js +164 -15
  23. package/ColorPicker/index.d.ts +4 -4
  24. package/ColorPicker/index.js +4 -1
  25. package/ComboSelect/index.d.ts +306 -6
  26. package/ComboSelect/index.js +1803 -14
  27. package/Container/index.d.ts +13 -8
  28. package/Container/index.js +239 -15
  29. package/DatePicker/index.d.ts +30 -17
  30. package/DatePicker/index.js +733 -14
  31. package/Desktop/index.d.ts +14 -6
  32. package/Desktop/index.js +853 -14
  33. package/Drawer/index.d.ts +92 -6
  34. package/Drawer/index.js +186 -14
  35. package/Dropdown/index.d.ts +29 -0
  36. package/Dropdown/index.js +67 -0
  37. package/Empty/index.d.ts +16 -10
  38. package/Empty/index.js +644 -14
  39. package/Form/index.d.ts +11 -9
  40. package/Form/index.js +384 -14
  41. package/FormItem/index.d.ts +5 -152
  42. package/FormItem/index.js +81 -14
  43. package/FunctionModal/index.d.ts +14 -3
  44. package/FunctionModal/index.js +39 -14
  45. package/GlobalContext/index.d.ts +38 -8
  46. package/GlobalContext/index.js +41 -16
  47. package/Help/index.d.ts +16 -10
  48. package/Help/index.js +39 -15
  49. package/HelperText/index.d.ts +11 -5
  50. package/HelperText/index.js +29 -15
  51. package/InputLang/index.d.ts +13 -7
  52. package/InputLang/index.js +270 -14
  53. package/InputNumber/index.d.ts +16 -10
  54. package/InputNumber/index.js +308 -14
  55. package/Label/index.d.ts +12 -6
  56. package/Label/index.js +81 -14
  57. package/Loading/index.d.ts +12 -6
  58. package/Loading/index.js +47 -15
  59. package/Menu/index.d.ts +123 -5
  60. package/Menu/index.js +1232 -14
  61. package/Message/index.d.ts +11 -5
  62. package/Message/index.js +222 -15
  63. package/Modal/index.d.ts +142 -40
  64. package/Modal/index.js +443 -14
  65. package/MultiBox/index.d.ts +13 -7
  66. package/MultiBox/index.js +231 -14
  67. package/Notification/index.d.ts +22 -16
  68. package/Notification/index.js +266 -15
  69. package/OperateBtn/index.d.ts +16 -10
  70. package/OperateBtn/index.js +260 -14
  71. package/PageHeader/index.d.ts +178 -5
  72. package/PageHeader/index.js +1171 -14
  73. package/Pagination/index.d.ts +12 -6
  74. package/Pagination/index.js +469 -14
  75. package/ParauiProvider/index.d.ts +9 -8
  76. package/ParauiProvider/index.js +53 -15
  77. package/PopConfirm/index.d.ts +23 -10
  78. package/PopConfirm/index.js +189 -14
  79. package/Popover/index.d.ts +18 -11
  80. package/Popover/index.js +66 -15
  81. package/Progress/index.d.ts +18 -12
  82. package/Progress/index.js +358 -20
  83. package/Querying/index.d.ts +15 -9
  84. package/Querying/index.js +762 -14
  85. package/Radio/index.d.ts +13 -7
  86. package/Radio/index.js +94 -14
  87. package/RadioGroup/index.d.ts +15 -9
  88. package/RadioGroup/index.js +128 -14
  89. package/Search/index.d.ts +18 -12
  90. package/Search/index.js +220 -14
  91. package/Select/index.d.ts +13 -7
  92. package/Select/index.js +1288 -14
  93. package/SelectInput/index.d.ts +11 -5
  94. package/SelectInput/index.js +51 -14
  95. package/SingleBox/index.d.ts +13 -7
  96. package/SingleBox/index.js +194 -14
  97. package/Slider/index.d.ts +104 -7
  98. package/Slider/index.js +125 -15
  99. package/Split/index.d.ts +8 -3
  100. package/Split/index.js +134 -15
  101. package/Stepper/index.d.ts +41 -25
  102. package/Stepper/index.js +99 -15
  103. package/Switch/index.d.ts +16 -10
  104. package/Switch/index.js +73 -14
  105. package/Table/index.d.ts +12 -4
  106. package/Table/index.js +2725 -14
  107. package/Tabs/index.d.ts +64 -29
  108. package/Tabs/index.js +218 -14
  109. package/Tag/index.d.ts +78 -12
  110. package/Tag/index.js +286 -14
  111. package/Test/index.d.ts +3 -2
  112. package/Test/index.js +9 -16
  113. package/TextField/index.d.ts +22 -16
  114. package/TextField/index.js +686 -14
  115. package/TimePicker/index.d.ts +20 -10
  116. package/TimePicker/index.js +77 -14
  117. package/Timeline/index.d.ts +49 -13
  118. package/Timeline/index.js +150 -15
  119. package/ToggleButton/index.d.ts +61 -10
  120. package/ToggleButton/index.js +200 -14
  121. package/Tooltip/index.d.ts +12 -10
  122. package/Tooltip/index.js +335 -15
  123. package/Transfer/index.d.ts +8 -3
  124. package/Transfer/index.js +343 -14
  125. package/Tree/index.d.ts +8 -5
  126. package/Tree/index.js +35 -14
  127. package/Upload/index.d.ts +179 -8
  128. package/Upload/index.js +1542 -14
  129. package/_verture/defineProperty-0590dc61.js +16 -0
  130. package/_verture/index-0d8e1d07.js +4 -0
  131. package/_verture/index-14a47097.js +4 -0
  132. package/_verture/index-342379c6.js +391 -0
  133. package/_verture/index-458032d7.js +10 -0
  134. package/_verture/index-46bfb2f0.js +778 -0
  135. package/_verture/index-50401de7.js +4 -0
  136. package/_verture/index-5b08df83.js +4 -0
  137. package/_verture/index-6190b129.js +4 -0
  138. package/_verture/index-7ef1e3b6.js +1553 -0
  139. package/_verture/index-a369ca3f.js +4 -0
  140. package/_verture/index-c60911dc.js +39 -0
  141. package/_verture/index-e2881a53.js +16 -0
  142. package/_verture/index-ff4c2a27.js +200 -0
  143. package/{Tree/interface.d.ts → _verture/interface-128abdd3.js} +15 -25
  144. package/_verture/interface-a77a851e.js +25 -0
  145. package/{Table/interface.d.ts → _verture/interface-a9b7c716.js} +20 -28
  146. package/_verture/intl-336570e4.js +65 -0
  147. package/_verture/modalContext-25890584.js +228 -0
  148. package/_verture/modalContext-639f2787.js +58 -0
  149. package/_verture/slicedToArray-d7722f4b.js +62 -0
  150. package/_verture/style-inject.es-300983ab.js +28 -0
  151. package/_verture/toConsumableArray-f8047a75.js +19 -0
  152. package/_verture/tslib.es6-55ed4bd2.js +38 -0
  153. package/_verture/typeof-498dd2b1.js +11 -0
  154. package/_verture/useFormatMessage-ac9d6acf.js +20 -0
  155. package/_verture/useGlobalProps-af9a2af6.js +12 -0
  156. package/index.d.ts +88 -128
  157. package/index.js +160 -19
  158. package/package.json +59 -22
  159. package/Button/SplitButton.d.ts +0 -61
  160. package/Button/lang/en_US.d.ts +0 -4
  161. package/Button/lang/index.d.ts +0 -9
  162. package/Button/lang/zh_CN.d.ts +0 -4
  163. package/Cascader/lang/en_US.d.ts +0 -4
  164. package/Cascader/lang/index.d.ts +0 -9
  165. package/Cascader/lang/zh_CN.d.ts +0 -4
  166. package/Collapse/collapsePanel.d.ts +0 -30
  167. package/Collapse/motion.d.ts +0 -5
  168. package/Collapse/util.d.ts +0 -11
  169. package/CollapseBox/util.d.ts +0 -5
  170. package/ComboSelect/WithTabsCombo/index.d.ts +0 -11
  171. package/ComboSelect/WithTabsCombo/interface.d.ts +0 -141
  172. package/ComboSelect/interface.d.ts +0 -143
  173. package/ComboSelect/lang/en_US.d.ts +0 -8
  174. package/ComboSelect/lang/index.d.ts +0 -17
  175. package/ComboSelect/lang/zh_CN.d.ts +0 -8
  176. package/ComboSelect/utils.d.ts +0 -12
  177. package/DatePicker/PickerButton.d.ts +0 -3
  178. package/DatePicker/PickerTag.d.ts +0 -3
  179. package/DatePicker/generatePicker/generateRangePicker.d.ts +0 -4
  180. package/DatePicker/generatePicker/generateSinglePicker.d.ts +0 -11
  181. package/DatePicker/generatePicker/index.d.ts +0 -77
  182. package/DatePicker/lang/en_US.d.ts +0 -3
  183. package/DatePicker/lang/index.d.ts +0 -7
  184. package/DatePicker/lang/zh_CN.d.ts +0 -3
  185. package/DatePicker/util.d.ts +0 -20
  186. package/Drawer/interface.d.ts +0 -83
  187. package/Drawer/lang/en_US.d.ts +0 -5
  188. package/Drawer/lang/index.d.ts +0 -11
  189. package/Drawer/lang/zh_CN.d.ts +0 -5
  190. package/Empty/images/index.d.ts +0 -2
  191. package/Empty/lang/en_US.d.ts +0 -6
  192. package/Empty/lang/index.d.ts +0 -13
  193. package/Empty/lang/zh_CN.d.ts +0 -6
  194. package/FormItem/compoments/defaultCompoments/index.d.ts +0 -19
  195. package/FormItem/compoments/formCheckboxGroup/index.d.ts +0 -8
  196. package/FormItem/compoments/formFile/index.d.ts +0 -38
  197. package/FormItem/compoments/formRadioGroup/index.d.ts +0 -8
  198. package/FormItem/compoments/formSelect/index.d.ts +0 -18
  199. package/FormItem/errorTips.d.ts +0 -12
  200. package/FormItem/itemType.d.ts +0 -42
  201. package/FormItem/validateFunction.d.ts +0 -15
  202. package/FunctionModal/dialog.d.ts +0 -58
  203. package/FunctionModal/modalContext.d.ts +0 -14
  204. package/GlobalContext/componentsProps.d.ts +0 -19
  205. package/GlobalContext/confirmLocale.d.ts +0 -7
  206. package/GlobalContext/intl.d.ts +0 -34
  207. package/GlobalContext/useFormatMessage.d.ts +0 -3
  208. package/Hooks/useGlobalProps.d.ts +0 -1
  209. package/Menu/footerExpansion.d.ts +0 -9
  210. package/Menu/interface.d.ts +0 -139
  211. package/Menu/logo.d.ts +0 -9
  212. package/Menu/verticalMenuList.d.ts +0 -14
  213. package/Modal/Confirm/index.d.ts +0 -66
  214. package/Modal/lang/en_US.d.ts +0 -5
  215. package/Modal/lang/index.d.ts +0 -11
  216. package/Modal/lang/zh_CN.d.ts +0 -5
  217. package/OperateBtn/lang/en_US.d.ts +0 -4
  218. package/OperateBtn/lang/index.d.ts +0 -9
  219. package/OperateBtn/lang/zh_CN.d.ts +0 -4
  220. package/PageHeader/horizontalMeun.d.ts +0 -9
  221. package/PageHeader/horizontalMeunRight.d.ts +0 -9
  222. package/PageHeader/interface.d.ts +0 -167
  223. package/Pagination/lang/en_US.d.ts +0 -8
  224. package/Pagination/lang/index.d.ts +0 -17
  225. package/Pagination/lang/zh_CN.d.ts +0 -8
  226. package/PopConfirm/lang/en_US.d.ts +0 -5
  227. package/PopConfirm/lang/index.d.ts +0 -11
  228. package/PopConfirm/lang/zh_CN.d.ts +0 -5
  229. package/Popper/index.d.ts +0 -13
  230. package/Popper/index.js +0 -16
  231. package/Progress/Line.d.ts +0 -47
  232. package/Progress/Steps.d.ts +0 -17
  233. package/Progress/utils.d.ts +0 -6
  234. package/Querying/images/index.d.ts +0 -2
  235. package/Querying/lang/en_US.d.ts +0 -4
  236. package/Querying/lang/index.d.ts +0 -9
  237. package/Querying/lang/zh_CN.d.ts +0 -4
  238. package/README.md +0 -489
  239. package/Select/lang/en_US.d.ts +0 -5
  240. package/Select/lang/index.d.ts +0 -11
  241. package/Select/lang/zh_CN.d.ts +0 -5
  242. package/Slider/interface.d.ts +0 -102
  243. package/Stepper/icons.d.ts +0 -5
  244. package/Table/lang/en_US.d.ts +0 -6
  245. package/Table/lang/index.d.ts +0 -13
  246. package/Table/lang/zh_CN.d.ts +0 -6
  247. package/Table/tableBody.d.ts +0 -9
  248. package/Table/tableBodyElement/index.d.ts +0 -15
  249. package/Table/tableBodyInterface.d.ts +0 -67
  250. package/Table/tableContainer/index.d.ts +0 -16
  251. package/Table/tableElement/index.d.ts +0 -17
  252. package/Table/tableHead.d.ts +0 -9
  253. package/Table/tableHeadElement/index.d.ts +0 -15
  254. package/Table/tableHeadInterface.d.ts +0 -30
  255. package/Table/tablePagination.d.ts +0 -9
  256. package/Table/tablePaginationInterFace.d.ts +0 -24
  257. package/Table/tdElement/index.d.ts +0 -15
  258. package/Table/thElement/index.d.ts +0 -15
  259. package/Table/trElement/index.d.ts +0 -15
  260. package/Table/util.d.ts +0 -16
  261. package/Tag/TagGroup.d.ts +0 -66
  262. package/TimePicker/locale/en_US.d.ts +0 -3
  263. package/TimePicker/locale/zh_CN.d.ts +0 -3
  264. package/TimePicker/style/index.d.ts +0 -1
  265. package/ToggleButton/ToggleButtonGroup.d.ts +0 -49
  266. package/Transfer/lang/en_US.d.ts +0 -6
  267. package/Transfer/lang/index.d.ts +0 -13
  268. package/Transfer/lang/zh_CN.d.ts +0 -6
  269. package/Tree/OperateBar/index.d.ts +0 -13
  270. package/Tree/Tree.d.ts +0 -4
  271. package/Tree/lang/en_US.d.ts +0 -8
  272. package/Tree/lang/index.d.ts +0 -17
  273. package/Tree/lang/zh_CN.d.ts +0 -8
  274. package/Tree/utils/closestPolyfill.d.ts +0 -0
  275. package/Tree/utils/tools.d.ts +0 -26
  276. package/Tree/utils/treeUtil.d.ts +0 -15
  277. package/Upload/Dragger/index.d.ts +0 -10
  278. package/Upload/ErroTip/index.d.ts +0 -13
  279. package/Upload/ImageUpload/index.d.ts +0 -14
  280. package/Upload/ImgCrop/EasyCrop.d.ts +0 -17
  281. package/Upload/ImgCrop/constants.d.ts +0 -7
  282. package/Upload/ImgCrop/index.d.ts +0 -6
  283. package/Upload/ImgCrop/interface.d.ts +0 -24
  284. package/Upload/UploadList/index.d.ts +0 -5
  285. package/Upload/interface.d.ts +0 -134
  286. package/Upload/lang/en_US.d.ts +0 -12
  287. package/Upload/lang/index.d.ts +0 -25
  288. package/Upload/lang/zh_CN.d.ts +0 -12
  289. package/cdn/AutoBox/index.js +0 -29
  290. package/cdn/AutoTips/index.js +0 -40
  291. package/cdn/Breadcrumbs/index.js +0 -53
  292. package/cdn/Button/index.js +0 -79
  293. package/cdn/ButtonGroup/index.js +0 -79
  294. package/cdn/Carousel/index.js +0 -6
  295. package/cdn/Cascader/index.js +0 -42
  296. package/cdn/Checkbox/index.js +0 -53
  297. package/cdn/CheckboxGroup/index.js +0 -53
  298. package/cdn/Collapse/index.js +0 -27
  299. package/cdn/CollapseBox/index.js +0 -1
  300. package/cdn/ColorPicker/index.js +0 -1
  301. package/cdn/ComboSelect/index.js +0 -438
  302. package/cdn/Container/index.js +0 -1
  303. package/cdn/DatePicker/index.js +0 -185
  304. package/cdn/Desktop/index.js +0 -24
  305. package/cdn/Drawer/index.js +0 -84
  306. package/cdn/Empty/index.js +0 -1
  307. package/cdn/Form/index.js +0 -477
  308. package/cdn/FormItem/index.js +0 -477
  309. package/cdn/FunctionModal/index.js +0 -144
  310. package/cdn/GlobalContext/index.js +0 -1
  311. package/cdn/Help/index.js +0 -53
  312. package/cdn/HelperText/index.js +0 -1
  313. package/cdn/InputLang/index.js +0 -144
  314. package/cdn/InputNumber/index.js +0 -118
  315. package/cdn/Label/index.js +0 -53
  316. package/cdn/Loading/index.js +0 -14
  317. package/cdn/Menu/index.js +0 -40
  318. package/cdn/Message/index.js +0 -53
  319. package/cdn/Modal/index.js +0 -144
  320. package/cdn/MultiBox/index.js +0 -131
  321. package/cdn/Notification/index.js +0 -66
  322. package/cdn/OperateBtn/index.js +0 -92
  323. package/cdn/PageHeader/index.js +0 -92
  324. package/cdn/Pagination/index.js +0 -214
  325. package/cdn/ParauiProvider/index.js +0 -9
  326. package/cdn/PopConfirm/index.js +0 -131
  327. package/cdn/Popover/index.js +0 -16
  328. package/cdn/Popper/index.js +0 -26
  329. package/cdn/Progress/index.js +0 -58
  330. package/cdn/Querying/index.js +0 -1
  331. package/cdn/Radio/index.js +0 -53
  332. package/cdn/RadioGroup/index.js +0 -53
  333. package/cdn/Search/index.js +0 -144
  334. package/cdn/Select/index.js +0 -131
  335. package/cdn/SelectInput/index.js +0 -131
  336. package/cdn/SingleBox/index.js +0 -131
  337. package/cdn/Slider/index.js +0 -16
  338. package/cdn/Split/index.js +0 -1
  339. package/cdn/Stepper/index.js +0 -154
  340. package/cdn/Switch/index.js +0 -71
  341. package/cdn/Table/index.js +0 -292
  342. package/cdn/Tabs/index.js +0 -165
  343. package/cdn/Tag/index.js +0 -27
  344. package/cdn/Test/index.js +0 -1
  345. package/cdn/TextField/index.js +0 -105
  346. package/cdn/TimePicker/index.js +0 -185
  347. package/cdn/Timeline/index.js +0 -16
  348. package/cdn/ToggleButton/index.js +0 -79
  349. package/cdn/Tooltip/index.js +0 -40
  350. package/cdn/Transfer/index.js +0 -170
  351. package/cdn/Tree/index.js +0 -170
  352. package/cdn/Upload/index.js +0 -252
  353. package/style.css +0 -72
@@ -0,0 +1,228 @@
1
+ import { _ as _toConsumableArray } from './toConsumableArray-f8047a75.js';
2
+ import { _ as _slicedToArray } from './slicedToArray-d7722f4b.js';
3
+ import { r as regenerator } from './index-342379c6.js';
4
+ import { a as __awaiter } from './tslib.es6-55ed4bd2.js';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import React__default from 'react';
7
+ import { Modal } from '../Modal/index.js';
8
+ import clsx from 'clsx';
9
+ import { s as styleInject } from './style-inject.es-300983ab.js';
10
+
11
+ var css_248z = ".function-modal-default [class*=makeStyles-md] {\n width: 440px;\n height: auto;\n max-height: initial;\n}";
12
+ styleInject(css_248z);
13
+
14
+ var FDialog = function FDialog(props) {
15
+ var open = props.open,
16
+ title = props.title,
17
+ size = props.size,
18
+ context = props.context,
19
+ content = props.content,
20
+ onSubmit = props.onSubmit,
21
+ onClose = props.onClose,
22
+ getClose = props.getClose,
23
+ listIndex = props.listIndex,
24
+ ModalProps = props.ModalProps;
25
+ /**
26
+ * 外部想要单独关闭弹窗传出
27
+ */
28
+
29
+ React__default.useEffect(function () {
30
+ getClose && getClose(function () {
31
+ return onClose(listIndex);
32
+ });
33
+ }, [getClose, listIndex, onClose]);
34
+ return jsx(Modal, Object.assign({}, ModalProps, {
35
+ className: clsx('function-modal', !size && 'function-modal-default'),
36
+ open: open,
37
+ title: title,
38
+ onCancel: function onCancel() {
39
+ return onClose(listIndex);
40
+ },
41
+ onOk: function onOk() {
42
+ return onSubmit(listIndex);
43
+ },
44
+ size: size || 'md',
45
+ children: content || context,
46
+ okButtonProps: {
47
+ onClick: function onClick() {
48
+ return onSubmit(listIndex);
49
+ }
50
+ },
51
+ cancelButtonProps: {
52
+ onClick: function onClick() {
53
+ return onClose(listIndex);
54
+ }
55
+ }
56
+ }));
57
+ };
58
+
59
+ /**
60
+ * 创建模态框的上下文
61
+ */
62
+
63
+ var FunctionModalContext = /*#__PURE__*/React__default.createContext(Promise.reject);
64
+ /**
65
+ * 弹出框组件
66
+ * @param context 主体内容
67
+ * @param title 弹出框标题
68
+ * @param hideClose 隐藏右上角关闭图标 boolean 默认 false
69
+ * @param checkFunction 检查方法,返回 boolean 值,true则关闭弹窗,false反之
70
+ **/
71
+
72
+ var useModal = function useModal() {
73
+ return React__default.useContext(FunctionModalContext);
74
+ };
75
+ var setState;
76
+ /**
77
+ * 函数弹窗组件Provider
78
+ */
79
+
80
+ var FunctionModalProvider = function FunctionModalProvider(_ref) {
81
+ var children = _ref.children;
82
+
83
+ // 模态框组 配置
84
+ var _React$useState = React__default.useState([]),
85
+ _React$useState2 = _slicedToArray(_React$useState, 2),
86
+ confirmationState = _React$useState2[0],
87
+ setConfirmationState = _React$useState2[1]; // 传出设置模态框数组hook,用于关闭所有弹窗
88
+
89
+
90
+ setState = function setState() {
91
+ setConfirmationState([]);
92
+ awaitingPromiseRef.current = [];
93
+ }; // 存储每个模态框的 promise 方法
94
+
95
+
96
+ var awaitingPromiseRef = React__default.useRef([]);
97
+ /**
98
+ * 模态框初始化方法
99
+ * @param options 模态框配置
100
+ * @return 返回一个promise 用于外部判断弹窗状态
101
+ */
102
+
103
+ var openConfirmation = function openConfirmation(options) {
104
+ setConfirmationState(function (pre) {
105
+ pre.push(options);
106
+ return _toConsumableArray(pre);
107
+ });
108
+ return new Promise(function (resolve, reject) {
109
+ awaitingPromiseRef.current.push({
110
+ resolve: resolve,
111
+ reject: reject
112
+ });
113
+ });
114
+ };
115
+ /**
116
+ * 模态框关闭方法
117
+ * @param idx 模态框在模态框数组里的下标,用于拿到对应的配置 和 promise
118
+ * @description 关闭后会清空相关配置
119
+ */
120
+
121
+
122
+ var handleClose = function handleClose(idx) {
123
+ // 是否有禁用取消停止功能的配置
124
+ if (confirmationState[idx] && !confirmationState[idx].disCatchOnCancel && awaitingPromiseRef.current[idx]) {
125
+ awaitingPromiseRef.current[idx].resolve(false);
126
+ } else if (awaitingPromiseRef.current[idx]) {
127
+ awaitingPromiseRef.current[idx].resolve(true);
128
+ }
129
+
130
+ hideDialog(idx);
131
+ deleteOption(idx);
132
+ };
133
+ /**
134
+ * 模态框确定触发的方法
135
+ * @param idx 模态框在模态框数组里的下标,用于拿到对应的配置 和 promise
136
+ */
137
+
138
+
139
+ var handleSubmit = function handleSubmit(idx) {
140
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
141
+ var checkFuc, jude, pRef;
142
+ return regenerator.wrap(function _callee$(_context) {
143
+ while (1) {
144
+ switch (_context.prev = _context.next) {
145
+ case 0:
146
+ checkFuc = confirmationState && confirmationState[idx] && confirmationState[idx].checkFunction;
147
+ jude = true; // 判断是否有检查方法,如果有则先执行检查方法
148
+
149
+ if (!checkFuc) {
150
+ _context.next = 6;
151
+ break;
152
+ }
153
+
154
+ _context.next = 5;
155
+ return checkFuc();
156
+
157
+ case 5:
158
+ jude = _context.sent;
159
+
160
+ case 6:
161
+ if (jude) {
162
+ _context.next = 8;
163
+ break;
164
+ }
165
+
166
+ return _context.abrupt("return");
167
+
168
+ case 8:
169
+ hideDialog(idx);
170
+ pRef = awaitingPromiseRef.current[idx];
171
+ deleteOption(idx, pRef);
172
+
173
+ case 11:
174
+ case "end":
175
+ return _context.stop();
176
+ }
177
+ }
178
+ }, _callee);
179
+ }));
180
+ };
181
+ /**
182
+ * 删除模态框配置,promise 执行成功操作
183
+ * @param pRef 模态框的promise
184
+ * @param idx 模态框在模态框组里的下标
185
+ */
186
+
187
+
188
+ var deleteOption = function deleteOption(idx, pRef) {
189
+ setTimeout(function () {
190
+ pRef && pRef.resolve(true);
191
+ setConfirmationState(function (pre) {
192
+ pre.splice(idx, 1);
193
+ awaitingPromiseRef.current.splice(idx, 1);
194
+ return _toConsumableArray(pre);
195
+ });
196
+ }, 200);
197
+ };
198
+ /**
199
+ * 隐藏模态框对应的dom
200
+ * @param idx 模态框在模态框数组里的下标
201
+ * @desc 解决异步导致的闪烁问题
202
+ */
203
+
204
+
205
+ var hideDialog = function hideDialog(idx) {
206
+ var dialogEl = document.querySelectorAll('.function-modal .MuiDialog-container')[idx];
207
+ if (dialogEl) dialogEl.style.opacity = '0';
208
+ };
209
+
210
+ return jsxs(Fragment, {
211
+ children: [jsx(FunctionModalContext.Provider, {
212
+ value: openConfirmation,
213
+ children: children
214
+ }), confirmationState && confirmationState.map(function (option, idx) {
215
+ return jsx(FDialog, Object.assign({
216
+ listIndex: idx,
217
+ open: Boolean(option),
218
+ onSubmit: handleSubmit,
219
+ onClose: handleClose
220
+ }, option), "modal-item-".concat(idx));
221
+ })]
222
+ });
223
+ };
224
+ var useClose = function useClose() {
225
+ return setState;
226
+ };
227
+
228
+ export { FunctionModalProvider as F, useClose as a, useModal as u };
@@ -0,0 +1,58 @@
1
+ import { ReactElement } from 'react';
2
+ import { ModalProps } from '../Modal/index.js';
3
+ import { JsxElement } from 'typescript';
4
+ import styleInject from './node_modules/style-inject/dist/style-inject.es.js';
5
+
6
+ var css_248z = ".function-modal-default [class*=makeStyles-md] {\n width: 440px;\n height: auto;\n max-height: initial;\n}";
7
+ styleInject(css_248z);
8
+
9
+ /**
10
+ * 弹窗配置
11
+ */
12
+ interface modalOptions extends ModalProps {
13
+ /**
14
+ * 非正常关闭仍然返回true
15
+ */
16
+ disCatchOnCancel?: boolean;
17
+ /**
18
+ * 模态框大小
19
+ */
20
+ size?: 'sm' | 'md' | 'lg' | 'auto' | 'fullScreen';
21
+ /**
22
+ * 模态框标题
23
+ */
24
+ title?: string;
25
+ context?: ReactElement | JsxElement;
26
+ /**
27
+ * 内容
28
+ */
29
+ content?: ReactElement | JsxElement;
30
+ /**
31
+ * 检查方法,根据返回值判断是否关闭模态框
32
+ */
33
+ checkFunction?: () => boolean | Promise<boolean>;
34
+ /**
35
+ * 获得关闭模态框方法
36
+ */
37
+ getClose?: (close: Function) => void;
38
+ /**
39
+ * 模态框其他配置
40
+ */
41
+ ModalProps?: ModalProps;
42
+ }
43
+
44
+ /**
45
+ * 弹出框组件
46
+ * @param context 主体内容
47
+ * @param title 弹出框标题
48
+ * @param hideClose 隐藏右上角关闭图标 boolean 默认 false
49
+ * @param checkFunction 检查方法,返回 boolean 值,true则关闭弹窗,false反之
50
+ **/
51
+ declare const useModal: () => (options: modalOptions) => Promise<boolean>;
52
+ /**
53
+ * 函数弹窗组件Provider
54
+ */
55
+ declare const FunctionModalProvider: ({ children }: any) => JSX.Element;
56
+ declare const useClose: () => Function;
57
+
58
+ export { FunctionModalProvider as F, useClose as a, useModal as u };
@@ -0,0 +1,62 @@
1
+ function _arrayWithHoles(arr) {
2
+ if (Array.isArray(arr)) return arr;
3
+ }
4
+
5
+ function _iterableToArrayLimit(arr, i) {
6
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
7
+
8
+ if (_i == null) return;
9
+ var _arr = [];
10
+ var _n = true;
11
+ var _d = false;
12
+
13
+ var _s, _e;
14
+
15
+ try {
16
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
17
+ _arr.push(_s.value);
18
+
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally {
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally {
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+
32
+ return _arr;
33
+ }
34
+
35
+ function _arrayLikeToArray(arr, len) {
36
+ if (len == null || len > arr.length) len = arr.length;
37
+
38
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
39
+ arr2[i] = arr[i];
40
+ }
41
+
42
+ return arr2;
43
+ }
44
+
45
+ function _unsupportedIterableToArray(o, minLen) {
46
+ if (!o) return;
47
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
48
+ var n = Object.prototype.toString.call(o).slice(8, -1);
49
+ if (n === "Object" && o.constructor) n = o.constructor.name;
50
+ if (n === "Map" || n === "Set") return Array.from(o);
51
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
52
+ }
53
+
54
+ function _nonIterableRest() {
55
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
56
+ }
57
+
58
+ function _slicedToArray(arr, i) {
59
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
60
+ }
61
+
62
+ export { _slicedToArray as _, _arrayLikeToArray as a, _unsupportedIterableToArray as b };
@@ -0,0 +1,28 @@
1
+ function styleInject(css, ref) {
2
+ if ( ref === void 0 ) ref = {};
3
+ var insertAt = ref.insertAt;
4
+
5
+ if (!css || typeof document === 'undefined') { return; }
6
+
7
+ var head = document.head || document.getElementsByTagName('head')[0];
8
+ var style = document.createElement('style');
9
+ style.type = 'text/css';
10
+
11
+ if (insertAt === 'top') {
12
+ if (head.firstChild) {
13
+ head.insertBefore(style, head.firstChild);
14
+ } else {
15
+ head.appendChild(style);
16
+ }
17
+ } else {
18
+ head.appendChild(style);
19
+ }
20
+
21
+ if (style.styleSheet) {
22
+ style.styleSheet.cssText = css;
23
+ } else {
24
+ style.appendChild(document.createTextNode(css));
25
+ }
26
+ }
27
+
28
+ export { styleInject as s };
@@ -0,0 +1,19 @@
1
+ import { a as _arrayLikeToArray, b as _unsupportedIterableToArray } from './slicedToArray-d7722f4b.js';
2
+
3
+ function _arrayWithoutHoles(arr) {
4
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
5
+ }
6
+
7
+ function _iterableToArray(iter) {
8
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9
+ }
10
+
11
+ function _nonIterableSpread() {
12
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13
+ }
14
+
15
+ function _toConsumableArray(arr) {
16
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
17
+ }
18
+
19
+ export { _toConsumableArray as _ };
@@ -0,0 +1,38 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+
16
+ function __rest(s, e) {
17
+ var t = {};
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
+ t[p] = s[p];
20
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
+ t[p[i]] = s[p[i]];
24
+ }
25
+ return t;
26
+ }
27
+
28
+ function __awaiter(thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ }
37
+
38
+ export { __rest as _, __awaiter as a };
@@ -0,0 +1,11 @@
1
+ function _typeof(obj) {
2
+ "@babel/helpers - typeof";
3
+
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
5
+ return typeof obj;
6
+ } : function (obj) {
7
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8
+ }, _typeof(obj);
9
+ }
10
+
11
+ export { _typeof as _ };
@@ -0,0 +1,20 @@
1
+ import React__default from 'react';
2
+ import GlobalContext from '@para-ui/core/GlobalContext';
3
+
4
+ /**
5
+ * @author linhd
6
+ * @date 2022/3/15 4:03 PM
7
+ * @description 国际化钩子
8
+ */
9
+
10
+ var useFormatMessage = function useFormatMessage(comName, defI18nData) {
11
+ var _React$useContext = React__default.useContext(GlobalContext),
12
+ intlFormat = _React$useContext.intlFormat;
13
+
14
+ defI18nData.zh_CN = defI18nData.zh;
15
+ defI18nData.en_US = defI18nData.en;
16
+ var intl = intlFormat && intlFormat(comName, defI18nData);
17
+ return intl;
18
+ };
19
+
20
+ export { useFormatMessage as u };
@@ -0,0 +1,12 @@
1
+ import React__default from 'react';
2
+ import GlobalContext from '@para-ui/core/GlobalContext';
3
+
4
+ function useGlobalProps(comProps, comName) {
5
+ var _React$useContext = React__default.useContext(GlobalContext),
6
+ componentsProps = _React$useContext.componentsProps;
7
+
8
+ var globalProps = componentsProps && componentsProps[comName];
9
+ return Object.assign(Object.assign({}, globalProps), comProps);
10
+ }
11
+
12
+ export { useGlobalProps as u };