@visactor/vtable-calendar 1.11.4 → 1.11.6-alpha.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.
@@ -1,6 +1,6 @@
1
1
  import type { MousePointerCellEvent } from '@visactor/vtable';
2
2
  import type { IEventData } from '../custom/custom-handler';
3
- import type { SelectedCellEvent } from '@visactor/vtable/src/ts-types';
3
+ import type { SelectedCellEvent } from '@visactor/vtable/es/ts-types';
4
4
  export interface CalendarEvents {
5
5
  CALENDAR_DATE_CLICK: 'calendar_date_click';
6
6
  SELECTED_DATE: 'selected_date';
@@ -1 +1 @@
1
- {"version":3,"sources":["event/type.ts"],"names":[],"mappings":";;;AA8Ba,QAAA,mBAAmB,GAAmB;IACjD,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,eAAe;IAC9B,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,2BAA2B,EAAE,6BAA6B;CACzC,CAAC","file":"type.js","sourcesContent":["import type { MousePointerCellEvent } from '@visactor/vtable';\nimport type { IEventData } from '../custom/custom-handler';\nimport type { SelectedCellEvent } from '@visactor/vtable/src/ts-types';\n\nexport interface CalendarEvents {\n /**\n * 日期点击事件\n */\n CALENDAR_DATE_CLICK: 'calendar_date_click';\n /**\n * 日期选中状态改变事件\n */\n SELECTED_DATE: 'selected_date';\n /**\n * 日期选中状态改变事件\n */\n SELECTED_DATE_CLEAR: 'selected_date_clear';\n /**\n * 拖拽框选日期鼠标松开事件\n */\n DRAG_SELECT_DATE_END: 'drag_select_date_end';\n /**\n * 自定义事件点击事件\n */\n CALENDAR_CUSTOM_EVENT_CLICK: 'calendar_custom_event_click';\n}\n\n/**\n * Calendar event types\n */\nexport const CALENDAR_EVENT_TYPE: CalendarEvents = {\n CALENDAR_DATE_CLICK: 'calendar_date_click',\n SELECTED_DATE: 'selected_date',\n SELECTED_DATE_CLEAR: 'selected_date_clear',\n DRAG_SELECT_DATE_END: 'drag_select_date_end',\n CALENDAR_CUSTOM_EVENT_CLICK: 'calendar_custom_event_click'\n} as CalendarEvents;\n\nexport interface CalendarEventHandlersEventArgumentMap {\n calendar_date_click: { date: Date; tableEvent: MousePointerCellEvent };\n selected_date: { date: Date; tableEvent: SelectedCellEvent };\n selected_date_clear: void;\n drag_select_date_end: { dates: Date[]; tableEvent: MousePointerCellEvent };\n calendar_custom_event_click: { date: Date; tableEvent: MousePointerCellEvent; customEvent: IEventData };\n}\n\nexport interface CalendarEventHandlersReturnMap {\n calendar_date_click: void;\n selected_date: void;\n selected_date_clear: void;\n drag_select_date_end: void;\n calendar_custom_event_click: void;\n}\n\nexport type CalendarEventListener<TYPE extends keyof CalendarEventHandlersEventArgumentMap> = (\n args: CalendarEventHandlersEventArgumentMap[TYPE]\n) => CalendarEventHandlersReturnMap[TYPE]; //AnyFunction;\n"]}
1
+ {"version":3,"sources":["event/type.ts"],"names":[],"mappings":";;;AA8Ba,QAAA,mBAAmB,GAAmB;IACjD,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,eAAe;IAC9B,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,2BAA2B,EAAE,6BAA6B;CACzC,CAAC","file":"type.js","sourcesContent":["import type { MousePointerCellEvent } from '@visactor/vtable';\nimport type { IEventData } from '../custom/custom-handler';\nimport type { SelectedCellEvent } from '@visactor/vtable/es/ts-types';\n\nexport interface CalendarEvents {\n /**\n * 日期点击事件\n */\n CALENDAR_DATE_CLICK: 'calendar_date_click';\n /**\n * 日期选中状态改变事件\n */\n SELECTED_DATE: 'selected_date';\n /**\n * 日期选中状态改变事件\n */\n SELECTED_DATE_CLEAR: 'selected_date_clear';\n /**\n * 拖拽框选日期鼠标松开事件\n */\n DRAG_SELECT_DATE_END: 'drag_select_date_end';\n /**\n * 自定义事件点击事件\n */\n CALENDAR_CUSTOM_EVENT_CLICK: 'calendar_custom_event_click';\n}\n\n/**\n * Calendar event types\n */\nexport const CALENDAR_EVENT_TYPE: CalendarEvents = {\n CALENDAR_DATE_CLICK: 'calendar_date_click',\n SELECTED_DATE: 'selected_date',\n SELECTED_DATE_CLEAR: 'selected_date_clear',\n DRAG_SELECT_DATE_END: 'drag_select_date_end',\n CALENDAR_CUSTOM_EVENT_CLICK: 'calendar_custom_event_click'\n} as CalendarEvents;\n\nexport interface CalendarEventHandlersEventArgumentMap {\n calendar_date_click: { date: Date; tableEvent: MousePointerCellEvent };\n selected_date: { date: Date; tableEvent: SelectedCellEvent };\n selected_date_clear: void;\n drag_select_date_end: { dates: Date[]; tableEvent: MousePointerCellEvent };\n calendar_custom_event_click: { date: Date; tableEvent: MousePointerCellEvent; customEvent: IEventData };\n}\n\nexport interface CalendarEventHandlersReturnMap {\n calendar_date_click: void;\n selected_date: void;\n selected_date_clear: void;\n drag_select_date_end: void;\n calendar_custom_event_click: void;\n}\n\nexport type CalendarEventListener<TYPE extends keyof CalendarEventHandlersEventArgumentMap> = (\n args: CalendarEventHandlersEventArgumentMap[TYPE]\n) => CalendarEventHandlersReturnMap[TYPE]; //AnyFunction;\n"]}
@@ -4,7 +4,7 @@ import type { TYPES, ListTableConstructorOptions } from '@visactor/vtable';
4
4
  import type { ICustomEvent, ICustomEventOptions, IEventData } from './custom/custom-handler';
5
5
  import { CustomEventHandler } from './custom/custom-handler';
6
6
  import type { CalendarEventHandlersEventArgumentMap, CalendarEventHandlersReturnMap, CalendarEventListener } from './event/type';
7
- import type { EventListenerId } from '@visactor/vtable/src/ts-types';
7
+ import type { EventListenerId } from '@visactor/vtable/es/ts-types';
8
8
  export interface CalendarConstructorOptions {
9
9
  startDate?: Date;
10
10
  endDate?: Date;
@@ -1 +1 @@
1
- {"version":3,"sources":["month-calendar.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAE1D,2CAA+E;AAE/E,uCAA6E;AAC7E,mCAAmD;AAEnD,uDAAyD;AAEzD,4DAA6D;AAM7D,uCAAmD;AAEnD,6CAA2C;A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,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;IAC1C,CAAC;IAED,kBAAkB,CAAC,GAAa;QAC9B,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;IAC1C,CAAC;IAED,kBAAkB,CAAC,MAAsB;QACvC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;IAC1C,CAAC;IAED,wBAAwB,CAAC,IAAU;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACvE,CAAC;IAED,4BAA4B,CAAC,GAAW,EAAE,GAAW;QACnD,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAClE,MAAM,MAAM,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;AAvTD,4BAuTC","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"]}
1
+ {"version":3,"sources":["month-calendar.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAE1D,2CAA+E;AAE/E,uCAA6E;AAC7E,mCAAmD;AAEnD,uDAAyD;AAEzD,4DAA6D;AAM7D,uCAAmD;AAEnD,6CAA2C;AAgB3C,MAAa,QAAS,SAAQ,oBAAW;IAoBvC,YAAY,SAAsB,EAAE,OAAoC;QACtE,KAAK,EAAE,CAAC;QAJV,WAAM,GAAW,CAAC,CAAC;QAKjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;QAC7B,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAEpE,IAAI,CAAC,WAAW,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;QACjC,IAAI,SAAS,IAAI,OAAO,EAAE;YACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;SACxB;aAAM;YACL,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,e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AC,CAAC;QAClE,MAAM,MAAM,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;AAvTD,4BAuTC","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/es/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"]}
@@ -44437,85 +44437,6 @@
44437
44437
  }
44438
44438
  }
44439
44439
 
44440
- class CustomCellStylePlugin {
44441
- constructor(table, customCellStyle, customCellStyleArrangement) {
44442
- this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
44443
- }
44444
- getCustomCellStyle(col, row) {
44445
- const customStyleIds = this.getCustomCellStyleIds(col, row);
44446
- if (customStyleIds.length) {
44447
- const styles = [];
44448
- return customStyleIds.forEach(customStyleId => {
44449
- const styleOption = this.getCustomCellStyleOption(customStyleId);
44450
- (null == styleOption ? void 0 : styleOption.style) && styles.push(styleOption.style);
44451
- }), merge({}, ...styles);
44452
- }
44453
- }
44454
- getCustomCellStyleIds(col, row) {
44455
- const customStyleIds = [],
44456
- range = this.table.getCellRange(col, row);
44457
- for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.customCellStyleArrangement.forEach(style => {
44458
- style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId);
44459
- });
44460
- return customStyleIds;
44461
- }
44462
- getCustomCellStyleOption(customStyleId) {
44463
- return this.customCellStyle.find(style => style.id === customStyleId);
44464
- }
44465
- registerCustomCellStyle(customStyleId, customStyle) {
44466
- const index = this.customCellStyle.findIndex(style => style.id === customStyleId);
44467
- -1 === index ? this.customCellStyle.push({
44468
- id: customStyleId,
44469
- style: customStyle
44470
- }) : this.customCellStyle[index] = {
44471
- id: customStyleId,
44472
- style: customStyle
44473
- }, this.customCellStyleArrangement.forEach(cellStyle => {
44474
- const cellPos = cellStyle.cellPosition;
44475
- if (cellStyle.customStyleId === customStyleId) if (cellPos.range) for (let col = Math.max(0, cellPos.range.start.col); col <= Math.min(this.table.colCount - 1, cellPos.range.end.col); col++) for (let row = Math.max(0, cellPos.range.start.row); row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row); row++) this.table.scenegraph.updateCellContent(col, row);else this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);
44476
- }), this.table.scenegraph.updateNextFrame();
44477
- }
44478
- arrangeCustomCellStyle(cellPos, customStyleId) {
44479
- const index = this.customCellStyleArrangement.findIndex(style => style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row);
44480
- if (-1 !== index || customStyleId) {
44481
- if (-1 === index && customStyleId) this.customCellStyleArrangement.push({
44482
- cellPosition: {
44483
- col: cellPos.col,
44484
- row: cellPos.row,
44485
- range: cellPos.range
44486
- },
44487
- customStyleId: customStyleId
44488
- });else {
44489
- if (this.customCellStyleArrangement[index].customStyleId === customStyleId) return;
44490
- customStyleId ? this.customCellStyleArrangement[index].customStyleId = customStyleId : this.customCellStyleArrangement.splice(index, 1);
44491
- }
44492
- if (cellPos.range) for (let col = Math.max(0, cellPos.range.start.col); col <= Math.min(this.table.colCount - 1, cellPos.range.end.col); col++) for (let row = Math.max(0, cellPos.range.start.row); row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row); row++) {
44493
- const range = this.table.getCellRange(col, row);
44494
- for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.table.scenegraph.updateCellContent(c, r);
44495
- } else this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);
44496
- this.table.scenegraph.updateNextFrame();
44497
- }
44498
- }
44499
- updateCustomCell(customCellStyle, customCellStyleArrangement) {
44500
- this.customCellStyle.length = 0, this.customCellStyleArrangement.length = 0, customCellStyle.forEach(cellStyle => {
44501
- this.registerCustomCellStyle(cellStyle.id, cellStyle.style);
44502
- }), customCellStyleArrangement.forEach(cellStyle => {
44503
- this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);
44504
- });
44505
- }
44506
- hasCustomCellStyle(customStyleId) {
44507
- return this.customCellStyle.some(style => style.id === customStyleId);
44508
- }
44509
- }
44510
- function mergeStyle(cacheStyle, customCellStyle) {
44511
- cacheStyle = cacheStyle.clone();
44512
- for (const key in customCellStyle) {
44513
- const value = customCellStyle[key];
44514
- value && (cacheStyle[`_${key}`] = value);
44515
- }
44516
- return cacheStyle;
44517
- }
44518
-
44519
44440
  class DimensionTree {
44520
44441
  constructor(tree, sharedVar) {
44521
44442
  let hierarchyType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "grid";
@@ -45438,10 +45359,92 @@
45438
45359
  Direction.vertical = "vertical", Direction.horizontal = "horizontal";
45439
45360
  }(Direction || (Direction = {}));
45440
45361
 
45362
+ class CustomCellStylePlugin {
45363
+ constructor(table, customCellStyle, customCellStyleArrangement) {
45364
+ this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
45365
+ }
45366
+ getCustomCellStyle(col, row) {
45367
+ const customStyleIds = this.getCustomCellStyleIds(col, row);
45368
+ if (customStyleIds.length) {
45369
+ const styles = [];
45370
+ return customStyleIds.forEach(customStyleId => {
45371
+ const styleOption = this.getCustomCellStyleOption(customStyleId);
45372
+ (null == styleOption ? void 0 : styleOption.style) && styles.push(styleOption.style);
45373
+ }), merge({}, ...styles);
45374
+ }
45375
+ }
45376
+ getCustomCellStyleIds(col, row) {
45377
+ const customStyleIds = [],
45378
+ range = this.table.getCellRange(col, row);
45379
+ for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.customCellStyleArrangement.forEach(style => {
45380
+ style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId);
45381
+ });
45382
+ return customStyleIds;
45383
+ }
45384
+ getCustomCellStyleOption(customStyleId) {
45385
+ return this.customCellStyle.find(style => style.id === customStyleId);
45386
+ }
45387
+ registerCustomCellStyle(customStyleId, customStyle) {
45388
+ const index = this.customCellStyle.findIndex(style => style.id === customStyleId);
45389
+ -1 === index ? this.customCellStyle.push({
45390
+ id: customStyleId,
45391
+ style: customStyle
45392
+ }) : this.customCellStyle[index] = {
45393
+ id: customStyleId,
45394
+ style: customStyle
45395
+ }, this.customCellStyleArrangement.forEach(cellStyle => {
45396
+ const cellPos = cellStyle.cellPosition;
45397
+ if (cellStyle.customStyleId === customStyleId) if (cellPos.range) for (let col = Math.max(0, cellPos.range.start.col); col <= Math.min(this.table.colCount - 1, cellPos.range.end.col); col++) for (let row = Math.max(0, cellPos.range.start.row); row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row); row++) this.table.scenegraph.updateCellContent(col, row);else this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);
45398
+ }), this.table.scenegraph.updateNextFrame();
45399
+ }
45400
+ arrangeCustomCellStyle(cellPos, customStyleId) {
45401
+ const index = this.customCellStyleArrangement.findIndex(style => style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row);
45402
+ if (-1 !== index || customStyleId) {
45403
+ if (-1 === index && customStyleId) this.customCellStyleArrangement.push({
45404
+ cellPosition: {
45405
+ col: cellPos.col,
45406
+ row: cellPos.row,
45407
+ range: cellPos.range
45408
+ },
45409
+ customStyleId: customStyleId
45410
+ });else {
45411
+ if (this.customCellStyleArrangement[index].customStyleId === customStyleId) return;
45412
+ customStyleId ? this.customCellStyleArrangement[index].customStyleId = customStyleId : this.customCellStyleArrangement.splice(index, 1);
45413
+ }
45414
+ if (cellPos.range) for (let col = Math.max(0, cellPos.range.start.col); col <= Math.min(this.table.colCount - 1, cellPos.range.end.col); col++) for (let row = Math.max(0, cellPos.range.start.row); row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row); row++) {
45415
+ const range = this.table.getCellRange(col, row);
45416
+ for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.table.scenegraph.updateCellContent(c, r);
45417
+ } else this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);
45418
+ this.table.scenegraph.updateNextFrame();
45419
+ }
45420
+ }
45421
+ updateCustomCell(customCellStyle, customCellStyleArrangement) {
45422
+ this.customCellStyle.length = 0, this.customCellStyleArrangement.length = 0, customCellStyle.forEach(cellStyle => {
45423
+ this.registerCustomCellStyle(cellStyle.id, cellStyle.style);
45424
+ }), customCellStyleArrangement.forEach(cellStyle => {
45425
+ this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);
45426
+ });
45427
+ }
45428
+ hasCustomCellStyle(customStyleId) {
45429
+ return this.customCellStyle.some(style => style.id === customStyleId);
45430
+ }
45431
+ }
45432
+ function mergeStyle(cacheStyle, customCellStyle) {
45433
+ cacheStyle = cacheStyle.clone();
45434
+ for (const key in customCellStyle) {
45435
+ const value = customCellStyle[key];
45436
+ value && (cacheStyle[`_${key}`] = value);
45437
+ }
45438
+ return cacheStyle;
45439
+ }
45440
+ const registerCustomCellStylePlugin = () => {
45441
+ Factory.registerComponent("customCellStylePlugin", CustomCellStylePlugin);
45442
+ };
45443
+
45441
45444
  const EMPTY_STYLE = {};
45442
45445
  function getCellStyle(col, row, table) {
45443
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45444
- const customCellStyle = table.customCellStylePlugin.getCustomCellStyle(col, row),
45446
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45447
+ const customCellStyle = null === (_a = table.customCellStylePlugin) || void 0 === _a ? void 0 : _a.getCustomCellStyle(col, row),
45445
45448
  {
45446
45449
  layoutMap: layoutMap
45447
45450
  } = table.internalProps;
@@ -45457,9 +45460,9 @@
45457
45460
  const hd = layoutMap.getHeader(col, row);
45458
45461
  let paddingForAxis;
45459
45462
  if (table.isPivotChart() && isTopOrBottomAxis(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
45460
- paddingForAxis = null !== (_b = null === (_a = layoutMap.getBody(col, table.rowHeaderLevelCount).style) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : table.theme.bodyStyle.padding;
45463
+ paddingForAxis = null !== (_c = null === (_b = layoutMap.getBody(col, table.rowHeaderLevelCount).style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : table.theme.bodyStyle.padding;
45461
45464
  } else if (table.isPivotChart() && isLeftOrRightAxis(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
45462
- paddingForAxis = null !== (_d = null === (_c = layoutMap.getBody(table.columnHeaderLevelCount, row).style) || void 0 === _c ? void 0 : _c.padding) && void 0 !== _d ? _d : table.theme.bodyStyle.padding;
45465
+ paddingForAxis = null !== (_e = null === (_d = layoutMap.getBody(table.columnHeaderLevelCount, row).style) || void 0 === _d ? void 0 : _d.padding) && void 0 !== _e ? _e : table.theme.bodyStyle.padding;
45463
45466
  }
45464
45467
  if ((!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightBottomCorner(col, row) || layoutMap.isCornerHeader(col, row) || layoutMap.isRightTopCorner(col, row))) return EMPTY_STYLE;
45465
45468
  const styleClass = table.internalProps.headerHelper.getStyleClass((null == hd ? void 0 : hd.headerType) || "text");
@@ -45495,7 +45498,7 @@
45495
45498
  return table.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? mergeStyle(cacheStyle, customCellStyle) : cacheStyle;
45496
45499
  }
45497
45500
  let bgColorFunc, cacheKey;
45498
- (null === (_f = null === (_e = table.internalProps) || void 0 === _e ? void 0 : _e.dataConfig) || void 0 === _f ? void 0 : _f.mappingRules) && !table.isHeader(col, row) && (null === (_j = null === (_h = null === (_g = table.internalProps) || void 0 === _g ? void 0 : _g.dataConfig) || void 0 === _h ? void 0 : _h.mappingRules) || void 0 === _j || _j.forEach((mappingRule, i) => {
45501
+ (null === (_g = null === (_f = table.internalProps) || void 0 === _f ? void 0 : _f.dataConfig) || void 0 === _g ? void 0 : _g.mappingRules) && !table.isHeader(col, row) && (null === (_k = null === (_j = null === (_h = table.internalProps) || void 0 === _h ? void 0 : _h.dataConfig) || void 0 === _j ? void 0 : _j.mappingRules) || void 0 === _k || _k.forEach((mappingRule, i) => {
45499
45502
  mappingRule.bgColor && table.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
45500
45503
  }));
45501
45504
  const cellType = table.getCellType(col, row),
@@ -45573,7 +45576,7 @@
45573
45576
  constructor(container) {
45574
45577
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45575
45578
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45576
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.4", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
45579
+ if (super(), this.showFrozenIcon = !0, this.version = "1.11.6-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
45577
45580
  const {
45578
45581
  frozenColCount = 0,
45579
45582
  frozenRowCount: frozenRowCount,
@@ -45657,7 +45660,9 @@
45657
45660
  }
45658
45661
  this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyMergeTitleCache = new Map(), this.bodyBottomStyleCache = new Map(), internalProps.stick = {
45659
45662
  changedCells: new Map()
45660
- }, internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_j = options.customCellStyle) && void 0 !== _j ? _j : [], null !== (_k = options.customCellStyleArrangement) && void 0 !== _k ? _k : []);
45663
+ }, internalProps.customMergeCell = options.customMergeCell;
45664
+ const CustomCellStylePlugin = Factory.getComponent("customCellStylePlugin");
45665
+ CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_j = options.customCellStyle) && void 0 !== _j ? _j : [], null !== (_k = options.customCellStyleArrangement) && void 0 !== _k ? _k : []));
45661
45666
  }
45662
45667
  getContainer() {
45663
45668
  return this.container;
@@ -46339,7 +46344,7 @@
46339
46344
  return super.fireListeners(type, event);
46340
46345
  }
46341
46346
  updateOption(options) {
46342
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
46347
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
46343
46348
  this.options = options, this._hasAutoImageColumn = void 0;
46344
46349
  const {
46345
46350
  frozenColCount = 0,
@@ -46407,7 +46412,7 @@
46407
46412
  const MenuHandler = Factory.getComponent("menuHandler");
46408
46413
  internalProps.menuHandler = new MenuHandler(this);
46409
46414
  }
46410
- this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = options.customMergeCell, this.customCellStylePlugin.updateCustomCell(null !== (_l = options.customCellStyle) && void 0 !== _l ? _l : [], null !== (_m = options.customCellStyleArrangement) && void 0 !== _m ? _m : []);
46415
+ this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = options.customMergeCell, null === (_l = this.customCellStylePlugin) || void 0 === _l || _l.updateCustomCell(null !== (_m = options.customCellStyle) && void 0 !== _m ? _m : [], null !== (_o = options.customCellStyleArrangement) && void 0 !== _o ? _o : []);
46411
46416
  }
46412
46417
  renderWithRecreateCells() {
46413
46418
  const oldHoverState = {
@@ -47261,13 +47266,16 @@
47261
47266
  }
47262
47267
  changeRecordOrder(source, target) {}
47263
47268
  hasCustomCellStyle(customStyleId) {
47264
- return this.customCellStylePlugin.hasCustomCellStyle(customStyleId);
47269
+ var _a;
47270
+ return null === (_a = this.customCellStylePlugin) || void 0 === _a ? void 0 : _a.hasCustomCellStyle(customStyleId);
47265
47271
  }
47266
47272
  registerCustomCellStyle(customStyleId, customStyle) {
47267
- this.customCellStylePlugin.registerCustomCellStyle(customStyleId, customStyle);
47273
+ var _a;
47274
+ null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.registerCustomCellStyle(customStyleId, customStyle);
47268
47275
  }
47269
47276
  arrangeCustomCellStyle(cellPos, customStyleId) {
47270
- this.customCellStylePlugin.arrangeCustomCellStyle(cellPos, customStyleId);
47277
+ var _a;
47278
+ null === (_a = this.customCellStylePlugin) || void 0 === _a || _a.arrangeCustomCellStyle(cellPos, customStyleId);
47271
47279
  }
47272
47280
  isSeriesNumber(col, row) {
47273
47281
  return this.internalProps.layoutMap.isSeriesNumber(col, row);
@@ -53134,7 +53142,7 @@
53134
53142
  Factory.registerFunction("createVideoCellGroup", createVideoCellGroup);
53135
53143
  };
53136
53144
 
53137
- registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
53145
+ registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
53138
53146
  class ListTableAll extends ListTable {}
53139
53147
 
53140
53148
  registerForVrender();