@lexriver/dome 1.5.11 → 2.0.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/README.md +10 -4
- package/out/{AnimatedArray.d.ts → src/AnimatedArray.d.mts} +29 -29
- package/out/{AnimatedArray.js → src/AnimatedArray.mjs} +52 -51
- package/out/{AnimatedTable.d.ts → src/AnimatedTable.d.mts} +38 -38
- package/out/{AnimatedTable.js → src/AnimatedTable.mjs} +88 -91
- package/out/{AnimatedText.d.ts → src/AnimatedText.d.mts} +13 -13
- package/out/{AnimatedText.js → src/AnimatedText.mjs} +24 -24
- package/out/{Animation.d.ts → src/Animation.d.mts} +4 -4
- package/out/{temp-test.d.ts → src/Animation.mjs} +1 -1
- package/out/{Dome.d.ts → src/Dome.d.mts} +9 -9
- package/out/{Dome.js → src/Dome.mjs} +291 -295
- package/out/{DomeComponent.d.ts → src/DomeComponent.d.mts} +22 -19
- package/out/{DomeComponent.js → src/DomeComponent.mjs} +47 -44
- package/out/{DomeManipulator.d.ts → src/DomeManipulator.d.mts} +48 -48
- package/out/{DomeManipulator.js → src/DomeManipulator.mjs} +329 -329
- package/out/src/DomeRouter.console-test.d.mts +1 -0
- package/out/{DomeRouter.console-test.js → src/DomeRouter.console-test.mjs} +44 -44
- package/out/{DomeRouter.d.ts → src/DomeRouter.d.mts} +32 -30
- package/out/{DomeRouter.js → src/DomeRouter.mjs} +249 -237
- package/out/{LongestCommonSubsequence.d.ts → src/LongestCommonSubsequence.d.mts} +15 -15
- package/out/{LongestCommonSubsequence.js → src/LongestCommonSubsequence.mjs} +164 -164
- package/out/src/index.d.mts +11 -0
- package/out/src/index.mjs +11 -0
- package/out/src/temp-test.d.mts +1 -0
- package/out/{temp-test.js → src/temp-test.mjs} +20 -20
- package/out/vitest.config.d.ts +2 -0
- package/out/vitest.config.js +9 -0
- package/package.json +16 -14
- package/src/{AnimatedArray.ts → AnimatedArray.mts} +3 -3
- package/src/{AnimatedTable.ts → AnimatedTable.mts} +6 -6
- package/src/{AnimatedText.ts → AnimatedText.mts} +4 -4
- package/src/{Animation.ts → Animation.mts} +0 -0
- package/src/{Dome.ts → Dome.mts} +7 -11
- package/src/{DomeComponent.ts → DomeComponent.mts} +3 -3
- package/src/{DomeManipulator.ts → DomeManipulator.mts} +5 -5
- package/src/{DomeRouter.console-test.ts → DomeRouter.console-test.mts} +0 -0
- package/src/{DomeRouter.ts → DomeRouter.mts} +20 -6
- package/src/{LongestCommonSubsequence.ts → LongestCommonSubsequence.mts} +0 -0
- package/src/index.mts +12 -0
- package/src/{temp-test.ts → temp-test.mts} +1 -1
- package/tsconfig.json +57 -60
- package/vitest.config.ts +10 -0
- package/jest.config.js +0 -22
- package/out/Animation.js +0 -0
- package/out/DomeRouter.console-test.d.ts +0 -0
- package/out/index.d.ts +0 -12
- package/out/index.js +0 -14
- package/src/index.ts +0 -14
package/README.md
CHANGED
|
@@ -1350,7 +1350,7 @@ DomeManipulator.scrollToY({
|
|
|
1350
1350
|
Use DomeRouter for navigation in single page app.
|
|
1351
1351
|
|
|
1352
1352
|
```typescript
|
|
1353
|
-
DomeRouter.onRoute('/about', true, async (params, url) => {
|
|
1353
|
+
DomeRouter.onRoute('/about', true, async (params, url, scrollTo, query) => {
|
|
1354
1354
|
const { PageAbout } = await import('./pages/PageAbout') // dynamic import component
|
|
1355
1355
|
DomeManipulator.replaceAllChildrenAsync(divContainer, <PageAbout />, animationHide, animationShow) // replace current page with new page
|
|
1356
1356
|
})
|
|
@@ -1507,12 +1507,18 @@ Parameters:
|
|
|
1507
1507
|
Where `RouteAction` type is:
|
|
1508
1508
|
```typescript
|
|
1509
1509
|
export type RouteAction = (
|
|
1510
|
-
params:{[key:string]:string}, // parameters from url
|
|
1511
|
-
url:string,
|
|
1512
|
-
scrollToPreviousPositionAsync:()=>Promise<void
|
|
1510
|
+
params:{[key:string]:string|number}, // parameters from url path
|
|
1511
|
+
url:string, // url path without query string
|
|
1512
|
+
scrollToPreviousPositionAsync:()=>Promise<void>, // this function can be called to scroll to previous page position
|
|
1513
|
+
query:{[key:string]:string} // query parameters from window.location.search
|
|
1513
1514
|
) => void|Promise<void>
|
|
1514
1515
|
```
|
|
1515
1516
|
|
|
1517
|
+
For example, for URL `/search?category=books&sort=price`, the `query` parameter will be:
|
|
1518
|
+
```typescript
|
|
1519
|
+
{category: 'books', sort: 'price'}
|
|
1520
|
+
```
|
|
1521
|
+
|
|
1516
1522
|
example:
|
|
1517
1523
|
```typescript
|
|
1518
1524
|
DomeRouter.onRoute('/login', true, (params, url) => changePage(<PageLogin />))
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { Animation } from './Animation';
|
|
2
|
-
interface KeyToElementPair {
|
|
3
|
-
key: string;
|
|
4
|
-
element: HTMLElement;
|
|
5
|
-
}
|
|
6
|
-
export declare class AnimatedArray<T> {
|
|
7
|
-
protected params: {
|
|
8
|
-
parentElement?: HTMLElement;
|
|
9
|
-
array?: T[];
|
|
10
|
-
getKey: (o: T) => string;
|
|
11
|
-
getHtmlElement: (o: T) => HTMLElement;
|
|
12
|
-
animationShow?: Animation;
|
|
13
|
-
animationHide?: Animation;
|
|
14
|
-
emptyList?: HTMLElement;
|
|
15
|
-
};
|
|
16
|
-
arrayOfKeyToElement: KeyToElementPair[];
|
|
17
|
-
constructor(params: {
|
|
18
|
-
parentElement?: HTMLElement;
|
|
19
|
-
array?: T[];
|
|
20
|
-
getKey: (o: T) => string;
|
|
21
|
-
getHtmlElement: (o: T) => HTMLElement;
|
|
22
|
-
animationShow?: Animation;
|
|
23
|
-
animationHide?: Animation;
|
|
24
|
-
emptyList?: HTMLElement;
|
|
25
|
-
});
|
|
26
|
-
get size(): number;
|
|
27
|
-
update(array: T[], parentElement?: HTMLElement | Element): void;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
1
|
+
import { Animation } from './Animation.mjs';
|
|
2
|
+
interface KeyToElementPair {
|
|
3
|
+
key: string;
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
}
|
|
6
|
+
export declare class AnimatedArray<T> {
|
|
7
|
+
protected params: {
|
|
8
|
+
parentElement?: HTMLElement;
|
|
9
|
+
array?: T[];
|
|
10
|
+
getKey: (o: T) => string;
|
|
11
|
+
getHtmlElement: (o: T) => HTMLElement;
|
|
12
|
+
animationShow?: Animation;
|
|
13
|
+
animationHide?: Animation;
|
|
14
|
+
emptyList?: HTMLElement;
|
|
15
|
+
};
|
|
16
|
+
arrayOfKeyToElement: KeyToElementPair[];
|
|
17
|
+
constructor(params: {
|
|
18
|
+
parentElement?: HTMLElement;
|
|
19
|
+
array?: T[];
|
|
20
|
+
getKey: (o: T) => string;
|
|
21
|
+
getHtmlElement: (o: T) => HTMLElement;
|
|
22
|
+
animationShow?: Animation;
|
|
23
|
+
animationHide?: Animation;
|
|
24
|
+
emptyList?: HTMLElement;
|
|
25
|
+
});
|
|
26
|
+
get size(): number;
|
|
27
|
+
update(array: T[], parentElement?: HTMLElement | Element): void;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { DomeManipulator } from "./DomeManipulator";
|
|
2
|
-
import { LongestCommonSubsequence } from "./LongestCommonSubsequence";
|
|
3
|
-
export class AnimatedArray {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.arrayOfKeyToElement.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
1
|
+
import { DomeManipulator } from "./DomeManipulator.mjs";
|
|
2
|
+
import { LongestCommonSubsequence } from "./LongestCommonSubsequence.mjs";
|
|
3
|
+
export class AnimatedArray {
|
|
4
|
+
params;
|
|
5
|
+
arrayOfKeyToElement = [];
|
|
6
|
+
constructor(params) {
|
|
7
|
+
this.params = params;
|
|
8
|
+
if (params.array && params.parentElement) {
|
|
9
|
+
this.update(params.array);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
get size() {
|
|
13
|
+
return this.arrayOfKeyToElement.length;
|
|
14
|
+
}
|
|
15
|
+
update(array, parentElement) {
|
|
16
|
+
parentElement = parentElement || this.params.parentElement;
|
|
17
|
+
if (!parentElement) {
|
|
18
|
+
console.warn('AnimatedArray unable to update, no parentElement');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (array.length == 0 && this.params.emptyList) {
|
|
22
|
+
DomeManipulator.replaceAllChildrenAsync(parentElement, this.params.emptyList);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (array.length > 0 && this.params.emptyList) {
|
|
26
|
+
DomeManipulator.removeElementAsync(this.params.emptyList, this.params.animationHide);
|
|
27
|
+
}
|
|
28
|
+
//let arrayOfKeyToElement:KeyToElementPair[] = []
|
|
29
|
+
let newArrayOfKeys = array.map((item) => this.params.getKey(item));
|
|
30
|
+
let oldArrayOfKeys = this.arrayOfKeyToElement.map(x => x.key);
|
|
31
|
+
LongestCommonSubsequence.getPatchOrdered({
|
|
32
|
+
oldArray: oldArrayOfKeys,
|
|
33
|
+
newArray: newArrayOfKeys,
|
|
34
|
+
onAdd: (index, key) => {
|
|
35
|
+
if (!parentElement)
|
|
36
|
+
throw new Error('no parent element'); //TODO: remove this
|
|
37
|
+
let itemIndex = newArrayOfKeys.indexOf(key);
|
|
38
|
+
if (itemIndex == -1)
|
|
39
|
+
throw new Error('no itemIndex'); //TODO: remove this
|
|
40
|
+
let item = array[itemIndex];
|
|
41
|
+
let element = this.params.getHtmlElement(item);
|
|
42
|
+
this.arrayOfKeyToElement.splice(index, 0, { key, element });
|
|
43
|
+
DomeManipulator.insertByIndexAsync(element, index, parentElement, this.params.animationShow);
|
|
44
|
+
//this.insertNewElementWithAnimation(element, index, parentElement)
|
|
45
|
+
},
|
|
46
|
+
onRemove: (index, key) => {
|
|
47
|
+
DomeManipulator.removeElementAsync(this.arrayOfKeyToElement[index].element, this.params.animationHide);
|
|
48
|
+
this.arrayOfKeyToElement.splice(index, 1);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Animation } from './Animation';
|
|
3
|
-
import {
|
|
4
|
-
interface Attrs<T> {
|
|
5
|
-
isLoadingO?:
|
|
6
|
-
itemsO:
|
|
7
|
-
animationShowRow: Animation;
|
|
8
|
-
animationHideRow: Animation;
|
|
9
|
-
animationHideTable?: Animation;
|
|
10
|
-
animationShowTable?: Animation;
|
|
11
|
-
animationHideEmptyList?: Animation;
|
|
12
|
-
animationShowEmptyList?: Animation;
|
|
13
|
-
animationShowLoading?: Animation;
|
|
14
|
-
animationHideLoading?: Animation;
|
|
15
|
-
getKey: (item: T) => string;
|
|
16
|
-
rootElement?: HTMLElement;
|
|
17
|
-
tableElement?: HTMLElement;
|
|
18
|
-
tableBody?: HTMLElement;
|
|
19
|
-
renderTableHead?: (items: T[]) => HTMLElement;
|
|
20
|
-
renderTableRow: (item: T) => HTMLElement;
|
|
21
|
-
renderTableFooter?: (items: T[]) => HTMLElement;
|
|
22
|
-
renderEmptyList: () => HTMLElement;
|
|
23
|
-
renderLoading?: () => HTMLElement;
|
|
24
|
-
}
|
|
25
|
-
export declare class AnimatedTable<T> extends DomeComponent<Attrs<T>> {
|
|
26
|
-
refRoot: HTMLElement;
|
|
27
|
-
refTable: HTMLElement;
|
|
28
|
-
refTableHead: Element;
|
|
29
|
-
refTableBody: HTMLElement;
|
|
30
|
-
refTableFooter: Element;
|
|
31
|
-
refEmptyList: Element;
|
|
32
|
-
refLoading: Element;
|
|
33
|
-
animatedArray: AnimatedArray<T>;
|
|
34
|
-
render(): HTMLElement;
|
|
35
|
-
afterRender(): void;
|
|
36
|
-
updateAsync(): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
1
|
+
import { ObservableVariable } from '@lexriver/observable';
|
|
2
|
+
import { Animation } from './Animation.mjs';
|
|
3
|
+
import { AnimatedArray, DomeComponent } from "./index.mjs";
|
|
4
|
+
interface Attrs<T> {
|
|
5
|
+
isLoadingO?: ObservableVariable<boolean>;
|
|
6
|
+
itemsO: ObservableVariable<T[]>;
|
|
7
|
+
animationShowRow: Animation;
|
|
8
|
+
animationHideRow: Animation;
|
|
9
|
+
animationHideTable?: Animation;
|
|
10
|
+
animationShowTable?: Animation;
|
|
11
|
+
animationHideEmptyList?: Animation;
|
|
12
|
+
animationShowEmptyList?: Animation;
|
|
13
|
+
animationShowLoading?: Animation;
|
|
14
|
+
animationHideLoading?: Animation;
|
|
15
|
+
getKey: (item: T) => string;
|
|
16
|
+
rootElement?: HTMLElement;
|
|
17
|
+
tableElement?: HTMLElement;
|
|
18
|
+
tableBody?: HTMLElement;
|
|
19
|
+
renderTableHead?: (items: T[]) => HTMLElement;
|
|
20
|
+
renderTableRow: (item: T) => HTMLElement;
|
|
21
|
+
renderTableFooter?: (items: T[]) => HTMLElement;
|
|
22
|
+
renderEmptyList: () => HTMLElement;
|
|
23
|
+
renderLoading?: () => HTMLElement;
|
|
24
|
+
}
|
|
25
|
+
export declare class AnimatedTable<T> extends DomeComponent<Attrs<T>> {
|
|
26
|
+
refRoot: HTMLElement;
|
|
27
|
+
refTable: HTMLElement;
|
|
28
|
+
refTableHead: Element;
|
|
29
|
+
refTableBody: HTMLElement;
|
|
30
|
+
refTableFooter: Element;
|
|
31
|
+
refEmptyList: Element;
|
|
32
|
+
refLoading: Element;
|
|
33
|
+
animatedArray: AnimatedArray<T>;
|
|
34
|
+
render(): HTMLElement;
|
|
35
|
+
afterRender(): void;
|
|
36
|
+
updateAsync(): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -1,91 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class AnimatedTable extends DomeComponent {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (this.attrs.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (this.attrs.
|
|
78
|
-
this.
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
import { DomeManipulator } from "./DomeManipulator.mjs";
|
|
2
|
+
import { AnimatedArray, DomeComponent } from "./index.mjs";
|
|
3
|
+
export class AnimatedTable extends DomeComponent {
|
|
4
|
+
// rootElement
|
|
5
|
+
// table
|
|
6
|
+
// thead
|
|
7
|
+
// tbody
|
|
8
|
+
// tfooter
|
|
9
|
+
// emptyList
|
|
10
|
+
refRoot = this.attrs.rootElement || document.createElement('div');
|
|
11
|
+
refTable = this.attrs.tableElement || document.createElement('table');
|
|
12
|
+
refTableHead = this.attrs.renderTableHead ? this.attrs.renderTableHead(this.attrs.itemsO.get()) : document.createElement('thead');
|
|
13
|
+
refTableBody = this.attrs.tableBody || document.createElement('tbody');
|
|
14
|
+
refTableFooter = this.attrs.renderTableFooter ? this.attrs.renderTableFooter(this.attrs.itemsO.get()) : document.createElement('tfoot');
|
|
15
|
+
refEmptyList = this.attrs.renderEmptyList ? this.attrs.renderEmptyList() : document.createElement('div');
|
|
16
|
+
refLoading = this.attrs.renderLoading ? this.attrs.renderLoading() : document.createElement('div');
|
|
17
|
+
animatedArray = new AnimatedArray({
|
|
18
|
+
animationHide: this.attrs.animationHideRow,
|
|
19
|
+
animationShow: this.attrs.animationShowRow,
|
|
20
|
+
array: [],
|
|
21
|
+
getKey: this.attrs.getKey,
|
|
22
|
+
getHtmlElement: this.attrs.renderTableRow
|
|
23
|
+
});
|
|
24
|
+
render() {
|
|
25
|
+
// refRoot
|
|
26
|
+
// refTable
|
|
27
|
+
// refTableHead
|
|
28
|
+
// refTableBody
|
|
29
|
+
// refTableFooter
|
|
30
|
+
// refEmptyListEl
|
|
31
|
+
// refLoading
|
|
32
|
+
this.refRoot.appendChild(this.refTable);
|
|
33
|
+
this.refRoot.appendChild(this.refEmptyList);
|
|
34
|
+
this.refRoot.appendChild(this.refLoading);
|
|
35
|
+
if (this.refTableHead)
|
|
36
|
+
this.refTable.appendChild(this.refTableHead);
|
|
37
|
+
if (this.refTableBody)
|
|
38
|
+
this.refTable.appendChild(this.refTableBody);
|
|
39
|
+
if (this.refTableFooter)
|
|
40
|
+
this.refTable.appendChild(this.refTableFooter);
|
|
41
|
+
console.log('AnimatedTable render()', 'refRoot=', this.refRoot);
|
|
42
|
+
return this.refRoot;
|
|
43
|
+
}
|
|
44
|
+
afterRender() {
|
|
45
|
+
this.updateAsync();
|
|
46
|
+
//this.animatedArray.update(this.attrs.items, this.el)
|
|
47
|
+
}
|
|
48
|
+
async updateAsync() {
|
|
49
|
+
try {
|
|
50
|
+
if (this.attrs.renderLoading) {
|
|
51
|
+
this.refLoading = await DomeManipulator.replaceAsync(this.refLoading, this.attrs.renderLoading());
|
|
52
|
+
}
|
|
53
|
+
if (this.attrs.isLoadingO && this.attrs.isLoadingO.get()) {
|
|
54
|
+
// show loading
|
|
55
|
+
await DomeManipulator.unhideElementAsync(this.refLoading, this.attrs.animationShowLoading);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// hide loading
|
|
59
|
+
await DomeManipulator.hideElementAsync(this.refLoading, this.attrs.animationHideLoading);
|
|
60
|
+
}
|
|
61
|
+
const items = this.attrs.itemsO.get();
|
|
62
|
+
const currentCount = items.length;
|
|
63
|
+
if (currentCount == 0) {
|
|
64
|
+
// render empty list
|
|
65
|
+
await DomeManipulator.hideElementAsync(this.refTable, this.attrs.animationHideTable);
|
|
66
|
+
if (this.attrs.renderEmptyList) {
|
|
67
|
+
this.refEmptyList = await DomeManipulator.replaceAsync(this.refEmptyList, this.attrs.renderEmptyList());
|
|
68
|
+
}
|
|
69
|
+
await DomeManipulator.unhideElementAsync(this.refEmptyList, this.attrs.animationShowEmptyList);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// render list with items
|
|
73
|
+
await DomeManipulator.hideElementAsync(this.refEmptyList, this.attrs.animationHideEmptyList);
|
|
74
|
+
if (this.attrs.renderTableHead) {
|
|
75
|
+
this.refTableHead = await DomeManipulator.replaceAsync(this.refTableHead, this.attrs.renderTableHead(items));
|
|
76
|
+
}
|
|
77
|
+
if (this.attrs.renderTableFooter) {
|
|
78
|
+
this.refTableFooter = await DomeManipulator.replaceAsync(this.refTableFooter, this.attrs.renderTableFooter(items));
|
|
79
|
+
}
|
|
80
|
+
await DomeManipulator.unhideElementAsync(this.refTable, this.attrs.animationShowTable);
|
|
81
|
+
this.animatedArray.update(items, this.refTableBody);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (x) {
|
|
85
|
+
console.error('AnimatedTable update failed', x);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
interface Attrs {
|
|
5
|
-
textO:
|
|
6
|
-
tag?: string;
|
|
7
|
-
class?: CssClass;
|
|
8
|
-
}
|
|
9
|
-
export declare class AnimatedText extends DomeComponent<Attrs> {
|
|
10
|
-
render(): HTMLElement;
|
|
11
|
-
updateAsync(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
1
|
+
import { ObservableVariable } from "@lexriver/observable";
|
|
2
|
+
import { CssClass } from "./DomeManipulator.mjs";
|
|
3
|
+
import { DomeComponent } from "./index.mjs";
|
|
4
|
+
interface Attrs {
|
|
5
|
+
textO: ObservableVariable<string>;
|
|
6
|
+
tag?: string;
|
|
7
|
+
class?: CssClass;
|
|
8
|
+
}
|
|
9
|
+
export declare class AnimatedText extends DomeComponent<Attrs> {
|
|
10
|
+
render(): HTMLElement;
|
|
11
|
+
updateAsync(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class AnimatedText extends DomeComponent {
|
|
4
|
-
render() {
|
|
5
|
-
//const result = this.attrs.tag ? document.createElement(this.attrs.tag) : document.createElement('span')
|
|
6
|
-
const result = document.createElement(this.attrs.tag || 'span');
|
|
7
|
-
//console.log('AnimatedText', 'this.attrs.class=',this.attrs.class)
|
|
8
|
-
if (this.attrs.class) {
|
|
9
|
-
DomeManipulator.setCssClasses(result, this.attrs.class);
|
|
10
|
-
}
|
|
11
|
-
result.append(this.attrs.textO.get());
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
async updateAsync() {
|
|
15
|
-
if (!this.rootElement)
|
|
16
|
-
return;
|
|
17
|
-
try {
|
|
18
|
-
this.rootElement = await DomeManipulator.replaceAsync(this.rootElement, this.render(), this.attrs.onHideAnimation, this.attrs.onShowAnimation);
|
|
19
|
-
}
|
|
20
|
-
catch (x) {
|
|
21
|
-
console.error('AnimatedText update failed', x);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import { DomeManipulator } from "./DomeManipulator.mjs";
|
|
2
|
+
import { DomeComponent } from "./index.mjs";
|
|
3
|
+
export class AnimatedText extends DomeComponent {
|
|
4
|
+
render() {
|
|
5
|
+
//const result = this.attrs.tag ? document.createElement(this.attrs.tag) : document.createElement('span')
|
|
6
|
+
const result = document.createElement(this.attrs.tag || 'span');
|
|
7
|
+
//console.log('AnimatedText', 'this.attrs.class=',this.attrs.class)
|
|
8
|
+
if (this.attrs.class) {
|
|
9
|
+
DomeManipulator.setCssClasses(result, this.attrs.class);
|
|
10
|
+
}
|
|
11
|
+
result.append(this.attrs.textO.get());
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
async updateAsync() {
|
|
15
|
+
if (!this.rootElement)
|
|
16
|
+
return;
|
|
17
|
+
try {
|
|
18
|
+
this.rootElement = await DomeManipulator.replaceAsync(this.rootElement, this.render(), this.attrs.onHideAnimation, this.attrs.onShowAnimation);
|
|
19
|
+
}
|
|
20
|
+
catch (x) {
|
|
21
|
+
console.error('AnimatedText update failed', x);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface Animation {
|
|
2
|
-
cssClassName: string;
|
|
3
|
-
timeMs: number;
|
|
4
|
-
}
|
|
1
|
+
export interface Animation {
|
|
2
|
+
cssClassName: string;
|
|
3
|
+
timeMs: number;
|
|
4
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare function h(tagName: any, attrs: any, ...childrenArgs: any[]): any;
|
|
2
|
-
export declare const React: {
|
|
3
|
-
createElement: typeof h;
|
|
4
|
-
Fragment: {
|
|
5
|
-
new (): DocumentFragment;
|
|
6
|
-
prototype: DocumentFragment;
|
|
7
|
-
} | (() => void);
|
|
8
|
-
};
|
|
9
|
-
export default React;
|
|
1
|
+
export declare function h(tagName: any, attrs: any, ...childrenArgs: any[]): any;
|
|
2
|
+
export declare const React: {
|
|
3
|
+
createElement: typeof h;
|
|
4
|
+
Fragment: {
|
|
5
|
+
new (): DocumentFragment;
|
|
6
|
+
prototype: DocumentFragment;
|
|
7
|
+
} | (() => void);
|
|
8
|
+
};
|
|
9
|
+
export default React;
|