import * as React from "react"; import { Spec as UpdateObject } from "immutability-helper"; import { isObject as _isObject } from "@luomus/laji-map/lib/utils"; import { RJSFSchema } from "@rjsf/utils"; import { FormContext, Translations, ByLang } from "./components/LajiForm"; import { FieldProps, UiSchema } from "./types"; export declare const isObject: typeof _isObject; export declare function isHidden(uiSchema: UiSchema, property: string): boolean; export declare function isDefaultData(formData: any, schema: any): boolean; export declare function getDefaultFormState(schema: RJSFSchema, formData?: T, rootSchema?: RJSFSchema): any; /** * If you use this with schema data, note that this function doesn't check default data. */ export declare function hasData(formData: any): boolean; /** * If you use this with schema data, note that this function doesn't check default data. */ export declare function propertyHasData(field: string, container: any): boolean; export declare function getUpdateObjectFromJSONPath(path: string, injection: any): any; export declare function getUpdateObjectFromJSONPointer(path: string, injection: any): any; export declare function immutableDelete(_obj: any, _delProp: string): any; export declare function getUiOptions(container?: UiSchema): any; export declare function getInnerUiSchema(parentUiSchema?: UiSchema): UiSchema; export declare function isNullOrUndefined(val: any): boolean; export declare function isEmptyString(val: any): boolean; export declare function parseJSONPointer(object: any, jsonPointer: string, safeMode?: true | "createParents", strictEmptyPath?: boolean): any; export declare function parseJSONPointer(object: any, jsonPointer: string, safeMode?: false, strictEmptyPath?: boolean): any | undefined; export declare function getReactComponentName(WrappedComponent: React.ComponentClass): string; export declare function isMultiSelect(schema: any, uiSchema?: UiSchema): boolean; export declare function isSelect(schema: RJSFSchema): boolean; export declare function getTabbableFields(elem: HTMLElement, reverse?: boolean): HTMLElement[]; export declare function isTabbableInput(elem: HTMLElement): boolean | RegExpMatchArray; export declare function canFocusNextInput(root: React.ReactInstance, inputElem: HTMLElement): any; export declare function findNearestParentSchemaElem(elem: HTMLElement | null | undefined): HTMLElement | null | undefined; export declare function findNearestParentTabbableElem(elem: HTMLElement): HTMLElement | undefined; export interface ReactUtilsType { findNearestParentSchemaElemId: (elem: HTMLElement) => string | undefined; getSchemaElementById: (id: string) => HTMLElement | null; focusById: (id: string, focus?: boolean) => boolean; focusAndScroll: (idToFocus?: string, idToScroll?: string, focus?: boolean) => boolean | undefined; shouldSyncScroll: () => boolean; syncScroll: (force: boolean) => void; filterItemIdsDeeply: (item: any, idSchemaId: string) => any; formDataIsEmpty: (props: FieldProps) => boolean; formDataEquals: (f1: any, f2: any, id: string) => boolean; keyboardClick: (fn: (e: KeyboardEvent | React.KeyboardEvent) => void) => (e: (KeyboardEvent | React.KeyboardEvent)) => void; getNextInput: (inputElem: HTMLElement, reverseDirection: boolean) => HTMLElement | undefined; focusNextInput: (reverseDirection: boolean) => void; getNextInputInInputs: (inputElem: HTMLElement | undefined, reverseDirection: boolean, fields: HTMLElement[]) => HTMLElement | undefined; } export declare const ReactUtils: (context: FormContext) => ReactUtilsType; export declare const getNextInputInInputs: (formContext: FormContext) => (inputElem: HTMLElement | undefined, reverseDirection: boolean | undefined, fields: HTMLElement[]) => HTMLElement | undefined; export declare const getNextInput: (formContext: FormContext) => (inputElem: HTMLElement, reverseDirection?: boolean) => HTMLElement | undefined; export declare const focusNextInput: (formContext: FormContext) => (reverseDirection?: boolean) => boolean; export declare const findNearestParentSchemaElemId: (elem: HTMLElement) => string | undefined; export declare const getSchemaElementById: (id: string) => HTMLElement | null; export declare const focusById: (context: FormContext, id: string, focus?: boolean) => boolean; export declare const focusAndScroll: (context: FormContext, idToFocus?: string, idToScroll?: string, focus?: boolean) => boolean | undefined; export declare const shouldSyncScroll: (context: FormContext) => boolean; export declare const _syncScroll: (context: FormContext) => (force?: boolean) => void; export declare const syncScroll: (context: FormContext, force: boolean) => void; export declare const filterLajiFormId: (item: any) => any; export declare const filterItemId: (item: any) => any; export declare const filterItemIdsDeeply: (item: any, context: FormContext, idSchemaId: string) => any; export declare const formDataIsEmpty: (props: FieldProps, context: FormContext) => any; export declare const formDataEquals: (f1: any, f2: any, context: FormContext, id: string) => any; export declare const keyboardClick: (fn: (e: KeyboardEvent | React.KeyboardEvent) => void, context: FormContext) => (e: KeyboardEvent | React.KeyboardEvent) => void; export declare function getNestedTailUiSchema(uiSchema: UiSchema): UiSchema; export declare function updateTailUiSchema(uiSchema: UiSchema, updateObject: UpdateObject): UiSchema; export declare function getNestedUiFieldsList(uiSchema: UiSchema): any[]; type BootstrapColumns = { lg: number; md: number; sm: number; xs: number; }; export declare function getBootstrapCols(width: number): BootstrapColumns; export declare function isDescendant(parent: HTMLElement | null, child: HTMLElement): boolean; export declare function getKeyHandlerTargetId(target: string | undefined, context: any, formData?: any): string; export declare function capitalizeFirstLetter(string: string): string; export declare function decapitalizeFirstLetter(string: string): string; export declare function stringifyKeyCombo(keyCombo?: string): string; export declare function canAdd(props: any): any; export declare function bsSizeToPixels(bsSize: keyof BootstrapColumns): 768 | 1200 | 992 | 576; export declare function pixelsToBsSize(pixels: number): "" | "lg" | "md" | "sm" | "xs"; export declare function applyFunction(props: FieldProps): any; export declare function getWindowScrolled(): number; export declare function getScrollPositionForScrollIntoViewIfNeeded(elem: Element, topOffset?: number, bottomOffset?: number): number; export declare function scrollIntoViewIfNeeded(elem: HTMLElement, topOffset?: number, bottomOffset?: number): void; export declare function filter(properties: any[], filter: string[], filterType?: "blacklist" | "whitelist", getValue?: (s: string) => any): any[]; export declare function updateSafelyWithJSONPath(obj: any, value: any, path: string, immutably: boolean, createNew: (obj: any, split: string) => any): any; export declare function updateSafelyWithJSONPointer(obj: any, value: any, path: string, immutably?: boolean, createNew?: (obj: any, split: string, o?: any, _split?: string) => any): any; export declare function injectButtons(uiSchema: any, buttons: any[], buttonsPath: string): any; export declare function dictionarify(array: any[], getKey?: (item: any) => string, getValue?: (item: any) => any): any; export declare function formatValue(props: FieldProps, _formatter?: any, parentProps?: any): any; export declare const formatErrorMessage: (msg: string) => string; export declare function checkRules(rules: any[], props: FieldProps, cache?: { [key: string]: any; }, prop?: keyof FieldProps): boolean | { passes: boolean; cache: { [key: string]: any; }; }; export declare function checkArrayRules(rules: any[], props: FieldProps, idx: number, cache?: { [key: string]: any; }, prop?: keyof FieldProps): boolean | { passes: boolean; cache: { [key: string]: any; }; }; export declare function bringRemoteFormData(formData: any, formContext: FormContext): any; export declare function triggerParentComponent(eventName: string, e: React.SyntheticEvent, props: any): void; export declare function parseSchemaFromFormDataPointer(schema: RJSFSchema, pointer: string): any; export declare function parseUiSchemaFromFormDataPointer(uiSchema: any, pointer: string): any; export declare function checkJSONPointer(obj: any, pointer: string): boolean; export declare const JSONPointerToId: (fieldName: string) => string; export declare const idSchemaIdToJSONPointer: (id: string) => string; export declare function schemaJSONPointer(schema: RJSFSchema, JSONPointer: string): string | undefined; export declare function uiSchemaJSONPointer(schema: RJSFSchema, JSONPointer: string): string | undefined; export declare function updateFormDataWithJSONPointer(schemaProps: Pick, value: any, path: string): any; export declare const assignUUID: (item: any, immutably?: boolean) => any; export declare const getUUID: (item?: any) => number | string | undefined; /** * Return item UUID or the parent UUID **/ export declare const getFieldUUID: (props: { formData?: any; formContext: FormContext; }) => string | number; export declare function addLajiFormIds(_formData: any, tree: any, immutably?: boolean): [any, { [id: string]: true; }]; export declare function getAllLajiFormIdsDeeply(_formData: any, tree: any): { [id: string]: true; }; export declare function removeLajiFormIds(formData: any, tree: any): any; export declare function findPointerForLajiFormId(tmpIdTree: any | undefined, formData: any, lajiFormId: any): string | undefined; export declare function highlightElem(elem?: Element): void; export declare function filteredErrors(errorSchema: any): any; export declare function constructTranslations(translations: { [word: string]: { [lang: string]: string; }; }): Translations; export declare function getIdxWithOffset(idx: number, offsets?: Record, totalOffset?: number): number; export declare function getIdxWithoutOffset(idx: number, offsets?: Record, totalOffset?: number): number; /** * The indices of the formData that a component receives doesn't match the actual root formData indices, * if the data is sorted or has offsets. This returns the original index. */ export declare function getFormDataIndex(idx: number, uiSchema: any): number; /** * Given an index pointing to actual index in root formData, returns the index with sorting & offset applied. */ export declare function getReversedFormDataIndex(idx: number, uiSchema: any): number; export declare function toJSONPointer(s: string): string; export declare function getTitle(props: { schema: RJSFSchema; uiSchema: any; name?: string; }, idx?: number): any; export declare const classNames: (...cs: any[]) => string; export declare function translate(translations: ByLang, key: string, params?: { [key: string]: string | undefined; }): string; /** * @param value the default value of the setter * @returns [stateValue, setTrue, setFalse] */ export declare function useBooleanSetter(value: boolean): [boolean, () => void, () => void]; export declare function usePrevious(value: T): T | undefined; export declare function asArray(maybeArr: T | T[]): T[]; export declare function getLajiUri(lajiId: string): string; export {};