erp-pos-ecommerce-shared 0.2.19 → 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/index.js +44 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6109,11 +6109,19 @@ var TableHeader = ({
|
|
|
6109
6109
|
const bgColor = style.bgColor ?? defaultHeaderBgColor;
|
|
6110
6110
|
const hoverBg = style.hoverBgColor ?? defaultHeaderHoverBg;
|
|
6111
6111
|
const hoverText = style.hoverTextColor ?? style.textColor ?? defaultHeaderTextColor;
|
|
6112
|
+
const totalColumnsSize = table.getVisibleLeafColumns().reduce((sum, column) => sum + column.getSize(), 0);
|
|
6112
6113
|
const getSortIcon = (sortState) => {
|
|
6113
6114
|
if (sortState === "asc") return SortIconAsc;
|
|
6114
6115
|
if (sortState === "desc") return SortIconDesc;
|
|
6115
6116
|
return SortIcon;
|
|
6116
6117
|
};
|
|
6118
|
+
const getColumnStyle = (size) => {
|
|
6119
|
+
if (!size || totalColumnsSize <= 0) return void 0;
|
|
6120
|
+
return {
|
|
6121
|
+
width: `${size / totalColumnsSize * 100}%`,
|
|
6122
|
+
minWidth: size
|
|
6123
|
+
};
|
|
6124
|
+
};
|
|
6117
6125
|
const baseButtonStyle = {
|
|
6118
6126
|
padding: style.padding ?? "4px 10px",
|
|
6119
6127
|
fontSize: style.fontSize ?? 14,
|
|
@@ -6155,26 +6163,34 @@ var TableHeader = ({
|
|
|
6155
6163
|
const sortState = header.column.getIsSorted();
|
|
6156
6164
|
const Icon = canSort ? getSortIcon(sortState) : null;
|
|
6157
6165
|
const isHovered = hoveredHeaderId === header.id;
|
|
6158
|
-
return /* @__PURE__ */ jsx(
|
|
6159
|
-
|
|
6166
|
+
return /* @__PURE__ */ jsx(
|
|
6167
|
+
Table.Th,
|
|
6160
6168
|
{
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
header.column.
|
|
6172
|
-
header.
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6169
|
+
bg: bgColor,
|
|
6170
|
+
style: getColumnStyle(header.column.getSize()),
|
|
6171
|
+
children: /* @__PURE__ */ jsxs(
|
|
6172
|
+
UnstyledButton,
|
|
6173
|
+
{
|
|
6174
|
+
style: {
|
|
6175
|
+
...baseButtonStyle,
|
|
6176
|
+
color: isHovered ? hoverText : style.textColor ?? defaultHeaderTextColor,
|
|
6177
|
+
backgroundColor: isHovered ? hoverBg : void 0
|
|
6178
|
+
},
|
|
6179
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
6180
|
+
onMouseEnter: () => setHoveredHeaderId(header.id),
|
|
6181
|
+
onMouseLeave: () => setHoveredHeaderId(null),
|
|
6182
|
+
children: [
|
|
6183
|
+
header.isPlaceholder ? null : flexRender(
|
|
6184
|
+
header.column.columnDef.header,
|
|
6185
|
+
header.getContext()
|
|
6186
|
+
),
|
|
6187
|
+
Icon && /* @__PURE__ */ jsx(Icon, { size: 16 })
|
|
6188
|
+
]
|
|
6189
|
+
}
|
|
6190
|
+
)
|
|
6191
|
+
},
|
|
6192
|
+
header.id
|
|
6193
|
+
);
|
|
6178
6194
|
}),
|
|
6179
6195
|
hasActionsColumn && /* @__PURE__ */ jsx(Table.Th, { bg: bgColor })
|
|
6180
6196
|
] }, headerGroup.id)) });
|
|
@@ -6189,6 +6205,14 @@ var TableBody = ({
|
|
|
6189
6205
|
onRowHover
|
|
6190
6206
|
}) => {
|
|
6191
6207
|
const [hoveredRowId, setHoveredRowId] = useState(null);
|
|
6208
|
+
const totalColumnsSize = table.getVisibleLeafColumns().reduce((sum, column) => sum + column.getSize(), 0);
|
|
6209
|
+
const getColumnStyle = (size) => {
|
|
6210
|
+
if (!size || totalColumnsSize <= 0) return void 0;
|
|
6211
|
+
return {
|
|
6212
|
+
width: `${size / totalColumnsSize * 100}%`,
|
|
6213
|
+
minWidth: size
|
|
6214
|
+
};
|
|
6215
|
+
};
|
|
6192
6216
|
return /* @__PURE__ */ jsx(Table.Tbody, { children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs(
|
|
6193
6217
|
Table.Tr,
|
|
6194
6218
|
{
|
|
@@ -6232,7 +6256,7 @@ var TableBody = ({
|
|
|
6232
6256
|
row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
|
|
6233
6257
|
Table.Td,
|
|
6234
6258
|
{
|
|
6235
|
-
style: cell.column.
|
|
6259
|
+
style: getColumnStyle(cell.column.getSize()),
|
|
6236
6260
|
onClick: () => onRowClick?.(row.original),
|
|
6237
6261
|
children: /* @__PURE__ */ jsx(
|
|
6238
6262
|
Text,
|