es-grid-template
Version:
es-grid-template
218 lines (217 loc) • 13.7 kB
TypeScript
import type { Row, Table } from "@tanstack/react-table";
import { type Column } from "@tanstack/react-table";
import type { VirtualItem } from "@tanstack/react-virtual";
import type { AnyObject, ColumnsTable, ColumnTable, EditType, FilterOperator, IColumnType, IFormat, RangeState, Sorter, TypeFilter } from "./../../grid-component/type";
import type { Key } from "react";
import { type CSSProperties } from "react";
import dayjs from "dayjs";
import type { IPositionCell } from "../useContext";
import type { ColumnDef } from "@tanstack/react-table";
import type { TreeDataNode } from "antd";
export declare const newGuid: () => any;
export declare const convertDayjsToDate: (dateString: string, format?: string) => Date;
export declare const convertDateToDayjs: (date: Date | undefined, format?: string) => dayjs.Dayjs;
export declare const getCommonPinningStyles: (column: Column<any>) => CSSProperties;
export declare const getCommonPinningStyles2: (header: any) => CSSProperties;
export declare const sumSize: (items: any) => number;
export declare const appendIfNotExists: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
export declare const getNewItemsOnly: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
export declare const extendsObject: <T extends AnyObject = AnyObject>(...list: T[]) => AnyObject;
export declare const isEmpty: (d: any) => boolean;
export declare const getFormat: (colFormat?: IFormat, format?: IFormat) => {
thousandSeparator: string;
decimalSeparator: string;
decimalScale: number;
allowNegative: boolean;
prefix: string;
suffix: string;
fixedDecimalScale: boolean;
dateFormat: string;
datetimeFormat: string;
timeFormat: string;
weekFormat: string;
monthFormat: string;
yearFormat: string;
};
export declare function convertFormat(formatStr: string): string;
export declare const getDatepickerFormat: (type: EditType | TypeFilter | IColumnType, format?: IFormat) => string;
export declare const getDateRangeFormat: (type: EditType | TypeFilter | IColumnType, format?: IFormat) => string;
export declare const getTypeFilter: (col: any) => TypeFilter;
export declare const addRowIdArray: (inputArray: any[]) => any[];
export declare function groupArrayByColumns(arr: any[], columns: string[] | undefined): any;
export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
export declare const checkDecimalSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
export declare const getFixedFields: <T>(columns: ColumnsTable<T>, type: 'left' | 'right') => string[];
export declare function areStringArraysEqual(a: string[], b: string[]): boolean;
export declare const getDefaultOperator: (col: ColumnTable) => FilterOperator;
export declare function isEqualSet(setA: any, setB: any): boolean;
export declare const getLastSelectCell: (selectCells: any) => {
row: number;
col: number;
};
export declare function getCellsByPosition(cellSet: any, position?: string): any[];
export declare const onAddBgSelectedCell: (selectedCells: any, id?: string, isFocusCellIndex?: boolean) => void;
export declare const onRemoveBgSelectedCell: (selectedCells: any, id?: string, rowsSelected?: any) => void;
export declare function getColIdsBetween(table: Table<any>, a: string, b: string): string[];
export declare function getRowIdsBetween(table: Table<any>, a: string, b: string): string[];
export declare const updateArrayByKey: (arr: any[], element: any, key: string) => any[];
export declare const unFlattenData: <RecordType extends AnyObject = AnyObject>(data: RecordType[]) => RecordType[];
export declare const flattenArray: <RecordType extends AnyObject = AnyObject>(arr: any[]) => RecordType[];
export declare function updateOrInsert(dataArray: any[], dataFilter: any[]): any[];
export declare const findItemByKey: (array: any, key: string | number, value: any) => any;
export declare const isFormattedNumber: (str: string) => boolean;
export declare const detectSeparators: (str: string) => {
thousandSeparator: string;
decimalSeparator: string;
};
export declare function isDateString(str: any): boolean;
export declare function compareDates(date1: any, date2: any): boolean;
export declare function compareDate(itemValue: any, value: any): boolean;
export declare const removeVietnameseTones: (str: any) => any;
export declare const shouldInclude: (item: any, queries: any[]) => any;
export declare function sortData(data: any[], sorter: Sorter[]): any[];
export declare function filterDataByColumns(data: any[], queries: any[], sorter: Sorter[], keysFilter: string[] | undefined): any[];
export declare const getAllRowKey: (data: any[]) => any[];
export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
export declare const checkFieldKey: (key: string | undefined) => string;
export declare const convertArrayWithIndent: (inputArray: any[], parentIndent?: number) => any[];
export declare const convertLabelToTitle: (data: any[]) => any[];
export declare const isNullOrUndefined: (d: any) => boolean;
export declare const isObjEmpty: (obj: any) => boolean;
export declare const isDisable: <T>(column: ColumnTable<T>, rowData?: any) => boolean;
export declare const customWeekStartEndFormat: (value: any, weekFormat: string) => string;
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
export declare const isNameColor: (strColor: string) => boolean;
export declare const isColor: (value: string) => boolean;
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
export declare const getEditType: <T>(column: ColumnTable<T>, rowData?: any) => EditType;
export declare const getDefaultValue: (defaultValue: any) => AnyObject;
export declare const flattenData: <RecordType extends AnyObject = AnyObject>(childrenColumnName: string, data?: RecordType[]) => RecordType[];
export declare const getSelectedCellMatrix: (table: Table<any>, startCell: IPositionCell | undefined, endCell: IPositionCell | undefined) => RangeState;
export declare function addRowsDownWithCtrl(arr: any, n: number): {
combined: any;
addedRows: any[];
} | {
combined: any[];
addedRows: any[];
};
export declare function addRowsDown(arr: any, n: number): {
combined: any;
addedRows: any[];
} | {
combined: any[];
addedRows: any[];
};
export declare function addRowsUpWithCtrl(array: any, n: number): {
combined: any;
addedRows: any[];
} | {
combined: any[];
addedRows: any[];
};
export declare function addRowsUp(array: any, n: number): {
combined: any;
addedRows: any[];
} | {
combined: any[];
addedRows: any[];
};
export declare const convertFilters: (filters: any[]) => any[];
export declare function getInvisibleColumns(columns: ColumnTable[]): Record<string, boolean>;
export declare const getAllVisibleKeys: (columns: any[]) => any[];
export declare const getAllVisibleKeys1: (columns: ColumnTable[]) => any[];
export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[]): string[];
export declare function getHiddenParentKeys1(columns: ColumnTable[], parentKeys?: string[]): string[];
export declare const getVisibleColumnKeys: (columns: any[]) => string[];
export declare const getVisibleColumnKeys1: (columns: any[]) => string[];
export declare function isObjEqual(obj1: any, obj2: any): boolean;
export declare const sortByType: <T>(arr: ColumnTable<T>[]) => ColumnTable<T>[];
export declare function convertColumnsToTreeData<T>(columns: ColumnDef<T, any>[], groupColumns?: string[]): TreeDataNode[];
export declare const updateColumns1: (columns: ColumnTable[], includes: string[]) => ColumnTable[];
export declare const convertToObj: (arr: any) => {
[k: string]: any;
};
export declare const convertToObjTrue: (arr: any) => {
[k: string]: any;
};
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
export declare function isTreeArray(arr: any[]): boolean;
export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
export declare function updateWidthsByOther(source: any[], target: any[]): any[];
export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
export declare function arraysEqualIgnoreOrderFast(a: any[], b: any[]): boolean;
export declare function filterByIds(a: any[], b: any[]): any[];
export declare function excludeItems(arrayA: any[], arrayB: any[]): any[];
export declare function getAllChildren(row: any): any;
export declare function toggleRowAndChildren(row: Row<any>, isSelected?: boolean): void;
export declare function countUnselectedChildren(row: Row<any>): number;
export declare function removeDuplicatesByKey(arr: any[], key?: string): any[];
export declare const getTableHeight: (height?: number, minHeight?: number) => number;
export declare const convertFlatColumn1: (array: ColumnsTable) => ColumnsTable[];
export declare const updateColumnsByGroup: (columns: any[], columnsGroup: string[]) => any[];
export declare const removeColumns: <RecordType>(columns: ColumnTable<RecordType>[], groupColumns: string[]) => ColumnsTable<RecordType>;
export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordType>[], fixedFields: string[]) => {
fixed: string;
field: string;
fieldOriginal?: string;
width?: number;
maxWidth?: number;
minWidth?: number;
type?: IColumnType;
haveSum?: boolean;
isSummary?: boolean;
summaryTemplate?: (data: number, key: string) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
format?: IFormat | ((rowData: any) => IFormat);
allowFiltering?: boolean;
sorter?: boolean;
allowSortering?: boolean;
operator?: FilterOperator;
hideOperator?: boolean;
placeholder?: string;
showInColumnChoose?: boolean;
typeFilter?: TypeFilter;
source?: any[];
showFilterSearch?: boolean;
headerText?: string;
hidden?: boolean;
visible?: boolean;
headerTooltip?: string | boolean | (() => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
columnGroupText?: string;
align?: import("./../../grid-component/type").ITextAlign;
textAlign?: import("./../../grid-component/type").ITextAlign;
headerTextAlign?: import("./../../grid-component/type").ITextAlign;
template?: import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
showTooltip?: boolean;
tooltipDescription?: string | ((args: {
value: any;
rowData: RecordType;
}) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
headerTemplate?: import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | ((column: ColumnTable<RecordType>) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
commandItems?: import("./../../grid-component/type").CommandItem[];
children?: ColumnTable<RecordType>[];
editType?: EditType | ((rowData?: RecordType) => EditType);
disable?: boolean | ((rowData: any) => boolean);
editEnable?: boolean | ((rowData: any) => boolean);
isClearable?: boolean;
maxDate?: any;
minDate?: any;
maxTime?: any;
minTime?: any;
max?: number;
min?: number;
editSelectSettings?: import("./../../grid-component/type").IEditSelectSettings;
editFromSettings?: import("./../../grid-component/type").IEditFromSettings;
fixedType?: import("./../../grid-component/type").FixedType;
headerTextWrap?: boolean;
ellipsis?: boolean;
allowResizing?: boolean;
allowSelection?: boolean | ((rowData: RecordType) => boolean);
onCellStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
onCellHeaderStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
onCellFooterStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
sumGroup?: boolean;
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
}[];
export declare function sortColumnsByField<T extends ColumnTable>(columns: T[], priorityFields: string[]): T[];