UNPKG

react-js-plugins

Version:

A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.

94 lines (93 loc) 6.66 kB
import { FormRef, ValidationResult, FlattenedObject } from "../typesdts/types"; import * as Yup from 'yup'; export declare const _scrollToTop: () => void; export declare const _batchProcess: <T>(data: T[], batchSize: number, processFn: (item: T) => Promise<void>) => Promise<void>; export declare const _flattenObject: (obj: any, prefix?: string) => FlattenedObject; export declare const _deepMerge: (target: any, source: any) => any; export declare const _chunk: <T>(arr: T[], size: number) => T[][]; export declare const _asyncDebounce: (fn: (...args: any[]) => Promise<void>, delay: number) => (...args: any[]) => Promise<void>; export declare function _throttle<T extends (...args: any[]) => void>(func: T, limit: number): (...args: Parameters<T>) => void; export declare const _deepCloneArray: <T>(arr: T[]) => T[]; export declare const _getMaxMinValue: (arr: number[]) => { max: number; min: number; }; export declare const _asyncMap: <T, U>(arr: T[], asyncFn: (item: T) => Promise<U>) => Promise<U[]>; export declare const _transformAsyncData: <T, U>(arr: T[], transformer: (item: T) => Promise<U>) => Promise<U[]>; export declare const _getNestedProperty: (obj: Record<string, any>, path: string) => Record<string, any>; export declare const _deepEqual: (obj1: any, obj2: any) => boolean; export declare const _mergeArrays: <T>(arr1: T[], arr2: T[]) => T[]; export declare const _filterDuplicates: <T>(arr: T[], uniqueKey: keyof T) => T[]; export declare const _sortByKey: <T>(arr: T[], key: keyof T) => T[]; export declare const _mapAsync: <T, U>(arr: T[], asyncFn: (item: T) => Promise<U>) => Promise<U[]>; export declare const _formatDate: (date: Date, format: string) => string; export declare function _localeDateFormat(date: Date | string, locale?: string, options?: Intl.DateTimeFormatOptions): string; export declare const _calPercentage: (value: number, total: number) => number; export declare const _sum: (numbers: number[]) => number; export declare const _average: (numbers: number[]) => number; export declare const _getPriceAfterTax: (price: number, taxRate: number) => number; export declare const _calculateTimeDifference: (startDate: Date, endDate: Date) => string; export declare const _arrayIncludesObject: (arr: any[], obj: any) => boolean; export declare const _toCamelCase: (str: string) => string; export declare const _freeze: <T extends Record<string, unknown>>(obj: T) => Readonly<T> | null; export declare const _isFreeze: <T extends Record<string, unknown>>(obj: T | null) => boolean; export declare const _seal: <T extends Record<string, unknown>>(obj: T) => T | null; export declare const _isSeal: <T extends Record<string, unknown>>(obj: T | null) => boolean; export declare const _arrayToObject: (arr: [string, any][]) => { [key: string]: any; }; export declare const _objectToArray: (obj: any) => any[][]; export declare const _arrayToObjectByKey: (arr: any[], key: string) => any; export declare const _isInArray: (arr: any[], value: any) => boolean; export declare const _getObjectValues: (obj: object) => any[]; export declare const _swapArrayElements: (arr: any[], index1: number, index2: number) => void; export declare const _filterObjectByKey: (obj: object, keys: string[]) => { [k: string]: any; }; export declare const _getScrollPosition: () => { scrollX: number; scrollY: number; }; export declare const _arrayIntersection: (arr1: any[], arr2: any[]) => any[]; export declare const _getArrayOfObjectsByProperty: (arr: any[], key: string, value: any) => any[]; export declare const _downloadBlob: (blob: Blob, filename: string) => void; export declare const _downloadFile: (response: any, defaultName?: string) => void; export declare const _fileToBase64: (file: any) => Promise<unknown>; export declare const _base64ToBlob: (base64: string) => Blob; export declare const _downloadBase64File: (base64Data: string, fileName: string) => void; export declare const _initializeFormValues: (fields: string[]) => { [key: string]: any; }; export declare const _dynamicRequiredValidation: (requiredFields: string[]) => Yup.ObjectSchema<any>; export declare const _generateYupValidation: (fields: string[]) => Yup.ObjectSchema<any>; export declare const _initializeFormikFields: (fields: string[]) => { [key: string]: string; }; export declare const _setNestedProperty: (obj: any, path: string, value: any) => any; export declare const _transformArray: <T, R>(arr: T[], transformFn: (item: T) => R) => R[]; export declare const _findObjectById: <T>(arr: T[], id: string) => T | undefined; export declare const _getUniqueValues: (arr: any[]) => any[]; export declare const _mergeArraysByKey: (arr1: any, arr2: any, key: string) => any[]; export declare const _removeDuplicates: (arr: any, key: string) => any; export declare const _groupBy: (arr: any, key: string) => any; export declare const _arrayDiff: <T>(arr1: T[], arr2: T[]) => T[]; export declare const _deepCompareArrays: <T>(arr1: T[], arr2: T[]) => boolean; export declare const _updateObjectInArray: (arr: [], key: string, value: any, update: any) => any[]; export declare const _getKeyByValue: (obj: Record<string, any> | null | undefined, value: any) => string | null; export declare const _getValueByKey: (obj: Record<string, any> | null | undefined, key: string) => any; export declare const _getKeysByValue: (obj: Record<string, any> | null | undefined, value: any) => string[]; export declare const _dateFormat: (date: Date, format?: string) => string; export declare const _dateTransformer: (data: any) => any; export declare const _escapeRegExpMatch: (s: string) => string; export declare const _isExactMatch: (str: string, match: string) => boolean; export declare const _bytesToSize: (bytes: number, decimals?: number) => string; export declare const _swapArrayByKey: (arr: any, key: string) => any; export declare const _setTouchedFields: (formRef: any, errors: any) => void; export declare const _isValidForm: (formRef: any) => Promise<boolean>; export declare const _isStepValid: (formRef: any, fieldsToCheck: string[]) => Promise<boolean>; export declare const _validateFormRef: (formRef: FormRef) => Promise<ValidationResult>; export declare const _handleParentsMenu: (currentArr: any, menuID: string) => void; export declare const _handleParentNode: (currentArr: any, menuID: string, permissionKey: string) => void; export declare const _handleChildrenMenu: (currentArr: any, parentKey: any, checked: boolean) => void; export declare const _handlePermissions: (currentArr: any, currentObj: any, permissionKey: string, isChecked: boolean) => any; export declare const _isValidYupSchema: (schema: any) => boolean;