@portnet/ui 1.1.9 → 2.0.1
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 -131
- package/dist/components/inputs/PuiDateTimeField.js +297 -27
- package/dist/components/table/ActionPopover.js +56 -0
- package/dist/components/table/PuiTable.js +139 -24
- package/dist/components/ui/pages/general/PuiSearchPage.js +126 -37
- package/package.json +4 -4
- package/dist/components/others/DateTimePickerField.js +0 -213
|
@@ -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;
|