Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010261
number.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
number.ts
View Options
import
{
Context
}
from
"koa"
;
import
{
FlatTemplatable
}
from
"tempstream"
;
import
{
FormField
,
NumberField
}
from
"../fields/field"
;
import
{
FormDataValue
}
from
"../form"
;
import
{
SimpleInput
,
SimpleInputOptions
}
from
"./simple-input"
;
export
type
NumberOptions
=
SimpleInputOptions
&
Partial
<
{
step
:
number
;
suffix
:
string
}
>
;
export
class
Number
extends
SimpleInput
<
number
|
null
>
{
field
:
NumberField
;
options
:
NumberOptions
;
constructor
(
field
:
NumberField
,
options
:
NumberOptions
)
{
super
(
field
,
options
);
}
getType
()
{
return
"number"
;
}
async
postInput
(
_
:
Context
)
:
Promise
<
FlatTemplatable
>
{
return
this
.
options
.
suffix
?
/* HTML */
`<span class="suffix">
${
this
.
options
.
suffix
}
</span>`
:
""
;
}
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
);
return
{
...
original
,
...
Object
.
fromEntries
([
...(
this
.
field
.
options
.
min
?
[[
"min"
,
this
.
field
.
options
.
min
]]
:
[]),
...(
this
.
field
.
options
.
max
?
[[
"max"
,
this
.
field
.
options
.
max
]]
:
[]),
...(
this
.
options
.
step
?
[[
"step"
,
this
.
options
.
step
]]
:
[]),
]),
};
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, May 7, 19:39 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
645332
Default Alt Text
number.ts (1 KB)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment