export interface FieldExtensionProps {
name: string;
locale?: string;
isTableCell: boolean;
value: any;
onBlur: <T extends HTMLElement = HTMLElement>(
event?: FocusEvent<T>,
) => Promise<void>;
onChange: <T extends HTMLElement = HTMLElement>(
event: ChangeEvent<T> | any,
) => Promise<void>;
onFocus: <T extends HTMLElement = HTMLElement>(
event?: FocusEvent<T>,
) => Promise<void>;
meta: {
active: boolean;
error: any;
touched: boolean;
};
openAssetPicker: () => Promise<null | (Asset & Record<string, unknown>)>;
form: {
change: <Value = any>(name: string, value: Value) => Promise<void>;
getState: <Values = Record<string, any>>() => Promise<FormState<Values>>;
getFieldState: <Value = any>(
fieldName: string,
) => Promise<FieldState<Value>>;
subscribeToFieldState: <Value = any>(
name: string,
callback: (state: FieldState<Value>) => any,
subscription: FieldSubscription,
) => Promise<() => any>;
subscribeToFormState: <Values = Record<string, any>>(
callback: Subscriber<FormState<Values>>,
subscription: FormSubscription,
) => Promise<() => any>;
};
field: {
id: string;
apiId: string;
description: string | null;
displayName: string;
isList: boolean;
isLocalized?: boolean;
isRequired?: boolean;
isUnique?: boolean;
isPreview: boolean;
type: FieldExtensionType;
};
model: {
apiId: string;
apiIdPlural: string;
id: string;
description: string | null;
displayName: string;
isLocalized: boolean;
};
extension: {
config: Record<string, any>;
status: 'connected' | 'connecting' | 'error' | 'disconnected';
};
isExpanded: boolean;
expand: (expand: boolean | ((isExpanded: boolean) => boolean)) => void;
context: {
project: {
id: string;
name: string;
mgmtApi: string;
mgmtToken: string;
};
environment: {
id: string;
name: string;
endpoint: string;
authToken: string;
};
};
openDialog: <DialogReturn = any, DialogProps = Record<string, any>>(
src: string,
props?: {
disableOverlayClick?: boolean;
maxWidth?: string;
ariaLabel?: string;
} & DialogProps,
) => Promise<DialogReturn | null>;
}