@para-ui/core 3.0.55 → 3.0.56
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.
- package/AutoBox/index.d.ts +34 -0
- package/AutoBox/index.js +277 -0
- package/AutoBox/protal.d.ts +17 -0
- package/AutoTips/autoTipsMultiline/index.d.ts +18 -0
- package/AutoTips/index.d.ts +35 -0
- package/AutoTips/index.js +271 -0
- package/Breadcrumbs/index.d.ts +53 -0
- package/Breadcrumbs/index.js +266 -0
- package/Breadcrumbs/lang/en_US.d.ts +4 -0
- package/Breadcrumbs/lang/index.d.ts +9 -0
- package/Breadcrumbs/lang/zh_CN.d.ts +4 -0
- package/Button/SplitButton.d.ts +64 -0
- package/Button/index.d.ts +79 -0
- package/Button/index.js +376 -0
- package/Button/lang/en_US.d.ts +4 -0
- package/Button/lang/index.d.ts +9 -0
- package/Button/lang/zh_CN.d.ts +4 -0
- package/ButtonGroup/index.d.ts +33 -0
- package/ButtonGroup/index.js +124 -0
- package/Carousel/index.d.ts +38 -0
- package/Carousel/index.js +78 -0
- package/Cascader/index.d.ts +54 -0
- package/Cascader/index.js +159 -0
- package/Cascader/lang/en_US.d.ts +4 -0
- package/Cascader/lang/index.d.ts +9 -0
- package/Cascader/lang/zh_CN.d.ts +4 -0
- package/Checkbox/index.d.ts +40 -0
- package/Checkbox/index.js +109 -0
- package/CheckboxGroup/index.d.ts +45 -0
- package/CheckboxGroup/index.js +142 -0
- package/Collapse/collapsePanel.d.ts +30 -0
- package/Collapse/index.d.ts +57 -0
- package/Collapse/index.js +152 -0
- package/Collapse/motion.d.ts +5 -0
- package/Collapse/util.d.ts +11 -0
- package/CollapseBox/index.d.ts +27 -0
- package/CollapseBox/index.js +148 -0
- package/CollapseBox/util.d.ts +5 -0
- package/CollapseLayout/index.d.ts +53 -0
- package/CollapseLayout/index.js +176 -0
- package/ColorPicker/index.d.ts +4 -0
- package/ColorPicker/index.js +4 -0
- package/ComboSelect/index.d.ts +6 -0
- package/ComboSelect/index.js +1049 -0
- package/ComboSelect/interface.d.ts +146 -0
- package/ComboSelect/lang/en_US.d.ts +9 -0
- package/ComboSelect/lang/index.d.ts +19 -0
- package/ComboSelect/lang/zh_CN.d.ts +9 -0
- package/ComboSelect/utils.d.ts +9 -0
- package/Container/index.d.ts +77 -0
- package/Container/index.js +232 -0
- package/DatePicker/PickerButton.d.ts +3 -0
- package/DatePicker/PickerTag.d.ts +3 -0
- package/DatePicker/generatePicker/generateRangePicker.d.ts +4 -0
- package/DatePicker/generatePicker/generateSinglePicker.d.ts +11 -0
- package/DatePicker/generatePicker/index.d.ts +95 -0
- package/DatePicker/index.d.ts +18 -0
- package/DatePicker/index.js +633 -0
- package/DatePicker/lang/en_US.d.ts +3 -0
- package/DatePicker/lang/index.d.ts +7 -0
- package/DatePicker/lang/zh_CN.d.ts +3 -0
- package/DatePicker/util.d.ts +22 -0
- package/Desktop/index.d.ts +57 -0
- package/Desktop/index.js +746 -0
- package/DragVerify/index.d.ts +36 -0
- package/DragVerify/index.js +385 -0
- package/DragVerify/lang/en_US.d.ts +5 -0
- package/DragVerify/lang/index.d.ts +11 -0
- package/DragVerify/lang/zh_CN.d.ts +5 -0
- package/Drawer/index.d.ts +11 -0
- package/Drawer/index.js +235 -0
- package/Drawer/interface.d.ts +92 -0
- package/Drawer/lang/en_US.d.ts +5 -0
- package/Drawer/lang/index.d.ts +11 -0
- package/Drawer/lang/zh_CN.d.ts +5 -0
- package/Dropdown/index.d.ts +40 -0
- package/Dropdown/index.js +10 -0
- package/DynamicMultiBox/formItem.d.ts +14 -0
- package/DynamicMultiBox/index.d.ts +5 -0
- package/DynamicMultiBox/index.js +1323 -0
- package/DynamicMultiBox/interface.d.ts +165 -0
- package/DynamicMultiBox/rowForm.d.ts +24 -0
- package/Empty/images/index.d.ts +3 -0
- package/Empty/index.d.ts +30 -0
- package/Empty/index.js +642 -0
- package/Empty/lang/en_US.d.ts +6 -0
- package/Empty/lang/index.d.ts +13 -0
- package/Empty/lang/zh_CN.d.ts +6 -0
- package/Form/index.d.ts +187 -0
- package/Form/index.js +355 -0
- package/FormItem/compoments/defaultCompoments/index.d.ts +19 -0
- package/FormItem/compoments/formCheckboxGroup/index.d.ts +8 -0
- package/FormItem/compoments/formFile/index.d.ts +38 -0
- package/FormItem/compoments/formRadioGroup/index.d.ts +8 -0
- package/FormItem/compoments/formSelect/index.d.ts +18 -0
- package/FormItem/errorTips.d.ts +12 -0
- package/FormItem/index.d.ts +152 -0
- package/FormItem/index.js +78 -0
- package/FormItem/itemType.d.ts +42 -0
- package/FormItem/validateFunction.d.ts +15 -0
- package/FunctionModal/dialog.d.ts +58 -0
- package/FunctionModal/index.d.ts +8 -0
- package/FunctionModal/index.js +43 -0
- package/FunctionModal/modalContext.d.ts +15 -0
- package/GlobalContext/componentsProps.d.ts +21 -0
- package/GlobalContext/confirmLocale.d.ts +7 -0
- package/GlobalContext/constant.d.ts +8 -0
- package/GlobalContext/index.d.ts +28 -0
- package/GlobalContext/index.js +41 -0
- package/GlobalContext/intl.d.ts +34 -0
- package/GlobalContext/useFormatMessage.d.ts +3 -0
- package/GlobalContext/usePopupContainer.d.ts +4 -0
- package/Help/index.d.ts +24 -0
- package/Help/index.js +41 -0
- package/HelperText/index.d.ts +27 -0
- package/HelperText/index.js +34 -0
- package/Hooks/useGlobalProps.d.ts +1 -0
- package/InputLang/index.d.ts +57 -0
- package/InputLang/index.js +355 -0
- package/InputNumber/index.d.ts +71 -0
- package/InputNumber/index.js +277 -0
- package/Label/index.d.ts +37 -0
- package/Label/index.js +85 -0
- package/Loading/index.d.ts +17 -0
- package/Loading/index.js +47 -0
- package/Menu/footerExpansion.d.ts +9 -0
- package/Menu/index.d.ts +10 -0
- package/Menu/index.js +1105 -0
- package/Menu/interface.d.ts +141 -0
- package/Menu/logo.d.ts +9 -0
- package/Menu/verticalMenuList.d.ts +14 -0
- package/Message/index.d.ts +99 -0
- package/Message/index.js +246 -0
- package/Modal/Confirm/index.d.ts +65 -0
- package/Modal/index.d.ts +99 -0
- package/Modal/index.js +421 -0
- package/Modal/lang/en_US.d.ts +5 -0
- package/Modal/lang/index.d.ts +11 -0
- package/Modal/lang/zh_CN.d.ts +5 -0
- package/MultiBox/index.d.ts +60 -0
- package/MultiBox/index.js +277 -0
- package/MultiBox/lang/en_US.d.ts +4 -0
- package/MultiBox/lang/index.d.ts +9 -0
- package/MultiBox/lang/zh_CN.d.ts +4 -0
- package/Notification/index.d.ts +74 -0
- package/Notification/index.js +252 -0
- package/OperateBtn/index.d.ts +59 -0
- package/OperateBtn/index.js +237 -0
- package/OperateBtn/lang/en_US.d.ts +4 -0
- package/OperateBtn/lang/index.d.ts +9 -0
- package/OperateBtn/lang/zh_CN.d.ts +4 -0
- package/PageHeader/horizontalMeun.d.ts +9 -0
- package/PageHeader/horizontalMeunRight.d.ts +9 -0
- package/PageHeader/index.d.ts +10 -0
- package/PageHeader/index.js +1050 -0
- package/PageHeader/interface.d.ts +169 -0
- package/Pagination/index.d.ts +46 -0
- package/Pagination/index.js +461 -0
- package/Pagination/lang/en_US.d.ts +8 -0
- package/Pagination/lang/index.d.ts +17 -0
- package/Pagination/lang/zh_CN.d.ts +8 -0
- package/ParauiProvider/index.d.ts +8 -0
- package/ParauiProvider/index.js +52 -0
- package/PasswordRules/index.d.ts +55 -0
- package/PasswordRules/index.js +144 -0
- package/PopConfirm/index.d.ts +61 -0
- package/PopConfirm/index.js +194 -0
- package/PopConfirm/lang/en_US.d.ts +5 -0
- package/PopConfirm/lang/index.d.ts +11 -0
- package/PopConfirm/lang/zh_CN.d.ts +5 -0
- package/Popover/index.d.ts +16 -0
- package/Popover/index.js +59 -0
- package/Progress/Line.d.ts +47 -0
- package/Progress/Steps.d.ts +17 -0
- package/Progress/index.d.ts +83 -0
- package/Progress/index.js +323 -0
- package/Progress/utils.d.ts +6 -0
- package/Querying/images/index.d.ts +3 -0
- package/Querying/index.d.ts +26 -0
- package/Querying/index.js +760 -0
- package/Querying/lang/en_US.d.ts +4 -0
- package/Querying/lang/index.d.ts +9 -0
- package/Querying/lang/zh_CN.d.ts +4 -0
- package/README.md +6 -0
- package/Radio/index.d.ts +38 -0
- package/Radio/index.js +97 -0
- package/RadioGroup/index.d.ts +46 -0
- package/RadioGroup/index.js +134 -0
- package/Search/index.d.ts +57 -0
- package/Search/index.js +208 -0
- package/Select/index.d.ts +93 -0
- package/Select/index.js +1146 -0
- package/Select/lang/en_US.d.ts +5 -0
- package/Select/lang/index.d.ts +11 -0
- package/Select/lang/zh_CN.d.ts +5 -0
- package/SelectInput/index.d.ts +12 -0
- package/SelectInput/index.js +55 -0
- package/Selector/index.d.ts +11 -0
- package/Selector/index.js +2175 -0
- package/Selector/interface.d.ts +432 -0
- package/Selector/lang/en_US.d.ts +11 -0
- package/Selector/lang/index.d.ts +23 -0
- package/Selector/lang/zh_CN.d.ts +11 -0
- package/Selector/selectorData/index.d.ts +10 -0
- package/Selector/selectorMain/index.d.ts +10 -0
- package/Selector/selectorNode/index.d.ts +10 -0
- package/Selector/util.d.ts +15 -0
- package/SelectorPicker/index.d.ts +53 -0
- package/SelectorPicker/index.js +444 -0
- package/SelectorPicker/lang/en_US.d.ts +5 -0
- package/SelectorPicker/lang/index.d.ts +11 -0
- package/SelectorPicker/lang/zh_CN.d.ts +5 -0
- package/SingleBox/index.d.ts +44 -0
- package/SingleBox/index.js +224 -0
- package/SingleBox/lang/en_US.d.ts +4 -0
- package/SingleBox/lang/index.d.ts +9 -0
- package/SingleBox/lang/zh_CN.d.ts +4 -0
- package/Slider/index.d.ts +14 -0
- package/Slider/index.js +119 -0
- package/Slider/interface.d.ts +102 -0
- package/Split/index.d.ts +7 -0
- package/Split/index.js +123 -0
- package/Status/index.d.ts +21 -0
- package/Status/index.js +37 -0
- package/Stepper/icons.d.ts +5 -0
- package/Stepper/index.d.ts +59 -0
- package/Stepper/index.js +97 -0
- package/Switch/index.d.ts +78 -0
- package/Switch/index.js +71 -0
- package/Table/index.d.ts +10 -0
- package/Table/index.js +3001 -0
- package/Table/interface.d.ts +346 -0
- package/Table/lang/en_US.d.ts +8 -0
- package/Table/lang/index.d.ts +17 -0
- package/Table/lang/zh_CN.d.ts +8 -0
- package/Table/tableBody.d.ts +9 -0
- package/Table/tableBodyElement/index.d.ts +15 -0
- package/Table/tableBodyInterface.d.ts +73 -0
- package/Table/tableContainer/index.d.ts +16 -0
- package/Table/tableElement/index.d.ts +17 -0
- package/Table/tableHead.d.ts +9 -0
- package/Table/tableHeadElement/index.d.ts +15 -0
- package/Table/tableHeadInterface.d.ts +37 -0
- package/Table/tablePagination.d.ts +9 -0
- package/Table/tablePaginationInterface.d.ts +27 -0
- package/Table/tdElement/index.d.ts +15 -0
- package/Table/thElement/index.d.ts +28 -0
- package/Table/trElement/index.d.ts +15 -0
- package/Table/util.d.ts +34 -0
- package/Tabs/index.d.ts +69 -0
- package/Tabs/index.js +205 -0
- package/Tabs/lang/en_US.d.ts +4 -0
- package/Tabs/lang/index.d.ts +9 -0
- package/Tabs/lang/zh_CN.d.ts +4 -0
- package/Tag/TagGroup.d.ts +66 -0
- package/Tag/index.d.ts +34 -0
- package/Tag/index.js +259 -0
- package/TextEditor/common.d.ts +11 -0
- package/TextEditor/index.d.ts +127 -0
- package/TextEditor/index.js +286 -0
- package/TextField/index.d.ts +90 -0
- package/TextField/index.js +611 -0
- package/TimePicker/index.d.ts +22 -0
- package/TimePicker/index.js +80 -0
- package/TimePicker/locale/en_US.d.ts +3 -0
- package/TimePicker/locale/zh_CN.d.ts +3 -0
- package/TimePicker/style/index.d.ts +1 -0
- package/Timeline/TimelineItem.d.ts +30 -0
- package/Timeline/index.d.ts +32 -0
- package/Timeline/index.js +148 -0
- package/Title/index.d.ts +30 -0
- package/Title/index.js +50 -0
- package/ToggleButton/ToggleButtonGroup.d.ts +49 -0
- package/ToggleButton/index.d.ts +49 -0
- package/ToggleButton/index.js +193 -0
- package/Tooltip/index.d.ts +11 -0
- package/Tooltip/index.js +368 -0
- package/Tooltip/interface.d.ts +35 -0
- package/Tooltip/utils.d.ts +18 -0
- package/Transfer/box.d.ts +38 -0
- package/Transfer/index.d.ts +32 -0
- package/Transfer/index.js +611 -0
- package/Transfer/lang/en_US.d.ts +10 -0
- package/Transfer/lang/index.d.ts +21 -0
- package/Transfer/lang/zh_CN.d.ts +10 -0
- package/Transfer/useClick.d.ts +3 -0
- package/Tree/OperateBar/index.d.ts +13 -0
- package/Tree/Tree.d.ts +4 -0
- package/Tree/index.d.ts +5 -0
- package/Tree/index.js +38 -0
- package/Tree/interface.d.ts +210 -0
- package/Tree/lang/en_US.d.ts +8 -0
- package/Tree/lang/index.d.ts +17 -0
- package/Tree/lang/zh_CN.d.ts +8 -0
- package/Tree/utils/closestPolyfill.d.ts +0 -0
- package/Tree/utils/tools.d.ts +25 -0
- package/Tree/utils/treeUtil.d.ts +15 -0
- package/Upload/Dragger/index.d.ts +10 -0
- package/Upload/ErroTip/index.d.ts +13 -0
- package/Upload/ImageUpload/index.d.ts +16 -0
- package/Upload/ImgCrop/EasyCrop.d.ts +17 -0
- package/Upload/ImgCrop/constants.d.ts +7 -0
- package/Upload/ImgCrop/index.d.ts +6 -0
- package/Upload/ImgCrop/interface.d.ts +48 -0
- package/Upload/UploadList/index.d.ts +5 -0
- package/Upload/index.d.ts +15 -0
- package/Upload/index.js +1446 -0
- package/Upload/interface.d.ts +136 -0
- package/Upload/lang/en_US.d.ts +12 -0
- package/Upload/lang/index.d.ts +25 -0
- package/Upload/lang/zh_CN.d.ts +12 -0
- package/_verture/constant-66aa48a1.js +10 -0
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/index-74f820ba.js +1355 -0
- package/_verture/index-77f9e0fb.js +236 -0
- package/_verture/index-a369ca3f.js +4 -0
- package/_verture/index-beef914f.js +340 -0
- package/_verture/index-d03136d4.js +711 -0
- package/_verture/index-e2881a53.js +16 -0
- package/_verture/intl-5cbb940c.js +57 -0
- package/_verture/modalContext-92bb0e16.js +201 -0
- package/_verture/slicedToArray-76060636.js +43 -0
- package/_verture/sortable.esm-49896035.js +3791 -0
- package/_verture/style-inject.es-300983ab.js +28 -0
- package/_verture/toConsumableArray-81040c9e.js +19 -0
- package/_verture/tslib.es6-55ed4bd2.js +38 -0
- package/_verture/typeof-498dd2b1.js +11 -0
- package/_verture/unsupportedIterableToArray-cb478f24.js +16 -0
- package/_verture/useFormatMessage-703f8b20.js +20 -0
- package/_verture/useGlobalProps-1b846a65.js +11 -0
- package/_verture/usePopupContainer-87febeb9.js +68 -0
- package/_verture/util-7e1fb1e2.js +18 -0
- package/index.d.ts +144 -0
- package/index.js +180 -0
- package/package.json +1 -1
- package/umd/AutoBox.js +43 -0
- package/umd/AutoTips.js +15 -0
- package/umd/Breadcrumbs.js +42 -0
- package/umd/Button.js +43 -0
- package/umd/ButtonGroup.js +43 -0
- package/umd/Carousel.js +6 -0
- package/umd/Cascader.js +43 -0
- package/umd/Checkbox.js +42 -0
- package/umd/CheckboxGroup.js +42 -0
- package/umd/Collapse.js +43 -0
- package/umd/CollapseBox.js +1 -0
- package/umd/CollapseLayout.js +29 -0
- package/umd/ColorPicker.js +1 -0
- package/umd/ComboSelect.js +42 -0
- package/umd/Container.js +1 -0
- package/umd/DatePicker.js +42 -0
- package/umd/Desktop.js +42 -0
- package/umd/DragVerify.js +28 -0
- package/umd/Drawer.js +43 -0
- package/umd/Dropdown.js +15 -0
- package/umd/DynamicMultiBox.js +54 -0
- package/umd/Empty.js +15 -0
- package/umd/Form.js +42 -0
- package/umd/FormItem.js +42 -0
- package/umd/FunctionModal.js +42 -0
- package/umd/GlobalContext.js +1 -0
- package/umd/Help.js +42 -0
- package/umd/HelperText.js +1 -0
- package/umd/InputLang.js +42 -0
- package/umd/InputNumber.js +42 -0
- package/umd/Label.js +42 -0
- package/umd/Loading.js +29 -0
- package/umd/Menu.js +29 -0
- package/umd/Message.js +30 -0
- package/umd/Modal.js +42 -0
- package/umd/MultiBox.js +42 -0
- package/umd/Notification.js +43 -0
- package/umd/OperateBtn.js +42 -0
- package/umd/PageHeader.js +42 -0
- package/umd/Pagination.js +42 -0
- package/umd/ParauiProvider.js +15 -0
- package/umd/PasswordRules.js +29 -0
- package/umd/PopConfirm.js +42 -0
- package/umd/Popover.js +15 -0
- package/umd/Progress.js +35 -0
- package/umd/Querying.js +15 -0
- package/umd/Radio.js +42 -0
- package/umd/RadioGroup.js +42 -0
- package/umd/Search.js +42 -0
- package/umd/Select.js +42 -0
- package/umd/SelectInput.js +42 -0
- package/umd/Selector.js +42 -0
- package/umd/SelectorPicker.js +42 -0
- package/umd/SingleBox.js +42 -0
- package/umd/Slider.js +15 -0
- package/umd/Split.js +1 -0
- package/umd/Status.js +1 -0
- package/umd/Stepper.js +42 -0
- package/umd/Switch.js +42 -0
- package/umd/Table.js +42 -0
- package/umd/Tabs.js +42 -0
- package/umd/Tag.js +43 -0
- package/umd/TextEditor.js +205 -0
- package/umd/TextField.js +42 -0
- package/umd/TimePicker.js +42 -0
- package/umd/Timeline.js +1 -0
- package/umd/Title.js +1 -0
- package/umd/ToggleButton.js +43 -0
- package/umd/Tooltip.js +15 -0
- package/umd/Transfer.js +49 -0
- package/umd/Tree.js +42 -0
- package/umd/Upload.js +56 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { _ as _typeof } from './typeof-498dd2b1.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 替换字符串模版变量
|
|
7
|
+
* @param str
|
|
8
|
+
* @param params
|
|
9
|
+
*/
|
|
10
|
+
var replaceStrTemplateVars = function replaceStrTemplateVars(str, vars) {
|
|
11
|
+
if (!vars) return str;
|
|
12
|
+
var jsx$1 = false; // 当替换的vars变量内存在jsx对象,则返回也是jsx数据,否则返回字符串
|
|
13
|
+
str = str.replace(/\"/g, '\\"');
|
|
14
|
+
var strTemplate = str.replace(/\{(.*?)\}/ig, function (s, v) {
|
|
15
|
+
if (_typeof(vars[v]) === 'object') jsx$1 = true;
|
|
16
|
+
return "\",vars.".concat(v, ",\"");
|
|
17
|
+
});
|
|
18
|
+
if (jsx$1) return new Function('vars', "return [\"".concat(strTemplate, "\"];"))(vars).map(function (item) {
|
|
19
|
+
return jsx(React__default.Fragment, {
|
|
20
|
+
children: item
|
|
21
|
+
}, Math.random());
|
|
22
|
+
});else return new Function('vars', "return [\"".concat(strTemplate, "\"].join('');"))(vars);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* 国际化获取方法
|
|
26
|
+
* @param ops 国际化取值key参数
|
|
27
|
+
* @param i18nData 国际化数据对象
|
|
28
|
+
* @param params 国际化字符变量对象
|
|
29
|
+
* @param lang 指定国际化语言
|
|
30
|
+
* @param defI18nData 默认国际化数据对象
|
|
31
|
+
*/
|
|
32
|
+
var i18nIntl = function i18nIntl(props) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
var ops = props.ops,
|
|
35
|
+
i18nData = props.i18nData,
|
|
36
|
+
lang = props.lang,
|
|
37
|
+
params = props.params,
|
|
38
|
+
defI18nData = props.defI18nData;
|
|
39
|
+
var text, key;
|
|
40
|
+
if (typeof ops === 'string') {
|
|
41
|
+
key = ops;
|
|
42
|
+
} else if (_typeof(ops) === 'object') {
|
|
43
|
+
if (typeof ops.id !== 'string') return 'i18n intl object "id" is missing';
|
|
44
|
+
key = ops.id;
|
|
45
|
+
}
|
|
46
|
+
if (key !== undefined) {
|
|
47
|
+
text = (_a = i18nData[lang]) === null || _a === void 0 ? void 0 : _a[key];
|
|
48
|
+
if (text === undefined && defI18nData) {
|
|
49
|
+
// 尝试从默认国际化数据获取
|
|
50
|
+
text = (_b = defI18nData[lang]) === null || _b === void 0 ? void 0 : _b[key];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (typeof text !== 'string') return "{".concat(key, "}");
|
|
54
|
+
return replaceStrTemplateVars(text, params);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { i18nIntl as i };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { _ as _toConsumableArray } from './toConsumableArray-81040c9e.js';
|
|
2
|
+
import { _ as _slicedToArray } from './slicedToArray-76060636.js';
|
|
3
|
+
import { r as regenerator } from './index-beef914f.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
|
+
React__default.useEffect(function () {
|
|
29
|
+
getClose && getClose(function () {
|
|
30
|
+
return onClose(listIndex);
|
|
31
|
+
});
|
|
32
|
+
}, [getClose, listIndex, onClose]);
|
|
33
|
+
return jsx(Modal, Object.assign({}, ModalProps, {
|
|
34
|
+
className: clsx('function-modal', !size && 'function-modal-default'),
|
|
35
|
+
open: open,
|
|
36
|
+
title: title,
|
|
37
|
+
onCancel: function onCancel() {
|
|
38
|
+
return onClose(listIndex);
|
|
39
|
+
},
|
|
40
|
+
onOk: function onOk() {
|
|
41
|
+
return onSubmit(listIndex);
|
|
42
|
+
},
|
|
43
|
+
size: size || 'md',
|
|
44
|
+
children: content || context,
|
|
45
|
+
okButtonProps: {
|
|
46
|
+
onClick: function onClick() {
|
|
47
|
+
return onSubmit(listIndex);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
cancelButtonProps: {
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
return onClose(listIndex);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 创建模态框的上下文
|
|
60
|
+
*/
|
|
61
|
+
var FunctionModalContext = /*#__PURE__*/React__default.createContext(Promise.reject);
|
|
62
|
+
/**
|
|
63
|
+
* 弹出框组件
|
|
64
|
+
* @param context 主体内容
|
|
65
|
+
* @param title 弹出框标题
|
|
66
|
+
* @param hideClose 隐藏右上角关闭图标 boolean 默认 false
|
|
67
|
+
* @param checkFunction 检查方法,返回 boolean 值,true则关闭弹窗,false反之
|
|
68
|
+
**/
|
|
69
|
+
var useModal = function useModal() {
|
|
70
|
+
return React__default.useContext(FunctionModalContext);
|
|
71
|
+
};
|
|
72
|
+
var setState;
|
|
73
|
+
/**
|
|
74
|
+
* 函数弹窗组件Provider
|
|
75
|
+
*/
|
|
76
|
+
var FunctionModalProvider = function FunctionModalProvider(_ref) {
|
|
77
|
+
var children = _ref.children;
|
|
78
|
+
// 模态框组 配置
|
|
79
|
+
var _React$useState = React__default.useState([]),
|
|
80
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
81
|
+
confirmationState = _React$useState2[0],
|
|
82
|
+
setConfirmationState = _React$useState2[1];
|
|
83
|
+
// 传出设置模态框数组hook,用于关闭所有弹窗
|
|
84
|
+
setState = function setState() {
|
|
85
|
+
setConfirmationState([]);
|
|
86
|
+
awaitingPromiseRef.current = [];
|
|
87
|
+
};
|
|
88
|
+
// 存储每个模态框的 promise 方法
|
|
89
|
+
var awaitingPromiseRef = React__default.useRef([]);
|
|
90
|
+
/**
|
|
91
|
+
* 模态框初始化方法
|
|
92
|
+
* @param options 模态框配置
|
|
93
|
+
* @return 返回一个promise 用于外部判断弹窗状态
|
|
94
|
+
*/
|
|
95
|
+
var openConfirmation = function openConfirmation(options) {
|
|
96
|
+
setConfirmationState(function (pre) {
|
|
97
|
+
pre.push(options);
|
|
98
|
+
return _toConsumableArray(pre);
|
|
99
|
+
});
|
|
100
|
+
return new Promise(function (resolve, reject) {
|
|
101
|
+
awaitingPromiseRef.current.push({
|
|
102
|
+
resolve: resolve,
|
|
103
|
+
reject: reject
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* 模态框关闭方法
|
|
109
|
+
* @param idx 模态框在模态框数组里的下标,用于拿到对应的配置 和 promise
|
|
110
|
+
* @description 关闭后会清空相关配置
|
|
111
|
+
*/
|
|
112
|
+
var handleClose = function handleClose(idx) {
|
|
113
|
+
// 是否有禁用取消停止功能的配置
|
|
114
|
+
if (confirmationState[idx] && !confirmationState[idx].disCatchOnCancel && awaitingPromiseRef.current[idx]) {
|
|
115
|
+
awaitingPromiseRef.current[idx].resolve(false);
|
|
116
|
+
} else if (awaitingPromiseRef.current[idx]) {
|
|
117
|
+
awaitingPromiseRef.current[idx].resolve(true);
|
|
118
|
+
}
|
|
119
|
+
hideDialog(idx);
|
|
120
|
+
deleteOption(idx);
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* 模态框确定触发的方法
|
|
124
|
+
* @param idx 模态框在模态框数组里的下标,用于拿到对应的配置 和 promise
|
|
125
|
+
*/
|
|
126
|
+
var handleSubmit = function handleSubmit(idx) {
|
|
127
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
128
|
+
var checkFuc, jude, pRef;
|
|
129
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
130
|
+
while (1) switch (_context.prev = _context.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
checkFuc = confirmationState && confirmationState[idx] && confirmationState[idx].checkFunction;
|
|
133
|
+
jude = true; // 判断是否有检查方法,如果有则先执行检查方法
|
|
134
|
+
if (!checkFuc) {
|
|
135
|
+
_context.next = 6;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
_context.next = 5;
|
|
139
|
+
return checkFuc();
|
|
140
|
+
case 5:
|
|
141
|
+
jude = _context.sent;
|
|
142
|
+
case 6:
|
|
143
|
+
if (jude) {
|
|
144
|
+
_context.next = 8;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
return _context.abrupt("return");
|
|
148
|
+
case 8:
|
|
149
|
+
hideDialog(idx);
|
|
150
|
+
pRef = awaitingPromiseRef.current[idx];
|
|
151
|
+
deleteOption(idx, pRef);
|
|
152
|
+
case 11:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context.stop();
|
|
155
|
+
}
|
|
156
|
+
}, _callee);
|
|
157
|
+
}));
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* 删除模态框配置,promise 执行成功操作
|
|
161
|
+
* @param pRef 模态框的promise
|
|
162
|
+
* @param idx 模态框在模态框组里的下标
|
|
163
|
+
*/
|
|
164
|
+
var deleteOption = function deleteOption(idx, pRef) {
|
|
165
|
+
setTimeout(function () {
|
|
166
|
+
pRef && pRef.resolve(true);
|
|
167
|
+
setConfirmationState(function (pre) {
|
|
168
|
+
pre.splice(idx, 1);
|
|
169
|
+
awaitingPromiseRef.current.splice(idx, 1);
|
|
170
|
+
return _toConsumableArray(pre);
|
|
171
|
+
});
|
|
172
|
+
}, 200);
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* 隐藏模态框对应的dom
|
|
176
|
+
* @param idx 模态框在模态框数组里的下标
|
|
177
|
+
* @desc 解决异步导致的闪烁问题
|
|
178
|
+
*/
|
|
179
|
+
var hideDialog = function hideDialog(idx) {
|
|
180
|
+
var dialogEl = document.querySelectorAll('.function-modal .MuiDialog-container')[idx];
|
|
181
|
+
if (dialogEl) dialogEl.style.opacity = '0';
|
|
182
|
+
};
|
|
183
|
+
return jsxs(Fragment, {
|
|
184
|
+
children: [jsx(FunctionModalContext.Provider, {
|
|
185
|
+
value: openConfirmation,
|
|
186
|
+
children: children
|
|
187
|
+
}), confirmationState && confirmationState.map(function (option, idx) {
|
|
188
|
+
return jsx(FDialog, Object.assign({
|
|
189
|
+
listIndex: idx,
|
|
190
|
+
open: Boolean(option),
|
|
191
|
+
onSubmit: handleSubmit,
|
|
192
|
+
onClose: handleClose
|
|
193
|
+
}, option), "modal-item-".concat(idx));
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
var useClose = function useClose() {
|
|
198
|
+
return setState;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export { FunctionModalProvider as F, useClose as a, useModal as u };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { _ as _unsupportedIterableToArray } from './unsupportedIterableToArray-cb478f24.js';
|
|
2
|
+
|
|
3
|
+
function _arrayWithHoles(arr) {
|
|
4
|
+
if (Array.isArray(arr)) return arr;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function _iterableToArrayLimit(arr, i) {
|
|
8
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9
|
+
if (null != _i) {
|
|
10
|
+
var _s,
|
|
11
|
+
_e,
|
|
12
|
+
_x,
|
|
13
|
+
_r,
|
|
14
|
+
_arr = [],
|
|
15
|
+
_n = !0,
|
|
16
|
+
_d = !1;
|
|
17
|
+
try {
|
|
18
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
19
|
+
if (Object(_i) !== _i) return;
|
|
20
|
+
_n = !1;
|
|
21
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_d = !0, _e = err;
|
|
24
|
+
} finally {
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
27
|
+
} finally {
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function _nonIterableRest() {
|
|
36
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _slicedToArray(arr, i) {
|
|
40
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { _slicedToArray as _ };
|