@things-factory/notification 9.1.13 → 10.0.0-beta.1
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-client/bootstrap.js +2 -2
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/pages/notification/notification-list-page.d.ts +1 -7
- package/dist-client/pages/notification/notification-list-page.js +44 -83
- package/dist-client/pages/notification/notification-list-page.js.map +1 -1
- package/dist-client/pages/notification-rule/notification-rule-list-page.d.ts +1 -7
- package/dist-client/pages/notification-rule/notification-rule-list-page.js +63 -120
- package/dist-client/pages/notification-rule/notification-rule-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/viewparts/notification-badge.d.ts +5 -10
- package/dist-client/viewparts/notification-badge.js +13 -4
- package/dist-client/viewparts/notification-badge.js.map +1 -1
- package/dist-client/viewparts/notification-list.d.ts +4 -8
- package/dist-client/viewparts/notification-list.js +10 -4
- package/dist-client/viewparts/notification-list.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
declare
|
|
4
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
5
|
-
connectedCallback(): void;
|
|
6
|
-
disconnectedCallback(): void;
|
|
7
|
-
stateChanged(_state: unknown): void;
|
|
8
|
-
readonly isConnected: boolean;
|
|
9
|
-
}) & typeof LitElement;
|
|
10
|
-
export declare class NotificationBadge extends NotificationBadge_base {
|
|
3
|
+
export declare class NotificationBadge extends LitElement {
|
|
11
4
|
static styles: import("lit").CSSResult[];
|
|
12
5
|
badge?: number;
|
|
13
6
|
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
-
|
|
7
|
+
private _unsubscribe?;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
private _applyState;
|
|
15
11
|
}
|
|
16
|
-
export {};
|
|
@@ -2,9 +2,8 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import '@material/web/icon/icon.js';
|
|
3
3
|
import { LitElement, html, css } from 'lit';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
-
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
6
5
|
import { store } from '@operato/shell';
|
|
7
|
-
let NotificationBadge = class NotificationBadge extends
|
|
6
|
+
let NotificationBadge = class NotificationBadge extends LitElement {
|
|
8
7
|
static { this.styles = [
|
|
9
8
|
css `
|
|
10
9
|
:host {
|
|
@@ -41,8 +40,18 @@ let NotificationBadge = class NotificationBadge extends connect(store)(LitElemen
|
|
|
41
40
|
render() {
|
|
42
41
|
return html ` <md-icon>notifications_none</md-icon> `;
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback();
|
|
45
|
+
this._applyState();
|
|
46
|
+
this._unsubscribe = store.subscribe(() => this._applyState());
|
|
47
|
+
}
|
|
48
|
+
disconnectedCallback() {
|
|
49
|
+
super.disconnectedCallback();
|
|
50
|
+
this._unsubscribe?.();
|
|
51
|
+
}
|
|
52
|
+
_applyState() {
|
|
53
|
+
const __state__ = store.getState();
|
|
54
|
+
this.badge = __state__.notification.badge || 0;
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
57
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-badge.js","sourceRoot":"","sources":["../../client/viewparts/notification-badge.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"notification-badge.js","sourceRoot":"","sources":["../../client/viewparts/notification-badge.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG/B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;aACxC,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;KACF,AAhCY,CAgCZ;IAID,MAAM;QACJ,OAAO,IAAI,CAAA,yCAAyC,CAAA;IACtD,CAAC;IAKD,iBAAiB;QAEf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,WAAW,EAAE,CAAA;QAElB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;IAE/D,CAAC;IAGD,oBAAoB;QAElB,KAAK,CAAC,oBAAoB,EAAE,CAAA;QAE5B,IAAI,CAAC,YAAY,EAAE,EAAE,CAAA;IAEvB,CAAC;IAGO,WAAW;QAEjB,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAS,CAAA;QAC7C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,CAAA;IAE5C,CAAC;;AAlCmE;IAAnE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDAAe;AAnCvE,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAsE7B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { store } from '@operato/shell'\n\n@customElement('notification-badge')\nexport class NotificationBadge extends LitElement {\n static styles = [\n css`\n :host {\n font-size: 2em;\n position: relative;\n }\n\n md-icon {\n display: block;\n }\n\n :host::after {\n content: attr(data-badge);\n position: absolute;\n top: 0px;\n right: -6px;\n font-family: var(--theme-font);\n font-size: 0.3em;\n background: var(--md-sys-color-error, rgb(186 26 26));\n color: var(--md-sys-color-on-primary);\n width: 14px;\n height: 14px;\n text-align: center;\n line-height: 14px;\n border-radius: 50%;\n box-shadow: var(--box-shadow);\n }\n\n :host([data-badge='0'])::after {\n display: none;\n }\n `\n ]\n\n @property({ type: Number, attribute: 'data-badge', reflect: true }) badge?: number\n\n render() {\n return html` <md-icon>notifications_none</md-icon> `\n }\n\n private _unsubscribe?: () => void\n\n\n connectedCallback() {\n\n super.connectedCallback()\n\n this._applyState()\n\n this._unsubscribe = store.subscribe(() => this._applyState())\n\n }\n\n\n disconnectedCallback() {\n\n super.disconnectedCallback()\n\n this._unsubscribe?.()\n\n }\n\n\n private _applyState() {\n\n const __state__ = store.getState() as any\nthis.badge = __state__.notification.badge || 0\n\n }\n}\n"]}
|
|
@@ -2,20 +2,16 @@ import '@material/web/icon/icon.js';
|
|
|
2
2
|
import '@material/web/button/elevated-button.js';
|
|
3
3
|
import './notification-item';
|
|
4
4
|
import { LitElement } from 'lit';
|
|
5
|
-
declare const NotificationList_base: (new (...args: any[]) =>
|
|
6
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
disconnectedCallback(): void;
|
|
9
|
-
stateChanged(_state: unknown): void;
|
|
10
|
-
readonly isConnected: boolean;
|
|
11
|
-
}) & (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
5
|
+
declare const NotificationList_base: (new (...args: any[]) => LitElement) & typeof LitElement;
|
|
12
6
|
export declare class NotificationList extends NotificationList_base {
|
|
13
7
|
static styles: import("lit").CSSResult[];
|
|
14
8
|
history: any[];
|
|
15
9
|
render(): import("lit-html").TemplateResult<1>;
|
|
16
10
|
onClose(notification: any): void;
|
|
17
11
|
onclearall(): void;
|
|
18
|
-
|
|
12
|
+
private _unsubscribe?;
|
|
13
|
+
private _applyState;
|
|
14
|
+
connectedCallback(): void;
|
|
19
15
|
disconnectedCallback(): Promise<void>;
|
|
20
16
|
}
|
|
21
17
|
export {};
|
|
@@ -4,11 +4,10 @@ import '@material/web/button/elevated-button.js';
|
|
|
4
4
|
import './notification-item';
|
|
5
5
|
import { LitElement, html, css } from 'lit';
|
|
6
6
|
import { customElement, property } from 'lit/decorators.js';
|
|
7
|
-
import { connect } from 'pwa-helpers';
|
|
8
7
|
import { store, notificationStore } from '@operato/shell';
|
|
9
8
|
import { i18next, localize } from '@operato/i18n';
|
|
10
9
|
import { UPDATE_NOTIFICATION } from '../actions/notification-fcm';
|
|
11
|
-
let NotificationList = class NotificationList extends
|
|
10
|
+
let NotificationList = class NotificationList extends localize(i18next)(LitElement) {
|
|
12
11
|
constructor() {
|
|
13
12
|
super(...arguments);
|
|
14
13
|
this.history = [];
|
|
@@ -117,11 +116,18 @@ let NotificationList = class NotificationList extends connect(store)(localize(i1
|
|
|
117
116
|
});
|
|
118
117
|
}));
|
|
119
118
|
}
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
_applyState() {
|
|
120
|
+
const __state__ = store.getState();
|
|
121
|
+
this.history = __state__.notification.history;
|
|
122
|
+
}
|
|
123
|
+
connectedCallback() {
|
|
124
|
+
super.connectedCallback();
|
|
125
|
+
this._applyState();
|
|
126
|
+
this._unsubscribe = store.subscribe(() => this._applyState());
|
|
122
127
|
}
|
|
123
128
|
async disconnectedCallback() {
|
|
124
129
|
super.disconnectedCallback();
|
|
130
|
+
this._unsubscribe?.();
|
|
125
131
|
await Promise.all(this.history
|
|
126
132
|
.filter(notification => !notification.confirmed)
|
|
127
133
|
.map(async (notification) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-list.js","sourceRoot":"","sources":["../../client/viewparts/notification-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"notification-list.js","sourceRoot":"","sources":["../../client/viewparts/notification-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAG1D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA5D;;QAuDsB,YAAO,GAAU,EAAE,CAAA;IAiHhD,CAAC;aAvKQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDF;KACF,AApDY,CAoDZ;IAID,MAAM;QACJ,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAA;QAEpC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC,IAAI,CAAA;;;wBAGY,OAAO,CAAC,CAAC,CAAC,yBA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aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAwK5B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport './notification-item'\n\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { store, notificationStore } from '@operato/shell'\nimport { i18next, localize } from '@operato/i18n'\nimport { UPDATE_NOTIFICATION } from '../actions/notification-fcm'\n\n@customElement('notification-list')\nexport class NotificationList extends localize(i18next)(LitElement) {\n static styles = [\n css`\n :host {\n display: block;\n background-color: var(--md-sys-color-surface);\n box-shadow: var(--box-shadow);\n margin-right: var(--spacing-large);\n padding: var(--spacing-medium);\n max-height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n [notifications-wrap] {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n }\n [notifications-wrap] div {\n align-items: stretch;\n border-bottom: 1px solid var(--md-sys-color-primary);\n }\n [notifications-wrap] strong {\n color: var(--md-sys-color-primary);\n text-transform: capitalize;\n line-height: 2;\n }\n [notifications-wrap] md-elevated-button {\n --md-elevated-button-container-height: 24px;\n float: right;\n padding-inline-start: 6px;\n padding-inline-end: 12px;\n }\n [no-notifications] {\n margin: 0;\n padding: var(--spacing-large);\n text-align: center;\n font-size: var(--fontsize-default);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n div md-icon {\n display: block;\n opacity: 0.3;\n }\n @media screen and (max-width: 480px) {\n :host {\n height: 100%;\n width: 100vw;\n }\n }\n `\n ]\n\n @property({ type: Array }) history: any[] = []\n\n render() {\n var history = this.history.reverse()\n\n return history.length > 0\n ? html`\n <div notifications-wrap>\n <div>\n <strong>${i18next.t('label.notification list')}</strong>\n <md-elevated-button outlined dense @click=${e => this.onclearall()}\n ><md-icon slot=\"icon\">delete_outline</md-icon>${String(\n i18next.t('label.clear all')\n )}</md-elevated-button\n >\n </div>\n ${history.map(\n notification => html`\n <notification-item\n @close=${e => {\n this.onClose(notification)\n }}\n .type=${notification.type}\n .notification=${notification}\n ></notification-item>\n `\n )}\n </div>\n `\n : html`\n <div no-notifications @click=${e => window.history.back()}>\n <md-icon>notifications_off</md-icon>${i18next.t('text.no notification available')}\n </div>\n `\n }\n\n onClose(notification) {\n const { id } = notification\n\n store.dispatch((async dispatch => {\n if (notification) {\n await notificationStore.delete(id)\n }\n\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n onclearall() {\n store.dispatch((async dispatch => {\n await notificationStore.clear()\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n\n private _unsubscribe?: () => void\n\n\n private _applyState() {\n\n const __state__ = store.getState() as any\n this.history = __state__.notification.history\n\n }\n\n\n connectedCallback() {\n\n super.connectedCallback()\n\n this._applyState()\n\n this._unsubscribe = store.subscribe(() => this._applyState())\n\n }\n\n\n async disconnectedCallback() {\n\n super.disconnectedCallback()\n\n this._unsubscribe?.()\n\n await Promise.all(\n this.history\n .filter(notification => !notification.confirmed)\n .map(async notification => {\n return await notificationStore.put({\n ...notification,\n confirmed: true\n })\n })\n )\n\n store.dispatch((async dispatch => {\n const history = await notificationStore.getAll()\n\n dispatch({\n type: UPDATE_NOTIFICATION,\n history: [...history]\n })\n }) as any)\n }\n}\n"]}
|