@oicl/openbridge-webcomponents 2.0.0-next.153 → 2.0.0-next.154
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/bundle/openbridge-webcomponents.bundle.js +309 -232
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +190 -46
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js +3 -7
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js.map +1 -1
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts +133 -14
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts.map +1 -1
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js +330 -233
- package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js.map +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +10 -2
- package/dist/components/table/table.js.map +1 -1
- 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
|
-
|
|
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
|
|
86307
|
-
if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
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.
|
|
86490
|
+
this.filterMode = "all";
|
|
86353
86491
|
this.alerts = [];
|
|
86354
|
-
this.
|
|
86355
|
-
|
|
86356
|
-
|
|
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
|
|
86373
|
-
|
|
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", {
|
|
86557
|
+
new CustomEvent("row-click", {
|
|
86558
|
+
detail: { alert, rowId }
|
|
86559
|
+
})
|
|
86376
86560
|
);
|
|
86377
86561
|
}
|
|
86378
86562
|
}
|
|
86379
86563
|
onCellButtonClick(e2) {
|
|
86380
|
-
const
|
|
86381
|
-
|
|
86564
|
+
const { rowId, columnKey } = e2.detail;
|
|
86565
|
+
const alert = this.alertByRowId.get(rowId);
|
|
86566
|
+
if (alert) {
|
|
86382
86567
|
this.dispatchEvent(
|
|
86383
|
-
new CustomEvent("
|
|
86384
|
-
detail: {
|
|
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
|
-
|
|
86399
|
-
|
|
86400
|
-
|
|
86401
|
-
|
|
86402
|
-
|
|
86403
|
-
|
|
86404
|
-
|
|
86405
|
-
|
|
86406
|
-
|
|
86407
|
-
|
|
86408
|
-
|
|
86409
|
-
|
|
86410
|
-
|
|
86411
|
-
|
|
86412
|
-
|
|
86413
|
-
|
|
86414
|
-
|
|
86415
|
-
|
|
86416
|
-
|
|
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
|
-
|
|
86423
|
-
|
|
86424
|
-
|
|
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
|
-
|
|
86455
|
-
|
|
86456
|
-
|
|
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
|
-
|
|
86467
|
-
|
|
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
|
|
86480
|
-
|
|
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
|
|
86483
|
-
return
|
|
86625
|
+
get metadata() {
|
|
86626
|
+
return getFilterModeData(this.filterMode);
|
|
86484
86627
|
}
|
|
86485
86628
|
buildVisibleRows() {
|
|
86486
|
-
const
|
|
86487
|
-
|
|
86488
|
-
|
|
86489
|
-
|
|
86490
|
-
|
|
86491
|
-
|
|
86492
|
-
|
|
86493
|
-
)
|
|
86494
|
-
|
|
86495
|
-
|
|
86496
|
-
|
|
86497
|
-
|
|
86498
|
-
|
|
86499
|
-
|
|
86500
|
-
|
|
86501
|
-
|
|
86502
|
-
|
|
86503
|
-
|
|
86504
|
-
|
|
86505
|
-
|
|
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
|
-
}
|
|
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;
|
|
86520
86649
|
}
|
|
86521
|
-
|
|
86522
|
-
|
|
86523
|
-
|
|
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());
|
|
86650
|
+
let rowId = this.selectedRowId;
|
|
86651
|
+
while (rowId !== void 0 && !this.alertByRowId.has(rowId)) {
|
|
86652
|
+
rowId = parentRowIdOf(rowId);
|
|
86550
86653
|
}
|
|
86551
|
-
return
|
|
86654
|
+
return rowId;
|
|
86552
86655
|
}
|
|
86553
86656
|
buildRowCells(alert) {
|
|
86554
|
-
|
|
86555
|
-
|
|
86556
|
-
|
|
86557
|
-
|
|
86558
|
-
|
|
86559
|
-
|
|
86560
|
-
|
|
86561
|
-
|
|
86562
|
-
|
|
86563
|
-
|
|
86564
|
-
|
|
86565
|
-
|
|
86566
|
-
|
|
86567
|
-
|
|
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
|
|
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.
|
|
86681
|
+
.columns=${this.tableColumns}
|
|
86612
86682
|
.striped=${true}
|
|
86613
|
-
.showHeader=${
|
|
86683
|
+
.showHeader=${this.showHeader}
|
|
86614
86684
|
@row-click=${this.onRowClick}
|
|
86615
86685
|
@cell-button-click=${this.onCellButtonClick}
|
|
86616
86686
|
@expand-toggle=${this.onExpandToggle}
|
|
86617
|
-
|
|
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, "
|
|
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:
|
|
86635
|
-
], ObcAlertListDetailsExperimental.prototype, "
|
|
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, "
|
|
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);
|