@qoretechnologies/reqore 0.36.1 → 0.36.2
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/components/InternalPopover/index.js +2 -2
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/KeyValueTable/index.d.ts +5 -2
- package/dist/components/KeyValueTable/index.d.ts.map +1 -1
- package/dist/components/KeyValueTable/index.js +32 -2
- package/dist/components/KeyValueTable/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +1 -0
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -0
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +20 -13
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Table/body.d.ts.map +1 -1
- package/dist/components/Table/body.js +22 -19
- package/dist/components/Table/body.js.map +1 -1
- package/dist/components/Table/cell.d.ts +3 -2
- package/dist/components/Table/cell.d.ts.map +1 -1
- package/dist/components/Table/cell.js +8 -4
- package/dist/components/Table/cell.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +11 -9
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +35 -34
- package/dist/components/Table/row.js.map +1 -1
- package/dist/constants/sizes.js +5 -5
- package/package.json +1 -1
- package/src/components/InternalPopover/index.tsx +2 -2
- package/src/components/KeyValueTable/index.tsx +42 -0
- package/src/components/Message/index.tsx +1 -0
- package/src/components/Notifications/notification.tsx +12 -1
- package/src/components/Popover/index.tsx +3 -0
- package/src/components/Table/body.tsx +20 -17
- package/src/components/Table/cell.tsx +15 -4
- package/src/components/Table/index.tsx +54 -43
- package/src/components/Table/row.tsx +36 -40
- package/src/constants/sizes.ts +5 -5
- package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +41 -0
- package/src/stories/Message/Message.stories.tsx +25 -0
- package/tests.json +1 -1
|
@@ -3,10 +3,17 @@ import { size as count, isArray } from 'lodash';
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { useMeasure, useUpdateEffect } from 'react-use';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ReqoreMessage,
|
|
8
|
+
ReqorePaginationContainer,
|
|
9
|
+
ReqorePanel,
|
|
10
|
+
ReqoreVerticalSpacer,
|
|
11
|
+
useReqoreTheme,
|
|
12
|
+
} from '../..';
|
|
7
13
|
import { TReqorePaginationType, getPagingObjectFromType } from '../../constants/paging';
|
|
8
14
|
import { TABLE_SIZE_TO_PX, TSizes } from '../../constants/sizes';
|
|
9
15
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
16
|
+
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
10
17
|
import { useQueryWithDelay } from '../../hooks/useQueryWithDelay';
|
|
11
18
|
import { IReqoreIntent, IReqoreTooltip } from '../../types/global';
|
|
12
19
|
import { IReqoreButtonProps, TReqoreBadge } from '../Button';
|
|
@@ -183,7 +190,6 @@ const ReqoreTable = ({
|
|
|
183
190
|
selected,
|
|
184
191
|
onSelectedChange,
|
|
185
192
|
selectToggleTooltip,
|
|
186
|
-
customTheme,
|
|
187
193
|
onRowClick,
|
|
188
194
|
striped,
|
|
189
195
|
selectedRowIntent = 'info',
|
|
@@ -222,6 +228,7 @@ const ReqoreTable = ({
|
|
|
222
228
|
const [_internalColumns, setColumns] = useState<IReqoreTableColumn[]>(columns);
|
|
223
229
|
const [zoom, setZoom] = useState<number>(sizeToZoom[size]);
|
|
224
230
|
const [showExportModal, setShowExportModal] = useState<'full' | 'current' | undefined>(undefined);
|
|
231
|
+
const theme = useReqoreTheme('main', rest.customTheme, intent);
|
|
225
232
|
|
|
226
233
|
const [wrapperRef, sizes] = useMeasure();
|
|
227
234
|
const { query, preQuery, setQuery, setPreQuery } = useQueryWithDelay(
|
|
@@ -554,6 +561,7 @@ const ReqoreTable = ({
|
|
|
554
561
|
|
|
555
562
|
if (exportable) {
|
|
556
563
|
moreActions = [
|
|
564
|
+
...moreActions,
|
|
557
565
|
...getExportActions((type) => setShowExportModal(type)),
|
|
558
566
|
{ divider: true, line: true },
|
|
559
567
|
];
|
|
@@ -561,6 +569,7 @@ const ReqoreTable = ({
|
|
|
561
569
|
|
|
562
570
|
if (zoomable) {
|
|
563
571
|
moreActions = [
|
|
572
|
+
...moreActions,
|
|
564
573
|
...getZoomActions('reqore-table', zoom, setZoom, true),
|
|
565
574
|
{ divider: true, line: true },
|
|
566
575
|
];
|
|
@@ -703,47 +712,49 @@ const ReqoreTable = ({
|
|
|
703
712
|
getContentRef={wrapperRef}
|
|
704
713
|
badge={badge}
|
|
705
714
|
>
|
|
706
|
-
<
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
{
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
715
|
+
<ReqoreThemeProvider theme={theme}>
|
|
716
|
+
<ReqorePaginationContainer<IReqoreTableRowData>
|
|
717
|
+
items={transformedData}
|
|
718
|
+
type={
|
|
719
|
+
pagingOptions
|
|
720
|
+
? {
|
|
721
|
+
...pagingOptions,
|
|
722
|
+
onPageChange: () => {
|
|
723
|
+
if (!pagingOptions.infinite) {
|
|
724
|
+
handleScrollToTop();
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
}
|
|
728
|
+
: undefined
|
|
729
|
+
}
|
|
730
|
+
>
|
|
731
|
+
{(pagedData) => (
|
|
732
|
+
<>
|
|
733
|
+
{showExportModal && (
|
|
734
|
+
<ReqoreExportModal
|
|
735
|
+
data={removeInternalData(
|
|
736
|
+
showExportModal === 'current' ? pagedData : transformedData
|
|
737
|
+
)}
|
|
738
|
+
onClose={() => setShowExportModal(undefined)}
|
|
739
|
+
/>
|
|
740
|
+
)}
|
|
741
|
+
<StyledTablesWrapper className='reqore-table-wrapper'>
|
|
742
|
+
{renderTable('left', pagedData)}
|
|
743
|
+
{renderTable('main', pagedData)}
|
|
744
|
+
{renderTable('right', pagedData)}
|
|
745
|
+
</StyledTablesWrapper>
|
|
746
|
+
{count(pagedData) === 0 ? (
|
|
747
|
+
<>
|
|
748
|
+
<ReqoreVerticalSpacer height={10} />
|
|
749
|
+
<ReqoreMessage flat size={size} icon='Search2Line'>
|
|
750
|
+
{emptyMessage}
|
|
751
|
+
</ReqoreMessage>
|
|
752
|
+
</>
|
|
753
|
+
) : null}
|
|
754
|
+
</>
|
|
755
|
+
)}
|
|
756
|
+
</ReqorePaginationContainer>
|
|
757
|
+
</ReqoreThemeProvider>
|
|
747
758
|
</ReqorePanel>
|
|
748
759
|
</>
|
|
749
760
|
);
|
|
@@ -3,7 +3,7 @@ import { isFunction, isString } from 'lodash';
|
|
|
3
3
|
import React, { ReactElement, useState } from 'react';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
import { IReqoreTableColumn, IReqoreTableData, IReqoreTableRowClick } from '.';
|
|
6
|
-
import { ReqoreButton, ReqoreControlGroup
|
|
6
|
+
import { ReqoreButton, ReqoreControlGroup } from '../..';
|
|
7
7
|
import { SIZE_TO_PX, TSizes } from '../../constants/sizes';
|
|
8
8
|
import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
9
9
|
import { IReqoreTooltip } from '../../types/global';
|
|
@@ -200,48 +200,44 @@ const ReqoreTableRow = ({
|
|
|
200
200
|
: {};
|
|
201
201
|
|
|
202
202
|
return (
|
|
203
|
-
<
|
|
203
|
+
<CellComponent
|
|
204
204
|
key={dataId}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
className: 'reqore-table-cell',
|
|
239
|
-
} as IReqoreTableCellStyle
|
|
240
|
-
}
|
|
241
|
-
{...tooltip}
|
|
205
|
+
{...({
|
|
206
|
+
width: resizedWidth || width,
|
|
207
|
+
minWidth,
|
|
208
|
+
maxWidth,
|
|
209
|
+
grow,
|
|
210
|
+
align,
|
|
211
|
+
size,
|
|
212
|
+
striped,
|
|
213
|
+
tooltip,
|
|
214
|
+
padded: cell?.padded,
|
|
215
|
+
disabled: data[index]._disabled,
|
|
216
|
+
selected: !!isSelected,
|
|
217
|
+
selectedIntent: selectedRowIntent,
|
|
218
|
+
flat,
|
|
219
|
+
even: index % 2 === 0 ? true : false,
|
|
220
|
+
intent: cell?.intent || data[index]._intent || intent,
|
|
221
|
+
hovered: isHovered,
|
|
222
|
+
interactive: !!cell?.onClick || !!onRowClick,
|
|
223
|
+
interactiveCell: !!cell?.onClick,
|
|
224
|
+
onClick: (e: React.MouseEvent<HTMLDivElement>) => {
|
|
225
|
+
if (cell?.onClick) {
|
|
226
|
+
e.stopPropagation();
|
|
227
|
+
cell.onClick(data[index]);
|
|
228
|
+
} else if (onRowClick) {
|
|
229
|
+
e.stopPropagation();
|
|
230
|
+
onRowClick(data[index]);
|
|
231
|
+
} else if (selectable && data[index]._selectId) {
|
|
232
|
+
// Otherwise select the row if selectable
|
|
233
|
+
onSelectClick(data[index]._selectId!);
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
className: 'reqore-table-cell',
|
|
237
|
+
} as IReqoreTableCellStyle)}
|
|
242
238
|
>
|
|
243
239
|
{renderContent(cell, data[index], dataId, align)}
|
|
244
|
-
</
|
|
240
|
+
</CellComponent>
|
|
245
241
|
);
|
|
246
242
|
}
|
|
247
243
|
);
|
package/src/constants/sizes.ts
CHANGED
|
@@ -110,11 +110,11 @@ export const TEXT_FROM_SIZE = {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
export const ICON_FROM_SIZE = {
|
|
113
|
-
tiny:
|
|
114
|
-
small:
|
|
115
|
-
normal:
|
|
116
|
-
big:
|
|
117
|
-
huge:
|
|
113
|
+
tiny: 13,
|
|
114
|
+
small: 17,
|
|
115
|
+
normal: 20,
|
|
116
|
+
big: 26,
|
|
117
|
+
huge: 33,
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
export const PADDING_FROM_SIZE = {
|
|
@@ -3,6 +3,7 @@ import ReqoreIcon from '../../components/Icon';
|
|
|
3
3
|
import { IReqoreKeyValueTableProps, ReqoreKeyValueTable } from '../../components/KeyValueTable';
|
|
4
4
|
import { IReqoreTableRowData, TReqoreTableColumnContent } from '../../components/Table';
|
|
5
5
|
import { TReqorePaginationType } from '../../constants/paging';
|
|
6
|
+
import { Exportable as ExportableTable } from '../Table/Table.stories';
|
|
6
7
|
import { StoryMeta } from '../utils';
|
|
7
8
|
import { CustomIntentArg, FlatArg, IntentArg, SizeArg, argManager } from '../utils/args';
|
|
8
9
|
|
|
@@ -112,6 +113,23 @@ export const Striped: Story = {
|
|
|
112
113
|
},
|
|
113
114
|
};
|
|
114
115
|
|
|
116
|
+
export const Exportable: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
exportable: true,
|
|
119
|
+
zoomable: true,
|
|
120
|
+
},
|
|
121
|
+
play: async ({ canvasElement, ...rest }) => {
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
await ExportableTable.play({ canvasElement, ...rest });
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const Sortable: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
sortable: true,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
115
133
|
export const Filterable: Story = {
|
|
116
134
|
args: {
|
|
117
135
|
filterable: true,
|
|
@@ -139,6 +157,29 @@ export const AllFiltersActive: Story = {
|
|
|
139
157
|
},
|
|
140
158
|
};
|
|
141
159
|
|
|
160
|
+
export const WithActions: Story = {
|
|
161
|
+
args: {
|
|
162
|
+
rowActions: () => [
|
|
163
|
+
{
|
|
164
|
+
icon: 'EditLine',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
icon: 'DeleteBinLine',
|
|
168
|
+
intent: 'danger',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
zoomable: true,
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const CustomTheme: Story = {
|
|
176
|
+
args: {
|
|
177
|
+
customTheme: { main: '#ff0000' },
|
|
178
|
+
flat: false,
|
|
179
|
+
transparent: false,
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
142
183
|
export const NoDataMessage: Story = {
|
|
143
184
|
args: {
|
|
144
185
|
filterable: true,
|
|
@@ -109,6 +109,31 @@ export const CustomTheme: Story = {
|
|
|
109
109
|
},
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
+
export const WithMargin: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<>
|
|
115
|
+
<ReqoreMessage margin='both' title='Bottom & top margin'>
|
|
116
|
+
In to am attended desirous raptures declared diverted confined at. Collected instantly
|
|
117
|
+
remaining up certainly to necessary as. Over walk dull into son boy door went new. At or
|
|
118
|
+
happiness commanded daughters as.
|
|
119
|
+
</ReqoreMessage>
|
|
120
|
+
<ReqoreMessage margin='top' title='Top margin'>
|
|
121
|
+
In to am attended desirous raptures declared diverted confined at.
|
|
122
|
+
</ReqoreMessage>
|
|
123
|
+
<ReqoreMessage margin='bottom' size='big' title='Bottom margin'>
|
|
124
|
+
In to am attended desirous raptures declared diverted confined at. Collected instantly
|
|
125
|
+
remaining up certainly to necessary as. Over walk dull into son boy door went new. At or
|
|
126
|
+
happiness commanded daughters as.
|
|
127
|
+
</ReqoreMessage>
|
|
128
|
+
<ReqoreMessage margin='bottom' size='small' title='Bottom small margin'>
|
|
129
|
+
In to am attended desirous raptures declared diverted confined at. Collected instantly
|
|
130
|
+
remaining up certainly to necessary as. Over walk dull into son boy door went new. At or
|
|
131
|
+
happiness commanded daughters as.
|
|
132
|
+
</ReqoreMessage>
|
|
133
|
+
</>
|
|
134
|
+
),
|
|
135
|
+
};
|
|
136
|
+
|
|
112
137
|
export const Effect: Story = {
|
|
113
138
|
render: Template,
|
|
114
139
|
|