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");
|
const img = document.createElement("img");
|
||||||
img.src = array[1];
|
img.src = array[1];
|
||||||
if (array[2] != undefined) {
|
if (array[2] != undefined) {
|
||||||
if (array[2].length == 2) {
|
if (array[2].length === 2) {
|
||||||
img.width = array[2][0];
|
img.width = array[2][0];
|
||||||
img.height = array[2][1];
|
img.height = array[2][1];
|
||||||
}
|
}
|
||||||
else if (array[2][0] == "fit") {
|
else if (array[2][0] === "fit") {
|
||||||
img.classList.add("imgfit");
|
img.classList.add("imgfit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,6 +226,7 @@ class Dialog {
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
console.error("can't find element:" + array[0], " full element:", array);
|
console.error("can't find element:" + array[0], " full element:", array);
|
||||||
|
return document.createElement("span");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show() {
|
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{
|
class Dialog{
|
||||||
layout;
|
layout;
|
||||||
onclose: Function;
|
onclose: Function;
|
||||||
|
@ -17,16 +45,16 @@ class Dialog{
|
||||||
this.html.classList.add("nonimagecenter");
|
this.html.classList.add("nonimagecenter");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tohtml(array:any[]){
|
tohtml(array:dialogjson):HTMLElement{
|
||||||
switch(array[0]){
|
switch(array[0]){
|
||||||
case"img":
|
case"img":
|
||||||
const img=document.createElement("img");
|
const img=document.createElement("img");
|
||||||
img.src=array[1];
|
img.src=array[1];
|
||||||
if(array[2]!=undefined){
|
if(array[2]!=undefined){
|
||||||
if(array[2].length==2){
|
if(array[2].length===2){
|
||||||
img.width=array[2][0];
|
img.width=array[2][0];
|
||||||
img.height=array[2][1];
|
img.height=array[2][1];
|
||||||
}else if(array[2][0]=="fit"){
|
}else if(array[2][0]==="fit"){
|
||||||
img.classList.add("imgfit");
|
img.classList.add("imgfit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,6 +261,7 @@ class Dialog{
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
console.error("can't find element:"+array[0]," full element:",array);
|
console.error("can't find element:"+array[0]," full element:",array);
|
||||||
|
return document.createElement("span");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show(){
|
show(){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue