fds-vue-core 6.2.0 → 6.2.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.
@@ -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,
@@ -14987,7 +14994,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
14987
14994
  const props = __props;
14988
14995
  const emit = __emit;
14989
14996
  const classes = vue.computed(() => [
14990
- "box-border flex h-[64px] w-[calc(100%/7.5)] shrink-0 flex-col items-center justify-center border-transparent px-1 py-1 transition-colors cursor-pointer",
14997
+ "box-border flex h-[64px] w-full max-w-[100px] flex-1 basis-0 flex-col items-center justify-center border-2 border-transparent px-1 py-1 transition-colors cursor-pointer",
14991
14998
  props.disabled ? "" : "hover:border-2 hover:border-blue-500 border-solid",
14992
14999
  props.disabled ? "" : "active:bg-blue_t-100 border-transparent",
14993
15000
  props.disabled ? "" : "focus:outline-none",
@@ -15004,7 +15011,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
15004
15011
  ]);
15005
15012
  const onClick = () => {
15006
15013
  if (props.disabled) return;
15007
- emit("select-date", props.date);
15014
+ emit("select-date", props.selected ? null : props.date);
15008
15015
  };
15009
15016
  const weekdayLabel = vue.computed(() => {
15010
15017
  const value = format(props.date, "EEE", { locale: sv });
@@ -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,34 +15103,34 @@ 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 },
15104
15110
  weekLabel: { default: "vecka" },
15105
15111
  onDecrementWeek: {},
15106
15112
  onIncrementWeek: {},
15107
- onSelectDate: {}
15113
+ onSelectDate: {},
15114
+ onChangeDateRange: {}
15108
15115
  },
15109
15116
  emits: ["change-date-range", "select-date", "decrement-week", "increment-week"],
15110
15117
  setup(__props, { emit: __emit }) {
15111
15118
  const props = __props;
15112
15119
  const emit = __emit;
15113
- const currentWeek = vue.ref(props.initialWeek ?? startOfISOWeek(/* @__PURE__ */ new Date()));
15120
+ const currentWeek = vue.ref(props.minWeek ?? startOfISOWeek(/* @__PURE__ */ new Date()));
15114
15121
  const selectedDay = vue.ref(props.selected ?? null);
15115
15122
  const slideDirection = vue.ref("left");
15116
15123
  const weekToRender = vue.computed(() => getDaysInWeek(currentWeek.value));
15117
- const nextWeek = vue.computed(() => getDaysOfNextWeek(addWeeks(currentWeek.value, 1)));
15124
+ const visibleWeekDays = vue.computed(() => weekToRender.value.filter((day) => getISODay(day) <= 5));
15118
15125
  const lastWeek = vue.computed(() => getDaysOfLastWeek(subWeeks(currentWeek.value)));
15119
15126
  const weekText = vue.computed(() => `${getOverlappingMonths(currentWeek.value)} (vecka ${getISOWeek(currentWeek.value)})`);
15120
15127
  const lastDayOfPreviousWeek = vue.computed(() => lastWeek.value[lastWeek.value.length - 1]);
15121
15128
  const disableLastWeekInteraction = vue.computed(
15122
- () => !!props.disablePreviousWeek || !!lastDayOfPreviousWeek.value && checkIfDateIsBeforeToday(lastDayOfPreviousWeek.value)
15129
+ () => !!props.disablePreviousWeek || !!lastDayOfPreviousWeek.value && checkIfDateIsBeforeToday(lastDayOfPreviousWeek.value) || !!props.minWeek && isBefore(subWeeks(currentWeek.value), startOfISOWeek(props.minWeek))
15123
15130
  );
15124
15131
  const disableNextWeekInteraction = vue.computed(
15125
15132
  () => !!props.disableNextWeek || !!props.maxDate && isSameWeek(currentWeek.value, props.maxDate, { weekStartsOn: 1 })
15126
15133
  );
15127
- const trailingPreviewDay = vue.computed(() => nextWeek.value[0]);
15128
15134
  const transitionClasses = vue.computed(() => {
15129
15135
  if (!props.enableHorizontalAnimation) {
15130
15136
  return {
@@ -15151,7 +15157,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15151
15157
  };
15152
15158
  });
15153
15159
  vue.watch(
15154
- weekToRender,
15160
+ visibleWeekDays,
15155
15161
  (week) => {
15156
15162
  const { endDate, startDate } = getStartAndEndRangeFromWeek(week);
15157
15163
  if (!startDate || !endDate) return;
@@ -15160,7 +15166,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15160
15166
  { immediate: true }
15161
15167
  );
15162
15168
  vue.watch(
15163
- () => props.initialWeek,
15169
+ () => props.minWeek,
15164
15170
  (newWeek) => {
15165
15171
  if (!newWeek) {
15166
15172
  currentWeek.value = startOfISOWeek(/* @__PURE__ */ new Date());
@@ -15233,7 +15239,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15233
15239
  key: currentWeek.value.toISOString(),
15234
15240
  class: "flex flex-row flex-nowrap items-center justify-start gap-x-px"
15235
15241
  }, [
15236
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(weekToRender.value, (weekDay, index) => {
15242
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(visibleWeekDays.value, (weekDay, index) => {
15237
15243
  return vue.openBlock(), vue.createBlock(_sfc_main$d, {
15238
15244
  key: `current-${weekDay.toISOString()}-${index}`,
15239
15245
  date: weekDay,
@@ -15242,15 +15248,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
15242
15248
  "is-today": isTodayDate(weekDay),
15243
15249
  onSelectDate: onHandleSelectedDay
15244
15250
  }, 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)
15251
+ }), 128))
15254
15252
  ]))
15255
15253
  ]),
15256
15254
  _: 1