@yuneta/gobj-ui 7.23.51 → 7.23.52

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 CHANGED
@@ -642,16 +642,32 @@ url is what gives way, cut with an ellipsis, and the whole value stays in the
642
642
 
643
643
  ### Reading a topic a page at a time
644
644
 
645
+ > ⚠️ **`with_remote_paging` is OFF in every consumer, and must stay off until
646
+ > linking works with a partial topic.** A record's link picker is built from
647
+ > the rows the PARENT topic's table holds — `build_fkey_options()` asks it
648
+ > with `get_topic_data`, which answers `tabulator.getData()` — and with paging
649
+ > that is one page. So the picker offers 200 of the 5891 possible parents (the
650
+ > right one is usually not among them), and a record whose parent is not on
651
+ > the loaded page opens with an fkey the form cannot match, which saving then
652
+ > drops. A treedb is a **memory database** — the backend holds the topic in
653
+ > RAM either way — so paging buys little and costs the links. The machinery
654
+ > below stays, working and tested, for the day linking learns to ask the
655
+ > BACKEND for a parent instead of the sibling table.
656
+ >
657
+ > **Local pagination is not affected and stays on.** `getData()` answers the
658
+ > WHOLE dataset whatever page is on screen, so paginating the DISPLAY is safe;
659
+ > only paginating the FETCH is not. `page_size` sets the display page for both
660
+ > paths.
661
+
645
662
  `C_YUI_TREEDB_TOPICS` takes **`with_remote_paging`** (off by default) and
646
663
  forwards it to every topic table: the table pulls the page it is showing
647
664
  instead of the host pushing the whole topic down. It needs the SDK's `nodes`
648
665
  with `from` / `limit` (see `YUNO_TREEDB.md` §5.3).
649
666
 
650
- **The page size is generous on purpose** (`page_size`, 200). A treedb that
651
- fits in one page behaves exactly as it did — paginator hidden, every filter
652
- seeing every row — so nothing that exists today changes. Only a topic that
653
- does NOT fit pays for paging, and for that one loading it whole was never an
654
- option.
667
+ **The page size is generous on purpose** (`page_size`, 200 when paging). A
668
+ treedb that fits in one page behaves exactly as it did — paginator hidden,
669
+ every filter seeing every row. Only a topic that does NOT fit pays for paging,
670
+ and for that one loading it whole was never an option.
655
671
 
656
672
  **Safe against a backend that cannot page:** it answers the whole list, which
657
673
  `nodes_answer()` reads as one page. That is the truth, and it is why the table
@@ -20534,7 +20534,8 @@ var attrs_table$6 = [
20534
20534
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "gobj_remote_yuno", 0, null, "Remote yuno for data fetching"),
20535
20535
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "treedb_name", 0, null, "Remote TreeDB service name"),
20536
20536
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "descs", 0, null, "Description of topics"),
20537
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Each topic table pulls its rows a PAGE at a time (`nodes` from/limit) instead of loading the topic whole. Safe against a backend that cannot page: it answers the whole list, which the table reads as one page"),
20537
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Each topic table pulls its rows a PAGE at a time (`nodes` from/limit) instead of loading the topic whole. ⚠️ DO NOT TURN THIS ON: a partial topic BREAKS LINKING -- the link picker of a record is built from the rows the PARENT topic's table holds, which with paging is one page, so the right parent is usually not offered and an existing link the form cannot match is dropped on save. Off in every consumer until linking asks the backend instead of the sibling table"),
20538
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "page_size", 0, 0, "Rows per page of each topic table (the DISPLAY; the fetch is whole). 0 leaves the table's own default"),
20538
20539
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_selection_bar", 0, false, "Each topic table shows the shared selection bar (\"N selected\" + a way out) above it while in edition mode. OFF by default: the bar takes its words from the HOST's i18n, so a host that turns it on must define \"{{n}} selected\" and \"clear selection\""),
20539
20540
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "system", 0, false, "Manage system topics (true) or user topics (false)"),
20540
20541
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "tabs_style", 0, "is-toggle is-fullwidth", "Bulma tab styling"),
@@ -21351,6 +21352,7 @@ function process_treedb_descs$1(gobj) {
21351
21352
  topic_name: key,
21352
21353
  desc,
21353
21354
  with_remote_paging: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_remote_paging"),
21355
+ page_size: (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "page_size"),
21354
21356
  with_selection_bar: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_selection_bar")
21355
21357
  };
21356
21358
  let id = `${(0, _yuneta_gobj_js.gobj_name)(gobj)}?${desc.topic_name}`;
@@ -22912,8 +22914,8 @@ var attrs_table$5 = [
22912
22914
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_export_button", 0, true, "Button toolbar EXPORT (download as CSV what the table holds)"),
22913
22915
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_header_filters", 0, true, "Per-column filter box in the table header, on the columns a text/number match means something (not hooks, fkeys or json)"),
22914
22916
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_inline_edit", 0, true, "Edit a writable scalar cell in place while in edition mode (the record form keeps the rest)"),
22915
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Pull the topic a PAGE at a time from the backend (`nodes` from/limit) instead of loading it whole. Needs a backend that pages"),
22916
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "page_size", 0, 200, "Rows per page when with_remote_paging. Generous on purpose: a treedb that fits in one page behaves exactly as it did, paginator hidden and every filter seeing every row"),
22917
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Pull the topic a PAGE at a time from the backend (`nodes` from/limit) instead of loading it whole. Needs a backend that pages. ⚠️ DO NOT TURN THIS ON: it breaks LINKS -- see the note above the tabulator settings. It is off in every consumer until linking works with a partial topic"),
22918
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "page_size", 0, 0, "Rows per page. 0 leaves the `tabulator_settings` value alone. With with_remote_paging it is also the size of each fetch (200 when unset)"),
22917
22919
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_in_row_edit_icons", 0, true, "Add a last column with internal EDIT/DELETE icon"),
22918
22920
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "editable", 0, false, "Edit state"),
22919
22921
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_checkbox", 0, true, "Auxiliary first column to select rows"),
@@ -23834,6 +23836,19 @@ function create_tabulator(gobj) {
23834
23836
  }
23835
23837
  });
23836
23838
  }
23839
+ if (!(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_remote_paging")) {
23840
+ let page_size = (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "page_size");
23841
+ if (page_size > 0 && tabulator_settings.pagination) {
23842
+ tabulator_settings.paginationSize = page_size;
23843
+ tabulator_settings.paginationSizeSelector = [
23844
+ 50,
23845
+ 100,
23846
+ 200,
23847
+ 500,
23848
+ true
23849
+ ];
23850
+ }
23851
+ }
23837
23852
  let remembered_size = load_page_size(gobj);
23838
23853
  if (remembered_size !== null && tabulator_settings.pagination) tabulator_settings.paginationSize = remembered_size;
23839
23854
  gobj.priv._page_size = tabulator_settings.paginationSize;
@@ -20529,7 +20529,8 @@ var attrs_table$6 = [
20529
20529
  SDATA(data_type_t.DTP_POINTER, "gobj_remote_yuno", 0, null, "Remote yuno for data fetching"),
20530
20530
  SDATA(data_type_t.DTP_STRING, "treedb_name", 0, null, "Remote TreeDB service name"),
20531
20531
  SDATA(data_type_t.DTP_JSON, "descs", 0, null, "Description of topics"),
20532
- SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Each topic table pulls its rows a PAGE at a time (`nodes` from/limit) instead of loading the topic whole. Safe against a backend that cannot page: it answers the whole list, which the table reads as one page"),
20532
+ SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Each topic table pulls its rows a PAGE at a time (`nodes` from/limit) instead of loading the topic whole. ⚠️ DO NOT TURN THIS ON: a partial topic BREAKS LINKING -- the link picker of a record is built from the rows the PARENT topic's table holds, which with paging is one page, so the right parent is usually not offered and an existing link the form cannot match is dropped on save. Off in every consumer until linking asks the backend instead of the sibling table"),
20533
+ SDATA(data_type_t.DTP_INTEGER, "page_size", 0, 0, "Rows per page of each topic table (the DISPLAY; the fetch is whole). 0 leaves the table's own default"),
20533
20534
  SDATA(data_type_t.DTP_BOOLEAN, "with_selection_bar", 0, false, "Each topic table shows the shared selection bar (\"N selected\" + a way out) above it while in edition mode. OFF by default: the bar takes its words from the HOST's i18n, so a host that turns it on must define \"{{n}} selected\" and \"clear selection\""),
20534
20535
  SDATA(data_type_t.DTP_BOOLEAN, "system", 0, false, "Manage system topics (true) or user topics (false)"),
20535
20536
  SDATA(data_type_t.DTP_STRING, "tabs_style", 0, "is-toggle is-fullwidth", "Bulma tab styling"),
@@ -21346,6 +21347,7 @@ function process_treedb_descs$1(gobj) {
21346
21347
  topic_name: key,
21347
21348
  desc,
21348
21349
  with_remote_paging: gobj_read_bool_attr(gobj, "with_remote_paging"),
21350
+ page_size: gobj_read_integer_attr(gobj, "page_size"),
21349
21351
  with_selection_bar: gobj_read_bool_attr(gobj, "with_selection_bar")
21350
21352
  };
21351
21353
  let id = `${gobj_name(gobj)}?${desc.topic_name}`;
@@ -22907,8 +22909,8 @@ var attrs_table$5 = [
22907
22909
  SDATA(data_type_t.DTP_BOOLEAN, "with_export_button", 0, true, "Button toolbar EXPORT (download as CSV what the table holds)"),
22908
22910
  SDATA(data_type_t.DTP_BOOLEAN, "with_header_filters", 0, true, "Per-column filter box in the table header, on the columns a text/number match means something (not hooks, fkeys or json)"),
22909
22911
  SDATA(data_type_t.DTP_BOOLEAN, "with_inline_edit", 0, true, "Edit a writable scalar cell in place while in edition mode (the record form keeps the rest)"),
22910
- SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Pull the topic a PAGE at a time from the backend (`nodes` from/limit) instead of loading it whole. Needs a backend that pages"),
22911
- SDATA(data_type_t.DTP_INTEGER, "page_size", 0, 200, "Rows per page when with_remote_paging. Generous on purpose: a treedb that fits in one page behaves exactly as it did, paginator hidden and every filter seeing every row"),
22912
+ SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Pull the topic a PAGE at a time from the backend (`nodes` from/limit) instead of loading it whole. Needs a backend that pages. ⚠️ DO NOT TURN THIS ON: it breaks LINKS -- see the note above the tabulator settings. It is off in every consumer until linking works with a partial topic"),
22913
+ SDATA(data_type_t.DTP_INTEGER, "page_size", 0, 0, "Rows per page. 0 leaves the `tabulator_settings` value alone. With with_remote_paging it is also the size of each fetch (200 when unset)"),
22912
22914
  SDATA(data_type_t.DTP_BOOLEAN, "with_in_row_edit_icons", 0, true, "Add a last column with internal EDIT/DELETE icon"),
22913
22915
  SDATA(data_type_t.DTP_BOOLEAN, "editable", 0, false, "Edit state"),
22914
22916
  SDATA(data_type_t.DTP_BOOLEAN, "with_checkbox", 0, true, "Auxiliary first column to select rows"),
@@ -23829,6 +23831,19 @@ function create_tabulator(gobj) {
23829
23831
  }
23830
23832
  });
23831
23833
  }
23834
+ if (!gobj_read_bool_attr(gobj, "with_remote_paging")) {
23835
+ let page_size = gobj_read_integer_attr(gobj, "page_size");
23836
+ if (page_size > 0 && tabulator_settings.pagination) {
23837
+ tabulator_settings.paginationSize = page_size;
23838
+ tabulator_settings.paginationSizeSelector = [
23839
+ 50,
23840
+ 100,
23841
+ 200,
23842
+ 500,
23843
+ true
23844
+ ];
23845
+ }
23846
+ }
23832
23847
  let remembered_size = load_page_size(gobj);
23833
23848
  if (remembered_size !== null && tabulator_settings.pagination) tabulator_settings.paginationSize = remembered_size;
23834
23849
  gobj.priv._page_size = tabulator_settings.paginationSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.51",
3
+ "version": "7.23.52",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -188,8 +188,8 @@ SDATA(data_type_t.DTP_BOOLEAN, "with_columns_button", 0, true, "Button
188
188
  SDATA(data_type_t.DTP_BOOLEAN, "with_export_button", 0, true, "Button toolbar EXPORT (download as CSV what the table holds)"),
189
189
  SDATA(data_type_t.DTP_BOOLEAN, "with_header_filters", 0, true, "Per-column filter box in the table header, on the columns a text/number match means something (not hooks, fkeys or json)"),
190
190
  SDATA(data_type_t.DTP_BOOLEAN, "with_inline_edit", 0, true, "Edit a writable scalar cell in place while in edition mode (the record form keeps the rest)"),
191
- SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Pull the topic a PAGE at a time from the backend (`nodes` from/limit) instead of loading it whole. Needs a backend that pages"),
192
- SDATA(data_type_t.DTP_INTEGER, "page_size", 0, 200, "Rows per page when with_remote_paging. Generous on purpose: a treedb that fits in one page behaves exactly as it did, paginator hidden and every filter seeing every row"),
191
+ SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Pull the topic a PAGE at a time from the backend (`nodes` from/limit) instead of loading it whole. Needs a backend that pages. ⚠️ DO NOT TURN THIS ON: it breaks LINKS -- see the note above the tabulator settings. It is off in every consumer until linking works with a partial topic"),
192
+ SDATA(data_type_t.DTP_INTEGER, "page_size", 0, 0, "Rows per page. 0 leaves the `tabulator_settings` value alone. With with_remote_paging it is also the size of each fetch (200 when unset)"),
193
193
  SDATA(data_type_t.DTP_BOOLEAN, "with_in_row_edit_icons", 0, true, "Add a last column with internal EDIT/DELETE icon"),
194
194
 
195
195
  SDATA(data_type_t.DTP_BOOLEAN, "editable", 0, false, "Edit state"),
@@ -1393,16 +1393,29 @@ function create_tabulator(gobj)
1393
1393
  let tabulator_settings = json_deep_copy(gobj_read_attr(gobj, "tabulator_settings"));
1394
1394
 
1395
1395
  /* Remote paging: the TABLE pulls, instead of the host pushing the whole
1396
- * topic down. The page size is generous on purpose — a treedb that fits
1397
- * in one page behaves exactly as it did before, with the paginator
1398
- * hidden and every filter seeing every row. Only a topic that does NOT
1399
- * fit pays for paging, and for that one loading it whole was never an
1400
- * option anyway.
1396
+ * topic down. Only a topic that does NOT fit pays for it, and for that
1397
+ * one loading it whole was never an option anyway.
1401
1398
  *
1402
1399
  * `filterMode: "local"` says the plain truth: the header filters and the
1403
1400
  * search box work on the page that is loaded. Same as the tranger
1404
1401
  * browser's Rows card, and for the same reason — the alternative is
1405
1402
  * pushing every filter to the backend and changing what "search" means.
1403
+ *
1404
+ * ⚠️ AND IT IS OFF IN EVERY CONSUMER, because it BREAKS LINKING.
1405
+ * `build_fkey_options()` asks the PARENT topic's table for the rows it
1406
+ * holds (`get_topic_data` -> `tabulator.getData()`), and with paging
1407
+ * that is one page. So the link picker offers 200 of the 5891 possible
1408
+ * parents -- the right one is usually not among them -- and a record
1409
+ * whose parent is not on the loaded page opens with an fkey the form
1410
+ * cannot match, which saving then drops. Local pagination has none of
1411
+ * this: `getData()` answers the WHOLE dataset whatever page is on
1412
+ * screen, so paginating the DISPLAY is safe and only paginating the
1413
+ * FETCH is not.
1414
+ *
1415
+ * A treedb is a memory database -- the backend holds the topic in RAM
1416
+ * either way -- so paging buys little and costs the links. It stays
1417
+ * here, working and tested, for the day linking learns to ask the
1418
+ * BACKEND for a parent instead of the sibling table.
1406
1419
  */
1407
1420
  if(gobj_read_bool_attr(gobj, "with_remote_paging")) {
1408
1421
  let page_size = gobj_read_integer_attr(gobj, "page_size") || 200;
@@ -1428,6 +1441,20 @@ function create_tabulator(gobj)
1428
1441
  });
1429
1442
  }
1430
1443
 
1444
+ /* Rows per page for the LOCAL paginator too, when the host asks for
1445
+ * one: with the fetch no longer paged, `page_size` is the only thing
1446
+ * left that says how many rows a reader wants in front of them, and a
1447
+ * host that had 200 should not drop to 25 for having stopped paging the
1448
+ * fetch. The sizes offered go up with it -- a selector that cannot name
1449
+ * the size in use is a selector Tabulator has to patch itself. */
1450
+ if(!gobj_read_bool_attr(gobj, "with_remote_paging")) {
1451
+ let page_size = gobj_read_integer_attr(gobj, "page_size");
1452
+ if(page_size > 0 && tabulator_settings.pagination) {
1453
+ tabulator_settings.paginationSize = page_size;
1454
+ tabulator_settings.paginationSizeSelector = [50, 100, 200, 500, true];
1455
+ }
1456
+ }
1457
+
1431
1458
  /* The size the reader picked last time, which outranks both defaults
1432
1459
  * above. Applied here, once the two paths have set theirs, so it is
1433
1460
  * written in ONE place -- and applied to `paginationSize` only: the
@@ -32,6 +32,7 @@ import {
32
32
  gobj_short_name,
33
33
  gobj_read_str_attr,
34
34
  gobj_read_bool_attr,
35
+ gobj_read_integer_attr,
35
36
  gobj_start,
36
37
  gobj_stop,
37
38
  gobj_is_running,
@@ -75,7 +76,8 @@ SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of o
75
76
  SDATA(data_type_t.DTP_POINTER, "gobj_remote_yuno", 0, null, "Remote yuno for data fetching"),
76
77
  SDATA(data_type_t.DTP_STRING, "treedb_name", 0, null, "Remote TreeDB service name"),
77
78
  SDATA(data_type_t.DTP_JSON, "descs", 0, null, "Description of topics"),
78
- SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Each topic table pulls its rows a PAGE at a time (`nodes` from/limit) instead of loading the topic whole. Safe against a backend that cannot page: it answers the whole list, which the table reads as one page"),
79
+ SDATA(data_type_t.DTP_BOOLEAN, "with_remote_paging", 0, false, "Each topic table pulls its rows a PAGE at a time (`nodes` from/limit) instead of loading the topic whole. ⚠️ DO NOT TURN THIS ON: a partial topic BREAKS LINKING -- the link picker of a record is built from the rows the PARENT topic's table holds, which with paging is one page, so the right parent is usually not offered and an existing link the form cannot match is dropped on save. Off in every consumer until linking asks the backend instead of the sibling table"),
80
+ SDATA(data_type_t.DTP_INTEGER, "page_size", 0, 0, "Rows per page of each topic table (the DISPLAY; the fetch is whole). 0 leaves the table's own default"),
79
81
  SDATA(data_type_t.DTP_BOOLEAN, "with_selection_bar", 0, false, "Each topic table shows the shared selection bar (\"N selected\" + a way out) above it while in edition mode. OFF by default: the bar takes its words from the HOST's i18n, so a host that turns it on must define \"{{n}} selected\" and \"clear selection\""),
80
82
  SDATA(data_type_t.DTP_BOOLEAN, "system", 0, false, "Manage system topics (true) or user topics (false)"),
81
83
  SDATA(data_type_t.DTP_STRING, "tabs_style", 0, "is-toggle is-fullwidth", "Bulma tab styling"),
@@ -1041,6 +1043,7 @@ function process_treedb_descs(gobj)
1041
1043
  topic_name: key,
1042
1044
  desc: desc,
1043
1045
  with_remote_paging: gobj_read_bool_attr(gobj, "with_remote_paging"),
1046
+ page_size: gobj_read_integer_attr(gobj, "page_size"),
1044
1047
  with_selection_bar: gobj_read_bool_attr(gobj, "with_selection_bar")
1045
1048
  };
1046
1049