@pequity/squirrel 10.1.0 → 11.0.0

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.
@@ -0,0 +1,19 @@
1
+ import type { Locale } from 'date-fns';
2
+ import { enUS } from 'date-fns/locale/en-US';
3
+ import { frCA } from 'date-fns/locale/fr-CA';
4
+
5
+ /**
6
+ * Maps vue-i18n locale codes to date-fns Locale objects.
7
+ *
8
+ * @param localeCode - The locale code from vue-i18n (e.g., 'en-US', 'fr-CA')
9
+ * @returns The corresponding date-fns Locale object
10
+ */
11
+ const localeMap = {
12
+ 'fr-CA': frCA,
13
+ 'en-US': enUS,
14
+ } as const;
15
+
16
+ const isValidLocaleCode = (code: string): code is keyof typeof localeMap => code in localeMap;
17
+
18
+ export const getDateFnsLocale = (localeCode: string): Locale =>
19
+ isValidLocaleCode(localeCode) ? localeMap[localeCode] : enUS;
@@ -1,171 +0,0 @@
1
- "use strict";
2
- const vue = require("vue");
3
- const pInput_vue_vue_type_script_setup_true_lang = require("./p-input.js");
4
- const VueDatePicker = require("@vuepic/vue-datepicker");
5
- const vueI18n = require("vue-i18n");
6
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
7
- ...{
8
- name: "PDatePicker",
9
- inheritAttrs: false
10
- },
11
- __name: "p-date-picker",
12
- props: /* @__PURE__ */ vue.mergeModels({
13
- label: { default: "" },
14
- errorMsg: { default: "" },
15
- required: { type: Boolean, default: false },
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: { type: [String, Function], default: "dd-MMM-yyyy" },
42
- previewFormat: {},
43
- hideInputIcon: { type: Boolean },
44
- state: { type: Boolean },
45
- clearable: { type: Boolean },
46
- alwaysClearable: { type: Boolean },
47
- autoApply: { type: Boolean, default: true },
48
- filters: {},
49
- disableMonthYearSelect: { type: Boolean },
50
- yearRange: {},
51
- disabledDates: {},
52
- inline: { type: [Boolean, Object], default: false },
53
- selectText: {},
54
- cancelText: {},
55
- weekNumName: {},
56
- autoPosition: { type: [Boolean, String] },
57
- monthPicker: { type: Boolean },
58
- timePicker: { type: Boolean },
59
- textInput: { type: [Boolean, Object], default: true },
60
- monthNameFormat: {},
61
- startDate: {},
62
- startTime: {},
63
- hideOffsetDates: { type: Boolean, default: true },
64
- noToday: { type: Boolean },
65
- noHoursOverlay: { type: Boolean },
66
- noMinutesOverlay: { type: Boolean },
67
- noSecondsOverlay: { type: Boolean },
68
- altPosition: {},
69
- disabledWeekDays: {},
70
- allowedDates: {},
71
- nowButtonLabel: {},
72
- monthChangeOnScroll: { type: [Boolean, String] },
73
- markers: {},
74
- transitions: { type: [Boolean, Object] },
75
- enableSeconds: { type: Boolean },
76
- escClose: { type: Boolean },
77
- spaceConfirm: { type: Boolean },
78
- monthChangeOnArrows: { type: Boolean },
79
- formatLocale: {},
80
- autocomplete: {},
81
- multiDates: { type: [Boolean, Object] },
82
- presetDates: {},
83
- flow: {},
84
- partialFlow: { type: Boolean },
85
- preventMinMaxNavigation: { type: Boolean },
86
- utc: { type: [Boolean, String] },
87
- reverseYears: { type: Boolean },
88
- weekPicker: { type: Boolean },
89
- vertical: { type: Boolean },
90
- ariaLabels: {},
91
- arrowNavigation: { type: Boolean },
92
- yearPicker: { type: Boolean },
93
- dayNames: {},
94
- modelType: { default: "yyyy-MM-dd" },
95
- modelAuto: { type: Boolean },
96
- highlight: {},
97
- offset: {},
98
- teleportCenter: { type: Boolean },
99
- teleport: { type: [Boolean, String] },
100
- ignoreTimeValidation: { type: Boolean },
101
- dayClass: {},
102
- hideNavigation: {},
103
- sixWeeks: { type: [Boolean, String] },
104
- timezone: {},
105
- disableYearSelect: { type: Boolean },
106
- focusStartDate: { type: Boolean },
107
- disabledTimes: {},
108
- timePickerInline: { type: Boolean },
109
- calendar: {},
110
- config: {},
111
- quarterPicker: { type: Boolean },
112
- yearFirst: { type: Boolean },
113
- loading: { type: Boolean },
114
- onInternalModelChange: {},
115
- enableMinutes: { type: Boolean },
116
- ui: {}
117
- }, {
118
- "modelValue": { default: "" },
119
- "modelModifiers": {}
120
- }),
121
- emits: ["update:modelValue"],
122
- setup(__props) {
123
- const props = __props;
124
- const model = vue.useModel(__props, "modelValue");
125
- const { locale } = vueI18n.useI18n();
126
- const attrs = vue.useAttrs();
127
- const datePickerProps = vue.computed(() => {
128
- const { modelValue: _, ...propsWithoutModelValue } = props;
129
- return { ...propsWithoutModelValue, locale: locale.value };
130
- });
131
- const inputPropsAndAttrs = vue.computed(() => {
132
- const { class: classes, style, ...res } = attrs;
133
- res.label = props.label;
134
- res.errorMsg = props.errorMsg;
135
- res.required = props.required;
136
- res.disabled = props.disabled;
137
- res.placeholder = props.placeholder ? props.placeholder : props.format;
138
- res.name = props.name;
139
- res.readonly = props.readonly;
140
- return res;
141
- });
142
- const handleInput = (e, onInputFn, onClearFn) => {
143
- if (e.target instanceof HTMLInputElement && e.target.value === "") {
144
- onClearFn(e);
145
- return;
146
- }
147
- return onInputFn(e);
148
- };
149
- return (_ctx, _cache) => {
150
- return vue.openBlock(), vue.createBlock(vue.unref(VueDatePicker), vue.mergeProps({
151
- modelValue: model.value,
152
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
153
- class: [{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]
154
- }, datePickerProps.value), {
155
- "dp-input": vue.withCtx(({ value, onInput, onEnter, onTab, onFocus, onBlur, onClear }) => [
156
- vue.createVNode(pInput_vue_vue_type_script_setup_true_lang._sfc_main, vue.mergeProps({ "model-value": value }, inputPropsAndAttrs.value, {
157
- onInput: ($event) => handleInput($event, onInput, onClear),
158
- onKeydown: [
159
- vue.withKeys(($event) => onEnter($event), ["enter"]),
160
- vue.withKeys(($event) => onTab($event), ["tab"])
161
- ],
162
- onFocus,
163
- onBlur
164
- }), null, 16, ["model-value", "onInput", "onKeydown", "onFocus", "onBlur"])
165
- ]),
166
- _: 1
167
- }, 16, ["modelValue", "class"]);
168
- };
169
- }
170
- });
171
- exports._sfc_main = _sfc_main;
@@ -1,172 +0,0 @@
1
- import { defineComponent, mergeModels, useModel, useAttrs, computed, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, withKeys } from "vue";
2
- import { _ as _sfc_main$1 } from "./p-input.js";
3
- import VueDatePicker from "@vuepic/vue-datepicker";
4
- import { useI18n } from "vue-i18n";
5
- const _sfc_main = /* @__PURE__ */ defineComponent({
6
- ...{
7
- name: "PDatePicker",
8
- inheritAttrs: false
9
- },
10
- __name: "p-date-picker",
11
- props: /* @__PURE__ */ mergeModels({
12
- label: { default: "" },
13
- errorMsg: { default: "" },
14
- required: { type: Boolean, default: false },
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
- alwaysClearable: { type: Boolean },
46
- autoApply: { type: Boolean, default: true },
47
- filters: {},
48
- disableMonthYearSelect: { type: Boolean },
49
- yearRange: {},
50
- disabledDates: {},
51
- inline: { type: [Boolean, Object], default: false },
52
- selectText: {},
53
- cancelText: {},
54
- weekNumName: {},
55
- autoPosition: { type: [Boolean, String] },
56
- monthPicker: { type: Boolean },
57
- timePicker: { type: Boolean },
58
- textInput: { type: [Boolean, Object], default: true },
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
- }),
120
- emits: ["update:modelValue"],
121
- setup(__props) {
122
- const props = __props;
123
- const model = useModel(__props, "modelValue");
124
- const { locale } = useI18n();
125
- const attrs = useAttrs();
126
- const datePickerProps = computed(() => {
127
- const { modelValue: _, ...propsWithoutModelValue } = props;
128
- return { ...propsWithoutModelValue, locale: locale.value };
129
- });
130
- const inputPropsAndAttrs = computed(() => {
131
- const { class: classes, style, ...res } = attrs;
132
- res.label = props.label;
133
- res.errorMsg = props.errorMsg;
134
- res.required = props.required;
135
- res.disabled = props.disabled;
136
- res.placeholder = props.placeholder ? props.placeholder : props.format;
137
- res.name = props.name;
138
- res.readonly = props.readonly;
139
- return res;
140
- });
141
- const handleInput = (e, onInputFn, onClearFn) => {
142
- if (e.target instanceof HTMLInputElement && e.target.value === "") {
143
- onClearFn(e);
144
- return;
145
- }
146
- return onInputFn(e);
147
- };
148
- return (_ctx, _cache) => {
149
- return openBlock(), createBlock(unref(VueDatePicker), mergeProps({
150
- modelValue: model.value,
151
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
152
- class: [{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]
153
- }, datePickerProps.value), {
154
- "dp-input": withCtx(({ value, onInput, onEnter, onTab, onFocus, onBlur, onClear }) => [
155
- createVNode(_sfc_main$1, mergeProps({ "model-value": value }, inputPropsAndAttrs.value, {
156
- onInput: ($event) => handleInput($event, onInput, onClear),
157
- onKeydown: [
158
- withKeys(($event) => onEnter($event), ["enter"]),
159
- withKeys(($event) => onTab($event), ["tab"])
160
- ],
161
- onFocus,
162
- onBlur
163
- }), null, 16, ["model-value", "onInput", "onKeydown", "onFocus", "onBlur"])
164
- ]),
165
- _: 1
166
- }, 16, ["modelValue", "class"]);
167
- };
168
- }
169
- });
170
- export {
171
- _sfc_main as _
172
- };