@claudebernard/patient-profile-element 0.7.1 → 0.7.3
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/custom-elements.json +145 -18
- package/dist/patient-profile.d.ts +143 -2
- package/dist/patient-profile.es.js +61 -8
- package/package.json +2 -1
- package/dist/vitest.config.d.ts +0 -4
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.shims.d.ts +0 -1
|
@@ -373,6 +373,14 @@
|
|
|
373
373
|
}
|
|
374
374
|
],
|
|
375
375
|
"exports": [
|
|
376
|
+
{
|
|
377
|
+
"kind": "js",
|
|
378
|
+
"name": "PatientProfilePreferences",
|
|
379
|
+
"declaration": {
|
|
380
|
+
"name": "PatientProfilePreferences",
|
|
381
|
+
"module": "src/patient-profile/patient-profile.ts"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
376
384
|
{
|
|
377
385
|
"kind": "js",
|
|
378
386
|
"name": "PatientProfile",
|
|
@@ -589,6 +597,24 @@
|
|
|
589
597
|
}
|
|
590
598
|
}
|
|
591
599
|
},
|
|
600
|
+
{
|
|
601
|
+
"kind": "method",
|
|
602
|
+
"name": "handleModalClose",
|
|
603
|
+
"privacy": "private",
|
|
604
|
+
"return": {
|
|
605
|
+
"type": {
|
|
606
|
+
"text": "void"
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
"parameters": [
|
|
610
|
+
{
|
|
611
|
+
"name": "event",
|
|
612
|
+
"type": {
|
|
613
|
+
"text": "Event"
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
]
|
|
617
|
+
},
|
|
592
618
|
{
|
|
593
619
|
"kind": "method",
|
|
594
620
|
"name": "handleDemographicsChange",
|
|
@@ -684,6 +710,24 @@
|
|
|
684
710
|
}
|
|
685
711
|
]
|
|
686
712
|
},
|
|
713
|
+
{
|
|
714
|
+
"kind": "javascript-module",
|
|
715
|
+
"path": "src/shared/interfaces/api-return.interface.ts",
|
|
716
|
+
"declarations": [],
|
|
717
|
+
"exports": []
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"kind": "javascript-module",
|
|
721
|
+
"path": "src/shared/interfaces/patient.ts",
|
|
722
|
+
"declarations": [],
|
|
723
|
+
"exports": []
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"kind": "javascript-module",
|
|
727
|
+
"path": "src/shared/interfaces/properties.ts",
|
|
728
|
+
"declarations": [],
|
|
729
|
+
"exports": []
|
|
730
|
+
},
|
|
687
731
|
{
|
|
688
732
|
"kind": "javascript-module",
|
|
689
733
|
"path": "src/shared/constants/edition-options.ts",
|
|
@@ -828,24 +872,6 @@
|
|
|
828
872
|
}
|
|
829
873
|
]
|
|
830
874
|
},
|
|
831
|
-
{
|
|
832
|
-
"kind": "javascript-module",
|
|
833
|
-
"path": "src/shared/interfaces/api-return.interface.ts",
|
|
834
|
-
"declarations": [],
|
|
835
|
-
"exports": []
|
|
836
|
-
},
|
|
837
|
-
{
|
|
838
|
-
"kind": "javascript-module",
|
|
839
|
-
"path": "src/shared/interfaces/patient.ts",
|
|
840
|
-
"declarations": [],
|
|
841
|
-
"exports": []
|
|
842
|
-
},
|
|
843
|
-
{
|
|
844
|
-
"kind": "javascript-module",
|
|
845
|
-
"path": "src/shared/interfaces/properties.ts",
|
|
846
|
-
"declarations": [],
|
|
847
|
-
"exports": []
|
|
848
|
-
},
|
|
849
875
|
{
|
|
850
876
|
"kind": "javascript-module",
|
|
851
877
|
"path": "src/shared/mocks/pathologies.mock.ts",
|
|
@@ -4082,6 +4108,17 @@
|
|
|
4082
4108
|
"description": "Sous-formulaire de la modale d'édition du profil patient : grossesse et allaitement.\nSa visibilité est pilotée par le parent via la propriété `visible`\n(calculée à partir de l'âge et du sexe dans `bcb-patient-demographics-form`).",
|
|
4083
4109
|
"name": "PatientReproductiveForm",
|
|
4084
4110
|
"members": [
|
|
4111
|
+
{
|
|
4112
|
+
"kind": "field",
|
|
4113
|
+
"name": "MAX_GESTATIONAL_WEEKS",
|
|
4114
|
+
"type": {
|
|
4115
|
+
"text": "number"
|
|
4116
|
+
},
|
|
4117
|
+
"privacy": "private",
|
|
4118
|
+
"static": true,
|
|
4119
|
+
"readonly": true,
|
|
4120
|
+
"default": "42"
|
|
4121
|
+
},
|
|
4085
4122
|
{
|
|
4086
4123
|
"kind": "field",
|
|
4087
4124
|
"name": "patientProfile",
|
|
@@ -4123,6 +4160,24 @@
|
|
|
4123
4160
|
},
|
|
4124
4161
|
"privacy": "private"
|
|
4125
4162
|
},
|
|
4163
|
+
{
|
|
4164
|
+
"kind": "field",
|
|
4165
|
+
"name": "_amenorrheaWeeks",
|
|
4166
|
+
"type": {
|
|
4167
|
+
"text": "number | \"\""
|
|
4168
|
+
},
|
|
4169
|
+
"privacy": "private",
|
|
4170
|
+
"default": "0"
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
"kind": "field",
|
|
4174
|
+
"name": "_amenorrheaDate",
|
|
4175
|
+
"type": {
|
|
4176
|
+
"text": "string"
|
|
4177
|
+
},
|
|
4178
|
+
"privacy": "private",
|
|
4179
|
+
"default": "\"\""
|
|
4180
|
+
},
|
|
4126
4181
|
{
|
|
4127
4182
|
"kind": "method",
|
|
4128
4183
|
"name": "handlePregnancy",
|
|
@@ -4169,6 +4224,78 @@
|
|
|
4169
4224
|
}
|
|
4170
4225
|
}
|
|
4171
4226
|
},
|
|
4227
|
+
{
|
|
4228
|
+
"kind": "method",
|
|
4229
|
+
"name": "updateGestationalWeeksWarning",
|
|
4230
|
+
"privacy": "private",
|
|
4231
|
+
"return": {
|
|
4232
|
+
"type": {
|
|
4233
|
+
"text": "void"
|
|
4234
|
+
}
|
|
4235
|
+
},
|
|
4236
|
+
"parameters": [
|
|
4237
|
+
{
|
|
4238
|
+
"name": "weeks",
|
|
4239
|
+
"type": {
|
|
4240
|
+
"text": "number | \"\""
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
]
|
|
4244
|
+
},
|
|
4245
|
+
{
|
|
4246
|
+
"kind": "method",
|
|
4247
|
+
"name": "calculateAmenorrheaWeeks",
|
|
4248
|
+
"privacy": "private",
|
|
4249
|
+
"return": {
|
|
4250
|
+
"type": {
|
|
4251
|
+
"text": "number"
|
|
4252
|
+
}
|
|
4253
|
+
},
|
|
4254
|
+
"parameters": [
|
|
4255
|
+
{
|
|
4256
|
+
"name": "amenorrheaDate",
|
|
4257
|
+
"type": {
|
|
4258
|
+
"text": "string"
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
]
|
|
4262
|
+
},
|
|
4263
|
+
{
|
|
4264
|
+
"kind": "method",
|
|
4265
|
+
"name": "calculateAmenorrheaDate",
|
|
4266
|
+
"privacy": "private",
|
|
4267
|
+
"return": {
|
|
4268
|
+
"type": {
|
|
4269
|
+
"text": "string"
|
|
4270
|
+
}
|
|
4271
|
+
},
|
|
4272
|
+
"parameters": [
|
|
4273
|
+
{
|
|
4274
|
+
"name": "amenorrheaWeeks",
|
|
4275
|
+
"type": {
|
|
4276
|
+
"text": "number"
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
]
|
|
4280
|
+
},
|
|
4281
|
+
{
|
|
4282
|
+
"kind": "method",
|
|
4283
|
+
"name": "handleAmenorrheaDateInputChange",
|
|
4284
|
+
"privacy": "private",
|
|
4285
|
+
"return": {
|
|
4286
|
+
"type": {
|
|
4287
|
+
"text": "void"
|
|
4288
|
+
}
|
|
4289
|
+
},
|
|
4290
|
+
"parameters": [
|
|
4291
|
+
{
|
|
4292
|
+
"name": "event",
|
|
4293
|
+
"type": {
|
|
4294
|
+
"text": "CustomEvent<{ value: string }>"
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
]
|
|
4298
|
+
},
|
|
4172
4299
|
{
|
|
4173
4300
|
"kind": "method",
|
|
4174
4301
|
"name": "getValue",
|
|
@@ -1,2 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Bundle } from 'fhir/r5';
|
|
2
|
+
import { CSSResult } from 'lit';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
import { nothing } from 'lit';
|
|
5
|
+
import { TemplateResult } from 'lit';
|
|
6
|
+
|
|
7
|
+
declare interface FormPreferences {
|
|
8
|
+
age?: SectionPreferences;
|
|
9
|
+
sexe?: SectionPreferences;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare interface MissingPreferences {
|
|
13
|
+
/** @default false */
|
|
14
|
+
display?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare interface OverviewPreferences {
|
|
18
|
+
warning?: {
|
|
19
|
+
missingWeight?: MissingPreferences;
|
|
20
|
+
missingHeight?: MissingPreferences;
|
|
21
|
+
missingGfr?: MissingPreferences;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export declare class PatientProfile extends LitElement {
|
|
26
|
+
patientProfile?: Bundle;
|
|
27
|
+
editButtonVisible: boolean | undefined;
|
|
28
|
+
apiUrl: string;
|
|
29
|
+
apiKey: string | undefined;
|
|
30
|
+
preferences: PatientProfilePreferences | undefined;
|
|
31
|
+
moreInformationVisible: boolean;
|
|
32
|
+
patientAgeUnit: "ans" | "mois";
|
|
33
|
+
private editionModalElement;
|
|
34
|
+
handleMoreInformation(): void;
|
|
35
|
+
displayRenalInsufficiencyStatus(): symbol | TemplateResult<1>;
|
|
36
|
+
displayCreatininemieSection(): TemplateResult<1> | typeof nothing;
|
|
37
|
+
private displayHepaticInsufficiencySection;
|
|
38
|
+
private truncateLabel;
|
|
39
|
+
private displayPregnancy;
|
|
40
|
+
private displayBreastfeeding;
|
|
41
|
+
displayPathologies(): TemplateResult<1> | typeof nothing;
|
|
42
|
+
displayAllergies(): TemplateResult<1> | typeof nothing;
|
|
43
|
+
openEditionModal(): void;
|
|
44
|
+
private editProfilePatient;
|
|
45
|
+
private getPatientAge;
|
|
46
|
+
render(): TemplateResult<1>;
|
|
47
|
+
static styles: CSSResult;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare interface PatientProfilePreferences {
|
|
51
|
+
/**
|
|
52
|
+
* Filtre le type de pathologie utilisé lors de l'appel fetchPathologiesByTerm.
|
|
53
|
+
* - "AMM" : pathologies avec Autorisation de Mise sur le Marché
|
|
54
|
+
* - "CIM10" : pathologies selon la classification CIM-10
|
|
55
|
+
* - "" : aucun filtre (toutes les pathologies)
|
|
56
|
+
*/
|
|
57
|
+
typePathology?: "AMM" | "CIM10" | "";
|
|
58
|
+
forms?: FormPreferences;
|
|
59
|
+
overview?: OverviewPreferences;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare interface PatientProfileProps {
|
|
63
|
+
patientProfile?: Bundle;
|
|
64
|
+
editButtonVisible?: boolean;
|
|
65
|
+
apiUrl: string;
|
|
66
|
+
apiKey?: string;
|
|
67
|
+
preferences?: PatientProfilePreferences;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare interface SectionPreferences {
|
|
71
|
+
/** @default true */
|
|
72
|
+
display?: boolean;
|
|
73
|
+
/** @default true */
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { }
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
declare global {
|
|
81
|
+
interface HTMLElementTagNameMap {
|
|
82
|
+
"bcb-patient-profile": PatientProfile;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
declare global {
|
|
88
|
+
interface HTMLElementTagNameMap {
|
|
89
|
+
"bcb-patient-profile-edition": PatientProfileEdition;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
declare global {
|
|
95
|
+
interface HTMLElementTagNameMap {
|
|
96
|
+
"bcb-patient-demographics-form": PatientDemographicsForm;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
declare global {
|
|
102
|
+
interface HTMLElementTagNameMap {
|
|
103
|
+
"bcb-patient-reproductive-form": PatientReproductiveForm;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
declare global {
|
|
109
|
+
interface HTMLElementTagNameMap {
|
|
110
|
+
"bcb-patient-allergies-form": PatientAllergiesForm;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
declare global {
|
|
116
|
+
interface HTMLElementTagNameMap {
|
|
117
|
+
"bcb-patient-pathologies-form": PatientPathologiesForm;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
declare global {
|
|
123
|
+
interface HTMLElementTagNameMap {
|
|
124
|
+
"bcb-patient-renal-form": PatientRenalForm;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
declare global {
|
|
130
|
+
interface HTMLElementTagNameMap {
|
|
131
|
+
"bcb-patient-hepatic-form": PatientHepaticForm;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
declare global {
|
|
137
|
+
interface Window {
|
|
138
|
+
RUNTIME_CONFIG?: {
|
|
139
|
+
STORYBOOK_API_URL?: string;
|
|
140
|
+
STORYBOOK_API_KEY?: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -1690,7 +1690,7 @@ __decorateClass$8([
|
|
|
1690
1690
|
PatientDemographicsForm = __decorateClass$8([
|
|
1691
1691
|
t("bcb-patient-demographics-form")
|
|
1692
1692
|
], PatientDemographicsForm);
|
|
1693
|
-
const patientReproductiveFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\n}\n.claudebernard-edition-modal-large-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n width: 100%;\n}\n.claudebernard-edition-modal-information-section {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\n}\n.claudebernard-edition-modal-little-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n flex: 1;\n min-width: 0;\n}\n.claudebernard-edition-modal-little-section bcbd-input {\n height: 100%;\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-little-section__with-info {\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 16px;\n gap: 8px;\n}\n.claudebernard-edition-modal-little-section__with-info bcbd-icon {\n --bcbd-icon-width: 1rem;\n --bcbd-icon-height: 1rem;\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n margin-inline: 0;\n border-radius: 4px;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\nbcbd-checkbox {\n --bcbd-checkbox-font-size: .9rem;\n}\n\n.claudebernard-edition-modal-pregnant-div {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.claudebernard-edition-modal-pregnant-div bcbd-input {\n width:
|
|
1693
|
+
const patientReproductiveFormCSS = ".claudebernard-edition-modal {\n font-size: 0.9rem;\n}\n.claudebernard-edition-modal-large-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n width: 100%;\n}\n.claudebernard-edition-modal-information-section {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex-wrap: wrap;\n}\n.claudebernard-edition-modal-information-section span {\n white-space: nowrap;\n}\n.claudebernard-edition-modal-information-section-secondary-group {\n display: flex;\n flex-direction: row;\n gap: 16px;\n flex: 3;\n flex-wrap: wrap;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n flex-basis: 100%;\n }\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-information-section-secondary-group {\n display: contents;\n }\n}\n.claudebernard-edition-modal-little-section {\n display: flex;\n flex-direction: column;\n gap: 5px;\n flex: 1;\n min-width: 0;\n}\n.claudebernard-edition-modal-little-section bcbd-input {\n height: 100%;\n}\n@media (max-width: 600px) {\n .claudebernard-edition-modal-little-section {\n flex: 1 1 calc(50% - 8px);\n }\n .claudebernard-edition-modal-little-section span {\n white-space: nowrap;\n }\n}\n.claudebernard-edition-modal-little-section__with-info {\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 16px;\n gap: 8px;\n}\n.claudebernard-edition-modal-little-section__with-info bcbd-icon {\n --bcbd-icon-width: 1rem;\n --bcbd-icon-height: 1rem;\n}\n.claudebernard-edition-modal-subtitle {\n font-weight: 600;\n font-size: 1.1rem;\n color: var(--bcbd-primary-color, #0C75AD);\n}\n.claudebernard-edition-modal-error-message {\n color: var(--bcbd-danger-color, #CF406E);\n font-size: 0.8rem;\n}\n.claudebernard-edition-modal-fieldset {\n border: 1px solid var(--bcbd-border-gray-color, #CBD5E1);\n margin-inline: 0;\n border-radius: 4px;\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\nbcbd-checkbox {\n --bcbd-checkbox-font-size: .9rem;\n}\n\n.claudebernard-edition-modal-pregnant-div {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 16px;\n}\n.claudebernard-edition-modal-pregnant-div bcbd-input {\n width: 35% !important;\n}\n.claudebernard-edition-modal-pregnant-div-section {\n display: flex;\n gap: 5px;\n order: 2;\n align-self: flex-start;\n flex-direction: column;\n}\n.claudebernard-edition-modal-pregnant-div-section bcbd-input {\n width: 100% !important;\n}\n.claudebernard-edition-modal-pregnant-div__checkboxes, .claudebernard-edition-modal-pregnant-div__inputs {\n display: contents;\n}\n.claudebernard-edition-modal-pregnant-div__pregnancy {\n order: 1;\n}\n.claudebernard-edition-modal-pregnant-div__gestational {\n order: 3;\n max-width: 30%;\n}\n.claudebernard-edition-modal-pregnant-div__breastfeeding {\n order: 4;\n}\n@media (max-width: 950px) {\n .claudebernard-edition-modal-pregnant-div__checkboxes, .claudebernard-edition-modal-pregnant-div__inputs {\n display: flex;\n align-items: center;\n flex: 1 1 100%;\n gap: 16px;\n }\n .claudebernard-edition-modal-pregnant-div-section {\n width: calc(50% - 8px) !important;\n }\n .claudebernard-edition-modal-pregnant-div__gestational {\n max-width: calc(50% - 8px);\n }\n}";
|
|
1694
1694
|
var __defProp$6 = Object.defineProperty;
|
|
1695
1695
|
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
1696
1696
|
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
@@ -1707,6 +1707,8 @@ let PatientReproductiveForm = class extends i$2 {
|
|
|
1707
1707
|
this.visible = false;
|
|
1708
1708
|
this.isPregnant = false;
|
|
1709
1709
|
this.breastfeeding = false;
|
|
1710
|
+
this._amenorrheaWeeks = 0;
|
|
1711
|
+
this._amenorrheaDate = "";
|
|
1710
1712
|
}
|
|
1711
1713
|
updated(changedProperties) {
|
|
1712
1714
|
if (!changedProperties.has("patientProfile")) {
|
|
@@ -1714,6 +1716,9 @@ let PatientReproductiveForm = class extends i$2 {
|
|
|
1714
1716
|
}
|
|
1715
1717
|
this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
|
|
1716
1718
|
this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
|
|
1719
|
+
this._amenorrheaWeeks = getPatientAmenorrheaStatus(this.patientProfile) ?? 0;
|
|
1720
|
+
this._amenorrheaDate = this.calculateAmenorrheaDate(this._amenorrheaWeeks);
|
|
1721
|
+
this.updateGestationalWeeksWarning(this._amenorrheaWeeks);
|
|
1717
1722
|
}
|
|
1718
1723
|
handlePregnancy(event) {
|
|
1719
1724
|
this.isPregnant = event.detail;
|
|
@@ -1723,7 +1728,31 @@ let PatientReproductiveForm = class extends i$2 {
|
|
|
1723
1728
|
}
|
|
1724
1729
|
handleGestationalWeeksChange() {
|
|
1725
1730
|
const gestationalWeeksValue = this.gestationalWeeksInput?.value ?? "";
|
|
1726
|
-
|
|
1731
|
+
const hasWeeks = gestationalWeeksValue !== "";
|
|
1732
|
+
const weeks = hasWeeks ? Number(gestationalWeeksValue) : "";
|
|
1733
|
+
this.isPregnant = hasWeeks;
|
|
1734
|
+
this._amenorrheaDate = weeks !== "" ? this.calculateAmenorrheaDate(weeks) : "";
|
|
1735
|
+
this.updateGestationalWeeksWarning(weeks);
|
|
1736
|
+
}
|
|
1737
|
+
updateGestationalWeeksWarning(weeks) {
|
|
1738
|
+
const warningMsg = typeof weeks === "number" && weeks > PatientReproductiveForm.MAX_GESTATIONAL_WEEKS ? `Le nombre de semaines d'aménorrhée ne doit pas dépasser ${PatientReproductiveForm.MAX_GESTATIONAL_WEEKS} semaines` : "";
|
|
1739
|
+
this.gestationalWeeksInput?.setAttribute("warning-msg", warningMsg);
|
|
1740
|
+
}
|
|
1741
|
+
calculateAmenorrheaWeeks(amenorrheaDate) {
|
|
1742
|
+
const millisecondsPerWeek = 7 * 24 * 60 * 60 * 1e3;
|
|
1743
|
+
const elapsedWeeks = (Date.now() - new Date(amenorrheaDate).getTime()) / millisecondsPerWeek;
|
|
1744
|
+
return Math.max(0, Math.floor(elapsedWeeks));
|
|
1745
|
+
}
|
|
1746
|
+
calculateAmenorrheaDate(amenorrheaWeeks) {
|
|
1747
|
+
const millisecondsPerWeek = 7 * 24 * 60 * 60 * 1e3;
|
|
1748
|
+
const amenorrheaDate = new Date(Date.now() - amenorrheaWeeks * millisecondsPerWeek);
|
|
1749
|
+
return amenorrheaDate.toISOString().split("T")[0];
|
|
1750
|
+
}
|
|
1751
|
+
handleAmenorrheaDateInputChange(event) {
|
|
1752
|
+
const hasDate = !!event.detail.value;
|
|
1753
|
+
this._amenorrheaWeeks = hasDate ? this.calculateAmenorrheaWeeks(event.detail.value) : "";
|
|
1754
|
+
this.isPregnant = hasDate;
|
|
1755
|
+
this.updateGestationalWeeksWarning(this._amenorrheaWeeks);
|
|
1727
1756
|
}
|
|
1728
1757
|
getValue() {
|
|
1729
1758
|
if (!this.visible) {
|
|
@@ -1740,13 +1769,25 @@ let PatientReproductiveForm = class extends i$2 {
|
|
|
1740
1769
|
return A;
|
|
1741
1770
|
}
|
|
1742
1771
|
return b`
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
<bcbd-
|
|
1746
|
-
<bcbd-checkbox data-test-id="breastfeeding-checkbox" id="breastfeedingCheckbox" .checked=${this.breastfeeding} label="Allaitement" color="primary" @change=${this.handleBreastfeeding}></bcbd-checkbox>
|
|
1772
|
+
<div class="${PREFIX}-edition-modal-pregnant-div">
|
|
1773
|
+
<div class="${PREFIX}-edition-modal-pregnant-div__checkboxes">
|
|
1774
|
+
<bcbd-checkbox class="${PREFIX}-edition-modal-pregnant-div__pregnancy" data-test-id="pregnancy-checkbox" id="pregnancyCheckbox" .checked=${this.isPregnant} label="Grossesse" color="primary" @change=${this.handlePregnancy}></bcbd-checkbox>
|
|
1775
|
+
<bcbd-checkbox class="${PREFIX}-edition-modal-pregnant-div__breastfeeding" data-test-id="breastfeeding-checkbox" id="breastfeedingCheckbox" .checked=${this.breastfeeding} label="Allaitement" color="primary" @change=${this.handleBreastfeeding}></bcbd-checkbox>
|
|
1776
|
+
</div>
|
|
1777
|
+
<div class="${PREFIX}-edition-modal-pregnant-div__inputs">
|
|
1778
|
+
<div class="${PREFIX}-edition-modal-pregnant-div-section">
|
|
1779
|
+
<span>Date de l'aménorrhée</span>
|
|
1780
|
+
<bcbd-input data-test-id="amenorrhea-date-input" id="amenorrheaDateInput" type="date" .value=${this._amenorrheaDate} aria-label="Date de l'aménorrhée" warning-msg="" @change=${this.handleAmenorrheaDateInputChange}></bcbd-input>
|
|
1781
|
+
</div>
|
|
1782
|
+
<div class="${PREFIX}-edition-modal-pregnant-div-section ${PREFIX}-edition-modal-pregnant-div__gestational">
|
|
1783
|
+
<span>Nombre de semaines d'aménorrhée</span>
|
|
1784
|
+
<bcbd-input data-test-id="gestational-input" id="gestationalWeeksInput" .value=${this._amenorrheaWeeks} type="number" aria-label="Nombre de semaines d'aménorrhée" warning-msg="" placeholder="" @change=${this.handleGestationalWeeksChange}></bcbd-input>
|
|
1785
|
+
</div>
|
|
1786
|
+
</div>
|
|
1747
1787
|
</div>`;
|
|
1748
1788
|
}
|
|
1749
1789
|
};
|
|
1790
|
+
PatientReproductiveForm.MAX_GESTATIONAL_WEEKS = 42;
|
|
1750
1791
|
PatientReproductiveForm.styles = i$5`${r$4(patientReproductiveFormCSS)}`;
|
|
1751
1792
|
__decorateClass$7([
|
|
1752
1793
|
n2({ type: Object, attribute: "patient-profile" })
|
|
@@ -1763,6 +1804,12 @@ __decorateClass$7([
|
|
|
1763
1804
|
__decorateClass$7([
|
|
1764
1805
|
e$1("#gestationalWeeksInput")
|
|
1765
1806
|
], PatientReproductiveForm.prototype, "gestationalWeeksInput", 2);
|
|
1807
|
+
__decorateClass$7([
|
|
1808
|
+
r()
|
|
1809
|
+
], PatientReproductiveForm.prototype, "_amenorrheaWeeks", 2);
|
|
1810
|
+
__decorateClass$7([
|
|
1811
|
+
r()
|
|
1812
|
+
], PatientReproductiveForm.prototype, "_amenorrheaDate", 2);
|
|
1766
1813
|
PatientReproductiveForm = __decorateClass$7([
|
|
1767
1814
|
t("bcb-patient-reproductive-form")
|
|
1768
1815
|
], PatientReproductiveForm);
|
|
@@ -2225,9 +2272,15 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
2225
2272
|
this.editionModalElement.open();
|
|
2226
2273
|
}
|
|
2227
2274
|
handleCancel() {
|
|
2228
|
-
this.resetKey++;
|
|
2229
2275
|
this.editionModalElement.close();
|
|
2230
2276
|
}
|
|
2277
|
+
// Quelle que soit la façon de fermer la modale (Annuler, croix, Échap, Valider),
|
|
2278
|
+
// les sous-formulaires sont recréés à partir du profil courant.
|
|
2279
|
+
handleModalClose(event) {
|
|
2280
|
+
if (event.target === this.editionModalElement) {
|
|
2281
|
+
this.resetKey++;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2231
2284
|
handleDemographicsChange(event) {
|
|
2232
2285
|
this.demographicsHasError = event.detail.hasError;
|
|
2233
2286
|
this.isPregnancyDivVisible = event.detail.isPregnancyEligible;
|
|
@@ -2298,7 +2351,7 @@ let PatientProfileEdition = class extends i$2 {
|
|
|
2298
2351
|
}
|
|
2299
2352
|
render() {
|
|
2300
2353
|
return b`
|
|
2301
|
-
<bcbd-modal title="Édition du profil patient" persistent id="patient-profile-edition-modal" class="${PREFIX}-edition-modal" data-test-id="patient-profile-edition-modal" >
|
|
2354
|
+
<bcbd-modal title="Édition du profil patient" persistent id="patient-profile-edition-modal" class="${PREFIX}-edition-modal" data-test-id="patient-profile-edition-modal" @close=${this.handleModalClose}>
|
|
2302
2355
|
${i3(this.resetKey, b`<div class="${PREFIX}-edition-modal-content">
|
|
2303
2356
|
<bcb-patient-demographics-form .patientProfile=${this.patientProfile} .preferences=${this.preferences}
|
|
2304
2357
|
@demographics-change=${this.handleDemographicsChange}></bcb-patient-demographics-form>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claudebernard/patient-profile-element",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"main": "dist/patient-profile.es.js",
|
|
5
5
|
"module": "dist/patient-profile.es.js",
|
|
6
6
|
"types": "dist/patient-profile.d.ts",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
52
52
|
"@hey-api/openapi-ts": "^0.99.0",
|
|
53
53
|
"@lit/localize-tools": "^0.8.0",
|
|
54
|
+
"@microsoft/api-extractor": "^7.59.3",
|
|
54
55
|
"@playwright/test": "1.61.1",
|
|
55
56
|
"@storybook/addon-a11y": "^10.2.11",
|
|
56
57
|
"@storybook/addon-coverage": "^3.0.2",
|
package/dist/vitest.config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";;AAWA,wBA8CG"}
|
package/dist/vitest.shims.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@vitest/browser-playwright" />
|