lucius-barcode-designer 0.1.2
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/barcode-designer.js +6419 -0
- package/dist/barcode-designer.umd.cjs +8 -0
- package/dist/lucius-barcode-designer.css +2 -0
- package/dist/src/BarcodeDesigner.d.ts +11 -0
- package/dist/src/components/BarcodePreviewCanvas.d.ts +5 -0
- package/dist/src/components/BlockPropertiesPanel.d.ts +3 -0
- package/dist/src/components/CustomSelect.d.ts +15 -0
- package/dist/src/components/FontSettingsPanel.d.ts +8 -0
- package/dist/src/components/TemplateManager.d.ts +3 -0
- package/dist/src/components/XmlJsonPreview.d.ts +3 -0
- package/dist/src/context/TemplateServiceContext.d.ts +20 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/models/BarcodeBlockDataEnum.d.ts +40 -0
- package/dist/src/models/BarcodeBlockSetting.d.ts +16 -0
- package/dist/src/models/BarcodeMultiZoneSetting.d.ts +27 -0
- package/dist/src/models/FontSetting.d.ts +16 -0
- package/dist/src/models/TemplateConfig.d.ts +18 -0
- package/dist/src/services/BarcodeDrawService.d.ts +4 -0
- package/dist/src/services/Code128Encoder.d.ts +8 -0
- package/dist/src/services/XmlSerializer.d.ts +9 -0
- package/dist/src/services/api.d.ts +2 -0
- package/dist/src/services/templateService.d.ts +47 -0
- package/dist/src/store/useBarcodeStore.d.ts +58 -0
- package/package.json +44 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code128 Barcode Encoder
|
|
3
|
+
* TypeScript port of BarcodePrint/Code128.cs
|
|
4
|
+
* Supports DYNAMIC, B, and C encoding modes.
|
|
5
|
+
*/
|
|
6
|
+
type Code128Type = 'DYNAMIC' | 'B' | 'C';
|
|
7
|
+
export declare function encodeCode128(rawData: string, type?: Code128Type): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BarcodeMultiZoneSetting } from '../models/BarcodeMultiZoneSetting';
|
|
2
|
+
/** Serialize BarcodeMultiZoneSetting to XML (C# XmlSerializer compatible) */
|
|
3
|
+
export declare function serializeToXml(settings: BarcodeMultiZoneSetting): string;
|
|
4
|
+
/** Deserialize XML to BarcodeMultiZoneSetting */
|
|
5
|
+
export declare function deserializeFromXml(xml: string): BarcodeMultiZoneSetting;
|
|
6
|
+
/** Convert settings to formatted JSON */
|
|
7
|
+
export declare function serializeToJson(settings: BarcodeMultiZoneSetting): string;
|
|
8
|
+
/** Parse JSON back to settings */
|
|
9
|
+
export declare function deserializeFromJson(json: string): BarcodeMultiZoneSetting;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { BarcodeMultiZoneSetting } from '../models/BarcodeMultiZoneSetting';
|
|
3
|
+
export interface PrinterInfo {
|
|
4
|
+
id: string;
|
|
5
|
+
code: string;
|
|
6
|
+
name: string | null;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
updatedAt?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare enum PrintTemplateType {
|
|
11
|
+
Tube = 0,
|
|
12
|
+
Specimen = 1
|
|
13
|
+
}
|
|
14
|
+
export interface BarcodeAgentTemplate {
|
|
15
|
+
id: string;
|
|
16
|
+
settings: BarcodeMultiZoneSetting;
|
|
17
|
+
printerInfoId: string | null;
|
|
18
|
+
printerInfo?: PrinterInfo | null;
|
|
19
|
+
type: PrintTemplateType;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface TemplateQueryParams {
|
|
24
|
+
type?: PrintTemplateType;
|
|
25
|
+
printerInfoId?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface UpsertBarcodeAgentTemplateRequest {
|
|
28
|
+
settings: BarcodeMultiZoneSetting;
|
|
29
|
+
printerInfoId: string;
|
|
30
|
+
type: PrintTemplateType;
|
|
31
|
+
}
|
|
32
|
+
export declare function createTemplateService(api: AxiosInstance): {
|
|
33
|
+
getPrinters: (searchText?: string) => Promise<PrinterInfo[]>;
|
|
34
|
+
createPrinter: (printer: {
|
|
35
|
+
code: string;
|
|
36
|
+
name: string;
|
|
37
|
+
}) => Promise<string | undefined>;
|
|
38
|
+
updatePrinter: (id: string, printer: {
|
|
39
|
+
code: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}) => Promise<string | undefined>;
|
|
42
|
+
deletePrinter: (id: string) => Promise<string | undefined>;
|
|
43
|
+
getTemplates: (params?: TemplateQueryParams) => Promise<BarcodeAgentTemplate[]>;
|
|
44
|
+
createTemplate: (request: UpsertBarcodeAgentTemplateRequest) => Promise<string | undefined>;
|
|
45
|
+
updateTemplate: (id: string, request: UpsertBarcodeAgentTemplateRequest) => Promise<string | undefined>;
|
|
46
|
+
deleteTemplate: (id: string) => Promise<string | undefined>;
|
|
47
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BarcodeMultiZoneSetting } from '../models/BarcodeMultiZoneSetting';
|
|
2
|
+
import { BarcodeBlockSetting } from '../models/BarcodeBlockSetting';
|
|
3
|
+
import { StoredTemplate } from '../models/TemplateConfig';
|
|
4
|
+
import { PrintTemplateType } from '../services/templateService';
|
|
5
|
+
interface BarcodeStore {
|
|
6
|
+
settings: BarcodeMultiZoneSetting;
|
|
7
|
+
templates: StoredTemplate[];
|
|
8
|
+
selectedBlockIndex: number;
|
|
9
|
+
showBorder: boolean;
|
|
10
|
+
showXmlPreview: boolean;
|
|
11
|
+
activeContext: {
|
|
12
|
+
printerName: string;
|
|
13
|
+
templateId: string;
|
|
14
|
+
} | null;
|
|
15
|
+
printApiBaseUrl: string | null;
|
|
16
|
+
past: BarcodeMultiZoneSetting[];
|
|
17
|
+
future: BarcodeMultiZoneSetting[];
|
|
18
|
+
undo: () => void;
|
|
19
|
+
redo: () => void;
|
|
20
|
+
toast: {
|
|
21
|
+
type: 'success' | 'error';
|
|
22
|
+
message: string;
|
|
23
|
+
} | null;
|
|
24
|
+
showToast: (type: 'success' | 'error', message: string) => void;
|
|
25
|
+
selectedTemplateId: string | null;
|
|
26
|
+
selectedPrinterId: string | null;
|
|
27
|
+
selectedTemplateType: PrintTemplateType | null;
|
|
28
|
+
setSelectedTemplate: (id: string | null, printerId: string | null, type: PrintTemplateType | null) => void;
|
|
29
|
+
canvasOffset: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
};
|
|
33
|
+
setCanvasOffset: (offset: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}) => void;
|
|
37
|
+
resetCanvasOffset: () => void;
|
|
38
|
+
updateSettings: (partial: Partial<BarcodeMultiZoneSetting>) => void;
|
|
39
|
+
setSettings: (settings: BarcodeMultiZoneSetting) => void;
|
|
40
|
+
addBlock: (block: BarcodeBlockSetting) => void;
|
|
41
|
+
editBlock: (index: number, block: BarcodeBlockSetting) => void;
|
|
42
|
+
removeBlock: (index: number) => void;
|
|
43
|
+
selectBlock: (index: number) => void;
|
|
44
|
+
loadTemplates: () => void;
|
|
45
|
+
saveTemplate: (name: string) => void;
|
|
46
|
+
loadTemplate: (name: string) => void;
|
|
47
|
+
deleteTemplate: (name: string) => void;
|
|
48
|
+
renameTemplate: (oldName: string, newName: string) => void;
|
|
49
|
+
setShowBorder: (show: boolean) => void;
|
|
50
|
+
setShowXmlPreview: (show: boolean) => void;
|
|
51
|
+
setActiveContext: (ctx: {
|
|
52
|
+
printerName: string;
|
|
53
|
+
templateId: string;
|
|
54
|
+
} | null) => void;
|
|
55
|
+
setPrintApiBaseUrl: (url: string | null) => void;
|
|
56
|
+
}
|
|
57
|
+
export declare const useBarcodeStore: import('zustand').UseBoundStore<import('zustand').StoreApi<BarcodeStore>>;
|
|
58
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lucius-barcode-designer",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/barcode-designer.umd.cjs",
|
|
6
|
+
"module": "./dist/barcode-designer.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/barcode-designer.js",
|
|
10
|
+
"require": "./dist/barcode-designer.umd.cjs",
|
|
11
|
+
"types": "./dist/src/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./dist/barcode-designer.css": "./dist/barcode-designer.css"
|
|
14
|
+
},
|
|
15
|
+
"types": "./dist/src/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"build:types": "tsc -p tsconfig.lib.json",
|
|
22
|
+
"dev": "vite build --watch"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"axios": ">=1.12.0",
|
|
26
|
+
"react": ">=19.0.0",
|
|
27
|
+
"react-dom": ">=19.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"fast-xml-parser": "5.8.0",
|
|
31
|
+
"zustand": "5.0.13"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/react": "^19.1.8",
|
|
35
|
+
"@types/react-dom": "^19.1.6",
|
|
36
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
37
|
+
"axios": "^1.16.1",
|
|
38
|
+
"react": "^19.2.6",
|
|
39
|
+
"react-dom": "^19.2.6",
|
|
40
|
+
"typescript": "~6.0.2",
|
|
41
|
+
"vite": "^8.0.12",
|
|
42
|
+
"vite-plugin-dts": "^4.5.4"
|
|
43
|
+
}
|
|
44
|
+
}
|