@douyinfe/semi-foundation 2.16.1 → 2.17.0-beta.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/collapse/collapse.scss +8 -0
- package/collapse/variables.scss +1 -0
- package/datePicker/constants.ts +1 -0
- package/datePicker/datePicker.scss +335 -17
- package/datePicker/foundation.ts +2 -0
- package/datePicker/monthsGridFoundation.ts +4 -1
- package/datePicker/rtl.scss +6 -6
- package/datePicker/variables.scss +58 -6
- package/datePicker/yearAndMonthFoundation.ts +4 -0
- package/lib/cjs/collapse/collapse.css +6 -0
- package/lib/cjs/collapse/collapse.scss +8 -0
- package/lib/cjs/collapse/variables.scss +1 -0
- package/lib/cjs/datePicker/constants.d.ts +1 -0
- package/lib/cjs/datePicker/constants.js +1 -0
- package/lib/cjs/datePicker/datePicker.css +267 -27
- package/lib/cjs/datePicker/datePicker.scss +335 -17
- package/lib/cjs/datePicker/foundation.d.ts +2 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +5 -1
- package/lib/cjs/datePicker/rtl.scss +6 -6
- package/lib/cjs/datePicker/variables.scss +58 -6
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +5 -0
- package/lib/cjs/select/foundation.d.ts +11 -0
- package/lib/cjs/select/foundation.js +188 -44
- package/lib/cjs/select/select.css +5 -5
- package/lib/cjs/select/select.scss +9 -6
- package/lib/cjs/tagInput/foundation.d.ts +11 -0
- package/lib/cjs/tagInput/foundation.js +47 -1
- package/lib/cjs/tagInput/tagInput.css +11 -0
- package/lib/cjs/tagInput/tagInput.scss +17 -0
- package/lib/cjs/tagInput/variables.scss +2 -0
- package/lib/cjs/tooltip/foundation.js +13 -5
- package/lib/cjs/transfer/foundation.d.ts +0 -1
- package/lib/cjs/transfer/foundation.js +3 -11
- package/lib/cjs/utils/arrayMove.d.ts +1 -0
- package/lib/cjs/utils/arrayMove.js +21 -0
- package/lib/es/collapse/collapse.css +6 -0
- package/lib/es/collapse/collapse.scss +8 -0
- package/lib/es/collapse/variables.scss +1 -0
- package/lib/es/datePicker/constants.d.ts +1 -0
- package/lib/es/datePicker/constants.js +1 -0
- package/lib/es/datePicker/datePicker.css +267 -27
- package/lib/es/datePicker/datePicker.scss +335 -17
- package/lib/es/datePicker/foundation.d.ts +2 -0
- package/lib/es/datePicker/monthsGridFoundation.d.ts +5 -1
- package/lib/es/datePicker/rtl.scss +6 -6
- package/lib/es/datePicker/variables.scss +58 -6
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +5 -0
- package/lib/es/select/foundation.d.ts +11 -0
- package/lib/es/select/foundation.js +187 -44
- package/lib/es/select/select.css +5 -5
- package/lib/es/select/select.scss +9 -6
- package/lib/es/tagInput/foundation.d.ts +11 -0
- package/lib/es/tagInput/foundation.js +46 -1
- package/lib/es/tagInput/tagInput.css +11 -0
- package/lib/es/tagInput/tagInput.scss +17 -0
- package/lib/es/tagInput/variables.scss +2 -0
- package/lib/es/tooltip/foundation.js +13 -5
- package/lib/es/transfer/foundation.d.ts +0 -1
- package/lib/es/transfer/foundation.js +3 -12
- package/lib/es/utils/arrayMove.d.ts +1 -0
- package/lib/es/utils/arrayMove.js +9 -0
- package/package.json +2 -2
- package/select/foundation.ts +149 -36
- package/select/select.scss +9 -6
- package/tagInput/foundation.ts +39 -0
- package/tagInput/tagInput.scss +17 -0
- package/tagInput/variables.scss +2 -0
- package/tooltip/foundation.ts +8 -5
- package/transfer/foundation.ts +2 -6
- package/utils/arrayMove.ts +5 -0
|
@@ -58,6 +58,8 @@ var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefi
|
|
|
58
58
|
|
|
59
59
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
60
60
|
|
|
61
|
+
var _a11y = require("../utils/a11y");
|
|
62
|
+
|
|
61
63
|
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
64
|
|
|
63
65
|
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; }
|
|
@@ -107,14 +109,22 @@ class SelectFoundation extends _foundation.default {
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
focus() {
|
|
110
|
-
this._focusTrigger();
|
|
111
|
-
|
|
112
112
|
const isFilterable = this._isFilterable();
|
|
113
113
|
|
|
114
|
+
const isMultiple = this._isMultiple();
|
|
115
|
+
|
|
114
116
|
this._adapter.updateFocusState(true);
|
|
115
117
|
|
|
116
|
-
|
|
118
|
+
this._adapter.setIsFocusInContainer(false);
|
|
119
|
+
|
|
120
|
+
if (isFilterable && isMultiple) {
|
|
121
|
+
// when filter and multiple, only focus input
|
|
122
|
+
this.focusInput();
|
|
123
|
+
} else if (isFilterable && !isMultiple) {
|
|
124
|
+
// when filter and not multiple, only show input and focus input
|
|
117
125
|
this.toggle2SearchInput(true);
|
|
126
|
+
} else {
|
|
127
|
+
this._focusTrigger();
|
|
118
128
|
}
|
|
119
129
|
}
|
|
120
130
|
|
|
@@ -124,9 +134,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
124
134
|
}
|
|
125
135
|
|
|
126
136
|
destroy() {
|
|
127
|
-
this._adapter.unregisterClickOutsideHandler();
|
|
137
|
+
this._adapter.unregisterClickOutsideHandler(); // this.unBindKeyBoardEvent();
|
|
128
138
|
|
|
129
|
-
this.unBindKeyBoardEvent();
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
_setDropdownWidth() {
|
|
@@ -445,6 +454,10 @@ class SelectFoundation extends _foundation.default {
|
|
|
445
454
|
|
|
446
455
|
this._adapter.registerClickOutsideHandler(e => {
|
|
447
456
|
this.close(e);
|
|
457
|
+
|
|
458
|
+
this._notifyBlur(e);
|
|
459
|
+
|
|
460
|
+
this._adapter.updateFocusState(false);
|
|
448
461
|
});
|
|
449
462
|
}
|
|
450
463
|
|
|
@@ -452,15 +465,17 @@ class SelectFoundation extends _foundation.default {
|
|
|
452
465
|
if (isShow) {
|
|
453
466
|
this._adapter.toggleInputShow(isShow, () => this.focusInput());
|
|
454
467
|
} else {
|
|
468
|
+
// only when choose the option and close the panel, the input can be hide
|
|
455
469
|
this._adapter.toggleInputShow(isShow, () => undefined);
|
|
456
470
|
}
|
|
457
471
|
}
|
|
458
472
|
|
|
459
473
|
close(e) {
|
|
474
|
+
// to support A11y, closing the panel trigger does not necessarily lose focus
|
|
460
475
|
const isFilterable = this._isFilterable();
|
|
461
476
|
|
|
462
477
|
if (isFilterable) {
|
|
463
|
-
this.unBindKeyBoardEvent();
|
|
478
|
+
// this.unBindKeyBoardEvent();
|
|
464
479
|
this.clearInput();
|
|
465
480
|
this.toggle2SearchInput(false);
|
|
466
481
|
}
|
|
@@ -469,13 +484,12 @@ class SelectFoundation extends _foundation.default {
|
|
|
469
484
|
|
|
470
485
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
471
486
|
|
|
472
|
-
this.unBindKeyBoardEvent();
|
|
487
|
+
this._adapter.setIsFocusInContainer(false); // this.unBindKeyBoardEvent();
|
|
488
|
+
// this._notifyBlur(e);
|
|
473
489
|
|
|
474
|
-
this._notifyBlur(e);
|
|
475
490
|
|
|
476
|
-
this._adapter.unregisterClickOutsideHandler();
|
|
491
|
+
this._adapter.unregisterClickOutsideHandler(); // this._adapter.updateFocusState(false);
|
|
477
492
|
|
|
478
|
-
this._adapter.updateFocusState(false);
|
|
479
493
|
}
|
|
480
494
|
|
|
481
495
|
onSelect(option, optionIndex, event) {
|
|
@@ -494,6 +508,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
494
508
|
|
|
495
509
|
if (!isMultiple) {
|
|
496
510
|
this._handleSingleSelect(option, event);
|
|
511
|
+
|
|
512
|
+
this._focusTrigger();
|
|
497
513
|
} else {
|
|
498
514
|
this._handleMultipleSelect(option, event);
|
|
499
515
|
}
|
|
@@ -717,6 +733,8 @@ class SelectFoundation extends _foundation.default {
|
|
|
717
733
|
this._adapter.focusInput();
|
|
718
734
|
|
|
719
735
|
this._adapter.updateFocusState(true);
|
|
736
|
+
|
|
737
|
+
this._adapter.setIsFocusInContainer(false);
|
|
720
738
|
}
|
|
721
739
|
|
|
722
740
|
handleInputChange(sugInput) {
|
|
@@ -852,14 +870,17 @@ class SelectFoundation extends _foundation.default {
|
|
|
852
870
|
|
|
853
871
|
_handleKeyDown(event) {
|
|
854
872
|
const key = event.keyCode;
|
|
873
|
+
const {
|
|
874
|
+
loading,
|
|
875
|
+
filter,
|
|
876
|
+
multiple,
|
|
877
|
+
disabled
|
|
878
|
+
} = this.getProps();
|
|
855
879
|
const {
|
|
856
880
|
isOpen
|
|
857
881
|
} = this.getStates();
|
|
858
|
-
const {
|
|
859
|
-
loading
|
|
860
|
-
} = this.getProps();
|
|
861
882
|
|
|
862
|
-
if (
|
|
883
|
+
if (loading || disabled) {
|
|
863
884
|
return;
|
|
864
885
|
}
|
|
865
886
|
|
|
@@ -890,16 +911,38 @@ class SelectFoundation extends _foundation.default {
|
|
|
890
911
|
case _keyCode.default.ENTER:
|
|
891
912
|
// internal-issues:302
|
|
892
913
|
// prevent trigger form’s submit when use in form
|
|
893
|
-
|
|
894
|
-
event.stopPropagation();
|
|
914
|
+
(0, _a11y.handlePrevent)(event);
|
|
895
915
|
|
|
896
916
|
this._handleEnterKeyDown(event);
|
|
897
917
|
|
|
898
918
|
break;
|
|
899
919
|
|
|
900
920
|
case _keyCode.default.ESC:
|
|
921
|
+
isOpen && this.close(event);
|
|
922
|
+
filter && !multiple && this._focusTrigger();
|
|
923
|
+
break;
|
|
924
|
+
|
|
901
925
|
case _keyCode.default.TAB:
|
|
902
|
-
|
|
926
|
+
// check if slot have focusable element
|
|
927
|
+
this._handleTabKeyDown(event);
|
|
928
|
+
|
|
929
|
+
break;
|
|
930
|
+
|
|
931
|
+
default:
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
handleContainerKeyDown(event) {
|
|
937
|
+
// when focus in contanier, handle the key down
|
|
938
|
+
const key = event.keyCode;
|
|
939
|
+
const {
|
|
940
|
+
isOpen
|
|
941
|
+
} = this.getStates();
|
|
942
|
+
|
|
943
|
+
switch (key) {
|
|
944
|
+
case _keyCode.default.TAB:
|
|
945
|
+
isOpen && this._handleTabKeyDown(event);
|
|
903
946
|
break;
|
|
904
947
|
|
|
905
948
|
default:
|
|
@@ -967,7 +1010,84 @@ class SelectFoundation extends _foundation.default {
|
|
|
967
1010
|
}
|
|
968
1011
|
|
|
969
1012
|
_handleArrowKeyDown(offset) {
|
|
970
|
-
|
|
1013
|
+
const {
|
|
1014
|
+
isOpen
|
|
1015
|
+
} = this.getStates();
|
|
1016
|
+
isOpen ? this._getEnableFocusIndex(offset) : this.open();
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
_handleTabKeyDown(event) {
|
|
1020
|
+
const {
|
|
1021
|
+
isOpen
|
|
1022
|
+
} = this.getStates();
|
|
1023
|
+
|
|
1024
|
+
this._adapter.updateFocusState(false);
|
|
1025
|
+
|
|
1026
|
+
if (isOpen) {
|
|
1027
|
+
const container = this._adapter.getContainer();
|
|
1028
|
+
|
|
1029
|
+
const focusableElements = this._adapter.getFocusableElements(container);
|
|
1030
|
+
|
|
1031
|
+
const focusableNum = focusableElements.length;
|
|
1032
|
+
|
|
1033
|
+
if (focusableNum > 0) {
|
|
1034
|
+
// Shift + Tab will move focus backward
|
|
1035
|
+
if (event.shiftKey) {
|
|
1036
|
+
this._handlePanelOpenShiftTabKeyDown(focusableElements, event);
|
|
1037
|
+
} else {
|
|
1038
|
+
this._handlePanelOpenTabKeyDown(focusableElements, event);
|
|
1039
|
+
}
|
|
1040
|
+
} else {
|
|
1041
|
+
// there are no focusable elements inside the container, tab to next element and trigger blur
|
|
1042
|
+
this.close();
|
|
1043
|
+
|
|
1044
|
+
this._notifyBlur(event);
|
|
1045
|
+
}
|
|
1046
|
+
} else {
|
|
1047
|
+
// tab or shift tab to next element and trigger blur
|
|
1048
|
+
this._notifyBlur(event);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
_handlePanelOpenTabKeyDown(focusableElements, event) {
|
|
1053
|
+
const activeElement = this._adapter.getActiveElement();
|
|
1054
|
+
|
|
1055
|
+
const isFocusInContainer = this._adapter.getIsFocusInContainer();
|
|
1056
|
+
|
|
1057
|
+
if (!isFocusInContainer) {
|
|
1058
|
+
// focus in trigger, set next focus to the first element in container
|
|
1059
|
+
focusableElements[0].focus();
|
|
1060
|
+
|
|
1061
|
+
this._adapter.setIsFocusInContainer(true);
|
|
1062
|
+
|
|
1063
|
+
(0, _a11y.handlePrevent)(event);
|
|
1064
|
+
} else if (activeElement === focusableElements[focusableElements.length - 1]) {
|
|
1065
|
+
// focus in the last element in container, focus back to trigger and close panel
|
|
1066
|
+
this._focusTrigger();
|
|
1067
|
+
|
|
1068
|
+
this.close();
|
|
1069
|
+
(0, _a11y.handlePrevent)(event);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
_handlePanelOpenShiftTabKeyDown(focusableElements, event) {
|
|
1074
|
+
const activeElement = this._adapter.getActiveElement();
|
|
1075
|
+
|
|
1076
|
+
const isFocusInContainer = this._adapter.getIsFocusInContainer();
|
|
1077
|
+
|
|
1078
|
+
if (!isFocusInContainer) {
|
|
1079
|
+
// focus in trigger, close the panel, shift tab to previe element and trigger blur
|
|
1080
|
+
this.close();
|
|
1081
|
+
|
|
1082
|
+
this._notifyBlur(event);
|
|
1083
|
+
} else if (activeElement === focusableElements[0]) {
|
|
1084
|
+
// focus in the first element in container, focus back to trigger
|
|
1085
|
+
this._focusTrigger();
|
|
1086
|
+
|
|
1087
|
+
this._adapter.setIsFocusInContainer(false);
|
|
1088
|
+
|
|
1089
|
+
(0, _a11y.handlePrevent)(event);
|
|
1090
|
+
}
|
|
971
1091
|
}
|
|
972
1092
|
|
|
973
1093
|
_handleEnterKeyDown(event) {
|
|
@@ -977,26 +1097,32 @@ class SelectFoundation extends _foundation.default {
|
|
|
977
1097
|
focusIndex
|
|
978
1098
|
} = this.getStates();
|
|
979
1099
|
|
|
980
|
-
if (
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
if (visibleOptions && length) {
|
|
991
|
-
const selectedOption = visibleOptions[focusIndex];
|
|
1100
|
+
if (!isOpen) {
|
|
1101
|
+
this.open();
|
|
1102
|
+
} else {
|
|
1103
|
+
if (focusIndex !== -1) {
|
|
1104
|
+
const visibleOptions = (0, _filter.default)(options).call(options, item => item._show);
|
|
1105
|
+
const {
|
|
1106
|
+
length
|
|
1107
|
+
} = visibleOptions; // fix issue 1201
|
|
992
1108
|
|
|
993
|
-
if (
|
|
1109
|
+
if (length <= focusIndex) {
|
|
994
1110
|
return;
|
|
995
1111
|
}
|
|
996
1112
|
|
|
997
|
-
|
|
1113
|
+
if (visibleOptions && length) {
|
|
1114
|
+
const selectedOption = visibleOptions[focusIndex];
|
|
1115
|
+
|
|
1116
|
+
if (selectedOption.disabled) {
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
this.onSelect(selectedOption, focusIndex, event);
|
|
1121
|
+
}
|
|
1122
|
+
} else {
|
|
1123
|
+
this.close();
|
|
998
1124
|
}
|
|
999
|
-
}
|
|
1125
|
+
}
|
|
1000
1126
|
}
|
|
1001
1127
|
|
|
1002
1128
|
_handleBackspaceKeyDown() {
|
|
@@ -1139,15 +1265,16 @@ class SelectFoundation extends _foundation.default {
|
|
|
1139
1265
|
this._adapter.notifyChange(values);
|
|
1140
1266
|
}
|
|
1141
1267
|
} // Scenes that may trigger blur:
|
|
1142
|
-
//
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1268
|
+
// 1、clickOutSide
|
|
1269
|
+
// 2、 tab to next element/ shift tab to previous element
|
|
1270
|
+
// 3、[remove when add a11y] click option / press enter, and then select complete(when multiple is false
|
|
1271
|
+
// 4、[remove when add a11y] press esc when dropdown list open
|
|
1145
1272
|
|
|
1146
1273
|
|
|
1147
1274
|
_notifyBlur(e) {
|
|
1148
1275
|
this._adapter.notifyBlur(e);
|
|
1149
1276
|
} // Scenes that may trigger focus:
|
|
1150
|
-
//
|
|
1277
|
+
// 1、click selection
|
|
1151
1278
|
|
|
1152
1279
|
|
|
1153
1280
|
_notifyFocus(e) {
|
|
@@ -1200,11 +1327,15 @@ class SelectFoundation extends _foundation.default {
|
|
|
1200
1327
|
|
|
1201
1328
|
handleListScroll(e) {
|
|
1202
1329
|
this._adapter.notifyListScroll(e);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
handleTriggerFocus(e) {
|
|
1333
|
+
this.bindKeyBoardEvent();
|
|
1334
|
+
|
|
1335
|
+
this._adapter.updateFocusState(true);
|
|
1207
1336
|
|
|
1337
|
+
this._adapter.setIsFocusInContainer(false);
|
|
1338
|
+
}
|
|
1208
1339
|
|
|
1209
1340
|
handleTriggerBlur(e) {
|
|
1210
1341
|
this._adapter.updateFocusState(false);
|
|
@@ -1216,15 +1347,28 @@ class SelectFoundation extends _foundation.default {
|
|
|
1216
1347
|
const {
|
|
1217
1348
|
isOpen,
|
|
1218
1349
|
isFocus
|
|
1219
|
-
} = this.getStates(); // Under normal circumstances, blur will be accompanied by
|
|
1220
|
-
// But when autoFocus, because
|
|
1350
|
+
} = this.getStates(); // Under normal circumstances, blur will be accompanied by clickOutsideHandler, so the notify of blur can be called uniformly in clickOutsideHandler
|
|
1351
|
+
// But when autoFocus, because clickOutsideHandler is not register, you need to listen for the trigger's blur and trigger the notify callback
|
|
1221
1352
|
|
|
1222
1353
|
if (autoFocus && isFocus && !isOpen) {
|
|
1223
|
-
// blur when autoFocus & not open dropdown yet
|
|
1224
1354
|
this._notifyBlur(e);
|
|
1225
1355
|
}
|
|
1226
1356
|
}
|
|
1227
1357
|
|
|
1358
|
+
handleInputBlur(e) {
|
|
1359
|
+
const {
|
|
1360
|
+
filter,
|
|
1361
|
+
autoFocus
|
|
1362
|
+
} = this.getProps();
|
|
1363
|
+
|
|
1364
|
+
const isMultiple = this._isMultiple();
|
|
1365
|
+
|
|
1366
|
+
if (autoFocus && filter && !isMultiple) {
|
|
1367
|
+
// under this condition, when input blur, hide the input
|
|
1368
|
+
this.toggle2SearchInput(false);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1228
1372
|
selectAll() {
|
|
1229
1373
|
const {
|
|
1230
1374
|
options
|
|
@@ -93,10 +93,6 @@
|
|
|
93
93
|
background-color: var(--semi-color-fill-1);
|
|
94
94
|
border: 1px solid transparent;
|
|
95
95
|
}
|
|
96
|
-
.semi-select:active {
|
|
97
|
-
background-color: var(--semi-color-fill-2);
|
|
98
|
-
border: 1px solid var(--semi-color-focus-border);
|
|
99
|
-
}
|
|
100
96
|
.semi-select:focus {
|
|
101
97
|
border: 1px solid var(--semi-color-focus-border);
|
|
102
98
|
outline: 0;
|
|
@@ -122,6 +118,10 @@
|
|
|
122
118
|
background-color: var(--semi-color-fill-0);
|
|
123
119
|
border: 1px solid var(--semi-color-focus-border);
|
|
124
120
|
}
|
|
121
|
+
.semi-select-open:active, .semi-select-focus:active {
|
|
122
|
+
background-color: var(--semi-color-fill-2);
|
|
123
|
+
border: 1px solid var(--semi-color-focus-border);
|
|
124
|
+
}
|
|
125
125
|
.semi-select-warning {
|
|
126
126
|
background-color: var(--semi-color-warning-light-default);
|
|
127
127
|
border-color: var(--semi-color-warning-light-default);
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
background-color: var(--semi-color-disabled-fill);
|
|
163
163
|
}
|
|
164
164
|
.semi-select-disabled:focus {
|
|
165
|
-
border: 1px solid
|
|
165
|
+
border: 1px solid transparent;
|
|
166
166
|
}
|
|
167
167
|
.semi-select-disabled .semi-select-selection,
|
|
168
168
|
.semi-select-disabled .semi-select-selection-placeholder {
|
|
@@ -27,11 +27,6 @@ $multiple: #{$module}-multiple;
|
|
|
27
27
|
border: $width-select-border-hover solid $color-select-border-hover;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
&:active {
|
|
31
|
-
background-color: $color-select-bg-active;
|
|
32
|
-
border: $width-select-border-active solid $color-select-border-active;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
30
|
&:focus {
|
|
36
31
|
border: $width-select-border-focus solid $color-select-border-focus;
|
|
37
32
|
outline: 0;
|
|
@@ -59,6 +54,12 @@ $multiple: #{$module}-multiple;
|
|
|
59
54
|
background-color: $color-select-bg-default;
|
|
60
55
|
border: $border-thickness-control-focus solid $color-select_default-border-focus;
|
|
61
56
|
}
|
|
57
|
+
|
|
58
|
+
// when click the trigger, trigger get the focus state, active style should take effect
|
|
59
|
+
&:active {
|
|
60
|
+
background-color: $color-select-bg-active;
|
|
61
|
+
border: $width-select-border-active solid $color-select-border-active;
|
|
62
|
+
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
&-warning {
|
|
@@ -111,7 +112,9 @@ $multiple: #{$module}-multiple;
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
&:focus {
|
|
114
|
-
border: $border-thickness-control-focus solid $color-select_default-border-focus;
|
|
115
|
+
// border: $border-thickness-control-focus solid $color-select_default-border-focus;
|
|
116
|
+
// when select is disabled, the border should not have active color
|
|
117
|
+
border: $border-thickness-control-focus solid transparent;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
.#{$module}-selection,
|
|
@@ -3,12 +3,20 @@ export declare type TagInputChangeEvent = any;
|
|
|
3
3
|
export declare type TagInputCursorEvent = any;
|
|
4
4
|
export declare type TagInputKeyboardEvent = any;
|
|
5
5
|
export declare type TagInputMouseEvent = any;
|
|
6
|
+
export interface OnSortEndProps {
|
|
7
|
+
oldIndex: number;
|
|
8
|
+
newIndex: number;
|
|
9
|
+
}
|
|
6
10
|
export interface TagInputAdapter extends DefaultAdapter {
|
|
7
11
|
setInputValue: (inputValue: string) => void;
|
|
8
12
|
setTagsArray: (tagsArray: string[]) => void;
|
|
9
13
|
setFocusing: (focusing: boolean) => void;
|
|
10
14
|
toggleFocusing(focused: boolean): void;
|
|
11
15
|
setHovering: (hovering: boolean) => void;
|
|
16
|
+
setActive: (active: boolean) => void;
|
|
17
|
+
getClickOutsideHandler: () => any;
|
|
18
|
+
registerClickOutsideHandler: (cb: any) => void;
|
|
19
|
+
unregisterClickOutsideHandler: () => void;
|
|
12
20
|
notifyBlur: (e: TagInputCursorEvent) => void;
|
|
13
21
|
notifyFocus: (e: TagInputCursorEvent) => void;
|
|
14
22
|
notifyInputChange: (v: string, e: TagInputChangeEvent) => void;
|
|
@@ -42,6 +50,8 @@ declare class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
42
50
|
handleTagClose(index: number): void;
|
|
43
51
|
handleInputMouseEnter(): void;
|
|
44
52
|
handleInputMouseLeave(): void;
|
|
53
|
+
handleClick(e?: any): void;
|
|
54
|
+
clickOutsideCallBack(): void;
|
|
45
55
|
handleClickPrefixOrSuffix(e: any): void;
|
|
46
56
|
handlePreventMouseDown(e: any): void;
|
|
47
57
|
/**
|
|
@@ -56,5 +66,6 @@ declare class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
|
|
|
56
66
|
* handler of input change
|
|
57
67
|
*/
|
|
58
68
|
_onInputChange(value: string, e: TagInputChangeEvent): void;
|
|
69
|
+
handleSortEnd(callbackProps: OnSortEndProps): void;
|
|
59
70
|
}
|
|
60
71
|
export default TagInputFoundation;
|
|
@@ -42,6 +42,8 @@ var _getSplitedArray = _interopRequireDefault(require("./utils/getSplitedArray")
|
|
|
42
42
|
|
|
43
43
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
44
44
|
|
|
45
|
+
var _arrayMove = _interopRequireDefault(require("../utils/arrayMove"));
|
|
46
|
+
|
|
45
47
|
class TagInputFoundation extends _foundation.default {
|
|
46
48
|
constructor(adapter) {
|
|
47
49
|
super((0, _assign.default)({}, adapter));
|
|
@@ -218,7 +220,10 @@ class TagInputFoundation extends _foundation.default {
|
|
|
218
220
|
|
|
219
221
|
if (inputValue.length > 0) {
|
|
220
222
|
this._onInputChange('', e);
|
|
221
|
-
}
|
|
223
|
+
} // Prevent event propagate to TagInput outermost div
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
e.stopPropagation();
|
|
222
227
|
}
|
|
223
228
|
|
|
224
229
|
handleTagClose(index) {
|
|
@@ -241,6 +246,30 @@ class TagInputFoundation extends _foundation.default {
|
|
|
241
246
|
this._adapter.setHovering(false);
|
|
242
247
|
}
|
|
243
248
|
|
|
249
|
+
handleClick(e) {
|
|
250
|
+
const {
|
|
251
|
+
disabled
|
|
252
|
+
} = this.getProps();
|
|
253
|
+
|
|
254
|
+
if (disabled) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const clickOutsideHandler = this._adapter.getClickOutsideHandler();
|
|
259
|
+
|
|
260
|
+
if (!clickOutsideHandler) {
|
|
261
|
+
this._adapter.setActive(true);
|
|
262
|
+
|
|
263
|
+
this._adapter.registerClickOutsideHandler(e => this.clickOutsideCallBack());
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
clickOutsideCallBack() {
|
|
268
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
269
|
+
|
|
270
|
+
this._adapter.setActive(false);
|
|
271
|
+
}
|
|
272
|
+
|
|
244
273
|
handleClickPrefixOrSuffix(e) {
|
|
245
274
|
const {
|
|
246
275
|
disabled
|
|
@@ -299,6 +328,23 @@ class TagInputFoundation extends _foundation.default {
|
|
|
299
328
|
this._adapter.notifyInputChange(value, e);
|
|
300
329
|
}
|
|
301
330
|
|
|
331
|
+
handleSortEnd(callbackProps) {
|
|
332
|
+
const {
|
|
333
|
+
oldIndex,
|
|
334
|
+
newIndex
|
|
335
|
+
} = callbackProps;
|
|
336
|
+
const {
|
|
337
|
+
tagsArray
|
|
338
|
+
} = this.getStates();
|
|
339
|
+
const newTagsArray = (0, _arrayMove.default)(tagsArray, oldIndex, newIndex);
|
|
340
|
+
|
|
341
|
+
if (!this._isControlledComponent()) {
|
|
342
|
+
this._adapter.setTagsArray(newTagsArray);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
this._adapter.notifyTagChange(newTagsArray);
|
|
346
|
+
}
|
|
347
|
+
|
|
302
348
|
}
|
|
303
349
|
|
|
304
350
|
var _default = TagInputFoundation;
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
}
|
|
13
|
+
.semi-tagInput-drag-item {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
}
|
|
17
|
+
.semi-tagInput-drag-handler {
|
|
18
|
+
margin-right: 4px;
|
|
19
|
+
cursor: move;
|
|
20
|
+
}
|
|
13
21
|
.semi-tagInput-hover {
|
|
14
22
|
background-color: var(--semi-color-fill-1);
|
|
15
23
|
border: 1px transparent solid;
|
|
@@ -88,6 +96,9 @@
|
|
|
88
96
|
margin-top: 3px;
|
|
89
97
|
margin-bottom: 3px;
|
|
90
98
|
}
|
|
99
|
+
.semi-tagInput-wrapper-tag-icon {
|
|
100
|
+
padding-left: 4px;
|
|
101
|
+
}
|
|
91
102
|
.semi-tagInput-wrapper-typo {
|
|
92
103
|
font-size: 12px;
|
|
93
104
|
}
|
|
@@ -11,6 +11,19 @@ $module: #{$prefix}-tagInput;
|
|
|
11
11
|
width: 100%;
|
|
12
12
|
box-sizing: border-box;
|
|
13
13
|
|
|
14
|
+
&-drag {
|
|
15
|
+
|
|
16
|
+
&-item {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-handler {
|
|
22
|
+
margin-right: $spacing-tagInput_drag_handler-marginRight;
|
|
23
|
+
cursor: move;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
&-hover {
|
|
15
28
|
background-color: $color-tagInput_default-bg-hover;
|
|
16
29
|
border: $width-tagInput-border-hover $color-tagInput-border-hover solid;
|
|
@@ -104,6 +117,10 @@ $module: #{$prefix}-tagInput;
|
|
|
104
117
|
margin-bottom: $spacing-tagInput_large-Y;
|
|
105
118
|
}
|
|
106
119
|
}
|
|
120
|
+
|
|
121
|
+
&-icon {
|
|
122
|
+
padding-left: $spacing-tagInput_tag_icon_paddingLeft;
|
|
123
|
+
}
|
|
107
124
|
}
|
|
108
125
|
|
|
109
126
|
&-typo {
|
|
@@ -32,6 +32,8 @@ $spacing-tagInput_small-Y: 1px; // 小尺寸标签输入框标签顶部外边距
|
|
|
32
32
|
$spacing-tagInput_default-Y: $spacing-super-tight; // 默认尺寸标签输入框标签顶部外边距
|
|
33
33
|
$spacing-tagInput_large-Y: 3px; // 大尺寸标签输入框标签顶部外边距
|
|
34
34
|
$spacing-tagInput_wrapper_n_paddingX: $spacing-tight; //标签输入框标签容器水平内边距
|
|
35
|
+
$spacing-tagInput_drag_handler-marginRight: 4px; // 拖拽handler icon的右外边距
|
|
36
|
+
$spacing-tagInput_tag_icon_paddingLeft: 4px; // tag中有handler icon时tag的左内边距
|
|
35
37
|
|
|
36
38
|
$height-tagInput-large: $height-control-large; // 大尺寸标签输入框高度
|
|
37
39
|
$height-tagInput-default: $height-control-default; // 默认尺寸标签输入框高度
|
|
@@ -384,11 +384,17 @@ class Tooltip extends _foundation.default {
|
|
|
384
384
|
|
|
385
385
|
|
|
386
386
|
triggerEventSet[eventNames.focus] = () => {
|
|
387
|
-
|
|
387
|
+
const {
|
|
388
|
+
disableFocusListener
|
|
389
|
+
} = this.getProps();
|
|
390
|
+
!disableFocusListener && this.delayShow();
|
|
388
391
|
};
|
|
389
392
|
|
|
390
393
|
triggerEventSet[eventNames.blur] = () => {
|
|
391
|
-
|
|
394
|
+
const {
|
|
395
|
+
disableFocusListener
|
|
396
|
+
} = this.getProps();
|
|
397
|
+
!disableFocusListener && this.delayHide();
|
|
392
398
|
};
|
|
393
399
|
|
|
394
400
|
portalEventSet = (0, _assign.default)({}, triggerEventSet);
|
|
@@ -943,7 +949,8 @@ class Tooltip extends _foundation.default {
|
|
|
943
949
|
|
|
944
950
|
_handleTriggerKeydown(event) {
|
|
945
951
|
const {
|
|
946
|
-
closeOnEsc
|
|
952
|
+
closeOnEsc,
|
|
953
|
+
disableArrowKeyDown
|
|
947
954
|
} = this.getProps();
|
|
948
955
|
|
|
949
956
|
const container = this._adapter.getContainer();
|
|
@@ -959,11 +966,12 @@ class Tooltip extends _foundation.default {
|
|
|
959
966
|
break;
|
|
960
967
|
|
|
961
968
|
case "ArrowUp":
|
|
962
|
-
|
|
969
|
+
// when disableArrowKeyDown is true, disable tooltip's arrow keyboard event action
|
|
970
|
+
!disableArrowKeyDown && focusableNum && this._handleTriggerArrowUpKeydown(focusableElements, event);
|
|
963
971
|
break;
|
|
964
972
|
|
|
965
973
|
case "ArrowDown":
|
|
966
|
-
focusableNum && this._handleTriggerArrowDownKeydown(focusableElements, event);
|
|
974
|
+
!disableArrowKeyDown && focusableNum && this._handleTriggerArrowDownKeydown(focusableElements, event);
|
|
967
975
|
break;
|
|
968
976
|
|
|
969
977
|
default:
|
|
@@ -47,5 +47,4 @@ export default class TransferFoundation<P = Record<string, any>, S = Record<stri
|
|
|
47
47
|
};
|
|
48
48
|
_notifyChange(selectedItems: DataItemMap): void;
|
|
49
49
|
handleSortEnd(callbackProps: OnSortEndProps): void;
|
|
50
|
-
_arrayMove(array: Array<BasicDataItem>, from: number, to: number): BasicDataItem[];
|
|
51
50
|
}
|