@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.
- 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
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {XPathUtil} from
|
|
2
|
-
import
|
|
3
|
-
import {FxLogSettings} from './fx-log-settings.js';
|
|
4
|
-
|
|
1
|
+
import { XPathUtil } from '../xpath-util';
|
|
2
|
+
import './fx-log-item.js';
|
|
3
|
+
import { FxLogSettings } from './fx-log-settings.js';
|
|
5
4
|
|
|
6
5
|
export class FxActionLog extends HTMLElement {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.attachShadow({ mode: 'open' });
|
|
9
|
+
this.listenTo = [];
|
|
10
|
+
this.listeners = [];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
const style = `
|
|
16
15
|
:host {
|
|
17
16
|
display:block;
|
|
18
17
|
position:relative;
|
|
@@ -211,19 +210,19 @@ export class FxActionLog extends HTMLElement {
|
|
|
211
210
|
}
|
|
212
211
|
`;
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
if (localStorage.getItem('fx-action-log-filters')) {
|
|
214
|
+
this.listenTo = JSON.parse(localStorage.getItem('fx-action-log-filters'));
|
|
215
|
+
} else {
|
|
216
|
+
this.listenTo = FxLogSettings.defaultSettings();
|
|
217
|
+
}
|
|
219
218
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
219
|
+
if (localStorage.getItem('fx-log-settings')) {
|
|
220
|
+
this.listenTo = JSON.parse(localStorage.getItem('fx-log-settings'));
|
|
221
|
+
} else {
|
|
222
|
+
this.listenTo = FxLogSettings.defaultSettings();
|
|
223
|
+
}
|
|
225
224
|
|
|
226
|
-
|
|
225
|
+
const html = `
|
|
227
226
|
<section open class="outer-details">
|
|
228
227
|
<header>Log
|
|
229
228
|
<span class="buttons">
|
|
@@ -236,34 +235,34 @@ export class FxActionLog extends HTMLElement {
|
|
|
236
235
|
</section>
|
|
237
236
|
`;
|
|
238
237
|
|
|
239
|
-
|
|
238
|
+
this.shadowRoot.innerHTML = `
|
|
240
239
|
<style>
|
|
241
240
|
${style}
|
|
242
241
|
</style>
|
|
243
242
|
${html}
|
|
244
243
|
`;
|
|
245
244
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
});
|
|
258
|
-
}
|
|
245
|
+
const fore = window.document.querySelector('fx-fore');
|
|
246
|
+
if (!fore) {
|
|
247
|
+
console.error('fx-fore element not found in this page.');
|
|
248
|
+
}
|
|
249
|
+
const log = this.shadowRoot.querySelector('#log');
|
|
250
|
+
// fore.classList.add('action-log');
|
|
251
|
+
|
|
252
|
+
this.listenTo.forEach(eventName => {
|
|
253
|
+
if (eventName.show) {
|
|
254
|
+
document.addEventListener(eventName.name, e => {
|
|
255
|
+
this._log(e, log);
|
|
259
256
|
});
|
|
257
|
+
}
|
|
258
|
+
});
|
|
260
259
|
|
|
261
|
-
|
|
260
|
+
// const boxes = this.shadowRoot.querySelector('.boxes');
|
|
262
261
|
|
|
263
|
-
|
|
262
|
+
/*
|
|
264
263
|
build the list of checkboxes for the filtering settings
|
|
265
264
|
*/
|
|
266
|
-
|
|
265
|
+
/*
|
|
267
266
|
this.listenTo.forEach(item => {
|
|
268
267
|
const wrapper = document.createElement('span');
|
|
269
268
|
boxes.append(wrapper);
|
|
@@ -301,184 +300,245 @@ export class FxActionLog extends HTMLElement {
|
|
|
301
300
|
});
|
|
302
301
|
*/
|
|
303
302
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
303
|
+
document.addEventListener(
|
|
304
|
+
'outermost-action-start',
|
|
305
|
+
e => {
|
|
306
|
+
this.outermost = true;
|
|
307
|
+
},
|
|
308
|
+
{ capture: true },
|
|
309
|
+
);
|
|
310
|
+
document.addEventListener(
|
|
311
|
+
'outermost-action-end',
|
|
312
|
+
e => {
|
|
313
|
+
this.outermost = false;
|
|
314
|
+
this.outermostAppender = null;
|
|
315
|
+
},
|
|
316
|
+
{ capture: true },
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
// buttons
|
|
320
|
+
const del = this.shadowRoot.querySelector('#del');
|
|
321
|
+
del.addEventListener('click', e => {
|
|
322
|
+
this.shadowRoot.querySelector('#log').innerHTML = '';
|
|
323
|
+
});
|
|
324
|
+
document.addEventListener('keydown', event => {
|
|
325
|
+
if (event.ctrlKey && event.key === 'd') {
|
|
326
|
+
this.shadowRoot.querySelector('#log').innerHTML = '';
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
_defaultSettings() {
|
|
332
|
+
this.listenTo = [
|
|
333
|
+
{
|
|
334
|
+
name: 'action-performed',
|
|
335
|
+
show: false,
|
|
336
|
+
description: 'fires after an action has been performed',
|
|
337
|
+
},
|
|
338
|
+
{ name: 'click', show: false, description: '' },
|
|
339
|
+
{
|
|
340
|
+
name: 'deleted',
|
|
341
|
+
show: false,
|
|
342
|
+
description: 'fires after a delete action has been executed',
|
|
343
|
+
},
|
|
344
|
+
{ name: 'deselect', show: false, description: 'fires when fx-case is deselected' },
|
|
345
|
+
{ name: 'dialog-hidden', show: false, description: 'fires after fx-dialog has been hidden' },
|
|
346
|
+
{ name: 'dialog-shown', show: false, description: 'fired when a dialog has been shown' },
|
|
347
|
+
{ name: 'error', show: false, description: 'fires after an error occurred' },
|
|
348
|
+
{ name: 'execute-action', show: true, description: 'fires when an action executes' },
|
|
349
|
+
{ name: 'init', show: false, description: 'fires when a control initializes' },
|
|
350
|
+
{ name: 'index-changed', show: false, description: 'fires when the repeat index changes' },
|
|
351
|
+
{ name: 'insert', show: false, description: 'fires when an fx-insert is executed' },
|
|
352
|
+
{
|
|
353
|
+
name: 'instance-loaded',
|
|
354
|
+
show: false,
|
|
355
|
+
description: 'fires after an fx-instance has been loaded',
|
|
356
|
+
},
|
|
357
|
+
{ name: 'invalid', show: false, description: 'fires after a control became invalid' },
|
|
358
|
+
{ name: 'item-changed', show: false, description: 'fires when a repeat item was changed' },
|
|
359
|
+
{ name: 'item-created', show: false, description: 'fires when a repeat item was created' },
|
|
360
|
+
{ name: 'loaded', show: false, description: 'fires after a fx-load has loaded' },
|
|
361
|
+
{ name: 'model-construct', show: false, description: 'fires when a model gets constructed' },
|
|
362
|
+
{
|
|
363
|
+
name: 'model-construct-done',
|
|
364
|
+
show: false,
|
|
365
|
+
description: 'fires after model initialization',
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: 'nonrelevant',
|
|
369
|
+
show: false,
|
|
370
|
+
description: 'fires after an fx-control became nonrelevant',
|
|
371
|
+
},
|
|
372
|
+
{ name: 'optional', show: false, description: 'fires after an fx-control became optional' },
|
|
373
|
+
{
|
|
374
|
+
name: 'outermost-action-end',
|
|
375
|
+
show: false,
|
|
376
|
+
description: 'fires when an outermost action block is finished',
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: 'outermost-action-start',
|
|
380
|
+
show: false,
|
|
381
|
+
description: 'fires when an outermost action block is started',
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: 'path-mutated',
|
|
385
|
+
show: false,
|
|
386
|
+
description: 'fires when a path in a repeat has been mutated',
|
|
387
|
+
},
|
|
388
|
+
{ name: 'readonly', show: false, description: 'fires after an fx-control became readonly' },
|
|
389
|
+
{ name: 'readwrite', show: false, description: 'fires after an fx-control became readwrite' },
|
|
390
|
+
{
|
|
391
|
+
name: 'ready',
|
|
392
|
+
show: false,
|
|
393
|
+
description: 'fires after a fx-fore page has been completely initialized',
|
|
394
|
+
},
|
|
395
|
+
{ name: 'rebuild-done', show: false, description: 'fires after a rebuild has taken place' },
|
|
396
|
+
{
|
|
397
|
+
name: 'recalculate-done',
|
|
398
|
+
show: false,
|
|
399
|
+
description: 'fires after a recalculate has taken place',
|
|
400
|
+
},
|
|
401
|
+
{ name: 'refresh-done', show: false, description: 'fires after a refresh has been done' },
|
|
402
|
+
{
|
|
403
|
+
name: 'relevant',
|
|
404
|
+
show: false,
|
|
405
|
+
description: 'fires after a fx-control has become relevant',
|
|
406
|
+
},
|
|
407
|
+
{ name: 'reload', show: false, description: 'fires when a fx-reload action executes' },
|
|
408
|
+
{
|
|
409
|
+
name: 'required',
|
|
410
|
+
show: false,
|
|
411
|
+
description: 'fires after an fx-control has become required',
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: 'return',
|
|
415
|
+
show: false,
|
|
416
|
+
description: 'fired by embedded Fore controls to return their bound value',
|
|
417
|
+
},
|
|
418
|
+
{ name: 'select', show: false, description: 'fires when an fx-case has been selected' },
|
|
419
|
+
{ name: 'submit', show: false, description: 'fires before a submission takes place' },
|
|
420
|
+
{
|
|
421
|
+
name: 'submit-done',
|
|
422
|
+
show: false,
|
|
423
|
+
description: 'fires after a submission has successfully been executed',
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: 'submit-error',
|
|
427
|
+
show: false,
|
|
428
|
+
description: 'fires when a submission returned an error',
|
|
429
|
+
},
|
|
430
|
+
{ name: 'valid', show: false, description: 'fires after a fx-control has become valid' },
|
|
431
|
+
{
|
|
432
|
+
name: 'value-changed',
|
|
433
|
+
show: false,
|
|
434
|
+
description: 'fires after a fx-control has changed its value',
|
|
435
|
+
},
|
|
436
|
+
];
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
_log(e, log) {
|
|
440
|
+
const elementName = e.target.nodeName;
|
|
441
|
+
if (elementName === 'FX-ACTION-LOG') return;
|
|
442
|
+
// e.preventDefault();
|
|
443
|
+
// e.stopPropagation();
|
|
444
|
+
|
|
445
|
+
const row = document.createElement('div');
|
|
446
|
+
row.classList.add('log-row');
|
|
447
|
+
const logRow = this._logDetails(e);
|
|
448
|
+
if (
|
|
449
|
+
e.detail &&
|
|
450
|
+
Object.keys(e.detail).length === 0 &&
|
|
451
|
+
Object.getPrototypeOf(e.detail) === Object.prototype
|
|
452
|
+
) {
|
|
453
|
+
row.classList.add('no-detail');
|
|
374
454
|
}
|
|
375
455
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
// e.preventDefault();
|
|
380
|
-
// e.stopPropagation();
|
|
381
|
-
|
|
382
|
-
const row = document.createElement('div');
|
|
383
|
-
row.classList.add('log-row');
|
|
384
|
-
const logRow = this._logDetails(e);
|
|
385
|
-
if (e.detail &&
|
|
386
|
-
Object.keys(e.detail).length === 0 &&
|
|
387
|
-
Object.getPrototypeOf(e.detail) === Object.prototype) {
|
|
388
|
-
row.classList.add('no-detail');
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
row.innerHTML = logRow;
|
|
392
|
-
if (this.outermost) {
|
|
393
|
-
/*
|
|
456
|
+
row.innerHTML = logRow;
|
|
457
|
+
if (this.outermost) {
|
|
458
|
+
/*
|
|
394
459
|
outermost-action-start and outermost-action-end are use as marker events only to start/end a list.
|
|
395
460
|
They don't have aditional information to log.
|
|
396
461
|
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if (this.parentPath && elementName !== 'FX-ACTION') {
|
|
411
|
-
row.classList.add('nested');
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const targetElement = e.target;
|
|
415
|
-
row.addEventListener('click', (ev) => {
|
|
416
|
-
// console.log('clicked inspect item', targetElement);
|
|
417
|
-
// console.log('clicked inspect item', ev.target.getAttribute('xpath'));
|
|
418
|
-
|
|
419
|
-
this._highlight(targetElement);
|
|
420
|
-
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const logRowTarget = row.querySelector('.event-target');
|
|
425
|
-
if (!logRowTarget) return;
|
|
426
|
-
|
|
427
|
-
logRowTarget.addEventListener('click', e => {
|
|
428
|
-
const alreadyLogged = document.querySelectorAll('.fx-action-log-debug');
|
|
429
|
-
alreadyLogged.forEach(logged => {
|
|
430
|
-
logged.classList.remove('fx-action-log-debug')
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
targetElement.dispatchEvent(
|
|
434
|
-
new CustomEvent('log-action', {
|
|
435
|
-
composed: false,
|
|
436
|
-
bubbles: true,
|
|
437
|
-
cancelable: true,
|
|
438
|
-
detail: {target: targetElement},
|
|
439
|
-
}),
|
|
440
|
-
);
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
targetElement.classList.add('fx-action-log-debug');
|
|
444
|
-
targetElement.setAttribute('data-name', targetElement.nodeName)
|
|
445
|
-
this._highlight(targetElement);
|
|
462
|
+
if (e.type === 'outermost-action-start') return; // we don't want this event to actualy log something
|
|
463
|
+
if (!this.outermostAppender) {
|
|
464
|
+
this.outermostAppender = document.createElement('ul');
|
|
465
|
+
log.append(this.outermostAppender);
|
|
466
|
+
}
|
|
467
|
+
const li = document.createElement('li');
|
|
468
|
+
// li.innerHTML = logRow;
|
|
469
|
+
li.append(row);
|
|
470
|
+
this.outermostAppender.append(li);
|
|
471
|
+
} else {
|
|
472
|
+
log.append(row);
|
|
473
|
+
}
|
|
446
474
|
|
|
447
|
-
|
|
448
|
-
|
|
475
|
+
if (this.parentPath && elementName !== 'FX-ACTION') {
|
|
476
|
+
row.classList.add('nested');
|
|
449
477
|
}
|
|
450
478
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
479
|
+
const targetElement = e.target;
|
|
480
|
+
row.addEventListener('click', ev => {
|
|
481
|
+
// console.log('clicked inspect item', targetElement);
|
|
482
|
+
// console.log('clicked inspect item', ev.target.getAttribute('xpath'));
|
|
483
|
+
|
|
484
|
+
this._highlight(targetElement);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
const logRowTarget = row.querySelector('.event-target');
|
|
488
|
+
if (!logRowTarget) return;
|
|
489
|
+
|
|
490
|
+
logRowTarget.addEventListener('click', e => {
|
|
491
|
+
const alreadyLogged = document.querySelectorAll('.fx-action-log-debug');
|
|
492
|
+
alreadyLogged.forEach(logged => {
|
|
493
|
+
logged.classList.remove('fx-action-log-debug');
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
targetElement.dispatchEvent(
|
|
497
|
+
new CustomEvent('log-action', {
|
|
498
|
+
composed: false,
|
|
499
|
+
bubbles: true,
|
|
500
|
+
cancelable: true,
|
|
501
|
+
detail: { target: targetElement },
|
|
502
|
+
}),
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
targetElement.classList.add('fx-action-log-debug');
|
|
506
|
+
targetElement.setAttribute('data-name', targetElement.nodeName);
|
|
507
|
+
this._highlight(targetElement);
|
|
508
|
+
});
|
|
509
|
+
// log.append(logElements);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* logs all configured events.
|
|
514
|
+
* Special treatment is given to action-execute event to log out all actions that
|
|
515
|
+
* are triggered.
|
|
516
|
+
*
|
|
517
|
+
* @param e the event to log
|
|
518
|
+
* @returns {string}
|
|
519
|
+
* @private
|
|
520
|
+
*/
|
|
521
|
+
_logDetails(e) {
|
|
522
|
+
const eventType = e.type;
|
|
523
|
+
const path = XPathUtil.getDocPath(e.target);
|
|
524
|
+
// console.log('>>>> _logDetails', path);
|
|
525
|
+
const cut = path.substring(path.indexOf('/fx-fore'), path.length);
|
|
526
|
+
const xpath = `/${cut}`;
|
|
527
|
+
const short = cut.replaceAll('fx-', '');
|
|
528
|
+
|
|
529
|
+
if (this.parentPath && !xpath.startsWith(this.parentPath)) {
|
|
530
|
+
this.parentPath = null;
|
|
531
|
+
}
|
|
532
|
+
switch (eventType) {
|
|
533
|
+
case 'deleted':
|
|
534
|
+
const { deletedNodes } = e.detail;
|
|
535
|
+
const s = new XMLSerializer();
|
|
536
|
+
let serialized = '';
|
|
537
|
+
deletedNodes.forEach(node => {
|
|
538
|
+
serialized += s.serializeToString(node);
|
|
539
|
+
});
|
|
480
540
|
|
|
481
|
-
|
|
541
|
+
return `
|
|
482
542
|
<fx-log-item event-name="${eventType}"
|
|
483
543
|
xpath="${xpath}"
|
|
484
544
|
short-info="${e.detail.ref}"
|
|
@@ -492,20 +552,20 @@ export class FxActionLog extends HTMLElement {
|
|
|
492
552
|
</section>
|
|
493
553
|
</fx-log-item>
|
|
494
554
|
`;
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
555
|
+
break;
|
|
556
|
+
case 'outermost-action-start':
|
|
557
|
+
return 'start';
|
|
558
|
+
break;
|
|
559
|
+
case 'outermost-action-end':
|
|
560
|
+
return '';
|
|
561
|
+
break;
|
|
562
|
+
case 'execute-action':
|
|
563
|
+
// ##### here actions will be handled
|
|
564
|
+
const actionElement = e.detail.action;
|
|
565
|
+
return this._renderAction(actionElement, xpath, short, e);
|
|
566
|
+
break;
|
|
567
|
+
default:
|
|
568
|
+
return `
|
|
509
569
|
<fx-log-item event-name="${eventType}"
|
|
510
570
|
xpath="${xpath}"
|
|
511
571
|
short-name="${e.target.nodeName.toLowerCase()}">
|
|
@@ -515,20 +575,24 @@ export class FxActionLog extends HTMLElement {
|
|
|
515
575
|
</section>
|
|
516
576
|
</fx-log-item>
|
|
517
577
|
`;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// }
|
|
521
578
|
}
|
|
522
579
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
580
|
+
// }
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
_renderAction(actionElement, xpath, short, e) {
|
|
584
|
+
const stripped = actionElement.nodeName.split('-')[1];
|
|
585
|
+
let eventName;
|
|
586
|
+
switch (actionElement.nodeName) {
|
|
587
|
+
case 'FX-ACTION':
|
|
588
|
+
this.parentPath = xpath;
|
|
589
|
+
eventName = e.target.currentEvent
|
|
590
|
+
? e.target.currentEvent.type
|
|
591
|
+
: e.detail.event
|
|
592
|
+
? e.detail.event
|
|
593
|
+
: '';
|
|
594
|
+
|
|
595
|
+
return `
|
|
532
596
|
<fx-log-item event-name="${eventName}"
|
|
533
597
|
xpath="${xpath}"
|
|
534
598
|
short-name="ACTION"
|
|
@@ -537,18 +601,22 @@ export class FxActionLog extends HTMLElement {
|
|
|
537
601
|
<section class="details">
|
|
538
602
|
<header>Attributes</header>
|
|
539
603
|
<section>
|
|
540
|
-
${Array.from(actionElement.attributes)
|
|
604
|
+
${Array.from(actionElement.attributes)
|
|
605
|
+
.map(
|
|
606
|
+
item => `
|
|
541
607
|
<span class="key">${item.nodeName}</span>
|
|
542
608
|
<span class="value">${item.nodeValue}</span>
|
|
543
|
-
|
|
609
|
+
`,
|
|
610
|
+
)
|
|
611
|
+
.join('')}
|
|
544
612
|
</section>
|
|
545
613
|
</section>
|
|
546
614
|
</fx-log-item>
|
|
547
615
|
`;
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
616
|
+
// break;
|
|
617
|
+
case 'FX-MESSAGE':
|
|
618
|
+
const message = e.detail.action.messageTextContent;
|
|
619
|
+
return `
|
|
552
620
|
<fx-log-item event-name="${e.detail.event}"
|
|
553
621
|
xpath="${xpath}"
|
|
554
622
|
short-name="MESSAGE"
|
|
@@ -558,11 +626,11 @@ export class FxActionLog extends HTMLElement {
|
|
|
558
626
|
</section>
|
|
559
627
|
</fx-log-item>
|
|
560
628
|
`;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
629
|
+
// break;
|
|
630
|
+
case 'FX-SEND':
|
|
631
|
+
const submission = document.querySelector(`#${e.detail.action.getAttribute('submission')}`);
|
|
632
|
+
const event = e.detail.event ? e.detail.event : '';
|
|
633
|
+
return `
|
|
566
634
|
<fx-log-item short-name="SEND"
|
|
567
635
|
short-info="${submission.getAttribute('id')}"
|
|
568
636
|
event-name="${event}"
|
|
@@ -571,19 +639,28 @@ export class FxActionLog extends HTMLElement {
|
|
|
571
639
|
<section class="details">
|
|
572
640
|
<header>Submission</header>
|
|
573
641
|
<section class="attributes">
|
|
574
|
-
${Array.from(submission.attributes)
|
|
642
|
+
${Array.from(submission.attributes)
|
|
643
|
+
.map(
|
|
644
|
+
item => `
|
|
575
645
|
<span class="key">${item.nodeName}</span>
|
|
576
646
|
<span class="value">${item.nodeValue}</span>
|
|
577
|
-
|
|
647
|
+
`,
|
|
648
|
+
)
|
|
649
|
+
.join('')}
|
|
578
650
|
</section>
|
|
579
651
|
</section>
|
|
580
652
|
</fx-log-item>
|
|
581
653
|
`;
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
654
|
+
// break;
|
|
655
|
+
case 'FX-SETVALUE':
|
|
656
|
+
const instPath = XPathUtil.getPath(e.target.nodeset);
|
|
657
|
+
const listensOn =
|
|
658
|
+
e.target.nodeName === 'FX-CONTROL'
|
|
659
|
+
? e.target.updateEvent
|
|
660
|
+
: e.detail.event
|
|
661
|
+
? e.detail.event
|
|
662
|
+
: '';
|
|
663
|
+
return `
|
|
587
664
|
<fx-log-item short-name="SETVALUE"
|
|
588
665
|
short-info="${instPath}"
|
|
589
666
|
event-name="${listensOn}"
|
|
@@ -595,10 +672,14 @@ export class FxActionLog extends HTMLElement {
|
|
|
595
672
|
</section>
|
|
596
673
|
</fx-log-item>
|
|
597
674
|
`;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
675
|
+
// break;
|
|
676
|
+
default:
|
|
677
|
+
eventName = e.target.currentEvent
|
|
678
|
+
? e.target.currentEvent.type
|
|
679
|
+
: e.detail.event
|
|
680
|
+
? e.detail.event
|
|
681
|
+
: '';
|
|
682
|
+
return `
|
|
602
683
|
<fx-log-item event-name="${eventName}"
|
|
603
684
|
short-name="${e.target.nodeName}"
|
|
604
685
|
xpath="${xpath}"
|
|
@@ -608,24 +689,25 @@ export class FxActionLog extends HTMLElement {
|
|
|
608
689
|
</section>
|
|
609
690
|
</fx-log-item>
|
|
610
691
|
`;
|
|
611
|
-
}
|
|
612
692
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
_listEventDetails(e) {
|
|
696
|
+
if (
|
|
697
|
+
e.detail &&
|
|
698
|
+
Object.keys(e.detail).length === 0 &&
|
|
699
|
+
Object.getPrototypeOf(e.detail) === Object.prototype
|
|
700
|
+
) {
|
|
701
|
+
return '';
|
|
622
702
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
703
|
+
return `${Object.keys(e.detail).map(item => `<span>${item}</span>`)}`;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
_listAttributes(e) {
|
|
707
|
+
// console.log('_listAttributes', e)
|
|
708
|
+
return '';
|
|
709
|
+
// return `${e.detail.model.id}`;
|
|
710
|
+
/*
|
|
629
711
|
if(e.detail &&
|
|
630
712
|
Object.keys(e.detail).length === 0 &&
|
|
631
713
|
Object.getPrototypeOf(e.detail) === Object.prototype){
|
|
@@ -634,28 +716,28 @@ export class FxActionLog extends HTMLElement {
|
|
|
634
716
|
return `${e.detail.map((item) => `<span>${item}</span>`)}`;
|
|
635
717
|
}
|
|
636
718
|
*/
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
_highlight(element) {
|
|
722
|
+
const defaultBG = element.style.backgroundColor;
|
|
723
|
+
const defaultTransition = element.style.transition;
|
|
724
|
+
|
|
725
|
+
element.style.transition = 'background 1s';
|
|
726
|
+
element.style.backgroundColor = '#FFA500';
|
|
727
|
+
|
|
728
|
+
setTimeout(() => {
|
|
729
|
+
element.style.backgroundColor = defaultBG;
|
|
730
|
+
setTimeout(() => {
|
|
731
|
+
element.style.transition = defaultTransition;
|
|
732
|
+
}, 400);
|
|
733
|
+
}, 400);
|
|
734
|
+
|
|
735
|
+
window.document.dispatchEvent(
|
|
736
|
+
new CustomEvent('log-active-element', { detail: { target: element } }),
|
|
737
|
+
);
|
|
738
|
+
}
|
|
657
739
|
}
|
|
658
740
|
|
|
659
741
|
if (!customElements.get('fx-action-log')) {
|
|
660
|
-
|
|
742
|
+
customElements.define('fx-action-log', FxActionLog);
|
|
661
743
|
}
|