@yuneta/gobj-ui 7.23.56 → 7.23.57

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.
@@ -5900,18 +5900,18 @@ function refresh_clear($input) {
5900
5900
  * Copyright (c) 2026, ArtGins.
5901
5901
  * All Rights Reserved.
5902
5902
  ***********************************************************************/
5903
- var LEFT_BUTTONS = [
5904
- "save",
5903
+ var LEFT_BUTTONS = ["copy", "paste"];
5904
+ var RIGHT_BUTTONS = [
5905
5905
  "undo",
5906
- "clear"
5906
+ "clear",
5907
+ "save"
5907
5908
  ];
5908
- var RIGHT_BUTTONS = ["copy", "paste"];
5909
5909
  var DEFAULT_TOOLBAR = [
5910
- "save",
5910
+ "copy",
5911
+ "paste",
5911
5912
  "undo",
5912
5913
  "clear",
5913
- "copy",
5914
- "paste"
5914
+ "save"
5915
5915
  ];
5916
5916
  /***************************************************************
5917
5917
  * plan_toolbar(wanted) -> {left, right, unknown}
@@ -5895,18 +5895,18 @@ function refresh_clear($input) {
5895
5895
  * Copyright (c) 2026, ArtGins.
5896
5896
  * All Rights Reserved.
5897
5897
  ***********************************************************************/
5898
- var LEFT_BUTTONS = [
5899
- "save",
5898
+ var LEFT_BUTTONS = ["copy", "paste"];
5899
+ var RIGHT_BUTTONS = [
5900
5900
  "undo",
5901
- "clear"
5901
+ "clear",
5902
+ "save"
5902
5903
  ];
5903
- var RIGHT_BUTTONS = ["copy", "paste"];
5904
5904
  var DEFAULT_TOOLBAR = [
5905
- "save",
5905
+ "copy",
5906
+ "paste",
5906
5907
  "undo",
5907
5908
  "clear",
5908
- "copy",
5909
- "paste"
5909
+ "save"
5910
5910
  ];
5911
5911
  /***************************************************************
5912
5912
  * plan_toolbar(wanted) -> {left, right, unknown}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.56",
3
+ "version": "7.23.57",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -10,13 +10,25 @@
10
10
  * All Rights Reserved.
11
11
  ***********************************************************************/
12
12
 
13
- /* Save/undo/clear sit on the left of the bar, copy/paste on the right.
14
- * That split is what the layout has always drawn, and keeping it means
15
- * a caller who drops one group does not leave a hole in the middle. */
16
- const LEFT_BUTTONS = ["save", "undo", "clear"];
17
- const RIGHT_BUTTONS = ["copy", "paste"];
13
+ /* Two groups, and the split is a real one: `undo`, `clear` and `save`
14
+ * act on the RECORD being edited, `copy` and `paste` move it in and out
15
+ * of the clipboard. Keeping them apart means a caller who drops one
16
+ * group does not leave a hole in the middle.
17
+ *
18
+ * WHICH SIDE EACH ONE TAKES CHANGED (2026-09-04), and the reason is that
19
+ * the form changed shape: it was an embedded panel and it opens as a
20
+ * MODAL DIALOG now. In a dialog the primary action goes bottom-RIGHT --
21
+ * every platform puts it there, and it is where the eye ends after
22
+ * reading the fields. `save` sat hard against the left edge, which is
23
+ * where a person looks last.
24
+ *
25
+ * So: clipboard on the left, record actions on the right, and `save`
26
+ * LAST of all. The order inside a group is the order asked for, which
27
+ * is why DEFAULT_TOOLBAR is written in the order it is drawn. */
28
+ const LEFT_BUTTONS = ["copy", "paste"];
29
+ const RIGHT_BUTTONS = ["undo", "clear", "save"];
18
30
 
19
- const DEFAULT_TOOLBAR = ["save", "undo", "clear", "copy", "paste"];
31
+ const DEFAULT_TOOLBAR = ["copy", "paste", "undo", "clear", "save"];
20
32
 
21
33
 
22
34
  /***************************************************************
@@ -5,17 +5,26 @@ describe("plan_toolbar", () => {
5
5
 
6
6
  it("says nothing -> the five buttons this gclass always had", () => {
7
7
  const p = plan_toolbar(undefined);
8
- expect(p.left).toEqual(["save", "undo", "clear"]);
9
- expect(p.right).toEqual(["copy", "paste"]);
8
+ expect(p.left).toEqual(["copy", "paste"]);
9
+ expect(p.right).toEqual(["undo", "clear", "save"]);
10
10
  expect(p.unknown).toEqual([]);
11
11
  expect(DEFAULT_TOOLBAR.length).toBe(5);
12
12
  });
13
13
 
14
+ it("save is the LAST button of the bar", () => {
15
+ /* The form opens as a modal dialog and a dialog's primary action
16
+ * goes bottom-right. Asserted on the plan and not on the CSS,
17
+ * because the plan is what decides the two groups. */
18
+ const p = plan_toolbar(undefined);
19
+ expect(p.right[p.right.length - 1]).toBe("save");
20
+ expect(p.left).not.toContain("save");
21
+ });
22
+
14
23
  it("a non-array is not an empty toolbar: it is the default", () => {
15
24
  /* Reading a JSON attr that was never set must not silently
16
25
  * leave a form with no save button. */
17
26
  for(const v of [null, "save", 0, {}]) {
18
- expect(plan_toolbar(v).left).toContain("save");
27
+ expect(plan_toolbar(v).right).toContain("save");
19
28
  }
20
29
  });
21
30
 
@@ -28,21 +37,21 @@ describe("plan_toolbar", () => {
28
37
 
29
38
  it("one action: a dialog asks for save only", () => {
30
39
  const p = plan_toolbar(["save"]);
31
- expect(p.left).toEqual(["save"]);
32
- expect(p.right).toEqual([]);
40
+ expect(p.right).toEqual(["save"]);
41
+ expect(p.left).toEqual([]);
33
42
  });
34
43
 
35
44
  it("keeps the order asked for inside each side", () => {
36
45
  const p = plan_toolbar(["clear", "save", "paste", "copy"]);
37
- expect(p.left).toEqual(["clear", "save"]);
38
- expect(p.right).toEqual(["paste", "copy"]);
46
+ expect(p.right).toEqual(["clear", "save"]);
47
+ expect(p.left).toEqual(["paste", "copy"]);
39
48
  });
40
49
 
41
50
  it("an unknown name is REPORTED, never silently dropped", () => {
42
51
  /* A typo here would otherwise remove a button and leave no
43
52
  * trace of why it is missing. */
44
53
  const p = plan_toolbar(["save", "sav", "undo"]);
45
- expect(p.left).toEqual(["save", "undo"]);
54
+ expect(p.right).toEqual(["save", "undo"]);
46
55
  expect(p.unknown).toEqual(["sav"]);
47
56
  });
48
57
 
@@ -59,7 +68,7 @@ describe("plan_toolbar", () => {
59
68
 
60
69
  it("drops one whole side without disturbing the other", () => {
61
70
  const p = plan_toolbar(["save", "undo", "clear"]);
62
- expect(p.left).toEqual(["save", "undo", "clear"]);
63
- expect(p.right).toEqual([]);
71
+ expect(p.right).toEqual(["save", "undo", "clear"]);
72
+ expect(p.left).toEqual([]);
64
73
  });
65
74
  });