@firecms/ui 3.0.0-canary.242 → 3.0.0-canary.244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Select.d.ts +1 -0
- package/dist/index.es.js +7 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +7 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Select.tsx +33 -28
@@ -23,6 +23,7 @@ export type SelectProps<T extends SelectValue = string> = {
|
|
23
23
|
padding?: boolean;
|
24
24
|
invisible?: boolean;
|
25
25
|
children?: React.ReactNode;
|
26
|
+
dataType?: "string" | "number" | "boolean";
|
26
27
|
};
|
27
28
|
export declare const Select: React.ForwardRefExoticComponent<SelectProps<string> & React.RefAttributes<HTMLDivElement>>;
|
28
29
|
export type SelectItemProps<T extends SelectValue = string> = {
|
package/dist/index.es.js
CHANGED
@@ -30551,6 +30551,7 @@ const Select = forwardRef(({
|
|
30551
30551
|
endAdornment,
|
30552
30552
|
invisible,
|
30553
30553
|
children,
|
30554
|
+
dataType = "string",
|
30554
30555
|
...props
|
30555
30556
|
}, ref) => {
|
30556
30557
|
const [openInternal, setOpenInternal] = useState(open ?? false);
|
@@ -30559,9 +30560,12 @@ const Select = forwardRef(({
|
|
30559
30560
|
}, [open]);
|
30560
30561
|
const onValueChangeInternal = useCallback((newValue) => {
|
30561
30562
|
let typedValue = newValue;
|
30562
|
-
if (
|
30563
|
-
|
30564
|
-
|
30563
|
+
if (dataType === "boolean") {
|
30564
|
+
if (newValue === "true") typedValue = true;
|
30565
|
+
else if (newValue === "false") typedValue = false;
|
30566
|
+
} else if (dataType === "number") {
|
30567
|
+
if (!isNaN(Number(newValue)) && newValue.trim() !== "") typedValue = Number(newValue);
|
30568
|
+
}
|
30565
30569
|
onValueChange?.(typedValue);
|
30566
30570
|
if (onChange) {
|
30567
30571
|
const event = {
|