@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/modal/index.js
CHANGED
|
@@ -1,30 +1,19 @@
|
|
|
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 _reactTransitionGroup = require("react-transition-group");
|
|
13
|
-
|
|
14
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
11
|
var _utils = require("@autobest-ui/utils");
|
|
17
|
-
|
|
18
12
|
var _portal = _interopRequireDefault(require("../portal"));
|
|
19
|
-
|
|
20
13
|
var _mask = _interopRequireDefault(require("../mask"));
|
|
21
|
-
|
|
22
14
|
var _Title = _interopRequireDefault(require("./Title"));
|
|
23
|
-
|
|
24
15
|
var _Affix = _interopRequireDefault(require("./Affix"));
|
|
25
|
-
|
|
26
16
|
var _getPopupLocation = _interopRequireDefault(require("./getPopupLocation"));
|
|
27
|
-
|
|
28
17
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
29
18
|
var _extendStatics = function extendStatics(d, b) {
|
|
30
19
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -36,23 +25,17 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
36
25
|
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
37
26
|
}
|
|
38
27
|
};
|
|
39
|
-
|
|
40
28
|
return _extendStatics(d, b);
|
|
41
29
|
};
|
|
42
|
-
|
|
43
30
|
return function (d, b) {
|
|
44
31
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
45
|
-
|
|
46
32
|
_extendStatics(d, b);
|
|
47
|
-
|
|
48
33
|
function __() {
|
|
49
34
|
this.constructor = d;
|
|
50
35
|
}
|
|
51
|
-
|
|
52
36
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
53
37
|
};
|
|
54
38
|
}();
|
|
55
|
-
|
|
56
39
|
function getId() {
|
|
57
40
|
try {
|
|
58
41
|
return new Date().getTime();
|
|
@@ -60,15 +43,10 @@ function getId() {
|
|
|
60
43
|
return Math.random();
|
|
61
44
|
}
|
|
62
45
|
}
|
|
63
|
-
|
|
64
|
-
var Modal =
|
|
65
|
-
/** @class */
|
|
66
|
-
function (_super) {
|
|
46
|
+
var Modal = /** @class */function (_super) {
|
|
67
47
|
__extends(Modal, _super);
|
|
68
|
-
|
|
69
48
|
function Modal(props) {
|
|
70
49
|
var _this = _super.call(this, props) || this;
|
|
71
|
-
|
|
72
50
|
_this.openId = getId();
|
|
73
51
|
_this.prefixCls = 'ab-modal';
|
|
74
52
|
_this.scrollBarSize = 0;
|
|
@@ -78,114 +56,88 @@ function (_super) {
|
|
|
78
56
|
* 全局事件回调
|
|
79
57
|
* @param event
|
|
80
58
|
*/
|
|
81
|
-
|
|
82
59
|
_this.onDocumentClick = function (event) {
|
|
83
60
|
if (!_this.props.visible) {
|
|
84
61
|
return;
|
|
85
62
|
}
|
|
86
|
-
|
|
87
63
|
var target = event.target;
|
|
88
|
-
|
|
89
64
|
var popupEl = _this.getPopupDomNode();
|
|
90
|
-
|
|
91
65
|
var maskEl = _this.getMaskDomNode();
|
|
92
|
-
|
|
93
66
|
if (!target || !popupEl || !maskEl) {
|
|
94
67
|
return;
|
|
95
68
|
}
|
|
96
|
-
|
|
97
69
|
var notCloseElement;
|
|
98
|
-
|
|
99
70
|
if (_this.props.getNotCloseElement) {
|
|
100
71
|
notCloseElement = _this.props.getNotCloseElement();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
72
|
+
}
|
|
73
|
+
// 排除操作当前元素
|
|
104
74
|
if (!(0, _utils.contains)(popupEl, target) && (maskEl === target || target === popupEl.parentNode) || notCloseElement && !(0, _utils.contains)(notCloseElement, target)) {
|
|
105
75
|
_this.onClose(target, true);
|
|
106
76
|
}
|
|
107
77
|
};
|
|
108
|
-
|
|
109
78
|
_this.clearPopupTimer = function (popupEl) {
|
|
110
79
|
clearTimeout(_this.popupTimer);
|
|
111
|
-
|
|
112
80
|
var element = popupEl || _this.getPopupDomNode();
|
|
113
|
-
|
|
114
81
|
if (element) {
|
|
115
82
|
element.style.visibility = '';
|
|
116
83
|
}
|
|
117
84
|
};
|
|
118
|
-
|
|
119
85
|
_this.onClose = function (event, isOutsideClick) {
|
|
120
86
|
if (isOutsideClick === void 0) {
|
|
121
87
|
isOutsideClick = false;
|
|
122
88
|
}
|
|
123
|
-
|
|
124
89
|
var _a = _this.props,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
90
|
+
closable = _a.closable,
|
|
91
|
+
maskClosable = _a.maskClosable,
|
|
92
|
+
onClose = _a.onClose,
|
|
93
|
+
name = _a.name;
|
|
130
94
|
if ((isOutsideClick && maskClosable || !isOutsideClick && closable) && onClose) {
|
|
131
95
|
onClose(event, name);
|
|
132
96
|
}
|
|
133
97
|
};
|
|
134
|
-
|
|
135
98
|
_this.onEnter = function (popupEl) {
|
|
136
99
|
var element = popupEl || _this.getPopupDomNode();
|
|
137
|
-
|
|
138
100
|
if (!element) {
|
|
139
101
|
return;
|
|
140
102
|
}
|
|
141
|
-
|
|
142
103
|
if (element && element.parentNode) {
|
|
143
104
|
var parentNode = element.parentNode;
|
|
144
105
|
parentNode.style.display = 'block';
|
|
145
106
|
}
|
|
146
|
-
|
|
147
107
|
_this.clearPopupTimer(element);
|
|
148
|
-
|
|
149
108
|
var _a = _this.props,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
109
|
+
placement = _a.placement,
|
|
110
|
+
hiddenScroll = _a.hiddenScroll,
|
|
111
|
+
targetTop = _a.top,
|
|
112
|
+
popupLimitSpacing = _a.popupLimitSpacing;
|
|
155
113
|
if (hiddenScroll) {
|
|
156
114
|
Modal.cacheOpenedIds.push(_this.openId);
|
|
157
115
|
var currentDocument = window.document.body;
|
|
158
116
|
currentDocument.style.overflow = 'hidden';
|
|
159
|
-
|
|
160
117
|
if ((0, _utils.hasVerticalScrollbar)(_this.scrollBarSize)) {
|
|
161
118
|
currentDocument.style.paddingRight = "".concat(_this.scrollBarSize, "px");
|
|
162
|
-
|
|
163
119
|
if (element && element.parentNode) {
|
|
164
120
|
var parentNode = element.parentNode;
|
|
165
121
|
parentNode.style.paddingRight = "".concat(_this.scrollBarSize, "px");
|
|
166
122
|
}
|
|
167
123
|
}
|
|
168
124
|
}
|
|
169
|
-
|
|
170
125
|
var _b = (0, _getPopupLocation.default)({
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
126
|
+
placement: placement,
|
|
127
|
+
element: element,
|
|
128
|
+
targetTop: targetTop,
|
|
129
|
+
popupLimitSpacing: popupLimitSpacing
|
|
130
|
+
}),
|
|
131
|
+
top = _b.top,
|
|
132
|
+
height = _b.height;
|
|
179
133
|
if (top) {
|
|
180
134
|
element.style.top = top;
|
|
181
135
|
}
|
|
182
|
-
|
|
183
136
|
if (height) {
|
|
184
137
|
element.style.height = height;
|
|
185
138
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
139
|
+
var isFixedTitle = _this.props.isFixedTitle;
|
|
140
|
+
// 固定title
|
|
189
141
|
if (isFixedTitle) {
|
|
190
142
|
// 需要延迟执行
|
|
191
143
|
_this.affixTimer = setTimeout(function () {
|
|
@@ -195,7 +147,6 @@ function (_super) {
|
|
|
195
147
|
var firstChildHeight = (0, _utils.getStyleValue)(firstChild, 'height');
|
|
196
148
|
lastChild.style.overflow = 'auto';
|
|
197
149
|
var popupHeight = height || _this.props.height;
|
|
198
|
-
|
|
199
150
|
if (!popupHeight || popupHeight === 'auto') {
|
|
200
151
|
lastChild.style.maxHeight = "calc(100vh - .3rem - ".concat(placement === 'top' && top ? top : '0px', " - ").concat(firstChildHeight, "px)");
|
|
201
152
|
} else {
|
|
@@ -204,55 +155,47 @@ function (_super) {
|
|
|
204
155
|
});
|
|
205
156
|
}
|
|
206
157
|
};
|
|
207
|
-
|
|
208
158
|
_this.onEntered = function () {
|
|
209
159
|
var _a = _this.props,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
160
|
+
onOpened = _a.onOpened,
|
|
161
|
+
name = _a.name;
|
|
213
162
|
if (onOpened) {
|
|
214
163
|
onOpened(name);
|
|
215
164
|
}
|
|
216
165
|
};
|
|
217
|
-
|
|
218
166
|
_this.onExited = function (element) {
|
|
219
167
|
clearTimeout(_this.affixTimer);
|
|
220
168
|
var _a = _this.props,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
169
|
+
hiddenScroll = _a.hiddenScroll,
|
|
170
|
+
onDestroy = _a.onDestroy,
|
|
171
|
+
name = _a.name;
|
|
224
172
|
var currentDocument = window.document.body;
|
|
225
|
-
|
|
226
173
|
if (hiddenScroll && currentDocument) {
|
|
227
174
|
// 删除指定id
|
|
228
175
|
Modal.cacheOpenedIds = Modal.cacheOpenedIds.filter(function (id) {
|
|
229
176
|
return id !== _this.openId;
|
|
230
|
-
});
|
|
231
|
-
|
|
177
|
+
});
|
|
178
|
+
// 如果都隐藏了,才清除body样式
|
|
232
179
|
if (Modal.cacheOpenedIds.length === 0) {
|
|
233
180
|
currentDocument.style.overflow = '';
|
|
234
181
|
currentDocument.style.paddingRight = '';
|
|
235
182
|
}
|
|
236
183
|
}
|
|
237
|
-
|
|
238
184
|
if (element && element.parentNode) {
|
|
239
185
|
var parentNode = element.parentNode;
|
|
240
186
|
parentNode.style.display = 'none';
|
|
241
187
|
parentNode.style.paddingRight = '';
|
|
242
188
|
}
|
|
243
|
-
|
|
244
189
|
if (onDestroy) {
|
|
245
190
|
onDestroy(name);
|
|
246
191
|
}
|
|
247
192
|
};
|
|
248
|
-
|
|
249
193
|
_this.state = {
|
|
250
194
|
isUserOperated: false,
|
|
251
195
|
cacheVisible: props.visible
|
|
252
196
|
};
|
|
253
197
|
return _this;
|
|
254
198
|
}
|
|
255
|
-
|
|
256
199
|
Modal.getDerivedStateFromProps = function (nextProps, preState) {
|
|
257
200
|
// isInsertNode为true时,只判断isUserOperated为false的情况
|
|
258
201
|
if (nextProps.isInsertNode && !preState.isUserOperated && preState.cacheVisible !== nextProps.visible) {
|
|
@@ -261,129 +204,101 @@ function (_super) {
|
|
|
261
204
|
isUserOperated: true
|
|
262
205
|
};
|
|
263
206
|
}
|
|
264
|
-
|
|
265
207
|
return null;
|
|
266
208
|
};
|
|
267
|
-
|
|
268
209
|
Modal.prototype.componentDidMount = function () {
|
|
269
210
|
this.scrollBarSize = (0, _utils.getScrollBarSize)();
|
|
270
211
|
this.componentDidUpdate();
|
|
271
212
|
};
|
|
272
|
-
|
|
273
213
|
Modal.prototype.getSnapshotBeforeUpdate = function () {
|
|
274
214
|
var popupEl = this.getPopupDomNode();
|
|
275
|
-
|
|
276
215
|
if (this.props.visible && popupEl) {
|
|
277
216
|
var displayValue = (0, _utils.getStyle)(popupEl, 'display');
|
|
278
|
-
|
|
279
217
|
if (displayValue === 'none') {
|
|
280
218
|
return null;
|
|
281
219
|
}
|
|
282
|
-
|
|
283
220
|
return (0, _utils.getElementSize)(popupEl);
|
|
284
221
|
}
|
|
285
|
-
|
|
286
222
|
return null;
|
|
287
223
|
};
|
|
288
|
-
|
|
289
224
|
Modal.prototype.componentDidUpdate = function (_prevProps, _prevState, prevPopupSize) {
|
|
290
225
|
var _this = this;
|
|
291
|
-
|
|
292
226
|
if (!this.props.visible) {
|
|
293
227
|
this.clearOutsideHandler();
|
|
294
228
|
return;
|
|
295
229
|
}
|
|
296
|
-
|
|
297
230
|
var currentDocument;
|
|
298
231
|
var touch = (0, _utils.isTouchScreen)();
|
|
299
|
-
|
|
300
232
|
if (!this.clickOutsideHandler && !touch) {
|
|
301
233
|
currentDocument = window.document;
|
|
302
234
|
this.clickOutsideHandler = (0, _utils.addEventListener)(currentDocument, 'mousedown', this.onDocumentClick);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
235
|
+
}
|
|
236
|
+
// always hide on mobile
|
|
306
237
|
if (!this.touchOutsideHandler && touch) {
|
|
307
238
|
currentDocument = currentDocument || window.document;
|
|
308
239
|
this.touchOutsideHandler = (0, _utils.addEventListener)(currentDocument, 'touchstart', this.onDocumentClick);
|
|
309
240
|
}
|
|
310
|
-
|
|
311
241
|
if (!prevPopupSize) {
|
|
312
242
|
return;
|
|
313
243
|
}
|
|
314
|
-
|
|
315
244
|
var popupEl = this.getPopupDomNode();
|
|
316
|
-
|
|
317
245
|
if (popupEl && prevPopupSize) {
|
|
318
246
|
var _a = (0, _utils.getElementSize)(popupEl),
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
247
|
+
width = _a.width,
|
|
248
|
+
height = _a.height;
|
|
322
249
|
if (prevPopupSize.width !== width || prevPopupSize.height !== height) {
|
|
323
250
|
this.clearPopupTimer(popupEl);
|
|
324
251
|
popupEl.style.visibility = 'hidden';
|
|
325
252
|
this.popupTimer = setTimeout(function () {
|
|
326
253
|
_this.onEnter(popupEl);
|
|
327
|
-
|
|
328
254
|
popupEl.style.visibility = '';
|
|
329
255
|
});
|
|
330
256
|
}
|
|
331
257
|
}
|
|
332
258
|
};
|
|
333
|
-
|
|
334
259
|
Modal.prototype.componentWillUnmount = function () {
|
|
335
260
|
// remove绑定事件
|
|
336
261
|
this.clearOutsideHandler();
|
|
337
262
|
this.onExited();
|
|
338
263
|
clearTimeout(this.affixTimer);
|
|
339
264
|
};
|
|
340
|
-
|
|
341
265
|
Modal.prototype.clearOutsideHandler = function () {
|
|
342
266
|
this.clearPopupTimer();
|
|
343
|
-
|
|
344
267
|
if (this.clickOutsideHandler) {
|
|
345
268
|
this.clickOutsideHandler.remove();
|
|
346
269
|
this.clickOutsideHandler = null;
|
|
347
270
|
}
|
|
348
|
-
|
|
349
271
|
if (this.touchOutsideHandler) {
|
|
350
272
|
this.touchOutsideHandler.remove();
|
|
351
273
|
this.touchOutsideHandler = null;
|
|
352
274
|
}
|
|
353
275
|
};
|
|
354
|
-
|
|
355
276
|
Modal.prototype.getPopupDomNode = function () {
|
|
356
277
|
if (this.popupRef && this.popupRef.current) {
|
|
357
278
|
return this.popupRef.current;
|
|
358
279
|
}
|
|
359
|
-
|
|
360
280
|
return null;
|
|
361
281
|
};
|
|
362
|
-
|
|
363
282
|
Modal.prototype.getMaskDomNode = function () {
|
|
364
283
|
if (this.maskRef && this.maskRef.current) {
|
|
365
284
|
return this.maskRef.current;
|
|
366
285
|
}
|
|
367
|
-
|
|
368
286
|
return null;
|
|
369
287
|
};
|
|
370
|
-
|
|
371
288
|
Modal.prototype.renderPopup = function () {
|
|
372
289
|
var _a;
|
|
373
|
-
|
|
374
290
|
var _this = this;
|
|
375
|
-
|
|
376
291
|
var cls = this.prefixCls;
|
|
377
292
|
var _b = this.props,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
293
|
+
visible = _b.visible,
|
|
294
|
+
children = _b.children,
|
|
295
|
+
width = _b.width,
|
|
296
|
+
height = _b.height,
|
|
297
|
+
className = _b.className,
|
|
298
|
+
closable = _b.closable,
|
|
299
|
+
title = _b.title,
|
|
300
|
+
placement = _b.placement,
|
|
301
|
+
top = _b.top;
|
|
387
302
|
var maxHeight = "calc(100vh - .3rem - ".concat(placement === 'top' && top ? top : '0px', ")");
|
|
388
303
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
389
304
|
className: (0, _classnames.default)(cls, className, (_a = {}, _a["".concat(cls, "-center")] = placement === 'center', _a["".concat(this.prefixCls, "-hidden")] = !visible && !this.state.isUserOperated, _a))
|
|
@@ -412,12 +327,10 @@ function (_super) {
|
|
|
412
327
|
}), children);
|
|
413
328
|
}));
|
|
414
329
|
};
|
|
415
|
-
|
|
416
330
|
Modal.prototype.render = function () {
|
|
417
331
|
var _a;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
332
|
+
var visible = this.props.visible;
|
|
333
|
+
// 插入元素,不使用传送门, 和当前元素同级
|
|
421
334
|
if (this.props.isInsertNode) {
|
|
422
335
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_mask.default, {
|
|
423
336
|
visible: visible,
|
|
@@ -426,7 +339,6 @@ function (_super) {
|
|
|
426
339
|
ref: this.maskRef
|
|
427
340
|
}), this.renderPopup());
|
|
428
341
|
}
|
|
429
|
-
|
|
430
342
|
if (visible || this.popupRef.current) {
|
|
431
343
|
return /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_mask.default, {
|
|
432
344
|
visible: visible,
|
|
@@ -434,13 +346,11 @@ function (_super) {
|
|
|
434
346
|
ref: this.maskRef
|
|
435
347
|
}), this.renderPopup()));
|
|
436
348
|
}
|
|
437
|
-
|
|
438
349
|
return null;
|
|
439
350
|
};
|
|
440
|
-
|
|
441
351
|
Modal.Affix = _Affix.default;
|
|
442
|
-
Modal.cacheOpenedIds = [];
|
|
443
|
-
|
|
352
|
+
Modal.cacheOpenedIds = [];
|
|
353
|
+
// 默认值
|
|
444
354
|
Modal.defaultProps = {
|
|
445
355
|
placement: 'center',
|
|
446
356
|
width: '6.5rem',
|
|
@@ -453,6 +363,5 @@ function (_super) {
|
|
|
453
363
|
};
|
|
454
364
|
return Modal;
|
|
455
365
|
}(_react.default.Component);
|
|
456
|
-
|
|
457
366
|
var _default = Modal;
|
|
458
367
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:101;overflow:auto;outline:0}.ab-modal.ab-modal-center{text-align:center}.ab-modal.ab-modal-center
|
|
1
|
+
.ab-mask{position:fixed;top:0;left:0;z-index:101;width:100%;height:100%;background-color:rgba(0,0,0,.45);transition:opacity .4s cubic-bezier(.7,.3,.1,1)}.ab-mask-fade-appear,.ab-mask-fade-enter{opacity:0}.ab-mask-fade-appear-active,.ab-mask-fade-enter-active,.ab-mask-fade-enter-done,.ab-mask-fade-exit{opacity:1}.ab-mask-fade-exit-active{opacity:0}.ab-mask-fade-exit-done{display:none}.ab-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:101;overflow:auto;outline:0}.ab-modal.ab-modal-center{text-align:center}.ab-modal.ab-modal-center::before{display:inline-block;width:0;height:100%;vertical-align:middle;content:""}.ab-modal.ab-modal-center .ab-modal-content{top:0;text-align:left;display:inline-block;vertical-align:middle}.ab-modal-content{position:relative;background-color:#fff;max-width:calc(100vw - .3rem);margin-left:auto;margin-right:auto;overflow:auto;-webkit-overflow-scrolling:touch;transition:transform .3s,opacity .3s cubic-bezier(.7,.3,.1,1);z-index:101}.ab-modal-title{position:relative;width:100%}.ab-modal-title .ab-modal-times{top:50%;transform:translateY(-50%)}.ab-modal-times{position:absolute;top:.12rem;right:.12rem;font-size:.15rem;color:#b0b0b0;cursor:pointer}.ab-modal-times svg{display:block}.ab-modal-times:hover{color:#333}.ab-modal-hidden{display:none}@media only screen and (max-width:767px){.ab-modal-content{width:calc(100vw - .3rem)}}.ab-modal-fade-appear,.ab-modal-fade-enter{transform:translate3d(0,-30px,0);opacity:0}.ab-modal-fade-appear-active,.ab-modal-fade-enter-active,.ab-modal-fade-enter-done,.ab-modal-fade-exit{transform:translateZ(0);opacity:1}.ab-modal-fade-exit-active{transform:translate3d(0,-30px,0);opacity:0}.ab-modal-fade-exit-done{display:none}
|