@visactor/vtable-calendar 1.7.6

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 (52) hide show
  1. package/README.md +67 -0
  2. package/cjs/custom/custom-handler.d.ts +46 -0
  3. package/cjs/custom/custom-handler.js +147 -0
  4. package/cjs/custom/custom-handler.js.map +1 -0
  5. package/cjs/custom/custom-layout.d.ts +6 -0
  6. package/cjs/custom/custom-layout.js +112 -0
  7. package/cjs/custom/custom-layout.js.map +1 -0
  8. package/cjs/date-util.d.ts +10 -0
  9. package/cjs/date-util.js +99 -0
  10. package/cjs/date-util.js.map +1 -0
  11. package/cjs/event/type.d.ts +39 -0
  12. package/cjs/event/type.js +12 -0
  13. package/cjs/event/type.js.map +1 -0
  14. package/cjs/index.d.ts +3 -0
  15. package/cjs/index.js +30 -0
  16. package/cjs/index.js.map +1 -0
  17. package/cjs/month-calendar.d.ts +65 -0
  18. package/cjs/month-calendar.js +177 -0
  19. package/cjs/month-calendar.js.map +1 -0
  20. package/cjs/style.d.ts +13 -0
  21. package/cjs/style.js +54 -0
  22. package/cjs/style.js.map +1 -0
  23. package/cjs/table/table-option.d.ts +7 -0
  24. package/cjs/table/table-option.js +61 -0
  25. package/cjs/table/table-option.js.map +1 -0
  26. package/dist/vtable-calendar.js +54526 -0
  27. package/dist/vtable-calendar.min.js +1 -0
  28. package/es/custom/custom-handler.d.ts +46 -0
  29. package/es/custom/custom-handler.js +140 -0
  30. package/es/custom/custom-handler.js.map +1 -0
  31. package/es/custom/custom-layout.d.ts +6 -0
  32. package/es/custom/custom-layout.js +105 -0
  33. package/es/custom/custom-layout.js.map +1 -0
  34. package/es/date-util.d.ts +10 -0
  35. package/es/date-util.js +88 -0
  36. package/es/date-util.js.map +1 -0
  37. package/es/event/type.d.ts +39 -0
  38. package/es/event/type.js +8 -0
  39. package/es/event/type.js.map +1 -0
  40. package/es/index.d.ts +3 -0
  41. package/es/index.js +4 -0
  42. package/es/index.js.map +1 -0
  43. package/es/month-calendar.d.ts +65 -0
  44. package/es/month-calendar.js +181 -0
  45. package/es/month-calendar.js.map +1 -0
  46. package/es/style.d.ts +13 -0
  47. package/es/style.js +45 -0
  48. package/es/style.js.map +1 -0
  49. package/es/table/table-option.d.ts +7 -0
  50. package/es/table/table-option.js +58 -0
  51. package/es/table/table-option.js.map +1 -0
  52. package/package.json +87 -0
@@ -0,0 +1,181 @@
1
+ import { ListTable, EventTarget } from "@visactor/vtable";
2
+
3
+ import { defaultDayTitles, getRecords, getStartAndEndDate } from "./date-util";
4
+
5
+ import { add, differenceInDays, previousSunday, startOfDay } from "date-fns";
6
+
7
+ import { getMonthCustomStyleRange } from "./style";
8
+
9
+ import { createTableOption } from "./table/table-option";
10
+
11
+ import { CustomEventHandler } from "./custom/custom-handler";
12
+
13
+ import { CALENDAR_EVENT_TYPE } from "./event/type";
14
+
15
+ import { isArray } from "@visactor/vutils";
16
+
17
+ export class Calendar extends EventTarget {
18
+ constructor(container, options) {
19
+ super(), this.minCol = 0, this.container = container, this.options = null != options ? options : {};
20
+ const {startDate: startDate, endDate: endDate, currentDate: currentDate, rangeDays: rangeDays} = this.options;
21
+ if (this.currentDate = null != currentDate ? currentDate : new Date, this.rangeDays = null != rangeDays ? rangeDays : 90,
22
+ startDate && endDate) this.startDate = startDate, this.endDate = endDate; else {
23
+ const {startDate: computedStartDate, endDate: computedEndDate} = getStartAndEndDate(this.currentDate, this.rangeDays);
24
+ this.startDate = null != startDate ? startDate : computedStartDate, this.endDate = null != endDate ? endDate : computedEndDate;
25
+ }
26
+ this.tableStartDate = 0 === this.startDate.getDay() ? this.startDate : previousSunday(this.startDate),
27
+ this.customHandler = new CustomEventHandler(this, null == options ? void 0 : options.customEventOptions),
28
+ this._createTable(), this._bindEvent(), this.options.customEvents && this.addCustomEvents(this.options.customEvents);
29
+ }
30
+ _createTable() {
31
+ const {dayTitles: dayTitles} = this.options, records = getRecords(this.startDate, this.endDate);
32
+ this.records = records;
33
+ const week = null != dayTitles ? dayTitles : defaultDayTitles;
34
+ this.maxCol = week.length - 1;
35
+ const option = createTableOption(week, this.currentDate, {
36
+ tableOptions: this.options.tableOptions,
37
+ containerWidth: this.container.clientWidth,
38
+ containerHeight: this.container.clientHeight
39
+ });
40
+ option.records = records, option.container = this.container, option._calendar = this;
41
+ const tableInstance = new ListTable(option);
42
+ this.table = tableInstance, tableInstance.addEventListener("scroll", (() => {
43
+ const record = this.getYearAndMonth();
44
+ if (!record.Sun) return void this._updateMonthCustomStyle(this.startDate.getFullYear(), this.startDate.getMonth());
45
+ const firstDateInWeek = new Date(record.year, record.month, record.Sun), lastDateInNextWeek = add(firstDateInWeek, {
46
+ days: 13
47
+ });
48
+ this._updateMonthCustomStyle(lastDateInNextWeek.getFullYear(), lastDateInNextWeek.getMonth());
49
+ })), tableInstance.addEventListener("scroll_vertical_end", (() => {
50
+ this._updateMonthCustomStyle(this.endDate.getFullYear(), this.endDate.getMonth());
51
+ })), this.jumpToCurrentMonth();
52
+ }
53
+ getYearAndMonth() {
54
+ const x = this.table.tableX + 10, y = this.table.tableY + this.table.getFrozenRowsHeight() + 10, topRow = this.table.getCellAtRelativePosition(x, y), {row: row} = topRow;
55
+ return this.table.getCellRawRecord(0, row);
56
+ }
57
+ jumpToDate(date, animation) {
58
+ date = startOfDay(date);
59
+ const dataIndex = Math.floor((differenceInDays(date, this.tableStartDate) + 1) / 7);
60
+ this.table.scrollToCell({
61
+ col: 0,
62
+ row: dataIndex + 1
63
+ }, animation), this._updateMonthCustomStyle(date.getFullYear(), date.getMonth());
64
+ }
65
+ jumpToCurrentMonth(animation) {
66
+ const topDate = new Date(this.currentDate.getTime());
67
+ topDate.setDate(1), this.jumpToDate(topDate, animation);
68
+ }
69
+ _updateMonthCustomStyle(year, month) {
70
+ var _a;
71
+ this.currentMonth === month && this.currentYear === year || (null === (_a = this.currentMonthCellRanges) || void 0 === _a || _a.forEach((range => {
72
+ this.table.arrangeCustomCellStyle(range, null);
73
+ })), this.currentMonth = month, this.currentYear = year, this.currentMonthCellRanges = getMonthCustomStyleRange(year, month, this.tableStartDate, this.records),
74
+ this.currentMonthCellRanges.forEach((range => {
75
+ this.table.arrangeCustomCellStyle(range, "current-month");
76
+ })));
77
+ }
78
+ fireListeners(type, event) {
79
+ return super.fireListeners(type, event);
80
+ }
81
+ on(type, listener) {
82
+ return super.on(type, listener);
83
+ }
84
+ _bindEvent() {
85
+ const titleComponent = this.table.internalProps.title.getComponentGraphic();
86
+ titleComponent.setAttributes({
87
+ cursor: "pointer",
88
+ childrenPickable: !1
89
+ }), this.titleClickHandler = (() => {
90
+ this.jumpToCurrentMonth({
91
+ duration: 500
92
+ });
93
+ }).bind(this), titleComponent.addEventListener("click", this.titleClickHandler),
94
+ this.table.on("click_cell", (e => {
95
+ const {target: target} = e;
96
+ "calendar-custom-event" === target._role ? this.fireListeners(CALENDAR_EVENT_TYPE.CALENDAR_CUSTOM_EVENT_CLICK, {
97
+ tableEvent: e,
98
+ date: this.getCellDate(e.col, e.row),
99
+ customEvent: target._customEvent
100
+ }) : this.table.isHeader(e.col, e.row) || this.fireListeners(CALENDAR_EVENT_TYPE.CALENDAR_DATE_CLICK, {
101
+ tableEvent: e,
102
+ date: this.getCellDate(e.col, e.row)
103
+ });
104
+ })), this.table.on("selected_cell", (e => {
105
+ this.table.isHeader(e.col, e.row) || this.fireListeners(CALENDAR_EVENT_TYPE.SELECTED_DATE, {
106
+ tableEvent: e,
107
+ date: this.getCellDate(e.col, e.row)
108
+ });
109
+ })), this.table.on("selected_clear", (() => {
110
+ this.fireListeners(CALENDAR_EVENT_TYPE.SELECTED_DATE_CLEAR, void 0);
111
+ })), this.table.on("drag_select_end", (e => {
112
+ const {cells: cells} = e, dates = [];
113
+ cells.map((row => {
114
+ row.map((cell => {
115
+ this.table.isHeader(cell.col, cell.row) || dates.push(this.getCellDate(cell.col, cell.row));
116
+ }));
117
+ })), this.fireListeners(CALENDAR_EVENT_TYPE.DRAG_SELECT_DATE_END, {
118
+ tableEvent: e,
119
+ dates: dates
120
+ });
121
+ }));
122
+ }
123
+ release() {
124
+ this.table.release();
125
+ }
126
+ getCellLocation(date) {
127
+ date = startOfDay(date);
128
+ return {
129
+ row: Math.floor((differenceInDays(date, this.tableStartDate) + 1) / 7) + 1,
130
+ col: date.getDay()
131
+ };
132
+ }
133
+ getCellDate(col, row) {
134
+ return add(this.tableStartDate, {
135
+ days: 7 * (row - 1) + col
136
+ });
137
+ }
138
+ get selectedDate() {
139
+ const cells = this.table.getSelectedCellInfos();
140
+ if (!isArray(cells) || 0 === cells.length) return [];
141
+ const dates = [];
142
+ return cells.map((row => {
143
+ row.map((cell => {
144
+ this.table.isHeader(cell.col, cell.row) || dates.push({
145
+ date: this.getCellDate(cell.col, cell.row),
146
+ col: cell.col,
147
+ row: cell.row
148
+ });
149
+ }));
150
+ })), dates;
151
+ }
152
+ addCustomEvent(event) {
153
+ this.customHandler.addEvent(event), this.table.scenegraph.updateNextFrame();
154
+ }
155
+ removeCustomEvent(id) {
156
+ this.customHandler.removeEvents([ id ]), this.table.scenegraph.updateNextFrame();
157
+ }
158
+ updateCustomEvent(event) {
159
+ this.customHandler.updateEvents([ event ]), this.table.scenegraph.updateNextFrame();
160
+ }
161
+ addCustomEvents(events) {
162
+ this.customHandler.addEvents(events), this.table.scenegraph.updateNextFrame();
163
+ }
164
+ removeCustomEvents(ids) {
165
+ this.customHandler.removeEvents(ids), this.table.scenegraph.updateNextFrame();
166
+ }
167
+ updateCustomEvents(events) {
168
+ this.customHandler.updateEvents(events), this.table.scenegraph.updateNextFrame();
169
+ }
170
+ getCellCustomEventByDate(date) {
171
+ const location = this.getCellLocation(date);
172
+ return this.getCellCustomEventByLocation(location.col, location.row);
173
+ }
174
+ getCellCustomEventByLocation(col, row) {
175
+ const cellEvent = this.customHandler.getCellCustomEvent(col, row), events = [];
176
+ return null == cellEvent || cellEvent.keys.forEach((key => {
177
+ events.push(cellEvent.values[key]);
178
+ })), events;
179
+ }
180
+ }
181
+ //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M,GAAiB,EAAE,CAAC;QAChC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","file":"month-calendar.js","sourcesContent":["import { ListTable, EventTarget } from '@visactor/vtable';\nimport type { DateRecord, DateRecordKeys } from './date-util';\nimport { defaultDayTitles, getRecords, getStartAndEndDate } from './date-util';\nimport { bindDebugTool } from '../../vtable/src/scenegraph/debug-tool';\nimport { add, differenceInDays, previousSunday, startOfDay } from 'date-fns';\nimport { getMonthCustomStyleRange } from './style';\nimport type { TYPES, ListTableConstructorOptions } from '@visactor/vtable';\nimport { createTableOption } from './table/table-option';\nimport type { ICustomEvent, ICustomEventOptions, IEventData } from './custom/custom-handler';\nimport { CustomEventHandler } from './custom/custom-handler';\nimport type {\n CalendarEventHandlersEventArgumentMap,\n CalendarEventHandlersReturnMap,\n CalendarEventListener\n} from './event/type';\nimport { CALENDAR_EVENT_TYPE } from './event/type';\nimport type { EventListenerId } from '@visactor/vtable/src/ts-types';\nimport { isArray } from '@visactor/vutils';\n\nexport interface CalendarConstructorOptions {\n startDate?: Date;\n endDate?: Date;\n currentDate?: Date;\n rangeDays?: number;\n\n dayTitles?: [string, string, string, string, string, string, string];\n\n tableOptions?: ListTableConstructorOptions;\n\n customEvents?: ICustomEvent[];\n customEventOptions?: ICustomEventOptions;\n}\n\nexport class Calendar extends EventTarget {\n container: HTMLElement;\n options: CalendarConstructorOptions;\n table: ListTable;\n startDate: Date;\n endDate: Date;\n currentDate: Date;\n rangeDays: number;\n tableStartDate: Date;\n records: DateRecord[];\n currentMonthCellRanges: { range: TYPES.CellRange }[];\n currentMonth: number;\n currentYear: number;\n\n titleClickHandler: () => void;\n\n maxCol: number;\n minCol: number = 0;\n customHandler: CustomEventHandler;\n\n constructor(container: HTMLElement, options?: CalendarConstructorOptions) {\n super();\n this.container = container;\n this.options = options ?? {};\n const { startDate, endDate, currentDate, rangeDays } = this.options;\n\n this.currentDate = currentDate ?? new Date();\n this.rangeDays = rangeDays ?? 90;\n if (startDate && endDate) {\n this.startDate = startDate;\n this.endDate = endDate;\n } else {\n const { startDate: computedStartDate, endDate: computedEndDate } = getStartAndEndDate(\n this.currentDate,\n this.rangeDays\n );\n this.startDate = startDate ?? computedStartDate;\n this.endDate = endDate ?? computedEndDate;\n }\n this.tableStartDate = this.startDate.getDay() === 0 ? this.startDate : previousSunday(this.startDate);\n\n this.customHandler = new CustomEventHandler(this, options?.customEventOptions);\n\n this._createTable();\n\n this._bindEvent();\n\n if (this.options.customEvents) {\n this.addCustomEvents(this.options.customEvents);\n }\n }\n\n _createTable() {\n const { dayTitles } = this.options;\n\n const records = getRecords(this.startDate, this.endDate);\n this.records = records;\n\n const week = (dayTitles ?? defaultDayTitles) as DateRecordKeys[];\n this.maxCol = week.length - 1;\n const option = createTableOption(week, this.currentDate, {\n tableOptions: this.options.tableOptions,\n containerWidth: this.container.clientWidth,\n containerHeight: this.container.clientHeight\n });\n option.records = records;\n option.container = this.container;\n (option as any)._calendar = this;\n\n const tableInstance = new ListTable(option);\n this.table = tableInstance;\n\n tableInstance.addEventListener('scroll', () => {\n const record: DateRecord = this.getYearAndMonth();\n if (!record.Sun) {\n // top\n this._updateMonthCustomStyle(this.startDate.getFullYear(), this.startDate.getMonth());\n return;\n }\n const firstDateInWeek = new Date(record.year, record.month, record.Sun);\n const lastDateInNextWeek = add(firstDateInWeek, {\n days: 13\n });\n this._updateMonthCustomStyle(lastDateInNextWeek.getFullYear(), lastDateInNextWeek.getMonth());\n });\n\n tableInstance.addEventListener('scroll_vertical_end', () => {\n this._updateMonthCustomStyle(this.endDate.getFullYear(), this.endDate.getMonth());\n });\n\n this.jumpToCurrentMonth();\n\n // bindDebugTool(tableInstance.scenegraph.stage as any, {\n // customGrapicKeys: ['col', 'row']\n // });\n }\n\n getYearAndMonth() {\n const x = this.table.tableX + 10; // buffer\n const y = this.table.tableY + this.table.getFrozenRowsHeight() + 10; // buffer\n const topRow = this.table.getCellAtRelativePosition(x, y);\n const { row } = topRow;\n const record = this.table.getCellRawRecord(0, row);\n return record;\n }\n\n jumpToDate(date: Date, animation?: boolean | TYPES.ITableAnimationOption) {\n date = startOfDay(date);\n const dataIndex = Math.floor((differenceInDays(date, this.tableStartDate) + 1) / 7);\n this.table.scrollToCell(\n {\n col: 0,\n row: dataIndex + 1\n },\n animation\n );\n\n this._updateMonthCustomStyle(date.getFullYear(), date.getMonth());\n }\n\n jumpToCurrentMonth(animation?: boolean | TYPES.ITableAnimationOption) {\n // scroll to current month\n const topDate = new Date(this.currentDate.getTime());\n topDate.setDate(1);\n this.jumpToDate(topDate, animation);\n }\n\n _updateMonthCustomStyle(year: number, month: number) {\n if (this.currentMonth === month && this.currentYear === year) {\n return;\n }\n\n // clear current\n this.currentMonthCellRanges?.forEach(range => {\n this.table.arrangeCustomCellStyle(range, null);\n });\n\n this.currentMonth = month;\n this.currentYear = year;\n this.currentMonthCellRanges = getMonthCustomStyleRange(year, month, this.tableStartDate, this.records);\n this.currentMonthCellRanges.forEach(range => {\n this.table.arrangeCustomCellStyle(range, 'current-month');\n });\n }\n\n // @ts-ignore\n fireListeners<TYPE extends keyof CalendarEventHandlersEventArgumentMap>(\n type: TYPE,\n event: CalendarEventHandlersEventArgumentMap[TYPE]\n ): CalendarEventHandlersReturnMap[TYPE][] {\n // 调用父类的方法\n return super.fireListeners(type as any, event as any);\n }\n\n // @ts-ignore\n on<TYPE extends keyof CalendarEventHandlersEventArgumentMap>(\n type: TYPE,\n listener: CalendarEventListener<TYPE>\n ): EventListenerId {\n // 调用父类的方法\n return super.on(type as any, listener as any);\n }\n\n _bindEvent() {\n // click title jump to current month\n const titleComponent = this.table.internalProps.title.getComponentGraphic();\n titleComponent.setAttributes({\n cursor: 'pointer',\n // hack for cursor\n childrenPickable: false\n });\n this.titleClickHandler = (() => {\n this.jumpToCurrentMonth({\n duration: 500\n });\n }).bind(this);\n titleComponent.addEventListener('click', this.titleClickHandler);\n\n this.table.on('click_cell', e => {\n const { target } = e;\n if ((target as any)._role === 'calendar-custom-event') {\n this.fireListeners(CALENDAR_EVENT_TYPE.CALENDAR_CUSTOM_EVENT_CLICK, {\n tableEvent: e,\n date: this.getCellDate(e.col, e.row),\n customEvent: (target as any)._customEvent\n });\n } else if (!this.table.isHeader(e.col, e.row)) {\n this.fireListeners(CALENDAR_EVENT_TYPE.CALENDAR_DATE_CLICK, {\n tableEvent: e,\n date: this.getCellDate(e.col, e.row)\n });\n }\n });\n\n this.table.on('selected_cell', e => {\n if (!this.table.isHeader(e.col, e.row)) {\n this.fireListeners(CALENDAR_EVENT_TYPE.SELECTED_DATE, {\n tableEvent: e,\n date: this.getCellDate(e.col, e.row)\n });\n }\n });\n\n this.table.on('selected_clear', () => {\n this.fireListeners(CALENDAR_EVENT_TYPE.SELECTED_DATE_CLEAR, undefined);\n });\n\n this.table.on('drag_select_end', e => {\n const { cells } = e;\n const dates: Date[] = [];\n cells.map(row => {\n row.map(cell => {\n if (!this.table.isHeader(cell.col, cell.row)) {\n dates.push(this.getCellDate(cell.col, cell.row));\n }\n });\n });\n this.fireListeners(CALENDAR_EVENT_TYPE.DRAG_SELECT_DATE_END, {\n tableEvent: e,\n dates\n });\n });\n }\n\n release() {\n this.table.release();\n }\n\n getCellLocation(date: Date) {\n date = startOfDay(date);\n const dataIndex = Math.floor((differenceInDays(date, this.tableStartDate) + 1) / 7);\n const row = dataIndex + 1;\n const col = date.getDay();\n\n return {\n row,\n col\n };\n }\n\n getCellDate(col: number, row: number) {\n const startDate = add(this.tableStartDate, {\n days: (row - 1) * 7 + col\n });\n return startDate;\n }\n\n get selectedDate(): { date: Date; col: number; row: number }[] {\n const cells = this.table.getSelectedCellInfos();\n if (!isArray(cells) || cells.length === 0) {\n return [];\n }\n const dates: { date: Date; col: number; row: number }[] = [];\n cells.map(row => {\n row.map(cell => {\n if (!this.table.isHeader(cell.col, cell.row)) {\n dates.push({\n date: this.getCellDate(cell.col, cell.row),\n col: cell.col,\n row: cell.row\n });\n }\n });\n });\n\n return dates;\n }\n\n addCustomEvent(event: ICustomEvent) {\n this.customHandler.addEvent(event);\n this.table.scenegraph.updateNextFrame();\n }\n\n removeCustomEvent(id: string) {\n this.customHandler.removeEvents([id]);\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomEvent(event: ICustomEvent) {\n this.customHandler.updateEvents([event]);\n this.table.scenegraph.updateNextFrame();\n }\n\n addCustomEvents(events: ICustomEvent[]) {\n this.customHandler.addEvents(events);\n this.table.scenegraph.updateNextFrame();\n }\n\n removeCustomEvents(ids: string[]) {\n this.customHandler.removeEvents(ids);\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomEvents(events: ICustomEvent[]) {\n this.customHandler.updateEvents(events);\n this.table.scenegraph.updateNextFrame();\n }\n\n getCellCustomEventByDate(date: Date) {\n const location = this.getCellLocation(date);\n return this.getCellCustomEventByLocation(location.col, location.row);\n }\n\n getCellCustomEventByLocation(col: number, row: number) {\n const cellEvent = this.customHandler.getCellCustomEvent(col, row);\n const events: IEventData[] = [];\n cellEvent?.keys.forEach(key => {\n events.push(cellEvent.values[key]);\n });\n return events;\n }\n}\n"]}
package/es/style.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { DateRecord } from './date-util';
2
+ export declare function getMonthCustomStyleRange(year: number, month: number, tableStartDate: Date, records: DateRecord[]): {
3
+ range: {
4
+ start: {
5
+ col: number;
6
+ row: number;
7
+ };
8
+ end: {
9
+ col: number;
10
+ row: number;
11
+ };
12
+ };
13
+ }[];
package/es/style.js ADDED
@@ -0,0 +1,45 @@
1
+ import { differenceInDays, lastDayOfMonth } from "date-fns";
2
+
3
+ export function getMonthCustomStyleRange(year, month, tableStartDate, records) {
4
+ const startDate = new Date(year, month, 1), startDataIndex = Math.floor((differenceInDays(startDate, tableStartDate) + 1) / 7), startRecord = records[startDataIndex], endDate = lastDayOfMonth(startDate), endDataIndex = Math.floor((differenceInDays(endDate, tableStartDate) + 1) / 7), endRecord = records[endDataIndex], customCellRanges = [ {
5
+ range: {
6
+ start: {
7
+ col: 0,
8
+ row: startDataIndex + 1 + 1
9
+ },
10
+ end: {
11
+ col: 6,
12
+ row: endDataIndex
13
+ }
14
+ }
15
+ } ];
16
+ let startIndex, endIndex;
17
+ 1 === startRecord.Sun ? startIndex = 0 : 1 === startRecord.Mon ? startIndex = 1 : 1 === startRecord.Tue ? startIndex = 2 : 1 === startRecord.Wed ? startIndex = 3 : 1 === startRecord.Thu ? startIndex = 4 : 1 === startRecord.Fri ? startIndex = 5 : 1 === startRecord.Sat && (startIndex = 6),
18
+ customCellRanges.push({
19
+ range: {
20
+ start: {
21
+ col: startIndex,
22
+ row: startDataIndex + 1
23
+ },
24
+ end: {
25
+ col: 6,
26
+ row: startDataIndex + 1
27
+ }
28
+ }
29
+ });
30
+ const monthEndDate = endDate.getDate();
31
+ return endRecord.Sun === monthEndDate ? endIndex = 0 : endRecord.Mon === monthEndDate ? endIndex = 1 : endRecord.Tue === monthEndDate ? endIndex = 2 : endRecord.Wed === monthEndDate ? endIndex = 3 : endRecord.Thu === monthEndDate ? endIndex = 4 : endRecord.Fri === monthEndDate ? endIndex = 5 : endRecord.Sat === monthEndDate && (endIndex = 6),
32
+ customCellRanges.push({
33
+ range: {
34
+ start: {
35
+ col: 0,
36
+ row: endDataIndex + 1
37
+ },
38
+ end: {
39
+ col: endIndex,
40
+ row: endDataIndex + 1
41
+ }
42
+ }
43
+ }), customCellRanges;
44
+ }
45
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG5D,MAAM,UAAU,wBAAwB,CAAC,IAAY,EAAE,KAAa,EAAE,c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E,QAAQ;gBACb,GAAG,EAAE,YAAY,GAAG,CAAC;aACtB;SACF;KACF,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC","file":"style.js","sourcesContent":["import { differenceInDays, lastDayOfMonth } from 'date-fns';\nimport type { DateRecord } from './date-util';\n\nexport function getMonthCustomStyleRange(year: number, month: number, tableStartDate: Date, records: DateRecord[]) {\n const startDate = new Date(year, month, 1);\n const startDataIndex = Math.floor((differenceInDays(startDate, tableStartDate) + 1) / 7);\n const startRecord = records[startDataIndex];\n\n const endDate = lastDayOfMonth(startDate);\n const endDataIndex = Math.floor((differenceInDays(endDate, tableStartDate) + 1) / 7);\n const endRecord = records[endDataIndex];\n\n const customCellRanges = [\n {\n range: {\n start: {\n col: 0,\n row: startDataIndex + 1 + 1\n },\n end: {\n col: 6,\n row: endDataIndex\n }\n }\n }\n ];\n\n let startIndex;\n if (startRecord.Sun === 1) {\n startIndex = 0;\n } else if (startRecord.Mon === 1) {\n startIndex = 1;\n } else if (startRecord.Tue === 1) {\n startIndex = 2;\n } else if (startRecord.Wed === 1) {\n startIndex = 3;\n } else if (startRecord.Thu === 1) {\n startIndex = 4;\n } else if (startRecord.Fri === 1) {\n startIndex = 5;\n } else if (startRecord.Sat === 1) {\n startIndex = 6;\n }\n customCellRanges.push({\n range: {\n start: {\n col: startIndex,\n row: startDataIndex + 1\n },\n end: {\n col: 6,\n row: startDataIndex + 1\n }\n }\n });\n\n let endIndex;\n const monthEndDate = endDate.getDate();\n if (endRecord.Sun === monthEndDate) {\n endIndex = 0;\n } else if (endRecord.Mon === monthEndDate) {\n endIndex = 1;\n } else if (endRecord.Tue === monthEndDate) {\n endIndex = 2;\n } else if (endRecord.Wed === monthEndDate) {\n endIndex = 3;\n } else if (endRecord.Thu === monthEndDate) {\n endIndex = 4;\n } else if (endRecord.Fri === monthEndDate) {\n endIndex = 5;\n } else if (endRecord.Sat === monthEndDate) {\n endIndex = 6;\n }\n\n customCellRanges.push({\n range: {\n start: {\n col: 0,\n row: endDataIndex + 1\n },\n end: {\n col: endIndex,\n row: endDataIndex + 1\n }\n }\n });\n\n return customCellRanges;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import type { ListTableConstructorOptions } from '@visactor/vtable';
2
+ import type { DateRecordKeys } from '../date-util';
3
+ export declare function createTableOption(week: DateRecordKeys[], currentDate: Date, config: {
4
+ tableOptions?: ListTableConstructorOptions;
5
+ containerWidth: number;
6
+ containerHeight: number;
7
+ }): ListTableConstructorOptions;
@@ -0,0 +1,58 @@
1
+ import { themes } from "@visactor/vtable";
2
+
3
+ import { defaultDayTitles, getMonthString, getWeekdayString } from "../date-util";
4
+
5
+ import { calendarCustomLayout } from "../custom/custom-layout";
6
+
7
+ import { merge } from "@visactor/vutils";
8
+
9
+ export function createTableOption(week, currentDate, config) {
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
11
+ const columns = week.map(((item, index) => ({
12
+ field: defaultDayTitles[index],
13
+ title: item,
14
+ fieldFormat: record => {
15
+ if (record.year === currentDate.getFullYear() && record.month === currentDate.getMonth() && record[item] === currentDate.getDate()) return `${record[item]}\nToday`;
16
+ if (1 === record[item]) {
17
+ const monthIndex = "Sun" === item ? record.month : record.month + 1, mouthStr = getMonthString(monthIndex);
18
+ return `${record[item]}\n${mouthStr}`;
19
+ }
20
+ return record[item];
21
+ },
22
+ customLayout: calendarCustomLayout
23
+ }))), rowHeight = Math.floor((config.containerHeight - ((null !== (_d = null === (_c = null === (_b = null === (_a = config.tableOptions) || void 0 === _a ? void 0 : _a.title) || void 0 === _b ? void 0 : _b.textStyle) || void 0 === _c ? void 0 : _c.fontSize) && void 0 !== _d ? _d : 20) + (null !== (_h = null === (_g = null === (_f = null === (_e = config.tableOptions) || void 0 === _e ? void 0 : _e.title) || void 0 === _f ? void 0 : _f.subtextStyle) || void 0 === _g ? void 0 : _g.fontSize) && void 0 !== _h ? _h : 16) + 1) - (null !== (_k = null === (_j = config.tableOptions) || void 0 === _j ? void 0 : _j.defaultHeaderRowHeight) && void 0 !== _k ? _k : 40)) / 5);
24
+ return Object.assign(Object.assign({}, null !== (_l = config.tableOptions) && void 0 !== _l ? _l : {}), {
25
+ columns: columns,
26
+ defaultRowHeight: null != rowHeight ? rowHeight : 120,
27
+ defaultHeaderRowHeight: null !== (_o = null === (_m = config.tableOptions) || void 0 === _m ? void 0 : _m.defaultHeaderRowHeight) && void 0 !== _o ? _o : 40,
28
+ widthMode: "adaptive",
29
+ columnResizeMode: "none",
30
+ theme: themes.DEFAULT.extends(merge({
31
+ headerStyle: {
32
+ textAlign: "center"
33
+ },
34
+ bodyStyle: {
35
+ bgColor: args => {
36
+ const {col: col, row: row, dataValue: dataValue, table: table} = args, record = table.getCellRawRecord(col, row), date = dataValue, month = record.Sun > dataValue ? record.month + 1 : record.month;
37
+ return (11 === record.month && record.Sun > dataValue ? record.year + 1 : record.year) === currentDate.getFullYear() && month === currentDate.getMonth() && date === currentDate.getDate() ? "#f0f0f0" : "#fff";
38
+ },
39
+ textAlign: "right",
40
+ textBaseline: "top",
41
+ color: "#999"
42
+ }
43
+ }, null === (_p = config.tableOptions) || void 0 === _p ? void 0 : _p.theme)),
44
+ title: Object.assign(Object.assign({}, null !== (_r = null === (_q = config.tableOptions) || void 0 === _q ? void 0 : _q.title) && void 0 !== _r ? _r : {}), {
45
+ orient: "top",
46
+ text: `${getWeekdayString(currentDate.getDay())}, ${getMonthString(currentDate.getMonth())} ${currentDate.getDate()}`,
47
+ subtext: currentDate.getFullYear()
48
+ }),
49
+ enableLineBreak: !0,
50
+ customCellStyle: [ {
51
+ id: "current-month",
52
+ style: {
53
+ color: "#000"
54
+ }
55
+ } ]
56
+ });
57
+ }
58
+ //# sourceMappingURL=table-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table/table-option.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,gBA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MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;oBAC3F,IACE,IAAI,KAAK,WAAW,CAAC,WAAW,EAAE;wBAClC,KAAK,KAAK,WAAW,CAAC,QAAQ,EAAE;wBAChC,IAAI,KAAK,WAAW,CAAC,OAAO,EAAE,EAC9B;wBACA,OAAO,SAAS,CAAC;qBAClB;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBACD,SAAS,EAAE,OAAO;gBAClB,YAAY,EAAE,KAAK;gBACnB,KAAK,EAAE,MAAM;aACd;SACF,EACD,MAAA,MAAM,CAAC,YAAY,0CAAE,KAAK,CAC3B,CACF,EACD,KAAK,kCACA,CAAC,MAAA,MAAA,MAAM,CAAC,YAAY,0CAAE,KAAK,mCAAI,EAAE,CAAC,KAErC,MAAM,EAAE,KAAK,EAEb,IAAI,EAAE,GAAG,gBAAgB,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,cAAc,CAChE,WAAW,CAAC,QAAQ,EAAE,CACvB,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,EAC5B,OAAO,EAAE,WAAW,CAAC,WAAW,EAAE,KAEpC,eAAe,EAAE,IAAI,EACrB,eAAe,EAAE;YACf;gBACE,EAAE,EAAE,eAAe;gBACnB,KAAK,EAAE;oBACL,KAAK,EAAE,MAAM;iBACd;aACF;SACF,GACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","file":"table-option.js","sourcesContent":["import type { ListTableConstructorOptions, TYPES } from '@visactor/vtable';\nimport { themes } from '@visactor/vtable';\nimport type { DateRecord, DateRecordKeys } from '../date-util';\nimport { defaultDayTitles, getMonthString, getWeekdayString } from '../date-util';\nimport { calendarCustomLayout } from '../custom/custom-layout';\nimport { merge } from '@visactor/vutils';\n\nexport function createTableOption(\n week: DateRecordKeys[],\n currentDate: Date,\n config: { tableOptions?: ListTableConstructorOptions; containerWidth: number; containerHeight: number }\n) {\n const columns = week.map((item: DateRecordKeys, index: number) => {\n return {\n field: defaultDayTitles[index],\n title: item,\n // width: columnWidth ?? 140,\n fieldFormat: (record: DateRecord) => {\n if (\n record.year === currentDate.getFullYear() &&\n record.month === currentDate.getMonth() &&\n record[item] === currentDate.getDate()\n ) {\n return `${record[item]}\\nToday`;\n } else if (record[item] === 1) {\n const monthIndex = item === 'Sun' ? record.month : record.month + 1;\n const mouthStr = getMonthString(monthIndex);\n return `${record[item]}\\n${mouthStr}`;\n }\n return record[item];\n },\n customLayout: calendarCustomLayout\n };\n });\n\n const rowHeight = Math.floor(\n (config.containerHeight -\n ((config.tableOptions?.title?.textStyle?.fontSize ?? 20) +\n (config.tableOptions?.title?.subtextStyle?.fontSize ?? 16) +\n 1) -\n ((config.tableOptions?.defaultHeaderRowHeight as number) ?? 40)) /\n 5\n ); // height - title - header\n const option: TYPES.ListTableConstructorOptions = {\n ...(config.tableOptions ?? {}),\n\n columns,\n defaultRowHeight: rowHeight ?? 120,\n defaultHeaderRowHeight: config.tableOptions?.defaultHeaderRowHeight ?? 40,\n widthMode: 'adaptive',\n columnResizeMode: 'none',\n theme: themes.DEFAULT.extends(\n merge(\n {\n headerStyle: {\n textAlign: 'center'\n },\n bodyStyle: {\n bgColor: args => {\n const { col, row, dataValue, table } = args;\n const record = table.getCellRawRecord(col, row);\n const date = dataValue;\n const month = record.Sun > dataValue ? record.month + 1 : record.month;\n const year = record.month === 11 && record.Sun > dataValue ? record.year + 1 : record.year;\n if (\n year === currentDate.getFullYear() &&\n month === currentDate.getMonth() &&\n date === currentDate.getDate()\n ) {\n return '#f0f0f0';\n }\n return '#fff';\n },\n textAlign: 'right',\n textBaseline: 'top',\n color: '#999'\n }\n },\n config.tableOptions?.theme\n )\n ),\n title: {\n ...(config.tableOptions?.title ?? {}),\n\n orient: 'top',\n // text: 'Thu, Aug 22',\n text: `${getWeekdayString(currentDate.getDay())}, ${getMonthString(\n currentDate.getMonth()\n )} ${currentDate.getDate()}`,\n subtext: currentDate.getFullYear()\n },\n enableLineBreak: true,\n customCellStyle: [\n {\n id: 'current-month',\n style: {\n color: '#000'\n }\n }\n ]\n };\n\n return option;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@visactor/vtable-calendar",
3
+ "version": "1.7.6",
4
+ "description": "The calendar component of VTable",
5
+ "author": {
6
+ "name": "VisActor",
7
+ "url": "https://VisActor.io/"
8
+ },
9
+ "license": "MIT",
10
+ "sideEffects": false,
11
+ "main": "cjs/index.js",
12
+ "module": "es/index.js",
13
+ "types": "es/index.d.ts",
14
+ "files": [
15
+ "cjs",
16
+ "es",
17
+ "dist"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "require": "./cjs/index.js",
22
+ "import": "./es/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "compile": "tsc --noEmit",
27
+ "start": "vite ./demo",
28
+ "build": "bundle --clean"
29
+ },
30
+ "unpkg": "latest",
31
+ "unpkgFiles": [
32
+ "dist/vtable-exporter.js"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "dependencies": {
38
+ "@visactor/vtable": "workspace:*",
39
+ "@visactor/vutils": "~0.18.14",
40
+ "date-fns": "3.6.0"
41
+ },
42
+ "devDependencies": {
43
+ "@internal/bundler": "workspace:*",
44
+ "@internal/eslint-config": "workspace:*",
45
+ "@internal/ts-config": "workspace:*",
46
+ "@rushstack/eslint-patch": "~1.1.4",
47
+ "react": "^18.0.0",
48
+ "react-dom": "^18.0.0",
49
+ "@types/react": "^18.0.0",
50
+ "@types/react-dom": "^18.0.0",
51
+ "@vitejs/plugin-react": "3.1.0",
52
+ "eslint": "~8.18.0",
53
+ "vite": "3.2.6",
54
+ "typescript": "4.9.5",
55
+ "@babel/core": "7.20.12",
56
+ "@babel/preset-env": "7.20.2",
57
+ "@types/chai": "4.2.22",
58
+ "@types/jest": "^26.0.0",
59
+ "@types/mocha": "9.0.0",
60
+ "@types/node": "*",
61
+ "@types/offscreencanvas": "2019.6.4",
62
+ "chai": "4.3.4",
63
+ "jest": "^26.0.0",
64
+ "jest-electron": "^0.1.12",
65
+ "jest-transform-stub": "^2.0.0",
66
+ "magic-string": "^0.25.7",
67
+ "mocha": "9.1.3",
68
+ "postcss": "8.4.21",
69
+ "rimraf": "3.0.2",
70
+ "sass": "1.43.5",
71
+ "ts-jest": "^26.0.0",
72
+ "ts-loader": "9.2.6",
73
+ "ts-node": "10.9.0",
74
+ "tslib": "2.3.1",
75
+ "ttypescript": "1.5.13",
76
+ "typescript-transform-paths": "3.3.1",
77
+ "json-formatter-js": "^2.3.4",
78
+ "inversify": "6.0.1",
79
+ "vite-plugin-markdown": "^2.1.0",
80
+ "markdown-it": "^13.0.0",
81
+ "node-fetch": "2.6.7",
82
+ "form-data": "~4.0.0",
83
+ "axios": "^1.4.0",
84
+ "@types/react-is": "^17.0.3",
85
+ "rollup-plugin-node-resolve": "5.2.0"
86
+ }
87
+ }