@sanity/form-builder
Version:
Sanity form builder
58 lines • 2.45 kB
TypeScript
import React from 'react';
import { ArraySchemaType, Marker, Path, SchemaType } from '@sanity/types';
import { FormFieldPresence } from '@sanity/base/presence';
import { PatchEvent } from '../../../PatchEvent';
import ArrayFunctions from '../common/ArrayFunctions';
import { PrimitiveValue } from './types';
export interface Props {
type: ArraySchemaType<PrimitiveValue>;
value: PrimitiveValue[];
compareValue?: PrimitiveValue[];
level: number;
onChange: (event: PatchEvent) => void;
onFocus: (path: Path) => void;
onBlur: () => void;
focusPath: Path;
ArrayFunctionsImpl: typeof ArrayFunctions;
readOnly?: boolean;
markers: Marker[];
presence: FormFieldPresence[];
}
export declare class ArrayOfPrimitivesInput extends React.PureComponent<Props> {
_element: HTMLElement | null;
_lastAddedIndex: number;
set(nextValue: PrimitiveValue[]): void;
removeAt(index: number): void;
handleAppend: (itemValue: PrimitiveValue) => void;
handlePrepend: (itemValue: PrimitiveValue) => void;
insertAfter(index: number, type: SchemaType): void;
handleRemoveItem: (index: number) => void;
handleInsert: (pos: 'before' | 'after', index: number, item: PrimitiveValue) => void;
handleItemChange: (event: PatchEvent) => void;
handleItemEnterKey: (index: number) => void;
handleItemEscapeKey: (index: number) => void;
handleSortEnd: (event: {
oldIndex: number;
newIndex: number;
}) => void;
getMemberType(typeName: string): import("@sanity/types").BooleanSchemaType | import("@sanity/types").StringSchemaType | import("@sanity/types").NumberSchemaType | import("@sanity/types").ObjectSchemaType | import("@sanity/types").ReferenceSchemaType;
setElement: (el: HTMLElement | null) => void;
focus(): void;
handleFocusRoot: (event: any) => void;
getSnapshotBeforeUpdate(prevProps: any, prevState: any): {
prevFocusedIndex: import("@sanity/types").PathSegment;
restoreSelection: {
text: string;
start: number;
end: number;
value: string;
};
} | {
prevFocusedIndex?: undefined;
restoreSelection?: undefined;
};
componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
handleFocusItem: (item: PrimitiveValue, index: number) => void;
render(): React.JSX.Element;
}
//# sourceMappingURL=ArrayOfPrimitivesInput.d.ts.map