import type { AfterPatchCallback, InsertType, JSONParser, JSONSelection, OnChange, OnChangeText, OnJSONSelect, OnPatch } from '../types'; import { type JSONPatchOperation, type JSONPath } from 'immutable-json-patch'; export interface OnCutAction { json: unknown | undefined; selection: JSONSelection | undefined; indentation: string | number | undefined; readOnly: boolean; parser: JSONParser; onPatch: OnPatch; } export declare function onCut({ json, selection, indentation, readOnly, parser, onPatch }: OnCutAction): Promise; export interface OnCopyAction { json: unknown; selection: JSONSelection | undefined; indentation: string | number | undefined; parser: JSONParser; } export declare function onCopy({ json, selection, indentation, parser }: OnCopyAction): Promise; type RepairModalCallback = (text: string, onApply: (repairedText: string) => void) => void; interface OnPasteAction { clipboardText: string; json: unknown | undefined; selection: JSONSelection | undefined; readOnly: boolean; parser: JSONParser; onPatch: OnPatch; onChangeText: OnChangeText; onPasteMultilineText: (pastedText: string) => void; openRepairModal: RepairModalCallback; } export declare function onPaste({ clipboardText, json, selection, readOnly, parser, onPatch, onChangeText, onPasteMultilineText, openRepairModal }: OnPasteAction): void; /** * When pasting text, we cannot always know how whether the text was intended as * a list with items that should be parsed into a JSON Array (after jsonrepair), * or a text with multiple lines that should be parsed into a single string. * * This function checks whether we're dealing with such a case, after which * we can show a message to the user asking about the intended behavior. */ export declare function isMultilineTextPastedAsArray(clipboardText: string, operators: JSONPatchOperation[], parser: JSONParser, maxSize?: number): boolean; export interface OnRemoveAction { json: unknown | undefined; text: string | undefined; selection: JSONSelection | undefined; keepSelection: boolean; readOnly: boolean; onChange: OnChange; onPatch: OnPatch; } export declare function onRemove({ json, text, selection, keepSelection, readOnly, onChange, onPatch }: OnRemoveAction): void; export interface OnDuplicateRowAction { json: unknown | undefined; selection: JSONSelection | undefined; columns: JSONPath[]; readOnly: boolean; onPatch: OnPatch; } /** * This function assumes that the json holds the Array that we're duplicating a row for, * it cannot duplicate something in some nested array */ export declare function onDuplicateRow({ json, selection, columns, readOnly, onPatch }: OnDuplicateRowAction): void; export interface OnInsertBeforeRowAction { json: unknown | undefined; selection: JSONSelection | undefined; columns: JSONPath[]; readOnly: boolean; onPatch: OnPatch; } /** * This function assumes that the json holds the Array that we're duplicating a row for, * it cannot duplicate something in some nested array */ export declare function onInsertBeforeRow({ json, selection, columns, readOnly, onPatch }: OnInsertBeforeRowAction): void; export interface OnInsertAfterRowAction { json: unknown | undefined; selection: JSONSelection | undefined; columns: JSONPath[]; readOnly: boolean; onPatch: OnPatch; } /** * This function assumes that the json holds the Array that we're duplicating a row for, * it cannot duplicate something in some nested array */ export declare function onInsertAfterRow({ json, selection, columns, readOnly, onPatch }: OnInsertAfterRowAction): void; export interface OnRemoveRowAction { json: unknown | undefined; selection: JSONSelection | undefined; columns: JSONPath[]; readOnly: boolean; onPatch: OnPatch; } /** * This function assumes that the json holds the Array that we're duplicating a row for, * it cannot duplicate something in some nested array */ export declare function onRemoveRow({ json, selection, columns, readOnly, onPatch }: OnRemoveRowAction): void; export interface OnInsert { insertType: InsertType; selectInside: boolean; json: unknown | undefined; selection: JSONSelection | undefined; initialValue: string | undefined; readOnly: boolean; parser: JSONParser; onPatch: OnPatch; onReplaceJson: (updatedJson: unknown, afterPatch: AfterPatchCallback) => void; } export declare function onInsert({ insertType, selectInside, initialValue, json, selection, readOnly, parser, onPatch, onReplaceJson }: OnInsert): void; export interface OnInsertCharacter { char: string; selectInside: boolean; json: unknown | undefined; selection: JSONSelection | undefined; readOnly: boolean; parser: JSONParser; onPatch: OnPatch; onReplaceJson: (updatedJson: unknown, afterPatch: AfterPatchCallback) => void; onSelect: OnJSONSelect; } export declare function onInsertCharacter({ char, selectInside, json, selection, readOnly, parser, onPatch, onReplaceJson, onSelect }: OnInsertCharacter): Promise; export {};