fds-vue-core 6.2.0 → 6.2.1

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.
@@ -14531,9 +14531,16 @@ function cleanEscapedString(input) {
14531
14531
  }
14532
14532
  return matched[1].replace(doubleQuoteRegExp, "'");
14533
14533
  }
14534
+ function getISODay(date, options) {
14535
+ const day = toDate(date, options?.in).getDay();
14536
+ return day === 0 ? 7 : day;
14537
+ }
14534
14538
  function isAfter(date, dateToCompare) {
14535
14539
  return +toDate(date) > +toDate(dateToCompare);
14536
14540
  }
14541
+ function isBefore(date, dateToCompare) {
14542
+ return +toDate(date) < +toDate(dateToCompare);
14543
+ }
14537
14544
  function isSameWeek(laterDate, earlierDate, options) {
14538
14545
  const [laterDate_, earlierDate_] = normalizeDates(
14539
14546
  options?.in,
@@ -15063,7 +15070,6 @@ const getDaysInWeek = (weekStart) => {
15063
15070
  return calendar;
15064
15071
  };
15065
15072
  const getDaysOfLastWeek = (week) => getDaysInWeek(week);
15066
- const getDaysOfNextWeek = (week) => getDaysInWeek(week);
15067
15073
  const getStartAndEndRangeFromWeek = (week) => {
15068
15074
  const lastDay = week.at(-1);
15069
15075
  const firstDay = week.at(0);
@@ -15097,7 +15103,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15097
15103
  disablePreviousWeek: { type: Boolean, default: false },
15098
15104
  disableNextWeek: { type: Boolean, default: false },
15099
15105
  enableHorizontalAnimation: { type: Boolean, default: true },
15100
- initialWeek: { default: void 0 },
15106
+ minWeek: { default: void 0 },
15101
15107
  maxDate: { default: void 0 },
15102
15108
  previewOtherDays: { type: Boolean, default: false },
15103
15109
  selected: { default: null },
@@ -15110,21 +15116,20 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15110
15116
  setup(__props, { emit: __emit }) {
15111
15117
  const props = __props;
15112
15118
  const emit = __emit;
15113
- const currentWeek = vue.ref(props.initialWeek ?? startOfISOWeek(/* @__PURE__ */ new Date()));
15119
+ const currentWeek = vue.ref(props.minWeek ?? startOfISOWeek(/* @__PURE__ */ new Date()));
15114
15120
  const selectedDay = vue.ref(props.selected ?? null);
15115
15121
  const slideDirection = vue.ref("left");
15116
15122
  const weekToRender = vue.computed(() => getDaysInWeek(currentWeek.value));
15117
- const nextWeek = vue.computed(() => getDaysOfNextWeek(addWeeks(currentWeek.value, 1)));
15123
+ const visibleWeekDays = vue.computed(() => weekToRender.value.filter((day) => getISODay(day) <= 5));
15118
15124
  const lastWeek = vue.computed(() => getDaysOfLastWeek(subWeeks(currentWeek.value)));
15119
15125
  const weekText = vue.computed(() => `${getOverlappingMonths(currentWeek.value)} (vecka ${getISOWeek(currentWeek.value)})`);
15120
15126
  const lastDayOfPreviousWeek = vue.computed(() => lastWeek.value[lastWeek.value.length - 1]);
15121
15127
  const disableLastWeekInteraction = vue.computed(
15122
- () => !!props.disablePreviousWeek || !!lastDayOfPreviousWeek.value && checkIfDateIsBeforeToday(lastDayOfPreviousWeek.value)
15128
+ () => !!props.disablePreviousWeek || !!lastDayOfPreviousWeek.value && checkIfDateIsBeforeToday(lastDayOfPreviousWeek.value) || !!props.minWeek && isBefore(subWeeks(currentWeek.value), startOfISOWeek(props.minWeek))
15123
15129
  );
15124
15130
  const disableNextWeekInteraction = vue.computed(
15125
15131
  () => !!props.disableNextWeek || !!props.maxDate && isSameWeek(currentWeek.value, props.maxDate, { weekStartsOn: 1 })
15126
15132
  );
15127
- const trailingPreviewDay = vue.computed(() => nextWeek.value[0]);
15128
15133
  const transitionClasses = vue.computed(() => {
15129
15134
  if (!props.enableHorizontalAnimation) {
15130
15135
  return {
@@ -15151,7 +15156,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15151
15156
  };
15152
15157
  });
15153
15158
  vue.watch(
15154
- weekToRender,
15159
+ visibleWeekDays,
15155
15160
  (week) => {
15156
15161
  const { endDate, startDate } = getStartAndEndRangeFromWeek(week);
15157
15162
  if (!startDate || !endDate) return;
@@ -15160,7 +15165,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15160
15165
  { immediate: true }
15161
15166
  );
15162
15167
  vue.watch(
15163
- () => props.initialWeek,
15168
+ () => props.minWeek,
15164
15169
  (newWeek) => {
15165
15170
  if (!newWeek) {
15166
15171
  currentWeek.value = startOfISOWeek(/* @__PURE__ */ new Date());
@@ -15233,7 +15238,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15233
15238
  key: currentWeek.value.toISOString(),
15234
15239
  class: "flex flex-row flex-nowrap items-center justify-start gap-x-px"
15235
15240
  }, [
15236
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(weekToRender.value, (weekDay, index) => {
15241
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(visibleWeekDays.value, (weekDay, index) => {
15237
15242
  return vue.openBlock(), vue.createBlock(_sfc_main$d, {
15238
15243
  key: `current-${weekDay.toISOString()}-${index}`,
15239
15244
  date: weekDay,
@@ -15242,15 +15247,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15242
15247
  "is-today": isTodayDate(weekDay),
15243
15248
  onSelectDate: onHandleSelectedDay
15244
15249
  }, null, 8, ["date", "disabled", "selected", "is-today"]);
15245
- }), 128)),
15246
- trailingPreviewDay.value ? (vue.openBlock(), vue.createBlock(_sfc_main$d, {
15247
- key: 0,
15248
- date: trailingPreviewDay.value,
15249
- disabled: isWeekDayDisabled(trailingPreviewDay.value),
15250
- selected: !!selectedDay.value && vue.unref(isSameDay)(trailingPreviewDay.value, selectedDay.value),
15251
- "is-today": isTodayDate(trailingPreviewDay.value),
15252
- onSelectDate: onHandleSelectedDay
15253
- }, null, 8, ["date", "disabled", "selected", "is-today"])) : vue.createCommentVNode("", true)
15250
+ }), 128))
15254
15251
  ]))
15255
15252
  ]),
15256
15253
  _: 1