@jingx/lottery-components-react-jsx 1.0.47 → 1.0.48
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 +107 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +107 -28
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -31083,7 +31083,19 @@ const getDomain = (platform) => {
|
|
|
31083
31083
|
const getS3ImgPrint = (platform) => s3hostPrint.concat(getDomain(platform)).concat(".png");
|
|
31084
31084
|
|
|
31085
31085
|
const TicketPrintBody = (props) => {
|
|
31086
|
-
const {
|
|
31086
|
+
const {
|
|
31087
|
+
item,
|
|
31088
|
+
bodyClass,
|
|
31089
|
+
is58,
|
|
31090
|
+
showItemCheckbox = false,
|
|
31091
|
+
selectedIds = [],
|
|
31092
|
+
onToggleItem,
|
|
31093
|
+
isProtest,
|
|
31094
|
+
isSystem,
|
|
31095
|
+
showDoubleCheckbox = false,
|
|
31096
|
+
doubleIds = [],
|
|
31097
|
+
onToggleDouble
|
|
31098
|
+
} = props;
|
|
31087
31099
|
const returnMargin = (length) => {
|
|
31088
31100
|
switch (length) {
|
|
31089
31101
|
case 1:
|
|
@@ -31418,17 +31430,32 @@ const TicketPrintBody = (props) => {
|
|
|
31418
31430
|
const itemId = getItemId(obj, i);
|
|
31419
31431
|
const isSend = Boolean(obj == null ? void 0 : obj.isSend);
|
|
31420
31432
|
const isChecked = selectedIds.includes(itemId);
|
|
31421
|
-
|
|
31422
|
-
|
|
31423
|
-
|
|
31424
|
-
{
|
|
31425
|
-
|
|
31426
|
-
|
|
31427
|
-
|
|
31428
|
-
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31433
|
+
const isDoubleChecked = doubleIds.includes(itemId);
|
|
31434
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "d-flex align-items-start justify-content-between w-100", children: [
|
|
31435
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "d-flex align-items-start", children: [
|
|
31436
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pr-2", children: isSend ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "transfer-ticket-send-icon", title: "Sent", children: /* @__PURE__ */ jsxRuntime.jsx(ArrowUp, { size: 16 }) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
31437
|
+
"input",
|
|
31438
|
+
{
|
|
31439
|
+
type: "checkbox",
|
|
31440
|
+
className: "transfer-ticket-checkbox",
|
|
31441
|
+
checked: isChecked,
|
|
31442
|
+
onChange: () => onToggleItem && onToggleItem(itemId)
|
|
31443
|
+
}
|
|
31444
|
+
) }),
|
|
31445
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-grow-1 ${isSend ? "transfer-ticket-item-send" : ""}`, children: node })
|
|
31446
|
+
] }),
|
|
31447
|
+
showDoubleCheckbox && !isSend && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pl-2 d-flex align-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "m-0 d-inline-flex align-items-center text-black font-weight-bold", style: { cursor: "pointer" }, children: [
|
|
31448
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31449
|
+
"input",
|
|
31450
|
+
{
|
|
31451
|
+
type: "checkbox",
|
|
31452
|
+
className: "transfer-ticket-checkbox mr-1",
|
|
31453
|
+
checked: isDoubleChecked,
|
|
31454
|
+
onChange: () => onToggleDouble && onToggleDouble(itemId)
|
|
31455
|
+
}
|
|
31456
|
+
),
|
|
31457
|
+
"X2"
|
|
31458
|
+
] }) })
|
|
31432
31459
|
] }, `select-${itemId}-${i}`);
|
|
31433
31460
|
};
|
|
31434
31461
|
const wrapWithCheckboxProtest = (node, obj, i) => {
|
|
@@ -37380,6 +37407,7 @@ const TransferTicket = ({
|
|
|
37380
37407
|
onSelectedIdsChange
|
|
37381
37408
|
}) => {
|
|
37382
37409
|
const [selectedIds, setSelectedIds] = React.useState([]);
|
|
37410
|
+
const [doubleIds, setDoubleIds] = React.useState([]);
|
|
37383
37411
|
const checkAllRef = React.useRef(null);
|
|
37384
37412
|
const isNight = object == null ? void 0 : object.isNight;
|
|
37385
37413
|
const selectableItemIds = React.useMemo(() => {
|
|
@@ -37397,10 +37425,14 @@ const TransferTicket = ({
|
|
|
37397
37425
|
}, [object == null ? void 0 : object.postGroup]);
|
|
37398
37426
|
const selectableIdSet = React.useMemo(() => new Set(selectableItemIds), [selectableItemIds]);
|
|
37399
37427
|
const allChecked = selectableItemIds.length > 0 && selectableItemIds.every((id) => selectedIds.includes(id));
|
|
37428
|
+
const allDoubleChecked = selectableItemIds.length > 0 && selectableItemIds.every((id) => doubleIds.includes(id));
|
|
37400
37429
|
const isIndeterminate = selectedIds.length > 0 && !allChecked;
|
|
37401
37430
|
React.useEffect(() => {
|
|
37402
37431
|
setSelectedIds((prev) => prev.filter((id) => selectableIdSet.has(id)));
|
|
37403
37432
|
}, [selectableIdSet]);
|
|
37433
|
+
React.useEffect(() => {
|
|
37434
|
+
setDoubleIds((prev) => prev.filter((id) => selectableIdSet.has(id) && selectedIds.includes(id)));
|
|
37435
|
+
}, [selectableIdSet, selectedIds]);
|
|
37404
37436
|
React.useEffect(() => {
|
|
37405
37437
|
if (checkAllRef.current) {
|
|
37406
37438
|
checkAllRef.current.indeterminate = isIndeterminate;
|
|
@@ -37408,9 +37440,16 @@ const TransferTicket = ({
|
|
|
37408
37440
|
}, [isIndeterminate]);
|
|
37409
37441
|
React.useEffect(() => {
|
|
37410
37442
|
if (typeof onSelectedIdsChange === "function") {
|
|
37411
|
-
|
|
37443
|
+
const mappedItems = selectedIds.map((id) => {
|
|
37444
|
+
const numId = isNaN(Number(id)) ? id : Number(id);
|
|
37445
|
+
return {
|
|
37446
|
+
orderItemId: numId,
|
|
37447
|
+
isDouble: doubleIds.includes(id)
|
|
37448
|
+
};
|
|
37449
|
+
});
|
|
37450
|
+
onSelectedIdsChange(mappedItems);
|
|
37412
37451
|
}
|
|
37413
|
-
}, [onSelectedIdsChange, selectedIds]);
|
|
37452
|
+
}, [onSelectedIdsChange, selectedIds, doubleIds]);
|
|
37414
37453
|
const toggleItem = (itemId) => {
|
|
37415
37454
|
if (!selectableIdSet.has(itemId)) return;
|
|
37416
37455
|
setSelectedIds((prev) => {
|
|
@@ -37418,6 +37457,19 @@ const TransferTicket = ({
|
|
|
37418
37457
|
return [...prev, itemId];
|
|
37419
37458
|
});
|
|
37420
37459
|
};
|
|
37460
|
+
const toggleDouble = (itemId) => {
|
|
37461
|
+
if (!selectableIdSet.has(itemId)) return;
|
|
37462
|
+
setDoubleIds((prev) => {
|
|
37463
|
+
if (prev.includes(itemId)) return prev.filter((id) => id !== itemId);
|
|
37464
|
+
setSelectedIds((selPrev) => {
|
|
37465
|
+
if (!selPrev.includes(itemId)) {
|
|
37466
|
+
return [...selPrev, itemId];
|
|
37467
|
+
}
|
|
37468
|
+
return selPrev;
|
|
37469
|
+
});
|
|
37470
|
+
return [...prev, itemId];
|
|
37471
|
+
});
|
|
37472
|
+
};
|
|
37421
37473
|
const toggleAll = () => {
|
|
37422
37474
|
setSelectedIds((prev) => {
|
|
37423
37475
|
if (selectableItemIds.length === 0) return prev;
|
|
@@ -37425,6 +37477,15 @@ const TransferTicket = ({
|
|
|
37425
37477
|
return selectableItemIds;
|
|
37426
37478
|
});
|
|
37427
37479
|
};
|
|
37480
|
+
const toggleAllDouble = () => {
|
|
37481
|
+
if (selectableItemIds.length === 0) return;
|
|
37482
|
+
if (allDoubleChecked) {
|
|
37483
|
+
setDoubleIds([]);
|
|
37484
|
+
} else {
|
|
37485
|
+
setSelectedIds(selectableItemIds);
|
|
37486
|
+
setDoubleIds(selectableItemIds);
|
|
37487
|
+
}
|
|
37488
|
+
};
|
|
37428
37489
|
return /* @__PURE__ */ jsxRuntime.jsx(ScopeHost, { children: /* @__PURE__ */ jsxRuntime.jsx("table", { id: "transfer-ticket-58", className: "print-tb-58-1", cellPadding: "7px", children: /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
37429
37490
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { style: { lineHeight: "35px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37430
37491
|
RenderTitle,
|
|
@@ -37446,19 +37507,34 @@ const TransferTicket = ({
|
|
|
37446
37507
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "f-16", children: getDateTime(object == null ? void 0 : object.drawAt) })
|
|
37447
37508
|
] }) }) }),
|
|
37448
37509
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { className: "p-0 pb-2", colSpan: 3, children: /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-top-ticket" }) }) }),
|
|
37449
|
-
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 3, className: "p-0
|
|
37450
|
-
/* @__PURE__ */ jsxRuntime.
|
|
37451
|
-
|
|
37452
|
-
|
|
37453
|
-
|
|
37454
|
-
|
|
37455
|
-
|
|
37456
|
-
|
|
37457
|
-
|
|
37458
|
-
|
|
37459
|
-
|
|
37460
|
-
|
|
37461
|
-
|
|
37510
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 3, className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center", children: [
|
|
37511
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "m-0 d-inline-flex align-items-center text-black font-weight-bold", style: { cursor: "pointer" }, children: [
|
|
37512
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37513
|
+
"input",
|
|
37514
|
+
{
|
|
37515
|
+
ref: checkAllRef,
|
|
37516
|
+
type: "checkbox",
|
|
37517
|
+
className: "transfer-ticket-checkbox",
|
|
37518
|
+
checked: allChecked,
|
|
37519
|
+
disabled: selectableItemIds.length === 0,
|
|
37520
|
+
onChange: toggleAll
|
|
37521
|
+
}
|
|
37522
|
+
),
|
|
37523
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 f-16", children: "Check all" })
|
|
37524
|
+
] }),
|
|
37525
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "m-0 d-inline-flex align-items-center text-black font-weight-bold", style: { cursor: "pointer" }, children: [
|
|
37526
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37527
|
+
"input",
|
|
37528
|
+
{
|
|
37529
|
+
type: "checkbox",
|
|
37530
|
+
className: "transfer-ticket-checkbox",
|
|
37531
|
+
checked: allDoubleChecked,
|
|
37532
|
+
disabled: selectableItemIds.length === 0,
|
|
37533
|
+
onChange: toggleAllDouble
|
|
37534
|
+
}
|
|
37535
|
+
),
|
|
37536
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 f-16", children: "X2 All" })
|
|
37537
|
+
] })
|
|
37462
37538
|
] }) }) }),
|
|
37463
37539
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 3, className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37464
37540
|
PrintTicket58,
|
|
@@ -37469,7 +37545,10 @@ const TransferTicket = ({
|
|
|
37469
37545
|
postGroup: object == null ? void 0 : object.postGroup,
|
|
37470
37546
|
showItemCheckbox: true,
|
|
37471
37547
|
selectedIds,
|
|
37472
|
-
onToggleItem: toggleItem
|
|
37548
|
+
onToggleItem: toggleItem,
|
|
37549
|
+
showDoubleCheckbox: true,
|
|
37550
|
+
doubleIds,
|
|
37551
|
+
onToggleDouble: toggleDouble
|
|
37473
37552
|
}
|
|
37474
37553
|
) }) }),
|
|
37475
37554
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 3, children: /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-top-ticket" }) }) })
|