Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7862292
component-input-single-reference.tsx
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
906 B
Referenced Files
None
Subscribers
None
component-input-single-reference.tsx
View Options
import
type
{
BaseContext
}
from
"koa"
;
import
type
{
SingleReference
}
from
"@sealcode/jdd"
;
import
{
TempstreamJSX
}
from
"tempstream"
;
import
{
makeJDDContext
}
from
"../../jdd-context.js"
;
import
{
printArgPath
}
from
"./print-arg-path.js"
;
export
async
function
ComponentInputSingleReference
<
State
,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
T
extends
SingleReference
<
any
>
>
({
ctx
,
arg_path
,
arg
,
value
,
onchange
,
}
:
{
ctx
:
BaseContext
;
state
:
State
;
arg_path
:
string
[];
arg
:
T
;
value
:
string
;
onchange
?:
string
;
})
:
Promise
<
string
>
{
return
(
<
div
>
<
label
>
{
arg_path
.
at
(
-
1
)
||
""
}
<
select
name
=
{
`$
${
printArgPath
(
arg_path
)
}
`
}
onchange
=
{
onchange
}
>
{(
await
arg
.
getValues
(
makeJDDContext
(
ctx
))).
map
((
v
)
=>
(
<
option
value
=
{
v
.
value
}
selected
=
{
value
==
v
.
value
}
>
{
v
.
label
}
<
/option>
))}
<
/select>
<
/label>
<
/div>
);
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, Aug 13, 20:22 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
871302
Default Alt Text
component-input-single-reference.tsx (906 B)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline
Log In to Comment