@bwp-web/components 1.3.0 → 1.3.1

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.js CHANGED
@@ -1125,6 +1125,7 @@ function BiampTableRowInner({
1125
1125
  selectChildrenWithParent,
1126
1126
  getRowLabel,
1127
1127
  hasExpandableRows,
1128
+ customColor,
1128
1129
  rowSlotProps,
1129
1130
  cellSlotProps
1130
1131
  }) {
@@ -1144,7 +1145,11 @@ function BiampTableRowInner({
1144
1145
  selected: enableRowSelection ? isSelected : void 0,
1145
1146
  role: clickable ? "button" : void 0,
1146
1147
  tabIndex: clickable ? 0 : void 0,
1147
- sx: mergeSx(clickable && rowCursorPointerSx, userRowSx),
1148
+ sx: mergeSx(
1149
+ clickable && rowCursorPointerSx,
1150
+ customColor ? { backgroundColor: customColor } : void 0,
1151
+ userRowSx
1152
+ ),
1148
1153
  onClick: clickable && onRowClick ? (e) => {
1149
1154
  onRowClick(row.original);
1150
1155
  userRowOnClick?.(e);
@@ -1157,23 +1162,33 @@ function BiampTableRowInner({
1157
1162
  userRowOnKeyDown?.(e);
1158
1163
  } : userRowOnKeyDown,
1159
1164
  children: [
1160
- enableRowSelection && /* @__PURE__ */ jsx8(TableCell, { padding: "checkbox", sx: selectionCellSx, children: /* @__PURE__ */ jsx8(
1161
- Checkbox,
1165
+ enableRowSelection && /* @__PURE__ */ jsx8(
1166
+ TableCell,
1162
1167
  {
1163
- checked: isSelected,
1164
- disabled: !row.getCanSelect(),
1165
- onChange: (e) => row.toggleSelected(e.target.checked, {
1166
- selectChildren: selectChildrenWithParent
1167
- }),
1168
- onClick: (e) => e.stopPropagation(),
1169
- sx: !row.getCanSelect() ? checkboxHiddenSx : void 0,
1170
- slotProps: {
1171
- input: {
1172
- "aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
1168
+ padding: "checkbox",
1169
+ sx: mergeSx(
1170
+ selectionCellSx,
1171
+ customColor ? { backgroundColor: customColor } : void 0
1172
+ ),
1173
+ children: /* @__PURE__ */ jsx8(
1174
+ Checkbox,
1175
+ {
1176
+ checked: isSelected,
1177
+ disabled: !row.getCanSelect(),
1178
+ onChange: (e) => row.toggleSelected(e.target.checked, {
1179
+ selectChildren: selectChildrenWithParent
1180
+ }),
1181
+ onClick: (e) => e.stopPropagation(),
1182
+ sx: !row.getCanSelect() ? checkboxHiddenSx : void 0,
1183
+ slotProps: {
1184
+ input: {
1185
+ "aria-label": getRowLabel ? `Select ${getRowLabel(row.original)}` : `Select row ${row.index + 1}`
1186
+ }
1187
+ }
1173
1188
  }
1174
- }
1189
+ )
1175
1190
  }
1176
- ) }),
1191
+ ),
1177
1192
  row.getVisibleCells().map((cell, cellIndex, cells) => {
1178
1193
  const sticky = cell.column.columnDef.meta?.sticky;
1179
1194
  const isExpandCell = enableExpanding && !sticky && cellIndex === cells.findIndex((c) => !c.column.columnDef.meta?.sticky);
@@ -1191,6 +1206,7 @@ function BiampTableRowInner({
1191
1206
  sx: mergeSx(
1192
1207
  cellSx(sticky, cell.column.columnDef.meta?.minWidth, 2),
1193
1208
  { pl: isExpandCell ? "6px" : "12px" },
1209
+ sticky && customColor ? { backgroundColor: customColor } : void 0,
1194
1210
  userCellSx
1195
1211
  ),
1196
1212
  children: (() => {
@@ -1248,7 +1264,7 @@ function BiampTableRowInner({
1248
1264
  );
1249
1265
  }
1250
1266
  function biampTableRowPropsAreEqual(prev, next) {
1251
- return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
1267
+ return prev.row.id === next.row.id && prev.row.original === next.row.original && prev.isSelected === next.isSelected && prev.isExpanded === next.isExpanded && prev.row.getVisibleCells().length === next.row.getVisibleCells().length && prev.enableRowSelection === next.enableRowSelection && prev.enableExpanding === next.enableExpanding && prev.hasExpandableRows === next.hasExpandableRows && prev.selectChildrenWithParent === next.selectChildrenWithParent && prev.onRowClick === next.onRowClick && prev.isRowClickable === next.isRowClickable && prev.getRowLabel === next.getRowLabel && prev.customColor === next.customColor && prev.rowSlotProps === next.rowSlotProps && prev.cellSlotProps === next.cellSlotProps;
1252
1268
  }
1253
1269
  var BiampTableRow = React2.memo(
1254
1270
  BiampTableRowInner,
@@ -1266,6 +1282,7 @@ function BiampTable({
1266
1282
  hideSelectAll,
1267
1283
  selectChildrenWithParent = false,
1268
1284
  getRowLabel,
1285
+ setRowColor,
1269
1286
  slotProps,
1270
1287
  sx,
1271
1288
  ...boxProps
@@ -1390,6 +1407,7 @@ function BiampTable({
1390
1407
  selectChildrenWithParent,
1391
1408
  getRowLabel,
1392
1409
  hasExpandableRows,
1410
+ customColor: setRowColor?.(row.original),
1393
1411
  rowSlotProps: slotProps?.row,
1394
1412
  cellSlotProps: slotProps?.cell
1395
1413
  },