@shaonq/vue 1.2.2 → 1.2.4

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/lib/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { DefineComponent } from 'vue';
8
8
  import { ExtractPropTypes } from 'vue';
9
9
  import { FormItem } from '@arco-design/web-vue';
10
10
  import { hiprint } from '@shaonq/hiprint';
11
+ import { jsPDFOptions } from 'jspdf';
11
12
  import { MethodOptions } from 'vue';
12
13
  import { Modal } from '@arco-design/web-vue';
13
14
  import { ModalConfig } from '@arco-design/web-vue';
@@ -221,20 +222,6 @@ declare const _default: {
221
222
  };
222
223
  export default _default;
223
224
 
224
- export declare function delay(ms: number): Promise<unknown>;
225
-
226
- export declare const download: (url: string, fileName?: string) => boolean;
227
-
228
- export declare function downLoadPdf(name: string, element: HTMLElement, option?: {
229
- /** `pdf page margin`: `[top, left, bottom, right]` */
230
- margin?: number[];
231
- /** 启用 `worker` */
232
- className?: string;
233
- /** 横向 `landscape` ,竖向 `portrait` */
234
- letterRendering?: 'landscape' | 'portrait';
235
- pagebreak?: any;
236
- } & RecordAny): Promise<void>;
237
-
238
225
  /**
239
226
  * @param name 下载名称
240
227
  * @param element HTMLElement
@@ -243,24 +230,36 @@ export declare function downLoadPdf(name: string, element: HTMLElement, option?:
243
230
  * @param {string} option.className 例 class = 'one-page-pdf' ,大量打印必填
244
231
  * @param {string} option.success successCallback worker:any => void
245
232
  */
246
- export declare function downLoadPdf2(name: string, element: HTMLElement, option?: {
247
- /** `pdf page margin`: `[top, left, bottom, right]` */
248
- margin?: number[];
249
- /** 启用 `worker` */
233
+ export declare function delay(ms: number): Promise<unknown>;
234
+
235
+ export declare const download: (url: string, fileName?: string) => boolean;
236
+
237
+ /**
238
+ * 将指定 HTML 元素(及其子元素)渲染为 PDF 并下载。
239
+ *
240
+ * @param name - 下载的 PDF 文件名(不带扩展名)
241
+ * @param element - 要转换为 PDF 的 HTML 元素
242
+ * @param option - 可选配置项:
243
+ * - className?: 用于选择多个子元素的选择器类名
244
+ * - paddingBuffer?: 分页时忽略的小段高度阈值(单位 mm)
245
+ * - margin?: 页面边距(未在代码中使用,但保留兼容性)
246
+ * - 其他 jsPDF 支持的选项(如格式、方向等)
247
+ *
248
+ * @throws 如果未传入 element,则抛出错误
249
+ *
250
+ * 注意事项:
251
+ * - 使用 htmlToImage 将 HTML 渲染为 Canvas
252
+ * - 使用 jsPDF 将 Canvas 添加到 PDF 文档
253
+ * - 默认 A4 格式纵向,可自定义通过 `option.orientation`
254
+ * - 当内容高度超过一页时会自动分页
255
+ * - 存在逻辑错误:canvas 的裁剪方式不正确,会导致每一页都显示整个页面的内容
256
+ */
257
+ export declare function downLoadPdf(name: string, element: HTMLElement, option?: {
258
+ progress?: (...args: number[]) => void;
250
259
  className?: string;
251
- /** 缩放比例 */
252
- scale?: number;
253
- /** 横向 `landscape` ,竖向 `portrait` */
254
- letterRendering?: 'landscape' | 'portrait';
255
- pagebreak?: {
256
- mode?: any;
257
- before?: any;
258
- after?: any;
259
- avoid?: any;
260
- };
261
- html2canvas?: any;
262
- jsPDF?: any;
263
- } & RecordAny): Promise<void>;
260
+ paddingBuffer?: number;
261
+ margin?: any;
262
+ } & jsPDFOptions): Promise<void>;
264
263
 
265
264
  /**
266
265
  * 参考文档 1: http://hiprint.io/docs/text
@@ -1630,6 +1629,11 @@ export declare interface OrcTableOption extends RecordAny_2 {
1630
1629
  tableProps?: TableInstance['$props'];
1631
1630
  }
1632
1631
 
1632
+ export declare function pAll(tasks: (() => Promise<any>)[], { concurrency, delayTime }?: {
1633
+ concurrency?: number | undefined;
1634
+ delayTime?: number | undefined;
1635
+ }): Promise<any[]>;
1636
+
1633
1637
  declare interface Props {
1634
1638
  useErrData?: <T = Record<string, any>>(config: Record<string, any>) => Promise<[boolean, T]>;
1635
1639
  }