type out Dialog
This commit is contained in:
parent
fc9d4d8d6f
commit
b57988e734
2 changed files with 235 additions and 205 deletions
|
@ -22,11 +22,11 @@ class Dialog {
|
|||
const img = document.createElement("img");
|
||||
img.src = array[1];
|
||||
if (array[2] != undefined) {
|
||||
if (array[2].length == 2) {
|
||||
if (array[2].length === 2) {
|
||||
img.width = array[2][0];
|
||||
img.height = array[2][1];
|
||||
}
|
||||
else if (array[2][0] == "fit") {
|
||||
else if (array[2][0] === "fit") {
|
||||
img.classList.add("imgfit");
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +226,7 @@ class Dialog {
|
|||
}
|
||||
default:
|
||||
console.error("can't find element:" + array[0], " full element:", array);
|
||||
return document.createElement("span");
|
||||
}
|
||||
}
|
||||
show() {
|
||||
|
|
|
@ -1,4 +1,32 @@
|
|||
|
||||
type dialogjson=[
|
||||
"hdiv",...dialogjson[]
|
||||
]|[
|
||||
"vdiv",...dialogjson[]
|
||||
]|[
|
||||
"img",string,[number,number]|undefined|["fit"]
|
||||
]|[
|
||||
"checkbox",string,boolean,(this:HTMLInputElement,e:Event)=>unknown
|
||||
]|[
|
||||
"button",string,string,(this:HTMLButtonElement,e:Event)=>unknown
|
||||
]|[
|
||||
"mdbox",string,string,(this:HTMLTextAreaElement,e:Event)=>unknown
|
||||
]|[
|
||||
"textbox",string,string,(this:HTMLInputElement,e:Event)=>unknown
|
||||
]|[
|
||||
"fileupload",string,(this:HTMLInputElement,e:Event)=>unknown
|
||||
]|[
|
||||
"text",string
|
||||
]|[
|
||||
"title",string
|
||||
]|[
|
||||
"radio",string,string[],(this:unknown,e:string)=>unknown,number
|
||||
]|[
|
||||
"html",HTMLElement
|
||||
]|[
|
||||
"select",string,string[],(this:HTMLSelectElement,e:Event)=>unknown,number
|
||||
]|[
|
||||
"tabs",[string,dialogjson][]
|
||||
]
|
||||
class Dialog{
|
||||
layout;
|
||||
onclose: Function;
|
||||
|
@ -17,16 +45,16 @@ class Dialog{
|
|||
this.html.classList.add("nonimagecenter");
|
||||
}
|
||||
}
|
||||
tohtml(array:any[]){
|
||||
tohtml(array:dialogjson):HTMLElement{
|
||||
switch(array[0]){
|
||||
case"img":
|
||||
const img=document.createElement("img");
|
||||
img.src=array[1];
|
||||
if(array[2]!=undefined){
|
||||
if(array[2].length==2){
|
||||
if(array[2].length===2){
|
||||
img.width=array[2][0];
|
||||
img.height=array[2][1];
|
||||
}else if(array[2][0]=="fit"){
|
||||
}else if(array[2][0]==="fit"){
|
||||
img.classList.add("imgfit");
|
||||
}
|
||||
}
|
||||
|
@ -233,6 +261,7 @@ class Dialog{
|
|||
}
|
||||
default:
|
||||
console.error("can't find element:"+array[0]," full element:",array);
|
||||
return document.createElement("span");
|
||||
}
|
||||
}
|
||||
show(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue