@@ -6,6 +6,7 @@ import dayjs from "dayjs";
|
||||
import TextArea from "antd/es/input/TextArea";
|
||||
import { IFilament } from "../filaments/model";
|
||||
import { ISpool } from "./model";
|
||||
import { numberFormatter, numberParser } from "../../utils/parsing";
|
||||
|
||||
interface CreateOrCloneProps {
|
||||
mode: "create" | "clone";
|
||||
@@ -107,7 +108,7 @@ export const SpoolCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber min={0} addonAfter="g" precision={0} />
|
||||
<InputNumber min={0} addonAfter="g" precision={1} formatter={numberFormatter} parser={numberParser} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("spool.fields.location")}
|
||||
|
||||
@@ -6,6 +6,7 @@ import dayjs from "dayjs";
|
||||
import TextArea from "antd/es/input/TextArea";
|
||||
import { IFilament } from "../filaments/model";
|
||||
import { ISpool } from "./model";
|
||||
import { numberFormatter, numberParser } from "../../utils/parsing";
|
||||
|
||||
export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
|
||||
const t = useTranslate();
|
||||
@@ -118,10 +119,14 @@ export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber min={0} addonAfter="g" precision={0} />
|
||||
{/* TODO: Allow higher precision here.
|
||||
However, that requires that we can handle the , -> . replacement in the number parser
|
||||
more elegantly for locales which use , as a thousands separator. */}
|
||||
<InputNumber
|
||||
min={0}
|
||||
addonAfter="g"
|
||||
precision={1}
|
||||
max={1e6}
|
||||
formatter={numberFormatter}
|
||||
parser={numberParser}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("spool.fields.location")}
|
||||
|
||||
@@ -262,7 +262,7 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
|
||||
id: "used_length",
|
||||
i18ncat: "spool",
|
||||
unit: "mm",
|
||||
decimals: 0,
|
||||
decimals: 1,
|
||||
dataSource,
|
||||
tableState,
|
||||
})}
|
||||
@@ -270,7 +270,7 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
|
||||
id: "remaining_length",
|
||||
i18ncat: "spool",
|
||||
unit: "mm",
|
||||
decimals: 0,
|
||||
decimals: 1,
|
||||
defaultText: t("unknown"),
|
||||
dataSource,
|
||||
tableState,
|
||||
|
||||
@@ -55,6 +55,7 @@ export const SpoolShow: React.FC<IResourceComponentsProps> = () => {
|
||||
unit="g"
|
||||
options={{
|
||||
maximumFractionDigits: 1,
|
||||
minimumFractionDigits: 1,
|
||||
}}
|
||||
/>
|
||||
<Title level={5}>{t("spool.fields.used_weight")}</Title>
|
||||
@@ -63,6 +64,7 @@ export const SpoolShow: React.FC<IResourceComponentsProps> = () => {
|
||||
unit="g"
|
||||
options={{
|
||||
maximumFractionDigits: 1,
|
||||
minimumFractionDigits: 1,
|
||||
}}
|
||||
/>
|
||||
<Title level={5}>{t("spool.fields.location")}</Title>
|
||||
|
||||
Reference in New Issue
Block a user