@optionfactory/ful 0.49.0 → 0.51.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 +242 -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 +238 -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,20 @@ var ful = (function (exports) {
|
|
|
953
1069
|
}
|
|
954
1070
|
}
|
|
955
1071
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
const input = el.input = slotted.input = slotted.input || (() => {
|
|
1072
|
+
const INPUT_TEMPLATE = `
|
|
1073
|
+
<label data-tpl-for="id" class="form-label">{{{{ slots.default }}}}</label>
|
|
1074
|
+
<div class="input-group">
|
|
1075
|
+
<span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>
|
|
1076
|
+
<div data-tpl-if="slots.before" data-tpl-remove="tag">{{{{ slots.before }}}}</div>
|
|
1077
|
+
{{{{ slots.input }}}}
|
|
1078
|
+
<div data-tpl-if="slots.after" data-tpl-remove="tag">{{{{ slots.after }}}}</div>
|
|
1079
|
+
<span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>
|
|
1080
|
+
</div>
|
|
1081
|
+
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
1082
|
+
`;
|
|
1083
|
+
|
|
1084
|
+
const makeInputFragment = (el, template, slots) => {
|
|
1085
|
+
const input = el.input = slots.input = slots.input || (() => {
|
|
971
1086
|
const el = document.createElement("input");
|
|
972
1087
|
el.classList.add("form-control");
|
|
973
1088
|
return el;
|
|
@@ -975,18 +1090,22 @@ var ful = (function (exports) {
|
|
|
975
1090
|
input.setAttribute('ful-validation-target', '');
|
|
976
1091
|
|
|
977
1092
|
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(
|
|
1093
|
+
Attributes.forward('input-', el, slots.input);
|
|
1094
|
+
Attributes.defaultValue(slots.input, "id", id);
|
|
1095
|
+
Attributes.defaultValue(slots.input, "type", "text");
|
|
1096
|
+
Attributes.defaultValue(slots.input, "placeholder", " ");
|
|
982
1097
|
const name = el.getAttribute('name');
|
|
983
|
-
return
|
|
1098
|
+
return template.render(el, { id, name, slots });
|
|
984
1099
|
};
|
|
985
1100
|
|
|
986
|
-
class Input extends ParsedElement(
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1101
|
+
class Input extends ParsedElement({
|
|
1102
|
+
flags: [],
|
|
1103
|
+
attrs: ['value'],
|
|
1104
|
+
slots: true,
|
|
1105
|
+
template: INPUT_TEMPLATE
|
|
1106
|
+
}){
|
|
1107
|
+
render(template, slots) {
|
|
1108
|
+
const fragment = makeInputFragment(this, template, slots);
|
|
990
1109
|
this.replaceChildren(fragment);
|
|
991
1110
|
}
|
|
992
1111
|
get value() {
|
|
@@ -1002,33 +1121,33 @@ var ful = (function (exports) {
|
|
|
1002
1121
|
* <link href="tom-select.bootstrap5.css" rel="stylesheet" />
|
|
1003
1122
|
*/
|
|
1004
1123
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
<
|
|
1011
|
-
{{{{
|
|
1012
|
-
<div
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1124
|
+
class Select extends ParsedElement({
|
|
1125
|
+
flags: [],
|
|
1126
|
+
attrs: ["value"],
|
|
1127
|
+
slots: true,
|
|
1128
|
+
template: `
|
|
1129
|
+
<label data-tpl-for="tsId" class="form-label">{{{{ slots.default }}}}</label>
|
|
1130
|
+
{{{{ input }}}}
|
|
1131
|
+
<div class="input-group">
|
|
1132
|
+
<span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>
|
|
1133
|
+
<div data-tpl-if="slots.before" data-tpl-remove="tag">{{{{ slots.before }}}}</div>
|
|
1134
|
+
{{{{ slots.input }}}}
|
|
1135
|
+
<div data-tpl-if="slots.after" data-tpl-remove="tag">{{{{ slots.after }}}}</div>
|
|
1136
|
+
<span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>
|
|
1137
|
+
</div>
|
|
1138
|
+
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
1139
|
+
`
|
|
1140
|
+
}) {
|
|
1020
1141
|
constructor(tsConfig) {
|
|
1021
1142
|
super();
|
|
1022
1143
|
this.tsConfig = tsConfig;
|
|
1023
1144
|
}
|
|
1024
|
-
render() {
|
|
1025
|
-
const slotted = Slots.from(this);
|
|
1026
|
-
|
|
1145
|
+
render(template, slots) {
|
|
1027
1146
|
const type = this.getAttribute("type") || 'local';
|
|
1028
1147
|
const remote = type != 'local';
|
|
1029
1148
|
const loadOnce = this.getAttribute('load') != 'always';
|
|
1030
1149
|
const name = this.getAttribute('name');
|
|
1031
|
-
const input =
|
|
1150
|
+
const input = slots.input = slots.input || (() => {
|
|
1032
1151
|
return document.createElement("select");
|
|
1033
1152
|
})();
|
|
1034
1153
|
input.setAttribute('ful-validation-target', '');
|
|
@@ -1041,7 +1160,7 @@ var ful = (function (exports) {
|
|
|
1041
1160
|
|
|
1042
1161
|
//tomselect needs the input to have a parent.
|
|
1043
1162
|
//se we move the input to a fragment
|
|
1044
|
-
|
|
1163
|
+
slots.input = Fragments.from(input);
|
|
1045
1164
|
|
|
1046
1165
|
this.loaded = !remote;
|
|
1047
1166
|
|
|
@@ -1064,7 +1183,7 @@ var ful = (function (exports) {
|
|
|
1064
1183
|
}
|
|
1065
1184
|
const type = query && query.hasOwnProperty('byId') ? 'id' : 'query';
|
|
1066
1185
|
const qvalue = type === 'id' ? query.byId : query;
|
|
1067
|
-
const data = await (this
|
|
1186
|
+
const data = await (this.#loader ? this.#loader(qvalue, type) : []);
|
|
1068
1187
|
if (type !== 'id') {
|
|
1069
1188
|
this.loaded = true;
|
|
1070
1189
|
}
|
|
@@ -1079,7 +1198,15 @@ var ful = (function (exports) {
|
|
|
1079
1198
|
} : {}, tsDefaultConfig, this.tsConfig));
|
|
1080
1199
|
//we remove the input to move it
|
|
1081
1200
|
input.remove();
|
|
1082
|
-
|
|
1201
|
+
template.renderTo(this, { id, tsId, name, input, slots });
|
|
1202
|
+
}
|
|
1203
|
+
#loader;
|
|
1204
|
+
set loader(l){
|
|
1205
|
+
this.#loader = l;
|
|
1206
|
+
// loader can be configured later so we load now
|
|
1207
|
+
if(this.hasAttribute('value')){
|
|
1208
|
+
this.value = this.getAttribute("value");
|
|
1209
|
+
}
|
|
1083
1210
|
}
|
|
1084
1211
|
set value(v) {
|
|
1085
1212
|
(async () => {
|
|
@@ -1095,33 +1222,34 @@ var ful = (function (exports) {
|
|
|
1095
1222
|
}
|
|
1096
1223
|
}
|
|
1097
1224
|
|
|
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
|
-
|
|
1225
|
+
class RadioGroup extends ParsedElement({
|
|
1226
|
+
flags: ['disabled'],
|
|
1227
|
+
attrs: ['value'],
|
|
1228
|
+
slots: true,
|
|
1229
|
+
template: `
|
|
1230
|
+
<fieldset>
|
|
1231
|
+
<legend class="form-label">
|
|
1232
|
+
{{{{ slots.default }}}}
|
|
1233
|
+
</legend>
|
|
1234
|
+
<header data-tpl-if="slots.header">
|
|
1235
|
+
{{{{ slots.header }}}}
|
|
1236
|
+
</header>
|
|
1237
|
+
<section>
|
|
1238
|
+
<label data-tpl-each="inputsAndLabels" data-tpl-var="ial">
|
|
1239
|
+
{{{{ ial[0] }}}}
|
|
1240
|
+
{{{{ ial[1] }}}}
|
|
1241
|
+
</label>
|
|
1242
|
+
</section>
|
|
1243
|
+
<ful-field-error data-tpl-if="name" data-tpl-field="name"></ful-field-error>
|
|
1244
|
+
<footer data-tpl-if="slots.footer">
|
|
1245
|
+
{{{{ slots.footer }}}}
|
|
1246
|
+
</footer>
|
|
1247
|
+
</fieldset>
|
|
1248
|
+
`
|
|
1249
|
+
}) {
|
|
1250
|
+
render(template, slots) {
|
|
1123
1251
|
const name = this.getAttribute('name') || Attributes.uid('ful-radiogroup');
|
|
1124
|
-
const radioEls = Array.from(
|
|
1252
|
+
const radioEls = Array.from(slots.default.querySelectorAll('ful-radio'));
|
|
1125
1253
|
const inputsAndLabels = radioEls.map(el => {
|
|
1126
1254
|
const input = document.createElement('input');
|
|
1127
1255
|
input.setAttribute('type', 'radio');
|
|
@@ -1134,11 +1262,7 @@ var ful = (function (exports) {
|
|
|
1134
1262
|
return [input, label];
|
|
1135
1263
|
});
|
|
1136
1264
|
radioEls.forEach(el => el.remove());
|
|
1137
|
-
|
|
1138
|
-
name: name,
|
|
1139
|
-
slotted: slotted,
|
|
1140
|
-
inputsAndLabels: inputsAndLabels
|
|
1141
|
-
});
|
|
1265
|
+
template.renderTo(this, {name, slots, inputsAndLabels});
|
|
1142
1266
|
}
|
|
1143
1267
|
get value() {
|
|
1144
1268
|
const checked = this.querySelector('input[type=radio]:checked');
|
|
@@ -1149,17 +1273,17 @@ var ful = (function (exports) {
|
|
|
1149
1273
|
}
|
|
1150
1274
|
}
|
|
1151
1275
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
<div class="ful-spinner-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1276
|
+
class Spinner extends ParsedElement({
|
|
1277
|
+
slots: true,
|
|
1278
|
+
template: `
|
|
1279
|
+
<div class="ful-spinner-wrapper">
|
|
1280
|
+
<div class="ful-spinner-text">{{{{ slots.default }}}}</div>
|
|
1281
|
+
<div class="ful-spinner-icon"></div>
|
|
1282
|
+
</div>
|
|
1283
|
+
`
|
|
1284
|
+
}) {
|
|
1285
|
+
render(template, slots) {
|
|
1286
|
+
template.renderTo(this, { slots });
|
|
1163
1287
|
}
|
|
1164
1288
|
}
|
|
1165
1289
|
|
|
@@ -1235,47 +1359,37 @@ var ful = (function (exports) {
|
|
|
1235
1359
|
}
|
|
1236
1360
|
}
|
|
1237
1361
|
|
|
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
1362
|
exports.Attributes = Attributes;
|
|
1250
1363
|
exports.AuthorizationCodeFlow = AuthorizationCodeFlow;
|
|
1251
1364
|
exports.AuthorizationCodeFlowInterceptor = AuthorizationCodeFlowInterceptor;
|
|
1252
1365
|
exports.AuthorizationCodeFlowSession = AuthorizationCodeFlowSession;
|
|
1253
1366
|
exports.Base64 = Base64;
|
|
1254
|
-
exports.
|
|
1367
|
+
exports.ElementsRegistry = ElementsRegistry;
|
|
1255
1368
|
exports.Failure = Failure;
|
|
1256
1369
|
exports.Form = Form;
|
|
1257
1370
|
exports.Fragments = Fragments;
|
|
1258
1371
|
exports.Hex = Hex;
|
|
1259
1372
|
exports.HttpClient = HttpClient;
|
|
1373
|
+
exports.INPUT_TEMPLATE = INPUT_TEMPLATE;
|
|
1260
1374
|
exports.Input = Input;
|
|
1375
|
+
exports.LightSlots = LightSlots;
|
|
1261
1376
|
exports.LocalStorage = LocalStorage;
|
|
1262
1377
|
exports.Nodes = Nodes;
|
|
1263
1378
|
exports.ParsedElement = ParsedElement;
|
|
1264
1379
|
exports.RadioGroup = RadioGroup;
|
|
1265
1380
|
exports.Select = Select;
|
|
1266
1381
|
exports.SessionStorage = SessionStorage;
|
|
1267
|
-
exports.Slots = Slots;
|
|
1268
1382
|
exports.Spinner = Spinner;
|
|
1269
1383
|
exports.SyncEvent = SyncEvent;
|
|
1270
|
-
exports.
|
|
1384
|
+
exports.TemplatesRegistry = TemplatesRegistry;
|
|
1271
1385
|
exports.VersionedStorage = VersionedStorage;
|
|
1272
1386
|
exports.Wizard = Wizard;
|
|
1387
|
+
exports.elements = elements;
|
|
1273
1388
|
exports.jsonPatch = jsonPatch;
|
|
1274
1389
|
exports.jsonPost = jsonPost;
|
|
1275
1390
|
exports.jsonPut = jsonPut;
|
|
1276
1391
|
exports.jsonRequest = jsonRequest;
|
|
1277
1392
|
exports.makeInputFragment = makeInputFragment;
|
|
1278
|
-
exports.templates = templates;
|
|
1279
1393
|
exports.timing = timing;
|
|
1280
1394
|
|
|
1281
1395
|
Object.defineProperty(exports, '__esModule', { value: true });
|