@kdcloudjs/kdesign 1.8.55 → 1.8.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kdesign-complete.less +5 -0
- package/dist/kdesign.css +4 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +32 -16
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +2 -2
- package/dist/kdesign.min.js +2 -2
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/usePopper.js +27 -12
- package/es/popconfirm/popconfirm.d.ts +1 -1
- package/es/popconfirm/popconfirm.js +4 -2
- package/es/popconfirm/style/index.css +3 -0
- package/es/popconfirm/style/index.less +5 -1
- package/lib/_utils/usePopper.js +27 -12
- package/lib/popconfirm/popconfirm.d.ts +1 -1
- package/lib/popconfirm/popconfirm.js +4 -2
- package/lib/popconfirm/style/index.css +3 -0
- package/lib/popconfirm/style/index.less +5 -1
- package/package.json +1 -1
package/es/_utils/usePopper.js
CHANGED
|
@@ -222,6 +222,10 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
222
222
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
223
223
|
maxWidth = _useState16[0],
|
|
224
224
|
setMaxWidth = _useState16[1];
|
|
225
|
+
var _useState17 = useState({}),
|
|
226
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
227
|
+
forceStyle = _useState18[0],
|
|
228
|
+
setForceStyle = _useState18[1];
|
|
225
229
|
useEffect(function () {
|
|
226
230
|
if (props.visible) {
|
|
227
231
|
!exist && setExist(true);
|
|
@@ -231,18 +235,18 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
231
235
|
setVisible(false);
|
|
232
236
|
}
|
|
233
237
|
}, [exist, props.visible]);
|
|
234
|
-
var
|
|
235
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
236
|
-
evType = _useState18[0],
|
|
237
|
-
setEvType = _useState18[1];
|
|
238
|
-
var _useState19 = useState(),
|
|
238
|
+
var _useState19 = useState(''),
|
|
239
239
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
var _useState21 = useState(
|
|
240
|
+
evType = _useState20[0],
|
|
241
|
+
setEvType = _useState20[1];
|
|
242
|
+
var _useState21 = useState(),
|
|
243
243
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
align = _useState22[0],
|
|
245
|
+
setAlign = _useState22[1];
|
|
246
|
+
var _useState23 = useState(_includesInstanceProperty(Placements).call(Placements, placement) ? placement : DEFAULT_PLACEMENT),
|
|
247
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
248
|
+
nextPlacement = _useState24[0],
|
|
249
|
+
setNextPlacement = _useState24[1];
|
|
246
250
|
useEffect(function () {
|
|
247
251
|
if (isMobile) return;
|
|
248
252
|
if (nextPlacement !== placement && _includesInstanceProperty(Placements).call(Placements, placement)) {
|
|
@@ -502,6 +506,7 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
502
506
|
}
|
|
503
507
|
var newMaxHeight = 0;
|
|
504
508
|
var newMaxWidth;
|
|
509
|
+
var newForceStyle = {};
|
|
505
510
|
if (/top/.test(placementForCalc)) {
|
|
506
511
|
newMaxHeight = rect.top - gap;
|
|
507
512
|
} else if (/bottom/.test(placementForCalc)) {
|
|
@@ -515,9 +520,19 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
515
520
|
} else if (/right/.test(placementForCalc)) {
|
|
516
521
|
newMaxWidth = viewportWidth - rect.right - gap;
|
|
517
522
|
}
|
|
523
|
+
var triggerWidth = rect.width;
|
|
524
|
+
if (triggerWidth >= viewportWidth * 0.8) {
|
|
525
|
+
newForceStyle = {
|
|
526
|
+
left: 0,
|
|
527
|
+
right: 'auto',
|
|
528
|
+
transform: 'none',
|
|
529
|
+
maxWidth: '100vw'
|
|
530
|
+
};
|
|
531
|
+
}
|
|
518
532
|
}
|
|
519
533
|
setMaxHeight(Math.max(newMaxHeight, 0));
|
|
520
534
|
setMaxWidth(newMaxWidth && newMaxWidth > 0 ? newMaxWidth : undefined);
|
|
535
|
+
setForceStyle(newForceStyle);
|
|
521
536
|
}
|
|
522
537
|
setCanAlign(false);
|
|
523
538
|
props.visible === undefined && setVisible(true);
|
|
@@ -531,13 +546,13 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
531
546
|
var arrowStyle = (_arrowStyle = {}, _defineProperty(_arrowStyle, "--arrowSize", arrowSize + 'px'), _defineProperty(_arrowStyle, "--arrowSpill", arrowWidth / -2 + 'px'), _arrowStyle);
|
|
532
547
|
if (arrowPos.top) arrowStyle["--arrowTop"] = arrowPos.top + 'px';
|
|
533
548
|
if (arrowPos.left) arrowStyle["--arrowLeft"] = arrowPos.left + 'px';
|
|
534
|
-
var popperContainerStyle = _extends(_extends(_extends(_extends(_extends({
|
|
549
|
+
var popperContainerStyle = _extends(_extends(_extends(_extends(_extends(_extends({
|
|
535
550
|
position: 'absolute'
|
|
536
551
|
}, align), arrow ? arrowStyle : {}), maxHeight ? {
|
|
537
552
|
maxHeight: maxHeight + 'px'
|
|
538
553
|
} : {}), maxWidth ? {
|
|
539
554
|
maxWidth: maxWidth + 'px'
|
|
540
|
-
} : {}), popperStyle);
|
|
555
|
+
} : {}), forceStyle), popperStyle);
|
|
541
556
|
var popperProps = {
|
|
542
557
|
ref: popperRef,
|
|
543
558
|
style: popperContainerStyle,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ButtonType, IButtonProps } from '../button';
|
|
3
|
-
import { PopperProps } from '../
|
|
3
|
+
import { PopperProps } from '../popper';
|
|
4
4
|
export declare type RenderFunction = () => React.ReactNode;
|
|
5
5
|
export interface PopconfirmProps extends PopperProps {
|
|
6
6
|
okText?: string;
|
|
@@ -6,7 +6,7 @@ import Icon from '../icon';
|
|
|
6
6
|
import Button from '../button';
|
|
7
7
|
import { getCompProps } from '../_utils';
|
|
8
8
|
import { ConfigContext } from '../config-provider';
|
|
9
|
-
import
|
|
9
|
+
import Popper from '../popper';
|
|
10
10
|
var Popconfirm = function Popconfirm(props) {
|
|
11
11
|
var _context;
|
|
12
12
|
var _React$useContext = React.useContext(ConfigContext),
|
|
@@ -78,7 +78,9 @@ var Popconfirm = function Popconfirm(props) {
|
|
|
78
78
|
arrow: true,
|
|
79
79
|
onVisibleChange: handleVisibleChange
|
|
80
80
|
});
|
|
81
|
-
return
|
|
81
|
+
return React.createElement(Popper, _extends({
|
|
82
|
+
tip: confirmPopper
|
|
83
|
+
}, popperProps), confirmLocator);
|
|
82
84
|
};
|
|
83
85
|
Popconfirm.displayName = 'Popconfirm';
|
|
84
86
|
export default Popconfirm;
|
|
@@ -78,6 +78,10 @@
|
|
|
78
78
|
margin-right: @popconfirm-button-spacing;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
.arrow::before {
|
|
83
|
+
border-color: @tooltip-background-color;
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
.@{popconfirm-prefix-cls}-rtl {
|
|
83
87
|
direction: rtl;
|
|
@@ -97,4 +101,4 @@
|
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
|
-
/*! rtl:end:ignore */
|
|
104
|
+
/*! rtl:end:ignore */
|
package/lib/_utils/usePopper.js
CHANGED
|
@@ -236,6 +236,10 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
236
236
|
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
237
237
|
maxWidth = _useState16[0],
|
|
238
238
|
setMaxWidth = _useState16[1];
|
|
239
|
+
var _useState17 = (0, _react.useState)({}),
|
|
240
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
241
|
+
forceStyle = _useState18[0],
|
|
242
|
+
setForceStyle = _useState18[1];
|
|
239
243
|
(0, _react.useEffect)(function () {
|
|
240
244
|
if (props.visible) {
|
|
241
245
|
!exist && setExist(true);
|
|
@@ -245,18 +249,18 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
245
249
|
setVisible(false);
|
|
246
250
|
}
|
|
247
251
|
}, [exist, props.visible]);
|
|
248
|
-
var
|
|
249
|
-
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
250
|
-
evType = _useState18[0],
|
|
251
|
-
setEvType = _useState18[1];
|
|
252
|
-
var _useState19 = (0, _react.useState)(),
|
|
252
|
+
var _useState19 = (0, _react.useState)(''),
|
|
253
253
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
var _useState21 = (0, _react.useState)(
|
|
254
|
+
evType = _useState20[0],
|
|
255
|
+
setEvType = _useState20[1];
|
|
256
|
+
var _useState21 = (0, _react.useState)(),
|
|
257
257
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
align = _useState22[0],
|
|
259
|
+
setAlign = _useState22[1];
|
|
260
|
+
var _useState23 = (0, _react.useState)((0, _includes.default)(Placements).call(Placements, placement) ? placement : DEFAULT_PLACEMENT),
|
|
261
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
262
|
+
nextPlacement = _useState24[0],
|
|
263
|
+
setNextPlacement = _useState24[1];
|
|
260
264
|
(0, _react.useEffect)(function () {
|
|
261
265
|
if (isMobile) return;
|
|
262
266
|
if (nextPlacement !== placement && (0, _includes.default)(Placements).call(Placements, placement)) {
|
|
@@ -516,6 +520,7 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
516
520
|
}
|
|
517
521
|
var newMaxHeight = 0;
|
|
518
522
|
var newMaxWidth;
|
|
523
|
+
var newForceStyle = {};
|
|
519
524
|
if (/top/.test(placementForCalc)) {
|
|
520
525
|
newMaxHeight = rect.top - gap;
|
|
521
526
|
} else if (/bottom/.test(placementForCalc)) {
|
|
@@ -529,9 +534,19 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
529
534
|
} else if (/right/.test(placementForCalc)) {
|
|
530
535
|
newMaxWidth = viewportWidth - rect.right - gap;
|
|
531
536
|
}
|
|
537
|
+
var triggerWidth = rect.width;
|
|
538
|
+
if (triggerWidth >= viewportWidth * 0.8) {
|
|
539
|
+
newForceStyle = {
|
|
540
|
+
left: 0,
|
|
541
|
+
right: 'auto',
|
|
542
|
+
transform: 'none',
|
|
543
|
+
maxWidth: '100vw'
|
|
544
|
+
};
|
|
545
|
+
}
|
|
532
546
|
}
|
|
533
547
|
setMaxHeight(Math.max(newMaxHeight, 0));
|
|
534
548
|
setMaxWidth(newMaxWidth && newMaxWidth > 0 ? newMaxWidth : undefined);
|
|
549
|
+
setForceStyle(newForceStyle);
|
|
535
550
|
}
|
|
536
551
|
setCanAlign(false);
|
|
537
552
|
props.visible === undefined && setVisible(true);
|
|
@@ -545,13 +560,13 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
545
560
|
var arrowStyle = (_arrowStyle = {}, (0, _defineProperty2.default)(_arrowStyle, "--arrowSize", arrowSize + 'px'), (0, _defineProperty2.default)(_arrowStyle, "--arrowSpill", arrowWidth / -2 + 'px'), _arrowStyle);
|
|
546
561
|
if (arrowPos.top) arrowStyle["--arrowTop"] = arrowPos.top + 'px';
|
|
547
562
|
if (arrowPos.left) arrowStyle["--arrowLeft"] = arrowPos.left + 'px';
|
|
548
|
-
var popperContainerStyle = (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
|
|
563
|
+
var popperContainerStyle = (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
|
|
549
564
|
position: 'absolute'
|
|
550
565
|
}, align), arrow ? arrowStyle : {}), maxHeight ? {
|
|
551
566
|
maxHeight: maxHeight + 'px'
|
|
552
567
|
} : {}), maxWidth ? {
|
|
553
568
|
maxWidth: maxWidth + 'px'
|
|
554
|
-
} : {}), popperStyle);
|
|
569
|
+
} : {}), forceStyle), popperStyle);
|
|
555
570
|
var popperProps = {
|
|
556
571
|
ref: popperRef,
|
|
557
572
|
style: popperContainerStyle,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ButtonType, IButtonProps } from '../button';
|
|
3
|
-
import { PopperProps } from '../
|
|
3
|
+
import { PopperProps } from '../popper';
|
|
4
4
|
export declare type RenderFunction = () => React.ReactNode;
|
|
5
5
|
export interface PopconfirmProps extends PopperProps {
|
|
6
6
|
okText?: string;
|
|
@@ -16,7 +16,7 @@ var _icon = _interopRequireDefault(require("../icon"));
|
|
|
16
16
|
var _button = _interopRequireDefault(require("../button"));
|
|
17
17
|
var _utils = require("../_utils");
|
|
18
18
|
var _configProvider = require("../config-provider");
|
|
19
|
-
var
|
|
19
|
+
var _popper = _interopRequireDefault(require("../popper"));
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
22
|
var Popconfirm = function Popconfirm(props) {
|
|
@@ -90,7 +90,9 @@ var Popconfirm = function Popconfirm(props) {
|
|
|
90
90
|
arrow: true,
|
|
91
91
|
onVisibleChange: handleVisibleChange
|
|
92
92
|
});
|
|
93
|
-
return (0,
|
|
93
|
+
return React.createElement(_popper.default, (0, _extends2.default)({
|
|
94
|
+
tip: confirmPopper
|
|
95
|
+
}, popperProps), confirmLocator);
|
|
94
96
|
};
|
|
95
97
|
Popconfirm.displayName = 'Popconfirm';
|
|
96
98
|
var _default = Popconfirm;
|
|
@@ -78,6 +78,10 @@
|
|
|
78
78
|
margin-right: @popconfirm-button-spacing;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
.arrow::before {
|
|
83
|
+
border-color: @tooltip-background-color;
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
.@{popconfirm-prefix-cls}-rtl {
|
|
83
87
|
direction: rtl;
|
|
@@ -97,4 +101,4 @@
|
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
|
-
/*! rtl:end:ignore */
|
|
104
|
+
/*! rtl:end:ignore */
|