@uxland/primary-shell 3.2.7 → 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 (25) hide show
  1. package/dist/index.js +58 -38
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.umd.cjs +16 -17
  4. package/dist/index.umd.cjs.map +1 -1
  5. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/components/dialog-component.d.ts +3 -4
  6. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm-mixin.d.ts +4 -9
  7. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/confirm.d.ts +2 -2
  8. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/index.d.ts +1 -0
  9. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/open-dialog.d.ts +3 -0
  10. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/shared.d.ts +3 -0
  11. package/dist/primary/shell/src/UI/shared-components/primaria-interaction/typings.d.ts +11 -2
  12. package/dist/primary/shell/src/api/interaction-manager/interaction.d.ts +5 -4
  13. package/dist/primary/shell/src/index.d.ts +1 -1
  14. package/package.json +1 -1
  15. package/src/UI/shared-components/primaria-interaction/components/dialog-component-styles.css +5 -2
  16. package/src/UI/shared-components/primaria-interaction/components/dialog-component.ts +47 -37
  17. package/src/UI/shared-components/primaria-interaction/confirm-mixin.ts +9 -13
  18. package/src/UI/shared-components/primaria-interaction/confirm.ts +5 -26
  19. package/src/UI/shared-components/primaria-interaction/index.ts +1 -0
  20. package/src/UI/shared-components/primaria-interaction/open-dialog.ts +8 -0
  21. package/src/UI/shared-components/primaria-interaction/shared.ts +29 -0
  22. package/src/UI/shared-components/primaria-interaction/typings.ts +13 -2
  23. package/src/api/interaction-manager/interaction.ts +11 -6
  24. package/src/index.ts +1 -4
  25. package/src/internal-plugins/activity-history/features/export-to-pdf/handler.ts +1 -2
package/dist/index.js CHANGED
@@ -5404,7 +5404,16 @@ const createAxiosInstance = (X) => {
5404
5404
  ), W;
5405
5405
  };
5406
5406
  let instance;
5407
- 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}}";
5408
5417
  var __defProp$o = Object.defineProperty, __getOwnPropDesc$n = Object.getOwnPropertyDescriptor, __decorateClass$o = (X, W, J, AA) => {
5409
5418
  for (var eA = AA > 1 ? void 0 : AA ? __getOwnPropDesc$n(W, J) : W, tA = X.length - 1, sA; tA >= 0; tA--)
5410
5419
  (sA = X[tA]) && (eA = (AA ? sA(W, J, eA) : sA(eA)) || eA);
@@ -5421,31 +5430,38 @@ const dssToConfirmTypeClass = (X) => X === "danger" ? "dss-button--error" : `dss
5421
5430
  </div>
5422
5431
  `;
5423
5432
  }, renderMessage = (X) => ke$1` <div id="message">${X.message || ""}</div> `;
5424
- function renderCustomContent(X, W) {
5425
- if (X.componentConstructor) {
5426
- const J = new X.componentConstructor();
5427
- 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}`;
5428
5437
  }
5429
5438
  return D$1;
5430
5439
  }
5431
- let DialogComponent = class extends h$4 {
5432
- render() {
5433
- return ke$1`
5434
- <div
5435
- class="modal"
5436
- @click=${(X) => X.target === this.modal && !this.options.modal && this.close(!1)}
5437
- >
5438
- <div
5439
- class="dialog"
5440
- >
5441
- ${this.options.fullCustomization ? renderCustomContent(this.options, this) : ke$1`<div class="dialog__header ${this.options.type}">
5442
- <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
+ )}
5443
5449
  </div>
5444
5450
  <div class="dialog__content">
5445
- ${this.options.message ? renderMessage(this.options) : renderCustomContent(this.options, this)}
5451
+ ${nn(
5452
+ X.options.message,
5453
+ () => renderMessage(X.options),
5454
+ () => renderCustomContent(X)
5455
+ )}
5446
5456
  </div>
5447
- ${renderActions(this)}`}
5448
-
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)}
5449
5465
  </div>
5450
5466
  </div>
5451
5467
  `;
@@ -5456,23 +5472,23 @@ let DialogComponent = class extends h$4 {
5456
5472
  `;
5457
5473
  }
5458
5474
  _cancel(X) {
5459
- console.log("canceling modal"), this.close(!1);
5475
+ this.close({ confirmed: !1 });
5460
5476
  }
5461
5477
  _accept(X) {
5462
- console.log("accepting modal"), this.close(!0);
5478
+ this.close({ confirmed: !0 });
5463
5479
  }
5464
5480
  componentCloseRequest(X) {
5465
5481
  this.close(X.detail);
5466
5482
  }
5467
5483
  async close(X) {
5468
- if (X) {
5469
- const W = this.getCustomComponent();
5470
- if (W != null && W.canAccept) {
5471
- if (!await W.canAccept()) return;
5472
- W.accept && await W.accept();
5473
- }
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));
5474
5490
  }
5475
- 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";
5476
5492
  }
5477
5493
  getCustomComponent() {
5478
5494
  var X;
@@ -5503,7 +5519,7 @@ __decorateClass$o([
5503
5519
  DialogComponent = __decorateClass$o([
5504
5520
  t$6("dialog-component")
5505
5521
  ], DialogComponent);
5506
- const doConfirm = async (X) => {
5522
+ const buildDialogComponent = (X) => {
5507
5523
  if (!X.message && !X.componentConstructor)
5508
5524
  throw new Error("message, componentConstructor options properties are required");
5509
5525
  return new Promise((W) => {
@@ -5519,7 +5535,7 @@ const doConfirm = async (X) => {
5519
5535
  J.remove(), W(tA.detail);
5520
5536
  }
5521
5537
  });
5522
- };
5538
+ }, confirm = async (X) => buildDialogComponent(X);
5523
5539
  /**
5524
5540
  * @license
5525
5541
  * Copyright 2018 Google LLC
@@ -5634,6 +5650,8 @@ const notificationStack = [], displayNotifications = [], stackLimit = 10, timeTo
5634
5650
  AA.clearAndUpdateOrder(sA), showAndSetTimeOutClose(AA, timeToCloseNotification);
5635
5651
  }
5636
5652
  });
5653
+ }, openDialog = (X) => {
5654
+ X.showCloseButton = "showCloseButton" in X ? X.showCloseButton : !0, buildDialogComponent(X);
5637
5655
  };
5638
5656
  var __defProp$m = Object.defineProperty, __decorateClass$m = (X, W, J, AA) => {
5639
5657
  for (var eA = void 0, tA = X.length - 1, sA; tA >= 0; tA--)
@@ -5648,21 +5666,24 @@ const ConfirmMixin = d$3((X) => {
5648
5666
  canAccept() {
5649
5667
  return Promise.resolve(!0);
5650
5668
  }
5651
- accept() {
5652
- return Promise.resolve();
5669
+ accept(AA) {
5670
+ return Promise.resolve(AA);
5653
5671
  }
5654
5672
  }
5655
5673
  return __decorateClass$m([
5656
5674
  n$9()
5657
- ], W.prototype, "model"), W;
5675
+ ], W.prototype, "model"), __decorateClass$m([
5676
+ n$9()
5677
+ ], W.prototype, "outputModel"), W;
5658
5678
  });
5659
5679
  function confirmMixin(X) {
5660
5680
  return ConfirmMixin(X);
5661
5681
  }
5662
5682
  const createInteractionManager = () => ({
5663
5683
  notify: (X) => notify(X),
5664
- doConfirm: (X) => doConfirm(X),
5665
- doCustomConfirm: (X) => doConfirm(X)
5684
+ confirm: (X) => confirm(X),
5685
+ customConfirm: (X) => confirm(X),
5686
+ openDialog: (X) => openDialog(X)
5666
5687
  });
5667
5688
  function _concat(X, W) {
5668
5689
  X = X || [], W = W || [];
@@ -39264,11 +39285,10 @@ let ExportToPdfHandler = class {
39264
39285
  }
39265
39286
  async handle() {
39266
39287
  try {
39267
- this.api.interactionManager.doCustomConfirm({
39288
+ this.api.interactionManager.customConfirm({
39268
39289
  title: "Exportar a PDF",
39269
39290
  componentConstructor: ExportPdfModal,
39270
39291
  type: "info",
39271
- modal: !0,
39272
39292
  cancelLabel: "Cancel·lar",
39273
39293
  acceptLabel: "Exportar"
39274
39294
  });