@portnet/ui 1.1.8 → 2.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/inputs/PuiDateField.js +57 -121
- package/dist/components/inputs/PuiDateTimeField.js +297 -27
- package/dist/components/table/ActionPopover.js +56 -0
- package/dist/components/table/PuiTable.js +10 -9
- package/dist/components/ui/pages/general/PuiSearchPage.js +126 -37
- package/package.json +4 -4
- package/dist/components/others/DateTimePickerField.js +0 -213
|
@@ -9,13 +9,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
-
var
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
13
|
var _DesktopDatePicker = require("@mui/x-date-pickers/DesktopDatePicker");
|
|
14
|
-
var _LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
15
14
|
var _formik = require("formik");
|
|
16
15
|
var _moment = _interopRequireDefault(require("moment"));
|
|
17
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
17
|
var React = _interopRequireWildcard(require("react"));
|
|
18
|
+
var _apperance = require("../../config/apperance");
|
|
19
|
+
var _StyledMuiTextField = _interopRequireDefault(require("../common/StyledMuiTextField"));
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
21
|
const _excluded = ["id", "className", "sx", "label", "name", "required", "value", "minDate", "maxDate", "inputFormat", "format", "disablePast", "disableFuture", "error", "readOnly", "fullWidth", "disabled", "helperText", "onChange", "onBlur"],
|
|
21
22
|
_excluded2 = ["id", "className", "sx", "label", "name", "required", "value", "minDate", "maxDate", "inputFormat", "format", "disablePast", "disableFuture", "error", "readOnly", "fullWidth", "disabled", "helperText", "onChange", "onBlur"],
|
|
@@ -23,94 +24,36 @@ const _excluded = ["id", "className", "sx", "label", "name", "required", "value"
|
|
|
23
24
|
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); }
|
|
24
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
26
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
28
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
26
29
|
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
30
|
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
31
|
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; }
|
|
29
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
30
33
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
success: "#48AC24",
|
|
40
|
-
info: "#2278CF",
|
|
41
|
-
white: "#FFF",
|
|
42
|
-
dark: "#000",
|
|
43
|
-
gray: {
|
|
44
|
-
darker: "#505050",
|
|
45
|
-
dark: "#b6b6b6",
|
|
46
|
-
light: "#F1F1F1"
|
|
47
|
-
},
|
|
48
|
-
background: {
|
|
49
|
-
required: "#FFFBE3",
|
|
50
|
-
error: "#FFE5E5"
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const textFieldStyles = {
|
|
54
|
-
"&.MuiFormControl-root": {
|
|
55
|
-
"&.required .MuiInputBase-root": {
|
|
56
|
-
backgroundColor: required => required ? palette.background.required : "white"
|
|
57
|
-
},
|
|
58
|
-
"& .MuiFormLabel-root": {
|
|
59
|
-
zIndex: 0,
|
|
60
|
-
lineSpacing: "-0.03em",
|
|
61
|
-
position: "initial",
|
|
62
|
-
transform: "none",
|
|
63
|
-
fontSize: "0.8rem",
|
|
64
|
-
fontWeight: "600",
|
|
65
|
-
marginBottom: "4px",
|
|
66
|
-
color: palette.gray.darker,
|
|
67
|
-
"&.Mui-focused ": {
|
|
68
|
-
color: palette.primary
|
|
69
|
-
},
|
|
70
|
-
"&.Mui-disabled": {
|
|
71
|
-
color: palette.gray.darker
|
|
72
|
-
},
|
|
73
|
-
"&.Mui-error": {
|
|
74
|
-
color: palette.error
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"& .MuiInputBase-root": {
|
|
78
|
-
backgroundColor: required => required ? palette.background.required : "white",
|
|
79
|
-
border: "2px solid ".concat(palette.gray.dark),
|
|
80
|
-
borderRadius: "5px",
|
|
81
|
-
"&.MuiInputBase-multiline": {
|
|
82
|
-
padding: "8px 0"
|
|
83
|
-
},
|
|
84
|
-
"&.Mui-focused ": {
|
|
85
|
-
border: "2px solid ".concat(palette.primary)
|
|
86
|
-
},
|
|
87
|
-
"&.Mui-error ": {
|
|
88
|
-
border: "2px solid ".concat(palette.error),
|
|
89
|
-
backgroundColor: palette.background.error
|
|
34
|
+
const StyledDateMuiTextField = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledMuiTextField.default, _objectSpread({
|
|
35
|
+
ref: ref
|
|
36
|
+
}, props))))(() => {
|
|
37
|
+
return {
|
|
38
|
+
"&.MuiFormControl-root": {
|
|
39
|
+
display: "block",
|
|
40
|
+
"& .MuiFormLabel-root": {
|
|
41
|
+
marginBottom: "0.65px"
|
|
90
42
|
},
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
WebkitTextFillColor: "".concat(palette.gray.darker)
|
|
43
|
+
"& .MuiInputAdornment-root .MuiButtonBase-root": {
|
|
44
|
+
"&:hover": {
|
|
45
|
+
backgroundColor: "transparent"
|
|
95
46
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
47
|
+
padding: "0 6px",
|
|
48
|
+
marginRight: "-8px",
|
|
49
|
+
"& .MuiSvgIcon-root": {
|
|
50
|
+
width: "16px",
|
|
51
|
+
height: "16px"
|
|
52
|
+
}
|
|
102
53
|
}
|
|
103
|
-
},
|
|
104
|
-
"& .MuiFormHelperText-root": {
|
|
105
|
-
fontWeight: "bold",
|
|
106
|
-
fontSize: ".7rem",
|
|
107
|
-
color: "red"
|
|
108
|
-
},
|
|
109
|
-
"& fieldset": {
|
|
110
|
-
display: "none"
|
|
111
54
|
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
55
|
+
};
|
|
56
|
+
});
|
|
114
57
|
const PuiStandardDateField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
115
58
|
let {
|
|
116
59
|
id,
|
|
@@ -143,48 +86,41 @@ const PuiStandardDateField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
143
86
|
onChange(null);
|
|
144
87
|
}
|
|
145
88
|
};
|
|
146
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
name,
|
|
164
|
-
sx: textFieldStyles,
|
|
165
|
-
fullWidth,
|
|
166
|
-
required,
|
|
167
|
-
error,
|
|
168
|
-
helperText
|
|
169
|
-
},
|
|
170
|
-
popper: {
|
|
171
|
-
sx: {
|
|
172
|
-
"& .MuiPaper-root": {
|
|
173
|
-
boxShadow: "none !important",
|
|
174
|
-
border: "1px solid #e0e0e0",
|
|
175
|
-
backgroundColor: "white"
|
|
176
|
-
},
|
|
177
|
-
"& .MuiPickersDay-root.Mui-selected": {
|
|
178
|
-
backgroundColor: "".concat(palette.primary, " !important")
|
|
179
|
-
},
|
|
180
|
-
"& .Mui-selected": {
|
|
181
|
-
backgroundColor: "".concat(palette.primary, " !important")
|
|
182
|
-
}
|
|
183
|
-
}
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DesktopDatePicker.DesktopDatePicker, _objectSpread({
|
|
90
|
+
ref: ref,
|
|
91
|
+
sx: sx,
|
|
92
|
+
label: label,
|
|
93
|
+
inputFormat: inputFormat,
|
|
94
|
+
value: value,
|
|
95
|
+
onChange: handleChange,
|
|
96
|
+
disablePast: disablePast,
|
|
97
|
+
disableFuture: disableFuture,
|
|
98
|
+
disabled: disabled,
|
|
99
|
+
maxDate: maxDate,
|
|
100
|
+
minDate: minDate,
|
|
101
|
+
readOnly: readOnly,
|
|
102
|
+
PopperProps: {
|
|
103
|
+
sx: {
|
|
104
|
+
"& .MuiButtonBase-root.Mui-selected, & .MuiButtonBase-root.Mui-selected:focus, & .MuiButtonBase-root.Mui-selected:hover": {
|
|
105
|
+
backgroundColor: _apperance.palette.primary
|
|
184
106
|
}
|
|
185
107
|
}
|
|
186
|
-
},
|
|
187
|
-
|
|
108
|
+
},
|
|
109
|
+
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledDateMuiTextField, _objectSpread(_objectSpread({
|
|
110
|
+
id: id,
|
|
111
|
+
className: className,
|
|
112
|
+
name: name,
|
|
113
|
+
required: required,
|
|
114
|
+
fullWidth: fullWidth,
|
|
115
|
+
onBlur: onBlur,
|
|
116
|
+
helperText: helperText
|
|
117
|
+
}, params), {}, {
|
|
118
|
+
error: params.error || error,
|
|
119
|
+
inputProps: _objectSpread({
|
|
120
|
+
name
|
|
121
|
+
}, params.inputProps)
|
|
122
|
+
}))
|
|
123
|
+
}, rest));
|
|
188
124
|
});
|
|
189
125
|
const PuiFormikDateField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
190
126
|
let {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
3
4
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
4
5
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
5
6
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
@@ -8,22 +9,238 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
9
|
});
|
|
9
10
|
exports.default = void 0;
|
|
10
11
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _DatePicker = require("@mui/x-date-pickers/DatePicker");
|
|
13
15
|
var _formik = require("formik");
|
|
14
16
|
var _moment = _interopRequireDefault(require("moment"));
|
|
15
|
-
var
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var React = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _apperance = require("../../config/apperance");
|
|
20
|
+
var _PuiButton = _interopRequireDefault(require("../buttons/PuiButton"));
|
|
21
|
+
var _StyledMuiTextField = _interopRequireDefault(require("../common/StyledMuiTextField"));
|
|
22
|
+
var _PuiDialog = _interopRequireDefault(require("../others/PuiDialog"));
|
|
23
|
+
var _PuiTextField = _interopRequireDefault(require("./PuiTextField"));
|
|
16
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["id", "className", "sx", "label", "name", "required", "value", "minDate", "maxDate", "inputFormat", "format", "disablePast", "disableFuture", "error", "readOnly", "fullWidth", "disabled", "helperText", "onChange", "onBlur"]
|
|
25
|
+
const _excluded = ["id", "className", "sx", "label", "name", "required", "value", "minDate", "maxDate", "inputFormat", "format", "disablePast", "disableFuture", "error", "readOnly", "fullWidth", "disabled", "helperText", "onChange", "onBlur"],
|
|
26
|
+
_excluded2 = ["id", "className", "sx", "label", "name", "required", "value", "minDate", "maxDate", "inputFormat", "format", "disablePast", "disableFuture", "error", "readOnly", "fullWidth", "disabled", "helperText", "onChange", "onBlur"],
|
|
27
|
+
_excluded3 = ["formik", "id", "className", "sx", "label", "name", "required", "value", "minDate", "maxDate", "inputFormat", "format", "disablePast", "disableFuture", "error", "readOnly", "fullWidth", "disabled", "helperText", "onChange", "onBlur"];
|
|
28
|
+
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); }
|
|
29
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
32
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
19
33
|
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; }
|
|
20
34
|
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; }
|
|
21
35
|
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; }
|
|
22
36
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
37
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
const StyledDateMuiTextField = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledMuiTextField.default, _objectSpread({
|
|
39
|
+
ref: ref
|
|
40
|
+
}, props))))(() => ({
|
|
41
|
+
"&.MuiFormControl-root": {
|
|
42
|
+
display: "block",
|
|
43
|
+
"& .MuiInputAdornment-root .MuiButtonBase-root": {
|
|
44
|
+
padding: "6px",
|
|
45
|
+
marginRight: "-8px",
|
|
46
|
+
"& .MuiSvgIcon-root": {
|
|
47
|
+
width: "16px",
|
|
48
|
+
height: "16px"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
const TimePickerDialog = _ref => {
|
|
54
|
+
var _ref2, _ref3;
|
|
55
|
+
let {
|
|
56
|
+
open,
|
|
57
|
+
selectedDate,
|
|
58
|
+
onTimeSelected,
|
|
59
|
+
onClose,
|
|
60
|
+
position
|
|
61
|
+
} = _ref;
|
|
62
|
+
const defaultTime = (0, _moment.default)(selectedDate).isValid() ? (0, _moment.default)(selectedDate).format("HH:mm") : (0, _moment.default)().format("HH:mm");
|
|
63
|
+
const [selectedTime, setSelectedTime] = React.useState(defaultTime);
|
|
64
|
+
const handleTimeChange = event => {
|
|
65
|
+
setSelectedTime(event.target.value);
|
|
66
|
+
};
|
|
67
|
+
const handleOk = () => {
|
|
68
|
+
onTimeSelected(selectedTime);
|
|
69
|
+
onClose();
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiDialog.default, {
|
|
72
|
+
open: open,
|
|
73
|
+
onClose: onClose,
|
|
74
|
+
slotProps: {
|
|
75
|
+
backdrop: {
|
|
76
|
+
style: {
|
|
77
|
+
backgroundColor: "transparent",
|
|
78
|
+
boxShadow: "none"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
hideBackdrop: true,
|
|
83
|
+
PaperProps: {
|
|
84
|
+
elevation: 5,
|
|
85
|
+
sx: {
|
|
86
|
+
position: "fixed",
|
|
87
|
+
alignContent: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
backgroundColor: "white",
|
|
91
|
+
height: 58,
|
|
92
|
+
width: 340,
|
|
93
|
+
maxWidth: "720px!important",
|
|
94
|
+
left: (_ref2 = (position === null || position === void 0 ? void 0 : position.left) - 420 / 2) !== null && _ref2 !== void 0 ? _ref2 : 0,
|
|
95
|
+
top: (_ref3 = (position === null || position === void 0 ? void 0 : position.top) + 36) !== null && _ref3 !== void 0 ? _ref3 : 36
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
99
|
+
sx: {
|
|
100
|
+
display: "flex",
|
|
101
|
+
gap: 1
|
|
102
|
+
},
|
|
103
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTextField.default, {
|
|
104
|
+
id: "time",
|
|
105
|
+
type: "time",
|
|
106
|
+
value: selectedTime,
|
|
107
|
+
onChange: handleTimeChange,
|
|
108
|
+
InputLabelProps: {
|
|
109
|
+
shrink: true
|
|
110
|
+
},
|
|
111
|
+
inputProps: {
|
|
112
|
+
step: 60
|
|
113
|
+
},
|
|
114
|
+
formik: false,
|
|
115
|
+
sx: {
|
|
116
|
+
width: 150
|
|
117
|
+
}
|
|
118
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
119
|
+
onClick: onClose,
|
|
120
|
+
sx: {
|
|
121
|
+
color: _apperance.palette.primary
|
|
122
|
+
},
|
|
123
|
+
children: "Cancel"
|
|
124
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
125
|
+
onClick: handleOk,
|
|
126
|
+
sx: {
|
|
127
|
+
color: _apperance.palette.primary
|
|
128
|
+
},
|
|
129
|
+
children: "OK"
|
|
130
|
+
})]
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const PuiStandardDateTimeField = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
135
|
+
let {
|
|
136
|
+
id,
|
|
137
|
+
className,
|
|
138
|
+
sx,
|
|
139
|
+
label,
|
|
140
|
+
name,
|
|
141
|
+
required,
|
|
142
|
+
value,
|
|
143
|
+
minDate,
|
|
144
|
+
maxDate,
|
|
145
|
+
inputFormat = "YYYY-MM-DDTHH:mm:ss.SSSZ",
|
|
146
|
+
format = "YYYY-MM-DDTHH:mm:ss.SSSZ",
|
|
147
|
+
disablePast,
|
|
148
|
+
disableFuture,
|
|
149
|
+
error,
|
|
150
|
+
readOnly,
|
|
151
|
+
fullWidth,
|
|
152
|
+
disabled,
|
|
153
|
+
helperText,
|
|
154
|
+
onChange,
|
|
155
|
+
onBlur
|
|
156
|
+
} = _ref4,
|
|
157
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
158
|
+
const textFieldRef = React.useRef(null);
|
|
159
|
+
const [dateTime, setDateTime] = React.useState(value || null);
|
|
160
|
+
const minDateObj = minDate ? (0, _moment.default)(minDate, format).toDate() : undefined;
|
|
161
|
+
const maxDateObj = maxDate ? (0, _moment.default)(maxDate, format).toDate() : undefined;
|
|
162
|
+
const [displayedDateTime, setDisplayedDateTime] = React.useState(value || null);
|
|
163
|
+
const [openTimePicker, setOpenTimePicker] = React.useState(false);
|
|
164
|
+
const [dialogPosition, setDialogPosition] = React.useState();
|
|
165
|
+
const handleDateChange = date => {
|
|
166
|
+
if (date) {
|
|
167
|
+
setDateTime((0, _moment.default)(date).format(format));
|
|
168
|
+
setOpenTimePicker(true);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const handleTimeSelected = time => {
|
|
172
|
+
const newDateTime = (0, _moment.default)(dateTime).format("YYYY-MM-DD") + "T" + time;
|
|
173
|
+
const updatedDateTime = (0, _moment.default)(newDateTime, "YYYY-MM-DDTHH:mm").format(format);
|
|
174
|
+
setDateTime(updatedDateTime);
|
|
175
|
+
setDisplayedDateTime(updatedDateTime);
|
|
176
|
+
onChange(updatedDateTime);
|
|
177
|
+
};
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
const updatePosition = () => {
|
|
180
|
+
if (textFieldRef !== null && textFieldRef !== void 0 && textFieldRef.current) {
|
|
181
|
+
const rect = textFieldRef.current.getBoundingClientRect();
|
|
182
|
+
console.log("rect : ", rect);
|
|
183
|
+
setDialogPosition({
|
|
184
|
+
left: rect.left + rect.width / 2 + window.scrollX,
|
|
185
|
+
top: rect.top > 310 ? rect.top - 80 : rect.top + 80
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
updatePosition();
|
|
190
|
+
window.addEventListener("resize", updatePosition);
|
|
191
|
+
window.addEventListener("scroll", updatePosition);
|
|
192
|
+
return () => {
|
|
193
|
+
window.removeEventListener("resize", updatePosition);
|
|
194
|
+
window.removeEventListener("scroll", updatePosition);
|
|
195
|
+
};
|
|
196
|
+
}, []);
|
|
197
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
198
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.DatePicker, _objectSpread({
|
|
199
|
+
ref: textFieldRef,
|
|
200
|
+
sx: sx,
|
|
201
|
+
ampm: false,
|
|
202
|
+
label: label,
|
|
203
|
+
inputFormat: "DD/MM/yyyy HH:mm",
|
|
204
|
+
value: displayedDateTime,
|
|
205
|
+
onChange: handleDateChange,
|
|
206
|
+
disablePast: disablePast,
|
|
207
|
+
disableFuture: disableFuture,
|
|
208
|
+
disabled: disabled,
|
|
209
|
+
maxDate: maxDateObj,
|
|
210
|
+
minDate: minDateObj,
|
|
211
|
+
readOnly: readOnly,
|
|
212
|
+
PopperProps: {
|
|
213
|
+
sx: {
|
|
214
|
+
"& .MuiButtonBase-root.Mui-selected, & .MuiButtonBase-root.Mui-selected:focus, & .MuiButtonBase-root.Mui-selected:hover": {
|
|
215
|
+
backgroundColor: _apperance.palette.primary
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledDateMuiTextField, _objectSpread(_objectSpread({}, params), {}, {
|
|
220
|
+
ref: textFieldRef,
|
|
221
|
+
id: id,
|
|
222
|
+
className: className,
|
|
223
|
+
label: label,
|
|
224
|
+
name: name,
|
|
225
|
+
required: required,
|
|
226
|
+
fullWidth: fullWidth,
|
|
227
|
+
onBlur: onBlur,
|
|
228
|
+
helperText: helperText,
|
|
229
|
+
error: error,
|
|
230
|
+
inputProps: _objectSpread(_objectSpread({}, params.inputProps), {}, {
|
|
231
|
+
readOnly: readOnly
|
|
232
|
+
})
|
|
233
|
+
}))
|
|
234
|
+
}, rest)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TimePickerDialog, {
|
|
235
|
+
open: openTimePicker,
|
|
236
|
+
selectedDate: dateTime,
|
|
237
|
+
onTimeSelected: handleTimeSelected,
|
|
238
|
+
onClose: () => setOpenTimePicker(false),
|
|
239
|
+
position: dialogPosition
|
|
240
|
+
})]
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
const PuiFormikDateTimeField = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
27
244
|
let {
|
|
28
245
|
id,
|
|
29
246
|
className,
|
|
@@ -45,11 +262,11 @@ const PuiDateTimeField = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
45
262
|
helperText,
|
|
46
263
|
onChange,
|
|
47
264
|
onBlur
|
|
48
|
-
} =
|
|
49
|
-
rest = _objectWithoutProperties(
|
|
265
|
+
} = _ref5,
|
|
266
|
+
rest = _objectWithoutProperties(_ref5, _excluded2);
|
|
50
267
|
const [field, meta] = (0, _formik.useField)(name);
|
|
51
268
|
const formikContext = (0, _formik.useFormikContext)();
|
|
52
|
-
const [hasError, setHasError] =
|
|
269
|
+
const [hasError, setHasError] = React.useState(false);
|
|
53
270
|
const minDateObj = minDate ? (0, _moment.default)(minDate, format).toDate() : undefined;
|
|
54
271
|
const maxDateObj = maxDate ? (0, _moment.default)(maxDate, format).toDate() : undefined;
|
|
55
272
|
const handleChange = value => {
|
|
@@ -60,49 +277,100 @@ const PuiDateTimeField = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
60
277
|
onBlur(event);
|
|
61
278
|
field.onBlur(event);
|
|
62
279
|
};
|
|
63
|
-
|
|
64
|
-
setHasError(meta.touched && meta.error);
|
|
280
|
+
React.useEffect(() => {
|
|
281
|
+
setHasError(Boolean(meta) && Boolean(meta.touched) && Boolean(meta.error));
|
|
65
282
|
}, [meta]);
|
|
66
|
-
|
|
67
|
-
if (value) {
|
|
283
|
+
React.useEffect(() => {
|
|
284
|
+
if (Boolean(value)) {
|
|
68
285
|
formikContext.setFieldValue(name, value);
|
|
69
286
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
287
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
288
|
+
}, [value]);
|
|
289
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardDateTimeField, _objectSpread({
|
|
73
290
|
id: id,
|
|
291
|
+
ref: ref,
|
|
74
292
|
className: className,
|
|
75
293
|
sx: sx,
|
|
76
294
|
label: label,
|
|
77
295
|
name: name,
|
|
78
296
|
required: required,
|
|
79
|
-
value: value,
|
|
297
|
+
value: Boolean(field.value) ? format ? _moment.default.utc(field.value, format) : _moment.default.utc(field.value) : null,
|
|
80
298
|
format: format,
|
|
81
299
|
minDate: minDateObj,
|
|
82
300
|
maxDate: maxDateObj,
|
|
83
301
|
inputFormat: inputFormat,
|
|
84
302
|
disableFuture: disableFuture,
|
|
85
303
|
disablePast: disablePast,
|
|
86
|
-
error:
|
|
304
|
+
error: error || hasError,
|
|
87
305
|
readOnly: readOnly,
|
|
88
306
|
fullWidth: fullWidth,
|
|
89
307
|
disabled: disabled,
|
|
90
|
-
helperText:
|
|
308
|
+
helperText: hasError && Boolean(meta.error) ? meta.error : helperText !== null && helperText !== void 0 ? helperText : "",
|
|
91
309
|
onChange: handleChange,
|
|
92
310
|
onBlur: handleBlur
|
|
93
311
|
}, rest));
|
|
94
312
|
});
|
|
313
|
+
const PuiDateTimeField = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
314
|
+
let {
|
|
315
|
+
formik,
|
|
316
|
+
id,
|
|
317
|
+
className,
|
|
318
|
+
sx,
|
|
319
|
+
label,
|
|
320
|
+
name,
|
|
321
|
+
required,
|
|
322
|
+
value,
|
|
323
|
+
minDate,
|
|
324
|
+
maxDate,
|
|
325
|
+
inputFormat,
|
|
326
|
+
format,
|
|
327
|
+
disablePast,
|
|
328
|
+
disableFuture,
|
|
329
|
+
error,
|
|
330
|
+
readOnly,
|
|
331
|
+
fullWidth,
|
|
332
|
+
disabled,
|
|
333
|
+
helperText,
|
|
334
|
+
onChange,
|
|
335
|
+
onBlur
|
|
336
|
+
} = _ref6,
|
|
337
|
+
rest = _objectWithoutProperties(_ref6, _excluded3);
|
|
338
|
+
return /*#__PURE__*/React.createElement(formik ? PuiFormikDateTimeField : PuiStandardDateTimeField, _objectSpread({
|
|
339
|
+
ref,
|
|
340
|
+
id,
|
|
341
|
+
className,
|
|
342
|
+
sx,
|
|
343
|
+
label,
|
|
344
|
+
name,
|
|
345
|
+
required,
|
|
346
|
+
value,
|
|
347
|
+
minDate,
|
|
348
|
+
maxDate,
|
|
349
|
+
inputFormat,
|
|
350
|
+
format,
|
|
351
|
+
disablePast,
|
|
352
|
+
disableFuture,
|
|
353
|
+
error,
|
|
354
|
+
readOnly,
|
|
355
|
+
fullWidth,
|
|
356
|
+
disabled,
|
|
357
|
+
helperText,
|
|
358
|
+
onChange,
|
|
359
|
+
onBlur
|
|
360
|
+
}, rest));
|
|
361
|
+
});
|
|
95
362
|
PuiDateTimeField.propTypes = {
|
|
96
363
|
id: _propTypes.default.string,
|
|
97
364
|
className: _propTypes.default.string,
|
|
98
365
|
sx: _propTypes.default.object,
|
|
99
366
|
label: _propTypes.default.string,
|
|
100
|
-
name: _propTypes.default.string
|
|
367
|
+
name: _propTypes.default.string,
|
|
101
368
|
helperText: _propTypes.default.string,
|
|
102
369
|
inputFormat: _propTypes.default.string,
|
|
103
370
|
format: _propTypes.default.string,
|
|
104
371
|
minDate: _propTypes.default.string,
|
|
105
372
|
maxDate: _propTypes.default.string,
|
|
373
|
+
formik: _propTypes.default.bool,
|
|
106
374
|
disabled: _propTypes.default.bool,
|
|
107
375
|
required: _propTypes.default.bool,
|
|
108
376
|
error: _propTypes.default.bool,
|
|
@@ -111,16 +379,18 @@ PuiDateTimeField.propTypes = {
|
|
|
111
379
|
readOnly: _propTypes.default.bool,
|
|
112
380
|
fullWidth: _propTypes.default.bool,
|
|
113
381
|
onChange: _propTypes.default.func,
|
|
114
|
-
onBlur: _propTypes.default.func
|
|
115
|
-
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.instanceOf(Date)])
|
|
382
|
+
onBlur: _propTypes.default.func
|
|
116
383
|
};
|
|
117
384
|
PuiDateTimeField.defaultProps = {
|
|
118
|
-
inputFormat: "YYYY
|
|
119
|
-
|
|
385
|
+
inputFormat: "DD/MM/YYYY HH:mm",
|
|
386
|
+
formik: true,
|
|
387
|
+
disabled: false,
|
|
388
|
+
required: false,
|
|
389
|
+
error: false,
|
|
390
|
+
fullWidth: true,
|
|
391
|
+
readOnly: false,
|
|
120
392
|
disablePast: false,
|
|
121
393
|
disableFuture: false,
|
|
122
|
-
readOnly: false,
|
|
123
|
-
fullWidth: true,
|
|
124
394
|
onChange: () => {},
|
|
125
395
|
onBlur: () => {}
|
|
126
396
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
|
|
11
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
12
|
+
var _MoreVert = _interopRequireDefault(require("@mui/icons-material/MoreVert"));
|
|
13
|
+
var _system = require("@mui/system");
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const ActionPopover = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
row,
|
|
20
|
+
actions
|
|
21
|
+
} = _ref;
|
|
22
|
+
const [anchorEl, setAnchorEl] = _react.default.useState(null);
|
|
23
|
+
const handleClick = event => {
|
|
24
|
+
setAnchorEl(event.currentTarget);
|
|
25
|
+
};
|
|
26
|
+
const handleClose = () => {
|
|
27
|
+
setAnchorEl(null);
|
|
28
|
+
};
|
|
29
|
+
const open = Boolean(anchorEl);
|
|
30
|
+
const id = open ? 'simple-popover' : undefined;
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
32
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
33
|
+
"aria-describedby": id,
|
|
34
|
+
onClick: handleClick,
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoreVert.default, {})
|
|
36
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
|
|
37
|
+
id: id,
|
|
38
|
+
open: open,
|
|
39
|
+
anchorEl: anchorEl,
|
|
40
|
+
onClose: handleClose,
|
|
41
|
+
anchorOrigin: {
|
|
42
|
+
vertical: 'bottom',
|
|
43
|
+
horizontal: 'left'
|
|
44
|
+
},
|
|
45
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
|
|
46
|
+
p: 2,
|
|
47
|
+
children: actions.map((action, index) => /*#__PURE__*/_react.default.cloneElement(action, {
|
|
48
|
+
row,
|
|
49
|
+
key: index,
|
|
50
|
+
onClick: handleClose // Assuming you want to close the popover when an action is clicked
|
|
51
|
+
}))
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var _default = exports.default = ActionPopover;
|
|
@@ -21,6 +21,7 @@ var _PuiCheckbox = _interopRequireDefault(require("../inputs/PuiCheckbox"));
|
|
|
21
21
|
var _PuiIcon = _interopRequireDefault(require("../others/PuiIcon"));
|
|
22
22
|
var _PuiTooltip = _interopRequireDefault(require("../others/PuiTooltip"));
|
|
23
23
|
var _PuiTableAction = _interopRequireDefault(require("./PuiTableAction"));
|
|
24
|
+
var _ActionPopover = _interopRequireDefault(require("./ActionPopover"));
|
|
24
25
|
var _system = require("@mui/system");
|
|
25
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
27
|
const _excluded = ["id", "className", "sx", "elevate", "rows", "rowCount", "columns", "paginationMode", "page", "pageSize", "checkboxSelection", "loading", "stripped", "actions", "oneActionOnly", "onSelect", "onPageChange", "onPageSizeChange", "rowDetailPanel"];
|
|
@@ -113,7 +114,7 @@ const StyledMuiTable = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props,
|
|
|
113
114
|
textOverflow: "ellipsis",
|
|
114
115
|
overflow: "hidden",
|
|
115
116
|
maxHeight: "none",
|
|
116
|
-
minWidth:
|
|
117
|
+
minWidth: 'maxWidth',
|
|
117
118
|
wordBreak: "break-word",
|
|
118
119
|
"&.tableAction": {
|
|
119
120
|
justifyContent: "center",
|
|
@@ -314,14 +315,14 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
314
315
|
} = _ref4;
|
|
315
316
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Box, {
|
|
316
317
|
sx: {
|
|
317
|
-
display:
|
|
318
|
-
gap:
|
|
318
|
+
display: 'flex',
|
|
319
|
+
gap: '8px',
|
|
319
320
|
// Adjust the space between icons as needed
|
|
320
|
-
flexWrap:
|
|
321
|
+
flexWrap: 'wrap',
|
|
321
322
|
// Keep icons on the same line; remove if you want them to wrap
|
|
322
|
-
justifyContent:
|
|
323
|
+
justifyContent: 'center',
|
|
323
324
|
// Center the icons horizontally
|
|
324
|
-
alignItems:
|
|
325
|
+
alignItems: 'center',
|
|
325
326
|
// Align icons vertically
|
|
326
327
|
minWidth: 0 // Prevent the flex container from stretching past its content width
|
|
327
328
|
},
|
|
@@ -331,7 +332,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
331
332
|
sx: _objectSpread(_objectSpread({}, action.props.sx), {}, {
|
|
332
333
|
marginRight: 0,
|
|
333
334
|
// Remove any outer margins
|
|
334
|
-
|
|
335
|
+
'&:last-child': {
|
|
335
336
|
marginRight: 0 // Ensure the last item doesn't push the container width
|
|
336
337
|
}
|
|
337
338
|
})
|
|
@@ -371,7 +372,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
371
372
|
};
|
|
372
373
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
373
374
|
style: {
|
|
374
|
-
width:
|
|
375
|
+
width: '100%'
|
|
375
376
|
},
|
|
376
377
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledMuiTable, _objectSpread({
|
|
377
378
|
ref: ref,
|
|
@@ -406,7 +407,7 @@ const PuiTable = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
406
407
|
loading: loading,
|
|
407
408
|
paginationMode: paginationMode,
|
|
408
409
|
localeText: localeText,
|
|
409
|
-
getRowHeight: () =>
|
|
410
|
+
getRowHeight: () => 'auto',
|
|
410
411
|
onPageChange: onPageChange,
|
|
411
412
|
onPageSizeChange: onPageSizeChange,
|
|
412
413
|
onSelectionModelChange: onSelect,
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
require("core-js/modules/es.weak-map.js");
|
|
4
4
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
5
5
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
6
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
6
|
Object.defineProperty(exports, "__esModule", {
|
|
8
7
|
value: true
|
|
9
8
|
});
|
|
10
9
|
exports.default = void 0;
|
|
11
10
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
12
11
|
require("core-js/modules/esnext.iterator.map.js");
|
|
13
|
-
|
|
12
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var
|
|
15
|
+
var _formik = require("formik");
|
|
16
16
|
var _PuiButton = _interopRequireDefault(require("../../../buttons/PuiButton"));
|
|
17
17
|
var _PuiFormikForm = _interopRequireDefault(require("../../../others/PuiFormikForm"));
|
|
18
18
|
var _PuiGrid = _interopRequireDefault(require("../../../others/PuiGrid"));
|
|
@@ -20,15 +20,17 @@ var _PuiIcon = _interopRequireDefault(require("../../../others/PuiIcon"));
|
|
|
20
20
|
var _PuiSection = _interopRequireDefault(require("../../../others/PuiSection"));
|
|
21
21
|
var _PuiTable = _interopRequireDefault(require("../../../table/PuiTable"));
|
|
22
22
|
var _PuiDefaultPage = _interopRequireDefault(require("./PuiDefaultPage"));
|
|
23
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
24
|
+
var _ExpandLess = _interopRequireDefault(require("@mui/icons-material/ExpandLess"));
|
|
23
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
27
|
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
28
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
29
|
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; }
|
|
28
30
|
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; }
|
|
29
31
|
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; }
|
|
30
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
31
|
-
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); }
|
|
33
|
+
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); } // Container for search form and actions
|
|
32
34
|
const PuiStandardSearchPageContainer = _ref => {
|
|
33
35
|
let {
|
|
34
36
|
actions,
|
|
@@ -63,9 +65,77 @@ const PuiSearchPage = _ref2 => {
|
|
|
63
65
|
onRetour,
|
|
64
66
|
onReset,
|
|
65
67
|
onSubmit,
|
|
66
|
-
children
|
|
67
|
-
additionalActions
|
|
68
|
+
children,
|
|
69
|
+
additionalActions,
|
|
70
|
+
collapsibleSearchSection = true,
|
|
71
|
+
// Collapsible by default
|
|
72
|
+
alwaysVisibleFields = null,
|
|
73
|
+
// Champs toujours visibles
|
|
74
|
+
collapsibleFields = null // Champs collapsibles
|
|
68
75
|
} = _ref2;
|
|
76
|
+
const [isSearchSectionExpanded, setSearchSectionExpanded] = (0, _react.useState)(false);
|
|
77
|
+
|
|
78
|
+
// Si des champs spécifiques sont définis comme collapsibles
|
|
79
|
+
const hasCollapsibleFields = collapsibleFields !== null;
|
|
80
|
+
// Si des champs sont toujours visibles
|
|
81
|
+
const hasAlwaysVisibleFields = alwaysVisibleFields !== null;
|
|
82
|
+
|
|
83
|
+
// Fonction qui détermine si la section de recherche a des champs à afficher même si collapsée
|
|
84
|
+
const shouldRenderSearchContent = () => {
|
|
85
|
+
if (!collapsibleSearchSection) return true; // Si non collapsible, toujours afficher
|
|
86
|
+
if (hasAlwaysVisibleFields) return true; // Si des champs sont toujours visibles, les afficher
|
|
87
|
+
return isSearchSectionExpanded; // Sinon, afficher seulement si la section est étendue
|
|
88
|
+
};
|
|
89
|
+
const toggleSearchSection = () => {
|
|
90
|
+
setSearchSectionExpanded(prev => !prev);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Fonction pour rendre le contenu des champs en fonction de leur visibilité
|
|
94
|
+
const renderSearchFields = () => {
|
|
95
|
+
// Si pas de champs collapsibles ou toujours visibles spécifiés, on affiche tous les enfants
|
|
96
|
+
if (!hasCollapsibleFields && !hasAlwaysVisibleFields) {
|
|
97
|
+
return children;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Si la section est étendue ou pas de champs collapsibles, on affiche tous les champs
|
|
101
|
+
if (isSearchSectionExpanded && hasCollapsibleFields) {
|
|
102
|
+
return collapsibleFields;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Si la section est collapsée et qu'on a des champs toujours visibles, on les affiche
|
|
106
|
+
if (hasAlwaysVisibleFields) {
|
|
107
|
+
return alwaysVisibleFields;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Par défaut, afficher les enfants
|
|
111
|
+
return children;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Bouton pour étendre/réduire les champs additionnels
|
|
115
|
+
const renderToggleButton = () => {
|
|
116
|
+
if (!hasCollapsibleFields) return null;
|
|
117
|
+
if (isSearchSectionExpanded) {
|
|
118
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
119
|
+
item: true,
|
|
120
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
121
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}),
|
|
122
|
+
onClick: toggleSearchSection,
|
|
123
|
+
color: "tertiary",
|
|
124
|
+
children: "Moins d'options"
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
129
|
+
item: true,
|
|
130
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
131
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {}),
|
|
132
|
+
onClick: toggleSearchSection,
|
|
133
|
+
color: "tertiary",
|
|
134
|
+
children: "Plus d'options"
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
69
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PuiDefaultPage.default, {
|
|
70
140
|
title: title,
|
|
71
141
|
titleIcon: titleIcon,
|
|
@@ -77,11 +147,24 @@ const PuiSearchPage = _ref2 => {
|
|
|
77
147
|
retour: retour,
|
|
78
148
|
onRetour: onRetour,
|
|
79
149
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiSection.default, {
|
|
80
|
-
title:
|
|
150
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
151
|
+
onClick: collapsibleSearchSection ? toggleSearchSection : undefined,
|
|
152
|
+
style: {
|
|
153
|
+
display: "flex",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
cursor: collapsibleSearchSection ? "pointer" : "default"
|
|
156
|
+
},
|
|
157
|
+
children: [collapsibleSearchSection && (isSearchSectionExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandLess.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {})), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
158
|
+
style: {
|
|
159
|
+
marginLeft: collapsibleSearchSection ? "8px" : "0px"
|
|
160
|
+
},
|
|
161
|
+
children: "Param\xE8tres de recherche"
|
|
162
|
+
})]
|
|
163
|
+
}),
|
|
81
164
|
sx: {
|
|
82
165
|
marginBottom: 2
|
|
83
166
|
},
|
|
84
|
-
children: formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
167
|
+
children: shouldRenderSearchContent() && (formik ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_formik.Formik, _objectSpread(_objectSpread({
|
|
85
168
|
initialValues: {}
|
|
86
169
|
}, formikProps), {}, {
|
|
87
170
|
children: _ref3 => {
|
|
@@ -116,18 +199,16 @@ const PuiSearchPage = _ref2 => {
|
|
|
116
199
|
loadingPosition: "start",
|
|
117
200
|
children: "Rechercher"
|
|
118
201
|
})
|
|
119
|
-
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, index);
|
|
128
|
-
})]
|
|
202
|
+
}), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
203
|
+
item: true,
|
|
204
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
205
|
+
startIcon: actionItem.icon,
|
|
206
|
+
onClick: actionItem.action,
|
|
207
|
+
children: actionItem.name
|
|
208
|
+
})
|
|
209
|
+
}, index)), hasCollapsibleFields && renderToggleButton()]
|
|
129
210
|
}),
|
|
130
|
-
children:
|
|
211
|
+
children: renderSearchFields()
|
|
131
212
|
})
|
|
132
213
|
});
|
|
133
214
|
}
|
|
@@ -157,22 +238,22 @@ const PuiSearchPage = _ref2 => {
|
|
|
157
238
|
loadingPosition: "start",
|
|
158
239
|
children: "Rechercher"
|
|
159
240
|
})
|
|
160
|
-
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}, index);
|
|
169
|
-
})]
|
|
241
|
+
}), additionalActions && additionalActions.map((actionItem, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
242
|
+
item: true,
|
|
243
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
244
|
+
startIcon: actionItem.icon,
|
|
245
|
+
onClick: actionItem.action,
|
|
246
|
+
children: actionItem.name
|
|
247
|
+
})
|
|
248
|
+
}, index)), hasCollapsibleFields && renderToggleButton()]
|
|
170
249
|
}),
|
|
171
|
-
children:
|
|
172
|
-
})
|
|
173
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread({
|
|
250
|
+
children: renderSearchFields()
|
|
251
|
+
}))
|
|
252
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiTable.default, _objectSpread(_objectSpread({
|
|
174
253
|
paginationMode: "server"
|
|
175
|
-
}, tableProps)
|
|
254
|
+
}, tableProps), {}, {
|
|
255
|
+
pinnedColumns: tableProps.pinnedColumns // Added pinnedColumns
|
|
256
|
+
}))]
|
|
176
257
|
});
|
|
177
258
|
};
|
|
178
259
|
PuiSearchPage.propTypes = {
|
|
@@ -185,7 +266,9 @@ PuiSearchPage.propTypes = {
|
|
|
185
266
|
topNav: _propTypes.default.bool,
|
|
186
267
|
bottomNav: _propTypes.default.bool,
|
|
187
268
|
loading: _propTypes.default.bool,
|
|
188
|
-
tableProps: _propTypes.default.
|
|
269
|
+
tableProps: _propTypes.default.shape({
|
|
270
|
+
pinnedColumns: _propTypes.default.object // Added pinnedColumns prop type
|
|
271
|
+
}),
|
|
189
272
|
retour: _propTypes.default.bool,
|
|
190
273
|
onRetour: _propTypes.default.func,
|
|
191
274
|
onReset: _propTypes.default.func,
|
|
@@ -194,11 +277,17 @@ PuiSearchPage.propTypes = {
|
|
|
194
277
|
name: _propTypes.default.string.isRequired,
|
|
195
278
|
action: _propTypes.default.func.isRequired,
|
|
196
279
|
icon: _propTypes.default.element
|
|
197
|
-
}))
|
|
280
|
+
})),
|
|
281
|
+
collapsibleSearchSection: _propTypes.default.bool,
|
|
282
|
+
alwaysVisibleFields: _propTypes.default.node,
|
|
283
|
+
collapsibleFields: _propTypes.default.node
|
|
198
284
|
};
|
|
199
285
|
PuiSearchPage.defaultProps = {
|
|
200
286
|
formik: true,
|
|
201
287
|
loading: false,
|
|
202
|
-
additionalActions: []
|
|
288
|
+
additionalActions: [],
|
|
289
|
+
collapsibleSearchSection: true,
|
|
290
|
+
alwaysVisibleFields: null,
|
|
291
|
+
collapsibleFields: null
|
|
203
292
|
};
|
|
204
293
|
var _default = exports.default = PuiSearchPage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portnet/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Portnet UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"@mui/material": "^5.10.16",
|
|
22
22
|
"@mui/x-data-grid": "^5.17.26",
|
|
23
23
|
"@mui/x-data-grid-pro": "^5.17.26",
|
|
24
|
-
"@mui/x-date-pickers": "^
|
|
24
|
+
"@mui/x-date-pickers": "^5.0.4",
|
|
25
25
|
"@testing-library/jest-dom": "^5.16.5",
|
|
26
26
|
"@testing-library/react": "^13.4.0",
|
|
27
27
|
"@testing-library/user-event": "^13.5.0",
|
|
28
|
-
"ajv": "^
|
|
28
|
+
"ajv": "^6.12.6",
|
|
29
|
+
"ajv-keywords": "^3.5.2",
|
|
29
30
|
"axios": "^0.27.2",
|
|
30
|
-
"dayjs": "^1.11.13",
|
|
31
31
|
"formik": "^2.2.9",
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
33
|
"moment": "^2.29.4",
|
|
@@ -1,213 +0,0 @@
|
|
|
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 DateTimePickerField = _ref => {
|
|
50
|
-
let {
|
|
51
|
-
label,
|
|
52
|
-
name,
|
|
53
|
-
value: propValue,
|
|
54
|
-
onChange,
|
|
55
|
-
required,
|
|
56
|
-
error = false,
|
|
57
|
-
helperText = null,
|
|
58
|
-
fullWidth = true
|
|
59
|
-
} = _ref;
|
|
60
|
-
const [field, meta, helpers] = (0, _formik.useField)(name || "default");
|
|
61
|
-
if (!name) {
|
|
62
|
-
console.error("DateTimePickerField requires a `name` prop to work with Formik.");
|
|
63
|
-
}
|
|
64
|
-
const textFieldStyles = {
|
|
65
|
-
"&.MuiFormControl-root": {
|
|
66
|
-
"&.required .MuiInputBase-root": {
|
|
67
|
-
backgroundColor: () => required ? palette.background.required : "white"
|
|
68
|
-
},
|
|
69
|
-
"& .MuiFormLabel-root": {
|
|
70
|
-
zIndex: 0,
|
|
71
|
-
lineSpacing: "-0.03em",
|
|
72
|
-
position: "initial",
|
|
73
|
-
transform: "none",
|
|
74
|
-
fontSize: "0.8rem",
|
|
75
|
-
fontWeight: "600",
|
|
76
|
-
marginBottom: "4px",
|
|
77
|
-
color: palette.gray.darker,
|
|
78
|
-
"&.Mui-focused ": {
|
|
79
|
-
color: palette.primary
|
|
80
|
-
},
|
|
81
|
-
"&.Mui-disabled": {
|
|
82
|
-
color: palette.gray.darker
|
|
83
|
-
},
|
|
84
|
-
"&.Mui-error": {
|
|
85
|
-
color: palette.error
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"& .MuiInputBase-root": {
|
|
89
|
-
backgroundColor: () => required ? palette.background.required : "white",
|
|
90
|
-
border: "2px solid ".concat(palette.gray.dark),
|
|
91
|
-
borderRadius: "5px",
|
|
92
|
-
"&.MuiInputBase-multiline": {
|
|
93
|
-
padding: "8px 0"
|
|
94
|
-
},
|
|
95
|
-
"&.Mui-focused ": {
|
|
96
|
-
border: "2px solid ".concat(palette.primary)
|
|
97
|
-
},
|
|
98
|
-
"&.Mui-error ": {
|
|
99
|
-
border: "2px solid ".concat(palette.error),
|
|
100
|
-
backgroundColor: palette.background.error
|
|
101
|
-
},
|
|
102
|
-
"&.Mui-disabled ": {
|
|
103
|
-
"& input": {
|
|
104
|
-
color: "".concat(palette.gray.darker),
|
|
105
|
-
WebkitTextFillColor: "".concat(palette.gray.darker)
|
|
106
|
-
},
|
|
107
|
-
backgroundColor: "".concat(palette.secondary)
|
|
108
|
-
},
|
|
109
|
-
"& .MuiInputBase-input": {
|
|
110
|
-
lineHeight: "1",
|
|
111
|
-
padding: "1px 6px",
|
|
112
|
-
fontSize: "0.7rem"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"& .MuiFormHelperText-root": {
|
|
116
|
-
fontWeight: "bold",
|
|
117
|
-
fontSize: ".7rem",
|
|
118
|
-
color: "red"
|
|
119
|
-
},
|
|
120
|
-
"& fieldset": {
|
|
121
|
-
display: "none"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const {
|
|
126
|
-
setValue,
|
|
127
|
-
setTouched
|
|
128
|
-
} = helpers;
|
|
129
|
-
const handleChange = newValue => {
|
|
130
|
-
if (!!newValue) {
|
|
131
|
-
setValue(_dayjs.default.utc(newValue).format("YYYY-MM-DDTHH:mm:ss.SSS[Z]"));
|
|
132
|
-
if (onChange) {
|
|
133
|
-
onChange(_dayjs.default.utc(newValue).format("YYYY-MM-DDTHH:mm:ss.SSS[Z]"));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const handleBlur = () => {
|
|
138
|
-
setTouched(true);
|
|
139
|
-
};
|
|
140
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDatePickers.LocalizationProvider, {
|
|
141
|
-
dateAdapter: _AdapterDayjs.AdapterDayjs,
|
|
142
|
-
localeText: frenchLocaleText,
|
|
143
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateTimePicker.DateTimePicker, {
|
|
144
|
-
label: label,
|
|
145
|
-
ampm: false,
|
|
146
|
-
format: "DD/MM/YYYY hh:mm",
|
|
147
|
-
value: field.value ? _dayjs.default.utc(field.value) : !!propValue ? _dayjs.default.utc(propValue) : null,
|
|
148
|
-
closeOnSelect: false,
|
|
149
|
-
onChange: handleChange,
|
|
150
|
-
onBlur: handleBlur,
|
|
151
|
-
views: ["year", "month", "day", "hours", "minutes"],
|
|
152
|
-
timeSteps: {
|
|
153
|
-
hours: 1,
|
|
154
|
-
minutes: 1,
|
|
155
|
-
seconds: 5
|
|
156
|
-
},
|
|
157
|
-
slotProps: {
|
|
158
|
-
textField: {
|
|
159
|
-
name: name,
|
|
160
|
-
sx: textFieldStyles,
|
|
161
|
-
fullWidth: fullWidth,
|
|
162
|
-
required: required,
|
|
163
|
-
error: Boolean(meta.touched && meta.error || error),
|
|
164
|
-
helperText: meta.touched && meta.error ? meta.error : !!helperText ? helperText : ""
|
|
165
|
-
},
|
|
166
|
-
actionBar: {
|
|
167
|
-
actions: ["cancel", "accept"],
|
|
168
|
-
sx: {
|
|
169
|
-
display: "flex",
|
|
170
|
-
justifyContent: "flex-end",
|
|
171
|
-
gap: 1,
|
|
172
|
-
padding: "8px",
|
|
173
|
-
"& .MuiButton-root": {
|
|
174
|
-
borderRadius: "4px",
|
|
175
|
-
padding: "6px 16px",
|
|
176
|
-
textTransform: "none",
|
|
177
|
-
fontSize: "0.875rem",
|
|
178
|
-
fontWeight: "bold"
|
|
179
|
-
},
|
|
180
|
-
"& .MuiButton-root:nth-of-type(1)": {
|
|
181
|
-
backgroundColor: "white",
|
|
182
|
-
color: "".concat(palette.primary, " !important"),
|
|
183
|
-
border: "1px solid ".concat(palette.primary, " !important"),
|
|
184
|
-
paddingY: 0
|
|
185
|
-
},
|
|
186
|
-
"& .MuiButton-root:nth-of-type(2)": {
|
|
187
|
-
backgroundColor: "".concat(palette.primary, " !important"),
|
|
188
|
-
color: "white !important",
|
|
189
|
-
border: "1px solid ".concat(palette.primary, " !important"),
|
|
190
|
-
paddingY: 0
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
popper: {
|
|
195
|
-
sx: {
|
|
196
|
-
"& .MuiPaper-root": {
|
|
197
|
-
boxShadow: "none !important",
|
|
198
|
-
border: "1px solid #e0e0e0",
|
|
199
|
-
backgroundColor: "white"
|
|
200
|
-
},
|
|
201
|
-
"& .MuiPickersDay-root.Mui-selected": {
|
|
202
|
-
backgroundColor: "".concat(palette.primary, " !important")
|
|
203
|
-
},
|
|
204
|
-
"& .Mui-selected": {
|
|
205
|
-
backgroundColor: "".concat(palette.primary, " !important")
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
})
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
var _default = exports.default = DateTimePickerField;
|