mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-18 13:48:58 +02:00
more moving
This commit is contained in:
parent
ee0a453cc9
commit
9ded99f964
@ -153,10 +153,6 @@ export const NewConstraintAccordionList = forwardRef<
|
|||||||
constraint={constraint}
|
constraint={constraint}
|
||||||
onCancel={onCancel?.bind(null, index)}
|
onCancel={onCancel?.bind(null, index)}
|
||||||
onDelete={onRemove?.bind(null, index)}
|
onDelete={onRemove?.bind(null, index)}
|
||||||
onSave={onSave!.bind(null, index)}
|
|
||||||
onAutoSave={onAutoSave?.(
|
|
||||||
constraint[constraintId],
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ConstraintAccordionView
|
<ConstraintAccordionView
|
||||||
|
@ -176,7 +176,6 @@ const getInputType = (input: Input): InputType => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
constraint: IConstraint;
|
|
||||||
localConstraint: IConstraint;
|
localConstraint: IConstraint;
|
||||||
setContextName: (contextName: string) => void;
|
setContextName: (contextName: string) => void;
|
||||||
setOperator: (operator: Operator) => void;
|
setOperator: (operator: Operator) => void;
|
||||||
@ -184,26 +183,20 @@ type Props = {
|
|||||||
onDelete?: () => void;
|
onDelete?: () => void;
|
||||||
toggleInvertedOperator: () => void;
|
toggleInvertedOperator: () => void;
|
||||||
toggleCaseSensitivity: () => void;
|
toggleCaseSensitivity: () => void;
|
||||||
onUndo: () => void;
|
|
||||||
constraintChanges: IConstraint[];
|
|
||||||
contextDefinition: Pick<IUnleashContextDefinition, 'legalValues'>;
|
contextDefinition: Pick<IUnleashContextDefinition, 'legalValues'>;
|
||||||
constraintValues: string[];
|
constraintValues: string[];
|
||||||
constraintValue: string;
|
constraintValue: string;
|
||||||
setValue: (value: string) => void;
|
setValue: (value: string) => void;
|
||||||
setValues: (values: string[]) => void;
|
setValues: (values: string[]) => void;
|
||||||
setValuesWithRecord: (values: string[]) => void;
|
|
||||||
removeValue: (index: number) => void;
|
removeValue: (index: number) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EditableConstraint: FC<Props> = ({
|
export const EditableConstraint: FC<Props> = ({
|
||||||
constraintChanges,
|
|
||||||
constraint,
|
|
||||||
localConstraint,
|
localConstraint,
|
||||||
setLocalConstraint,
|
setLocalConstraint,
|
||||||
setContextName,
|
setContextName,
|
||||||
setOperator,
|
setOperator,
|
||||||
onDelete,
|
onDelete,
|
||||||
onUndo,
|
|
||||||
toggleInvertedOperator,
|
toggleInvertedOperator,
|
||||||
toggleCaseSensitivity,
|
toggleCaseSensitivity,
|
||||||
contextDefinition,
|
contextDefinition,
|
||||||
@ -211,7 +204,6 @@ export const EditableConstraint: FC<Props> = ({
|
|||||||
constraintValue,
|
constraintValue,
|
||||||
setValue,
|
setValue,
|
||||||
setValues,
|
setValues,
|
||||||
setValuesWithRecord,
|
|
||||||
removeValue,
|
removeValue,
|
||||||
}) => {
|
}) => {
|
||||||
const { input } = useConstraintInput({
|
const { input } = useConstraintInput({
|
||||||
@ -324,7 +316,7 @@ export const EditableConstraint: FC<Props> = ({
|
|||||||
...(localConstraint.values || []),
|
...(localConstraint.values || []),
|
||||||
...newValues,
|
...newValues,
|
||||||
]);
|
]);
|
||||||
setValuesWithRecord(Array.from(combinedValues));
|
setValues(Array.from(combinedValues));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -399,7 +391,7 @@ export const EditableConstraint: FC<Props> = ({
|
|||||||
<ValueList
|
<ValueList
|
||||||
values={localConstraint.values}
|
values={localConstraint.values}
|
||||||
removeValue={removeValue}
|
removeValue={removeValue}
|
||||||
setValues={setValuesWithRecord}
|
setValues={setValues}
|
||||||
getExternalFocusTarget={() =>
|
getExternalFocusTarget={() =>
|
||||||
addValuesButtonRef.current ??
|
addValuesButtonRef.current ??
|
||||||
deleteButtonRef.current
|
deleteButtonRef.current
|
||||||
@ -430,7 +422,7 @@ export const EditableConstraint: FC<Props> = ({
|
|||||||
)}
|
)}
|
||||||
constraintValues={constraintValues}
|
constraintValues={constraintValues}
|
||||||
values={localConstraint.values || []}
|
values={localConstraint.values || []}
|
||||||
setValuesWithRecord={setValuesWithRecord}
|
setValuesWithRecord={setValues}
|
||||||
setValues={setValues}
|
setValues={setValues}
|
||||||
/>
|
/>
|
||||||
</LegalValuesContainer>
|
</LegalValuesContainer>
|
||||||
|
@ -118,6 +118,7 @@ export const EditableConstraintWrapper = ({
|
|||||||
(index: number) => {
|
(index: number) => {
|
||||||
const valueCopy = [...localConstraint.values!];
|
const valueCopy = [...localConstraint.values!];
|
||||||
valueCopy.splice(index, 1);
|
valueCopy.splice(index, 1);
|
||||||
|
setValues(valueCopy);
|
||||||
},
|
},
|
||||||
[localConstraint],
|
[localConstraint],
|
||||||
);
|
);
|
||||||
@ -131,15 +132,12 @@ export const EditableConstraintWrapper = ({
|
|||||||
toggleInvertedOperator={setInvertedOperator}
|
toggleInvertedOperator={setInvertedOperator}
|
||||||
toggleCaseSensitivity={setCaseInsensitive}
|
toggleCaseSensitivity={setCaseInsensitive}
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
constraintChanges={constraintChanges}
|
|
||||||
setValues={setValues}
|
setValues={setValues}
|
||||||
setValuesWithRecord={setValuesWithRecord}
|
|
||||||
setValue={setValue}
|
setValue={setValue}
|
||||||
constraintValues={constraint?.values || []}
|
constraintValues={constraint?.values || []}
|
||||||
constraintValue={constraint?.value || ''}
|
constraintValue={constraint?.value || ''}
|
||||||
contextDefinition={contextDefinition}
|
contextDefinition={contextDefinition}
|
||||||
removeValue={removeValue}
|
removeValue={removeValue}
|
||||||
constraint={constraint}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user