aio-table 11.1.3 → 11.2.1
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/index.d.ts +9 -2
- package/index.js +16 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -18,12 +18,19 @@ export type I_table_paging = UT.I_paging;
|
|
|
18
18
|
export type I_table_sort<T> = UT.I_sort<T>;
|
|
19
19
|
export type I_table_filter = UT.I_filter;
|
|
20
20
|
export type I_table_filter_item = UT.I_filter_item;
|
|
21
|
-
export type I_table_filter_saved_item = UT.
|
|
21
|
+
export type I_table_filter_saved_item = UT.I_filter_collection;
|
|
22
22
|
export type I_table_column<T> = {
|
|
23
23
|
title?: any;
|
|
24
24
|
sort?: true | I_table_sort<T>;
|
|
25
25
|
jalali?: boolean;
|
|
26
|
-
|
|
26
|
+
filter?: {
|
|
27
|
+
operators?: UT.I_filter_operator[];
|
|
28
|
+
options?: {
|
|
29
|
+
text: string;
|
|
30
|
+
value: any;
|
|
31
|
+
}[];
|
|
32
|
+
type?: I_table_column<any>["type"];
|
|
33
|
+
};
|
|
27
34
|
search?: boolean;
|
|
28
35
|
id: string;
|
|
29
36
|
width?: any;
|
package/index.js
CHANGED
|
@@ -116,7 +116,7 @@ const AIOTable = (props) => {
|
|
|
116
116
|
let searchColumns = [], excelColumns = [], filterColumns = [], toggleColumns = [];
|
|
117
117
|
let updatedColumns = columns.map((column, i) => {
|
|
118
118
|
const cellDetail = tableHook.getCellDetail({ column });
|
|
119
|
-
const
|
|
119
|
+
const filter = getColumnOption('filter', cellDetail);
|
|
120
120
|
const search = getColumnOption('search', cellDetail);
|
|
121
121
|
const excel = getColumnOption('excel', cellDetail);
|
|
122
122
|
const toggle = getColumnOption('toggle', cellDetail);
|
|
@@ -130,7 +130,7 @@ const AIOTable = (props) => {
|
|
|
130
130
|
if (excel) {
|
|
131
131
|
excelColumns.push(column);
|
|
132
132
|
}
|
|
133
|
-
if (
|
|
133
|
+
if (filter) {
|
|
134
134
|
filterColumns.push(column);
|
|
135
135
|
}
|
|
136
136
|
if (toggle) {
|
|
@@ -266,8 +266,12 @@ const AIOTable = (props) => {
|
|
|
266
266
|
return (_jsxs(Provider, { value: context, children: [_jsxs("div", Object.assign({}, attrs, { children: [_jsx(TableToolbar, {}), !!props.filter &&
|
|
267
267
|
_jsx(UT.Filterbar, { columns: filterColumns, filter: props.filter, fa: props.fa, columnOption: {
|
|
268
268
|
text: (column) => getColumnOption('title', tableHook.getCellDetail({ column })),
|
|
269
|
-
id: (column) => getColumnOption('
|
|
270
|
-
type: (column) => getColumnOption('type', tableHook.getCellDetail({ column })) || 'text'
|
|
269
|
+
id: (column) => getColumnOption('id', tableHook.getCellDetail({ column })),
|
|
270
|
+
type: (column) => getColumnOption('type', tableHook.getCellDetail({ column })) || 'text',
|
|
271
|
+
options: (column) => {
|
|
272
|
+
const filter = getColumnOption('filter', tableHook.getCellDetail({ column }));
|
|
273
|
+
return filter === null || filter === void 0 ? void 0 : filter.options;
|
|
274
|
+
},
|
|
271
275
|
} }), _jsxs("div", { className: 'aio-table-unit aio-table-scroll', style: { gap: gap[1] }, children: [_jsx(TableHeader, {}), _jsx(TableRows, {})] }), pagingHook.render()] })), popup.render()] }));
|
|
272
276
|
};
|
|
273
277
|
export default AIOTable;
|
|
@@ -509,7 +513,14 @@ const useTable = (getProps, getPaging, getColumnOption) => {
|
|
|
509
513
|
const width = getColumnOption('width', cellDetail);
|
|
510
514
|
const minWidth = getColumnOption('minWidth', cellDetail);
|
|
511
515
|
const className = `aio-table-cell` + (justify ? ` aio-table-cell-justify` : '');
|
|
512
|
-
|
|
516
|
+
let isNumber = false;
|
|
517
|
+
try {
|
|
518
|
+
if (!isNaN(+cellValue)) {
|
|
519
|
+
isNumber = true;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
catch (_a) { }
|
|
523
|
+
const style = { width, minWidth, flex: width ? undefined : 1, direction: isNumber ? 'ltr' : undefined };
|
|
513
524
|
if (striped) {
|
|
514
525
|
style.background = isOdd ? striped[0] : striped[1];
|
|
515
526
|
}
|