@qoretechnologies/reqore 0.44.0 → 0.46.0
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/constants/theme.d.ts +8 -1
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/constants/theme.js +16 -2
- package/dist/constants/theme.js.map +1 -1
- package/package.json +1 -1
- package/tests.json +1 -1
- package/.eslintrc.js +0 -40
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/ISSUE_TEMPLATE/new-component.md +0 -20
- package/.github/ISSUE_TEMPLATE/visual-bug-report.md +0 -38
- package/.github/workflows/beta_release.yml +0 -100
- package/.github/workflows/tests.yml +0 -84
- package/.gitpod.yml +0 -11
- package/.jest-test-results.json +0 -1
- package/.prettierrc +0 -7
- package/.vscode/settings.json +0 -0
- package/__tests__/breadcrumbs.test.tsx +0 -75
- package/__tests__/button.test.tsx +0 -218
- package/__tests__/checkbox.test.tsx +0 -45
- package/__tests__/collection.test.tsx +0 -243
- package/__tests__/containers/paging.test.tsx +0 -138
- package/__tests__/control_group.test.tsx +0 -32
- package/__tests__/drawer.test.tsx +0 -140
- package/__tests__/dropdown.test.tsx +0 -381
- package/__tests__/effect.test.tsx +0 -70
- package/__tests__/heading.test.tsx +0 -58
- package/__tests__/helpers/colors.test.tsx +0 -18
- package/__tests__/helpers/table.test.tsx +0 -67
- package/__tests__/hooks/useLatestZIndex.test.tsx +0 -10
- package/__tests__/hooks/useReqorePaging.test.tsx +0 -271
- package/__tests__/hooks/useTheme.test.tsx +0 -31
- package/__tests__/icon.test.tsx +0 -53
- package/__tests__/input.test.tsx +0 -482
- package/__tests__/layout.test.tsx +0 -37
- package/__tests__/menu.test.tsx +0 -65
- package/__tests__/messages.test.tsx +0 -79
- package/__tests__/modal.test.tsx +0 -204
- package/__tests__/multiselect.test.tsx +0 -458
- package/__tests__/navbar.test.tsx +0 -31
- package/__tests__/notifications.test.tsx +0 -178
- package/__tests__/pagination.test.tsx +0 -437
- package/__tests__/panel.test.tsx +0 -243
- package/__tests__/popover.test.tsx +0 -282
- package/__tests__/radiogroup.test.tsx +0 -47
- package/__tests__/setup.js +0 -8
- package/__tests__/stories/Collection.stories.tsx +0 -0
- package/__tests__/table.test.tsx +0 -647
- package/__tests__/tabs.test.tsx +0 -321
- package/__tests__/tag.test.tsx +0 -160
- package/__tests__/textarea.test.tsx +0 -467
- package/__tests__/timeAgo.test.tsx +0 -27
- package/__tests__/tree.test.tsx +0 -58
- package/build-storybook.log +0 -491
- package/chromatic.config.json +0 -1
- package/icons.ts +0 -1
- package/migration-storybook.log +0 -56
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol-small.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
- package/src/components/Breadcrumbs/index.tsx +0 -254
- package/src/components/Breadcrumbs/item.tsx +0 -44
- package/src/components/Button/index.tsx +0 -633
- package/src/components/Checkbox/index.tsx +0 -388
- package/src/components/Collection/index.tsx +0 -426
- package/src/components/Collection/item.tsx +0 -267
- package/src/components/Columns/column.tsx +0 -27
- package/src/components/Columns/index.tsx +0 -41
- package/src/components/Comment/index.tsx +0 -141
- package/src/components/CommentFeed/index.tsx +0 -34
- package/src/components/Content/index.tsx +0 -34
- package/src/components/Content/wrapper.tsx +0 -36
- package/src/components/ControlGroup/index.tsx +0 -523
- package/src/components/DatePicker/index.tsx +0 -347
- package/src/components/Drawer/backdrop.tsx +0 -54
- package/src/components/Drawer/index.tsx +0 -365
- package/src/components/Dropdown/index.tsx +0 -153
- package/src/components/Dropdown/item.tsx +0 -33
- package/src/components/Dropdown/list.tsx +0 -222
- package/src/components/Effect/index.tsx +0 -464
- package/src/components/ExportModal/index.tsx +0 -99
- package/src/components/Header/index.tsx +0 -81
- package/src/components/Icon/index.tsx +0 -184
- package/src/components/Input/index.tsx +0 -295
- package/src/components/InputClearButton/index.tsx +0 -59
- package/src/components/InternalPopover/index.tsx +0 -303
- package/src/components/KeyValueTable/index.tsx +0 -192
- package/src/components/Label/index.tsx +0 -10
- package/src/components/Layout/content.tsx +0 -31
- package/src/components/Layout/index.tsx +0 -55
- package/src/components/Menu/divider.tsx +0 -92
- package/src/components/Menu/index.tsx +0 -141
- package/src/components/Menu/item.tsx +0 -137
- package/src/components/Menu/section.tsx +0 -81
- package/src/components/Message/index.tsx +0 -220
- package/src/components/Modal/index.tsx +0 -26
- package/src/components/MultiSelect/index.tsx +0 -288
- package/src/components/Navbar/divider.tsx +0 -50
- package/src/components/Navbar/group.tsx +0 -53
- package/src/components/Navbar/index.tsx +0 -82
- package/src/components/Navbar/item.tsx +0 -92
- package/src/components/Notifications/index.tsx +0 -57
- package/src/components/Notifications/notification.tsx +0 -362
- package/src/components/Paging/index.tsx +0 -321
- package/src/components/Panel/LabelEditor.tsx +0 -67
- package/src/components/Panel/NonResponsiveActions.tsx +0 -79
- package/src/components/Panel/__screenshots__/linux/panel-SomePanel.png +0 -0
- package/src/components/Panel/index.tsx +0 -912
- package/src/components/Panel/panel.screenshot.tsx +0 -29
- package/src/components/Paragraph/index.tsx +0 -43
- package/src/components/Popover/index.tsx +0 -68
- package/src/components/RadioGroup/index.tsx +0 -71
- package/src/components/Slider/index.tsx +0 -358
- package/src/components/Spacer/index.tsx +0 -142
- package/src/components/Spinner/index.tsx +0 -74
- package/src/components/Table/body.tsx +0 -109
- package/src/components/Table/cell.tsx +0 -136
- package/src/components/Table/header.tsx +0 -236
- package/src/components/Table/headerCell.tsx +0 -203
- package/src/components/Table/helpers.ts +0 -308
- package/src/components/Table/index.tsx +0 -797
- package/src/components/Table/row.tsx +0 -288
- package/src/components/Table/value.tsx +0 -28
- package/src/components/Tabs/content.tsx +0 -68
- package/src/components/Tabs/index.tsx +0 -124
- package/src/components/Tabs/item.tsx +0 -198
- package/src/components/Tabs/list.tsx +0 -381
- package/src/components/Tag/group.tsx +0 -73
- package/src/components/Tag/index.tsx +0 -463
- package/src/components/Textarea/index.tsx +0 -277
- package/src/components/TimeAgo/index.tsx +0 -15
- package/src/components/Tree/index.tsx +0 -271
- package/src/constants/animations.ts +0 -9
- package/src/constants/colors.ts +0 -13
- package/src/constants/paging.ts +0 -93
- package/src/constants/sizes.ts +0 -185
- package/src/constants/theme.ts +0 -122
- package/src/containers/Paging.tsx +0 -136
- package/src/containers/PopoverProvider.tsx +0 -124
- package/src/containers/ReqoreProvider.tsx +0 -289
- package/src/containers/ThemeProvider.tsx +0 -12
- package/src/containers/UIProvider.tsx +0 -101
- package/src/context/PopoverContext.tsx +0 -11
- package/src/context/ReqoreContext.tsx +0 -47
- package/src/context/ThemeContext.tsx +0 -4
- package/src/helpers/animations.ts +0 -13
- package/src/helpers/colors.ts +0 -335
- package/src/helpers/time.ts +0 -21
- package/src/helpers/utils.ts +0 -152
- package/src/hooks/useAutoFocus.ts +0 -106
- package/src/hooks/useCloneThroughFragments.ts +0 -39
- package/src/hooks/useCombinedRefs.ts +0 -26
- package/src/hooks/useLatestZIndex.ts +0 -13
- package/src/hooks/useOutsideClick.ts +0 -29
- package/src/hooks/usePaging.ts +0 -128
- package/src/hooks/usePopover.tsx +0 -220
- package/src/hooks/useQueryWithDelay.ts +0 -30
- package/src/hooks/useReqore.ts +0 -12
- package/src/hooks/useReqoreContext.ts +0 -16
- package/src/hooks/useReqoreEffect.ts +0 -49
- package/src/hooks/useTextareaAutoSize.ts +0 -22
- package/src/hooks/useTheme.ts +0 -48
- package/src/hooks/useTooltip.ts +0 -40
- package/src/hooks/useWhyDidYouUpdate.ts +0 -32
- package/src/icons.json +0 -2295
- package/src/index.tsx +0 -80
- package/src/mock/breadcrumbs.ts +0 -146
- package/src/mock/collectionData.tsx +0 -380
- package/src/mock/data.json +0 -11000
- package/src/mock/icons.ts +0 -32
- package/src/mock/menu.ts +0 -93
- package/src/mock/multiSelect.ts +0 -71
- package/src/mock/object.json +0 -317
- package/src/mock/styleMock.js +0 -1
- package/src/mock/tableData.ts +0 -64
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +0 -27
- package/src/stories/Button/Button.stories.tsx +0 -405
- package/src/stories/Checkbox/Checkbox.stories.tsx +0 -75
- package/src/stories/Collection/Collection.stories.tsx +0 -317
- package/src/stories/Columns/Columns.stories.tsx +0 -158
- package/src/stories/Comment/Comment.stories.tsx +0 -136
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +0 -399
- package/src/stories/DatePicker/DatePicker.stories.tsx +0 -348
- package/src/stories/Drawer/Drawer.stories.tsx +0 -294
- package/src/stories/Dropdown/Dropdown.stories.tsx +0 -375
- package/src/stories/Dropdown/DropdownTests.stories.tsx +0 -111
- package/src/stories/ExportModal/ExportModal.stories.tsx +0 -18
- package/src/stories/Header/Header.stories.tsx +0 -108
- package/src/stories/Icon/Icon.stories.tsx +0 -162
- package/src/stories/Input/Input.stories.tsx +0 -220
- package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +0 -346
- package/src/stories/Label/Label.stories.tsx +0 -33
- package/src/stories/Menu/Menu.stories.tsx +0 -367
- package/src/stories/Message/Message.stories.tsx +0 -167
- package/src/stories/Modal/Manager.stories.tsx +0 -192
- package/src/stories/Modal/Modal.stories.tsx +0 -252
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +0 -140
- package/src/stories/Navbar/Navbar.stories.tsx +0 -119
- package/src/stories/Notifications/Interactive.stories.tsx +0 -117
- package/src/stories/Notifications/Notification.stories.tsx +0 -216
- package/src/stories/Notifications/Notifications.stories.tsx +0 -81
- package/src/stories/Paging/Paging.stories.tsx +0 -255
- package/src/stories/Panel/Panel.stories.tsx +0 -753
- package/src/stories/Paragraph/Paragraph.stories.tsx +0 -108
- package/src/stories/Popover/Popover.stories.tsx +0 -510
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +0 -212
- package/src/stories/Slider/Slider.stories.tsx +0 -173
- package/src/stories/Spacer/Spacer.stories.tsx +0 -100
- package/src/stories/Spinner/Spinner.stories.tsx +0 -82
- package/src/stories/Table/Table.stories.tsx +0 -571
- package/src/stories/Tabs/Tabs.stories.tsx +0 -346
- package/src/stories/Tag/Tag.stories.tsx +0 -381
- package/src/stories/Tag/TagGroup.stories.tsx +0 -307
- package/src/stories/TextArea/TextArea.stories.tsx +0 -287
- package/src/stories/TextArea/TextAreaTests.stories.tsx +0 -108
- package/src/stories/Tree/Tree.stories.tsx +0 -124
- package/src/stories/Wrapper.tsx +0 -13
- package/src/stories/utils/args.ts +0 -151
- package/src/stories/utils.ts +0 -39
- package/src/styles.ts +0 -124
- package/src/types/global.ts +0 -211
- package/src/types/icons.ts +0 -2272
- package/tsconfig.prod.json +0 -26
|
@@ -1,571 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import { fireEvent, userEvent, waitFor, within } from '@storybook/testing-library';
|
|
3
|
-
import { noop, slice } from 'lodash';
|
|
4
|
-
import { StyledEffect } from '../../components/Effect';
|
|
5
|
-
import { IReqoreTableColumn, IReqoreTableProps, IReqoreTableRowData } from '../../components/Table';
|
|
6
|
-
import { IReqoreCustomTableBodyCellProps } from '../../components/Table/cell';
|
|
7
|
-
import { IReqoreCustomHeaderCellProps } from '../../components/Table/header';
|
|
8
|
-
import { IReqoreCustomTableRowProps } from '../../components/Table/row';
|
|
9
|
-
import { TReqorePaginationType } from '../../constants/paging';
|
|
10
|
-
import { sleep } from '../../helpers/utils';
|
|
11
|
-
import {
|
|
12
|
-
ReqoreH3,
|
|
13
|
-
ReqoreH4,
|
|
14
|
-
ReqoreIcon,
|
|
15
|
-
ReqoreInput,
|
|
16
|
-
ReqoreP,
|
|
17
|
-
ReqoreTable,
|
|
18
|
-
ReqoreTag,
|
|
19
|
-
} from '../../index';
|
|
20
|
-
import tableData from '../../mock/tableData';
|
|
21
|
-
import { StoryMeta } from '../utils';
|
|
22
|
-
import { CustomIntentArg, FlatArg, IntentArg, SizeArg, argManager } from '../utils/args';
|
|
23
|
-
|
|
24
|
-
const { createArg } = argManager<IReqoreTableProps>();
|
|
25
|
-
|
|
26
|
-
const defaultColumns: IReqoreTableColumn[] = [
|
|
27
|
-
{
|
|
28
|
-
dataId: 'id',
|
|
29
|
-
intent: 'info',
|
|
30
|
-
header: {
|
|
31
|
-
label: 'ID',
|
|
32
|
-
tooltip: 'Custom ID tooltip nice',
|
|
33
|
-
},
|
|
34
|
-
cell: {
|
|
35
|
-
content: 'tag',
|
|
36
|
-
},
|
|
37
|
-
width: 80,
|
|
38
|
-
align: 'center',
|
|
39
|
-
sortable: true,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
header: {
|
|
43
|
-
label: 'Name',
|
|
44
|
-
columns: [
|
|
45
|
-
{
|
|
46
|
-
dataId: 'firstName',
|
|
47
|
-
minWidth: 50,
|
|
48
|
-
maxWidth: 500,
|
|
49
|
-
header: {
|
|
50
|
-
icon: 'SlideshowLine',
|
|
51
|
-
label: 'First Name',
|
|
52
|
-
effect: {
|
|
53
|
-
gradient: {
|
|
54
|
-
colors: {
|
|
55
|
-
0: 'success',
|
|
56
|
-
100: 'info',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
cell: {
|
|
62
|
-
padded: 'none',
|
|
63
|
-
content: ({ _size, firstName }) => (
|
|
64
|
-
<ReqoreInput icon='PriceTag2Fill' size={_size} value={firstName} />
|
|
65
|
-
),
|
|
66
|
-
},
|
|
67
|
-
width: 150,
|
|
68
|
-
grow: 2,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
dataId: 'lastName',
|
|
72
|
-
header: {
|
|
73
|
-
icon: 'SlideshowLine',
|
|
74
|
-
label: 'Last Name',
|
|
75
|
-
},
|
|
76
|
-
width: 150,
|
|
77
|
-
grow: 1,
|
|
78
|
-
sortable: true,
|
|
79
|
-
cell: {
|
|
80
|
-
onClick: ({ lastName }) => alert(`Clicked last name cell ${lastName}`),
|
|
81
|
-
content: 'title:info',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
dataId: 'name',
|
|
87
|
-
grow: 3,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
dataId: 'address',
|
|
91
|
-
header: {
|
|
92
|
-
label: 'Address',
|
|
93
|
-
description: 'This is the address',
|
|
94
|
-
onClick: () => alert('clicked address'),
|
|
95
|
-
},
|
|
96
|
-
width: 300,
|
|
97
|
-
grow: 2,
|
|
98
|
-
resizable: false,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
dataId: 'age',
|
|
102
|
-
header: {
|
|
103
|
-
label: 'Really long age header',
|
|
104
|
-
icon: 'User4Line',
|
|
105
|
-
tooltip: 'Custom age tooltip',
|
|
106
|
-
actions: [
|
|
107
|
-
{
|
|
108
|
-
label: 'Do something',
|
|
109
|
-
icon: 'EBike2Fill',
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
width: 100,
|
|
114
|
-
align: 'center',
|
|
115
|
-
sortable: true,
|
|
116
|
-
|
|
117
|
-
cell: {
|
|
118
|
-
intent: 'danger',
|
|
119
|
-
content: 'tag:#000000',
|
|
120
|
-
tooltip: (value) => `Age is ${value}`,
|
|
121
|
-
onClick: ({ age }) => alert(`Clicked age cell ${age}`),
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
header: {
|
|
126
|
-
label: 'Data',
|
|
127
|
-
columns: [
|
|
128
|
-
{
|
|
129
|
-
dataId: 'occupation',
|
|
130
|
-
header: { label: 'Ocuppation' },
|
|
131
|
-
width: 200,
|
|
132
|
-
cell: { content: 'text:warning' },
|
|
133
|
-
filterable: true,
|
|
134
|
-
filterPlaceholder: 'Search occupation',
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
dataId: 'group',
|
|
138
|
-
align: 'right',
|
|
139
|
-
header: { label: <ReqoreTag label='Group' icon='Group2Line' size='small' /> },
|
|
140
|
-
width: 150,
|
|
141
|
-
cell: { intent: 'muted' },
|
|
142
|
-
filterable: true,
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
dataId: 'data',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
dataId: 'date',
|
|
150
|
-
header: { label: 'Date' },
|
|
151
|
-
sortable: true,
|
|
152
|
-
grow: 2,
|
|
153
|
-
width: 150,
|
|
154
|
-
cell: {
|
|
155
|
-
content: 'time-ago',
|
|
156
|
-
tooltip: () => ({
|
|
157
|
-
title: 'Custom tooltip',
|
|
158
|
-
content: 'This is a custom tooltip',
|
|
159
|
-
effect: {
|
|
160
|
-
gradient: {
|
|
161
|
-
colors: {
|
|
162
|
-
0: 'warning',
|
|
163
|
-
100: 'info',
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
}),
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
dataId: 'actions',
|
|
172
|
-
header: {
|
|
173
|
-
icon: 'SettingsLine',
|
|
174
|
-
},
|
|
175
|
-
width: 120,
|
|
176
|
-
align: 'center',
|
|
177
|
-
pin: 'right',
|
|
178
|
-
|
|
179
|
-
cell: {
|
|
180
|
-
padded: 'none',
|
|
181
|
-
actions: () => [
|
|
182
|
-
{
|
|
183
|
-
icon: 'AddLine',
|
|
184
|
-
intent: 'info',
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
icon: 'EditLine',
|
|
188
|
-
intent: 'warning',
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
icon: 'DeleteBinLine',
|
|
192
|
-
intent: 'danger',
|
|
193
|
-
},
|
|
194
|
-
],
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
];
|
|
198
|
-
|
|
199
|
-
const defaultColumnsWithFilters: IReqoreTableColumn[] = defaultColumns.map((column, index) => {
|
|
200
|
-
if (index === 4) {
|
|
201
|
-
return {
|
|
202
|
-
...column,
|
|
203
|
-
header: {
|
|
204
|
-
...column.header,
|
|
205
|
-
columns: column.header.columns.map((subColumn, subIndex) =>
|
|
206
|
-
subIndex === 0
|
|
207
|
-
? {
|
|
208
|
-
...subColumn,
|
|
209
|
-
filter: 'Advisor',
|
|
210
|
-
}
|
|
211
|
-
: {
|
|
212
|
-
...subColumn,
|
|
213
|
-
filter: 'net',
|
|
214
|
-
}
|
|
215
|
-
),
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return column;
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
const defaultColumnsWithHiddenColumns: IReqoreTableColumn[] = defaultColumns.map(
|
|
224
|
-
(column, index) => {
|
|
225
|
-
if (index === 4) {
|
|
226
|
-
return {
|
|
227
|
-
...column,
|
|
228
|
-
header: {
|
|
229
|
-
...column.header,
|
|
230
|
-
columns: column.header.columns.map((subColumn, subIndex) =>
|
|
231
|
-
subIndex === 0
|
|
232
|
-
? {
|
|
233
|
-
...subColumn,
|
|
234
|
-
show: false,
|
|
235
|
-
}
|
|
236
|
-
: subColumn
|
|
237
|
-
),
|
|
238
|
-
},
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (index === 2) {
|
|
243
|
-
return {
|
|
244
|
-
...column,
|
|
245
|
-
show: false,
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return column;
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
const defaultColumnsWithPinnedColumns: IReqoreTableColumn[] = defaultColumns.map(
|
|
254
|
-
(column, index) => {
|
|
255
|
-
if (index === 0) {
|
|
256
|
-
return {
|
|
257
|
-
...column,
|
|
258
|
-
pin: 'left',
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (index === 1) {
|
|
263
|
-
return {
|
|
264
|
-
...column,
|
|
265
|
-
header: {
|
|
266
|
-
...column.header,
|
|
267
|
-
columns: column.header.columns.map((subColumn, subIndex) =>
|
|
268
|
-
subIndex === 1
|
|
269
|
-
? {
|
|
270
|
-
...subColumn,
|
|
271
|
-
pin: 'left',
|
|
272
|
-
}
|
|
273
|
-
: subColumn
|
|
274
|
-
),
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (index === 3) {
|
|
280
|
-
return {
|
|
281
|
-
...column,
|
|
282
|
-
pin: 'right',
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return column;
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
const defaultColumnsWithCustomContentHeaders: IReqoreTableColumn[] = defaultColumns.map(
|
|
291
|
-
(column, index) => {
|
|
292
|
-
if (index === 4) {
|
|
293
|
-
return {
|
|
294
|
-
...column,
|
|
295
|
-
header: {
|
|
296
|
-
...column.header,
|
|
297
|
-
content: <ReqoreInput icon='PriceTag2Fill' value='Custom input value' rounded={false} />,
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return column;
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
const meta = {
|
|
307
|
-
title: 'Collections/Table/Stories',
|
|
308
|
-
component: ReqoreTable,
|
|
309
|
-
args: {
|
|
310
|
-
columns: defaultColumns,
|
|
311
|
-
data: tableData.data,
|
|
312
|
-
height: 600,
|
|
313
|
-
selectToggleTooltip: 'Select this row',
|
|
314
|
-
fill: false,
|
|
315
|
-
sort: { by: 'lastName', direction: 'desc' },
|
|
316
|
-
label: 'Table',
|
|
317
|
-
},
|
|
318
|
-
argTypes: {
|
|
319
|
-
...createArg('rounded', {
|
|
320
|
-
type: 'boolean',
|
|
321
|
-
name: 'Rounded',
|
|
322
|
-
description: 'If the table should have rounded corners',
|
|
323
|
-
}),
|
|
324
|
-
...createArg('striped', {
|
|
325
|
-
type: 'boolean',
|
|
326
|
-
name: 'Striped',
|
|
327
|
-
description: 'If the table should have striped rows',
|
|
328
|
-
}),
|
|
329
|
-
...createArg('selectable', {
|
|
330
|
-
type: 'boolean',
|
|
331
|
-
name: 'Selectable',
|
|
332
|
-
description: 'If the table should be selectable',
|
|
333
|
-
}),
|
|
334
|
-
...createArg('columns', {
|
|
335
|
-
name: 'Columns',
|
|
336
|
-
}),
|
|
337
|
-
...createArg('width', {
|
|
338
|
-
type: 'number',
|
|
339
|
-
name: 'Width',
|
|
340
|
-
description: 'The width of the table',
|
|
341
|
-
}),
|
|
342
|
-
...createArg('height', {
|
|
343
|
-
type: 'number',
|
|
344
|
-
name: 'Height',
|
|
345
|
-
description: 'The height of the table',
|
|
346
|
-
}),
|
|
347
|
-
...createArg('data', {
|
|
348
|
-
type: 'array',
|
|
349
|
-
name: 'Data',
|
|
350
|
-
description: 'The data to be displayed in the table',
|
|
351
|
-
table: {
|
|
352
|
-
disable: true,
|
|
353
|
-
},
|
|
354
|
-
}),
|
|
355
|
-
...createArg('selectToggleTooltip', {
|
|
356
|
-
type: 'string',
|
|
357
|
-
name: 'Select Toggle Tooltip',
|
|
358
|
-
description: 'The tooltip of the select toggle',
|
|
359
|
-
}),
|
|
360
|
-
...createArg('fill', {
|
|
361
|
-
type: 'boolean',
|
|
362
|
-
name: 'Fill',
|
|
363
|
-
description: 'Whether the table should fill the parent',
|
|
364
|
-
}),
|
|
365
|
-
...SizeArg,
|
|
366
|
-
...FlatArg,
|
|
367
|
-
...IntentArg,
|
|
368
|
-
...CustomIntentArg('selectedRowIntent'),
|
|
369
|
-
},
|
|
370
|
-
} as StoryMeta<typeof ReqoreTable>;
|
|
371
|
-
|
|
372
|
-
export default meta;
|
|
373
|
-
type Story = StoryObj<typeof meta>;
|
|
374
|
-
|
|
375
|
-
export const Basic: Story = {};
|
|
376
|
-
|
|
377
|
-
export const NoLabel: Story = {
|
|
378
|
-
args: {
|
|
379
|
-
label: undefined,
|
|
380
|
-
},
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
export const CustomWidth: Story = {
|
|
384
|
-
args: {
|
|
385
|
-
width: 400,
|
|
386
|
-
},
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
export const NotFlat: Story = {
|
|
390
|
-
args: {
|
|
391
|
-
flat: false,
|
|
392
|
-
},
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
export const NoHeight: Story = {
|
|
396
|
-
args: {
|
|
397
|
-
height: undefined,
|
|
398
|
-
data: slice(tableData.data, 0, 150),
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
export const InteractiveRows: Story = {
|
|
403
|
-
args: {
|
|
404
|
-
onRowClick: noop,
|
|
405
|
-
},
|
|
406
|
-
play: async ({ canvasElement }) => {
|
|
407
|
-
await userEvent.hover(canvasElement.querySelectorAll('.reqore-table-row')[2]);
|
|
408
|
-
},
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
export const Striped: Story = {
|
|
412
|
-
args: {
|
|
413
|
-
striped: true,
|
|
414
|
-
},
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
export const Filterable: Story = {
|
|
418
|
-
args: {
|
|
419
|
-
filterable: true,
|
|
420
|
-
},
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
export const DefaultFilter: Story = {
|
|
424
|
-
args: {
|
|
425
|
-
filterable: true,
|
|
426
|
-
filter: 'Village',
|
|
427
|
-
},
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
export const NoDataMessage: Story = {
|
|
431
|
-
args: {
|
|
432
|
-
filterable: true,
|
|
433
|
-
filter: 'asjkghakshgjkashg',
|
|
434
|
-
},
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
export const FilterableColumns: Story = {
|
|
438
|
-
args: {
|
|
439
|
-
columns: defaultColumnsWithFilters,
|
|
440
|
-
},
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
export const AllFiltersActive: Story = {
|
|
444
|
-
args: {
|
|
445
|
-
filterable: true,
|
|
446
|
-
filter: 'Road',
|
|
447
|
-
columns: defaultColumnsWithFilters,
|
|
448
|
-
},
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
export const HiddenColumns: Story = {
|
|
452
|
-
args: {
|
|
453
|
-
columns: defaultColumnsWithHiddenColumns,
|
|
454
|
-
},
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
export const PinnedColumns: Story = {
|
|
458
|
-
args: {
|
|
459
|
-
columns: defaultColumnsWithPinnedColumns,
|
|
460
|
-
zoomable: true,
|
|
461
|
-
filterable: true,
|
|
462
|
-
},
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
export const Selectable: Story = {
|
|
466
|
-
args: {
|
|
467
|
-
selectable: true,
|
|
468
|
-
},
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
export const PreselectedRows: Story = {
|
|
472
|
-
args: {
|
|
473
|
-
selected: ['274', '280'],
|
|
474
|
-
selectable: true,
|
|
475
|
-
},
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
export const Zoomable: Story = {
|
|
479
|
-
args: {
|
|
480
|
-
zoomable: true,
|
|
481
|
-
},
|
|
482
|
-
play: async ({ canvasElement }) => {
|
|
483
|
-
const canvas = within(canvasElement);
|
|
484
|
-
|
|
485
|
-
await sleep(1000);
|
|
486
|
-
await fireEvent.click(document.querySelector('.reqore-table-more'));
|
|
487
|
-
await waitFor(() => canvas.findAllByText('Zoom in'), { timeout: 5000 });
|
|
488
|
-
},
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
export const Exportable: Story = {
|
|
492
|
-
args: {
|
|
493
|
-
exportable: true,
|
|
494
|
-
filterable: true,
|
|
495
|
-
paging: 'buttons',
|
|
496
|
-
},
|
|
497
|
-
play: async ({ canvasElement }) => {
|
|
498
|
-
const canvas = within(canvasElement);
|
|
499
|
-
|
|
500
|
-
await sleep(1000);
|
|
501
|
-
await fireEvent.click(document.querySelector('.reqore-table-more'));
|
|
502
|
-
await waitFor(() => canvas.findAllByText('Export current view'), { timeout: 5000 });
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
export const FillParent: Story = {
|
|
507
|
-
args: {
|
|
508
|
-
fill: true,
|
|
509
|
-
},
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
export const Sizes: Story = {
|
|
513
|
-
args: {
|
|
514
|
-
size: 'small',
|
|
515
|
-
filterable: true,
|
|
516
|
-
wrapperSize: 'big',
|
|
517
|
-
},
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
export const DefaultPaging: Story = {
|
|
521
|
-
args: {
|
|
522
|
-
paging: 'buttons',
|
|
523
|
-
},
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
export const CustomPaging: Story = {
|
|
527
|
-
args: {
|
|
528
|
-
paging: {
|
|
529
|
-
fluid: true,
|
|
530
|
-
loadMoreLabel: 'Load more rows...',
|
|
531
|
-
showLabels: true,
|
|
532
|
-
infinite: true,
|
|
533
|
-
itemsPerPage: 100,
|
|
534
|
-
} as TReqorePaginationType<IReqoreTableRowData>,
|
|
535
|
-
},
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
export const CustomHeaderContent: Story = {
|
|
539
|
-
args: {
|
|
540
|
-
columns: defaultColumnsWithCustomContentHeaders,
|
|
541
|
-
},
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
const CustomHeaderCell = (props: IReqoreCustomHeaderCellProps) => {
|
|
545
|
-
if (props.hasColumns) {
|
|
546
|
-
return <ReqoreH3 intent='success'>{props.label}</ReqoreH3>;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
return (
|
|
550
|
-
<ReqoreH4 style={{ width: props.width, flexGrow: props.grow }}>
|
|
551
|
-
<ReqoreIcon icon={props.icon} />
|
|
552
|
-
{props.label}
|
|
553
|
-
</ReqoreH4>
|
|
554
|
-
);
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
const CustomCell = (props: IReqoreCustomTableBodyCellProps) => {
|
|
558
|
-
return <ReqoreP style={{ width: props.width, flexGrow: props.grow }}>{props.children}</ReqoreP>;
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
const CustomRow = (props: IReqoreCustomTableRowProps) => {
|
|
562
|
-
return <StyledEffect style={props.style}>{props.children}</StyledEffect>;
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
export const CustomCellsAndRows: Story = {
|
|
566
|
-
args: {
|
|
567
|
-
headerCellComponent: CustomHeaderCell,
|
|
568
|
-
bodyCellComponent: CustomCell,
|
|
569
|
-
rowComponent: CustomRow,
|
|
570
|
-
},
|
|
571
|
-
};
|