@yuneta/gobj-ui 5.17.0 → 6.1.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/README.md +103 -8
- package/dist/gobj-ui.cjs.js +5397 -489
- package/dist/gobj-ui.es.js +5397 -490
- package/index.js +1 -0
- package/package.json +3 -3
- package/src/c_yui_form.js +11 -3
- package/src/c_yui_schema_editor.css +133 -0
- package/src/c_yui_schema_editor.js +3217 -0
- package/src/c_yui_treedb_schema.js +22 -3
- package/src/c_yui_treedb_topic_with_form.js +5 -1
- package/src/schema_descs.js +164 -0
- package/src/schema_descs.test.js +145 -0
- package/src/schema_flags.js +237 -0
- package/src/schema_flags.test.js +133 -0
- package/src/schema_import.js +413 -0
- package/src/schema_import.test.js +234 -0
- package/src/schema_model.js +512 -0
- package/src/schema_model.test.js +233 -0
- package/src/schema_to_c.js +367 -0
- package/src/schema_to_c.test.js +218 -0
- package/src/schema_validate.js +289 -0
- package/src/schema_validate.test.js +265 -0
- package/src/treedb_node_label.js +15 -9
- package/src/treedb_node_label.test.js +14 -0
package/index.js
CHANGED
|
@@ -79,6 +79,7 @@ export { register_c_yui_treedb_topics } from "./src/c_yui_treedb_topics.js";
|
|
|
79
79
|
export { register_c_yui_treedb_topic_with_form } from "./src/c_yui_treedb_topic_with_form.js";
|
|
80
80
|
export { register_c_yui_treedb_graph } from "./src/c_yui_treedb_graph.js";
|
|
81
81
|
export { register_c_yui_treedb_schema } from "./src/c_yui_treedb_schema.js";
|
|
82
|
+
export { register_c_yui_schema_editor } from "./src/c_yui_schema_editor.js";
|
|
82
83
|
export { register_c_g6_nodes_tree } from "./src/c_g6_nodes_tree.js";
|
|
83
84
|
|
|
84
85
|
/*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.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.
|
|
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.
|
|
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",
|
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
|
|
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
|
-
|
|
902
|
-
|
|
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":
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* c_yui_schema_editor.css
|
|
3
|
+
*
|
|
4
|
+
* What the schema editor needs that Bulma does not give: a drag
|
|
5
|
+
* affordance on a row, the line that says where a dropped row
|
|
6
|
+
* lands, and a flag grid that stays readable at 360px.
|
|
7
|
+
*
|
|
8
|
+
* No transitions anywhere, deliberately: a row that slides into
|
|
9
|
+
* place hides the fact that a write is what moved it.
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2026, ArtGins.
|
|
12
|
+
* All Rights Reserved.
|
|
13
|
+
***********************************************************************/
|
|
14
|
+
|
|
15
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_TOOLBAR {
|
|
16
|
+
border-bottom: 1px solid var(--bulma-border, rgba(128, 128, 128, .3));
|
|
17
|
+
flex: 0 0 auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_CRUMBS {
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
text-overflow: ellipsis;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_CRUMB_SEP {
|
|
27
|
+
margin: 0 .3rem;
|
|
28
|
+
opacity: .5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* The rows are the working surface: a drag handle that looks
|
|
32
|
+
* draggable, and a cursor that says the row itself opens. */
|
|
33
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_ROW {
|
|
34
|
+
cursor: default;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_HANDLE {
|
|
38
|
+
cursor: grab;
|
|
39
|
+
width: 1.6rem;
|
|
40
|
+
text-align: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_ROW.SCHEMA_COL_DRAGGING {
|
|
44
|
+
opacity: .45;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Where the row would land. A line and not a gap: a gap reflows the
|
|
48
|
+
* table under the pointer, which moves the target while it is aimed at. */
|
|
49
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_ROW.SCHEMA_COL_DROP_BEFORE > td {
|
|
50
|
+
box-shadow: inset 0 2px 0 0 var(--bulma-link, #485fc7);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_ROW.SCHEMA_COL_DROP_AFTER > td {
|
|
54
|
+
box-shadow: inset 0 -2px 0 0 var(--bulma-link, #485fc7);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_TOPIC_ROW {
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_FLAGS .tags {
|
|
62
|
+
margin-bottom: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_FLAGS .tag {
|
|
66
|
+
margin-bottom: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* The treedb cards reuse the shell's grid, so a schema card and a nav
|
|
70
|
+
* card are the same object to the eye. */
|
|
71
|
+
.C_YUI_SCHEMA_EDITOR .yui-nav-card {
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* The flag grid: as many columns as fit, never fewer than one. */
|
|
76
|
+
.SCHEMA_FLAGS .SCHEMA_FLAG_LIST {
|
|
77
|
+
display: grid;
|
|
78
|
+
grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
|
|
79
|
+
gap: .1rem .5rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.SCHEMA_FLAGS .SCHEMA_FLAG {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
min-width: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.SCHEMA_FLAGS .SCHEMA_FLAG_NAME {
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
font-family: var(--bulma-family-code, monospace);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Meaningless on the chosen type, and still editable: a flag already
|
|
96
|
+
* set has to stay reachable or the next save drops it. */
|
|
97
|
+
.SCHEMA_FLAGS .SCHEMA_FLAG_DIM .SCHEMA_FLAG_NAME {
|
|
98
|
+
opacity: .55;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.SCHEMA_EXPORT_TEXT,
|
|
102
|
+
.SCHEMA_IMPORT_TEXT {
|
|
103
|
+
white-space: pre;
|
|
104
|
+
overflow-wrap: normal;
|
|
105
|
+
overflow-x: auto;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.SCHEMA_IMPORT_LINES {
|
|
109
|
+
list-style: none;
|
|
110
|
+
margin: 0;
|
|
111
|
+
padding: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.SCHEMA_IMPORT_LINE {
|
|
115
|
+
padding: .1rem 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* No animation anywhere in this view. */
|
|
119
|
+
.C_YUI_SCHEMA_EDITOR *,
|
|
120
|
+
.SCHEMA_COL_FORM_DIALOG *,
|
|
121
|
+
.SCHEMA_TOPIC_FORM_DIALOG *,
|
|
122
|
+
.SCHEMA_IMPORT_DIALOG *,
|
|
123
|
+
.SCHEMA_EXPORT_DIALOG *,
|
|
124
|
+
.SCHEMA_REPORT_DIALOG * {
|
|
125
|
+
transition: none !important;
|
|
126
|
+
animation: none !important;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* A write is in flight: the screen stays up and stops answering. */
|
|
130
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_BODY.SCHEMA_BUSY {
|
|
131
|
+
pointer-events: none;
|
|
132
|
+
opacity: .6;
|
|
133
|
+
}
|