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