@pdg/react-table 1.0.37 → 1.0.38
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/InfoTable/InfoTable.types.d.ts +6 -0
- package/dist/index.esm.js +16 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,7 +19,12 @@ export interface InfoTableItem<T = InfoTableInfo> {
|
|
|
19
19
|
valueStyle?: CommonSxProps['style'];
|
|
20
20
|
valueSx?: CommonSxProps['sx'];
|
|
21
21
|
xs?: number;
|
|
22
|
+
sm?: number;
|
|
23
|
+
md?: number;
|
|
24
|
+
lg?: number;
|
|
25
|
+
xl?: number;
|
|
22
26
|
onRender?(info: T): ReactNode;
|
|
27
|
+
onRenderEmpty?(info: T): ReactNode;
|
|
23
28
|
}
|
|
24
29
|
export declare type InfoTableItems<T = InfoTableInfo> = (InfoTableItem<T> | false | undefined | null)[];
|
|
25
30
|
export declare type InfoTableCols = 1 | 2 | 3 | 4 | 6 | 12;
|
|
@@ -42,6 +47,7 @@ export interface InfoTableProps<T = InfoTableInfo> {
|
|
|
42
47
|
valueClassName?: string;
|
|
43
48
|
valueStyle?: CommonSxProps['style'];
|
|
44
49
|
valueSx?: CommonSxProps['sx'];
|
|
50
|
+
ellipsis?: boolean;
|
|
45
51
|
valueUnderline?: boolean;
|
|
46
52
|
info: T;
|
|
47
53
|
items: InfoTableItems<T>;
|
package/dist/index.esm.js
CHANGED
|
@@ -9835,7 +9835,7 @@ TableMenuButton.defaultProps = TableMenuButtonDefaultProps;var InfoTableDefaultP
|
|
|
9835
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, valueClassName = _a.valueClassName, valueStyle = _a.valueStyle, valueSx = _a.valueSx, valueUnderline = _a.valueUnderline, 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, ellipsis = _a.ellipsis, valueUnderline = _a.valueUnderline, info = _a.info, items = _a.items;
|
|
9839
9839
|
var sizeProps = useMemo(function () {
|
|
9840
9840
|
var value = {};
|
|
9841
9841
|
if (typeof cols === 'number') {
|
|
@@ -9863,12 +9863,25 @@ var templateObject_1, templateObject_2, templateObject_3;var InfoTable = functio
|
|
|
9863
9863
|
var valueUnderlineStyle = valueUnderline
|
|
9864
9864
|
? { borderBottom: '1px solid #efefef', paddingBottom: 5 }
|
|
9865
9865
|
: undefined;
|
|
9866
|
+
var finalSizeProps = __assign$1({}, sizeProps);
|
|
9867
|
+
if (item.xs)
|
|
9868
|
+
finalSizeProps.xs = item.xs;
|
|
9869
|
+
if (item.sm)
|
|
9870
|
+
finalSizeProps.sm = item.sm;
|
|
9871
|
+
if (item.md)
|
|
9872
|
+
finalSizeProps.md = item.md;
|
|
9873
|
+
if (item.lg)
|
|
9874
|
+
finalSizeProps.lg = item.lg;
|
|
9875
|
+
if (item.xl)
|
|
9876
|
+
finalSizeProps.xl = item.xl;
|
|
9866
9877
|
var data = item.name !== undefined ? info[item.name] : undefined;
|
|
9867
9878
|
if (item.onRender)
|
|
9868
9879
|
data = item.onRender(info);
|
|
9869
|
-
|
|
9880
|
+
if (empty(data))
|
|
9881
|
+
data = item.onRenderEmpty ? item.onRenderEmpty(info) : React__default.createElement(React__default.Fragment, null, "\u00A0");
|
|
9882
|
+
return (React__default.createElement(Grid, __assign$1({ key: idx, item: true }, finalSizeProps, { className: item.className, style: item.style, sx: item.sx }),
|
|
9870
9883
|
React__default.createElement(Label, { className: classNames(labelClassName, item.labelClassName), style: __assign$1(__assign$1({}, item.labelStyle), labelStyle), sx: finalLabelSx }, item.label),
|
|
9871
|
-
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)));
|
|
9884
|
+
React__default.createElement(Value, { className: classNames(valueClassName, item.valueClassName), style: __assign$1(__assign$1(__assign$1({}, valueStyle), item.valueStyle), valueUnderlineStyle), sx: finalValueSx }, item.ellipsis || ellipsis ? React__default.createElement(ValueEllipsis, null, data) : data)));
|
|
9872
9885
|
}
|
|
9873
9886
|
})));
|
|
9874
9887
|
};
|