mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-20 01:02:22 +00:00
a424450cbe
Summary: A new widget type Forms. For now hidden behind GRIST_EXPERIMENTAL_PLUGINS(). This diff contains all the core moving parts as a serves as a base to extend this functionality further. Test Plan: New test added Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4130
25 lines
971 B
TypeScript
25 lines
971 B
TypeScript
// 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'}],
|
|
['form', {label: 'Form', icon: 'Board'}],
|
|
['custom', {label: 'Custom', icon: 'TypeCustom'}],
|
|
['custom.calendar', {label: 'Calendar', icon: 'TypeCalendar'}],
|
|
]);
|
|
|
|
// 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')!;
|
|
}
|