Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996510
component-input-structured.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
component-input-structured.ts
View Options
import
type
{
Context
}
from
"koa"
;
import
type
{
ComponentArgument
,
JDDContext
,
Structured
}
from
"@sealcode/jdd"
;
import
type
{
StatefulPage
}
from
"@sealcode/sealgen"
;
import
{
ComponentInput
}
from
"./component-input.js"
;
import
type
{
JDDPageState
}
from
"../jdd-page.js"
;
import
type
{
ComponentPreviewActions
}
from
"../component-preview-actions.js"
;
export
async
function
ComponentInputStructured
<
T
extends
Structured
<
Record
<
string
,
ComponentArgument
<
unknown
>>>
>
({
state
,
ctx
,
arg_path
,
arg
,
value
,
page
,
...
rest
}
:
{
state
:
JDDPageState
;
ctx
:
Context
;
arg_path
:
string
[];
arg
:
T
;
value
:
Record
<
string
,
unknown
>
;
page
:
StatefulPage
<
JDDPageState
,
typeof
ComponentPreviewActions
>
;
makeJDDContext
:
(
ctx
:
Context
)
=>
JDDContext
;
makeAssetURL
:
(
asset
:
string
)
=>
string
;
})
{
return
/* HTML */
`<fieldset
id="
${
`component-input-structured-
${
arg_path
.
join
(
"-"
)
}
`
}
"
>
<legend>{arg_path.at(-1)}</legend>
${
(
await
Promise
.
all
(
Object
.
entries
(
arg
.
structure
).
map
(
async
([
arg_name
,
arg
])
=>
{
const
ret
=
`<div>
${
await
ComponentInput
({
ctx
,
state
,
arg_path
:
[...
arg_path
,
arg_name
],
arg
,
value
:
value
[
arg_name
],
page
,
...
rest
,
}
)}
</div>`
;
return
ret
;
}
)
)
).join("")}
</fieldset>`
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 14:05 (12 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557294
Default Alt Text
component-input-structured.ts (1 KB)
Attached To
Mode
rJDDE jdd-editor
Attached
Detach File
Event Timeline
Log In to Comment