@jinntec/fore 2.2.0 → 2.3.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.
Files changed (88) hide show
  1. package/README.md +1 -1
  2. package/dist/fore-dev.js +2 -2
  3. package/dist/fore-dev.js.map +1 -1
  4. package/dist/fore.js +2 -2
  5. package/dist/fore.js.map +1 -1
  6. package/index.js +3 -2
  7. package/package.json +10 -38
  8. package/resources/fore.css +263 -262
  9. package/resources/vars.css +8 -0
  10. package/src/DependencyNotifyingDomFacade.js +1 -0
  11. package/src/ForeElementMixin.js +243 -228
  12. package/src/actions/abstract-action.js +407 -398
  13. package/src/actions/fx-action.js +6 -6
  14. package/src/actions/fx-append.js +1 -1
  15. package/src/actions/fx-call.js +63 -62
  16. package/src/actions/fx-confirm.js +11 -11
  17. package/src/actions/fx-construct-done.js +4 -4
  18. package/src/actions/fx-copy.js +36 -36
  19. package/src/actions/fx-delete.js +77 -79
  20. package/src/actions/fx-dispatch.js +14 -14
  21. package/src/actions/fx-hide.js +15 -15
  22. package/src/actions/fx-insert.js +9 -12
  23. package/src/actions/fx-insertchild.js +88 -0
  24. package/src/actions/fx-load.js +188 -185
  25. package/src/actions/fx-message.js +18 -19
  26. package/src/actions/fx-refresh.js +10 -10
  27. package/src/actions/fx-reload.js +16 -14
  28. package/src/actions/fx-replace.js +0 -1
  29. package/src/actions/fx-reset.js +31 -31
  30. package/src/actions/fx-send.js +59 -52
  31. package/src/actions/fx-setattribute.js +48 -49
  32. package/src/actions/fx-setfocus.js +54 -58
  33. package/src/actions/fx-setvalue.js +85 -81
  34. package/src/actions/fx-show.js +11 -11
  35. package/src/actions/fx-toggle.js +2 -2
  36. package/src/actions/fx-toggleboolean.js +38 -39
  37. package/src/actions/fx-unmodified.js +27 -0
  38. package/src/actions/fx-update.js +6 -6
  39. package/src/dep_graph.js +1 -1
  40. package/src/drawdown.js +23 -30
  41. package/src/events.js +19 -19
  42. package/src/fore.js +143 -125
  43. package/src/functions/common-function.js +24 -25
  44. package/src/functions/fx-function.js +4 -6
  45. package/src/functions/fx-functionlib.js +39 -42
  46. package/src/functions/registerFunction.js +95 -86
  47. package/src/fx-bind.js +19 -24
  48. package/src/fx-connection.js +226 -0
  49. package/src/fx-fore.js +846 -815
  50. package/src/fx-header.js +4 -4
  51. package/src/fx-instance.js +23 -27
  52. package/src/fx-model.js +405 -383
  53. package/src/fx-submission.js +399 -397
  54. package/src/fx-var.js +6 -5
  55. package/src/getInScopeContext.js +102 -89
  56. package/src/json-util.js +24 -24
  57. package/src/lab/fore-component.js +48 -52
  58. package/src/lab/instance-inspector.js +13 -16
  59. package/src/modelitem.js +48 -10
  60. package/src/relevance.js +12 -16
  61. package/src/tools/adi.js +858 -812
  62. package/src/tools/fx-action-log.js +377 -295
  63. package/src/tools/fx-devtools.js +210 -210
  64. package/src/tools/fx-dom-inspector.js +123 -122
  65. package/src/tools/fx-json-instance.js +262 -253
  66. package/src/tools/fx-log-item.js +6 -11
  67. package/src/tools/fx-log-settings.js +358 -301
  68. package/src/tools/fx-minimap.js +186 -177
  69. package/src/tools/helpers.js +1 -1
  70. package/src/ui/abstract-control.js +74 -56
  71. package/src/ui/fx-case.js +59 -7
  72. package/src/ui/fx-container.js +13 -14
  73. package/src/ui/fx-control.js +572 -538
  74. package/src/ui/fx-dialog.js +3 -3
  75. package/src/ui/fx-droptarget.js +3 -4
  76. package/src/ui/fx-group.js +4 -2
  77. package/src/ui/fx-hint.js +3 -0
  78. package/src/ui/fx-inspector.js +5 -5
  79. package/src/ui/fx-items.js +11 -11
  80. package/src/ui/fx-output.js +10 -12
  81. package/src/ui/fx-repeat-attributes.js +23 -27
  82. package/src/ui/fx-repeat.js +347 -344
  83. package/src/ui/fx-repeatitem.js +75 -68
  84. package/src/ui/fx-switch.js +39 -14
  85. package/src/ui/fx-trigger.js +4 -4
  86. package/src/withDraggability.js +193 -191
  87. package/src/xpath-evaluation.js +969 -959
  88. package/src/xpath-util.js +161 -134
package/src/ui/fx-case.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // import { foreElementMixin } from '../ForeElementMixin';
2
2
 
3
- import {FxContainer} from "./fx-container.js";
3
+ import { FxContainer } from './fx-container.js';
4
+ import { Fore } from '../fore.js';
4
5
 
5
6
  /**
6
7
  * `fx-case`
@@ -9,12 +10,27 @@ import {FxContainer} from "./fx-container.js";
9
10
  * * todo: implement
10
11
  * @customElement
11
12
  */
12
- class FxCase extends FxContainer {
13
- /*
14
- constructor() {
15
- super();
13
+ export class FxCase extends FxContainer {
14
+ static get properties() {
15
+ return {
16
+ ...super.properties,
17
+ label: {
18
+ type: String,
19
+ },
20
+ name: {
21
+ type: String,
22
+ },
23
+ selected: {
24
+ type: String,
25
+ },
26
+ selector: {
27
+ type: String,
28
+ },
29
+ src: {
30
+ type: String,
31
+ },
32
+ };
16
33
  }
17
- */
18
34
 
19
35
  connectedCallback() {
20
36
  if (this.hasAttribute('label')) {
@@ -26,6 +42,10 @@ class FxCase extends FxContainer {
26
42
  if (this.hasAttribute('selected')) {
27
43
  this.selected = this.getAttribute('selected');
28
44
  }
45
+ this.selector = this.hasAttribute('selector') ? this.getAttribute('selector') : 'fx-case';
46
+ if (this.hasAttribute('src')) {
47
+ this.src = this.getAttribute('src');
48
+ }
29
49
 
30
50
  const style = `
31
51
  :host {
@@ -41,8 +61,40 @@ class FxCase extends FxContainer {
41
61
  ${style}
42
62
  </style>
43
63
  ${html}
44
- `;
64
+ `;
65
+
66
+ this.addEventListener('select', async () => {
67
+ const ownerForm = this.getOwnerForm();
68
+ if (this.src) {
69
+ // We will replace the node. So this node will be detached after these async function
70
+ // calls. Save all important state first.
71
+ const { parentNode } = this;
72
+ const replacement = await this._loadFromSrc();
73
+ if(!replacement){
74
+ Fore.dispatch(this, 'error', {
75
+ detail: {
76
+ message: `HTML page couldn't be loaded`,
77
+ },
78
+ });
79
+ return;
80
+ }
81
+ await parentNode.replaceCase(this, replacement);
82
+ }
83
+ const model = ownerForm.getModel();
84
+ model.updateModel();
85
+ ownerForm.refresh(true);
86
+ });
87
+ }
45
88
 
89
+ /**
90
+ * loads a Fore from an URL given by `src`.
91
+ *
92
+ * Will extract the `fx-fore` element from that target file and use and replace current `fx-fore` element with the loaded one.
93
+ * @private
94
+ */
95
+ async _loadFromSrc() {
96
+ // console.log('########## loading Fore from ', this.src, '##########');
97
+ return Fore.loadForeFromSrc(this, this.src, this.selector);
46
98
  }
47
99
  }
48
100
 
@@ -1,30 +1,30 @@
1
1
  import '../fx-model.js';
2
- import { foreElementMixin } from '../ForeElementMixin.js';
3
- import {Fore} from "../fore.js";
2
+ import ForeElementMixin from '../ForeElementMixin.js';
4
3
 
5
4
  /**
6
5
  * `fx-container` -
7
6
  * is a general class for container elements.
8
7
  *
9
8
  */
10
- export class FxContainer extends foreElementMixin(HTMLElement) {
9
+ export class FxContainer extends ForeElementMixin {
11
10
  static get properties() {
12
11
  return {
13
12
  ...super.properties,
14
- /*
13
+ /*
15
14
  src: {
16
15
  type: String,
17
16
  },
18
17
  */
19
18
  };
20
19
  }
20
+
21
21
  constructor() {
22
22
  super();
23
23
  this.attachShadow({ mode: 'open' });
24
24
  }
25
25
 
26
26
  connectedCallback() {
27
- this.src = this.hasAttribute('src') ? this.getAttribute('src'):null;
27
+ this.src = this.hasAttribute('src') ? this.getAttribute('src') : null;
28
28
  const style = `
29
29
  :host {
30
30
  display: block;
@@ -44,7 +44,7 @@ export class FxContainer extends foreElementMixin(HTMLElement) {
44
44
 
45
45
  this.getOwnerForm().registerLazyElement(this);
46
46
 
47
- /*
47
+ /*
48
48
  this.addEventListener('mousedown', e => {
49
49
 
50
50
  if(e.target === this){
@@ -53,7 +53,6 @@ export class FxContainer extends foreElementMixin(HTMLElement) {
53
53
  }
54
54
  } );
55
55
  */
56
-
57
56
  }
58
57
 
59
58
  /**
@@ -64,7 +63,7 @@ export class FxContainer extends foreElementMixin(HTMLElement) {
64
63
  // console.log('### FxContainer.refresh on : ', this);
65
64
 
66
65
  // if loading from 'src' needs to be done do it now
67
- /*
66
+ /*
68
67
  if(this.src){
69
68
  await Fore.loadForeFromSrc(this,this.src,'fx-group')
70
69
  .then(foreElement =>{
@@ -104,8 +103,8 @@ export class FxContainer extends foreElementMixin(HTMLElement) {
104
103
  // console.log('mip valid', this.modelItem.enabled);
105
104
  if (!this.modelItem) {
106
105
  // console.log('container is not relevant');
107
- this.removeAttribute('relevant','');
108
- this.setAttribute('nonrelevant','');
106
+ this.removeAttribute('relevant', '');
107
+ this.setAttribute('nonrelevant', '');
109
108
  this.dispatchEvent(new CustomEvent('disabled', {}));
110
109
  return;
111
110
  }
@@ -113,12 +112,12 @@ export class FxContainer extends foreElementMixin(HTMLElement) {
113
112
  if (this.isEnabled() !== this.modelItem.enabled) {
114
113
  if (this.modelItem.relevant) {
115
114
  // this.style.display = 'block';
116
- this.removeAttribute('nonrelevant','');
117
- this.setAttribute('relevant','');
115
+ this.removeAttribute('nonrelevant', '');
116
+ this.setAttribute('relevant', '');
118
117
  this.dispatchEvent(new CustomEvent('enabled', {}));
119
118
  } else {
120
- this.removeAttribute('relevant','');
121
- this.setAttribute('nonrelevant','');
119
+ this.removeAttribute('relevant', '');
120
+ this.setAttribute('nonrelevant', '');
122
121
  this.dispatchEvent(new CustomEvent('disabled', {}));
123
122
  }
124
123
  }