jit-pdf 0.1.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/README.md +50 -0
- package/dist/annotation-snapshot.d.ts +2 -0
- package/dist/browser.cjs +1 -0
- package/dist/browser.d.ts +25 -0
- package/dist/browser.js +56 -0
- package/dist/components/JitPdfEditor.vue.d.ts +21 -0
- package/dist/components/JitPdfEditorInner.vue.d.ts +22 -0
- package/dist/composables/usePdfEditorSdk.d.ts +8 -0
- package/dist/http-service-DBwg8kDH.js +43169 -0
- package/dist/http-service-DqmwdbGE.cjs +18844 -0
- package/dist/http-service.d.ts +6 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/indexeddb-service.d.ts +10 -0
- package/dist/jit-pdf.umd.js +18863 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +128 -0
- package/package.json +84 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# jit-pdf
|
|
2
|
+
|
|
3
|
+
Jit PDF 是一套面向业务系统的 PDF 预览与编辑 SDK,支持:
|
|
4
|
+
|
|
5
|
+
- Vue 组件接入
|
|
6
|
+
- 浏览器挂载式接入
|
|
7
|
+
- UMD `<script>` 直引
|
|
8
|
+
- 本地 `IndexedDB` 模式
|
|
9
|
+
- 服务端文件流模式
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add jit-pdf
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Vue 接入
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import "jit-pdf/styles.css";
|
|
21
|
+
import {
|
|
22
|
+
JitPdfEditor,
|
|
23
|
+
createIndexedDbPdfEditorService
|
|
24
|
+
} from "jit-pdf";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 浏览器挂载
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import "jit-pdf/styles.css";
|
|
31
|
+
import {
|
|
32
|
+
createIndexedDbPdfEditorService,
|
|
33
|
+
mountJitPdfEditor
|
|
34
|
+
} from "jit-pdf/browser";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## UMD 直引
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<link rel="stylesheet" href="https://cdn.example.com/jit-pdf/dist/style.css" />
|
|
41
|
+
<script src="https://cdn.example.com/jit-pdf/dist/jit-pdf.umd.js"></script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const { createIndexedDbPdfEditorService, mountJitPdfEditor } = window.JitPdfSdk;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 文档
|
|
49
|
+
|
|
50
|
+
- GitHub: https://github.com/jitOffice/jit-pdf-sdk
|
package/dist/browser.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),e=require("./http-service-DqmwdbGE.cjs");function v(r){if(typeof r=="string"){const t=document.querySelector(r);if(!t)throw new Error(`未找到挂载容器:${r}`);return t}return r}function i(r){const{target:t,onReady:c,onDirtyChange:u,onSaveStart:f,onSaveSuccess:s,onSaveError:a,onLoadError:S,...E}=r,n=v(t),o=d.createApp({render(){return d.h(e._sfc_main,{...E,onReady:c,onDirtyChange:u,onSaveStart:f,onSaveSuccess:s,onSaveError:a,onLoadError:S})}});return o.mount(n),{app:o,element:n,unmount(){o.unmount()}}}const P={mountJitPdfEditor:i,createHttpPdfEditorService:e.createHttpPdfEditorService,createIndexedDbPdfEditorService:e.createIndexedDbPdfEditorService};exports.JitPdfEditor=e._sfc_main;exports.createHttpPdfEditorService=e.createHttpPdfEditorService;exports.createIndexedDbPdfEditorService=e.createIndexedDbPdfEditorService;exports.usePdfEditorSdk=e.usePdfEditorSdk;exports.browser=P;exports.mountJitPdfEditor=i;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type App as VueApp } from "vue";
|
|
2
|
+
import { createHttpPdfEditorService } from "./http-service";
|
|
3
|
+
import { createIndexedDbPdfEditorService } from "./indexeddb-service";
|
|
4
|
+
import type { JitPdfEditorDirtyChangeEvent, JitPdfEditorErrorEvent, JitPdfEditorProps, JitPdfEditorReadyEvent, SaveCopyResult } from "./types";
|
|
5
|
+
export * from "./index";
|
|
6
|
+
export interface MountJitPdfEditorOptions extends JitPdfEditorProps {
|
|
7
|
+
target: string | HTMLElement;
|
|
8
|
+
onReady?: (payload: JitPdfEditorReadyEvent) => void;
|
|
9
|
+
onDirtyChange?: (payload: JitPdfEditorDirtyChangeEvent) => void;
|
|
10
|
+
onSaveStart?: () => void;
|
|
11
|
+
onSaveSuccess?: (payload: SaveCopyResult) => void;
|
|
12
|
+
onSaveError?: (payload: JitPdfEditorErrorEvent) => void;
|
|
13
|
+
onLoadError?: (payload: JitPdfEditorErrorEvent) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface MountedJitPdfEditor {
|
|
16
|
+
app: VueApp;
|
|
17
|
+
element: HTMLElement;
|
|
18
|
+
unmount: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function mountJitPdfEditor(options: MountJitPdfEditorOptions): MountedJitPdfEditor;
|
|
21
|
+
export declare const browser: {
|
|
22
|
+
mountJitPdfEditor: typeof mountJitPdfEditor;
|
|
23
|
+
createHttpPdfEditorService: typeof createHttpPdfEditorService;
|
|
24
|
+
createIndexedDbPdfEditorService: typeof createIndexedDbPdfEditorService;
|
|
25
|
+
};
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createApp as f, h as m } from "vue";
|
|
2
|
+
import { a as p, c as E, _ as S } from "./http-service-DBwg8kDH.js";
|
|
3
|
+
import { u as _ } from "./http-service-DBwg8kDH.js";
|
|
4
|
+
function v(r) {
|
|
5
|
+
if (typeof r == "string") {
|
|
6
|
+
const e = document.querySelector(r);
|
|
7
|
+
if (!e)
|
|
8
|
+
throw new Error(`未找到挂载容器:${r}`);
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
return r;
|
|
12
|
+
}
|
|
13
|
+
function P(r) {
|
|
14
|
+
const {
|
|
15
|
+
target: e,
|
|
16
|
+
onReady: n,
|
|
17
|
+
onDirtyChange: i,
|
|
18
|
+
onSaveStart: c,
|
|
19
|
+
onSaveSuccess: d,
|
|
20
|
+
onSaveError: s,
|
|
21
|
+
onLoadError: u,
|
|
22
|
+
...a
|
|
23
|
+
} = r, t = v(e), o = f({
|
|
24
|
+
render() {
|
|
25
|
+
return m(S, {
|
|
26
|
+
...a,
|
|
27
|
+
onReady: n,
|
|
28
|
+
onDirtyChange: i,
|
|
29
|
+
onSaveStart: c,
|
|
30
|
+
onSaveSuccess: d,
|
|
31
|
+
onSaveError: s,
|
|
32
|
+
onLoadError: u
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return o.mount(t), {
|
|
37
|
+
app: o,
|
|
38
|
+
element: t,
|
|
39
|
+
unmount() {
|
|
40
|
+
o.unmount();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const h = {
|
|
45
|
+
mountJitPdfEditor: P,
|
|
46
|
+
createHttpPdfEditorService: E,
|
|
47
|
+
createIndexedDbPdfEditorService: p
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
S as JitPdfEditor,
|
|
51
|
+
h as browser,
|
|
52
|
+
E as createHttpPdfEditorService,
|
|
53
|
+
p as createIndexedDbPdfEditorService,
|
|
54
|
+
P as mountJitPdfEditor,
|
|
55
|
+
_ as usePdfEditorSdk
|
|
56
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JitPdfEditorDirtyChangeEvent, JitPdfEditorErrorEvent, JitPdfEditorProps, JitPdfEditorReadyEvent, SaveCopyResult } from "../types";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<JitPdfEditorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
ready: (payload: JitPdfEditorReadyEvent) => any;
|
|
4
|
+
"dirty-change": (payload: JitPdfEditorDirtyChangeEvent) => any;
|
|
5
|
+
"save-start": () => any;
|
|
6
|
+
"save-success": (payload: SaveCopyResult) => any;
|
|
7
|
+
"save-error": (payload: JitPdfEditorErrorEvent) => any;
|
|
8
|
+
"load-error": (payload: JitPdfEditorErrorEvent) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<JitPdfEditorProps> & Readonly<{
|
|
10
|
+
onReady?: ((payload: JitPdfEditorReadyEvent) => any) | undefined;
|
|
11
|
+
"onDirty-change"?: ((payload: JitPdfEditorDirtyChangeEvent) => any) | undefined;
|
|
12
|
+
"onSave-start"?: (() => any) | undefined;
|
|
13
|
+
"onSave-success"?: ((payload: SaveCopyResult) => any) | undefined;
|
|
14
|
+
"onSave-error"?: ((payload: JitPdfEditorErrorEvent) => any) | undefined;
|
|
15
|
+
"onLoad-error"?: ((payload: JitPdfEditorErrorEvent) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
readonly: boolean;
|
|
18
|
+
locale: "zh-CN";
|
|
19
|
+
theme: "blue-enterprise";
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JitPdfEditorDirtyChangeEvent, JitPdfEditorErrorEvent, JitPdfEditorProps, JitPdfEditorReadyEvent, SaveCopyResult } from "../types";
|
|
2
|
+
type __VLS_Props = JitPdfEditorProps & {
|
|
3
|
+
activeDocumentId: string | null;
|
|
4
|
+
pluginsReady: boolean;
|
|
5
|
+
isInitializing: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
ready: (payload: JitPdfEditorReadyEvent) => any;
|
|
9
|
+
"dirty-change": (payload: JitPdfEditorDirtyChangeEvent) => any;
|
|
10
|
+
"save-start": () => any;
|
|
11
|
+
"save-success": (payload: SaveCopyResult) => any;
|
|
12
|
+
"save-error": (payload: JitPdfEditorErrorEvent) => any;
|
|
13
|
+
"load-error": (payload: JitPdfEditorErrorEvent) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
onReady?: ((payload: JitPdfEditorReadyEvent) => any) | undefined;
|
|
16
|
+
"onDirty-change"?: ((payload: JitPdfEditorDirtyChangeEvent) => any) | undefined;
|
|
17
|
+
"onSave-start"?: (() => any) | undefined;
|
|
18
|
+
"onSave-success"?: ((payload: SaveCopyResult) => any) | undefined;
|
|
19
|
+
"onSave-error"?: ((payload: JitPdfEditorErrorEvent) => any) | undefined;
|
|
20
|
+
"onLoad-error"?: ((payload: JitPdfEditorErrorEvent) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JitPdfEditorProps, PdfEditorCapabilities } from "../types";
|
|
2
|
+
export declare function usePdfEditorSdk(props: Pick<JitPdfEditorProps, "capabilities" | "readonly" | "source">): {
|
|
3
|
+
capabilities: import("vue").ComputedRef<PdfEditorCapabilities>;
|
|
4
|
+
canSaveToService: import("vue").ComputedRef<boolean>;
|
|
5
|
+
statusMessage: import("vue").Ref<string, string>;
|
|
6
|
+
leftDrawerOpen: import("vue").Ref<boolean, boolean>;
|
|
7
|
+
rightDrawerOpen: import("vue").Ref<boolean, boolean>;
|
|
8
|
+
};
|