Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10352682
item-draft.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
item-draft.ts
View Options
import
{
Collection
,
FieldTypes
as
SealiousFieldTypes
}
from
"sealious"
;
import
{
sealiousToFormField
}
from
"./get-field-for-sealious.js"
;
import
{
Hybrid
}
from
"./hybrid.js"
;
import
{
FormField
}
from
"./field.js"
;
import
{
ExtractedFieldInfo
}
from
"../../utils/extract-fields-from-collection.js"
;
import
{
toPascalCase
}
from
"js-convert-case"
;
export
class
ItemDraft
<
C
extends
Collection
>
extends
Hybrid
<
{
[
name
in
keyof
C
[
"fields"
]]
:
FormField
;
}
>
{
constructor
(
public
sealious_field
:
SealiousFieldTypes
.
ItemDraft
<
C
>
)
{
super
(
Object
.
fromEntries
(
Object
.
entries
(
sealious_field
.
target_collection
.
fields
).
map
(
([
field_name
,
sealious_field
])
=>
[
field_name
,
sealiousToFormField
(
sealious_field
),
]
)
)
as
unknown
as
{
[
name
in
keyof
C
[
"fields"
]]
:
FormField
;
}
);
}
generateFieldDeclaration
(
field_info
:
ExtractedFieldInfo
,
vars
:
{
form_field_types
:
string
;
sealious_field
:
string
}
)
:
string
{
return
`new
${
vars
.
form_field_types
}
.
${
this
.
constructor
.
name
}
<typeof
${
toPascalCase
(
field_info
.
target
!
)
}
>(
${
vars
.
sealious_field
}
)`
;
}
generateImportsForFieldList
(
field_info
:
ExtractedFieldInfo
)
:
{
what
:
string
;
from
:
string
;
as
?:
string
;
type
?:
boolean
}[]
{
return
[
{
what
:
toPascalCase
(
field_info
.
target
!
),
from
:
"src/back/collections/collections.js"
,
type
:
true
,
},
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sun, Nov 2, 17:56 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1029149
Default Alt Text
item-draft.ts (1 KB)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment