ab-ui-library 1.6.0 → 1.6.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/components/AdvancedTable/ColumnSettings.d.ts +2 -1
- package/components/AdvancedTable/ColumnSettings.js +5 -2
- package/components/AdvancedTable/Table.d.ts +1 -1
- package/components/AdvancedTable/Table.js +2 -0
- package/components/AdvancedTable/types.d.ts +1 -0
- package/components/AdvancedTable/useTable.d.ts +1 -1
- package/components/AdvancedTable/useTable.js +7 -0
- package/components/SideNavigation/SideNavigation.d.ts +1 -1
- package/package.json +1 -1
- package/stories/SideNavigation.stories.d.ts +2 -2
|
@@ -2,6 +2,7 @@ import type { Table } from '@tanstack/react-table';
|
|
|
2
2
|
interface ColumnSettingsProps<T> {
|
|
3
3
|
table: Table<T>;
|
|
4
4
|
tooltipText?: string;
|
|
5
|
+
hiddenColumns?: string[];
|
|
5
6
|
}
|
|
6
|
-
export declare function ColumnSettings<T>({ table, tooltipText }: ColumnSettingsProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ColumnSettings<T>({ table, tooltipText, hiddenColumns }: ColumnSettingsProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -54,10 +54,12 @@ import '../Collapse/CollapseItem/CollapseItem.js';
|
|
|
54
54
|
import '../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
|
|
55
55
|
import '../SVGIcons/IconChevronDown.js';
|
|
56
56
|
|
|
57
|
-
var
|
|
57
|
+
var defaultHiddenColumnSettings = ['select', 'actions'];
|
|
58
58
|
function ColumnSettings(_ref) {
|
|
59
59
|
var table = _ref.table,
|
|
60
|
-
tooltipText = _ref.tooltipText
|
|
60
|
+
tooltipText = _ref.tooltipText,
|
|
61
|
+
_ref$hiddenColumns = _ref.hiddenColumns,
|
|
62
|
+
hiddenColumns = _ref$hiddenColumns === void 0 ? [] : _ref$hiddenColumns;
|
|
61
63
|
var _useState = useState(null),
|
|
62
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
63
65
|
ref = _useState2[0],
|
|
@@ -79,6 +81,7 @@ function ColumnSettings(_ref) {
|
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
};
|
|
84
|
+
var hiddenColumnSettings = defaultHiddenColumnSettings.concat(hiddenColumns);
|
|
82
85
|
return /*#__PURE__*/React.createElement("div", {
|
|
83
86
|
ref: setRef
|
|
84
87
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TTableProps } from './types';
|
|
2
2
|
import 'react-loading-skeleton/dist/skeleton.css';
|
|
3
|
-
export declare function Table<TData>({ data, columns, isLoading, hasError, isActionsVisible, totalCount, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder, defaultPageIndex, defaultPageSize, renderHeader, renderFooter, onSortChange, onRowClick, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function Table<TData>({ data, columns, isLoading, hasError, isActionsVisible, totalCount, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder, defaultPageIndex, defaultPageSize, defaultHiddenColumns, renderHeader, renderFooter, onSortChange, onRowClick, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -67,6 +67,7 @@ function Table(_ref) {
|
|
|
67
67
|
withBorder = _ref$withBorder === void 0 ? true : _ref$withBorder,
|
|
68
68
|
defaultPageIndex = _ref.defaultPageIndex,
|
|
69
69
|
defaultPageSize = _ref.defaultPageSize,
|
|
70
|
+
defaultHiddenColumns = _ref.defaultHiddenColumns,
|
|
70
71
|
renderHeader = _ref.renderHeader,
|
|
71
72
|
renderFooter = _ref.renderFooter,
|
|
72
73
|
onSortChange = _ref.onSortChange,
|
|
@@ -81,6 +82,7 @@ function Table(_ref) {
|
|
|
81
82
|
totalCount: totalCount,
|
|
82
83
|
defaultPageIndex: defaultPageIndex,
|
|
83
84
|
defaultPageSize: defaultPageSize,
|
|
85
|
+
defaultHiddenColumns: defaultHiddenColumns,
|
|
84
86
|
onSortChange: onSortChange,
|
|
85
87
|
onRowSelection: onRowSelection,
|
|
86
88
|
onColumnSizing: onColumnSizing,
|
|
@@ -21,6 +21,7 @@ export type TTableProps<TData> = {
|
|
|
21
21
|
customHeader?: ReactNode;
|
|
22
22
|
defaultPageIndex?: number;
|
|
23
23
|
defaultPageSize?: number;
|
|
24
|
+
defaultHiddenColumns?: string[];
|
|
24
25
|
renderHeader?: (table: TTable<TData>) => ReactNode;
|
|
25
26
|
renderFooter?: (table: Table<TData>) => ReactNode;
|
|
26
27
|
onRowClick?: (row: Row<TData>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
|
|
2
2
|
import type { Column, TTableProps } from './types';
|
|
3
|
-
export declare function useTable<TData>({ withSelect, columns, data, totalCount, defaultPageSize, defaultPageIndex, onSortChange, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): {
|
|
3
|
+
export declare function useTable<TData>({ withSelect, columns, data, totalCount, defaultPageSize, defaultPageIndex, defaultHiddenColumns, onSortChange, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): {
|
|
4
4
|
table: import("@tanstack/react-table").Table<TData>;
|
|
5
5
|
activeHeader: import("@tanstack/react-table").Header<TData, unknown> | null | undefined;
|
|
6
6
|
sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
|
|
@@ -42,6 +42,8 @@ function useTable(_ref) {
|
|
|
42
42
|
defaultPageSize = _ref$defaultPageSize === void 0 ? 10 : _ref$defaultPageSize,
|
|
43
43
|
_ref$defaultPageIndex = _ref.defaultPageIndex,
|
|
44
44
|
defaultPageIndex = _ref$defaultPageIndex === void 0 ? 0 : _ref$defaultPageIndex,
|
|
45
|
+
_ref$defaultHiddenCol = _ref.defaultHiddenColumns,
|
|
46
|
+
defaultHiddenColumns = _ref$defaultHiddenCol === void 0 ? [] : _ref$defaultHiddenCol,
|
|
45
47
|
onSortChange = _ref.onSortChange,
|
|
46
48
|
onRowSelection = _ref.onRowSelection,
|
|
47
49
|
onColumnSizing = _ref.onColumnSizing,
|
|
@@ -147,6 +149,10 @@ function useTable(_ref) {
|
|
|
147
149
|
setPagination(newPagination);
|
|
148
150
|
onPaginationChange === null || onPaginationChange === void 0 || onPaginationChange(newPagination);
|
|
149
151
|
};
|
|
152
|
+
var hiddenColumns = defaultHiddenColumns === null || defaultHiddenColumns === void 0 ? void 0 : defaultHiddenColumns.reduce(function (acc, key) {
|
|
153
|
+
acc[key] = false;
|
|
154
|
+
return acc;
|
|
155
|
+
}, {});
|
|
150
156
|
var table = useReactTable({
|
|
151
157
|
data: data,
|
|
152
158
|
columns: reorderedColumns,
|
|
@@ -157,6 +163,7 @@ function useTable(_ref) {
|
|
|
157
163
|
columnOrder: columnOrder,
|
|
158
164
|
columnSizing: columnSizing,
|
|
159
165
|
rowSelection: rowSelection,
|
|
166
|
+
columnVisibility: hiddenColumns,
|
|
160
167
|
columnPinning: {
|
|
161
168
|
left: ['select'],
|
|
162
169
|
right: ['actions']
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { TSideNavigationPropTypes } from '../components/SideNavigation/types';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: (props: TSideNavigationPropTypes) => JSX.Element;
|
|
5
|
+
component: (props: TSideNavigationPropTypes) => React.JSX.Element;
|
|
6
6
|
argTypes: {};
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|