@sia.soul/sia-react-ui 0.1.0 → 0.1.3

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.
@@ -715,8 +715,8 @@ var coreIconPaths = {
715
715
  download: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 3v12M7 10l5 5 5-5M4 20h16" }) }),
716
716
  upload: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 16V4M7 9l5-5 5 5M4 20h16" }) }),
717
717
  refresh: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
718
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M20 7v5h-5" }),
719
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M19 12a7.5 7.5 0 1 1-2-5" })
718
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M20 4v4.686h-4.686" }),
719
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M20 8.686 17.657 6.343A8 8 0 1 0 20 12" })
720
720
  ] }),
721
721
  loader: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1" }),
722
722
  calendar: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  RichTextContent,
3
3
  RichTextEditor
4
- } from "./chunk-OMA75YLM.js";
5
- import "./chunk-DZ45HRVP.js";
4
+ } from "./chunk-OQLDEVCF.js";
5
+ import "./chunk-IMZT6VCU.js";
6
6
  import "./chunk-MBS2HXLZ.js";
7
- import "./chunk-YCVXUMGP.js";
7
+ import "./chunk-2RRTDU3N.js";
8
8
  export {
9
9
  RichTextContent,
10
10
  RichTextEditor
@@ -4,7 +4,7 @@ import { C as ControlSize, a as ControlStatus, d as SelectOption, f as SelectVal
4
4
 
5
5
  type DatePickerShowTime = boolean | {
6
6
  showSecond?: boolean;
7
- defaultValue?: string;
7
+ defaultValue?: string | readonly [string, string];
8
8
  };
9
9
 
10
10
  type DatePickerType = "date" | "week" | "month" | "year" | "quarter";
@@ -42,6 +42,9 @@ interface DatePickerProps extends SharedDatePickerProps {
42
42
  disabledDate?: (value: string, info: DatePickerDisabledInfo) => boolean;
43
43
  onChange?: (value: DatePickerValue) => void;
44
44
  onOpenChange?: (open: boolean) => void;
45
+ /** 只格式化显示文字,不改变传入和回调的标准日期值。 */
46
+ formatValue?: (value: string) => string;
47
+ renderExtraFooter?: () => ReactNode;
45
48
  }
46
49
  interface DateRangePickerProps extends Omit<DatePickerProps, "value" | "defaultValue" | "onChange" | "placeholder" | "multiple" | "presets"> {
47
50
  value?: readonly [string, string];
@@ -50,11 +53,15 @@ interface DateRangePickerProps extends Omit<DatePickerProps, "value" | "defaultV
50
53
  separator?: ReactNode;
51
54
  presets?: readonly DateRangePickerPreset[];
52
55
  maxRangeDays?: number;
56
+ /** 允许单独保留起点或终点;需要点击确定提交未完整的范围。 */
57
+ allowEmpty?: readonly [boolean, boolean];
58
+ /** 锁定指定端点,编辑和清空时保留其值。 */
59
+ endpointDisabled?: readonly [boolean, boolean];
53
60
  onCalendarChange?: (value: readonly [string, string]) => void;
54
61
  onChange?: (value: readonly [string, string]) => void;
55
62
  }
56
- declare function DateRangePicker({ value, defaultValue, placeholder, separator, presets, maxRangeDays, size, status, allowClear, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, disabledDate, disabled, className, onCalendarChange, onChange, onOpenChange, ...props }: DateRangePickerProps): react.JSX.Element;
57
- declare function DatePicker({ value, defaultValue, picker, size, status, allowClear, multiple, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, presets, disabledDate, disabled, className, onChange, onOpenChange, placeholder, ...props }: DatePickerProps): react.JSX.Element;
63
+ declare function DateRangePicker({ value, defaultValue, placeholder, separator, presets, maxRangeDays, allowEmpty, endpointDisabled, size, status, allowClear, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, disabledDate, disabled, className, onCalendarChange, onChange, onOpenChange, formatValue, renderExtraFooter, ...props }: DateRangePickerProps): react.JSX.Element;
64
+ declare function DatePicker({ value, defaultValue, picker, size, status, allowClear, multiple, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, presets, disabledDate, disabled, className, onChange, onOpenChange, placeholder, formatValue, renderExtraFooter, ...props }: DatePickerProps): react.JSX.Element;
58
65
  declare namespace DatePicker {
59
66
  const RangePicker: typeof DateRangePicker;
60
67
  }
@@ -4,7 +4,7 @@ import { C as ControlSize, a as ControlStatus, d as SelectOption, f as SelectVal
4
4
 
5
5
  type DatePickerShowTime = boolean | {
6
6
  showSecond?: boolean;
7
- defaultValue?: string;
7
+ defaultValue?: string | readonly [string, string];
8
8
  };
9
9
 
10
10
  type DatePickerType = "date" | "week" | "month" | "year" | "quarter";
@@ -42,6 +42,9 @@ interface DatePickerProps extends SharedDatePickerProps {
42
42
  disabledDate?: (value: string, info: DatePickerDisabledInfo) => boolean;
43
43
  onChange?: (value: DatePickerValue) => void;
44
44
  onOpenChange?: (open: boolean) => void;
45
+ /** 只格式化显示文字,不改变传入和回调的标准日期值。 */
46
+ formatValue?: (value: string) => string;
47
+ renderExtraFooter?: () => ReactNode;
45
48
  }
46
49
  interface DateRangePickerProps extends Omit<DatePickerProps, "value" | "defaultValue" | "onChange" | "placeholder" | "multiple" | "presets"> {
47
50
  value?: readonly [string, string];
@@ -50,11 +53,15 @@ interface DateRangePickerProps extends Omit<DatePickerProps, "value" | "defaultV
50
53
  separator?: ReactNode;
51
54
  presets?: readonly DateRangePickerPreset[];
52
55
  maxRangeDays?: number;
56
+ /** 允许单独保留起点或终点;需要点击确定提交未完整的范围。 */
57
+ allowEmpty?: readonly [boolean, boolean];
58
+ /** 锁定指定端点,编辑和清空时保留其值。 */
59
+ endpointDisabled?: readonly [boolean, boolean];
53
60
  onCalendarChange?: (value: readonly [string, string]) => void;
54
61
  onChange?: (value: readonly [string, string]) => void;
55
62
  }
56
- declare function DateRangePicker({ value, defaultValue, placeholder, separator, presets, maxRangeDays, size, status, allowClear, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, disabledDate, disabled, className, onCalendarChange, onChange, onOpenChange, ...props }: DateRangePickerProps): react.JSX.Element;
57
- declare function DatePicker({ value, defaultValue, picker, size, status, allowClear, multiple, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, presets, disabledDate, disabled, className, onChange, onOpenChange, placeholder, ...props }: DatePickerProps): react.JSX.Element;
63
+ declare function DateRangePicker({ value, defaultValue, placeholder, separator, presets, maxRangeDays, allowEmpty, endpointDisabled, size, status, allowClear, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, disabledDate, disabled, className, onCalendarChange, onChange, onOpenChange, formatValue, renderExtraFooter, ...props }: DateRangePickerProps): react.JSX.Element;
64
+ declare function DatePicker({ value, defaultValue, picker, size, status, allowClear, multiple, needConfirm, showTime, showToday, open, defaultOpen, suffixIcon, minDate, maxDate, presets, disabledDate, disabled, className, onChange, onOpenChange, placeholder, formatValue, renderExtraFooter, ...props }: DatePickerProps): react.JSX.Element;
58
65
  declare namespace DatePicker {
59
66
  const RangePicker: typeof DateRangePicker;
60
67
  }
@@ -633,8 +633,8 @@ var coreIconPaths = {
633
633
  download: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 3v12M7 10l5 5 5-5M4 20h16" }) }),
634
634
  upload: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 16V4M7 9l5-5 5 5M4 20h16" }) }),
635
635
  refresh: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
636
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 7v5h-5" }),
637
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M19 12a7.5 7.5 0 1 1-2-5" })
636
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 4v4.686h-4.686" }),
637
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 8.686 17.657 6.343A8 8 0 1 0 20 12" })
638
638
  ] }),
639
639
  loader: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1" }),
640
640
  calendar: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
@@ -1004,14 +1004,15 @@ function withTime(date, time, showSecond = false) {
1004
1004
  const [hour = "00", minute = "00", second = "00"] = time.split(":");
1005
1005
  return `${date} ${hour}:${minute}${showSecond ? `:${second}` : ""}`;
1006
1006
  }
1007
- function normalizeDateValue(value, showTime) {
1007
+ function normalizeDateValue(value, showTime, index = 0) {
1008
1008
  if (!value) return "";
1009
1009
  const date = parseDate(value);
1010
1010
  if (!date) return value;
1011
1011
  const day = dateKey(date);
1012
1012
  if (!showTime) return day;
1013
1013
  const config = typeof showTime === "object" ? showTime : {};
1014
- return withTime(day, timePart(value, config.defaultValue ?? "00:00:00"), Boolean(config.showSecond));
1014
+ const fallback = typeof config.defaultValue === "string" ? config.defaultValue : config.defaultValue?.[index] ?? "00:00:00";
1015
+ return withTime(day, timePart(value, fallback), Boolean(config.showSecond));
1015
1016
  }
1016
1017
  var WEEKDAYS = ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"];
1017
1018
  function CalendarMonth({
@@ -1211,8 +1212,9 @@ function placeholderFor(picker, showTime, multiple) {
1211
1212
  function showSecondFrom(showTime) {
1212
1213
  return Boolean(typeof showTime === "object" && showTime.showSecond);
1213
1214
  }
1214
- function defaultTimeFrom(showTime) {
1215
- return typeof showTime === "object" ? showTime.defaultValue ?? "00:00:00" : "00:00:00";
1215
+ function defaultTimeFrom(showTime, index = 0) {
1216
+ const value = typeof showTime === "object" ? showTime.defaultValue : void 0;
1217
+ return typeof value === "string" ? value : value?.[index] ?? "00:00:00";
1216
1218
  }
1217
1219
  function resolvePreset(value) {
1218
1220
  return typeof value === "function" ? value() : value;
@@ -1243,6 +1245,8 @@ function DatePicker({
1243
1245
  onChange,
1244
1246
  onOpenChange,
1245
1247
  placeholder,
1248
+ formatValue = (value2) => value2,
1249
+ renderExtraFooter,
1246
1250
  ...props
1247
1251
  }) {
1248
1252
  const id = (0, import_react5.useId)();
@@ -1308,6 +1312,8 @@ function DatePicker({
1308
1312
  }
1309
1313
  }
1310
1314
  function commitDraft() {
1315
+ const values = Array.isArray(draftValue) ? draftValue : [draftValue];
1316
+ if (values.some((value2) => !value2 || isDisabled(dayFromValue(value2)))) return;
1311
1317
  setCurrentValue(draftValue);
1312
1318
  changeOpen(false);
1313
1319
  }
@@ -1317,7 +1323,7 @@ function DatePicker({
1317
1323
  setDraftValue(empty);
1318
1324
  setCurrentValue(empty);
1319
1325
  }
1320
- const display = Array.isArray(currentValue) ? currentValue.join("\u3001") : currentValue;
1326
+ const display = Array.isArray(currentValue) ? currentValue.map(formatValue).join("\u3001") : currentValue ? formatValue(currentValue) : "";
1321
1327
  const triggerLabel = props["aria-label"] ?? (typeof placeholder === "string" ? placeholder : "\u65E5\u671F\u9009\u62E9\u5668");
1322
1328
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { ref: rootRef, className: `sia-picker sia-picker--${size} sia-picker--${status}${visible ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
1323
1329
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
@@ -1343,15 +1349,16 @@ function DatePicker({
1343
1349
  },
1344
1350
  children: [
1345
1351
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `sia-picker__value${display ? "" : " is-placeholder"}`, children: display || placeholder || placeholderFor(picker, showTime, multiple) }),
1346
- allowClear && display && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { role: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
1347
1352
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "calendar", size: 16 }) })
1348
1353
  ]
1349
1354
  }
1350
1355
  ),
1356
+ allowClear && display && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
1351
1357
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel${showTime ? " sia-date-panel--with-time" : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u9009\u62E9\u9762\u677F", children: [
1352
1358
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sia-date-panel__body", children: [
1353
1359
  presets?.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("aside", { className: "sia-date-panel__presets", children: presets.map((preset, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", onClick: () => {
1354
1360
  const next = resolvePreset(preset.value);
1361
+ if (!next || isDisabled(dayFromValue(next))) return;
1355
1362
  setDraftValue(next);
1356
1363
  if (!resolvedNeedConfirm) {
1357
1364
  setCurrentValue(next);
@@ -1379,6 +1386,7 @@ function DatePicker({
1379
1386
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1380
1387
  DatePanelFooter,
1381
1388
  {
1389
+ extra: renderExtraFooter?.(),
1382
1390
  showToday,
1383
1391
  needConfirm: resolvedNeedConfirm,
1384
1392
  disabledConfirm: Array.isArray(draftValue) ? draftValue.length === 0 : !draftValue,
@@ -1396,6 +1404,8 @@ function DateRangePicker({
1396
1404
  separator = "\u2192",
1397
1405
  presets,
1398
1406
  maxRangeDays,
1407
+ allowEmpty = [false, false],
1408
+ endpointDisabled = [false, false],
1399
1409
  size = "medium",
1400
1410
  status = "default",
1401
1411
  allowClear = true,
@@ -1413,6 +1423,8 @@ function DateRangePicker({
1413
1423
  onCalendarChange,
1414
1424
  onChange,
1415
1425
  onOpenChange,
1426
+ formatValue = (value2) => value2,
1427
+ renderExtraFooter,
1416
1428
  ...props
1417
1429
  }) {
1418
1430
  const id = (0, import_react5.useId)();
@@ -1428,9 +1440,10 @@ function DateRangePicker({
1428
1440
  const [compactDateTime, setCompactDateTime] = (0, import_react5.useState)(false);
1429
1441
  const showSecond = showSecondFrom(showTime);
1430
1442
  const defaultTime = defaultTimeFrom(showTime);
1443
+ const defaultEndTime = defaultTimeFrom(showTime, 1);
1431
1444
  const [times, setTimes] = (0, import_react5.useState)([
1432
1445
  timePart(currentValue[0], defaultTime),
1433
- timePart(currentValue[1], defaultTime)
1446
+ timePart(currentValue[1], defaultEndTime)
1434
1447
  ]);
1435
1448
  const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
1436
1449
  const rangeDates = [dayFromValue(draftValue[0]), dayFromValue(draftValue[1])];
@@ -1460,8 +1473,8 @@ function DateRangePicker({
1460
1473
  function changeOpen(next) {
1461
1474
  if (next) {
1462
1475
  setDraftValue(currentValue);
1463
- setTimes([timePart(currentValue[0], defaultTime), timePart(currentValue[1], defaultTime)]);
1464
- setActiveIndex(currentValue[0] && !currentValue[1] ? 1 : 0);
1476
+ setTimes([timePart(currentValue[0], defaultTime), timePart(currentValue[1], defaultEndTime)]);
1477
+ setActiveIndex(endpointDisabled[0] ? 1 : endpointDisabled[1] ? 0 : currentValue[0] && !currentValue[1] ? 1 : 0);
1465
1478
  const nextStartMonth = startOfMonth(parseDate(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date());
1466
1479
  setViewMonth(nextStartMonth);
1467
1480
  setEndViewMonth(startOfMonth(parseDate(dayFromValue(currentValue[1])) ?? addMonths(nextStartMonth, 1)));
@@ -1469,6 +1482,7 @@ function DateRangePicker({
1469
1482
  setVisible(next);
1470
1483
  }
1471
1484
  function isDisabled(day, index = activeIndex, pairedDateTime = false) {
1485
+ if (endpointDisabled[index]) return true;
1472
1486
  const minimum = minDate ?? props.min;
1473
1487
  const maximum = maxDate ?? props.max;
1474
1488
  if (minimum && day < String(minimum).slice(0, 10)) return true;
@@ -1491,6 +1505,17 @@ function DateRangePicker({
1491
1505
  }
1492
1506
  function selectDate(day) {
1493
1507
  if (isDisabled(day)) return;
1508
+ if (endpointDisabled.some(Boolean)) {
1509
+ const index = endpointDisabled[0] ? 1 : 0;
1510
+ const next = [...draftValue];
1511
+ next[index] = buildRangeValue(day, index);
1512
+ updateDraft(next);
1513
+ if (!resolvedNeedConfirm && isValidRange(next)) {
1514
+ setCurrentValue(next);
1515
+ changeOpen(false);
1516
+ }
1517
+ return;
1518
+ }
1494
1519
  if (activeIndex === 0 || !rangeDates[0] || rangeDates[1]) {
1495
1520
  const next = [buildRangeValue(day, 0), ""];
1496
1521
  updateDraft(next);
@@ -1526,6 +1551,7 @@ function DateRangePicker({
1526
1551
  }
1527
1552
  }
1528
1553
  function changeTime(index, nextTime) {
1554
+ if (endpointDisabled[index]) return;
1529
1555
  const nextTimes = [...times];
1530
1556
  nextTimes[index] = nextTime;
1531
1557
  setTimes(nextTimes);
@@ -1536,6 +1562,28 @@ function DateRangePicker({
1536
1562
  updateDraft(nextValue);
1537
1563
  }
1538
1564
  }
1565
+ function isValidRange(next) {
1566
+ if (!next.some(Boolean)) return false;
1567
+ for (const index of [0, 1]) {
1568
+ if (!next[index]) {
1569
+ if (!allowEmpty[index]) return false;
1570
+ else continue;
1571
+ }
1572
+ if (endpointDisabled[index]) {
1573
+ if (next[index] !== currentValue[index]) return false;
1574
+ else continue;
1575
+ }
1576
+ const day = dayFromValue(next[index]);
1577
+ if (!day) return false;
1578
+ if (minDate && day < minDate.slice(0, 10) || maxDate && day > maxDate.slice(0, 10)) return false;
1579
+ if (disabledDate?.(day, { from: index === 1 ? dayFromValue(next[0]) || void 0 : void 0, type: "date" })) return false;
1580
+ }
1581
+ if (next[0] && next[1]) {
1582
+ if (next[0] > next[1]) return false;
1583
+ if (maxRangeDays && Math.abs(daysBetween(dayFromValue(next[0]), dayFromValue(next[1]))) >= maxRangeDays) return false;
1584
+ }
1585
+ return true;
1586
+ }
1539
1587
  function confirm() {
1540
1588
  if (compactDateTime && showTime && activeIndex === 0) {
1541
1589
  if (!draftValue[0]) return;
@@ -1544,7 +1592,7 @@ function DateRangePicker({
1544
1592
  setHoverDate("");
1545
1593
  return;
1546
1594
  }
1547
- if (!draftValue[0] || !draftValue[1] || invalidDateTimeRange) return;
1595
+ if (!isValidRange(draftValue)) return;
1548
1596
  setCurrentValue(draftValue);
1549
1597
  changeOpen(false);
1550
1598
  }
@@ -1552,10 +1600,11 @@ function DateRangePicker({
1552
1600
  const raw = resolveRangePreset(preset.value);
1553
1601
  const next = [
1554
1602
  normalizeDateValue(raw[0], showTime),
1555
- normalizeDateValue(raw[1], showTime)
1603
+ normalizeDateValue(raw[1], showTime, 1)
1556
1604
  ];
1605
+ if (!isValidRange(next)) return;
1557
1606
  updateDraft(next);
1558
- setTimes([timePart(next[0], defaultTime), timePart(next[1], defaultTime)]);
1607
+ setTimes([timePart(next[0], defaultTime), timePart(next[1], defaultEndTime)]);
1559
1608
  const nextStartMonth = startOfMonth(parseDate(dayFromValue(next[0] || next[1])) ?? /* @__PURE__ */ new Date());
1560
1609
  setViewMonth(nextStartMonth);
1561
1610
  setEndViewMonth(startOfMonth(parseDate(dayFromValue(next[1])) ?? addMonths(nextStartMonth, 1)));
@@ -1566,7 +1615,7 @@ function DateRangePicker({
1566
1615
  }
1567
1616
  function clearValue(event) {
1568
1617
  event.stopPropagation();
1569
- const empty = ["", ""];
1618
+ const empty = [endpointDisabled[0] ? currentValue[0] : "", endpointDisabled[1] ? currentValue[1] : ""];
1570
1619
  updateDraft(empty);
1571
1620
  setCurrentValue(empty);
1572
1621
  setActiveIndex(0);
@@ -1635,14 +1684,14 @@ function DateRangePicker({
1635
1684
  disabled,
1636
1685
  onClick: () => changeOpen(!visible),
1637
1686
  children: [
1638
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `sia-picker-range-control__value${currentValue[0] ? "" : " is-placeholder"}`, children: currentValue[0] || placeholder[0] }),
1687
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `sia-picker-range-control__value${currentValue[0] ? "" : " is-placeholder"}`, children: currentValue[0] ? formatValue(currentValue[0]) : placeholder[0] }),
1639
1688
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sia-picker-range-control__separator", children: separator }),
1640
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `sia-picker-range-control__value${currentValue[1] ? "" : " is-placeholder"}`, children: currentValue[1] || placeholder[1] }),
1641
- allowClear && (currentValue[0] || currentValue[1]) && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { role: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
1689
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `sia-picker-range-control__value${currentValue[1] ? "" : " is-placeholder"}`, children: currentValue[1] ? formatValue(currentValue[1]) : placeholder[1] }),
1642
1690
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "calendar", size: 16 }) })
1643
1691
  ]
1644
1692
  }
1645
1693
  ),
1694
+ allowClear && (currentValue[0] || currentValue[1]) && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
1646
1695
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel sia-date-panel--range${showTime ? ` sia-date-panel--with-time sia-date-panel--range-time-${compactDateTime ? "compact" : "paired"}` : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F", children: [
1647
1696
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sia-date-panel__body", children: showTime ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sia-date-panel__range-date-time", children: compactDateTime ? renderDateTimeGroup(activeIndex) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1648
1697
  renderDateTimeGroup(0),
@@ -1677,10 +1726,11 @@ function DateRangePicker({
1677
1726
  DatePanelFooter,
1678
1727
  {
1679
1728
  showToday: showToday && !presets?.length,
1680
- needConfirm: resolvedNeedConfirm,
1681
- disabledConfirm: compactDateTime && showTime && activeIndex === 0 ? !draftValue[0] : !draftValue[0] || !draftValue[1] || invalidDateTimeRange,
1729
+ needConfirm: resolvedNeedConfirm || allowEmpty.some(Boolean),
1730
+ disabledConfirm: compactDateTime && showTime && activeIndex === 0 ? !draftValue[0] : !isValidRange(draftValue),
1682
1731
  confirmText: compactDateTime && showTime && activeIndex === 0 ? "\u4E0B\u4E00\u6B65" : "\u786E\u5B9A",
1683
1732
  extra: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1733
+ renderExtraFooter?.(),
1684
1734
  presets?.map((preset, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", onClick: () => applyPreset(preset), children: preset.label }, index)),
1685
1735
  compactDateTime && showTime && activeIndex === 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", onClick: () => {
1686
1736
  setActiveIndex(0);
@@ -1,3 +1,3 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-DWik3ADr.cjs';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-UyYrHex6.cjs';
2
2
  import 'react';
3
3
  import './Select-CJJ5LQap.cjs';
@@ -1,3 +1,3 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-BDWdo7qt.js';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-DOyG1DGp.js';
2
2
  import 'react';
3
3
  import './Select-CJJ5LQap.js';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-34TTF4Y7.js";
4
- import "./chunk-JKZGAZMB.js";
5
- import "./chunk-YCVXUMGP.js";
3
+ } from "./chunk-R4OWKIXJ.js";
4
+ import "./chunk-OAC7BSUR.js";
5
+ import "./chunk-2RRTDU3N.js";
6
6
  export {
7
7
  SelectDateRange
8
8
  };