@douyinfe/semi-foundation 2.96.0 → 2.97.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/cascader/foundation.ts +74 -19
- package/datePicker/datePicker.scss +100 -5
- package/form/foundation.ts +7 -3
- package/form/utils.ts +7 -2
- package/image/previewImageFoundation.ts +34 -3
- package/image/previewInnerFoundation.ts +15 -4
- package/input/textarea.scss +35 -0
- package/lib/cjs/cascader/foundation.d.ts +12 -0
- package/lib/cjs/cascader/foundation.js +68 -23
- package/lib/cjs/datePicker/datePicker.css +67 -5
- package/lib/cjs/datePicker/datePicker.scss +100 -5
- package/lib/cjs/form/foundation.d.ts +1 -1
- package/lib/cjs/form/foundation.js +6 -6
- package/lib/cjs/form/utils.js +5 -2
- package/lib/cjs/image/previewImageFoundation.d.ts +4 -0
- package/lib/cjs/image/previewImageFoundation.js +33 -2
- package/lib/cjs/image/previewInnerFoundation.d.ts +1 -0
- package/lib/cjs/image/previewInnerFoundation.js +17 -4
- package/lib/cjs/input/textarea.css +17 -0
- package/lib/cjs/input/textarea.scss +35 -0
- package/lib/cjs/navigation/navigation.css +2 -1
- package/lib/cjs/navigation/navigation.scss +1 -0
- package/lib/cjs/navigation/variables.scss +1 -1
- package/lib/cjs/overflowList/foundation.d.ts +1 -0
- package/lib/cjs/overflowList/foundation.js +51 -1
- package/lib/cjs/select/foundation.d.ts +1 -1
- package/lib/cjs/select/foundation.js +28 -2
- package/lib/cjs/switch/switch.css +1 -0
- package/lib/cjs/switch/switch.scss +1 -0
- package/lib/cjs/switch/variables.scss +2 -1
- package/lib/cjs/table/foundation.js +2 -1
- package/lib/cjs/tag/tag.css +26 -0
- package/lib/cjs/tag/tag.scss +33 -0
- package/lib/cjs/tagInput/tagInput.css +17 -0
- package/lib/cjs/tagInput/tagInput.scss +18 -0
- package/lib/cjs/timePicker/constants.d.ts +1 -0
- package/lib/cjs/timePicker/foundation.d.ts +7 -1
- package/lib/cjs/timePicker/foundation.js +62 -11
- package/lib/es/cascader/foundation.d.ts +12 -0
- package/lib/es/cascader/foundation.js +68 -23
- package/lib/es/datePicker/datePicker.css +67 -5
- package/lib/es/datePicker/datePicker.scss +100 -5
- package/lib/es/form/foundation.d.ts +1 -1
- package/lib/es/form/foundation.js +6 -6
- package/lib/es/form/utils.js +5 -2
- package/lib/es/image/previewImageFoundation.d.ts +4 -0
- package/lib/es/image/previewImageFoundation.js +33 -2
- package/lib/es/image/previewInnerFoundation.d.ts +1 -0
- package/lib/es/image/previewInnerFoundation.js +17 -4
- package/lib/es/input/textarea.css +17 -0
- package/lib/es/input/textarea.scss +35 -0
- package/lib/es/navigation/navigation.css +2 -1
- package/lib/es/navigation/navigation.scss +1 -0
- package/lib/es/navigation/variables.scss +1 -1
- package/lib/es/overflowList/foundation.d.ts +1 -0
- package/lib/es/overflowList/foundation.js +51 -1
- package/lib/es/select/foundation.d.ts +1 -1
- package/lib/es/select/foundation.js +28 -2
- package/lib/es/switch/switch.css +1 -0
- package/lib/es/switch/switch.scss +1 -0
- package/lib/es/switch/variables.scss +2 -1
- package/lib/es/table/foundation.js +2 -1
- package/lib/es/tag/tag.css +26 -0
- package/lib/es/tag/tag.scss +33 -0
- package/lib/es/tagInput/tagInput.css +17 -0
- package/lib/es/tagInput/tagInput.scss +18 -0
- package/lib/es/timePicker/constants.d.ts +1 -0
- package/lib/es/timePicker/foundation.d.ts +7 -1
- package/lib/es/timePicker/foundation.js +62 -11
- package/navigation/navigation.scss +1 -0
- package/navigation/variables.scss +1 -1
- package/overflowList/foundation.ts +48 -2
- package/package.json +4 -4
- package/select/foundation.ts +27 -2
- package/switch/switch.scss +1 -0
- package/switch/variables.scss +2 -1
- package/table/foundation.ts +2 -1
- package/tag/tag.scss +33 -0
- package/tagInput/tagInput.scss +18 -0
- package/timePicker/constants.ts +2 -0
- package/timePicker/foundation.ts +62 -10
package/table/foundation.ts
CHANGED
|
@@ -1088,7 +1088,8 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
1088
1088
|
* @param {*} e
|
|
1089
1089
|
*/
|
|
1090
1090
|
handleSort(column: { dataIndex?: string; sortOrder?: BaseSortOrder } = {}, e: any, check = false) {
|
|
1091
|
-
|
|
1091
|
+
/* Do not call stopPropagation here, otherwise the click event registered via onHeaderCell
|
|
1092
|
+
will be blocked when the click hot area is the whole title (#1861). */
|
|
1092
1093
|
/* if mouse down to the resizable handle, do not trigger the sorting,fix #2802
|
|
1093
1094
|
The target of the click event may be different from the target of the mousedown,
|
|
1094
1095
|
e.g: Press the mouse, move to another node and then release it,
|
package/tag/tag.scss
CHANGED
|
@@ -329,4 +329,37 @@ $types: "ghost", "solid", "light";
|
|
|
329
329
|
color: $color-tag_avatar-text-default;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
+
.#{$module}-split {
|
|
333
|
+
display: inline-flex;
|
|
334
|
+
align-items: center;
|
|
335
|
+
|
|
336
|
+
.#{$module} {
|
|
337
|
+
border-radius: 0;
|
|
338
|
+
margin-right: 1px;
|
|
339
|
+
|
|
340
|
+
&-first {
|
|
341
|
+
border-top-left-radius: $radius-tag;
|
|
342
|
+
border-bottom-left-radius: $radius-tag;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&-last {
|
|
346
|
+
border-top-right-radius: $radius-tag;
|
|
347
|
+
border-bottom-right-radius: $radius-tag;
|
|
348
|
+
margin-right: unset;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
&-circle {
|
|
352
|
+
&.#{$module}-first {
|
|
353
|
+
border-top-left-radius: $radius-tag_circle;
|
|
354
|
+
border-bottom-left-radius: $radius-tag_circle;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
&.#{$module}-last {
|
|
358
|
+
border-top-right-radius: $radius-tag_circle;
|
|
359
|
+
border-bottom-right-radius: $radius-tag_circle;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
332
365
|
@import './rtl.scss';
|
package/tagInput/tagInput.scss
CHANGED
|
@@ -137,6 +137,7 @@ $module: #{$prefix}-tagInput;
|
|
|
137
137
|
padding-left: $spacing-extra-tight;
|
|
138
138
|
padding-right: $spacing-extra-tight;
|
|
139
139
|
overflow: hidden;
|
|
140
|
+
position: relative;
|
|
140
141
|
|
|
141
142
|
&-tag {
|
|
142
143
|
margin-right: $spacing-extra-tight;
|
|
@@ -190,6 +191,8 @@ $module: #{$prefix}-tagInput;
|
|
|
190
191
|
& &-input {
|
|
191
192
|
flex-grow: 1;
|
|
192
193
|
width: min-content;
|
|
194
|
+
min-width: 2px;
|
|
195
|
+
max-width: 100%;
|
|
193
196
|
// min-width: 38px;
|
|
194
197
|
border: none;
|
|
195
198
|
outline: none;
|
|
@@ -240,6 +243,21 @@ $module: #{$prefix}-tagInput;
|
|
|
240
243
|
}
|
|
241
244
|
}
|
|
242
245
|
}
|
|
246
|
+
|
|
247
|
+
/* hidden mirror used to measure input text width */
|
|
248
|
+
&-inputMirror {
|
|
249
|
+
position: absolute;
|
|
250
|
+
top: 0;
|
|
251
|
+
left: 0;
|
|
252
|
+
visibility: hidden;
|
|
253
|
+
pointer-events: none;
|
|
254
|
+
height: 0;
|
|
255
|
+
overflow: hidden;
|
|
256
|
+
white-space: pre;
|
|
257
|
+
font-size: $font-size-regular;
|
|
258
|
+
font-weight: $font-weight-regular;
|
|
259
|
+
font-family: inherit;
|
|
260
|
+
}
|
|
243
261
|
}
|
|
244
262
|
|
|
245
263
|
&-clearBtn {
|
package/timePicker/constants.ts
CHANGED
|
@@ -6,6 +6,8 @@ const TYPE_TIME_RANGE_PICKER = 'timeRange' as const;
|
|
|
6
6
|
const DEFAULT_RANGE_SEPARATOR = ' ~ ' as const;
|
|
7
7
|
const DEFAULT_MULTIPLE_SEPARATOR = ',' as const;
|
|
8
8
|
|
|
9
|
+
export type PanelType = 'left' | 'right';
|
|
10
|
+
|
|
9
11
|
const cssClasses = {
|
|
10
12
|
PREFIX: `${BASE_CLASS_PREFIX}-timepicker`,
|
|
11
13
|
RANGE_PICKER: `${BASE_CLASS_PREFIX}-timepicker-range-panel`,
|
package/timePicker/foundation.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { strings } from './constants';
|
|
2
|
+
import type { PanelType } from './constants';
|
|
2
3
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
4
|
import {
|
|
4
5
|
formatToString,
|
|
@@ -70,8 +71,35 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
|
|
|
70
71
|
return position || rtlDirection || strings.DEFAULT_POSITION[type];
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
const { disabledHours, disabledMinutes, disabledSeconds } = this.getProps();
|
|
74
|
+
getDisabledTimeFns(panelType: PanelType, dates: Date[]) {
|
|
75
|
+
const { disabledHours, disabledMinutes, disabledSeconds, disabledTime } = this.getProps() as any;
|
|
76
|
+
|
|
77
|
+
// disabledTime is range-only: only invoke it when the picker is
|
|
78
|
+
// actually a range picker. In single mode panelType has no meaning, so
|
|
79
|
+
// we fall back to the top-level disabledHours / disabledMinutes /
|
|
80
|
+
// disabledSeconds without invoking disabledTime.
|
|
81
|
+
if (typeof disabledTime === 'function' && this._adapter.isRangePicker()) {
|
|
82
|
+
const disabledObj = disabledTime(dates, panelType) || {};
|
|
83
|
+
return {
|
|
84
|
+
disabledHours: disabledObj.disabledHours || disabledHours,
|
|
85
|
+
disabledMinutes: disabledObj.disabledMinutes || disabledMinutes,
|
|
86
|
+
disabledSeconds: disabledObj.disabledSeconds || disabledSeconds,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
disabledHours,
|
|
92
|
+
disabledMinutes,
|
|
93
|
+
disabledSeconds,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
isDisabledHMS(
|
|
98
|
+
{ hours, minutes, seconds }: { hours: number; minutes: number; seconds: number },
|
|
99
|
+
panelType: PanelType = 'left',
|
|
100
|
+
dates: Date[] = []
|
|
101
|
+
) {
|
|
102
|
+
const { disabledHours, disabledMinutes, disabledSeconds } = this.getDisabledTimeFns(panelType, dates);
|
|
75
103
|
const hDis = !isNullOrUndefined(hours) && hourIsDisabled(disabledHours, hours);
|
|
76
104
|
const mDis = !isNullOrUndefined(hours) && !isNullOrUndefined(minutes) && minuteIsDisabled(disabledMinutes, hours, minutes);
|
|
77
105
|
const sDis =
|
|
@@ -123,8 +151,8 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
|
|
|
123
151
|
});
|
|
124
152
|
|
|
125
153
|
const isAM = [true, false];
|
|
126
|
-
parsedValues.map((item, idx)=>{
|
|
127
|
-
isAM[idx]= getHours(item) < 12;
|
|
154
|
+
parsedValues.map((item, idx) => {
|
|
155
|
+
isAM[idx] = getHours(item) < 12;
|
|
128
156
|
});
|
|
129
157
|
|
|
130
158
|
if (parsedValues.length === value.length) {
|
|
@@ -213,9 +241,21 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
|
|
|
213
241
|
)
|
|
214
242
|
);
|
|
215
243
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
244
|
+
if (this._adapter.isRangePicker()) {
|
|
245
|
+
invalid = dates.some((d, idx) => {
|
|
246
|
+
const panelType: PanelType = idx === 1 ? 'right' : 'left';
|
|
247
|
+
return this.isDisabledHMS(
|
|
248
|
+
{ hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() },
|
|
249
|
+
panelType,
|
|
250
|
+
dates
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
} else {
|
|
254
|
+
const d = dates[0];
|
|
255
|
+
invalid = d
|
|
256
|
+
? this.isDisabledHMS({ hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() }, 'left', dates)
|
|
257
|
+
: false;
|
|
258
|
+
}
|
|
219
259
|
}
|
|
220
260
|
const inputValue = this.formatValue(dates);
|
|
221
261
|
|
|
@@ -325,9 +365,21 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
|
|
|
325
365
|
let invalid = dates.some(d => isNaN(Number(d)));
|
|
326
366
|
|
|
327
367
|
if (!invalid) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
368
|
+
if (this._adapter.isRangePicker()) {
|
|
369
|
+
invalid = dates.some((d, idx) => {
|
|
370
|
+
const panelType: PanelType = idx === 1 ? 'right' : 'left';
|
|
371
|
+
return this.isDisabledHMS(
|
|
372
|
+
{ hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() },
|
|
373
|
+
panelType,
|
|
374
|
+
dates
|
|
375
|
+
);
|
|
376
|
+
});
|
|
377
|
+
} else {
|
|
378
|
+
const d = dates[0];
|
|
379
|
+
invalid = d
|
|
380
|
+
? this.isDisabledHMS({ hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() }, 'left', dates)
|
|
381
|
+
: false;
|
|
382
|
+
}
|
|
331
383
|
}
|
|
332
384
|
|
|
333
385
|
return invalid;
|