@oicl/openbridge-webcomponents 2.0.0-next.153 → 2.0.0-next.155

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 (33) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +438 -238
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +260 -50
  4. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js +3 -7
  5. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js.map +1 -1
  6. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts +133 -14
  7. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts.map +1 -1
  8. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js +330 -233
  9. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js.map +1 -1
  10. package/dist/components/table/table.d.ts.map +1 -1
  11. package/dist/components/table/table.js +10 -2
  12. package/dist/components/table/table.js.map +1 -1
  13. package/dist/components/user-button/user-button.css.js +68 -1
  14. package/dist/components/user-button/user-button.css.js.map +1 -1
  15. package/dist/components/user-button/user-button.d.ts +12 -1
  16. package/dist/components/user-button/user-button.d.ts.map +1 -1
  17. package/dist/components/user-button/user-button.js +12 -3
  18. package/dist/components/user-button/user-button.js.map +1 -1
  19. package/dist/components/user-menu/user-menu.css.js +15 -0
  20. package/dist/components/user-menu/user-menu.css.js.map +1 -1
  21. package/dist/components/user-menu/user-menu.d.ts +30 -2
  22. package/dist/components/user-menu/user-menu.d.ts.map +1 -1
  23. package/dist/components/user-menu/user-menu.js +34 -2
  24. package/dist/components/user-menu/user-menu.js.map +1 -1
  25. package/dist/generated/locales/es-419.d.ts +1 -0
  26. package/dist/generated/locales/es-419.d.ts.map +1 -1
  27. package/dist/generated/locales/es-419.js +1 -0
  28. package/dist/generated/locales/es-419.js.map +1 -1
  29. package/dist/generated/locales/fi-FI.d.ts +1 -0
  30. package/dist/generated/locales/fi-FI.d.ts.map +1 -1
  31. package/dist/generated/locales/fi-FI.js +1 -0
  32. package/dist/generated/locales/fi-FI.js.map +1 -1
  33. package/package.json +2 -2
@@ -84020,6 +84020,7 @@ const compentStyle$W = i$7`* {
84020
84020
  .alert-list {
84021
84021
  min-height: 0;
84022
84022
  flex-grow: 0;
84023
+ --alert-list-grid-columns: 1fr;
84023
84024
  }
84024
84025
 
84025
84026
  .spacer {
@@ -84044,13 +84045,8 @@ const compentStyle$W = i$7`* {
84044
84045
  }
84045
84046
 
84046
84047
  obc-table::part(grid) {
84047
- grid-template-columns: 1fr repeat(4, min-content);
84048
- }
84049
-
84050
- .wrapper.small obc-table::part(grid) {
84051
- grid-template-columns: 1fr min-content var(
84052
- --app-components-alert-table-row-ack-container-width-small
84053
- );
84048
+ /* set from columns[].width */
84049
+ grid-template-columns: var(--alert-list-grid-columns);
84054
84050
  }
84055
84051
 
84056
84052
  .empty-list {
@@ -85431,6 +85427,7 @@ var ObcTableCellType = /* @__PURE__ */ ((ObcTableCellType2) => {
85431
85427
  ObcTableCellType2["HorizontalBar"] = "horizontal-bar";
85432
85428
  return ObcTableCellType2;
85433
85429
  })(ObcTableCellType || {});
85430
+ const INTERACTIVE_SELECTOR = 'button, a[href], input, select, textarea, [role="button"], [role="link"], [role="checkbox"]';
85434
85431
  function cssPart(value, subpart) {
85435
85432
  if (value.cssPart) {
85436
85433
  return `${value.cssPart} ${subpart}`;
@@ -85537,7 +85534,14 @@ let ObcTable = class extends i$4 {
85537
85534
  this._sortDirection = "asc";
85538
85535
  }
85539
85536
  }
85540
- _handleRowClick(row) {
85537
+ _handleRowClick(event, row) {
85538
+ const rowElement = event.currentTarget;
85539
+ for (const node of event.composedPath()) {
85540
+ if (node === rowElement) break;
85541
+ if (node instanceof Element && node.matches(INTERACTIVE_SELECTOR)) {
85542
+ return;
85543
+ }
85544
+ }
85541
85545
  this.dispatchEvent(
85542
85546
  new CustomEvent("row-click", { detail: { row } })
85543
85547
  );
@@ -85904,7 +85908,7 @@ let ObcTable = class extends i$4 {
85904
85908
  "selected-with-next": isRowSelected && hasSelectedNextRow,
85905
85909
  striped: isStriped
85906
85910
  })}
85907
- @click=${() => this._handleRowClick(row)}
85911
+ @click=${(event) => this._handleRowClick(event, row)}
85908
85912
  @keydown=${this._handleRowKeyDown}
85909
85913
  data-row-id=${row.id}
85910
85914
  style="grid-row: ${rowIndex + 1}"
@@ -86303,8 +86307,8 @@ var __decorateClass$v3 = (decorators, target, key, kind) => {
86303
86307
  if (kind && result) __defProp$u$(target, key, result);
86304
86308
  return result;
86305
86309
  };
86306
- function getAlertListModeData$1(selectedMode) {
86307
- if (selectedMode === "all")
86310
+ function getFilterModeData(filterMode) {
86311
+ if (filterMode === "all")
86308
86312
  return {
86309
86313
  name: "all",
86310
86314
  title: msg("All"),
@@ -86312,7 +86316,7 @@ function getAlertListModeData$1(selectedMode) {
86312
86316
  emptyIcon: b`<obi-alerts></obi-alerts>`,
86313
86317
  filter: (alert) => !isShelved(alert) && isActive(alert)
86314
86318
  };
86315
- else if (selectedMode === "unacked")
86319
+ else if (filterMode === "unacked")
86316
86320
  return {
86317
86321
  name: "unacked",
86318
86322
  title: msg("Unacked"),
@@ -86320,7 +86324,7 @@ function getAlertListModeData$1(selectedMode) {
86320
86324
  emptyIcon: b`<obi-unacknowledged></obi-unacknowledged>`,
86321
86325
  filter: (alert) => !isAcknowledged(alert) && isActive(alert) && !excludedFromUnackedFilter(alert.type) && !isShelved(alert)
86322
86326
  };
86323
- else if (selectedMode === "shelved")
86327
+ else if (filterMode === "shelved")
86324
86328
  return {
86325
86329
  name: "shelved",
86326
86330
  title: msg("Shelved"),
@@ -86328,7 +86332,7 @@ function getAlertListModeData$1(selectedMode) {
86328
86332
  emptyIcon: b`<obi-alerts-shelf></obi-alerts-shelf>`,
86329
86333
  filter: (alert) => isShelved(alert)
86330
86334
  };
86331
- else if (selectedMode === "blocked")
86335
+ else if (filterMode === "blocked")
86332
86336
  return {
86333
86337
  name: "blocked",
86334
86338
  title: msg("Blocked"),
@@ -86336,7 +86340,7 @@ function getAlertListModeData$1(selectedMode) {
86336
86340
  emptyIcon: b`<obi-alerts-active></obi-alerts-active>`,
86337
86341
  filter: (alert) => isBlocked(alert)
86338
86342
  };
86339
- else if (selectedMode === "rectified")
86343
+ else if (filterMode === "rectified")
86340
86344
  return {
86341
86345
  name: "rectified",
86342
86346
  title: msg("Rectified"),
@@ -86344,19 +86348,196 @@ function getAlertListModeData$1(selectedMode) {
86344
86348
  emptyIcon: b`<obi-alarm-rectified-iec></obi-alarm-rectified-iec>`,
86345
86349
  filter: (alert) => !isActive(alert)
86346
86350
  };
86347
- else throw new Error("Invalid selected mode");
86351
+ else throw new Error("Invalid filter mode");
86352
+ }
86353
+ function alertListCellSlotName(columnKey, rowId) {
86354
+ return `cell-${encodeURIComponent(columnKey)}:${rowId}`;
86355
+ }
86356
+ function statusColumn(options = {}) {
86357
+ return {
86358
+ key: "status",
86359
+ label: "Status",
86360
+ sortDirection: "desc",
86361
+ compare: comparePriorityAlerts,
86362
+ cell: (alert) => ({
86363
+ type: ObcTableCellType.Regular,
86364
+ largeIcon: true,
86365
+ text: alert.text,
86366
+ title: alert.source,
86367
+ noWrap: true,
86368
+ icon: b`<obc-alert-icon
86369
+ .type=${alert.type}
86370
+ .acknowledged=${isAcknowledged(alert)}
86371
+ .active=${isActive(alert)}
86372
+ ></obc-alert-icon>`
86373
+ }),
86374
+ ...options
86375
+ };
86376
+ }
86377
+ function ackColumn(options = {}) {
86378
+ return {
86379
+ key: "ack",
86380
+ label: "ACK-status",
86381
+ cell: (alert) => {
86382
+ if (isAcknowledged(alert) || !isActive(alert) || !requiresAcknowledgement(alert.type)) {
86383
+ return { type: ObcTableCellType.Regular };
86384
+ }
86385
+ if (alert.noAck) {
86386
+ const icon = usesAlarmNoAckIcon(alert.type) ? b`<obi-alarm-noack-iec usecsscolor></obi-alarm-noack-iec>` : b`<obi-warning-noack-iec usecsscolor></obi-warning-noack-iec>`;
86387
+ return {
86388
+ type: ObcTableCellType.Regular,
86389
+ largeIcon: true,
86390
+ icon,
86391
+ align: "center"
86392
+ };
86393
+ }
86394
+ return { type: ObcTableCellType.Button, text: msg("ACK") };
86395
+ },
86396
+ ...options
86397
+ };
86398
+ }
86399
+ function tagIdColumn(options = {}) {
86400
+ return {
86401
+ key: "tagId",
86402
+ label: "Tag ID",
86403
+ compare: (a2, b2) => a2.tagId.localeCompare(b2.tagId),
86404
+ cell: (alert) => ({
86405
+ type: ObcTableCellType.Regular,
86406
+ text: "#" + alert.tagId,
86407
+ align: "right"
86408
+ }),
86409
+ ...options
86410
+ };
86411
+ }
86412
+ function isSlotColumn(column) {
86413
+ return "slot" in column && column.slot === true;
86414
+ }
86415
+ function parentRowIdOf(rowId) {
86416
+ const separatorIndex = rowId.lastIndexOf("/");
86417
+ return separatorIndex === -1 ? void 0 : rowId.slice(0, separatorIndex);
86418
+ }
86419
+ const TABLE_KEY_PREFIX = "column-";
86420
+ function walkAlertRows(alerts, isExpanded) {
86421
+ const alertIds = new Set(alerts.map((alert) => alert.id));
86422
+ const membersByGroupId = /* @__PURE__ */ new Map();
86423
+ const roots = [];
86424
+ for (const alert of alerts) {
86425
+ const groupIds = (alert.memberOf ?? []).filter(
86426
+ (groupId) => groupId !== alert.id && alertIds.has(groupId)
86427
+ );
86428
+ if (groupIds.length === 0) {
86429
+ roots.push(alert);
86430
+ continue;
86431
+ }
86432
+ for (const groupId of groupIds) {
86433
+ const members = membersByGroupId.get(groupId) ?? [];
86434
+ members.push(alert);
86435
+ membersByGroupId.set(groupId, members);
86436
+ }
86437
+ }
86438
+ const reachable = /* @__PURE__ */ new Set();
86439
+ const markReachable = (alert) => {
86440
+ if (reachable.has(alert.id)) {
86441
+ return;
86442
+ }
86443
+ reachable.add(alert.id);
86444
+ for (const member of membersByGroupId.get(alert.id) ?? []) {
86445
+ markReachable(member);
86446
+ }
86447
+ };
86448
+ roots.forEach(markReachable);
86449
+ for (const alert of alerts) {
86450
+ if (!reachable.has(alert.id)) {
86451
+ roots.push(alert);
86452
+ markReachable(alert);
86453
+ }
86454
+ }
86455
+ const rows = [];
86456
+ const visit = (alert, level, parentRowId, ancestors) => {
86457
+ const segment = encodeURIComponent(alert.id);
86458
+ const rowId = parentRowId === void 0 ? segment : `${parentRowId}/${segment}`;
86459
+ const members = membersByGroupId.get(alert.id) ?? [];
86460
+ const expandableMembers = members.filter(
86461
+ (member) => !ancestors.has(member.id)
86462
+ );
86463
+ rows.push({
86464
+ rowId,
86465
+ parentRowId,
86466
+ alert,
86467
+ level,
86468
+ expandable: expandableMembers.length > 0
86469
+ });
86470
+ if (!isExpanded(rowId)) {
86471
+ return;
86472
+ }
86473
+ const nextAncestors = new Set(ancestors).add(alert.id);
86474
+ for (const member of expandableMembers) {
86475
+ visit(member, level + 1, rowId, nextAncestors);
86476
+ }
86477
+ };
86478
+ for (const alert of roots) {
86479
+ visit(alert, 0, void 0, /* @__PURE__ */ new Set());
86480
+ }
86481
+ return rows;
86482
+ }
86483
+ function getAlertRows(alerts, filterMode) {
86484
+ const { filter } = getFilterModeData(filterMode);
86485
+ return walkAlertRows(alerts.filter(filter), () => true);
86348
86486
  }
86349
86487
  let ObcAlertListDetailsExperimental = class extends i$4 {
86350
86488
  constructor() {
86351
86489
  super(...arguments);
86352
- this.selectedMode = "all";
86490
+ this.filterMode = "all";
86353
86491
  this.alerts = [];
86354
- this.showTime = false;
86355
- this.timeFormatter = (time) => time.toLocaleTimeString(void 0, { hour12: false });
86356
- this.small = false;
86492
+ this.columns = [
86493
+ statusColumn(),
86494
+ ackColumn({ dividerRight: true }),
86495
+ tagIdColumn()
86496
+ ];
86497
+ this.showHeader = true;
86357
86498
  this.defaultExpanded = true;
86358
86499
  this.expansionOverrides = /* @__PURE__ */ new Map();
86359
86500
  this.alertByRowId = /* @__PURE__ */ new Map();
86501
+ this.allRowIds = /* @__PURE__ */ new Set();
86502
+ this._cellSlots = [];
86503
+ this.cellSlotsChanged = false;
86504
+ }
86505
+ /** Slot of every cell in a slot column, rows in collapsed groups included. */
86506
+ get cellSlots() {
86507
+ return this._cellSlots;
86508
+ }
86509
+ willUpdate(changed) {
86510
+ if (!changed.has("alerts") && !changed.has("columns") && !changed.has("filterMode")) {
86511
+ return;
86512
+ }
86513
+ const rows = getAlertRows(this.alerts, this.filterMode);
86514
+ this.allRowIds = new Set(rows.map((row) => row.rowId));
86515
+ const slotColumns = this.columns.filter(isSlotColumn);
86516
+ const next = getAlertRows(this.alerts, this.filterMode).flatMap(
86517
+ (row) => slotColumns.map((column) => ({
86518
+ name: alertListCellSlotName(column.key, row.rowId),
86519
+ alert: row.alert,
86520
+ rowId: row.rowId,
86521
+ columnKey: column.key
86522
+ }))
86523
+ );
86524
+ const unchanged = next.length === this._cellSlots.length && next.every(
86525
+ (slot, index2) => slot.name === this._cellSlots[index2].name && slot.alert === this._cellSlots[index2].alert
86526
+ );
86527
+ if (!unchanged) {
86528
+ this._cellSlots = next;
86529
+ this.cellSlotsChanged = true;
86530
+ }
86531
+ }
86532
+ updated() {
86533
+ if (this.cellSlotsChanged) {
86534
+ this.cellSlotsChanged = false;
86535
+ this.dispatchEvent(
86536
+ new CustomEvent("cell-slots-change", {
86537
+ detail: this._cellSlots
86538
+ })
86539
+ );
86540
+ }
86360
86541
  }
86361
86542
  getVisibleAlerts() {
86362
86543
  const seen = /* @__PURE__ */ new Set();
@@ -86369,19 +86550,27 @@ let ObcAlertListDetailsExperimental = class extends i$4 {
86369
86550
  });
86370
86551
  }
86371
86552
  onRowClick(e2) {
86372
- const row = this.alertByRowId.get(e2.detail.row.id);
86373
- if (row) {
86553
+ const rowId = e2.detail.row.id;
86554
+ const alert = this.alertByRowId.get(rowId);
86555
+ if (alert) {
86374
86556
  this.dispatchEvent(
86375
- new CustomEvent("row-click", { detail: { alert: row } })
86557
+ new CustomEvent("row-click", {
86558
+ detail: { alert, rowId }
86559
+ })
86376
86560
  );
86377
86561
  }
86378
86562
  }
86379
86563
  onCellButtonClick(e2) {
86380
- const row = this.alertByRowId.get(e2.detail.rowId);
86381
- if (row) {
86564
+ const { rowId, columnKey } = e2.detail;
86565
+ const alert = this.alertByRowId.get(rowId);
86566
+ if (alert) {
86382
86567
  this.dispatchEvent(
86383
- new CustomEvent("ack-click", {
86384
- detail: { alert: row },
86568
+ new CustomEvent("cell-click", {
86569
+ detail: {
86570
+ alert,
86571
+ columnKey: columnKey.slice(TABLE_KEY_PREFIX.length),
86572
+ rowId
86573
+ },
86385
86574
  bubbles: false
86386
86575
  })
86387
86576
  );
@@ -86395,226 +86584,114 @@ let ObcAlertListDetailsExperimental = class extends i$4 {
86395
86584
  isExpanded(rowId) {
86396
86585
  return this.expansionOverrides.get(rowId) ?? this.defaultExpanded;
86397
86586
  }
86398
- get columns() {
86399
- if (this.small) {
86400
- const columns = [
86401
- {
86402
- label: "Status",
86403
- key: "status",
86404
- sortDirection: "desc",
86405
- sortable: true,
86406
- compareFunction: (_a, _b, aRow, bRow) => {
86407
- const aAlert = this.alertByRowId.get(aRow.id);
86408
- const bAlert = this.alertByRowId.get(bRow.id);
86409
- if (aAlert && bAlert) {
86410
- return comparePriorityAlerts(aAlert, bAlert);
86411
- }
86412
- return 0;
86413
- }
86414
- }
86415
- ];
86416
- if (this.showTime) {
86417
- columns.push({
86418
- label: "Activated",
86419
- key: "time"
86420
- });
86587
+ compareRows(compare, aRow, bRow) {
86588
+ const aAlert = this.alertByRowId.get(aRow.id);
86589
+ const bAlert = this.alertByRowId.get(bRow.id);
86590
+ return aAlert && bAlert ? compare(aAlert, bAlert) : 0;
86591
+ }
86592
+ get tableColumns() {
86593
+ return this.columns.map((column) => {
86594
+ const base = {
86595
+ label: column.label,
86596
+ key: TABLE_KEY_PREFIX + column.key,
86597
+ dividerRight: column.dividerRight
86598
+ };
86599
+ if (isSlotColumn(column)) {
86600
+ return {
86601
+ ...base,
86602
+ renderCell: (_value, row) => b`<slot
86603
+ name=${alertListCellSlotName(column.key, row.id)}
86604
+ ></slot>`
86605
+ };
86421
86606
  }
86422
- columns.push({
86423
- label: "ACK-status",
86424
- key: "action"
86425
- });
86426
- return columns;
86427
- } else {
86428
- const columns = [
86429
- {
86430
- label: "Status",
86431
- key: "status",
86432
- sortDirection: "desc",
86433
- sortable: true,
86434
- compareFunction: (_a, _b, aRow, bRow) => {
86435
- const aAlert = this.alertByRowId.get(aRow.id);
86436
- const bAlert = this.alertByRowId.get(bRow.id);
86437
- if (aAlert && bAlert) {
86438
- return comparePriorityAlerts(aAlert, bAlert);
86439
- }
86440
- return 0;
86441
- }
86442
- },
86443
- {
86444
- label: "ACK-status",
86445
- key: "action",
86446
- dividerRight: true
86447
- }
86448
- ];
86449
- if (this.showTime) {
86450
- columns.push({
86451
- label: "Activated",
86452
- key: "time",
86607
+ const { compare } = column;
86608
+ if (compare) {
86609
+ return {
86610
+ ...base,
86453
86611
  sortable: true,
86454
- compareFunction: (_a, _b, aRow, bRow) => {
86455
- const aAlert = this.alertByRowId.get(aRow.id);
86456
- const bAlert = this.alertByRowId.get(bRow.id);
86457
- if (aAlert && bAlert) {
86458
- const aTime = new Date(aAlert.time);
86459
- const bTime = new Date(bAlert.time);
86460
- return aTime.getTime() - bTime.getTime();
86461
- }
86462
- return 0;
86463
- }
86464
- });
86612
+ sortDirection: column.sortDirection,
86613
+ compareFunction: (_a, _b, aRow, bRow) => this.compareRows(compare, aRow, bRow)
86614
+ };
86465
86615
  }
86466
- columns.push({
86467
- label: "Tag ID",
86468
- key: "tagId",
86469
- sortable: true,
86470
- compareFunction: (a2, b2) => {
86471
- const aText = a2?.type === ObcTableCellType.Regular ? String(a2.text ?? "") : "";
86472
- const bText = b2?.type === ObcTableCellType.Regular ? String(b2.text ?? "") : "";
86473
- return aText.localeCompare(bText);
86474
- }
86475
- });
86476
- return columns;
86477
- }
86616
+ return base;
86617
+ });
86478
86618
  }
86479
- get metadata() {
86480
- return getAlertListModeData$1(this.selectedMode);
86619
+ get gridColumns() {
86620
+ const columnTracks = this.columns.map(
86621
+ (column, index2) => column.width ?? (index2 === 0 ? "1fr" : "min-content")
86622
+ );
86623
+ return [...columnTracks, "min-content"].join(" ");
86481
86624
  }
86482
- get filteredAlerts() {
86483
- return this.alerts.filter(this.metadata.filter);
86625
+ get metadata() {
86626
+ return getFilterModeData(this.filterMode);
86484
86627
  }
86485
86628
  buildVisibleRows() {
86486
- const alerts = this.filteredAlerts;
86487
- const alertIds = new Set(alerts.map((alert) => alert.id));
86488
- const membersByGroupId = /* @__PURE__ */ new Map();
86489
- const roots = [];
86490
- for (const alert of alerts) {
86491
- const groupIds = (alert.memberOf ?? []).filter(
86492
- (groupId) => groupId !== alert.id && alertIds.has(groupId)
86493
- );
86494
- if (groupIds.length === 0) {
86495
- roots.push(alert);
86496
- continue;
86497
- }
86498
- for (const groupId of groupIds) {
86499
- const members = membersByGroupId.get(groupId) ?? [];
86500
- members.push(alert);
86501
- membersByGroupId.set(groupId, members);
86502
- }
86629
+ const rows = walkAlertRows(
86630
+ this.alerts.filter(this.metadata.filter),
86631
+ (rowId) => this.isExpanded(rowId)
86632
+ );
86633
+ this.alertByRowId = new Map(rows.map((row) => [row.rowId, row.alert]));
86634
+ const highlightedRowId = this.highlightedRowId();
86635
+ return rows.map((row) => ({
86636
+ ...this.buildRowCells(row.alert),
86637
+ id: row.rowId,
86638
+ parentId: row.parentRowId,
86639
+ level: row.level,
86640
+ expandable: row.expandable,
86641
+ expanded: this.isExpanded(row.rowId),
86642
+ selected: row.rowId === highlightedRowId
86643
+ }));
86644
+ }
86645
+ /** The selected row, or the nearest visible group row when a collapsed group hides it. */
86646
+ highlightedRowId() {
86647
+ if (this.selectedRowId === void 0 || !this.allRowIds.has(this.selectedRowId)) {
86648
+ return void 0;
86503
86649
  }
86504
- const reachable = /* @__PURE__ */ new Set();
86505
- const markReachable = (alert) => {
86506
- if (reachable.has(alert.id)) {
86507
- return;
86508
- }
86509
- reachable.add(alert.id);
86510
- for (const member of membersByGroupId.get(alert.id) ?? []) {
86511
- markReachable(member);
86512
- }
86513
- };
86514
- roots.forEach(markReachable);
86515
- for (const alert of alerts) {
86516
- if (!reachable.has(alert.id)) {
86517
- roots.push(alert);
86518
- markReachable(alert);
86519
- }
86650
+ let rowId = this.selectedRowId;
86651
+ while (rowId !== void 0 && !this.alertByRowId.has(rowId)) {
86652
+ rowId = parentRowIdOf(rowId);
86520
86653
  }
86521
- const rows = [];
86522
- this.alertByRowId = /* @__PURE__ */ new Map();
86523
- const visit = (alert, level, parentRowId, ancestors) => {
86524
- const segment = encodeURIComponent(alert.id);
86525
- const rowId = parentRowId === void 0 ? segment : `${parentRowId}/${segment}`;
86526
- const members = membersByGroupId.get(alert.id) ?? [];
86527
- const expandableMembers = members.filter(
86528
- (member) => !ancestors.has(member.id)
86529
- );
86530
- const expanded = this.isExpanded(rowId);
86531
- this.alertByRowId.set(rowId, alert);
86532
- rows.push({
86533
- ...this.buildRowCells(alert),
86534
- id: rowId,
86535
- parentId: parentRowId,
86536
- level,
86537
- expandable: expandableMembers.length > 0,
86538
- expanded
86539
- });
86540
- if (!expanded) {
86541
- return;
86542
- }
86543
- const nextAncestors = new Set(ancestors).add(alert.id);
86544
- for (const member of expandableMembers) {
86545
- visit(member, level + 1, rowId, nextAncestors);
86546
- }
86547
- };
86548
- for (const alert of roots) {
86549
- visit(alert, 0, void 0, /* @__PURE__ */ new Set());
86550
- }
86551
- return rows;
86654
+ return rowId;
86552
86655
  }
86553
86656
  buildRowCells(alert) {
86554
- let action = {
86555
- type: ObcTableCellType.Regular
86556
- };
86557
- if (!isAcknowledged(alert) && isActive(alert) && requiresAcknowledgement(alert.type)) {
86558
- if (alert.noAck) {
86559
- const icon = usesAlarmNoAckIcon(alert.type) ? b`<obi-alarm-noack-iec usecsscolor></obi-alarm-noack-iec>` : b`<obi-warning-noack-iec usecsscolor></obi-warning-noack-iec>`;
86560
- action = {
86561
- type: ObcTableCellType.Regular,
86562
- largeIcon: true,
86563
- icon,
86564
- align: "center"
86565
- };
86566
- } else {
86567
- action = {
86568
- type: ObcTableCellType.Button,
86569
- text: msg("ACK")
86570
- };
86571
- }
86572
- }
86573
- const status = {
86574
- type: ObcTableCellType.Regular,
86575
- largeIcon: true,
86576
- text: alert.text,
86577
- title: alert.source,
86578
- noWrap: true,
86579
- icon: b`<obc-alert-icon
86580
- .type=${alert.type}
86581
- .acknowledged=${isAcknowledged(alert)}
86582
- .active=${isActive(alert)}
86583
- ></obc-alert-icon>`
86584
- };
86585
- const time = this.showTime ? {
86586
- type: ObcTableCellType.Regular,
86587
- text: this.timeFormatter(alert.time),
86588
- align: "center",
86589
- neutral: true
86590
- } : void 0;
86591
- const tagId = this.small ? void 0 : {
86592
- type: ObcTableCellType.Regular,
86593
- text: "#" + alert.id,
86594
- align: "right"
86595
- };
86596
- return {
86597
- status,
86598
- time,
86599
- action,
86600
- tagId
86601
- };
86657
+ const cells = {};
86658
+ for (const column of this.columns) {
86659
+ cells[TABLE_KEY_PREFIX + column.key] = isSlotColumn(column) ? (
86660
+ // obc-table skips renderCell for an undefined value.
86661
+ { type: ObcTableCellType.Regular }
86662
+ ) : column.cell(alert);
86663
+ }
86664
+ return cells;
86665
+ }
86666
+ slotNames(rows) {
86667
+ const slotColumns = this.columns.filter(isSlotColumn);
86668
+ return rows.flatMap(
86669
+ (row) => slotColumns.map((column) => alertListCellSlotName(column.key, row.id))
86670
+ );
86602
86671
  }
86603
86672
  render() {
86604
86673
  const selectedList = this.metadata;
86605
86674
  const data = this.buildVisibleRows();
86606
86675
  return b`
86607
- <div class="wrapper ${this.small ? "small" : ""}">
86676
+ <div class="wrapper">
86608
86677
  ${data.length > 0 ? b` <obc-table
86609
86678
  class="alert-list"
86679
+ style="--alert-list-grid-columns: ${this.gridColumns}"
86610
86680
  .data=${data}
86611
- .columns=${this.columns}
86681
+ .columns=${this.tableColumns}
86612
86682
  .striped=${true}
86613
- .showHeader=${!this.small}
86683
+ .showHeader=${this.showHeader}
86614
86684
  @row-click=${this.onRowClick}
86615
86685
  @cell-button-click=${this.onCellButtonClick}
86616
86686
  @expand-toggle=${this.onExpandToggle}
86617
- ></obc-table>
86687
+ >
86688
+ ${c(
86689
+ this.slotNames(data),
86690
+ (name) => name,
86691
+ // Forwards the host's slot into the one obc-table renders in the cell.
86692
+ (name) => b`<slot name=${name} slot=${name}></slot>`
86693
+ )}
86694
+ </obc-table>
86618
86695
  <div class="spacer"></div>` : b` <div class="empty-list">
86619
86696
  <div class="icon">${selectedList.emptyIcon}</div>
86620
86697
  <div class="empty-title">${selectedList.emptyTitle}</div>
@@ -86626,22 +86703,22 @@ let ObcAlertListDetailsExperimental = class extends i$4 {
86626
86703
  ObcAlertListDetailsExperimental.styles = r$7(compentStyle$W);
86627
86704
  __decorateClass$v3([
86628
86705
  n$3({ type: String })
86629
- ], ObcAlertListDetailsExperimental.prototype, "selectedMode", 2);
86706
+ ], ObcAlertListDetailsExperimental.prototype, "filterMode", 2);
86630
86707
  __decorateClass$v3([
86631
86708
  n$3({ type: Array })
86632
86709
  ], ObcAlertListDetailsExperimental.prototype, "alerts", 2);
86633
86710
  __decorateClass$v3([
86634
- n$3({ type: Boolean })
86635
- ], ObcAlertListDetailsExperimental.prototype, "showTime", 2);
86636
- __decorateClass$v3([
86637
- n$3({ attribute: false })
86638
- ], ObcAlertListDetailsExperimental.prototype, "timeFormatter", 2);
86711
+ n$3({ type: Array, attribute: false })
86712
+ ], ObcAlertListDetailsExperimental.prototype, "columns", 2);
86639
86713
  __decorateClass$v3([
86640
- n$3({ type: Boolean })
86641
- ], ObcAlertListDetailsExperimental.prototype, "small", 2);
86714
+ n$3({ type: Boolean, attribute: false })
86715
+ ], ObcAlertListDetailsExperimental.prototype, "showHeader", 2);
86642
86716
  __decorateClass$v3([
86643
86717
  n$3({ type: Boolean, attribute: false })
86644
86718
  ], ObcAlertListDetailsExperimental.prototype, "defaultExpanded", 2);
86719
+ __decorateClass$v3([
86720
+ n$3({ type: String })
86721
+ ], ObcAlertListDetailsExperimental.prototype, "selectedRowId", 2);
86645
86722
  __decorateClass$v3([
86646
86723
  e$3("obc-table")
86647
86724
  ], ObcAlertListDetailsExperimental.prototype, "alertList", 2);
@@ -93512,6 +93589,39 @@ const compentStyle$K = i$7`* {
93512
93589
  "ss04" on;
93513
93590
  }
93514
93591
 
93592
+ .wrapper.size-large .user-label {
93593
+ font-family: var(--global-typography-font-family);
93594
+ font-weight: var(--global-typography-ui-body-font-weight);
93595
+ font-size: var(--global-typography-ui-body-font-size);
93596
+ line-height: var(--global-typography-ui-body-line-height);
93597
+ font-feature-settings:
93598
+ "liga" off,
93599
+ "clig" off,
93600
+ "ss04" on;
93601
+ }
93602
+
93603
+ .wrapper.size-large .user-sublabel {
93604
+ font-family: var(--global-typography-font-family);
93605
+ font-weight: var(--global-typography-ui-body-font-weight);
93606
+ font-size: var(--global-typography-ui-body-font-size);
93607
+ line-height: var(--global-typography-ui-body-line-height);
93608
+ font-feature-settings:
93609
+ "liga" off,
93610
+ "clig" off,
93611
+ "ss04" on;
93612
+ }
93613
+
93614
+ .wrapper.size-large.has-sublabel .user-label {
93615
+ font-family: var(--global-typography-font-family);
93616
+ font-weight: var(--global-typography-ui-body-active-font-weight);
93617
+ font-size: var(--global-typography-ui-body-active-font-size);
93618
+ line-height: var(--global-typography-ui-body-active-line-height);
93619
+ font-feature-settings:
93620
+ "liga" off,
93621
+ "clig" off,
93622
+ "ss04" on;
93623
+ }
93624
+
93515
93625
  .wrapper.size-large.style-selected .user-initials {
93516
93626
  font-family: var(--global-typography-font-family);
93517
93627
  font-weight: var(--font-weight-bold);
@@ -93524,6 +93634,17 @@ const compentStyle$K = i$7`* {
93524
93634
  "ss04" on;
93525
93635
  }
93526
93636
 
93637
+ .wrapper.size-large.style-selected .user-label {
93638
+ font-family: var(--global-typography-font-family);
93639
+ font-weight: var(--global-typography-ui-body-active-font-weight);
93640
+ font-size: var(--global-typography-ui-body-active-font-size);
93641
+ line-height: var(--global-typography-ui-body-active-line-height);
93642
+ font-feature-settings:
93643
+ "liga" off,
93644
+ "clig" off,
93645
+ "ss04" on;
93646
+ }
93647
+
93527
93648
  .wrapper.size-large.state-static {
93528
93649
  width: var(--ui-components-user-button-visual-size-enhanced);
93529
93650
  height: var(--ui-components-user-button-visual-size-enhanced);
@@ -93545,7 +93666,30 @@ const compentStyle$K = i$7`* {
93545
93666
  color: var(--element-active-color);
93546
93667
  }
93547
93668
 
93548
- .wrapper:disabled .user-label {
93669
+ .wrapper .user-sublabel {
93670
+ font-family: var(--global-typography-font-family);
93671
+ font-weight: var(--global-typography-ui-label-font-weight);
93672
+ font-size: var(--global-typography-ui-label-font-size);
93673
+ line-height: var(--global-typography-ui-label-line-height);
93674
+ font-feature-settings:
93675
+ "liga" off,
93676
+ "clig" off,
93677
+ "ss04" on;
93678
+ color: var(--element-active-color);
93679
+ }
93680
+
93681
+ .wrapper.has-sublabel .user-label {
93682
+ font-family: var(--global-typography-font-family);
93683
+ font-weight: var(--global-typography-ui-label-active-font-weight);
93684
+ font-size: var(--global-typography-ui-label-active-font-size);
93685
+ line-height: var(--global-typography-ui-label-active-line-height);
93686
+ font-feature-settings:
93687
+ "liga" off,
93688
+ "clig" off,
93689
+ "ss04" on;
93690
+ }
93691
+
93692
+ .wrapper:disabled .user-label,.wrapper:disabled .user-sublabel {
93549
93693
  color: var(--element-disabled-color);
93550
93694
  }
93551
93695
 
@@ -93953,15 +94097,21 @@ let ObcUserButton = class extends i$4 {
93953
94097
  "mode-icon": this.shouldShowIcon,
93954
94098
  "mode-initials": !this.shouldShowIcon,
93955
94099
  "state-static": this.static,
93956
- [`size-${this.size}`]: true
94100
+ [`size-${this.size}`]: true,
94101
+ "has-sublabel": Boolean(this.sublabel) && !this.static
93957
94102
  };
93958
94103
  const tag = this.static ? i$2`div` : i$2`button`;
94104
+ const visibleText = [this.label, this.sublabel].filter(Boolean).join(", ");
94105
+ const accessibleName = !this.static && visibleText || this.initials || "User button";
93959
94106
  const label = this.label && !this.static ? u$2`<span class="user-label" part="label">${this.label}</span>` : A;
94107
+ const sublabel = this.sublabel && !this.static ? u$2`<span class="user-sublabel" part="sublabel">
94108
+ ${this.sublabel}
94109
+ </span>` : A;
93960
94110
  return u$2`
93961
94111
  <${tag}
93962
94112
  class=${e$1(wrapperClasses)}
93963
94113
  ?disabled=${this.disabled}
93964
- aria-label=${this.initials || "User button"}
94114
+ aria-label=${accessibleName}
93965
94115
  >
93966
94116
  <div class="content-container" part="content-container">
93967
94117
  <div class="user-button-circle">
@@ -93978,7 +94128,7 @@ let ObcUserButton = class extends i$4 {
93978
94128
  </span>
93979
94129
  `}
93980
94130
  </div>
93981
- ${label}
94131
+ ${label} ${sublabel}
93982
94132
  </div>
93983
94133
  </${tag}>
93984
94134
  `;
@@ -94006,6 +94156,9 @@ __decorateClass$uA([
94006
94156
  __decorateClass$uA([
94007
94157
  n$3({ type: String })
94008
94158
  ], ObcUserButton.prototype, "label", 2);
94159
+ __decorateClass$uA([
94160
+ n$3({ type: String })
94161
+ ], ObcUserButton.prototype, "sublabel", 2);
94009
94162
  ObcUserButton = __decorateClass$uA([
94010
94163
  customElement("obc-user-button")
94011
94164
  ], ObcUserButton);
@@ -124095,6 +124248,21 @@ const componentStyle$l = i$7`* {
124095
124248
  color: var(--element-neutral-color);
124096
124249
  }
124097
124250
 
124251
+ :is(.card .user-profile) obc-user-button:not(.has-role)::part(label) {
124252
+ font-weight: var(--font-weight-regular);
124253
+ }
124254
+
124255
+ :is(.card .user-profile) obc-user-button::part(sublabel) {
124256
+ font-family: var(--global-typography-font-family);
124257
+ font-weight: var(--global-typography-ui-body-font-weight);
124258
+ font-size: var(--global-typography-ui-body-font-size);
124259
+ line-height: var(--global-typography-ui-body-line-height);
124260
+ font-feature-settings:
124261
+ "liga" off,
124262
+ "clig" off,
124263
+ "ss04" on;
124264
+ }
124265
+
124098
124266
  .card .user-primary {
124099
124267
  padding: 0;
124100
124268
  }
@@ -124186,6 +124354,7 @@ let ObcUserMenu = class extends i$4 {
124186
124354
  this.passwordError = "";
124187
124355
  this.recentUsers = [];
124188
124356
  this.signedInActions = [];
124357
+ this.showUseAnotherAccount = true;
124189
124358
  }
124190
124359
  get showRecentUsers() {
124191
124360
  return this.hasRecentlySignedIn && this.recentUsers.length > 0;
@@ -124226,6 +124395,7 @@ let ObcUserMenu = class extends i$4 {
124226
124395
  .size=${size}
124227
124396
  .initials=${user.initials}
124228
124397
  .label=${user.label}
124398
+ .sublabel=${isLarge ? user.role : void 0}
124229
124399
  @click=${() => this.handleRecentUserClick(user)}
124230
124400
  ></obc-user-button>
124231
124401
  `
@@ -124238,6 +124408,7 @@ let ObcUserMenu = class extends i$4 {
124238
124408
  return A;
124239
124409
  }
124240
124410
  const userButtonSize = size === "large" ? Size.large : Size.regular;
124411
+ const role = size === "large" ? this.userRole : void 0;
124241
124412
  return b`
124242
124413
  <div
124243
124414
  class=${e$1({
@@ -124248,13 +124419,15 @@ let ObcUserMenu = class extends i$4 {
124248
124419
  <obc-user-button
124249
124420
  class=${e$1({
124250
124421
  "user-avatar": true,
124251
- [`size-${size}`]: true
124422
+ [`size-${size}`]: true,
124423
+ "has-role": Boolean(role)
124252
124424
  })}
124253
124425
  .variant=${Variant.initials}
124254
124426
  .styleType=${StyleType.normal}
124255
124427
  .size=${userButtonSize}
124256
124428
  .initials=${this.userInitials ?? ""}
124257
124429
  .label=${this.userLabel ?? ""}
124430
+ .sublabel=${role}
124258
124431
  ></obc-user-button>
124259
124432
  </div>
124260
124433
  `;
@@ -124286,7 +124459,7 @@ let ObcUserMenu = class extends i$4 {
124286
124459
  handleRecentUserClick(user) {
124287
124460
  this.dispatchEvent(
124288
124461
  new CustomEvent("recent-user-click", {
124289
- detail: { initials: user.initials, label: user.label }
124462
+ detail: { ...user }
124290
124463
  })
124291
124464
  );
124292
124465
  }
@@ -124334,6 +124507,9 @@ let ObcUserMenu = class extends i$4 {
124334
124507
  handleSignOutClick() {
124335
124508
  this.dispatchEvent(new CustomEvent("sign-out-click"));
124336
124509
  }
124510
+ handleUseAnotherAccountClick() {
124511
+ this.dispatchEvent(new CustomEvent("use-another-account-click"));
124512
+ }
124337
124513
  renderSignIn() {
124338
124514
  return b`
124339
124515
  <div class="title-container">
@@ -124454,6 +124630,15 @@ let ObcUserMenu = class extends i$4 {
124454
124630
  >
124455
124631
  ${msg("Sign in")}
124456
124632
  </obc-button>
124633
+ ${this.showUseAnotherAccount ? b`
124634
+ <obc-button
124635
+ variant=${ButtonVariant.normal}
124636
+ fullWidth
124637
+ @click=${this.handleUseAnotherAccountClick}
124638
+ >
124639
+ ${msg("Use another account")}
124640
+ </obc-button>
124641
+ ` : A}
124457
124642
  </div>
124458
124643
  </div>
124459
124644
  ${this.showRecentUsers ? b`
@@ -124496,6 +124681,15 @@ let ObcUserMenu = class extends i$4 {
124496
124681
  >
124497
124682
  ${msg("Sign in")}
124498
124683
  </obc-button>
124684
+ ${this.showUseAnotherAccount ? b`
124685
+ <obc-button
124686
+ variant=${ButtonVariant.normal}
124687
+ fullWidth
124688
+ @click=${this.handleUseAnotherAccountClick}
124689
+ >
124690
+ ${msg("Use another account")}
124691
+ </obc-button>
124692
+ ` : A}
124499
124693
  </div>
124500
124694
  ${this.showRecentUsers ? b`
124501
124695
  <div class="divider" aria-hidden="true"></div>
@@ -124674,6 +124868,9 @@ __decorateClass$sQ([
124674
124868
  __decorateClass$sQ([
124675
124869
  n$3({ type: String })
124676
124870
  ], ObcUserMenu.prototype, "userLabel", 2);
124871
+ __decorateClass$sQ([
124872
+ n$3({ type: String })
124873
+ ], ObcUserMenu.prototype, "userRole", 2);
124677
124874
  __decorateClass$sQ([
124678
124875
  n$3({ type: Array, attribute: false })
124679
124876
  ], ObcUserMenu.prototype, "recentUsers", 2);
@@ -124683,6 +124880,9 @@ __decorateClass$sQ([
124683
124880
  __decorateClass$sQ([
124684
124881
  n$3({ type: String })
124685
124882
  ], ObcUserMenu.prototype, "primaryActionId", 2);
124883
+ __decorateClass$sQ([
124884
+ n$3({ type: Boolean, attribute: false })
124885
+ ], ObcUserMenu.prototype, "showUseAnotherAccount", 2);
124686
124886
  ObcUserMenu = __decorateClass$sQ([
124687
124887
  customElement("obc-user-menu"),
124688
124888
  localized()