coles-solid-library 0.2.8 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/checkbox.d.ts +11 -0
- package/dist/components/Form/formGroup.d.ts +47 -7
- package/dist/components/Form/formHelp/formArray.d.ts +84 -7
- package/dist/components/Form/formHelp/models.d.ts +1 -1
- package/dist/components/Icon/icon.d.ts +2 -29
- package/dist/components/Input/inputV2.d.ts +12 -0
- package/dist/components/Menu/menu.d.ts +2 -0
- package/dist/components/Menu/menuContext.d.ts +14 -0
- package/dist/components/Menu/menuDropdown.d.ts +1 -1
- package/dist/components/Radio/radio.d.ts +13 -0
- package/dist/components/Radio/radioGroup.d.ts +23 -0
- package/dist/components/Select/select.component.d.ts +1 -9
- package/dist/components/Select/selectContext.d.ts +14 -0
- package/dist/components/TableV2/droprow.d.ts +1 -0
- package/dist/components/TableV2/formArrayTable.d.ts +18 -0
- package/dist/components/TableV2/table.d.ts +0 -1
- package/dist/components/TableV2/tableProvider.d.ts +6 -2
- package/dist/components/modal/popup.component.d.ts +24 -0
- package/dist/components/popup/popup.component.d.ts +2 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.esm.js +1785 -837
- package/package.json +3 -1
- package/readme.md +1 -4
package/dist/index.esm.js
CHANGED
|
@@ -516,11 +516,11 @@ function styleInject(css, ref) {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
var css_248z$
|
|
519
|
+
var css_248z$j = ".Button_customButtonStyle__1TOXE {\n border-radius: 8px;\n font-family: \"Roboto, sans-serif\";\n padding: 8px 8px;\n border: none;\n outline: none;\n transition: transform 0.2s ease, background 0.2s ease;\n}\n.Button_customButtonStyle__1TOXE:active {\n transform: scale(0.9);\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);\n}\n.Button_customButtonStyle__1TOXE:not(:disabled):hover {\n cursor: pointer;\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);\n}\n.Button_customButtonStyle__1TOXE:disabled:hover {\n cursor: not-allowed;\n}\n\n.Button_primary__auYD2 {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.Button_primaryVariant__NbKc2 {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.Button_secondary__DVppl {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button_secondaryVariant__suwON {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button_background__E82uk {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.Button_surface__EF0NA {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.Button_surfaceVariant__-SFxJ {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.Button_container__E1Hq5 {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.Button_error__Yab6f {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.Button_borderPrimary__uJ-qE {\n border: 1px solid var(--primary-color, #4CAF50);\n}\n\n.Button_borderPrimaryVariant__qkdEf {\n border: 1px solid var(--primary-color-varient, #43A047);\n}\n\n.Button_borderSecondary__-P9is {\n border: 1px solid var(--secondary-color, #14b9c3);\n}\n\n.Button_borderSecondaryVariant__6dCZ7 {\n border: 1px solid var(--secondary-color-varient, #0b969f);\n}\n\n.Button_borderBackground__lm7yB {\n border: 1px solid var(--background-color, #ffffff);\n}\n\n.Button_borderSurface__AJQxT {\n border: 1px solid var(--surface-color, #EEEEEE);\n}\n\n.Button_borderSurfaceVariant__Cfk2f {\n border: 1px solid var(--surface-color-variant, #ccc);\n}\n\n.Button_borderContainer__GXDhL {\n border: 1px solid var(--container-color, #ffffff);\n}\n\n.Button_borderError__f2lZ- {\n border: 1px solid var(--error-color, #B00020);\n}\n\n.Button_none__vPYWY {\n border: none;\n}\n\n.Button_transparent__aet0J {\n background-color: transparent !important;\n border: none;\n outline: none;\n padding: 0px;\n margin: 0px;\n}";
|
|
520
520
|
var style$8 = {"customButtonStyle":"Button_customButtonStyle__1TOXE","primary":"Button_primary__auYD2","primaryVariant":"Button_primaryVariant__NbKc2","secondary":"Button_secondary__DVppl","secondaryVariant":"Button_secondaryVariant__suwON","background":"Button_background__E82uk","surface":"Button_surface__EF0NA","surfaceVariant":"Button_surfaceVariant__-SFxJ","container":"Button_container__E1Hq5","error":"Button_error__Yab6f","borderPrimary":"Button_borderPrimary__uJ-qE","borderPrimaryVariant":"Button_borderPrimaryVariant__qkdEf","borderSecondary":"Button_borderSecondary__-P9is","borderSecondaryVariant":"Button_borderSecondaryVariant__6dCZ7","borderBackground":"Button_borderBackground__lm7yB","borderSurface":"Button_borderSurface__AJQxT","borderSurfaceVariant":"Button_borderSurfaceVariant__Cfk2f","borderContainer":"Button_borderContainer__GXDhL","borderError":"Button_borderError__f2lZ-","none":"Button_none__vPYWY","transparent":"Button_transparent__aet0J"};
|
|
521
|
-
styleInject(css_248z$
|
|
521
|
+
styleInject(css_248z$j);
|
|
522
522
|
|
|
523
|
-
var _tmpl$$
|
|
523
|
+
var _tmpl$$o = /*#__PURE__*/template(`<button>`);
|
|
524
524
|
const Button = props => {
|
|
525
525
|
const [local, others] = splitProps(props, ["theme", "transparent", "borderTheme"]);
|
|
526
526
|
const isTransparent = () => {
|
|
@@ -529,6 +529,7 @@ const Button = props => {
|
|
|
529
529
|
}
|
|
530
530
|
return false;
|
|
531
531
|
};
|
|
532
|
+
const [buttonRef, setButtonRef] = createSignal();
|
|
532
533
|
const transparent = createMemo(() => isTransparent() ? style$8.transparent : "");
|
|
533
534
|
const getBorderThemeName = theme => {
|
|
534
535
|
switch (theme) {
|
|
@@ -555,7 +556,12 @@ const Button = props => {
|
|
|
555
556
|
}
|
|
556
557
|
};
|
|
557
558
|
return (() => {
|
|
558
|
-
var _el$ = _tmpl$$
|
|
559
|
+
var _el$ = _tmpl$$o();
|
|
560
|
+
use(ref => {
|
|
561
|
+
setButtonRef(ref);
|
|
562
|
+
// @ts-ignore
|
|
563
|
+
props?.ref?.(ref);
|
|
564
|
+
}, _el$);
|
|
559
565
|
spread(_el$, mergeProps(others, {
|
|
560
566
|
get ["class"]() {
|
|
561
567
|
return `${style$8[local?.theme ?? "container"]} ${style$8[getBorderThemeName(local?.borderTheme ?? 'none')]} ${style$8.customButtonStyle} ${transparent()} ${props?.class ?? ""} `;
|
|
@@ -566,12 +572,12 @@ const Button = props => {
|
|
|
566
572
|
})();
|
|
567
573
|
};
|
|
568
574
|
|
|
569
|
-
var css_248z$
|
|
575
|
+
var css_248z$i = ".Carosel-module_carouselHeader__JAhGf {\n display: flex;\n flex-direction: row;\n width: 100%;\n}\n.Carosel-module_carouselHeader__JAhGf div {\n flex-grow: 1;\n text-align: center;\n}\n.Carosel-module_carouselHeader__JAhGf button {\n flex-basis: 1;\n}\n\n.Carosel-module_carousel__cHoMx {\n position: relative;\n width: 100%;\n margin: auto;\n overflow: hidden;\n border-radius: 10px;\n}\n\n.Carosel-module_carouselSlides__MgPU3 {\n display: flex;\n transition: transform 0.5s ease-in-out;\n width: 100%;\n height: 100%;\n}\n\n.Carosel-module_carouselSlide__--NkY {\n min-width: 100%;\n padding: 5px;\n box-sizing: border-box;\n}\n\n.Carosel-module_carouselButton__E1gGu {\n opacity: 0.5;\n border: none;\n padding: 10px;\n cursor: pointer;\n}\n.Carosel-module_carouselButton__E1gGu:hover {\n opacity: 1;\n}";
|
|
570
576
|
var style$7 = {"carouselHeader":"Carosel-module_carouselHeader__JAhGf","carousel":"Carosel-module_carousel__cHoMx","carouselSlides":"Carosel-module_carouselSlides__MgPU3","carouselSlide":"Carosel-module_carouselSlide__--NkY","carouselButton":"Carosel-module_carouselButton__E1gGu"};
|
|
571
|
-
styleInject(css_248z$
|
|
577
|
+
styleInject(css_248z$i);
|
|
572
578
|
|
|
573
|
-
var _tmpl$$
|
|
574
|
-
_tmpl$2$
|
|
579
|
+
var _tmpl$$n = /*#__PURE__*/template(`<div>No <!> Found`),
|
|
580
|
+
_tmpl$2$c = /*#__PURE__*/template(`<div>No Elements Found`),
|
|
575
581
|
_tmpl$3$4 = /*#__PURE__*/template(`<div>`),
|
|
576
582
|
_tmpl$4$2 = /*#__PURE__*/template(`<div><div><div></div></div><div>`);
|
|
577
583
|
const carouselTitleContext = createContext(createSignal([]));
|
|
@@ -643,13 +649,13 @@ const Carousel = ({
|
|
|
643
649
|
}
|
|
644
650
|
}
|
|
645
651
|
return props.notFoundName ? (() => {
|
|
646
|
-
var _el$ = _tmpl$$
|
|
652
|
+
var _el$ = _tmpl$$n(),
|
|
647
653
|
_el$2 = _el$.firstChild,
|
|
648
654
|
_el$4 = _el$2.nextSibling;
|
|
649
655
|
_el$4.nextSibling;
|
|
650
656
|
insert(_el$, () => props.notFoundName, _el$4);
|
|
651
657
|
return _el$;
|
|
652
|
-
})() : _tmpl$2$
|
|
658
|
+
})() : _tmpl$2$c();
|
|
653
659
|
});
|
|
654
660
|
// ----- Functions -----
|
|
655
661
|
const nextSlide = () => {
|
|
@@ -749,12 +755,12 @@ const Slide = props => {
|
|
|
749
755
|
return createMemo(() => props.children);
|
|
750
756
|
};
|
|
751
757
|
|
|
752
|
-
var css_248z$
|
|
758
|
+
var css_248z$h = ".Chip-module_Chip__HWK4W {\n display: flex;\n flex-direction: row;\n padding: 5px 10px;\n margin-left: 8px;\n border-radius: 15px;\n height: -moz-max-content;\n height: max-content;\n min-width: -moz-min-content;\n min-width: min-content;\n max-width: -moz-max-content;\n max-width: max-content;\n margin: 5px;\n}\n.Chip-module_Chip__HWK4W span {\n margin: 0px 2px;\n width: -moz-max-content;\n width: max-content;\n max-width: 10em;\n text-overflow: ellipsis;\n}\n.Chip-module_Chip__HWK4W button {\n font-size: 1rem !important;\n height: -moz-min-content;\n height: min-content;\n margin: auto 0px;\n padding: 0px 4px !important;\n margin-left: 5px !important;\n border-radius: 8px;\n}\n\n.Chip-module_removeChipButton__kl1mU {\n margin: 0 !important;\n margin-left: 5px !important;\n padding: 0 !important;\n font-size: 1rem !important;\n}\n\n.Chip-module_hover__fvVQS:hover {\n cursor: pointer;\n}\n\n.Chip-module_tertiary__TtdnV {\n background-color: inherit;\n color: var(--on-container-color, #000);\n border: 1px solid var(--primary-color, #4CAF50);\n margin-right: 6px;\n}\n.Chip-module_tertiary__TtdnV button {\n background-color: inherit;\n color: var(--on-container-color, #000);\n font-weight: 700;\n}";
|
|
753
759
|
var style$6 = {"Chip":"Chip-module_Chip__HWK4W","removeChipButton":"Chip-module_removeChipButton__kl1mU","hover":"Chip-module_hover__fvVQS","tertiary":"Chip-module_tertiary__TtdnV"};
|
|
754
|
-
styleInject(css_248z$
|
|
760
|
+
styleInject(css_248z$h);
|
|
755
761
|
|
|
756
|
-
var _tmpl$$
|
|
757
|
-
_tmpl$2$
|
|
762
|
+
var _tmpl$$m = /*#__PURE__*/template(`<span>`),
|
|
763
|
+
_tmpl$2$b = /*#__PURE__*/template(`<span>:`),
|
|
758
764
|
_tmpl$3$3 = /*#__PURE__*/template(`<span><span>`);
|
|
759
765
|
const Chip = props => {
|
|
760
766
|
const hoverChip = props.onClick ? `${style$6.hover}` : "";
|
|
@@ -768,10 +774,10 @@ const Chip = props => {
|
|
|
768
774
|
},
|
|
769
775
|
get children() {
|
|
770
776
|
return [(() => {
|
|
771
|
-
var _el$2 = _tmpl$$
|
|
777
|
+
var _el$2 = _tmpl$$m();
|
|
772
778
|
insert(_el$2, () => props.key);
|
|
773
779
|
return _el$2;
|
|
774
|
-
})(), _tmpl$2$
|
|
780
|
+
})(), _tmpl$2$b()];
|
|
775
781
|
}
|
|
776
782
|
}), _el$4);
|
|
777
783
|
insert(_el$4, () => ' ' + props.value);
|
|
@@ -798,12 +804,12 @@ const Chip = props => {
|
|
|
798
804
|
};
|
|
799
805
|
delegateEvents(["click"]);
|
|
800
806
|
|
|
801
|
-
var css_248z$
|
|
807
|
+
var css_248z$g = ".chipbar-module_chipbar__PjssB {\n display: flex;\n flex-direction: row;\n min-width: 100%;\n width: -moz-max-content;\n width: max-content;\n max-width: 100%;\n padding: var(--spacing-1, 8px) 0px;\n border-bottom: 1px solid var(--on-background, white);\n}\n\n.chipbar-module_chipContainer__lnYfX {\n display: flex;\n flex-direction: row;\n overflow-x: hidden;\n scroll-behavior: smooth;\n flex-grow: 1;\n}\n.chipbar-module_chipContainer__lnYfX span {\n height: -moz-min-content;\n height: min-content;\n margin: auto 0px;\n}\n.chipbar-module_chipContainer__lnYfX span button {\n width: -moz-max-content;\n width: max-content;\n padding: 5px;\n}\n\n.chipbar-module_leftArrow__OS8vV {\n margin-right: 10px;\n align-self: flex-start;\n margin: auto 0px;\n}\n\n.chipbar-module_rightArrow__T4ubJ {\n margin-left: 10px;\n align-self: flex-end;\n margin: auto 0px;\n}";
|
|
802
808
|
var style$5 = {"chipbar":"chipbar-module_chipbar__PjssB","chipContainer":"chipbar-module_chipContainer__lnYfX","leftArrow":"chipbar-module_leftArrow__OS8vV","rightArrow":"chipbar-module_rightArrow__T4ubJ"};
|
|
803
|
-
styleInject(css_248z$
|
|
809
|
+
styleInject(css_248z$g);
|
|
804
810
|
|
|
805
|
-
var _tmpl$$
|
|
806
|
-
_tmpl$2$
|
|
811
|
+
var _tmpl$$l = /*#__PURE__*/template(`<span>`),
|
|
812
|
+
_tmpl$2$a = /*#__PURE__*/template(`<div><div>`);
|
|
807
813
|
function Chipbar(props) {
|
|
808
814
|
const hasSignalChips = props.chips !== undefined;
|
|
809
815
|
const [chipContainer, setChipContainer] = createSignal();
|
|
@@ -857,14 +863,14 @@ function Chipbar(props) {
|
|
|
857
863
|
setShowLeft(true);
|
|
858
864
|
};
|
|
859
865
|
return (() => {
|
|
860
|
-
var _el$ = _tmpl$2$
|
|
866
|
+
var _el$ = _tmpl$2$a(),
|
|
861
867
|
_el$3 = _el$.firstChild;
|
|
862
868
|
insert(_el$, createComponent(Show, {
|
|
863
869
|
get when() {
|
|
864
870
|
return showLeft();
|
|
865
871
|
},
|
|
866
872
|
get children() {
|
|
867
|
-
var _el$2 = _tmpl$$
|
|
873
|
+
var _el$2 = _tmpl$$l();
|
|
868
874
|
insert(_el$2, createComponent(Button, {
|
|
869
875
|
onMouseDown: scrollLeft,
|
|
870
876
|
children: "\u2190"
|
|
@@ -879,7 +885,7 @@ function Chipbar(props) {
|
|
|
879
885
|
return (hasSignalChips || !hasSignalChips && props.clearAll !== undefined);
|
|
880
886
|
},
|
|
881
887
|
get children() {
|
|
882
|
-
var _el$4 = _tmpl$$
|
|
888
|
+
var _el$4 = _tmpl$$l();
|
|
883
889
|
insert(_el$4, createComponent(Button, {
|
|
884
890
|
onClick: () => clearAll() ,
|
|
885
891
|
children: "Clear All"
|
|
@@ -923,7 +929,7 @@ function Chipbar(props) {
|
|
|
923
929
|
return showRight();
|
|
924
930
|
},
|
|
925
931
|
get children() {
|
|
926
|
-
var _el$5 = _tmpl$$
|
|
932
|
+
var _el$5 = _tmpl$$l();
|
|
927
933
|
insert(_el$5, createComponent(Button, {
|
|
928
934
|
onMouseDown: scrollRight,
|
|
929
935
|
children: "\u2192"
|
|
@@ -946,18 +952,18 @@ function Chipbar(props) {
|
|
|
946
952
|
})();
|
|
947
953
|
}
|
|
948
954
|
|
|
949
|
-
var css_248z$
|
|
950
|
-
var styles$
|
|
951
|
-
styleInject(css_248z$
|
|
955
|
+
var css_248z$f = ".body-module_compBody__d3HyU {\n width: 70%;\n margin: 0 auto;\n border-radius: 15px;\n padding: 8px;\n padding-top: 0px;\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n@media screen and (max-width: 768px) {\n .body-module_compBody__d3HyU {\n width: 95%;\n margin: 0 auto;\n }\n}";
|
|
956
|
+
var styles$a = {"compBody":"body-module_compBody__d3HyU"};
|
|
957
|
+
styleInject(css_248z$f);
|
|
952
958
|
|
|
953
|
-
var _tmpl$$
|
|
959
|
+
var _tmpl$$k = /*#__PURE__*/template(`<div>`);
|
|
954
960
|
const Body = props => {
|
|
955
961
|
const [customProps, normalProps] = splitProps(props, ["children", "class", 'style']);
|
|
956
962
|
return (() => {
|
|
957
|
-
var _el$ = _tmpl$$
|
|
963
|
+
var _el$ = _tmpl$$k();
|
|
958
964
|
spread(_el$, mergeProps(normalProps, {
|
|
959
965
|
get ["class"]() {
|
|
960
|
-
return `${styles$
|
|
966
|
+
return `${styles$a.compBody} ${customProps.class ?? ""}`;
|
|
961
967
|
}
|
|
962
968
|
}), false, true);
|
|
963
969
|
insert(_el$, () => customProps.children);
|
|
@@ -1149,17 +1155,26 @@ function useClickOutside(elementRefs, callback) {
|
|
|
1149
1155
|
};
|
|
1150
1156
|
// Set up the event listener when the component mounts.
|
|
1151
1157
|
onMount(() => {
|
|
1152
|
-
|
|
1158
|
+
const handleClick = event => {
|
|
1159
|
+
const path = event.composedPath();
|
|
1160
|
+
// If click is inside ANY ref’ed element, do nothing
|
|
1161
|
+
if (elementRefs.some(ref => {
|
|
1162
|
+
const el = ref();
|
|
1163
|
+
return el && path.includes(el);
|
|
1164
|
+
})) return;
|
|
1165
|
+
callback();
|
|
1166
|
+
};
|
|
1167
|
+
document.addEventListener('pointerdown', handleClick); // capture phase
|
|
1153
1168
|
});
|
|
1154
1169
|
// Clean up the event listener when the component unmounts.
|
|
1155
1170
|
onCleanup(() => {
|
|
1156
|
-
document.removeEventListener('
|
|
1171
|
+
document.removeEventListener('pointerdown', handleClick);
|
|
1157
1172
|
});
|
|
1158
1173
|
}
|
|
1159
1174
|
|
|
1160
|
-
var css_248z$
|
|
1161
|
-
var styles$
|
|
1162
|
-
styleInject(css_248z$
|
|
1175
|
+
var css_248z$e = "@charset \"UTF-8\";\n.input-module_input__-LMoi {\n width: 100%;\n max-width: 400px;\n border-radius: var(--border-radius-lg, 16px);\n font-size: var(--font-size-base, 16px);\n transition: border 0.7s ease, padding 0.7s ease;\n}\n@media screen and (max-width: 768px) {\n .input-module_input__-LMoi {\n width: 100%;\n max-width: 100%;\n }\n}\n.input-module_input__-LMoi[type=checkbox] {\n width: -moz-min-content;\n width: min-content;\n -webkit-appearance: none;\n border: 1px solid #cacece;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);\n padding: var(--spacing-1, 8px);\n border-radius: var(--border-radius-sm);\n display: inline-block;\n position: relative;\n}\n.input-module_input__-LMoi[type=checkbox]:checked {\n background-color: inherit;\n border: 1px solid #adb8c0;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);\n color: inherit;\n}\n.input-module_input__-LMoi[type=checkbox]:checked:after {\n content: \"✔\";\n position: absolute;\n top: -15%;\n left: 15%;\n width: 10px;\n height: 10px;\n border-radius: 10%;\n}\n.input-module_input__-LMoi:not([type=checkbox])::-moz-placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:not([type=checkbox])::placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:focus {\n outline: none;\n}\n.input-module_input__-LMoi.input-module_error__vs2kz {\n border: 1px solid var(--warn-color);\n}\n.input-module_input__-LMoi.input-module_success__beiu5 {\n border: 1px solid green;\n}\n.input-module_input__-LMoi.input-module_warning__b6S5s {\n border: 1px solid orange;\n}\n.input-module_input__-LMoi.input-module_info__pWO0n {\n border: 1px solid blue;\n}\n.input-module_input__-LMoi.input-module_disabled__40ZHw {\n border: 1px solid gray;\n}\n\n.input-module_inFormField__kk-PD {\n border: none;\n outline: none;\n transition: padding 0.7s ease;\n}\n\n.input-module_checkbox__Yu-9M {\n cursor: pointer;\n}\n\n.input-module_transparent__aXcGX {\n background-color: inherit !important;\n opacity: 1;\n color: inherit !important;\n border: none;\n}\n.input-module_transparent__aXcGX :focus {\n outline: none;\n}";
|
|
1176
|
+
var styles$9 = {"input":"input-module_input__-LMoi","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
|
|
1177
|
+
styleInject(css_248z$e);
|
|
1163
1178
|
|
|
1164
1179
|
const $RAW = Symbol("store-raw"),
|
|
1165
1180
|
$NODE = Symbol("store-node"),
|
|
@@ -1375,7 +1390,7 @@ function createStore(...[store, options]) {
|
|
|
1375
1390
|
return [wrappedStore, setStore];
|
|
1376
1391
|
}
|
|
1377
1392
|
|
|
1378
|
-
var _tmpl$$
|
|
1393
|
+
var _tmpl$$j = /*#__PURE__*/template(`<form>`);
|
|
1379
1394
|
const FormContext = createContext();
|
|
1380
1395
|
const useFormContext = () => {
|
|
1381
1396
|
return useContext(FormContext);
|
|
@@ -1411,7 +1426,7 @@ const FormInner = props => {
|
|
|
1411
1426
|
formRef()?.removeEventListener('submit', submitFunction);
|
|
1412
1427
|
});
|
|
1413
1428
|
return (() => {
|
|
1414
|
-
var _el$ = _tmpl$$
|
|
1429
|
+
var _el$ = _tmpl$$j();
|
|
1415
1430
|
use(setFormRef, _el$);
|
|
1416
1431
|
insert(_el$, () => props.children);
|
|
1417
1432
|
return _el$;
|
|
@@ -1434,59 +1449,54 @@ const Provider = props => {
|
|
|
1434
1449
|
});
|
|
1435
1450
|
};
|
|
1436
1451
|
|
|
1437
|
-
var _tmpl$$
|
|
1452
|
+
var _tmpl$$i = /*#__PURE__*/template(`<input>`);
|
|
1438
1453
|
const Input = props => {
|
|
1439
1454
|
const [customProps, normalProps] = splitProps(props, ["tooltip", "transparent", "value", "onChange"]);
|
|
1440
|
-
const noTransparent = type => "checkbox" !== (type ?? "text");
|
|
1441
1455
|
const context = useFormProvider();
|
|
1442
1456
|
const formContext = useFormContext();
|
|
1457
|
+
// Determine the input's value using form context or provided prop value
|
|
1443
1458
|
const inputValue = createMemo(() => {
|
|
1444
|
-
if (!isNullish(
|
|
1445
|
-
return
|
|
1459
|
+
if (!isNullish(props?.value)) {
|
|
1460
|
+
return props.value;
|
|
1461
|
+
}
|
|
1462
|
+
if (!isNullish(formContext?.data?.[context.formName ?? ""])) {
|
|
1463
|
+
return formContext.data[context.formName ?? ""];
|
|
1446
1464
|
}
|
|
1447
1465
|
if (!isNullish(context.getValue)) {
|
|
1448
1466
|
return context.getValue();
|
|
1449
1467
|
}
|
|
1450
1468
|
return props.value;
|
|
1451
1469
|
});
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1470
|
+
const isRequired = createMemo(() => {
|
|
1471
|
+
if (context && formContext) {
|
|
1472
|
+
const key = context?.formName ?? "";
|
|
1473
|
+
return formContext?.formGroup?.hasValidator?.(key, 'required');
|
|
1474
|
+
}
|
|
1475
|
+
return Object.keys(normalProps).includes("required") && props?.required !== false || props?.required === true;
|
|
1454
1476
|
});
|
|
1477
|
+
// onChange only handles non-checkbox values
|
|
1455
1478
|
const onChange = e => {
|
|
1456
|
-
if (!isNullish(formContext?.setData)) {
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
context.setTextInside(textInside);
|
|
1466
|
-
formContext.formGroup.set(context.formName ?? '', e.currentTarget.value);
|
|
1467
|
-
formContext.setData(old => ({
|
|
1468
|
-
...old,
|
|
1469
|
-
[context.formName ?? '']: e.currentTarget.value
|
|
1470
|
-
}));
|
|
1471
|
-
}
|
|
1472
|
-
} else if (!isNullish(context.getName)) {
|
|
1479
|
+
if (!isNullish(formContext?.setData) && !!formContext?.formGroup?.get) {
|
|
1480
|
+
const textInside = !isNullish(e.currentTarget.value) && e.currentTarget.value?.trim() !== "";
|
|
1481
|
+
context?.setTextInside?.(textInside);
|
|
1482
|
+
formContext.formGroup?.set?.(context.formName ?? "", e.currentTarget.value);
|
|
1483
|
+
formContext?.setData?.(old => ({
|
|
1484
|
+
...old,
|
|
1485
|
+
[context.formName ?? ""]: e.currentTarget.value
|
|
1486
|
+
}));
|
|
1487
|
+
} else if (!isNullish(context.getName) && !!context?.getName?.()) {
|
|
1473
1488
|
if (e.currentTarget.value.trim()) {
|
|
1474
|
-
context
|
|
1489
|
+
context?.setValue(e.currentTarget.value);
|
|
1475
1490
|
context.setTextInside(true);
|
|
1476
1491
|
} else {
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
context.setTextInside(e.currentTarget.checked);
|
|
1480
|
-
} else {
|
|
1481
|
-
context.setValue("");
|
|
1482
|
-
context.setTextInside(false);
|
|
1483
|
-
}
|
|
1492
|
+
context.setValue("");
|
|
1493
|
+
context.setTextInside(false);
|
|
1484
1494
|
}
|
|
1485
1495
|
}
|
|
1486
1496
|
if (props.onChange) props.onChange(e);
|
|
1487
1497
|
};
|
|
1488
1498
|
createEffect(() => {
|
|
1489
|
-
if (
|
|
1499
|
+
if (isRequired()) {
|
|
1490
1500
|
context?.setName?.(old => `${old} *`);
|
|
1491
1501
|
} else {
|
|
1492
1502
|
context?.setName?.(old => old);
|
|
@@ -1494,9 +1504,10 @@ const Input = props => {
|
|
|
1494
1504
|
});
|
|
1495
1505
|
onMount(() => {
|
|
1496
1506
|
if (!isNullish(context.getName)) {
|
|
1497
|
-
|
|
1507
|
+
// Force a non-checkbox field type
|
|
1508
|
+
context.setFieldType(props.type === "checkbox" ? "text" : props.type ?? "text");
|
|
1498
1509
|
if (!isNullish(formContext?.data)) {
|
|
1499
|
-
const formValue = formContext.data[context.formName ??
|
|
1510
|
+
const formValue = formContext.data[context.formName ?? ""]?.trim();
|
|
1500
1511
|
if (formValue) {
|
|
1501
1512
|
context.setValue(formValue);
|
|
1502
1513
|
context.setTextInside(true);
|
|
@@ -1504,22 +1515,25 @@ const Input = props => {
|
|
|
1504
1515
|
}
|
|
1505
1516
|
}
|
|
1506
1517
|
});
|
|
1507
|
-
const placeholder =
|
|
1508
|
-
|
|
1509
|
-
|
|
1518
|
+
const placeholder = () => {
|
|
1519
|
+
const reqText = isRequired() ? " *" : "";
|
|
1520
|
+
if (context?.getTextInside?.() && !context?.getFocused?.()) {
|
|
1521
|
+
return (context?.getName?.() ?? props?.placeholder ?? "") + reqText;
|
|
1510
1522
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1523
|
+
if (props?.placeholder) {
|
|
1524
|
+
return props.placeholder + reqText;
|
|
1525
|
+
}
|
|
1526
|
+
return "";
|
|
1527
|
+
};
|
|
1513
1528
|
createEffect(() => {
|
|
1514
|
-
const hasInputValue = isNullish(inputValue()) || inputValue() ===
|
|
1515
|
-
if (!isNullish(context) &&
|
|
1516
|
-
context?.getTextInside?.();
|
|
1529
|
+
const hasInputValue = isNullish(inputValue()) || inputValue() === "";
|
|
1530
|
+
if (!isNullish(context) && hasInputValue !== context?.getTextInside?.()) {
|
|
1517
1531
|
context?.getFocused?.();
|
|
1518
1532
|
context?.setTextInside?.(!hasInputValue);
|
|
1519
1533
|
}
|
|
1520
1534
|
});
|
|
1521
1535
|
return (() => {
|
|
1522
|
-
var _el$ = _tmpl$$
|
|
1536
|
+
var _el$ = _tmpl$$i();
|
|
1523
1537
|
spread(_el$, mergeProps(normalProps, {
|
|
1524
1538
|
get placeholder() {
|
|
1525
1539
|
return placeholder();
|
|
@@ -1527,7 +1541,7 @@ const Input = props => {
|
|
|
1527
1541
|
get value() {
|
|
1528
1542
|
return inputValue();
|
|
1529
1543
|
},
|
|
1530
|
-
"onFocus":
|
|
1544
|
+
"onFocus": () => {
|
|
1531
1545
|
if (!isNullish(context.getName)) {
|
|
1532
1546
|
context.setFocused?.(true);
|
|
1533
1547
|
}
|
|
@@ -1536,22 +1550,22 @@ const Input = props => {
|
|
|
1536
1550
|
if (!isNullish(context.getName)) {
|
|
1537
1551
|
context?.setFocused?.(prev => {
|
|
1538
1552
|
if (prev) {
|
|
1539
|
-
formContext?.formGroup?.validate?.(context?.formName ??
|
|
1553
|
+
formContext?.formGroup?.validate?.(context?.formName ?? "");
|
|
1540
1554
|
}
|
|
1541
1555
|
return false;
|
|
1542
1556
|
});
|
|
1543
1557
|
const noValue = !e.currentTarget?.value?.trim();
|
|
1544
|
-
const noFormValue = !formContext?.data?.[context?.formName ??
|
|
1558
|
+
const noFormValue = !formContext?.data?.[context?.formName ?? ""];
|
|
1545
1559
|
const noContextValue = !context?.getValue();
|
|
1546
|
-
context.setTextInside(
|
|
1560
|
+
context.setTextInside(noValue && noFormValue && noContextValue);
|
|
1547
1561
|
}
|
|
1548
1562
|
},
|
|
1549
1563
|
get type() {
|
|
1550
|
-
return
|
|
1564
|
+
return props.type === "checkbox" ? "text" : props.type ?? "text";
|
|
1551
1565
|
},
|
|
1552
1566
|
"onChange": onChange,
|
|
1553
1567
|
get ["class"]() {
|
|
1554
|
-
return `${styles$
|
|
1568
|
+
return `${styles$9.input} ${customProps.transparent ? styles$9.transparent : ""} ${!!context?.getName?.() ? styles$9.inFormField : ""} ${props?.class ?? ""}`;
|
|
1555
1569
|
},
|
|
1556
1570
|
get title() {
|
|
1557
1571
|
return customProps.tooltip;
|
|
@@ -1561,16 +1575,163 @@ const Input = props => {
|
|
|
1561
1575
|
})();
|
|
1562
1576
|
};
|
|
1563
1577
|
|
|
1564
|
-
var css_248z$
|
|
1565
|
-
var styles$
|
|
1566
|
-
styleInject(css_248z$
|
|
1578
|
+
var css_248z$d = ".checkbox-module_checkbox__LzFLC {\n display: flex;\n align-items: center;\n cursor: pointer;\n width: -moz-fit-content;\n width: fit-content;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 {\n cursor: not-allowed;\n}\n\n.checkbox-module_checkbox__input__pTELL {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n}\n\n.checkbox-module_checkbox__checkmark__0kdFq {\n position: relative;\n width: 16px;\n height: 16px;\n border: 2px solid #666;\n border-radius: 4px;\n background: transparent;\n margin-right: 0.5em;\n flex-shrink: 0;\n}\n\n.checkbox-module_checkbox__checkmark__0kdFq:after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 5px;\n height: 10px;\n border: solid #fff;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n display: none;\n}\n\n.checkbox-module_checkbox__input__pTELL:checked + .checkbox-module_checkbox__checkmark__0kdFq {\n background: #007bff;\n border-color: #007bff;\n}\n\n.checkbox-module_checkbox__input__pTELL:checked + .checkbox-module_checkbox__checkmark__0kdFq:after {\n display: block;\n}\n\n.checkbox-module_checkbox__LzFLC:hover .checkbox-module_checkbox__checkmark__0kdFq {\n border-color: #444;\n}\n\n.checkbox-module_checkbox__LzFLC:focus-within .checkbox-module_checkbox__checkmark__0kdFq {\n outline: 2px solid #80bdff;\n outline-offset: 2px;\n}\n\n.checkbox-module_checkbox__label__YXjgj {\n vertical-align: middle;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 .checkbox-module_checkbox__checkmark__0kdFq {\n border-color: #ccc;\n background: transparent;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 .checkbox-module_checkbox__checkmark__0kdFq:after {\n border-color: #ccc;\n}\n\n.checkbox-module_checkbox--disabled__5PdL7 .checkbox-module_checkbox__label__YXjgj {\n color: #ccc;\n}";
|
|
1579
|
+
var styles$8 = {"checkbox":"checkbox-module_checkbox__LzFLC","checkbox--disabled":"checkbox-module_checkbox--disabled__5PdL7","checkbox__input":"checkbox-module_checkbox__input__pTELL","checkbox__checkmark":"checkbox-module_checkbox__checkmark__0kdFq","checkbox__label":"checkbox-module_checkbox__label__YXjgj"};
|
|
1580
|
+
styleInject(css_248z$d);
|
|
1581
|
+
|
|
1582
|
+
var _tmpl$$h = /*#__PURE__*/template(`<label><input type=checkbox><span>`),
|
|
1583
|
+
_tmpl$2$9 = /*#__PURE__*/template(`<span>`);
|
|
1584
|
+
function Checkbox(props) {
|
|
1585
|
+
// Handle controlled vs. uncontrolled state
|
|
1586
|
+
const [internalChecked, setInternalChecked] = createSignal(props.defaultChecked ?? false);
|
|
1587
|
+
const checkedState = createMemo(() => props.checked !== undefined ? props.checked : internalChecked());
|
|
1588
|
+
const handleChange = e => {
|
|
1589
|
+
const target = e.currentTarget;
|
|
1590
|
+
const newChecked = target.checked;
|
|
1591
|
+
if (props.checked === undefined) {
|
|
1592
|
+
setInternalChecked(newChecked);
|
|
1593
|
+
}
|
|
1594
|
+
props.onChange?.(newChecked);
|
|
1595
|
+
};
|
|
1596
|
+
return (() => {
|
|
1597
|
+
var _el$ = _tmpl$$h(),
|
|
1598
|
+
_el$2 = _el$.firstChild,
|
|
1599
|
+
_el$3 = _el$2.nextSibling;
|
|
1600
|
+
_el$2.addEventListener("change", handleChange);
|
|
1601
|
+
insert(_el$, (() => {
|
|
1602
|
+
var _c$ = createMemo(() => !!props.label);
|
|
1603
|
+
return () => _c$() && (() => {
|
|
1604
|
+
var _el$4 = _tmpl$2$9();
|
|
1605
|
+
insert(_el$4, () => props.label);
|
|
1606
|
+
createRenderEffect(() => className(_el$4, styles$8["checkbox__label"]));
|
|
1607
|
+
return _el$4;
|
|
1608
|
+
})();
|
|
1609
|
+
})(), null);
|
|
1610
|
+
createRenderEffect(_p$ => {
|
|
1611
|
+
var _v$ = styles$8.checkbox,
|
|
1612
|
+
_v$2 = {
|
|
1613
|
+
[styles$8["checkbox--disabled"]]: props.disabled,
|
|
1614
|
+
[styles$8["checkbox--checked"]]: checkedState()
|
|
1615
|
+
},
|
|
1616
|
+
_v$3 = styles$8["checkbox__input"],
|
|
1617
|
+
_v$4 = props.disabled,
|
|
1618
|
+
_v$5 = props.label ? undefined : props.ariaLabel,
|
|
1619
|
+
_v$6 = styles$8["checkbox__checkmark"];
|
|
1620
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
1621
|
+
_p$.t = classList(_el$, _v$2, _p$.t);
|
|
1622
|
+
_v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
|
|
1623
|
+
_v$4 !== _p$.o && (_el$2.disabled = _p$.o = _v$4);
|
|
1624
|
+
_v$5 !== _p$.i && setAttribute(_el$2, "aria-label", _p$.i = _v$5);
|
|
1625
|
+
_v$6 !== _p$.n && className(_el$3, _p$.n = _v$6);
|
|
1626
|
+
return _p$;
|
|
1627
|
+
}, {
|
|
1628
|
+
e: undefined,
|
|
1629
|
+
t: undefined,
|
|
1630
|
+
a: undefined,
|
|
1631
|
+
o: undefined,
|
|
1632
|
+
i: undefined,
|
|
1633
|
+
n: undefined
|
|
1634
|
+
});
|
|
1635
|
+
createRenderEffect(() => _el$2.checked = checkedState());
|
|
1636
|
+
return _el$;
|
|
1637
|
+
})();
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
var css_248z$c = ".selectStyles-module_solid_select__placeholder__VO5-- {\n opacity: var(--text-emphasis-medium, 87%);\n transition: all 0.7s ease;\n}\n\n.selectStyles-module_solid_select__transparent__nOpvm {\n background-color: transparent;\n}\n\n.selectStyles-module_solid_select__3plh1 {\n display: inline-block;\n position: relative;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n text-align: left;\n border-radius: 8px;\n width: 100%;\n margin: 0px 6px;\n}\n\n.selectStyles-module_solid_select__control__Wmmpg {\n display: flex;\n align-items: center;\n width: 100%;\n max-height: 48px;\n border-radius: 8px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n cursor: pointer;\n transition: border 0.7s ease, padding 0.7s ease;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.selectStyles-module_solid_select__control__Wmmpg:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control__Wmmpg:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__control_no_form__Cq9Sc {\n display: flex;\n align-items: center;\n width: 100%;\n height: 48px;\n border-radius: 8px;\n width: 200px;\n margin-top: 2px;\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__arrow__OPCZo {\n font-size: 0.7em;\n}\n\n.selectStyles-module_solid_select__value__rNtqF {\n flex-grow: 1;\n transition: all 0.3s ease;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n}\n\n.selectStyles-module_multiselect-value__UUhhP {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n.selectStyles-module_solid_select__dropdown__UCt-N {\n position: absolute;\n background-color: var(--surface-color, #EEEEEE);\n top: 100%;\n left: 0;\n z-index: 999999999999999;\n max-height: 200px;\n border-radius: 8px;\n overflow-x: hidden;\n overflow-y: auto;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n transform-origin: top;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.selectStyles-module_dropTop__IVz9p {\n transform-origin: bottom;\n}\n\n.selectStyles-module_dropBottom__cYJF0 {\n transform-origin: top;\n}\n\n.selectStyles-module_open__f8zLA {\n transform: scaleY(1);\n opacity: 1;\n}\n\n.selectStyles-module_solid_select__option__47WMY {\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n min-height: 32px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n border-radius: 8px;\n}\n.selectStyles-module_solid_select__option__47WMY:hover {\n border: 2px inset var(--primary-color-varient, #43A047);\n}\n.selectStyles-module_solid_select__option__47WMY:has(.selectStyles-module_selected__1-CKm) {\n font-weight: bold;\n}\n\n.selectStyles-module_checkmark__UWcbd {\n display: inline-block;\n width: 1.2em;\n margin-right: 4px;\n text-align: center;\n}\n\n.selectStyles-module_option-label__bBFSW {\n width: -moz-max-content;\n width: max-content;\n height: -moz-max-content;\n height: max-content;\n}";
|
|
1641
|
+
var styles$7 = {"solid_select__placeholder":"selectStyles-module_solid_select__placeholder__VO5--","solid_select__transparent":"selectStyles-module_solid_select__transparent__nOpvm","solid_select":"selectStyles-module_solid_select__3plh1","solid_select__control":"selectStyles-module_solid_select__control__Wmmpg","solid_select__control_no_form":"selectStyles-module_solid_select__control_no_form__Cq9Sc","solid_select__arrow":"selectStyles-module_solid_select__arrow__OPCZo","solid_select__value":"selectStyles-module_solid_select__value__rNtqF","multiselect-value":"selectStyles-module_multiselect-value__UUhhP","solid_select__dropdown":"selectStyles-module_solid_select__dropdown__UCt-N","dropTop":"selectStyles-module_dropTop__IVz9p","dropBottom":"selectStyles-module_dropBottom__cYJF0","open":"selectStyles-module_open__f8zLA","solid_select__option":"selectStyles-module_solid_select__option__47WMY","selected":"selectStyles-module_selected__1-CKm","checkmark":"selectStyles-module_checkmark__UWcbd","option-label":"selectStyles-module_option-label__bBFSW"};
|
|
1642
|
+
styleInject(css_248z$c);
|
|
1643
|
+
|
|
1644
|
+
const manager = new class WinManager {
|
|
1645
|
+
data = [];
|
|
1646
|
+
ignore = [];
|
|
1647
|
+
get entries() {
|
|
1648
|
+
return this.data;
|
|
1649
|
+
}
|
|
1650
|
+
get ignoreElements() {
|
|
1651
|
+
return this.ignore;
|
|
1652
|
+
}
|
|
1653
|
+
register(entry) {
|
|
1654
|
+
this.data.push(entry);
|
|
1655
|
+
}
|
|
1656
|
+
unregister(entry) {
|
|
1657
|
+
const index = this.data.indexOf(entry);
|
|
1658
|
+
if (index !== -1) {
|
|
1659
|
+
this.data.splice(index, 1);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
ignoreElement(element) {
|
|
1663
|
+
this.ignore.push(element);
|
|
1664
|
+
}
|
|
1665
|
+
unignoreElement(element) {
|
|
1666
|
+
const index = this.ignore.indexOf(element);
|
|
1667
|
+
if (index !== -1) {
|
|
1668
|
+
this.ignore.splice(index, 1);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}();
|
|
1672
|
+
// Register an element along with its click-outside callback.
|
|
1673
|
+
function registerWindowManager(entry) {
|
|
1674
|
+
manager.register(entry);
|
|
1675
|
+
}
|
|
1676
|
+
function getEntryAmount() {
|
|
1677
|
+
return manager.entries.length;
|
|
1678
|
+
}
|
|
1679
|
+
function ignoreWindowManager(element) {
|
|
1680
|
+
manager.ignoreElement(element);
|
|
1681
|
+
}
|
|
1682
|
+
// Unregister the given element.
|
|
1683
|
+
function unregisterWindowManager(entry) {
|
|
1684
|
+
manager.unregister(entry);
|
|
1685
|
+
}
|
|
1686
|
+
// Global event handler that only lets the topmost window close.
|
|
1687
|
+
function handleGlobalClick(e) {
|
|
1688
|
+
if (manager.entries.length === 0) return;
|
|
1689
|
+
// Get the topmost (last registered) entry.
|
|
1690
|
+
const topEntry = manager.entries[manager.entries.length - 1];
|
|
1691
|
+
const toIgnore = manager.ignoreElements;
|
|
1692
|
+
if (toIgnore.length > 0) {
|
|
1693
|
+
for (const el of toIgnore) {
|
|
1694
|
+
if (el.contains(e.target)) {
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
// If the click target is not inside the top entry element, trigger its callback.
|
|
1700
|
+
if (!topEntry.element.contains(e.target)) {
|
|
1701
|
+
topEntry.onClickOutside(e);
|
|
1702
|
+
unregisterWindowManager(topEntry);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
// Attach the global event listeners in capture phase.
|
|
1706
|
+
if (typeof document !== 'undefined') {
|
|
1707
|
+
document.addEventListener('mousedown', handleGlobalClick, true);
|
|
1708
|
+
document.addEventListener('touchstart', handleGlobalClick, true);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
const SelectContext = createContext({});
|
|
1712
|
+
const useSelectContext = () => {
|
|
1713
|
+
const context = useContext(SelectContext);
|
|
1714
|
+
if (!context) {
|
|
1715
|
+
throw new Error("<Select> must be used within a <SelectContext.Provider>");
|
|
1716
|
+
}
|
|
1717
|
+
return context;
|
|
1718
|
+
};
|
|
1719
|
+
const SelectContextProvider = props => {
|
|
1720
|
+
return createComponent(SelectContext.Provider, {
|
|
1721
|
+
get value() {
|
|
1722
|
+
return props.value;
|
|
1723
|
+
},
|
|
1724
|
+
get children() {
|
|
1725
|
+
return props.children;
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
};
|
|
1567
1729
|
|
|
1568
|
-
var _tmpl$$
|
|
1569
|
-
_tmpl$2$
|
|
1730
|
+
var _tmpl$$g = /*#__PURE__*/template(`<span>`),
|
|
1731
|
+
_tmpl$2$8 = /*#__PURE__*/template(`<span>▲`),
|
|
1570
1732
|
_tmpl$3$2 = /*#__PURE__*/template(`<span>▼`),
|
|
1571
1733
|
_tmpl$4$1 = /*#__PURE__*/template(`<div>`),
|
|
1572
|
-
_tmpl$5$1 = /*#__PURE__*/template(`<div is=coles-solid-select tabindex=0><div><span>`, true, false, false);
|
|
1573
|
-
const SelectContext = createContext();
|
|
1734
|
+
_tmpl$5$1 = /*#__PURE__*/template(`<div is=coles-solid-select role=button aria-haspopup=listbox tabindex=0><div><span>`, true, false, false);
|
|
1574
1735
|
function Select(props) {
|
|
1575
1736
|
const isMultiple = Object.keys(props).includes("multiple") || props.multiple === true;
|
|
1576
1737
|
const [placeholder, setPlaceholder] = createSignal(props?.placeholder ?? "Select...");
|
|
@@ -1601,13 +1762,31 @@ function Select(props) {
|
|
|
1601
1762
|
}
|
|
1602
1763
|
return selectRef();
|
|
1603
1764
|
});
|
|
1604
|
-
|
|
1605
|
-
|
|
1765
|
+
const [options, setOptions] = createStore({});
|
|
1766
|
+
// Register and unregister functions using the store
|
|
1606
1767
|
const registerOption = (val, label) => {
|
|
1607
|
-
|
|
1768
|
+
const stringVal = JSON.stringify(val);
|
|
1769
|
+
setOptions(store => ({
|
|
1770
|
+
...store,
|
|
1771
|
+
[stringVal]: {
|
|
1772
|
+
value: stringVal,
|
|
1773
|
+
label
|
|
1774
|
+
}
|
|
1775
|
+
}));
|
|
1608
1776
|
};
|
|
1609
1777
|
const unregisterOption = val => {
|
|
1610
|
-
|
|
1778
|
+
const stringVal = JSON.stringify(val);
|
|
1779
|
+
setOptions(store => {
|
|
1780
|
+
const newStore = {
|
|
1781
|
+
...store
|
|
1782
|
+
};
|
|
1783
|
+
delete newStore[stringVal];
|
|
1784
|
+
return newStore;
|
|
1785
|
+
});
|
|
1786
|
+
};
|
|
1787
|
+
const getLabel = val => {
|
|
1788
|
+
const stringVal = JSON.stringify(val);
|
|
1789
|
+
return options[stringVal]?.label || String(val);
|
|
1611
1790
|
};
|
|
1612
1791
|
// Helper to check if a value is selected (for Option highlighting)
|
|
1613
1792
|
const isSelected = val => {
|
|
@@ -1628,9 +1807,11 @@ function Select(props) {
|
|
|
1628
1807
|
}
|
|
1629
1808
|
setSelected(() => newSelected);
|
|
1630
1809
|
props?.onChange?.(newSelected);
|
|
1810
|
+
props?.onSelect?.(newSelected);
|
|
1631
1811
|
} else {
|
|
1632
1812
|
setSelected(() => val);
|
|
1633
1813
|
props?.onChange?.(val);
|
|
1814
|
+
props?.onSelect?.(val);
|
|
1634
1815
|
setOpen(false);
|
|
1635
1816
|
}
|
|
1636
1817
|
};
|
|
@@ -1642,26 +1823,29 @@ function Select(props) {
|
|
|
1642
1823
|
if (selectedArray.length === 0) {
|
|
1643
1824
|
if (hasForm && form.getTextInside() && !form.getFocused()) {
|
|
1644
1825
|
return (() => {
|
|
1645
|
-
var _el$ = _tmpl$$
|
|
1646
|
-
|
|
1647
|
-
createRenderEffect(() => className(_el$, `${styles$
|
|
1826
|
+
var _el$ = _tmpl$$g();
|
|
1827
|
+
_el$.style.setProperty("opacity", "0");
|
|
1828
|
+
createRenderEffect(() => className(_el$, `${styles$7["solid_select__placeholder"]}`));
|
|
1648
1829
|
return _el$;
|
|
1649
1830
|
})();
|
|
1650
1831
|
}
|
|
1651
1832
|
return (() => {
|
|
1652
|
-
var _el$2 = _tmpl$$
|
|
1833
|
+
var _el$2 = _tmpl$$g();
|
|
1653
1834
|
insert(_el$2, () => props.placeholder || "Select...");
|
|
1654
|
-
createRenderEffect(() => className(_el$2, `${styles$
|
|
1835
|
+
createRenderEffect(() => className(_el$2, `${styles$7["solid_select__placeholder"]}`));
|
|
1655
1836
|
return _el$2;
|
|
1656
1837
|
})();
|
|
1657
1838
|
}
|
|
1658
1839
|
if (props.renderValue) {
|
|
1659
1840
|
return props.renderValue(selectedArray);
|
|
1660
1841
|
} else {
|
|
1661
|
-
const labels = selectedArray.map(val =>
|
|
1842
|
+
const labels = selectedArray.map(val => options[JSON.stringify(val)]?.label || String(val));
|
|
1662
1843
|
return (() => {
|
|
1663
|
-
var _el$3 = _tmpl$$
|
|
1664
|
-
|
|
1844
|
+
var _el$3 = _tmpl$$g();
|
|
1845
|
+
_el$3.style.setProperty("width", "100%");
|
|
1846
|
+
_el$3.style.setProperty("height", "100%");
|
|
1847
|
+
insert(_el$3, () => labels.join(', '));
|
|
1848
|
+
createRenderEffect(() => className(_el$3, `${styles$7["solid_select__value"]} ${styles$7["multiselect-value"]}`));
|
|
1665
1849
|
return _el$3;
|
|
1666
1850
|
})();
|
|
1667
1851
|
}
|
|
@@ -1671,25 +1855,24 @@ function Select(props) {
|
|
|
1671
1855
|
if (isNullish(singleVal) || typeof singleVal === "string" && !!!singleVal.trim()) {
|
|
1672
1856
|
if (hasForm && form.getTextInside() && !form.getFocused()) {
|
|
1673
1857
|
return (() => {
|
|
1674
|
-
var _el$4 = _tmpl$$
|
|
1675
|
-
|
|
1676
|
-
createRenderEffect(() => className(_el$4, `${styles$5["solid_select__placeholder"]}`));
|
|
1858
|
+
var _el$4 = _tmpl$$g();
|
|
1859
|
+
createRenderEffect(() => className(_el$4, `${styles$7["solid_select__placeholder"]}`));
|
|
1677
1860
|
return _el$4;
|
|
1678
1861
|
})();
|
|
1679
1862
|
}
|
|
1680
1863
|
return (() => {
|
|
1681
|
-
var _el$5 = _tmpl$$
|
|
1864
|
+
var _el$5 = _tmpl$$g();
|
|
1682
1865
|
insert(_el$5, () => props.placeholder || "Select...");
|
|
1683
|
-
createRenderEffect(() => className(_el$5, `${styles$
|
|
1866
|
+
createRenderEffect(() => className(_el$5, `${styles$7["solid_select__placeholder"]}`));
|
|
1684
1867
|
return _el$5;
|
|
1685
1868
|
})();
|
|
1686
1869
|
} else if (props.renderValue) {
|
|
1687
1870
|
return props.renderValue(singleVal);
|
|
1688
1871
|
} else {
|
|
1689
|
-
const label = optionsMap.get(singleVal) || String(singleVal);
|
|
1690
1872
|
return (() => {
|
|
1691
|
-
var _el$6 = _tmpl$$
|
|
1692
|
-
insert(_el$6,
|
|
1873
|
+
var _el$6 = _tmpl$$g();
|
|
1874
|
+
insert(_el$6, () => getLabel(singleVal));
|
|
1875
|
+
createRenderEffect(() => className(_el$6, `${styles$7["solid_select__value"]}`));
|
|
1693
1876
|
return _el$6;
|
|
1694
1877
|
})();
|
|
1695
1878
|
}
|
|
@@ -1703,9 +1886,11 @@ function Select(props) {
|
|
|
1703
1886
|
}
|
|
1704
1887
|
return false;
|
|
1705
1888
|
};
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
|
|
1889
|
+
const [menuRect, setMenuRect] = createSignal();
|
|
1890
|
+
const selectLocation = createMemo(() => {
|
|
1891
|
+
const select = selectRef();
|
|
1892
|
+
const menuLoc = menuLocRef();
|
|
1893
|
+
const getLocation = rect => {
|
|
1709
1894
|
if (dropdownBelowScreen()) {
|
|
1710
1895
|
return {
|
|
1711
1896
|
x: rect.left,
|
|
@@ -1716,11 +1901,60 @@ function Select(props) {
|
|
|
1716
1901
|
x: rect.left,
|
|
1717
1902
|
y: rect.bottom
|
|
1718
1903
|
};
|
|
1904
|
+
};
|
|
1905
|
+
if (hasForm || hasFormContext) {
|
|
1906
|
+
if (menuLoc) {
|
|
1907
|
+
const rect = menuRect() ?? menuLoc.getBoundingClientRect();
|
|
1908
|
+
return getLocation(rect);
|
|
1909
|
+
} else if (select) {
|
|
1910
|
+
const rect = select.getBoundingClientRect();
|
|
1911
|
+
return getLocation(rect);
|
|
1912
|
+
}
|
|
1913
|
+
} else {
|
|
1914
|
+
if (select) {
|
|
1915
|
+
const rect = select.getBoundingClientRect();
|
|
1916
|
+
return getLocation(rect);
|
|
1917
|
+
}
|
|
1719
1918
|
}
|
|
1720
1919
|
return {
|
|
1721
1920
|
x: 0,
|
|
1722
1921
|
y: 0
|
|
1723
1922
|
};
|
|
1923
|
+
});
|
|
1924
|
+
const selectWidth = () => {
|
|
1925
|
+
if (menuLocRef()) {
|
|
1926
|
+
return menuLocRef().getBoundingClientRect().width;
|
|
1927
|
+
}
|
|
1928
|
+
return 0;
|
|
1929
|
+
};
|
|
1930
|
+
createMemo(() => {
|
|
1931
|
+
const value = currentValue();
|
|
1932
|
+
if (isMultiple) {
|
|
1933
|
+
const selectedArray = Array.isArray(value) ? value : [];
|
|
1934
|
+
if (selectedArray.length === 0) {
|
|
1935
|
+
return 0;
|
|
1936
|
+
}
|
|
1937
|
+
const labels = selectedArray.map(val => options[JSON.stringify(val)]?.label || String(val));
|
|
1938
|
+
return labels.join(", ").length * 8; // Approximate width based on character count
|
|
1939
|
+
} else {
|
|
1940
|
+
return selectWidth();
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
const updatePosition = () => {
|
|
1944
|
+
const menuLoc = dropdownRef();
|
|
1945
|
+
const select = selectRef();
|
|
1946
|
+
if (menuLoc && select) {
|
|
1947
|
+
const selectRect = select.getBoundingClientRect();
|
|
1948
|
+
const dropdownRect = menuLoc.getBoundingClientRect();
|
|
1949
|
+
let newX = selectRect.left + window.scrollX;
|
|
1950
|
+
let newY = selectRect.bottom + window.scrollY;
|
|
1951
|
+
if (selectRect.bottom + dropdownRect.height > window.innerHeight) {
|
|
1952
|
+
newY = selectRect.top + window.scrollY - dropdownRect.height;
|
|
1953
|
+
}
|
|
1954
|
+
menuLoc.style.left = `${newX}px`;
|
|
1955
|
+
menuLoc.style.top = `${newY}px`;
|
|
1956
|
+
menuLoc.style.width = `${selectRect.width}px`;
|
|
1957
|
+
}
|
|
1724
1958
|
};
|
|
1725
1959
|
// Update width of select to match option text width
|
|
1726
1960
|
createEffect(() => {
|
|
@@ -1764,11 +1998,12 @@ function Select(props) {
|
|
|
1764
1998
|
});
|
|
1765
1999
|
});
|
|
1766
2000
|
onMount(() => {
|
|
2001
|
+
setMenuRect(menuLocRef()?.getBoundingClientRect());
|
|
1767
2002
|
if (hasForm) {
|
|
1768
2003
|
const formValue = currentValue() ?? isMultiple ? [] : undefined;
|
|
1769
2004
|
const typedFormValue = isMultiple ? formValue : formValue;
|
|
1770
2005
|
if (isMultiple) {
|
|
1771
|
-
const isAvailableOptions = typedFormValue.every(val =>
|
|
2006
|
+
const isAvailableOptions = typedFormValue.every(val => !!options[JSON.stringify(val)]);
|
|
1772
2007
|
if (!!formValue && formValue.length > 0 && isAvailableOptions) {
|
|
1773
2008
|
form.setTextInside(true);
|
|
1774
2009
|
setSelected?.(old => [...(old ?? []), ...typedFormValue]);
|
|
@@ -1777,7 +2012,7 @@ function Select(props) {
|
|
|
1777
2012
|
}
|
|
1778
2013
|
} else {
|
|
1779
2014
|
if (typedFormValue) {
|
|
1780
|
-
if (
|
|
2015
|
+
if (!!options[JSON.stringify(typedFormValue)]) {
|
|
1781
2016
|
form.setTextInside(true);
|
|
1782
2017
|
setSelected?.(formValue);
|
|
1783
2018
|
} else {
|
|
@@ -1789,33 +2024,59 @@ function Select(props) {
|
|
|
1789
2024
|
}
|
|
1790
2025
|
}
|
|
1791
2026
|
}
|
|
2027
|
+
const dropdown = dropdownRef();
|
|
2028
|
+
if (dropdown) {
|
|
2029
|
+
ignoreWindowManager(dropdown);
|
|
2030
|
+
}
|
|
2031
|
+
document.addEventListener('scroll', updatePosition, true);
|
|
2032
|
+
window.addEventListener('resize', updatePosition);
|
|
2033
|
+
onCleanup(() => {
|
|
2034
|
+
document.removeEventListener('scroll', updatePosition, true);
|
|
2035
|
+
window.removeEventListener('resize', updatePosition);
|
|
2036
|
+
});
|
|
1792
2037
|
});
|
|
2038
|
+
children(() => props.children);
|
|
2039
|
+
const selectDropX = createMemo(() => `${selectLocation().x}px`);
|
|
2040
|
+
const selectDropY = createMemo(() => `${selectLocation().y}px`);
|
|
2041
|
+
const providerValue = createMemo(() => ({
|
|
2042
|
+
isSelected,
|
|
2043
|
+
selectValue,
|
|
2044
|
+
registerOption,
|
|
2045
|
+
unregisterOption,
|
|
2046
|
+
selectRef,
|
|
2047
|
+
selectStyle: currStyle
|
|
2048
|
+
}));
|
|
1793
2049
|
return (() => {
|
|
1794
2050
|
var _el$7 = _tmpl$5$1(),
|
|
1795
2051
|
_el$8 = _el$7.firstChild,
|
|
1796
2052
|
_el$9 = _el$8.firstChild;
|
|
1797
2053
|
_el$7.$$keydown = e => {
|
|
1798
|
-
|
|
1799
|
-
|
|
2054
|
+
if (e.key === "ArrowDown") {
|
|
2055
|
+
// Open dropdown if not open and set highlightedIndex to 0
|
|
2056
|
+
if (!open()) {
|
|
2057
|
+
setOpen(true);
|
|
2058
|
+
// set highlightedIndex(0);
|
|
2059
|
+
}
|
|
2060
|
+
} else if (e.key === "ArrowUp") ; else if (e.key === "Enter") ; else if (e.key === "Escape") {
|
|
2061
|
+
setOpen(false);
|
|
2062
|
+
}
|
|
1800
2063
|
};
|
|
1801
2064
|
_el$7.addEventListener("focus", () => form?.setFocused?.(true));
|
|
1802
2065
|
_el$7._$owner = getOwner();
|
|
1803
2066
|
_el$8.$$click = e => {
|
|
2067
|
+
const menuRect = menuLocRef()?.getBoundingClientRect();
|
|
2068
|
+
setMenuRect(menuRect);
|
|
1804
2069
|
setOpen(old => !old);
|
|
1805
2070
|
};
|
|
1806
2071
|
use(setSelectRef, _el$8);
|
|
1807
|
-
_el$9.$$click = e => {
|
|
1808
|
-
setOpen(old => !old);
|
|
1809
|
-
e.stopPropagation();
|
|
1810
|
-
};
|
|
1811
2072
|
insert(_el$9, displayValue);
|
|
1812
2073
|
insert(_el$8, createComponent(Show, {
|
|
1813
2074
|
get when() {
|
|
1814
2075
|
return open();
|
|
1815
2076
|
},
|
|
1816
2077
|
get children() {
|
|
1817
|
-
var _el$10 = _tmpl$2$
|
|
1818
|
-
createRenderEffect(() => className(_el$10, styles$
|
|
2078
|
+
var _el$10 = _tmpl$2$8();
|
|
2079
|
+
createRenderEffect(() => className(_el$10, styles$7['solid_select__arrow']));
|
|
1819
2080
|
return _el$10;
|
|
1820
2081
|
}
|
|
1821
2082
|
}), null);
|
|
@@ -1825,18 +2086,13 @@ function Select(props) {
|
|
|
1825
2086
|
},
|
|
1826
2087
|
get children() {
|
|
1827
2088
|
var _el$11 = _tmpl$3$2();
|
|
1828
|
-
createRenderEffect(() => className(_el$11, styles$
|
|
2089
|
+
createRenderEffect(() => className(_el$11, styles$7['solid_select__arrow']));
|
|
1829
2090
|
return _el$11;
|
|
1830
2091
|
}
|
|
1831
2092
|
}), null);
|
|
1832
|
-
insert(_el$7, createComponent(
|
|
1833
|
-
value
|
|
1834
|
-
|
|
1835
|
-
selectValue,
|
|
1836
|
-
registerOption,
|
|
1837
|
-
unregisterOption,
|
|
1838
|
-
selectRef,
|
|
1839
|
-
selectStyle: currStyle
|
|
2093
|
+
insert(_el$7, createComponent(SelectContextProvider, {
|
|
2094
|
+
get value() {
|
|
2095
|
+
return providerValue();
|
|
1840
2096
|
},
|
|
1841
2097
|
get children() {
|
|
1842
2098
|
return createComponent(Portal, {
|
|
@@ -1845,9 +2101,9 @@ function Select(props) {
|
|
|
1845
2101
|
use(setDropdownRef, _el$12);
|
|
1846
2102
|
insert(_el$12, () => props.children);
|
|
1847
2103
|
createRenderEffect(_p$ => {
|
|
1848
|
-
var _v$ = `${styles$
|
|
1849
|
-
_v$2 =
|
|
1850
|
-
_v$3 =
|
|
2104
|
+
var _v$ = `${styles$7['solid_select__dropdown']} ${dropdownBelowScreen() ? styles$7.dropTop : styles$7.dropBottom} ${open() ? styles$7.open : ''} ${props.dropdownClass || ""}`,
|
|
2105
|
+
_v$2 = selectDropY(),
|
|
2106
|
+
_v$3 = selectDropX(),
|
|
1851
2107
|
_v$4 = `${menuLocRef()?.getBoundingClientRect().width ?? 100}px !important`;
|
|
1852
2108
|
_v$ !== _p$.e && className(_el$12, _p$.e = _v$);
|
|
1853
2109
|
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$12.style.setProperty("top", _v$2) : _el$12.style.removeProperty("top"));
|
|
@@ -1867,19 +2123,21 @@ function Select(props) {
|
|
|
1867
2123
|
}), null);
|
|
1868
2124
|
createRenderEffect(_p$ => {
|
|
1869
2125
|
var _v$5 = props.id,
|
|
1870
|
-
_v$6 = `${styles$
|
|
1871
|
-
_v$7 =
|
|
1872
|
-
_v$8 =
|
|
1873
|
-
_v$9 =
|
|
2126
|
+
_v$6 = `${styles$7.solid_select__control_no_form} ${styles$7[styleClassTransparent]} coles-solid-selectControl`,
|
|
2127
|
+
_v$7 = open(),
|
|
2128
|
+
_v$8 = props.tooltip,
|
|
2129
|
+
_v$9 = `${styles$7['solid_select__control']} ${props.class || ""}`,
|
|
2130
|
+
_v$10 = !hasForm ? {
|
|
1874
2131
|
height: '48px'
|
|
1875
2132
|
} : {},
|
|
1876
|
-
_v$
|
|
2133
|
+
_v$11 = styles$7['solid_select__value'];
|
|
1877
2134
|
_v$5 !== _p$.e && (_el$7.id = _p$.e = _v$5);
|
|
1878
2135
|
_v$6 !== _p$.t && className(_el$7, _p$.t = _v$6);
|
|
1879
|
-
_v$7 !== _p$.a && (_el$7.
|
|
1880
|
-
_v$8 !== _p$.o &&
|
|
1881
|
-
_p$.i
|
|
1882
|
-
|
|
2136
|
+
_v$7 !== _p$.a && (_el$7.ariaExpanded = _p$.a = _v$7);
|
|
2137
|
+
_v$8 !== _p$.o && (_el$7.title = _p$.o = _v$8);
|
|
2138
|
+
_v$9 !== _p$.i && className(_el$8, _p$.i = _v$9);
|
|
2139
|
+
_p$.n = style$9(_el$8, _v$10, _p$.n);
|
|
2140
|
+
_v$11 !== _p$.s && className(_el$9, _p$.s = _v$11);
|
|
1883
2141
|
return _p$;
|
|
1884
2142
|
}, {
|
|
1885
2143
|
e: undefined,
|
|
@@ -1887,22 +2145,22 @@ function Select(props) {
|
|
|
1887
2145
|
a: undefined,
|
|
1888
2146
|
o: undefined,
|
|
1889
2147
|
i: undefined,
|
|
1890
|
-
n: undefined
|
|
2148
|
+
n: undefined,
|
|
2149
|
+
s: undefined
|
|
1891
2150
|
});
|
|
1892
2151
|
return _el$7;
|
|
1893
2152
|
})();
|
|
1894
2153
|
}
|
|
1895
2154
|
delegateEvents(["keydown", "click"]);
|
|
1896
2155
|
|
|
1897
|
-
var _tmpl$$
|
|
2156
|
+
var _tmpl$$f = /*#__PURE__*/template(`<div role=option><span></span><span is=coles-select-label>`, true, false, false);
|
|
1898
2157
|
function Option(props) {
|
|
1899
|
-
const select = useContext(SelectContext);
|
|
1900
|
-
if (!select) {
|
|
1901
|
-
throw new Error("<Option> must be used within a <Select>");
|
|
1902
|
-
}
|
|
1903
2158
|
const formField = useFormProvider();
|
|
1904
2159
|
const formContext = useFormContext();
|
|
1905
|
-
|
|
2160
|
+
const select = useSelectContext();
|
|
2161
|
+
onMount(() => {
|
|
2162
|
+
select.registerOption?.(props.value, props.children);
|
|
2163
|
+
});
|
|
1906
2164
|
onCleanup(() => select.unregisterOption?.(props.value));
|
|
1907
2165
|
const selectFormFieldValue = value => {
|
|
1908
2166
|
if (!!formField?.getName?.()) {
|
|
@@ -1963,211 +2221,48 @@ function Option(props) {
|
|
|
1963
2221
|
const contextSuccess = selectFormContextValue(props.value);
|
|
1964
2222
|
!contextSuccess ? selectFormFieldValue(props.value) : true;
|
|
1965
2223
|
if (!formField?.getName?.()) {
|
|
2224
|
+
console.log('selected!', props.value, select);
|
|
1966
2225
|
select.selectValue?.(props.value);
|
|
1967
2226
|
formField?.setFocused?.(true);
|
|
1968
2227
|
}
|
|
1969
2228
|
};
|
|
1970
2229
|
return (() => {
|
|
1971
|
-
var _el$ = _tmpl$$
|
|
2230
|
+
var _el$ = _tmpl$$f(),
|
|
1972
2231
|
_el$2 = _el$.firstChild,
|
|
1973
2232
|
_el$3 = _el$2.nextSibling;
|
|
1974
2233
|
_el$.$$click = handleClick;
|
|
1975
|
-
insert(_el$2, () => select
|
|
2234
|
+
insert(_el$2, () => select?.isSelected?.(props.value) ?? false ? "✓" : "");
|
|
1976
2235
|
_el$3._$owner = getOwner();
|
|
1977
2236
|
insert(_el$3, () => props.children ?? "");
|
|
1978
2237
|
createRenderEffect(_p$ => {
|
|
1979
|
-
var _v$ =
|
|
1980
|
-
_v$2 =
|
|
1981
|
-
_v$3 =
|
|
1982
|
-
_v$4 = `${styles$
|
|
1983
|
-
|
|
1984
|
-
_v$
|
|
1985
|
-
_v$
|
|
1986
|
-
_v$
|
|
2238
|
+
var _v$ = select?.isSelected?.(props.value) ?? false,
|
|
2239
|
+
_v$2 = `${styles$7['solid_select__option']} ${props.class || ""}`,
|
|
2240
|
+
_v$3 = !!(select?.isSelected?.(props.value) ?? false),
|
|
2241
|
+
_v$4 = `${styles$7['checkmark']}`,
|
|
2242
|
+
_v$5 = `${styles$7['option-label']}`;
|
|
2243
|
+
_v$ !== _p$.e && setAttribute(_el$, "aria-selected", _p$.e = _v$);
|
|
2244
|
+
_v$2 !== _p$.t && className(_el$, _p$.t = _v$2);
|
|
2245
|
+
_v$3 !== _p$.a && _el$.classList.toggle("selected", _p$.a = _v$3);
|
|
2246
|
+
_v$4 !== _p$.o && className(_el$2, _p$.o = _v$4);
|
|
2247
|
+
_v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
|
|
1987
2248
|
return _p$;
|
|
1988
2249
|
}, {
|
|
1989
2250
|
e: undefined,
|
|
1990
2251
|
t: undefined,
|
|
1991
2252
|
a: undefined,
|
|
1992
|
-
o: undefined
|
|
2253
|
+
o: undefined,
|
|
2254
|
+
i: undefined
|
|
1993
2255
|
});
|
|
1994
2256
|
return _el$;
|
|
1995
2257
|
})();
|
|
1996
2258
|
}
|
|
1997
2259
|
delegateEvents(["click"]);
|
|
1998
2260
|
|
|
1999
|
-
var css_248z$
|
|
2000
|
-
var style$4 = {"
|
|
2001
|
-
styleInject(css_248z$
|
|
2002
|
-
|
|
2003
|
-
var _tmpl$$c = /*#__PURE__*/template(`<div>`),
|
|
2004
|
-
_tmpl$2$6 = /*#__PURE__*/template(`<div><span>`);
|
|
2005
|
-
const [snackbars, setSnackbars] = createSignal([]);
|
|
2006
|
-
const addSnackbar = snack => {
|
|
2007
|
-
setSnackbars(old => [...old, snack]);
|
|
2008
|
-
};
|
|
2009
|
-
const removeSnackbar = index => {
|
|
2010
|
-
setSnackbars(old => old.filter((_, i) => i !== index));
|
|
2011
|
-
};
|
|
2012
|
-
const SnackbarController = () => {
|
|
2013
|
-
return createComponent(Show, {
|
|
2014
|
-
get when() {
|
|
2015
|
-
return snackbars().length > 0;
|
|
2016
|
-
},
|
|
2017
|
-
get children() {
|
|
2018
|
-
var _el$ = _tmpl$$c();
|
|
2019
|
-
insert(_el$, createComponent(For, {
|
|
2020
|
-
get each() {
|
|
2021
|
-
return snackbars();
|
|
2022
|
-
},
|
|
2023
|
-
children: (snack, index) => createComponent(Snackbar, mergeProps(snack, {
|
|
2024
|
-
get index() {
|
|
2025
|
-
return index();
|
|
2026
|
-
},
|
|
2027
|
-
onClose: () => removeSnackbar(index())
|
|
2028
|
-
}))
|
|
2029
|
-
}));
|
|
2030
|
-
createRenderEffect(() => className(_el$, style$4.snackContainer));
|
|
2031
|
-
return _el$;
|
|
2032
|
-
}
|
|
2033
|
-
});
|
|
2034
|
-
};
|
|
2035
|
-
const Snackbar = props => {
|
|
2036
|
-
const [isOpen, setIsOpen] = createSignal(true);
|
|
2037
|
-
if (props.closeTimeout) setTimeout(() => props.onClose(), props.closeTimeout);
|
|
2038
|
-
if (!props.closeTimeout) setTimeout(() => props.onClose(), 5000);
|
|
2039
|
-
const messageLength = Math.floor(props.message.length / 17);
|
|
2040
|
-
return createComponent(Portal, {
|
|
2041
|
-
get mount() {
|
|
2042
|
-
return document.body;
|
|
2043
|
-
},
|
|
2044
|
-
get children() {
|
|
2045
|
-
return createComponent(Show, {
|
|
2046
|
-
get when() {
|
|
2047
|
-
return isOpen();
|
|
2048
|
-
},
|
|
2049
|
-
get children() {
|
|
2050
|
-
var _el$2 = _tmpl$2$6(),
|
|
2051
|
-
_el$3 = _el$2.firstChild;
|
|
2052
|
-
insert(_el$3, () => props.message);
|
|
2053
|
-
insert(_el$2, createComponent(Button, {
|
|
2054
|
-
get onClick() {
|
|
2055
|
-
return props.onClose;
|
|
2056
|
-
},
|
|
2057
|
-
children: "X"
|
|
2058
|
-
}), null);
|
|
2059
|
-
createRenderEffect(_p$ => {
|
|
2060
|
-
var _v$ = `${10 + props.index * (50 + messageLength * 8)}px`,
|
|
2061
|
-
_v$2 = `${style$4.primary} ${style$4.snack} ${style$4[props.severity ?? 'info']}`;
|
|
2062
|
-
_v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$2.style.setProperty("bottom", _v$) : _el$2.style.removeProperty("bottom"));
|
|
2063
|
-
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
2064
|
-
return _p$;
|
|
2065
|
-
}, {
|
|
2066
|
-
e: undefined,
|
|
2067
|
-
t: undefined
|
|
2068
|
-
});
|
|
2069
|
-
return _el$2;
|
|
2070
|
-
}
|
|
2071
|
-
});
|
|
2072
|
-
}
|
|
2073
|
-
});
|
|
2074
|
-
};
|
|
2075
|
-
|
|
2076
|
-
var css_248z$8 = ".popup-module_popup__Oeq7F {\n padding: 0px;\n padding-top: 8px;\n padding-bottom: 8px;\n overflow: hidden;\n position: fixed;\n top: 50%;\n left: 50%;\n border: var(--primary-color, #4CAF50) 1px solid;\n border-radius: 8px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n z-index: 1000;\n text-align: center;\n}\n\n.popup-module_wrapper__S7cXt {\n padding: 0px;\n overflow-y: hidden;\n padding-bottom: 5px;\n display: flex;\n flex-direction: column;\n}\n.popup-module_wrapper__S7cXt :not(span):nth-child(2) {\n margin-top: 5%;\n height: 95%;\n flex-grow: 1;\n overflow-y: auto;\n}\n\n.popup-module_header__aKiI0 {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 5%;\n overflow-y: hidden;\n padding: 5px;\n min-height: 2em;\n}\n.popup-module_header__aKiI0 button {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n}\n.popup-module_header__aKiI0 h2 {\n text-align: left;\n margin-left: 5%;\n flex-grow: 1;\n padding: 0px;\n padding-bottom: 5px;\n margin: 0px;\n margin-left: 1em;\n}\n.popup-module_header__aKiI0 span {\n flex-shrink: 0;\n width: -moz-min-content;\n width: min-content;\n height: -moz-min-content;\n height: min-content;\n}\n.popup-module_header__aKiI0 span button:hover {\n cursor: pointer;\n}\n\n.popup-module_body__ouRAt {\n flex-grow: 1;\n}\n\n.popup-module_tertiary__69E41, .popup-module_accent__AzLZ1, .popup-module_primary__tm77N {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}";
|
|
2077
|
-
var style$3 = {"popup":"popup-module_popup__Oeq7F","wrapper":"popup-module_wrapper__S7cXt","header":"popup-module_header__aKiI0","body":"popup-module_body__ouRAt","primary":"popup-module_primary__tm77N"};
|
|
2078
|
-
styleInject(css_248z$8);
|
|
2079
|
-
|
|
2080
|
-
var _tmpl$$b = /*#__PURE__*/template(`<b>X`),
|
|
2081
|
-
_tmpl$2$5 = /*#__PURE__*/template(`<div><div><h2></h2><span></span></div><div>`);
|
|
2082
|
-
const Modal = props => {
|
|
2083
|
-
const defaultX = props.translate?.x ?? "-50%";
|
|
2084
|
-
const defaultY = props.translate?.y ?? "-50%";
|
|
2085
|
-
const [popupRef, setPopupRef] = createSignal();
|
|
2086
|
-
// Flag to ignore the click that triggered opening the modal.
|
|
2087
|
-
const [ignoreFirstClick, setIgnoreFirstClick] = createSignal(true);
|
|
2088
|
-
const isShown = createMemo(() => props.show[0]());
|
|
2089
|
-
// When the modal becomes visible, set the flag and clear it on the next tick.
|
|
2090
|
-
createEffect(() => {
|
|
2091
|
-
if (isShown()) {
|
|
2092
|
-
setIgnoreFirstClick(true);
|
|
2093
|
-
// Use a 0ms timeout to clear the flag after the current event loop.
|
|
2094
|
-
setTimeout(() => setIgnoreFirstClick(false), 0);
|
|
2095
|
-
}
|
|
2096
|
-
});
|
|
2097
|
-
const clickOutside = e => {
|
|
2098
|
-
// Only process if modal is visible and we're not in the first click.
|
|
2099
|
-
if (!props.show[0]() || ignoreFirstClick()) return;
|
|
2100
|
-
const popupBox = popupRef()?.getBoundingClientRect();
|
|
2101
|
-
if (!isNullish(popupBox)) {
|
|
2102
|
-
const outLeft = e.clientX < popupBox.left;
|
|
2103
|
-
const outRight = e.clientX > popupBox.right;
|
|
2104
|
-
const outTop = e.clientY < popupBox.top;
|
|
2105
|
-
const outBottom = e.clientY > popupBox.bottom;
|
|
2106
|
-
if (outLeft || outRight || outTop || outBottom) {
|
|
2107
|
-
props.show[1](false);
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
};
|
|
2111
|
-
onMount(() => {
|
|
2112
|
-
document.addEventListener("click", clickOutside);
|
|
2113
|
-
});
|
|
2114
|
-
onCleanup(() => {
|
|
2115
|
-
document.removeEventListener("click", clickOutside);
|
|
2116
|
-
});
|
|
2117
|
-
return createComponent(Show, {
|
|
2118
|
-
get when() {
|
|
2119
|
-
return isShown();
|
|
2120
|
-
},
|
|
2121
|
-
get children() {
|
|
2122
|
-
return createComponent(Portal, {
|
|
2123
|
-
get children() {
|
|
2124
|
-
var _el$ = _tmpl$2$5(),
|
|
2125
|
-
_el$2 = _el$.firstChild,
|
|
2126
|
-
_el$3 = _el$2.firstChild,
|
|
2127
|
-
_el$4 = _el$3.nextSibling,
|
|
2128
|
-
_el$6 = _el$2.nextSibling;
|
|
2129
|
-
use(el => setPopupRef(el), _el$);
|
|
2130
|
-
`translate(${defaultX}, ${defaultY})` != null ? _el$.style.setProperty("transform", `translate(${defaultX}, ${defaultY})`) : _el$.style.removeProperty("transform");
|
|
2131
|
-
insert(_el$3, () => props.title ?? "Modal");
|
|
2132
|
-
insert(_el$4, createComponent(Button, {
|
|
2133
|
-
transparent: true,
|
|
2134
|
-
onClick: () => props.show[1](old => !old),
|
|
2135
|
-
get children() {
|
|
2136
|
-
return _tmpl$$b();
|
|
2137
|
-
}
|
|
2138
|
-
}));
|
|
2139
|
-
insert(_el$6, () => props.children);
|
|
2140
|
-
createRenderEffect(_p$ => {
|
|
2141
|
-
var _v$ = props.width ? props.width : isMobile() ? "90vw" : "45vw",
|
|
2142
|
-
_v$2 = props.height ? props.height : isMobile() ? "90vh" : "60vh",
|
|
2143
|
-
_v$3 = `${style$3["primary"]} ${style$3.wrapper} ${style$3.popup}`,
|
|
2144
|
-
_v$4 = style$3.header,
|
|
2145
|
-
_v$5 = style$3.body;
|
|
2146
|
-
_v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$.style.setProperty("width", _v$) : _el$.style.removeProperty("width"));
|
|
2147
|
-
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("height", _v$2) : _el$.style.removeProperty("height"));
|
|
2148
|
-
_v$3 !== _p$.a && className(_el$, _p$.a = _v$3);
|
|
2149
|
-
_v$4 !== _p$.o && className(_el$2, _p$.o = _v$4);
|
|
2150
|
-
_v$5 !== _p$.i && className(_el$6, _p$.i = _v$5);
|
|
2151
|
-
return _p$;
|
|
2152
|
-
}, {
|
|
2153
|
-
e: undefined,
|
|
2154
|
-
t: undefined,
|
|
2155
|
-
a: undefined,
|
|
2156
|
-
o: undefined,
|
|
2157
|
-
i: undefined
|
|
2158
|
-
});
|
|
2159
|
-
return _el$;
|
|
2160
|
-
}
|
|
2161
|
-
});
|
|
2162
|
-
}
|
|
2163
|
-
});
|
|
2164
|
-
};
|
|
2165
|
-
|
|
2166
|
-
var css_248z$7 = ".TextArea-module_areaStyle__AshKi {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 0.5rem;\n margin-right: calc(var(--spacing-1, 8px) / 2);\n border: 1px solid #ccc;\n border-radius: var(--border-radius-md, 6px);\n width: 98%;\n height: 100%;\n resize: none;\n}\n@media screen and (max-width: 768px) {\n .TextArea-module_areaStyle__AshKi {\n width: 90%;\n }\n}\n.TextArea-module_areaStyle__AshKi::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.TextArea-module_areaStyle__AshKi::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.TextArea-module_picButton__TV9ZE {\n padding: calc(var(--spacing-1, 8px) / 2) var(--spacing-1, 8px) !important;\n background-color: transparent;\n border-top: 1px solid white;\n border-bottom: 1px solid white;\n}\n\n.TextArea-module_transparent__pwXRO {\n background-color: transparent;\n border: none;\n color: white;\n padding: 0.5rem;\n width: inherit;\n height: 100%;\n resize: none;\n}\n.TextArea-module_transparent__pwXRO:focus {\n outline: none;\n border: none;\n}";
|
|
2167
|
-
var style$2 = {"areaStyle":"TextArea-module_areaStyle__AshKi"};
|
|
2168
|
-
styleInject(css_248z$7);
|
|
2261
|
+
var css_248z$b = ".TextArea-module_areaStyle__AshKi {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n padding: 0.5rem;\n margin-right: calc(var(--spacing-1, 8px) / 2);\n border: 1px solid #ccc;\n border-radius: var(--border-radius-md, 6px);\n width: 98%;\n height: 100%;\n resize: none;\n}\n@media screen and (max-width: 768px) {\n .TextArea-module_areaStyle__AshKi {\n width: 90%;\n }\n}\n.TextArea-module_areaStyle__AshKi::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.TextArea-module_areaStyle__AshKi::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.TextArea-module_picButton__TV9ZE {\n padding: calc(var(--spacing-1, 8px) / 2) var(--spacing-1, 8px) !important;\n background-color: transparent;\n border-top: 1px solid white;\n border-bottom: 1px solid white;\n}\n\n.TextArea-module_transparent__pwXRO {\n background-color: transparent;\n border: none;\n color: white;\n padding: 0.5rem;\n width: inherit;\n height: 100%;\n resize: none;\n}\n.TextArea-module_transparent__pwXRO:focus {\n outline: none;\n border: none;\n}";
|
|
2262
|
+
var style$4 = {"areaStyle":"TextArea-module_areaStyle__AshKi"};
|
|
2263
|
+
styleInject(css_248z$b);
|
|
2169
2264
|
|
|
2170
|
-
var _tmpl$$
|
|
2265
|
+
var _tmpl$$e = /*#__PURE__*/template(`<textarea>`);
|
|
2171
2266
|
const TextArea = props => {
|
|
2172
2267
|
let myElement;
|
|
2173
2268
|
const [customProps, normalProps] = splitProps(props, ["minSize", "text", "setText", "class", "tooltip", "transparent"]);
|
|
@@ -2202,7 +2297,7 @@ const TextArea = props => {
|
|
|
2202
2297
|
}
|
|
2203
2298
|
});
|
|
2204
2299
|
return (() => {
|
|
2205
|
-
var _el$ = _tmpl$$
|
|
2300
|
+
var _el$ = _tmpl$$e();
|
|
2206
2301
|
use(el => {
|
|
2207
2302
|
myElement = el;
|
|
2208
2303
|
OnInput();
|
|
@@ -2219,10 +2314,10 @@ const TextArea = props => {
|
|
|
2219
2314
|
}
|
|
2220
2315
|
},
|
|
2221
2316
|
get placeholder() {
|
|
2222
|
-
return
|
|
2317
|
+
return !!context.getName && context.getTextInside() && !context.getFocused() ? "" : props.placeholder;
|
|
2223
2318
|
},
|
|
2224
2319
|
get ["class"]() {
|
|
2225
|
-
return `${style$
|
|
2320
|
+
return `${style$4.areaStyle} ${customProps.class ?? ""} ${customProps.transparent ? customProps.transparent : ""}`;
|
|
2226
2321
|
},
|
|
2227
2322
|
get value() {
|
|
2228
2323
|
return customProps.text();
|
|
@@ -2246,26 +2341,137 @@ const TextArea = props => {
|
|
|
2246
2341
|
})();
|
|
2247
2342
|
};
|
|
2248
2343
|
|
|
2249
|
-
var css_248z$
|
|
2250
|
-
var style$
|
|
2251
|
-
styleInject(css_248z$
|
|
2344
|
+
var css_248z$a = ".popup-module_popup__5A6Ji {\n padding: 0px;\n padding-top: 8px;\n padding-bottom: 8px;\n overflow: hidden;\n position: fixed;\n top: 50%;\n left: 50%;\n border: var(--primary-color, #4CAF50) 1px solid;\n border-radius: 8px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n z-index: 1001;\n text-align: center;\n}\n@media (min-width: 768px) {\n .popup-module_popup__5A6Ji {\n transform: translate(-50%, -50%);\n }\n}\n@media (max-width: 768px) {\n .popup-module_popup__5A6Ji {\n top: 0;\n left: 0;\n transform: translate(5%, 0%);\n }\n}\n\n.popup-module_wrapper__iyFpP {\n padding: 0px;\n overflow-y: hidden;\n padding-bottom: 5px;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n}\n\n.popup-module_header__-CekS {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n overflow-y: hidden;\n padding: 5px;\n min-height: 2em;\n}\n.popup-module_header__-CekS button {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n}\n.popup-module_header__-CekS h2 {\n text-align: left;\n margin-left: 5%;\n flex-grow: 1;\n padding: 0px;\n padding-bottom: 5px;\n margin: 0px;\n margin-left: 1em;\n}\n.popup-module_header__-CekS span {\n flex-shrink: 0;\n width: -moz-min-content;\n width: min-content;\n height: -moz-min-content;\n height: min-content;\n}\n.popup-module_header__-CekS span button:hover {\n cursor: pointer;\n}\n\n.popup-module_body__IhaZc {\n flex-basis: auto;\n overflow-y: auto;\n flex-grow: 1;\n justify-self: flex-end;\n}\n\n.popup-module_tertiary__RM-hn, .popup-module_accent__cBwGV, .popup-module_primary__Q9k96 {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.popup-module_backdrop__o8l1M {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.4); /* dark overlay */\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000; /* sit beneath your modal */\n}";
|
|
2345
|
+
var style$3 = {"popup":"popup-module_popup__5A6Ji","wrapper":"popup-module_wrapper__iyFpP","header":"popup-module_header__-CekS","body":"popup-module_body__IhaZc","primary":"popup-module_primary__Q9k96","backdrop":"popup-module_backdrop__o8l1M"};
|
|
2346
|
+
styleInject(css_248z$a);
|
|
2252
2347
|
|
|
2253
|
-
var _tmpl$$
|
|
2254
|
-
_tmpl$2$
|
|
2255
|
-
const
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2348
|
+
var _tmpl$$d = /*#__PURE__*/template(`<b>X`),
|
|
2349
|
+
_tmpl$2$7 = /*#__PURE__*/template(`<div><div><div><h2></h2><span></span></div><div>`);
|
|
2350
|
+
const Modal = props => {
|
|
2351
|
+
const defaultX = createMemo(() => props.translate?.x ?? "-50%");
|
|
2352
|
+
const defaultY = createMemo(() => props.translate?.y ?? "-50%");
|
|
2353
|
+
const isShown = createMemo(() => props.show[0]());
|
|
2354
|
+
const [innerPopup, setInnerPopup] = createSignal();
|
|
2355
|
+
// const [ignoreClicks, setIgnoreClicks] = createSignal(true);
|
|
2356
|
+
createEffect(() => {
|
|
2357
|
+
const entry = {
|
|
2358
|
+
element: innerPopup(),
|
|
2359
|
+
onClickOutside: e => {
|
|
2360
|
+
props.show[1](false);
|
|
2361
|
+
}
|
|
2362
|
+
};
|
|
2363
|
+
if (isShown()) {
|
|
2364
|
+
setTimeout(() => {
|
|
2365
|
+
registerWindowManager(entry);
|
|
2366
|
+
}, 250);
|
|
2367
|
+
} else {
|
|
2368
|
+
unregisterWindowManager(entry);
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
const widthStyle = createMemo(() => {
|
|
2372
|
+
if (props.width) {
|
|
2373
|
+
return props.width;
|
|
2374
|
+
}
|
|
2375
|
+
if (isMobile()) {
|
|
2376
|
+
return "90vw";
|
|
2377
|
+
}
|
|
2378
|
+
return "45vw";
|
|
2379
|
+
});
|
|
2380
|
+
const heightStyle = createMemo(() => {
|
|
2381
|
+
if (props.height) {
|
|
2382
|
+
return props.height;
|
|
2383
|
+
}
|
|
2384
|
+
if (isMobile()) {
|
|
2385
|
+
return "95vh";
|
|
2386
|
+
}
|
|
2387
|
+
return "60vh";
|
|
2388
|
+
});
|
|
2389
|
+
const shouldTranslate = createMemo(() => {
|
|
2390
|
+
if (props.translate?.x || props.translate?.y) {
|
|
2391
|
+
return `translate(${defaultX()}, ${defaultY()})`;
|
|
2392
|
+
} else {
|
|
2393
|
+
return "";
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
return createComponent(Show, {
|
|
2397
|
+
get when() {
|
|
2398
|
+
return isShown();
|
|
2399
|
+
},
|
|
2400
|
+
get children() {
|
|
2401
|
+
return createComponent(Portal, {
|
|
2402
|
+
get children() {
|
|
2403
|
+
var _el$ = _tmpl$2$7(),
|
|
2404
|
+
_el$2 = _el$.firstChild,
|
|
2405
|
+
_el$3 = _el$2.firstChild,
|
|
2406
|
+
_el$4 = _el$3.firstChild,
|
|
2407
|
+
_el$5 = _el$4.nextSibling,
|
|
2408
|
+
_el$7 = _el$3.nextSibling;
|
|
2409
|
+
use(el => {
|
|
2410
|
+
setInnerPopup(el);
|
|
2411
|
+
// @ts-ignore
|
|
2412
|
+
props?.ref?.(el);
|
|
2413
|
+
}, _el$2);
|
|
2414
|
+
insert(_el$4, () => props.title ?? "Modal");
|
|
2415
|
+
insert(_el$5, createComponent(Button, {
|
|
2416
|
+
transparent: true,
|
|
2417
|
+
onClick: () => props.show[1](false),
|
|
2418
|
+
get children() {
|
|
2419
|
+
return _tmpl$$d();
|
|
2420
|
+
}
|
|
2421
|
+
}));
|
|
2422
|
+
insert(_el$7, () => props.children);
|
|
2423
|
+
createRenderEffect(_p$ => {
|
|
2424
|
+
var _v$ = style$3.backdrop,
|
|
2425
|
+
_v$2 = widthStyle(),
|
|
2426
|
+
_v$3 = heightStyle(),
|
|
2427
|
+
_v$4 = shouldTranslate(),
|
|
2428
|
+
_v$5 = `${style$3["primary"]} ${style$3.wrapper} ${style$3.popup}`,
|
|
2429
|
+
_v$6 = style$3.header,
|
|
2430
|
+
_v$7 = style$3.body;
|
|
2431
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
2432
|
+
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$2.style.setProperty("width", _v$2) : _el$2.style.removeProperty("width"));
|
|
2433
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$2.style.setProperty("height", _v$3) : _el$2.style.removeProperty("height"));
|
|
2434
|
+
_v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$2.style.setProperty("transform", _v$4) : _el$2.style.removeProperty("transform"));
|
|
2435
|
+
_v$5 !== _p$.i && className(_el$2, _p$.i = _v$5);
|
|
2436
|
+
_v$6 !== _p$.n && className(_el$3, _p$.n = _v$6);
|
|
2437
|
+
_v$7 !== _p$.s && className(_el$7, _p$.s = _v$7);
|
|
2438
|
+
return _p$;
|
|
2439
|
+
}, {
|
|
2440
|
+
e: undefined,
|
|
2441
|
+
t: undefined,
|
|
2442
|
+
a: undefined,
|
|
2443
|
+
o: undefined,
|
|
2444
|
+
i: undefined,
|
|
2445
|
+
n: undefined,
|
|
2446
|
+
s: undefined
|
|
2447
|
+
});
|
|
2448
|
+
return _el$;
|
|
2449
|
+
}
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2453
|
+
};
|
|
2454
|
+
|
|
2455
|
+
var css_248z$9 = ".expansion-module_header__eaZ-i {\n width: 100%;\n max-width: 100%;\n display: flex;\n flex-direction: row;\n height: -moz-min-content;\n height: min-content;\n text-wrap: wrap;\n}\n.expansion-module_header__eaZ-i :first-child {\n flex-grow: 1;\n}\n.expansion-module_header__eaZ-i :last-child {\n align-self: flex-end;\n padding: 10px;\n fill: var(--on-container-color, #000);\n}\n.expansion-module_header__eaZ-i button {\n height: -moz-min-content;\n height: min-content;\n background: none;\n}\n.expansion-module_header__eaZ-i button svg {\n height: 50%;\n}\n\n.expansion-module_opened__BFLJk {\n border-radius: 8px 8px 0px 0px;\n}\n\n.expansion-module_closed__VmSJ7 {\n border-radius: 4px 4px 8px 8px;\n}\n\n.expansion-module_body__OYZTn {\n display: hidden;\n max-height: 0;\n opacity: 0;\n transition: max-height 0.5s ease, opacity 0.5s ease;\n padding: calc(var(--spacing-1, 8px) - 2px);\n border-radius: 0px 0px 8px 8px;\n}\n.expansion-module_body__OYZTn :nth-child(n) {\n text-wrap: wrap !important;\n}\n\n.expansion-module_open__L1UJR {\n max-height: 800px;\n opacity: 1;\n}\n\n.expansion-module_totalPanel__o0hyd {\n max-width: 100%;\n display: flex !important;\n flex-direction: column !important;\n border-radius: 4px 4px 8px 8px;\n}\n\n.expansion-module_hover__lzPNA:hover {\n cursor: pointer;\n}\n\n.expansion-module_accent__HYwcP {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}";
|
|
2456
|
+
var style$2 = {"header":"expansion-module_header__eaZ-i","opened":"expansion-module_opened__BFLJk","closed":"expansion-module_closed__VmSJ7","body":"expansion-module_body__OYZTn","open":"expansion-module_open__L1UJR","totalPanel":"expansion-module_totalPanel__o0hyd","hover":"expansion-module_hover__lzPNA","accent":"expansion-module_accent__HYwcP"};
|
|
2457
|
+
styleInject(css_248z$9);
|
|
2458
|
+
|
|
2459
|
+
var _tmpl$$c = /*#__PURE__*/template(`<svg width=46 height=44><path d="M24.15 12.7875L37.6625 25.575C39.1 26.95 39.1 29.15 37.6625 30.525C36.225 31.9 33.925 31.9 32.4875 30.525L24.15 22.6875C23.4312 22 22.425 22 21.7062 22.6875L13.3687 30.525C11.9312 31.9 9.63123 31.9 8.19373 30.525C6.75623 29.15 6.75623 26.95 8.19373 25.575L21.7062 12.7875C22.425 12.2375 23.575 12.2375 24.15 12.7875Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`),
|
|
2460
|
+
_tmpl$2$6 = /*#__PURE__*/template(`<svg width=44 height=43><path d="M20.7625 31.8469L7.83752 19.35C6.46252 18.0062 6.46252 15.8562 7.83752 14.5125C9.21252 13.1687 11.4125 13.1687 12.7875 14.5125L20.7625 22.1719C21.45 22.8437 22.4125 22.8437 23.1 22.1719L31.075 14.5125C32.45 13.1687 34.65 13.1687 36.025 14.5125C37.4 15.8562 37.4 18.0062 36.025 19.35L23.1 31.8469C22.55 32.3844 21.45 32.3844 20.7625 31.8469Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`);
|
|
2461
|
+
const UpArrow = props => {
|
|
2462
|
+
return (() => {
|
|
2463
|
+
var _el$ = _tmpl$$c();
|
|
2464
|
+
spread(_el$, mergeProps(props, {
|
|
2465
|
+
"viewBox": "0 0 46 44",
|
|
2466
|
+
"fill": "none",
|
|
2467
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
2468
|
+
}), true, true);
|
|
2469
|
+
return _el$;
|
|
2470
|
+
})();
|
|
2471
|
+
};
|
|
2266
2472
|
const DownArrow = props => {
|
|
2267
2473
|
return (() => {
|
|
2268
|
-
var _el$2 = _tmpl$2$
|
|
2474
|
+
var _el$2 = _tmpl$2$6();
|
|
2269
2475
|
spread(_el$2, mergeProps(props, {
|
|
2270
2476
|
"viewBox": "0 0 44 43",
|
|
2271
2477
|
"fill": "none",
|
|
@@ -2275,17 +2481,17 @@ const DownArrow = props => {
|
|
|
2275
2481
|
})();
|
|
2276
2482
|
};
|
|
2277
2483
|
|
|
2278
|
-
var _tmpl$$
|
|
2484
|
+
var _tmpl$$b = /*#__PURE__*/template(`<div><div><span></span></div><div>`);
|
|
2279
2485
|
const ExpansionPanel = props => {
|
|
2280
2486
|
const [open, setOpen] = createSignal(!!props.startOpen);
|
|
2281
2487
|
return (() => {
|
|
2282
|
-
var _el$ = _tmpl$$
|
|
2488
|
+
var _el$ = _tmpl$$b(),
|
|
2283
2489
|
_el$2 = _el$.firstChild,
|
|
2284
2490
|
_el$3 = _el$2.firstChild,
|
|
2285
2491
|
_el$4 = _el$2.nextSibling;
|
|
2286
2492
|
spread(_el$, mergeProps(props, {
|
|
2287
2493
|
get ["class"]() {
|
|
2288
|
-
return `${style$
|
|
2494
|
+
return `${style$2.totalPanel}`;
|
|
2289
2495
|
}
|
|
2290
2496
|
}), false, true);
|
|
2291
2497
|
_el$3.style.setProperty("width", "min-content");
|
|
@@ -2303,7 +2509,7 @@ const ExpansionPanel = props => {
|
|
|
2303
2509
|
props.extraLogic ? props.extraLogic() : null;
|
|
2304
2510
|
},
|
|
2305
2511
|
get ["class"]() {
|
|
2306
|
-
return `${style$
|
|
2512
|
+
return `${style$2.hover}`;
|
|
2307
2513
|
},
|
|
2308
2514
|
get children() {
|
|
2309
2515
|
return [createComponent(Show, {
|
|
@@ -2347,8 +2553,8 @@ const ExpansionPanel = props => {
|
|
|
2347
2553
|
}), null);
|
|
2348
2554
|
insert(_el$4, () => props.children[1]);
|
|
2349
2555
|
createRenderEffect(_p$ => {
|
|
2350
|
-
var _v$ = `${style$
|
|
2351
|
-
_v$2 = `${style$
|
|
2556
|
+
var _v$ = `${style$2['accent']} ${style$2.header} ${open() ? style$2.opened : style$2.closed}`,
|
|
2557
|
+
_v$2 = `${style$2['accent']} ${style$2.body} ${open() ? style$2.open : ''}`;
|
|
2352
2558
|
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
2353
2559
|
_v$2 !== _p$.t && className(_el$4, _p$.t = _v$2);
|
|
2354
2560
|
return _p$;
|
|
@@ -2360,110 +2566,95 @@ const ExpansionPanel = props => {
|
|
|
2360
2566
|
})();
|
|
2361
2567
|
};
|
|
2362
2568
|
|
|
2363
|
-
var css_248z$
|
|
2364
|
-
var
|
|
2365
|
-
styleInject(css_248z$
|
|
2569
|
+
var css_248z$8 = ".snackbar-module_snack__Dkcmp {\n position: fixed;\n bottom: 10px;\n left: 45vw;\n right: 45vw;\n border-radius: 15px;\n margin: 0;\n padding: 0;\n z-index: 9999;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n max-width: 10vw;\n padding: 5px;\n}\n@media screen and (max-width: 768px) {\n .snackbar-module_snack__Dkcmp {\n left: 8vw;\n right: 8vw;\n bottom: 20vh;\n max-width: 70vw;\n }\n}\n.snackbar-module_snack__Dkcmp span {\n flex-grow: 1;\n margin: auto 0;\n text-wrap: wrap;\n}\n.snackbar-module_snack__Dkcmp button {\n margin: auto 0;\n}\n\n.snackbar-module_error__7IShA {\n border: 2px solid var(--error-color, #B00020);\n font-weight: bold;\n}\n\n.snackbar-module_success__JPkNY {\n border-color: #4caf50;\n border: 2px solid #4caf50;\n color: #4caf50;\n}\n\n.snackbar-module_info__52mgJ {\n border: 2px solid var(--secondary-color, #14b9c3);\n}\n\n.snackbar-module_warning__K1oCK {\n border-color: #ff9800;\n border: 2px solid #ff9800;\n color: #ff9800;\n}\n\n.snackbar-module_open__Bdhg1 {\n animation: snackbar-module_slideIn__aM-2K 0.5s forwards;\n}\n\n.snackbar-module_close__-JXxs {\n animation: snackbar-module_slideOut__6sQkv 0.5s forwards;\n}\n\n.snackbar-module_primary__j2zPB {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.snackbar-module_primary__j2zPB:hover {\n cursor: pointer;\n}";
|
|
2570
|
+
var style$1 = {"snack":"snackbar-module_snack__Dkcmp","error":"snackbar-module_error__7IShA","success":"snackbar-module_success__JPkNY","info":"snackbar-module_info__52mgJ","warning":"snackbar-module_warning__K1oCK","open":"snackbar-module_open__Bdhg1","slideIn":"snackbar-module_slideIn__aM-2K","close":"snackbar-module_close__-JXxs","slideOut":"snackbar-module_slideOut__6sQkv","primary":"snackbar-module_primary__j2zPB"};
|
|
2571
|
+
styleInject(css_248z$8);
|
|
2366
2572
|
|
|
2367
|
-
var _tmpl$$
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2573
|
+
var _tmpl$$a = /*#__PURE__*/template(`<div>`),
|
|
2574
|
+
_tmpl$2$5 = /*#__PURE__*/template(`<div><span>`);
|
|
2575
|
+
const [snackbars, setSnackbars] = createSignal([]);
|
|
2576
|
+
const addSnackbar = snack => {
|
|
2577
|
+
setSnackbars(old => [...old, snack]);
|
|
2372
2578
|
};
|
|
2373
|
-
const
|
|
2374
|
-
|
|
2375
|
-
regular: "400",
|
|
2376
|
-
bold: "400" // Using "400" for both regular and bold in this implementation.
|
|
2579
|
+
const removeSnackbar = index => {
|
|
2580
|
+
setSnackbars(old => old.filter((_, i) => i !== index));
|
|
2377
2581
|
};
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
switch (variant) {
|
|
2399
|
-
case "outlined":
|
|
2400
|
-
return outlinedIcons[path];
|
|
2401
|
-
case "rounded":
|
|
2402
|
-
return roundedIcons[path];
|
|
2403
|
-
case "sharp":
|
|
2404
|
-
return sharpIcons[path];
|
|
2405
|
-
default:
|
|
2406
|
-
return outlinedIcons[path];
|
|
2582
|
+
const SnackbarController = () => {
|
|
2583
|
+
return createComponent(Show, {
|
|
2584
|
+
get when() {
|
|
2585
|
+
return snackbars().length > 0;
|
|
2586
|
+
},
|
|
2587
|
+
get children() {
|
|
2588
|
+
var _el$ = _tmpl$$a();
|
|
2589
|
+
insert(_el$, createComponent(For, {
|
|
2590
|
+
get each() {
|
|
2591
|
+
return snackbars();
|
|
2592
|
+
},
|
|
2593
|
+
children: (snack, index) => createComponent(Snackbar, mergeProps(snack, {
|
|
2594
|
+
get index() {
|
|
2595
|
+
return index();
|
|
2596
|
+
},
|
|
2597
|
+
onClose: () => removeSnackbar(index())
|
|
2598
|
+
}))
|
|
2599
|
+
}));
|
|
2600
|
+
createRenderEffect(() => className(_el$, style$1.snackContainer));
|
|
2601
|
+
return _el$;
|
|
2407
2602
|
}
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2603
|
+
});
|
|
2604
|
+
};
|
|
2605
|
+
const Snackbar = props => {
|
|
2606
|
+
const [isOpen, setIsOpen] = createSignal(true);
|
|
2607
|
+
if (props.closeTimeout) setTimeout(() => props.onClose(), props.closeTimeout);
|
|
2608
|
+
if (!props.closeTimeout) setTimeout(() => props.onClose(), 5000);
|
|
2609
|
+
const messageLength = Math.floor(props.message.length / 17);
|
|
2610
|
+
return createComponent(Portal, {
|
|
2611
|
+
get mount() {
|
|
2612
|
+
return document.body;
|
|
2613
|
+
},
|
|
2614
|
+
get children() {
|
|
2615
|
+
return createComponent(Show, {
|
|
2616
|
+
get when() {
|
|
2617
|
+
return isOpen();
|
|
2618
|
+
},
|
|
2619
|
+
get children() {
|
|
2620
|
+
var _el$2 = _tmpl$2$5(),
|
|
2621
|
+
_el$3 = _el$2.firstChild;
|
|
2622
|
+
insert(_el$3, () => props.message);
|
|
2623
|
+
insert(_el$2, createComponent(Button, {
|
|
2624
|
+
get onClick() {
|
|
2625
|
+
return props.onClose;
|
|
2626
|
+
},
|
|
2627
|
+
children: "X"
|
|
2628
|
+
}), null);
|
|
2629
|
+
createRenderEffect(_p$ => {
|
|
2630
|
+
var _v$ = `${10 + props.index * (50 + messageLength * 8)}px`,
|
|
2631
|
+
_v$2 = `${style$1.primary} ${style$1.snack} ${style$1[props.severity ?? 'info']}`;
|
|
2632
|
+
_v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$2.style.setProperty("bottom", _v$) : _el$2.style.removeProperty("bottom"));
|
|
2633
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
2634
|
+
return _p$;
|
|
2635
|
+
}, {
|
|
2636
|
+
e: undefined,
|
|
2637
|
+
t: undefined
|
|
2638
|
+
});
|
|
2639
|
+
return _el$2;
|
|
2640
|
+
}
|
|
2417
2641
|
});
|
|
2418
|
-
} else {
|
|
2419
|
-
console.error(`Icon not found: ${iconPath}`);
|
|
2420
2642
|
}
|
|
2421
2643
|
});
|
|
2422
|
-
return (() => {
|
|
2423
|
-
var _el$ = _tmpl$$7();
|
|
2424
|
-
addEventListener(_el$, "click", props.onClick, true);
|
|
2425
|
-
_el$.$$pointerdown = e => {
|
|
2426
|
-
e.stopPropagation();
|
|
2427
|
-
e.preventDefault();
|
|
2428
|
-
};
|
|
2429
|
-
`${sizePx}px` != null ? _el$.style.setProperty("width", `${sizePx}px`) : _el$.style.removeProperty("width");
|
|
2430
|
-
`${sizePx}px` != null ? _el$.style.setProperty("height", `${sizePx}px`) : _el$.style.removeProperty("height");
|
|
2431
|
-
color != null ? _el$.style.setProperty("color", color) : _el$.style.removeProperty("color");
|
|
2432
|
-
_el$.style.setProperty("display", "block");
|
|
2433
|
-
_el$.style.setProperty("pointer-events", "none");
|
|
2434
|
-
_el$.style.setProperty("outline-color", "transparent");
|
|
2435
|
-
_el$.style.setProperty("border-block-color", "transparent");
|
|
2436
|
-
_el$.style.setProperty("border-inline-color", "transparent");
|
|
2437
|
-
createRenderEffect(_p$ => {
|
|
2438
|
-
var _v$ = styles$4.icon,
|
|
2439
|
-
_v$2 = IconSvg(),
|
|
2440
|
-
_v$3 = props.ariaLabel || "";
|
|
2441
|
-
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
2442
|
-
_v$2 !== _p$.t && setAttribute(_el$, "src", _p$.t = _v$2);
|
|
2443
|
-
_v$3 !== _p$.a && setAttribute(_el$, "alt", _p$.a = _v$3);
|
|
2444
|
-
return _p$;
|
|
2445
|
-
}, {
|
|
2446
|
-
e: undefined,
|
|
2447
|
-
t: undefined,
|
|
2448
|
-
a: undefined
|
|
2449
|
-
});
|
|
2450
|
-
return _el$;
|
|
2451
|
-
})();
|
|
2452
2644
|
};
|
|
2453
|
-
delegateEvents(["pointerdown", "click"]);
|
|
2454
2645
|
|
|
2455
|
-
var css_248z$
|
|
2456
|
-
var styles$
|
|
2457
|
-
styleInject(css_248z$
|
|
2646
|
+
var css_248z$7 = ".container-module_primary__EvZuR {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n fill: var(--on-primary-color, #fff);\n}\n\n.container-module_primaryVariant__lC3Dg {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n fill: var(--on-primary-color, #fff);\n}\n\n.container-module_secondary__-ywDW {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n fill: var(--on-secondary-color, #000000);\n}\n\n.container-module_secondaryVariant__E7Gxe {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n fill: var(--on-secondary-color, #000000);\n}\n\n.container-module_background__TT8pn {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n fill: var(--on-background-color, #000000);\n}\n\n.container-module_surface__59oDI {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n fill: var(--on-surface-color, #000000);\n}\n\n.container-module_surfaceVariant__S9Pyg {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n fill: var(--on-surface-color, #000000);\n}\n\n.container-module_container__Xfc8t {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n fill: var(--on-container-color, #000);\n}\n\n.container-module_error__anU8a {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n fill: var(--on-error-color, #ffffff);\n}\n\n.container-module_header__2SLww {\n background-color: var(--header-background-color, #2E7D32);\n color: var(--header-on-background-color, #fff);\n fill: var(--header-on-background-color, #fff);\n height: 50px;\n}\n.container-module_header__2SLww a {\n color: var(--header-on-background-color, #fff);\n}\n\n.container-module_subheader__Y2LUC {\n background-color: var(--subheader-background-color, #388E3C);\n color: var(--subheader-on-background-color, #fff);\n fill: var(--subheader-on-background-color, #fff);\n height: 38px;\n}";
|
|
2647
|
+
var styles$6 = {"primary":"container-module_primary__EvZuR","primaryVariant":"container-module_primaryVariant__lC3Dg","secondary":"container-module_secondary__-ywDW","secondaryVariant":"container-module_secondaryVariant__E7Gxe","background":"container-module_background__TT8pn","surface":"container-module_surface__59oDI","surfaceVariant":"container-module_surfaceVariant__S9Pyg","container":"container-module_container__Xfc8t","error":"container-module_error__anU8a","header":"container-module_header__2SLww","subheader":"container-module_subheader__Y2LUC"};
|
|
2648
|
+
styleInject(css_248z$7);
|
|
2458
2649
|
|
|
2459
|
-
var _tmpl$$
|
|
2650
|
+
var _tmpl$$9 = /*#__PURE__*/template(`<div>`);
|
|
2460
2651
|
const Container = props => {
|
|
2461
2652
|
const [local, other] = splitProps(props, ["children", "class", "theme"]);
|
|
2462
2653
|
return (() => {
|
|
2463
|
-
var _el$ = _tmpl$$
|
|
2654
|
+
var _el$ = _tmpl$$9();
|
|
2464
2655
|
spread(_el$, mergeProps(other, {
|
|
2465
2656
|
get ["class"]() {
|
|
2466
|
-
return `${styles$
|
|
2657
|
+
return `${styles$6[local.theme]} ${local.class}`;
|
|
2467
2658
|
}
|
|
2468
2659
|
}), false, true);
|
|
2469
2660
|
insert(_el$, () => local.children);
|
|
@@ -2471,35 +2662,141 @@ const Container = props => {
|
|
|
2471
2662
|
})();
|
|
2472
2663
|
};
|
|
2473
2664
|
|
|
2474
|
-
var css_248z$
|
|
2475
|
-
var styles$
|
|
2476
|
-
styleInject(css_248z$
|
|
2665
|
+
var css_248z$6 = ".icon-module_icon__K4BP- {\n outline: none !important;\n border: none !important;\n}\n.icon-module_icon__K4BP-:focus {\n outline: none !important;\n border: none !important;\n}\n.icon-module_icon__K4BP-:active {\n outline: none !important;\n border: none !important;\n}";
|
|
2666
|
+
var styles$5 = {"icon":"icon-module_icon__K4BP-"};
|
|
2667
|
+
styleInject(css_248z$6);
|
|
2668
|
+
|
|
2669
|
+
var _tmpl$$8 = /*#__PURE__*/template(`<div>`);
|
|
2670
|
+
// @ts-ignore
|
|
2671
|
+
const icons = import.meta.glob('/node_modules/@material-symbols/svg-400/**/*.svg', {
|
|
2672
|
+
query: '?raw',
|
|
2673
|
+
import: 'default'
|
|
2674
|
+
});
|
|
2675
|
+
const Icon = props => {
|
|
2676
|
+
const [svg, setSvg] = createSignal("");
|
|
2677
|
+
const sizeMap = {
|
|
2678
|
+
small: 16,
|
|
2679
|
+
medium: 24,
|
|
2680
|
+
large: 32
|
|
2681
|
+
};
|
|
2682
|
+
const size = createMemo(() => {
|
|
2683
|
+
if (typeof props.size === "number") {
|
|
2684
|
+
return props.size;
|
|
2685
|
+
}
|
|
2686
|
+
if (props.size && sizeMap[props.size]) {
|
|
2687
|
+
return sizeMap[props.size];
|
|
2688
|
+
}
|
|
2689
|
+
return 24;
|
|
2690
|
+
});
|
|
2691
|
+
const color = props.color ?? "currentColor";
|
|
2692
|
+
const variant = props.variant ?? "outlined";
|
|
2693
|
+
const key = `/node_modules/@material-symbols/svg-400/${variant}/${props.name}.svg`;
|
|
2694
|
+
if (!icons[key]) throw new Error(`Icon not found: ${key}`);
|
|
2695
|
+
icons[key]().then(raw => {
|
|
2696
|
+
setSvg(raw.replace(/fill=".*?"/g, 'fill="currentColor"').replace(/width=".*?"/g, `width="${untrack(size)}"`).replace(/height=".*?"/g, `height="${untrack(size)}"`));
|
|
2697
|
+
}).catch(console.error);
|
|
2698
|
+
const [iconRef, setIconRef] = createSignal();
|
|
2699
|
+
return (() => {
|
|
2700
|
+
var _el$ = _tmpl$$8();
|
|
2701
|
+
use(ref => {
|
|
2702
|
+
setIconRef(ref);
|
|
2703
|
+
// @ts-ignore
|
|
2704
|
+
props?.ref?.(ref);
|
|
2705
|
+
}, _el$);
|
|
2706
|
+
_el$.style.setProperty("display", "inline-block");
|
|
2707
|
+
color != null ? _el$.style.setProperty("color", color) : _el$.style.removeProperty("color");
|
|
2708
|
+
createRenderEffect(_p$ => {
|
|
2709
|
+
var _v$ = styles$5.icon,
|
|
2710
|
+
_v$2 = `${size()}px`,
|
|
2711
|
+
_v$3 = `${size()}px`,
|
|
2712
|
+
_v$4 = svg();
|
|
2713
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
2714
|
+
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("width", _v$2) : _el$.style.removeProperty("width"));
|
|
2715
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("height", _v$3) : _el$.style.removeProperty("height"));
|
|
2716
|
+
_v$4 !== _p$.o && (_el$.innerHTML = _p$.o = _v$4);
|
|
2717
|
+
return _p$;
|
|
2718
|
+
}, {
|
|
2719
|
+
e: undefined,
|
|
2720
|
+
t: undefined,
|
|
2721
|
+
a: undefined,
|
|
2722
|
+
o: undefined
|
|
2723
|
+
});
|
|
2724
|
+
return _el$;
|
|
2725
|
+
})();
|
|
2726
|
+
};
|
|
2477
2727
|
|
|
2478
|
-
var
|
|
2728
|
+
var css_248z$5 = ".menu-module_menu__UDlDL {\n background-color: var(--header-background-color, #2E7D32);\n color: var(--header-on-background-color, #fff);\n fill: var(--header-on-background-color, #fff);\n padding: 1px;\n margin: 0px;\n width: 100px;\n border-radius: 8px;\n transform-origin: top;\n max-height: 0;\n transition: max-height 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n visibility: hidden;\n}\n\n.menu-module_open__TpFnL {\n max-height: 800px !important;\n opacity: 1 !important;\n visibility: visible;\n}\n\n.menu-module_list__WPlII {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n fill: var(--on-container-color, #000);\n width: 100%;\n list-style: none;\n padding: 4px 0;\n margin: 0;\n border-radius: 8px;\n}\n\n.menu-module_listHeader__Hv-1- {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding-left: 4px;\n opacity: 1 !important;\n}\n\n.menu-module_menuDropdown__uQA25 {\n opacity: 1 !important;\n}\n.menu-module_menuDropdown__uQA25 button:focus, .menu-module_menuDropdown__uQA25 button:active, .menu-module_menuDropdown__uQA25 button:focus-within, .menu-module_menuDropdown__uQA25 button:focus-visible {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_menuDropdown__uQA25 button::-moz-focus-inner {\n border: 0;\n}\n\n.menu-module_droplist__-e059 {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n fill: var(--on-container-color, #000);\n padding: 1px;\n margin: 0px;\n width: 98%;\n border-radius: 8px;\n transform-origin: top;\n max-height: 0;\n transition: max-height 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n pointer-events: none;\n}\n\n.menu-module_openDropList__pYIA- {\n max-height: 800px !important;\n opacity: 1 !important;\n pointer-events: auto;\n}\n\n.menu-module_icon__nvdCD {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n fill: var(--header-on-background-color, #fff);\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_icon__nvdCD:focus, .menu-module_icon__nvdCD:active, .menu-module_icon__nvdCD:focus-within, .menu-module_icon__nvdCD:focus-visible {\n outline: none !important;\n border: none !important;\n box-shadow: none !important;\n -webkit-tap-highlight-color: transparent !important;\n}\n.menu-module_icon__nvdCD::-moz-focus-inner {\n border: 0;\n}\n\n.menu-module_header__xWzbR {\n flex-grow: 1;\n}\n\n.menu-module_menuItem__oXBNs {\n padding: 0.5rem 0;\n width: 100%;\n}\n.menu-module_menuItem__oXBNs:hover {\n background-color: var(--surface-color-variant, #ccc);\n cursor: pointer;\n}";
|
|
2729
|
+
var styles$4 = {"menu":"menu-module_menu__UDlDL","open":"menu-module_open__TpFnL","list":"menu-module_list__WPlII","listHeader":"menu-module_listHeader__Hv-1-","menuDropdown":"menu-module_menuDropdown__uQA25","droplist":"menu-module_droplist__-e059","openDropList":"menu-module_openDropList__pYIA-","header":"menu-module_header__xWzbR","menuItem":"menu-module_menuItem__oXBNs"};
|
|
2730
|
+
styleInject(css_248z$5);
|
|
2731
|
+
|
|
2732
|
+
const MenuContext = createContext();
|
|
2733
|
+
const useMenuContext = () => {
|
|
2734
|
+
return useContext(MenuContext);
|
|
2735
|
+
};
|
|
2736
|
+
|
|
2737
|
+
var _tmpl$$7 = /*#__PURE__*/template(`<div><ul>`);
|
|
2479
2738
|
const Menu = props => {
|
|
2480
2739
|
const [local, others] = splitProps(props, ['anchorElement', 'children', 'ref', 'show', 'position']);
|
|
2481
2740
|
const [menuRef, setMenuRef] = createSignal();
|
|
2741
|
+
const menuContext = useMenuContext();
|
|
2482
2742
|
const openStyle = () => {
|
|
2483
2743
|
if (local.show[0]()) {
|
|
2484
|
-
return styles$
|
|
2744
|
+
return styles$4.open;
|
|
2485
2745
|
}
|
|
2486
2746
|
return '';
|
|
2487
2747
|
};
|
|
2488
2748
|
createEffect(() => {
|
|
2749
|
+
const entry = {
|
|
2750
|
+
element: menuRef(),
|
|
2751
|
+
onClickOutside: e => {
|
|
2752
|
+
props.show[1](false);
|
|
2753
|
+
}
|
|
2754
|
+
};
|
|
2755
|
+
if (props.show[0]() && menuRef()) {
|
|
2756
|
+
entry.element.style.zIndex = `${999 + getEntryAmount()}`;
|
|
2757
|
+
registerWindowManager(entry);
|
|
2758
|
+
} else {
|
|
2759
|
+
unregisterWindowManager(entry);
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2762
|
+
const getAndSetPosition = (menu, anchor) => {
|
|
2763
|
+
const rect = anchor.getBoundingClientRect();
|
|
2764
|
+
menu.style.position = 'absolute';
|
|
2765
|
+
menu.style.top = `${rect.bottom}px`;
|
|
2766
|
+
if ((local?.position ?? 'left') === 'left') {
|
|
2767
|
+
menu.style.left = `${rect.left}px`;
|
|
2768
|
+
} else if (local.position === 'center') {
|
|
2769
|
+
menu.style.left = `${rect.left + rect.width - menu.offsetWidth / 2 - anchor.offsetWidth / 2}px`;
|
|
2770
|
+
} else {
|
|
2771
|
+
const mod = rect.width < 12 ? 1.25 : 1;
|
|
2772
|
+
const menuFix = menu.getBoundingClientRect().width * mod;
|
|
2773
|
+
menu.style.left = `${rect.right - (menuFix + window.scrollX)}px`;
|
|
2774
|
+
}
|
|
2775
|
+
};
|
|
2776
|
+
const updatePosition = () => {
|
|
2489
2777
|
const menu = menuRef();
|
|
2490
2778
|
const anchor = local.anchorElement();
|
|
2491
2779
|
if (menu && anchor) {
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
menu
|
|
2780
|
+
getAndSetPosition(menu, anchor);
|
|
2781
|
+
}
|
|
2782
|
+
};
|
|
2783
|
+
onMount(() => {
|
|
2784
|
+
const menu = menuRef();
|
|
2785
|
+
const anchor = local.anchorElement();
|
|
2786
|
+
if (menu && anchor) {
|
|
2787
|
+
setTimeout(() => {
|
|
2788
|
+
getAndSetPosition(menu, anchor);
|
|
2789
|
+
}, 50);
|
|
2790
|
+
if (!isNullish(menuContext)) {
|
|
2791
|
+
menuContext.registerWithParent(menu);
|
|
2501
2792
|
}
|
|
2793
|
+
document.addEventListener('scroll', updatePosition, true);
|
|
2794
|
+
window.addEventListener('resize', updatePosition);
|
|
2502
2795
|
}
|
|
2796
|
+
onCleanup(() => {
|
|
2797
|
+
document.removeEventListener('scroll', updatePosition, true);
|
|
2798
|
+
window.removeEventListener('resize', updatePosition);
|
|
2799
|
+
});
|
|
2503
2800
|
});
|
|
2504
2801
|
onCleanup(() => {
|
|
2505
2802
|
const menu = menuRef();
|
|
@@ -2507,43 +2804,35 @@ const Menu = props => {
|
|
|
2507
2804
|
menu.style.top = '';
|
|
2508
2805
|
menu.style.left = '';
|
|
2509
2806
|
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2807
|
+
if (!isNullish(menuContext)) {
|
|
2808
|
+
menuContext.unregisterWithParent(menuRef());
|
|
2809
|
+
}
|
|
2513
2810
|
});
|
|
2514
2811
|
return createComponent(Portal, {
|
|
2515
2812
|
get children() {
|
|
2516
|
-
var _el$ = _tmpl$$
|
|
2813
|
+
var _el$ = _tmpl$$7(),
|
|
2517
2814
|
_el$2 = _el$.firstChild;
|
|
2518
2815
|
use(setMenuRef, _el$);
|
|
2519
2816
|
spread(_el$, mergeProps(others, {
|
|
2520
2817
|
get ["class"]() {
|
|
2521
|
-
return `${styles$
|
|
2818
|
+
return `${styles$4.menu} ${openStyle()}`;
|
|
2522
2819
|
}
|
|
2523
2820
|
}), false, true);
|
|
2524
|
-
_el$2.$$click = e => {
|
|
2525
|
-
e.stopPropagation();
|
|
2526
|
-
e.preventDefault();
|
|
2527
|
-
};
|
|
2528
|
-
_el$2.$$pointerdown = e => {
|
|
2529
|
-
e.stopPropagation();
|
|
2530
|
-
};
|
|
2531
2821
|
insert(_el$2, () => local.children);
|
|
2532
|
-
createRenderEffect(() => className(_el$2, `${styles$
|
|
2822
|
+
createRenderEffect(() => className(_el$2, `${styles$4.list}`));
|
|
2533
2823
|
return _el$;
|
|
2534
2824
|
}
|
|
2535
2825
|
});
|
|
2536
2826
|
};
|
|
2537
|
-
delegateEvents(["pointerdown", "click"]);
|
|
2538
2827
|
|
|
2539
|
-
var _tmpl$$
|
|
2828
|
+
var _tmpl$$6 = /*#__PURE__*/template(`<li>`);
|
|
2540
2829
|
const MenuItem = props => {
|
|
2541
2830
|
const [local, others] = splitProps(props, ['children', 'class']);
|
|
2542
2831
|
return (() => {
|
|
2543
|
-
var _el$ = _tmpl$$
|
|
2832
|
+
var _el$ = _tmpl$$6();
|
|
2544
2833
|
spread(_el$, mergeProps(others, {
|
|
2545
2834
|
get ["class"]() {
|
|
2546
|
-
return `${styles$
|
|
2835
|
+
return `${styles$4.menuItem} ${local.class}`;
|
|
2547
2836
|
}
|
|
2548
2837
|
}), false, true);
|
|
2549
2838
|
insert(_el$, () => local.children);
|
|
@@ -2551,33 +2840,27 @@ const MenuItem = props => {
|
|
|
2551
2840
|
})();
|
|
2552
2841
|
};
|
|
2553
2842
|
|
|
2554
|
-
var _tmpl$$
|
|
2555
|
-
_tmpl$2$3 = /*#__PURE__*/template(`<ul>`);
|
|
2843
|
+
var _tmpl$$5 = /*#__PURE__*/template(`<li><span><span></span></span><ul>`);
|
|
2556
2844
|
const MenuDropdown = props => {
|
|
2557
2845
|
const [local, others] = splitProps(props, ['children', 'class', 'header']);
|
|
2558
2846
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
2559
2847
|
const onButtonClick = e => {
|
|
2560
|
-
e.stopPropagation();
|
|
2561
|
-
e.preventDefault();
|
|
2562
2848
|
setIsOpen(old => {
|
|
2563
2849
|
return !old;
|
|
2564
2850
|
});
|
|
2565
2851
|
};
|
|
2566
|
-
return
|
|
2567
|
-
var _el$ = _tmpl$$
|
|
2852
|
+
return (() => {
|
|
2853
|
+
var _el$ = _tmpl$$5(),
|
|
2568
2854
|
_el$2 = _el$.firstChild,
|
|
2569
|
-
_el$3 = _el$2.firstChild
|
|
2855
|
+
_el$3 = _el$2.firstChild,
|
|
2856
|
+
_el$4 = _el$2.nextSibling;
|
|
2570
2857
|
spread(_el$, mergeProps(others, {
|
|
2571
2858
|
get ["class"]() {
|
|
2572
|
-
return `${styles$
|
|
2859
|
+
return `${styles$4.menuDropdown} ${local.class}`;
|
|
2573
2860
|
}
|
|
2574
2861
|
}), false, true);
|
|
2575
|
-
insert(_el$3, () =>
|
|
2862
|
+
insert(_el$3, () => props?.header?.());
|
|
2576
2863
|
insert(_el$2, createComponent(Button, {
|
|
2577
|
-
onPointerDown: e => {
|
|
2578
|
-
e.stopPropagation();
|
|
2579
|
-
e.preventDefault();
|
|
2580
|
-
},
|
|
2581
2864
|
onClick: onButtonClick,
|
|
2582
2865
|
get children() {
|
|
2583
2866
|
return [createComponent(Show, {
|
|
@@ -2586,8 +2869,11 @@ const MenuDropdown = props => {
|
|
|
2586
2869
|
},
|
|
2587
2870
|
get children() {
|
|
2588
2871
|
return createComponent(Icon, {
|
|
2589
|
-
|
|
2590
|
-
|
|
2872
|
+
name: "keyboard_arrow_up",
|
|
2873
|
+
onClick: e => {
|
|
2874
|
+
// onButtonClick(e);
|
|
2875
|
+
e.stopPropagation();
|
|
2876
|
+
}
|
|
2591
2877
|
});
|
|
2592
2878
|
}
|
|
2593
2879
|
}), createComponent(Show, {
|
|
@@ -2596,193 +2882,240 @@ const MenuDropdown = props => {
|
|
|
2596
2882
|
},
|
|
2597
2883
|
get children() {
|
|
2598
2884
|
return createComponent(Icon, {
|
|
2599
|
-
|
|
2600
|
-
|
|
2885
|
+
name: "keyboard_arrow_down",
|
|
2886
|
+
onClick: e => {
|
|
2887
|
+
// onButtonClick(e);
|
|
2888
|
+
e.stopPropagation();
|
|
2889
|
+
}
|
|
2601
2890
|
});
|
|
2602
2891
|
}
|
|
2603
2892
|
})];
|
|
2604
2893
|
}
|
|
2605
2894
|
}), null);
|
|
2895
|
+
insert(_el$4, () => props.children);
|
|
2606
2896
|
createRenderEffect(_p$ => {
|
|
2607
|
-
var _v$ = `${styles$
|
|
2608
|
-
_v$2 = `${styles$
|
|
2897
|
+
var _v$ = `${styles$4.listHeader}`,
|
|
2898
|
+
_v$2 = `${styles$4.header}`,
|
|
2899
|
+
_v$3 = `${styles$4.list} ${styles$4.droplist} ${isOpen() ? styles$4.openDropList : ''}`;
|
|
2609
2900
|
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
2610
2901
|
_v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
|
|
2902
|
+
_v$3 !== _p$.a && className(_el$4, _p$.a = _v$3);
|
|
2611
2903
|
return _p$;
|
|
2612
2904
|
}, {
|
|
2613
2905
|
e: undefined,
|
|
2614
|
-
t: undefined
|
|
2906
|
+
t: undefined,
|
|
2907
|
+
a: undefined
|
|
2615
2908
|
});
|
|
2616
2909
|
return _el$;
|
|
2617
|
-
})()
|
|
2618
|
-
var _el$4 = _tmpl$2$3();
|
|
2619
|
-
insert(_el$4, () => local.children);
|
|
2620
|
-
createRenderEffect(() => className(_el$4, `${styles$2.list} ${styles$2.droplist} ${isOpen() ? styles$2.open : ''}`));
|
|
2621
|
-
return _el$4;
|
|
2622
|
-
})()];
|
|
2910
|
+
})();
|
|
2623
2911
|
};
|
|
2624
2912
|
|
|
2625
|
-
var css_248z$
|
|
2626
|
-
var
|
|
2627
|
-
styleInject(css_248z$
|
|
2913
|
+
var css_248z$4 = ".radio-group-module_radio-group__label__UV7dt {\n display: block;\n margin-bottom: 0.5em;\n font-weight: 600;\n}\n\n.radio-group-module_radio-group__options__AnbeY .radio-group-module_radio__6oLZe:not(:last-child) {\n margin-bottom: 0.5em;\n}\n\n.radio-group-module_radio-group--disabled__sI9-e .radio-group-module_radio-group__label__UV7dt {\n color: #ccc;\n}";
|
|
2914
|
+
var styles$3 = {"radio-group__label":"radio-group-module_radio-group__label__UV7dt","radio-group__options":"radio-group-module_radio-group__options__AnbeY","radio-group--disabled":"radio-group-module_radio-group--disabled__sI9-e"};
|
|
2915
|
+
styleInject(css_248z$4);
|
|
2628
2916
|
|
|
2629
|
-
var _tmpl$$
|
|
2630
|
-
_tmpl$2$
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2917
|
+
var _tmpl$$4 = /*#__PURE__*/template(`<div><div role=radiogroup>`),
|
|
2918
|
+
_tmpl$2$4 = /*#__PURE__*/template(`<div>`);
|
|
2919
|
+
const RadioGroupContext = createContext();
|
|
2920
|
+
let radioGroupCount = 0;
|
|
2921
|
+
function RadioGroup(props) {
|
|
2922
|
+
radioGroupCount++;
|
|
2923
|
+
const groupName = props.name ?? `radio-group-${radioGroupCount}`;
|
|
2924
|
+
const [internalValue, setInternalValue] = createSignal(props.defaultValue);
|
|
2925
|
+
const selectedValue = () => props.value !== undefined ? props.value : internalValue();
|
|
2926
|
+
const setSelectedValue = val => {
|
|
2927
|
+
if (props.value === undefined) {
|
|
2928
|
+
setInternalValue(val);
|
|
2641
2929
|
}
|
|
2642
|
-
|
|
2643
|
-
};
|
|
2644
|
-
const FormField2 = props => {
|
|
2645
|
-
const [local, others] = splitProps(props, ["children", "styleType", "name", "class", "legendClass", "formName"]);
|
|
2646
|
-
const context = useFormProvider();
|
|
2647
|
-
const formContext = useFormContext();
|
|
2648
|
-
const hasValue = val => {
|
|
2649
|
-
if (val === undefined || val === null) return false;
|
|
2650
|
-
if (typeof val === "string" && val.trim() === "") return false;
|
|
2651
|
-
if (Array.isArray(val) && val.length === 0) return false;
|
|
2652
|
-
return true;
|
|
2930
|
+
props.onChange?.(val);
|
|
2653
2931
|
};
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
const isFocused = context?.getFocused?.();
|
|
2663
|
-
const hasText = !context?.getTextInside?.();
|
|
2664
|
-
return !isFocused && (!hasText || !hasValue(currentVal));
|
|
2665
|
-
});
|
|
2666
|
-
const [fieldRef, setFieldRef] = createSignal();
|
|
2667
|
-
const theChildren = children(() => props.children);
|
|
2668
|
-
const formErrors = () => {
|
|
2669
|
-
const allErrors = (formContext?.formGroup.getErrors(local?.formName ?? '') ?? []).filter(error => error.hasError);
|
|
2670
|
-
if (allErrors.length === 0) return [];
|
|
2671
|
-
let errKeys = allErrors.map(error => error.key);
|
|
2672
|
-
// test just require
|
|
2673
|
-
if (errKeys.includes('required')) {
|
|
2674
|
-
errKeys = errKeys.filter(err => err !== 'minLength' && err !== 'maxLength');
|
|
2932
|
+
const radioRefs = [];
|
|
2933
|
+
const register = el => {
|
|
2934
|
+
radioRefs.push(el);
|
|
2935
|
+
};
|
|
2936
|
+
const unregister = el => {
|
|
2937
|
+
const index = radioRefs.indexOf(el);
|
|
2938
|
+
if (index >= 0) {
|
|
2939
|
+
radioRefs.splice(index, 1);
|
|
2675
2940
|
}
|
|
2676
|
-
//---
|
|
2677
|
-
return context?.getErrors?.().err.filter(err => errKeys.includes(err.key));
|
|
2678
2941
|
};
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2681
|
-
if (
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2942
|
+
const handleKeyDown = e => {
|
|
2943
|
+
const key = e.key;
|
|
2944
|
+
if (key === "ArrowLeft" || key === "ArrowUp" || key === "Left" || key === "Up") {
|
|
2945
|
+
e.preventDefault();
|
|
2946
|
+
const currentIndex = radioRefs.indexOf(e.currentTarget);
|
|
2947
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : radioRefs.length - 1;
|
|
2948
|
+
const prevRadio = radioRefs[prevIndex];
|
|
2949
|
+
setSelectedValue(prevRadio.value);
|
|
2950
|
+
prevRadio.focus();
|
|
2951
|
+
} else if (key === "ArrowRight" || key === "ArrowDown" || key === "Right" || key === "Down") {
|
|
2952
|
+
e.preventDefault();
|
|
2953
|
+
const currentIndex = radioRefs.indexOf(e.currentTarget);
|
|
2954
|
+
const nextIndex = currentIndex < radioRefs.length - 1 ? currentIndex + 1 : 0;
|
|
2955
|
+
const nextRadio = radioRefs[nextIndex];
|
|
2956
|
+
setSelectedValue(nextRadio.value);
|
|
2957
|
+
nextRadio.focus();
|
|
2958
|
+
} else if (key === "Home") {
|
|
2959
|
+
e.preventDefault();
|
|
2960
|
+
if (radioRefs.length > 0) {
|
|
2961
|
+
setSelectedValue(radioRefs[0].value);
|
|
2962
|
+
radioRefs[0].focus();
|
|
2963
|
+
}
|
|
2964
|
+
} else if (key === "End") {
|
|
2965
|
+
e.preventDefault();
|
|
2966
|
+
if (radioRefs.length > 0) {
|
|
2967
|
+
const lastIndex = radioRefs.length - 1;
|
|
2968
|
+
setSelectedValue(radioRefs[lastIndex].value);
|
|
2969
|
+
radioRefs[lastIndex].focus();
|
|
2970
|
+
}
|
|
2700
2971
|
}
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2972
|
+
};
|
|
2973
|
+
const contextValue = {
|
|
2974
|
+
name: groupName,
|
|
2975
|
+
selectedValue,
|
|
2976
|
+
setSelectedValue,
|
|
2977
|
+
register,
|
|
2978
|
+
unregister,
|
|
2979
|
+
handleKeyDown,
|
|
2980
|
+
disabled: !!props.disabled
|
|
2981
|
+
};
|
|
2982
|
+
return (() => {
|
|
2983
|
+
var _el$ = _tmpl$$4(),
|
|
2984
|
+
_el$2 = _el$.firstChild;
|
|
2985
|
+
insert(_el$, (() => {
|
|
2986
|
+
var _c$ = createMemo(() => !!props.label);
|
|
2987
|
+
return () => _c$() && (() => {
|
|
2988
|
+
var _el$3 = _tmpl$2$4();
|
|
2989
|
+
setAttribute(_el$3, "id", `${groupName}-label`);
|
|
2990
|
+
insert(_el$3, () => props.label);
|
|
2991
|
+
createRenderEffect(() => className(_el$3, styles$3["radio-group__label"]));
|
|
2992
|
+
return _el$3;
|
|
2993
|
+
})();
|
|
2994
|
+
})(), _el$2);
|
|
2995
|
+
insert(_el$2, createComponent(RadioGroupContext.Provider, {
|
|
2996
|
+
value: contextValue,
|
|
2997
|
+
get children() {
|
|
2998
|
+
return props.children;
|
|
2704
2999
|
}
|
|
2705
|
-
|
|
3000
|
+
}));
|
|
3001
|
+
createRenderEffect(_p$ => {
|
|
3002
|
+
var _v$ = styles$3["radio-group"],
|
|
3003
|
+
_v$2 = {
|
|
3004
|
+
[styles$3["radio-group--disabled"]]: props.disabled
|
|
3005
|
+
},
|
|
3006
|
+
_v$3 = styles$3["radio-group__options"],
|
|
3007
|
+
_v$4 = props.label ? `${groupName}-label` : undefined,
|
|
3008
|
+
_v$5 = props.label ? undefined : props.ariaLabel,
|
|
3009
|
+
_v$6 = props.disabled ? "true" : undefined;
|
|
3010
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
3011
|
+
_p$.t = classList(_el$, _v$2, _p$.t);
|
|
3012
|
+
_v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
|
|
3013
|
+
_v$4 !== _p$.o && setAttribute(_el$2, "aria-labelledby", _p$.o = _v$4);
|
|
3014
|
+
_v$5 !== _p$.i && setAttribute(_el$2, "aria-label", _p$.i = _v$5);
|
|
3015
|
+
_v$6 !== _p$.n && setAttribute(_el$2, "aria-disabled", _p$.n = _v$6);
|
|
3016
|
+
return _p$;
|
|
3017
|
+
}, {
|
|
3018
|
+
e: undefined,
|
|
3019
|
+
t: undefined,
|
|
3020
|
+
a: undefined,
|
|
3021
|
+
o: undefined,
|
|
3022
|
+
i: undefined,
|
|
3023
|
+
n: undefined
|
|
2706
3024
|
});
|
|
2707
|
-
|
|
3025
|
+
return _el$;
|
|
3026
|
+
})();
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
var css_248z$3 = ".radio-module_radio__HTGQn {\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n\n.radio-module_radio--disabled__oPPg9 {\n cursor: not-allowed;\n}\n\n.radio-module_radio__input__64jm3 {\n position: absolute;\n opacity: 0;\n pointer-events: none;\n}\n\n.radio-module_radio__circle__oVf3f {\n position: relative;\n width: 16px;\n height: 16px;\n border: 2px solid #666;\n border-radius: 50%;\n background: transparent;\n margin-right: 0.5em;\n flex-shrink: 0;\n}\n\n.radio-module_radio__circle__oVf3f:after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 8px;\n height: 8px;\n background: #007bff;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n display: none;\n}\n\n.radio-module_radio__input__64jm3:checked + .radio-module_radio__circle__oVf3f {\n border-color: #007bff;\n}\n\n.radio-module_radio__input__64jm3:checked + .radio-module_radio__circle__oVf3f:after {\n display: block;\n}\n\n.radio-module_radio__HTGQn:hover .radio-module_radio__circle__oVf3f {\n border-color: #444;\n}\n\n.radio-module_radio__HTGQn:focus-within .radio-module_radio__circle__oVf3f {\n outline: 2px solid #80bdff;\n outline-offset: 2px;\n}\n\n.radio-module_radio__label__ktLh- {\n vertical-align: middle;\n}\n\n.radio-module_radio__input__64jm3:disabled + .radio-module_radio__circle__oVf3f {\n border-color: #ccc;\n}\n\n.radio-module_radio__input__64jm3:disabled + .radio-module_radio__circle__oVf3f:after {\n background: #ccc;\n}\n\n.radio-module_radio--disabled__oPPg9 .radio-module_radio__label__ktLh- {\n color: #ccc;\n}";
|
|
3030
|
+
var styles$2 = {"radio":"radio-module_radio__HTGQn","radio--disabled":"radio-module_radio--disabled__oPPg9","radio__input":"radio-module_radio__input__64jm3","radio__circle":"radio-module_radio__circle__oVf3f","radio__label":"radio-module_radio__label__ktLh-"};
|
|
3031
|
+
styleInject(css_248z$3);
|
|
3032
|
+
|
|
3033
|
+
var _tmpl$$3 = /*#__PURE__*/template(`<label><input type=radio><span>`),
|
|
3034
|
+
_tmpl$2$3 = /*#__PURE__*/template(`<span>`);
|
|
3035
|
+
function Radio(props) {
|
|
3036
|
+
const group = useContext(RadioGroupContext);
|
|
3037
|
+
const isInGroup = !!group;
|
|
3038
|
+
// Manage controlled vs. uncontrolled state
|
|
3039
|
+
const [internalChecked, setInternalChecked] = createSignal(props.defaultChecked ?? false);
|
|
3040
|
+
const checkedState = () => {
|
|
3041
|
+
if (isInGroup) {
|
|
3042
|
+
return group.selectedValue() === props.value;
|
|
3043
|
+
}
|
|
3044
|
+
return props.checked !== undefined ? props.checked : internalChecked();
|
|
3045
|
+
};
|
|
3046
|
+
const isDisabled = () => !!(props.disabled || isInGroup && group.disabled);
|
|
3047
|
+
const handleChange = e => {
|
|
3048
|
+
if (isInGroup) {
|
|
3049
|
+
group.setSelectedValue(props.value);
|
|
3050
|
+
} else {
|
|
3051
|
+
if (props.checked === undefined) {
|
|
3052
|
+
setInternalChecked(true);
|
|
3053
|
+
}
|
|
3054
|
+
props.onChange?.(props.value);
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
let inputRef;
|
|
2708
3058
|
onMount(() => {
|
|
2709
|
-
if (
|
|
2710
|
-
|
|
2711
|
-
context.setTextInside(textInside);
|
|
3059
|
+
if (isInGroup && inputRef) {
|
|
3060
|
+
group.register(inputRef);
|
|
2712
3061
|
}
|
|
2713
3062
|
});
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
context?.setFormFieldRef?.(fieldRefer);
|
|
3063
|
+
onCleanup(() => {
|
|
3064
|
+
if (isInGroup && inputRef) {
|
|
3065
|
+
group.unregister(inputRef);
|
|
2718
3066
|
}
|
|
2719
3067
|
});
|
|
2720
|
-
return
|
|
2721
|
-
var _el$ = _tmpl$$
|
|
3068
|
+
return (() => {
|
|
3069
|
+
var _el$ = _tmpl$$3(),
|
|
2722
3070
|
_el$2 = _el$.firstChild,
|
|
2723
|
-
_el$3 = _el$2.
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
}), null);
|
|
2738
|
-
insert(_el$3, createComponent(Show, {
|
|
2739
|
-
get when() {
|
|
2740
|
-
return hasRequired();
|
|
2741
|
-
},
|
|
2742
|
-
get children() {
|
|
2743
|
-
return [createMemo(() => context?.getName()), " *"];
|
|
2744
|
-
}
|
|
2745
|
-
}), null);
|
|
2746
|
-
insert(_el$, theChildren, null);
|
|
3071
|
+
_el$3 = _el$2.nextSibling;
|
|
3072
|
+
addEventListener(_el$2, "keydown", isInGroup ? group.handleKeyDown : undefined, true);
|
|
3073
|
+
_el$2.addEventListener("change", handleChange);
|
|
3074
|
+
var _ref$ = inputRef;
|
|
3075
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : inputRef = _el$2;
|
|
3076
|
+
insert(_el$, (() => {
|
|
3077
|
+
var _c$ = createMemo(() => !!props.label);
|
|
3078
|
+
return () => _c$() && (() => {
|
|
3079
|
+
var _el$4 = _tmpl$2$3();
|
|
3080
|
+
insert(_el$4, () => props.label);
|
|
3081
|
+
createRenderEffect(() => className(_el$4, styles$2["radio__label"]));
|
|
3082
|
+
return _el$4;
|
|
3083
|
+
})();
|
|
3084
|
+
})(), null);
|
|
2747
3085
|
createRenderEffect(_p$ => {
|
|
2748
|
-
var _v$ =
|
|
2749
|
-
_v$2 =
|
|
2750
|
-
|
|
2751
|
-
|
|
3086
|
+
var _v$ = styles$2.radio,
|
|
3087
|
+
_v$2 = {
|
|
3088
|
+
[styles$2["radio--disabled"]]: isDisabled(),
|
|
3089
|
+
[styles$2["radio--checked"]]: checkedState()
|
|
3090
|
+
},
|
|
3091
|
+
_v$3 = styles$2["radio__input"],
|
|
3092
|
+
_v$4 = isInGroup ? group.name : props.name,
|
|
3093
|
+
_v$5 = isDisabled(),
|
|
3094
|
+
_v$6 = props.label ? undefined : props.ariaLabel,
|
|
3095
|
+
_v$7 = styles$2["radio__circle"];
|
|
3096
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
3097
|
+
_p$.t = classList(_el$, _v$2, _p$.t);
|
|
3098
|
+
_v$3 !== _p$.a && className(_el$2, _p$.a = _v$3);
|
|
3099
|
+
_v$4 !== _p$.o && setAttribute(_el$2, "name", _p$.o = _v$4);
|
|
3100
|
+
_v$5 !== _p$.i && (_el$2.disabled = _p$.i = _v$5);
|
|
3101
|
+
_v$6 !== _p$.n && setAttribute(_el$2, "aria-label", _p$.n = _v$6);
|
|
3102
|
+
_v$7 !== _p$.s && className(_el$3, _p$.s = _v$7);
|
|
2752
3103
|
return _p$;
|
|
2753
3104
|
}, {
|
|
2754
3105
|
e: undefined,
|
|
2755
|
-
t: undefined
|
|
3106
|
+
t: undefined,
|
|
3107
|
+
a: undefined,
|
|
3108
|
+
o: undefined,
|
|
3109
|
+
i: undefined,
|
|
3110
|
+
n: undefined,
|
|
3111
|
+
s: undefined
|
|
2756
3112
|
});
|
|
3113
|
+
createRenderEffect(() => _el$2.value = props.value.toString());
|
|
3114
|
+
createRenderEffect(() => _el$2.checked = checkedState());
|
|
2757
3115
|
return _el$;
|
|
2758
|
-
})()
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
get each() {
|
|
2762
|
-
return formErrors();
|
|
2763
|
-
},
|
|
2764
|
-
children: (error, index) => {
|
|
2765
|
-
return (() => {
|
|
2766
|
-
var _el$5 = _tmpl$2$2();
|
|
2767
|
-
insert(_el$5, () => error.display);
|
|
2768
|
-
createRenderEffect(_p$ => {
|
|
2769
|
-
var _v$3 = style.error,
|
|
2770
|
-
_v$4 = getErrorLocStyle(index());
|
|
2771
|
-
_v$3 !== _p$.e && className(_el$5, _p$.e = _v$3);
|
|
2772
|
-
_p$.t = style$9(_el$5, _v$4, _p$.t);
|
|
2773
|
-
return _p$;
|
|
2774
|
-
}, {
|
|
2775
|
-
e: undefined,
|
|
2776
|
-
t: undefined
|
|
2777
|
-
});
|
|
2778
|
-
return _el$5;
|
|
2779
|
-
})();
|
|
2780
|
-
}
|
|
2781
|
-
}));
|
|
2782
|
-
createRenderEffect(() => className(_el$4, style.errorContainer));
|
|
2783
|
-
return _el$4;
|
|
2784
|
-
})()];
|
|
2785
|
-
};
|
|
3116
|
+
})();
|
|
3117
|
+
}
|
|
3118
|
+
delegateEvents(["keydown"]);
|
|
2786
3119
|
|
|
2787
3120
|
/**
|
|
2788
3121
|
* A class that encapsulates an array of form controls along with their validation logic.
|
|
@@ -2816,52 +3149,159 @@ class FormArray {
|
|
|
2816
3149
|
* @private
|
|
2817
3150
|
*/
|
|
2818
3151
|
errors = [];
|
|
3152
|
+
/**
|
|
3153
|
+
* The current values of the form controls in the array.
|
|
3154
|
+
*
|
|
3155
|
+
* @private
|
|
3156
|
+
*/
|
|
3157
|
+
internalValues;
|
|
3158
|
+
/**
|
|
3159
|
+
* A function to update the current values of the form controls.
|
|
3160
|
+
*
|
|
3161
|
+
* @private
|
|
3162
|
+
*/
|
|
3163
|
+
setValues;
|
|
2819
3164
|
/**
|
|
2820
3165
|
* Creates an instance of FormArray.
|
|
2821
3166
|
*
|
|
2822
3167
|
* @param arrayValidation - A tuple where the first element is an initial array of control-level validation definitions
|
|
2823
3168
|
* and the second element is an array of array-level validators.
|
|
3169
|
+
* @param initialValues - Optional initial values for the form controls.
|
|
2824
3170
|
*/
|
|
2825
|
-
constructor(arrayValidation) {
|
|
3171
|
+
constructor(arrayValidation, initialValues = []) {
|
|
2826
3172
|
const [valid, setValid] = createStore(arrayValidation[0]);
|
|
3173
|
+
const [values, setValues] = createStore(initialValues);
|
|
2827
3174
|
this.internalArrayValidation = arrayValidation[1];
|
|
2828
3175
|
this.internalValidation = valid;
|
|
2829
3176
|
this.setValidation = setValid;
|
|
3177
|
+
this.internalValues = values;
|
|
3178
|
+
this.setValues = setValues;
|
|
3179
|
+
}
|
|
3180
|
+
/**
|
|
3181
|
+
* Gets the current values of the form controls in the array.
|
|
3182
|
+
*
|
|
3183
|
+
* @returns A cloned copy of the values array.
|
|
3184
|
+
*/
|
|
3185
|
+
get() {
|
|
3186
|
+
return this.internalValues;
|
|
3187
|
+
}
|
|
3188
|
+
/**
|
|
3189
|
+
* Gets the value of a specific control in the array.
|
|
3190
|
+
*
|
|
3191
|
+
* @param index - The index of the control.
|
|
3192
|
+
* @returns A cloned copy of the control value.
|
|
3193
|
+
*/
|
|
3194
|
+
getAt(index) {
|
|
3195
|
+
if (index < 0 || index >= this.internalValues.length) {
|
|
3196
|
+
return undefined;
|
|
3197
|
+
}
|
|
3198
|
+
return Clone(this.internalValues[index]);
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* Gets a property value from an object at the specified index.
|
|
3202
|
+
*
|
|
3203
|
+
* @param index - The index of the control.
|
|
3204
|
+
* @param key - The property key to retrieve.
|
|
3205
|
+
* @returns The property value, or undefined if not found.
|
|
3206
|
+
*/
|
|
3207
|
+
getProperty(index, key) {
|
|
3208
|
+
const item = this.getAt(index);
|
|
3209
|
+
return item ? item[key] : undefined;
|
|
3210
|
+
}
|
|
3211
|
+
/**
|
|
3212
|
+
* Sets the values of all controls in the array.
|
|
3213
|
+
*
|
|
3214
|
+
* @param values - The new values for the controls.
|
|
3215
|
+
*/
|
|
3216
|
+
set(values) {
|
|
3217
|
+
this.setValues(Clone(values));
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Sets the value of a control at the specified index.
|
|
3221
|
+
*
|
|
3222
|
+
* @param index - The index of the control to update.
|
|
3223
|
+
* @param value - The new value for the control.
|
|
3224
|
+
*/
|
|
3225
|
+
setAt(index, value) {
|
|
3226
|
+
if (index < 0 || index >= this.internalValues.length) {
|
|
3227
|
+
console.error(`Index ${index} out of bounds.`);
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3230
|
+
this.setValues(index, Clone(value));
|
|
2830
3231
|
}
|
|
2831
3232
|
/**
|
|
2832
|
-
*
|
|
3233
|
+
* Sets a property value on an object at the specified index.
|
|
3234
|
+
*
|
|
3235
|
+
* @param index - The index of the control.
|
|
3236
|
+
* @param key - The property key to set.
|
|
3237
|
+
* @param value - The new value for the property.
|
|
3238
|
+
*/
|
|
3239
|
+
setProperty(index, key, value) {
|
|
3240
|
+
if (index < 0 || index >= this.internalValues.length) {
|
|
3241
|
+
console.error(`Index ${index} out of bounds.`);
|
|
3242
|
+
return;
|
|
3243
|
+
}
|
|
3244
|
+
this.setValues(index, oldValue => {
|
|
3245
|
+
const newValue = {
|
|
3246
|
+
...oldValue
|
|
3247
|
+
};
|
|
3248
|
+
newValue[key] = Clone(value);
|
|
3249
|
+
return newValue;
|
|
3250
|
+
});
|
|
3251
|
+
}
|
|
3252
|
+
/**
|
|
3253
|
+
* Removes a control at the specified index.
|
|
2833
3254
|
*
|
|
2834
3255
|
* @param index - The index of the control to remove.
|
|
2835
3256
|
*/
|
|
2836
3257
|
remove(index) {
|
|
3258
|
+
// Remove validation
|
|
2837
3259
|
this.setValidation(old => {
|
|
2838
3260
|
const copy = [...old];
|
|
2839
3261
|
copy.splice(index, 1);
|
|
2840
3262
|
return copy;
|
|
2841
3263
|
});
|
|
3264
|
+
// Remove value
|
|
3265
|
+
this.setValues(old => {
|
|
3266
|
+
const copy = [...old];
|
|
3267
|
+
copy.splice(index, 1);
|
|
3268
|
+
return copy;
|
|
3269
|
+
});
|
|
3270
|
+
// Remove errors
|
|
3271
|
+
if (this.errors.length > index) {
|
|
3272
|
+
this.errors.splice(index, 1);
|
|
3273
|
+
}
|
|
2842
3274
|
}
|
|
2843
3275
|
/**
|
|
2844
|
-
* Replaces a control
|
|
3276
|
+
* Replaces a control at the specified index with new validation and value.
|
|
2845
3277
|
*
|
|
2846
3278
|
* @param index - The index of the control to replace.
|
|
2847
3279
|
* @param controlValidation - The new validation to apply for the control.
|
|
3280
|
+
* @param value - The new value for the control.
|
|
2848
3281
|
*/
|
|
2849
|
-
replace(index, controlValidation) {
|
|
3282
|
+
replace(index, controlValidation, value) {
|
|
2850
3283
|
this.setValidation(old => {
|
|
2851
3284
|
const copy = [...old];
|
|
2852
3285
|
copy.splice(index, 1, controlValidation);
|
|
2853
3286
|
return copy;
|
|
2854
3287
|
});
|
|
3288
|
+
if (value !== undefined) {
|
|
3289
|
+
this.setValues(index, Clone(value));
|
|
3290
|
+
}
|
|
2855
3291
|
}
|
|
2856
3292
|
/**
|
|
2857
|
-
* Adds a new control
|
|
3293
|
+
* Adds a new control to the array with validation and optional value.
|
|
2858
3294
|
*
|
|
2859
3295
|
* @param controlValidation - The validation definition to add.
|
|
3296
|
+
* @param value - Optional value for the new control.
|
|
2860
3297
|
*/
|
|
2861
|
-
add(controlValidation) {
|
|
3298
|
+
add(controlValidation, value) {
|
|
2862
3299
|
this.setValidation(old => {
|
|
2863
3300
|
return [...old, controlValidation];
|
|
2864
3301
|
});
|
|
3302
|
+
this.setValues(old => {
|
|
3303
|
+
return [...old, value ? Clone(value) : {}];
|
|
3304
|
+
});
|
|
2865
3305
|
}
|
|
2866
3306
|
/**
|
|
2867
3307
|
* Checks if any validation errors exist.
|
|
@@ -2888,6 +3328,35 @@ class FormArray {
|
|
|
2888
3328
|
hasValidator(index, errKey) {
|
|
2889
3329
|
return this.errors[index].some(error => error.key === errKey);
|
|
2890
3330
|
}
|
|
3331
|
+
/**
|
|
3332
|
+
* Gets all errors for the form array.
|
|
3333
|
+
*
|
|
3334
|
+
* @returns An array of error arrays for each control.
|
|
3335
|
+
*/
|
|
3336
|
+
getErrors() {
|
|
3337
|
+
return Clone(this.errors);
|
|
3338
|
+
}
|
|
3339
|
+
/**
|
|
3340
|
+
* Gets errors for a specific control in the array.
|
|
3341
|
+
*
|
|
3342
|
+
* @param index - The index of the control.
|
|
3343
|
+
* @returns An array of errors for the control, or an empty array if not found.
|
|
3344
|
+
*/
|
|
3345
|
+
getErrorsAt(index) {
|
|
3346
|
+
if (index < 0 || index >= this.errors.length) {
|
|
3347
|
+
return [];
|
|
3348
|
+
}
|
|
3349
|
+
return Clone(this.errors[index]);
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* Validates the form array using current values.
|
|
3353
|
+
*
|
|
3354
|
+
* @param index - Optional index to validate just one control.
|
|
3355
|
+
* @returns True if validation passes, false otherwise.
|
|
3356
|
+
*/
|
|
3357
|
+
validateCurrent(index) {
|
|
3358
|
+
return this.validate(this.internalValues, index);
|
|
3359
|
+
}
|
|
2891
3360
|
/**
|
|
2892
3361
|
* Validates the provided form control values.
|
|
2893
3362
|
*
|
|
@@ -2903,7 +3372,16 @@ class FormArray {
|
|
|
2903
3372
|
}
|
|
2904
3373
|
// Validate all controls in the form array.
|
|
2905
3374
|
if (isNullish(index)) {
|
|
2906
|
-
|
|
3375
|
+
const cleanValue = val => {
|
|
3376
|
+
if (isNullish(val)) {
|
|
3377
|
+
return [];
|
|
3378
|
+
} else if (Array.isArray(val)) {
|
|
3379
|
+
return val;
|
|
3380
|
+
} else {
|
|
3381
|
+
return [val];
|
|
3382
|
+
}
|
|
3383
|
+
};
|
|
3384
|
+
this.errors = cleanValue(values).map((value, i) => {
|
|
2907
3385
|
const errors = this.internalValidation.map(([_, validators]) => {
|
|
2908
3386
|
return validators.map(validator => ({
|
|
2909
3387
|
key: validator.errKey,
|
|
@@ -2919,17 +3397,179 @@ class FormArray {
|
|
|
2919
3397
|
});
|
|
2920
3398
|
return this.errors.flat().every(error => !error.hasError);
|
|
2921
3399
|
}
|
|
2922
|
-
// Validate a specific control in the form array.
|
|
2923
|
-
const errors = this.internalValidation.map(([_, validators]) => {
|
|
2924
|
-
return validators.map(validator => ({
|
|
2925
|
-
key: validator.errKey,
|
|
2926
|
-
hasError: !validator.revalidate(values[index])
|
|
2927
|
-
}));
|
|
3400
|
+
// Validate a specific control in the form array.
|
|
3401
|
+
const errors = this.internalValidation.map(([_, validators]) => {
|
|
3402
|
+
return validators.map(validator => ({
|
|
3403
|
+
key: validator.errKey,
|
|
3404
|
+
hasError: !validator.revalidate(values[index])
|
|
3405
|
+
}));
|
|
3406
|
+
});
|
|
3407
|
+
this.errors[index] = errors.flat();
|
|
3408
|
+
return this.errors[index].every(error => !error.hasError);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
var css_248z$2 = ".formfield-module_formField__w6mH9:focus-within > legend, .formfield-module_has-focus__9ingx > legend {\n top: -8px !important;\n font-size: 0.75rem !important;\n}\n\n.formfield-module_formField__w6mH9 {\n position: relative;\n display: inline-block;\n border-radius: var(--border-radius-md);\n box-sizing: border-box;\n border: none;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n margin-top: 0px !important;\n margin-bottom: 0px !important;\n}\n.formfield-module_formField__w6mH9 > legend {\n position: absolute;\n left: 12px;\n top: calc(50% - 0.5em);\n font-size: 1rem;\n transition: top 0.25s ease, font-size 0.25s ease;\n pointer-events: none;\n}\n.formfield-module_formField__w6mH9 input::-moz-placeholder, .formfield-module_formField__w6mH9 select::-moz-placeholder {\n opacity: 0 !important;\n -moz-transition: opacity 0.25s ease;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 input::placeholder,\n.formfield-module_formField__w6mH9 select::placeholder {\n opacity: 0 !important;\n transition: opacity 0.25s ease;\n}\n.formfield-module_formField__w6mH9 label {\n position: relative;\n top: -0.5rem;\n padding-right: 10px;\n}\n.formfield-module_formField__w6mH9:has(textarea) {\n position: relative;\n margin: 8px;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n width: auto;\n min-width: 95%;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n padding-bottom: 8px;\n border: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea:focus {\n outline: none;\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_formField__w6mH9:has(textarea) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) {\n position: relative;\n height: 48px !important;\n padding: 0px !important;\n width: 100%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) legend {\n height: 16px;\n max-height: 16px;\n transition: all 0.25s ease;\n top: calc(50% - 1em);\n z-index: 10000;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select] {\n position: absolute;\n left: 0px;\n right: 0px;\n padding: 0px !important;\n margin: 0px !important;\n height: 48px !important;\n border-radius: 4px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: auto;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has([is=coles-solid-select]) [is=coles-solid-select]:nth-child(n) {\n border-radius: 4px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) legend {\n position: absolute;\n height: 24px;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text] {\n background-color: transparent !important;\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::-moz-placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=text]) input[type=text]::placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) {\n height: 48px;\n position: relative;\n width: 100%;\n margin-top: 16px;\n margin-bottom: 16px;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) legend {\n height: 24px;\n position: absolute;\n left: 8px;\n transition: all 0.25s ease;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number] {\n background-color: transparent !important;\n color: var(--on-primary-color, #fff);\n height: 24px;\n border-radius: 4px;\n margin: 8px 0px;\n font-family: \"Roboto, sans-serif\";\n font-size: 16px;\n width: 100%;\n min-width: 95%;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::-moz-placeholder {\n opacity: 0;\n}\n.formfield-module_formField__w6mH9:has(input[type=number]) input[type=number]::placeholder {\n opacity: 0;\n}\n@media screen and (max-width: 768px) {\n .formfield-module_formField__w6mH9 {\n max-width: 75%;\n }\n}\n\n.formfield-module_topMargin__dahW5 {\n margin-top: 12px;\n}\n\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=text]) input[type=text]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number] {\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(input[type=number]) input[type=number]::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has([is=coles-solid-select]) [is=coles-solid-select] {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) {\n width: 100%;\n height: auto;\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::-moz-placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n.formfield-module_primary__7BYyQ:has(textarea) textarea::placeholder {\n color: var(--on-container-color, #000);\n opacity: var(--text-emphasis-medium, 87%);\n}\n\n.formfield-module_legendStyle__gnI49 {\n background-color: transparent;\n opacity: var(--text-emphasis-medium, 87%);\n width: 100%;\n transition: all 0.3s ease;\n}\n\n.formfield-module_checkboxPadding__DU1CG {\n padding: 0px;\n padding-bottom: 10px;\n padding-left: 10px;\n padding-right: 10px;\n}\n\n.formfield-module_errorContainer__HR4PL {\n position: relative;\n min-height: 2rem;\n}\n\n.formfield-module_error__wNBh2 {\n position: absolute;\n background: transparent;\n color: var(--error-color, #B00020);\n font-size: 10px;\n}";
|
|
3413
|
+
var style = {"formField":"formfield-module_formField__w6mH9","has-focus":"formfield-module_has-focus__9ingx","primary":"formfield-module_primary__7BYyQ","legendStyle":"formfield-module_legendStyle__gnI49","errorContainer":"formfield-module_errorContainer__HR4PL","error":"formfield-module_error__wNBh2"};
|
|
3414
|
+
styleInject(css_248z$2);
|
|
3415
|
+
|
|
3416
|
+
var _tmpl$$2 = /*#__PURE__*/template(`<fieldset><legend><span>`),
|
|
3417
|
+
_tmpl$2$2 = /*#__PURE__*/template(`<div>`);
|
|
3418
|
+
const FormField = props => {
|
|
3419
|
+
return createComponent(Provider$1, {
|
|
3420
|
+
get name() {
|
|
3421
|
+
return props.name;
|
|
3422
|
+
},
|
|
3423
|
+
get formName() {
|
|
3424
|
+
return props.formName;
|
|
3425
|
+
},
|
|
3426
|
+
get children() {
|
|
3427
|
+
return createComponent(FormField2, props);
|
|
3428
|
+
}
|
|
3429
|
+
});
|
|
3430
|
+
};
|
|
3431
|
+
const FormField2 = props => {
|
|
3432
|
+
const [local, others] = splitProps(props, ["children", "styleType", "name", "class", "legendClass", "formName"]);
|
|
3433
|
+
const context = useFormProvider();
|
|
3434
|
+
const formContext = useFormContext();
|
|
3435
|
+
const [fieldRef, setFieldRef] = createSignal(); // Moved up before it's used
|
|
3436
|
+
const hasValue = val => {
|
|
3437
|
+
if (val === undefined || val === null) return false;
|
|
3438
|
+
if (typeof val === "string" && val.trim() === "") return false;
|
|
3439
|
+
if (Array.isArray(val) && val.length === 0) return false;
|
|
3440
|
+
return true;
|
|
3441
|
+
};
|
|
3442
|
+
const shouldFloat = createMemo(() => {
|
|
3443
|
+
let currentVal;
|
|
3444
|
+
if (hasValue(formContext?.data?.[local?.formName ?? ''])) {
|
|
3445
|
+
currentVal = formContext?.data?.[local?.formName ?? ''];
|
|
3446
|
+
}
|
|
3447
|
+
if (hasValue(context?.getValue?.())) {
|
|
3448
|
+
currentVal = context?.getValue?.();
|
|
3449
|
+
}
|
|
3450
|
+
return hasValue(currentVal) || context?.getFocused?.();
|
|
3451
|
+
});
|
|
3452
|
+
const theChildren = children(() => props.children);
|
|
3453
|
+
const formErrors = () => {
|
|
3454
|
+
const allErrors = (formContext?.formGroup.getErrors(local?.formName ?? '') ?? []).filter(error => error.hasError);
|
|
3455
|
+
if (allErrors.length === 0) return [];
|
|
3456
|
+
let errKeys = allErrors.map(error => error.key);
|
|
3457
|
+
// test just require
|
|
3458
|
+
if (errKeys.includes('required')) {
|
|
3459
|
+
errKeys = errKeys.filter(err => err !== 'minLength' && err !== 'maxLength');
|
|
3460
|
+
}
|
|
3461
|
+
//---
|
|
3462
|
+
return context?.getErrors?.().err.filter(err => errKeys.includes(err.key));
|
|
3463
|
+
};
|
|
3464
|
+
const hasRequired = createMemo(() => {
|
|
3465
|
+
if (isNullish(local?.formName)) return false;
|
|
3466
|
+
if (Object.keys(props).includes('required') && props.required !== false) return true;
|
|
3467
|
+
return formContext?.formGroup?.hasValidator?.(local?.formName ?? '', 'required');
|
|
3468
|
+
});
|
|
3469
|
+
const getErrorLocStyle = index => {
|
|
3470
|
+
const fieldBox = fieldRef()?.getBoundingClientRect();
|
|
3471
|
+
if (!fieldBox) return {};
|
|
3472
|
+
return {
|
|
3473
|
+
top: `${index * 12}px`
|
|
3474
|
+
};
|
|
3475
|
+
};
|
|
3476
|
+
createEffect(() => {
|
|
3477
|
+
context.setName(props.name);
|
|
3478
|
+
});
|
|
3479
|
+
context?.setFocused?.(false);
|
|
3480
|
+
useClickOutside([fieldRef], () => {
|
|
3481
|
+
if (!isNullish(formContext?.data)) {
|
|
3482
|
+
const value = formContext?.data?.[local?.formName ?? ''];
|
|
3483
|
+
context?.setTextInside(!hasValue(value));
|
|
3484
|
+
} else if (!isNullish(context?.getValue)) {
|
|
3485
|
+
const val = context?.getValue?.();
|
|
3486
|
+
context?.setTextInside(!hasValue(val));
|
|
3487
|
+
}
|
|
3488
|
+
context?.setFocused(prev => {
|
|
3489
|
+
if (prev) {
|
|
3490
|
+
formContext?.formGroup?.validate?.(local?.formName ?? '');
|
|
3491
|
+
}
|
|
3492
|
+
return false;
|
|
3493
|
+
});
|
|
3494
|
+
});
|
|
3495
|
+
onMount(() => {
|
|
3496
|
+
if (context?.getValue !== undefined) {
|
|
3497
|
+
const textInside = !hasValue(context?.getValue?.());
|
|
3498
|
+
context.setTextInside(textInside);
|
|
3499
|
+
}
|
|
3500
|
+
});
|
|
3501
|
+
createEffect(() => {
|
|
3502
|
+
const fieldRefer = fieldRef?.();
|
|
3503
|
+
if (fieldRefer) {
|
|
3504
|
+
context?.setFormFieldRef?.(fieldRefer);
|
|
3505
|
+
}
|
|
3506
|
+
});
|
|
3507
|
+
return [(() => {
|
|
3508
|
+
var _el$ = _tmpl$$2(),
|
|
3509
|
+
_el$2 = _el$.firstChild,
|
|
3510
|
+
_el$3 = _el$2.firstChild;
|
|
3511
|
+
use(setFieldRef, _el$);
|
|
3512
|
+
spread(_el$, mergeProps(others, {
|
|
3513
|
+
get ["class"]() {
|
|
3514
|
+
return `${style["primary"]} ${style.formField} ${shouldFloat() ? style["has-focus"] : ""} ${local.class ?? ''}`;
|
|
3515
|
+
}
|
|
3516
|
+
}), false, true);
|
|
3517
|
+
insert(_el$3, createComponent(Show, {
|
|
3518
|
+
get when() {
|
|
3519
|
+
return !hasRequired();
|
|
3520
|
+
},
|
|
3521
|
+
get children() {
|
|
3522
|
+
return context.getName();
|
|
3523
|
+
}
|
|
3524
|
+
}), null);
|
|
3525
|
+
insert(_el$3, createComponent(Show, {
|
|
3526
|
+
get when() {
|
|
3527
|
+
return hasRequired();
|
|
3528
|
+
},
|
|
3529
|
+
get children() {
|
|
3530
|
+
return [createMemo(() => context?.getName()), " *"];
|
|
3531
|
+
}
|
|
3532
|
+
}), null);
|
|
3533
|
+
insert(_el$, theChildren, null);
|
|
3534
|
+
createRenderEffect(_p$ => {
|
|
3535
|
+
var _v$ = `${local?.legendClass ?? ''}`,
|
|
3536
|
+
_v$2 = `${style.legendStyle}`;
|
|
3537
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
3538
|
+
_v$2 !== _p$.t && className(_el$3, _p$.t = _v$2);
|
|
3539
|
+
return _p$;
|
|
3540
|
+
}, {
|
|
3541
|
+
e: undefined,
|
|
3542
|
+
t: undefined
|
|
2928
3543
|
});
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
3544
|
+
return _el$;
|
|
3545
|
+
})(), (() => {
|
|
3546
|
+
var _el$4 = _tmpl$2$2();
|
|
3547
|
+
insert(_el$4, createComponent(For, {
|
|
3548
|
+
get each() {
|
|
3549
|
+
return formErrors();
|
|
3550
|
+
},
|
|
3551
|
+
children: (error, index) => {
|
|
3552
|
+
return (() => {
|
|
3553
|
+
var _el$5 = _tmpl$2$2();
|
|
3554
|
+
insert(_el$5, () => error.display);
|
|
3555
|
+
createRenderEffect(_p$ => {
|
|
3556
|
+
var _v$3 = style.error,
|
|
3557
|
+
_v$4 = getErrorLocStyle(index());
|
|
3558
|
+
_v$3 !== _p$.e && className(_el$5, _p$.e = _v$3);
|
|
3559
|
+
_p$.t = style$9(_el$5, _v$4, _p$.t);
|
|
3560
|
+
return _p$;
|
|
3561
|
+
}, {
|
|
3562
|
+
e: undefined,
|
|
3563
|
+
t: undefined
|
|
3564
|
+
});
|
|
3565
|
+
return _el$5;
|
|
3566
|
+
})();
|
|
3567
|
+
}
|
|
3568
|
+
}));
|
|
3569
|
+
createRenderEffect(() => className(_el$4, style.errorContainer));
|
|
3570
|
+
return _el$4;
|
|
3571
|
+
})()];
|
|
3572
|
+
};
|
|
2933
3573
|
|
|
2934
3574
|
/**
|
|
2935
3575
|
* A collection of static validator functions that return a ValidatorResult.
|
|
@@ -3070,7 +3710,8 @@ class FormGroup {
|
|
|
3070
3710
|
this.keys.push(key);
|
|
3071
3711
|
if (value instanceof FormArray) {
|
|
3072
3712
|
// If the value is a FormArray, store it directly.
|
|
3073
|
-
|
|
3713
|
+
// We need to ensure that when T[key] is an array type, we store the array returned by FormArray
|
|
3714
|
+
newData[key] = value.get();
|
|
3074
3715
|
} else {
|
|
3075
3716
|
// Otherwise, initialize the data, validators, and errors for the control.
|
|
3076
3717
|
newData[key] = value[0];
|
|
@@ -3087,8 +3728,26 @@ class FormGroup {
|
|
|
3087
3728
|
}
|
|
3088
3729
|
get(key) {
|
|
3089
3730
|
if (!key) return Clone(this.internalDataSignal[0]);
|
|
3731
|
+
// If the control is a FormArray, use its get method
|
|
3732
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3733
|
+
// Return the array from FormArray.get() as the expected type T[K]
|
|
3734
|
+
return this.internalDataSignal[0][key].get();
|
|
3735
|
+
}
|
|
3090
3736
|
return Clone(this.internalDataSignal[0][key]);
|
|
3091
3737
|
}
|
|
3738
|
+
/**
|
|
3739
|
+
* Gets a specific item from a FormArray at the given index
|
|
3740
|
+
*
|
|
3741
|
+
* @param key - The key of the form control containing the FormArray
|
|
3742
|
+
* @param index - The index to retrieve from the array
|
|
3743
|
+
* @returns The item at the specified index, or undefined if not found
|
|
3744
|
+
*/
|
|
3745
|
+
getArrayItem(key, index) {
|
|
3746
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3747
|
+
return this.internalDataSignal[0][key].getAt(index);
|
|
3748
|
+
}
|
|
3749
|
+
return undefined;
|
|
3750
|
+
}
|
|
3092
3751
|
/**
|
|
3093
3752
|
* Checks whether a specific validator error exists for a given control.
|
|
3094
3753
|
*
|
|
@@ -3097,10 +3756,22 @@ class FormGroup {
|
|
|
3097
3756
|
* @returns `true` if the error exists, otherwise `false`.
|
|
3098
3757
|
*/
|
|
3099
3758
|
hasValidator(key, errKey) {
|
|
3100
|
-
|
|
3759
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3760
|
+
return this.internalDataSignal[0][key].hasError();
|
|
3761
|
+
}
|
|
3762
|
+
return this.errors[0]()?.[key]?.some(error => error.key === errKey) ?? false;
|
|
3101
3763
|
}
|
|
3764
|
+
/**
|
|
3765
|
+
* Gets all errors for a specific control
|
|
3766
|
+
*
|
|
3767
|
+
* @param key - The key of the form control
|
|
3768
|
+
* @returns An array of errors for the control
|
|
3769
|
+
*/
|
|
3102
3770
|
getErrors(key) {
|
|
3103
|
-
|
|
3771
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3772
|
+
return [];
|
|
3773
|
+
}
|
|
3774
|
+
return this.errors[0]()?.[key] ?? [];
|
|
3104
3775
|
}
|
|
3105
3776
|
/**
|
|
3106
3777
|
* Determines if a specific control has any validation errors.
|
|
@@ -3109,10 +3780,24 @@ class FormGroup {
|
|
|
3109
3780
|
* @returns `true` if any error is present, otherwise `false`.
|
|
3110
3781
|
*/
|
|
3111
3782
|
hasError(key) {
|
|
3112
|
-
|
|
3783
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3784
|
+
return this.internalDataSignal[0][key].hasError();
|
|
3785
|
+
}
|
|
3786
|
+
return this.errors[0]()?.[key]?.some(error => error.hasError) ?? false;
|
|
3113
3787
|
}
|
|
3788
|
+
/**
|
|
3789
|
+
* Sets an error state for a validator on a specific control
|
|
3790
|
+
*
|
|
3791
|
+
* @param key - The key of the form control
|
|
3792
|
+
* @param errKey - The error key to update
|
|
3793
|
+
* @param hasError - Whether the error should be set or cleared
|
|
3794
|
+
*/
|
|
3114
3795
|
setError(key, errKey, hasError) {
|
|
3115
|
-
|
|
3796
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3797
|
+
// Not supported for FormArray - errors are managed internally
|
|
3798
|
+
return;
|
|
3799
|
+
}
|
|
3800
|
+
const errorIndex = this.errors[0]()[key]?.findIndex(error => error.key === errKey);
|
|
3116
3801
|
if (errorIndex !== -1) {
|
|
3117
3802
|
this.errors[1](old => {
|
|
3118
3803
|
old[key][errorIndex].hasError = hasError;
|
|
@@ -3127,11 +3812,41 @@ class FormGroup {
|
|
|
3127
3812
|
* @param value - The new value to assign to the control.
|
|
3128
3813
|
*/
|
|
3129
3814
|
set(key, value) {
|
|
3815
|
+
// If the control is a FormArray, use its set method
|
|
3816
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3817
|
+
if (Array.isArray(value)) {
|
|
3818
|
+
this.internalDataSignal[0][key].set(value);
|
|
3819
|
+
}
|
|
3820
|
+
return;
|
|
3821
|
+
}
|
|
3130
3822
|
this.internalDataSignal[1](old => ({
|
|
3131
3823
|
...old,
|
|
3132
3824
|
[key]: value
|
|
3133
3825
|
}));
|
|
3134
3826
|
}
|
|
3827
|
+
/**
|
|
3828
|
+
* Adds an item to a FormArray control
|
|
3829
|
+
*
|
|
3830
|
+
* @param key - The key of the FormArray control
|
|
3831
|
+
* @param controlValidation - The validation for the new item
|
|
3832
|
+
* @param value - Optional initial value for the new item
|
|
3833
|
+
*/
|
|
3834
|
+
addToArray(key, controlValidation, value) {
|
|
3835
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3836
|
+
this.internalDataSignal[0][key].add(controlValidation, value);
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
/**
|
|
3840
|
+
* Removes an item from a FormArray control
|
|
3841
|
+
*
|
|
3842
|
+
* @param key - The key of the FormArray control
|
|
3843
|
+
* @param index - The index of the item to remove
|
|
3844
|
+
*/
|
|
3845
|
+
removeFromArray(key, index) {
|
|
3846
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3847
|
+
this.internalDataSignal[0][key].remove(index);
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3135
3850
|
/**
|
|
3136
3851
|
* Validates the form data.
|
|
3137
3852
|
*
|
|
@@ -3145,14 +3860,12 @@ class FormGroup {
|
|
|
3145
3860
|
console.error('Data is null');
|
|
3146
3861
|
return false;
|
|
3147
3862
|
}
|
|
3148
|
-
// Validate all controls if no key is specified.
|
|
3149
3863
|
if (!key) {
|
|
3150
|
-
const results = this.keys.map(
|
|
3864
|
+
const results = this.keys.map(k => this.validate(k));
|
|
3151
3865
|
return results.every(result => result);
|
|
3152
3866
|
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
return this.internalDataSignal[0][key].validate(this.internalDataSignal[0][key].get());
|
|
3867
|
+
if (this.internalDataSignal?.[0]?.[key] instanceof FormArray) {
|
|
3868
|
+
return this.internalDataSignal[0][key].validateCurrent();
|
|
3156
3869
|
}
|
|
3157
3870
|
const validators = this.validators[key];
|
|
3158
3871
|
if (!validators) return true;
|
|
@@ -3206,26 +3919,41 @@ const useColumnContext = () => {
|
|
|
3206
3919
|
return useContext(ColumnContext);
|
|
3207
3920
|
};
|
|
3208
3921
|
|
|
3209
|
-
var css_248z$1 = ".table-module_table__um-mK {\n border-collapse: collapse;\n text-align: center;\n}\n.table-module_table__um-mK thead tr th {\n padding: 0.5rem;\n}\n.table-module_table__um-mK tr[isdropheader=true] {\n cursor: pointer;\n}\n.table-module_table__um-mK tr td {\n padding: 0.5rem;\n width: -moz-max-content;\n width: max-content;\n}\n\n.table-module_dropRow__BugV9 {\n transform-origin: top;\n
|
|
3922
|
+
var css_248z$1 = ".table-module_table__um-mK {\n border-collapse: collapse;\n text-align: center;\n}\n.table-module_table__um-mK thead tr th {\n padding: 0.5rem;\n}\n.table-module_table__um-mK tr[isdropheader=true] {\n cursor: pointer;\n}\n.table-module_table__um-mK tr[isdropheader=true]:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.table-module_table__um-mK tr td {\n padding: 0.5rem;\n width: -moz-max-content;\n width: max-content;\n}\n\n.table-module_dropRow__BugV9 {\n transform-origin: top;\n animation: table-module_rowDropping__zE5Uz 0.5s reverse forwards;\n display: none;\n}\n\n.table-module_openDropRow__rjfjd {\n animation: table-module_rowDropping__zE5Uz 0.5s forwards;\n display: table-row;\n}\n\n@keyframes table-module_rowDropping__zE5Uz {\n 0% {\n max-height: 0;\n opacity: 0;\n }\n 1% {\n max-height: 0;\n opacity: 0;\n }\n 100% {\n max-height: 2000px;\n opacity: 1;\n }\n}";
|
|
3210
3923
|
var styles$1 = {"table":"table-module_table__um-mK","dropRow":"table-module_dropRow__BugV9","openDropRow":"table-module_openDropRow__rjfjd"};
|
|
3211
3924
|
styleInject(css_248z$1);
|
|
3212
3925
|
|
|
3213
|
-
var _tmpl$$1 = /*#__PURE__*/template(`<
|
|
3214
|
-
_tmpl$2$1 = /*#__PURE__*/template(`<
|
|
3215
|
-
_tmpl$3$1 = /*#__PURE__*/template(`<
|
|
3216
|
-
_tmpl$4 = /*#__PURE__*/template(`<
|
|
3217
|
-
_tmpl$5 = /*#__PURE__*/template(`<
|
|
3926
|
+
var _tmpl$$1 = /*#__PURE__*/template(`<span>Error`),
|
|
3927
|
+
_tmpl$2$1 = /*#__PURE__*/template(`<table><colgroup></colgroup><thead></thead><tbody></tbody><tfoot>`),
|
|
3928
|
+
_tmpl$3$1 = /*#__PURE__*/template(`<col>`),
|
|
3929
|
+
_tmpl$4 = /*#__PURE__*/template(`<tr>`),
|
|
3930
|
+
_tmpl$5 = /*#__PURE__*/template(`<th>`),
|
|
3931
|
+
_tmpl$6 = /*#__PURE__*/template(`<td>`);
|
|
3218
3932
|
const Table = props => {
|
|
3219
|
-
const
|
|
3933
|
+
const [redrawRows, setRedrawRows] = createSignal(false);
|
|
3934
|
+
const [mounted, setMounted] = createSignal(false);
|
|
3220
3935
|
const tableContext = {};
|
|
3221
3936
|
const getProps = () => props;
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3937
|
+
const tableData = () => {
|
|
3938
|
+
redrawRows();
|
|
3939
|
+
return props.data() ?? [];
|
|
3940
|
+
};
|
|
3941
|
+
// Create a reactive memo for columns to handle dynamic changes
|
|
3942
|
+
const reactiveColumns = createMemo(() => getProps().columns);
|
|
3943
|
+
// Add effect to reset column styles when columns change
|
|
3944
|
+
createEffect(() => {
|
|
3945
|
+
const columns = reactiveColumns();
|
|
3946
|
+
if (columns.length > 0) {
|
|
3947
|
+
// Reset column styles when columns change
|
|
3948
|
+
setColumnStyle({});
|
|
3949
|
+
}
|
|
3950
|
+
});
|
|
3226
3951
|
tableContext.setDataSource = data => {
|
|
3227
3952
|
getProps().setData?.(() => [...data]);
|
|
3228
|
-
|
|
3953
|
+
};
|
|
3954
|
+
tableContext.getDataSource = () => {
|
|
3955
|
+
const data = getProps().data();
|
|
3956
|
+
return data;
|
|
3229
3957
|
};
|
|
3230
3958
|
const [headers, setHeaders] = createSignal({});
|
|
3231
3959
|
tableContext.addHeaderCell = (name, index, header) => {
|
|
@@ -3239,31 +3967,75 @@ const Table = props => {
|
|
|
3239
3967
|
});
|
|
3240
3968
|
});
|
|
3241
3969
|
};
|
|
3242
|
-
const [rows, setRows] = createSignal({});
|
|
3243
|
-
|
|
3970
|
+
// const [rows, setRows] = createSignal<RowOrganized<T>>({});
|
|
3971
|
+
const [rowData, setRows] = createStore({});
|
|
3972
|
+
const rows = () => {
|
|
3973
|
+
mounted();
|
|
3974
|
+
return rowData;
|
|
3975
|
+
};
|
|
3976
|
+
const rowKeys = createMemo(() => {
|
|
3977
|
+
return Object.keys(rows()).map(key => parseInt(key)).sort((a, b) => a - b);
|
|
3978
|
+
});
|
|
3979
|
+
tableContext.addRowCell = (index, name, cell, isDropDown) => {
|
|
3244
3980
|
setRows(old => {
|
|
3245
|
-
|
|
3246
|
-
...old
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3981
|
+
const newRows = {
|
|
3982
|
+
...old
|
|
3983
|
+
};
|
|
3984
|
+
if (!newRows[index]) {
|
|
3985
|
+
newRows[index] = {};
|
|
3986
|
+
}
|
|
3987
|
+
// Preserve any existing dropHeader flag when updating a row
|
|
3988
|
+
const existingData = old[index]?.[name];
|
|
3989
|
+
newRows[index][name] = {
|
|
3990
|
+
element: cell,
|
|
3991
|
+
dropRow: !!isDropDown,
|
|
3992
|
+
dropHeader: existingData?.dropHeader || false
|
|
3993
|
+
};
|
|
3994
|
+
return newRows;
|
|
3995
|
+
});
|
|
3996
|
+
};
|
|
3997
|
+
tableContext.removeRowCell = (index, name) => {
|
|
3998
|
+
setRows(old => {
|
|
3999
|
+
if (!old[index] || !old[index][name]) return old;
|
|
4000
|
+
const newRows = {
|
|
4001
|
+
...old
|
|
4002
|
+
};
|
|
4003
|
+
const newRowData = {
|
|
4004
|
+
...newRows[index]
|
|
3254
4005
|
};
|
|
4006
|
+
delete newRowData[name];
|
|
4007
|
+
newRows[index] = newRowData;
|
|
4008
|
+
return newRows;
|
|
3255
4009
|
});
|
|
3256
4010
|
};
|
|
3257
4011
|
const [footerCell, setFooterCell] = createSignal({});
|
|
3258
4012
|
tableContext.addFooterCell = (index, name, cell) => {
|
|
3259
4013
|
setFooterCell(old => {
|
|
3260
|
-
|
|
3261
|
-
...old
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
4014
|
+
const newFooter = {
|
|
4015
|
+
...old
|
|
4016
|
+
};
|
|
4017
|
+
if (!newFooter[index]) {
|
|
4018
|
+
newFooter[index] = {};
|
|
4019
|
+
}
|
|
4020
|
+
newFooter[index] = {
|
|
4021
|
+
...newFooter[index],
|
|
4022
|
+
[name]: cell
|
|
4023
|
+
};
|
|
4024
|
+
return newFooter;
|
|
4025
|
+
});
|
|
4026
|
+
};
|
|
4027
|
+
tableContext.removeFooterCell = (index, name) => {
|
|
4028
|
+
setFooterCell(old => {
|
|
4029
|
+
if (!old[index] || !old[index][name]) return old;
|
|
4030
|
+
const newFooter = {
|
|
4031
|
+
...old
|
|
4032
|
+
};
|
|
4033
|
+
const newRowData = {
|
|
4034
|
+
...newFooter[index]
|
|
3266
4035
|
};
|
|
4036
|
+
delete newRowData[name];
|
|
4037
|
+
newFooter[index] = newRowData;
|
|
4038
|
+
return newFooter;
|
|
3267
4039
|
});
|
|
3268
4040
|
};
|
|
3269
4041
|
const [headerStyle, setHeaderStyle] = createSignal({});
|
|
@@ -3303,27 +4075,43 @@ const Table = props => {
|
|
|
3303
4075
|
});
|
|
3304
4076
|
};
|
|
3305
4077
|
const [rowStyle, setRowStyle] = createSignal({});
|
|
3306
|
-
tableContext.addRowStyle = (index, style,
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
4078
|
+
tableContext.addRowStyle = (index, style, isDropRow, isDropHeader) => {
|
|
4079
|
+
// If this is a dropdown row or dropdown header, update the row data
|
|
4080
|
+
const firstColumn = reactiveColumns()?.[0];
|
|
4081
|
+
if (!isNullish(firstColumn)) {
|
|
4082
|
+
setRows(old => {
|
|
4083
|
+
// Get existing row data
|
|
4084
|
+
const existingRow = old[index] || {};
|
|
4085
|
+
const existingCell = existingRow[firstColumn] || {
|
|
4086
|
+
element: () => []
|
|
4087
|
+
};
|
|
4088
|
+
return {
|
|
4089
|
+
...old,
|
|
4090
|
+
[index]: {
|
|
4091
|
+
...existingRow,
|
|
4092
|
+
[firstColumn]: {
|
|
4093
|
+
...existingCell,
|
|
4094
|
+
element: existingCell.element,
|
|
4095
|
+
// Set dropRow based on isDropRow param or preserve existing value
|
|
4096
|
+
dropRow: isDropRow === true ? true : existingCell.dropRow || false,
|
|
4097
|
+
// Set dropHeader based on isDropHeader param or preserve existing value
|
|
4098
|
+
dropHeader: isDropHeader === true ? true : existingCell.dropHeader || false
|
|
3318
4099
|
}
|
|
3319
|
-
}
|
|
3320
|
-
}
|
|
3321
|
-
}
|
|
4100
|
+
}
|
|
4101
|
+
};
|
|
4102
|
+
});
|
|
3322
4103
|
}
|
|
4104
|
+
// Update row style
|
|
3323
4105
|
setRowStyle(old => {
|
|
3324
4106
|
return {
|
|
3325
4107
|
...old,
|
|
3326
|
-
[index]:
|
|
4108
|
+
[index]: {
|
|
4109
|
+
...style,
|
|
4110
|
+
all: {
|
|
4111
|
+
...style?.all,
|
|
4112
|
+
isDropHeader: isDropHeader === true ? true : undefined
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
3327
4115
|
};
|
|
3328
4116
|
});
|
|
3329
4117
|
};
|
|
@@ -3354,22 +4142,84 @@ const Table = props => {
|
|
|
3354
4142
|
};
|
|
3355
4143
|
});
|
|
3356
4144
|
};
|
|
4145
|
+
// Add a removeColumnStyle method to allow cleanup
|
|
4146
|
+
tableContext.removeColumnStyle = name => {
|
|
4147
|
+
setColumnStyle(old => {
|
|
4148
|
+
const newStyles = {
|
|
4149
|
+
...old
|
|
4150
|
+
};
|
|
4151
|
+
delete newStyles[name];
|
|
4152
|
+
return newStyles;
|
|
4153
|
+
});
|
|
4154
|
+
};
|
|
4155
|
+
const [refresh, setRefresh] = createSignal(false);
|
|
4156
|
+
let firstRun = false;
|
|
4157
|
+
tableContext.refresh = refresh;
|
|
4158
|
+
createEffect(() => {
|
|
4159
|
+
if (firstRun) {
|
|
4160
|
+
setRefresh(old => !old);
|
|
4161
|
+
} else {
|
|
4162
|
+
firstRun = true;
|
|
4163
|
+
}
|
|
4164
|
+
tableData();
|
|
4165
|
+
});
|
|
3357
4166
|
const headerFactory = (index, column) => {
|
|
3358
4167
|
return headers()?.[index]?.[column];
|
|
3359
4168
|
};
|
|
3360
4169
|
const rowStyleFactory = rowNum => {
|
|
3361
|
-
return rowStyle()?.[rowNum];
|
|
4170
|
+
return rowStyle()?.[rowNum] ?? {};
|
|
3362
4171
|
};
|
|
3363
4172
|
const [dropOpenStore, setDropOpenStore] = createStore([]);
|
|
4173
|
+
// Enhanced renderCell with better type safety and error handling
|
|
4174
|
+
const renderCell = (cell, item, index) => {
|
|
4175
|
+
if (typeof cell === 'function') {
|
|
4176
|
+
try {
|
|
4177
|
+
return cell(item, index);
|
|
4178
|
+
} catch (error) {
|
|
4179
|
+
console.error('Error rendering table cell:', error, {
|
|
4180
|
+
cellType: typeof cell,
|
|
4181
|
+
itemType: typeof item,
|
|
4182
|
+
index
|
|
4183
|
+
});
|
|
4184
|
+
return (() => {
|
|
4185
|
+
var _el$ = _tmpl$$1();
|
|
4186
|
+
createRenderEffect(() => className(_el$, styles$1.errorCell));
|
|
4187
|
+
return _el$;
|
|
4188
|
+
})();
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
// Handle null or undefined cells gracefully
|
|
4192
|
+
if (cell === null || cell === undefined) {
|
|
4193
|
+
return "Cell nully";
|
|
4194
|
+
}
|
|
4195
|
+
return cell;
|
|
4196
|
+
};
|
|
4197
|
+
onMount(() => {
|
|
4198
|
+
setMounted(true);
|
|
4199
|
+
});
|
|
4200
|
+
const getIsDropOpen = (rowNum, index) => {
|
|
4201
|
+
// Check if this row should be displayed based on its position
|
|
4202
|
+
const firstColumn = reactiveColumns()?.[0];
|
|
4203
|
+
const rowData = rows()?.[rowNum]?.[firstColumn];
|
|
4204
|
+
// For regular rows, show normally
|
|
4205
|
+
if (!rowData?.dropRow) {
|
|
4206
|
+
return true;
|
|
4207
|
+
}
|
|
4208
|
+
// For dropdown rows, respect the dropdown state
|
|
4209
|
+
return dropOpenStore[index] ?? false;
|
|
4210
|
+
};
|
|
4211
|
+
const dropRowStyle = (rowNum, index) => {
|
|
4212
|
+
return getIsDropOpen(rowNum, index) ? styles$1.openDropRow : styles$1.dropRow;
|
|
4213
|
+
};
|
|
3364
4214
|
return createComponent(TableProvider, mergeProps(tableContext, {
|
|
3365
4215
|
get children() {
|
|
3366
4216
|
return [(() => {
|
|
3367
|
-
var _el$ = _tmpl
|
|
3368
|
-
_el$
|
|
3369
|
-
_el$3 = _el$2.nextSibling,
|
|
4217
|
+
var _el$2 = _tmpl$2$1(),
|
|
4218
|
+
_el$3 = _el$2.firstChild,
|
|
3370
4219
|
_el$4 = _el$3.nextSibling,
|
|
3371
|
-
_el$5 = _el$4.nextSibling
|
|
3372
|
-
|
|
4220
|
+
_el$5 = _el$4.nextSibling,
|
|
4221
|
+
_el$6 = _el$5.nextSibling;
|
|
4222
|
+
spread(_el$3, mergeProps(() => getProps()?.otherStyles?.colGroup?.all, {
|
|
3373
4223
|
get style() {
|
|
3374
4224
|
return getProps().otherStyles?.colGroup?.style;
|
|
3375
4225
|
},
|
|
@@ -3377,13 +4227,13 @@ const Table = props => {
|
|
|
3377
4227
|
return getProps().otherStyles?.colGroup?.class;
|
|
3378
4228
|
}
|
|
3379
4229
|
}), false, true);
|
|
3380
|
-
insert(_el$
|
|
4230
|
+
insert(_el$3, createComponent(For, {
|
|
3381
4231
|
get each() {
|
|
3382
|
-
return
|
|
4232
|
+
return reactiveColumns();
|
|
3383
4233
|
},
|
|
3384
4234
|
children: column => (() => {
|
|
3385
|
-
var _el$
|
|
3386
|
-
spread(_el$
|
|
4235
|
+
var _el$7 = _tmpl$3$1();
|
|
4236
|
+
spread(_el$7, mergeProps(() => columnStyle()[column]?.all, {
|
|
3387
4237
|
get style() {
|
|
3388
4238
|
return columnStyle()[column]?.style;
|
|
3389
4239
|
},
|
|
@@ -3391,10 +4241,10 @@ const Table = props => {
|
|
|
3391
4241
|
return columnStyle()[column]?.class;
|
|
3392
4242
|
}
|
|
3393
4243
|
}), false, false);
|
|
3394
|
-
return _el$
|
|
4244
|
+
return _el$7;
|
|
3395
4245
|
})()
|
|
3396
4246
|
}));
|
|
3397
|
-
spread(_el$
|
|
4247
|
+
spread(_el$4, mergeProps(() => getProps()?.otherStyles?.thead?.all, {
|
|
3398
4248
|
get style() {
|
|
3399
4249
|
return getProps().otherStyles?.thead?.style;
|
|
3400
4250
|
},
|
|
@@ -3402,22 +4252,22 @@ const Table = props => {
|
|
|
3402
4252
|
return getProps().otherStyles?.thead?.class;
|
|
3403
4253
|
}
|
|
3404
4254
|
}), false, true);
|
|
3405
|
-
insert(_el$
|
|
4255
|
+
insert(_el$4, createComponent(For, {
|
|
3406
4256
|
get each() {
|
|
3407
4257
|
return Object.keys(headers()).map(key => parseInt(key)).sort((a, b) => a - b);
|
|
3408
4258
|
},
|
|
3409
4259
|
children: rowNum => {
|
|
3410
4260
|
return (() => {
|
|
3411
|
-
var _el$
|
|
3412
|
-
insert(_el$
|
|
4261
|
+
var _el$8 = _tmpl$4();
|
|
4262
|
+
insert(_el$8, createComponent(For, {
|
|
3413
4263
|
get each() {
|
|
3414
|
-
return
|
|
4264
|
+
return reactiveColumns();
|
|
3415
4265
|
},
|
|
3416
4266
|
children: (column, index) => {
|
|
3417
4267
|
const headCell = headers()[rowNum]?.[column];
|
|
3418
4268
|
return !!headCell ? (() => {
|
|
3419
|
-
var _el$
|
|
3420
|
-
spread(_el$
|
|
4269
|
+
var _el$9 = _tmpl$5();
|
|
4270
|
+
spread(_el$9, mergeProps(() => headerStyle()[column]?.[rowNum]?.all, {
|
|
3421
4271
|
get style() {
|
|
3422
4272
|
return headerStyle()[column]?.[rowNum]?.style;
|
|
3423
4273
|
},
|
|
@@ -3425,26 +4275,26 @@ const Table = props => {
|
|
|
3425
4275
|
return headerStyle()[column]?.[rowNum]?.class;
|
|
3426
4276
|
}
|
|
3427
4277
|
}), false, true);
|
|
3428
|
-
insert(_el$
|
|
3429
|
-
return _el$
|
|
4278
|
+
insert(_el$9, () => headerFactory(rowNum, column));
|
|
4279
|
+
return _el$9;
|
|
3430
4280
|
})() : [];
|
|
3431
4281
|
}
|
|
3432
4282
|
}));
|
|
3433
4283
|
createRenderEffect(_p$ => {
|
|
3434
4284
|
var _v$4 = headerRowStyle()[rowNum]?.style,
|
|
3435
4285
|
_v$5 = headerRowStyle()[rowNum]?.class;
|
|
3436
|
-
_p$.e = style$9(_el$
|
|
3437
|
-
_v$5 !== _p$.t && className(_el$
|
|
4286
|
+
_p$.e = style$9(_el$8, _v$4, _p$.e);
|
|
4287
|
+
_v$5 !== _p$.t && className(_el$8, _p$.t = _v$5);
|
|
3438
4288
|
return _p$;
|
|
3439
4289
|
}, {
|
|
3440
4290
|
e: undefined,
|
|
3441
4291
|
t: undefined
|
|
3442
4292
|
});
|
|
3443
|
-
return _el$
|
|
4293
|
+
return _el$8;
|
|
3444
4294
|
})();
|
|
3445
4295
|
}
|
|
3446
4296
|
}));
|
|
3447
|
-
spread(_el$
|
|
4297
|
+
spread(_el$5, mergeProps(() => getProps()?.otherStyles?.tbody?.all, {
|
|
3448
4298
|
get style() {
|
|
3449
4299
|
return getProps().otherStyles?.tbody?.style;
|
|
3450
4300
|
},
|
|
@@ -3452,81 +4302,60 @@ const Table = props => {
|
|
|
3452
4302
|
return getProps().otherStyles?.tbody?.class;
|
|
3453
4303
|
}
|
|
3454
4304
|
}), false, true);
|
|
3455
|
-
insert(_el$
|
|
4305
|
+
insert(_el$5, createComponent(For, {
|
|
3456
4306
|
get each() {
|
|
3457
|
-
return
|
|
4307
|
+
return tableData();
|
|
3458
4308
|
},
|
|
3459
4309
|
children: (item, index) => createComponent(For, {
|
|
3460
4310
|
get each() {
|
|
3461
|
-
return
|
|
4311
|
+
return rowKeys();
|
|
3462
4312
|
},
|
|
3463
4313
|
children: rowNum => {
|
|
3464
4314
|
return (() => {
|
|
3465
|
-
var _el$
|
|
3466
|
-
spread(_el$
|
|
4315
|
+
var _el$10 = _tmpl$4();
|
|
4316
|
+
spread(_el$10, mergeProps(() => rowStyleFactory?.(rowNum)?.all, {
|
|
3467
4317
|
get style() {
|
|
3468
|
-
return rowStyleFactory(rowNum)?.style;
|
|
4318
|
+
return rowStyleFactory?.(rowNum)?.style;
|
|
3469
4319
|
},
|
|
3470
4320
|
"onClick": e => {
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
//
|
|
3474
|
-
if (
|
|
3475
|
-
|
|
4321
|
+
const firstColumn = reactiveColumns()?.[0];
|
|
4322
|
+
const rowData = rows()?.[rowNum]?.[firstColumn];
|
|
4323
|
+
// Only toggle dropdown state if this is a header row
|
|
4324
|
+
if (rowData?.dropHeader === true) {
|
|
4325
|
+
e.preventDefault();
|
|
4326
|
+
setDropOpenStore(index(), !dropOpenStore[index()]);
|
|
4327
|
+
}
|
|
4328
|
+
// Call any additional click handlers
|
|
4329
|
+
if (rowStyleFactory !== undefined) {
|
|
4330
|
+
const onClick = rowStyleFactory(rowNum).all?.onClick;
|
|
4331
|
+
if (typeof onClick === 'function') {
|
|
4332
|
+
onClick(e);
|
|
4333
|
+
}
|
|
3476
4334
|
}
|
|
3477
|
-
// @ts-ignore
|
|
3478
|
-
rowStyleFactory(rowNum).all?.onClick?.(e);
|
|
3479
4335
|
},
|
|
3480
4336
|
get ["class"]() {
|
|
3481
|
-
return rowStyleFactory(rowNum)?.class
|
|
4337
|
+
return `${dropRowStyle(rowNum, index())} ${rowStyleFactory?.(rowNum)?.all?.class ?? ''}`;
|
|
3482
4338
|
}
|
|
3483
4339
|
}), false, true);
|
|
3484
|
-
insert(_el$
|
|
3485
|
-
|
|
3486
|
-
|
|
4340
|
+
insert(_el$10, createComponent(TableRowColumns, {
|
|
4341
|
+
reactiveColumns: reactiveColumns,
|
|
4342
|
+
rows: rows,
|
|
4343
|
+
rowNum: rowNum,
|
|
4344
|
+
get index() {
|
|
4345
|
+
return index();
|
|
3487
4346
|
},
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
return (() => {
|
|
3494
|
-
var _el$10 = _tmpl$5();
|
|
3495
|
-
insert(_el$10, () => cell(item, index()));
|
|
3496
|
-
createRenderEffect(_p$ => {
|
|
3497
|
-
var _v$6 = `${styles$1.dropRow} ${!!dropOpenStore[index()] === true ? styles$1.openDropRow : ''} `,
|
|
3498
|
-
_v$7 = getProps().columns.length;
|
|
3499
|
-
_v$6 !== _p$.e && className(_el$10, _p$.e = _v$6);
|
|
3500
|
-
_v$7 !== _p$.t && setAttribute(_el$10, "colspan", _p$.t = _v$7);
|
|
3501
|
-
return _p$;
|
|
3502
|
-
}, {
|
|
3503
|
-
e: undefined,
|
|
3504
|
-
t: undefined
|
|
3505
|
-
});
|
|
3506
|
-
return _el$10;
|
|
3507
|
-
})();
|
|
3508
|
-
}
|
|
3509
|
-
return !isNullish(cell) ? (() => {
|
|
3510
|
-
var _el$11 = _tmpl$5();
|
|
3511
|
-
spread(_el$11, mergeProps(() => cellStyle?.()?.[rowNum]?.[column]?.all, {
|
|
3512
|
-
get style() {
|
|
3513
|
-
return cellStyle()[rowNum]?.[column]?.style;
|
|
3514
|
-
},
|
|
3515
|
-
get ["class"]() {
|
|
3516
|
-
return cellStyle()[rowNum]?.[column]?.class;
|
|
3517
|
-
}
|
|
3518
|
-
}), false, true);
|
|
3519
|
-
insert(_el$11, () => cell(item, index()));
|
|
3520
|
-
return _el$11;
|
|
3521
|
-
})() : [];
|
|
3522
|
-
}
|
|
4347
|
+
setDropOpenStore: setDropOpenStore,
|
|
4348
|
+
renderCell: renderCell,
|
|
4349
|
+
item: item,
|
|
4350
|
+
dropOpenStore: dropOpenStore,
|
|
4351
|
+
cellStyle: cellStyle
|
|
3523
4352
|
}));
|
|
3524
|
-
return _el$
|
|
4353
|
+
return _el$10;
|
|
3525
4354
|
})();
|
|
3526
4355
|
}
|
|
3527
4356
|
})
|
|
3528
4357
|
}));
|
|
3529
|
-
spread(_el$
|
|
4358
|
+
spread(_el$6, mergeProps(() => getProps()?.otherStyles?.tfoot?.all, {
|
|
3530
4359
|
get style() {
|
|
3531
4360
|
return getProps().otherStyles?.tfoot?.style;
|
|
3532
4361
|
},
|
|
@@ -3534,14 +4363,14 @@ const Table = props => {
|
|
|
3534
4363
|
return getProps().otherStyles?.tfoot?.class;
|
|
3535
4364
|
}
|
|
3536
4365
|
}), false, true);
|
|
3537
|
-
insert(_el$
|
|
4366
|
+
insert(_el$6, createComponent(For, {
|
|
3538
4367
|
get each() {
|
|
3539
4368
|
return Object.keys(footerCell()).map(key => parseInt(key)).sort((a, b) => a - b);
|
|
3540
4369
|
},
|
|
3541
4370
|
children: rowNum => {
|
|
3542
4371
|
return (() => {
|
|
3543
|
-
var _el$
|
|
3544
|
-
spread(_el$
|
|
4372
|
+
var _el$11 = _tmpl$4();
|
|
4373
|
+
spread(_el$11, mergeProps(() => footerStyle()[rowNum]?.all, {
|
|
3545
4374
|
get style() {
|
|
3546
4375
|
return footerStyle()[rowNum]?.style;
|
|
3547
4376
|
},
|
|
@@ -3549,15 +4378,15 @@ const Table = props => {
|
|
|
3549
4378
|
return footerStyle()[rowNum]?.class;
|
|
3550
4379
|
}
|
|
3551
4380
|
}), false, true);
|
|
3552
|
-
insert(_el$
|
|
4381
|
+
insert(_el$11, createComponent(For, {
|
|
3553
4382
|
get each() {
|
|
3554
|
-
return
|
|
4383
|
+
return reactiveColumns();
|
|
3555
4384
|
},
|
|
3556
4385
|
children: column => {
|
|
3557
4386
|
const footCell = footerCell()[rowNum]?.[column];
|
|
3558
4387
|
return !!footCell ? (() => {
|
|
3559
|
-
var _el$
|
|
3560
|
-
spread(_el$
|
|
4388
|
+
var _el$12 = _tmpl$6();
|
|
4389
|
+
spread(_el$12, mergeProps(() => footCellStyle()?.[rowNum]?.[column]?.all, {
|
|
3561
4390
|
get style() {
|
|
3562
4391
|
return footCellStyle()[rowNum]?.[column]?.style;
|
|
3563
4392
|
},
|
|
@@ -3565,33 +4394,70 @@ const Table = props => {
|
|
|
3565
4394
|
return footCellStyle()[rowNum]?.[column]?.class;
|
|
3566
4395
|
}
|
|
3567
4396
|
}), false, true);
|
|
3568
|
-
insert(_el$
|
|
3569
|
-
return _el$
|
|
4397
|
+
insert(_el$12, footCell);
|
|
4398
|
+
return _el$12;
|
|
3570
4399
|
})() : [];
|
|
3571
4400
|
}
|
|
3572
4401
|
}));
|
|
3573
|
-
return _el$
|
|
4402
|
+
return _el$11;
|
|
3574
4403
|
})();
|
|
3575
4404
|
}
|
|
3576
4405
|
}));
|
|
3577
4406
|
createRenderEffect(_p$ => {
|
|
3578
4407
|
var _v$ = getProps().id,
|
|
3579
|
-
_v$2 = `${styles$1.table} ${getProps().class}`,
|
|
4408
|
+
_v$2 = `${styles$1.table} ${getProps().class || ''}`,
|
|
3580
4409
|
_v$3 = getProps().style;
|
|
3581
|
-
_v$ !== _p$.e && setAttribute(_el
|
|
3582
|
-
_v$2 !== _p$.t && className(_el
|
|
3583
|
-
_p$.a = style$9(_el
|
|
4410
|
+
_v$ !== _p$.e && setAttribute(_el$2, "id", _p$.e = _v$);
|
|
4411
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
4412
|
+
_p$.a = style$9(_el$2, _v$3, _p$.a);
|
|
3584
4413
|
return _p$;
|
|
3585
4414
|
}, {
|
|
3586
4415
|
e: undefined,
|
|
3587
4416
|
t: undefined,
|
|
3588
4417
|
a: undefined
|
|
3589
4418
|
});
|
|
3590
|
-
return _el
|
|
4419
|
+
return _el$2;
|
|
3591
4420
|
})(), createMemo(() => props.children)];
|
|
3592
4421
|
}
|
|
3593
4422
|
}));
|
|
3594
4423
|
};
|
|
4424
|
+
const TableRowColumns = props => {
|
|
4425
|
+
return createComponent(For, {
|
|
4426
|
+
get each() {
|
|
4427
|
+
return props.reactiveColumns();
|
|
4428
|
+
},
|
|
4429
|
+
children: column => {
|
|
4430
|
+
// Initialize dropdown state for this row if dropdown capabilities exist
|
|
4431
|
+
if (props.rows()[props.rowNum]?.[column]?.dropRow === true || props.rows()[props.rowNum]?.[column]?.dropHeader === true) {
|
|
4432
|
+
// Initialize with closed state if not already set
|
|
4433
|
+
if (props.dropOpenStore[props.index] === undefined) {
|
|
4434
|
+
props.setDropOpenStore(props.index, false);
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
if (Object.keys(props.rows()[props.rowNum]?.[column] ?? {}).includes('dropRow') && props.rows()[props.rowNum]?.[column]?.dropRow !== false) {
|
|
4438
|
+
return (() => {
|
|
4439
|
+
var _el$13 = _tmpl$6();
|
|
4440
|
+
insert(_el$13, () => props.renderCell(props.rows()[props.rowNum]?.[column]?.element, props.item, props.index));
|
|
4441
|
+
createRenderEffect(() => setAttribute(_el$13, "colspan", props.reactiveColumns().length));
|
|
4442
|
+
return _el$13;
|
|
4443
|
+
})();
|
|
4444
|
+
}
|
|
4445
|
+
return !isNullish(props.rows()[props.rowNum]?.[column]?.element) ? (() => {
|
|
4446
|
+
var _el$14 = _tmpl$6();
|
|
4447
|
+
spread(_el$14, mergeProps(() => props.cellStyle?.()?.[props.rowNum]?.[column]?.all, {
|
|
4448
|
+
get style() {
|
|
4449
|
+
return props.cellStyle()[props.rowNum]?.[column]?.style;
|
|
4450
|
+
},
|
|
4451
|
+
get ["class"]() {
|
|
4452
|
+
return props.cellStyle()[props.rowNum]?.[column]?.class;
|
|
4453
|
+
}
|
|
4454
|
+
}), false, true);
|
|
4455
|
+
insert(_el$14, () => props.renderCell(props.rows()[props.rowNum]?.[column]?.element, props.item, props.index));
|
|
4456
|
+
return _el$14;
|
|
4457
|
+
})() : [];
|
|
4458
|
+
}
|
|
4459
|
+
});
|
|
4460
|
+
};
|
|
3595
4461
|
|
|
3596
4462
|
const Row = props => {
|
|
3597
4463
|
const [local, others] = splitProps(props, ["rowNumber", "children", "class", "style", "header", "footer"]);
|
|
@@ -3634,52 +4500,133 @@ const Row = props => {
|
|
|
3634
4500
|
|
|
3635
4501
|
const Column = props => {
|
|
3636
4502
|
const {
|
|
3637
|
-
addColumnStyle
|
|
4503
|
+
addColumnStyle,
|
|
4504
|
+
removeColumnStyle,
|
|
4505
|
+
refresh
|
|
3638
4506
|
} = useTableContext();
|
|
3639
4507
|
const [local, others] = splitProps(props, ["name", "rowNumber", "children", "class", "style"]);
|
|
4508
|
+
// Track the name to handle changes
|
|
4509
|
+
let currentName = local.name;
|
|
4510
|
+
// Create a reactive effect to update styles
|
|
3640
4511
|
createEffect(() => {
|
|
3641
|
-
|
|
4512
|
+
const newName = local.name;
|
|
4513
|
+
refresh();
|
|
4514
|
+
// If the name has changed, remove the old style
|
|
4515
|
+
if (currentName !== newName && currentName && removeColumnStyle) {
|
|
4516
|
+
removeColumnStyle(currentName);
|
|
4517
|
+
}
|
|
4518
|
+
// Update the current name
|
|
4519
|
+
currentName = newName;
|
|
4520
|
+
// Add the style with the new name
|
|
4521
|
+
addColumnStyle?.(newName, {
|
|
3642
4522
|
class: local.class,
|
|
3643
4523
|
style: local.style,
|
|
3644
4524
|
all: others
|
|
3645
4525
|
});
|
|
3646
4526
|
});
|
|
4527
|
+
// Clean up when the component is unmounted
|
|
4528
|
+
onCleanup(() => {
|
|
4529
|
+
if (removeColumnStyle && currentName) {
|
|
4530
|
+
removeColumnStyle(currentName);
|
|
4531
|
+
}
|
|
4532
|
+
});
|
|
3647
4533
|
return createComponent(ColumnProvider, {
|
|
3648
4534
|
get name() {
|
|
3649
|
-
return
|
|
4535
|
+
return local.name ?? ``;
|
|
3650
4536
|
},
|
|
3651
4537
|
get children() {
|
|
3652
|
-
return
|
|
4538
|
+
return local.children;
|
|
3653
4539
|
}
|
|
3654
4540
|
});
|
|
3655
4541
|
};
|
|
3656
4542
|
|
|
3657
4543
|
const Cell = props => {
|
|
3658
|
-
const
|
|
3659
|
-
name
|
|
3660
|
-
} = useColumnContext();
|
|
4544
|
+
const columnContext = useColumnContext();
|
|
3661
4545
|
const {
|
|
3662
4546
|
addFooterCell,
|
|
3663
4547
|
addFootCellStyle,
|
|
4548
|
+
removeFooterCell,
|
|
3664
4549
|
addRowCell,
|
|
3665
|
-
addCellStyle
|
|
4550
|
+
addCellStyle,
|
|
4551
|
+
removeRowCell,
|
|
4552
|
+
refresh
|
|
3666
4553
|
} = useTableContext();
|
|
3667
|
-
const [local, others] = splitProps(props, ["children", "class", "style", "footer", "rowNumber"]);
|
|
4554
|
+
const [local, others] = splitProps(props, ["children", "class", "style", "footer", "rowNumber", "header"]);
|
|
4555
|
+
// Get the column name from context or props
|
|
4556
|
+
const cellName = () => columnContext.name;
|
|
4557
|
+
// Get the current row number with a default of 1
|
|
4558
|
+
const rowNumber = () => (local?.rowNumber ?? 1) - 1;
|
|
4559
|
+
// Track registrations for cleanup
|
|
4560
|
+
let registeredAsFooter = false;
|
|
4561
|
+
let registeredAsRow = false;
|
|
3668
4562
|
createEffect(() => {
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
4563
|
+
refresh();
|
|
4564
|
+
const name = cellName();
|
|
4565
|
+
const row = rowNumber();
|
|
4566
|
+
props.children;
|
|
4567
|
+
// Skip if no valid column name
|
|
4568
|
+
if (!name) return;
|
|
4569
|
+
// First clean up any previous registrations
|
|
4570
|
+
if (registeredAsFooter) {
|
|
4571
|
+
removeFooterCell?.(row, name);
|
|
4572
|
+
registeredAsFooter = false;
|
|
4573
|
+
}
|
|
4574
|
+
if (registeredAsRow) {
|
|
4575
|
+
removeRowCell?.(row, name);
|
|
4576
|
+
registeredAsRow = false;
|
|
4577
|
+
}
|
|
4578
|
+
// Register based on current props
|
|
4579
|
+
const isFooter = local.footer === true;
|
|
4580
|
+
const isHeader = local.header === true;
|
|
4581
|
+
if (isFooter) {
|
|
4582
|
+
// Handle footer cell registration
|
|
4583
|
+
if (addFooterCell && addFootCellStyle) {
|
|
4584
|
+
addFooterCell(row, name, local.children);
|
|
4585
|
+
addFootCellStyle(row, name, {
|
|
4586
|
+
class: local.class,
|
|
4587
|
+
style: local.style,
|
|
4588
|
+
all: others
|
|
4589
|
+
});
|
|
4590
|
+
registeredAsFooter = true;
|
|
4591
|
+
}
|
|
4592
|
+
} else if (!isHeader) {
|
|
4593
|
+
// Handle regular data cell registration
|
|
4594
|
+
if (addRowCell && addCellStyle) {
|
|
4595
|
+
addRowCell(row, name, local.children);
|
|
4596
|
+
addCellStyle(row, name, {
|
|
4597
|
+
class: local.class,
|
|
4598
|
+
style: local.style,
|
|
4599
|
+
all: {
|
|
4600
|
+
...others,
|
|
4601
|
+
colSpan: others?.colSpan ?? 1
|
|
4602
|
+
}
|
|
4603
|
+
});
|
|
4604
|
+
registeredAsRow = true;
|
|
4605
|
+
}
|
|
3676
4606
|
} else {
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
4607
|
+
// Handle header cell registration
|
|
4608
|
+
if (addRowCell && addCellStyle) {
|
|
4609
|
+
addRowCell(row, name, local.children);
|
|
4610
|
+
addCellStyle(row, name, {
|
|
4611
|
+
class: local.class,
|
|
4612
|
+
style: local.style,
|
|
4613
|
+
all: others
|
|
4614
|
+
});
|
|
4615
|
+
registeredAsRow = true;
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
});
|
|
4619
|
+
// Clean up registered cells when component unmounts
|
|
4620
|
+
onCleanup(() => {
|
|
4621
|
+
const name = cellName();
|
|
4622
|
+
const row = rowNumber();
|
|
4623
|
+
if (name) {
|
|
4624
|
+
if (registeredAsFooter && removeFooterCell) {
|
|
4625
|
+
removeFooterCell(row, name);
|
|
4626
|
+
}
|
|
4627
|
+
if (registeredAsRow && removeRowCell) {
|
|
4628
|
+
removeRowCell(row, name);
|
|
4629
|
+
}
|
|
3683
4630
|
}
|
|
3684
4631
|
});
|
|
3685
4632
|
return [];
|
|
@@ -3696,6 +4643,7 @@ const Header = props => {
|
|
|
3696
4643
|
}
|
|
3697
4644
|
const [local, others] = splitProps(props, ["children", "class", "style", "rowNumber"]);
|
|
3698
4645
|
createEffect(() => {
|
|
4646
|
+
tableContext.refresh();
|
|
3699
4647
|
tableContext?.addHeaderCell?.(columnInfo.name, (props?.rowNumber ?? 1) - 1, local.children);
|
|
3700
4648
|
tableContext?.addHeaderStyle?.(columnInfo.name, (props?.rowNumber ?? 1) - 1, {
|
|
3701
4649
|
class: local.class,
|
|
@@ -3869,4 +4817,4 @@ const ColeError = props => {
|
|
|
3869
4817
|
return [];
|
|
3870
4818
|
};
|
|
3871
4819
|
|
|
3872
|
-
export { Body, Button, Carousel, Cell, Chip, Chipbar, Column, Container, ExpansionPanel, ColeError as FieldError, Form, FormField, FormGroup, Header, Icon, Input, Menu, MenuDropdown, MenuItem, Modal, Option, Row, Select,
|
|
4820
|
+
export { Body, Button, Carousel, Cell, Checkbox, Chip, Chipbar, Column, Container, ExpansionPanel, ColeError as FieldError, Form, FormArray, FormField, FormGroup, Header, Icon, Input, Menu, MenuDropdown, MenuItem, Modal, Option, Radio, RadioGroup, RadioGroupContext, Row, Select, Slide, SnackbarController, TabBar, Table, TextArea, Validators, addSnackbar, addTheme, carouselTitleContext };
|