@jinntec/fore 2.1.1 → 2.3.0
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 +2 -2
- package/dist/fore-dev.js +2 -2
- package/dist/fore-dev.js.map +1 -1
- package/dist/fore.js +2 -2
- package/dist/fore.js.map +1 -1
- package/index.js +4 -2
- package/package.json +10 -38
- package/resources/fore.css +263 -262
- package/resources/vars.css +8 -0
- package/src/DependencyNotifyingDomFacade.js +1 -0
- package/src/ForeElementMixin.js +243 -228
- package/src/actions/abstract-action.js +407 -398
- package/src/actions/fx-action.js +6 -6
- package/src/actions/fx-append.js +1 -1
- package/src/actions/fx-call.js +63 -62
- package/src/actions/fx-confirm.js +11 -11
- package/src/actions/fx-construct-done.js +4 -4
- package/src/actions/fx-copy.js +36 -36
- package/src/actions/fx-delete.js +77 -79
- package/src/actions/fx-dispatch.js +14 -14
- package/src/actions/fx-hide.js +15 -15
- package/src/actions/fx-insert.js +9 -12
- package/src/actions/fx-insertchild.js +88 -0
- package/src/actions/fx-load.js +188 -185
- package/src/actions/fx-message.js +18 -19
- package/src/actions/fx-refresh.js +10 -10
- package/src/actions/fx-reload.js +16 -14
- package/src/actions/fx-replace.js +0 -1
- package/src/actions/fx-reset.js +31 -31
- package/src/actions/fx-send.js +59 -52
- package/src/actions/fx-setattribute.js +48 -49
- package/src/actions/fx-setfocus.js +54 -58
- package/src/actions/fx-setvalue.js +85 -81
- package/src/actions/fx-show.js +11 -11
- package/src/actions/fx-toggle.js +2 -2
- package/src/actions/fx-toggleboolean.js +38 -39
- package/src/actions/fx-unmodified.js +27 -0
- package/src/actions/fx-update.js +6 -6
- package/src/dep_graph.js +1 -1
- package/src/drawdown.js +23 -30
- package/src/events.js +19 -19
- package/src/fore.js +143 -125
- package/src/functions/common-function.js +24 -25
- package/src/functions/fx-function.js +6 -99
- package/src/functions/fx-functionlib.js +56 -0
- package/src/functions/registerFunction.js +112 -0
- package/src/fx-bind.js +19 -24
- package/src/fx-connection.js +226 -0
- package/src/fx-fore.js +844 -815
- package/src/fx-header.js +4 -4
- package/src/fx-instance.js +25 -29
- package/src/fx-model.js +405 -380
- package/src/fx-submission.js +399 -397
- package/src/fx-var.js +13 -12
- package/src/getInScopeContext.js +102 -89
- package/src/json-util.js +24 -24
- package/src/lab/fore-component.js +48 -52
- package/src/lab/instance-inspector.js +13 -16
- package/src/modelitem.js +48 -10
- package/src/relevance.js +12 -16
- package/src/tools/adi.js +858 -812
- package/src/tools/fx-action-log.js +377 -295
- package/src/tools/fx-devtools.js +210 -210
- package/src/tools/fx-dom-inspector.js +123 -122
- package/src/tools/fx-json-instance.js +262 -253
- package/src/tools/fx-log-item.js +6 -11
- package/src/tools/fx-log-settings.js +358 -301
- package/src/tools/fx-minimap.js +186 -177
- package/src/tools/helpers.js +1 -1
- package/src/ui/abstract-control.js +73 -53
- package/src/ui/fx-case.js +59 -7
- package/src/ui/fx-container.js +13 -14
- package/src/ui/fx-control.js +572 -538
- package/src/ui/fx-dialog.js +3 -3
- package/src/ui/fx-droptarget.js +3 -4
- package/src/ui/fx-group.js +4 -2
- package/src/ui/fx-hint.js +3 -0
- package/src/ui/fx-inspector.js +5 -5
- package/src/ui/fx-items.js +11 -11
- package/src/ui/fx-output.js +10 -12
- package/src/ui/fx-repeat-attributes.js +23 -27
- package/src/ui/fx-repeat.js +347 -344
- package/src/ui/fx-repeatitem.js +75 -68
- package/src/ui/fx-switch.js +39 -14
- package/src/ui/fx-trigger.js +4 -4
- package/src/withDraggability.js +193 -191
- package/src/xpath-evaluation.js +969 -958
- package/src/xpath-util.js +161 -134
package/src/actions/fx-action.js
CHANGED
|
@@ -41,12 +41,12 @@ export class FxAction extends AbstractAction {
|
|
|
41
41
|
script.src = this.src;
|
|
42
42
|
this.appendChild(script);
|
|
43
43
|
} else {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
for (const actionOrVar of children) {
|
|
45
|
+
if (actionOrVar.localName === 'fx-var') {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const action = actionOrVar;
|
|
49
|
+
action.detail = this.detail;
|
|
50
50
|
await action.execute();
|
|
51
51
|
}
|
|
52
52
|
this.dispatchActionPerformed();
|
package/src/actions/fx-append.js
CHANGED
package/src/actions/fx-call.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../fx-model.js';
|
|
2
|
-
import {AbstractAction} from './abstract-action.js';
|
|
3
|
-
import {evaluateXPath
|
|
4
|
-
import {Fore} from
|
|
5
|
-
import getInScopeContext from
|
|
6
|
-
import {XPathUtil} from
|
|
2
|
+
import { AbstractAction } from './abstract-action.js';
|
|
3
|
+
import { evaluateXPath } from '../xpath-evaluation.js';
|
|
4
|
+
import { Fore } from '../fore.js';
|
|
5
|
+
import getInScopeContext from '../getInScopeContext.js';
|
|
6
|
+
import { XPathUtil } from '../xpath-util.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* `fx-call`
|
|
@@ -11,73 +11,74 @@ import {XPathUtil} from "../xpath-util.js";
|
|
|
11
11
|
* @customElement
|
|
12
12
|
*/
|
|
13
13
|
export default class FxCall extends AbstractAction {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
constructor() {
|
|
27
|
-
super();
|
|
28
|
-
this.action = '';
|
|
29
|
-
this.fn = '';
|
|
30
|
-
}
|
|
14
|
+
static get properties() {
|
|
15
|
+
return {
|
|
16
|
+
...super.properties,
|
|
17
|
+
action: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
fn: {
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.action = this.getAttribute('action');
|
|
38
|
-
} else if(this.hasAttribute('function')){
|
|
39
|
-
this.fn = this.getAttribute('function');
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.action = '';
|
|
29
|
+
this.fn = '';
|
|
30
|
+
}
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
if (super.connectedCallback) {
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
}
|
|
36
|
+
if (this.hasAttribute('action')) {
|
|
37
|
+
this.action = this.getAttribute('action');
|
|
38
|
+
} else if (this.hasAttribute('function')) {
|
|
39
|
+
this.fn = this.getAttribute('function');
|
|
40
|
+
} else {
|
|
41
|
+
throw new Error('fx-call must specify an "action" or "function" attribute');
|
|
44
42
|
}
|
|
43
|
+
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
// execute function
|
|
52
|
-
if(this.fn){
|
|
53
|
-
this._callFunction();
|
|
54
|
-
}
|
|
45
|
+
async perform() {
|
|
46
|
+
super.perform();
|
|
47
|
+
if (this.action) {
|
|
48
|
+
await this._callAction();
|
|
55
49
|
}
|
|
50
|
+
// execute function
|
|
51
|
+
if (this.fn) {
|
|
52
|
+
this._callFunction();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
56
55
|
|
|
56
|
+
/**
|
|
57
|
+
* find action and execute it
|
|
58
|
+
*/
|
|
59
|
+
async _callAction() {
|
|
57
60
|
/**
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
61
|
+
* @type {import('./fx-action.js').FxAction}
|
|
62
|
+
*/
|
|
63
|
+
const action = document.querySelector(`#${this.action}`);
|
|
64
|
+
if (action) {
|
|
65
|
+
await action.perform();
|
|
66
|
+
} else {
|
|
67
|
+
Fore.dispatch(this, 'error', {
|
|
68
|
+
origin: this,
|
|
69
|
+
message: `Action '${this.action}' not found`,
|
|
70
|
+
expr: XPathUtil.getDocPath(this),
|
|
71
|
+
level: 'Error',
|
|
72
|
+
});
|
|
73
73
|
}
|
|
74
|
+
}
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
_callFunction() {
|
|
77
|
+
const inscope = getInScopeContext(this, 'instance()', this);
|
|
78
|
+
evaluateXPath(this.fn, inscope, this);
|
|
79
|
+
}
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
if (!customElements.get('fx-call')) {
|
|
82
|
-
|
|
83
|
+
window.customElements.define('fx-call', FxCall);
|
|
83
84
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {FxAction} from
|
|
1
|
+
import { FxAction } from './fx-action.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `fx-confirm`
|
|
@@ -8,18 +8,18 @@ import {FxAction} from "./fx-action.js";
|
|
|
8
8
|
* @demo demo/project.html
|
|
9
9
|
*/
|
|
10
10
|
export class FxConfirm extends FxAction {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
...FxAction.properties,
|
|
14
|
+
message: {
|
|
15
|
+
type: String,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
connectedCallback() {
|
|
21
|
-
if (super.connectedCallback){
|
|
22
|
-
|
|
21
|
+
if (super.connectedCallback) {
|
|
22
|
+
super.connectedCallback();
|
|
23
23
|
}
|
|
24
24
|
this.message = this.hasAttribute('message') ? this.getAttribute('message') : null;
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractAction } from './abstract-action.js';
|
|
2
|
-
import {FxAction} from
|
|
3
|
-
import {Fore} from
|
|
2
|
+
import { FxAction } from './fx-action.js';
|
|
3
|
+
import { Fore } from '../fore.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* `fx-action`
|
|
@@ -14,8 +14,8 @@ export class FxConstructDone extends FxAction {
|
|
|
14
14
|
// eslint-disable-next-line wc/guard-super-call
|
|
15
15
|
super.connectedCallback();
|
|
16
16
|
console.log('parentNode', this.parentNode);
|
|
17
|
-
if(this.parentNode.nodeName !== 'FX-MODEL'){
|
|
18
|
-
Fore.dispatch(this, 'error', {message:'parent is not a model'})
|
|
17
|
+
if (this.parentNode.nodeName !== 'FX-MODEL') {
|
|
18
|
+
Fore.dispatch(this, 'error', { message: 'parent is not a model' });
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
this.parentNode.addEventListener('model-construct-done', e => {
|
package/src/actions/fx-copy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../fx-model.js';
|
|
2
|
-
import {AbstractAction} from './abstract-action.js';
|
|
2
|
+
import { AbstractAction } from './abstract-action.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `fx-copy`
|
|
@@ -7,48 +7,48 @@ import {AbstractAction} from './abstract-action.js';
|
|
|
7
7
|
* @customElement
|
|
8
8
|
*/
|
|
9
9
|
export default class FxCopy extends AbstractAction {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
static get properties() {
|
|
11
|
+
return {
|
|
12
|
+
...super.properties,
|
|
13
|
+
ref: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
to: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.ref = '';
|
|
25
|
+
this.to = '';
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
if (super.connectedCallback) {
|
|
30
|
+
super.connectedCallback();
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
this.to = this.getAttribute('to');
|
|
33
|
+
if (this.hasAttribute('ref')) {
|
|
34
|
+
this.ref = this.getAttribute('ref');
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error('fx-copy must specify a "ref" attribute');
|
|
39
37
|
}
|
|
38
|
+
this.to = this.getAttribute('to');
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
perform() {
|
|
42
|
+
super.perform();
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
44
|
+
if (this.nodeset.nodeType === Node.ATTRIBUTE_NODE) {
|
|
45
|
+
navigator.clipboard.writeText(this.nodeset.nodeValue);
|
|
46
|
+
} else {
|
|
47
|
+
navigator.clipboard.writeText(this.nodeset);
|
|
49
48
|
}
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
/*
|
|
51
|
+
/*
|
|
52
52
|
setValue(modelItem, newVal) {
|
|
53
53
|
const item = modelItem;
|
|
54
54
|
if (!item) return;
|
|
@@ -63,5 +63,5 @@ export default class FxCopy extends AbstractAction {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
if (!customElements.get('fx-copy')) {
|
|
66
|
-
|
|
66
|
+
window.customElements.define('fx-copy', FxCopy);
|
|
67
67
|
}
|
package/src/actions/fx-delete.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as fx from
|
|
2
|
-
import {AbstractAction} from './abstract-action.js';
|
|
3
|
-
import {Fore} from '../fore.js';
|
|
4
|
-
import {evaluateXPathToNodes, evaluateXPathToString} from
|
|
5
|
-
import {XPathUtil} from
|
|
1
|
+
import * as fx from 'fontoxpath';
|
|
2
|
+
import { AbstractAction } from './abstract-action.js';
|
|
3
|
+
import { Fore } from '../fore.js';
|
|
4
|
+
import { evaluateXPathToNodes, evaluateXPathToString } from '../xpath-evaluation.js';
|
|
5
|
+
import { XPathUtil } from '../xpath-util.js';
|
|
6
6
|
import getInScopeContext from '../getInScopeContext.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -14,83 +14,81 @@ import getInScopeContext from '../getInScopeContext.js';
|
|
|
14
14
|
* @demo demo/todo.html
|
|
15
15
|
*/
|
|
16
16
|
class FxDelete extends AbstractAction {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
static get properties() {
|
|
18
|
+
return {
|
|
19
|
+
...super.properties,
|
|
20
|
+
ref: {
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* deletes nodes from instance data.
|
|
28
|
+
*
|
|
29
|
+
* Will NOT perform delete if nodeset is pointing to document node, document fragment, root node or being readonly.
|
|
30
|
+
*/
|
|
31
|
+
async perform() {
|
|
32
|
+
const inscopeContext = getInScopeContext(this.getAttributeNode('ref') || this, this.ref);
|
|
33
|
+
this.nodeset = evaluateXPathToNodes(this.ref, inscopeContext, this);
|
|
34
|
+
|
|
35
|
+
// console.log('delete nodeset ', this.nodeset);
|
|
36
|
+
|
|
37
|
+
const instanceId = XPathUtil.resolveInstance(this, this.ref);
|
|
38
|
+
const instance = this.getModel().getInstance(instanceId);
|
|
39
|
+
|
|
40
|
+
// const path = instance && this.nodeset.length !== 0 ? evaluateXPathToString('path()', this.nodeset[0], instance) : '';
|
|
41
|
+
|
|
42
|
+
const path = Fore.getDomNodeIndexString(this.nodeset);
|
|
43
|
+
|
|
44
|
+
const nodesToDelete = this.nodeset;
|
|
45
|
+
|
|
46
|
+
this.dispatchEvent(
|
|
47
|
+
new CustomEvent('execute-action', {
|
|
48
|
+
composed: true,
|
|
49
|
+
bubbles: true,
|
|
50
|
+
cancelable: true,
|
|
51
|
+
detail: { action: this, event: this.event, path },
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
let parent;
|
|
56
|
+
if (Array.isArray(nodesToDelete)) {
|
|
57
|
+
if (nodesToDelete.length === 0) return;
|
|
58
|
+
parent = nodesToDelete[0].parentNode;
|
|
59
|
+
nodesToDelete.forEach(item => {
|
|
60
|
+
this._deleteNode(parent, item);
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
parent = nodesToDelete.parentNode;
|
|
64
|
+
this._deleteNode(parent, nodesToDelete);
|
|
24
65
|
}
|
|
25
66
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
composed: true,
|
|
50
|
-
bubbles: true,
|
|
51
|
-
cancelable:true,
|
|
52
|
-
detail: { action: this, event:this.event, path:path},
|
|
53
|
-
}),
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
let parent;
|
|
57
|
-
if (Array.isArray(nodesToDelete)) {
|
|
58
|
-
if(nodesToDelete.length === 0) return;
|
|
59
|
-
parent = nodesToDelete[0].parentNode;
|
|
60
|
-
nodesToDelete.forEach(item => {
|
|
61
|
-
this._deleteNode(parent, item);
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
parent = nodesToDelete.parentNode;
|
|
65
|
-
this._deleteNode(parent, nodesToDelete);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
await Fore.dispatch(instance, 'deleted', {ref:path,deletedNodes:nodesToDelete});
|
|
70
|
-
this.needsUpdate = true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
_deleteNode(parent, node) {
|
|
74
|
-
if (parent.nodeType === Node.DOCUMENT_NODE) return;
|
|
75
|
-
if (node.nodeType === Node.DOCUMENT_NODE) return;
|
|
76
|
-
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) return;
|
|
77
|
-
if (node.parentNode === null) return;
|
|
78
|
-
|
|
79
|
-
const mi = this.getModelItem();
|
|
80
|
-
if (mi.readonly) return;
|
|
81
|
-
|
|
82
|
-
parent.removeChild(node);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* overwriting as we need to perform additional rebuild()
|
|
87
|
-
*/
|
|
88
|
-
actionPerformed() {
|
|
89
|
-
this.getModel().rebuild();
|
|
90
|
-
super.actionPerformed();
|
|
91
|
-
}
|
|
67
|
+
await Fore.dispatch(instance, 'deleted', { ref: path, deletedNodes: nodesToDelete });
|
|
68
|
+
this.needsUpdate = true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_deleteNode(parent, node) {
|
|
72
|
+
if (parent.nodeType === Node.DOCUMENT_NODE) return;
|
|
73
|
+
if (node.nodeType === Node.DOCUMENT_NODE) return;
|
|
74
|
+
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) return;
|
|
75
|
+
if (node.parentNode === null) return;
|
|
76
|
+
|
|
77
|
+
const mi = this.getModelItem();
|
|
78
|
+
if (mi.readonly) return;
|
|
79
|
+
|
|
80
|
+
parent.removeChild(node);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* overwriting as we need to perform additional rebuild()
|
|
85
|
+
*/
|
|
86
|
+
actionPerformed() {
|
|
87
|
+
this.getModel().rebuild();
|
|
88
|
+
super.actionPerformed();
|
|
89
|
+
}
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
if (!customElements.get('fx-delete')) {
|
|
95
|
-
|
|
93
|
+
window.customElements.define('fx-delete', FxDelete);
|
|
96
94
|
}
|
|
@@ -10,20 +10,20 @@ import { evaluateXPath, resolveId } from '../xpath-evaluation.js';
|
|
|
10
10
|
* can be accessed in usual JavaScript way.
|
|
11
11
|
*/
|
|
12
12
|
export class FxDispatch extends AbstractAction {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
...super.properties,
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
targetid: {
|
|
20
|
+
type: String,
|
|
21
|
+
},
|
|
22
|
+
details: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
27
|
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
package/src/actions/fx-hide.js
CHANGED
|
@@ -10,14 +10,14 @@ import { resolveId } from '../xpath-evaluation.js';
|
|
|
10
10
|
* @demo demo/project.html
|
|
11
11
|
*/
|
|
12
12
|
export class FxHide extends AbstractAction {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
...super.properties,
|
|
16
|
+
dialog: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
21
|
|
|
22
22
|
connectedCallback() {
|
|
23
23
|
super.connectedCallback();
|
|
@@ -29,17 +29,17 @@ export class FxHide extends AbstractAction {
|
|
|
29
29
|
|
|
30
30
|
async perform() {
|
|
31
31
|
this.dispatchEvent(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
new CustomEvent('execute-action', {
|
|
33
|
+
composed: true,
|
|
34
|
+
bubbles: true,
|
|
35
|
+
cancelable: true,
|
|
36
|
+
detail: { action: this, event: this.event },
|
|
37
|
+
}),
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
const dialog = resolveId(this.dialog, this);
|
|
41
41
|
dialog.hide();
|
|
42
|
-
Fore.dispatch(dialog,'dialog-hidden',{})
|
|
42
|
+
Fore.dispatch(dialog, 'dialog-hidden', {});
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
package/src/actions/fx-insert.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
evaluateXPathToFirstNode,
|
|
6
6
|
evaluateXPathToNumber,
|
|
7
7
|
} from '../xpath-evaluation.js';
|
|
8
|
-
import {XPathUtil} from
|
|
9
|
-
import {Fore} from '../fore.js';
|
|
8
|
+
import { XPathUtil } from '../xpath-util';
|
|
9
|
+
import { Fore } from '../fore.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* `fx-insert`
|
|
@@ -60,7 +60,7 @@ export class FxInsert extends AbstractAction {
|
|
|
60
60
|
this.keepValues = !!this.hasAttribute('keep-values');
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
_getOriginSequence(inscope, targetSequence){
|
|
63
|
+
_getOriginSequence(inscope, targetSequence) {
|
|
64
64
|
let originSequence;
|
|
65
65
|
if (this.origin) {
|
|
66
66
|
// ### if there's an origin attribute use it
|
|
@@ -143,7 +143,7 @@ export class FxInsert extends AbstractAction {
|
|
|
143
143
|
inscopeContext,
|
|
144
144
|
this.getOwnerForm(),
|
|
145
145
|
);
|
|
146
|
-
|
|
146
|
+
inscope = inscopeContext;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if (this.hasAttribute('ref')) {
|
|
@@ -171,7 +171,6 @@ export class FxInsert extends AbstractAction {
|
|
|
171
171
|
insertLocationNode = inscope;
|
|
172
172
|
inscope.appendChild(originSequenceClone);
|
|
173
173
|
index = 1;
|
|
174
|
-
|
|
175
174
|
}
|
|
176
175
|
} else {
|
|
177
176
|
/* ### insert at position given by 'at' or use the last item in the targetSequence ### */
|
|
@@ -238,22 +237,20 @@ export class FxInsert extends AbstractAction {
|
|
|
238
237
|
// const xpath = XPathUtil.getPath(originSequenceClone.parentNode, instanceId);
|
|
239
238
|
const xpath = XPathUtil.getPath(insertLocationNode.parentNode, instanceId);
|
|
240
239
|
|
|
241
|
-
|
|
242
|
-
|
|
243
240
|
const path = Fore.getDomNodeIndexString(originSequenceClone);
|
|
244
241
|
this.dispatchEvent(
|
|
245
242
|
new CustomEvent('execute-action', {
|
|
246
243
|
composed: true,
|
|
247
244
|
bubbles: true,
|
|
248
|
-
cancelable:true,
|
|
249
|
-
detail: { action: this, event:this.event, path },
|
|
245
|
+
cancelable: true,
|
|
246
|
+
detail: { action: this, event: this.event, path },
|
|
250
247
|
}),
|
|
251
248
|
);
|
|
252
249
|
|
|
253
|
-
Fore.dispatch(inst,'insert',{
|
|
250
|
+
Fore.dispatch(inst, 'insert', {
|
|
254
251
|
'inserted-nodes': originSequenceClone,
|
|
255
252
|
'insert-location-node': insertLocationNode,
|
|
256
|
-
|
|
253
|
+
position: this.position,
|
|
257
254
|
});
|
|
258
255
|
|
|
259
256
|
// todo: this actually should dispatch to respective instance
|
|
@@ -270,7 +267,7 @@ export class FxInsert extends AbstractAction {
|
|
|
270
267
|
);
|
|
271
268
|
|
|
272
269
|
this.needsUpdate = true;
|
|
273
|
-
console.log('Changed!', xpath)
|
|
270
|
+
console.log('Changed!', xpath);
|
|
274
271
|
return [xpath];
|
|
275
272
|
}
|
|
276
273
|
|