Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7112493
field-hybrid.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
field-hybrid.ts
View Options
import
Field
,
{
Depromisify
}
from
"./field"
;
import
type
Context
from
"../context"
;
import
type
{
App
,
Collection
,
ItemListResult
}
from
"../main"
;
/*
A hybrid field is one that takes a field type as a param. All
uncustomized methods should be taken from that given field type
*/
export
default
abstract
class
HybridField
<
T
extends
Field
>
extends
Field
{
virtual_field
:
T
;
constructor
(
base_field
:
T
)
{
super
();
this
.
virtual_field
=
base_field
;
}
setName
(
name
:
string
)
{
super
.
setName
(
name
);
this
.
virtual_field
.
setName
(
name
);
}
setCollection
(
collection
:
Collection
)
{
super
.
setCollection
(
collection
);
this
.
virtual_field
.
setCollection
(
collection
);
}
async
encode
(
context
:
Context
,
value
:
Parameters
<
T
[
"encode"
]
>
[
1
],
old_value
?:
Parameters
<
T
[
"encode"
]
>
[
2
]
)
{
return
this
.
virtual_field
.
encode
(
context
,
value
,
old_value
);
}
async
filterToQuery
(
context
:
Context
,
filter
:
any
)
{
return
this
.
virtual_field
.
filterToQuery
(
context
,
filter
);
}
async
isProperValue
(
context
:
Context
,
new_value
:
Parameters
<
T
[
"checkValue"
]
>
[
1
],
old_value
:
Parameters
<
T
[
"checkValue"
]
>
[
2
]
)
{
return
this
.
virtual_field
.
checkValue
(
context
,
new_value
,
old_value
);
}
async
decode
(
context
:
Context
,
decoded_value
:
Depromisify
<
ReturnType
<
this
[
"encode"
]
>>
,
old_value
:
Parameters
<
T
[
"decode"
]
>
[
2
],
format
:
Parameters
<
T
[
"decode"
]
>
[
3
]
)
{
return
this
.
virtual_field
.
decode
(
context
,
decoded_value
,
old_value
,
format
);
}
async
getAttachments
(
context
:
Context
,
values
:
any
[],
attachment_options
:
any
)
:
Promise
<
ItemListResult
<
any
>>
{
return
this
.
virtual_field
.
getAttachments
(
context
,
values
,
attachment_options
);
}
async
init
(
app
:
App
)
{
await
super
.
init
(
app
);
await
this
.
virtual_field
.
init
(
app
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Thu, Jul 3, 18:13 (4 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
784501
Default Alt Text
field-hybrid.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment