@portnet/ui 2.0.6 → 2.0.8
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/PuiNewUserButton.js +121 -0
- package/dist/components/inputs/PuiSelect.js +100 -35
- package/dist/components/others/PuiChip.js +254 -114
- package/dist/components/table/PuiTable.js +50 -8
- package/dist/components/ui/layout/Header.js +253 -0
- package/dist/components/ui/layout/Layout.js +104 -0
- package/dist/components/ui/layout/Sidebar.js +193 -0
- package/dist/components/ui/layout/index.js +29 -0
- package/dist/index.js +37 -1
- package/package.json +1 -1
|
@@ -1,151 +1,291 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.weak-map.js");
|
|
4
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
5
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
6
4
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
7
5
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
6
|
Object.defineProperty(exports, "__esModule", {
|
|
9
7
|
value: true
|
|
10
8
|
});
|
|
11
|
-
exports.default = void 0;
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
exports.default = exports.PuiStatusChip = void 0;
|
|
10
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
11
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var
|
|
14
|
+
var _antd = require("antd");
|
|
16
15
|
var _apperance = require("../../config/apperance");
|
|
17
|
-
var _PuiTooltip = _interopRequireDefault(require("./PuiTooltip"));
|
|
18
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["id", "className", "sx", "color", "fullWidth", "children"]
|
|
17
|
+
const _excluded = ["id", "className", "sx", "color", "variant", "size", "fullWidth", "children", "clickable", "onClick", "status"],
|
|
18
|
+
_excluded2 = ["status", "children"]; // Définition des états prédéfinis et leur correspondance de style
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
-
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; }
|
|
24
|
-
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; }
|
|
25
22
|
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; }
|
|
26
23
|
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; }
|
|
27
24
|
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; }
|
|
28
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
29
26
|
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); }
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
27
|
+
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; }
|
|
28
|
+
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; }
|
|
29
|
+
const STATUS_CONFIG = {
|
|
30
|
+
// États génériques
|
|
31
|
+
active: {
|
|
32
|
+
color: 'success',
|
|
33
|
+
label: 'Active'
|
|
34
|
+
},
|
|
35
|
+
inactive: {
|
|
36
|
+
color: 'secondary',
|
|
37
|
+
label: 'Inactive'
|
|
38
|
+
},
|
|
39
|
+
pending: {
|
|
40
|
+
color: 'warning',
|
|
41
|
+
label: 'En attente'
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
color: 'error',
|
|
45
|
+
label: 'Erreur'
|
|
46
|
+
},
|
|
47
|
+
// États spécifiques
|
|
48
|
+
cancelled: {
|
|
49
|
+
color: 'error',
|
|
50
|
+
label: 'Annulée'
|
|
51
|
+
},
|
|
52
|
+
payed: {
|
|
53
|
+
color: 'success',
|
|
54
|
+
label: 'Réglée'
|
|
55
|
+
},
|
|
56
|
+
pending_payment: {
|
|
57
|
+
color: 'warning',
|
|
58
|
+
label: 'Paiement en attente'
|
|
59
|
+
},
|
|
60
|
+
shipped: {
|
|
61
|
+
color: 'info',
|
|
62
|
+
label: 'Expédiée'
|
|
63
|
+
},
|
|
64
|
+
delivered: {
|
|
65
|
+
color: 'success',
|
|
66
|
+
label: 'Livrée'
|
|
67
|
+
},
|
|
68
|
+
processing: {
|
|
69
|
+
color: 'primary',
|
|
70
|
+
label: 'En traitement'
|
|
71
|
+
},
|
|
72
|
+
refunded: {
|
|
73
|
+
color: 'error',
|
|
74
|
+
label: 'Remboursée'
|
|
75
|
+
},
|
|
76
|
+
onhold: {
|
|
77
|
+
color: 'secondary',
|
|
78
|
+
label: 'En suspens'
|
|
79
|
+
},
|
|
80
|
+
completed: {
|
|
81
|
+
color: 'success',
|
|
82
|
+
label: 'Terminée'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Style CSS pour le composant custom
|
|
87
|
+
const chipStyles = "\n .pui-custom-chip {\n display: inline-block;\n box-sizing: border-box;\n margin: 2px;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 14px;\n line-height: 1.5;\n font-weight: 500;\n transition: all 0.2s;\n max-width: 100%;\n vertical-align: middle;\n border: 1px solid transparent;\n }\n \n .pui-custom-chip.full-width {\n width: 100%;\n display: block;\n }\n \n .pui-custom-chip.small {\n font-size: 12px;\n padding: 2px 6px;\n }\n \n .pui-custom-chip.medium {\n font-size: 14px;\n padding: 4px 8px;\n }\n \n .pui-custom-chip.large {\n font-size: 16px;\n padding: 6px 10px;\n }\n \n .pui-custom-chip-content {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: normal;\n word-wrap: break-word;\n word-break: break-word;\n width: 100%;\n }\n \n .pui-custom-chip.clickable {\n cursor: pointer;\n }\n \n .pui-custom-chip.clickable:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n \n /* Styles sp\xE9cifiques pour les statuts */\n .pui-status-chip {\n font-weight: 600;\n padding: 3px 10px;\n border-radius: 12px;\n }\n";
|
|
88
|
+
|
|
89
|
+
// Injection des styles dans le document
|
|
90
|
+
const injectStyles = () => {
|
|
91
|
+
const styleId = 'pui-custom-chip-styles';
|
|
92
|
+
if (!document.getElementById(styleId)) {
|
|
93
|
+
const styleElement = document.createElement('style');
|
|
94
|
+
styleElement.id = styleId;
|
|
95
|
+
styleElement.innerHTML = chipStyles;
|
|
96
|
+
document.head.appendChild(styleElement);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Suppression des styles lors du démontage
|
|
101
|
+
const removeStyles = () => {
|
|
102
|
+
const styleElement = document.getElementById('pui-custom-chip-styles');
|
|
103
|
+
if (styleElement) {
|
|
104
|
+
document.head.removeChild(styleElement);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Configuration des couleurs selon la palette
|
|
109
|
+
const getColorConfig = (color, variant) => {
|
|
110
|
+
var _colorConfigs$color;
|
|
111
|
+
const colorConfigs = {
|
|
112
|
+
primary: {
|
|
113
|
+
filled: {
|
|
114
|
+
color: '#fff',
|
|
115
|
+
backgroundColor: _apperance.palette.primary,
|
|
116
|
+
borderColor: _apperance.palette.primary
|
|
117
|
+
},
|
|
118
|
+
outlined: {
|
|
119
|
+
color: _apperance.palette.primary,
|
|
120
|
+
backgroundColor: 'transparent',
|
|
121
|
+
borderColor: _apperance.palette.primary
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
secondary: {
|
|
125
|
+
filled: {
|
|
126
|
+
color: _apperance.palette.gray.darker,
|
|
127
|
+
backgroundColor: _apperance.palette.secondary,
|
|
128
|
+
borderColor: _apperance.palette.gray.dark
|
|
129
|
+
},
|
|
130
|
+
outlined: {
|
|
131
|
+
color: _apperance.palette.gray.darker,
|
|
132
|
+
backgroundColor: 'transparent',
|
|
133
|
+
borderColor: _apperance.palette.gray.dark
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
info: {
|
|
137
|
+
filled: {
|
|
138
|
+
color: '#fff',
|
|
139
|
+
backgroundColor: _apperance.palette.info,
|
|
140
|
+
borderColor: _apperance.palette.info
|
|
141
|
+
},
|
|
142
|
+
outlined: {
|
|
143
|
+
color: _apperance.palette.info,
|
|
144
|
+
backgroundColor: 'transparent',
|
|
145
|
+
borderColor: _apperance.palette.info
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
success: {
|
|
149
|
+
filled: {
|
|
150
|
+
color: '#fff',
|
|
151
|
+
backgroundColor: _apperance.palette.success,
|
|
152
|
+
borderColor: _apperance.palette.success
|
|
153
|
+
},
|
|
154
|
+
outlined: {
|
|
155
|
+
color: _apperance.palette.success,
|
|
156
|
+
backgroundColor: 'transparent',
|
|
157
|
+
borderColor: _apperance.palette.success
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
warning: {
|
|
161
|
+
filled: {
|
|
162
|
+
color: '#fff',
|
|
163
|
+
backgroundColor: _apperance.palette.warning,
|
|
164
|
+
borderColor: _apperance.palette.warning
|
|
165
|
+
},
|
|
166
|
+
outlined: {
|
|
167
|
+
color: _apperance.palette.warning,
|
|
168
|
+
backgroundColor: 'transparent',
|
|
169
|
+
borderColor: _apperance.palette.warning
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
error: {
|
|
173
|
+
filled: {
|
|
174
|
+
color: '#fff',
|
|
175
|
+
backgroundColor: _apperance.palette.error,
|
|
176
|
+
borderColor: _apperance.palette.error
|
|
177
|
+
},
|
|
178
|
+
outlined: {
|
|
179
|
+
color: _apperance.palette.error,
|
|
180
|
+
backgroundColor: 'transparent',
|
|
181
|
+
borderColor: _apperance.palette.error
|
|
182
|
+
}
|
|
95
183
|
}
|
|
96
184
|
};
|
|
97
|
-
|
|
98
|
-
const getChipByColor = color => {
|
|
99
|
-
switch (color) {
|
|
100
|
-
case "primary":
|
|
101
|
-
default:
|
|
102
|
-
return PrimaryChip;
|
|
103
|
-
case "secondary":
|
|
104
|
-
return SecondaryChip;
|
|
105
|
-
case "success":
|
|
106
|
-
return SuccessChip;
|
|
107
|
-
case "error":
|
|
108
|
-
return ErrorChip;
|
|
109
|
-
case "info":
|
|
110
|
-
return InfoChip;
|
|
111
|
-
case "warning":
|
|
112
|
-
return WarningChip;
|
|
113
|
-
}
|
|
185
|
+
return ((_colorConfigs$color = colorConfigs[color]) === null || _colorConfigs$color === void 0 ? void 0 : _colorConfigs$color[variant]) || colorConfigs.primary.filled;
|
|
114
186
|
};
|
|
115
|
-
const PuiChip = /*#__PURE__*/
|
|
187
|
+
const PuiChip = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
116
188
|
let {
|
|
117
189
|
id,
|
|
118
190
|
className,
|
|
119
191
|
sx,
|
|
120
|
-
color,
|
|
121
|
-
|
|
122
|
-
|
|
192
|
+
color = "primary",
|
|
193
|
+
variant = "filled",
|
|
194
|
+
size = "medium",
|
|
195
|
+
fullWidth = false,
|
|
196
|
+
children,
|
|
197
|
+
clickable = false,
|
|
198
|
+
onClick,
|
|
199
|
+
status // Nouveau prop pour gérer les états prédéfinis
|
|
123
200
|
} = _ref,
|
|
124
201
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
202
|
+
// Injection des styles
|
|
203
|
+
_react.default.useEffect(() => {
|
|
204
|
+
injectStyles();
|
|
205
|
+
return () => removeStyles();
|
|
206
|
+
}, []);
|
|
207
|
+
|
|
208
|
+
// Si un statut est fourni, utiliser sa configuration
|
|
209
|
+
let displayContent = children;
|
|
210
|
+
let statusColor = color;
|
|
211
|
+
if (status && STATUS_CONFIG[status]) {
|
|
212
|
+
const statusConfig = STATUS_CONFIG[status];
|
|
213
|
+
statusColor = statusConfig.color;
|
|
214
|
+
// Si aucun contenu n'est fourni, utiliser le libellé par défaut du statut
|
|
215
|
+
if (!children) {
|
|
216
|
+
displayContent = statusConfig.label;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const colorConfig = getColorConfig(statusColor, variant);
|
|
220
|
+
const shouldShowTooltip = typeof displayContent === 'string' && displayContent.length > 30;
|
|
221
|
+
|
|
222
|
+
// Déterminer les classes CSS
|
|
223
|
+
const chipClasses = ['pui-custom-chip', status ? 'pui-status-chip' : '', size, fullWidth ? 'full-width' : '', clickable ? 'clickable' : '', className || ''].filter(Boolean).join(' ');
|
|
224
|
+
|
|
225
|
+
// Gérer le clic
|
|
226
|
+
const handleClick = e => {
|
|
227
|
+
if (clickable && onClick) {
|
|
228
|
+
onClick(e);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Créer le chip personnalisé
|
|
233
|
+
const chipElement = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
|
|
234
|
+
id: id,
|
|
235
|
+
ref: ref,
|
|
236
|
+
className: chipClasses,
|
|
237
|
+
style: _objectSpread(_objectSpread({}, colorConfig), sx),
|
|
238
|
+
onClick: handleClick,
|
|
239
|
+
"data-status": status || null
|
|
240
|
+
}, rest), {}, {
|
|
241
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
242
|
+
className: "pui-custom-chip-content",
|
|
243
|
+
children: displayContent
|
|
244
|
+
})
|
|
245
|
+
}));
|
|
246
|
+
return shouldShowTooltip ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
247
|
+
title: displayContent,
|
|
248
|
+
placement: "top",
|
|
249
|
+
children: chipElement
|
|
250
|
+
}) : chipElement;
|
|
140
251
|
});
|
|
252
|
+
|
|
253
|
+
// Composant utilitaire simplifié pour afficher un statut
|
|
254
|
+
const PuiStatusChip = exports.PuiStatusChip = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
255
|
+
let {
|
|
256
|
+
status,
|
|
257
|
+
children
|
|
258
|
+
} = _ref2,
|
|
259
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
260
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiChip, _objectSpread(_objectSpread({
|
|
261
|
+
ref: ref,
|
|
262
|
+
status: status,
|
|
263
|
+
variant: "filled"
|
|
264
|
+
}, props), {}, {
|
|
265
|
+
children: children
|
|
266
|
+
}));
|
|
267
|
+
});
|
|
268
|
+
PuiStatusChip.propTypes = {
|
|
269
|
+
status: _propTypes.default.oneOf(Object.keys(STATUS_CONFIG)),
|
|
270
|
+
children: _propTypes.default.node
|
|
271
|
+
};
|
|
141
272
|
PuiChip.propTypes = {
|
|
142
273
|
id: _propTypes.default.string,
|
|
143
274
|
className: _propTypes.default.string,
|
|
144
275
|
sx: _propTypes.default.object,
|
|
276
|
+
color: _propTypes.default.oneOf(["primary", "secondary", "info", "success", "warning", "error"]),
|
|
277
|
+
variant: _propTypes.default.oneOf(["filled", "outlined"]),
|
|
278
|
+
size: _propTypes.default.oneOf(["small", "medium", "large"]),
|
|
145
279
|
fullWidth: _propTypes.default.bool,
|
|
146
|
-
|
|
280
|
+
clickable: _propTypes.default.bool,
|
|
281
|
+
onClick: _propTypes.default.func,
|
|
282
|
+
status: _propTypes.default.oneOf(Object.keys(STATUS_CONFIG))
|
|
147
283
|
};
|
|
148
284
|
PuiChip.defaultProps = {
|
|
149
|
-
color: "primary"
|
|
285
|
+
color: "primary",
|
|
286
|
+
variant: "filled",
|
|
287
|
+
size: "medium",
|
|
288
|
+
fullWidth: false,
|
|
289
|
+
clickable: false
|
|
150
290
|
};
|
|
151
291
|
var _default = exports.default = PuiChip;
|
|
@@ -21,7 +21,7 @@ var _antd = require("antd");
|
|
|
21
21
|
var _icons = require("@ant-design/icons");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
const _excluded = ["field", "headerName", "width", "renderCell", "sortable", "align"],
|
|
24
|
-
_excluded2 = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange", "stickyColumns", "pinnedColumns", "getRowId", "onSelectionModelChange", "selectionModel", "onRowClick", "highlightHoveredRow", "stickyHeader", "hideFooter", "hideFooterPagination", "components", "componentsProps", "getRowClassName", "onActionClick"];
|
|
24
|
+
_excluded2 = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "load", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange", "stickyColumns", "pinnedColumns", "getRowId", "onSelectionModelChange", "selectionModel", "onRowClick", "highlightHoveredRow", "stickyHeader", "hideFooter", "hideFooterPagination", "components", "componentsProps", "getRowClassName", "onActionClick", "rowHeight"];
|
|
25
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
26
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -32,7 +32,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
32
32
|
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; }
|
|
33
33
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
34
34
|
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); } // Styles personnalisés pour le tableau
|
|
35
|
-
const tableCustomStyles = "\n /* Styles g\xE9n\xE9raux du tableau - inspir\xE9 du design de r\xE9f\xE9rence */\n .pui-table {\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);\n background-color: #ffffff;\n }\n \n .pui-table .ant-table {\n border-radius: 8px;\n }\n \n /* En-t\xEAtes de colonnes */\n .pui-table .ant-table-thead > tr > th {\n background-color: #f9fafb;\n color: #374151;\n font-weight: 600;\n font-size: 0.875rem;\n padding: 12px 16px;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s;\n }\n \n .pui-table .ant-table-thead > tr > th:hover {\n background-color: #f3f4f6;\n }\n \n /* Cellules du tableau */\n .pui-table .ant-table-tbody > tr > td {\n padding: 12px 16px;\n border-bottom: 1px solid #f3f4f6;\n color: #111827;\n font-size: 0.875rem;\n transition: background-color 0.2s ease;\n }\n \n /* Lignes altern\xE9es */\n .pui-table .ant-table-tbody > tr:nth-child(even) > td {\n background-color: #f9fafb;\n }\n \n .pui-table .ant-table-tbody > tr:nth-child(odd) > td {\n background-color: #ffffff;\n }\n \n /* Effet de survol */\n .pui-table .ant-table-tbody > tr:hover > td {\n background-color: #f3f4f6 !important;\n }\n \n /* Styles des lignes s\xE9lectionn\xE9es */\n .pui-table .ant-table-tbody > tr.ant-table-row-selected > td {\n background-color: rgba(59, 130, 246, 0.05);\n }\n \n .pui-table .ant-table-tbody > tr.ant-table-row-selected:hover > td {\n background-color: rgba(59, 130, 246, 0.1) !important;\n }\n \n /* Styles des statuts */\n .pui-table .status-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1.5;\n }\n \n .pui-table .status-badge.cancelled {\n background-color: #fee2e2;\n color: #b91c1c;\n }\n \n .pui-table .status-badge.delivered {\n background-color: #dcfce7;\n color: #15803d;\n }\n \n .pui-table .status-badge.ready {\n background-color: #e0f2fe;\n color: #0369a1;\n }\n \n .pui-table .status-badge.on-the-way {\n background-color: #fef3c7;\n color: #92400e;\n }\n \n /* Pagination */\n .pui-table-pagination {\n padding: 12px 16px;\n border-top: 1px solid #f3f4f6;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n \n .pui-table-pagination .ant-pagination {\n margin: 0;\n }\n \n .pui-table-pagination .ant-pagination-item,\n .pui-table-pagination .ant-pagination-prev button,\n .pui-table-pagination .ant-pagination-next button {\n border-radius: 6px;\n border: 1px solid #e5e7eb;\n height: 32px;\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .pui-table-pagination .ant-pagination-item:hover,\n .pui-table-pagination .ant-pagination-prev:hover button,\n .pui-table-pagination .ant-pagination-next:hover button {\n border-color: #d1d5db;\n color: #4b5563;\n }\n \n .pui-table-pagination .ant-pagination-item-active {\n background-color: #3b82f6;\n border-color: #3b82f6;\n }\n \n .pui-table-pagination .ant-pagination-item-active a {\n color: white;\n }\n \n .pui-table-pagination .ant-pagination-item-active:hover {\n background-color: #2563eb;\n border-color: #2563eb;\n }\n \n /* Styles pour la colonne d'actions */\n .pui-table .actions-column {\n white-space: nowrap !important;\n overflow: visible !important;\n }\n \n .pui-table .action-button {\n padding: 4px 8px !important;\n margin: 0 2px !important;\n min-width: auto !important;\n height: 28px !important;\n line-height: 20px !important;\n transition: all 0.2s !important;\n }\n \n .pui-table .action-button:hover {\n background-color: rgba(24, 144, 255, 0.1) !important;\n color: #1890ff !important;\n }\n \n /* Bouton Cr\xE9er */\n .pui-create-button {\n background-color: #3b82f6;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 8px 16px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: all 0.2s;\n }\n \n .pui-create-button:hover {\n background-color: #2563eb;\n }\n \n /* Titre de la page */\n .pui-table-title {\n font-size: 1.5rem;\n font-weight: 600;\n color: #111827;\n margin-bottom: 16px;\n }\n";
|
|
35
|
+
const tableCustomStyles = "\n /* Styles g\xE9n\xE9raux du tableau - inspir\xE9 du design de r\xE9f\xE9rence */\n .pui-table {\n border-radius: 8px;\n overflow: hidden;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);\n background-color: #ffffff;\n }\n \n .pui-table .ant-table {\n border-radius: 8px;\n }\n \n /* En-t\xEAtes de colonnes */\n .pui-table .ant-table-thead > tr > th {\n background-color: #f9fafb;\n color: #374151;\n font-weight: 600;\n font-size: 0.875rem;\n padding: 12px 16px;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s;\n }\n \n .pui-table .ant-table-thead > tr > th:hover {\n background-color: #f3f4f6;\n }\n \n /* Cellules du tableau */\n .pui-table .ant-table-tbody > tr > td {\n padding: 12px 16px;\n border-bottom: 1px solid #f3f4f6;\n color: #111827;\n font-size: 0.875rem;\n transition: background-color 0.2s ease;\n white-space: normal !important;\n word-wrap: break-word !important;\n word-break: break-word !important;\n max-width: 300px;\n overflow: visible;\n line-height: 1.5;\n }\n \n /* Lignes altern\xE9es */\n .pui-table .ant-table-tbody > tr:nth-child(even) > td {\n background-color: #f9fafb;\n }\n \n .pui-table .ant-table-tbody > tr:nth-child(odd) > td {\n background-color: #ffffff;\n }\n \n /* Effet de survol */\n .pui-table .ant-table-tbody > tr:hover > td {\n background-color: #f3f4f6 !important;\n }\n \n /* Styles des lignes s\xE9lectionn\xE9es */\n .pui-table .ant-table-tbody > tr.ant-table-row-selected > td {\n background-color: rgba(59, 130, 246, 0.05);\n }\n \n .pui-table .ant-table-tbody > tr.ant-table-row-selected:hover > td {\n background-color: rgba(59, 130, 246, 0.1) !important;\n }\n \n /* Styles des statuts */\n .pui-table .status-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 0.75rem;\n font-weight: 500;\n line-height: 1.5;\n }\n \n .pui-table .status-badge.cancelled {\n background-color: #fee2e2;\n color: #b91c1c;\n }\n \n .pui-table .status-badge.delivered {\n background-color: #dcfce7;\n color: #15803d;\n }\n \n .pui-table .status-badge.ready {\n background-color: #e0f2fe;\n color: #0369a1;\n }\n \n .pui-table .status-badge.on-the-way {\n background-color: #fef3c7;\n color: #92400e;\n }\n \n /* Pagination */\n .pui-table-pagination {\n padding: 12px 16px;\n border-top: 1px solid #f3f4f6;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n \n .pui-table-pagination .ant-pagination {\n margin: 0;\n }\n \n .pui-table-pagination .ant-pagination-item,\n .pui-table-pagination .ant-pagination-prev button,\n .pui-table-pagination .ant-pagination-next button {\n border-radius: 6px;\n border: 1px solid #e5e7eb;\n height: 32px;\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n \n .pui-table-pagination .ant-pagination-item:hover,\n .pui-table-pagination .ant-pagination-prev:hover button,\n .pui-table-pagination .ant-pagination-next:hover button {\n border-color: #d1d5db;\n color: #4b5563;\n }\n \n .pui-table-pagination .ant-pagination-item-active {\n background-color: #3b82f6;\n border-color: #3b82f6;\n }\n \n .pui-table-pagination .ant-pagination-item-active a {\n color: white;\n }\n \n .pui-table-pagination .ant-pagination-item-active:hover {\n background-color: #2563eb;\n border-color: #2563eb;\n }\n \n /* Styles pour la colonne d'actions */\n .pui-table .actions-column {\n white-space: nowrap !important;\n overflow: visible !important;\n }\n \n .pui-table .action-button {\n padding: 4px 8px !important;\n margin: 0 2px !important;\n min-width: auto !important;\n height: 28px !important;\n line-height: 20px !important;\n transition: all 0.2s !important;\n }\n \n .pui-table .action-button:hover {\n background-color: rgba(24, 144, 255, 0.1) !important;\n color: #1890ff !important;\n }\n \n /* Bouton Cr\xE9er */\n .pui-create-button {\n background-color: #3b82f6;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 8px 16px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: all 0.2s;\n }\n \n .pui-create-button:hover {\n background-color: #2563eb;\n }\n \n /* Titre de la page */\n .pui-table-title {\n font-size: 1.5rem;\n font-weight: 600;\n color: #111827;\n margin-bottom: 16px;\n }\n";
|
|
36
36
|
|
|
37
37
|
// Injection des styles dans le document
|
|
38
38
|
const injectStyles = () => {
|
|
@@ -171,6 +171,33 @@ const convertColumns = (columns, onActionClick, actions) => {
|
|
|
171
171
|
align
|
|
172
172
|
} = column,
|
|
173
173
|
rest = _objectWithoutProperties(column, _excluded);
|
|
174
|
+
|
|
175
|
+
// Fonction de rendu par défaut pour gérer les textes longs
|
|
176
|
+
const defaultRender = (text, record) => {
|
|
177
|
+
if (text === null || text === undefined) return "-";
|
|
178
|
+
const textStr = String(text);
|
|
179
|
+
const shouldShowTooltip = textStr.length > 30;
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
181
|
+
title: shouldShowTooltip ? textStr : "",
|
|
182
|
+
placement: "topLeft",
|
|
183
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
184
|
+
style: {
|
|
185
|
+
whiteSpace: 'normal',
|
|
186
|
+
wordWrap: 'break-word',
|
|
187
|
+
wordBreak: 'break-word',
|
|
188
|
+
overflow: 'hidden',
|
|
189
|
+
textOverflow: 'ellipsis',
|
|
190
|
+
lineHeight: '1.5',
|
|
191
|
+
maxHeight: '4.5em',
|
|
192
|
+
// Environ 3 lignes
|
|
193
|
+
display: '-webkit-box',
|
|
194
|
+
WebkitLineClamp: 3,
|
|
195
|
+
WebkitBoxOrient: 'vertical'
|
|
196
|
+
},
|
|
197
|
+
children: textStr
|
|
198
|
+
})
|
|
199
|
+
});
|
|
200
|
+
};
|
|
174
201
|
return _objectSpread({
|
|
175
202
|
title: headerName,
|
|
176
203
|
dataIndex: field,
|
|
@@ -181,7 +208,7 @@ const convertColumns = (columns, onActionClick, actions) => {
|
|
|
181
208
|
render: renderCell ? (text, record) => renderCell({
|
|
182
209
|
row: record,
|
|
183
210
|
value: text
|
|
184
|
-
}) :
|
|
211
|
+
}) : defaultRender
|
|
185
212
|
}, rest);
|
|
186
213
|
});
|
|
187
214
|
|
|
@@ -377,6 +404,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
377
404
|
pageSize,
|
|
378
405
|
checkboxSelection,
|
|
379
406
|
loading,
|
|
407
|
+
load,
|
|
380
408
|
stripped,
|
|
381
409
|
actions,
|
|
382
410
|
oneActionOnly,
|
|
@@ -396,7 +424,8 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
396
424
|
components,
|
|
397
425
|
componentsProps,
|
|
398
426
|
getRowClassName,
|
|
399
|
-
onActionClick
|
|
427
|
+
onActionClick,
|
|
428
|
+
rowHeight = 'auto'
|
|
400
429
|
} = _ref3,
|
|
401
430
|
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
402
431
|
// Convertir les colonnes au format Ant Design
|
|
@@ -448,6 +477,12 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
448
477
|
boxShadow: '0 2px 8px rgba(0,0,0,0.07)'
|
|
449
478
|
} : {}), sx || {});
|
|
450
479
|
|
|
480
|
+
// Style pour les lignes du tableau
|
|
481
|
+
const rowStyle = {
|
|
482
|
+
height: rowHeight,
|
|
483
|
+
minHeight: rowHeight === 'auto' ? '60px' : rowHeight
|
|
484
|
+
};
|
|
485
|
+
|
|
451
486
|
// Injection des styles CSS personnalisés
|
|
452
487
|
React.useEffect(() => {
|
|
453
488
|
injectStyles();
|
|
@@ -508,7 +543,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
508
543
|
}
|
|
509
544
|
},
|
|
510
545
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Spin, {
|
|
511
|
-
spinning: loading,
|
|
546
|
+
spinning: loading || load,
|
|
512
547
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Table, _objectSpread({
|
|
513
548
|
ref: ref,
|
|
514
549
|
id: id,
|
|
@@ -530,7 +565,9 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
530
565
|
if (record.isEditing) className += ' ant-table-row-editing';
|
|
531
566
|
return className;
|
|
532
567
|
},
|
|
533
|
-
onRow: getRowProps
|
|
568
|
+
onRow: record => _objectSpread(_objectSpread({}, getRowProps(record)), {}, {
|
|
569
|
+
style: rowStyle
|
|
570
|
+
})
|
|
534
571
|
}, rest)), !hideFooter && !hideFooterPagination && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
535
572
|
className: "pui-table-pagination",
|
|
536
573
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiTablePagination, {
|
|
@@ -569,6 +606,7 @@ PuiTable.propTypes = {
|
|
|
569
606
|
checkboxSelection: _propTypes.default.bool,
|
|
570
607
|
paginationMode: _propTypes.default.oneOf(["client", "server", "none"]),
|
|
571
608
|
loading: _propTypes.default.bool,
|
|
609
|
+
load: _propTypes.default.bool,
|
|
572
610
|
onSelect: _propTypes.default.func,
|
|
573
611
|
onPageChange: _propTypes.default.func,
|
|
574
612
|
onPageSizeChange: _propTypes.default.func,
|
|
@@ -585,7 +623,8 @@ PuiTable.propTypes = {
|
|
|
585
623
|
components: _propTypes.default.object,
|
|
586
624
|
componentsProps: _propTypes.default.object,
|
|
587
625
|
getRowClassName: _propTypes.default.func,
|
|
588
|
-
onActionClick: _propTypes.default.func
|
|
626
|
+
onActionClick: _propTypes.default.func,
|
|
627
|
+
rowHeight: _propTypes.default.string
|
|
589
628
|
};
|
|
590
629
|
PuiTable.defaultProps = {
|
|
591
630
|
oneActionOnly: false,
|
|
@@ -608,7 +647,10 @@ PuiTable.defaultProps = {
|
|
|
608
647
|
components: null,
|
|
609
648
|
componentsProps: null,
|
|
610
649
|
getRowClassName: null,
|
|
611
|
-
onActionClick: null
|
|
650
|
+
onActionClick: null,
|
|
651
|
+
rowHeight: 'auto',
|
|
652
|
+
loading: false,
|
|
653
|
+
load: false
|
|
612
654
|
};
|
|
613
655
|
|
|
614
656
|
// Composant pour l'en-tête de la table avec titre et bouton de création
|