@omniumretail/component-library 1.1.96 → 1.1.97
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.
|
@@ -45,5 +45,6 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
|
45
45
|
buttonActionLabel?: (record: any) => string | null;
|
|
46
46
|
buttonActionMethod?: () => void;
|
|
47
47
|
buttonActionStyle?: string | ((record: any) => any);
|
|
48
|
+
cleanRowSelection?: boolean;
|
|
48
49
|
}
|
|
49
50
|
export declare const ResponsiveTable: (props: ResponsiveTableCustomProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ const Template: Story<ResponsiveTableCustomProps> = (args) => {
|
|
|
13
13
|
const [pageInfo, setPageInfo] = useState<any>({});
|
|
14
14
|
const [rowSelectionInfo, setRowSelectionInfo] = useState<any>({});
|
|
15
15
|
const [sortBy, setSortBy] = useState<string[]>(['id', 'desc']);
|
|
16
|
+
const [clearRowSelection, setClearRowSelection] = useState<boolean>(false);
|
|
16
17
|
|
|
17
18
|
const handleSortByColumnChange = (sortState: any) => {
|
|
18
19
|
console.log('handleSortChange called with:', sortState);
|
|
@@ -24,13 +25,16 @@ const Template: Story<ResponsiveTableCustomProps> = (args) => {
|
|
|
24
25
|
return (record as any)?.type === "Efetivo" ? "Pog" : null;
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
console.log(rowSelectionInfo);
|
|
29
|
+
|
|
27
30
|
return <ResponsiveTable
|
|
28
31
|
scroll={{ x: 4000 }}
|
|
32
|
+
cleanRowSelection={clearRowSelection}
|
|
29
33
|
columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo}
|
|
30
34
|
actionsArray={[
|
|
31
35
|
{
|
|
32
36
|
key: '1', label: `${t('actions.one')}`, onClick: () => {
|
|
33
|
-
|
|
37
|
+
setClearRowSelection(true);
|
|
34
38
|
}
|
|
35
39
|
},
|
|
36
40
|
{ key: '2', label: `${t('actions.two')}` },
|
|
@@ -51,6 +51,7 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
|
51
51
|
buttonActionLabel?: (record: any) => string | null;
|
|
52
52
|
buttonActionMethod?: () => void;
|
|
53
53
|
buttonActionStyle?: string | ((record: any) => any);
|
|
54
|
+
cleanRowSelection?: boolean;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
@@ -79,7 +80,8 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
79
80
|
buttonActionName,
|
|
80
81
|
buttonActionMethod,
|
|
81
82
|
buttonActionStyle,
|
|
82
|
-
buttonActionLabel
|
|
83
|
+
buttonActionLabel,
|
|
84
|
+
cleanRowSelection
|
|
83
85
|
} = props;
|
|
84
86
|
|
|
85
87
|
const [customFilters, setCustomFilters] = useState<any>([]);
|
|
@@ -89,7 +91,6 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
89
91
|
const [selectedAllRowKeys, setSelectedAllRowKeys] = useState(false);
|
|
90
92
|
const [deselectAll, setDeselectAll] = useState(false);
|
|
91
93
|
|
|
92
|
-
|
|
93
94
|
const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
|
|
94
95
|
if (rowSelection.type === 'radio') {
|
|
95
96
|
setselectedRowKeys(newSelectedRowKeys);
|
|
@@ -174,6 +175,12 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
174
175
|
props.rowSelectionInfo(selectedRowKeys);
|
|
175
176
|
}, [selectedRowKeys]);
|
|
176
177
|
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (cleanRowSelection) {
|
|
180
|
+
setselectedRowKeys([]);
|
|
181
|
+
}
|
|
182
|
+
}, [cleanRowSelection]);
|
|
183
|
+
|
|
177
184
|
useEffect(() => {
|
|
178
185
|
if (dataSource && (dataSource as any)?.length > 0) {
|
|
179
186
|
// Columns
|