@omniumretail/component-library 1.2.70 → 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.
Files changed (249) hide show
  1. package/dist/component-library.umd.js +1154 -0
  2. package/dist/{types/components → components}/AnalyticsBar/helpers/codeMutation.d.ts +2 -2
  3. package/dist/{types/components → components}/AnalyticsBar/index.d.ts +2 -1
  4. package/dist/{types/components → components}/Button/index.d.ts +2 -1
  5. package/dist/{types/components → components}/Category/index.d.ts +2 -1
  6. package/dist/{types/components → components}/CategoryReadOnly/index.d.ts +2 -1
  7. package/dist/{types/components → components}/CategoryResponse/index.d.ts +3 -2
  8. package/dist/{types/components → components}/DatePicker/index.d.ts +2 -1
  9. package/dist/{types/components → components}/DatePickerTag/index.d.ts +2 -1
  10. package/dist/{types/components → components}/DropdownButton/index.d.ts +3 -2
  11. package/dist/{types/components → components}/Footer2/index.d.ts +2 -1
  12. package/dist/{types/components → components}/Header/Header.data.d.ts +2 -1
  13. package/dist/{types/components → components}/Header/Header.types.d.ts +2 -1
  14. package/dist/{types/components → components}/Header/index.d.ts +2 -1
  15. package/dist/{types/components → components}/Input/index.d.ts +2 -1
  16. package/dist/{types/components → components}/InputCountryCode/index.d.ts +2 -1
  17. package/dist/{types/components → components}/Link/index.d.ts +2 -1
  18. package/dist/{types/components → components}/Menu/helpers/codeMutation.d.ts +2 -2
  19. package/dist/{types/components → components}/Menu/index.d.ts +2 -1
  20. package/dist/{types/components → components}/MobileTable/index.d.ts +2 -1
  21. package/dist/{types/components → components}/ModalWithTable/index.d.ts +2 -1
  22. package/dist/{types/components → components}/Notification/index.d.ts +2 -1
  23. package/dist/{types/components → components}/Radio/index.d.ts +3 -2
  24. package/dist/{types/components → components}/ResponsiveTable/index.d.ts +2 -1
  25. package/dist/{types/components → components}/Select/index.d.ts +2 -1
  26. package/dist/{types/components → components}/Switch/index.d.ts +2 -1
  27. package/dist/{types/components → components}/Table/index.d.ts +2 -1
  28. package/dist/{types/components → components}/Tag/index.d.ts +3 -2
  29. package/dist/{types/components → components}/Upload/index.d.ts +3 -2
  30. package/dist/{types/components → components}/WebCam/index.d.ts +2 -1
  31. package/{src/locales/en.json → dist/locales/en.json.d.ts} +4 -2
  32. package/{src/locales/es.json → dist/locales/es.json.d.ts} +4 -2
  33. package/{src/locales/pt.json → dist/locales/pt.json.d.ts} +4 -1
  34. package/package.json +98 -183
  35. package/NPMPUBLISH.md +0 -29
  36. package/bitbucket-pipelines.yml +0 -95
  37. package/dist/780.bundle.js +0 -1
  38. package/dist/838.bundle.js +0 -2
  39. package/dist/838.bundle.js.LICENSE.txt +0 -1
  40. package/dist/bundle.js +0 -2
  41. package/dist/bundle.js.LICENSE.txt +0 -451
  42. package/dist/main.css +0 -36
  43. package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +0 -4
  44. package/dist/types/components/BellNotifications/BellNotifications.stories.d.ts +0 -4
  45. package/dist/types/components/Button/Button.stories.d.ts +0 -5
  46. package/dist/types/components/Category/Category.stories.d.ts +0 -3
  47. package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +0 -3
  48. package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +0 -3
  49. package/dist/types/components/DatePicker/DatePicker.stories.d.ts +0 -4
  50. package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +0 -4
  51. package/dist/types/components/DropdownButton/DropdownButton.stories.d.ts +0 -4
  52. package/dist/types/components/ExportTableData/ExportTableData.stories.d.ts +0 -3
  53. package/dist/types/components/Footer/Footer.stories.d.ts +0 -4
  54. package/dist/types/components/Footer2/Footer.stories.d.ts +0 -5
  55. package/dist/types/components/Header/Header.stories.d.ts +0 -4
  56. package/dist/types/components/Input/Input.stories.d.ts +0 -4
  57. package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +0 -4
  58. package/dist/types/components/Label/Label.stories.d.ts +0 -5
  59. package/dist/types/components/Link/Link.stories.d.ts +0 -6
  60. package/dist/types/components/Menu/Menu.stories.d.ts +0 -4
  61. package/dist/types/components/MobileTable/MobileTable.stories.d.ts +0 -4
  62. package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +0 -4
  63. package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +0 -4
  64. package/dist/types/components/Navigation/Navigation.stories.d.ts +0 -4
  65. package/dist/types/components/Notification/Notification.stories.d.ts +0 -4
  66. package/dist/types/components/Questions/Questions.stories.d.ts +0 -3
  67. package/dist/types/components/Radio/Radio.stories.d.ts +0 -4
  68. package/dist/types/components/ResponseType/ResponseType.stories.d.ts +0 -3
  69. package/dist/types/components/ResponsiveTable/ResponsiveTable.stories.d.ts +0 -8
  70. package/dist/types/components/Select/Select.stories.d.ts +0 -5
  71. package/dist/types/components/Separator/Separator.stories.d.ts +0 -5
  72. package/dist/types/components/Sidebar/Sidebar.stories.d.ts +0 -5
  73. package/dist/types/components/Switch/Switch.stories.d.ts +0 -4
  74. package/dist/types/components/Table/Table.stories.d.ts +0 -8
  75. package/dist/types/components/Tag/Tag.stories.d.ts +0 -4
  76. package/dist/types/components/Upload/Upload.stories.d.ts +0 -3
  77. package/dist/types/components/UserInfo/UserInfo.stories.d.ts +0 -3
  78. package/dist/types/components/WebCam/WebCam.stories.d.ts +0 -3
  79. package/src/assets/code-brackets.svg +0 -1
  80. package/src/assets/colors.svg +0 -1
  81. package/src/assets/comments.svg +0 -1
  82. package/src/assets/direction.svg +0 -1
  83. package/src/assets/flow.svg +0 -1
  84. package/src/assets/fonts/Silka-Bold.woff2 +0 -0
  85. package/src/assets/fonts/Silka-Regular.woff2 +0 -0
  86. package/src/assets/images/A2AI-logo.png +0 -0
  87. package/src/assets/images/omnium-retail-logo-white.png +0 -0
  88. package/src/assets/images/omnium-retail-logo.png +0 -0
  89. package/src/assets/images/omnium-retail_icon.png +0 -0
  90. package/src/assets/plugin.svg +0 -1
  91. package/src/assets/repo.svg +0 -1
  92. package/src/assets/scss/_combinations.scss +0 -0
  93. package/src/assets/scss/_global.scss +0 -89
  94. package/src/assets/scss/index.scss +0 -2
  95. package/src/assets/stackalt.svg +0 -1
  96. package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +0 -236
  97. package/src/components/AnalyticsBar/helpers/codeMutation.tsx +0 -19
  98. package/src/components/AnalyticsBar/index.tsx +0 -76
  99. package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +0 -13
  100. package/src/components/AnalyticsBar/styles.module.scss +0 -137
  101. package/src/components/BellNotifications/BellNotifications.stories.tsx +0 -200
  102. package/src/components/BellNotifications/index.tsx +0 -154
  103. package/src/components/BellNotifications/styles.module.scss +0 -239
  104. package/src/components/Button/Button.stories.tsx +0 -26
  105. package/src/components/Button/index.tsx +0 -24
  106. package/src/components/Button/styles.module.scss +0 -70
  107. package/src/components/Category/Category.stories.tsx +0 -371
  108. package/src/components/Category/CategoryContent/index.tsx +0 -255
  109. package/src/components/Category/CategoryContent/styles.module.scss +0 -69
  110. package/src/components/Category/CategorySidebar/index.tsx +0 -344
  111. package/src/components/Category/CategorySidebar/styles.module.scss +0 -28
  112. package/src/components/Category/index.tsx +0 -58
  113. package/src/components/Category/styles.module.scss +0 -13
  114. package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +0 -274
  115. package/src/components/CategoryReadOnly/evaluationOptions.tsx +0 -81
  116. package/src/components/CategoryReadOnly/index.tsx +0 -328
  117. package/src/components/CategoryReadOnly/styles.module.scss +0 -214
  118. package/src/components/CategoryResponse/CategoryResponse.stories.tsx +0 -312
  119. package/src/components/CategoryResponse/evaluationOptions.tsx +0 -81
  120. package/src/components/CategoryResponse/index.tsx +0 -502
  121. package/src/components/CategoryResponse/styles.module.scss +0 -365
  122. package/src/components/DatePicker/DatePicker.stories.tsx +0 -16
  123. package/src/components/DatePicker/index.tsx +0 -38
  124. package/src/components/DatePicker/styles.module.scss +0 -3
  125. package/src/components/DatePickerTag/DatePickerTag.stories.tsx +0 -19
  126. package/src/components/DatePickerTag/index.tsx +0 -91
  127. package/src/components/DatePickerTag/styles.module.scss +0 -32
  128. package/src/components/DropdownButton/DropdownButton.stories.tsx +0 -24
  129. package/src/components/DropdownButton/index.tsx +0 -36
  130. package/src/components/DropdownButton/styles.module.scss +0 -9
  131. package/src/components/ExportTableData/ExportTableData.stories.tsx +0 -43
  132. package/src/components/ExportTableData/index.tsx +0 -37
  133. package/src/components/ExportTableData/styles.module.scss +0 -4
  134. package/src/components/Footer/Footer.stories.tsx +0 -15
  135. package/src/components/Footer/index.tsx +0 -45
  136. package/src/components/Footer/styles.module.scss +0 -38
  137. package/src/components/Footer2/Footer.stories.tsx +0 -184
  138. package/src/components/Footer2/index.tsx +0 -322
  139. package/src/components/Footer2/styles.module.scss +0 -292
  140. package/src/components/Header/Header.data.ts +0 -26
  141. package/src/components/Header/Header.stories.tsx +0 -236
  142. package/src/components/Header/Header.types.ts +0 -32
  143. package/src/components/Header/README.md +0 -38
  144. package/src/components/Header/index.tsx +0 -200
  145. package/src/components/Header/styles.module.scss +0 -216
  146. package/src/components/Input/Input.stories.tsx +0 -13
  147. package/src/components/Input/index.tsx +0 -31
  148. package/src/components/Input/styles.module.scss +0 -8
  149. package/src/components/InputCountryCode/index.tsx +0 -79
  150. package/src/components/InputCountryCode/inputCountryCode.stories.tsx +0 -55
  151. package/src/components/InputCountryCode/styles.module.scss +0 -3
  152. package/src/components/Label/Label.stories.tsx +0 -21
  153. package/src/components/Label/index.tsx +0 -19
  154. package/src/components/Label/styles.module.scss +0 -17
  155. package/src/components/Link/Link.stories.tsx +0 -30
  156. package/src/components/Link/index.tsx +0 -21
  157. package/src/components/Link/styles.module.scss +0 -24
  158. package/src/components/Menu/Menu.stories.tsx +0 -178
  159. package/src/components/Menu/helpers/codeMutation.tsx +0 -19
  160. package/src/components/Menu/index.tsx +0 -24
  161. package/src/components/Menu/styles.module.scss +0 -0
  162. package/src/components/MobileTable/MobileTable.stories.tsx +0 -27
  163. package/src/components/MobileTable/index.tsx +0 -102
  164. package/src/components/MobileTable/styles.module.scss +0 -75
  165. package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +0 -40
  166. package/src/components/ModalConfirmation/ModalStatusList.tsx +0 -5
  167. package/src/components/ModalConfirmation/index.tsx +0 -71
  168. package/src/components/ModalConfirmation/styles.module.scss +0 -62
  169. package/src/components/ModalWithTable/ModalWithTable.stories.tsx +0 -99
  170. package/src/components/ModalWithTable/index.tsx +0 -238
  171. package/src/components/ModalWithTable/styles.module.scss +0 -77
  172. package/src/components/Navigation/Navigation.stories.tsx +0 -21
  173. package/src/components/Navigation/index.tsx +0 -91
  174. package/src/components/Navigation/styles.module.scss +0 -91
  175. package/src/components/Notification/Notification.stories.tsx +0 -32
  176. package/src/components/Notification/index.tsx +0 -28
  177. package/src/components/Questions/Questions.stories.tsx +0 -37
  178. package/src/components/Questions/SingleQuestion/index.tsx +0 -337
  179. package/src/components/Questions/SingleQuestion/styles.module.scss +0 -142
  180. package/src/components/Questions/index.tsx +0 -124
  181. package/src/components/Questions/styles.modules.scss +0 -0
  182. package/src/components/Radio/Radio.stories.tsx +0 -43
  183. package/src/components/Radio/index.tsx +0 -26
  184. package/src/components/Radio/styles.module.scss +0 -24
  185. package/src/components/ResponseType/ResponseType.stories.tsx +0 -393
  186. package/src/components/ResponseType/index.tsx +0 -100
  187. package/src/components/ResponseType/styles.module.scss +0 -31
  188. package/src/components/ResponsiveTable/ResponsiveTable.stories.tsx +0 -386
  189. package/src/components/ResponsiveTable/index.tsx +0 -389
  190. package/src/components/ResponsiveTable/styles.module.scss +0 -153
  191. package/src/components/Select/Select.stories.tsx +0 -39
  192. package/src/components/Select/index.tsx +0 -27
  193. package/src/components/Select/styles.module.scss +0 -19
  194. package/src/components/Separator/Separator.stories.tsx +0 -22
  195. package/src/components/Separator/index.tsx +0 -27
  196. package/src/components/Separator/styles.module.scss +0 -25
  197. package/src/components/Sidebar/Sidebar.stories.tsx +0 -85
  198. package/src/components/Sidebar/index.tsx +0 -127
  199. package/src/components/Sidebar/styles.module.scss +0 -141
  200. package/src/components/Switch/Switch.stories.tsx +0 -14
  201. package/src/components/Switch/index.tsx +0 -18
  202. package/src/components/Switch/styles.module.scss +0 -7
  203. package/src/components/Table/Table.stories.tsx +0 -337
  204. package/src/components/Table/index.tsx +0 -313
  205. package/src/components/Table/styles.module.scss +0 -97
  206. package/src/components/Tag/Tag.stories.tsx +0 -32
  207. package/src/components/Tag/index.tsx +0 -295
  208. package/src/components/Tag/styles.module.scss +0 -104
  209. package/src/components/Upload/Upload.stories.tsx +0 -45
  210. package/src/components/Upload/index.tsx +0 -112
  211. package/src/components/Upload/styles.module.scss +0 -29
  212. package/src/components/UserInfo/UserInfo.stories.tsx +0 -38
  213. package/src/components/UserInfo/index.tsx +0 -77
  214. package/src/components/UserInfo/styles.module.scss +0 -35
  215. package/src/components/WebCam/WebCam.stories.tsx +0 -24
  216. package/src/components/WebCam/index.tsx +0 -73
  217. package/src/components/WebCam/styles.module.scss +0 -37
  218. package/src/components/index.tsx +0 -34
  219. package/src/constants/i18n.ts +0 -25
  220. package/src/constants/logoCompanyHelper.ts +0 -52
  221. package/src/constants/translationHelper.ts +0 -7
  222. package/src/index.ts +0 -3
  223. package/src/types/Global.d.ts +0 -4
  224. package/tsconfig.json +0 -29
  225. package/webpack.config.js +0 -51
  226. /package/dist/{types/components → components}/AnalyticsBar/interfaces/analyticsBar.d.ts +0 -0
  227. /package/dist/{types/components → components}/BellNotifications/index.d.ts +0 -0
  228. /package/dist/{types/components → components}/Category/CategoryContent/index.d.ts +0 -0
  229. /package/dist/{types/components → components}/Category/CategorySidebar/index.d.ts +0 -0
  230. /package/dist/{types/components → components}/CategoryReadOnly/evaluationOptions.d.ts +0 -0
  231. /package/dist/{types/components → components}/CategoryResponse/evaluationOptions.d.ts +0 -0
  232. /package/dist/{types/components → components}/ExportTableData/index.d.ts +0 -0
  233. /package/dist/{types/components → components}/Footer/index.d.ts +0 -0
  234. /package/dist/{types/components → components}/Label/index.d.ts +0 -0
  235. /package/dist/{types/components → components}/ModalConfirmation/ModalStatusList.d.ts +0 -0
  236. /package/dist/{types/components → components}/ModalConfirmation/index.d.ts +0 -0
  237. /package/dist/{types/components → components}/Navigation/index.d.ts +0 -0
  238. /package/dist/{types/components → components}/Questions/SingleQuestion/index.d.ts +0 -0
  239. /package/dist/{types/components → components}/Questions/index.d.ts +0 -0
  240. /package/dist/{types/components → components}/ResponseType/index.d.ts +0 -0
  241. /package/dist/{types/components → components}/Separator/index.d.ts +0 -0
  242. /package/dist/{types/components → components}/Sidebar/index.d.ts +0 -0
  243. /package/dist/{types/components → components}/UserInfo/index.d.ts +0 -0
  244. /package/dist/{types/components → components}/index.d.ts +0 -0
  245. /package/dist/{types/constants → constants}/i18n.d.ts +0 -0
  246. /package/dist/{types/constants → constants}/logoCompanyHelper.d.ts +0 -0
  247. /package/dist/{types/constants → constants}/translationHelper.d.ts +0 -0
  248. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  249. /package/{public → dist}/index.ts +0 -0
@@ -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-webpack5";
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-webpack5";
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
- }