@operato/data-grist 10.29.85 → 10.29.87
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the view shows its end with pages still to read. A view not on screen (no height) never asks. Nor does one
|
|
3
|
+
* whose bottom is below the window: a view that grows with its records instead of scrolling them always "shows its
|
|
4
|
+
* end", and would read every page of the list.
|
|
5
|
+
*/
|
|
6
|
+
export declare function wantsNextPage(view: HTMLElement, page: number, total: number, limit: number): boolean;
|
|
7
|
+
/** Asks the data provider for the next page (`DataProvider` listens on the grist). */
|
|
8
|
+
export declare function askNextPage(view: HTMLElement): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A list read page after page (card and list views) asks for its next page when its end comes into view. Waiting for
|
|
3
|
+
* a scroll is not enough: on a screen wide or tall enough to show the whole first page there is nothing to scroll, and
|
|
4
|
+
* the list stopped at its first 20 (user 2026-11-15, the figure library on a wide screen). So the view asks again after
|
|
5
|
+
* each page arrives and whenever its size changes, until it can scroll or the last page is in.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Whether the view shows its end with pages still to read. A view not on screen (no height) never asks. Nor does one
|
|
9
|
+
* whose bottom is below the window: a view that grows with its records instead of scrolling them always "shows its
|
|
10
|
+
* end", and would read every page of the list.
|
|
11
|
+
*/
|
|
12
|
+
export function wantsNextPage(view, page, total, limit) {
|
|
13
|
+
if (!view.isConnected || view.clientHeight === 0)
|
|
14
|
+
return false;
|
|
15
|
+
if (!limit || page >= Math.ceil(total / limit))
|
|
16
|
+
return false;
|
|
17
|
+
if (view.getBoundingClientRect().bottom > window.innerHeight + 1)
|
|
18
|
+
return false;
|
|
19
|
+
return view.scrollHeight <= view.clientHeight + view.scrollTop + 1;
|
|
20
|
+
}
|
|
21
|
+
/** Asks the data provider for the next page (`DataProvider` listens on the grist). */
|
|
22
|
+
export function askNextPage(view) {
|
|
23
|
+
view.dispatchEvent(new CustomEvent('attach-page', { bubbles: true, composed: true }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=attach-page.js.map
|
|
@@ -24,6 +24,9 @@ export declare class DataCard extends DataManipulator {
|
|
|
24
24
|
private _clearDropIndicator;
|
|
25
25
|
private _resetDragState;
|
|
26
26
|
updated(changes: PropertyValues<this>): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
private _resizeObserver?;
|
|
29
|
+
private _askNextPageIfEnd;
|
|
27
30
|
render(): import("lit-html").TemplateResult<1>;
|
|
28
31
|
private renderTotals;
|
|
29
32
|
gotoTop(e: Event): void;
|
|
@@ -9,6 +9,7 @@ import { accumulateRecord } from '../accumulator/accumulator.js';
|
|
|
9
9
|
import { groupColumn, groupHeading, opensGroup } from '../group-heading.js';
|
|
10
10
|
import { DataManipulator } from '../data-manipulator.js';
|
|
11
11
|
import { renderEmptyNote } from '../empty-note-render.js';
|
|
12
|
+
import { askNextPage, wantsNextPage } from '../attach-page.js';
|
|
12
13
|
let DataCard = class DataCard extends DataManipulator {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
@@ -24,20 +25,13 @@ let DataCard = class DataCard extends DataManipulator {
|
|
|
24
25
|
}
|
|
25
26
|
firstUpdated(changes) {
|
|
26
27
|
this.isTop = true;
|
|
27
|
-
/* infinite scrolling */
|
|
28
|
+
/* infinite scrolling - also when the page shown does not fill the view (attach-page.ts) */
|
|
28
29
|
this.addEventListener('scroll', e => {
|
|
29
|
-
|
|
30
|
-
const screenHeight = this.offsetHeight;
|
|
31
|
-
const currentScrollTop = this.scrollTop;
|
|
32
|
-
if (totalScrollHeight <= screenHeight + currentScrollTop + 1) {
|
|
33
|
-
/* 마지막 페이지까지 계속 페이지를 증가시킨다. */
|
|
34
|
-
var lastPage = Math.ceil(this._total / this._limit);
|
|
35
|
-
if (this._page < lastPage) {
|
|
36
|
-
this.dispatchEvent(new CustomEvent('attach-page', { bubbles: true, composed: true }));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
30
|
+
this._askNextPageIfEnd();
|
|
39
31
|
this.isTop = this.scrollTop == 0;
|
|
40
32
|
});
|
|
33
|
+
this._resizeObserver = new ResizeObserver(() => this._askNextPageIfEnd());
|
|
34
|
+
this._resizeObserver.observe(this);
|
|
41
35
|
this._wireReorder();
|
|
42
36
|
}
|
|
43
37
|
/*
|
|
@@ -218,8 +212,19 @@ let DataCard = class DataCard extends DataManipulator {
|
|
|
218
212
|
this._total = this.data.total || 0;
|
|
219
213
|
this._limit = this.data.limit || 20;
|
|
220
214
|
this._page = this.data.page || 0;
|
|
215
|
+
this._askNextPageIfEnd();
|
|
221
216
|
}
|
|
222
217
|
}
|
|
218
|
+
disconnectedCallback() {
|
|
219
|
+
var _a;
|
|
220
|
+
super.disconnectedCallback();
|
|
221
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
222
|
+
this._resizeObserver = undefined;
|
|
223
|
+
}
|
|
224
|
+
_askNextPageIfEnd() {
|
|
225
|
+
if (wantsNextPage(this, this._page, this._total, this._limit))
|
|
226
|
+
askNextPage(this);
|
|
227
|
+
}
|
|
223
228
|
render() {
|
|
224
229
|
var { classifier, reorderable } = this.config.rows;
|
|
225
230
|
var records = this._records || [];
|
|
@@ -17,6 +17,9 @@ export declare class DataList extends DataManipulator {
|
|
|
17
17
|
private _page;
|
|
18
18
|
firstUpdated(changes: PropertyValues<this>): void;
|
|
19
19
|
updated(changes: PropertyValues<this>): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
private _resizeObserver?;
|
|
22
|
+
private _askNextPageIfEnd;
|
|
20
23
|
render(): import("lit-html").TemplateResult<1>;
|
|
21
24
|
gotoTop(e: Event): void;
|
|
22
25
|
get pullToRefreshTarget(): this;
|
|
@@ -7,6 +7,7 @@ import { css, html } from 'lit';
|
|
|
7
7
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
8
8
|
import { DataManipulator } from '../data-manipulator.js';
|
|
9
9
|
import { renderEmptyNote } from '../empty-note-render.js';
|
|
10
|
+
import { askNextPage, wantsNextPage } from '../attach-page.js';
|
|
10
11
|
let DataList = class DataList extends DataManipulator {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
@@ -18,20 +19,13 @@ let DataList = class DataList extends DataManipulator {
|
|
|
18
19
|
}
|
|
19
20
|
firstUpdated(changes) {
|
|
20
21
|
this.isTop = true;
|
|
21
|
-
/* infinite scrolling */
|
|
22
|
+
/* infinite scrolling - also when the page shown does not fill the view (attach-page.ts) */
|
|
22
23
|
this.addEventListener('scroll', e => {
|
|
23
|
-
|
|
24
|
-
const screenHeight = this.offsetHeight;
|
|
25
|
-
const currentScrollTop = this.scrollTop;
|
|
26
|
-
if (totalScrollHeight <= screenHeight + currentScrollTop + 1) {
|
|
27
|
-
/* 마지막 페이지까지 계속 페이지를 증가시킨다. */
|
|
28
|
-
var lastPage = Math.ceil(this._total / this._limit);
|
|
29
|
-
if (this._page < lastPage) {
|
|
30
|
-
this.dispatchEvent(new CustomEvent('attach-page', { bubbles: true, composed: true }));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
24
|
+
this._askNextPageIfEnd();
|
|
33
25
|
this.isTop = this.scrollTop == 0;
|
|
34
26
|
});
|
|
27
|
+
this._resizeObserver = new ResizeObserver(() => this._askNextPageIfEnd());
|
|
28
|
+
this._resizeObserver.observe(this);
|
|
35
29
|
}
|
|
36
30
|
updated(changes) {
|
|
37
31
|
/*
|
|
@@ -43,8 +37,19 @@ let DataList = class DataList extends DataManipulator {
|
|
|
43
37
|
this._total = this.data.total || 0;
|
|
44
38
|
this._limit = this.data.limit || 20;
|
|
45
39
|
this._page = this.data.page || 0;
|
|
40
|
+
this._askNextPageIfEnd();
|
|
46
41
|
}
|
|
47
42
|
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
var _a;
|
|
45
|
+
super.disconnectedCallback();
|
|
46
|
+
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
47
|
+
this._resizeObserver = undefined;
|
|
48
|
+
}
|
|
49
|
+
_askNextPageIfEnd() {
|
|
50
|
+
if (wantsNextPage(this, this._page, this._total, this._limit))
|
|
51
|
+
askNextPage(this);
|
|
52
|
+
}
|
|
48
53
|
render() {
|
|
49
54
|
var { classifier } = this.config.rows;
|
|
50
55
|
var records = this._records || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/data-grist",
|
|
3
|
-
"version": "10.29.
|
|
3
|
+
"version": "10.29.87",
|
|
4
4
|
"description": "User interface for grid (desktop) and list (mobile)",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"type": "module",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"@material/web": "^2.0.0",
|
|
98
98
|
"@operato/headroom": "^10.29.83",
|
|
99
99
|
"@operato/i18n": "^10.29.85",
|
|
100
|
-
"@operato/input": "^10.29.
|
|
101
|
-
"@operato/layout": "^10.29.
|
|
100
|
+
"@operato/input": "^10.29.87",
|
|
101
|
+
"@operato/layout": "^10.29.87",
|
|
102
102
|
"@operato/list-state": "^10.29.85",
|
|
103
103
|
"@operato/p13n": "^10.29.85",
|
|
104
104
|
"@operato/popup": "^10.29.85",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"prettier --write"
|
|
145
145
|
]
|
|
146
146
|
},
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "5b486a37c6b182fcd15785c5f8c04b95faa3600a"
|
|
148
148
|
}
|