Skip to content

Commit

Permalink
fix: do not allow arbitrary in table
Browse files Browse the repository at this point in the history
  • Loading branch information
QRuhier committed Jan 10, 2025
1 parent bc7067e commit 39e02a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
15 changes: 2 additions & 13 deletions src/model/formToState/component-new-edit/response-format-table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const defaultMeasureState = {
cloneDeep(CodesListDefaultState),
{ id: uuid() },
),
allowArbitrary: false,
visHint: RADIO,
},
};
Expand All @@ -77,7 +76,6 @@ export const defaultMeasureForm = {
type: SIMPLE,
[SIMPLE]: defaultMeasureSimpleState,
[SINGLE_CHOICE]: {
allowArbitrary: false,
hasSpecialCode: false,
specialLabel: '',
specialCode: '',
Expand Down Expand Up @@ -174,17 +172,13 @@ export function formToStateMeasure(form, codesListMeasure) {
[simpleType]: { ...simpleForm },
};
} else {
const {
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: codesListForm,
} = measureForm;
const { visHint, [DEFAULT_CODES_LIST_SELECTOR_PATH]: codesListForm } =
measureForm;
const codesList = codesListMeasure
? codesListMeasure.formToStateComponent(codesListForm)
: CodesListFactory().formToState(codesListForm);

state[SINGLE_CHOICE] = {
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: codesList,
};
Expand Down Expand Up @@ -259,7 +253,6 @@ export function stateToFormMeasure(
type,
[SIMPLE]: simpleState,
[SINGLE_CHOICE]: {
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: codesListState,
},
Expand All @@ -280,7 +273,6 @@ export function stateToFormMeasure(
type,
[SIMPLE]: simpleState,
[SINGLE_CHOICE]: {
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: codesListForm,
},
Expand All @@ -290,7 +282,6 @@ export function stateToFormMeasure(
export function stateToFormMeasureList(currentState, codesListsStore) {
const {
[SINGLE_CHOICE]: {
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: codesListState,
},
Expand All @@ -304,7 +295,6 @@ export function stateToFormMeasureList(currentState, codesListsStore) {
return {
...currentState,
[SINGLE_CHOICE]: {
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: codesListForm,
},
Expand Down Expand Up @@ -387,7 +377,6 @@ const Factory = (initialState = {}, codesListsStore) => {
state[SINGLE_CHOICE] = {
[DEFAULT_CODES_LIST_SELECTOR_PATH]:
codesListsStore[measureState[DEFAULT_CODES_LIST_SELECTOR_PATH].id],
allowArbitrary: measureState.allowArbitrary,
visHint: measureState.visHint,
};
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/model/transformations/response-format-table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ function stateToResponseState(state) {
} else {
const {
mandatory,
allowArbitrary,
visHint,
[DEFAULT_CODES_LIST_SELECTOR_PATH]: { id: codesListId },
} = measureTypeState;
Expand All @@ -328,7 +327,6 @@ function stateToResponseState(state) {
typeName: TEXT,
maxLength: 1,
pattern: '',
allowArbitrary,
visHint,
};
}
Expand Down

0 comments on commit 39e02a5

Please sign in to comment.