@pequity/squirrel 5.4.8 → 5.4.9
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/README.md +1 -1
- package/dist/cjs/chunks/p-date-picker.js +143 -85
- package/dist/cjs/chunks/p-inline-date-picker.js +117 -67
- package/dist/es/chunks/p-date-picker.js +144 -86
- package/dist/es/chunks/p-inline-date-picker.js +118 -68
- package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +27 -31
- package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +2 -2
- package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +1 -1
- package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +46 -0
- package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +3 -3
- package/dist/style.css +37 -928
- package/package.json +7 -9
- package/squirrel/assets/squirrel.css +45 -6
- package/squirrel/components/p-date-picker/p-date-picker.spec.js +292 -0
- package/squirrel/components/p-date-picker/p-date-picker.stories.js +2 -2
- package/squirrel/components/p-date-picker/p-date-picker.vue +45 -90
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +21 -45
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.stories.js +2 -2
- package/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue +16 -85
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The library is built using [Vue 3](https://vuejs.org/) and [Tailwind CSS](https:
|
|
|
10
10
|
Install the package and its dependencies using `pnpm`:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
pnpm i vue vue-router @pequity/squirrel @
|
|
13
|
+
pnpm i vue vue-router @pequity/squirrel @tanstack/vue-virtual @vuepic/vue-datepicker dayjs floating-vue lodash-es vue-currency-input vue-toastification@2.0.0-rc.5
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Install Tailwind CSS:
|
|
@@ -1,107 +1,165 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
3
|
const pInput = require("../p-input.js");
|
|
4
|
-
const
|
|
5
|
-
const dayjs = require("dayjs");
|
|
6
|
-
const lodashEs = require("lodash-es");
|
|
7
|
-
const vCalendar = require("v-calendar");
|
|
8
|
-
const _hoisted_1 = ["data-has-error"];
|
|
4
|
+
const VueDatePicker = require("@vuepic/vue-datepicker");
|
|
9
5
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
10
6
|
...{
|
|
11
7
|
name: "PDatePicker",
|
|
12
8
|
inheritAttrs: false
|
|
13
9
|
},
|
|
14
10
|
__name: "p-date-picker",
|
|
15
|
-
props: {
|
|
16
|
-
modelValue: { default: "" },
|
|
11
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
17
12
|
label: { default: "" },
|
|
18
13
|
errorMsg: { default: "" },
|
|
19
14
|
required: { type: Boolean, default: false },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
uid: {},
|
|
16
|
+
name: {},
|
|
17
|
+
is24: { type: Boolean },
|
|
18
|
+
enableTimePicker: { type: Boolean, default: false },
|
|
19
|
+
range: { type: [Boolean, Object] },
|
|
20
|
+
multiCalendars: { type: [Boolean, Number, String, Object] },
|
|
21
|
+
modelValue: {},
|
|
22
|
+
locale: {},
|
|
23
|
+
position: {},
|
|
24
|
+
dark: { type: Boolean },
|
|
25
|
+
placeholder: {},
|
|
26
|
+
weekNumbers: {},
|
|
27
|
+
hoursIncrement: {},
|
|
28
|
+
hoursGridIncrement: {},
|
|
29
|
+
secondsGridIncrement: {},
|
|
30
|
+
minutesGridIncrement: {},
|
|
31
|
+
minutesIncrement: {},
|
|
32
|
+
secondsIncrement: {},
|
|
33
|
+
minDate: {},
|
|
34
|
+
maxDate: {},
|
|
35
|
+
minTime: {},
|
|
36
|
+
maxTime: {},
|
|
37
|
+
weekStart: { default: 0 },
|
|
38
|
+
disabled: { type: Boolean },
|
|
39
|
+
readonly: { type: Boolean },
|
|
40
|
+
format: { type: [String, Function], default: "dd-MMM-yyyy" },
|
|
41
|
+
previewFormat: {},
|
|
42
|
+
hideInputIcon: { type: Boolean },
|
|
43
|
+
state: { type: Boolean },
|
|
44
|
+
clearable: { type: Boolean },
|
|
45
|
+
autoApply: { type: Boolean, default: true },
|
|
46
|
+
filters: {},
|
|
47
|
+
disableMonthYearSelect: { type: Boolean },
|
|
48
|
+
yearRange: {},
|
|
49
|
+
disabledDates: {},
|
|
50
|
+
inline: { type: [Boolean, Object], default: false },
|
|
51
|
+
selectText: {},
|
|
52
|
+
cancelText: {},
|
|
53
|
+
weekNumName: {},
|
|
54
|
+
autoPosition: { type: [Boolean, String] },
|
|
55
|
+
monthPicker: { type: Boolean },
|
|
56
|
+
timePicker: { type: Boolean },
|
|
57
|
+
textInput: { type: [Boolean, Object], default: true },
|
|
58
|
+
monthNameFormat: {},
|
|
59
|
+
startDate: {},
|
|
60
|
+
startTime: {},
|
|
61
|
+
hideOffsetDates: { type: Boolean, default: true },
|
|
62
|
+
noToday: { type: Boolean },
|
|
63
|
+
noHoursOverlay: { type: Boolean },
|
|
64
|
+
noMinutesOverlay: { type: Boolean },
|
|
65
|
+
noSecondsOverlay: { type: Boolean },
|
|
66
|
+
altPosition: {},
|
|
67
|
+
disabledWeekDays: {},
|
|
68
|
+
allowedDates: {},
|
|
69
|
+
nowButtonLabel: {},
|
|
70
|
+
monthChangeOnScroll: { type: [Boolean, String] },
|
|
71
|
+
markers: {},
|
|
72
|
+
transitions: { type: [Boolean, Object] },
|
|
73
|
+
enableSeconds: { type: Boolean },
|
|
74
|
+
escClose: { type: Boolean },
|
|
75
|
+
spaceConfirm: { type: Boolean },
|
|
76
|
+
monthChangeOnArrows: { type: Boolean },
|
|
77
|
+
formatLocale: {},
|
|
78
|
+
autocomplete: {},
|
|
79
|
+
multiDates: { type: [Boolean, Object] },
|
|
80
|
+
presetDates: {},
|
|
81
|
+
flow: {},
|
|
82
|
+
partialFlow: { type: Boolean },
|
|
83
|
+
preventMinMaxNavigation: { type: Boolean },
|
|
84
|
+
utc: { type: [Boolean, String] },
|
|
85
|
+
reverseYears: { type: Boolean },
|
|
86
|
+
weekPicker: { type: Boolean },
|
|
87
|
+
vertical: { type: Boolean },
|
|
88
|
+
ariaLabels: {},
|
|
89
|
+
arrowNavigation: { type: Boolean },
|
|
90
|
+
yearPicker: { type: Boolean },
|
|
91
|
+
dayNames: {},
|
|
92
|
+
modelType: { default: "yyyy-MM-dd" },
|
|
93
|
+
modelAuto: { type: Boolean },
|
|
94
|
+
highlight: {},
|
|
95
|
+
offset: {},
|
|
96
|
+
teleportCenter: { type: Boolean },
|
|
97
|
+
teleport: { type: [Boolean, String] },
|
|
98
|
+
ignoreTimeValidation: { type: Boolean },
|
|
99
|
+
dayClass: {},
|
|
100
|
+
hideNavigation: {},
|
|
101
|
+
sixWeeks: { type: [Boolean, String] },
|
|
102
|
+
timezone: {},
|
|
103
|
+
disableYearSelect: { type: Boolean },
|
|
104
|
+
focusStartDate: { type: Boolean },
|
|
105
|
+
disabledTimes: {},
|
|
106
|
+
timePickerInline: { type: Boolean },
|
|
107
|
+
calendar: {},
|
|
108
|
+
config: {},
|
|
109
|
+
quarterPicker: { type: Boolean },
|
|
110
|
+
yearFirst: { type: Boolean },
|
|
111
|
+
loading: { type: Boolean },
|
|
112
|
+
onInternalModelChange: {},
|
|
113
|
+
enableMinutes: { type: Boolean },
|
|
114
|
+
ui: {}
|
|
115
|
+
}, {
|
|
116
|
+
"modelValue": { default: "" },
|
|
117
|
+
"modelModifiers": {}
|
|
118
|
+
}),
|
|
24
119
|
emits: ["update:modelValue"],
|
|
25
|
-
setup(__props
|
|
26
|
-
const selectAttribute = { highlight: { class: "bg-primary", contentClass: "text-white" } };
|
|
27
|
-
const DEFAULT_MASKS = {
|
|
28
|
-
// The mask for the input
|
|
29
|
-
input: "DD-MMM-YYYY",
|
|
30
|
-
// The mask for the model value
|
|
31
|
-
data: "YYYY-MM-DD"
|
|
32
|
-
};
|
|
120
|
+
setup(__props) {
|
|
33
121
|
const props = __props;
|
|
34
|
-
const
|
|
35
|
-
const { labelClasses, errorMsgClasses } = useInputClasses.useInputClasses(props);
|
|
122
|
+
const model = vue.useModel(__props, "modelValue");
|
|
36
123
|
const attrs = vue.useAttrs();
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return Object.assign(DEFAULT_MASKS, attrs.masks);
|
|
41
|
-
});
|
|
42
|
-
const displayPlaceholder = vue.computed(() => {
|
|
43
|
-
return lodashEs.isString(attrs.placeholder) ? attrs.placeholder : masks.value.input;
|
|
124
|
+
const datePickerProps = vue.computed(() => {
|
|
125
|
+
const { modelValue: _, ...propsWithoutModelValue } = props;
|
|
126
|
+
return propsWithoutModelValue;
|
|
44
127
|
});
|
|
45
|
-
const
|
|
46
|
-
const { class: classes, style
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
() => props.modelValue,
|
|
54
|
-
(nV) => {
|
|
55
|
-
if (!stopWatch.value) {
|
|
56
|
-
innerValue.value = nV ? dayjs(nV, masks.value.data).toDate() : null;
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{ immediate: true }
|
|
60
|
-
);
|
|
61
|
-
vue.watch(innerValue, (nV) => {
|
|
62
|
-
const toEmit = lodashEs.isDate(nV) && nV.toString() !== "Invalid Date" ? dayjs(nV).format(masks.value.data) : null;
|
|
63
|
-
stopWatch.value = true;
|
|
64
|
-
emit("update:modelValue", toEmit);
|
|
65
|
-
vue.nextTick(() => {
|
|
66
|
-
stopWatch.value = false;
|
|
67
|
-
});
|
|
128
|
+
const inputPropsAndAttrs = vue.computed(() => {
|
|
129
|
+
const { class: classes, style, ...res } = attrs;
|
|
130
|
+
res.label = props.label;
|
|
131
|
+
res.errorMsg = props.errorMsg;
|
|
132
|
+
res.required = props.required;
|
|
133
|
+
res.disabled = props.disabled;
|
|
134
|
+
res.placeholder = props.placeholder ? props.placeholder : props.format;
|
|
135
|
+
return res;
|
|
68
136
|
});
|
|
137
|
+
const handleInput = (e, onInputFn, onClearFn) => {
|
|
138
|
+
if (e.target instanceof HTMLInputElement && e.target.value === "") {
|
|
139
|
+
onClearFn(e);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
return onInputFn(e);
|
|
143
|
+
};
|
|
69
144
|
return (_ctx, _cache) => {
|
|
70
|
-
return vue.openBlock(), vue.
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
vue.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
145
|
+
return vue.openBlock(), vue.createBlock(vue.unref(VueDatePicker), vue.mergeProps({
|
|
146
|
+
modelValue: model.value,
|
|
147
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
148
|
+
class: [{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]
|
|
149
|
+
}, datePickerProps.value), {
|
|
150
|
+
"dp-input": vue.withCtx(({ value, onInput, onEnter, onTab, onFocus, onBlur, onClear }) => [
|
|
151
|
+
vue.createVNode(pInput, vue.mergeProps({ "model-value": value }, inputPropsAndAttrs.value, {
|
|
152
|
+
onInput: ($event) => handleInput($event, onInput, onClear),
|
|
153
|
+
onKeydown: [
|
|
154
|
+
vue.withKeys(($event) => onEnter($event), ["enter"]),
|
|
155
|
+
vue.withKeys(($event) => onTab($event), ["tab"])
|
|
156
|
+
],
|
|
157
|
+
onFocus,
|
|
158
|
+
onBlur
|
|
159
|
+
}), null, 16, ["model-value", "onInput", "onKeydown", "onFocus", "onBlur"])
|
|
83
160
|
]),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => innerValue.value = $event),
|
|
87
|
-
"select-attribute": selectAttribute,
|
|
88
|
-
popover: { visibility: "click", placement: "auto" },
|
|
89
|
-
"min-date": _ctx.minDate || null,
|
|
90
|
-
"max-date": _ctx.maxDate || null,
|
|
91
|
-
masks: masks.value,
|
|
92
|
-
timezone: _ctx.timezone
|
|
93
|
-
}, {
|
|
94
|
-
default: vue.withCtx(({ inputValue, inputEvents }) => [
|
|
95
|
-
vue.createVNode(pInput, vue.mergeProps({ value: inputValue }, attrsWithoutClassAndStyle.value, { placeholder: displayPlaceholder.value }, vue.toHandlers(inputEvents)), null, 16, ["value", "placeholder"])
|
|
96
|
-
]),
|
|
97
|
-
_: 1
|
|
98
|
-
}, 8, ["modelValue", "min-date", "max-date", "masks", "timezone"]),
|
|
99
|
-
vue.withDirectives(vue.createElementVNode("div", {
|
|
100
|
-
class: vue.normalizeClass(vue.unref(errorMsgClasses))
|
|
101
|
-
}, vue.toDisplayString(_ctx.errorMsg), 3), [
|
|
102
|
-
[vue.vShow, _ctx.errorMsg]
|
|
103
|
-
])
|
|
104
|
-
], 14, _hoisted_1);
|
|
161
|
+
_: 1
|
|
162
|
+
}, 16, ["modelValue", "class"]);
|
|
105
163
|
};
|
|
106
164
|
}
|
|
107
165
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
3
|
const useInputClasses = require("../useInputClasses.js");
|
|
4
|
-
const
|
|
5
|
-
const vCalendar = require("v-calendar");
|
|
4
|
+
const VueDatePicker = require("@vuepic/vue-datepicker");
|
|
6
5
|
const _hoisted_1 = ["data-has-error"];
|
|
7
6
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
8
7
|
...{
|
|
@@ -10,69 +9,128 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
10
9
|
inheritAttrs: false
|
|
11
10
|
},
|
|
12
11
|
__name: "p-inline-date-picker",
|
|
13
|
-
props: {
|
|
14
|
-
modelValue: { default: "" },
|
|
12
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
15
13
|
label: { default: "" },
|
|
16
14
|
errorMsg: { default: "" },
|
|
17
15
|
required: { type: Boolean, default: false },
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
uid: {},
|
|
17
|
+
name: {},
|
|
18
|
+
is24: { type: Boolean },
|
|
19
|
+
enableTimePicker: { type: Boolean, default: false },
|
|
20
|
+
range: { type: [Boolean, Object] },
|
|
21
|
+
multiCalendars: { type: [Boolean, Number, String, Object] },
|
|
22
|
+
modelValue: {},
|
|
23
|
+
locale: {},
|
|
24
|
+
position: {},
|
|
25
|
+
dark: { type: Boolean },
|
|
26
|
+
placeholder: {},
|
|
27
|
+
weekNumbers: {},
|
|
28
|
+
hoursIncrement: {},
|
|
29
|
+
hoursGridIncrement: {},
|
|
30
|
+
secondsGridIncrement: {},
|
|
31
|
+
minutesGridIncrement: {},
|
|
32
|
+
minutesIncrement: {},
|
|
33
|
+
secondsIncrement: {},
|
|
34
|
+
minDate: {},
|
|
35
|
+
maxDate: {},
|
|
36
|
+
minTime: {},
|
|
37
|
+
maxTime: {},
|
|
38
|
+
weekStart: { default: 0 },
|
|
39
|
+
disabled: { type: Boolean },
|
|
40
|
+
readonly: { type: Boolean },
|
|
41
|
+
format: {},
|
|
42
|
+
previewFormat: {},
|
|
43
|
+
hideInputIcon: { type: Boolean },
|
|
44
|
+
state: { type: Boolean },
|
|
45
|
+
clearable: { type: Boolean },
|
|
46
|
+
autoApply: { type: Boolean, default: true },
|
|
47
|
+
filters: {},
|
|
48
|
+
disableMonthYearSelect: { type: Boolean },
|
|
49
|
+
yearRange: {},
|
|
50
|
+
disabledDates: {},
|
|
51
|
+
inline: { type: [Boolean, Object], default: true },
|
|
52
|
+
selectText: {},
|
|
53
|
+
cancelText: {},
|
|
54
|
+
weekNumName: {},
|
|
55
|
+
autoPosition: { type: [Boolean, String] },
|
|
56
|
+
monthPicker: { type: Boolean },
|
|
57
|
+
timePicker: { type: Boolean },
|
|
58
|
+
textInput: { type: [Boolean, Object] },
|
|
59
|
+
monthNameFormat: {},
|
|
60
|
+
startDate: {},
|
|
61
|
+
startTime: {},
|
|
62
|
+
hideOffsetDates: { type: Boolean, default: true },
|
|
63
|
+
noToday: { type: Boolean },
|
|
64
|
+
noHoursOverlay: { type: Boolean },
|
|
65
|
+
noMinutesOverlay: { type: Boolean },
|
|
66
|
+
noSecondsOverlay: { type: Boolean },
|
|
67
|
+
altPosition: {},
|
|
68
|
+
disabledWeekDays: {},
|
|
69
|
+
allowedDates: {},
|
|
70
|
+
nowButtonLabel: {},
|
|
71
|
+
monthChangeOnScroll: { type: [Boolean, String] },
|
|
72
|
+
markers: {},
|
|
73
|
+
transitions: { type: [Boolean, Object] },
|
|
74
|
+
enableSeconds: { type: Boolean },
|
|
75
|
+
escClose: { type: Boolean },
|
|
76
|
+
spaceConfirm: { type: Boolean },
|
|
77
|
+
monthChangeOnArrows: { type: Boolean },
|
|
78
|
+
formatLocale: {},
|
|
79
|
+
autocomplete: {},
|
|
80
|
+
multiDates: { type: [Boolean, Object] },
|
|
81
|
+
presetDates: {},
|
|
82
|
+
flow: {},
|
|
83
|
+
partialFlow: { type: Boolean },
|
|
84
|
+
preventMinMaxNavigation: { type: Boolean },
|
|
85
|
+
utc: { type: [Boolean, String] },
|
|
86
|
+
reverseYears: { type: Boolean },
|
|
87
|
+
weekPicker: { type: Boolean },
|
|
88
|
+
vertical: { type: Boolean },
|
|
89
|
+
ariaLabels: {},
|
|
90
|
+
arrowNavigation: { type: Boolean },
|
|
91
|
+
yearPicker: { type: Boolean },
|
|
92
|
+
dayNames: {},
|
|
93
|
+
modelType: { default: "yyyy-MM-dd" },
|
|
94
|
+
modelAuto: { type: Boolean },
|
|
95
|
+
highlight: {},
|
|
96
|
+
offset: {},
|
|
97
|
+
teleportCenter: { type: Boolean },
|
|
98
|
+
teleport: { type: [Boolean, String] },
|
|
99
|
+
ignoreTimeValidation: { type: Boolean },
|
|
100
|
+
dayClass: {},
|
|
101
|
+
hideNavigation: {},
|
|
102
|
+
sixWeeks: { type: [Boolean, String] },
|
|
103
|
+
timezone: {},
|
|
104
|
+
disableYearSelect: { type: Boolean },
|
|
105
|
+
focusStartDate: { type: Boolean },
|
|
106
|
+
disabledTimes: {},
|
|
107
|
+
timePickerInline: { type: Boolean },
|
|
108
|
+
calendar: {},
|
|
109
|
+
config: {},
|
|
110
|
+
quarterPicker: { type: Boolean },
|
|
111
|
+
yearFirst: { type: Boolean },
|
|
112
|
+
loading: { type: Boolean },
|
|
113
|
+
onInternalModelChange: {},
|
|
114
|
+
enableMinutes: { type: Boolean },
|
|
115
|
+
ui: {}
|
|
116
|
+
}, {
|
|
117
|
+
"modelValue": { default: "" },
|
|
118
|
+
"modelModifiers": {}
|
|
119
|
+
}),
|
|
22
120
|
emits: ["update:modelValue"],
|
|
23
|
-
setup(__props
|
|
24
|
-
const selectAttribute = {
|
|
25
|
-
highlight: { class: "bg-primary", contentClass: "text-white" }
|
|
26
|
-
};
|
|
27
|
-
const DEFAULT_MASKS = {
|
|
28
|
-
// The mask for the input
|
|
29
|
-
input: "DD-MMM-YYYY",
|
|
30
|
-
// The mask for the model value
|
|
31
|
-
data: "YYYY-MM-DD"
|
|
32
|
-
};
|
|
121
|
+
setup(__props) {
|
|
33
122
|
const props = __props;
|
|
34
|
-
const
|
|
35
|
-
const { labelClasses, errorMsgClasses } = useInputClasses.useInputClasses(props);
|
|
123
|
+
const model = vue.useModel(__props, "modelValue");
|
|
36
124
|
const attrs = vue.useAttrs();
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const listeners = vue.computed(() => {
|
|
43
|
-
return Object.keys(attrs).reduce((acc, curr) => {
|
|
44
|
-
if (curr.startsWith("on")) {
|
|
45
|
-
return { ...acc, [curr]: attrs[curr] };
|
|
46
|
-
} else {
|
|
47
|
-
return acc;
|
|
48
|
-
}
|
|
49
|
-
}, {});
|
|
125
|
+
const { labelClasses, errorMsgClasses } = useInputClasses.useInputClasses(props);
|
|
126
|
+
const datePickerProps = vue.computed(() => {
|
|
127
|
+
const { modelValue: _, ...propsWithoutModelValue } = props;
|
|
128
|
+
const { class: classes, style: style2, ...attrsWithoutClassAndStyle } = attrs;
|
|
129
|
+
return { ...propsWithoutModelValue, ...attrsWithoutClassAndStyle };
|
|
50
130
|
});
|
|
51
131
|
const style = vue.computed(() => {
|
|
52
132
|
return attrs.style;
|
|
53
133
|
});
|
|
54
|
-
const styleDatepicker = vue.computed(() => {
|
|
55
|
-
return props.errorMsg ? { border: "1px solid #f0453c" } : {};
|
|
56
|
-
});
|
|
57
|
-
const dayclick = (e) => {
|
|
58
|
-
emit("update:modelValue", e.id);
|
|
59
|
-
};
|
|
60
|
-
vue.watch(
|
|
61
|
-
() => props.modelValue,
|
|
62
|
-
async (nV) => {
|
|
63
|
-
const date = dayjs(nV, masks.value.data).toDate();
|
|
64
|
-
if (nV && date.toString() === "Invalid Date") {
|
|
65
|
-
emit("update:modelValue", null);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
innerValue.value = nV ? dayjs(nV, masks.value.data).toDate() : null;
|
|
69
|
-
const datepicker = datepickerRef.value;
|
|
70
|
-
if (datepicker && typeof datepicker.move === "function" && innerValue.value) {
|
|
71
|
-
await datepicker.move(innerValue.value);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
{ immediate: true }
|
|
75
|
-
);
|
|
76
134
|
return (_ctx, _cache) => {
|
|
77
135
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
78
136
|
class: vue.normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
|
|
@@ -88,18 +146,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
88
146
|
class: vue.normalizeClass(vue.unref(labelClasses))
|
|
89
147
|
}, vue.toDisplayString(_ctx.label), 3)) : vue.createCommentVNode("", true)
|
|
90
148
|
]),
|
|
91
|
-
vue.createVNode(vue.unref(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"model-value": innerValue.value,
|
|
96
|
-
"select-attribute": selectAttribute,
|
|
97
|
-
"min-date": _ctx.minDate || null,
|
|
98
|
-
"max-date": _ctx.maxDate || null,
|
|
99
|
-
masks: masks.value,
|
|
100
|
-
style: styleDatepicker.value,
|
|
101
|
-
timezone: _ctx.timezone
|
|
102
|
-
}, listeners.value, { onDayclick: dayclick }), null, 16, ["class", "model-value", "min-date", "max-date", "masks", "style", "timezone"]),
|
|
149
|
+
vue.createVNode(vue.unref(VueDatePicker), vue.mergeProps({
|
|
150
|
+
modelValue: model.value,
|
|
151
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
|
|
152
|
+
}, datePickerProps.value), null, 16, ["modelValue"]),
|
|
103
153
|
vue.withDirectives(vue.createElementVNode("div", {
|
|
104
154
|
class: vue.normalizeClass(vue.unref(errorMsgClasses))
|
|
105
155
|
}, vue.toDisplayString(_ctx.errorMsg), 3), [
|