@everchron/ec-shards 19.11.5 → 19.11.6

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.
package/dist/ec-shards.js CHANGED
@@ -3381,6 +3381,10 @@ var Vr = /*#__PURE__*/ V(zr, [["render", Br], ["__scopeId", "data-v-2f0cb806"]])
3381
3381
  },
3382
3382
  icon: String,
3383
3383
  badgeIcon: String,
3384
+ badge: {
3385
+ type: [Boolean, Object],
3386
+ default: !1
3387
+ },
3384
3388
  active: Boolean,
3385
3389
  highlighted: Boolean,
3386
3390
  loading: Boolean,
@@ -3422,6 +3426,75 @@ var Vr = /*#__PURE__*/ V(zr, [["render", Br], ["__scopeId", "data-v-2f0cb806"]])
3422
3426
  },
3423
3427
  badgeIconSize() {
3424
3428
  return this.size == "xsml" ? "8" : this.size == "sml" ? "10" : this.size == "md" ? "12" : this.size == "lg" ? "14" : "12";
3429
+ },
3430
+ badgeSize() {
3431
+ return this.size == "xsml" ? 4 : this.size == "sml" || this.size == "md" ? 6 : this.size == "lg" ? 8 : 6;
3432
+ },
3433
+ badgePosition() {
3434
+ let e = this.size || "md";
3435
+ return !this.iconOnly && this.icon ? {
3436
+ xsml: {
3437
+ top: 2,
3438
+ left: 12
3439
+ },
3440
+ sml: {
3441
+ top: 4,
3442
+ left: 14
3443
+ },
3444
+ md: {
3445
+ top: 6,
3446
+ left: 18
3447
+ },
3448
+ lg: {
3449
+ top: 8,
3450
+ left: 26
3451
+ }
3452
+ }[e] : this.iconOnly ? {
3453
+ xsml: {
3454
+ top: 1,
3455
+ right: 1
3456
+ },
3457
+ sml: {
3458
+ top: 4,
3459
+ right: 4
3460
+ },
3461
+ md: {
3462
+ top: 6,
3463
+ right: 6
3464
+ },
3465
+ lg: {
3466
+ top: 8,
3467
+ right: 8
3468
+ }
3469
+ }[e] : {
3470
+ xsml: {
3471
+ top: 1,
3472
+ right: 1
3473
+ },
3474
+ sml: {
3475
+ top: 1,
3476
+ right: 1
3477
+ },
3478
+ md: {
3479
+ top: 1,
3480
+ right: 1
3481
+ },
3482
+ lg: {
3483
+ top: 4,
3484
+ right: 4
3485
+ }
3486
+ }[e];
3487
+ },
3488
+ badgeStyle() {
3489
+ let e = `${this.badgeSize}px`, t = {
3490
+ width: e,
3491
+ height: e
3492
+ }, { top: n, left: r, right: i } = this.badgePosition;
3493
+ if (t.top = `${n}px`, r != null && (t.left = `${r}px`), i != null && (t.right = `${i}px`), this.badge && typeof this.badge == "object") {
3494
+ let { positionTop: e, positionRight: n, positionLeft: r, color: i } = this.badge;
3495
+ e != null && (t.top = e), r != null && (t.left = r, t.right = "auto"), n != null && (t.right = n, t.left = "auto"), i != null && (t.background = i);
3496
+ }
3497
+ return t;
3425
3498
  }
3426
3499
  },
3427
3500
  mounted() {
@@ -3481,6 +3554,11 @@ function Xr(e, t, n, r, i, a) {
3481
3554
  }, null, 8, ["type", "size"])) : s("", !0),
3482
3555
  n.iconOnly ? s("", !0) : k(e.$slots, "default", { key: 2 }, void 0, !0),
3483
3556
  n.shortcut && !n.iconOnly ? (T(), c("span", Kr, N(n.shortcut), 1)) : s("", !0),
3557
+ n.badge ? (T(), c("div", {
3558
+ key: 4,
3559
+ class: "badge",
3560
+ style: S(a.badgeStyle)
3561
+ }, null, 4)) : s("", !0),
3484
3562
  f(d, {
3485
3563
  inset: n.focusInset,
3486
3564
  danger: n.type == "danger" || n.type == "danger-vibrant"
@@ -3543,13 +3621,18 @@ function Xr(e, t, n, r, i, a) {
3543
3621
  }, null, 8, ["type", "size"])) : s("", !0),
3544
3622
  n.iconOnly ? s("", !0) : k(e.$slots, "default", { key: 2 }, void 0, !0),
3545
3623
  n.shortcut && !n.iconOnly ? (T(), c("span", Jr, N(n.shortcut), 1)) : s("", !0),
3624
+ n.badge ? (T(), c("div", {
3625
+ key: 4,
3626
+ class: "badge",
3627
+ style: S(a.badgeStyle)
3628
+ }, null, 4)) : s("", !0),
3546
3629
  f(d, {
3547
3630
  inset: n.focusInset,
3548
3631
  danger: n.type == "danger" || n.type == "danger-vibrant"
3549
3632
  }, null, 8, ["inset", "danger"])
3550
3633
  ], 42, qr));
3551
3634
  }
3552
- var X = /*#__PURE__*/ V(Wr, [["render", Xr], ["__scopeId", "data-v-b7e356a6"]]), Zr = {
3635
+ var X = /*#__PURE__*/ V(Wr, [["render", Xr], ["__scopeId", "data-v-c54b96de"]]), Zr = {
3553
3636
  name: "ecs-popover-list-item",
3554
3637
  emits: [
3555
3638
  "click",
@@ -13281,7 +13364,7 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13281
13364
  name: "ecs-inline-edit",
13282
13365
  emits: [
13283
13366
  "save",
13284
- "cancel",
13367
+ "undo",
13285
13368
  "edit",
13286
13369
  "update:editing"
13287
13370
  ],
@@ -13311,6 +13394,10 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13311
13394
  type: Boolean,
13312
13395
  default: !1
13313
13396
  },
13397
+ modified: {
13398
+ type: Boolean,
13399
+ default: !1
13400
+ },
13314
13401
  triggerOnClick: {
13315
13402
  type: Boolean,
13316
13403
  default: !0
@@ -13319,15 +13406,6 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13319
13406
  type: Boolean,
13320
13407
  default: !0
13321
13408
  },
13322
- clickOutside: {
13323
- type: String,
13324
- default: "cancel",
13325
- validator: (e) => [
13326
- "cancel",
13327
- "save",
13328
- "none"
13329
- ].includes(e)
13330
- },
13331
13409
  align: {
13332
13410
  type: String,
13333
13411
  default: "right",
@@ -13345,6 +13423,9 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13345
13423
  actionsLabel() {
13346
13424
  return "Edit actions";
13347
13425
  },
13426
+ showActions() {
13427
+ return this.isEditing && this.modified;
13428
+ },
13348
13429
  popperPlacement() {
13349
13430
  return this.align === "left" ? "bottom-start" : "bottom-end";
13350
13431
  }
@@ -13353,7 +13434,7 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13353
13434
  editing(e) {
13354
13435
  this.isEditing = e;
13355
13436
  },
13356
- isEditing(e) {
13437
+ showActions(e) {
13357
13438
  e ? this.$nextTick(() => this.createActionsPopper()) : this.destroyActionsPopper();
13358
13439
  },
13359
13440
  align() {
@@ -13362,7 +13443,7 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13362
13443
  },
13363
13444
  mounted() {
13364
13445
  this.isEditing && this.$nextTick(() => {
13365
- this.createActionsPopper(), this.focusFirstEditable();
13446
+ this.showActions && this.createActionsPopper(), this.focusFirstEditable();
13366
13447
  });
13367
13448
  },
13368
13449
  beforeUnmount() {
@@ -13377,11 +13458,11 @@ var $p = /*#__PURE__*/ V(Zp, [["render", Qp], ["__scopeId", "data-v-f66945cb"]])
13377
13458
  this.setEditing(!1);
13378
13459
  }, this.saveDelay)));
13379
13460
  },
13380
- cancel() {
13381
- this.disabled || (this.clearCloseTimeout(), this.$emit("cancel"), this.setEditing(!1));
13461
+ undo() {
13462
+ this.disabled || this.$emit("undo");
13382
13463
  },
13383
13464
  onClickOutside(e) {
13384
- !this.isEditing || this.disabled || this.loading || this.$refs.actionsEl && this.$refs.actionsEl.contains(e?.target) || (this.clickOutside === "cancel" ? this.cancel() : this.clickOutside === "save" && this.confirm());
13465
+ !this.isEditing || this.disabled || this.loading || this.$refs.actionsEl && this.$refs.actionsEl.contains(e?.target) || this.confirm();
13385
13466
  },
13386
13467
  setEditing(e) {
13387
13468
  this.isEditing = e, this.$emit("update:editing", e);
@@ -13435,7 +13516,7 @@ function im(e, n, i, a, u, d) {
13435
13516
  default: I(() => [u.isEditing ? (T(), c("div", {
13436
13517
  key: "edit",
13437
13518
  class: "ecs-inline-edit-edit",
13438
- onKeydown: n[0] ||= L(R((...e) => d.cancel && d.cancel(...e), ["stop"]), ["esc"])
13519
+ onKeydown: n[0] ||= L(R((...e) => d.undo && d.undo(...e), ["stop"]), ["esc"])
13439
13520
  }, [l("div", nm, [k(e.$slots, "edit", {}, void 0, !0)], 512)], 32)) : (T(), o(p, {
13440
13521
  key: "view",
13441
13522
  class: "ecs-inline-edit-view",
@@ -13452,39 +13533,24 @@ function im(e, n, i, a, u, d) {
13452
13533
  "onKeydown"
13453
13534
  ]))]),
13454
13535
  _: 3
13455
- }, 8, ["onAfterEnter"]), (T(), o(t, { to: "body" }, [u.isEditing ? (T(), c("div", {
13536
+ }, 8, ["onAfterEnter"]), (T(), o(t, { to: "body" }, [d.showActions ? (T(), c("div", {
13456
13537
  key: 0,
13457
13538
  ref: "actionsEl",
13458
13539
  class: "ecs-inline-edit-actions",
13459
13540
  role: "group",
13460
- "aria-label": d.actionsLabel,
13461
- onKeydown: n[1] ||= L(R((...e) => d.cancel && d.cancel(...e), ["stop"]), ["esc"])
13541
+ "aria-label": d.actionsLabel
13462
13542
  }, [f(m, {
13463
- onClick: d.confirm,
13543
+ onClick: R(d.undo, ["stop"]),
13464
13544
  type: "secondary",
13465
13545
  size: "sml",
13466
- icon: "check",
13546
+ icon: "undo",
13467
13547
  "icon-only": "",
13468
- loading: i.loading,
13469
13548
  disabled: i.disabled,
13470
- title: "Save",
13471
- "aria-label": "Save changes"
13472
- }, null, 8, [
13473
- "onClick",
13474
- "loading",
13475
- "disabled"
13476
- ]), f(m, {
13477
- onClick: R(d.cancel, ["stop"]),
13478
- type: "secondary",
13479
- size: "sml",
13480
- icon: "close",
13481
- "icon-only": "",
13482
- disabled: i.loading || i.disabled,
13483
- title: "Cancel",
13484
- "aria-label": "Revert changes"
13485
- }, null, 8, ["onClick", "disabled"])], 40, rm)) : s("", !0)]))], 2)), [[h, d.onClickOutside]]);
13549
+ title: "Undo",
13550
+ "aria-label": "Undo changes"
13551
+ }, null, 8, ["onClick", "disabled"])], 8, rm)) : s("", !0)]))], 2)), [[h, d.onClickOutside]]);
13486
13552
  }
13487
- var am = /*#__PURE__*/ V(tm, [["render", im], ["__scopeId", "data-v-ecc56dd7"]]), om = {
13553
+ var am = /*#__PURE__*/ V(tm, [["render", im], ["__scopeId", "data-v-00fa7dec"]]), om = {
13488
13554
  name: "ecs-input-group-addon",
13489
13555
  components: { EcsIcon: H },
13490
13556
  props: {