Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583770
file.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
file.ts
View Options
import
{
Context
}
from
"koa"
;
import
{
FlatTemplatable
,
tempstream
}
from
"tempstream"
;
import
{
FileContainer
}
from
"../fields/file"
;
import
{
FormDataValue
}
from
"../form"
;
import
{
SimpleInput
}
from
"./simple-input"
;
export
class
File
extends
SimpleInput
<
FileContainer
>
{
getType
()
{
return
"file"
;
}
async
renderFilePreview
(
ctx
:
Context
,
file_data
:
{
id
?:
string
;
filename
?:
string
}
|
null
)
:
Promise
<
FlatTemplatable
>
{
return
file_data
?
.
filename
||
""
;
}
async
preInput
(
ctx
:
Context
,
data
:
Record
<
string
,
FormDataValue
>
)
{
const
{
parsed
}
=
await
this
.
field
.
getValue
(
ctx
,
data
);
return
tempstream
/* HTML */
`
${
this
.
renderFilePreview
(
ctx
,
parsed
.
old
)
}
<input
type="hidden"
name="
${
this
.
field
.
name
}
[old][id]"
value="
${
parsed
.
old
?
.
id
||
""
}
"
/>
<input
type="hidden"
name="
${
this
.
field
.
name
}
[old][filename]"
value="
${
parsed
.
old
?
.
filename
||
""
}
"
/>`
;
}
async
getInputAttributes
(
ctx
:
Context
,
data
:
Record
<
string
,
FormDataValue
>
,
field_prefix
:
string
,
form_id
:
string
)
:
Promise
<
Record
<
string
,
string
|
boolean
>>
{
const
original
=
await
super
.
getInputAttributes
(
ctx
,
data
,
field_prefix
,
form_id
);
const
{
parsed
}
=
await
this
.
field
.
getValue
(
ctx
,
data
);
return
{
...
original
,
name
:
this
.
field
.
name
+
"[new]"
,
required
:
original
.
required
&&
!
parsed
.
old
,
value
:
false
,
};
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Oct 11, 10:43 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
983657
Default Alt Text
file.ts (1 KB)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment