@shaonq/vue 1.2.1 → 1.2.3

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,8 +222,6 @@ declare const _default: {
221
222
  };
222
223
  export default _default;
223
224
 
224
- export declare const download: (url: string, fileName?: string) => boolean;
225
-
226
225
  /**
227
226
  * @param name 下载名称
228
227
  * @param element HTMLElement
@@ -231,24 +230,35 @@ export declare const download: (url: string, fileName?: string) => boolean;
231
230
  * @param {string} option.className 例 class = 'one-page-pdf' ,大量打印必填
232
231
  * @param {string} option.success successCallback worker:any => void
233
232
  */
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
+ */
234
257
  export declare function downLoadPdf(name: string, element: HTMLElement, option?: {
235
- /** `pdf page margin`: `[top, left, bottom, right]` */
236
- margin?: number[];
237
- /** 启用 `worker` */
238
258
  className?: string;
239
- /** 缩放比例 */
240
- scale?: number;
241
- /** 横向 `landscape` ,竖向 `portrait` */
242
- letterRendering?: 'landscape' | 'portrait';
243
- pagebreak?: {
244
- mode?: any;
245
- before?: any;
246
- after?: any;
247
- avoid?: any;
248
- };
249
- html2canvas?: any;
250
- jsPDF?: any;
251
- } & RecordAny): Promise<void>;
259
+ paddingBuffer?: number;
260
+ margin?: any;
261
+ } & jsPDFOptions): Promise<void>;
252
262
 
253
263
  /**
254
264
  * 参考文档 1: http://hiprint.io/docs/text
@@ -1618,6 +1628,11 @@ export declare interface OrcTableOption extends RecordAny_2 {
1618
1628
  tableProps?: TableInstance['$props'];
1619
1629
  }
1620
1630
 
1631
+ export declare function pAll(tasks: (() => Promise<any>)[], { concurrency, delayTime }?: {
1632
+ concurrency?: number | undefined;
1633
+ delayTime?: number | undefined;
1634
+ }): Promise<any[]>;
1635
+
1621
1636
  declare interface Props {
1622
1637
  useErrData?: <T = Record<string, any>>(config: Record<string, any>) => Promise<[boolean, T]>;
1623
1638
  }