@paubox/ui 0.13.0 → 0.14.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/index.esm.js
CHANGED
|
@@ -21944,7 +21944,8 @@ var Popper = function(param) {
|
|
|
21944
21944
|
containerRef,
|
|
21945
21945
|
side,
|
|
21946
21946
|
align,
|
|
21947
|
-
offset
|
|
21947
|
+
offset,
|
|
21948
|
+
detectEdges
|
|
21948
21949
|
]);
|
|
21949
21950
|
useEffect(function() {
|
|
21950
21951
|
updatePosition();
|
|
@@ -21975,7 +21976,7 @@ var Popper = function(param) {
|
|
|
21975
21976
|
overflow: maxHeight ? 'auto' : undefined
|
|
21976
21977
|
}, style),
|
|
21977
21978
|
children: children
|
|
21978
|
-
}), document.body);
|
|
21979
|
+
}), document.querySelector('[role="presentation"]') || document.body);
|
|
21979
21980
|
};
|
|
21980
21981
|
|
|
21981
21982
|
function _array_like_to_array$h(arr, len) {
|
|
@@ -23158,7 +23159,7 @@ function _templateObject2$a() {
|
|
|
23158
23159
|
";\n border-radius: 0.5rem;\n\n -webkit-appearance: none;\n -moz-appearance: none;\n &::-ms-expand {\n display: none;\n }\n &::placeholder {\n color: ",
|
|
23159
23160
|
";\n }\n color: ",
|
|
23160
23161
|
";\n padding: ",
|
|
23161
|
-
";\n outline: none;\n &::placeholder {\n color: ",
|
|
23162
|
+
";\n padding-right: 2rem;\n outline: none;\n &::placeholder {\n color: ",
|
|
23162
23163
|
";\n opacity: 0.3;\n }\n transition: all 150ms ease-in-out;\n\n &:focus-within {\n border-color: ",
|
|
23163
23164
|
";\n }\n\n &:hover {\n background-color: ",
|
|
23164
23165
|
";\n }\n\n &:focus {\n background-color: ",
|
|
@@ -24010,7 +24011,7 @@ function _templateObject2$8() {
|
|
|
24010
24011
|
";\n\n background-color: ",
|
|
24011
24012
|
";\n border-radius: 0.5rem;\n -webkit-appearance: none;\n -moz-appearance: none;\n &::-ms-expand {\n display: none;\n }\n color: ",
|
|
24012
24013
|
";\n padding: ",
|
|
24013
|
-
";\n outline: none;\n &::placeholder {\n color: ",
|
|
24014
|
+
";\n padding-right: 2rem;\n outline: none;\n &::placeholder {\n color: ",
|
|
24014
24015
|
";\n opacity: 0.3;\n }\n transition: all 150ms ease-in-out;\n\n &:focus-within {\n border-color: ",
|
|
24015
24016
|
";\n }\n\n &:hover {\n background-color: ",
|
|
24016
24017
|
";\n }\n\n &:focus {\n background-color: ",
|
|
@@ -33239,11 +33240,11 @@ function _templateObject3$1() {
|
|
|
33239
33240
|
}
|
|
33240
33241
|
var StyledTableBody = styled.tbody(_templateObject$4());
|
|
33241
33242
|
var Tr = styled.tr(_templateObject2$2(), function(props) {
|
|
33242
|
-
return props.enableHover && css(_templateObject1$3(), primary100);
|
|
33243
|
+
return props.enableHover && css(_templateObject1$3(), props.disabled ? neutral100 : primary100);
|
|
33243
33244
|
});
|
|
33244
33245
|
var Td = styled(Typography)(_templateObject3$1(), neutral300);
|
|
33245
33246
|
var TableBody = function(param) {
|
|
33246
|
-
var table = param.table, columnWidths = param.columnWidths, enableRowSelection = param.enableRowSelection, onRowClick = param.onRowClick, dense = param.dense, _param_testId = param.testId, testId = _param_testId === void 0 ? 'table' : _param_testId;
|
|
33247
|
+
var table = param.table, columnWidths = param.columnWidths, enableRowSelection = param.enableRowSelection, onRowClick = param.onRowClick, getRowDisabled = param.getRowDisabled, dense = param.dense, _param_testId = param.testId, testId = _param_testId === void 0 ? 'table' : _param_testId;
|
|
33247
33248
|
return /*#__PURE__*/ jsxs(StyledTableBody, {
|
|
33248
33249
|
children: [
|
|
33249
33250
|
/*#__PURE__*/ jsx("colgroup", {
|
|
@@ -33254,13 +33255,15 @@ var TableBody = function(param) {
|
|
|
33254
33255
|
}),
|
|
33255
33256
|
table.getRowModel().rows.map(function(row) {
|
|
33256
33257
|
var rowClickEnabled = enableRowSelection || !!onRowClick;
|
|
33258
|
+
var isDisabled = !!(getRowDisabled === null || getRowDisabled === void 0 ? void 0 : getRowDisabled(row.original));
|
|
33257
33259
|
return /*#__PURE__*/ jsx(Tr, {
|
|
33258
33260
|
role: rowClickEnabled ? 'button' : undefined,
|
|
33261
|
+
disabled: isDisabled,
|
|
33259
33262
|
onClick: onRowClick ? function() {
|
|
33260
|
-
return onRowClick(row.original);
|
|
33263
|
+
return !isDisabled && onRowClick(row.original);
|
|
33261
33264
|
} : row.getToggleSelectedHandler(),
|
|
33262
33265
|
style: {
|
|
33263
|
-
cursor: rowClickEnabled ? 'pointer' : undefined,
|
|
33266
|
+
cursor: rowClickEnabled ? isDisabled ? 'not-allowed' : 'pointer' : undefined,
|
|
33264
33267
|
background: row.getIsSelected() ? primary100 : undefined
|
|
33265
33268
|
},
|
|
33266
33269
|
enableHover: rowClickEnabled,
|
|
@@ -33333,7 +33336,8 @@ var ContextMenuCell = function(param) {
|
|
|
33333
33336
|
var isDisabled = typeof action.disabled === 'function' ? action.disabled(row.original) : action.disabled;
|
|
33334
33337
|
return /*#__PURE__*/ jsx(MenuItem, {
|
|
33335
33338
|
disabled: isDisabled,
|
|
33336
|
-
onClick: function() {
|
|
33339
|
+
onClick: function(e) {
|
|
33340
|
+
e.stopPropagation();
|
|
33337
33341
|
if (!isDisabled) {
|
|
33338
33342
|
action.onClick(row.original);
|
|
33339
33343
|
setOpenMenuId(null);
|
|
@@ -33490,7 +33494,7 @@ var TableContainer = styled(/*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
33490
33494
|
}))(_templateObject$2(), neutral300, spacing(1));
|
|
33491
33495
|
var TableWrapper = styled.table(_templateObject1$2());
|
|
33492
33496
|
var Table = function(param) {
|
|
33493
|
-
var columns = param.columns, _param_data = param.data, data = _param_data === void 0 ? [] : _param_data, getRowId = param.getRowId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, pageInfo = param.pageInfo, onPageSizeChange = param.onPageSizeChange, onPageChange = param.onPageChange, sortBy = param.sortBy, sortOrder = param.sortOrder, onSortChange = param.onSortChange, _param_enableRowSelection = param.enableRowSelection, enableRowSelection = _param_enableRowSelection === void 0 ? false : _param_enableRowSelection, _param_selectedRows = param.selectedRows, selectedRows = _param_selectedRows === void 0 ? {} : _param_selectedRows, onRowSelectionChange = param.onRowSelectionChange, onRowClick = param.onRowClick, contextMenuActions = param.contextMenuActions, _param_dense = param.dense, dense = _param_dense === void 0 ? false : _param_dense, height = param.height, error = param.error, _param_testId = param.testId, testId = _param_testId === void 0 ? 'table' : _param_testId;
|
|
33497
|
+
var columns = param.columns, _param_data = param.data, data = _param_data === void 0 ? [] : _param_data, getRowId = param.getRowId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, pageInfo = param.pageInfo, onPageSizeChange = param.onPageSizeChange, onPageChange = param.onPageChange, sortBy = param.sortBy, sortOrder = param.sortOrder, onSortChange = param.onSortChange, _param_enableRowSelection = param.enableRowSelection, enableRowSelection = _param_enableRowSelection === void 0 ? false : _param_enableRowSelection, _param_selectedRows = param.selectedRows, selectedRows = _param_selectedRows === void 0 ? {} : _param_selectedRows, onRowSelectionChange = param.onRowSelectionChange, getRowDisabled = param.getRowDisabled, onRowClick = param.onRowClick, contextMenuActions = param.contextMenuActions, _param_dense = param.dense, dense = _param_dense === void 0 ? false : _param_dense, height = param.height, error = param.error, _param_testId = param.testId, testId = _param_testId === void 0 ? 'table' : _param_testId;
|
|
33494
33498
|
var containerRef = useRef(null);
|
|
33495
33499
|
var _useState = _sliced_to_array$1(useState({}), 2), columnSizing = _useState[0], setColumnSizing = _useState[1];
|
|
33496
33500
|
var _useState1 = _sliced_to_array$1(useState(null), 2), openMenuId = _useState1[0], setOpenMenuId = _useState1[1];
|
|
@@ -33574,7 +33578,8 @@ var Table = function(param) {
|
|
|
33574
33578
|
enableRowSelection,
|
|
33575
33579
|
contextMenuActions,
|
|
33576
33580
|
disableControls,
|
|
33577
|
-
openMenuId
|
|
33581
|
+
openMenuId,
|
|
33582
|
+
testId
|
|
33578
33583
|
]);
|
|
33579
33584
|
var handleSortingChange = useCallback(function(updater) {
|
|
33580
33585
|
var currentSort = sortBy ? [
|
|
@@ -33679,6 +33684,7 @@ var Table = function(param) {
|
|
|
33679
33684
|
columnWidths: columnWidths,
|
|
33680
33685
|
enableRowSelection: enableRowSelection,
|
|
33681
33686
|
onRowClick: onRowClick,
|
|
33687
|
+
getRowDisabled: getRowDisabled,
|
|
33682
33688
|
dense: dense,
|
|
33683
33689
|
testId: testId
|
|
33684
33690
|
})
|
package/package.json
CHANGED
package/src/lib/Table/Table.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ interface TableRowProps<T> {
|
|
|
39
39
|
selectedRows?: RowSelectState;
|
|
40
40
|
onRowSelectionChange?: OnChangeFn<RowSelectState>;
|
|
41
41
|
onRowClick?: (row: T) => void;
|
|
42
|
+
getRowDisabled?: (row: T) => boolean;
|
|
42
43
|
contextMenuActions?: RowAction<T>[];
|
|
43
44
|
}
|
|
44
45
|
interface PaginationProps {
|
|
@@ -59,5 +60,5 @@ interface TableDataProps<T> {
|
|
|
59
60
|
}
|
|
60
61
|
export interface TableProps<T extends object> extends TableStyleProps, TableRowProps<T>, TableDataProps<T>, PaginationProps {
|
|
61
62
|
}
|
|
62
|
-
export declare const Table: <T extends object>({ columns, data, getRowId, isLoading, pageInfo, onPageSizeChange, onPageChange, sortBy, sortOrder, onSortChange, enableRowSelection, selectedRows, onRowSelectionChange, onRowClick, contextMenuActions, dense, height, error, testId, }: TableProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
63
|
+
export declare const Table: <T extends object>({ columns, data, getRowId, isLoading, pageInfo, onPageSizeChange, onPageChange, sortBy, sortOrder, onSortChange, enableRowSelection, selectedRows, onRowSelectionChange, getRowDisabled, onRowClick, contextMenuActions, dense, height, error, testId, }: TableProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
63
64
|
export {};
|
|
@@ -6,7 +6,8 @@ interface TableBodyProps<T extends object> {
|
|
|
6
6
|
enableRowSelection?: boolean;
|
|
7
7
|
onRowClick?: (row: T) => void;
|
|
8
8
|
dense: boolean;
|
|
9
|
+
getRowDisabled?: (row: T) => boolean;
|
|
9
10
|
testId?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare const TableBody: <T extends object>({ table, columnWidths, enableRowSelection, onRowClick, dense, testId, }: TableBodyProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TableBody: <T extends object>({ table, columnWidths, enableRowSelection, onRowClick, getRowDisabled, dense, testId, }: TableBodyProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|