@reekon-tools/boldr-utils 1.6.26 → 1.6.27
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/annotation/canvas/AnnotationCanvasSkia.js +6 -2
- package/dist/annotation/canvas/measurementGeometry.js +2 -3
- package/dist/annotation/canvas/stampLayout.d.ts +1 -2
- package/dist/annotation/canvas/stampLayout.js +21 -30
- package/dist/annotation/canvas/tools/measurementLineTool.d.ts +12 -0
- package/dist/annotation/canvas/tools/measurementLineTool.js +95 -0
- package/dist/exports.d.ts +1 -2
- package/dist/exports.js +1 -2
- package/package.json +1 -1
- package/dist/canvas/AnnotationCanvas.d.ts +0 -11
- package/dist/canvas/AnnotationCanvas.js +0 -10
- package/dist/canvas/AnnotationCanvas.native.d.ts +0 -8
- package/dist/canvas/AnnotationCanvas.native.js +0 -6
- package/dist/canvas/AnnotationCanvasInner.d.ts +0 -39
- package/dist/canvas/AnnotationCanvasInner.js +0 -219
- package/dist/canvas/AnnotationCanvasInner.native.d.ts +0 -35
- package/dist/canvas/AnnotationCanvasInner.native.js +0 -138
- package/dist/canvas/AnnotationCanvasSkia.d.ts +0 -27
- package/dist/canvas/AnnotationCanvasSkia.js +0 -20
- package/dist/canvas/Tool.d.ts +0 -38
- package/dist/canvas/Tool.js +0 -1
- package/dist/canvas/elements/BackgroundImageElement.d.ts +0 -9
- package/dist/canvas/elements/BackgroundImageElement.js +0 -37
- package/dist/canvas/elements/MeasurementStampElement.d.ts +0 -13
- package/dist/canvas/elements/MeasurementStampElement.js +0 -30
- package/dist/canvas/elements/ShapeElement.d.ts +0 -7
- package/dist/canvas/elements/ShapeElement.js +0 -62
- package/dist/canvas/elements/StrokeElement.d.ts +0 -7
- package/dist/canvas/elements/StrokeElement.js +0 -18
- package/dist/canvas/measurementPicker.d.ts +0 -10
- package/dist/canvas/measurementPicker.js +0 -1
- package/dist/canvas/measurementStampOverlay.d.ts +0 -11
- package/dist/canvas/measurementStampOverlay.js +0 -1
- package/dist/canvas/pointerAdapter.d.ts +0 -3
- package/dist/canvas/pointerAdapter.js +0 -19
- package/dist/canvas/stampLayout.d.ts +0 -5
- package/dist/canvas/stampLayout.js +0 -14
- package/dist/canvas/tools/measurementStampTool.d.ts +0 -9
- package/dist/canvas/tools/measurementStampTool.js +0 -37
- package/dist/canvas/tools/panTool.d.ts +0 -5
- package/dist/canvas/tools/panTool.js +0 -25
- package/dist/canvas/tools/penTool.d.ts +0 -13
- package/dist/canvas/tools/penTool.js +0 -68
- package/dist/canvas/tools/selectTool.d.ts +0 -2
- package/dist/canvas/tools/selectTool.js +0 -182
- package/dist/canvas/useAnnotationCanvasState.d.ts +0 -54
- package/dist/canvas/useAnnotationCanvasState.js +0 -210
- package/dist/canvas/viewport.d.ts +0 -16
- package/dist/canvas/viewport.js +0 -54
- package/dist/data/AnnotationDataContext.d.ts +0 -8
- package/dist/data/AnnotationDataContext.js +0 -11
- package/dist/data/AnnotationDataProvider.d.ts +0 -65
- package/dist/data/AnnotationDataProvider.js +0 -4
- package/dist/data/InMemoryAnnotationProvider.d.ts +0 -30
- package/dist/data/InMemoryAnnotationProvider.js +0 -197
- package/dist/data/canvasPersistence.d.ts +0 -3
- package/dist/data/canvasPersistence.js +0 -26
- package/dist/data/hooks/useAnnotationCanvasDoc.d.ts +0 -33
- package/dist/data/hooks/useAnnotationCanvasDoc.js +0 -314
- package/dist/data/hooks/useAnnotationDoc.d.ts +0 -7
- package/dist/data/hooks/useAnnotationDoc.js +0 -33
- package/dist/data/hooks/useAnnotationList.d.ts +0 -7
- package/dist/data/hooks/useAnnotationList.js +0 -26
- package/dist/data/hooks/useAnnotationMutations.d.ts +0 -9
- package/dist/data/hooks/useAnnotationMutations.js +0 -11
- package/dist/hooks/useParseMeasurement.d.ts +0 -4
- package/dist/hooks/useParseMeasurement.js +0 -14
- package/dist/utils/evaluateFormula.d.ts +0 -20
- package/dist/utils/evaluateFormula.js +0 -31
- package/dist/utils/indexLabels.d.ts +0 -3
- package/dist/utils/indexLabels.js +0 -40
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AnnotationFile, ImageBlob, JobGroupScope, Patch, UploadedImageRef } from '../AnnotationDataProvider.js';
|
|
2
|
-
export interface AnnotationMutations {
|
|
3
|
-
create(seed: Partial<AnnotationFile>): Promise<string>;
|
|
4
|
-
update(fileId: string, patch: Patch<AnnotationFile>): Promise<void>;
|
|
5
|
-
remove(fileId: string): Promise<void>;
|
|
6
|
-
uploadImage(fileId: string, role: 'background' | 'thumbnail', blob: ImageBlob): Promise<UploadedImageRef>;
|
|
7
|
-
deleteImage(fileId: string, storagePath: string): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export declare const useAnnotationMutations: (scope: JobGroupScope) => AnnotationMutations;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react';
|
|
2
|
-
import { useAnnotationData } from '../AnnotationDataContext.js';
|
|
3
|
-
export const useAnnotationMutations = (scope) => {
|
|
4
|
-
const provider = useAnnotationData();
|
|
5
|
-
const create = useCallback((seed) => provider.create(scope, seed), [provider, scope.orgId, scope.projectId, scope.jobId, scope.groupId]);
|
|
6
|
-
const update = useCallback((fileId, patch) => provider.update(scope, fileId, patch), [provider, scope.orgId, scope.projectId, scope.jobId, scope.groupId]);
|
|
7
|
-
const remove = useCallback((fileId) => provider.delete(scope, fileId), [provider, scope.orgId, scope.projectId, scope.jobId, scope.groupId]);
|
|
8
|
-
const uploadImage = useCallback((fileId, role, blob) => provider.uploadImage(scope, fileId, role, blob), [provider, scope.orgId, scope.projectId, scope.jobId, scope.groupId]);
|
|
9
|
-
const deleteImage = useCallback((fileId, storagePath) => provider.deleteImage(scope, fileId, storagePath), [provider, scope.orgId, scope.projectId, scope.jobId, scope.groupId]);
|
|
10
|
-
return useMemo(() => ({ create, update, remove, uploadImage, deleteImage }), [create, update, remove, uploadImage, deleteImage]);
|
|
11
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { parseMeasurement } from '../utils/parseMeasurement.js';
|
|
3
|
-
export const useParseMeasurement = () => {
|
|
4
|
-
const [error, setError] = useState(null);
|
|
5
|
-
const parseMeasurementInput = (input, defaultUnit = 'mm') => {
|
|
6
|
-
setError(null);
|
|
7
|
-
const result = parseMeasurement(input, defaultUnit);
|
|
8
|
-
if (result === null) {
|
|
9
|
-
setError('Invalid measurement. Please provide a valid number and unit.');
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
return { parseMeasurementInput, error };
|
|
14
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type MeasurementMap = Map<string, {
|
|
2
|
-
id: string;
|
|
3
|
-
value: number;
|
|
4
|
-
}[]>;
|
|
5
|
-
interface FormulaEvaluationOptions {
|
|
6
|
-
expression: string;
|
|
7
|
-
mappings: Record<string, string>;
|
|
8
|
-
group: {
|
|
9
|
-
id: string;
|
|
10
|
-
columns: Map<string, any>;
|
|
11
|
-
};
|
|
12
|
-
columns: {
|
|
13
|
-
id: string;
|
|
14
|
-
type: string;
|
|
15
|
-
}[];
|
|
16
|
-
measurementMap: MeasurementMap;
|
|
17
|
-
defaultUnit?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function evaluateFormula({ expression, mappings, group, columns, measurementMap, defaultUnit, }: FormulaEvaluationOptions): number | string;
|
|
20
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { create, all } from 'mathjs';
|
|
2
|
-
const math = create(all);
|
|
3
|
-
export function evaluateFormula({ expression, mappings, group, columns, measurementMap, defaultUnit = 'um', }) {
|
|
4
|
-
const scope = {};
|
|
5
|
-
for (const [variable, columnId] of Object.entries(mappings)) {
|
|
6
|
-
const rawValue = group.columns.get(columnId);
|
|
7
|
-
const columnDef = columns.find((c) => c.id === columnId);
|
|
8
|
-
if (columnDef?.type === 'Measurement') {
|
|
9
|
-
const groupMeasurements = measurementMap.get(group.id) || [];
|
|
10
|
-
const measurement = groupMeasurements.find((m) => m.id === rawValue);
|
|
11
|
-
if (measurement?.value !== undefined) {
|
|
12
|
-
scope[variable] = math.unit(measurement.value, defaultUnit);
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const parsedValue = typeof rawValue === 'number' ? rawValue : parseFloat(rawValue || '');
|
|
17
|
-
scope[variable] = isNaN(parsedValue) ? 0 : parsedValue;
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const compiled = math.compile(expression);
|
|
21
|
-
const result = compiled.evaluate(scope);
|
|
22
|
-
if (math.typeOf(result) === 'Unit') {
|
|
23
|
-
return result.toNumber(defaultUnit);
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
console.error(`Formula evaluation failed:`, err);
|
|
29
|
-
return 'Error';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const numberToLetterIndex: (index: number) => string;
|
|
2
|
-
export declare const formGroupInputLabel: (columnIndex: number, groupIndex: number) => string;
|
|
3
|
-
export declare const listGroupMeasurementLabel: (deviceMeasurementNumber: number | null | undefined, groupIndex: number) => string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Canonical measurement / input index labels, shared by rock-desktop and
|
|
2
|
-
// rock-pro-app so every surface (tables, forms, PDF tile overlays, mobile
|
|
3
|
-
// lists) renders the same identifier for the same datum.
|
|
4
|
-
//
|
|
5
|
-
// Two schemes exist:
|
|
6
|
-
//
|
|
7
|
-
// - FORM groups: inputs are identified positionally — the column's index in
|
|
8
|
-
// the section's tableConfig as a letter, plus the group's 1-based number.
|
|
9
|
-
// First column in the second group → "A2"; fifth column in the third
|
|
10
|
-
// group → "E3".
|
|
11
|
-
//
|
|
12
|
-
// - LIST groups: entries are always measurements, identified by their stable
|
|
13
|
-
// deviceMeasurementNumber (capture sequence) as the letter, plus the same
|
|
14
|
-
// group number. deviceMeasurementNumber 4 in the second group → "E2".
|
|
15
|
-
// Legacy measurements without a deviceMeasurementNumber fall back to the
|
|
16
|
-
// bare group number ("2") — positional letters would shift as the list
|
|
17
|
-
// re-sorts, so no letter is shown.
|
|
18
|
-
// 0-based index → spreadsheet-style letters: 0 → "A", 25 → "Z", 26 → "AA".
|
|
19
|
-
// Negative / non-finite input yields ''.
|
|
20
|
-
export const numberToLetterIndex = (index) => {
|
|
21
|
-
if (!Number.isFinite(index) || index < 0)
|
|
22
|
-
return '';
|
|
23
|
-
let n = Math.floor(index) + 1;
|
|
24
|
-
let result = '';
|
|
25
|
-
while (n > 0) {
|
|
26
|
-
n--;
|
|
27
|
-
result = String.fromCharCode((n % 26) + 65) + result;
|
|
28
|
-
n = Math.floor(n / 26);
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
// Label for a FORM-group input: column position (0-based) + group number.
|
|
33
|
-
// formGroupInputLabel(0, 1) → "A2"
|
|
34
|
-
export const formGroupInputLabel = (columnIndex, groupIndex) => `${numberToLetterIndex(columnIndex)}${groupIndex + 1}`;
|
|
35
|
-
// Label for a LIST-group measurement: deviceMeasurementNumber (0-based) +
|
|
36
|
-
// group number, or the bare group number when the measurement has no device
|
|
37
|
-
// number. listGroupMeasurementLabel(4, 1) → "E2"; (null, 1) → "2".
|
|
38
|
-
export const listGroupMeasurementLabel = (deviceMeasurementNumber, groupIndex) => deviceMeasurementNumber != null && deviceMeasurementNumber >= 0
|
|
39
|
-
? `${numberToLetterIndex(deviceMeasurementNumber)}${groupIndex + 1}`
|
|
40
|
-
: `${groupIndex + 1}`;
|