@portnet/ui 3.1.1 → 3.1.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.
- package/dist/components/buttons/PuiButton.js +78 -15
- package/dist/components/common/StyledMuiTextField.js +34 -15
- package/dist/components/inputs/PuiSelect.js +42 -26
- package/dist/components/providers/PuiAntdProvider.js +70 -0
- package/dist/components/providers/PuiThemeProvider.js +230 -0
- package/dist/components/table/PuiModernTable.js +546 -0
- package/dist/components-antd-optional/PuiAntdForm.js +328 -0
- package/dist/components-antd-optional/PuiAntdStepper.js +317 -0
- package/dist/components-antd-optional/PuiAntdTable.js +352 -0
- package/dist/config/antdTheme.js +227 -0
- package/dist/config/apperance.js +67 -38
- package/dist/index.js +21 -0
- package/package.json +3 -1
|
@@ -0,0 +1,546 @@
|
|
|
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: 'translateX(0)',
|
|
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: '11px',
|
|
127
|
+
fontWeight: 600,
|
|
128
|
+
color: _apperance.palette.gray[500],
|
|
129
|
+
textTransform: 'uppercase',
|
|
130
|
+
letterSpacing: '0.5px'
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
// Valeur de colonne
|
|
134
|
+
const ColumnValue = (0, _styles.styled)(_material.Typography)(() => ({
|
|
135
|
+
fontSize: '14px',
|
|
136
|
+
fontWeight: 500,
|
|
137
|
+
color: _apperance.palette.dark,
|
|
138
|
+
wordBreak: 'break-word'
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
// Section des actions avec effet de survol
|
|
142
|
+
const ActionsSection = (0, _styles.styled)(_material.Box)(() => ({
|
|
143
|
+
display: 'flex',
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
gap: '8px',
|
|
146
|
+
flexShrink: 0,
|
|
147
|
+
opacity: 0,
|
|
148
|
+
transform: 'translateX(10px)',
|
|
149
|
+
transition: 'all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)',
|
|
150
|
+
position: 'relative',
|
|
151
|
+
// Afficher les actions uniquement au survol de la card parent directe
|
|
152
|
+
'&:hover': {
|
|
153
|
+
opacity: 1,
|
|
154
|
+
transform: 'translateX(0)',
|
|
155
|
+
transitionDelay: '0.1s' // Délai d'apparition pour un effet plus fluide
|
|
156
|
+
},
|
|
157
|
+
// Indicateur subtil d'actions disponibles (icône menu)
|
|
158
|
+
'&::before': {
|
|
159
|
+
content: '""',
|
|
160
|
+
position: 'absolute',
|
|
161
|
+
right: '8px',
|
|
162
|
+
top: '50%',
|
|
163
|
+
transform: 'translateY(-50%)',
|
|
164
|
+
width: '4px',
|
|
165
|
+
height: '4px',
|
|
166
|
+
borderRadius: '50%',
|
|
167
|
+
backgroundColor: _apperance.palette.gray[400],
|
|
168
|
+
opacity: 1,
|
|
169
|
+
transition: 'opacity 0.3s ease',
|
|
170
|
+
boxShadow: "\n 0 6px 0 ".concat(_apperance.palette.gray[400], ",\n 0 12px 0 ").concat(_apperance.palette.gray[400], "\n ")
|
|
171
|
+
},
|
|
172
|
+
'.MuiBox-root:hover &::before': {
|
|
173
|
+
opacity: 0
|
|
174
|
+
},
|
|
175
|
+
'@media (max-width: 768px)': {
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
opacity: 1,
|
|
178
|
+
// Toujours visible sur mobile
|
|
179
|
+
transform: 'translateX(0)',
|
|
180
|
+
'&::before': {
|
|
181
|
+
display: 'none' // Pas d'indicateur sur mobile
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
// Footer avec pagination
|
|
187
|
+
const TableFooter = (0, _styles.styled)(_material.Box)(() => ({
|
|
188
|
+
display: 'flex',
|
|
189
|
+
justifyContent: 'center',
|
|
190
|
+
alignItems: 'center',
|
|
191
|
+
marginTop: '16px',
|
|
192
|
+
padding: '16px 0',
|
|
193
|
+
borderTop: "1px solid ".concat(_apperance.palette.border.light)
|
|
194
|
+
}));
|
|
195
|
+
|
|
196
|
+
// États de statut avec couleurs
|
|
197
|
+
const statusConfig = {
|
|
198
|
+
active: {
|
|
199
|
+
color: _apperance.palette.success,
|
|
200
|
+
icon: _iconsMaterial.CheckCircleRounded,
|
|
201
|
+
label: 'Actif'
|
|
202
|
+
},
|
|
203
|
+
expired: {
|
|
204
|
+
color: _apperance.palette.error,
|
|
205
|
+
icon: _iconsMaterial.ErrorRounded,
|
|
206
|
+
label: 'Expiré'
|
|
207
|
+
},
|
|
208
|
+
pending: {
|
|
209
|
+
color: _apperance.palette.warning,
|
|
210
|
+
icon: _iconsMaterial.AccessTimeRounded,
|
|
211
|
+
label: 'En attente'
|
|
212
|
+
},
|
|
213
|
+
processing: {
|
|
214
|
+
color: _apperance.palette.info,
|
|
215
|
+
icon: _iconsMaterial.RefreshRounded,
|
|
216
|
+
label: 'En cours'
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Types d'actions avec couleurs exactes extraites des maquettes
|
|
221
|
+
const actionConfig = {
|
|
222
|
+
validate: {
|
|
223
|
+
color: 'success',
|
|
224
|
+
icon: _iconsMaterial.CheckCircleRounded,
|
|
225
|
+
label: 'Validé',
|
|
226
|
+
bgColor: _apperance.palette.actions.validate,
|
|
227
|
+
// Vert Material Design des maquettes
|
|
228
|
+
textColor: '#fff'
|
|
229
|
+
},
|
|
230
|
+
expire: {
|
|
231
|
+
color: 'error',
|
|
232
|
+
icon: _iconsMaterial.ErrorRounded,
|
|
233
|
+
label: 'Expiré',
|
|
234
|
+
bgColor: _apperance.palette.actions.expire,
|
|
235
|
+
// Rouge Material Design des maquettes
|
|
236
|
+
textColor: '#fff'
|
|
237
|
+
},
|
|
238
|
+
renew: {
|
|
239
|
+
color: 'warning',
|
|
240
|
+
icon: _iconsMaterial.RefreshRounded,
|
|
241
|
+
label: 'Renouveler',
|
|
242
|
+
bgColor: _apperance.palette.actions.renew,
|
|
243
|
+
// Orange Material Design des maquettes
|
|
244
|
+
textColor: '#fff'
|
|
245
|
+
},
|
|
246
|
+
download: {
|
|
247
|
+
color: 'info',
|
|
248
|
+
icon: _iconsMaterial.DownloadRounded,
|
|
249
|
+
label: 'Télécharger',
|
|
250
|
+
bgColor: _apperance.palette.actions.download,
|
|
251
|
+
// Bleu Material Design des maquettes
|
|
252
|
+
textColor: '#fff'
|
|
253
|
+
},
|
|
254
|
+
processing: {
|
|
255
|
+
color: 'info',
|
|
256
|
+
icon: _iconsMaterial.AccessTimeRounded,
|
|
257
|
+
label: 'En cours',
|
|
258
|
+
bgColor: _apperance.palette.actions.processing,
|
|
259
|
+
// Violet Material Design des maquettes
|
|
260
|
+
textColor: '#fff'
|
|
261
|
+
},
|
|
262
|
+
souscrit: {
|
|
263
|
+
color: 'secondary',
|
|
264
|
+
icon: _iconsMaterial.CheckCircleRounded,
|
|
265
|
+
label: 'Souscrit',
|
|
266
|
+
bgColor: _apperance.palette.actions.souscrit,
|
|
267
|
+
// Gris bleu Material Design des maquettes
|
|
268
|
+
textColor: '#fff'
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Composant de tableau moderne basé sur la maquette
|
|
274
|
+
*
|
|
275
|
+
* Fonctionnalités :
|
|
276
|
+
* - Actions visibles uniquement au survol de la ligne
|
|
277
|
+
* - Indicateur visuel subtil (3 points) quand les actions sont cachées
|
|
278
|
+
* - Transitions fluides et animations modernes
|
|
279
|
+
* - Design responsive (actions toujours visibles sur mobile)
|
|
280
|
+
*/
|
|
281
|
+
const PuiModernTable = _ref => {
|
|
282
|
+
let {
|
|
283
|
+
title,
|
|
284
|
+
data = [],
|
|
285
|
+
columns = [],
|
|
286
|
+
actions = [],
|
|
287
|
+
loading = false,
|
|
288
|
+
pagination = true,
|
|
289
|
+
currentPage = 1,
|
|
290
|
+
totalPages = 1,
|
|
291
|
+
onPageChange,
|
|
292
|
+
emptyMessage = "Aucune donnée disponible",
|
|
293
|
+
className = ''
|
|
294
|
+
} = _ref,
|
|
295
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
296
|
+
const renderColumnValue = (item, column) => {
|
|
297
|
+
if (column.render) {
|
|
298
|
+
return column.render(item[column.key], item);
|
|
299
|
+
}
|
|
300
|
+
if (column.type === 'status') {
|
|
301
|
+
const status = statusConfig[item[column.key]] || statusConfig.pending;
|
|
302
|
+
const IconComponent = status.icon;
|
|
303
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
304
|
+
sx: {
|
|
305
|
+
display: 'flex',
|
|
306
|
+
alignItems: 'center',
|
|
307
|
+
gap: '6px'
|
|
308
|
+
},
|
|
309
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
310
|
+
sx: {
|
|
311
|
+
fontSize: '16px',
|
|
312
|
+
color: status.color
|
|
313
|
+
}
|
|
314
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
315
|
+
style: {
|
|
316
|
+
color: status.color
|
|
317
|
+
},
|
|
318
|
+
children: status.label
|
|
319
|
+
})]
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (column.type === 'currency') {
|
|
323
|
+
return new Intl.NumberFormat('fr-FR', {
|
|
324
|
+
style: 'currency',
|
|
325
|
+
currency: 'MAD'
|
|
326
|
+
}).format(item[column.key] || 0);
|
|
327
|
+
}
|
|
328
|
+
if (column.type === 'date') {
|
|
329
|
+
return new Date(item[column.key]).toLocaleDateString('fr-FR');
|
|
330
|
+
}
|
|
331
|
+
return item[column.key] || '-';
|
|
332
|
+
};
|
|
333
|
+
const renderActions = item => {
|
|
334
|
+
return actions.map((action, index) => {
|
|
335
|
+
var _action$disabled;
|
|
336
|
+
const config = actionConfig[action.type] || actionConfig.validate;
|
|
337
|
+
const IconComponent = action.icon || config.icon;
|
|
338
|
+
const isDisabled = (_action$disabled = action.disabled) === null || _action$disabled === void 0 ? void 0 : _action$disabled.call(action, item);
|
|
339
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
340
|
+
color: "primary",
|
|
341
|
+
size: "small",
|
|
342
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
343
|
+
sx: {
|
|
344
|
+
fontSize: '14px'
|
|
345
|
+
}
|
|
346
|
+
}),
|
|
347
|
+
onClick: () => {
|
|
348
|
+
var _action$onClick;
|
|
349
|
+
return (_action$onClick = action.onClick) === null || _action$onClick === void 0 ? void 0 : _action$onClick.call(action, item);
|
|
350
|
+
},
|
|
351
|
+
disabled: isDisabled,
|
|
352
|
+
sx: {
|
|
353
|
+
minWidth: 'auto',
|
|
354
|
+
padding: '6px 12px',
|
|
355
|
+
fontSize: '11px',
|
|
356
|
+
fontWeight: 500,
|
|
357
|
+
backgroundColor: isDisabled ? _apperance.palette.gray[300] : action.bgColor || config.bgColor,
|
|
358
|
+
color: isDisabled ? _apperance.palette.gray[500] : action.textColor || config.textColor,
|
|
359
|
+
border: 'none',
|
|
360
|
+
borderRadius: '6px',
|
|
361
|
+
textTransform: 'none',
|
|
362
|
+
'&:hover': {
|
|
363
|
+
backgroundColor: isDisabled ? _apperance.palette.gray[300] : "".concat(action.bgColor || config.bgColor, "dd"),
|
|
364
|
+
transform: isDisabled ? 'none' : 'translateY(-1px)'
|
|
365
|
+
},
|
|
366
|
+
'&:active': {
|
|
367
|
+
transform: isDisabled ? 'none' : 'translateY(0)'
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
children: action.label || config.label
|
|
371
|
+
}, index);
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
if (loading) {
|
|
375
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ModernTableContainer, _objectSpread(_objectSpread({
|
|
376
|
+
className: className
|
|
377
|
+
}, props), {}, {
|
|
378
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
|
|
379
|
+
sx: {
|
|
380
|
+
borderRadius: '4px'
|
|
381
|
+
}
|
|
382
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
383
|
+
sx: {
|
|
384
|
+
textAlign: 'center',
|
|
385
|
+
py: 4
|
|
386
|
+
},
|
|
387
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
388
|
+
variant: "body2",
|
|
389
|
+
color: "textSecondary",
|
|
390
|
+
children: "Chargement des donn\xE9es..."
|
|
391
|
+
})
|
|
392
|
+
})]
|
|
393
|
+
}));
|
|
394
|
+
}
|
|
395
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ModernTableContainer, _objectSpread(_objectSpread({
|
|
396
|
+
className: className
|
|
397
|
+
}, props), {}, {
|
|
398
|
+
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TableHeader, {
|
|
399
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
400
|
+
variant: "h5",
|
|
401
|
+
sx: {
|
|
402
|
+
fontWeight: 600,
|
|
403
|
+
color: _apperance.palette.dark
|
|
404
|
+
},
|
|
405
|
+
children: title
|
|
406
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
407
|
+
variant: "body2",
|
|
408
|
+
color: "textSecondary",
|
|
409
|
+
children: [data.length, " \xE9l\xE9ment", data.length > 1 ? 's' : '']
|
|
410
|
+
})]
|
|
411
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CardsContainer, {
|
|
412
|
+
children: data.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
413
|
+
sx: {
|
|
414
|
+
textAlign: 'center',
|
|
415
|
+
py: 6,
|
|
416
|
+
color: _apperance.palette.gray[500]
|
|
417
|
+
},
|
|
418
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
419
|
+
variant: "body1",
|
|
420
|
+
children: emptyMessage
|
|
421
|
+
})
|
|
422
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
423
|
+
children: [data.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TableCard, {
|
|
424
|
+
sx: {
|
|
425
|
+
backgroundColor: "".concat(_apperance.palette.primary, "05"),
|
|
426
|
+
borderColor: "".concat(_apperance.palette.primary, "20"),
|
|
427
|
+
cursor: 'default',
|
|
428
|
+
'&:hover': {
|
|
429
|
+
transform: 'none',
|
|
430
|
+
boxShadow: _apperance.palette.shadow.card,
|
|
431
|
+
borderColor: "".concat(_apperance.palette.primary, "20"),
|
|
432
|
+
backgroundColor: "".concat(_apperance.palette.primary, "05")
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DataSection, {
|
|
436
|
+
children: columns.map(column => /*#__PURE__*/(0, _jsxRuntime.jsxs)(DataColumn, {
|
|
437
|
+
style: {
|
|
438
|
+
flex: column.flex || 1
|
|
439
|
+
},
|
|
440
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ColumnLabel, {
|
|
441
|
+
sx: {
|
|
442
|
+
fontSize: '12px',
|
|
443
|
+
fontWeight: 700,
|
|
444
|
+
color: _apperance.palette.primary,
|
|
445
|
+
textTransform: 'uppercase',
|
|
446
|
+
letterSpacing: '0.8px'
|
|
447
|
+
},
|
|
448
|
+
children: column.label
|
|
449
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ColumnValue, {
|
|
450
|
+
sx: {
|
|
451
|
+
fontSize: '13px',
|
|
452
|
+
fontWeight: 600,
|
|
453
|
+
color: _apperance.palette.gray[600],
|
|
454
|
+
fontStyle: 'italic'
|
|
455
|
+
},
|
|
456
|
+
children: "En-t\xEAte"
|
|
457
|
+
})]
|
|
458
|
+
}, column.key))
|
|
459
|
+
}), actions.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionsSection, {
|
|
460
|
+
className: "actions-section",
|
|
461
|
+
sx: {
|
|
462
|
+
opacity: 0.6,
|
|
463
|
+
'&::before': {
|
|
464
|
+
backgroundColor: _apperance.palette.primary,
|
|
465
|
+
boxShadow: "\n 0 6px 0 ".concat(_apperance.palette.primary, ",\n 0 12px 0 ").concat(_apperance.palette.primary, "\n ")
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
469
|
+
sx: {
|
|
470
|
+
fontSize: '11px',
|
|
471
|
+
fontWeight: 600,
|
|
472
|
+
color: _apperance.palette.primary,
|
|
473
|
+
textTransform: 'uppercase',
|
|
474
|
+
letterSpacing: '0.5px'
|
|
475
|
+
},
|
|
476
|
+
children: "Actions"
|
|
477
|
+
})
|
|
478
|
+
})]
|
|
479
|
+
}), data.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(TableCard, {
|
|
480
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DataSection, {
|
|
481
|
+
children: columns.map(column => /*#__PURE__*/(0, _jsxRuntime.jsx)(DataColumn, {
|
|
482
|
+
style: {
|
|
483
|
+
flex: column.flex || 1
|
|
484
|
+
},
|
|
485
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ColumnValue, {
|
|
486
|
+
children: renderColumnValue(item, column)
|
|
487
|
+
})
|
|
488
|
+
}, column.key))
|
|
489
|
+
}), actions.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionsSection, {
|
|
490
|
+
className: "actions-section",
|
|
491
|
+
children: renderActions(item)
|
|
492
|
+
})]
|
|
493
|
+
}, item.id || index))]
|
|
494
|
+
})
|
|
495
|
+
}), pagination && totalPages > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(TableFooter, {
|
|
496
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
|
|
497
|
+
count: totalPages,
|
|
498
|
+
page: currentPage,
|
|
499
|
+
onChange: (event, page) => onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(page),
|
|
500
|
+
color: "primary",
|
|
501
|
+
size: "medium",
|
|
502
|
+
showFirstButton: true,
|
|
503
|
+
showLastButton: true,
|
|
504
|
+
sx: {
|
|
505
|
+
'& .MuiPaginationItem-root': {
|
|
506
|
+
borderRadius: '6px',
|
|
507
|
+
'&.Mui-selected': {
|
|
508
|
+
backgroundColor: _apperance.palette.primary,
|
|
509
|
+
color: _apperance.palette.white,
|
|
510
|
+
'&:hover': {
|
|
511
|
+
backgroundColor: _apperance.palette.blue.dark
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
})
|
|
517
|
+
})]
|
|
518
|
+
}));
|
|
519
|
+
};
|
|
520
|
+
PuiModernTable.propTypes = {
|
|
521
|
+
title: _propTypes.default.string,
|
|
522
|
+
data: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
523
|
+
columns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
524
|
+
key: _propTypes.default.string.isRequired,
|
|
525
|
+
label: _propTypes.default.string.isRequired,
|
|
526
|
+
type: _propTypes.default.oneOf(['text', 'status', 'currency', 'date']),
|
|
527
|
+
flex: _propTypes.default.number,
|
|
528
|
+
render: _propTypes.default.func
|
|
529
|
+
})),
|
|
530
|
+
actions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
531
|
+
type: _propTypes.default.oneOf(['renew', 'validate', 'expire', 'download']),
|
|
532
|
+
label: _propTypes.default.string,
|
|
533
|
+
color: _propTypes.default.oneOf(['primary', 'secondary', 'tertiary']),
|
|
534
|
+
icon: _propTypes.default.elementType,
|
|
535
|
+
onClick: _propTypes.default.func,
|
|
536
|
+
disabled: _propTypes.default.func
|
|
537
|
+
})),
|
|
538
|
+
loading: _propTypes.default.bool,
|
|
539
|
+
pagination: _propTypes.default.bool,
|
|
540
|
+
currentPage: _propTypes.default.number,
|
|
541
|
+
totalPages: _propTypes.default.number,
|
|
542
|
+
onPageChange: _propTypes.default.func,
|
|
543
|
+
emptyMessage: _propTypes.default.string,
|
|
544
|
+
className: _propTypes.default.string
|
|
545
|
+
};
|
|
546
|
+
var _default = exports.default = PuiModernTable;
|