@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.cjs.js
CHANGED
|
@@ -31951,13 +31951,6 @@ const THLabel = {
|
|
|
31951
31951
|
};
|
|
31952
31952
|
const isVNType = (lotteryType) => [lType.MC, lType.TN, lType.KH].includes(lotteryType);
|
|
31953
31953
|
const s3hostPrint = "https://vnonemedia.s3.ap-southeast-1.amazonaws.com/print-logo/";
|
|
31954
|
-
const proxifyS3AssetOnLocalhost = (url) => {
|
|
31955
|
-
if (typeof window === "undefined") return url;
|
|
31956
|
-
const hostname = window.location.hostname;
|
|
31957
|
-
const isLocalhost = hostname === "localhost" || hostname === "127.0.0.1";
|
|
31958
|
-
if (!isLocalhost) return url;
|
|
31959
|
-
return `/__spx_asset_proxy?url=${encodeURIComponent(url)}`;
|
|
31960
|
-
};
|
|
31961
31954
|
const getDomain = (platform) => {
|
|
31962
31955
|
if (platform) return platform;
|
|
31963
31956
|
let url = window.location.hostname;
|
|
@@ -31966,7 +31959,7 @@ const getDomain = (platform) => {
|
|
|
31966
31959
|
let dm = items.reverse()[1];
|
|
31967
31960
|
return dm;
|
|
31968
31961
|
};
|
|
31969
|
-
const getS3ImgPrint = (platform) =>
|
|
31962
|
+
const getS3ImgPrint = (platform) => s3hostPrint.concat(getDomain(platform)).concat(".png");
|
|
31970
31963
|
|
|
31971
31964
|
const TicketPrintBody = (props) => {
|
|
31972
31965
|
const { item, bodyClass, is58, showItemCheckbox = false, selectedIds = [], onToggleItem } = props;
|
|
@@ -38128,7 +38121,7 @@ const RenderTitle = ({ lotteryType, className = "", logo, isVN, drawAt }) => {
|
|
|
38128
38121
|
const RenderHead$1 = ({ logo, platform }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
38129
38122
|
logo && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { className: "mr-2", style: {
|
|
38130
38123
|
width: "50px"
|
|
38131
|
-
}, src: getS3ImgPrint(platform), alt: "__log__" }),
|
|
38124
|
+
}, crossOrigin: "anonymous", src: getS3ImgPrint(platform), alt: "__log__" }),
|
|
38132
38125
|
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"
|
|
38133
38126
|
] });
|
|
38134
38127
|
|
|
@@ -38141,7 +38134,7 @@ function ScopeHost({ className, children, style }) {
|
|
|
38141
38134
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style, ref, className: `spacx bg-transparent ${className}`, children: typeof children === "function" ? children(container) : children });
|
|
38142
38135
|
}
|
|
38143
38136
|
|
|
38144
|
-
const totalStyle = { lineHeight: "
|
|
38137
|
+
const totalStyle = { lineHeight: "25px", fontWeight: 600, fontSize: 25 };
|
|
38145
38138
|
const dotStyle = { lineHeight: "13px", fontWeight: 800, fontSize: 25, color: "black" };
|
|
38146
38139
|
const RenderRow = ({ children, label, isShow = true }) => {
|
|
38147
38140
|
if (!isShow) return null;
|
|
@@ -46276,17 +46269,31 @@ var parseBackgroundColor = function (context, element, backgroundColorOverride)
|
|
|
46276
46269
|
: defaultBackgroundColor;
|
|
46277
46270
|
};
|
|
46278
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
|
+
});
|
|
46279
46287
|
const exportToImage = async (reportRef, actionButtonsRef, lotteryType, ticketNumber) => {
|
|
46280
46288
|
if (!reportRef.current || !actionButtonsRef.current) return;
|
|
46281
46289
|
const originalVisibility = actionButtonsRef.current.style.visibility;
|
|
46282
46290
|
try {
|
|
46283
46291
|
actionButtonsRef.current.style.visibility = "hidden";
|
|
46284
|
-
|
|
46285
|
-
const canvas = await html2canvas(
|
|
46286
|
-
|
|
46287
|
-
|
|
46288
|
-
|
|
46289
|
-
});
|
|
46292
|
+
await waitForFontsAndImages(reportRef.current);
|
|
46293
|
+
const canvas = await html2canvas(
|
|
46294
|
+
reportRef.current,
|
|
46295
|
+
getCanvasOptions(reportRef.current, true)
|
|
46296
|
+
);
|
|
46290
46297
|
const image = canvas.toDataURL(`image/png`, 1);
|
|
46291
46298
|
const link = document.createElement("a");
|
|
46292
46299
|
link.href = image;
|
|
@@ -46307,14 +46314,7 @@ const copyImageToClipboard = async (reportRef, actionButtonsRef, lotteryType, ti
|
|
|
46307
46314
|
try {
|
|
46308
46315
|
if (btn) btn.style.visibility = "hidden";
|
|
46309
46316
|
await waitForFontsAndImages(node);
|
|
46310
|
-
const
|
|
46311
|
-
const canvas = await html2canvas(node, {
|
|
46312
|
-
scale,
|
|
46313
|
-
useCORS: true,
|
|
46314
|
-
backgroundColor: "#ffffff",
|
|
46315
|
-
logging: false,
|
|
46316
|
-
removeContainer: true
|
|
46317
|
-
});
|
|
46317
|
+
const canvas = await html2canvas(node, getCanvasOptions(node));
|
|
46318
46318
|
const blob = await canvasToBlob(canvas);
|
|
46319
46319
|
if (!blob) throw new Error("Clipboard blob unavailable");
|
|
46320
46320
|
if (!((_a = navigator.clipboard) == null ? void 0 : _a.write)) {
|
|
@@ -46360,15 +46360,7 @@ const exportToImageShare = async (reportRef, actionButtonsRef, lotteryType, tick
|
|
|
46360
46360
|
try {
|
|
46361
46361
|
if (btn) btn.style.visibility = "hidden";
|
|
46362
46362
|
await waitForFontsAndImages(node);
|
|
46363
|
-
const
|
|
46364
|
-
const canvas = await html2canvas(node, {
|
|
46365
|
-
scale,
|
|
46366
|
-
useCORS: true,
|
|
46367
|
-
// enable if your images have CORS headers
|
|
46368
|
-
backgroundColor: "#ffffff",
|
|
46369
|
-
logging: false,
|
|
46370
|
-
removeContainer: true
|
|
46371
|
-
});
|
|
46363
|
+
const canvas = await html2canvas(node, getCanvasOptions(node));
|
|
46372
46364
|
const blob = await canvasToBlob(canvas);
|
|
46373
46365
|
if (!blob) return;
|
|
46374
46366
|
const fileName = `${lotteryType}-#${ticketNumber}.png`;
|