@yuneta/gobj-ui 7.26.8 → 7.26.10
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 +86 -0
- package/dist/gobj-ui.cjs.js +217 -82
- package/dist/gobj-ui.es.js +218 -83
- package/package.json +7 -3
- package/src/c_g6_nodes_tree.js +37 -7
- package/src/c_yui_form.js +47 -13
- package/src/c_yui_gclass.js +1 -1
- package/src/c_yui_gobj_tree_js.js +6 -2
- package/src/c_yui_nav.js +2 -2
- package/src/c_yui_schema_editor.js +22 -22
- package/src/c_yui_shell.js +57 -3
- package/src/c_yui_treedb_topic_with_form.js +4 -4
- package/src/c_yui_treedb_topics.js +9 -9
- package/src/c_yui_window.js +13 -11
- package/src/c_yui_window_manager.js +58 -6
- package/src/form_toolbar_plan.js +5 -5
- package/src/map_stop_windows.wiring.test.js +112 -0
- package/src/overlay_marker_after_back.wiring.test.js +212 -0
- package/src/shell_modals.js +2 -2
- package/src/vite_plugin_yuneta_html.test.js +17 -2
- package/src/window_show.wiring.test.js +50 -3
- package/src/yui_asset.js +3 -2
- package/src/yui_data_color.js +33 -0
- package/src/yui_data_color.test.js +27 -0
- package/src/yui_dev.js +2 -2
- package/src/yui_text.js +12 -0
- package/src/yui_text.test.js +29 -1
- package/vite-plugin-yuneta-html.js +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -24,19 +24,23 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "vite build",
|
|
26
26
|
"test": "vitest run",
|
|
27
|
+
"check-markup": "node scripts/check-markup-strings.mjs",
|
|
28
|
+
"prebuild": "npm run check-markup",
|
|
29
|
+
"pretest": "npm run check-markup",
|
|
27
30
|
"deploy-round": "node scripts/deploy-round.mjs",
|
|
28
31
|
"prepublishOnly": "npm run build"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@rollup/plugin-terser": "^1.0.0",
|
|
32
35
|
"@vitest/coverage-v8": "^4.1.10",
|
|
33
|
-
"@yuneta/gobj-js": "^7.
|
|
36
|
+
"@yuneta/gobj-js": "^7.26.3",
|
|
37
|
+
"acorn": "^8.19.0",
|
|
34
38
|
"vite": "^8.3.3",
|
|
35
39
|
"vitest": "^4.1.10"
|
|
36
40
|
},
|
|
37
41
|
"peerDependencies": {
|
|
38
42
|
"@antv/g6": "^5.1.0",
|
|
39
|
-
"@yuneta/gobj-js": "^7.
|
|
43
|
+
"@yuneta/gobj-js": "^7.26.3",
|
|
40
44
|
"bulma": "^1.0.4",
|
|
41
45
|
"i18next": "^26.3.6",
|
|
42
46
|
"maplibre-gl": "^6.11.2",
|
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -177,6 +177,7 @@ import {yui_theme_now, yui_watch_theme} from "./yui_theme.js";
|
|
|
177
177
|
import {yui_shell_of} from "./c_yui_shell.js";
|
|
178
178
|
import {yui_shell_show_error} from "./shell_modals.js";
|
|
179
179
|
import {g6_event_kw} from "./g6_event_kw.js";
|
|
180
|
+
import {css_color_or_null} from "./yui_data_color.js";
|
|
180
181
|
|
|
181
182
|
/***************************************************************
|
|
182
183
|
* YuiToolbar — G6 Toolbar subclass that adds per-item className
|
|
@@ -2295,6 +2296,23 @@ function topic_defaults_of(gobj, topic_name)
|
|
|
2295
2296
|
topic_props.defaults : null;
|
|
2296
2297
|
}
|
|
2297
2298
|
|
|
2299
|
+
/************************************************************
|
|
2300
|
+
* A colour read from DATA (a `__graphs__` record), or null.
|
|
2301
|
+
* It is written into a card's html (see yui_data_color.js): a
|
|
2302
|
+
* refused value logs, and the node wears the topic's colour.
|
|
2303
|
+
************************************************************/
|
|
2304
|
+
function data_color(gobj, value)
|
|
2305
|
+
{
|
|
2306
|
+
if(value === undefined || value === null || value === "") {
|
|
2307
|
+
return null;
|
|
2308
|
+
}
|
|
2309
|
+
let color = css_color_or_null(value);
|
|
2310
|
+
if(!color) {
|
|
2311
|
+
log_warning(`${gobj_short_name(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
|
|
2312
|
+
}
|
|
2313
|
+
return color;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2298
2316
|
/************************************************************
|
|
2299
2317
|
* What a node is PAINTED with: its own colours, then the
|
|
2300
2318
|
* topic's default, then the topic's colour.
|
|
@@ -2312,8 +2330,10 @@ function node_paint_of(gobj, desc, geometry)
|
|
|
2312
2330
|
{
|
|
2313
2331
|
let defaults = topic_defaults_of(gobj, desc.topic_name);
|
|
2314
2332
|
let g = is_object(geometry)? geometry : {};
|
|
2315
|
-
let fill =
|
|
2316
|
-
|
|
2333
|
+
let fill = data_color(gobj, g.fill) ||
|
|
2334
|
+
data_color(gobj, defaults && defaults.fill) || desc.color;
|
|
2335
|
+
let stroke = data_color(gobj, g.stroke) ||
|
|
2336
|
+
data_color(gobj, defaults && defaults.stroke) || getStrokeColor(fill);
|
|
2317
2337
|
let line_width = g.lineWidth || (defaults && defaults.lineWidth) || 1;
|
|
2318
2338
|
return {fill: fill, stroke: stroke, lineWidth: line_width};
|
|
2319
2339
|
}
|
|
@@ -5275,7 +5295,9 @@ function select_node(gobj, node_id)
|
|
|
5275
5295
|
history_pause(gobj);
|
|
5276
5296
|
try {
|
|
5277
5297
|
graph.setElementState(node_id, ['selected']);
|
|
5278
|
-
} catch(e) {
|
|
5298
|
+
} catch(e) {
|
|
5299
|
+
log_warning(`${gobj_short_name(gobj)}: node state not set: ${e}`);
|
|
5300
|
+
}
|
|
5279
5301
|
priv._selected_node_id = node_id;
|
|
5280
5302
|
paint_selection(gobj, [node_id]);
|
|
5281
5303
|
|
|
@@ -5319,7 +5341,9 @@ function deselect_node(gobj)
|
|
|
5319
5341
|
states[id] = [];
|
|
5320
5342
|
}
|
|
5321
5343
|
graph.setElementState(states);
|
|
5322
|
-
} catch(e) {
|
|
5344
|
+
} catch(e) {
|
|
5345
|
+
log_warning(`${gobj_short_name(gobj)}: node states not cleared: ${e}`);
|
|
5346
|
+
}
|
|
5323
5347
|
priv._selected_node_id = null;
|
|
5324
5348
|
paint_selection(gobj, []);
|
|
5325
5349
|
|
|
@@ -6834,7 +6858,9 @@ function select_edge(gobj, edge_id)
|
|
|
6834
6858
|
history_pause(gobj);
|
|
6835
6859
|
try {
|
|
6836
6860
|
graph.setElementState(edge_id, ['selected']);
|
|
6837
|
-
} catch(e) {
|
|
6861
|
+
} catch(e) {
|
|
6862
|
+
log_warning(`${gobj_short_name(gobj)}: edge state not set: ${e}`);
|
|
6863
|
+
}
|
|
6838
6864
|
|
|
6839
6865
|
show_edge_icon(gobj);
|
|
6840
6866
|
|
|
@@ -6856,7 +6882,9 @@ function deselect_edge(gobj)
|
|
|
6856
6882
|
history_pause(gobj);
|
|
6857
6883
|
try {
|
|
6858
6884
|
graph.setElementState(priv._selected_edge_id, []);
|
|
6859
|
-
} catch(e) {
|
|
6885
|
+
} catch(e) {
|
|
6886
|
+
log_warning(`${gobj_short_name(gobj)}: edge state not cleared: ${e}`);
|
|
6887
|
+
}
|
|
6860
6888
|
priv._selected_edge_id = null;
|
|
6861
6889
|
|
|
6862
6890
|
graph_draw(gobj).then(() => {
|
|
@@ -6995,7 +7023,9 @@ function show_edge_popover(gobj)
|
|
|
6995
7023
|
history_pause(gobj);
|
|
6996
7024
|
try {
|
|
6997
7025
|
graph.setElementState(edge_id, []);
|
|
6998
|
-
} catch(e) {
|
|
7026
|
+
} catch(e) {
|
|
7027
|
+
log_warning(`${gobj_short_name(gobj)}: edge state not cleared for the style preview: ${e}`);
|
|
7028
|
+
}
|
|
6999
7029
|
graph_draw(gobj).then(() => {
|
|
7000
7030
|
history_resume(gobj);
|
|
7001
7031
|
});
|
package/src/c_yui_form.js
CHANGED
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
treedb_decoder_fkey,
|
|
49
49
|
gclass_find_by_name,
|
|
50
50
|
gobj_is_destroying,
|
|
51
|
+
html_markup,
|
|
51
52
|
} from "@yuneta/gobj-js";
|
|
52
53
|
|
|
53
54
|
import {t} from "i18next";
|
|
@@ -91,7 +92,7 @@ import "./tabulator.css";
|
|
|
91
92
|
import {is_time_field} from "./json_view_helpers.js";
|
|
92
93
|
import {date_to_datetime_local, datetime_local_to_epoch} from "./form_time_value.js";
|
|
93
94
|
import {parse_json_field, json_editor_value} from "./form_json_field.js";
|
|
94
|
-
import {text_node} from "./yui_text.js";
|
|
95
|
+
import {text_node, text_title_formatter} from "./yui_text.js";
|
|
95
96
|
import { TabulatorFull as Tabulator } from "tabulator-tables"; // Import Full Tabulator JS
|
|
96
97
|
// import { Tabulator } from "tabulator-tables"; // Import light Tabulator JS
|
|
97
98
|
|
|
@@ -384,7 +385,7 @@ function toolbar_button(gobj, name)
|
|
|
384
385
|
switch(name) {
|
|
385
386
|
case "save":
|
|
386
387
|
return ['button', {class: 'button p-1 button-save', title: t('save'), 'data-i18n-title': 'save', 'aria-label': t('save'), 'data-i18n-aria-label': 'save', disabled: true}, [
|
|
387
|
-
['span', {class: 'icon m-0'}, '<i class="yi-floppy-disk"></i>'],
|
|
388
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-floppy-disk"></i>')],
|
|
388
389
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'save'}, 'save']
|
|
389
390
|
], {
|
|
390
391
|
click: function(evt) {
|
|
@@ -394,7 +395,7 @@ function toolbar_button(gobj, name)
|
|
|
394
395
|
}];
|
|
395
396
|
case "undo":
|
|
396
397
|
return ['button', {class: 'button p-1 button-undo', title: t('undo'), 'data-i18n-title': 'undo', 'aria-label': t('undo'), 'data-i18n-aria-label': 'undo', disabled: true}, [
|
|
397
|
-
['span', {class: 'icon m-0'}, '<i class="yi-arrow-rotate-left"></i>'],
|
|
398
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-arrow-rotate-left"></i>')],
|
|
398
399
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'undo'}, 'undo']
|
|
399
400
|
], {
|
|
400
401
|
click: function(evt) {
|
|
@@ -404,7 +405,7 @@ function toolbar_button(gobj, name)
|
|
|
404
405
|
}];
|
|
405
406
|
case "clear":
|
|
406
407
|
return ['button', {class: 'button p-1 button-clear', title: t('clear'), 'data-i18n-title': 'clear', 'aria-label': t('clear'), 'data-i18n-aria-label': 'clear'}, [
|
|
407
|
-
['span', {class: 'icon m-0'}, '<i class="yi-broom-wide"></i>'],
|
|
408
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-broom-wide"></i>')],
|
|
408
409
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'clear'}, 'clear']
|
|
409
410
|
], {
|
|
410
411
|
click: function(evt) {
|
|
@@ -414,7 +415,7 @@ function toolbar_button(gobj, name)
|
|
|
414
415
|
}];
|
|
415
416
|
case "copy":
|
|
416
417
|
return ['button', {class: 'button p-1 button-copy', title: t('copy'), 'data-i18n-title': 'copy', 'aria-label': t('copy'), 'data-i18n-aria-label': 'copy'}, [
|
|
417
|
-
['span', {class: 'icon m-0'}, '<i class="yi-copy"></i>'],
|
|
418
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-copy"></i>')],
|
|
418
419
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'copy'}, 'copy']
|
|
419
420
|
], {click: function(evt) {
|
|
420
421
|
evt.stopPropagation();
|
|
@@ -423,7 +424,7 @@ function toolbar_button(gobj, name)
|
|
|
423
424
|
}];
|
|
424
425
|
case "paste":
|
|
425
426
|
return ['button', {class: 'button p-1 button-paste', title: t('paste'), 'data-i18n-title': 'paste', 'aria-label': t('paste'), 'data-i18n-aria-label': 'paste'}, [
|
|
426
|
-
['span', {class: 'icon m-0'}, '<i class="yi-paste"></i>'],
|
|
427
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-paste"></i>')],
|
|
427
428
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'paste'}, 'paste']
|
|
428
429
|
], {click: async function(evt) {
|
|
429
430
|
evt.stopPropagation();
|
|
@@ -521,6 +522,9 @@ function destroy_ui(gobj)
|
|
|
521
522
|
let $container = gobj_read_attr(gobj, "$container");
|
|
522
523
|
if($container) {
|
|
523
524
|
destroy_widgets(gobj, $container);
|
|
525
|
+
if(gobj.priv && gobj.priv.tables) {
|
|
526
|
+
gobj.priv.tables.clear();
|
|
527
|
+
}
|
|
524
528
|
if($container.parentNode) {
|
|
525
529
|
$container.parentNode.removeChild($container);
|
|
526
530
|
}
|
|
@@ -568,6 +572,13 @@ function table_identity(gobj, $table)
|
|
|
568
572
|
{
|
|
569
573
|
if(!$table.yui_table_id) {
|
|
570
574
|
let priv = gobj.priv;
|
|
575
|
+
/* The entries of tables the collector already took go first: a
|
|
576
|
+
* nested table rebuilt by its row formatter leaves one behind. */
|
|
577
|
+
for(let [id, ref] of priv.tables) {
|
|
578
|
+
if(!ref.deref()) {
|
|
579
|
+
priv.tables.delete(id);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
571
582
|
priv.table_seq += 1;
|
|
572
583
|
$table.yui_table_id = `t${priv.table_seq}`;
|
|
573
584
|
priv.tables.set($table.yui_table_id, new WeakRef($table));
|
|
@@ -616,11 +627,17 @@ function destroy_widgets(gobj, $container)
|
|
|
616
627
|
log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
|
|
617
628
|
}
|
|
618
629
|
};
|
|
630
|
+
let forget = ($el) => {
|
|
631
|
+
if($el.yui_table_id && gobj.priv && gobj.priv.tables) {
|
|
632
|
+
gobj.priv.tables.delete($el.yui_table_id);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
619
635
|
$container.querySelectorAll('.yui-tabulator-table-nested').forEach(($el) => {
|
|
620
636
|
if($el.tabulator) {
|
|
621
637
|
destroy("nested table", $el.tabulator);
|
|
622
638
|
$el.tabulator = null;
|
|
623
639
|
}
|
|
640
|
+
forget($el);
|
|
624
641
|
});
|
|
625
642
|
$container.querySelectorAll('.yui-form-data-input').forEach(($el) => {
|
|
626
643
|
if($el.tom_select) {
|
|
@@ -635,6 +652,7 @@ function destroy_widgets(gobj, $container)
|
|
|
635
652
|
destroy("table", $el.tabulator);
|
|
636
653
|
$el.tabulator = null;
|
|
637
654
|
}
|
|
655
|
+
forget($el);
|
|
638
656
|
});
|
|
639
657
|
}
|
|
640
658
|
|
|
@@ -690,6 +708,18 @@ function name_form_control($field, conf)
|
|
|
690
708
|
if($clear) {
|
|
691
709
|
const CLEAR_KEY = "remove all selected options";
|
|
692
710
|
$clear.setAttribute("role", "button");
|
|
711
|
+
/* A button a keyboard can reach and press: a key press clicks
|
|
712
|
+
* it, so it reaches Tom Select's own click handler. */
|
|
713
|
+
$clear.setAttribute("tabindex", "0");
|
|
714
|
+
if(!$clear.yui_keys_wired) {
|
|
715
|
+
$clear.yui_keys_wired = true;
|
|
716
|
+
$clear.addEventListener("keydown", function(evt) {
|
|
717
|
+
if(evt.key === "Enter" || evt.key === " ") {
|
|
718
|
+
evt.preventDefault();
|
|
719
|
+
$clear.click();
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
693
723
|
$clear.setAttribute("title", t(CLEAR_KEY));
|
|
694
724
|
$clear.setAttribute("data-i18n-title", CLEAR_KEY);
|
|
695
725
|
$clear.setAttribute("aria-label", t(CLEAR_KEY));
|
|
@@ -1350,7 +1380,7 @@ function create_form_field(
|
|
|
1350
1380
|
['button', {class: 'button p-1',
|
|
1351
1381
|
title: t('add'), 'data-i18n-title': 'add',
|
|
1352
1382
|
'aria-label': t('add'), 'data-i18n-aria-label': 'add'}, [
|
|
1353
|
-
['span', {class: 'icon m-0'}, '<i class="yi-plus"></i>'],
|
|
1383
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-plus"></i>')],
|
|
1354
1384
|
['span', {class: 'p-1 pr-2 is-hidden-mobile', i18n: 'add'}, 'add'],
|
|
1355
1385
|
], {
|
|
1356
1386
|
click: function(evt) {
|
|
@@ -2034,7 +2064,7 @@ function create_coordinates(gobj, attrs)
|
|
|
2034
2064
|
{
|
|
2035
2065
|
class: 'icon is-left is-clickable'
|
|
2036
2066
|
},
|
|
2037
|
-
'<i class="yi-location-crosshairs"></i>',
|
|
2067
|
+
html_markup('<i class="yi-location-crosshairs"></i>'),
|
|
2038
2068
|
{
|
|
2039
2069
|
'click': function (evt) {
|
|
2040
2070
|
evt.stopPropagation();
|
|
@@ -2206,6 +2236,7 @@ function template2columns(gobj, columns, template, sub_elements)
|
|
|
2206
2236
|
let column = {
|
|
2207
2237
|
field: field_desc.name,
|
|
2208
2238
|
title: t(field_desc.header || field_desc.name),
|
|
2239
|
+
titleFormatter: text_title_formatter,
|
|
2209
2240
|
editable: get_editable_state,
|
|
2210
2241
|
editor: false,
|
|
2211
2242
|
headerWordWrap: true,
|
|
@@ -3568,11 +3599,14 @@ function ac_add_table_row(gobj, event, kw, src)
|
|
|
3568
3599
|
if(gobj_is_destroying(gobj)) {
|
|
3569
3600
|
return; // the form went in the meantime: nothing to redraw
|
|
3570
3601
|
}
|
|
3571
|
-
/*
|
|
3572
|
-
* row
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3602
|
+
/* A row LOADED redraws the table that took it, nested or not; a
|
|
3603
|
+
* row ADDED by hand to a nested table redraws the table of the
|
|
3604
|
+
* row the nested one lives in, which is what grew (closest()
|
|
3605
|
+
* is the table itself for an outer one). Re-checked: it may be
|
|
3606
|
+
* destroyed by now. */
|
|
3607
|
+
let $target = loading? $table : $table.closest('.yui-tabulator-table');
|
|
3608
|
+
if($target && $target.tabulator) {
|
|
3609
|
+
$target.tabulator.redraw(); /* Delete double scrollbar */
|
|
3576
3610
|
}
|
|
3577
3611
|
}, 30);
|
|
3578
3612
|
|
package/src/c_yui_gclass.js
CHANGED
|
@@ -1756,7 +1756,9 @@ function restore_view_anchored(gobj, anchor)
|
|
|
1756
1756
|
if(typeof anchor.zoom === "number" && anchor.zoom > 0) {
|
|
1757
1757
|
try {
|
|
1758
1758
|
graph.zoomTo(anchor.zoom);
|
|
1759
|
-
} catch(e) {
|
|
1759
|
+
} catch(e) {
|
|
1760
|
+
log_warning(`${gobj_short_name(gobj)}: zoom not restored: ${e}`);
|
|
1761
|
+
}
|
|
1760
1762
|
}
|
|
1761
1763
|
|
|
1762
1764
|
/*
|
|
@@ -1768,7 +1770,9 @@ function restore_view_anchored(gobj, anchor)
|
|
|
1768
1770
|
let dx = anchor.viewport_x - vp[0];
|
|
1769
1771
|
let dy = anchor.viewport_y - vp[1];
|
|
1770
1772
|
graph.translateBy([dx, dy]);
|
|
1771
|
-
} catch(e) {
|
|
1773
|
+
} catch(e) {
|
|
1774
|
+
log_warning(`${gobj_short_name(gobj)}: anchor node not put back at its screen spot: ${e}`);
|
|
1775
|
+
}
|
|
1772
1776
|
}
|
|
1773
1777
|
|
|
1774
1778
|
/************************************************************
|
package/src/c_yui_nav.js
CHANGED
|
@@ -597,7 +597,7 @@ function render_submenu(gobj, items)
|
|
|
597
597
|
return createElement2(
|
|
598
598
|
["aside", {class: "menu p-2"},
|
|
599
599
|
[
|
|
600
|
-
["p", heading_attrs, heading_text],
|
|
600
|
+
["p", heading_attrs, text_node(heading_text)],
|
|
601
601
|
["ul", {class: "menu-list"}, lis]
|
|
602
602
|
]
|
|
603
603
|
]
|
|
@@ -639,7 +639,7 @@ function render_accordion(gobj, items)
|
|
|
639
639
|
head_attrs["aria-label"] = head_text;
|
|
640
640
|
head_attrs["data-i18n-aria-label"] = head_text;
|
|
641
641
|
}
|
|
642
|
-
let $hdr = createElement2(["button", head_attrs, head_text]);
|
|
642
|
+
let $hdr = createElement2(["button", head_attrs, text_node(head_text)]);
|
|
643
643
|
$container.appendChild($hdr);
|
|
644
644
|
|
|
645
645
|
let $ul = createElement2(
|
|
@@ -1029,7 +1029,7 @@ function show_notice(gobj, key, detail, detail_is_key)
|
|
|
1029
1029
|
attrs.i18n = `${detail}`;
|
|
1030
1030
|
}
|
|
1031
1031
|
$notice.appendChild(createElement2(
|
|
1032
|
-
["span", attrs, detail_is_key ? t(`${detail}`) : `${detail}`]
|
|
1032
|
+
["span", attrs, text_node(detail_is_key ? t(`${detail}`) : `${detail}`)]
|
|
1033
1033
|
));
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
@@ -1273,7 +1273,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
|
|
|
1273
1273
|
return ["span", {class: `${logical}_TAG tag ${tag.style || ""}`.trimEnd()},
|
|
1274
1274
|
tag.i18n
|
|
1275
1275
|
? [["span", {i18n: tag.i18n}, t(tag.i18n)],
|
|
1276
|
-
["span", {class: "ml-1"},
|
|
1276
|
+
["span", {class: "ml-1"}, text_node(tag.text)]]
|
|
1277
1277
|
: `${tag.text}`];
|
|
1278
1278
|
});
|
|
1279
1279
|
|
|
@@ -1282,7 +1282,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
|
|
|
1282
1282
|
["p", {class: `${logical}_TITLE is-flex is-align-items-center`,
|
|
1283
1283
|
style: "gap:.4rem;"}, [
|
|
1284
1284
|
["span", {class: "icon"}, [["i", {class: icon}]]],
|
|
1285
|
-
["span", {class: `${logical}_NAME has-text-weight-semibold`},
|
|
1285
|
+
["span", {class: `${logical}_NAME has-text-weight-semibold`}, text_node(title)]
|
|
1286
1286
|
]],
|
|
1287
1287
|
["div", {class: `${logical}_TAGS tags mt-2`, style: "gap:.25rem;"}, $tags]
|
|
1288
1288
|
]]
|
|
@@ -1385,7 +1385,7 @@ function render_topics(gobj, $body)
|
|
|
1385
1385
|
|
|
1386
1386
|
$rows.push(["tr", {class: "SCHEMA_TOPIC_ROW", role: "button", tabindex: "0"}, [
|
|
1387
1387
|
["td", {class: "SCHEMA_TOPIC_NAME"}, [
|
|
1388
|
-
["span", {class: "has-text-weight-semibold"},
|
|
1388
|
+
["span", {class: "has-text-weight-semibold"}, text_node(topic.name)],
|
|
1389
1389
|
topic.system_topic
|
|
1390
1390
|
? ["span", {class: "SCHEMA_TOPIC_SYSTEM tag ml-2",
|
|
1391
1391
|
i18n: "system"}, t("system")]
|
|
@@ -1399,14 +1399,14 @@ function render_topics(gobj, $body)
|
|
|
1399
1399
|
: ["span", {}, ""],
|
|
1400
1400
|
ambiguous
|
|
1401
1401
|
? ["div", {class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet"},
|
|
1402
|
-
[["code", {},
|
|
1402
|
+
[["code", {}, text_node(topic.id)]]]
|
|
1403
1403
|
: ["span", {}, ""]
|
|
1404
1404
|
]],
|
|
1405
|
-
["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {},
|
|
1406
|
-
["td", {class: "SCHEMA_TOPIC_COLS has-text-right"},
|
|
1405
|
+
["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {}, text_node(topic.pkey || "id")]]],
|
|
1406
|
+
["td", {class: "SCHEMA_TOPIC_COLS has-text-right"}, text_node(topic.cols.length)],
|
|
1407
1407
|
["td", {class: "SCHEMA_TOPIC_VERSION"}, [
|
|
1408
1408
|
["span", {class: `tag ${pending ? "is-warning" : "is-info"} is-light`},
|
|
1409
|
-
|
|
1409
|
+
text_node(topic.topic_version === undefined ? "?" : topic.topic_version)]
|
|
1410
1410
|
]],
|
|
1411
1411
|
["td", {class: "SCHEMA_TOPIC_ACTIONS has-text-right"}, $actions]
|
|
1412
1412
|
], {
|
|
@@ -1616,7 +1616,7 @@ function column_row(gobj, topic, col, index, readonly, twice)
|
|
|
1616
1616
|
* open_card(). It is why 'writable', 'image', 'wild' and every
|
|
1617
1617
|
* other unstyled flag rendered as an empty pill. */
|
|
1618
1618
|
return ["span", {class: `SCHEMA_COL_FLAG tag ${yui_tint(flag_style(flag))}`.trimEnd()},
|
|
1619
|
-
|
|
1619
|
+
text_node(flag)];
|
|
1620
1620
|
});
|
|
1621
1621
|
|
|
1622
1622
|
/* An unset `blob` column comes back as `{}`, which is an object and
|
|
@@ -1646,22 +1646,22 @@ function column_row(gobj, topic, col, index, readonly, twice)
|
|
|
1646
1646
|
readonly ? [] : [["span", {class: "icon yui-text-quiet"},
|
|
1647
1647
|
[["i", {class: "yi-grip-vertical"}]]]]],
|
|
1648
1648
|
["td", {class: "SCHEMA_COL_NAME"}, [
|
|
1649
|
-
["code", {},
|
|
1649
|
+
["code", {}, text_node(col.name)],
|
|
1650
1650
|
ambiguous
|
|
1651
1651
|
? ["span", {class: "SCHEMA_COL_ID is-size-7 yui-text-quiet ml-2"},
|
|
1652
|
-
[["code", {},
|
|
1652
|
+
[["code", {}, text_node(col.id)]]]
|
|
1653
1653
|
: ["span", {}, ""],
|
|
1654
1654
|
is_pkey
|
|
1655
1655
|
? ["span", {class: "SCHEMA_COL_PKEY tag is-info is-light ml-2",
|
|
1656
1656
|
i18n: "pkey"}, t("pkey")]
|
|
1657
1657
|
: ["span", {}, ""]
|
|
1658
1658
|
]],
|
|
1659
|
-
["td", {class: "SCHEMA_COL_HEADER"},
|
|
1660
|
-
["td", {class: "SCHEMA_COL_TYPE"}, [["code", {},
|
|
1659
|
+
["td", {class: "SCHEMA_COL_HEADER"}, text_node(record.header || "")],
|
|
1660
|
+
["td", {class: "SCHEMA_COL_TYPE"}, [["code", {}, text_node(record.type || "")]]],
|
|
1661
1661
|
["td", {class: "SCHEMA_COL_FLAGS"}, [
|
|
1662
1662
|
["div", {class: "tags", style: "gap:.2rem;"}, $flags]
|
|
1663
1663
|
]],
|
|
1664
|
-
["td", {class: "SCHEMA_COL_LINK"},
|
|
1664
|
+
["td", {class: "SCHEMA_COL_LINK"}, text_node(link)],
|
|
1665
1665
|
["td", {class: "SCHEMA_COL_ACTIONS has-text-right"}, $actions]
|
|
1666
1666
|
]]
|
|
1667
1667
|
);
|
|
@@ -2116,7 +2116,7 @@ function flags_field(gobj, type, current)
|
|
|
2116
2116
|
["input", el_attrs({type: "checkbox", class: "SCHEMA_FLAG_BOX",
|
|
2117
2117
|
"data-flag": flag.name,
|
|
2118
2118
|
checked: flag.on ? "checked" : undefined})],
|
|
2119
|
-
["span", {class: "SCHEMA_FLAG_NAME ml-1"},
|
|
2119
|
+
["span", {class: "SCHEMA_FLAG_NAME ml-1"}, text_node(flag.name)]
|
|
2120
2120
|
]];
|
|
2121
2121
|
});
|
|
2122
2122
|
|
|
@@ -2389,9 +2389,9 @@ function open_report(gobj, findings, treedb_id)
|
|
|
2389
2389
|
" is-light", i18n: finding.severity}, t(finding.severity)]
|
|
2390
2390
|
]],
|
|
2391
2391
|
["td", {class: "SCHEMA_REPORT_WHAT", i18n: finding.code}, t(finding.code)],
|
|
2392
|
-
["td", {class: "SCHEMA_REPORT_TOPIC"},
|
|
2393
|
-
["td", {class: "SCHEMA_REPORT_COL"},
|
|
2394
|
-
["td", {class: "SCHEMA_REPORT_DETAIL"}, [["code", {},
|
|
2392
|
+
["td", {class: "SCHEMA_REPORT_TOPIC"}, text_node(finding.topic || "")],
|
|
2393
|
+
["td", {class: "SCHEMA_REPORT_COL"}, text_node(finding.col || "")],
|
|
2394
|
+
["td", {class: "SCHEMA_REPORT_DETAIL"}, [["code", {}, text_node(finding.detail || "")]]]
|
|
2395
2395
|
]];
|
|
2396
2396
|
});
|
|
2397
2397
|
|
|
@@ -2664,7 +2664,7 @@ function render_import_plan(gobj, plan)
|
|
|
2664
2664
|
return ["li", {class: `SCHEMA_IMPORT_LINE SCHEMA_IMPORT_${write.op.toUpperCase()}`}, [
|
|
2665
2665
|
["span", {class: `tag is-light ${write.op === "delete" ? "is-danger" : "is-info"}`,
|
|
2666
2666
|
i18n: write.op}, t(write.op)],
|
|
2667
|
-
["code", {class: "ml-2"},
|
|
2667
|
+
["code", {class: "ml-2"}, text_node(what)]
|
|
2668
2668
|
]];
|
|
2669
2669
|
});
|
|
2670
2670
|
|
|
@@ -2672,9 +2672,9 @@ function render_import_plan(gobj, plan)
|
|
|
2672
2672
|
["div", {class: "SCHEMA_IMPORT_SUMMARY"}, [
|
|
2673
2673
|
["p", {class: "SCHEMA_IMPORT_COUNT is-size-7 yui-text-quiet mb-2"}, [
|
|
2674
2674
|
["span", {i18n: "writes"}, t("writes")],
|
|
2675
|
-
["span", {class: "ml-1"},
|
|
2675
|
+
["span", {class: "ml-1"}, text_node(plan.writes.length)],
|
|
2676
2676
|
["span", {class: "ml-3", i18n: "deletions"}, t("deletions")],
|
|
2677
|
-
["span", {class: "ml-1 has-text-weight-bold"},
|
|
2677
|
+
["span", {class: "ml-1 has-text-weight-bold"}, text_node(deletes.length)]
|
|
2678
2678
|
]],
|
|
2679
2679
|
["ul", {class: "SCHEMA_IMPORT_LINES is-size-7",
|
|
2680
2680
|
style: "max-height:14rem; overflow:auto;"}, $lines]
|
|
@@ -2699,7 +2699,7 @@ function open_orphans(gobj)
|
|
|
2699
2699
|
let row = (kind, entry) => {
|
|
2700
2700
|
return ["tr", {class: "SCHEMA_ORPHAN_ROW"}, [
|
|
2701
2701
|
["td", {class: "SCHEMA_ORPHAN_KIND", i18n: kind}, t(kind)],
|
|
2702
|
-
["td", {class: "SCHEMA_ORPHAN_ID"}, [["code", {},
|
|
2702
|
+
["td", {class: "SCHEMA_ORPHAN_ID"}, [["code", {}, text_node(entry.id)]]],
|
|
2703
2703
|
["td", {class: "SCHEMA_ORPHAN_ACTIONS has-text-right"},
|
|
2704
2704
|
readonly ? [] : [row_icon(gobj, "SCHEMA_ORPHAN_DELETE", "yi-trash", "delete",
|
|
2705
2705
|
"EV_DELETE_ORPHAN", {kind: kind, id: entry.id, model_gen: priv.model_gen})]]
|
package/src/c_yui_shell.js
CHANGED
|
@@ -155,6 +155,9 @@ let PRIVATE_DATA = {
|
|
|
155
155
|
/* Count of history.back() calls WE issued to retire a dismissed
|
|
156
156
|
* overlay; the popstate they trigger is expected and ignored. */
|
|
157
157
|
expected_pops: 0,
|
|
158
|
+
/* Overlays registered while one of those history.back() calls is
|
|
159
|
+
* still in flight: their marker is pushed once it has landed. */
|
|
160
|
+
pending_markers: [],
|
|
158
161
|
popstate_handler: null,
|
|
159
162
|
/* Avatar item support — every toolbar item with type:"avatar"
|
|
160
163
|
* registers its <span> here so refresh_avatars() can repaint
|
|
@@ -278,6 +281,9 @@ function mt_start(gobj)
|
|
|
278
281
|
/* A history.back() we issued to retire a dismissed
|
|
279
282
|
* overlay — the teardown already happened. */
|
|
280
283
|
p.expected_pops--;
|
|
284
|
+
if(p.expected_pops === 0) {
|
|
285
|
+
push_pending_markers(gobj);
|
|
286
|
+
}
|
|
281
287
|
return;
|
|
282
288
|
}
|
|
283
289
|
if(p.overlay_stack.length === 0) {
|
|
@@ -2603,16 +2609,60 @@ function push_overlay_history(gobj, close, opts)
|
|
|
2603
2609
|
* dock-managed window registers no overlay at all. */
|
|
2604
2610
|
keep_on_navigate: !!(opts && opts.keep_on_navigate) };
|
|
2605
2611
|
priv.overlay_stack.push(entry);
|
|
2612
|
+
|
|
2613
|
+
/* A history.back() of ours still in flight (an overlay closed by a
|
|
2614
|
+
* button, and this one opened in the same turn: a window that takes
|
|
2615
|
+
* its entry back when its question is answered, a dialog that opens
|
|
2616
|
+
* another). back() is ASYNCHRONOUS and pushState is not, so a marker
|
|
2617
|
+
* pushed now lands BEFORE the traversal, which then runs from it:
|
|
2618
|
+
* the marker is left orphaned ahead of the old one, and the pop we
|
|
2619
|
+
* counted is the user's next Back. The marker waits for the landing. */
|
|
2620
|
+
if(priv.expected_pops > 0) {
|
|
2621
|
+
entry.marker_pending = true;
|
|
2622
|
+
priv.pending_markers.push(entry);
|
|
2623
|
+
return entry;
|
|
2624
|
+
}
|
|
2625
|
+
if(!push_overlay_marker(gobj, entry)) {
|
|
2626
|
+
return null; // Error already logged
|
|
2627
|
+
}
|
|
2628
|
+
return entry;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
function push_overlay_marker(gobj, entry)
|
|
2632
|
+
{
|
|
2633
|
+
let priv = gobj.priv;
|
|
2606
2634
|
try {
|
|
2607
2635
|
window.history.pushState({ __yui_overlay__: entry.id }, "");
|
|
2608
2636
|
} catch(e) {
|
|
2609
2637
|
/* pushState failed (rare): drop the entry so overlay_dismissed
|
|
2610
2638
|
* won't later history.back() past a real route. */
|
|
2611
|
-
priv.overlay_stack.
|
|
2639
|
+
let idx = priv.overlay_stack.indexOf(entry);
|
|
2640
|
+
if(idx >= 0) {
|
|
2641
|
+
priv.overlay_stack.splice(idx, 1);
|
|
2642
|
+
}
|
|
2612
2643
|
log_warning(`C_YUI_SHELL: overlay pushState failed: ${e}`);
|
|
2613
|
-
return
|
|
2644
|
+
return false;
|
|
2645
|
+
}
|
|
2646
|
+
return true;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
/* The history.back() calls of ours have all landed: push the markers of
|
|
2650
|
+
* the overlays registered meanwhile, in their order. One closed in the
|
|
2651
|
+
* meantime (dismissed, drained, or no longer on the stack) has none. */
|
|
2652
|
+
function push_pending_markers(gobj)
|
|
2653
|
+
{
|
|
2654
|
+
let priv = gobj.priv;
|
|
2655
|
+
let pending = priv.pending_markers.splice(0);
|
|
2656
|
+
for(let entry of pending) {
|
|
2657
|
+
entry.marker_pending = false;
|
|
2658
|
+
if(entry.dismissed || priv.overlay_stack.indexOf(entry) < 0) {
|
|
2659
|
+
continue;
|
|
2660
|
+
}
|
|
2661
|
+
/* The traversal was same-hash, but a route may have moved
|
|
2662
|
+
* meanwhile: the marker lives on the hash it is pushed on. */
|
|
2663
|
+
entry.hash = window.location.hash;
|
|
2664
|
+
push_overlay_marker(gobj, entry); // Error already logged
|
|
2614
2665
|
}
|
|
2615
|
-
return entry;
|
|
2616
2666
|
}
|
|
2617
2667
|
|
|
2618
2668
|
function overlay_dismissed(gobj, entry)
|
|
@@ -2631,6 +2681,10 @@ function overlay_dismissed(gobj, entry)
|
|
|
2631
2681
|
return;
|
|
2632
2682
|
}
|
|
2633
2683
|
priv.overlay_stack.splice(idx, 1);
|
|
2684
|
+
if(entry.marker_pending) {
|
|
2685
|
+
/* Its marker was never pushed: there is nothing to retire. */
|
|
2686
|
+
return;
|
|
2687
|
+
}
|
|
2634
2688
|
/* Retire the synthetic browser entry ONLY when it is the CURRENT
|
|
2635
2689
|
* one — its state marker is live — so history.back() steps off it
|
|
2636
2690
|
* invisibly (same hash, no route change). In every other case the
|
|
@@ -1147,7 +1147,7 @@ function col_title_formatter(gobj, col)
|
|
|
1147
1147
|
if(t(col.id, {defaultValue: NO_I18N}) !== NO_I18N) {
|
|
1148
1148
|
attrs.i18n = col.id;
|
|
1149
1149
|
}
|
|
1150
|
-
return createElement2(['span', attrs, text]);
|
|
1150
|
+
return createElement2(['span', attrs, text_node(text)]);
|
|
1151
1151
|
};
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
@@ -2045,7 +2045,7 @@ function file_cell_formatter(cell, formatterParams, onRendered)
|
|
|
2045
2045
|
}
|
|
2046
2046
|
const children = [
|
|
2047
2047
|
['span', {class: 'FILE_CELL_ICON icon yi-eye'}],
|
|
2048
|
-
['span', {class: 'FILE_CELL_ID'}, yui_file_id_label(ids[0])]
|
|
2048
|
+
['span', {class: 'FILE_CELL_ID'}, text_node(yui_file_id_label(ids[0]))]
|
|
2049
2049
|
];
|
|
2050
2050
|
if(ids.length > 1) {
|
|
2051
2051
|
children.push(['span', {class: 'FILE_CELL_MORE'}, `+${ids.length - 1}`]);
|
|
@@ -4814,7 +4814,7 @@ function build_delete_question(gobj, records)
|
|
|
4814
4814
|
if(one && one[pkey] !== undefined && one[pkey] !== null) {
|
|
4815
4815
|
lines.push(["p", {class: "DELETE_ASK_WHAT", style: ROW}, [
|
|
4816
4816
|
["span", {i18n: "delete"}, t("delete")],
|
|
4817
|
-
["strong", {},
|
|
4817
|
+
["strong", {}, text_node(one[pkey])]
|
|
4818
4818
|
]]);
|
|
4819
4819
|
} else {
|
|
4820
4820
|
lines.push(["p", {class: "DELETE_ASK_WHAT", style: ROW}, [
|
|
@@ -5069,7 +5069,7 @@ function ac_open_columns(gobj, event, kw, src)
|
|
|
5069
5069
|
$list.appendChild(createElement2(
|
|
5070
5070
|
['label', {class: 'checkbox is-block mb-1 TREEDB_COLUMN_ITEM'}, [
|
|
5071
5071
|
$cb,
|
|
5072
|
-
['span', {class: 'ml-2'}, column.getDefinition().title || field]
|
|
5072
|
+
['span', {class: 'ml-2'}, text_node(column.getDefinition().title || field)]
|
|
5073
5073
|
]]
|
|
5074
5074
|
));
|
|
5075
5075
|
}
|