@pdg/react-table 1.0.34 → 1.0.35

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.
@@ -8,6 +8,9 @@ export interface InfoTableItem<T = InfoTableInfo> {
8
8
  label: ReactNode;
9
9
  name?: keyof T;
10
10
  ellipsis?: boolean;
11
+ className?: string;
12
+ style?: CommonSxProps['style'];
13
+ sx?: BoxProps['sx'];
11
14
  labelClassName?: string;
12
15
  labelColor?: TypographyProps['color'];
13
16
  labelStyle?: CommonSxProps['style'];
@@ -29,6 +32,10 @@ export interface InfoTableProps<T = InfoTableInfo> {
29
32
  labelColor?: TypographyProps['color'];
30
33
  labelStyle?: CommonSxProps['style'];
31
34
  labelSx?: BoxProps['sx'];
35
+ valueClassName?: string;
36
+ valueStyle?: CommonSxProps['style'];
37
+ valueSx?: CommonSxProps['sx'];
38
+ valueUnderline?: boolean;
32
39
  info: T;
33
40
  items: InfoTableItems<T>;
34
41
  }
package/dist/index.esm.js CHANGED
@@ -9829,23 +9829,27 @@ TableButton.defaultProps = TableButtonDefaultProps;var TableMenuButtonDefaultPro
9829
9829
  });
9830
9830
  TableMenuButton.displayName = 'TableMenuButton';
9831
9831
  TableMenuButton.defaultProps = TableMenuButtonDefaultProps;var InfoTableDefaultProps = {
9832
- spacing: 1,
9832
+ spacing: 2,
9833
9833
  labelColor: 'primary',
9834
9834
  };var Label = styled(Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 12px;\n font-weight: bold;\n"], ["\n font-size: 12px;\n font-weight: bold;\n"])));
9835
- var Value = styled(Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""])));
9835
+ var Value = styled(Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 3px;\n"], ["\n margin-top: 3px;\n"])));
9836
9836
  var ValueEllipsis = styled('div')(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"], ["\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
9837
9837
  var templateObject_1, templateObject_2, templateObject_3;var InfoTable = function (_a) {
9838
- var cols = _a.cols, spacing = _a.spacing, className = _a.className, style = _a.style, sx = _a.sx, labelClassName = _a.labelClassName, labelColor = _a.labelColor, labelStyle = _a.labelStyle, labelSx = _a.labelSx, info = _a.info, items = _a.items;
9838
+ var cols = _a.cols, spacing = _a.spacing, className = _a.className, style = _a.style, sx = _a.sx, labelClassName = _a.labelClassName, labelColor = _a.labelColor, labelStyle = _a.labelStyle, labelSx = _a.labelSx, valueClassName = _a.valueClassName, valueStyle = _a.valueStyle, valueSx = _a.valueSx, valueUnderline = _a.valueUnderline, info = _a.info, items = _a.items;
9839
9839
  var xs = useMemo(function () { return 12 / cols; }, [cols]);
9840
9840
  return (React__default.createElement(Grid, { container: true, spacing: spacing, className: classNames('InfoTable', className), style: style, sx: sx }, items.map(function (item, idx) {
9841
9841
  var finalLabelColor = typographyColorToSxColor(item.labelColor || labelColor);
9842
9842
  var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
9843
+ var finalValueSx = combineSx(valueSx, item.valueSx);
9844
+ var valueUnderlineStyle = valueUnderline
9845
+ ? { borderBottom: '1px solid #efefef', paddingBottom: 5 }
9846
+ : undefined;
9843
9847
  var data = item.name !== undefined ? info[item.name] : undefined;
9844
9848
  if (item.onRender)
9845
9849
  data = item.onRender(info);
9846
- return (React__default.createElement(Grid, { key: idx, item: true, xs: item.xs || xs },
9850
+ return (React__default.createElement(Grid, { key: idx, item: true, xs: item.xs || xs, className: item.className, style: item.style, sx: item.sx },
9847
9851
  React__default.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign$1(__assign$1({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label),
9848
- React__default.createElement(Value, { className: item.valueClassName, style: item.valueStyle, sx: item.valueSx }, item.ellipsis ? React__default.createElement(ValueEllipsis, null, data) : data)));
9852
+ React__default.createElement(Value, { className: classNames(valueClassName, item.valueClassName), style: __assign$1(__assign$1(__assign$1({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx }, item.ellipsis ? React__default.createElement(ValueEllipsis, null, data) : data)));
9849
9853
  })));
9850
9854
  };
9851
9855
  InfoTable.displayName = 'InfoTable';