@jinntec/fore 1.0.0-1 → 1.0.0-4
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 +20 -1
- package/dist/fore-all.js +10 -10
- package/dist/fore-debug.js +140 -0
- package/index.js +8 -0
- package/package.json +7 -6
- package/resources/{vars.css → fore-styles.css} +292 -0
- package/src/DependencyNotifyingDomFacade.js +9 -1
- package/src/ForeElementMixin.js +25 -17
- package/src/actions/abstract-action.js +8 -7
- package/src/actions/fx-action.js +6 -1
- package/src/actions/fx-dispatch.js +10 -2
- package/src/actions/fx-hide.js +23 -0
- package/src/actions/fx-insert.js +9 -9
- package/src/actions/fx-send.js +1 -1
- package/src/actions/fx-setvalue.js +2 -4
- package/src/actions/fx-show.js +23 -0
- package/src/dep_graph.js +9 -0
- package/src/drawdown.js +172 -0
- package/src/fore.js +56 -3
- package/src/fx-bind.js +20 -17
- package/src/fx-fore.js +297 -33
- package/src/fx-instance.js +27 -6
- package/src/fx-model.js +182 -37
- package/src/fx-submission.js +29 -7
- package/src/fx-var.js +43 -0
- package/src/getInScopeContext.js +28 -7
- package/src/modelitem.js +1 -0
- package/src/ui/abstract-control.js +17 -4
- package/src/ui/fx-alert.js +16 -20
- package/src/ui/fx-container.js +9 -4
- package/src/ui/fx-control.js +76 -39
- package/src/ui/fx-dialog.js +68 -0
- package/src/ui/fx-inspector.js +44 -0
- package/src/ui/fx-items.js +120 -0
- package/src/ui/fx-output.js +50 -12
- package/src/ui/fx-repeat.js +83 -16
- package/src/ui/fx-repeatitem.js +11 -4
- package/src/ui/fx-trigger.js +3 -0
- package/src/xpath-evaluation.js +372 -135
- package/src/xpath-util.js +52 -12
- package/dist/fore.js +0 -2
- package/resources/fore.css +0 -86
- package/resources/toastify.css +0 -87
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import './src/fx-instance.js';
|
|
|
5
5
|
import './src/fx-model.js';
|
|
6
6
|
import './src/fx-submission.js';
|
|
7
7
|
import './src/fx-header.js';
|
|
8
|
+
import './src/fx-var.js';
|
|
8
9
|
|
|
9
10
|
// ui classes
|
|
10
11
|
import './src/ui/fx-alert.js';
|
|
@@ -17,6 +18,11 @@ import './src/ui/fx-repeat.js';
|
|
|
17
18
|
import './src/ui/fx-switch.js';
|
|
18
19
|
import './src/ui/fx-trigger.js';
|
|
19
20
|
import './src/ui/fx-case.js';
|
|
21
|
+
import './src/ui/fx-inspector.js';
|
|
22
|
+
import './src/ui/fx-dialog.js';
|
|
23
|
+
import './src/ui/fx-items.js';
|
|
24
|
+
|
|
25
|
+
// import './src/ui/fx-checkbox-group.js';
|
|
20
26
|
|
|
21
27
|
// action classes
|
|
22
28
|
import './src/actions/fx-append.js';
|
|
@@ -30,5 +36,7 @@ import './src/actions/fx-dispatch.js';
|
|
|
30
36
|
import './src/actions/fx-update.js';
|
|
31
37
|
import './src/actions/fx-refresh.js';
|
|
32
38
|
import './src/actions/fx-confirm.js';
|
|
39
|
+
import './src/actions/fx-show.js';
|
|
40
|
+
import './src/actions/fx-hide.js';
|
|
33
41
|
|
|
34
42
|
import './src/functions/fx-function.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jinntec/fore",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-4",
|
|
4
4
|
"description": "Fore - Forms for the Web",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,12 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"index.js",
|
|
22
|
-
"resources/fore.css",
|
|
23
|
-
"resources/vars.css",
|
|
24
|
-
"resources/toastify.css",
|
|
22
|
+
"resources/fore-styles.css",
|
|
25
23
|
"src/**/*",
|
|
26
|
-
"dist/fore.js",
|
|
27
|
-
"dist/fore-
|
|
24
|
+
"dist/fore-all.js",
|
|
25
|
+
"dist/fore-debug.js"
|
|
28
26
|
],
|
|
29
27
|
"dependencies": {
|
|
30
28
|
"@jinntec/jinn-toast": "^1.0.2",
|
|
@@ -32,6 +30,8 @@
|
|
|
32
30
|
"@polymer/iron-demo-helpers": "^3.1.0",
|
|
33
31
|
"@polymer/paper-button": "^3.0.1",
|
|
34
32
|
"@polymer/paper-checkbox": "^3.1.0",
|
|
33
|
+
"@polymer/paper-dialog": "^3.0.1",
|
|
34
|
+
"@polymer/paper-dialog-scrollable": "^3.0.1",
|
|
35
35
|
"@polymer/paper-input": "^3.2.1",
|
|
36
36
|
"fontoxpath": "^3.20.4",
|
|
37
37
|
"web-component-analyzer": "^1.1.6"
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"es-dev-server": "^1.57.8",
|
|
55
55
|
"eslint": "^6.1.0",
|
|
56
56
|
"husky": "^1.0.0",
|
|
57
|
+
"jsdoc": "^3.6.7",
|
|
57
58
|
"lint-staged": "^8.0.0",
|
|
58
59
|
"lit-html": "^1.1.2",
|
|
59
60
|
"mocha": "^7.0.1",
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/* Material Design color palette for Google products */
|
|
2
|
+
/* Material Design color palette for Google products */
|
|
3
|
+
/* Material Design color palette for Google products */
|
|
4
|
+
/* Material Design color palette for Google products */
|
|
5
|
+
|
|
2
6
|
html {
|
|
7
|
+
|
|
8
|
+
--inspector-bg:var(--paper-grey-500);
|
|
9
|
+
--inspector-pre-bg:var(--paper-grey-100);
|
|
10
|
+
--inspector-color:var(--paper-grey-800);
|
|
11
|
+
--inspector-instance-height:200px;
|
|
12
|
+
|
|
3
13
|
--google-red-100: #f4c7c3;
|
|
4
14
|
--google-red-300: #e67c73;
|
|
5
15
|
--google-red-500: #db4437;
|
|
@@ -318,3 +328,285 @@ html {
|
|
|
318
328
|
--model-element-margin:10px;
|
|
319
329
|
}
|
|
320
330
|
|
|
331
|
+
/*!
|
|
332
|
+
* Toastify js 1.11.0
|
|
333
|
+
* https://github.com/apvarun/toastify-js
|
|
334
|
+
* @license MIT licensed
|
|
335
|
+
*
|
|
336
|
+
* Copyright (C) 2018 Varun A P
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
.toastify {
|
|
340
|
+
padding: 12px 20px;
|
|
341
|
+
color: #ffffff;
|
|
342
|
+
display: inline-block;
|
|
343
|
+
box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
|
|
344
|
+
background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
|
|
345
|
+
background: linear-gradient(135deg, #f8f8f9, #cfcfcf);
|
|
346
|
+
position: fixed;
|
|
347
|
+
opacity: 0;
|
|
348
|
+
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
349
|
+
border-radius: 2px;
|
|
350
|
+
cursor: pointer;
|
|
351
|
+
text-decoration: none;
|
|
352
|
+
max-width: calc(50% - 20px);
|
|
353
|
+
z-index: 2147483647;
|
|
354
|
+
font-weight: 300;
|
|
355
|
+
color:black;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.toastify.on {
|
|
359
|
+
opacity: 1;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.toast-close {
|
|
363
|
+
opacity: 0.8;
|
|
364
|
+
padding: 0 5px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.toastify-right {
|
|
368
|
+
right: 15px;
|
|
369
|
+
}
|
|
370
|
+
.toastify-right .toast-close {
|
|
371
|
+
margin-right:-10px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.toastify-left {
|
|
375
|
+
left: 15px;
|
|
376
|
+
}
|
|
377
|
+
.toastify-left .toast-close{
|
|
378
|
+
margin-left:-10px;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.toastify-top {
|
|
382
|
+
top: -150px;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.toastify-bottom {
|
|
386
|
+
bottom: -150px;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.toastify-rounded {
|
|
390
|
+
border-radius: 25px;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.toastify-avatar {
|
|
394
|
+
width: 1.5em;
|
|
395
|
+
height: 1.5em;
|
|
396
|
+
margin: -7px 5px;
|
|
397
|
+
border-radius: 2px;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.toastify-center {
|
|
401
|
+
margin-left: auto;
|
|
402
|
+
margin-right: auto;
|
|
403
|
+
left: 0;
|
|
404
|
+
right: 0;
|
|
405
|
+
max-width: fit-content;
|
|
406
|
+
max-width: -moz-fit-content;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
@media only screen and (max-width: 360px) {
|
|
410
|
+
.toastify-right, .toastify-left {
|
|
411
|
+
margin-left: auto;
|
|
412
|
+
margin-right: auto;
|
|
413
|
+
left: 0;
|
|
414
|
+
right: 0;
|
|
415
|
+
max-width: fit-content;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/*!
|
|
420
|
+
* Fore js 1.0.0-2
|
|
421
|
+
* @license MIT licensed
|
|
422
|
+
*
|
|
423
|
+
* Copyright (C) 2012 Joern Turner
|
|
424
|
+
*/
|
|
425
|
+
|
|
426
|
+
[unresolved]{
|
|
427
|
+
display: none;
|
|
428
|
+
}
|
|
429
|
+
[disabled] {
|
|
430
|
+
pointer-events: none;
|
|
431
|
+
cursor: default;
|
|
432
|
+
}
|
|
433
|
+
[refresh-on-view]{
|
|
434
|
+
/*opacity: 0;*/
|
|
435
|
+
}
|
|
436
|
+
[required]:after {
|
|
437
|
+
content: "*";
|
|
438
|
+
display: inline;
|
|
439
|
+
color: red;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.error{
|
|
443
|
+
background: var(--paper-red-500);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
fx-alert{
|
|
447
|
+
color:darkred;
|
|
448
|
+
font-size: 0.9rem;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
fx-control, fx-trigger{
|
|
452
|
+
white-space: nowrap;
|
|
453
|
+
position: relative;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.fx-checkbox{
|
|
457
|
+
white-space: nowrap;
|
|
458
|
+
}
|
|
459
|
+
fx-dialog{
|
|
460
|
+
display: none;
|
|
461
|
+
}
|
|
462
|
+
fx-dialog.show{
|
|
463
|
+
display: block;
|
|
464
|
+
min-height: 200px;
|
|
465
|
+
border-radius: 0.5rem;
|
|
466
|
+
/*opacity: 0.3;*/
|
|
467
|
+
background:rgba(0,0,0,0.5);
|
|
468
|
+
z-index: 10;
|
|
469
|
+
}
|
|
470
|
+
fx-dialog.show .dialog-content{
|
|
471
|
+
padding: 1rem;
|
|
472
|
+
width:fit-content;
|
|
473
|
+
height:fit-content;
|
|
474
|
+
border:thin solid;
|
|
475
|
+
border-radius: 0.3rem;
|
|
476
|
+
position: absolute;
|
|
477
|
+
left:50%;
|
|
478
|
+
top:50%;
|
|
479
|
+
transform:translateX(-50%) translateY(-50%);
|
|
480
|
+
background: white;
|
|
481
|
+
|
|
482
|
+
}
|
|
483
|
+
fx-dialog a.close-dialog{
|
|
484
|
+
position: absolute;
|
|
485
|
+
right: 0.4rem;
|
|
486
|
+
top:0.2rem;
|
|
487
|
+
color:var(--paper-grey-900);
|
|
488
|
+
text-decoration: none;
|
|
489
|
+
font-size:1.2rem;
|
|
490
|
+
}
|
|
491
|
+
fx-dialog .action{
|
|
492
|
+
width: 100%;
|
|
493
|
+
text-align: center;
|
|
494
|
+
display: block;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
fx-hint{
|
|
498
|
+
display: none;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/* fx-inspector styles */
|
|
502
|
+
fx-inspector{
|
|
503
|
+
position:fixed;
|
|
504
|
+
left:0;
|
|
505
|
+
right:0;
|
|
506
|
+
bottom:0;
|
|
507
|
+
width: 100%;
|
|
508
|
+
background: var(--inspector-bg);
|
|
509
|
+
color: white;
|
|
510
|
+
max-height: 33%;
|
|
511
|
+
overflow: scroll;
|
|
512
|
+
border-top:3px solid black;
|
|
513
|
+
opacity: 0.9;
|
|
514
|
+
}
|
|
515
|
+
fx-inspector::before{
|
|
516
|
+
content:'Instance Inspector';
|
|
517
|
+
font-style:italic;
|
|
518
|
+
position:absolute;
|
|
519
|
+
top:0;
|
|
520
|
+
right: 0.3rem;
|
|
521
|
+
z-index: 10;
|
|
522
|
+
font-size: 0.8rem;
|
|
523
|
+
}
|
|
524
|
+
fx-inspector details{
|
|
525
|
+
padding: 1rem;
|
|
526
|
+
}
|
|
527
|
+
fx-inspector pre{
|
|
528
|
+
background: var(--inspector-pre-bg);
|
|
529
|
+
border-radius: 0.5rem;
|
|
530
|
+
padding: 0.3rem;
|
|
531
|
+
max-height: var(--inspector-instance-height);
|
|
532
|
+
/*overflow: scroll;*/
|
|
533
|
+
}
|
|
534
|
+
fx-inspector details{
|
|
535
|
+
overflow: auto;
|
|
536
|
+
margin:0;
|
|
537
|
+
}
|
|
538
|
+
fx-inspector summary{
|
|
539
|
+
padding: 0;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
fx-model, fx-model *, fx-model ::slotted(fx-instance), fx-instance{
|
|
543
|
+
display:none;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
fx-trigger a[disabled] {
|
|
547
|
+
color:lightgrey;
|
|
548
|
+
}
|
|
549
|
+
fx-trigger img[disabled]{
|
|
550
|
+
filter:blur(2px);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
fx-repeatitem{
|
|
554
|
+
position:relative;
|
|
555
|
+
/*
|
|
556
|
+
opacity:1;
|
|
557
|
+
-webkit-transition: opacity 3s;
|
|
558
|
+
-moz-transition: opacity 3s;
|
|
559
|
+
transition: opacity 3s;
|
|
560
|
+
*/
|
|
561
|
+
}
|
|
562
|
+
.hidden {
|
|
563
|
+
visibility: hidden;
|
|
564
|
+
opacity: 0;
|
|
565
|
+
transition: visibility 0s 2s, opacity 2s linear;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.loaded{
|
|
569
|
+
animation: fadein 0.3s forwards;
|
|
570
|
+
}
|
|
571
|
+
/* avoid flicker from nested lazily loaded elements */
|
|
572
|
+
.loaded .loaded{
|
|
573
|
+
animation: none;
|
|
574
|
+
opacity: 1;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.logtree details{
|
|
578
|
+
padding:0.1rem 1rem;
|
|
579
|
+
margin:0;
|
|
580
|
+
}
|
|
581
|
+
.logtree details summary{
|
|
582
|
+
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.non-relevant{
|
|
586
|
+
opacity: 0;
|
|
587
|
+
height: 0;
|
|
588
|
+
transition: opacity 1s;
|
|
589
|
+
}
|
|
590
|
+
.required:after {
|
|
591
|
+
content: '*';
|
|
592
|
+
color: red;
|
|
593
|
+
padding-left: 4px;
|
|
594
|
+
right:3px;
|
|
595
|
+
top:3px;
|
|
596
|
+
z-index: 1;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.vertical label{
|
|
600
|
+
display: block;
|
|
601
|
+
}
|
|
602
|
+
@keyframes fadein {
|
|
603
|
+
0% {
|
|
604
|
+
opacity:0;
|
|
605
|
+
}
|
|
606
|
+
100% {
|
|
607
|
+
opacity:1;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
@@ -9,7 +9,7 @@ import { getBucketsForNode } from 'fontoxpath';
|
|
|
9
9
|
*/
|
|
10
10
|
export class DependencyNotifyingDomFacade {
|
|
11
11
|
/**
|
|
12
|
-
* @param
|
|
12
|
+
* @param onNodeTouched - onNodeTouched A function what will be executed whenever a node is 'touched' by the XPath
|
|
13
13
|
*/
|
|
14
14
|
constructor(onNodeTouched) {
|
|
15
15
|
this._onNodeTouched = onNodeTouched;
|
|
@@ -45,13 +45,21 @@ export class DependencyNotifyingDomFacade {
|
|
|
45
45
|
* @param bucket - The bucket that matches the attribute that will be used.
|
|
46
46
|
*/
|
|
47
47
|
// eslint-disable-next-line class-methods-use-this
|
|
48
|
+
/*
|
|
48
49
|
getChildNodes(node, bucket) {
|
|
49
50
|
const matchingNodes = Array.from(node.childNodes).filter(
|
|
50
51
|
childNode => !bucket || getBucketsForNode(childNode).includes(bucket),
|
|
51
52
|
);
|
|
52
53
|
return matchingNodes;
|
|
53
54
|
}
|
|
55
|
+
*/
|
|
54
56
|
|
|
57
|
+
getChildNodes(node, bucket) {
|
|
58
|
+
const matchingNodes = Array.from(node.childNodes).filter(
|
|
59
|
+
childNode => !bucket || getBucketsForNode(childNode).includes(bucket));
|
|
60
|
+
matchingNodes.forEach(matchingNode => this._onNodeTouched(matchingNode));
|
|
61
|
+
return matchingNodes;
|
|
62
|
+
}
|
|
55
63
|
/**
|
|
56
64
|
* Get the data of this node.
|
|
57
65
|
*
|
package/src/ForeElementMixin.js
CHANGED
|
@@ -23,12 +23,6 @@ export const foreElementMixin = superclass =>
|
|
|
23
23
|
model: {
|
|
24
24
|
type: Object,
|
|
25
25
|
},
|
|
26
|
-
/**
|
|
27
|
-
* XPath binding expression pointing to bound node
|
|
28
|
-
*/
|
|
29
|
-
ref: {
|
|
30
|
-
type: String,
|
|
31
|
-
},
|
|
32
26
|
/**
|
|
33
27
|
* The modelitem object associated to the bound node holding the evaluated state.
|
|
34
28
|
*/
|
|
@@ -41,6 +35,15 @@ export const foreElementMixin = superclass =>
|
|
|
41
35
|
nodeset: {
|
|
42
36
|
type: Object,
|
|
43
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* XPath binding expression pointing to bound node
|
|
40
|
+
*/
|
|
41
|
+
ref: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
inScopeVariables: {
|
|
45
|
+
type: Map,
|
|
46
|
+
},
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -50,6 +53,7 @@ export const foreElementMixin = superclass =>
|
|
|
50
53
|
this.model = null;
|
|
51
54
|
this.modelItem = {};
|
|
52
55
|
this.ref = this.hasAttribute('ref') ? this.getAttribute('ref') : '';
|
|
56
|
+
this.inScopeVariables = null;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
getModel() {
|
|
@@ -90,7 +94,7 @@ export const foreElementMixin = superclass =>
|
|
|
90
94
|
*/
|
|
91
95
|
evalInContext() {
|
|
92
96
|
// const inscopeContext = this.getInScopeContext();
|
|
93
|
-
const inscopeContext = getInScopeContext(this, this.ref);
|
|
97
|
+
const inscopeContext = getInScopeContext(this.getAttributeNode('ref') || this, this.ref);
|
|
94
98
|
if (!inscopeContext) {
|
|
95
99
|
console.warn('no in scopeContext for ', this);
|
|
96
100
|
return;
|
|
@@ -98,26 +102,26 @@ export const foreElementMixin = superclass =>
|
|
|
98
102
|
if (this.ref === '') {
|
|
99
103
|
this.nodeset = inscopeContext;
|
|
100
104
|
} else if (Array.isArray(inscopeContext)) {
|
|
105
|
+
/*
|
|
101
106
|
inscopeContext.forEach(n => {
|
|
102
107
|
if (XPathUtil.isSelfReference(this.ref)) {
|
|
103
108
|
this.nodeset = inscopeContext;
|
|
104
109
|
} else {
|
|
105
|
-
const localResult = evaluateXPathToFirstNode(this.ref, n,
|
|
110
|
+
const localResult = evaluateXPathToFirstNode(this.ref, n, this);
|
|
106
111
|
// console.log('local result: ', localResult);
|
|
107
112
|
this.nodeset.push(localResult);
|
|
108
113
|
}
|
|
109
114
|
});
|
|
115
|
+
*/
|
|
116
|
+
this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext[0], this);
|
|
110
117
|
} else {
|
|
111
118
|
// this.nodeset = fx.evaluateXPathToFirstNode(this.ref, inscopeContext, null, {namespaceResolver: this.namespaceResolver});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (inscopeContext.nodeType) {
|
|
116
|
-
this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext, formElement);
|
|
119
|
+
const { nodeType } = inscopeContext;
|
|
120
|
+
if (nodeType) {
|
|
121
|
+
this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext, this);
|
|
117
122
|
} else {
|
|
118
|
-
this.nodeset = evaluateXPath(this.ref, inscopeContext,
|
|
123
|
+
this.nodeset = evaluateXPath(this.ref, inscopeContext, this);
|
|
119
124
|
}
|
|
120
|
-
// this.nodeset = evaluateXPath(this.ref,inscopeContext,formElement)
|
|
121
125
|
}
|
|
122
126
|
// console.log('UiElement evaluated to nodeset: ', this.nodeset);
|
|
123
127
|
}
|
|
@@ -217,7 +221,11 @@ export const foreElementMixin = superclass =>
|
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
getInScopeContext() {
|
|
220
|
-
return getInScopeContext(this, this.ref);
|
|
224
|
+
return getInScopeContext(this.getAttributeNode('ref') || this, this.ref);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
setInScopeVariables(inScopeVariables) {
|
|
228
|
+
this.inScopeVariables = inScopeVariables;
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
dispatch(eventName, detail) {
|
|
@@ -226,7 +234,7 @@ export const foreElementMixin = superclass =>
|
|
|
226
234
|
bubbles: true,
|
|
227
235
|
detail,
|
|
228
236
|
});
|
|
229
|
-
console.log('firing', event);
|
|
237
|
+
// console.log('firing', event);
|
|
230
238
|
this.dispatchEvent(event);
|
|
231
239
|
}
|
|
232
240
|
};
|
|
@@ -81,7 +81,9 @@ export class AbstractAction extends foreElementMixin(HTMLElement) {
|
|
|
81
81
|
|
|
82
82
|
this.target = this.getAttribute('target');
|
|
83
83
|
if (this.target) {
|
|
84
|
-
if (this.target === '#
|
|
84
|
+
if (this.target === '#window') {
|
|
85
|
+
window.addEventListener(this.event, e => this.execute(e));
|
|
86
|
+
} else if (this.target === '#document') {
|
|
85
87
|
document.addEventListener(this.event, e => this.execute(e));
|
|
86
88
|
} else {
|
|
87
89
|
this.targetElement = document.getElementById(this.target);
|
|
@@ -122,7 +124,7 @@ export class AbstractAction extends foreElementMixin(HTMLElement) {
|
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
// First check if 'if' condition is true - otherwise exist right away
|
|
125
|
-
if (this.ifExpr && !evaluateXPathToBoolean(this.ifExpr, this.nodeset, this
|
|
127
|
+
if (this.ifExpr && !evaluateXPathToBoolean(this.ifExpr, this.nodeset, this)) {
|
|
126
128
|
return;
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -137,7 +139,7 @@ export class AbstractAction extends foreElementMixin(HTMLElement) {
|
|
|
137
139
|
return;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
if (!evaluateXPathToBoolean(this.whileExpr, this.nodeset, this
|
|
142
|
+
if (!evaluateXPathToBoolean(this.whileExpr, this.nodeset, this)) {
|
|
141
143
|
// Done with iterating
|
|
142
144
|
return;
|
|
143
145
|
}
|
|
@@ -190,15 +192,14 @@ export class AbstractAction extends foreElementMixin(HTMLElement) {
|
|
|
190
192
|
const model = this.getModel();
|
|
191
193
|
model.recalculate();
|
|
192
194
|
model.revalidate();
|
|
193
|
-
model.parentNode.refresh();
|
|
194
|
-
this.
|
|
195
|
+
model.parentNode.refresh(true);
|
|
196
|
+
this.dispatchActionPerformed();
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
/**
|
|
199
|
-
* @private
|
|
200
201
|
*/
|
|
201
|
-
|
|
202
|
+
dispatchActionPerformed() {
|
|
202
203
|
console.log('action-performed ', this);
|
|
203
204
|
this.dispatchEvent(
|
|
204
205
|
new CustomEvent('action-performed', { composed: true, bubbles: true, detail: {} }),
|
package/src/actions/fx-action.js
CHANGED
|
@@ -41,11 +41,16 @@ export class FxAction extends AbstractAction {
|
|
|
41
41
|
script.src = this.src;
|
|
42
42
|
this.appendChild(script);
|
|
43
43
|
} else {
|
|
44
|
-
Array.from(children).forEach(
|
|
44
|
+
Array.from(children).forEach(actionOrVar => {
|
|
45
|
+
if (actionOrVar.localName === 'fx-var') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const action = actionOrVar;
|
|
45
49
|
action.detail = this.detail;
|
|
46
50
|
// action.perform();
|
|
47
51
|
action.execute();
|
|
48
52
|
});
|
|
53
|
+
this.dispatchActionPerformed();
|
|
49
54
|
// this.needsUpdate = false;
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractAction } from './abstract-action.js';
|
|
2
|
-
import { evaluateXPath } from '../xpath-evaluation.js';
|
|
2
|
+
import { evaluateXPath, resolveId } from '../xpath-evaluation.js';
|
|
3
|
+
import { XPathUtil } from '../xpath-util.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* `fx-dispatch`
|
|
@@ -89,7 +90,14 @@ export class FxDispatch extends AbstractAction {
|
|
|
89
90
|
|
|
90
91
|
// ### when targetid is given dispatch to that if present (throw an error if not) - otherwise dispatch to document
|
|
91
92
|
if (this.targetid) {
|
|
92
|
-
const target = document.getElementById(this.targetid);
|
|
93
|
+
// const target = document.getElementById(this.targetid);
|
|
94
|
+
let target;
|
|
95
|
+
if (XPathUtil.isRepeated(this)) {
|
|
96
|
+
target = resolveId(this.targetid, this.parentNode, null);
|
|
97
|
+
} else {
|
|
98
|
+
target = document.getElementById(this.targetid);
|
|
99
|
+
}
|
|
100
|
+
console.log('target', target);
|
|
93
101
|
if (!target) {
|
|
94
102
|
throw new Error(`targetid ${this.targetid} does not exist in document`);
|
|
95
103
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FxAction } from './fx-action.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `fx-hide`
|
|
5
|
+
* hides a dialog
|
|
6
|
+
*
|
|
7
|
+
* @customElement
|
|
8
|
+
* @demo demo/project.html
|
|
9
|
+
*/
|
|
10
|
+
export class FxHide extends FxAction {
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
this.dialog = this.getAttribute('dialog');
|
|
13
|
+
if(!this.dialog){
|
|
14
|
+
this.dispatch('error',{message:'dialog does not exist'})
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
perform() {
|
|
19
|
+
document.getElementById(this.dialog).hide();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
window.customElements.define('fx-hide', FxHide);
|
package/src/actions/fx-insert.js
CHANGED
|
@@ -77,7 +77,7 @@ export class FxInsert extends AbstractAction {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
perform() {
|
|
80
|
-
super.perform();
|
|
80
|
+
// super.perform();
|
|
81
81
|
|
|
82
82
|
/*
|
|
83
83
|
todo: !!! calling super here does not correctly give the nodeset - it's likely still a bug in ForeElementMixin !!!
|
|
@@ -86,11 +86,11 @@ export class FxInsert extends AbstractAction {
|
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
88
|
// ### obtaining targetSequence
|
|
89
|
-
const inscope = getInScopeContext(this, this.ref);
|
|
89
|
+
const inscope = getInScopeContext(this.getAttributeNode('ref'), this.ref);
|
|
90
90
|
|
|
91
91
|
// @ts-ignore
|
|
92
92
|
const targetSequence = evaluateXPathToNodes(this.ref, inscope, this.getOwnerForm());
|
|
93
|
-
console.log('insert nodeset ', targetSequence);
|
|
93
|
+
// console.log('insert nodeset ', targetSequence);
|
|
94
94
|
|
|
95
95
|
// ### obtaining originSequence
|
|
96
96
|
/*
|
|
@@ -117,8 +117,8 @@ export class FxInsert extends AbstractAction {
|
|
|
117
117
|
let insertLocationNode;
|
|
118
118
|
let index;
|
|
119
119
|
|
|
120
|
-
const idx = this._getInsertIndex(inscope, targetSequence);
|
|
121
|
-
console.log('insert index', idx);
|
|
120
|
+
// const idx = this._getInsertIndex(inscope, targetSequence);
|
|
121
|
+
// console.log('insert index', idx);
|
|
122
122
|
|
|
123
123
|
// if the targetSequence is empty but we got an originSequence use inscope as context and ignore 'at' and 'position'
|
|
124
124
|
if (targetSequence.length === 0) {
|
|
@@ -151,7 +151,7 @@ export class FxInsert extends AbstractAction {
|
|
|
151
151
|
|
|
152
152
|
insertLocationNode = targetSequence;
|
|
153
153
|
const context = evaluateXPath('count(preceding::*)', targetSequence, this.getOwnerForm());
|
|
154
|
-
console.log('context', context);
|
|
154
|
+
// console.log('context', context);
|
|
155
155
|
index = context + 1;
|
|
156
156
|
// index = targetSequence.findIndex(insertLocationNode);
|
|
157
157
|
}
|
|
@@ -171,10 +171,10 @@ export class FxInsert extends AbstractAction {
|
|
|
171
171
|
|
|
172
172
|
// console.log('insert context item ', insertLocationNode);
|
|
173
173
|
// console.log('parent ', insertLocationNode.parentNode);
|
|
174
|
-
console.log('instance ', this.getModel().getDefaultContext());
|
|
174
|
+
// console.log('instance ', this.getModel().getDefaultContext());
|
|
175
175
|
|
|
176
|
-
console.log('<<<<<<< at', this.at);
|
|
177
|
-
console.log('<<<<<<< index', index);
|
|
176
|
+
// console.log('<<<<<<< at', this.at);
|
|
177
|
+
// console.log('<<<<<<< index', index);
|
|
178
178
|
// todo: this actually should dispatch to respective instance
|
|
179
179
|
document.dispatchEvent(
|
|
180
180
|
new CustomEvent('insert', {
|
package/src/actions/fx-send.js
CHANGED
|
@@ -17,7 +17,7 @@ class FxSend extends AbstractAction {
|
|
|
17
17
|
connectedCallback() {
|
|
18
18
|
// eslint-disable-next-line wc/guard-super-call
|
|
19
19
|
super.connectedCallback();
|
|
20
|
-
console.log('connectedCallback ', this);
|
|
20
|
+
// console.log('connectedCallback ', this);
|
|
21
21
|
this.submission = this.getAttribute('submission');
|
|
22
22
|
}
|
|
23
23
|
|