@genesislcap/pbc-notify-ui 15.0.0 → 15.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +673 -382
- package/dist/dts/components/foundation-inbox/inbox-base/inbox-base.d.ts +38 -2
- package/dist/dts/components/foundation-inbox/inbox-base/inbox-base.d.ts.map +1 -1
- package/dist/dts/components/foundation-inbox/inbox.template.d.ts.map +1 -1
- package/dist/dts/index.d.ts +2 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/react.d.ts +22 -22
- package/dist/esm/components/foundation-inbox/inbox-base/inbox-base.js +55 -2
- package/dist/esm/components/foundation-inbox/inbox.template.js +45 -21
- package/dist/esm/index.js +1 -0
- package/dist/pbc-notify-ui.api.json +348 -0
- package/dist/pbc-notify-ui.d.ts +39 -3
- package/dist/react.cjs +10 -10
- package/dist/react.mjs +8 -8
- package/package.json +23 -23
- package/src/components/foundation-inbox/inbox-base/inbox-base.ts +44 -2
- package/src/components/foundation-inbox/inbox.template.ts +54 -24
- package/src/index.ts +2 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@genesislcap/foundation-criteria';
|
|
10
10
|
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
11
11
|
import type { Tabs } from '@genesislcap/foundation-ui';
|
|
12
|
-
import { GenesisElement, observable } from '@genesislcap/web-core';
|
|
12
|
+
import { attr, GenesisElement, observable, ViewTemplate } from '@genesislcap/web-core';
|
|
13
13
|
import dayjs from 'dayjs';
|
|
14
14
|
import utc from 'dayjs/plugin/utc';
|
|
15
15
|
import debounce from 'lodash.debounce';
|
|
@@ -26,6 +26,7 @@ import { TemplateService } from '../../../services/template.service';
|
|
|
26
26
|
import { logger } from '../../../utils';
|
|
27
27
|
import { NotifyPermission } from '../../../utils/notifyPermissions';
|
|
28
28
|
import { showNotificationError } from '../../foundation-notification-dashboard/notification-dashboard.utils';
|
|
29
|
+
import type { FoundationInbox } from '../inbox';
|
|
29
30
|
import { Alert, InboxTab, NotificationRuleTemplateReply, Rule, RuleTemplate } from '../inbox.types';
|
|
30
31
|
import { extractTopic } from '../inbox.utils';
|
|
31
32
|
|
|
@@ -54,6 +55,47 @@ export class FoundationInboxBase extends GenesisElement {
|
|
|
54
55
|
@observable alertsFilter: Alert[] = [];
|
|
55
56
|
@observable moreAlerts: boolean = false;
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Optional per-row template for the Alerts / Alert History lists. When set, it replaces the
|
|
60
|
+
* default alert row (the `.toast` element) and is rendered with the alert as its source (`x`)
|
|
61
|
+
* and the inbox host as `c.parent`, mirroring the internal `html<Alert, FoundationInbox>` row.
|
|
62
|
+
* When unset, the built-in row is used, so existing consumers are unaffected.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
@observable renderAlert: ViewTemplate<Alert, FoundationInbox> | undefined = undefined;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Hide the Severity filter block in the search bar. Set via the `hide-severity-filter`
|
|
70
|
+
* attribute or property. @public
|
|
71
|
+
*/
|
|
72
|
+
@attr({ mode: 'boolean' }) hideSeverityFilter: boolean = false;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Hide the Date Range filter block in the search bar. Set via the `hide-date-range`
|
|
76
|
+
* attribute or property. @public
|
|
77
|
+
*/
|
|
78
|
+
@attr({ mode: 'boolean' }) hideDateRange: boolean = false;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Hide the Search-by-Title field in the search bar. Set via the `hide-title-search`
|
|
82
|
+
* attribute or property. @public
|
|
83
|
+
*/
|
|
84
|
+
@attr({ mode: 'boolean' }) hideTitleSearch: boolean = false;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Hide the Search-by-Body field in the search bar. Set via the `hide-body-search`
|
|
88
|
+
* attribute or property. @public
|
|
89
|
+
*/
|
|
90
|
+
@attr({ mode: 'boolean' }) hideBodySearch: boolean = false;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Optional click handler for an alert row, fired with the clicked alert so consumers can open
|
|
94
|
+
* the related record. Interactive elements inside a custom {@link renderAlert} template should
|
|
95
|
+
* call `event.stopPropagation()` to avoid triggering this. @public
|
|
96
|
+
*/
|
|
97
|
+
@observable onAlertClick: ((alert: Alert) => void) | undefined = undefined;
|
|
98
|
+
|
|
57
99
|
@RuleService ruleService: RuleService;
|
|
58
100
|
@observable rules: Rule[] = [];
|
|
59
101
|
|
|
@@ -85,7 +127,7 @@ export class FoundationInboxBase extends GenesisElement {
|
|
|
85
127
|
|
|
86
128
|
@observable criteriaMatchAlertStatus: Expression;
|
|
87
129
|
@observable reverse: boolean = false;
|
|
88
|
-
@observable sortDirection:
|
|
130
|
+
@observable sortDirection: 'Asc' | 'Desc' = 'Desc';
|
|
89
131
|
@observable showLoadingIndicator: boolean = false;
|
|
90
132
|
|
|
91
133
|
@observable severityType = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html, ref, repeat, sync, when } from '@genesislcap/web-core';
|
|
1
|
+
import { html, ref, repeat, sync, when, whenElse } from '@genesislcap/web-core';
|
|
2
2
|
import { eventDetail } from '../../utils';
|
|
3
3
|
import { NotifyPermission } from '../../utils/notifyPermissions';
|
|
4
4
|
import type { FoundationInbox } from './inbox';
|
|
@@ -13,7 +13,10 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
|
|
|
13
13
|
style=${(x) => (x.selectedTab === tab ? '' : 'display: none;')}
|
|
14
14
|
>
|
|
15
15
|
<div class="search">
|
|
16
|
-
<div
|
|
16
|
+
<div
|
|
17
|
+
style=${(x) =>
|
|
18
|
+
x.hideSeverityFilter ? 'display: none;' : 'display: flex; flex-direction: column;'}
|
|
19
|
+
>
|
|
17
20
|
<label part="label" for="control" class="search-label">
|
|
18
21
|
<slot>Severity</slot>
|
|
19
22
|
</label>
|
|
@@ -65,7 +68,10 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
|
|
|
65
68
|
</div>
|
|
66
69
|
</div>
|
|
67
70
|
|
|
68
|
-
<div
|
|
71
|
+
<div
|
|
72
|
+
style=${(x) =>
|
|
73
|
+
x.hideDateRange ? 'display: none;' : 'display: flex; flex-direction: column;'}
|
|
74
|
+
>
|
|
69
75
|
<label part="label" for="control" class="search-label">
|
|
70
76
|
<slot>Date Range</slot>
|
|
71
77
|
</label>
|
|
@@ -94,6 +100,7 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
|
|
|
94
100
|
|
|
95
101
|
<rapid-text-field
|
|
96
102
|
class="search-input"
|
|
103
|
+
style=${(x) => (x.hideTitleSearch ? 'display: none;' : '')}
|
|
97
104
|
:value=${(x) => x.titleSearchValue}
|
|
98
105
|
@input=${(x, c) => {
|
|
99
106
|
x.titleSearchValue = (c.event.target as HTMLInputElement).value;
|
|
@@ -105,6 +112,7 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
|
|
|
105
112
|
|
|
106
113
|
<rapid-text-field
|
|
107
114
|
class="search-input"
|
|
115
|
+
style=${(x) => (x.hideBodySearch ? 'display: none;' : '')}
|
|
108
116
|
:value=${(x) => x.bodySearchValue}
|
|
109
117
|
@input=${(x, c) => {
|
|
110
118
|
x.bodySearchValue = (c.event.target as HTMLInputElement).value;
|
|
@@ -120,8 +128,8 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
|
|
|
120
128
|
<slot>Sort By</slot>
|
|
121
129
|
</label>
|
|
122
130
|
<rapid-segmented-control :value=${sync((x) => x.sortDirection)}>
|
|
123
|
-
<rapid-segmented-item
|
|
124
|
-
<rapid-segmented-item value="Desc">Desc</rapid-segmented-item>
|
|
131
|
+
<rapid-segmented-item value="Asc">Asc</rapid-segmented-item>
|
|
132
|
+
<rapid-segmented-item checked value="Desc">Desc</rapid-segmented-item>
|
|
125
133
|
</rapid-segmented-control>
|
|
126
134
|
</div>
|
|
127
135
|
${when(
|
|
@@ -144,27 +152,49 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
|
|
|
144
152
|
${repeat(
|
|
145
153
|
(x) => x.alertsFilter,
|
|
146
154
|
html<Alert, FoundationInbox>`
|
|
147
|
-
<div
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
<div
|
|
156
|
+
class="alert-row"
|
|
157
|
+
style=${(x, c) => (c.parent.onAlertClick ? 'cursor: pointer;' : '')}
|
|
158
|
+
@click=${(x, c) => c.parent.onAlertClick?.(x)}
|
|
159
|
+
>
|
|
160
|
+
${whenElse(
|
|
161
|
+
(x, c) => !!c.parent.renderAlert,
|
|
162
|
+
html<Alert, FoundationInbox>`
|
|
163
|
+
${(x, c) => c.parent.renderAlert}
|
|
164
|
+
`,
|
|
165
|
+
html<Alert, FoundationInbox>`
|
|
166
|
+
<div class="toast" id=${(x) => x.ALERT_ID}>
|
|
167
|
+
<div
|
|
168
|
+
class="toast-severity"
|
|
169
|
+
style="background-color: ${(x) => getSeverityColor(x.NOTIFY_SEVERITY)}"
|
|
170
|
+
></div>
|
|
152
171
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
172
|
+
<div class="toast-content">
|
|
173
|
+
${when(
|
|
174
|
+
(x) => x.ALERT_STATUS === AlertStatus.NEW,
|
|
175
|
+
html`
|
|
176
|
+
<div
|
|
177
|
+
class="close-icon"
|
|
178
|
+
@click=${(x, c) => {
|
|
179
|
+
c.event.stopPropagation();
|
|
180
|
+
c.parent.dismissAlert(x.ALERT_ID);
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
<rapid-icon name="times"></rapid-icon>
|
|
184
|
+
</div>
|
|
185
|
+
`,
|
|
186
|
+
)}
|
|
187
|
+
<span class="toast-header">${(x) => x.HEADER}</span>
|
|
188
|
+
<span class="toast-message">${(x) => x.MESSAGE}</span>
|
|
189
|
+
<div class="toast-bottom" slot="bottom">
|
|
190
|
+
<span class="toast-date" slot="date">
|
|
191
|
+
${(x) => getFormattedDate(x.CREATED_AT)}
|
|
192
|
+
</span>
|
|
193
|
+
</div>
|
|
159
194
|
</div>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<span class="toast-message">${(x) => x.MESSAGE}</span>
|
|
164
|
-
<div class="toast-bottom" slot="bottom">
|
|
165
|
-
<span class="toast-date" slot="date">${(x) => getFormattedDate(x.CREATED_AT)}</span>
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
195
|
+
</div>
|
|
196
|
+
`,
|
|
197
|
+
)}
|
|
168
198
|
</div>
|
|
169
199
|
`,
|
|
170
200
|
)}
|
package/src/index.ts
CHANGED
|
@@ -3,8 +3,10 @@ export * from './components/foundation-inbox/components/foundation-inbox-flyout/
|
|
|
3
3
|
export * from './components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter';
|
|
4
4
|
export * from './components/foundation-notification-dashboard';
|
|
5
5
|
export type {
|
|
6
|
+
Alert,
|
|
6
7
|
ParameterEditedEventDetail,
|
|
7
8
|
RuleParameterEntity,
|
|
8
9
|
} from './components/foundation-inbox/inbox.types';
|
|
10
|
+
export { AlertStatus } from './components/foundation-inbox/inbox.types';
|
|
9
11
|
export type { ConditionBuilderEntity } from './notify.types';
|
|
10
12
|
export type { ParameterBuilderEntity } from './components/foundation-notification-dashboard/components/templates/template-dialog/template-dialog.types';
|