@douyinfe/semi-foundation 2.2.0 → 2.3.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/breadcrumb/foundation.ts +10 -1
- package/checkbox/checkboxFoundation.ts +9 -0
- package/datePicker/datePicker.scss +11 -0
- package/datePicker/foundation.ts +33 -15
- package/datePicker/inputFoundation.ts +2 -0
- package/datePicker/monthsGridFoundation.ts +10 -3
- package/datePicker/rtl.scss +15 -1
- package/datePicker/variables.scss +2 -0
- 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/datePicker.css +26 -2
- package/lib/cjs/datePicker/datePicker.scss +11 -0
- package/lib/cjs/datePicker/foundation.d.ts +6 -3
- package/lib/cjs/datePicker/foundation.js +42 -18
- package/lib/cjs/datePicker/inputFoundation.js +3 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +2 -1
- package/lib/cjs/datePicker/monthsGridFoundation.js +16 -3
- package/lib/cjs/datePicker/rtl.scss +15 -1
- package/lib/cjs/datePicker/variables.scss +2 -0
- 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/table.css +0 -2
- package/lib/cjs/table/table.scss +0 -2
- 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/datePicker.css +26 -2
- package/lib/es/datePicker/datePicker.scss +11 -0
- package/lib/es/datePicker/foundation.d.ts +6 -3
- package/lib/es/datePicker/foundation.js +42 -18
- package/lib/es/datePicker/inputFoundation.js +3 -0
- package/lib/es/datePicker/monthsGridFoundation.d.ts +2 -1
- package/lib/es/datePicker/monthsGridFoundation.js +15 -3
- package/lib/es/datePicker/rtl.scss +15 -1
- package/lib/es/datePicker/variables.scss +2 -0
- 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/table.css +0 -2
- package/lib/es/table/table.scss +0 -2
- 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/table.scss +0 -2
- 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
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/table.css
CHANGED
|
@@ -52,12 +52,10 @@
|
|
|
52
52
|
color: var(--semi-color-text-0);
|
|
53
53
|
width: 100%;
|
|
54
54
|
}
|
|
55
|
-
.semi-table-middle .semi-table-thead > .semi-table-row > .semi-table-row-head,
|
|
56
55
|
.semi-table-middle .semi-table-tbody > .semi-table-row > .semi-table-row-cell {
|
|
57
56
|
padding-top: 12px;
|
|
58
57
|
padding-bottom: 12px;
|
|
59
58
|
}
|
|
60
|
-
.semi-table-small .semi-table-thead > .semi-table-row > .semi-table-row-head,
|
|
61
59
|
.semi-table-small .semi-table-tbody > .semi-table-row > .semi-table-row-cell {
|
|
62
60
|
padding-top: 8px;
|
|
63
61
|
padding-bottom: 8px;
|
package/lib/cjs/table/table.scss
CHANGED
|
@@ -25,7 +25,6 @@ $module: #{$prefix}-table;
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&-middle {
|
|
28
|
-
.#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
|
|
29
28
|
.#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
|
|
30
29
|
padding-top: $spacing-table_middle-paddingY;
|
|
31
30
|
padding-bottom: $spacing-table_middle-paddingY;
|
|
@@ -33,7 +32,6 @@ $module: #{$prefix}-table;
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
&-small {
|
|
36
|
-
.#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
|
|
37
35
|
.#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
|
|
38
36
|
padding-top: $spacing-table_small-paddingY;
|
|
39
37
|
padding-bottom: $spacing-table_small-paddingY;
|
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;
|
|
@@ -54,6 +54,8 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
|
54
54
|
|
|
55
55
|
var _treeUtil = require("../tree/treeUtil");
|
|
56
56
|
|
|
57
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
58
|
+
|
|
57
59
|
// eslint-disable-next-line max-len
|
|
58
60
|
class TreeSelectFoundation extends _foundation.default {
|
|
59
61
|
constructor(adapter) {
|
|
@@ -338,6 +340,16 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
338
340
|
this.close(e);
|
|
339
341
|
}
|
|
340
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* A11y: simulate selection click
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
handleSelectionEnterPress(e) {
|
|
349
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
350
|
+
this.handleClick(e);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
341
353
|
|
|
342
354
|
handleClear(e) {
|
|
343
355
|
const {
|
|
@@ -379,6 +391,16 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
379
391
|
}
|
|
380
392
|
}
|
|
381
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* A11y: simulate clear button click
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
handleClearEnterPress(e) {
|
|
400
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
401
|
+
this.handleClear(e);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
382
404
|
|
|
383
405
|
removeTag(eventKey) {
|
|
384
406
|
const {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.default = void 0;
|
|
12
|
+
|
|
13
|
+
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
14
|
+
|
|
15
|
+
var _keyCode = require("./keyCode");
|
|
16
|
+
|
|
17
|
+
function isEnterPress(e) {
|
|
18
|
+
return (0, _get2.default)(e, 'key') === _keyCode.ENTER_KEY ? true : false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var _default = isEnterPress;
|
|
22
|
+
exports.default = _default;
|
package/lib/cjs/utils/keyCode.js
CHANGED
|
@@ -6,7 +6,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
exports.default = void 0;
|
|
9
|
+
exports.default = exports.TAB_KEY = exports.ENTER_KEY = void 0;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @ignore
|
|
@@ -538,5 +538,9 @@ const keyCode = {
|
|
|
538
538
|
*/
|
|
539
539
|
WIN_IME: 229
|
|
540
540
|
};
|
|
541
|
+
const ENTER_KEY = 'Enter';
|
|
542
|
+
exports.ENTER_KEY = ENTER_KEY;
|
|
543
|
+
const TAB_KEY = 'Tab';
|
|
544
|
+
exports.TAB_KEY = TAB_KEY;
|
|
541
545
|
var _default = keyCode;
|
|
542
546
|
exports.default = _default;
|
package/lib/cjs/utils/uuid.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
export default function getUuid(prefix: string): string;
|
|
2
2
|
declare function getUuidv4(): string;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Get a random id with prefix, it not strictly guarantee id uniqueness
|
|
5
|
+
*
|
|
6
|
+
* Note: the return value of getUuid is too long, we need a short one
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* getUuidShort({ prefix: 'semi' }) => 'semi-46dinzc'
|
|
10
|
+
* getUuidShort({ prefix: '' }) => '0eer2i0'
|
|
11
|
+
* getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
|
|
12
|
+
*/
|
|
13
|
+
declare function getUuidShort(options?: GetUuidShortOptions): string;
|
|
14
|
+
interface GetUuidShortOptions {
|
|
15
|
+
prefix?: string;
|
|
16
|
+
length?: number;
|
|
17
|
+
}
|
|
18
|
+
export { getUuid, getUuidv4, getUuidShort };
|
package/lib/cjs/utils/uuid.js
CHANGED
|
@@ -9,6 +9,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
exports.getUuid = exports.default = getUuid;
|
|
12
|
+
exports.getUuidShort = getUuidShort;
|
|
12
13
|
exports.getUuidv4 = getUuidv4;
|
|
13
14
|
|
|
14
15
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
@@ -26,4 +27,35 @@ function getUuidv4() {
|
|
|
26
27
|
} catch (err) {
|
|
27
28
|
return getUuid('semi');
|
|
28
29
|
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get a random id with prefix, it not strictly guarantee id uniqueness
|
|
33
|
+
*
|
|
34
|
+
* Note: the return value of getUuid is too long, we need a short one
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* getUuidShort({ prefix: 'semi' }) => 'semi-46dinzc'
|
|
38
|
+
* getUuidShort({ prefix: '' }) => '0eer2i0'
|
|
39
|
+
* getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function getUuidShort() {
|
|
44
|
+
var _context3;
|
|
45
|
+
|
|
46
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
47
|
+
const {
|
|
48
|
+
prefix = '',
|
|
49
|
+
length = 7
|
|
50
|
+
} = options;
|
|
51
|
+
const characters = '0123456789abcdefghijklmnopqrstuvwxyz';
|
|
52
|
+
const total = characters.length;
|
|
53
|
+
let randomId = '';
|
|
54
|
+
|
|
55
|
+
for (let i = 0; i < length; i++) {
|
|
56
|
+
const random = Math.floor(Math.random() * total);
|
|
57
|
+
randomId += characters.charAt(random);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return prefix ? (0, _concat.default)(_context3 = "".concat(prefix, "-")).call(_context3, randomId) : randomId;
|
|
29
61
|
}
|
|
@@ -8,6 +8,10 @@ export default class BreadcrumbFoundation<P = Record<string, any>, S = Record<st
|
|
|
8
8
|
constructor(adapter: BreadcrumbAdapter<P, S>);
|
|
9
9
|
handleClick(info: BreadcrumbItemInfo, event: any): void;
|
|
10
10
|
handleExpand(clickEvent: any): void;
|
|
11
|
+
/**
|
|
12
|
+
* A11y: simulate clear button click
|
|
13
|
+
*/
|
|
14
|
+
handleExpandEnterPress(keyboardEvent: any): void;
|
|
11
15
|
genRoutes(routes: Array<Route>): ({
|
|
12
16
|
name: never;
|
|
13
17
|
_origin: {
|
|
@@ -3,6 +3,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable prefer-const */
|
|
5
5
|
import BaseFoundation from '../base/foundation';
|
|
6
|
+
import isEnterPress from '../utils/isEnterPress';
|
|
6
7
|
export default class BreadcrumbFoundation extends BaseFoundation {
|
|
7
8
|
constructor(adapter) {
|
|
8
9
|
super(_Object$assign({}, adapter));
|
|
@@ -15,6 +16,16 @@ export default class BreadcrumbFoundation extends BaseFoundation {
|
|
|
15
16
|
handleExpand(clickEvent) {
|
|
16
17
|
this._adapter.expandCollapsed(clickEvent);
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A11y: simulate clear button click
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
handleExpandEnterPress(keyboardEvent) {
|
|
25
|
+
if (isEnterPress(keyboardEvent)) {
|
|
26
|
+
this.handleExpand(keyboardEvent);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
18
29
|
|
|
19
30
|
genRoutes(routes) {
|
|
20
31
|
return _mapInstanceProperty(routes).call(routes, route => {
|
|
@@ -34,6 +34,7 @@ declare class CheckboxFoundation<P = Record<string, any>, S = Record<string, any
|
|
|
34
34
|
notifyChange(checked: boolean, e: any): void;
|
|
35
35
|
handleChange(e: any): void;
|
|
36
36
|
handleChangeInGroup(e: any): void;
|
|
37
|
+
handleEnterPress(e: any): void;
|
|
37
38
|
setChecked(checked: boolean): void;
|
|
38
39
|
destroy(): void;
|
|
39
40
|
}
|
|
@@ -52,5 +53,7 @@ export interface BaseCheckboxProps {
|
|
|
52
53
|
onMouseEnter?: (e: any) => void;
|
|
53
54
|
onMouseLeave?: (e: any) => void;
|
|
54
55
|
extra?: any;
|
|
56
|
+
addonId?: string;
|
|
57
|
+
extraId?: string;
|
|
55
58
|
}
|
|
56
59
|
export default CheckboxFoundation;
|