es-grid-template 1.8.64 → 1.8.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/es/grid-component/TempTable.js +2 -2
- package/es/grid-component/hooks/utils.d.ts +2 -8
- package/es/grid-component/hooks/utils.js +175 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/type.d.ts +7 -0
- package/es/table-component/type.d.ts +8 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +232 -0
- package/es/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/es/table-virtuoso/ColumnsGroup/index.js +1 -0
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +413 -0
- package/es/table-virtuoso/body/TableBody.d.ts +14 -0
- package/es/table-virtuoso/body/TableBody.js +84 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +466 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +116 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +11 -0
- package/es/table-virtuoso/style.scss +1440 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +302 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +305 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/es/table-virtuoso/table/TableWrapper.js +158 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/lib/grid-component/TempTable.js +2 -2
- package/lib/grid-component/hooks/utils.d.ts +2 -8
- package/lib/grid-component/hooks/utils.js +176 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/type.d.ts +7 -0
- package/lib/table-component/type.d.ts +8 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +243 -0
- package/lib/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/lib/table-virtuoso/ColumnsGroup/index.js +16 -0
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +422 -0
- package/lib/table-virtuoso/body/TableBody.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBody.js +95 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +473 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +124 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +18 -0
- package/lib/table-virtuoso/style.scss +1440 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +311 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +313 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/lib/table-virtuoso/table/TableWrapper.js +164 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -1
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- package/lib/grid-component/table/InfiniteTable.js +0 -109
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function useFilterOperator(table) {
|
|
2
|
+
const setFilterOperator = (columnId, operator) => {
|
|
3
|
+
const filters = table.getState().columnFilters;
|
|
4
|
+
const next = filters.map(f => f.id === columnId ? {
|
|
5
|
+
...f,
|
|
6
|
+
operator
|
|
7
|
+
} : f);
|
|
8
|
+
table.setColumnFilters(next);
|
|
9
|
+
};
|
|
10
|
+
const getFilterOperator = columnId => {
|
|
11
|
+
const filters = table.getState().columnFilters;
|
|
12
|
+
return filters.find(f => f.id === columnId)?.operator ?? 'contains';
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
setFilterOperator,
|
|
16
|
+
getFilterOperator
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function customStringFilterFn(row, columnId, filterValue) {
|
|
20
|
+
const filters = row.table.getState().columnFilters;
|
|
21
|
+
const operator = filters.find(f => f.id === columnId)?.operator ?? 'contains';
|
|
22
|
+
const cellValue = String(row.getValue(columnId) ?? '');
|
|
23
|
+
switch (operator) {
|
|
24
|
+
case 'equal':
|
|
25
|
+
return cellValue === filterValue;
|
|
26
|
+
case 'startsWith':
|
|
27
|
+
return cellValue.toLowerCase().startsWith(filterValue.toLowerCase());
|
|
28
|
+
case 'endsWith':
|
|
29
|
+
return cellValue.toLowerCase().endsWith(filterValue.toLowerCase());
|
|
30
|
+
default:
|
|
31
|
+
return cellValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { Row, Table } from "@tanstack/react-table";
|
|
2
|
+
import { type Column } from "@tanstack/react-table";
|
|
3
|
+
import type { VirtualItem } from "@tanstack/react-virtual";
|
|
4
|
+
import type { AnyObject, ColumnsTable, ColumnTable, EditType, FilterOperator, IColumnType, IFormat, RangeState, Sorter, TypeFilter } from "../../table-component/type";
|
|
5
|
+
import type { Key } from "react";
|
|
6
|
+
import { type CSSProperties } from "react";
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
import type { ColumnDef } from "@tanstack/react-table";
|
|
9
|
+
import type { TreeDataNode } from "antd";
|
|
10
|
+
import type { IPositionCell } from "../../table-component/useContext";
|
|
11
|
+
export declare const newGuid: () => any;
|
|
12
|
+
export declare const convertDayjsToDate: (dateString: string, format?: string) => Date;
|
|
13
|
+
export declare const convertDateToDayjs: (date: Date | undefined, format?: string) => dayjs.Dayjs;
|
|
14
|
+
export declare const getCommonPinningHeaderStyles: (column: Column<any>) => CSSProperties;
|
|
15
|
+
export declare const getCommonPinningStyles: (column: Column<any>) => CSSProperties;
|
|
16
|
+
export declare const getCommonPinningStyles2: (header: any) => CSSProperties;
|
|
17
|
+
export declare const sumSize: (items: any) => number;
|
|
18
|
+
export declare const appendIfNotExists: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
|
|
19
|
+
export declare const getNewItemsOnly: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
|
|
20
|
+
export declare const extendsObject: <T extends AnyObject = AnyObject>(...list: T[]) => AnyObject;
|
|
21
|
+
export declare const isEmpty: (d: any) => boolean;
|
|
22
|
+
export declare const getFormat: (colFormat?: IFormat, format?: IFormat) => {
|
|
23
|
+
thousandSeparator: string;
|
|
24
|
+
decimalSeparator: string;
|
|
25
|
+
decimalScale: number;
|
|
26
|
+
allowNegative: boolean;
|
|
27
|
+
prefix: string;
|
|
28
|
+
suffix: string;
|
|
29
|
+
fixedDecimalScale: boolean;
|
|
30
|
+
dateFormat: string;
|
|
31
|
+
datetimeFormat: string;
|
|
32
|
+
timeFormat: string;
|
|
33
|
+
weekFormat: string;
|
|
34
|
+
monthFormat: string;
|
|
35
|
+
yearFormat: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function convertFormat(formatStr: string): string;
|
|
38
|
+
export declare const getDatepickerFormat: (type: EditType | TypeFilter | IColumnType, format?: IFormat) => string;
|
|
39
|
+
export declare const getDateRangeFormat: (type: EditType | TypeFilter | IColumnType, format?: IFormat) => string;
|
|
40
|
+
export declare const getTypeFilter: (col: any) => TypeFilter;
|
|
41
|
+
export declare const addRowIdArray: (inputArray: any[]) => any[];
|
|
42
|
+
export declare function groupArrayByColumns(arr: any[], columns: string[] | undefined): any;
|
|
43
|
+
export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
44
|
+
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
45
|
+
export declare const checkDecimalSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
46
|
+
export declare const getFixedFields: <T>(columns: ColumnsTable<T>, type: 'left' | 'right') => string[];
|
|
47
|
+
export declare function areStringArraysEqual(a: string[], b: string[]): boolean;
|
|
48
|
+
export declare const getDefaultOperator: (col: ColumnTable) => FilterOperator;
|
|
49
|
+
export declare function isEqualSet(setA: any, setB: any): boolean;
|
|
50
|
+
export declare const getLastSelectCell: (selectCells: any) => {
|
|
51
|
+
row: number;
|
|
52
|
+
col: number;
|
|
53
|
+
};
|
|
54
|
+
export declare function getCellsByPosition(cellSet: any, position?: string): any[];
|
|
55
|
+
export declare const onAddBgSelectedCell: (selectedCells: any, id?: string, isFocusCellIndex?: boolean) => void;
|
|
56
|
+
export declare const onRemoveBgSelectedCell: (selectedCells: any, id?: string, rowsSelected?: any) => void;
|
|
57
|
+
export declare function getColIdsBetween(table: Table<any>, a: string, b: string): string[];
|
|
58
|
+
export declare function getRowIdsBetween(table: Table<any>, a: string, b: string): string[];
|
|
59
|
+
export declare const updateArrayByKey: (arr: any[], element: any, key: string) => any[];
|
|
60
|
+
export declare const unFlattenData: <RecordType extends AnyObject = AnyObject>(data: RecordType[]) => RecordType[];
|
|
61
|
+
export declare const flattenArray: <RecordType extends AnyObject = AnyObject>(arr: any[]) => RecordType[];
|
|
62
|
+
export declare function updateOrInsert(dataArray: any[], dataFilter: any[]): any[];
|
|
63
|
+
export declare const findItemByKey: (array: any, key: string | number, value: any) => any;
|
|
64
|
+
export declare const isFormattedNumber: (str: string) => boolean;
|
|
65
|
+
export declare const detectSeparators: (str: string) => {
|
|
66
|
+
thousandSeparator: string;
|
|
67
|
+
decimalSeparator: string;
|
|
68
|
+
};
|
|
69
|
+
export declare function isDateString(str: any): boolean;
|
|
70
|
+
export declare function compareDates(date1: any, date2: any): boolean;
|
|
71
|
+
export declare function compareDate(itemValue: any, value: any): boolean;
|
|
72
|
+
export declare const removeVietnameseTones: (str: any) => any;
|
|
73
|
+
export declare const shouldInclude: (item: any, queries: any[]) => any;
|
|
74
|
+
export declare function sortData(data: any[], sorter: Sorter[]): any[];
|
|
75
|
+
export declare function filterDataByColumns(data: any[], queries: any[], sorter: Sorter[], keysFilter: string[] | undefined): any[];
|
|
76
|
+
export declare const getAllRowKey: (data: any[]) => any[];
|
|
77
|
+
export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
|
|
78
|
+
export declare const checkFieldKey: (key: string | undefined) => string;
|
|
79
|
+
export declare const convertArrayWithIndent: (inputArray: any[], parentIndent?: number) => any[];
|
|
80
|
+
export declare const convertLabelToTitle: (data: any[]) => any[];
|
|
81
|
+
export declare const isNullOrUndefined: (d: any) => boolean;
|
|
82
|
+
export declare const isObjEmpty: (obj: any) => boolean;
|
|
83
|
+
export declare const isDisable: <T>(column: ColumnTable<T>, rowData?: any) => boolean;
|
|
84
|
+
export declare const customWeekStartEndFormat: (value: any, weekFormat: string) => string;
|
|
85
|
+
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
|
|
86
|
+
export declare const isNameColor: (strColor: string) => boolean;
|
|
87
|
+
export declare const isColor: (value: string) => boolean;
|
|
88
|
+
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|
|
89
|
+
export declare const getEditType: <T>(column: ColumnTable<T>, rowData?: any) => EditType;
|
|
90
|
+
export declare const getDefaultValue: (defaultValue: any) => AnyObject;
|
|
91
|
+
export declare const flattenData: <RecordType extends AnyObject = AnyObject>(childrenColumnName: string, data?: RecordType[]) => RecordType[];
|
|
92
|
+
export declare const getSelectedCellMatrix: (table: Table<any>, startCell: IPositionCell | undefined, endCell: IPositionCell | undefined) => RangeState;
|
|
93
|
+
export declare function addRowsDownWithCtrl(arr: any, n: number): {
|
|
94
|
+
combined: any;
|
|
95
|
+
addedRows: any[];
|
|
96
|
+
} | {
|
|
97
|
+
combined: any[];
|
|
98
|
+
addedRows: any[];
|
|
99
|
+
};
|
|
100
|
+
export declare function addRowsDown(arr: any, n: number): {
|
|
101
|
+
combined: any;
|
|
102
|
+
addedRows: any[];
|
|
103
|
+
} | {
|
|
104
|
+
combined: any[];
|
|
105
|
+
addedRows: any[];
|
|
106
|
+
};
|
|
107
|
+
export declare function addRowsUpWithCtrl(array: any, n: number): {
|
|
108
|
+
combined: any;
|
|
109
|
+
addedRows: any[];
|
|
110
|
+
} | {
|
|
111
|
+
combined: any[];
|
|
112
|
+
addedRows: any[];
|
|
113
|
+
};
|
|
114
|
+
export declare function addRowsUp(array: any, n: number): {
|
|
115
|
+
combined: any;
|
|
116
|
+
addedRows: any[];
|
|
117
|
+
} | {
|
|
118
|
+
combined: any[];
|
|
119
|
+
addedRows: any[];
|
|
120
|
+
};
|
|
121
|
+
export declare const convertFilters: (filters: any[]) => any[];
|
|
122
|
+
export declare function getInvisibleColumns(columns: ColumnTable[]): Record<string, boolean>;
|
|
123
|
+
export declare const getAllVisibleKeys: (columns: any[]) => any[];
|
|
124
|
+
export declare const getAllVisibleKeys1: (columns: ColumnTable[]) => any[];
|
|
125
|
+
export declare function getHiddenParentKeys(columns: any[], parentKeys?: string[]): string[];
|
|
126
|
+
export declare function getHiddenParentKeys1(columns: ColumnTable[], parentKeys?: string[]): string[];
|
|
127
|
+
export declare const getVisibleColumnKeys: (columns: any[]) => string[];
|
|
128
|
+
export declare const getVisibleColumnKeys1: (columns: any[]) => string[];
|
|
129
|
+
export declare function isObjEqual(obj1: any, obj2: any): boolean;
|
|
130
|
+
export declare const sortByType: <T>(arr: ColumnTable<T>[]) => ColumnTable<T>[];
|
|
131
|
+
export declare function convertColumnsToTreeData<T>(columns: ColumnDef<T, any>[], groupColumns?: string[]): TreeDataNode[];
|
|
132
|
+
export declare const updateColumns1: (columns: ColumnTable[], includes: string[]) => ColumnTable[];
|
|
133
|
+
export declare const convertToObj: (arr: any) => {
|
|
134
|
+
[k: string]: any;
|
|
135
|
+
};
|
|
136
|
+
export declare const convertToObjTrue: (arr: any) => {
|
|
137
|
+
[k: string]: any;
|
|
138
|
+
};
|
|
139
|
+
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
|
|
140
|
+
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
|
|
141
|
+
export declare function isTreeArray(arr: any[]): boolean;
|
|
142
|
+
export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
|
|
143
|
+
export declare function updateWidthsByOther(source: any[], target: any[]): any[];
|
|
144
|
+
export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
|
|
145
|
+
export declare function parseExcelText(text: string): string[][];
|
|
146
|
+
export declare function parseExcelClipboard(e: React.ClipboardEvent): string[][];
|
|
147
|
+
export declare function parseExcelClipboardText(text: string): string[][];
|
|
148
|
+
export declare function parseClipboardEvent(e: ClipboardEvent | React.ClipboardEvent): string[][];
|
|
149
|
+
export declare function arraysEqualIgnoreOrderFast(a: any[], b: any[]): boolean;
|
|
150
|
+
export declare function filterByIds(a: any[], b: any[]): any[];
|
|
151
|
+
export declare function excludeItems(arrayA: any[], arrayB: any[]): any[];
|
|
152
|
+
export declare function getAllChildren(row: any): any;
|
|
153
|
+
export declare function toggleRowAndChildren(row: Row<any>, isSelected?: boolean): void;
|
|
154
|
+
export declare function countUnselectedChildren(row: Row<any>): number;
|
|
155
|
+
export declare function removeDuplicatesByKey(arr: any[], key?: string): any[];
|
|
156
|
+
export declare const getTableHeight: (height?: number, minHeight?: number) => number;
|
|
157
|
+
export declare const convertFlatColumn1: (array: ColumnsTable) => ColumnsTable[];
|
|
158
|
+
export declare const updateColumnsByGroup: (columns: any[], columnsGroup: string[]) => any[];
|
|
159
|
+
export declare function removeKeys<T extends Record<string, any>>(obj: T, keys: string[]): Partial<T>;
|