@jingx/lottery-components-react-jsx 1.0.25 → 1.0.26
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/index.cjs.js +23 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -24
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -38134,7 +38134,7 @@ function ScopeHost({ className, children, style }) {
|
|
|
38134
38134
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style, ref, className: `spacx bg-transparent ${className}`, children: typeof children === "function" ? children(container) : children });
|
|
38135
38135
|
}
|
|
38136
38136
|
|
|
38137
|
-
const totalStyle = { lineHeight: "
|
|
38137
|
+
const totalStyle = { lineHeight: "25px", fontWeight: 600, fontSize: 25 };
|
|
38138
38138
|
const dotStyle = { lineHeight: "13px", fontWeight: 800, fontSize: 25, color: "black" };
|
|
38139
38139
|
const RenderRow = ({ children, label, isShow = true }) => {
|
|
38140
38140
|
if (!isShow) return null;
|
|
@@ -46269,17 +46269,31 @@ var parseBackgroundColor = function (context, element, backgroundColorOverride)
|
|
|
46269
46269
|
: defaultBackgroundColor;
|
|
46270
46270
|
};
|
|
46271
46271
|
|
|
46272
|
+
const getCanvasScale = () => {
|
|
46273
|
+
const deviceScale = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
46274
|
+
return Math.max(deviceScale, 5);
|
|
46275
|
+
};
|
|
46276
|
+
const getCanvasOptions = (node, useCORS = true) => ({
|
|
46277
|
+
scale: getCanvasScale(),
|
|
46278
|
+
useCORS,
|
|
46279
|
+
backgroundColor: "#ffffff",
|
|
46280
|
+
logging: false,
|
|
46281
|
+
removeContainer: true,
|
|
46282
|
+
width: node.scrollWidth,
|
|
46283
|
+
height: node.scrollHeight,
|
|
46284
|
+
windowWidth: node.scrollWidth,
|
|
46285
|
+
windowHeight: node.scrollHeight
|
|
46286
|
+
});
|
|
46272
46287
|
const exportToImage = async (reportRef, actionButtonsRef, lotteryType, ticketNumber) => {
|
|
46273
46288
|
if (!reportRef.current || !actionButtonsRef.current) return;
|
|
46274
46289
|
const originalVisibility = actionButtonsRef.current.style.visibility;
|
|
46275
46290
|
try {
|
|
46276
46291
|
actionButtonsRef.current.style.visibility = "hidden";
|
|
46277
|
-
|
|
46278
|
-
const canvas = await html2canvas(
|
|
46279
|
-
|
|
46280
|
-
|
|
46281
|
-
|
|
46282
|
-
});
|
|
46292
|
+
await waitForFontsAndImages(reportRef.current);
|
|
46293
|
+
const canvas = await html2canvas(
|
|
46294
|
+
reportRef.current,
|
|
46295
|
+
getCanvasOptions(reportRef.current, true)
|
|
46296
|
+
);
|
|
46283
46297
|
const image = canvas.toDataURL(`image/png`, 1);
|
|
46284
46298
|
const link = document.createElement("a");
|
|
46285
46299
|
link.href = image;
|
|
@@ -46300,14 +46314,7 @@ const copyImageToClipboard = async (reportRef, actionButtonsRef, lotteryType, ti
|
|
|
46300
46314
|
try {
|
|
46301
46315
|
if (btn) btn.style.visibility = "hidden";
|
|
46302
46316
|
await waitForFontsAndImages(node);
|
|
46303
|
-
const
|
|
46304
|
-
const canvas = await html2canvas(node, {
|
|
46305
|
-
scale,
|
|
46306
|
-
useCORS: true,
|
|
46307
|
-
backgroundColor: "#ffffff",
|
|
46308
|
-
logging: false,
|
|
46309
|
-
removeContainer: true
|
|
46310
|
-
});
|
|
46317
|
+
const canvas = await html2canvas(node, getCanvasOptions(node));
|
|
46311
46318
|
const blob = await canvasToBlob(canvas);
|
|
46312
46319
|
if (!blob) throw new Error("Clipboard blob unavailable");
|
|
46313
46320
|
if (!((_a = navigator.clipboard) == null ? void 0 : _a.write)) {
|
|
@@ -46353,15 +46360,7 @@ const exportToImageShare = async (reportRef, actionButtonsRef, lotteryType, tick
|
|
|
46353
46360
|
try {
|
|
46354
46361
|
if (btn) btn.style.visibility = "hidden";
|
|
46355
46362
|
await waitForFontsAndImages(node);
|
|
46356
|
-
const
|
|
46357
|
-
const canvas = await html2canvas(node, {
|
|
46358
|
-
scale,
|
|
46359
|
-
useCORS: true,
|
|
46360
|
-
// enable if your images have CORS headers
|
|
46361
|
-
backgroundColor: "#ffffff",
|
|
46362
|
-
logging: false,
|
|
46363
|
-
removeContainer: true
|
|
46364
|
-
});
|
|
46363
|
+
const canvas = await html2canvas(node, getCanvasOptions(node));
|
|
46365
46364
|
const blob = await canvasToBlob(canvas);
|
|
46366
46365
|
if (!blob) return;
|
|
46367
46366
|
const fileName = `${lotteryType}-#${ticketNumber}.png`;
|