This commit is contained in:
Rizky 2024-01-26 08:54:20 +07:00
parent 89510dcb8c
commit 1e70d014ad
2 changed files with 8 additions and 8 deletions

View File

@ -9,15 +9,12 @@ import { EDGlobal } from "../../../logic/ed-global";
import { import {
iconChevronDown, iconChevronDown,
iconDownload, iconDownload,
iconLoading,
iconLog,
iconNewTab, iconNewTab,
iconScrollOff, iconScrollOff,
iconScrollOn, iconScrollOn,
iconTrash, iconUpload
iconUpload,
} from "./icons"; } from "./icons";
import { CodeNameItem, CodeNameList, codeName } from "./name-list"; import { CodeNameItem, CodeNameList } from "./name-list";
export const code = { export const code = {
mode: "" as "" | "old" | "new", mode: "" as "" | "old" | "new",

View File

@ -59,14 +59,16 @@ export const FieldNumUnit: FC<{
} }
if (!parseInt(val)) unt = ""; if (!parseInt(val)) unt = "";
} }
if (!local.focus) {
local.val_str = val;
}
local.val = parseInt(val) || 0; local.val = parseInt(val) || 0;
if (positiveOnly && local.val < 0) { if (positiveOnly && local.val < 0) {
local.val = Math.max(0, local.val); local.val = Math.max(0, local.val);
} }
local.unit = unit || unt || "px"; local.unit = unit || unt || "px";
if (!local.focus) {
local.val_str = local.val + "";
}
local.render(); local.render();
}, [value, unit]); }, [value, unit]);
@ -166,6 +168,7 @@ export const FieldNumUnit: FC<{
}} }}
onBlur={() => { onBlur={() => {
local.focus = false; local.focus = false;
local.val_str = local.val + "";
local.render(); local.render();
}} }}
onChange={(e) => { onChange={(e) => {