2023-08-29 14:50:42 +00:00
|
|
|
// the list of widget types with their labels and icons
|
|
|
|
import {IWidgetType} from "app/common/widgetTypes";
|
|
|
|
import {IconName} from "app/client/ui2018/IconList";
|
|
|
|
|
|
|
|
export const widgetTypesMap = new Map<IWidgetType, IWidgetTypeInfo>([
|
|
|
|
['record', {label: 'Table', icon: 'TypeTable'}],
|
|
|
|
['single', {label: 'Card', icon: 'TypeCard'}],
|
|
|
|
['detail', {label: 'Card List', icon: 'TypeCardList'}],
|
|
|
|
['chart', {label: 'Chart', icon: 'TypeChart'}],
|
2023-12-12 09:58:20 +00:00
|
|
|
['form', {label: 'Form', icon: 'Board'}],
|
2023-08-29 14:50:42 +00:00
|
|
|
['custom', {label: 'Custom', icon: 'TypeCustom'}],
|
2023-10-06 09:11:37 +00:00
|
|
|
['custom.calendar', {label: 'Calendar', icon: 'TypeCalendar'}],
|
2023-08-29 14:50:42 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
// Widget type info.
|
|
|
|
export interface IWidgetTypeInfo {
|
|
|
|
label: string;
|
|
|
|
icon: IconName;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the widget type info for sectionType, or the one for 'record' if sectionType is null.
|
|
|
|
export function getWidgetTypes(sectionType: IWidgetType | null): IWidgetTypeInfo {
|
|
|
|
return widgetTypesMap.get(sectionType || 'record') || widgetTypesMap.get('record')!;
|
|
|
|
}
|