@blaze-cms/plugin-data-ui 0.127.0-project-admin-customisations.3 → 0.128.0-admin-updates.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -29
- package/README.md +0 -2
- package/lib/components/EntityManager/Entity/Entity.js +1 -10
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/Tabs/index.js +18 -2
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +1 -10
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/Tabs/index.js +5 -2
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/package.json +9 -10
- package/src/components/EntityManager/Entity/Entity.js +0 -4
- package/src/components/Tabs/index.js +3 -2
- package/lib/components/InfoBoxes/InfoBoxes.js +0 -36
- package/lib/components/InfoBoxes/InfoBoxes.js.map +0 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +0 -44
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
- package/lib/components/InfoBoxes/hooks/useData.js +0 -42
- package/lib/components/InfoBoxes/hooks/useData.js.map +0 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +0 -26
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
- package/lib/components/InfoBoxes/index.js +0 -12
- package/lib/components/InfoBoxes/index.js.map +0 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +0 -46
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
- package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -30
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js +0 -37
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -19
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
- package/lib-es/components/InfoBoxes/index.js +0 -3
- package/lib-es/components/InfoBoxes/index.js.map +0 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -31
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
- package/src/components/InfoBoxes/InfoBoxes.js +0 -24
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +0 -22
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/src/components/InfoBoxes/hooks/useData.js +0 -20
- package/src/components/InfoBoxes/hooks/useInfoBox.js +0 -13
- package/src/components/InfoBoxes/index.js +0 -3
- package/src/components/InfoBoxes/presentational/InfoBox.js +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-data-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.128.0-admin-updates.0",
|
|
4
4
|
"description": "Blaze plugin data ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,13 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/admin-ui-utils": "0.
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/
|
|
33
|
-
"@blaze-cms/react-
|
|
34
|
-
"@blaze-cms/
|
|
35
|
-
"@blaze-cms/
|
|
36
|
-
"@blaze-cms/versioning-ui": "0.127.0-project-admin-customisations.0",
|
|
30
|
+
"@blaze-cms/admin-ui-utils": "0.128.0-admin-updates.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.128.0-admin-updates.0",
|
|
32
|
+
"@blaze-cms/react-form-builder": "0.128.0-admin-updates.0",
|
|
33
|
+
"@blaze-cms/react-page-builder": "0.128.0-admin-updates.0",
|
|
34
|
+
"@blaze-cms/setup-ui": "0.128.0-admin-updates.0",
|
|
35
|
+
"@blaze-cms/versioning-ui": "0.128.0-admin-updates.0",
|
|
37
36
|
"@blaze-react/button": "0.5.19",
|
|
38
37
|
"@blaze-react/more": "0.5.19",
|
|
39
38
|
"@blaze-react/multiselect": "0.6.6",
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"uuid": "^3.3.3"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
|
-
"@blaze-cms/core-ui": "
|
|
56
|
+
"@blaze-cms/core-ui": "0.128.0-admin-updates.0"
|
|
58
57
|
},
|
|
59
58
|
"peerDependencies": {
|
|
60
59
|
"@apollo/client": "3.x",
|
|
@@ -66,5 +65,5 @@
|
|
|
66
65
|
"lib/*",
|
|
67
66
|
"lib-es/*"
|
|
68
67
|
],
|
|
69
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ad3389e954fe463366655311efb1198191dbb625"
|
|
70
69
|
}
|
|
@@ -3,7 +3,6 @@ import React, { useEffect, useState, useRef } from 'react';
|
|
|
3
3
|
import { withRouter, Prompt } from 'react-router-dom';
|
|
4
4
|
import { useApolloClient } from '@apollo/client';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
7
6
|
import { getQuery, GET_CURRENT_TAB_ID } from '@blaze-cms/admin-ui-utils';
|
|
8
7
|
import { FormBuilder, parseFormValues } from '@blaze-cms/react-form-builder';
|
|
9
8
|
import { DeleteAction, CopyDataFromAction } from '@blaze-cms/admin';
|
|
@@ -35,7 +34,6 @@ import {
|
|
|
35
34
|
checkFulfilConditions
|
|
36
35
|
} from '../utils/entity';
|
|
37
36
|
import useToggle from '../../../utils/hooks/useToggle';
|
|
38
|
-
import InfoBoxes from '../../InfoBoxes/InfoBoxes';
|
|
39
37
|
|
|
40
38
|
const Entity = ({
|
|
41
39
|
formData,
|
|
@@ -442,8 +440,6 @@ const Entity = ({
|
|
|
442
440
|
<div className="page__content--fixed">
|
|
443
441
|
<div className="page__content">
|
|
444
442
|
<div className="content">
|
|
445
|
-
<RenderHook hookKey={`entity:${action}:main:top`} entity={entity} schema={schema} />
|
|
446
|
-
<InfoBoxes id={entity.id} schema={schema} />
|
|
447
443
|
<Tabs
|
|
448
444
|
enabled={showPageBuilderTabs}
|
|
449
445
|
onTabChange={tabId => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Tab, TabItem } from '@blaze-react/tab';
|
|
4
4
|
import {
|
|
@@ -15,10 +15,11 @@ import {
|
|
|
15
15
|
|
|
16
16
|
const Tabs = ({ children, onTabChange, enabled }) => {
|
|
17
17
|
const { currentTabId } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;
|
|
18
|
+
const [activeAccordions, setActiveAccordions] = useState([]);
|
|
18
19
|
|
|
19
20
|
return enabled ? (
|
|
20
21
|
<>
|
|
21
|
-
<TabsContextProvider value={{ currentTabId }}>
|
|
22
|
+
<TabsContextProvider value={{ currentTabId, activeAccordions, setActiveAccordions }}>
|
|
22
23
|
<Tab selected={currentTabId}>
|
|
23
24
|
<TabItem title={EDITOR_VIEW_TAB} action={() => onTabChange(EDITOR_VIEW_TAB_INDEX)}>
|
|
24
25
|
{children}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
require("core-js/modules/es.array.map.js");
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _react = _interopRequireDefault(require("react"));
|
|
12
|
-
var _InfoBoxContainer = _interopRequireDefault(require("./container/InfoBoxContainer"));
|
|
13
|
-
var InfoBoxes = function InfoBoxes(_ref) {
|
|
14
|
-
var id = _ref.id,
|
|
15
|
-
schema = _ref.schema;
|
|
16
|
-
var _schema$displayProper = schema.displayProperties.adminInfoBoxes,
|
|
17
|
-
adminInfoBoxes = _schema$displayProper === void 0 ? [] : _schema$displayProper;
|
|
18
|
-
if (adminInfoBoxes.length <= 0) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return adminInfoBoxes.map(function (infoBox) {
|
|
22
|
-
return /*#__PURE__*/_react["default"].createElement(_InfoBoxContainer["default"], {
|
|
23
|
-
id: id,
|
|
24
|
-
schema: schema,
|
|
25
|
-
key: infoBox.key,
|
|
26
|
-
infoBox: infoBox
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var _default = InfoBoxes;
|
|
31
|
-
exports["default"] = _default;
|
|
32
|
-
InfoBoxes.propTypes = {
|
|
33
|
-
id: _propTypes["default"].string.isRequired,
|
|
34
|
-
schema: _propTypes["default"].object.isRequired
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=InfoBoxes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBoxes.js","names":["InfoBoxes","id","schema","displayProperties","adminInfoBoxes","length","map","infoBox","key","propTypes","PropTypes","string","isRequired","object"],"sources":["../../../src/components/InfoBoxes/InfoBoxes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxContainer from './container/InfoBoxContainer';\n\nconst InfoBoxes = ({ id, schema }) => {\n const {\n displayProperties: { adminInfoBoxes = [] }\n } = schema;\n\n if (adminInfoBoxes.length <= 0) {\n return null;\n }\n\n return adminInfoBoxes.map(infoBox => (\n <InfoBoxContainer id={id} schema={schema} key={infoBox.key} infoBox={infoBox} />\n ));\n};\n\nexport default InfoBoxes;\n\nInfoBoxes.propTypes = {\n id: PropTypes.string.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAS,OAAuB;EAAA,IAAjBC,EAAE,QAAFA,EAAE;IAAEC,MAAM,QAANA,MAAM;EAC7B,4BAEIA,MAAM,CADRC,iBAAiB,CAAIC,cAAc;IAAdA,cAAc,sCAAG,EAAE;EAG1C,IAAIA,cAAc,CAACC,MAAM,IAAI,CAAC,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,OAAOD,cAAc,CAACE,GAAG,CAAC,UAAAC,OAAO;IAAA,oBAC/B,gCAAC,4BAAgB;MAAC,EAAE,EAAEN,EAAG;MAAC,MAAM,EAAEC,MAAO;MAAC,GAAG,EAAEK,OAAO,CAACC,GAAI;MAAC,OAAO,EAAED;IAAQ,EAAG;EAAA,CACjF,CAAC;AACJ,CAAC;AAAC,eAEaP,SAAS;AAAA;AAExBA,SAAS,CAACS,SAAS,GAAG;EACpBR,EAAE,EAAES,qBAAS,CAACC,MAAM,CAACC,UAAU;EAC/BV,MAAM,EAAEQ,qBAAS,CAACG,MAAM,CAACD;AAC3B,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
require("core-js/modules/es.object.keys.js");
|
|
10
|
-
require("core-js/modules/es.array.flat-map.js");
|
|
11
|
-
require("core-js/modules/es.array.unscopables.flat-map.js");
|
|
12
|
-
require("core-js/modules/es.object.to-string.js");
|
|
13
|
-
require("core-js/modules/es.object.values.js");
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _useData2 = _interopRequireDefault(require("../hooks/useData"));
|
|
17
|
-
var _InfoBox = _interopRequireDefault(require("../presentational/InfoBox"));
|
|
18
|
-
var InfoBoxContainer = function InfoBoxContainer(_ref) {
|
|
19
|
-
var id = _ref.id,
|
|
20
|
-
schema = _ref.schema,
|
|
21
|
-
infoBox = _ref.infoBox;
|
|
22
|
-
var _useData = (0, _useData2["default"])({
|
|
23
|
-
id: id,
|
|
24
|
-
schema: schema,
|
|
25
|
-
infoBox: infoBox
|
|
26
|
-
}),
|
|
27
|
-
data = _useData.data;
|
|
28
|
-
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
29
|
-
var items = Object.values(data).flatMap(function (item) {
|
|
30
|
-
return Object.values(item);
|
|
31
|
-
});
|
|
32
|
-
return /*#__PURE__*/_react["default"].createElement(_InfoBox["default"], {
|
|
33
|
-
items: items,
|
|
34
|
-
infoBoxKey: infoBox.key
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var _default = InfoBoxContainer;
|
|
38
|
-
exports["default"] = _default;
|
|
39
|
-
InfoBoxContainer.propTypes = {
|
|
40
|
-
id: _propTypes["default"].string.isRequired,
|
|
41
|
-
infoBox: _propTypes["default"].object.isRequired,
|
|
42
|
-
schema: _propTypes["default"].object.isRequired
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=InfoBoxContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBoxContainer.js","names":["InfoBoxContainer","id","schema","infoBox","useData","data","Object","keys","length","items","values","flatMap","item","key","propTypes","PropTypes","string","isRequired","object"],"sources":["../../../../src/components/InfoBoxes/container/InfoBoxContainer.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport useData from '../hooks/useData';\nimport InfoBox from '../presentational/InfoBox';\n\nconst InfoBoxContainer = ({ id, schema, infoBox }) => {\n const { data } = useData({ id, schema, infoBox });\n\n if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;\n\n const items = Object.values(data).flatMap(item => Object.values(item));\n\n return <InfoBox items={items} infoBoxKey={infoBox.key} />;\n};\n\nexport default InfoBoxContainer;\n\nInfoBoxContainer.propTypes = {\n id: PropTypes.string.isRequired,\n infoBox: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAEA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,OAAgC;EAAA,IAA1BC,EAAE,QAAFA,EAAE;IAAEC,MAAM,QAANA,MAAM;IAAEC,OAAO,QAAPA,OAAO;EAC7C,eAAiB,IAAAC,oBAAO,EAAC;MAAEH,EAAE,EAAFA,EAAE;MAAEC,MAAM,EAANA,MAAM;MAAEC,OAAO,EAAPA;IAAQ,CAAC,CAAC;IAAzCE,IAAI,YAAJA,IAAI;EAEZ,IAAI,CAACA,IAAI,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAE9E,IAAMC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACL,IAAI,CAAC,CAACM,OAAO,CAAC,UAAAC,IAAI;IAAA,OAAIN,MAAM,CAACI,MAAM,CAACE,IAAI,CAAC;EAAA,EAAC;EAEtE,oBAAO,gCAAC,mBAAO;IAAC,KAAK,EAAEH,KAAM;IAAC,UAAU,EAAEN,OAAO,CAACU;EAAI,EAAG;AAC3D,CAAC;AAAC,eAEab,gBAAgB;AAAA;AAE/BA,gBAAgB,CAACc,SAAS,GAAG;EAC3Bb,EAAE,EAAEc,qBAAS,CAACC,MAAM,CAACC,UAAU;EAC/Bd,OAAO,EAAEY,qBAAS,CAACG,MAAM,CAACD,UAAU;EACpCf,MAAM,EAAEa,qBAAS,CAACG,MAAM,CAACD;AAC3B,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = buildDynamicQuery;
|
|
9
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
-
var _client = require("@apollo/client");
|
|
11
|
-
var _coreErrors = require("@blaze-cms/core-errors");
|
|
12
|
-
var _templateObject;
|
|
13
|
-
function buildDynamicQuery(_ref) {
|
|
14
|
-
var id = _ref.id,
|
|
15
|
-
schema = _ref.schema,
|
|
16
|
-
infoBox = _ref.infoBox;
|
|
17
|
-
if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
|
|
18
|
-
throw new _coreErrors.BlazeError('DataEntity query requires get action, properties and fields from entity schema');
|
|
19
|
-
}
|
|
20
|
-
var fields = "".concat(infoBox.property, " {\n label\n value\n }");
|
|
21
|
-
return {
|
|
22
|
-
query: (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["query getInfoBoxData($id: String!){\n ", "( id: $id ) {\n id\n ", "\n __typename\n }\n }"])), schema.actions.get, fields)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=build-dynamic-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["buildDynamicQuery","id","schema","infoBox","actions","get","properties","BlazeError","fields","property","query","gql"],"sources":["../../../../src/components/InfoBoxes/helpers/build-dynamic-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nexport default function buildDynamicQuery({ id, schema, infoBox }) {\n if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {\n throw new BlazeError(\n 'DataEntity query requires get action, properties and fields from entity schema'\n );\n }\n\n const fields = `${infoBox.property} {\n label\n value\n }`;\n\n return {\n query: gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields}\n __typename\n }\n }`\n };\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AAAoD;AAErC,SAASA,iBAAiB,OAA0B;EAAA,IAAvBC,EAAE,QAAFA,EAAE;IAAEC,MAAM,QAANA,MAAM;IAAEC,OAAO,QAAPA,OAAO;EAC7D,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;IAC3E,MAAM,IAAIC,sBAAU,CAClB,gFAAgF,CACjF;EACH;EAEA,IAAMC,MAAM,aAAML,OAAO,CAACM,QAAQ,wCAG9B;EAEJ,OAAO;IACLC,KAAK,MAAEC,WAAG,oMACRT,MAAM,CAACE,OAAO,CAACC,GAAG,EAEjBG,MAAM;EAIX,CAAC;AACH"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
-
var _client = require("@apollo/client");
|
|
11
|
-
var _useInfoBox = _interopRequireDefault(require("./useInfoBox"));
|
|
12
|
-
var _templateObject;
|
|
13
|
-
function useData(_ref) {
|
|
14
|
-
var id = _ref.id,
|
|
15
|
-
schema = _ref.schema,
|
|
16
|
-
infoBox = _ref.infoBox;
|
|
17
|
-
var _useInfoBoxData = (0, _useInfoBox["default"])({
|
|
18
|
-
id: id,
|
|
19
|
-
schema: schema,
|
|
20
|
-
infoBox: infoBox
|
|
21
|
-
}),
|
|
22
|
-
query = _useInfoBoxData.query;
|
|
23
|
-
var infoBoxQuery = query || (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n query {\n __typename\n }\n "])));
|
|
24
|
-
var _useQuery = (0, _client.useQuery)(infoBoxQuery, {
|
|
25
|
-
variables: {
|
|
26
|
-
id: id
|
|
27
|
-
},
|
|
28
|
-
skip: !query
|
|
29
|
-
}),
|
|
30
|
-
_useQuery$data = _useQuery.data,
|
|
31
|
-
data = _useQuery$data === void 0 ? {} : _useQuery$data,
|
|
32
|
-
loading = _useQuery.loading,
|
|
33
|
-
error = _useQuery.error;
|
|
34
|
-
return {
|
|
35
|
-
data: data.__typename !== 'Query' ? data : null,
|
|
36
|
-
loading: loading,
|
|
37
|
-
error: error
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
var _default = useData;
|
|
41
|
-
exports["default"] = _default;
|
|
42
|
-
//# sourceMappingURL=useData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useData.js","names":["useData","id","schema","infoBox","useInfoBoxData","query","infoBoxQuery","gql","useQuery","variables","skip","data","loading","error","__typename"],"sources":["../../../../src/components/InfoBoxes/hooks/useData.js"],"sourcesContent":["import { useQuery, gql } from '@apollo/client';\nimport useInfoBoxData from './useInfoBox';\n\nfunction useData({ id, schema, infoBox }) {\n const { query } = useInfoBoxData({ id, schema, infoBox });\n\n const infoBoxQuery =\n query ||\n gql`\n query {\n __typename\n }\n `;\n\n const { data = {}, loading, error } = useQuery(infoBoxQuery, { variables: { id }, skip: !query });\n\n return { data: data.__typename !== 'Query' ? data : null, loading, error };\n}\n\nexport default useData;\n"],"mappings":";;;;;;;;;AAAA;AACA;AAA0C;AAE1C,SAASA,OAAO,OAA0B;EAAA,IAAvBC,EAAE,QAAFA,EAAE;IAAEC,MAAM,QAANA,MAAM;IAAEC,OAAO,QAAPA,OAAO;EACpC,sBAAkB,IAAAC,sBAAc,EAAC;MAAEH,EAAE,EAAFA,EAAE;MAAEC,MAAM,EAANA,MAAM;MAAEC,OAAO,EAAPA;IAAQ,CAAC,CAAC;IAAjDE,KAAK,mBAALA,KAAK;EAEb,IAAMC,YAAY,GAChBD,KAAK,QACLE,WAAG,yIAIF;EAEH,gBAAsC,IAAAC,gBAAQ,EAACF,YAAY,EAAE;MAAEG,SAAS,EAAE;QAAER,EAAE,EAAFA;MAAG,CAAC;MAAES,IAAI,EAAE,CAACL;IAAM,CAAC,CAAC;IAAA,2BAAzFM,IAAI;IAAJA,IAAI,+BAAG,CAAC,CAAC;IAAEC,OAAO,aAAPA,OAAO;IAAEC,KAAK,aAALA,KAAK;EAEjC,OAAO;IAAEF,IAAI,EAAEA,IAAI,CAACG,UAAU,KAAK,OAAO,GAAGH,IAAI,GAAG,IAAI;IAAEC,OAAO,EAAPA,OAAO;IAAEC,KAAK,EAALA;EAAM,CAAC;AAC5E;AAAC,eAEcb,OAAO;AAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _buildDynamicQuery2 = _interopRequireDefault(require("../helpers/build-dynamic-query"));
|
|
10
|
-
function useInfoBox(_ref) {
|
|
11
|
-
var id = _ref.id,
|
|
12
|
-
schema = _ref.schema,
|
|
13
|
-
infoBox = _ref.infoBox;
|
|
14
|
-
var _buildDynamicQuery = (0, _buildDynamicQuery2["default"])({
|
|
15
|
-
id: id,
|
|
16
|
-
schema: schema,
|
|
17
|
-
infoBox: infoBox
|
|
18
|
-
}),
|
|
19
|
-
query = _buildDynamicQuery.query;
|
|
20
|
-
return {
|
|
21
|
-
query: query || null
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var _default = useInfoBox;
|
|
25
|
-
exports["default"] = _default;
|
|
26
|
-
//# sourceMappingURL=useInfoBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInfoBox.js","names":["useInfoBox","id","schema","infoBox","buildDynamicQuery","query"],"sources":["../../../../src/components/InfoBoxes/hooks/useInfoBox.js"],"sourcesContent":["import buildDynamicQuery from '../helpers/build-dynamic-query';\n\nfunction useInfoBox({ id, schema, infoBox }) {\n const { query } = buildDynamicQuery({\n id,\n schema,\n infoBox\n });\n\n return { query: query || null };\n}\n\nexport default useInfoBox;\n"],"mappings":";;;;;;;;AAAA;AAEA,SAASA,UAAU,OAA0B;EAAA,IAAvBC,EAAE,QAAFA,EAAE;IAAEC,MAAM,QAANA,MAAM;IAAEC,OAAO,QAAPA,OAAO;EACvC,yBAAkB,IAAAC,8BAAiB,EAAC;MAClCH,EAAE,EAAFA,EAAE;MACFC,MAAM,EAANA,MAAM;MACNC,OAAO,EAAPA;IACF,CAAC,CAAC;IAJME,KAAK,sBAALA,KAAK;EAMb,OAAO;IAAEA,KAAK,EAAEA,KAAK,IAAI;EAAK,CAAC;AACjC;AAAC,eAEcL,UAAU;AAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _InfoBoxes = _interopRequireDefault(require("./InfoBoxes"));
|
|
10
|
-
var _default = _InfoBoxes["default"];
|
|
11
|
-
exports["default"] = _default;
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["InfoBoxes"],"sources":["../../../src/components/InfoBoxes/index.js"],"sourcesContent":["import InfoBoxes from './InfoBoxes';\n\nexport default InfoBoxes;\n"],"mappings":";;;;;;;;AAAA;AAAoC,eAErBA,qBAAS;AAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
require("core-js/modules/es.array.map.js");
|
|
10
|
-
require("core-js/modules/es.array.filter.js");
|
|
11
|
-
require("core-js/modules/es.object.to-string.js");
|
|
12
|
-
require("core-js/modules/es.object.values.js");
|
|
13
|
-
require("core-js/modules/es.array.concat.js");
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var InfoBox = function InfoBox(_ref) {
|
|
17
|
-
var items = _ref.items,
|
|
18
|
-
infoBoxKey = _ref.infoBoxKey;
|
|
19
|
-
if (!items) return null;
|
|
20
|
-
var infoBoxItems = items.map(function (item) {
|
|
21
|
-
return Object.values(item).map(function (info) {
|
|
22
|
-
if (!info.label || !info.value) return null;
|
|
23
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
24
|
-
className: "info-box--item",
|
|
25
|
-
key: "".concat(infoBoxKey, "-").concat(info.label.toLowerCase())
|
|
26
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
27
|
-
className: "info-box--label"
|
|
28
|
-
}, info.label, ": "), /*#__PURE__*/_react["default"].createElement("div", {
|
|
29
|
-
className: "info-box--value"
|
|
30
|
-
}, info.value));
|
|
31
|
-
}).filter(Boolean);
|
|
32
|
-
});
|
|
33
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
|
-
className: "info-box",
|
|
35
|
-
key: infoBoxKey
|
|
36
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
37
|
-
className: "info-box--container"
|
|
38
|
-
}, infoBoxItems));
|
|
39
|
-
};
|
|
40
|
-
var _default = InfoBox;
|
|
41
|
-
exports["default"] = _default;
|
|
42
|
-
InfoBox.propTypes = {
|
|
43
|
-
infoBoxKey: _propTypes["default"].string.isRequired,
|
|
44
|
-
items: _propTypes["default"].array.isRequired
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBox.js","names":["InfoBox","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","toLowerCase","filter","Boolean","propTypes","PropTypes","string","isRequired","array"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst InfoBox = ({ items, infoBoxKey }) => {\n if (!items) return null;\n\n const infoBoxItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <div className=\"info-box--item\" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>\n <div className=\"info-box--label\">{info.label}: </div>\n <div className=\"info-box--value\">{info.value}</div>\n </div>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"info-box\" key={infoBoxKey}>\n <div className=\"info-box--container\">{infoBoxItems}</div>\n </div>\n );\n};\n\nexport default InfoBox;\n\nInfoBox.propTypes = {\n infoBoxKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAO,OAA8B;EAAA,IAAxBC,KAAK,QAALA,KAAK;IAAEC,UAAU,QAAVA,UAAU;EAClC,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,IAAME,YAAY,GAAGF,KAAK,CAACG,GAAG,CAAC,UAAAC,IAAI;IAAA,OACjCC,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,CAChBD,GAAG,CAAC,UAAAI,IAAI,EAAI;MACX,IAAI,CAACA,IAAI,CAACC,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK,EAAE,OAAO,IAAI;MAE3C,oBACE;QAAK,SAAS,EAAC,gBAAgB;QAAC,GAAG,YAAKR,UAAU,cAAIM,IAAI,CAACC,KAAK,CAACE,WAAW,EAAE;MAAG,gBAC/E;QAAK,SAAS,EAAC;MAAiB,GAAEH,IAAI,CAACC,KAAK,EAAC,IAAE,CAAM,eACrD;QAAK,SAAS,EAAC;MAAiB,GAAED,IAAI,CAACE,KAAK,CAAO,CAC/C;IAEV,CAAC,CAAC,CACDE,MAAM,CAACC,OAAO,CAAC;EAAA,EACnB;EAED,oBACE;IAAK,SAAS,EAAC,UAAU;IAAC,GAAG,EAAEX;EAAW,gBACxC;IAAK,SAAS,EAAC;EAAqB,GAAEC,YAAY,CAAO,CACrD;AAEV,CAAC;AAAC,eAEaH,OAAO;AAAA;AAEtBA,OAAO,CAACc,SAAS,GAAG;EAClBZ,UAAU,EAAEa,qBAAS,CAACC,MAAM,CAACC,UAAU;EACvChB,KAAK,EAAEc,qBAAS,CAACG,KAAK,CAACD;AACzB,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import InfoBoxContainer from './container/InfoBoxContainer';
|
|
4
|
-
const InfoBoxes = ({
|
|
5
|
-
id,
|
|
6
|
-
schema
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
displayProperties: {
|
|
10
|
-
adminInfoBoxes = []
|
|
11
|
-
}
|
|
12
|
-
} = schema;
|
|
13
|
-
if (adminInfoBoxes.length <= 0) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
return adminInfoBoxes.map(infoBox => /*#__PURE__*/React.createElement(InfoBoxContainer, {
|
|
17
|
-
id: id,
|
|
18
|
-
schema: schema,
|
|
19
|
-
key: infoBox.key,
|
|
20
|
-
infoBox: infoBox
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
23
|
-
export default InfoBoxes;
|
|
24
|
-
InfoBoxes.propTypes = {
|
|
25
|
-
id: PropTypes.string.isRequired,
|
|
26
|
-
schema: PropTypes.object.isRequired
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=InfoBoxes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBoxes.js","names":["PropTypes","React","InfoBoxContainer","InfoBoxes","id","schema","displayProperties","adminInfoBoxes","length","map","infoBox","key","propTypes","string","isRequired","object"],"sources":["../../../src/components/InfoBoxes/InfoBoxes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxContainer from './container/InfoBoxContainer';\n\nconst InfoBoxes = ({ id, schema }) => {\n const {\n displayProperties: { adminInfoBoxes = [] }\n } = schema;\n\n if (adminInfoBoxes.length <= 0) {\n return null;\n }\n\n return adminInfoBoxes.map(infoBox => (\n <InfoBoxContainer id={id} schema={schema} key={infoBox.key} infoBox={infoBox} />\n ));\n};\n\nexport default InfoBoxes;\n\nInfoBoxes.propTypes = {\n id: PropTypes.string.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,gBAAgB,MAAM,8BAA8B;AAE3D,MAAMC,SAAS,GAAG,CAAC;EAAEC,EAAE;EAAEC;AAAO,CAAC,KAAK;EACpC,MAAM;IACJC,iBAAiB,EAAE;MAAEC,cAAc,GAAG;IAAG;EAC3C,CAAC,GAAGF,MAAM;EAEV,IAAIE,cAAc,CAACC,MAAM,IAAI,CAAC,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,OAAOD,cAAc,CAACE,GAAG,CAACC,OAAO,iBAC/B,oBAAC,gBAAgB;IAAC,EAAE,EAAEN,EAAG;IAAC,MAAM,EAAEC,MAAO;IAAC,GAAG,EAAEK,OAAO,CAACC,GAAI;IAAC,OAAO,EAAED;EAAQ,EAC9E,CAAC;AACJ,CAAC;AAED,eAAeP,SAAS;AAExBA,SAAS,CAACS,SAAS,GAAG;EACpBR,EAAE,EAAEJ,SAAS,CAACa,MAAM,CAACC,UAAU;EAC/BT,MAAM,EAAEL,SAAS,CAACe,MAAM,CAACD;AAC3B,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import useData from '../hooks/useData';
|
|
4
|
-
import InfoBox from '../presentational/InfoBox';
|
|
5
|
-
const InfoBoxContainer = ({
|
|
6
|
-
id,
|
|
7
|
-
schema,
|
|
8
|
-
infoBox
|
|
9
|
-
}) => {
|
|
10
|
-
const {
|
|
11
|
-
data
|
|
12
|
-
} = useData({
|
|
13
|
-
id,
|
|
14
|
-
schema,
|
|
15
|
-
infoBox
|
|
16
|
-
});
|
|
17
|
-
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
18
|
-
const items = Object.values(data).flatMap(item => Object.values(item));
|
|
19
|
-
return /*#__PURE__*/React.createElement(InfoBox, {
|
|
20
|
-
items: items,
|
|
21
|
-
infoBoxKey: infoBox.key
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
export default InfoBoxContainer;
|
|
25
|
-
InfoBoxContainer.propTypes = {
|
|
26
|
-
id: PropTypes.string.isRequired,
|
|
27
|
-
infoBox: PropTypes.object.isRequired,
|
|
28
|
-
schema: PropTypes.object.isRequired
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=InfoBoxContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBoxContainer.js","names":["PropTypes","React","useData","InfoBox","InfoBoxContainer","id","schema","infoBox","data","Object","keys","length","items","values","flatMap","item","key","propTypes","string","isRequired","object"],"sources":["../../../../src/components/InfoBoxes/container/InfoBoxContainer.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport useData from '../hooks/useData';\nimport InfoBox from '../presentational/InfoBox';\n\nconst InfoBoxContainer = ({ id, schema, infoBox }) => {\n const { data } = useData({ id, schema, infoBox });\n\n if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;\n\n const items = Object.values(data).flatMap(item => Object.values(item));\n\n return <InfoBox items={items} infoBoxKey={infoBox.key} />;\n};\n\nexport default InfoBoxContainer;\n\nInfoBoxContainer.propTypes = {\n id: PropTypes.string.isRequired,\n infoBox: PropTypes.object.isRequired,\n schema: PropTypes.object.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,OAAO,MAAM,2BAA2B;AAE/C,MAAMC,gBAAgB,GAAG,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,KAAK;EACpD,MAAM;IAAEC;EAAK,CAAC,GAAGN,OAAO,CAAC;IAAEG,EAAE;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC;EAEjD,IAAI,CAACC,IAAI,IAAI,CAACC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAE9E,MAAMC,KAAK,GAAGH,MAAM,CAACI,MAAM,CAACL,IAAI,CAAC,CAACM,OAAO,CAACC,IAAI,IAAIN,MAAM,CAACI,MAAM,CAACE,IAAI,CAAC,CAAC;EAEtE,oBAAO,oBAAC,OAAO;IAAC,KAAK,EAAEH,KAAM;IAAC,UAAU,EAAEL,OAAO,CAACS;EAAI,EAAG;AAC3D,CAAC;AAED,eAAeZ,gBAAgB;AAE/BA,gBAAgB,CAACa,SAAS,GAAG;EAC3BZ,EAAE,EAAEL,SAAS,CAACkB,MAAM,CAACC,UAAU;EAC/BZ,OAAO,EAAEP,SAAS,CAACoB,MAAM,CAACD,UAAU;EACpCb,MAAM,EAAEN,SAAS,CAACoB,MAAM,CAACD;AAC3B,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client';
|
|
2
|
-
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
-
export default function buildDynamicQuery({
|
|
4
|
-
id,
|
|
5
|
-
schema,
|
|
6
|
-
infoBox
|
|
7
|
-
}) {
|
|
8
|
-
if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
|
|
9
|
-
throw new BlazeError('DataEntity query requires get action, properties and fields from entity schema');
|
|
10
|
-
}
|
|
11
|
-
const fields = `${infoBox.property} {
|
|
12
|
-
label
|
|
13
|
-
value
|
|
14
|
-
}`;
|
|
15
|
-
return {
|
|
16
|
-
query: gql`query getInfoBoxData($id: String!){
|
|
17
|
-
${schema.actions.get}( id: $id ) {
|
|
18
|
-
id
|
|
19
|
-
${fields}
|
|
20
|
-
__typename
|
|
21
|
-
}
|
|
22
|
-
}`
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=build-dynamic-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","infoBox","actions","get","properties","fields","property","query"],"sources":["../../../../src/components/InfoBoxes/helpers/build-dynamic-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nexport default function buildDynamicQuery({ id, schema, infoBox }) {\n if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {\n throw new BlazeError(\n 'DataEntity query requires get action, properties and fields from entity schema'\n );\n }\n\n const fields = `${infoBox.property} {\n label\n value\n }`;\n\n return {\n query: gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields}\n __typename\n }\n }`\n };\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiB,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EACjE,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;IAC3E,MAAM,IAAIP,UAAU,CAClB,gFAAgF,CACjF;EACH;EAEA,MAAMQ,MAAM,GAAI,GAAEJ,OAAO,CAACK,QAAS;AACrC;AACA;AACA,MAAM;EAEJ,OAAO;IACLC,KAAK,EAAEX,GAAI;AACf,MAAMI,MAAM,CAACE,OAAO,CAACC,GAAI;AACzB;AACA,OAAOE,MAAO;AACd;AACA;AACA;EACE,CAAC;AACH"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useQuery, gql } from '@apollo/client';
|
|
2
|
-
import useInfoBoxData from './useInfoBox';
|
|
3
|
-
function useData({
|
|
4
|
-
id,
|
|
5
|
-
schema,
|
|
6
|
-
infoBox
|
|
7
|
-
}) {
|
|
8
|
-
const {
|
|
9
|
-
query
|
|
10
|
-
} = useInfoBoxData({
|
|
11
|
-
id,
|
|
12
|
-
schema,
|
|
13
|
-
infoBox
|
|
14
|
-
});
|
|
15
|
-
const infoBoxQuery = query || gql`
|
|
16
|
-
query {
|
|
17
|
-
__typename
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
const {
|
|
21
|
-
data = {},
|
|
22
|
-
loading,
|
|
23
|
-
error
|
|
24
|
-
} = useQuery(infoBoxQuery, {
|
|
25
|
-
variables: {
|
|
26
|
-
id
|
|
27
|
-
},
|
|
28
|
-
skip: !query
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
data: data.__typename !== 'Query' ? data : null,
|
|
32
|
-
loading,
|
|
33
|
-
error
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export default useData;
|
|
37
|
-
//# sourceMappingURL=useData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useData.js","names":["useQuery","gql","useInfoBoxData","useData","id","schema","infoBox","query","infoBoxQuery","data","loading","error","variables","skip","__typename"],"sources":["../../../../src/components/InfoBoxes/hooks/useData.js"],"sourcesContent":["import { useQuery, gql } from '@apollo/client';\nimport useInfoBoxData from './useInfoBox';\n\nfunction useData({ id, schema, infoBox }) {\n const { query } = useInfoBoxData({ id, schema, infoBox });\n\n const infoBoxQuery =\n query ||\n gql`\n query {\n __typename\n }\n `;\n\n const { data = {}, loading, error } = useQuery(infoBoxQuery, { variables: { id }, skip: !query });\n\n return { data: data.__typename !== 'Query' ? data : null, loading, error };\n}\n\nexport default useData;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,GAAG,QAAQ,gBAAgB;AAC9C,OAAOC,cAAc,MAAM,cAAc;AAEzC,SAASC,OAAO,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EACxC,MAAM;IAAEC;EAAM,CAAC,GAAGL,cAAc,CAAC;IAAEE,EAAE;IAAEC,MAAM;IAAEC;EAAQ,CAAC,CAAC;EAEzD,MAAME,YAAY,GAChBD,KAAK,IACLN,GAAI;AACR;AACA;AACA;AACA,KAAK;EAEH,MAAM;IAAEQ,IAAI,GAAG,CAAC,CAAC;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGX,QAAQ,CAACQ,YAAY,EAAE;IAAEI,SAAS,EAAE;MAAER;IAAG,CAAC;IAAES,IAAI,EAAE,CAACN;EAAM,CAAC,CAAC;EAEjG,OAAO;IAAEE,IAAI,EAAEA,IAAI,CAACK,UAAU,KAAK,OAAO,GAAGL,IAAI,GAAG,IAAI;IAAEC,OAAO;IAAEC;EAAM,CAAC;AAC5E;AAEA,eAAeR,OAAO"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import buildDynamicQuery from '../helpers/build-dynamic-query';
|
|
2
|
-
function useInfoBox({
|
|
3
|
-
id,
|
|
4
|
-
schema,
|
|
5
|
-
infoBox
|
|
6
|
-
}) {
|
|
7
|
-
const {
|
|
8
|
-
query
|
|
9
|
-
} = buildDynamicQuery({
|
|
10
|
-
id,
|
|
11
|
-
schema,
|
|
12
|
-
infoBox
|
|
13
|
-
});
|
|
14
|
-
return {
|
|
15
|
-
query: query || null
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export default useInfoBox;
|
|
19
|
-
//# sourceMappingURL=useInfoBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInfoBox.js","names":["buildDynamicQuery","useInfoBox","id","schema","infoBox","query"],"sources":["../../../../src/components/InfoBoxes/hooks/useInfoBox.js"],"sourcesContent":["import buildDynamicQuery from '../helpers/build-dynamic-query';\n\nfunction useInfoBox({ id, schema, infoBox }) {\n const { query } = buildDynamicQuery({\n id,\n schema,\n infoBox\n });\n\n return { query: query || null };\n}\n\nexport default useInfoBox;\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,gCAAgC;AAE9D,SAASC,UAAU,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAE;EAC3C,MAAM;IAAEC;EAAM,CAAC,GAAGL,iBAAiB,CAAC;IAClCE,EAAE;IACFC,MAAM;IACNC;EACF,CAAC,CAAC;EAEF,OAAO;IAAEC,KAAK,EAAEA,KAAK,IAAI;EAAK,CAAC;AACjC;AAEA,eAAeJ,UAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["InfoBoxes"],"sources":["../../../src/components/InfoBoxes/index.js"],"sourcesContent":["import InfoBoxes from './InfoBoxes';\n\nexport default InfoBoxes;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,eAAeA,SAAS"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
const InfoBox = ({
|
|
4
|
-
items,
|
|
5
|
-
infoBoxKey
|
|
6
|
-
}) => {
|
|
7
|
-
if (!items) return null;
|
|
8
|
-
const infoBoxItems = items.map(item => Object.values(item).map(info => {
|
|
9
|
-
if (!info.label || !info.value) return null;
|
|
10
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
-
className: "info-box--item",
|
|
12
|
-
key: `${infoBoxKey}-${info.label.toLowerCase()}`
|
|
13
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
-
className: "info-box--label"
|
|
15
|
-
}, info.label, ": "), /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
className: "info-box--value"
|
|
17
|
-
}, info.value));
|
|
18
|
-
}).filter(Boolean));
|
|
19
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: "info-box",
|
|
21
|
-
key: infoBoxKey
|
|
22
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
-
className: "info-box--container"
|
|
24
|
-
}, infoBoxItems));
|
|
25
|
-
};
|
|
26
|
-
export default InfoBox;
|
|
27
|
-
InfoBox.propTypes = {
|
|
28
|
-
infoBoxKey: PropTypes.string.isRequired,
|
|
29
|
-
items: PropTypes.array.isRequired
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBox","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","toLowerCase","filter","Boolean","propTypes","string","isRequired","array"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst InfoBox = ({ items, infoBoxKey }) => {\n if (!items) return null;\n\n const infoBoxItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <div className=\"info-box--item\" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>\n <div className=\"info-box--label\">{info.label}: </div>\n <div className=\"info-box--value\">{info.value}</div>\n </div>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"info-box\" key={infoBoxKey}>\n <div className=\"info-box--container\">{infoBoxItems}</div>\n </div>\n );\n};\n\nexport default InfoBox;\n\nInfoBox.propTypes = {\n infoBoxKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AAEzB,MAAMC,OAAO,GAAG,CAAC;EAAEC,KAAK;EAAEC;AAAW,CAAC,KAAK;EACzC,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,MAAME,YAAY,GAAGF,KAAK,CAACG,GAAG,CAACC,IAAI,IACjCC,MAAM,CAACC,MAAM,CAACF,IAAI,CAAC,CAChBD,GAAG,CAACI,IAAI,IAAI;IACX,IAAI,CAACA,IAAI,CAACC,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK,EAAE,OAAO,IAAI;IAE3C,oBACE;MAAK,SAAS,EAAC,gBAAgB;MAAC,GAAG,EAAG,GAAER,UAAW,IAAGM,IAAI,CAACC,KAAK,CAACE,WAAW,EAAG;IAAE,gBAC/E;MAAK,SAAS,EAAC;IAAiB,GAAEH,IAAI,CAACC,KAAK,EAAC,IAAE,CAAM,eACrD;MAAK,SAAS,EAAC;IAAiB,GAAED,IAAI,CAACE,KAAK,CAAO,CAC/C;EAEV,CAAC,CAAC,CACDE,MAAM,CAACC,OAAO,CAAC,CACnB;EAED,oBACE;IAAK,SAAS,EAAC,UAAU;IAAC,GAAG,EAAEX;EAAW,gBACxC;IAAK,SAAS,EAAC;EAAqB,GAAEC,YAAY,CAAO,CACrD;AAEV,CAAC;AAED,eAAeH,OAAO;AAEtBA,OAAO,CAACc,SAAS,GAAG;EAClBZ,UAAU,EAAEJ,SAAS,CAACiB,MAAM,CAACC,UAAU;EACvCf,KAAK,EAAEH,SAAS,CAACmB,KAAK,CAACD;AACzB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import InfoBoxContainer from './container/InfoBoxContainer';
|
|
4
|
-
|
|
5
|
-
const InfoBoxes = ({ id, schema }) => {
|
|
6
|
-
const {
|
|
7
|
-
displayProperties: { adminInfoBoxes = [] }
|
|
8
|
-
} = schema;
|
|
9
|
-
|
|
10
|
-
if (adminInfoBoxes.length <= 0) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return adminInfoBoxes.map(infoBox => (
|
|
15
|
-
<InfoBoxContainer id={id} schema={schema} key={infoBox.key} infoBox={infoBox} />
|
|
16
|
-
));
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default InfoBoxes;
|
|
20
|
-
|
|
21
|
-
InfoBoxes.propTypes = {
|
|
22
|
-
id: PropTypes.string.isRequired,
|
|
23
|
-
schema: PropTypes.object.isRequired
|
|
24
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import useData from '../hooks/useData';
|
|
4
|
-
import InfoBox from '../presentational/InfoBox';
|
|
5
|
-
|
|
6
|
-
const InfoBoxContainer = ({ id, schema, infoBox }) => {
|
|
7
|
-
const { data } = useData({ id, schema, infoBox });
|
|
8
|
-
|
|
9
|
-
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
10
|
-
|
|
11
|
-
const items = Object.values(data).flatMap(item => Object.values(item));
|
|
12
|
-
|
|
13
|
-
return <InfoBox items={items} infoBoxKey={infoBox.key} />;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default InfoBoxContainer;
|
|
17
|
-
|
|
18
|
-
InfoBoxContainer.propTypes = {
|
|
19
|
-
id: PropTypes.string.isRequired,
|
|
20
|
-
infoBox: PropTypes.object.isRequired,
|
|
21
|
-
schema: PropTypes.object.isRequired
|
|
22
|
-
};
|