@sia.soul/sia-react-ui 0.1.153 → 0.1.155
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/{chunk-PDYEIHUO.js → chunk-SD3MG2PO.js} +22 -4
- package/dist/core.css +22 -4
- package/dist/game.css +13 -4
- package/dist/index.cjs +56 -14
- package/dist/index.css +22 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +35 -11
- package/dist/{select-date-range-C5bNGxaY.d.cts → select-date-range-BxjiD6zL.d.cts} +1 -1
- package/dist/{select-date-range-DfhpX7vv.d.ts → select-date-range-D3-8mmAT.d.ts} +1 -1
- package/dist/select-date-range.cjs +22 -4
- package/dist/select-date-range.d.cts +1 -1
- package/dist/select-date-range.d.ts +1 -1
- package/dist/select-date-range.js +1 -1
- package/package.json +1 -1
|
@@ -346,8 +346,9 @@ function DatePicker({
|
|
|
346
346
|
function isDisabled(day) {
|
|
347
347
|
const minimum = minDate ?? props.min;
|
|
348
348
|
const maximum = maxDate ?? props.max;
|
|
349
|
-
|
|
350
|
-
if (
|
|
349
|
+
const length = picker === "year" ? 4 : 10;
|
|
350
|
+
if (minimum && day.slice(0, length) < String(minimum).slice(0, length)) return true;
|
|
351
|
+
if (maximum && day.slice(0, length) > String(maximum).slice(0, length)) return true;
|
|
351
352
|
return disabledDate?.(day, { type: "date" }) ?? false;
|
|
352
353
|
}
|
|
353
354
|
function buildValue(day, time = draftTime) {
|
|
@@ -427,7 +428,24 @@ function DatePicker({
|
|
|
427
428
|
changeOpen(false);
|
|
428
429
|
}
|
|
429
430
|
}, children: preset.label }, index)) }) : null,
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ jsx2("section", { className: "sia-date-panel__calendar", children: picker === "year" ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
432
|
+
/* @__PURE__ */ jsxs2("div", { className: "sia-date-panel__header", children: [
|
|
433
|
+
/* @__PURE__ */ jsx2("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": "\u4E0A\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, -120)), children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-left", size: 15 }) }) }),
|
|
434
|
+
/* @__PURE__ */ jsxs2("strong", { children: [
|
|
435
|
+
Math.floor(viewMonth.getFullYear() / 10) * 10,
|
|
436
|
+
"\u5E74 \u2014 ",
|
|
437
|
+
Math.floor(viewMonth.getFullYear() / 10) * 10 + 9,
|
|
438
|
+
"\u5E74"
|
|
439
|
+
] }),
|
|
440
|
+
/* @__PURE__ */ jsx2("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": "\u4E0B\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, 120)), children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-right", size: 15 }) }) })
|
|
441
|
+
] }),
|
|
442
|
+
/* @__PURE__ */ jsx2("div", { className: "sia-date-panel__years", children: Array.from({ length: 10 }, (_, index) => {
|
|
443
|
+
const year = String(Math.floor(viewMonth.getFullYear() / 10) * 10 + index);
|
|
444
|
+
const day = `${year}-01-01`;
|
|
445
|
+
const selected = selectedDates.some((value2) => value2.slice(0, 4) === year);
|
|
446
|
+
return /* @__PURE__ */ jsx2("span", { className: `sia-date-panel__cell${selected ? " is-selected" : ""}${year === String((/* @__PURE__ */ new Date()).getFullYear()) ? " is-today" : ""}`, children: /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": `${year}\u5E74`, "aria-pressed": selected, disabled: isDisabled(day), onClick: () => selectDate(day), children: year }) }, year);
|
|
447
|
+
}) })
|
|
448
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
431
449
|
/* @__PURE__ */ jsx2(
|
|
432
450
|
CalendarHeader,
|
|
433
451
|
{
|
|
@@ -439,7 +457,7 @@ function DatePicker({
|
|
|
439
457
|
}
|
|
440
458
|
),
|
|
441
459
|
/* @__PURE__ */ jsx2(CalendarMonth, { month: viewMonth, selectedDates, disabledDate: isDisabled, onSelect: selectDate })
|
|
442
|
-
] }),
|
|
460
|
+
] }) }),
|
|
443
461
|
showTime ? /* @__PURE__ */ jsx2(TimePanel, { value: draftTime, showSecond, onChange: (next) => {
|
|
444
462
|
setDraftTime(next);
|
|
445
463
|
if (typeof draftValue === "string" && draftValue) setDraftValue(withTime(dayFromValue(draftValue), next, showSecond));
|
package/dist/core.css
CHANGED
|
@@ -4214,26 +4214,35 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4214
4214
|
cursor: pointer;
|
|
4215
4215
|
}
|
|
4216
4216
|
.sia-table__sortable-header {
|
|
4217
|
+
position: relative;
|
|
4217
4218
|
display: flex;
|
|
4218
4219
|
align-items: center;
|
|
4219
|
-
justify-content: space-between;
|
|
4220
4220
|
min-width: 0;
|
|
4221
|
-
gap: 6px;
|
|
4222
4221
|
}
|
|
4223
4222
|
.sia-table__sort-button {
|
|
4223
|
+
position: absolute;
|
|
4224
|
+
z-index: 1;
|
|
4225
|
+
right: 0;
|
|
4226
|
+
top: 50%;
|
|
4227
|
+
transform: translateY(-50%);
|
|
4224
4228
|
display: grid;
|
|
4225
4229
|
align-content: center;
|
|
4226
4230
|
justify-items: center;
|
|
4227
|
-
flex: 0 0 26px;
|
|
4228
4231
|
width: 26px;
|
|
4229
4232
|
height: 28px;
|
|
4230
4233
|
padding: 0;
|
|
4234
|
+
opacity: 0;
|
|
4231
4235
|
color: var(--sia-color-text-secondary);
|
|
4232
4236
|
cursor: pointer;
|
|
4233
|
-
background:
|
|
4237
|
+
background: var(--sia-color-control-hover);
|
|
4234
4238
|
border: 0;
|
|
4235
4239
|
border-radius: var(--sia-radius);
|
|
4236
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
|
+
}
|
|
4237
4246
|
.sia-table__sort-button[data-sort-order=none] .sia-icon {
|
|
4238
4247
|
margin-block: -2px;
|
|
4239
4248
|
}
|
|
@@ -11543,6 +11552,15 @@ button.sia-treemap__tile:focus-visible,
|
|
|
11543
11552
|
flex-wrap: wrap;
|
|
11544
11553
|
}
|
|
11545
11554
|
}
|
|
11555
|
+
.sia-date-panel__years {
|
|
11556
|
+
display: grid;
|
|
11557
|
+
grid-template-columns: repeat(3, 1fr);
|
|
11558
|
+
gap: 12px 8px;
|
|
11559
|
+
padding: 16px 12px;
|
|
11560
|
+
}
|
|
11561
|
+
.sia-date-panel__years .sia-date-panel__cell button {
|
|
11562
|
+
width: 64px;
|
|
11563
|
+
}
|
|
11546
11564
|
|
|
11547
11565
|
/* src/title-tooltip.css */
|
|
11548
11566
|
body > .sia-title-tooltip[data-sia-popup-layer] {
|
package/dist/game.css
CHANGED
|
@@ -4265,26 +4265,35 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4265
4265
|
cursor: pointer;
|
|
4266
4266
|
}
|
|
4267
4267
|
.sia-table__sortable-header {
|
|
4268
|
+
position: relative;
|
|
4268
4269
|
display: flex;
|
|
4269
4270
|
align-items: center;
|
|
4270
|
-
justify-content: space-between;
|
|
4271
4271
|
min-width: 0;
|
|
4272
|
-
gap: 6px;
|
|
4273
4272
|
}
|
|
4274
4273
|
.sia-table__sort-button {
|
|
4274
|
+
position: absolute;
|
|
4275
|
+
z-index: 1;
|
|
4276
|
+
right: 0;
|
|
4277
|
+
top: 50%;
|
|
4278
|
+
transform: translateY(-50%);
|
|
4275
4279
|
display: grid;
|
|
4276
4280
|
align-content: center;
|
|
4277
4281
|
justify-items: center;
|
|
4278
|
-
flex: 0 0 26px;
|
|
4279
4282
|
width: 26px;
|
|
4280
4283
|
height: 28px;
|
|
4281
4284
|
padding: 0;
|
|
4285
|
+
opacity: 0;
|
|
4282
4286
|
color: var(--sia-color-text-secondary);
|
|
4283
4287
|
cursor: pointer;
|
|
4284
|
-
background:
|
|
4288
|
+
background: var(--sia-color-control-hover);
|
|
4285
4289
|
border: 0;
|
|
4286
4290
|
border-radius: var(--sia-radius);
|
|
4287
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
|
+
}
|
|
4288
4297
|
.sia-table__sort-button[data-sort-order=none] .sia-icon {
|
|
4289
4298
|
margin-block: -2px;
|
|
4290
4299
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -9974,8 +9974,9 @@ function DatePicker({
|
|
|
9974
9974
|
function isDisabled(day) {
|
|
9975
9975
|
const minimum = minDate ?? props.min;
|
|
9976
9976
|
const maximum = maxDate ?? props.max;
|
|
9977
|
-
|
|
9978
|
-
if (
|
|
9977
|
+
const length = picker === "year" ? 4 : 10;
|
|
9978
|
+
if (minimum && day.slice(0, length) < String(minimum).slice(0, length)) return true;
|
|
9979
|
+
if (maximum && day.slice(0, length) > String(maximum).slice(0, length)) return true;
|
|
9979
9980
|
return disabledDate?.(day, { type: "date" }) ?? false;
|
|
9980
9981
|
}
|
|
9981
9982
|
function buildValue(day, time = draftTime) {
|
|
@@ -10055,7 +10056,24 @@ function DatePicker({
|
|
|
10055
10056
|
changeOpen(false);
|
|
10056
10057
|
}
|
|
10057
10058
|
}, children: preset2.label }, index)) }) : null,
|
|
10058
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.
|
|
10059
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("section", { className: "sia-date-panel__calendar", children: picker === "year" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
10060
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "sia-date-panel__header", children: [
|
|
10061
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-label": "\u4E0A\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, -120)), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-left", size: 15 }) }) }),
|
|
10062
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("strong", { children: [
|
|
10063
|
+
Math.floor(viewMonth.getFullYear() / 10) * 10,
|
|
10064
|
+
"\u5E74 \u2014 ",
|
|
10065
|
+
Math.floor(viewMonth.getFullYear() / 10) * 10 + 9,
|
|
10066
|
+
"\u5E74"
|
|
10067
|
+
] }),
|
|
10068
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-label": "\u4E0B\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, 120)), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-right", size: 15 }) }) })
|
|
10069
|
+
] }),
|
|
10070
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "sia-date-panel__years", children: Array.from({ length: 10 }, (_, index) => {
|
|
10071
|
+
const year = String(Math.floor(viewMonth.getFullYear() / 10) * 10 + index);
|
|
10072
|
+
const day = `${year}-01-01`;
|
|
10073
|
+
const selected = selectedDates.some((value2) => value2.slice(0, 4) === year);
|
|
10074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: `sia-date-panel__cell${selected ? " is-selected" : ""}${year === String((/* @__PURE__ */ new Date()).getFullYear()) ? " is-today" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { type: "button", "aria-label": `${year}\u5E74`, "aria-pressed": selected, disabled: isDisabled(day), onClick: () => selectDate(day), children: year }) }, year);
|
|
10075
|
+
}) })
|
|
10076
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
10059
10077
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
10060
10078
|
CalendarHeader,
|
|
10061
10079
|
{
|
|
@@ -10067,7 +10085,7 @@ function DatePicker({
|
|
|
10067
10085
|
}
|
|
10068
10086
|
),
|
|
10069
10087
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CalendarMonth, { month: viewMonth, selectedDates, disabledDate: isDisabled, onSelect: selectDate })
|
|
10070
|
-
] }),
|
|
10088
|
+
] }) }),
|
|
10071
10089
|
showTime ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TimePanel, { value: draftTime, showSecond, onChange: (next) => {
|
|
10072
10090
|
setDraftTime(next);
|
|
10073
10091
|
if (typeof draftValue === "string" && draftValue) setDraftValue(withTime(dayFromValue(draftValue), next, showSecond));
|
|
@@ -15411,8 +15429,9 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
15411
15429
|
canvas.style.height = `${height}px`;
|
|
15412
15430
|
ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
15413
15431
|
ctx.clearRect(0, 0, width, height);
|
|
15414
|
-
const style = getComputedStyle(scroller);
|
|
15415
|
-
const
|
|
15432
|
+
const style = getComputedStyle(scroller.querySelector("td[data-column-key]") ?? scroller);
|
|
15433
|
+
const padding = Number.parseFloat(style.paddingLeft) || 12;
|
|
15434
|
+
const foreground = getComputedStyle(scroller).color;
|
|
15416
15435
|
const readyCells = /* @__PURE__ */ new Map();
|
|
15417
15436
|
scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
|
|
15418
15437
|
const keys = /* @__PURE__ */ new Set();
|
|
@@ -15447,10 +15466,11 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
15447
15466
|
for (let index = first; index < last; index++) {
|
|
15448
15467
|
const row = rows[index];
|
|
15449
15468
|
const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
|
|
15469
|
+
if (readyCells.get(index)?.has(column.key)) continue;
|
|
15450
15470
|
if (!column.canvasRender && column.render) {
|
|
15451
15471
|
if (!readyCells.get(index)?.has(column.key)) {
|
|
15452
|
-
const skeletonWidth = Math.max(0, Math.min(cellWidth -
|
|
15453
|
-
const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth -
|
|
15472
|
+
const skeletonWidth = Math.max(0, Math.min(cellWidth - padding * 2, 120));
|
|
15473
|
+
const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth - padding : column.align === "center" ? x + (cellWidth - skeletonWidth) / 2 : x + padding;
|
|
15454
15474
|
ctx.save();
|
|
15455
15475
|
ctx.fillStyle = foreground;
|
|
15456
15476
|
ctx.globalAlpha = 0.12;
|
|
@@ -15464,7 +15484,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
15464
15484
|
const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
|
|
15465
15485
|
const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
|
|
15466
15486
|
if (!content2?.text) continue;
|
|
15467
|
-
const available = Math.max(0, cellWidth - (content2.background ?
|
|
15487
|
+
const available = Math.max(0, cellWidth - padding * 2 - (content2.background ? 16 : 0));
|
|
15468
15488
|
let text = content2.text;
|
|
15469
15489
|
if (ctx.measureText(text).width > available) {
|
|
15470
15490
|
let lo = 0, hi = text.length;
|
|
@@ -15477,7 +15497,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
15477
15497
|
}
|
|
15478
15498
|
const textWidth = ctx.measureText(text).width;
|
|
15479
15499
|
const total = textWidth + (content2.background ? 16 : 0);
|
|
15480
|
-
const tx = column.align === "right" ? x + cellWidth - total -
|
|
15500
|
+
const tx = column.align === "right" ? x + cellWidth - total - padding : column.align === "center" ? x + (cellWidth - total) / 2 : x + padding;
|
|
15481
15501
|
if (content2.background) {
|
|
15482
15502
|
ctx.fillStyle = content2.background;
|
|
15483
15503
|
ctx.beginPath();
|
|
@@ -15498,6 +15518,19 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
15498
15518
|
draw();
|
|
15499
15519
|
};
|
|
15500
15520
|
scroller.addEventListener("scroll", onScroll, { passive: true, capture: true });
|
|
15521
|
+
const onWheel = (event) => {
|
|
15522
|
+
if (event.ctrlKey || !event.cancelable) return;
|
|
15523
|
+
const dx = event.deltaX || (event.shiftKey ? event.deltaY : 0);
|
|
15524
|
+
if (!dx) return;
|
|
15525
|
+
const scale = event.deltaMode === 1 ? rowHeight : event.deltaMode === 2 ? scroller.clientWidth : 1;
|
|
15526
|
+
const next = Math.max(0, Math.min(scroller.scrollWidth - scroller.clientWidth, scroller.scrollLeft + dx * scale));
|
|
15527
|
+
if (next === scroller.scrollLeft) return;
|
|
15528
|
+
event.preventDefault();
|
|
15529
|
+
scroller.scrollLeft = next;
|
|
15530
|
+
if (event.deltaX && event.deltaY) scroller.scrollTop += event.deltaY * (event.deltaMode === 2 ? scroller.clientHeight : scale);
|
|
15531
|
+
onScroll();
|
|
15532
|
+
};
|
|
15533
|
+
scroller.addEventListener("wheel", onWheel, { passive: false });
|
|
15501
15534
|
const resize = new ResizeObserver(schedule);
|
|
15502
15535
|
resize.observe(scroller);
|
|
15503
15536
|
const content = new MutationObserver(schedule);
|
|
@@ -15512,6 +15545,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
15512
15545
|
content.disconnect();
|
|
15513
15546
|
theme.disconnect();
|
|
15514
15547
|
scroller.removeEventListener("scroll", onScroll, true);
|
|
15548
|
+
scroller.removeEventListener("wheel", onWheel);
|
|
15515
15549
|
window.removeEventListener("resize", schedule);
|
|
15516
15550
|
};
|
|
15517
15551
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
@@ -15673,6 +15707,7 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
15673
15707
|
|
|
15674
15708
|
// src/components/Table/Table.tsx
|
|
15675
15709
|
var import_react67 = require("react");
|
|
15710
|
+
var import_react_dom7 = require("react-dom");
|
|
15676
15711
|
|
|
15677
15712
|
// src/components/Table/plugins.tsx
|
|
15678
15713
|
var import_react66 = require("react");
|
|
@@ -18341,6 +18376,7 @@ var TableBodyRow = (0, import_react67.memo)(function TableBodyRow2({
|
|
|
18341
18376
|
onCellPointerDown,
|
|
18342
18377
|
onCellPointerMove
|
|
18343
18378
|
}) {
|
|
18379
|
+
const [textColumn, setTextColumn] = (0, import_react67.useState)();
|
|
18344
18380
|
const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
|
|
18345
18381
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
18346
18382
|
"tr",
|
|
@@ -18374,21 +18410,27 @@ var TableBodyRow = (0, import_react67.memo)(function TableBodyRow2({
|
|
|
18374
18410
|
{
|
|
18375
18411
|
"data-column-key": column.key,
|
|
18376
18412
|
"aria-invalid": invalid || void 0,
|
|
18377
|
-
"data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? "true" : void 0,
|
|
18413
|
+
"data-canvas-dom-ready": canvas && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? "true" : void 0,
|
|
18378
18414
|
"aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
|
|
18379
18415
|
rowSpan: pluginCellProps.rowSpan,
|
|
18380
18416
|
colSpan: pluginCellProps.colSpan,
|
|
18381
18417
|
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(),
|
|
18382
18418
|
style: { ...fixedStyle, ...pluginCellProps.style },
|
|
18383
|
-
onMouseEnter: () =>
|
|
18419
|
+
onMouseEnter: () => {
|
|
18420
|
+
if (canvas && !column.canvasRender && !column.render) setTextColumn(column.key);
|
|
18421
|
+
onCellMouseEnter(column);
|
|
18422
|
+
},
|
|
18384
18423
|
onMouseLeave: () => onCellMouseLeave(column),
|
|
18385
18424
|
onClick: (event) => onCellClick(column, event),
|
|
18386
18425
|
onDoubleClick: (event) => onCellDoubleClick(column, event),
|
|
18387
18426
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
18388
|
-
onPointerDown: (event) =>
|
|
18427
|
+
onPointerDown: (event) => {
|
|
18428
|
+
if (canvas && !column.canvasRender && !column.render && textColumn !== column.key) (0, import_react_dom7.flushSync)(() => setTextColumn(column.key));
|
|
18429
|
+
onCellPointerDown(column, event);
|
|
18430
|
+
},
|
|
18389
18431
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
18390
18432
|
children: [
|
|
18391
|
-
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && column.render) ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
18433
|
+
!canvas || visibleColumns.has(column.key) && (pluginCellProps.content !== void 0 || !column.canvasRender && (column.render || textColumn === column.key)) ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
18392
18434
|
TableCellContent,
|
|
18393
18435
|
{
|
|
18394
18436
|
ellipsis: column.ellipsis !== false,
|
package/dist/index.css
CHANGED
|
@@ -4214,26 +4214,35 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
4214
4214
|
cursor: pointer;
|
|
4215
4215
|
}
|
|
4216
4216
|
.sia-table__sortable-header {
|
|
4217
|
+
position: relative;
|
|
4217
4218
|
display: flex;
|
|
4218
4219
|
align-items: center;
|
|
4219
|
-
justify-content: space-between;
|
|
4220
4220
|
min-width: 0;
|
|
4221
|
-
gap: 6px;
|
|
4222
4221
|
}
|
|
4223
4222
|
.sia-table__sort-button {
|
|
4223
|
+
position: absolute;
|
|
4224
|
+
z-index: 1;
|
|
4225
|
+
right: 0;
|
|
4226
|
+
top: 50%;
|
|
4227
|
+
transform: translateY(-50%);
|
|
4224
4228
|
display: grid;
|
|
4225
4229
|
align-content: center;
|
|
4226
4230
|
justify-items: center;
|
|
4227
|
-
flex: 0 0 26px;
|
|
4228
4231
|
width: 26px;
|
|
4229
4232
|
height: 28px;
|
|
4230
4233
|
padding: 0;
|
|
4234
|
+
opacity: 0;
|
|
4231
4235
|
color: var(--sia-color-text-secondary);
|
|
4232
4236
|
cursor: pointer;
|
|
4233
|
-
background:
|
|
4237
|
+
background: var(--sia-color-control-hover);
|
|
4234
4238
|
border: 0;
|
|
4235
4239
|
border-radius: var(--sia-radius);
|
|
4236
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
|
+
}
|
|
4237
4246
|
.sia-table__sort-button[data-sort-order=none] .sia-icon {
|
|
4238
4247
|
margin-block: -2px;
|
|
4239
4248
|
}
|
|
@@ -11543,6 +11552,15 @@ button.sia-treemap__tile:focus-visible,
|
|
|
11543
11552
|
flex-wrap: wrap;
|
|
11544
11553
|
}
|
|
11545
11554
|
}
|
|
11555
|
+
.sia-date-panel__years {
|
|
11556
|
+
display: grid;
|
|
11557
|
+
grid-template-columns: repeat(3, 1fr);
|
|
11558
|
+
gap: 12px 8px;
|
|
11559
|
+
padding: 16px 12px;
|
|
11560
|
+
}
|
|
11561
|
+
.sia-date-panel__years .sia-date-panel__cell button {
|
|
11562
|
+
width: 64px;
|
|
11563
|
+
}
|
|
11546
11564
|
|
|
11547
11565
|
/* src/title-tooltip.css */
|
|
11548
11566
|
body > .sia-title-tooltip[data-sia-popup-layer] {
|
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,7 @@ import { B as ButtonProps, a as ButtonSize } from './Button-xLR4Yt57.cjs';
|
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-xLR4Yt57.cjs';
|
|
8
8
|
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult } from './Select-DKfT3fJR.cjs';
|
|
9
9
|
export { e as Modal, f as ModalProps, g as ModalType, h as Select, i as SelectMode, j as SelectValue } from './Select-DKfT3fJR.cjs';
|
|
10
|
-
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-
|
|
10
|
+
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-BxjiD6zL.cjs';
|
|
11
11
|
export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.cjs';
|
|
12
12
|
export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.cjs';
|
|
13
13
|
import * as Monaco from 'monaco-editor';
|
|
@@ -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
|
|
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
|
@@ -7,7 +7,7 @@ import { B as ButtonProps, a as ButtonSize } from './Button-B59TIes7.js';
|
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-B59TIes7.js';
|
|
8
8
|
import { O as OverlayContainer, a as OverlayApiHandle, M as ModalOpenConfig, S as SelectOption, b as SelectChangeValue, c as SelectProps, d as ModalActionResult } from './Select-Wolx4zNc.js';
|
|
9
9
|
export { e as Modal, f as ModalProps, g as ModalType, h as Select, i as SelectMode, j as SelectValue } from './Select-Wolx4zNc.js';
|
|
10
|
-
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-
|
|
10
|
+
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-D3-8mmAT.js';
|
|
11
11
|
export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.js';
|
|
12
12
|
export { MarkdownEditor, MarkdownEditorMode, MarkdownEditorProps } from './markdown-editor.js';
|
|
13
13
|
import * as Monaco from 'monaco-editor';
|
|
@@ -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
|
|
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
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-SD3MG2PO.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
OverflowTags,
|
|
@@ -6462,8 +6462,9 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6462
6462
|
canvas.style.height = `${height}px`;
|
|
6463
6463
|
ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
6464
6464
|
ctx.clearRect(0, 0, width, height);
|
|
6465
|
-
const style = getComputedStyle(scroller);
|
|
6466
|
-
const
|
|
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;
|
|
6467
6468
|
const readyCells = /* @__PURE__ */ new Map();
|
|
6468
6469
|
scroller.querySelectorAll("tr[data-canvas-row-index]").forEach((element) => {
|
|
6469
6470
|
const keys = /* @__PURE__ */ new Set();
|
|
@@ -6498,10 +6499,11 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6498
6499
|
for (let index = first; index < last; index++) {
|
|
6499
6500
|
const row = rows[index];
|
|
6500
6501
|
const y = headerHeight + index * rowHeight - scroller.scrollTop + rowHeight / 2;
|
|
6502
|
+
if (readyCells.get(index)?.has(column.key)) continue;
|
|
6501
6503
|
if (!column.canvasRender && column.render) {
|
|
6502
6504
|
if (!readyCells.get(index)?.has(column.key)) {
|
|
6503
|
-
const skeletonWidth = Math.max(0, Math.min(cellWidth -
|
|
6504
|
-
const skeletonX = column.align === "right" ? x + cellWidth - skeletonWidth -
|
|
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;
|
|
6505
6507
|
ctx.save();
|
|
6506
6508
|
ctx.fillStyle = foreground;
|
|
6507
6509
|
ctx.globalAlpha = 0.12;
|
|
@@ -6515,7 +6517,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6515
6517
|
const value = getTableValue(row.record, column.dataIndex, column.code ?? column.key);
|
|
6516
6518
|
const content2 = column.canvasRender ? column.canvasRender(value, row.record, row.sourceIndex, { row, rowIndex: index, column }) : { text: value == null ? "" : String(value) };
|
|
6517
6519
|
if (!content2?.text) continue;
|
|
6518
|
-
const available = Math.max(0, cellWidth - (content2.background ?
|
|
6520
|
+
const available = Math.max(0, cellWidth - padding * 2 - (content2.background ? 16 : 0));
|
|
6519
6521
|
let text = content2.text;
|
|
6520
6522
|
if (ctx.measureText(text).width > available) {
|
|
6521
6523
|
let lo = 0, hi = text.length;
|
|
@@ -6528,7 +6530,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6528
6530
|
}
|
|
6529
6531
|
const textWidth = ctx.measureText(text).width;
|
|
6530
6532
|
const total = textWidth + (content2.background ? 16 : 0);
|
|
6531
|
-
const tx = column.align === "right" ? x + cellWidth - total -
|
|
6533
|
+
const tx = column.align === "right" ? x + cellWidth - total - padding : column.align === "center" ? x + (cellWidth - total) / 2 : x + padding;
|
|
6532
6534
|
if (content2.background) {
|
|
6533
6535
|
ctx.fillStyle = content2.background;
|
|
6534
6536
|
ctx.beginPath();
|
|
@@ -6549,6 +6551,19 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6549
6551
|
draw();
|
|
6550
6552
|
};
|
|
6551
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 });
|
|
6552
6567
|
const resize = new ResizeObserver(schedule);
|
|
6553
6568
|
resize.observe(scroller);
|
|
6554
6569
|
const content = new MutationObserver(schedule);
|
|
@@ -6563,6 +6578,7 @@ function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHe
|
|
|
6563
6578
|
content.disconnect();
|
|
6564
6579
|
theme.disconnect();
|
|
6565
6580
|
scroller.removeEventListener("scroll", onScroll, true);
|
|
6581
|
+
scroller.removeEventListener("wheel", onWheel);
|
|
6566
6582
|
window.removeEventListener("resize", schedule);
|
|
6567
6583
|
};
|
|
6568
6584
|
}, [viewport, rows, columns, widths, rowHeight, headerHeight]);
|
|
@@ -6724,6 +6740,7 @@ function playCellFocusGlow(cell, isVisible, onFinish, options) {
|
|
|
6724
6740
|
|
|
6725
6741
|
// src/components/Table/Table.tsx
|
|
6726
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";
|
|
6727
6744
|
|
|
6728
6745
|
// src/components/Table/plugins.tsx
|
|
6729
6746
|
import { isValidElement as isValidElement3, useEffect as useEffect16, useRef as useRef23, useState as useState23 } from "react";
|
|
@@ -9392,6 +9409,7 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9392
9409
|
onCellPointerDown,
|
|
9393
9410
|
onCellPointerMove
|
|
9394
9411
|
}) {
|
|
9412
|
+
const [textColumn, setTextColumn] = useState24();
|
|
9395
9413
|
const resizeColumnKey = resize ? columns.find((column) => !getCellProps(column).hidden)?.key : void 0;
|
|
9396
9414
|
return /* @__PURE__ */ jsx29(
|
|
9397
9415
|
"tr",
|
|
@@ -9425,21 +9443,27 @@ var TableBodyRow = memo(function TableBodyRow2({
|
|
|
9425
9443
|
{
|
|
9426
9444
|
"data-column-key": column.key,
|
|
9427
9445
|
"aria-invalid": invalid || void 0,
|
|
9428
|
-
"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,
|
|
9429
9447
|
"aria-label": canvas ? column.canvasRender?.(value, row.record, row.sourceIndex, { row, rowIndex, column })?.text ?? (value == null ? "" : String(value)) : void 0,
|
|
9430
9448
|
rowSpan: pluginCellProps.rowSpan,
|
|
9431
9449
|
colSpan: pluginCellProps.colSpan,
|
|
9432
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(),
|
|
9433
9451
|
style: { ...fixedStyle, ...pluginCellProps.style },
|
|
9434
|
-
onMouseEnter: () =>
|
|
9452
|
+
onMouseEnter: () => {
|
|
9453
|
+
if (canvas && !column.canvasRender && !column.render) setTextColumn(column.key);
|
|
9454
|
+
onCellMouseEnter(column);
|
|
9455
|
+
},
|
|
9435
9456
|
onMouseLeave: () => onCellMouseLeave(column),
|
|
9436
9457
|
onClick: (event) => onCellClick(column, event),
|
|
9437
9458
|
onDoubleClick: (event) => onCellDoubleClick(column, event),
|
|
9438
9459
|
onContextMenu: (event) => onCellContextMenu(column, event),
|
|
9439
|
-
onPointerDown: (event) =>
|
|
9460
|
+
onPointerDown: (event) => {
|
|
9461
|
+
if (canvas && !column.canvasRender && !column.render && textColumn !== column.key) flushSync(() => setTextColumn(column.key));
|
|
9462
|
+
onCellPointerDown(column, event);
|
|
9463
|
+
},
|
|
9440
9464
|
onPointerMove: (event) => onCellPointerMove(column, event),
|
|
9441
9465
|
children: [
|
|
9442
|
-
!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(
|
|
9443
9467
|
TableCellContent,
|
|
9444
9468
|
{
|
|
9445
9469
|
ellipsis: column.ellipsis !== false,
|
|
@@ -2558,8 +2558,9 @@ function DatePicker({
|
|
|
2558
2558
|
function isDisabled(day) {
|
|
2559
2559
|
const minimum = minDate ?? props.min;
|
|
2560
2560
|
const maximum = maxDate ?? props.max;
|
|
2561
|
-
|
|
2562
|
-
if (
|
|
2561
|
+
const length = picker === "year" ? 4 : 10;
|
|
2562
|
+
if (minimum && day.slice(0, length) < String(minimum).slice(0, length)) return true;
|
|
2563
|
+
if (maximum && day.slice(0, length) > String(maximum).slice(0, length)) return true;
|
|
2563
2564
|
return disabledDate?.(day, { type: "date" }) ?? false;
|
|
2564
2565
|
}
|
|
2565
2566
|
function buildValue(day, time = draftTime) {
|
|
@@ -2639,7 +2640,24 @@ function DatePicker({
|
|
|
2639
2640
|
changeOpen(false);
|
|
2640
2641
|
}
|
|
2641
2642
|
}, children: preset2.label }, index)) }) : null,
|
|
2642
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: "sia-date-panel__calendar", children: picker === "year" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-date-panel__header", children: [
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": "\u4E0A\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, -120)), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "chevron-left", size: 15 }) }) }),
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("strong", { children: [
|
|
2647
|
+
Math.floor(viewMonth.getFullYear() / 10) * 10,
|
|
2648
|
+
"\u5E74 \u2014 ",
|
|
2649
|
+
Math.floor(viewMonth.getFullYear() / 10) * 10 + 9,
|
|
2650
|
+
"\u5E74"
|
|
2651
|
+
] }),
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-date-panel__nav", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": "\u4E0B\u5341\u5E74", onClick: () => setViewMonth(addMonths(viewMonth, 120)), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "chevron-right", size: 15 }) }) })
|
|
2653
|
+
] }),
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-date-panel__years", children: Array.from({ length: 10 }, (_, index) => {
|
|
2655
|
+
const year = String(Math.floor(viewMonth.getFullYear() / 10) * 10 + index);
|
|
2656
|
+
const day = `${year}-01-01`;
|
|
2657
|
+
const selected = selectedDates.some((value2) => value2.slice(0, 4) === year);
|
|
2658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `sia-date-panel__cell${selected ? " is-selected" : ""}${year === String((/* @__PURE__ */ new Date()).getFullYear()) ? " is-today" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-label": `${year}\u5E74`, "aria-pressed": selected, disabled: isDisabled(day), onClick: () => selectDate(day), children: year }) }, year);
|
|
2659
|
+
}) })
|
|
2660
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
2643
2661
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2644
2662
|
CalendarHeader,
|
|
2645
2663
|
{
|
|
@@ -2651,7 +2669,7 @@ function DatePicker({
|
|
|
2651
2669
|
}
|
|
2652
2670
|
),
|
|
2653
2671
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarMonth, { month: viewMonth, selectedDates, disabledDate: isDisabled, onSelect: selectDate })
|
|
2654
|
-
] }),
|
|
2672
|
+
] }) }),
|
|
2655
2673
|
showTime ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TimePanel, { value: draftTime, showSecond, onChange: (next) => {
|
|
2656
2674
|
setDraftTime(next);
|
|
2657
2675
|
if (typeof draftValue === "string" && draftValue) setDraftValue(withTime(dayFromValue(draftValue), next, showSecond));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
1
|
+
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-BxjiD6zL.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './shared-Bx4B28Wh.cjs';
|
|
4
4
|
import './Select-DKfT3fJR.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-
|
|
1
|
+
export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-D3-8mmAT.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './shared-Bx4B28Wh.js';
|
|
4
4
|
import './Select-Wolx4zNc.js';
|