import { Dayjs } from 'dayjs'; import { QXEvent } from 'qx-util'; import { ICalendarEvent } from '../../events'; import { DateSplitItem, IBzCalendarConfig, IBzCalendarNode, IBzResourceNode } from '../../interface'; import { IBzCalendarOptionStore, IBzResourceAllocationState, IBzResourceAllocationStore } from '../../store'; import { IBzCalendarLayoutOptionStore } from '../../store/ibz-calendar-layout-option-store/ibz-calendar-layout-option-store'; /** * 资源排布控制器 * * @export * @class IBzResourceAllocationController */ export declare class IBzResourceAllocationController { readonly evt: QXEvent; readonly store: IBzResourceAllocationStore; readonly state: IBzResourceAllocationState; readonly option: IBzCalendarOptionStore; readonly layout: IBzCalendarLayoutOptionStore; /** * 日历容器DOM * * @author chitanda * @date 2021-03-08 14:03:39 * @type {HTMLIbzResourceAllocationElement} */ dom: HTMLIbzResourceAllocationElement; /** * 拖拽展示实例 * * @author chitanda * @date 2021-03-14 11:03:01 * @type {HTMLIbzResourceDragItemElement} */ dragRef: HTMLIbzResourceDragItemElement; /** * 小时标度列表 * * @type {string []} * @memberof IBzResourceAllocationController */ readonly hourSplits: string[]; /** * 日期标度列表 * * @type {DateSplitItem[]} * @memberof IBzResourceAllocationController */ readonly dateSplits: DateSplitItem[]; /** * 按月,日期分割对应表 * * @type {Map} * @memberof IBzResourceAllocationController */ readonly monthDateSplits: Map; /** * 缓存计算过的天内数据 * * @type {Map} * @memberof IBzResourceAllocationController */ readonly dayItemsMap: Map; /** * 单个资源所占高 * * @author chitanda * @date 2021-03-14 10:03:15 * @readonly * @type {number} */ get resourceHeight(): number; /** * Creates an instance of IBzResourceAllocationController. * @memberof IBzResourceAllocationController */ constructor(); /** * 设置选中项 * * @param {IBzCalendarNode} node * @memberof IBzResourceAllocationController */ setSelect(node: IBzCalendarNode): void; /** * 设置数据集 * * @param {any[]} items * @return {*} {void} * @memberof IBzResourceAllocationController */ setItems(items: any[]): void; /** * 设置项,存在替换,不存在新增。 * * @author chitanda * @date 2021-03-08 17:03:44 * @param {any} data * @return {*} {void} */ setItem(data: any): void; /** * 设置参数 * * @param {IBzCalendarConfig} opt * @memberof IBzResourceAllocationController */ setOption(opt: IBzCalendarConfig): void; /** * 计算展示的节点 * * @memberof IBzResourceAllocationController */ calcShowNodes(): void; /** * 计算配置参数(此方法内所有计算不可轻易修改,组件内有大部分逻辑,基于此方法计算出的参数进行计算。) * * @protected * @param {IBzCalendarConfig} opt * @memberof IBzResourceAllocationController */ protected calcOption(opt: IBzCalendarConfig): void; /** * 刷新指定时间范围内,所有数据的层级计算 * * @param {IBzResourceNode} resource * @param {Dayjs} start * @param {Dayjs} end * @memberof IBzResourceAllocationController */ calcDaysLevelByTimeFrame(resource: IBzResourceNode, start: Dayjs, end: Dayjs): void; /** * 计算指定日期数据展示偏移层级 * * @param {IBzResourceNode} resource * @param {string} date * @return {*} {{ [key: string]: number }} * @memberof IBzResourceAllocationController */ calcDayItemsLevel(resource: IBzResourceNode, date: string): { [key: string]: number; }; /** * 计算给定数据集显示偏移级别 * * @param {IBzCalendarNode[]} items 此数据集是已经按照时间正序后集合 * @param {number} [level=0] * @return {*} {{ [key: string]: number }} * @memberof IBzResourceAllocationController */ calcItemsLevel(items: IBzCalendarNode[], level?: number): { [key: string]: number; }; /** * 计算小时标度列表 * * @protected * @memberof IBzResourceAllocationController */ protected calcHourSplitList(): void; /** * 计算天标度列表 * * @protected * @memberof IBzResourceAllocationController */ protected calcDaySplitList(): void; /** * 计算节点内容 * * @param {*} item * @returns {IBzCalendarNode} * @memberof IBzResourceAllocationController */ formatNodeData(resource: IBzResourceNode, item: any): IBzCalendarNode; /** * 返回指定日期数据(已在界面上显示的) * * @param {string} date 指定日期。例:2020-02-20 * @returns {IBzCalendarNode[]} * @memberof IBzResourceAllocationController */ getSpecifyDateItems(resource: IBzResourceNode, date: string): IBzCalendarNode[]; /** * 变更数据起始和结束时间 * * @param {Dayjs} newstartTime 新的起始时间, Dayjs格式 * @param {Dayjs} newendTime 新的结束时间,Dayjs格式 * @param {IBzCalendarNode} item 需要操作的数据 * @memberof IBzResourceAllocationController */ changeNodeStartAndEndDate(newstartTime: Dayjs, newendTime: Dayjs, item: IBzCalendarNode): void; /** * 变更数据起始时间 * * @param {Dayjs} newstartTime 新的起始时间, Dayjs格式 * @param {IBzCalendarNode} item 需要操作的数据 * @memberof IBzResourceAllocationController */ changeNodeStartDate(newstartTime: Dayjs, item: IBzCalendarNode): void; /** * 变更数据结束时间 * * @param {Dayjs} newendTime 新的结束时间,Dayjs格式 * @param {IBzCalendarNode} item 需要操作的数据 * @memberof IBzResourceAllocationController */ changeNodeEndDate(newendTime: Dayjs, item: IBzCalendarNode): void; /** * 根据偏移量计算所属时间 * * @author chitanda * @date 2021-03-14 11:03:24 * @param {number} x * @param {number} y * @return {*} {{ resource: IBzResourceNode; start: Dayjs; }} */ getResourceAndDateByOffset(x: number, y: number): { resource: IBzResourceNode; start: Dayjs; }; /** * 时间是否在某天冲突 * * @param {IBzCalendarNode} self 项 * @param {Dayjs} start 当日起始时间 * @param {Dayjs} [newstartTime] 需要计算的起始时间 * @param {Dayjs} [newendTime] 需要计算的结束时间 * @return {*} {boolean} * @memberof IBzResourceAllocationController */ isOverlapsTodayTime(self: IBzCalendarNode, start: Dayjs, newstartTime?: Dayjs, newendTime?: Dayjs): boolean; /** * 是否出现时间重叠 * * @protected * @param {IBzCalendarNode} self 项 * @param {IBzCalendarNode[]} items 需要判断的数据集 * @param {Dayjs} newstartTime 需要计算的起始时间 * @param {Dayjs} newendTime 需要计算的结束时间 * @returns {boolean} * @memberof IBzResourceAllocationController */ protected isOverlapsTime(self: IBzCalendarNode, items: IBzCalendarNode[], newstartTime: Dayjs, newendTime: Dayjs): boolean; /** * 计算日起始时间 * * @param {string} date 日期 * @returns {Dayjs} * @memberof IBzResourceAllocationController */ calcDayStartDate(date: string): Dayjs; /** * 计算日结束时间 * * @param {string} date * @returns {Dayjs} * @memberof IBzResourceAllocationController */ calcDayEndDate(date: string): Dayjs; /** * 根据「起始」时间计算天的标识 * * @author chitanda * @date 2021-03-09 21:03:30 * @param {string} resourceId 资源标识 * @param {Dayjs} m 时间 * @param {boolean} [fix] 是否修正时间偏移 * @return {*} {string} */ calcDayKey(resourceId: string, m: Dayjs, fix?: boolean): string; /** * 合成日期层级缓存唯一id * * @param {string} resourceId * @param {string} date * @return {*} {string} * @memberof IBzResourceAllocationController */ calcResourceLevelKey(resourceId: string, date: string): string; /** * 计算偏移量,修正Y轴滚动条偏移 * * @author chitanda * @date 2021-03-14 11:03:21 * @param {*} e * @param {HTMLDivElement} el * @return {*} {{ x: number; y: number }} */ calcOffset(e: any, el: HTMLDivElement): { x: number; y: number; }; }