@omniumretail/component-library 1.1.6 → 1.1.7
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.
|
@@ -37,5 +37,9 @@ export interface TableCustomProps extends TableProps<any> {
|
|
|
37
37
|
dataIndex: string;
|
|
38
38
|
side: 'left' | 'right';
|
|
39
39
|
}[];
|
|
40
|
+
customColumnWidths?: {
|
|
41
|
+
columnName: string;
|
|
42
|
+
width: string;
|
|
43
|
+
}[];
|
|
40
44
|
}
|
|
41
45
|
export declare const Table: (props: TableCustomProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ const Template: Story<TableCustomProps> = (args) => {
|
|
|
23
23
|
return <Table scroll={{y: 1000, x: 3000}} fixedColumns={[
|
|
24
24
|
{ dataIndex: 'name', side: 'left' },
|
|
25
25
|
{ dataIndex: 'mecanographicNumber', side: 'left' },
|
|
26
|
-
]} columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo} actionsArray={
|
|
26
|
+
]} customColumnWidths={[{columnName: 'name', width: "100px"}]} columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo} actionsArray={
|
|
27
27
|
[
|
|
28
28
|
{ key: '1', label: `${t('actions.one')}`, onClick: () => {
|
|
29
29
|
console.log('onClick');
|
|
@@ -46,6 +46,7 @@ export interface TableCustomProps extends TableProps<any> {
|
|
|
46
46
|
sortByColumns?: boolean;
|
|
47
47
|
columnsToSort?: string[];
|
|
48
48
|
fixedColumns?: { dataIndex: string; side: 'left' | 'right' }[];
|
|
49
|
+
customColumnWidths?: { columnName: string; width: string }[];
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export const Table = (props: TableCustomProps) => {
|
|
@@ -69,7 +70,8 @@ export const Table = (props: TableCustomProps) => {
|
|
|
69
70
|
tableMaxHeight,
|
|
70
71
|
sortByColumns,
|
|
71
72
|
columnsToSort,
|
|
72
|
-
fixedColumns
|
|
73
|
+
fixedColumns,
|
|
74
|
+
customColumnWidths
|
|
73
75
|
} = props;
|
|
74
76
|
|
|
75
77
|
const [customFilters, setCustomFilters] = useState<any>([]);
|
|
@@ -219,6 +221,16 @@ export const Table = (props: TableCustomProps) => {
|
|
|
219
221
|
});
|
|
220
222
|
}
|
|
221
223
|
|
|
224
|
+
if (customColumnWidths) {
|
|
225
|
+
customColumnWidths.forEach((column) => {
|
|
226
|
+
const { columnName, width } = column;
|
|
227
|
+
const foundColumn = columns.find((col: any) => col.dataIndex === columnName);
|
|
228
|
+
if (foundColumn) {
|
|
229
|
+
foundColumn.width = width;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
222
234
|
setCustomColumns(columns);
|
|
223
235
|
|
|
224
236
|
// Filters
|