@nebularstreams/libmui 2.5.81 → 2.5.82
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/dist/libui.esm.js +2 -2
- package/dist/libui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets/TemplatedInputWidget.js +466 -427
|
@@ -301,6 +301,7 @@ const
|
|
|
301
301
|
paramKey = (isObj && metaDef.key) || metaKey,
|
|
302
302
|
|
|
303
303
|
isCardie = isObj && metaDef.type === "group",
|
|
304
|
+
isCardieArray = isObj && metaDef.type === "groupArray",
|
|
304
305
|
isString = typeof metaDef === "string" || (isObj && metaDef.type === "text"),
|
|
305
306
|
isJson = (isObj && metaDef.type === "json"),
|
|
306
307
|
isBoolean = typeof metaDef === "boolean" || (isObj && metaDef.type === "boolean"),
|
|
@@ -392,12 +393,12 @@ const
|
|
|
392
393
|
+ ((metaDef.itemClass || itemClass) ? " " + (metaDef.itemClass || itemClass) : ""),
|
|
393
394
|
"aria-label": metaKey
|
|
394
395
|
},
|
|
395
|
-
|
|
396
|
-
?
|
|
397
|
-
m(CardieWidget, {
|
|
396
|
+
isCardieArray
|
|
397
|
+
? Array.isArray(rawValue)
|
|
398
|
+
? rawValue.map((item, index) => m(CardieWidget, {
|
|
398
399
|
class: "relative grows " + (metaDef.class || "emby w-max") + (metaDef.dynClass ? " " + metaDef.dynClass(parameters, auxParameters) : ""),
|
|
399
400
|
title: metaDef.dynTitle ? metaDef.dynTitle(parameters, auxParameters) : metaDef.title,
|
|
400
|
-
cardid: metaDef.cardid,
|
|
401
|
+
cardid: metaDef.cardid + "-" + index,
|
|
401
402
|
nofold: false,
|
|
402
403
|
size: metaDef.size || 1,
|
|
403
404
|
expandedView: () => [
|
|
@@ -407,7 +408,7 @@ const
|
|
|
407
408
|
when: {},
|
|
408
409
|
sizes: {},
|
|
409
410
|
|
|
410
|
-
parameters,
|
|
411
|
+
parameters: item,
|
|
411
412
|
auxParameters,
|
|
412
413
|
|
|
413
414
|
global,
|
|
@@ -428,490 +429,528 @@ const
|
|
|
428
429
|
],
|
|
429
430
|
titleExpended: metaDef.titleExpanded || metaDef.hint,
|
|
430
431
|
titleCollapsed: metaDef.titleCollapsed || metaDef.hint,
|
|
431
|
-
})
|
|
432
|
-
|
|
433
|
-
:
|
|
432
|
+
}))
|
|
433
|
+
: []
|
|
434
|
+
: isCardie
|
|
434
435
|
? [
|
|
435
|
-
m(
|
|
436
|
-
class: metaDef.class || "
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
m(CardieWidget, {
|
|
437
|
+
class: "relative grows " + (metaDef.class || "emby w-max") + (metaDef.dynClass ? " " + metaDef.dynClass(parameters, auxParameters) : ""),
|
|
438
|
+
title: metaDef.dynTitle ? metaDef.dynTitle(parameters, auxParameters) : metaDef.title,
|
|
439
|
+
cardid: metaDef.cardid,
|
|
440
|
+
nofold: false,
|
|
441
|
+
size: metaDef.size || 1,
|
|
442
|
+
expandedView: () => [
|
|
443
|
+
m(ParameterTable, {
|
|
444
|
+
meta: metaDef.items,
|
|
445
|
+
crit: {},
|
|
446
|
+
when: {},
|
|
447
|
+
sizes: {},
|
|
448
|
+
|
|
449
|
+
parameters,
|
|
450
|
+
auxParameters,
|
|
451
|
+
|
|
452
|
+
global,
|
|
453
|
+
clone,
|
|
454
|
+
onchange,
|
|
455
|
+
itemClass,
|
|
456
|
+
wrapper,
|
|
457
|
+
empty: vacioperovacio,
|
|
458
|
+
itemsDict: attrs.itemsDict,
|
|
459
|
+
layer: attrs.layer,
|
|
460
|
+
onAction: attrs.onAction,
|
|
461
|
+
optionsDict: attrs.optionsDict,
|
|
462
|
+
play: attrs.play,
|
|
463
|
+
auxTargetIsDefault: attrs.auxTargetIsDefault,
|
|
464
|
+
AssetButton: attrs.AssetButton,
|
|
465
|
+
CodeMirror: attrs.CodeMirror
|
|
466
|
+
})
|
|
467
|
+
],
|
|
468
|
+
titleExpended: metaDef.titleExpanded || metaDef.hint,
|
|
469
|
+
titleCollapsed: metaDef.titleCollapsed || metaDef.hint,
|
|
439
470
|
})
|
|
440
471
|
]
|
|
441
|
-
:
|
|
442
|
-
?
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
:
|
|
450
|
-
?
|
|
451
|
-
m(
|
|
452
|
-
metaDef.widget,
|
|
453
|
-
metaDef.attrs(rawValue, state, (critical, rootParameters) => {
|
|
454
|
-
onchange(critical || UPDATECODE, rootParameters ? parameters : targetParameters, metaKey, undefined, metaDef);
|
|
455
|
-
}, global, attrs, targetParameters),
|
|
456
|
-
metaDef.children
|
|
457
|
-
? metaDef.children(rawValue, state, (critical, rootParameters) => {
|
|
458
|
-
onchange(critical || UPDATECODE, rootParameters ? parameters : targetParameters, metaKey, undefined, metaDef);
|
|
459
|
-
}, global, attrs, targetParameters)
|
|
460
|
-
: [])
|
|
461
|
-
]
|
|
462
|
-
: isPlusMinus
|
|
472
|
+
: isSeparator
|
|
473
|
+
? [
|
|
474
|
+
m(Separator, {
|
|
475
|
+
class: metaDef.class || "mini",
|
|
476
|
+
text: typeof metaDef.title === "string"
|
|
477
|
+
? metaDef.title : metaDef.label || metaKey
|
|
478
|
+
})
|
|
479
|
+
]
|
|
480
|
+
: isText
|
|
481
|
+
? metaDef.icon
|
|
463
482
|
? [
|
|
464
|
-
m(
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
483
|
+
m(Icon, {icon: metaDef.icon, class: metaDef.iconClass}),
|
|
484
|
+
m(".innertext", {class: metaDef.class, title: metaDef.hint}, rawValue)
|
|
485
|
+
] : [
|
|
486
|
+
m(".innertext", {class: metaDef.class, title: metaDef.hint}, rawValue)
|
|
487
|
+
]
|
|
488
|
+
: isWidget
|
|
489
|
+
? [
|
|
490
|
+
m(
|
|
491
|
+
metaDef.widget,
|
|
492
|
+
metaDef.attrs(rawValue, state, (critical, rootParameters) => {
|
|
493
|
+
onchange(critical || UPDATECODE, rootParameters ? parameters : targetParameters, metaKey, undefined, metaDef);
|
|
494
|
+
}, global, attrs, targetParameters),
|
|
495
|
+
metaDef.children
|
|
496
|
+
? metaDef.children(rawValue, state, (critical, rootParameters) => {
|
|
497
|
+
onchange(critical || UPDATECODE, rootParameters ? parameters : targetParameters, metaKey, undefined, metaDef);
|
|
498
|
+
}, global, attrs, targetParameters)
|
|
499
|
+
: [])
|
|
475
500
|
]
|
|
476
|
-
:
|
|
501
|
+
: isPlusMinus
|
|
477
502
|
? [
|
|
478
|
-
m(
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
value: rawValue,
|
|
482
|
-
label: metaDef.label,
|
|
483
|
-
hint: isObj ? metaDef.hint : metaDef,
|
|
503
|
+
m(PlusMinusWidget, {
|
|
504
|
+
max: metaDef.max,
|
|
505
|
+
min: metaDef.min,
|
|
484
506
|
title: metaDef.title,
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
oninput: () => {
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
multi: isJson || metaDef.multi,
|
|
491
|
-
alwaysmulti: isJson || metaDef.alwaysmulti,
|
|
507
|
+
label: metaDef.label,
|
|
508
|
+
value: rawValue,
|
|
492
509
|
onchange: (value) => {
|
|
493
510
|
set(value);
|
|
494
511
|
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
495
512
|
}
|
|
496
|
-
})
|
|
497
|
-
|
|
513
|
+
})
|
|
514
|
+
]
|
|
515
|
+
: isString || (isJson && !attrs.CodeMirror)
|
|
498
516
|
? [
|
|
499
|
-
m(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
Notification.add(metaDef.hint + " cleared");
|
|
510
|
-
}
|
|
517
|
+
m(InputWidget, {
|
|
518
|
+
containerClass: "grows",
|
|
519
|
+
class: metaDef.inputClass,
|
|
520
|
+
value: rawValue,
|
|
521
|
+
label: metaDef.label,
|
|
522
|
+
hint: isObj ? metaDef.hint : metaDef,
|
|
523
|
+
title: metaDef.title,
|
|
524
|
+
maxlength: isObj ? metaDef.maxlength || 256 : 256,
|
|
525
|
+
...metaDef.final && {
|
|
526
|
+
oninput: () => {
|
|
511
527
|
}
|
|
528
|
+
},
|
|
529
|
+
multi: isJson || metaDef.multi,
|
|
530
|
+
alwaysmulti: isJson || metaDef.alwaysmulti,
|
|
531
|
+
onchange: (value) => {
|
|
532
|
+
set(value);
|
|
533
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
512
534
|
}
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
: isNumber
|
|
535
|
+
})]
|
|
536
|
+
: isJson
|
|
516
537
|
? [
|
|
517
|
-
m(
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
...metaDef.final && {
|
|
530
|
-
oninput: () => {
|
|
538
|
+
m(attrs.CodeMirror, {
|
|
539
|
+
doc: rawValue,
|
|
540
|
+
schema: metaDef.schema,
|
|
541
|
+
hint: metaDef.dynamicHint ? metaDef.dynamicHint(targetParameters) : metaDef.hint,
|
|
542
|
+
empty: metaDef.empty,
|
|
543
|
+
onSave: (content) => {
|
|
544
|
+
if (content !== null) {
|
|
545
|
+
set(content || "");
|
|
546
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
547
|
+
if (!content) {
|
|
548
|
+
Notification.add(metaDef.hint + " cleared");
|
|
549
|
+
}
|
|
531
550
|
}
|
|
532
|
-
}
|
|
533
|
-
|
|
551
|
+
}
|
|
552
|
+
})
|
|
553
|
+
]
|
|
554
|
+
: isNumber
|
|
555
|
+
? [
|
|
556
|
+
m(InputWidget, {
|
|
557
|
+
containerClass: "grows",
|
|
558
|
+
class: metaDef.inputClass,
|
|
559
|
+
value: (metaDef.step > 0 && metaDef.step < 1 || metaDef.float)
|
|
560
|
+
? rawValue !== undefined
|
|
561
|
+
? (parseFloat(rawValue) || 0).toFixed(3)
|
|
562
|
+
: ""
|
|
563
|
+
: rawValue,
|
|
564
|
+
type: "text",
|
|
565
|
+
label: metaDef.label,
|
|
566
|
+
hint: isObj ? metaDef.hint : metaDef,
|
|
567
|
+
title: metaDef.title,
|
|
568
|
+
...metaDef.final && {
|
|
569
|
+
oninput: () => {
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
onchange: (value) => {
|
|
534
573
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
574
|
+
let
|
|
575
|
+
isFloat = metaDef.step > 0 && metaDef.step < 1 || metaDef.float,
|
|
576
|
+
{min, max} = metaDef;
|
|
538
577
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
578
|
+
if (value === undefined) {
|
|
579
|
+
set(undefined);
|
|
580
|
+
} else {
|
|
542
581
|
|
|
543
|
-
|
|
582
|
+
let val = isFloat ? parseFloat(value) : parseInt(value, 10);
|
|
544
583
|
|
|
545
|
-
|
|
584
|
+
if (!isNaN(val)) {
|
|
546
585
|
|
|
547
|
-
|
|
548
|
-
|
|
586
|
+
if (val < min) val = min;
|
|
587
|
+
if (val > max) val = max;
|
|
549
588
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
589
|
+
} else {
|
|
590
|
+
val = undefined;
|
|
591
|
+
}
|
|
553
592
|
|
|
554
|
-
|
|
593
|
+
set(val);
|
|
555
594
|
|
|
556
|
-
|
|
595
|
+
}
|
|
557
596
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
597
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
598
|
+
}
|
|
599
|
+
})]
|
|
600
|
+
: isNotice
|
|
601
|
+
? [m(NoticeWidget, metaDef)]
|
|
602
|
+
: isAsset
|
|
603
|
+
? attrs.AssetButton ? [
|
|
604
|
+
m(attrs.AssetButton, {
|
|
605
|
+
global,
|
|
606
|
+
value: rawValue, // metaDef.values ? metaDef.values[parameters[metaKey].id] : parameters[metaKey],
|
|
607
|
+
confirm: metaDef.confirm,
|
|
608
|
+
class: "grows font-125 " + (metaDef.containerClass || "scaff scaff-b1"),
|
|
609
|
+
buttonClass: (metaDef.buttonClass || "unitheight scaff-left"),
|
|
610
|
+
readonly: metaDef.readOnly,
|
|
611
|
+
closeClass: metaDef.closeClass,
|
|
612
|
+
textClass: metaDef.textClass || "",
|
|
613
|
+
iconClass: metaDef.iconClass || "",
|
|
614
|
+
field: metaDef.field,
|
|
615
|
+
|
|
616
|
+
types: metaDef.types,
|
|
617
|
+
subtype: metaDef.subtype,
|
|
618
|
+
file: metaDef.file,
|
|
619
|
+
pack: metaDef.pack,
|
|
620
|
+
|
|
621
|
+
shiftUpdate: metaDef.shiftUpdate,
|
|
622
|
+
shiftIcon: metaDef.shiftIcon,
|
|
623
|
+
removeIcon: metaDef.removeIcon,
|
|
624
|
+
emptyValue: metaDef.emptyText || "off",
|
|
625
|
+
emptyText: metaDef.emptyText || "off",
|
|
626
|
+
emptyIcon: metaDef.emptyIcon || metaDef.icon,
|
|
627
|
+
icon: metaDef.icon,
|
|
628
|
+
title: metaDef.title,
|
|
629
|
+
titleCollapsed: metaDef.titleCollapsed,
|
|
630
|
+
titleClass: "pad-2 pad-v no-pad-bottom",
|
|
631
|
+
parameters,
|
|
632
|
+
auxParameters,
|
|
633
|
+
onchange: (value, e) => {
|
|
634
|
+
if (e && e.shiftKey && attrs.onShiftPress) {
|
|
635
|
+
attrs.onShiftPress(metaKey, targetParameters, value);
|
|
636
|
+
} else {
|
|
637
|
+
if (value === undefined) value = metaDef.nullValue || undefined;
|
|
638
|
+
set(value);
|
|
639
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
640
|
+
}
|
|
601
641
|
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
: isEmoji
|
|
613
|
-
? [
|
|
614
|
-
m(SmileysButton, {
|
|
615
|
-
class: "grows " + (metaDef.class || "scaff scaff-b1 unitheight font-200"),
|
|
616
|
-
icon: {glyph: rawValue},
|
|
617
|
-
icons: false,
|
|
618
|
-
onchange: (glyph) => {
|
|
619
|
-
set(glyph);
|
|
620
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
621
|
-
}
|
|
622
|
-
})]
|
|
623
|
-
: isFont
|
|
642
|
+
})]
|
|
643
|
+
: [
|
|
644
|
+
m(ButtonNew, {
|
|
645
|
+
icon: metaDef.icon,
|
|
646
|
+
title: metaDef.title,
|
|
647
|
+
class: "unitheight",
|
|
648
|
+
text: "No Asset Module"
|
|
649
|
+
})
|
|
650
|
+
]
|
|
651
|
+
: isEmoji
|
|
624
652
|
? [
|
|
625
|
-
m(
|
|
626
|
-
class: "grows " + (metaDef.class || "scaff-
|
|
627
|
-
|
|
628
|
-
|
|
653
|
+
m(SmileysButton, {
|
|
654
|
+
class: "grows " + (metaDef.class || "scaff scaff-b1 unitheight font-200"),
|
|
655
|
+
icon: {glyph: rawValue},
|
|
656
|
+
icons: false,
|
|
629
657
|
onchange: (glyph) => {
|
|
630
|
-
if (metaDef.nodelete && !glyph) return;
|
|
631
658
|
set(glyph);
|
|
632
|
-
|
|
633
|
-
const newTargetParameters = (metaDef.target || metaDef.forTarget) ? parameters[metaDef.target || metaDef.forTarget] : parameters;
|
|
634
|
-
onchange(!glyph ? NEEDS_DELETE : UPDATECODE, newTargetParameters, metaKey, !glyph, metaDef);
|
|
659
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
635
660
|
}
|
|
636
661
|
})]
|
|
637
|
-
:
|
|
662
|
+
: isFont
|
|
638
663
|
? [
|
|
639
|
-
m(
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
+
m(FontSelectorButton, {
|
|
665
|
+
class: "grows " + (metaDef.class || "scaff-right unitheight"),
|
|
666
|
+
fontFamily: rawValue,
|
|
667
|
+
nodelete: metaDef.nodelete,
|
|
668
|
+
onchange: (glyph) => {
|
|
669
|
+
if (metaDef.nodelete && !glyph) return;
|
|
670
|
+
set(glyph);
|
|
671
|
+
// could be erased
|
|
672
|
+
const newTargetParameters = (metaDef.target || metaDef.forTarget) ? parameters[metaDef.target || metaDef.forTarget] : parameters;
|
|
673
|
+
onchange(!glyph ? NEEDS_DELETE : UPDATECODE, newTargetParameters, metaKey, !glyph, metaDef);
|
|
674
|
+
}
|
|
675
|
+
})]
|
|
676
|
+
: isColor
|
|
677
|
+
? [
|
|
678
|
+
m(ColorJoeWidget, {
|
|
679
|
+
class: "grows " + (metaDef.class || "unitheight") + (altKey ? " withalt" : ""),
|
|
680
|
+
color: rawValue,
|
|
681
|
+
caption: metaDef.caption,
|
|
682
|
+
noalpha: metaDef.noalpha,
|
|
683
|
+
remove: metaDef.remove,
|
|
684
|
+
onchange: (color, colorObject) => {
|
|
685
|
+
let finalColor = color;
|
|
686
|
+
if (finalColor) {
|
|
687
|
+
if (metaDef.hsl) {
|
|
688
|
+
const hsl = colorObject.hsl();
|
|
689
|
+
finalColor = [hsl.hue(), hsl.saturation(), hsl.lightness()];
|
|
690
|
+
} else if (metaDef.rgba) {
|
|
691
|
+
finalColor = [colorObject.r(), colorObject.g(), colorObject.b(), colorObject.a()];
|
|
664
692
|
|
|
665
|
-
|
|
666
|
-
altMeta
|
|
667
|
-
? [
|
|
668
|
-
m(RangeWidget, {
|
|
669
|
-
auto0: altMeta.auto0,
|
|
670
|
-
min: altMeta.min,
|
|
671
|
-
max: altMeta.max,
|
|
672
|
-
step: altMeta.step || 0.1,
|
|
673
|
-
...altMeta.mul && {multiplier: altMeta.mul},
|
|
674
|
-
class: "col-11 grows innerlabel order-first",
|
|
675
|
-
title: altMeta.title,
|
|
676
|
-
value: targetParameters[altKey] ?? altMeta.min,
|
|
677
|
-
onchange: (value) => {
|
|
678
|
-
set(value, undefined, altKey, altMeta);
|
|
679
|
-
onchange(crit[altMetaKey], targetParameters, altMetaKey, undefined, metaDef);
|
|
693
|
+
}
|
|
680
694
|
}
|
|
681
|
-
|
|
682
|
-
]
|
|
683
|
-
: undefined)]
|
|
684
|
-
: isBoolean
|
|
685
|
-
? [
|
|
686
|
-
m(
|
|
687
|
-
isObj && metaDef.toggle
|
|
688
|
-
? metaDef.states ? ToggleStateWidget : ToggleWidget
|
|
689
|
-
: SwitchWidget,
|
|
690
|
-
{
|
|
691
|
-
class: "grows " + (metaDef.class || "unitheight"),
|
|
692
|
-
text: isObj ? metaDef.title || metaDef.label : metaKey,
|
|
693
|
-
icon: isObj ? metaDef.icon : undefined,
|
|
694
|
-
noclass: metaDef.noclass,
|
|
695
|
-
subline: metaDef.subline,
|
|
696
|
-
checked: rawValue,
|
|
697
|
-
title: metaDef.hint,
|
|
698
|
-
hint: metaDef.hint,
|
|
699
|
-
inverted: isObj && metaDef.inverted,
|
|
700
|
-
states: metaDef.states,
|
|
701
|
-
iconClass: metaDef.iconClass,
|
|
702
|
-
onchange: (st) => {
|
|
703
|
-
set(metaDef.states ? st : !!st);
|
|
695
|
+
set(finalColor);
|
|
704
696
|
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
697
|
+
},
|
|
698
|
+
...altKey && {
|
|
699
|
+
style: {
|
|
700
|
+
"--data-altval": ((((targetParameters[altKey] ?? altMeta.min) - altMeta.min) / (altMeta.max - altMeta.min)) * 100) + "%"
|
|
701
|
+
}
|
|
705
702
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
703
|
+
|
|
704
|
+
},
|
|
705
|
+
altMeta
|
|
706
|
+
? [
|
|
707
|
+
m(RangeWidget, {
|
|
708
|
+
auto0: altMeta.auto0,
|
|
709
|
+
min: altMeta.min,
|
|
710
|
+
max: altMeta.max,
|
|
711
|
+
step: altMeta.step || 0.1,
|
|
712
|
+
...altMeta.mul && {multiplier: altMeta.mul},
|
|
713
|
+
class: "col-11 grows innerlabel order-first",
|
|
714
|
+
title: altMeta.title,
|
|
715
|
+
value: targetParameters[altKey] ?? altMeta.min,
|
|
716
|
+
onchange: (value) => {
|
|
717
|
+
set(value, undefined, altKey, altMeta);
|
|
718
|
+
onchange(crit[altMetaKey], targetParameters, altMetaKey, undefined, metaDef);
|
|
719
|
+
}
|
|
720
|
+
})
|
|
721
|
+
]
|
|
722
|
+
: undefined)]
|
|
723
|
+
: isBoolean
|
|
710
724
|
? [
|
|
711
725
|
m(
|
|
712
|
-
|
|
726
|
+
isObj && metaDef.toggle
|
|
727
|
+
? metaDef.states ? ToggleStateWidget : ToggleWidget
|
|
728
|
+
: SwitchWidget,
|
|
713
729
|
{
|
|
714
|
-
class: "grows " + (metaDef.class || "
|
|
715
|
-
text: metaDef.label
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
if (metaDef.confirm) {
|
|
731
|
-
confirm(metaDef.confirm, runAction);
|
|
732
|
-
} else {
|
|
733
|
-
runAction();
|
|
734
|
-
}
|
|
730
|
+
class: "grows " + (metaDef.class || "unitheight"),
|
|
731
|
+
text: isObj ? metaDef.title || metaDef.label : metaKey,
|
|
732
|
+
icon: isObj ? metaDef.icon : undefined,
|
|
733
|
+
noclass: metaDef.noclass,
|
|
734
|
+
subline: metaDef.subline,
|
|
735
|
+
checked: rawValue,
|
|
736
|
+
title: metaDef.hint,
|
|
737
|
+
hint: metaDef.hint,
|
|
738
|
+
inverted: isObj && metaDef.inverted,
|
|
739
|
+
states: metaDef.states,
|
|
740
|
+
iconClass: metaDef.iconClass,
|
|
741
|
+
onchange: (st) => {
|
|
742
|
+
set(metaDef.states ? st : !!st);
|
|
743
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
735
744
|
}
|
|
736
745
|
}
|
|
737
746
|
)
|
|
738
747
|
]
|
|
739
|
-
:
|
|
748
|
+
: isActionButton
|
|
740
749
|
? [
|
|
741
|
-
m(
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
750
|
+
m(
|
|
751
|
+
ButtonNew,
|
|
752
|
+
{
|
|
753
|
+
class: "grows " + (metaDef.class || "accentbutton unitheight"),
|
|
754
|
+
text: metaDef.label === ""
|
|
755
|
+
? null
|
|
756
|
+
: metaDef.label || metaDef.text || metaKey,
|
|
757
|
+
icon: metaDef.icon,
|
|
758
|
+
title: metaDef.title || metaDef.hint,
|
|
759
|
+
onClick: (e) => {
|
|
760
|
+
|
|
761
|
+
const runAction = () => {
|
|
762
|
+
if (metaDef.onClick) {
|
|
763
|
+
metaDef.onClick(metaKey, e, targetParameters, auxParameters, global, attrs);
|
|
764
|
+
} else {
|
|
765
|
+
if (attrs.onAction) attrs.onAction(metaKey, e, targetSource);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
if (metaDef.confirm) {
|
|
770
|
+
confirm(metaDef.confirm, runAction);
|
|
771
|
+
} else {
|
|
772
|
+
runAction();
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
)
|
|
754
777
|
]
|
|
755
|
-
:
|
|
778
|
+
: isMultiToggle
|
|
756
779
|
? [
|
|
757
|
-
m(
|
|
758
|
-
class: "col-12" + (metaDef.
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
780
|
+
m(metaDef.keys ? PagedMultiToggleWidget : MultiToggleWidget, {
|
|
781
|
+
class: "col-12 " + (metaDef.toggle ? "istoggler" : ""),
|
|
782
|
+
icon: metaDef.icon,
|
|
783
|
+
buttonClass: metaDef.buttonClass,
|
|
784
|
+
selectorClass: metaDef.selectorClass || "grows",
|
|
785
|
+
selectorButtonClass: metaDef.selectorButtonClass,
|
|
786
|
+
keys: metaDef.keys,
|
|
787
|
+
hint: metaDef.hint,
|
|
788
|
+
nocustom: metaDef.nocustom,
|
|
766
789
|
source: rawValue,
|
|
767
790
|
onchange: () => onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef),
|
|
768
|
-
|
|
769
|
-
keys: metaDef.keys,
|
|
770
|
-
add: metaDef.add,
|
|
771
|
-
targetParameters,
|
|
772
|
-
auxParameters,
|
|
773
|
-
empty: metaDef.empty
|
|
791
|
+
...(metaDef.customWidget || {})
|
|
774
792
|
})
|
|
775
793
|
]
|
|
776
|
-
:
|
|
794
|
+
: isKeyIterator
|
|
777
795
|
? [
|
|
778
|
-
m(
|
|
779
|
-
class: "col-12
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
if (value || value >= 0) {
|
|
796
|
-
if (metaDef.toggle && value === rawValue) value = !value;
|
|
797
|
-
set(value, choice);
|
|
798
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
799
|
-
} else {
|
|
800
|
-
set(undefined, choice);
|
|
801
|
-
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
802
|
-
}
|
|
803
|
-
taint();
|
|
804
|
-
}
|
|
796
|
+
m(KeyIteratorWidget, {
|
|
797
|
+
class: "col-12" + (metaDef.class ? " " + metaDef.class : ""),
|
|
798
|
+
buttonClass: metaDef.widgetClass,
|
|
799
|
+
cardie: metaDef.cardie,
|
|
800
|
+
cardieClass: metaDef.cardieClass,
|
|
801
|
+
addButtonClass: metaDef.addButtonClass,
|
|
802
|
+
caption: metaDef.caption,
|
|
803
|
+
separatorClass: metaDef.separatorClass,
|
|
804
|
+
noseparator: metaDef.noseparator,
|
|
805
|
+
source: rawValue,
|
|
806
|
+
onchange: () => onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef),
|
|
807
|
+
widget: metaDef.keyWidget,
|
|
808
|
+
keys: metaDef.keys,
|
|
809
|
+
add: metaDef.add,
|
|
810
|
+
targetParameters,
|
|
811
|
+
auxParameters,
|
|
812
|
+
empty: metaDef.empty
|
|
805
813
|
})
|
|
806
814
|
]
|
|
807
|
-
:
|
|
808
|
-
?
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
815
|
+
: isButtonChoice
|
|
816
|
+
? [
|
|
817
|
+
m(ButtonChoiceWidget, {
|
|
818
|
+
class: "col-12 " + (metaDef.toggle ? "istoggler" : ""),
|
|
819
|
+
subclass: metaDef.class,
|
|
820
|
+
buttonClass: metaDef.buttonClass,
|
|
821
|
+
choices: metaDef.choices,
|
|
822
|
+
choose: metaDef.choose,
|
|
823
|
+
chooseKey: metaDef.chooseKey,
|
|
824
|
+
chooseDict: attrs.chooseDict,
|
|
825
|
+
label: metaDef.label,
|
|
826
|
+
field: metaDef.field,
|
|
827
|
+
icon: metaDef.icon,
|
|
828
|
+
value: rawValue,
|
|
829
|
+
onchange: (choice) => {
|
|
830
|
+
|
|
831
|
+
let
|
|
832
|
+
{value} = choice;
|
|
833
|
+
|
|
834
|
+
if (value || value >= 0) {
|
|
835
|
+
if (metaDef.toggle && value === rawValue) value = !value;
|
|
836
|
+
set(value, choice);
|
|
837
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
838
|
+
} else {
|
|
839
|
+
set(undefined, choice);
|
|
840
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
828
841
|
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
842
|
+
taint();
|
|
843
|
+
}
|
|
844
|
+
})
|
|
845
|
+
]
|
|
846
|
+
: !isCombo
|
|
847
|
+
? isFullCombo
|
|
832
848
|
? [
|
|
833
|
-
m(
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
? {
|
|
842
|
-
multiplier: metaDef.mul
|
|
843
|
-
}
|
|
844
|
-
: {},
|
|
845
|
-
class: "col-11 grows innerlabel",
|
|
846
|
-
title: metaDef.label || metaDef.title || (metaKey.indexOf("-") === -1 ? metaKey : metaKey.substring(metaKey.lastIndexOf("-") + 1)),
|
|
847
|
-
hint: metaDef.hint,
|
|
848
|
-
value: parseFloat(rawValue) ?? metaDef ?? metaDef.min,
|
|
849
|
-
parser: metaDef.parser,
|
|
849
|
+
m(ComboWidget, {
|
|
850
|
+
class: "grows scaff scaff-b1 " + (metaDef.class || "unitheight"),
|
|
851
|
+
value: rawValue,
|
|
852
|
+
emptyText: metaDef.emptyText || "off",
|
|
853
|
+
icon: metaDef.icon,
|
|
854
|
+
title: metaDef.title,
|
|
855
|
+
items: metaDef.items,
|
|
856
|
+
textClass: metaDef.textClass || "",
|
|
850
857
|
onchange: (value) => {
|
|
851
|
-
|
|
852
|
-
|
|
858
|
+
if (typeof value === "string") value = value.trim();
|
|
859
|
+
if (value) {
|
|
860
|
+
set(value);
|
|
861
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
862
|
+
} else {
|
|
863
|
+
set(undefined);
|
|
864
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
865
|
+
}
|
|
866
|
+
taint();
|
|
853
867
|
}
|
|
854
868
|
})
|
|
855
869
|
]
|
|
856
|
-
:
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
870
|
+
: isRange
|
|
871
|
+
? [
|
|
872
|
+
m(RangeWidget, {
|
|
873
|
+
auto0: metaDef.auto0,
|
|
874
|
+
relative: !metaDef.auto0 && !metaDef.absolute,
|
|
875
|
+
factor: metaDef.factor,
|
|
876
|
+
min: metaDef.min,
|
|
877
|
+
max: metaDef.max,
|
|
878
|
+
step: metaDef.step || 0.1,
|
|
879
|
+
...metaDef.mul
|
|
880
|
+
? {
|
|
881
|
+
multiplier: metaDef.mul
|
|
882
|
+
}
|
|
883
|
+
: {},
|
|
884
|
+
class: "col-11 grows innerlabel",
|
|
885
|
+
title: metaDef.label || metaDef.title || (metaKey.indexOf("-") === -1 ? metaKey : metaKey.substring(metaKey.lastIndexOf("-") + 1)),
|
|
886
|
+
hint: metaDef.hint,
|
|
887
|
+
value: parseFloat(rawValue) ?? metaDef ?? metaDef.min,
|
|
888
|
+
parser: metaDef.parser,
|
|
889
|
+
onchange: (value) => {
|
|
890
|
+
set(value);
|
|
891
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
892
|
+
}
|
|
893
|
+
})
|
|
894
|
+
]
|
|
895
|
+
: [
|
|
896
|
+
m(RangeWidget, {
|
|
897
|
+
min: metaDef[0],
|
|
898
|
+
max: metaDef[1],
|
|
899
|
+
step: metaDef[2] || 0.1,
|
|
900
|
+
...metaDef[3]
|
|
901
|
+
? {
|
|
902
|
+
multiplier: metaDef[3]
|
|
903
|
+
} : {},
|
|
904
|
+
class: "col-11 grows innerlabel",
|
|
905
|
+
title: metaDef[4] || (metaKey.indexOf("-") === -1 ? metaKey : metaKey.substring(metaKey.lastIndexOf("-") + 1)),
|
|
906
|
+
value: parseFloat(rawValue) || metaDef[0],
|
|
907
|
+
onchange: (value) => {
|
|
908
|
+
set(value);
|
|
909
|
+
onchange(UPDATECODE, targetParameters, metaKey, undefined, metaDef);
|
|
910
|
+
}
|
|
911
|
+
})
|
|
912
|
+
]
|
|
913
|
+
: [
|
|
914
|
+
m(ComboPrompt, {
|
|
915
|
+
class: metaDef.containerClass || "scaff scaff-b1",
|
|
916
|
+
buttonClass: metaDef.class || "unitheightsmall scaff-left",
|
|
917
|
+
closeClass: metaDef.buttonClass || undefined,
|
|
918
|
+
textClass: metaDef.textClass || "",
|
|
919
|
+
locked: metaDef.locked,
|
|
920
|
+
value: rawValue, // metaDef.values ? metaDef.values[parameters[metaKey].id] : parameters[metaKey],
|
|
921
|
+
field: metaDef.field,
|
|
922
|
+
fieldTitle: metaDef.fieldTitle,
|
|
923
|
+
emptyText: metaDef.emptyText || "off",
|
|
924
|
+
emptyIcon: metaDef.emptyIcon || metaDef.icon,
|
|
925
|
+
confirm: metaDef.confirm,
|
|
926
|
+
icon: metaDef.icon || attrs.icon,
|
|
927
|
+
hint: metaDef.hint,
|
|
928
|
+
label: metaDef.label,
|
|
929
|
+
title: metaDef.question,
|
|
930
|
+
itemsKey: typeof metaDef.optionsKey === "function" ? () => {
|
|
931
|
+
return metaDef.optionsKey(targetParameters);
|
|
932
|
+
} : metaDef.optionsKey,
|
|
933
|
+
items: metaDef.options || attrs.optionsDict,
|
|
934
|
+
removeIcon: metaDef.removeIcon,
|
|
935
|
+
nodelete: metaDef.nodelete,
|
|
936
|
+
onchange: (value, event) => {
|
|
937
|
+
if (event?.shiftKey) {
|
|
938
|
+
if (metaDef.shiftPress) {
|
|
939
|
+
metaDef.shiftPress(targetParameters, auxParameters);
|
|
940
|
+
}
|
|
941
|
+
return;
|
|
871
942
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
textClass: metaDef.textClass || "",
|
|
880
|
-
locked: metaDef.locked,
|
|
881
|
-
value: rawValue, // metaDef.values ? metaDef.values[parameters[metaKey].id] : parameters[metaKey],
|
|
882
|
-
field: metaDef.field,
|
|
883
|
-
fieldTitle: metaDef.fieldTitle,
|
|
884
|
-
emptyText: metaDef.emptyText || "off",
|
|
885
|
-
emptyIcon: metaDef.emptyIcon || metaDef.icon,
|
|
886
|
-
confirm: metaDef.confirm,
|
|
887
|
-
icon: metaDef.icon || attrs.icon,
|
|
888
|
-
hint: metaDef.hint,
|
|
889
|
-
label: metaDef.label,
|
|
890
|
-
title: metaDef.question,
|
|
891
|
-
itemsKey: typeof metaDef.optionsKey === "function" ? () => {
|
|
892
|
-
return metaDef.optionsKey(targetParameters);
|
|
893
|
-
} : metaDef.optionsKey,
|
|
894
|
-
items: metaDef.options || attrs.optionsDict,
|
|
895
|
-
removeIcon: metaDef.removeIcon,
|
|
896
|
-
nodelete: metaDef.nodelete,
|
|
897
|
-
onchange: (value, event) => {
|
|
898
|
-
if (event?.shiftKey) {
|
|
899
|
-
if (metaDef.shiftPress) {
|
|
900
|
-
metaDef.shiftPress(targetParameters, auxParameters);
|
|
943
|
+
if (typeof value === "string") value = value.trim();
|
|
944
|
+
if (value) {
|
|
945
|
+
set(metaDef.values ? metaDef.values[value] : value, metaDef.clone);
|
|
946
|
+
onchange(UPDATECODE, targetParameters, metaKey, false, metaDef);
|
|
947
|
+
} else {
|
|
948
|
+
set(metaDef.nullValue || undefined);
|
|
949
|
+
onchange(UPDATECODE, targetParameters, metaKey, true, metaDef);
|
|
901
950
|
}
|
|
902
|
-
|
|
903
|
-
}
|
|
904
|
-
if (typeof value === "string") value = value.trim();
|
|
905
|
-
if (value) {
|
|
906
|
-
set(metaDef.values ? metaDef.values[value] : value, metaDef.clone);
|
|
907
|
-
onchange(UPDATECODE, targetParameters, metaKey, false, metaDef);
|
|
908
|
-
} else {
|
|
909
|
-
set(metaDef.nullValue || undefined);
|
|
910
|
-
onchange(UPDATECODE, targetParameters, metaKey, true, metaDef);
|
|
951
|
+
taint();
|
|
911
952
|
}
|
|
912
|
-
|
|
913
|
-
}
|
|
914
|
-
})]);
|
|
953
|
+
})]);
|
|
915
954
|
});
|
|
916
955
|
|
|
917
956
|
return total || children.length
|