@uzum-tech/ui 1.1.5 → 1.2.0

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.
Files changed (79) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +266 -340
  3. package/dist/index.prod.js +2 -2
  4. package/es/_utils/uzum/warn.js +3 -3
  5. package/es/alert/src/Alert.js +1 -1
  6. package/es/alert/src/styles/index.cssr.js +1 -1
  7. package/es/date-picker/src/DatePicker.d.ts +1 -0
  8. package/es/date-picker/src/DatePicker.js +10 -8
  9. package/es/date-picker/src/config.d.ts +1 -1
  10. package/es/date-picker/src/config.js +1 -1
  11. package/es/date-picker/src/interface.d.ts +7 -5
  12. package/es/date-picker/src/panel/date.d.ts +10 -7
  13. package/es/date-picker/src/panel/date.js +38 -18
  14. package/es/date-picker/src/panel/daterange.d.ts +18 -7
  15. package/es/date-picker/src/panel/daterange.js +94 -43
  16. package/es/date-picker/src/panel/datetime.d.ts +3 -1
  17. package/es/date-picker/src/panel/datetimerange.d.ts +2 -0
  18. package/es/date-picker/src/panel/panelHeader.d.ts +28 -7
  19. package/es/date-picker/src/panel/panelHeader.js +37 -13
  20. package/es/date-picker/src/panel/panelMonth.d.ts +16 -8
  21. package/es/date-picker/src/panel/panelMonth.js +8 -4
  22. package/es/date-picker/src/panel/panelMonthContent.d.ts +3 -1
  23. package/es/date-picker/src/panel/panelMonthContent.js +2 -5
  24. package/es/date-picker/src/panel/panelYear.d.ts +16 -8
  25. package/es/date-picker/src/panel/panelYear.js +8 -4
  26. package/es/date-picker/src/panel/panelYearContent.d.ts +3 -1
  27. package/es/date-picker/src/panel/panelYearContent.js +2 -1
  28. package/es/date-picker/src/panel/use-calendar.d.ts +4 -3
  29. package/es/date-picker/src/panel/use-dual-calendar.d.ts +1 -0
  30. package/es/date-picker/src/panel/use-panel-common.d.ts +2 -0
  31. package/es/date-picker/src/panel/use-panel-common.js +1 -0
  32. package/es/date-picker/src/styles/index.cssr.js +12 -10
  33. package/es/date-picker/src/utils.d.ts +1 -0
  34. package/es/grid/src/Grid.js +1 -1
  35. package/es/preset.d.ts +2 -2
  36. package/es/preset.js +3 -3
  37. package/es/version.d.ts +1 -1
  38. package/es/version.js +1 -1
  39. package/lib/_utils/uzum/warn.js +3 -3
  40. package/lib/alert/src/Alert.js +1 -1
  41. package/lib/alert/src/styles/index.cssr.js +1 -1
  42. package/lib/date-picker/src/DatePicker.d.ts +1 -0
  43. package/lib/date-picker/src/DatePicker.js +9 -7
  44. package/lib/date-picker/src/config.d.ts +1 -1
  45. package/lib/date-picker/src/config.js +1 -1
  46. package/lib/date-picker/src/interface.d.ts +7 -5
  47. package/lib/date-picker/src/panel/date.d.ts +10 -7
  48. package/lib/date-picker/src/panel/date.js +37 -17
  49. package/lib/date-picker/src/panel/daterange.d.ts +18 -7
  50. package/lib/date-picker/src/panel/daterange.js +93 -42
  51. package/lib/date-picker/src/panel/datetime.d.ts +3 -1
  52. package/lib/date-picker/src/panel/datetimerange.d.ts +2 -0
  53. package/lib/date-picker/src/panel/panelHeader.d.ts +28 -7
  54. package/lib/date-picker/src/panel/panelHeader.js +37 -13
  55. package/lib/date-picker/src/panel/panelMonth.d.ts +16 -8
  56. package/lib/date-picker/src/panel/panelMonth.js +8 -4
  57. package/lib/date-picker/src/panel/panelMonthContent.d.ts +3 -1
  58. package/lib/date-picker/src/panel/panelMonthContent.js +2 -5
  59. package/lib/date-picker/src/panel/panelYear.d.ts +16 -8
  60. package/lib/date-picker/src/panel/panelYear.js +8 -4
  61. package/lib/date-picker/src/panel/panelYearContent.d.ts +3 -1
  62. package/lib/date-picker/src/panel/panelYearContent.js +2 -1
  63. package/lib/date-picker/src/panel/use-calendar.d.ts +4 -3
  64. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +1 -0
  65. package/lib/date-picker/src/panel/use-panel-common.d.ts +2 -0
  66. package/lib/date-picker/src/panel/use-panel-common.js +1 -0
  67. package/lib/date-picker/src/styles/index.cssr.js +12 -10
  68. package/lib/date-picker/src/utils.d.ts +1 -0
  69. package/lib/grid/src/Grid.js +1 -1
  70. package/lib/preset.d.ts +2 -2
  71. package/lib/preset.js +3 -3
  72. package/lib/version.d.ts +1 -1
  73. package/lib/version.js +1 -1
  74. package/package.json +5 -6
  75. package/web-types.json +9 -9
  76. package/es/date-picker/src/panel/monthrange.d.ts +0 -1303
  77. package/es/date-picker/src/panel/monthrange.js +0 -117
  78. package/lib/date-picker/src/panel/monthrange.d.ts +0 -1303
  79. package/lib/date-picker/src/panel/monthrange.js +0 -119
package/dist/index.js CHANGED
@@ -597,16 +597,16 @@
597
597
 
598
598
  const warnedMessages = /* @__PURE__ */new Set();
599
599
  function warnOnce(location, message) {
600
- const mergedMessage = `[naive/${location}]: ${message}`;
600
+ const mergedMessage = `[uzum-ui/${location}]: ${message}`;
601
601
  if (warnedMessages.has(mergedMessage)) return;
602
602
  warnedMessages.add(mergedMessage);
603
603
  console.error(mergedMessage);
604
604
  }
605
605
  function warn$2(location, message) {
606
- console.error(`[naive/${location}]: ${message}`);
606
+ console.error(`[uzum-ui/${location}]: ${message}`);
607
607
  }
608
608
  function throwError(location, message) {
609
- throw new Error(`[naive/${location}]: ${message}`);
609
+ throw new Error(`[uzum-ui/${location}]: ${message}`);
610
610
  }
611
611
 
612
612
  function smallerSize(size) {
@@ -42629,7 +42629,7 @@
42629
42629
  width: var(--u-close-icon-size);
42630
42630
  height: var(--u-close-icon-size);
42631
42631
  `),
42632
- // fix: https://github.com/tusen-ai/naive-ui/issues/4588
42632
+ // fix: https://github.com/tusen-ai/uzum-ui/issues/4588
42633
42633
  cM("right-adjust", [cB("alert-body", `
42634
42634
  padding-right: calc(var(--u-close-size) + var(--u-padding) + 2px);
42635
42635
  `)]), cM("show-icon", [cB("alert-body", [cE("content, title", `
@@ -42863,7 +42863,7 @@
42863
42863
  `${mergedClsPrefix}-alert--${this.layoutType}`,
42864
42864
  this.actionsHorizontal && `${mergedClsPrefix}-alert--horizontal`,
42865
42865
  this.showIcon && `${mergedClsPrefix}-alert--show-icon`,
42866
- // fix: https://github.com/tusen-ai/naive-ui/issues/4588
42866
+ // fix: https://github.com/tusen-ai/uzum-ui/issues/4588
42867
42867
  !this.title && this.closable && `${mergedClsPrefix}-alert--right-adjust`,
42868
42868
  this.rtlEnabled && `${mergedClsPrefix}-alert--rtl`
42869
42869
  ],
@@ -48543,7 +48543,7 @@
48543
48543
  }
48544
48544
  });
48545
48545
 
48546
- const START_YEAR = 1901;
48546
+ const START_YEAR = 1924;
48547
48547
  const END_YEAR = /* @__PURE__ */new Date().getFullYear();
48548
48548
  const MONTH_ITEM_HEIGHT = 50;
48549
48549
  const MONTH_ITEM_GAP = 8;
@@ -71854,6 +71854,7 @@
71854
71854
  const usePanelCommonProps = {
71855
71855
  active: Boolean,
71856
71856
  dateFormat: String,
71857
+ type: String,
71857
71858
  timeFormat: {
71858
71859
  type: String,
71859
71860
  value: TIME_FORMAT
@@ -72377,7 +72378,11 @@
72377
72378
  ],
72378
72379
  onClick: () => {
72379
72380
  useAsQuickJump ? handleQuickMonthClick(item, (value) => {
72380
- props.onUpdateValue(value, false);
72381
+ props.onUpdateValue(
72382
+ value,
72383
+ false,
72384
+ item
72385
+ );
72381
72386
  }) : handleDateClick(item);
72382
72387
  }
72383
72388
  },
@@ -72406,17 +72411,9 @@
72406
72411
  onKeydown: this.handlePanelKeyDown
72407
72412
  },
72408
72413
  /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-month-calendar` }, {
72409
- default: () => [
72410
- this.monthArray.map(
72411
- (item, i) => renderItem(item, i, mergedClsPrefix)
72412
- ),
72413
- /* @__PURE__ */ vue.h(
72414
- "div",
72415
- {
72416
- class: `${mergedClsPrefix}-date-panel-month-calendar__padding`
72417
- }
72418
- )
72419
- ]
72414
+ default: () => this.monthArray.map(
72415
+ (item, i) => renderItem(item, i, mergedClsPrefix)
72416
+ )
72420
72417
  }),
72421
72418
  /* @__PURE__ */ vue.h(FocusDetector, { onFocus: this.handleFocusDetectorFocus })
72422
72419
  );
@@ -72439,6 +72436,7 @@
72439
72436
  type: String,
72440
72437
  required: true
72441
72438
  },
72439
+ disabled: Boolean,
72442
72440
  onUpdateValue: {
72443
72441
  type: Function,
72444
72442
  required: true
@@ -72456,10 +72454,12 @@
72456
72454
  }
72457
72455
  });
72458
72456
  function handleHeaderClick() {
72457
+ if (props.disabled)
72458
+ return;
72459
72459
  showRef.value = !showRef.value;
72460
72460
  }
72461
- function handleUpdateValue(value) {
72462
- props.onUpdateValue(value);
72461
+ function handleUpdateValue(value, doUpdate, item) {
72462
+ props.onUpdateValue(value, doUpdate, item);
72463
72463
  handleHeaderClick();
72464
72464
  }
72465
72465
  return {
@@ -72470,13 +72470,14 @@
72470
72470
  };
72471
72471
  },
72472
72472
  render() {
72473
- const { mergedClsPrefix } = this;
72473
+ const { mergedClsPrefix, disabled } = this;
72474
72474
  return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-month__month-year` }, /* @__PURE__ */ vue.h(
72475
72475
  "div",
72476
72476
  {
72477
72477
  class: [
72478
72478
  `${mergedClsPrefix}-date-panel-month__text`,
72479
- this.show && `${mergedClsPrefix}-date-panel-month__text--active`
72479
+ this.show && `${mergedClsPrefix}-date-panel-month__text--active`,
72480
+ disabled && `${mergedClsPrefix}-date-panel-month__text--disabled`
72480
72481
  ],
72481
72482
  onClick: this.handleHeaderClick
72482
72483
  },
@@ -72533,7 +72534,11 @@
72533
72534
  ],
72534
72535
  onClick: () => {
72535
72536
  useAsQuickJump ? handleQuickMonthClick(item, (value) => {
72536
- props.onUpdateValue(value, false);
72537
+ props.onUpdateValue(
72538
+ value,
72539
+ false,
72540
+ item
72541
+ );
72537
72542
  }) : handleDateClick(item);
72538
72543
  }
72539
72544
  },
@@ -72556,6 +72561,7 @@
72556
72561
  class: [
72557
72562
  `${mergedClsPrefix}-date-panel`,
72558
72563
  `${mergedClsPrefix}-date-panel--month`,
72564
+ `${mergedClsPrefix}-date-panel--year`,
72559
72565
  this.themeClass
72560
72566
  ],
72561
72567
  onFocus: this.handlePanelFocus,
@@ -72597,6 +72603,7 @@
72597
72603
  type: String,
72598
72604
  required: true
72599
72605
  },
72606
+ disabled: Boolean,
72600
72607
  onUpdateValue: {
72601
72608
  type: Function,
72602
72609
  required: true
@@ -72614,10 +72621,12 @@
72614
72621
  }
72615
72622
  });
72616
72623
  function handleHeaderClick() {
72624
+ if (props.disabled)
72625
+ return;
72617
72626
  showRef.value = !showRef.value;
72618
72627
  }
72619
- function handleUpdateValue(value) {
72620
- props.onUpdateValue(value);
72628
+ function handleUpdateValue(value, doUpdate, item) {
72629
+ props.onUpdateValue(value, doUpdate, item);
72621
72630
  handleHeaderClick();
72622
72631
  }
72623
72632
  return {
@@ -72628,7 +72637,7 @@
72628
72637
  };
72629
72638
  },
72630
72639
  render() {
72631
- const { mergedClsPrefix } = this;
72640
+ const { mergedClsPrefix, disabled } = this;
72632
72641
  return /* @__PURE__ */ vue.h(
72633
72642
  "div",
72634
72643
  {
@@ -72640,7 +72649,8 @@
72640
72649
  {
72641
72650
  class: [
72642
72651
  `${mergedClsPrefix}-date-panel-month__text`,
72643
- this.show && `${mergedClsPrefix}-date-panel-month__text--active`
72652
+ this.show && `${mergedClsPrefix}-date-panel-month__text--active`,
72653
+ disabled && `${mergedClsPrefix}-date-panel-month__text--disabled`
72644
72654
  ],
72645
72655
  onClick: this.handleHeaderClick
72646
72656
  },
@@ -72687,14 +72697,21 @@
72687
72697
  type: String,
72688
72698
  required: true
72689
72699
  },
72690
- onUpdateValue: {
72691
- type: Function,
72692
- required: true
72693
- }
72700
+ isMonth: {
72701
+ type: Boolean,
72702
+ value: false
72703
+ },
72704
+ isYear: {
72705
+ type: Boolean,
72706
+ value: false
72707
+ },
72708
+ onUpdateValue: Function,
72709
+ onUpdateMonth: Function,
72710
+ onUpdateYear: Function
72694
72711
  },
72695
- setup() {
72696
- const monthPanelIsActive = vue.ref(false);
72697
- const yearPanelIsActive = vue.ref(false);
72712
+ setup(props) {
72713
+ const monthPanelIsActive = vue.ref(props.isMonth);
72714
+ const yearPanelIsActive = vue.ref(props.isYear);
72698
72715
  function onUpdateMonthPanelIsActive(value) {
72699
72716
  monthPanelIsActive.value = value;
72700
72717
  if (value)
@@ -72702,41 +72719,65 @@
72702
72719
  }
72703
72720
  function onUpdateYearPanelIsActive(value) {
72704
72721
  yearPanelIsActive.value = value;
72705
- if (value)
72722
+ if (value && !props.isMonth)
72706
72723
  monthPanelIsActive.value = false;
72707
72724
  }
72725
+ function handleUpdateMonth(value, doUpdate, item) {
72726
+ props.onUpdateMonth?.(value, doUpdate, item);
72727
+ props.onUpdateValue?.(value, doUpdate, item);
72728
+ }
72729
+ function handleUpdateYear(value, doUpdate, item) {
72730
+ props.onUpdateYear?.(value, doUpdate, item);
72731
+ props.onUpdateValue?.(value, doUpdate, item);
72732
+ }
72708
72733
  return {
72709
72734
  monthPanelIsActive,
72710
72735
  yearPanelIsActive,
72711
72736
  onUpdateMonthPanelIsActive,
72712
- onUpdateYearPanelIsActive
72737
+ onUpdateYearPanelIsActive,
72738
+ handleUpdateMonth,
72739
+ handleUpdateYear
72713
72740
  };
72714
72741
  },
72715
72742
  render() {
72716
- const { mergedClsPrefix } = this;
72717
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-month` }, /* @__PURE__ */ vue.h(
72718
- PanelMonth,
72719
- {
72720
- panelActive: this.monthPanelIsActive,
72721
- value: this.value,
72722
- mergedClsPrefix,
72723
- calendarMonth: this.calendarMonth,
72724
- calendarYear: this.calendarYear,
72725
- onUpdatePanelActive: this.onUpdateMonthPanelIsActive,
72726
- onUpdateValue: this.onUpdateValue
72727
- }
72728
- ), /* @__PURE__ */ vue.h(
72729
- PanelYear,
72743
+ const { mergedClsPrefix, isYear } = this;
72744
+ return /* @__PURE__ */ vue.h(
72745
+ "div",
72730
72746
  {
72731
- panelActive: this.yearPanelIsActive,
72732
- value: this.value,
72733
- mergedClsPrefix,
72734
- calendarMonth: this.calendarMonth,
72735
- calendarYear: this.calendarYear,
72736
- onUpdatePanelActive: this.onUpdateYearPanelIsActive,
72737
- onUpdateValue: this.onUpdateValue
72738
- }
72739
- ));
72747
+ class: [
72748
+ `${mergedClsPrefix}-date-panel-month`,
72749
+ {
72750
+ [`${mergedClsPrefix}-date-panel-month--justify-end`]: isYear
72751
+ }
72752
+ ]
72753
+ },
72754
+ isYear ? null : /* @__PURE__ */ vue.h(
72755
+ PanelMonth,
72756
+ {
72757
+ panelActive: this.monthPanelIsActive,
72758
+ value: this.value,
72759
+ mergedClsPrefix,
72760
+ calendarMonth: this.calendarMonth,
72761
+ calendarYear: this.calendarYear,
72762
+ disabled: this.isMonth,
72763
+ onUpdatePanelActive: this.onUpdateMonthPanelIsActive,
72764
+ onUpdateValue: this.handleUpdateMonth
72765
+ }
72766
+ ),
72767
+ /* @__PURE__ */ vue.h(
72768
+ PanelYear,
72769
+ {
72770
+ panelActive: this.yearPanelIsActive,
72771
+ value: this.value,
72772
+ mergedClsPrefix,
72773
+ calendarMonth: this.calendarMonth,
72774
+ calendarYear: this.calendarYear,
72775
+ disabled: this.isYear,
72776
+ onUpdatePanelActive: this.onUpdateYearPanelIsActive,
72777
+ onUpdateValue: this.handleUpdateYear
72778
+ }
72779
+ )
72780
+ );
72740
72781
  }
72741
72782
  });
72742
72783
 
@@ -73796,10 +73837,41 @@
73796
73837
  }
73797
73838
  });
73798
73839
  }
73799
- return useCalendar(props, "date");
73840
+ const calendar = useCalendar(props, "date");
73841
+ const type = props.type;
73842
+ const monthTypes = ["month", "quarter"];
73843
+ const withoutDayTypes = [...monthTypes, "year"];
73844
+ const isWithoutDay = vue.computed(() => withoutDayTypes.includes(type));
73845
+ const isMonth = vue.computed(() => monthTypes.includes(type));
73846
+ const isYear = vue.computed(() => type === "year");
73847
+ const handleMonthClick = (value, _doUpdate, item) => {
73848
+ calendar.onUpdateCalendarValue(value);
73849
+ isMonth.value && calendar.handleDateClick(item);
73850
+ };
73851
+ const handleYearClick = (value, _doUpdate, item) => {
73852
+ calendar.onUpdateCalendarValue(value);
73853
+ isYear.value && calendar.handleDateClick(item);
73854
+ };
73855
+ return {
73856
+ ...calendar,
73857
+ isWithoutDay,
73858
+ isMonth,
73859
+ isYear,
73860
+ handleMonthClick,
73861
+ handleYearClick
73862
+ };
73800
73863
  },
73801
73864
  render() {
73802
- const { mergedClsPrefix, shortcuts, onRender } = this;
73865
+ const {
73866
+ mergedClsPrefix,
73867
+ shortcuts,
73868
+ onRender,
73869
+ isWithoutDay,
73870
+ isYear,
73871
+ isMonth,
73872
+ handleMonthClick,
73873
+ handleYearClick
73874
+ } = this;
73803
73875
  onRender?.();
73804
73876
  return /* @__PURE__ */ vue.h(
73805
73877
  "div",
@@ -73819,12 +73891,15 @@
73819
73891
  PanelHeader,
73820
73892
  {
73821
73893
  value: this.calendarValue,
73894
+ isMonth,
73895
+ isYear,
73822
73896
  mergedClsPrefix,
73823
73897
  calendarMonth: this.calendarMonth,
73824
73898
  calendarYear: this.calendarYear,
73825
- onUpdateValue: this.onUpdateCalendarValue
73899
+ onUpdateMonth: handleMonthClick,
73900
+ onUpdateYear: handleYearClick
73826
73901
  }
73827
- ), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-weekdays` }, this.weekdays.map((weekday) => /* @__PURE__ */ vue.h(
73902
+ ), isWithoutDay ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-placeholder` }) : /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-weekdays` }, this.weekdays.map((weekday) => /* @__PURE__ */ vue.h(
73828
73903
  "div",
73829
73904
  {
73830
73905
  key: weekday,
@@ -73849,9 +73924,14 @@
73849
73924
  this.handleDateClick(dateItem);
73850
73925
  }
73851
73926
  },
73852
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-date__trigger` }),
73927
+ /* @__PURE__ */ vue.h(
73928
+ "div",
73929
+ {
73930
+ class: `${mergedClsPrefix}-date-panel-date__trigger`
73931
+ }
73932
+ ),
73853
73933
  dateItem.dateObject.date
73854
- )))),
73934
+ ))))),
73855
73935
  this.datePickerSlots.footer ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-footer` }, this.datePickerSlots.footer()) : null,
73856
73936
  this.actions?.length || shortcuts ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions` }, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions__prefix` }, shortcuts && Object.keys(shortcuts).map((key) => {
73857
73937
  const shortcut = shortcuts[key];
@@ -73893,10 +73973,76 @@
73893
73973
  }
73894
73974
  });
73895
73975
  }
73896
- return useDualCalendar(props, "daterange");
73976
+ const calendar = useDualCalendar(props, "daterange");
73977
+ const type = props.type;
73978
+ const monthRanges = ["monthrange", "quarterrange"];
73979
+ const withoutDayTypes = [...monthRanges, "yearrange"];
73980
+ const isWithoutDay = vue.computed(() => withoutDayTypes.includes(type));
73981
+ const isMonthRange = vue.computed(() => monthRanges.includes(type));
73982
+ const isYearRange = vue.computed(() => type === "yearrange");
73983
+ const monthToDateItem = (value, item, isEnd = false) => {
73984
+ const { dateObject, ...monthItem } = item;
73985
+ return {
73986
+ ...monthItem,
73987
+ dateObject: {
73988
+ ...dateObject,
73989
+ date: 1
73990
+ },
73991
+ inCurrentMonth: false,
73992
+ isCurrentDate: false,
73993
+ inSpan: false,
73994
+ startOfSpan: false,
73995
+ endOfSpan: isEnd,
73996
+ selected: isEnd,
73997
+ ts: value,
73998
+ type: "date"
73999
+ };
74000
+ };
74001
+ const setMonthRange = (value, item, isEnd = false) => {
74002
+ const monthItem = monthToDateItem(value, item, isEnd);
74003
+ calendar.handleDateMouseEnter(monthItem);
74004
+ calendar.handleDateClick(monthItem);
74005
+ };
74006
+ const handleMonthStartClick = (value, _doUpdate, item) => {
74007
+ calendar.onUpdateStartCalendarValue(value);
74008
+ isMonthRange.value && setMonthRange(value, item);
74009
+ };
74010
+ const handleMonthEndClick = (value, _doUpdate, item) => {
74011
+ calendar.onUpdateEndCalendarValue(value);
74012
+ isMonthRange.value && setMonthRange(value, item, true);
74013
+ };
74014
+ const handleYearStartClick = (value, _doUpdate, item) => {
74015
+ calendar.onUpdateStartCalendarValue(value);
74016
+ isYearRange.value && setMonthRange(value, item);
74017
+ };
74018
+ const handleYearEndClick = (value, _doUpdate, item) => {
74019
+ calendar.onUpdateEndCalendarValue(value);
74020
+ isYearRange.value && setMonthRange(value, item, true);
74021
+ };
74022
+ return {
74023
+ ...calendar,
74024
+ isMonthRange,
74025
+ isYearRange,
74026
+ isWithoutDay,
74027
+ handleMonthStartClick,
74028
+ handleMonthEndClick,
74029
+ handleYearStartClick,
74030
+ handleYearEndClick
74031
+ };
73897
74032
  },
73898
74033
  render() {
73899
- const { mergedClsPrefix, shortcuts, onRender } = this;
74034
+ const {
74035
+ mergedClsPrefix,
74036
+ shortcuts,
74037
+ onRender,
74038
+ isMonthRange,
74039
+ isYearRange,
74040
+ isWithoutDay,
74041
+ handleMonthStartClick,
74042
+ handleMonthEndClick,
74043
+ handleYearStartClick,
74044
+ handleYearEndClick
74045
+ } = this;
73900
74046
  onRender?.();
73901
74047
  return /* @__PURE__ */ vue.h(
73902
74048
  "div",
@@ -73923,20 +74069,22 @@
73923
74069
  {
73924
74070
  value: this.startCalendarDateTime,
73925
74071
  mergedClsPrefix,
74072
+ isMonth: isMonthRange,
74073
+ isYear: isYearRange,
73926
74074
  calendarMonth: this.startCalendarMonth,
73927
74075
  calendarYear: this.startCalendarYear,
73928
- onUpdateValue: this.onUpdateStartCalendarValue
74076
+ onUpdateMonth: handleMonthStartClick,
74077
+ onUpdateYear: handleYearStartClick
73929
74078
  }
73930
74079
  ),
73931
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-weekdays` }, this.weekdays.map((weekday) => /* @__PURE__ */ vue.h(
74080
+ isWithoutDay ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-placeholder` }) : /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-weekdays` }, this.weekdays.map((weekday) => /* @__PURE__ */ vue.h(
73932
74081
  "div",
73933
74082
  {
73934
74083
  key: weekday,
73935
74084
  class: `${mergedClsPrefix}-date-panel-weekdays__day`
73936
74085
  },
73937
74086
  weekday
73938
- ))),
73939
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-dates` }, this.startDateArray.map((dateItem, i) => /* @__PURE__ */ vue.h(
74087
+ ))), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-dates` }, this.startDateArray.map((dateItem, i) => /* @__PURE__ */ vue.h(
73940
74088
  "div",
73941
74089
  {
73942
74090
  "data-u-date": true,
@@ -73960,9 +74108,14 @@
73960
74108
  this.handleDateMouseEnter(dateItem);
73961
74109
  }
73962
74110
  },
73963
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-date__trigger` }),
74111
+ /* @__PURE__ */ vue.h(
74112
+ "div",
74113
+ {
74114
+ class: `${mergedClsPrefix}-date-panel-date__trigger`
74115
+ }
74116
+ ),
73964
74117
  dateItem.dateObject.date
73965
- )))
74118
+ ))))
73966
74119
  ),
73967
74120
  /* @__PURE__ */ vue.h(
73968
74121
  "div",
@@ -73975,20 +74128,22 @@
73975
74128
  {
73976
74129
  value: this.endCalendarDateTime,
73977
74130
  mergedClsPrefix,
74131
+ isMonth: isMonthRange,
74132
+ isYear: isYearRange,
73978
74133
  calendarMonth: this.endCalendarMonth,
73979
74134
  calendarYear: this.endCalendarYear,
73980
- onUpdateValue: this.onUpdateEndCalendarValue
74135
+ onUpdateMonth: handleMonthEndClick,
74136
+ onUpdateYear: handleYearEndClick
73981
74137
  }
73982
74138
  ),
73983
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-weekdays` }, this.weekdays.map((weekday) => /* @__PURE__ */ vue.h(
74139
+ isWithoutDay ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-placeholder` }) : /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-weekdays` }, this.weekdays.map((weekday) => /* @__PURE__ */ vue.h(
73984
74140
  "div",
73985
74141
  {
73986
74142
  key: weekday,
73987
74143
  class: `${mergedClsPrefix}-date-panel-weekdays__day`
73988
74144
  },
73989
74145
  weekday
73990
- ))),
73991
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-dates` }, this.endDateArray.map((dateItem, i) => /* @__PURE__ */ vue.h(
74146
+ ))), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-dates` }, this.endDateArray.map((dateItem, i) => /* @__PURE__ */ vue.h(
73992
74147
  "div",
73993
74148
  {
73994
74149
  "data-u-date": true,
@@ -74012,9 +74167,14 @@
74012
74167
  this.handleDateMouseEnter(dateItem);
74013
74168
  }
74014
74169
  },
74015
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-date__trigger` }),
74170
+ /* @__PURE__ */ vue.h(
74171
+ "div",
74172
+ {
74173
+ class: `${mergedClsPrefix}-date-panel-date__trigger`
74174
+ }
74175
+ ),
74016
74176
  dateItem.dateObject.date
74017
- )))
74177
+ ))))
74018
74178
  ),
74019
74179
  this.datePickerSlots.footer ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-footer` }, this.datePickerSlots.footer()) : null,
74020
74180
  this.actions?.length || shortcuts ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions` }, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions__prefix` }, shortcuts && Object.keys(shortcuts).map((key) => {
@@ -74051,250 +74211,6 @@
74051
74211
  }
74052
74212
  });
74053
74213
 
74054
- var MonthRangePanel = vue.defineComponent({
74055
- name: "MonthRangePanel",
74056
- props: {
74057
- ...useDualCalendarProps,
74058
- type: {
74059
- type: String,
74060
- required: true
74061
- }
74062
- },
74063
- setup(props) {
74064
- {
74065
- vue.watchEffect(() => {
74066
- if (props.actions?.includes("now")) {
74067
- warnOnce(
74068
- "date-picker",
74069
- `The \`now\` action is not supported for u-date-picker of ${props.type}type`
74070
- );
74071
- }
74072
- });
74073
- }
74074
- const useCalendarRef = useDualCalendar(props, props.type);
74075
- const renderItem = (item, i, mergedClsPrefix, type) => {
74076
- const { handleColItemClick } = useCalendarRef;
74077
- const disabled = false;
74078
- return /* @__PURE__ */ vue.h(
74079
- "div",
74080
- {
74081
- "data-u-date": true,
74082
- key: i,
74083
- class: [
74084
- `${mergedClsPrefix}-date-panel-month-calendar__picker-col-item`,
74085
- {
74086
- [`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--current`]: item.isCurrent,
74087
- [`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--selected`]: item.selected,
74088
- [`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: disabled
74089
- }
74090
- ],
74091
- onClick: () => {
74092
- handleColItemClick(item, type);
74093
- }
74094
- },
74095
- item.type === "month" ? item.dateObject.month + 1 : item.type === "quarter" ? `Q${item.dateObject.quarter}` : item.dateObject.year
74096
- );
74097
- };
74098
- vue.onMounted(() => {
74099
- useCalendarRef.justifyColumnsScrollState();
74100
- });
74101
- return { ...useCalendarRef, renderItem };
74102
- },
74103
- render() {
74104
- const {
74105
- mergedClsPrefix,
74106
- mergedTheme,
74107
- shortcuts,
74108
- type,
74109
- renderItem,
74110
- onRender
74111
- } = this;
74112
- onRender?.();
74113
- return /* @__PURE__ */ vue.h(
74114
- "div",
74115
- {
74116
- ref: "selfRef",
74117
- tabindex: 0,
74118
- class: [
74119
- `${mergedClsPrefix}-date-panel`,
74120
- `${mergedClsPrefix}-date-panel--daterange`,
74121
- !this.panel && `${mergedClsPrefix}-date-panel--shadow`,
74122
- this.themeClass
74123
- ],
74124
- onKeydown: this.handlePanelKeyDown,
74125
- onFocus: this.handlePanelFocus
74126
- },
74127
- /* @__PURE__ */ vue.h(
74128
- "div",
74129
- {
74130
- ref: "startDatesElRef",
74131
- class: `${mergedClsPrefix}-date-panel-calendar ${mergedClsPrefix}-date-panel-calendar--start`
74132
- },
74133
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-month-calendar` }, /* @__PURE__ */ vue.h(
74134
- Scrollbar$1,
74135
- {
74136
- ref: "startYearScrollbarRef",
74137
- class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col`,
74138
- theme: mergedTheme.peers.Scrollbar,
74139
- themeOverrides: mergedTheme.peerOverrides.Scrollbar,
74140
- container: () => this.virtualListContainer("start"),
74141
- content: () => this.virtualListContent("start"),
74142
- horizontalRailStyle: { zIndex: 1 },
74143
- verticalRailStyle: { zIndex: 1 }
74144
- },
74145
- {
74146
- default: () => /* @__PURE__ */ vue.h(
74147
- VVirtualList,
74148
- {
74149
- ref: "startYearVlRef",
74150
- items: this.startYearArray,
74151
- itemSize: MONTH_ITEM_HEIGHT,
74152
- showScrollbar: false,
74153
- keyField: "ts",
74154
- onScroll: this.handleStartYearVlScroll,
74155
- paddingBottom: 4
74156
- },
74157
- {
74158
- default: ({
74159
- item,
74160
- index
74161
- }) => {
74162
- return renderItem(item, index, mergedClsPrefix, "start");
74163
- }
74164
- }
74165
- )
74166
- }
74167
- ), type === "monthrange" || type === "quarterrange" ? /* @__PURE__ */ vue.h(
74168
- "div",
74169
- {
74170
- class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col`
74171
- },
74172
- /* @__PURE__ */ vue.h(
74173
- Scrollbar$1,
74174
- {
74175
- ref: "startMonthScrollbarRef",
74176
- theme: mergedTheme.peers.Scrollbar,
74177
- themeOverrides: mergedTheme.peerOverrides.Scrollbar
74178
- },
74179
- {
74180
- default: () => [
74181
- (type === "monthrange" ? this.startMonthArray : this.startQuarterArray).map(
74182
- (item, i) => renderItem(item, i, mergedClsPrefix, "start")
74183
- ),
74184
- type === "monthrange" && /* @__PURE__ */ vue.h(
74185
- "div",
74186
- {
74187
- class: `${mergedClsPrefix}-date-panel-month-calendar__padding`
74188
- }
74189
- )
74190
- ]
74191
- }
74192
- )
74193
- ) : null)
74194
- ),
74195
- /* @__PURE__ */ vue.h(
74196
- "div",
74197
- {
74198
- ref: "endDatesElRef",
74199
- class: `${mergedClsPrefix}-date-panel-calendar ${mergedClsPrefix}-date-panel-calendar--end`
74200
- },
74201
- /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-month-calendar` }, /* @__PURE__ */ vue.h(
74202
- Scrollbar$1,
74203
- {
74204
- ref: "endYearScrollbarRef",
74205
- class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col`,
74206
- theme: mergedTheme.peers.Scrollbar,
74207
- themeOverrides: mergedTheme.peerOverrides.Scrollbar,
74208
- container: () => this.virtualListContainer("end"),
74209
- content: () => this.virtualListContent("end"),
74210
- horizontalRailStyle: { zIndex: 1 },
74211
- verticalRailStyle: { zIndex: 1 }
74212
- },
74213
- {
74214
- default: () => /* @__PURE__ */ vue.h(
74215
- VVirtualList,
74216
- {
74217
- ref: "endYearVlRef",
74218
- items: this.endYearArray,
74219
- itemSize: MONTH_ITEM_HEIGHT,
74220
- showScrollbar: false,
74221
- keyField: "ts",
74222
- onScroll: this.handleEndYearVlScroll,
74223
- paddingBottom: 4
74224
- },
74225
- {
74226
- default: ({
74227
- item,
74228
- index
74229
- }) => {
74230
- return renderItem(item, index, mergedClsPrefix, "end");
74231
- }
74232
- }
74233
- )
74234
- }
74235
- ), type === "monthrange" || type === "quarterrange" ? /* @__PURE__ */ vue.h(
74236
- "div",
74237
- {
74238
- class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col`
74239
- },
74240
- /* @__PURE__ */ vue.h(
74241
- Scrollbar$1,
74242
- {
74243
- ref: "endMonthScrollbarRef",
74244
- theme: mergedTheme.peers.Scrollbar,
74245
- themeOverrides: mergedTheme.peerOverrides.Scrollbar
74246
- },
74247
- {
74248
- default: () => [
74249
- (type === "monthrange" ? this.endMonthArray : this.endQuarterArray).map(
74250
- (item, i) => renderItem(item, i, mergedClsPrefix, "end")
74251
- ),
74252
- type === "monthrange" && /* @__PURE__ */ vue.h(
74253
- "div",
74254
- {
74255
- class: `${mergedClsPrefix}-date-panel-month-calendar__padding`
74256
- }
74257
- )
74258
- ]
74259
- }
74260
- )
74261
- ) : null)
74262
- ),
74263
- this.datePickerSlots.footer ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-footer` }, vue.renderSlot(this.datePickerSlots, "footer")) : null,
74264
- this.actions?.length || shortcuts ? /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions` }, /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions__prefix` }, shortcuts && Object.keys(shortcuts).map((key) => {
74265
- const shortcut = shortcuts[key];
74266
- return Array.isArray(shortcut) || typeof shortcut === "function" ? /* @__PURE__ */ vue.h(
74267
- XButton,
74268
- {
74269
- secondary: true,
74270
- round: true,
74271
- size: "small",
74272
- onMouseenter: () => {
74273
- this.handleRangeShortcutMouseenter(shortcut);
74274
- },
74275
- onClick: () => {
74276
- this.handleRangeShortcutClick(shortcut);
74277
- },
74278
- onMouseleave: () => {
74279
- this.handleShortcutMouseleave();
74280
- }
74281
- },
74282
- { default: () => key }
74283
- ) : null;
74284
- })), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefix}-date-panel-actions__suffix` }, this.actions?.includes("clear") ? /* @__PURE__ */ vue.h(XButton, { secondary: true, onClick: this.handleClearClick }, { default: () => this.locale.clear }) : null, this.actions?.includes("confirm") ? /* @__PURE__ */ vue.h(
74285
- XButton,
74286
- {
74287
- type: "primary",
74288
- disabled: this.isRangeInvalid,
74289
- onClick: this.handleConfirmClick
74290
- },
74291
- { default: () => this.locale.confirm }
74292
- ) : null)) : null,
74293
- /* @__PURE__ */ vue.h(FocusDetector, { onFocus: this.handleFocusDetectorFocus })
74294
- );
74295
- }
74296
- });
74297
-
74298
74214
  var style$S = c$1([cB("date-picker", `
74299
74215
  position: relative;
74300
74216
  z-index: auto;
@@ -74417,6 +74333,8 @@
74417
74333
  margin: 0,
74418
74334
  padding: "15px 16px",
74419
74335
  boxSizing: "border-box"
74336
+ }), cM("year", {
74337
+ zIndex: "2"
74420
74338
  }), cB("date-panel-footer", {
74421
74339
  gridArea: "footer"
74422
74340
  }), cB("date-panel-actions", {
@@ -74439,21 +74357,20 @@
74439
74357
  zIndex: 1
74440
74358
  })]), c$1("~ .u-date-panel-calendar", {
74441
74359
  paddingTop: "16px"
74442
- })]), cB("date-panel-month", {
74360
+ })]), cB("date-panel-placeholder", {
74361
+ width: "266px",
74362
+ height: "250px"
74363
+ }), cB("date-panel-month", {
74443
74364
  boxSizing: "border-box",
74444
74365
  display: "flex",
74445
74366
  alignItems: "center",
74446
74367
  justifyContent: "space-between",
74447
74368
  padding: "var(--u-calendar-title-padding)",
74448
74369
  height: "var(--u-calendar-title-height)"
74449
- }, [cE("icon", `
74370
+ }, [cM("justify-end", {
74371
+ justifyContent: "end"
74372
+ }), cE("icon", `
74450
74373
  font-size: var(--u-arrow-size);
74451
- `), cE("prev, next, fast-prev, fast-next", `
74452
- line-height: 0;
74453
- cursor: pointer;
74454
- width: var(--u-arrow-size);
74455
- height: var(--u-arrow-size);
74456
- color: var(--u-arrow-color);
74457
74374
  `), cE("month-year", {
74458
74375
  userSelect: "none",
74459
74376
  "-webkit-user-select": "none"
@@ -74466,10 +74383,11 @@
74466
74383
  padding: 6px 8px;
74467
74384
  text-align: center;
74468
74385
  color: var(--u-calendar-title-text-color);
74469
- cursor: pointer;
74470
74386
  transition: .3s var(--u-bezier);
74471
74387
  border-radius: var(--u-panel-border-radius);
74472
- `, [c$1(".u-icon", {
74388
+ `, [cNotM("disabled", {
74389
+ cursor: "pointer"
74390
+ }), c$1(".u-icon", {
74473
74391
  width: "24px",
74474
74392
  transition: "transform .3s var(--u-bezier)"
74475
74393
  }), cM("active", `
@@ -74704,6 +74622,12 @@
74704
74622
  }
74705
74623
  });
74706
74624
  }
74625
+ const rangeTypes = [
74626
+ "daterange",
74627
+ "monthrange",
74628
+ "yearrange",
74629
+ "quarterrange"
74630
+ ];
74707
74631
  const { localeRef, dateLocaleRef } = useLocale("DatePicker");
74708
74632
  const formItem = useFormItem(props);
74709
74633
  const { mergedSizeRef, mergedDisabledRef, mergedStatusRef } = formItem;
@@ -75467,6 +75391,7 @@
75467
75391
  ) : void 0;
75468
75392
  return {
75469
75393
  ...exposedMethods,
75394
+ rangeTypes,
75470
75395
  mergedStatus: mergedStatusRef,
75471
75396
  mergedClsPrefix: mergedClsPrefixRef,
75472
75397
  mergedBordered: mergedBorderedRef,
@@ -75539,11 +75464,12 @@
75539
75464
  onRender: this.onRender
75540
75465
  };
75541
75466
  const renderPanel = () => {
75542
- const { type } = this;
75543
- return type === "datetime" ? /* @__PURE__ */ vue.h(DatetimePanel, { ...commonPanelProps }, $slots) : type === "daterange" ? /* @__PURE__ */ vue.h(
75467
+ const { type, rangeTypes } = this;
75468
+ return type === "datetime" ? /* @__PURE__ */ vue.h(DatetimePanel, { ...commonPanelProps }, $slots) : rangeTypes.includes(type) ? /* @__PURE__ */ vue.h(
75544
75469
  DateRangePanel,
75545
75470
  {
75546
75471
  ...commonPanelProps,
75472
+ type,
75547
75473
  defaultCalendarStartTime: this.defaultCalendarStartTime,
75548
75474
  defaultCalendarEndTime: this.defaultCalendarEndTime,
75549
75475
  bindCalendarMonths: this.bindCalendarMonths
@@ -75558,7 +75484,7 @@
75558
75484
  bindCalendarMonths: this.bindCalendarMonths
75559
75485
  },
75560
75486
  $slots
75561
- ) : type === "month" || type === "year" || type === "quarter" ? /* @__PURE__ */ vue.h(vue.Fragment, null) : type === "monthrange" || type === "yearrange" || type === "quarterrange" ? /* @__PURE__ */ vue.h(MonthRangePanel, { ...commonPanelProps, type }) : /* @__PURE__ */ vue.h(DatePanel, { ...commonPanelProps }, $slots);
75487
+ ) : /* @__PURE__ */ vue.h(DatePanel, { ...commonPanelProps, type }, $slots);
75562
75488
  };
75563
75489
  if (this.panel) {
75564
75490
  return renderPanel();
@@ -106796,7 +106722,7 @@
106796
106722
  watermarkProps: watermarkProps
106797
106723
  });
106798
106724
 
106799
- var version = "1.1.5";
106725
+ var version = "1.2.0";
106800
106726
 
106801
106727
  function create({
106802
106728
  componentPrefix = "U",
@@ -106832,10 +106758,10 @@
106832
106758
  };
106833
106759
  }
106834
106760
 
106835
- const naive = create({
106761
+ const uzumUi = create({
106836
106762
  components: Object.keys(components).map(key => components[key])
106837
106763
  });
106838
- const install = naive.install;
106764
+ const install = uzumUi.install;
106839
106765
 
106840
106766
  function useThemeVars() {
106841
106767
  const configProviderInjection = vue.inject(configProviderInjectionKey, null);
@@ -107833,7 +107759,7 @@
107833
107759
  exports.dateZhCN = dateZhCN;
107834
107760
  exports.dateZhTW = datezhTW;
107835
107761
  exports.deDE = deDE;
107836
- exports.default = naive;
107762
+ exports.default = uzumUi;
107837
107763
  exports.descriptionsDark = descriptionsDark;
107838
107764
  exports.descriptionsItemProps = descriptionsItemProps;
107839
107765
  exports.descriptionsProps = descriptionsProps;