UI: Add new unit definition

This commit is contained in:
Vladyslav_Prykhodko 2025-04-30 18:31:57 +03:00
parent 505dfb2e4d
commit 76fd2a3abb
5 changed files with 36 additions and 16 deletions

View File

@ -18,7 +18,7 @@ import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models';
export type ChargeUnits = ChargeMetricUnits;
export type ChargeMetricUnits = 'c' | 'mC' | 'μC' | 'nC' | 'pC';
export type ChargeMetricUnits = 'c' | 'mC' | 'μC' | 'nC' | 'pC' | 'mAh' | 'Ah' | 'kAh';
const METRIC: TbMeasureUnits<ChargeMetricUnits> = {
units: {
@ -47,6 +47,21 @@ const METRIC: TbMeasureUnits<ChargeMetricUnits> = {
tags: ['charge', 'electricity', 'electrostatics', 'picocoulomb', 'pC'],
to_anchor: 1e-12,
},
mAh: {
name: 'unit.milliampere-hour',
tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'milliampere-hour', 'milliampere-hours', 'mAh'],
to_anchor: 3.6,
},
Ah: {
name: 'unit.ampere-hours',
tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'ampere', 'ampere-hours', 'Ah'],
to_anchor: 3600,
},
kAh: {
name: 'unit.kiloampere-hours',
tags: ['electric current', 'current flow', 'electric charge', 'current capacity', 'flow of electricity', 'electrical flow', 'kiloampere-hours', 'kiloampere-hour', 'kAh'],
to_anchor: 3600000,
},
}
};

View File

@ -18,7 +18,7 @@ import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models';
export type ElectricCurrentUnits = ElectricCurrentMetricalUnits;
export type ElectricCurrentMetricalUnits = 'A' | 'nA' | 'μA' | 'mA' | 'kA' | 'MA' | 'GA';
export type ElectricCurrentMetricalUnits = 'A' | 'pA' | 'nA' | 'μA' | 'mA' | 'kA' | 'MA' | 'GA';
const METRIC: TbMeasureUnits<ElectricCurrentMetricalUnits> = {
units: {
@ -27,9 +27,14 @@ const METRIC: TbMeasureUnits<ElectricCurrentMetricalUnits> = {
tags: ['electric current', 'current flow', 'flow of electricity', 'electrical flow', 'ampere', 'amperes', 'amperage', 'A'],
to_anchor: 1,
},
pA: {
name: 'unit.picoampere',
tags: ['current', 'amperes', 'picoampere', 'pA'],
to_anchor: 1e-12,
},
nA: {
name: 'unit.nanoampere',
tags: ['electric current', 'nanoampere', 'nanoamperes', 'nA'],
tags: ['electric current', 'amperes', 'nanoampere', 'nA'],
to_anchor: 1e-9,
},
μA: {

View File

@ -33,7 +33,7 @@ export type EnergyMetricUnits =
| 'GJ'
| 'eV';
export type EnergyImperialUnits = 'kcal' | 'cal' | 'Cal' | 'BTU' | 'ft·lb';
export type EnergyImperialUnits = 'kcal' | 'cal' | 'Cal' | 'BTU' | 'ft·lb' | 'thm';
const METRIC: TbMeasureUnits<EnergyMetricUnits> = {
ratio: 1 / 4.184,
@ -134,6 +134,11 @@ const IMPERIAL: TbMeasureUnits<EnergyImperialUnits> = {
tags: ['energy', 'foot-pound', 'foot-pounds', 'ft·lb', 'ft⋅lbf'],
to_anchor: 0.32404875717017,
},
thm: {
name: 'unit.therm',
tags: ['energy', 'natural gas consumption', 'BTU', 'therm', 'thm'],
to_anchor: 25219021.687207,
},
},
};

View File

@ -18,7 +18,7 @@ import { TbMeasure, TbMeasureUnits } from '@shared/models/unit.models';
export type MassUnits = MassMetricUnits | MassImperialUnits;
export type MassMetricUnits = 'ng' | 'mcg' | 'mg' | 'g' | 'kg' | 't' | 'Da';
export type MassMetricUnits = 'ng' | 'mcg' | 'mg' | 'g' | 'kg' | 't' | 'Da' | 'ct';
export type MassImperialUnits = 'oz' | 'lb' | 'st' | 'short tons' | 'gr' | 'dr' | 'qr' | 'cwt' | 'slug';
const METRIC: TbMeasureUnits<MassMetricUnits> = {
@ -47,7 +47,7 @@ const METRIC: TbMeasureUnits<MassMetricUnits> = {
kg: {
name: 'unit.kilogram',
tags: ['mass', 'weight', 'heaviness', 'load', 'kilogram', 'kilograms', 'kg'],
to_anchor: 1000, // 1 kg = 1000 g
to_anchor: 1000,
},
t: {
name: 'unit.tonne',
@ -59,6 +59,11 @@ const METRIC: TbMeasureUnits<MassMetricUnits> = {
tags: ['atomic mass unit', 'AMU', 'unified atomic mass unit', 'dalton', 'Da'],
to_anchor: 1.66053906660e-24,
},
ct: {
name: 'unit.carat',
tags: ['gemstone', 'pearl', 'jewelry', 'carat', 'ct'],
to_anchor: 0.2,
},
},
};

View File

@ -6059,11 +6059,8 @@
"barn": "Barn",
"circular-inch": "Circular Inch",
"milliampere-hour": "Milliampere-hour",
"milliampere-hour-tags": "electric current, current flow, electric charge, current capacity, flow of electricity, electrical flow, milliampere-hour, milliampere-hours, mAh",
"ampere-hours": "Ampere-hours",
"ampere-hours-tags": "electric current, current flow, electric charge, current capacity, flow of electricity, electrical flow, ampere, ampere-hours, Ah",
"kiloampere-hours": "Kiloampere-hours",
"kiloampere-hours-tags": "electric current, current flow, electric charge, current capacity, flow of electricity, electrical flow, kiloampere-hours, kiloampere-hour, kAh",
"nanoampere": "Nanoampere",
"microampere": "Microampere",
"milliampere": "Milliampere",
@ -6072,19 +6069,12 @@
"megaampere": "Megaampere",
"gigaampere": "Gigaampere",
"microampere-per-square-centimeter": "Microampere per square centimeter",
"microampere-per-square-centimeter-tags": "Current density, microampere per square centimeter, µA/cm²",
"ampere-per-square-meter": "Ampere per Square Meter",
"ampere-per-square-meter-tags": "current density, current per unit area, ampere per square meter, A/m²",
"ampere-per-meter": "Ampere per Meter",
"ampere-per-meter-tags": "magnetic field strength, magnetic field intensity, ampere per meter, A/m",
"oersted": "Oersted",
"oersted-tags": "magnetic field, oersted, Oe",
"bohr-magneton": "Bohr Magneton",
"bohr-magneton-tags": "atomic physics, magnetic moment, bohr magneton, μB",
"ampere-meter-squared": "Ampere-Meter Squared",
"ampere-meter-squared-tags": "magnetic moment, dipole moment, ampere-meter squared, A·m²",
"ampere-meter": "Ampere-Meter",
"ampere-meter-tags": "magnetic field, current loop, ampere-meter, A·m",
"nanovolt": "Nanovolt",
"picovolt": "Picovolt",
"millivolt": "Millivolts",