allow the select empty and placeholder props to be reactive functions

This commit is contained in:
Gani Georgiev
2026-05-20 16:39:59 +03:00
parent 23a989118c
commit ea1a537a60
3 changed files with 20 additions and 4 deletions
+18 -2
View File
@@ -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) => {