@portnet/ui 0.1.38 → 0.1.40
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.
|
@@ -13,11 +13,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var React = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _apperance = require("../../config/apperance");
|
|
15
15
|
var _PuiTooltip = _interopRequireDefault(require("./PuiTooltip"));
|
|
16
|
-
var _CheckCircle = _interopRequireDefault(require("@mui/icons-material/CheckCircle"));
|
|
17
|
-
var _Error = _interopRequireDefault(require("@mui/icons-material/Error"));
|
|
18
|
-
var _HourglassEmpty = _interopRequireDefault(require("@mui/icons-material/HourglassEmpty"));
|
|
19
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["id", "className", "sx", "color", "fullWidth", "children"
|
|
17
|
+
const _excluded = ["id", "className", "sx", "color", "fullWidth", "children"];
|
|
21
18
|
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); }
|
|
22
19
|
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 && Object.prototype.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; }
|
|
23
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -49,23 +46,6 @@ const PrimaryChip = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, r
|
|
|
49
46
|
}
|
|
50
47
|
};
|
|
51
48
|
});
|
|
52
|
-
const iconMapping = {
|
|
53
|
-
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
|
|
54
|
-
style: {
|
|
55
|
-
color: 'white'
|
|
56
|
-
}
|
|
57
|
-
}),
|
|
58
|
-
error: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Error.default, {
|
|
59
|
-
style: {
|
|
60
|
-
color: 'white'
|
|
61
|
-
}
|
|
62
|
-
}),
|
|
63
|
-
info: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HourglassEmpty.default, {
|
|
64
|
-
style: {
|
|
65
|
-
color: 'white'
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
};
|
|
69
49
|
const SecondaryChip = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledChip, _objectSpread({
|
|
70
50
|
ref: ref
|
|
71
51
|
}, props))))(() => {
|
|
@@ -137,8 +117,7 @@ const PuiChip = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
137
117
|
sx,
|
|
138
118
|
color,
|
|
139
119
|
fullWidth,
|
|
140
|
-
children
|
|
141
|
-
icon
|
|
120
|
+
children
|
|
142
121
|
} = _ref,
|
|
143
122
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
144
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTooltip.default, {
|
|
@@ -153,10 +132,7 @@ const PuiChip = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
153
132
|
width: fullWidth ? "100%" : "fit-content"
|
|
154
133
|
}),
|
|
155
134
|
className,
|
|
156
|
-
label: children
|
|
157
|
-
icon: icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
158
|
-
children: iconMapping[icon]
|
|
159
|
-
}) : null
|
|
135
|
+
label: children
|
|
160
136
|
}, rest))
|
|
161
137
|
});
|
|
162
138
|
});
|
|
@@ -165,8 +141,7 @@ PuiChip.propTypes = {
|
|
|
165
141
|
className: _propTypes.default.string,
|
|
166
142
|
sx: _propTypes.default.object,
|
|
167
143
|
fullWidth: _propTypes.default.bool,
|
|
168
|
-
color: _propTypes.default.oneOf(["primary", "secondary", "info", "success", "warning", "error"])
|
|
169
|
-
icon: _propTypes.default.oneOf(["success", "error", "info"]) // Prop icon pour spécifier l'icône
|
|
144
|
+
color: _propTypes.default.oneOf(["primary", "secondary", "info", "success", "warning", "error"])
|
|
170
145
|
};
|
|
171
146
|
PuiChip.defaultProps = {
|
|
172
147
|
color: "primary"
|
|
@@ -32,166 +32,21 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
32
32
|
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; }
|
|
33
33
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
34
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
35
|
-
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); }
|
|
35
|
+
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 for your DataGrid
|
|
36
36
|
const StyledMuiTable = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.DataGrid, _objectSpread({
|
|
37
37
|
ref: ref
|
|
38
|
-
}, props))))(() =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
display: "flex"
|
|
45
|
-
},
|
|
46
|
-
"& .MuiDataGrid-columnHeaderTitleContainer": {
|
|
47
|
-
justifyContent: "center"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"&.elevate": {
|
|
51
|
-
boxShadow: "0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%)"
|
|
52
|
-
},
|
|
53
|
-
backgroundColor: _apperance.palette.gray.light,
|
|
54
|
-
border: "2px solid ".concat(_apperance.palette.gray.dark),
|
|
55
|
-
"& .MuiPaginationItem-root": {
|
|
56
|
-
"&.Mui-selected": {
|
|
57
|
-
color: _apperance.palette.white,
|
|
58
|
-
backgroundColor: _apperance.palette.primary
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"& .table-stripped .MuiDataGrid-row": {
|
|
62
|
-
"&:nth-of-type(even)": {
|
|
63
|
-
backgroundColor: _apperance.palette.gray.light
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"& .MuiLinearProgress-root": {
|
|
67
|
-
zIndex: 1,
|
|
68
|
-
backgroundColor: _apperance.palette.info,
|
|
69
|
-
"& .MuiLinearProgress-bar": {
|
|
70
|
-
backgroundColor: _apperance.palette.primary
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"& .MuiDataGrid-columnHeaders": {
|
|
74
|
-
"& .MuiDataGrid-columnHeader": {
|
|
75
|
-
"& .MuiDataGrid-columnHeaderTitle": {
|
|
76
|
-
display: "flex",
|
|
77
|
-
alignItems: "center",
|
|
78
|
-
fontWeight: "600",
|
|
79
|
-
color: _apperance.palette.primary,
|
|
80
|
-
whiteSpace: "normal",
|
|
81
|
-
lineHeight: "1.2em"
|
|
82
|
-
},
|
|
83
|
-
"&:focus-within": {
|
|
84
|
-
outline: "none"
|
|
85
|
-
},
|
|
86
|
-
"&:last-of-type .MuiDataGrid-columnSeparator": {
|
|
87
|
-
display: "none"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"& .MuiDataGrid-columnSeparator": {
|
|
91
|
-
color: _apperance.palette.gray.dark
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"& .MuiDataGrid-cell": {
|
|
95
|
-
paddingTop: "2px",
|
|
96
|
-
paddingBottom: "2px",
|
|
97
|
-
whiteSpace: "normal",
|
|
98
|
-
textOverflow: "ellipsis",
|
|
99
|
-
overflow: "hidden",
|
|
100
|
-
maxHeight: "none",
|
|
101
|
-
minWidth: "maxWidth",
|
|
102
|
-
wordBreak: "break-word",
|
|
103
|
-
"&.tableAction": {
|
|
104
|
-
justifyContent: "center",
|
|
105
|
-
position: "relative",
|
|
106
|
-
overflow: "initial !important"
|
|
107
|
-
},
|
|
108
|
-
"&:focus-within": {
|
|
109
|
-
outline: "none"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
"& .MuiDataGrid-row": {
|
|
113
|
-
maxHeight: "none !important",
|
|
114
|
-
"&:nth-of-type(odd)": {
|
|
115
|
-
backgroundColor: "#ffffff" // color for odd rows
|
|
116
|
-
},
|
|
117
|
-
"&:nth-of-type(even)": {
|
|
118
|
-
backgroundColor: "#F6F9FF" // color for even rows
|
|
119
|
-
},
|
|
120
|
-
"&:hover": {
|
|
121
|
-
backgroundColor: "#95C7FC"
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"& .MuiDataGrid-virtualScrollerContent": {
|
|
125
|
-
"& .MuiDataGrid-row": {
|
|
126
|
-
maxHeight: "none !important"
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"& .MuiDataGrid-virtualScroller": {
|
|
130
|
-
backgroundColor: _apperance.palette.white
|
|
131
|
-
},
|
|
132
|
-
"& .MuiDataGrid-footerContainer": {
|
|
133
|
-
backgroundColor: _apperance.palette.white,
|
|
134
|
-
height: "28px",
|
|
135
|
-
minHeight: "28px"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}));
|
|
139
|
-
const localeText = {
|
|
140
|
-
noRowsLabel: "Aucune ligne",
|
|
141
|
-
footerRowSelected: count => count !== 1 ? "".concat(count.toLocaleString(), " lignes s\xE9lectionn\xE9es") : "".concat(count.toLocaleString(), " ligne s\xE9lectionn\xE9e"),
|
|
142
|
-
footerTotalVisibleRows: (visibleCount, totalCount) => "".concat(visibleCount.toLocaleString(), " de ").concat(totalCount.toLocaleString()),
|
|
143
|
-
MuiTablePagination: {
|
|
144
|
-
labelDisplayedRows: _ref => {
|
|
145
|
-
let {
|
|
146
|
-
from,
|
|
147
|
-
to,
|
|
148
|
-
count
|
|
149
|
-
} = _ref;
|
|
150
|
-
return "".concat(from, "\u2013").concat(to, " de ").concat(count !== -1 ? count : "plus que ".concat(to));
|
|
151
|
-
},
|
|
152
|
-
labelRowsPerPage: "Lignes par page"
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const TablePagination = () => {
|
|
156
|
-
const apiRef = (0, _xDataGrid.useGridApiContext)();
|
|
157
|
-
const page = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridPageSelector);
|
|
158
|
-
const pageCount = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridPageCountSelector);
|
|
159
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
|
|
160
|
-
size: "small",
|
|
161
|
-
sx: {
|
|
162
|
-
position: "absolute",
|
|
163
|
-
left: "50%",
|
|
164
|
-
transform: "translateX(-50%)",
|
|
165
|
-
"& .MuiButtonBase-root": {
|
|
166
|
-
lineHeight: "1em",
|
|
167
|
-
fontSize: "1em",
|
|
168
|
-
minWidth: "20px",
|
|
169
|
-
height: "20px"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
count: pageCount,
|
|
173
|
-
page: page + 1,
|
|
174
|
-
onChange: (event, value) => apiRef.current.setPage(value - 1),
|
|
175
|
-
showFirstButton: true,
|
|
176
|
-
showLastButton: true
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
const TableCheckbox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
180
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiCheckbox.default, _objectSpread(_objectSpread({
|
|
181
|
-
ref: ref
|
|
182
|
-
}, props), {}, {
|
|
183
|
-
formik: false,
|
|
184
|
-
sx: {
|
|
185
|
-
transform: "scale(.6)",
|
|
186
|
-
marginTop: "-4px"
|
|
38
|
+
}, props))))(() => {
|
|
39
|
+
return {
|
|
40
|
+
"&.MuiDataGrid-root": {
|
|
41
|
+
fontSize: ".8em",
|
|
42
|
+
backgroundColor: _apperance.palette.gray.light,
|
|
43
|
+
border: "2px solid ".concat(_apperance.palette.gray.dark)
|
|
187
44
|
}
|
|
188
|
-
}
|
|
45
|
+
};
|
|
189
46
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
};
|
|
194
|
-
const PuiTable = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
47
|
+
|
|
48
|
+
// Define the table component
|
|
49
|
+
const PuiTable = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
195
50
|
let {
|
|
196
51
|
id,
|
|
197
52
|
className,
|
|
@@ -212,24 +67,27 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
212
67
|
onPageChange,
|
|
213
68
|
onPageSizeChange,
|
|
214
69
|
rowDetailPanel
|
|
215
|
-
} =
|
|
216
|
-
rest = _objectWithoutProperties(
|
|
70
|
+
} = _ref,
|
|
71
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
217
72
|
const [expandedRows, setExpandedRows] = React.useState({});
|
|
73
|
+
|
|
74
|
+
// Toggle row expansion
|
|
218
75
|
const toggleRowExpansion = rowId => {
|
|
219
|
-
setExpandedRows(
|
|
220
|
-
[rowId]: !
|
|
76
|
+
setExpandedRows(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
77
|
+
[rowId]: !prev[rowId]
|
|
221
78
|
}));
|
|
222
79
|
};
|
|
80
|
+
|
|
81
|
+
// Render the detail panel for expanded rows
|
|
223
82
|
const renderRowDetails = row => {
|
|
224
|
-
console.log("row ==", row);
|
|
225
|
-
if (!row) return null; // Ensure row exists
|
|
226
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
|
|
227
84
|
in: expandedRows[row.id],
|
|
228
85
|
timeout: "auto",
|
|
229
86
|
unmountOnExit: true,
|
|
230
87
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
|
|
231
88
|
sx: {
|
|
232
|
-
padding: 2
|
|
89
|
+
padding: 2,
|
|
90
|
+
backgroundColor: "#f9f9f9"
|
|
233
91
|
},
|
|
234
92
|
children: rowDetailPanel && /*#__PURE__*/React.cloneElement(rowDetailPanel, {
|
|
235
93
|
rowData: row
|
|
@@ -237,15 +95,17 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
237
95
|
})
|
|
238
96
|
});
|
|
239
97
|
};
|
|
98
|
+
|
|
99
|
+
// Add an extra column for the expand/collapse button
|
|
240
100
|
const appColumns = React.useMemo(() => [{
|
|
241
101
|
field: "expand",
|
|
242
102
|
headerName: "",
|
|
243
103
|
sortable: false,
|
|
244
104
|
width: 50,
|
|
245
|
-
renderCell:
|
|
105
|
+
renderCell: _ref2 => {
|
|
246
106
|
let {
|
|
247
107
|
row
|
|
248
|
-
} =
|
|
108
|
+
} = _ref2;
|
|
249
109
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
250
110
|
"aria-label": "expand row",
|
|
251
111
|
size: "small",
|
|
@@ -253,7 +113,8 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
253
113
|
children: expandedRows[row.id] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyboardArrowUp.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyboardArrowDown.default, {})
|
|
254
114
|
});
|
|
255
115
|
}
|
|
256
|
-
}, ...columns
|
|
116
|
+
}, ...columns // Spread the existing columns
|
|
117
|
+
], [columns, expandedRows]);
|
|
257
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
258
119
|
style: {
|
|
259
120
|
width: "100%"
|
|
@@ -262,9 +123,9 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
262
123
|
ref: ref,
|
|
263
124
|
id: id,
|
|
264
125
|
components: {
|
|
265
|
-
BaseCheckbox:
|
|
126
|
+
BaseCheckbox: _PuiCheckbox.default,
|
|
266
127
|
LoadingOverlay: _material.LinearProgress,
|
|
267
|
-
Pagination:
|
|
128
|
+
Pagination: _material.Pagination
|
|
268
129
|
},
|
|
269
130
|
className: "".concat(className, " ").concat(stripped ? "table-stripped" : "", " ").concat(loading ? "table-loading" : "", " ").concat(elevate ? "elevate" : ""),
|
|
270
131
|
sx: {
|
|
@@ -290,12 +151,25 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
290
151
|
density: "compact",
|
|
291
152
|
loading: loading,
|
|
292
153
|
paginationMode: paginationMode,
|
|
293
|
-
localeText:
|
|
294
|
-
|
|
154
|
+
localeText: {
|
|
155
|
+
noRowsLabel: "Aucune ligne",
|
|
156
|
+
footerRowSelected: count => count !== 1 ? "".concat(count.toLocaleString(), " lignes s\xE9lectionn\xE9es") : "".concat(count.toLocaleString(), " ligne s\xE9lectionn\xE9e"),
|
|
157
|
+
footerTotalVisibleRows: (visibleCount, totalCount) => "".concat(visibleCount.toLocaleString(), " de ").concat(totalCount.toLocaleString()),
|
|
158
|
+
MuiTablePagination: {
|
|
159
|
+
labelDisplayedRows: _ref3 => {
|
|
160
|
+
let {
|
|
161
|
+
from,
|
|
162
|
+
to,
|
|
163
|
+
count
|
|
164
|
+
} = _ref3;
|
|
165
|
+
return "".concat(from, "\u2013").concat(to, " de ").concat(count !== -1 ? count : "plus que ".concat(to));
|
|
166
|
+
},
|
|
167
|
+
labelRowsPerPage: "Lignes par page"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
295
170
|
onPageChange: onPageChange,
|
|
296
171
|
onPageSizeChange: onPageSizeChange,
|
|
297
|
-
onSelectionModelChange: onSelect
|
|
298
|
-
autosizeOptions: autosizeOptions
|
|
172
|
+
onSelectionModelChange: onSelect
|
|
299
173
|
}, rest)), rows.map(row => /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
300
174
|
children: expandedRows[row.id] && renderRowDetails(row)
|
|
301
175
|
}, row.id))]
|
|
@@ -320,7 +194,6 @@ PuiTable.propTypes = {
|
|
|
320
194
|
onSelect: _propTypes.default.func,
|
|
321
195
|
onPageChange: _propTypes.default.func,
|
|
322
196
|
onPageSizeChange: _propTypes.default.func,
|
|
323
|
-
onSelectionModelChange: _propTypes.default.func,
|
|
324
197
|
rowDetailPanel: _propTypes.default.element
|
|
325
198
|
};
|
|
326
199
|
PuiTable.defaultProps = {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
3
|
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
require("core-js/modules/
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
require("core-js/modules/es.symbol.description.js");
|
|
12
10
|
var _formik = require("formik");
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _PuiButton = _interopRequireDefault(require("../../../buttons/PuiButton"));
|
|
14
14
|
var _PuiFormikForm = _interopRequireDefault(require("../../../others/PuiFormikForm"));
|
|
15
15
|
var _PuiGrid = _interopRequireDefault(require("../../../others/PuiGrid"));
|
|
@@ -17,18 +17,15 @@ var _PuiIcon = _interopRequireDefault(require("../../../others/PuiIcon"));
|
|
|
17
17
|
var _PuiSection = _interopRequireDefault(require("../../../others/PuiSection"));
|
|
18
18
|
var _PuiTable = _interopRequireDefault(require("../../../table/PuiTable"));
|
|
19
19
|
var _PuiDefaultPage = _interopRequireDefault(require("./PuiDefaultPage"));
|
|
20
|
-
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
21
|
-
var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
|
|
22
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
21
|
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); }
|
|
25
22
|
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 && Object.prototype.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; }
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
24
|
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; }
|
|
27
25
|
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; }
|
|
28
26
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
27
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
30
|
-
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); }
|
|
31
|
-
// Arrow for expanded state
|
|
28
|
+
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); }
|
|
32
29
|
const PuiStandardSearchPageContainer = _ref => {
|
|
33
30
|
let {
|
|
34
31
|
actions,
|
|
@@ -64,14 +61,8 @@ const PuiSearchPage = _ref2 => {
|
|
|
64
61
|
onReset,
|
|
65
62
|
onSubmit,
|
|
66
63
|
children: _children,
|
|
67
|
-
additionalActions
|
|
68
|
-
collapsibleSearchSection = true // Collapsible by default
|
|
64
|
+
additionalActions
|
|
69
65
|
} = _ref2;
|
|
70
|
-
// Start with the section collapsed (not displayed on first render)
|
|
71
|
-
const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
|
|
72
|
-
const toggleSearchSection = () => {
|
|
73
|
-
setSearchSectionExpanded(prev => !prev);
|
|
74
|
-
};
|
|
75
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
|
|
76
67
|
title: title,
|
|
77
68
|
titleIcon: titleIcon,
|
|
@@ -83,129 +74,102 @@ const PuiSearchPage = _ref2 => {
|
|
|
83
74
|
retour: retour,
|
|
84
75
|
onRetour: onRetour,
|
|
85
76
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
|
|
86
|
-
title:
|
|
87
|
-
onClick: toggleSearchSection,
|
|
88
|
-
style: {
|
|
89
|
-
display: "flex",
|
|
90
|
-
alignItems: "center",
|
|
91
|
-
cursor: collapsibleSearchSection ? "pointer" : "default" // Clickable only if collapsibleSearchSection is true
|
|
92
|
-
},
|
|
93
|
-
children: [collapsibleSearchSection && (isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
94
|
-
style: {
|
|
95
|
-
marginLeft: collapsibleSearchSection ? "8px" : "0px"
|
|
96
|
-
},
|
|
97
|
-
children: "Param\xE8tres de recherche"
|
|
98
|
-
}), " "]
|
|
99
|
-
}),
|
|
77
|
+
title: "Param\xE8tres de recherche",
|
|
100
78
|
sx: {
|
|
101
79
|
marginBottom: 2
|
|
102
80
|
},
|
|
103
|
-
children:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
81
|
+
children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
82
|
+
initialValues: {}
|
|
83
|
+
}, formikProps), {}, {
|
|
84
|
+
children: _ref3 => {
|
|
85
|
+
let {
|
|
86
|
+
resetForm,
|
|
87
|
+
submitForm
|
|
88
|
+
} = _ref3;
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiFormikForm.default, {
|
|
90
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
|
|
91
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
92
|
+
container: true,
|
|
93
|
+
justifyContent: "end",
|
|
94
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
95
|
+
item: true,
|
|
96
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
97
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
98
|
+
type: "effacer",
|
|
99
|
+
size: "small"
|
|
100
|
+
}),
|
|
101
|
+
onClick: resetForm,
|
|
102
|
+
color: "tertiary",
|
|
103
|
+
children: "Effacer"
|
|
104
|
+
})
|
|
105
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
106
|
+
item: true,
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
108
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
109
|
+
type: "rechercher",
|
|
110
|
+
size: "small"
|
|
111
|
+
}),
|
|
112
|
+
onClick: submitForm,
|
|
113
|
+
loadingPosition: "start",
|
|
114
|
+
children: "Rechercher"
|
|
115
|
+
})
|
|
116
|
+
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
140
118
|
item: true,
|
|
141
119
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
142
120
|
startIcon: actionItem.icon,
|
|
143
121
|
onClick: actionItem.action,
|
|
144
122
|
children: actionItem.name
|
|
145
123
|
})
|
|
146
|
-
}, index)
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
})
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
})
|
|
124
|
+
}, index);
|
|
125
|
+
})]
|
|
126
|
+
}),
|
|
127
|
+
children: _children
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSearchPageContainer, {
|
|
132
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiGrid.default, {
|
|
133
|
+
container: true,
|
|
134
|
+
justifyContent: "end",
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
136
|
+
item: true,
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
138
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
139
|
+
type: "effacer",
|
|
140
|
+
size: "small"
|
|
141
|
+
}),
|
|
142
|
+
onClick: onReset,
|
|
143
|
+
color: "tertiary",
|
|
144
|
+
children: "Effacer"
|
|
145
|
+
})
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
147
|
+
item: true,
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
149
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
150
|
+
type: "rechercher",
|
|
151
|
+
size: "small"
|
|
152
|
+
}),
|
|
153
|
+
onClick: onSubmit,
|
|
154
|
+
loadingPosition: "start",
|
|
155
|
+
children: "Rechercher"
|
|
156
|
+
})
|
|
157
|
+
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
179
159
|
item: true,
|
|
180
160
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
181
161
|
startIcon: actionItem.icon,
|
|
182
162
|
onClick: actionItem.action,
|
|
183
163
|
children: actionItem.name
|
|
184
164
|
})
|
|
185
|
-
}, index)
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
|
|
165
|
+
}, index);
|
|
166
|
+
})]
|
|
167
|
+
}),
|
|
168
|
+
children: _children
|
|
189
169
|
})
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread({
|
|
191
171
|
paginationMode: "server"
|
|
192
|
-
}, tableProps)
|
|
193
|
-
sx: {
|
|
194
|
-
'& .MuiDataGrid-columnHeaders': {
|
|
195
|
-
backgroundColor: '#f5f5f5',
|
|
196
|
-
// Light gray background
|
|
197
|
-
fontWeight: 'bold',
|
|
198
|
-
textAlign: 'center',
|
|
199
|
-
padding: '10px 15px'
|
|
200
|
-
},
|
|
201
|
-
'& .MuiDataGrid-cell': {
|
|
202
|
-
padding: '8px 12px' // Adds padding for cells
|
|
203
|
-
},
|
|
204
|
-
'& .numeric-cell': {
|
|
205
|
-
textAlign: 'right' // Aligns numeric values to the right
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}))]
|
|
172
|
+
}, tableProps))]
|
|
209
173
|
});
|
|
210
174
|
};
|
|
211
175
|
PuiSearchPage.propTypes = {
|
|
@@ -227,13 +191,11 @@ PuiSearchPage.propTypes = {
|
|
|
227
191
|
name: _propTypes.default.string.isRequired,
|
|
228
192
|
action: _propTypes.default.func.isRequired,
|
|
229
193
|
icon: _propTypes.default.element
|
|
230
|
-
}))
|
|
231
|
-
collapsibleSearchSection: _propTypes.default.bool // New prop with default value
|
|
194
|
+
}))
|
|
232
195
|
};
|
|
233
196
|
PuiSearchPage.defaultProps = {
|
|
234
197
|
formik: true,
|
|
235
198
|
loading: false,
|
|
236
|
-
additionalActions: []
|
|
237
|
-
collapsibleSearchSection: true // Collapsible by default is true
|
|
199
|
+
additionalActions: []
|
|
238
200
|
};
|
|
239
201
|
var _default = exports.default = PuiSearchPage;
|