@sia.soul/sia-react-ui 0.1.127 → 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 +28 -2
- package/dist/game.css +28 -2
- package/dist/index.cjs +13 -5
- package/dist/index.css +42 -6
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +13 -5
- package/package.json +1 -1
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;
|
|
@@ -4255,12 +4281,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4255
4281
|
overflow: hidden;
|
|
4256
4282
|
text-overflow: ellipsis;
|
|
4257
4283
|
}
|
|
4258
|
-
.sia-table__editable-display .sia-icon {
|
|
4284
|
+
.sia-table__editable-display > .sia-icon {
|
|
4259
4285
|
flex: 0 0 auto;
|
|
4260
4286
|
color: var(--sia-color-primary-text);
|
|
4261
4287
|
opacity: 0;
|
|
4262
4288
|
}
|
|
4263
|
-
.sia-table__editable-display:hover .sia-icon {
|
|
4289
|
+
.sia-table__editable-display:hover > .sia-icon {
|
|
4264
4290
|
opacity: 1;
|
|
4265
4291
|
}
|
|
4266
4292
|
.sia-table__cell-content:has(> .sia-table__editor) {
|
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;
|
|
@@ -4264,12 +4290,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4264
4290
|
overflow: hidden;
|
|
4265
4291
|
text-overflow: ellipsis;
|
|
4266
4292
|
}
|
|
4267
|
-
.sia-table__editable-display .sia-icon {
|
|
4293
|
+
.sia-table__editable-display > .sia-icon {
|
|
4268
4294
|
flex: 0 0 auto;
|
|
4269
4295
|
color: var(--sia-color-primary-text);
|
|
4270
4296
|
opacity: 0;
|
|
4271
4297
|
}
|
|
4272
|
-
.sia-table__editable-display:hover .sia-icon {
|
|
4298
|
+
.sia-table__editable-display:hover > .sia-icon {
|
|
4273
4299
|
opacity: 1;
|
|
4274
4300
|
}
|
|
4275
4301
|
.sia-table__cell-content:has(> .sia-table__editor) {
|
package/dist/index.cjs
CHANGED
|
@@ -15327,7 +15327,8 @@ function EditableTableCell({
|
|
|
15327
15327
|
onStart,
|
|
15328
15328
|
onSave,
|
|
15329
15329
|
onCancel,
|
|
15330
|
-
trigger
|
|
15330
|
+
trigger,
|
|
15331
|
+
showEditIcon
|
|
15331
15332
|
}) {
|
|
15332
15333
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
15333
15334
|
const [editValue, setEditValue] = (0, import_react56.useState)(value);
|
|
@@ -15395,7 +15396,7 @@ function EditableTableCell({
|
|
|
15395
15396
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
15396
15397
|
children: [
|
|
15397
15398
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: content }),
|
|
15398
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Icon, { name: "edit", size: 13 })
|
|
15399
|
+
showEditIcon && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Icon, { name: "edit", size: 13 })
|
|
15399
15400
|
]
|
|
15400
15401
|
}
|
|
15401
15402
|
);
|
|
@@ -15484,6 +15485,7 @@ function createEditablePlugin(options = {}) {
|
|
|
15484
15485
|
record,
|
|
15485
15486
|
content,
|
|
15486
15487
|
trigger,
|
|
15488
|
+
showEditIcon: options.showEditIcon ?? true,
|
|
15487
15489
|
onStart: () => context.setState({
|
|
15488
15490
|
editing: { rowKey: info.row.key, columnKey: column.key }
|
|
15489
15491
|
}),
|
|
@@ -16436,6 +16438,7 @@ var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
|
|
|
16436
16438
|
const pluginCellProps = getCellProps(column);
|
|
16437
16439
|
if (pluginCellProps.hidden) return null;
|
|
16438
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;
|
|
16439
16442
|
const cellClass = typeof column.cellClassName === "function" ? column.cellClassName(row.record, rowIndex) : column.cellClassName ?? "";
|
|
16440
16443
|
const fixed = normalizeFixed(column.fixed);
|
|
16441
16444
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
@@ -16445,11 +16448,12 @@ var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
|
|
|
16445
16448
|
"td",
|
|
16446
16449
|
{
|
|
16447
16450
|
"data-column-key": column.key,
|
|
16451
|
+
"aria-invalid": invalid || void 0,
|
|
16448
16452
|
"data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
|
|
16449
16453
|
"aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
|
|
16450
16454
|
rowSpan: pluginCellProps.rowSpan,
|
|
16451
16455
|
colSpan: pluginCellProps.colSpan,
|
|
16452
|
-
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(),
|
|
16453
16457
|
style: { ...fixedStyle, ...pluginCellProps.style },
|
|
16454
16458
|
onMouseEnter: () => onCellMouseEnter(column),
|
|
16455
16459
|
onMouseLeave: () => onCellMouseLeave(column),
|
|
@@ -16901,7 +16905,8 @@ function TableInner(props, ref) {
|
|
|
16901
16905
|
}
|
|
16902
16906
|
function renderHeaderContent(column, content) {
|
|
16903
16907
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
16904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "sia-table__header-label"
|
|
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: "*" }),
|
|
16905
16910
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
16906
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 }) }) })
|
|
16907
16912
|
] });
|
|
@@ -17586,6 +17591,8 @@ function createWorksheetPlugin(options) {
|
|
|
17586
17591
|
const epoch = editEpoch;
|
|
17587
17592
|
const editPlugin = createEditablePlugin({
|
|
17588
17593
|
trigger: "doubleClick",
|
|
17594
|
+
// 工作表由选区和填充柄提示操作,不额外展示容易被误认作清理按钮的铅笔。
|
|
17595
|
+
showEditIcon: false,
|
|
17589
17596
|
onCellChange: (columnKey, record, value) => {
|
|
17590
17597
|
if (epoch !== editEpoch) return false;
|
|
17591
17598
|
const row = context.rows.find((item) => item.record === record);
|
|
@@ -17657,8 +17664,9 @@ function createWorksheetPlugin(options) {
|
|
|
17657
17664
|
remember(current);
|
|
17658
17665
|
const r = current.rows.indexOf(row), c = columns().findIndex((item) => item.key === column.key);
|
|
17659
17666
|
const preview = drag && c >= drag.bounds.left && c <= drag.bounds.right && r >= Math.min(drag.target, drag.bounds.top) && r <= Math.max(drag.target, drag.bounds.bottom);
|
|
17667
|
+
const readonly = !column.meta?.plugin && !editable(row.record, column);
|
|
17660
17668
|
return {
|
|
17661
|
-
className: `sia-table__worksheet-cell${preview ? " sia-table__worksheet-fill-preview" : ""}`
|
|
17669
|
+
className: `sia-table__worksheet-cell${preview ? " sia-table__worksheet-fill-preview" : ""}${readonly ? " sia-table__worksheet-cell--readonly" : ""}`
|
|
17662
17670
|
};
|
|
17663
17671
|
},
|
|
17664
17672
|
renderToolbarStart(current) {
|
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;
|
|
@@ -4255,12 +4281,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4255
4281
|
overflow: hidden;
|
|
4256
4282
|
text-overflow: ellipsis;
|
|
4257
4283
|
}
|
|
4258
|
-
.sia-table__editable-display .sia-icon {
|
|
4284
|
+
.sia-table__editable-display > .sia-icon {
|
|
4259
4285
|
flex: 0 0 auto;
|
|
4260
4286
|
color: var(--sia-color-primary-text);
|
|
4261
4287
|
opacity: 0;
|
|
4262
4288
|
}
|
|
4263
|
-
.sia-table__editable-display:hover .sia-icon {
|
|
4289
|
+
.sia-table__editable-display:hover > .sia-icon {
|
|
4264
4290
|
opacity: 1;
|
|
4265
4291
|
}
|
|
4266
4292
|
.sia-table__cell-content:has(> .sia-table__editor) {
|
|
@@ -11164,12 +11190,19 @@ body > .sia-title-tooltip[data-sia-popup-layer] {
|
|
|
11164
11190
|
.sia-table__worksheet-cell:not(.sia-table__cell--fixed) {
|
|
11165
11191
|
position: relative;
|
|
11166
11192
|
}
|
|
11193
|
+
.sia-table__cell.sia-table__worksheet-cell > .sia-table__cell-content:not(:has(> .sia-table__editor)) {
|
|
11194
|
+
position: static;
|
|
11195
|
+
}
|
|
11196
|
+
.sia-table .sia-table__row .sia-table__cell.sia-table__worksheet-cell--readonly {
|
|
11197
|
+
background: var(--sia-color-background);
|
|
11198
|
+
}
|
|
11167
11199
|
.sia-table__worksheet-handle {
|
|
11168
11200
|
position: absolute;
|
|
11169
|
-
right:
|
|
11170
|
-
bottom:
|
|
11171
|
-
width:
|
|
11172
|
-
height:
|
|
11201
|
+
right: 0;
|
|
11202
|
+
bottom: 0;
|
|
11203
|
+
width: 12px;
|
|
11204
|
+
height: 12px;
|
|
11205
|
+
box-sizing: border-box;
|
|
11173
11206
|
padding: 0;
|
|
11174
11207
|
border: 1px solid var(--sia-color-surface);
|
|
11175
11208
|
background: var(--sia-color-primary);
|
|
@@ -11179,6 +11212,9 @@ body > .sia-title-tooltip[data-sia-popup-layer] {
|
|
|
11179
11212
|
.sia-table__worksheet-fill-preview {
|
|
11180
11213
|
box-shadow: inset 0 0 0 1px var(--sia-color-primary);
|
|
11181
11214
|
}
|
|
11215
|
+
.sia-table__cell--invalid .sia-table__worksheet-handle {
|
|
11216
|
+
z-index: 10;
|
|
11217
|
+
}
|
|
11182
11218
|
.sia-table__worksheet-tools {
|
|
11183
11219
|
display: inline-flex;
|
|
11184
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
|
/** 读取单元格值的字段名或嵌套路径。 */
|
|
@@ -2828,6 +2832,8 @@ interface TableEditablePluginOptions<T> {
|
|
|
2828
2832
|
onCellChange?: (columnKey: string, record: T, newValue: unknown) => boolean | Promise<boolean>;
|
|
2829
2833
|
/** 触发显示的交互方式。 */
|
|
2830
2834
|
trigger?: "click" | "doubleClick";
|
|
2835
|
+
/** 非编辑状态是否显示铅笔提示,默认 true;关闭后仍保留原点击或双击编辑交互。 */
|
|
2836
|
+
showEditIcon?: boolean;
|
|
2831
2837
|
}
|
|
2832
2838
|
/** TableEditable的操作接口。 */
|
|
2833
2839
|
interface TableEditableApi {
|
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
|
/** 读取单元格值的字段名或嵌套路径。 */
|
|
@@ -2828,6 +2832,8 @@ interface TableEditablePluginOptions<T> {
|
|
|
2828
2832
|
onCellChange?: (columnKey: string, record: T, newValue: unknown) => boolean | Promise<boolean>;
|
|
2829
2833
|
/** 触发显示的交互方式。 */
|
|
2830
2834
|
trigger?: "click" | "doubleClick";
|
|
2835
|
+
/** 非编辑状态是否显示铅笔提示,默认 true;关闭后仍保留原点击或双击编辑交互。 */
|
|
2836
|
+
showEditIcon?: boolean;
|
|
2831
2837
|
}
|
|
2832
2838
|
/** TableEditable的操作接口。 */
|
|
2833
2839
|
interface TableEditableApi {
|
package/dist/index.js
CHANGED
|
@@ -7259,7 +7259,8 @@ function EditableTableCell({
|
|
|
7259
7259
|
onStart,
|
|
7260
7260
|
onSave,
|
|
7261
7261
|
onCancel,
|
|
7262
|
-
trigger
|
|
7262
|
+
trigger,
|
|
7263
|
+
showEditIcon
|
|
7263
7264
|
}) {
|
|
7264
7265
|
const config = typeof editable === "object" ? editable : { type: "input" };
|
|
7265
7266
|
const [editValue, setEditValue] = useState21(value);
|
|
@@ -7327,7 +7328,7 @@ function EditableTableCell({
|
|
|
7327
7328
|
onDoubleClick: trigger === "doubleClick" ? onStart : void 0,
|
|
7328
7329
|
children: [
|
|
7329
7330
|
/* @__PURE__ */ jsx24("span", { children: content }),
|
|
7330
|
-
/* @__PURE__ */ jsx24(Icon, { name: "edit", size: 13 })
|
|
7331
|
+
showEditIcon && /* @__PURE__ */ jsx24(Icon, { name: "edit", size: 13 })
|
|
7331
7332
|
]
|
|
7332
7333
|
}
|
|
7333
7334
|
);
|
|
@@ -7416,6 +7417,7 @@ function createEditablePlugin(options = {}) {
|
|
|
7416
7417
|
record,
|
|
7417
7418
|
content,
|
|
7418
7419
|
trigger,
|
|
7420
|
+
showEditIcon: options.showEditIcon ?? true,
|
|
7419
7421
|
onStart: () => context.setState({
|
|
7420
7422
|
editing: { rowKey: info.row.key, columnKey: column.key }
|
|
7421
7423
|
}),
|
|
@@ -8368,6 +8370,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8368
8370
|
const pluginCellProps = getCellProps(column);
|
|
8369
8371
|
if (pluginCellProps.hidden) return null;
|
|
8370
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;
|
|
8371
8374
|
const cellClass = typeof column.cellClassName === "function" ? column.cellClassName(row.record, rowIndex) : column.cellClassName ?? "";
|
|
8372
8375
|
const fixed = normalizeFixed(column.fixed);
|
|
8373
8376
|
const fixedStyle = fixed === "left" ? { left: leftOffsets.get(column.key) } : fixed === "right" ? { right: rightOffsets.get(column.key) } : void 0;
|
|
@@ -8377,11 +8380,12 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
8377
8380
|
"td",
|
|
8378
8381
|
{
|
|
8379
8382
|
"data-column-key": column.key,
|
|
8383
|
+
"aria-invalid": invalid || void 0,
|
|
8380
8384
|
"data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
|
|
8381
8385
|
"aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
|
|
8382
8386
|
rowSpan: pluginCellProps.rowSpan,
|
|
8383
8387
|
colSpan: pluginCellProps.colSpan,
|
|
8384
|
-
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(),
|
|
8385
8389
|
style: { ...fixedStyle, ...pluginCellProps.style },
|
|
8386
8390
|
onMouseEnter: () => onCellMouseEnter(column),
|
|
8387
8391
|
onMouseLeave: () => onCellMouseLeave(column),
|
|
@@ -8833,7 +8837,8 @@ function TableInner(props, ref) {
|
|
|
8833
8837
|
}
|
|
8834
8838
|
function renderHeaderContent(column, content) {
|
|
8835
8839
|
const title = getHeaderTitleText(column.title ?? column.name) || column.name || column.key;
|
|
8836
|
-
return /* @__PURE__ */ jsxs23("span", { className: "sia-table__header-label"
|
|
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: "*" }),
|
|
8837
8842
|
/* @__PURE__ */ jsx25("span", { className: "sia-table__header-label-content", "data-sia-title-overflow-only": true, ...withTitleTooltip({ title }), children: content }),
|
|
8838
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 }) }) })
|
|
8839
8844
|
] });
|
|
@@ -9518,6 +9523,8 @@ function createWorksheetPlugin(options) {
|
|
|
9518
9523
|
const epoch = editEpoch;
|
|
9519
9524
|
const editPlugin = createEditablePlugin({
|
|
9520
9525
|
trigger: "doubleClick",
|
|
9526
|
+
// 工作表由选区和填充柄提示操作,不额外展示容易被误认作清理按钮的铅笔。
|
|
9527
|
+
showEditIcon: false,
|
|
9521
9528
|
onCellChange: (columnKey, record, value) => {
|
|
9522
9529
|
if (epoch !== editEpoch) return false;
|
|
9523
9530
|
const row = context.rows.find((item) => item.record === record);
|
|
@@ -9589,8 +9596,9 @@ function createWorksheetPlugin(options) {
|
|
|
9589
9596
|
remember(current);
|
|
9590
9597
|
const r = current.rows.indexOf(row), c = columns().findIndex((item) => item.key === column.key);
|
|
9591
9598
|
const preview = drag && c >= drag.bounds.left && c <= drag.bounds.right && r >= Math.min(drag.target, drag.bounds.top) && r <= Math.max(drag.target, drag.bounds.bottom);
|
|
9599
|
+
const readonly = !column.meta?.plugin && !editable(row.record, column);
|
|
9592
9600
|
return {
|
|
9593
|
-
className: `sia-table__worksheet-cell${preview ? " sia-table__worksheet-fill-preview" : ""}`
|
|
9601
|
+
className: `sia-table__worksheet-cell${preview ? " sia-table__worksheet-fill-preview" : ""}${readonly ? " sia-table__worksheet-cell--readonly" : ""}`
|
|
9594
9602
|
};
|
|
9595
9603
|
},
|
|
9596
9604
|
renderToolbarStart(current) {
|