vistaview 0.10.21 → 0.10.23
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.
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function r({
|
|
2
|
+
onSelect: c,
|
|
3
|
+
selection: l,
|
|
4
|
+
placeholder: s = "Select an option"
|
|
5
|
+
}) {
|
|
6
|
+
let e = null;
|
|
7
|
+
return {
|
|
8
|
+
name: "selectBox",
|
|
9
|
+
control: () => {
|
|
10
|
+
e = document.createElement("div"), e.classList.add("vvw-select-box");
|
|
11
|
+
const t = document.createElement("select");
|
|
12
|
+
t.classList.add("vvw-select-box-select");
|
|
13
|
+
const n = document.createElement("option");
|
|
14
|
+
return n.value = "", n.textContent = s, n.disabled = !0, n.selected = !0, t.appendChild(n), l.forEach((o) => {
|
|
15
|
+
const a = document.createElement("option");
|
|
16
|
+
a.value = o.value, a.textContent = o.text || o.value, t.appendChild(a);
|
|
17
|
+
}), t.addEventListener("change", async (o) => {
|
|
18
|
+
const d = o.target.value;
|
|
19
|
+
await c(d);
|
|
20
|
+
}), e.appendChild(t), e;
|
|
21
|
+
},
|
|
22
|
+
onClose(t) {
|
|
23
|
+
e && e.remove();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
r as selectBox
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(e=typeof globalThis<"u"?globalThis:e||self,o(e.VistaView=e.VistaView||{}))})(this,(function(e){"use strict";function o({onSelect:l,selection:a,placeholder:d="Select an option"}){let t=null;return{name:"selectBox",control:()=>{t=document.createElement("div"),t.classList.add("vvw-select-box");const n=document.createElement("select");n.classList.add("vvw-select-box-select");const s=document.createElement("option");return s.value="",s.textContent=d,s.disabled=!0,s.selected=!0,n.appendChild(s),a.forEach(c=>{const i=document.createElement("option");i.value=c.value,i.textContent=c.text||c.value,n.appendChild(i)}),n.addEventListener("change",async c=>{const u=c.target.value;await l(u)}),t.appendChild(n),t},onClose(n){t&&t.remove()}}}e.selectBox=o,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VistaExtension } from '../types';
|
|
2
|
+
export declare function selectBox({ onSelect, selection, placeholder, }: {
|
|
3
|
+
onSelect: (value: string) => void | Promise<void>;
|
|
4
|
+
selection: {
|
|
5
|
+
value: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
}[];
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}): VistaExtension;
|
|
10
|
+
//# sourceMappingURL=select-box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-box.d.ts","sourceRoot":"","sources":["../../../src/lib/extensions/select-box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,EACT,WAAgC,GACjC,EAAE;IACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,cAAc,CAwCjB"}
|