-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.x] [Canvas] Update object-path-immutable; type AxisConfig a… (#42086)
* Initial WIP * Migrate to latest object-path-immutable; type arguments * Fix Storybook Snapshot test; add snapshots * Revert storyshots test change * Adding SeriesStyle conversion + stories * Addressing feedback; updating against master * Update snapshots
- Loading branch information
1 parent
8240788
commit d77145c
Showing
41 changed files
with
3,305 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 167 additions & 0 deletions
167
...uis/arguments/axis_config/__examples__/__snapshots__/extended_template.examples.storyshot
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
107 changes: 107 additions & 0 deletions
107
...c/uis/arguments/axis_config/__examples__/__snapshots__/simple_template.examples.storyshot
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
...s/canvas_plugin_src/uis/arguments/axis_config/__examples__/extended_template.examples.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { action } from '@storybook/addon-actions'; | ||
import { storiesOf } from '@storybook/react'; | ||
import React from 'react'; | ||
import { ExpressionAST } from '../../../../../types'; | ||
|
||
import { ExtendedTemplate } from '../extended_template'; | ||
|
||
const defaultExpression: ExpressionAST = { | ||
type: 'expression', | ||
chain: [ | ||
{ | ||
type: 'function', | ||
function: 'axisConfig', | ||
arguments: {}, | ||
}, | ||
], | ||
}; | ||
|
||
const defaultValues = { | ||
argValue: defaultExpression, | ||
}; | ||
|
||
class Interactive extends React.Component<{}, typeof defaultValues> { | ||
public state = defaultValues; | ||
|
||
_onValueChange: (argValue: ExpressionAST) => void = argValue => { | ||
action('onValueChange')(argValue); | ||
this.setState({ argValue }); | ||
}; | ||
|
||
public render() { | ||
return ( | ||
<ExtendedTemplate | ||
onValueChange={this._onValueChange} | ||
argValue={this.state.argValue} | ||
typeInstance={{ name: 'xaxis' }} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
storiesOf('arguments/AxisConfig', module) | ||
.addDecorator(story => ( | ||
<div style={{ width: '323px', padding: '16px', background: '#fff' }}>{story()}</div> | ||
)) | ||
.add('extended', () => <Interactive />); | ||
|
||
storiesOf('arguments/AxisConfig/components', module) | ||
.addDecorator(story => ( | ||
<div style={{ width: '323px', padding: '16px', background: '#fff' }}>{story()}</div> | ||
)) | ||
.add('extended disabled', () => ( | ||
<ExtendedTemplate | ||
onValueChange={action('onValueChange')} | ||
argValue={false} | ||
typeInstance={{ name: 'yaxis' }} | ||
/> | ||
)) | ||
.add('extended', () => ( | ||
<ExtendedTemplate | ||
onValueChange={action('onValueChange')} | ||
argValue={defaultExpression} | ||
typeInstance={{ name: 'yaxis' }} | ||
/> | ||
)); |
Oops, something went wrong.