@uxland/primary-shell 5.3.10 → 5.3.11

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.
Files changed (23) hide show
  1. package/dist/index.js +42 -41
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.cjs +4 -4
  4. package/dist/index.umd.cjs.map +1 -1
  5. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/are-same-diagnostics.d.ts +3 -0
  6. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/are-same-diagnostics.test.d.ts +1 -0
  7. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/has-valid-diagnostics.d.ts +4 -0
  8. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/has-valid-diagnostics.test.d.ts +1 -0
  9. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/validation/is-valid-professional.d.ts +1 -0
  10. package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/validation/utils.d.ts +4 -0
  11. package/package.json +1 -1
  12. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/are-same-diagnostics.test.ts +48 -0
  13. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/are-same-diagnostics.ts +15 -0
  14. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/has-valid-diagnostics.test.ts +79 -0
  15. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/diagnostics/has-valid-diagnostics.ts +20 -0
  16. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/is-valid-basic-history-item.ts +1 -11
  17. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/is-valid-full-history-item.ts +3 -39
  18. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/is-valid-professional.ts +16 -0
  19. package/src/internal-plugins/activity-history/activity-history-item/domain/validation/utils.ts +11 -0
  20. package/src/internal-plugins/activity-history/activity-history-item/filter/UI/activity-history-filters/template.ts +1 -1
  21. package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/reducer.ts +5 -1
  22. package/src/internal-plugins/activity-history/activity-history-item/list/group-history-items/group-history-items.test.ts +43 -2
  23. package/src/internal-plugins/activity-history/activity-history-item/list/group-history-items/group-history-items.ts +40 -44
package/dist/index.js CHANGED
@@ -3497,7 +3497,7 @@ function isArrayBufferView(X) {
3497
3497
  let W;
3498
3498
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? W = ArrayBuffer.isView(X) : W = X && X.buffer && isArrayBuffer(X.buffer), W;
3499
3499
  }
3500
- const isString = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (X) => X !== null && typeof X == "object", isBoolean$1 = (X) => X === !0 || X === !1, isPlainObject$2 = (X) => {
3500
+ const isString$1 = typeOfTest("string"), isFunction = typeOfTest("function"), isNumber = typeOfTest("number"), isObject = (X) => X !== null && typeof X == "object", isBoolean$1 = (X) => X === !0 || X === !1, isPlainObject$2 = (X) => {
3501
3501
  if (kindOf(X) !== "object")
3502
3502
  return !1;
3503
3503
  const W = getPrototypeOf$1(X);
@@ -3660,7 +3660,7 @@ const toJSONObject = (X) => {
3660
3660
  isBuffer,
3661
3661
  isFormData,
3662
3662
  isArrayBufferView,
3663
- isString,
3663
+ isString: isString$1,
3664
3664
  isNumber,
3665
3665
  isBoolean: isBoolean$1,
3666
3666
  isObject,
@@ -10973,7 +10973,7 @@ function setCommonFilterValueReducer(X, W) {
10973
10973
  } : J);
10974
10974
  }
10975
10975
  function addCustomFiltersReducer(X, W) {
10976
- X.filters = [...X.filters, W.payload];
10976
+ X.filters.some((te) => te.id === W.payload.id) || (X.filters = [...X.filters, W.payload]);
10977
10977
  }
10978
10978
  function setCustomFilterGroupValueReducer(X, W) {
10979
10979
  X.filters = X.filters.map((J) => J.id === W.payload.id ? {
@@ -11130,15 +11130,12 @@ const bootstrapInjectAsyncHistoryItems = (X) => {
11130
11130
  request$g = X.registerRequest(addAsyncHistoryItemsCommand, InjectAsyncHistoryItemsHandler);
11131
11131
  }, teardownInjectAsyncHistoryItems = () => {
11132
11132
  request$g == null || request$g.dispose();
11133
- }, isValidBasicActivityHistoryItem = (X) => {
11134
- const W = (te) => typeof te == "string" && te.trim() !== "", J = (te) => {
11135
- if (typeof te != "string" || te.trim() === "") return !1;
11136
- const re = new Date(te);
11137
- return re instanceof Date && !Number.isNaN(re.getTime());
11138
- };
11139
- return X && W(X.id) && // Verifica que "id" esté informado
11140
- J(X.date);
11141
- }, ensureAreValidBasicActivityHistoryItems = (X) => {
11133
+ }, isString = (X) => typeof X == "string" && X.trim() !== "", isValidDateString = (X) => {
11134
+ if (typeof X != "string" || X.trim() === "") return !1;
11135
+ const W = new Date(X);
11136
+ return W instanceof Date && !Number.isNaN(W.getTime());
11137
+ }, isValidBasicActivityHistoryItem = (X) => X && isString(X.id) && // Verifica que "id" esté informado
11138
+ isValidDateString(X.date), ensureAreValidBasicActivityHistoryItems = (X) => {
11142
11139
  if (!X.every(isValidBasicActivityHistoryItem))
11143
11140
  throw console.error("Invalid activity history items", X), new Error("Invalid activity history items");
11144
11141
  return X;
@@ -11555,16 +11552,40 @@ const activityHistoryFiltersSelector = (X) => X.activityHistoryFilters.filters,
11555
11552
  return (de = oe.enabledValues) == null ? void 0 : de.length;
11556
11553
  })
11557
11554
  })).filter((W) => W.filters.length > 0)
11558
- ), isSameVisit = (X, W) => {
11559
- var ne, oe, de, ue, ce, he, pe, fe, ge, be, me, ve, ye, we, Se, _e, Ce, Ie;
11560
- const J = ((ne = X.professional) == null ? void 0 : ne.id) === ((oe = W.professional) == null ? void 0 : oe.id) && ((ue = (de = X.professional) == null ? void 0 : de.role) == null ? void 0 : ue.id) === ((he = (ce = W.professional) == null ? void 0 : ce.role) == null ? void 0 : he.id) && ((fe = (pe = X.professional) == null ? void 0 : pe.speciality) == null ? void 0 : fe.id) === ((be = (ge = W.professional) == null ? void 0 : ge.speciality) == null ? void 0 : be.id), te = ((me = X.ep) == null ? void 0 : me.id) === ((ve = W.ep) == null ? void 0 : ve.id) && ((ye = X.up) == null ? void 0 : ye.id) === ((we = W.up) == null ? void 0 : we.id) && ((Se = X.center) == null ? void 0 : Se.id) === ((_e = W.center) == null ? void 0 : _e.id) && ((Ce = X.service) == null ? void 0 : Ce.id) === ((Ie = W.service) == null ? void 0 : Ie.id), re = new Date(X.date).toDateString() === new Date(W.date).toDateString();
11561
- return J && te && re;
11562
- }, withinEightHours = (X, W) => Math.abs(new Date(X).getTime() - new Date(W).getTime()) <= 8 * 60 * 60 * 1e3, areSameDiagnostics = (X, W) => {
11555
+ ), areSameDiagnostics = (X, W) => {
11563
11556
  if (X.length !== W.length)
11564
11557
  return !1;
11565
11558
  const J = X.map((re) => re.codi).sort(), te = W.map((re) => re.codi).sort();
11566
11559
  return J.every((re, ne) => re === te[ne]);
11567
- }, groupActivityHistoryItems = (X) => {
11560
+ }, hasValidDiagnostic = (X) => X != null && typeof X.codi == "string" && typeof X.cataleg == "string" && typeof X.descripcio == "string", hasValidDiagnostics = (X) => X == null ? !0 : Array.isArray(X) && X.every(hasValidDiagnostic), isSameVisit = (X, W) => {
11561
+ var ne, oe, de, ue, ce, he, pe, fe, ge, be, me, ve, ye, we, Se, _e, Ce, Ie;
11562
+ const J = ((ne = X.professional) == null ? void 0 : ne.id) === ((oe = W.professional) == null ? void 0 : oe.id) && ((ue = (de = X.professional) == null ? void 0 : de.role) == null ? void 0 : ue.id) === ((he = (ce = W.professional) == null ? void 0 : ce.role) == null ? void 0 : he.id) && ((fe = (pe = X.professional) == null ? void 0 : pe.speciality) == null ? void 0 : fe.id) === ((be = (ge = W.professional) == null ? void 0 : ge.speciality) == null ? void 0 : be.id), te = ((me = X.ep) == null ? void 0 : me.id) === ((ve = W.ep) == null ? void 0 : ve.id) && ((ye = X.up) == null ? void 0 : ye.id) === ((we = W.up) == null ? void 0 : we.id) && ((Se = X.center) == null ? void 0 : Se.id) === ((_e = W.center) == null ? void 0 : _e.id) && ((Ce = X.service) == null ? void 0 : Ce.id) === ((Ie = W.service) == null ? void 0 : Ie.id), re = new Date(X.date).toDateString() === new Date(W.date).toDateString();
11563
+ return J && te && re;
11564
+ }, withinEightHours = (X, W) => Math.abs(new Date(X).getTime() - new Date(W).getTime()) <= 8 * 60 * 60 * 1e3;
11565
+ function groupByValidDiagnostics(X) {
11566
+ X.forEach((W) => {
11567
+ const J = [], te = [];
11568
+ W.items.forEach((re) => {
11569
+ const ne = re.diagnostics;
11570
+ if ((ne == null ? void 0 : ne.length) > 0 && hasValidDiagnostics(ne)) {
11571
+ let de = !1;
11572
+ for (const ue of J) {
11573
+ const ce = ue.items[0];
11574
+ if (areSameDiagnostics(ce.diagnostics, ne)) {
11575
+ ue.items.push(re), de = !0;
11576
+ break;
11577
+ }
11578
+ }
11579
+ de || J.push({
11580
+ idSubGroup: crypto.randomUUID(),
11581
+ items: [re]
11582
+ });
11583
+ } else
11584
+ te.push(re);
11585
+ }), W.items = te, W.subGroups = J;
11586
+ });
11587
+ }
11588
+ const groupActivityHistoryItems = (X) => {
11568
11589
  const W = [];
11569
11590
  return X == null || X.forEach((J) => {
11570
11591
  let te = !1;
@@ -11585,31 +11606,11 @@ const activityHistoryFiltersSelector = (X) => X.activityHistoryFilters.filters,
11585
11606
  }
11586
11607
  }
11587
11608
  te || W.push({
11588
- idGroup: Math.random().toString(36).substr(2, 9),
11609
+ idGroup: crypto.randomUUID(),
11589
11610
  items: [J],
11590
11611
  sameVisit: !1
11591
11612
  });
11592
- }), W.forEach((J) => {
11593
- const te = [], re = [];
11594
- J.items.forEach((ne) => {
11595
- var oe;
11596
- if (((oe = ne.diagnostics) == null ? void 0 : oe.length) > 0) {
11597
- let de = !1;
11598
- for (const ue of te) {
11599
- const ce = ue.items[0];
11600
- if (areSameDiagnostics(ce.diagnostics, ne.diagnostics)) {
11601
- ue.items.push(ne), de = !0;
11602
- break;
11603
- }
11604
- }
11605
- de || te.push({
11606
- idSubGroup: Math.random().toString(36).substr(2, 9),
11607
- items: [ne]
11608
- });
11609
- } else
11610
- re.push(ne);
11611
- }), J.items = re, J.subGroups = te;
11612
- }), W;
11613
+ }), groupByValidDiagnostics(W), W;
11613
11614
  }, sortGroupsByMostRecentDate = (X) => {
11614
11615
  const W = (ne) => ne.reduce((oe, de) => {
11615
11616
  const ue = new Date(de.date);
@@ -15414,7 +15415,7 @@ const styles$c = ".filters-sidebar{padding:8px 4px;border-right:1px solid rgb(18
15414
15415
  <div class="filter-container">
15415
15416
  ${Qt(X.commonFilters, (J) => ke$1`<div class="filter">${getFilterTemplate(J, X._onChangeCommonFilterValue.bind(X))}</div> `)}
15416
15417
  ${X.diagnosticFilter && ke$1`<div class="filter">
15417
- <dss-input-dropdown icon="" multiple dropdownFixed type="default" .elements=${(W = X.diagnosticFilter) == null ? void 0 : W.values} @onInputDropdownChange=${X._handleDiagnosticFilterChange} .selectedValue=${X.diagnosticFilterEnabledValues}>
15418
+ <dss-input-dropdown icon="" multiple dropdownFixed type="default" .elements=${(W = X.diagnosticFilter) == null ? void 0 : W.values} @onInputDropdownChange=${X._handleDiagnosticFilterChange} .selectedValue=${X.diagnosticFilterEnabledValues} selectorStyle=${"max-height: 450px"}>
15418
15419
  <label slot="label" for="diagnostic-filter">${X.diagnosticFilter.title}</label>
15419
15420
  <input id="diagnostic-filter" slot="input" type="text" class="dss-input" autocomplete="off"/>
15420
15421
  </dss-input-dropdown>