@calenderjs/core 0.3.1 → 0.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CalenderJS Contributors
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,22 @@
1
+ import { Event } from '@calenderjs/event-model';
2
+ /**
3
+ * 判断事件是否在指定日期
4
+ */
5
+ export declare function isAppointmentOnDate(appointment: Event, date: Date): boolean;
6
+ /**
7
+ * 判断事件是否在指定时间范围内
8
+ */
9
+ export declare function isAppointmentInTimeRange(appointment: Event, startTime: Date, endTime: Date): boolean;
10
+ /**
11
+ * 按日期分组事件
12
+ */
13
+ export declare function groupAppointmentsByDate(appointments: Event[]): Map<string, Event[]>;
14
+ /**
15
+ * 计算事件在时间轴上的位置(top,单位:px)
16
+ */
17
+ export declare function calculateAppointmentTop(appointment: Event, slotHeight: number, slotDuration: number): number;
18
+ /**
19
+ * 计算事件的高度(单位:px)
20
+ */
21
+ export declare function calculateAppointmentHeight(appointment: Event, slotHeight: number, slotDuration: number): number;
22
+ //# sourceMappingURL=appointment-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appointment-utils.d.ts","sourceRoot":"","sources":["../../src/utils/appointment-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAY3E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,GACZ,OAAO,CAKT;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,KAAK,EAAE,GACpB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAmBtB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,KAAK,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,KAAK,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAMR"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 工具函数导出
3
+ */
4
+ export * from './appointment-utils';
5
+ export * from './recurring-utils';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Event, RecurringRule } from '@calenderjs/event-model';
2
+ /**
3
+ * 生成重复事件实例
4
+ *
5
+ * @param parentEvent 父事件(原始事件)
6
+ * @param recurringRule 重复规则
7
+ * @returns 生成的重复事件实例数组
8
+ */
9
+ export declare function generateRecurringInstances(parentEvent: Event, recurringRule: RecurringRule): Event[];
10
+ //# sourceMappingURL=recurring-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recurring-utils.d.ts","sourceRoot":"","sources":["../../src/utils/recurring-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,KAAK,EAClB,aAAa,EAAE,aAAa,GAC3B,KAAK,EAAE,CAsGT"}
@@ -0,0 +1,67 @@
1
+ import { Event } from '@calenderjs/event-model';
2
+ /**
3
+ * 验证时间范围是否有效
4
+ *
5
+ * @param startTime 开始时间
6
+ * @param endTime 结束时间
7
+ * @returns 是否有效
8
+ */
9
+ export declare function isValidTimeRange(startTime: Date, endTime: Date): boolean;
10
+ /**
11
+ * 计算持续时间(分钟数)
12
+ *
13
+ * @param startTime 开始时间
14
+ * @param endTime 结束时间
15
+ * @returns 持续时间(分钟数)
16
+ */
17
+ export declare function calculateDuration(startTime: Date, endTime: Date): number;
18
+ /**
19
+ * 检查两个事件是否有时间冲突(支持全天事件)
20
+ *
21
+ * @param event1 第一个事件
22
+ * @param event2 第二个事件
23
+ * @returns 是否有冲突
24
+ */
25
+ export declare function hasTimeConflict(event1: Event, event2: Event): boolean;
26
+ /**
27
+ * 时区转换
28
+ *
29
+ * @param date 日期时间
30
+ * @param fromTimeZone 源时区(IANA 时区标识符)
31
+ * @param toTimeZone 目标时区(IANA 时区标识符)
32
+ * @returns 转换后的日期时间
33
+ */
34
+ export declare function convertTimeZone(date: Date, fromTimeZone: string, toTimeZone: string): Date;
35
+ /**
36
+ * 判断是否在工作时间
37
+ *
38
+ * @param date 日期时间
39
+ * @param startHour 工作开始时间(小时,默认 9)
40
+ * @param endHour 工作结束时间(小时,默认 18)
41
+ * @param useUTC 是否使用 UTC 时间(默认 true)
42
+ * @returns 是否在工作时间
43
+ */
44
+ export declare function isBusinessHours(date: Date, startHour?: number, endHour?: number, useUTC?: boolean): boolean;
45
+ /**
46
+ * 判断是否是工作日
47
+ *
48
+ * @param date 日期
49
+ * @returns 是否是工作日(周一到周五)
50
+ */
51
+ export declare function isBusinessDay(date: Date): boolean;
52
+ /**
53
+ * 判断是否是周末
54
+ *
55
+ * @param date 日期
56
+ * @returns 是否是周末(周六或周日)
57
+ */
58
+ export declare function isWeekend(date: Date): boolean;
59
+ /**
60
+ * 计算两个日期之间的天数
61
+ *
62
+ * @param date1 第一个日期
63
+ * @param date2 第二个日期
64
+ * @returns 天数差(正数表示 date2 在 date1 之后)
65
+ */
66
+ export declare function daysBetween(date1: Date, date2: Date): number;
67
+ //# sourceMappingURL=time-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-utils.d.ts","sourceRoot":"","sources":["../../src/utils/time-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAUxE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,CAMxE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAwDrE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,IAAI,CAsDN;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,SAAS,GAAE,MAAU,EACrB,OAAO,GAAE,MAAW,EACpB,MAAM,GAAE,OAAc,GACrB,OAAO,CAGT;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAIjD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAI7C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,CAQ5D"}
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "@calenderjs/core",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "CalenderJS 核心日历组件库 - 基于 Web Components",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/calenderjs/calenderjs.git",
9
+ "directory": "packages/core"
10
+ },
11
+ "homepage": "https://github.com/calenderjs/calenderjs/tree/main/packages/core#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/calenderjs/calenderjs/issues"
14
+ },
5
15
  "type": "module",
6
16
  "main": "./dist/index.cjs",
7
17
  "module": "./dist/index.mjs",
@@ -25,14 +35,14 @@
25
35
  "access": "public"
26
36
  },
27
37
  "dependencies": {
28
- "@calenderjs/date-time": "0.3.1",
29
- "@calenderjs/event-model": "0.3.1"
38
+ "@calenderjs/date-time": "0.4.0",
39
+ "@calenderjs/event-model": "0.4.0"
30
40
  },
31
41
  "devDependencies": {
32
42
  "@types/node": "^20.19.27",
33
43
  "@vitest/coverage-v8": "^2.1.9",
34
44
  "typescript": "^5.9.3",
35
- "vite": "^7.3.0",
45
+ "vite": "^7.3.8",
36
46
  "vite-plugin-dts": "^4.5.4",
37
47
  "vitest": "^2.1.9"
38
48
  },