@blaze-cms/plugin-data-ui 0.146.0-translations.8 → 0.147.0-rc-eagle.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/lib/components/EntityDataListing/EntityDataListing.js +21 -19
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +2 -3
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -19
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +286 -458
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +32 -56
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -17
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +34 -32
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +95 -158
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +23 -30
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +42 -56
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +29 -45
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +7 -8
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +36 -57
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +47 -66
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +2 -3
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +91 -166
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +2 -3
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/RecordEditContext/index.js +3 -4
- package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +34 -46
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +35 -80
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +17 -10
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxTooltip.js +19 -16
- package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +19 -19
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +26 -38
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +21 -16
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useData.js +33 -30
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +10 -10
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/index.js +2 -3
- package/lib/components/InfoBoxes/index.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +27 -34
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +155 -296
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +53 -58
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +159 -257
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +25 -36
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/helpers.js +46 -68
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/querys.js +5 -5
- package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +2 -3
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +2 -3
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +103 -122
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +66 -83
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +26 -42
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/hooks/useCallbackDebounce.js +5 -9
- package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
- package/lib/constants.js +30 -31
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +17 -20
- package/lib/icons/ContentIcon.js.map +1 -1
- package/lib/icons/SettingsIcon.js +12 -15
- package/lib/icons/SettingsIcon.js.map +1 -1
- package/lib/icons/TaxonomyIcon.js +15 -18
- package/lib/icons/TaxonomyIcon.js.map +1 -1
- package/lib/icons/UsersIcon.js +11 -14
- package/lib/icons/UsersIcon.js.map +1 -1
- package/lib/icons/index.js +8 -9
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +81 -121
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +67 -93
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +12 -9
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +11 -8
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +17 -14
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +15 -9
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +7 -6
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +4 -6
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +4 -12
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js +2 -3
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +15 -26
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +6 -3
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js +2 -2
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +20 -17
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +6 -7
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/index.js +11 -3
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/build-update-data-query.js.map +1 -1
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/package.json +27 -22
- package/src/components/EntityManager/Entity/Entity.js +63 -81
- package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +9 -7
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +64 -59
- package/src/components/EntityManager/EntityManager.js +52 -45
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +3 -6
- package/src/components/InfoBoxes/hooks/useData.js +6 -1
- package/src/components/ListingTable/ListingTable.js +13 -21
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +38 -44
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +105 -120
- package/src/components/ListingTable/service/index.js +2 -3
- package/src/components/Tabs/index.js +17 -21
- package/src/index.js +9 -7
- package/src/utils/hoc/withContext.js +5 -4
- package/CHANGELOG.md +0 -1947
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.js");
|
|
4
|
-
require("core-js/modules/es.array.filter.js");
|
|
5
|
-
require("core-js/modules/es.object.define-properties.js");
|
|
6
|
-
require("core-js/modules/es.object.define-property.js");
|
|
7
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
8
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
9
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
10
4
|
Object.defineProperty(exports, "__esModule", {
|
|
11
5
|
value: true
|
|
12
6
|
});
|
|
13
7
|
exports.populateRows = exports.getParsedRowData = exports.formatRows = void 0;
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
require("core-js/modules/es.array.concat.js");
|
|
18
|
-
require("core-js/modules/es.array.for-each.js");
|
|
19
|
-
require("core-js/modules/es.array.includes.js");
|
|
20
|
-
require("core-js/modules/es.array.is-array.js");
|
|
21
|
-
require("core-js/modules/es.array.map.js");
|
|
22
|
-
require("core-js/modules/es.array.reduce.js");
|
|
23
|
-
require("core-js/modules/es.array.slice.js");
|
|
24
|
-
require("core-js/modules/es.object.keys.js");
|
|
25
|
-
require("core-js/modules/es.object.to-string.js");
|
|
26
|
-
require("core-js/modules/es.string.includes.js");
|
|
27
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
28
9
|
var _react = _interopRequireDefault(require("react"));
|
|
29
10
|
var _reactRouterDom = require("react-router-dom");
|
|
30
11
|
var _pluginRenderHooksUi = require("@blaze-cms/plugin-render-hooks-ui");
|
|
@@ -34,135 +15,135 @@ var _InfoBoxValue = _interopRequireDefault(require("../../InfoBoxes/presentation
|
|
|
34
15
|
var _InfoBoxLabel = _interopRequireDefault(require("../../InfoBoxes/presentational/InfoBoxLabel"));
|
|
35
16
|
var _InfoBoxTooltip = _interopRequireDefault(require("../../InfoBoxes/InfoBoxTooltip"));
|
|
36
17
|
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; }
|
|
37
|
-
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) { (0, _defineProperty2
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
19
|
+
const formatRows = ({
|
|
20
|
+
rows,
|
|
21
|
+
url,
|
|
22
|
+
toggleModal,
|
|
23
|
+
label,
|
|
24
|
+
firstColumn = 'name',
|
|
25
|
+
isEnquiry,
|
|
26
|
+
entitySchema
|
|
27
|
+
}) => rows.map(data => {
|
|
28
|
+
const editUrl = `${url}/update/${data.id}`;
|
|
29
|
+
const rowProps = _objectSpread(_objectSpread({}, data), {}, {
|
|
30
|
+
[firstColumn]: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
|
|
50
31
|
to: editUrl,
|
|
51
32
|
role: "button"
|
|
52
|
-
}, data[firstColumn]), /*#__PURE__*/_react
|
|
33
|
+
}, data[firstColumn]), /*#__PURE__*/_react.default.createElement(_pluginRenderHooksUi.RenderHook, {
|
|
53
34
|
hookKey: "entity:listing:table:row:column:after",
|
|
54
35
|
schema: entitySchema,
|
|
55
36
|
data: data,
|
|
56
37
|
value: data[firstColumn],
|
|
57
38
|
column: firstColumn
|
|
58
|
-
}))
|
|
59
|
-
if (!isEnquiry) rowProps.actions = /*#__PURE__*/_react["default"].createElement(_TableActions["default"], {
|
|
60
|
-
editUrl: editUrl,
|
|
61
|
-
data: data,
|
|
62
|
-
showDeleteModal: toggleModal
|
|
63
|
-
});
|
|
64
|
-
return rowProps;
|
|
39
|
+
}))
|
|
65
40
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
41
|
+
if (!isEnquiry) rowProps.actions = /*#__PURE__*/_react.default.createElement(_TableActions.default, {
|
|
42
|
+
editUrl: editUrl,
|
|
43
|
+
data: data,
|
|
44
|
+
showDeleteModal: toggleModal
|
|
45
|
+
});
|
|
46
|
+
return rowProps;
|
|
47
|
+
});
|
|
48
|
+
exports.formatRows = formatRows;
|
|
49
|
+
const getSanitizedColumnLabel = columnProp => {
|
|
50
|
+
let sanitizedChar = '';
|
|
51
|
+
for (let index = 0; index < columnProp.length; index += 1) {
|
|
52
|
+
if (index && columnProp[index] === columnProp[index].toUpperCase()) sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;else sanitizedChar += columnProp[index];
|
|
71
53
|
}
|
|
72
54
|
return sanitizedChar;
|
|
73
55
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var group1 = rowData.slice(0, groupSize);
|
|
101
|
-
var group2 = rowData.slice(groupSize, groupSize * 2);
|
|
102
|
-
var group3 = rowData.slice(groupSize * 2);
|
|
103
|
-
var dataGroups = [group1, group2, group3];
|
|
56
|
+
const buildArrayRowContent = rowData => /*#__PURE__*/_react.default.createElement("div", {
|
|
57
|
+
className: "table-row-list"
|
|
58
|
+
}, rowData.map(rowGroup => {
|
|
59
|
+
if (!rowGroup.length) return null;
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
+
className: "table-row-list__group"
|
|
62
|
+
}, rowGroup.map(item => /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: "table-row-list__group__item"
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
65
|
+
className: "table-row-list__group__item__label"
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_InfoBoxLabel.default, {
|
|
67
|
+
item: item
|
|
68
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
69
|
+
className: "table-row-list__group__item__value"
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement(_InfoBoxValue.default, {
|
|
71
|
+
item: item
|
|
72
|
+
}), /*#__PURE__*/_react.default.createElement(_InfoBoxTooltip.default, {
|
|
73
|
+
info: item
|
|
74
|
+
})))));
|
|
75
|
+
}));
|
|
76
|
+
const buildArrayRowData = rowData => {
|
|
77
|
+
const groupSize = Math.ceil(rowData.length / 3);
|
|
78
|
+
const group1 = rowData.slice(0, groupSize);
|
|
79
|
+
const group2 = rowData.slice(groupSize, groupSize * 2);
|
|
80
|
+
const group3 = rowData.slice(groupSize * 2);
|
|
81
|
+
const dataGroups = [group1, group2, group3];
|
|
104
82
|
return buildArrayRowContent(dataGroups);
|
|
105
83
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2["default"])({}, key, parsedData));
|
|
111
|
-
}, {});
|
|
84
|
+
const getParsedRowData = rows => rows.map(rowData => Object.keys(rowData).reduce((acc, key) => {
|
|
85
|
+
const parsedData = Array.isArray(rowData[key]) ? buildArrayRowData(rowData[key]) : rowData[key];
|
|
86
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
87
|
+
[key]: parsedData
|
|
112
88
|
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
89
|
+
}, {}));
|
|
90
|
+
exports.getParsedRowData = getParsedRowData;
|
|
91
|
+
const getColumnsAndLabels = (listingProperties, allProperties, rows) => {
|
|
92
|
+
const columns = [];
|
|
93
|
+
const labels = {};
|
|
94
|
+
listingProperties.forEach(listingProperty => {
|
|
95
|
+
const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;
|
|
96
|
+
const {
|
|
97
|
+
label
|
|
98
|
+
} = allProperties[propKey] || {};
|
|
121
99
|
columns.push(propKey);
|
|
122
100
|
labels[propKey] = label || getSanitizedColumnLabel(propKey);
|
|
123
101
|
});
|
|
124
|
-
|
|
102
|
+
const parsedRowData = getParsedRowData(rows);
|
|
125
103
|
return {
|
|
126
|
-
columns
|
|
127
|
-
labels
|
|
128
|
-
parsedRowData
|
|
104
|
+
columns,
|
|
105
|
+
labels,
|
|
106
|
+
parsedRowData
|
|
129
107
|
};
|
|
130
108
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
109
|
+
const populateRows = ({
|
|
110
|
+
toggleModal,
|
|
111
|
+
url,
|
|
112
|
+
entitySchema,
|
|
113
|
+
rows
|
|
114
|
+
}) => {
|
|
115
|
+
const {
|
|
116
|
+
id: schemaId,
|
|
117
|
+
listingProperties,
|
|
118
|
+
properties,
|
|
119
|
+
dynamicProperties = {},
|
|
120
|
+
formProperties
|
|
121
|
+
} = entitySchema;
|
|
122
|
+
const isEnquiry = schemaId === 'enquiry';
|
|
123
|
+
const columnOptions = !isEnquiry ? [...listingProperties, _constants.ACTIONS] : [...listingProperties];
|
|
124
|
+
const allProperties = _objectSpread(_objectSpread({}, properties), dynamicProperties);
|
|
125
|
+
const {
|
|
126
|
+
columns,
|
|
127
|
+
labels,
|
|
128
|
+
parsedRowData
|
|
129
|
+
} = getColumnsAndLabels(columnOptions, allProperties, rows);
|
|
130
|
+
const [firstColumn] = columns;
|
|
151
131
|
return {
|
|
152
132
|
identification: 'id',
|
|
153
133
|
sort: null,
|
|
154
|
-
columns
|
|
155
|
-
labels
|
|
156
|
-
orderBy:
|
|
134
|
+
columns,
|
|
135
|
+
labels,
|
|
136
|
+
orderBy: [...formProperties],
|
|
157
137
|
rows: formatRows({
|
|
158
|
-
firstColumn
|
|
138
|
+
firstColumn,
|
|
159
139
|
rows: parsedRowData,
|
|
160
|
-
url
|
|
161
|
-
toggleModal
|
|
162
|
-
isEnquiry
|
|
163
|
-
entitySchema
|
|
140
|
+
url,
|
|
141
|
+
toggleModal,
|
|
142
|
+
isEnquiry,
|
|
143
|
+
entitySchema
|
|
164
144
|
}),
|
|
165
|
-
isEnquiry
|
|
145
|
+
isEnquiry
|
|
166
146
|
};
|
|
167
147
|
};
|
|
148
|
+
exports.populateRows = populateRows;
|
|
168
149
|
//# sourceMappingURL=populate-rows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate-rows.js","names":["_react","_interopRequireDefault","require","_reactRouterDom","_pluginRenderHooksUi","_TableActions","_constants","_InfoBoxValue","_InfoBoxLabel","_InfoBoxTooltip","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","formatRows","exports","_ref","rows","url","toggleModal","label","_ref$firstColumn","firstColumn","isEnquiry","entitySchema","map","data","editUrl","concat","id","rowProps","createElement","Fragment","Link","to","role","RenderHook","hookKey","schema","value","column","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","toUpperCase","toLowerCase","buildArrayRowContent","rowData","className","rowGroup","item","info","buildArrayRowData","groupSize","Math","ceil","group1","slice","group2","group3","dataGroups","getParsedRowData","reduce","acc","key","parsedData","Array","isArray","getColumnsAndLabels","listingProperties","allProperties","columns","labels","listingProperty","propKey","includes","split","_ref2","parsedRowData","populateRows","_ref3","schemaId","properties","_entitySchema$dynamic","dynamicProperties","formProperties","columnOptions","_toConsumableArray2","ACTIONS","_getColumnsAndLabels","_columns","_slicedToArray2","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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MACHC,WAAW,EAAXA,WAAW;MACXI,SAAS,EAATA,SAAS;MACTC,YAAY,EAAZA;IACF,CAAC,CAAC;IACFD,SAAS,EAATA;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"populate-rows.js","names":["_react","_interopRequireDefault","require","_reactRouterDom","_pluginRenderHooksUi","_TableActions","_constants","_InfoBoxValue","_InfoBoxLabel","_InfoBoxTooltip","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","formatRows","rows","url","toggleModal","label","firstColumn","isEnquiry","entitySchema","map","data","editUrl","id","rowProps","createElement","Fragment","Link","to","role","RenderHook","hookKey","schema","value","column","actions","showDeleteModal","exports","getSanitizedColumnLabel","columnProp","sanitizedChar","index","toUpperCase","toLowerCase","buildArrayRowContent","rowData","className","rowGroup","item","info","buildArrayRowData","groupSize","Math","ceil","group1","slice","group2","group3","dataGroups","getParsedRowData","reduce","acc","key","parsedData","Array","isArray","getColumnsAndLabels","listingProperties","allProperties","columns","labels","listingProperty","propKey","includes","split","parsedRowData","populateRows","schemaId","properties","dynamicProperties","formProperties","columnOptions","ACTIONS","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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AAA4D,SAAAQ,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,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IAAEC,MAAM;IAAEK;EAAc,CAAC;AAC3C,CAAC;AAED,MAAMC,YAAY,GAAGA,CAAC;EAAE7D,WAAW;EAAED,GAAG;EAAEK,YAAY;EAAEN;AAAK,CAAC,KAAK;EACjE,MAAM;IACJU,EAAE,EAAEsD,QAAQ;IACZV,iBAAiB;IACjBW,UAAU;IACVC,iBAAiB,GAAG,CAAC,CAAC;IACtBC;EACF,CAAC,GAAG7D,YAAY;EAEhB,MAAMD,SAAS,GAAG2D,QAAQ,KAAK,SAAS;EACxC,MAAMI,aAAa,GAAG,CAAC/D,SAAS,GAAG,CAAC,GAAGiD,iBAAiB,EAAEe,kBAAO,CAAC,GAAG,CAAC,GAAGf,iBAAiB,CAAC;EAE3F,MAAMC,aAAa,GAAAjE,aAAA,CAAAA,aAAA,KAAQ2E,UAAU,GAAKC,iBAAiB,CAAE;EAC7D,MAAM;IAAEV,OAAO;IAAEC,MAAM;IAAEK;EAAc,CAAC,GAAGT,mBAAmB,CAC5De,aAAa,EACbb,aAAa,EACbvD,IACF,CAAC;EACD,MAAM,CAACI,WAAW,CAAC,GAAGoD,OAAO;EAE7B,OAAO;IACLc,cAAc,EAAE,IAAI;IACpBC,IAAI,EAAE,IAAI;IACVf,OAAO;IACPC,MAAM;IACNe,OAAO,EAAE,CAAC,GAAGL,cAAc,CAAC;IAC5BnE,IAAI,EAAED,UAAU,CAAC;MACfK,WAAW;MACXJ,IAAI,EAAE8D,aAAa;MACnB7D,GAAG;MACHC,WAAW;MACXG,SAAS;MACTC;IACF,CAAC,CAAC;IACFD;EACF,CAAC;AACH,CAAC;AAACmB,OAAA,CAAAuC,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -1,51 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.js");
|
|
4
|
-
require("core-js/modules/es.array.filter.js");
|
|
5
|
-
require("core-js/modules/es.array.for-each.js");
|
|
6
|
-
require("core-js/modules/es.object.define-properties.js");
|
|
7
|
-
require("core-js/modules/es.object.define-property.js");
|
|
8
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
10
|
-
require("core-js/modules/es.object.keys.js");
|
|
11
|
-
require("core-js/modules/es.object.to-string.js");
|
|
12
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
13
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
14
4
|
Object.defineProperty(exports, "__esModule", {
|
|
15
5
|
value: true
|
|
16
6
|
});
|
|
17
7
|
exports.fetchData = void 0;
|
|
18
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
19
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
20
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
22
|
-
require("core-js/modules/es.array.concat.js");
|
|
23
|
-
require("core-js/modules/es.array.is-array.js");
|
|
24
|
-
require("core-js/modules/es.array.sort.js");
|
|
25
9
|
var _buildListingQuery = _interopRequireDefault(require("../../../utils/build-listing-query"));
|
|
26
10
|
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; }
|
|
27
|
-
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) { (0, _defineProperty2
|
|
28
|
-
function buildVariables(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
12
|
+
function buildVariables({
|
|
13
|
+
entitySchema,
|
|
14
|
+
isSearchQuery,
|
|
15
|
+
listFilters = [],
|
|
16
|
+
queryParams = {}
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
identifier
|
|
20
|
+
} = entitySchema;
|
|
21
|
+
const {
|
|
22
|
+
sort,
|
|
23
|
+
offset,
|
|
24
|
+
limit,
|
|
25
|
+
where
|
|
26
|
+
} = queryParams;
|
|
27
|
+
const [{
|
|
28
|
+
property,
|
|
29
|
+
direction
|
|
30
|
+
}] = sort;
|
|
31
|
+
const parsedOffset = `${property}:${direction}`;
|
|
45
32
|
if (!isSearchQuery) return _objectSpread(_objectSpread({}, queryParams), {}, {
|
|
46
33
|
where: !Array.isArray(listFilters) ? listFilters : where
|
|
47
34
|
});
|
|
48
|
-
|
|
35
|
+
const rawQuery = {
|
|
49
36
|
bool: {
|
|
50
37
|
must: listFilters || [],
|
|
51
38
|
filter: [{
|
|
@@ -56,56 +43,52 @@ function buildVariables(_ref) {
|
|
|
56
43
|
}
|
|
57
44
|
};
|
|
58
45
|
return {
|
|
59
|
-
limit
|
|
60
|
-
offset
|
|
46
|
+
limit,
|
|
47
|
+
offset,
|
|
61
48
|
sort: parsedOffset,
|
|
62
49
|
where: JSON.stringify(rawQuery)
|
|
63
50
|
};
|
|
64
51
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return function fetchData(_x) {
|
|
108
|
-
return _ref3.apply(this, arguments);
|
|
109
|
-
};
|
|
110
|
-
}();
|
|
52
|
+
const fetchData = async ({
|
|
53
|
+
client,
|
|
54
|
+
querySettings: {
|
|
55
|
+
entitySchema,
|
|
56
|
+
queryParams
|
|
57
|
+
},
|
|
58
|
+
listFilters
|
|
59
|
+
}) => {
|
|
60
|
+
const {
|
|
61
|
+
displayProperties: {
|
|
62
|
+
adminListings: {
|
|
63
|
+
dataSource: {
|
|
64
|
+
source,
|
|
65
|
+
index
|
|
66
|
+
} = {}
|
|
67
|
+
} = {}
|
|
68
|
+
} = {}
|
|
69
|
+
} = entitySchema;
|
|
70
|
+
const isSearchQuery = source === 'search';
|
|
71
|
+
const query = (0, _buildListingQuery.default)(entitySchema, index, isSearchQuery);
|
|
72
|
+
const variables = buildVariables({
|
|
73
|
+
entitySchema,
|
|
74
|
+
listFilters,
|
|
75
|
+
queryParams,
|
|
76
|
+
isSearchQuery
|
|
77
|
+
});
|
|
78
|
+
const {
|
|
79
|
+
data = {}
|
|
80
|
+
} = await client.query({
|
|
81
|
+
query,
|
|
82
|
+
variables,
|
|
83
|
+
fetchPolicy: 'network-only'
|
|
84
|
+
});
|
|
85
|
+
if (data.searchResults) {
|
|
86
|
+
return {
|
|
87
|
+
listingData: data.searchResults.results,
|
|
88
|
+
totalRecords: data.searchResults.total
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
};
|
|
93
|
+
exports.fetchData = fetchData;
|
|
111
94
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_buildListingQuery","_interopRequireDefault","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","buildVariables","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildListingQuery","_interopRequireDefault","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","buildVariables","entitySchema","isSearchQuery","listFilters","queryParams","identifier","sort","offset","limit","where","property","direction","parsedOffset","Array","isArray","rawQuery","bool","must","term","entityIdentifier","JSON","stringify","fetchData","client","querySettings","displayProperties","adminListings","dataSource","source","index","query","buildListingQuery","variables","data","fetchPolicy","searchResults","listingData","results","totalRecords","total","exports"],"sources":["../../../../src/components/ListingTable/service/index.js"],"sourcesContent":["import buildListingQuery from '../../../utils/build-listing-query';\n\nfunction buildVariables({ entitySchema, isSearchQuery, listFilters = [], queryParams = {} }) {\n const { identifier } = entitySchema;\n const { sort, offset, limit, where } = queryParams;\n const [{ property, direction }] = sort;\n const parsedOffset = `${property}:${direction}`;\n\n if (!isSearchQuery)\n return {\n ...queryParams,\n where: !Array.isArray(listFilters) ? listFilters : where\n };\n\n const rawQuery = {\n bool: {\n must: listFilters || [],\n filter: [\n {\n term: {\n entityIdentifier: identifier\n }\n }\n ]\n }\n };\n\n return {\n limit,\n offset,\n sort: parsedOffset,\n where: JSON.stringify(rawQuery)\n };\n}\n\nconst fetchData = async ({ client, querySettings: { entitySchema, queryParams }, listFilters }) => {\n const { displayProperties: { adminListings: { dataSource: { source, index } = {} } = {} } = {} } =\n entitySchema;\n\n const isSearchQuery = source === 'search';\n const query = buildListingQuery(entitySchema, index, isSearchQuery);\n const variables = buildVariables({ entitySchema, listFilters, queryParams, isSearchQuery });\n\n const { data = {} } = await client.query({\n query,\n variables,\n fetchPolicy: 'network-only'\n });\n\n if (data.searchResults) {\n return {\n listingData: data.searchResults.results,\n totalRecords: data.searchResults.total\n };\n }\n return data;\n};\n\nexport { fetchData };\n"],"mappings":";;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmE,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAAC,OAAA,EAAAjB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAe,yBAAA,GAAAf,MAAA,CAAAgB,gBAAA,CAAAnB,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