Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7319598
component-argument.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-argument.ts
View Options
import
{
JDDContext
,
List
,
ShortText
}
from
"../index"
;
import
{
MaybePromise
}
from
"../utils/util-types"
;
export
type
ExtractComponentArgumentValue
<
C
>
=
C
extends
List
<
infer
S
>
?
S
[]
:
C
extends
ComponentArgument
<
infer
T
>
?
T
:
never
;
export
type
ExtractStructuredComponentArgumentsValues
<
C
>
=
{
[
property
in
keyof
C
]
:
ExtractComponentArgumentValue
<
C
[
property
]
>
;
};
export
abstract
class
ComponentArgument
<
ARG
>
{
public
example_values
:
ARG
[]
=
[];
public
parent_argument
:
ComponentArgument
<
unknown
>
|
null
=
null
;
abstract
getTypeName
()
:
string
;
abstract
getEmptyValue
()
:
ARG
;
abstract
countWords
(
value
:
ARG
)
:
number
;
abstract
parseFormInput
(
context
:
JDDContext
,
input
:
unknown
,
arg_name
:
string
)
:
MaybePromise
<
ARG
|
ARG
[]
|
null
>
;
getExampleValue
(
_context
:
JDDContext
)
:
Promise
<
ARG
>
|
ARG
{
return
this
.
example_values
[
Math
.
floor
(
this
.
example_values
.
length
*
Math
.
random
())
];
}
setExampleValues
(
values
:
ARG
[])
:
this
{
this
.
example_values
=
values
;
return
this
;
}
hasParent
(
type
:
string
)
{
let
parent
=
this
.
parent_argument
;
while
(
parent
)
{
if
(
parent
.
getTypeName
()
==
type
)
{
return
true
;
}
parent
=
parent
.
parent_argument
;
}
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sun, Jul 13, 06:47 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
821935
Default Alt Text
component-argument.ts (1 KB)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment