@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/select/index.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _utils = require("@autobest-ui/utils");
|
|
15
|
-
|
|
16
11
|
var _trigger = _interopRequireDefault(require("../trigger"));
|
|
17
|
-
|
|
18
12
|
var __extends = void 0 && (void 0).__extends || function () {
|
|
19
13
|
var _extendStatics = function extendStatics(d, b) {
|
|
20
14
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -26,52 +20,39 @@ var __extends = void 0 && (void 0).__extends || function () {
|
|
|
26
20
|
if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
27
21
|
}
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
return _extendStatics(d, b);
|
|
31
24
|
};
|
|
32
|
-
|
|
33
25
|
return function (d, b) {
|
|
34
26
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
35
|
-
|
|
36
27
|
_extendStatics(d, b);
|
|
37
|
-
|
|
38
28
|
function __() {
|
|
39
29
|
this.constructor = d;
|
|
40
30
|
}
|
|
41
|
-
|
|
42
31
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
43
32
|
};
|
|
44
33
|
}();
|
|
45
|
-
|
|
46
34
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
47
35
|
__assign = Object.assign || function (t) {
|
|
48
36
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
49
37
|
s = arguments[i];
|
|
50
|
-
|
|
51
38
|
for (var p in s) {
|
|
52
39
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
53
40
|
}
|
|
54
41
|
}
|
|
55
|
-
|
|
56
42
|
return t;
|
|
57
43
|
};
|
|
58
|
-
|
|
59
44
|
return __assign.apply(this, arguments);
|
|
60
45
|
};
|
|
61
|
-
|
|
62
46
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
63
47
|
var t = {};
|
|
64
|
-
|
|
65
48
|
for (var p in s) {
|
|
66
49
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
67
50
|
}
|
|
68
|
-
|
|
69
51
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
52
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
71
53
|
}
|
|
72
54
|
return t;
|
|
73
55
|
};
|
|
74
|
-
|
|
75
56
|
var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
|
|
76
57
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
77
58
|
if (ar || !(i in from)) {
|
|
@@ -81,66 +62,49 @@ var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack
|
|
|
81
62
|
}
|
|
82
63
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
83
64
|
};
|
|
84
|
-
|
|
85
|
-
var Select =
|
|
86
|
-
/** @class */
|
|
87
|
-
function (_super) {
|
|
65
|
+
var Select = /** @class */function (_super) {
|
|
88
66
|
__extends(Select, _super);
|
|
89
|
-
|
|
90
67
|
function Select(props) {
|
|
91
68
|
var _this = _super.call(this, props) || this;
|
|
92
|
-
|
|
93
69
|
_this.prefixCls = 'ab-select';
|
|
94
70
|
_this.keydownHandler = null;
|
|
95
71
|
_this.popupContentRef = /*#__PURE__*/_react.default.createRef();
|
|
96
72
|
/**
|
|
97
73
|
* 当支持过滤时,绑定过滤事件
|
|
98
74
|
*/
|
|
99
|
-
|
|
100
75
|
_this.addKeydownListener = function () {
|
|
101
76
|
_this.keydownHandler = (0, _utils.addEventListener)(document, 'keydown', _this.keydownCallback);
|
|
102
77
|
};
|
|
103
|
-
|
|
104
78
|
_this.removeKeydownListener = function () {
|
|
105
79
|
if (_this.keydownHandler) {
|
|
106
80
|
_this.keydownHandler.remove();
|
|
107
|
-
|
|
108
81
|
_this.keydownHandler = null;
|
|
109
82
|
}
|
|
110
83
|
};
|
|
111
|
-
|
|
112
84
|
_this.keydownCallback = function (event) {
|
|
113
85
|
var code = event.keyCode || event.which;
|
|
114
|
-
|
|
115
86
|
if (code >= 65 && code <= 90 || code >= 48 && code <= 57 || code >= 96 && code <= 105) {
|
|
116
87
|
var findItem_1 = _this.findMatchItem(event.key.toLowerCase());
|
|
117
|
-
|
|
118
88
|
if (!findItem_1) {
|
|
119
89
|
return;
|
|
120
90
|
}
|
|
121
|
-
|
|
122
91
|
var _a = _this.props,
|
|
123
|
-
|
|
124
|
-
|
|
92
|
+
onFilterChange_1 = _a.onFilterChange,
|
|
93
|
+
name_1 = _a.name;
|
|
125
94
|
var filterItem = _this.state.filterItem;
|
|
126
|
-
|
|
127
95
|
if (!filterItem || findItem_1.value !== filterItem.value) {
|
|
128
96
|
_this.setState({
|
|
129
97
|
filterItem: findItem_1
|
|
130
98
|
}, function () {
|
|
131
99
|
if (onFilterChange_1) {
|
|
132
100
|
onFilterChange_1(findItem_1, name_1);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
101
|
+
}
|
|
102
|
+
// 通过搜索选择的,将滚动到该元素位置
|
|
136
103
|
var element = _this.popupContentRef.current;
|
|
137
|
-
|
|
138
104
|
if (element && element.parentNode) {
|
|
139
105
|
var elementParentNode = element.parentNode;
|
|
140
|
-
|
|
141
106
|
if (elementParentNode) {
|
|
142
107
|
var activeElement = elementParentNode.querySelector(".".concat(_this.prefixCls, "-active"));
|
|
143
|
-
|
|
144
108
|
if (activeElement) {
|
|
145
109
|
// scrollIntoView有问题,设置block为start会带动全局的滚动条
|
|
146
110
|
elementParentNode.scrollTop = activeElement.offsetTop;
|
|
@@ -152,14 +116,12 @@ function (_super) {
|
|
|
152
116
|
}
|
|
153
117
|
}
|
|
154
118
|
};
|
|
155
|
-
|
|
156
119
|
_this.findMatchItem = function (inputVal) {
|
|
157
120
|
var list = _this.state.list;
|
|
158
|
-
|
|
159
121
|
for (var i = 0; i < list.length; i++) {
|
|
160
122
|
for (var j = 0; j < list[i].length; j++) {
|
|
161
|
-
var item = list[i][j];
|
|
162
|
-
|
|
123
|
+
var item = list[i][j];
|
|
124
|
+
// 只对string/number类型进行筛选,
|
|
163
125
|
if (!item.unselect && (typeof item.name === 'string' || typeof item.name === 'number')) {
|
|
164
126
|
if (item.name.toString().toLowerCase().indexOf(inputVal) === 0) {
|
|
165
127
|
return item;
|
|
@@ -167,105 +129,83 @@ function (_super) {
|
|
|
167
129
|
}
|
|
168
130
|
}
|
|
169
131
|
}
|
|
170
|
-
|
|
171
132
|
return null;
|
|
172
133
|
};
|
|
173
134
|
/**
|
|
174
135
|
* 设置显示与隐藏
|
|
175
136
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
178
137
|
_this.triggerSelect = function (status) {
|
|
179
138
|
if (status === void 0) {
|
|
180
139
|
status = false;
|
|
181
140
|
}
|
|
182
|
-
|
|
183
141
|
if (_this.state.visible === status) {
|
|
184
142
|
return;
|
|
185
143
|
}
|
|
186
|
-
|
|
187
144
|
_this.removeKeydownListener();
|
|
188
|
-
|
|
189
145
|
if (_this.props.isFilterOption && status) {
|
|
190
146
|
_this.addKeydownListener();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
147
|
+
}
|
|
148
|
+
// 关闭下拉框,并且已经过滤到数据
|
|
194
149
|
var filterItem = _this.state.filterItem;
|
|
195
|
-
|
|
196
150
|
if (filterItem && !status) {
|
|
197
151
|
// 清空filter数据,并触发onChange
|
|
198
152
|
_this.setState({
|
|
199
153
|
filterItem: null
|
|
200
154
|
});
|
|
201
|
-
|
|
202
155
|
if (filterItem.value !== _this.props.value) {
|
|
203
156
|
_this.props.onChange(filterItem, _this.props.name);
|
|
204
157
|
}
|
|
205
158
|
}
|
|
206
|
-
|
|
207
159
|
_this.setState({
|
|
208
160
|
visible: status
|
|
209
161
|
});
|
|
210
162
|
};
|
|
211
|
-
|
|
212
163
|
_this.onTriggerSelect = function () {
|
|
213
164
|
if (_this.props.disabled) {
|
|
214
165
|
return;
|
|
215
166
|
}
|
|
216
|
-
|
|
217
167
|
_this.triggerSelect(!_this.state.visible);
|
|
218
168
|
};
|
|
219
|
-
|
|
220
169
|
_this.state = {
|
|
221
170
|
visible: false,
|
|
222
171
|
list: [[]]
|
|
223
172
|
};
|
|
224
173
|
return _this;
|
|
225
174
|
}
|
|
226
|
-
|
|
227
175
|
Select.getDerivedStateFromProps = function (nextProps) {
|
|
228
176
|
var columnCount = nextProps.columnCount,
|
|
229
|
-
|
|
230
|
-
|
|
177
|
+
options = nextProps.options;
|
|
231
178
|
if (columnCount <= 1) {
|
|
232
179
|
return {
|
|
233
180
|
list: [__spreadArray([], options, true)]
|
|
234
181
|
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
182
|
+
}
|
|
183
|
+
// 对columnCount值,进行分列,返回一个新的多维数组
|
|
238
184
|
var list = [];
|
|
239
|
-
var maxRow = Math.ceil(options.length / columnCount);
|
|
240
|
-
|
|
185
|
+
var maxRow = Math.ceil(options.length / columnCount);
|
|
186
|
+
// 分列
|
|
241
187
|
for (var i = 1; i <= columnCount; i++) {
|
|
242
188
|
var startIndex = maxRow * (i - 1);
|
|
243
189
|
var endIndex = maxRow * i;
|
|
244
190
|
var columnList = options.slice(startIndex, endIndex);
|
|
245
191
|
list.push(__spreadArray([], columnList, true));
|
|
246
192
|
}
|
|
247
|
-
|
|
248
193
|
return {
|
|
249
194
|
list: list
|
|
250
195
|
};
|
|
251
196
|
};
|
|
252
|
-
|
|
253
197
|
Select.prototype.componentWillUnmount = function () {
|
|
254
198
|
this.removeKeydownListener();
|
|
255
199
|
};
|
|
256
|
-
|
|
257
200
|
Select.prototype.onSelecting = function (ev, item) {
|
|
258
201
|
var _this = this;
|
|
259
|
-
|
|
260
202
|
if (ev) {
|
|
261
203
|
ev.stopPropagation();
|
|
262
204
|
}
|
|
263
|
-
|
|
264
205
|
var _a = this.props,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
206
|
+
onChange = _a.onChange,
|
|
207
|
+
value = _a.value,
|
|
208
|
+
name = _a.name;
|
|
269
209
|
if (item.value !== value) {
|
|
270
210
|
onChange(item, name);
|
|
271
211
|
this.setState({
|
|
@@ -276,33 +216,24 @@ function (_super) {
|
|
|
276
216
|
});
|
|
277
217
|
return;
|
|
278
218
|
}
|
|
279
|
-
|
|
280
219
|
this.triggerSelect(false);
|
|
281
220
|
};
|
|
282
|
-
|
|
283
221
|
Select.prototype.renderTitle = function () {
|
|
284
222
|
var title = this.props.title;
|
|
285
|
-
|
|
286
223
|
if (!title) {
|
|
287
224
|
return null;
|
|
288
225
|
}
|
|
289
|
-
|
|
290
226
|
var child = _react.default.Children.only(title);
|
|
291
|
-
|
|
292
227
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
293
228
|
className: (0, _classnames.default)("".concat(this.prefixCls, "-title"), child.props.className)
|
|
294
229
|
});
|
|
295
230
|
};
|
|
296
|
-
|
|
297
231
|
Select.prototype.renderBottom = function () {
|
|
298
232
|
var bottom = this.props.bottom;
|
|
299
|
-
|
|
300
233
|
if (!bottom) {
|
|
301
234
|
return null;
|
|
302
235
|
}
|
|
303
|
-
|
|
304
236
|
var child = _react.default.Children.only(bottom);
|
|
305
|
-
|
|
306
237
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
307
238
|
className: (0, _classnames.default)("".concat(this.prefixCls, "-bottom"), child.props.className)
|
|
308
239
|
});
|
|
@@ -310,11 +241,8 @@ function (_super) {
|
|
|
310
241
|
/**
|
|
311
242
|
* 下拉框内容
|
|
312
243
|
*/
|
|
313
|
-
|
|
314
|
-
|
|
315
244
|
Select.prototype.getSelectPopup = function () {
|
|
316
245
|
var _this = this;
|
|
317
|
-
|
|
318
246
|
var cls = this.prefixCls;
|
|
319
247
|
var filterItem = this.state.filterItem;
|
|
320
248
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, this.renderTitle(), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -326,14 +254,12 @@ function (_super) {
|
|
|
326
254
|
key: index
|
|
327
255
|
}, col.map(function (item) {
|
|
328
256
|
var _a;
|
|
329
|
-
|
|
330
257
|
if (item.unselect) {
|
|
331
258
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
332
259
|
key: "".concat(item.value, "1"),
|
|
333
260
|
className: (0, _classnames.default)(item.className, "".concat(cls, "-unselect"))
|
|
334
261
|
}, item.name);
|
|
335
262
|
}
|
|
336
|
-
|
|
337
263
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
338
264
|
key: item.value,
|
|
339
265
|
className: (0, _classnames.default)(item.className, (_a = {}, _a["".concat(cls, "-active")] = filterItem ? filterItem.value === item.value : item.value === _this.props.value, _a)),
|
|
@@ -348,41 +274,32 @@ function (_super) {
|
|
|
348
274
|
* 根据value获取当前的name,并显示出来
|
|
349
275
|
* @returns {*}
|
|
350
276
|
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
277
|
Select.prototype.getCurrentName = function () {
|
|
354
278
|
var _a = this.props,
|
|
355
|
-
|
|
356
|
-
|
|
279
|
+
options = _a.options,
|
|
280
|
+
value = _a.value;
|
|
357
281
|
var filterItem = this.state.filterItem;
|
|
358
|
-
|
|
359
282
|
if (!(0, _utils.isBlank)(value) || filterItem) {
|
|
360
283
|
var currentItem = options.find(function (item) {
|
|
361
284
|
return filterItem ? filterItem.value === item.value : item.value === value;
|
|
362
285
|
});
|
|
363
|
-
|
|
364
286
|
if (currentItem) {
|
|
365
287
|
return currentItem.actualName || currentItem.name;
|
|
366
288
|
}
|
|
367
289
|
}
|
|
368
|
-
|
|
369
290
|
return null;
|
|
370
291
|
};
|
|
371
|
-
|
|
372
292
|
Select.prototype.render = function () {
|
|
373
293
|
var _a, _b;
|
|
374
|
-
|
|
375
294
|
var visible = this.state.visible;
|
|
376
|
-
|
|
377
295
|
var _c = this.props,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
296
|
+
className = _c.className,
|
|
297
|
+
placeholder = _c.placeholder,
|
|
298
|
+
disabled = _c.disabled,
|
|
299
|
+
hiddenIcon = _c.hiddenIcon,
|
|
300
|
+
icon = _c.icon,
|
|
301
|
+
dropClassName = _c.dropClassName,
|
|
302
|
+
extraProps = __rest(_c, ["className", "placeholder", "disabled", "hiddenIcon", "icon", "dropClassName"]);
|
|
386
303
|
var cls = this.prefixCls;
|
|
387
304
|
var currentName = this.getCurrentName();
|
|
388
305
|
return /*#__PURE__*/_react.default.createElement(_trigger.default, __assign({}, extraProps, {
|
|
@@ -403,9 +320,8 @@ function (_super) {
|
|
|
403
320
|
}, currentName || placeholder), hiddenIcon ? null : /*#__PURE__*/_react.default.createElement("span", {
|
|
404
321
|
className: "".concat(cls, "-icon")
|
|
405
322
|
}, typeof icon === 'function' ? icon() : icon)));
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
|
|
323
|
+
};
|
|
324
|
+
// 默认值
|
|
409
325
|
Select.defaultProps = {
|
|
410
326
|
title: null,
|
|
411
327
|
icon: /*#__PURE__*/_react.default.createElement("svg", {
|
|
@@ -431,6 +347,5 @@ function (_super) {
|
|
|
431
347
|
};
|
|
432
348
|
return Select;
|
|
433
349
|
}(_react.default.Component);
|
|
434
|
-
|
|
435
350
|
var _default = Select;
|
|
436
351
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ab-select-wrap{min-width:177px;background-color:#fff;background-clip:padding-box;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15)}.ab-select-bottom,.ab-select-content,.ab-select-title{display:flex}.ab-select-title{padding:.09rem 0;background-color:transparent;cursor:context-menu;border-bottom:1px solid #d7d7d7;font-weight:700;color:#606060;font-size:.12rem;margin:0 .1rem}.ab-select-col{font-size:.12rem;padding-right:.07rem;flex:auto}.ab-select-col:last-child{padding-right:0}.ab-select-col>li{padding:.08rem .11rem;cursor:pointer}.ab-select-col>li:hover{background-color:#eee}.ab-select-col>li.ab-select-active{background-color:#e6f7ff}.ab-select-col>li.ab-select-unselect{background-color:transparent;cursor:context-menu}.ab-select-input-group{position:relative;overflow:hidden}.ab-select-input-control{
|
|
1
|
+
.ab-trigger-wrap{position:absolute;top:0;left:0;z-index:101}.ab-trigger-wrap.ab-trigger-hidden{display:none}.ab-trigger-mask{position:fixed;top:0;left:0;bottom:0;right:0;z-index:101;background-color:transparent;display:none}.ab-trigger-mask.ab-trigger-mask-show{display:block}.ab-trigger-fade-appear,.ab-trigger-fade-enter,.ab-trigger-fade-hr-appear,.ab-trigger-fade-hr-enter{opacity:0}.ab-trigger-fade-appear,.ab-trigger-fade-enter{transform:scale(.7)}.ab-trigger-fade-hr-appear,.ab-trigger-fade-hr-enter{opacity:0;transform:scaleY(.7)}.ab-trigger-fade-appear-active,.ab-trigger-fade-enter-active,.ab-trigger-fade-hr-appear-active,.ab-trigger-fade-hr-enter-active{opacity:1;transition:opacity .2s,transform .2s}.ab-trigger-fade-appear-active,.ab-trigger-fade-enter-active{transform:scale(1)}.ab-trigger-fade-hr-appear-active,.ab-trigger-fade-hr-enter-active{transform:scaleY(1)}.ab-trigger-fade-exit,.ab-trigger-fade-hr-exit{opacity:1}.ab-trigger-fade-exit-active,.ab-trigger-fade-hr-exit-active{opacity:0;transition:opacity .2s,transform .2s}.ab-trigger-fade-exit-active{transform:scale(.7)}.ab-trigger-fade-hr-exit-active{transform:scaleY(.7)}.ab-trigger-fade-exit-done,.ab-trigger-fade-hr-exit-done{display:none}.ab-select-wrap{min-width:177px;background-color:#fff;background-clip:padding-box;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15)}.ab-select-bottom,.ab-select-content,.ab-select-title{display:flex}.ab-select-title{padding:.09rem 0;background-color:transparent;cursor:context-menu;border-bottom:1px solid #d7d7d7;font-weight:700;color:#606060;font-size:.12rem;margin:0 .1rem}.ab-select-col{font-size:.12rem;padding-right:.07rem;flex:auto}.ab-select-col:last-child{padding-right:0}.ab-select-col>li{padding:.08rem .11rem;cursor:pointer}.ab-select-col>li:hover{background-color:#eee}.ab-select-col>li.ab-select-active{background-color:#e6f7ff}.ab-select-col>li.ab-select-unselect{background-color:transparent;cursor:context-menu}.ab-select-input-group{position:relative;overflow:hidden}.ab-select-input-control{appearance:none;outline:0;user-select:none;width:100%;border:1px solid #ccc;border-radius:2px;resize:none;transition:.2s;background-color:#fff;text-overflow:ellipsis;padding:.08rem .28rem .07rem .07rem;font-size:.14rem;white-space:nowrap;overflow:hidden;max-width:100%;cursor:pointer}.ab-select-input-control.ab-select-focused{box-shadow:0 0 4px rgba(52,143,238,.8);border-color:rgba(52,143,238,.8)}.ab-select-input-control.ab-select-empty{color:#888}.ab-select-input-control.error{background-color:#fffacd}.ab-select-icon{position:absolute;right:.21rem;top:50%;color:#ccc;font-size:0;transform:translate(100%,-50%);transition:transform .2s}.ab-select-icon svg{font-size:.12rem}.ab-select-active .ab-select-icon{transform:translate(100%,-50%) rotate(180deg)}@media only screen and (max-width:767px){.ab-select-content{display:block}.ab-select-input-control{padding:.1rem .05rem;font-size:.14rem}.ab-select-col{padding-right:0}}
|