@portnet/ui 3.1.6 → 4.0.1
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/dist/components/buttons/PuiButton.js +96 -103
- package/dist/components/common/StyledMuiButton.js +3 -5
- package/dist/components/common/StyledMuiTextField.js +103 -59
- package/dist/components/inputs/PuiDateField.js +176 -52
- package/dist/components/inputs/PuiDateTimeField.js +204 -195
- package/dist/components/inputs/PuiSelect.js +124 -82
- package/dist/components/others/DateTimePickerField.js +210 -0
- package/dist/components/others/PuiSection.js +88 -31
- package/dist/components/referentiel/components/PuiSpecificReferentielField.js +6 -24
- package/dist/components/table/PuiTable.js +124 -50
- package/dist/components/table/PuiTableAction.js +12 -2
- package/dist/components/typography/PuiMainTitle.js +124 -35
- package/dist/components/ui/pages/general/PuiSearchPage.js +56 -34
- package/dist/config/apperance.js +13 -95
- package/dist/index.js +0 -42
- package/package.json +20 -25
- package/dist/components/providers/PuiAntdProvider.js +0 -70
- package/dist/components/providers/PuiThemeProvider.js +0 -230
- package/dist/components/stepper/PuiStepContent.js +0 -66
- package/dist/components/stepper/PuiStepper.js +0 -184
- package/dist/components/stepper/PuiStepperActions.js +0 -105
- package/dist/components/table/PuiModernTable.js +0 -541
- package/dist/components-antd-optional/PuiAntdForm.js +0 -328
- package/dist/components-antd-optional/PuiAntdStepper.js +0 -317
- package/dist/components-antd-optional/PuiAntdTable.js +0 -352
- package/dist/config/antdTheme.js +0 -227
- package/dist/hooks/useCustomAxios.js +0 -36
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
4
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
11
|
-
var _react = _interopRequireDefault(require("react"));
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var _material = require("@mui/material");
|
|
14
|
-
var _styles = require("@mui/material/styles");
|
|
15
|
-
var _apperance = require("../../config/apperance");
|
|
16
|
-
var _PuiButton = _interopRequireDefault(require("../buttons/PuiButton"));
|
|
17
|
-
var _iconsMaterial = require("@mui/icons-material");
|
|
18
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["title", "data", "columns", "actions", "loading", "pagination", "currentPage", "totalPages", "onPageChange", "emptyMessage", "className"]; // Container principal du tableau moderne
|
|
20
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
27
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
28
|
-
const ModernTableContainer = (0, _styles.styled)(_material.Box)(() => ({
|
|
29
|
-
display: 'flex',
|
|
30
|
-
flexDirection: 'column',
|
|
31
|
-
gap: '16px',
|
|
32
|
-
padding: '24px',
|
|
33
|
-
backgroundColor: _apperance.palette.background.default,
|
|
34
|
-
borderRadius: '12px',
|
|
35
|
-
minHeight: '400px'
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
// Header du tableau
|
|
39
|
-
const TableHeader = (0, _styles.styled)(_material.Box)(() => ({
|
|
40
|
-
display: 'flex',
|
|
41
|
-
justifyContent: 'space-between',
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
marginBottom: '16px',
|
|
44
|
-
borderBottom: "2px solid ".concat(_apperance.palette.border.light),
|
|
45
|
-
paddingBottom: '16px'
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
// Conteneur des cartes
|
|
49
|
-
const CardsContainer = (0, _styles.styled)(_material.Box)(() => ({
|
|
50
|
-
display: 'flex',
|
|
51
|
-
flexDirection: 'column',
|
|
52
|
-
gap: '12px',
|
|
53
|
-
flex: 1
|
|
54
|
-
}));
|
|
55
|
-
|
|
56
|
-
// Card individuelle pour chaque ligne
|
|
57
|
-
const TableCard = (0, _styles.styled)(_material.Box)(() => ({
|
|
58
|
-
display: 'flex',
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
justifyContent: 'space-between',
|
|
61
|
-
padding: '16px 20px',
|
|
62
|
-
backgroundColor: _apperance.palette.background.paper,
|
|
63
|
-
borderRadius: '8px',
|
|
64
|
-
border: "1px solid ".concat(_apperance.palette.border.light),
|
|
65
|
-
boxShadow: _apperance.palette.shadow.card,
|
|
66
|
-
transition: 'all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)',
|
|
67
|
-
position: 'relative',
|
|
68
|
-
cursor: 'pointer',
|
|
69
|
-
'&:hover': {
|
|
70
|
-
transform: 'translateY(-2px)',
|
|
71
|
-
boxShadow: _apperance.palette.shadow.medium,
|
|
72
|
-
borderColor: "".concat(_apperance.palette.primary, "40"),
|
|
73
|
-
backgroundColor: "".concat(_apperance.palette.primary, "02"),
|
|
74
|
-
// Afficher les actions de cette ligne spécifique au survol
|
|
75
|
-
'& .actions-section': {
|
|
76
|
-
opacity: 1,
|
|
77
|
-
transform: 'translate(-50%, -50%)',
|
|
78
|
-
transitionDelay: '0.1s'
|
|
79
|
-
},
|
|
80
|
-
// Masquer l'indicateur de points au survol
|
|
81
|
-
'& .actions-section::before': {
|
|
82
|
-
opacity: 0
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
// Responsive
|
|
86
|
-
'@media (max-width: 768px)': {
|
|
87
|
-
flexDirection: 'column',
|
|
88
|
-
alignItems: 'stretch',
|
|
89
|
-
gap: '12px',
|
|
90
|
-
cursor: 'default',
|
|
91
|
-
'&:hover': {
|
|
92
|
-
transform: 'none' // Pas d'effet de survol sur mobile
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
96
|
-
|
|
97
|
-
// Section des données dans la card
|
|
98
|
-
const DataSection = (0, _styles.styled)(_material.Box)(() => ({
|
|
99
|
-
display: 'flex',
|
|
100
|
-
alignItems: 'center',
|
|
101
|
-
gap: '24px',
|
|
102
|
-
flex: 1,
|
|
103
|
-
transition: 'all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)',
|
|
104
|
-
// Indicateur subtil d'actions disponibles
|
|
105
|
-
'.MuiBox-root:hover &': {
|
|
106
|
-
opacity: 0.7
|
|
107
|
-
},
|
|
108
|
-
'@media (max-width: 768px)': {
|
|
109
|
-
flexDirection: 'column',
|
|
110
|
-
alignItems: 'stretch',
|
|
111
|
-
gap: '8px'
|
|
112
|
-
}
|
|
113
|
-
}));
|
|
114
|
-
|
|
115
|
-
// Colonne de données
|
|
116
|
-
const DataColumn = (0, _styles.styled)(_material.Box)(() => ({
|
|
117
|
-
display: 'flex',
|
|
118
|
-
flexDirection: 'column',
|
|
119
|
-
gap: '2px',
|
|
120
|
-
minWidth: '0',
|
|
121
|
-
flex: 1
|
|
122
|
-
}));
|
|
123
|
-
|
|
124
|
-
// Label de colonne
|
|
125
|
-
const ColumnLabel = (0, _styles.styled)(_material.Typography)(() => ({
|
|
126
|
-
fontSize: '12px',
|
|
127
|
-
fontWeight: 600,
|
|
128
|
-
color: "#293854",
|
|
129
|
-
// Couleur bleu marine pour les en-têtes
|
|
130
|
-
textTransform: 'none',
|
|
131
|
-
letterSpacing: '0.3px'
|
|
132
|
-
}));
|
|
133
|
-
|
|
134
|
-
// Valeur de colonne
|
|
135
|
-
const ColumnValue = (0, _styles.styled)(_material.Typography)(() => ({
|
|
136
|
-
fontSize: '14px',
|
|
137
|
-
fontWeight: 500,
|
|
138
|
-
color: _apperance.palette.dark,
|
|
139
|
-
wordBreak: 'break-word'
|
|
140
|
-
}));
|
|
141
|
-
|
|
142
|
-
// Section des actions avec effet de survol
|
|
143
|
-
const ActionsSection = (0, _styles.styled)(_material.Box)(() => ({
|
|
144
|
-
display: 'flex',
|
|
145
|
-
alignItems: 'center',
|
|
146
|
-
justifyContent: 'center',
|
|
147
|
-
gap: '8px',
|
|
148
|
-
flexShrink: 0,
|
|
149
|
-
opacity: 0,
|
|
150
|
-
transform: 'translateX(10px)',
|
|
151
|
-
transition: 'all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)',
|
|
152
|
-
position: 'absolute',
|
|
153
|
-
top: '50%',
|
|
154
|
-
left: '50%',
|
|
155
|
-
transform: 'translate(-50%, -50%)',
|
|
156
|
-
zIndex: 10,
|
|
157
|
-
// Les actions restent toujours cachées, même au hover direct
|
|
158
|
-
// Elles ne s'affichent que via le hover de la card parent
|
|
159
|
-
|
|
160
|
-
// Indicateur subtil d'actions disponibles (icône menu)
|
|
161
|
-
'&::before': {
|
|
162
|
-
content: '""',
|
|
163
|
-
position: 'absolute',
|
|
164
|
-
right: '8px',
|
|
165
|
-
top: '50%',
|
|
166
|
-
transform: 'translateY(-50%)',
|
|
167
|
-
width: '4px',
|
|
168
|
-
height: '4px',
|
|
169
|
-
borderRadius: '50%',
|
|
170
|
-
backgroundColor: _apperance.palette.gray[400],
|
|
171
|
-
opacity: 1,
|
|
172
|
-
transition: 'opacity 0.3s ease',
|
|
173
|
-
boxShadow: "\n 0 6px 0 ".concat(_apperance.palette.gray[400], ",\n 0 12px 0 ").concat(_apperance.palette.gray[400], "\n ")
|
|
174
|
-
},
|
|
175
|
-
'.MuiBox-root:hover &::before': {
|
|
176
|
-
opacity: 0
|
|
177
|
-
},
|
|
178
|
-
'@media (max-width: 768px)': {
|
|
179
|
-
justifyContent: 'center',
|
|
180
|
-
opacity: 0,
|
|
181
|
-
// Reste caché même sur mobile
|
|
182
|
-
transform: 'translate(-50%, -50%)',
|
|
183
|
-
'&::before': {
|
|
184
|
-
display: 'none' // Pas d'indicateur sur mobile
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}));
|
|
188
|
-
|
|
189
|
-
// Footer avec pagination
|
|
190
|
-
const TableFooter = (0, _styles.styled)(_material.Box)(() => ({
|
|
191
|
-
display: 'flex',
|
|
192
|
-
justifyContent: 'center',
|
|
193
|
-
alignItems: 'center',
|
|
194
|
-
marginTop: '16px',
|
|
195
|
-
padding: '16px 0',
|
|
196
|
-
borderTop: "1px solid ".concat(_apperance.palette.border.light)
|
|
197
|
-
}));
|
|
198
|
-
|
|
199
|
-
// États de statut avec couleurs
|
|
200
|
-
const statusConfig = {
|
|
201
|
-
active: {
|
|
202
|
-
color: _apperance.palette.success,
|
|
203
|
-
icon: _iconsMaterial.CheckCircleRounded,
|
|
204
|
-
label: 'Actif'
|
|
205
|
-
},
|
|
206
|
-
expired: {
|
|
207
|
-
color: _apperance.palette.error,
|
|
208
|
-
icon: _iconsMaterial.ErrorRounded,
|
|
209
|
-
label: 'Expiré'
|
|
210
|
-
},
|
|
211
|
-
pending: {
|
|
212
|
-
color: _apperance.palette.warning,
|
|
213
|
-
icon: _iconsMaterial.AccessTimeRounded,
|
|
214
|
-
label: 'En attente'
|
|
215
|
-
},
|
|
216
|
-
processing: {
|
|
217
|
-
color: _apperance.palette.info,
|
|
218
|
-
icon: _iconsMaterial.RefreshRounded,
|
|
219
|
-
label: 'En cours'
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
// Types d'actions avec couleurs exactes extraites des maquettes
|
|
224
|
-
const actionConfig = {
|
|
225
|
-
validate: {
|
|
226
|
-
color: 'success',
|
|
227
|
-
icon: _iconsMaterial.CheckCircleRounded,
|
|
228
|
-
label: 'Validé',
|
|
229
|
-
bgColor: _apperance.palette.actions.validate,
|
|
230
|
-
// Vert Material Design des maquettes
|
|
231
|
-
textColor: '#fff'
|
|
232
|
-
},
|
|
233
|
-
expire: {
|
|
234
|
-
color: 'error',
|
|
235
|
-
icon: _iconsMaterial.ErrorRounded,
|
|
236
|
-
label: 'Expiré',
|
|
237
|
-
bgColor: _apperance.palette.actions.expire,
|
|
238
|
-
// Rouge Material Design des maquettes
|
|
239
|
-
textColor: '#fff'
|
|
240
|
-
},
|
|
241
|
-
renew: {
|
|
242
|
-
color: 'warning',
|
|
243
|
-
icon: _iconsMaterial.RefreshRounded,
|
|
244
|
-
label: 'Renouveler',
|
|
245
|
-
bgColor: _apperance.palette.actions.renew,
|
|
246
|
-
// Orange Material Design des maquettes
|
|
247
|
-
textColor: '#fff'
|
|
248
|
-
},
|
|
249
|
-
download: {
|
|
250
|
-
color: 'info',
|
|
251
|
-
icon: _iconsMaterial.DownloadRounded,
|
|
252
|
-
label: 'Télécharger',
|
|
253
|
-
bgColor: _apperance.palette.actions.download,
|
|
254
|
-
// Bleu Material Design des maquettes
|
|
255
|
-
textColor: '#fff'
|
|
256
|
-
},
|
|
257
|
-
processing: {
|
|
258
|
-
color: 'info',
|
|
259
|
-
icon: _iconsMaterial.AccessTimeRounded,
|
|
260
|
-
label: 'En cours',
|
|
261
|
-
bgColor: _apperance.palette.actions.processing,
|
|
262
|
-
// Violet Material Design des maquettes
|
|
263
|
-
textColor: '#fff'
|
|
264
|
-
},
|
|
265
|
-
souscrit: {
|
|
266
|
-
color: 'secondary',
|
|
267
|
-
icon: _iconsMaterial.CheckCircleRounded,
|
|
268
|
-
label: 'Souscrit',
|
|
269
|
-
bgColor: _apperance.palette.actions.souscrit,
|
|
270
|
-
// Gris bleu Material Design des maquettes
|
|
271
|
-
textColor: '#fff'
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Composant de tableau moderne basé sur la maquette
|
|
277
|
-
*
|
|
278
|
-
* Fonctionnalités :
|
|
279
|
-
* - Actions visibles uniquement au survol de la ligne
|
|
280
|
-
* - Indicateur visuel subtil (3 points) quand les actions sont cachées
|
|
281
|
-
* - Transitions fluides et animations modernes
|
|
282
|
-
* - Design responsive (actions toujours visibles sur mobile)
|
|
283
|
-
*/
|
|
284
|
-
const PuiModernTable = _ref => {
|
|
285
|
-
let {
|
|
286
|
-
title,
|
|
287
|
-
data = [],
|
|
288
|
-
columns = [],
|
|
289
|
-
actions = [],
|
|
290
|
-
loading = false,
|
|
291
|
-
pagination = true,
|
|
292
|
-
currentPage = 1,
|
|
293
|
-
totalPages = 1,
|
|
294
|
-
onPageChange,
|
|
295
|
-
emptyMessage = "Aucune donnée disponible",
|
|
296
|
-
className = ''
|
|
297
|
-
} = _ref,
|
|
298
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
299
|
-
const renderColumnValue = (item, column) => {
|
|
300
|
-
if (column.render) {
|
|
301
|
-
return column.render(item[column.key], item);
|
|
302
|
-
}
|
|
303
|
-
if (column.type === 'status') {
|
|
304
|
-
const status = statusConfig[item[column.key]] || statusConfig.pending;
|
|
305
|
-
const IconComponent = status.icon;
|
|
306
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
307
|
-
sx: {
|
|
308
|
-
display: 'flex',
|
|
309
|
-
alignItems: 'center',
|
|
310
|
-
gap: '6px'
|
|
311
|
-
},
|
|
312
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
313
|
-
sx: {
|
|
314
|
-
fontSize: '16px',
|
|
315
|
-
color: status.color
|
|
316
|
-
}
|
|
317
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
318
|
-
style: {
|
|
319
|
-
color: status.color
|
|
320
|
-
},
|
|
321
|
-
children: status.label
|
|
322
|
-
})]
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
if (column.type === 'currency') {
|
|
326
|
-
return new Intl.NumberFormat('fr-FR', {
|
|
327
|
-
style: 'currency',
|
|
328
|
-
currency: 'MAD'
|
|
329
|
-
}).format(item[column.key] || 0);
|
|
330
|
-
}
|
|
331
|
-
if (column.type === 'date') {
|
|
332
|
-
return new Date(item[column.key]).toLocaleDateString('fr-FR');
|
|
333
|
-
}
|
|
334
|
-
return item[column.key] || '-';
|
|
335
|
-
};
|
|
336
|
-
const renderActions = item => {
|
|
337
|
-
return actions.map((action, index) => {
|
|
338
|
-
var _action$disabled;
|
|
339
|
-
const config = actionConfig[action.type] || actionConfig.validate;
|
|
340
|
-
const IconComponent = action.icon || config.icon;
|
|
341
|
-
const isDisabled = (_action$disabled = action.disabled) === null || _action$disabled === void 0 ? void 0 : _action$disabled.call(action, item);
|
|
342
|
-
|
|
343
|
-
// Couleur unique basée sur le hover (couleur primaire avec transparence)
|
|
344
|
-
const hoverColor = "".concat(_apperance.palette.primary, "dd"); // Couleur du hover comme couleur unique
|
|
345
|
-
|
|
346
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
347
|
-
color: "primary",
|
|
348
|
-
size: "small",
|
|
349
|
-
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
350
|
-
sx: {
|
|
351
|
-
fontSize: '12px'
|
|
352
|
-
}
|
|
353
|
-
}),
|
|
354
|
-
onClick: () => {
|
|
355
|
-
var _action$onClick;
|
|
356
|
-
return (_action$onClick = action.onClick) === null || _action$onClick === void 0 ? void 0 : _action$onClick.call(action, item);
|
|
357
|
-
},
|
|
358
|
-
disabled: isDisabled,
|
|
359
|
-
sx: {
|
|
360
|
-
minWidth: 'auto',
|
|
361
|
-
padding: '4px 8px',
|
|
362
|
-
fontSize: '11px',
|
|
363
|
-
fontWeight: 500,
|
|
364
|
-
backgroundColor: isDisabled ? _apperance.palette.gray[300] : hoverColor,
|
|
365
|
-
color: isDisabled ? _apperance.palette.gray[500] : _apperance.palette.white,
|
|
366
|
-
border: 'none',
|
|
367
|
-
borderRadius: '4px',
|
|
368
|
-
textTransform: 'none',
|
|
369
|
-
boxShadow: 'none',
|
|
370
|
-
'&:hover': {
|
|
371
|
-
backgroundColor: isDisabled ? _apperance.palette.gray[300] : hoverColor,
|
|
372
|
-
transform: 'none'
|
|
373
|
-
},
|
|
374
|
-
'&:active': {
|
|
375
|
-
transform: 'none'
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
children: action.label || config.label
|
|
379
|
-
}, index);
|
|
380
|
-
});
|
|
381
|
-
};
|
|
382
|
-
if (loading) {
|
|
383
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ModernTableContainer, _objectSpread(_objectSpread({
|
|
384
|
-
className: className
|
|
385
|
-
}, props), {}, {
|
|
386
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
|
|
387
|
-
sx: {
|
|
388
|
-
borderRadius: '4px'
|
|
389
|
-
}
|
|
390
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
391
|
-
sx: {
|
|
392
|
-
textAlign: 'center',
|
|
393
|
-
py: 4
|
|
394
|
-
},
|
|
395
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
396
|
-
variant: "body2",
|
|
397
|
-
color: "textSecondary",
|
|
398
|
-
children: "Chargement des donn\xE9es..."
|
|
399
|
-
})
|
|
400
|
-
})]
|
|
401
|
-
}));
|
|
402
|
-
}
|
|
403
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ModernTableContainer, _objectSpread(_objectSpread({
|
|
404
|
-
className: className
|
|
405
|
-
}, props), {}, {
|
|
406
|
-
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TableHeader, {
|
|
407
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
408
|
-
variant: "h5",
|
|
409
|
-
sx: {
|
|
410
|
-
fontWeight: 600,
|
|
411
|
-
color: _apperance.palette.dark
|
|
412
|
-
},
|
|
413
|
-
children: title
|
|
414
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
415
|
-
variant: "body2",
|
|
416
|
-
color: "textSecondary",
|
|
417
|
-
children: [data.length, " \xE9l\xE9ment", data.length > 1 ? 's' : '']
|
|
418
|
-
})]
|
|
419
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CardsContainer, {
|
|
420
|
-
children: data.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
421
|
-
sx: {
|
|
422
|
-
textAlign: 'center',
|
|
423
|
-
py: 6,
|
|
424
|
-
color: _apperance.palette.gray[500]
|
|
425
|
-
},
|
|
426
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
427
|
-
variant: "body1",
|
|
428
|
-
children: emptyMessage
|
|
429
|
-
})
|
|
430
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
431
|
-
children: [data.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(TableCard, {
|
|
432
|
-
sx: {
|
|
433
|
-
backgroundColor: _apperance.palette.gray[50],
|
|
434
|
-
// Fond gris très clair comme dans l'image
|
|
435
|
-
borderColor: _apperance.palette.border.light,
|
|
436
|
-
cursor: 'default',
|
|
437
|
-
// Pas d'effet de hover pour l'en-tête
|
|
438
|
-
'&:hover': {
|
|
439
|
-
backgroundColor: _apperance.palette.gray[50],
|
|
440
|
-
// Garde le même fond au survol
|
|
441
|
-
borderColor: _apperance.palette.border.light,
|
|
442
|
-
transform: 'none',
|
|
443
|
-
boxShadow: 'none'
|
|
444
|
-
}
|
|
445
|
-
},
|
|
446
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DataSection, {
|
|
447
|
-
children: columns.map(column => /*#__PURE__*/(0, _jsxRuntime.jsxs)(DataColumn, {
|
|
448
|
-
style: {
|
|
449
|
-
flex: column.flex || 1
|
|
450
|
-
},
|
|
451
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
452
|
-
sx: {
|
|
453
|
-
fontSize: '12px',
|
|
454
|
-
fontWeight: 600,
|
|
455
|
-
color: '#029cfd !important',
|
|
456
|
-
textTransform: 'none',
|
|
457
|
-
letterSpacing: '0.3px',
|
|
458
|
-
'& *': {
|
|
459
|
-
color: '#029cfd !important'
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
children: column.label
|
|
463
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ColumnValue, {
|
|
464
|
-
sx: {
|
|
465
|
-
fontSize: '0px',
|
|
466
|
-
height: '0px',
|
|
467
|
-
margin: '0px',
|
|
468
|
-
padding: '0px',
|
|
469
|
-
visibility: 'hidden'
|
|
470
|
-
}
|
|
471
|
-
})]
|
|
472
|
-
}, column.key))
|
|
473
|
-
})
|
|
474
|
-
}), data.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(TableCard, {
|
|
475
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DataSection, {
|
|
476
|
-
children: columns.map(column => /*#__PURE__*/(0, _jsxRuntime.jsx)(DataColumn, {
|
|
477
|
-
style: {
|
|
478
|
-
flex: column.flex || 1
|
|
479
|
-
},
|
|
480
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ColumnValue, {
|
|
481
|
-
children: renderColumnValue(item, column)
|
|
482
|
-
})
|
|
483
|
-
}, column.key))
|
|
484
|
-
}), actions.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionsSection, {
|
|
485
|
-
className: "actions-section",
|
|
486
|
-
children: renderActions(item)
|
|
487
|
-
})]
|
|
488
|
-
}, item.id || index))]
|
|
489
|
-
})
|
|
490
|
-
}), pagination && totalPages > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(TableFooter, {
|
|
491
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
|
|
492
|
-
count: totalPages,
|
|
493
|
-
page: currentPage,
|
|
494
|
-
onChange: (event, page) => onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(page),
|
|
495
|
-
color: "primary",
|
|
496
|
-
size: "medium",
|
|
497
|
-
showFirstButton: true,
|
|
498
|
-
showLastButton: true,
|
|
499
|
-
sx: {
|
|
500
|
-
'& .MuiPaginationItem-root': {
|
|
501
|
-
borderRadius: '6px',
|
|
502
|
-
'&.Mui-selected': {
|
|
503
|
-
backgroundColor: _apperance.palette.primary,
|
|
504
|
-
color: _apperance.palette.white,
|
|
505
|
-
'&:hover': {
|
|
506
|
-
backgroundColor: _apperance.palette.blue.dark
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
})
|
|
512
|
-
})]
|
|
513
|
-
}));
|
|
514
|
-
};
|
|
515
|
-
PuiModernTable.propTypes = {
|
|
516
|
-
title: _propTypes.default.string,
|
|
517
|
-
data: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
518
|
-
columns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
519
|
-
key: _propTypes.default.string.isRequired,
|
|
520
|
-
label: _propTypes.default.string.isRequired,
|
|
521
|
-
type: _propTypes.default.oneOf(['text', 'status', 'currency', 'date']),
|
|
522
|
-
flex: _propTypes.default.number,
|
|
523
|
-
render: _propTypes.default.func
|
|
524
|
-
})),
|
|
525
|
-
actions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
526
|
-
type: _propTypes.default.oneOf(['renew', 'validate', 'expire', 'download']),
|
|
527
|
-
label: _propTypes.default.string,
|
|
528
|
-
color: _propTypes.default.oneOf(['primary', 'secondary', 'tertiary']),
|
|
529
|
-
icon: _propTypes.default.elementType,
|
|
530
|
-
onClick: _propTypes.default.func,
|
|
531
|
-
disabled: _propTypes.default.func
|
|
532
|
-
})),
|
|
533
|
-
loading: _propTypes.default.bool,
|
|
534
|
-
pagination: _propTypes.default.bool,
|
|
535
|
-
currentPage: _propTypes.default.number,
|
|
536
|
-
totalPages: _propTypes.default.number,
|
|
537
|
-
onPageChange: _propTypes.default.func,
|
|
538
|
-
emptyMessage: _propTypes.default.string,
|
|
539
|
-
className: _propTypes.default.string
|
|
540
|
-
};
|
|
541
|
-
var _default = exports.default = PuiModernTable;
|