Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996498
default-list-filters.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
default-list-filters.ts
View Options
import
{
Field
}
from
"sealious"
;
import
{
FlatTemplatable
}
from
"tempstream"
;
export
type
ListFilterRender
=
(
value
:
string
,
field
:
Field
<
any
>
)
=>
FlatTemplatable
;
export
type
DefaultListFilter
=
{
render
:
ListFilterRender
;
prepareValue
?:
(
filter_value
:
unknown
)
=>
unknown
;
};
export
const
BooleanListFilter
=
{
render
:
(
value
:
string
,
field
:
Field
<
any
>
)
=>
{
return
/* HTML */
`<label>
${
field
.
name
}
<select name="filter[
${
field
.
name
}
]" autocomplete="off">
<option value="true"
${
value
==
"true"
?
"selected"
:
""
}
>
True
</option>
<option value="false"
${
value
==
"false"
?
"selected"
:
""
}
>
False
</option>
<option
value=""
${
value
==
"null"
||
value
==
""
||
value
==
"undefined"
||
value
==
undefined
?
"selected"
:
""
}
>
-
</option>
</select>
</label>`
;
},
};
export
const
SimpleTextFilter
=
{
render
:
(
value
:
string
,
field
:
Field
<
any
>
)
=>
{
return
/* HTML */
`<label>
${
field
.
name
}
<input
type="text"
name="filter[
${
field
.
name
}
]"
autocomplete="off"
${
value
?
`value="
${
value
}
"`
:
value
}
/>
</label>`
;
},
prepareValue
:
(
value
:
string
)
=>
{
return
{
regex
:
`.*
${
value
}
.*`
};
},
};
export
const
DefaultListFilters
=
{
boolean
:
BooleanListFilter
,
text
:
SimpleTextFilter
,
fallback
:
SimpleTextFilter
,
}
as
Record
<
string
,
DefaultListFilter
>
;
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 14:04 (12 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557252
Default Alt Text
default-list-filters.ts (1 KB)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment