vueless 0.0.69 → 0.0.71

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.
@@ -1,4 +1,4 @@
1
- import { onMounted, ref, watch, computed } from "vue";
1
+ import { onMounted, ref, watch, computed, onBeforeUnmount } from "vue";
2
2
 
3
3
  const BREAKPOINT_NAME = {
4
4
  xs: "xs",
@@ -50,7 +50,11 @@ export default function useBreakpoint() {
50
50
  onMounted(() => {
51
51
  windowWidth.value = window.innerWidth;
52
52
 
53
- window.addEventListener(resizeListener, { passive: true });
53
+ window.addEventListener("resize", resizeListener, { passive: true });
54
+ });
55
+
56
+ onBeforeUnmount(() => {
57
+ window.removeEventListener("resize", resizeListener, { passive: true });
54
58
  });
55
59
 
56
60
  watch(windowWidth, setBreakpoint, { immediate: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.69",
3
+ "version": "0.0.71",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -61,6 +61,7 @@ export default function useAttrs(props, { isShownMenu }) {
61
61
  const rangeSwitchWrapperAttrs = getAttrs("rangeSwitchWrapper");
62
62
  const nextIconAttrs = getAttrs("nextIcon");
63
63
  const prevIconAttrs = getAttrs("prevIcon");
64
+ const periodButtonIconAttrs = getAttrs("periodButtonIcon");
64
65
  const rangeSwitchTitleAttrs = getAttrs("rangeSwitchTitle");
65
66
 
66
67
  const periodButtonAttrs = (classes = []) => {
@@ -95,6 +96,7 @@ export default function useAttrs(props, { isShownMenu }) {
95
96
  menuAttrs,
96
97
  periodsRowAttrs,
97
98
  periodButtonAttrs,
99
+ periodButtonIconAttrs,
98
100
  rangeSwitchWrapperAttrs,
99
101
  nextIconAttrs,
100
102
  prevIconAttrs,
@@ -33,6 +33,7 @@ export default /*tw*/ {
33
33
  px-1.5 py-2.5 text-center text-xs font-medium text-brand-900 hover:bg-brand-200
34
34
  [&_span]:block [&_span]:font-normal [&_span]:text-brand-500
35
35
  `,
36
+ periodButtonIcon: "",
36
37
  periodButtonActive: "bg-zinc-200",
37
38
  rangeSwitchWrapper: "mb-2.5 mt-4 flex items-center justify-between py-2",
38
39
  rangeSwitchTitle: "font-medium text-sm",
@@ -192,6 +193,7 @@ export default /*tw*/ {
192
193
  },
193
194
  timepicker: false,
194
195
  disabled: false,
196
+ dateFormat: "d.m.Y",
195
197
  maxDate: undefined,
196
198
  minDate: undefined,
197
199
  },
@@ -6,7 +6,6 @@ export const UDatePickerRange = "UDatePickerRange";
6
6
 
7
7
  export const DATE_PICKER_BUTTON_TYPE = "button";
8
8
  export const DATE_PICKER_INPUT_TYPE = "input";
9
- export const RANGE_INPUT_FORMAT = "d.m.Y";
10
9
 
11
10
  export const INPUT_RANGE_TYPE = {
12
11
  start: "start",
@@ -91,7 +91,7 @@
91
91
  v-bind="periodButtonAttrs(getPeriodButtonsClasses(PERIOD.ownRange))"
92
92
  @click="onClickOwnRange"
93
93
  >
94
- <UIcon name="apps" size="xs" />
94
+ <UIcon name="apps" size="xs" v-bind="periodButtonIconAttrs" />
95
95
 
96
96
  {{ locale.ownRange }}
97
97
  </div>
@@ -168,7 +168,7 @@
168
168
  :min-date="minDate"
169
169
  :max-date="maxDate"
170
170
  v-bind="calendarAttrs"
171
- :date-format="RANGE_INPUT_FORMAT"
171
+ :date-format="dateFormat"
172
172
  range
173
173
  @mouseenter="onMouseoverCalendar"
174
174
  />
@@ -234,7 +234,6 @@ import {
234
234
  DATE_PICKER_BUTTON_TYPE,
235
235
  DATE_PICKER_INPUT_TYPE,
236
236
  PERIOD,
237
- RANGE_INPUT_FORMAT,
238
237
  INPUT_RANGE_TYPE,
239
238
  } from "./constants";
240
239
 
@@ -335,6 +334,14 @@ const props = defineProps({
335
334
  default: UIService.get(defaultConfig, UDatePickerRange).default.disabled,
336
335
  },
337
336
 
337
+ /**
338
+ * Date format.
339
+ */
340
+ dateFormat: {
341
+ type: String,
342
+ default: UIService.get(defaultConfig, UDatePickerRange).default.dateFormat,
343
+ },
344
+
338
345
  /**
339
346
  * Unique element id.
340
347
  * @ignore
@@ -372,6 +379,7 @@ const {
372
379
  menuAttrs,
373
380
  periodsRowAttrs,
374
381
  periodButtonAttrs,
382
+ periodButtonIconAttrs,
375
383
  rangeSwitchWrapperAttrs,
376
384
  nextIconAttrs,
377
385
  prevIconAttrs,
@@ -605,15 +613,11 @@ watch(
605
613
  }
606
614
 
607
615
  rangeStart.value = props.modelValue.from
608
- ? formatDate(
609
- getDateFromUnixTimestamp(props.modelValue.from),
610
- RANGE_INPUT_FORMAT,
611
- locale.value,
612
- )
616
+ ? formatDate(getDateFromUnixTimestamp(props.modelValue.from), props.dateFormat, locale.value)
613
617
  : "";
614
618
 
615
619
  rangeEnd.value = props.modelValue.to
616
- ? formatDate(getDateFromUnixTimestamp(props.modelValue.to), RANGE_INPUT_FORMAT, locale.value)
620
+ ? formatDate(getDateFromUnixTimestamp(props.modelValue.to), props.dateFormat, locale.value)
617
621
  : "";
618
622
 
619
623
  inputRangeStartError.value = "";
@@ -704,13 +708,13 @@ function isDatePeriodOutOfRange(datePeriod) {
704
708
  props.minDate,
705
709
  props.maxDate,
706
710
  locale.value,
707
- RANGE_INPUT_FORMAT,
711
+ props.dateFormat,
708
712
  ) ||
709
713
  dateIsOutOfRange(
710
714
  getDateFromUnixTimestamp(datePeriod.endRange),
711
715
  props.minDate,
712
716
  props.maxDate,
713
- RANGE_INPUT_FORMAT,
717
+ props.dateFormat,
714
718
  )
715
719
  );
716
720
  }
@@ -814,14 +818,14 @@ function onInputRangeInput(value, type) {
814
818
  inputRangeEndError.value = error;
815
819
  }
816
820
 
817
- const parsedValue = gmtToUTC(parseDate(value || new Date(), RANGE_INPUT_FORMAT, locale.value));
821
+ const parsedValue = gmtToUTC(parseDate(value || new Date(), props.dateFormat, locale.value));
818
822
  const unixTimeValue = getUnixTimestampFromDate(parsedValue);
819
823
  const isOutOfRange = dateIsOutOfRange(
820
824
  parsedValue,
821
825
  props.minDate,
822
826
  props.maxDate,
823
827
  locale.value,
824
- RANGE_INPUT_FORMAT,
828
+ props.dateFormat,
825
829
  );
826
830
  const isToLessThanFrom = unixTimeValue <= localValue.value.from;
827
831
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.69",
4
+ "version": "0.0.71",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -1741,6 +1741,15 @@
1741
1741
  },
1742
1742
  "default": "false"
1743
1743
  },
1744
+ {
1745
+ "name": "dateFormat",
1746
+ "description": "Date format.",
1747
+ "value": {
1748
+ "kind": "expression",
1749
+ "type": "string"
1750
+ },
1751
+ "default": "d.m.Y"
1752
+ },
1744
1753
  {
1745
1754
  "name": "id",
1746
1755
  "description": "@ignore: Unique element id.",