@jinntec/fore 2.2.0 → 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 +1 -1
- 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 +3 -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 +4 -6
- package/src/functions/fx-functionlib.js +39 -42
- package/src/functions/registerFunction.js +95 -86
- package/src/fx-bind.js +19 -24
- package/src/fx-connection.js +226 -0
- package/src/fx-fore.js +846 -815
- package/src/fx-header.js +4 -4
- package/src/fx-instance.js +23 -27
- package/src/fx-model.js +405 -383
- package/src/fx-submission.js +399 -397
- package/src/fx-var.js +6 -5
- 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 +74 -56
- 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 -959
- package/src/xpath-util.js +161 -134
package/src/ui/fx-repeatitem.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {Fore} from '../fore.js';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {withDraggability} from "../withDraggability.js";
|
|
1
|
+
import { Fore } from '../fore.js';
|
|
2
|
+
import ForeElementMixin from '../ForeElementMixin.js';
|
|
3
|
+
import { withDraggability } from '../withDraggability.js';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* `fx-repeat`
|
|
@@ -10,62 +9,59 @@ import {withDraggability} from "../withDraggability.js";
|
|
|
10
9
|
* @customElement
|
|
11
10
|
* @demo demo/index.html
|
|
12
11
|
*/
|
|
13
|
-
export class FxRepeatitem extends withDraggability(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
this.inited = false;
|
|
12
|
+
export class FxRepeatitem extends withDraggability(ForeElementMixin, true) {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
inited: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.inited = false;
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
this.addEventListener('click', this._dispatchIndexChange);
|
|
26
|
+
// this.addEventListener('focusin', this._handleFocus);
|
|
27
|
+
this.addEventListener('focusin', this._dispatchIndexChange);
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
this.attachShadow({ mode: 'open', delegatesFocus: true });
|
|
33
30
|
|
|
34
|
-
|
|
31
|
+
this.dropTarget = null;
|
|
32
|
+
}
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
this.display = this.style.display;
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
const html = `
|
|
41
39
|
<slot></slot>
|
|
42
40
|
`;
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
this.shadowRoot.innerHTML = `
|
|
45
43
|
${html}
|
|
46
44
|
`;
|
|
47
|
-
|
|
45
|
+
this.getOwnerForm().registerLazyElement(this);
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.tabindex = 0;
|
|
52
|
-
|
|
53
|
-
}
|
|
47
|
+
this.ref = `${this.parentNode.ref}`;
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.removeEventListener('click', this._dispatchIndexChange);
|
|
58
|
-
this.removeEventListener('focusin', this._handleFocus);
|
|
59
|
-
}
|
|
49
|
+
this.tabindex = 0;
|
|
50
|
+
}
|
|
60
51
|
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
super.disconnectedCallback();
|
|
54
|
+
this.removeEventListener('click', this._dispatchIndexChange);
|
|
55
|
+
this.removeEventListener('focusin', this._handleFocus);
|
|
56
|
+
}
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
init() {
|
|
59
|
+
// console.log('repeatitem init model ', this.nodeset);
|
|
60
|
+
// this._initializeChildren(this);
|
|
61
|
+
this.inited = true;
|
|
62
|
+
}
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
/*
|
|
69
65
|
getModelItem() {
|
|
70
66
|
super.getModelItem();
|
|
71
67
|
// console.log('modelItem in repeatitem ', this.getModelItem()[this.index]);
|
|
@@ -73,32 +69,43 @@ export class FxRepeatitem extends withDraggability(foreElementMixin(HTMLElement)
|
|
|
73
69
|
}
|
|
74
70
|
*/
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
_dispatchIndexChange() {
|
|
73
|
+
/**
|
|
74
|
+
* @type {import('./fx-repeat.js').FxRepeat}
|
|
75
|
+
*/
|
|
76
|
+
const repeat = this.parentNode;
|
|
77
|
+
if (repeat.index === this.index) {
|
|
78
|
+
// The index did not really change if it did not change :wink:
|
|
79
|
+
return;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
this.dispatchEvent(
|
|
82
|
+
new CustomEvent('item-changed', {
|
|
83
|
+
composed: false,
|
|
84
|
+
bubbles: true,
|
|
85
|
+
detail: { item: this, index: this.index },
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
refresh(force) {
|
|
91
|
+
this.modelItem = this.getModelItem();
|
|
92
|
+
// ### register ourselves as boundControl
|
|
93
|
+
if (!this.modelItem.boundControls.includes(this)) {
|
|
94
|
+
this.modelItem.boundControls.push(this);
|
|
95
|
+
|
|
96
|
+
if (this.modelItem && !this.modelItem.relevant) {
|
|
97
|
+
this.removeAttribute('relevant');
|
|
98
|
+
this.setAttribute('nonrelevant', '');
|
|
99
|
+
} else {
|
|
100
|
+
this.removeAttribute('nonrelevant');
|
|
101
|
+
this.setAttribute('relevant', '');
|
|
102
|
+
}
|
|
99
103
|
}
|
|
104
|
+
// Always recurse for these refreshes, especially when forced
|
|
105
|
+
Fore.refreshChildren(this, force);
|
|
106
|
+
}
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
if (!customElements.get('fx-repeatitem')) {
|
|
103
|
-
|
|
104
|
-
}
|
|
110
|
+
window.customElements.define('fx-repeatitem', FxRepeatitem);
|
|
111
|
+
}
|
package/src/ui/fx-switch.js
CHANGED
|
@@ -41,41 +41,41 @@ class FxSwitch extends FxContainer {
|
|
|
41
41
|
${html}
|
|
42
42
|
`;
|
|
43
43
|
this.cases = [];
|
|
44
|
-
this.formerCase=null;
|
|
44
|
+
this.formerCase = null;
|
|
45
45
|
this.selectedCase = null;
|
|
46
|
-
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
async refresh(force) {
|
|
50
49
|
super.refresh(force);
|
|
51
50
|
// console.log('refresh on switch ');
|
|
52
|
-
if(this.cases.length === 0){
|
|
51
|
+
if (this.cases.length === 0) {
|
|
53
52
|
this.cases = Array.from(this.querySelectorAll(':scope > fx-case'));
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
if (this.isBound()) {
|
|
57
56
|
this._handleBoundSwitch();
|
|
58
57
|
}
|
|
59
|
-
if(!this.selectedCase){
|
|
58
|
+
if (!this.selectedCase) {
|
|
60
59
|
this.selectedCase = this.cases[0]; // first is always default
|
|
61
60
|
this.toggle(this.selectedCase);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
Fore.refreshChildren(this.selectedCase,force);
|
|
63
|
+
Fore.refreshChildren(this.selectedCase, force);
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
_dispatchEvents(){
|
|
68
|
-
if(this.
|
|
69
|
-
|
|
66
|
+
_dispatchEvents() {
|
|
67
|
+
if(this.selectedCase === this.formerCase) return;
|
|
68
|
+
if (this.formerCase && this.formerCase !== this.selectedCase) {
|
|
69
|
+
Fore.dispatch(this.formerCase, 'deselect', {});
|
|
70
70
|
}
|
|
71
|
-
if(this.selectedCase.classList.contains('selected-case')){
|
|
72
|
-
Fore.dispatch(this.selectedCase,'select',{});
|
|
71
|
+
if (this.selectedCase.classList.contains('selected-case')) {
|
|
72
|
+
Fore.dispatch(this.selectedCase, 'select', {});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
_resetVisited(){
|
|
76
|
+
_resetVisited() {
|
|
77
77
|
const visited = this.selectedCase.querySelectorAll('.visited');
|
|
78
|
-
Array.from(visited).forEach(v =>{
|
|
78
|
+
Array.from(visited).forEach(v => {
|
|
79
79
|
v.classList.remove('visited');
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -93,11 +93,35 @@ class FxSwitch extends FxContainer {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Replace an old case with a new case element.
|
|
98
|
+
*
|
|
99
|
+
* @param {import('./fx-case.js').FxCase} oldCase
|
|
100
|
+
* @param {import('./fx-case.js').FxCase} newCase
|
|
101
|
+
*/
|
|
102
|
+
async replaceCase(oldCase, newCase) {
|
|
103
|
+
this.cases.splice(this.cases.indexOf(oldCase), 1, newCase);
|
|
104
|
+
|
|
105
|
+
if (oldCase === this.selectedCase) {
|
|
106
|
+
this.selectedCase = newCase;
|
|
107
|
+
this.formerCase = newCase;
|
|
108
|
+
newCase.classList.add('selected-case');
|
|
109
|
+
newCase.classList.remove('deselected-case');
|
|
110
|
+
newCase.inert = false;
|
|
111
|
+
// Tell the owner form we might have new template expressions here
|
|
112
|
+
this.getOwnerForm().scanForNewTemplateExpressionsNextRefresh();
|
|
113
|
+
} else {
|
|
114
|
+
newCase.classList.add('deselected-case');
|
|
115
|
+
newCase.classList.remove('selected-case');
|
|
116
|
+
newCase.inert = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
96
120
|
/**
|
|
97
121
|
* Activates a fx-case element by switching CSS classes.
|
|
98
122
|
* Dispatches 'select' and 'deselect' events as appropriate.
|
|
99
123
|
*
|
|
100
|
-
* @param caseElement the fx-case element to activate
|
|
124
|
+
* @param {import('./fx-case.js').FxCase} caseElement the fx-case element to activate
|
|
101
125
|
*/
|
|
102
126
|
toggle(caseElement) {
|
|
103
127
|
this.selectedCase = caseElement;
|
|
@@ -114,7 +138,7 @@ class FxSwitch extends FxContainer {
|
|
|
114
138
|
}
|
|
115
139
|
});
|
|
116
140
|
|
|
117
|
-
if(this.selectedCase !== caseElement){
|
|
141
|
+
if (this.selectedCase !== caseElement) {
|
|
118
142
|
this.selectedCase = caseElement;
|
|
119
143
|
}
|
|
120
144
|
this._dispatchEvents();
|
|
@@ -122,6 +146,7 @@ class FxSwitch extends FxContainer {
|
|
|
122
146
|
|
|
123
147
|
// Tell the owner form we might have new template expressions here
|
|
124
148
|
this.getOwnerForm().scanForNewTemplateExpressionsNextRefresh();
|
|
149
|
+
this.getOwnerForm().getModel().updateModel();
|
|
125
150
|
}
|
|
126
151
|
}
|
|
127
152
|
|
package/src/ui/fx-trigger.js
CHANGED
|
@@ -23,10 +23,10 @@ export class FxTrigger extends XfAbstractControl {
|
|
|
23
23
|
const slot = this.shadowRoot.querySelector('slot');
|
|
24
24
|
slot.addEventListener('slotchange', () => {
|
|
25
25
|
const elements = slot.assignedElements({ flatten: true });
|
|
26
|
-
if(!elements[0].getAttribute('tabindex')){
|
|
26
|
+
if (!elements[0].getAttribute('tabindex')) {
|
|
27
27
|
elements[0].setAttribute('tabindex', '0');
|
|
28
28
|
}
|
|
29
|
-
if(elements[0].nodeName !== 'BUTTON'){
|
|
29
|
+
if (elements[0].nodeName !== 'BUTTON') {
|
|
30
30
|
elements[0].setAttribute('role', 'button');
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ export class FxTrigger extends XfAbstractControl {
|
|
|
34
34
|
|
|
35
35
|
this.addEventListener('mousedown', e => {
|
|
36
36
|
console.log('target', e.target.nodeName);
|
|
37
|
-
|
|
37
|
+
e.target.focus();
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
if (this.debounceDelay) {
|
|
@@ -108,7 +108,7 @@ export class FxTrigger extends XfAbstractControl {
|
|
|
108
108
|
// We are handling the event. Stop it from going further
|
|
109
109
|
e.preventDefault();
|
|
110
110
|
e.stopPropagation();
|
|
111
|
-
if(e.type && child.event && e.type !== child.event) return;
|
|
111
|
+
if (e.type && child.event && e.type !== child.event) return;
|
|
112
112
|
}
|
|
113
113
|
// eslint-disable-next-line no-await-in-loop
|
|
114
114
|
await child.execute(e);
|