@dotss/tictoccroc 0.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.
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +54 -0
- package/dist/shared/components/Calendar/Calendar.d.ts +10 -0
- package/dist/shared/components/Calendar/Calendar.mjs +80 -0
- package/dist/shared/components/Calendar/index.d.ts +2 -0
- package/dist/shared/components/Calendar/index.mjs +4 -0
- package/dist/shared/components/Carousel/Carousel.d.ts +16 -0
- package/dist/shared/components/Carousel/Carousel.mjs +205 -0
- package/dist/shared/components/Carousel/CarouselSlide/CarouselSlide.d.ts +4 -0
- package/dist/shared/components/Carousel/CarouselSlide/CarouselSlide.mjs +8 -0
- package/dist/shared/components/Carousel/CarouselSlide/index.d.ts +3 -0
- package/dist/shared/components/Carousel/CarouselSlide/index.mjs +4 -0
- package/dist/shared/components/Carousel/index.d.ts +4 -0
- package/dist/shared/components/Carousel/index.mjs +6 -0
- package/dist/shared/components/Image/Image.d.ts +20 -0
- package/dist/shared/components/Image/Image.mjs +181 -0
- package/dist/shared/components/Image/index.d.ts +3 -0
- package/dist/shared/components/Image/index.mjs +4 -0
- package/dist/shared/components/ImageZoomDialog/ImageBlock/ImageBlock.d.ts +8 -0
- package/dist/shared/components/ImageZoomDialog/ImageBlock/ImageBlock.mjs +50 -0
- package/dist/shared/components/ImageZoomDialog/ImageBlock/index.d.ts +2 -0
- package/dist/shared/components/ImageZoomDialog/ImageBlock/index.mjs +4 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialog.d.ts +16 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialog.mjs +344 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/ImageZoomDialogContent.d.ts +3 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/ImageZoomDialogContent.mjs +23 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/index.d.ts +2 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogContent/index.mjs +4 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/ImageZoomDialogFooter.d.ts +3 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/ImageZoomDialogFooter.mjs +28 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/index.d.ts +2 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogFooter/index.mjs +4 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/ImageZoomDialogToolbar.d.ts +3 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/ImageZoomDialogToolbar.mjs +22 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/index.d.ts +2 -0
- package/dist/shared/components/ImageZoomDialog/ImageZoomDialogToolbar/index.mjs +4 -0
- package/dist/shared/components/ImageZoomDialog/index.d.ts +6 -0
- package/dist/shared/components/ImageZoomDialog/index.mjs +10 -0
- package/dist/shared/components/Roller/Roller.d.ts +9 -0
- package/dist/shared/components/Roller/Roller.mjs +122 -0
- package/dist/shared/components/Roller/RollerBlock/RollerBlock.d.ts +4 -0
- package/dist/shared/components/Roller/RollerBlock/RollerBlock.mjs +8 -0
- package/dist/shared/components/Roller/RollerBlock/index.d.ts +3 -0
- package/dist/shared/components/Roller/RollerBlock/index.mjs +4 -0
- package/dist/shared/components/Roller/index.d.ts +4 -0
- package/dist/shared/components/Roller/index.mjs +6 -0
- package/dist/shared/components/Scheduler/ScheduleBlock/ScheduleBlock.d.ts +7 -0
- package/dist/shared/components/Scheduler/ScheduleBlock/ScheduleBlock.mjs +31 -0
- package/dist/shared/components/Scheduler/ScheduleBlock/index.d.ts +3 -0
- package/dist/shared/components/Scheduler/ScheduleBlock/index.mjs +4 -0
- package/dist/shared/components/Scheduler/ScheduleEvent/ScheduleEvent.d.ts +9 -0
- package/dist/shared/components/Scheduler/ScheduleEvent/ScheduleEvent.mjs +36 -0
- package/dist/shared/components/Scheduler/ScheduleEvent/index.d.ts +3 -0
- package/dist/shared/components/Scheduler/ScheduleEvent/index.mjs +4 -0
- package/dist/shared/components/Scheduler/Scheduler.d.ts +15 -0
- package/dist/shared/components/Scheduler/Scheduler.mjs +552 -0
- package/dist/shared/components/Scheduler/Scheduler.utils.d.ts +32 -0
- package/dist/shared/components/Scheduler/Scheduler.utils.mjs +92 -0
- package/dist/shared/components/Scheduler/index.d.ts +6 -0
- package/dist/shared/components/Scheduler/index.mjs +10 -0
- package/dist/shared/components/Swiper/Swiper.d.ts +25 -0
- package/dist/shared/components/Swiper/Swiper.mjs +274 -0
- package/dist/shared/components/Swiper/Swiper.utils.d.ts +13 -0
- package/dist/shared/components/Swiper/Swiper.utils.mjs +25 -0
- package/dist/shared/components/Swiper/SwiperBlock/SwiperBlock.d.ts +4 -0
- package/dist/shared/components/Swiper/SwiperBlock/SwiperBlock.mjs +19 -0
- package/dist/shared/components/Swiper/SwiperBlock/index.d.ts +3 -0
- package/dist/shared/components/Swiper/SwiperBlock/index.mjs +4 -0
- package/dist/shared/components/Swiper/index.d.ts +4 -0
- package/dist/shared/components/Swiper/index.mjs +6 -0
- package/dist/shared/components/TimePicker/TimePicker.d.ts +23 -0
- package/dist/shared/components/TimePicker/TimePicker.mjs +122 -0
- package/dist/shared/components/TimePicker/index.d.ts +3 -0
- package/dist/shared/components/TimePicker/index.mjs +4 -0
- package/dist/shared/components/index.d.ts +7 -0
- package/dist/shared/components/index.mjs +30 -0
- package/dist/shared/hooks/index.d.ts +1 -0
- package/dist/shared/hooks/index.mjs +4 -0
- package/dist/shared/hooks/useIsomorphicLayoutEffect/index.d.ts +2 -0
- package/dist/shared/hooks/useIsomorphicLayoutEffect/index.mjs +4 -0
- package/dist/shared/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/shared/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +6 -0
- package/dist/shared/utils/birthDateToAge/birthDateToAge.d.ts +1 -0
- package/dist/shared/utils/birthDateToAge/birthDateToAge.mjs +11 -0
- package/dist/shared/utils/birthDateToAge/birthDateToAge.test.d.ts +1 -0
- package/dist/shared/utils/birthDateToAge/birthDateToAge.test.mjs +12 -0
- package/dist/shared/utils/birthDateToAge/index.d.ts +2 -0
- package/dist/shared/utils/birthDateToAge/index.mjs +4 -0
- package/dist/shared/utils/getDateRange/getDateRange.d.ts +11 -0
- package/dist/shared/utils/getDateRange/getDateRange.mjs +21 -0
- package/dist/shared/utils/getDateRange/getDateRange.test.d.ts +1 -0
- package/dist/shared/utils/getDateRange/getDateRange.test.mjs +61 -0
- package/dist/shared/utils/getDateRange/index.d.ts +2 -0
- package/dist/shared/utils/getDateRange/index.mjs +4 -0
- package/dist/shared/utils/getImageUrl/getImageUrl.d.ts +3 -0
- package/dist/shared/utils/getImageUrl/getImageUrl.mjs +17 -0
- package/dist/shared/utils/getImageUrl/getImageUrl.test.d.ts +1 -0
- package/dist/shared/utils/getImageUrl/getImageUrl.test.mjs +28 -0
- package/dist/shared/utils/getImageUrl/index.d.ts +3 -0
- package/dist/shared/utils/getImageUrl/index.mjs +6 -0
- package/dist/shared/utils/getTimeRange/getTimeRange.d.ts +12 -0
- package/dist/shared/utils/getTimeRange/getTimeRange.mjs +22 -0
- package/dist/shared/utils/getTimeRange/getTimeRange.test.d.ts +1 -0
- package/dist/shared/utils/getTimeRange/getTimeRange.test.mjs +76 -0
- package/dist/shared/utils/getTimeRange/index.d.ts +2 -0
- package/dist/shared/utils/getTimeRange/index.mjs +4 -0
- package/dist/shared/utils/getVimeoId/getVimeoId.d.ts +1 -0
- package/dist/shared/utils/getVimeoId/getVimeoId.mjs +12 -0
- package/dist/shared/utils/getVimeoId/getVimeoId.test.d.ts +1 -0
- package/dist/shared/utils/getVimeoId/getVimeoId.test.mjs +15 -0
- package/dist/shared/utils/getVimeoId/index.d.ts +2 -0
- package/dist/shared/utils/getVimeoId/index.mjs +4 -0
- package/dist/shared/utils/index.d.ts +11 -0
- package/dist/shared/utils/index.mjs +24 -0
- package/dist/shared/utils/isAndroid/index.d.ts +2 -0
- package/dist/shared/utils/isAndroid/index.mjs +4 -0
- package/dist/shared/utils/isAndroid/isAndroid.d.ts +1 -0
- package/dist/shared/utils/isAndroid/isAndroid.mjs +6 -0
- package/dist/shared/utils/isAndroid/isAndroid.test.d.ts +1 -0
- package/dist/shared/utils/isAndroid/isAndroid.test.mjs +13 -0
- package/dist/shared/utils/isApp/index.d.ts +2 -0
- package/dist/shared/utils/isApp/index.mjs +4 -0
- package/dist/shared/utils/isApp/isApp.d.ts +1 -0
- package/dist/shared/utils/isApp/isApp.mjs +6 -0
- package/dist/shared/utils/isApp/isApp.test.d.ts +1 -0
- package/dist/shared/utils/isApp/isApp.test.mjs +23 -0
- package/dist/shared/utils/isDesktop/index.d.ts +2 -0
- package/dist/shared/utils/isDesktop/index.mjs +4 -0
- package/dist/shared/utils/isDesktop/isDesktop.d.ts +1 -0
- package/dist/shared/utils/isDesktop/isDesktop.mjs +16 -0
- package/dist/shared/utils/isDesktop/isDesktop.test.d.ts +1 -0
- package/dist/shared/utils/isDesktop/isDesktop.test.mjs +11 -0
- package/dist/shared/utils/isServer/index.d.ts +2 -0
- package/dist/shared/utils/isServer/index.mjs +4 -0
- package/dist/shared/utils/isServer/isServer.d.ts +1 -0
- package/dist/shared/utils/isServer/isServer.mjs +6 -0
- package/dist/shared/utils/isServer/isServer.test.d.ts +1 -0
- package/dist/shared/utils/isServer/isServer.test.mjs +13 -0
- package/dist/shared/utils/objectToQueryString/index.d.ts +2 -0
- package/dist/shared/utils/objectToQueryString/index.mjs +4 -0
- package/dist/shared/utils/objectToQueryString/objectToQueryString.d.ts +1 -0
- package/dist/shared/utils/objectToQueryString/objectToQueryString.mjs +9 -0
- package/dist/shared/utils/objectToQueryString/objectToQueryString.test.d.ts +1 -0
- package/dist/shared/utils/objectToQueryString/objectToQueryString.test.mjs +11 -0
- package/dist/shared/utils/parseQueryString/index.d.ts +2 -0
- package/dist/shared/utils/parseQueryString/index.mjs +4 -0
- package/dist/shared/utils/parseQueryString/parseQueryString.d.ts +4 -0
- package/dist/shared/utils/parseQueryString/parseQueryString.mjs +6 -0
- package/dist/shared/utils/parseQueryString/parseQueryString.test.d.ts +1 -0
- package/dist/shared/utils/parseQueryString/parseQueryString.test.mjs +16 -0
- package/dist/teacher/profile/components/ProfileSummary/ProfileSummary.d.ts +2 -0
- package/dist/teacher/profile/components/ProfileSummary/ProfileSummary.mjs +8 -0
- package/dist/teacher/profile/components/ProfileSummary/index.d.ts +2 -0
- package/dist/teacher/profile/components/ProfileSummary/index.mjs +4 -0
- package/package.json +100 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { DateValue } from 'node_modules/@thedotscorp/ui/DatePicker/DatePicker';
|
|
3
|
+
interface DateRangeOptions {
|
|
4
|
+
format?: 'YYYY-MM-DD' | 'YYYY-MM-DD HH:mm' | 'YYYY-MM-DD HH:mm:ss' | 'YYYY-MM';
|
|
5
|
+
}
|
|
6
|
+
interface DateRange {
|
|
7
|
+
label: string;
|
|
8
|
+
value: Date;
|
|
9
|
+
}
|
|
10
|
+
export default function getDateRange(startDate: string | Date | Dayjs | DateValue, endDate: string | Date | Dayjs | DateValue, options?: DateRangeOptions): DateRange[];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import a from "dayjs";
|
|
2
|
+
import d from "dayjs/plugin/isSameOrBefore";
|
|
3
|
+
a.extend(d);
|
|
4
|
+
function u(i, n, f = {}) {
|
|
5
|
+
const { format: o = "YYYY-MM-DD" } = f, t = a(i), r = a(n);
|
|
6
|
+
if (!t.isValid() || !r.isValid())
|
|
7
|
+
return [];
|
|
8
|
+
if (t.isAfter(r))
|
|
9
|
+
return [];
|
|
10
|
+
const s = [];
|
|
11
|
+
let e = t;
|
|
12
|
+
for (; e.isSameOrBefore(r); )
|
|
13
|
+
s.push({
|
|
14
|
+
label: e.format(o),
|
|
15
|
+
value: e.toDate()
|
|
16
|
+
}), o === "YYYY-MM" ? e = e.add(1, "month") : e = e.add(1, "day");
|
|
17
|
+
return s;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
u as default
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import t from "dayjs";
|
|
2
|
+
import { describe as s, test as o, expect as e } from "vitest";
|
|
3
|
+
import l from "./getDateRange.mjs";
|
|
4
|
+
s("getDateRange", () => {
|
|
5
|
+
o("시작 날짜와 종료 날짜 사이의 날짜를 배열로 반환한다.", () => {
|
|
6
|
+
const a = l("2024-03-01", "2024-03-03");
|
|
7
|
+
e(a).toEqual([
|
|
8
|
+
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
9
|
+
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
10
|
+
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
11
|
+
]);
|
|
12
|
+
}), o("시작 날짜가 종료 날짜보다 크면 빈 배열을 반환한다.", () => {
|
|
13
|
+
e(l("2024-03-03", "2024-03-01")).toEqual([]);
|
|
14
|
+
}), o("유효하지 않은 날짜가 포함되면 빈 배열을 반환한다.", () => {
|
|
15
|
+
e(l("invalid", "2024-03-03")).toEqual([]), e(l("2024-03-01", "invalid")).toEqual([]);
|
|
16
|
+
}), o("YYYY-MM 형식으로 월 단위의 날짜를 반환한다.", () => {
|
|
17
|
+
const a = l("2024-01-01", "2024-03-01", { format: "YYYY-MM" });
|
|
18
|
+
e(a).toEqual([
|
|
19
|
+
{ label: "2024-01", value: t("2024-01-01").toDate() },
|
|
20
|
+
{ label: "2024-02", value: t("2024-02-01").toDate() },
|
|
21
|
+
{ label: "2024-03", value: t("2024-03-01").toDate() }
|
|
22
|
+
]);
|
|
23
|
+
}), o("YYYY-MM-DD HH:mm 형식으로 날짜를 반환한다.", () => {
|
|
24
|
+
const a = l("2024-03-01 09:00", "2024-03-02 09:00", {
|
|
25
|
+
format: "YYYY-MM-DD HH:mm"
|
|
26
|
+
});
|
|
27
|
+
e(a).toEqual([
|
|
28
|
+
{ label: "2024-03-01 09:00", value: t("2024-03-01 09:00").toDate() },
|
|
29
|
+
{ label: "2024-03-02 09:00", value: t("2024-03-02 09:00").toDate() }
|
|
30
|
+
]);
|
|
31
|
+
}), o("YYYY-MM-DD HH:mm:ss 형식으로 날짜를 반환한다.", () => {
|
|
32
|
+
const a = l("2024-03-01 09:00:00", "2024-03-02 09:00:00", {
|
|
33
|
+
format: "YYYY-MM-DD HH:mm:ss"
|
|
34
|
+
});
|
|
35
|
+
e(a).toEqual([
|
|
36
|
+
{ label: "2024-03-01 09:00:00", value: t("2024-03-01 09:00:00").toDate() },
|
|
37
|
+
{ label: "2024-03-02 09:00:00", value: t("2024-03-02 09:00:00").toDate() }
|
|
38
|
+
]);
|
|
39
|
+
}), o("Date 객체를 입력으로 받을 수 있다.", () => {
|
|
40
|
+
const a = t("2024-03-01").toDate(), u = t("2024-03-03").toDate(), D = l(a, u);
|
|
41
|
+
e(D).toEqual([
|
|
42
|
+
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
43
|
+
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
44
|
+
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
45
|
+
]);
|
|
46
|
+
}), o("Dayjs 객체를 입력으로 받을 수 있다.", () => {
|
|
47
|
+
const a = t("2024-03-01"), u = t("2024-03-03"), D = l(a, u);
|
|
48
|
+
e(D).toEqual([
|
|
49
|
+
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
50
|
+
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
51
|
+
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
52
|
+
]);
|
|
53
|
+
}), o("Dayjs 객체와 Date 객체를 혼합해서 입력으로 받을 수 있다.", () => {
|
|
54
|
+
const a = t("2024-03-01"), u = t("2024-03-03").toDate(), D = l(a, u);
|
|
55
|
+
e(D).toEqual([
|
|
56
|
+
{ label: "2024-03-01", value: t("2024-03-01").toDate() },
|
|
57
|
+
{ label: "2024-03-02", value: t("2024-03-02").toDate() },
|
|
58
|
+
{ label: "2024-03-03", value: t("2024-03-03").toDate() }
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ImageProps } from '../../components/Image';
|
|
2
|
+
export declare const LAMBDA_VERSION = 1;
|
|
3
|
+
export default function getImageUrl({ src, width, height, fit, position, scale, disabledResizing }: Pick<ImageProps, 'src' | 'width' | 'height' | 'fit' | 'position' | 'scale' | 'disabledResizing'>): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const c = 1;
|
|
2
|
+
function s({
|
|
3
|
+
src: o,
|
|
4
|
+
width: t,
|
|
5
|
+
height: f,
|
|
6
|
+
fit: r = "cover",
|
|
7
|
+
position: n = "center",
|
|
8
|
+
scale: i = 2,
|
|
9
|
+
disabledResizing: $ = !1
|
|
10
|
+
}) {
|
|
11
|
+
let e = `${o}?v=1`;
|
|
12
|
+
return $ || (e += `&fit=${r}&position=${n}`, t && (e += `&width=${t * i}`), f && (e += `&height=${f * i}`)), e;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
c as LAMBDA_VERSION,
|
|
16
|
+
s as default
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe as g, test as h, expect as i } from "vitest";
|
|
2
|
+
import e, { LAMBDA_VERSION as o } from "./getImageUrl.mjs";
|
|
3
|
+
g("getImageUrl", () => {
|
|
4
|
+
const t = "https://example.com/image.jpg";
|
|
5
|
+
h("기본 옵션으로 URL을 생성한다.", () => {
|
|
6
|
+
i(e({ src: t, width: 100, height: 200 })).toBe(
|
|
7
|
+
`${t}?v=${o}&fit=cover&position=center&width=200&height=400`
|
|
8
|
+
);
|
|
9
|
+
}), h("disabledResizing이 true일 경우 리사이징 파라미터를 추가하지 않는다.", () => {
|
|
10
|
+
i(e({ src: t, width: 100, height: 200, disabledResizing: !0 })).toBe(
|
|
11
|
+
`${t}?v=${o}`
|
|
12
|
+
);
|
|
13
|
+
}), h("fit과 position 옵션을 변경하여 URL을 생성한다.", () => {
|
|
14
|
+
i(e({ src: t, width: 100, height: 200, fit: "contain", position: "top" })).toBe(
|
|
15
|
+
`${t}?v=${o}&fit=contain&position=top&width=200&height=400`
|
|
16
|
+
);
|
|
17
|
+
}), h("scale을 1로 설정하면 원본 크기로 설정된다.", () => {
|
|
18
|
+
i(e({ src: t, width: 100, height: 200, scale: 1 })).toBe(
|
|
19
|
+
`${t}?v=${o}&fit=cover&position=center&width=100&height=200`
|
|
20
|
+
);
|
|
21
|
+
}), h("width 또는 height가 제공되지 않을 경우 해당 파라미터를 추가하지 않는다.", () => {
|
|
22
|
+
i(e({ src: t, width: 100 })).toBe(
|
|
23
|
+
`${t}?v=${o}&fit=cover&position=center&width=200`
|
|
24
|
+
), i(e({ src: t, height: 200 })).toBe(
|
|
25
|
+
`${t}?v=${o}&fit=cover&position=center&height=400`
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface TimeRangeOptions {
|
|
2
|
+
step?: number;
|
|
3
|
+
minTime?: number;
|
|
4
|
+
maxTime?: number;
|
|
5
|
+
pairs?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface TimeRange {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
export default function getTimeRange(startTime: number, endTime: number, options?: TimeRangeOptions): TimeRange[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import c from "dayjs";
|
|
2
|
+
function p(r, u, l = {}) {
|
|
3
|
+
const { step: n = 0.5, minTime: s, maxTime: a, pairs: m = !1 } = l;
|
|
4
|
+
if (r >= u || r < 0 || u < 0 || n <= 0)
|
|
5
|
+
return [];
|
|
6
|
+
const e = [];
|
|
7
|
+
let t = r;
|
|
8
|
+
for (; t <= u; ) {
|
|
9
|
+
if ((s === void 0 || t >= s) && (a === void 0 || t <= a)) {
|
|
10
|
+
const o = Math.floor(t), i = Math.round((t - o) * 60), f = c().hour(o).minute(i);
|
|
11
|
+
e.push({
|
|
12
|
+
label: f.format("HH:mm"),
|
|
13
|
+
value: Number(t.toFixed(1))
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
t = Number((t + n).toFixed(1));
|
|
17
|
+
}
|
|
18
|
+
return m ? e.slice(0, -1).flatMap((o, i) => [o, e[i + 1]]) : e;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
p as default
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { describe as t, test as u, expect as l } from "vitest";
|
|
2
|
+
import e from "./getTimeRange.mjs";
|
|
3
|
+
t("getTimeRange", () => {
|
|
4
|
+
u("시작 시간과 종료 시간 사이의 시간을 배열로 반환한다.", () => {
|
|
5
|
+
const a = e(5.5, 10.5);
|
|
6
|
+
l(a).toEqual([
|
|
7
|
+
{ label: "05:30", value: 5.5 },
|
|
8
|
+
{ label: "06:00", value: 6 },
|
|
9
|
+
{ label: "06:30", value: 6.5 },
|
|
10
|
+
{ label: "07:00", value: 7 },
|
|
11
|
+
{ label: "07:30", value: 7.5 },
|
|
12
|
+
{ label: "08:00", value: 8 },
|
|
13
|
+
{ label: "08:30", value: 8.5 },
|
|
14
|
+
{ label: "09:00", value: 9 },
|
|
15
|
+
{ label: "09:30", value: 9.5 },
|
|
16
|
+
{ label: "10:00", value: 10 },
|
|
17
|
+
{ label: "10:30", value: 10.5 }
|
|
18
|
+
]);
|
|
19
|
+
}), u("시작 시간이 종료 시간보다 크면 빈 배열을 반환한다.", () => {
|
|
20
|
+
l(e(10.5, 5.5)).toEqual([]);
|
|
21
|
+
}), u("음수 시간이 포함되면 빈 배열을 반환한다.", () => {
|
|
22
|
+
l(e(-1, 5.5)).toEqual([]), l(e(5.5, -1)).toEqual([]);
|
|
23
|
+
}), u("step이 0 이하면 빈 배열을 반환한다.", () => {
|
|
24
|
+
l(e(5.5, 10.5, { step: 0 })).toEqual([]), l(e(5.5, 10.5, { step: -0.5 })).toEqual([]);
|
|
25
|
+
}), u("minTime과 maxTime을 적용할 수 있다.", () => {
|
|
26
|
+
const a = e(5.5, 10.5, {
|
|
27
|
+
minTime: 6,
|
|
28
|
+
maxTime: 9.5
|
|
29
|
+
});
|
|
30
|
+
l(a).toEqual([
|
|
31
|
+
{ label: "06:00", value: 6 },
|
|
32
|
+
{ label: "06:30", value: 6.5 },
|
|
33
|
+
{ label: "07:00", value: 7 },
|
|
34
|
+
{ label: "07:30", value: 7.5 },
|
|
35
|
+
{ label: "08:00", value: 8 },
|
|
36
|
+
{ label: "08:30", value: 8.5 },
|
|
37
|
+
{ label: "09:00", value: 9 },
|
|
38
|
+
{ label: "09:30", value: 9.5 }
|
|
39
|
+
]);
|
|
40
|
+
}), u("step을 조정할 수 있다.", () => {
|
|
41
|
+
const a = e(5.5, 7.5, { step: 1 });
|
|
42
|
+
l(a).toEqual([
|
|
43
|
+
{ label: "05:30", value: 5.5 },
|
|
44
|
+
{ label: "06:30", value: 6.5 },
|
|
45
|
+
{ label: "07:30", value: 7.5 }
|
|
46
|
+
]);
|
|
47
|
+
}), u("pairs 옵션을 사용하면 연속된 시간 쌍을 반환한다.", () => {
|
|
48
|
+
const a = e(8.5, 9.5, { pairs: !0 });
|
|
49
|
+
l(a).toEqual([
|
|
50
|
+
{ label: "08:30", value: 8.5 },
|
|
51
|
+
// 첫 번째 쌍의 시작 시간
|
|
52
|
+
{ label: "09:00", value: 9 },
|
|
53
|
+
// 첫 번째 쌍의 종료 시간
|
|
54
|
+
{ label: "09:00", value: 9 },
|
|
55
|
+
// 두 번째 쌍의 시작 시간
|
|
56
|
+
{ label: "09:30", value: 9.5 }
|
|
57
|
+
// 두 번째 쌍의 종료 시간
|
|
58
|
+
]);
|
|
59
|
+
}), u("pairs 옵션과 다른 옵션을 함께 사용할 수 있다.", () => {
|
|
60
|
+
const a = e(8.5, 10.5, {
|
|
61
|
+
pairs: !0,
|
|
62
|
+
minTime: 9,
|
|
63
|
+
maxTime: 10
|
|
64
|
+
});
|
|
65
|
+
l(a).toEqual([
|
|
66
|
+
{ label: "09:00", value: 9 },
|
|
67
|
+
// 첫 번째 쌍의 시작 시간
|
|
68
|
+
{ label: "09:30", value: 9.5 },
|
|
69
|
+
// 첫 번째 쌍의 종료 시간
|
|
70
|
+
{ label: "09:30", value: 9.5 },
|
|
71
|
+
// 두 번째 쌍의 시작 시간
|
|
72
|
+
{ label: "10:00", value: 10 }
|
|
73
|
+
// 두 번째 쌍의 종료 시간
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getVimeoId(url: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe as c, expect as o } from "vitest";
|
|
2
|
+
import e from "./getVimeoId.mjs";
|
|
3
|
+
c("getVimeoId", (t) => {
|
|
4
|
+
t("유효한 Vimeo URL에서 ID를 추출한다.", () => {
|
|
5
|
+
o(e("https://vimeo.com/123456789")).toBe(123456789);
|
|
6
|
+
}), t("URL이 비어있으면 0을 반환한다.", () => {
|
|
7
|
+
o(e("")).toBe(0);
|
|
8
|
+
}), t("Vimeo URL이 아니면 0을 반환한다.", () => {
|
|
9
|
+
o(e("https://youtube.com/watch?v=abcdef")).toBe(0);
|
|
10
|
+
}), t("ID가 포함되지 않은 Vimeo URL이면 0을 반환한다.", () => {
|
|
11
|
+
o(e("https://vimeo.com/")).toBe(0);
|
|
12
|
+
}), t("올바르지 않은 URL 형식이면 0을 반환한다.", () => {
|
|
13
|
+
o(e("")).toBe(0), o(e(void 0)).toBe(0), o(e("parent.tictoccroc.com")).toBe(0), o(e("parent.tictoccroc.com///")).toBe(0), o(e("tictocisland")).toBe(0);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as getImageUrl } from './getImageUrl';
|
|
2
|
+
export { default as isServer } from './isServer';
|
|
3
|
+
export { default as getTimeRange } from './getTimeRange';
|
|
4
|
+
export { default as getDateRange } from './getDateRange';
|
|
5
|
+
export { default as isAndroid } from './isAndroid';
|
|
6
|
+
export { default as isApp } from './isApp';
|
|
7
|
+
export { default as isDesktop } from './isDesktop';
|
|
8
|
+
export { default as birthDateToAge } from './birthDateToAge';
|
|
9
|
+
export { default as objectToQueryString } from './objectToQueryString';
|
|
10
|
+
export { default as getVimeoId } from './getVimeoId';
|
|
11
|
+
export { default as parseQueryString } from './parseQueryString';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as r } from "./getImageUrl/getImageUrl.mjs";
|
|
2
|
+
import { default as o } from "./isServer/isServer.mjs";
|
|
3
|
+
import { default as s } from "./getTimeRange/getTimeRange.mjs";
|
|
4
|
+
import { default as d } from "./getDateRange/getDateRange.mjs";
|
|
5
|
+
import { default as u } from "./isAndroid/isAndroid.mjs";
|
|
6
|
+
import { default as x } from "./isApp/isApp.mjs";
|
|
7
|
+
import { default as i } from "./isDesktop/isDesktop.mjs";
|
|
8
|
+
import { default as A } from "./birthDateToAge/birthDateToAge.mjs";
|
|
9
|
+
import { default as S } from "./objectToQueryString/objectToQueryString.mjs";
|
|
10
|
+
import { default as b } from "./getVimeoId/getVimeoId.mjs";
|
|
11
|
+
import { default as I } from "./parseQueryString/parseQueryString.mjs";
|
|
12
|
+
export {
|
|
13
|
+
A as birthDateToAge,
|
|
14
|
+
d as getDateRange,
|
|
15
|
+
r as getImageUrl,
|
|
16
|
+
s as getTimeRange,
|
|
17
|
+
b as getVimeoId,
|
|
18
|
+
u as isAndroid,
|
|
19
|
+
x as isApp,
|
|
20
|
+
i as isDesktop,
|
|
21
|
+
o as isServer,
|
|
22
|
+
S as objectToQueryString,
|
|
23
|
+
I as parseQueryString
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isAndroid(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe as t, afterEach as l, vi as e, test as i, expect as o } from "vitest";
|
|
2
|
+
import r from "./isAndroid.mjs";
|
|
3
|
+
t("isAndroid", () => {
|
|
4
|
+
l(() => {
|
|
5
|
+
e.restoreAllMocks();
|
|
6
|
+
}), i("Android userAgent일 때 true를 반환한다.", () => {
|
|
7
|
+
e.stubGlobal("navigator", { userAgent: "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36" }), o(r()).toBe(!0);
|
|
8
|
+
}), i("Android가 아닌 userAgent일 때 false를 반환한다.", () => {
|
|
9
|
+
e.stubGlobal("navigator", {
|
|
10
|
+
userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/537.36"
|
|
11
|
+
}), o(r()).toBe(!1);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isApp(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { describe as a, beforeEach as r, vi as e, afterEach as i, test as o, expect as t } from "vitest";
|
|
2
|
+
import l from "./isApp.mjs";
|
|
3
|
+
a("isApp", () => {
|
|
4
|
+
r(() => {
|
|
5
|
+
e.stubGlobal("document", {}), e.stubGlobal("window", {});
|
|
6
|
+
}), i(() => {
|
|
7
|
+
e.restoreAllMocks();
|
|
8
|
+
}), o("웹 환경에서는 false를 반환한다.", () => {
|
|
9
|
+
t(l()).toBe(!1);
|
|
10
|
+
}), o("앱 환경에서는 true를 반환한다.", () => {
|
|
11
|
+
Object.defineProperty(window, "flutter_inappwebview", {
|
|
12
|
+
value: {
|
|
13
|
+
callHandler: () => {
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
configurable: !0
|
|
17
|
+
}), t(l()).toBe(!0);
|
|
18
|
+
}), o("document가 존재하지 않으면 false를 반환한다.", () => {
|
|
19
|
+
e.stubGlobal("document", void 0), t(l()).toBe(!1);
|
|
20
|
+
}), o("window가 존재하지 않으면 false를 반환한다.", () => {
|
|
21
|
+
e.stubGlobal("window", void 0), t(l()).toBe(!1);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isDesktop(): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function n() {
|
|
2
|
+
const e = navigator.userAgent.toLowerCase();
|
|
3
|
+
return ![
|
|
4
|
+
"android",
|
|
5
|
+
"iphone",
|
|
6
|
+
"ipad",
|
|
7
|
+
"ipod",
|
|
8
|
+
"blackberry",
|
|
9
|
+
"windows phone",
|
|
10
|
+
"opera mini",
|
|
11
|
+
"mobile"
|
|
12
|
+
].some((o) => e.includes(o));
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
n as default
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe as r, afterEach as s, vi as e, expect as t } from "vitest";
|
|
2
|
+
import o from "./isDesktop.mjs";
|
|
3
|
+
r("isDesktop", (a) => {
|
|
4
|
+
s(() => {
|
|
5
|
+
e.restoreAllMocks();
|
|
6
|
+
}), a("모바일 환경인 경우 false를 반환한다.", () => {
|
|
7
|
+
e.stubGlobal("navigator", { userAgent: "android" }), t(o()).toBe(!1), e.stubGlobal("navigator", { userAgent: "iphone" }), t(o()).toBe(!1), e.stubGlobal("navigator", { userAgent: "ipad" }), t(o()).toBe(!1), e.stubGlobal("navigator", { userAgent: "mobile" }), t(o()).toBe(!1);
|
|
8
|
+
}), a("데스크탑 환경인 경우 true를 반환한다.", () => {
|
|
9
|
+
e.stubGlobal("navigator", { userAgent: "windows" }), t(o()).toBe(!0), e.stubGlobal("navigator", { userAgent: "mac" }), t(o()).toBe(!0), e.stubGlobal("navigator", { userAgent: "linux" }), t(o()).toBe(!0);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isServer(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe as u, afterEach as i, vi as e, expect as r } from "vitest";
|
|
2
|
+
import t from "./isServer.mjs";
|
|
3
|
+
u("isServer", (o) => {
|
|
4
|
+
i(() => {
|
|
5
|
+
e.restoreAllMocks();
|
|
6
|
+
}), o("document가 존재하면 false를 반환한다.", () => {
|
|
7
|
+
e.stubGlobal("document", {}), r(t()).toBe(!1);
|
|
8
|
+
}), o("document가 존재하지 않으면 true를 반환한다.", () => {
|
|
9
|
+
e.stubGlobal("document", void 0), r(t()).toBe(!0);
|
|
10
|
+
}), o("window가 존재하지 않으면 true를 반환한다.", () => {
|
|
11
|
+
e.stubGlobal("window", void 0), r(t()).toBe(!0);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function convertObjectToQueryString(params: object): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe as r, expect as e } from "vitest";
|
|
2
|
+
import t from "./objectToQueryString.mjs";
|
|
3
|
+
r("convertObjectToQueryString", (o) => {
|
|
4
|
+
o("object 타입이 들어왔을 때 query string으로 변환한다.", () => {
|
|
5
|
+
e(t({ a: 1, b: !0, c: "test", d: void 0, e: null, f: { fa: 1 } })).toEqual(
|
|
6
|
+
"?a=1&b=true&c=test&d=undefined&e=null&f=%5Bobject+Object%5D"
|
|
7
|
+
);
|
|
8
|
+
}), o("변환할 수 없는 타입이 들어온 경우 빈 문자열을 반환한다.", () => {
|
|
9
|
+
e(t(null)).toEqual(""), e(t(void 0)).toEqual("");
|
|
10
|
+
});
|
|
11
|
+
});
|