@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.
Files changed (81) hide show
  1. package/cascader/foundation.ts +74 -19
  2. package/datePicker/datePicker.scss +100 -5
  3. package/form/foundation.ts +7 -3
  4. package/form/utils.ts +7 -2
  5. package/image/previewImageFoundation.ts +34 -3
  6. package/image/previewInnerFoundation.ts +15 -4
  7. package/input/textarea.scss +35 -0
  8. package/lib/cjs/cascader/foundation.d.ts +12 -0
  9. package/lib/cjs/cascader/foundation.js +68 -23
  10. package/lib/cjs/datePicker/datePicker.css +67 -5
  11. package/lib/cjs/datePicker/datePicker.scss +100 -5
  12. package/lib/cjs/form/foundation.d.ts +1 -1
  13. package/lib/cjs/form/foundation.js +6 -6
  14. package/lib/cjs/form/utils.js +5 -2
  15. package/lib/cjs/image/previewImageFoundation.d.ts +4 -0
  16. package/lib/cjs/image/previewImageFoundation.js +33 -2
  17. package/lib/cjs/image/previewInnerFoundation.d.ts +1 -0
  18. package/lib/cjs/image/previewInnerFoundation.js +17 -4
  19. package/lib/cjs/input/textarea.css +17 -0
  20. package/lib/cjs/input/textarea.scss +35 -0
  21. package/lib/cjs/navigation/navigation.css +2 -1
  22. package/lib/cjs/navigation/navigation.scss +1 -0
  23. package/lib/cjs/navigation/variables.scss +1 -1
  24. package/lib/cjs/overflowList/foundation.d.ts +1 -0
  25. package/lib/cjs/overflowList/foundation.js +51 -1
  26. package/lib/cjs/select/foundation.d.ts +1 -1
  27. package/lib/cjs/select/foundation.js +28 -2
  28. package/lib/cjs/switch/switch.css +1 -0
  29. package/lib/cjs/switch/switch.scss +1 -0
  30. package/lib/cjs/switch/variables.scss +2 -1
  31. package/lib/cjs/table/foundation.js +2 -1
  32. package/lib/cjs/tag/tag.css +26 -0
  33. package/lib/cjs/tag/tag.scss +33 -0
  34. package/lib/cjs/tagInput/tagInput.css +17 -0
  35. package/lib/cjs/tagInput/tagInput.scss +18 -0
  36. package/lib/cjs/timePicker/constants.d.ts +1 -0
  37. package/lib/cjs/timePicker/foundation.d.ts +7 -1
  38. package/lib/cjs/timePicker/foundation.js +62 -11
  39. package/lib/es/cascader/foundation.d.ts +12 -0
  40. package/lib/es/cascader/foundation.js +68 -23
  41. package/lib/es/datePicker/datePicker.css +67 -5
  42. package/lib/es/datePicker/datePicker.scss +100 -5
  43. package/lib/es/form/foundation.d.ts +1 -1
  44. package/lib/es/form/foundation.js +6 -6
  45. package/lib/es/form/utils.js +5 -2
  46. package/lib/es/image/previewImageFoundation.d.ts +4 -0
  47. package/lib/es/image/previewImageFoundation.js +33 -2
  48. package/lib/es/image/previewInnerFoundation.d.ts +1 -0
  49. package/lib/es/image/previewInnerFoundation.js +17 -4
  50. package/lib/es/input/textarea.css +17 -0
  51. package/lib/es/input/textarea.scss +35 -0
  52. package/lib/es/navigation/navigation.css +2 -1
  53. package/lib/es/navigation/navigation.scss +1 -0
  54. package/lib/es/navigation/variables.scss +1 -1
  55. package/lib/es/overflowList/foundation.d.ts +1 -0
  56. package/lib/es/overflowList/foundation.js +51 -1
  57. package/lib/es/select/foundation.d.ts +1 -1
  58. package/lib/es/select/foundation.js +28 -2
  59. package/lib/es/switch/switch.css +1 -0
  60. package/lib/es/switch/switch.scss +1 -0
  61. package/lib/es/switch/variables.scss +2 -1
  62. package/lib/es/table/foundation.js +2 -1
  63. package/lib/es/tag/tag.css +26 -0
  64. package/lib/es/tag/tag.scss +33 -0
  65. package/lib/es/tagInput/tagInput.css +17 -0
  66. package/lib/es/tagInput/tagInput.scss +18 -0
  67. package/lib/es/timePicker/constants.d.ts +1 -0
  68. package/lib/es/timePicker/foundation.d.ts +7 -1
  69. package/lib/es/timePicker/foundation.js +62 -11
  70. package/navigation/navigation.scss +1 -0
  71. package/navigation/variables.scss +1 -1
  72. package/overflowList/foundation.ts +48 -2
  73. package/package.json +4 -4
  74. package/select/foundation.ts +27 -2
  75. package/switch/switch.scss +1 -0
  76. package/switch/variables.scss +2 -1
  77. package/table/foundation.ts +2 -1
  78. package/tag/tag.scss +33 -0
  79. package/tagInput/tagInput.scss +18 -0
  80. package/timePicker/constants.ts +2 -0
  81. package/timePicker/foundation.ts +62 -10
@@ -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
- this.stopPropagation(e);
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';
@@ -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 {
@@ -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`,
@@ -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
- isDisabledHMS({ hours, minutes, seconds }: { hours: number; minutes: number; seconds: number }) {
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
- invalid = dates.some(d =>
217
- this.isDisabledHMS({ hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() })
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
- invalid = dates.some(d =>
329
- this.isDisabledHMS({ hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds() })
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;