@sv-print/hiprint 0.2.24 → 0.3.0

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/index.d.ts CHANGED
@@ -36,20 +36,23 @@ export declare type Hiprint = hiprint;
36
36
  export declare class hiprint {
37
37
  static init: (options: InitOptions) => void;
38
38
  static register: (options: RegisterOptions) => string;
39
- static setConfig: (options: ConfigOptions) => void;
39
+ static setConfig: (options?: ConfigOptions) => void;
40
40
  static getOptionItems: Record<string, any>;
41
41
  static updateElementType: <T>(tid: string, callback: (type: T) => T) => void;
42
42
  static hiwebSocket: HiWebSocket;
43
- static refreshPrinterList: (callback: (printerList: PrinterInfo[]) => void) => void;
44
- static getAddress: (type: string, callback: (addr: Record<string, any>, e: any) => void) => void;
43
+ static setHost: (host: string, token?: string) => Promise<any>;
44
+ static refreshPrinterList: () => Promise<PrinterInfo[]>;
45
+ static getAddress: () => Promise<Record<string, any>>;
46
+ static getClients: () => Promise<any[]>;
47
+ static getClientInfo: () => Promise<any>;
45
48
  static ippPrint: (...args: any) => void;
46
49
  static ippRequest: (...args: any) => void;
47
50
  static PrintElementTypeManager: PrintElementTypeManager;
48
51
  static PrintElementTypeGroup: PrintElementTypeGroup;
49
52
  static PrintTemplate: typeof PrintTemplate;
50
- static print: (data: Templates) => void;
51
- static print2: (data: Templates, printSuccess: (e: any) => void, printError: (e: any) => void) => void;
52
- static getHtml: (data: Templates) => any;
53
+ static print: (data: Templates) => Promise<any>;
54
+ static print2: (data: Templates) => Promise<any>;
55
+ static getHtml: (data: Templates) => Promise<any>;
53
56
  }
54
57
 
55
58
  export declare interface HiWebSocket {
@@ -73,7 +76,7 @@ export declare interface PanelJson {
73
76
  width?: number;
74
77
  paperHeader?: number;
75
78
  paperFooter?: number;
76
- printElements?: any[];
79
+ printElements?: PrintElementJson[];
77
80
  paperNumberLeft?: number;
78
81
  paperNumberTop?: number;
79
82
  paperNumberDisabled?: boolean;
@@ -152,6 +155,24 @@ export declare interface Print2Options extends Record<string, any> {
152
155
 
153
156
  export declare type PrintData = Record<string, any> | Record<string, any>[];
154
157
 
158
+ export declare interface PrintElementJson {
159
+ type: {
160
+ title: string;
161
+ type: string;
162
+ };
163
+ options?: PrintElementOptionsJson;
164
+ }
165
+
166
+ export declare interface PrintElementOptionsJson extends Record<string, any> {
167
+ left?: number;
168
+ top?: number;
169
+ width?: number;
170
+ height?: number;
171
+ title?: string;
172
+ field?: string;
173
+ testData?: string;
174
+ }
175
+
155
176
  export declare interface PrintElementType extends Record<string, any> {
156
177
  tid: string;
157
178
  type: string;
@@ -188,9 +209,9 @@ export declare class PrintTemplate {
188
209
  container: any;
189
210
  editingPanel: Array<any>;
190
211
  printPanels: Array<any>;
191
- design: (container: string, { grid: boolean }) => any;
212
+ design: (container: string, option: { grid?: boolean; activePanel?: boolean }) => any;
192
213
  buildPagination: (container: string) => void;
193
- update: (json: PrintTemplateJson, panelIndex: number, history: boolean) => any;
214
+ update: (json: PrintTemplateJson, panelIndex?: number, history?: boolean) => any;
194
215
  print: (
195
216
  data: PrintData,
196
217
  options?: { leftOffset?: number; topOffset?: number },
@@ -219,7 +240,7 @@ export declare class PrintTemplate {
219
240
  updateOption: (key: string, val: any) => void;
220
241
  setElsAlign: (align: string, toPaper?: boolean) => void;
221
242
  setElsSpace: (dis: number, isHor: boolean) => void;
222
- selectAllEls: (reverse?: boolean) => any;
243
+ selectAllEls: (reverse?: boolean) => PrintElementJson[];
223
244
  addPrintElementToPaperByTid: (tid: string, left?: number, top?: number) => any;
224
245
  getJson: () => PrintTemplateJson;
225
246
  getJsonTid: () => PrintTemplateJson;