@yuneta/gobj-ui 5.16.0 → 6.0.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "5.16.0",
3
+ "version": "6.0.0",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -29,13 +29,13 @@
29
29
  "devDependencies": {
30
30
  "@rollup/plugin-terser": "^1.0.0",
31
31
  "@vitest/coverage-v8": "^4.1.10",
32
- "@yuneta/gobj-js": "^7.8.7",
32
+ "@yuneta/gobj-js": "^7.13.2",
33
33
  "vite": "^8.2.1",
34
34
  "vitest": "^4.1.10"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@antv/g6": "^5.1.0",
38
- "@yuneta/gobj-js": "^7.8.7",
38
+ "@yuneta/gobj-js": "^7.13.2",
39
39
  "bulma": "^1.0.4",
40
40
  "i18next": "^26.3.6",
41
41
  "maplibre-gl": "^6.1.0",
@@ -78,6 +78,8 @@ import {
78
78
  getStrokeColor,
79
79
  } from "./lib_graph.js";
80
80
 
81
+ import {node_label} from "./treedb_node_label.js";
82
+
81
83
  import {
82
84
  BaseLayout,
83
85
  ExtensionCategory,
@@ -1227,7 +1229,8 @@ function create_topic_node(gobj, desc, record)
1227
1229
  style.dx = -58;
1228
1230
  style.dy = -20;
1229
1231
  style.innerHTML = build_chip_innerHTML(
1230
- desc.color, priv.theme, record.icon, record.id
1232
+ desc.color, priv.theme, record.icon,
1233
+ node_label(desc, record), record.id
1231
1234
  );
1232
1235
 
1233
1236
  } else if(node_treedb_type === 'extended') {
@@ -1239,8 +1242,8 @@ function create_topic_node(gobj, desc, record)
1239
1242
  style.dx = -72;
1240
1243
  style.dy = -33;
1241
1244
  style.innerHTML = build_node_innerHTML(
1242
- desc.color, priv.theme, record.icon, record.id,
1243
- desc.topic_name, true
1245
+ desc.color, priv.theme, record.icon, node_label(desc, record),
1246
+ desc.topic_name, true, record.id
1244
1247
  );
1245
1248
 
1246
1249
  } else {
@@ -1250,7 +1253,8 @@ function create_topic_node(gobj, desc, record)
1250
1253
  style.dx = -86;
1251
1254
  style.dy = -48;
1252
1255
  style.innerHTML = build_node_innerHTML(
1253
- desc.color, priv.theme, record.icon, record.id, desc.topic_name
1256
+ desc.color, priv.theme, record.icon, node_label(desc, record),
1257
+ desc.topic_name, false, record.id
1254
1258
  );
1255
1259
  }
1256
1260
 
@@ -1353,7 +1357,8 @@ function update_topic_node(gobj, desc, node_name, record)
1353
1357
  id: node_name,
1354
1358
  style: {
1355
1359
  innerHTML: build_chip_innerHTML(
1356
- desc.color, priv.theme, record.icon, record.id
1360
+ desc.color, priv.theme, record.icon,
1361
+ node_label(desc, record), record.id
1357
1362
  ),
1358
1363
  }
1359
1364
  }]);
@@ -1362,8 +1367,9 @@ function update_topic_node(gobj, desc, node_name, record)
1362
1367
  id: node_name,
1363
1368
  style: {
1364
1369
  innerHTML: build_node_innerHTML(
1365
- desc.color, priv.theme, record.icon, record.id,
1366
- desc.topic_name, true
1370
+ desc.color, priv.theme, record.icon,
1371
+ node_label(desc, record),
1372
+ desc.topic_name, true, record.id
1367
1373
  ),
1368
1374
  }
1369
1375
  }]);
@@ -1372,8 +1378,9 @@ function update_topic_node(gobj, desc, node_name, record)
1372
1378
  id: node_name,
1373
1379
  style: {
1374
1380
  innerHTML: build_node_innerHTML(
1375
- desc.color, priv.theme, record.icon, record.id,
1376
- desc.topic_name
1381
+ desc.color, priv.theme, record.icon,
1382
+ node_label(desc, record),
1383
+ desc.topic_name, false, record.id
1377
1384
  ),
1378
1385
  }
1379
1386
  }]);
@@ -4184,8 +4191,9 @@ function show_node_popover(gobj)
4184
4191
  if(node_graph_type === 'hierarchical') {
4185
4192
  let record = nodeData.data.record || {};
4186
4193
  updateStyle.innerHTML = build_node_innerHTML(
4187
- fill, priv.theme, record.icon, record.id,
4188
- nodeData.data.desc.topic_name
4194
+ fill, priv.theme, record.icon,
4195
+ node_label(nodeData.data.desc, record),
4196
+ nodeData.data.desc.topic_name, false, record.id
4189
4197
  );
4190
4198
  }
4191
4199
  graph.updateNodeData([{ id: node_id, style: updateStyle }]);
@@ -4221,8 +4229,9 @@ function show_node_popover(gobj)
4221
4229
  if(node_graph_type === 'hierarchical') {
4222
4230
  let record = nodeData.data.record || {};
4223
4231
  restoreStyle.innerHTML = build_node_innerHTML(
4224
- origFill, priv.theme, record.icon, record.id,
4225
- nodeData.data.desc.topic_name
4232
+ origFill, priv.theme, record.icon,
4233
+ node_label(nodeData.data.desc, record),
4234
+ nodeData.data.desc.topic_name, false, record.id
4226
4235
  );
4227
4236
  }
4228
4237
  graph.updateNodeData([{ id: node_id, style: restoreStyle }]);
@@ -4398,7 +4407,8 @@ function refresh_html_nodes_theme(gobj, theme)
4398
4407
  style: {
4399
4408
  innerHTML: build_node_innerHTML(
4400
4409
  nd.data.desc.color, theme, record.icon,
4401
- record.id, nd.data.desc.topic_name
4410
+ node_label(nd.data.desc, record),
4411
+ nd.data.desc.topic_name, false, record.id
4402
4412
  )
4403
4413
  }
4404
4414
  });
@@ -4408,7 +4418,7 @@ function refresh_html_nodes_theme(gobj, theme)
4408
4418
  style: {
4409
4419
  innerHTML: build_chip_innerHTML(
4410
4420
  nd.data.desc.color, theme, record.icon,
4411
- record.id
4421
+ node_label(nd.data.desc, record), record.id
4412
4422
  )
4413
4423
  }
4414
4424
  });
@@ -4418,7 +4428,8 @@ function refresh_html_nodes_theme(gobj, theme)
4418
4428
  style: {
4419
4429
  innerHTML: build_node_innerHTML(
4420
4430
  nd.data.desc.color, theme, record.icon,
4421
- record.id, nd.data.desc.topic_name, true
4431
+ node_label(nd.data.desc, record),
4432
+ nd.data.desc.topic_name, true, record.id
4422
4433
  )
4423
4434
  }
4424
4435
  });
@@ -4464,8 +4475,9 @@ function refresh_default_edges_theme(gobj, theme)
4464
4475
  * but lighter (1px border, no shadow, single line). The name is
4465
4476
  * always legible (ellipsis + native title tooltip on overflow).
4466
4477
  ************************************************************/
4467
- function build_chip_innerHTML(color, theme, icon, id)
4478
+ function build_chip_innerHTML(color, theme, icon, label, key)
4468
4479
  {
4480
+ let title = key || label;
4469
4481
  let dark = (theme === "dark");
4470
4482
  let surface = dark ? "#1b2230" : "#ffffff";
4471
4483
  let bg = dark
@@ -4485,7 +4497,7 @@ function build_chip_innerHTML(color, theme, icon, id)
4485
4497
  }
4486
4498
 
4487
4499
  return `
4488
- <div title="${escapeHtml(id)}" style="
4500
+ <div title="${escapeHtml(title)}" style="
4489
4501
  box-sizing: border-box;
4490
4502
  width: 100%;
4491
4503
  height: 100%;
@@ -4502,7 +4514,7 @@ function build_chip_innerHTML(color, theme, icon, id)
4502
4514
  ">${icon_html}<span style="
4503
4515
  font-size: 12px; font-weight: 600; line-height: 1;
4504
4516
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
4505
- ">${escapeHtml(id)}</span>
4517
+ ">${escapeHtml(label)}</span>
4506
4518
  </div>
4507
4519
  `;
4508
4520
  }
@@ -4517,8 +4529,9 @@ function build_chip_innerHTML(color, theme, icon, id)
4517
4529
  * colour is kept (per-topic differentiation) but softened via
4518
4530
  * color-mix instead of a harsh saturated fill. Theme-aware.
4519
4531
  ************************************************************/
4520
- function build_node_innerHTML(color, theme, icon, id, topic_name, structural)
4532
+ function build_node_innerHTML(color, theme, icon, label, topic_name, structural, key)
4521
4533
  {
4534
+ let title = key || label;
4522
4535
  let dark = (theme === "dark");
4523
4536
  let surface = dark ? "#1b2230" : "#ffffff";
4524
4537
  let bg, border, border_style;
@@ -4568,7 +4581,7 @@ function build_node_innerHTML(color, theme, icon, id, topic_name, structural)
4568
4581
  }
4569
4582
 
4570
4583
  return `
4571
- <div title="${escapeHtml(id)}" style="
4584
+ <div title="${escapeHtml(title)}" style="
4572
4585
  box-sizing: border-box;
4573
4586
  width: 100%;
4574
4587
  height: 100%;
@@ -4591,7 +4604,7 @@ function build_node_innerHTML(color, theme, icon, id, topic_name, structural)
4591
4604
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
4592
4605
  display: -webkit-box; -webkit-line-clamp: 2;
4593
4606
  -webkit-box-orient: vertical; word-break: break-word;
4594
- ">${escapeHtml(id)}</div>${sub_html}
4607
+ ">${escapeHtml(label)}</div>${sub_html}
4595
4608
  </div>
4596
4609
  `;
4597
4610
  }
@@ -4945,8 +4958,9 @@ function apply_node_properties(gobj, node_id, fill, stroke, lineWidth, scope)
4945
4958
  if(nd.data.desc.node_treedb_type === 'hierarchical') {
4946
4959
  let record = nd.data.record || {};
4947
4960
  updateStyle.innerHTML = build_node_innerHTML(
4948
- fill, priv.theme, record.icon, record.id,
4949
- nd.data.desc.topic_name
4961
+ fill, priv.theme, record.icon,
4962
+ node_label(nd.data.desc, record),
4963
+ nd.data.desc.topic_name, false, record.id
4950
4964
  );
4951
4965
  }
4952
4966
  updates.push({ id: nodes[i].id, style: updateStyle });
package/src/c_yui_form.js CHANGED
@@ -676,6 +676,7 @@ function build_form_field_conf(gobj, field_desc)
676
676
  break;
677
677
 
678
678
  case "rowid":
679
+ case "qualified":
679
680
  field_conf.tag = 'input';
680
681
  field_conf.inputType = 'text';
681
682
  break;
@@ -878,7 +879,8 @@ function build_fkey_ref(gobj, field_desc, value)
878
879
  /************************************************************
879
880
  * Apply the form mode to the pkey field:
880
881
  * "update" -> pkey readonly, not required
881
- * "create" -> pkey writable and required (readonly if rowid)
882
+ * "create" -> pkey writable and required, unless the store
883
+ * hands the key out itself (rowid, qualified)
882
884
  * Empty form_mode keeps the template-declared behaviour
883
885
  * (backward compatible).
884
886
  ************************************************************/
@@ -898,8 +900,11 @@ function apply_form_mode(gobj, $form)
898
900
  return;
899
901
  }
900
902
 
901
- let is_rowid = $input.field_desc && $input.field_desc.type === "rowid";
902
- if(mode === "create" && !is_rowid) {
903
+ /* A key the store composes is never typed: a rowid comes from the
904
+ * topic size, a qualified id from the parent and the name. */
905
+ let type = $input.field_desc? $input.field_desc.type: "";
906
+ let store_makes_the_key = (type === "rowid" || type === "qualified");
907
+ if(mode === "create" && !store_makes_the_key) {
903
908
  $input.removeAttribute("readonly");
904
909
  $input.setAttribute("required", "");
905
910
  } else {
@@ -1826,6 +1831,7 @@ function template2columns(gobj, columns, template, sub_elements)
1826
1831
  break;
1827
1832
 
1828
1833
  case "rowid":
1834
+ case "qualified":
1829
1835
  // field_conf.tag = 'input';
1830
1836
  // field_conf.inputType = 'text';
1831
1837
  column = null;
@@ -2448,6 +2454,7 @@ function treedb_value_2_form_value(gobj, field_desc, value)
2448
2454
  case "enum":
2449
2455
  case "uuid":
2450
2456
  case "rowid":
2457
+ case "qualified":
2451
2458
  case "password":
2452
2459
  case "email":
2453
2460
  case "url":
@@ -2572,6 +2579,7 @@ function form_value_2_treedb_value(gobj, field_desc, value)
2572
2579
  case "enum":
2573
2580
  case "uuid":
2574
2581
  case "rowid":
2582
+ case "qualified":
2575
2583
  case "password":
2576
2584
  case "email":
2577
2585
  case "url":