@uxland/primary-shell 3.2.6 → 3.3.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.
Files changed (43) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +101 -58
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.umd.cjs +23 -25
  5. package/dist/index.umd.cjs.map +1 -1
  6. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/components/dialog-component.d.ts +3 -4
  7. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm-mixin.d.ts +4 -9
  8. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm.d.ts +2 -2
  9. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/index.d.ts +1 -0
  10. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/open-dialog.d.ts +3 -0
  11. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/shared.d.ts +3 -0
  12. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/typings.d.ts +11 -2
  13. package/dist/primary/shell/src/UI/shared-components/{primaria-menu-with-submenu/primaria-menu-with-submenu.d.ts → primaria-nav-menu/primaria-nav-menu.d.ts} +1 -1
  14. package/dist/primary/shell/src/UI/shared-components/primaria-nav-menu/template.d.ts +3 -0
  15. package/dist/primary/shell/src/api/api.d.ts +2 -0
  16. package/dist/primary/shell/src/api/ecap-event-manager/ecap-event-manager.d.ts +16 -0
  17. package/dist/primary/shell/src/api/ecap-event-manager/typings.d.ts +5 -0
  18. package/dist/primary/shell/src/api/interaction-manager/interaction.d.ts +5 -4
  19. package/dist/primary/shell/src/index.d.ts +3 -1
  20. package/dist/primary/shell/src/internal-plugins/activity-history/components/activity-history/activity-history.d.ts +1 -1
  21. package/package.json +1 -1
  22. package/src/UI/components/poc-events-ecap/poc-events-ecap.ts +4 -10
  23. package/src/UI/shared-components/primaria-interaction/components/dialog-component-styles.css +5 -2
  24. package/src/UI/shared-components/primaria-interaction/components/dialog-component.ts +47 -37
  25. package/src/UI/shared-components/primaria-interaction/confirm-mixin.ts +9 -13
  26. package/src/UI/shared-components/primaria-interaction/confirm.ts +5 -26
  27. package/src/UI/shared-components/primaria-interaction/index.ts +1 -0
  28. package/src/UI/shared-components/primaria-interaction/open-dialog.ts +8 -0
  29. package/src/UI/shared-components/primaria-interaction/shared.ts +29 -0
  30. package/src/UI/shared-components/primaria-interaction/typings.ts +13 -2
  31. package/src/UI/shared-components/{primaria-menu-with-submenu/primaria-menu-with-submenu.ts → primaria-nav-menu/primaria-nav-menu.ts} +2 -2
  32. package/src/UI/shared-components/{primaria-menu-with-submenu → primaria-nav-menu}/styles.css +1 -1
  33. package/src/UI/shared-components/{primaria-menu-with-submenu → primaria-nav-menu}/template.ts +3 -3
  34. package/src/api/api.ts +4 -0
  35. package/src/api/ecap-event-manager/ecap-event-manager.ts +34 -0
  36. package/src/api/ecap-event-manager/typings.ts +5 -0
  37. package/src/api/interaction-manager/interaction.ts +11 -6
  38. package/src/api/region-manager/region-manager.ts +8 -0
  39. package/src/index.ts +6 -4
  40. package/src/internal-plugins/activity-history/components/activity-history/activity-history.ts +17 -5
  41. package/src/internal-plugins/activity-history/components/activity-history/template.ts +2 -3
  42. package/src/internal-plugins/activity-history/features/export-to-pdf/handler.ts +1 -2
  43. package/dist/primary/shell/src/UI/shared-components/primaria-menu-with-submenu/template.d.ts +0 -3
@@ -0,0 +1 @@
1
+ export * from './primary/shell/src/index'
package/dist/index.js CHANGED
@@ -3232,6 +3232,13 @@ class RegionManagerProxy {
3232
3232
  W
3233
3233
  ), Promise.resolve();
3234
3234
  }
3235
+ registerNavigationMenu(W) {
3236
+ return this.regionManager.registerViewWithRegion(
3237
+ shellRegions.navigationMenu,
3238
+ `${this.pluginInfo.pluginId}::${W.id}`,
3239
+ W
3240
+ ), Promise.resolve();
3241
+ }
3235
3242
  registerMainView(W) {
3236
3243
  return this.regionManager.registerViewWithRegion(
3237
3244
  shellRegions.main,
@@ -5397,7 +5404,16 @@ const createAxiosInstance = (X) => {
5397
5404
  ), W;
5398
5405
  };
5399
5406
  let instance;
5400
- const createHttpClient = (X) => (instance || (instance = createAxiosInstance(X)), { request: instance.request }), styles$i = "*[hidden]{display:none!important}.modal{font-family:Open Sans;display:none;position:fixed;z-index:400;left:0;top:0;width:100%;height:100%;background-color:#000000a6}.modal .dialog{display:flex;flex-direction:column;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:21;background:#fff;border-radius:16px;width:auto;height:auto;max-height:95%;min-width:400px;box-shadow:0 0 14px #00000040,0 1px 10px #00000038}.modal .dialog .dialog__header{display:flex;flex-direction:row;justify-content:space-between;padding:24px;border-top-left-radius:8px;border-top-right-radius:8px;justify-content:center;align-items:center}.modal .dialog .dialog__header h2{color:var(--color-neutral-900);padding:0;margin:0;font-weight:700;font-size:1.286rem;line-height:30px}.modal .dialog .dialog__content{display:flex;flex-direction:column;flex:1;align-items:center;min-height:1px;height:100%;padding-inline:24px;padding-bottom:24px;font-weight:400;font-size:16px;line-height:24px;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.modal .dialog .dialog__content>*{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.modal .dialog .dialog__actions{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:16px;padding:24px 16px}@-webkit-keyframes fadein{0%{opacity:0}to{opacity:1}}@keyframes fadein{0%{opacity:0}to{opacity:1}}";
5407
+ const createHttpClient = (X) => (instance || (instance = createAxiosInstance(X)), { request: instance.request });
5408
+ /**
5409
+ * @license
5410
+ * Copyright 2021 Google LLC
5411
+ * SPDX-License-Identifier: BSD-3-Clause
5412
+ */
5413
+ function nn(X, W, J) {
5414
+ return X ? W(X) : J == null ? void 0 : J(X);
5415
+ }
5416
+ const styles$i = "*[hidden]{display:none!important}.modal{font-family:Open Sans;display:none;position:fixed;z-index:400;left:0;top:0;width:100%;height:100%;background-color:#000000a6}.modal .dialog{display:flex;flex-direction:column;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);z-index:21;background:#fff;border-radius:16px;width:auto;height:auto;max-height:95%;min-width:400px;box-shadow:0 0 14px #00000040,0 1px 10px #00000038}.modal .dialog .dialog__header{display:flex;flex-direction:row;justify-content:center;padding:24px;border-top-left-radius:8px;border-top-right-radius:8px;align-items:center}.modal .dialog .dialog__header.with-close{justify-content:space-between}.modal .dialog .dialog__header h2{color:var(--color-neutral-900);padding:0;margin:0;font-weight:700;font-size:1.286rem;line-height:30px}.modal .dialog .dialog__content{display:flex;flex-direction:column;flex:1;align-items:center;min-height:1px;height:100%;padding-inline:24px;padding-bottom:24px;font-weight:400;font-size:16px;line-height:24px;border-bottom-left-radius:8px;border-bottom-right-radius:8px}.modal .dialog .dialog__content>*{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.modal .dialog .dialog__actions{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:16px;padding:24px 16px}@-webkit-keyframes fadein{0%{opacity:0}to{opacity:1}}@keyframes fadein{0%{opacity:0}to{opacity:1}}";
5401
5417
  var __defProp$o = Object.defineProperty, __getOwnPropDesc$n = Object.getOwnPropertyDescriptor, __decorateClass$o = (X, W, J, AA) => {
5402
5418
  for (var eA = AA > 1 ? void 0 : AA ? __getOwnPropDesc$n(W, J) : W, tA = X.length - 1, sA; tA >= 0; tA--)
5403
5419
  (sA = X[tA]) && (eA = (AA ? sA(W, J, eA) : sA(eA)) || eA);
@@ -5414,31 +5430,38 @@ const dssToConfirmTypeClass = (X) => X === "danger" ? "dss-button--error" : `dss
5414
5430
  </div>
5415
5431
  `;
5416
5432
  }, renderMessage = (X) => ke$1` <div id="message">${X.message || ""}</div> `;
5417
- function renderCustomContent(X, W) {
5418
- if (X.componentConstructor) {
5419
- const J = new X.componentConstructor();
5420
- return J.setAttribute("id", "__custom-element__"), J.addEventListener("closed", W.componentCloseRequest.bind(W)), ke$1`${J}`;
5433
+ function renderCustomContent(X) {
5434
+ if (X.options.componentConstructor) {
5435
+ const W = new X.options.componentConstructor();
5436
+ return W.setAttribute("id", "__custom-element__"), W.addEventListener("closed", X.componentCloseRequest.bind(X)), ke$1`${W}`;
5421
5437
  }
5422
5438
  return D$1;
5423
5439
  }
5424
- let DialogComponent = class extends h$4 {
5425
- render() {
5426
- return ke$1`
5427
- <div
5428
- class="modal"
5429
- @click=${(X) => X.target === this.modal && !this.options.modal && this.close(!1)}
5430
- >
5431
- <div
5432
- class="dialog"
5433
- >
5434
- ${this.options.fullCustomization ? renderCustomContent(this.options, this) : ke$1`<div class="dialog__header ${this.options.type}">
5435
- <h2 part="title">${this.options.title || ""}</h2>
5440
+ function renderDefaultContent(X) {
5441
+ const W = X.options.showCloseButton;
5442
+ return ke$1`<div class="dialog__header ${X.options.type} ${W ? "with-close" : ""}">
5443
+ <h2 part="title">${X.options.title || ""}</h2>
5444
+ ${nn(
5445
+ W,
5446
+ () => ke$1`<dss-icon-button size="md" icon="cancel" @click="${X._cancel}"></dss-icon-button>`,
5447
+ () => D$1
5448
+ )}
5436
5449
  </div>
5437
5450
  <div class="dialog__content">
5438
- ${this.options.message ? renderMessage(this.options) : renderCustomContent(this.options, this)}
5451
+ ${nn(
5452
+ X.options.message,
5453
+ () => renderMessage(X.options),
5454
+ () => renderCustomContent(X)
5455
+ )}
5439
5456
  </div>
5440
- ${renderActions(this)}`}
5441
-
5457
+ ${renderActions(X)}`;
5458
+ }
5459
+ let DialogComponent = class extends h$4 {
5460
+ render() {
5461
+ return ke$1`
5462
+ <div class="modal">
5463
+ <div class="dialog">
5464
+ ${this.options.fullCustomization ? renderCustomContent(this) : renderDefaultContent(this)}
5442
5465
  </div>
5443
5466
  </div>
5444
5467
  `;
@@ -5449,23 +5472,23 @@ let DialogComponent = class extends h$4 {
5449
5472
  `;
5450
5473
  }
5451
5474
  _cancel(X) {
5452
- console.log("canceling modal"), this.close(!1);
5475
+ this.close({ confirmed: !1 });
5453
5476
  }
5454
5477
  _accept(X) {
5455
- console.log("accepting modal"), this.close(!0);
5478
+ this.close({ confirmed: !0 });
5456
5479
  }
5457
5480
  componentCloseRequest(X) {
5458
5481
  this.close(X.detail);
5459
5482
  }
5460
5483
  async close(X) {
5461
- if (X) {
5462
- const W = this.getCustomComponent();
5463
- if (W != null && W.canAccept) {
5464
- if (!await W.canAccept()) return;
5465
- W.accept && await W.accept();
5466
- }
5484
+ let W = X;
5485
+ if (W != null && W.confirmed) {
5486
+ const J = this.getCustomComponent();
5487
+ if (J != null && J.canAccept && !await J.canAccept())
5488
+ return;
5489
+ J != null && J.accept && (W = await J.accept(W));
5467
5490
  }
5468
- this.modal.style.display = "none", this.dispatchEvent(new CustomEvent("closed", { detail: X }));
5491
+ this.dispatchEvent(new CustomEvent("closed", { detail: W })), this.modal.style.display = "none";
5469
5492
  }
5470
5493
  getCustomComponent() {
5471
5494
  var X;
@@ -5496,7 +5519,7 @@ __decorateClass$o([
5496
5519
  DialogComponent = __decorateClass$o([
5497
5520
  t$6("dialog-component")
5498
5521
  ], DialogComponent);
5499
- const doConfirm = async (X) => {
5522
+ const buildDialogComponent = (X) => {
5500
5523
  if (!X.message && !X.componentConstructor)
5501
5524
  throw new Error("message, componentConstructor options properties are required");
5502
5525
  return new Promise((W) => {
@@ -5512,7 +5535,7 @@ const doConfirm = async (X) => {
5512
5535
  J.remove(), W(tA.detail);
5513
5536
  }
5514
5537
  });
5515
- };
5538
+ }, confirm = async (X) => buildDialogComponent(X);
5516
5539
  /**
5517
5540
  * @license
5518
5541
  * Copyright 2018 Google LLC
@@ -5627,6 +5650,8 @@ const notificationStack = [], displayNotifications = [], stackLimit = 10, timeTo
5627
5650
  AA.clearAndUpdateOrder(sA), showAndSetTimeOutClose(AA, timeToCloseNotification);
5628
5651
  }
5629
5652
  });
5653
+ }, openDialog = (X) => {
5654
+ X.showCloseButton = "showCloseButton" in X ? X.showCloseButton : !0, buildDialogComponent(X);
5630
5655
  };
5631
5656
  var __defProp$m = Object.defineProperty, __decorateClass$m = (X, W, J, AA) => {
5632
5657
  for (var eA = void 0, tA = X.length - 1, sA; tA >= 0; tA--)
@@ -5641,21 +5666,24 @@ const ConfirmMixin = d$3((X) => {
5641
5666
  canAccept() {
5642
5667
  return Promise.resolve(!0);
5643
5668
  }
5644
- accept() {
5645
- return Promise.resolve();
5669
+ accept(AA) {
5670
+ return Promise.resolve(AA);
5646
5671
  }
5647
5672
  }
5648
5673
  return __decorateClass$m([
5649
5674
  n$9()
5650
- ], W.prototype, "model"), W;
5675
+ ], W.prototype, "model"), __decorateClass$m([
5676
+ n$9()
5677
+ ], W.prototype, "outputModel"), W;
5651
5678
  });
5652
5679
  function confirmMixin(X) {
5653
5680
  return ConfirmMixin(X);
5654
5681
  }
5655
5682
  const createInteractionManager = () => ({
5656
5683
  notify: (X) => notify(X),
5657
- doConfirm: (X) => doConfirm(X),
5658
- doCustomConfirm: (X) => doConfirm(X)
5684
+ confirm: (X) => confirm(X),
5685
+ customConfirm: (X) => confirm(X),
5686
+ openDialog: (X) => openDialog(X)
5659
5687
  });
5660
5688
  function _concat(X, W) {
5661
5689
  X = X || [], W = W || [];
@@ -7597,7 +7625,26 @@ class TokenManagerSimulator {
7597
7625
  }
7598
7626
  const tokenManager$1 = new TokenManagerSimulator();
7599
7627
  tokenManager$1.initToken();
7600
- const createTokenManager = () => tokenManager$1, broker$1 = createBroker(), regionManager = u$2("primaria"), PrimariaRegionHost = l$2(regionManager), tokenManager = createTokenManager(), globalStateManager = createGlobalStateManager(broker$1), primariaApiFactory = (X) => ({
7628
+ const createTokenManager = () => tokenManager$1;
7629
+ class EcapEventManager {
7630
+ }
7631
+ class EcapEventManagerImpl {
7632
+ publish(W, J, AA) {
7633
+ const eA = this.createEcapEvent(W, J, AA);
7634
+ this.raiseEcapEvent(eA);
7635
+ }
7636
+ createEcapEvent(W, J, AA) {
7637
+ return {
7638
+ event: W,
7639
+ eventType: J,
7640
+ url: AA
7641
+ };
7642
+ }
7643
+ raiseEcapEvent(W) {
7644
+ window.parent && window.parent.postMessage(JSON.stringify(W), "*"), console.log("metod", JSON.stringify(W));
7645
+ }
7646
+ }
7647
+ const ecapEventManager = new EcapEventManagerImpl(), createEcapEventManager = () => ecapEventManager, broker$1 = createBroker(), regionManager = u$2("primaria"), PrimariaRegionHost = l$2(regionManager), tokenManager = createTokenManager(), globalStateManager = createGlobalStateManager(broker$1), primariaApiFactory = (X) => ({
7601
7648
  pluginInfo: X,
7602
7649
  regionManager: createRegionManagerProxy(X, regionManager),
7603
7650
  httpClient: createHttpClient(tokenManager),
@@ -7605,7 +7652,8 @@ const createTokenManager = () => tokenManager$1, broker$1 = createBroker(), regi
7605
7652
  broker: broker$1,
7606
7653
  createLocaleManager: createLocaleManager(X.pluginId),
7607
7654
  globalStateManager,
7608
- tokenManager
7655
+ tokenManager,
7656
+ ecapEventManager: createEcapEventManager()
7609
7657
  }), shellApi = primariaApiFactory({ pluginId: "primaria-shell" });
7610
7658
  var __defProp$l = Object.defineProperty, __getOwnPropDesc$l = Object.getOwnPropertyDescriptor, __decorateClass$l = (X, W, J, AA) => {
7611
7659
  for (var eA = AA > 1 ? void 0 : AA ? __getOwnPropDesc$l(W, J) : W, tA = X.length - 1, sA; tA >= 0; tA--)
@@ -37166,14 +37214,7 @@ let PocEventsEcap = class extends h$4 {
37166
37214
  goToLinkOnEcap(X, W) {
37167
37215
  var eA, tA, sA, iA;
37168
37216
  const J = X || ((tA = (eA = this.shadowRoot) == null ? void 0 : eA.getElementById("url")) == null ? void 0 : tA.value), AA = W || ((iA = (sA = this.shadowRoot) == null ? void 0 : sA.getElementById("accio")) == null ? void 0 : iA.value);
37169
- if (window.parent) {
37170
- const oA = {
37171
- TipusEvent: "URL_EXTERNA",
37172
- Accio: AA,
37173
- URL_LLAMADA: J
37174
- };
37175
- console.log(JSON.stringify(oA)), window.parent.postMessage(JSON.stringify(oA), "*");
37176
- }
37217
+ shellApi.ecapEventManager.publish(AA, "URL_EXTERNA", J);
37177
37218
  }
37178
37219
  };
37179
37220
  PocEventsEcap.styles = i$8`
@@ -38941,11 +38982,10 @@ const template$4 = (X) => ke$1`<div class="container" ?maximized=${X.maximized}>
38941
38982
  ${X.maximized ? ke$1`${headerMaximizedTemplate(X)}` : ke$1`<div class="header">
38942
38983
  <div class="header__left">
38943
38984
  <div class="title">${translate("activityHistory")}</div>
38944
- <input type="text" placeholder="Escriu per cercar" @input=${X._handleSearch}>
38945
- <!-- <dss-search-bar icon="search" inputsize="md" threshold="3" recentsearchestext="" emptydropdowntext="Sense resultats per">
38985
+ <dss-search-bar @onSearchChange=${X._handleSearchChange} icon="search" inputsize="md" threshold="2" recentsearchestext="" emptydropdowntext="">
38946
38986
  <label slot="label" for="searchbar1" aria-hidden="false"></label>
38947
38987
  <input slot="input" id="searchbar1" type="text">
38948
- </dss-search-bar> -->
38988
+ </dss-search-bar>
38949
38989
  <dss-datepicker inputsize="md" class="date-picker">
38950
38990
  <label slot="label" for="myDatepicker">${translate("goToDate")}</label>
38951
38991
  <input slot="input" id="myDatepicker" type="text" class="dss-input">
@@ -39042,16 +39082,17 @@ let ActivityHistory = class extends PrimariaRegionHost(h$4) {
39042
39082
  return ke$1`${template$4(this)}`;
39043
39083
  }
39044
39084
  connectedCallback() {
39085
+ var W;
39045
39086
  super.connectedCallback(), this.api.broker.subscribe(shellEvents.openClinicalMonitoringRequested, () => {
39046
39087
  this.maximized = !1;
39047
39088
  });
39089
+ const X = (W = this.shadowRoot) == null ? void 0 : W.querySelector("dss-search-bar");
39090
+ X && X.addEventListener("onSearchChange", this._handleSearchChange);
39048
39091
  }
39049
39092
  firstUpdated(X) {
39050
- var W, J;
39051
- super.firstUpdated(X), (W = this.shadowRoot.querySelector("dss-datepicker")) == null || W.addEventListener("onValueChange", (AA) => {
39052
- this._handleSelectDate(AA.detail);
39053
- }), (J = this.shadowRoot.querySelector("dss-search-bar")) == null || J.addEventListener("onSearchChange", (AA) => {
39054
- this._handleSearch(AA.detail);
39093
+ var W;
39094
+ super.firstUpdated(X), (W = this.shadowRoot.querySelector("dss-datepicker")) == null || W.addEventListener("onValueChange", (J) => {
39095
+ this._handleSelectDate(J.detail);
39055
39096
  });
39056
39097
  }
39057
39098
  toggleMenu() {
@@ -39066,8 +39107,9 @@ let ActivityHistory = class extends PrimariaRegionHost(h$4) {
39066
39107
  _minimize() {
39067
39108
  this.maximized = !1;
39068
39109
  }
39069
- _handleSearch(X) {
39070
- this.api.broker.send(new SearchActivityHistoryItems((X == null ? void 0 : X.length) > 2 ? X : ""));
39110
+ _handleSearchChange(X) {
39111
+ const W = X.detail || [], J = W.length > 0 ? W.join(" ") : "";
39112
+ console.log(J), J.length > 2 ? this.api.broker.send(new SearchActivityHistoryItems(J)) : console.log("query too short");
39071
39113
  }
39072
39114
  _handleSelectDate(X) {
39073
39115
  this.selectedDate = parse(X, "dd/MM/yyyy", /* @__PURE__ */ new Date()), this.scrollToClosestDate();
@@ -39243,11 +39285,10 @@ let ExportToPdfHandler = class {
39243
39285
  }
39244
39286
  async handle() {
39245
39287
  try {
39246
- this.api.interactionManager.doCustomConfirm({
39288
+ this.api.interactionManager.customConfirm({
39247
39289
  title: "Exportar a PDF",
39248
39290
  componentConstructor: ExportPdfModal,
39249
39291
  type: "info",
39250
- modal: !0,
39251
39292
  cancelLabel: "Cancel·lar",
39252
39293
  acceptLabel: "Exportar"
39253
39294
  });
@@ -47360,11 +47401,13 @@ class ReactWebComponent extends HTMLElement {
47360
47401
  customElements.define("ux-react-web-component", ReactWebComponent);
47361
47402
  const wrapReactViewFactory = (X, W) => () => Promise.resolve(new ReactWebComponent(X, W));
47362
47403
  export {
47404
+ EcapEventManager,
47363
47405
  PrimariaMenuItem,
47364
47406
  PrimariaRegionHost,
47365
47407
  bootstrapPlugins,
47366
47408
  clinicalMonitoringRegions,
47367
47409
  confirmMixin,
47410
+ createEcapEventManager,
47368
47411
  initializeShell,
47369
47412
  primariaApiFactory,
47370
47413
  shellApi,