jb-mobile-ui 1.5.1 → 1.5.2

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/index.es.js CHANGED
@@ -5391,6 +5391,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5391
5391
  const timeKey = computed(() => timeKeyMap[props.timePickerType]);
5392
5392
  const defaultValueFirst = computed(() => Array.isArray(props.defaultValue) ? props.defaultValue[0] : props.defaultValue);
5393
5393
  const defaultValueSecond = computed(() => Array.isArray(props.defaultValue) ? props.defaultValue[1] : props.defaultValue);
5394
+ const calendarKey = ref(0);
5394
5395
  const defaultDate = computed(() => {
5395
5396
  return props.timePickerType === "dateRange" ? [
5396
5397
  dayjs(defaultValueFirst.value).startOf(timeKey.value).toDate(),
@@ -5590,7 +5591,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5590
5591
  var _a, _b;
5591
5592
  if (["dateRange", "week"].includes(props.timePickerType)) {
5592
5593
  (_a = calendarRef.value) == null ? void 0 : _a.scrollToDate(
5593
- Array.isArray(defaultDate.value) ? defaultDate.value[0] : defaultDate.value
5594
+ props.timePickerType === "week" ? weekStartDate : Array.isArray(defaultDate.value) ? defaultDate.value[0] : defaultDate.value
5594
5595
  );
5595
5596
  } else {
5596
5597
  const selectedItem = (_b = timePickerContentRef.value) == null ? void 0 : _b.querySelector(".selected");
@@ -5682,20 +5683,36 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5682
5683
  return dayjs(startTime).isSame(dayjs(minDate.value), timeKey.value);
5683
5684
  };
5684
5685
  const toPrevDate = () => {
5685
- handleFinishSelectDate(
5686
- dayjs(endTime).subtract(1, timeKey.value).toDate()
5687
- );
5686
+ const date = dayjs(endTime).subtract(1, timeKey.value).toDate();
5687
+ if (props.timePickerType === "week") {
5688
+ setWeekStartAndEndDate(date);
5689
+ }
5690
+ handleFinishSelectDate(date);
5688
5691
  selectedTimeValue.value = dayjs(props.timePickerType === "examine" ? endTime : startTime).format("YYYY-MM-DD");
5689
- handleConfirm();
5692
+ if (!props.withSelectTab) {
5693
+ handleConfirm();
5694
+ } else {
5695
+ calendarKey.value++;
5696
+ nextTick(() => {
5697
+ setSelectedScrollIntoView();
5698
+ });
5699
+ }
5690
5700
  };
5691
5701
  const toNextDate = () => {
5692
- nextTick(() => {
5693
- handleFinishSelectDate(
5694
- dayjs(endTime).add(1, timeKey.value).toDate()
5695
- );
5696
- selectedTimeValue.value = dayjs(props.timePickerType === "examine" ? endTime : startTime).format("YYYY-MM-DD");
5702
+ const date = dayjs(endTime).add(1, timeKey.value).toDate();
5703
+ if (props.timePickerType === "week") {
5704
+ setWeekStartAndEndDate(date);
5705
+ }
5706
+ handleFinishSelectDate(date);
5707
+ selectedTimeValue.value = dayjs(props.timePickerType === "examine" ? endTime : startTime).format("YYYY-MM-DD");
5708
+ if (!props.withSelectTab) {
5697
5709
  handleConfirm();
5698
- });
5710
+ } else {
5711
+ calendarKey.value++;
5712
+ nextTick(() => {
5713
+ setSelectedScrollIntoView();
5714
+ });
5715
+ }
5699
5716
  };
5700
5717
  const confirmSelectDate = () => {
5701
5718
  setDateValueFormat([startTime, endTime], timePickerTypeObj.value.format);
@@ -5843,11 +5860,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5843
5860
  ])) : createCommentVNode("", true)
5844
5861
  ])
5845
5862
  ])) : createCommentVNode("", true),
5846
- withDirectives(createVNode(_component_van_calendar, {
5863
+ withDirectives((openBlock(), createBlock(_component_van_calendar, {
5847
5864
  ref_key: "calendarRef",
5848
5865
  ref: calendarRef,
5849
5866
  class: "jb-mobile-time-picker__calendar",
5850
5867
  "allow-same-day": "",
5868
+ key: calendarKey.value,
5851
5869
  type: timePickerTypeObj.value.calendarType,
5852
5870
  poppable: false,
5853
5871
  "show-mark": false,
@@ -5867,7 +5885,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5867
5885
  createElementVNode("div", _hoisted_6$5, toDisplayString(text), 1)
5868
5886
  ]),
5869
5887
  _: 1
5870
- }, 8, ["type", "min-date", "max-date", "default-date", "first-day-of-week"]), [
5888
+ }, 8, ["type", "min-date", "max-date", "default-date", "first-day-of-week"])), [
5871
5889
  [vShow, isShowCalendar.value]
5872
5890
  ]),
5873
5891
  withDirectives(createElementVNode("div", _hoisted_7$4, [
@@ -5902,7 +5920,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5902
5920
  };
5903
5921
  }
5904
5922
  });
5905
- const JbMobileTimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-4804ddd8"]]);
5923
+ const JbMobileTimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-2322ec22"]]);
5906
5924
  const _hoisted_1$9 = { class: "jb-mobile-date-picker" };
5907
5925
  const _hoisted_2$7 = { class: "jb-mobile-date-picker__value" };
5908
5926
  const _hoisted_3$6 = ["src"];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "jb-mobile-ui",
3
3
  "description": "JinBiWuYe Mobile UI Components base on Vant",
4
4
  "private": false,
5
- "version": "1.5.1",
5
+ "version": "1.5.2",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
8
8
  "type": "module",