@sia.soul/sia-react-ui 0.1.128 → 0.1.129

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/dist/core.css CHANGED
@@ -3769,6 +3769,32 @@ fieldset:disabled .sia-input-number__floating-placeholder {
3769
3769
  min-width: 0;
3770
3770
  gap: 5px;
3771
3771
  }
3772
+ .sia-table__header-label--required .sia-table__header-label-content,
3773
+ .sia-table__required-mark {
3774
+ color: var(--sia-color-error);
3775
+ }
3776
+ .sia-table__required-mark {
3777
+ flex: 0 0 auto;
3778
+ }
3779
+ .sia-table .sia-table__row td.sia-table__cell.sia-table__cell--invalid {
3780
+ isolation: isolate;
3781
+ background-image:
3782
+ repeating-linear-gradient(
3783
+ 135deg,
3784
+ color-mix(in srgb, var(--sia-color-error) 9%, transparent) 0 7px,
3785
+ transparent 7px 14px);
3786
+ }
3787
+ .sia-table__cell--invalid::before {
3788
+ position: absolute;
3789
+ z-index: 9;
3790
+ right: 0;
3791
+ bottom: 0;
3792
+ left: 0;
3793
+ height: 3px;
3794
+ content: "";
3795
+ background: var(--sia-color-error);
3796
+ pointer-events: none;
3797
+ }
3772
3798
  .sia-table__header-label-content {
3773
3799
  display: block;
3774
3800
  min-width: 0;
package/dist/game.css CHANGED
@@ -3778,6 +3778,32 @@ fieldset:disabled .sia-input-number__floating-placeholder {
3778
3778
  min-width: 0;
3779
3779
  gap: 5px;
3780
3780
  }
3781
+ .sia-table__header-label--required .sia-table__header-label-content,
3782
+ .sia-table__required-mark {
3783
+ color: var(--sia-color-error);
3784
+ }
3785
+ .sia-table__required-mark {
3786
+ flex: 0 0 auto;
3787
+ }
3788
+ .sia-table .sia-table__row td.sia-table__cell.sia-table__cell--invalid {
3789
+ isolation: isolate;
3790
+ background-image:
3791
+ repeating-linear-gradient(
3792
+ 135deg,
3793
+ color-mix(in srgb, var(--sia-color-error) 9%, transparent) 0 7px,
3794
+ transparent 7px 14px);
3795
+ }
3796
+ .sia-table__cell--invalid::before {
3797
+ position: absolute;
3798
+ z-index: 9;
3799
+ right: 0;
3800
+ bottom: 0;
3801
+ left: 0;
3802
+ height: 3px;
3803
+ content: "";
3804
+ background: var(--sia-color-error);
3805
+ pointer-events: none;
3806
+ }
3781
3807
  .sia-table__header-label-content {
3782
3808
  display: block;
3783
3809
  min-width: 0;
package/dist/index.cjs CHANGED
@@ -16438,6 +16438,7 @@ var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
16438
16438
  const pluginCellProps = getCellProps(column);
16439
16439
  if (pluginCellProps.hidden) return null;
16440
16440
  const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
16441
+ const invalid = typeof column.invalid === "function" ? column.invalid(row.record, row.sourceIndex) : column.invalid;
16441
16442
  const cellClass = typeof column.cellClassName === "function" ? column.cellClassName(row.record, rowIndex) : column.cellClassName ?? "";
16442
16443
  const fixed = normalizeFixed(column.fixed);
16443
16444
  const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
@@ -16447,11 +16448,12 @@ var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
16447
16448
  "td",
16448
16449
  {
16449
16450
  "data-column-key": column.key,
16451
+ "aria-invalid": invalid || void 0,
16450
16452
  "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
16451
16453
  "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
16452
16454
  rowSpan: pluginCellProps.rowSpan,
16453
16455
  colSpan: pluginCellProps.colSpan,
16454
- className: `sia-table__cell sia-table__cell--${column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}${column.ellipsis !== false ? " sia-table__cell--ellipsis" : ""} ${cellClass} ${pluginCellProps.className ?? ""}`.trim(),
16456
+ className: `sia-table__cell sia-table__cell--${column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}${invalid ? " sia-table__cell--invalid" : ""}${column.ellipsis !== false ? " sia-table__cell--ellipsis" : ""} ${cellClass} ${pluginCellProps.className ?? ""}`.trim(),
16455
16457
  style: { ...fixedStyle, ...pluginCellProps.style },
16456
16458
  onMouseEnter: () => onCellMouseEnter(column),
16457
16459
  onMouseLeave: () => onCellMouseLeave(column),
@@ -16903,7 +16905,8 @@ function TableInner(props, ref) {
16903
16905
  }
16904
16906
  function renderHeaderContent(column, content) {
16905
16907
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
16906
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "sia-table__header-label", children: [
16908
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
16909
+ column.required && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
16907
16910
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
16908
16911
  column.description != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Icon, { name: "info", size: 14 }) }) })
16909
16912
  ] });
package/dist/index.css CHANGED
@@ -3769,6 +3769,32 @@ fieldset:disabled .sia-input-number__floating-placeholder {
3769
3769
  min-width: 0;
3770
3770
  gap: 5px;
3771
3771
  }
3772
+ .sia-table__header-label--required .sia-table__header-label-content,
3773
+ .sia-table__required-mark {
3774
+ color: var(--sia-color-error);
3775
+ }
3776
+ .sia-table__required-mark {
3777
+ flex: 0 0 auto;
3778
+ }
3779
+ .sia-table .sia-table__row td.sia-table__cell.sia-table__cell--invalid {
3780
+ isolation: isolate;
3781
+ background-image:
3782
+ repeating-linear-gradient(
3783
+ 135deg,
3784
+ color-mix(in srgb, var(--sia-color-error) 9%, transparent) 0 7px,
3785
+ transparent 7px 14px);
3786
+ }
3787
+ .sia-table__cell--invalid::before {
3788
+ position: absolute;
3789
+ z-index: 9;
3790
+ right: 0;
3791
+ bottom: 0;
3792
+ left: 0;
3793
+ height: 3px;
3794
+ content: "";
3795
+ background: var(--sia-color-error);
3796
+ pointer-events: none;
3797
+ }
3772
3798
  .sia-table__header-label-content {
3773
3799
  display: block;
3774
3800
  min-width: 0;
@@ -11186,6 +11212,9 @@ body > .sia-title-tooltip[data-sia-popup-layer] {
11186
11212
  .sia-table__worksheet-fill-preview {
11187
11213
  box-shadow: inset 0 0 0 1px var(--sia-color-primary);
11188
11214
  }
11215
+ .sia-table__cell--invalid .sia-table__worksheet-handle {
11216
+ z-index: 10;
11217
+ }
11189
11218
  .sia-table__worksheet-tools {
11190
11219
  display: inline-flex;
11191
11220
  align-items: center;
package/dist/index.d.cts CHANGED
@@ -2053,6 +2053,10 @@ interface TableColumn<T = Record<string, unknown>> {
2053
2053
  name?: string;
2054
2054
  /** 列头内容,可传入文本或 React 节点;默认单行显示,仅文字实际超宽省略时通过框架 title 提示展示完整文本,完整显示时不提示。节点无法提取文本时使用 name 或 key。 */
2055
2055
  title?: ReactNode;
2056
+ /** 是否以红色列名和前置红色星号标识必填列,默认 false;仅表达列头语义,不自动校验单元格。 */
2057
+ required?: boolean;
2058
+ /** 单元格是否校验失败,默认 false;可按行数据和源数据索引返回布尔值。失败时显示淡红斜纹和 3px 红色底线,不插入图标、不改变行高;业务负责判断空值、格式或其他错误。 */
2059
+ invalid?: boolean | ((record: T, index: number) => boolean);
2056
2060
  /** 补充说明内容。 */
2057
2061
  description?: ReactNode;
2058
2062
  /** 读取单元格值的字段名或嵌套路径。 */
package/dist/index.d.ts CHANGED
@@ -2053,6 +2053,10 @@ interface TableColumn<T = Record<string, unknown>> {
2053
2053
  name?: string;
2054
2054
  /** 列头内容,可传入文本或 React 节点;默认单行显示,仅文字实际超宽省略时通过框架 title 提示展示完整文本,完整显示时不提示。节点无法提取文本时使用 name 或 key。 */
2055
2055
  title?: ReactNode;
2056
+ /** 是否以红色列名和前置红色星号标识必填列,默认 false;仅表达列头语义,不自动校验单元格。 */
2057
+ required?: boolean;
2058
+ /** 单元格是否校验失败,默认 false;可按行数据和源数据索引返回布尔值。失败时显示淡红斜纹和 3px 红色底线,不插入图标、不改变行高;业务负责判断空值、格式或其他错误。 */
2059
+ invalid?: boolean | ((record: T, index: number) => boolean);
2056
2060
  /** 补充说明内容。 */
2057
2061
  description?: ReactNode;
2058
2062
  /** 读取单元格值的字段名或嵌套路径。 */
package/dist/index.js CHANGED
@@ -8370,6 +8370,7 @@ var TableBodyRow = memo(function TableBodyRow2({
8370
8370
  const pluginCellProps = getCellProps(column);
8371
8371
  if (pluginCellProps.hidden) return null;
8372
8372
  const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
8373
+ const invalid = typeof column.invalid === "function" ? column.invalid(row.record, row.sourceIndex) : column.invalid;
8373
8374
  const cellClass = typeof column.cellClassName === "function" ? column.cellClassName(row.record, rowIndex) : column.cellClassName ?? "";
8374
8375
  const fixed = normalizeFixed(column.fixed);
8375
8376
  const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
@@ -8379,11 +8380,12 @@ var TableBodyRow = memo(function TableBodyRow2({
8379
8380
  "td",
8380
8381
  {
8381
8382
  "data-column-key": column.key,
8383
+ "aria-invalid": invalid || void 0,
8382
8384
  "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
8383
8385
  "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
8384
8386
  rowSpan: pluginCellProps.rowSpan,
8385
8387
  colSpan: pluginCellProps.colSpan,
8386
- className: `sia-table__cell sia-table__cell--${column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}${column.ellipsis !== false ? " sia-table__cell--ellipsis" : ""} ${cellClass} ${pluginCellProps.className ?? ""}`.trim(),
8388
+ className: `sia-table__cell sia-table__cell--${column.align ?? "left"}${fixed ? ` sia-table__cell--fixed sia-table__cell--fixed-${fixed}` : ""}${fixedEdgeClass}${autoWidthClass}${invalid ? " sia-table__cell--invalid" : ""}${column.ellipsis !== false ? " sia-table__cell--ellipsis" : ""} ${cellClass} ${pluginCellProps.className ?? ""}`.trim(),
8387
8389
  style: { ...fixedStyle, ...pluginCellProps.style },
8388
8390
  onMouseEnter: () => onCellMouseEnter(column),
8389
8391
  onMouseLeave: () => onCellMouseLeave(column),
@@ -8835,7 +8837,8 @@ function TableInner(props, ref) {
8835
8837
  }
8836
8838
  function renderHeaderContent(column, content) {
8837
8839
  const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
8838
- return /* @__PURE__ */ jsxs23("span", { className: "sia-table__header-label", children: [
8840
+ return /* @__PURE__ */ jsxs23("span", { className: `sia-table__header-label${column.required ? " sia-table__header-label--required" : ""}`, children: [
8841
+ column.required && /* @__PURE__ */ jsx25("span", { className: "sia-table__required-mark", "aria-hidden": "true", children: "*" }),
8839
8842
  /* @__PURE__ */ jsx25("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
8840
8843
  column.description != null && /* @__PURE__ */ jsx25(Tooltip, { title: column.description, placement: "top", trigger: ["hover", "focus"], children: /* @__PURE__ */ jsx25("button", { type: "button", className: "sia-table__header-description", "aria-label": `${column.name ?? column.key}\u5217\u8BF4\u660E`, onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx25(Icon, { name: "info", size: 14 }) }) })
8841
8844
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.128",
3
+ "version": "0.1.129",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",