Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
36ecd23f
Commit
36ecd23f
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[dome] select field
parent
b0132bee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ivette/src/dome/src/renderer/controls/buttons.tsx
+1
-1
1 addition, 1 deletion
ivette/src/dome/src/renderer/controls/buttons.tsx
ivette/src/dome/src/renderer/layout/form.tsx
+40
-1
40 additions, 1 deletion
ivette/src/dome/src/renderer/layout/form.tsx
with
41 additions
and
2 deletions
ivette/src/dome/src/renderer/controls/buttons.tsx
+
1
−
1
View file @
36ecd23f
...
...
@@ -522,7 +522,7 @@ export interface SelectProps {
className
?:
string
;
/** Additional style for the `< dov /> ` container of Raiods */
style
?:
React
.
CSSProperties
;
/** Shall be
[[Item]]
elements. */
/** Shall be
standard `<option/>` and `<optgroup/>`
elements. */
children
:
any
;
}
...
...
This diff is collapsed.
Click to expand it.
ivette/src/dome/src/renderer/layout/form.tsx
+
40
−
1
View file @
36ecd23f
...
...
@@ -12,7 +12,7 @@ import React from 'react';
import
*
as
Dome
from
'
dome
'
;
import
*
as
Utils
from
'
dome/misc/utils
'
;
import
{
SVG
}
from
'
dome/controls/icons
'
;
import
{
Checkbox
,
Radio
}
from
'
dome/controls/buttons
'
;
import
{
Checkbox
,
Radio
,
Select
as
SelectMenu
}
from
'
dome/controls/buttons
'
;
export
type
Error
=
|
undefined
|
boolean
|
string
...
...
@@ -1050,6 +1050,7 @@ export interface RadioFieldProps<A> extends FieldProps<A> {
value
:
A
;
}
/** @category Form Fields */
export
function
RadioField
<
A
>
(
props
:
RadioFieldProps
<
A
>
)
{
const
{
hidden
,
disabled
}
=
useContext
(
props
);
...
...
@@ -1076,4 +1077,42 @@ export function RadioField<A>(props: RadioFieldProps<A>) {
);
}
/* --------------------------------------------------------------------------*/
/* --- Select Menu Field ---*/
/* --------------------------------------------------------------------------*/
/** @category Form Fields */
export
interface
SelectFieldProps
extends
FieldProps
<
string
|
undefined
>
{
placeholder
?:
string
;
children
:
any
;
}
/**
Children must be standard `<option>` or `<optgroup>` elements.
@category Form Fields
*/
export
function
SelectField
(
props
:
SelectFieldProps
)
{
const
id
=
useHtmlFor
();
const
[
value
,
error
,
setState
]
=
useChecker
(
props
.
state
,
props
.
checker
);
const
onChange
=
(
newValue
?:
string
)
=>
setState
(
newValue
,
undefined
);
const
{
children
,
placeholder
}
=
props
;
return
(
<
Field
{
...
props
}
error
=
{
error
}
htmlFor
=
{
id
}
>
<
SelectMenu
id
=
{
id
}
value
=
{
value
}
placeholder
=
{
placeholder
}
onChange
=
{
onChange
}
>
{
children
}
</
SelectMenu
>
</
Field
>
);
}
// --------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment