refactor: varargs
This commit is contained in:
parent
ab7a28bed4
commit
3af9037da4
|
@ -95,7 +95,7 @@ const Expression = ({
|
|||
}}
|
||||
key={opPath}
|
||||
onChange={((i) => (event, value, localPath) => {
|
||||
if (0 === value.indexOf('.')) {
|
||||
if ('.' === value || '...' === value) {
|
||||
const parts = localPath.split('/');
|
||||
parts.pop();
|
||||
parts.pop();
|
||||
|
@ -282,6 +282,7 @@ const Expression = ({
|
|||
path={opPath}
|
||||
type={description.type}
|
||||
value={expressionValue}
|
||||
vararg={vararg}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ const Literal = ({
|
|||
type,
|
||||
options,
|
||||
value,
|
||||
vararg,
|
||||
}) => {
|
||||
// eslint-disable-next-line react/destructuring-assignment
|
||||
const contextDescription = context.describe();
|
||||
|
@ -129,12 +130,17 @@ const Literal = ({
|
|||
? {'.': {label: '', type: 'undefined'}}
|
||||
: {}
|
||||
),
|
||||
...(
|
||||
vararg
|
||||
? {'...': {label: '', type: 'undefined'}}
|
||||
: {}
|
||||
),
|
||||
'[literal]': {label: '', type: value.type},
|
||||
...contextDescription.children,
|
||||
'[key]': {label: '', type: value.type},
|
||||
}}
|
||||
onChange={(event, value) => {
|
||||
if ('.' === value) {
|
||||
if ('.' === value || '...' === value) {
|
||||
patch({
|
||||
op: 'remove',
|
||||
path,
|
||||
|
@ -188,6 +194,7 @@ const Literal = ({
|
|||
|
||||
Literal.defaultProps = {
|
||||
options: [],
|
||||
vararg: false,
|
||||
};
|
||||
|
||||
Literal.displayName = 'Literal';
|
||||
|
@ -202,6 +209,7 @@ Literal.propTypes = {
|
|||
path: PropTypes.string.isRequired,
|
||||
// eslint-disable-next-line react/forbid-prop-types
|
||||
value: PropTypes.any.isRequired,
|
||||
vararg: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default Literal;
|
||||
|
|
Loading…
Reference in New Issue
Block a user