@sia.soul/sia-react-ui 0.1.152 → 0.1.154

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.
@@ -1556,7 +1556,7 @@ var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
1556
1556
  function useThumbnail(file, accept) {
1557
1557
  const [local, setLocal] = useState6();
1558
1558
  useEffect5(() => {
1559
- if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
1559
+ if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
1560
1560
  const url = URL.createObjectURL(file.originFileObj);
1561
1561
  setLocal(url);
1562
1562
  return () => URL.revokeObjectURL(url);
package/dist/core.cjs CHANGED
@@ -6044,7 +6044,7 @@ var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
6044
6044
  function useThumbnail(file, accept) {
6045
6045
  const [local, setLocal] = (0, import_react32.useState)();
6046
6046
  (0, import_react32.useEffect)(() => {
6047
- if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
6047
+ if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
6048
6048
  const url = URL.createObjectURL(file.originFileObj);
6049
6049
  setLocal(url);
6050
6050
  return () => URL.revokeObjectURL(url);
package/dist/core.css CHANGED
@@ -371,6 +371,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
371
371
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__label {
372
372
  padding-top: 0;
373
373
  }
374
+ .sia-form--horizontal .sia-form-item--multiline-label {
375
+ align-items: center;
376
+ }
377
+ .sia-form--horizontal .sia-form-item--multiline-label > .sia-form-item__label {
378
+ padding-top: 0;
379
+ }
374
380
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__control > .sia-floating > .sia-form-item__input-wrap {
375
381
  display: flex;
376
382
  flex-direction: column;
@@ -4208,26 +4214,35 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4208
4214
  cursor: pointer;
4209
4215
  }
4210
4216
  .sia-table__sortable-header {
4217
+ position: relative;
4211
4218
  display: flex;
4212
4219
  align-items: center;
4213
- justify-content: space-between;
4214
4220
  min-width: 0;
4215
- gap: 6px;
4216
4221
  }
4217
4222
  .sia-table__sort-button {
4223
+ position: absolute;
4224
+ z-index: 1;
4225
+ right: 0;
4226
+ top: 50%;
4227
+ transform: translateY(-50%);
4218
4228
  display: grid;
4219
4229
  align-content: center;
4220
4230
  justify-items: center;
4221
- flex: 0 0 26px;
4222
4231
  width: 26px;
4223
4232
  height: 28px;
4224
4233
  padding: 0;
4234
+ opacity: 0;
4225
4235
  color: var(--sia-color-text-secondary);
4226
4236
  cursor: pointer;
4227
- background: transparent;
4237
+ background: var(--sia-color-control-hover);
4228
4238
  border: 0;
4229
4239
  border-radius: var(--sia-radius);
4230
4240
  }
4241
+ .sia-table__header-cell:hover .sia-table__sort-button,
4242
+ .sia-table__sortable-header:focus-within .sia-table__sort-button,
4243
+ .sia-table__sort-button:not([data-sort-order=none]) {
4244
+ opacity: 1;
4245
+ }
4231
4246
  .sia-table__sort-button[data-sort-order=none] .sia-icon {
4232
4247
  margin-block: -2px;
4233
4248
  }
@@ -8265,8 +8280,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8265
8280
  color: var(--sia-color-text);
8266
8281
  }
8267
8282
  .sia-form-item__label-content {
8268
- display: inline-block;
8283
+ display: flex;
8284
+ align-items: center;
8269
8285
  width: max-content;
8286
+ max-width: 180px;
8287
+ margin-left: auto;
8288
+ }
8289
+ .sia-form-item__label-text {
8290
+ display: -webkit-box;
8291
+ min-width: 0;
8292
+ -webkit-box-orient: vertical;
8293
+ -webkit-line-clamp: 2;
8294
+ overflow: hidden;
8295
+ overflow-wrap: anywhere;
8296
+ white-space: normal;
8270
8297
  }
8271
8298
  .sia-form-item__label {
8272
8299
  padding-top: 8px;
@@ -8275,6 +8302,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8275
8302
  line-height: 1.45;
8276
8303
  }
8277
8304
  .sia-form-item__required-mark {
8305
+ flex: none;
8278
8306
  margin-right: 4px;
8279
8307
  color: var(--sia-color-error);
8280
8308
  }
@@ -8364,6 +8392,10 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8364
8392
  padding-top: 0;
8365
8393
  text-align: left;
8366
8394
  }
8395
+ .sia-form--vertical .sia-form-item__label-content,
8396
+ .sia-form--inline .sia-form-item__label-content {
8397
+ margin-left: 0;
8398
+ }
8367
8399
  .sia-form--inline > fieldset {
8368
8400
  display: flex;
8369
8401
  align-items: start;
@@ -8393,6 +8425,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8393
8425
  padding-top: 0;
8394
8426
  text-align: left;
8395
8427
  }
8428
+ .sia-form-item__label-content {
8429
+ margin-left: 0;
8430
+ }
8396
8431
  .sia-picker-range {
8397
8432
  align-items: stretch;
8398
8433
  flex-direction: column;
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  Typography,
12
12
  Upload,
13
13
  message
14
- } from "./chunk-GA5HA2A4.js";
14
+ } from "./chunk-AWBINTI3.js";
15
15
  import "./chunk-RX242MUO.js";
16
16
  import {
17
17
  Select
package/dist/game.css CHANGED
@@ -422,6 +422,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
422
422
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__label {
423
423
  padding-top: 0;
424
424
  }
425
+ .sia-form--horizontal .sia-form-item--multiline-label {
426
+ align-items: center;
427
+ }
428
+ .sia-form--horizontal .sia-form-item--multiline-label > .sia-form-item__label {
429
+ padding-top: 0;
430
+ }
425
431
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__control > .sia-floating > .sia-form-item__input-wrap {
426
432
  display: flex;
427
433
  flex-direction: column;
@@ -4259,26 +4265,35 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4259
4265
  cursor: pointer;
4260
4266
  }
4261
4267
  .sia-table__sortable-header {
4268
+ position: relative;
4262
4269
  display: flex;
4263
4270
  align-items: center;
4264
- justify-content: space-between;
4265
4271
  min-width: 0;
4266
- gap: 6px;
4267
4272
  }
4268
4273
  .sia-table__sort-button {
4274
+ position: absolute;
4275
+ z-index: 1;
4276
+ right: 0;
4277
+ top: 50%;
4278
+ transform: translateY(-50%);
4269
4279
  display: grid;
4270
4280
  align-content: center;
4271
4281
  justify-items: center;
4272
- flex: 0 0 26px;
4273
4282
  width: 26px;
4274
4283
  height: 28px;
4275
4284
  padding: 0;
4285
+ opacity: 0;
4276
4286
  color: var(--sia-color-text-secondary);
4277
4287
  cursor: pointer;
4278
- background: transparent;
4288
+ background: var(--sia-color-control-hover);
4279
4289
  border: 0;
4280
4290
  border-radius: var(--sia-radius);
4281
4291
  }
4292
+ .sia-table__header-cell:hover .sia-table__sort-button,
4293
+ .sia-table__sortable-header:focus-within .sia-table__sort-button,
4294
+ .sia-table__sort-button:not([data-sort-order=none]) {
4295
+ opacity: 1;
4296
+ }
4282
4297
  .sia-table__sort-button[data-sort-order=none] .sia-icon {
4283
4298
  margin-block: -2px;
4284
4299
  }
package/dist/index.cjs CHANGED
@@ -8695,6 +8695,8 @@ function FormRoot({
8695
8695
  observed.add(label);
8696
8696
  }
8697
8697
  if (label.getClientRects().length) width = Math.max(width, label.offsetWidth);
8698
+ const multiline = label.getBoundingClientRect().height > parseFloat(getComputedStyle(label).lineHeight) * 1.5;
8699
+ label.closest(".sia-form-item")?.classList.toggle("sia-form-item--multiline-label", multiline);
8698
8700
  });
8699
8701
  const value = `${Math.ceil(width)}px`;
8700
8702
  if (root.style.getPropertyValue("--sia-form-auto-label-width") !== value) root.style.setProperty("--sia-form-auto-label-width", value);
@@ -8874,10 +8876,10 @@ function FormItem({
8874
8876
  if (noStyle) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: content });
8875
8877
  const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
8876
8878
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
8877
- label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "sia-form-item__label-content", children: [
8879
+ label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tooltip, { title: label, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "sia-form-item__label-content", children: [
8878
8880
  ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
8879
- label
8880
- ] }) }) : null,
8881
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-form-item__label-text", children: label })
8882
+ ] }) }) }) : null,
8881
8883
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "sia-form-item__control", children: [
8882
8884
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8883
8885
  Tooltip,
@@ -11306,7 +11308,7 @@ var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
11306
11308
  function useThumbnail(file, accept) {
11307
11309
  const [local, setLocal] = (0, import_react50.useState)();
11308
11310
  (0, import_react50.useEffect)(() => {
11309
- if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
11311
+ if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
11310
11312
  const url = URL.createObjectURL(file.originFileObj);
11311
11313
  setLocal(url);
11312
11314
  return () => URL.revokeObjectURL(url);
@@ -15409,8 +15411,9 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
15409
15411
  canvas.style.height = `${height}px`;
15410
15412
  ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
15411
15413
  ctx.clearRect(0, 0, width, height);
15412
- const style = getComputedStyle(scroller);
15413
- const foreground = style.color;
15414
+ const style = getComputedStyle(scroller.querySelector("td[data-column-key]") ?? scroller);
15415
+ const padding = Number.parseFloat(style.paddingLeft) || 12;
15416
+ const foreground = getComputedStyle(scroller).color;
15414
15417
  const readyCells = /* @__PURE__ */ new Map();
15415
15418
  scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
15416
15419
  const keys = /* @__PURE__ */ new Set();
@@ -15445,10 +15448,11 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
15445
15448
  for (let index = first; index < last; index++) {
15446
15449
  const row = rows[index];
15447
15450
  const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
15451
+ if (readyCells.get(index)?.has(column.key)) continue;
15448
15452
  if (!column.canvasRender && column.render) {
15449
15453
  if (!readyCells.get(index)?.has(column.key)) {
15450
- const skeletonWidth = Math.max(0, Math.min(cellWidth - 24, 120));
15451
- const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - 8 : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + 8;
15454
+ const skeletonWidth = Math.max(0, Math.min(cellWidth - padding * 2, 120));
15455
+ const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - padding : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + padding;
15452
15456
  ctx.save();
15453
15457
  ctx.fillStyle = foreground;
15454
15458
  ctx.globalAlpha = 0.12;
@@ -15462,7 +15466,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
15462
15466
  const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
15463
15467
  const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
15464
15468
  if (!content2?.text) continue;
15465
- const available = Math.max(0, cellWidth - (content2.background ? 32 : 16));
15469
+ const available = Math.max(0, cellWidth - padding * 2 - (content2.background ? 16 : 0));
15466
15470
  let text = content2.text;
15467
15471
  if (ctx.measureText(text).width > available) {
15468
15472
  let lo = 0, hi = text.length;
@@ -15475,7 +15479,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
15475
15479
  }
15476
15480
  const textWidth = ctx.measureText(text).width;
15477
15481
  const total = textWidth + (content2.background ? 16 : 0);
15478
- const tx = column.align === "right" ? x + cellWidth - total - 8 : column.align === "center" ? x + (cellWidth - total) / 2 : x + 8;
15482
+ const tx = column.align === "right" ? x + cellWidth - total - padding : column.align === "center" ? x + (cellWidth - total) / 2 : x + padding;
15479
15483
  if (content2.background) {
15480
15484
  ctx.fillStyle = content2.background;
15481
15485
  ctx.beginPath();
@@ -15496,6 +15500,19 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
15496
15500
  draw();
15497
15501
  };
15498
15502
  scroller.addEventListener("scroll", onScroll, { passive: true, capture: true });
15503
+ const onWheel = (event) => {
15504
+ if (event.ctrlKey || !event.cancelable) return;
15505
+ const dx = event.deltaX || (event.shiftKey ? event.deltaY : 0);
15506
+ if (!dx) return;
15507
+ const scale = event.deltaMode === 1 ? rowHeight : event.deltaMode === 2 ? scroller.clientWidth : 1;
15508
+ const next = Math.max(0, Math.min(scroller.scrollWidth - scroller.clientWidth, scroller.scrollLeft + dx * scale));
15509
+ if (next === scroller.scrollLeft) return;
15510
+ event.preventDefault();
15511
+ scroller.scrollLeft = next;
15512
+ if (event.deltaX && event.deltaY) scroller.scrollTop += event.deltaY * (event.deltaMode === 2 ? scroller.clientHeight : scale);
15513
+ onScroll();
15514
+ };
15515
+ scroller.addEventListener("wheel", onWheel, { passive: false });
15499
15516
  const resize = new ResizeObserver(schedule);
15500
15517
  resize.observe(scroller);
15501
15518
  const content = new MutationObserver(schedule);
@@ -15510,6 +15527,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
15510
15527
  content.disconnect();
15511
15528
  theme.disconnect();
15512
15529
  scroller.removeEventListener("scroll", onScroll, true);
15530
+ scroller.removeEventListener("wheel", onWheel);
15513
15531
  window.removeEventListener("resize", schedule);
15514
15532
  };
15515
15533
  }, [viewport, rows, columns, widths, rowHeight, headerHeight]);
@@ -15671,6 +15689,7 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
15671
15689
 
15672
15690
  // src/components/Table/Table.tsx
15673
15691
  var import_react67 = require("react");
15692
+ var import_react_dom7 = require("react-dom");
15674
15693
 
15675
15694
  // src/components/Table/plugins.tsx
15676
15695
  var import_react66 = require("react");
@@ -18339,6 +18358,7 @@ var TableBodyRow = (0, import_react67.memo)(function TableBodyRow2({
18339
18358
  onCellPointerDown,
18340
18359
  onCellPointerMove
18341
18360
  }) {
18361
+ const [textColumn, setTextColumn] = (0, import_react67.useState)();
18342
18362
  const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
18343
18363
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
18344
18364
  "tr",
@@ -18372,21 +18392,27 @@ var TableBodyRow = (0, import_react67.memo)(function TableBodyRow2({
18372
18392
  {
18373
18393
  "data-column-key": column.key,
18374
18394
  "aria-invalid": invalid || void 0,
18375
- "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
18395
+ "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? "true" : void 0,
18376
18396
  "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
18377
18397
  rowSpan: pluginCellProps.rowSpan,
18378
18398
  colSpan: pluginCellProps.colSpan,
18379
18399
  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(),
18380
18400
  style: { ...fixedStyle, ...pluginCellProps.style },
18381
- onMouseEnter: () => onCellMouseEnter(column),
18401
+ onMouseEnter: () => {
18402
+ if (canvas && !column.canvasRender && !column.render) setTextColumn(column.key);
18403
+ onCellMouseEnter(column);
18404
+ },
18382
18405
  onMouseLeave: () => onCellMouseLeave(column),
18383
18406
  onClick: (event) => onCellClick(column, event),
18384
18407
  onDoubleClick: (event) => onCellDoubleClick(column, event),
18385
18408
  onContextMenu: (event) => onCellContextMenu(column, event),
18386
- onPointerDown: (event) => onCellPointerDown(column, event),
18409
+ onPointerDown: (event) => {
18410
+ if (canvas && !column.canvasRender && !column.render && textColumn !== column.key) (0, import_react_dom7.flushSync)(() => setTextColumn(column.key));
18411
+ onCellPointerDown(column, event);
18412
+ },
18387
18413
  onPointerMove: (event) => onCellPointerMove(column, event),
18388
18414
  children: [
18389
- !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
18415
+ !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
18390
18416
  TableCellContent,
18391
18417
  {
18392
18418
  ellipsis: column.ellipsis !== false,
package/dist/index.css CHANGED
@@ -371,6 +371,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
371
371
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__label {
372
372
  padding-top: 0;
373
373
  }
374
+ .sia-form--horizontal .sia-form-item--multiline-label {
375
+ align-items: center;
376
+ }
377
+ .sia-form--horizontal .sia-form-item--multiline-label > .sia-form-item__label {
378
+ padding-top: 0;
379
+ }
374
380
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__control > .sia-floating > .sia-form-item__input-wrap {
375
381
  display: flex;
376
382
  flex-direction: column;
@@ -4208,26 +4214,35 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4208
4214
  cursor: pointer;
4209
4215
  }
4210
4216
  .sia-table__sortable-header {
4217
+ position: relative;
4211
4218
  display: flex;
4212
4219
  align-items: center;
4213
- justify-content: space-between;
4214
4220
  min-width: 0;
4215
- gap: 6px;
4216
4221
  }
4217
4222
  .sia-table__sort-button {
4223
+ position: absolute;
4224
+ z-index: 1;
4225
+ right: 0;
4226
+ top: 50%;
4227
+ transform: translateY(-50%);
4218
4228
  display: grid;
4219
4229
  align-content: center;
4220
4230
  justify-items: center;
4221
- flex: 0 0 26px;
4222
4231
  width: 26px;
4223
4232
  height: 28px;
4224
4233
  padding: 0;
4234
+ opacity: 0;
4225
4235
  color: var(--sia-color-text-secondary);
4226
4236
  cursor: pointer;
4227
- background: transparent;
4237
+ background: var(--sia-color-control-hover);
4228
4238
  border: 0;
4229
4239
  border-radius: var(--sia-radius);
4230
4240
  }
4241
+ .sia-table__header-cell:hover .sia-table__sort-button,
4242
+ .sia-table__sortable-header:focus-within .sia-table__sort-button,
4243
+ .sia-table__sort-button:not([data-sort-order=none]) {
4244
+ opacity: 1;
4245
+ }
4231
4246
  .sia-table__sort-button[data-sort-order=none] .sia-icon {
4232
4247
  margin-block: -2px;
4233
4248
  }
@@ -8265,8 +8280,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8265
8280
  color: var(--sia-color-text);
8266
8281
  }
8267
8282
  .sia-form-item__label-content {
8268
- display: inline-block;
8283
+ display: flex;
8284
+ align-items: center;
8269
8285
  width: max-content;
8286
+ max-width: 180px;
8287
+ margin-left: auto;
8288
+ }
8289
+ .sia-form-item__label-text {
8290
+ display: -webkit-box;
8291
+ min-width: 0;
8292
+ -webkit-box-orient: vertical;
8293
+ -webkit-line-clamp: 2;
8294
+ overflow: hidden;
8295
+ overflow-wrap: anywhere;
8296
+ white-space: normal;
8270
8297
  }
8271
8298
  .sia-form-item__label {
8272
8299
  padding-top: 8px;
@@ -8275,6 +8302,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8275
8302
  line-height: 1.45;
8276
8303
  }
8277
8304
  .sia-form-item__required-mark {
8305
+ flex: none;
8278
8306
  margin-right: 4px;
8279
8307
  color: var(--sia-color-error);
8280
8308
  }
@@ -8364,6 +8392,10 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8364
8392
  padding-top: 0;
8365
8393
  text-align: left;
8366
8394
  }
8395
+ .sia-form--vertical .sia-form-item__label-content,
8396
+ .sia-form--inline .sia-form-item__label-content {
8397
+ margin-left: 0;
8398
+ }
8367
8399
  .sia-form--inline > fieldset {
8368
8400
  display: flex;
8369
8401
  align-items: start;
@@ -8393,6 +8425,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8393
8425
  padding-top: 0;
8394
8426
  text-align: left;
8395
8427
  }
8428
+ .sia-form-item__label-content {
8429
+ margin-left: 0;
8430
+ }
8396
8431
  .sia-picker-range {
8397
8432
  align-items: stretch;
8398
8433
  flex-direction: column;
package/dist/index.d.cts CHANGED
@@ -920,7 +920,7 @@ declare function FormRoot({ fill, form, initialValues, layout, size: sizeProp, p
920
920
  interface FormItemProps {
921
921
  /** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
922
922
  name?: NamePath;
923
- /** 字段标签,支持文本或 React 节点;横向及行内布局未指定标签列宽时,与同一 Form 内最宽的可见标签对齐,测量包含必填标记。未渲染标签时,控件占据表单项整行宽度。 */
923
+ /** 字段标签,支持文本或 React 节点;默认最大宽度 180px(包含必填标记),文案自动换行并在超过两行时省略,悬停显示全文;必填星号与整块文案垂直居中。横向布局的两行标签作为整体与控件垂直居中;横向及行内布局按同一 Form 内最宽可见标签对齐,无标签时控件占整行。 */
924
924
  label?: ReactNode;
925
925
  /** 横向表单中标签与内容的垂直对齐:start 对齐首行控件,center 将标签与整个内容区居中,适合只读文字和多行信息。纵向、行内、窄屏堆叠及 noStyle 布局不受影响。
926
926
  * @defaultValue "start"
@@ -2198,7 +2198,7 @@ interface TableColumn<T = Record<string, unknown>> {
2198
2198
  ellipsis?: boolean;
2199
2199
  /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头仅在文字实际省略时提示完整标题,不受此属性影响。 */
2200
2200
  showTitle?: boolean;
2201
- /** 是否允许该列排序;配合排序插件显示按钮,依次切换升序、降序、未排序,当前排序方向以高亮单箭头显示。 */
2201
+ /** 是否允许该列排序;配合排序插件显示浮动按钮,不挤占标题宽度。未排序时在悬停或键盘聚焦后显示,依次切换升序、降序、未排序;当前排序方向始终以高亮单箭头显示。 */
2202
2202
  sortable?: boolean;
2203
2203
  /** 是否允许该列筛选。 */
2204
2204
  filterable?: boolean;
@@ -2429,7 +2429,7 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
2429
2429
  striped?: boolean;
2430
2430
  /** 是否启用窗口化渲染;未指定时按 virtualThreshold 判断。筛选、分页及树展开后的实际展示行数超过 100 时强制启用,优先于 false 和插件的 disableVirtual。 */
2431
2431
  virtual?: boolean;
2432
- /** 内容渲染方式,默认 dom;canvas 使用画布绘制文本,并保留可见交互组件及 DOM 单元格语义。Canvas 强制固定行高和行虚拟化;不支持虚拟化的插件、rowHeights 或 rowResizable 会自动回退 DOM。 */
2432
+ /** 内容渲染方式,默认 dom;canvas 使用画布绘制文本,并保留可见交互组件及 DOM 单元格语义。普通文本在指针进入或按下时按需提供原生文字选区,横向滚轮与画布同步移动。Canvas 强制固定行高和行虚拟化;不支持虚拟化的插件、rowHeights 或 rowResizable 会自动回退 DOM。 */
2433
2433
  renderMode?: "dom" | "canvas";
2434
2434
  /** 自动启用虚拟滚动的展示行数阈值(含该值),默认 100;仅在未指定 virtual 时使用,实际展示超过 100 行始终强制启用。 */
2435
2435
  virtualThreshold?: number;
package/dist/index.d.ts CHANGED
@@ -920,7 +920,7 @@ declare function FormRoot({ fill, form, initialValues, layout, size: sizeProp, p
920
920
  interface FormItemProps {
921
921
  /** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
922
922
  name?: NamePath;
923
- /** 字段标签,支持文本或 React 节点;横向及行内布局未指定标签列宽时,与同一 Form 内最宽的可见标签对齐,测量包含必填标记。未渲染标签时,控件占据表单项整行宽度。 */
923
+ /** 字段标签,支持文本或 React 节点;默认最大宽度 180px(包含必填标记),文案自动换行并在超过两行时省略,悬停显示全文;必填星号与整块文案垂直居中。横向布局的两行标签作为整体与控件垂直居中;横向及行内布局按同一 Form 内最宽可见标签对齐,无标签时控件占整行。 */
924
924
  label?: ReactNode;
925
925
  /** 横向表单中标签与内容的垂直对齐:start 对齐首行控件,center 将标签与整个内容区居中,适合只读文字和多行信息。纵向、行内、窄屏堆叠及 noStyle 布局不受影响。
926
926
  * @defaultValue "start"
@@ -2198,7 +2198,7 @@ interface TableColumn<T = Record<string, unknown>> {
2198
2198
  ellipsis?: boolean;
2199
2199
  /** 数据单元格是否使用 Sia Tooltip 显示完整文本;默认 false,不生成浏览器原生 title。列头仅在文字实际省略时提示完整标题,不受此属性影响。 */
2200
2200
  showTitle?: boolean;
2201
- /** 是否允许该列排序;配合排序插件显示按钮,依次切换升序、降序、未排序,当前排序方向以高亮单箭头显示。 */
2201
+ /** 是否允许该列排序;配合排序插件显示浮动按钮,不挤占标题宽度。未排序时在悬停或键盘聚焦后显示,依次切换升序、降序、未排序;当前排序方向始终以高亮单箭头显示。 */
2202
2202
  sortable?: boolean;
2203
2203
  /** 是否允许该列筛选。 */
2204
2204
  filterable?: boolean;
@@ -2429,7 +2429,7 @@ interface TableProps<T extends Record<string, unknown> = Record<string, unknown>
2429
2429
  striped?: boolean;
2430
2430
  /** 是否启用窗口化渲染;未指定时按 virtualThreshold 判断。筛选、分页及树展开后的实际展示行数超过 100 时强制启用,优先于 false 和插件的 disableVirtual。 */
2431
2431
  virtual?: boolean;
2432
- /** 内容渲染方式,默认 dom;canvas 使用画布绘制文本,并保留可见交互组件及 DOM 单元格语义。Canvas 强制固定行高和行虚拟化;不支持虚拟化的插件、rowHeights 或 rowResizable 会自动回退 DOM。 */
2432
+ /** 内容渲染方式,默认 dom;canvas 使用画布绘制文本,并保留可见交互组件及 DOM 单元格语义。普通文本在指针进入或按下时按需提供原生文字选区,横向滚轮与画布同步移动。Canvas 强制固定行高和行虚拟化;不支持虚拟化的插件、rowHeights 或 rowResizable 会自动回退 DOM。 */
2433
2433
  renderMode?: "dom" | "canvas";
2434
2434
  /** 自动启用虚拟滚动的展示行数阈值(含该值),默认 100;仅在未指定 virtual 时使用,实际展示超过 100 行始终强制启用。 */
2435
2435
  virtualThreshold?: number;
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ import {
82
82
  Watermark,
83
83
  message,
84
84
  notification
85
- } from "./chunk-GA5HA2A4.js";
85
+ } from "./chunk-AWBINTI3.js";
86
86
  import "./chunk-RX242MUO.js";
87
87
  import {
88
88
  MarkdownEditor
@@ -2335,6 +2335,8 @@ function FormRoot({
2335
2335
  observed.add(label);
2336
2336
  }
2337
2337
  if (label.getClientRects().length) width = Math.max(width, label.offsetWidth);
2338
+ const multiline = label.getBoundingClientRect().height > parseFloat(getComputedStyle(label).lineHeight) * 1.5;
2339
+ label.closest(".sia-form-item")?.classList.toggle("sia-form-item--multiline-label", multiline);
2338
2340
  });
2339
2341
  const value = `${Math.ceil(width)}px`;
2340
2342
  if (root.style.getPropertyValue("--sia-form-auto-label-width") !== value) root.style.setProperty("--sia-form-auto-label-width", value);
@@ -2514,10 +2516,10 @@ function FormItem({
2514
2516
  if (noStyle) return /* @__PURE__ */ jsx12(Fragment4, { children: content });
2515
2517
  const inputWrap = /* @__PURE__ */ jsx12("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
2516
2518
  return /* @__PURE__ */ jsxs12("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
2517
- label ? /* @__PURE__ */ jsx12("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs12("span", { className: "sia-form-item__label-content", children: [
2519
+ label ? /* @__PURE__ */ jsx12("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsx12(Tooltip, { title: label, children: /* @__PURE__ */ jsxs12("span", { className: "sia-form-item__label-content", children: [
2518
2520
  ruleRequired ? /* @__PURE__ */ jsx12("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
2519
- label
2520
- ] }) }) : null,
2521
+ /* @__PURE__ */ jsx12("span", { className: "sia-form-item__label-text", children: label })
2522
+ ] }) }) }) : null,
2521
2523
  /* @__PURE__ */ jsxs12("div", { className: "sia-form-item__control", children: [
2522
2524
  /* @__PURE__ */ jsx12(
2523
2525
  Tooltip,
@@ -6460,8 +6462,9 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
6460
6462
  canvas.style.height = `${height}px`;
6461
6463
  ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
6462
6464
  ctx.clearRect(0, 0, width, height);
6463
- const style = getComputedStyle(scroller);
6464
- const foreground = style.color;
6465
+ const style = getComputedStyle(scroller.querySelector("td[data-column-key]") ?? scroller);
6466
+ const padding = Number.parseFloat(style.paddingLeft) || 12;
6467
+ const foreground = getComputedStyle(scroller).color;
6465
6468
  const readyCells = /* @__PURE__ */ new Map();
6466
6469
  scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
6467
6470
  const keys = /* @__PURE__ */ new Set();
@@ -6496,10 +6499,11 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
6496
6499
  for (let index = first; index < last; index++) {
6497
6500
  const row = rows[index];
6498
6501
  const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
6502
+ if (readyCells.get(index)?.has(column.key)) continue;
6499
6503
  if (!column.canvasRender && column.render) {
6500
6504
  if (!readyCells.get(index)?.has(column.key)) {
6501
- const skeletonWidth = Math.max(0, Math.min(cellWidth - 24, 120));
6502
- const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - 8 : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + 8;
6505
+ const skeletonWidth = Math.max(0, Math.min(cellWidth - padding * 2, 120));
6506
+ const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - padding : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + padding;
6503
6507
  ctx.save();
6504
6508
  ctx.fillStyle = foreground;
6505
6509
  ctx.globalAlpha = 0.12;
@@ -6513,7 +6517,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
6513
6517
  const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
6514
6518
  const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
6515
6519
  if (!content2?.text) continue;
6516
- const available = Math.max(0, cellWidth - (content2.background ? 32 : 16));
6520
+ const available = Math.max(0, cellWidth - padding * 2 - (content2.background ? 16 : 0));
6517
6521
  let text = content2.text;
6518
6522
  if (ctx.measureText(text).width > available) {
6519
6523
  let lo = 0, hi = text.length;
@@ -6526,7 +6530,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
6526
6530
  }
6527
6531
  const textWidth = ctx.measureText(text).width;
6528
6532
  const total = textWidth + (content2.background ? 16 : 0);
6529
- const tx = column.align === "right" ? x + cellWidth - total - 8 : column.align === "center" ? x + (cellWidth - total) / 2 : x + 8;
6533
+ const tx = column.align === "right" ? x + cellWidth - total - padding : column.align === "center" ? x + (cellWidth - total) / 2 : x + padding;
6530
6534
  if (content2.background) {
6531
6535
  ctx.fillStyle = content2.background;
6532
6536
  ctx.beginPath();
@@ -6547,6 +6551,19 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
6547
6551
  draw();
6548
6552
  };
6549
6553
  scroller.addEventListener("scroll", onScroll, { passive: true, capture: true });
6554
+ const onWheel = (event) => {
6555
+ if (event.ctrlKey || !event.cancelable) return;
6556
+ const dx = event.deltaX || (event.shiftKey ? event.deltaY : 0);
6557
+ if (!dx) return;
6558
+ const scale = event.deltaMode === 1 ? rowHeight : event.deltaMode === 2 ? scroller.clientWidth : 1;
6559
+ const next = Math.max(0, Math.min(scroller.scrollWidth - scroller.clientWidth, scroller.scrollLeft + dx * scale));
6560
+ if (next === scroller.scrollLeft) return;
6561
+ event.preventDefault();
6562
+ scroller.scrollLeft = next;
6563
+ if (event.deltaX && event.deltaY) scroller.scrollTop += event.deltaY * (event.deltaMode === 2 ? scroller.clientHeight : scale);
6564
+ onScroll();
6565
+ };
6566
+ scroller.addEventListener("wheel", onWheel, { passive: false });
6550
6567
  const resize = new ResizeObserver(schedule);
6551
6568
  resize.observe(scroller);
6552
6569
  const content = new MutationObserver(schedule);
@@ -6561,6 +6578,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
6561
6578
  content.disconnect();
6562
6579
  theme.disconnect();
6563
6580
  scroller.removeEventListener("scroll", onScroll, true);
6581
+ scroller.removeEventListener("wheel", onWheel);
6564
6582
  window.removeEventListener("resize", schedule);
6565
6583
  };
6566
6584
  }, [viewport, rows, columns, widths, rowHeight, headerHeight]);
@@ -6722,6 +6740,7 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
6722
6740
 
6723
6741
  // src/components/Table/Table.tsx
6724
6742
  import { Fragment as Fragment9, forwardRef as forwardRef6, isValidElement as isValidElement4, memo, useCallback as useCallback2, useEffect as useEffect17, useImperativeHandle, useMemo as useMemo10, useRef as useRef24, useState as useState24 } from "react";
6743
+ import { flushSync } from "react-dom";
6725
6744
 
6726
6745
  // src/components/Table/plugins.tsx
6727
6746
  import { isValidElement as isValidElement3, useEffect as useEffect16, useRef as useRef23, useState as useState23 } from "react";
@@ -9390,6 +9409,7 @@ var TableBodyRow = memo(function TableBodyRow2({
9390
9409
  onCellPointerDown,
9391
9410
  onCellPointerMove
9392
9411
  }) {
9412
+ const [textColumn, setTextColumn] = useState24();
9393
9413
  const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
9394
9414
  return /* @__PURE__ */ jsx29(
9395
9415
  "tr",
@@ -9423,21 +9443,27 @@ var TableBodyRow = memo(function TableBodyRow2({
9423
9443
  {
9424
9444
  "data-column-key": column.key,
9425
9445
  "aria-invalid": invalid || void 0,
9426
- "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
9446
+ "data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? "true" : void 0,
9427
9447
  "aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
9428
9448
  rowSpan: pluginCellProps.rowSpan,
9429
9449
  colSpan: pluginCellProps.colSpan,
9430
9450
  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(),
9431
9451
  style: { ...fixedStyle, ...pluginCellProps.style },
9432
- onMouseEnter: () => onCellMouseEnter(column),
9452
+ onMouseEnter: () => {
9453
+ if (canvas && !column.canvasRender && !column.render) setTextColumn(column.key);
9454
+ onCellMouseEnter(column);
9455
+ },
9433
9456
  onMouseLeave: () => onCellMouseLeave(column),
9434
9457
  onClick: (event) => onCellClick(column, event),
9435
9458
  onDoubleClick: (event) => onCellDoubleClick(column, event),
9436
9459
  onContextMenu: (event) => onCellContextMenu(column, event),
9437
- onPointerDown: (event) => onCellPointerDown(column, event),
9460
+ onPointerDown: (event) => {
9461
+ if (canvas && !column.canvasRender && !column.render && textColumn !== column.key) flushSync(() => setTextColumn(column.key));
9462
+ onCellPointerDown(column, event);
9463
+ },
9438
9464
  onPointerMove: (event) => onCellPointerMove(column, event),
9439
9465
  children: [
9440
- !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ jsx29(
9466
+ !canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? /* @__PURE__ */ jsx29(
9441
9467
  TableCellContent,
9442
9468
  {
9443
9469
  ellipsis: column.ellipsis !== false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.152",
3
+ "version": "0.1.154",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",