@portnet/ui 3.0.2 → 3.0.4
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 +136 -0
- package/dist/components/buttons/PuiIconButton.js +97 -0
- package/dist/components/common/PuiAlertContext.js +13 -0
- package/dist/components/common/StyledMuiButton.js +47 -0
- package/dist/components/common/StyledMuiTextField.js +120 -0
- package/dist/components/inputs/PuiAutocomplete.js +350 -0
- package/dist/components/inputs/PuiCheckbox.js +307 -0
- package/dist/components/inputs/PuiCheckboxGroup.js +213 -0
- package/dist/components/inputs/PuiCheckboxItem.js +161 -0
- package/dist/components/inputs/PuiDateField.js +279 -0
- package/dist/components/inputs/PuiDateTimeField.js +395 -0
- package/dist/components/inputs/PuiFileField.js +264 -0
- package/dist/components/inputs/PuiRadioGroup.js +196 -0
- package/dist/components/inputs/PuiRadioItem.js +99 -0
- package/dist/components/inputs/PuiSelect.js +357 -0
- package/dist/components/inputs/PuiTextField.js +262 -0
- package/dist/components/others/PuiBadge.js +56 -0
- package/dist/components/others/PuiChip.js +149 -0
- package/dist/components/others/PuiDialog.js +101 -0
- package/dist/components/others/PuiFormikForm.js +71 -0
- package/dist/components/others/PuiGrid.js +21 -0
- package/dist/components/others/PuiIcon.js +91 -0
- package/dist/components/others/PuiLoadingBackdrop.js +32 -0
- package/dist/components/others/PuiMainContainer.js +40 -0
- package/dist/components/others/PuiNavigation.js +67 -0
- package/dist/components/others/PuiSection.js +97 -0
- package/dist/components/others/PuiTooltip.js +85 -0
- package/dist/components/providers/PuiAlertProvider.js +132 -0
- package/dist/components/providers/PuiLocalizationProvider.js +32 -0
- package/dist/components/referentiel/common/ReferetielContext.js +13 -0
- package/dist/components/referentiel/common/constants/specificReferentielsApis.js +22 -0
- package/dist/components/referentiel/common/constants/specificReferentielsBaseColumns.js +691 -0
- package/dist/components/referentiel/common/constants/specificReferentielsBaseFilters.js +598 -0
- package/dist/components/referentiel/common/constants/specificReferentielsInitialValues.js +80 -0
- package/dist/components/referentiel/common/constants/specificReferentielsKeys.js +18 -0
- package/dist/components/referentiel/common/constants/specificReferentielsTitles.js +22 -0
- package/dist/components/referentiel/common/constants/specificReferentielsValidationSchemas.js +86 -0
- package/dist/components/referentiel/components/PuiBasePopupReferentielField.js +355 -0
- package/dist/components/referentiel/components/PuiCustomPopupReferentielField.js +180 -0
- package/dist/components/referentiel/components/PuiSimplePopupReferentielField.js +323 -0
- package/dist/components/referentiel/components/PuiSimpleReferentielField.js +201 -0
- package/dist/components/referentiel/components/PuiSpecificReferentielField.js +330 -0
- package/dist/components/referentiel/providers/PuiReferentielProvider.js +65 -0
- package/dist/components/tab/PuiTab.js +25 -0
- package/dist/components/tab/PuiTabs.js +145 -0
- package/dist/components/table/ActionPopover.js +54 -0
- package/dist/components/table/PuiTable.js +446 -0
- package/dist/components/table/PuiTableAction.js +63 -0
- package/dist/components/typography/PuiDefinition.js +42 -0
- package/dist/components/typography/PuiIndication.js +79 -0
- package/dist/components/typography/PuiMainTitle.js +85 -0
- package/dist/components/ui/dialogs/PuiSearchDialog.js +105 -0
- package/dist/components/ui/pages/errors/PuiErrorBasePage.js +73 -0
- package/dist/components/ui/pages/errors/PuiForbiddenErrorPage.js +36 -0
- package/dist/components/ui/pages/errors/PuiNetworkErrorPage.js +36 -0
- package/dist/components/ui/pages/errors/PuiNotFoundErrorPage.js +30 -0
- package/dist/components/ui/pages/errors/PuiServerErrorPage.js +37 -0
- package/dist/components/ui/pages/general/PuiDefaultPage.js +68 -0
- package/dist/components/ui/pages/general/PuiSearchPage.js +201 -0
- package/dist/config/apperance.js +26 -0
- package/dist/config/mapping.js +26 -0
- package/dist/config/referentiel.js +10 -0
- package/dist/general/yupValidationErrors.js +8 -0
- package/dist/hooks/useAlert.js +20 -0
- package/dist/hooks/useAxios.js +23 -0
- package/dist/hooks/useQuery.js +19 -0
- package/dist/index.js +335 -0
- package/package.json +1 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/es.symbol.description.js");
|
|
10
|
+
var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
|
|
11
|
+
var _material = require("@mui/material");
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _xDataGrid = require("@mui/x-data-grid");
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
var React = _interopRequireWildcard(require("react"));
|
|
16
|
+
var _apperance = require("../../config/apperance");
|
|
17
|
+
var _PuiCheckbox = _interopRequireDefault(require("../inputs/PuiCheckbox"));
|
|
18
|
+
var _PuiIcon = _interopRequireDefault(require("../others/PuiIcon"));
|
|
19
|
+
var _PuiTooltip = _interopRequireDefault(require("../others/PuiTooltip"));
|
|
20
|
+
var _PuiTableAction = _interopRequireDefault(require("./PuiTableAction"));
|
|
21
|
+
var _ActionPopover = _interopRequireDefault(require("./ActionPopover"));
|
|
22
|
+
var _system = require("@mui/system");
|
|
23
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
+
const _excluded = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange", "rowDetailPanel"];
|
|
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
|
+
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; }
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
29
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
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); }
|
|
35
|
+
const StyledMuiTable = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.DataGrid, _objectSpread({
|
|
36
|
+
ref: ref
|
|
37
|
+
}, props))))(() => {
|
|
38
|
+
return {
|
|
39
|
+
"&.MuiDataGrid-root": {
|
|
40
|
+
fontSize: ".8em",
|
|
41
|
+
"& .tableActionColumn": {
|
|
42
|
+
"& .MuiDataGrid-columnHeaderTitle": {
|
|
43
|
+
justifyContent: "center",
|
|
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-loading .MuiDataGrid-virtualScroller, &.table-loading .MuiDataGrid-footerContainer": {
|
|
62
|
+
filter: "blur(1px)",
|
|
63
|
+
"&::before": {
|
|
64
|
+
content: "''",
|
|
65
|
+
width: "100%",
|
|
66
|
+
height: "100%",
|
|
67
|
+
backgroundColor: _apperance.palette.white,
|
|
68
|
+
position: "absolute",
|
|
69
|
+
zIndex: 1,
|
|
70
|
+
display: "block",
|
|
71
|
+
opacity: 0
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"&.table-stripped .MuiDataGrid-row": {
|
|
75
|
+
"&:nth-of-type(even)": {
|
|
76
|
+
backgroundColor: _apperance.palette.gray.light
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"& .MuiLinearProgress-root": {
|
|
80
|
+
zIndex: 1,
|
|
81
|
+
backgroundColor: _apperance.palette.info,
|
|
82
|
+
"& .MuiLinearProgress-bar": {
|
|
83
|
+
backgroundColor: _apperance.palette.primary
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"& .MuiDataGrid-columnHeaders": {
|
|
87
|
+
"& .MuiDataGrid-columnHeader": {
|
|
88
|
+
"& .MuiDataGrid-columnHeaderTitle": {
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
fontWeight: "600",
|
|
92
|
+
color: _apperance.palette.primary,
|
|
93
|
+
whiteSpace: "normal",
|
|
94
|
+
lineHeight: "1.2em"
|
|
95
|
+
},
|
|
96
|
+
"&:focus-within": {
|
|
97
|
+
outline: "none"
|
|
98
|
+
},
|
|
99
|
+
"&:last-of-type .MuiDataGrid-columnSeparator": {
|
|
100
|
+
display: "none"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"& .MuiDataGrid-columnSeparator": {
|
|
104
|
+
color: _apperance.palette.gray.dark
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"& .MuiDataGrid-cell": {
|
|
108
|
+
paddingTop: "2px",
|
|
109
|
+
paddingBottom: "2px",
|
|
110
|
+
whiteSpace: "normal",
|
|
111
|
+
textOverflow: "ellipsis",
|
|
112
|
+
overflow: "hidden",
|
|
113
|
+
maxHeight: "none",
|
|
114
|
+
minWidth: 'maxWidth',
|
|
115
|
+
wordBreak: "break-word",
|
|
116
|
+
"&.tableAction": {
|
|
117
|
+
justifyContent: "center",
|
|
118
|
+
position: "relative",
|
|
119
|
+
overflow: "initial !important"
|
|
120
|
+
},
|
|
121
|
+
"&:focus-within": {
|
|
122
|
+
outline: "none"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"& .MuiDataGrid-row": {
|
|
126
|
+
maxHeight: "none !important",
|
|
127
|
+
"&:nth-of-type(odd)": {
|
|
128
|
+
backgroundColor: "#ffffff" // color for odd rows
|
|
129
|
+
},
|
|
130
|
+
"&:nth-of-type(even)": {
|
|
131
|
+
backgroundColor: "#F6F9FF" // color for even rows
|
|
132
|
+
},
|
|
133
|
+
"&:hover": {
|
|
134
|
+
backgroundColor: "#95C7FC"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"& .MuiDataGrid-virtualScrollerContent": {
|
|
138
|
+
"& .MuiDataGrid-row": {
|
|
139
|
+
maxHeight: "none !important"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"& .MuiDataGrid-virtualScroller": {
|
|
143
|
+
backgroundColor: _apperance.palette.white
|
|
144
|
+
},
|
|
145
|
+
"& .MuiDataGrid-footerContainer": {
|
|
146
|
+
backgroundColor: _apperance.palette.white,
|
|
147
|
+
height: "28px",
|
|
148
|
+
minHeight: "28px"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
const localeText = {
|
|
154
|
+
noRowsLabel: "Aucune ligne",
|
|
155
|
+
footerRowSelected: count => count !== 1 ? "".concat(count.toLocaleString(), " lignes s\xE9lectionn\xE9es") : "".concat(count.toLocaleString(), " ligne s\xE9lectionn\xE9e"),
|
|
156
|
+
footerTotalVisibleRows: (visibleCount, totalCount) => "".concat(visibleCount.toLocaleString(), " de ").concat(totalCount.toLocaleString()),
|
|
157
|
+
MuiTablePagination: {
|
|
158
|
+
labelDisplayedRows: _ref => {
|
|
159
|
+
let {
|
|
160
|
+
from,
|
|
161
|
+
to,
|
|
162
|
+
count
|
|
163
|
+
} = _ref;
|
|
164
|
+
return "".concat(from, "\u2013").concat(to, " de ").concat(count !== -1 ? count : "plus que ".concat(to));
|
|
165
|
+
},
|
|
166
|
+
labelRowsPerPage: "Lignes par page"
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const TableActions = _ref2 => {
|
|
170
|
+
let {
|
|
171
|
+
row,
|
|
172
|
+
actions
|
|
173
|
+
} = _ref2;
|
|
174
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
175
|
+
const actionsRef = React.useRef();
|
|
176
|
+
const outsideClickHandler = React.useCallback(event => {
|
|
177
|
+
if (Boolean(actionsRef.current) && !actionsRef.current.contains(event.target)) {
|
|
178
|
+
closeHandler();
|
|
179
|
+
}
|
|
180
|
+
if (!Boolean(actionsRef.current)) {
|
|
181
|
+
document.removeEventListener("mouseup", outsideClickHandler, false);
|
|
182
|
+
}
|
|
183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
184
|
+
}, []);
|
|
185
|
+
const openHandler = () => {
|
|
186
|
+
document.addEventListener("mouseup", outsideClickHandler, false);
|
|
187
|
+
setIsOpen(true);
|
|
188
|
+
};
|
|
189
|
+
const closeHandler = () => {
|
|
190
|
+
document.removeEventListener("mouseup", outsideClickHandler, false);
|
|
191
|
+
setIsOpen(false);
|
|
192
|
+
};
|
|
193
|
+
React.useEffect(() => {
|
|
194
|
+
return () => {
|
|
195
|
+
document.removeEventListener("mouseup", outsideClickHandler, false);
|
|
196
|
+
};
|
|
197
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
198
|
+
}, []);
|
|
199
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
200
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTableAction.default, {
|
|
201
|
+
title: "Voir plus",
|
|
202
|
+
color: "primary",
|
|
203
|
+
onClick: openHandler,
|
|
204
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
205
|
+
type: "voir-plus"
|
|
206
|
+
})
|
|
207
|
+
}), Boolean(isOpen) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
|
|
208
|
+
ref: actionsRef,
|
|
209
|
+
elevation: 1,
|
|
210
|
+
sx: {
|
|
211
|
+
borderRadius: "5px",
|
|
212
|
+
position: "absolute",
|
|
213
|
+
right: "0",
|
|
214
|
+
top: "50%",
|
|
215
|
+
transform: "translate(0, -50%)",
|
|
216
|
+
display: "flex",
|
|
217
|
+
alignItems: "center",
|
|
218
|
+
gap: "8px",
|
|
219
|
+
paddingX: "11px",
|
|
220
|
+
height: "calc(100% - 4px)",
|
|
221
|
+
backgroundColor: _apperance.palette.gray.light,
|
|
222
|
+
border: "2px solid ".concat(_apperance.palette.gray.dark)
|
|
223
|
+
},
|
|
224
|
+
children: [actions.map((action, index) => /*#__PURE__*/React.cloneElement(action, {
|
|
225
|
+
row,
|
|
226
|
+
key: index
|
|
227
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTableAction.default, {
|
|
228
|
+
size: "small",
|
|
229
|
+
title: "Fermer",
|
|
230
|
+
color: "primary",
|
|
231
|
+
onClick: closeHandler,
|
|
232
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
233
|
+
type: "voir-plus"
|
|
234
|
+
})
|
|
235
|
+
})]
|
|
236
|
+
})]
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
const TablePagination = () => {
|
|
240
|
+
const apiRef = (0, _xDataGrid.useGridApiContext)();
|
|
241
|
+
const page = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridPageSelector);
|
|
242
|
+
const pageCount = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridPageCountSelector);
|
|
243
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Pagination, {
|
|
244
|
+
size: "small",
|
|
245
|
+
sx: {
|
|
246
|
+
position: "absolute",
|
|
247
|
+
left: "50%",
|
|
248
|
+
transform: "translateX(-50%)",
|
|
249
|
+
"& .MuiButtonBase-root": {
|
|
250
|
+
lineHeight: "1em",
|
|
251
|
+
fontSize: "1em",
|
|
252
|
+
minWidth: "20px",
|
|
253
|
+
height: "20px"
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
count: pageCount,
|
|
257
|
+
page: page + 1,
|
|
258
|
+
onChange: (event, value) => apiRef.current.setPage(value - 1),
|
|
259
|
+
showFirstButton: true,
|
|
260
|
+
showLastButton: true
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
const TableCheckbox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
264
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiCheckbox.default, _objectSpread(_objectSpread({
|
|
265
|
+
ref: ref
|
|
266
|
+
}, props), {}, {
|
|
267
|
+
formik: false,
|
|
268
|
+
sx: {
|
|
269
|
+
transform: "scale(.6)",
|
|
270
|
+
marginTop: "-4px"
|
|
271
|
+
}
|
|
272
|
+
}));
|
|
273
|
+
});
|
|
274
|
+
const autosizeOptions = {
|
|
275
|
+
includeHeaders: true,
|
|
276
|
+
includeOutliers: true
|
|
277
|
+
};
|
|
278
|
+
const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
279
|
+
let {
|
|
280
|
+
id,
|
|
281
|
+
className,
|
|
282
|
+
sx,
|
|
283
|
+
elevate,
|
|
284
|
+
rows,
|
|
285
|
+
rowCount,
|
|
286
|
+
columns,
|
|
287
|
+
paginationMode,
|
|
288
|
+
page,
|
|
289
|
+
pageSize,
|
|
290
|
+
checkboxSelection,
|
|
291
|
+
loading,
|
|
292
|
+
stripped,
|
|
293
|
+
actions,
|
|
294
|
+
oneActionOnly,
|
|
295
|
+
onSelect,
|
|
296
|
+
onPageChange,
|
|
297
|
+
onPageSizeChange,
|
|
298
|
+
rowDetailPanel
|
|
299
|
+
} = _ref3,
|
|
300
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
301
|
+
const [appColumns, setAppColumns] = React.useState(columns);
|
|
302
|
+
React.useEffect(() => {
|
|
303
|
+
const newColumns = Boolean(actions.length) ? [...columns, {
|
|
304
|
+
field: "action",
|
|
305
|
+
headerName: "Actions",
|
|
306
|
+
sortable: false,
|
|
307
|
+
filterable: false,
|
|
308
|
+
width: 100,
|
|
309
|
+
renderCell: _ref4 => {
|
|
310
|
+
let {
|
|
311
|
+
row
|
|
312
|
+
} = _ref4;
|
|
313
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
|
|
314
|
+
sx: {
|
|
315
|
+
display: 'flex',
|
|
316
|
+
gap: '8px',
|
|
317
|
+
// Adjust the space between icons as needed
|
|
318
|
+
flexWrap: 'wrap',
|
|
319
|
+
// Keep icons on the same line; remove if you want them to wrap
|
|
320
|
+
justifyContent: 'center',
|
|
321
|
+
// Center the icons horizontally
|
|
322
|
+
alignItems: 'center',
|
|
323
|
+
// Align icons vertically
|
|
324
|
+
minWidth: 0 // Prevent the flex container from stretching past its content width
|
|
325
|
+
},
|
|
326
|
+
children: actions.map((action, index) => /*#__PURE__*/React.cloneElement(action, {
|
|
327
|
+
row,
|
|
328
|
+
key: index,
|
|
329
|
+
sx: _objectSpread(_objectSpread({}, action.props.sx), {}, {
|
|
330
|
+
marginRight: 0,
|
|
331
|
+
// Remove any outer margins
|
|
332
|
+
'&:last-child': {
|
|
333
|
+
marginRight: 0 // Ensure the last item doesn't push the container width
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
}))
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
cellClassName: "tableAction",
|
|
340
|
+
headerClassName: "tableActionColumn"
|
|
341
|
+
}] : columns;
|
|
342
|
+
setAppColumns(newColumns.map(column => {
|
|
343
|
+
const renderCell = Boolean(column.renderCell) ? column.renderCell : Boolean(column.valueGetter) ? columnData => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTooltip.default, {
|
|
344
|
+
title: Boolean(column.titleGetter) ? column.titleGetter(columnData.row) : String(column.valueGetter(columnData)),
|
|
345
|
+
children: column.valueGetter(columnData)
|
|
346
|
+
}) : Boolean(column.field) ? _ref5 => {
|
|
347
|
+
let {
|
|
348
|
+
row
|
|
349
|
+
} = _ref5;
|
|
350
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTooltip.default, {
|
|
351
|
+
title: Boolean(column.titleGetter) ? column.titleGetter(row) : String(row[column.field]),
|
|
352
|
+
children: row[column.field]
|
|
353
|
+
});
|
|
354
|
+
} : undefined;
|
|
355
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
356
|
+
renderCell
|
|
357
|
+
});
|
|
358
|
+
}));
|
|
359
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
360
|
+
}, [actions, columns]);
|
|
361
|
+
const renderRowDetailPanel = params => {
|
|
362
|
+
const {
|
|
363
|
+
data
|
|
364
|
+
} = params;
|
|
365
|
+
// Render the passed rowDetailPanel component with the row data
|
|
366
|
+
return /*#__PURE__*/React.cloneElement(rowDetailPanel, {
|
|
367
|
+
rowData: data
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
371
|
+
style: {
|
|
372
|
+
width: '100%'
|
|
373
|
+
},
|
|
374
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMuiTable, _objectSpread({
|
|
375
|
+
ref: ref,
|
|
376
|
+
id: id,
|
|
377
|
+
components: {
|
|
378
|
+
BaseCheckbox: TableCheckbox,
|
|
379
|
+
LoadingOverlay: _material.LinearProgress,
|
|
380
|
+
Pagination: TablePagination
|
|
381
|
+
},
|
|
382
|
+
className: "".concat(className, " ").concat(stripped ? "table-stripped" : "", " ").concat(loading ? "table-loading" : "", " ").concat(elevate ? "elevate" : ""),
|
|
383
|
+
sx: {
|
|
384
|
+
["& .".concat(_xDataGrid.gridClasses.cell)]: {
|
|
385
|
+
py: 0.5
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
autoHeight: true,
|
|
389
|
+
headerHeight: 60,
|
|
390
|
+
footerHeight: 40,
|
|
391
|
+
rowHeight: 40,
|
|
392
|
+
rows: rows,
|
|
393
|
+
rowCount: rowCount,
|
|
394
|
+
columns: appColumns,
|
|
395
|
+
page: page,
|
|
396
|
+
pageSize: pageSize,
|
|
397
|
+
checkboxSelection: checkboxSelection,
|
|
398
|
+
disableSelectionOnClick: true,
|
|
399
|
+
disableColumnMenu: true,
|
|
400
|
+
disableColumnFilter: true,
|
|
401
|
+
disableColumnSelector: true,
|
|
402
|
+
disableVirtualization: true,
|
|
403
|
+
density: "compact",
|
|
404
|
+
loading: loading,
|
|
405
|
+
paginationMode: paginationMode,
|
|
406
|
+
localeText: localeText,
|
|
407
|
+
getRowHeight: () => 'auto',
|
|
408
|
+
onPageChange: onPageChange,
|
|
409
|
+
onPageSizeChange: onPageSizeChange,
|
|
410
|
+
onSelectionModelChange: onSelect,
|
|
411
|
+
autosizeOptions: autosizeOptions,
|
|
412
|
+
rowDetailPanel: renderRowDetailPanel
|
|
413
|
+
}, rest))
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
PuiTable.propTypes = {
|
|
417
|
+
id: _propTypes.default.string,
|
|
418
|
+
className: _propTypes.default.string,
|
|
419
|
+
sx: _propTypes.default.object,
|
|
420
|
+
elevate: _propTypes.default.bool,
|
|
421
|
+
stripped: _propTypes.default.bool,
|
|
422
|
+
oneActionOnly: _propTypes.default.bool,
|
|
423
|
+
rows: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
424
|
+
rowCount: _propTypes.default.number,
|
|
425
|
+
columns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
426
|
+
page: _propTypes.default.number,
|
|
427
|
+
pageSize: _propTypes.default.number,
|
|
428
|
+
actions: _propTypes.default.arrayOf(_propTypes.default.element),
|
|
429
|
+
checkboxSelection: _propTypes.default.bool,
|
|
430
|
+
paginationMode: _propTypes.default.oneOf(["client", "server"]),
|
|
431
|
+
loading: _propTypes.default.bool,
|
|
432
|
+
onSelect: _propTypes.default.func,
|
|
433
|
+
onPageChange: _propTypes.default.func,
|
|
434
|
+
onPageSizeChange: _propTypes.default.func,
|
|
435
|
+
onSelectionModelChange: _propTypes.default.func,
|
|
436
|
+
rowDetailPanel: _propTypes.default.element
|
|
437
|
+
};
|
|
438
|
+
PuiTable.defaultProps = {
|
|
439
|
+
oneActionOnly: false,
|
|
440
|
+
elevate: true,
|
|
441
|
+
pageSize: 5,
|
|
442
|
+
paginationMode: "client",
|
|
443
|
+
stripped: false,
|
|
444
|
+
actions: []
|
|
445
|
+
};
|
|
446
|
+
var _default = exports.default = PuiTable;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.symbol.description.js");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _PuiIconButton = _interopRequireDefault(require("../buttons/PuiIconButton"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
16
|
+
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); }
|
|
17
|
+
const PuiTableAction = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
id,
|
|
20
|
+
className,
|
|
21
|
+
sx,
|
|
22
|
+
row,
|
|
23
|
+
title,
|
|
24
|
+
hide,
|
|
25
|
+
hideFunc,
|
|
26
|
+
disabled,
|
|
27
|
+
onClick: _onClick,
|
|
28
|
+
children
|
|
29
|
+
} = _ref;
|
|
30
|
+
return hide || hideFunc(row) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIconButton.default, {
|
|
31
|
+
id: id,
|
|
32
|
+
className: className,
|
|
33
|
+
sx: _objectSpread(_objectSpread({}, sx), {}, {
|
|
34
|
+
"& .MuiSvgIcon-root": {
|
|
35
|
+
width: ".75em !important",
|
|
36
|
+
height: ".75em !important",
|
|
37
|
+
color: "#1e498c"
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
title: title,
|
|
41
|
+
disabled: disabled,
|
|
42
|
+
size: "small",
|
|
43
|
+
onClick: () => _onClick(row),
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
PuiTableAction.propTypes = {
|
|
48
|
+
id: _propTypes.default.string,
|
|
49
|
+
className: _propTypes.default.string,
|
|
50
|
+
sx: _propTypes.default.object,
|
|
51
|
+
row: _propTypes.default.object,
|
|
52
|
+
title: _propTypes.default.string,
|
|
53
|
+
hide: _propTypes.default.bool,
|
|
54
|
+
hideFunc: _propTypes.default.func,
|
|
55
|
+
disabled: _propTypes.default.bool,
|
|
56
|
+
onClick: _propTypes.default.func
|
|
57
|
+
};
|
|
58
|
+
PuiTableAction.defaultProps = {
|
|
59
|
+
hide: false,
|
|
60
|
+
hideFunc: () => false,
|
|
61
|
+
onClick: () => {}
|
|
62
|
+
};
|
|
63
|
+
var _default = exports.default = PuiTableAction;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _material = require("@mui/material");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _apperance = require("../../config/apperance");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const PuiDefinition = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
label,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
18
|
+
direction: "row",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
spacing: 1,
|
|
21
|
+
sx: {
|
|
22
|
+
fontFamily: '"Roboto","Helvetica","Arial",sans-serif',
|
|
23
|
+
fontSize: "0.8rem",
|
|
24
|
+
color: _apperance.palette.gray.darker,
|
|
25
|
+
lineHeight: "1.4375em",
|
|
26
|
+
letterSpacing: "0.00938em",
|
|
27
|
+
whiteSpace: "nowrap"
|
|
28
|
+
},
|
|
29
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
30
|
+
sx: {
|
|
31
|
+
fontWeight: "600"
|
|
32
|
+
},
|
|
33
|
+
children: "".concat(label, " :")
|
|
34
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
35
|
+
children: children
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
PuiDefinition.propTypes = {
|
|
40
|
+
label: _propTypes.default.string.isRequired
|
|
41
|
+
};
|
|
42
|
+
var _default = exports.default = PuiDefinition;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/es.symbol.description.js");
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _apperance = require("../../config/apperance");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
22
|
+
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); }
|
|
23
|
+
const getTextFontSize = size => {
|
|
24
|
+
switch (size) {
|
|
25
|
+
case "small":
|
|
26
|
+
return ".7rem";
|
|
27
|
+
default:
|
|
28
|
+
case "medium":
|
|
29
|
+
return "1rem";
|
|
30
|
+
case "large":
|
|
31
|
+
return "1.2rem";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const PuiIndication = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
id,
|
|
37
|
+
className,
|
|
38
|
+
sx,
|
|
39
|
+
icon,
|
|
40
|
+
color,
|
|
41
|
+
size,
|
|
42
|
+
children
|
|
43
|
+
} = _ref;
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
45
|
+
id: id,
|
|
46
|
+
className: className,
|
|
47
|
+
sx: _objectSpread({
|
|
48
|
+
color: color === "inherit" ? "inherit" : _apperance.palette[color]
|
|
49
|
+
}, sx),
|
|
50
|
+
direction: "row",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
spacing: 1,
|
|
53
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
54
|
+
children: icon && /*#__PURE__*/React.cloneElement(icon, {
|
|
55
|
+
fontSize: size,
|
|
56
|
+
size
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
59
|
+
sx: {
|
|
60
|
+
fontSize: getTextFontSize(size),
|
|
61
|
+
fontWeight: "bold"
|
|
62
|
+
},
|
|
63
|
+
children: children
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
PuiIndication.propTypes = {
|
|
68
|
+
id: _propTypes.default.string,
|
|
69
|
+
className: _propTypes.default.string,
|
|
70
|
+
sx: _propTypes.default.object,
|
|
71
|
+
icon: _propTypes.default.element,
|
|
72
|
+
color: _propTypes.default.oneOf(["primary", "secondary", "error", "success", "warning", "info", "dark", "inherit"]),
|
|
73
|
+
size: _propTypes.default.oneOf(["small", "medium", "large"])
|
|
74
|
+
};
|
|
75
|
+
PuiIndication.defaultProps = {
|
|
76
|
+
color: "primary",
|
|
77
|
+
size: "medium"
|
|
78
|
+
};
|
|
79
|
+
var _default = exports.default = PuiIndication;
|