@reekon-tools/boldr-utils 1.26.0 → 1.26.1
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/exports.d.ts +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/types/firestore.d.ts +9 -0
- package/dist/utils/micrometersToUnit.d.ts +11 -0
- package/dist/utils/micrometersToUnit.js +27 -0
- package/package.json +1 -1
package/dist/exports.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { evaluateFormula, createFormulaScope, createEnhancedFormulaScope, clearFormulaCache, micrometersToUnitNumber, type EnhancedMapping, type FormulaDefinition, type FormulaEvaluationOptions, } from './formulas/evaluateFormula.js';
|
|
2
2
|
export { calculateFormula } from './formulas/calculateFormula.js';
|
|
3
|
-
export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
3
|
+
export { convertMicrometers, resultDisplayUnit, } from './utils/micrometersToUnit.js';
|
|
4
4
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
5
5
|
export { useParseMeasurement } from './utils/useParseMeasurement.js';
|
|
6
6
|
export * from './types/firestore.js';
|
package/dist/exports.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// AnnotationCanvas import.
|
|
5
5
|
export { evaluateFormula, createFormulaScope, createEnhancedFormulaScope, clearFormulaCache, micrometersToUnitNumber, } from './formulas/evaluateFormula.js';
|
|
6
6
|
export { calculateFormula } from './formulas/calculateFormula.js';
|
|
7
|
-
export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
7
|
+
export { convertMicrometers, resultDisplayUnit, } from './utils/micrometersToUnit.js';
|
|
8
8
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
9
9
|
export { useParseMeasurement } from './utils/useParseMeasurement.js';
|
|
10
10
|
export * from './types/firestore.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './exports.js';
|
|
2
2
|
export { evaluateFormula, createFormulaScope, createEnhancedFormulaScope, clearFormulaCache, micrometersToUnitNumber, type EnhancedMapping, type FormulaDefinition, type FormulaEvaluationOptions, } from './formulas/evaluateFormula.js';
|
|
3
3
|
export { calculateFormula } from './formulas/calculateFormula.js';
|
|
4
|
-
export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
4
|
+
export { convertMicrometers, resultDisplayUnit, } from './utils/micrometersToUnit.js';
|
|
5
5
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
6
6
|
export { useParseMeasurement } from './utils/useParseMeasurement.js';
|
|
7
7
|
export * from './types/firestore.js';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export * from './exports.js';
|
|
6
6
|
export { evaluateFormula, createFormulaScope, createEnhancedFormulaScope, clearFormulaCache, micrometersToUnitNumber, } from './formulas/evaluateFormula.js';
|
|
7
7
|
export { calculateFormula } from './formulas/calculateFormula.js';
|
|
8
|
-
export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
8
|
+
export { convertMicrometers, resultDisplayUnit, } from './utils/micrometersToUnit.js';
|
|
9
9
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
10
10
|
export { useParseMeasurement } from './utils/useParseMeasurement.js';
|
|
11
11
|
export * from './types/firestore.js';
|
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { evaluateFormula, createFormulaScope, createEnhancedFormulaScope, clearFormulaCache, micrometersToUnitNumber, type EnhancedMapping, type FormulaDefinition, type FormulaEvaluationOptions, } from './formulas/evaluateFormula.js';
|
|
2
2
|
export { calculateFormula } from './formulas/calculateFormula.js';
|
|
3
|
-
export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
3
|
+
export { convertMicrometers, resultDisplayUnit, } from './utils/micrometersToUnit.js';
|
|
4
4
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
5
5
|
export * from './types/firestore.js';
|
|
6
6
|
export * from './types/layout.js';
|
package/dist/server.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// in their import graph may be re-exported from this file.
|
|
6
6
|
export { evaluateFormula, createFormulaScope, createEnhancedFormulaScope, clearFormulaCache, micrometersToUnitNumber, } from './formulas/evaluateFormula.js';
|
|
7
7
|
export { calculateFormula } from './formulas/calculateFormula.js';
|
|
8
|
-
export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
8
|
+
export { convertMicrometers, resultDisplayUnit, } from './utils/micrometersToUnit.js';
|
|
9
9
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
10
10
|
export * from './types/firestore.js';
|
|
11
11
|
export * from './types/layout.js';
|
|
@@ -435,6 +435,15 @@ interface ColumnConfigBase {
|
|
|
435
435
|
export type ColumnConfig = ColumnConfigBase & ({
|
|
436
436
|
type: ColumnType.Formula;
|
|
437
437
|
columnData: FormulaColumnData;
|
|
438
|
+
/**
|
|
439
|
+
* Renders the computed result in the decimal/fractional counterpart
|
|
440
|
+
* of each viewer's unit (in_frac ⇄ in, ft_in_frac ⇄ ft_in_decimal;
|
|
441
|
+
* no-op for units with no counterpart). Absent = follow the unit's
|
|
442
|
+
* own format. Lives on the union member — NOT inside columnData,
|
|
443
|
+
* which every formula-editor save rebuilds wholesale. Clearing
|
|
444
|
+
* removes the key.
|
|
445
|
+
*/
|
|
446
|
+
resultDisplay?: 'decimal' | 'fractional';
|
|
438
447
|
} | {
|
|
439
448
|
type: ColumnType.SingleSelect;
|
|
440
449
|
columnData: SelectColumnData;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { DecimalTolerance, FractionalTolerance, Units } from '../types/firestore.js';
|
|
2
|
+
/**
|
|
3
|
+
* The display unit for a formula column's result under its per-column
|
|
4
|
+
* decimal/fractional switch. Fraction-vs-decimal is decided entirely by the
|
|
5
|
+
* Units value (convertMicrometers has no format parameter), so the switch is
|
|
6
|
+
* a substitution between same-scale counterparts: in_frac ⇄ in and
|
|
7
|
+
* ft_in_frac ⇄ ft_in_decimal. Units with no counterpart — metric, and plain
|
|
8
|
+
* ft (the enum has no fractional-feet form) — pass through unchanged, so the
|
|
9
|
+
* setting is a no-op for those viewers. Same physical scale both ways: this
|
|
10
|
+
* can never change a computed number, only its rendering.
|
|
11
|
+
*/
|
|
12
|
+
export declare const resultDisplayUnit: (unit: Units, resultDisplay?: "decimal" | "fractional") => Units;
|
|
2
13
|
export declare const roundToT1Values: (value: number, u: Units) => number;
|
|
3
14
|
export declare const convertMicrometers: (micrometers: number | null | undefined, unit: Units, fractionalTolerance?: FractionalTolerance, decimalTolerance?: DecimalTolerance, device?: string) => {
|
|
4
15
|
value: string;
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { DecimalTolerance, FractionalTolerance, Units, convertUnitsToReadable, } from '../types/firestore.js';
|
|
2
2
|
import { create, all } from 'mathjs';
|
|
3
3
|
const math = create(all);
|
|
4
|
+
/**
|
|
5
|
+
* The display unit for a formula column's result under its per-column
|
|
6
|
+
* decimal/fractional switch. Fraction-vs-decimal is decided entirely by the
|
|
7
|
+
* Units value (convertMicrometers has no format parameter), so the switch is
|
|
8
|
+
* a substitution between same-scale counterparts: in_frac ⇄ in and
|
|
9
|
+
* ft_in_frac ⇄ ft_in_decimal. Units with no counterpart — metric, and plain
|
|
10
|
+
* ft (the enum has no fractional-feet form) — pass through unchanged, so the
|
|
11
|
+
* setting is a no-op for those viewers. Same physical scale both ways: this
|
|
12
|
+
* can never change a computed number, only its rendering.
|
|
13
|
+
*/
|
|
14
|
+
export const resultDisplayUnit = (unit, resultDisplay) => {
|
|
15
|
+
if (resultDisplay === 'decimal') {
|
|
16
|
+
if (unit === Units.FractionalInches)
|
|
17
|
+
return Units.Inches;
|
|
18
|
+
if (unit === Units.FeetInchesFractional)
|
|
19
|
+
return Units.FeetInchesDecimal;
|
|
20
|
+
return unit;
|
|
21
|
+
}
|
|
22
|
+
if (resultDisplay === 'fractional') {
|
|
23
|
+
if (unit === Units.Inches)
|
|
24
|
+
return Units.FractionalInches;
|
|
25
|
+
if (unit === Units.FeetInchesDecimal)
|
|
26
|
+
return Units.FeetInchesFractional;
|
|
27
|
+
return unit;
|
|
28
|
+
}
|
|
29
|
+
return unit;
|
|
30
|
+
};
|
|
4
31
|
// The T1 rounds differently depending on the selected measurement unit.
|
|
5
32
|
// This function mirrors the rounding behavior implemented on the firmware.
|
|
6
33
|
// The value being rounded is in microns.
|