@fibrae/semi-foundation 0.7.0 → 0.9.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 (51) hide show
  1. package/dist/components/calendar/event-util.js +1 -1
  2. package/dist/components/carousel/foundation.js +1 -1
  3. package/dist/components/cascader/foundation.js +1 -1
  4. package/dist/components/date-picker/months-grid-foundation.d.ts +1 -1
  5. package/dist/components/date-picker/months-grid-foundation.js +1 -1
  6. package/dist/components/dropdown/menu-foundation.d.ts +1 -1
  7. package/dist/components/form/form.css +64 -2
  8. package/dist/components/form/form.scss +65 -2
  9. package/dist/components/form/foundation.d.ts +2 -1
  10. package/dist/components/form/foundation.js +63 -3
  11. package/dist/components/form/interface.d.ts +9 -1
  12. package/dist/components/form/json-schema.d.ts +78 -2
  13. package/dist/components/form/json-schema.js +75 -8
  14. package/dist/components/form/rules.js +1 -1
  15. package/dist/components/form/variables.scss +4 -0
  16. package/dist/components/image/preview-image-foundation.js +1 -1
  17. package/dist/components/image/preview-inner-foundation.js +2 -4
  18. package/dist/components/input-number/foundation.js +2 -2
  19. package/dist/components/json-viewer/foundation.js +1 -1
  20. package/dist/components/navigation/foundation.js +6 -8
  21. package/dist/components/pagination/foundation.d.ts +1 -1
  22. package/dist/components/select/foundation.d.ts +1 -1
  23. package/dist/components/select/option-foundation.d.ts +2 -1
  24. package/dist/components/side-sheet/side-sheet-foundation.js +1 -1
  25. package/dist/components/slider/foundation.d.ts +2 -2
  26. package/dist/components/table/foundation.d.ts +8 -0
  27. package/dist/components/table/foundation.js +14 -2
  28. package/dist/components/table/rtl.scss +5 -0
  29. package/dist/components/table/table.css +123 -0
  30. package/dist/components/table/table.scss +174 -0
  31. package/dist/components/toast/toast.css +1 -1
  32. package/dist/components/toast/toast.scss +2 -1
  33. package/dist/components/tooltip/foundation.js +2 -4
  34. package/dist/components/tooltip/tooltip.css +1 -1
  35. package/dist/components/tooltip/tooltip.scss +4 -2
  36. package/dist/components/tree/tree-util.js +4 -4
  37. package/dist/components/upload/constants.d.ts +1 -1
  38. package/dist/components/upload/foundation.js +1 -1
  39. package/dist/components/video-player/foundation.js +1 -1
  40. package/dist/locale/interface.d.ts +4 -0
  41. package/dist/locale/source/en_US.js +3 -1
  42. package/dist/locale/source/zh_CN.js +3 -1
  43. package/dist/utils/a11y.d.ts +2 -0
  44. package/dist/utils/a11y.js +5 -1
  45. package/dist/utils/index.d.ts +3 -3
  46. package/dist/utils/index.js +3 -3
  47. package/dist/utils/scroll-lock.d.ts +4 -3
  48. package/dist/utils/scroll-lock.js +15 -11
  49. package/dist/utils/supports.d.ts +2 -0
  50. package/dist/utils/supports.js +7 -1
  51. package/package.json +2 -2
@@ -32,6 +32,9 @@ $font-form_label-fontWeight: $font-weight-bold; // 表单项标签字重
32
32
  $color-form_label-text-default: var(--semi-color-text-0); // 表单项标签文字颜色
33
33
  $color-form_label_optional-text-default: var(--semi-color-tertiary); // 表单项标签可选标记颜色
34
34
  $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单项标签图标颜色
35
+ $color-form_label_tooltip-icon-default: var(--semi-color-tertiary); // 表单项标签提示图标颜色
36
+ $spacing-form_label_tooltip-marginLeft: $spacing-extra-tight; // 表单项标签与提示图标的间距
37
+ $width-form_label_tooltip-icon: $font-size-regular; // 表单项标签提示图标大小,与标签文字同大
35
38
  $color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
36
39
  $font-form_requiredMark-fontWeight: $font-weight-bold; // 表单必填标识字重
37
40
 
@@ -48,5 +51,6 @@ $spacing-form_section_text-paddingBottom: $spacing-tight; // 表单分组标题
48
51
  $spacing-form_section_text-marginBottom: $spacing-extra-tight; // 表单分组标题底部外边距
49
52
  $spacing-form_section_text-paddingTop: 0px; // 表单分组标题顶部内边距
50
53
  $spacing-form_section_text-marginTop: 0px; // 表单分组标题顶部外边距
54
+ $spacing-form_section_extra-marginBottom: $spacing-extra-tight; // 表单分组说明文字底部外边距
51
55
  $spacing-form_schema_array_row-gap: $spacing-tight; // SchemaField 数组行内容与操作按钮的间距
52
56
  $spacing-form_schema_array_row_actions-gap: $spacing-extra-tight; // SchemaField 数组行操作按钮之间的间距
@@ -52,7 +52,7 @@ var PreviewImageFoundation = class extends BaseFoundation {
52
52
  const { ratio, initialZoom } = this.getProps();
53
53
  let _zoom = 1;
54
54
  this.#syncInitialZoomFlagWithSrc();
55
- if (!this.#initialZoomApplied && typeof initialZoom === "number" && Number.isFinite(initialZoom) && initialZoom > 0) {
55
+ if (!this.#initialZoomApplied && Number.isFinite(initialZoom) && initialZoom > 0) {
56
56
  this.#initialZoomApplied = true;
57
57
  return this.#clampZoom(initialZoom);
58
58
  }
@@ -62,10 +62,8 @@ var PreviewInnerFoundation = class PreviewInnerFoundation extends BaseFoundation
62
62
  if (wrap && (!active || active === document.body)) wrap.focus({ preventScroll: true });
63
63
  }
64
64
  #clearTimer() {
65
- if (this.#timer) {
66
- clearTimeout(this.#timer);
67
- this.#timer = null;
68
- }
65
+ clearTimeout(this.#timer);
66
+ this.#timer = null;
69
67
  }
70
68
  #onWheel(e) {
71
69
  const { zoomStep } = this.getProps();
@@ -155,7 +155,7 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
155
155
  const { scientificNotation } = this.getProps();
156
156
  if (typeof scientificNotation === "object" && scientificNotation !== null) {
157
157
  const t = scientificNotation.threshold;
158
- return typeof t === "number" && Number.isFinite(t) && t >= 1 ? t : 15;
158
+ return Number.isFinite(t) && t >= 1 ? t : 15;
159
159
  }
160
160
  return 15;
161
161
  }
@@ -425,7 +425,7 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
425
425
  }
426
426
  const key = isComposing(event) || event.altKey || event.ctrlKey || event.metaKey ? "" : event.key;
427
427
  const bound = event.shiftKey ? null : key === "Home" ? this.getProp("min") : key === "End" ? this.getProp("max") : null;
428
- const jumpsToBound = typeof bound === "number" && Number.isFinite(bound);
428
+ const jumpsToBound = Number.isFinite(bound);
429
429
  if ((key === "ArrowUp" || key === "ArrowDown") && !this.#canStep(key === "ArrowUp" ? 1 : -1)) event.preventDefault();
430
430
  else if (key === "ArrowUp" || key === "ArrowDown" || jumpsToBound) {
431
431
  this.#lastChangeWasStep = true;
@@ -39,7 +39,7 @@ var JsonViewerFoundation = class extends BaseFoundation {
39
39
  height
40
40
  };
41
41
  this.#resetMeasuredHeights ||= rewrap;
42
- if (this.#resizeRafId !== null) cancelAnimationFrame(this.#resizeRafId);
42
+ cancelAnimationFrame(this.#resizeRafId);
43
43
  this.#resizeRafId = requestAnimationFrame(() => {
44
44
  this.#resizeRafId = null;
45
45
  if (this.#resetMeasuredHeights) this.#jsonViewer?.resetMeasuredHeights();
@@ -31,22 +31,20 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
31
31
  }
32
32
  static getZeroParentKeys(itemKeysMap = {}, ...itemKeys) {
33
33
  const willAddKeys = [];
34
- if (itemKeys.length) {
35
- for (const itemKey of itemKeys) if (Array.isArray(itemKeysMap[itemKey]) && itemKeysMap[itemKey].length) {
36
- const levelZeroParentKey = itemKeysMap[itemKey][0];
37
- if (levelZeroParentKey != null) willAddKeys.push(levelZeroParentKey);
38
- }
34
+ for (const itemKey of itemKeys) if (Array.isArray(itemKeysMap[itemKey])) {
35
+ const levelZeroParentKey = itemKeysMap[itemKey][0];
36
+ if (levelZeroParentKey != null) willAddKeys.push(levelZeroParentKey);
39
37
  }
40
38
  return willAddKeys;
41
39
  }
42
40
  static buildItemKeysMap(items = [], keysMap = {}, parentKeys = [], keyPropName = "itemKey") {
43
- if (Array.isArray(items) && items.length) for (const item of items) if (Array.isArray(item)) NavigationFoundation.buildItemKeysMap(item, keysMap, [...parentKeys], keyPropName);
41
+ if (Array.isArray(items)) for (const item of items) if (Array.isArray(item)) NavigationFoundation.buildItemKeysMap(item, keysMap, [...parentKeys], keyPropName);
44
42
  else {
45
43
  let itemKey;
46
44
  if (item && typeof item === "object") itemKey = item[keyPropName];
47
45
  if (itemKey != null) {
48
46
  keysMap[itemKey] = [...parentKeys];
49
- if (Array.isArray(item.items) && item.items.length) NavigationFoundation.buildItemKeysMap(item.items, keysMap, [...parentKeys, itemKey], keyPropName);
47
+ if (Array.isArray(item.items)) NavigationFoundation.buildItemKeysMap(item.items, keysMap, [...parentKeys, itemKey], keyPropName);
50
48
  }
51
49
  }
52
50
  return keysMap;
@@ -74,7 +72,7 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
74
72
  }
75
73
  static getShouldOpenKeys(itemKeysMap = {}, selectedKeys = []) {
76
74
  const willOpenKeySet = /* @__PURE__ */ new Set();
77
- if (Array.isArray(selectedKeys) && selectedKeys.length) selectedKeys.forEach((item) => {
75
+ if (Array.isArray(selectedKeys)) selectedKeys.forEach((item) => {
78
76
  if (item != null) {
79
77
  const parentKeys = itemKeysMap[item];
80
78
  if (Array.isArray(parentKeys)) parentKeys.forEach((k) => willOpenKeySet.add(k));
@@ -53,7 +53,7 @@ export default class PaginationFoundation<P extends PaginationBaseProps = Pagina
53
53
  sizeChangerShown: boolean;
54
54
  hidden: boolean;
55
55
  quickJumpDisabled: boolean;
56
- switchPosition: "bottomLeft" | "bottom" | "top" | "bottomRight" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
56
+ switchPosition: "bottomLeft" | "left" | "right" | "top" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
57
57
  };
58
58
  static getDisabled(currentPage: number, total: number, pageSize: number): {
59
59
  prevDisabled: boolean;
@@ -77,7 +77,7 @@ export default class SelectFoundation<P extends SelectBaseProps = SelectBaseProp
77
77
  };
78
78
  protected initOnce(): void;
79
79
  /** The rtl default of `position`; `direction` is read from the host's config */
80
- static getPosition<P extends string>(position?: P, direction?: string): "bottomLeft" | P | "bottomRight";
80
+ static getPosition<P extends string>(position?: P, direction?: string): "bottomLeft" | "bottomRight" | P;
81
81
  static getVisibleOptions<O extends Pick<OptionRecord, 'show'>>(options: O[]): O[];
82
82
  /** The index the combobox points at with `aria-activedescendant`, or undefined when no option is highlighted */
83
83
  static getActiveOptionIndex({ isOpen, loading, focusIndex, visibleCount }: {
@@ -1,6 +1,7 @@
1
+ export type SelectRawValue = string | number | boolean;
1
2
  export interface BasicOptionProps {
2
3
  [x: string]: any;
3
- value?: string | number;
4
+ value?: SelectRawValue;
4
5
  label?: string | number | unknown;
5
6
  children?: unknown;
6
7
  disabled?: boolean;
@@ -110,7 +110,7 @@ var SideSheetFoundation = class SideSheetFoundation extends BaseFoundation {
110
110
  focus: dialog,
111
111
  preventScroll: true
112
112
  });
113
- warnIfDialogUnnamed(dialog ?? null, "SideSheet");
113
+ warnIfDialogUnnamed(dialog, "SideSheet");
114
114
  };
115
115
  afterHide = () => {
116
116
  if (this.#session.end()) this.#resources.release();
@@ -95,11 +95,11 @@ export default class SliderFoundation<P extends SliderProps = SliderProps> exten
95
95
  * `reverse` is the class suffix of a vertical slider drawn from the bottom.
96
96
  */
97
97
  static getLayout(props: SliderProps, value: SliderState['currentValue'], { chooseMovePos, isDrag }: Pick<SliderState, 'chooseMovePos' | 'isDrag'>, direction?: string): {
98
- startProp: "top" | "left" | "right";
98
+ startProp: "left" | "right" | "top";
99
99
  inputDir: "rtl" | "ltr";
100
100
  reverse: string;
101
101
  track: {
102
- sizeProp: "height" | "width";
102
+ sizeProp: "width" | "height";
103
103
  size: string;
104
104
  start: string;
105
105
  };
@@ -224,6 +224,14 @@ export default class TableFoundation<RecordType, P extends TableBaseProps<Record
224
224
  static getInitialState<R, C extends BaseColumnProps<R> = BaseColumnProps<R>>(props: TableBaseProps<R>, flattenColumns: C[], queries: C[]): TableColumnsState<R, C>;
225
225
  /** Hosts call it after mount, on body scroll and when the table or its content resizes */
226
226
  syncScrollEdges: () => void;
227
+ /**
228
+ * Whether a sticky header follows the body through a scroll-driven animation, which the compositor runs in the
229
+ * frame it scrolls the body, rather than through scrollLeft writes a frame late. Probed after mount, like
230
+ * syncScrollEdges. Removable with the scrollLeft path once Chrome 116, Firefox 159 and Safari 26 are the minimum.
231
+ */
232
+ headerFollowsInCss: () => boolean;
233
+ /** Hosts call it after commits and body resizes of a sticky table: the distance the header's animation spans */
234
+ syncHeaderScrollRange: () => void;
227
235
  /** `index` is the header row the widths were measured in */
228
236
  setHeadWidths: (widths: BaseHeadWidth[], index?: number) => void;
229
237
  setBodyHasScrollbar: (bodyHasScrollBar: boolean) => void;
@@ -11,6 +11,7 @@ import { get } from "es-toolkit/compat";
11
11
  // src/components/table/foundation.ts
12
12
  var TableFoundation = class TableFoundation extends BaseFoundation {
13
13
  #trackScrollEdges;
14
+ #headerFollowsInCss;
14
15
  #rangeAnchor = null;
15
16
  #rangeBase = null;
16
17
  #rangeResult = null;
@@ -348,11 +349,11 @@ var TableFoundation = class TableFoundation extends BaseFoundation {
348
349
  if (!(keysSet instanceof Set)) keysSet = new Set(keys);
349
350
  const childrenRecordName = this.getProp("childrenRecordName");
350
351
  const records = [];
351
- if (keysSet.size && Array.isArray(dataSource) && dataSource.length) {
352
+ if (keysSet.size && Array.isArray(dataSource)) {
352
353
  records.push(...dataSource.filter((data) => keysSet.has(this.getRecordKey(data))));
353
354
  if (records.length < keys.length) for (const item of dataSource) {
354
355
  const children = get(item, childrenRecordName);
355
- if (Array.isArray(children) && children.length) records.push(...this.getRecordsByKeys(children, keys, keysSet));
356
+ if (Array.isArray(children)) records.push(...this.getRecordsByKeys(children, keys, keysSet));
356
357
  }
357
358
  }
358
359
  return records;
@@ -755,6 +756,17 @@ var TableFoundation = class TableFoundation extends BaseFoundation {
755
756
  const body = this.#trackScrollEdges ? this.adapter.getBodyWrapper() : null;
756
757
  if (body) TableFoundation.#syncScrollableEdges(body);
757
758
  };
759
+ /**
760
+ * Whether a sticky header follows the body through a scroll-driven animation, which the compositor runs in the
761
+ * frame it scrolls the body, rather than through scrollLeft writes a frame late. Probed after mount, like
762
+ * syncScrollEdges. Removable with the scrollLeft path once Chrome 116, Firefox 159 and Safari 26 are the minimum.
763
+ */
764
+ headerFollowsInCss = () => this.#headerFollowsInCss ??= CSS.supports("timeline-scope", "--semi-table-body-x");
765
+ /** Hosts call it after commits and body resizes of a sticky table: the distance the header's animation spans */
766
+ syncHeaderScrollRange = () => {
767
+ const body = this.headerFollowsInCss() ? this.adapter.getBodyWrapper() : null;
768
+ body?.parentElement?.style.setProperty("--semi-table-scroll-range", `${body.scrollWidth - body.clientWidth}px`);
769
+ };
758
770
  /** `index` is the header row the widths were measured in */
759
771
  setHeadWidths = (widths, index = 0) => {
760
772
  const prevHeadWidths = this.getState("headWidths") ?? [];
@@ -5,6 +5,11 @@
5
5
 
6
6
  $module: #{$prefix}-table;
7
7
 
8
+ // an RTL body scrolls toward its left end, so the sticky header's table moves right
9
+ .#{$module}-container:dir(rtl) {
10
+ --semi-table-scroll-sign: 1;
11
+ }
12
+
8
13
  .#{$module}-align-left:dir(rtl) .#{$module}-operate-wrapper {
9
14
  justify-content: flex-end;
10
15
  }
@@ -73,6 +73,14 @@
73
73
  .semi-table-container {
74
74
  position: relative;
75
75
  }
76
+ @supports (timeline-scope: --semi-table-body-x) {
77
+ .semi-table-container {
78
+ timeline-scope: --semi-table-body-x;
79
+ }
80
+ .semi-table-container > .semi-table-body {
81
+ scroll-timeline: --semi-table-body-x x;
82
+ }
83
+ }
76
84
  .semi-table-header {
77
85
  container-name: semi-table-scroll;
78
86
  container-type: scroll-state;
@@ -96,6 +104,41 @@
96
104
  .semi-table-header-sticky .semi-table-thead > .semi-table-row > .semi-table-row-head {
97
105
  background-color: var(--semi-color-bg-1);
98
106
  }
107
+ @supports (timeline-scope: --semi-table-body-x) {
108
+ .semi-table-header-sticky {
109
+ container-type: normal;
110
+ }
111
+ .semi-table-header-sticky > .semi-table {
112
+ animation: semi-table-header-follow linear both;
113
+ animation-timeline: --semi-table-body-x;
114
+ }
115
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row > .semi-table-cell-fixed-left, .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row > .semi-table-cell-fixed-right {
116
+ animation: semi-table-header-pin linear both;
117
+ animation-timeline: --semi-table-body-x;
118
+ }
119
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row > .semi-table-cell-fixed-left-last::after, .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row > .semi-table-cell-fixed-right-first::after {
120
+ animation: semi-table-header-edge-start linear both;
121
+ animation-timeline: --semi-table-body-x;
122
+ }
123
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row > .semi-table-cell-fixed-right-first::after, .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row:dir(rtl) > .semi-table-cell-fixed-left-last::after {
124
+ animation-name: semi-table-header-edge-end;
125
+ }
126
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row:dir(rtl) > .semi-table-cell-fixed-right-first::after {
127
+ animation-name: semi-table-header-edge-start;
128
+ }
129
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row:where(:not(.semi-table-bordered *)) > .semi-table-cell-fixed-left-last {
130
+ animation-name: semi-table-header-pin, semi-table-header-line-left-start;
131
+ }
132
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row:where(:not(.semi-table-bordered *)) > .semi-table-cell-fixed-right-first {
133
+ animation-name: semi-table-header-pin, semi-table-header-line-right-end;
134
+ }
135
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row:where(:not(.semi-table-bordered *)):dir(rtl) > .semi-table-cell-fixed-left-last {
136
+ animation-name: semi-table-header-pin, semi-table-header-line-left-end;
137
+ }
138
+ .semi-table-header-sticky > .semi-table > .semi-table-thead > .semi-table-row:where(:not(.semi-table-bordered *)):dir(rtl) > .semi-table-cell-fixed-right-first {
139
+ animation-name: semi-table-header-pin, semi-table-header-line-right-start;
140
+ }
141
+ }
99
142
  .semi-table-header-hidden {
100
143
  height: 0;
101
144
  }
@@ -131,6 +174,18 @@
131
174
  outline: 2px solid var(--semi-color-primary-light-active);
132
175
  outline-offset: -2px;
133
176
  }
177
+ .semi-table-fixed-header > .semi-table-container > .semi-table-body > .semi-table > .semi-table-thead {
178
+ position: sticky;
179
+ top: 0;
180
+ z-index: 102;
181
+ }
182
+ .semi-table-list-header {
183
+ position: sticky;
184
+ top: 0;
185
+ z-index: 102;
186
+ inline-size: fit-content;
187
+ min-inline-size: 100%;
188
+ }
134
189
  .semi-table-row:focus-visible {
135
190
  outline: 2px solid var(--semi-color-primary-light-active);
136
191
  outline-offset: -2px;
@@ -449,6 +504,12 @@
449
504
  :where(.semi-table-bordered) > .semi-table-container > .semi-table-footer {
450
505
  border-bottom: 1px solid var(--semi-color-border);
451
506
  }
507
+ :where(.semi-table-bordered > .semi-table-container > .semi-table-body) {
508
+ border-bottom: 1px solid var(--semi-color-border);
509
+ }
510
+ :where(.semi-table-bordered > .semi-table-container > .semi-table-body) > .semi-table > .semi-table-tbody > :last-child > .semi-table-row-cell, :where(.semi-table-bordered > .semi-table-container > .semi-table-body) > .semi-table-placeholder {
511
+ border-bottom: 0;
512
+ }
452
513
  :where(.semi-table-bordered > .semi-table-container > .semi-table-body) > .semi-table > .semi-table-thead > .semi-table-row > .semi-table-row-head .semi-table-resize-handle {
453
514
  background-color: transparent;
454
515
  }
@@ -609,6 +670,64 @@
609
670
  overflow-y: auto;
610
671
  }
611
672
 
673
+ @keyframes semi-table-header-follow {
674
+ to {
675
+ translate: calc(var(--semi-table-scroll-range, 0px) * var(--semi-table-scroll-sign, -1)) 0;
676
+ }
677
+ }
678
+ @keyframes semi-table-header-pin {
679
+ to {
680
+ translate: calc(var(--semi-table-scroll-range, 0px) * var(--semi-table-scroll-sign, -1) * -1) 0;
681
+ }
682
+ }
683
+ @keyframes semi-table-header-edge-start {
684
+ from {
685
+ opacity: 0;
686
+ }
687
+ 0.01%, to {
688
+ opacity: 1;
689
+ }
690
+ }
691
+ @keyframes semi-table-header-edge-end {
692
+ from, 99.99% {
693
+ opacity: 1;
694
+ }
695
+ to {
696
+ opacity: 0;
697
+ }
698
+ }
699
+ @keyframes semi-table-header-line-left-start {
700
+ from {
701
+ border-right-color: transparent;
702
+ }
703
+ 0.01%, to {
704
+ border-right-color: var(--semi-color-border);
705
+ }
706
+ }
707
+ @keyframes semi-table-header-line-left-end {
708
+ from, 99.99% {
709
+ border-right-color: var(--semi-color-border);
710
+ }
711
+ to {
712
+ border-right-color: transparent;
713
+ }
714
+ }
715
+ @keyframes semi-table-header-line-right-start {
716
+ from {
717
+ border-left-color: transparent;
718
+ }
719
+ 0.01%, to {
720
+ border-left-color: var(--semi-color-border);
721
+ }
722
+ }
723
+ @keyframes semi-table-header-line-right-end {
724
+ from, 99.99% {
725
+ border-left-color: var(--semi-color-border);
726
+ }
727
+ to {
728
+ border-left-color: transparent;
729
+ }
730
+ }
612
731
  .semi-table-column-filter-footer {
613
732
  display: flex;
614
733
  justify-content: flex-end;
@@ -617,6 +736,10 @@
617
736
  border-block-start: 1px solid var(--semi-color-border);
618
737
  }
619
738
 
739
+ .semi-table-container:dir(rtl) {
740
+ --semi-table-scroll-sign: 1;
741
+ }
742
+
620
743
  .semi-table-align-left:dir(rtl) .semi-table-operate-wrapper {
621
744
  justify-content: flex-end;
622
745
  }
@@ -56,6 +56,15 @@ $module: #{$prefix}-table;
56
56
 
57
57
  &-container {
58
58
  position: relative;
59
+
60
+ // scoped here so the sticky header, a sibling of the body, can follow the body's timeline
61
+ @supports (timeline-scope: --semi-table-body-x) {
62
+ timeline-scope: --semi-table-body-x;
63
+
64
+ & > .#{$module}-body {
65
+ scroll-timeline: --semi-table-body-x x;
66
+ }
67
+ }
59
68
  }
60
69
 
61
70
  &-header {
@@ -85,6 +94,63 @@ $module: #{$prefix}-table;
85
94
  .#{$module}-thead > .#{$module}-row > .#{$module}-row-head {
86
95
  background-color: $color-table-bg-default;
87
96
  }
97
+
98
+ // The header stuck to the page sits outside the body's scroller. A scroll-driven animation on the body's
99
+ // timeline shifts it, and holds its fixed cells in place, in the frame the compositor scrolls the body; the
100
+ // foundation writes the range. Elsewhere the host copies scrollLeft a frame late. Removable together with
101
+ // the foundation's headerFollowsInCss.
102
+ @supports (timeline-scope: --semi-table-body-x) {
103
+ // the header never scrolls itself, so its scroll state says nothing; the edges follow the body's timeline
104
+ container-type: normal;
105
+
106
+ & > .#{$module} {
107
+ animation: #{$module}-header-follow linear both;
108
+ animation-timeline: --semi-table-body-x;
109
+
110
+ & > .#{$module}-thead > .#{$module}-row {
111
+ & > .#{$module}-cell-fixed-left,
112
+ & > .#{$module}-cell-fixed-right {
113
+ animation: #{$module}-header-pin linear both;
114
+ animation-timeline: --semi-table-body-x;
115
+ }
116
+
117
+ & > .#{$module}-cell-fixed-left-last::after,
118
+ & > .#{$module}-cell-fixed-right-first::after {
119
+ animation: #{$module}-header-edge-start linear both;
120
+ animation-timeline: --semi-table-body-x;
121
+ }
122
+
123
+ // physical sides like the shadows: in RTL the body scrolls from its right end
124
+ & > .#{$module}-cell-fixed-right-first::after,
125
+ &:dir(rtl) > .#{$module}-cell-fixed-left-last::after {
126
+ animation-name: #{$module}-header-edge-end;
127
+ }
128
+
129
+ &:dir(rtl) > .#{$module}-cell-fixed-right-first::after {
130
+ animation-name: #{$module}-header-edge-start;
131
+ }
132
+
133
+ // without `bordered` the edge lines show only with the shadows
134
+ &:where(:not(.#{$module}-bordered *)) {
135
+ & > .#{$module}-cell-fixed-left-last {
136
+ animation-name: #{$module}-header-pin, #{$module}-header-line-left-start;
137
+ }
138
+
139
+ & > .#{$module}-cell-fixed-right-first {
140
+ animation-name: #{$module}-header-pin, #{$module}-header-line-right-end;
141
+ }
142
+
143
+ &:dir(rtl) > .#{$module}-cell-fixed-left-last {
144
+ animation-name: #{$module}-header-pin, #{$module}-header-line-left-end;
145
+ }
146
+
147
+ &:dir(rtl) > .#{$module}-cell-fixed-right-first {
148
+ animation-name: #{$module}-header-pin, #{$module}-header-line-right-start;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
88
154
  }
89
155
 
90
156
  &-hidden {
@@ -133,6 +199,23 @@ $module: #{$prefix}-table;
133
199
  &:focus-visible {
134
200
  @include focus-ring(-2px);
135
201
  }
202
+
203
+ // scroll.y keeps the header in the body's scroller, so the compositor moves both in the same frame; above the
204
+ // fixed body cells, and the fixed head cells inside stack above the other head cells
205
+ .#{$module}-fixed-header > .#{$module}-container > & > .#{$module} > .#{$module}-thead {
206
+ position: sticky;
207
+ top: 0;
208
+ z-index: $z-table_fixed_column + 1;
209
+ }
210
+ }
211
+
212
+ // the virtual list's header, in the list's scroller above the rows
213
+ &-list-header {
214
+ position: sticky;
215
+ top: 0;
216
+ z-index: $z-table_fixed_column + 1;
217
+ inline-size: fit-content;
218
+ min-inline-size: 100%;
136
219
  }
137
220
 
138
221
  // the scrolling body would clip an outside ring on a row focusable for drag sorting
@@ -552,7 +635,16 @@ $module: #{$prefix}-table;
552
635
  }
553
636
  }
554
637
 
638
+ // the container's side borders run down past a horizontal scrollbar; the body's bottom border closes the box
639
+ // below it, so the last row and the empty placeholder drop their own
555
640
  :where(& > .#{$module}-container > .#{$module}-body) {
641
+ border-bottom: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
642
+
643
+ & > .#{$module} > .#{$module}-tbody > :last-child > .#{$module}-row-cell,
644
+ & > .#{$module}-placeholder {
645
+ border-bottom: 0;
646
+ }
647
+
556
648
  & > .#{$module} > .#{$module}-thead > .#{$module}-row > .#{$module}-row-head {
557
649
  .#{$module}-resize-handle {
558
650
  background-color: transparent;
@@ -778,6 +870,88 @@ $module: #{$prefix}-table;
778
870
  }
779
871
  }
780
872
 
873
+ // the sticky header's table moves against the body's scroll, and its fixed cells move back by as much
874
+ @keyframes #{$module}-header-follow {
875
+ to {
876
+ translate: calc(var(--semi-table-scroll-range, 0px) * var(--semi-table-scroll-sign, -1)) 0;
877
+ }
878
+ }
879
+
880
+ @keyframes #{$module}-header-pin {
881
+ to {
882
+ translate: calc(var(--semi-table-scroll-range, 0px) * var(--semi-table-scroll-sign, -1) * -1) 0;
883
+ }
884
+ }
885
+
886
+ // a fixed edge shows while content hides behind it: past the scroll start, or short of the end
887
+ @keyframes #{$module}-header-edge-start {
888
+ from {
889
+ opacity: 0;
890
+ }
891
+
892
+ 0.01%,
893
+ to {
894
+ opacity: 1;
895
+ }
896
+ }
897
+
898
+ @keyframes #{$module}-header-edge-end {
899
+ from,
900
+ 99.99% {
901
+ opacity: 1;
902
+ }
903
+
904
+ to {
905
+ opacity: 0;
906
+ }
907
+ }
908
+
909
+ // stylelint-disable property-disallowed-list -- physical sides like the fixed-cell class names
910
+ @keyframes #{$module}-header-line-left-start {
911
+ from {
912
+ border-right-color: transparent;
913
+ }
914
+
915
+ 0.01%,
916
+ to {
917
+ border-right-color: $color-table_shadow-border-default;
918
+ }
919
+ }
920
+
921
+ @keyframes #{$module}-header-line-left-end {
922
+ from,
923
+ 99.99% {
924
+ border-right-color: $color-table_shadow-border-default;
925
+ }
926
+
927
+ to {
928
+ border-right-color: transparent;
929
+ }
930
+ }
931
+
932
+ @keyframes #{$module}-header-line-right-start {
933
+ from {
934
+ border-left-color: transparent;
935
+ }
936
+
937
+ 0.01%,
938
+ to {
939
+ border-left-color: $color-table_shadow-border-default;
940
+ }
941
+ }
942
+
943
+ @keyframes #{$module}-header-line-right-end {
944
+ from,
945
+ 99.99% {
946
+ border-left-color: $color-table_shadow-border-default;
947
+ }
948
+
949
+ to {
950
+ border-left-color: transparent;
951
+ }
952
+ }
953
+ // stylelint-enable property-disallowed-list
954
+
781
955
  .#{$module}-column-filter-footer {
782
956
  display: flex;
783
957
  justify-content: flex-end;
@@ -61,7 +61,7 @@
61
61
  justify-content: center;
62
62
  padding-block: 12px 12px;
63
63
  padding-inline: 8px 8px;
64
- margin: 12px;
64
+ margin: 12px 12px 0;
65
65
  font-weight: var(--semi-font-weight-bold);
66
66
  color: var(--semi-color-text-0);
67
67
  pointer-events: all;
@@ -86,7 +86,8 @@ $icon: #{$prefix}-toast-icon;
86
86
  justify-content: center;
87
87
  padding-block: $spacing-toast_content-paddingTop $spacing-toast_content-paddingBottom;
88
88
  padding-inline: $spacing-toast_content-paddingLeft $spacing-toast_content-paddingRight;
89
- margin: $spacing-toast_content-margin;
89
+ // no bottom margin: the gap between stacked toasts equals the first toast's distance from the top
90
+ margin: $spacing-toast_content-margin $spacing-toast_content-margin 0;
90
91
  font-weight: $font-toast_content-fontWeight;
91
92
  color: $color-toast-text-default;
92
93
  pointer-events: all;
@@ -308,10 +308,8 @@ var Tooltip = class Tooltip extends BaseFoundation {
308
308
  event.preventDefault();
309
309
  }
310
310
  #clearDelayTimer() {
311
- if (this.#timer) {
312
- clearTimeout(this.#timer);
313
- this.#timer = null;
314
- }
311
+ clearTimeout(this.#timer);
312
+ this.#timer = null;
315
313
  }
316
314
  /** Under a controlled `visible` that differs, a trigger only asks the owner (D-1); returns whether it asked */
317
315
  #requestFromOwner(visible) {
@@ -16,7 +16,7 @@
16
16
  outline: 2px solid var(--semi-color-primary-light-active);
17
17
  }
18
18
 
19
- [popover][data-semi-covered] {
19
+ :popover-open[data-semi-covered] {
20
20
  visibility: hidden;
21
21
  }
22
22
 
@@ -16,8 +16,10 @@ $module-icon: #{$module}-icon-arrow;
16
16
  @include focus-ring;
17
17
  }
18
18
 
19
- // utils/layer.ts marks a popup a modal layer covers: the top layer would otherwise paint it above the modal's mask
20
- [popover][data-semi-covered] {
19
+ // utils/layer.ts marks a popup a modal layer covers: the top layer would otherwise paint it above the modal's mask. A
20
+ // closed popover is not in the top layer and may be a box the page shows (a sidebar that is a drawer only on narrow
21
+ // screens); the mask covers it already
22
+ :popover-open[data-semi-covered] {
21
23
  visibility: hidden;
22
24
  }
23
25