allaw-ui 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,6 +10,10 @@ export interface ContactCardEditProps {
|
|
|
10
10
|
hideActions?: boolean;
|
|
11
11
|
controlled?: boolean;
|
|
12
12
|
hasExternalChanges?: boolean;
|
|
13
|
+
clientTypeOptions?: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
13
17
|
datepickerYearDropdownItemNumber?: number;
|
|
14
18
|
datepickerMaxDaysInPast?: number;
|
|
15
19
|
datepickerMinDate?: Date;
|
|
@@ -16,7 +16,7 @@ import Select from "../../atoms/selects/Select";
|
|
|
16
16
|
import Datepicker from "../../atoms/datepickers/Datepicker";
|
|
17
17
|
import IconButton from "../../atoms/buttons/IconButton";
|
|
18
18
|
var ContactCardEdit = function (_a) {
|
|
19
|
-
var name = _a.name, status = _a.status, phone = _a.phone, email = _a.email, _b = _a.clientOfStudy, clientOfStudy = _b === void 0 ? false : _b, _c = _a.officeName, officeName = _c === void 0 ? "du cabinet" : _c, birthDate = _a.birthDate, _d = _a.hideActions, hideActions = _d === void 0 ? false : _d, _e = _a.controlled, controlled = _e === void 0 ? false : _e, _f = _a.hasExternalChanges, hasExternalChanges = _f === void 0 ? false : _f, _g = _a.datepickerYearDropdownItemNumber, datepickerYearDropdownItemNumber = _g === void 0 ? 10 : _g, datepickerMaxDaysInPast = _a.datepickerMaxDaysInPast, datepickerMinDate = _a.datepickerMinDate, datepickerMaxDate = _a.datepickerMaxDate, _h = _a.datepickerDisableFutur, datepickerDisableFutur = _h === void 0 ? true : _h, externalEditData = _a.editData, onEditDataChange = _a.onEditDataChange, onSave = _a.onSave, onCancel = _a.onCancel;
|
|
19
|
+
var name = _a.name, status = _a.status, phone = _a.phone, email = _a.email, _b = _a.clientOfStudy, clientOfStudy = _b === void 0 ? false : _b, _c = _a.officeName, officeName = _c === void 0 ? "du cabinet" : _c, birthDate = _a.birthDate, _d = _a.hideActions, hideActions = _d === void 0 ? false : _d, _e = _a.controlled, controlled = _e === void 0 ? false : _e, _f = _a.hasExternalChanges, hasExternalChanges = _f === void 0 ? false : _f, clientTypeOptions = _a.clientTypeOptions, _g = _a.datepickerYearDropdownItemNumber, datepickerYearDropdownItemNumber = _g === void 0 ? 10 : _g, datepickerMaxDaysInPast = _a.datepickerMaxDaysInPast, datepickerMinDate = _a.datepickerMinDate, datepickerMaxDate = _a.datepickerMaxDate, _h = _a.datepickerDisableFutur, datepickerDisableFutur = _h === void 0 ? true : _h, externalEditData = _a.editData, onEditDataChange = _a.onEditDataChange, onSave = _a.onSave, onCancel = _a.onCancel;
|
|
20
20
|
var _j = useState({
|
|
21
21
|
firstName: "",
|
|
22
22
|
lastName: "",
|
|
@@ -39,12 +39,13 @@ var ContactCardEdit = function (_a) {
|
|
|
39
39
|
setInternalEditData(updater);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
// Options
|
|
43
|
-
var
|
|
42
|
+
// Options par défaut si non fournies
|
|
43
|
+
var defaultClientTypeOptions = [
|
|
44
44
|
{ label: "Client du cabinet", value: "Client du cabinet" },
|
|
45
45
|
{ label: "Client de l'étude", value: "Client de l'étude" },
|
|
46
46
|
{ label: "Contact", value: "Contact" },
|
|
47
47
|
];
|
|
48
|
+
var finalClientTypeOptions = clientTypeOptions || defaultClientTypeOptions;
|
|
48
49
|
// Initialisation des données d'édition
|
|
49
50
|
useEffect(function () {
|
|
50
51
|
if (name && !controlled) {
|
|
@@ -129,7 +130,7 @@ var ContactCardEdit = function (_a) {
|
|
|
129
130
|
React.createElement("div", { className: styles.infoItem },
|
|
130
131
|
React.createElement("i", { className: "allaw-icon-user ".concat(styles.infoIcon) }),
|
|
131
132
|
React.createElement("div", { className: styles.clientTypeSelectContainer },
|
|
132
|
-
React.createElement(Select, { items:
|
|
133
|
+
React.createElement(Select, { items: finalClientTypeOptions, selectedItem: editData.clientType, placeholder: "Type de client", onChange: function (value) {
|
|
133
134
|
return updateEditData(function (prev) { return (__assign(__assign({}, prev), { clientType: value })); });
|
|
134
135
|
} }))),
|
|
135
136
|
React.createElement("div", { className: styles.telephoneEmailItems },
|
|
@@ -141,9 +142,10 @@ var ContactCardEdit = function (_a) {
|
|
|
141
142
|
}, disableAutofill: true }))),
|
|
142
143
|
React.createElement("div", { className: styles.infoItem },
|
|
143
144
|
React.createElement("i", { className: "allaw-icon-mail ".concat(styles.infoIcon) }),
|
|
144
|
-
React.createElement(
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
React.createElement("div", { className: styles.emailInputContainer },
|
|
146
|
+
React.createElement(Input, { title: "", placeholder: "Email", type: "email", value: editData.email, onChange: function (value) {
|
|
147
|
+
return updateEditData(function (prev) { return (__assign(__assign({}, prev), { email: value })); });
|
|
148
|
+
}, disableAutofill: true }))),
|
|
147
149
|
birthDate && (React.createElement("div", { className: styles.infoItem },
|
|
148
150
|
React.createElement("i", { className: "allaw-icon-user ".concat(styles.infoIcon) }),
|
|
149
151
|
React.createElement(Datepicker, { value: editData.birthDate, onChange: function (date) {
|
|
@@ -107,17 +107,47 @@
|
|
|
107
107
|
max-width: 160px;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
.emailInputContainer {
|
|
111
|
+
width: 160px;
|
|
112
|
+
min-width: 160px;
|
|
113
|
+
max-width: 160px;
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
.clientTypeSelectContainer {
|
|
111
117
|
padding-left: 0px;
|
|
112
118
|
max-width: 160px;
|
|
113
119
|
min-width: 160px;
|
|
114
120
|
}
|
|
115
121
|
|
|
122
|
+
/* Media queries pour les largeurs en fonction du viewport */
|
|
123
|
+
@media (min-width: 1152px) {
|
|
124
|
+
.phoneInputContainer {
|
|
125
|
+
width: 190px;
|
|
126
|
+
min-width: 190px;
|
|
127
|
+
max-width: 190px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.emailInputContainer {
|
|
131
|
+
width: 200px;
|
|
132
|
+
min-width: 200px;
|
|
133
|
+
max-width: 200px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.clientTypeSelectContainer {
|
|
137
|
+
max-width: 190px;
|
|
138
|
+
min-width: 190px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
116
142
|
/* Media queries responsive */
|
|
117
143
|
@media (max-width: 1000px) {
|
|
118
144
|
.phoneInputContainer {
|
|
119
145
|
max-width: 100%;
|
|
120
146
|
}
|
|
147
|
+
|
|
148
|
+
.emailInputContainer {
|
|
149
|
+
max-width: 100%;
|
|
150
|
+
}
|
|
121
151
|
}
|
|
122
152
|
|
|
123
153
|
@media (max-width: 900px) {
|