@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.5
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 +89 -117
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +7 -9
- 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 +242 -330
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +22 -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 +219 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +66 -74
- package/FormItem/index.js +14 -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 +905 -796
- package/SelectorPicker/index.js +111 -133
- 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 +25 -26
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +767 -963
- package/Tabs/index.js +102 -102
- package/Tag/index.js +115 -162
- package/TextEditor/index.js +81 -103
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +27 -28
- package/Timeline/index.js +67 -58
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +53 -52
- package/Tooltip/index.js +79 -82
- package/Transfer/index.js +159 -201
- package/Tree/index.js +7 -12
- package/Upload/index.js +523 -758
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-0ced30f7.js} +1127 -1079
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-ef1235fb.js} +125 -134
- package/_verture/{index-b1f80962.js → index-f186b5e8.js} +314 -398
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-5df08980.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-8223a2ef.js} +15 -2
- 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-418da0a4.js → utils-46e99c9a.js} +34 -25
- package/index.js +21 -22
- package/locale/index.js +6 -6
- package/package.json +1 -1
- 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-232d890b.js +0 -327
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/toConsumableArray-8f4c9589.js +0 -19
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
package/Tooltip/index.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
2
1
|
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
3
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
3
|
import React__default from 'react';
|
|
5
4
|
import RcTooltip from 'rc-tooltip';
|
|
6
5
|
import { placements } from 'rc-tooltip/lib/placements';
|
|
7
6
|
import clsx from 'clsx';
|
|
8
|
-
import { a as $rcPrefixCls, $ as $prefixCls } from '../_verture/constant-
|
|
7
|
+
import { a as $rcPrefixCls, $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
9
8
|
import Forbid from '@para-ui/icons/Forbid';
|
|
10
9
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
11
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
12
10
|
|
|
13
11
|
//自动调整位置
|
|
14
|
-
|
|
12
|
+
const autoAdjustOverflowEnabled = {
|
|
15
13
|
adjustX: 1,
|
|
16
14
|
adjustY: 1
|
|
17
15
|
};
|
|
18
16
|
//非自动调整位置
|
|
19
|
-
|
|
17
|
+
const autoAdjustOverflowDisabled = {
|
|
20
18
|
adjustX: 0,
|
|
21
19
|
adjustY: 0
|
|
22
20
|
};
|
|
@@ -29,12 +27,12 @@ function getOverflowOptions(autoAdjustOverflow) {
|
|
|
29
27
|
}
|
|
30
28
|
//tooltip placement
|
|
31
29
|
function getPlacements(config) {
|
|
32
|
-
|
|
33
|
-
horizontalArrowShift =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
const {
|
|
31
|
+
horizontalArrowShift = 16,
|
|
32
|
+
verticalArrowShift = 8,
|
|
33
|
+
autoAdjustOverflow
|
|
34
|
+
} = config;
|
|
35
|
+
const placementMap = {
|
|
38
36
|
left: {
|
|
39
37
|
points: ['cr', 'cl'],
|
|
40
38
|
offset: [-8, 0]
|
|
@@ -84,7 +82,7 @@ function getPlacements(config) {
|
|
|
84
82
|
offset: [-8, verticalArrowShift]
|
|
85
83
|
}
|
|
86
84
|
};
|
|
87
|
-
Object.keys(placementMap).forEach(
|
|
85
|
+
Object.keys(placementMap).forEach(key => {
|
|
88
86
|
placementMap[key] = Object.assign(Object.assign({}, placements[key]), {
|
|
89
87
|
offset: getAlignOffset(key).offset,
|
|
90
88
|
overflow: getOverflowOptions(autoAdjustOverflow)
|
|
@@ -93,39 +91,40 @@ function getPlacements(config) {
|
|
|
93
91
|
});
|
|
94
92
|
return placementMap;
|
|
95
93
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
keys.forEach(
|
|
94
|
+
const splitObject = (obj, keys) => {
|
|
95
|
+
const picked = {};
|
|
96
|
+
const omitted = Object.assign({}, obj);
|
|
97
|
+
keys.forEach(key => {
|
|
100
98
|
if (obj && key in obj) {
|
|
101
99
|
picked[key] = obj[key];
|
|
102
100
|
delete omitted[key];
|
|
103
101
|
}
|
|
104
102
|
});
|
|
105
103
|
return {
|
|
106
|
-
picked
|
|
107
|
-
omitted
|
|
104
|
+
picked,
|
|
105
|
+
omitted
|
|
108
106
|
};
|
|
109
107
|
};
|
|
110
108
|
//兼容禁用title
|
|
111
109
|
function getDisabledCompatibleChildren(child) {
|
|
112
|
-
|
|
110
|
+
const element = /*#__PURE__*/React__default.isValidElement(child) ? child : jsx("span", {
|
|
113
111
|
children: child
|
|
114
112
|
});
|
|
115
113
|
if (element.type === 'button' && element.props.disabled) {
|
|
116
|
-
|
|
117
|
-
picked
|
|
118
|
-
omitted
|
|
119
|
-
|
|
114
|
+
const {
|
|
115
|
+
picked,
|
|
116
|
+
omitted
|
|
117
|
+
} = splitObject(element.props.style, ['position', 'left', 'right', 'top', 'bottom', 'float', 'display', 'zIndex']);
|
|
118
|
+
const spanStyle = Object.assign(Object.assign({
|
|
120
119
|
display: 'inline-block'
|
|
121
120
|
}, picked), {
|
|
122
121
|
cursor: 'not-allowed',
|
|
123
122
|
width: element.props.block ? '100%' : null
|
|
124
123
|
});
|
|
125
|
-
|
|
124
|
+
const buttonStyle = Object.assign(Object.assign({}, omitted), {
|
|
126
125
|
pointerEvents: 'none'
|
|
127
126
|
});
|
|
128
|
-
|
|
127
|
+
const child = /*#__PURE__*/React__default.cloneElement(element, {
|
|
129
128
|
style: buttonStyle,
|
|
130
129
|
className: null
|
|
131
130
|
});
|
|
@@ -133,14 +132,14 @@ function getDisabledCompatibleChildren(child) {
|
|
|
133
132
|
style: spanStyle,
|
|
134
133
|
className: clsx(element.props.className, "".concat($rcPrefixCls, "-tooltip-disabled-compatible-wrapper"))
|
|
135
134
|
}, {
|
|
136
|
-
children:
|
|
135
|
+
children: child
|
|
137
136
|
}));
|
|
138
137
|
}
|
|
139
138
|
return element;
|
|
140
139
|
}
|
|
141
140
|
//映射placement
|
|
142
141
|
function mapLegacyPlacement(place) {
|
|
143
|
-
|
|
142
|
+
const legacyPlacement = {
|
|
144
143
|
'bottom-end': 'bottomRight',
|
|
145
144
|
'bottom-start': 'bottomLeft',
|
|
146
145
|
'left-end': 'leftBottom',
|
|
@@ -154,8 +153,8 @@ function mapLegacyPlacement(place) {
|
|
|
154
153
|
}
|
|
155
154
|
//浮层偏移量
|
|
156
155
|
function getAlignOffset(place) {
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
const mPlace = mapLegacyPlacement(place);
|
|
157
|
+
const offsetMap = {
|
|
159
158
|
left: {
|
|
160
159
|
offset: [-8, 0]
|
|
161
160
|
},
|
|
@@ -200,31 +199,27 @@ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/5/25 下
|
|
|
200
199
|
styleInject(css_248z);
|
|
201
200
|
|
|
202
201
|
//tooltip
|
|
203
|
-
|
|
202
|
+
const Tooltip = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
204
203
|
var _a;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var tRef = React__default.useRef(); //实例
|
|
211
|
-
var _React$useState3 = React__default.useState([0, 0]),
|
|
212
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
213
|
-
targetOffset = _React$useState4[0],
|
|
214
|
-
setTargetOffset = _React$useState4[1];
|
|
215
|
-
React__default.useEffect(function () {
|
|
204
|
+
const [visible, setVisible] = React__default.useState(props.defaultVisible); //是否显示
|
|
205
|
+
const wrapRef = React__default.useRef(); //锚点
|
|
206
|
+
const tRef = React__default.useRef(); //实例
|
|
207
|
+
const [targetOffset, setTargetOffset] = React__default.useState([0, 0]);
|
|
208
|
+
React__default.useEffect(() => {
|
|
216
209
|
var _a;
|
|
217
210
|
if ('visible' in props || 'open' in props) {
|
|
218
211
|
setVisible(!!((_a = props.visible) !== null && _a !== void 0 ? _a : props.open));
|
|
219
212
|
}
|
|
220
213
|
}, [(_a = props.visible) !== null && _a !== void 0 ? _a : props.open]);
|
|
221
214
|
//no title
|
|
222
|
-
|
|
223
|
-
|
|
215
|
+
const isUntitled = () => {
|
|
216
|
+
const {
|
|
217
|
+
title
|
|
218
|
+
} = props;
|
|
224
219
|
return !title && title !== 0;
|
|
225
220
|
};
|
|
226
221
|
//浮层切换时回调
|
|
227
|
-
|
|
222
|
+
const onVisibleChange = vis => {
|
|
228
223
|
var _a;
|
|
229
224
|
if (!('visible' in props || 'open' in props)) {
|
|
230
225
|
setVisible(isUntitled() ? false : vis);
|
|
@@ -234,26 +229,26 @@ var Tooltip = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
234
229
|
}
|
|
235
230
|
};
|
|
236
231
|
//tooltip 弹出位置
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
232
|
+
const getTooltipPlacements = () => {
|
|
233
|
+
const {
|
|
234
|
+
builtinPlacements,
|
|
235
|
+
autoAdjustOverflow
|
|
236
|
+
} = props;
|
|
240
237
|
return builtinPlacements || getPlacements({
|
|
241
|
-
autoAdjustOverflow
|
|
238
|
+
autoAdjustOverflow
|
|
242
239
|
});
|
|
243
240
|
};
|
|
244
241
|
// 动态设置动画点
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
const onPopupAlign = (domNode, align) => {
|
|
243
|
+
const placements = getTooltipPlacements();
|
|
247
244
|
// 当前返回的位置
|
|
248
|
-
|
|
249
|
-
return placements[key].points[0] === align.points[0] && placements[key].points[1] === align.points[1];
|
|
250
|
-
});
|
|
245
|
+
const placement = Object.keys(placements).find(key => placements[key].points[0] === align.points[0] && placements[key].points[1] === align.points[1]);
|
|
251
246
|
if (!placement) {
|
|
252
247
|
return;
|
|
253
248
|
}
|
|
254
249
|
// 根据当前坐标设置动画点
|
|
255
|
-
|
|
256
|
-
|
|
250
|
+
const rect = domNode.getBoundingClientRect();
|
|
251
|
+
const transformOrigin = {
|
|
257
252
|
top: '50%',
|
|
258
253
|
left: '50%'
|
|
259
254
|
};
|
|
@@ -270,44 +265,46 @@ var Tooltip = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
270
265
|
domNode.style.transformOrigin = "".concat(transformOrigin.left, " ").concat(transformOrigin.top);
|
|
271
266
|
};
|
|
272
267
|
//跟随光标
|
|
273
|
-
|
|
268
|
+
const handleMouseMove = e => {
|
|
274
269
|
var _a, _b, _c, _d;
|
|
275
270
|
if (wrapRef.current) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
x
|
|
280
|
-
y
|
|
281
|
-
width
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
271
|
+
const popupHeight = ((_d = (_c = (_b = (_a = tRef.current) === null || _a === void 0 ? void 0 : _a.popupRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getElement()) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
272
|
+
const cursorSpace = popupHeight === 0 ? 60 : 30;
|
|
273
|
+
const {
|
|
274
|
+
x,
|
|
275
|
+
y,
|
|
276
|
+
width
|
|
277
|
+
} = wrapRef.current.getBoundingClientRect();
|
|
278
|
+
const newX = e.clientX - (x + width / 2);
|
|
279
|
+
const newY = e.clientY - y + popupHeight + cursorSpace;
|
|
280
|
+
setTimeout(() => {
|
|
285
281
|
setTargetOffset([-newX, -newY]);
|
|
286
282
|
});
|
|
287
283
|
}
|
|
288
284
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
285
|
+
const {
|
|
286
|
+
prefixCls = "".concat($rcPrefixCls, "-tooltip"),
|
|
287
|
+
getPopupContainer,
|
|
288
|
+
overlayClassName,
|
|
289
|
+
overlayInnerStyle,
|
|
290
|
+
overlayStyle,
|
|
291
|
+
children,
|
|
292
|
+
title,
|
|
293
|
+
placement,
|
|
294
|
+
isPopover,
|
|
295
|
+
followCursor,
|
|
296
|
+
maxWidth,
|
|
297
|
+
disabled
|
|
298
|
+
} = props,
|
|
302
299
|
restProps = __rest(props, ["prefixCls", "getPopupContainer", "overlayClassName", "overlayInnerStyle", "overlayStyle", "children", "title", "placement", "isPopover", "followCursor", "maxWidth", "disabled"]);
|
|
303
|
-
|
|
300
|
+
let tempVisible = visible;
|
|
304
301
|
if (!('visible' in props || 'open' in props) && isUntitled()) {
|
|
305
302
|
//没有title必然不可见
|
|
306
303
|
tempVisible = false;
|
|
307
304
|
}
|
|
308
305
|
//overlayCls
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
const overlayCls = clsx(!isPopover && "".concat($prefixCls, "-tooltip"), overlayClassName);
|
|
307
|
+
const mergeOverlayStyle = Object.assign({}, overlayStyle);
|
|
311
308
|
if (maxWidth) {
|
|
312
309
|
mergeOverlayStyle.maxWidth = maxWidth;
|
|
313
310
|
}
|
|
@@ -325,7 +322,7 @@ var Tooltip = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
325
322
|
}),
|
|
326
323
|
visible: tempVisible,
|
|
327
324
|
align: {
|
|
328
|
-
targetOffset
|
|
325
|
+
targetOffset
|
|
329
326
|
},
|
|
330
327
|
onVisibleChange: onVisibleChange,
|
|
331
328
|
onPopupAlign: onPopupAlign,
|