@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
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import _set from "lodash/set";
|
|
2
|
+
import _isObject from "lodash/isObject";
|
|
3
|
+
import _cloneDeep from "lodash/cloneDeep";
|
|
1
4
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
|
|
3
|
-
/* eslint-disable max-len */
|
|
5
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
6
|
import BaseFoundation from '../base/foundation';
|
|
5
7
|
import { formatDateValues } from './_utils/formatter';
|
|
6
8
|
import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
|
|
9
|
+
import getInsetInputFormatToken from './_utils/getInsetInputFormatToken';
|
|
10
|
+
import getInsetInputValueFromInsetInputStr from './_utils/getInsetInputValueFromInsetInputStr';
|
|
7
11
|
const KEY_CODE_ENTER = 'Enter';
|
|
8
12
|
const KEY_CODE_TAB = 'Tab';
|
|
9
13
|
export default class InputFoundation extends BaseFoundation {
|
|
@@ -62,7 +66,7 @@ export default class InputFoundation extends BaseFoundation {
|
|
|
62
66
|
this._adapter.notifyRangeInputFocus(e, rangeType);
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
formatShowText(value) {
|
|
69
|
+
formatShowText(value, customFormat) {
|
|
66
70
|
const {
|
|
67
71
|
type,
|
|
68
72
|
dateFnsLocale,
|
|
@@ -70,7 +74,7 @@ export default class InputFoundation extends BaseFoundation {
|
|
|
70
74
|
rangeSeparator
|
|
71
75
|
} = this._adapter.getProps();
|
|
72
76
|
|
|
73
|
-
const formatToken = format || getDefaultFormatTokenByType(type);
|
|
77
|
+
const formatToken = customFormat || format || getDefaultFormatTokenByType(type);
|
|
74
78
|
let text = '';
|
|
75
79
|
|
|
76
80
|
switch (type) {
|
|
@@ -107,4 +111,188 @@ export default class InputFoundation extends BaseFoundation {
|
|
|
107
111
|
return text;
|
|
108
112
|
}
|
|
109
113
|
|
|
114
|
+
handleInsetInputChange(options) {
|
|
115
|
+
const {
|
|
116
|
+
value,
|
|
117
|
+
valuePath,
|
|
118
|
+
insetInputValue
|
|
119
|
+
} = options;
|
|
120
|
+
|
|
121
|
+
const {
|
|
122
|
+
format,
|
|
123
|
+
type
|
|
124
|
+
} = this._adapter.getProps();
|
|
125
|
+
|
|
126
|
+
const insetFormatToken = getInsetInputFormatToken({
|
|
127
|
+
type,
|
|
128
|
+
format
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const newInsetInputValue = _set(_cloneDeep(insetInputValue), valuePath, value);
|
|
132
|
+
|
|
133
|
+
const newInputValue = this.concatInsetInputValue({
|
|
134
|
+
insetInputValue: newInsetInputValue
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
this._adapter.notifyInsetInputChange({
|
|
138
|
+
insetInputValue: newInsetInputValue,
|
|
139
|
+
format: insetFormatToken,
|
|
140
|
+
insetInputStr: newInputValue
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 只有传入的 format 符合 formatReg 时,才会使用用户传入的 format
|
|
145
|
+
* 否则会使用默认的 format 作为 placeholder
|
|
146
|
+
*
|
|
147
|
+
* The format passed in by the user will be used only if the incoming format conforms to formatReg
|
|
148
|
+
* Otherwise the default format will be used as placeholder
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
getInsetInputPlaceholder() {
|
|
153
|
+
const {
|
|
154
|
+
type,
|
|
155
|
+
format
|
|
156
|
+
} = this._adapter.getProps();
|
|
157
|
+
|
|
158
|
+
const insetInputFormat = getInsetInputFormatToken({
|
|
159
|
+
type,
|
|
160
|
+
format
|
|
161
|
+
});
|
|
162
|
+
let datePlaceholder, timePlaceholder;
|
|
163
|
+
|
|
164
|
+
switch (type) {
|
|
165
|
+
case 'date':
|
|
166
|
+
case 'month':
|
|
167
|
+
case 'dateRange':
|
|
168
|
+
datePlaceholder = insetInputFormat;
|
|
169
|
+
break;
|
|
170
|
+
|
|
171
|
+
case 'dateTime':
|
|
172
|
+
case 'dateTimeRange':
|
|
173
|
+
[datePlaceholder, timePlaceholder] = insetInputFormat.split(' ');
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
datePlaceholder,
|
|
179
|
+
timePlaceholder
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* 从当前日期值或 inputValue 中解析出 insetInputValue
|
|
184
|
+
*
|
|
185
|
+
* Parse out insetInputValue from current date value or inputValue
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
getInsetInputValue(_ref) {
|
|
190
|
+
let {
|
|
191
|
+
value,
|
|
192
|
+
insetInputValue
|
|
193
|
+
} = _ref;
|
|
194
|
+
|
|
195
|
+
const {
|
|
196
|
+
type,
|
|
197
|
+
rangeSeparator,
|
|
198
|
+
format
|
|
199
|
+
} = this._adapter.getProps();
|
|
200
|
+
|
|
201
|
+
let inputValueStr = '';
|
|
202
|
+
|
|
203
|
+
if (_isObject(insetInputValue)) {
|
|
204
|
+
inputValueStr = this.concatInsetInputValue({
|
|
205
|
+
insetInputValue
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
const insetInputFormat = getInsetInputFormatToken({
|
|
209
|
+
format,
|
|
210
|
+
type
|
|
211
|
+
});
|
|
212
|
+
inputValueStr = this.formatShowText(value, insetInputFormat);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const newInsetInputValue = getInsetInputValueFromInsetInputStr({
|
|
216
|
+
inputValue: inputValueStr,
|
|
217
|
+
type,
|
|
218
|
+
rangeSeparator
|
|
219
|
+
});
|
|
220
|
+
return newInsetInputValue;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
concatInsetDateAndTime(_ref2) {
|
|
224
|
+
var _context;
|
|
225
|
+
|
|
226
|
+
let {
|
|
227
|
+
date,
|
|
228
|
+
time
|
|
229
|
+
} = _ref2;
|
|
230
|
+
return _concatInstanceProperty(_context = "".concat(date, " ")).call(_context, time);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
concatInsetDateRange(_ref3) {
|
|
234
|
+
var _context2, _context3;
|
|
235
|
+
|
|
236
|
+
let {
|
|
237
|
+
rangeStart,
|
|
238
|
+
rangeEnd
|
|
239
|
+
} = _ref3;
|
|
240
|
+
|
|
241
|
+
const {
|
|
242
|
+
rangeSeparator
|
|
243
|
+
} = this._adapter.getProps();
|
|
244
|
+
|
|
245
|
+
return _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "".concat(rangeStart)).call(_context3, rangeSeparator)).call(_context2, rangeEnd);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
concatInsetInputValue(_ref4) {
|
|
249
|
+
let {
|
|
250
|
+
insetInputValue
|
|
251
|
+
} = _ref4;
|
|
252
|
+
|
|
253
|
+
const {
|
|
254
|
+
type
|
|
255
|
+
} = this._adapter.getProps();
|
|
256
|
+
|
|
257
|
+
let inputValue = '';
|
|
258
|
+
|
|
259
|
+
switch (type) {
|
|
260
|
+
case 'date':
|
|
261
|
+
case 'month':
|
|
262
|
+
inputValue = insetInputValue.monthLeft.dateInput;
|
|
263
|
+
break;
|
|
264
|
+
|
|
265
|
+
case 'dateRange':
|
|
266
|
+
inputValue = this.concatInsetDateRange({
|
|
267
|
+
rangeStart: insetInputValue.monthLeft.dateInput,
|
|
268
|
+
rangeEnd: insetInputValue.monthRight.dateInput
|
|
269
|
+
});
|
|
270
|
+
break;
|
|
271
|
+
|
|
272
|
+
case 'dateTime':
|
|
273
|
+
inputValue = this.concatInsetDateAndTime({
|
|
274
|
+
date: insetInputValue.monthLeft.dateInput,
|
|
275
|
+
time: insetInputValue.monthLeft.timeInput
|
|
276
|
+
});
|
|
277
|
+
break;
|
|
278
|
+
|
|
279
|
+
case 'dateTimeRange':
|
|
280
|
+
const rangeStart = this.concatInsetDateAndTime({
|
|
281
|
+
date: insetInputValue.monthLeft.dateInput,
|
|
282
|
+
time: insetInputValue.monthLeft.timeInput
|
|
283
|
+
});
|
|
284
|
+
const rangeEnd = this.concatInsetDateAndTime({
|
|
285
|
+
date: insetInputValue.monthRight.dateInput,
|
|
286
|
+
time: insetInputValue.monthRight.timeInput
|
|
287
|
+
});
|
|
288
|
+
inputValue = this.concatInsetDateRange({
|
|
289
|
+
rangeStart,
|
|
290
|
+
rangeEnd
|
|
291
|
+
});
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return inputValue;
|
|
296
|
+
}
|
|
297
|
+
|
|
110
298
|
}
|
|
@@ -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;
|
|
@@ -148,7 +148,8 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
148
148
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
149
149
|
const monthLeft = this.getState('monthLeft');
|
|
150
150
|
|
|
151
|
-
const newMonthLeft = _Object$assign({}, monthLeft);
|
|
151
|
+
const newMonthLeft = _Object$assign({}, monthLeft); // REMOVE:
|
|
152
|
+
|
|
152
153
|
|
|
153
154
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
154
155
|
|
|
@@ -165,6 +166,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
165
166
|
if (refreshPicker) {
|
|
166
167
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
167
168
|
} else {
|
|
169
|
+
// FIXME:
|
|
168
170
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
169
171
|
}
|
|
170
172
|
|
|
@@ -566,7 +568,7 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
566
568
|
selected: selectedSet,
|
|
567
569
|
rangeStart,
|
|
568
570
|
rangeEnd
|
|
569
|
-
} = this.getStates();
|
|
571
|
+
} = this.getStates(); // FIXME:
|
|
570
572
|
|
|
571
573
|
const includeRange = _includesInstanceProperty(_context3 = ['dateRange', 'dateTimeRange']).call(_context3, type);
|
|
572
574
|
|
|
@@ -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/es/table/table.css
CHANGED
package/lib/es/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/es/tag/tag.css
CHANGED
package/lib/es/tag/tag.scss
CHANGED
|
@@ -520,25 +520,25 @@ export default class Tooltip extends BaseFoundation {
|
|
|
520
520
|
break;
|
|
521
521
|
|
|
522
522
|
case 'leftTopOver':
|
|
523
|
-
left = triggerRect.left;
|
|
524
|
-
top = triggerRect.top;
|
|
523
|
+
left = triggerRect.left - SPACING;
|
|
524
|
+
top = triggerRect.top - SPACING;
|
|
525
525
|
break;
|
|
526
526
|
|
|
527
527
|
case 'rightTopOver':
|
|
528
|
-
left = triggerRect.right;
|
|
529
|
-
top = triggerRect.top;
|
|
528
|
+
left = triggerRect.right + SPACING;
|
|
529
|
+
top = triggerRect.top - SPACING;
|
|
530
530
|
translateX = -1;
|
|
531
531
|
break;
|
|
532
532
|
|
|
533
533
|
case 'leftBottomOver':
|
|
534
|
-
left = triggerRect.left;
|
|
535
|
-
top = triggerRect.bottom;
|
|
534
|
+
left = triggerRect.left - SPACING;
|
|
535
|
+
top = triggerRect.bottom + SPACING;
|
|
536
536
|
translateY = -1;
|
|
537
537
|
break;
|
|
538
538
|
|
|
539
539
|
case 'rightBottomOver':
|
|
540
|
-
left = triggerRect.right;
|
|
541
|
-
top = triggerRect.bottom;
|
|
540
|
+
left = triggerRect.right + SPACING;
|
|
541
|
+
top = triggerRect.bottom + SPACING;
|
|
542
542
|
translateX = -1;
|
|
543
543
|
translateY = -1;
|
|
544
544
|
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;
|
|
@@ -14,6 +14,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
14
14
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
15
15
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
16
16
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
17
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
17
18
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
18
19
|
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
19
20
|
import { strings } from '../treeSelect/constants';
|
|
@@ -159,7 +160,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
159
160
|
const isSearching = Boolean(inputValue);
|
|
160
161
|
const treeNodeProps = {
|
|
161
162
|
eventKey: key,
|
|
162
|
-
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
163
|
+
expanded: isSearching && !this._isExpandControlled() ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
163
164
|
selected: _includesInstanceProperty(selectedKeys).call(selectedKeys, key),
|
|
164
165
|
checked: realChecked,
|
|
165
166
|
halfChecked: realHalfChecked,
|
|
@@ -446,20 +447,25 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
446
447
|
|
|
447
448
|
clearInput() {
|
|
448
449
|
const {
|
|
450
|
+
flattenNodes,
|
|
449
451
|
expandedKeys,
|
|
450
452
|
selectedKeys,
|
|
451
453
|
keyEntities,
|
|
452
454
|
treeData
|
|
453
455
|
} = this.getStates();
|
|
456
|
+
const newExpandedKeys = new _Set(expandedKeys);
|
|
457
|
+
|
|
458
|
+
const isExpandControlled = this._isExpandControlled();
|
|
459
|
+
|
|
454
460
|
const expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
455
461
|
|
|
456
|
-
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item =>
|
|
462
|
+
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item => newExpandedKeys.add(item));
|
|
457
463
|
|
|
458
|
-
const
|
|
464
|
+
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys);
|
|
459
465
|
|
|
460
466
|
this._adapter.updateState({
|
|
461
|
-
expandedKeys,
|
|
462
|
-
flattenNodes,
|
|
467
|
+
expandedKeys: isExpandControlled ? expandedKeys : newExpandedKeys,
|
|
468
|
+
flattenNodes: isExpandControlled ? flattenNodes : newFlattenNodes,
|
|
463
469
|
inputValue: '',
|
|
464
470
|
motionKeys: new _Set([]),
|
|
465
471
|
filteredKeys: new _Set([]),
|
|
@@ -473,6 +479,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
473
479
|
this._adapter.updateInputValue(sugInput);
|
|
474
480
|
|
|
475
481
|
const {
|
|
482
|
+
flattenNodes,
|
|
476
483
|
expandedKeys,
|
|
477
484
|
selectedKeys,
|
|
478
485
|
keyEntities,
|
|
@@ -483,17 +490,18 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
483
490
|
filterTreeNode,
|
|
484
491
|
treeNodeFilterProp
|
|
485
492
|
} = this.getProps();
|
|
493
|
+
const newExpandedKeys = new _Set(expandedKeys);
|
|
486
494
|
let filteredOptsKeys = [];
|
|
487
495
|
let expandedOptsKeys = [];
|
|
488
|
-
let
|
|
496
|
+
let newFlattenNodes = [];
|
|
489
497
|
let filteredShownKeys = new _Set([]);
|
|
490
498
|
|
|
491
499
|
if (!sugInput) {
|
|
492
500
|
expandedOptsKeys = findAncestorKeys(selectedKeys, keyEntities);
|
|
493
501
|
|
|
494
|
-
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item =>
|
|
502
|
+
_forEachInstanceProperty(expandedOptsKeys).call(expandedOptsKeys, item => newExpandedKeys.add(item));
|
|
495
503
|
|
|
496
|
-
|
|
504
|
+
newFlattenNodes = flattenTreeData(treeData, newExpandedKeys);
|
|
497
505
|
} else {
|
|
498
506
|
var _context3, _context4;
|
|
499
507
|
|
|
@@ -506,17 +514,19 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
506
514
|
expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
507
515
|
const shownChildKeys = findDescendantKeys(filteredOptsKeys, keyEntities, true);
|
|
508
516
|
filteredShownKeys = new _Set([...shownChildKeys, ...expandedOptsKeys]);
|
|
509
|
-
|
|
517
|
+
newFlattenNodes = flattenTreeData(treeData, new _Set(expandedOptsKeys), showFilteredOnly && filteredShownKeys);
|
|
510
518
|
}
|
|
511
519
|
|
|
512
|
-
|
|
520
|
+
const newFilteredExpandedKeys = new _Set(expandedOptsKeys);
|
|
521
|
+
|
|
522
|
+
this._adapter.notifySearch(sugInput, _Array$from(newFilteredExpandedKeys));
|
|
513
523
|
|
|
514
524
|
this._adapter.updateState({
|
|
515
|
-
expandedKeys,
|
|
516
|
-
flattenNodes,
|
|
525
|
+
expandedKeys: this._isExpandControlled() ? expandedKeys : newExpandedKeys,
|
|
526
|
+
flattenNodes: this._isExpandControlled() ? flattenNodes : newFlattenNodes,
|
|
517
527
|
motionKeys: new _Set([]),
|
|
518
528
|
filteredKeys: new _Set(filteredOptsKeys),
|
|
519
|
-
filteredExpandedKeys:
|
|
529
|
+
filteredExpandedKeys: newFilteredExpandedKeys,
|
|
520
530
|
filteredShownKeys
|
|
521
531
|
});
|
|
522
532
|
}
|
|
@@ -760,7 +770,9 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
760
770
|
return;
|
|
761
771
|
}
|
|
762
772
|
|
|
763
|
-
|
|
773
|
+
const isExpandControlled = this._isExpandControlled();
|
|
774
|
+
|
|
775
|
+
if (isSearching && !isExpandControlled) {
|
|
764
776
|
this.handleNodeExpandInSearch(e, treeNode);
|
|
765
777
|
return;
|
|
766
778
|
}
|
|
@@ -788,7 +800,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
|
|
|
788
800
|
|
|
789
801
|
this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
|
|
790
802
|
|
|
791
|
-
if (!
|
|
803
|
+
if (!isExpandControlled) {
|
|
792
804
|
const flattenNodes = flattenTreeData(treeData, expandedKeys);
|
|
793
805
|
const motionKeys = this._isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
|
|
794
806
|
const newState = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
11
|
-
"@douyinfe/semi-animation": "2.
|
|
11
|
+
"@douyinfe/semi-animation": "2.7.0-beta.0",
|
|
12
12
|
"async-validator": "^3.5.0",
|
|
13
13
|
"classnames": "^2.2.6",
|
|
14
14
|
"date-fns": "^2.9.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "51cc4f6fa52f3275728d2112a98446ba54619c5b",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/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;
|
package/table/variables.scss
CHANGED
|
@@ -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/tag/tag.scss
CHANGED
package/tooltip/foundation.ts
CHANGED
|
@@ -426,22 +426,22 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
426
426
|
translateY = -1;
|
|
427
427
|
break;
|
|
428
428
|
case 'leftTopOver':
|
|
429
|
-
left = triggerRect.left;
|
|
430
|
-
top = triggerRect.top;
|
|
429
|
+
left = triggerRect.left - SPACING;
|
|
430
|
+
top = triggerRect.top - SPACING;
|
|
431
431
|
break;
|
|
432
432
|
case 'rightTopOver':
|
|
433
|
-
left = triggerRect.right;
|
|
434
|
-
top = triggerRect.top;
|
|
433
|
+
left = triggerRect.right + SPACING;
|
|
434
|
+
top = triggerRect.top - SPACING;
|
|
435
435
|
translateX = -1;
|
|
436
436
|
break;
|
|
437
437
|
case 'leftBottomOver':
|
|
438
|
-
left = triggerRect.left;
|
|
439
|
-
top = triggerRect.bottom;
|
|
438
|
+
left = triggerRect.left - SPACING;
|
|
439
|
+
top = triggerRect.bottom + SPACING;
|
|
440
440
|
translateY = -1;
|
|
441
441
|
break;
|
|
442
442
|
case 'rightBottomOver':
|
|
443
|
-
left = triggerRect.right;
|
|
444
|
-
top = triggerRect.bottom;
|
|
443
|
+
left = triggerRect.right + SPACING;
|
|
444
|
+
top = triggerRect.bottom + SPACING;
|
|
445
445
|
translateX = -1;
|
|
446
446
|
translateY = -1;
|
|
447
447
|
break;
|