allow the select empty and placeholder props to be reactive functions
This commit is contained in:
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
||||
|
||||
<!-- prism -->
|
||||
<script src="./libs/prism/prism.js" data-manual></script>
|
||||
<script type="module" crossorigin src="./assets/index-qP-3lJAQ.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-DV8pBThR.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="./assets/pocketbase.es-B_4DUNUU.js">
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-Cbzik3Gc.css">
|
||||
</head>
|
||||
|
||||
+18
-2
@@ -152,7 +152,15 @@ window.app.components.select = function(propsArg = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
const noItemsFoundElem = t.div({ className: "txt-hint txt-center m-0 p-5", hidden: true }, props.noItemsFoundText);
|
||||
const noItemsFoundElem = t.div(
|
||||
{ className: "txt-hint txt-center m-0 p-5", hidden: true },
|
||||
(el) => {
|
||||
if (typeof props.noItemsFoundText == "function") {
|
||||
return props.noItemsFoundText(el);
|
||||
}
|
||||
return props.noItemsFoundText;
|
||||
},
|
||||
);
|
||||
|
||||
async function toggleNoItemsFoundElem() {
|
||||
if (!dropdown) {
|
||||
@@ -236,7 +244,15 @@ window.app.components.select = function(propsArg = {}) {
|
||||
},
|
||||
() => {
|
||||
if (!internalData.selected.length) {
|
||||
return t.span({ rid: "selected-placeholder", className: "placeholder" }, () => props.placeholder);
|
||||
return t.span(
|
||||
{ rid: "selected-placeholder", className: "placeholder" },
|
||||
(el) => {
|
||||
if (typeof props.placeholder == "function") {
|
||||
return props.placeholder(el);
|
||||
}
|
||||
return props.placeholder;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return internalData.selected.map((opt) => {
|
||||
|
||||
Reference in New Issue
Block a user