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/parameter select #794

Merged
merged 7 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 0 additions & 1 deletion src/chart/parameter/component/DateParameterSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import NeoDatePicker from '../../../component/field/DateField';
import dayjs from 'dayjs';
import { Date as Neo4jDate } from 'neo4j-driver-core/lib/temporal-types.js';
import { isCastableToNeo4jDate, isEmptyObject } from '../../ChartUtils';
import { debounce } from '@mui/material';

function castPropsToBoltDate(dict) {
if (isEmptyObject(dict)) {
Expand Down
16 changes: 8 additions & 8 deletions src/chart/parameter/component/NodePropertyParameterSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
let valDisplayReference = manualParameterSave ? paramValueDisplayLocal : props.parameterDisplayValue;
// Multiple and new entry
if (isMulti && inputValue !== null && newDisplay !== null && inputValue.length < newDisplay.length) {
newValue = Array.isArray(valReference) ? [...valReference] : [valReference];
newValue = Array.isArray(valReference)
? [...valReference]
: valReference && valReference !== null
? [valReference]
: [];
const newDisplayValue = [...newDisplay].slice(-1)[0];

let val = extraRecords.filter((r) => r._fields[displayValueRowIndex].toString() == newDisplayValue)[0]._fields[
realValueRowIndex
];

if (newValue.low) {
newValue.push(toNumber(val));
} else {
Expand All @@ -119,18 +121,17 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
newValue = extraRecords.filter((r) => (r?._fields?.[displayValueRowIndex]?.toString() || null) == newDisplay)[0]
._fields[realValueRowIndex];

newValue = newValue.low ? toNumber(newValue) : RenderSubValue(newValue);
newValue =
(newValue.low && newValue.low != null) || newValue.low === 0 ? 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);

handleParametersUpdate(newValue, newDisplay, manualParameterSave);
};

Expand Down Expand Up @@ -164,7 +165,6 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
/>
);
}

return (
<div className={'n-flex n-flex-row n-flex-wrap n-items-center'}>
<Autocomplete
Expand All @@ -179,7 +179,7 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
marginLeft: '15px',
marginTop: '5px',
}}
inputValue={inputDisplayText || ''}
inputValue={inputDisplayText.toString() || ''}
onInputChange={(event, value) => {
setInputDisplayText(value);
debouncedQueryCallback(props.query, { input: `${value}`, ...allParameters }, setExtraRecords);
Expand Down
Loading
Loading