@yuneta/gobj-ui 7.9.0 → 7.9.2
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/gobj-ui.cjs.js
CHANGED
|
@@ -15703,8 +15703,7 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
|
|
|
15703
15703
|
if (result >= 0) {
|
|
15704
15704
|
let gobj_topic_form = (0, _yuneta_gobj_js.gobj_find_child)(gobj, { __gobj_name__: `${(0, _yuneta_gobj_js.gobj_name)(gobj)}?${topic_name}` });
|
|
15705
15705
|
let answer = nodes_answer(data);
|
|
15706
|
-
let
|
|
15707
|
-
let req_id = (0, _yuneta_gobj_js.kw_get_str)(gobj, md, "req_id", "", 0);
|
|
15706
|
+
let req_id = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw_command, "req_id", "", 0);
|
|
15708
15707
|
if (req_id) (0, _yuneta_gobj_js.gobj_send_event)(gobj_topic_form, "EV_PAGE_LOADED", {
|
|
15709
15708
|
req_id,
|
|
15710
15709
|
rows: answer.rows,
|
|
@@ -16448,6 +16447,7 @@ var attrs_table$5 = [
|
|
|
16448
16447
|
var PRIVATE_DATA$5 = {
|
|
16449
16448
|
_pending_pages: null,
|
|
16450
16449
|
_page_seq: 0,
|
|
16450
|
+
_page_total: null,
|
|
16451
16451
|
$container: null,
|
|
16452
16452
|
treedb_name: "",
|
|
16453
16453
|
topic_name: "",
|
|
@@ -17216,11 +17216,19 @@ function create_tabulator(gobj) {
|
|
|
17216
17216
|
} catch (e) {
|
|
17217
17217
|
n = 0;
|
|
17218
17218
|
}
|
|
17219
|
-
|
|
17219
|
+
let paged = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_remote_paging");
|
|
17220
|
+
let total = gobj.priv._page_total;
|
|
17221
|
+
if (paged && typeof total === "number" && total > n) $rc.textContent = `${n} / ${total} ${(0, i18next.t)("rows")}`;
|
|
17222
|
+
else $rc.textContent = `${n} ${(0, i18next.t)("rows")}`;
|
|
17220
17223
|
let single_page = true;
|
|
17221
17224
|
try {
|
|
17222
|
-
|
|
17223
|
-
|
|
17225
|
+
if (paged) {
|
|
17226
|
+
let max = tabulator.getPageMax();
|
|
17227
|
+
single_page = max === false || max <= 1;
|
|
17228
|
+
} else {
|
|
17229
|
+
let size = tabulator.getPageSize();
|
|
17230
|
+
single_page = !size || n <= size;
|
|
17231
|
+
}
|
|
17224
17232
|
} catch (e) {
|
|
17225
17233
|
single_page = true;
|
|
17226
17234
|
}
|
|
@@ -18461,6 +18469,7 @@ function ac_repull_page(gobj, event, kw, src) {
|
|
|
18461
18469
|
* The host answered a page.
|
|
18462
18470
|
************************************************************/
|
|
18463
18471
|
function ac_page_loaded(gobj, event, kw, src) {
|
|
18472
|
+
if (typeof kw.total === "number") gobj.priv._page_total = kw.total;
|
|
18464
18473
|
settle_page(gobj, kw.req_id, {
|
|
18465
18474
|
data: (0, _yuneta_gobj_js.is_array)(kw.rows) ? kw.rows : [],
|
|
18466
18475
|
last_page: kw.pages || 1,
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -15698,8 +15698,7 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
|
|
|
15698
15698
|
if (result >= 0) {
|
|
15699
15699
|
let gobj_topic_form = gobj_find_child(gobj, { __gobj_name__: `${gobj_name(gobj)}?${topic_name}` });
|
|
15700
15700
|
let answer = nodes_answer(data);
|
|
15701
|
-
let
|
|
15702
|
-
let req_id = kw_get_str(gobj, md, "req_id", "", 0);
|
|
15701
|
+
let req_id = kw_get_str(gobj, kw_command, "req_id", "", 0);
|
|
15703
15702
|
if (req_id) gobj_send_event(gobj_topic_form, "EV_PAGE_LOADED", {
|
|
15704
15703
|
req_id,
|
|
15705
15704
|
rows: answer.rows,
|
|
@@ -16443,6 +16442,7 @@ var attrs_table$5 = [
|
|
|
16443
16442
|
var PRIVATE_DATA$5 = {
|
|
16444
16443
|
_pending_pages: null,
|
|
16445
16444
|
_page_seq: 0,
|
|
16445
|
+
_page_total: null,
|
|
16446
16446
|
$container: null,
|
|
16447
16447
|
treedb_name: "",
|
|
16448
16448
|
topic_name: "",
|
|
@@ -17211,11 +17211,19 @@ function create_tabulator(gobj) {
|
|
|
17211
17211
|
} catch (e) {
|
|
17212
17212
|
n = 0;
|
|
17213
17213
|
}
|
|
17214
|
-
|
|
17214
|
+
let paged = gobj_read_bool_attr(gobj, "with_remote_paging");
|
|
17215
|
+
let total = gobj.priv._page_total;
|
|
17216
|
+
if (paged && typeof total === "number" && total > n) $rc.textContent = `${n} / ${total} ${t("rows")}`;
|
|
17217
|
+
else $rc.textContent = `${n} ${t("rows")}`;
|
|
17215
17218
|
let single_page = true;
|
|
17216
17219
|
try {
|
|
17217
|
-
|
|
17218
|
-
|
|
17220
|
+
if (paged) {
|
|
17221
|
+
let max = tabulator.getPageMax();
|
|
17222
|
+
single_page = max === false || max <= 1;
|
|
17223
|
+
} else {
|
|
17224
|
+
let size = tabulator.getPageSize();
|
|
17225
|
+
single_page = !size || n <= size;
|
|
17226
|
+
}
|
|
17219
17227
|
} catch (e) {
|
|
17220
17228
|
single_page = true;
|
|
17221
17229
|
}
|
|
@@ -18456,6 +18464,7 @@ function ac_repull_page(gobj, event, kw, src) {
|
|
|
18456
18464
|
* The host answered a page.
|
|
18457
18465
|
************************************************************/
|
|
18458
18466
|
function ac_page_loaded(gobj, event, kw, src) {
|
|
18467
|
+
if (typeof kw.total === "number") gobj.priv._page_total = kw.total;
|
|
18459
18468
|
settle_page(gobj, kw.req_id, {
|
|
18460
18469
|
data: is_array(kw.rows) ? kw.rows : [],
|
|
18461
18470
|
last_page: kw.pages || 1,
|
package/package.json
CHANGED
|
@@ -151,6 +151,7 @@ SDATA_END()
|
|
|
151
151
|
let PRIVATE_DATA = {
|
|
152
152
|
_pending_pages: null, // req_id -> {resolve, reject, timer}
|
|
153
153
|
_page_seq: 0, // correlation id of a page request
|
|
154
|
+
_page_total: null, // rows the topic HAS, from the last page answer
|
|
154
155
|
$container: null,
|
|
155
156
|
treedb_name: "",
|
|
156
157
|
topic_name: "",
|
|
@@ -1203,15 +1204,33 @@ function create_tabulator(gobj)
|
|
|
1203
1204
|
n = 0;
|
|
1204
1205
|
}
|
|
1205
1206
|
}
|
|
1206
|
-
|
|
1207
|
+
/* Remote paging: `n` is the PAGE, so saying "50 rows" of a topic
|
|
1208
|
+
* with 114 would be a lie by omission. Say both. */
|
|
1209
|
+
let paged = gobj_read_bool_attr(gobj, "with_remote_paging");
|
|
1210
|
+
let total = gobj.priv._page_total;
|
|
1211
|
+
if(paged && typeof total === "number" && total > n) {
|
|
1212
|
+
$rc.textContent = `${n} / ${total} ${t("rows")}`;
|
|
1213
|
+
} else {
|
|
1214
|
+
$rc.textContent = `${n} ${t("rows")}`;
|
|
1215
|
+
}
|
|
1207
1216
|
|
|
1208
|
-
/* Derived from the count and the page size rather than read from
|
|
1209
|
-
* getPageMax(), which is stale in the filter path for the same
|
|
1210
|
-
* reason. getPageSize() throws with pagination off -> one page. */
|
|
1211
1217
|
let single_page = true;
|
|
1212
1218
|
try {
|
|
1213
|
-
|
|
1214
|
-
|
|
1219
|
+
if(paged) {
|
|
1220
|
+
/* Tabulator knows the last page from the answer's
|
|
1221
|
+
* `last_page`, and that is the only thing that says whether
|
|
1222
|
+
* there is more. Deriving it from the row count instead —
|
|
1223
|
+
* which is what the local path does — hid the paginator on
|
|
1224
|
+
* every FULL page: 50 rows of a 50-row page reads as "it all
|
|
1225
|
+
* fits" and it does not. */
|
|
1226
|
+
let max = tabulator.getPageMax();
|
|
1227
|
+
single_page = (max === false) || max <= 1;
|
|
1228
|
+
} else {
|
|
1229
|
+
/* Derived from the count and the page size rather than read
|
|
1230
|
+
* from getPageMax(), which is stale in the filter path. */
|
|
1231
|
+
let size = tabulator.getPageSize();
|
|
1232
|
+
single_page = !size || n <= size;
|
|
1233
|
+
}
|
|
1215
1234
|
} catch(e) {
|
|
1216
1235
|
single_page = true;
|
|
1217
1236
|
}
|
|
@@ -3089,6 +3108,9 @@ function ac_repull_page(gobj, event, kw, src)
|
|
|
3089
3108
|
************************************************************/
|
|
3090
3109
|
function ac_page_loaded(gobj, event, kw, src)
|
|
3091
3110
|
{
|
|
3111
|
+
if(typeof kw.total === "number") {
|
|
3112
|
+
gobj.priv._page_total = kw.total;
|
|
3113
|
+
}
|
|
3092
3114
|
settle_page(gobj, kw.req_id, {
|
|
3093
3115
|
data: is_array(kw.rows)? kw.rows : [],
|
|
3094
3116
|
last_page: kw.pages || 1,
|
|
@@ -1803,12 +1803,14 @@ function ac_mt_command_answer(gobj, event, kw, src)
|
|
|
1803
1803
|
* backend that cannot page: the whole list arrives as one
|
|
1804
1804
|
* page, which is the truth. */
|
|
1805
1805
|
let answer = nodes_answer(data);
|
|
1806
|
-
/* The correlation id
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
|
|
1811
|
-
|
|
1806
|
+
/* The correlation id rides in `__md_command__`, which is the
|
|
1807
|
+
* same place `topic_name` rides — and `kw_command` IS that
|
|
1808
|
+
* object: C_IEVENT_CLI EXTRACTS `__md_command__` from the kw
|
|
1809
|
+
* and pushes it as the command stack's `kw`. So it is read
|
|
1810
|
+
* flat, one level up from where the sent kw put it, and it
|
|
1811
|
+
* never travels to the backend as a parameter it does not
|
|
1812
|
+
* know. */
|
|
1813
|
+
let req_id = kw_get_str(gobj, kw_command, "req_id", "", 0);
|
|
1812
1814
|
if(req_id) {
|
|
1813
1815
|
gobj_send_event(
|
|
1814
1816
|
gobj_topic_form,
|