@claudebernard/patient-profile-element 0.5.6 → 0.6.0

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.
@@ -149,6 +149,7 @@
149
149
  "type": {
150
150
  "text": "PatientProfilePreferences | undefined"
151
151
  },
152
+ "default": "{ forms: { age: { display: true, readOnly: true }, sexe: { display: true, readOnly: true }, }, }",
152
153
  "attribute": "preferences"
153
154
  },
154
155
  {
@@ -314,6 +315,7 @@
314
315
  "type": {
315
316
  "text": "PatientProfilePreferences | undefined"
316
317
  },
318
+ "default": "{ forms: { age: { display: true, readOnly: true }, sexe: { display: true, readOnly: true }, }, }",
317
319
  "fieldName": "preferences"
318
320
  }
319
321
  ],
@@ -354,6 +356,13 @@
354
356
  "type": {
355
357
  "text": "WebComponentsStory<any, any>"
356
358
  }
359
+ },
360
+ {
361
+ "kind": "variable",
362
+ "name": "AgeAndSexeEditable",
363
+ "type": {
364
+ "text": "WebComponentsStory<any, any>"
365
+ }
357
366
  }
358
367
  ],
359
368
  "exports": [
@@ -364,6 +373,14 @@
364
373
  "name": "Base",
365
374
  "module": "src/patient-profile/patient-profile-edition/patient-profile-edition.stories.ts"
366
375
  }
376
+ },
377
+ {
378
+ "kind": "js",
379
+ "name": "AgeAndSexeEditable",
380
+ "declaration": {
381
+ "name": "AgeAndSexeEditable",
382
+ "module": "src/patient-profile/patient-profile-edition/patient-profile-edition.stories.ts"
383
+ }
367
384
  }
368
385
  ]
369
386
  },
@@ -409,6 +426,42 @@
409
426
  },
410
427
  "attribute": "preferences"
411
428
  },
429
+ {
430
+ "kind": "field",
431
+ "name": "isAgeDisplay",
432
+ "type": {
433
+ "text": "boolean"
434
+ },
435
+ "privacy": "private",
436
+ "readonly": true
437
+ },
438
+ {
439
+ "kind": "field",
440
+ "name": "isAgeReadOnly",
441
+ "type": {
442
+ "text": "boolean"
443
+ },
444
+ "privacy": "private",
445
+ "readonly": true
446
+ },
447
+ {
448
+ "kind": "field",
449
+ "name": "isSexeDisplay",
450
+ "type": {
451
+ "text": "boolean"
452
+ },
453
+ "privacy": "private",
454
+ "readonly": true
455
+ },
456
+ {
457
+ "kind": "field",
458
+ "name": "isSexeReadOnly",
459
+ "type": {
460
+ "text": "boolean"
461
+ },
462
+ "privacy": "private",
463
+ "readonly": true
464
+ },
412
465
  {
413
466
  "kind": "field",
414
467
  "name": "patientAge",
@@ -1185,6 +1238,24 @@
1185
1238
  }
1186
1239
  ]
1187
1240
  },
1241
+ {
1242
+ "kind": "javascript-module",
1243
+ "path": "src/shared/interfaces/api-return.interface.ts",
1244
+ "declarations": [],
1245
+ "exports": []
1246
+ },
1247
+ {
1248
+ "kind": "javascript-module",
1249
+ "path": "src/shared/interfaces/patient.ts",
1250
+ "declarations": [],
1251
+ "exports": []
1252
+ },
1253
+ {
1254
+ "kind": "javascript-module",
1255
+ "path": "src/shared/interfaces/properties.ts",
1256
+ "declarations": [],
1257
+ "exports": []
1258
+ },
1188
1259
  {
1189
1260
  "kind": "javascript-module",
1190
1261
  "path": "src/shared/mocks/pathologies.mock.ts",
@@ -1249,18 +1320,6 @@
1249
1320
  }
1250
1321
  ]
1251
1322
  },
1252
- {
1253
- "kind": "javascript-module",
1254
- "path": "src/shared/interfaces/api-return.interface.ts",
1255
- "declarations": [],
1256
- "exports": []
1257
- },
1258
- {
1259
- "kind": "javascript-module",
1260
- "path": "src/shared/interfaces/patient.ts",
1261
- "declarations": [],
1262
- "exports": []
1263
- },
1264
1323
  {
1265
1324
  "kind": "javascript-module",
1266
1325
  "path": "src/shared/services/api-prescription.service.ts",
@@ -4,6 +4,11 @@ import { LitElement } from 'lit';
4
4
  import { nothing } from 'lit';
5
5
  import { TemplateResult } from 'lit';
6
6
 
7
+ declare interface FormPreferences {
8
+ age?: SectionPreferences;
9
+ sexe?: SectionPreferences;
10
+ }
11
+
7
12
  export declare class PatientProfile extends LitElement {
8
13
  patientProfile?: Bundle;
9
14
  editButtonVisible: boolean | undefined;
@@ -29,7 +34,7 @@ export declare class PatientProfile extends LitElement {
29
34
  static styles: CSSResult;
30
35
  }
31
36
 
32
- export declare interface PatientProfilePreferences {
37
+ declare interface PatientProfilePreferences {
33
38
  /**
34
39
  * Filtre le type de pathologie utilisé lors de l'appel fetchPathologiesByTerm.
35
40
  * - "AMM" : pathologies avec Autorisation de Mise sur le Marché
@@ -37,6 +42,7 @@ export declare interface PatientProfilePreferences {
37
42
  * - "" : aucun filtre (toutes les pathologies)
38
43
  */
39
44
  typePathology?: "AMM" | "CIM10" | "";
45
+ forms?: FormPreferences;
40
46
  }
41
47
 
42
48
  export declare interface PatientProfileProps {
@@ -47,4 +53,11 @@ export declare interface PatientProfileProps {
47
53
  preferences?: PatientProfilePreferences;
48
54
  }
49
55
 
56
+ declare interface SectionPreferences {
57
+ /** @default true */
58
+ display?: boolean;
59
+ /** @default true */
60
+ readOnly?: boolean;
61
+ }
62
+
50
63
  export { }
@@ -1697,6 +1697,18 @@ let PatientProfileEdition = class extends i$2 {
1697
1697
  this.imc = 0;
1698
1698
  this.resetKey = 0;
1699
1699
  }
1700
+ get isAgeDisplay() {
1701
+ return this.preferences?.forms?.age?.display ?? true;
1702
+ }
1703
+ get isAgeReadOnly() {
1704
+ return this.preferences?.forms?.age?.readOnly ?? true;
1705
+ }
1706
+ get isSexeDisplay() {
1707
+ return this.preferences?.forms?.sexe?.display ?? true;
1708
+ }
1709
+ get isSexeReadOnly() {
1710
+ return this.preferences?.forms?.sexe?.readOnly ?? true;
1711
+ }
1700
1712
  open() {
1701
1713
  this.editionModalElement.open();
1702
1714
  }
@@ -2031,17 +2043,19 @@ let PatientProfileEdition = class extends i$2 {
2031
2043
  <bcbd-select data-test-id="name-select" .selectedOptions=${{ value: "1", label: getPatientName(this.patientProfile) }} readonly></bcbd-select>
2032
2044
  </div>
2033
2045
  <div class="${PREFIX}-edition-modal-information-section">
2046
+ ${this.isSexeDisplay ? b`
2034
2047
  <div class="${PREFIX}-edition-modal-little-section">
2035
2048
  <span>Sexe</span>
2036
- <bcbd-select data-test-id="sex-select" id="genderSelect" placeholder="Choisir" .options=${sexOptions} .selectedOptions=${this.defaultPatientSex} @change=${this.modifyGender}></bcbd-select>
2037
- </div>
2049
+ <bcbd-select data-test-id="sex-select" id="genderSelect" ?disabled=${this.isSexeReadOnly} placeholder="Choisir" .options=${sexOptions} .selectedOptions=${this.defaultPatientSex} ?readonly=${this.isSexeReadOnly} @change=${this.modifyGender}></bcbd-select>
2050
+ </div>` : A}
2051
+ ${this.isAgeDisplay ? b`
2038
2052
  <div class="${PREFIX}-edition-modal-little-section">
2039
2053
  <span>Age</span>
2040
2054
  <div class="${PREFIX}-edition-modal-age-input-group">
2041
- <bcbd-input data-test-id="age-input" id="ageInput" required type="number" aria-label="Age" .value=${this.patientAge} warning-msg="" @change=${this.verifyAgeInput}></bcbd-input>
2042
- <bcbd-select data-test-id="age-unit-select" id="ageUnitSelect" .options=${ageOptions} .selectedOptions=${this.defaultPatientUnitAge} @change=${this.handleAgeUnit}></bcbd-select>
2055
+ <bcbd-input data-test-id="age-input" id="ageInput" ?disabled=${this.isAgeReadOnly} required type="number" aria-label="Age" .value=${this.patientAge} warning-msg="" ?readonly=${this.isAgeReadOnly} @change=${this.verifyAgeInput}></bcbd-input>
2056
+ <bcbd-select data-test-id="age-unit-select" id="ageUnitSelect" ?disabled=${this.isAgeReadOnly} .options=${ageOptions} .selectedOptions=${this.defaultPatientUnitAge} ?readonly=${this.isAgeReadOnly} @change=${this.handleAgeUnit}></bcbd-select>
2043
2057
  </div>
2044
- </div>
2058
+ </div>` : A}
2045
2059
  <div class="${PREFIX}-edition-modal-little-section">
2046
2060
  <span>Taille (cm)</span>
2047
2061
  <bcbd-input data-test-id="size-input" id="sizeInput" type="number" aria-label="Taille (cm)" .value=${getPatientHeight(this.patientProfile) ?? ""} warning-msg="" @change=${this.verifySizeInput}></bcbd-input>
@@ -2270,6 +2284,12 @@ let PatientProfile = class extends i$2 {
2270
2284
  super(...arguments);
2271
2285
  this.editButtonVisible = true;
2272
2286
  this.apiUrl = "https://api-dev.claudebernard.fr";
2287
+ this.preferences = {
2288
+ forms: {
2289
+ age: { display: true, readOnly: true },
2290
+ sexe: { display: true, readOnly: true }
2291
+ }
2292
+ };
2273
2293
  this.moreInformationVisible = false;
2274
2294
  this.patientAgeUnit = "ans";
2275
2295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudebernard/patient-profile-element",
3
- "version": "0.5.6",
3
+ "version": "0.6.0",
4
4
  "main": "dist/patient-profile.es.js",
5
5
  "module": "dist/patient-profile.es.js",
6
6
  "types": "dist/patient-profile.d.ts",
@@ -85,7 +85,7 @@
85
85
  "vitest": "^4.0.7"
86
86
  },
87
87
  "peerDependencies": {
88
- "@claudebernard/design-system": "^2.29.6",
88
+ "@claudebernard/design-system": "^2.33.0",
89
89
  "@claudebernard/types": "^0.35.0"
90
90
  },
91
91
  "customElements": "dist/custom-elements.json",