Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
357c0753
Commit
357c0753
authored
Apr 08, 2023
by
pythongosssss
Browse files
Support dataset when creating elements
Allow dialog to show element and override buttons
parent
ebd7f9bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
web/scripts/ui.js
web/scripts/ui.js
+29
-18
No files found.
web/scripts/ui.js
View file @
357c0753
...
...
@@ -8,14 +8,18 @@ export function $el(tag, propsOrChildren, children) {
if
(
Array
.
isArray
(
propsOrChildren
))
{
element
.
append
(...
propsOrChildren
);
}
else
{
const
parent
=
propsOrChildren
.
parent
;
const
{
parent
,
$
:
cb
,
dataset
,
style
}
=
propsOrChildren
;
delete
propsOrChildren
.
parent
;
const
cb
=
propsOrChildren
.
$
;
delete
propsOrChildren
.
$
;
if
(
propsOrChildren
.
style
)
{
Object
.
assign
(
element
.
style
,
propsOrChildren
.
style
);
delete
propsOrChildren
.
dataset
;
delete
propsOrChildren
.
style
;
if
(
style
)
{
Object
.
assign
(
element
.
style
,
style
);
}
if
(
dataset
)
{
Object
.
assign
(
element
.
dataset
,
dataset
);
}
Object
.
assign
(
element
,
propsOrChildren
);
...
...
@@ -155,18 +159,21 @@ function dragElement(dragEl, settings) {
}
}
class
ComfyDialog
{
export
class
ComfyDialog
{
constructor
()
{
this
.
element
=
$el
(
"
div.comfy-modal
"
,
{
parent
:
document
.
body
},
[
$el
(
"
div.comfy-modal-content
"
,
[
$el
(
"
p
"
,
{
$
:
(
p
)
=>
(
this
.
textElement
=
p
)
}),
$el
(
"
div.comfy-modal-content
"
,
[
$el
(
"
p
"
,
{
$
:
(
p
)
=>
(
this
.
textElement
=
p
)
}),
...
this
.
createButtons
()]),
]);
}
createButtons
()
{
return
[
$el
(
"
button
"
,
{
type
:
"
button
"
,
textContent
:
"
Close
"
,
onclick
:
()
=>
this
.
close
(),
}),
]),
]);
];
}
close
()
{
...
...
@@ -174,7 +181,11 @@ class ComfyDialog {
}
show
(
html
)
{
if
(
typeof
html
===
"
string
"
)
{
this
.
textElement
.
innerHTML
=
html
;
}
else
{
this
.
textElement
.
replaceChildren
(
html
);
}
this
.
element
.
style
.
display
=
"
flex
"
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment