@pdg/react-table 1.0.42 → 1.0.44
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 +3 -1
- package/dist/Table/Table.types.d.ts +1 -0
- package/dist/index.esm.js +27 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,8 @@ export interface InfoTableProps<T = InfoTableInfo> {
|
|
|
41
41
|
xl?: InfoTableCols;
|
|
42
42
|
};
|
|
43
43
|
spacing?: GridProps['spacing'];
|
|
44
|
+
columnSpacing?: GridProps['spacing'];
|
|
45
|
+
rowSpacing?: GridProps['spacing'];
|
|
44
46
|
className?: string;
|
|
45
47
|
style?: CommonSxProps['style'];
|
|
46
48
|
sx?: CommonSxProps['sx'];
|
|
@@ -57,4 +59,4 @@ export interface InfoTableProps<T = InfoTableInfo> {
|
|
|
57
59
|
items: InfoTableItems<T>;
|
|
58
60
|
onCopyToClipboard?(item: InfoTableItem<T>, text: string): void;
|
|
59
61
|
}
|
|
60
|
-
export declare const InfoTableDefaultProps: Pick<InfoTableProps, 'spacing' | 'labelColor'>;
|
|
62
|
+
export declare const InfoTableDefaultProps: Pick<InfoTableProps, 'spacing' | 'columnSpacing' | 'rowSpacing' | 'labelColor'>;
|
package/dist/index.esm.js
CHANGED
|
@@ -8922,6 +8922,7 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
8922
8922
|
var localBodyDataRef = useRef({});
|
|
8923
8923
|
var updateHeadCheckTimer = useRef();
|
|
8924
8924
|
var fireOnCheckChangeTimer = useRef({});
|
|
8925
|
+
var simpleBarRef = useRef(null);
|
|
8925
8926
|
// sortable --------------------------------------------------------------------------------------------------------
|
|
8926
8927
|
var sensors = useSensors(useSensor(MouseSensor, {
|
|
8927
8928
|
// Require the mouse to move by 10 pixels before activating
|
|
@@ -9063,6 +9064,10 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
9063
9064
|
}, 100);
|
|
9064
9065
|
}
|
|
9065
9066
|
}, [getCheckedItems, onCheckChange]);
|
|
9067
|
+
var simpleBarScrollToTop = useCallback(function () {
|
|
9068
|
+
var _a, _b;
|
|
9069
|
+
(_b = (_a = simpleBarRef.current) === null || _a === void 0 ? void 0 : _a.getScrollElement()) === null || _b === void 0 ? void 0 : _b.scrollTo({ top: 0 });
|
|
9070
|
+
}, []);
|
|
9066
9071
|
// Effect ----------------------------------------------------------------------------------------------------------
|
|
9067
9072
|
useEffect(function () {
|
|
9068
9073
|
return function () {
|
|
@@ -9161,6 +9166,7 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
9161
9166
|
setSortableItems(makeSortableItems(lastItems_1));
|
|
9162
9167
|
},
|
|
9163
9168
|
getCheckedItems: getCheckedItems,
|
|
9169
|
+
scrollToTop: simpleBarScrollToTop,
|
|
9164
9170
|
};
|
|
9165
9171
|
if (typeof ref === 'function') {
|
|
9166
9172
|
ref(commands);
|
|
@@ -9169,7 +9175,18 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
9169
9175
|
ref.current = commands;
|
|
9170
9176
|
}
|
|
9171
9177
|
}
|
|
9172
|
-
}, [
|
|
9178
|
+
}, [
|
|
9179
|
+
ref,
|
|
9180
|
+
columns,
|
|
9181
|
+
items,
|
|
9182
|
+
paging,
|
|
9183
|
+
makeSortableItems,
|
|
9184
|
+
setColumns,
|
|
9185
|
+
setItems,
|
|
9186
|
+
setPaging,
|
|
9187
|
+
getCheckedItems,
|
|
9188
|
+
simpleBarScrollToTop,
|
|
9189
|
+
]);
|
|
9173
9190
|
// Event Handler ---------------------------------------------------------------------------------------------------
|
|
9174
9191
|
var handleDragEnd = useCallback(function (event) {
|
|
9175
9192
|
var active = event.active, over = event.over;
|
|
@@ -9216,6 +9233,10 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
9216
9233
|
var handleBodyCheckChange = useCallback(function (item, column) {
|
|
9217
9234
|
updateHeadCheck(column);
|
|
9218
9235
|
}, [updateHeadCheck]);
|
|
9236
|
+
var handlePageChange = useCallback(function (page) {
|
|
9237
|
+
simpleBarScrollToTop();
|
|
9238
|
+
onPageChange && onPageChange(page);
|
|
9239
|
+
}, [onPageChange, simpleBarScrollToTop]);
|
|
9219
9240
|
// TableContext Function ---------------------------------------------------------------------------------------------
|
|
9220
9241
|
var TableContextSetMenuOpen = useCallback(function (newMenuOpen, newOpenMenuId) {
|
|
9221
9242
|
if (newMenuOpen) {
|
|
@@ -9327,7 +9348,7 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
9327
9348
|
// Render ----------------------------------------------------------------------------------------------------------
|
|
9328
9349
|
return finalColumns ? (React__default.createElement(TableContextProvider, { value: tableContextValue },
|
|
9329
9350
|
React__default.createElement(Paper, { ref: fullHeight ? containerHeightDetector : undefined, className: classNames('Table', className, !!stickyHeader && 'sticky-header', !!fullHeight && 'full-height', !!showOddColor && 'odd-color', !!showEvenColor && 'even-color', !!sortable && 'sortable'), variant: 'outlined', style: style, sx: sx },
|
|
9330
|
-
React__default.createElement(SimpleBar, { style: simpleBarStyle },
|
|
9351
|
+
React__default.createElement(SimpleBar, { ref: simpleBarRef, style: simpleBarStyle },
|
|
9331
9352
|
React__default.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd },
|
|
9332
9353
|
React__default.createElement(Table$1, { stickyHeader: stickyHeader, sx: tableSx, style: tableStyle },
|
|
9333
9354
|
React__default.createElement(TableHead, null,
|
|
@@ -9340,7 +9361,7 @@ var Table = React__default.forwardRef(function (_a, ref) {
|
|
|
9340
9361
|
!isNoData && footer && (React__default.createElement(TableFooter, null,
|
|
9341
9362
|
React__default.createElement(TableRow, null, finalColumns.map(function (column, idx) { return (React__default.createElement(TableFooterCell, { key: idx, column: column, defaultAlign: defaultAlign })); }))))))),
|
|
9342
9363
|
paging && paging.total > 0 && (React__default.createElement(Stack, { ref: fullHeight ? pagingHeightResizeDetector : undefined, alignItems: pagingAlign, style: pagingStyle },
|
|
9343
|
-
React__default.createElement(TablePagination, { className: pagination === null || pagination === void 0 ? void 0 : pagination.className, style: pagination === null || pagination === void 0 ? void 0 : pagination.style, sx: pagination === null || pagination === void 0 ? void 0 : pagination.sx, paging: paging, align: pagingAlign, onChange:
|
|
9364
|
+
React__default.createElement(TablePagination, { className: pagination === null || pagination === void 0 ? void 0 : pagination.className, style: pagination === null || pagination === void 0 ? void 0 : pagination.style, sx: pagination === null || pagination === void 0 ? void 0 : pagination.sx, paging: paging, align: pagingAlign, onChange: handlePageChange })))))) : null;
|
|
9344
9365
|
});
|
|
9345
9366
|
Table.displayName = 'Table';
|
|
9346
9367
|
Table.defaultProps = TableDefaultProps;var SearchTableDefaultProps = {};var SearchTable = React__default.forwardRef(function (_a, ref) {
|
|
@@ -9830,6 +9851,7 @@ TableButton.defaultProps = TableButtonDefaultProps;var TableMenuButtonDefaultPro
|
|
|
9830
9851
|
TableMenuButton.displayName = 'TableMenuButton';
|
|
9831
9852
|
TableMenuButton.defaultProps = TableMenuButtonDefaultProps;var InfoTableDefaultProps = {
|
|
9832
9853
|
spacing: 2,
|
|
9854
|
+
rowSpacing: 3,
|
|
9833
9855
|
labelColor: 'primary',
|
|
9834
9856
|
};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
9857
|
var ValueWrap = styled(Box)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 3px;\n position: relative;\n display: flex;\n flex-direction: row;\n"], ["\n margin-top: 3px;\n position: relative;\n display: flex;\n flex-direction: row;\n"])));
|
|
@@ -10102,7 +10124,7 @@ _defineProperty(CopyToClipboard$1, "defaultProps", {
|
|
|
10102
10124
|
|
|
10103
10125
|
CopyToClipboard.CopyToClipboard = CopyToClipboard;
|
|
10104
10126
|
var lib = CopyToClipboard;var InfoTable = function (_a) {
|
|
10105
|
-
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, onCopyToClipboard = _a.onCopyToClipboard;
|
|
10127
|
+
var cols = _a.cols, spacing = _a.spacing, columnSpacing = _a.columnSpacing, rowSpacing = _a.rowSpacing, 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, onCopyToClipboard = _a.onCopyToClipboard;
|
|
10106
10128
|
var sizeProps = useMemo(function () {
|
|
10107
10129
|
var value = {};
|
|
10108
10130
|
if (typeof cols === 'number') {
|
|
@@ -10122,7 +10144,7 @@ var lib = CopyToClipboard;var InfoTable = function (_a) {
|
|
|
10122
10144
|
}
|
|
10123
10145
|
return value;
|
|
10124
10146
|
}, [cols]);
|
|
10125
|
-
return (React__default.createElement(Grid, { container: true, spacing: spacing, className: classNames('InfoTable', className), style: style, sx: sx }, items.map(function (item, idx) {
|
|
10147
|
+
return (React__default.createElement(Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('InfoTable', className), style: style, sx: sx }, items.map(function (item, idx) {
|
|
10126
10148
|
if (item) {
|
|
10127
10149
|
var finalLabelColor = typographyColorToSxColor(item.labelColor || labelColor);
|
|
10128
10150
|
var finalLabelSx = combineSx(labelSx, item.labelSx, !!finalLabelColor && { color: finalLabelColor });
|