@para-ui/core 3.0.28 → 3.0.30
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 +48 -88
- package/AutoTips/index.js +25 -32
- package/Breadcrumbs/index.js +43 -63
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/index.js +88 -118
- package/ButtonGroup/index.js +27 -36
- package/Carousel/index.d.ts +2 -2
- package/Carousel/index.js +27 -28
- package/Cascader/index.js +52 -64
- package/Checkbox/index.js +23 -39
- package/CheckboxGroup/index.js +31 -48
- package/Collapse/collapsePanel.d.ts +1 -1
- package/Collapse/index.d.ts +1 -1
- package/Collapse/index.js +9 -29
- package/Collapse/util.d.ts +2 -2
- package/CollapseBox/index.js +45 -56
- package/CollapseLayout/index.js +35 -54
- package/ComboSelect/index.js +222 -349
- package/ComboSelect/interface.d.ts +3 -3
- package/Container/index.js +17 -20
- package/DatePicker/generatePicker/index.d.ts +17 -17
- package/DatePicker/index.d.ts +4 -4
- package/DatePicker/index.js +111 -167
- package/Desktop/index.js +62 -173
- package/Drawer/index.js +65 -58
- package/Drawer/interface.d.ts +7 -3
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/index.js +3 -3
- package/Empty/index.js +17 -22
- package/Form/index.d.ts +1 -1
- package/Form/index.js +38 -80
- package/FormItem/index.d.ts +1 -1
- package/FormItem/index.js +11 -11
- package/FormItem/validateFunction.d.ts +1 -1
- package/FunctionModal/index.js +11 -11
- package/GlobalContext/index.js +3 -3
- package/GlobalContext/usePopupContainer.d.ts +1 -1
- package/Help/index.js +11 -11
- package/HelperText/index.js +11 -12
- package/InputLang/index.js +47 -80
- package/InputNumber/index.js +65 -100
- package/Label/index.js +15 -16
- package/Loading/index.js +6 -7
- package/Menu/index.js +148 -328
- package/Menu/interface.d.ts +2 -2
- package/Menu/verticalMenuList.d.ts +1 -1
- package/Message/index.d.ts +1 -1
- package/Message/index.js +45 -64
- package/Modal/Confirm/index.d.ts +2 -2
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +119 -152
- package/MultiBox/index.js +44 -76
- package/Notification/index.d.ts +2 -2
- package/Notification/index.js +51 -72
- package/OperateBtn/index.js +42 -70
- package/PageHeader/index.js +120 -286
- package/PageHeader/interface.d.ts +1 -1
- package/Pagination/index.d.ts +2 -2
- package/Pagination/index.js +79 -131
- package/ParauiProvider/index.js +2 -3
- package/PasswordRules/index.js +12 -30
- package/PopConfirm/index.d.ts +1 -1
- package/PopConfirm/index.js +52 -59
- package/Popover/index.js +8 -9
- package/Progress/index.d.ts +6 -6
- package/Progress/index.js +50 -89
- package/Querying/index.js +14 -17
- package/README.md +813 -800
- package/Radio/index.js +21 -33
- package/RadioGroup/index.js +32 -47
- package/Search/index.js +44 -66
- package/Select/index.js +176 -343
- package/SelectInput/index.js +8 -9
- package/Selector/index.js +285 -681
- package/SelectorPicker/index.js +62 -97
- package/SingleBox/index.js +30 -55
- package/Slider/index.d.ts +1 -1
- package/Slider/index.js +29 -41
- package/Slider/interface.d.ts +2 -2
- package/Split/index.js +10 -23
- package/Status/index.js +8 -7
- package/Stepper/index.d.ts +1 -1
- package/Stepper/index.js +20 -25
- package/Styles/form.scss +5 -5
- package/Styles/index.scss +37 -37
- package/Styles/normalize.scss +348 -348
- package/Styles/scrollbar.scss +223 -223
- package/Styles/theme.scss +74 -74
- package/Switch/index.d.ts +2 -2
- package/Switch/index.js +19 -20
- package/Table/index.js +568 -1019
- package/Table/interface.d.ts +5 -5
- package/Tabs/index.d.ts +3 -3
- package/Tabs/index.js +47 -65
- package/Tag/TagGroup.d.ts +1 -1
- package/Tag/index.d.ts +2 -2
- package/Tag/index.js +72 -107
- package/TextEditor/index.d.ts +2 -2
- package/TextEditor/index.js +81 -105
- package/TextField/index.js +141 -220
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/index.js +12 -15
- package/Timeline/index.js +42 -52
- package/Title/index.js +10 -9
- package/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/ToggleButton/index.js +50 -70
- package/Tooltip/index.js +64 -98
- package/Tooltip/interface.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +114 -137
- package/Transfer/useClick.d.ts +1 -1
- package/Tree/index.js +10 -10
- package/Tree/interface.d.ts +6 -6
- package/Upload/Dragger/index.d.ts +1 -1
- package/Upload/ImageUpload/index.d.ts +1 -1
- package/Upload/ImgCrop/EasyCrop.d.ts +1 -1
- package/Upload/index.d.ts +1 -1
- package/Upload/index.js +283 -475
- package/Upload/interface.d.ts +2 -2
- package/_verture/{constant-bf34e6fa.js → constant-66aa48a1.js} +0 -1
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/{index-342379c6.js → index-06fea29b.js} +79 -124
- package/_verture/{index-48875ffd.js → index-131f8fe5.js} +80 -181
- package/_verture/{index-31ce5a11.js → index-92144ad3.js} +238 -445
- package/_verture/{index-bbed73a3.js → index-be4faaee.js} +19 -61
- package/_verture/{intl-336570e4.js → intl-5cbb940c.js} +4 -12
- package/_verture/{modalContext-d646d9db.js → modalContext-c749e1c6.js} +18 -43
- package/_verture/{slicedToArray-d7722f4b.js → slicedToArray-77980792.js} +23 -25
- package/_verture/{toConsumableArray-f8047a75.js → toConsumableArray-87c7d895.js} +1 -1
- package/_verture/{useFormatMessage-f4452258.js → useFormatMessage-703f8b20.js} +1 -3
- package/_verture/{useGlobalProps-af9a2af6.js → useGlobalProps-1b846a65.js} +1 -2
- package/_verture/{usePopupContainer-b8ab7cab.js → usePopupContainer-87febeb9.js} +10 -25
- package/_verture/{util-a77b261e.js → util-7e1fb1e2.js} +2 -3
- package/index.d.ts +2 -4
- package/index.js +15 -16
- package/package.json +167 -168
- package/Test/index.d.ts +0 -3
- package/Test/index.js +0 -9
- package/_verture/defineProperty-0590dc61.js +0 -16
package/CollapseBox/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
1
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-77980792.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { Transition } from 'react-transition-group';
|
|
5
|
-
import { g as getTransitionProps, a as getAutoHeightDuration } from '../_verture/util-
|
|
6
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
5
|
+
import { g as getTransitionProps, a as getAutoHeightDuration } from '../_verture/util-7e1fb1e2.js';
|
|
6
|
+
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
|
|
7
7
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
8
8
|
|
|
9
9
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-collapse-box {\n transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n width: 100%;\n overflow: hidden;\n height: 0;\n}\n.paraui-v3-collapse-box > .collapse-box-wrapper {\n display: flex;\n width: 100%;\n}\n.paraui-v3-collapse-box > .collapse-box-wrapper > .collapse-box-wrapper-inner {\n width: 100%;\n}\n.paraui-v3-collapse-box.paraui-v3-collapse-box-entered {\n overflow: visible;\n}\n.paraui-v3-collapse-box.paraui-v3-collapse-box-hidden {\n visibility: hidden;\n}";
|
|
@@ -11,30 +11,28 @@ styleInject(css_248z);
|
|
|
11
11
|
|
|
12
12
|
var CollapseBox = function CollapseBox(props) {
|
|
13
13
|
var className = props.className,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var timer = useRef(null);
|
|
24
|
-
|
|
25
|
-
var nodeRef = useRef(null);
|
|
26
|
-
|
|
27
|
-
var wrapperRef = useRef(null);
|
|
28
|
-
|
|
29
|
-
var autoTransitionDuration = useRef(null);
|
|
30
|
-
|
|
14
|
+
style = props.style,
|
|
15
|
+
open = props.in,
|
|
16
|
+
_props$collapsedHeigh = props.collapsedHeight,
|
|
17
|
+
collapsedHeightProp = _props$collapsedHeigh === void 0 ? '0px' : _props$collapsedHeigh,
|
|
18
|
+
_props$timeout = props.timeout,
|
|
19
|
+
timeout = _props$timeout === void 0 ? 'auto' : _props$timeout,
|
|
20
|
+
unmountOnExit = props.unmountOnExit,
|
|
21
|
+
_children = props.children;
|
|
22
|
+
// timer
|
|
23
|
+
var timer = useRef(null);
|
|
24
|
+
// 动画节点
|
|
25
|
+
var nodeRef = useRef(null);
|
|
26
|
+
// 内置容器
|
|
27
|
+
var wrapperRef = useRef(null);
|
|
28
|
+
// 存储动画时间变量
|
|
29
|
+
var autoTransitionDuration = useRef(null);
|
|
30
|
+
// 下拉收起的高度
|
|
31
31
|
var collapsedHeight = typeof collapsedHeightProp === 'number' ? "".concat(collapsedHeightProp, "px") : collapsedHeightProp;
|
|
32
|
-
|
|
33
32
|
var _useState = useState(false),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
inProp = _useState2[0],
|
|
35
|
+
setInProp = _useState2[1];
|
|
38
36
|
useEffect(function () {
|
|
39
37
|
return function () {
|
|
40
38
|
clearTimeout(timer.current);
|
|
@@ -42,31 +40,28 @@ var CollapseBox = function CollapseBox(props) {
|
|
|
42
40
|
}, []);
|
|
43
41
|
useEffect(function () {
|
|
44
42
|
setInProp(open);
|
|
45
|
-
}, [open]);
|
|
46
|
-
|
|
43
|
+
}, [open]);
|
|
44
|
+
// 处理节点
|
|
47
45
|
var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
|
|
48
46
|
return function (nodeOrAppearing) {
|
|
49
47
|
if (callback) {
|
|
50
48
|
callback(nodeOrAppearing);
|
|
51
49
|
}
|
|
52
50
|
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
};
|
|
52
|
+
// 下拉
|
|
56
53
|
var handleEnter = normalizedTransitionCallback(function (node) {
|
|
57
54
|
node.style.height = collapsedHeight;
|
|
58
55
|
});
|
|
59
56
|
var handleEntering = normalizedTransitionCallback(function (node) {
|
|
60
57
|
var wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0;
|
|
61
|
-
|
|
62
58
|
var _getTransitionProps = getTransitionProps({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
style: style,
|
|
60
|
+
timeout: timeout
|
|
61
|
+
}, {
|
|
62
|
+
mode: 'enter'
|
|
63
|
+
}),
|
|
64
|
+
transitionDuration = _getTransitionProps.duration;
|
|
70
65
|
if (timeout === 'auto') {
|
|
71
66
|
var duration2 = getAutoHeightDuration(wrapperHeight);
|
|
72
67
|
node.style.transitionDuration = "".concat(duration2, "ms");
|
|
@@ -74,28 +69,25 @@ var CollapseBox = function CollapseBox(props) {
|
|
|
74
69
|
} else {
|
|
75
70
|
node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : "".concat(transitionDuration, "ms");
|
|
76
71
|
}
|
|
77
|
-
|
|
78
72
|
node.style.height = "".concat(wrapperHeight, "px");
|
|
79
73
|
});
|
|
80
74
|
var handleEntered = normalizedTransitionCallback(function (node) {
|
|
81
75
|
node.style.height = 'auto';
|
|
82
|
-
});
|
|
83
|
-
|
|
76
|
+
});
|
|
77
|
+
// 收起
|
|
84
78
|
var handleExit = normalizedTransitionCallback(function (node) {
|
|
85
79
|
var wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0;
|
|
86
80
|
node.style.height = "".concat(wrapperHeight, "px");
|
|
87
81
|
});
|
|
88
82
|
var handleExiting = normalizedTransitionCallback(function (node) {
|
|
89
83
|
var wrapperHeight = wrapperRef.current ? wrapperRef.current.clientHeight : 0;
|
|
90
|
-
|
|
91
84
|
var _getTransitionProps2 = getTransitionProps({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
style: style,
|
|
86
|
+
timeout: timeout
|
|
87
|
+
}, {
|
|
88
|
+
mode: 'exit'
|
|
89
|
+
}),
|
|
90
|
+
transitionDuration = _getTransitionProps2.duration;
|
|
99
91
|
if (timeout === 'auto') {
|
|
100
92
|
var duration2 = getAutoHeightDuration(wrapperHeight);
|
|
101
93
|
node.style.transitionDuration = "".concat(duration2, "ms");
|
|
@@ -103,15 +95,13 @@ var CollapseBox = function CollapseBox(props) {
|
|
|
103
95
|
} else {
|
|
104
96
|
node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : "".concat(transitionDuration, "ms");
|
|
105
97
|
}
|
|
106
|
-
|
|
107
98
|
node.style.height = collapsedHeight;
|
|
108
|
-
});
|
|
109
|
-
|
|
99
|
+
});
|
|
100
|
+
// 完成下拉/收起回调
|
|
110
101
|
var addEndListener = function addEndListener(nodeOrNext, maybeNext) {
|
|
111
102
|
timer.current = setTimeout(maybeNext, autoTransitionDuration.current || 0);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
};
|
|
104
|
+
// 处理className
|
|
115
105
|
var handClass = function handClass(state) {
|
|
116
106
|
var str = $prefixCls + '-collapse-box';
|
|
117
107
|
if (className) str += ' ' + className;
|
|
@@ -119,7 +109,6 @@ var CollapseBox = function CollapseBox(props) {
|
|
|
119
109
|
if (state === 'exited' && !inProp && collapsedHeight === '0px') str += " ".concat($prefixCls, "-collapse-box-hidden");
|
|
120
110
|
return str;
|
|
121
111
|
};
|
|
122
|
-
|
|
123
112
|
return jsx(Transition, Object.assign({
|
|
124
113
|
in: inProp,
|
|
125
114
|
unmountOnExit: unmountOnExit,
|
package/CollapseLayout/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-
|
|
2
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
1
|
+
import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
|
|
2
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-77980792.js';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useRef, useState, useEffect } from 'react';
|
|
5
5
|
import DoubleLeft from '@para-ui/icons/DoubleLeft';
|
|
6
6
|
import DoubleRight from '@para-ui/icons/DoubleRight';
|
|
7
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
7
|
+
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import { a as getAutoHeightDuration } from '../_verture/util-
|
|
9
|
+
import { a as getAutoHeightDuration } from '../_verture/util-7e1fb1e2.js';
|
|
10
10
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
11
|
+
import '../_verture/typeof-498dd2b1.js';
|
|
11
12
|
|
|
12
13
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-collapse-layout {\n height: 100%;\n width: 100%;\n position: relative;\n overflow: hidden;\n}\n.paraui-v3-collapse-layout .collapse-layout-icon-transform-top {\n transform: rotate(90deg);\n}\n.paraui-v3-collapse-layout .collapse-layout-icon-transform-bottom {\n transform: rotate(-90deg);\n}\n.paraui-v3-collapse-layout .collapse-layout-icon-transform-right {\n transform: rotate(180deg);\n}\n.paraui-v3-collapse-layout .collapse-layout-display {\n overflow: hidden;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-click span, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-click span, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-top .collapse-layout-click span, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom .collapse-layout-click span {\n font-size: 12px;\n font-weight: 400;\n text-align: center;\n color: rgb(54, 102, 214);\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-click {\n position: absolute;\n top: 50%;\n left: \"\";\n width: 20px;\n height: 72px;\n background: rgba(171, 176, 185, 0.12);\n text-align: center;\n cursor: pointer;\n margin-top: -36px;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n transition-property: right;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n right: 0px;\n border-radius: 4px 0 0 4px;\n border-right: 1px solid rgb(54, 102, 214);\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-display-shadow {\n transition-property: margin-right;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-click {\n position: absolute;\n top: 50%;\n left: 0;\n width: 20px;\n height: 72px;\n background: rgba(171, 176, 185, 0.12);\n text-align: center;\n cursor: pointer;\n margin-top: -36px;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n transition-property: left;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n border-left: 1px solid rgb(54, 102, 214);\n border-radius: 0 4px 4px 0;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-display-shadow {\n transition-property: margin-left;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left > div, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-right > div {\n display: inline-block;\n vertical-align: middle;\n height: 100%;\n position: relative;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-display-shadow, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-display-shadow {\n height: 100%;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-display,\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-default, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-display,\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-default {\n transition: width;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-left .collapse-layout-click, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-right .collapse-layout-click {\n flex-direction: column;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-top .collapse-layout-click {\n position: absolute;\n top: 0;\n left: 50%;\n width: 72px;\n height: 20px;\n background: rgba(171, 176, 185, 0.12);\n text-align: center;\n cursor: pointer;\n margin-top: 0;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n transition-property: top;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n margin-left: -36px;\n border-top: 1px solid rgb(54, 102, 214);\n border-radius: 0 0 4px 4px;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-top .collapse-layout-display-shadow {\n transition-property: margin-top;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom .collapse-layout-click {\n position: absolute;\n top: \"\";\n left: 50%;\n width: 72px;\n height: 20px;\n background: rgba(171, 176, 185, 0.12);\n text-align: center;\n cursor: pointer;\n margin-top: 0;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n transition-property: bottom;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n margin-left: -36px;\n bottom: 0px;\n border-bottom: 1px solid rgb(54, 102, 214);\n border-radius: 4px 4px 0 0;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom .collapse-layout-display-shadow {\n transition-property: margin-bottom;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-top .collapse-layout-display,\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-top .collapse-layout-default, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom .collapse-layout-display,\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom .collapse-layout-default {\n transition-property: height;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 0ms;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-top .collapse-layout-display-shadow, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom .collapse-layout-display-shadow {\n width: 100%;\n}\n.paraui-v3-collapse-layout.paraui-v3-collapse-layout-top > div, .paraui-v3-collapse-layout.paraui-v3-collapse-layout-bottom > div {\n display: block;\n width: 100%;\n position: relative;\n}";
|
|
13
14
|
styleInject(css_248z);
|
|
@@ -16,28 +17,26 @@ styleInject(css_248z);
|
|
|
16
17
|
* @author zhanzl
|
|
17
18
|
* @date 2022/08/09
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
var CollapseLayout = function CollapseLayout(props) {
|
|
21
21
|
var _props$type = props.type,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
type = _props$type === void 0 ? 'left' : _props$type,
|
|
23
|
+
showLabel = props.showLabel,
|
|
24
|
+
_props$open = props.open,
|
|
25
|
+
open = _props$open === void 0 ? false : _props$open,
|
|
26
|
+
hideLabel = props.hideLabel,
|
|
27
|
+
_props$spacing = props.spacing,
|
|
28
|
+
spacing = _props$spacing === void 0 ? 20 : _props$spacing,
|
|
29
|
+
_props$zoomLength = props.zoomLength,
|
|
30
|
+
zoomLength = _props$zoomLength === void 0 ? 0 : _props$zoomLength,
|
|
31
|
+
_props$unit = props.unit,
|
|
32
|
+
unit = _props$unit === void 0 ? 'px' : _props$unit,
|
|
33
|
+
style = props.style,
|
|
34
|
+
_props$className = props.className,
|
|
35
|
+
className = _props$className === void 0 ? '' : _props$className;
|
|
36
36
|
var displayRef = useRef(null);
|
|
37
37
|
/**
|
|
38
38
|
* 处理动画时间
|
|
39
39
|
* */
|
|
40
|
-
|
|
41
40
|
var handTime = function handTime() {
|
|
42
41
|
var dom = displayRef.current;
|
|
43
42
|
if (!dom) return 0;
|
|
@@ -45,19 +44,15 @@ var CollapseLayout = function CollapseLayout(props) {
|
|
|
45
44
|
var durationHand = getAutoHeightDuration(rect.width);
|
|
46
45
|
return durationHand;
|
|
47
46
|
};
|
|
48
|
-
|
|
49
47
|
var duration = handTime(); // 动画时间
|
|
50
|
-
|
|
51
48
|
/**
|
|
52
49
|
* 当前为收起还是展开
|
|
53
50
|
*/
|
|
54
|
-
|
|
55
51
|
var _useState = useState(),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
showBox = _useState2[0],
|
|
54
|
+
setShowBox = _useState2[1];
|
|
55
|
+
// 渲染配置
|
|
61
56
|
var typeConfig = {
|
|
62
57
|
layout: {
|
|
63
58
|
left: ['display', 'default'],
|
|
@@ -65,36 +60,30 @@ var CollapseLayout = function CollapseLayout(props) {
|
|
|
65
60
|
top: ['display', 'default'],
|
|
66
61
|
bottom: ['default', 'display']
|
|
67
62
|
}
|
|
68
|
-
};
|
|
69
|
-
|
|
63
|
+
};
|
|
64
|
+
// 首字母大写
|
|
70
65
|
var formatterType = function formatterType(str) {
|
|
71
66
|
var newStr = str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
72
67
|
return newStr;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
};
|
|
69
|
+
// 计算方位
|
|
76
70
|
var hangWH = function hangWH() {
|
|
77
71
|
var wH = 'width';
|
|
78
|
-
|
|
79
72
|
if (type === "top" || type === "bottom") {
|
|
80
73
|
wH = 'height';
|
|
81
74
|
}
|
|
82
|
-
|
|
83
75
|
return wH;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
};
|
|
77
|
+
// 收缩容器的样式
|
|
87
78
|
var handDisplayStyle = function handDisplayStyle() {
|
|
88
79
|
var json = {};
|
|
89
80
|
var collapseL = (showBox ? zoomLength : 0) + unit; // 收缩长度
|
|
90
|
-
|
|
91
81
|
var wH = hangWH();
|
|
92
82
|
json[wH] = collapseL;
|
|
93
83
|
json['transitionDuration'] = duration + 'ms';
|
|
94
84
|
return json;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
};
|
|
86
|
+
// 收缩容器的样式,里面的样式
|
|
98
87
|
var handDisplayShowStyle = function handDisplayShowStyle() {
|
|
99
88
|
var json = {};
|
|
100
89
|
var direction = "margin".concat(formatterType(type));
|
|
@@ -103,22 +92,19 @@ var CollapseLayout = function CollapseLayout(props) {
|
|
|
103
92
|
json[direction] = (showBox ? 0 : zoomLength) + unit;
|
|
104
93
|
json['transitionDuration'] = duration + 'ms';
|
|
105
94
|
return json;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
};
|
|
96
|
+
// 自适应容器的样式
|
|
109
97
|
var handDefaultStyle = function handDefaultStyle() {
|
|
110
98
|
var json = {};
|
|
111
99
|
var wH = hangWH();
|
|
112
100
|
var collapseL = showBox ? zoomLength : 0; // 收缩长度
|
|
113
|
-
|
|
114
101
|
json[wH] = "calc(100% - ".concat(collapseL + spacing).concat(unit);
|
|
115
102
|
var direction = "margin".concat(formatterType(type));
|
|
116
103
|
json[direction] = spacing + unit;
|
|
117
104
|
json['transitionDuration'] = duration + 'ms';
|
|
118
105
|
return json;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
};
|
|
107
|
+
// 布局
|
|
122
108
|
var Layout = function Layout() {
|
|
123
109
|
return typeConfig.layout[type].map(function (key, idx) {
|
|
124
110
|
switch (key) {
|
|
@@ -136,7 +122,6 @@ var CollapseLayout = function CollapseLayout(props) {
|
|
|
136
122
|
children: props.displayContent
|
|
137
123
|
}))
|
|
138
124
|
}), idx);
|
|
139
|
-
|
|
140
125
|
default:
|
|
141
126
|
return jsx("div", Object.assign({
|
|
142
127
|
className: "collapse-layout-default",
|
|
@@ -150,11 +135,8 @@ var CollapseLayout = function CollapseLayout(props) {
|
|
|
150
135
|
/**
|
|
151
136
|
* 展开收起按钮
|
|
152
137
|
* */
|
|
153
|
-
|
|
154
|
-
|
|
155
138
|
var handBtn = function handBtn() {
|
|
156
139
|
var _style;
|
|
157
|
-
|
|
158
140
|
/**
|
|
159
141
|
* 计算后的展示文字
|
|
160
142
|
*/
|
|
@@ -175,7 +157,6 @@ var CollapseLayout = function CollapseLayout(props) {
|
|
|
175
157
|
})]
|
|
176
158
|
}));
|
|
177
159
|
};
|
|
178
|
-
|
|
179
160
|
useEffect(function () {
|
|
180
161
|
setShowBox(open);
|
|
181
162
|
}, [open]);
|