@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.149 → 2.0.0-next.150

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 (26) hide show
  1. package/bundle/openbridge-webcomponents.bundle.js +4443 -3841
  2. package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
  3. package/custom-elements.json +381 -2
  4. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js +94 -0
  5. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.css.js.map +1 -0
  6. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts +72 -0
  7. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.d.ts.map +1 -0
  8. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js +396 -0
  9. package/dist/components/alert-list-details-experimental/alert-list-details-experimental.js.map +1 -0
  10. package/dist/components/table/table.css.js +43 -0
  11. package/dist/components/table/table.css.js.map +1 -1
  12. package/dist/components/table/table.d.ts +31 -1
  13. package/dist/components/table/table.d.ts.map +1 -1
  14. package/dist/components/table/table.js +124 -11
  15. package/dist/components/table/table.js.map +1 -1
  16. package/dist/types.d.ts +2 -0
  17. package/dist/types.d.ts.map +1 -1
  18. package/dist/types.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/components/alert-list-details-experimental/alert-list-details-experimental.css +70 -0
  21. package/src/components/alert-list-details-experimental/alert-list-details-experimental.stories.ts +510 -0
  22. package/src/components/alert-list-details-experimental/alert-list-details-experimental.ts +457 -0
  23. package/src/components/table/table.css +42 -0
  24. package/src/components/table/table.stories.ts +279 -0
  25. package/src/components/table/table.ts +177 -13
  26. package/src/types.ts +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oicl/openbridge-webcomponents-full-bundle",
3
- "version": "2.0.0-next.149",
3
+ "version": "2.0.0-next.150",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,70 @@
1
+ .wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ width: 100%;
6
+ user-select: none;
7
+ }
8
+
9
+ .alert-list {
10
+ min-height: 0;
11
+ flex-grow: 0;
12
+ }
13
+
14
+ .spacer {
15
+ flex-grow: 1;
16
+ }
17
+
18
+ .action {
19
+ display: flex;
20
+ height: var(--app-components-tool-bar-touch-target-size);
21
+ padding: 0px var(--app-components-alert-toolbar-margin-horizontal);
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ flex-shrink: 0;
25
+ flex-grow: 0;
26
+ border-top: 1px solid var(--border-divider-color);
27
+ background: var(--container-section-color);
28
+ box-shadow: var(--shadow-flat);
29
+
30
+ .btn-group {
31
+ display: flex;
32
+ }
33
+ }
34
+
35
+ obc-table::part(grid) {
36
+ grid-template-columns: 1fr repeat(4, min-content);
37
+ }
38
+
39
+ .wrapper.small obc-table::part(grid) {
40
+ grid-template-columns: 1fr min-content var(
41
+ --app-components-alert-table-row-ack-container-width-small
42
+ );
43
+ }
44
+
45
+ .empty-list {
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ justify-content: center;
50
+ height: 100%;
51
+ gap: var(--app-components-alert-menu-button-spacing);
52
+
53
+ .icon {
54
+ height: 96px;
55
+ width: 96px;
56
+ color: var(--on-flat-neutral-color);
57
+ }
58
+
59
+ .empty-title {
60
+ color: var(--element-active-color);
61
+ @mixin font-body-active;
62
+ }
63
+
64
+ .empty-description {
65
+ color: var(--element-neutral-color);
66
+ @mixin font-body;
67
+ max-width: 344px;
68
+ text-align: center;
69
+ }
70
+ }
@@ -0,0 +1,510 @@
1
+ import type {Meta, StoryObj} from '@storybook/web-components-vite';
2
+ import {
3
+ AlertListMode,
4
+ ObcAckClickEvent,
5
+ ObcAlertListDetailsExperimental,
6
+ } from './alert-list-details-experimental.js';
7
+ import '../alert-icon/alert-icon.js';
8
+ import '../../icons/icon-alarm-unacknowledged-iec.js';
9
+ import '../../icons/icon-warning-unacknowledged-iec.js';
10
+ import '../../icons/icon-caution-color-iec.js';
11
+ import '../../icons/icon-alarm-acknowledged-iec.js';
12
+
13
+ import {html} from 'lit';
14
+ import {Alert, AlertType} from '../../types.js';
15
+
16
+ // Handler for ack-click events, this is a demo solution for the storybook
17
+ // Normally the ack-click is handled by the backend and the component is updated
18
+ const handleAck = (e: ObcAckClickEvent) => {
19
+ const item = e.detail.alert;
20
+ ack(item);
21
+ };
22
+
23
+ const ack = (item: Alert) => {
24
+ item.acknowledged = {
25
+ acknowledgedBy: 'John Doe',
26
+ acknowledgedAt: new Date(),
27
+ };
28
+ item.shelved = false;
29
+
30
+ // remove icon from alert-icon slot
31
+ const alertListPageSmall = document.querySelector(
32
+ 'obc-alert-list-details-experimental'
33
+ )!;
34
+ const alarms = alertListPageSmall.alerts;
35
+ const newAlarms = [...alarms];
36
+ const index = newAlarms.findIndex((alarm) => alarm.id === item.id);
37
+ newAlarms[index] = item;
38
+ alertListPageSmall.alerts = newAlarms;
39
+ };
40
+
41
+ const meta: Meta<typeof ObcAlertListDetailsExperimental> = {
42
+ title: 'Application Components/Alerts/Alert List Details Experimental',
43
+ tags: ['6.0', 'experimental'],
44
+ component: 'obc-alert-list-details-experimental',
45
+ args: {
46
+ selectedMode: AlertListMode.ALL,
47
+ showTime: true,
48
+ alerts: [
49
+ {
50
+ id: '1',
51
+ tagId: '1',
52
+ source: 'ECDIS',
53
+ text: 'Risk of collision with vessel MV NORDIC at CPA 0.2nm',
54
+ acknowledged: false,
55
+ active: true,
56
+ type: AlertType.Alarm,
57
+ time: new Date('2024-01-15T14:32:15Z'),
58
+ },
59
+ {
60
+ id: '2',
61
+ tagId: '2',
62
+ source: 'ECDIS',
63
+ text: 'Vessel has deviated from planned route by 0.5nm',
64
+ acknowledged: {
65
+ acknowledgedBy: 'John Doe',
66
+ acknowledgedAt: new Date('2024-01-15T14:34:00Z'),
67
+ },
68
+ active: true,
69
+ type: AlertType.Warning,
70
+ time: new Date('2024-01-15T13:45:22Z'),
71
+ noAck: true,
72
+ },
73
+ {
74
+ id: '3',
75
+ tagId: '3',
76
+ source: 'ME 1',
77
+ text: 'Port main engine load exceeds 95% of MCR',
78
+ acknowledged: {
79
+ acknowledgedBy: 'John Doe',
80
+ acknowledgedAt: new Date('2024-01-15T14:34:00Z'),
81
+ },
82
+ active: true,
83
+ type: AlertType.Alarm,
84
+ time: new Date('2024-01-15T12:18:47Z'),
85
+ },
86
+ {
87
+ id: '4',
88
+ tagId: '4',
89
+ source: 'ECDIS',
90
+ text: 'Under keel clearance below safety margin: 2.5m',
91
+ acknowledged: false,
92
+ active: true,
93
+ type: AlertType.Warning,
94
+ time: new Date('2024-01-15T11:52:33Z'),
95
+ noAck: true,
96
+ },
97
+ {
98
+ id: '5',
99
+ tagId: '5',
100
+ source: 'Weather',
101
+ text: 'True wind speed 35kts exceeds operational limit',
102
+ acknowledged: false,
103
+ active: true,
104
+ type: AlertType.Warning,
105
+ time: new Date('2024-01-15T10:27:08Z'),
106
+ },
107
+ {
108
+ id: '6',
109
+ tagId: '6',
110
+ source: 'GPS',
111
+ text: 'Position source switched to secondary GPS',
112
+ acknowledged: false,
113
+ active: true,
114
+ type: AlertType.Warning,
115
+ time: new Date('2024-01-15T09:14:55Z'),
116
+ },
117
+ {
118
+ id: '7',
119
+ tagId: '7',
120
+ source: 'ME 1',
121
+ text: 'HFO temperature approaching lower limit: 115°C',
122
+ acknowledged: false,
123
+ active: true,
124
+ type: AlertType.Caution,
125
+ time: new Date('2024-01-15T08:39:42Z'),
126
+ },
127
+ ] as Alert[],
128
+ },
129
+ parameters: {
130
+ layout: 'fullscreen',
131
+ },
132
+ argTypes: {},
133
+ render: (args) => {
134
+ return html` <obc-alert-list-details-experimental
135
+ data-testid="alert-menu"
136
+ .selectedMode=${args.selectedMode}
137
+ .showTime=${args.showTime}
138
+ .small=${args.small}
139
+ @ack-click=${handleAck}
140
+ .alerts=${args.alerts}
141
+ style="height: 100vh; display: block; max-height: 100%;"
142
+ >
143
+ </obc-alert-list-details-experimental>`;
144
+ },
145
+ } satisfies Meta<ObcAlertListDetailsExperimental>;
146
+
147
+ export default meta;
148
+ type Story = StoryObj<ObcAlertListDetailsExperimental>;
149
+
150
+ export const Regular: Story = {
151
+ args: {},
152
+ };
153
+
154
+ export const Small: Story = {
155
+ args: {
156
+ small: true,
157
+ },
158
+ };
159
+
160
+ export const Empty: Story = {
161
+ args: {},
162
+ render: () =>
163
+ html` <obc-alert-list-details-experimental
164
+ style="height: 100vh; display: block;"
165
+ ></obc-alert-list-details-experimental>`,
166
+ };
167
+
168
+ export const OneItem: Story = {
169
+ args: {
170
+ alerts: [
171
+ {
172
+ id: '1',
173
+ tagId: '1',
174
+ source: 'ME 1',
175
+ text: 'Port main engine temperature exceeds normal operating range',
176
+ acknowledged: false,
177
+ active: true,
178
+ type: AlertType.Alarm,
179
+ time: new Date('2024-01-15T14:32:15Z'),
180
+ },
181
+ ],
182
+ },
183
+ render: (args) => {
184
+ return html` <obc-alert-list-details-experimental
185
+ @ack-click=${handleAck}
186
+ .selectedMode=${args.selectedMode}
187
+ .alerts=${args.alerts}
188
+ style="height: 100vh; display: block;"
189
+ >
190
+ </obc-alert-list-details-experimental>`;
191
+ },
192
+ };
193
+
194
+ export const LevelCategories: Story = {
195
+ args: {
196
+ alerts: [
197
+ {
198
+ id: 'level-1',
199
+ tagId: 'CRIT-01',
200
+ source: 'PCS',
201
+ text: 'Emergency shutdown condition detected',
202
+ acknowledged: false,
203
+ active: true,
204
+ type: AlertType.LevelCritical,
205
+ time: new Date('2024-01-15T14:32:15Z'),
206
+ },
207
+ {
208
+ id: 'level-2',
209
+ tagId: 'HIGH-02',
210
+ source: 'ME 1',
211
+ text: 'Main engine overspeed',
212
+ acknowledged: false,
213
+ active: true,
214
+ type: AlertType.LevelHigh,
215
+ time: new Date('2024-01-15T14:30:00Z'),
216
+ },
217
+ {
218
+ id: 'level-3',
219
+ tagId: 'MED-03',
220
+ source: 'Tank 1',
221
+ text: 'Tank level approaching high limit',
222
+ acknowledged: false,
223
+ active: true,
224
+ type: AlertType.LevelMedium,
225
+ time: new Date('2024-01-15T14:28:00Z'),
226
+ },
227
+ {
228
+ id: 'level-4',
229
+ tagId: 'LOW-04',
230
+ source: 'HVAC',
231
+ text: 'Filter maintenance due',
232
+ acknowledged: false,
233
+ active: true,
234
+ type: AlertType.LevelLow,
235
+ time: new Date('2024-01-15T14:25:00Z'),
236
+ },
237
+ {
238
+ id: 'level-5',
239
+ tagId: 'DIAG-05',
240
+ source: 'Network',
241
+ text: 'Redundant link diagnostic message',
242
+ acknowledged: false,
243
+ active: true,
244
+ type: AlertType.LevelDiagnostic,
245
+ time: new Date('2024-01-15T14:20:00Z'),
246
+ },
247
+ ],
248
+ },
249
+ render: (args) => {
250
+ return html` <obc-alert-list-details-experimental
251
+ @ack-click=${handleAck}
252
+ .selectedMode=${args.selectedMode}
253
+ .alerts=${args.alerts}
254
+ .showTime=${args.showTime}
255
+ style="height: 100vh; display: block;"
256
+ >
257
+ </obc-alert-list-details-experimental>`;
258
+ },
259
+ };
260
+
261
+ export const GroupedAlerts: Story = {
262
+ args: {
263
+ showTime: true,
264
+ alerts: [
265
+ {
266
+ id: 'gyro',
267
+ tagId: 'GYRO-01',
268
+ source: 'Gyroscope',
269
+ text: 'Gyroscope group',
270
+ acknowledged: false,
271
+ active: true,
272
+ type: AlertType.Alarm,
273
+ time: new Date('2024-01-15T14:32:15Z'),
274
+ noAck: true,
275
+ },
276
+ {
277
+ id: 'heading',
278
+ tagId: 'GYRO-02',
279
+ source: 'Gyroscope',
280
+ text: 'Heading deviation',
281
+ acknowledged: false,
282
+ active: true,
283
+ type: AlertType.Alarm,
284
+ time: new Date('2024-01-15T14:32:15Z'),
285
+ memberOf: ['gyro'],
286
+ },
287
+ {
288
+ id: 'sensor',
289
+ tagId: 'SENS-01',
290
+ source: 'Sensor',
291
+ text: 'Sensor group, nested under the gyroscope group',
292
+ acknowledged: false,
293
+ active: true,
294
+ type: AlertType.Alarm,
295
+ time: new Date('2024-01-15T14:33:15Z'),
296
+ memberOf: ['gyro'],
297
+ },
298
+ {
299
+ id: 'drift',
300
+ tagId: 'SENS-02',
301
+ source: 'Sensor',
302
+ text: 'Sensor drift out of range',
303
+ acknowledged: false,
304
+ active: true,
305
+ type: AlertType.Warning,
306
+ time: new Date('2024-01-15T14:34:15Z'),
307
+ memberOf: ['sensor'],
308
+ },
309
+ {
310
+ id: 'radar',
311
+ tagId: 'RADAR-01',
312
+ source: 'Radar',
313
+ text: 'Radar group',
314
+ acknowledged: false,
315
+ active: true,
316
+ type: AlertType.Warning,
317
+ time: new Date('2024-01-15T14:35:15Z'),
318
+ },
319
+ {
320
+ id: 'power',
321
+ tagId: 'PWR-01',
322
+ source: 'Power',
323
+ text: 'Supply voltage low, a member of both groups',
324
+ acknowledged: false,
325
+ active: true,
326
+ type: AlertType.Caution,
327
+ time: new Date('2024-01-15T14:36:15Z'),
328
+ memberOf: ['gyro', 'radar'],
329
+ },
330
+ {
331
+ id: 'ecdis',
332
+ tagId: 'ECDIS-01',
333
+ source: 'ECDIS',
334
+ text: 'Ungrouped alert',
335
+ acknowledged: false,
336
+ active: true,
337
+ type: AlertType.Warning,
338
+ time: new Date('2024-01-15T14:37:15Z'),
339
+ },
340
+ ] as Alert[],
341
+ },
342
+ parameters: {
343
+ docs: {
344
+ description: {
345
+ story:
346
+ 'Alerts are grouped through `memberOf`, which names the alerts a given alert is a member of. Groups nest, and `PWR-01` lists two groups so it appears under both. The `GYRO-01` group row sets `noAck`, so it shows no ACK button of its own.',
347
+ },
348
+ },
349
+ },
350
+ render: (args) => {
351
+ return html` <obc-alert-list-details-experimental
352
+ @ack-click=${handleAck}
353
+ .selectedMode=${args.selectedMode}
354
+ .alerts=${args.alerts}
355
+ .showTime=${args.showTime}
356
+ style="height: 100vh; display: block;"
357
+ >
358
+ </obc-alert-list-details-experimental>`;
359
+ },
360
+ };
361
+
362
+ export const CyclicGrouping: Story = {
363
+ args: {
364
+ showTime: true,
365
+ alerts: [
366
+ {
367
+ id: 'standalone',
368
+ tagId: 'ECDIS-01',
369
+ source: 'ECDIS',
370
+ text: 'Ungrouped alert, the only natural root',
371
+ acknowledged: false,
372
+ active: true,
373
+ type: AlertType.Warning,
374
+ time: new Date('2024-01-15T14:32:15Z'),
375
+ },
376
+ {
377
+ id: 'pump-a',
378
+ tagId: 'PUMP-01',
379
+ source: 'Pump A',
380
+ text: 'Recovered as a root: a member of Pump B',
381
+ acknowledged: false,
382
+ active: true,
383
+ type: AlertType.Alarm,
384
+ time: new Date('2024-01-15T14:33:15Z'),
385
+ memberOf: ['pump-b'],
386
+ },
387
+ {
388
+ id: 'pump-b',
389
+ tagId: 'PUMP-02',
390
+ source: 'Pump B',
391
+ text: 'Recovered under Pump A, which it also groups',
392
+ acknowledged: false,
393
+ active: true,
394
+ type: AlertType.Alarm,
395
+ time: new Date('2024-01-15T14:34:15Z'),
396
+ memberOf: ['pump-a'],
397
+ },
398
+ ] as Alert[],
399
+ },
400
+ parameters: {
401
+ docs: {
402
+ description: {
403
+ story:
404
+ 'Regression guard. Three active alerts go in and three are listed. `buildVisibleRows()` seeds its walk from alerts with no in-set `memberOf`, so this membership cycle produces no root of its own; the alerts it cannot reach become roots instead of being dropped, because an alert list must never quietly omit an active alarm. Remove the standalone alert and both alarms still render.',
405
+ },
406
+ },
407
+ },
408
+ render: (args) => {
409
+ return html` <obc-alert-list-details-experimental
410
+ @ack-click=${handleAck}
411
+ .selectedMode=${args.selectedMode}
412
+ .alerts=${args.alerts}
413
+ .showTime=${args.showTime}
414
+ style="height: 100vh; display: block;"
415
+ >
416
+ </obc-alert-list-details-experimental>`;
417
+ },
418
+ };
419
+
420
+ export const CycleWithDescendants: Story = {
421
+ args: {
422
+ showTime: true,
423
+ alerts: [
424
+ {
425
+ id: 'reachable-group',
426
+ tagId: 'GYRO-01',
427
+ source: 'Gyroscope',
428
+ text: 'Reachable group, renders with its whole cycle below it',
429
+ acknowledged: false,
430
+ active: true,
431
+ type: AlertType.Alarm,
432
+ time: new Date('2024-01-15T14:30:15Z'),
433
+ noAck: true,
434
+ },
435
+ {
436
+ id: 'reachable-child',
437
+ tagId: 'GYRO-02',
438
+ source: 'Gyroscope',
439
+ text: 'Member of the group, and of its own child below',
440
+ acknowledged: false,
441
+ active: true,
442
+ type: AlertType.Alarm,
443
+ time: new Date('2024-01-15T14:31:15Z'),
444
+ memberOf: ['reachable-group', 'reachable-grandchild'],
445
+ },
446
+ {
447
+ id: 'reachable-grandchild',
448
+ tagId: 'GYRO-03',
449
+ source: 'Gyroscope',
450
+ text: 'Closes the cycle back to its own parent',
451
+ acknowledged: false,
452
+ active: true,
453
+ type: AlertType.Alarm,
454
+ time: new Date('2024-01-15T14:32:15Z'),
455
+ memberOf: ['reachable-child'],
456
+ },
457
+ {
458
+ id: 'pump-a',
459
+ tagId: 'PUMP-01',
460
+ source: 'Pump A',
461
+ text: 'Recovered as a root: a member of Pump B',
462
+ acknowledged: false,
463
+ active: true,
464
+ type: AlertType.Warning,
465
+ time: new Date('2024-01-15T14:33:15Z'),
466
+ memberOf: ['pump-b'],
467
+ },
468
+ {
469
+ id: 'pump-b',
470
+ tagId: 'PUMP-02',
471
+ source: 'Pump B',
472
+ text: 'Recovered under Pump A, which it also groups',
473
+ acknowledged: false,
474
+ active: true,
475
+ type: AlertType.Warning,
476
+ time: new Date('2024-01-15T14:34:15Z'),
477
+ memberOf: ['pump-a'],
478
+ },
479
+ {
480
+ id: 'pump-sensor',
481
+ tagId: 'PUMP-03',
482
+ source: 'Pump sensor',
483
+ text: 'Recovered, and not itself cyclic: a member of Pump A',
484
+ acknowledged: false,
485
+ active: true,
486
+ type: AlertType.Caution,
487
+ time: new Date('2024-01-15T14:35:15Z'),
488
+ memberOf: ['pump-a'],
489
+ },
490
+ ] as Alert[],
491
+ },
492
+ parameters: {
493
+ docs: {
494
+ description: {
495
+ story:
496
+ 'Regression guard for both halves of the cycle handling. The Gyroscope cycle sits under a group with no `memberOf`, so the walk reaches it and the `ancestors` guard prunes only the repeat visit; those three must render once each, not be re-listed at top level by the recovery. The Pump cycle has no root, so it is recovered: Pump A becomes a root, and Pump B and Pump sensor render beneath it. Pump sensor is in no cycle and merely names a member of one, so recovering only cycle members would still lose it.',
497
+ },
498
+ },
499
+ },
500
+ render: (args) => {
501
+ return html` <obc-alert-list-details-experimental
502
+ @ack-click=${handleAck}
503
+ .selectedMode=${args.selectedMode}
504
+ .alerts=${args.alerts}
505
+ .showTime=${args.showTime}
506
+ style="height: 100vh; display: block;"
507
+ >
508
+ </obc-alert-list-details-experimental>`;
509
+ },
510
+ };