UNPKG

@blinkk/selective-edit

Version:
87 lines (86 loc) 3.3 kB
import { DeepObject } from '../../utility/deepObject'; import { Field, FieldConfig } from '../field'; import { GlobalConfig, SelectiveEditor } from '../editor'; import { TemplateResult } from 'lit-html'; import { FieldsComponent } from '../fields'; import { Types } from '../types'; export interface GroupFieldConfig extends FieldConfig { /** * Fields to be grouped and hidden. */ fields?: Array<FieldConfig>; /** * Is the group expanded to show the fields? * * Set to `true` to expand the group by default. */ isExpanded?: boolean; /** * Preview field keys. * * When showing a preview of the group, use these field keys to determine * the value to show for the preview. * * If no fields are no preview will be shown for the group when collapsed. */ previewFields?: Array<string>; } export declare class GroupField extends Field { config: GroupFieldConfig; fields?: FieldsComponent; usingAutoFields: boolean; constructor(types: Types, config: GroupFieldConfig, globalConfig: GlobalConfig, fieldType?: string); classesForField(): Record<string, boolean>; protected createFields(fieldConfigs: Array<any>): FieldsComponent; protected ensureFields(): void; get isClean(): boolean; /** * Check if the data format is invalid for what the field expects to edit. */ get isDataFormatValid(): boolean; get isValid(): boolean; templateHeader(editor: SelectiveEditor, data: DeepObject): TemplateResult; /** * Template for rendering the field header structure. * * @param editor Selective editor used to render the template. * @param data Data provided to render the template. */ templateHeaderStructure(editor: SelectiveEditor, data: DeepObject): TemplateResult; /** * Template for rendering the field input. * * The help text is part of the input template so complex inputs can * use zones for the help text. * * @param editor Selective editor used to render the template. * @param data Data provided to render the template. */ templateInput(editor: SelectiveEditor, data: DeepObject): TemplateResult; /** * Template for rendering the field label. * * @param editor Selective editor used to render the template. * @param data Data provided to render the template. */ templateLabel(editor: SelectiveEditor, data: DeepObject): TemplateResult; get value(): Record<string, any>; /** * Template for rendering the field preview. * * When the group is collapsed, show a set of previews for a few values in the group. * * @param editor Selective editor used to render the template. * @param data Data provided to render the template. */ templatePreview(editor: SelectiveEditor, data: DeepObject): TemplateResult; /** * Template for rendering the field preview. * * When the group is collapsed, show a set of previews for a few values in the group. * * @param editor Selective editor used to render the template. * @param data Data provided to render the template. */ templatePreviewField(editor: SelectiveEditor, data: DeepObject, fieldKey: string): TemplateResult; }