-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #9071 add advanced options to coutner widgets * fix retrocompatibility issue with uom
- Loading branch information
Showing
9 changed files
with
291 additions
and
64 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
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
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
45 changes: 45 additions & 0 deletions
45
web/client/components/widgets/builder/wizard/common/CounterAdvancedOptions.jsx
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,45 @@ | ||
/* | ||
* Copyright 2020, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import React from 'react'; | ||
import { FormGroup } from 'react-bootstrap'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import Message from '../../../../I18N/Message'; | ||
import Format from './Format'; | ||
import Formula from './Formula'; | ||
import SwitchPanel from '../../../../misc/switch/SwitchPanel'; | ||
|
||
function Header({}) { | ||
return (<span> | ||
<span style={{ cursor: "pointer" }}><Message msgId="widgets.advanced.title"/></span> | ||
</span>); | ||
} | ||
|
||
function CounterAdvancedOptions({ | ||
data, | ||
onChange = () => {} | ||
}) { | ||
return (<SwitchPanel id="displayCartesian" | ||
header={<Header data={data}/>} | ||
collapsible | ||
expanded={data.panel} | ||
onSwitch={(val) => { onChange("panel", val); }} | ||
> | ||
<FormGroup controlId="AdvancedOptions"> | ||
<Format prefix="counterOpts" data={data} onChange={onChange}/> | ||
<Formula data={data} onChange={onChange}/> | ||
</FormGroup> | ||
</SwitchPanel>); | ||
} | ||
|
||
CounterAdvancedOptions.propTypes = { | ||
data: PropTypes.object, | ||
onChange: PropTypes.func | ||
}; | ||
|
||
export default CounterAdvancedOptions; |
53 changes: 53 additions & 0 deletions
53
web/client/components/widgets/builder/wizard/common/Format.jsx
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,53 @@ | ||
/* | ||
* Copyright 2023, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import React from 'react'; | ||
import { Col, FormControl, ControlLabel } from 'react-bootstrap'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import Message from '../../../../I18N/Message'; | ||
import HTML from '../../../../I18N/HTML'; | ||
import DisposablePopover from '../../../../misc/popover/DisposablePopover'; | ||
|
||
const Format = ({ | ||
data, | ||
onChange = () => {}, | ||
prefix = "yAxisOpts" | ||
}) => { | ||
|
||
return ( | ||
<> | ||
<Col componentClass={ControlLabel} sm={12}> | ||
<Message msgId="widgets.advanced.format" /> | ||
</Col> | ||
<Col sm={4}> | ||
<ControlLabel> | ||
<Message msgId="widgets.advanced.prefix" /> | ||
<FormControl placeholder="e.g.: ~" disabled={data.yAxis === false} value={data?.[prefix]?.tickPrefix} type="text" onChange={e => onChange(prefix + ".tickPrefix", e.target.value)} /> | ||
</ControlLabel> | ||
</Col> | ||
<Col sm={4}> | ||
<ControlLabel> | ||
<Message msgId="widgets.advanced.format" /> | ||
</ControlLabel> | ||
<DisposablePopover placement="top" title={<Message msgId="widgets.advanced.examples"/>} text={<HTML msgId="widgets.advanced.formatExamples" />} /> | ||
<FormControl placeholder="e.g.: .2s" disabled={data.yAxis === false} value={data?.[prefix]?.format} type="text" onChange={e => onChange(prefix + ".format", e.target.value)} /> | ||
</Col> | ||
<Col sm={4}> | ||
<ControlLabel><Message msgId="widgets.advanced.suffix" /></ControlLabel> | ||
<FormControl placeholder="e.g.: W" disabled={data.yAxis === false} value={data?.[prefix]?.tickSuffix || data?.options?.seriesOptions?.[0].uom} type="text" onChange={e => onChange(prefix + ".tickSuffix", e.target.value)} /> | ||
</Col> | ||
|
||
</>); | ||
}; | ||
Format.propTypes = { | ||
data: PropTypes.object, | ||
onChange: PropTypes.func, | ||
prefix: PropTypes.string | ||
}; | ||
|
||
export default Format; |
31 changes: 31 additions & 0 deletions
31
web/client/components/widgets/builder/wizard/common/Formula.jsx
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,31 @@ | ||
/* | ||
* Copyright 2023, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Col } from 'react-bootstrap'; | ||
|
||
import FormulaInput from './FormulaInput'; | ||
|
||
|
||
const Formula = ({ | ||
data, | ||
onChange = () => {} | ||
}) => { | ||
return ( | ||
<Col sm={12}> | ||
<FormulaInput disabled={data.yAxis === false} value={data.formula} type="text" onChange={e => onChange("formula", e.target.value)} /> | ||
</Col> | ||
); | ||
}; | ||
|
||
Formula.propTypes = { | ||
data: PropTypes.object, | ||
onChange: PropTypes.func | ||
}; | ||
|
||
export default Formula; |
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
Oops, something went wrong.