@rdlabo/ionic-angular-kit 21.2.0-4 → 21.2.0-6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdlabo/ionic-angular-kit",
3
- "version": "21.2.0-4",
3
+ "version": "21.2.0-6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rdlabo-team/ionic-angular-library.git"
@@ -24,6 +24,7 @@
24
24
  "@capacitor-community/apple-sign-in": "*",
25
25
  "@rdlabo/capacitor-brotherprint": ">=6.0.0 <9.0.0",
26
26
  "dom-to-image-more": "^3.0.0",
27
+ "pdf-lib": "^1.17.1",
27
28
  "firebase": ">=11 <13",
28
29
  "rxjs": "^7.8.0"
29
30
  },
@@ -54,6 +55,9 @@
54
55
  },
55
56
  "dom-to-image-more": {
56
57
  "optional": true
58
+ },
59
+ "pdf-lib": {
60
+ "optional": true
57
61
  }
58
62
  },
59
63
  "dependencies": {
@@ -77,5 +77,71 @@ interface KitBrotherPrintSettingsParams {
77
77
  */
78
78
  declare const kitBuildBrotherPrintSettings: (params: KitBrotherPrintSettingsParams) => BRLMPrintOptions;
79
79
 
80
- export { kitBuildBrotherPrintSettings, kitDomToPng, kitRotationImage };
81
- export type { KitBrotherPrintSettingsParams, KitDomToPngOptions };
80
+ /** Physical paper dimensions used to build a PDF page. */
81
+ interface KitPrintPaper {
82
+ /** Human-readable paper name. */
83
+ readonly label: string;
84
+ /** Paper width in millimetres. */
85
+ readonly widthMm: number;
86
+ /** Paper height in millimetres. */
87
+ readonly heightMm: number;
88
+ }
89
+ /** Standard paper presets shared by the printing applications. */
90
+ declare const kitPrintPaperSizes: {
91
+ readonly a4: {
92
+ readonly label: "A4";
93
+ readonly widthMm: 210;
94
+ readonly heightMm: 297;
95
+ };
96
+ readonly b5: {
97
+ readonly label: "B5";
98
+ readonly widthMm: 182;
99
+ readonly heightMm: 257;
100
+ };
101
+ };
102
+ /** A position for one label on a PDF page, expressed in PDF points. */
103
+ interface KitPrintPosition {
104
+ readonly pageIndex: number;
105
+ readonly x: number;
106
+ readonly y: number;
107
+ }
108
+ /** Calculated PDF page and label dimensions. */
109
+ interface KitPrintLayout {
110
+ readonly paperWidth: number;
111
+ readonly paperHeight: number;
112
+ readonly labelWidth: number;
113
+ readonly labelHeight: number;
114
+ readonly positions: readonly KitPrintPosition[];
115
+ }
116
+ /** Optional physical size override for a label. */
117
+ interface KitPrintMeasure {
118
+ readonly type: 'width' | 'height';
119
+ readonly sizeMm: number;
120
+ }
121
+ /** Parameters for {@link kitCalculatePrintLayout}. */
122
+ interface KitCalculatePrintLayoutParams {
123
+ readonly paper: KitPrintPaper;
124
+ readonly labelWidthPx: number;
125
+ readonly labelHeightPx: number;
126
+ readonly copies: number;
127
+ readonly measure?: KitPrintMeasure | null;
128
+ /** Outer page margin in millimetres. Defaults to 5mm. */
129
+ readonly marginMm?: number;
130
+ }
131
+ /**
132
+ * Calculate page dimensions and row-major label positions for a printable PDF.
133
+ *
134
+ * Labels keep their aspect ratio, are never enlarged beyond their requested pixel/physical size,
135
+ * and automatically continue on additional pages when the current page is full.
136
+ */
137
+ declare const kitCalculatePrintLayout: (params: KitCalculatePrintLayoutParams) => KitPrintLayout;
138
+ /** Parameters for {@link kitBuildLabelPdf}. */
139
+ interface KitBuildLabelPdfParams extends KitCalculatePrintLayoutParams {
140
+ /** PNG label artwork as a data URL or base64 string accepted by pdf-lib. */
141
+ readonly imageData: string;
142
+ }
143
+ /** Build a multi-page label PDF and return its bytes without choosing an output destination. */
144
+ declare const kitBuildLabelPdf: (params: KitBuildLabelPdfParams) => Promise<Uint8Array>;
145
+
146
+ export { kitBuildBrotherPrintSettings, kitBuildLabelPdf, kitCalculatePrintLayout, kitDomToPng, kitPrintPaperSizes, kitRotationImage };
147
+ export type { KitBrotherPrintSettingsParams, KitBuildLabelPdfParams, KitCalculatePrintLayoutParams, KitDomToPngOptions, KitPrintLayout, KitPrintMeasure, KitPrintPaper, KitPrintPosition };
@@ -1390,21 +1390,22 @@ declare const arrayConcatById: <T>(arrayOld: T[], arrayNew: T[], key: keyof T, o
1390
1390
  declare const objectEqual: (a: object, b: object) => boolean;
1391
1391
 
1392
1392
  /**
1393
- * Disable the button that triggered an event while an async operation runs, re-enabling it after.
1393
+ * Disable the controls that triggered an event while an async operation runs.
1394
1394
  *
1395
1395
  * @remarks
1396
- * Prevents the common double-submit / double-tap bug: the `event.target` button is disabled, the
1397
- * work is awaited, and the button is re-enabled — even if the work rejects (the rejection is
1398
- * swallowed here so the button always recovers; handle errors inside `work` if you need to react).
1399
- *
1400
- * @param event - The DOM event whose `target` is the button to disable (e.g. a click event).
1401
- * @param work - The async operation to run while the button is disabled.
1402
- * @returns A Promise that resolves once the work has settled and the button has been re-enabled.
1396
+ * For a click event, the clicked control is disabled. For a submit event, the submitter is
1397
+ * disabled and the browser's default form navigation is prevented. Ionic's external
1398
+ * `ion-button[form]` uses a hidden native submitter, so buttons associated with the submitted form
1399
+ * are resolved through their `form` property and disabled instead. Rejections are swallowed so
1400
+ * controls always recover; handle errors inside `work` when the caller needs to react.
1401
+ *
1402
+ * @param event - The click or submit event that triggered the operation.
1403
+ * @param work - The async operation to run while the controls are disabled.
1404
+ * @returns A Promise that resolves once the work has settled and the controls have been restored.
1403
1405
  * @example
1404
- * ```ts
1405
- * async submit(event: Event): Promise<void> {
1406
- * await disableHandler(event, this.save());
1407
- * }
1406
+ * ```html
1407
+ * <form #formRef (submit)="helper.disableHandler($event, save())"></form>
1408
+ * <ion-button type="submit" [form]="formRef">Save</ion-button>
1408
1409
  * ```
1409
1410
  */
1410
1411
  declare const disableHandler: (event: Event, work: Promise<void | boolean>) => Promise<void>;