| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
const { __ } = wp.i18n; |
| 5 |
|
| 6 |
const { Component } = wp.element; |
| 7 |
|
| 8 |
const { |
| 9 |
PanelBody, |
| 10 |
Notice, |
| 11 |
TextControl |
| 12 |
} = wp.components; |
| 13 |
|
| 14 |
class InstanceSettings extends Component { |
| 15 |
constructor() { |
| 16 |
super( ...arguments ); |
| 17 |
} |
| 18 |
|
| 19 |
render() { |
| 20 |
|
| 21 |
const settings = this.props.chart['visualizer-settings']; |
| 22 |
|
| 23 |
return ( |
| 24 |
<PanelBody |
| 25 |
title={ __( 'Instance Settings' ) } |
| 26 |
initialOpen={ true } |
| 27 |
className="visualizer-instance-panel" |
| 28 |
> |
| 29 |
|
| 30 |
<Notice status="info" isDismissible={ false } > |
| 31 |
<p> |
| 32 |
{ __( 'These settings are valid only for this instance of the chart.' ) } |
| 33 |
</p> |
| 34 |
<p> |
| 35 |
{ __( 'This means that if you insert this chart again elsewhere, these values will not persist.' ) } |
| 36 |
</p> |
| 37 |
</Notice> |
| 38 |
|
| 39 |
<TextControl |
| 40 |
label={ __( 'Should this instance lazy Load?' ) } |
| 41 |
help={ __( '-1: do not lazy load. Any number greater than -1 will lazy load the chart once the viewport is that many pixels away from the chart' ) } |
| 42 |
value={ this.props.attributes.lazy ? Number( this.props.attributes.lazy ) : -1 } |
| 43 |
type="number" |
| 44 |
min="-1" |
| 45 |
max="1000" |
| 46 |
step="1" |
| 47 |
onChange={ e => { |
| 48 |
this.props.attributes.lazy = e; |
| 49 |
this.props.edit( settings ); |
| 50 |
} } |
| 51 |
/> |
| 52 |
|
| 53 |
</PanelBody> |
| 54 |
); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
export default InstanceSettings; |
| 59 |
|