@claudebernard/patient-profile-element 0.8.0 → 0.8.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.
@@ -177,15 +177,6 @@
177
177
  },
178
178
  "attribute": "patient-profile"
179
179
  },
180
- {
181
- "kind": "field",
182
- "name": "editButtonVisible",
183
- "type": {
184
- "text": "boolean | undefined"
185
- },
186
- "default": "true",
187
- "attribute": "edit-button-visible"
188
- },
189
180
  {
190
181
  "kind": "field",
191
182
  "name": "apiUrl",
@@ -217,7 +208,7 @@
217
208
  "type": {
218
209
  "text": "PatientProfilePreferences | undefined"
219
210
  },
220
- "default": "{ forms: { age: { display: true, readOnly: false }, sexe: { display: true, readOnly: false }, }, overview: { warning: { missingWeight: { display: false }, missingHeight: { display: false }, missingGfr: { display: false }, }, }, }",
211
+ "default": "{ forms: { age: { display: true, readOnly: false }, sexe: { display: true, readOnly: false }, }, overview: { editButton: { display: true, }, warning: { missingWeight: { display: false }, missingHeight: { display: false }, missingGfr: { display: false }, }, }, }",
221
212
  "attribute": "preferences"
222
213
  },
223
214
  {
@@ -355,14 +346,6 @@
355
346
  },
356
347
  "fieldName": "patientProfile"
357
348
  },
358
- {
359
- "name": "edit-button-visible",
360
- "type": {
361
- "text": "boolean | undefined"
362
- },
363
- "default": "true",
364
- "fieldName": "editButtonVisible"
365
- },
366
349
  {
367
350
  "name": "api-url",
368
351
  "type": {
@@ -390,7 +373,7 @@
390
373
  "type": {
391
374
  "text": "PatientProfilePreferences | undefined"
392
375
  },
393
- "default": "{ forms: { age: { display: true, readOnly: false }, sexe: { display: true, readOnly: false }, }, overview: { warning: { missingWeight: { display: false }, missingHeight: { display: false }, missingGfr: { display: false }, }, }, }",
376
+ "default": "{ forms: { age: { display: true, readOnly: false }, sexe: { display: true, readOnly: false }, }, overview: { editButton: { display: true, }, warning: { missingWeight: { display: false }, missingHeight: { display: false }, missingGfr: { display: false }, }, }, }",
394
377
  "fieldName": "preferences"
395
378
  }
396
379
  ],
@@ -1779,6 +1762,24 @@
1779
1762
  ],
1780
1763
  "description": "Modifie le statut d'aménorrhée du patient dans le Bundle FHIR du patient"
1781
1764
  },
1765
+ {
1766
+ "kind": "function",
1767
+ "name": "deletePatientAmenorrheaStatus",
1768
+ "return": {
1769
+ "type": {
1770
+ "text": "void"
1771
+ }
1772
+ },
1773
+ "parameters": [
1774
+ {
1775
+ "name": "bundle",
1776
+ "type": {
1777
+ "text": "Bundle"
1778
+ }
1779
+ }
1780
+ ],
1781
+ "description": "Supprime l'observation d'aménorrhée du Bundle FHIR du patient"
1782
+ },
1782
1783
  {
1783
1784
  "kind": "function",
1784
1785
  "name": "getPatientBreastfeedingStatus",
@@ -2537,6 +2538,14 @@
2537
2538
  "module": "src/shared/utils/patient-fhir-utils.ts"
2538
2539
  }
2539
2540
  },
2541
+ {
2542
+ "kind": "js",
2543
+ "name": "deletePatientAmenorrheaStatus",
2544
+ "declaration": {
2545
+ "name": "deletePatientAmenorrheaStatus",
2546
+ "module": "src/shared/utils/patient-fhir-utils.ts"
2547
+ }
2548
+ },
2540
2549
  {
2541
2550
  "kind": "js",
2542
2551
  "name": "getPatientBreastfeedingStatus",
@@ -4453,7 +4462,7 @@
4453
4462
  "text": "number | \"\""
4454
4463
  },
4455
4464
  "privacy": "private",
4456
- "default": "0"
4465
+ "default": "\"\""
4457
4466
  },
4458
4467
  {
4459
4468
  "kind": "field",
@@ -15,6 +15,10 @@ declare interface MissingPreferences {
15
15
  }
16
16
 
17
17
  declare interface OverviewPreferences {
18
+ editButton?: {
19
+ /** @default true */
20
+ display?: boolean;
21
+ };
18
22
  warning?: {
19
23
  missingWeight?: MissingPreferences;
20
24
  missingHeight?: MissingPreferences;
@@ -24,7 +28,6 @@ declare interface OverviewPreferences {
24
28
 
25
29
  export declare class PatientProfile extends LitElement {
26
30
  patientProfile?: Bundle;
27
- editButtonVisible: boolean | undefined;
28
31
  apiUrl: string;
29
32
  apiKey: string | undefined;
30
33
  context?: WebComponentContext;
@@ -62,7 +65,6 @@ export declare interface PatientProfilePreferences {
62
65
 
63
66
  export declare interface PatientProfileProps {
64
67
  patientProfile?: Bundle;
65
- editButtonVisible?: boolean;
66
68
  apiUrl: string;
67
69
  apiKey?: string;
68
70
  preferences?: PatientProfilePreferences;
@@ -132,21 +134,21 @@ declare global {
132
134
 
133
135
  declare global {
134
136
  interface HTMLElementTagNameMap {
135
- "bcb-patient-renal-form": PatientRenalForm;
137
+ "bcb-patient-allergies-form": PatientAllergiesForm;
136
138
  }
137
139
  }
138
140
 
139
141
 
140
142
  declare global {
141
143
  interface HTMLElementTagNameMap {
142
- "bcb-patient-hepatic-form": PatientHepaticForm;
144
+ "bcb-patient-renal-form": PatientRenalForm;
143
145
  }
144
146
  }
145
147
 
146
148
 
147
149
  declare global {
148
150
  interface HTMLElementTagNameMap {
149
- "bcb-patient-allergies-form": PatientAllergiesForm;
151
+ "bcb-patient-hepatic-form": PatientHepaticForm;
150
152
  }
151
153
  }
152
154
 
@@ -399,6 +399,9 @@ function setPatientAmenorrheaStatus(bundle, weeks) {
399
399
  false
400
400
  );
401
401
  }
402
+ function deletePatientAmenorrheaStatus(bundle) {
403
+ removeObservationByCode(bundle, AMENORRHEA_LOINC_CODE);
404
+ }
402
405
  const BREASTFEEDING_LOINC_CODE = "63895-7";
403
406
  const BREASTFEEDING_SNOMED_CODE = "69840006";
404
407
  function getPatientBreastfeedingStatus(bundle) {
@@ -1714,7 +1717,7 @@ let PatientReproductiveForm = class extends i$2 {
1714
1717
  this.visible = false;
1715
1718
  this.isPregnant = false;
1716
1719
  this.breastfeeding = false;
1717
- this._amenorrheaWeeks = 0;
1720
+ this._amenorrheaWeeks = "";
1718
1721
  this._amenorrheaDate = "";
1719
1722
  }
1720
1723
  updated(changedProperties) {
@@ -1723,8 +1726,8 @@ let PatientReproductiveForm = class extends i$2 {
1723
1726
  }
1724
1727
  this.breastfeeding = getPatientBreastfeedingStatus(this.patientProfile);
1725
1728
  this.isPregnant = getPatientPregnancyStatus(this.patientProfile);
1726
- this._amenorrheaWeeks = getPatientAmenorrheaStatus(this.patientProfile) ?? 0;
1727
- this._amenorrheaDate = this.calculateAmenorrheaDate(this._amenorrheaWeeks);
1729
+ this._amenorrheaWeeks = getPatientAmenorrheaStatus(this.patientProfile) ?? "";
1730
+ this._amenorrheaDate = this._amenorrheaWeeks === "" ? "" : this.calculateAmenorrheaDate(this._amenorrheaWeeks);
1728
1731
  this.updateGestationalWeeksWarning(this._amenorrheaWeeks);
1729
1732
  }
1730
1733
  handlePregnancy(event) {
@@ -1763,12 +1766,13 @@ let PatientReproductiveForm = class extends i$2 {
1763
1766
  }
1764
1767
  getValue() {
1765
1768
  if (!this.visible) {
1766
- return { isPregnant: false, breastfeeding: false, gestationalWeeks: 0 };
1769
+ return { isPregnant: false, breastfeeding: false, gestationalWeeks: void 0 };
1767
1770
  }
1771
+ const weeksValue = this.gestationalWeeksInput?.value ?? "";
1768
1772
  return {
1769
1773
  isPregnant: this.isPregnant,
1770
1774
  breastfeeding: this.breastfeeding,
1771
- gestationalWeeks: Number(this.gestationalWeeksInput?.value ?? "")
1775
+ gestationalWeeks: weeksValue === "" ? void 0 : Number(weeksValue)
1772
1776
  };
1773
1777
  }
1774
1778
  render() {
@@ -1784,7 +1788,7 @@ let PatientReproductiveForm = class extends i$2 {
1784
1788
  <div class="${PREFIX}-edition-modal-pregnant-div__inputs">
1785
1789
  <div class="${PREFIX}-edition-modal-pregnant-div-section">
1786
1790
  <span>Date de l'aménorrhée</span>
1787
- <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>
1791
+ <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="" date-picker-placement="bottom" @change=${this.handleAmenorrheaDateInputChange}></bcbd-input>
1788
1792
  </div>
1789
1793
  <div class="${PREFIX}-edition-modal-pregnant-div-section ${PREFIX}-edition-modal-pregnant-div__gestational">
1790
1794
  <span>Nombre de semaines d'aménorrhée</span>
@@ -3974,8 +3978,10 @@ let PatientProfileEdition = class extends i$2 {
3974
3978
  } else {
3975
3979
  deletePatientHepaticInsufficiencyStatus(this.patientProfile);
3976
3980
  }
3977
- if (reproductive.isPregnant) {
3978
- setPatientAmenorrheaStatus(this.patientProfile, isNaN(reproductive.gestationalWeeks) ? 0 : reproductive.gestationalWeeks);
3981
+ if (reproductive.isPregnant && reproductive.gestationalWeeks !== void 0 && !isNaN(reproductive.gestationalWeeks)) {
3982
+ setPatientAmenorrheaStatus(this.patientProfile, reproductive.gestationalWeeks);
3983
+ } else {
3984
+ deletePatientAmenorrheaStatus(this.patientProfile);
3979
3985
  }
3980
3986
  setPatientBreastfeedingStatus(this.patientProfile, reproductive.breastfeeding);
3981
3987
  setPatientPregnancyStatus(this.patientProfile, reproductive.isPregnant);
@@ -4085,7 +4091,6 @@ var __decorateClass = (decorators, target, key, kind) => {
4085
4091
  let PatientProfile = class extends i$2 {
4086
4092
  constructor() {
4087
4093
  super(...arguments);
4088
- this.editButtonVisible = true;
4089
4094
  this.apiUrl = "https://api-dev.claudebernard.fr";
4090
4095
  this.preferences = {
4091
4096
  forms: {
@@ -4093,6 +4098,9 @@ let PatientProfile = class extends i$2 {
4093
4098
  sexe: { display: true, readOnly: false }
4094
4099
  },
4095
4100
  overview: {
4101
+ editButton: {
4102
+ display: true
4103
+ },
4096
4104
  warning: {
4097
4105
  missingWeight: { display: false },
4098
4106
  missingHeight: { display: false },
@@ -4294,7 +4302,7 @@ let PatientProfile = class extends i$2 {
4294
4302
  <div class="${PREFIX}-patient-profile__no-profile__first">Aucun profil patient renseigné</div>
4295
4303
  <div class="${PREFIX}-patient-profile__no-profile__second">Veuillez remplir le formulaire</div>
4296
4304
  </div>
4297
- ${this.editButtonVisible || this.editButtonVisible === void 0 ? b`<bcbd-button icon="pencil" size="medium" background-color="primary" outlined aria-label="Modifier le profil patient" data-test-id="modify-button" @click=${this.openEditionModal}></bcbd-button>` : A}
4305
+ ${this.preferences?.overview?.editButton?.display !== false ? b`<bcbd-button icon="pencil" size="medium" background-color="primary" outlined aria-label="Modifier le profil patient" data-test-id="modify-button" @click=${this.openEditionModal}></bcbd-button>` : A}
4298
4306
  ` : b`
4299
4307
  <div class="${PREFIX}-patient-profile__id-info-container">
4300
4308
  <div class="${PREFIX}-patient-profile__name-info" data-test-id="patient-name" title=${o(getPatientName(this.patientProfile))}>
@@ -4349,7 +4357,7 @@ let PatientProfile = class extends i$2 {
4349
4357
  </div>
4350
4358
 
4351
4359
  <div class="${PREFIX}-patient-profile__action-buttons-container" data-test-id="action-buttons">
4352
- ${this.editButtonVisible || this.editButtonVisible === void 0 ? b`
4360
+ ${this.preferences?.overview?.editButton?.display !== false ? b`
4353
4361
  <bcbd-tooltip content="Editer le profil patient" placement="top">
4354
4362
  <bcbd-button icon="pencil" size="medium" background-color="primary" outlined aria-label="Editer le profil patient" data-test-id="modify-button" @click=${this.openEditionModal}></bcbd-button>
4355
4363
  </bcbd-tooltip>
@@ -4398,9 +4406,6 @@ PatientProfile.styles = i$5`${r$4(patientProfileCSS)}`;
4398
4406
  __decorateClass([
4399
4407
  n2({ type: Object, attribute: "patient-profile" })
4400
4408
  ], PatientProfile.prototype, "patientProfile", 2);
4401
- __decorateClass([
4402
- n2({ type: Boolean, attribute: "edit-button-visible" })
4403
- ], PatientProfile.prototype, "editButtonVisible", 2);
4404
4409
  __decorateClass([
4405
4410
  n2({ type: String, attribute: "api-url" })
4406
4411
  ], PatientProfile.prototype, "apiUrl", 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudebernard/patient-profile-element",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "main": "dist/patient-profile.es.js",
5
5
  "module": "dist/patient-profile.es.js",
6
6
  "types": "dist/patient-profile.d.ts",
@@ -87,7 +87,7 @@
87
87
  "vitest": "^4.0.7"
88
88
  },
89
89
  "peerDependencies": {
90
- "@claudebernard/design-system": "^2.37.2",
90
+ "@claudebernard/design-system": "^2.39.3",
91
91
  "@claudebernard/types": "^0.35.0 || ^0.36.0"
92
92
  },
93
93
  "customElements": "dist/custom-elements.json",