@claudebernard/patient-profile-element 0.7.2 → 0.7.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.
@@ -1,2 +1,143 @@
1
- export * from './src/patient-profile/patient-profile.js'
2
- export {}
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-allergies-form": PatientAllergiesForm;
104
+ }
105
+ }
106
+
107
+
108
+ declare global {
109
+ interface HTMLElementTagNameMap {
110
+ "bcb-patient-reproductive-form": PatientReproductiveForm;
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-hepatic-form": PatientHepaticForm;
125
+ }
126
+ }
127
+
128
+
129
+ declare global {
130
+ interface HTMLElementTagNameMap {
131
+ "bcb-patient-renal-form": PatientRenalForm;
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
+ }
@@ -1468,9 +1468,15 @@ let PatientDemographicsForm = class extends i$2 {
1468
1468
  get patientAge() {
1469
1469
  return this.patientAgeValue === void 0 ? "" : `${this.patientAgeValue} ${this.patientUnitAge}`;
1470
1470
  }
1471
+ static isPregnancyEligible(age, unit, sex) {
1472
+ return unit === "ans" && age >= 12 && age <= 55 && !!sex && sex !== "male";
1473
+ }
1471
1474
  get isPregnancyAge() {
1472
- const age = this.patientAgeValue ?? 0;
1473
- return this.patientUnitAge === "ans" && age >= 12 && age <= 55 && !!this.genderSelect?.value && this.genderSelect.value !== "male";
1475
+ return PatientDemographicsForm.isPregnancyEligible(
1476
+ this.patientAgeValue ?? 0,
1477
+ this.patientUnitAge,
1478
+ this.genderSelect?.value
1479
+ );
1474
1480
  }
1475
1481
  emitChange(isPregnancyEligible, triggerRenalRecalculation) {
1476
1482
  this.dispatchEvent(new CustomEvent("demographics-change", {
@@ -1510,7 +1516,7 @@ let PatientDemographicsForm = class extends i$2 {
1510
1516
  const { age, unit } = calculateAgeFromBirthDate(birthDate);
1511
1517
  this.patientAgeValue = age;
1512
1518
  this.patientUnitAge = unit;
1513
- isPregnancyEligible = unit === "ans" && this.defaultPatientSex.value !== "male";
1519
+ isPregnancyEligible = PatientDemographicsForm.isPregnancyEligible(age, unit, this.defaultPatientSex.value);
1514
1520
  } else {
1515
1521
  this.patientAgeValue = void 0;
1516
1522
  this.ageErrorMessageInput = "L'âge est requis";
@@ -2703,8 +2709,14 @@ let PatientProfile = class extends i$2 {
2703
2709
  </div>
2704
2710
 
2705
2711
  <div class="${PREFIX}-patient-profile__action-buttons-container" data-test-id="action-buttons">
2706
- ${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}
2707
- <bcbd-button icon=${this.moreInformationVisible ? "chevron-up" : "chevron-down"} size="medium" background-color="primary" aria-label=${this.moreInformationVisible ? "Masquer les informations supplémentaires" : "Afficher les informations supplémentaires"} @click=${this.handleMoreInformation} data-test-id="visible-button"></bcbd-button>
2712
+ ${this.editButtonVisible || this.editButtonVisible === void 0 ? b`
2713
+ <bcbd-tooltip content="Editer le profil patient" placement="top">
2714
+ <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>
2715
+ </bcbd-tooltip>
2716
+ ` : A}
2717
+ <bcbd-tooltip content="Déplier le profil patient" placement="top">
2718
+ <bcbd-button icon=${this.moreInformationVisible ? "chevron-up" : "chevron-down"} size="medium" background-color="primary" aria-label=${this.moreInformationVisible ? "Masquer les informations supplémentaires" : "Afficher les informations supplémentaires"} @click=${this.handleMoreInformation} data-test-id="visible-button"></bcbd-button>
2719
+ </bcbd-tooltip>
2708
2720
  </div>`}
2709
2721
  </div>
2710
2722
  <div class="${PREFIX}-patient-profile__alert-container" data-test-id="alert-container">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudebernard/patient-profile-element",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "main": "dist/patient-profile.es.js",
5
5
  "module": "dist/patient-profile.es.js",
6
6
  "types": "dist/patient-profile.d.ts",
@@ -46,11 +46,12 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@chromatic-com/storybook": "^5.0.1",
49
- "@claudebernard/fhir-prescription-mocks": "^2.4.1",
49
+ "@claudebernard/fhir-prescription-mocks": "^2.5.3",
50
50
  "@claudebernard/storybook-addon-theme-switcher": "0.1.0",
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",
@@ -1,4 +0,0 @@
1
- import { UserConfig } from 'vite';
2
- declare const _default: UserConfig;
3
- export default _default;
4
- //# sourceMappingURL=vitest.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";;AAWA,wBA8CG"}
@@ -1 +0,0 @@
1
- /// <reference types="@vitest/browser-playwright" />