@dmsi/wedgekit-react 0.0.171 → 0.0.173
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/{chunk-GCBW2LDM.js → chunk-REGRTR2Y.js} +6 -4
- package/dist/{chunk-OJX75MY2.js → chunk-TB7VTSDP.js} +20 -9
- package/dist/{chunk-6A54FL75.js → chunk-ZSKLCKIR.js} +13 -1
- package/dist/components/DataGridCell.cjs +20 -9
- package/dist/components/DataGridCell.js +1 -1
- package/dist/components/Modal.cjs +18 -4
- package/dist/components/Modal.js +2 -2
- package/dist/components/ModalHeader.cjs +13 -1
- package/dist/components/ModalHeader.js +1 -1
- package/dist/components/PDFViewer.cjs +221 -101
- package/dist/components/PDFViewer.js +152 -94
- package/dist/components/index.cjs +213 -181
- package/dist/components/index.js +194 -173
- package/dist/index.css +8 -0
- package/package.json +1 -1
- package/src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx +1 -1
- package/src/components/DataGrid/PinnedColumns.tsx +19 -6
- package/src/components/DataGrid/TableBody/TableBodyRow.tsx +7 -2
- package/src/components/DataGrid/index.tsx +38 -9
- package/src/components/DataGridCell.tsx +16 -4
- package/src/components/Modal.tsx +5 -2
- package/src/components/ModalHeader.tsx +10 -1
- package/src/components/PDFViewer.tsx +86 -15
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-REGRTR2Y.js";
|
|
5
5
|
import "../chunk-4RJKB7LC.js";
|
|
6
6
|
import "../chunk-T7NDKJDP.js";
|
|
7
7
|
import "../chunk-SYEJVSE4.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-ZSKLCKIR.js";
|
|
9
9
|
import "../chunk-ZFOANBWG.js";
|
|
10
10
|
import {
|
|
11
11
|
Spinner
|
|
12
12
|
} from "../chunk-PLMGI5K5.js";
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
Heading3
|
|
15
|
+
} from "../chunk-AZ7LVLOK.js";
|
|
14
16
|
import {
|
|
15
17
|
Caption
|
|
16
18
|
} from "../chunk-E7D24OHM.js";
|
|
@@ -19,6 +21,9 @@ import "../chunk-6LN6QT6M.js";
|
|
|
19
21
|
import {
|
|
20
22
|
Stack
|
|
21
23
|
} from "../chunk-N6JVLYEE.js";
|
|
24
|
+
import {
|
|
25
|
+
Paragraph
|
|
26
|
+
} from "../chunk-HVI3CL7Y.js";
|
|
22
27
|
import {
|
|
23
28
|
Icon
|
|
24
29
|
} from "../chunk-NKUETCDA.js";
|
|
@@ -52,14 +57,32 @@ function PDFViewer(props) {
|
|
|
52
57
|
setIsDownloading(false);
|
|
53
58
|
}, [currentIndex, encodedPdfs]);
|
|
54
59
|
if (!encodedPdfs.length) return null;
|
|
60
|
+
function handleNextFile() {
|
|
61
|
+
if (currentIndex < encodedPdfs.length - 1) {
|
|
62
|
+
setCurrentIndex((prev) => prev + 1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function handlePreviousFile() {
|
|
66
|
+
if (currentIndex > 0) {
|
|
67
|
+
setCurrentIndex((prev) => prev - 1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function handleClose() {
|
|
71
|
+
setCurrentIndex(0);
|
|
72
|
+
setIsDownloading(false);
|
|
73
|
+
onClose();
|
|
74
|
+
}
|
|
55
75
|
return /* @__PURE__ */ jsx(
|
|
56
76
|
Modal,
|
|
57
77
|
{
|
|
58
78
|
testid,
|
|
59
79
|
open: isOpen,
|
|
60
|
-
onClose,
|
|
80
|
+
onClose: handleClose,
|
|
61
81
|
showButtons: !!customActions,
|
|
62
82
|
customActions,
|
|
83
|
+
size: "large",
|
|
84
|
+
fixedHeightScrolling: true,
|
|
85
|
+
headerIconAlign: "right",
|
|
63
86
|
headerIcon: /* @__PURE__ */ jsx(
|
|
64
87
|
DownloadIcon,
|
|
65
88
|
{
|
|
@@ -68,33 +91,49 @@ function PDFViewer(props) {
|
|
|
68
91
|
isDownloading
|
|
69
92
|
}
|
|
70
93
|
),
|
|
71
|
-
|
|
94
|
+
className: "!max-w-fit",
|
|
95
|
+
children: /* @__PURE__ */ jsxs(Stack, { sizing: "layout", items: "center", children: [
|
|
72
96
|
/* @__PURE__ */ jsx(PDFElement, { testid, b64: encodedPdfs[currentIndex].base64 }),
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
|
|
97
|
+
!!encodedPdfs[currentIndex].fileName && /* @__PURE__ */ jsx(Paragraph, { children: encodedPdfs[currentIndex].fileName.endsWith(".pdf") ? encodedPdfs[currentIndex].fileName : `${encodedPdfs[currentIndex].fileName}.pdf` }),
|
|
98
|
+
/* @__PURE__ */ jsxs(
|
|
99
|
+
Stack,
|
|
75
100
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
requestAnimationFrame(() => {
|
|
82
|
-
const button = e.target;
|
|
83
|
-
button.scrollIntoView({
|
|
84
|
-
behavior: "smooth",
|
|
85
|
-
block: "nearest",
|
|
86
|
-
inline: "center"
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
disabled: isDownloading || currentIndex === index || !pdf.base64,
|
|
101
|
+
horizontal: true,
|
|
102
|
+
overflowX: "auto",
|
|
103
|
+
justify: "center",
|
|
104
|
+
items: "center",
|
|
105
|
+
sizing: "layout-group",
|
|
91
106
|
children: [
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
Button,
|
|
109
|
+
{
|
|
110
|
+
iconOnly: true,
|
|
111
|
+
variant: "tertiary",
|
|
112
|
+
onClick: handlePreviousFile,
|
|
113
|
+
leftIcon: /* @__PURE__ */ jsx(Icon, { name: "chevron_backward" }),
|
|
114
|
+
disabled: currentIndex === 0,
|
|
115
|
+
testid: testid ? `${testid}-pdf-file-previous-button` : void 0
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsxs(Heading3, { className: "text-text-primary-normal", children: [
|
|
119
|
+
currentIndex + 1,
|
|
120
|
+
" / ",
|
|
121
|
+
encodedPdfs.length
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
Button,
|
|
125
|
+
{
|
|
126
|
+
iconOnly: true,
|
|
127
|
+
variant: "tertiary",
|
|
128
|
+
onClick: handleNextFile,
|
|
129
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { name: "chevron_forward" }),
|
|
130
|
+
disabled: currentIndex === encodedPdfs.length - 1,
|
|
131
|
+
testid: testid ? `${testid}-pdf-file-next-button` : void 0
|
|
132
|
+
}
|
|
133
|
+
)
|
|
94
134
|
]
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
)) })
|
|
135
|
+
}
|
|
136
|
+
)
|
|
98
137
|
] })
|
|
99
138
|
}
|
|
100
139
|
);
|
|
@@ -123,74 +162,93 @@ function PDFElement({ b64, testid }) {
|
|
|
123
162
|
workerSrc: "/scripts/pdf.worker.min.mjs",
|
|
124
163
|
page,
|
|
125
164
|
canvasRef,
|
|
126
|
-
scale: 1
|
|
165
|
+
scale: 1.1
|
|
127
166
|
});
|
|
128
|
-
return /* @__PURE__ */ jsxs(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
167
|
+
return /* @__PURE__ */ jsxs(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: "flex flex-col space-y-4 ",
|
|
171
|
+
style: {
|
|
172
|
+
minHeight: 871,
|
|
173
|
+
minWidth: 654
|
|
174
|
+
},
|
|
175
|
+
children: [
|
|
176
|
+
!!pdfDocument && !!b64 ? /* @__PURE__ */ jsx(
|
|
177
|
+
"canvas",
|
|
178
|
+
{
|
|
179
|
+
"data-testid": testid ? `${testid}-pdf-content` : void 0,
|
|
180
|
+
ref: canvasRef
|
|
181
|
+
}
|
|
182
|
+
) : /* @__PURE__ */ jsx(
|
|
183
|
+
Stack,
|
|
184
|
+
{
|
|
185
|
+
justify: "center",
|
|
186
|
+
items: "center",
|
|
187
|
+
height: "full",
|
|
188
|
+
flexGrow: 1,
|
|
189
|
+
"data-testid": testid ? `${testid}-pdf-loading` : void 0,
|
|
190
|
+
children: /* @__PURE__ */ jsx(Spinner, { size: "large" })
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
(pdfDocument == null ? void 0 : pdfDocument.numPages) && pdfDocument.numPages > 1 && /* @__PURE__ */ jsxs(
|
|
194
|
+
"ul",
|
|
195
|
+
{
|
|
196
|
+
className: "flex flex-row justify-between items-center",
|
|
197
|
+
"data-testid": testid ? `${testid}-pdf-pagination` : void 0,
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx("li", { className: "previous", children: /* @__PURE__ */ jsx(
|
|
200
|
+
"button",
|
|
201
|
+
{
|
|
202
|
+
"data-testid": testid ? `${testid}-pdf-pagination-previous-button` : void 0,
|
|
203
|
+
disabled: page === 1,
|
|
204
|
+
onClick: () => setPage(page - 1),
|
|
205
|
+
className: "not-disabled:cursor-pointer not-disabled:hover:underline ",
|
|
206
|
+
children: /* @__PURE__ */ jsx(Caption, { className: "not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal", children: "Previous" })
|
|
207
|
+
}
|
|
208
|
+
) }),
|
|
209
|
+
/* @__PURE__ */ jsxs(
|
|
210
|
+
"li",
|
|
211
|
+
{
|
|
212
|
+
"data-testid": testid ? `${testid}-pdf-pagination-text` : void 0,
|
|
213
|
+
className: "text-label-desktop text-text-primary-normal",
|
|
214
|
+
children: [
|
|
215
|
+
"Page",
|
|
216
|
+
" ",
|
|
217
|
+
/* @__PURE__ */ jsx(
|
|
218
|
+
"span",
|
|
219
|
+
{
|
|
220
|
+
"data-testid": testid ? `${testid}-pdf-pagination-page-${page}` : void 0,
|
|
221
|
+
children: page
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
" ",
|
|
225
|
+
"of",
|
|
226
|
+
" ",
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
"span",
|
|
229
|
+
{
|
|
230
|
+
"data-testid": testid ? `${testid}-pdf-pagination-total-page-${pdfDocument.numPages}` : void 0,
|
|
231
|
+
children: pdfDocument.numPages
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ jsx("li", { className: "next", children: /* @__PURE__ */ jsx(
|
|
238
|
+
"button",
|
|
239
|
+
{
|
|
240
|
+
"data-testid": testid ? `${testid}-pdf-pagination-next-button` : void 0,
|
|
241
|
+
disabled: page === pdfDocument.numPages,
|
|
242
|
+
onClick: () => setPage(page + 1),
|
|
243
|
+
children: /* @__PURE__ */ jsx(Caption, { className: "not-disabled:cursor-pointer not-disabled:hover:underline not-disabled:text-text-primary-normal", children: "Next" })
|
|
244
|
+
}
|
|
245
|
+
) })
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
);
|
|
194
252
|
}
|
|
195
253
|
export {
|
|
196
254
|
PDFViewer
|