@portnet/ui 3.1.1 → 4.0.0
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 +85 -37
- package/dist/components/common/StyledMuiButton.js +3 -5
- package/dist/components/common/StyledMuiTextField.js +95 -40
- package/dist/components/inputs/PuiDateField.js +121 -57
- package/dist/components/inputs/PuiDateTimeField.js +27 -296
- package/dist/components/inputs/PuiSelect.js +26 -50
- package/dist/components/others/DateTimePickerField.js +210 -0
- package/dist/components/others/PuiSection.js +83 -20
- package/dist/components/referentiel/components/PuiSpecificReferentielField.js +6 -24
- package/dist/components/table/PuiTable.js +110 -41
- package/dist/components/typography/PuiMainTitle.js +57 -4
- package/dist/components/ui/pages/general/PuiSearchPage.js +56 -34
- package/dist/config/apperance.js +13 -56
- package/dist/index.js +0 -21
- package/package.json +105 -108
- package/dist/components/stepper/PuiStepContent.js +0 -66
- package/dist/components/stepper/PuiStepper.js +0 -184
- package/dist/components/stepper/PuiStepperActions.js +0 -105
- package/dist/hooks/useCustomAxios.js +0 -36
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
require("dayjs/locale/fr");
|
|
10
|
+
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
11
|
+
var _formik = require("formik");
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _xDatePickers = require("@mui/x-date-pickers");
|
|
14
|
+
var _AdapterDayjs = require("@mui/x-date-pickers/AdapterDayjs");
|
|
15
|
+
var _DateTimePicker = require("@mui/x-date-pickers/DateTimePicker");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
_dayjs.default.extend(_utc.default);
|
|
19
|
+
_dayjs.default.locale("fr");
|
|
20
|
+
const frenchLocaleText = {
|
|
21
|
+
cancelButtonLabel: "Annuler",
|
|
22
|
+
okButtonLabel: "Appliquer",
|
|
23
|
+
toolbarTitle: "Sélectionner la date et l'heure",
|
|
24
|
+
todayButtonLabel: "Aujourd’hui",
|
|
25
|
+
clockLabelText: "Sélectionnez l’heure",
|
|
26
|
+
calendarWeekNumberHeaderLabel: "Semaine",
|
|
27
|
+
calendarWeekNumberLabel: "Semaine {weekNumber}"
|
|
28
|
+
};
|
|
29
|
+
const palette = {
|
|
30
|
+
inherit: "inherit",
|
|
31
|
+
primary: "#232f66",
|
|
32
|
+
secondary: "#e7e7e7",
|
|
33
|
+
error: "#d32f2f",
|
|
34
|
+
warning: "#FD9727",
|
|
35
|
+
success: "#48AC24",
|
|
36
|
+
info: "#2278CF",
|
|
37
|
+
white: "#FFF",
|
|
38
|
+
dark: "#000",
|
|
39
|
+
gray: {
|
|
40
|
+
darker: "#505050",
|
|
41
|
+
dark: "#b6b6b6",
|
|
42
|
+
light: "#F1F1F1"
|
|
43
|
+
},
|
|
44
|
+
background: {
|
|
45
|
+
required: "#FFFBE3",
|
|
46
|
+
error: "#FFE5E5"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const textFieldStyles = {
|
|
50
|
+
"&.MuiFormControl-root": {
|
|
51
|
+
"&.required .MuiInputBase-root": {
|
|
52
|
+
backgroundColor: required => required ? palette.background.required : "white"
|
|
53
|
+
},
|
|
54
|
+
"& .MuiFormLabel-root": {
|
|
55
|
+
zIndex: 0,
|
|
56
|
+
lineSpacing: "-0.03em",
|
|
57
|
+
position: "initial",
|
|
58
|
+
transform: "none",
|
|
59
|
+
fontSize: "0.8rem",
|
|
60
|
+
fontWeight: "600",
|
|
61
|
+
marginBottom: "4px",
|
|
62
|
+
color: palette.gray.darker,
|
|
63
|
+
"&.Mui-focused ": {
|
|
64
|
+
color: palette.primary
|
|
65
|
+
},
|
|
66
|
+
"&.Mui-disabled": {
|
|
67
|
+
color: palette.gray.darker
|
|
68
|
+
},
|
|
69
|
+
"&.Mui-error": {
|
|
70
|
+
color: palette.error
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"& .MuiInputBase-root": {
|
|
74
|
+
backgroundColor: required => required ? palette.background.required : "white",
|
|
75
|
+
border: "2px solid ".concat(palette.gray.dark),
|
|
76
|
+
borderRadius: "5px",
|
|
77
|
+
"&.MuiInputBase-multiline": {
|
|
78
|
+
padding: "8px 0"
|
|
79
|
+
},
|
|
80
|
+
"&.Mui-focused ": {
|
|
81
|
+
border: "2px solid ".concat(palette.primary)
|
|
82
|
+
},
|
|
83
|
+
"&.Mui-error ": {
|
|
84
|
+
border: "2px solid ".concat(palette.error),
|
|
85
|
+
backgroundColor: palette.background.error
|
|
86
|
+
},
|
|
87
|
+
"&.Mui-disabled ": {
|
|
88
|
+
"& input": {
|
|
89
|
+
color: "".concat(palette.gray.darker),
|
|
90
|
+
WebkitTextFillColor: "".concat(palette.gray.darker)
|
|
91
|
+
},
|
|
92
|
+
backgroundColor: "".concat(palette.secondary)
|
|
93
|
+
},
|
|
94
|
+
"& .MuiInputBase-input": {
|
|
95
|
+
lineHeight: "1",
|
|
96
|
+
padding: "1px 6px",
|
|
97
|
+
fontSize: "0.7rem"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"& .MuiFormHelperText-root": {
|
|
101
|
+
fontWeight: "bold",
|
|
102
|
+
fontSize: ".7rem",
|
|
103
|
+
color: "red"
|
|
104
|
+
},
|
|
105
|
+
"& fieldset": {
|
|
106
|
+
display: "none"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const DateTimePickerField = _ref => {
|
|
111
|
+
let {
|
|
112
|
+
label,
|
|
113
|
+
name,
|
|
114
|
+
value: propValue,
|
|
115
|
+
onChange,
|
|
116
|
+
required = true,
|
|
117
|
+
error = false,
|
|
118
|
+
helperText = null,
|
|
119
|
+
fullWidth = true
|
|
120
|
+
} = _ref;
|
|
121
|
+
const [field, meta, helpers] = (0, _formik.useField)(name || "default");
|
|
122
|
+
if (!name) {
|
|
123
|
+
console.error("DateTimePickerField requires a `name` prop to work with Formik.");
|
|
124
|
+
}
|
|
125
|
+
const {
|
|
126
|
+
setValue,
|
|
127
|
+
setTouched
|
|
128
|
+
} = helpers;
|
|
129
|
+
const handleChange = newValue => {
|
|
130
|
+
setValue(_dayjs.default.utc(newValue).format("YYYY-MM-DDTHH:mm:ss.SSS[Z]"));
|
|
131
|
+
if (onChange) {
|
|
132
|
+
onChange(_dayjs.default.utc(newValue).format("YYYY-MM-DDTHH:mm:ss.SSS[Z]"));
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const handleBlur = () => {
|
|
136
|
+
setTouched(true);
|
|
137
|
+
};
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDatePickers.LocalizationProvider, {
|
|
139
|
+
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
140
|
+
localeText: frenchLocaleText,
|
|
141
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateTimePicker.DateTimePicker, {
|
|
142
|
+
label: label,
|
|
143
|
+
ampm: false,
|
|
144
|
+
value: field.value ? _dayjs.default.utc(field.value) : !!propValue ? _dayjs.default.utc(propValue) : null,
|
|
145
|
+
closeOnSelect: false,
|
|
146
|
+
onChange: handleChange,
|
|
147
|
+
onBlur: handleBlur,
|
|
148
|
+
views: ["year", "month", "day", "hours", "minutes"],
|
|
149
|
+
timeSteps: {
|
|
150
|
+
hours: 1,
|
|
151
|
+
minutes: 1,
|
|
152
|
+
seconds: 5
|
|
153
|
+
},
|
|
154
|
+
slotProps: {
|
|
155
|
+
textField: {
|
|
156
|
+
name: name,
|
|
157
|
+
sx: textFieldStyles,
|
|
158
|
+
fullWidth: fullWidth,
|
|
159
|
+
required: required,
|
|
160
|
+
error: Boolean(meta.touched && meta.error || error),
|
|
161
|
+
helperText: meta.touched && meta.error ? meta.error : !!helperText ? helperText : ""
|
|
162
|
+
},
|
|
163
|
+
actionBar: {
|
|
164
|
+
actions: ["cancel", "accept"],
|
|
165
|
+
sx: {
|
|
166
|
+
display: "flex",
|
|
167
|
+
justifyContent: "flex-end",
|
|
168
|
+
gap: 1,
|
|
169
|
+
padding: "8px",
|
|
170
|
+
"& .MuiButton-root": {
|
|
171
|
+
borderRadius: "4px",
|
|
172
|
+
padding: "6px 16px",
|
|
173
|
+
textTransform: "none",
|
|
174
|
+
fontSize: "0.875rem",
|
|
175
|
+
fontWeight: "bold"
|
|
176
|
+
},
|
|
177
|
+
"& .MuiButton-root:nth-of-type(1)": {
|
|
178
|
+
backgroundColor: "white",
|
|
179
|
+
color: "".concat(palette.primary, " !important"),
|
|
180
|
+
border: "1px solid ".concat(palette.primary, " !important"),
|
|
181
|
+
paddingY: 0
|
|
182
|
+
},
|
|
183
|
+
"& .MuiButton-root:nth-of-type(2)": {
|
|
184
|
+
backgroundColor: "".concat(palette.primary, " !important"),
|
|
185
|
+
color: "white !important",
|
|
186
|
+
border: "1px solid ".concat(palette.primary, " !important"),
|
|
187
|
+
paddingY: 0
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
popper: {
|
|
192
|
+
sx: {
|
|
193
|
+
"& .MuiPaper-root": {
|
|
194
|
+
boxShadow: "none !important",
|
|
195
|
+
border: "1px solid #e0e0e0",
|
|
196
|
+
backgroundColor: "white"
|
|
197
|
+
},
|
|
198
|
+
"& .MuiPickersDay-root.Mui-selected": {
|
|
199
|
+
backgroundColor: "".concat(palette.primary, " !important")
|
|
200
|
+
},
|
|
201
|
+
"& .Mui-selected": {
|
|
202
|
+
backgroundColor: "".concat(palette.primary, " !important")
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
var _default = exports.default = DateTimePickerField;
|
|
@@ -21,15 +21,71 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
|
-
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); }
|
|
24
|
+
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); } // Helper function to get palette from theme or fallback to appearance
|
|
25
|
+
const getPalette = theme => {
|
|
26
|
+
// Check if theme has our custom palette properties
|
|
27
|
+
if (theme && theme.palette && theme.palette.gray && theme.palette.gray.darker) {
|
|
28
|
+
// Theme has our custom structure, now normalize it
|
|
29
|
+
return {
|
|
30
|
+
primary: theme.palette.primary.main || theme.palette.primary,
|
|
31
|
+
secondary: theme.palette.secondary.main || theme.palette.secondary,
|
|
32
|
+
error: theme.palette.error ? theme.palette.error.main || theme.palette.error : _apperance.palette.error,
|
|
33
|
+
warning: theme.palette.warning ? theme.palette.warning.main || theme.palette.warning : _apperance.palette.warning,
|
|
34
|
+
success: theme.palette.success ? theme.palette.success.main || theme.palette.success : _apperance.palette.success,
|
|
35
|
+
info: theme.palette.info ? theme.palette.info.main || theme.palette.info : _apperance.palette.info,
|
|
36
|
+
white: theme.palette.white || _apperance.palette.white,
|
|
37
|
+
dark: theme.palette.dark || _apperance.palette.dark,
|
|
38
|
+
gray: theme.palette.gray,
|
|
39
|
+
blue: theme.palette.blue || _apperance.palette.blue,
|
|
40
|
+
background: theme.palette.background || _apperance.palette.background,
|
|
41
|
+
border: theme.palette.border || _apperance.palette.border,
|
|
42
|
+
shadow: theme.palette.shadow || _apperance.palette.shadow
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// Check if theme object itself has gray (root level)
|
|
46
|
+
if (theme && theme.gray && theme.gray.darker) {
|
|
47
|
+
return {
|
|
48
|
+
primary: theme.primary,
|
|
49
|
+
secondary: theme.secondary,
|
|
50
|
+
error: theme.error || _apperance.palette.error,
|
|
51
|
+
warning: theme.warning || _apperance.palette.warning,
|
|
52
|
+
success: theme.success || _apperance.palette.success,
|
|
53
|
+
info: theme.info || _apperance.palette.info,
|
|
54
|
+
white: theme.white || _apperance.palette.white,
|
|
55
|
+
dark: theme.dark || _apperance.palette.dark,
|
|
56
|
+
gray: theme.gray,
|
|
57
|
+
blue: theme.blue || _apperance.palette.blue,
|
|
58
|
+
background: theme.background || _apperance.palette.background,
|
|
59
|
+
border: theme.border || _apperance.palette.border,
|
|
60
|
+
shadow: theme.shadow || _apperance.palette.shadow
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return _apperance.palette;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Helper function to get PuiSection styles from theme
|
|
67
|
+
const getPuiSectionStyles = theme => {
|
|
68
|
+
if (theme && theme.components && theme.components.PuiSection) {
|
|
69
|
+
return theme.components.PuiSection;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
backgroundColor: _apperance.palette.gray.light,
|
|
73
|
+
border: "2px solid ".concat(_apperance.palette.gray.dark),
|
|
74
|
+
borderRadius: "5px",
|
|
75
|
+
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%)",
|
|
76
|
+
titleColor: _apperance.palette.primary
|
|
77
|
+
};
|
|
78
|
+
};
|
|
25
79
|
const StyledMuiPaper = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Paper, _objectSpread({
|
|
26
80
|
ref: ref
|
|
27
|
-
}, props))))(
|
|
81
|
+
}, props))))(props => {
|
|
82
|
+
const sectionStyles = getPuiSectionStyles(props.theme);
|
|
28
83
|
return {
|
|
29
84
|
"&.MuiPaper-root": {
|
|
30
|
-
backgroundColor:
|
|
31
|
-
border: "
|
|
32
|
-
borderRadius: "
|
|
85
|
+
backgroundColor: "".concat(sectionStyles.backgroundColor, " !important"),
|
|
86
|
+
border: "".concat(sectionStyles.border, " !important"),
|
|
87
|
+
borderRadius: "".concat(sectionStyles.borderRadius, " !important"),
|
|
88
|
+
boxShadow: "".concat(sectionStyles.boxShadow, " !important"),
|
|
33
89
|
position: "relative"
|
|
34
90
|
}
|
|
35
91
|
};
|
|
@@ -59,24 +115,31 @@ const PuiSection = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
59
115
|
transform: "translate(0,-50%)"
|
|
60
116
|
},
|
|
61
117
|
children: [Boolean(title) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
62
|
-
sx: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
118
|
+
sx: theme => {
|
|
119
|
+
const themePalette = getPalette(theme);
|
|
120
|
+
return {
|
|
121
|
+
transform: "translateY(-50%)",
|
|
122
|
+
top: "50%",
|
|
123
|
+
zIndex: "-1",
|
|
124
|
+
position: "absolute",
|
|
125
|
+
width: "100%",
|
|
126
|
+
height: "4px",
|
|
127
|
+
backgroundColor: themePalette.gray.light
|
|
128
|
+
};
|
|
70
129
|
}
|
|
71
130
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
72
131
|
variant: titleVariant,
|
|
73
|
-
sx: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
132
|
+
sx: theme => {
|
|
133
|
+
const sectionStyles = getPuiSectionStyles(theme);
|
|
134
|
+
const themePalette = getPalette(theme);
|
|
135
|
+
return {
|
|
136
|
+
textAlign: "center",
|
|
137
|
+
paddingX: 1,
|
|
138
|
+
fontWeight: "600",
|
|
139
|
+
lineSpacing: "-0.03em",
|
|
140
|
+
color: sectionStyles.titleColor || themePalette.primary,
|
|
141
|
+
fontSize: "1.2rem"
|
|
142
|
+
};
|
|
80
143
|
},
|
|
81
144
|
children: title
|
|
82
145
|
})]
|
|
@@ -17,7 +17,6 @@ var _formik = require("formik");
|
|
|
17
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
18
|
var React = _interopRequireWildcard(require("react"));
|
|
19
19
|
var _useAxios = _interopRequireDefault(require("../../../hooks/useAxios"));
|
|
20
|
-
var _useCustomAxios = _interopRequireDefault(require("../../../hooks/useCustomAxios"));
|
|
21
20
|
var _PuiButton = _interopRequireDefault(require("../../buttons/PuiButton"));
|
|
22
21
|
var _PuiFormikForm = _interopRequireDefault(require("../../others/PuiFormikForm"));
|
|
23
22
|
var _PuiGrid = _interopRequireDefault(require("../../others/PuiGrid"));
|
|
@@ -107,9 +106,7 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
107
106
|
getReturnedValue,
|
|
108
107
|
getRenderedValue,
|
|
109
108
|
onChange,
|
|
110
|
-
onError
|
|
111
|
-
searchApi,
|
|
112
|
-
customUrl
|
|
109
|
+
onError
|
|
113
110
|
} = _ref2;
|
|
114
111
|
const {
|
|
115
112
|
token,
|
|
@@ -117,7 +114,6 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
117
114
|
baseURL
|
|
118
115
|
} = React.useContext(_ReferetielContext.default);
|
|
119
116
|
const axios = (0, _useAxios.default)(token, secret, baseURL);
|
|
120
|
-
const customAxios = (0, _useCustomAxios.default)(token, secret, customUrl);
|
|
121
117
|
const [dataFetchingState, dataFetchingDispatch] = React.useReducer(dataFetchingReducer, dataFetchingInitalState);
|
|
122
118
|
const [filtreredFilters, setFiltreredFilters] = React.useState([..._specificReferentielsBaseFilters.default[searchKey]]);
|
|
123
119
|
const formRef = React.useRef();
|
|
@@ -133,24 +129,12 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
133
129
|
dataFetchingDispatch({
|
|
134
130
|
type: "GET_DATA"
|
|
135
131
|
});
|
|
136
|
-
let response;
|
|
137
|
-
if (customUrl) {
|
|
138
|
-
// Si customUrl est fourni, utiliser useCustomAxios
|
|
139
|
-
response = await customAxios.post("/getPage", _objectSpread(_objectSpread({}, specifications), {}, {
|
|
140
|
-
pageNumber: dataFetchingState.pageNumber,
|
|
141
|
-
pageSize: dataFetchingState.pageSize
|
|
142
|
-
}, values));
|
|
143
|
-
} else {
|
|
144
|
-
// Sinon, utiliser useAxios avec l'URL relative
|
|
145
|
-
const apiEndpoint = searchApi || _specificReferentielsApis.default[searchKey];
|
|
146
|
-
response = await axios.post("/api/".concat(apiEndpoint, "/getPage"), _objectSpread(_objectSpread({}, specifications), {}, {
|
|
147
|
-
pageNumber: dataFetchingState.pageNumber,
|
|
148
|
-
pageSize: dataFetchingState.pageSize
|
|
149
|
-
}, values));
|
|
150
|
-
}
|
|
151
132
|
const {
|
|
152
133
|
data
|
|
153
|
-
} =
|
|
134
|
+
} = await axios.post("/api/".concat(_specificReferentielsApis.default[searchKey], "/getPage"), _objectSpread(_objectSpread({}, specifications), {}, {
|
|
135
|
+
pageNumber: dataFetchingState.pageNumber,
|
|
136
|
+
pageSize: dataFetchingState.pageSize
|
|
137
|
+
}, values));
|
|
154
138
|
if (data.succes) {
|
|
155
139
|
dataFetchingDispatch({
|
|
156
140
|
type: "SUCCESSED",
|
|
@@ -325,9 +309,7 @@ PuiSpecificReferentielField.propTypes = {
|
|
|
325
309
|
getRenderedValue: _propTypes.default.func.isRequired,
|
|
326
310
|
getReturnedValue: _propTypes.default.func,
|
|
327
311
|
onChange: _propTypes.default.func,
|
|
328
|
-
onError: _propTypes.default.func
|
|
329
|
-
searchApi: _propTypes.default.string,
|
|
330
|
-
customUrl: _propTypes.default.string // URL de base personnalisée (ex: "https://api.example.com/preneur")
|
|
312
|
+
onError: _propTypes.default.func
|
|
331
313
|
};
|
|
332
314
|
PuiSpecificReferentielField.defaultProps = {
|
|
333
315
|
disabled: false,
|
|
@@ -33,13 +33,79 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
33
33
|
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; }
|
|
34
34
|
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; }
|
|
35
35
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
36
|
-
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); }
|
|
36
|
+
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); } // Helper function to get palette from theme or fallback to appearance
|
|
37
|
+
const getPalette = theme => {
|
|
38
|
+
// Check if theme has our custom palette properties
|
|
39
|
+
if (theme && theme.palette && theme.palette.gray && theme.palette.gray.darker) {
|
|
40
|
+
// Theme has our custom structure, now normalize it
|
|
41
|
+
return {
|
|
42
|
+
primary: theme.palette.primary.main || theme.palette.primary,
|
|
43
|
+
secondary: theme.palette.secondary.main || theme.palette.secondary,
|
|
44
|
+
error: theme.palette.error ? theme.palette.error.main || theme.palette.error : _apperance.palette.error,
|
|
45
|
+
warning: theme.palette.warning ? theme.palette.warning.main || theme.palette.warning : _apperance.palette.warning,
|
|
46
|
+
success: theme.palette.success ? theme.palette.success.main || theme.palette.success : _apperance.palette.success,
|
|
47
|
+
info: theme.palette.info ? theme.palette.info.main || theme.palette.info : _apperance.palette.info,
|
|
48
|
+
white: theme.palette.white || _apperance.palette.white,
|
|
49
|
+
dark: theme.palette.dark || _apperance.palette.dark,
|
|
50
|
+
gray: theme.palette.gray,
|
|
51
|
+
blue: theme.palette.blue || _apperance.palette.blue,
|
|
52
|
+
background: theme.palette.background || _apperance.palette.background,
|
|
53
|
+
border: theme.palette.border || _apperance.palette.border,
|
|
54
|
+
shadow: theme.palette.shadow || _apperance.palette.shadow
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Check if theme object itself has gray (root level)
|
|
58
|
+
if (theme && theme.gray && theme.gray.darker) {
|
|
59
|
+
return {
|
|
60
|
+
primary: theme.primary,
|
|
61
|
+
secondary: theme.secondary,
|
|
62
|
+
error: theme.error || _apperance.palette.error,
|
|
63
|
+
warning: theme.warning || _apperance.palette.warning,
|
|
64
|
+
success: theme.success || _apperance.palette.success,
|
|
65
|
+
info: theme.info || _apperance.palette.info,
|
|
66
|
+
white: theme.white || _apperance.palette.white,
|
|
67
|
+
dark: theme.dark || _apperance.palette.dark,
|
|
68
|
+
gray: theme.gray,
|
|
69
|
+
blue: theme.blue || _apperance.palette.blue,
|
|
70
|
+
background: theme.background || _apperance.palette.background,
|
|
71
|
+
border: theme.border || _apperance.palette.border,
|
|
72
|
+
shadow: theme.shadow || _apperance.palette.shadow
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return _apperance.palette;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Helper function to get PuiTable styles from theme
|
|
79
|
+
const getPuiTableStyles = theme => {
|
|
80
|
+
if (theme && theme.components && theme.components.PuiTable) {
|
|
81
|
+
return theme.components.PuiTable;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
border: "2px solid ".concat(_apperance.palette.gray.dark),
|
|
85
|
+
marginTop: "0px",
|
|
86
|
+
rowHeight: {
|
|
87
|
+
maxHeight: "none",
|
|
88
|
+
minHeight: "auto",
|
|
89
|
+
lineHeight: "1.2em"
|
|
90
|
+
},
|
|
91
|
+
cellJustifyContent: "flex-start",
|
|
92
|
+
headerJustifyContent: "flex-start",
|
|
93
|
+
headerColor: _apperance.palette.primary,
|
|
94
|
+
headerFontSize: "1em",
|
|
95
|
+
virtualScrollerHeight: "auto"
|
|
96
|
+
};
|
|
97
|
+
};
|
|
37
98
|
const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.DataGrid, _objectSpread({
|
|
38
99
|
ref: ref
|
|
39
|
-
}, props))))(
|
|
100
|
+
}, props))))(props => {
|
|
101
|
+
var _themePalette$shadow, _palette$shadow;
|
|
102
|
+
const themePalette = getPalette(props.theme);
|
|
103
|
+
const tableStyles = getPuiTableStyles(props.theme);
|
|
40
104
|
return {
|
|
41
105
|
"&.MuiDataGrid-root": {
|
|
42
106
|
fontSize: ".8em",
|
|
107
|
+
border: "".concat(tableStyles.border, " !important"),
|
|
108
|
+
marginTop: "".concat(tableStyles.marginTop, " !important"),
|
|
43
109
|
"& .tableActionColumn": {
|
|
44
110
|
"& .MuiDataGrid-columnHeaderTitle": {
|
|
45
111
|
justifyContent: "center",
|
|
@@ -50,14 +116,13 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
50
116
|
}
|
|
51
117
|
},
|
|
52
118
|
"&.elevate": {
|
|
53
|
-
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%)"
|
|
119
|
+
boxShadow: ((_themePalette$shadow = themePalette.shadow) === null || _themePalette$shadow === void 0 ? void 0 : _themePalette$shadow.medium) || ((_palette$shadow = _apperance.palette.shadow) === null || _palette$shadow === void 0 ? void 0 : _palette$shadow.medium) || "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%)"
|
|
54
120
|
},
|
|
55
|
-
backgroundColor:
|
|
56
|
-
border: "2px solid ".concat(_apperance.palette.gray.dark),
|
|
121
|
+
backgroundColor: themePalette.gray.light,
|
|
57
122
|
"& .MuiPaginationItem-root": {
|
|
58
123
|
"&.Mui-selected": {
|
|
59
|
-
color:
|
|
60
|
-
backgroundColor:
|
|
124
|
+
color: themePalette.white,
|
|
125
|
+
backgroundColor: themePalette.primary
|
|
61
126
|
}
|
|
62
127
|
},
|
|
63
128
|
"&.table-loading .MuiDataGrid-virtualScroller, &.table-loading .MuiDataGrid-footerContainer": {
|
|
@@ -66,7 +131,7 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
66
131
|
content: "''",
|
|
67
132
|
width: "100%",
|
|
68
133
|
height: "100%",
|
|
69
|
-
backgroundColor:
|
|
134
|
+
backgroundColor: themePalette.white,
|
|
70
135
|
position: "absolute",
|
|
71
136
|
zIndex: 1,
|
|
72
137
|
display: "block",
|
|
@@ -75,14 +140,14 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
75
140
|
},
|
|
76
141
|
"&.table-stripped .MuiDataGrid-row": {
|
|
77
142
|
"&:nth-of-type(even)": {
|
|
78
|
-
backgroundColor:
|
|
143
|
+
backgroundColor: themePalette.gray.light
|
|
79
144
|
}
|
|
80
145
|
},
|
|
81
146
|
"& .MuiLinearProgress-root": {
|
|
82
147
|
zIndex: 1,
|
|
83
|
-
backgroundColor:
|
|
148
|
+
backgroundColor: themePalette.info,
|
|
84
149
|
"& .MuiLinearProgress-bar": {
|
|
85
|
-
backgroundColor:
|
|
150
|
+
backgroundColor: themePalette.primary
|
|
86
151
|
}
|
|
87
152
|
},
|
|
88
153
|
"& .MuiDataGrid-columnHeaders": {
|
|
@@ -91,10 +156,14 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
91
156
|
display: "flex",
|
|
92
157
|
alignItems: "center",
|
|
93
158
|
fontWeight: "600",
|
|
94
|
-
color:
|
|
159
|
+
color: "".concat(tableStyles.headerColor, " !important"),
|
|
160
|
+
fontSize: "".concat(tableStyles.headerFontSize, " !important"),
|
|
95
161
|
whiteSpace: "normal",
|
|
96
162
|
lineHeight: "1.2em"
|
|
97
163
|
},
|
|
164
|
+
"& .MuiDataGrid-columnHeaderTitleContainer": {
|
|
165
|
+
justifyContent: "".concat(tableStyles.headerJustifyContent, " !important")
|
|
166
|
+
},
|
|
98
167
|
"&:focus-within": {
|
|
99
168
|
outline: "none"
|
|
100
169
|
},
|
|
@@ -103,7 +172,7 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
103
172
|
}
|
|
104
173
|
},
|
|
105
174
|
"& .MuiDataGrid-columnSeparator": {
|
|
106
|
-
color:
|
|
175
|
+
color: themePalette.gray.dark
|
|
107
176
|
}
|
|
108
177
|
},
|
|
109
178
|
"& .MuiDataGrid-cell": {
|
|
@@ -112,11 +181,12 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
112
181
|
whiteSpace: "normal",
|
|
113
182
|
textOverflow: "ellipsis",
|
|
114
183
|
overflow: "hidden",
|
|
115
|
-
maxHeight: "
|
|
184
|
+
maxHeight: "".concat(tableStyles.rowHeight.maxHeight, " !important"),
|
|
116
185
|
minWidth: 'maxWidth',
|
|
117
186
|
wordBreak: "break-word",
|
|
187
|
+
justifyContent: "".concat(tableStyles.cellJustifyContent, " !important"),
|
|
118
188
|
"&.tableAction": {
|
|
119
|
-
justifyContent: "center",
|
|
189
|
+
justifyContent: "center !important",
|
|
120
190
|
position: "relative",
|
|
121
191
|
overflow: "initial !important"
|
|
122
192
|
},
|
|
@@ -125,12 +195,14 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
125
195
|
}
|
|
126
196
|
},
|
|
127
197
|
"& .MuiDataGrid-row": {
|
|
128
|
-
maxHeight: "
|
|
198
|
+
maxHeight: "".concat(tableStyles.rowHeight.maxHeight, " !important"),
|
|
199
|
+
minHeight: "".concat(tableStyles.rowHeight.minHeight, " !important"),
|
|
200
|
+
lineHeight: "".concat(tableStyles.rowHeight.lineHeight, " !important"),
|
|
129
201
|
"&:nth-of-type(odd)": {
|
|
130
|
-
backgroundColor: "#ffffff"
|
|
202
|
+
backgroundColor: "#ffffff"
|
|
131
203
|
},
|
|
132
204
|
"&:nth-of-type(even)": {
|
|
133
|
-
backgroundColor: "#F6F9FF"
|
|
205
|
+
backgroundColor: "#F6F9FF"
|
|
134
206
|
},
|
|
135
207
|
"&:hover": {
|
|
136
208
|
backgroundColor: "#95C7FC"
|
|
@@ -142,10 +214,10 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
142
214
|
}
|
|
143
215
|
},
|
|
144
216
|
"& .MuiDataGrid-virtualScroller": {
|
|
145
|
-
backgroundColor:
|
|
217
|
+
backgroundColor: themePalette.white
|
|
146
218
|
},
|
|
147
219
|
"& .MuiDataGrid-footerContainer": {
|
|
148
|
-
backgroundColor:
|
|
220
|
+
backgroundColor: themePalette.white,
|
|
149
221
|
height: "28px",
|
|
150
222
|
minHeight: "28px"
|
|
151
223
|
}
|
|
@@ -209,19 +281,22 @@ const TableActions = _ref2 => {
|
|
|
209
281
|
}), Boolean(isOpen) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
|
|
210
282
|
ref: actionsRef,
|
|
211
283
|
elevation: 1,
|
|
212
|
-
sx: {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
284
|
+
sx: theme => {
|
|
285
|
+
const themePalette = getPalette(theme);
|
|
286
|
+
return {
|
|
287
|
+
borderRadius: "5px",
|
|
288
|
+
position: "absolute",
|
|
289
|
+
right: "0",
|
|
290
|
+
top: "50%",
|
|
291
|
+
transform: "translate(0, -50%)",
|
|
292
|
+
display: "flex",
|
|
293
|
+
alignItems: "center",
|
|
294
|
+
gap: "8px",
|
|
295
|
+
paddingX: "11px",
|
|
296
|
+
height: "calc(100% - 4px)",
|
|
297
|
+
backgroundColor: themePalette.gray.light,
|
|
298
|
+
border: "2px solid ".concat(themePalette.gray.dark)
|
|
299
|
+
};
|
|
225
300
|
},
|
|
226
301
|
children: [actions.map((action, index) => /*#__PURE__*/React.cloneElement(action, {
|
|
227
302
|
row,
|
|
@@ -316,23 +391,18 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
316
391
|
sx: {
|
|
317
392
|
display: 'flex',
|
|
318
393
|
gap: '8px',
|
|
319
|
-
// Adjust the space between icons as needed
|
|
320
394
|
flexWrap: 'wrap',
|
|
321
|
-
// Keep icons on the same line; remove if you want them to wrap
|
|
322
395
|
justifyContent: 'center',
|
|
323
|
-
// Center the icons horizontally
|
|
324
396
|
alignItems: 'center',
|
|
325
|
-
|
|
326
|
-
minWidth: 0 // Prevent the flex container from stretching past its content width
|
|
397
|
+
minWidth: 0
|
|
327
398
|
},
|
|
328
399
|
children: actions.map((action, index) => /*#__PURE__*/React.cloneElement(action, {
|
|
329
400
|
row,
|
|
330
401
|
key: index,
|
|
331
402
|
sx: _objectSpread(_objectSpread({}, action.props.sx), {}, {
|
|
332
403
|
marginRight: 0,
|
|
333
|
-
// Remove any outer margins
|
|
334
404
|
'&:last-child': {
|
|
335
|
-
marginRight: 0
|
|
405
|
+
marginRight: 0
|
|
336
406
|
}
|
|
337
407
|
})
|
|
338
408
|
}))
|
|
@@ -364,7 +434,6 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
364
434
|
const {
|
|
365
435
|
data
|
|
366
436
|
} = params;
|
|
367
|
-
// Render the passed rowDetailPanel component with the row data
|
|
368
437
|
return /*#__PURE__*/React.cloneElement(rowDetailPanel, {
|
|
369
438
|
rowData: data
|
|
370
439
|
});
|