@telia-ace/knowledge-widget-components-notification-row 1.0.38-experimental.1 → 1.0.38-experimental.10
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/index.js +1 -1
- package/dist/notification-row-data-provider.d.ts +1 -12
- package/dist/{notification-row-wrapper.297e86c1.js → notification-row-wrapper.ca131e7d.js} +84 -107
- package/dist/notification-row-wrapper.ca131e7d.js.map +1 -0
- package/dist/notification-row.d.ts +1 -0
- package/package.json +9 -8
- package/dist/notification-row-wrapper.297e86c1.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { ReactiveControllerHost } from 'lit';
|
|
2
|
-
import {
|
|
3
|
-
import { Container } from '@webprovisions/platform';
|
|
4
|
-
declare class DataProvider {
|
|
5
|
-
private _host;
|
|
6
|
-
node: ComponentNode | undefined;
|
|
7
|
-
nodeId: string;
|
|
8
|
-
container: Container | undefined;
|
|
9
|
-
constructor(elem: HTMLElement);
|
|
10
|
-
initialize(): Promise<void>;
|
|
11
|
-
_requestInstance(key: string): any;
|
|
12
|
-
}
|
|
2
|
+
import { DataProvider } from '@telia-ace/widget-ui';
|
|
13
3
|
export declare class NotificationRowDataProvider extends DataProvider {
|
|
14
4
|
host: ReactiveControllerHost;
|
|
15
5
|
constructor(host: ReactiveControllerHost);
|
|
@@ -17,4 +7,3 @@ export declare class NotificationRowDataProvider extends DataProvider {
|
|
|
17
7
|
initialize(): Promise<void>;
|
|
18
8
|
_fetch(): Promise<void>;
|
|
19
9
|
}
|
|
20
|
-
export {};
|
|
@@ -1,68 +1,37 @@
|
|
|
1
|
-
var P = Object.defineProperty,
|
|
1
|
+
var P = Object.defineProperty, k = Object.defineProperties;
|
|
2
2
|
var A = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var y = Object.getOwnPropertySymbols,
|
|
4
|
-
var w = (
|
|
3
|
+
var y = Object.getOwnPropertySymbols, C = Object.getPrototypeOf, L = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable, O = Reflect.get;
|
|
4
|
+
var w = (i, t, e) => t in i ? P(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, b = (i, t) => {
|
|
5
5
|
for (var e in t || (t = {}))
|
|
6
|
-
L.call(t, e) && w(
|
|
6
|
+
L.call(t, e) && w(i, e, t[e]);
|
|
7
7
|
if (y)
|
|
8
8
|
for (var e of y(t))
|
|
9
|
-
z.call(t, e) && w(
|
|
10
|
-
return
|
|
11
|
-
}, f = (
|
|
12
|
-
var m = (
|
|
13
|
-
var
|
|
14
|
-
var
|
|
9
|
+
z.call(t, e) && w(i, e, t[e]);
|
|
10
|
+
return i;
|
|
11
|
+
}, f = (i, t) => k(i, A(t));
|
|
12
|
+
var m = (i, t, e) => O(C(i), e, t);
|
|
13
|
+
var u = (i, t, e) => new Promise((o, n) => {
|
|
14
|
+
var a = (c) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
16
|
+
p(e.next(c));
|
|
17
|
+
} catch (h) {
|
|
18
|
+
n(h);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, s = (c) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
22
|
+
p(e.throw(c));
|
|
23
|
+
} catch (h) {
|
|
24
|
+
n(h);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, p = (c) => c.done ? o(c.value) : Promise.resolve(c.value).then(a, s);
|
|
27
|
+
p((e = e.apply(i, t)).next());
|
|
28
28
|
});
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { LitElement as
|
|
32
|
-
import { property as
|
|
29
|
+
import { DataClient as N } from "@telia-ace/knowledge-data-client";
|
|
30
|
+
import { DataProvider as E, WidgetComponentMixin as S, NodeConnector as D } from "@telia-ace/widget-ui";
|
|
31
|
+
import { LitElement as B, nothing as v, html as g, css as R } from "lit";
|
|
32
|
+
import { property as d, state as $ } from "lit/decorators.js";
|
|
33
33
|
import { classMap as _ } from "lit/directives/class-map.js";
|
|
34
|
-
class
|
|
35
|
-
constructor(t) {
|
|
36
|
-
this.nodeId = "", this._host = t;
|
|
37
|
-
}
|
|
38
|
-
initialize() {
|
|
39
|
-
return h(this, null, function* () {
|
|
40
|
-
if (this.nodeId = this._host.getAttribute("nodeId"), !this.nodeId) {
|
|
41
|
-
console.warn("Could not get node id in DataProvider.");
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (this.container = this._requestInstance("container"), !this.container) {
|
|
45
|
-
console.warn("Could not get data in DataProvider. Container was not defined.");
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const t = yield I.getInstance(this.container);
|
|
49
|
-
if (this.node = t.nodes.get(this.nodeId), !this.node) {
|
|
50
|
-
console.warn(`Could not get component node with ID: ${this.nodeId}.`);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
_requestInstance(t) {
|
|
56
|
-
const e = new CustomEvent("request-instance", {
|
|
57
|
-
detail: { key: t },
|
|
58
|
-
bubbles: !0,
|
|
59
|
-
composed: !0,
|
|
60
|
-
cancelable: !0
|
|
61
|
-
});
|
|
62
|
-
return this._host.dispatchEvent(e), e.detail.instance;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
class x extends B {
|
|
34
|
+
class x extends E {
|
|
66
35
|
constructor(t) {
|
|
67
36
|
super(t), (this.host = t).addController(this);
|
|
68
37
|
}
|
|
@@ -70,43 +39,47 @@ class x extends B {
|
|
|
70
39
|
this.initialize();
|
|
71
40
|
}
|
|
72
41
|
initialize() {
|
|
73
|
-
return
|
|
42
|
+
return u(this, null, function* () {
|
|
74
43
|
yield m(x.prototype, this, "initialize").call(this), this._fetch();
|
|
75
44
|
});
|
|
76
45
|
}
|
|
77
46
|
_fetch() {
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
if (!this.node)
|
|
47
|
+
return u(this, null, function* () {
|
|
48
|
+
if (!this.node || !this.container)
|
|
81
49
|
return;
|
|
82
50
|
this.node.writeProperties(f(b({}, this.node.attributes.properties), {
|
|
83
51
|
loading: !0,
|
|
84
52
|
error: void 0,
|
|
85
53
|
notifications: []
|
|
86
54
|
}));
|
|
55
|
+
const t = yield N.getInstance(this.container);
|
|
56
|
+
if (!t) {
|
|
57
|
+
console.warn("Unable to get DataClient in NotificationRow.");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
87
60
|
const {
|
|
88
|
-
topNotifications:
|
|
89
|
-
bottomNotifications:
|
|
90
|
-
middleNotifications:
|
|
91
|
-
} = yield
|
|
92
|
-
let
|
|
93
|
-
const { notifications:
|
|
94
|
-
|
|
61
|
+
topNotifications: e = [],
|
|
62
|
+
bottomNotifications: o = [],
|
|
63
|
+
middleNotifications: n = []
|
|
64
|
+
} = yield t.fetch("row-notices", {});
|
|
65
|
+
let a = [];
|
|
66
|
+
const { notifications: s, types: p = [] } = this.node.attributes.properties;
|
|
67
|
+
p.length ? (p.indexOf("top") > -1 && (a = a.concat(e)), p.indexOf("middle") > -1 && (a = a.concat(n)), p.indexOf("bottom") > -1 && (a = a.concat(o))) : a = e, this.node.writeProperties(f(b({}, this.node.attributes.properties), {
|
|
95
68
|
loading: !1,
|
|
96
69
|
error: void 0,
|
|
97
|
-
notifications:
|
|
70
|
+
notifications: a.length ? a : s
|
|
98
71
|
}));
|
|
99
72
|
});
|
|
100
73
|
}
|
|
101
74
|
}
|
|
102
|
-
var j = Object.defineProperty,
|
|
103
|
-
for (var
|
|
104
|
-
(
|
|
105
|
-
return o &&
|
|
75
|
+
var j = Object.defineProperty, K = Object.getOwnPropertyDescriptor, l = (i, t, e, o) => {
|
|
76
|
+
for (var n = o > 1 ? void 0 : o ? K(t, e) : t, a = i.length - 1, s; a >= 0; a--)
|
|
77
|
+
(s = i[a]) && (n = (o ? s(t, e, n) : s(n)) || n);
|
|
78
|
+
return o && n && j(t, e, n), n;
|
|
106
79
|
};
|
|
107
|
-
class r extends
|
|
80
|
+
class r extends B {
|
|
108
81
|
constructor() {
|
|
109
|
-
super(
|
|
82
|
+
super(), this._closeAriaLabel = "", this._pagePreviousAriaLabel = "", this._pageNextAriaLabel = "", this._types = [], this._notifications = [], this._expandable = !1, this._allowPaging = !1, this.expanded = !1, this.index = 0, this.closed = [];
|
|
110
83
|
}
|
|
111
84
|
connectedCallback() {
|
|
112
85
|
super.connectedCallback();
|
|
@@ -133,7 +106,7 @@ class r extends S {
|
|
|
133
106
|
"not-expandable": this._expandable && !this.expanded
|
|
134
107
|
};
|
|
135
108
|
if (this._allowPaging = !0, this._allowPaging) {
|
|
136
|
-
const o = t[this.index] || t[this.index + 1] || t[this.index - 1], { id:
|
|
109
|
+
const o = t[this.index] || t[this.index + 1] || t[this.index - 1], { id: n, body: a } = o || {};
|
|
137
110
|
return g`
|
|
138
111
|
<!-- onKeyDown={(e: React.KeyboardEvent) => {
|
|
139
112
|
if (e.key === 'Enter') {
|
|
@@ -158,24 +131,24 @@ class r extends S {
|
|
|
158
131
|
part="close-button"
|
|
159
132
|
aria-label=${this._closeAriaLabel}
|
|
160
133
|
@click=${() => {
|
|
161
|
-
this.index = t.indexOf(o), this.closed = [...this.closed,
|
|
134
|
+
this.index = t.indexOf(o), this.closed = [...this.closed, n];
|
|
162
135
|
}}
|
|
163
136
|
>
|
|
164
137
|
<ui-symbol-badge .symbol=${{ type: "Svg", content: "close" }} />
|
|
165
138
|
</ui-button>
|
|
166
139
|
<ui-html
|
|
167
140
|
data-pageable=${length > 1}
|
|
168
|
-
data-notification=${
|
|
141
|
+
data-notification=${n}
|
|
169
142
|
data-expandable=${this._expandable}
|
|
170
143
|
data-expanded=${this.expanded}
|
|
171
|
-
.html=${
|
|
172
|
-
|
|
144
|
+
.html=${a}
|
|
145
|
+
></ui-html>
|
|
173
146
|
<div class="notification-row-pager" part="pager">
|
|
174
147
|
<ui-button
|
|
175
148
|
aria-label=${this._pagePreviousAriaLabel}
|
|
176
149
|
data-disabled=${this.index === 0}
|
|
177
|
-
@click=${(
|
|
178
|
-
|
|
150
|
+
@click=${(s) => {
|
|
151
|
+
s.stopPropagation(), this.index > 0 && (this.index -= 1);
|
|
179
152
|
}}
|
|
180
153
|
part="arrow-button"
|
|
181
154
|
>
|
|
@@ -189,8 +162,8 @@ class r extends S {
|
|
|
189
162
|
<ui-button
|
|
190
163
|
aria-label=${this._pageNextAriaLabel}
|
|
191
164
|
data-disabled=${this.index + 1 >= t.length}
|
|
192
|
-
@click=${(
|
|
193
|
-
|
|
165
|
+
@click=${(s) => {
|
|
166
|
+
s.stopPropagation(), this.index < t.length - 1 && (this.index += 1);
|
|
194
167
|
}}
|
|
195
168
|
part="arrow-button"
|
|
196
169
|
>
|
|
@@ -212,7 +185,7 @@ class r extends S {
|
|
|
212
185
|
}
|
|
213
186
|
}
|
|
214
187
|
r.styles = [
|
|
215
|
-
|
|
188
|
+
R`
|
|
216
189
|
:host::part(close-button) {
|
|
217
190
|
position: absolute;
|
|
218
191
|
top: 7.5px;
|
|
@@ -291,6 +264,10 @@ r.styles = [
|
|
|
291
264
|
font-weight: 300;
|
|
292
265
|
}
|
|
293
266
|
|
|
267
|
+
ui-html > div p:only-child {
|
|
268
|
+
margin: 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
294
271
|
ui-button::part(container) {
|
|
295
272
|
background-color: transparent;
|
|
296
273
|
border: none;
|
|
@@ -322,45 +299,45 @@ r.styles = [
|
|
|
322
299
|
}
|
|
323
300
|
`
|
|
324
301
|
];
|
|
325
|
-
|
|
326
|
-
|
|
302
|
+
l([
|
|
303
|
+
d({ type: Boolean })
|
|
327
304
|
], r.prototype, "_allowPaging", 2);
|
|
328
|
-
|
|
329
|
-
|
|
305
|
+
l([
|
|
306
|
+
d({ type: Boolean })
|
|
330
307
|
], r.prototype, "_expandable", 2);
|
|
331
|
-
|
|
332
|
-
|
|
308
|
+
l([
|
|
309
|
+
d({ type: String })
|
|
333
310
|
], r.prototype, "_closeAriaLabel", 2);
|
|
334
|
-
|
|
335
|
-
|
|
311
|
+
l([
|
|
312
|
+
d({ type: String })
|
|
336
313
|
], r.prototype, "_pageNextAriaLabel", 2);
|
|
337
|
-
|
|
338
|
-
|
|
314
|
+
l([
|
|
315
|
+
d({ type: String })
|
|
339
316
|
], r.prototype, "_expandAriaLabel", 2);
|
|
340
|
-
|
|
341
|
-
|
|
317
|
+
l([
|
|
318
|
+
d({ type: String })
|
|
342
319
|
], r.prototype, "_pagePreviousAriaLabel", 2);
|
|
343
|
-
|
|
344
|
-
|
|
320
|
+
l([
|
|
321
|
+
d({ type: Array })
|
|
345
322
|
], r.prototype, "_types", 2);
|
|
346
|
-
|
|
347
|
-
|
|
323
|
+
l([
|
|
324
|
+
d({ type: Array })
|
|
348
325
|
], r.prototype, "_notifications", 2);
|
|
349
|
-
|
|
326
|
+
l([
|
|
350
327
|
$()
|
|
351
328
|
], r.prototype, "closed", 2);
|
|
352
|
-
|
|
353
|
-
|
|
329
|
+
l([
|
|
330
|
+
d({ reflect: !0 })
|
|
354
331
|
], r.prototype, "expanded", 2);
|
|
355
|
-
|
|
332
|
+
l([
|
|
356
333
|
$()
|
|
357
334
|
], r.prototype, "index", 2);
|
|
358
|
-
class
|
|
335
|
+
class F extends S(r) {
|
|
359
336
|
constructor() {
|
|
360
|
-
super(), this.connector = new
|
|
337
|
+
super(), this.connector = new D(this), this.dataProvider = new x(this);
|
|
361
338
|
}
|
|
362
339
|
}
|
|
363
340
|
export {
|
|
364
|
-
|
|
341
|
+
F as default
|
|
365
342
|
};
|
|
366
|
-
//# sourceMappingURL=notification-row-wrapper.
|
|
343
|
+
//# sourceMappingURL=notification-row-wrapper.ca131e7d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-row-wrapper.ca131e7d.js","sources":["../src/notification-row-data-provider.ts","../src/notification-row.ts","../src/notification-row-wrapper.ts"],"sourcesContent":["import { ReactiveControllerHost } from 'lit';\n// import { DataProvider } from 'types-web';\nimport { DataClient } from '@telia-ace/knowledge-data-client';\nimport { DataProvider } from '@telia-ace/widget-ui';\n\n// class DataProvider {\n// private _host: HTMLElement;\n// node: ComponentNode | undefined;\n// nodeId: string = '';\n// container: Container | undefined;\n\n// constructor(elem: HTMLElement) {\n// this._host = elem;\n// }\n\n// async initialize() {\n// this.nodeId = (this._host as any).getAttribute('nodeId');\n\n// if (!this.nodeId) {\n// console.warn('Could not get node id in DataProvider.');\n// return;\n// }\n\n// this.container = this._requestInstance('container');\n\n// if (!this.container) {\n// console.warn('Could not get data in DataProvider. Container was not defined.');\n// return;\n// }\n// const platform = await ComponentPlatform.getInstance(this.container);\n// this.node = platform.nodes.get(this.nodeId);\n\n// if (!this.node) {\n// console.warn(`Could not get component node with ID: ${this.nodeId}.`);\n// return;\n// }\n// }\n\n// _requestInstance(key: string) {\n// const event = new CustomEvent<{ key: string; instance?: any }>('request-instance', {\n// detail: { key },\n// bubbles: true,\n// composed: true,\n// cancelable: true,\n// });\n// (this._host as any).dispatchEvent(event);\n\n// return event.detail.instance;\n// }\n// }\n\nexport class NotificationRowDataProvider extends DataProvider {\n host;\n\n constructor(host: ReactiveControllerHost) {\n super(host as any);\n (this.host = host).addController(this);\n }\n\n hostConnected() {\n this.initialize();\n }\n\n async initialize() {\n await super.initialize();\n\n this._fetch();\n }\n\n async _fetch() {\n if (!this.node || !this.container) {\n return;\n }\n this.node.writeProperties({\n ...this.node.attributes.properties,\n loading: true,\n error: undefined,\n notifications: [],\n });\n\n const dataClient = await DataClient.getInstance(this.container);\n\n if (!dataClient) {\n console.warn('Unable to get DataClient in NotificationRow.');\n return;\n }\n\n const {\n topNotifications = [],\n bottomNotifications = [],\n middleNotifications = [],\n } = await (dataClient as any).fetch('row-notices', {\n // categories: [ TODO: missing\n // input.params.guideCategory,\n // input.params.contactCategory,\n // ].filter((c) => !!c),\n // searchPhrase: input.params.phrase,\n });\n // const {\n // topNotifications = [],\n // bottomNotifications = [],\n // middleNotifications = [],\n // } = await this.container?.getAsync('dataClient').then((dataClient) => {\n // return dataClient.fetch('row-notices', {\n // // categories: [ TODO: missing\n // // input.params.guideCategory,\n // // input.params.contactCategory,\n // // ].filter((c) => !!c),\n // // searchPhrase: input.params.phrase,\n // });\n // });\n\n let newNotifications: Notification[] = [];\n const { notifications, types = [] } = this.node.attributes.properties;\n if (types.length) {\n if (types.indexOf('top') > -1) {\n newNotifications = newNotifications.concat(topNotifications);\n }\n if (types.indexOf('middle') > -1) {\n newNotifications = newNotifications.concat(middleNotifications);\n }\n if (types.indexOf('bottom') > -1) {\n newNotifications = newNotifications.concat(bottomNotifications);\n }\n } else {\n newNotifications = topNotifications;\n }\n\n this.node.writeProperties({\n ...this.node.attributes.properties,\n loading: false,\n error: undefined,\n notifications: newNotifications.length ? newNotifications : notifications,\n });\n }\n}\n","import { css, html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nexport default class NotificationRow extends LitElement {\n @property({ type: Boolean })\n declare _allowPaging;\n\n @property({ type: Boolean })\n declare _expandable;\n\n @property({ type: String })\n declare _closeAriaLabel: string;\n\n @property({ type: String })\n declare _pageNextAriaLabel: string;\n\n @property({ type: String })\n declare _expandAriaLabel: string;\n\n @property({ type: String })\n declare _pagePreviousAriaLabel;\n\n @property({ type: Array })\n declare _types: string[];\n\n @property({ type: Array })\n declare _notifications: any[]; // TODO: no any\n\n @state()\n declare closed: string[];\n\n @property({ reflect: true })\n declare expanded: boolean;\n\n @state()\n declare index: number;\n\n // const CloseButton = styled(StyledButton)`\n // svg {\n // vertical-align: middle;\n // line,\n // path {\n // stroke: ${(p) => p.theme.colors?.text};\n // }\n // }\n // `;\n\n static styles = [\n // genericHtml,\n css`\n :host::part(close-button) {\n position: absolute;\n top: 7.5px;\n right: 7.5px;\n width: 25px;\n height: auto;\n padding: calc(var(--size-small) / 2) var(--size-small);\n }\n\n :host::part(pager) {\n text-align: center;\n width: 100%;\n }\n\n :host::part(pager) span {\n font-size: var(--fonts-small);\n display: inline-block;\n width: 30px;\n text-align: center;\n }\n\n i {\n color: var(--colors-text);\n }\n\n a {\n color: var(--colors-link);\n }\n\n .notification-row {\n padding: var(--size-normal) calc(var(--cardinal) * 12);\n text-align: center;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n background-color: var(\n --notification-row-background,\n var(--notification-row-background-default)\n );\n color: var(--colors-text);\n border-radius: var(--borderRadius);\n }\n\n .notification-row.expandable {\n cursor: pointer;\n }\n\n .notification-row.not-expandable ui-html {\n max-width: 100%;\n }\n\n .notification-row.not-expandable ui-html p {\n display: none;\n }\n .notification-row.not-expandable ui-html p:first-child {\n display: block;\n margin-bottom: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .notification-row[data-allow-paging='false'] {\n flex-wrap: wrap;\n }\n .notification-row[data-allow-paging='false'] > div {\n min-width: 100%;\n margin: var(--cardinal * 2);\n }\n\n ui-html {\n flex: 1;\n font-size: var(--fonts-normal);\n line-height: 1.6em;\n font-weight: 300;\n }\n\n ui-html > div p:only-child {\n margin: 0;\n }\n\n ui-button::part(container) {\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: opacity 200ms ease-out;\n justify-self: flex-end;\n align-self: flex-start;\n padding: var(--size-small);\n }\n\n ui-button::part(container):focus-visible {\n outline: var(--accessibility-border);\n color: var(--accessibility-colors-inactiveText);\n border-color: transparent;\n }\n\n ui-button::part(container[data-disabled]) {\n display: none;\n }\n\n ui-button[data-disabled='true']::part(container) {\n opacity: 0.8;\n }\n\n @media (hover: hover) {\n ui-button[data-disabled='false']:hover::part(container) {\n opacity: 0.5;\n }\n }\n `,\n ];\n\n constructor() {\n super();\n this._closeAriaLabel = '';\n this._pagePreviousAriaLabel = '';\n this._pageNextAriaLabel = '';\n this._types = [];\n this._notifications = [];\n this._expandable = false;\n this._allowPaging = false;\n this.expanded = false;\n this.index = 0;\n this.closed = [];\n }\n\n connectedCallback() {\n super.connectedCallback();\n }\n\n private _toggleExpand() {\n this.expanded = !this.expanded;\n }\n\n private getBackgroundColor() {\n if (this._types.length) {\n if (this._types.indexOf('top') > -1) {\n return '--colors-warning';\n } else if (this._types.indexOf('bottom') > -1) {\n return '--colors-transparent';\n }\n return '--colors-primary';\n }\n return '--colors-warning';\n }\n\n render() {\n this.style.setProperty(\n '--notification-row-background-default',\n `var(${this.getBackgroundColor()})`\n );\n\n const filtered = this._notifications.filter(({ id }) => this.closed.indexOf(id) === -1);\n\n if (!filtered.length) {\n return nothing;\n }\n const classes = {\n 'humany-notification-row': true,\n 'notification-row': true,\n expandable: this._expandable,\n expanded: this.expanded,\n 'not-expandable': this._expandable && !this.expanded,\n };\n\n this._allowPaging = true;\n\n if (this._allowPaging) {\n const notification =\n filtered[this.index] || filtered[this.index + 1] || filtered[this.index - 1];\n\n const { id, body } = notification || {};\n\n return html`\n <!-- onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n toggleExpand();\n }\n }}\n onClick={toggleExpand} -->\n <div\n class=${classMap(classes)}\n part=\"container\"\n data-expandable=${this._expandable}\n data-allow-paging=${this._allowPaging}\n aria-expanded=${this._expandable ? this.expanded : true}\n aria-label=${this._expandAriaLabel}\n tabindex=${this._expandable ? 0 : -1}\n @click=${() => {\n this._toggleExpand();\n }}\n >\n <ui-button\n class=\"notification-row-close-button\"\n part=\"close-button\"\n aria-label=${this._closeAriaLabel}\n @click=${() => {\n this.index = filtered.indexOf(notification);\n this.closed = [...this.closed, id];\n }}\n >\n <ui-symbol-badge .symbol=${{ type: 'Svg', content: 'close' }} />\n </ui-button>\n <ui-html\n data-pageable=${length > 1}\n data-notification=${id}\n data-expandable=${this._expandable}\n data-expanded=${this.expanded}\n .html=${body}\n ></ui-html>\n <div class=\"notification-row-pager\" part=\"pager\">\n <ui-button\n aria-label=${this._pagePreviousAriaLabel}\n data-disabled=${this.index === 0}\n @click=${(e: Event) => {\n e.stopPropagation();\n if (this.index > 0) {\n this.index -= 1;\n }\n }}\n part=\"arrow-button\"\n >\n <ui-symbol-badge\n .size=${10}\n .symbol=${{ type: 'Svg', content: 'caret-left' }}\n part=\"arrow-icon\"\n />\n </ui-button>\n <span> ${this.index + 1}/${filtered.length} </span>\n <ui-button\n aria-label=${this._pageNextAriaLabel}\n data-disabled=${this.index + 1 >= filtered.length}\n @click=${(e: Event) => {\n e.stopPropagation();\n if (this.index < filtered.length - 1) {\n this.index += 1;\n }\n }}\n part=\"arrow-button\"\n >\n <ui-symbol-badge\n .size=${10}\n .symbol=${{ type: 'Svg', content: 'caret-right' }}\n part=\"arrow-icon\"\n />\n </ui-button>\n </div>\n </div>\n `;\n }\n\n // data-pageable=\"false\"\n // data-types=${types}\n // data-allow-paging=\"false\"\n // className={appendClassNames(className, 'humany-notification-row')}\n return html`\n <div part=\"container\" class=${classMap(classes)} data-expandable=${this._expandable}>\n ${filtered.map((notification) => {\n if (!notification) {\n return nothing;\n }\n\n return html` <ui-html .html=${notification.body} /> `;\n })}\n </div>\n `;\n }\n}\n","import { NotificationRowDataProvider } from './notification-row-data-provider';\n\nimport { NodeConnector, WidgetComponentMixin } from '@telia-ace/widget-ui';\nimport NotificationRow from './notification-row';\n\nexport default class NotificationRowWrapper extends WidgetComponentMixin(NotificationRow) {\n connector = new NodeConnector(this);\n dataProvider = new NotificationRowDataProvider(this);\n\n constructor() {\n super();\n }\n}\n"],"names":["NotificationRowDataProvider","DataProvider","host","__async","__superGet","__spreadProps","__spreadValues","dataClient","DataClient","topNotifications","bottomNotifications","middleNotifications","newNotifications","notifications","types","NotificationRow","LitElement","filtered","id","nothing","classes","notification","body","html","classMap","e","css","__decorateClass","property","state","NotificationRowWrapper","WidgetComponentMixin","NodeConnector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDO,MAAMA,UAAoCC,EAAa;AAAA,EAG1D,YAAYC,GAA8B;AACtC,UAAMA,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AhBTb,EAiBT,WAAA,0BAAA,CAAA;AAGAY,EAAA;AAAA,EADPC,EAAS,EAAE,MAAM,OAAO;AAAA,GAnBRb,EAoBT,WAAA,UAAA,CAAA;AAGAY,EAAA;AAAA,EADPC,EAAS,EAAE,MAAM,OAAO;AAAA,GAtBRb,EAuBT,WAAA,kBAAA,CAAA;AAGAY,EAAA;AAAA,EADPE,EAAM;AAAA,GAzBUd,EA0BT,WAAA,UAAA,CAAA;AAGAY,EAAA;AAAA,EADPC,EAAS,EAAE,SAAS,IAAM;AAAA,GA5BVb,EA6BT,WAAA,YAAA,CAAA;AAGAY,EAAA;AAAA,EADPE,EAAM;AAAA,GA/BUd,EAgCT,WAAA,SAAA,CAAA;AC/BS,MAAAe,UAA+BC,EAAqBhB,CAAe,EAAE;AAAA,EAItF,cAAc;AACJ,aAJE,KAAA,YAAA,IAAIiB,EAAc,IAAI,GACnB,KAAA,eAAA,IAAIhC,EAA4B,IAAI;AAAA,EAInD;AACJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-notification-row",
|
|
3
|
-
"version": "1.0.38-experimental.
|
|
3
|
+
"version": "1.0.38-experimental.10",
|
|
4
4
|
"description": "Notification row component for ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@telia-ace/knowledge-
|
|
25
|
-
"@telia-ace/knowledge-widget-
|
|
26
|
-
"@telia-ace/knowledge-widget-
|
|
27
|
-
"@telia-ace/widget-
|
|
28
|
-
"@telia-ace/widget-
|
|
29
|
-
"@telia-ace/widget-
|
|
24
|
+
"@telia-ace/knowledge-data-client": "^1.0.2-experimental.1",
|
|
25
|
+
"@telia-ace/knowledge-widget-core": "1.0.34-experimental.10",
|
|
26
|
+
"@telia-ace/knowledge-widget-types-grid": "1.0.45-experimental.10",
|
|
27
|
+
"@telia-ace/knowledge-widget-ui": "1.0.40-experimental.10",
|
|
28
|
+
"@telia-ace/widget-services": "^1.0.21-experimental.20",
|
|
29
|
+
"@telia-ace/widget-ui": "^1.0.28-experimental.20",
|
|
30
|
+
"@telia-ace/widget-utilities": "^1.0.10-experimental.20",
|
|
30
31
|
"@webprovisions/platform": "^1.1.2"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"@emotion/styled": "^11.10.5",
|
|
42
43
|
"@types/react": "^18.0.26",
|
|
43
44
|
"@types/react-dom": "^18.0.10",
|
|
44
|
-
"lit": "^2.6.
|
|
45
|
+
"lit": "^2.6.1",
|
|
45
46
|
"react": "^18.2.0",
|
|
46
47
|
"react-dom": "^18.2.0"
|
|
47
48
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification-row-wrapper.297e86c1.js","sources":["../src/notification-row-data-provider.ts","../src/notification-row.ts","../src/notification-row-wrapper.ts"],"sourcesContent":["import { ReactiveControllerHost } from 'lit';\n// import { DataProvider } from 'types-web';\nimport { ComponentNode, ComponentPlatform } from '@telia-ace/knowledge-widget-core';\nimport { Container } from '@webprovisions/platform';\n\nclass DataProvider {\n private _host: HTMLElement;\n node: ComponentNode | undefined;\n nodeId: string = '';\n container: Container | undefined;\n\n constructor(elem: HTMLElement) {\n this._host = elem;\n }\n\n async initialize() {\n this.nodeId = (this._host as any).getAttribute('nodeId');\n\n if (!this.nodeId) {\n console.warn('Could not get node id in DataProvider.');\n return;\n }\n\n this.container = this._requestInstance('container');\n\n if (!this.container) {\n console.warn('Could not get data in DataProvider. Container was not defined.');\n return;\n }\n const platform = await ComponentPlatform.getInstance(this.container);\n this.node = platform.nodes.get(this.nodeId);\n\n if (!this.node) {\n console.warn(`Could not get component node with ID: ${this.nodeId}.`);\n return;\n }\n }\n\n _requestInstance(key: string) {\n const event = new CustomEvent<{ key: string; instance?: any }>('request-instance', {\n detail: { key },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n (this._host as any).dispatchEvent(event);\n\n return event.detail.instance;\n }\n}\n\nexport class NotificationRowDataProvider extends DataProvider {\n host;\n\n constructor(host: ReactiveControllerHost) {\n super(host as any);\n (this.host = host).addController(this);\n }\n\n hostConnected() {\n this.initialize();\n }\n\n async initialize() {\n await super.initialize();\n\n this._fetch();\n }\n\n async _fetch() {\n if (!this.node) {\n return;\n }\n this.node.writeProperties({\n ...this.node.attributes.properties,\n loading: true,\n error: undefined,\n notifications: [],\n });\n\n const {\n topNotifications = [],\n bottomNotifications = [],\n middleNotifications = [],\n } = await this.container?.getAsync('dataClient').then((dataClient) => {\n return dataClient.fetch('row-notices', {\n // categories: [ TODO: missing\n // input.params.guideCategory,\n // input.params.contactCategory,\n // ].filter((c) => !!c),\n // searchPhrase: input.params.phrase,\n });\n });\n\n let newNotifications: Notification[] = [];\n const { notifications, types = [] } = this.node.attributes.properties;\n if (types.length) {\n if (types.indexOf('top') > -1) {\n newNotifications = newNotifications.concat(topNotifications);\n }\n if (types.indexOf('middle') > -1) {\n newNotifications = newNotifications.concat(middleNotifications);\n }\n if (types.indexOf('bottom') > -1) {\n newNotifications = newNotifications.concat(bottomNotifications);\n }\n } else {\n newNotifications = topNotifications;\n }\n\n this.node.writeProperties({\n ...this.node.attributes.properties,\n loading: false,\n error: undefined,\n notifications: newNotifications.length ? newNotifications : notifications,\n });\n }\n}\n","import { css, html, LitElement, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nexport default class NotificationRow extends LitElement {\n @property({ type: Boolean })\n _allowPaging = false;\n\n @property({ type: Boolean })\n _expandable = false;\n\n @property({ type: String })\n _closeAriaLabel = '';\n\n @property({ type: String })\n _pageNextAriaLabel = '';\n\n @property({ type: String })\n _expandAriaLabel = '';\n\n @property({ type: String })\n _pagePreviousAriaLabel = '';\n\n @property({ type: Array })\n _types: string[] = [];\n\n @property({ type: Array })\n _notifications: any[] = []; // TODO: no any\n\n @state() closed: string[] = [];\n\n @property({ reflect: true }) expanded = false;\n\n @state() index = 0;\n\n // const CloseButton = styled(StyledButton)`\n // svg {\n // vertical-align: middle;\n // line,\n // path {\n // stroke: ${(p) => p.theme.colors?.text};\n // }\n // }\n // `;\n\n static styles = [\n // genericHtml,\n css`\n :host::part(close-button) {\n position: absolute;\n top: 7.5px;\n right: 7.5px;\n width: 25px;\n height: auto;\n padding: calc(var(--size-small) / 2) var(--size-small);\n }\n\n :host::part(pager) {\n text-align: center;\n width: 100%;\n }\n\n :host::part(pager) span {\n font-size: var(--fonts-small);\n display: inline-block;\n width: 30px;\n text-align: center;\n }\n\n i {\n color: var(--colors-text);\n }\n\n a {\n color: var(--colors-link);\n }\n\n .notification-row {\n padding: var(--size-normal) calc(var(--cardinal) * 12);\n text-align: center;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n background-color: var(\n --notification-row-background,\n var(--notification-row-background-default)\n );\n color: var(--colors-text);\n border-radius: var(--borderRadius);\n }\n\n .notification-row.expandable {\n cursor: pointer;\n }\n\n .notification-row.not-expandable ui-html {\n max-width: 100%;\n }\n\n .notification-row.not-expandable ui-html p {\n display: none;\n }\n .notification-row.not-expandable ui-html p:first-child {\n display: block;\n margin-bottom: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .notification-row[data-allow-paging='false'] {\n flex-wrap: wrap;\n }\n .notification-row[data-allow-paging='false'] > div {\n min-width: 100%;\n margin: var(--cardinal * 2);\n }\n\n ui-html {\n flex: 1;\n font-size: var(--fonts-normal);\n line-height: 1.6em;\n font-weight: 300;\n }\n\n ui-button::part(container) {\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: opacity 200ms ease-out;\n justify-self: flex-end;\n align-self: flex-start;\n padding: var(--size-small);\n }\n\n ui-button::part(container):focus-visible {\n outline: var(--accessibility-border);\n color: var(--accessibility-colors-inactiveText);\n border-color: transparent;\n }\n\n ui-button::part(container[data-disabled]) {\n display: none;\n }\n\n ui-button[data-disabled='true']::part(container) {\n opacity: 0.8;\n }\n\n @media (hover: hover) {\n ui-button[data-disabled='false']:hover::part(container) {\n opacity: 0.5;\n }\n }\n `,\n ];\n\n connectedCallback() {\n super.connectedCallback();\n }\n\n private _toggleExpand() {\n this.expanded = !this.expanded;\n }\n\n private getBackgroundColor() {\n if (this._types.length) {\n if (this._types.indexOf('top') > -1) {\n return '--colors-warning';\n } else if (this._types.indexOf('bottom') > -1) {\n return '--colors-transparent';\n }\n return '--colors-primary';\n }\n return '--colors-warning';\n }\n\n render() {\n this.style.setProperty(\n '--notification-row-background-default',\n `var(${this.getBackgroundColor()})`\n );\n\n const filtered = this._notifications.filter(({ id }) => this.closed.indexOf(id) === -1);\n\n if (!filtered.length) {\n return nothing;\n }\n const classes = {\n 'humany-notification-row': true,\n 'notification-row': true,\n expandable: this._expandable,\n expanded: this.expanded,\n 'not-expandable': this._expandable && !this.expanded,\n };\n\n this._allowPaging = true;\n\n if (this._allowPaging) {\n const notification =\n filtered[this.index] || filtered[this.index + 1] || filtered[this.index - 1];\n\n const { id, body } = notification || {};\n\n return html`\n <!-- onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n toggleExpand();\n }\n }}\n onClick={toggleExpand} -->\n <div\n class=${classMap(classes)}\n part=\"container\"\n data-expandable=${this._expandable}\n data-allow-paging=${this._allowPaging}\n aria-expanded=${this._expandable ? this.expanded : true}\n aria-label=${this._expandAriaLabel}\n tabindex=${this._expandable ? 0 : -1}\n @click=${() => {\n this._toggleExpand();\n }}\n >\n <ui-button\n class=\"notification-row-close-button\"\n part=\"close-button\"\n aria-label=${this._closeAriaLabel}\n @click=${() => {\n this.index = filtered.indexOf(notification);\n this.closed = [...this.closed, id];\n }}\n >\n <ui-symbol-badge .symbol=${{ type: 'Svg', content: 'close' }} />\n </ui-button>\n <ui-html\n data-pageable=${length > 1}\n data-notification=${id}\n data-expandable=${this._expandable}\n data-expanded=${this.expanded}\n .html=${body}\n />\n <div class=\"notification-row-pager\" part=\"pager\">\n <ui-button\n aria-label=${this._pagePreviousAriaLabel}\n data-disabled=${this.index === 0}\n @click=${(e: Event) => {\n e.stopPropagation();\n if (this.index > 0) {\n this.index -= 1;\n }\n }}\n part=\"arrow-button\"\n >\n <ui-symbol-badge\n .size=${10}\n .symbol=${{ type: 'Svg', content: 'caret-left' }}\n part=\"arrow-icon\"\n />\n </ui-button>\n <span> ${this.index + 1}/${filtered.length} </span>\n <ui-button\n aria-label=${this._pageNextAriaLabel}\n data-disabled=${this.index + 1 >= filtered.length}\n @click=${(e: Event) => {\n e.stopPropagation();\n if (this.index < filtered.length - 1) {\n this.index += 1;\n }\n }}\n part=\"arrow-button\"\n >\n <ui-symbol-badge\n .size=${10}\n .symbol=${{ type: 'Svg', content: 'caret-right' }}\n part=\"arrow-icon\"\n />\n </ui-button>\n </div>\n </div>\n `;\n }\n\n // data-pageable=\"false\"\n // data-types=${types}\n // data-allow-paging=\"false\"\n // className={appendClassNames(className, 'humany-notification-row')}\n return html`\n <div part=\"container\" class=${classMap(classes)} data-expandable=${this._expandable}>\n ${filtered.map((notification) => {\n if (!notification) {\n return nothing;\n }\n\n return html` <ui-html .html=${notification.body} /> `;\n })}\n </div>\n `;\n }\n}\n","// import { NodeConnector, WidgetComponentMixin } from '@telia-ace/knowledge-widget-ui';\n// import NotificationRow from './notification-row';\nimport { NotificationRowDataProvider } from './notification-row-data-provider';\n\nimport { NodeConnector, WidgetComponentMixin } from '@telia-ace/widget-ui';\nimport NotificationRow from './notification-row';\n\n// type Constructor<T = {}> = new (...args: any[]) => T;\n// type TestType = <T extends Constructor<LitElement>>(Base: T);\n\nexport default class NotificationRowWrapper extends WidgetComponentMixin(NotificationRow) {\n connector = new NodeConnector(this);\n dataProvider = new NotificationRowDataProvider(this);\n\n constructor() {\n super();\n }\n}\n"],"names":["DataProvider","elem","__async","platform","ComponentPlatform","key","event","NotificationRowDataProvider","host","__superGet","__spreadProps","__spreadValues","topNotifications","bottomNotifications","middleNotifications","_a","dataClient","newNotifications","notifications","types","NotificationRow","LitElement","filtered","id","nothing","classes","notification","body","html","classMap","e","css","__decorateClass","property","state","NotificationRowWrapper","WidgetComponentMixin","NodeConnector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAMA,EAAa;AAAA,EAMf,YAAYC,GAAmB;AAHd,SAAA,SAAA,IAIb,KAAK,QAAQA;AAAA,EACjB;AAAA,EAEM,aAAa;AAAA,WAAAC,EAAA;AAGX,UAFJ,KAAK,SAAU,KAAK,MAAc,aAAa,QAAQ,GAEnD,CAAC,KAAK,QAAQ;AACd,gBAAQ,KAAK,wCAAwC;AACrD;AAAA,MACJ;AAII,UAFC,KAAA,YAAY,KAAK,iBAAiB,WAAW,GAE9C,CAAC,KAAK,WAAW;AACjB,gBAAQ,KAAK,gEAAgE;AAC7E;AAAA,MACJ;AACA,YAAMC,IAAW,MAAMC,EAAkB,YAAY,KAAK,SAAS;AAG/D,UAFJ,KAAK,OAAOD,EAAS,MAAM,IAAI,KAAK,MAAM,GAEtC,CAAC,KAAK,MAAM;AACJ,gBAAA,KAAK,yCAAyC,KAAK,SAAS;AACpE;AAAA,MACJ;AAAA,IACJ;AAAA;AAAA,EAEA,iBAAiBE,GAAa;AACpB,UAAAC,IAAQ,IAAI,YAA6C,oBAAoB;AAAA,MAC/E,QAAQ,EAAE,KAAAD,EAAI;AAAA,MACd,SAAS;AAAA,MACT,UAAU;AAAA,MACV,YAAY;AAAA,IAAA,CACf;AACA,gBAAK,MAAc,cAAcC,CAAK,GAEhCA,EAAM,OAAO;AAAA,EACxB;AACJ;AAEO,MAAMC,UAAoCP,EAAa;AAAA,EAG1D,YAAYQ,GAA8B;AACtC,UAAMA,CAAW,IAChB,KAAK,OAAOA,GAAM,cAAc,IAAI;AAAA,EACzC;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