@humandialog/forms.svelte 1.4.2 → 1.4.3

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.
Files changed (2) hide show
  1. package/operations.svelte +33 -0
  2. package/package.json +1 -1
package/operations.svelte CHANGED
@@ -1,5 +1,6 @@
1
1
  <script>import { showFloatingToolbar, showMenu, showGridMenu } from "./components/menu.js";
2
2
  import { contextToolbarOperations, pageToolbarOperations, contextItemsStore } from "./stores.js";
3
+ import { FaEllipsisV } from "svelte-icons/fa";
3
4
  export let mobile = false;
4
5
  $:
5
6
  update($pageToolbarOperations, $contextToolbarOperations);
@@ -9,17 +10,20 @@ let rightOperations = [];
9
10
  let hasOperations = false;
10
11
  function update(...args) {
11
12
  let opVer = 0;
13
+ let operationsRoot = null;
12
14
  if ($contextToolbarOperations && Array.isArray($contextToolbarOperations) && $contextToolbarOperations.length > 0) {
13
15
  operations = $contextToolbarOperations;
14
16
  } else if ($contextToolbarOperations && $contextToolbarOperations.operations && $contextToolbarOperations.operations.length > 0) {
15
17
  operations = $contextToolbarOperations.operations;
16
18
  opVer = $contextToolbarOperations.opver ?? 0;
19
+ operationsRoot = $contextToolbarOperations;
17
20
  } else {
18
21
  if (Array.isArray($pageToolbarOperations))
19
22
  operations = $pageToolbarOperations;
20
23
  else {
21
24
  operations = $pageToolbarOperations.operations;
22
25
  opVer = $pageToolbarOperations.opver ?? 0;
26
+ operationsRoot = $pageToolbarOperations;
23
27
  }
24
28
  }
25
29
  leftOperations = [];
@@ -38,6 +42,35 @@ function update(...args) {
38
42
  leftOperations = [...AOperations, ...BOperations];
39
43
  rightOperations = [...COperations];
40
44
  } else if (opVer == 2) {
45
+ if (operationsRoot && operationsRoot.tbr) {
46
+ let allFlatOperations = [];
47
+ operationsRoot.operations.forEach(
48
+ (g) => allFlatOperations = [
49
+ ...allFlatOperations,
50
+ {
51
+ separator: true
52
+ },
53
+ ...g.operations
54
+ ]
55
+ );
56
+ const allOperationsMenu = {
57
+ caption: operationsRoot.caption ?? "",
58
+ icon: operationsRoot.icon ?? FaEllipsisV,
59
+ menu: allFlatOperations,
60
+ tbr: operationsRoot.tbr
61
+ };
62
+ switch (operationsRoot.tbr) {
63
+ case "A":
64
+ AOperations.push(allOperationsMenu);
65
+ break;
66
+ case "B":
67
+ BOperations.push(allOperationsMenu);
68
+ break;
69
+ case "C":
70
+ COperations.push(allOperationsMenu);
71
+ break;
72
+ }
73
+ }
41
74
  operations.forEach((group) => {
42
75
  if (group.tbr) {
43
76
  const expandOperation = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",