@douyinfe/semi-foundation 2.5.1 → 2.7.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/button/button.scss +11 -0
- package/button/variables.scss +4 -0
- package/cascader/foundation.ts +19 -0
- package/datePicker/_utils/formatter.ts +2 -2
- package/datePicker/_utils/getInsetInputFormatToken.ts +42 -0
- package/datePicker/_utils/getInsetInputValueFromInsetInputStr.ts +60 -0
- package/datePicker/constants.ts +2 -0
- package/datePicker/datePicker.scss +136 -3
- package/datePicker/foundation.ts +96 -19
- package/datePicker/inputFoundation.ts +133 -5
- package/datePicker/monthFoundation.ts +1 -0
- package/datePicker/monthsGridFoundation.ts +4 -0
- package/datePicker/rtl.scss +8 -0
- package/datePicker/variables.scss +30 -0
- package/lib/cjs/button/button.css +9 -0
- package/lib/cjs/button/button.scss +11 -0
- package/lib/cjs/button/variables.scss +4 -0
- package/lib/cjs/cascader/foundation.d.ts +19 -0
- package/lib/cjs/cascader/foundation.js +22 -0
- package/lib/cjs/datePicker/_utils/formatter.d.ts +2 -2
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.d.ts +20 -0
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +61 -0
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.d.ts +31 -0
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +76 -0
- package/lib/cjs/datePicker/constants.d.ts +2 -0
- package/lib/cjs/datePicker/constants.js +4 -3
- package/lib/cjs/datePicker/datePicker.css +104 -2
- package/lib/cjs/datePicker/datePicker.scss +136 -3
- package/lib/cjs/datePicker/foundation.d.ts +34 -11
- package/lib/cjs/datePicker/foundation.js +122 -9
- package/lib/cjs/datePicker/inputFoundation.d.ts +73 -4
- package/lib/cjs/datePicker/inputFoundation.js +196 -3
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGridFoundation.js +4 -2
- package/lib/cjs/datePicker/rtl.scss +8 -0
- package/lib/cjs/datePicker/variables.scss +30 -0
- package/lib/cjs/table/table.css +1 -1
- package/lib/cjs/table/table.scss +1 -1
- package/lib/cjs/table/variables.scss +1 -0
- package/lib/cjs/tag/tag.css +1 -0
- package/lib/cjs/tag/tag.scss +1 -0
- package/lib/cjs/tooltip/foundation.js +8 -8
- package/lib/cjs/treeSelect/foundation.d.ts +3 -2
- package/lib/cjs/treeSelect/foundation.js +28 -15
- package/lib/es/button/button.css +9 -0
- package/lib/es/button/button.scss +11 -0
- package/lib/es/button/variables.scss +4 -0
- package/lib/es/cascader/foundation.d.ts +19 -0
- package/lib/es/cascader/foundation.js +22 -1
- package/lib/es/datePicker/_utils/formatter.d.ts +2 -2
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.d.ts +20 -0
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +48 -0
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.d.ts +31 -0
- package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +66 -0
- package/lib/es/datePicker/constants.d.ts +2 -0
- package/lib/es/datePicker/constants.js +4 -3
- package/lib/es/datePicker/datePicker.css +104 -2
- package/lib/es/datePicker/datePicker.scss +136 -3
- package/lib/es/datePicker/foundation.d.ts +34 -11
- package/lib/es/datePicker/foundation.js +120 -9
- package/lib/es/datePicker/inputFoundation.d.ts +73 -4
- package/lib/es/datePicker/inputFoundation.js +192 -4
- package/lib/es/datePicker/monthFoundation.d.ts +1 -0
- package/lib/es/datePicker/monthsGridFoundation.d.ts +1 -0
- package/lib/es/datePicker/monthsGridFoundation.js +4 -2
- package/lib/es/datePicker/rtl.scss +8 -0
- package/lib/es/datePicker/variables.scss +30 -0
- package/lib/es/table/table.css +1 -1
- package/lib/es/table/table.scss +1 -1
- package/lib/es/table/variables.scss +1 -0
- package/lib/es/tag/tag.css +1 -0
- package/lib/es/tag/tag.scss +1 -0
- package/lib/es/tooltip/foundation.js +8 -8
- package/lib/es/treeSelect/foundation.d.ts +3 -2
- package/lib/es/treeSelect/foundation.js +27 -15
- package/package.json +3 -3
- package/table/table.scss +1 -1
- package/table/variables.scss +1 -0
- package/tag/tag.scss +1 -0
- package/tooltip/foundation.ts +8 -8
- package/treeSelect/foundation.ts +26 -19
|
@@ -12,13 +12,24 @@ exports.default = void 0;
|
|
|
12
12
|
|
|
13
13
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
14
|
|
|
15
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
16
|
+
|
|
17
|
+
var _set2 = _interopRequireDefault(require("lodash/set"));
|
|
18
|
+
|
|
19
|
+
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
20
|
+
|
|
21
|
+
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
22
|
+
|
|
15
23
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
16
24
|
|
|
17
25
|
var _formatter = require("./_utils/formatter");
|
|
18
26
|
|
|
19
27
|
var _getDefaultFormatToken = require("./_utils/getDefaultFormatToken");
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
var _getInsetInputFormatToken = _interopRequireDefault(require("./_utils/getInsetInputFormatToken"));
|
|
30
|
+
|
|
31
|
+
var _getInsetInputValueFromInsetInputStr = _interopRequireDefault(require("./_utils/getInsetInputValueFromInsetInputStr"));
|
|
32
|
+
|
|
22
33
|
const KEY_CODE_ENTER = 'Enter';
|
|
23
34
|
const KEY_CODE_TAB = 'Tab';
|
|
24
35
|
|
|
@@ -78,7 +89,7 @@ class InputFoundation extends _foundation.default {
|
|
|
78
89
|
this._adapter.notifyRangeInputFocus(e, rangeType);
|
|
79
90
|
}
|
|
80
91
|
|
|
81
|
-
formatShowText(value) {
|
|
92
|
+
formatShowText(value, customFormat) {
|
|
82
93
|
const {
|
|
83
94
|
type,
|
|
84
95
|
dateFnsLocale,
|
|
@@ -86,7 +97,7 @@ class InputFoundation extends _foundation.default {
|
|
|
86
97
|
rangeSeparator
|
|
87
98
|
} = this._adapter.getProps();
|
|
88
99
|
|
|
89
|
-
const formatToken = format || (0, _getDefaultFormatToken.getDefaultFormatTokenByType)(type);
|
|
100
|
+
const formatToken = customFormat || format || (0, _getDefaultFormatToken.getDefaultFormatTokenByType)(type);
|
|
90
101
|
let text = '';
|
|
91
102
|
|
|
92
103
|
switch (type) {
|
|
@@ -123,6 +134,188 @@ class InputFoundation extends _foundation.default {
|
|
|
123
134
|
return text;
|
|
124
135
|
}
|
|
125
136
|
|
|
137
|
+
handleInsetInputChange(options) {
|
|
138
|
+
const {
|
|
139
|
+
value,
|
|
140
|
+
valuePath,
|
|
141
|
+
insetInputValue
|
|
142
|
+
} = options;
|
|
143
|
+
|
|
144
|
+
const {
|
|
145
|
+
format,
|
|
146
|
+
type
|
|
147
|
+
} = this._adapter.getProps();
|
|
148
|
+
|
|
149
|
+
const insetFormatToken = (0, _getInsetInputFormatToken.default)({
|
|
150
|
+
type,
|
|
151
|
+
format
|
|
152
|
+
});
|
|
153
|
+
const newInsetInputValue = (0, _set2.default)((0, _cloneDeep2.default)(insetInputValue), valuePath, value);
|
|
154
|
+
const newInputValue = this.concatInsetInputValue({
|
|
155
|
+
insetInputValue: newInsetInputValue
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
this._adapter.notifyInsetInputChange({
|
|
159
|
+
insetInputValue: newInsetInputValue,
|
|
160
|
+
format: insetFormatToken,
|
|
161
|
+
insetInputStr: newInputValue
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* 只有传入的 format 符合 formatReg 时,才会使用用户传入的 format
|
|
166
|
+
* 否则会使用默认的 format 作为 placeholder
|
|
167
|
+
*
|
|
168
|
+
* The format passed in by the user will be used only if the incoming format conforms to formatReg
|
|
169
|
+
* Otherwise the default format will be used as placeholder
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
getInsetInputPlaceholder() {
|
|
174
|
+
const {
|
|
175
|
+
type,
|
|
176
|
+
format
|
|
177
|
+
} = this._adapter.getProps();
|
|
178
|
+
|
|
179
|
+
const insetInputFormat = (0, _getInsetInputFormatToken.default)({
|
|
180
|
+
type,
|
|
181
|
+
format
|
|
182
|
+
});
|
|
183
|
+
let datePlaceholder, timePlaceholder;
|
|
184
|
+
|
|
185
|
+
switch (type) {
|
|
186
|
+
case 'date':
|
|
187
|
+
case 'month':
|
|
188
|
+
case 'dateRange':
|
|
189
|
+
datePlaceholder = insetInputFormat;
|
|
190
|
+
break;
|
|
191
|
+
|
|
192
|
+
case 'dateTime':
|
|
193
|
+
case 'dateTimeRange':
|
|
194
|
+
[datePlaceholder, timePlaceholder] = insetInputFormat.split(' ');
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
datePlaceholder,
|
|
200
|
+
timePlaceholder
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 从当前日期值或 inputValue 中解析出 insetInputValue
|
|
205
|
+
*
|
|
206
|
+
* Parse out insetInputValue from current date value or inputValue
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
getInsetInputValue(_ref) {
|
|
211
|
+
let {
|
|
212
|
+
value,
|
|
213
|
+
insetInputValue
|
|
214
|
+
} = _ref;
|
|
215
|
+
|
|
216
|
+
const {
|
|
217
|
+
type,
|
|
218
|
+
rangeSeparator,
|
|
219
|
+
format
|
|
220
|
+
} = this._adapter.getProps();
|
|
221
|
+
|
|
222
|
+
let inputValueStr = '';
|
|
223
|
+
|
|
224
|
+
if ((0, _isObject2.default)(insetInputValue)) {
|
|
225
|
+
inputValueStr = this.concatInsetInputValue({
|
|
226
|
+
insetInputValue
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
const insetInputFormat = (0, _getInsetInputFormatToken.default)({
|
|
230
|
+
format,
|
|
231
|
+
type
|
|
232
|
+
});
|
|
233
|
+
inputValueStr = this.formatShowText(value, insetInputFormat);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const newInsetInputValue = (0, _getInsetInputValueFromInsetInputStr.default)({
|
|
237
|
+
inputValue: inputValueStr,
|
|
238
|
+
type,
|
|
239
|
+
rangeSeparator
|
|
240
|
+
});
|
|
241
|
+
return newInsetInputValue;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
concatInsetDateAndTime(_ref2) {
|
|
245
|
+
var _context;
|
|
246
|
+
|
|
247
|
+
let {
|
|
248
|
+
date,
|
|
249
|
+
time
|
|
250
|
+
} = _ref2;
|
|
251
|
+
return (0, _concat.default)(_context = "".concat(date, " ")).call(_context, time);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
concatInsetDateRange(_ref3) {
|
|
255
|
+
var _context2, _context3;
|
|
256
|
+
|
|
257
|
+
let {
|
|
258
|
+
rangeStart,
|
|
259
|
+
rangeEnd
|
|
260
|
+
} = _ref3;
|
|
261
|
+
|
|
262
|
+
const {
|
|
263
|
+
rangeSeparator
|
|
264
|
+
} = this._adapter.getProps();
|
|
265
|
+
|
|
266
|
+
return (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = "".concat(rangeStart)).call(_context3, rangeSeparator)).call(_context2, rangeEnd);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
concatInsetInputValue(_ref4) {
|
|
270
|
+
let {
|
|
271
|
+
insetInputValue
|
|
272
|
+
} = _ref4;
|
|
273
|
+
|
|
274
|
+
const {
|
|
275
|
+
type
|
|
276
|
+
} = this._adapter.getProps();
|
|
277
|
+
|
|
278
|
+
let inputValue = '';
|
|
279
|
+
|
|
280
|
+
switch (type) {
|
|
281
|
+
case 'date':
|
|
282
|
+
case 'month':
|
|
283
|
+
inputValue = insetInputValue.monthLeft.dateInput;
|
|
284
|
+
break;
|
|
285
|
+
|
|
286
|
+
case 'dateRange':
|
|
287
|
+
inputValue = this.concatInsetDateRange({
|
|
288
|
+
rangeStart: insetInputValue.monthLeft.dateInput,
|
|
289
|
+
rangeEnd: insetInputValue.monthRight.dateInput
|
|
290
|
+
});
|
|
291
|
+
break;
|
|
292
|
+
|
|
293
|
+
case 'dateTime':
|
|
294
|
+
inputValue = this.concatInsetDateAndTime({
|
|
295
|
+
date: insetInputValue.monthLeft.dateInput,
|
|
296
|
+
time: insetInputValue.monthLeft.timeInput
|
|
297
|
+
});
|
|
298
|
+
break;
|
|
299
|
+
|
|
300
|
+
case 'dateTimeRange':
|
|
301
|
+
const rangeStart = this.concatInsetDateAndTime({
|
|
302
|
+
date: insetInputValue.monthLeft.dateInput,
|
|
303
|
+
time: insetInputValue.monthLeft.timeInput
|
|
304
|
+
});
|
|
305
|
+
const rangeEnd = this.concatInsetDateAndTime({
|
|
306
|
+
date: insetInputValue.monthRight.dateInput,
|
|
307
|
+
time: insetInputValue.monthRight.timeInput
|
|
308
|
+
});
|
|
309
|
+
inputValue = this.concatInsetDateRange({
|
|
310
|
+
rangeStart,
|
|
311
|
+
rangeEnd
|
|
312
|
+
});
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return inputValue;
|
|
317
|
+
}
|
|
318
|
+
|
|
126
319
|
}
|
|
127
320
|
|
|
128
321
|
exports.default = InputFoundation;
|
|
@@ -54,6 +54,7 @@ export interface MonthsGridFoundationProps extends MonthsGridElementProps {
|
|
|
54
54
|
isAnotherPanelHasOpened?: (currentRangeInput: 'rangeStart' | 'rangeEnd') => boolean;
|
|
55
55
|
focusRecordsRef?: any;
|
|
56
56
|
triggerRender?: (props: Record<string, any>) => any;
|
|
57
|
+
insetInput: boolean;
|
|
57
58
|
}
|
|
58
59
|
export interface MonthInfo {
|
|
59
60
|
pickerDate: Date;
|
|
@@ -180,7 +180,7 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
180
180
|
_initDatePickerFromValue(values) {
|
|
181
181
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
182
182
|
const monthLeft = this.getState('monthLeft');
|
|
183
|
-
const newMonthLeft = (0, _assign.default)({}, monthLeft);
|
|
183
|
+
const newMonthLeft = (0, _assign.default)({}, monthLeft); // REMOVE:
|
|
184
184
|
|
|
185
185
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
186
186
|
|
|
@@ -197,6 +197,7 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
197
197
|
if (refreshPicker) {
|
|
198
198
|
this.handleShowDateAndTime(_constants.strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
199
199
|
} else {
|
|
200
|
+
// FIXME:
|
|
200
201
|
this.handleShowDateAndTime(_constants.strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
201
202
|
}
|
|
202
203
|
|
|
@@ -598,7 +599,8 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
598
599
|
selected: selectedSet,
|
|
599
600
|
rangeStart,
|
|
600
601
|
rangeEnd
|
|
601
|
-
} = this.getStates();
|
|
602
|
+
} = this.getStates(); // FIXME:
|
|
603
|
+
|
|
602
604
|
const includeRange = (0, _includes2.default)(_context3 = ['dateRange', 'dateTimeRange']).call(_context3, type);
|
|
603
605
|
const options = {
|
|
604
606
|
closePanel: false
|
|
@@ -181,5 +181,13 @@ $module: #{$prefix}-datepicker;
|
|
|
181
181
|
padding-left: $spacing-datepicker_footer_compact-paddintRight;
|
|
182
182
|
padding-right: auto;
|
|
183
183
|
}
|
|
184
|
+
|
|
185
|
+
.#{$module}-inset-input {
|
|
186
|
+
&-separator {
|
|
187
|
+
border-right: $width-datepicker-border solid $color-datepicker_border-bg-default;
|
|
188
|
+
border-left: 0;
|
|
189
|
+
transform: translateX(-50%);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
184
192
|
}
|
|
185
193
|
}
|
|
@@ -23,6 +23,14 @@ $width-datepicker_quick_control-borderRadius: var(--semi-border-radius-medium);
|
|
|
23
23
|
$width-datepicker_slot-border: 1px; // 日期星期分割线宽度
|
|
24
24
|
$width-datepicker_range_input-border: $border-thickness-control-focus;
|
|
25
25
|
$width-datepicker_day_main-border: 1px;
|
|
26
|
+
$height-datepicker_timeType_insetInput_yam: 100%; // 时间面板高度 - 内嵌输入框
|
|
27
|
+
$height-datepicker_timeType_insetInput_tpk: 100%; // 时间面板高度 - 内嵌输入框
|
|
28
|
+
$width-datepicker_insetInput_date_type_wrapper: 284px; // 日期类型内嵌输入框宽度
|
|
29
|
+
$width-datepicker_insetInput_date_range_type_wrapper: $width-datepicker_insetInput_date_type_wrapper * 2; // 范围选择内嵌输入框宽度
|
|
30
|
+
$width-datepicker_insetInput_month_type_wrapper: 204px; // 月份类型内嵌输入框宽度
|
|
31
|
+
$height-datepicker_insetInput_separator: 32px;
|
|
32
|
+
$height-datepicker_month_grid_yearType_insetInput: 312px;
|
|
33
|
+
$height-datepicker_month_grid_timeType_insetInput: 314px;
|
|
26
34
|
|
|
27
35
|
// Spacing
|
|
28
36
|
$spacing-datepicker_day-marginX: ($width-datepicker_day - $width-datepicker_day_main) / 2; // 日期格子水平外边距
|
|
@@ -53,6 +61,14 @@ $spacing-datepicker_range_input_suffix-paddingLeft: 8px;
|
|
|
53
61
|
$spacing-datepicker_range_input_suffix-paddingRight: 12px;
|
|
54
62
|
$spacing-datepicker_range_input_clearbtn-paddingLeft: 8px;
|
|
55
63
|
$spacing-datepicker_range_input_clearbtn-paddingRight: 12px;
|
|
64
|
+
$spacing-datepicker_navigation_insetInput-paddingY: 8px; // 年月切换 header 垂直内边距 - 内嵌输入框
|
|
65
|
+
$spacing-datepicker_insetInput_wrapper-margin: 8px;
|
|
66
|
+
$spacing-datepicker_insetInput_wrapper-paddingY: 12px;
|
|
67
|
+
$spacing-datepicker_insetInput_wrapper-paddingX: 16px;
|
|
68
|
+
$spacing-datepicker_insetInput_wrapper-paddingBottom: 0;
|
|
69
|
+
$spacing-datepicker_insetInput_separator-paddingY: 0;
|
|
70
|
+
$spacing-datepicker_insetInput_separator-paddingX: 4px;
|
|
71
|
+
|
|
56
72
|
|
|
57
73
|
// Color
|
|
58
74
|
$color-datepicker_panel-bg-default: var(--semi-color-bg-3); // 日期选择器背景颜色
|
|
@@ -118,6 +134,7 @@ $color-datepicker_range_input_inputWrapper-bg-default: transparent;
|
|
|
118
134
|
$color-datepicker_range_input_inputWrapper-bg-focus: var(--semi-color-fill-1);
|
|
119
135
|
$color-datepicker_range_input_separator-text-active: var(--semi-color-text-0);
|
|
120
136
|
$color-datepicker_day_main-border: var(--semi-color-primary-active);
|
|
137
|
+
$color-datepicker_insetInput_separator: var(--semi-color-text-3);
|
|
121
138
|
|
|
122
139
|
// Font
|
|
123
140
|
$font-datepicker_range_input_prefix_suffix_clearbtn-fontWeight: 600;
|
|
@@ -144,9 +161,17 @@ $radius-datepicker_range_input_inputWrapper: var(--semi-border-radius-small);
|
|
|
144
161
|
$height-datepicker_range_input-default: 32px;
|
|
145
162
|
$height-datepicker_range_input-small: 24px;
|
|
146
163
|
$height-datepicker_range_input-large: 40px;
|
|
164
|
+
$width-datepicker_insetInput_date_type_wrapper_compact: 216px;
|
|
165
|
+
$width-datepicker_insetInput_date_range_type_wrapper_compact: $width-datepicker_insetInput_date_type_wrapper_compact * 2;
|
|
166
|
+
$width-datepicker_insetInput_month_type_wrapper_compact: 195px;
|
|
167
|
+
$height-datepicker_insetInput_tpk_compact: 100%;
|
|
168
|
+
$height-datepicker_timeType_insetInput_yam_compact: 100%;
|
|
169
|
+
$height-datepicker_insetInput_wrapper_compact: 28px;
|
|
147
170
|
|
|
148
171
|
$lineHeight-datepicker_compact: 20px;
|
|
149
172
|
$lineHeight-datepicker_weekday_item_compact: 28px;
|
|
173
|
+
$height-datepicker_insetInput_compact: 26px;
|
|
174
|
+
$fontSize-datepicker_insetInput_compact-fontSize: 12px;
|
|
150
175
|
|
|
151
176
|
$spacing-datepicker_switch_compact-padding: 6px;
|
|
152
177
|
$spacing-datepicker_day_compact-margin: ($width-datepicker_day_compact - $width-datepicker_day_main_compact) / 2;
|
|
@@ -163,6 +188,11 @@ $spacing-datepicker_footer_compact-paddintBottom: 10px;
|
|
|
163
188
|
$spacing-datepicker_footer_compact-paddintRight: 8px;
|
|
164
189
|
$spacing-datepicker_scrolllist_shade_pre_compact-marginTop: -17px;
|
|
165
190
|
$spacing-datepicker_scrolllist_shade_post_compact-marginTop: 17px;
|
|
191
|
+
$spacing-datepicker_insetInput_wrapper_compact-margin: 4px;
|
|
192
|
+
$spacing-datepicker_insetInput_wrapper_compact-paddingY: 8px;
|
|
193
|
+
$spacing-datepicker_insetInput_wrapper_compact-paddingX: 8px;
|
|
194
|
+
$spacing-datepicker_insetInput_wrapper_compact-paddingBottom: 0;
|
|
195
|
+
$spacing-datepicker_insetInput_wrapper_rangeType_compact-paddingTop: 0;
|
|
166
196
|
|
|
167
197
|
// Radius
|
|
168
198
|
$radius-datepicker_range_input: var(--semi-border-radius-small);
|
package/lib/cjs/table/table.css
CHANGED
package/lib/cjs/table/table.scss
CHANGED
|
@@ -466,7 +466,7 @@ $module: #{$prefix}-table;
|
|
|
466
466
|
position: relative;
|
|
467
467
|
z-index: 1;
|
|
468
468
|
padding: #{$spacing-table-paddingY} #{$spacing-table-paddingX};
|
|
469
|
-
color: $color-
|
|
469
|
+
color: $color-table_placeholder-text-default;
|
|
470
470
|
font-size: #{$font-table_base-fontSize};
|
|
471
471
|
text-align: center;
|
|
472
472
|
background: $color-table_pl-bg-default;
|
|
@@ -73,6 +73,7 @@ $color-table_sorter-text-hover: var(--semi-color-text-2); // 表格排序按钮
|
|
|
73
73
|
$color-table_page-text-default: var(--semi-color-text-2); // 表格翻页器文本颜色
|
|
74
74
|
$color-table_resizer-bg-default: var(--semi-color-primary); // 表格拉伸标示线颜色
|
|
75
75
|
$color-table_selection-bg-default: rgba(var(--semi-grey-0), 1); // 表格分组背景色
|
|
76
|
+
$color-table_placeholder-text-default: var(--semi-color-text-2); // 表格空数据文本颜色
|
|
76
77
|
|
|
77
78
|
// Other
|
|
78
79
|
$font-table_base-fontSize: 14px; // 表格默认文本字号
|
package/lib/cjs/tag/tag.css
CHANGED
package/lib/cjs/tag/tag.scss
CHANGED
|
@@ -538,25 +538,25 @@ class Tooltip extends _foundation.default {
|
|
|
538
538
|
break;
|
|
539
539
|
|
|
540
540
|
case 'leftTopOver':
|
|
541
|
-
left = triggerRect.left;
|
|
542
|
-
top = triggerRect.top;
|
|
541
|
+
left = triggerRect.left - SPACING;
|
|
542
|
+
top = triggerRect.top - SPACING;
|
|
543
543
|
break;
|
|
544
544
|
|
|
545
545
|
case 'rightTopOver':
|
|
546
|
-
left = triggerRect.right;
|
|
547
|
-
top = triggerRect.top;
|
|
546
|
+
left = triggerRect.right + SPACING;
|
|
547
|
+
top = triggerRect.top - SPACING;
|
|
548
548
|
translateX = -1;
|
|
549
549
|
break;
|
|
550
550
|
|
|
551
551
|
case 'leftBottomOver':
|
|
552
|
-
left = triggerRect.left;
|
|
553
|
-
top = triggerRect.bottom;
|
|
552
|
+
left = triggerRect.left - SPACING;
|
|
553
|
+
top = triggerRect.bottom + SPACING;
|
|
554
554
|
translateY = -1;
|
|
555
555
|
break;
|
|
556
556
|
|
|
557
557
|
case 'rightBottomOver':
|
|
558
|
-
left = triggerRect.right;
|
|
559
|
-
top = triggerRect.bottom;
|
|
558
|
+
left = triggerRect.right + SPACING;
|
|
559
|
+
top = triggerRect.bottom + SPACING;
|
|
560
560
|
translateX = -1;
|
|
561
561
|
translateY = -1;
|
|
562
562
|
break;
|
|
@@ -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' | '
|
|
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' | 'expandAll' | 'disableStrictly' | 'aria-label' | 'checkRelation'> {
|
|
31
31
|
motion?: Motion;
|
|
32
32
|
mouseEnterDelay?: number;
|
|
33
33
|
mouseLeaveDelay?: number;
|
|
@@ -63,6 +63,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
|
|
|
63
63
|
renderSelectedItem?: BasicRenderSelectedItem;
|
|
64
64
|
getPopupContainer?: () => HTMLElement;
|
|
65
65
|
onBlur?: (e: any) => void;
|
|
66
|
+
onSearch?: (sunInput: string, filteredExpandedKeys: string[]) => void;
|
|
66
67
|
onChange?: BasicOnChange;
|
|
67
68
|
onFocus?: (e: any) => void;
|
|
68
69
|
onVisibleChange?: (isVisible: boolean) => void;
|
|
@@ -84,7 +85,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
84
85
|
rePositionDropdown: () => void;
|
|
85
86
|
updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
|
|
86
87
|
notifySelect: (selectedKeys: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
|
|
87
|
-
notifySearch: (input: string) => void;
|
|
88
|
+
notifySearch: (input: string, filteredExpandedKeys: string[]) => void;
|
|
88
89
|
cacheFlattenNodes: (bool: boolean) => void;
|
|
89
90
|
openMenu: () => void;
|
|
90
91
|
closeMenu: (cb?: () => void) => void;
|
|
@@ -28,6 +28,8 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
28
28
|
|
|
29
29
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
30
30
|
|
|
31
|
+
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
32
|
+
|
|
31
33
|
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
32
34
|
|
|
33
35
|
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
@@ -193,7 +195,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
193
195
|
const isSearching = Boolean(inputValue);
|
|
194
196
|
const treeNodeProps = {
|
|
195
197
|
eventKey: key,
|
|
196
|
-
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
198
|
+
expanded: isSearching && !this._isExpandControlled() ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
197
199
|
selected: (0, _includes.default)(selectedKeys).call(selectedKeys, key),
|
|
198
200
|
checked: realChecked,
|
|
199
201
|
halfChecked: realHalfChecked,
|
|
@@ -480,18 +482,23 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
480
482
|
|
|
481
483
|
clearInput() {
|
|
482
484
|
const {
|
|
485
|
+
flattenNodes,
|
|
483
486
|
expandedKeys,
|
|
484
487
|
selectedKeys,
|
|
485
488
|
keyEntities,
|
|
486
489
|
treeData
|
|
487
490
|
} = this.getStates();
|
|
491
|
+
const newExpandedKeys = new _set.default(expandedKeys);
|
|
492
|
+
|
|
493
|
+
const isExpandControlled = this._isExpandControlled();
|
|
494
|
+
|
|
488
495
|
const expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(selectedKeys, keyEntities);
|
|
489
|
-
(0, _forEach.default)(expandedOptsKeys).call(expandedOptsKeys, item =>
|
|
490
|
-
const
|
|
496
|
+
(0, _forEach.default)(expandedOptsKeys).call(expandedOptsKeys, item => newExpandedKeys.add(item));
|
|
497
|
+
const newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, newExpandedKeys);
|
|
491
498
|
|
|
492
499
|
this._adapter.updateState({
|
|
493
|
-
expandedKeys,
|
|
494
|
-
flattenNodes,
|
|
500
|
+
expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
|
|
501
|
+
flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
|
|
495
502
|
inputValue: '',
|
|
496
503
|
motionKeys: new _set.default([]),
|
|
497
504
|
filteredKeys: new _set.default([]),
|
|
@@ -505,6 +512,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
505
512
|
this._adapter.updateInputValue(sugInput);
|
|
506
513
|
|
|
507
514
|
const {
|
|
515
|
+
flattenNodes,
|
|
508
516
|
expandedKeys,
|
|
509
517
|
selectedKeys,
|
|
510
518
|
keyEntities,
|
|
@@ -515,15 +523,16 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
515
523
|
filterTreeNode,
|
|
516
524
|
treeNodeFilterProp
|
|
517
525
|
} = this.getProps();
|
|
526
|
+
const newExpandedKeys = new _set.default(expandedKeys);
|
|
518
527
|
let filteredOptsKeys = [];
|
|
519
528
|
let expandedOptsKeys = [];
|
|
520
|
-
let
|
|
529
|
+
let newFlattenNodes = [];
|
|
521
530
|
let filteredShownKeys = new _set.default([]);
|
|
522
531
|
|
|
523
532
|
if (!sugInput) {
|
|
524
533
|
expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(selectedKeys, keyEntities);
|
|
525
|
-
(0, _forEach.default)(expandedOptsKeys).call(expandedOptsKeys, item =>
|
|
526
|
-
|
|
534
|
+
(0, _forEach.default)(expandedOptsKeys).call(expandedOptsKeys, item => newExpandedKeys.add(item));
|
|
535
|
+
newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, newExpandedKeys);
|
|
527
536
|
} else {
|
|
528
537
|
var _context3, _context4;
|
|
529
538
|
|
|
@@ -536,17 +545,19 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
536
545
|
expandedOptsKeys = (0, _treeUtil.findAncestorKeys)(filteredOptsKeys, keyEntities, false);
|
|
537
546
|
const shownChildKeys = (0, _treeUtil.findDescendantKeys)(filteredOptsKeys, keyEntities, true);
|
|
538
547
|
filteredShownKeys = new _set.default([...shownChildKeys, ...expandedOptsKeys]);
|
|
539
|
-
|
|
548
|
+
newFlattenNodes = (0, _treeUtil.flattenTreeData)(treeData, new _set.default(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
540
549
|
}
|
|
541
550
|
|
|
542
|
-
|
|
551
|
+
const newFilteredExpandedKeys = new _set.default(expandedOptsKeys);
|
|
552
|
+
|
|
553
|
+
this._adapter.notifySearch(sugInput, (0, _from.default)(newFilteredExpandedKeys));
|
|
543
554
|
|
|
544
555
|
this._adapter.updateState({
|
|
545
|
-
expandedKeys,
|
|
546
|
-
flattenNodes,
|
|
556
|
+
expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
|
|
557
|
+
flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
|
|
547
558
|
motionKeys: new _set.default([]),
|
|
548
559
|
filteredKeys: new _set.default(filteredOptsKeys),
|
|
549
|
-
filteredExpandedKeys:
|
|
560
|
+
filteredExpandedKeys: newFilteredExpandedKeys,
|
|
550
561
|
filteredShownKeys
|
|
551
562
|
});
|
|
552
563
|
}
|
|
@@ -785,7 +796,9 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
785
796
|
return;
|
|
786
797
|
}
|
|
787
798
|
|
|
788
|
-
|
|
799
|
+
const isExpandControlled = this._isExpandControlled();
|
|
800
|
+
|
|
801
|
+
if (isSearching && !isExpandControlled) {
|
|
789
802
|
this.handleNodeExpandInSearch(e, treeNode);
|
|
790
803
|
return;
|
|
791
804
|
}
|
|
@@ -813,7 +826,7 @@ class TreeSelectFoundation extends _foundation.default {
|
|
|
813
826
|
|
|
814
827
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
815
828
|
|
|
816
|
-
if (!
|
|
829
|
+
if (!isExpandControlled) {
|
|
817
830
|
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData, expandedKeys);
|
|
818
831
|
const motionKeys = this._isAnimated() ? (0, _treeUtil.getMotionKeys)(eventKey, expandedKeys, keyEntities) : [];
|
|
819
832
|
const newState = {
|
package/lib/es/button/button.css
CHANGED
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
vertical-align: middle;
|
|
45
45
|
white-space: nowrap;
|
|
46
46
|
}
|
|
47
|
+
.semi-button:focus {
|
|
48
|
+
outline: 2px solid var(--semi-color-primary-light-active);
|
|
49
|
+
}
|
|
47
50
|
.semi-button-danger {
|
|
48
51
|
background-color: var(--semi-color-danger);
|
|
49
52
|
color: white;
|
|
@@ -57,6 +60,9 @@
|
|
|
57
60
|
.semi-button-danger.semi-button-light, .semi-button-danger.semi-button-borderless {
|
|
58
61
|
color: var(--semi-color-danger);
|
|
59
62
|
}
|
|
63
|
+
.semi-button-danger:not(.semi-button-borderless):not(.semi-button-light):focus {
|
|
64
|
+
outline-color: var(--semi-color-danger-light-active);
|
|
65
|
+
}
|
|
60
66
|
.semi-button-warning {
|
|
61
67
|
background-color: var(--semi-color-warning);
|
|
62
68
|
color: white;
|
|
@@ -70,6 +76,9 @@
|
|
|
70
76
|
.semi-button-warning.semi-button-light, .semi-button-warning.semi-button-borderless {
|
|
71
77
|
color: var(--semi-color-warning);
|
|
72
78
|
}
|
|
79
|
+
.semi-button-warning:not(.semi-button-borderless):not(.semi-button-light):focus {
|
|
80
|
+
outline-color: var(--semi-color-warning-light-active);
|
|
81
|
+
}
|
|
73
82
|
.semi-button-tertiary {
|
|
74
83
|
background-color: var(--semi-color-tertiary);
|
|
75
84
|
color: white;
|
|
@@ -23,6 +23,11 @@ $module: #{$prefix}-button;
|
|
|
23
23
|
outline: none;
|
|
24
24
|
vertical-align: middle;
|
|
25
25
|
white-space: nowrap;
|
|
26
|
+
|
|
27
|
+
&:focus {
|
|
28
|
+
outline: $width-button-outline solid $color-button_primary-outline-focus;
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
&-danger {
|
|
27
32
|
background-color: $color-button_danger-bg-default;
|
|
28
33
|
color: $color-button_danger-text-default;
|
|
@@ -36,6 +41,9 @@ $module: #{$prefix}-button;
|
|
|
36
41
|
&.#{$module}-borderless {
|
|
37
42
|
color: $color-button_danger-bg-default;
|
|
38
43
|
}
|
|
44
|
+
&:not(.#{$module}-borderless):not(.#{$module}-light):focus {
|
|
45
|
+
outline-color: $color-button_danger-outline-focus;
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
48
|
&-warning {
|
|
41
49
|
background-color: $color-button_warning-bg-default;
|
|
@@ -50,6 +58,9 @@ $module: #{$prefix}-button;
|
|
|
50
58
|
&.#{$module}-borderless {
|
|
51
59
|
color: $color-button_warning-bg-default;
|
|
52
60
|
}
|
|
61
|
+
&:not(.#{$module}-borderless):not(.#{$module}-light):focus {
|
|
62
|
+
outline-color: $color-button_warning-outline-focus;
|
|
63
|
+
}
|
|
53
64
|
}
|
|
54
65
|
&-tertiary {
|
|
55
66
|
background-color: $color-button_tertiary-bg-default;
|
|
@@ -10,6 +10,7 @@ $color-button_primary-text-hover: white; // 主要按钮文字颜色 - 悬浮
|
|
|
10
10
|
$color-button_primary-bg-active: var(--semi-color-primary-active); // 主要按钮背景颜色 - 按下
|
|
11
11
|
$color-button_primary-border-active: var(--semi-color-primary-active); // 主要按钮描边颜色 - 按下
|
|
12
12
|
$color-button_primary-text-active: white; // 主要按钮文字颜色 - 按下
|
|
13
|
+
$color-button_primary-outline-focus: var(--semi-color-primary-light-active); // 主要按钮轮廓 - 聚焦
|
|
13
14
|
|
|
14
15
|
// secondary
|
|
15
16
|
$color-button_secondary-bg-default: var(--semi-color-secondary); // 次要按钮背景颜色
|
|
@@ -36,6 +37,7 @@ $color-button_danger-text-hover: white; // 危险按钮文字颜色 - 悬浮
|
|
|
36
37
|
$color-button_danger-bg-active: var(--semi-color-danger-active); // 危险按钮背景颜色 - 按下
|
|
37
38
|
$color-button_danger-border-active: var(--semi-color-danger-active); // 危险按钮描边颜色 - 按下
|
|
38
39
|
$color-button_danger-text-active: white; // 危险按钮文字颜色 - 按下
|
|
40
|
+
$color-button_danger-outline-focus: var(--semi-color-danger-light-active); // 危险按钮轮廓 - 聚焦
|
|
39
41
|
|
|
40
42
|
// warning
|
|
41
43
|
$color-button_warning-bg-default: var(--semi-color-warning); // 警告按钮背景颜色
|
|
@@ -49,6 +51,7 @@ $color-button_warning-text-hover: white; // 警告按钮文字颜色 - 悬浮
|
|
|
49
51
|
$color-button_warning-bg-active: var(--semi-color-warning-active); // 警告按钮背景颜色 - 按下
|
|
50
52
|
$color-button_warning-border-active: var(--semi-color-warning-active); // 警告按钮描边颜色 - 按下
|
|
51
53
|
$color-button_warning-text-active: white; // 警告按钮文字颜色 - 按下
|
|
54
|
+
$color-button_warning-outline-focus: var(--semi-color-warning-light-active); // 警告按钮轮廓 - 聚焦
|
|
52
55
|
|
|
53
56
|
// tertiary
|
|
54
57
|
$color-button_tertiary-bg-default: var(--semi-color-tertiary); // 第三按钮背景颜色
|
|
@@ -134,3 +137,4 @@ $height-button_default: $height-control-default; // 按钮高度 - 默认
|
|
|
134
137
|
$width-button-border: $border-thickness; // 按钮描边宽度
|
|
135
138
|
$radius-button: var(--semi-border-radius-small); // 按钮圆角大小
|
|
136
139
|
$radius-button_group: $radius-button; // 按钮组圆角大小
|
|
140
|
+
$width-button-outline: 2px; // 按钮轮廓宽度
|