sevago-library 1.7.7 → 1.7.9
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/CHANGELOG.md +12 -0
- package/README.md +2 -0
- package/dist/index.cjs.js +84 -84
- package/dist/index.esm.js +13023 -12240
- package/dist/src/components/elements/floating-action-hub/floating-action-hub.element.stories.d.ts +1 -0
- package/dist/src/components/elements/floating-action-hub/floating-action-hub.interface.d.ts +4 -0
- package/dist/src/components/elements/floating-tools/elements/floating-scale-history.element.d.ts +8 -0
- package/dist/src/components/elements/floating-tools/floating-scale-panel.element.d.ts +2 -0
- package/dist/src/components/elements/floating-tools/floating-scale.constant.d.ts +58 -0
- package/dist/src/components/elements/floating-tools/floating-scale.enum.d.ts +16 -0
- package/dist/src/components/elements/floating-tools/floating-scale.interface.d.ts +58 -0
- package/dist/src/components/elements/floating-tools/floating-scale.util.d.ts +3 -0
- package/dist/src/components/elements/floating-tools/floating-tools.argtypes.d.ts +3 -0
- package/dist/src/components/elements/floating-tools/floating-tools.element.d.ts +2 -0
- package/dist/src/components/elements/floating-tools/floating-tools.element.stories.d.ts +7 -0
- package/dist/src/components/elements/floating-tools/index.d.ts +1 -0
- package/dist/src/components/elements/floating-tools/use-floating-scale.hook.d.ts +2 -0
- package/dist/src/components/elements/text-field/text-field-weight-number.element.d.ts +4 -0
- package/dist/src/components/elements/text-field/text-field-weight-number.element.stories.d.ts +1 -1
- package/dist/src/components/elements/text-field/text-field.element.stories.d.ts +0 -11
- package/dist/src/components/elements/text-field/use-scan-replace-input.constant.d.ts +6 -0
- package/dist/src/components/elements/text-field/use-scan-replace-input.d.ts +2 -20
- package/dist/src/components/elements/text-field/use-scan-replace-input.interface.d.ts +27 -0
- package/dist/src/components/web-serial-scale/web-serial-scale.enum.d.ts +5 -0
- package/dist/src/components/web-serial-scale/web-serial-scale.interface.d.ts +25 -1
- package/package.json +1 -1
- package/dist/src/components/web-serial-scale/web-serial-scale.argtypes.d.ts +0 -3
- package/dist/src/components/web-serial-scale/web-serial-scale.stories.d.ts +0 -9
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
export interface FloatingActionHubItem {
|
|
4
|
+
alwaysVisible?: boolean;
|
|
5
|
+
badgeContent?: ReactNode;
|
|
6
|
+
badgeLabel?: string;
|
|
3
7
|
backgroundColor?: string;
|
|
4
8
|
color?: string;
|
|
5
9
|
disabled?: boolean;
|
package/dist/src/components/elements/floating-tools/elements/floating-scale-history.element.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FLOATING_SCALE_LABELS } from '../floating-scale.constant';
|
|
2
|
+
import { UseFloatingScaleResult } from '../floating-scale.interface';
|
|
3
|
+
interface FloatingScaleHistoryProps extends Pick<UseFloatingScaleResult, 'drops' | 'total' | 'applying' | 'removeDrop'> {
|
|
4
|
+
unit: string;
|
|
5
|
+
labels: typeof FLOATING_SCALE_LABELS;
|
|
6
|
+
}
|
|
7
|
+
export declare const FloatingScaleHistory: ({ drops, total, unit, applying, removeDrop, labels, }: FloatingScaleHistoryProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { FloatingScaleConfig } from './floating-scale.interface';
|
|
2
|
+
import { Theme } from '@mui/material';
|
|
3
|
+
export declare const FLOATING_SCALE_LABELS: {
|
|
4
|
+
title: string;
|
|
5
|
+
single: string;
|
|
6
|
+
accumulated: string;
|
|
7
|
+
connected: string;
|
|
8
|
+
disconnected: string;
|
|
9
|
+
connecting: string;
|
|
10
|
+
disconnecting: string;
|
|
11
|
+
connect: string;
|
|
12
|
+
disconnect: string;
|
|
13
|
+
removeLoad: string;
|
|
14
|
+
liveWeight: string;
|
|
15
|
+
target: string;
|
|
16
|
+
noTarget: string;
|
|
17
|
+
capture: string;
|
|
18
|
+
apply: string;
|
|
19
|
+
reset: string;
|
|
20
|
+
empty: string;
|
|
21
|
+
total: string;
|
|
22
|
+
drop: string;
|
|
23
|
+
dropCount: string;
|
|
24
|
+
maximum: string;
|
|
25
|
+
minimize: string;
|
|
26
|
+
expand: string;
|
|
27
|
+
close: string;
|
|
28
|
+
remove: string;
|
|
29
|
+
missingProvider: string;
|
|
30
|
+
unsupported: string;
|
|
31
|
+
applied: string;
|
|
32
|
+
applyError: string;
|
|
33
|
+
waiting: string;
|
|
34
|
+
moving: string;
|
|
35
|
+
stable: string;
|
|
36
|
+
stale: string;
|
|
37
|
+
overload: string;
|
|
38
|
+
invalid: string;
|
|
39
|
+
negative: string;
|
|
40
|
+
configError: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const FLOATING_SCALE_DEFAULTS: FloatingScaleConfig;
|
|
43
|
+
export declare const FLOATING_SCALE_PANEL_SX: {
|
|
44
|
+
readonly position: "fixed";
|
|
45
|
+
readonly right: "16px";
|
|
46
|
+
readonly bottom: 88;
|
|
47
|
+
readonly width: 360;
|
|
48
|
+
readonly maxWidth: "calc(100vw - 2 * 16px)";
|
|
49
|
+
readonly maxHeight: "calc(100dvh - 112px)";
|
|
50
|
+
readonly overflow: "hidden";
|
|
51
|
+
readonly zIndex: (theme: Theme) => number;
|
|
52
|
+
readonly padding: "16px";
|
|
53
|
+
readonly gap: "8px";
|
|
54
|
+
readonly backgroundColor: string;
|
|
55
|
+
readonly border: `1px solid ${string}`;
|
|
56
|
+
readonly borderRadius: "12px";
|
|
57
|
+
readonly boxShadow: "0 4px 20px rgba(0, 0, 0, 0.12)";
|
|
58
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum FloatingScaleReadingStatus {
|
|
2
|
+
Waiting = "waiting",
|
|
3
|
+
Moving = "moving",
|
|
4
|
+
Stable = "stable",
|
|
5
|
+
Stale = "stale",
|
|
6
|
+
Overload = "overload",
|
|
7
|
+
Invalid = "invalid",
|
|
8
|
+
Negative = "negative",
|
|
9
|
+
ConfigError = "configError"
|
|
10
|
+
}
|
|
11
|
+
export declare enum FloatingScaleFeedback {
|
|
12
|
+
Applied = "applied",
|
|
13
|
+
ApplyError = "applyError"
|
|
14
|
+
}
|
|
15
|
+
export declare const FloatingScaleReadingStatusTitle: Record<FloatingScaleReadingStatus, string>;
|
|
16
|
+
export declare const FloatingScaleFeedbackTitle: Record<FloatingScaleFeedback, string>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { WebSerialScaleMode, WebSerialScaleReading, WebSerialScaleSharedContextValue, WebSerialScaleWeighingAudit } from '../../web-serial-scale';
|
|
2
|
+
import { FloatingScaleFeedback, FloatingScaleReadingStatus } from './floating-scale.enum';
|
|
3
|
+
export interface FloatingScaleConfig {
|
|
4
|
+
unit: string;
|
|
5
|
+
maxWeight: number;
|
|
6
|
+
stableDurationMs: number;
|
|
7
|
+
stableTolerance: number;
|
|
8
|
+
staleAfterMs: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FloatingScaleOptions {
|
|
11
|
+
/** Readings and all thresholds must use this same unit. No unit conversion is performed. */
|
|
12
|
+
unit?: string;
|
|
13
|
+
maxWeight?: number;
|
|
14
|
+
stableDurationMs?: number;
|
|
15
|
+
stableTolerance?: number;
|
|
16
|
+
staleAfterMs?: number;
|
|
17
|
+
deviceId?: string;
|
|
18
|
+
deviceLabel?: string;
|
|
19
|
+
operatorId?: string;
|
|
20
|
+
labels?: Partial<typeof import('./floating-scale.constant').FLOATING_SCALE_LABELS>;
|
|
21
|
+
onApply?: (audit: WebSerialScaleWeighingAudit) => void | Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export interface FloatingScaleDrop {
|
|
24
|
+
id: number;
|
|
25
|
+
units: bigint;
|
|
26
|
+
reading: WebSerialScaleReading;
|
|
27
|
+
}
|
|
28
|
+
export interface FloatingScaleSample {
|
|
29
|
+
value: number;
|
|
30
|
+
time: number;
|
|
31
|
+
}
|
|
32
|
+
export interface UseFloatingScaleResult {
|
|
33
|
+
scale?: WebSerialScaleSharedContextValue;
|
|
34
|
+
config: FloatingScaleConfig;
|
|
35
|
+
mode: WebSerialScaleMode;
|
|
36
|
+
setMode: (mode: WebSerialScaleMode) => void;
|
|
37
|
+
drops: FloatingScaleDrop[];
|
|
38
|
+
total: number;
|
|
39
|
+
displayWeight: string;
|
|
40
|
+
readingStatus: FloatingScaleReadingStatus;
|
|
41
|
+
locked: boolean;
|
|
42
|
+
applying: boolean;
|
|
43
|
+
feedback?: FloatingScaleFeedback;
|
|
44
|
+
canCapture: boolean;
|
|
45
|
+
canApply: boolean;
|
|
46
|
+
capture: () => void;
|
|
47
|
+
apply: () => Promise<void>;
|
|
48
|
+
removeDrop: (id: number) => void;
|
|
49
|
+
reset: () => void;
|
|
50
|
+
}
|
|
51
|
+
export interface FloatingScalePanelProps {
|
|
52
|
+
state: UseFloatingScaleResult;
|
|
53
|
+
open: boolean;
|
|
54
|
+
onClose: () => void;
|
|
55
|
+
onDisconnect: () => void;
|
|
56
|
+
onConnect: () => void;
|
|
57
|
+
options?: FloatingScaleOptions;
|
|
58
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { FloatingActionHubItem } from '../floating-action-hub';
|
|
4
|
+
import { FloatingScaleOptions } from './floating-scale.interface';
|
|
4
5
|
export interface FloatingToolsElementProps {
|
|
5
6
|
axiosProductManagement?: AxiosInstance;
|
|
6
7
|
enableFinishGoodGallery?: boolean;
|
|
7
8
|
enableScale?: boolean;
|
|
8
9
|
items?: FloatingActionHubItem[];
|
|
9
10
|
scaleAutoConnectAuthorized?: boolean;
|
|
11
|
+
scaleOptions?: FloatingScaleOptions;
|
|
10
12
|
}
|
|
11
13
|
export declare const FloatingToolsElement: FC<FloatingToolsElementProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { FloatingToolsElement } from './floating-tools.element';
|
|
3
|
+
declare const meta: Meta<typeof FloatingToolsElement>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof FloatingToolsElement>;
|
|
6
|
+
export declare const RealScale: Story;
|
|
7
|
+
export declare const RealScaleInDialog: Story;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { WebSerialScaleReading, WebSerialScaleWeighingAudit } from '../../web-serial-scale';
|
|
2
3
|
import { TextFieldNumberElementProps } from './text-field-number/text-field-number.element';
|
|
3
4
|
export interface TextFieldWeightNumberElementProps extends TextFieldNumberElementProps {
|
|
4
5
|
enabled?: boolean;
|
|
5
6
|
showWeightAdornment?: boolean;
|
|
6
7
|
weightAdornmentLabel?: React.ReactNode;
|
|
7
8
|
onEnterConfirm?: (weight: number) => void | Promise<void>;
|
|
9
|
+
onWeighingApply?: (reading: WebSerialScaleReading) => void | Promise<void>;
|
|
10
|
+
weighingAudit?: WebSerialScaleWeighingAudit;
|
|
11
|
+
getWeighingAuditTooltip?: (audit: WebSerialScaleWeighingAudit) => React.ReactNode;
|
|
8
12
|
}
|
|
9
13
|
export declare const TextFieldWeightNumberElement: React.FC<TextFieldWeightNumberElementProps>;
|
package/dist/src/components/elements/text-field/text-field-weight-number.element.stories.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const meta: Meta<typeof TextFieldWeightNumberElement>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof TextFieldWeightNumberElement>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const WithFloatingTools: Story;
|
|
8
8
|
export declare const ScaleDisabled: Story;
|
|
9
9
|
export declare const Disabled: Story;
|
|
10
10
|
export declare const ErrorState: Story;
|
|
@@ -3,15 +3,4 @@ import { TextFieldElement } from './text-field.element';
|
|
|
3
3
|
declare const meta: Meta<typeof TextFieldElement>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof TextFieldElement>;
|
|
6
|
-
export declare const Default: Story;
|
|
7
|
-
export declare const WithoutLabel: Story;
|
|
8
|
-
export declare const Required: Story;
|
|
9
|
-
export declare const ErrorState: Story;
|
|
10
|
-
export declare const Multiline: Story;
|
|
11
6
|
export declare const ScanReplace: Story;
|
|
12
|
-
export declare const ScanVietnameseIme: Story;
|
|
13
|
-
export declare const ScanVietnameseLayout: Story;
|
|
14
|
-
export declare const ScanVietnameseImeRewrite: Story;
|
|
15
|
-
export declare const ScanAlwaysEnglish: Story;
|
|
16
|
-
export declare const VietnameseTyping: Story;
|
|
17
|
-
export declare const ScanDisabledVietnamese: Story;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DEFAULT_SCAN_THRESHOLD_MS = 80;
|
|
2
|
+
export declare const DEFAULT_SCAN_MIN_LENGTH = 4;
|
|
3
|
+
export declare const MODIFIER_KEYS: Set<string>;
|
|
4
|
+
export declare const SCANNER_REVERSE_MAP: Record<string, string>;
|
|
5
|
+
export declare const SHIFTED_DIGITS: Record<string, string>;
|
|
6
|
+
export declare const PUNCTUATION: Record<string, string>;
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
type Options = {
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
onReplace: (value: string) => void;
|
|
6
|
-
thresholdMs?: number;
|
|
7
|
-
minLength?: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const useScanReplaceInput: ({ enabled, onReplace, thresholdMs, minLength }: Options) => {
|
|
10
|
-
inputRef: React.RefObject<ScanInputNode | null>;
|
|
11
|
-
resetScan: () => void;
|
|
12
|
-
selectInput: () => void;
|
|
13
|
-
handleChange: React.ChangeEventHandler<ScanInputNode>;
|
|
14
|
-
handleInputCapture: React.FormEventHandler<HTMLElement>;
|
|
15
|
-
handleCompositionEnd: React.CompositionEventHandler<HTMLElement>;
|
|
16
|
-
handlePaste: React.ClipboardEventHandler<HTMLElement>;
|
|
17
|
-
handleKeyDownCapture: React.KeyboardEventHandler<HTMLElement>;
|
|
18
|
-
handleKeyUpCapture: React.KeyboardEventHandler<HTMLElement>;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
1
|
+
import { UseScanReplaceInputOptions, UseScanReplaceInputResult } from './use-scan-replace-input.interface';
|
|
2
|
+
export declare const useScanReplaceInput: ({ enabled, onReplace, thresholdMs, minLength, }: UseScanReplaceInputOptions) => UseScanReplaceInputResult;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
export type ScanInputNode = HTMLInputElement | HTMLTextAreaElement;
|
|
3
|
+
export interface ScanCandidate {
|
|
4
|
+
value: string;
|
|
5
|
+
time: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ScanState extends ScanCandidate {
|
|
8
|
+
active: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UseScanReplaceInputOptions {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
onReplace: (value: string) => void;
|
|
13
|
+
thresholdMs?: number;
|
|
14
|
+
minLength?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface UseScanReplaceInputResult {
|
|
17
|
+
inputRef: React.RefObject<ScanInputNode | null>;
|
|
18
|
+
resetScan: () => void;
|
|
19
|
+
selectInput: () => void;
|
|
20
|
+
handleBeforeInput: React.FormEventHandler<HTMLElement>;
|
|
21
|
+
handleChange: React.ChangeEventHandler<ScanInputNode>;
|
|
22
|
+
handleInputCapture: React.FormEventHandler<HTMLElement>;
|
|
23
|
+
handleCompositionEnd: React.CompositionEventHandler<HTMLElement>;
|
|
24
|
+
handlePaste: React.ClipboardEventHandler<HTMLElement>;
|
|
25
|
+
handleKeyDownCapture: React.KeyboardEventHandler<HTMLElement>;
|
|
26
|
+
handleKeyUpCapture: React.KeyboardEventHandler<HTMLElement>;
|
|
27
|
+
}
|
|
@@ -5,6 +5,11 @@ export declare enum WebSerialScaleStatus {
|
|
|
5
5
|
Disconnecting = "disconnecting",
|
|
6
6
|
Error = "error"
|
|
7
7
|
}
|
|
8
|
+
export declare enum WebSerialScaleMode {
|
|
9
|
+
Single = "SINGLE",
|
|
10
|
+
Accumulated = "ACCUMULATED"
|
|
11
|
+
}
|
|
12
|
+
export declare const WebSerialScaleModeTitle: Record<WebSerialScaleMode, string>;
|
|
8
13
|
export declare enum ParityWebSerialScaleSerial {
|
|
9
14
|
None = "none",
|
|
10
15
|
Even = "even",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParityWebSerialScaleSerial, FlowControlWebSerialScaleEvent, WebSerialScaleStatus } from './web-serial-scale.enum';
|
|
1
|
+
import { ParityWebSerialScaleSerial, FlowControlWebSerialScaleEvent, WebSerialScaleStatus, WebSerialScaleMode } from './web-serial-scale.enum';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
export interface WebSerialScaleReading {
|
|
4
4
|
rawLine?: string;
|
|
@@ -6,6 +6,24 @@ export interface WebSerialScaleReading {
|
|
|
6
6
|
numericValue?: number;
|
|
7
7
|
unit?: string;
|
|
8
8
|
receivedAt?: number;
|
|
9
|
+
weighingAudit?: WebSerialScaleWeighingAudit;
|
|
10
|
+
overload?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface WebSerialScaleWeighingDrop {
|
|
13
|
+
step: number;
|
|
14
|
+
weight: number;
|
|
15
|
+
timestamp: string;
|
|
16
|
+
raw_line?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WebSerialScaleWeighingAudit {
|
|
19
|
+
mode: WebSerialScaleMode;
|
|
20
|
+
scale_device_id?: string;
|
|
21
|
+
operator_id?: string;
|
|
22
|
+
target_field: string;
|
|
23
|
+
unit: string;
|
|
24
|
+
total_weight: number;
|
|
25
|
+
drops_count: number;
|
|
26
|
+
drops: WebSerialScaleWeighingDrop[];
|
|
9
27
|
}
|
|
10
28
|
export interface WebSerialScaleSerialOptions {
|
|
11
29
|
baudRate: number;
|
|
@@ -33,10 +51,12 @@ export interface WebSerialScaleConnectOptions {
|
|
|
33
51
|
}
|
|
34
52
|
export interface WebSerialScaleTarget {
|
|
35
53
|
name: string;
|
|
54
|
+
fieldName?: string;
|
|
36
55
|
label?: string;
|
|
37
56
|
description?: string;
|
|
38
57
|
disabled?: boolean;
|
|
39
58
|
onApply?: (reading: WebSerialScaleReading) => void | Promise<void>;
|
|
59
|
+
onConfirm?: (reading: WebSerialScaleReading) => void | Promise<void>;
|
|
40
60
|
}
|
|
41
61
|
export interface UseWebSerialScaleOptions {
|
|
42
62
|
serialOptions: WebSerialScaleSerialOptions;
|
|
@@ -72,6 +92,10 @@ export interface WebSerialScaleTargetRegistration {
|
|
|
72
92
|
}
|
|
73
93
|
export interface WebSerialScaleSharedContextValue extends UseWebSerialScaleResult {
|
|
74
94
|
registerTargets: (registration: WebSerialScaleTargetRegistration) => () => void;
|
|
95
|
+
activeTarget?: Omit<WebSerialScaleTarget, 'onApply' | 'onConfirm'>;
|
|
96
|
+
isManualApply: boolean;
|
|
97
|
+
registerManualController: () => () => void;
|
|
98
|
+
applyToActiveTarget: (reading: WebSerialScaleReading) => Promise<boolean>;
|
|
75
99
|
}
|
|
76
100
|
export interface WebSerialScaleProviderElementProps extends Omit<UseWebSerialScaleOptions, 'serialOptions' | 'onReading'> {
|
|
77
101
|
children: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { WebSerialScaleControllerElement } from './web-serial-scale-controller.element';
|
|
3
|
-
declare const meta: Meta<typeof WebSerialScaleControllerElement>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof WebSerialScaleControllerElement>;
|
|
6
|
-
export declare const Default: Story;
|
|
7
|
-
export declare const FieldFocusFlow: Story;
|
|
8
|
-
export declare const WithUsbRequestFilter: Story;
|
|
9
|
-
export declare const SharedScaleProviderFlow: Story;
|