@jingx/lottery-components-react-jsx 1.0.24 → 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 +25 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +25 -33
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -31931,13 +31931,6 @@ const THLabel = {
|
|
|
31931
31931
|
};
|
|
31932
31932
|
const isVNType = (lotteryType) => [lType.MC, lType.TN, lType.KH].includes(lotteryType);
|
|
31933
31933
|
const s3hostPrint = "https://vnonemedia.s3.ap-southeast-1.amazonaws.com/print-logo/";
|
|
31934
|
-
const proxifyS3AssetOnLocalhost = (url) => {
|
|
31935
|
-
if (typeof window === "undefined") return url;
|
|
31936
|
-
const hostname = window.location.hostname;
|
|
31937
|
-
const isLocalhost = hostname === "localhost" || hostname === "127.0.0.1";
|
|
31938
|
-
if (!isLocalhost) return url;
|
|
31939
|
-
return `/__spx_asset_proxy?url=${encodeURIComponent(url)}`;
|
|
31940
|
-
};
|
|
31941
31934
|
const getDomain = (platform) => {
|
|
31942
31935
|
if (platform) return platform;
|
|
31943
31936
|
let url = window.location.hostname;
|
|
@@ -31946,7 +31939,7 @@ const getDomain = (platform) => {
|
|
|
31946
31939
|
let dm = items.reverse()[1];
|
|
31947
31940
|
return dm;
|
|
31948
31941
|
};
|
|
31949
|
-
const getS3ImgPrint = (platform) =>
|
|
31942
|
+
const getS3ImgPrint = (platform) => s3hostPrint.concat(getDomain(platform)).concat(".png");
|
|
31950
31943
|
|
|
31951
31944
|
const TicketPrintBody = (props) => {
|
|
31952
31945
|
const { item, bodyClass, is58, showItemCheckbox = false, selectedIds = [], onToggleItem } = props;
|
|
@@ -38108,7 +38101,7 @@ const RenderTitle = ({ lotteryType, className = "", logo, isVN, drawAt }) => {
|
|
|
38108
38101
|
const RenderHead$1 = ({ logo, platform }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
38109
38102
|
logo && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { className: "mr-2", style: {
|
|
38110
38103
|
width: "50px"
|
|
38111
|
-
}, src: getS3ImgPrint(platform), alt: "__log__" }),
|
|
38104
|
+
}, crossOrigin: "anonymous", src: getS3ImgPrint(platform), alt: "__log__" }),
|
|
38112
38105
|
logo ? "\u1786\u17D2\u1793\u17C4\u178F\u1782\u17D2\u179A\u1794\u17CB\u1794\u17D2\u179A\u1797\u17C1\u1791" : "\u1786\u17D2\u1793\u17C4\u178F\u1795\u17D2\u179F\u1784\u179F\u17C6\u178E\u17B6\u1784"
|
|
38113
38106
|
] });
|
|
38114
38107
|
|
|
@@ -38121,7 +38114,7 @@ function ScopeHost({ className, children, style }) {
|
|
|
38121
38114
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style, ref, className: `spacx bg-transparent ${className}`, children: typeof children === "function" ? children(container) : children });
|
|
38122
38115
|
}
|
|
38123
38116
|
|
|
38124
|
-
const totalStyle = { lineHeight: "
|
|
38117
|
+
const totalStyle = { lineHeight: "25px", fontWeight: 600, fontSize: 25 };
|
|
38125
38118
|
const dotStyle = { lineHeight: "13px", fontWeight: 800, fontSize: 25, color: "black" };
|
|
38126
38119
|
const RenderRow = ({ children, label, isShow = true }) => {
|
|
38127
38120
|
if (!isShow) return null;
|
|
@@ -46256,17 +46249,31 @@ var parseBackgroundColor = function (context, element, backgroundColorOverride)
|
|
|
46256
46249
|
: defaultBackgroundColor;
|
|
46257
46250
|
};
|
|
46258
46251
|
|
|
46252
|
+
const getCanvasScale = () => {
|
|
46253
|
+
const deviceScale = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
46254
|
+
return Math.max(deviceScale, 5);
|
|
46255
|
+
};
|
|
46256
|
+
const getCanvasOptions = (node, useCORS = true) => ({
|
|
46257
|
+
scale: getCanvasScale(),
|
|
46258
|
+
useCORS,
|
|
46259
|
+
backgroundColor: "#ffffff",
|
|
46260
|
+
logging: false,
|
|
46261
|
+
removeContainer: true,
|
|
46262
|
+
width: node.scrollWidth,
|
|
46263
|
+
height: node.scrollHeight,
|
|
46264
|
+
windowWidth: node.scrollWidth,
|
|
46265
|
+
windowHeight: node.scrollHeight
|
|
46266
|
+
});
|
|
46259
46267
|
const exportToImage = async (reportRef, actionButtonsRef, lotteryType, ticketNumber) => {
|
|
46260
46268
|
if (!reportRef.current || !actionButtonsRef.current) return;
|
|
46261
46269
|
const originalVisibility = actionButtonsRef.current.style.visibility;
|
|
46262
46270
|
try {
|
|
46263
46271
|
actionButtonsRef.current.style.visibility = "hidden";
|
|
46264
|
-
|
|
46265
|
-
const canvas = await html2canvas(
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46269
|
-
});
|
|
46272
|
+
await waitForFontsAndImages(reportRef.current);
|
|
46273
|
+
const canvas = await html2canvas(
|
|
46274
|
+
reportRef.current,
|
|
46275
|
+
getCanvasOptions(reportRef.current, true)
|
|
46276
|
+
);
|
|
46270
46277
|
const image = canvas.toDataURL(`image/png`, 1);
|
|
46271
46278
|
const link = document.createElement("a");
|
|
46272
46279
|
link.href = image;
|
|
@@ -46287,14 +46294,7 @@ const copyImageToClipboard = async (reportRef, actionButtonsRef, lotteryType, ti
|
|
|
46287
46294
|
try {
|
|
46288
46295
|
if (btn) btn.style.visibility = "hidden";
|
|
46289
46296
|
await waitForFontsAndImages(node);
|
|
46290
|
-
const
|
|
46291
|
-
const canvas = await html2canvas(node, {
|
|
46292
|
-
scale,
|
|
46293
|
-
useCORS: true,
|
|
46294
|
-
backgroundColor: "#ffffff",
|
|
46295
|
-
logging: false,
|
|
46296
|
-
removeContainer: true
|
|
46297
|
-
});
|
|
46297
|
+
const canvas = await html2canvas(node, getCanvasOptions(node));
|
|
46298
46298
|
const blob = await canvasToBlob(canvas);
|
|
46299
46299
|
if (!blob) throw new Error("Clipboard blob unavailable");
|
|
46300
46300
|
if (!((_a = navigator.clipboard) == null ? void 0 : _a.write)) {
|
|
@@ -46340,15 +46340,7 @@ const exportToImageShare = async (reportRef, actionButtonsRef, lotteryType, tick
|
|
|
46340
46340
|
try {
|
|
46341
46341
|
if (btn) btn.style.visibility = "hidden";
|
|
46342
46342
|
await waitForFontsAndImages(node);
|
|
46343
|
-
const
|
|
46344
|
-
const canvas = await html2canvas(node, {
|
|
46345
|
-
scale,
|
|
46346
|
-
useCORS: true,
|
|
46347
|
-
// enable if your images have CORS headers
|
|
46348
|
-
backgroundColor: "#ffffff",
|
|
46349
|
-
logging: false,
|
|
46350
|
-
removeContainer: true
|
|
46351
|
-
});
|
|
46343
|
+
const canvas = await html2canvas(node, getCanvasOptions(node));
|
|
46352
46344
|
const blob = await canvasToBlob(canvas);
|
|
46353
46345
|
if (!blob) return;
|
|
46354
46346
|
const fileName = `${lotteryType}-#${ticketNumber}.png`;
|