zeed-dynamic-table
Version:
A flexible and dynamic table component for React and Next.js applications without Tailwind dependencies
39 lines (38 loc) • 1.7 kB
TypeScript
import { ColumnType } from "../types";
/**
* Gets a nested value from an object using a dot-notation path
* Improved error handling and type safety
*/
declare function getNestedValue<T>(obj: T, path: string): any;
/**
* Simpler, more robust implementation for dynamic properties
* Replaces the complex regex-based implementation
*/
declare function handlePropsDynamic<T>(props: Record<string, any>, item: T): Record<string, any>;
/**
* Safer expression evaluation without using eval
* For simple cases of property access and comparison
*/
declare function evaluateSimpleExpression(expression: string, item: any): any;
/**
* Generates a dynamic link by replacing path placeholders with values
* Improved error handling
*/
declare function generateDynamicLink(href: string, item: any): string;
/**
* Joins multiple field values from an item based on column join configuration
* Improved error handling
*/
declare function handleJoined<T>(column: ColumnType<keyof T & string>, item: T): string;
/**
* Handles option change via API
* Improved error handling and type safety
*/
declare function handleOptionChnage(value: string, apiLink: string, onRes?: (value: any) => void, onCatch?: (error: any) => void, data?: any): Promise<void>;
/**
* Finds the first true condition in a column's conditions array
* Improved error handling and type safety
*/
declare function findTrueContion<T>(column: ColumnType<keyof T & string>, item: T): import("../types").ColumnConditionsType<keyof T & string> | null | undefined;
export { getNestedValue, handlePropsDynamic, generateDynamicLink, handleJoined, handleOptionChnage, findTrueContion, evaluateSimpleExpression, };
export type { ColumnType };