diff --git a/src/constants/dictionary.jsx b/src/constants/dictionary.jsx index b5d26fbbc..6f1230a34 100644 --- a/src/constants/dictionary.jsx +++ b/src/constants/dictionary.jsx @@ -787,6 +787,14 @@ const dictionary = { en: 'Array', fr: 'Tableau', }, + ROUNDABOUT: { + en: 'Roundabout', + fr: 'Rond-point', + }, + OCCURRENCE: { + en: 'Occurrence', + fr: 'Occurrence', + }, responseFormatSimple: { fr: 'RĂ©ponse simple', en: 'Simple response', diff --git a/src/model/transformations/control.jsx b/src/model/transformations/control.jsx index e218e8120..affb12a6f 100644 --- a/src/model/transformations/control.jsx +++ b/src/model/transformations/control.jsx @@ -23,7 +23,8 @@ export function remoteToState(remote = []) { criticity, during_collect, post_collect, - scope: scope === 'line' ? 'LINE' : 'DYNAMIC_ARRAY', + scope: + scope === 'line' || scope === 'occurrence' ? 'OCCURRENCE' : 'WHOLE', }, }; }, {}); @@ -50,7 +51,7 @@ export function stateToRemote(state) { criticity, during_collect, post_collect, - scope: scope === 'LINE' && 'line', + scope: scope === 'OCCURRENCE' && 'occurrence', }; }); } diff --git a/src/model/transformations/control.spec.jsx b/src/model/transformations/control.spec.jsx index 2d734638e..5aa5e51b3 100644 --- a/src/model/transformations/control.spec.jsx +++ b/src/model/transformations/control.spec.jsx @@ -21,7 +21,7 @@ describe('control tramsformation', () => { criticity: 'criticity 2', during_collect: 'during_collect 2', post_collect: 'post_collect 2', - scope: 'line', + scope: 'occurrence', }, ]; const state = { @@ -33,7 +33,7 @@ describe('control tramsformation', () => { criticity: 'criticity 1', during_collect: 'during_collect 1', post_collect: 'post_collect 1', - scope: 'DYNAMIC_ARRAY', + scope: 'WHOLE', }, 2: { id: '2', @@ -43,7 +43,7 @@ describe('control tramsformation', () => { criticity: 'criticity 2', during_collect: 'during_collect 2', post_collect: 'post_collect 2', - scope: 'LINE', + scope: 'OCCURRENCE', }, }; describe('remoteToState', () => { diff --git a/src/widgets/component-new-edit/components/controls.jsx b/src/widgets/component-new-edit/components/controls.jsx index 2d21a3dd2..d47337bfc 100644 --- a/src/widgets/component-new-edit/components/controls.jsx +++ b/src/widgets/component-new-edit/components/controls.jsx @@ -32,6 +32,7 @@ const Controls = ({ errors, addErrors, isDynamicArray, + isRoundabout, }) => { const [disableValidation, setDisableValidation] = useState(false); return ( @@ -91,26 +92,30 @@ const Controls = ({ label={Dictionary.control_scope} required={isDynamicArray} > - + {Dictionary.DYNAMIC_ARRAY} - + {Dictionary.LINE} )} - {/* */} - {/* */} + {isRoundabout && ( + + + {Dictionary.ROUNDABOUT} + + + {Dictionary.OCCURRENCE} + + + )} ); @@ -127,6 +132,7 @@ const mapStateToProps = (state, { formName }) => { state, `${TABS_PATHS.RESPONSE_FORMAT}.${QUESTION_TYPE_ENUM.TABLE}.${DIMENSION_TYPE.PRIMARY}.type`, ) === DIMENSION_FORMATS.LIST, + isRoundabout: selector(state, `locked`) !== undefined, }; }; @@ -136,12 +142,14 @@ Controls.propTypes = { errors: PropTypes.array, addErrors: PropTypes.func.isRequired, isDynamicArray: PropTypes.bool, + isRoundabout: PropTypes.bool, }; Controls.defaultProps = { formName: DEFAULT_FORM_NAME, selectorPath: TABS_PATHS.CONTROLS, errors: [], isDynamicArray: false, + isRoundabout: false, }; export default connect(mapStateToProps)(Controls); diff --git a/src/widgets/component-new-edit/components/sequence-new-edit.jsx b/src/widgets/component-new-edit/components/sequence-new-edit.jsx index 7c99c5ca9..e736f12b0 100644 --- a/src/widgets/component-new-edit/components/sequence-new-edit.jsx +++ b/src/widgets/component-new-edit/components/sequence-new-edit.jsx @@ -85,6 +85,16 @@ export const SequenceNewEdit = ({ addErrors={addSubformValidationErrors} /> + + + )} {componentType !== ROUNDABOUT && (