@nocobase/plugin-calendar 2.1.0-alpha.4 → 2.1.0-alpha.40

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.
Files changed (47) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -10
  3. package/client-v2.d.ts +2 -0
  4. package/client-v2.js +3 -0
  5. package/dist/client/82.d5fa7ed1a8d872b0.js +10 -0
  6. package/dist/client/{9a7f2eedc5c80833.js → 953.dc0ed940b4cf0214.js} +1 -1
  7. package/dist/client/calendar/utils.d.ts +1 -3
  8. package/dist/client/index.js +1 -1
  9. package/dist/client-v2/110.a300efc255ce18b8.js +10 -0
  10. package/dist/client-v2/701.ab4233a614cd3e0a.js +10 -0
  11. package/dist/client-v2/82.7b76afd4bcb77bb9.js +10 -0
  12. package/dist/client-v2/944.f4b4f1ca02f36c49.js +10 -0
  13. package/dist/client-v2/952.8117af037dabbb79.js +10 -0
  14. package/dist/client-v2/953.6fd23a3f18022252.js +10 -0
  15. package/dist/client-v2/index.d.ts +10 -0
  16. package/dist/client-v2/index.js +10 -0
  17. package/dist/client-v2/locale.d.ts +10 -0
  18. package/dist/client-v2/models/CalendarBlockModel.d.ts +85 -0
  19. package/dist/client-v2/models/actions/CalendarActionModels.d.ts +43 -0
  20. package/dist/client-v2/models/actions/CalendarPopupModels.d.ts +47 -0
  21. package/dist/client-v2/models/components/CalendarBlock.d.ts +53 -0
  22. package/dist/client-v2/models/components/CalendarHeader.d.ts +21 -0
  23. package/dist/client-v2/models/components/CalendarToolbar.d.ts +20 -0
  24. package/dist/client-v2/models/components/CalendarViewContext.d.ts +22 -0
  25. package/dist/client-v2/models/components/dateTimeUtils.d.ts +9 -0
  26. package/dist/client-v2/models/components/getLabelFormatValue.d.ts +11 -0
  27. package/dist/client-v2/models/components/global.style.d.ts +11 -0
  28. package/dist/client-v2/models/components/index.d.ts +12 -0
  29. package/dist/client-v2/models/components/lazy.d.ts +11 -0
  30. package/dist/client-v2/models/components/style.d.ts +471 -0
  31. package/dist/client-v2/models/components/useCalendarHeight.d.ts +15 -0
  32. package/dist/client-v2/models/index.d.ts +11 -0
  33. package/dist/client-v2/models/utils.d.ts +44 -0
  34. package/dist/client-v2/plugin.d.ts +53 -0
  35. package/dist/externalVersion.js +9 -7
  36. package/dist/locale/en-US.json +4 -0
  37. package/dist/locale/zh-CN.json +4 -0
  38. package/dist/node_modules/solarlunar-es/LICENSE +21 -0
  39. package/dist/node_modules/solarlunar-es/dist/solarlunar.cjs.js +1 -0
  40. package/dist/node_modules/solarlunar-es/dist/solarlunar.d.ts +145 -0
  41. package/dist/node_modules/solarlunar-es/dist/solarlunar.esm.js +1 -0
  42. package/dist/node_modules/solarlunar-es/package.json +1 -0
  43. package/dist/shared/calendar.d.ts +17 -0
  44. package/dist/shared/calendar.js +70 -0
  45. package/package.json +4 -3
  46. package/dist/client/8eb21f8e302e69f4.js +0 -10
  47. package/dist/client/dfc51bc039d8fa26.js +0 -10
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import dayjs from 'dayjs';
10
+ export declare const CALENDAR_RANGE_FILTER_GROUP = "__calendar_view_range__";
11
+ export type CalendarVisibleRange = {
12
+ start: Date;
13
+ end: Date;
14
+ };
15
+ export declare const normalizeCalendarFieldPath: (fieldPath?: string | string[]) => string;
16
+ export declare const parseCalendarWeekStart: (weekStart?: number | string) => 1 | 0;
17
+ export declare const getCalendarVisibleRange: (value: Date | string, view?: 'month' | 'week' | 'day' | string, weekStart?: number | string) => CalendarVisibleRange;
18
+ export declare const formatDate: (date: dayjs.Dayjs) => string;
19
+ export declare const createCalendarRangeFilter: (fieldNames: {
20
+ start?: string | string[];
21
+ end?: string | string[];
22
+ }, range: CalendarVisibleRange) => {
23
+ [x: string]: {
24
+ $gte: string;
25
+ $lte: string;
26
+ };
27
+ } | {
28
+ $or: ({
29
+ [x: string]: {
30
+ $gte: string;
31
+ $lte: string;
32
+ };
33
+ } | {
34
+ $and: ({
35
+ [x: string]: {
36
+ $lte: string;
37
+ };
38
+ } | {
39
+ [x: string]: {
40
+ $gte: string;
41
+ };
42
+ })[];
43
+ })[];
44
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Application, Plugin } from '@nocobase/client-v2';
10
+ import React from 'react';
11
+ interface ColorFunctions {
12
+ loading: boolean;
13
+ getFontColor: (value: any) => string;
14
+ getBackgroundColor: (value: any) => string;
15
+ }
16
+ type TitleRendererProps = {
17
+ value: any;
18
+ };
19
+ export declare class PluginCalendarClient extends Plugin<any, Application> {
20
+ titleFieldInterfaces: {
21
+ [T: string]: {
22
+ TitleRenderer: React.FC<TitleRendererProps>;
23
+ };
24
+ };
25
+ colorFieldInterfaces: {
26
+ [T: string]: {
27
+ useGetColor: (field: any) => ColorFunctions;
28
+ };
29
+ };
30
+ dateTimeFieldInterfaces: string[];
31
+ registerTitleFieldInterface(key: string, options?: {
32
+ TitleRenderer: React.FC<TitleRendererProps>;
33
+ }): void;
34
+ getTitleFieldInterface(key: string): {
35
+ TitleRenderer: React.FC<TitleRendererProps>;
36
+ } | {
37
+ [T: string]: {
38
+ TitleRenderer: React.FC<TitleRendererProps>;
39
+ };
40
+ };
41
+ getTitleFieldInterfaces(): string[];
42
+ registerDateTimeFieldInterface(data: string | string[]): void;
43
+ getDateTimeFieldInterfaces(): string[];
44
+ registerColorFieldInterface(type: any, option: {
45
+ useGetColor: (field: any) => ColorFunctions;
46
+ }): void;
47
+ getColorFieldInterface(type: string): {
48
+ useGetColor: (field: any) => ColorFunctions;
49
+ };
50
+ getColorFieldInterfaces(): string[];
51
+ load(): Promise<void>;
52
+ }
53
+ export default PluginCalendarClient;
@@ -8,20 +8,22 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.4",
11
+ "@nocobase/client": "2.1.0-alpha.40",
12
12
  "react": "18.2.0",
13
+ "@nocobase/flow-engine": "2.1.0-alpha.40",
14
+ "@nocobase/client-v2": "2.1.0-alpha.40",
13
15
  "react-i18next": "11.18.6",
14
- "@nocobase/server": "2.1.0-alpha.4",
15
- "@nocobase/test": "2.1.0-alpha.4",
16
+ "@nocobase/server": "2.1.0-alpha.40",
17
+ "dayjs": "1.11.13",
18
+ "lodash": "4.18.1",
19
+ "@nocobase/test": "2.1.0-alpha.40",
16
20
  "@ant-design/icons": "5.6.1",
17
21
  "@formily/react": "2.3.7",
18
- "dayjs": "1.11.13",
19
- "lodash": "4.17.21",
20
- "@nocobase/flow-engine": "2.1.0-alpha.4",
21
22
  "antd": "5.24.2",
22
23
  "react-dom": "18.2.0",
23
24
  "antd-style": "3.7.1",
24
25
  "@formily/core": "2.3.7",
25
26
  "@formily/shared": "2.3.7",
26
- "@formily/antd-v5": "1.2.3"
27
+ "@formily/antd-v5": "1.2.3",
28
+ "@nocobase/utils": "2.1.0-alpha.40"
27
29
  };
@@ -25,7 +25,9 @@
25
25
  "End date field": "End date field",
26
26
  "Event": "Event",
27
27
  "Event open mode": "Event open mode",
28
+ "Event popup settings": "Event popup settings",
28
29
  "Filter": "Filter",
30
+ "Monday": "Monday",
29
31
  "Month": "Month",
30
32
  "Monthly": "Monthly",
31
33
  "None": "None",
@@ -33,6 +35,7 @@
33
35
  "Popup": "Popup",
34
36
  "Print": "Print",
35
37
  "Quick create event": "Quick create event",
38
+ "Quick create popup settings": "Quick create popup settings",
36
39
  "Repeats": "Repeats",
37
40
  "Select view": "Select view",
38
41
  "Show lunar": "Show lunar",
@@ -52,5 +55,6 @@
52
55
  "Weekly": "Weekly",
53
56
  "Work week": "Work week",
54
57
  "Yearly": "Yearly",
58
+ "Sunday": "Sunday",
55
59
  "{{count}} more items": "{{count}} more items"
56
60
  }
@@ -25,7 +25,9 @@
25
25
  "End date field": "结束日期字段",
26
26
  "Event": "事件",
27
27
  "Event open mode": "事项打开方式",
28
+ "Event popup settings": "事项弹窗设置",
28
29
  "Filter": "筛选",
30
+ "Monday": "周一",
29
31
  "Month": "月",
30
32
  "Monthly": "每月",
31
33
  "None": "无",
@@ -33,6 +35,7 @@
33
35
  "Popup": "弹窗",
34
36
  "Print": "打印",
35
37
  "Quick create event": "快速创建事项",
38
+ "Quick create popup settings": "快速创建弹窗设置",
36
39
  "Repeats": "重复",
37
40
  "Select view": "切换视图",
38
41
  "Show lunar": "展示农历",
@@ -52,5 +55,6 @@
52
55
  "Weekly": "每周",
53
56
  "Work week": "工作日",
54
57
  "Yearly": "每年",
58
+ "Sunday": "周日",
55
59
  "{{count}} more items": "{{count}} 更多事项"
56
60
  }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 邱权武(qiuquanwu)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var b={149:b=>{var f={1:{1:"春节",15:"元宵"},2:{2:"龙抬头"},5:{5:"端午"},7:{7:"七夕",15:"中元"},8:{15:"中秋"},9:{9:"重阳"},12:{29:"除夕",30:"除夕"}};var c={1:{1:"元旦"},2:{14:"情人节"},3:{8:"妇女节"},4:{1:"愚人节",4:"清明节"},5:{1:"劳动节",4:"青年节"},6:{1:"儿童节"},7:{1:"建党节"},8:{1:"建军节"},9:{10:"教师节"},10:{1:"国庆节"}};const e={lunarInfo:[19416,19168,42352,21717,53856,55632,91476,22176,39632,21970,19168,42422,42192,53840,119381,46400,54944,44450,38320,84343,18800,42160,46261,27216,27968,109396,11104,38256,21234,18800,25958,54432,59984,28309,23248,11104,100067,37600,116951,51536,54432,120998,46416,22176,107956,9680,37584,53938,43344,46423,27808,46416,86869,19872,42416,83315,21168,43432,59728,27296,44710,43856,19296,43748,42352,21088,62051,55632,23383,22176,38608,19925,19152,42192,54484,53840,54616,46400,46752,103846,38320,18864,43380,42160,45690,27216,27968,44870,43872,38256,19189,18800,25776,29859,59984,27480,23232,43872,38613,37600,51552,55636,54432,55888,30034,22176,43959,9680,37584,51893,43344,46240,47780,44368,21977,19360,42416,86390,21168,43312,31060,27296,44368,23378,19296,42726,42208,53856,60005,54576,23200,30371,38608,19195,19152,42192,118966,53840,54560,56645,46496,22224,21938,18864,42359,42160,43600,111189,27936,44448,84835,37744,18936,18800,25776,92326,59984,27424,108228,43744,37600,53987,51552,54615,54432,55888,23893,22176,42704,21972,21200,43448,43344,46240,46758,44368,21920,43940,42416,21168,45683,26928,29495,27296,44368,84821,19296,42352,21732,53600,59752,54560,55968,92838,22224,19168,43476,42192,53584,62034,54560],solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],gan:["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],zhi:["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],animals:["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"],lunarTerm:["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"],lTermInfo:["9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","9778397bd19801ec9210c965cc920e","97b6b97bd19801ec95f8c965cc920f","97bd09801d98082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd197c36c9210c9274c91aa","97b6b97bd19801ec95f8c965cc920e","97bd09801d98082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec95f8c965cc920e","97bcf97c3598082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd07f595b0b6fc920fb0722","9778397bd097c36b0b6fc9210c8dc2","9778397bd19801ec9210c9274c920e","97b6b97bd19801ec95f8c965cc920f","97bd07f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c920e","97b6b97bd19801ec95f8c965cc920f","97bd07f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec9210c965cc920e","97bd07f1487f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c9274c920e","97bcf7f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c91aa","97b6b97bd197c36c9210c9274c920e","97bcf7f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c920e","97b6b7f0e47f531b0723b0b6fb0722","7f0e37f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36b0b70c9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e37f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc9210c8dc2","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0787b0721","7f0e27f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c91aa","97b6b7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c8dc2","977837f0e37f149b0723b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f5307f595b0b0bc920fb0722","7f0e397bd097c35b0b6fc9210c8dc2","977837f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0721","7f0e37f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc9210c8dc2","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0723b06bd","7f07e7f0e37f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f1487f595b0b0bb0b6fb0722","7f0e37f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e37f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0723b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0723b06bd","7f07e7f0e37f14998083b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14898082b0723b02d5","7f07e7f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e36665b66aa89801e9808297c35","665f67f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e36665b66a449801e9808297c35","665f67f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e36665b66a449801e9808297c35","665f67f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e26665b66a449801e9808297c35","665f67f0e37f1489801eb072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722"],nStr1:["日","一","二","三","四","五","六","七","八","九","十"],nStr2:["初","十","廿","卅"],nStr3:["正","二","三","四","五","六","七","八","九","十","冬","腊"],nStr4:["零","一","二","三","四","五","六","七","八","九","十"],lYearDays:function(b){var f,c=348;for(f=32768;f>8;f>>=1)c+=e.lunarInfo[b-1900]&f?1:0;return c+e.leapDays(b)},leapMonth:function(b){return 15&e.lunarInfo[b-1900]},leapDays:function(b){return e.leapMonth(b)?65536&e.lunarInfo[b-1900]?30:29:0},monthDays:function(b,f){return f>12||f<1?-1:e.lunarInfo[b-1900]&65536>>f?30:29},solarDays:function(b,f){if(f>12||f<1)return-1;var c=f-1;return 1==c?b%4==0&&b%100!=0||b%400==0?29:28:e.solarMonth[c]},toGanZhi:function(b){return e.gan[b%10]+e.zhi[b%12]},getTerm:function(b,f){if(b<1900||b>2100)return-1;if(f<1||f>24)return-1;var c=e.lTermInfo[b-1900],a=[parseInt("0x"+c.substr(0,5)).toString(),parseInt("0x"+c.substr(5,5)).toString(),parseInt("0x"+c.substr(10,5)).toString(),parseInt("0x"+c.substr(15,5)).toString(),parseInt("0x"+c.substr(20,5)).toString(),parseInt("0x"+c.substr(25,5)).toString()],r=[a[0].substr(0,1),a[0].substr(1,2),a[0].substr(3,1),a[0].substr(4,2),a[1].substr(0,1),a[1].substr(1,2),a[1].substr(3,1),a[1].substr(4,2),a[2].substr(0,1),a[2].substr(1,2),a[2].substr(3,1),a[2].substr(4,2),a[3].substr(0,1),a[3].substr(1,2),a[3].substr(3,1),a[3].substr(4,2),a[4].substr(0,1),a[4].substr(1,2),a[4].substr(3,1),a[4].substr(4,2),a[5].substr(0,1),a[5].substr(1,2),a[5].substr(3,1),a[5].substr(4,2)];return parseInt(r[f-1])},toChinaYear:function(b){var f=parseInt((b/1e3).toString()),c=parseInt((b%1e3/100).toString()),a=parseInt((b%100/10).toString()),r=b%10;return e.nStr4[f]+e.nStr4[c]+e.nStr4[a]+e.nStr4[r]+"年"},toChinaMonth:function(b){if(b>12||b<1)return-1;var f=e.nStr3[b-1];return f+="月"},toChinaDay:function(b){var f;switch(b){case 10:f="初十";break;case 20:f="二十";break;case 30:f="三十";break;default:f=e.nStr2[Math.floor(b/10)],f+=e.nStr1[b%10]}return f},getAnimal:function(b){return e.animals[(b-4)%12]},solar2lunar:function(b,a,r){if(b<1900||b>2100)return-1;if(1900==b&&1==a&&r<31)return-1;if(b)t=new Date(b,parseInt(a.toString())-1,r);else var t=new Date;var n,d=0,s=(b=t.getFullYear(),a=t.getMonth()+1,r=t.getDate(),(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())-Date.UTC(1900,0,31))/864e5);for(n=1900;n<2101&&s>0;n++)s-=d=e.lYearDays(n);s<0&&(s+=d,n--);var u=new Date,o=!1;u.getFullYear()==b&&u.getMonth()+1==a&&u.getDate()==r&&(o=!0);var i=t.getDay(),l=e.nStr1[i];0==i&&(i=7);var h=n,g=e.leapMonth(n),p=!1;for(n=1;n<13&&s>0;n++)g>0&&n==g+1&&0==p?(--n,p=!0,d=e.leapDays(h)):d=e.monthDays(h,n),1==p&&n==g+1&&(p=!1),s-=d;0==s&&g>0&&n==g+1&&(p?p=!1:(p=!0,--n)),s<0&&(s+=d,--n);var D=n,v=s+1,_=a-1,m=e.getTerm(b,3),y=e.toGanZhi(b-4),S=new Date(b,1,m).getTime();new Date(b,_,r).getTime()<S&&(y=e.toGanZhi(b-5));var T=e.getTerm(b,2*a-1),I=e.getTerm(b,2*a),M=e.toGanZhi(12*(b-1900)+a+11);r>=T&&(M=e.toGanZhi(12*(b-1900)+a+12));var C=!1,w="";T==r&&(C=!0,w=e.lunarTerm[2*a-2]),I==r&&(C=!0,w=e.lunarTerm[2*a-1]);var x=Date.UTC(b,_,1,0,0,0,0)/864e5+25567+10,Y=e.toGanZhi(x+r-1),k=f[D]&&f[D][v]?f[D][v]:"";[2022,2025,2026,2027,2028,2029,2031,2032].includes(b)&&12===D&&29===v&&(k="除夕");var U=c[a]&&c[a][r]?c[a][r]:"";return{lYear:h,lMonth:D,lDay:v,animal:e.getAnimal(h),yearCn:e.toChinaYear(h),monthCn:(p&&g===D?"闰":"")+e.toChinaMonth(D),dayCn:e.toChinaDay(v),cYear:b,cMonth:a,cDay:r,gzYear:y,gzMonth:M,gzDay:Y,isToday:o,isLeap:p,nWeek:i,ncWeek:"星期"+l,isTerm:C,term:w,lunarFestival:k,festival:U}},lunar2solar:function(b,f,c,a){var r=e.leapMonth(b);if(e.leapDays(b),a&&r!=f)return-1;if(2100==b&&12==f&&c>1||1900==b&&1==f&&c<31)return-1;var t=e.monthDays(b,f);if(b<1900||b>2100||c>t)return-1;for(var n=0,d=1900;d<b;d++)n+=e.lYearDays(d);var s=0,u=!1;for(d=1;d<f;d++)s=e.leapMonth(b),u||s<=d&&s>0&&(n+=e.leapDays(b),u=!0),n+=e.monthDays(b,d);a&&(n+=t);var o=Date.UTC(1900,1,30,0,0,0),i=new Date(864e5*(n+c-31)+o),l=i.getUTCFullYear(),h=i.getUTCMonth()+1,g=i.getUTCDate();return e.solar2lunar(l,h,g)}};var a=e;b.exports=a}};var f={};function __nccwpck_require__(c){var e=f[c];if(e!==undefined){return e.exports}var a=f[c]={exports:{}};var r=true;try{b[c](a,a.exports,__nccwpck_require__);r=false}finally{if(r)delete f[c]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var c=__nccwpck_require__(149);module.exports=c})();
@@ -0,0 +1,145 @@
1
+ declare interface Solar2lunar {
2
+ lYear: number;
3
+ lMonth: number;
4
+ lDay: number;
5
+ animal: string;
6
+ monthCn: string;
7
+ dayCn: string;
8
+ cYear: number;
9
+ cMonth: number;
10
+ cDay: number;
11
+ gzYear: string;
12
+ gzMonth: string;
13
+ gzDay: string;
14
+ isToday: boolean;
15
+ isLeap: boolean;
16
+ nWeek: number;
17
+ ncWeek: string;
18
+ isTerm: boolean;
19
+ term: string;
20
+ lunarFestival: string;
21
+ festival: string;
22
+ }
23
+
24
+ /**
25
+ * @1900-2100区间内的公历、农历互转
26
+ * @charset UTF-8
27
+ * @author Ajing(JJonline@JJonline.Cn)
28
+ * @Time 2014-7-21
29
+ * @Version $ID$
30
+ * @公历转农历:solarLunar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
31
+ * @农历转公历:solarLunar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
32
+ * @link http://blog.jjonline.cn/userInterFace/173.html
33
+ */
34
+
35
+ declare const solarLunar: {
36
+ lunarInfo: number[];
37
+ solarMonth: number[];
38
+ gan: string[];
39
+ zhi: string[];
40
+ animals: string[];
41
+ lunarTerm: string[];
42
+ lTermInfo: string[];
43
+ nStr1: string[];
44
+ nStr2: string[];
45
+ nStr3: string[];
46
+ nStr4: string[];
47
+ /**
48
+ * 返回农历y年一整年的总天数
49
+ * @param lunar Year
50
+ * @return Number
51
+ * @eg:var count = solarLunar.lYearDays(1987) ;//count=387
52
+ */
53
+ lYearDays: (y: number) => number;
54
+ /**
55
+ * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
56
+ * @param lunar Year
57
+ * @return Number (0-12)
58
+ * @eg:var leapMonth = solarLunar.leapMonth(1987) ;//leapMonth=6
59
+ */
60
+ leapMonth: (y: number) => number;
61
+ /**
62
+ * 返回农历y年闰月的天数 若该年没有闰月则返回0
63
+ * @param lunar Year
64
+ * @return Number (0、29、30)
65
+ * @eg:var leapMonthDay = solarLunar.leapDays(1987) ;//leapMonthDay=29
66
+ */
67
+ leapDays: (y: number) => number;
68
+ /**
69
+ * 返回农历 y 年 m 月(非闰月)的总天数,计算 m 为闰月时的天数请使用 leapDays 方法
70
+ * @param lunar Year
71
+ * @return Number (-1、29、30)
72
+ * @eg:var MonthDay = solarLunar.monthDays(1987,9) ;//MonthDay=29
73
+ */
74
+ monthDays: (y: number, m: number) => number;
75
+ /**
76
+ * 返回公历(!)y年m月的天数
77
+ * @param solar Year
78
+ * @return Number (-1、28、29、30、31)
79
+ * @eg:var solarMonthDay = solarLunar.leapDays(1987) ;//solarMonthDay=30
80
+ */
81
+ solarDays: (y: number, m: number) => number;
82
+ /**
83
+ * 传入offset偏移量返回干支
84
+ * @param offset 相对甲子的偏移量
85
+ * @return Cn string
86
+ */
87
+ toGanZhi: (offset: number) => string;
88
+ /**
89
+ * 传入公历(!) y 年获得该年第 n 个节气的公历日期
90
+ * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
91
+ * @return number Number
92
+ * @eg:var _24 = solarLunar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
93
+ */
94
+ getTerm: (y: number, n: number) => number;
95
+ /**
96
+ * 传入农历年份数字返回汉语通俗表示法
97
+ * @param lunar year
98
+ * @return string
99
+ * @eg:
100
+ */
101
+ toChinaYear: (y: number) => string;
102
+ /**
103
+ * 传入农历数字月份返回汉语通俗表示法
104
+ * @param lunar month
105
+ * @return number string
106
+ * @eg:var cnMonth = solarLunar.toChinaMonth(12) ;//cnMonth='腊月'
107
+ */
108
+ toChinaMonth: (m: number) => string | number;
109
+ /**
110
+ * 传入农历日期数字返回汉字表示法
111
+ * @param lunar day
112
+ * @return Cn string
113
+ * @eg:var cnDay = solarLunar.toChinaDay(21) ;//cnMonth='廿一'
114
+ */
115
+ toChinaDay: (d: number) => string;
116
+ /**
117
+ * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
118
+ * @param y year
119
+ * @return Cn string
120
+ * @eg:var animal = solarLunar.getAnimal(1987) ;//animal='兔'
121
+ * todo 生肖需要精确转换
122
+ */
123
+ getAnimal: (y: number) => string;
124
+ /**
125
+ * 传入公历年月日获得详细的公历、农历object信息 <=>JSON
126
+ * @param y solar year
127
+ * @param m solar month
128
+ * @param d solar day
129
+ * @return JSON object
130
+ * @eg:console.log(solarLunar.solar2lunar(1987,11,01));
131
+ */
132
+ solar2lunar: (y: number, m: number, d: number) => Solar2lunar | number;
133
+ /**
134
+ * 传入公历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
135
+ * @param y lunar year
136
+ * @param m lunar month
137
+ * @param d lunar day
138
+ * @param isLeapMonth lunar month is leap or not.
139
+ * @return JSON object
140
+ * @eg:console.log(solarLunar.lunar2solar(1987,9,10));
141
+ */
142
+ lunar2solar: (y: number, m: number, d: number, isLeapMonth: boolean) => Solar2lunar | number;
143
+ };
144
+
145
+ export { solarLunar as default };
@@ -0,0 +1 @@
1
+ var b={1:{1:"春节",15:"元宵"},2:{2:"龙抬头"},5:{5:"端午"},7:{7:"七夕",15:"中元"},8:{15:"中秋"},9:{9:"重阳"},12:{29:"除夕",30:"除夕"}};var f={1:{1:"元旦"},2:{14:"情人节"},3:{8:"妇女节"},4:{1:"愚人节",4:"清明节"},5:{1:"劳动节",4:"青年节"},6:{1:"儿童节"},7:{1:"建党节"},8:{1:"建军节"},9:{10:"教师节"},10:{1:"国庆节"}};const c={lunarInfo:[19416,19168,42352,21717,53856,55632,91476,22176,39632,21970,19168,42422,42192,53840,119381,46400,54944,44450,38320,84343,18800,42160,46261,27216,27968,109396,11104,38256,21234,18800,25958,54432,59984,28309,23248,11104,100067,37600,116951,51536,54432,120998,46416,22176,107956,9680,37584,53938,43344,46423,27808,46416,86869,19872,42416,83315,21168,43432,59728,27296,44710,43856,19296,43748,42352,21088,62051,55632,23383,22176,38608,19925,19152,42192,54484,53840,54616,46400,46752,103846,38320,18864,43380,42160,45690,27216,27968,44870,43872,38256,19189,18800,25776,29859,59984,27480,23232,43872,38613,37600,51552,55636,54432,55888,30034,22176,43959,9680,37584,51893,43344,46240,47780,44368,21977,19360,42416,86390,21168,43312,31060,27296,44368,23378,19296,42726,42208,53856,60005,54576,23200,30371,38608,19195,19152,42192,118966,53840,54560,56645,46496,22224,21938,18864,42359,42160,43600,111189,27936,44448,84835,37744,18936,18800,25776,92326,59984,27424,108228,43744,37600,53987,51552,54615,54432,55888,23893,22176,42704,21972,21200,43448,43344,46240,46758,44368,21920,43940,42416,21168,45683,26928,29495,27296,44368,84821,19296,42352,21732,53600,59752,54560,55968,92838,22224,19168,43476,42192,53584,62034,54560],solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],gan:["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],zhi:["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],animals:["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"],lunarTerm:["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"],lTermInfo:["9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","9778397bd19801ec9210c965cc920e","97b6b97bd19801ec95f8c965cc920f","97bd09801d98082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd197c36c9210c9274c91aa","97b6b97bd19801ec95f8c965cc920e","97bd09801d98082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec95f8c965cc920e","97bcf97c3598082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd07f595b0b6fc920fb0722","9778397bd097c36b0b6fc9210c8dc2","9778397bd19801ec9210c9274c920e","97b6b97bd19801ec95f8c965cc920f","97bd07f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c920e","97b6b97bd19801ec95f8c965cc920f","97bd07f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec9210c965cc920e","97bd07f1487f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c9274c920e","97bcf7f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c91aa","97b6b97bd197c36c9210c9274c920e","97bcf7f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c920e","97b6b7f0e47f531b0723b0b6fb0722","7f0e37f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36b0b70c9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e37f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc9210c8dc2","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0787b0721","7f0e27f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c91aa","97b6b7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c8dc2","977837f0e37f149b0723b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f5307f595b0b0bc920fb0722","7f0e397bd097c35b0b6fc9210c8dc2","977837f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0721","7f0e37f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc9210c8dc2","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0723b06bd","7f07e7f0e37f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f1487f595b0b0bb0b6fb0722","7f0e37f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e37f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0723b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0723b06bd","7f07e7f0e37f14998083b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14898082b0723b02d5","7f07e7f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e36665b66aa89801e9808297c35","665f67f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e36665b66a449801e9808297c35","665f67f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e36665b66a449801e9808297c35","665f67f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e26665b66a449801e9808297c35","665f67f0e37f1489801eb072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722"],nStr1:["日","一","二","三","四","五","六","七","八","九","十"],nStr2:["初","十","廿","卅"],nStr3:["正","二","三","四","五","六","七","八","九","十","冬","腊"],nStr4:["零","一","二","三","四","五","六","七","八","九","十"],lYearDays:function(b){var f,e=348;for(f=32768;f>8;f>>=1)e+=c.lunarInfo[b-1900]&f?1:0;return e+c.leapDays(b)},leapMonth:function(b){return 15&c.lunarInfo[b-1900]},leapDays:function(b){return c.leapMonth(b)?65536&c.lunarInfo[b-1900]?30:29:0},monthDays:function(b,f){return f>12||f<1?-1:c.lunarInfo[b-1900]&65536>>f?30:29},solarDays:function(b,f){if(f>12||f<1)return-1;var e=f-1;return 1==e?b%4==0&&b%100!=0||b%400==0?29:28:c.solarMonth[e]},toGanZhi:function(b){return c.gan[b%10]+c.zhi[b%12]},getTerm:function(b,f){if(b<1900||b>2100)return-1;if(f<1||f>24)return-1;var e=c.lTermInfo[b-1900],a=[parseInt("0x"+e.substr(0,5)).toString(),parseInt("0x"+e.substr(5,5)).toString(),parseInt("0x"+e.substr(10,5)).toString(),parseInt("0x"+e.substr(15,5)).toString(),parseInt("0x"+e.substr(20,5)).toString(),parseInt("0x"+e.substr(25,5)).toString()],t=[a[0].substr(0,1),a[0].substr(1,2),a[0].substr(3,1),a[0].substr(4,2),a[1].substr(0,1),a[1].substr(1,2),a[1].substr(3,1),a[1].substr(4,2),a[2].substr(0,1),a[2].substr(1,2),a[2].substr(3,1),a[2].substr(4,2),a[3].substr(0,1),a[3].substr(1,2),a[3].substr(3,1),a[3].substr(4,2),a[4].substr(0,1),a[4].substr(1,2),a[4].substr(3,1),a[4].substr(4,2),a[5].substr(0,1),a[5].substr(1,2),a[5].substr(3,1),a[5].substr(4,2)];return parseInt(t[f-1])},toChinaYear:function(b){var f=parseInt((b/1e3).toString()),e=parseInt((b%1e3/100).toString()),a=parseInt((b%100/10).toString()),t=b%10;return c.nStr4[f]+c.nStr4[e]+c.nStr4[a]+c.nStr4[t]+"年"},toChinaMonth:function(b){if(b>12||b<1)return-1;var f=c.nStr3[b-1];return f+="月"},toChinaDay:function(b){var f;switch(b){case 10:f="初十";break;case 20:f="二十";break;case 30:f="三十";break;default:f=c.nStr2[Math.floor(b/10)],f+=c.nStr1[b%10]}return f},getAnimal:function(b){return c.animals[(b-4)%12]},solar2lunar:function(e,a,t){if(e<1900||e>2100)return-1;if(1900==e&&1==a&&t<31)return-1;if(e)r=new Date(e,parseInt(a.toString())-1,t);else var r=new Date;var n,d=0,s=(e=r.getFullYear(),a=r.getMonth()+1,t=r.getDate(),(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate())-Date.UTC(1900,0,31))/864e5);for(n=1900;n<2101&&s>0;n++)s-=d=c.lYearDays(n);s<0&&(s+=d,n--);var u=new Date,o=!1;u.getFullYear()==e&&u.getMonth()+1==a&&u.getDate()==t&&(o=!0);var i=r.getDay(),l=c.nStr1[i];0==i&&(i=7);var h=n,g=c.leapMonth(n),D=!1;for(n=1;n<13&&s>0;n++)g>0&&n==g+1&&0==D?(--n,D=!0,d=c.leapDays(h)):d=c.monthDays(h,n),1==D&&n==g+1&&(D=!1),s-=d;0==s&&g>0&&n==g+1&&(D?D=!1:(D=!0,--n)),s<0&&(s+=d,--n);var v=n,m=s+1,p=a-1,y=c.getTerm(e,3),S=c.toGanZhi(e-4),T=new Date(e,1,y).getTime();new Date(e,p,t).getTime()<T&&(S=c.toGanZhi(e-5));var I=c.getTerm(e,2*a-1),M=c.getTerm(e,2*a),C=c.toGanZhi(12*(e-1900)+a+11);t>=I&&(C=c.toGanZhi(12*(e-1900)+a+12));var Y=!1,w="";I==t&&(Y=!0,w=c.lunarTerm[2*a-2]),M==t&&(Y=!0,w=c.lunarTerm[2*a-1]);var x=Date.UTC(e,p,1,0,0,0,0)/864e5+25567+10,U=c.toGanZhi(x+t-1),G=b[v]&&b[v][m]?b[v][m]:"";[2022,2025,2026,2027,2028,2029,2031,2032].includes(e)&&12===v&&29===m&&(G="除夕");var Z=f[a]&&f[a][t]?f[a][t]:"";return{lYear:h,lMonth:v,lDay:m,animal:c.getAnimal(h),yearCn:c.toChinaYear(h),monthCn:(D&&g===v?"闰":"")+c.toChinaMonth(v),dayCn:c.toChinaDay(m),cYear:e,cMonth:a,cDay:t,gzYear:S,gzMonth:C,gzDay:U,isToday:o,isLeap:D,nWeek:i,ncWeek:"星期"+l,isTerm:Y,term:w,lunarFestival:G,festival:Z}},lunar2solar:function(b,f,e,a){var t=c.leapMonth(b);if(c.leapDays(b),a&&t!=f)return-1;if(2100==b&&12==f&&e>1||1900==b&&1==f&&e<31)return-1;var r=c.monthDays(b,f);if(b<1900||b>2100||e>r)return-1;for(var n=0,d=1900;d<b;d++)n+=c.lYearDays(d);var s=0,u=!1;for(d=1;d<f;d++)s=c.leapMonth(b),u||s<=d&&s>0&&(n+=c.leapDays(b),u=!0),n+=c.monthDays(b,d);a&&(n+=r);var o=Date.UTC(1900,1,30,0,0,0),i=new Date(864e5*(n+e-31)+o),l=i.getUTCFullYear(),h=i.getUTCMonth()+1,g=i.getUTCDate();return c.solar2lunar(l,h,g)}};var e=c;export{e as default};
@@ -0,0 +1 @@
1
+ {"name":"solarlunar-es","version":"1.0.9","description":"一个公历农历转化工具,支持esmodule","main":"./dist/solarlunar.cjs.js","module":"./dist/solarlunar.esm.js","types":"./dist/solarlunar.d.ts","scripts":{"build":"rollup -c","test":"mocha"},"files":["dist"],"keywords":["solarlunar","esm","公历农历转换"],"repository":{"type":"git","url":"https://github.com/qiuquanwu/solarlunar-es"},"author":"qiuquanwu","license":"ISC","devDependencies":{"@babel/core":"^7.12.10","@rollup/plugin-commonjs":"^17.1.0","@rollup/plugin-node-resolve":"^11.1.0","rollup":"^2.38.1","rollup-plugin-babel":"^4.4.0","rollup-plugin-dts":"^4.1.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-typescript":"^1.0.1","typescript":"^4.5.5","chai":"^4.3.6","mocha":"^9.2.1"},"_lastModified":"2026-05-21T22:21:30.580Z"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import dayjs from 'dayjs';
10
+ export declare const toEvents: (data: any[], fieldNames: any, fallbackTitle?: string) => {
11
+ id: any;
12
+ title: any;
13
+ start: Date;
14
+ end: Date;
15
+ }[];
16
+ export declare const getLunarDay: (date: dayjs.Dayjs | string) => string | number;
17
+ export declare const formatDate: (date: dayjs.Dayjs) => string;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var calendar_exports = {};
38
+ __export(calendar_exports, {
39
+ formatDate: () => formatDate,
40
+ getLunarDay: () => getLunarDay,
41
+ toEvents: () => toEvents
42
+ });
43
+ module.exports = __toCommonJS(calendar_exports);
44
+ var import_dayjs = __toESM(require("dayjs"));
45
+ var import_lodash = require("lodash");
46
+ var import_solarlunar_es = __toESM(require("solarlunar-es"));
47
+ const toEvents = (data, fieldNames, fallbackTitle = "Untitle") => {
48
+ return data == null ? void 0 : data.map((item) => {
49
+ return {
50
+ id: (0, import_lodash.get)(item, fieldNames.id || "id"),
51
+ title: (0, import_lodash.get)(item, fieldNames.title) || fallbackTitle,
52
+ start: new Date((0, import_lodash.get)(item, fieldNames.start)),
53
+ end: new Date((0, import_lodash.get)(item, fieldNames.end || fieldNames.start))
54
+ };
55
+ });
56
+ };
57
+ const getLunarDay = (date) => {
58
+ const md = (0, import_dayjs.default)(date);
59
+ const result = import_solarlunar_es.default.solar2lunar(md.year(), md.month() + 1, md.date());
60
+ return typeof result !== "number" ? result.lunarFestival || result.term || result.dayCn : result;
61
+ };
62
+ const formatDate = (date) => {
63
+ return date.format("YYYY-MM-DDTHH:mm:ss.SSSZ");
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ formatDate,
68
+ getLunarDay,
69
+ toEvents
70
+ });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-calendar",
3
- "version": "2.1.0-alpha.4",
3
+ "version": "2.1.0-alpha.40",
4
4
  "displayName": "Calendar",
5
5
  "displayName.ru-RU": "Календарь",
6
6
  "displayName.zh-CN": "日历",
7
7
  "description": "Provides callendar collection template and block for managing date data, typically for date/time related information such as events, appointments, tasks, and so on.",
8
8
  "description.ru-RU": "Предоставляет шаблон коллекции календаря и блок для управления данными дат — такими как события, встречи, задачи и другие связанные с датой/временем данные.",
9
9
  "description.zh-CN": "提供日历数据表模板和区块,用于管理日期数据,通常用于事件、约会、任务等与日期/时间相关的信息。",
10
- "license": "AGPL-3.0",
10
+ "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/handbook/calendar",
13
13
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/calendar",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@nocobase/client": "2.x",
34
+ "@nocobase/client-v2": "2.x",
34
35
  "@nocobase/database": "2.x",
35
36
  "@nocobase/server": "2.x"
36
37
  },
@@ -39,7 +40,7 @@
39
40
  "url": "git+https://github.com/nocobase/nocobase.git",
40
41
  "directory": "packages/plugins/calendar"
41
42
  },
42
- "gitHead": "32c682485e5f1878b9165be2e9de18000d98f935",
43
+ "gitHead": "e73f99dd0abefe847f2e50ff0fea1f41a82fd048",
43
44
  "keywords": [
44
45
  "Collections",
45
46
  "Blocks"
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- (self.webpackChunk_nocobase_plugin_calendar=self.webpackChunk_nocobase_plugin_calendar||[]).push([["453"],{606:function(e,t,n){"use strict";var r=n(561).default;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"add",{enumerable:!0,get:function(){return u.add}}),t.ceil=function(e,t){var n=u.startOf(e,t);return u.eq(n,e)?n:u.add(n,1,t)},t.diff=function(e,t,n){return n&&"milliseconds"!==n?Math.round(Math.abs(+u.startOf(e,n)/o[n]-+u.startOf(t,n)/o[n])):Math.abs(+e-+t)},t.duration=function(e,t,n,r){return"day"===n&&(n="date"),Math.abs(u[n](e,void 0,r)-u[n](t,void 0,r))},Object.defineProperty(t,"endOf",{enumerable:!0,get:function(){return u.endOf}}),Object.defineProperty(t,"eq",{enumerable:!0,get:function(){return u.eq}}),t.eqTime=function(e,t){return u.hours(e)===u.hours(t)&&u.minutes(e)===u.minutes(t)&&u.seconds(e)===u.seconds(t)},t.firstVisibleDay=i,Object.defineProperty(t,"gt",{enumerable:!0,get:function(){return u.gt}}),Object.defineProperty(t,"gte",{enumerable:!0,get:function(){return u.gte}}),Object.defineProperty(t,"hours",{enumerable:!0,get:function(){return u.hours}}),Object.defineProperty(t,"inRange",{enumerable:!0,get:function(){return u.inRange}}),t.isJustDate=function(e){return 0===u.hours(e)&&0===u.minutes(e)&&0===u.seconds(e)&&0===u.milliseconds(e)},t.lastVisibleDay=s,Object.defineProperty(t,"lt",{enumerable:!0,get:function(){return u.lt}}),Object.defineProperty(t,"lte",{enumerable:!0,get:function(){return u.lte}}),Object.defineProperty(t,"max",{enumerable:!0,get:function(){return u.max}}),t.merge=function(e,t){return null==t&&null==e?null:(null==t&&(t=new Date),null==e&&(e=new Date),e=u.startOf(e,"day"),e=u.hours(e,u.hours(t)),e=u.minutes(e,u.minutes(t)),e=u.seconds(e,u.seconds(t)),u.milliseconds(e,u.milliseconds(t)))},Object.defineProperty(t,"milliseconds",{enumerable:!0,get:function(){return u.milliseconds}}),Object.defineProperty(t,"min",{enumerable:!0,get:function(){return u.min}}),Object.defineProperty(t,"minutes",{enumerable:!0,get:function(){return u.minutes}}),Object.defineProperty(t,"month",{enumerable:!0,get:function(){return u.month}}),t.monthsInYear=function(e){var t=new Date(e,0,1);return a.map(function(e){return u.month(t,e)})},Object.defineProperty(t,"neq",{enumerable:!0,get:function(){return u.neq}}),t.range=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"day",r=e,o=[];u.lte(r,t,n);)o.push(r),r=u.add(r,1,n);return o},Object.defineProperty(t,"seconds",{enumerable:!0,get:function(){return u.seconds}}),Object.defineProperty(t,"startOf",{enumerable:!0,get:function(){return u.startOf}}),t.today=function(){return u.startOf(new Date,"day")},t.tomorrow=function(){return u.add(u.startOf(new Date,"day"),1,"day")},t.total=function(e,t){var n=e.getTime(),r=1;switch(t){case"week":r*=7;case"day":r*=24;case"hours":r*=60;case"minutes":r*=60;case"seconds":r*=1e3}return n/r},t.visibleDays=function(e,t){for(var n=i(e,t),r=s(e,t),o=[];u.lte(n,r,"day");)o.push(n),n=u.add(n,1,"day");return o},t.week=function(e){var t=new Date(e);return t.setHours(0,0,0),t.setDate(t.getDate()+4-(t.getDay()||7)),Math.ceil(((t-new Date(t.getFullYear(),0,1))/864e5+1)/7)},t.yesterday=function(){return u.add(u.startOf(new Date,"day"),-1,"day")};var u=r(n(63)),o={seconds:1e3,minutes:6e4,hours:36e5,day:864e5},a=[0,1,2,3,4,5,6,7,8,9,10,11];function i(e,t){var n=u.startOf(e,"month");return u.startOf(n,"week",t.startOfWeek())}function s(e,t){var n=u.endOf(e,"month");return u.endOf(n,"week",t.startOfWeek())}},561:function(e,t,n){var r=n(265).default;function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}e.exports=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=r(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&({}).hasOwnProperty.call(e,i)){var s=a?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o},e.exports.__esModule=!0,e.exports.default=e.exports},265:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}}]);