yuyeon 0.0.41 → 0.0.42-rc10
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/style.css +1 -1
- package/dist/yuyeon.js +5157 -3010
- package/dist/yuyeon.umd.cjs +8 -4
- package/lib/components/button/YButton.scss +2 -1
- package/lib/components/date-picker/YDateCalendar.mjs +235 -5
- package/lib/components/date-picker/YDateCalendar.mjs.map +1 -1
- package/lib/components/date-picker/YDateCalendar.scss +82 -0
- package/lib/components/date-picker/YDatePicker.mjs.map +1 -1
- package/lib/components/date-picker/YDatePickerControl.mjs +29 -0
- package/lib/components/date-picker/YDatePickerControl.mjs.map +1 -0
- package/lib/components/date-picker/YDatePickerControl.scss +3 -0
- package/lib/components/date-picker/index.mjs +1 -1
- package/lib/components/date-picker/index.mjs.map +1 -1
- package/lib/components/divider/YDivider.mjs +4 -2
- package/lib/components/divider/YDivider.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.mjs +11 -5
- package/lib/components/dropdown/YDropdown.mjs.map +1 -1
- package/lib/components/dropdown/YDropdown.scss +3 -8
- package/lib/components/field-input/YFieldInput.mjs +10 -10
- package/lib/components/field-input/YFieldInput.mjs.map +1 -1
- package/lib/components/icon/YIcon.mjs +62 -0
- package/lib/components/icon/YIcon.mjs.map +1 -0
- package/lib/components/icon/YIcon.scss +18 -0
- package/lib/components/icon/index.mjs +2 -0
- package/lib/components/icon/index.mjs.map +1 -0
- package/lib/components/icon/poly.mjs +57 -0
- package/lib/components/icon/poly.mjs.map +1 -0
- package/lib/components/icons/index.mjs +14 -0
- package/lib/components/icons/index.mjs.map +1 -1
- package/lib/components/index.mjs +3 -0
- package/lib/components/index.mjs.map +1 -1
- package/lib/components/input/YInput.mjs +1 -0
- package/lib/components/input/YInput.mjs.map +1 -1
- package/lib/components/input/index.mjs.map +1 -1
- package/lib/components/layer/YLayer.mjs +2 -0
- package/lib/components/layer/YLayer.mjs.map +1 -1
- package/lib/components/layer/active-stack.mjs.map +1 -1
- package/lib/components/list/YList.mjs.map +1 -1
- package/lib/components/menu/YMenu.mjs +14 -2
- package/lib/components/menu/YMenu.mjs.map +1 -1
- package/lib/components/select/YSelect.mjs +9 -6
- package/lib/components/select/YSelect.mjs.map +1 -1
- package/lib/components/select/YSelect.scss +3 -8
- package/lib/components/switch/YSwitch.mjs +2 -0
- package/lib/components/switch/YSwitch.mjs.map +1 -1
- package/lib/components/tab/types.mjs.map +1 -1
- package/lib/components/table/composibles/pagination.mjs.map +1 -1
- package/lib/components/textarea/YTextarea.mjs +159 -0
- package/lib/components/textarea/YTextarea.mjs.map +1 -0
- package/lib/components/textarea/YTextarea.scss +25 -0
- package/lib/components/textarea/index.mjs +2 -0
- package/lib/components/textarea/index.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.mjs +2 -2
- package/lib/components/tooltip/YTooltip.mjs.map +1 -1
- package/lib/components/tree-view/YTreeView.mjs +5 -0
- package/lib/components/tree-view/YTreeView.mjs.map +1 -1
- package/lib/components/tree-view/YTreeViewNode.mjs +1 -0
- package/lib/components/tree-view/YTreeViewNode.mjs.map +1 -1
- package/lib/composables/communication.mjs +9 -0
- package/lib/composables/communication.mjs.map +1 -1
- package/lib/composables/date/factory.mjs +12 -0
- package/lib/composables/date/factory.mjs.map +1 -0
- package/lib/composables/date/index.mjs +19 -1
- package/lib/composables/date/index.mjs.map +1 -1
- package/lib/composables/date/setting.mjs +11 -0
- package/lib/composables/date/setting.mjs.map +1 -0
- package/lib/composables/date/types.mjs +1 -1
- package/lib/composables/date/types.mjs.map +1 -1
- package/lib/composables/i18n/index.mjs +30 -0
- package/lib/composables/i18n/index.mjs.map +1 -0
- package/lib/composables/i18n/locale.mjs +5 -0
- package/lib/composables/i18n/locale.mjs.map +1 -0
- package/lib/composables/i18n/rtl.mjs +34 -0
- package/lib/composables/i18n/rtl.mjs.map +1 -0
- package/lib/composables/i18n/share.mjs +2 -0
- package/lib/composables/i18n/share.mjs.map +1 -0
- package/lib/composables/icon.mjs +141 -0
- package/lib/composables/icon.mjs.map +1 -1
- package/lib/composables/index.mjs +1 -0
- package/lib/composables/index.mjs.map +1 -1
- package/lib/composables/theme/index.mjs.map +1 -1
- package/lib/composables/transition.mjs.map +1 -1
- package/lib/i18n/built-in.mjs +77 -0
- package/lib/i18n/built-in.mjs.map +1 -0
- package/lib/i18n/config.mjs +82 -0
- package/lib/i18n/config.mjs.map +1 -0
- package/lib/i18n/types.mjs +2 -0
- package/lib/i18n/types.mjs.map +1 -0
- package/lib/index.mjs +24 -5
- package/lib/index.mjs.map +1 -1
- package/lib/locales/en.mjs +4 -0
- package/lib/locales/en.mjs.map +1 -0
- package/lib/locales/index.mjs +3 -0
- package/lib/locales/index.mjs.map +1 -0
- package/lib/locales/ko.mjs +4 -0
- package/lib/locales/ko.mjs.map +1 -0
- package/lib/styles/util/_mixin.scss +34 -0
- package/lib/types/index.mjs.map +1 -1
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs +99 -0
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs.map +1 -0
- package/lib/util/date/built-in.mjs +18 -104
- package/lib/util/date/built-in.mjs.map +1 -1
- package/lib/util/date/index.mjs +1 -0
- package/lib/util/date/index.mjs.map +1 -1
- package/lib/util/date/types.mjs.map +1 -1
- package/lib/util/index.mjs +1 -0
- package/lib/util/index.mjs.map +1 -1
- package/package.json +7 -5
- package/types/abstract/items.d.ts +4 -4
- package/types/components/button/YButton.d.ts +10 -10
- package/types/components/checkbox/YInputCheckbox.d.ts +2 -2
- package/types/components/date-picker/YDateCalendar.d.ts +136 -0
- package/types/components/date-picker/index.d.ts +1 -0
- package/types/components/dialog/YDialog.d.ts +3 -2
- package/types/components/dropdown/YDropdown.d.ts +34 -13
- package/types/components/field-input/YFieldInput.d.ts +10 -10
- package/types/components/form/YForm.d.ts +1 -1
- package/types/components/icon/YIcon.d.ts +81 -0
- package/types/components/icon/index.d.ts +1 -0
- package/types/components/icons/YIconCheckbox.d.ts +2 -2
- package/types/components/icons/YIconSort.d.ts +2 -2
- package/types/components/icons/index.d.ts +48 -0
- package/types/components/index.d.ts +3 -0
- package/types/components/input/YInput.d.ts +28 -11
- package/types/components/layer/YLayer.d.ts +23 -22
- package/types/components/layer/active-stack.d.ts +1 -2
- package/types/components/list/YList.d.ts +3 -3
- package/types/components/list/YListItem.d.ts +5 -5
- package/types/components/menu/YMenu.d.ts +13 -8
- package/types/components/pagination/YPagination.d.ts +5 -5
- package/types/components/progress-bar/YProgressBar.d.ts +1 -1
- package/types/components/select/YSelect.d.ts +80 -64
- package/types/components/switch/YSwitch.d.ts +1 -1
- package/types/components/tab/YTab.d.ts +15 -15
- package/types/components/tab/YTabs.d.ts +5 -5
- package/types/components/tab/types.d.ts +1 -0
- package/types/components/table/YDataTable.d.ts +18 -18
- package/types/components/table/YDataTableBody.d.ts +5 -5
- package/types/components/table/YDataTableControl.d.ts +2 -2
- package/types/components/table/YDataTableHead.d.ts +2 -2
- package/types/components/table/YDataTableServer.d.ts +21 -21
- package/types/components/table/YTable.d.ts +4 -4
- package/types/components/table/composibles/header.d.ts +1 -1
- package/types/components/table/composibles/items.d.ts +3 -3
- package/types/components/table/composibles/pagination.d.ts +2 -2
- package/types/components/table/composibles/selection.d.ts +2 -2
- package/types/components/table/composibles/sorting.d.ts +1 -1
- package/types/components/textarea/YTextarea.d.ts +737 -0
- package/types/components/textarea/index.d.ts +1 -0
- package/types/components/tooltip/YTooltip.d.ts +13 -12
- package/types/components/tree-view/YTreeView.d.ts +7 -4
- package/types/components/tree-view/YTreeViewNode.d.ts +17 -9
- package/types/composables/choice.d.ts +1 -1
- package/types/composables/communication.d.ts +2 -0
- package/types/composables/coordinate/index.d.ts +6 -6
- package/types/composables/date/factory.d.ts +2 -0
- package/types/composables/date/index.d.ts +11 -0
- package/types/composables/date/setting.d.ts +4 -0
- package/types/composables/date/types.d.ts +12 -0
- package/types/composables/i18n/index.d.ts +8 -0
- package/types/composables/i18n/locale.d.ts +2 -0
- package/types/composables/i18n/rtl.d.ts +20 -0
- package/types/composables/i18n/share.d.ts +1 -0
- package/types/composables/icon.d.ts +96 -0
- package/types/composables/index.d.ts +2 -0
- package/types/composables/list-items.d.ts +10 -10
- package/types/composables/theme/index.d.ts +5 -5
- package/types/globals.d.ts +12 -7
- package/types/i18n/built-in.d.ts +2 -0
- package/types/i18n/config.d.ts +81 -0
- package/types/i18n/types.d.ts +19 -0
- package/types/locales/en.d.ts +4 -0
- package/types/shims.d.ts +88 -83
- package/types/types/index.d.ts +5 -0
- package/types/util/date/adapters/yuyeon-date-adapter.d.ts +38 -0
- package/types/util/date/built-in.d.ts +35 -0
- package/types/util/date/index.d.ts +3 -0
- package/types/util/date/types.d.ts +163 -0
- package/types/util/index.d.ts +1 -0
package/types/globals.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { VNode } from "vue";
|
|
2
|
+
import type {NativeElements, ReservedProps} from "@vue/runtime-dom";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
export namespace JSX {
|
|
5
|
+
export interface Element extends VNode {}
|
|
6
|
+
export interface ElementClass {
|
|
7
|
+
$props: {}
|
|
8
|
+
}
|
|
9
|
+
export interface ElementAttributesProperty {
|
|
10
|
+
$props: {}
|
|
11
|
+
}
|
|
12
|
+
export interface IntrinsicElements extends NativeElements {
|
|
13
|
+
[name: string]: any
|
|
10
14
|
}
|
|
15
|
+
export interface IntrinsicAttributes extends ReservedProps {}
|
|
11
16
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const localeCodesMap: {
|
|
2
|
+
af: string;
|
|
3
|
+
bg: string;
|
|
4
|
+
ca: string;
|
|
5
|
+
cs: string;
|
|
6
|
+
de: string;
|
|
7
|
+
el: string;
|
|
8
|
+
en: string;
|
|
9
|
+
et: string;
|
|
10
|
+
fa: string;
|
|
11
|
+
fi: string;
|
|
12
|
+
hr: string;
|
|
13
|
+
hu: string;
|
|
14
|
+
he: string;
|
|
15
|
+
id: string;
|
|
16
|
+
it: string;
|
|
17
|
+
ja: string;
|
|
18
|
+
ko: string;
|
|
19
|
+
lv: string;
|
|
20
|
+
lt: string;
|
|
21
|
+
nl: string;
|
|
22
|
+
no: string;
|
|
23
|
+
pl: string;
|
|
24
|
+
pt: string;
|
|
25
|
+
ro: string;
|
|
26
|
+
ru: string;
|
|
27
|
+
sk: string;
|
|
28
|
+
sl: string;
|
|
29
|
+
srCyrl: string;
|
|
30
|
+
srLatn: string;
|
|
31
|
+
sv: string;
|
|
32
|
+
th: string;
|
|
33
|
+
tr: string;
|
|
34
|
+
az: string;
|
|
35
|
+
uk: string;
|
|
36
|
+
vi: string;
|
|
37
|
+
zhHans: string;
|
|
38
|
+
zhHant: string;
|
|
39
|
+
};
|
|
40
|
+
export declare const defaultRtl: {
|
|
41
|
+
af: boolean;
|
|
42
|
+
ar: boolean;
|
|
43
|
+
bg: boolean;
|
|
44
|
+
ca: boolean;
|
|
45
|
+
cs: boolean;
|
|
46
|
+
de: boolean;
|
|
47
|
+
el: boolean;
|
|
48
|
+
en: boolean;
|
|
49
|
+
es: boolean;
|
|
50
|
+
et: boolean;
|
|
51
|
+
fa: boolean;
|
|
52
|
+
fi: boolean;
|
|
53
|
+
fr: boolean;
|
|
54
|
+
hr: boolean;
|
|
55
|
+
hu: boolean;
|
|
56
|
+
he: boolean;
|
|
57
|
+
id: boolean;
|
|
58
|
+
it: boolean;
|
|
59
|
+
ja: boolean;
|
|
60
|
+
ko: boolean;
|
|
61
|
+
lv: boolean;
|
|
62
|
+
lt: boolean;
|
|
63
|
+
nl: boolean;
|
|
64
|
+
no: boolean;
|
|
65
|
+
pl: boolean;
|
|
66
|
+
pt: boolean;
|
|
67
|
+
ro: boolean;
|
|
68
|
+
ru: boolean;
|
|
69
|
+
sk: boolean;
|
|
70
|
+
sl: boolean;
|
|
71
|
+
srCyrl: boolean;
|
|
72
|
+
srLatn: boolean;
|
|
73
|
+
sv: boolean;
|
|
74
|
+
th: boolean;
|
|
75
|
+
tr: boolean;
|
|
76
|
+
az: boolean;
|
|
77
|
+
uk: boolean;
|
|
78
|
+
vi: boolean;
|
|
79
|
+
zhHans: boolean;
|
|
80
|
+
zhHant: boolean;
|
|
81
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export type LocaleMessages = {
|
|
3
|
+
[key: string]: LocaleMessages | string;
|
|
4
|
+
};
|
|
5
|
+
export interface LocaleOptions {
|
|
6
|
+
messages?: LocaleMessages;
|
|
7
|
+
locale?: string;
|
|
8
|
+
fallbackLocale?: string;
|
|
9
|
+
adapter?: LocaleModule;
|
|
10
|
+
}
|
|
11
|
+
export interface LocaleModule {
|
|
12
|
+
name: string;
|
|
13
|
+
locale: Ref<string>;
|
|
14
|
+
fallbackLocale: Ref<string>;
|
|
15
|
+
messages: Ref<LocaleMessages>;
|
|
16
|
+
t: (key: string, ...args: unknown[]) => string;
|
|
17
|
+
n: (value: number) => string;
|
|
18
|
+
getContext: (props: LocaleOptions) => LocaleModule;
|
|
19
|
+
}
|
package/types/shims.d.ts
CHANGED
|
@@ -1,83 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
YDialog,
|
|
15
|
-
YDividePanel,
|
|
16
|
-
YDivider,
|
|
17
|
-
YDropdown,
|
|
18
|
-
YExpandHTransition,
|
|
19
|
-
YExpandVTransition,
|
|
20
|
-
YFieldInput,
|
|
21
|
-
YForm,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
import {
|
|
2
|
+
YAlert,
|
|
3
|
+
YApp,
|
|
4
|
+
YButton,
|
|
5
|
+
YCard,
|
|
6
|
+
YCardBody,
|
|
7
|
+
YCardFooter,
|
|
8
|
+
YCardHeader,
|
|
9
|
+
YCheckbox,
|
|
10
|
+
YChip,
|
|
11
|
+
YDataTable,
|
|
12
|
+
YDataTableServer,
|
|
13
|
+
YDateCalendar,
|
|
14
|
+
YDialog,
|
|
15
|
+
YDividePanel,
|
|
16
|
+
YDivider,
|
|
17
|
+
YDropdown,
|
|
18
|
+
YExpandHTransition,
|
|
19
|
+
YExpandVTransition,
|
|
20
|
+
YFieldInput,
|
|
21
|
+
YForm,
|
|
22
|
+
YIcon,
|
|
23
|
+
YInput,
|
|
24
|
+
YInputCheckbox,
|
|
25
|
+
YLayer,
|
|
26
|
+
YList,
|
|
27
|
+
YListItem,
|
|
28
|
+
YMenu,
|
|
29
|
+
YPagination,
|
|
30
|
+
YProgressBar,
|
|
31
|
+
YSelect,
|
|
32
|
+
YSnackbar,
|
|
33
|
+
YSpinnerRing,
|
|
34
|
+
YSwitch,
|
|
35
|
+
YTab,
|
|
36
|
+
YTable,
|
|
37
|
+
YTabs,
|
|
38
|
+
YTextarea,
|
|
39
|
+
YTooltip,
|
|
40
|
+
YTreeView,
|
|
41
|
+
YTreeViewNode,
|
|
42
|
+
} from 'yuyeon/components';
|
|
43
|
+
|
|
44
|
+
declare module '@vue/runtime-core' {
|
|
45
|
+
export interface GlobalComponents {
|
|
46
|
+
// @define-components
|
|
47
|
+
YApp: typeof YApp;
|
|
48
|
+
YButton: typeof YButton;
|
|
49
|
+
YChip: typeof YChip;
|
|
50
|
+
YInput: typeof YInput;
|
|
51
|
+
YFieldInput: typeof YFieldInput;
|
|
52
|
+
YTextarea: typeof YTextarea;
|
|
53
|
+
YForm: typeof YForm;
|
|
54
|
+
YCard: typeof YCard;
|
|
55
|
+
YCardBody: typeof YCardBody;
|
|
56
|
+
YCardHeader: typeof YCardHeader;
|
|
57
|
+
YCardFooter: typeof YCardFooter;
|
|
58
|
+
YDialog: typeof YDialog;
|
|
59
|
+
YLayer: typeof YLayer;
|
|
60
|
+
YSnackbar: typeof YSnackbar;
|
|
61
|
+
YProgressBar: typeof YProgressBar;
|
|
62
|
+
YSpinnerRing: typeof YSpinnerRing;
|
|
63
|
+
YTooltip: typeof YTooltip;
|
|
64
|
+
YExpandVTransition: typeof YExpandVTransition;
|
|
65
|
+
YExpandHTransition: typeof YExpandHTransition;
|
|
66
|
+
YDividePanel: typeof YDividePanel;
|
|
67
|
+
YList: typeof YList;
|
|
68
|
+
YListItem: typeof YListItem;
|
|
69
|
+
YTreeView: typeof YTreeView;
|
|
70
|
+
YTreeViewNode: typeof YTreeViewNode;
|
|
71
|
+
YDataTable: typeof YDataTable;
|
|
72
|
+
YTable: typeof YTable;
|
|
73
|
+
YDataTableServer: typeof YDataTableServer;
|
|
74
|
+
YMenu: typeof YMenu;
|
|
75
|
+
YPagination: typeof YPagination;
|
|
76
|
+
YInputCheckbox: typeof YInputCheckbox;
|
|
77
|
+
YCheckbox: typeof YCheckbox;
|
|
78
|
+
YSwitch: typeof YSwitch;
|
|
79
|
+
YDropdown: typeof YDropdown;
|
|
80
|
+
YSelect: typeof YSelect;
|
|
81
|
+
YAlert: typeof YAlert;
|
|
82
|
+
YTabs: typeof YTabs;
|
|
83
|
+
YTab: typeof YTab;
|
|
84
|
+
YDivider: typeof YDivider;
|
|
85
|
+
YDateCalendar: typeof YDateCalendar;
|
|
86
|
+
YIcon: typeof YIcon;
|
|
87
|
+
}
|
|
88
|
+
}
|
package/types/types/index.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from '@vue/runtime-dom';
|
|
2
|
+
import type { ComponentPublicInstance, FunctionalComponent } from 'vue';
|
|
1
3
|
export type CandidateKey = string | number;
|
|
4
|
+
export type JSXComponent<Props = any> = FunctionalComponent<Props | Props & HTMLAttributes> | {
|
|
5
|
+
new (): ComponentPublicInstance<Props | Props & HTMLAttributes>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DateAdapter, DateFormatOptions } from '../types';
|
|
2
|
+
export declare class YuyeonDateAdapter implements DateAdapter<Date> {
|
|
3
|
+
locale: string;
|
|
4
|
+
formats?: Record<string, DateFormatOptions>;
|
|
5
|
+
constructor(options: {
|
|
6
|
+
locale: string;
|
|
7
|
+
formats?: Record<string, DateFormatOptions>;
|
|
8
|
+
});
|
|
9
|
+
getWeekArray(date: Date): Date[][];
|
|
10
|
+
startOfMonth(date: Date): Date;
|
|
11
|
+
endOfMonth(date: Date): Date;
|
|
12
|
+
addDays(date: Date, amount: number): Date;
|
|
13
|
+
addMonths(date: Date, amount: number): Date;
|
|
14
|
+
date(value?: any): Date | null;
|
|
15
|
+
endOfDay(date: Date): Date;
|
|
16
|
+
endOfYear(date: Date): Date;
|
|
17
|
+
format(date: Date, formatString: string): string;
|
|
18
|
+
getDiff(date: Date, comparing: string | Date, unit?: string): number;
|
|
19
|
+
getYear(date: Date): number;
|
|
20
|
+
getMonth(date: Date): number;
|
|
21
|
+
getDay(date: Date): number;
|
|
22
|
+
getNextMonth(date: Date): Date;
|
|
23
|
+
getWeekdays(): string[];
|
|
24
|
+
isAfter(date: Date, comparing: Date): boolean;
|
|
25
|
+
isBefore(date: Date, comparing: Date): boolean;
|
|
26
|
+
isEqual(date: Date, comparing: Date): boolean;
|
|
27
|
+
isSameDay(date: Date, comparing: Date): boolean;
|
|
28
|
+
isSameMonth(date: Date, comparing: Date): boolean;
|
|
29
|
+
isValid(date: any): boolean;
|
|
30
|
+
isWithinRange(date: Date, range: [Date, Date]): boolean;
|
|
31
|
+
parseISO(date: string): Date;
|
|
32
|
+
setMonth(date: Date, month: number): Date;
|
|
33
|
+
setYear(date: Date, year: number): Date;
|
|
34
|
+
startOfDay(date: Date): Date;
|
|
35
|
+
startOfYear(date: Date): Date;
|
|
36
|
+
toISO(date: Date): string;
|
|
37
|
+
toJsDate(date: Date): Date;
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DateAdapter, DateFormatOptions } from './types';
|
|
2
|
+
export declare const ONE_DAY: number;
|
|
3
|
+
export declare const YYYY_MM_DD_REGEX: RegExp;
|
|
4
|
+
export declare const FIRST_SUNDAY: Date;
|
|
5
|
+
export declare class DateUtil {
|
|
6
|
+
static date(value?: any): Date | null;
|
|
7
|
+
static format(value: Date, formatString: string, locale: string, formats?: Record<string, DateFormatOptions>): string;
|
|
8
|
+
static parseLocalDate(value: string): Date;
|
|
9
|
+
static parseISO(value: string): Date;
|
|
10
|
+
static toISO(adapter: DateAdapter<any>, value: Date): string;
|
|
11
|
+
static getWeekArray(date: Date, locale: string): Date[][];
|
|
12
|
+
static startOfMonth(date: Date): Date;
|
|
13
|
+
static endOfMonth(date: Date): Date;
|
|
14
|
+
static startOfDay(date: Date): Date;
|
|
15
|
+
static startOfYear(date: Date): Date;
|
|
16
|
+
static endOfDay(date: Date): Date;
|
|
17
|
+
static endOfYear(date: Date): Date;
|
|
18
|
+
static getYear(date: Date): number;
|
|
19
|
+
static getMonth(date: Date): number;
|
|
20
|
+
static getDay(date: Date): number;
|
|
21
|
+
static getNextMonth(date: Date): Date;
|
|
22
|
+
static getWeekdays(locale: string): string[];
|
|
23
|
+
static isAfter(date: Date, comparing: Date): boolean;
|
|
24
|
+
static isBefore(date: Date, comparing: Date): boolean;
|
|
25
|
+
static isEqual(date: Date, comparing: Date): boolean;
|
|
26
|
+
static isSameDay(date: Date, comparing: Date): boolean;
|
|
27
|
+
static isSameMonth(date: Date, comparing: Date): boolean;
|
|
28
|
+
static isValid(date: any): boolean;
|
|
29
|
+
static isWithinRange(date: Date, range: [Date, Date]): boolean;
|
|
30
|
+
static addDays(date: Date, amount: number): Date;
|
|
31
|
+
static addMonths(date: Date, amount: number): Date;
|
|
32
|
+
static getDiff(date: Date, comparing: string | Date, unit?: 'month' | string): number;
|
|
33
|
+
static setMonth(date: Date, month: number): Date;
|
|
34
|
+
static setYear(date: Date, year: number): Date;
|
|
35
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export interface DateAdapter<T = unknown> {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param value
|
|
5
|
+
*/
|
|
6
|
+
date(value?: any): T | null;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param date
|
|
10
|
+
* @param formatString
|
|
11
|
+
*/
|
|
12
|
+
format(date: T, formatString: string): string;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param value
|
|
16
|
+
*/
|
|
17
|
+
toJsDate(value: T): Date;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param date
|
|
21
|
+
*/
|
|
22
|
+
parseISO(date: string): T;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param date
|
|
26
|
+
*/
|
|
27
|
+
toISO(date: T): string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param date
|
|
31
|
+
*/
|
|
32
|
+
startOfDay(date: T): T;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param date
|
|
36
|
+
*/
|
|
37
|
+
endOfDay(date: T): T;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param date
|
|
41
|
+
*/
|
|
42
|
+
startOfMonth(date: T): T;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param date
|
|
46
|
+
*/
|
|
47
|
+
endOfMonth(date: T): T;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param date
|
|
51
|
+
*/
|
|
52
|
+
startOfYear(date: T): T;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param date
|
|
56
|
+
*/
|
|
57
|
+
endOfYear(date: T): T;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param date
|
|
61
|
+
* @param comparing
|
|
62
|
+
*/
|
|
63
|
+
isBefore(date: T, comparing: T): boolean;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param date
|
|
67
|
+
* @param comparing
|
|
68
|
+
*/
|
|
69
|
+
isAfter(date: T, comparing: T): boolean;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param date
|
|
73
|
+
* @param comparing
|
|
74
|
+
*/
|
|
75
|
+
isEqual(date: T, comparing: T): boolean;
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
* @param date
|
|
79
|
+
* @param comparing
|
|
80
|
+
*/
|
|
81
|
+
isSameDay(date: T, comparing: T): boolean;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param date
|
|
85
|
+
* @param comparing
|
|
86
|
+
*/
|
|
87
|
+
isSameMonth(date: T, comparing: T): boolean;
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @param date
|
|
91
|
+
*/
|
|
92
|
+
isValid(date: any): boolean;
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
* @param date
|
|
96
|
+
* @param range
|
|
97
|
+
*/
|
|
98
|
+
isWithinRange(date: T, range: [T, T]): boolean;
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @param date
|
|
102
|
+
* @param amount
|
|
103
|
+
*/
|
|
104
|
+
addDays(date: T, amount: number): T;
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
* @param date
|
|
108
|
+
* @param amount
|
|
109
|
+
*/
|
|
110
|
+
addMonths(date: T, amount: number): T;
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @param date
|
|
114
|
+
*/
|
|
115
|
+
getYear(date: T): number;
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @param date
|
|
119
|
+
* @param year
|
|
120
|
+
*/
|
|
121
|
+
setYear(date: T, year: number): T;
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param date
|
|
125
|
+
* @param comparing
|
|
126
|
+
* @param unit
|
|
127
|
+
*/
|
|
128
|
+
getDiff(date: T, comparing: T | string, unit?: string): number;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
*
|
|
132
|
+
* @param date
|
|
133
|
+
*/
|
|
134
|
+
getWeekArray(date: T): T[][];
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
getWeekdays(): string[];
|
|
139
|
+
/**
|
|
140
|
+
* 0 ~ 11
|
|
141
|
+
* @param date
|
|
142
|
+
*/
|
|
143
|
+
getMonth(date: T): number;
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
* @param date
|
|
147
|
+
* @param month
|
|
148
|
+
*/
|
|
149
|
+
setMonth(date: T, month: number): T;
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* get day (1-31) number
|
|
153
|
+
*
|
|
154
|
+
* @param date
|
|
155
|
+
*/
|
|
156
|
+
getDay(date: T): number;
|
|
157
|
+
/**
|
|
158
|
+
*
|
|
159
|
+
* @param date
|
|
160
|
+
*/
|
|
161
|
+
getNextMonth(date: T): T;
|
|
162
|
+
}
|
|
163
|
+
export type DateFormatOptions = Intl.DateTimeFormatOptions | ((date: Date, formatString: string, locale: string) => string);
|
package/types/util/index.d.ts
CHANGED