@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/AutoBox/index.js
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
2
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { useState, useRef, useEffect, Fragment as Fragment$1 } from 'react';
|
|
4
3
|
import { Popover } from '../Popover/index.js';
|
|
5
4
|
import { createPortal } from 'react-dom';
|
|
6
5
|
import { UUID } from '@paraview/lib';
|
|
7
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
6
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
8
7
|
import More from '@para-ui/icons/More';
|
|
9
8
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
10
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
11
9
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
12
10
|
import '../Tooltip/index.js';
|
|
13
11
|
import 'rc-tooltip';
|
|
14
12
|
import 'rc-tooltip/lib/placements';
|
|
15
13
|
import 'clsx';
|
|
16
14
|
import '@para-ui/icons/Forbid';
|
|
17
|
-
import '../_verture/usePopupContainer-
|
|
15
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var constData = useRef({
|
|
17
|
+
const Protal = props => {
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
anchorEl,
|
|
22
|
+
onClose
|
|
23
|
+
} = props;
|
|
24
|
+
const [styleCom, setStyleCom] = useState({});
|
|
25
|
+
const constData = useRef({
|
|
29
26
|
uuid: "".concat($prefixCls, "-protal-box-content-").concat(UUID())
|
|
30
27
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
useEffect(
|
|
28
|
+
const domRef = useRef();
|
|
29
|
+
const contentRef = useRef();
|
|
30
|
+
useEffect(() => {
|
|
34
31
|
handStyle();
|
|
35
32
|
window.addEventListener('click', clickFunc);
|
|
36
|
-
return
|
|
33
|
+
return () => {
|
|
37
34
|
domRef && domRef.current && domRef.current.remove();
|
|
38
35
|
window.removeEventListener('click', clickFunc);
|
|
39
36
|
};
|
|
@@ -43,8 +40,8 @@ var Protal = function Protal(props) {
|
|
|
43
40
|
* @param el 当前元素
|
|
44
41
|
* @param selector 查找元素class
|
|
45
42
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const closest = (el, selector) => {
|
|
44
|
+
const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
48
45
|
while (el) {
|
|
49
46
|
if (matchesSelector.call(el, selector)) {
|
|
50
47
|
break;
|
|
@@ -54,23 +51,23 @@ var Protal = function Protal(props) {
|
|
|
54
51
|
return el;
|
|
55
52
|
};
|
|
56
53
|
/** 全局监听点击事件 */
|
|
57
|
-
|
|
54
|
+
const clickFunc = e => {
|
|
58
55
|
if (!constData.current) return;
|
|
59
|
-
|
|
56
|
+
const bol = closest(e.target, ".".concat(constData.current.uuid)); // 是否存在下拉当中
|
|
60
57
|
if (!bol) onClose && onClose();
|
|
61
58
|
};
|
|
62
59
|
/** 处理内容的定位样式 */
|
|
63
|
-
|
|
60
|
+
const handStyle = () => {
|
|
64
61
|
if (!anchorEl || !contentRef.current) return;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
const posDomRect = anchorEl.getBoundingClientRect();
|
|
63
|
+
const contentDomRect = contentRef.current.getBoundingClientRect();
|
|
64
|
+
const json = {
|
|
68
65
|
opacity: 1,
|
|
69
66
|
left: posDomRect.left,
|
|
70
67
|
top: posDomRect.top + posDomRect.height
|
|
71
68
|
};
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const winHeight = window.innerHeight;
|
|
70
|
+
const winWidth = window.innerWidth;
|
|
74
71
|
if (json.left + contentDomRect.width > winWidth) {
|
|
75
72
|
json.left = winWidth - contentDomRect.width - 8;
|
|
76
73
|
if (json.left < 0) json.left = 0;
|
|
@@ -82,12 +79,12 @@ var Protal = function Protal(props) {
|
|
|
82
79
|
setStyleCom(json);
|
|
83
80
|
};
|
|
84
81
|
/** 处理className */
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const handClass = () => {
|
|
83
|
+
let str = "".concat($prefixCls, "-protal-box");
|
|
87
84
|
if (className) str += " ".concat(className);
|
|
88
85
|
return str;
|
|
89
86
|
};
|
|
90
|
-
|
|
87
|
+
const handContent = () => {
|
|
91
88
|
return jsxs("div", Object.assign({
|
|
92
89
|
className: handClass(),
|
|
93
90
|
ref: domRef
|
|
@@ -108,88 +105,78 @@ var Protal = function Protal(props) {
|
|
|
108
105
|
});
|
|
109
106
|
};
|
|
110
107
|
|
|
111
|
-
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-box {\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n}\n.paraui-v4-auto-box > .auto-box-more {\n display: inline-block;\n height: 100%;\n cursor: pointer;\n vertical-align: middle;\n}\n\n.paraui-v4-auto-box-popover .auto-box-popover-content {\n display: flex;\n flex-direction: column;\n}\n\n.paraui-v4-protal-box {\n position: fixed;\n z-index: 1500;\n inset: 0px;\n}\n.paraui-v4-protal-box .protal-mask {\n z-index: -1;\n position: fixed;\n inset: 0px;\n background-color: transparent;\n}\n.paraui-v4-protal-box .protal-content {\n border-radius: 4px;\n box-shadow:
|
|
108
|
+
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-box {\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n}\n.paraui-v4-auto-box > .auto-box-more {\n display: inline-block;\n height: 100%;\n cursor: pointer;\n vertical-align: middle;\n}\n\n.paraui-v4-auto-box-popover .auto-box-popover-content {\n display: flex;\n flex-direction: column;\n}\n\n.paraui-v4-protal-box {\n position: fixed;\n z-index: 1500;\n inset: 0px;\n}\n.paraui-v4-protal-box .protal-mask {\n z-index: -1;\n position: fixed;\n inset: 0px;\n background-color: transparent;\n}\n.paraui-v4-protal-box .protal-content {\n border-radius: 4px;\n box-shadow: 1px 1px 10px 2px rgba(212, 218, 227, 0.4);\n background-color: white;\n outline: 0;\n position: absolute;\n max-width: calc(100% - 32px);\n min-width: 16px;\n max-height: calc(100% - 32px);\n min-height: 16px;\n overflow-x: hidden;\n overflow-y: auto;\n opacity: 0;\n transform: none;\n transition: opacity 243ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 162ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}";
|
|
112
109
|
styleInject(css_248z);
|
|
113
110
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
list =
|
|
118
|
-
popoverClassName
|
|
119
|
-
moreCustomize
|
|
120
|
-
anchorEl
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
morePos = _useState2[0],
|
|
135
|
-
setMorePos = _useState2[1]; // 超出在原始位置
|
|
136
|
-
var _useState3 = useState(false),
|
|
137
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
138
|
-
openMoreCom = _useState4[0],
|
|
139
|
-
setOpenMoreCom = _useState4[1]; // 显示更多
|
|
140
|
-
var _useState5 = useState({}),
|
|
141
|
-
_useState6 = _slicedToArray(_useState5, 1),
|
|
142
|
-
timer = _useState6[0];
|
|
143
|
-
var posDom = useRef();
|
|
111
|
+
const AutoBox = props => {
|
|
112
|
+
const {
|
|
113
|
+
className,
|
|
114
|
+
list = [],
|
|
115
|
+
popoverClassName,
|
|
116
|
+
moreCustomize,
|
|
117
|
+
anchorEl,
|
|
118
|
+
hideMore = false,
|
|
119
|
+
showNum,
|
|
120
|
+
onCloseMore,
|
|
121
|
+
onShowMore,
|
|
122
|
+
style,
|
|
123
|
+
trigger = 'click',
|
|
124
|
+
placement = 'bottomLeft'
|
|
125
|
+
} = props;
|
|
126
|
+
const comRef = useRef(null);
|
|
127
|
+
const [morePos, setMorePos] = useState(null); // 超出在原始位置
|
|
128
|
+
const [openMoreCom, setOpenMoreCom] = useState(false); // 显示更多
|
|
129
|
+
const [timer] = useState({});
|
|
130
|
+
const posDom = useRef();
|
|
144
131
|
// 监听打开更多
|
|
145
|
-
useEffect(
|
|
132
|
+
useEffect(() => {
|
|
146
133
|
if (props.openMore !== undefined) {
|
|
147
134
|
setOpenMoreCom(props.openMore);
|
|
148
135
|
}
|
|
149
136
|
}, [props.openMore]);
|
|
150
|
-
useEffect(
|
|
137
|
+
useEffect(() => {
|
|
151
138
|
if (props.showNum !== undefined) return;
|
|
152
139
|
changeSize();
|
|
153
140
|
window.addEventListener('resize', changeSize);
|
|
154
|
-
return
|
|
141
|
+
return () => {
|
|
155
142
|
window.removeEventListener('resize', changeSize);
|
|
156
143
|
clearTimeout(timer.timer);
|
|
157
144
|
};
|
|
158
145
|
}, [list]);
|
|
159
|
-
useEffect(
|
|
146
|
+
useEffect(() => {
|
|
160
147
|
if (showNum !== undefined) {
|
|
161
148
|
setMorePos(showNum);
|
|
162
149
|
window.removeEventListener('resize', changeSize);
|
|
163
150
|
}
|
|
164
151
|
}, [showNum]);
|
|
165
|
-
useEffect(
|
|
152
|
+
useEffect(() => {
|
|
166
153
|
if (morePos !== null && list.length > morePos) {
|
|
167
154
|
onShowMore && onShowMore(true);
|
|
168
155
|
} else {
|
|
169
156
|
onShowMore && onShowMore(false);
|
|
170
157
|
}
|
|
171
158
|
}, [list, morePos, onShowMore]);
|
|
172
|
-
|
|
159
|
+
const onVisibleChange = bol => {
|
|
173
160
|
if (bol) return setOpenMoreCom(true);
|
|
174
161
|
closeMore();
|
|
175
162
|
};
|
|
176
163
|
// 关闭显示更多
|
|
177
|
-
|
|
164
|
+
const closeMore = () => {
|
|
178
165
|
setOpenMoreCom(false);
|
|
179
166
|
onCloseMore && onCloseMore();
|
|
180
167
|
};
|
|
181
168
|
// 关闭显示更多
|
|
182
|
-
|
|
169
|
+
const handleCloseMore = () => {
|
|
183
170
|
closeMore();
|
|
184
171
|
};
|
|
185
172
|
// 不换行 计算
|
|
186
|
-
|
|
173
|
+
const handMultiline = index => {
|
|
187
174
|
if (index === null || index === 0) return;
|
|
188
175
|
if (index === undefined) index = list.length;
|
|
189
|
-
|
|
176
|
+
const boxDom = comRef.current;
|
|
190
177
|
if (!boxDom) return;
|
|
191
178
|
if (boxDom.scrollWidth > boxDom.clientWidth) {
|
|
192
|
-
|
|
179
|
+
const num = Number(index) - 1;
|
|
193
180
|
// 超出
|
|
194
181
|
setMorePos(num);
|
|
195
182
|
handMultiline(num);
|
|
@@ -199,32 +186,32 @@ var AutoBox = function AutoBox(props) {
|
|
|
199
186
|
}
|
|
200
187
|
};
|
|
201
188
|
// 多选 不换行
|
|
202
|
-
|
|
189
|
+
const changeSize = () => {
|
|
203
190
|
clearTimeout(timer.timer);
|
|
204
191
|
closeMore();
|
|
205
|
-
timer.timer = setTimeout(
|
|
192
|
+
timer.timer = setTimeout(() => {
|
|
206
193
|
setMorePos(list.length);
|
|
207
194
|
handMultiline();
|
|
208
195
|
}, 100);
|
|
209
196
|
};
|
|
210
197
|
// 处理class
|
|
211
|
-
|
|
212
|
-
|
|
198
|
+
const handClass = () => {
|
|
199
|
+
let str = "".concat($prefixCls, "-auto-box");
|
|
213
200
|
if (className) str += " ".concat(className);
|
|
214
201
|
return str;
|
|
215
202
|
};
|
|
216
203
|
// 处理handClassPopover
|
|
217
|
-
|
|
218
|
-
|
|
204
|
+
const handClassPopover = () => {
|
|
205
|
+
let str = "".concat($prefixCls, "-auto-box-popover");
|
|
219
206
|
if (popoverClassName) str += " ".concat(popoverClassName);
|
|
220
207
|
return str;
|
|
221
208
|
};
|
|
222
209
|
// 处理更多内容
|
|
223
|
-
|
|
210
|
+
const handMoreDom = () => {
|
|
224
211
|
return jsx("div", Object.assign({
|
|
225
212
|
className: "auto-box-popover-content"
|
|
226
213
|
}, {
|
|
227
|
-
children: list && list.map(
|
|
214
|
+
children: list && list.map((item, index) => {
|
|
228
215
|
if (morePos !== null && morePos > index) return null;
|
|
229
216
|
return jsx(Fragment$1, {
|
|
230
217
|
children: item
|
|
@@ -233,9 +220,9 @@ var AutoBox = function AutoBox(props) {
|
|
|
233
220
|
}));
|
|
234
221
|
};
|
|
235
222
|
/** 处理更多按钮 */
|
|
236
|
-
|
|
223
|
+
const handMoreBtn = () => {
|
|
237
224
|
if (morePos !== null && list.length > morePos && !hideMore) {
|
|
238
|
-
|
|
225
|
+
const handContent = () => {
|
|
239
226
|
if (moreCustomize) {
|
|
240
227
|
if (typeof moreCustomize === 'function') {
|
|
241
228
|
return moreCustomize(morePos);
|
|
@@ -262,7 +249,7 @@ var AutoBox = function AutoBox(props) {
|
|
|
262
249
|
}
|
|
263
250
|
};
|
|
264
251
|
/** 自定义更多按钮 */
|
|
265
|
-
|
|
252
|
+
const handCustomDialog = () => {
|
|
266
253
|
if (anchorEl && openMoreCom) {
|
|
267
254
|
return jsx(Protal, Object.assign({
|
|
268
255
|
className: handClassPopover(),
|
|
@@ -278,7 +265,7 @@ var AutoBox = function AutoBox(props) {
|
|
|
278
265
|
style: style,
|
|
279
266
|
ref: comRef
|
|
280
267
|
}, {
|
|
281
|
-
children: [list.map(
|
|
268
|
+
children: [list.map((item, index) => {
|
|
282
269
|
if (morePos !== null && morePos <= index) return null;
|
|
283
270
|
return jsx(Fragment$1, {
|
|
284
271
|
children: item
|
package/AutoTips/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
2
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { useRef, useState, useEffect, useMemo } from 'react';
|
|
4
3
|
import { Tooltip } from '../Tooltip/index.js';
|
|
5
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
4
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
6
5
|
import { isIE } from '@paraview/lib';
|
|
7
6
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
8
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
9
7
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
10
8
|
import 'rc-tooltip';
|
|
11
9
|
import 'rc-tooltip/lib/placements';
|
|
@@ -15,60 +13,50 @@ import '@para-ui/icons/Forbid';
|
|
|
15
13
|
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2021/11/1 20:28\n* @description 文字隐藏...\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-tips-multiline {\n max-width: 100%;\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-auto-tips-multiline > .auto-tips-multiline-content-box {\n position: relative;\n}\n.paraui-v4-auto-tips-multiline > .auto-tips-multiline-content-box > .auto-tips-multiline-content > .last-line {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.paraui-v4-auto-tips-multiline > .auto-tips-multiline-content-box > .hidden {\n opacity: 0;\n visibility: hidden;\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: -100000;\n}\n.paraui-v4-auto-tips-multiline.paraui-v4-auto-tips-multiline-safari > .auto-tips-multiline-content-box > .auto-tips-multiline-content > .last-line::before {\n content: \"\";\n display: block;\n}\n\n.paraui-v4-auto-tips-multiline-tooltip .component-tooltip-inner {\n max-height: calc(100vh - 25px);\n overflow: auto;\n}";
|
|
16
14
|
styleInject(css_248z$1);
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
arrow =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _useState = useState(),
|
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
-
lineClamp = _useState2[0],
|
|
40
|
-
setLineClamp = _useState2[1];
|
|
41
|
-
var constData = useRef({
|
|
42
|
-
line: line,
|
|
43
|
-
tips: tips
|
|
16
|
+
const AutoTipsMultiline = props => {
|
|
17
|
+
const {
|
|
18
|
+
children,
|
|
19
|
+
arrow = false,
|
|
20
|
+
placement = 'bottom-start',
|
|
21
|
+
tips = '',
|
|
22
|
+
className = '',
|
|
23
|
+
interactive = true,
|
|
24
|
+
tipMaxWidth,
|
|
25
|
+
line = 2,
|
|
26
|
+
refresh,
|
|
27
|
+
style
|
|
28
|
+
} = props;
|
|
29
|
+
const boxRef = useRef(null);
|
|
30
|
+
const singleWordRefs = useRef([]);
|
|
31
|
+
const [lineClamp, setLineClamp] = useState();
|
|
32
|
+
const constData = useRef({
|
|
33
|
+
line,
|
|
34
|
+
tips
|
|
44
35
|
});
|
|
45
36
|
constData.current.line = line;
|
|
46
37
|
constData.current.tips = tips;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
tTips = _useState4[0],
|
|
50
|
-
setTTips = _useState4[1];
|
|
51
|
-
useEffect(function () {
|
|
38
|
+
const [tTips, setTTips] = useState('');
|
|
39
|
+
useEffect(() => {
|
|
52
40
|
window.addEventListener('resize', calcLine);
|
|
53
|
-
return
|
|
41
|
+
return () => {
|
|
54
42
|
window.removeEventListener('resize', calcLine);
|
|
55
43
|
};
|
|
56
44
|
}, []);
|
|
57
|
-
useEffect(
|
|
45
|
+
useEffect(() => {
|
|
58
46
|
calcLine();
|
|
59
47
|
}, [children, refresh]);
|
|
60
48
|
// 计算行数
|
|
61
|
-
|
|
49
|
+
const calcLine = () => {
|
|
62
50
|
var _a;
|
|
63
51
|
if (!children) return;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
for (
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
const lineArr = [];
|
|
53
|
+
let showTooltip = false;
|
|
54
|
+
const boxRefWidth = ((_a = boxRef === null || boxRef === void 0 ? void 0 : boxRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
|
|
55
|
+
let addWidth = 0;
|
|
56
|
+
let linePos = 0;
|
|
57
|
+
for (let i = 0; i < singleWordRefs.current.length; i++) {
|
|
58
|
+
const dom = singleWordRefs.current[i];
|
|
59
|
+
const offsetWidth = dom.offsetWidth;
|
|
72
60
|
addWidth += offsetWidth;
|
|
73
61
|
// 累计宽度超出了一行宽度
|
|
74
62
|
if (addWidth > boxRefWidth) {
|
|
@@ -91,39 +79,35 @@ var AutoTipsMultiline = function AutoTipsMultiline(props) {
|
|
|
91
79
|
}
|
|
92
80
|
}
|
|
93
81
|
setLineClamp({
|
|
94
|
-
lineArr
|
|
95
|
-
showTooltip
|
|
82
|
+
lineArr,
|
|
83
|
+
showTooltip
|
|
96
84
|
});
|
|
97
85
|
};
|
|
98
86
|
/**
|
|
99
87
|
* 描述文字span包裹
|
|
100
88
|
*/
|
|
101
|
-
|
|
89
|
+
const descriptionRender = useMemo(() => {
|
|
102
90
|
singleWordRefs.current = [];
|
|
103
91
|
return jsx("div", Object.assign({
|
|
104
92
|
className: 'hidden'
|
|
105
93
|
}, {
|
|
106
|
-
children: children === null || children === void 0 ? void 0 : children.split('').map(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}, {
|
|
112
|
-
children: word
|
|
113
|
-
}), wIdx);
|
|
114
|
-
})
|
|
94
|
+
children: children === null || children === void 0 ? void 0 : children.split('').map((word, wIdx) => jsx("span", Object.assign({
|
|
95
|
+
ref: dom => dom && singleWordRefs.current.push(dom)
|
|
96
|
+
}, {
|
|
97
|
+
children: word
|
|
98
|
+
}), wIdx))
|
|
115
99
|
}));
|
|
116
100
|
}, [children]);
|
|
117
101
|
// 判断浏览器是否是safari
|
|
118
|
-
|
|
119
|
-
|
|
102
|
+
const isSafari = () => {
|
|
103
|
+
const userAgent = navigator.userAgent;
|
|
120
104
|
if (userAgent.indexOf('Safari') > -1) {
|
|
121
105
|
return true;
|
|
122
106
|
}
|
|
123
107
|
};
|
|
124
108
|
// 处理class
|
|
125
|
-
|
|
126
|
-
|
|
109
|
+
const handClass = () => {
|
|
110
|
+
let str = "".concat($prefixCls, "-auto-tips-multiline");
|
|
127
111
|
if (isSafari()) str += " ".concat($prefixCls, "-auto-tips-multiline-safari");
|
|
128
112
|
if (className) str += " ".concat(className);
|
|
129
113
|
return str;
|
|
@@ -147,8 +131,8 @@ var AutoTipsMultiline = function AutoTipsMultiline(props) {
|
|
|
147
131
|
children: [jsx("div", Object.assign({
|
|
148
132
|
className: 'auto-tips-multiline-content'
|
|
149
133
|
}, {
|
|
150
|
-
children: lineClamp === null || lineClamp === void 0 ? void 0 : lineClamp.lineArr.map(
|
|
151
|
-
|
|
134
|
+
children: lineClamp === null || lineClamp === void 0 ? void 0 : lineClamp.lineArr.map((line, lIdx) => {
|
|
135
|
+
let str = 'line-text';
|
|
152
136
|
if (lIdx === lineClamp.lineArr.length - 1) str += ' last-line';
|
|
153
137
|
return jsx("div", Object.assign({
|
|
154
138
|
className: str
|
|
@@ -165,37 +149,30 @@ var AutoTipsMultiline = function AutoTipsMultiline(props) {
|
|
|
165
149
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2021/11/1 20:28\n* @description 文字隐藏...\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-auto-tips {\n max-width: 100%;\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-auto-tips > .auto-tips-content {\n display: inline;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-auto-tips.paraui-v4-auto-tips-safari > .auto-tips-content::before {\n content: \"\";\n display: block;\n}\n\n.paraui-v4-auto-tips-tooltip .component-tooltip-inner {\n max-height: calc(100vh - 25px);\n overflow: auto;\n}";
|
|
166
150
|
styleInject(css_248z);
|
|
167
151
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
arrow =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var tipsElm = useRef();
|
|
185
|
-
var textElm = useRef();
|
|
186
|
-
var _useState = useState(''),
|
|
187
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
188
|
-
tTips = _useState2[0],
|
|
189
|
-
setTTips = _useState2[1];
|
|
190
|
-
useEffect(function () {
|
|
152
|
+
const AutoTips = props => {
|
|
153
|
+
const {
|
|
154
|
+
children,
|
|
155
|
+
arrow = false,
|
|
156
|
+
placement = 'bottom-start',
|
|
157
|
+
tips = '',
|
|
158
|
+
className = '',
|
|
159
|
+
beyondText = true,
|
|
160
|
+
interactive = true,
|
|
161
|
+
tipMaxWidth,
|
|
162
|
+
style
|
|
163
|
+
} = props;
|
|
164
|
+
const tipsElm = useRef();
|
|
165
|
+
const textElm = useRef();
|
|
166
|
+
const [tTips, setTTips] = useState('');
|
|
167
|
+
useEffect(() => {
|
|
191
168
|
setTTips(tips);
|
|
192
169
|
}, [tips]);
|
|
193
170
|
// 鼠标移入事件
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
171
|
+
const mouseHover = () => {
|
|
172
|
+
let val = '';
|
|
173
|
+
const tipsEle = tipsElm.current;
|
|
174
|
+
const tipsEleRect = tipsEle.getBoundingClientRect();
|
|
175
|
+
const textEleRect = textElm.current.getBoundingClientRect();
|
|
199
176
|
if (tipsElm.current) {
|
|
200
177
|
if (isIE()) {
|
|
201
178
|
if (tipsEleRect.width > textEleRect.width) {
|
|
@@ -225,15 +202,15 @@ var AutoTips = function AutoTips(props) {
|
|
|
225
202
|
return tipsElm && tipsElm.current ? tipsElm.current.offsetWidth : 0;
|
|
226
203
|
}*/
|
|
227
204
|
// 判断浏览器是否是safari
|
|
228
|
-
|
|
229
|
-
|
|
205
|
+
const isSafari = () => {
|
|
206
|
+
const userAgent = navigator.userAgent;
|
|
230
207
|
if (/^((?!chrome|android).)*safari/i.test(userAgent)) {
|
|
231
208
|
return true;
|
|
232
209
|
}
|
|
233
210
|
};
|
|
234
211
|
// 处理class
|
|
235
|
-
|
|
236
|
-
|
|
212
|
+
const handClass = () => {
|
|
213
|
+
let str = "".concat($prefixCls, "-auto-tips");
|
|
237
214
|
if (isSafari()) str += " ".concat($prefixCls, "-auto-tips-safari");
|
|
238
215
|
if (className) str += " ".concat(className);
|
|
239
216
|
return str;
|
package/Badge/index.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
2
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
6
5
|
|
|
7
6
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-badge {\n display: inline-block;\n line-height: 1;\n position: relative;\n}\n.paraui-v4-badge > .pos-box {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n transform-origin: 100% 0%;\n height: 12px;\n display: inline-block;\n background-color: rgb(244, 66, 66);\n color: rgb(255, 255, 255);\n}\n.paraui-v4-badge > .pos-box.dot {\n border-radius: 50%;\n width: 8px;\n height: 8px;\n}\n.paraui-v4-badge > .pos-box.number, .paraui-v4-badge > .pos-box.text {\n border-radius: 8px;\n font-size: 12px;\n min-width: 12px;\n text-align: center;\n line-height: 12px;\n padding: 0 3px;\n max-width: 60px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-v4-badge > .pos-box.number > span, .paraui-v4-badge > .pos-box.text > span {\n transform: scale(0.8);\n display: inline-block;\n}";
|
|
8
7
|
styleInject(css_248z);
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const Badge = props => {
|
|
10
|
+
const {
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
children,
|
|
14
|
+
sign,
|
|
15
|
+
backgroundColor,
|
|
16
|
+
color
|
|
17
|
+
} = props;
|
|
17
18
|
// 判断数据类型
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const handleType = () => {
|
|
20
|
+
const type = typeof sign;
|
|
20
21
|
if (type === 'undefined') return 'dot';
|
|
21
22
|
if (type === 'number') return 'number';
|
|
22
23
|
return 'text';
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
const type = handleType();
|
|
25
26
|
// 标记内容
|
|
26
|
-
|
|
27
|
+
const handleSign = () => {
|
|
27
28
|
return jsxs("span", Object.assign({
|
|
28
29
|
className: "pos-box ".concat(type),
|
|
29
30
|
style: {
|
|
30
|
-
backgroundColor
|
|
31
|
-
color
|
|
31
|
+
backgroundColor,
|
|
32
|
+
color
|
|
32
33
|
}
|
|
33
34
|
}, {
|
|
34
35
|
children: [type === 'number' && jsx("span", {
|
|
@@ -39,7 +40,7 @@ var Badge = function Badge(props) {
|
|
|
39
40
|
}));
|
|
40
41
|
};
|
|
41
42
|
// 处理number
|
|
42
|
-
|
|
43
|
+
const handleNumber = () => {
|
|
43
44
|
if (Number(sign) > 999) return '999+';
|
|
44
45
|
return sign;
|
|
45
46
|
};
|