argous 1.2.247 → 1.3.3

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 (226) hide show
  1. package/dist/api/WebSocket.d.ts +18 -10
  2. package/dist/api/WebSocket.js +26 -18
  3. package/dist/api/index.js +54 -43
  4. package/dist/api/ws.d.ts +1 -1
  5. package/dist/api/ws.js +44 -3
  6. package/dist/components/Alert/Alert.js +17 -7
  7. package/dist/components/ArgousAction/ArgousAction.js +17 -7
  8. package/dist/components/ArgousAvatar/ArgousAvatar.d.ts +1 -1
  9. package/dist/components/ArgousAvatar/ArgousAvatar.js +44 -60
  10. package/dist/components/ArgousComplexPagination/ArgousComplexPagination.d.ts +1 -1
  11. package/dist/components/ArgousComplexPagination/ArgousComplexPagination.js +107 -81
  12. package/dist/components/ArgousComplexTable/ArgousComplexTable.d.ts +1 -1
  13. package/dist/components/ArgousComplexTable/ArgousComplexTable.js +39 -52
  14. package/dist/components/ArgousComplexTableBody/ArgousComplexTableBody.d.ts +1 -1
  15. package/dist/components/ArgousComplexTableBody/ArgousComplexTableBody.js +119 -97
  16. package/dist/components/ArgousComplexTableBody/DragAndDrop.d.ts +37 -0
  17. package/dist/components/ArgousComplexTableBody/DragAndDrop.js +156 -0
  18. package/dist/components/ArgousComplexTableHead/ArgousComplexTableHead.js +64 -47
  19. package/dist/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.js +55 -37
  20. package/dist/components/ArgousInput/ArgousInput.js +19 -9
  21. package/dist/components/ArgousPagination/ArgousPagination.js +18 -11
  22. package/dist/components/ArgousProgressBar/ArgousProgressBar.js +64 -74
  23. package/dist/components/ArgousSimpleTable/ArgousSimpleTable.js +28 -22
  24. package/dist/components/AutoComplete/AutoComplete.js +18 -9
  25. package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.d.ts +3 -4
  26. package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.js +226 -174
  27. package/dist/components/BarChart/BarChart.js +17 -7
  28. package/dist/components/BarraFerramentas/BarraFerramentas.js +119 -105
  29. package/dist/components/Button/Button.js +17 -7
  30. package/dist/components/Cabecalho/Cabecalho.js +17 -7
  31. package/dist/components/Calendar/Calendar.js +24 -41
  32. package/dist/components/Cam/Cam.js +19 -9
  33. package/dist/components/Carousel/Carousel.js +113 -103
  34. package/dist/components/CartaoUsuario/CartaoUsuario.js +36 -26
  35. package/dist/components/Collapse/Collapse.d.ts +3 -3
  36. package/dist/components/Collapse/Collapse.js +121 -71
  37. package/dist/components/Compartilhar/Compartilhar.js +70 -65
  38. package/dist/components/ConfirmModal/BasicModal.d.ts +1 -1
  39. package/dist/components/ConfirmModal/BasicModal.js +8 -8
  40. package/dist/components/ConfirmModal/ModalProvider.d.ts +12 -1
  41. package/dist/components/ConfirmModal/ModalProvider.js +17 -7
  42. package/dist/components/ConfirmModal/WrapperModal.d.ts +2 -2
  43. package/dist/components/ConfirmModal/WrapperModal.js +5 -5
  44. package/dist/components/ContactValidationInput/ContactValidationInput.d.ts +1 -1
  45. package/dist/components/ContactValidationInput/ContactValidationInput.js +105 -80
  46. package/dist/components/ContactValidationInput/SealModal.d.ts +1 -1
  47. package/dist/components/ContactValidationInput/SealModal.js +13 -20
  48. package/dist/components/Document/Icons.d.ts +2 -2
  49. package/dist/components/Document/Icons.js +33 -16
  50. package/dist/components/Document/ModalVisualizacaoDocumentos.d.ts +1 -1
  51. package/dist/components/Document/ModalVisualizacaoDocumentos.js +33 -17
  52. package/dist/components/Document/Visualizacao.d.ts +1 -1
  53. package/dist/components/Document/Visualizacao.js +48 -34
  54. package/dist/components/DropArea/DropArea.js +27 -12
  55. package/dist/components/DropArea/Html5FileSelector.js +6 -7
  56. package/dist/components/Editor/ScriptLoader2.d.ts +1 -1
  57. package/dist/components/Editor/ScriptLoader2.js +2 -2
  58. package/dist/components/Editor/Utils.d.ts +3 -3
  59. package/dist/components/Editor/Utils.js +2 -2
  60. package/dist/components/Editor/components/Editor.d.ts +1 -1
  61. package/dist/components/Editor/components/Editor.js +18 -9
  62. package/dist/components/Editor/components/EditorPropTypes.js +17 -7
  63. package/dist/components/FilePreparer/FilePreparer.d.ts +1 -1
  64. package/dist/components/FilePreparer/FilePreparer.js +105 -88
  65. package/dist/components/FileUploader/FileUploader.js +33 -22
  66. package/dist/components/FormVisualizer/FormVisualizer.d.ts +5 -7
  67. package/dist/components/FormVisualizer/FormVisualizer.js +92 -61
  68. package/dist/components/HalfGauge/HalfGauge.js +87 -135
  69. package/dist/components/Highlight/Highlight.js +23 -12
  70. package/dist/components/ImageResize/ImageResize.d.ts +1 -1
  71. package/dist/components/ImageResize/ImageResize.js +79 -85
  72. package/dist/components/ImageResizeButton/ImageResizeButton.d.ts +1 -1
  73. package/dist/components/ImageResizeButton/ImageResizeButton.js +19 -9
  74. package/dist/components/Input/Input.js +19 -9
  75. package/dist/components/InputTags/InputTags.js +22 -13
  76. package/dist/components/ListSelect/ListSelect.js +17 -7
  77. package/dist/components/MaterialButton/MaterialButton.d.ts +2 -4
  78. package/dist/components/MaterialButton/MaterialButton.js +56 -125
  79. package/dist/components/MenuBar/MenuBar.js +17 -7
  80. package/dist/components/MonthPicker/MonthPicker.js +20 -10
  81. package/dist/components/MultipleSelect/MultipleSelect.js +17 -7
  82. package/dist/components/OtpInput/OtpInput.d.ts +1 -1
  83. package/dist/components/OtpInput/OtpInput.js +71 -58
  84. package/dist/components/OutputText/OutputText.js +17 -7
  85. package/dist/components/Pagination/Pagination.js +17 -7
  86. package/dist/components/PercentageDisplay/PercentageDisplay.d.ts +1 -1
  87. package/dist/components/PercentageDisplay/PercentageDisplay.js +24 -92
  88. package/dist/components/Programa/PageCodeEasterEgg.d.ts +5 -4
  89. package/dist/components/Programa/PageCodeEasterEgg.js +41 -32
  90. package/dist/components/Programa/Programa.d.ts +2 -2
  91. package/dist/components/Programa/Programa.js +50 -28
  92. package/dist/components/Programa/Tab.d.ts +2 -2
  93. package/dist/components/Programa/TabNavigationRail.d.ts +3 -3
  94. package/dist/components/Programa/TabNavigationRail.js +13 -55
  95. package/dist/components/ProgressBar/ProgressBar.js +17 -7
  96. package/dist/components/Select/Select.js +17 -7
  97. package/dist/components/SimpleTable/SimpleTable.js +17 -7
  98. package/dist/components/Stepper/Stepper.d.ts +1 -1
  99. package/dist/components/Stepper/Stepper.js +194 -179
  100. package/dist/components/TablePicker/TablePicker.js +37 -12
  101. package/dist/components/Tabs/Tabs.js +17 -7
  102. package/dist/components/TextArea/TextArea.js +17 -7
  103. package/dist/components/TextToHtml/Cursor.d.ts +1 -1
  104. package/dist/components/TextToHtml/Cursor.js +17 -7
  105. package/dist/components/TextToHtml/TextStyles.d.ts +1 -1
  106. package/dist/components/TextToHtml/TextStyles.js +51 -44
  107. package/dist/components/TextToHtml/TextToHtml.js +37 -17
  108. package/dist/components/ThreadLog/ThreadLog.js +19 -9
  109. package/dist/components/UserCard/UserCard.js +36 -26
  110. package/dist/components/UtilAutoComplete/UtilAutoComplete.d.ts +3 -4
  111. package/dist/components/UtilAutoComplete/UtilAutoComplete.js +26 -16
  112. package/dist/components/UtilTextField/UtilTextField.d.ts +1 -1
  113. package/dist/components/UtilTextField/UtilTextField.js +26 -14
  114. package/dist/components/Zoom/Zoom.js +23 -24
  115. package/dist/fieldsRedux/createField.js +17 -7
  116. package/dist/fieldsRedux/fieldsRedux.js +19 -9
  117. package/dist/fieldsRedux/passFields.js +17 -7
  118. package/dist/reducers/index.d.ts +98 -2
  119. package/dist/utils/api.js +32 -15
  120. package/dist/utils/config.js +2 -3
  121. package/dist/utils/index.d.ts +3 -3
  122. package/dist/utils/index.js +68 -54
  123. package/dist/utils/store.js +2 -3
  124. package/lib/api/WebSocket.js +11 -12
  125. package/lib/api/index.js +14 -14
  126. package/lib/api/ws.js +48 -4
  127. package/lib/components/ArgousAvatar/ArgousAvatar.d.ts +1 -1
  128. package/lib/components/ArgousAvatar/ArgousAvatar.js +20 -54
  129. package/lib/components/ArgousComplexPagination/ArgousComplexPagination.d.ts +1 -1
  130. package/lib/components/ArgousComplexPagination/ArgousComplexPagination.js +50 -25
  131. package/lib/components/ArgousComplexTable/ArgousComplexTable.d.ts +1 -1
  132. package/lib/components/ArgousComplexTable/ArgousComplexTable.js +15 -15
  133. package/lib/components/ArgousComplexTableBody/ArgousComplexTableBody.d.ts +1 -1
  134. package/lib/components/ArgousComplexTableBody/ArgousComplexTableBody.js +121 -106
  135. package/lib/components/ArgousComplexTableBody/DragAndDrop.js +85 -0
  136. package/lib/components/ArgousComplexTableHead/ArgousComplexTableHead.js +60 -51
  137. package/lib/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.js +21 -12
  138. package/lib/components/ArgousInput/ArgousInput.js +2 -2
  139. package/lib/components/ArgousPagination/ArgousPagination.js +12 -4
  140. package/lib/components/ArgousProgressBar/ArgousProgressBar.js +67 -78
  141. package/lib/components/ArgousSimpleTable/ArgousSimpleTable.js +12 -18
  142. package/lib/components/AutoComplete/AutoComplete.js +2 -3
  143. package/lib/components/AutoCompleteFavorites/AutoCompleteFavorites.d.ts +3 -4
  144. package/lib/components/AutoCompleteFavorites/AutoCompleteFavorites.js +174 -108
  145. package/lib/components/BarraFerramentas/BarraFerramentas.js +32 -21
  146. package/lib/components/Calendar/Calendar.js +7 -42
  147. package/lib/components/Carousel/Carousel.js +42 -27
  148. package/lib/components/CartaoUsuario/CartaoUsuario.js +6 -6
  149. package/lib/components/Collapse/Collapse.d.ts +3 -3
  150. package/lib/components/Collapse/Collapse.js +92 -57
  151. package/lib/components/Compartilhar/Compartilhar.js +47 -46
  152. package/lib/components/ConfirmModal/BasicModal.tsx +1 -1
  153. package/lib/components/ConfirmModal/WrapperModal.tsx +2 -2
  154. package/lib/components/ContactValidationInput/ContactValidationInput.d.ts +1 -1
  155. package/lib/components/ContactValidationInput/ContactValidationInput.js +248 -213
  156. package/lib/components/ContactValidationInput/SealModal.js +38 -32
  157. package/lib/components/Document/Icons.js +14 -6
  158. package/lib/components/Document/ModalVisualizacaoDocumentos.js +9 -2
  159. package/lib/components/Document/Visualizacao.js +31 -25
  160. package/lib/components/DropArea/DropArea.js +9 -3
  161. package/lib/components/Editor/ScriptLoader2.ts +3 -3
  162. package/lib/components/Editor/Utils.ts +3 -3
  163. package/lib/components/Editor/components/Editor.tsx +1 -1
  164. package/lib/components/Editor/tinymce/README.md +73 -0
  165. package/lib/components/Editor/tinymce/langs/README.md +3 -0
  166. package/lib/components/Editor/tinymce/models/dom/model.min.js +1 -1
  167. package/lib/components/Editor/tinymce/plugins/accordion/plugin.min.js +1 -1
  168. package/lib/components/Editor/tinymce/plugins/autolink/plugin.min.js +1 -1
  169. package/lib/components/Editor/tinymce/plugins/autosave/plugin.min.js +1 -1
  170. package/lib/components/Editor/tinymce/plugins/charmap/plugin.min.js +1 -1
  171. package/lib/components/Editor/tinymce/plugins/codesample/plugin.min.js +1 -1
  172. package/lib/components/Editor/tinymce/plugins/directionality/plugin.min.js +1 -1
  173. package/lib/components/Editor/tinymce/plugins/fullscreen/plugin.min.js +1 -1
  174. package/lib/components/Editor/tinymce/plugins/help/plugin.min.js +1 -1
  175. package/lib/components/Editor/tinymce/plugins/image/plugin.min.js +1 -1
  176. package/lib/components/Editor/tinymce/plugins/link/plugin.min.js +1 -1
  177. package/lib/components/Editor/tinymce/plugins/lists/plugin.min.js +1 -1
  178. package/lib/components/Editor/tinymce/plugins/media/plugin.min.js +1 -1
  179. package/lib/components/Editor/tinymce/plugins/searchreplace/plugin.min.js +1 -1
  180. package/lib/components/Editor/tinymce/plugins/table/plugin.js +3 -3
  181. package/lib/components/Editor/tinymce/plugins/table/plugin.min.js +1 -1
  182. package/lib/components/Editor/tinymce/plugins/visualchars/plugin.min.js +1 -1
  183. package/lib/components/Editor/tinymce/themes/silver/theme.js +38 -38
  184. package/lib/components/Editor/tinymce/themes/silver/theme.min.js +1 -1
  185. package/lib/components/Editor/tinymce/tinymce.js +12 -12
  186. package/lib/components/Editor/tinymce/tinymce.min.js +1 -1
  187. package/lib/components/FilePreparer/FilePreparer.d.ts +1 -1
  188. package/lib/components/FilePreparer/FilePreparer.js +112 -108
  189. package/lib/components/FileUploader/FileUploader.js +8 -7
  190. package/lib/components/FormVisualizer/FormVisualizer.d.ts +5 -7
  191. package/lib/components/FormVisualizer/FormVisualizer.js +59 -46
  192. package/lib/components/HalfGauge/HalfGauge.js +87 -85
  193. package/lib/components/Highlight/Highlight.js +4 -4
  194. package/lib/components/ImageResize/ImageResize.d.ts +1 -1
  195. package/lib/components/ImageResize/ImageResize.js +123 -118
  196. package/lib/components/ImageResizeButton/ImageResizeButton.d.ts +1 -1
  197. package/lib/components/ImageResizeButton/ImageResizeButton.js +1 -1
  198. package/lib/components/Input/Input.js +2 -2
  199. package/lib/components/InputTags/InputTags.js +6 -7
  200. package/lib/components/MaterialButton/MaterialButton.d.ts +2 -4
  201. package/lib/components/MaterialButton/MaterialButton.js +50 -125
  202. package/lib/components/MonthPicker/MonthPicker.js +2 -2
  203. package/lib/components/OtpInput/OtpInput.tsx +77 -69
  204. package/lib/components/PercentageDisplay/PercentageDisplay.d.ts +1 -1
  205. package/lib/components/PercentageDisplay/PercentageDisplay.js +29 -54
  206. package/lib/components/Programa/PageCodeEasterEgg.js +41 -40
  207. package/lib/components/Programa/Programa.d.ts +2 -2
  208. package/lib/components/Programa/Programa.js +21 -5
  209. package/lib/components/Programa/Tab.ts +4 -2
  210. package/lib/components/Programa/TabNavigationRail.js +9 -31
  211. package/lib/components/Stepper/Stepper.d.ts +1 -1
  212. package/lib/components/Stepper/Stepper.js +222 -190
  213. package/lib/components/TablePicker/TablePicker.js +11 -6
  214. package/lib/components/TextToHtml/TextStyles.js +42 -42
  215. package/lib/components/TextToHtml/TextToHtml.js +102 -92
  216. package/lib/components/ThreadLog/ThreadLog.js +1 -1
  217. package/lib/components/UserCard/UserCard.js +6 -6
  218. package/lib/components/UtilAutoComplete/UtilAutoComplete.d.ts +3 -4
  219. package/lib/components/UtilAutoComplete/UtilAutoComplete.js +67 -9
  220. package/lib/components/UtilTextField/UtilTextField.d.ts +1 -1
  221. package/lib/components/UtilTextField/UtilTextField.js +18 -16
  222. package/lib/components/Zoom/Zoom.js +6 -3
  223. package/lib/utils/api.ts +1 -1
  224. package/lib/utils/index.ts +10 -8
  225. package/package.json +56 -56
  226. package/.gitlab-ci.yml +0 -21
@@ -1,10 +1,24 @@
1
- import { makeStyles, Toolbar, Typography, Select, InputBase, MenuItem, useTheme, IconButton, Box } from '@material-ui/core';
2
- import clsx from 'clsx';
1
+ import { Toolbar, Typography, Select, InputBase, MenuItem, useTheme, IconButton, Box, GlobalStyles } from '@mui/material';
2
+ import { clsx } from 'clsx';
3
3
  import React, { memo } from 'react';
4
4
  import { MdLastPage, MdFirstPage, MdKeyboardArrowRight, MdKeyboardArrowLeft } from 'react-icons/md';
5
5
 
6
- const useStyles = makeStyles(theme => ({
7
- pagination: {
6
+ const classes = {
7
+ pagination: 'argous-complex-pagination-pagination',
8
+ toolbar: 'argous-complex-pagination-toolbar',
9
+ spacer: 'argous-complex-pagination-spacer',
10
+ caption: 'argous-complex-pagination-caption',
11
+ selectRoot: 'argous-complex-pagination-select-root',
12
+ select: 'argous-complex-pagination-select',
13
+ selectIcon: 'argous-complex-pagination-select-icon',
14
+ input: 'argous-complex-pagination-input',
15
+ menuItem: 'argous-complex-pagination-menu-item',
16
+ actions: 'argous-complex-pagination-actions',
17
+ paginationActions: 'argous-complex-pagination-pagination-actions',
18
+ };
19
+
20
+ const paginationStyles = theme => ({
21
+ [`.${classes.pagination}`]: {
8
22
  display: 'flex',
9
23
  flexDirection: 'row-reverse',
10
24
  color: theme.palette.text.primary,
@@ -14,40 +28,42 @@ const useStyles = makeStyles(theme => ({
14
28
  padding: 0,
15
29
  },
16
30
  },
17
- toolbar: {
31
+ [`.${classes.toolbar}`]: {
18
32
  minHeight: 52,
19
33
  paddingRight: 2,
20
34
  },
21
- spacer: {
35
+ [`.${classes.spacer}`]: {
22
36
  flex: '1 1 100%',
23
37
  },
24
- caption: {
38
+ [`.${classes.caption}`]: {
25
39
  flexShrink: 0,
26
40
  },
27
- selectRoot: {
41
+ [`.${classes.selectRoot}`]: {
28
42
  marginRight: 32,
29
43
  marginLeft: 8,
30
44
  },
31
- select: {
45
+ [`.${classes.select}`]: {
32
46
  paddingLeft: 8,
33
47
  paddingRight: 24,
34
48
  textAlign: 'right',
35
49
  textAlignLast: 'right',
36
50
  },
37
- input: {
51
+ [`.${classes.selectIcon}`]: {},
52
+ [`.${classes.input}`]: {
38
53
  color: 'inherit',
39
54
  fontSize: 'inherit',
40
55
  flexShrink: 0,
41
56
  },
42
- actions: {
57
+ [`.${classes.menuItem}`]: {},
58
+ [`.${classes.actions}`]: {
43
59
  flexShrink: 0,
44
60
  marginLeft: 20,
45
61
  },
46
- paginationActions: {
62
+ [`.${classes.paginationActions}`]: {
47
63
  flexShrink: 0,
48
64
  marginLeft: theme.spacing(2.5),
49
65
  },
50
- }));
66
+ });
51
67
 
52
68
  const handleChangePgAtual = (value, pages) => {
53
69
  if (value < 1) return 0;
@@ -56,17 +72,22 @@ const handleChangePgAtual = (value, pages) => {
56
72
  };
57
73
 
58
74
  const DefaultLabelDisplayedRows = ({ pages, page, onChangePage, from, to, count, showCount }) => {
59
- return <React.Fragment>
60
- <Box padding='1px 0px' display='inline'>
61
- <InputBase inputProps={{ type: 'number', min: 1, max: pages || 1, value: page + 1 }} onChange={e => onChangePage(e, handleChangePgAtual(e.target.value, pages))} />
62
- {` / ${pages || 1}`}
63
- </Box>
64
- {showCount && <div style={{ display: 'inline', marginLeft: '10px', paddingLeft: '10px' }}>{from} a {to} de {count}</div>}
65
- </React.Fragment>;
75
+ return (
76
+ <React.Fragment>
77
+ <Box
78
+ sx={{
79
+ padding: '1px 0px',
80
+ display: 'inline'
81
+ }}>
82
+ <InputBase inputProps={{ type: 'number', min: 1, max: pages || 1, value: page + 1 }} onChange={e => onChangePage(e, handleChangePgAtual(e.target.value, pages))} />
83
+ {` / ${pages || 1}`}
84
+ </Box>
85
+ {showCount && <div style={{ display: 'inline', marginLeft: '10px', paddingLeft: '10px' }}>{from} a {to} de {count}</div>}
86
+ </React.Fragment>
87
+ );
66
88
  };
67
89
 
68
90
  const TablePaginationActions = memo(({ count, page, rowsPerPage, onChangePage }) => {
69
- const classes = useStyles();
70
91
  const theme = useTheme();
71
92
  const handleFirstPageButtonClick = e => onChangePage(e, 0);
72
93
  const handleBackButtonClick = e => onChangePage(e, page - 1);
@@ -117,14 +138,16 @@ const ArgousComplexPagination = memo(({
117
138
  SelectProps = {},
118
139
  showCount
119
140
  }) => {
120
- const classes = useStyles();
121
141
  const MenuItemComponent = SelectProps.native ? 'option' : MenuItem;
122
142
  return (
123
143
  <div className={clsx(classes.pagination, className)}>
144
+ <GlobalStyles styles={paginationStyles} />
124
145
  <Toolbar className={classes.toolbar}>
125
146
  <div className={classes.spacer} />
126
147
  {rowsPerPageOptions.length > 1 && (
127
- <Typography color='inherit' variant='body2' className={classes.caption}>
148
+ <Typography variant='body2' className={classes.caption} sx={{
149
+ color: 'inherit'
150
+ }}>
128
151
  {labelRowsPerPage}
129
152
  </Typography>
130
153
  )}
@@ -150,7 +173,9 @@ const ArgousComplexPagination = memo(({
150
173
  ))}
151
174
  </Select>
152
175
  )}
153
- <Typography color='inherit' variant='body2' component='div' className={classes.caption}>
176
+ <Typography variant='body2' component='div' className={classes.caption} sx={{
177
+ color: 'inherit'
178
+ }}>
154
179
  <LabelDisplayedRows {...{
155
180
  pages: Math.ceil(count / parseInt(rowsPerPage, 10)),
156
181
  from: count === 0 ? 0 : page * rowsPerPage + 1,
@@ -179,4 +204,4 @@ const ArgousComplexPagination = memo(({
179
204
  );
180
205
  });
181
206
 
182
- export default ArgousComplexPagination;
207
+ export default ArgousComplexPagination;
@@ -2,7 +2,7 @@ import { ArgousComplexPaginationPrivateProps, ArgousComplexPaginationProps } fro
2
2
  import { ArgousComplexTableBodyPrivateProps, ArgousComplexTableBodyProps } from '../ArgousComplexTableBody/ArgousComplexTableBody';
3
3
  import { ArgousComplexTableHeadPrivateProps, ArgousComplexTableHeadProps } from '../ArgousComplexTableHead/ArgousComplexTableHead';
4
4
  import { ArgousComplexTableToolBarPrivateProps, ArgousComplexTableToolBarProps } from '../ArgousComplexTableToolbar/ArgousComplexTableToolBar';
5
- import { TableContainerProps, TableProps } from '@material-ui/core';
5
+ import { TableContainerProps, TableProps } from '@mui/material';
6
6
  import React from 'react';
7
7
 
8
8
  export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, ArgousComplexPaginationProps, ArgousComplexPaginationProps, ArgousComplexTableHeadProps, ArgousComplexTableToolBarProps {
@@ -1,23 +1,22 @@
1
1
  import { ArgousComplexPagination, ArgousComplexTableHead, ArgousComplexTableToolbar, ArgousComplexTableBody } from '../';
2
2
  import { getField } from '../../fieldsRedux';
3
3
  import { serverAction } from '../../utils/api';
4
- import { Table, TableContainer, Paper, ClickAwayListener, makeStyles } from '@material-ui/core';
5
- import clsx from 'clsx';
4
+ import { Table, TableContainer, Paper, ClickAwayListener } from '@mui/material';
6
5
  import { isArray, isEqual, isFunction } from 'lodash';
7
6
  import moment from 'moment';
8
7
  import PropTypes from 'prop-types';
9
8
  import React, { useState, useEffect, forwardRef, useImperativeHandle, useMemo, createContext, useReducer, useCallback, memo } from 'react';
10
9
 
11
- const useStyles = makeStyles({
12
- root: {
13
- '& [class*="smooth-dnd-container"]': {
14
- display: 'table-row-group'
15
- },
16
- '& [class*="smooth-dnd-draggable-wrapper"]': {
17
- display: 'table-row !important'
18
- }
10
+ const rootSx = {
11
+ '& [class*="smooth-dnd-container"]': {
12
+ display: 'table-row-group'
13
+ },
14
+ '& [class*="smooth-dnd-draggable-wrapper"]': {
15
+ display: 'table-row !important'
19
16
  }
20
- });
17
+ };
18
+
19
+ const normalizeSx = sx => sx ? (Array.isArray(sx) ? sx : [sx]) : [];
21
20
 
22
21
  export const TableContext = createContext();
23
22
 
@@ -181,7 +180,6 @@ const ArgousComplexTable = forwardRef(({
181
180
  token = ''
182
181
  }, ref) => {
183
182
 
184
- const classes = useStyles();
185
183
  const [state, dispatch] = useReducer(reducer, initialState(defaultRowsPerPage));
186
184
  const memoState = useMemo(() => ({ ...state, dispatch }), [state, dispatch]);
187
185
  const { selected, page, rowsPerPage, order, orderBy, filter, open } = memoState;
@@ -285,7 +283,9 @@ const ArgousComplexTable = forwardRef(({
285
283
  }
286
284
  }, [page, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, method, field, externalCtrlPgn, dispatch]);
287
285
 
288
- useEffect(() => dispatch({ type: 'setSelected', value: [] }), [lista]);
286
+ useEffect(() => {
287
+ dispatch({ type: 'setSelected', value: [] });
288
+ }, [lista]);
289
289
 
290
290
  useEffect(() => {
291
291
  if (onSelect) onSelect(selected);
@@ -354,7 +354,7 @@ const ArgousComplexTable = forwardRef(({
354
354
  return (
355
355
  <TableContext.Provider value={{ ...memoState, dadosMostrados, lista, indexToSelect, method, externalCtrlPgn }}>
356
356
  <ClickAwayListener onClickAway={onClickAway}>
357
- <TableContainer component={Paper} variant='outlined' style={style} {...containerProps} className={clsx(classes.root, className)}>
357
+ <TableContainer component={Paper} variant='outlined' style={style} {...containerProps} className={className} sx={[rootSx, ...normalizeSx(containerProps?.sx)]}>
358
358
  <ToolbarComponent
359
359
  numSelected={selected.length}
360
360
  disableFilter={disableFilter || !!method || !!externalCtrlPgn}
@@ -433,4 +433,4 @@ ArgousComplexTable.propTypes = {
433
433
  setExternalCtrlPgn: PropTypes.func
434
434
  };
435
435
 
436
- export default memo(ArgousComplexTable, isEqual);
436
+ export default memo(ArgousComplexTable, isEqual);
@@ -1,4 +1,4 @@
1
- import { TableCellBaseProps, TableRowProps } from '@material-ui/core';
1
+ import { TableCellBaseProps, TableRowProps } from '@mui/material';
2
2
  import * as React from 'react';
3
3
 
4
4
  export declare interface ChildrenFunction {
@@ -1,32 +1,44 @@
1
1
  import { TableContext } from '../ArgousComplexTable/ArgousComplexTable';
2
- import { TableBody, TableRow, Checkbox, Collapse, TableCell, makeStyles, Typography, CircularProgress, alpha, Tooltip, IconButton } from '@material-ui/core';
3
- import clsx from 'clsx';
2
+ import { TableBody, TableRow, Checkbox, Collapse, TableCell, Typography, CircularProgress, Tooltip, IconButton, GlobalStyles } from '@mui/material';
3
+ import { alpha } from '@mui/material/styles';
4
+ import { clsx } from 'clsx';
4
5
  import { isArray } from 'lodash';
5
6
  import React, { Fragment, useContext, memo } from 'react';
6
7
  import { MdDragHandle } from 'react-icons/md';
7
- import { Container, Draggable } from 'react-trello/dist/';
8
+ import { Container, Draggable } from './DragAndDrop';
8
9
 
9
- const useStyles = makeStyles(theme => ({
10
- dragHandle: {
10
+ const classes = {
11
+ dragHandle: 'argous-complex-table-body-drag-handle',
12
+ hover: 'argous-complex-table-body-hover',
13
+ open: 'argous-complex-table-body-open',
14
+ semDados: 'argous-complex-table-body-sem-dados',
15
+ group: 'argous-complex-table-body-group',
16
+ loading: 'argous-complex-table-body-loading',
17
+ ghost: 'argous-complex-table-body-ghost',
18
+ tableCell: 'argous-complex-table-body-table-cell',
19
+ };
20
+
21
+ const tableBodyStyles = theme => ({
22
+ [`.${classes.dragHandle}`]: {
11
23
  cursor: 'n-resize'
12
24
  },
13
- hover: {
25
+ [`.${classes.hover}`]: {
14
26
  '&:hover': {
15
27
  backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.selectedOpacity * 2)
16
28
  }
17
29
  },
18
- open: {
30
+ [`.${classes.open}`]: {
19
31
  backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),
20
32
  '&:hover': {
21
33
  backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity * 2),
22
34
  }
23
35
  },
24
- semDados: {
36
+ [`.${classes.semDados}`]: {
25
37
  padding: theme.spacing(1),
26
38
  paddingLeft: theme.spacing(2),
27
39
  fontSize: '1rem',
28
40
  },
29
- group: {
41
+ [`.${classes.group}`]: {
30
42
  '&>td': {
31
43
  padding: '0px',
32
44
  // '&:hover':{
@@ -34,33 +46,33 @@ const useStyles = makeStyles(theme => ({
34
46
  // }
35
47
  }
36
48
  },
37
- loading: {
49
+ [`.${classes.loading}`]: {
38
50
  textAlign: 'center',
39
51
  padding: '7px'
40
52
  },
41
- ghost: {
53
+ [`.${classes.ghost}`]: {
42
54
  borderBottom: '1px solid #0000',
43
55
  userSelect: 'none',
44
56
  '&:hover': {
45
57
  backgroundColor: '#0000 !important'
46
58
  }
47
59
  },
48
- tableCell: {
60
+ [`.${classes.tableCell}`]: {
49
61
  overflow: 'hidden',
50
62
  whiteSpace: 'nowrap',
51
63
  textOverflow: 'ellipsis'
52
64
  }
53
- }));
65
+ });
54
66
 
55
67
  const ArgousComplexTableBody = memo(({
56
- children,
57
- line,
68
+ children,
69
+ line,
58
70
  lineStyle,
59
71
  handleOpenClose,
60
72
  lineClass,
61
73
  enableCheck,
62
74
  disableCheckIf,
63
- columnStyles,
75
+ columnStyles,
64
76
  head,
65
77
  onClick,
66
78
  onDoubleClick,
@@ -75,8 +87,6 @@ const ArgousComplexTableBody = memo(({
75
87
  enableDrag,
76
88
  onDrop
77
89
  }) => {
78
- const classes = useStyles();
79
-
80
90
  const { lista, selected, dispatch, loading } = useContext(TableContext);
81
91
 
82
92
  const handleClick = name => {
@@ -103,98 +113,103 @@ const ArgousComplexTableBody = memo(({
103
113
  };
104
114
 
105
115
  return (
106
- <Container dragHandleSelector={`.${classes.dragHandle}`} onDrop={onDrop} render={containerRef => (
107
- <TableBody innerRef={containerRef} /*component={Container} dragHandleSelector={`.${classes.dragHandle}`} onDrop={onDrop}*/>
108
- {loading ? (
109
- <TableRow><TableCell className={classes.loading} colSpan={dadosMostrados?.length && line(dadosMostrados[0])?.length + (enableCheck ? 1 : 0) + (enableDrag ? 1 : 0)}><CircularProgress disableShrink/></TableCell></TableRow>
110
- ) : dadosMostrados.length ? dadosMostrados.map((linha, i) => {
116
+ <>
117
+ <GlobalStyles styles={tableBodyStyles} />
118
+ <Container dragHandleSelector={`.${classes.dragHandle}`} onDrop={onDrop} render={containerRef => (
119
+ <TableBody ref={containerRef} /*component={Container} dragHandleSelector={`.${classes.dragHandle}`} onDrop={onDrop}*/>
120
+ {loading ? (
121
+ <TableRow><TableCell className={classes.loading} colSpan={dadosMostrados?.length && line(dadosMostrados[0])?.length + (enableCheck ? 1 : 0) + (enableDrag ? 1 : 0)}><CircularProgress disableShrink/></TableCell></TableRow>
122
+ ) : dadosMostrados.length ? dadosMostrados.map((linha, i) => {
111
123
 
112
- const isItemSelected = isSelected(linha[indexToSelect]);
113
- const isItemOpen = i === open;
114
- const ghostRow = (isArray(linha)) ? !linha.some((value) => !!value) : false;
115
- const { title, ...rowProperties } = rowProps({ index: i, linhaOriginal: linha, linhaFormatada: line(linha), itensSelecionados: selected }) || {};
124
+ const isItemSelected = isSelected(linha[indexToSelect]);
125
+ const isItemOpen = i === open;
126
+ const ghostRow = (isArray(linha)) ? !linha.some((value) => !!value) : false;
127
+ const { title, ...rowProperties } = rowProps({ index: i, linhaOriginal: linha, linhaFormatada: line(linha), itensSelecionados: selected }) || {};
116
128
 
117
129
 
118
- return <Draggable key={customKey ? lista[i][customKey] : i} render={draggableRef => (
119
- //TODO criar proprio draggable pois esse remove classes do filho
120
- <Fragment>
121
- <CustomTooltip title={(ghostRow) ? '' : (lineTitle || title)}>
122
- <TableRow
123
- component={Draggable}
124
- {...rowProperties}
125
- className={
126
- clsx(
127
- {
128
- [classes.hover]: isItemSelected,
129
- [classes.open]: (isItemOpen && !!children),
130
- [classes.ghost]: ghostRow
131
- },
132
- (ghostRow) ? '' : lineClass(line(linha), linha, i),
133
- rowProperties.className
134
- )
135
- }
136
- hover
137
- role='checkbox'
138
- tabIndex={-1}
139
- selected={isItemSelected}
140
- style={(lineStyle && !ghostRow) ? lineStyle(linha, line(linha), i) : undefined}
141
- onClick={(ghostRow) ? undefined : (onClick) ? e => onClick(e, linha, line(linha), i) : (children) ? () => handleOpenClose(i) : undefined}
142
- onDoubleClick={(ghostRow) ? undefined : (onDoubleClick) ? e => onDoubleClick(e, linha, line(linha), i) : undefined}
143
- innerRef={draggableRef}
144
- >
145
- {enableDrag && <TableCell padding='checkbox'>
146
- <Tooltip title='Arrastar'>
147
- <IconButton size='small' className={classes.dragHandle}>
148
- <MdDragHandle/>
149
- </IconButton>
150
- </Tooltip>
151
- </TableCell>}
152
- {(enableCheck) && (
153
- <TableCell padding='checkbox' className={clsx({ [classes.ghost]: ghostRow })}>
154
- {(!ghostRow) && (
155
- <Checkbox
156
- checked={isItemSelected}
157
- disabled={(disableCheckIf) && disableCheckIf(linha, line(linha), i)}
158
- onClick={(event) => {
159
- event.stopPropagation();
160
- handleClick(linha[indexToSelect]);
161
- }}
162
- />
130
+ return (
131
+ <Draggable key={customKey ? lista[i][customKey] : i} render={draggableRef => (
132
+ //TODO criar proprio draggable pois esse remove classes do filho
133
+ (<Fragment>
134
+ <CustomTooltip title={(ghostRow) ? '' : (lineTitle || title)}>
135
+ <TableRow
136
+ component={Draggable}
137
+ {...rowProperties}
138
+ className={
139
+ clsx(
140
+ {
141
+ [classes.hover]: isItemSelected,
142
+ [classes.open]: (isItemOpen && !!children),
143
+ [classes.ghost]: ghostRow
144
+ },
145
+ (ghostRow) ? '' : lineClass(line(linha), linha, i),
146
+ rowProperties.className
147
+ )
148
+ }
149
+ hover
150
+ role='checkbox'
151
+ tabIndex={-1}
152
+ selected={isItemSelected}
153
+ style={(lineStyle && !ghostRow) ? lineStyle(linha, line(linha), i) : undefined}
154
+ onClick={(ghostRow) ? undefined : (onClick) ? e => onClick(e, linha, line(linha), i) : (children) ? () => handleOpenClose(i) : undefined}
155
+ onDoubleClick={(ghostRow) ? undefined : (onDoubleClick) ? e => onDoubleClick(e, linha, line(linha), i) : undefined}
156
+ ref={draggableRef}
157
+ >
158
+ {enableDrag && <TableCell padding='checkbox'>
159
+ <Tooltip title='Arrastar'>
160
+ <IconButton size='small' className={classes.dragHandle}>
161
+ <MdDragHandle/>
162
+ </IconButton>
163
+ </Tooltip>
164
+ </TableCell>}
165
+ {(enableCheck) && (
166
+ <TableCell padding='checkbox' className={clsx({ [classes.ghost]: ghostRow })}>
167
+ {(!ghostRow) && (
168
+ <Checkbox
169
+ checked={isItemSelected}
170
+ disabled={(disableCheckIf) && disableCheckIf(linha, line(linha), i)}
171
+ onClick={(event) => {
172
+ event.stopPropagation();
173
+ handleClick(linha[indexToSelect]);
174
+ }}
175
+ />
176
+ )}
177
+ </TableCell>
163
178
  )}
164
- </TableCell>
165
- )}
166
- {isArray(line(linha)) && line(linha).map((coluna, j) => (
167
- (ghostRow) ? (
168
- <TableCell key={j} className={clsx(classes.tableCell, classes.ghost)}>
169
- &nbsp;
170
- </TableCell>
171
- ) : (
172
- <TableCell
173
- key={j}
174
- {...columnProps(j, coluna, linha, line(linha))}
175
- style={columnStyles ? columnStyles[j] : undefined}
176
- className={classes.tableCell}
177
- >
178
- {getCellContent(coluna, dadosMostrados[i], j, i)}
179
+ {isArray(line(linha)) && line(linha).map((coluna, j) => (
180
+ (ghostRow) ? (
181
+ <TableCell key={j} className={clsx(classes.tableCell, classes.ghost)}>
182
+ &nbsp;
183
+ </TableCell>
184
+ ) : (
185
+ <TableCell
186
+ key={j}
187
+ {...columnProps(j, coluna, linha, line(linha))}
188
+ style={columnStyles ? columnStyles[j] : undefined}
189
+ className={classes.tableCell}
190
+ >
191
+ {getCellContent(coluna, dadosMostrados[i], j, i)}
192
+ </TableCell>
193
+ )
194
+ ))}
195
+ </TableRow>
196
+ </CustomTooltip>
197
+ {children && (
198
+ <TableRow className={classes.group}>
199
+ <TableCell colSpan={dadosMostrados?.length && line(dadosMostrados[0])?.length + (enableCheck ? 1 : 0) + (enableDrag ? 1 : 0)} style={{ padding: open === i ? 8 : 0 }} className='argous-complex-table-group-cell'>
200
+ <Collapse in={open === i} mountOnEnter unmountOnExit>
201
+ {typeof children === 'function' ? children({ linha: line(linha), linhaOriginal: linha, index: i }) : children}
202
+ </Collapse>
179
203
  </TableCell>
180
- )
181
- ))}
182
- </TableRow>
183
- </CustomTooltip>
184
- {children && (
185
- <TableRow className={classes.group}>
186
- <TableCell colSpan={dadosMostrados?.length && line(dadosMostrados[0])?.length + (enableCheck ? 1 : 0) + (enableDrag ? 1 : 0)} style={{ padding: open === i ? 8 : 0 }} className='argous-complex-table-group-cell'>
187
- <Collapse in={open === i} mountOnEnter unmountOnExit>
188
- {typeof children === 'function' ? children({ linha: line(linha), linhaOriginal: linha, index: i }) : children}
189
- </Collapse>
190
- </TableCell>
191
- </TableRow>
192
- )}
193
- </Fragment>
194
- )}/>;
195
- }) : <TableRow><Typography className={classes.semDados} component='td' variant='h6' colSpan={head.length + (enableCheck ? 1 : 0)}>Nenhum dado a ser exibido</Typography></TableRow> }
196
- </TableBody>
197
- )}/>
204
+ </TableRow>
205
+ )}
206
+ </Fragment>)
207
+ )}/>
208
+ );
209
+ }) : <TableRow><Typography className={classes.semDados} component='td' variant='h6' colSpan={head.length + (enableCheck ? 1 : 0)}>Nenhum dado a ser exibido</Typography></TableRow> }
210
+ </TableBody>
211
+ )}/>
212
+ </>
198
213
  );
199
214
  });
200
215
 
@@ -205,4 +220,4 @@ export const CustomTooltip = ({ title, children }) => {
205
220
  {children}
206
221
  </Tooltip>;
207
222
  return children;
208
- };
223
+ };
@@ -0,0 +1,85 @@
1
+ import PropTypes from 'prop-types';
2
+ import React, { Component } from 'react';
3
+ import smoothDnD, { constants, dropHandlers } from 'trello-smooth-dnd';
4
+
5
+ smoothDnD.dropHandler = dropHandlers.reactDropHandler().handler;
6
+ smoothDnD.wrapChild = child => child;
7
+
8
+ export class Container extends Component {
9
+ componentDidMount() {
10
+ this.previousContainer = this.containerElement;
11
+ this.container = smoothDnD(this.containerElement, this.getContainerOptions());
12
+ }
13
+
14
+ componentDidUpdate() {
15
+ if (this.previousContainer && this.previousContainer !== this.containerElement) {
16
+ this.container.dispose();
17
+ this.container = smoothDnD(this.containerElement, this.getContainerOptions());
18
+ this.previousContainer = this.containerElement;
19
+ }
20
+ }
21
+
22
+ componentWillUnmount() {
23
+ this.container.dispose();
24
+ }
25
+
26
+ setRef = element => {
27
+ this.containerElement = element;
28
+ };
29
+
30
+ getContainerOptions = () => {
31
+ const functionProps = {};
32
+ const callbacks = [
33
+ 'onDragStart',
34
+ 'onDragEnd',
35
+ 'onDrop',
36
+ 'getChildPayload',
37
+ 'shouldAnimateDrop',
38
+ 'shouldAcceptDrop',
39
+ 'onDragEnter',
40
+ 'onDragLeave',
41
+ 'render',
42
+ 'onDropReady',
43
+ 'getGhostParent'
44
+ ];
45
+
46
+ callbacks.forEach(callback => {
47
+ if (this.props[callback]) {
48
+ functionProps[callback] = (...parameters) => this.props[callback](...parameters);
49
+ }
50
+ });
51
+
52
+ return { ...this.props, ...functionProps };
53
+ };
54
+
55
+ render() {
56
+ if (this.props.render) {
57
+ return this.props.render(this.setRef);
58
+ }
59
+
60
+ return <div style={this.props.style} ref={this.setRef}>{this.props.children}</div>;
61
+ }
62
+ }
63
+
64
+ Container.propTypes = {
65
+ children: PropTypes.node,
66
+ render: PropTypes.func,
67
+ style: PropTypes.object
68
+ };
69
+
70
+ export class Draggable extends Component {
71
+ render() {
72
+ if (this.props.render) {
73
+ return React.cloneElement(this.props.render(), { className: constants.wrapperClass });
74
+ }
75
+
76
+ const className = `${this.props.className ? `${this.props.className} ` : ''}${constants.wrapperClass}`;
77
+ return <div {...this.props} className={className}>{this.props.children}</div>;
78
+ }
79
+ }
80
+
81
+ Draggable.propTypes = {
82
+ children: PropTypes.node,
83
+ className: PropTypes.string,
84
+ render: PropTypes.func
85
+ };