@varlet/ui 3.5.2 → 3.5.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.
package/lib/varlet.cjs.js CHANGED
@@ -13379,13 +13379,14 @@ const __sfc__$T = vue.defineComponent({
13379
13379
  headerEl.value.checkDate(checkType);
13380
13380
  };
13381
13381
  vue.watch(
13382
- () => props2.preview.previewYear,
13383
- (year) => {
13384
- const {
13385
- componentProps: { min: min2, max: max2 }
13386
- } = props2;
13387
- if (max2) panelBtnDisabled.right = !dayjs(`${toNumber(year) + 1}`).isSameOrBefore(dayjs(max2), "year");
13388
- if (min2) panelBtnDisabled.left = !dayjs(`${toNumber(year) - 1}`).isSameOrAfter(dayjs(min2), "year");
13382
+ () => [props2.preview.previewYear, props2.componentProps.max, props2.componentProps.min],
13383
+ ([year, max2, min2]) => {
13384
+ if (max2) {
13385
+ panelBtnDisabled.right = !dayjs(`${toNumber(year) + 1}`).isSameOrBefore(dayjs(max2), "year");
13386
+ }
13387
+ if (min2) {
13388
+ panelBtnDisabled.left = !dayjs(`${toNumber(year) - 1}`).isSameOrAfter(dayjs(min2), "year");
13389
+ }
13389
13390
  },
13390
13391
  { immediate: true }
13391
13392
  );
@@ -13820,15 +13821,18 @@ const __sfc__$R = vue.defineComponent({
13820
13821
  }
13821
13822
  );
13822
13823
  vue.watch(
13823
- yearList,
13824
- (list) => {
13825
- const {
13826
- componentProps: { min: min2, max: max2 }
13827
- } = props2;
13828
- if (max2)
13824
+ () => [yearList.value, props2.componentProps.max, props2.componentProps.min],
13825
+ (newVal) => {
13826
+ const [list, max2, min2] = newVal;
13827
+ if (max2) {
13829
13828
  panelBtnDisabled.right = !dayjs(`${toNumber(list[list.length - 1])}`).isSameOrBefore(dayjs(max2), "year");
13830
- if (min2) panelBtnDisabled.left = !dayjs(`${toNumber(list[0])}`).isSameOrAfter(dayjs(min2), "year");
13831
- if (toNumber(list[0] <= 0)) panelBtnDisabled.left = false;
13829
+ }
13830
+ if (min2) {
13831
+ panelBtnDisabled.left = !dayjs(`${toNumber(list[0])}`).isSameOrAfter(dayjs(min2), "year");
13832
+ }
13833
+ if (toNumber(list[0] <= 0)) {
13834
+ panelBtnDisabled.left = false;
13835
+ }
13832
13836
  },
13833
13837
  {
13834
13838
  immediate: true
@@ -14165,6 +14169,7 @@ const __sfc__$Q = vue.defineComponent({
14165
14169
  initHeader();
14166
14170
  }
14167
14171
  );
14172
+ vue.watch(() => [props2.componentProps.max, props2.componentProps.min], initHeader);
14168
14173
  return {
14169
14174
  n: n$P,
14170
14175
  nDate,
@@ -14481,7 +14486,7 @@ const __sfc__$P = vue.defineComponent({
14481
14486
  const yearPanelEl = vue.ref(null);
14482
14487
  const monthPanelEl = vue.ref(null);
14483
14488
  const dayPanelEl = vue.ref(null);
14484
- const componentProps = vue.reactive({
14489
+ const componentProps = vue.computed(() => ({
14485
14490
  allowedDates: props2.allowedDates,
14486
14491
  type: props2.type,
14487
14492
  color: props2.color,
@@ -14492,7 +14497,7 @@ const __sfc__$P = vue.defineComponent({
14492
14497
  multiple: props2.multiple,
14493
14498
  range: props2.range,
14494
14499
  buttonElevation: props2.buttonElevation
14495
- });
14500
+ }));
14496
14501
  const getChoose = vue.computed(() => ({
14497
14502
  chooseMonth: chooseMonth.value,
14498
14503
  chooseYear: chooseYear.value,
@@ -14575,7 +14580,7 @@ const __sfc__$P = vue.defineComponent({
14575
14580
  vue.watch(
14576
14581
  () => props2.modelValue,
14577
14582
  (value) => {
14578
- if (!checkValue() || invalidFormatDate(value) || !value) return;
14583
+ if (!checkValue() || invalidFormatDate(value)) return;
14579
14584
  if (props2.range) {
14580
14585
  if (!isArray(value)) return;
14581
14586
  rangeDone.value = value.length !== 1;
@@ -14769,7 +14774,8 @@ const __sfc__$P = vue.defineComponent({
14769
14774
  rangeDate.value = formatDateList.filter((date) => date !== "Invalid Date");
14770
14775
  }
14771
14776
  function dateInit(value) {
14772
- const formatDate = dayjs(value).format("YYYY-MM-D");
14777
+ const handleValue = value ? dayjs(value) : dayjs();
14778
+ const formatDate = handleValue.format("YYYY-MM-D");
14773
14779
  if (invalidFormatDate(formatDate)) return;
14774
14780
  const [yearValue, monthValue, dayValue] = formatDate.split("-");
14775
14781
  const monthDes2 = MONTH_LIST.find((month) => month === monthValue);
@@ -28256,24 +28262,37 @@ const __sfc__$2 = vue.defineComponent({
28256
28262
  vue.watch(
28257
28263
  () => props2.modelValue,
28258
28264
  (value) => {
28259
- if (value) {
28260
- const { hour, minute, second } = getNumberTime(value);
28261
- const formatHour12 = dayjs().hour(hour).format("hh");
28262
- const formatHour24 = dayjs().hour(hour).format("HH");
28263
- const formatMinute = dayjs().minute(minute).format("mm");
28264
- const formatSecond = dayjs().second(second).format("ss");
28265
- hourRad.value = (formatHour12 === "12" ? 0 : toNumber(formatHour12)) * 30;
28266
- minuteRad.value = toNumber(formatMinute) * 6;
28267
- secondRad.value = toNumber(formatSecond) * 6;
28268
- time.value = getTime(value);
28269
- if (props2.format !== "24hr") {
28270
- ampm.value = padStart$1(`${hour}`, 2, "0") === formatHour24 && hours24.includes(formatHour24) ? "pm" : "am";
28271
- }
28272
- isInner.value = props2.format === "24hr" && hours24.includes(formatHour24);
28265
+ if (value === void 0 || value === "") {
28266
+ resetTime();
28267
+ return;
28273
28268
  }
28269
+ const { hour, minute, second } = getNumberTime(value);
28270
+ const formatHour12 = dayjs().hour(hour).format("hh");
28271
+ const formatHour24 = dayjs().hour(hour).format("HH");
28272
+ const formatMinute = dayjs().minute(minute).format("mm");
28273
+ const formatSecond = dayjs().second(second).format("ss");
28274
+ hourRad.value = (formatHour12 === "12" ? 0 : toNumber(formatHour12)) * 30;
28275
+ minuteRad.value = toNumber(formatMinute) * 6;
28276
+ secondRad.value = toNumber(formatSecond) * 6;
28277
+ time.value = getTime(value);
28278
+ if (props2.format !== "24hr") {
28279
+ ampm.value = padStart$1(`${hour}`, 2, "0") === formatHour24 && hours24.includes(formatHour24) ? "pm" : "am";
28280
+ }
28281
+ isInner.value = props2.format === "24hr" && hours24.includes(formatHour24);
28274
28282
  },
28275
28283
  { immediate: true }
28276
28284
  );
28285
+ function resetTime() {
28286
+ hourRad.value = void 0;
28287
+ minuteRad.value = 0;
28288
+ secondRad.value = 0;
28289
+ time.value = {
28290
+ hour: "00",
28291
+ minute: "00",
28292
+ second: "00"
28293
+ };
28294
+ ampm.value = "am";
28295
+ }
28277
28296
  function update(newTime) {
28278
28297
  call(props2["onUpdate:modelValue"], newTime);
28279
28298
  call(props2.onChange, newTime);
@@ -29297,7 +29316,7 @@ withInstall(stdin_default$1);
29297
29316
  withPropsDefaultsSetter(stdin_default$1, props);
29298
29317
  const _WatermarkComponent = stdin_default$1;
29299
29318
  var stdin_default = stdin_default$1;
29300
- const version = "3.5.2";
29319
+ const version = "3.5.3";
29301
29320
  function install(app) {
29302
29321
  stdin_default$5I.install && app.use(stdin_default$5I);
29303
29322
  stdin_default$5G.install && app.use(stdin_default$5G);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,9 +48,9 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "3.5.2",
52
- "@varlet/shared": "3.5.2",
53
- "@varlet/use": "3.5.2"
51
+ "@varlet/icons": "3.5.3",
52
+ "@varlet/shared": "3.5.3",
53
+ "@varlet/use": "3.5.3"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vue/runtime-core": "3.4.21",
@@ -65,9 +65,9 @@
65
65
  "typescript": "^5.1.5",
66
66
  "vue": "3.4.21",
67
67
  "vue-router": "4.2.0",
68
- "@varlet/cli": "3.5.2",
69
- "@varlet/ui": "3.5.2",
70
- "@varlet/touch-emulator": "3.5.2"
68
+ "@varlet/cli": "3.5.3",
69
+ "@varlet/touch-emulator": "3.5.3",
70
+ "@varlet/ui": "3.5.3"
71
71
  },
72
72
  "scripts": {
73
73
  "dev": "varlet-cli dev",
@@ -259,6 +259,7 @@ interface BaseStyleVars {
259
259
  '--date-picker-title-year-font-size'?: string
260
260
  '--date-picker-title-year-font-weight'?: string
261
261
  '--date-picker-title-year-margin-bottom'?: string
262
+ '--date-picker-title-year-min-height'?: string
262
263
  '--date-picker-title-date-height'?: string
263
264
  '--date-picker-title-date-font-size'?: string
264
265
  '--date-picker-title-date-font-weight'?: string
@@ -280,6 +281,7 @@ interface BaseStyleVars {
280
281
  '--year-picker-item-height'?: string
281
282
  '--year-picker-item-button-max-width'?: string
282
283
  '--day-picker-content-item-width'?: string
284
+ '--day-picker-content-item-min-height'?: string
283
285
  '--day-picker-content-item-font-size'?: string
284
286
  '--day-picker-content-item-padding'?: string
285
287
  '--day-picker-content-item-button-width'?: string
@@ -752,6 +754,7 @@ interface BaseStyleVars {
752
754
  '--time-picker-title-background'?: string
753
755
  '--time-picker-title-hint-color'?: string
754
756
  '--time-picker-title-hint-font-size'?: string
757
+ '--time-picker-title-hint-min-height'?: string
755
758
  '--time-picker-title-inactive-opacity'?: string
756
759
  '--time-picker-title-time-font-size'?: string
757
760
  '--time-picker-title-time-margin'?: string