@mekari/pixel3-date-picker 0.0.1-dev.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.
- package/dist/calendar-panel.d.mts +231 -0
- package/dist/calendar-panel.d.ts +231 -0
- package/dist/calendar-panel.js +1498 -0
- package/dist/calendar-panel.mjs +25 -0
- package/dist/chunk-26Y3AVJW.mjs +115 -0
- package/dist/chunk-3VROFGJH.mjs +34 -0
- package/dist/chunk-3YYRUEIF.mjs +257 -0
- package/dist/chunk-5PISTT2K.mjs +131 -0
- package/dist/chunk-AGAA7XTC.mjs +20 -0
- package/dist/chunk-EJCSF5VR.mjs +492 -0
- package/dist/chunk-EQWT6VDG.mjs +34 -0
- package/dist/chunk-FTR7OMCT.mjs +0 -0
- package/dist/chunk-HJ4V3PM6.mjs +125 -0
- package/dist/chunk-J5BK7Z2U.mjs +46 -0
- package/dist/chunk-JZ2KFYWF.mjs +127 -0
- package/dist/chunk-LVCRFE25.mjs +153 -0
- package/dist/chunk-NIUQXHGQ.mjs +56 -0
- package/dist/chunk-NVULZQVI.mjs +119 -0
- package/dist/chunk-OY5PVQH5.mjs +31 -0
- package/dist/chunk-Q3Z5ZITX.mjs +155 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-V36XV4LV.mjs +129 -0
- package/dist/chunk-V6D6W7RO.mjs +0 -0
- package/dist/chunk-VACMCDOZ.mjs +8 -0
- package/dist/components/calendar/index.d.mts +11 -0
- package/dist/components/calendar/index.d.ts +11 -0
- package/dist/components/calendar/index.js +548 -0
- package/dist/components/calendar/index.mjs +23 -0
- package/dist/components/calendar/table-date.d.mts +97 -0
- package/dist/components/calendar/table-date.d.ts +97 -0
- package/dist/components/calendar/table-date.js +305 -0
- package/dist/components/calendar/table-date.mjs +13 -0
- package/dist/components/calendar/table-month.d.mts +90 -0
- package/dist/components/calendar/table-month.d.ts +90 -0
- package/dist/components/calendar/table-month.js +294 -0
- package/dist/components/calendar/table-month.mjs +14 -0
- package/dist/components/calendar/table-year.d.mts +71 -0
- package/dist/components/calendar/table-year.d.ts +71 -0
- package/dist/components/calendar/table-year.js +288 -0
- package/dist/components/calendar/table-year.mjs +14 -0
- package/dist/components/parts/date.d.mts +38 -0
- package/dist/components/parts/date.d.ts +38 -0
- package/dist/components/parts/date.js +70 -0
- package/dist/components/parts/date.mjs +7 -0
- package/dist/components/parts/day.d.mts +6 -0
- package/dist/components/parts/day.d.ts +6 -0
- package/dist/components/parts/day.js +44 -0
- package/dist/components/parts/day.mjs +7 -0
- package/dist/components/parts/index.d.mts +9 -0
- package/dist/components/parts/index.d.ts +9 -0
- package/dist/components/parts/index.js +157 -0
- package/dist/components/parts/index.mjs +20 -0
- package/dist/components/parts/month.d.mts +29 -0
- package/dist/components/parts/month.d.ts +29 -0
- package/dist/components/parts/month.js +58 -0
- package/dist/components/parts/month.mjs +7 -0
- package/dist/components/parts/year.d.mts +29 -0
- package/dist/components/parts/year.d.ts +29 -0
- package/dist/components/parts/year.js +58 -0
- package/dist/components/parts/year.mjs +7 -0
- package/dist/composables/useCalendar.d.mts +90 -0
- package/dist/composables/useCalendar.d.ts +90 -0
- package/dist/composables/useCalendar.js +184 -0
- package/dist/composables/useCalendar.mjs +8 -0
- package/dist/composables/useCalendarRange.d.mts +277 -0
- package/dist/composables/useCalendarRange.d.ts +277 -0
- package/dist/composables/useCalendarRange.js +160 -0
- package/dist/composables/useCalendarRange.mjs +8 -0
- package/dist/date-picker.d.mts +237 -0
- package/dist/date-picker.d.ts +237 -0
- package/dist/date-picker.js +1851 -0
- package/dist/date-picker.mjs +25 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1853 -0
- package/dist/index.mjs +25 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/date-picker.context.d.mts +20 -0
- package/dist/modules/date-picker.context.d.ts +20 -0
- package/dist/modules/date-picker.context.js +33 -0
- package/dist/modules/date-picker.context.mjs +9 -0
- package/dist/modules/date-picker.hooks.d.mts +53 -0
- package/dist/modules/date-picker.hooks.d.ts +53 -0
- package/dist/modules/date-picker.hooks.js +337 -0
- package/dist/modules/date-picker.hooks.mjs +10 -0
- package/dist/modules/date-picker.locales.d.mts +27 -0
- package/dist/modules/date-picker.locales.d.ts +27 -0
- package/dist/modules/date-picker.locales.js +84 -0
- package/dist/modules/date-picker.locales.mjs +8 -0
- package/dist/modules/date-picker.props.d.mts +217 -0
- package/dist/modules/date-picker.props.d.ts +217 -0
- package/dist/modules/date-picker.props.js +181 -0
- package/dist/modules/date-picker.props.mjs +11 -0
- package/dist/utils/base.d.mts +20 -0
- package/dist/utils/base.d.ts +20 -0
- package/dist/utils/base.js +80 -0
- package/dist/utils/base.mjs +13 -0
- package/dist/utils/date.d.mts +19 -0
- package/dist/utils/date.d.ts +19 -0
- package/dist/utils/date.js +147 -0
- package/dist/utils/date.mjs +29 -0
- package/package.json +49 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/modules/date-picker.hooks.ts
|
|
32
|
+
var date_picker_hooks_exports = {};
|
|
33
|
+
__export(date_picker_hooks_exports, {
|
|
34
|
+
useDatePicker: () => useDatePicker
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(date_picker_hooks_exports);
|
|
37
|
+
var import_vue = require("vue");
|
|
38
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
39
|
+
var import_date_format_parse = require("date-format-parse");
|
|
40
|
+
|
|
41
|
+
// src/modules/date-picker.locales.ts
|
|
42
|
+
var import_en = __toESM(require("date-format-parse/lib/locale/en"));
|
|
43
|
+
|
|
44
|
+
// src/utils/base.ts
|
|
45
|
+
var isObject = /* @__PURE__ */ __name((value) => {
|
|
46
|
+
return !!value && value.constructor === Object;
|
|
47
|
+
}, "isObject");
|
|
48
|
+
var assign = /* @__PURE__ */ __name((initial, override) => {
|
|
49
|
+
var _a;
|
|
50
|
+
if (!initial || !override)
|
|
51
|
+
return (_a = initial != null ? initial : override) != null ? _a : {};
|
|
52
|
+
return Object.entries({
|
|
53
|
+
...initial,
|
|
54
|
+
...override
|
|
55
|
+
}).reduce((acc, [key, value]) => {
|
|
56
|
+
return {
|
|
57
|
+
...acc,
|
|
58
|
+
[key]: (() => {
|
|
59
|
+
if (isObject(initial[key]))
|
|
60
|
+
return assign(initial[key], value);
|
|
61
|
+
return value;
|
|
62
|
+
})()
|
|
63
|
+
};
|
|
64
|
+
}, {});
|
|
65
|
+
}, "assign");
|
|
66
|
+
|
|
67
|
+
// src/modules/date-picker.locales.ts
|
|
68
|
+
var locales = {
|
|
69
|
+
formatLocale: import_en.default,
|
|
70
|
+
days: import_en.default.weekdaysMin,
|
|
71
|
+
months: import_en.default.monthsShort,
|
|
72
|
+
yearFormat: "YYYY",
|
|
73
|
+
monthFormat: "MMM",
|
|
74
|
+
monthBeforeYear: true,
|
|
75
|
+
todayText: "Today",
|
|
76
|
+
thisMonthText: "This Month",
|
|
77
|
+
thisYearText: "This Year"
|
|
78
|
+
};
|
|
79
|
+
function getLocale(config) {
|
|
80
|
+
if (!config) {
|
|
81
|
+
return locales;
|
|
82
|
+
}
|
|
83
|
+
return assign(locales, config);
|
|
84
|
+
}
|
|
85
|
+
__name(getLocale, "getLocale");
|
|
86
|
+
|
|
87
|
+
// src/utils/date.ts
|
|
88
|
+
var import_date_fns = require("date-fns");
|
|
89
|
+
function isValidDate(date) {
|
|
90
|
+
return date instanceof Date && !isNaN(date);
|
|
91
|
+
}
|
|
92
|
+
__name(isValidDate, "isValidDate");
|
|
93
|
+
function isValidRangeDate(date) {
|
|
94
|
+
return Array.isArray(date) && date.length === 2 && date.every(isValidDate) && date[0] <= date[1];
|
|
95
|
+
}
|
|
96
|
+
__name(isValidRangeDate, "isValidRangeDate");
|
|
97
|
+
|
|
98
|
+
// src/modules/date-picker.hooks.ts
|
|
99
|
+
function useDatePicker(props, emit) {
|
|
100
|
+
const getId = props.id || (0, import_pixel3_utils.getUniqueId)("", "datepicker").value;
|
|
101
|
+
const currentLabel = (0, import_vue.ref)("");
|
|
102
|
+
const isOutside = (0, import_vue.ref)(true);
|
|
103
|
+
const isPopoverOpen = (0, import_vue.ref)(false);
|
|
104
|
+
const isInnerInvalid = (0, import_vue.ref)(false);
|
|
105
|
+
const userInput = (0, import_vue.ref)(null);
|
|
106
|
+
const innerValueDate = (0, import_vue.ref)();
|
|
107
|
+
const isUseRange = (0, import_vue.computed)(() => {
|
|
108
|
+
if (props.isRange || props.type === "biweek" || props.type === "week")
|
|
109
|
+
return true;
|
|
110
|
+
return false;
|
|
111
|
+
});
|
|
112
|
+
const innerFormat = (0, import_vue.computed)(() => {
|
|
113
|
+
const format2 = {
|
|
114
|
+
date: "DD-MM-YYYY",
|
|
115
|
+
datetime: "DD-MM-YYYY HH:mm:ss",
|
|
116
|
+
year: "YYYY",
|
|
117
|
+
month: "YYYY-MM",
|
|
118
|
+
time: "HH:mm:ss",
|
|
119
|
+
week: "DD-MM-YYYY",
|
|
120
|
+
biweek: "DD-MM-YYYY"
|
|
121
|
+
};
|
|
122
|
+
return props.format || format2[props.type] || format2.date;
|
|
123
|
+
});
|
|
124
|
+
const innerValue = (0, import_vue.computed)(() => {
|
|
125
|
+
if (isUseRange.value) {
|
|
126
|
+
if (isValidRangeDate(props.modelValue)) {
|
|
127
|
+
const startDate = valueToDate(props.modelValue[0]);
|
|
128
|
+
const endDate = valueToDate(props.modelValue[1]);
|
|
129
|
+
return [startDate, endDate];
|
|
130
|
+
}
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
return valueToDate(props.modelValue);
|
|
134
|
+
});
|
|
135
|
+
const text = (0, import_vue.computed)(() => {
|
|
136
|
+
if (userInput.value !== null)
|
|
137
|
+
return userInput.value;
|
|
138
|
+
if (!innerValue.value)
|
|
139
|
+
return "";
|
|
140
|
+
if (isUseRange.value) {
|
|
141
|
+
if (!isValidRangeDate(innerValue.value))
|
|
142
|
+
return "";
|
|
143
|
+
} else {
|
|
144
|
+
if (!isValidDate(innerValue.value))
|
|
145
|
+
return "";
|
|
146
|
+
}
|
|
147
|
+
if (Array.isArray(innerValue.value)) {
|
|
148
|
+
return innerValue.value.map((v) => formatDate(v)).join(props.rangeSeparator);
|
|
149
|
+
}
|
|
150
|
+
return formatDate(innerValue.value);
|
|
151
|
+
});
|
|
152
|
+
const locale = (0, import_vue.computed)(() => {
|
|
153
|
+
if (isObject(props.lang)) {
|
|
154
|
+
return getLocale(props.lang);
|
|
155
|
+
}
|
|
156
|
+
return getLocale();
|
|
157
|
+
});
|
|
158
|
+
function onOpenPopover() {
|
|
159
|
+
if (props.isReadOnly)
|
|
160
|
+
return;
|
|
161
|
+
isPopoverOpen.value = true;
|
|
162
|
+
}
|
|
163
|
+
__name(onOpenPopover, "onOpenPopover");
|
|
164
|
+
function onClosePopover() {
|
|
165
|
+
isPopoverOpen.value = false;
|
|
166
|
+
}
|
|
167
|
+
__name(onClosePopover, "onClosePopover");
|
|
168
|
+
function onBlur() {
|
|
169
|
+
onClosePopover();
|
|
170
|
+
const inputEl = document.getElementById(`${getId}-control`);
|
|
171
|
+
inputEl == null ? void 0 : inputEl.blur();
|
|
172
|
+
}
|
|
173
|
+
__name(onBlur, "onBlur");
|
|
174
|
+
function handleForceFocusToInput() {
|
|
175
|
+
const inputEl = document.getElementById(`${getId}-control`);
|
|
176
|
+
inputEl == null ? void 0 : inputEl.focus();
|
|
177
|
+
}
|
|
178
|
+
__name(handleForceFocusToInput, "handleForceFocusToInput");
|
|
179
|
+
function onClear() {
|
|
180
|
+
isOutside.value = true;
|
|
181
|
+
userInput.value = null;
|
|
182
|
+
emit("update:modelValue", "");
|
|
183
|
+
onBlur();
|
|
184
|
+
}
|
|
185
|
+
__name(onClear, "onClear");
|
|
186
|
+
function onInputChange(e) {
|
|
187
|
+
var _a;
|
|
188
|
+
if (e) {
|
|
189
|
+
const target = e.target;
|
|
190
|
+
userInput.value = typeof e === "string" ? e : target.value;
|
|
191
|
+
if (userInput.value === null)
|
|
192
|
+
return;
|
|
193
|
+
const text2 = ((_a = userInput.value) == null ? void 0 : _a.trim()) || "";
|
|
194
|
+
if (text2 === "") {
|
|
195
|
+
onClear();
|
|
196
|
+
isInnerInvalid.value = false;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
let date;
|
|
200
|
+
if (isUseRange.value) {
|
|
201
|
+
let arr = text2.split(props.rangeSeparator);
|
|
202
|
+
if (arr.length !== 2) {
|
|
203
|
+
arr = text2.split(props.rangeSeparator.trim());
|
|
204
|
+
}
|
|
205
|
+
date = arr.map((v) => parseDate(v.trim()));
|
|
206
|
+
} else {
|
|
207
|
+
date = parseDate(text2);
|
|
208
|
+
}
|
|
209
|
+
if (isValidValueAndNotDisabled(date)) {
|
|
210
|
+
innerValueDate.value = date;
|
|
211
|
+
(0, import_vue.nextTick)(() => {
|
|
212
|
+
isOutside.value = true;
|
|
213
|
+
isInnerInvalid.value = false;
|
|
214
|
+
onBlur();
|
|
215
|
+
});
|
|
216
|
+
} else {
|
|
217
|
+
isInnerInvalid.value = true;
|
|
218
|
+
emit("error", text2);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
__name(onInputChange, "onInputChange");
|
|
223
|
+
function onEmitModelValue(value) {
|
|
224
|
+
userInput.value = null;
|
|
225
|
+
innerValueDate.value = value;
|
|
226
|
+
if (isUseRange.value) {
|
|
227
|
+
const dates = value;
|
|
228
|
+
const startDate = dateToValue(new Date(dates[0]));
|
|
229
|
+
const endDate = dateToValue(new Date(dates[1]));
|
|
230
|
+
emit("update:modelValue", [startDate, endDate]);
|
|
231
|
+
} else {
|
|
232
|
+
emit("update:modelValue", dateToValue(new Date(value)));
|
|
233
|
+
}
|
|
234
|
+
(0, import_vue.nextTick)(() => {
|
|
235
|
+
isOutside.value = true;
|
|
236
|
+
onBlur();
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
__name(onEmitModelValue, "onEmitModelValue");
|
|
240
|
+
function parseDate(value) {
|
|
241
|
+
const backupDate = /* @__PURE__ */ new Date();
|
|
242
|
+
return (0, import_date_format_parse.parse)(value, innerFormat.value, {
|
|
243
|
+
locale: locale.value.formatLocale,
|
|
244
|
+
backupDate
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
__name(parseDate, "parseDate");
|
|
248
|
+
function formatDate(date) {
|
|
249
|
+
return (0, import_date_format_parse.format)(date, innerFormat.value, {
|
|
250
|
+
locale: locale.value.formatLocale
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
__name(formatDate, "formatDate");
|
|
254
|
+
function valueToDate(value) {
|
|
255
|
+
switch (props.valueType) {
|
|
256
|
+
case "date":
|
|
257
|
+
return value instanceof Date ? new Date(value.getTime()) : /* @__PURE__ */ new Date(NaN);
|
|
258
|
+
case "timestamp":
|
|
259
|
+
return typeof value === "number" ? new Date(value) : /* @__PURE__ */ new Date(NaN);
|
|
260
|
+
case "string":
|
|
261
|
+
return typeof value === "string" ? parseDate(value) : /* @__PURE__ */ new Date(NaN);
|
|
262
|
+
default:
|
|
263
|
+
return typeof value === "string" ? parseDate(value) : /* @__PURE__ */ new Date(NaN);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
__name(valueToDate, "valueToDate");
|
|
267
|
+
function dateToValue(date) {
|
|
268
|
+
if (!isValidDate(date))
|
|
269
|
+
return null;
|
|
270
|
+
switch (props.valueType) {
|
|
271
|
+
case "date":
|
|
272
|
+
return date;
|
|
273
|
+
case "timestamp":
|
|
274
|
+
return date.getTime();
|
|
275
|
+
case "string":
|
|
276
|
+
return formatDate(date);
|
|
277
|
+
default:
|
|
278
|
+
return formatDate(date);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
__name(dateToValue, "dateToValue");
|
|
282
|
+
function isValidValue(value) {
|
|
283
|
+
if (isUseRange.value)
|
|
284
|
+
return isValidRangeDate(value);
|
|
285
|
+
return isValidDate(value);
|
|
286
|
+
}
|
|
287
|
+
__name(isValidValue, "isValidValue");
|
|
288
|
+
function isValidValueAndNotDisabled(value) {
|
|
289
|
+
if (!isValidValue(value))
|
|
290
|
+
return false;
|
|
291
|
+
const disabledDate = typeof props.disabledDate === "function" ? props.disabledDate : () => false;
|
|
292
|
+
if (!Array.isArray(value)) {
|
|
293
|
+
value = [value];
|
|
294
|
+
}
|
|
295
|
+
return value.every((v) => !disabledDate(v));
|
|
296
|
+
}
|
|
297
|
+
__name(isValidValueAndNotDisabled, "isValidValueAndNotDisabled");
|
|
298
|
+
const rootAttrs = {
|
|
299
|
+
style: {
|
|
300
|
+
width: "100%",
|
|
301
|
+
position: "relative"
|
|
302
|
+
},
|
|
303
|
+
onMouseenter: () => {
|
|
304
|
+
isOutside.value = false;
|
|
305
|
+
},
|
|
306
|
+
onMouseleave: () => {
|
|
307
|
+
isOutside.value = true;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
return {
|
|
311
|
+
rootAttrs,
|
|
312
|
+
isOutside,
|
|
313
|
+
isPopoverOpen,
|
|
314
|
+
currentLabel,
|
|
315
|
+
userInput,
|
|
316
|
+
innerFormat,
|
|
317
|
+
innerValueDate,
|
|
318
|
+
innerValue,
|
|
319
|
+
isUseRange,
|
|
320
|
+
onOpenPopover,
|
|
321
|
+
onClosePopover,
|
|
322
|
+
onClear,
|
|
323
|
+
onInputChange,
|
|
324
|
+
getId,
|
|
325
|
+
onBlur,
|
|
326
|
+
handleForceFocusToInput,
|
|
327
|
+
text,
|
|
328
|
+
locale,
|
|
329
|
+
isInnerInvalid,
|
|
330
|
+
onEmitModelValue
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
__name(useDatePicker, "useDatePicker");
|
|
334
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
335
|
+
0 && (module.exports = {
|
|
336
|
+
useDatePicker
|
|
337
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as date_format_parse_lib_locale from 'date-format-parse/lib/locale';
|
|
2
|
+
|
|
3
|
+
declare const locales: {
|
|
4
|
+
formatLocale: date_format_parse_lib_locale.Locale;
|
|
5
|
+
days: string[];
|
|
6
|
+
months: string[];
|
|
7
|
+
yearFormat: string;
|
|
8
|
+
monthFormat: string;
|
|
9
|
+
monthBeforeYear: boolean;
|
|
10
|
+
todayText: string;
|
|
11
|
+
thisMonthText: string;
|
|
12
|
+
thisYearText: string;
|
|
13
|
+
};
|
|
14
|
+
type Locales = Partial<typeof locales>;
|
|
15
|
+
declare function getLocale(config?: Locales): {
|
|
16
|
+
formatLocale: date_format_parse_lib_locale.Locale;
|
|
17
|
+
days: string[];
|
|
18
|
+
months: string[];
|
|
19
|
+
yearFormat: string;
|
|
20
|
+
monthFormat: string;
|
|
21
|
+
monthBeforeYear: boolean;
|
|
22
|
+
todayText: string;
|
|
23
|
+
thisMonthText: string;
|
|
24
|
+
thisYearText: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { getLocale };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as date_format_parse_lib_locale from 'date-format-parse/lib/locale';
|
|
2
|
+
|
|
3
|
+
declare const locales: {
|
|
4
|
+
formatLocale: date_format_parse_lib_locale.Locale;
|
|
5
|
+
days: string[];
|
|
6
|
+
months: string[];
|
|
7
|
+
yearFormat: string;
|
|
8
|
+
monthFormat: string;
|
|
9
|
+
monthBeforeYear: boolean;
|
|
10
|
+
todayText: string;
|
|
11
|
+
thisMonthText: string;
|
|
12
|
+
thisYearText: string;
|
|
13
|
+
};
|
|
14
|
+
type Locales = Partial<typeof locales>;
|
|
15
|
+
declare function getLocale(config?: Locales): {
|
|
16
|
+
formatLocale: date_format_parse_lib_locale.Locale;
|
|
17
|
+
days: string[];
|
|
18
|
+
months: string[];
|
|
19
|
+
yearFormat: string;
|
|
20
|
+
monthFormat: string;
|
|
21
|
+
monthBeforeYear: boolean;
|
|
22
|
+
todayText: string;
|
|
23
|
+
thisMonthText: string;
|
|
24
|
+
thisYearText: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { getLocale };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/modules/date-picker.locales.ts
|
|
32
|
+
var date_picker_locales_exports = {};
|
|
33
|
+
__export(date_picker_locales_exports, {
|
|
34
|
+
getLocale: () => getLocale
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(date_picker_locales_exports);
|
|
37
|
+
var import_en = __toESM(require("date-format-parse/lib/locale/en"));
|
|
38
|
+
|
|
39
|
+
// src/utils/base.ts
|
|
40
|
+
var isObject = /* @__PURE__ */ __name((value) => {
|
|
41
|
+
return !!value && value.constructor === Object;
|
|
42
|
+
}, "isObject");
|
|
43
|
+
var assign = /* @__PURE__ */ __name((initial, override) => {
|
|
44
|
+
var _a;
|
|
45
|
+
if (!initial || !override)
|
|
46
|
+
return (_a = initial != null ? initial : override) != null ? _a : {};
|
|
47
|
+
return Object.entries({
|
|
48
|
+
...initial,
|
|
49
|
+
...override
|
|
50
|
+
}).reduce((acc, [key, value]) => {
|
|
51
|
+
return {
|
|
52
|
+
...acc,
|
|
53
|
+
[key]: (() => {
|
|
54
|
+
if (isObject(initial[key]))
|
|
55
|
+
return assign(initial[key], value);
|
|
56
|
+
return value;
|
|
57
|
+
})()
|
|
58
|
+
};
|
|
59
|
+
}, {});
|
|
60
|
+
}, "assign");
|
|
61
|
+
|
|
62
|
+
// src/modules/date-picker.locales.ts
|
|
63
|
+
var locales = {
|
|
64
|
+
formatLocale: import_en.default,
|
|
65
|
+
days: import_en.default.weekdaysMin,
|
|
66
|
+
months: import_en.default.monthsShort,
|
|
67
|
+
yearFormat: "YYYY",
|
|
68
|
+
monthFormat: "MMM",
|
|
69
|
+
monthBeforeYear: true,
|
|
70
|
+
todayText: "Today",
|
|
71
|
+
thisMonthText: "This Month",
|
|
72
|
+
thisYearText: "This Year"
|
|
73
|
+
};
|
|
74
|
+
function getLocale(config) {
|
|
75
|
+
if (!config) {
|
|
76
|
+
return locales;
|
|
77
|
+
}
|
|
78
|
+
return assign(locales, config);
|
|
79
|
+
}
|
|
80
|
+
__name(getLocale, "getLocale");
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
getLocale
|
|
84
|
+
});
|