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.
- package/composable.breakpoint/index.js +6 -2
- package/package.json +1 -1
- package/ui.form-date-picker-range/composables/attrs.composable.js +2 -0
- package/ui.form-date-picker-range/configs/default.config.js +2 -0
- package/ui.form-date-picker-range/constants/index.js +0 -1
- package/ui.form-date-picker-range/index.vue +17 -13
- package/web-types.json +10 -1
|
@@ -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
|
@@ -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
|
},
|
|
@@ -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="
|
|
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),
|
|
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
|
-
|
|
711
|
+
props.dateFormat,
|
|
708
712
|
) ||
|
|
709
713
|
dateIsOutOfRange(
|
|
710
714
|
getDateFromUnixTimestamp(datePeriod.endRange),
|
|
711
715
|
props.minDate,
|
|
712
716
|
props.maxDate,
|
|
713
|
-
|
|
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(),
|
|
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
|
-
|
|
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.
|
|
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.",
|