Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Numbers value parse on parameter selector #641

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/chart/parameter/component/NodePropertyParameterSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { ParameterSelectProps } from './ParameterSelect';
import { RenderSubValue } from '../../../report/ReportRecordProcessing';
import { SelectionConfirmationButton } from './SelectionConfirmationButton';
import { getRecordType, toNumber } from '../../ChartUtils';

const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
const suggestionsUpdateTimeout =
Expand Down Expand Up @@ -105,18 +106,24 @@
realValueRowIndex
];

newValue.push(RenderSubValue(val));
if (newValue.low) {
newValue.push(toNumber(val));
} else {
newValue.push(RenderSubValue(val));

Check warning on line 112 in src/chart/parameter/component/NodePropertyParameterSelect.tsx

View check run for this annotation

Codecov / codecov/patch

src/chart/parameter/component/NodePropertyParameterSelect.tsx#L110-L112

Added lines #L110 - L112 were not covered by tests
}
} else if (!isMulti) {
newValue = extraRecords.filter((r) => (r?._fields?.[displayValueRowIndex]?.toString() || null) == newDisplay)[0]
._fields[realValueRowIndex];

newValue = RenderSubValue(newValue);
newValue = newValue.low ? toNumber(newValue) : RenderSubValue(newValue);
} else {
let ele = valDisplayReference.filter((x) => !newDisplay.includes(x))[0];
newValue = [...valReference];
newValue.splice(valDisplayReference.indexOf(ele), 1);
}

newDisplay = newDisplay.low ? toNumber(newDisplay) : RenderSubValue(newDisplay);

setInputDisplayText(isMulti ? '' : newDisplay);
setInputValue(newDisplay);

Expand All @@ -129,14 +136,14 @@
const isArray = Array.isArray(props.parameterDisplayValue);
if (multiSelector) {
if (isArray) {
setInputDisplayText(props.parameterDisplayValue);
setInputValue(props.parameterDisplayValue);

Check warning on line 140 in src/chart/parameter/component/NodePropertyParameterSelect.tsx

View check run for this annotation

Codecov / codecov/patch

src/chart/parameter/component/NodePropertyParameterSelect.tsx#L139-L140

Added lines #L139 - L140 were not covered by tests
} else if (props.parameterDisplayValue !== '') {
setInputDisplayText([props.parameterDisplayValue]);
setInputValue([props.parameterDisplayValue]);
} else {
setInputDisplayText('');
setInputValue([]);

Check warning on line 146 in src/chart/parameter/component/NodePropertyParameterSelect.tsx

View check run for this annotation

Codecov / codecov/patch

src/chart/parameter/component/NodePropertyParameterSelect.tsx#L142-L146

Added lines #L142 - L146 were not covered by tests
}
} else {
setInputDisplayText(props.parameterDisplayValue);
Expand Down
Loading