@douyinfe/semi-foundation 2.2.1 → 2.3.1
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/breadcrumb/foundation.ts +10 -1
- package/checkbox/checkboxFoundation.ts +9 -0
- package/datePicker/foundation.ts +2 -4
- package/datePicker/monthsGridFoundation.ts +10 -3
- package/form/foundation.ts +20 -8
- package/form/utils.ts +2 -0
- package/input/foundation.ts +21 -2
- package/input/textareaFoundation.ts +11 -1
- package/inputNumber/foundation.ts +3 -2
- package/lib/cjs/breadcrumb/foundation.d.ts +4 -0
- package/lib/cjs/breadcrumb/foundation.js +12 -0
- package/lib/cjs/checkbox/checkboxFoundation.d.ts +3 -0
- package/lib/cjs/checkbox/checkboxFoundation.js +8 -0
- package/lib/cjs/datePicker/foundation.js +2 -4
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGridFoundation.js +16 -3
- package/lib/cjs/form/foundation.d.ts +13 -0
- package/lib/cjs/form/foundation.js +32 -8
- package/lib/cjs/form/utils.d.ts +1 -0
- package/lib/cjs/form/utils.js +5 -3
- package/lib/cjs/input/foundation.d.ts +8 -0
- package/lib/cjs/input/foundation.js +24 -2
- package/lib/cjs/input/textareaFoundation.d.ts +5 -1
- package/lib/cjs/input/textareaFoundation.js +12 -0
- package/lib/cjs/inputNumber/foundation.d.ts +2 -2
- package/lib/cjs/inputNumber/foundation.js +3 -1
- package/lib/cjs/modal/modalContentFoundation.d.ts +7 -0
- package/lib/cjs/modal/modalContentFoundation.js +14 -0
- package/lib/cjs/navigation/itemFoundation.d.ts +5 -0
- package/lib/cjs/navigation/itemFoundation.js +12 -0
- package/lib/cjs/navigation/subNavFoundation.d.ts +6 -0
- package/lib/cjs/navigation/subNavFoundation.js +14 -0
- package/lib/cjs/notification/notificationListFoundation.js +1 -1
- package/lib/cjs/radio/radio.css +7 -1
- package/lib/cjs/radio/radio.scss +8 -1
- package/lib/cjs/select/foundation.d.ts +2 -0
- package/lib/cjs/select/foundation.js +40 -6
- package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +1 -0
- package/lib/cjs/slider/foundation.d.ts +6 -1
- package/lib/cjs/slider/foundation.js +6 -12
- package/lib/cjs/slider/slider.css +1 -0
- package/lib/cjs/slider/slider.scss +1 -0
- package/lib/cjs/table/utils.d.ts +7 -0
- package/lib/cjs/table/utils.js +26 -0
- package/lib/cjs/tagInput/foundation.d.ts +4 -0
- package/lib/cjs/tagInput/foundation.js +12 -0
- package/lib/cjs/tooltip/foundation.js +7 -6
- package/lib/cjs/transfer/transfer.css +0 -2
- package/lib/cjs/transfer/transfer.scss +0 -2
- package/lib/cjs/tree/foundation.d.ts +1 -0
- package/lib/cjs/tree/foundation.js +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +9 -1
- package/lib/cjs/treeSelect/foundation.js +22 -0
- package/lib/cjs/utils/isEnterPress.d.ts +4 -0
- package/lib/cjs/utils/isEnterPress.js +22 -0
- package/lib/cjs/utils/keyCode.d.ts +2 -0
- package/lib/cjs/utils/keyCode.js +5 -1
- package/lib/cjs/utils/uuid.d.ts +16 -1
- package/lib/cjs/utils/uuid.js +32 -0
- package/lib/es/breadcrumb/foundation.d.ts +4 -0
- package/lib/es/breadcrumb/foundation.js +11 -0
- package/lib/es/checkbox/checkboxFoundation.d.ts +3 -0
- package/lib/es/checkbox/checkboxFoundation.js +7 -0
- package/lib/es/datePicker/foundation.js +2 -4
- package/lib/es/datePicker/monthsGridFoundation.d.ts +1 -0
- package/lib/es/datePicker/monthsGridFoundation.js +15 -3
- package/lib/es/form/foundation.d.ts +13 -0
- package/lib/es/form/foundation.js +31 -8
- package/lib/es/form/utils.d.ts +1 -0
- package/lib/es/form/utils.js +5 -3
- package/lib/es/input/foundation.d.ts +8 -0
- package/lib/es/input/foundation.js +23 -2
- package/lib/es/input/textareaFoundation.d.ts +5 -1
- package/lib/es/input/textareaFoundation.js +11 -0
- package/lib/es/inputNumber/foundation.d.ts +2 -2
- package/lib/es/inputNumber/foundation.js +3 -1
- package/lib/es/modal/modalContentFoundation.d.ts +7 -0
- package/lib/es/modal/modalContentFoundation.js +14 -0
- package/lib/es/navigation/itemFoundation.d.ts +5 -0
- package/lib/es/navigation/itemFoundation.js +11 -0
- package/lib/es/navigation/subNavFoundation.d.ts +6 -0
- package/lib/es/navigation/subNavFoundation.js +13 -0
- package/lib/es/notification/notificationListFoundation.js +1 -1
- package/lib/es/radio/radio.css +7 -1
- package/lib/es/radio/radio.scss +8 -1
- package/lib/es/select/foundation.d.ts +2 -0
- package/lib/es/select/foundation.js +31 -6
- package/lib/es/sideSheet/sideSheetFoundation.d.ts +1 -0
- package/lib/es/slider/foundation.d.ts +6 -1
- package/lib/es/slider/foundation.js +6 -12
- package/lib/es/slider/slider.css +1 -0
- package/lib/es/slider/slider.scss +1 -0
- package/lib/es/table/utils.d.ts +7 -0
- package/lib/es/table/utils.js +24 -0
- package/lib/es/tagInput/foundation.d.ts +4 -0
- package/lib/es/tagInput/foundation.js +11 -0
- package/lib/es/tooltip/foundation.js +7 -6
- package/lib/es/transfer/transfer.css +0 -2
- package/lib/es/transfer/transfer.scss +0 -2
- package/lib/es/tree/foundation.d.ts +1 -0
- package/lib/es/tree/foundation.js +1 -1
- package/lib/es/treeSelect/foundation.d.ts +9 -1
- package/lib/es/treeSelect/foundation.js +22 -1
- package/lib/es/utils/isEnterPress.d.ts +4 -0
- package/lib/es/utils/isEnterPress.js +8 -0
- package/lib/es/utils/keyCode.d.ts +2 -0
- package/lib/es/utils/keyCode.js +2 -0
- package/lib/es/utils/uuid.d.ts +16 -1
- package/lib/es/utils/uuid.js +32 -1
- package/modal/modalContentFoundation.ts +18 -0
- package/navigation/itemFoundation.ts +11 -0
- package/navigation/subNavFoundation.ts +12 -0
- package/notification/notificationListFoundation.ts +4 -8
- package/package.json +3 -3
- package/radio/radio.scss +8 -1
- package/select/foundation.ts +26 -7
- package/sideSheet/sideSheetFoundation.ts +3 -5
- package/slider/foundation.ts +10 -13
- package/slider/slider.scss +1 -0
- package/table/utils.ts +16 -0
- package/tagInput/foundation.ts +10 -0
- package/tooltip/foundation.ts +5 -5
- package/transfer/transfer.scss +0 -2
- package/tree/foundation.ts +2 -1
- package/treeSelect/foundation.ts +20 -0
- package/utils/isEnterPress.ts +8 -0
- package/utils/keyCode.ts +3 -0
- package/utils/uuid.ts +29 -1
|
@@ -28,6 +28,8 @@ var _calculateNodeHeight = _interopRequireDefault(require("./util/calculateNodeH
|
|
|
28
28
|
|
|
29
29
|
var _getSizingData = _interopRequireDefault(require("./util/getSizingData"));
|
|
30
30
|
|
|
31
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
32
|
+
|
|
31
33
|
class TextAreaFoundation extends _foundation.default {
|
|
32
34
|
constructor(adapter) {
|
|
33
35
|
super((0, _assign.default)((0, _assign.default)({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
|
|
@@ -293,6 +295,16 @@ class TextAreaFoundation extends _foundation.default {
|
|
|
293
295
|
|
|
294
296
|
this.stopPropagation(e);
|
|
295
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* A11y: simulate clear button click
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
handleClearEnterPress(e) {
|
|
304
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
305
|
+
this.handleClear(e);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
296
308
|
|
|
297
309
|
}
|
|
298
310
|
|
|
@@ -63,11 +63,11 @@ declare class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
63
63
|
_adjustPrec(num: string | number): string;
|
|
64
64
|
/**
|
|
65
65
|
* format number to string
|
|
66
|
-
* @param {number} value
|
|
66
|
+
* @param {string|number} value
|
|
67
67
|
* @param {boolean} needAdjustPrec
|
|
68
68
|
* @returns {string}
|
|
69
69
|
*/
|
|
70
|
-
doFormat(value?: number, needAdjustPrec?: boolean): string;
|
|
70
|
+
doFormat(value?: string | number, needAdjustPrec?: boolean): string;
|
|
71
71
|
/**
|
|
72
72
|
*
|
|
73
73
|
* @param {number} current
|
|
@@ -140,6 +140,8 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
140
140
|
|
|
141
141
|
this._adapter.setFocusing(true, null);
|
|
142
142
|
|
|
143
|
+
this._adapter.setClickUpOrDown(false);
|
|
144
|
+
|
|
143
145
|
this._adapter.notifyFocus(e);
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
@@ -476,7 +478,7 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
476
478
|
}
|
|
477
479
|
/**
|
|
478
480
|
* format number to string
|
|
479
|
-
* @param {number} value
|
|
481
|
+
* @param {string|number} value
|
|
480
482
|
* @param {boolean} needAdjustPrec
|
|
481
483
|
* @returns {string}
|
|
482
484
|
*/
|
|
@@ -10,6 +10,7 @@ export interface ModalContentProps extends ModalProps {
|
|
|
10
10
|
}
|
|
11
11
|
export interface ModalContentState {
|
|
12
12
|
dialogMouseDown: boolean;
|
|
13
|
+
prevFocusElement: HTMLElement;
|
|
13
14
|
}
|
|
14
15
|
export interface ModalContentAdapter extends DefaultAdapter<ModalContentProps, ModalContentState> {
|
|
15
16
|
notifyClose: (e: any) => void;
|
|
@@ -18,6 +19,9 @@ export interface ModalContentAdapter extends DefaultAdapter<ModalContentProps, M
|
|
|
18
19
|
addKeyDownEventListener: () => void;
|
|
19
20
|
removeKeyDownEventListener: () => void;
|
|
20
21
|
getMouseState: () => boolean;
|
|
22
|
+
modalDialogFocus: () => void;
|
|
23
|
+
modalDialogBlur: () => void;
|
|
24
|
+
prevFocusElementReFocus: () => void;
|
|
21
25
|
}
|
|
22
26
|
export default class ModalContentFoundation extends BaseFoundation<ModalContentAdapter> {
|
|
23
27
|
constructor(adapter: ModalContentAdapter);
|
|
@@ -30,4 +34,7 @@ export default class ModalContentFoundation extends BaseFoundation<ModalContentA
|
|
|
30
34
|
getMouseState(): void;
|
|
31
35
|
handleMaskClick(e: any): void;
|
|
32
36
|
close(e: any): void;
|
|
37
|
+
modalDialogFocus(): void;
|
|
38
|
+
modalDialogBlur(): void;
|
|
39
|
+
prevFocusElementReFocus(): void;
|
|
33
40
|
}
|
|
@@ -23,6 +23,8 @@ class ModalContentFoundation extends _foundation.default {
|
|
|
23
23
|
|
|
24
24
|
destroy() {
|
|
25
25
|
this.handleKeyDownEventListenerUnmount();
|
|
26
|
+
this.modalDialogBlur();
|
|
27
|
+
this.prevFocusElementReFocus();
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
handleDialogMouseDown() {
|
|
@@ -71,6 +73,18 @@ class ModalContentFoundation extends _foundation.default {
|
|
|
71
73
|
this._adapter.notifyClose(e);
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
modalDialogFocus() {
|
|
77
|
+
this._adapter.modalDialogFocus();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
modalDialogBlur() {
|
|
81
|
+
this._adapter.modalDialogBlur();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
prevFocusElementReFocus() {
|
|
85
|
+
this._adapter.prevFocusElementReFocus();
|
|
86
|
+
}
|
|
87
|
+
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
exports.default = ModalContentFoundation;
|
|
@@ -33,6 +33,7 @@ export interface ItemAdapter<P = Record<string, any>, S = Record<string, any>> e
|
|
|
33
33
|
notifyMouseLeave(e: any): void;
|
|
34
34
|
getIsCollapsed(): boolean;
|
|
35
35
|
getSelected(): boolean;
|
|
36
|
+
getIsOpen(): boolean;
|
|
36
37
|
}
|
|
37
38
|
export default class ItemFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ItemAdapter<P, S>, P, S> {
|
|
38
39
|
_timer: number;
|
|
@@ -42,4 +43,8 @@ export default class ItemFoundation<P = Record<string, any>, S = Record<string,
|
|
|
42
43
|
destroy(): void;
|
|
43
44
|
isValidKey(itemKey: string): boolean;
|
|
44
45
|
handleClick(e: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* A11y: simulate item click
|
|
48
|
+
*/
|
|
49
|
+
handleKeyPress(e: any): void;
|
|
45
50
|
}
|
|
@@ -14,6 +14,8 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
16
16
|
|
|
17
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
18
|
+
|
|
17
19
|
/* argus-disable unPkgSensitiveInfo */
|
|
18
20
|
class ItemFoundation extends _foundation.default {
|
|
19
21
|
constructor(adapter) {
|
|
@@ -78,6 +80,16 @@ class ItemFoundation extends _foundation.default {
|
|
|
78
80
|
domEvent: e
|
|
79
81
|
});
|
|
80
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* A11y: simulate item click
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
handleKeyPress(e) {
|
|
89
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
90
|
+
this.handleClick(e);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
81
93
|
|
|
82
94
|
}
|
|
83
95
|
|
|
@@ -36,4 +36,10 @@ export default class SubNavFoundation<P = Record<string, any>, S = Record<string
|
|
|
36
36
|
* @param {HTMLElement} titleRef
|
|
37
37
|
*/
|
|
38
38
|
handleClick(e: any, titleRef: any): void;
|
|
39
|
+
/**
|
|
40
|
+
* A11y: simulate sub nav click
|
|
41
|
+
* @param e
|
|
42
|
+
* @param titleRef
|
|
43
|
+
*/
|
|
44
|
+
handleKeyPress(e: any, titleRef: any): void;
|
|
39
45
|
}
|
|
@@ -20,6 +20,8 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
20
20
|
|
|
21
21
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
22
22
|
|
|
23
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
24
|
+
|
|
23
25
|
const addKeys = function addKeys() {
|
|
24
26
|
let originKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
25
27
|
const keySet = new _set.default(originKeys);
|
|
@@ -141,6 +143,18 @@ class SubNavFoundation extends _foundation.default {
|
|
|
141
143
|
|
|
142
144
|
this._adapter.notifyGlobalOnClick(cbVal);
|
|
143
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* A11y: simulate sub nav click
|
|
148
|
+
* @param e
|
|
149
|
+
* @param titleRef
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
handleKeyPress(e, titleRef) {
|
|
154
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
155
|
+
this.handleClick(e, titleRef);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
144
158
|
|
|
145
159
|
}
|
|
146
160
|
|
package/lib/cjs/radio/radio.css
CHANGED
|
@@ -236,7 +236,13 @@
|
|
|
236
236
|
}
|
|
237
237
|
.semi-radio .semi-radio-inner-buttonRadio,
|
|
238
238
|
.semi-radio .semi-radio-inner-pureCardRadio {
|
|
239
|
-
|
|
239
|
+
position: absolute;
|
|
240
|
+
top: 0;
|
|
241
|
+
left: 0;
|
|
242
|
+
width: 100%;
|
|
243
|
+
height: 100%;
|
|
244
|
+
z-index: -1;
|
|
245
|
+
opacity: 0;
|
|
240
246
|
}
|
|
241
247
|
.semi-radio-disabled, .semi-radio-disabled:hover {
|
|
242
248
|
cursor: not-allowed;
|
package/lib/cjs/radio/radio.scss
CHANGED
|
@@ -317,9 +317,16 @@ $inner-width: $width-icon-medium;
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
+
// A11y: arrow keyboard control
|
|
320
321
|
.#{$module}-inner-buttonRadio,
|
|
321
322
|
.#{$module}-inner-pureCardRadio {
|
|
322
|
-
|
|
323
|
+
position: absolute;
|
|
324
|
+
top: 0;
|
|
325
|
+
left: 0;
|
|
326
|
+
width: 100%;
|
|
327
|
+
height: 100%;
|
|
328
|
+
z-index: -1;
|
|
329
|
+
opacity: 0;
|
|
323
330
|
}
|
|
324
331
|
|
|
325
332
|
&-disabled {
|
|
@@ -101,6 +101,8 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
101
101
|
handleMouseEnter(e: MouseEvent): void;
|
|
102
102
|
handleMouseLeave(e: MouseEvent): void;
|
|
103
103
|
handleClearClick(e: MouseEvent): void;
|
|
104
|
+
handleKeyPress(e: KeyboardEvent): void;
|
|
105
|
+
handleClearBtnEnterPress(e: KeyboardEvent): void;
|
|
104
106
|
handleOptionMouseEnter(optionIndex: number): void;
|
|
105
107
|
handleListScroll(e: any): void;
|
|
106
108
|
handleTriggerBlur(e: FocusEvent): void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
4
|
+
|
|
3
5
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
6
|
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
+
|
|
5
9
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
10
|
|
|
7
11
|
_Object$defineProperty(exports, "__esModule", {
|
|
@@ -46,12 +50,18 @@ var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
|
46
50
|
|
|
47
51
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
48
52
|
|
|
49
|
-
var _keyCode =
|
|
53
|
+
var _keyCode = _interopRequireWildcard(require("../utils/keyCode"));
|
|
50
54
|
|
|
51
55
|
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
52
56
|
|
|
53
57
|
var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
|
|
54
58
|
|
|
59
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
60
|
+
|
|
61
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
62
|
+
|
|
63
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
64
|
+
|
|
55
65
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
56
66
|
var t = {};
|
|
57
67
|
|
|
@@ -536,6 +546,10 @@ class SelectFoundation extends _foundation.default {
|
|
|
536
546
|
|
|
537
547
|
const selections = this._adapter.getSelections();
|
|
538
548
|
|
|
549
|
+
const {
|
|
550
|
+
autoClearSearchValue
|
|
551
|
+
} = this.getProps();
|
|
552
|
+
|
|
539
553
|
if (selections.has(label)) {
|
|
540
554
|
this._notifyDeselect(value, (0, _assign.default)({
|
|
541
555
|
value,
|
|
@@ -567,7 +581,10 @@ class SelectFoundation extends _foundation.default {
|
|
|
567
581
|
this._notifyChange(selections);
|
|
568
582
|
|
|
569
583
|
if (this._isFilterable()) {
|
|
570
|
-
|
|
584
|
+
if (autoClearSearchValue) {
|
|
585
|
+
this.clearInput();
|
|
586
|
+
}
|
|
587
|
+
|
|
571
588
|
this.focusInput();
|
|
572
589
|
}
|
|
573
590
|
} else {
|
|
@@ -582,11 +599,15 @@ class SelectFoundation extends _foundation.default {
|
|
|
582
599
|
} = this.getStates(); // Searchable filtering, when selected, resets Input
|
|
583
600
|
|
|
584
601
|
if (this._isFilterable()) {
|
|
585
|
-
|
|
586
|
-
|
|
602
|
+
// When filter active,if autoClearSearchValue is true,reset input after select
|
|
603
|
+
if (autoClearSearchValue) {
|
|
604
|
+
this.clearInput(); // At the same time, the filtering of options is also cleared, in order to show all candidates
|
|
587
605
|
|
|
588
|
-
|
|
589
|
-
|
|
606
|
+
const sugInput = '';
|
|
607
|
+
options = this._filterOption(options, sugInput);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
this.focusInput();
|
|
590
611
|
}
|
|
591
612
|
|
|
592
613
|
this.updateOptionsActiveStatus(selections, options);
|
|
@@ -860,6 +881,7 @@ class SelectFoundation extends _foundation.default {
|
|
|
860
881
|
break;
|
|
861
882
|
|
|
862
883
|
case _keyCode.default.ESC:
|
|
884
|
+
case _keyCode.default.TAB:
|
|
863
885
|
this.close(event);
|
|
864
886
|
break;
|
|
865
887
|
|
|
@@ -1134,6 +1156,18 @@ class SelectFoundation extends _foundation.default {
|
|
|
1134
1156
|
e.stopPropagation();
|
|
1135
1157
|
}
|
|
1136
1158
|
|
|
1159
|
+
handleKeyPress(e) {
|
|
1160
|
+
if (e && e.key === _keyCode.ENTER_KEY) {
|
|
1161
|
+
this.handleClick(e);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
handleClearBtnEnterPress(e) {
|
|
1166
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
1167
|
+
this.handleClearClick(e);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1137
1171
|
handleOptionMouseEnter(optionIndex) {
|
|
1138
1172
|
this._adapter.updateFocusIndex(optionIndex);
|
|
1139
1173
|
}
|
|
@@ -23,6 +23,10 @@ export interface SliderProps {
|
|
|
23
23
|
showBoundary?: boolean;
|
|
24
24
|
railStyle?: Record<string, any>;
|
|
25
25
|
verticalReverse?: boolean;
|
|
26
|
+
'aria-label'?: string;
|
|
27
|
+
'aria-labelledby'?: string;
|
|
28
|
+
'aria-valuetext'?: string;
|
|
29
|
+
getAriaValueText?: (value: number) => string;
|
|
26
30
|
}
|
|
27
31
|
export interface SliderState {
|
|
28
32
|
currentValue: number | number[];
|
|
@@ -138,7 +142,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
138
142
|
*
|
|
139
143
|
* @memberof SliderFoundation
|
|
140
144
|
*/
|
|
141
|
-
getScrollParent: (element: HTMLElement) =>
|
|
145
|
+
getScrollParent: (element: HTMLElement) => Element;
|
|
142
146
|
/**
|
|
143
147
|
* Fixed the event location, beyond the maximum, minimum, left and right, etc. directly modified to the effective location
|
|
144
148
|
*
|
|
@@ -184,6 +188,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
184
188
|
onHandleEnter: (pos: SliderState['focusPos']) => void;
|
|
185
189
|
onHandleLeave: () => void;
|
|
186
190
|
onHandleUp: (e: any) => boolean;
|
|
191
|
+
onFocus: (e: any, handler: 'min' | 'max') => void;
|
|
187
192
|
handleWrapClick: (e: any) => void;
|
|
188
193
|
/**
|
|
189
194
|
* Move the slider to the current click position
|
|
@@ -286,17 +286,8 @@ class SliderFoundation extends _foundation.default {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
if (step !== 1) {
|
|
289
|
-
//
|
|
290
|
-
|
|
291
|
-
// Move right
|
|
292
|
-
stepValue = Math.round(stepValue / step) * step;
|
|
293
|
-
} else if (stepValue < compareValue && Math.round(stepValue / step) * step <= stepValue) {
|
|
294
|
-
// Move left
|
|
295
|
-
stepValue = Math.round(stepValue / step) * step;
|
|
296
|
-
} else {
|
|
297
|
-
// Other moves are invalid, click valid
|
|
298
|
-
stepValue = compareValue;
|
|
299
|
-
}
|
|
289
|
+
// Find nearest step point
|
|
290
|
+
stepValue = Math.round(stepValue / step) * step;
|
|
300
291
|
}
|
|
301
292
|
|
|
302
293
|
if (range && stepValue !== compareValue) {
|
|
@@ -610,7 +601,10 @@ class SliderFoundation extends _foundation.default {
|
|
|
610
601
|
this._adapter.onHandleUpAfter();
|
|
611
602
|
|
|
612
603
|
return true;
|
|
613
|
-
};
|
|
604
|
+
}; // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
this.onFocus = (e, handler) => {};
|
|
614
608
|
|
|
615
609
|
this.handleWrapClick = e => {
|
|
616
610
|
const {
|
package/lib/cjs/table/utils.d.ts
CHANGED
|
@@ -93,3 +93,10 @@ export interface GetAllDisabledRowKeysProps {
|
|
|
93
93
|
rowKey?: string | number | ((record: Record<string, any>) => string | number);
|
|
94
94
|
}
|
|
95
95
|
export declare function warnIfNoDataIndex(column: Record<string, any>): void;
|
|
96
|
+
/**
|
|
97
|
+
* Whether is tree table
|
|
98
|
+
*/
|
|
99
|
+
export declare function isTreeTable({ dataSource, childrenRecordName }: {
|
|
100
|
+
dataSource: Record<string, any>;
|
|
101
|
+
childrenRecordName?: string;
|
|
102
|
+
}): boolean;
|
package/lib/cjs/table/utils.js
CHANGED
|
@@ -41,6 +41,7 @@ exports.isLastLeftFixed = isLastLeftFixed;
|
|
|
41
41
|
exports.isScrollbarColumn = isScrollbarColumn;
|
|
42
42
|
exports.isSelected = isSelected;
|
|
43
43
|
exports.isSelectionColumn = isSelectionColumn;
|
|
44
|
+
exports.isTreeTable = isTreeTable;
|
|
44
45
|
exports.mergeColumns = mergeColumns;
|
|
45
46
|
exports.mergeQueries = mergeQueries;
|
|
46
47
|
exports.sliceColumnsByLevel = sliceColumnsByLevel;
|
|
@@ -614,4 +615,29 @@ function warnIfNoDataIndex(column) {
|
|
|
614
615
|
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
615
616
|
}
|
|
616
617
|
}
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Whether is tree table
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
function isTreeTable(_ref2) {
|
|
625
|
+
let {
|
|
626
|
+
dataSource,
|
|
627
|
+
childrenRecordName = 'children'
|
|
628
|
+
} = _ref2;
|
|
629
|
+
let flag = false;
|
|
630
|
+
|
|
631
|
+
if ((0, _isArray.default)(dataSource)) {
|
|
632
|
+
for (const data of dataSource) {
|
|
633
|
+
const children = (0, _get2.default)(data, childrenRecordName);
|
|
634
|
+
|
|
635
|
+
if ((0, _isArray.default)(children) && children.length) {
|
|
636
|
+
flag = true;
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
return flag;
|
|
617
643
|
}
|
|
@@ -33,6 +33,10 @@ declare class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
33
33
|
_handleAddTags(e: TagInputChangeEvent): void;
|
|
34
34
|
handleInputBlur(e: TagInputCursorEvent): void;
|
|
35
35
|
handleInputFocus(e: TagInputCursorEvent): void;
|
|
36
|
+
/**
|
|
37
|
+
* A11y: simulate clear button click
|
|
38
|
+
*/
|
|
39
|
+
handleClearEnterPress(e: TagInputKeyboardEvent): void;
|
|
36
40
|
handleClearBtn(e: TagInputMouseEvent): void;
|
|
37
41
|
handleTagClose(index: number): void;
|
|
38
42
|
handleInputMouseEnter(): void;
|
|
@@ -40,6 +40,8 @@ var _keyCode = _interopRequireDefault(require("../utils/keyCode"));
|
|
|
40
40
|
|
|
41
41
|
var _getSplitedArray = _interopRequireDefault(require("./utils/getSplitedArray"));
|
|
42
42
|
|
|
43
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
44
|
+
|
|
43
45
|
class TagInputFoundation extends _foundation.default {
|
|
44
46
|
constructor(adapter) {
|
|
45
47
|
super((0, _assign.default)({}, adapter));
|
|
@@ -185,6 +187,16 @@ class TagInputFoundation extends _foundation.default {
|
|
|
185
187
|
|
|
186
188
|
this._adapter.notifyFocus(e);
|
|
187
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* A11y: simulate clear button click
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
handleClearEnterPress(e) {
|
|
196
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
197
|
+
this.handleClearBtn(e);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
188
200
|
|
|
189
201
|
handleClearBtn(e) {
|
|
190
202
|
const {
|
|
@@ -96,8 +96,6 @@ class Tooltip extends _foundation.default {
|
|
|
96
96
|
if (trigger === 'custom') {
|
|
97
97
|
// eslint-disable-next-line
|
|
98
98
|
this._adapter.registerClickOutsideHandler(() => {});
|
|
99
|
-
|
|
100
|
-
this._togglePortalVisible(true);
|
|
101
99
|
}
|
|
102
100
|
/**
|
|
103
101
|
* trigger类型是click时,仅当portal被插入显示后,才绑定clickOutsideHandler
|
|
@@ -643,6 +641,9 @@ class Tooltip extends _foundation.default {
|
|
|
643
641
|
innerWidth,
|
|
644
642
|
innerHeight
|
|
645
643
|
} = window;
|
|
644
|
+
const {
|
|
645
|
+
spacing
|
|
646
|
+
} = this.getProps();
|
|
646
647
|
|
|
647
648
|
if (wrapperRect.width > 0 && wrapperRect.height > 0) {
|
|
648
649
|
// let clientLeft = left + translateX * wrapperRect.width - containerRect.scrollLeft;
|
|
@@ -666,10 +667,10 @@ class Tooltip extends _foundation.default {
|
|
|
666
667
|
const widthIsBigger = wrapperRect.width > triggerRect.width;
|
|
667
668
|
const heightIsBigger = wrapperRect.height > triggerRect.height; // The wrapperR ect.top|bottom equivalent cannot be directly used here for comparison, which is easy to cause jitter
|
|
668
669
|
|
|
669
|
-
const shouldReverseTop = clientTop < wrapperRect.height && restClientBottom > wrapperRect.height;
|
|
670
|
-
const shouldReverseLeft = clientLeft < wrapperRect.width && restClientRight > wrapperRect.width;
|
|
671
|
-
const sholdReverseBottom = restClientBottom < wrapperRect.height && clientTop > wrapperRect.height;
|
|
672
|
-
const shouldReverseRight = restClientRight < wrapperRect.width && clientLeft > wrapperRect.width;
|
|
670
|
+
const shouldReverseTop = clientTop < wrapperRect.height + spacing && restClientBottom > wrapperRect.height + spacing;
|
|
671
|
+
const shouldReverseLeft = clientLeft < wrapperRect.width + spacing && restClientRight > wrapperRect.width + spacing;
|
|
672
|
+
const sholdReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
|
|
673
|
+
const shouldReverseRight = restClientRight < wrapperRect.width + spacing && clientLeft > wrapperRect.width + spacing;
|
|
673
674
|
const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
674
675
|
const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
675
676
|
const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
@@ -651,7 +651,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
651
651
|
|
|
652
652
|
|
|
653
653
|
if (dragNode && eventKey === dragOverNodeKey) {
|
|
654
|
-
const newPos = (0, _treeUtil.calcDropRelativePosition)(
|
|
654
|
+
const newPos = (0, _treeUtil.calcDropRelativePosition)(e, treeNode);
|
|
655
655
|
|
|
656
656
|
if (dropPosition === newPos) {
|
|
657
657
|
return;
|
|
@@ -27,7 +27,7 @@ export interface BasicOnChange {
|
|
|
27
27
|
(node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
|
|
28
28
|
(value: BasicTreeNodeData['value'] | Array<BasicTreeNodeData['value']>, node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
|
|
29
29
|
}
|
|
30
|
-
export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'onSearch' | 'expandAll' | 'disableStrictly'> {
|
|
30
|
+
export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'onSearch' | 'expandAll' | 'disableStrictly' | 'aria-label'> {
|
|
31
31
|
motion?: Motion;
|
|
32
32
|
mouseEnterDelay?: number;
|
|
33
33
|
mouseLeaveDelay?: number;
|
|
@@ -128,7 +128,15 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
128
128
|
open(): void;
|
|
129
129
|
close(e: any): void;
|
|
130
130
|
handleClick(e: any): void;
|
|
131
|
+
/**
|
|
132
|
+
* A11y: simulate selection click
|
|
133
|
+
*/
|
|
134
|
+
handleSelectionEnterPress(e: any): void;
|
|
131
135
|
handleClear(e: any): void;
|
|
136
|
+
/**
|
|
137
|
+
* A11y: simulate clear button click
|
|
138
|
+
*/
|
|
139
|
+
handleClearEnterPress(e: any): void;
|
|
132
140
|
removeTag(eventKey: BasicTreeNodeData['key']): void;
|
|
133
141
|
clearInput(): void;
|
|
134
142
|
handleInputChange(sugInput: string): void;
|