mx-ui-components
Version:
mobius ui library
149 lines (148 loc) • 9.42 kB
TypeScript
import { type ComponentMetadata } from "./loader";
import BaseComponent from "../Counter/BaseComponent";
import OverlayPanel from "../Counter/OverlayPanel";
export declare function addMissingDefaults<T extends Record<string, any>>(jsonObj: T, defaults: Record<string, any>): T;
export declare function hideComponent(component: ComponentMetadata): ComponentMetadata;
export declare function unClamp(element: BaseComponent, clamp: number): void;
export declare function clamp(element: BaseComponent, clamp: number): void;
export declare function downloadFromURL(urls: string[], fileName: string): Promise<void>;
export declare function get(obj: any, path: string | Array<string | number>, defaultValue?: any): any;
export declare function set(obj: any, path: string | Array<string | number>, value: any): any;
export declare function getQueryParam(param: string): string | null;
/**
* Recursively binds API response data to a given entity.
*
* @param arrayOfObjs - An array of objects representing the API response.
* @param entity - The entity to bind the API response data to.
* @returns A new array of objects with the API response data bound to the entity.
*
* @remarks
* - The function creates a deep copy of each object in the array.
* - If an object has a propertyKeyInAPIResponse property, it assigns the corresponding value from the entity to the value property of the object.
* - If an object has a children property, the function recursively binds the API response data to the children.
* - If an object has a loopInsideOf property and the entity contains a corresponding array, the function maps over the array and recursively binds the API response data to each element.
*/
export declare function bindAPIResponse(arrayOfObjs: any[], entity: any): any[];
export declare function generateDynamicAccordion(res: any, scope: any, accordionProps: any): void;
export declare function makeConnectionsUsingLeaderLineAsync(sourceIdArray: any[], element2: any, parentElement: any, leaderLineCustomizationProps: any): any[] | undefined;
export declare function makeConnectionsUsingLeaderLine(sourceIdArray: any[], element2: any, leaderLineCustomizationProps: any): any;
export declare function processNodeRecursively(arrayOfObjects: any[], component: any, scope: any, wrapperEl: any, wrapperStyles: string, levelWrapperMap?: Map<number, any>, level?: number): void;
export declare function replace(url: string, category: string): string;
export declare const convertSizeToGB: (size: string) => string;
export declare function handleStateReference(path?: string): {
stateName: string | undefined;
key: string;
};
export declare function replaceTableRowDataKeyRecursively(component: any, uniqueKey: string, rowData: any): void;
export declare function replaceCurlyBraces(obj: any, dataSource?: string, state?: any, props?: any, scope?: BaseComponent | null, removeCurlyBraceFromRegex?: boolean): any;
export declare function replaceCurlyBracesWithoutCurly(obj: any, dataSource?: string, state?: any, props?: any, scope?: BaseComponent | null, removeCurlyBraceFromRegex?: boolean): any;
export declare function parseNestedJSON(obj: any): any;
export declare function replacePlaceholdersFromLocalStorage(obj: any): any;
export declare function searchElement(element: Element, type?: string): any | undefined;
export declare function toggleClasses(element: Element, condition: boolean, addClasses: string[], removeClasses: string[]): void;
export declare function resolveDynamicData(dynamicProps: any, apiResponse: any, props: any): any;
export declare function resolveProps(component: any, data: any): any;
export declare function resolveBindings(component: any, data: any, scope?: BaseComponent): any;
export declare function uploadFile(file: File, scope: BaseComponent): Promise<any>;
export declare function appendBearerToToken(token: string): string;
export declare function createDynamicChart(chartOptions: any, parent: any, value: any, scope: BaseComponent, chartData: any): void;
export declare function traverseObject(obj: any, callback: (key: string, value: any) => void): void;
export declare function traverseObjectAndUpdate(obj: any, callback: (key: string, value: any) => {
key: string;
value: any;
}): any;
export declare function traverseComponentMetadata(component: ComponentMetadata, callback: (component: ComponentMetadata) => void): void;
export declare function addOrRemoveStyles(scope: any, type: string, styles: string): void;
export declare function attachEventStyles(eventStyles: any, scope: any): void;
export declare function cloneDeep(value: any): any;
export declare function generateUUID(): string;
export declare function formatCustomDate(datearg: any): string;
export declare function createAccordion(accordionComponent: any, scope: BaseComponent): HTMLDivElement;
export declare function formatTimestamp(timestamp: string): string;
/**
* Determines the time category for a given date.
*/
export declare function getTimeCategory(date: Date): string;
export declare function makeAPiCall(source: string, payload: any | undefined, method: string | undefined, token: string, tokenKey?: string, getResponse?: boolean, payloadType?: string, header?: {}): Promise<any>;
type SafeOptions = {
callbackFn: string;
whitelist?: string[];
};
export declare function safeMap<T, U = any>(value: T[], options: SafeOptions, scope: BaseComponent, isReplaceEnabled?: boolean): U[] | T[];
export declare function safeFilter<T>(value: T[], options: SafeOptions, scope: BaseComponent): T[];
export declare function safeSome<T>(value: T[], options: SafeOptions, scope: BaseComponent): Boolean;
export declare function fetchAPI(API: any, APIData: any, value: any, scope: BaseComponent | undefined): Promise<any>;
export declare function evaluateCondition(cond: string, value: any, scope: BaseComponent): boolean;
export declare function recursiveResolveComponent(component: any, data: any, value: any, index: number): any;
export declare function findKeysInNestedObject(obj: any, keysToFind: string[]): {
[key: string]: any;
};
export declare function appendToJSONId(dropdownList: any, valuesToModify: any, appendValue: any): any;
export declare function convertStringToObject(str: any): any;
export declare function replaceNestedValuesInObj(template: {
[key: string]: any;
}, values: {
[key: string]: any;
}): any;
export declare function throttle(fn: Function, delay: number): (...args: unknown[]) => void;
export declare function registerNode(value: any, scope: any): void;
export declare const timestampToDate: (timestamp: number | string, props: any) => string | number;
export declare function fromValidationToError(value: any, scope: any, stateProps: any[]): Boolean;
export declare function showToast(props: any, scope?: BaseComponent | null): Boolean;
export declare function changeCSSOfTargetElement(value: any): any;
export declare function getConnectionDetails(socketio: any): {
serverUrl: string;
namespace: string;
config: {};
onConnect: {
name: string;
data: {};
};
};
export declare function getListenerDetails(socketio: any): {
serverUrl: string;
namespace: string;
names: never[];
};
export declare function removeNodeConnections(value: any, scope: any): void;
export declare function updateNodeConnections(value: any, scope: any): void;
export declare function convertToNumber(value: any, initialValue?: any): number;
export declare const timeSince: (timestamp: Date | string | number) => string;
export declare const removeNode: (config: {
method: string;
selector: string;
scope: BaseComponent;
}) => void;
export declare const addInputFields: (container: HTMLElement, data: any, originalData: any, path: string[] | undefined, scope: BaseComponent) => void;
export declare const createCustomForm: (data: any, scope: any) => DocumentFragment;
export declare const getButtonConfig: () => {
id: string;
name: string;
type: string;
version: string;
value: string;
styles: string;
bindings: {
state: {
DynamicFormInputs: {
path: string;
};
};
};
};
export declare const addEventToComponent: (component: any, scope: BaseComponent, Overlay: OverlayPanel) => void;
export declare const OpenFieldWindow: (scope: any) => void;
export declare const replaceSubstringInObjValueRecursively: (obj: any, search: string, replacement: string) => any;
export declare const convertToString: (data: any) => any;
export declare const isEmpty: (value: any) => boolean;
export declare const appendBasedOnType: (prevData: any, currentData: any) => any;
export declare const safeSpread: (value: any) => any;
export declare const isPlainObject: (value: any) => boolean;
export declare function debounce<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
export declare const stringUtils: Record<string, (...args: any[]) => string | string[] | boolean>;
export declare const readFileAsText: (file: File) => Promise<string>;
export declare const readFileAsArrayBuffer: (file: File) => Promise<ArrayBuffer>;
export declare function parseCSVContent(content: string): Promise<Record<string, any>[]>;
export declare function parseXlSheetContent(XlFile: File): Promise<unknown[]>;
export declare function helperFunctionInApplyCssAction(cssEntry: any, scope: BaseComponent): void;
export {};