/// import type { Layout } from 'publ-echo/dist/lib'; import type { ResizeEventType } from 'publ-echo/dist/lib/GridItem/types'; import type { ComponentBlock, GroupBlock } from 'publ-echo/dist/lib/GridLayoutEditor/group'; import type { LayoutItem, Layouts } from 'publ-echo/dist/lib/GridLayoutEditor/types'; export type TypeOfSectionAction = ActionMap[keyof ActionMap]; export type PayloadCBType = { type: ComponentBlock['type']; blockId: string; cbId: number; workDir: string; }; export type PayloadGBType = { type: GroupBlock['type']; blockId: string; childrenBlockIds: string[]; childrenCBIds: number[]; workDir: string; }; export type PayloadBulkType = { type: 'BULK'; blockId: 'BULK'; childrenBlockIds: string[]; childrenCBIds: number[]; workDir: string; groupDisabled: boolean; }; export type BlockPayloadType = PayloadCBType | PayloadGBType | PayloadBulkType; type ActionHandlerPayload = { '@EXP_IFRAME/IFRAME_ON_LOADED': { event: React.SyntheticEvent; multiPurposeUrl: string; }; '@CUSTOMSECTION/CB_DRAG_START': { layout: Layout; prev?: LayoutItem; item?: LayoutItem; placeholder?: LayoutItem; e?: ResizeEventType; node?: HTMLElement; }; '@CUSTOMSECTION/CB_DRAG_STOP': { layout: Layout; prev?: LayoutItem; item?: LayoutItem; placeholder?: LayoutItem; e?: ResizeEventType; node?: HTMLElement; blockId: string; workDir: string; }; '@CUSTOMSECTION/CB_RESIZE_STOP': { layout: Layout; prev?: LayoutItem; item?: LayoutItem; placeholder?: LayoutItem; e?: ResizeEventType; node?: HTMLElement; blockId: string; workDir: string; }; '@CUSTOMSECTION/CB_AUTO_FIT_CONTENT': { layout: Layout; prev?: LayoutItem; item?: LayoutItem; placeholder?: LayoutItem; e?: ResizeEventType; node?: HTMLElement; details: { hadPaddingChanged: boolean; }; blockId: string; workDir: string; }; '@CUSTOMSECTION/PLACEMENT_CHANGED': { layout: Layout; layouts: Layouts; }; '@CUSTOMSECTION/BLOCK_CLICKED': { block: BlockPayloadType; }; '@CUSTOMSECTION/CB_RIGHT_CLICKED': { e: React.MouseEvent; block: BlockPayloadType; }; '@CUSTOMSECTION/SECTION_CLICKED': { sectionId: number; }; '@CUSTOMSECTION/SECTION_RIGHT_CLICKED': { sectionId: number; e: React.MouseEvent; }; '@CUSTOMSECTION/GROUP_RIGHT_CLICKED': { e: React.MouseEvent; block: PayloadGBType; isEditingGroup: boolean; }; '@CUSTOMSECTION/BULK_RIGHT_CLICKED': { e: React.MouseEvent; block: PayloadBulkType; }; '@CUSTOMSECTION/BULK_CREATED': { message: string; data: LayoutItem; }; '@CUSTOMSECTION/BULK_DISMISSED': { message: string; editingGroupBlock: string; }; '@CUSTOMSECTION/COLLISION_NOT_FOUND': { message: string; }; '@CUSTOMSECTION/ESCAPE_ONE_FROM_BULK': { id: string; }; '@CUSTOMSECTION/BULK_DRAG_STOP': { updatedBlocks: UpdatedBlock[]; }; '@CUSTOMSECTION/GROUP_DRAG_STOP': { updatedBlocks: UpdatedBlock[]; workDir: string; }; '@CUSTOMSECTION/WORKDIR_CHANGED': { workDir: string; }; }; export type UpdatedBlock = { blockId: string; cbId: number; x: number; y: number; }; type ActionMap = { [Key in keyof M]: M[Key] extends undefined ? { type: Key; } : { type: Key; payload: M[Key]; }; }; export {};