@ballistix.digital/react-components 0.4.3 → 0.4.5
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/index.d.ts +61 -52
- package/dist/index.esm.js +18 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React, { FC, ReactNode, RefObject, ReactElement, HTMLInputTypeAttribute,
|
|
|
2
2
|
import { DeepPartial as DeepPartial$1 } from 'types/DeepPartial';
|
|
3
3
|
import { Menu } from '@headlessui/react';
|
|
4
4
|
import { IconName } from '@fortawesome/fontawesome-svg-core';
|
|
5
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
5
|
+
import { ColumnDef, SortingState, ColumnOrderState } from '@tanstack/react-table';
|
|
6
6
|
import { TButtonElementStyles as TButtonElementStyles$1 } from 'components/Element/Button';
|
|
7
7
|
import { TDropdownElementStyles as TDropdownElementStyles$1 } from 'components/Element/Dropdown';
|
|
8
8
|
import { TPagePaginationNavigationStyles as TPagePaginationNavigationStyles$1 } from 'components/Navigation/PagePagination';
|
|
@@ -17,7 +17,7 @@ declare const base$i: {
|
|
|
17
17
|
};
|
|
18
18
|
type TAvatarElementStyles = DeepPartial$1<typeof base$i>;
|
|
19
19
|
|
|
20
|
-
type TProps$
|
|
20
|
+
type TProps$g = {
|
|
21
21
|
src?: string | undefined;
|
|
22
22
|
placeholder?: string | undefined;
|
|
23
23
|
children?: ReactNode | ReactNode[] | string;
|
|
@@ -29,7 +29,7 @@ type TProps$h = {
|
|
|
29
29
|
isLoading?: boolean;
|
|
30
30
|
styles?: TAvatarElementStyles;
|
|
31
31
|
};
|
|
32
|
-
declare const AvatarElement: FC<TProps$
|
|
32
|
+
declare const AvatarElement: FC<TProps$g>;
|
|
33
33
|
|
|
34
34
|
declare const base$h: {
|
|
35
35
|
container: string;
|
|
@@ -38,7 +38,7 @@ declare const base$h: {
|
|
|
38
38
|
};
|
|
39
39
|
type TBadgeElementStyles = DeepPartial$1<typeof base$h>;
|
|
40
40
|
|
|
41
|
-
type TProps$
|
|
41
|
+
type TProps$f = {
|
|
42
42
|
children: string | ReactNode;
|
|
43
43
|
color?: 'gray' | 'red' | 'yellow' | 'green' | 'blue' | 'indigo' | 'purple' | 'pink';
|
|
44
44
|
type?: 'normal' | 'indicator' | 'close';
|
|
@@ -49,7 +49,7 @@ type TProps$g = {
|
|
|
49
49
|
onClose?: () => void;
|
|
50
50
|
styles?: TBadgeElementStyles;
|
|
51
51
|
};
|
|
52
|
-
declare const BadgeElement: FC<TProps$
|
|
52
|
+
declare const BadgeElement: FC<TProps$f>;
|
|
53
53
|
|
|
54
54
|
declare const base$g: {
|
|
55
55
|
container: string;
|
|
@@ -59,7 +59,7 @@ declare const base$g: {
|
|
|
59
59
|
};
|
|
60
60
|
type TButtonElementStyles = DeepPartial$1<typeof base$g>;
|
|
61
61
|
|
|
62
|
-
type TProps$
|
|
62
|
+
type TProps$e = {
|
|
63
63
|
children: string | ReactNode;
|
|
64
64
|
innerRef?: RefObject<HTMLButtonElement>;
|
|
65
65
|
htmlType?: 'button' | 'submit';
|
|
@@ -71,7 +71,7 @@ type TProps$f = {
|
|
|
71
71
|
styles?: TButtonElementStyles;
|
|
72
72
|
onClick: () => void;
|
|
73
73
|
};
|
|
74
|
-
declare const ButtonElement: FC<TProps$
|
|
74
|
+
declare const ButtonElement: FC<TProps$e>;
|
|
75
75
|
|
|
76
76
|
declare const base$f: {
|
|
77
77
|
container: string;
|
|
@@ -81,11 +81,11 @@ declare const base$f: {
|
|
|
81
81
|
};
|
|
82
82
|
type TButtonGroupElementStyles = DeepPartial$1<typeof base$f>;
|
|
83
83
|
|
|
84
|
-
type TProps$
|
|
84
|
+
type TProps$d = {
|
|
85
85
|
children: ReactElement[];
|
|
86
86
|
styles?: TButtonGroupElementStyles;
|
|
87
87
|
};
|
|
88
|
-
declare const ButtonGroupElement: FC<TProps$
|
|
88
|
+
declare const ButtonGroupElement: FC<TProps$d>;
|
|
89
89
|
|
|
90
90
|
declare const base$e: {
|
|
91
91
|
container: string;
|
|
@@ -96,7 +96,7 @@ declare const base$e: {
|
|
|
96
96
|
};
|
|
97
97
|
type TDropdownElementStyles = DeepPartial$1<typeof base$e>;
|
|
98
98
|
|
|
99
|
-
type TProps$
|
|
99
|
+
type TProps$c = {
|
|
100
100
|
children: ReactElement | ReactElement[];
|
|
101
101
|
label: string | ReactElement;
|
|
102
102
|
type?: 'button' | 'compact';
|
|
@@ -104,16 +104,16 @@ type TProps$d = {
|
|
|
104
104
|
styles?: TDropdownElementStyles;
|
|
105
105
|
};
|
|
106
106
|
declare const DropdownElement: {
|
|
107
|
-
Container: FC<TProps$
|
|
107
|
+
Container: FC<TProps$c>;
|
|
108
108
|
Item: typeof Menu.Item;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
type TProps$
|
|
111
|
+
type TProps$b = {
|
|
112
112
|
accessor: IconName;
|
|
113
113
|
type: 'brands' | 'light' | 'regular' | 'solid';
|
|
114
114
|
className?: string;
|
|
115
115
|
};
|
|
116
|
-
declare const IconElement: FC<TProps$
|
|
116
|
+
declare const IconElement: FC<TProps$b>;
|
|
117
117
|
|
|
118
118
|
declare const base$d: {
|
|
119
119
|
container: string;
|
|
@@ -130,7 +130,7 @@ declare const base$d: {
|
|
|
130
130
|
};
|
|
131
131
|
type TInputGroupStyles = DeepPartial$1<typeof base$d>;
|
|
132
132
|
|
|
133
|
-
type TProps$
|
|
133
|
+
type TProps$a = {
|
|
134
134
|
name: string;
|
|
135
135
|
htmlType: HTMLInputTypeAttribute;
|
|
136
136
|
label?: string | ReactNode;
|
|
@@ -157,7 +157,7 @@ type TProps$b = {
|
|
|
157
157
|
onBlur: any;
|
|
158
158
|
styles?: TInputGroupStyles;
|
|
159
159
|
};
|
|
160
|
-
declare const InputGroupForm: FC<TProps$
|
|
160
|
+
declare const InputGroupForm: FC<TProps$a>;
|
|
161
161
|
|
|
162
162
|
declare const base$c: {
|
|
163
163
|
container: string;
|
|
@@ -165,12 +165,12 @@ declare const base$c: {
|
|
|
165
165
|
};
|
|
166
166
|
type TContainerLayoutStyles = DeepPartial$1<typeof base$c>;
|
|
167
167
|
|
|
168
|
-
type TProps$
|
|
168
|
+
type TProps$9 = {
|
|
169
169
|
children: ReactNode;
|
|
170
170
|
type?: 'break' | 'center' | 'fill';
|
|
171
171
|
styles?: TContainerLayoutStyles;
|
|
172
172
|
};
|
|
173
|
-
declare const ContainerLayout: FC<TProps$
|
|
173
|
+
declare const ContainerLayout: FC<TProps$9>;
|
|
174
174
|
|
|
175
175
|
declare const base$b: {
|
|
176
176
|
container: string;
|
|
@@ -181,12 +181,12 @@ declare const base$b: {
|
|
|
181
181
|
};
|
|
182
182
|
type TDividerLayoutStyles = DeepPartial$1<typeof base$b>;
|
|
183
183
|
|
|
184
|
-
type TProps$
|
|
184
|
+
type TProps$8 = {
|
|
185
185
|
children?: ReactNode;
|
|
186
186
|
type?: 'left' | 'center' | 'right';
|
|
187
187
|
styles?: TDividerLayoutStyles;
|
|
188
188
|
};
|
|
189
|
-
declare const DividerLayout: FC<TProps$
|
|
189
|
+
declare const DividerLayout: FC<TProps$8>;
|
|
190
190
|
|
|
191
191
|
declare const base$a: {
|
|
192
192
|
container: string;
|
|
@@ -195,12 +195,12 @@ declare const base$a: {
|
|
|
195
195
|
};
|
|
196
196
|
type TListContainerLayoutStyles = DeepPartial$1<typeof base$a>;
|
|
197
197
|
|
|
198
|
-
type TProps$
|
|
198
|
+
type TProps$7 = {
|
|
199
199
|
children: ReactElement | ReactElement[];
|
|
200
200
|
type?: 'fill' | 'fill-sticky' | 'center' | 'center-sticky' | 'card' | 'card-sticky';
|
|
201
201
|
styles?: TListContainerLayoutStyles;
|
|
202
202
|
};
|
|
203
|
-
declare const ListContainerLayout: FC<TProps$
|
|
203
|
+
declare const ListContainerLayout: FC<TProps$7>;
|
|
204
204
|
|
|
205
205
|
declare const base$9: {
|
|
206
206
|
container: string;
|
|
@@ -211,14 +211,14 @@ declare const base$9: {
|
|
|
211
211
|
};
|
|
212
212
|
type TMediaObjectLayoutStyles = DeepPartial$1<typeof base$9>;
|
|
213
213
|
|
|
214
|
-
type TProps$
|
|
214
|
+
type TProps$6 = {
|
|
215
215
|
title: string;
|
|
216
216
|
paragraph: string;
|
|
217
217
|
figure?: ReactNode;
|
|
218
218
|
type?: 'top' | 'top-reversed' | 'center' | 'center-reversed' | 'bottom' | 'bottom-reversed' | 'stretch' | 'stretch-reversed' | 'responsive' | 'responsive-reversed' | 'wide' | 'wide-reversed';
|
|
219
219
|
styles?: TMediaObjectLayoutStyles;
|
|
220
220
|
};
|
|
221
|
-
declare const MediaObjectLayout: FC<TProps$
|
|
221
|
+
declare const MediaObjectLayout: FC<TProps$6>;
|
|
222
222
|
|
|
223
223
|
declare const base$8: {
|
|
224
224
|
container: string;
|
|
@@ -242,6 +242,43 @@ declare const LayoutPanel: {
|
|
|
242
242
|
Section: React.FC<TSectionProps>;
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
+
type TData = any;
|
|
246
|
+
type VisibilityState = {
|
|
247
|
+
[key: string]: boolean;
|
|
248
|
+
};
|
|
249
|
+
type TTableListProps<TData> = {
|
|
250
|
+
id: string;
|
|
251
|
+
columns: ColumnDef<TData>[];
|
|
252
|
+
data: TData[];
|
|
253
|
+
page: {
|
|
254
|
+
total: number;
|
|
255
|
+
};
|
|
256
|
+
defaultOrder?: string[];
|
|
257
|
+
children: ({ min, max, current, }: {
|
|
258
|
+
min: number;
|
|
259
|
+
max: number;
|
|
260
|
+
current: number;
|
|
261
|
+
}) => ReactNode;
|
|
262
|
+
type?: 'normal' | 'panel' | 'full';
|
|
263
|
+
isStriped?: boolean;
|
|
264
|
+
hasStickyHeader?: boolean;
|
|
265
|
+
hasVerticalSeparators?: boolean;
|
|
266
|
+
areControlsVisible?: boolean;
|
|
267
|
+
styles?: TTableListStyles & {
|
|
268
|
+
components: {
|
|
269
|
+
buttonElement: TButtonElementStyles$1;
|
|
270
|
+
dropdownElement: TDropdownElementStyles$1;
|
|
271
|
+
panelPaginationNavigation: TPagePaginationNavigationStyles$1;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
onChange?: ({ sorting, visibility, order, }: {
|
|
275
|
+
sorting: SortingState;
|
|
276
|
+
visibility: VisibilityState;
|
|
277
|
+
order: ColumnOrderState;
|
|
278
|
+
}) => void;
|
|
279
|
+
};
|
|
280
|
+
declare const TableList: FC<TTableListProps<TData>>;
|
|
281
|
+
|
|
245
282
|
declare const base$7: {
|
|
246
283
|
container: string;
|
|
247
284
|
head: {
|
|
@@ -296,34 +333,6 @@ declare const base$7: {
|
|
|
296
333
|
};
|
|
297
334
|
type TTableListStyles = DeepPartial$1<typeof base$7>;
|
|
298
335
|
|
|
299
|
-
type TData = any;
|
|
300
|
-
type TProps$6<TData> = {
|
|
301
|
-
id: string;
|
|
302
|
-
columns: ColumnDef<TData>[];
|
|
303
|
-
data: TData[];
|
|
304
|
-
page: {
|
|
305
|
-
total: number;
|
|
306
|
-
};
|
|
307
|
-
children: ({ min, max, current, }: {
|
|
308
|
-
min: number;
|
|
309
|
-
max: number;
|
|
310
|
-
current: number;
|
|
311
|
-
}) => ReactNode;
|
|
312
|
-
type?: 'normal' | 'panel' | 'full';
|
|
313
|
-
isStriped?: boolean;
|
|
314
|
-
hasStickyHeader?: boolean;
|
|
315
|
-
hasVerticalSeparators?: boolean;
|
|
316
|
-
areControlsVisible?: boolean;
|
|
317
|
-
styles?: TTableListStyles & {
|
|
318
|
-
components: {
|
|
319
|
-
buttonElement: TButtonElementStyles$1;
|
|
320
|
-
dropdownElement: TDropdownElementStyles$1;
|
|
321
|
-
panelPaginationNavigation: TPagePaginationNavigationStyles$1;
|
|
322
|
-
};
|
|
323
|
-
};
|
|
324
|
-
};
|
|
325
|
-
declare const TableList: FC<TProps$6<TData>>;
|
|
326
|
-
|
|
327
336
|
declare const base$6: {
|
|
328
337
|
container: string;
|
|
329
338
|
list: string;
|
|
@@ -685,4 +694,4 @@ type TProps = {
|
|
|
685
694
|
};
|
|
686
695
|
declare const SlideOverOverlay: FC<TProps>;
|
|
687
696
|
|
|
688
|
-
export { AvatarElement, BadgeElement, BreadcrumbsNavigation, ButtonElement, ButtonGroupElement, ContainerLayout, DividerLayout, DropdownElement, IconElement, InputGroupForm, ListContainerLayout, MediaObjectLayout, ModalOverlay, NotificationOverlay, PagePaginationNavigation, LayoutPanel as PanelLayout, PanelPaginationNavigation, SlideOverOverlay, TabNavigation, TableList, VerticalNavigation };
|
|
697
|
+
export { AvatarElement, BadgeElement, BreadcrumbsNavigation, ButtonElement, ButtonGroupElement, ContainerLayout, DividerLayout, DropdownElement, IconElement, InputGroupForm, ListContainerLayout, MediaObjectLayout, ModalOverlay, NotificationOverlay, PagePaginationNavigation, LayoutPanel as PanelLayout, PanelPaginationNavigation, SlideOverOverlay, TTableListProps, TTableListStyles, TabNavigation, TableList, VerticalNavigation };
|
package/dist/index.esm.js
CHANGED
|
@@ -328,7 +328,7 @@ var ButtonElement = function (props) {
|
|
|
328
328
|
return result;
|
|
329
329
|
};
|
|
330
330
|
var styles = handleGenerateStyle();
|
|
331
|
-
return (jsxs("button", __assign({ type: htmlType, className: styles.container, disabled: isDisabled || status !== 'idle', onClick: onClick, ref: innerRef }, { children: [status === 'idle' && children, status === 'loading' && (jsxs("div", __assign({ className: styles.content }, { children: [jsx(ArrowPathIcon, { className: styles.spinner }), jsx("
|
|
331
|
+
return (jsxs("button", __assign({ type: htmlType, className: styles.container, disabled: isDisabled || status !== 'idle', onClick: onClick, ref: innerRef }, { children: [status === 'idle' && children, status === 'loading' && (jsxs("div", __assign({ className: styles.content }, { children: [jsx(ArrowPathIcon, { className: styles.spinner }), jsx("div", { children: children })] }))), status === 'error' && (jsxs("div", __assign({ className: styles.content }, { children: [jsx(ExclamationCircleIcon, { className: styles.icon }), jsx("div", { children: children })] }))), status === 'success' && (jsxs("div", __assign({ className: styles.content }, { children: [jsx(CheckIcon, { className: styles.icon }), jsx("div", { children: children })] })))] })));
|
|
332
332
|
};
|
|
333
333
|
|
|
334
334
|
var base$g = {
|
|
@@ -16868,7 +16868,7 @@ var PanelPaginationNavigation = function (props) {
|
|
|
16868
16868
|
component = (jsxs(Fragment$1, { children: [jsx("button", __assign({ className: toClassName(styles.button.default, current === min && styles.button.active), onClick: function () { return handleChangeCurrent(min); } }, { children: min })), jsx("button", __assign({ className: toClassName(styles.button.default, current === min + 1 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 1); } }, { children: min + 1 })), jsx("button", __assign({ className: toClassName(styles.button.default, current === min + 2 && styles.button.active), onClick: function () { return handleChangeCurrent(min + 2); } }, { children: min + 2 }))] }));
|
|
16869
16869
|
break;
|
|
16870
16870
|
}
|
|
16871
|
-
return (jsxs("div", __assign({ className: styles.container }, { children: [jsxs("div", __assign({ className: "flex flex-1 justify-between sm:hidden" }, { children: [jsx("button", __assign({ className: toClassName(styles.mobile.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); } }, { children: "Previous" })), jsx("button", __assign({ className: toClassName(styles.mobile.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); } }, { children: "Next" }))] })), jsxs("div", __assign({ className: styles.desktop.container }, { children: [jsx("div", { children: jsx("
|
|
16871
|
+
return (jsxs("div", __assign({ className: styles.container }, { children: [jsxs("div", __assign({ className: "flex flex-1 justify-between sm:hidden" }, { children: [jsx("button", __assign({ className: toClassName(styles.mobile.button, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); } }, { children: "Previous" })), jsx("button", __assign({ className: toClassName(styles.mobile.button, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); } }, { children: "Next" }))] })), jsxs("div", __assign({ className: styles.desktop.container }, { children: [jsx("div", { children: jsx("div", __assign({ className: "text-sm text-gray-700" }, { children: children({ min: min, max: max, current: current }) })) }), jsx("div", { children: jsxs("nav", __assign({ className: styles.desktop.navigation, "aria-label": "Pagination" }, { children: [jsxs("button", __assign({ className: toClassName(styles.desktop.leftButton, current === min && styles.button.disabled), disabled: current === min, onClick: function () { return handleChangeCurrent(current - 1); } }, { children: [jsx("span", __assign({ className: styles.label }, { children: "Previous" })), jsx(ChevronLeftIcon, { className: styles.icon, "aria-hidden": "true" })] })), component, jsxs("button", __assign({ className: toClassName(styles.desktop.rightButton, current === max && styles.button.disabled), disabled: current === max, onClick: function () { return handleChangeCurrent(current + 1); } }, { children: [jsx("span", __assign({ className: styles.label }, { children: "Next" })), jsx(ChevronRightIcon, { className: styles.icon, "aria-hidden": "true" })] }))] })) })] }))] })));
|
|
16872
16872
|
};
|
|
16873
16873
|
|
|
16874
16874
|
var base$7 = {
|
|
@@ -16897,7 +16897,7 @@ var styles$8 = {
|
|
|
16897
16897
|
};
|
|
16898
16898
|
|
|
16899
16899
|
var TableList = function (props) {
|
|
16900
|
-
var id = props.id, columns = props.columns, data = props.data, page = props.page, children = props.children, _a = props.type, type = _a === void 0 ? 'normal' : _a, _b = props.isStriped, isStriped = _b === void 0 ? false : _b, _c = props.hasStickyHeader, hasStickyHeader = _c === void 0 ? false : _c, _d = props.hasVerticalSeparators, hasVerticalSeparators = _d === void 0 ? false : _d, _e = props.areControlsVisible, areControlsVisible = _e === void 0 ? true : _e, stylesOverrides = props.styles;
|
|
16900
|
+
var id = props.id, columns = props.columns, data = props.data, page = props.page, children = props.children, defaultOrder = props.defaultOrder, _a = props.type, type = _a === void 0 ? 'normal' : _a, _b = props.isStriped, isStriped = _b === void 0 ? false : _b, _c = props.hasStickyHeader, hasStickyHeader = _c === void 0 ? false : _c, _d = props.hasVerticalSeparators, hasVerticalSeparators = _d === void 0 ? false : _d, _e = props.areControlsVisible, areControlsVisible = _e === void 0 ? true : _e, stylesOverrides = props.styles, onChange = props.onChange;
|
|
16901
16901
|
var write = useExcel().write;
|
|
16902
16902
|
var handleGenerateStyle = function () {
|
|
16903
16903
|
var result = deepCopyObject(styles$7.base);
|
|
@@ -16926,6 +16926,12 @@ var TableList = function (props) {
|
|
|
16926
16926
|
onColumnVisibilityChange: setVisibility,
|
|
16927
16927
|
onColumnOrderChange: setOrder,
|
|
16928
16928
|
});
|
|
16929
|
+
useEffect(function () {
|
|
16930
|
+
if (sorting || visibility || order) {
|
|
16931
|
+
onChange && onChange({ sorting: sorting, visibility: visibility, order: order });
|
|
16932
|
+
}
|
|
16933
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16934
|
+
}, [sorting || visibility || order]);
|
|
16929
16935
|
var handleCalculateExcelTypeFromValue = function (value) {
|
|
16930
16936
|
var _a;
|
|
16931
16937
|
var result = 'string';
|
|
@@ -16972,8 +16978,7 @@ var TableList = function (props) {
|
|
|
16972
16978
|
var handleUpdateColumnOrder = useCallback(function (column, location) {
|
|
16973
16979
|
var _a;
|
|
16974
16980
|
var ids = (_a = table
|
|
16975
|
-
.getAllLeafColumns()
|
|
16976
|
-
.filter(function (column) { return column === null || column === void 0 ? void 0 : column.getCanSort(); })) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
16981
|
+
.getAllLeafColumns()) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
16977
16982
|
var currentIndexOfId = ids.findIndex(function (id) { return id === column.id; });
|
|
16978
16983
|
// Remove id from array.
|
|
16979
16984
|
ids.splice(currentIndexOfId, 1);
|
|
@@ -16986,6 +16991,9 @@ var TableList = function (props) {
|
|
|
16986
16991
|
var _a;
|
|
16987
16992
|
var state = window === null || window === void 0 ? void 0 : window.localStorage.getItem("TableList.".concat(id, ".state"));
|
|
16988
16993
|
if (!state) {
|
|
16994
|
+
if (defaultOrder && (defaultOrder === null || defaultOrder === void 0 ? void 0 : defaultOrder.length) > 0) {
|
|
16995
|
+
return setOrder(defaultOrder);
|
|
16996
|
+
}
|
|
16989
16997
|
return setOrder(columns.map(function (column) { var _a; return (_a = column === null || column === void 0 ? void 0 : column.id) !== null && _a !== void 0 ? _a : ''; }));
|
|
16990
16998
|
}
|
|
16991
16999
|
var savedColumnOrder = (_a = state === null || state === void 0 ? void 0 : state.split(',').map(function (id) { return id.replace('-', ''); })) !== null && _a !== void 0 ? _a : [];
|
|
@@ -16995,7 +17003,7 @@ var TableList = function (props) {
|
|
|
16995
17003
|
});
|
|
16996
17004
|
setOrder(savedColumnOrder);
|
|
16997
17005
|
setVisibility(savedColumnVisibility);
|
|
16998
|
-
}, [columns, id]);
|
|
17006
|
+
}, [columns, defaultOrder, id]);
|
|
16999
17007
|
// Save state to local storage when column visibility or order updates.
|
|
17000
17008
|
useEffect(function () {
|
|
17001
17009
|
var _a;
|
|
@@ -17003,8 +17011,7 @@ var TableList = function (props) {
|
|
|
17003
17011
|
var isMounted = order.length > 0;
|
|
17004
17012
|
if (isMounted && (order || visibility)) {
|
|
17005
17013
|
var ids = (_a = table
|
|
17006
|
-
.getAllLeafColumns()
|
|
17007
|
-
.filter(function (column) { return column === null || column === void 0 ? void 0 : column.getCanSort(); })) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
17014
|
+
.getAllLeafColumns()) === null || _a === void 0 ? void 0 : _a.map(function (column) { return column.id; });
|
|
17008
17015
|
var idsWithVisibilityIndicator = ids.map(function (id) {
|
|
17009
17016
|
// Hardcoding `false` here since `undefined` is allowed.
|
|
17010
17017
|
if (visibility[id] === false) {
|
|
@@ -17017,9 +17024,10 @@ var TableList = function (props) {
|
|
|
17017
17024
|
}, [id, table, order, visibility]);
|
|
17018
17025
|
return (jsx(Fragment$1, { children: jsxs("div", __assign({ className: styles.container }, { children: [jsxs("div", __assign({ className: styles.controls.container }, { children: [jsx(DropdownElement.Container, __assign({ styles: stylesOverrides === null || stylesOverrides === void 0 ? void 0 : stylesOverrides.components.dropdownElement, label: jsx(ViewColumnsIcon, { className: "w-6 h-6" }) }, { children: jsx("div", __assign({ className: styles.controls.content }, { children: table
|
|
17019
17026
|
.getAllLeafColumns()
|
|
17020
|
-
.filter(
|
|
17027
|
+
// .filter((column) => column?.getCanSort())
|
|
17021
17028
|
.map(function (column, index) {
|
|
17022
|
-
|
|
17029
|
+
var canSort = column === null || column === void 0 ? void 0 : column.getCanSort();
|
|
17030
|
+
return (jsx(DropdownElement.Item, { children: function () { return (jsxs("div", __assign({ className: toClassName(styles.controls.dropdown.container, !canSort && 'hidden') }, { children: [jsx("input", { className: styles.controls.dropdown.input, type: "checkbox", checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler() }), jsx("label", __assign({ className: styles.controls.dropdown.label }, { children: column.columnDef.header })), jsxs("div", __assign({ className: styles.controls.dropdown.actions }, { children: [jsx(ChevronDownIcon$1, { className: styles.controls.dropdown.upIcon, onClick: function () {
|
|
17023
17031
|
return handleUpdateColumnOrder(column, index - 1);
|
|
17024
17032
|
} }), jsx(ChevronDownIcon$1, { className: styles.controls.dropdown.downIcon, onClick: function () {
|
|
17025
17033
|
return handleUpdateColumnOrder(column, index + 1);
|