@rws-framework/client 2.18.13 → 2.18.14
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/package.json
CHANGED
|
@@ -9,16 +9,35 @@ class LineSplitter extends RWSViewComponent {
|
|
|
9
9
|
@observable text: string = '';
|
|
10
10
|
@observable content: string | ViewTemplate = '<span class="dots">.</span>';
|
|
11
11
|
@observable query: string = '';
|
|
12
|
+
|
|
13
|
+
@observable callback?: () => void;
|
|
12
14
|
|
|
15
|
+
@attr dots = false;
|
|
16
|
+
|
|
13
17
|
@attr allowedTags = '';
|
|
14
|
-
@attr addClass = '';
|
|
18
|
+
@attr addClass = '';
|
|
19
|
+
|
|
20
|
+
private stopAnimation: () => void = () => {};
|
|
15
21
|
|
|
16
22
|
private allowedHTMLTags: string[] = ['dl', 'dt', 'dd', 'br', 'blockquote', 'span', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'strong', 'i', 'small', 'u'];
|
|
17
23
|
|
|
24
|
+
connectedCallback(): void {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
|
|
27
|
+
console.log({dots: this.dots, cb: this.callback});
|
|
28
|
+
|
|
29
|
+
if(this.dots){
|
|
30
|
+
this.stopAnimation = this.animateLoadingDots();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if(this.text){
|
|
34
|
+
this.splitLines();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
18
37
|
|
|
19
38
|
parseTags(line: string): string | ViewTemplate
|
|
20
39
|
{
|
|
21
|
-
const componentAllowedTags: string[] = this.allowedHTMLTags.concat(this.allowedTags.split(','));
|
|
40
|
+
const componentAllowedTags: string[] = this.allowedHTMLTags.concat(this.allowedTags.split(','));
|
|
22
41
|
|
|
23
42
|
let output = this.domService.sanitizeHTML(line, { ADD_TAGS: [], ALLOWED_TAGS: componentAllowedTags });
|
|
24
43
|
|
|
@@ -47,11 +66,12 @@ class LineSplitter extends RWSViewComponent {
|
|
|
47
66
|
}
|
|
48
67
|
|
|
49
68
|
splitLines(): void
|
|
50
|
-
{
|
|
69
|
+
{
|
|
51
70
|
if([". ", ". . ", ". . . "].includes(this.text)){
|
|
52
71
|
this.content = `<span class="dots">${this.text}</span>`
|
|
53
|
-
}else{
|
|
54
|
-
this.
|
|
72
|
+
}else{
|
|
73
|
+
this.stopAnimation();
|
|
74
|
+
this.content = this.parseTags(this.text);
|
|
55
75
|
}
|
|
56
76
|
}
|
|
57
77
|
|
|
@@ -63,6 +83,23 @@ class LineSplitter extends RWSViewComponent {
|
|
|
63
83
|
}
|
|
64
84
|
}
|
|
65
85
|
|
|
86
|
+
contentChanged(){
|
|
87
|
+
if(this.callback){
|
|
88
|
+
this.callback();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
animateLoadingDots(): () => void {
|
|
93
|
+
let counter = 1;
|
|
94
|
+
const interval = setInterval(() => {
|
|
95
|
+
counter = counter % 3 + 1;
|
|
96
|
+
this.text = '. '.repeat(counter);
|
|
97
|
+
}, 800);
|
|
98
|
+
|
|
99
|
+
// Zwracamy funkcję do zatrzymania animacji
|
|
100
|
+
return () => clearInterval(interval);
|
|
101
|
+
}
|
|
102
|
+
|
|
66
103
|
addClassChanged(oldVal: string, newVal: string)
|
|
67
104
|
{
|
|
68
105
|
if(newVal){
|
|
@@ -70,14 +107,6 @@ class LineSplitter extends RWSViewComponent {
|
|
|
70
107
|
}
|
|
71
108
|
}
|
|
72
109
|
|
|
73
|
-
connectedCallback(): void {
|
|
74
|
-
super.connectedCallback();
|
|
75
|
-
|
|
76
|
-
if(this.text){
|
|
77
|
-
this.splitLines();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
110
|
queryChanged(oldVal: string, newVal: string){
|
|
82
111
|
if(newVal){
|
|
83
112
|
this.splitLines();
|