erp-pos-ecommerce-shared 0.2.18 → 0.2.20
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/components.js +44 -20
- package/dist/components.js.map +1 -1
- package/dist/hooks.d.ts +6 -4
- package/dist/hooks.js +16 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +60 -21
- package/dist/index.js.map +1 -1
- package/dist/queries.d.ts +12 -3
- package/dist/queries.js +11 -0
- package/dist/queries.js.map +1 -1
- package/dist/services.d.ts +1 -1
- package/dist/services.js +5 -1
- package/dist/services.js.map +1 -1
- package/dist/{shift.queries-Cy85o6l8.d.ts → shift.queries-CaMY7FWd.d.ts} +1 -1
- package/dist/{warehouse.service-C51KYjQB.d.ts → warehouse.service-CV2UDqAD.d.ts} +2 -1
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -1335,11 +1335,19 @@ var TableHeader = ({
|
|
|
1335
1335
|
const bgColor = style.bgColor ?? defaultHeaderBgColor;
|
|
1336
1336
|
const hoverBg = style.hoverBgColor ?? defaultHeaderHoverBg;
|
|
1337
1337
|
const hoverText = style.hoverTextColor ?? style.textColor ?? defaultHeaderTextColor;
|
|
1338
|
+
const totalColumnsSize = table.getVisibleLeafColumns().reduce((sum, column) => sum + column.getSize(), 0);
|
|
1338
1339
|
const getSortIcon = (sortState) => {
|
|
1339
1340
|
if (sortState === "asc") return SortIconAsc;
|
|
1340
1341
|
if (sortState === "desc") return SortIconDesc;
|
|
1341
1342
|
return SortIcon;
|
|
1342
1343
|
};
|
|
1344
|
+
const getColumnStyle = (size) => {
|
|
1345
|
+
if (!size || totalColumnsSize <= 0) return void 0;
|
|
1346
|
+
return {
|
|
1347
|
+
width: `${size / totalColumnsSize * 100}%`,
|
|
1348
|
+
minWidth: size
|
|
1349
|
+
};
|
|
1350
|
+
};
|
|
1343
1351
|
const baseButtonStyle = {
|
|
1344
1352
|
padding: style.padding ?? "4px 10px",
|
|
1345
1353
|
fontSize: style.fontSize ?? 14,
|
|
@@ -1381,26 +1389,34 @@ var TableHeader = ({
|
|
|
1381
1389
|
const sortState = header.column.getIsSorted();
|
|
1382
1390
|
const Icon = canSort ? getSortIcon(sortState) : null;
|
|
1383
1391
|
const isHovered = hoveredHeaderId === header.id;
|
|
1384
|
-
return /* @__PURE__ */ jsx(
|
|
1385
|
-
|
|
1392
|
+
return /* @__PURE__ */ jsx(
|
|
1393
|
+
Table.Th,
|
|
1386
1394
|
{
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
header.column.
|
|
1398
|
-
header.
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1395
|
+
bg: bgColor,
|
|
1396
|
+
style: getColumnStyle(header.column.getSize()),
|
|
1397
|
+
children: /* @__PURE__ */ jsxs(
|
|
1398
|
+
UnstyledButton,
|
|
1399
|
+
{
|
|
1400
|
+
style: {
|
|
1401
|
+
...baseButtonStyle,
|
|
1402
|
+
color: isHovered ? hoverText : style.textColor ?? defaultHeaderTextColor,
|
|
1403
|
+
backgroundColor: isHovered ? hoverBg : void 0
|
|
1404
|
+
},
|
|
1405
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
1406
|
+
onMouseEnter: () => setHoveredHeaderId(header.id),
|
|
1407
|
+
onMouseLeave: () => setHoveredHeaderId(null),
|
|
1408
|
+
children: [
|
|
1409
|
+
header.isPlaceholder ? null : flexRender(
|
|
1410
|
+
header.column.columnDef.header,
|
|
1411
|
+
header.getContext()
|
|
1412
|
+
),
|
|
1413
|
+
Icon && /* @__PURE__ */ jsx(Icon, { size: 16 })
|
|
1414
|
+
]
|
|
1415
|
+
}
|
|
1416
|
+
)
|
|
1417
|
+
},
|
|
1418
|
+
header.id
|
|
1419
|
+
);
|
|
1404
1420
|
}),
|
|
1405
1421
|
hasActionsColumn && /* @__PURE__ */ jsx(Table.Th, { bg: bgColor })
|
|
1406
1422
|
] }, headerGroup.id)) });
|
|
@@ -1415,6 +1431,14 @@ var TableBody = ({
|
|
|
1415
1431
|
onRowHover
|
|
1416
1432
|
}) => {
|
|
1417
1433
|
const [hoveredRowId, setHoveredRowId] = useState(null);
|
|
1434
|
+
const totalColumnsSize = table.getVisibleLeafColumns().reduce((sum, column) => sum + column.getSize(), 0);
|
|
1435
|
+
const getColumnStyle = (size) => {
|
|
1436
|
+
if (!size || totalColumnsSize <= 0) return void 0;
|
|
1437
|
+
return {
|
|
1438
|
+
width: `${size / totalColumnsSize * 100}%`,
|
|
1439
|
+
minWidth: size
|
|
1440
|
+
};
|
|
1441
|
+
};
|
|
1418
1442
|
return /* @__PURE__ */ jsx(Table.Tbody, { children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs(
|
|
1419
1443
|
Table.Tr,
|
|
1420
1444
|
{
|
|
@@ -1458,7 +1482,7 @@ var TableBody = ({
|
|
|
1458
1482
|
row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
|
|
1459
1483
|
Table.Td,
|
|
1460
1484
|
{
|
|
1461
|
-
style: cell.column.
|
|
1485
|
+
style: getColumnStyle(cell.column.getSize()),
|
|
1462
1486
|
onClick: () => onRowClick?.(row.original),
|
|
1463
1487
|
children: /* @__PURE__ */ jsx(
|
|
1464
1488
|
Text,
|