@blaze-cms/plugin-data-ui 0.146.0-node18-core-styles-tooltips.45 → 0.146.0-node18-tooltips.38
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 +33 -129
- package/lib-es/components/EntityDataListing/EntityDataListing.js +33 -0
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -0
- package/lib-es/components/EntityDataListing/index.js +3 -0
- package/lib-es/components/EntityDataListing/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +30 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/Entity.js +452 -0
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +103 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +47 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +30 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +29 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +49 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +133 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +36 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +46 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +32 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js +12 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +39 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +53 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/index.js.map +1 -0
- package/lib-es/components/EntityManager/EntityManager.js +133 -0
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -0
- package/lib-es/components/EntityManager/index.js +3 -0
- package/lib-es/components/EntityManager/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js +6 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js +55 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -0
- package/lib-es/components/EntityManager/utils/entity.js +70 -0
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -0
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js +56 -0
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -0
- package/lib-es/components/EntityManager/utils/is-form-empty.js +9 -0
- package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -0
- package/lib-es/components/EntityManager/utils/query.js +23 -0
- package/lib-es/components/EntityManager/utils/query.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js +28 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +38 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +28 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js +39 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +17 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/index.js +3 -0
- package/lib-es/components/InfoBoxes/index.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +40 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js +12 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js +30 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTable.js +208 -0
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +72 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/index.js +3 -0
- package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +207 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +40 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js +96 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js +8 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js +34 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/index.js +3 -0
- package/lib-es/components/ListingTable/TableActions/index.js.map +1 -0
- package/lib-es/components/ListingTable/index.js +3 -0
- package/lib-es/components/ListingTable/index.js.map +1 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js +140 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -0
- package/lib-es/components/ListingTable/service/index.js +87 -0
- package/lib-es/components/ListingTable/service/index.js.map +1 -0
- package/lib-es/components/Tabs/index.js +40 -0
- package/lib-es/components/Tabs/index.js.map +1 -0
- package/lib-es/components/hooks/useCallbackDebounce.js +12 -0
- package/lib-es/components/hooks/useCallbackDebounce.js.map +1 -0
- package/lib-es/constants.js +42 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/icons/ContentIcon.js +80 -0
- package/lib-es/icons/ContentIcon.js.map +1 -0
- package/lib-es/icons/SettingsIcon.js +36 -0
- package/lib-es/icons/SettingsIcon.js.map +1 -0
- package/lib-es/icons/TaxonomyIcon.js +60 -0
- package/lib-es/icons/TaxonomyIcon.js.map +1 -0
- package/lib-es/icons/UsersIcon.js +33 -0
- package/lib-es/icons/UsersIcon.js.map +1 -0
- package/lib-es/icons/index.js +6 -0
- package/lib-es/icons/index.js.map +1 -0
- package/lib-es/index.js +84 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/utils/add-content-menu-items.js +72 -0
- package/lib-es/utils/add-content-menu-items.js.map +1 -0
- package/lib-es/utils/build-create-entity-mutation.js +21 -0
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -0
- package/lib-es/utils/build-delete-entity-mutation.js +18 -0
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -0
- package/lib-es/utils/build-listing-query.js +28 -0
- package/lib-es/utils/build-listing-query.js.map +1 -0
- package/lib-es/utils/build-update-data-query.js +24 -0
- package/lib-es/utils/build-update-data-query.js.map +1 -0
- package/lib-es/utils/build-update-publish-unpublish-mutation.js +22 -0
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -0
- package/lib-es/utils/get-default-query-params.js +17 -0
- package/lib-es/utils/get-default-query-params.js.map +1 -0
- package/lib-es/utils/hoc/withContext.js +8 -0
- package/lib-es/utils/hoc/withContext.js.map +1 -0
- package/lib-es/utils/hooks/useToggle.js +8 -0
- package/lib-es/utils/hooks/useToggle.js.map +1 -0
- package/lib-es/utils/index.js +3 -0
- package/lib-es/utils/index.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import React, { useState, useMemo, useEffect, useCallback } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Select from '@blaze-react/select';
|
|
7
|
+
import { useQuery, useApolloClient } from '@apollo/client';
|
|
8
|
+
import { getDynamicQuery, getQuery } from '@blaze-cms/admin-ui-utils';
|
|
9
|
+
import { BsArrowCounterclockwise, BsSearch } from 'react-icons/bs';
|
|
10
|
+
import { updateListFilters, buildQueryFields } from './helpers';
|
|
11
|
+
import { NOOP_QUERY } from './querys';
|
|
12
|
+
import { ENTER_KEY, DEFAULT_FILTER_OPTION_LABEL } from '../../../constants';
|
|
13
|
+
const SearchContainer = ({
|
|
14
|
+
setListFilters,
|
|
15
|
+
keywordFiltersToUse = [],
|
|
16
|
+
selectFiltersToDisplay = [],
|
|
17
|
+
schema,
|
|
18
|
+
index
|
|
19
|
+
}) => {
|
|
20
|
+
const apolloClient = useApolloClient();
|
|
21
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
22
|
+
const [selectedFilters, setSelectedFilters] = useState({});
|
|
23
|
+
const [selectOptions, setSelectOptions] = useState([]);
|
|
24
|
+
const displaySearchFilter = keywordFiltersToUse.length > 0;
|
|
25
|
+
const displaySelectFilters = selectFiltersToDisplay.length > 0;
|
|
26
|
+
const {
|
|
27
|
+
keywordSearchProperties,
|
|
28
|
+
keywordSearchLabels
|
|
29
|
+
} = useMemo(() => {
|
|
30
|
+
const labels = [];
|
|
31
|
+
const properties = [];
|
|
32
|
+
keywordFiltersToUse.forEach(([property, {
|
|
33
|
+
label
|
|
34
|
+
}]) => {
|
|
35
|
+
if (label) labels.push(label);
|
|
36
|
+
properties.push(property);
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
keywordSearchProperties: properties,
|
|
40
|
+
keywordSearchLabels: labels
|
|
41
|
+
};
|
|
42
|
+
}, [keywordFiltersToUse]);
|
|
43
|
+
const {
|
|
44
|
+
gqlFields,
|
|
45
|
+
rawQuery
|
|
46
|
+
} = useMemo(() => buildQueryFields(selectFiltersToDisplay, schema.id), [selectFiltersToDisplay, schema.id]);
|
|
47
|
+
const action = displaySelectFilters ? getDynamicQuery('ADMIN_SEARCH')([schema], gqlFields, false, index) : NOOP_QUERY;
|
|
48
|
+
const {
|
|
49
|
+
data
|
|
50
|
+
} = useQuery(action, {
|
|
51
|
+
skip: !displaySelectFilters,
|
|
52
|
+
variables: {
|
|
53
|
+
where: rawQuery,
|
|
54
|
+
limit: 0
|
|
55
|
+
},
|
|
56
|
+
fetchPolicy: 'cache-and-network'
|
|
57
|
+
});
|
|
58
|
+
const filterData = useMemo(() => {
|
|
59
|
+
const {
|
|
60
|
+
searchResults: {
|
|
61
|
+
rawResults: {
|
|
62
|
+
aggregations = {}
|
|
63
|
+
} = {}
|
|
64
|
+
} = {}
|
|
65
|
+
} = data || {};
|
|
66
|
+
const proccessedData = [];
|
|
67
|
+
Object.entries(aggregations).forEach(([key, {
|
|
68
|
+
buckets
|
|
69
|
+
}]) => {
|
|
70
|
+
proccessedData.push(Array.isArray(buckets) ? [key, buckets.map(b => b.key).filter(Boolean)] : []);
|
|
71
|
+
});
|
|
72
|
+
return proccessedData;
|
|
73
|
+
}, [data]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!filterData.length) {
|
|
76
|
+
setSelectOptions([]);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
(async () => {
|
|
80
|
+
const results = await Promise.all(filterData.map(async ([property, ids]) => {
|
|
81
|
+
try {
|
|
82
|
+
if (!ids || !ids.length) return {};
|
|
83
|
+
const [, selectionDetails] = selectFiltersToDisplay.find(([selectProperty]) => selectProperty === property) || [];
|
|
84
|
+
if (!selectionDetails) return null;
|
|
85
|
+
if (!selectionDetails.relation) {
|
|
86
|
+
return {
|
|
87
|
+
id: property,
|
|
88
|
+
label: selectionDetails.label,
|
|
89
|
+
options: ids.map(value => [value, value])
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const query = getQuery('GET_ENTITY_SCHEMA');
|
|
93
|
+
const {
|
|
94
|
+
data: {
|
|
95
|
+
getEntitySchemas: [relationSchema]
|
|
96
|
+
}
|
|
97
|
+
} = await apolloClient.query({
|
|
98
|
+
query,
|
|
99
|
+
variables: {
|
|
100
|
+
identifier: selectionDetails.relation.entityIdentifier
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const {
|
|
104
|
+
data: {
|
|
105
|
+
result: selected = []
|
|
106
|
+
}
|
|
107
|
+
} = await apolloClient.query({
|
|
108
|
+
query: getDynamicQuery('GET_ALL_ENTITIES')(relationSchema),
|
|
109
|
+
variables: {
|
|
110
|
+
where: {
|
|
111
|
+
id: {
|
|
112
|
+
_in: ids
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
sort: [{
|
|
116
|
+
property: 'name',
|
|
117
|
+
direction: 'asc'
|
|
118
|
+
}]
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
// eslint-disable-next-line no-console
|
|
122
|
+
.catch(e => console.error(e));
|
|
123
|
+
return {
|
|
124
|
+
id: property,
|
|
125
|
+
label: selectionDetails.label,
|
|
126
|
+
options: selected.map(item => [item.id, item.name])
|
|
127
|
+
};
|
|
128
|
+
} catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
setSelectOptions(results.filter(Boolean));
|
|
133
|
+
})();
|
|
134
|
+
}, [apolloClient, filterData, schema, selectFiltersToDisplay]);
|
|
135
|
+
const updateFilters = useCallback((term, filters) => updateListFilters(term, filters, setListFilters, keywordSearchProperties), [setListFilters, keywordSearchProperties]);
|
|
136
|
+
const handleSearch = useCallback(() => updateFilters(searchTerm, selectedFilters), [searchTerm, selectedFilters, updateFilters]);
|
|
137
|
+
const handleSearchChange = useCallback(e => setSearchTerm(e.target.value), []);
|
|
138
|
+
const handleEnterKey = useCallback(e => {
|
|
139
|
+
if (e.key === ENTER_KEY) handleSearch();
|
|
140
|
+
}, [handleSearch]);
|
|
141
|
+
const handleReset = useCallback(() => {
|
|
142
|
+
setSearchTerm('');
|
|
143
|
+
setSelectedFilters(Object.keys(selectedFilters).reduce((acc, key) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
144
|
+
[key]: DEFAULT_FILTER_OPTION_LABEL
|
|
145
|
+
}), {}));
|
|
146
|
+
updateFilters('', {});
|
|
147
|
+
}, [selectedFilters, updateFilters]);
|
|
148
|
+
const handleSelect = useCallback((property, event) => {
|
|
149
|
+
const {
|
|
150
|
+
value
|
|
151
|
+
} = event;
|
|
152
|
+
const next = _objectSpread(_objectSpread({}, selectedFilters), {}, {
|
|
153
|
+
[property]: value
|
|
154
|
+
});
|
|
155
|
+
setSelectedFilters(next);
|
|
156
|
+
updateFilters(searchTerm, next);
|
|
157
|
+
}, [searchTerm, selectedFilters, updateFilters]);
|
|
158
|
+
const placeholderText = `Search ${keywordSearchLabels.join(', ')}`;
|
|
159
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: "search-container"
|
|
161
|
+
}, displaySearchFilter && /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
className: "search-container__search-input-container"
|
|
163
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
164
|
+
type: "search",
|
|
165
|
+
className: "search-container__search-input-container__search-input",
|
|
166
|
+
placeholder: placeholderText,
|
|
167
|
+
value: searchTerm,
|
|
168
|
+
onChange: handleSearchChange,
|
|
169
|
+
onKeyDown: handleEnterKey
|
|
170
|
+
}), /*#__PURE__*/React.createElement("i", {
|
|
171
|
+
role: "button",
|
|
172
|
+
onClick: handleSearch
|
|
173
|
+
}, /*#__PURE__*/React.createElement(BsSearch, null))), displaySelectFilters && selectOptions.map(({
|
|
174
|
+
id,
|
|
175
|
+
options,
|
|
176
|
+
label
|
|
177
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, options && !!options.length && /*#__PURE__*/React.createElement("div", {
|
|
178
|
+
className: "search-container__select-wrapper"
|
|
179
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
180
|
+
label: label,
|
|
181
|
+
id: id,
|
|
182
|
+
name: id,
|
|
183
|
+
onChange: event => handleSelect(id, event),
|
|
184
|
+
options: options,
|
|
185
|
+
value: selectedFilters[id],
|
|
186
|
+
defaultTextValue: DEFAULT_FILTER_OPTION_LABEL
|
|
187
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: "search-container__reset-button"
|
|
189
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
190
|
+
role: "button",
|
|
191
|
+
onClick: handleReset
|
|
192
|
+
}, /*#__PURE__*/React.createElement(BsArrowCounterclockwise, null))));
|
|
193
|
+
};
|
|
194
|
+
SearchContainer.propTypes = {
|
|
195
|
+
setListFilters: PropTypes.func.isRequired,
|
|
196
|
+
keywordFiltersToUse: PropTypes.array,
|
|
197
|
+
selectFiltersToDisplay: PropTypes.array,
|
|
198
|
+
schema: PropTypes.object.isRequired,
|
|
199
|
+
index: PropTypes.string
|
|
200
|
+
};
|
|
201
|
+
SearchContainer.defaultProps = {
|
|
202
|
+
keywordFiltersToUse: [],
|
|
203
|
+
selectFiltersToDisplay: [],
|
|
204
|
+
index: 'admin'
|
|
205
|
+
};
|
|
206
|
+
export default SearchContainer;
|
|
207
|
+
//# sourceMappingURL=SearchContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchContainer.js","names":["React","useState","useMemo","useEffect","useCallback","PropTypes","Select","useQuery","useApolloClient","getDynamicQuery","getQuery","BsArrowCounterclockwise","BsSearch","updateListFilters","buildQueryFields","NOOP_QUERY","ENTER_KEY","DEFAULT_FILTER_OPTION_LABEL","SearchContainer","setListFilters","keywordFiltersToUse","selectFiltersToDisplay","schema","index","apolloClient","searchTerm","setSearchTerm","selectedFilters","setSelectedFilters","selectOptions","setSelectOptions","displaySearchFilter","length","displaySelectFilters","keywordSearchProperties","keywordSearchLabels","labels","properties","forEach","property","label","push","gqlFields","rawQuery","id","action","data","skip","variables","where","limit","fetchPolicy","filterData","searchResults","rawResults","aggregations","proccessedData","Object","entries","key","buckets","Array","isArray","map","b","filter","Boolean","results","Promise","all","ids","selectionDetails","find","selectProperty","relation","options","value","query","getEntitySchemas","relationSchema","identifier","entityIdentifier","result","selected","_in","sort","direction","catch","e","console","error","item","name","updateFilters","term","filters","handleSearch","handleSearchChange","target","handleEnterKey","handleReset","keys","reduce","acc","_objectSpread","handleSelect","event","next","placeholderText","join","createElement","className","type","placeholder","onChange","onKeyDown","role","onClick","Fragment","defaultTextValue","propTypes","func","isRequired","array","object","string","defaultProps"],"sources":["../../../../src/components/ListingTable/SearchFilter/SearchContainer.js"],"sourcesContent":["import React, { useState, useMemo, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@blaze-react/select';\nimport { useQuery, useApolloClient } from '@apollo/client';\nimport { getDynamicQuery, getQuery } from '@blaze-cms/admin-ui-utils';\nimport { BsArrowCounterclockwise, BsSearch } from 'react-icons/bs';\nimport { updateListFilters, buildQueryFields } from './helpers';\nimport { NOOP_QUERY } from './querys';\nimport { ENTER_KEY, DEFAULT_FILTER_OPTION_LABEL } from '../../../constants';\n\nconst SearchContainer = ({\n setListFilters,\n keywordFiltersToUse = [],\n selectFiltersToDisplay = [],\n schema,\n index\n}) => {\n const apolloClient = useApolloClient();\n const [searchTerm, setSearchTerm] = useState('');\n const [selectedFilters, setSelectedFilters] = useState({});\n const [selectOptions, setSelectOptions] = useState([]);\n\n const displaySearchFilter = keywordFiltersToUse.length > 0;\n const displaySelectFilters = selectFiltersToDisplay.length > 0;\n\n const { keywordSearchProperties, keywordSearchLabels } = useMemo(\n () => {\n const labels = [];\n const properties = [];\n\n keywordFiltersToUse.forEach(([property, { label }]) => {\n if (label) labels.push(label);\n properties.push(property);\n });\n\n return { keywordSearchProperties: properties, keywordSearchLabels: labels };\n },\n [keywordFiltersToUse]\n );\n\n const { gqlFields, rawQuery } = useMemo(\n () => buildQueryFields(selectFiltersToDisplay, schema.id),\n [selectFiltersToDisplay, schema.id]\n );\n const action = displaySelectFilters\n ? getDynamicQuery('ADMIN_SEARCH')([schema], gqlFields, false, index)\n : NOOP_QUERY;\n\n const { data } = useQuery(action, {\n skip: !displaySelectFilters,\n variables: { where: rawQuery, limit: 0 },\n fetchPolicy: 'cache-and-network'\n });\n\n const filterData = useMemo(\n () => {\n const { searchResults: { rawResults: { aggregations = {} } = {} } = {} } = data || {};\n const proccessedData = [];\n Object.entries(aggregations).forEach(([key, { buckets }]) => {\n proccessedData.push(\n Array.isArray(buckets) ? [key, buckets.map(b => b.key).filter(Boolean)] : []\n );\n });\n\n return proccessedData;\n },\n [data]\n );\n\n useEffect(\n () => {\n if (!filterData.length) {\n setSelectOptions([]);\n return;\n }\n\n (async () => {\n const results = await Promise.all(\n filterData.map(async ([property, ids]) => {\n try {\n if (!ids || !ids.length) return {};\n\n const [, selectionDetails] =\n selectFiltersToDisplay.find(([selectProperty]) => selectProperty === property) ||\n [];\n\n if (!selectionDetails) return null;\n\n if (!selectionDetails.relation) {\n return {\n id: property,\n label: selectionDetails.label,\n options: ids.map(value => [value, value])\n };\n }\n const query = getQuery('GET_ENTITY_SCHEMA');\n const {\n data: {\n getEntitySchemas: [relationSchema]\n }\n } = await apolloClient.query({\n query,\n variables: { identifier: selectionDetails.relation.entityIdentifier }\n });\n\n const {\n data: { result: selected = [] }\n } = await apolloClient\n .query({\n query: getDynamicQuery('GET_ALL_ENTITIES')(relationSchema),\n variables: {\n where: {\n id: {\n _in: ids\n }\n },\n sort: [{ property: 'name', direction: 'asc' }]\n }\n })\n // eslint-disable-next-line no-console\n .catch(e => console.error(e));\n\n return {\n id: property,\n label: selectionDetails.label,\n options: selected.map(item => [item.id, item.name])\n };\n } catch {\n return null;\n }\n })\n );\n\n setSelectOptions(results.filter(Boolean));\n })();\n },\n [apolloClient, filterData, schema, selectFiltersToDisplay]\n );\n\n const updateFilters = useCallback(\n (term, filters) => updateListFilters(term, filters, setListFilters, keywordSearchProperties),\n [setListFilters, keywordSearchProperties]\n );\n\n const handleSearch = useCallback(() => updateFilters(searchTerm, selectedFilters), [\n searchTerm,\n selectedFilters,\n updateFilters\n ]);\n const handleSearchChange = useCallback(e => setSearchTerm(e.target.value), []);\n const handleEnterKey = useCallback(\n e => {\n if (e.key === ENTER_KEY) handleSearch();\n },\n [handleSearch]\n );\n const handleReset = useCallback(\n () => {\n setSearchTerm('');\n setSelectedFilters(\n Object.keys(selectedFilters).reduce(\n (acc, key) => ({ ...acc, [key]: DEFAULT_FILTER_OPTION_LABEL }),\n {}\n )\n );\n updateFilters('', {});\n },\n [selectedFilters, updateFilters]\n );\n const handleSelect = useCallback(\n (property, event) => {\n const { value } = event;\n const next = { ...selectedFilters, [property]: value };\n setSelectedFilters(next);\n updateFilters(searchTerm, next);\n },\n [searchTerm, selectedFilters, updateFilters]\n );\n\n const placeholderText = `Search ${keywordSearchLabels.join(', ')}`;\n\n return (\n <div className=\"search-container\">\n {displaySearchFilter && (\n <div className=\"search-container__search-input-container\">\n <input\n type=\"search\"\n className=\"search-container__search-input-container__search-input\"\n placeholder={placeholderText}\n value={searchTerm}\n onChange={handleSearchChange}\n onKeyDown={handleEnterKey}\n />\n <i role=\"button\" onClick={handleSearch}>\n <BsSearch />\n </i>\n </div>\n )}\n\n {displaySelectFilters &&\n selectOptions.map(({ id, options, label }) => (\n <>\n {options &&\n !!options.length && (\n <div className=\"search-container__select-wrapper\">\n <Select\n label={label}\n id={id}\n name={id}\n onChange={event => handleSelect(id, event)}\n options={options}\n value={selectedFilters[id]}\n defaultTextValue={DEFAULT_FILTER_OPTION_LABEL}\n />\n </div>\n )}\n </>\n ))}\n\n <div className=\"search-container__reset-button\">\n <span role=\"button\" onClick={handleReset}>\n <BsArrowCounterclockwise />\n </span>\n </div>\n </div>\n );\n};\n\nSearchContainer.propTypes = {\n setListFilters: PropTypes.func.isRequired,\n keywordFiltersToUse: PropTypes.array,\n selectFiltersToDisplay: PropTypes.array,\n schema: PropTypes.object.isRequired,\n index: PropTypes.string\n};\n\nSearchContainer.defaultProps = {\n keywordFiltersToUse: [],\n selectFiltersToDisplay: [],\n index: 'admin'\n};\n\nexport default SearchContainer;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AACxE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,QAAQ,EAAEC,eAAe,QAAQ,gBAAgB;AAC1D,SAASC,eAAe,EAAEC,QAAQ,QAAQ,2BAA2B;AACrE,SAASC,uBAAuB,EAAEC,QAAQ,QAAQ,gBAAgB;AAClE,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,WAAW;AAC/D,SAASC,UAAU,QAAQ,UAAU;AACrC,SAASC,SAAS,EAAEC,2BAA2B,QAAQ,oBAAoB;AAE3E,MAAMC,eAAe,GAAGA,CAAC;EACvBC,cAAc;EACdC,mBAAmB,GAAG,EAAE;EACxBC,sBAAsB,GAAG,EAAE;EAC3BC,MA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reList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { getKeywordSearchFilters, findSelectFilters } from './helpers';
|
|
4
|
+
import SearchContainer from './SearchContainer';
|
|
5
|
+
const SearchFilter = ({
|
|
6
|
+
schema,
|
|
7
|
+
setListFilters
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
displayProperties = {}
|
|
11
|
+
} = schema || {};
|
|
12
|
+
const {
|
|
13
|
+
adminListings: {
|
|
14
|
+
dataSource: {
|
|
15
|
+
source,
|
|
16
|
+
index
|
|
17
|
+
} = {},
|
|
18
|
+
disableListingFilter = false
|
|
19
|
+
} = {}
|
|
20
|
+
} = displayProperties;
|
|
21
|
+
const keywordFiltersToUse = useMemo(() => getKeywordSearchFilters(schema), [schema]);
|
|
22
|
+
const selectFiltersToDisplay = useMemo(() => findSelectFilters(schema), [schema]);
|
|
23
|
+
if (disableListingFilter) return null;
|
|
24
|
+
const canSearch = source === 'search' && (keywordFiltersToUse.length > 0 || selectFiltersToDisplay.length > 0);
|
|
25
|
+
if (!canSearch) return null;
|
|
26
|
+
return /*#__PURE__*/React.createElement(SearchContainer, {
|
|
27
|
+
index: index,
|
|
28
|
+
key: schema.id,
|
|
29
|
+
setListFilters: setListFilters,
|
|
30
|
+
keywordFiltersToUse: keywordFiltersToUse,
|
|
31
|
+
selectFiltersToDisplay: selectFiltersToDisplay,
|
|
32
|
+
schema: schema
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
SearchFilter.propTypes = {
|
|
36
|
+
setListFilters: PropTypes.func.isRequired,
|
|
37
|
+
schema: PropTypes.object.isRequired
|
|
38
|
+
};
|
|
39
|
+
export default SearchFilter;
|
|
40
|
+
//# sourceMappingURL=SearchFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchFilter.js","names":["React","useMemo","PropTypes","getKeywordSearchFilters","findSelectFilters","SearchContainer","SearchFilter","schema","setListFilters","displayProperties","adminListings","dataSource","source","index","disableListingFilter","keywordFiltersToUse","selectFiltersToDisplay","canSearch","length","createElement","key","id","propTypes","func","isRequired","object"],"sources":["../../../../src/components/ListingTable/SearchFilter/SearchFilter.js"],"sourcesContent":["import React, { useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { getKeywordSearchFilters, findSelectFilters } from './helpers';\nimport SearchContainer from './SearchContainer';\n\nconst SearchFilter = ({ schema, setListFilters }) => {\n const { displayProperties = {} } = schema || {};\n const {\n adminListings: { dataSource: { source, index } = {}, disableListingFilter = false } = {}\n } = displayProperties;\n\n const keywordFiltersToUse = useMemo(() => getKeywordSearchFilters(schema), [schema]);\n const selectFiltersToDisplay = useMemo(() => findSelectFilters(schema), [schema]);\n\n if (disableListingFilter) return null;\n\n const canSearch =\n source === 'search' && (keywordFiltersToUse.length > 0 || selectFiltersToDisplay.length > 0);\n if (!canSearch) return null;\n\n return (\n <SearchContainer\n index={index}\n key={schema.id}\n setListFilters={setListFilters}\n keywordFiltersToUse={keywordFiltersToUse}\n selectFiltersToDisplay={selectFiltersToDisplay}\n schema={schema}\n />\n );\n};\n\nSearchFilter.propTypes = {\n setListFilters: PropTypes.func.isRequired,\n schema: PropTypes.object.isRequired\n};\n\nexport default SearchFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,uBAAuB,EAAEC,iBAAiB,QAAQ,WAAW;AACtE,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,MAAMC,YAAY,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAe,CAAC,KAAK;EACnD,MAAM;IAAEC,iBAAiB,GAAG,CAAC;EAAE,CAAC,GAAGF,MAAM,IAAI,CAAC,CAAC;EAC/C,MAAM;IACJG,aAAa,EAAE;MAAEC,UAAU,EAAE;QAAEC,MAAM;QAAEC;MAAM,CAAC,GAAG,CAAC,CAAC;MAAEC,oBAAoB,GAAG;IAAM,CAAC,GAAG,CAAC;EACzF,CAAC,GAAGL,iBAAiB;EAErB,MAAMM,mBAAmB,GAAGd,OAAO,CAAC,MAAME,uBAAuB,CAACI,MAAM,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACpF,MAAMS,sBAAsB,GAAGf,OAAO,CAAC,MAAMG,iBAAiB,CAACG,MAAM,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEjF,IAAIO,oBAAoB,EAAE,OAAO,IAAI;EAErC,MAAMG,SAAS,GACbL,MAAM,KAAK,QAAQ,KAAKG,mBAAmB,CAACG,MAAM,GAAG,CAAC,IAAIF,sBAAsB,CAACE,MAAM,GAAG,CAAC,CAAC;EAC9F,IAAI,CAACD,SAAS,EAAE,OAAO,IAAI;EAE3B,oBACEjB,KAAA,CAAAmB,aAAA,CAACd,eAAe;IACdQ,KAAK,EAAEA,KAAM;IACbO,GAAG,EAAEb,MAAM,CAACc,EAAG;IACfb,cAAc,EAAEA,cAAe;IAC/BO,mBAAmB,EAAEA,mBAAoB;IACzCC,sBAAsB,EAAEA,sBAAuB;IAC/CT,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN,CAAC;AAEDD,YAAY,CAACgB,SAAS,GAAG;EACvBd,cAAc,EAAEN,SAAS,CAACqB,IAAI,CAACC,UAAU;EACzCjB,MAAM,EAAEL,SAAS,CAACuB,MAAM,CAACD;AAC3B,CAAC;AAED,eAAelB,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { DEFAULT_FILTER_OPTION_LABEL } from '../../../constants';
|
|
2
|
+
const updateListFilters = (searchTerm, selectedFilters, setListFilters, fields = []) => {
|
|
3
|
+
const filters = [];
|
|
4
|
+
if (searchTerm) {
|
|
5
|
+
filters.push({
|
|
6
|
+
simple_query_string: {
|
|
7
|
+
query: `${searchTerm}`,
|
|
8
|
+
default_operator: 'AND',
|
|
9
|
+
fields: fields.map(field => field)
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
Object.entries(selectedFilters).forEach(([filterKey, filterValue]) => {
|
|
14
|
+
if (!filterValue || filterValue === DEFAULT_FILTER_OPTION_LABEL) return;
|
|
15
|
+
filters.push({
|
|
16
|
+
match: {
|
|
17
|
+
[`${filterKey}.keyword`]: {
|
|
18
|
+
query: filterValue
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
setListFilters(filters);
|
|
24
|
+
};
|
|
25
|
+
const getKeywordSearchFilters = schema => {
|
|
26
|
+
if (!schema || !schema.properties) return [];
|
|
27
|
+
const {
|
|
28
|
+
properties = {},
|
|
29
|
+
dynamicProperties = {}
|
|
30
|
+
} = schema;
|
|
31
|
+
const propertyKeyword = Object.entries(properties).filter(isFilterKeywordItem);
|
|
32
|
+
const dynamicPropertyKeywords = Object.entries(dynamicProperties).filter(isFilterKeywordItem);
|
|
33
|
+
return [...propertyKeyword, ...dynamicPropertyKeywords];
|
|
34
|
+
};
|
|
35
|
+
const isFilterKeywordItem = ([, item]) => item.adminListingOptions && item.adminListingOptions.includeInKeywordSeach === true;
|
|
36
|
+
const findSelectFilters = schema => {
|
|
37
|
+
if (!schema || !schema.properties) return [];
|
|
38
|
+
const {
|
|
39
|
+
properties = {},
|
|
40
|
+
dynamicProperties = {}
|
|
41
|
+
} = schema;
|
|
42
|
+
const propertySelects = Object.entries(properties).filter(isFilterSelectItem);
|
|
43
|
+
const dynamicPropertySelects = Object.entries(dynamicProperties).filter(isFilterSelectItem);
|
|
44
|
+
return [...propertySelects, ...dynamicPropertySelects];
|
|
45
|
+
};
|
|
46
|
+
const isFilterSelectItem = ([, item]) => item.adminListingOptions && item.adminListingOptions.filterType === 'select';
|
|
47
|
+
const buildQueryFields = (selectFilters, entityId) => {
|
|
48
|
+
if (!Array.isArray(selectFilters) || selectFilters.length === 0) {
|
|
49
|
+
return {
|
|
50
|
+
gqlFields: '',
|
|
51
|
+
rawQuery: '{}'
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const aggs = {};
|
|
55
|
+
selectFilters.forEach(([property, details]) => {
|
|
56
|
+
aggs[property] = {
|
|
57
|
+
terms: {
|
|
58
|
+
field: `${property}.keyword`,
|
|
59
|
+
// todo: handle different field types
|
|
60
|
+
size: 1000,
|
|
61
|
+
// todo: customise size
|
|
62
|
+
order: {
|
|
63
|
+
_key: 'asc'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
const docType = entityId;
|
|
69
|
+
const rawQueryObject = {
|
|
70
|
+
size: 0,
|
|
71
|
+
query: {
|
|
72
|
+
bool: {
|
|
73
|
+
filter: {
|
|
74
|
+
bool: {
|
|
75
|
+
must: [{
|
|
76
|
+
match: {
|
|
77
|
+
docType
|
|
78
|
+
}
|
|
79
|
+
}]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
aggs
|
|
85
|
+
};
|
|
86
|
+
const rawQuery = JSON.stringify(rawQueryObject);
|
|
87
|
+
const gqlFields = `
|
|
88
|
+
rawResults
|
|
89
|
+
`;
|
|
90
|
+
return {
|
|
91
|
+
gqlFields,
|
|
92
|
+
rawQuery
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export { buildQueryFields, updateListFilters, getKeywordSearchFilters, findSelectFilters };
|
|
96
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["DEFAULT_FILTER_OPTION_LABEL","updateListFilters","searchTerm","selectedFilters","setListFilters","fields","filters","push","simple_query_string","query","default_operator","map","field","Object","entries","forEach","filterKey","filterValue","match","getKeywordSearchFilters","schema","properties","dynamicProperties","propertyKeyword","filter","isFilterKeywordItem","dynamicPropertyKeywords","item","adminListingOptions","includeInKeywordSeach","findSelectFilters","propertySelects","isFilterSelectItem","dynamicPropertySelects","filterType","buildQueryFields","selectFilters","entityId","Array","isArray","length","gqlFields","rawQuery","aggs","property","details","terms","size","order","_key","docType","rawQueryObject","bool","must","JSON","stringify"],"sources":["../../../../src/components/ListingTable/SearchFilter/helpers.js"],"sourcesContent":["import { DEFAULT_FILTER_OPTION_LABEL } from '../../../constants';\n\nconst updateListFilters = (searchTerm, selectedFilters, setListFilters, fields = []) => {\n const filters = [];\n\n if (searchTerm) {\n filters.push({\n simple_query_string: {\n query: `${searchTerm}`,\n default_operator: 'AND',\n fields: fields.map(field => field)\n }\n });\n }\n\n Object.entries(selectedFilters).forEach(([filterKey, filterValue]) => {\n if (!filterValue || filterValue === DEFAULT_FILTER_OPTION_LABEL) return;\n filters.push({\n match: {\n [`${filterKey}.keyword`]: {\n query: filterValue\n }\n }\n });\n });\n\n setListFilters(filters);\n};\n\nconst getKeywordSearchFilters = schema => {\n if (!schema || !schema.properties) return [];\n\n const { properties = {}, dynamicProperties = {} } = schema;\n\n const propertyKeyword = Object.entries(properties).filter(isFilterKeywordItem);\n const dynamicPropertyKeywords = Object.entries(dynamicProperties).filter(isFilterKeywordItem);\n\n return [...propertyKeyword, ...dynamicPropertyKeywords];\n};\n\nconst isFilterKeywordItem = ([, item]) =>\n item.adminListingOptions && item.adminListingOptions.includeInKeywordSeach === true;\n\nconst findSelectFilters = schema => {\n if (!schema || !schema.properties) return [];\n\n const { properties = {}, dynamicProperties = {} } = schema;\n\n const propertySelects = Object.entries(properties).filter(isFilterSelectItem);\n const dynamicPropertySelects = Object.entries(dynamicProperties).filter(isFilterSelectItem);\n\n return [...propertySelects, ...dynamicPropertySelects];\n};\n\nconst isFilterSelectItem = ([, item]) =>\n item.adminListingOptions && item.adminListingOptions.filterType === 'select';\n\nconst buildQueryFields = (selectFilters, entityId) => {\n if (!Array.isArray(selectFilters) || selectFilters.length === 0) {\n return { gqlFields: '', rawQuery: '{}' };\n }\n\n const aggs = {};\n selectFilters.forEach(([property, details]) => {\n aggs[property] = {\n terms: {\n field: `${property}.keyword`, // todo: handle different field types\n size: 1000, // todo: customise size\n order: {\n _key: 'asc'\n }\n }\n };\n });\n\n const docType = entityId;\n const rawQueryObject = {\n size: 0,\n query: {\n bool: {\n filter: {\n bool: {\n must: [{ match: { docType } }]\n }\n }\n }\n },\n aggs\n };\n const rawQuery = JSON.stringify(rawQueryObject);\n\n const gqlFields = `\n rawResults\n `;\n\n return { gqlFields, rawQuery };\n};\n\nexport { buildQueryFields, updateListFilters, getKeywordSearchFilters, findSelectFilters };\n"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,oBAAoB;AAEhE,MAAMC,iBAAiB,GAAGA,CAACC,UAAU,EAAEC,eAAe,EAAEC,cAAc,EAAEC,MAAM,GAAG,EAAE,KAAK;EACtF,MAAMC,OAAO,GAAG,EAAE;EAElB,IAAIJ,UAAU,EAAE;IACdI,OAAO,CAACC,IAAI,CAAC;MACXC,mBAAmB,EAAE;QACnBC,KAAK,EAAE,GAAGP,UAAU,EAAE;QACtBQ,gBAAgB,EAAE,KAAK;QACvBL,MAAM,EAAEA,MAAM,CAACM,GAAG,CAACC,KAAK,IAAIA,KAAK;MACnC;IACF,CAAC,CAAC;EACJ;EAEAC,MAAM,CAACC,OAAO,CAACX,eAAe,CAAC,CAACY,OAAO,CAAC,CAAC,CAACC,SAAS,EAAEC,WAAW,CAAC,KAAK;IACpE,IAAI,CAACA,WAAW,IAAIA,WAAW,KAAKjB,2BAA2B,EAAE;IACjEM,OAAO,CAACC,IAAI,CAAC;MACXW,KAAK,EAAE;QACL,CAAC,GAAGF,SAAS,UAAU,GAAG;UACxBP,KAAK,EAAEQ;QACT;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFb,cAAc,CAACE,OAAO,CAAC;AACzB,CAAC;AAED,MAAMa,uBAAuB,GAAGC,MAAM,IAAI;EACxC,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,UAAU,EAAE,OAAO,EAAE;EAE5C,MAAM;IAA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,CAACI,MAAM,KAAK,CAAC,EAAE;IAC/D,OAAO;MAAEC,SAAS,EAAE,EAAE;MAAEC,QAAQ,EAAE;IAAK,CAAC;EAC1C;EAEA,MAAMC,IAAI,GAAG,CAAC,CAAC;EACfP,aAAa,CAACrB,OAAO,CAAC,CAAC,CAAC6B,QAAQ,EAAEC,OAAO,CAAC,KAAK;IAC7CF,IAAI,CAACC,QAAQ,CAAC,GAAG;MACfE,KAAK,EAAE;QACLlC,KAAK,EAAE,GAAGgC,QAAQ,UAAU;QAAE;QAC9BG,IAAI,EAAE,IAAI;QAAE;QACZC,KAAK,EAAE;UACLC,IAAI,EAAE;QACR;MACF;IACF,CAAC;EACH,CAAC,CAAC;EAEF,MAAMC,OAAO,GAAGb,QAAQ;EACxB,MAAMc,cAAc,GAAG;IACrBJ,IAAI,EAAE,CAAC;IACPtC,KAAK,EAAE;MACL2C,IAAI,EAAE;QACJ5B,MAAM,EAAE;UACN4B,IAAI,EAAE;YACJC,IAAI,EAAE,CAAC;cAAEnC,KAAK,EAAE;gBAAEgC;cAAQ;YAAE,CAAC;UAC/B;QACF;MACF;IACF,CAAC;IACDP;EACF,CAAC;EACD,MAAMD,QAAQ,GAAGY,IAAI,CAACC,SAAS,CAACJ,cAAc,CAAC;EAE/C,MAAMV,SAAS,GAAG;AACpB;AACA,GAAG;EAED,OAAO;IAAEA,SAAS;IAAEC;EAAS,CAAC;AAChC,CAAC;AAED,SAASP,gBAAgB,EAAElC,iBAAiB,EAAEkB,uBAAuB,EAAEW,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"querys.js","names":["gql","NOOP_QUERY"],"sources":["../../../../src/components/ListingTable/SearchFilter/querys.js"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst NOOP_QUERY = gql`\n query NoOp {\n __typename\n }\n`;\n\nexport { NOOP_QUERY };\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,UAAU,GAAGD,GAAG;AACtB;AACA;AACA;AACA,CAAC;AAED,SAASC,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import More from '@blaze-react/more';
|
|
5
|
+
import Button from '@blaze-react/button';
|
|
6
|
+
const TableActions = ({
|
|
7
|
+
editUrl,
|
|
8
|
+
data,
|
|
9
|
+
showDeleteModal
|
|
10
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "more-menu__wrapper"
|
|
12
|
+
}, /*#__PURE__*/React.createElement(More, {
|
|
13
|
+
isMoreMenu: true
|
|
14
|
+
}, /*#__PURE__*/React.createElement(More.Avatar, {
|
|
15
|
+
isMoreMenu: true
|
|
16
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
17
|
+
className: "material-icons"
|
|
18
|
+
}, "more_vert")), /*#__PURE__*/React.createElement(More.Content, {
|
|
19
|
+
isMoreMenu: true
|
|
20
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
21
|
+
to: editUrl,
|
|
22
|
+
className: "more-menu__link",
|
|
23
|
+
role: "button"
|
|
24
|
+
}, "Edit"), /*#__PURE__*/React.createElement(Button, {
|
|
25
|
+
className: "more-menu__link",
|
|
26
|
+
onClick: () => showDeleteModal(data)
|
|
27
|
+
}, "Delete"))));
|
|
28
|
+
TableActions.propTypes = {
|
|
29
|
+
editUrl: PropTypes.string.isRequired,
|
|
30
|
+
showDeleteModal: PropTypes.func.isRequired,
|
|
31
|
+
data: PropTypes.object.isRequired
|
|
32
|
+
};
|
|
33
|
+
export default TableActions;
|
|
34
|
+
//# sourceMappingURL=TableActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableActions.js","names":["React","Link","PropTypes","More","Button","TableActions","editUrl","data","showDeleteModal","createElement","className","isMoreMenu","Avatar","Content","to","role","onClick","propTypes","string","isRequired","func","object"],"sources":["../../../../src/components/ListingTable/TableActions/TableActions.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport More from '@blaze-react/more';\nimport Button from '@blaze-react/button';\n\nconst TableActions = ({ editUrl, data, showDeleteModal }) => (\n <div className=\"more-menu__wrapper\">\n <More isMoreMenu>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu>\n <Link to={editUrl} className=\"more-menu__link\" role=\"button\">\n Edit\n </Link>\n <Button className=\"more-menu__link\" onClick={() => showDeleteModal(data)}>\n Delete\n </Button>\n </More.Content>\n </More>\n </div>\n);\n\nTableActions.propTypes = {\n editUrl: PropTypes.string.isRequired,\n showDeleteModal: PropTypes.func.isRequired,\n data: PropTypes.object.isRequired\n};\n\nexport default TableActions;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,MAAM,MAAM,qBAAqB;AAExC,MAAMC,YAAY,GAAGA,CAAC;EAAEC,OAAO;EAAEC,IAAI;EAAEC;AAAgB,CAAC,kBACtDR,KAAA,CAAAS,aAAA;EAAKC,SAAS,EAAC;AAAoB,gBACjCV,KAAA,CAAAS,aAAA,CAACN,IAAI;EAACQ,UAAU;AAAA,gBACdX,KAAA,CAAAS,aAAA,CAACN,IAAI,CAACS,MAAM;EAACD,UAAU;AAAA,gBACrBX,KAAA,CAAAS,aAAA;EAAMC,SAAS,EAAC;AAAgB,GAAC,WAAe,CACrC,CAAC,eACdV,KAAA,CAAAS,aAAA,CAACN,IAAI,CAACU,OAAO;EAACF,UAAU;AAAA,gBACtBX,KAAA,CAAAS,aAAA,CAACR,IAAI;EAACa,EAAE,EAAER,OAAQ;EAACI,SAAS,EAAC,iBAAiB;EAACK,IAAI,EAAC;AAAQ,GAAC,MAEvD,CAAC,eACPf,KAAA,CAAAS,aAAA,CAACL,MAAM;EAACM,SAAS,EAAC,iBAAiB;EAACM,OAAO,EAAEA,CAAA,KAAMR,eAAe,CAACD,IAAI;AAAE,GAAC,QAElE,CACI,CACV,CACH,CACN;AAEDF,YAAY,CAACY,SAAS,GAAG;EACvBX,OAAO,EAAEJ,SAAS,CAACgB,MAAM,CAACC,UAAU;EACpCX,eAAe,EAAEN,SAAS,CAACkB,IAAI,CAACD,UAAU;EAC1CZ,IAAI,EAAEL,SAAS,CAACmB,MAAM,CAACF;AACzB,CAAC;AAED,eAAed,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["TableActions"],"sources":["../../../../src/components/ListingTable/TableActions/index.js"],"sourcesContent":["import TableActions from './TableActions';\n\nexport default TableActions;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ListingTable"],"sources":["../../../src/components/ListingTable/index.js"],"sourcesContent":["import ListingTable from './ListingTable';\n\nexport default ListingTable;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
7
|
+
import TableActions from '../TableActions';
|
|
8
|
+
import { ACTIONS } from '../../../constants';
|
|
9
|
+
import InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';
|
|
10
|
+
import InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';
|
|
11
|
+
import InfoBoxTooltip from '../../InfoBoxes/InfoBoxTooltip';
|
|
12
|
+
const formatRows = ({
|
|
13
|
+
rows,
|
|
14
|
+
url,
|
|
15
|
+
toggleModal,
|
|
16
|
+
label,
|
|
17
|
+
firstColumn = 'name',
|
|
18
|
+
isEnquiry,
|
|
19
|
+
entitySchema
|
|
20
|
+
}) => rows.map(data => {
|
|
21
|
+
const editUrl = `${url}/update/${data.id}`;
|
|
22
|
+
const rowProps = _objectSpread(_objectSpread({}, data), {}, {
|
|
23
|
+
[firstColumn]: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Link, {
|
|
24
|
+
to: editUrl,
|
|
25
|
+
role: "button"
|
|
26
|
+
}, data[firstColumn]), /*#__PURE__*/React.createElement(RenderHook, {
|
|
27
|
+
hookKey: "entity:listing:table:row:column:after",
|
|
28
|
+
schema: entitySchema,
|
|
29
|
+
data: data,
|
|
30
|
+
value: data[firstColumn],
|
|
31
|
+
column: firstColumn
|
|
32
|
+
}))
|
|
33
|
+
});
|
|
34
|
+
if (!isEnquiry) rowProps.actions = /*#__PURE__*/React.createElement(TableActions, {
|
|
35
|
+
editUrl: editUrl,
|
|
36
|
+
data: data,
|
|
37
|
+
showDeleteModal: toggleModal
|
|
38
|
+
});
|
|
39
|
+
return rowProps;
|
|
40
|
+
});
|
|
41
|
+
const getSanitizedColumnLabel = columnProp => {
|
|
42
|
+
let sanitizedChar = '';
|
|
43
|
+
for (let index = 0; index < columnProp.length; index += 1) {
|
|
44
|
+
if (index && columnProp[index] === columnProp[index].toUpperCase()) sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;else sanitizedChar += columnProp[index];
|
|
45
|
+
}
|
|
46
|
+
return sanitizedChar;
|
|
47
|
+
};
|
|
48
|
+
const buildArrayRowContent = rowData => /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "table-row-list"
|
|
50
|
+
}, rowData.map(rowGroup => {
|
|
51
|
+
if (!rowGroup.length) return null;
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "table-row-list__group"
|
|
54
|
+
}, rowGroup.map(item => /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "table-row-list__group__item"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
57
|
+
className: "table-row-list__group__item__label"
|
|
58
|
+
}, /*#__PURE__*/React.createElement(InfoBoxLabel, {
|
|
59
|
+
item: item
|
|
60
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
61
|
+
className: "table-row-list__group__item__value"
|
|
62
|
+
}, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
63
|
+
item: item
|
|
64
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
65
|
+
info: item
|
|
66
|
+
})))));
|
|
67
|
+
}));
|
|
68
|
+
const buildArrayRowData = rowData => {
|
|
69
|
+
const groupSize = Math.ceil(rowData.length / 3);
|
|
70
|
+
const group1 = rowData.slice(0, groupSize);
|
|
71
|
+
const group2 = rowData.slice(groupSize, groupSize * 2);
|
|
72
|
+
const group3 = rowData.slice(groupSize * 2);
|
|
73
|
+
const dataGroups = [group1, group2, group3];
|
|
74
|
+
return buildArrayRowContent(dataGroups);
|
|
75
|
+
};
|
|
76
|
+
const getParsedRowData = rows => rows.map(rowData => Object.keys(rowData).reduce((acc, key) => {
|
|
77
|
+
const parsedData = Array.isArray(rowData[key]) ? buildArrayRowData(rowData[key]) : rowData[key];
|
|
78
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
79
|
+
[key]: parsedData
|
|
80
|
+
});
|
|
81
|
+
}, {}));
|
|
82
|
+
const getColumnsAndLabels = (listingProperties, allProperties, rows) => {
|
|
83
|
+
const columns = [];
|
|
84
|
+
const labels = {};
|
|
85
|
+
listingProperties.forEach(listingProperty => {
|
|
86
|
+
const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;
|
|
87
|
+
const {
|
|
88
|
+
label
|
|
89
|
+
} = allProperties[propKey] || {};
|
|
90
|
+
columns.push(propKey);
|
|
91
|
+
labels[propKey] = label || getSanitizedColumnLabel(propKey);
|
|
92
|
+
});
|
|
93
|
+
const parsedRowData = getParsedRowData(rows);
|
|
94
|
+
return {
|
|
95
|
+
columns,
|
|
96
|
+
labels,
|
|
97
|
+
parsedRowData
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
const populateRows = ({
|
|
101
|
+
toggleModal,
|
|
102
|
+
url,
|
|
103
|
+
entitySchema,
|
|
104
|
+
rows
|
|
105
|
+
}) => {
|
|
106
|
+
const {
|
|
107
|
+
id: schemaId,
|
|
108
|
+
listingProperties,
|
|
109
|
+
properties,
|
|
110
|
+
dynamicProperties = {},
|
|
111
|
+
formProperties
|
|
112
|
+
} = entitySchema;
|
|
113
|
+
const isEnquiry = schemaId === 'enquiry';
|
|
114
|
+
const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];
|
|
115
|
+
const allProperties = _objectSpread(_objectSpread({}, properties), dynamicProperties);
|
|
116
|
+
const {
|
|
117
|
+
columns,
|
|
118
|
+
labels,
|
|
119
|
+
parsedRowData
|
|
120
|
+
} = getColumnsAndLabels(columnOptions, allProperties, rows);
|
|
121
|
+
const [firstColumn] = columns;
|
|
122
|
+
return {
|
|
123
|
+
identification: 'id',
|
|
124
|
+
sort: null,
|
|
125
|
+
columns,
|
|
126
|
+
labels,
|
|
127
|
+
orderBy: [...formProperties],
|
|
128
|
+
rows: formatRows({
|
|
129
|
+
firstColumn,
|
|
130
|
+
rows: parsedRowData,
|
|
131
|
+
url,
|
|
132
|
+
toggleModal,
|
|
133
|
+
isEnquiry,
|
|
134
|
+
entitySchema
|
|
135
|
+
}),
|
|
136
|
+
isEnquiry
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export { populateRows, formatRows, getParsedRowData };
|
|
140
|
+
//# sourceMappingURL=populate-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate-rows.js","names":["React","Link","RenderHook","TableActions","ACTIONS","InfoBoxValue","InfoBoxLabel","InfoBoxTooltip","formatRows","rows","url","toggleModal","label","firstColumn","isEnquiry","entitySchema","map","data","editUrl","id","rowProps","_objectSpread","createElement","Fragment","to","role","hookKey","schema","value","column","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","buildArrayRowContent","rowData","className","rowGroup","item","info","buildArrayRowData","groupSize","Math","ceil","group1","slice","group2","group3","dataGroups","getParsedRowData","Object","keys","reduce","acc","key","parsedData","Array","isArray","getColumnsAndLabels","listingProperties","allProperties","columns","labels","forEach","listingProperty","propKey","includes","split","push","parsedRowData","populateRows","schemaId","properties","dynamicProperties","formProperties","columnOptions","identification","sort","orderBy"],"sources":["../../../../src/components/ListingTable/mappers/populate-rows.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';\nimport TableActions from '../TableActions';\nimport { ACTIONS } from '../../../constants';\nimport InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';\nimport InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';\nimport InfoBoxTooltip from '../../InfoBoxes/InfoBoxTooltip';\n\nconst formatRows = ({\n rows,\n url,\n toggleModal,\n label,\n firstColumn = 'name',\n isEnquiry,\n entitySchema\n}) =>\n rows.map(data => {\n const editUrl = `${url}/update/${data.id}`;\n\n const rowProps = {\n ...data,\n [firstColumn]: (\n <>\n <Link to={editUrl} role=\"button\">\n {data[firstColumn]}\n </Link>\n <RenderHook\n hookKey=\"entity:listing:table:row:column:after\"\n schema={entitySchema}\n data={data}\n value={data[firstColumn]}\n column={firstColumn}\n />\n </>\n )\n };\n if (!isEnquiry)\n rowProps.actions = (\n <TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />\n );\n return rowProps;\n });\n\nconst getSanitizedColumnLabel = columnProp => {\n let sanitizedChar = '';\n\n for (let index = 0; index < columnProp.length; index += 1) {\n if (index && columnProp[index] === columnProp[index].toUpperCase())\n sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;\n else sanitizedChar += columnProp[index];\n }\n return sanitizedChar;\n};\n\nconst buildArrayRowContent = rowData => (\n <div className=\"table-row-list\">\n {rowData.map(rowGroup => {\n if (!rowGroup.length) return null;\n return (\n <div className=\"table-row-list__group\">\n {rowGroup.map(item => (\n <div className=\"table-row-list__group__item\">\n <span className=\"table-row-list__group__item__label\">\n <InfoBoxLabel item={item} />\n </span>\n <span className=\"table-row-list__group__item__value\">\n <InfoBoxValue item={item} />\n <InfoBoxTooltip info={item} />\n </span>\n </div>\n ))}\n </div>\n );\n })}\n </div>\n);\n\nconst buildArrayRowData = rowData => {\n const groupSize = Math.ceil(rowData.length / 3);\n const group1 = rowData.slice(0, groupSize);\n const group2 = rowData.slice(groupSize, groupSize * 2);\n const group3 = rowData.slice(groupSize * 2);\n const dataGroups = [group1, group2, group3];\n\n return buildArrayRowContent(dataGroups);\n};\n\nconst getParsedRowData = rows =>\n rows.map(rowData =>\n Object.keys(rowData).reduce((acc, key) => {\n const parsedData = Array.isArray(rowData[key])\n ? buildArrayRowData(rowData[key])\n : rowData[key];\n return { ...acc, [key]: parsedData };\n }, {})\n );\n\nconst getColumnsAndLabels = (listingProperties, allProperties, rows) => {\n const columns = [];\n const labels = {};\n\n listingProperties.forEach(listingProperty => {\n const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;\n const { label } = allProperties[propKey] || {};\n columns.push(propKey);\n labels[propKey] = label || getSanitizedColumnLabel(propKey);\n });\n const parsedRowData = getParsedRowData(rows);\n\n return { columns, labels, parsedRowData };\n};\n\nconst populateRows = ({ toggleModal, url, entitySchema, rows }) => {\n const {\n id: schemaId,\n listingProperties,\n properties,\n dynamicProperties = {},\n formProperties\n } = entitySchema;\n\n const isEnquiry = schemaId === 'enquiry';\n const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];\n\n const allProperties = { ...properties, ...dynamicProperties };\n const { columns, labels, parsedRowData } = getColumnsAndLabels(\n columnOptions,\n allProperties,\n rows\n );\n const [firstColumn] = columns;\n\n return {\n identification: 'id',\n sort: null,\n columns,\n labels,\n orderBy: [...formProperties],\n rows: formatRows({\n firstColumn,\n rows: parsedRowData,\n url,\n toggleModal,\n isEnquiry,\n entitySchema\n }),\n isEnquiry\n };\n};\n\nexport { populateRows, formatRows, getParsedRowData };\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAOC,YAAY,MAAM,6CAA6C;AACtE,OAAOC,YAAY,MAAM,6CAA6C;AACtE,OAAOC,cAAc,MAAM,gCAAgC;AAE3D,MAAMC,UAAU,GAAGA,CAAC;EAClBC,IAAI;EACJC,GAAG;EACHC,WAAW;EACXC,KAAK;EACLC,WAAW,GAAG,MAAM;EACpBC,SAAS;EACTC;AACF,CAAC,KACCN,IAAI,CAACO,GAAG,CAACC,IAAI,IAAI;EACf,MAAMC,OAAO,GAAG,GAAGR,GAAG,WAAWO,IAAI,CAACE,EAA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