@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.6
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.js +72 -85
- package/AutoTips/index.js +72 -95
- package/Badge/index.js +17 -16
- package/Breadcrumbs/index.js +57 -73
- package/Button/index.js +90 -118
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +9 -10
- package/Checkbox/index.js +28 -35
- package/CheckboxGroup/index.js +43 -58
- package/Collapse/index.js +52 -49
- package/CollapseBox/index.js +65 -70
- package/CollapseLayout/index.js +106 -101
- package/ColorPicker/index.js +3 -3
- package/ComboSelect/index.js +260 -337
- package/ComboSelect/lang/en_US.d.ts +1 -0
- package/ComboSelect/lang/index.d.ts +2 -0
- package/ComboSelect/lang/zh_CN.d.ts +1 -0
- package/ComboSelect/utils.d.ts +6 -0
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +24 -27
- package/Descriptions/index.js +50 -59
- package/Desktop/index.js +161 -180
- package/DragVerify/index.js +77 -113
- package/Drawer/index.js +80 -95
- package/Dropdown/index.js +3 -3
- package/DynamicMultiBox/index.js +222 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +70 -74
- package/FormItem/index.js +18 -15
- package/FunctionModal/index.js +7 -14
- package/GlobalContext/index.js +17 -20
- package/Help/index.js +9 -12
- package/HelperText/index.js +11 -11
- package/InputLang/index.js +104 -124
- package/InputNumber/index.js +62 -81
- package/Label/index.js +19 -21
- package/Loading/index.js +11 -10
- package/Menu/index.js +302 -371
- package/Message/index.js +104 -113
- package/Modal/index.js +122 -148
- package/MultiBox/index.d.ts +5 -0
- package/MultiBox/index.js +111 -115
- package/Notification/index.js +105 -103
- package/OperateBtn/index.d.ts +3 -0
- package/OperateBtn/index.js +77 -107
- package/PageHeader/index.js +327 -406
- package/Pagination/index.js +107 -137
- package/ParauiProvider/index.js +20 -22
- package/PasswordRules/index.js +36 -40
- package/PopConfirm/index.js +60 -77
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +22 -23
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +34 -43
- package/Select/index.js +281 -345
- package/SelectInput/index.js +8 -13
- package/Selector/index.js +582 -796
- package/SelectorPicker/index.js +113 -134
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +92 -88
- package/Slider/index.js +46 -57
- package/Status/index.js +14 -13
- package/Stepper/index.js +24 -25
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +360 -494
- package/Tabs/index.js +100 -100
- package/Tag/index.js +64 -82
- package/TextEditor/index.js +78 -100
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +29 -28
- package/Timeline/index.js +50 -47
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +29 -29
- package/Tooltip/index.js +52 -56
- package/Transfer/index.js +117 -154
- package/Tree/index.js +9 -10
- package/Upload/index.js +125 -143
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-3cdaba96.js} +967 -934
- package/_verture/{index-b1f80962.js → index-4fafd0a0.js} +6 -8
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/{index-232d890b.js → index-d63bd287.js} +1 -1
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-e0f9064d.js} +125 -134
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-8534f23d.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
- package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
- package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
- package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
- package/_verture/utils-c17b5265.js +97 -0
- package/index.js +24 -23
- package/locale/en-US.d.ts +1 -0
- package/locale/index.d.ts +2 -0
- package/locale/index.js +10 -8
- package/locale/zh-CN.d.ts +1 -0
- package/package.json +11 -10
- package/umd/AutoBox.js +9 -8
- package/umd/AutoTips.js +9 -8
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +9 -8
- package/umd/Button.js +9 -8
- package/umd/ButtonGroup.js +9 -8
- package/umd/Carousel.js +5 -5
- package/umd/Cascader.js +9 -8
- package/umd/Checkbox.js +9 -8
- package/umd/CheckboxGroup.js +9 -8
- package/umd/Collapse.js +8 -7
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +9 -8
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +9 -8
- package/umd/DatePicker.js +9 -8
- package/umd/Descriptions.js +9 -8
- package/umd/Desktop.js +9 -8
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +9 -8
- package/umd/Dropdown.js +6 -5
- package/umd/DynamicMultiBox.js +11 -10
- package/umd/Empty.js +1 -1
- package/umd/Form.js +9 -8
- package/umd/FormItem.js +9 -8
- package/umd/FunctionModal.js +9 -8
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +9 -8
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +9 -8
- package/umd/InputNumber.js +9 -8
- package/umd/Label.js +9 -8
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Message.js +4 -4
- package/umd/Modal.js +9 -8
- package/umd/MultiBox.js +9 -8
- package/umd/Notification.js +8 -7
- package/umd/OperateBtn.js +9 -8
- package/umd/PageHeader.js +9 -8
- package/umd/Pagination.js +9 -8
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +9 -8
- package/umd/Popover.js +9 -8
- package/umd/Progress.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/Radio.js +9 -8
- package/umd/RadioGroup.js +9 -8
- package/umd/Search.js +9 -8
- package/umd/Select.js +9 -8
- package/umd/SelectInput.js +9 -8
- package/umd/Selector.js +9 -8
- package/umd/SelectorPicker.js +9 -8
- package/umd/SingleBox.js +9 -8
- package/umd/Slider.js +6 -5
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +9 -8
- package/umd/Switch.js +9 -8
- package/umd/Table.js +9 -8
- package/umd/Tabs.js +9 -8
- package/umd/Tag.js +9 -8
- package/umd/TextEditor.js +22 -21
- package/umd/TextField.js +9 -8
- package/umd/TimePicker.js +9 -8
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +9 -8
- package/umd/ToggleButton.js +9 -8
- package/umd/Tooltip.js +9 -8
- package/umd/Transfer.js +10 -9
- package/umd/Tree.js +9 -8
- package/umd/Upload.js +10 -9
- package/umd/locale.js +1 -1
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- package/_verture/utils-418da0a4.js +0 -73
- /package/_verture/{typeof-c310ee4a.js → typeof-b240b062.js} +0 -0
package/DragVerify/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
2
|
-
import { r as regenerator } from '../_verture/index-232d890b.js';
|
|
3
1
|
import { a as __awaiter } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
4
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
3
|
import { useState, useRef, useEffect } from 'react';
|
|
@@ -8,12 +6,10 @@ import DoubleRight from '@para-ui/icons/DoubleRight';
|
|
|
8
6
|
import CloseIcon from '@para-ui/icons/Close';
|
|
9
7
|
import Check from '@para-ui/icons/Check';
|
|
10
8
|
import Refresh from '@para-ui/icons/Refresh';
|
|
11
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
12
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
9
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
10
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
13
11
|
import { Loading } from '../Loading/index.js';
|
|
14
12
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
15
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
16
|
-
import '../_verture/typeof-c310ee4a.js';
|
|
17
13
|
import '@para-ui/core/GlobalContext';
|
|
18
14
|
import '@para-ui/icons/LoadingF';
|
|
19
15
|
|
|
@@ -28,120 +24,88 @@ var zh = {
|
|
|
28
24
|
};
|
|
29
25
|
|
|
30
26
|
var localeJson = {
|
|
31
|
-
zh
|
|
32
|
-
en
|
|
27
|
+
zh,
|
|
28
|
+
en
|
|
33
29
|
};
|
|
34
30
|
|
|
35
31
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-drag-verify {\n width: 100%;\n position: relative;\n}\n.paraui-v4-drag-verify > .refresh {\n position: absolute;\n right: 4px;\n top: 4px;\n z-index: 10;\n cursor: pointer;\n display: none;\n font-size: 24px;\n color: rgb(255, 255, 255);\n opacity: 0.7;\n}\n.paraui-v4-drag-verify > .refresh:hover {\n opacity: 1;\n}\n.paraui-v4-drag-verify > .slider-img {\n position: relative;\n border-radius: 4px;\n overflow: hidden;\n line-height: 0;\n min-height: 60px;\n}\n.paraui-v4-drag-verify > .slider-img .slider-img-bg {\n width: 100%;\n height: auto;\n border-radius: 4px;\n}\n.paraui-v4-drag-verify > .slider-img .slider-img-move {\n position: absolute;\n left: 0;\n height: auto;\n}\n.paraui-v4-drag-verify > .slider-move {\n position: relative;\n text-align: center;\n line-height: 32px;\n height: 32px;\n margin-top: 12px;\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-bg {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n background-color: rgb(247, 248, 250);\n height: 32px;\n border-radius: 4px;\n border: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-mask {\n position: absolute;\n left: 0;\n top: 0;\n height: 32px;\n width: 2px;\n border-bottom-left-radius: 4px;\n border-top-left-radius: 4px;\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-mask > .slider-move-box {\n position: absolute;\n top: 0;\n left: -1px;\n width: 32px;\n height: 32px;\n background: rgb(255, 255, 255);\n cursor: pointer;\n border-radius: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-mask > .slider-move-box:hover .svg-right {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-mask > .slider-move-box .svg-right {\n display: inline-block;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-mask > .slider-move-box .svg-close {\n display: none;\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-mask > .slider-move-box .svg-check {\n display: none;\n}\n.paraui-v4-drag-verify > .slider-move > .slider-move-text {\n color: rgb(161, 168, 179);\n font-size: 14px;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-move > .slider-move > .slider-move-mask {\n border: 1px solid rgb(46, 101, 230);\n border-width: 1px 0 1px 1px;\n background-color: rgb(213, 224, 250);\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-move > .slider-move > .slider-move-mask > .slider-move-box {\n background-color: rgb(46, 101, 230);\n border-top: 1px solid rgb(46, 101, 230);\n border-bottom: 1px solid rgb(46, 101, 230);\n top: -1px;\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-move > .slider-move > .slider-move-mask > .slider-move-box > .svg-right {\n color: rgb(255, 255, 255);\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-error > .slider-move > .slider-move-mask {\n border: 1px solid rgb(244, 66, 66);\n border-width: 1px 0 1px 1px;\n background-color: rgba(244, 66, 66, 0.1);\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-error > .slider-move > .slider-move-mask > .slider-move-box {\n background-color: rgb(244, 66, 66);\n border-top: 1px solid rgb(244, 66, 66);\n border-bottom: 1px solid rgb(244, 66, 66);\n top: -1px;\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-error > .slider-move > .slider-move-mask > .slider-move-box > .svg-close {\n display: inline-block;\n color: rgb(255, 255, 255);\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-error > .slider-move > .slider-move-mask > .slider-move-box > .svg-right {\n display: none;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-error > .slider-move > .slider-move-mask > .slider-move-box > .svg-check {\n display: none;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-success > .slider-move > .slider-move-mask {\n border: 1px solid rgb(19, 191, 76);\n border-width: 1px 0 1px 1px;\n background-color: rgba(19, 191, 76, 0.1);\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-success > .slider-move > .slider-move-mask > .slider-move-box {\n background-color: rgb(19, 191, 76);\n border-top: 1px solid rgb(19, 191, 76);\n border-bottom: 1px solid rgb(19, 191, 76);\n top: -1px;\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-success > .slider-move > .slider-move-mask > .slider-move-box .svg-close {\n display: none;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-success > .slider-move > .slider-move-mask > .slider-move-box .svg-right {\n display: none;\n}\n.paraui-v4-drag-verify.paraui-v4-drag-verify-success > .slider-move > .slider-move-mask > .slider-move-box .svg-check {\n display: inline-block;\n color: rgb(255, 255, 255);\n}";
|
|
36
32
|
styleInject(css_248z);
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var refDom = useRef(null);
|
|
56
|
-
var constData = useRef({
|
|
57
|
-
getImgInfo: getImgInfo,
|
|
58
|
-
verify: verify
|
|
34
|
+
const DragVerify = props => {
|
|
35
|
+
const {
|
|
36
|
+
className,
|
|
37
|
+
style,
|
|
38
|
+
refresh,
|
|
39
|
+
getImgInfo,
|
|
40
|
+
verify,
|
|
41
|
+
width,
|
|
42
|
+
height
|
|
43
|
+
} = props;
|
|
44
|
+
const intl = useFormatMessage('DragVerify', localeJson);
|
|
45
|
+
const [refreshCom, setRefreshCom] = useState();
|
|
46
|
+
const [loading, setLoading] = useState(false);
|
|
47
|
+
const refDom = useRef(null);
|
|
48
|
+
const constData = useRef({
|
|
49
|
+
getImgInfo,
|
|
50
|
+
verify
|
|
59
51
|
});
|
|
60
|
-
|
|
52
|
+
const prefixCls = "".concat($prefixCls, "-drag-verify");
|
|
61
53
|
constData.current.getImgInfo = getImgInfo;
|
|
62
54
|
constData.current.verify = verify;
|
|
63
|
-
useEffect(
|
|
55
|
+
useEffect(() => {
|
|
64
56
|
reset();
|
|
65
57
|
getImgInfoReq();
|
|
66
|
-
return
|
|
58
|
+
return () => {
|
|
67
59
|
clearTimeout(constData.current.timerError);
|
|
68
60
|
clearTimeout(constData.current.timerSuccess);
|
|
69
61
|
};
|
|
70
62
|
}, [refresh, refreshCom]);
|
|
71
63
|
/** 获取图片信息 */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
setLoading(true);
|
|
80
|
-
_context.next = 4;
|
|
81
|
-
return constData.current.getImgInfo();
|
|
82
|
-
case 4:
|
|
83
|
-
result = _context.sent;
|
|
84
|
-
constData.current.imgInfo = result;
|
|
85
|
-
initImg();
|
|
86
|
-
case 7:
|
|
87
|
-
case "end":
|
|
88
|
-
return _context.stop();
|
|
89
|
-
}
|
|
90
|
-
}, _callee);
|
|
91
|
-
}));
|
|
92
|
-
};
|
|
64
|
+
const getImgInfoReq = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
constData.current.padding = true;
|
|
66
|
+
setLoading(true);
|
|
67
|
+
const result = yield constData.current.getImgInfo();
|
|
68
|
+
constData.current.imgInfo = result;
|
|
69
|
+
initImg();
|
|
70
|
+
});
|
|
93
71
|
/** 校验滑块 */
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
99
|
-
case 0:
|
|
100
|
-
_context2.next = 2;
|
|
101
|
-
return constData.current.verify(x, constData.current.verify);
|
|
102
|
-
case 2:
|
|
103
|
-
result = _context2.sent;
|
|
104
|
-
callback(result);
|
|
105
|
-
case 4:
|
|
106
|
-
case "end":
|
|
107
|
-
return _context2.stop();
|
|
108
|
-
}
|
|
109
|
-
}, _callee2);
|
|
110
|
-
}));
|
|
111
|
-
};
|
|
72
|
+
const sliderPosiCheck = (x, callback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
const result = yield constData.current.verify(x, constData.current.verify);
|
|
74
|
+
callback(result);
|
|
75
|
+
});
|
|
112
76
|
/** 初始化图片 */
|
|
113
|
-
|
|
77
|
+
const initImg = () => {
|
|
114
78
|
var _a;
|
|
115
79
|
if (!refDom.current) return;
|
|
116
80
|
// 背景图
|
|
117
|
-
|
|
81
|
+
const imgBg = document.createElement('img');
|
|
118
82
|
imgBg.setAttribute('src', (_a = constData.current.imgInfo) === null || _a === void 0 ? void 0 : _a.sourceImage);
|
|
119
83
|
imgBg.style.display = 'none';
|
|
120
84
|
// 滑动的图片
|
|
121
|
-
|
|
85
|
+
const imgMove = document.createElement('img');
|
|
122
86
|
constData.current.imgMove = imgMove;
|
|
123
87
|
imgMove.className = 'slider-img-move';
|
|
124
88
|
imgMove.style.display = 'none';
|
|
125
|
-
|
|
126
|
-
|
|
89
|
+
const sliderImgEle = refDom.current.querySelector('.slider-img');
|
|
90
|
+
const refreshEle = refDom.current.querySelector('.refresh');
|
|
127
91
|
if (!sliderImgEle || !refreshEle) return;
|
|
128
92
|
refreshEle.style.display = 'none';
|
|
129
93
|
sliderImgEle.innerHTML = '';
|
|
130
94
|
sliderImgEle.append(imgBg);
|
|
131
|
-
imgBg.onload =
|
|
95
|
+
imgBg.onload = () => {
|
|
132
96
|
var _a;
|
|
133
97
|
imgBg.style.display = 'inline-block'; // 必须先显示图片,要不然ie10获取不到图片
|
|
134
98
|
imgMove.setAttribute('src', (_a = constData.current.imgInfo) === null || _a === void 0 ? void 0 : _a.newImage);
|
|
135
|
-
|
|
99
|
+
const a = imgBg.width;
|
|
136
100
|
imgBg.className = 'slider-img-bg';
|
|
137
101
|
imgBg.style.display = 'inline-block';
|
|
138
102
|
if (!refDom.current) return;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
103
|
+
const sliderImgEle = refDom.current.querySelector('.slider-img');
|
|
104
|
+
const sliderImgEleRect = sliderImgEle === null || sliderImgEle === void 0 ? void 0 : sliderImgEle.getBoundingClientRect();
|
|
105
|
+
const b = sliderImgEleRect.width;
|
|
142
106
|
constData.current.imgScale = a / b;
|
|
143
107
|
sliderImgEle === null || sliderImgEle === void 0 ? void 0 : sliderImgEle.append(imgMove);
|
|
144
|
-
imgMove.onload =
|
|
108
|
+
imgMove.onload = () => {
|
|
145
109
|
var _a;
|
|
146
110
|
constData.current.padding = false;
|
|
147
111
|
imgMove.style.display = 'inline-block'; // 必须先显示图片,要不然ie10获取不到图片
|
|
@@ -154,46 +118,46 @@ var DragVerify = function DragVerify(props) {
|
|
|
154
118
|
registerEvents(imgBg, imgMove);
|
|
155
119
|
};
|
|
156
120
|
/** 注册事件 */
|
|
157
|
-
|
|
158
|
-
|
|
121
|
+
const registerEvents = (imgBg, imgMove) => {
|
|
122
|
+
const sliderBox = refDom.current;
|
|
159
123
|
if (!sliderBox) return;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
moveDom.onmousedown =
|
|
124
|
+
const moveDom = sliderBox.querySelector('.slider-move-box'); // 滑块
|
|
125
|
+
const moveProgress = sliderBox.querySelector('.slider-move-mask'); // 滑动距离元素
|
|
126
|
+
const moveSliderEle = sliderBox.querySelector('.slider-move'); // 进度条的宽
|
|
127
|
+
const sliderText = sliderBox.querySelector('.slider-move-text'); // 互动轨道显示的文字
|
|
128
|
+
const moveSliderRect = moveSliderEle.getBoundingClientRect();
|
|
129
|
+
const moveDomRect = moveDom.getBoundingClientRect();
|
|
130
|
+
const moveDomWidth = moveDomRect.width; // 移动箭头的框
|
|
131
|
+
const moveSliderWidth = moveSliderRect.width; // 进度条的宽
|
|
132
|
+
moveDom.onmousedown = e => {
|
|
169
133
|
if (constData.current.padding) return;
|
|
170
134
|
sliderBox.classList.add("".concat(prefixCls, "-move"));
|
|
171
|
-
document.onmousemove =
|
|
172
|
-
|
|
135
|
+
document.onmousemove = event => {
|
|
136
|
+
let moveW = event.pageX - e.pageX; // 鼠标移动的距离
|
|
173
137
|
if (moveW < 0) moveW = 0;
|
|
174
138
|
if (moveW + moveDomWidth > imgBg.width) moveW = imgBg.width - moveDomWidth;
|
|
175
139
|
moveDom.style.left = "".concat(moveW - 1, "px");
|
|
176
140
|
// 加一防止滑块与进度条之间有间隙
|
|
177
141
|
moveProgress.style.width = "".concat(moveW < 2 ? 2 : moveW, "px");
|
|
178
142
|
// 进度条走过的比例
|
|
179
|
-
|
|
180
|
-
|
|
143
|
+
const ratio = moveW / (moveSliderWidth - moveDomWidth);
|
|
144
|
+
const imgMoveWidth = (imgBg.width - imgMove.width) * ratio;
|
|
181
145
|
imgMove.style.left = "".concat(imgMoveWidth, "px");
|
|
182
146
|
sliderText.innerHTML = '';
|
|
183
147
|
};
|
|
184
148
|
// 鼠标抬起
|
|
185
|
-
document.onmouseup =
|
|
149
|
+
document.onmouseup = () => {
|
|
186
150
|
document.onmousemove = null;
|
|
187
151
|
document.onmouseup = null;
|
|
188
152
|
sliderBox.classList.remove("".concat(prefixCls, "-move"));
|
|
189
153
|
constData.current.padding = true;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
sliderPosiCheck(handX,
|
|
154
|
+
const X = parseFloat(imgMove.style.left);
|
|
155
|
+
const handX = X * constData.current.imgScale;
|
|
156
|
+
sliderPosiCheck(handX, result => {
|
|
193
157
|
if (!result) {
|
|
194
158
|
// 错误
|
|
195
159
|
sliderBox.classList.add("".concat(prefixCls, "-error"));
|
|
196
|
-
constData.current.timerError = setTimeout(
|
|
160
|
+
constData.current.timerError = setTimeout(() => {
|
|
197
161
|
constData.current.padding = false;
|
|
198
162
|
reset();
|
|
199
163
|
sliderText.innerHTML = intl({
|
|
@@ -213,14 +177,14 @@ var DragVerify = function DragVerify(props) {
|
|
|
213
177
|
};
|
|
214
178
|
};
|
|
215
179
|
/** 复位 */
|
|
216
|
-
|
|
217
|
-
|
|
180
|
+
const reset = () => {
|
|
181
|
+
const sliderBox = refDom.current;
|
|
218
182
|
if (!sliderBox) return;
|
|
219
183
|
sliderBox.classList.remove("".concat(prefixCls, "-success"));
|
|
220
184
|
sliderBox.classList.remove("".concat(prefixCls, "-error"));
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
185
|
+
const moveDom = sliderBox.querySelector('.slider-move-box'); // 滑块
|
|
186
|
+
const moveProgress = sliderBox.querySelector('.slider-move-mask'); // 滑动距离元素
|
|
187
|
+
const sliderText = sliderBox.querySelector('.slider-move-text'); // 互动轨道显示的文字
|
|
224
188
|
sliderText.innerHTML = intl({
|
|
225
189
|
id: 'swipe'
|
|
226
190
|
}); // 再试一次
|
|
@@ -229,25 +193,25 @@ var DragVerify = function DragVerify(props) {
|
|
|
229
193
|
if (constData.current.imgMove) constData.current.imgMove.style.left = '0px';
|
|
230
194
|
};
|
|
231
195
|
/* 刷新 */
|
|
232
|
-
|
|
196
|
+
const clickRefresh = () => {
|
|
233
197
|
setRefreshCom(Math.random());
|
|
234
198
|
};
|
|
235
199
|
/* 处理标签内容 */
|
|
236
|
-
|
|
237
|
-
|
|
200
|
+
const handStyle = () => {
|
|
201
|
+
const obj = {};
|
|
238
202
|
if (width) {
|
|
239
|
-
|
|
203
|
+
let widthHand = width;
|
|
240
204
|
if (typeof width === 'number') widthHand = "".concat(width, "px");
|
|
241
205
|
obj.width = widthHand;
|
|
242
206
|
}
|
|
243
207
|
if (height) {
|
|
244
|
-
|
|
208
|
+
let heightHand = height;
|
|
245
209
|
if (typeof height === 'number') heightHand = "".concat(height, "px");
|
|
246
210
|
obj.height = heightHand;
|
|
247
211
|
}
|
|
248
212
|
return obj;
|
|
249
213
|
};
|
|
250
|
-
|
|
214
|
+
const makeCls = () => {
|
|
251
215
|
return clsx(prefixCls, className);
|
|
252
216
|
};
|
|
253
217
|
return jsxs("div", Object.assign({
|
package/Drawer/index.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
2
1
|
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
3
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
3
|
import { useState, useRef, useEffect } from 'react';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
import RcDrawer from 'rc-drawer';
|
|
7
6
|
import { Button } from '../Button/index.js';
|
|
8
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
9
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
7
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
8
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
10
9
|
import AutoTips from '../AutoTips/index.js';
|
|
11
10
|
import { isIE } from '@paraview/lib';
|
|
12
11
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
13
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
14
|
-
import '../_verture/typeof-adeedc13.js';
|
|
15
12
|
import '@para-ui/icons/LoadingF';
|
|
16
13
|
import '../Tooltip/index.js';
|
|
17
14
|
import 'rc-tooltip';
|
|
18
15
|
import 'rc-tooltip/lib/placements';
|
|
19
16
|
import '@para-ui/icons/Forbid';
|
|
20
17
|
import '@para-ui/icons/Down';
|
|
21
|
-
import '../_verture/index-
|
|
18
|
+
import '../_verture/index-da9097d3.js';
|
|
22
19
|
import 'rc-dropdown';
|
|
23
|
-
import '../_verture/usePopupContainer-
|
|
20
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
24
21
|
import 'dayjs';
|
|
25
22
|
import '@para-ui/core/GlobalContext';
|
|
26
23
|
|
|
@@ -35,8 +32,8 @@ var zh = {
|
|
|
35
32
|
};
|
|
36
33
|
|
|
37
34
|
var localeJson = {
|
|
38
|
-
zh
|
|
39
|
-
en
|
|
35
|
+
zh,
|
|
36
|
+
en
|
|
40
37
|
};
|
|
41
38
|
|
|
42
39
|
/**
|
|
@@ -44,8 +41,8 @@ var localeJson = {
|
|
|
44
41
|
* @param el 当前元素
|
|
45
42
|
* @param selector 查找元素class
|
|
46
43
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const closest = (el, selector) => {
|
|
45
|
+
const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
49
46
|
while (el) {
|
|
50
47
|
if (matchesSelector.call(el, selector)) {
|
|
51
48
|
break;
|
|
@@ -59,53 +56,43 @@ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/8 下
|
|
|
59
56
|
styleInject(css_248z);
|
|
60
57
|
|
|
61
58
|
//drawer 抽屉
|
|
62
|
-
|
|
59
|
+
const Drawer = props => {
|
|
63
60
|
var _a;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
distance: 100
|
|
86
|
-
} : _props$push,
|
|
61
|
+
const {
|
|
62
|
+
className,
|
|
63
|
+
resizable,
|
|
64
|
+
onClose,
|
|
65
|
+
destroyOnClose = false,
|
|
66
|
+
style,
|
|
67
|
+
title,
|
|
68
|
+
extra,
|
|
69
|
+
showExtra = true,
|
|
70
|
+
footer,
|
|
71
|
+
children,
|
|
72
|
+
size = 'large',
|
|
73
|
+
onOk,
|
|
74
|
+
onCancel,
|
|
75
|
+
afterVisibleChange,
|
|
76
|
+
okButtonProps,
|
|
77
|
+
cancelButtonProps,
|
|
78
|
+
push = {
|
|
79
|
+
distance: 100
|
|
80
|
+
}
|
|
81
|
+
} = props,
|
|
87
82
|
restProps = __rest(props, ["className", "resizable", "onClose", "destroyOnClose", "style", "title", "extra", "showExtra", "footer", "children", "size", "onOk", "onCancel", "afterVisibleChange", "okButtonProps", "cancelButtonProps", "push"]);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var timerRef = useRef();
|
|
102
|
-
var isHorizontal = ['left', 'right'].includes((_a = props.placement) !== null && _a !== void 0 ? _a : 'right');
|
|
103
|
-
var startRef = useRef(0);
|
|
104
|
-
var rootEleSize = useRef(0);
|
|
105
|
-
var initialContentEleSize = useRef();
|
|
106
|
-
var contentEleSize = useRef(0);
|
|
107
|
-
useEffect(function () {
|
|
108
|
-
return function () {
|
|
83
|
+
const intl = useFormatMessage('Drawer', localeJson);
|
|
84
|
+
const [, setRefresh] = useState(0);
|
|
85
|
+
const [offsetStyle, setOffsetStyle] = useState({});
|
|
86
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
87
|
+
const destroyCloseRef = useRef(false); //销毁标识
|
|
88
|
+
const timerRef = useRef();
|
|
89
|
+
const isHorizontal = ['left', 'right'].includes((_a = props.placement) !== null && _a !== void 0 ? _a : 'right');
|
|
90
|
+
const startRef = useRef(0);
|
|
91
|
+
const rootEleSize = useRef(0);
|
|
92
|
+
const initialContentEleSize = useRef();
|
|
93
|
+
const contentEleSize = useRef(0);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
return () => {
|
|
109
96
|
// 销毁时销毁timer
|
|
110
97
|
if (!timerRef.current) return;
|
|
111
98
|
clearTimeout(timerRef.current);
|
|
@@ -115,30 +102,30 @@ var Drawer = function Drawer(props) {
|
|
|
115
102
|
initialContentEleSize.current = undefined;
|
|
116
103
|
};
|
|
117
104
|
}, []);
|
|
118
|
-
useEffect(
|
|
105
|
+
useEffect(() => {
|
|
119
106
|
setOffsetStyle(getOffsetStyle);
|
|
120
107
|
if (!props.open) {
|
|
121
108
|
initialContentEleSize.current = undefined;
|
|
122
109
|
}
|
|
123
110
|
}, [props.open, props.placement, props.width, props.height, size]);
|
|
124
111
|
//设置drawer width、height
|
|
125
|
-
|
|
112
|
+
const getOffsetStyle = () => {
|
|
126
113
|
if (!props.open) {
|
|
127
114
|
return {};
|
|
128
115
|
}
|
|
129
|
-
|
|
116
|
+
const sizeMap = {
|
|
130
117
|
large: '1000px',
|
|
131
118
|
medium: '630px',
|
|
132
119
|
small: '400px'
|
|
133
120
|
};
|
|
134
|
-
|
|
121
|
+
const offsetStyle = {};
|
|
135
122
|
if (props.placement === 'left' || props.placement === 'right') {
|
|
136
|
-
|
|
123
|
+
const defaultWidth = sizeMap[size];
|
|
137
124
|
if (size !== 'auto') {
|
|
138
125
|
offsetStyle.width = props.width === undefined ? defaultWidth : props.width;
|
|
139
126
|
}
|
|
140
127
|
} else {
|
|
141
|
-
|
|
128
|
+
const defaultHeight = size === 'large' ? 736 : 378;
|
|
142
129
|
if (size !== 'auto') {
|
|
143
130
|
offsetStyle.height = props.height === undefined ? defaultHeight : props.height;
|
|
144
131
|
}
|
|
@@ -146,42 +133,42 @@ var Drawer = function Drawer(props) {
|
|
|
146
133
|
return offsetStyle;
|
|
147
134
|
};
|
|
148
135
|
//关闭回调
|
|
149
|
-
|
|
136
|
+
const handleClose = e => {
|
|
150
137
|
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
151
138
|
};
|
|
152
139
|
//确定回调
|
|
153
|
-
|
|
140
|
+
const handleOk = () => {
|
|
154
141
|
onOk === null || onOk === void 0 ? void 0 : onOk();
|
|
155
142
|
};
|
|
156
143
|
//取消回调
|
|
157
|
-
|
|
144
|
+
const handleCancel = () => {
|
|
158
145
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
159
146
|
};
|
|
160
|
-
|
|
147
|
+
const onHandlerMouseDown = e => {
|
|
161
148
|
var _a, _b, _c;
|
|
162
149
|
setIsResizing(true);
|
|
163
150
|
startRef.current = isHorizontal ? e.clientX : e.clientY;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
151
|
+
const rootEle = (_a = closest(e.target, ".".concat($prefixCls, "-drawer-open"))) !== null && _a !== void 0 ? _a : document.body;
|
|
152
|
+
const contentCls = ".".concat($prefixCls, "-drawer-content-wrapper");
|
|
153
|
+
const contentEle = (_b = closest(e.target, contentCls)) !== null && _b !== void 0 ? _b : rootEle.querySelector(contentCls);
|
|
167
154
|
rootEleSize.current = isHorizontal ? rootEle.offsetWidth : rootEle.offsetHeight;
|
|
168
155
|
contentEleSize.current = isHorizontal ? contentEle.offsetWidth : contentEle.offsetHeight;
|
|
169
156
|
initialContentEleSize.current = (_c = initialContentEleSize.current) !== null && _c !== void 0 ? _c : contentEleSize.current;
|
|
170
157
|
document.addEventListener('mousemove', onHandlerMouseMove);
|
|
171
158
|
document.addEventListener('mouseup', onHandlerMouseUp);
|
|
172
159
|
};
|
|
173
|
-
|
|
160
|
+
const onHandlerMouseUp = () => {
|
|
174
161
|
setIsResizing(false);
|
|
175
162
|
document.removeEventListener('mousemove', onHandlerMouseMove);
|
|
176
163
|
document.removeEventListener('mouseup', onHandlerMouseUp);
|
|
177
164
|
};
|
|
178
|
-
|
|
165
|
+
const onHandlerMouseMove = e => {
|
|
179
166
|
var _a;
|
|
180
|
-
|
|
167
|
+
const resizeMinimum = (_a = initialContentEleSize.current) !== null && _a !== void 0 ? _a : 400;
|
|
181
168
|
switch (props.placement) {
|
|
182
169
|
case 'left':
|
|
183
170
|
{
|
|
184
|
-
|
|
171
|
+
const newWidth = contentEleSize.current + (e.clientX - startRef.current);
|
|
185
172
|
if (newWidth + 100 >= rootEleSize.current || newWidth < resizeMinimum) return;
|
|
186
173
|
setOffsetStyle({
|
|
187
174
|
width: newWidth
|
|
@@ -190,16 +177,16 @@ var Drawer = function Drawer(props) {
|
|
|
190
177
|
}
|
|
191
178
|
case 'right':
|
|
192
179
|
{
|
|
193
|
-
|
|
194
|
-
if (
|
|
180
|
+
const newWidth = contentEleSize.current - (e.clientX - startRef.current);
|
|
181
|
+
if (newWidth + 100 >= rootEleSize.current || newWidth < resizeMinimum) return;
|
|
195
182
|
setOffsetStyle({
|
|
196
|
-
width:
|
|
183
|
+
width: newWidth
|
|
197
184
|
});
|
|
198
185
|
break;
|
|
199
186
|
}
|
|
200
187
|
case 'top':
|
|
201
188
|
{
|
|
202
|
-
|
|
189
|
+
const newHeight = contentEleSize.current + (e.clientY - startRef.current);
|
|
203
190
|
if (newHeight + 100 >= rootEleSize.current || newHeight < resizeMinimum) return;
|
|
204
191
|
setOffsetStyle({
|
|
205
192
|
height: newHeight
|
|
@@ -208,16 +195,16 @@ var Drawer = function Drawer(props) {
|
|
|
208
195
|
}
|
|
209
196
|
case 'bottom':
|
|
210
197
|
{
|
|
211
|
-
|
|
212
|
-
if (
|
|
198
|
+
const newHeight = contentEleSize.current - (e.clientY - startRef.current);
|
|
199
|
+
if (newHeight + 100 >= rootEleSize.current || newHeight < resizeMinimum) return;
|
|
213
200
|
setOffsetStyle({
|
|
214
|
-
height:
|
|
201
|
+
height: newHeight
|
|
215
202
|
});
|
|
216
203
|
break;
|
|
217
204
|
}
|
|
218
205
|
}
|
|
219
206
|
};
|
|
220
|
-
|
|
207
|
+
const handleTitle = title => {
|
|
221
208
|
if (typeof title === 'string') {
|
|
222
209
|
return jsx("div", Object.assign({
|
|
223
210
|
className: 'drawer-header-title drawer-header-title-ellipsis'
|
|
@@ -234,7 +221,7 @@ var Drawer = function Drawer(props) {
|
|
|
234
221
|
}));
|
|
235
222
|
};
|
|
236
223
|
//标题节点
|
|
237
|
-
|
|
224
|
+
const titleNode = jsxs("div", Object.assign({
|
|
238
225
|
className: 'drawer-body-header'
|
|
239
226
|
}, {
|
|
240
227
|
children: [jsx(Fragment, {
|
|
@@ -266,7 +253,7 @@ var Drawer = function Drawer(props) {
|
|
|
266
253
|
})]
|
|
267
254
|
}));
|
|
268
255
|
//渲染内容
|
|
269
|
-
|
|
256
|
+
const renderContent = () => {
|
|
270
257
|
if (!title && !footer) return children;
|
|
271
258
|
return jsxs("div", Object.assign({
|
|
272
259
|
className: 'drawer-content-body'
|
|
@@ -286,22 +273,20 @@ var Drawer = function Drawer(props) {
|
|
|
286
273
|
destroyCloseRef.current = false;
|
|
287
274
|
return null;
|
|
288
275
|
}
|
|
289
|
-
|
|
276
|
+
const maskMotion = {
|
|
290
277
|
motionName: "".concat($prefixCls, "-drawer-mask-motion"),
|
|
291
278
|
motionAppear: true,
|
|
292
279
|
motionEnter: true,
|
|
293
280
|
motionLeave: true,
|
|
294
281
|
motionDeadline: isIE() ? 0 : 100
|
|
295
282
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
};
|
|
304
|
-
};
|
|
283
|
+
const panelMotion = motionPlacement => ({
|
|
284
|
+
motionName: "".concat($prefixCls, "-drawer-panel-motion-").concat(motionPlacement),
|
|
285
|
+
motionAppear: true,
|
|
286
|
+
motionEnter: true,
|
|
287
|
+
motionLeave: true,
|
|
288
|
+
motionDeadline: isIE() ? 0 : 100
|
|
289
|
+
});
|
|
305
290
|
return jsxs(RcDrawer, Object.assign({}, restProps, offsetStyle, {
|
|
306
291
|
style: style,
|
|
307
292
|
maskMotion: maskMotion,
|
|
@@ -310,12 +295,12 @@ var Drawer = function Drawer(props) {
|
|
|
310
295
|
prefixCls: "".concat($prefixCls, "-drawer"),
|
|
311
296
|
rootClassName: clsx(className, isResizing && "".concat($prefixCls, "-drawer-resizing")),
|
|
312
297
|
onClose: handleClose,
|
|
313
|
-
afterOpenChange:
|
|
298
|
+
afterOpenChange: open => {
|
|
314
299
|
if (open) {
|
|
315
300
|
destroyCloseRef.current = false;
|
|
316
301
|
} else if (destroyOnClose) {
|
|
317
302
|
destroyCloseRef.current = true;
|
|
318
|
-
timerRef.current = setTimeout(
|
|
303
|
+
timerRef.current = setTimeout(() => {
|
|
319
304
|
setRefresh(Math.random());
|
|
320
305
|
}, 300);
|
|
321
306
|
}
|