@quidgest/ui 0.14.12 → 0.14.13
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/manifest/components.json +3 -0
- package/dist/ui.css +1647 -124
- package/dist/ui.esm.js +11101 -1899
- package/dist/ui.js +29 -29
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +1210 -255
- package/dist/ui.scss +208 -7
- package/esm/components/QBadge/QBadge.d.ts +2 -1
- package/esm/components/QBadge/QBadge.d.ts.map +1 -1
- package/esm/components/QBadge/QBadge.vue.js +75 -66
- package/esm/components/QBadge/index.d.ts +3 -0
- package/esm/components/QBadge/index.d.ts.map +1 -1
- package/esm/components/QBadge/types.d.ts +7 -0
- package/esm/components/QBadge/types.d.ts.map +1 -1
- package/esm/components/QBadge/types.js +5 -2
- package/esm/components/QBadgeIndicator/QBadgeIndicator.d.ts +22 -0
- package/esm/components/QBadgeIndicator/QBadgeIndicator.d.ts.map +1 -0
- package/esm/components/QBadgeIndicator/QBadgeIndicator.vue.js +43 -0
- package/esm/components/QBadgeIndicator/QBadgeIndicator.vue2.js +4 -0
- package/esm/components/QBadgeIndicator/index.d.ts +28 -0
- package/esm/components/QBadgeIndicator/index.d.ts.map +1 -0
- package/esm/components/QBadgeIndicator/index.js +6 -0
- package/esm/components/QBadgeIndicator/types.d.ts +19 -0
- package/esm/components/QBadgeIndicator/types.d.ts.map +1 -0
- package/esm/components/QCombobox/QCombobox.d.ts +32 -4
- package/esm/components/QCombobox/QCombobox.d.ts.map +1 -1
- package/esm/components/QCombobox/index.d.ts +56 -7
- package/esm/components/QCombobox/index.d.ts.map +1 -1
- package/esm/components/QDateTimePicker/QDateTimePicker.d.ts +36 -0
- package/esm/components/QDateTimePicker/QDateTimePicker.d.ts.map +1 -0
- package/esm/components/QDateTimePicker/QDateTimePicker.vue.js +168 -0
- package/esm/components/QDateTimePicker/QDateTimePicker.vue2.js +4 -0
- package/esm/components/QDateTimePicker/index.d.ts +54 -0
- package/esm/components/QDateTimePicker/index.d.ts.map +1 -0
- package/esm/components/QDateTimePicker/index.js +6 -0
- package/esm/components/QDateTimePicker/types.d.ts +93 -0
- package/esm/components/QDateTimePicker/types.d.ts.map +1 -0
- package/esm/components/QDateTimePicker/types.js +15 -0
- package/esm/components/QFileUpload/QFileUpload.d.ts +37 -0
- package/esm/components/QFileUpload/QFileUpload.d.ts.map +1 -0
- package/esm/components/QFileUpload/QFileUpload.vue.js +238 -0
- package/esm/components/QFileUpload/QFileUpload.vue2.js +4 -0
- package/esm/components/QFileUpload/index.d.ts +52 -0
- package/esm/components/QFileUpload/index.d.ts.map +1 -0
- package/esm/components/QFileUpload/index.js +6 -0
- package/esm/components/QFileUpload/types.d.ts +69 -0
- package/esm/components/QFileUpload/types.d.ts.map +1 -0
- package/esm/components/QFileUpload/types.js +28 -0
- package/esm/components/QTextField/QTextField.d.ts +3 -0
- package/esm/components/QTextField/QTextField.d.ts.map +1 -1
- package/esm/components/QTextField/QTextField.vue.js +51 -39
- package/esm/components/QTextField/index.d.ts +7 -0
- package/esm/components/QTextField/index.d.ts.map +1 -1
- package/esm/components/QTextField/types.d.ts +11 -0
- package/esm/components/QTextField/types.d.ts.map +1 -1
- package/esm/components/index.d.ts +3 -0
- package/esm/components/index.d.ts.map +1 -1
- package/esm/components/index.js +62 -56
- package/esm/composables/maska.d.ts +28 -0
- package/esm/composables/maska.d.ts.map +1 -0
- package/esm/composables/maska.js +26 -0
- package/esm/composables/useDropZone/index.d.ts +38 -0
- package/esm/composables/useDropZone/index.d.ts.map +1 -0
- package/esm/composables/useDropZone/index.js +62 -0
- package/esm/index.d.ts +3 -0
- package/esm/utils/color.js +57 -27
- package/esm/utils/date/date.d.ts +9 -0
- package/esm/utils/date/date.d.ts.map +1 -0
- package/esm/utils/date/date.js +91 -0
- package/esm/utils/date/index.d.ts +4 -0
- package/esm/utils/date/index.d.ts.map +1 -0
- package/esm/utils/date/tokens.d.ts +49 -0
- package/esm/utils/date/tokens.d.ts.map +1 -0
- package/esm/utils/date/tokens.js +243 -0
- package/esm/utils/download.d.ts +7 -0
- package/esm/utils/download.d.ts.map +1 -0
- package/esm/utils/download.js +16 -0
- package/esm/utils/string.d.ts.map +1 -1
- package/esm/utils/string.js +5 -2
- package/esm/utils/time.d.ts +36 -0
- package/esm/utils/time.d.ts.map +1 -0
- package/esm/utils/time.js +14 -0
- package/esm/vendors/@vuepic/vue-datepicker/dist/vue-datepicker.js +5148 -0
- package/esm/vendors/date-fns/_lib/addLeadingZeros.js +7 -0
- package/esm/vendors/date-fns/_lib/defaultOptions.js +7 -0
- package/esm/vendors/date-fns/_lib/format/formatters.js +583 -0
- package/esm/vendors/date-fns/_lib/format/lightFormatters.js +59 -0
- package/esm/vendors/date-fns/_lib/format/longFormatters.js +52 -0
- package/esm/vendors/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
- package/esm/vendors/date-fns/_lib/normalizeDates.js +11 -0
- package/esm/vendors/date-fns/_lib/normalizeInterval.js +8 -0
- package/esm/vendors/date-fns/_lib/protectedTokens.js +20 -0
- package/esm/vendors/date-fns/add.js +20 -0
- package/esm/vendors/date-fns/addDays.js +10 -0
- package/esm/vendors/date-fns/addHours.js +9 -0
- package/esm/vendors/date-fns/addMilliseconds.js +9 -0
- package/esm/vendors/date-fns/addMonths.js +20 -0
- package/esm/vendors/date-fns/addQuarters.js +8 -0
- package/esm/vendors/date-fns/addYears.js +8 -0
- package/esm/vendors/date-fns/compareAsc.js +9 -0
- package/esm/vendors/date-fns/constants.js +9 -0
- package/esm/vendors/date-fns/constructFrom.js +8 -0
- package/esm/vendors/date-fns/differenceInCalendarDays.js +16 -0
- package/esm/vendors/date-fns/differenceInCalendarYears.js +13 -0
- package/esm/vendors/date-fns/differenceInYears.js +17 -0
- package/esm/vendors/date-fns/eachDayOfInterval.js +17 -0
- package/esm/vendors/date-fns/eachQuarterOfInterval.js +18 -0
- package/esm/vendors/date-fns/endOfQuarter.js +9 -0
- package/esm/vendors/date-fns/endOfWeek.js +11 -0
- package/esm/vendors/date-fns/endOfYear.js +9 -0
- package/esm/vendors/date-fns/format.js +59 -0
- package/esm/vendors/date-fns/getDay.js +8 -0
- package/esm/vendors/date-fns/getDayOfYear.js +11 -0
- package/esm/vendors/date-fns/getDaysInMonth.js +10 -0
- package/esm/vendors/date-fns/getDefaultOptions.js +8 -0
- package/esm/vendors/date-fns/getHours.js +8 -0
- package/esm/vendors/date-fns/getISODay.js +9 -0
- package/esm/vendors/date-fns/getISOWeek.js +12 -0
- package/esm/vendors/date-fns/getISOWeekYear.js +15 -0
- package/esm/vendors/date-fns/getMinutes.js +8 -0
- package/esm/vendors/date-fns/getMonth.js +8 -0
- package/esm/vendors/date-fns/getQuarter.js +9 -0
- package/esm/vendors/date-fns/getSeconds.js +8 -0
- package/esm/vendors/date-fns/getWeek.js +12 -0
- package/esm/vendors/date-fns/getWeekYear.js +17 -0
- package/esm/vendors/date-fns/getYear.js +8 -0
- package/esm/vendors/date-fns/isAfter.js +8 -0
- package/esm/vendors/date-fns/isBefore.js +8 -0
- package/esm/vendors/date-fns/isDate.js +7 -0
- package/esm/vendors/date-fns/isEqual.js +8 -0
- package/esm/vendors/date-fns/isSameQuarter.js +14 -0
- package/esm/vendors/date-fns/isValid.js +9 -0
- package/esm/vendors/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
- package/esm/vendors/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
- package/esm/vendors/date-fns/locale/_lib/buildMatchFn.js +31 -0
- package/esm/vendors/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
- package/esm/vendors/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
- package/esm/vendors/date-fns/locale/en-US/_lib/formatLong.js +33 -0
- package/esm/vendors/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
- package/esm/vendors/date-fns/locale/en-US/_lib/localize.js +155 -0
- package/esm/vendors/date-fns/locale/en-US/_lib/match.js +110 -0
- package/esm/vendors/date-fns/locale/en-US.js +21 -0
- package/esm/vendors/date-fns/parse/_lib/Parser.js +22 -0
- package/esm/vendors/date-fns/parse/_lib/Setter.js +41 -0
- package/esm/vendors/date-fns/parse/_lib/constants.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/AMPMParser.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/DateParser.js +61 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/DayOfYearParser.js +51 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/DayParser.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/DayPeriodParser.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/EraParser.js +33 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/ExtendedYearParser.js +21 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +22 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/Hour0To11Parser.js +32 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/Hour0to23Parser.js +32 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/Hour1To24Parser.js +33 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/Hour1to12Parser.js +33 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/ISODayParser.js +105 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +48 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +48 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/ISOWeekParser.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +40 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/LocalDayParser.js +80 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/LocalWeekParser.js +48 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +69 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/MinuteParser.js +32 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/MonthParser.js +77 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/QuarterParser.js +75 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/SecondParser.js +32 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +80 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +77 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +75 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +22 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +22 -0
- package/esm/vendors/date-fns/parse/_lib/parsers/YearParser.js +49 -0
- package/esm/vendors/date-fns/parse/_lib/parsers.js +67 -0
- package/esm/vendors/date-fns/parse/_lib/utils.js +103 -0
- package/esm/vendors/date-fns/parse.js +89 -0
- package/esm/vendors/date-fns/set.js +11 -0
- package/esm/vendors/date-fns/setDay.js +12 -0
- package/esm/vendors/date-fns/setHours.js +9 -0
- package/esm/vendors/date-fns/setISODay.js +11 -0
- package/esm/vendors/date-fns/setISOWeek.js +10 -0
- package/esm/vendors/date-fns/setMilliseconds.js +9 -0
- package/esm/vendors/date-fns/setMinutes.js +9 -0
- package/esm/vendors/date-fns/setMonth.js +13 -0
- package/esm/vendors/date-fns/setSeconds.js +9 -0
- package/esm/vendors/date-fns/setWeek.js +10 -0
- package/esm/vendors/date-fns/setYear.js +10 -0
- package/esm/vendors/date-fns/startOfDay.js +9 -0
- package/esm/vendors/date-fns/startOfISOWeek.js +8 -0
- package/esm/vendors/date-fns/startOfISOWeekYear.js +11 -0
- package/esm/vendors/date-fns/startOfMonth.js +9 -0
- package/esm/vendors/date-fns/startOfQuarter.js +9 -0
- package/esm/vendors/date-fns/startOfWeek.js +11 -0
- package/esm/vendors/date-fns/startOfWeekYear.js +13 -0
- package/esm/vendors/date-fns/startOfYear.js +9 -0
- package/esm/vendors/date-fns/sub.js +19 -0
- package/esm/vendors/date-fns/subDays.js +8 -0
- package/esm/vendors/date-fns/subMonths.js +8 -0
- package/esm/vendors/date-fns/subYears.js +8 -0
- package/esm/vendors/date-fns/toDate.js +8 -0
- package/esm/vendors/date-fns/transpose.js +18 -0
- package/esm/vendors/maska/dist/maska.js +179 -0
- package/package.json +5 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MaybeRef, Ref } from 'vue';
|
|
2
|
+
interface DropZoneOptions {
|
|
3
|
+
/** Callback fired when valid files are dropped */
|
|
4
|
+
onDrop?: (files: File[]) => void;
|
|
5
|
+
/** Callback fired when files are dragged over the drop zone */
|
|
6
|
+
onDragOver?: (event: DragEvent) => void;
|
|
7
|
+
/** Callback fired when files are dragged out of the drop zone */
|
|
8
|
+
onDragLeave?: (event: DragEvent) => void;
|
|
9
|
+
/** Array of accepted MIME types or file patterns (e.g., 'image/*', '.pdf') */
|
|
10
|
+
accept?: MaybeRef<string[]>;
|
|
11
|
+
/** Whether to allow multiple files to be dropped */
|
|
12
|
+
multiple?: MaybeRef<boolean>;
|
|
13
|
+
/** Maximum allowed file size in bytes */
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
/** Whether the drop zone is enabled */
|
|
16
|
+
enabled?: MaybeRef<boolean>;
|
|
17
|
+
}
|
|
18
|
+
interface UseDropZoneReturn {
|
|
19
|
+
/** Whether files are currently being dragged over the drop zone */
|
|
20
|
+
isOverDropZone: Ref<boolean>;
|
|
21
|
+
/** Whether the currently dragged files match the accepted types */
|
|
22
|
+
isValid: Ref<boolean>;
|
|
23
|
+
/** Whether the drop zone is currently enabled */
|
|
24
|
+
isEnabled: Ref<boolean>;
|
|
25
|
+
/** Function to enable the drop zone */
|
|
26
|
+
enable: () => void;
|
|
27
|
+
/** Function to disable the drop zone */
|
|
28
|
+
disable: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Vue composable for handling file drag and drop with validation
|
|
32
|
+
*
|
|
33
|
+
* @param elementRef - Ref to the HTML element that will act as the drop zone
|
|
34
|
+
* @param options - Configuration options for the drop zone
|
|
35
|
+
*/
|
|
36
|
+
export declare function useDropZone(elementRef: Ref<HTMLElement | null>, options?: DropZoneOptions): UseDropZoneReturn;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/useDropZone/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAKxC,UAAU,eAAe;IACxB,kDAAkD;IAClD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAChC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,iEAAiE;IACjE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACxC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5B,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uCAAuC;IACvC,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC3B;AAED,UAAU,iBAAiB;IAC1B,mEAAmE;IACnE,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC5B,mEAAmE;IACnE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,iDAAiD;IACjD,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACvB,uCAAuC;IACvC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,wCAAwC;IACxC,OAAO,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,UAAU,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,EACnC,OAAO,GAAE,eAAoB,GAC3B,iBAAiB,CAmJnB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ref as v, unref as c, isRef as C, watch as M, onMounted as O, onUnmounted as U } from "vue";
|
|
2
|
+
function k(p, s = {}) {
|
|
3
|
+
const {
|
|
4
|
+
onDrop: m,
|
|
5
|
+
onDragOver: i,
|
|
6
|
+
onDragLeave: d,
|
|
7
|
+
accept: y = [],
|
|
8
|
+
multiple: F,
|
|
9
|
+
maxSize: g,
|
|
10
|
+
enabled: T = !0
|
|
11
|
+
} = s;
|
|
12
|
+
let a = 0;
|
|
13
|
+
const l = v(!1), u = v(!1), t = v(c(T)), E = (e) => {
|
|
14
|
+
const r = c(y);
|
|
15
|
+
return r.length === 0 || r.some((n) => e.match(n));
|
|
16
|
+
}, x = (e) => !(g && e.size > g || !E(e.type)), f = () => {
|
|
17
|
+
a = 0, l.value = !1, u.value = !1;
|
|
18
|
+
}, L = (e) => {
|
|
19
|
+
var o;
|
|
20
|
+
if (!t.value) return;
|
|
21
|
+
e.preventDefault(), f();
|
|
22
|
+
const r = Array.from(((o = e.dataTransfer) == null ? void 0 : o.files) || []);
|
|
23
|
+
if (!c(F) && r.length > 1)
|
|
24
|
+
return;
|
|
25
|
+
const n = r.filter(x);
|
|
26
|
+
n.length && m && m(n);
|
|
27
|
+
}, h = (e) => {
|
|
28
|
+
var n;
|
|
29
|
+
if (!t.value) return;
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
const r = Array.from(((n = e.dataTransfer) == null ? void 0 : n.items) || []).map((o) => o.type);
|
|
32
|
+
u.value = r.some(E), a++, a === 1 && (l.value = !0, i == null || i(e));
|
|
33
|
+
}, D = (e) => {
|
|
34
|
+
t.value && (e.preventDefault(), a--, a === 0 && (l.value = !1, u.value = !1, d == null || d(e)));
|
|
35
|
+
}, b = (e) => {
|
|
36
|
+
t.value && e.preventDefault();
|
|
37
|
+
}, z = () => {
|
|
38
|
+
t.value = !0;
|
|
39
|
+
}, A = () => {
|
|
40
|
+
t.value = !1, f();
|
|
41
|
+
};
|
|
42
|
+
s.enabled && C(s.enabled) && M(s.enabled, (e) => {
|
|
43
|
+
t.value = e, e || f();
|
|
44
|
+
});
|
|
45
|
+
const S = () => {
|
|
46
|
+
const e = p.value;
|
|
47
|
+
e && (e.addEventListener("drop", L), e.addEventListener("dragenter", h), e.addEventListener("dragleave", D), e.addEventListener("dragover", b));
|
|
48
|
+
}, Z = () => {
|
|
49
|
+
const e = p.value;
|
|
50
|
+
e && (e.removeEventListener("drop", L), e.removeEventListener("dragenter", h), e.removeEventListener("dragleave", D), e.removeEventListener("dragover", b));
|
|
51
|
+
};
|
|
52
|
+
return O(S), U(Z), {
|
|
53
|
+
isOverDropZone: l,
|
|
54
|
+
isValid: u,
|
|
55
|
+
isEnabled: t,
|
|
56
|
+
enable: z,
|
|
57
|
+
disable: A
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
k as useDropZone
|
|
62
|
+
};
|
package/esm/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare module '@vue/runtime-core' {
|
|
|
9
9
|
export interface GlobalComponents {
|
|
10
10
|
QAccordion: typeof import('@quidgest/ui/components')['QAccordion']
|
|
11
11
|
QBadge: typeof import('@quidgest/ui/components')['QBadge']
|
|
12
|
+
QBadgeIndicator: typeof import('@quidgest/ui/components')['QBadgeIndicator']
|
|
12
13
|
QButton: typeof import('@quidgest/ui/components')['QButton']
|
|
13
14
|
QButtonGroup: typeof import('@quidgest/ui/components')['QButtonGroup']
|
|
14
15
|
QButtonToggle: typeof import('@quidgest/ui/components')['QButtonToggle']
|
|
@@ -17,9 +18,11 @@ declare module '@vue/runtime-core' {
|
|
|
17
18
|
QCollapsible: typeof import('@quidgest/ui/components')['QCollapsible']
|
|
18
19
|
QColorPicker: typeof import('@quidgest/ui/components')['QColorPicker']
|
|
19
20
|
QCombobox: typeof import('@quidgest/ui/components')['QCombobox']
|
|
21
|
+
QDateTimePicker: typeof import('@quidgest/ui/components')['QDateTimePicker']
|
|
20
22
|
QDialog: typeof import('@quidgest/ui/components')['QDialog']
|
|
21
23
|
QDropdownMenu: typeof import('@quidgest/ui/components')['QDropdownMenu']
|
|
22
24
|
QField: typeof import('@quidgest/ui/components')['QField']
|
|
25
|
+
QFileUpload: typeof import('@quidgest/ui/components')['QFileUpload']
|
|
23
26
|
QIcon: typeof import('@quidgest/ui/components')['QIcon']
|
|
24
27
|
QIconFont: typeof import('@quidgest/ui/components')['QIconFont']
|
|
25
28
|
QIconImg: typeof import('@quidgest/ui/components')['QIconImg']
|
package/esm/utils/color.js
CHANGED
|
@@ -1,41 +1,49 @@
|
|
|
1
|
-
function h(t,
|
|
2
|
-
return
|
|
1
|
+
function h(t, r = !1) {
|
|
2
|
+
return r ? /^#[a-fA-F0-9]{6}$/.test(t) : /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(t);
|
|
3
3
|
}
|
|
4
4
|
function d(t) {
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
const
|
|
8
|
-
return { r:
|
|
5
|
+
const r = t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
6
|
+
if (r) {
|
|
7
|
+
const n = parseInt(r[1], 10), s = parseInt(r[2], 10), e = parseInt(r[3], 10);
|
|
8
|
+
return { r: n, g: s, b: e };
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function b(t) {
|
|
12
12
|
if (h(t)) {
|
|
13
13
|
t.length === 4 && (t = "#" + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
|
|
14
|
-
const
|
|
15
|
-
return { r
|
|
14
|
+
const r = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), s = parseInt(t.slice(5, 7), 16);
|
|
15
|
+
return { r, g: n, b: s };
|
|
16
16
|
} else {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
17
|
+
const r = d(t);
|
|
18
|
+
if (r) return r;
|
|
19
19
|
}
|
|
20
20
|
throw new Error("Invalid color format");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const n = t
|
|
22
|
+
function p(t, r) {
|
|
23
|
+
const n = g(t), s = r / 100;
|
|
24
|
+
return n.l = n.l - s * n.l, l(n);
|
|
25
|
+
}
|
|
26
|
+
function M(t) {
|
|
27
|
+
const r = t.r.toString(16).padStart(2, "0"), n = t.g.toString(16).padStart(2, "0"), s = t.b.toString(16).padStart(2, "0");
|
|
28
|
+
return `#${r}${n}${s}`;
|
|
29
|
+
}
|
|
30
|
+
function g(t) {
|
|
31
|
+
const r = t.r / 255, n = t.g / 255, s = t.b / 255, e = Math.max(r, n, s), o = Math.min(r, n, s);
|
|
24
32
|
let a = 0, c;
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
33
|
+
const i = (e + o) / 2;
|
|
34
|
+
if (e === o)
|
|
27
35
|
a = c = 0;
|
|
28
36
|
else {
|
|
29
|
-
const
|
|
30
|
-
switch (c =
|
|
37
|
+
const u = e - o;
|
|
38
|
+
switch (c = i > 0.5 ? u / (2 - e - o) : u / (e + o), e) {
|
|
39
|
+
case r:
|
|
40
|
+
a = (n - s) / u + (n < s ? 6 : 0);
|
|
41
|
+
break;
|
|
31
42
|
case n:
|
|
32
|
-
a = (s -
|
|
43
|
+
a = (s - r) / u + 2;
|
|
33
44
|
break;
|
|
34
45
|
case s:
|
|
35
|
-
a = (
|
|
36
|
-
break;
|
|
37
|
-
case e:
|
|
38
|
-
a = (n - s) / f + 4;
|
|
46
|
+
a = (r - n) / u + 4;
|
|
39
47
|
break;
|
|
40
48
|
}
|
|
41
49
|
a /= 6;
|
|
@@ -43,16 +51,38 @@ function b(t) {
|
|
|
43
51
|
return {
|
|
44
52
|
h: Math.round(a * 360),
|
|
45
53
|
s: Math.round(c * 100),
|
|
46
|
-
l: Math.round(
|
|
54
|
+
l: Math.round(i * 100)
|
|
47
55
|
};
|
|
48
56
|
}
|
|
49
|
-
function
|
|
57
|
+
function l(t) {
|
|
58
|
+
const r = t.h / 360, n = t.s / 100, s = t.l / 100;
|
|
59
|
+
let e, o, a;
|
|
60
|
+
if (n === 0)
|
|
61
|
+
e = o = a = s;
|
|
62
|
+
else {
|
|
63
|
+
const c = s < 0.5 ? s * (1 + n) : s + n - s * n, i = 2 * s - c;
|
|
64
|
+
e = f(i, c, r + 1 / 3), o = f(i, c, r), a = f(i, c, r - 1 / 3);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
r: Math.round(e * 255),
|
|
68
|
+
g: Math.round(o * 255),
|
|
69
|
+
b: Math.round(a * 255)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function f(t, r, n) {
|
|
73
|
+
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (r - t) * 6 * n : n < 1 / 2 ? r : n < 2 / 3 ? t + (r - t) * (2 / 3 - n) * 6 : t;
|
|
74
|
+
}
|
|
75
|
+
function m(t) {
|
|
50
76
|
return t > 50 ? "#000" : "#fff";
|
|
51
77
|
}
|
|
52
78
|
export {
|
|
53
|
-
|
|
79
|
+
M as colorToHex,
|
|
80
|
+
p as darken,
|
|
81
|
+
m as getContrastingColor,
|
|
82
|
+
l as hslToRgb,
|
|
83
|
+
f as hueToRgb,
|
|
54
84
|
h as isValidHex,
|
|
55
|
-
|
|
56
|
-
|
|
85
|
+
b as parseColor,
|
|
86
|
+
g as rgbToHsl,
|
|
57
87
|
d as tryParseRgb
|
|
58
88
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a Unicode date format pattern
|
|
3
|
+
* into a mask string compatible with the Maska library.
|
|
4
|
+
*
|
|
5
|
+
* @param pattern - The Unicode date format pattern to be converted.
|
|
6
|
+
* @returns The corresponding mask string for the Maska library.
|
|
7
|
+
*/
|
|
8
|
+
export declare function convertDatePatternToMask(format: string): string | string[];
|
|
9
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date/date.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CA8C1E"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { tokenizeFormat as g, staticTokensMap as h, isUnitRepetition as y, dynamicTokensMap as E } from "./tokens.js";
|
|
2
|
+
function x(n) {
|
|
3
|
+
const r = g(n);
|
|
4
|
+
if (!r)
|
|
5
|
+
throw Error("Failed to tokenize format string.");
|
|
6
|
+
const i = [...r.sort((e, a) => a.length - e.length)], t = [n];
|
|
7
|
+
if (r.filter((e) => h[e] !== void 0).forEach((e) => {
|
|
8
|
+
const a = h[e];
|
|
9
|
+
d(a, t, e);
|
|
10
|
+
const c = i.indexOf(e);
|
|
11
|
+
i.splice(c, 1);
|
|
12
|
+
}), [...i].forEach((e) => {
|
|
13
|
+
if (!y(e))
|
|
14
|
+
throw new Error(`Invalid token format: ${e}. Tokens must be repeated characters.`);
|
|
15
|
+
const a = e[0], c = w(a, e.length);
|
|
16
|
+
d(c, t, e);
|
|
17
|
+
const f = i.indexOf(e);
|
|
18
|
+
i.splice(f, 1);
|
|
19
|
+
}), i.length > 0)
|
|
20
|
+
throw new Error(`Unhandled tokens remain: ${i.join(", ")}`);
|
|
21
|
+
return t.forEach((e, a) => {
|
|
22
|
+
t[a] = T(e);
|
|
23
|
+
}), t.length === 1 ? t[0] : t;
|
|
24
|
+
}
|
|
25
|
+
function T(n) {
|
|
26
|
+
const r = "\0";
|
|
27
|
+
return n.replace(/'((?:[^']|'')+)'/g, (i, t) => t.replace(/''/g, r).split("").map((e) => e === r ? "!'" : "!" + e).join(""));
|
|
28
|
+
}
|
|
29
|
+
function w(n, r) {
|
|
30
|
+
const i = [], t = E[n];
|
|
31
|
+
if (t === void 0)
|
|
32
|
+
throw new Error(`Dynamic token '${n}' not found.`);
|
|
33
|
+
if (typeof t == "string") {
|
|
34
|
+
const s = p(t, r);
|
|
35
|
+
i.push(s);
|
|
36
|
+
} else Array.isArray(i) && t.forEach((o) => {
|
|
37
|
+
const s = p(o, r);
|
|
38
|
+
i.push(s);
|
|
39
|
+
});
|
|
40
|
+
return i;
|
|
41
|
+
}
|
|
42
|
+
function p(n, r) {
|
|
43
|
+
const i = n.startsWith("-");
|
|
44
|
+
return i && (n = n.substring(1)), n = n.repeat(r), i && (n = `-${n}`), n;
|
|
45
|
+
}
|
|
46
|
+
function d(n, r, i) {
|
|
47
|
+
if (typeof n == "string") {
|
|
48
|
+
const t = n;
|
|
49
|
+
r.forEach((o, s) => {
|
|
50
|
+
r[s] = u(o, i, t);
|
|
51
|
+
});
|
|
52
|
+
} else if (Array.isArray(n)) {
|
|
53
|
+
const t = n.length, o = [...r], s = o.length;
|
|
54
|
+
for (let e = 1; e < t; e++)
|
|
55
|
+
r.push(...o);
|
|
56
|
+
n.forEach((e, a) => {
|
|
57
|
+
const c = a * s, f = c + s - 1;
|
|
58
|
+
for (let l = c; l <= f; l++)
|
|
59
|
+
r[l] = u(r[l], i, e);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function u(n, r, i) {
|
|
64
|
+
let t = "", o = 0, s = !1, e = "";
|
|
65
|
+
const a = r.length;
|
|
66
|
+
for (; o < n.length; ) {
|
|
67
|
+
const c = n[o];
|
|
68
|
+
if (!s && (c === "'" || c === '"')) {
|
|
69
|
+
s = !0, e = c, t += c, o++;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (s)
|
|
73
|
+
if (c === e)
|
|
74
|
+
if (o + 1 < n.length && n[o + 1] === e) {
|
|
75
|
+
t += e + e, o += 2;
|
|
76
|
+
continue;
|
|
77
|
+
} else {
|
|
78
|
+
s = !1, t += c, o++;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
t += c, o++;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
n.substring(o, o + a) === r ? (t += i, o += a) : (t += c, o++);
|
|
86
|
+
}
|
|
87
|
+
return t;
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
x as convertDatePatternToMask
|
|
91
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/date/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type TokenMap = {
|
|
2
|
+
[token: string]: string | string[];
|
|
3
|
+
};
|
|
4
|
+
export declare const staticTokensMap: TokenMap;
|
|
5
|
+
export declare const dynamicTokensMap: TokenMap;
|
|
6
|
+
/**
|
|
7
|
+
* Tokenizes a given format string by matching against both variable and fixed token patterns.
|
|
8
|
+
*
|
|
9
|
+
* This function dynamically constructs a regular expression that first targets variable tokens
|
|
10
|
+
* (allowing for 1 to 4 greedy occurrences) and then fixed tokens (sorted in descending order of length).
|
|
11
|
+
* It escapes any special regex characters in both token maps to ensure that they are correctly interpreted
|
|
12
|
+
* as literal strings in the resulting Regex.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* The generated regular expression is used to match and extract tokens from the provided format string.
|
|
16
|
+
* If any tokens are found based on the specified patterns from `variableTokensMap` and `tokensMap`, an array
|
|
17
|
+
* of tokens is returned; otherwise, `null` is returned.
|
|
18
|
+
*
|
|
19
|
+
* @param format - The string containing the format to be tokenized.
|
|
20
|
+
* @returns An array of matched tokens if present, or `null` if no tokens match.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const tokens = tokenizeFormat("YYYY-MM-DD");
|
|
25
|
+
* console.log(tokens); // ['YYYY', 'MM', 'DD']
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see dynamicTokensMap
|
|
29
|
+
* @see staticTokensMap
|
|
30
|
+
*/
|
|
31
|
+
export declare function tokenizeFormat(format: string): RegExpMatchArray | null;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if a given format string represents a time-only format.
|
|
34
|
+
*
|
|
35
|
+
* @param format - The format string to check (e.g., 'HH:mm:ss', 'YYYY-MM-DD HH:mm').
|
|
36
|
+
* @returns `true` if the format is time-only, `false` if it includes date components.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isTimeOnlyFormat(format: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Checks whether the given token is not composed entirely of a single repeated character.
|
|
41
|
+
*
|
|
42
|
+
* A valid unit repetition (e.g., 'yyyy') consists of the same character repeated. This function
|
|
43
|
+
* returns false if the token consists solely of one repeating character, and true otherwise.
|
|
44
|
+
*
|
|
45
|
+
* @param token - The string token to evaluate.
|
|
46
|
+
* @returns False if the token is a unit repetition; true if it is not.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isUnitRepetition(token: string): boolean;
|
|
49
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/utils/date/tokens.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,CAAA;AA0I7D,eAAO,MAAM,eAAe,EAAE,QAG7B,CAAA;AAuBD,eAAO,MAAM,gBAAgB,EAAE,QAG9B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAuBtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOxD;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,WAG7C"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
const c = {
|
|
2
|
+
// Era
|
|
3
|
+
GGGGG: "A",
|
|
4
|
+
// A, B
|
|
5
|
+
GGGG: "S",
|
|
6
|
+
// Anno Domini, Before Christ
|
|
7
|
+
GGG: "AA",
|
|
8
|
+
// AD, BC
|
|
9
|
+
GG: "AA",
|
|
10
|
+
// AD, BC
|
|
11
|
+
G: "AA",
|
|
12
|
+
// AD, BC
|
|
13
|
+
// Calendar year (y)
|
|
14
|
+
yy: "##",
|
|
15
|
+
// 44, 01, 00, 17
|
|
16
|
+
y: "N",
|
|
17
|
+
// 44, 1, 1900, 2017, 9999
|
|
18
|
+
// Local week-numbering year (Y)
|
|
19
|
+
YY: "##",
|
|
20
|
+
// 44, 01, 00, 17
|
|
21
|
+
Y: "N",
|
|
22
|
+
// 44, 1, 1900, 2017, 9999
|
|
23
|
+
// Quarter (formatting) – Q tokens
|
|
24
|
+
QQQQQ: "#",
|
|
25
|
+
// 1, 2, 3, 4
|
|
26
|
+
QQQQ: "#aa W",
|
|
27
|
+
// 1st quarter, 2nd quarter, ...
|
|
28
|
+
QQQ: "Q#",
|
|
29
|
+
// Q1, Q2, Q3, Q4
|
|
30
|
+
QQ: "##",
|
|
31
|
+
// 01, 02, 03, 04
|
|
32
|
+
Q: "#",
|
|
33
|
+
// 1, 2, 3, 4
|
|
34
|
+
// Quarter (stand-alone) – q tokens
|
|
35
|
+
qqqqq: "#",
|
|
36
|
+
// 1, 2, 3, 4
|
|
37
|
+
qqqq: "#aa W",
|
|
38
|
+
// 1st quarter, 2nd quarter, ...
|
|
39
|
+
qqq: "Q#",
|
|
40
|
+
// Q1, Q2, Q3, Q4
|
|
41
|
+
qq: "##",
|
|
42
|
+
// 01, 02, 03, 04
|
|
43
|
+
q: "#",
|
|
44
|
+
// 1, 2, 3, 4
|
|
45
|
+
// Month (formatting) – M tokens
|
|
46
|
+
MMMMM: "A",
|
|
47
|
+
// J, F, ..., D
|
|
48
|
+
MMMM: "W",
|
|
49
|
+
// January, February, ..., December
|
|
50
|
+
MMM: "Aaa",
|
|
51
|
+
// Jan, Feb, ..., Dec
|
|
52
|
+
MM: "##",
|
|
53
|
+
// 01, 02, ..., 12
|
|
54
|
+
M: "#n",
|
|
55
|
+
// 1, 2, ..., 12
|
|
56
|
+
// Month (stand-alone) – L tokens
|
|
57
|
+
LLLLL: "A",
|
|
58
|
+
// J, F, ..., D
|
|
59
|
+
LLLL: "W",
|
|
60
|
+
// January, February, ..., December
|
|
61
|
+
LLL: "Aaa",
|
|
62
|
+
// Jan, Feb, ..., Dec
|
|
63
|
+
LL: "##",
|
|
64
|
+
// 01, 02, ..., 12
|
|
65
|
+
L: "#n",
|
|
66
|
+
// 1, 2, ..., 12
|
|
67
|
+
// Local week of year (w tokens)
|
|
68
|
+
ww: "##",
|
|
69
|
+
// 01, 02, ..., 53
|
|
70
|
+
w: "#n",
|
|
71
|
+
// 1, 2, ..., 53
|
|
72
|
+
// Day of month (d tokens)
|
|
73
|
+
dd: "##",
|
|
74
|
+
// 01, 02, ..., 31
|
|
75
|
+
d: "#n",
|
|
76
|
+
// 1, 2, ..., 31
|
|
77
|
+
// Day of week (formatting) using E tokens
|
|
78
|
+
EEEEEE: "Aa",
|
|
79
|
+
// Mo, Tu, We, Th, Fr, Sa, Su
|
|
80
|
+
EEEEE: "A",
|
|
81
|
+
// M, T, W, T, F, S, S
|
|
82
|
+
EEEE: "W",
|
|
83
|
+
// Monday, Tuesday, ..., Sunday
|
|
84
|
+
EEE: "Aaa",
|
|
85
|
+
// Mon, Tue, Wed, ..., Sun
|
|
86
|
+
EE: "Aaa",
|
|
87
|
+
// Mon, Tue, Wed, ..., Sun
|
|
88
|
+
E: "Aaa",
|
|
89
|
+
// Mon, Tue, Wed, ..., Sun
|
|
90
|
+
// Local day of week (formatting) using e tokens
|
|
91
|
+
eeeeee: "Aa",
|
|
92
|
+
// Mo, Tu, We, Th, Fr, Sa, Su
|
|
93
|
+
eeeee: "A",
|
|
94
|
+
// M, T, W, T, F, S, S
|
|
95
|
+
eeee: "W",
|
|
96
|
+
// Monday, Tuesday, ..., Sunday
|
|
97
|
+
eee: "Aaa",
|
|
98
|
+
// Mon, Tue, Wed, ..., Sun
|
|
99
|
+
ee: "##",
|
|
100
|
+
// 02, 03, ..., 01
|
|
101
|
+
e: "#",
|
|
102
|
+
// 2, 3, 4, ..., 1
|
|
103
|
+
// Local day of week (stand-alone) using c tokens
|
|
104
|
+
cccccc: "Aa",
|
|
105
|
+
// Mo, Tu, We, Th, Fr, Sa, Su
|
|
106
|
+
ccccc: "A",
|
|
107
|
+
// M, T, W, T, F, S, S
|
|
108
|
+
cccc: "W",
|
|
109
|
+
// Monday, Tuesday, ..., Sunday
|
|
110
|
+
ccc: "Aaa",
|
|
111
|
+
// Mon, Tue, Wed, ..., Sun
|
|
112
|
+
cc: "##",
|
|
113
|
+
// 02, 03, ..., 01
|
|
114
|
+
c: "#"
|
|
115
|
+
// 2, 3, 4, ..., 1
|
|
116
|
+
}, o = {
|
|
117
|
+
// AM, PM (a tokens)
|
|
118
|
+
aaaaa: "a",
|
|
119
|
+
// a, p
|
|
120
|
+
aaaa: "a.a.",
|
|
121
|
+
// a.m., p.m.
|
|
122
|
+
aaa: "AA",
|
|
123
|
+
// AM, PM
|
|
124
|
+
aa: "AA",
|
|
125
|
+
// AM, PM
|
|
126
|
+
a: "AA",
|
|
127
|
+
// AM, PM
|
|
128
|
+
// AM, PM, noon, midnight (b tokens)
|
|
129
|
+
bbbbb: "a",
|
|
130
|
+
// a, p
|
|
131
|
+
bbbb: "a.a.",
|
|
132
|
+
// a.m., p.m.
|
|
133
|
+
bbb: "AA",
|
|
134
|
+
// AM, PM
|
|
135
|
+
bb: "AA",
|
|
136
|
+
// AM, PM
|
|
137
|
+
b: "AA",
|
|
138
|
+
// AM, PM
|
|
139
|
+
// Flexible day period (B tokens)
|
|
140
|
+
B: "S",
|
|
141
|
+
// AM, PM, noon, midnight
|
|
142
|
+
// Hour [1-12] (h tokens)
|
|
143
|
+
hh: "##",
|
|
144
|
+
// 01, 02, ..., 11, 12
|
|
145
|
+
h: "#n",
|
|
146
|
+
// 1, 2, ..., 11, 12
|
|
147
|
+
// Hour [0-23] (H tokens)
|
|
148
|
+
HH: "##",
|
|
149
|
+
// 00, 01, 02, ..., 23
|
|
150
|
+
H: "#n",
|
|
151
|
+
// 0, 1, 2, ..., 23
|
|
152
|
+
// Hour [0-11] (K tokens)
|
|
153
|
+
KK: "##",
|
|
154
|
+
// 01, 02, ..., 11, 00
|
|
155
|
+
K: "#n",
|
|
156
|
+
// 1, 2, ..., 11, 0
|
|
157
|
+
// Hour [1-24] (k tokens)
|
|
158
|
+
kk: "##",
|
|
159
|
+
// 24, 01, 02, ..., 23
|
|
160
|
+
k: "#n",
|
|
161
|
+
// 24, 1, 2, ..., 23
|
|
162
|
+
// Minute (m tokens)
|
|
163
|
+
mm: "##",
|
|
164
|
+
// 00, 01, ..., 59
|
|
165
|
+
m: "#n",
|
|
166
|
+
// 0, 1, ..., 59
|
|
167
|
+
// Second (s tokens)
|
|
168
|
+
ss: "##",
|
|
169
|
+
// 00, 01, ..., 59
|
|
170
|
+
s: "#n",
|
|
171
|
+
// 0, 1, ..., 59,
|
|
172
|
+
// Timezone (ISO-8601 with Z) – X tokens
|
|
173
|
+
XXXXX: ["-##:##", "+##:##", "-##:##:##", "+##:##:##", "Z"],
|
|
174
|
+
// -08:00, +05:30, Z, +12:34:56
|
|
175
|
+
XXXX: ["-####", "+####", "-######", "+######", "Z"],
|
|
176
|
+
// -0800, +0530, Z, +123456
|
|
177
|
+
XXX: ["-##:##", "+##:##", "Z"],
|
|
178
|
+
// -08:00, +05:30, Z
|
|
179
|
+
XX: ["-####", "+####", "Z"],
|
|
180
|
+
// -0800, +0530, Z
|
|
181
|
+
X: ["-##", "+##", "-####", "+####", "Z"],
|
|
182
|
+
// -08, +0530, Z
|
|
183
|
+
// Timezone (ISO-8601 without Z) – x tokens
|
|
184
|
+
xxxxx: ["-##:##", "+##:##", "-##:##:##", "+##:##:##"],
|
|
185
|
+
// -08:00, +05:30, +00:00, +12:34:56
|
|
186
|
+
xxxx: ["-####", "+####", "-######", "+######"],
|
|
187
|
+
// -0800, +0530, +0000, +123456
|
|
188
|
+
xxx: ["-##:##", "+##:##"],
|
|
189
|
+
// -08:00, +05:30, +00:00
|
|
190
|
+
xx: ["-####", "+####"],
|
|
191
|
+
// -0800, +0530, +0000
|
|
192
|
+
x: ["-##", "+##", "-####", "+####"]
|
|
193
|
+
// -08, +0530, +00
|
|
194
|
+
}, d = {
|
|
195
|
+
...c,
|
|
196
|
+
...o
|
|
197
|
+
}, s = {
|
|
198
|
+
// Calendar year (y)
|
|
199
|
+
y: "#",
|
|
200
|
+
// 44, 1, 1900, 2017, 9999
|
|
201
|
+
// Local week-numbering year (Y)
|
|
202
|
+
Y: "#",
|
|
203
|
+
// 44, 1, 1900, 2017, 9000
|
|
204
|
+
// Extended year (u)
|
|
205
|
+
u: ["-#", "#"],
|
|
206
|
+
// -43, 1, 1900, 2017, 9999, -999
|
|
207
|
+
// Day of year (D tokens)
|
|
208
|
+
D: "#"
|
|
209
|
+
// 1, 2, ..., 365, 366
|
|
210
|
+
}, i = {
|
|
211
|
+
// Fraction of second (S tokens)
|
|
212
|
+
S: "#"
|
|
213
|
+
// 0, 1, ..., 9
|
|
214
|
+
}, x = {
|
|
215
|
+
...s,
|
|
216
|
+
...i
|
|
217
|
+
};
|
|
218
|
+
function b(e) {
|
|
219
|
+
const a = e.replace(/(['"]).*?\1/g, ""), r = Object.keys(x).map((n) => `${n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}{1,4}`).join("|"), E = Object.keys(d).sort((n, t) => t.length - n.length).map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), M = `(${r}|${E})`, m = new RegExp(M, "g");
|
|
220
|
+
return a.match(m);
|
|
221
|
+
}
|
|
222
|
+
function Q(e) {
|
|
223
|
+
const a = b(e);
|
|
224
|
+
if (!a)
|
|
225
|
+
throw Error("Failed to tokenize format string.");
|
|
226
|
+
return a.some(u) && !a.some(p);
|
|
227
|
+
}
|
|
228
|
+
function p(e) {
|
|
229
|
+
return c[e] !== void 0 || A(e) && s[e[0]] !== void 0;
|
|
230
|
+
}
|
|
231
|
+
function u(e) {
|
|
232
|
+
return o[e] !== void 0 || A(e) && i[e[0]] !== void 0;
|
|
233
|
+
}
|
|
234
|
+
function A(e) {
|
|
235
|
+
return /^(\w)\1*$/.test(e);
|
|
236
|
+
}
|
|
237
|
+
export {
|
|
238
|
+
x as dynamicTokensMap,
|
|
239
|
+
Q as isTimeOnlyFormat,
|
|
240
|
+
A as isUnitRepetition,
|
|
241
|
+
d as staticTokensMap,
|
|
242
|
+
b as tokenizeFormat
|
|
243
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/utils/download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAqB7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function r(o) {
|
|
2
|
+
const t = new FileReader();
|
|
3
|
+
t.onload = () => {
|
|
4
|
+
const a = o.type || "application/octet-stream", d = new Blob([t.result], { type: a }), e = Object.assign(document.createElement("a"), {
|
|
5
|
+
href: URL.createObjectURL(d),
|
|
6
|
+
download: o.name || "download"
|
|
7
|
+
});
|
|
8
|
+
document.body.appendChild(e), e.click(), setTimeout(() => {
|
|
9
|
+
var n;
|
|
10
|
+
URL.revokeObjectURL(e.href), (n = e.parentNode) == null || n.removeChild(e);
|
|
11
|
+
}, 100);
|
|
12
|
+
}, t.readAsArrayBuffer(o);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
r as downloadFile
|
|
16
|
+
};
|