react-better-html 1.1.108 → 1.1.110

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.d.mts CHANGED
@@ -665,10 +665,13 @@ type ElementColumn<DataItem> = {
665
665
  type ImageColumn<DataItem> = {
666
666
  type: "image";
667
667
  keyName?: keyof DataItem;
668
- } & ImageProps;
668
+ getImageSrc?: (item: DataItem, index: number) => string;
669
+ imageProps?: ImageProps;
670
+ };
669
671
  type CheckboxColumn = {
670
672
  type: "checkbox";
671
- } & ToggleInputProps<boolean>;
673
+ toggleInputProps?: ToggleInputProps<boolean>;
674
+ };
672
675
  type NumberFilter<DataItem> = {
673
676
  filter?: "number";
674
677
  getValue?: (item: DataItem) => number;
package/dist/index.d.ts CHANGED
@@ -665,10 +665,13 @@ type ElementColumn<DataItem> = {
665
665
  type ImageColumn<DataItem> = {
666
666
  type: "image";
667
667
  keyName?: keyof DataItem;
668
- } & ImageProps;
668
+ getImageSrc?: (item: DataItem, index: number) => string;
669
+ imageProps?: ImageProps;
670
+ };
669
671
  type CheckboxColumn = {
670
672
  type: "checkbox";
671
- } & ToggleInputProps<boolean>;
673
+ toggleInputProps?: ToggleInputProps<boolean>;
674
+ };
672
675
  type NumberFilter<DataItem> = {
673
676
  filter?: "number";
674
677
  getValue?: (item: DataItem) => number;
package/dist/index.js CHANGED
@@ -6860,7 +6860,7 @@ var ColorThemeSwitch_default = ColorThemeSwitch2;
6860
6860
  var import_react23 = require("react");
6861
6861
  var import_styled_components11 = __toESM(require("styled-components"));
6862
6862
  var import_jsx_runtime21 = require("react/jsx-runtime");
6863
- var defaultImageWidth = 120;
6863
+ var defaultImageWidth = 160;
6864
6864
  var maximumVisiblePages = 11;
6865
6865
  var TableStyledComponent = import_styled_components11.default.table.withConfig({
6866
6866
  shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
@@ -7005,12 +7005,11 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7005
7005
  return column.render?.(item, index) ?? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
7006
7006
  }
7007
7007
  case "image": {
7008
- const { type, keyName, ...props2 } = column;
7009
- const src = keyName ? item[keyName] : void 0;
7010
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, { src, width: defaultImageWidth, borderRadius: theme2.styles.borderRadius / 2, ...props2 });
7008
+ const src = column.getImageSrc?.(item, index) ?? (column.keyName ? item[column.keyName] : void 0);
7009
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, { src, width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...column.imageProps });
7011
7010
  }
7012
7011
  case "checkbox": {
7013
- const { type, onChange, ...props2 } = column;
7012
+ const { onChange, ...toggleInputProps } = column.toggleInputProps ?? {};
7014
7013
  const checkedValue = checkedItems[index];
7015
7014
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7016
7015
  ToggleInput_default.checkbox,
@@ -7022,7 +7021,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7022
7021
  );
7023
7022
  onChange?.(checked, value);
7024
7023
  },
7025
- ...props2
7024
+ ...toggleInputProps
7026
7025
  }
7027
7026
  );
7028
7027
  }
@@ -7287,7 +7286,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7287
7286
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7288
7287
  ThStyledComponent,
7289
7288
  {
7290
- width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
7289
+ width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : void 0),
7291
7290
  minWidth: column.minWidth,
7292
7291
  maxWidth: column.maxWidth,
7293
7292
  textAlign: column.align,