@yuneta/gobj-ui 5.1.0 → 5.2.1

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.
@@ -307,6 +307,8 @@ function validate_dropdown_action(action, owner_id) {
307
307
  warnings.push(`dropdown item ${where} has action.type:dropdown — nested dropdowns are not supported`);
308
308
  continue;
309
309
  }
310
+ if (it.icon && it.image) warnings.push(`dropdown item ${where} declares both icon and image — image wins, drop one`);
311
+ if (it.selected !== void 0 && typeof it.selected !== "boolean") warnings.push(`dropdown item ${where} has non-boolean 'selected'`);
310
312
  let nested = validate_action(it.action, where);
311
313
  for (let w of nested) warnings.push(w);
312
314
  }
@@ -1914,7 +1916,16 @@ function build_dropdown_row(gobj, sub, idx) {
1914
1916
  return null;
1915
1917
  }
1916
1918
  let children = [];
1917
- if (!(0, _yuneta_gobj_js.empty_string)(sub.icon)) children.push([
1919
+ if (!(0, _yuneta_gobj_js.empty_string)(sub.image)) children.push([
1920
+ "span",
1921
+ { class: "yui-toolbar-dropdown-glyph" },
1922
+ ["img", {
1923
+ src: sub.image,
1924
+ alt: "",
1925
+ "aria-hidden": "true"
1926
+ }]
1927
+ ]);
1928
+ else if (!(0, _yuneta_gobj_js.empty_string)(sub.icon)) children.push([
1918
1929
  "span",
1919
1930
  { class: "icon" },
1920
1931
  ["i", {
@@ -1930,12 +1941,21 @@ function build_dropdown_row(gobj, sub, idx) {
1930
1941
  },
1931
1942
  sub.name
1932
1943
  ]);
1944
+ children.push([
1945
+ "span",
1946
+ { class: "yui-toolbar-dropdown-check" },
1947
+ ["i", {
1948
+ class: "yi-check",
1949
+ "aria-hidden": "true"
1950
+ }]
1951
+ ]);
1933
1952
  let aria_key = sub.aria_label || sub.name || sub.id || "";
1934
1953
  let i18n_aria = sub.aria_label || sub.name;
1935
1954
  let attrs = {
1936
- class: "yui-toolbar-dropdown-item",
1955
+ class: "yui-toolbar-dropdown-item" + (sub.selected ? " is-selected" : ""),
1937
1956
  type: "button",
1938
- role: "menuitem",
1957
+ role: "menuitemradio",
1958
+ "aria-checked": sub.selected ? "true" : "false",
1939
1959
  "data-dropdown-item-id": sub.id || "",
1940
1960
  "aria-label": aria_key
1941
1961
  };
@@ -18644,8 +18664,7 @@ function build_graph$1(gobj) {
18644
18664
  priv.graph = graph;
18645
18665
  graph.setTheme(dark ? "dark" : "light");
18646
18666
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
18647
- let node_id = evt && evt.target && evt.target.id;
18648
- gobj_send_event(gobj, "EV_NODE_CLICK", { node_id }, gobj);
18667
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { node_id: evt && evt.target && evt.target.id }, gobj);
18649
18668
  });
18650
18669
  graph.render().then(() => {
18651
18670
  try {