fix: Improve number and slider input handling in V2Input and SplitPanelLayoutComponent
- Enhanced V2Input to convert string values from the database to numbers for number and slider inputs, ensuring correct display and functionality. - Updated primary key retrieval logic in SplitPanelLayoutComponent to prioritize actual DB id values, improving data integrity. - Simplified primary key handling by removing unnecessary checks and ensuring consistent usage of id fields. - Improved user feedback in the SplitPanelLayoutComponent with clearer console logs for save operations and item selections.
This commit is contained in:
@@ -771,9 +771,15 @@ export const V2Input = forwardRef<HTMLDivElement, V2InputProps>((props, ref) =>
|
||||
);
|
||||
|
||||
case "number":
|
||||
// DB에서 문자열("325")로 반환되는 경우도 숫자로 변환하여 표시
|
||||
const numValue = typeof displayValue === "number"
|
||||
? displayValue
|
||||
: (displayValue !== undefined && displayValue !== null && displayValue !== "" && !isNaN(Number(displayValue)))
|
||||
? Number(displayValue)
|
||||
: undefined;
|
||||
return (
|
||||
<NumberInput
|
||||
value={typeof displayValue === "number" ? displayValue : undefined}
|
||||
value={numValue}
|
||||
onChange={(v) => {
|
||||
setAutoGeneratedValue(null);
|
||||
onChange?.(v ?? 0);
|
||||
@@ -802,9 +808,15 @@ export const V2Input = forwardRef<HTMLDivElement, V2InputProps>((props, ref) =>
|
||||
);
|
||||
|
||||
case "slider":
|
||||
// DB에서 문자열로 반환되는 경우도 숫자로 변환
|
||||
const sliderValue = typeof displayValue === "number"
|
||||
? displayValue
|
||||
: (displayValue !== undefined && displayValue !== null && displayValue !== "" && !isNaN(Number(displayValue)))
|
||||
? Number(displayValue)
|
||||
: (config.min ?? 0);
|
||||
return (
|
||||
<SliderInput
|
||||
value={typeof displayValue === "number" ? displayValue : (config.min ?? 0)}
|
||||
value={sliderValue}
|
||||
onChange={(v) => {
|
||||
setAutoGeneratedValue(null);
|
||||
onChange?.(v);
|
||||
|
||||
Reference in New Issue
Block a user