@omniumretail/component-library 1.2.71 → 1.2.72
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/package.json +12 -3
- package/NPMPUBLISH.md +0 -29
- package/bitbucket-pipelines.yml +0 -95
- package/dist/components/AnalyticsBar/AnalyticsBar.stories.d.ts +0 -5
- package/dist/components/BellNotifications/BellNotifications.stories.d.ts +0 -5
- package/dist/components/Button/Button.stories.d.ts +0 -6
- package/dist/components/Category/Category.stories.d.ts +0 -3
- package/dist/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +0 -3
- package/dist/components/CategoryResponse/CategoryResponse.stories.d.ts +0 -3
- package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -5
- package/dist/components/DatePickerTag/DatePickerTag.stories.d.ts +0 -5
- package/dist/components/DropdownButton/DropdownButton.stories.d.ts +0 -5
- package/dist/components/ExportTableData/ExportTableData.stories.d.ts +0 -3
- package/dist/components/Footer/Footer.stories.d.ts +0 -5
- package/dist/components/Footer2/Footer.stories.d.ts +0 -6
- package/dist/components/Header/Header.stories.d.ts +0 -5
- package/dist/components/Input/Input.stories.d.ts +0 -5
- package/dist/components/InputCountryCode/inputCountryCode.stories.d.ts +0 -5
- package/dist/components/Label/Label.stories.d.ts +0 -6
- package/dist/components/Link/Link.stories.d.ts +0 -7
- package/dist/components/Menu/Menu.stories.d.ts +0 -5
- package/dist/components/MobileTable/MobileTable.stories.d.ts +0 -5
- package/dist/components/ModalConfirmation/ModalConfirmation.stories.d.ts +0 -5
- package/dist/components/ModalWithTable/ModalWithTable.stories.d.ts +0 -5
- package/dist/components/Navigation/Navigation.stories.d.ts +0 -5
- package/dist/components/Notification/Notification.stories.d.ts +0 -5
- package/dist/components/Questions/Questions.stories.d.ts +0 -3
- package/dist/components/Radio/Radio.stories.d.ts +0 -5
- package/dist/components/ResponseType/ResponseType.stories.d.ts +0 -3
- package/dist/components/ResponsiveTable/ResponsiveTable.stories.d.ts +0 -9
- package/dist/components/Select/Select.stories.d.ts +0 -6
- package/dist/components/Separator/Separator.stories.d.ts +0 -6
- package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -6
- package/dist/components/Switch/Switch.stories.d.ts +0 -5
- package/dist/components/Table/Table.stories.d.ts +0 -9
- package/dist/components/Tag/Tag.stories.d.ts +0 -5
- package/dist/components/Upload/Upload.stories.d.ts +0 -3
- package/dist/components/UserInfo/UserInfo.stories.d.ts +0 -3
- package/dist/components/WebCam/WebCam.stories.d.ts +0 -3
- package/dist/types/index.d.ts +0 -2
- package/public/index.ts +0 -0
- package/src/assets/code-brackets.svg +0 -1
- package/src/assets/colors.svg +0 -1
- package/src/assets/comments.svg +0 -1
- package/src/assets/direction.svg +0 -1
- package/src/assets/flow.svg +0 -1
- package/src/assets/fonts/Silka-Bold.woff2 +0 -0
- package/src/assets/fonts/Silka-Regular.woff2 +0 -0
- package/src/assets/images/A2AI-logo.png +0 -0
- package/src/assets/images/omnium-retail-logo-white.png +0 -0
- package/src/assets/images/omnium-retail-logo.png +0 -0
- package/src/assets/images/omnium-retail_icon.png +0 -0
- package/src/assets/plugin.svg +0 -1
- package/src/assets/repo.svg +0 -1
- package/src/assets/scss/_combinations.scss +0 -0
- package/src/assets/scss/_global.scss +0 -89
- package/src/assets/scss/index.scss +0 -2
- package/src/assets/stackalt.svg +0 -1
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +0 -236
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +0 -19
- package/src/components/AnalyticsBar/index.tsx +0 -76
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +0 -13
- package/src/components/AnalyticsBar/styles.module.scss +0 -137
- package/src/components/BellNotifications/BellNotifications.stories.tsx +0 -200
- package/src/components/BellNotifications/index.tsx +0 -154
- package/src/components/BellNotifications/styles.module.scss +0 -239
- package/src/components/Button/Button.stories.tsx +0 -26
- package/src/components/Button/index.tsx +0 -24
- package/src/components/Button/styles.module.scss +0 -70
- package/src/components/Category/Category.stories.tsx +0 -371
- package/src/components/Category/CategoryContent/index.tsx +0 -255
- package/src/components/Category/CategoryContent/styles.module.scss +0 -69
- package/src/components/Category/CategorySidebar/index.tsx +0 -344
- package/src/components/Category/CategorySidebar/styles.module.scss +0 -28
- package/src/components/Category/index.tsx +0 -58
- package/src/components/Category/styles.module.scss +0 -13
- package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +0 -274
- package/src/components/CategoryReadOnly/evaluationOptions.tsx +0 -81
- package/src/components/CategoryReadOnly/index.tsx +0 -328
- package/src/components/CategoryReadOnly/styles.module.scss +0 -214
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +0 -311
- package/src/components/CategoryResponse/evaluationOptions.tsx +0 -81
- package/src/components/CategoryResponse/index.tsx +0 -502
- package/src/components/CategoryResponse/styles.module.scss +0 -365
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -16
- package/src/components/DatePicker/index.tsx +0 -38
- package/src/components/DatePicker/styles.module.scss +0 -3
- package/src/components/DatePickerTag/DatePickerTag.stories.tsx +0 -19
- package/src/components/DatePickerTag/index.tsx +0 -91
- package/src/components/DatePickerTag/styles.module.scss +0 -32
- package/src/components/DropdownButton/DropdownButton.stories.tsx +0 -24
- package/src/components/DropdownButton/index.tsx +0 -36
- package/src/components/DropdownButton/styles.module.scss +0 -9
- package/src/components/ExportTableData/ExportTableData.stories.tsx +0 -43
- package/src/components/ExportTableData/index.tsx +0 -37
- package/src/components/ExportTableData/styles.module.scss +0 -4
- package/src/components/Footer/Footer.stories.tsx +0 -15
- package/src/components/Footer/index.tsx +0 -45
- package/src/components/Footer/styles.module.scss +0 -38
- package/src/components/Footer2/Footer.stories.tsx +0 -184
- package/src/components/Footer2/index.tsx +0 -322
- package/src/components/Footer2/styles.module.scss +0 -292
- package/src/components/Header/Header.data.ts +0 -26
- package/src/components/Header/Header.stories.tsx +0 -236
- package/src/components/Header/Header.types.ts +0 -32
- package/src/components/Header/README.md +0 -38
- package/src/components/Header/index.tsx +0 -200
- package/src/components/Header/styles.module.scss +0 -216
- package/src/components/Input/Input.stories.tsx +0 -13
- package/src/components/Input/index.tsx +0 -31
- package/src/components/Input/styles.module.scss +0 -8
- package/src/components/InputCountryCode/index.tsx +0 -79
- package/src/components/InputCountryCode/inputCountryCode.stories.tsx +0 -55
- package/src/components/InputCountryCode/styles.module.scss +0 -3
- package/src/components/Label/Label.stories.tsx +0 -21
- package/src/components/Label/index.tsx +0 -19
- package/src/components/Label/styles.module.scss +0 -17
- package/src/components/Link/Link.stories.tsx +0 -30
- package/src/components/Link/index.tsx +0 -21
- package/src/components/Link/styles.module.scss +0 -24
- package/src/components/Menu/Menu.stories.tsx +0 -178
- package/src/components/Menu/helpers/codeMutation.tsx +0 -19
- package/src/components/Menu/index.tsx +0 -24
- package/src/components/Menu/styles.module.scss +0 -0
- package/src/components/MobileTable/MobileTable.stories.tsx +0 -27
- package/src/components/MobileTable/index.tsx +0 -102
- package/src/components/MobileTable/styles.module.scss +0 -75
- package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +0 -40
- package/src/components/ModalConfirmation/ModalStatusList.tsx +0 -5
- package/src/components/ModalConfirmation/index.tsx +0 -71
- package/src/components/ModalConfirmation/styles.module.scss +0 -62
- package/src/components/ModalWithTable/ModalWithTable.stories.tsx +0 -99
- package/src/components/ModalWithTable/index.tsx +0 -238
- package/src/components/ModalWithTable/styles.module.scss +0 -77
- package/src/components/Navigation/Navigation.stories.tsx +0 -21
- package/src/components/Navigation/index.tsx +0 -91
- package/src/components/Navigation/styles.module.scss +0 -91
- package/src/components/Notification/Notification.stories.tsx +0 -32
- package/src/components/Notification/index.tsx +0 -28
- package/src/components/Questions/Questions.stories.tsx +0 -37
- package/src/components/Questions/SingleQuestion/index.tsx +0 -337
- package/src/components/Questions/SingleQuestion/styles.module.scss +0 -142
- package/src/components/Questions/index.tsx +0 -124
- package/src/components/Questions/styles.modules.scss +0 -0
- package/src/components/Radio/Radio.stories.tsx +0 -43
- package/src/components/Radio/index.tsx +0 -26
- package/src/components/Radio/styles.module.scss +0 -24
- package/src/components/ResponseType/ResponseType.stories.tsx +0 -393
- package/src/components/ResponseType/index.tsx +0 -100
- package/src/components/ResponseType/styles.module.scss +0 -31
- package/src/components/ResponsiveTable/ResponsiveTable.stories.tsx +0 -386
- package/src/components/ResponsiveTable/index.tsx +0 -389
- package/src/components/ResponsiveTable/styles.module.scss +0 -153
- package/src/components/Select/Select.stories.tsx +0 -39
- package/src/components/Select/index.tsx +0 -27
- package/src/components/Select/styles.module.scss +0 -19
- package/src/components/Separator/Separator.stories.tsx +0 -22
- package/src/components/Separator/index.tsx +0 -27
- package/src/components/Separator/styles.module.scss +0 -25
- package/src/components/Sidebar/Sidebar.stories.tsx +0 -85
- package/src/components/Sidebar/index.tsx +0 -127
- package/src/components/Sidebar/styles.module.scss +0 -141
- package/src/components/Switch/Switch.stories.tsx +0 -14
- package/src/components/Switch/index.tsx +0 -18
- package/src/components/Switch/styles.module.scss +0 -7
- package/src/components/Table/Table.stories.tsx +0 -337
- package/src/components/Table/index.tsx +0 -313
- package/src/components/Table/styles.module.scss +0 -97
- package/src/components/Tag/Tag.stories.tsx +0 -32
- package/src/components/Tag/index.tsx +0 -295
- package/src/components/Tag/styles.module.scss +0 -104
- package/src/components/Upload/Upload.stories.tsx +0 -45
- package/src/components/Upload/index.tsx +0 -112
- package/src/components/Upload/styles.module.scss +0 -29
- package/src/components/UserInfo/UserInfo.stories.tsx +0 -38
- package/src/components/UserInfo/index.tsx +0 -77
- package/src/components/UserInfo/styles.module.scss +0 -35
- package/src/components/WebCam/WebCam.stories.tsx +0 -24
- package/src/components/WebCam/index.tsx +0 -73
- package/src/components/WebCam/styles.module.scss +0 -37
- package/src/components/index.tsx +0 -34
- package/src/constants/i18n.ts +0 -25
- package/src/constants/logoCompanyHelper.ts +0 -52
- package/src/constants/translationHelper.ts +0 -7
- package/src/index.ts +0 -3
- package/src/locales/en.json +0 -142
- package/src/locales/es.json +0 -142
- package/src/locales/pt.json +0 -142
- package/src/types/Global.d.ts +0 -4
- package/tsconfig.json +0 -24
- package/vite.config.js +0 -51
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import { Space, TableProps, Select, Dropdown } from 'antd';
|
|
3
|
-
import { Table as AntdTable } from 'antd';
|
|
4
|
-
import type { ColumnsType } from 'antd/es/table/interface';
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { MoreOutlined } from '@ant-design/icons';
|
|
8
|
-
import classnames from 'classnames';
|
|
9
|
-
import { Button } from '../Button';
|
|
10
|
-
|
|
11
|
-
export interface FilterTableOptions {
|
|
12
|
-
value: string;
|
|
13
|
-
label: string;
|
|
14
|
-
direction: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface TableActions {
|
|
18
|
-
key: string;
|
|
19
|
-
label: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export enum sortByOption {
|
|
23
|
-
asc = 'asc',
|
|
24
|
-
desc = 'desc',
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
28
|
-
fieldsToSort?: any[],
|
|
29
|
-
selectPlaceholder?: string,
|
|
30
|
-
onSort?: (field: any, sortByOption: any) => void;
|
|
31
|
-
sortInfo?: any;
|
|
32
|
-
paginationInfo?: any;
|
|
33
|
-
headingTranslationsKey?: string;
|
|
34
|
-
actionsArray?: any;
|
|
35
|
-
rowSelectionInfo?: any;
|
|
36
|
-
rowKeyValue?: string;
|
|
37
|
-
hiddenColumns?: string[];
|
|
38
|
-
rowSelection?: any;
|
|
39
|
-
onSelectAllButtonClick?: () => void;
|
|
40
|
-
AllItemsShowing?: boolean;
|
|
41
|
-
selectAllStatus?: any;
|
|
42
|
-
isTableDataRefreshed?: any;
|
|
43
|
-
tableLoading?: any;
|
|
44
|
-
tableMaxHeight?: any;
|
|
45
|
-
columnsSortChange?: any;
|
|
46
|
-
sortByColumns?: boolean;
|
|
47
|
-
columnsToSort?: string[];
|
|
48
|
-
fixedColumns?: { dataIndex: string; side: 'left' | 'right' }[];
|
|
49
|
-
customColumnWidths?: { columnName: string; width: string }[];
|
|
50
|
-
buttonActionName?: string;
|
|
51
|
-
buttonActionLabel?: (record: any) => string | null;
|
|
52
|
-
buttonActionMethod?: () => void;
|
|
53
|
-
buttonActionStyle?: string | ((record: any) => any);
|
|
54
|
-
cleanRowSelection?: boolean;
|
|
55
|
-
getRowActions?: (record: any) => any;
|
|
56
|
-
customSelectAllButton?: string;
|
|
57
|
-
buttonActionIcon?: (record: any) => any | null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
61
|
-
const { t } = useTranslation();
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
dataSource = undefined,
|
|
65
|
-
fieldsToSort,
|
|
66
|
-
selectPlaceholder = 'Sort By',
|
|
67
|
-
onSort,
|
|
68
|
-
headingTranslationsKey,
|
|
69
|
-
actionsArray: items,
|
|
70
|
-
rowKeyValue,
|
|
71
|
-
hiddenColumns,
|
|
72
|
-
rowSelection,
|
|
73
|
-
onSelectAllButtonClick,
|
|
74
|
-
AllItemsShowing,
|
|
75
|
-
selectAllStatus,
|
|
76
|
-
isTableDataRefreshed,
|
|
77
|
-
tableLoading,
|
|
78
|
-
tableMaxHeight,
|
|
79
|
-
sortByColumns,
|
|
80
|
-
columnsToSort,
|
|
81
|
-
fixedColumns,
|
|
82
|
-
customColumnWidths,
|
|
83
|
-
buttonActionName,
|
|
84
|
-
buttonActionMethod,
|
|
85
|
-
buttonActionStyle,
|
|
86
|
-
buttonActionLabel,
|
|
87
|
-
cleanRowSelection,
|
|
88
|
-
getRowActions,
|
|
89
|
-
customSelectAllButton,
|
|
90
|
-
buttonActionIcon
|
|
91
|
-
} = props;
|
|
92
|
-
|
|
93
|
-
const [customFilters, setCustomFilters] = useState<any>([]);
|
|
94
|
-
const [customColumns, setCustomColumns] = useState<ColumnsType<any>>([]);
|
|
95
|
-
const [sortInfo, setSortInfo] = useState<any>([]);
|
|
96
|
-
const [selectedRowKeys, setselectedRowKeys] = useState<any>(rowSelection?.selectedRowKeys || []);
|
|
97
|
-
const [selectedAllRowKeys, setSelectedAllRowKeys] = useState(false);
|
|
98
|
-
const [deselectAll, setDeselectAll] = useState(false);
|
|
99
|
-
|
|
100
|
-
const onSelectChange = (newSelectedRowKeys: React.Key[]) => {
|
|
101
|
-
if (rowSelection.type === 'radio') {
|
|
102
|
-
setselectedRowKeys(newSelectedRowKeys);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
setselectedRowKeys((prevKeys: any) => {
|
|
107
|
-
const dataSourceIds = dataSource?.map((data) => data[rowKeyValue as any])
|
|
108
|
-
|
|
109
|
-
const oldKeys = prevKeys.filter((key: any) => {
|
|
110
|
-
return !dataSourceIds?.includes(key)
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return [...oldKeys, ...newSelectedRowKeys];
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
setSelectedAllRowKeys(false);
|
|
117
|
-
setDeselectAll(false);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const handleChange: TableProps<any>['onChange'] = (pagination, filters, sorter: any, extra) => {
|
|
121
|
-
const getPagination = {
|
|
122
|
-
currentPage: pagination.current,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const getSortAndPaginationInfo = { ...sortInfo, ...getPagination }
|
|
126
|
-
props.paginationInfo(getSortAndPaginationInfo);
|
|
127
|
-
|
|
128
|
-
// SORT
|
|
129
|
-
if (sortByColumns) {
|
|
130
|
-
const { field, order } = sorter;
|
|
131
|
-
let mappedOrder = null;
|
|
132
|
-
if (order === "ascend") {
|
|
133
|
-
mappedOrder = "asc";
|
|
134
|
-
} else if (order === "descend") {
|
|
135
|
-
mappedOrder = "desc";
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (field && mappedOrder) {
|
|
139
|
-
props.columnsSortChange({ field, order: mappedOrder });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const setSorter = (option: any) => {
|
|
145
|
-
onSort?.(option.value.split('-')[0], option.direction);
|
|
146
|
-
const sortData = {
|
|
147
|
-
sortDirection: option.direction,
|
|
148
|
-
sortValue: option.value.split('-')[0],
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
setSortInfo(sortData)
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const selectAllRows = () => {
|
|
155
|
-
if (selectedAllRowKeys) {
|
|
156
|
-
setDeselectAll(true);
|
|
157
|
-
} else {
|
|
158
|
-
onSelectAllButtonClick?.(); // Call the onSelectAllButtonClick callback
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
if (isTableDataRefreshed && !tableLoading || AllItemsShowing) {
|
|
164
|
-
if (selectAllStatus && AllItemsShowing) {
|
|
165
|
-
const allRowKeys = dataSource?.map((record) => record[rowKeyValue as any]);
|
|
166
|
-
setselectedRowKeys(allRowKeys);
|
|
167
|
-
setSelectedAllRowKeys(true);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, [isTableDataRefreshed, tableLoading, selectAllStatus, AllItemsShowing]);
|
|
171
|
-
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
if (deselectAll) {
|
|
174
|
-
setselectedRowKeys([]);
|
|
175
|
-
setDeselectAll(false);
|
|
176
|
-
setSelectedAllRowKeys(false);
|
|
177
|
-
}
|
|
178
|
-
}, [deselectAll]);
|
|
179
|
-
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
props.rowSelectionInfo(selectedRowKeys);
|
|
182
|
-
}, [selectedRowKeys]);
|
|
183
|
-
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
if (cleanRowSelection) {
|
|
186
|
-
setselectedRowKeys([]);
|
|
187
|
-
}
|
|
188
|
-
}, [cleanRowSelection]);
|
|
189
|
-
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
if (dataSource && (dataSource as any)?.length > 0) {
|
|
192
|
-
// Columns
|
|
193
|
-
let columns = Object.keys(dataSource?.[0]).map(key => {
|
|
194
|
-
if (hiddenColumns?.includes(key)) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const isColumnSortable = columnsToSort?.includes(key) ? sortByColumns : false;
|
|
199
|
-
|
|
200
|
-
const column = {
|
|
201
|
-
title: headingTranslationsKey ? t(`${headingTranslationsKey}.${key}`) : key,
|
|
202
|
-
dataIndex: key,
|
|
203
|
-
key: key,
|
|
204
|
-
ellipsis: false,
|
|
205
|
-
sorter: isColumnSortable,
|
|
206
|
-
// No fixed property here, we'll add it later based on the fixedColumns prop
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return column;
|
|
210
|
-
|
|
211
|
-
}).filter(el => el !== undefined) as any;
|
|
212
|
-
|
|
213
|
-
const columnActions = {
|
|
214
|
-
key: 'action',
|
|
215
|
-
title: headingTranslationsKey ? t(`${headingTranslationsKey}.${'action'}`) : 'action',
|
|
216
|
-
dataIndex: 'action',
|
|
217
|
-
ellipsis: false,
|
|
218
|
-
align: 'right',
|
|
219
|
-
render: (_: any, record: any) => {
|
|
220
|
-
const rowActions = getRowActions ? getRowActions(record) : null;
|
|
221
|
-
|
|
222
|
-
if ((!items?.[0] && !rowActions)) return null;
|
|
223
|
-
|
|
224
|
-
const actions = rowActions ? rowActions : items;
|
|
225
|
-
|
|
226
|
-
const buttonLabel = buttonActionLabel ? buttonActionLabel(record) : null;
|
|
227
|
-
|
|
228
|
-
const icon = buttonActionIcon ? buttonActionIcon(record) : null;
|
|
229
|
-
|
|
230
|
-
const buttonClass = typeof buttonActionStyle === 'function'
|
|
231
|
-
? buttonActionStyle(record) // Se for uma função, chama com o `record`
|
|
232
|
-
: buttonActionStyle || ''; // Se for string, usa diretamente
|
|
233
|
-
|
|
234
|
-
const renderActionElement = () => {
|
|
235
|
-
if (icon) {
|
|
236
|
-
return (
|
|
237
|
-
<span
|
|
238
|
-
className={buttonClass}
|
|
239
|
-
onClick={() => buttonActionMethod?.()}
|
|
240
|
-
>
|
|
241
|
-
{icon}
|
|
242
|
-
</span>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Senão, renderiza botão como antes
|
|
247
|
-
if (buttonActionName || buttonLabel) {
|
|
248
|
-
return (
|
|
249
|
-
<Button
|
|
250
|
-
customClass={buttonClass}
|
|
251
|
-
onClick={() => buttonActionMethod?.()}
|
|
252
|
-
>
|
|
253
|
-
{buttonActionName || buttonLabel}
|
|
254
|
-
</Button>
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return null;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
return (
|
|
262
|
-
<Space size="middle">
|
|
263
|
-
{renderActionElement()}
|
|
264
|
-
|
|
265
|
-
<Dropdown menu={{ items: actions }}>
|
|
266
|
-
<a>
|
|
267
|
-
<MoreOutlined style={{ color: 'var(--color-blue)', transform: 'scale(1.6)' }} />
|
|
268
|
-
</a>
|
|
269
|
-
</Dropdown>
|
|
270
|
-
</Space>
|
|
271
|
-
);
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
(items || getRowActions) && columns.push(columnActions as any);
|
|
276
|
-
|
|
277
|
-
if (fixedColumns) {
|
|
278
|
-
fixedColumns.forEach((column) => {
|
|
279
|
-
const { dataIndex, side } = column;
|
|
280
|
-
const foundColumn = columns.find((col: any) => col.dataIndex === dataIndex);
|
|
281
|
-
if (foundColumn) {
|
|
282
|
-
foundColumn.fixed = side;
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (customColumnWidths) {
|
|
288
|
-
customColumnWidths.forEach((column) => {
|
|
289
|
-
const { columnName, width } = column;
|
|
290
|
-
const foundColumn = columns.find((col: any) => col.dataIndex === columnName);
|
|
291
|
-
if (foundColumn) {
|
|
292
|
-
foundColumn.width = width;
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
setCustomColumns(columns);
|
|
298
|
-
|
|
299
|
-
// Filters
|
|
300
|
-
const dataKeysToFilter = Object.keys(dataSource?.[0]).filter((el) => fieldsToSort?.includes(el));
|
|
301
|
-
|
|
302
|
-
const filters = ([] as FilterTableOptions[]).concat(
|
|
303
|
-
...dataKeysToFilter.map(key => ({
|
|
304
|
-
value: `${key}-${sortByOption.desc}`,
|
|
305
|
-
label: `${headingTranslationsKey ? t(`${headingTranslationsKey}.${key}`) : key} (${sortByOption.desc})`,
|
|
306
|
-
direction: `${sortByOption.desc}`,
|
|
307
|
-
})),
|
|
308
|
-
...dataKeysToFilter.map(key => ({
|
|
309
|
-
value: `${key}-${sortByOption.asc}`,
|
|
310
|
-
label: `${headingTranslationsKey ? t(`${headingTranslationsKey}.${key}`) : key} (${sortByOption.asc})`,
|
|
311
|
-
direction: `${sortByOption.asc}`,
|
|
312
|
-
}))
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
setCustomFilters(filters);
|
|
316
|
-
}
|
|
317
|
-
}, [dataSource]);
|
|
318
|
-
|
|
319
|
-
const shouldRenderSortDropdown = customFilters.length > 0;
|
|
320
|
-
|
|
321
|
-
const tableWrapperClasses = classnames({
|
|
322
|
-
[styles.tableWrapperNoSelection]: !rowSelection
|
|
323
|
-
}, [styles.tableWrapper]);
|
|
324
|
-
|
|
325
|
-
return (
|
|
326
|
-
<div className={tableWrapperClasses}>
|
|
327
|
-
{shouldRenderSortDropdown &&
|
|
328
|
-
<Space style={{ marginBottom: 16 }}>
|
|
329
|
-
<Select
|
|
330
|
-
style={{ width: 'auto', minWidth: 200 }}
|
|
331
|
-
placeholder={selectPlaceholder}
|
|
332
|
-
onSelect={(_, option: any) => {
|
|
333
|
-
setSorter(option);
|
|
334
|
-
}}
|
|
335
|
-
optionFilterProp="children"
|
|
336
|
-
filterOption={(input, option) => (option?.label ?? '').includes(input)}
|
|
337
|
-
filterSort={(optionA, optionB) =>
|
|
338
|
-
(optionA?.label ?? '').toLowerCase().localeCompare((optionB?.label ?? '').toLowerCase())
|
|
339
|
-
}
|
|
340
|
-
options={customFilters}
|
|
341
|
-
/>
|
|
342
|
-
</Space>
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
<AntdTable
|
|
346
|
-
dataSource={dataSource}
|
|
347
|
-
onChange={handleChange}
|
|
348
|
-
{...props}
|
|
349
|
-
columns={customColumns}
|
|
350
|
-
{...props.rowSelection ? (
|
|
351
|
-
{
|
|
352
|
-
rowSelection: {
|
|
353
|
-
selectedRowKeys: selectedRowKeys,
|
|
354
|
-
onChange: onSelectChange,
|
|
355
|
-
type: props.rowSelection?.type,
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
) : null}
|
|
359
|
-
rowKey={rowKeyValue}
|
|
360
|
-
onRow={(record: any) => {
|
|
361
|
-
const internalRow = {
|
|
362
|
-
style: {
|
|
363
|
-
opacity: (record.Status === "I" || record.Status === "Draft") ? 0.5 : 1,
|
|
364
|
-
boxShadow: record.Status === "Draft" ? "inset 2px 0 0 #FF674C" : "none",
|
|
365
|
-
},
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
const externalRow = props.onRow?.(record) ?? {};
|
|
369
|
-
|
|
370
|
-
return {
|
|
371
|
-
...externalRow,
|
|
372
|
-
...internalRow,
|
|
373
|
-
style: {
|
|
374
|
-
...internalRow.style,
|
|
375
|
-
...externalRow.style,
|
|
376
|
-
},
|
|
377
|
-
};
|
|
378
|
-
}}
|
|
379
|
-
{...(tableMaxHeight ? { scroll: { y: tableMaxHeight } } : {})}
|
|
380
|
-
/>
|
|
381
|
-
{
|
|
382
|
-
onSelectAllButtonClick &&
|
|
383
|
-
<Button onClick={selectAllRows} customClass={customSelectAllButton}>
|
|
384
|
-
{selectedAllRowKeys ? t('components.table.deselectAll') : t('components.table.selectAll')}
|
|
385
|
-
</Button>
|
|
386
|
-
}
|
|
387
|
-
</div>
|
|
388
|
-
);
|
|
389
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
.tableWrapper {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
|
|
6
|
-
:global {
|
|
7
|
-
.ant-table-thead > tr > th {
|
|
8
|
-
background-color: transparent;
|
|
9
|
-
border: 0px;
|
|
10
|
-
color: var(--color-blue);
|
|
11
|
-
|
|
12
|
-
&:before {
|
|
13
|
-
display: none;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ant-table-wrapper {
|
|
18
|
-
margin-bottom: 12px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.ant-table-cell {
|
|
22
|
-
word-break: break-word;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.ant-table-tbody {
|
|
26
|
-
> tr {
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
|
|
29
|
-
&:last-child {
|
|
30
|
-
> td {
|
|
31
|
-
border-bottom: 1px solid var(--color-grey-light) !important;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&:first-child {
|
|
36
|
-
> td {
|
|
37
|
-
border-top: 1px solid var(--color-blue) !important;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&:hover {
|
|
42
|
-
td {
|
|
43
|
-
border-radius: 0 !important;
|
|
44
|
-
border-bottom-color: var(--color-grey-light) !important;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.ant-space {
|
|
51
|
-
align-self: flex-end;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.ant-select-selection-placeholder {
|
|
55
|
-
color: var(--color-black);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.ant-select-selector,
|
|
59
|
-
.ant-select-focused .ant-select-selection-search {
|
|
60
|
-
border: none !important;
|
|
61
|
-
box-shadow: none !important;
|
|
62
|
-
|
|
63
|
-
&:focus,
|
|
64
|
-
&:hover {
|
|
65
|
-
border: none !important;
|
|
66
|
-
box-shadow: none !important;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.ant-pagination {
|
|
71
|
-
max-width: calc(100% - 200px);
|
|
72
|
-
margin-left: auto !important;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
button[type="button"].ant-pagination-item-link {
|
|
76
|
-
margin-top: 0 !important;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
button[type="button"] {
|
|
81
|
-
margin-top: -50px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
@media screen and (max-width: 1024px) {
|
|
86
|
-
:global {
|
|
87
|
-
.ant-table-thead>tr>th {
|
|
88
|
-
font-size: 12px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.ant-table-tbody>tr>td {
|
|
92
|
-
font-size: 12px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.ant-table-wrapper .ant-table-thead>tr>th {
|
|
96
|
-
padding: 8px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.ant-table-wrapper .ant-table-tbody>tr>td {
|
|
100
|
-
padding: 8px;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
@media screen and (max-width: 767px) {
|
|
106
|
-
:global {
|
|
107
|
-
.ant-table-thead>tr>th {
|
|
108
|
-
font-size: 10px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.ant-table-tbody>tr>td {
|
|
112
|
-
font-size: 10px;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.ant-table-content table {
|
|
116
|
-
width: 100%;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.ant-table-content {
|
|
120
|
-
width: 100%;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.ant-table-wrapper .ant-table .ant-table-title,
|
|
124
|
-
.ant-table-wrapper .ant-table .ant-table-header {
|
|
125
|
-
word-break: break-all;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ant-table-wrapper .ant-table-thead>tr>th {
|
|
129
|
-
padding: 4px;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ant-table-wrapper .ant-table-tbody>tr>td {
|
|
133
|
-
padding: 4px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.ant-table-wrapper .ant-table-column-sorter {
|
|
137
|
-
margin-inline-start: 0px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.ant-table-wrapper .ant-table-column-sorter-up {
|
|
141
|
-
font-size: 8px;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.ant-table-wrapper .ant-table-column-sorter-down {
|
|
145
|
-
font-size: 8px;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.ant-pagination {
|
|
149
|
-
max-width: unset;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { Select } from '.';
|
|
3
|
-
import { SelectProps } from 'antd';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Select',
|
|
7
|
-
component: Select,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: StoryFn<SelectProps> = (args: any) => <Select {...args}></Select>;
|
|
11
|
-
|
|
12
|
-
export const Primary = Template.bind({});
|
|
13
|
-
Primary.args = {
|
|
14
|
-
defaultValue: 'something',
|
|
15
|
-
options: [
|
|
16
|
-
{
|
|
17
|
-
value: 'lucy',
|
|
18
|
-
label: 'Lucy',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
value: 'Yiminghe',
|
|
22
|
-
label: 'yiminghe',
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const noArguments = Template.bind({});
|
|
28
|
-
noArguments.args = {
|
|
29
|
-
options: [
|
|
30
|
-
{
|
|
31
|
-
value: 'lucy',
|
|
32
|
-
label: 'Lucy',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
value: 'Yiminghe',
|
|
36
|
-
label: 'yiminghe',
|
|
37
|
-
},
|
|
38
|
-
]
|
|
39
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import { Select as AntdSelect, SelectProps as AntdSelectProps } from 'antd';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
export interface SelectProps extends AntdSelectProps {
|
|
6
|
-
customClass?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Select = ({customClass, ...props}: SelectProps) => {
|
|
10
|
-
const { defaultValue, options } = props;
|
|
11
|
-
|
|
12
|
-
const selectClasses = {
|
|
13
|
-
[styles.select]: true,
|
|
14
|
-
[`${customClass}`]: customClass,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
(options || defaultValue) &&
|
|
19
|
-
<AntdSelect
|
|
20
|
-
className={ classNames(selectClasses) }
|
|
21
|
-
defaultValue={defaultValue}
|
|
22
|
-
style={{ minWidth: 180 }}
|
|
23
|
-
options={options}
|
|
24
|
-
{...props}
|
|
25
|
-
></AntdSelect>
|
|
26
|
-
)
|
|
27
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.select {
|
|
2
|
-
:global {
|
|
3
|
-
.ant-select-selector {
|
|
4
|
-
border-color: rgba(var(--color-black-rgb), .5) !important;
|
|
5
|
-
height: 50px !important;
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
}
|
|
9
|
-
.ant-select-arrow {
|
|
10
|
-
color: var(--color-black);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:global {
|
|
16
|
-
.ant-select-single {
|
|
17
|
-
height: unset;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from "@storybook/react-vite";
|
|
2
|
-
import { Separator, SeparatorProps, Spaces } from '.';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Separator',
|
|
6
|
-
component: Separator,
|
|
7
|
-
} as Meta;
|
|
8
|
-
|
|
9
|
-
const Template: StoryFn<SeparatorProps> = (args: any) => <Separator {...args}></Separator>;
|
|
10
|
-
|
|
11
|
-
export const Primary = Template.bind({});
|
|
12
|
-
Primary.args = {
|
|
13
|
-
hasOpacity: false,
|
|
14
|
-
colorIsBlue: false,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Secondary = Template.bind({});
|
|
18
|
-
Secondary.args = {
|
|
19
|
-
hasOpacity: true,
|
|
20
|
-
colorIsBlue: true,
|
|
21
|
-
space: Spaces.l,
|
|
22
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styles from './styles.module.scss';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
|
|
4
|
-
export enum Spaces {
|
|
5
|
-
s = 's',
|
|
6
|
-
m = 'm',
|
|
7
|
-
l = 'l',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface SeparatorProps {
|
|
11
|
-
hasOpacity?: boolean;
|
|
12
|
-
colorIsBlue?: boolean;
|
|
13
|
-
space: Spaces;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Separator = (props: SeparatorProps) => {
|
|
17
|
-
const { hasOpacity, colorIsBlue, space } = props;
|
|
18
|
-
|
|
19
|
-
const separatorClasses = classNames({
|
|
20
|
-
[styles.separator]: true,
|
|
21
|
-
[styles['separator--opacity-50']]: hasOpacity,
|
|
22
|
-
[styles['separator--blue-background']]: colorIsBlue,
|
|
23
|
-
[styles[`separator--space-${space}` || '']]: space && Spaces[space],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return <hr className={separatorClasses} />
|
|
27
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.separator {
|
|
2
|
-
background-color: var(--color-orange);
|
|
3
|
-
height: 1px;
|
|
4
|
-
border: none;
|
|
5
|
-
|
|
6
|
-
&--opacity-50 {
|
|
7
|
-
opacity: 50%;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&--blue-background {
|
|
11
|
-
background-color: var(--color-blue);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&--space-s {
|
|
15
|
-
margin: 8px 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&--space-m {
|
|
19
|
-
margin: 16px 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&--space-l {
|
|
23
|
-
margin: 24px 0;
|
|
24
|
-
}
|
|
25
|
-
}
|