import { BasicProps, BasicState, EditSetting } from '../type' export interface ShareReadItem { type: 'shareRead', id: number, title: string, userDesc: string, shareRead: any, bookDesc: string, shareReadData: any, } export interface BookItem { type: 'book', id: string, title: string, userDesc: string, bookDesc: string, bookData: any, } export type ItemType = ShareReadItem | BookItem; export function isShareReadItem( item: ItemType ): item is ShareReadItem { return item.type === 'shareRead'; } export function isBookItem( item: ItemType ): item is BookItem { return item.type === 'book'; } export class Props extends BasicProps { public editSetting: EditSetting = { key: 'gaea-snailShareRead-2021', name: '蜗牛共读2021版', isContainer: false, isAutoHeight: true, defaultPosition: { top: '0', left: '0' }, type: ['common', 'snail'], editors: [ '模块配置', { field: 'showCount', type: 'number', text: '模块显示数量:', }, { field: 'style.backgroundColor', text: '背景颜色:', type: 'color' }, '共读ID列表', { field: 'shareReadList', type: 'shareRead' }, ] }; public style: React.CSSProperties = { display: 'block', width: '100%', overflow: 'hidden', zIndex: 2, }; public shareReadList: ItemType[] = [] public showCount: number } export class State extends BasicState { showAll: boolean = false; }