@sia.soul/sia-react-ui 0.1.45 → 0.1.46

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.
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-H7IAG72O.js";
15
15
 
16
16
  // src/components/DatePicker.tsx
17
- import { useEffect, useId, useMemo, useRef as useRef2, useState } from "react";
17
+ import { useEffect, useId, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState } from "react";
18
18
 
19
19
  // src/components/DatePickerPanel.tsx
20
20
  import { useLayoutEffect, useRef } from "react";
@@ -496,6 +496,24 @@ function DateRangePicker({
496
496
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
497
497
  const [draftValue, setDraftValue] = useState(currentValue);
498
498
  const [activeIndex, setActiveIndex] = useState(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
499
+ const indicatorRef = useRef2(null);
500
+ useLayoutEffect2(() => {
501
+ const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
502
+ const indicator = indicatorRef.current;
503
+ if (!field || !indicator) return;
504
+ const alignIndicator = () => {
505
+ indicator.style.transform = `translateX(${field.offsetLeft}px)`;
506
+ indicator.style.width = `${field.offsetWidth}px`;
507
+ };
508
+ alignIndicator();
509
+ const observer = new ResizeObserver(alignIndicator);
510
+ const trigger = field.parentElement;
511
+ if (trigger) {
512
+ observer.observe(trigger);
513
+ for (const child of trigger.children) if (child !== indicator) observer.observe(child);
514
+ }
515
+ return () => observer.disconnect();
516
+ });
499
517
  const [confirmedIndex, setConfirmedIndex] = useState(null);
500
518
  const [presetSelected, setPresetSelected] = useState(false);
501
519
  const [hoverDate, setHoverDate] = useState("");
@@ -762,6 +780,7 @@ function DateRangePicker({
762
780
  /* @__PURE__ */ jsx2("span", { className: `sia-picker-range-control__value${displayValue[1] ? "" : " is-placeholder"}`, children: displayValue[1] ? formatValue(displayValue[1]) : placeholder[1] }),
763
781
  endFloating.label
764
782
  ] }),
783
+ /* @__PURE__ */ jsx2("span", { ref: indicatorRef, className: "sia-picker-range-control__indicator", "aria-hidden": "true" }),
765
784
  /* @__PURE__ */ jsx2("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ jsx2(Icon, { name: "calendar", size: 16 }) })
766
785
  ]
767
786
  }
package/dist/core.css CHANGED
@@ -121,15 +121,26 @@ fieldset:disabled .sia-input-number__floating-placeholder {
121
121
  min-width: 0;
122
122
  height: 100%;
123
123
  }
124
- .sia-picker-range-control__field.is-active::after {
125
- content: "";
124
+ .sia-picker-range-control > .sia-picker__trigger {
125
+ position: relative;
126
+ }
127
+ .sia-picker-range-control__indicator {
126
128
  position: absolute;
127
- right: 0;
128
129
  bottom: -1px;
129
130
  left: 0;
130
131
  height: 3px;
131
132
  background: var(--sia-color-primary);
132
133
  pointer-events: none;
134
+ visibility: hidden;
135
+ }
136
+ .sia-picker-range-control.is-open .sia-picker-range-control__indicator {
137
+ visibility: visible;
138
+ transition: transform 220ms ease, width 220ms ease;
139
+ }
140
+ @media (prefers-reduced-motion: reduce) {
141
+ .sia-picker-range-control.is-open .sia-picker-range-control__indicator {
142
+ transition: none;
143
+ }
133
144
  }
134
145
  .sia-picker-range-control__field.sia-placeholder-floating > .is-placeholder {
135
146
  color: transparent;
package/dist/index.cjs CHANGED
@@ -7487,6 +7487,24 @@ function DateRangePicker({
7487
7487
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
7488
7488
  const [draftValue, setDraftValue] = (0, import_react34.useState)(currentValue);
7489
7489
  const [activeIndex, setActiveIndex] = (0, import_react34.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
7490
+ const indicatorRef = (0, import_react34.useRef)(null);
7491
+ (0, import_react34.useLayoutEffect)(() => {
7492
+ const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
7493
+ const indicator = indicatorRef.current;
7494
+ if (!field || !indicator) return;
7495
+ const alignIndicator = () => {
7496
+ indicator.style.transform = `translateX(${field.offsetLeft}px)`;
7497
+ indicator.style.width = `${field.offsetWidth}px`;
7498
+ };
7499
+ alignIndicator();
7500
+ const observer = new ResizeObserver(alignIndicator);
7501
+ const trigger = field.parentElement;
7502
+ if (trigger) {
7503
+ observer.observe(trigger);
7504
+ for (const child of trigger.children) if (child !== indicator) observer.observe(child);
7505
+ }
7506
+ return () => observer.disconnect();
7507
+ });
7490
7508
  const [confirmedIndex, setConfirmedIndex] = (0, import_react34.useState)(null);
7491
7509
  const [presetSelected, setPresetSelected] = (0, import_react34.useState)(false);
7492
7510
  const [hoverDate, setHoverDate] = (0, import_react34.useState)("");
@@ -7753,6 +7771,7 @@ function DateRangePicker({
7753
7771
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: `sia-picker-range-control__value${displayValue[1] ? "" : " is-placeholder"}`, children: displayValue[1] ? formatValue2(displayValue[1]) : placeholder[1] }),
7754
7772
  endFloating.label
7755
7773
  ] }),
7774
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { ref: indicatorRef, className: "sia-picker-range-control__indicator", "aria-hidden": "true" }),
7756
7775
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "calendar", size: 16 }) })
7757
7776
  ]
7758
7777
  }
@@ -11994,6 +12013,12 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
11994
12013
  ctx.clearRect(0, 0, width, height);
11995
12014
  const style = getComputedStyle(scroller);
11996
12015
  const foreground = style.color;
12016
+ const readyCells = /* @__PURE__ */ new Map();
12017
+ scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
12018
+ const keys = /* @__PURE__ */ new Set();
12019
+ element.querySelectorAll('[data-canvas-dom-ready="true"]').forEach((cell) => keys.add(cell.dataset.columnKey));
12020
+ readyCells.set(Number(element.dataset.canvasRowIndex), keys);
12021
+ });
11997
12022
  ctx.font = `${style.fontSize} ${style.fontFamily}`;
11998
12023
  ctx.textBaseline = "middle";
11999
12024
  const leftWidth = columns.reduce((n, c) => n + (normalizeFixed(c.fixed) === "left" ? widths.get(c.key) ?? 160 : 0), 0);
@@ -12011,7 +12036,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
12011
12036
  const first = Math.max(0, Math.floor(scroller.scrollTop / rowHeight));
12012
12037
  const last = Math.min(rows.length, Math.ceil((scroller.scrollTop + height) / rowHeight));
12013
12038
  for (const { column, x, cellWidth, fixed } of geometry) {
12014
- if (x + cellWidth <= 0 || x >= width || !column.canvasRender && column.render) continue;
12039
+ if (x + cellWidth <= 0 || x >= width) continue;
12015
12040
  const clipLeft = Math.max(x, fixed ? 0 : leftWidth);
12016
12041
  const clipRight = Math.min(x + cellWidth, fixed ? width : width - rightWidth);
12017
12042
  if (clipRight <= clipLeft) continue;
@@ -12021,12 +12046,26 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
12021
12046
  ctx.clip();
12022
12047
  for (let index = first; index < last; index++) {
12023
12048
  const row = rows[index];
12024
- const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
12025
- const content = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
12026
- if (!content?.text) continue;
12027
12049
  const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
12028
- const available = Math.max(0, cellWidth - (content.background ? 32 : 16));
12029
- let text = content.text;
12050
+ if (!column.canvasRender && column.render) {
12051
+ if (!readyCells.get(index)?.has(column.key)) {
12052
+ const skeletonWidth = Math.max(0, Math.min(cellWidth - 24, 120));
12053
+ const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - 8 : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + 8;
12054
+ ctx.save();
12055
+ ctx.fillStyle = foreground;
12056
+ ctx.globalAlpha = 0.12;
12057
+ ctx.beginPath();
12058
+ ctx.roundRect(skeletonX, y - 6, skeletonWidth, 12, 4);
12059
+ ctx.fill();
12060
+ ctx.restore();
12061
+ }
12062
+ continue;
12063
+ }
12064
+ const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
12065
+ const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
12066
+ if (!content2?.text) continue;
12067
+ const available = Math.max(0, cellWidth - (content2.background ? 32 : 16));
12068
+ let text = content2.text;
12030
12069
  if (ctx.measureText(text).width > available) {
12031
12070
  let lo = 0, hi = text.length;
12032
12071
  while (lo < hi) {
@@ -12037,16 +12076,16 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
12037
12076
  text = text.slice(0, lo) + "\u2026";
12038
12077
  }
12039
12078
  const textWidth = ctx.measureText(text).width;
12040
- const total = textWidth + (content.background ? 16 : 0);
12079
+ const total = textWidth + (content2.background ? 16 : 0);
12041
12080
  const tx = column.align === "right" ? x + cellWidth - total - 8 : column.align === "center" ? x + (cellWidth - total) / 2 : x + 8;
12042
- if (content.background) {
12043
- ctx.fillStyle = content.background;
12081
+ if (content2.background) {
12082
+ ctx.fillStyle = content2.background;
12044
12083
  ctx.beginPath();
12045
12084
  ctx.roundRect(tx, y - 12, total, 24, 4);
12046
12085
  ctx.fill();
12047
12086
  }
12048
- ctx.fillStyle = content.color ?? foreground;
12049
- ctx.fillText(text, tx + (content.background ? 8 : 0), y);
12087
+ ctx.fillStyle = content2.color ?? foreground;
12088
+ ctx.fillText(text, tx + (content2.background ? 8 : 0), y);
12050
12089
  }
12051
12090
  ctx.restore();
12052
12091
  }
@@ -12057,6 +12096,8 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
12057
12096
  scroller.addEventListener("scroll", schedule, { passive: true });
12058
12097
  const resize = new ResizeObserver(schedule);
12059
12098
  resize.observe(scroller);
12099
+ const content = new MutationObserver(schedule);
12100
+ content.observe(scroller, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-canvas-row-index", "data-canvas-dom-ready", "data-column-key"] });
12060
12101
  const theme = new MutationObserver(schedule);
12061
12102
  theme.observe(document.documentElement, { attributes: true });
12062
12103
  window.addEventListener("resize", schedule);
@@ -12064,6 +12105,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
12064
12105
  return () => {
12065
12106
  cancelAnimationFrame(frame);
12066
12107
  resize.disconnect();
12108
+ content.disconnect();
12067
12109
  theme.disconnect();
12068
12110
  scroller.removeEventListener("scroll", schedule);
12069
12111
  window.removeEventListener("resize", schedule);
@@ -14613,6 +14655,7 @@ var TableBodyRow = (0, import_react52.memo)(function TableBodyRow2({
14613
14655
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
14614
14656
  "tr",
14615
14657
  {
14658
+ "data-canvas-row-index": canvas ? rowIndex : void 0,
14616
14659
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
14617
14660
  style: { height: rowHeight },
14618
14661
  onClick,
@@ -14638,6 +14681,7 @@ var TableBodyRow = (0, import_react52.memo)(function TableBodyRow2({
14638
14681
  "td",
14639
14682
  {
14640
14683
  "data-column-key": column.key,
14684
+ "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
14641
14685
  "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
14642
14686
  rowSpan: pluginCellProps.rowSpan,
14643
14687
  colSpan: pluginCellProps.colSpan,
package/dist/index.css CHANGED
@@ -121,15 +121,26 @@ fieldset:disabled .sia-input-number__floating-placeholder {
121
121
  min-width: 0;
122
122
  height: 100%;
123
123
  }
124
- .sia-picker-range-control__field.is-active::after {
125
- content: "";
124
+ .sia-picker-range-control > .sia-picker__trigger {
125
+ position: relative;
126
+ }
127
+ .sia-picker-range-control__indicator {
126
128
  position: absolute;
127
- right: 0;
128
129
  bottom: -1px;
129
130
  left: 0;
130
131
  height: 3px;
131
132
  background: var(--sia-color-primary);
132
133
  pointer-events: none;
134
+ visibility: hidden;
135
+ }
136
+ .sia-picker-range-control.is-open .sia-picker-range-control__indicator {
137
+ visibility: visible;
138
+ transition: transform 220ms ease, width 220ms ease;
139
+ }
140
+ @media (prefers-reduced-motion: reduce) {
141
+ .sia-picker-range-control.is-open .sia-picker-range-control__indicator {
142
+ transition: none;
143
+ }
133
144
  }
134
145
  .sia-picker-range-control__field.sia-placeholder-floating > .is-placeholder {
135
146
  color: transparent;
package/dist/index.d.cts CHANGED
@@ -5,7 +5,7 @@ import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttribut
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
6
6
  import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult, B as ButtonProps, e as ButtonSize } from './Select-YJbT-MF1.cjs';
7
7
  export { f as Button, g as ButtonVariant, h as Modal, i as ModalProps, j as ModalType, k as Select, l as SelectMode, m as SelectValue } from './Select-YJbT-MF1.cjs';
8
- export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-2galnCvZ.cjs';
8
+ export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CyfCT32j.cjs';
9
9
  export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.cjs';
10
10
  export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.cjs';
11
11
  import * as Monaco from 'monaco-editor';
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttribut
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
6
6
  import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult, B as ButtonProps, e as ButtonSize } from './Select-CCrPqULn.js';
7
7
  export { f as Button, g as ButtonVariant, h as Modal, i as ModalProps, j as ModalType, k as Select, l as SelectMode, m as SelectValue } from './Select-CCrPqULn.js';
8
- export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-Dtj6XF9I.js';
8
+ export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-B1ZWIHoe.js';
9
9
  export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.js';
10
10
  export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.js';
11
11
  import * as Monaco from 'monaco-editor';
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  DatePicker,
96
96
  SelectDateRange,
97
97
  TimePanel
98
- } from "./chunk-QIXU7N4X.js";
98
+ } from "./chunk-E4RMSZOC.js";
99
99
  import {
100
100
  Checkbox,
101
101
  FloatingScrollbarProvider,
@@ -4785,6 +4785,12 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
4785
4785
  ctx.clearRect(0, 0, width, height);
4786
4786
  const style = getComputedStyle(scroller);
4787
4787
  const foreground = style.color;
4788
+ const readyCells = /* @__PURE__ */ new Map();
4789
+ scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
4790
+ const keys = /* @__PURE__ */ new Set();
4791
+ element.querySelectorAll('[data-canvas-dom-ready="true"]').forEach((cell) => keys.add(cell.dataset.columnKey));
4792
+ readyCells.set(Number(element.dataset.canvasRowIndex), keys);
4793
+ });
4788
4794
  ctx.font = `${style.fontSize} ${style.fontFamily}`;
4789
4795
  ctx.textBaseline = "middle";
4790
4796
  const leftWidth = columns.reduce((n, c) => n + (normalizeFixed(c.fixed) === "left" ? widths.get(c.key) ?? 160 : 0), 0);
@@ -4802,7 +4808,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
4802
4808
  const first = Math.max(0, Math.floor(scroller.scrollTop / rowHeight));
4803
4809
  const last = Math.min(rows.length, Math.ceil((scroller.scrollTop + height) / rowHeight));
4804
4810
  for (const { column, x, cellWidth, fixed } of geometry) {
4805
- if (x + cellWidth <= 0 || x >= width || !column.canvasRender && column.render) continue;
4811
+ if (x + cellWidth <= 0 || x >= width) continue;
4806
4812
  const clipLeft = Math.max(x, fixed ? 0 : leftWidth);
4807
4813
  const clipRight = Math.min(x + cellWidth, fixed ? width : width - rightWidth);
4808
4814
  if (clipRight <= clipLeft) continue;
@@ -4812,12 +4818,26 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
4812
4818
  ctx.clip();
4813
4819
  for (let index = first; index < last; index++) {
4814
4820
  const row = rows[index];
4815
- const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
4816
- const content = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
4817
- if (!content?.text) continue;
4818
4821
  const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
4819
- const available = Math.max(0, cellWidth - (content.background ? 32 : 16));
4820
- let text = content.text;
4822
+ if (!column.canvasRender && column.render) {
4823
+ if (!readyCells.get(index)?.has(column.key)) {
4824
+ const skeletonWidth = Math.max(0, Math.min(cellWidth - 24, 120));
4825
+ const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - 8 : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + 8;
4826
+ ctx.save();
4827
+ ctx.fillStyle = foreground;
4828
+ ctx.globalAlpha = 0.12;
4829
+ ctx.beginPath();
4830
+ ctx.roundRect(skeletonX, y - 6, skeletonWidth, 12, 4);
4831
+ ctx.fill();
4832
+ ctx.restore();
4833
+ }
4834
+ continue;
4835
+ }
4836
+ const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
4837
+ const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
4838
+ if (!content2?.text) continue;
4839
+ const available = Math.max(0, cellWidth - (content2.background ? 32 : 16));
4840
+ let text = content2.text;
4821
4841
  if (ctx.measureText(text).width > available) {
4822
4842
  let lo = 0, hi = text.length;
4823
4843
  while (lo < hi) {
@@ -4828,16 +4848,16 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
4828
4848
  text = text.slice(0, lo) + "\u2026";
4829
4849
  }
4830
4850
  const textWidth = ctx.measureText(text).width;
4831
- const total = textWidth + (content.background ? 16 : 0);
4851
+ const total = textWidth + (content2.background ? 16 : 0);
4832
4852
  const tx = column.align === "right" ? x + cellWidth - total - 8 : column.align === "center" ? x + (cellWidth - total) / 2 : x + 8;
4833
- if (content.background) {
4834
- ctx.fillStyle = content.background;
4853
+ if (content2.background) {
4854
+ ctx.fillStyle = content2.background;
4835
4855
  ctx.beginPath();
4836
4856
  ctx.roundRect(tx, y - 12, total, 24, 4);
4837
4857
  ctx.fill();
4838
4858
  }
4839
- ctx.fillStyle = content.color ?? foreground;
4840
- ctx.fillText(text, tx + (content.background ? 8 : 0), y);
4859
+ ctx.fillStyle = content2.color ?? foreground;
4860
+ ctx.fillText(text, tx + (content2.background ? 8 : 0), y);
4841
4861
  }
4842
4862
  ctx.restore();
4843
4863
  }
@@ -4848,6 +4868,8 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
4848
4868
  scroller.addEventListener("scroll", schedule, { passive: true });
4849
4869
  const resize = new ResizeObserver(schedule);
4850
4870
  resize.observe(scroller);
4871
+ const content = new MutationObserver(schedule);
4872
+ content.observe(scroller, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-canvas-row-index", "data-canvas-dom-ready", "data-column-key"] });
4851
4873
  const theme = new MutationObserver(schedule);
4852
4874
  theme.observe(document.documentElement, { attributes: true });
4853
4875
  window.addEventListener("resize", schedule);
@@ -4855,6 +4877,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
4855
4877
  return () => {
4856
4878
  cancelAnimationFrame(frame);
4857
4879
  resize.disconnect();
4880
+ content.disconnect();
4858
4881
  theme.disconnect();
4859
4882
  scroller.removeEventListener("scroll", schedule);
4860
4883
  window.removeEventListener("resize", schedule);
@@ -7404,6 +7427,7 @@ var TableBodyRow = memo(function TableBodyRow2({
7404
7427
  return /* @__PURE__ */ jsx23(
7405
7428
  "tr",
7406
7429
  {
7430
+ "data-canvas-row-index": canvas ? rowIndex : void 0,
7407
7431
  className: `sia-table__row${striped && rowIndex % 2 === 1 ? " sia-table__row--striped" : ""} ${className}`.trim(),
7408
7432
  style: { height: rowHeight },
7409
7433
  onClick,
@@ -7429,6 +7453,7 @@ var TableBodyRow = memo(function TableBodyRow2({
7429
7453
  "td",
7430
7454
  {
7431
7455
  "data-column-key": column.key,
7456
+ "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
7432
7457
  "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
7433
7458
  rowSpan: pluginCellProps.rowSpan,
7434
7459
  colSpan: pluginCellProps.colSpan,
@@ -142,7 +142,7 @@ interface DateRangePickerProps extends Omit<DatePickerProps, "value" | "defaultV
142
142
  /** 值发生变化时调用;参数为新值及类型声明中列出的关联信息。 */
143
143
  onChange?: (value: readonly [string, string]) => void;
144
144
  }
145
- /** 日期范围选择;纯日期按两次点击组成范围,带时间时使用单面板分步设置起止值并确认提交。 */
145
+ /** 日期范围选择;纯日期按两次点击组成范围,带时间时使用单面板分步设置起止值并确认提交,活动底线随编辑端点平滑移动。 */
146
146
  declare function DateRangePicker({ value, defaultValue, placeholder, placeholderMode, separator, presets, maxRangeDays, allowEmpty, endpointDisabled, size: sizeProp, status, allowClear, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, disabledDate, disabled, className, onCalendarChange, onChange, onOpenChange, formatValue, renderExtraFooter, ...props }: DateRangePickerProps): react.JSX.Element;
147
147
  /** 日期选择组件。 */
148
148
  declare function DatePicker({ value, defaultValue, picker, size: sizeProp, status, allowClear, multiple, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, presets, disabledDate, disabled, className, onChange, onOpenChange, placeholder, placeholderMode, formatValue, renderExtraFooter, ...props }: DatePickerProps): react.JSX.Element;
@@ -142,7 +142,7 @@ interface DateRangePickerProps extends Omit<DatePickerProps, "value" | "defaultV
142
142
  /** 值发生变化时调用;参数为新值及类型声明中列出的关联信息。 */
143
143
  onChange?: (value: readonly [string, string]) => void;
144
144
  }
145
- /** 日期范围选择;纯日期按两次点击组成范围,带时间时使用单面板分步设置起止值并确认提交。 */
145
+ /** 日期范围选择;纯日期按两次点击组成范围,带时间时使用单面板分步设置起止值并确认提交,活动底线随编辑端点平滑移动。 */
146
146
  declare function DateRangePicker({ value, defaultValue, placeholder, placeholderMode, separator, presets, maxRangeDays, allowEmpty, endpointDisabled, size: sizeProp, status, allowClear, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, disabledDate, disabled, className, onCalendarChange, onChange, onOpenChange, formatValue, renderExtraFooter, ...props }: DateRangePickerProps): react.JSX.Element;
147
147
  /** 日期选择组件。 */
148
148
  declare function DatePicker({ value, defaultValue, picker, size: sizeProp, status, allowClear, multiple, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, presets, disabledDate, disabled, className, onChange, onOpenChange, placeholder, placeholderMode, formatValue, renderExtraFooter, ...props }: DatePickerProps): react.JSX.Element;
@@ -2005,6 +2005,24 @@ function DateRangePicker({
2005
2005
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
2006
2006
  const [draftValue, setDraftValue] = (0, import_react7.useState)(currentValue);
2007
2007
  const [activeIndex, setActiveIndex] = (0, import_react7.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
2008
+ const indicatorRef = (0, import_react7.useRef)(null);
2009
+ (0, import_react7.useLayoutEffect)(() => {
2010
+ const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
2011
+ const indicator = indicatorRef.current;
2012
+ if (!field || !indicator) return;
2013
+ const alignIndicator = () => {
2014
+ indicator.style.transform = `translateX(${field.offsetLeft}px)`;
2015
+ indicator.style.width = `${field.offsetWidth}px`;
2016
+ };
2017
+ alignIndicator();
2018
+ const observer = new ResizeObserver(alignIndicator);
2019
+ const trigger = field.parentElement;
2020
+ if (trigger) {
2021
+ observer.observe(trigger);
2022
+ for (const child of trigger.children) if (child !== indicator) observer.observe(child);
2023
+ }
2024
+ return () => observer.disconnect();
2025
+ });
2008
2026
  const [confirmedIndex, setConfirmedIndex] = (0, import_react7.useState)(null);
2009
2027
  const [presetSelected, setPresetSelected] = (0, import_react7.useState)(false);
2010
2028
  const [hoverDate, setHoverDate] = (0, import_react7.useState)("");
@@ -2271,6 +2289,7 @@ function DateRangePicker({
2271
2289
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: `sia-picker-range-control__value${displayValue[1] ? "" : " is-placeholder"}`, children: displayValue[1] ? formatValue(displayValue[1]) : placeholder[1] }),
2272
2290
  endFloating.label
2273
2291
  ] }),
2292
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { ref: indicatorRef, className: "sia-picker-range-control__indicator", "aria-hidden": "true" }),
2274
2293
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: "calendar", size: 16 }) })
2275
2294
  ]
2276
2295
  }
@@ -1,4 +1,4 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-2galnCvZ.cjs';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CyfCT32j.cjs';
2
2
  import 'react';
3
3
  import './shared-Bx4B28Wh.cjs';
4
4
  import './Select-YJbT-MF1.cjs';
@@ -1,4 +1,4 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-Dtj6XF9I.js';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-B1ZWIHoe.js';
2
2
  import 'react';
3
3
  import './shared-Bx4B28Wh.js';
4
4
  import './Select-CCrPqULn.js';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-QIXU7N4X.js";
3
+ } from "./chunk-E4RMSZOC.js";
4
4
  import "./chunk-NYJSSPIX.js";
5
5
  import "./chunk-XCVAVCIO.js";
6
6
  import "./chunk-IKAMZNCK.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",