@antscorp/antsomi-ui 1.3.5-beta.435 → 1.3.5-beta.436
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/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.d.ts +1 -0
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +12 -5
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +2 -4
- package/package.json +2 -1
|
@@ -24,6 +24,7 @@ interface TUseDataTableListing<TTableType = any> {
|
|
|
24
24
|
getFilterMetricList: ReturnType<typeof useGetFilterMetricList>;
|
|
25
25
|
getSearchListing: ReturnType<typeof useGetSearchListing>;
|
|
26
26
|
};
|
|
27
|
+
onChangeSelectedRow: (selectedRowKeys: React.Key[], selectedRows?: TTableType[]) => void;
|
|
27
28
|
setDatTableListingState: React.Dispatch<React.SetStateAction<TState<TTableType>>>;
|
|
28
29
|
}
|
|
29
30
|
type TState<TTableType = any> = {
|
|
@@ -75,7 +75,7 @@ export function useDataTableListing(props) {
|
|
|
75
75
|
const _f = apiSearch || {}, { url: searchUrl = '', enabled: enabledApiSearch = true } = _f, restOfApiSearchRequest = __rest(_f, ["url", "enabled"]);
|
|
76
76
|
const { filters, selectedFilterId, pagination, selectedRowKeys, searchValue, table, sorter, selectedRow, } = state;
|
|
77
77
|
const { externalFilters, includeDataType = false } = filterProps || {};
|
|
78
|
-
const { sortDirectionKey = 'az' } = tableProps || {};
|
|
78
|
+
const { sortDirectionKey = 'az', mainColumnKey } = tableProps || {};
|
|
79
79
|
const modifyColumnAuth = Object.assign(Object.assign({}, auth), { url: columnUrl });
|
|
80
80
|
const filterAuth = Object.assign(Object.assign({}, auth), { url: filterUrl });
|
|
81
81
|
const listingAuth = Object.assign(Object.assign({}, auth), { url: listingUrl });
|
|
@@ -471,6 +471,14 @@ export function useDataTableListing(props) {
|
|
|
471
471
|
pageSize,
|
|
472
472
|
});
|
|
473
473
|
}, [handleUpdatePagination]);
|
|
474
|
+
const onChangeSelectedRow = useCallback((selectedRowKeys, selectedRows) => {
|
|
475
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys, selectedRow: {
|
|
476
|
+
keys: selectedRowKeys,
|
|
477
|
+
rows: selectedRows ||
|
|
478
|
+
(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.map(key => tableData === null || tableData === void 0 ? void 0 : tableData.find(row => { var _a; return ((_a = row[mainColumnKey]) === null || _a === void 0 ? void 0 : _a.toString()) === key.toString(); })).filter(Boolean)) ||
|
|
479
|
+
[],
|
|
480
|
+
} })));
|
|
481
|
+
}, [mainColumnKey, tableData]);
|
|
474
482
|
return {
|
|
475
483
|
/* Modify Column */
|
|
476
484
|
modifyColumn: {
|
|
@@ -506,10 +514,8 @@ export function useDataTableListing(props) {
|
|
|
506
514
|
dataSource: tableData,
|
|
507
515
|
columnWidths: table.columnWidths || {},
|
|
508
516
|
rowSelection: {
|
|
509
|
-
selectedRowKeys,
|
|
510
|
-
onChange
|
|
511
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedRowKeys, selectedRow: { keys: selectedRowKeys, rows: selectedRows } })));
|
|
512
|
-
},
|
|
517
|
+
selectedRowKeys: selectedRow.keys || [],
|
|
518
|
+
onChange: onChangeSelectedRow,
|
|
513
519
|
},
|
|
514
520
|
onChange: onChangeTable,
|
|
515
521
|
onColumnResize(data) {
|
|
@@ -549,6 +555,7 @@ export function useDataTableListing(props) {
|
|
|
549
555
|
getSearchListing,
|
|
550
556
|
},
|
|
551
557
|
// Handles
|
|
558
|
+
onChangeSelectedRow,
|
|
552
559
|
setDatTableListingState: setState,
|
|
553
560
|
};
|
|
554
561
|
}
|
|
@@ -20,7 +20,6 @@ import { CustomLabelStyled, CustomRootLabel, MenuWrapper, TextWrapper } from './
|
|
|
20
20
|
// Components
|
|
21
21
|
import { Checkbox, Scrollbars, Spin } from '../../../../atoms';
|
|
22
22
|
import { Menu } from '../../../../organism';
|
|
23
|
-
import { Empty } from '../Empty';
|
|
24
23
|
// Utils
|
|
25
24
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
26
25
|
// Constants
|
|
@@ -118,8 +117,7 @@ export const CategoryListing = memo(props => {
|
|
|
118
117
|
header,
|
|
119
118
|
React.createElement(Scrollbars, { className: "category__listing" },
|
|
120
119
|
React.createElement(Spin, { spinning: loading, wrapperClassName: "template-listing__loading" },
|
|
121
|
-
|
|
122
|
-
React.createElement(Empty, Object.assign({}, emptyProps)))) : (React.createElement(Menu, Object.assign({ selectedKeys: [], items: menuItems, inlineIndent: 0, mode: "inline", defaultOpenKeys: items === null || items === void 0 ? void 0 : items.map(item => String(item.key)), expandIcon: ({ isOpen }) => {
|
|
120
|
+
React.createElement(Menu, Object.assign({ selectedKeys: [], items: menuItems, inlineIndent: 0, mode: "inline", defaultOpenKeys: items === null || items === void 0 ? void 0 : items.map(item => String(item.key)), expandIcon: ({ isOpen }) => {
|
|
123
121
|
var _a;
|
|
124
122
|
return (React.createElement(Icon, { type: "icon-ants-expand-more", style: {
|
|
125
123
|
fontSize: 20,
|
|
@@ -139,7 +137,7 @@ export const CategoryListing = memo(props => {
|
|
|
139
137
|
// }}
|
|
140
138
|
// />
|
|
141
139
|
// }
|
|
142
|
-
onClick: handleClickMenu }, restOfProps))
|
|
140
|
+
onClick: handleClickMenu }, restOfProps)),
|
|
143
141
|
footer)))) : null;
|
|
144
142
|
});
|
|
145
143
|
CategoryListing.displayName = 'CategoryListing';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.436",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"react-custom-scrollbars": "^4.2.1",
|
|
112
112
|
"react-draggable": "^4.4.5",
|
|
113
113
|
"react-frame-component": "^5.2.6",
|
|
114
|
+
"react-konva": "^18.2.10",
|
|
114
115
|
"react-intersection-observer": "^9.10.3",
|
|
115
116
|
"react-konva": "^18.2.10",
|
|
116
117
|
"react-markdown": "^8.0.7",
|