@dmsi/wedgekit-react 2.1.2 → 3.0.1
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/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/Breadcrumbs.js +21 -17
- package/dist/components/DataGrid/index.d.ts.map +1 -1
- package/dist/components/DataGrid/index.js +340 -325
- package/dist/components/Link.d.ts +1 -2
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +23 -24
- package/dist/components/ModalButtons.d.ts.map +1 -1
- package/dist/components/ModalButtons.js +19 -18
- package/dist/components/PDFViewer/PDFElement.js +1 -1
- package/dist/components/PDFViewer/PDFPage.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +12 -2
- package/dist/node_modules/@mikecousins/react-pdf/dist/index.js +0 -83
- package/dist/node_modules/pdfjs-dist/build/pdf.js +0 -17649
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dmsi/wedgekit-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,7 +21,17 @@
|
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": ">=18.0.0",
|
|
24
|
-
"react-dom": ">=18.0.0"
|
|
24
|
+
"react-dom": ">=18.0.0",
|
|
25
|
+
"@mikecousins/react-pdf": "^8.1.0",
|
|
26
|
+
"pdfjs-dist": "^5"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"@mikecousins/react-pdf": {
|
|
30
|
+
"optional": true
|
|
31
|
+
},
|
|
32
|
+
"pdfjs-dist": {
|
|
33
|
+
"optional": true
|
|
34
|
+
}
|
|
25
35
|
},
|
|
26
36
|
"publishConfig": {
|
|
27
37
|
"access": "public"
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { useState as I, useRef as n, useEffect as e } from "react";
|
|
2
|
-
function i(f) {
|
|
3
|
-
return typeof f == "function";
|
|
4
|
-
}
|
|
5
|
-
const W = ({ canvasRef: f, file: j, onDocumentLoadSuccess: R, onDocumentLoadFail: d, onPageLoadSuccess: w, onPageLoadFail: h, onPageRenderSuccess: v, onPageRenderFail: x, scale: z = 1, rotate: m = 0, page: A = 1, cMapUrl: p, cMapPacked: B, workerSrc: D, withCredentials: G = !1 }) => {
|
|
6
|
-
const [o, J] = I(), [K, N] = I(), c = n(null), y = n(null), E = n(R), q = n(d), C = n(w), P = n(h), k = n(v), T = n(x);
|
|
7
|
-
return e(() => {
|
|
8
|
-
E.current = R;
|
|
9
|
-
}, [R]), e(() => {
|
|
10
|
-
q.current = d;
|
|
11
|
-
}, [d]), e(() => {
|
|
12
|
-
C.current = w;
|
|
13
|
-
}, [w]), e(() => {
|
|
14
|
-
P.current = h;
|
|
15
|
-
}, [h]), e(() => {
|
|
16
|
-
k.current = v;
|
|
17
|
-
}, [v]), e(() => {
|
|
18
|
-
T.current = x;
|
|
19
|
-
}, [x]), e(() => {
|
|
20
|
-
if (typeof window > "u") return;
|
|
21
|
-
const u = {
|
|
22
|
-
url: j,
|
|
23
|
-
withCredentials: G
|
|
24
|
-
};
|
|
25
|
-
p && (u.cMapUrl = p, u.cMapPacked = B), import("../../../pdfjs-dist/build/pdf.js").then(({ GlobalWorkerOptions: t, getDocument: V, version: s }) => {
|
|
26
|
-
t.workerSrc = D, V(u).promise.then((r) => {
|
|
27
|
-
J(r), i(E.current) && E.current(r);
|
|
28
|
-
}, () => {
|
|
29
|
-
i(q.current) && q.current();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}, [
|
|
33
|
-
j,
|
|
34
|
-
G,
|
|
35
|
-
p,
|
|
36
|
-
B,
|
|
37
|
-
D
|
|
38
|
-
]), e(() => {
|
|
39
|
-
const u = (t) => {
|
|
40
|
-
const V = m === 0 ? t.rotate : t.rotate + m, s = t.getViewport({
|
|
41
|
-
scale: z,
|
|
42
|
-
rotation: V
|
|
43
|
-
}), r = f.current;
|
|
44
|
-
if (!r) return;
|
|
45
|
-
const b = r.getContext("2d");
|
|
46
|
-
if (!b) return;
|
|
47
|
-
const l = typeof window < "u" ? window.devicePixelRatio : 1;
|
|
48
|
-
if (r.height = s.height * l, r.width = s.width * l, b.scale(l, l), c.current) {
|
|
49
|
-
y.current = t, c.current.cancel();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
return c.current = t.render({
|
|
53
|
-
canvasContext: b,
|
|
54
|
-
canvas: r,
|
|
55
|
-
viewport: s
|
|
56
|
-
}), c.current.promise.then(() => {
|
|
57
|
-
c.current = null, i(k.current) && k.current(t);
|
|
58
|
-
}, (H) => {
|
|
59
|
-
if (c.current = null, H && H.name === "RenderingCancelledException") {
|
|
60
|
-
const O = y.current ?? t;
|
|
61
|
-
y.current = null, u(O);
|
|
62
|
-
} else i(T.current) && T.current();
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
o && o.getPage(A).then((t) => {
|
|
66
|
-
N(t), i(C.current) && C.current(t), u(t);
|
|
67
|
-
}, () => {
|
|
68
|
-
i(P.current) && P.current();
|
|
69
|
-
});
|
|
70
|
-
}, [
|
|
71
|
-
f,
|
|
72
|
-
A,
|
|
73
|
-
o,
|
|
74
|
-
m,
|
|
75
|
-
z
|
|
76
|
-
]), {
|
|
77
|
-
pdfDocument: o,
|
|
78
|
-
pdfPage: K
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
export {
|
|
82
|
-
W as usePdf
|
|
83
|
-
};
|