@optionfactory/ful 0.49.0 → 0.50.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/dist/ful.iife.js +239 -128
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +236 -125
- package/dist/ful.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ful.iife.js
CHANGED
|
@@ -565,7 +565,7 @@ var ful = (function (exports) {
|
|
|
565
565
|
class SyncEvent extends CustomEvent {
|
|
566
566
|
#results;
|
|
567
567
|
constructor(type, options) {
|
|
568
|
-
super(type, options);
|
|
568
|
+
super(type, {...options, cancelable: true});
|
|
569
569
|
this.#results = [];
|
|
570
570
|
}
|
|
571
571
|
|
|
@@ -574,9 +574,11 @@ var ful = (function (exports) {
|
|
|
574
574
|
// event handlers asynchronously via the event loop, dispatchEvent()
|
|
575
575
|
// invokes event handlers synchronously.
|
|
576
576
|
// see: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
|
|
577
|
-
|
|
577
|
+
el.dispatchEvent(this);
|
|
578
|
+
//we ignore the result of dispatchEvent and use defaultPrevented instead
|
|
579
|
+
//because handlers can be async
|
|
578
580
|
const results = await Promise.all(this.#results);
|
|
579
|
-
return [
|
|
581
|
+
return [!this.defaultPrevented, results];
|
|
580
582
|
}
|
|
581
583
|
|
|
582
584
|
static on(el, type, h, useCapture) {
|
|
@@ -588,6 +590,11 @@ var ful = (function (exports) {
|
|
|
588
590
|
}
|
|
589
591
|
|
|
590
592
|
class Fragments {
|
|
593
|
+
/**
|
|
594
|
+
*
|
|
595
|
+
* @param {...string} html
|
|
596
|
+
* @returns
|
|
597
|
+
*/
|
|
591
598
|
static fromHtml(...html) {
|
|
592
599
|
const el = document.createElement("div");
|
|
593
600
|
el.innerHTML = html.join("");
|
|
@@ -595,16 +602,31 @@ var ful = (function (exports) {
|
|
|
595
602
|
fragment.append(...el.childNodes);
|
|
596
603
|
return fragment;
|
|
597
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
*
|
|
607
|
+
* @param {DocumentFragment} fragment
|
|
608
|
+
* @returns
|
|
609
|
+
*/
|
|
598
610
|
static toHtml(fragment) {
|
|
599
611
|
var r = document.createElement("div");
|
|
600
612
|
r.appendChild(fragment);
|
|
601
613
|
return r.innerHTML;
|
|
602
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
*
|
|
617
|
+
* @param {...Node} nodes
|
|
618
|
+
* @returns
|
|
619
|
+
*/
|
|
603
620
|
static from(...nodes) {
|
|
604
621
|
const fragment = new DocumentFragment();
|
|
605
622
|
fragment.append(...nodes);
|
|
606
623
|
return fragment;
|
|
607
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
*
|
|
627
|
+
* @param {HTMLElement} el
|
|
628
|
+
* @returns
|
|
629
|
+
*/
|
|
608
630
|
static fromChildNodes(el) {
|
|
609
631
|
const fragment = new DocumentFragment();
|
|
610
632
|
fragment.append(...el.childNodes);
|
|
@@ -614,18 +636,41 @@ var ful = (function (exports) {
|
|
|
614
636
|
|
|
615
637
|
class Attributes {
|
|
616
638
|
static id = 0;
|
|
639
|
+
/**
|
|
640
|
+
*
|
|
641
|
+
* @param {string} prefix
|
|
642
|
+
* @returns
|
|
643
|
+
*/
|
|
617
644
|
static uid(prefix) {
|
|
618
645
|
return `${prefix}-${++Attributes.id}`;
|
|
619
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
*
|
|
649
|
+
* @param {any} value
|
|
650
|
+
* @returns
|
|
651
|
+
*/
|
|
620
652
|
static asBoolean(value) {
|
|
621
653
|
return value !== null && value !== undefined && value !== false;
|
|
622
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
*
|
|
657
|
+
* @param {HTMLElement} el
|
|
658
|
+
* @param {string} k
|
|
659
|
+
* @param {string} v
|
|
660
|
+
* @returns
|
|
661
|
+
*/
|
|
623
662
|
static defaultValue(el, k, v) {
|
|
624
663
|
if (!el.hasAttribute(k)) {
|
|
625
664
|
el.setAttribute(k, v);
|
|
626
665
|
}
|
|
627
666
|
return el.getAttribute(k);
|
|
628
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
*
|
|
670
|
+
* @param {string} prefix
|
|
671
|
+
* @param {HTMLElement} from
|
|
672
|
+
* @param {HTMLElement} to
|
|
673
|
+
*/
|
|
629
674
|
static forward(prefix, from, to) {
|
|
630
675
|
from.getAttributeNames()
|
|
631
676
|
.filter(a => a.startsWith(prefix))
|
|
@@ -640,7 +685,12 @@ var ful = (function (exports) {
|
|
|
640
685
|
}
|
|
641
686
|
}
|
|
642
687
|
|
|
643
|
-
class
|
|
688
|
+
class LightSlots {
|
|
689
|
+
/**
|
|
690
|
+
*
|
|
691
|
+
* @param {HTMLElement} el
|
|
692
|
+
* @returns the slots
|
|
693
|
+
*/
|
|
644
694
|
static from(el) {
|
|
645
695
|
const namedSlots = Array.from(el.childNodes)
|
|
646
696
|
.filter(el => el.matches && el.matches('[slot]'))
|
|
@@ -650,10 +700,10 @@ var ful = (function (exports) {
|
|
|
650
700
|
el.removeAttribute("slot");
|
|
651
701
|
return [slot, el];
|
|
652
702
|
});
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return
|
|
703
|
+
const slots = Object.fromEntries(namedSlots);
|
|
704
|
+
slots.default = new DocumentFragment();
|
|
705
|
+
slots.default.append(...el.childNodes);
|
|
706
|
+
return slots;
|
|
657
707
|
}
|
|
658
708
|
}
|
|
659
709
|
|
|
@@ -668,20 +718,20 @@ var ful = (function (exports) {
|
|
|
668
718
|
}
|
|
669
719
|
}
|
|
670
720
|
|
|
671
|
-
class
|
|
721
|
+
class TemplatesRegistry {
|
|
672
722
|
#idToFragment = {};
|
|
673
723
|
#idToTemplate = {};
|
|
674
724
|
#ec;
|
|
675
725
|
put(k, fragment) {
|
|
676
726
|
if (this.#ec) {
|
|
677
|
-
this.#idToTemplate[k] =
|
|
727
|
+
this.#idToTemplate[k] = Template.fromFragment(fragment, ec);
|
|
678
728
|
return;
|
|
679
729
|
}
|
|
680
730
|
this.#idToFragment[k] = fragment;
|
|
681
731
|
}
|
|
682
732
|
get(k) {
|
|
683
733
|
if (!this.#ec) {
|
|
684
|
-
throw new Error("
|
|
734
|
+
throw new Error("TemplatesRegistry is not configured");
|
|
685
735
|
}
|
|
686
736
|
const tpl = this.#idToTemplate[k];
|
|
687
737
|
if (!tpl) {
|
|
@@ -698,7 +748,50 @@ var ful = (function (exports) {
|
|
|
698
748
|
}
|
|
699
749
|
}
|
|
700
750
|
|
|
701
|
-
|
|
751
|
+
|
|
752
|
+
class ElementsRegistry {
|
|
753
|
+
#templates;
|
|
754
|
+
#tagToclass;
|
|
755
|
+
#configured;
|
|
756
|
+
#id = 0;
|
|
757
|
+
constructor(){
|
|
758
|
+
this.#templates = new TemplatesRegistry();
|
|
759
|
+
this.#tagToclass = {};
|
|
760
|
+
}
|
|
761
|
+
defineTemplate(html){
|
|
762
|
+
if(html === null || html === undefined){
|
|
763
|
+
return undefined;
|
|
764
|
+
}
|
|
765
|
+
const name = `unnamed-${++this.#id}`;
|
|
766
|
+
this.#templates.put(name, Fragments.fromHtml(html));
|
|
767
|
+
return name;
|
|
768
|
+
}
|
|
769
|
+
template(k){
|
|
770
|
+
if(k === null || k === undefined){
|
|
771
|
+
return undefined;
|
|
772
|
+
}
|
|
773
|
+
return this.#templates.get(k);
|
|
774
|
+
}
|
|
775
|
+
define(tag, klass){
|
|
776
|
+
if(!this.#configured){
|
|
777
|
+
this.#tagToclass[tag] = klass;
|
|
778
|
+
return this;
|
|
779
|
+
}
|
|
780
|
+
customElements.define(tag, klass);
|
|
781
|
+
return this;
|
|
782
|
+
}
|
|
783
|
+
configure(ec) {
|
|
784
|
+
this.#templates.configure(ec);
|
|
785
|
+
for(const [tag, klass] of Object.entries(this.#tagToclass)) {
|
|
786
|
+
customElements.define(tag, klass);
|
|
787
|
+
delete this.#tagToclass[tag];
|
|
788
|
+
}
|
|
789
|
+
this.#configured = true;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
const elements = new ElementsRegistry();
|
|
794
|
+
|
|
702
795
|
|
|
703
796
|
class UpgradeQueue {
|
|
704
797
|
#q = [];
|
|
@@ -718,22 +811,29 @@ var ful = (function (exports) {
|
|
|
718
811
|
|
|
719
812
|
const upgradeQueue = new UpgradeQueue();
|
|
720
813
|
|
|
721
|
-
const ParsedElement = (
|
|
814
|
+
const ParsedElement = (conf) => {
|
|
815
|
+
const {flags, attrs, template, slots} = conf || {};
|
|
722
816
|
|
|
723
817
|
const observed_flags = flags || [];
|
|
724
|
-
const observed_others =
|
|
818
|
+
const observed_others = attrs || [];
|
|
725
819
|
const observed = [].concat(observed_flags).concat(observed_others);
|
|
726
820
|
|
|
821
|
+
const templateId = elements.defineTemplate(template);
|
|
822
|
+
|
|
727
823
|
const k = class extends HTMLElement {
|
|
728
824
|
static get observedAttributes() {
|
|
729
825
|
return observed;
|
|
730
826
|
}
|
|
731
827
|
#parsed;
|
|
828
|
+
#initialized;
|
|
732
829
|
#internals;
|
|
733
830
|
constructor(...args) {
|
|
734
831
|
super(...args);
|
|
735
832
|
this.#internals = this.attachInternals();
|
|
736
833
|
}
|
|
834
|
+
get initialized(){
|
|
835
|
+
return this.#initialized;
|
|
836
|
+
}
|
|
737
837
|
get internals() {
|
|
738
838
|
return this.#internals;
|
|
739
839
|
}
|
|
@@ -769,34 +869,50 @@ var ful = (function (exports) {
|
|
|
769
869
|
return;
|
|
770
870
|
}
|
|
771
871
|
this.#parsed = true;
|
|
772
|
-
await this.render();
|
|
872
|
+
await this.render(elements.template(templateId), slots ? LightSlots.from(this) : undefined);
|
|
773
873
|
for (const flag of observed_flags) {
|
|
774
|
-
if(this.hasAttribute(flag)){
|
|
874
|
+
if (this.hasAttribute(flag)) {
|
|
775
875
|
this[flag] = true;
|
|
776
876
|
}
|
|
777
877
|
}
|
|
778
878
|
for (const other of observed_others) {
|
|
779
|
-
if(this.hasAttribute(other)){
|
|
879
|
+
if (this.hasAttribute(other)) {
|
|
780
880
|
this[other] = this.getAttribute(other);
|
|
781
881
|
}
|
|
782
882
|
}
|
|
783
|
-
|
|
883
|
+
this.#initialized = true;
|
|
884
|
+
}
|
|
784
885
|
};
|
|
785
886
|
|
|
786
887
|
for (const flag of observed_flags) {
|
|
888
|
+
const state = `--${flag};`;
|
|
787
889
|
Object.defineProperty(k.prototype, flag, {
|
|
788
890
|
enumerable: true,
|
|
789
891
|
configurable: true,
|
|
790
892
|
get() {
|
|
791
|
-
return this.internals.states.has(
|
|
893
|
+
return this.internals.states.has(state);
|
|
792
894
|
},
|
|
793
895
|
set(value) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
896
|
+
const v = Attributes.asBoolean(value);
|
|
897
|
+
const et = this.initialized ? 'changed' : 'init';
|
|
898
|
+
const event = new SyncEvent(`${flag}:${et}`, {
|
|
899
|
+
detail: {
|
|
900
|
+
target: this,
|
|
901
|
+
value: v
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
(async () => {
|
|
905
|
+
const [success, results] = await event.dispatchTo(this);
|
|
906
|
+
if (!success) {
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
if (v) {
|
|
910
|
+
//see https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#using_double_dash_prefixed_idents
|
|
911
|
+
this.internals.states.add(state);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
this.internals.states.delete(state);
|
|
915
|
+
})();
|
|
800
916
|
}
|
|
801
917
|
});
|
|
802
918
|
}
|
|
@@ -953,21 +1069,8 @@ var ful = (function (exports) {
|
|
|
953
1069
|
}
|
|
954
1070
|
}
|
|
955
1071
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
<div class="input-group">
|
|
959
|
-
<span data-tpl-if="slotted.ibefore" class="input-group-text">{{{{ slotted.ibefore }}}}</span>
|
|
960
|
-
<div data-tpl-if="slotted.before" data-tpl-remove="tag">{{{{ slotted.before }}}}</div>
|
|
961
|
-
{{{{ slotted.input }}}}
|
|
962
|
-
<div data-tpl-if="slotted.after" data-tpl-remove="tag">{{{{ slotted.after }}}}</div>
|
|
963
|
-
<span data-tpl-if="slotted.iafter" class="input-group-text">{{{{ slotted.iafter }}}}</span>
|
|
964
|
-
</div>
|
|
965
|
-
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
966
|
-
`));
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
const makeInputFragment = (el, slotted) => {
|
|
970
|
-
const input = el.input = slotted.input = slotted.input || (() => {
|
|
1072
|
+
const makeInputFragment = (el, template, slots) => {
|
|
1073
|
+
const input = el.input = slots.input = slots.input || (() => {
|
|
971
1074
|
const el = document.createElement("input");
|
|
972
1075
|
el.classList.add("form-control");
|
|
973
1076
|
return el;
|
|
@@ -975,18 +1078,32 @@ var ful = (function (exports) {
|
|
|
975
1078
|
input.setAttribute('ful-validation-target', '');
|
|
976
1079
|
|
|
977
1080
|
const id = input.getAttribute('id') || el.getAttribute('input-id') || Attributes.uid('ful-input');
|
|
978
|
-
Attributes.forward('input-', el,
|
|
979
|
-
Attributes.defaultValue(
|
|
980
|
-
Attributes.defaultValue(
|
|
981
|
-
Attributes.defaultValue(
|
|
1081
|
+
Attributes.forward('input-', el, slots.input);
|
|
1082
|
+
Attributes.defaultValue(slots.input, "id", id);
|
|
1083
|
+
Attributes.defaultValue(slots.input, "type", "text");
|
|
1084
|
+
Attributes.defaultValue(slots.input, "placeholder", " ");
|
|
982
1085
|
const name = el.getAttribute('name');
|
|
983
|
-
return
|
|
1086
|
+
return template.render(el, { id, name, slots });
|
|
984
1087
|
};
|
|
985
1088
|
|
|
986
|
-
class Input extends ParsedElement(
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1089
|
+
class Input extends ParsedElement({
|
|
1090
|
+
flags: [],
|
|
1091
|
+
attrs: ['value'],
|
|
1092
|
+
slots: true,
|
|
1093
|
+
template: `
|
|
1094
|
+
<label data-tpl-for="id" class="form-label">{{{{ slots.default }}}}</label>
|
|
1095
|
+
<div class="input-group">
|
|
1096
|
+
<span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>
|
|
1097
|
+
<div data-tpl-if="slots.before" data-tpl-remove="tag">{{{{ slots.before }}}}</div>
|
|
1098
|
+
{{{{ slots.input }}}}
|
|
1099
|
+
<div data-tpl-if="slots.after" data-tpl-remove="tag">{{{{ slots.after }}}}</div>
|
|
1100
|
+
<span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>
|
|
1101
|
+
</div>
|
|
1102
|
+
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
1103
|
+
`
|
|
1104
|
+
}){
|
|
1105
|
+
render(template, slots) {
|
|
1106
|
+
const fragment = makeInputFragment(this, template, slots);
|
|
990
1107
|
this.replaceChildren(fragment);
|
|
991
1108
|
}
|
|
992
1109
|
get value() {
|
|
@@ -1002,33 +1119,33 @@ var ful = (function (exports) {
|
|
|
1002
1119
|
* <link href="tom-select.bootstrap5.css" rel="stylesheet" />
|
|
1003
1120
|
*/
|
|
1004
1121
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
<
|
|
1011
|
-
{{{{
|
|
1012
|
-
<div
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1122
|
+
class Select extends ParsedElement({
|
|
1123
|
+
flags: [],
|
|
1124
|
+
attrs: ["value"],
|
|
1125
|
+
slots: true,
|
|
1126
|
+
template: `
|
|
1127
|
+
<label data-tpl-for="tsId" class="form-label">{{{{ slots.default }}}}</label>
|
|
1128
|
+
{{{{ input }}}}
|
|
1129
|
+
<div class="input-group">
|
|
1130
|
+
<span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>
|
|
1131
|
+
<div data-tpl-if="slots.before" data-tpl-remove="tag">{{{{ slots.before }}}}</div>
|
|
1132
|
+
{{{{ slots.input }}}}
|
|
1133
|
+
<div data-tpl-if="slots.after" data-tpl-remove="tag">{{{{ slots.after }}}}</div>
|
|
1134
|
+
<span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>
|
|
1135
|
+
</div>
|
|
1136
|
+
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
1137
|
+
`
|
|
1138
|
+
}) {
|
|
1020
1139
|
constructor(tsConfig) {
|
|
1021
1140
|
super();
|
|
1022
1141
|
this.tsConfig = tsConfig;
|
|
1023
1142
|
}
|
|
1024
|
-
render() {
|
|
1025
|
-
const slotted = Slots.from(this);
|
|
1026
|
-
|
|
1143
|
+
render(template, slots) {
|
|
1027
1144
|
const type = this.getAttribute("type") || 'local';
|
|
1028
1145
|
const remote = type != 'local';
|
|
1029
1146
|
const loadOnce = this.getAttribute('load') != 'always';
|
|
1030
1147
|
const name = this.getAttribute('name');
|
|
1031
|
-
const input =
|
|
1148
|
+
const input = slots.input = slots.input || (() => {
|
|
1032
1149
|
return document.createElement("select");
|
|
1033
1150
|
})();
|
|
1034
1151
|
input.setAttribute('ful-validation-target', '');
|
|
@@ -1041,7 +1158,7 @@ var ful = (function (exports) {
|
|
|
1041
1158
|
|
|
1042
1159
|
//tomselect needs the input to have a parent.
|
|
1043
1160
|
//se we move the input to a fragment
|
|
1044
|
-
|
|
1161
|
+
slots.input = Fragments.from(input);
|
|
1045
1162
|
|
|
1046
1163
|
this.loaded = !remote;
|
|
1047
1164
|
|
|
@@ -1064,7 +1181,7 @@ var ful = (function (exports) {
|
|
|
1064
1181
|
}
|
|
1065
1182
|
const type = query && query.hasOwnProperty('byId') ? 'id' : 'query';
|
|
1066
1183
|
const qvalue = type === 'id' ? query.byId : query;
|
|
1067
|
-
const data = await (this
|
|
1184
|
+
const data = await (this.#loader ? this.#loader(qvalue, type) : []);
|
|
1068
1185
|
if (type !== 'id') {
|
|
1069
1186
|
this.loaded = true;
|
|
1070
1187
|
}
|
|
@@ -1079,7 +1196,15 @@ var ful = (function (exports) {
|
|
|
1079
1196
|
} : {}, tsDefaultConfig, this.tsConfig));
|
|
1080
1197
|
//we remove the input to move it
|
|
1081
1198
|
input.remove();
|
|
1082
|
-
|
|
1199
|
+
template.renderTo(this, { id, tsId, name, input, slots });
|
|
1200
|
+
}
|
|
1201
|
+
#loader;
|
|
1202
|
+
set loader(l){
|
|
1203
|
+
this.#loader = l;
|
|
1204
|
+
// loader can be configured later so we load now
|
|
1205
|
+
if(this.hasAttribute('value')){
|
|
1206
|
+
this.value = this.getAttribute("value");
|
|
1207
|
+
}
|
|
1083
1208
|
}
|
|
1084
1209
|
set value(v) {
|
|
1085
1210
|
(async () => {
|
|
@@ -1095,33 +1220,34 @@ var ful = (function (exports) {
|
|
|
1095
1220
|
}
|
|
1096
1221
|
}
|
|
1097
1222
|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
<
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
<
|
|
1108
|
-
{{{{
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1223
|
+
class RadioGroup extends ParsedElement({
|
|
1224
|
+
flags: ['disabled'],
|
|
1225
|
+
attrs: ['value'],
|
|
1226
|
+
slots: true,
|
|
1227
|
+
template: `
|
|
1228
|
+
<fieldset>
|
|
1229
|
+
<legend class="form-label">
|
|
1230
|
+
{{{{ slots.default }}}}
|
|
1231
|
+
</legend>
|
|
1232
|
+
<header data-tpl-if="slots.header">
|
|
1233
|
+
{{{{ slots.header }}}}
|
|
1234
|
+
</header>
|
|
1235
|
+
<section>
|
|
1236
|
+
<label data-tpl-each="inputsAndLabels" data-tpl-var="ial">
|
|
1237
|
+
{{{{ ial[0] }}}}
|
|
1238
|
+
{{{{ ial[1] }}}}
|
|
1239
|
+
</label>
|
|
1240
|
+
</section>
|
|
1241
|
+
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
1242
|
+
<footer data-tpl-if="slots.footer">
|
|
1243
|
+
{{{{ slots.footer }}}}
|
|
1244
|
+
</footer>
|
|
1245
|
+
</fieldset>
|
|
1246
|
+
`
|
|
1247
|
+
}) {
|
|
1248
|
+
render(template, slots) {
|
|
1123
1249
|
const name = this.getAttribute('name') || Attributes.uid('ful-radiogroup');
|
|
1124
|
-
const radioEls = Array.from(
|
|
1250
|
+
const radioEls = Array.from(slots.default.querySelectorAll('ful-radio'));
|
|
1125
1251
|
const inputsAndLabels = radioEls.map(el => {
|
|
1126
1252
|
const input = document.createElement('input');
|
|
1127
1253
|
input.setAttribute('type', 'radio');
|
|
@@ -1134,11 +1260,7 @@ var ful = (function (exports) {
|
|
|
1134
1260
|
return [input, label];
|
|
1135
1261
|
});
|
|
1136
1262
|
radioEls.forEach(el => el.remove());
|
|
1137
|
-
|
|
1138
|
-
name: name,
|
|
1139
|
-
slotted: slotted,
|
|
1140
|
-
inputsAndLabels: inputsAndLabels
|
|
1141
|
-
});
|
|
1263
|
+
template.renderTo(this, {name, slots, inputsAndLabels});
|
|
1142
1264
|
}
|
|
1143
1265
|
get value() {
|
|
1144
1266
|
const checked = this.querySelector('input[type=radio]:checked');
|
|
@@ -1149,17 +1271,17 @@ var ful = (function (exports) {
|
|
|
1149
1271
|
}
|
|
1150
1272
|
}
|
|
1151
1273
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
<div class="ful-spinner-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1274
|
+
class Spinner extends ParsedElement({
|
|
1275
|
+
slots: true,
|
|
1276
|
+
template: `
|
|
1277
|
+
<div class="ful-spinner-wrapper">
|
|
1278
|
+
<div class="ful-spinner-text">{{{{ slots.default }}}}</div>
|
|
1279
|
+
<div class="ful-spinner-icon"></div>
|
|
1280
|
+
</div>
|
|
1281
|
+
`
|
|
1282
|
+
}) {
|
|
1283
|
+
render(template, slots) {
|
|
1284
|
+
template.renderTo(this, { slots });
|
|
1163
1285
|
}
|
|
1164
1286
|
}
|
|
1165
1287
|
|
|
@@ -1235,47 +1357,36 @@ var ful = (function (exports) {
|
|
|
1235
1357
|
}
|
|
1236
1358
|
}
|
|
1237
1359
|
|
|
1238
|
-
class CustomElements {
|
|
1239
|
-
static configure(ec) {
|
|
1240
|
-
templates.configure(ec);
|
|
1241
|
-
customElements.define('ful-spinner', Spinner);
|
|
1242
|
-
customElements.define('ful-input', Input);
|
|
1243
|
-
customElements.define('ful-radio-group', RadioGroup);
|
|
1244
|
-
customElements.define('ful-select', Select);
|
|
1245
|
-
customElements.define('ful-form', Form);
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
1360
|
exports.Attributes = Attributes;
|
|
1250
1361
|
exports.AuthorizationCodeFlow = AuthorizationCodeFlow;
|
|
1251
1362
|
exports.AuthorizationCodeFlowInterceptor = AuthorizationCodeFlowInterceptor;
|
|
1252
1363
|
exports.AuthorizationCodeFlowSession = AuthorizationCodeFlowSession;
|
|
1253
1364
|
exports.Base64 = Base64;
|
|
1254
|
-
exports.
|
|
1365
|
+
exports.ElementsRegistry = ElementsRegistry;
|
|
1255
1366
|
exports.Failure = Failure;
|
|
1256
1367
|
exports.Form = Form;
|
|
1257
1368
|
exports.Fragments = Fragments;
|
|
1258
1369
|
exports.Hex = Hex;
|
|
1259
1370
|
exports.HttpClient = HttpClient;
|
|
1260
1371
|
exports.Input = Input;
|
|
1372
|
+
exports.LightSlots = LightSlots;
|
|
1261
1373
|
exports.LocalStorage = LocalStorage;
|
|
1262
1374
|
exports.Nodes = Nodes;
|
|
1263
1375
|
exports.ParsedElement = ParsedElement;
|
|
1264
1376
|
exports.RadioGroup = RadioGroup;
|
|
1265
1377
|
exports.Select = Select;
|
|
1266
1378
|
exports.SessionStorage = SessionStorage;
|
|
1267
|
-
exports.Slots = Slots;
|
|
1268
1379
|
exports.Spinner = Spinner;
|
|
1269
1380
|
exports.SyncEvent = SyncEvent;
|
|
1270
|
-
exports.
|
|
1381
|
+
exports.TemplatesRegistry = TemplatesRegistry;
|
|
1271
1382
|
exports.VersionedStorage = VersionedStorage;
|
|
1272
1383
|
exports.Wizard = Wizard;
|
|
1384
|
+
exports.elements = elements;
|
|
1273
1385
|
exports.jsonPatch = jsonPatch;
|
|
1274
1386
|
exports.jsonPost = jsonPost;
|
|
1275
1387
|
exports.jsonPut = jsonPut;
|
|
1276
1388
|
exports.jsonRequest = jsonRequest;
|
|
1277
1389
|
exports.makeInputFragment = makeInputFragment;
|
|
1278
|
-
exports.templates = templates;
|
|
1279
1390
|
exports.timing = timing;
|
|
1280
1391
|
|
|
1281
1392
|
Object.defineProperty(exports, '__esModule', { value: true });
|