@autobest-ui/components 2.2.1 → 2.4.0
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/esm/accordion/Item.js +6 -23
- package/esm/accordion/index.js +8 -36
- package/esm/accordion/style/index.css +1 -0
- package/esm/affix/PortalAffix.js +7 -11
- package/esm/affix/index.js +30 -70
- package/esm/affix/style/index.css +1 -1
- package/esm/base.css +1 -1
- package/esm/carousel/index.js +45 -141
- package/esm/checkbox/index.js +12 -37
- package/esm/checkbox/style/index.css +1 -1
- package/esm/collapse/index.js +11 -49
- package/esm/confirm/index.d.ts +8 -0
- package/esm/confirm/index.js +23 -31
- package/esm/confirm/style/index.css +1 -1
- package/esm/date-picker/DateEnum.js +0 -3
- package/esm/date-picker/calendar/Day.js +62 -78
- package/esm/date-picker/calendar/MonthYear.js +20 -53
- package/esm/date-picker/calendar/grid/index.js +7 -12
- package/esm/date-picker/calendar/index.js +4 -31
- package/esm/date-picker/index.js +11 -51
- package/esm/date-picker/style/index.css +1 -1
- package/esm/date-picker/utils.js +6 -11
- package/esm/drawer/Child.js +10 -20
- package/esm/drawer/index.js +22 -71
- package/esm/drawer/style/index.css +1 -1
- package/esm/ellipsis/index.js +9 -17
- package/esm/ellipsis/style/index.css +1 -1
- package/esm/guide/index.js +25 -63
- package/esm/guide/style/index.css +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/input-number/ControlArrow.js +0 -2
- package/esm/input-number/constants.js +2 -2
- package/esm/input-number/index.js +26 -106
- package/esm/input-number/style/index.css +1 -1
- package/esm/lazy-image/index.js +10 -55
- package/esm/lazy-image/style/index.css +1 -1
- package/esm/link-list/index.js +11 -35
- package/esm/link-list/style/index.css +1 -1
- package/esm/loading/index.js +15 -42
- package/esm/loading/style/index.css +1 -1
- package/esm/loading-bar/style/index.css +1 -1
- package/esm/loading-container/index.js +3 -6
- package/esm/loading-container/style/index.css +1 -1
- package/esm/loading-icon/index.js +0 -2
- package/esm/loading-icon/style/index.css +1 -1
- package/esm/mask/index.js +6 -9
- package/esm/mask/style/index.css +1 -1
- package/esm/message/index.d.ts +17 -6
- package/esm/message/index.js +68 -96
- package/esm/message/renderMessage.d.ts +17 -0
- package/esm/message/renderMessage.js +137 -0
- package/esm/message/style/index.css +1 -1
- package/esm/modal/Title.js +5 -12
- package/esm/modal/getPopupLocation.js +5 -7
- package/esm/modal/index.js +44 -125
- package/esm/modal/style/index.css +1 -1
- package/esm/move/index.js +32 -132
- package/esm/move/range.js +6 -12
- package/esm/move/utils.js +3 -10
- package/esm/popover/index.js +9 -28
- package/esm/popover/style/index.css +1 -1
- package/esm/portal/index.js +1 -22
- package/esm/script/index.js +19 -59
- package/esm/select/index.js +28 -106
- package/esm/select/style/index.css +1 -1
- package/esm/show-more/index.js +40 -103
- package/esm/skeleton/Item.js +1 -3
- package/esm/skeleton/index.js +5 -11
- package/esm/skeleton/style/index.css +1 -1
- package/esm/style.css +1 -33
- package/esm/table/body/BodyRow.js +11 -28
- package/esm/table/body/CheckIcon.js +10 -18
- package/esm/table/body/index.js +8 -12
- package/esm/table/header/CheckIcon.js +3 -11
- package/esm/table/header/HeaderCell.js +12 -33
- package/esm/table/header/HeaderRow.js +6 -17
- package/esm/table/index.js +30 -100
- package/esm/table/style/index.css +1 -1
- package/esm/tabs/index.js +35 -118
- package/esm/tabs/style/index.css +1 -1
- package/esm/tooltip/index.js +0 -4
- package/esm/tooltip/style/index.css +1 -1
- package/esm/trigger/align.js +6 -6
- package/esm/trigger/bottomAlign.js +33 -45
- package/esm/trigger/constants.js +0 -1
- package/esm/trigger/getPopupLocation.js +48 -68
- package/esm/trigger/index.js +52 -187
- package/esm/trigger/leftAlign.js +33 -47
- package/esm/trigger/ref.js +2 -7
- package/esm/trigger/rightAlign.js +33 -45
- package/esm/trigger/topAlign.js +33 -45
- package/esm/trigger/utils.js +28 -45
- package/lib/accordion/Item.js +6 -27
- package/lib/accordion/index.js +8 -41
- package/lib/accordion/style/index.css +1 -0
- package/lib/affix/PortalAffix.js +7 -17
- package/lib/affix/index.js +30 -75
- package/lib/affix/style/index.css +1 -1
- package/lib/base.css +1 -1
- package/lib/carousel/index.js +45 -146
- package/lib/checkbox/index.js +12 -41
- package/lib/checkbox/style/index.css +1 -1
- package/lib/collapse/index.js +11 -53
- package/lib/confirm/index.d.ts +8 -0
- package/lib/confirm/index.js +23 -38
- package/lib/confirm/style/index.css +1 -1
- package/lib/date-picker/DateEnum.js +0 -3
- package/lib/date-picker/calendar/Day.js +62 -87
- package/lib/date-picker/calendar/MonthYear.js +20 -62
- package/lib/date-picker/calendar/grid/index.js +7 -16
- package/lib/date-picker/calendar/index.js +4 -37
- package/lib/date-picker/index.js +9 -58
- package/lib/date-picker/style/index.css +1 -1
- package/lib/date-picker/utils.js +6 -26
- package/lib/drawer/Child.js +10 -25
- package/lib/drawer/index.js +22 -78
- package/lib/drawer/style/index.css +1 -1
- package/lib/ellipsis/index.js +9 -23
- package/lib/ellipsis/style/index.css +1 -1
- package/lib/guide/index.js +25 -71
- package/lib/guide/style/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -29
- package/lib/input-number/ControlArrow.js +0 -4
- package/lib/input-number/constants.js +2 -2
- package/lib/input-number/index.js +26 -114
- package/lib/input-number/style/index.css +1 -1
- package/lib/lazy-image/index.js +10 -58
- package/lib/lazy-image/style/index.css +1 -1
- package/lib/link-list/index.js +11 -40
- package/lib/link-list/style/index.css +1 -1
- package/lib/loading/index.js +13 -48
- package/lib/loading/style/index.css +1 -1
- package/lib/loading-bar/index.js +0 -5
- package/lib/loading-bar/style/index.css +1 -1
- package/lib/loading-container/index.js +3 -11
- package/lib/loading-container/style/index.css +1 -1
- package/lib/loading-icon/index.js +0 -7
- package/lib/loading-icon/style/index.css +1 -1
- package/lib/mask/index.js +6 -17
- package/lib/mask/style/index.css +1 -1
- package/lib/message/index.d.ts +17 -6
- package/lib/message/index.js +67 -104
- package/lib/message/renderMessage.d.ts +17 -0
- package/lib/message/renderMessage.js +144 -0
- package/lib/message/style/index.css +1 -1
- package/lib/modal/Affix.js +0 -4
- package/lib/modal/Title.js +5 -15
- package/lib/modal/getPopupLocation.js +5 -9
- package/lib/modal/index.js +44 -135
- package/lib/modal/style/index.css +1 -1
- package/lib/move/index.js +32 -144
- package/lib/move/range.js +6 -14
- package/lib/move/utils.js +3 -12
- package/lib/popover/index.js +9 -33
- package/lib/popover/style/index.css +1 -1
- package/lib/portal/index.js +1 -25
- package/lib/script/index.js +19 -61
- package/lib/select/index.js +28 -113
- package/lib/select/style/index.css +1 -1
- package/lib/show-more/index.js +40 -110
- package/lib/skeleton/Item.js +1 -8
- package/lib/skeleton/index.js +5 -16
- package/lib/skeleton/style/index.css +1 -1
- package/lib/style.css +1 -33
- package/lib/table/body/BodyRow.js +11 -33
- package/lib/table/body/CheckIcon.js +10 -22
- package/lib/table/body/index.js +8 -17
- package/lib/table/header/CheckIcon.js +3 -15
- package/lib/table/header/HeaderCell.js +12 -37
- package/lib/table/header/HeaderRow.js +6 -22
- package/lib/table/index.js +30 -107
- package/lib/table/style/index.css +1 -1
- package/lib/tabs/index.js +35 -122
- package/lib/tabs/style/index.css +1 -1
- package/lib/tooltip/index.js +0 -9
- package/lib/tooltip/style/index.css +1 -1
- package/lib/trigger/align.js +0 -4
- package/lib/trigger/bottomAlign.js +33 -48
- package/lib/trigger/constants.js +0 -2
- package/lib/trigger/getPopupLocation.js +48 -74
- package/lib/trigger/index.js +52 -198
- package/lib/trigger/leftAlign.js +33 -50
- package/lib/trigger/ref.js +2 -12
- package/lib/trigger/rightAlign.js +33 -48
- package/lib/trigger/topAlign.js +33 -48
- package/lib/trigger/utils.js +28 -53
- package/package.json +9 -3
- package/esm/accordion/style/index.d.ts +0 -1
- package/esm/accordion/style/index.js +0 -5
- package/esm/affix/style/index.d.ts +0 -1
- package/esm/affix/style/index.js +0 -5
- package/esm/affix/style/index.scss +0 -35
- package/esm/base.scss +0 -42
- package/esm/carousel/style/index.d.ts +0 -1
- package/esm/carousel/style/index.js +0 -5
- package/esm/carousel/style/index.scss +0 -37
- package/esm/checkbox/style/index.d.ts +0 -1
- package/esm/checkbox/style/index.js +0 -5
- package/esm/checkbox/style/index.scss +0 -118
- package/esm/collapse/style/index.d.ts +0 -1
- package/esm/collapse/style/index.js +0 -5
- package/esm/collapse/style/index.scss +0 -43
- package/esm/confirm/style/index.d.ts +0 -1
- package/esm/confirm/style/index.js +0 -7
- package/esm/confirm/style/index.scss +0 -44
- package/esm/date-picker/calendar/grid/index.scss +0 -90
- package/esm/date-picker/calendar/index.scss +0 -58
- package/esm/date-picker/style/index.d.ts +0 -1
- package/esm/date-picker/style/index.js +0 -11
- package/esm/date-picker/style/index.scss +0 -24
- package/esm/drawer/style/index.d.ts +0 -1
- package/esm/drawer/style/index.js +0 -7
- package/esm/drawer/style/index.scss +0 -44
- package/esm/ellipsis/style/index.d.ts +0 -1
- package/esm/ellipsis/style/index.js +0 -5
- package/esm/ellipsis/style/index.scss +0 -35
- package/esm/guide/style/index.d.ts +0 -1
- package/esm/guide/style/index.js +0 -7
- package/esm/guide/style/index.scss +0 -18
- package/esm/input-number/style/index.d.ts +0 -1
- package/esm/input-number/style/index.js +0 -5
- package/esm/input-number/style/index.scss +0 -70
- package/esm/lazy-image/style/index.d.ts +0 -1
- package/esm/lazy-image/style/index.js +0 -5
- package/esm/lazy-image/style/index.scss +0 -25
- package/esm/link-list/style/index.d.ts +0 -1
- package/esm/link-list/style/index.js +0 -7
- package/esm/link-list/style/index.scss +0 -125
- package/esm/loading/style/index.d.ts +0 -1
- package/esm/loading/style/index.js +0 -7
- package/esm/loading/style/index.scss +0 -21
- package/esm/loading-bar/style/index.d.ts +0 -1
- package/esm/loading-bar/style/index.js +0 -5
- package/esm/loading-bar/style/index.scss +0 -62
- package/esm/loading-container/style/index.d.ts +0 -1
- package/esm/loading-container/style/index.js +0 -7
- package/esm/loading-container/style/index.scss +0 -28
- package/esm/loading-icon/style/index.d.ts +0 -1
- package/esm/loading-icon/style/index.js +0 -5
- package/esm/loading-icon/style/index.scss +0 -24
- package/esm/mask/style/index.d.ts +0 -1
- package/esm/mask/style/index.js +0 -5
- package/esm/mask/style/index.scss +0 -35
- package/esm/message/style/index.d.ts +0 -1
- package/esm/message/style/index.js +0 -5
- package/esm/message/style/index.scss +0 -71
- package/esm/modal/style/index.d.ts +0 -1
- package/esm/modal/style/index.js +0 -7
- package/esm/modal/style/index.scss +0 -112
- package/esm/move/style/index.d.ts +0 -1
- package/esm/move/style/index.js +0 -5
- package/esm/move/style/index.scss +0 -7
- package/esm/popover/style/index.d.ts +0 -1
- package/esm/popover/style/index.js +0 -7
- package/esm/popover/style/index.scss +0 -60
- package/esm/portal/style/index.d.ts +0 -1
- package/esm/portal/style/index.js +0 -5
- package/esm/portal/style/index.scss +0 -0
- package/esm/script/style/index.d.ts +0 -1
- package/esm/script/style/index.js +0 -1
- package/esm/script/style/index.scss +0 -0
- package/esm/select/style/index.d.ts +0 -1
- package/esm/select/style/index.js +0 -7
- package/esm/select/style/index.scss +0 -126
- package/esm/show-more/style/index.d.ts +0 -1
- package/esm/show-more/style/index.js +0 -5
- package/esm/show-more/style/index.scss +0 -23
- package/esm/skeleton/style/index.d.ts +0 -1
- package/esm/skeleton/style/index.js +0 -5
- package/esm/skeleton/style/index.scss +0 -27
- package/esm/table/style/index.d.ts +0 -1
- package/esm/table/style/index.js +0 -9
- package/esm/table/style/index.scss +0 -45
- package/esm/tabs/style/index.d.ts +0 -1
- package/esm/tabs/style/index.js +0 -5
- package/esm/tabs/style/index.scss +0 -62
- package/esm/tooltip/style/index.d.ts +0 -1
- package/esm/tooltip/style/index.js +0 -7
- package/esm/tooltip/style/index.scss +0 -62
- package/esm/trigger/style/index.d.ts +0 -1
- package/esm/trigger/style/index.js +0 -5
- package/esm/trigger/style/index.scss +0 -79
- package/lib/accordion/style/index.d.ts +0 -1
- package/lib/accordion/style/index.js +0 -7
- package/lib/affix/style/index.d.ts +0 -1
- package/lib/affix/style/index.js +0 -7
- package/lib/affix/style/index.scss +0 -35
- package/lib/base.scss +0 -42
- package/lib/carousel/style/index.d.ts +0 -1
- package/lib/carousel/style/index.js +0 -7
- package/lib/carousel/style/index.scss +0 -37
- package/lib/checkbox/style/index.d.ts +0 -1
- package/lib/checkbox/style/index.js +0 -7
- package/lib/checkbox/style/index.scss +0 -118
- package/lib/collapse/style/index.d.ts +0 -1
- package/lib/collapse/style/index.js +0 -7
- package/lib/collapse/style/index.scss +0 -43
- package/lib/confirm/style/index.d.ts +0 -1
- package/lib/confirm/style/index.js +0 -9
- package/lib/confirm/style/index.scss +0 -44
- package/lib/date-picker/calendar/grid/index.scss +0 -90
- package/lib/date-picker/calendar/index.scss +0 -58
- package/lib/date-picker/style/index.d.ts +0 -1
- package/lib/date-picker/style/index.js +0 -13
- package/lib/date-picker/style/index.scss +0 -24
- package/lib/drawer/style/index.d.ts +0 -1
- package/lib/drawer/style/index.js +0 -9
- package/lib/drawer/style/index.scss +0 -44
- package/lib/ellipsis/style/index.d.ts +0 -1
- package/lib/ellipsis/style/index.js +0 -7
- package/lib/ellipsis/style/index.scss +0 -35
- package/lib/guide/style/index.d.ts +0 -1
- package/lib/guide/style/index.js +0 -9
- package/lib/guide/style/index.scss +0 -18
- package/lib/input-number/style/index.d.ts +0 -1
- package/lib/input-number/style/index.js +0 -7
- package/lib/input-number/style/index.scss +0 -70
- package/lib/lazy-image/style/index.d.ts +0 -1
- package/lib/lazy-image/style/index.js +0 -7
- package/lib/lazy-image/style/index.scss +0 -25
- package/lib/link-list/style/index.d.ts +0 -1
- package/lib/link-list/style/index.js +0 -9
- package/lib/link-list/style/index.scss +0 -125
- package/lib/loading/style/index.d.ts +0 -1
- package/lib/loading/style/index.js +0 -9
- package/lib/loading/style/index.scss +0 -21
- package/lib/loading-bar/style/index.d.ts +0 -1
- package/lib/loading-bar/style/index.js +0 -7
- package/lib/loading-bar/style/index.scss +0 -62
- package/lib/loading-container/style/index.d.ts +0 -1
- package/lib/loading-container/style/index.js +0 -9
- package/lib/loading-container/style/index.scss +0 -28
- package/lib/loading-icon/style/index.d.ts +0 -1
- package/lib/loading-icon/style/index.js +0 -7
- package/lib/loading-icon/style/index.scss +0 -24
- package/lib/mask/style/index.d.ts +0 -1
- package/lib/mask/style/index.js +0 -7
- package/lib/mask/style/index.scss +0 -35
- package/lib/message/style/index.d.ts +0 -1
- package/lib/message/style/index.js +0 -7
- package/lib/message/style/index.scss +0 -71
- package/lib/modal/style/index.d.ts +0 -1
- package/lib/modal/style/index.js +0 -9
- package/lib/modal/style/index.scss +0 -112
- package/lib/move/style/index.d.ts +0 -1
- package/lib/move/style/index.js +0 -7
- package/lib/move/style/index.scss +0 -7
- package/lib/popover/style/index.d.ts +0 -1
- package/lib/popover/style/index.js +0 -9
- package/lib/popover/style/index.scss +0 -60
- package/lib/portal/style/index.d.ts +0 -1
- package/lib/portal/style/index.js +0 -7
- package/lib/portal/style/index.scss +0 -0
- package/lib/script/style/index.d.ts +0 -1
- package/lib/script/style/index.js +0 -1
- package/lib/script/style/index.scss +0 -0
- package/lib/select/style/index.d.ts +0 -1
- package/lib/select/style/index.js +0 -9
- package/lib/select/style/index.scss +0 -126
- package/lib/show-more/style/index.d.ts +0 -1
- package/lib/show-more/style/index.js +0 -7
- package/lib/show-more/style/index.scss +0 -23
- package/lib/skeleton/style/index.d.ts +0 -1
- package/lib/skeleton/style/index.js +0 -7
- package/lib/skeleton/style/index.scss +0 -27
- package/lib/table/style/index.d.ts +0 -1
- package/lib/table/style/index.js +0 -11
- package/lib/table/style/index.scss +0 -45
- package/lib/tabs/style/index.d.ts +0 -1
- package/lib/tabs/style/index.js +0 -7
- package/lib/tabs/style/index.scss +0 -62
- package/lib/tooltip/style/index.d.ts +0 -1
- package/lib/tooltip/style/index.js +0 -9
- package/lib/tooltip/style/index.scss +0 -62
- package/lib/trigger/style/index.d.ts +0 -1
- package/lib/trigger/style/index.js +0 -7
- package/lib/trigger/style/index.scss +0 -79
package/lib/trigger/index.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactDom = require("react-dom");
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _utils = require("@autobest-ui/utils");
|
|
17
|
-
|
|
18
12
|
var _reactTransitionGroup = require("react-transition-group");
|
|
19
|
-
|
|
20
13
|
var _portal = _interopRequireDefault(require("../portal"));
|
|
21
|
-
|
|
22
14
|
var _ref = require("./ref");
|
|
23
|
-
|
|
24
15
|
var _getPopupLocation = _interopRequireDefault(require("./getPopupLocation"));
|
|
25
|
-
|
|
26
16
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
27
17
|
var _extendStatics = function extendStatics(d, b) {
|
|
28
18
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -34,140 +24,106 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
34
24
|
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
35
25
|
}
|
|
36
26
|
};
|
|
37
|
-
|
|
38
27
|
return _extendStatics(d, b);
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return function (d, b) {
|
|
42
30
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
43
|
-
|
|
44
31
|
_extendStatics(d, b);
|
|
45
|
-
|
|
46
32
|
function __() {
|
|
47
33
|
this.constructor = d;
|
|
48
34
|
}
|
|
49
|
-
|
|
50
35
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
51
36
|
};
|
|
52
37
|
}();
|
|
53
|
-
|
|
54
38
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
55
39
|
__assign = Object.assign || function (t) {
|
|
56
40
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
57
41
|
s = arguments[i];
|
|
58
|
-
|
|
59
42
|
for (var p in s) {
|
|
60
43
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
61
44
|
}
|
|
62
45
|
}
|
|
63
|
-
|
|
64
46
|
return t;
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
return __assign.apply(this, arguments);
|
|
68
49
|
};
|
|
69
|
-
|
|
70
50
|
function noop() {}
|
|
71
|
-
|
|
72
|
-
var Trigger =
|
|
73
|
-
/** @class */
|
|
74
|
-
function (_super) {
|
|
51
|
+
var Trigger = /** @class */function (_super) {
|
|
75
52
|
__extends(Trigger, _super);
|
|
76
|
-
|
|
77
53
|
function Trigger(props) {
|
|
78
54
|
var _this = _super.call(this, props) || this;
|
|
79
|
-
|
|
80
55
|
_this.prefixCls = 'ab-trigger';
|
|
81
56
|
_this.popupRef = /*#__PURE__*/_react.default.createRef();
|
|
82
57
|
_this.maskRef = /*#__PURE__*/_react.default.createRef();
|
|
83
58
|
_this.triggerRef = /*#__PURE__*/_react.default.createRef();
|
|
84
|
-
|
|
85
59
|
_this.isClickToHide = function () {
|
|
86
60
|
return _this.props.trigger.indexOf('click') !== -1;
|
|
87
61
|
};
|
|
88
|
-
|
|
89
62
|
_this.clearPopupTimer = function (popupEl) {
|
|
90
63
|
clearTimeout(_this.popupTimer);
|
|
91
|
-
|
|
92
64
|
var element = popupEl || _this.getPopupDomNode();
|
|
93
|
-
|
|
94
65
|
if (element) {
|
|
95
66
|
element.style.visibility = '';
|
|
96
67
|
}
|
|
97
68
|
};
|
|
98
|
-
|
|
99
69
|
_this.forceAlign = function (popupEl) {
|
|
100
70
|
var rootEl = _this.getRootDomNode();
|
|
101
|
-
|
|
102
71
|
popupEl = popupEl || _this.getPopupDomNode();
|
|
103
|
-
|
|
104
72
|
if (!popupEl || !rootEl) {
|
|
105
73
|
return;
|
|
106
74
|
}
|
|
107
|
-
|
|
108
75
|
_this.clearPopupTimer(popupEl);
|
|
109
|
-
|
|
110
76
|
var _a = _this.props,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
77
|
+
placement = _a.placement,
|
|
78
|
+
translateX = _a.translateX,
|
|
79
|
+
translateY = _a.translateY,
|
|
80
|
+
rootToPopupSpacing = _a.rootToPopupSpacing,
|
|
81
|
+
popupLimitSpacing = _a.popupLimitSpacing,
|
|
82
|
+
isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
|
|
83
|
+
hiddenArrow = _a.hiddenArrow,
|
|
84
|
+
onArrowStyleChange = _a.onArrowStyleChange,
|
|
85
|
+
maxHeight = _a.maxHeight,
|
|
86
|
+
isMinRootWidth = _a.isMinRootWidth,
|
|
87
|
+
isMaxRootWidth = _a.isMaxRootWidth,
|
|
88
|
+
isInsertNode = _a.isInsertNode;
|
|
124
89
|
if (maxHeight) {
|
|
125
90
|
popupEl.style.maxHeight = "".concat(maxHeight, "px");
|
|
126
91
|
popupEl.style.overflowY = 'auto';
|
|
127
92
|
}
|
|
128
|
-
|
|
129
93
|
if (isMinRootWidth || isMaxRootWidth) {
|
|
130
94
|
var rootWidth = (0, _utils.getElementSize)(rootEl).width;
|
|
131
|
-
|
|
132
95
|
if (isMinRootWidth) {
|
|
133
96
|
popupEl.style.minWidth = "".concat(rootWidth, "px");
|
|
134
97
|
}
|
|
135
|
-
|
|
136
98
|
if (isMaxRootWidth) {
|
|
137
99
|
popupEl.style.maxWidth = "".concat(rootWidth, "px");
|
|
138
100
|
popupEl.style.overflowX = 'auto';
|
|
139
101
|
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
102
|
+
}
|
|
103
|
+
// 计算Popup元素应该显示的位置
|
|
143
104
|
var _b = (0, _getPopupLocation.default)(placement, rootEl, popupEl, translateX, translateY, rootToPopupSpacing, popupLimitSpacing, isTransformHorizontalDirection, hiddenArrow, isInsertNode),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
105
|
+
left = _b.left,
|
|
106
|
+
top = _b.top,
|
|
107
|
+
arrowStyle = _b.arrowStyle,
|
|
108
|
+
transformOrigin = _b.transformOrigin,
|
|
109
|
+
popupMaxWidthByCalc = _b.maxWidth,
|
|
110
|
+
popupMaxHeightByCalc = _b.maxHeight,
|
|
111
|
+
width = _b.width,
|
|
112
|
+
height = _b.height;
|
|
153
113
|
_this.prevPopupSize = {
|
|
154
114
|
width: width,
|
|
155
115
|
height: height
|
|
156
116
|
};
|
|
157
|
-
|
|
158
117
|
if (!hiddenArrow && onArrowStyleChange && JSON.stringify(arrowStyle) !== JSON.stringify(_this.prevArrowStyle)) {
|
|
159
118
|
_this.prevArrowStyle = arrowStyle;
|
|
160
119
|
onArrowStyleChange(arrowStyle);
|
|
161
120
|
}
|
|
162
|
-
|
|
163
121
|
popupEl.style.transformOrigin = transformOrigin;
|
|
164
122
|
popupEl.style.left = "".concat(left, "px");
|
|
165
123
|
popupEl.style.top = "".concat(top, "px");
|
|
166
|
-
|
|
167
124
|
if (popupMaxHeightByCalc) {
|
|
168
125
|
popupEl.style.maxHeight = "".concat(popupMaxWidthByCalc, "px");
|
|
169
126
|
}
|
|
170
|
-
|
|
171
127
|
if (popupMaxWidthByCalc) {
|
|
172
128
|
popupEl.style.maxWidth = "".concat(popupMaxWidthByCalc, "px");
|
|
173
129
|
popupEl.style.overflowX = 'auto';
|
|
@@ -175,89 +131,67 @@ function (_super) {
|
|
|
175
131
|
popupEl.style.maxWidth = '';
|
|
176
132
|
}
|
|
177
133
|
};
|
|
178
|
-
|
|
179
134
|
_this.getRootDomNode = function () {
|
|
180
135
|
var getCurrentDOMNode = _this.props.getCurrentDOMNode;
|
|
181
|
-
|
|
182
136
|
if (getCurrentDOMNode) {
|
|
183
137
|
return getCurrentDOMNode(_this.triggerRef.current);
|
|
184
138
|
}
|
|
185
|
-
|
|
186
139
|
try {
|
|
187
140
|
// 支持children是组件的情况, 穿透组件获取HTML元素
|
|
188
141
|
// eslint-disable-next-line react/no-find-dom-node
|
|
189
142
|
var domNode = (0, _reactDom.findDOMNode)(_this.triggerRef.current);
|
|
190
|
-
|
|
191
143
|
if (domNode) {
|
|
192
144
|
return domNode;
|
|
193
145
|
}
|
|
194
146
|
} catch (err) {}
|
|
195
|
-
|
|
196
147
|
return null;
|
|
197
148
|
};
|
|
198
149
|
/**
|
|
199
150
|
* 全局事件回调
|
|
200
151
|
* @param event
|
|
201
152
|
*/
|
|
202
|
-
|
|
203
|
-
|
|
204
153
|
_this.onDocumentClick = function (event) {
|
|
205
154
|
if (!_this.state.visible) {
|
|
206
155
|
return;
|
|
207
156
|
}
|
|
208
|
-
|
|
209
157
|
var target = event.target;
|
|
210
|
-
|
|
211
158
|
var root = _this.getRootDomNode();
|
|
212
|
-
|
|
213
159
|
var popupNode = _this.getPopupDomNode();
|
|
214
|
-
|
|
215
160
|
if (!root || !target || !popupNode) {
|
|
216
161
|
return;
|
|
217
162
|
}
|
|
218
|
-
|
|
219
163
|
var showMask = _this.props.showMask;
|
|
220
|
-
|
|
221
164
|
var maskEl = _this.getMaskDomNode();
|
|
222
|
-
|
|
223
165
|
if (showMask && !maskEl) {
|
|
224
166
|
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
167
|
+
}
|
|
168
|
+
// 排除操作当前元素
|
|
228
169
|
if (!(0, _utils.contains)(root, target) && (!showMask || maskEl === target) && !(0, _utils.contains)(popupNode, target) && !_this.hasPopupMouseDown) {
|
|
229
170
|
_this.hidePopup();
|
|
230
171
|
}
|
|
231
172
|
};
|
|
232
|
-
|
|
233
173
|
_this.showPopup = function () {
|
|
234
174
|
_this.triggerPopup(true);
|
|
235
175
|
};
|
|
236
|
-
|
|
237
176
|
_this.hidePopup = function (ev) {
|
|
238
177
|
if (ev) {
|
|
239
178
|
ev.stopPropagation();
|
|
240
179
|
ev.nativeEvent.stopImmediatePropagation();
|
|
241
180
|
}
|
|
242
|
-
|
|
243
181
|
_this.triggerPopup(false);
|
|
244
182
|
};
|
|
245
|
-
|
|
246
183
|
_this.onVisibleChange = function (visible) {
|
|
247
184
|
var prevVisible = _this.state.visible;
|
|
248
185
|
clearTimeout(_this.delayTimer);
|
|
249
|
-
|
|
250
186
|
if (prevVisible !== visible) {
|
|
251
187
|
if (!_this.isOutsideControl()) {
|
|
252
188
|
_this.setState({
|
|
253
189
|
visible: visible
|
|
254
190
|
});
|
|
255
191
|
}
|
|
256
|
-
|
|
257
192
|
var _a = _this.props,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
193
|
+
onVisibleChange = _a.onVisibleChange,
|
|
194
|
+
name_1 = _a.name;
|
|
261
195
|
if (onVisibleChange) {
|
|
262
196
|
onVisibleChange(visible, name_1);
|
|
263
197
|
}
|
|
@@ -267,21 +201,17 @@ function (_super) {
|
|
|
267
201
|
* 设置显示与隐藏
|
|
268
202
|
* @param nextVisible
|
|
269
203
|
*/
|
|
270
|
-
|
|
271
|
-
|
|
272
204
|
_this.triggerPopup = function (nextVisible) {
|
|
273
205
|
if (nextVisible) {
|
|
274
|
-
_this.hasPopupMouseDown = true;
|
|
275
|
-
|
|
206
|
+
_this.hasPopupMouseDown = true;
|
|
207
|
+
// 禁止执行全局监听,回调函数中的隐藏功能
|
|
276
208
|
clearTimeout(_this.mouseDownTimeout);
|
|
277
209
|
_this.mouseDownTimeout = setTimeout(function () {
|
|
278
210
|
_this.hasPopupMouseDown = false;
|
|
279
211
|
}, 0);
|
|
280
212
|
}
|
|
281
|
-
|
|
282
213
|
_this.onVisibleChange(nextVisible);
|
|
283
214
|
};
|
|
284
|
-
|
|
285
215
|
_this.onPopupMouseDown = function () {
|
|
286
216
|
_this.hasPopupMouseDown = true;
|
|
287
217
|
clearTimeout(_this.mouseDownTimeout);
|
|
@@ -289,59 +219,45 @@ function (_super) {
|
|
|
289
219
|
_this.hasPopupMouseDown = false;
|
|
290
220
|
}, 0);
|
|
291
221
|
};
|
|
292
|
-
|
|
293
222
|
_this.onClick = function (event) {
|
|
294
223
|
if (event && event.preventDefault) {
|
|
295
224
|
event.preventDefault();
|
|
296
225
|
}
|
|
297
|
-
|
|
298
226
|
var touch = (0, _utils.isTouchScreen)();
|
|
299
|
-
|
|
300
227
|
if (event.type === 'touchstart' && touch || event.type === 'mousedown' && !touch) {
|
|
301
228
|
_this.triggerPopup(!_this.state.visible);
|
|
302
229
|
}
|
|
303
230
|
};
|
|
304
|
-
|
|
305
231
|
_this.onMouseEnter = function () {
|
|
306
232
|
_this.delaySetPopupVisible(true, _this.props.mouseEnterDelay);
|
|
307
233
|
};
|
|
308
|
-
|
|
309
234
|
_this.onMouseLeave = function () {
|
|
310
235
|
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
|
311
236
|
};
|
|
312
|
-
|
|
313
237
|
_this.onPopupMouseEnter = function () {
|
|
314
238
|
clearTimeout(_this.delayTimer);
|
|
315
239
|
};
|
|
316
|
-
|
|
317
240
|
_this.onPopupMouseLeave = function () {
|
|
318
241
|
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
|
319
242
|
};
|
|
320
|
-
|
|
321
243
|
_this.onExited = function () {
|
|
322
244
|
_this.clearPopupTimer();
|
|
323
|
-
|
|
324
245
|
var onDestroy = _this.props.onDestroy;
|
|
325
|
-
|
|
326
246
|
if (onDestroy) {
|
|
327
247
|
onDestroy();
|
|
328
248
|
}
|
|
329
249
|
};
|
|
330
|
-
|
|
331
250
|
_this.isCurrentTrigger = function (eventName, trigger) {
|
|
332
251
|
return trigger.indexOf(eventName) !== -1;
|
|
333
252
|
};
|
|
334
|
-
|
|
335
253
|
_this.isOutsideControl = function () {
|
|
336
254
|
return 'visible' in _this.props;
|
|
337
255
|
};
|
|
338
|
-
|
|
339
256
|
_this.onPreventThrough = function (event) {
|
|
340
257
|
if (event && event.preventDefault) {
|
|
341
258
|
event.preventDefault();
|
|
342
259
|
}
|
|
343
260
|
};
|
|
344
|
-
|
|
345
261
|
_this.state = {
|
|
346
262
|
visible: false,
|
|
347
263
|
isUserOperated: false,
|
|
@@ -349,7 +265,6 @@ function (_super) {
|
|
|
349
265
|
};
|
|
350
266
|
return _this;
|
|
351
267
|
}
|
|
352
|
-
|
|
353
268
|
Trigger.getPopupInnerHeight = function (element) {
|
|
354
269
|
if (element.children && element.children.length) {
|
|
355
270
|
var height_1 = (0, _utils.getStyleValue)(element, 'padding-top') + (0, _utils.getStyleValue)(element, 'padding-bottom');
|
|
@@ -359,53 +274,40 @@ function (_super) {
|
|
|
359
274
|
});
|
|
360
275
|
return height_1;
|
|
361
276
|
}
|
|
362
|
-
|
|
363
277
|
return (0, _utils.getElementSize)(element).height;
|
|
364
278
|
};
|
|
365
|
-
|
|
366
279
|
Trigger.getDerivedStateFromProps = function (nextProps, preState) {
|
|
367
280
|
var nextState = {};
|
|
368
|
-
|
|
369
281
|
if ('visible' in nextProps) {
|
|
370
282
|
nextState.visible = nextProps.visible;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
283
|
+
}
|
|
284
|
+
// 在触摸屏下, hover 事件转成click
|
|
374
285
|
if (nextProps.trigger === 'hover' && (0, _utils.isTouchScreen)()) {
|
|
375
286
|
nextState.trigger = 'click';
|
|
376
287
|
}
|
|
377
|
-
|
|
378
288
|
var isUserOperated = preState.isUserOperated || nextState.visible || preState.visible;
|
|
379
|
-
|
|
380
289
|
if (isUserOperated !== preState.isUserOperated) {
|
|
381
290
|
nextState.isUserOperated = isUserOperated;
|
|
382
291
|
}
|
|
383
|
-
|
|
384
292
|
if ((0, _utils.isEmptyObject)(nextState)) {
|
|
385
293
|
return null;
|
|
386
294
|
}
|
|
387
|
-
|
|
388
295
|
return nextState;
|
|
389
296
|
};
|
|
390
|
-
|
|
391
297
|
Trigger.prototype.componentDidMount = function () {
|
|
392
298
|
this.componentDidUpdate();
|
|
393
299
|
};
|
|
394
|
-
|
|
395
300
|
Trigger.prototype.componentDidUpdate = function () {
|
|
396
301
|
var _this = this;
|
|
397
|
-
|
|
398
302
|
var visible = this.state.visible;
|
|
399
|
-
|
|
400
303
|
if (!visible) {
|
|
401
304
|
// 其中参数是解决: 当同时多个trigger在同一个组件中,一个更新(一个使用visible)导致多个都发生componentDidUpdate
|
|
402
305
|
// 应该不让其他trigger 的delay事件销毁
|
|
403
306
|
this.clearOutsideHandler(true);
|
|
404
307
|
return;
|
|
405
308
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
309
|
+
var popupEl = this.getPopupDomNode();
|
|
310
|
+
// 加入 resize 监听
|
|
409
311
|
if (this.props.monitorWindowResize && !this.resizeHandler) {
|
|
410
312
|
var handle = this.props.windowResizeHidden ? (0, _utils.throttleWithRAF)(function () {
|
|
411
313
|
return _this.triggerPopup(false);
|
|
@@ -413,126 +315,99 @@ function (_super) {
|
|
|
413
315
|
return _this.forceAlign();
|
|
414
316
|
});
|
|
415
317
|
this.resizeHandler = (0, _utils.addEventListener)(window, 'resize', handle);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
318
|
+
}
|
|
319
|
+
// 加入 scroll 监听
|
|
419
320
|
if (visible && this.props.scrollClosable && !this.scrollHandler) {
|
|
420
321
|
this.scrollHandler = (0, _utils.addEventListener)(window, 'scroll', function () {
|
|
421
322
|
if (_this.scrollHandler) {
|
|
422
323
|
_this.scrollHandler.remove();
|
|
423
|
-
|
|
424
324
|
_this.scrollHandler = null;
|
|
425
325
|
}
|
|
426
|
-
|
|
427
326
|
_this.triggerPopup(false);
|
|
428
327
|
});
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
|
|
328
|
+
}
|
|
329
|
+
// 需要监听 `mousedown` or `touchstart`, 而不是click
|
|
432
330
|
var currentDocument;
|
|
433
331
|
var touch = (0, _utils.isTouchScreen)();
|
|
434
|
-
|
|
435
332
|
if (!this.clickOutsideHandler && !touch && this.isClickToHide()) {
|
|
436
333
|
currentDocument = window.document;
|
|
437
334
|
this.clickOutsideHandler = (0, _utils.addEventListener)(currentDocument, 'mousedown', this.onDocumentClick);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
335
|
+
}
|
|
336
|
+
// always hide on mobile
|
|
441
337
|
if (!this.touchOutsideHandler) {
|
|
442
338
|
currentDocument = currentDocument || window.document;
|
|
443
339
|
this.touchOutsideHandler = (0, _utils.addEventListener)(currentDocument, 'touchstart', this.onDocumentClick);
|
|
444
340
|
}
|
|
445
|
-
|
|
446
341
|
if (popupEl && this.prevPopupSize) {
|
|
447
342
|
var _a = (0, _utils.getElementSize)(popupEl),
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
343
|
+
width = _a.width,
|
|
344
|
+
height = _a.height;
|
|
451
345
|
if (this.prevPopupSize.width !== width || this.prevPopupSize.height !== height) {
|
|
452
346
|
this.clearPopupTimer(popupEl);
|
|
453
347
|
popupEl.style.visibility = 'hidden';
|
|
454
348
|
this.popupTimer = setTimeout(function () {
|
|
455
349
|
_this.forceAlign(popupEl);
|
|
456
|
-
|
|
457
350
|
popupEl.style.visibility = '';
|
|
458
351
|
});
|
|
459
352
|
}
|
|
460
353
|
}
|
|
461
354
|
};
|
|
462
|
-
|
|
463
355
|
Trigger.prototype.componentWillUnmount = function () {
|
|
464
356
|
// remove绑定事件
|
|
465
357
|
this.clearOutsideHandler();
|
|
466
358
|
};
|
|
467
|
-
|
|
468
359
|
Trigger.prototype.getPopupDomNode = function () {
|
|
469
360
|
if (this.popupRef && this.popupRef.current) {
|
|
470
361
|
return this.popupRef.current;
|
|
471
362
|
}
|
|
472
|
-
|
|
473
363
|
return null;
|
|
474
364
|
};
|
|
475
|
-
|
|
476
365
|
Trigger.prototype.getMaskDomNode = function () {
|
|
477
366
|
if (this.maskRef && this.maskRef.current) {
|
|
478
367
|
return this.maskRef.current;
|
|
479
368
|
}
|
|
480
|
-
|
|
481
369
|
return null;
|
|
482
370
|
};
|
|
483
|
-
|
|
484
371
|
Trigger.prototype.clearOutsideHandler = function (ignoreDelayTimer) {
|
|
485
372
|
// clearTimeout(this.mouseDownTimeout);
|
|
486
373
|
if (!ignoreDelayTimer) {
|
|
487
374
|
clearTimeout(this.delayTimer);
|
|
488
375
|
}
|
|
489
|
-
|
|
490
376
|
this.clearPopupTimer();
|
|
491
|
-
|
|
492
377
|
if (this.resizeHandler) {
|
|
493
378
|
this.resizeHandler.remove();
|
|
494
379
|
this.resizeHandler = null;
|
|
495
380
|
}
|
|
496
|
-
|
|
497
381
|
if (this.scrollHandler) {
|
|
498
382
|
this.scrollHandler.remove();
|
|
499
383
|
this.scrollHandler = null;
|
|
500
384
|
}
|
|
501
|
-
|
|
502
385
|
if (this.clickOutsideHandler) {
|
|
503
386
|
this.clickOutsideHandler.remove();
|
|
504
387
|
this.clickOutsideHandler = null;
|
|
505
388
|
}
|
|
506
|
-
|
|
507
389
|
if (this.touchOutsideHandler) {
|
|
508
390
|
this.touchOutsideHandler.remove();
|
|
509
391
|
this.touchOutsideHandler = null;
|
|
510
392
|
}
|
|
511
393
|
};
|
|
512
|
-
|
|
513
394
|
Trigger.prototype.delaySetPopupVisible = function (visible, delayTime) {
|
|
514
395
|
var _this = this;
|
|
515
|
-
|
|
516
396
|
clearTimeout(this.delayTimer);
|
|
517
|
-
|
|
518
397
|
if (delayTime) {
|
|
519
398
|
var delay = delayTime * 1000;
|
|
520
399
|
this.delayTimer = setTimeout(function () {
|
|
521
400
|
_this.triggerPopup(visible);
|
|
522
|
-
|
|
523
401
|
clearTimeout(_this.delayTimer);
|
|
524
402
|
}, delay);
|
|
525
403
|
} else {
|
|
526
404
|
this.triggerPopup(visible);
|
|
527
405
|
}
|
|
528
406
|
};
|
|
529
|
-
|
|
530
407
|
Trigger.prototype.renderMask = function () {
|
|
531
408
|
var _a;
|
|
532
|
-
|
|
533
409
|
var visible = this.state.visible;
|
|
534
410
|
var showMask = this.props.showMask;
|
|
535
|
-
|
|
536
411
|
if (showMask) {
|
|
537
412
|
var cls = this.prefixCls;
|
|
538
413
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -541,32 +416,27 @@ function (_super) {
|
|
|
541
416
|
onTouchEnd: this.onPreventThrough
|
|
542
417
|
});
|
|
543
418
|
}
|
|
544
|
-
|
|
545
419
|
return null;
|
|
546
420
|
};
|
|
547
|
-
|
|
548
421
|
Trigger.prototype.renderPopupContent = function () {
|
|
549
422
|
var _a;
|
|
550
|
-
|
|
551
423
|
var cls = this.prefixCls;
|
|
552
424
|
var _b = this.props,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
425
|
+
popup = _b.popup,
|
|
426
|
+
wrapClassName = _b.wrapClassName,
|
|
427
|
+
isTransformHorizontalDirection = _b.isTransformHorizontalDirection,
|
|
428
|
+
isInsertNode = _b.isInsertNode;
|
|
557
429
|
var _c = this.state,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
var wrapClass = (0, _classnames.default)("".concat(cls, "-wrap"), wrapClassName, (_a = {}, _a["".concat(cls, "-hidden")] = isInsertNode && !isUserOperated && !visible, _a));
|
|
562
|
-
|
|
430
|
+
visible = _c.visible,
|
|
431
|
+
isUserOperated = _c.isUserOperated,
|
|
432
|
+
trigger = _c.trigger;
|
|
433
|
+
var wrapClass = (0, _classnames.default)("".concat(cls, "-wrap"), wrapClassName, (_a = {}, _a["".concat(cls, "-hidden")] = isInsertNode && !isUserOperated && !visible, _a));
|
|
434
|
+
// hover 下,对popup增加相应的事件,延迟隐藏,可以在弹框中停留
|
|
563
435
|
var mouseProps = {};
|
|
564
|
-
|
|
565
436
|
if (this.isCurrentTrigger('hover', trigger)) {
|
|
566
437
|
mouseProps.onMouseEnter = this.onPopupMouseEnter;
|
|
567
438
|
mouseProps.onMouseLeave = this.onPopupMouseLeave;
|
|
568
439
|
}
|
|
569
|
-
|
|
570
440
|
mouseProps.onMouseDown = this.onPopupMouseDown;
|
|
571
441
|
mouseProps.onTouchStart = this.onPopupMouseDown;
|
|
572
442
|
return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
|
|
@@ -584,61 +454,46 @@ function (_super) {
|
|
|
584
454
|
/**
|
|
585
455
|
* 扩充children属性,根据trigger绑定不同事件
|
|
586
456
|
*/
|
|
587
|
-
|
|
588
|
-
|
|
589
457
|
Trigger.prototype.renderChildComponent = function () {
|
|
590
458
|
var children = this.props.children;
|
|
591
459
|
var trigger = this.state.trigger;
|
|
592
|
-
|
|
593
460
|
var child = _react.default.Children.only(children);
|
|
594
|
-
|
|
595
461
|
var newChildProps = {
|
|
596
462
|
key: 'trigger'
|
|
597
463
|
};
|
|
598
|
-
|
|
599
464
|
if (this.isCurrentTrigger('hover', trigger) && this.props.trigger === trigger) {
|
|
600
465
|
newChildProps.onMouseEnter = this.onMouseEnter;
|
|
601
466
|
newChildProps.onMouseLeave = this.onMouseLeave;
|
|
602
467
|
}
|
|
603
|
-
|
|
604
468
|
if (!this.isOutsideControl() || this.props.trigger !== trigger) {
|
|
605
469
|
if (this.isCurrentTrigger('click', trigger)) {
|
|
606
470
|
newChildProps.onMouseDown = this.onClick;
|
|
607
471
|
newChildProps.onTouchStart = this.onClick;
|
|
608
472
|
}
|
|
609
|
-
|
|
610
473
|
if (this.isCurrentTrigger('focus', trigger)) {
|
|
611
474
|
newChildProps.onFocus = this.showPopup;
|
|
612
475
|
newChildProps.onBlur = this.hidePopup;
|
|
613
476
|
}
|
|
614
477
|
}
|
|
615
|
-
|
|
616
478
|
var cloneProps = __assign({}, newChildProps);
|
|
617
|
-
|
|
618
479
|
if ((0, _ref.supportRef)(child)) {
|
|
619
480
|
cloneProps.ref = (0, _ref.composeRef)(this.triggerRef, child.ref);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
|
|
481
|
+
}
|
|
482
|
+
// 对当前children元素添加额外属性
|
|
623
483
|
return /*#__PURE__*/_react.default.cloneElement(child, cloneProps);
|
|
624
484
|
};
|
|
625
|
-
|
|
626
485
|
Trigger.prototype.renderPopupComponent = function () {
|
|
627
486
|
if (this.props.isInsertNode) {
|
|
628
487
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, this.renderMask(), this.renderPopupContent());
|
|
629
488
|
}
|
|
630
|
-
|
|
631
489
|
if (this.state.visible || this.popupRef.current) {
|
|
632
490
|
return /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, this.renderMask(), this.renderPopupContent()));
|
|
633
491
|
}
|
|
634
|
-
|
|
635
492
|
return null;
|
|
636
493
|
};
|
|
637
|
-
|
|
638
494
|
Trigger.prototype.render = function () {
|
|
639
495
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, this.renderChildComponent(), this.renderPopupComponent());
|
|
640
496
|
};
|
|
641
|
-
|
|
642
497
|
Trigger.defaultProps = {
|
|
643
498
|
placement: 'Top',
|
|
644
499
|
trigger: 'hover',
|
|
@@ -662,6 +517,5 @@ function (_super) {
|
|
|
662
517
|
};
|
|
663
518
|
return Trigger;
|
|
664
519
|
}(_react.default.Component);
|
|
665
|
-
|
|
666
520
|
var _default = Trigger;
|
|
667
521
|
exports.default = _default;
|