@things-factory/notification 7.0.84 → 7.0.86
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/client/viewparts/notification-item.ts +1 -0
- package/client/viewparts/notification-list.ts +0 -11
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/viewparts/notification-item.js +1 -0
- package/dist-client/viewparts/notification-item.js.map +1 -1
- package/dist-client/viewparts/notification-list.js +0 -11
- package/dist-client/viewparts/notification-list.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../client/viewparts/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,SAAS,sBAAsB,CAAC,GAAG;IACjC,SAAS,WAAW,CAAC,QAAQ;QAC3B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;IAED,SAAS,MAAM,CAAC,QAAQ;QACtB,OAAO,QAAQ,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAA;IACjF,CAAC;IAED,IAAI,CAAC;QACH,IAAI,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAA;QAClC,IAAI,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;QAE9C,OAAO,CAAC,CAAC,CACP,QA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,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;OAMT;YACD,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,IAAI;oBACJ,MAAM,EAAE,EAAE;iBACX;aACF;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAA;IAC/C,CAAC;;AAhNM,uBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuHF;CACF,AAzHY,CAyHZ;AAE0C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CAAc;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiD;AAC/C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gDAAiB;AAhIlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAkN5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\n\nfunction isOriginSameAsLocation(url) {\n function defaultPort(protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }\n\n function portOf(location) {\n return location.port || defaultPort(location.protocol || pageLocation.protocol)\n }\n\n try {\n var pageLocation = window.location\n var urlparts = new URL(url, pageLocation.href)\n\n return !!(\n urlparts.protocol &&\n urlparts.protocol == pageLocation.protocol &&\n urlparts.host &&\n urlparts.host == pageLocation.host &&\n urlparts.host &&\n portOf(urlparts) == portOf(pageLocation)\n )\n } catch (err) {\n console.warn(err, url)\n }\n}\n\n@customElement('notification-item')\nexport class NotificationItem extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-medium);\n border-left: 0 solid transparent;\n border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;\n transition:\n border-left 200ms ease-in-out,\n padding-left 200ms ease-in-out;\n color: var(--md-sys-color-on-surface);\n\n --type-dot-size: 9px;\n }\n\n :host([newbie]) {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n :host(:hover) {\n padding-left: 0.5rem;\n border-left: 0.2rem solid var(--status-info-color);\n }\n\n [titler] {\n white-space: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontsize-large);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n\n [titler] span {\n display: inline-block;\n width: var(--type-dot-size);\n height: var(--type-dot-size);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n }\n [titler] * {\n vertical-align: middle;\n }\n\n [close] {\n position: absolute;\n top: 13px;\n right: 0;\n font-size: var(--fontsize-large);\n opacity: 0.5;\n cursor: pointer;\n }\n [close]:hover {\n opacity: 1;\n }\n [detail] {\n padding: var(--spacing-small) var(--spacing-medium);\n border-radius: var(--border-radius);\n font-size: 0.85em;\n }\n span.more {\n margin-left: 16px;\n float: right;\n padding: 0px var(--spacing-small) 2px var(--spacing-small);\n border-radius: var(--border-radius);\n font-size: 0.8em;\n color: var(--md-sys-color-on-primary);\n --md-icon-size: 14px;\n }\n span.more * {\n vertical-align: middle;\n }\n\n :host([type='ERROR']) span {\n background-color: var(--status-danger-color);\n }\n :host([type='ERROR']) {\n border-color: var(--status-danger-color);\n }\n :host([type='ERROR']) [detail] {\n border: 1px solid rgba(241, 53, 63, 0.5);\n background-color: rgba(241, 53, 63, 0.1);\n }\n :host([type='WARN']) span {\n background-color: var(--status-warning-color);\n }\n :host([type='WARN']) {\n border-color: var(--status-warning-color);\n }\n :host([type='SUCCESS']) span {\n background-color: var(--status-success-color);\n }\n :host([type='SUCCESS']) {\n border-color: var(--status-success-color);\n }\n :host([type='INFO']) span,\n :host span {\n background-color: var(--status-info-color);\n }\n :host([type='INFO']) {\n border-color: var(--status-info-color);\n }\n\n img {\n display: block;\n max-width: 100%;\n margin: auto;\n }\n\n [message] {\n font-size: var(--fontsize-default);\n color: var(--md-sys-color-secondary);\n }\n\n [timestamp] {\n white-space: nowrap;\n font-size: var(--fontsize-small);\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @property({ type: String, reflect: true }) type?: string\n @property({ type: Object }) notification: any\n @property({ type: String }) target?: string\n @property({ type: Object }) detail?: { message: string; [key: string]: any }\n @property({ type: Boolean }) newbie?: boolean\n\n render() {\n const { title, url, image, timestamp, body } = this.notification\n const target = this.target\n const detail = this.detail\n const type = this.type\n\n return html`\n <div titler>\n <span></span>\n ${url\n ? target\n ? html`<a href=${url} target=${target}>${title}</a>`\n : html`<a href=${url}>${title}</a>`\n : title}\n </div>\n <md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>\n\n ${image\n ? url\n ? target\n ? html`<a href=${url} target=${target}><img src=${image} /></a>`\n : html`<a href=${url}><img src=${image} /></a>`\n : html`<img src=${image} />`\n : html``}\n <div message>${body}</div>\n ${type == 'ERROR'\n ? html`<div\n @click=${() => {\n this.decipherErrorCode()\n }}\n >\n <span class=\"more\"><md-icon>expand_circle_down</md-icon> more</span>\n </div>`\n : html``}\n ${detail ? html`<div detail>${detail.message}</div>` : html``}\n\n <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>\n `\n }\n\n updated(changed) {\n if (!this.notification?.confirmed) {\n this.setAttribute('newbie', '')\n } else {\n this.removeAttribute('newbie')\n }\n\n const url = this.notification?.url\n this.target = url && !isOriginSameAsLocation(url) && '_blank'\n }\n\n async decipherErrorCode() {\n if (this.type != 'ERROR' || !this.notification) {\n return\n }\n\n const { title, body } = this.notification\n var code = `${title}`\n if (body) {\n code += `: ${body}`\n }\n\n const response = await client.query({\n query: gql`\n query ($input: CodeDecipherInput!) {\n decipherErrorCode(input: $input) {\n message\n }\n }\n `,\n variables: {\n input: {\n code,\n system: ''\n }\n }\n })\n\n this.detail = response.data.decipherErrorCode\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../client/viewparts/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,SAAS,sBAAsB,CAAC,GAAG;IACjC,SAAS,WAAW,CAAC,QAAQ;QAC3B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAA;IACjD,CAAC;IAED,SAAS,MAAM,CAAC,QAAQ;QACtB,OAAO,QAAQ,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAA;IACjF,CAAC;IAED,IAAI,CAAC;QACH,IAAI,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAA;QAClC,IAAI,QAAQ,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;QAE9C,OAAO,CAAC,CAAC,CACP,QAAQ,CAAC,QAAQ;YACjB,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC,QAAQ;YAC1C,QAAQ,CAAC,IAAI;YACb,QAAQ,CAAC,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,MAAM,EAAE,EAAE;iBACX;aACF;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAA;IAC/C,CAAC;;AAjNM,uBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwHF;CACF,AA1HY,CA0HZ;AAE0C;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CAAc;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAiD;AAC/C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gDAAiB;AAjIlC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmN5B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport gql from 'graphql-tag'\nimport { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\n\nfunction isOriginSameAsLocation(url) {\n function defaultPort(protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }\n\n function portOf(location) {\n return location.port || defaultPort(location.protocol || pageLocation.protocol)\n }\n\n try {\n var pageLocation = window.location\n var urlparts = new URL(url, pageLocation.href)\n\n return !!(\n urlparts.protocol &&\n urlparts.protocol == pageLocation.protocol &&\n urlparts.host &&\n urlparts.host == pageLocation.host &&\n urlparts.host &&\n portOf(urlparts) == portOf(pageLocation)\n )\n } catch (err) {\n console.warn(err, url)\n }\n}\n\n@customElement('notification-item')\nexport class NotificationItem extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-medium);\n border-left: 0 solid transparent;\n border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;\n transition:\n border-left 200ms ease-in-out,\n padding-left 200ms ease-in-out;\n color: var(--md-sys-color-on-surface);\n\n --type-dot-size: 9px;\n }\n\n :host([newbie]) {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n :host(:hover) {\n padding-left: 0.5rem;\n border-left: 0.2rem solid var(--status-info-color);\n }\n\n [titler] {\n white-space: normal;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: var(--fontsize-large);\n font-weight: bold;\n color: var(--md-sys-color-secondary);\n }\n\n [titler] span {\n display: inline-block;\n width: var(--type-dot-size);\n height: var(--type-dot-size);\n border-radius: 50%;\n margin-right: var(--spacing-small);\n margin-bottom: var(--spacing-tiny);\n }\n [titler] * {\n vertical-align: middle;\n }\n\n [close] {\n position: absolute;\n top: 13px;\n right: 0;\n font-size: var(--fontsize-large);\n opacity: 0.5;\n cursor: pointer;\n }\n [close]:hover {\n opacity: 1;\n }\n [detail] {\n padding: var(--spacing-small) var(--spacing-medium);\n border-radius: var(--border-radius);\n font-size: 0.85em;\n }\n span.more {\n margin-left: 16px;\n float: right;\n padding: 0px var(--spacing-small) 2px var(--spacing-small);\n border-radius: var(--border-radius);\n font-size: 0.8em;\n color: var(--md-sys-color-on-primary);\n --md-icon-size: 14px;\n }\n span.more * {\n vertical-align: middle;\n }\n\n :host([type='ERROR']) span {\n background-color: var(--status-danger-color);\n }\n :host([type='ERROR']) {\n border-color: var(--status-danger-color);\n }\n :host([type='ERROR']) [detail] {\n border: 1px solid rgba(241, 53, 63, 0.5);\n background-color: rgba(241, 53, 63, 0.1);\n }\n :host([type='WARN']) span {\n background-color: var(--status-warning-color);\n }\n :host([type='WARN']) {\n border-color: var(--status-warning-color);\n }\n :host([type='SUCCESS']) span {\n background-color: var(--status-success-color);\n }\n :host([type='SUCCESS']) {\n border-color: var(--status-success-color);\n }\n :host([type='INFO']) span,\n :host span {\n background-color: var(--status-info-color);\n }\n :host([type='INFO']) {\n border-color: var(--status-info-color);\n }\n\n img {\n display: block;\n max-width: 100%;\n margin: auto;\n }\n\n [message] {\n font-size: var(--fontsize-default);\n color: var(--md-sys-color-secondary);\n }\n\n [timestamp] {\n white-space: nowrap;\n font-size: var(--fontsize-small);\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @property({ type: String, reflect: true }) type?: string\n @property({ type: Object }) notification: any\n @property({ type: String }) target?: string\n @property({ type: Object }) detail?: { message: string; [key: string]: any }\n @property({ type: Boolean }) newbie?: boolean\n\n render() {\n const { title, url, image, timestamp, body } = this.notification\n const target = this.target\n const detail = this.detail\n const type = this.type\n\n return html`\n <div titler>\n <span></span>\n ${url\n ? target\n ? html`<a href=${url} target=${target}>${title}</a>`\n : html`<a href=${url}>${title}</a>`\n : title}\n </div>\n <md-icon close @click=${e => this.dispatchEvent(new CustomEvent('close'))}>close</md-icon>\n\n ${image\n ? url\n ? target\n ? html`<a href=${url} target=${target}><img src=${image} /></a>`\n : html`<a href=${url}><img src=${image} /></a>`\n : html`<img src=${image} />`\n : html``}\n <div message>${body}</div>\n ${type == 'ERROR'\n ? html`<div\n @click=${() => {\n this.decipherErrorCode()\n }}\n >\n <span class=\"more\"><md-icon>expand_circle_down</md-icon> more</span>\n </div>`\n : html``}\n ${detail ? html`<div detail>${detail.message}</div>` : html``}\n\n <div timestamp>${new Date(Number(timestamp)).toLocaleString()}</div>\n `\n }\n\n updated(changed) {\n if (!this.notification?.confirmed) {\n this.setAttribute('newbie', '')\n } else {\n this.removeAttribute('newbie')\n }\n\n const url = this.notification?.url\n this.target = url && !isOriginSameAsLocation(url) && '_blank'\n }\n\n async decipherErrorCode() {\n if (this.type != 'ERROR' || !this.notification) {\n return\n }\n\n const { title, body } = this.notification\n var code = `${title}`\n if (body) {\n code += `: ${body}`\n }\n\n const response = await client.query({\n query: gql`\n query ($input: CodeDecipherInput!) {\n decipherErrorCode(input: $input) {\n message\n }\n }\n `,\n variables: {\n input: {\n code,\n system: ''\n }\n }\n })\n\n this.detail = response.data.decipherErrorCode\n }\n}\n"]}
|
|
@@ -95,17 +95,6 @@ NotificationList.styles = [
|
|
|
95
95
|
overflow-x: hidden;
|
|
96
96
|
overflow-y: auto;
|
|
97
97
|
}
|
|
98
|
-
:host::before {
|
|
99
|
-
content: '';
|
|
100
|
-
width: 0px;
|
|
101
|
-
height: 0px;
|
|
102
|
-
border-left: 7px solid transparent;
|
|
103
|
-
border-right: 7px solid transparent;
|
|
104
|
-
border-bottom: 7px solid var(--md-sys-color-on-primary);
|
|
105
|
-
position: absolute;
|
|
106
|
-
margin-top: -7px;
|
|
107
|
-
right: 50px;
|
|
108
|
-
}
|
|
109
98
|
|
|
110
99
|
[notifications-wrap] {
|
|
111
100
|
display: flex;
|
|
@@ -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,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,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,OAAO,CAAC,KAAK,CAA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AAC,GAAG,CACf,IAAI,CAAC,OAAO;aACT,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC;aAC/C,GAAG,CAAC,KAAK,EAAC,YAAY,EAAC,EAAE;YACxB,OAAO,MAAM,iBAAiB,CAAC,GAAG,iCAC7B,YAAY,KACf,SAAS,EAAE,IAAI,IACf,CAAA;QACJ,CAAC,CAAC,CACL,CAAA;QAED,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAC,QAAQ,EAAC,EAAE;YAC/B,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,CAAA;YAEhD,QAAQ,CAAC;gBACP,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;aACtB,CAAC,CAAA;QACJ,CAAC,CAAQ,CAAC,CAAA;IACZ,CAAC;;AAjJM,uBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDF;CACF,AApDY,CAoDZ;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDAAoB;AAvDnC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAmJ5B","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 { connect } from 'pwa-helpers'\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 connect(store)(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 stateChanged(state) {\n this.history = state.notification.history\n }\n\n async disconnectedCallback() {\n super.disconnectedCallback()\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"]}
|