@blaze-cms/plugin-data-ui 0.141.0-core-styles.5 → 0.141.0-core-variants.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/CHANGELOG.md +1 -60
- package/lib/components/EntityManager/Entity/Entity.js +1 -9
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +4 -18
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +2 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +120 -114
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +19 -18
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +2 -11
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/utils/build-listing-query.js +1 -1
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/get-default-query-params.js +1 -1
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +1 -12
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +4 -18
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +2 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +57 -56
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +19 -18
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js +1 -7
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/utils/build-listing-query.js +0 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js +1 -1
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/package.json +11 -12
- package/src/components/EntityManager/Entity/Entity.js +0 -18
- package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +11 -24
- package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
- package/src/components/InfoBoxes/presentational/InfoBox.js +2 -2
- package/src/components/ListingTable/ListingTable.js +76 -66
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +18 -20
- package/src/components/ListingTable/service/index.js +2 -12
- package/src/utils/build-listing-query.js +0 -1
- package/src/utils/get-default-query-params.js +1 -1
- package/lib/components/hooks/useCallbackDebounce.js +0 -22
- package/lib/components/hooks/useCallbackDebounce.js.map +0 -1
- package/lib-es/components/hooks/useCallbackDebounce.js +0 -12
- package/lib-es/components/hooks/useCallbackDebounce.js.map +0 -1
- package/src/components/hooks/useCallbackDebounce.js +0 -15
|
@@ -9,7 +9,6 @@ import { SAVE_BUTTON_TEXTS } from '../../../../constants';
|
|
|
9
9
|
const EntityHeader = ({
|
|
10
10
|
saveButtonText,
|
|
11
11
|
entityData,
|
|
12
|
-
entitySchema,
|
|
13
12
|
entityIdentifier,
|
|
14
13
|
pageTitle,
|
|
15
14
|
onSubmit,
|
|
@@ -21,29 +20,18 @@ const EntityHeader = ({
|
|
|
21
20
|
toggleModal,
|
|
22
21
|
formData,
|
|
23
22
|
pageName,
|
|
24
|
-
onViewUrl
|
|
25
|
-
saveOnChange
|
|
23
|
+
onViewUrl
|
|
26
24
|
}) => {
|
|
27
25
|
const SaveButtonModifiers = isSaveButtonAvailable ? ['small'] : ['small', 'disabled'];
|
|
28
26
|
const showPreviewButton = isEnablePreviewButton && entityIdentifier && entityData.id;
|
|
29
27
|
const shouldDisableMoreMenu = saveButtonText === SAVE_BUTTON_TEXTS.saving;
|
|
30
28
|
|
|
31
|
-
const {
|
|
32
|
-
displayProperties: { adminCrudActions: { delete: deleteAction = { active: true } } = {} } = {}
|
|
33
|
-
} =
|
|
34
|
-
entitySchema || {};
|
|
35
|
-
|
|
36
|
-
const showDeleteButton =
|
|
37
|
-
deleteAction.active && formData && Object.keys(formData.values).length !== 0;
|
|
38
|
-
|
|
39
29
|
return (
|
|
40
30
|
<PageHeader title={pageTitle} pageName={pageName} onViewUrl={onViewUrl}>
|
|
41
31
|
<PageHeader.Actions>
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</Button>
|
|
46
|
-
)}
|
|
32
|
+
<Button onClick={onSubmit} modifiers={SaveButtonModifiers} data-testid="button-save">
|
|
33
|
+
{saveButtonText}
|
|
34
|
+
</Button>
|
|
47
35
|
<More disabled={shouldDisableMoreMenu}>
|
|
48
36
|
<More.Avatar data-testid={`entity-header-${pageName}`} isMoreMenu>
|
|
49
37
|
<span className="material-icons">more_vert</span>
|
|
@@ -70,11 +58,12 @@ const EntityHeader = ({
|
|
|
70
58
|
View
|
|
71
59
|
</Button>
|
|
72
60
|
)}
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
{formData &&
|
|
62
|
+
Object.keys(formData.values).length !== 0 && (
|
|
63
|
+
<Button className="more-menu__link" onClick={toggleModal}>
|
|
64
|
+
Delete
|
|
65
|
+
</Button>
|
|
66
|
+
)}
|
|
78
67
|
</More.Content>
|
|
79
68
|
</More>
|
|
80
69
|
</PageHeader.Actions>
|
|
@@ -85,7 +74,6 @@ const EntityHeader = ({
|
|
|
85
74
|
EntityHeader.propTypes = {
|
|
86
75
|
entityData: PropTypes.object,
|
|
87
76
|
entityIdentifier: PropTypes.string,
|
|
88
|
-
entitySchema: PropTypes.object.isRequired,
|
|
89
77
|
pageTitle: PropTypes.string.isRequired,
|
|
90
78
|
pageName: PropTypes.string,
|
|
91
79
|
onSubmit: PropTypes.func.isRequired,
|
|
@@ -97,8 +85,7 @@ EntityHeader.propTypes = {
|
|
|
97
85
|
toggleModal: PropTypes.func.isRequired,
|
|
98
86
|
formData: PropTypes.object,
|
|
99
87
|
onViewUrl: PropTypes.func.isRequired,
|
|
100
|
-
saveButtonText: PropTypes.string
|
|
101
|
-
saveOnChange: PropTypes.bool.isRequired
|
|
88
|
+
saveButtonText: PropTypes.string
|
|
102
89
|
};
|
|
103
90
|
|
|
104
91
|
EntityHeader.defaultProps = {
|
|
@@ -8,10 +8,10 @@ const InfoBox = ({ items, infoBoxKey }) => {
|
|
|
8
8
|
Object.values(item)
|
|
9
9
|
.map(info => {
|
|
10
10
|
if (!info.label || !info.value) return null;
|
|
11
|
-
|
|
11
|
+
const label = info.showLabel === false ? '' : `${info.label}: `;
|
|
12
12
|
return (
|
|
13
13
|
<div className="info-box--item" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>
|
|
14
|
-
<div className="info-box--label">{
|
|
14
|
+
<div className="info-box--label">{label}</div>
|
|
15
15
|
<div className="info-box--value">{info.value}</div>
|
|
16
16
|
</div>
|
|
17
17
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { useApolloClient } from '@apollo/client';
|
|
1
2
|
import React, { useEffect, useState, Fragment } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { withRouter, Link } from 'react-router-dom';
|
|
3
5
|
import More from '@blaze-react/more';
|
|
4
|
-
import { useApolloClient } from '@apollo/client';
|
|
5
|
-
import { withRouter, Link, useLocation } from 'react-router-dom';
|
|
6
6
|
import { PageHeader, DeleteAction, CardPrompt } from '@blaze-cms/admin';
|
|
7
7
|
import { useToasts } from '@blaze-react/toaster';
|
|
8
8
|
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
@@ -12,20 +12,20 @@ import { fetchData } from './service';
|
|
|
12
12
|
import { populateRows, formatRows, getParsedRowData } from './mappers/populate-rows';
|
|
13
13
|
import { getDefaultQueryParams } from '../../utils/get-default-query-params';
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const OVER_SCAN_BUFFER = 10;
|
|
16
|
+
|
|
17
|
+
const ListingTable = ({ match, entitySchema }) => {
|
|
16
18
|
const [tableData, setTableData] = useState({});
|
|
17
19
|
const [modalStatus, setModalStatus] = useState(false);
|
|
18
20
|
const [itemToDelete, setItemToDelete] = useState({});
|
|
19
21
|
const [previousSchema, setPreviousSchema] = useState({ id: null });
|
|
20
|
-
const [
|
|
22
|
+
const [scrollToIndex, setScrollToIndex] = useState(0);
|
|
23
|
+
const [verifiedRanges, setVerifiedRanges] = useState([]);
|
|
21
24
|
const queryParamsDefault = getDefaultQueryParams(entitySchema);
|
|
22
25
|
const [queryParams, setQueryParams] = useState(queryParamsDefault);
|
|
23
26
|
const [listFilters, setListFilters] = useState([]);
|
|
24
27
|
const client = useApolloClient();
|
|
25
28
|
const { addToast } = useToasts();
|
|
26
|
-
const location = useLocation();
|
|
27
|
-
const searchParams = new URLSearchParams(location.search);
|
|
28
|
-
const currentPage = Number(searchParams.get('page')) || 1;
|
|
29
29
|
|
|
30
30
|
useEffect(
|
|
31
31
|
() => {
|
|
@@ -42,12 +42,12 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
42
42
|
[client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
const doQuery = async (filters = listFilters
|
|
46
|
-
const
|
|
45
|
+
const doQuery = async (filters = listFilters) => {
|
|
46
|
+
const data = await fetchData({
|
|
47
47
|
client,
|
|
48
48
|
querySettings: {
|
|
49
49
|
entitySchema,
|
|
50
|
-
queryParams:
|
|
50
|
+
queryParams: queryParamsDefault
|
|
51
51
|
},
|
|
52
52
|
listFilters: filters
|
|
53
53
|
});
|
|
@@ -56,22 +56,10 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
56
56
|
toggleModal,
|
|
57
57
|
url: match.url,
|
|
58
58
|
entitySchema,
|
|
59
|
-
rows:
|
|
59
|
+
rows: data
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
setTableData(populatedTable);
|
|
63
|
-
setTotalItems(totalRecords);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const handleOnPageChange = async ({ pageNumber, offset: _offset }) => {
|
|
67
|
-
const updatedQueryParams = {
|
|
68
|
-
...queryParams,
|
|
69
|
-
offset: _offset
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
await doQuery(listFilters, updatedQueryParams);
|
|
73
|
-
|
|
74
|
-
history.push(`?page=${pageNumber}`);
|
|
75
63
|
};
|
|
76
64
|
|
|
77
65
|
const updateListingFilters = async filters => {
|
|
@@ -112,9 +100,11 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
112
100
|
...queryParamsDefault,
|
|
113
101
|
sort: [{ property, direction }]
|
|
114
102
|
};
|
|
103
|
+
setScrollToIndex(0);
|
|
104
|
+
setVerifiedRanges([]);
|
|
115
105
|
setQueryParams(sortQueryParams);
|
|
116
106
|
|
|
117
|
-
const
|
|
107
|
+
const data = await fetchData({
|
|
118
108
|
client,
|
|
119
109
|
querySettings: {
|
|
120
110
|
entitySchema,
|
|
@@ -129,42 +119,66 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
129
119
|
...tableData,
|
|
130
120
|
appliedSort: { [property]: direction },
|
|
131
121
|
rows: formatRows({
|
|
132
|
-
rows: getParsedRowData(
|
|
122
|
+
rows: getParsedRowData(data),
|
|
133
123
|
url: match.url,
|
|
134
124
|
toggleModal,
|
|
135
125
|
firstColumn,
|
|
136
126
|
isEnquiry
|
|
137
127
|
})
|
|
138
128
|
});
|
|
139
|
-
history.push('?page=1');
|
|
140
129
|
};
|
|
141
130
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
131
|
+
const handleRenderedItems = async params => {
|
|
132
|
+
const { startIndex } = params;
|
|
133
|
+
const rowsLength = tableData.rows.length;
|
|
134
|
+
const loadIndex = Math.floor(rowsLength / 3) - OVER_SCAN_BUFFER;
|
|
135
|
+
if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {
|
|
136
|
+
const updatedQueryParams = {
|
|
137
|
+
...queryParams,
|
|
138
|
+
offset: rowsLength
|
|
139
|
+
};
|
|
140
|
+
const data = await fetchData({
|
|
141
|
+
client,
|
|
142
|
+
querySettings: {
|
|
143
|
+
entitySchema,
|
|
144
|
+
queryParams: updatedQueryParams
|
|
145
|
+
},
|
|
146
|
+
listFilters
|
|
147
|
+
});
|
|
148
|
+
const updatedRows = [
|
|
149
|
+
...tableData.rows,
|
|
150
|
+
...formatRows({
|
|
151
|
+
rows: getParsedRowData(data),
|
|
152
|
+
url: match.url,
|
|
153
|
+
toggleModal,
|
|
154
|
+
isEnquiry: tableData.isEnquiry
|
|
155
|
+
})
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
setVerifiedRanges([...verifiedRanges, loadIndex]);
|
|
159
|
+
setQueryParams(updatedQueryParams);
|
|
160
|
+
setTableData({
|
|
161
|
+
...tableData,
|
|
162
|
+
rows: updatedRows
|
|
163
|
+
});
|
|
164
|
+
setScrollToIndex(startIndex + OVER_SCAN_BUFFER);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
152
167
|
|
|
153
|
-
|
|
168
|
+
if (!tableData || !tableData.rows) return 'loading';
|
|
169
|
+
const showAddButton = !!tableData.rows.length;
|
|
154
170
|
|
|
155
171
|
return (
|
|
156
172
|
<div className="page">
|
|
157
|
-
{modalStatus &&
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
/>
|
|
165
|
-
)}
|
|
173
|
+
{modalStatus && (
|
|
174
|
+
<DeleteAction
|
|
175
|
+
onClose={toggleModal}
|
|
176
|
+
deleteAction={deleteAction}
|
|
177
|
+
itemName={itemToDelete.name}
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
166
180
|
<PageHeader title={entitySchema.displayName} subtitle="">
|
|
167
|
-
{
|
|
181
|
+
{showAddButton && (
|
|
168
182
|
<Fragment>
|
|
169
183
|
<Link
|
|
170
184
|
data-testid="addEntity"
|
|
@@ -183,7 +197,7 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
183
197
|
</Fragment>
|
|
184
198
|
)}
|
|
185
199
|
</PageHeader>
|
|
186
|
-
{!showAddButton &&
|
|
200
|
+
{!showAddButton && (
|
|
187
201
|
<CardPrompt>
|
|
188
202
|
<Link
|
|
189
203
|
className="button button--rounded button--cta"
|
|
@@ -192,30 +206,26 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
192
206
|
Add
|
|
193
207
|
</Link>
|
|
194
208
|
</CardPrompt>
|
|
195
|
-
) : (
|
|
196
|
-
<>
|
|
197
|
-
<RenderHook
|
|
198
|
-
hookKey="entity:listing:main:top"
|
|
199
|
-
schema={entitySchema}
|
|
200
|
-
setListFilters={updateListingFilters}
|
|
201
|
-
/>
|
|
202
|
-
<ListingTableContent
|
|
203
|
-
totalItems={totalItems}
|
|
204
|
-
currentPage={currentPage}
|
|
205
|
-
onSort={handleSort}
|
|
206
|
-
handleOnPageChange={handleOnPageChange}
|
|
207
|
-
tableData={tableData}
|
|
208
|
-
onCloseCardPrompt={onCloseCardPrompt}
|
|
209
|
-
/>
|
|
210
|
-
</>
|
|
211
209
|
)}
|
|
210
|
+
<RenderHook
|
|
211
|
+
hookKey="entity:listing:main:top"
|
|
212
|
+
schema={entitySchema}
|
|
213
|
+
setListFilters={updateListingFilters}
|
|
214
|
+
/>
|
|
215
|
+
<ListingTableContent
|
|
216
|
+
overScanBuffer={OVER_SCAN_BUFFER}
|
|
217
|
+
onSort={handleSort}
|
|
218
|
+
onRenderItems={handleRenderedItems}
|
|
219
|
+
tableData={tableData}
|
|
220
|
+
onCloseCardPrompt={onCloseCardPrompt}
|
|
221
|
+
scrollToIndex={scrollToIndex}
|
|
222
|
+
/>
|
|
212
223
|
</div>
|
|
213
224
|
);
|
|
214
225
|
};
|
|
215
226
|
ListingTable.propTypes = {
|
|
216
227
|
entitySchema: PropTypes.object.isRequired,
|
|
217
|
-
match: PropTypes.object.isRequired
|
|
218
|
-
history: PropTypes.object.isRequired
|
|
228
|
+
match: PropTypes.object.isRequired
|
|
219
229
|
};
|
|
220
230
|
|
|
221
231
|
export default withRouter(ListingTable);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Table from '@blaze-react/table';
|
|
3
|
-
import Pagination from '@blaze-react/pagination';
|
|
4
|
-
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import { withRouter } from 'react-router-dom';
|
|
7
5
|
|
|
@@ -9,9 +7,10 @@ const ListingTableContent = ({
|
|
|
9
7
|
tableData,
|
|
10
8
|
handleSelect,
|
|
11
9
|
onSort,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
onClickRow,
|
|
11
|
+
overScanBuffer,
|
|
12
|
+
onRenderItems,
|
|
13
|
+
scrollToIndex
|
|
15
14
|
}) => {
|
|
16
15
|
const displayTable = tableData && tableData.rows && !!tableData.rows.length;
|
|
17
16
|
const { isEnquiry } = tableData;
|
|
@@ -19,28 +18,22 @@ const ListingTableContent = ({
|
|
|
19
18
|
|
|
20
19
|
return (
|
|
21
20
|
<>
|
|
22
|
-
{displayTable
|
|
21
|
+
{displayTable && (
|
|
23
22
|
<>
|
|
24
23
|
<div className={className}>
|
|
25
24
|
<Table
|
|
25
|
+
scrollToIndex={scrollToIndex}
|
|
26
26
|
onSort={onSort}
|
|
27
|
+
onClickRow={onClickRow}
|
|
28
|
+
overScanBuffer={overScanBuffer}
|
|
29
|
+
onRenderItems={onRenderItems}
|
|
27
30
|
data={tableData}
|
|
28
31
|
checkboxes={!isEnquiry}
|
|
29
32
|
onSelect={handleSelect}
|
|
30
33
|
data-testid="listing-table-content"
|
|
31
34
|
/>
|
|
32
|
-
<Pagination
|
|
33
|
-
visiblePages={10}
|
|
34
|
-
totalItems={totalItems}
|
|
35
|
-
currentPage={currentPage}
|
|
36
|
-
onPageChange={handleOnPageChange}
|
|
37
|
-
/>
|
|
38
35
|
</div>
|
|
39
36
|
</>
|
|
40
|
-
) : (
|
|
41
|
-
<span className="table-no-results" data-testid="no-results">
|
|
42
|
-
No results
|
|
43
|
-
</span>
|
|
44
37
|
)}
|
|
45
38
|
</>
|
|
46
39
|
);
|
|
@@ -53,15 +46,20 @@ ListingTableContent.propTypes = {
|
|
|
53
46
|
}).isRequired,
|
|
54
47
|
handleSelect: PropTypes.func,
|
|
55
48
|
onSort: PropTypes.func,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
onClickRow: PropTypes.func,
|
|
50
|
+
overScanBuffer: PropTypes.number,
|
|
51
|
+
scrollToIndex: PropTypes.number,
|
|
52
|
+
onRenderItems: PropTypes.func
|
|
59
53
|
};
|
|
60
54
|
|
|
61
55
|
ListingTableContent.defaultProps = {
|
|
62
56
|
handleSelect: () => {},
|
|
63
57
|
onSort: () => {},
|
|
64
|
-
|
|
58
|
+
onClickRow: () => {},
|
|
59
|
+
overScanBuffer: 0,
|
|
60
|
+
scrollToIndex: 0,
|
|
61
|
+
onRenderItems: () => {},
|
|
62
|
+
selectedMenuItem: null
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
export default withRouter(ListingTableContent);
|
|
@@ -41,19 +41,9 @@ const fetchData = async ({ client, querySettings: { entitySchema, queryParams },
|
|
|
41
41
|
const isSearchQuery = source === 'search';
|
|
42
42
|
const query = buildListingQuery(entitySchema, isSearchQuery);
|
|
43
43
|
const variables = buildVariables({ entitySchema, listFilters, queryParams, isSearchQuery });
|
|
44
|
-
const { data = {} } = await client.query({
|
|
45
|
-
query,
|
|
46
|
-
variables,
|
|
47
|
-
fetchPolicy: 'network-only'
|
|
48
|
-
});
|
|
44
|
+
const { data = {} } = await client.query({ query, variables, fetchPolicy: 'network-only' });
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
listingData: data.searchResults.results,
|
|
53
|
-
totalRecords: data.searchResults.total
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return data;
|
|
46
|
+
return data.searchResults ? data.searchResults.results : data.listingData;
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
export { fetchData };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
require("core-js/modules/web.timers.js");
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
function useCallbackDebounce(callback, delay, dependencies, skip) {
|
|
11
|
-
(0, _react.useEffect)(function () {
|
|
12
|
-
if (skip) return;
|
|
13
|
-
var timer = setTimeout(callback, delay);
|
|
14
|
-
return function () {
|
|
15
|
-
return clearTimeout(timer);
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
-
dependencies);
|
|
20
|
-
}
|
|
21
|
-
var _default = exports["default"] = useCallbackDebounce;
|
|
22
|
-
//# sourceMappingURL=useCallbackDebounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCallbackDebounce.js","names":["_react","require","useCallbackDebounce","callback","delay","dependencies","skip","useEffect","timer","setTimeout","clearTimeout","_default","exports"],"sources":["../../../src/components/hooks/useCallbackDebounce.js"],"sourcesContent":["import { useEffect } from 'react';\n\nfunction useCallbackDebounce(callback, delay, dependencies, skip) {\n useEffect(\n () => {\n if (skip) return;\n const timer = setTimeout(callback, delay);\n return () => clearTimeout(timer);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n dependencies\n );\n}\n\nexport default useCallbackDebounce;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,KAAK,EAAEC,YAAY,EAAEC,IAAI,EAAE;EAChE,IAAAC,gBAAS,EACP,YAAM;IACJ,IAAID,IAAI,EAAE;IACV,IAAME,KAAK,GAAGC,UAAU,CAACN,QAAQ,EAAEC,KAAK,CAAC;IACzC,OAAO;MAAA,OAAMM,YAAY,CAACF,KAAK,CAAC;IAAA;EAClC,CAAC;EACD;EACAH,YACF,CAAC;AACH;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEcV,mBAAmB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
function useCallbackDebounce(callback, delay, dependencies, skip) {
|
|
3
|
-
useEffect(() => {
|
|
4
|
-
if (skip) return;
|
|
5
|
-
const timer = setTimeout(callback, delay);
|
|
6
|
-
return () => clearTimeout(timer);
|
|
7
|
-
},
|
|
8
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9
|
-
dependencies);
|
|
10
|
-
}
|
|
11
|
-
export default useCallbackDebounce;
|
|
12
|
-
//# sourceMappingURL=useCallbackDebounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCallbackDebounce.js","names":["useEffect","useCallbackDebounce","callback","delay","dependencies","skip","timer","setTimeout","clearTimeout"],"sources":["../../../src/components/hooks/useCallbackDebounce.js"],"sourcesContent":["import { useEffect } from 'react';\n\nfunction useCallbackDebounce(callback, delay, dependencies, skip) {\n useEffect(\n () => {\n if (skip) return;\n const timer = setTimeout(callback, delay);\n return () => clearTimeout(timer);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n dependencies\n );\n}\n\nexport default useCallbackDebounce;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,KAAK,EAAEC,YAAY,EAAEC,IAAI,EAAE;EAChEL,SAAS,CACP,MAAM;IACJ,IAAIK,IAAI,EAAE;IACV,MAAMC,KAAK,GAAGC,UAAU,CAACL,QAAQ,EAAEC,KAAK,CAAC;IACzC,OAAO,MAAMK,YAAY,CAACF,KAAK,CAAC;EAClC,CAAC;EACD;EACAF,YACF,CAAC;AACH;AAEA,eAAeH,mBAAmB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
function useCallbackDebounce(callback, delay, dependencies, skip) {
|
|
4
|
-
useEffect(
|
|
5
|
-
() => {
|
|
6
|
-
if (skip) return;
|
|
7
|
-
const timer = setTimeout(callback, delay);
|
|
8
|
-
return () => clearTimeout(timer);
|
|
9
|
-
},
|
|
10
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
|
-
dependencies
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default useCallbackDebounce;
|