From 30bb3aa5f49ed5264cf609d6b8f234b07b7988ca Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Thu, 9 Sep 2021 23:57:36 +0300 Subject: [PATCH 1/5] Add Sonarqube tag using ims-frontend addons list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b60644d..e916457 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GIT_NAME = "volto-block-style" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu" + SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims" DEPENDENCIES = "" } From fe2f13324096dd835a84bc8404ce270dc6cb4dad Mon Sep 17 00:00:00 2001 From: Tiberiu Ichim Date: Sat, 25 Sep 2021 00:18:58 +0300 Subject: [PATCH 2/5] Various improvements (#29) * Use url widget for background image; allow textual input in range slider, by doubleclicking * Fix getStyle * yarn lint:fix Co-authored-by: Alin Voinea --- src/StyleWrapper/StyleWrapperView.jsx | 2 +- src/StyleWrapper/schema.js | 2 +- src/Widgets/Slider.jsx | 214 +++++++++++++++----------- src/Widgets/range.css.js | 10 +- 4 files changed, 130 insertions(+), 98 deletions(-) diff --git a/src/StyleWrapper/StyleWrapperView.jsx b/src/StyleWrapper/StyleWrapperView.jsx index a6a2b86..acbfa27 100644 --- a/src/StyleWrapper/StyleWrapperView.jsx +++ b/src/StyleWrapper/StyleWrapperView.jsx @@ -16,7 +16,7 @@ const getLineHeight = (fontSize) => { }; const getSide = (side, v) => - `${v[side] ? `${v[side]}${v.unit ? v.unit : 'px'}` : ''}`; + `${v[side] ? `${v[side]}${v.unit ? v.unit : 'px'}` : '0px'}`; const getSides = (v) => { return `${getSide('top', v)} ${getSide('right', v)} ${getSide( diff --git a/src/StyleWrapper/schema.js b/src/StyleWrapper/schema.js index 7ab237b..d526adf 100644 --- a/src/StyleWrapper/schema.js +++ b/src/StyleWrapper/schema.js @@ -98,7 +98,7 @@ export const StyleSchema = () => ({ }, backgroundImage: { title: 'Background image', - widget: 'object_by_path', + widget: 'url', }, backgroundColor: { title: 'Background color', diff --git a/src/Widgets/Slider.jsx b/src/Widgets/Slider.jsx index f22a6aa..caebb73 100644 --- a/src/Widgets/Slider.jsx +++ b/src/Widgets/Slider.jsx @@ -5,11 +5,15 @@ import PropTypes from 'prop-types'; import ReactDOM from 'react-dom'; import { FormFieldWrapper } from '@plone/volto/components'; -// import { withParentSize } from '@visx/responsive'; import styles from './range.css.js'; import './range.css'; +function isNumeric(str) { + if (typeof str != 'string') return false; // we only process strings! + return !isNaN(str); +} + export class Slider extends Component { constructor(props) { super(props); @@ -25,10 +29,12 @@ export class Slider extends Component { offset: 10, precision: 0, mouseDown: false, + showNumericInput: false, }; this.determinePosition = this.determinePosition.bind(this); this.rangeMouseUp = this.rangeMouseUp.bind(this); this.refresh = this.refresh.bind(this); + this.handleKnobClick = this.handleKnobClick.bind(this); } componentDidMount() { @@ -297,94 +303,132 @@ export class Slider extends Component { }); } + handleKnobClick(e) { + if (e.detail > 1 && !this.state.showNumericInput) { + this.setState({ showNumericInput: true }); + } + } + render() { return (
-
this.rangeMouseDown(false, event)} - onMouseMove={(event) => this.rangeMouseMove(false, event)} - onMouseUp={(event) => this.rangeMouseUp(false, event)} - onTouchEnd={(event) => this.rangeMouseUp(true, event)} - onTouchMove={(event) => this.rangeMouseMove(true, event)} - onTouchStart={(event) => this.rangeMouseDown(true, event)} - style={{ - ...styles.range, - ...(this.props.disabled ? styles.disabled : {}), - ...(this.props.style ? this.props.style : {}), - }} - > -
{ - this.inner = inner; + {this.state.showNumericInput ? ( + { + // TODO: handle multiple knobs + if (e.key === 'Enter' && isNumeric(e.target.value)) { + const value = e.target.value; + this.setState({ showNumericInput: false }, () => { + this.props.settings.onChange(parseInt(value)); + }); + } }} + /> + ) : ( +
this.rangeMouseDown(false, event)} + onMouseMove={(event) => this.rangeMouseMove(false, event)} + onMouseUp={(event) => this.rangeMouseUp(false, event)} + onTouchEnd={(event) => this.rangeMouseUp(true, event)} + onTouchMove={(event) => this.rangeMouseMove(true, event)} + onTouchStart={(event) => this.rangeMouseDown(true, event)} style={{ - ...styles.inner, - ...(this.props.style - ? this.props.style.inner - ? this.props.style.inner - : {} - : {}), + ...styles.range, + ...(this.props.disabled ? styles.disabled : {}), + ...(this.props.style ? this.props.style : {}), }} >
{ - this.track = track; + className="semantic_ui_range_inner" + ref={(inner) => { + this.inner = inner; }} style={{ - ...styles.track, - ...(this.props.inverted ? styles.invertedTrack : {}), + ...styles.inner, ...(this.props.style - ? this.props.style.track - ? this.props.style.track + ? this.props.style.inner + ? this.props.style.inner : {} : {}), }} - /> -
{ - this.trackFill = trackFill; - }} - style={{ - ...styles.trackFill, - ...(this.props.inverted ? styles.invertedTrackFill : {}), - ...styles[ - this.props.inverted - ? 'inverted-' + this.props.color - : this.props.color - ], - ...(this.props.style - ? this.props.style.trackFill + > +
{ + this.track = track; + }} + style={{ + ...styles.track, + ...(this.props.inverted ? styles.invertedTrack : {}), + ...(this.props.style + ? this.props.style.track + ? this.props.style.track + : {} + : {}), + }} + /> +
{ + this.trackFill = trackFill; + }} + style={{ + ...styles.trackFill, + ...(this.props.inverted ? styles.invertedTrackFill : {}), + ...styles[ + this.props.inverted + ? 'inverted-' + this.props.color + : this.props.color + ], + ...(this.props.style ? this.props.style.trackFill - : {} - : {}), - ...(this.props.disabled ? styles.disabledTrackFill : {}), - ...(this.props.style - ? this.props.style.disabledTrackFill + ? this.props.style.trackFill + : {} + : {}), + ...(this.props.disabled ? styles.disabledTrackFill : {}), + ...(this.props.style ? this.props.style.disabledTrackFill - : {} - : {}), - ...{ width: this.state.position + this.state.offset + 'px' }, - ...(this.props.multiple && this.state.position.length > 0 - ? { - left: this.state.position[0], - width: - this.state.position[this.state.numberOfKnobs - 1] - - this.state.position[0], - } - : {}), - }} - /> + ? this.props.style.disabledTrackFill + : {} + : {}), + ...{ width: this.state.position + this.state.offset + 'px' }, + ...(this.props.multiple && this.state.position.length > 0 + ? { + left: this.state.position[0], + width: + this.state.position[this.state.numberOfKnobs - 1] - + this.state.position[0], + } + : {}), + }} + /> - {this.props.multiple ? ( - this.state.position.map((pos, i) => ( + {this.props.multiple ? ( + this.state.position.map((pos, i) => ( +
+ )) + ) : (
- )) - ) : ( -
- {this.props.extra} -
- )} + > + {this.props.extra} +
+ )} +
-
+ )}
); } @@ -456,6 +487,7 @@ const SliderWidget = (props) => { settings={{ ...settings, onChange: (value) => { + // console.log('onchange', value); onChange(id, value); }, }} diff --git a/src/Widgets/range.css.js b/src/Widgets/range.css.js index 74ea060..76fc2f2 100644 --- a/src/Widgets/range.css.js +++ b/src/Widgets/range.css.js @@ -2,11 +2,11 @@ const styles = { range: { cursor: 'pointer', width: '100%', - height: '20px', + height: '30px', }, inner: { margin: '0 10px 0 10px', - height: '20px', + height: '30px', position: 'relative', }, /* @@ -18,7 +18,7 @@ const styles = { width: '100%', height: '4px', borderRadius: '4px', - top: '9px', + top: '12px', left: '0', backgroundColor: 'rgba(0,0,0,.05)', }, @@ -30,7 +30,7 @@ const styles = { width: '0', height: '4px', borderRadius: '4px', - top: '9px', + top: '12px', left: '0', backgroundColor: '#1b1c1d', }, @@ -41,7 +41,7 @@ const styles = { position: 'absolute', top: '0px', left: '0', - height: '20px', + height: '30px', width: '20px', background: '#fff linear-gradient(transparent, rgba(0, 0, 0, 0.5))', // background: '#fff -webkit-linear-gradient(transparent, rgba(0, 0, 0, 0.5))', From 9b169ed32f4ea2e8ac81d7be171c0cfefedf7edf Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Fri, 24 Sep 2021 21:25:50 +0000 Subject: [PATCH 3/5] Automated release 3.4.6 --- CHANGELOG.md | 11 +++++++---- package.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f666398..3647c59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [3.4.6](https://github.com/eea/volto-block-style/compare/3.4.5...3.4.6) + +- Various improvements [`#29`](https://github.com/eea/volto-block-style/pull/29) + #### [3.4.5](https://github.com/eea/volto-block-style/compare/3.4.4...3.4.5) +> 31 August 2021 + +- Develop [`#28`](https://github.com/eea/volto-block-style/pull/28) - Lint fix 2 [`dbdf49a`](https://github.com/eea/volto-block-style/commit/dbdf49a842f07019444ad3ee87ceccf6504c48f1) - Lint fix [`20ea653`](https://github.com/eea/volto-block-style/commit/20ea653087ec1f9167b46e482128412d25dcdf05) - Stretch fix overflow for wide screens [`535d8be`](https://github.com/eea/volto-block-style/commit/535d8be197eb6a8720cb90c1f35e8b5332661f85) @@ -77,10 +84,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Add range slider [`8a91ef1`](https://github.com/eea/volto-block-style/commit/8a91ef168df01e4a0f114596d50a401a14a41251) - Separate block wrapping; don't apply multiple times [`2adffd5`](https://github.com/eea/volto-block-style/commit/2adffd58a99af59bb42d72c54f2a05be3b9b2ea1) - Separate block wrapping; don't apply multiple times [`584e7a9`](https://github.com/eea/volto-block-style/commit/584e7a9859c7d417708f9aa78b83e94547f2f1ab) -- Add Sonarqube tag using frontend addons list [`f6737ef`](https://github.com/eea/volto-block-style/commit/f6737ef68ba906c5fb72e18c77b060aa82ed0a73) -- Add Sonarqube tag using frontend addons list [`6a4c6c1`](https://github.com/eea/volto-block-style/commit/6a4c6c16acc88471279a82a62b92555dc1ac20cc) -- Add Sonarqube tag using frontend addons list [`2101b55`](https://github.com/eea/volto-block-style/commit/2101b550588402b37cd91b5d582e27a6255d6cac) -- Add Sonarqube tag using frontend addons list [`2583c68`](https://github.com/eea/volto-block-style/commit/2583c68ea49ddbedc7b90b9d477cbbe4e2b779fd) - Add hidden toggle [`3b8ed26`](https://github.com/eea/volto-block-style/commit/3b8ed26a82c31ff430301adceea1174e92464a77) - Add a clear button to the box size widget [`4bdf803`](https://github.com/eea/volto-block-style/commit/4bdf8030d7a4d39d3a48b56ed6c8cddc311b3ff7) diff --git a/package.json b/package.json index 9af4bbe..9f8b213 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-block-style", - "version": "3.4.5", + "version": "3.4.6", "description": "volto-block-style: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From 0a5a98e531f93470956673e50b6c71f37f59b49e Mon Sep 17 00:00:00 2001 From: Alin Voinea Date: Sat, 25 Sep 2021 00:29:03 +0300 Subject: [PATCH 4/5] Release 3.5.0 --- Jenkinsfile | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e916457..0bee52d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,6 +75,12 @@ pipeline { } stage('Integration tests') { + // Exclude Pull-Requests. Already running on branch + when { + allOf { + environment name: 'CHANGE_ID', value: '' + } + } steps { parallel( diff --git a/package.json b/package.json index 9f8b213..679c6d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-block-style", - "version": "3.4.6", + "version": "3.5.0", "description": "volto-block-style: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From a648d0ec5e58d5e88c76679902ae8076031c3ea5 Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Fri, 24 Sep 2021 21:32:00 +0000 Subject: [PATCH 5/5] Automated release 3.5.0 --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3647c59..c90fcca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,11 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [3.4.6](https://github.com/eea/volto-block-style/compare/3.4.5...3.4.6) +#### [3.5.0](https://github.com/eea/volto-block-style/compare/3.4.5...3.5.0) - Various improvements [`#29`](https://github.com/eea/volto-block-style/pull/29) +- Release 3.5.0 [`0a5a98e`](https://github.com/eea/volto-block-style/commit/0a5a98e531f93470956673e50b6c71f37f59b49e) +- Add Sonarqube tag using ims-frontend addons list [`30bb3aa`](https://github.com/eea/volto-block-style/commit/30bb3aa5f49ed5264cf609d6b8f234b07b7988ca) #### [3.4.5](https://github.com/eea/volto-block-style/compare/3.4.4...3.4.5) @@ -84,6 +86,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Add range slider [`8a91ef1`](https://github.com/eea/volto-block-style/commit/8a91ef168df01e4a0f114596d50a401a14a41251) - Separate block wrapping; don't apply multiple times [`2adffd5`](https://github.com/eea/volto-block-style/commit/2adffd58a99af59bb42d72c54f2a05be3b9b2ea1) - Separate block wrapping; don't apply multiple times [`584e7a9`](https://github.com/eea/volto-block-style/commit/584e7a9859c7d417708f9aa78b83e94547f2f1ab) +- Add Sonarqube tag using frontend addons list [`f6737ef`](https://github.com/eea/volto-block-style/commit/f6737ef68ba906c5fb72e18c77b060aa82ed0a73) +- Add Sonarqube tag using frontend addons list [`6a4c6c1`](https://github.com/eea/volto-block-style/commit/6a4c6c16acc88471279a82a62b92555dc1ac20cc) +- Add Sonarqube tag using frontend addons list [`2101b55`](https://github.com/eea/volto-block-style/commit/2101b550588402b37cd91b5d582e27a6255d6cac) +- Add Sonarqube tag using frontend addons list [`2583c68`](https://github.com/eea/volto-block-style/commit/2583c68ea49ddbedc7b90b9d477cbbe4e2b779fd) - Add hidden toggle [`3b8ed26`](https://github.com/eea/volto-block-style/commit/3b8ed26a82c31ff430301adceea1174e92464a77) - Add a clear button to the box size widget [`4bdf803`](https://github.com/eea/volto-block-style/commit/4bdf8030d7a4d39d3a48b56ed6c8cddc311b3ff7)