@oicl/openbridge-webcomponents 2.1.0-next.1 → 2.1.0-next.3

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 (59) hide show
  1. package/README.md +1 -0
  2. package/bundle/openbridge-webcomponents.bundle.js +390 -301
  3. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  4. package/custom-elements.json +979 -94
  5. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts +25 -1
  6. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.d.ts.map +1 -1
  7. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js +39 -58
  8. package/dist/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.js.map +1 -1
  9. package/dist/building-blocks/alert-list/alert-list-base.d.ts +60 -0
  10. package/dist/building-blocks/alert-list/alert-list-base.d.ts.map +1 -0
  11. package/dist/building-blocks/alert-list/alert-list-base.js +191 -0
  12. package/dist/building-blocks/alert-list/alert-list-base.js.map +1 -0
  13. package/dist/building-blocks/alert-list/alert-list.css.js.map +1 -1
  14. package/dist/building-blocks/alert-list/alert-list.d.ts +13 -26
  15. package/dist/building-blocks/alert-list/alert-list.d.ts.map +1 -1
  16. package/dist/building-blocks/alert-list/alert-list.js +7 -142
  17. package/dist/building-blocks/alert-list/alert-list.js.map +1 -1
  18. package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
  19. package/dist/components/alert-icon/alert-icon.js +6 -5
  20. package/dist/components/alert-icon/alert-icon.js.map +1 -1
  21. package/dist/components/alert-list-details/alert-list-details.css.js +4 -1
  22. package/dist/components/alert-list-details/alert-list-details.css.js.map +1 -1
  23. package/dist/components/alert-menu/alert-menu.css.js +3 -42
  24. package/dist/components/alert-menu/alert-menu.css.js.map +1 -1
  25. package/dist/components/alert-menu/alert-menu.d.ts +28 -6
  26. package/dist/components/alert-menu/alert-menu.d.ts.map +1 -1
  27. package/dist/components/alert-menu/alert-menu.js +81 -60
  28. package/dist/components/alert-menu/alert-menu.js.map +1 -1
  29. package/dist/components/alert-menu-item/alert-menu-item.d.ts +16 -6
  30. package/dist/components/alert-menu-item/alert-menu-item.d.ts.map +1 -1
  31. package/dist/components/alert-menu-item/alert-menu-item.js +11 -2
  32. package/dist/components/alert-menu-item/alert-menu-item.js.map +1 -1
  33. package/dist/components/number-input-field/number-input-field.css.js +8 -2
  34. package/dist/components/number-input-field/number-input-field.css.js.map +1 -1
  35. package/dist/components/number-input-field/number-input-field.d.ts +15 -1
  36. package/dist/components/number-input-field/number-input-field.d.ts.map +1 -1
  37. package/dist/components/number-input-field/number-input-field.js +38 -44
  38. package/dist/components/number-input-field/number-input-field.js.map +1 -1
  39. package/dist/components/textbox/textbox.css.js +3 -9
  40. package/dist/components/textbox/textbox.css.js.map +1 -1
  41. package/dist/components/textbox/textbox.d.ts +3 -0
  42. package/dist/components/textbox/textbox.d.ts.map +1 -1
  43. package/dist/components/textbox/textbox.js.map +1 -1
  44. package/dist/generated/locales/es-419.d.ts +1 -1
  45. package/dist/generated/locales/es-419.js +1 -1
  46. package/dist/generated/locales/es-419.js.map +1 -1
  47. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js +2 -1
  48. package/dist/navigation-instruments/readout-list-item/readout-list-item.css.js.map +1 -1
  49. package/dist/pages/alert-detail-page/alert-detail-page.js +1 -1
  50. package/dist/pages/alert-detail-page/alert-detail-page.js.map +1 -1
  51. package/dist/pages/alert-list-page-small/alert-list-page-small-base.d.ts +63 -0
  52. package/dist/pages/alert-list-page-small/alert-list-page-small-base.d.ts.map +1 -0
  53. package/dist/pages/alert-list-page-small/alert-list-page-small-base.js +126 -0
  54. package/dist/pages/alert-list-page-small/alert-list-page-small-base.js.map +1 -0
  55. package/dist/pages/alert-list-page-small/alert-list-page-small.d.ts +12 -15
  56. package/dist/pages/alert-list-page-small/alert-list-page-small.d.ts.map +1 -1
  57. package/dist/pages/alert-list-page-small/alert-list-page-small.js +41 -92
  58. package/dist/pages/alert-list-page-small/alert-list-page-small.js.map +1 -1
  59. package/package.json +1 -1
@@ -12949,6 +12949,13 @@ __decorate([n$4({ type: Boolean })], ObiTwowayAnalogClosed.prototype, "useCssCol
12949
12949
  ObiTwowayAnalogClosed = __decorate([customElement("obi-twoway-analog-closed")], ObiTwowayAnalogClosed);
12950
12950
  //#endregion
12951
12951
  //#region src/automation/valve-analoge-two-way-icon/valve-analog-two-way-icon.ts
12952
+ var OUTLINE = "M11 11L3.5547 6.03645C2.89015 5.59342 2 6.06981 2 6.8685V19.1315C2 19.9302 2.89015 20.4066 3.5547 19.9635L11 15H13L20.4453 19.9635C21.1099 20.4066 22 19.9302 22 19.1315V6.8685C22 6.06981 21.1099 5.59342 20.4453 6.03645L13 11H11ZM3 6.8685L3 19.1315L10.6972 14H13.3028L21 19.1315V6.8685L13.3028 12H10.6972L3 6.8685Z";
12953
+ var BODY = "M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z";
12954
+ /** Width of the shut band at each port end when the opening is 0 %, in icon units. */
12955
+ var BAND_RANGE = 7;
12956
+ var SECONDARY = "fill: var(--automation-device-secondary-color)";
12957
+ var TERTIARY = "fill: var(--automation-device-tertiary-color)";
12958
+ var PRIMARY = "fill: var(--automation-device-primary-color)";
12952
12959
  var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends i$4 {
12953
12960
  constructor(..._args) {
12954
12961
  super(..._args);
@@ -12956,21 +12963,37 @@ var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends i$4 {
12956
12963
  this.closed = false;
12957
12964
  this.vertical = false;
12958
12965
  }
12966
+ renderBands(width) {
12967
+ if (width <= 0) return null;
12968
+ const left = 3 + width;
12969
+ const right = 21 - width;
12970
+ return w`<g clip-path="url(#body)">
12971
+ <rect x="2" y="0" width=${left - 2} height="24" style=${SECONDARY}/>
12972
+ <rect x=${left} y="0" width="1" height="24" style=${TERTIARY}/>
12973
+ <rect x=${right} y="0" width=${22 - right} height="24" style=${SECONDARY}/>
12974
+ <rect x=${right - 1} y="0" width="1" height="24" style=${TERTIARY}/>
12975
+ </g>`;
12976
+ }
12977
+ /**
12978
+ * Horizontal at the top when open, turning to vertical and moving 2 units
12979
+ * down as the valve shuts, matching `obi-twoway-analog-open` at 100 %.
12980
+ */
12981
+ renderHandle(value) {
12982
+ const shut = 1 - value / 100;
12983
+ const angle = -90 * shut;
12984
+ const cx = 12;
12985
+ const cy = 3.5 + 2 * shut;
12986
+ return w`<g transform="rotate(${angle} ${cx} ${cy})">
12987
+ <rect x=${8} y=${cy - 1.5} width="8" height="3" rx="1.5" style=${TERTIARY}/>
12988
+ <rect x=${9} y=${cy - .5} width="6" height="1" rx="0.5" style=${PRIMARY}/>
12989
+ </g>`;
12990
+ }
12959
12991
  render() {
12960
12992
  const transform = this.vertical ? "transform: rotate(90deg);" : "";
12961
12993
  if (this.closed) return b` <div class="wrapper" style="${transform}">
12962
12994
  <obi-twoway-analog-closed useCssColor> </obi-twoway-analog-closed>
12963
12995
  </div>`;
12964
- const handleRotation = -(1 - this.value / 100) * 90;
12965
- const handle = w`
12966
- <g transform="translate(0, ${(1 - this.value / 100) * 2}) rotate(${handleRotation} 12 3.5) ">
12967
- <path fill-rule="evenodd" clip-rule="evenodd" d="M9.5 5H14.5C15.3284 5 16 4.32843 16 3.5C16 2.67157 15.3284 2 14.5 2H9.5C8.67157 2 8 2.67157 8 3.5C8 4.32843 8.67157 5 9.5 5ZM9.5 4L14.5 4C14.7761 4 15 3.77614 15 3.5C15 3.22386 14.7761 3 14.5 3L9.5 3C9.22386 3 9 3.22386 9 3.5C9 3.77614 9.22386 4 9.5 4Z" fill="var(--automation-device-tertiary-color)"/>
12968
- <path d="M9.5 4L14.5 4C14.7761 4 15 3.77614 15 3.5C15 3.22386 14.7761 3 14.5 3L9.5 3C9.22386 3 9 3.22386 9 3.5C9 3.77614 9.22386 4 9.5 4Z" fill="var(--automation-device-primary-color)"/>
12969
- </g>
12970
- `;
12971
- const xmin = 10.5;
12972
- const xmax = 2.5;
12973
- const x = xmin + -8 * this.value / 100;
12996
+ const value = clampPercent$1(this.value);
12974
12997
  return b`
12975
12998
  <div class="wrapper" style="${transform}">
12976
12999
  <svg
@@ -12980,55 +13003,13 @@ var ObcValveAnalogTwoWayIcon = class ObcValveAnalogTwoWayIcon extends i$4 {
12980
13003
  fill="none"
12981
13004
  xmlns="http://www.w3.org/2000/svg"
12982
13005
  >
12983
- <path
12984
- d="M11 11L3.5547 6.03645C2.89015 5.59342 2 6.06981 2 6.8685V19.1315C2 19.9302 2.89015 20.4066 3.5547 19.9635L11 15H13L20.4453 19.9635C21.1099 20.4066 22 19.9302 22 19.1315V6.8685C22 6.06981 21.1099 5.59342 20.4453 6.03645L13 11H11ZM3 6.8685L3 19.1315L10.6972 14H13.3028L21 19.1315V6.8685L13.3028 12H10.6972L3 6.8685Z"
12985
- fill="var(--automation-device-tertiary-color)"
12986
- />
12987
- <path
12988
- d="M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z"
12989
- fill="var(--automation-device-primary-color)"
12990
- />
12991
- ${handle}
12992
- <g clip-path="url(#clip0)">
12993
- <rect
12994
- x=${xmax}
12995
- y="0"
12996
- width=${x - xmax}
12997
- height="24"
12998
- fill="var(--automation-device-secondary-color)"
12999
- />
13000
- <line
13001
- x1=${x}
13002
- y1="0"
13003
- x2=${x}
13004
- y2="24"
13005
- stroke="var(--automation-device-tertiary-color)"
13006
- stroke-width="1"
13007
- />
13008
-
13009
- <rect
13010
- x=${24 - x}
13011
- y="0"
13012
- width=${x - xmax}
13013
- height="24"
13014
- fill="var(--automation-device-secondary-color)"
13015
- />
13016
- <line
13017
- x1=${24 - x}
13018
- y1="0"
13019
- x2=${24 - x}
13020
- y2="24"
13021
- stroke="var(--automation-device-tertiary-color)"
13022
- stroke-width="1"
13023
- />
13024
- </g>
13025
13006
  <defs>
13026
- <clipPath id="clip0">
13027
- <path
13028
- d="M10.6972 12H13.3028L21 6.8685V19.1315L13.3028 14H10.6972L3 19.1315V6.8685L10.6972 12Z"
13029
- />
13030
- </clipPath>
13007
+ <clipPath id="body"><path d=${BODY} /></clipPath>
13031
13008
  </defs>
13009
+ <path d=${OUTLINE} style=${TERTIARY} />
13010
+ <path d=${BODY} style=${PRIMARY} />
13011
+ ${this.renderBands(BAND_RANGE * (100 - value) / 100)}
13012
+ ${this.renderHandle(value)}
13032
13013
  </svg>
13033
13014
  </div>
13034
13015
  `;
@@ -16359,21 +16340,15 @@ var textbox_default = i$7`* {
16359
16340
  letter-spacing: var(--global-typography-generic-l-letter-spacing);
16360
16341
  }
16361
16342
 
16362
- /* The inner-wrapper is the box: its height (--height) is the full textbox
16363
- height, padding included. The content is sized to the cap height and
16364
- vertically centered, which leaves the padding as equal space above and
16365
- below. In engines that support text-box-trim the content box collapses to
16366
- the cap height exactly; in Firefox (no text-box-trim) the content keeps its
16367
- natural line box, so align-items:center + overflow:hidden crops it to the
16368
- same height instead. No padding here – the centering provides it.
16369
- (A small top padding could be added later to nudge the text up in Firefox.) */
16343
+ /* The box, never clipped: descenders and diacritics paint past its edges. The
16344
+ centred content leaves equal padding above and below; without text-box-trim
16345
+ the host's zero line-height keeps it centred to within about a pixel. */
16370
16346
  .inner-wrapper {
16371
16347
  box-sizing: border-box;
16372
16348
  display: flex;
16373
16349
  align-items: center;
16374
16350
  justify-content: var(--alignment-justify, flex-end);
16375
16351
  height: var(--height);
16376
- overflow: hidden;
16377
16352
  /* Opt-in: animate a \`size\` change (height + font-size below). Defaults to 0s
16378
16353
  (instant, current behavior) so existing usages and snapshots are unchanged;
16379
16354
  a consumer sets \`--obc-textbox-size-transition\` (e.g. 300ms) to animate the
@@ -47007,7 +46982,8 @@ obc-readout-block {
47007
46982
  gap: var(--global-size-spacing-target-padding);
47008
46983
  flex: 1 1 auto;
47009
46984
  min-inline-size: 0;
47010
- overflow: clip;
46985
+ overflow-x: clip;
46986
+ overflow-y: visible; /* a label's descenders and diacritics paint past its cap-to-baseline box */
47011
46987
  /* a leading-src chip's 1px outline is drawn outside its box at the container edge */
47012
46988
  overflow-clip-margin: 1px;
47013
46989
  }
@@ -69331,19 +69307,52 @@ __decorate([r$3()], ObcScrollbar.prototype, "_thumbHeight", void 0);
69331
69307
  __decorate([r$3()], ObcScrollbar.prototype, "_showOverlayThumb", void 0);
69332
69308
  ObcScrollbar = __decorate([customElement("obc-scrollbar")], ObcScrollbar);
69333
69309
  //#endregion
69334
- //#region src/building-blocks/alert-list/alert-list.ts
69335
- var ObcAlertList = class ObcAlertList extends i$4 {
69310
+ //#region src/building-blocks/alert-list/alert-list-base.ts
69311
+ /**
69312
+ * `ObcAlertListBase` – Scrolling list of slotted alert items that animates items
69313
+ * into place and shows an empty state when no item passes its filter.
69314
+ *
69315
+ * Not registered as an element: the subclasses decide which items pass.
69316
+ * `obc-alert-list` runs a predicate the consumer sets.
69317
+ *
69318
+ * ### Features
69319
+ * - **Filter:** `matchesFilter()` decides which items count; the list re-reads
69320
+ * it when items are added or removed, when an item attribute named by
69321
+ * `observedItemAttributes` changes, and when `filterChanged()` reports a
69322
+ * change of the subclass's filter inputs.
69323
+ * - **Motion:** items that move slide to their new place; new items play
69324
+ * their intro animation once the list has been seen.
69325
+ * - **Empty state:** icon, title and description slots, with fallback content
69326
+ * from `emptyFallback`.
69327
+ * - **Visible items:** `getVisibleElements()` returns the items that pass the
69328
+ * filter and sit inside the scroll viewport.
69329
+ */
69330
+ var ObcAlertListBase = class extends i$4 {
69336
69331
  constructor(..._args) {
69337
69332
  super(..._args);
69338
- this.filter = () => true;
69339
69333
  this.oldElementTop = /* @__PURE__ */ new Map();
69340
69334
  this.mutationObserver = null;
69341
69335
  this.intersectionObserver = null;
69342
69336
  this.hasRenderedPanel = false;
69343
69337
  this._empty = false;
69344
69338
  }
69339
+ /** Whether the list counts an item as one it shows. */
69340
+ matchesFilter(_item) {
69341
+ return true;
69342
+ }
69343
+ /** Whether this update changed what `matchesFilter` decides. */
69344
+ filterChanged(_changed) {
69345
+ return false;
69346
+ }
69347
+ /** Item attributes whose changes can change what `matchesFilter` decides. */
69348
+ get observedItemAttributes() {
69349
+ return ["status", "shelved"];
69350
+ }
69351
+ get emptyFallback() {
69352
+ return {};
69353
+ }
69345
69354
  firstUpdated() {
69346
- this.updateEmpty();
69355
+ this.applyFilter();
69347
69356
  this.setupMutationObserver();
69348
69357
  }
69349
69358
  connectedCallback() {
@@ -69356,6 +69365,7 @@ var ObcAlertList = class ObcAlertList extends i$4 {
69356
69365
  this.setupMutationObserver();
69357
69366
  }
69358
69367
  disconnectedCallback() {
69368
+ super.disconnectedCallback();
69359
69369
  if (this.mutationObserver) {
69360
69370
  this.mutationObserver.disconnect();
69361
69371
  this.mutationObserver = null;
@@ -69366,16 +69376,17 @@ var ObcAlertList = class ObcAlertList extends i$4 {
69366
69376
  }
69367
69377
  }
69368
69378
  willUpdate(_changedProperties) {
69369
- if (_changedProperties.has("filter")) {
69370
- this.updateEmpty();
69379
+ if (this.filterChanged(_changedProperties)) {
69380
+ this.applyFilter();
69371
69381
  this.updateOldElementTop();
69372
69382
  }
69373
69383
  }
69374
- updateEmpty() {
69384
+ /** Runs whenever the items or the filter change; a subclass extends it to act on each item. */
69385
+ applyFilter() {
69375
69386
  this._empty = this.getAlertItems().length === 0;
69376
69387
  }
69377
69388
  getAlertItems() {
69378
- return this.alertItems.filter(this.filter);
69389
+ return this.alertItems.filter((item) => this.matchesFilter(item));
69379
69390
  }
69380
69391
  updateOldElementTop() {
69381
69392
  const elements = this.getAlertItems();
@@ -69400,7 +69411,7 @@ var ObcAlertList = class ObcAlertList extends i$4 {
69400
69411
  this.alertItems.forEach((element) => {
69401
69412
  this.mutationObserver?.observe(element, {
69402
69413
  attributes: true,
69403
- attributeFilter: ["status", "shelved"]
69414
+ attributeFilter: this.observedItemAttributes
69404
69415
  });
69405
69416
  });
69406
69417
  }
@@ -69410,7 +69421,7 @@ var ObcAlertList = class ObcAlertList extends i$4 {
69410
69421
  }
69411
69422
  handleElementsChange() {
69412
69423
  this.mutationObserver?.takeRecords();
69413
- this.updateEmpty();
69424
+ this.applyFilter();
69414
69425
  if (!this.checkVisibility()) return;
69415
69426
  const elements = this.getAlertItems();
69416
69427
  const oldElementTop = new Map(this.oldElementTop);
@@ -69455,14 +69466,15 @@ var ObcAlertList = class ObcAlertList extends i$4 {
69455
69466
  });
69456
69467
  }
69457
69468
  render() {
69469
+ const fallback = this.emptyFallback;
69458
69470
  return b` <obc-scrollbar class="alert-list" id="scrollbar">
69459
69471
  <slot @slotchange=${this.handleSlotChange}></slot>
69460
69472
  ${this._empty ? b` <div class="empty-list">
69461
69473
  <div class="icon">
69462
- <slot name="empty-icon"></slot>
69474
+ <slot name="empty-icon">${fallback.icon}</slot>
69463
69475
  </div>
69464
69476
  <div class="empty-title">
69465
- <slot name="empty-title"></slot>
69477
+ <slot name="empty-title">${fallback.title}</slot>
69466
69478
  </div>
69467
69479
  <div class="empty-description">
69468
69480
  <slot name="empty-description"></slot>
@@ -69474,10 +69486,24 @@ var ObcAlertList = class ObcAlertList extends i$4 {
69474
69486
  this.styles = r$7(alert_list_default);
69475
69487
  }
69476
69488
  };
69489
+ __decorate([r$3()], ObcAlertListBase.prototype, "_empty", void 0);
69490
+ __decorate([o$5({ flatten: true })], ObcAlertListBase.prototype, "alertItems", void 0);
69491
+ __decorate([e$4("#scrollbar", true)], ObcAlertListBase.prototype, "scrollbar", void 0);
69492
+ //#endregion
69493
+ //#region src/building-blocks/alert-list/alert-list.ts
69494
+ var ObcAlertList = class ObcAlertList extends ObcAlertListBase {
69495
+ constructor(..._args) {
69496
+ super(..._args);
69497
+ this.filter = () => true;
69498
+ }
69499
+ matchesFilter(item) {
69500
+ return this.filter(item);
69501
+ }
69502
+ filterChanged(changed) {
69503
+ return changed.has("filter");
69504
+ }
69505
+ };
69477
69506
  __decorate([n$4({ attribute: false })], ObcAlertList.prototype, "filter", void 0);
69478
- __decorate([r$3()], ObcAlertList.prototype, "_empty", void 0);
69479
- __decorate([o$5({ flatten: true })], ObcAlertList.prototype, "alertItems", void 0);
69480
- __decorate([e$4("#scrollbar", true)], ObcAlertList.prototype, "scrollbar", void 0);
69481
69507
  ObcAlertList = __decorate([customElement("obc-alert-list")], ObcAlertList);
69482
69508
  //#endregion
69483
69509
  //#region src/building-blocks/bar-horizontal/bar-horizontal.ts
@@ -77149,10 +77175,11 @@ var ObcAlertIcon = class ObcAlertIcon extends i$4 {
77149
77175
  case "unacknowledged": return mapping["alarm-unack"];
77150
77176
  default: return null;
77151
77177
  }
77152
- else if (this.bamType === AlertType.Warning) {
77153
- if (this.active === false) return mapping["warning-rectified"];
77154
- else if (this.acknowledged) return mapping["warning-silenced"];
77155
- else return mapping["warning-unack"];
77178
+ else if (this.bamType === AlertType.Warning) switch (this._effectiveState) {
77179
+ case "rectified": return mapping["warning-rectified"];
77180
+ case "silenced": return mapping["warning-silenced"];
77181
+ case "unacknowledged": return mapping["warning-unack"];
77182
+ default: return null;
77156
77183
  }
77157
77184
  return null;
77158
77185
  }
@@ -77186,7 +77213,7 @@ var ObcAlertIcon = class ObcAlertIcon extends i$4 {
77186
77213
  default: return A;
77187
77214
  }
77188
77215
  }
77189
- return A;
77216
+ return this.icon ? b`${this.icon.a}` : A;
77190
77217
  }
77191
77218
  render() {
77192
77219
  if (!this._effectiveType) return b`<div>No alarm</div>`;
@@ -80361,7 +80388,6 @@ obc-table::part(grid) {
80361
80388
  .empty-list .icon {
80362
80389
  height: 96px;
80363
80390
  width: 96px;
80364
- color: var(--on-flat-neutral-color);
80365
80391
  }
80366
80392
 
80367
80393
  .empty-list .empty-title {
@@ -80389,6 +80415,10 @@ obc-table::part(grid) {
80389
80415
  max-width: 344px;
80390
80416
  text-align: center;
80391
80417
  }
80418
+
80419
+ .empty-list .icon {
80420
+ color: var(--on-flat-neutral-color);
80421
+ }
80392
80422
  `;
80393
80423
  //#endregion
80394
80424
  //#region src/components/alert-list-details/alert-list-details.ts
@@ -80651,6 +80681,7 @@ var ObcAlertMenuItemStatus = /* @__PURE__ */ function(ObcAlertMenuItemStatus) {
80651
80681
  ObcAlertMenuItemStatus["NoAckAlarm"] = "no-ack-alarm";
80652
80682
  ObcAlertMenuItemStatus["NoAckWarning"] = "no-ack-warning";
80653
80683
  ObcAlertMenuItemStatus["Rectified"] = "rectified";
80684
+ ObcAlertMenuItemStatus["RectifiedUnacknowledged"] = "rectified-unacknowledged";
80654
80685
  return ObcAlertMenuItemStatus;
80655
80686
  }({});
80656
80687
  var ObcAlertMenuItem = class ObcAlertMenuItem extends i$4 {
@@ -80658,6 +80689,7 @@ var ObcAlertMenuItem = class ObcAlertMenuItem extends i$4 {
80658
80689
  super(..._args);
80659
80690
  this.hasIcon = false;
80660
80691
  this.shelved = false;
80692
+ this.blocked = false;
80661
80693
  this.title = "";
80662
80694
  this.description = "";
80663
80695
  this.day = "";
@@ -80670,9 +80702,12 @@ var ObcAlertMenuItem = class ObcAlertMenuItem extends i$4 {
80670
80702
  this.primaryActionState = "enabled";
80671
80703
  this.secondaryActionState = "none";
80672
80704
  }
80705
+ get canAck() {
80706
+ return this.status === "unacknowledged" || this.status === "rectified-unacknowledged";
80707
+ }
80673
80708
  get primaryActionLabel() {
80674
80709
  if (this.primaryActionState === "none") return "";
80675
- return this.status === "unacknowledged" ? "ACK" : "";
80710
+ return this.canAck ? "ACK" : "";
80676
80711
  }
80677
80712
  get secondaryActionLabelToShow() {
80678
80713
  if (this.secondaryActionState === "none") return "";
@@ -80685,7 +80720,7 @@ var ObcAlertMenuItem = class ObcAlertMenuItem extends i$4 {
80685
80720
  return this.secondaryActionState === "disabled";
80686
80721
  }
80687
80722
  get hasTrailingIcon() {
80688
- return this.status !== "unacknowledged";
80723
+ return !this.canAck;
80689
80724
  }
80690
80725
  handleMessageClick(event) {
80691
80726
  event.stopPropagation();
@@ -80745,6 +80780,10 @@ __decorate([n$4({
80745
80780
  type: Boolean,
80746
80781
  reflect: true
80747
80782
  })], ObcAlertMenuItem.prototype, "shelved", void 0);
80783
+ __decorate([n$4({
80784
+ type: Boolean,
80785
+ reflect: true
80786
+ })], ObcAlertMenuItem.prototype, "blocked", void 0);
80748
80787
  __decorate([n$4({ type: String })], ObcAlertMenuItem.prototype, "title", void 0);
80749
80788
  __decorate([n$4({ type: String })], ObcAlertMenuItem.prototype, "description", void 0);
80750
80789
  __decorate([n$4({ type: String })], ObcAlertMenuItem.prototype, "day", void 0);
@@ -80839,52 +80878,13 @@ var alert_menu_default = i$7`* {
80839
80878
  min-width: 120px;
80840
80879
  }
80841
80880
 
80842
- .empty-list {
80843
- display: flex;
80844
- flex-direction: column;
80845
- align-items: center;
80846
- justify-content: center;
80847
- height: 100%;
80848
- gap: var(--app-components-alert-menu-button-spacing);
80849
- }
80850
-
80851
- .empty-list .icon {
80852
- height: 96px;
80853
- width: 96px;
80854
- }
80855
-
80856
- .empty-list .empty-title {
80857
- color: var(--element-active-color);
80858
- font-family: var(--global-typography-font-family);
80859
- font-weight: var(--global-typography-ui-body-active-font-weight);
80860
- font-size: var(--global-typography-ui-body-active-font-size);
80861
- line-height: var(--global-typography-ui-body-active-line-height);
80862
- font-feature-settings:
80863
- "liga" off,
80864
- "clig" off,
80865
- "ss04" on;
80866
- }
80867
-
80868
- .empty-list .empty-description {
80869
- color: var(--element-neutral-color);
80870
- font-family: var(--global-typography-font-family);
80871
- font-weight: var(--global-typography-ui-body-font-weight);
80872
- font-size: var(--global-typography-ui-body-font-size);
80873
- line-height: var(--global-typography-ui-body-line-height);
80874
- font-feature-settings:
80875
- "liga" off,
80876
- "clig" off,
80877
- "ss04" on;
80878
- max-width: 344px;
80879
- text-align: center;
80880
- }
80881
-
80882
80881
  ::slotted(*) {
80883
80882
  display: block;
80884
80883
  will-change: transform;
80885
80884
  }
80886
80885
 
80887
- .alert-list.all ::slotted([shelved]) {
80886
+ .alert-list.all ::slotted([shelved]),
80887
+ .alert-list.all ::slotted([status="rectified-unacknowledged"]) {
80888
80888
  display: none;
80889
80889
  }
80890
80890
 
@@ -80892,7 +80892,7 @@ var alert_menu_default = i$7`* {
80892
80892
  display: none;
80893
80893
  }
80894
80894
 
80895
- .alert-list.unacked ::slotted(:not([status="unacknowledged"])),.alert-list.unacked ::slotted([shelved]) {
80895
+ .alert-list.unacked ::slotted(:not([status="unacknowledged"]):not([status="rectified-unacknowledged"])),.alert-list.unacked ::slotted([shelved]) {
80896
80896
  display: none;
80897
80897
  }
80898
80898
  `;
@@ -81310,6 +81310,7 @@ __decorate([n$4({ type: Boolean })], ObcTabbedCard.prototype, "hasTabIcons", voi
81310
81310
  ObcTabbedCard = __decorate([customElement("obc-tabbed-card")], ObcTabbedCard);
81311
81311
  //#endregion
81312
81312
  //#region src/components/alert-menu/alert-menu.ts
81313
+ var WAITING_FOR_ACK = [ObcAlertMenuItemStatus.Unacknowledged, ObcAlertMenuItemStatus.RectifiedUnacknowledged];
81313
81314
  var ObcAlertMenu = class ObcAlertMenu extends i$4 {
81314
81315
  constructor(..._args) {
81315
81316
  super(..._args);
@@ -81320,88 +81321,108 @@ var ObcAlertMenu = class ObcAlertMenu extends i$4 {
81320
81321
  this.canAckAll = false;
81321
81322
  this.showSilenceButton = true;
81322
81323
  this.showAlertListButton = true;
81323
- this._selectedTabIndex = 1;
81324
81324
  }
81325
81325
  handleAckAllVisibleClick() {
81326
81326
  const visibleElements = this.alertList.getVisibleElements();
81327
81327
  this.dispatchEvent(new CustomEvent("ack-all-visible-click", { detail: {
81328
81328
  visibleElements,
81329
- tabName: this.getSelectedTab().name
81329
+ tabName: this.selectedTab.name
81330
81330
  } }));
81331
81331
  }
81332
81332
  onTabChange(e) {
81333
- this._selectedTabIndex = e.detail.tab;
81333
+ this._selectedTabName = this.tabs[e.detail.tab]?.name;
81334
+ }
81335
+ willUpdate(changedProperties) {
81336
+ super.willUpdate(changedProperties);
81337
+ if (!this.tabs.some((tab) => tab.name === this._selectedTabName)) this._selectedTabName = void 0;
81338
+ }
81339
+ /** Whether the menu offers "ACK visible" at all; `canAckAll` enables it. */
81340
+ get offersAckAll() {
81341
+ return true;
81334
81342
  }
81335
- getSelectedTab() {
81336
- if (this._selectedTabIndex === 0) return {
81343
+ /** The tabs in display order; the menu opens on the second one. */
81344
+ get tabs() {
81345
+ const tabs = [{
81337
81346
  name: "unacked",
81347
+ title: msg("Unacked"),
81338
81348
  emptyTitle: msg("No unacknowledged alerts"),
81339
- emptyDescription: msg("Go to the 'Alert list' for more details or to manage existing alerts."),
81340
- emptyIcon: b`<obi-unacknowledged></obi-unacknowledged>`,
81341
- class: "unacked",
81342
- filter: (item) => {
81343
- return item.getAttribute("status") === ObcAlertMenuItemStatus.Unacknowledged && !item.hasAttribute("shelved");
81344
- }
81345
- };
81346
- else if (this._selectedTabIndex === 2) return {
81347
- name: "shelved",
81348
- emptyTitle: msg("No shelved alerts"),
81349
- emptyDescription: msg("Go to the 'Alert list' for more details or to manage existing alerts."),
81350
- emptyIcon: b`<obi-alerts-shelf></obi-alerts-shelf>`,
81351
- class: "shelved",
81352
- filter: (item) => {
81353
- return item.hasAttribute("shelved");
81354
- }
81355
- };
81356
- else return {
81349
+ emptyIcon: b`<obi-unacknowledged></obi-unacknowledged>`
81350
+ }, {
81357
81351
  name: "all",
81352
+ title: msg("Active"),
81358
81353
  emptyTitle: msg("No active alerts"),
81359
- emptyDescription: msg("Go to the 'Alert list' for more details or to manage existing alerts."),
81360
- emptyIcon: b`<obi-alerts></obi-alerts>`,
81361
- class: "all",
81362
- filter: (item) => {
81363
- return !item.hasAttribute("shelved");
81364
- }
81365
- };
81354
+ emptyIcon: b`<obi-alerts></obi-alerts>`
81355
+ }];
81356
+ if (this.hasShelved) tabs.push({
81357
+ name: "shelved",
81358
+ title: msg("Shelved"),
81359
+ emptyTitle: msg("No shelved alerts"),
81360
+ emptyIcon: b`<obi-alerts-shelf></obi-alerts-shelf>`
81361
+ });
81362
+ return tabs;
81363
+ }
81364
+ /** Where the selected tab sits in `tabs`: the one the user picked, else the second. */
81365
+ selectedTabIndex(tabs) {
81366
+ const index = tabs.findIndex((tab) => tab.name === this._selectedTabName);
81367
+ return index === -1 ? 1 : index;
81368
+ }
81369
+ get selectedTab() {
81370
+ const tabs = this.tabs;
81371
+ return tabs[this.selectedTabIndex(tabs)];
81372
+ }
81373
+ /**
81374
+ * The list that shows the selected tab's items. The CSS hides the items the
81375
+ * tab leaves out; the filter tells the list which ones those are.
81376
+ */
81377
+ renderList(tab, content) {
81378
+ return b`<obc-alert-list
81379
+ class="alert-list ${tab.name}"
81380
+ .filter=${(item) => this.tabFilter(tab.name, item)}
81381
+ >${content}</obc-alert-list
81382
+ >`;
81383
+ }
81384
+ tabFilter(name, item) {
81385
+ const status = item.getAttribute("status") ?? "";
81386
+ if (name === "unacked") return WAITING_FOR_ACK.includes(status) && !item.hasAttribute("shelved");
81387
+ if (name === "shelved") return item.hasAttribute("shelved");
81388
+ return !item.hasAttribute("shelved") && status !== ObcAlertMenuItemStatus.RectifiedUnacknowledged;
81366
81389
  }
81367
81390
  render() {
81368
- const t = this.getSelectedTab();
81391
+ const tabs = this.tabs;
81392
+ const selectedIndex = this.selectedTabIndex(tabs);
81393
+ const t = tabs[selectedIndex];
81369
81394
  return b`
81370
81395
  <obc-tabbed-card
81371
- .nTabs=${this.hasShelved ? 3 : 2}
81396
+ .nTabs=${tabs.length}
81372
81397
  class="wrapper"
81373
81398
  part="wrapper"
81374
- .selectedTab=${this._selectedTabIndex}
81399
+ .selectedTab=${selectedIndex}
81375
81400
  hasDefaultSlotOnly
81376
81401
  @tab-change=${this.onTabChange}
81377
81402
  >
81378
- <span slot="tab-title-0">${msg("Unacked")}</span>
81379
- <span slot="tab-title-1">${msg("Active")}</span>
81380
- ${this.hasShelved ? b`<span slot="tab-title-2">${msg("Shelved")}</span>` : A}
81403
+ ${tabs.map((tab, index) => b`<span slot="tab-title-${index}">${tab.title}</span>`)}
81381
81404
  <div class="container">
81382
- <obc-alert-list class="alert-list ${t.class}" .filter=${t.filter}>
81383
- <slot></slot>
81384
- <slot name="empty-${t.name}-title" slot="empty-title"
81385
- >${t.emptyTitle}</slot
81386
- >
81387
- <slot name="empty-${t.name}-description" slot="empty-description"
81388
- >${t.emptyDescription}</slot
81389
- >
81390
- <slot name="empty-${t.name}-icon" slot="empty-icon"
81391
- >${t.emptyIcon}</slot
81392
- >
81393
- </obc-alert-list>
81405
+ ${this.renderList(t, b`<slot></slot>
81406
+ <slot name="empty-${t.name}-title" slot="empty-title"
81407
+ >${t.emptyTitle}</slot
81408
+ >
81409
+ <slot name="empty-${t.name}-description" slot="empty-description"
81410
+ >${msg("Go to the 'Alert list' for more details or to manage existing alerts.")}</slot
81411
+ >
81412
+ <slot name="empty-${t.name}-icon" slot="empty-icon"
81413
+ >${t.emptyIcon}</slot
81414
+ >`)}
81394
81415
  <div class="action">
81395
- <obc-button
81396
- variant="raised"
81397
- .disabled=${!this.canAckAll}
81398
- fullWidth
81399
- class="btn"
81400
- data-testid="ack-all-visible-button"
81401
- @click=${this.handleAckAllVisibleClick}
81402
- >
81403
- ${msg("ACK visible")}
81404
- </obc-button>
81416
+ ${this.offersAckAll ? b`<obc-button
81417
+ variant="raised"
81418
+ .disabled=${!this.canAckAll}
81419
+ fullWidth
81420
+ class="btn"
81421
+ data-testid="ack-all-visible-button"
81422
+ @click=${this.handleAckAllVisibleClick}
81423
+ >
81424
+ ${msg("ACK visible")}
81425
+ </obc-button>` : A}
81405
81426
  ${this.showSilenceButton ? b`<obc-button
81406
81427
  variant="normal"
81407
81428
  fullWidth
@@ -81447,8 +81468,8 @@ __decorate([n$4({
81447
81468
  type: Boolean,
81448
81469
  attribute: false
81449
81470
  })], ObcAlertMenu.prototype, "showAlertListButton", void 0);
81450
- __decorate([r$3()], ObcAlertMenu.prototype, "_selectedTabIndex", void 0);
81451
- __decorate([e$4("obc-alert-list")], ObcAlertMenu.prototype, "alertList", void 0);
81471
+ __decorate([r$3()], ObcAlertMenu.prototype, "_selectedTabName", void 0);
81472
+ __decorate([e$4(".alert-list")], ObcAlertMenu.prototype, "alertList", void 0);
81452
81473
  ObcAlertMenu = __decorate([localized(), customElement("obc-alert-menu")], ObcAlertMenu);
81453
81474
  //#endregion
81454
81475
  //#region src/components/alert-subsystem-counter/alert-subsystem-counter.css?inline
@@ -98626,12 +98647,18 @@ var number_input_field_default = i$7`* {
98626
98647
  }
98627
98648
 
98628
98649
  .wrapper.align-center .value-input {
98629
- width: var(--obc-number-input-center-width, auto);
98630
- min-width: var(--obc-number-input-center-width, 40px);
98650
+ field-sizing: content; /* the unit hugs the value */
98651
+ width: auto;
98631
98652
  text-align: right;
98632
98653
  flex: 0 0 auto;
98633
98654
  }
98634
98655
 
98656
+ @supports not (field-sizing: content) {
98657
+ .wrapper.align-center .value-input {
98658
+ flex: 1 1 auto; /* the 20-character default width would push the value out of a narrow field */
98659
+ }
98660
+ }
98661
+
98635
98662
  .wrapper.align-right .label-container,
98636
98663
  .wrapper.align-right-unit-outside .label-container {
98637
98664
  justify-content: flex-end;
@@ -98738,9 +98765,6 @@ var ObcNumberInputFieldSize = /* @__PURE__ */ function(ObcNumberInputFieldSize)
98738
98765
  ObcNumberInputFieldSize["Large"] = "large";
98739
98766
  return ObcNumberInputFieldSize;
98740
98767
  }({});
98741
- var characterWidth = 9.15199279785156;
98742
- var symbolWidth = 4.287994384765653;
98743
- var baseFontSize = 16;
98744
98768
  var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98745
98769
  constructor(..._args) {
98746
98770
  super(..._args);
@@ -98774,6 +98798,7 @@ var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98774
98798
  this.previousValue = NaN;
98775
98799
  this.previousDisplayText = "";
98776
98800
  this.lastCommittedValue = NaN;
98801
+ this.focusFromValueClick = false;
98777
98802
  }
98778
98803
  get displayValue() {
98779
98804
  return this.displayText;
@@ -98797,7 +98822,6 @@ var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98797
98822
  const parsed = parseNumberInput(raw);
98798
98823
  this.value = parsed;
98799
98824
  this.previousDisplayText = raw;
98800
- this.updateCenterAlignedInputWidth(raw);
98801
98825
  this.dispatchInput();
98802
98826
  }
98803
98827
  isProjectedValueAllowed(projected) {
@@ -98825,6 +98849,31 @@ var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98825
98849
  onFocus() {
98826
98850
  this.hasFocus = true;
98827
98851
  if (this.readonly) return;
98852
+ if (this.focusFromValueClick) {
98853
+ this.focusFromValueClick = false;
98854
+ requestAnimationFrame(() => void this.ungroupKeepingSelection());
98855
+ return;
98856
+ }
98857
+ this.ungroupDisplay();
98858
+ }
98859
+ /**
98860
+ * Ungroups a value the user clicked into, once the browser has placed the
98861
+ * caret, and moves the caret with its digits. Ungrouping before that shifts
98862
+ * the text under the pointer and the caret lands beside the clicked digit.
98863
+ */
98864
+ async ungroupKeepingSelection() {
98865
+ const input = this.inputElement;
98866
+ if (!input || !this.hasFocus) return;
98867
+ const grouped = input.value;
98868
+ const offsetWithoutGrouping = (offset) => removeGroupingFromDisplay(grouped.slice(0, offset ?? grouped.length), this.getFormatOptions()).length;
98869
+ const start = offsetWithoutGrouping(input.selectionStart);
98870
+ const end = offsetWithoutGrouping(input.selectionEnd);
98871
+ const direction = input.selectionDirection ?? void 0;
98872
+ this.ungroupDisplay();
98873
+ await this.updateComplete;
98874
+ input.setSelectionRange(start, end, direction);
98875
+ }
98876
+ ungroupDisplay() {
98828
98877
  const source = this.displayOverride || this.displayText;
98829
98878
  this.displayText = removeGroupingFromDisplay(source, this.getFormatOptions());
98830
98879
  this.displayOverride = "";
@@ -98870,22 +98919,9 @@ var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98870
98919
  if (!this.shouldUpdateValue && this.inputElement) return this.inputElement.value;
98871
98920
  return this.displayText;
98872
98921
  }
98873
- updateCenterAlignedInputWidth(value) {
98874
- if (this.textAlign !== "center") {
98875
- this.style.removeProperty("--obc-number-input-center-width");
98876
- return;
98877
- }
98878
- const fontSize = Number.parseFloat(getCssVariableValue(this, "--global-typography-instrument-value-regular-font-size"));
98879
- const characters = value.replaceAll(/[.,]/g, "");
98880
- const symbols = value.length - characters.length;
98881
- const calculatedWidth = characters.length * characterWidth + symbols * symbolWidth;
98882
- const measuredWidth = Math.ceil(calculatedWidth * fontSize / baseFontSize);
98883
- this.style.setProperty("--obc-number-input-center-width", `${measuredWidth}px`);
98884
- }
98885
98922
  firstUpdated() {
98886
98923
  if (!this.displayText && !this.displayOverride) this.displayText = this.formatValueForDisplay(this.value);
98887
98924
  this.lastCommittedValue = this.value;
98888
- this.updateCenterAlignedInputWidth(this.getEffectiveDisplay());
98889
98925
  }
98890
98926
  get isEmpty() {
98891
98927
  if (this.inputElement) return this.inputElement.value.trim().length === 0;
@@ -98907,7 +98943,6 @@ var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98907
98943
  }
98908
98944
  updated() {
98909
98945
  if (this.rejectDuplicateUpdates && !valuesEqual(this.value, this.previousValue) && (this.previousDisplayText !== this.displayText || !this.hasFocus)) this.previousValue = this.value;
98910
- this.updateCenterAlignedInputWidth(this.getEffectiveDisplay());
98911
98946
  }
98912
98947
  renderFooterText(text, isError) {
98913
98948
  if (!text) return A;
@@ -98924,33 +98959,20 @@ var ObcNumberInputField = class ObcNumberInputField extends i$4 {
98924
98959
  ${text}
98925
98960
  </div>`;
98926
98961
  }
98962
+ /**
98963
+ * Keeps focus where it is while the chrome around the value is clicked.
98964
+ * The wrapper is a `<label>`, so the click itself focuses the input; without
98965
+ * this the pointerdown would blur it first and commit an unfinished edit.
98966
+ * A click on the value itself is the browser's; it is only noted, so the
98967
+ * focus it causes ungroups the value without moving the caret.
98968
+ */
98927
98969
  onPointerDown(e) {
98928
- if (this.disabled) return;
98929
- if (this.readonly) return;
98930
- if (this.inputElement) {
98931
- e.stopPropagation();
98932
- e.preventDefault();
98933
- this.inputElement.focus();
98934
- const inputBox = this.inputElement.getBoundingClientRect();
98935
- let selectionStart;
98936
- if (e.clientX < inputBox.left) selectionStart = 0;
98937
- else if (e.clientX > inputBox.right) selectionStart = this.inputElement.value.length;
98938
- else {
98939
- const mouseX = e.clientX;
98940
- let inputX = inputBox.right;
98941
- const text = this.inputElement.value;
98942
- for (let i = text.length - 1; i >= 0; i--) {
98943
- const width = text[i].match(/[.,]/) ? symbolWidth : characterWidth;
98944
- if (mouseX > inputX - width / 2) {
98945
- selectionStart = i + 1;
98946
- break;
98947
- }
98948
- inputX -= width;
98949
- }
98950
- if (selectionStart === void 0) selectionStart = 0;
98951
- }
98952
- this.inputElement.setSelectionRange(selectionStart, selectionStart);
98970
+ if (this.disabled || this.readonly) return;
98971
+ if (e.target === this.inputElement) {
98972
+ this.focusFromValueClick = !this.hasFocus;
98973
+ return;
98953
98974
  }
98975
+ e.preventDefault();
98954
98976
  }
98955
98977
  render() {
98956
98978
  const hasHelperOrError = Boolean(this.helperText) || Boolean(this.error && this.errorText);
@@ -211276,7 +211298,7 @@ var ObcAlertDetailPage = class ObcAlertDetailPage extends i$4 {
211276
211298
  [`type-${this.type}`]: true,
211277
211299
  "status-acknowledged": isAcknowledged(this.alert) && isActive(this.alert),
211278
211300
  "status-unacknowledged": !isAcknowledged(this.alert) && isActive(this.alert),
211279
- "status-resolved": isActive(this.alert)
211301
+ "status-resolved": !isActive(this.alert)
211280
211302
  })}
211281
211303
  >
211282
211304
  <div class="header">
@@ -211391,75 +211413,85 @@ var alert_list_page_small_default = i$7`* {
211391
211413
  }
211392
211414
  `;
211393
211415
  //#endregion
211394
- //#region src/pages/alert-list-page-small/alert-list-page-small.ts
211395
- var ObcAlertListPageSmall = class ObcAlertListPageSmall extends i$4 {
211416
+ //#region src/pages/alert-list-page-small/alert-list-page-small-base.ts
211417
+ /**
211418
+ * `ObcAlertListPageSmallBase` – Compact alert list page: a list of alerts over a
211419
+ * bar with a mode dropdown, a silence button and "ACK visible".
211420
+ *
211421
+ * Not registered as an element: the subclasses supply the list and the
211422
+ * modes. `obc-alert-list-page-small` renders `obc-alert-list-details`.
211423
+ *
211424
+ * ### Features
211425
+ * - **Modes:** the dropdown offers `modes` and shows `mode`; picking one calls
211426
+ * `selectMode()`.
211427
+ * - **ACK visible:** enabled while `canAckAll` holds; a click reports the
211428
+ * alerts `visibleAlerts()` returns, and the mode, in `ack-all-visible-click`.
211429
+ * - **Silence:** the icon button fires `silence-click`.
211430
+ *
211431
+ * The base holds no alerts: each page declares `alerts` in the alert type it
211432
+ * lists.
211433
+ *
211434
+ * @property hasShelved - Whether the dropdown offers the shelved alerts.
211435
+ * @property showTime - Whether the list shows when each alert was raised.
211436
+ * @property timeFormatter - Formats the time the list shows.
211437
+ * @availableWhen timeFormatter showTime==true
211438
+ */
211439
+ var ObcAlertListPageSmallBase = class extends i$4 {
211396
211440
  constructor(..._args) {
211397
211441
  super(..._args);
211398
211442
  this.hasShelved = false;
211399
- this.selectedMode = "all";
211400
- this.alerts = [];
211401
211443
  this.showTime = false;
211402
211444
  this.timeFormatter = (time) => time.toLocaleTimeString(void 0, { hour12: false });
211403
- this._mode = "all";
211404
211445
  }
211405
- willUpdate(changedProperties) {
211406
- if (changedProperties.has("selectedMode") && this._mode !== this.selectedMode) this._mode = this.selectedMode;
211446
+ /** The dropdown's options, in order. */
211447
+ get modes() {
211448
+ return [];
211449
+ }
211450
+ /** The mode the list filters by and the dropdown shows. */
211451
+ get mode() {
211452
+ return "";
211453
+ }
211454
+ selectMode(_mode) {}
211455
+ /** Whether an alert the list shows in `mode` can still be acknowledged. */
211456
+ get canAckAll() {
211457
+ return false;
211458
+ }
211459
+ /** Whether the page offers "ACK visible" at all; `canAckAll` enables it. */
211460
+ get offersAckAll() {
211461
+ return true;
211462
+ }
211463
+ /** The alerts in view, which "ACK visible" reports. */
211464
+ visibleAlerts() {
211465
+ return [];
211466
+ }
211467
+ renderList() {
211468
+ return A;
211469
+ }
211470
+ dispatchAckClick(alert) {
211471
+ this.dispatchEvent(new CustomEvent("ack-click", { detail: { alert } }));
211472
+ }
211473
+ dispatchRowClick(alert) {
211474
+ this.dispatchEvent(new CustomEvent("row-click", { detail: { alert } }));
211407
211475
  }
211408
211476
  handleAckAllVisibleClick() {
211409
- const tabName = this.selectedMode;
211410
- const visibleElements = this.alertList.getVisibleAlerts();
211411
211477
  this.dispatchEvent(new CustomEvent("ack-all-visible-click", { detail: {
211412
- alerts: visibleElements,
211413
- mode: tabName
211478
+ alerts: this.visibleAlerts(),
211479
+ mode: this.mode
211414
211480
  } }));
211415
211481
  }
211416
211482
  onModeSelect(e) {
211417
- this._mode = e.detail.value;
211418
- }
211419
- get metadata() {
211420
- return getAlertListModeData(this.selectedMode);
211421
- }
211422
- onAckClick(e) {
211423
- this.dispatchEvent(new CustomEvent("ack-click", { detail: { alert: e.detail.alert } }));
211424
- }
211425
- onRowClick(e) {
211426
- this.dispatchEvent(new CustomEvent("row-click", { detail: { alert: e.detail.alert } }));
211483
+ this.selectMode(e.detail.value);
211427
211484
  }
211428
211485
  render() {
211429
- const lists = [{
211430
- name: "all",
211431
- title: msg("All")
211432
- }, {
211433
- name: "unacked",
211434
- title: msg("Unacked")
211435
- }];
211436
- if (this.hasShelved) lists.push({
211437
- name: "shelved",
211438
- title: msg("Shelved")
211439
- });
211440
- const metadata = this.metadata;
211441
- const canAckAll = this.alerts.some(canAckFilter(metadata.filter));
211442
211486
  return b`
211443
211487
  <div class="wrapper">
211444
- <obc-alert-list-details
211445
- class="alert-list"
211446
- .small=${true}
211447
- .alerts=${this.alerts}
211448
- .selectedMode=${this._mode}
211449
- .showTime=${this.showTime}
211450
- .timeFormatter=${this.timeFormatter}
211451
- @ack-click=${this.onAckClick}
211452
- @row-click=${this.onRowClick}
211453
- ></obc-alert-list-details>
211488
+ ${this.renderList()}
211454
211489
  <div class="action">
211455
211490
  <div class="btn-group">
211456
211491
  <obc-dropdown-button
211457
- .value=${this._mode}
211492
+ .value=${this.mode}
211458
211493
  @change=${this.onModeSelect}
211459
- .options=${lists.map((v) => ({
211460
- value: v.name,
211461
- label: v.title
211462
- }))}
211494
+ .options=${this.modes}
211463
211495
  >
211464
211496
  </obc-dropdown-button>
211465
211497
  </div>
@@ -211472,16 +211504,16 @@ var ObcAlertListPageSmall = class ObcAlertListPageSmall extends i$4 {
211472
211504
  >
211473
211505
  <obi-silence-iec></obi-silence-iec>
211474
211506
  </obc-icon-button>
211475
- <obc-button
211476
- .variant=${ButtonVariant.raised}
211477
- .disabled=${!canAckAll}
211478
- fullWidth
211479
- class="btn"
211480
- data-testid="ack-all-visible-button"
211481
- @click=${() => this.handleAckAllVisibleClick()}
211482
- >
211483
- ${msg("ACK visible")}
211484
- </obc-button>
211507
+ ${this.offersAckAll ? b`<obc-button
211508
+ .variant=${ButtonVariant.raised}
211509
+ .disabled=${!this.canAckAll}
211510
+ fullWidth
211511
+ class="btn"
211512
+ data-testid="ack-all-visible-button"
211513
+ @click=${() => this.handleAckAllVisibleClick()}
211514
+ >
211515
+ ${msg("ACK visible")}
211516
+ </obc-button>` : A}
211485
211517
  </div>
211486
211518
  </div>
211487
211519
  </div>
@@ -211491,11 +211523,68 @@ var ObcAlertListPageSmall = class ObcAlertListPageSmall extends i$4 {
211491
211523
  this.styles = r$7(alert_list_page_small_default);
211492
211524
  }
211493
211525
  };
211494
- __decorate([n$4({ type: Boolean })], ObcAlertListPageSmall.prototype, "hasShelved", void 0);
211495
- __decorate([n$4({ type: String })], ObcAlertListPageSmall.prototype, "selectedMode", void 0);
211526
+ __decorate([n$4({ type: Boolean })], ObcAlertListPageSmallBase.prototype, "hasShelved", void 0);
211527
+ __decorate([n$4({ type: Boolean })], ObcAlertListPageSmallBase.prototype, "showTime", void 0);
211528
+ __decorate([n$4({ attribute: false })], ObcAlertListPageSmallBase.prototype, "timeFormatter", void 0);
211529
+ //#endregion
211530
+ //#region src/pages/alert-list-page-small/alert-list-page-small.ts
211531
+ var ObcAlertListPageSmall = class ObcAlertListPageSmall extends ObcAlertListPageSmallBase {
211532
+ constructor(..._args) {
211533
+ super(..._args);
211534
+ this.alerts = [];
211535
+ this.selectedMode = "all";
211536
+ this._mode = "all";
211537
+ }
211538
+ willUpdate(changedProperties) {
211539
+ if (changedProperties.has("selectedMode") && this._mode !== this.selectedMode) this._mode = this.selectedMode;
211540
+ }
211541
+ get modes() {
211542
+ const modes = [{
211543
+ value: "all",
211544
+ label: msg("All")
211545
+ }, {
211546
+ value: "unacked",
211547
+ label: msg("Unacked")
211548
+ }];
211549
+ if (this.hasShelved) modes.push({
211550
+ value: "shelved",
211551
+ label: msg("Shelved")
211552
+ });
211553
+ return modes;
211554
+ }
211555
+ get mode() {
211556
+ return this._mode;
211557
+ }
211558
+ selectMode(mode) {
211559
+ this._mode = mode;
211560
+ }
211561
+ get canAckAll() {
211562
+ return this.alerts.some(canAckFilter(getAlertListModeData(this._mode).filter));
211563
+ }
211564
+ visibleAlerts() {
211565
+ return this.alertList.getVisibleAlerts();
211566
+ }
211567
+ onAckClick(e) {
211568
+ this.dispatchAckClick(e.detail.alert);
211569
+ }
211570
+ onRowClick(e) {
211571
+ this.dispatchRowClick(e.detail.alert);
211572
+ }
211573
+ renderList() {
211574
+ return b`<obc-alert-list-details
211575
+ class="alert-list"
211576
+ .small=${true}
211577
+ .alerts=${this.alerts}
211578
+ .selectedMode=${this._mode}
211579
+ .showTime=${this.showTime}
211580
+ .timeFormatter=${this.timeFormatter}
211581
+ @ack-click=${this.onAckClick}
211582
+ @row-click=${this.onRowClick}
211583
+ ></obc-alert-list-details>`;
211584
+ }
211585
+ };
211496
211586
  __decorate([n$4({ type: Array })], ObcAlertListPageSmall.prototype, "alerts", void 0);
211497
- __decorate([n$4({ type: Boolean })], ObcAlertListPageSmall.prototype, "showTime", void 0);
211498
- __decorate([n$4({ attribute: false })], ObcAlertListPageSmall.prototype, "timeFormatter", void 0);
211587
+ __decorate([n$4({ type: String })], ObcAlertListPageSmall.prototype, "selectedMode", void 0);
211499
211588
  __decorate([r$3()], ObcAlertListPageSmall.prototype, "_mode", void 0);
211500
211589
  __decorate([e$4("obc-alert-list-details")], ObcAlertListPageSmall.prototype, "alertList", void 0);
211501
211590
  ObcAlertListPageSmall = __decorate([customElement("obc-alert-list-page-small")], ObcAlertListPageSmall);