@blaze-cms/plugin-data-ui 0.127.0-project-admin-customisations.3 → 0.127.3

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +2 -34
  2. package/README.md +0 -2
  3. package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
  4. package/lib/components/EntityDataListing/index.js.map +1 -1
  5. package/lib/components/EntityManager/Entity/Entity.js +19 -29
  6. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  7. package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  8. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  9. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
  10. package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
  11. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +6 -12
  12. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  13. package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
  14. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  15. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  16. package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
  17. package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
  18. package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
  19. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  20. package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
  21. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  22. package/lib/components/EntityManager/Entity/index.js.map +1 -1
  23. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  24. package/lib/components/EntityManager/index.js.map +1 -1
  25. package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
  26. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  27. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  28. package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
  29. package/lib/components/EntityManager/utils/query.js.map +1 -1
  30. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  31. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  32. package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
  33. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  34. package/lib/components/ListingTable/TableActions/index.js.map +1 -1
  35. package/lib/components/ListingTable/index.js.map +1 -1
  36. package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
  37. package/lib/components/ListingTable/service/index.js.map +1 -1
  38. package/lib/components/Tabs/index.js.map +1 -1
  39. package/lib/constants.js.map +1 -1
  40. package/lib/index.js.map +1 -1
  41. package/lib/utils/add-content-menu-items.js.map +1 -1
  42. package/lib/utils/build-create-entity-mutation.js.map +1 -1
  43. package/lib/utils/build-delete-entity-mutation.js.map +1 -1
  44. package/lib/utils/build-listing-query.js.map +1 -1
  45. package/lib/utils/build-update-data-query.js.map +1 -1
  46. package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  47. package/lib/utils/get-default-query-params.js.map +1 -1
  48. package/lib/utils/hoc/withContext.js.map +1 -1
  49. package/lib/utils/hooks/useToggle.js.map +1 -1
  50. package/lib/utils/index.js.map +1 -1
  51. package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
  52. package/lib-es/components/EntityManager/Entity/Entity.js +18 -29
  53. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  54. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  55. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  56. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +7 -13
  57. package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  58. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  59. package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  60. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  61. package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  62. package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
  63. package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -1
  64. package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
  65. package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  66. package/lib-es/components/EntityManager/utils/query.js.map +1 -1
  67. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  68. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  69. package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
  70. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  71. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  72. package/lib-es/components/Tabs/index.js.map +1 -1
  73. package/lib-es/index.js.map +1 -1
  74. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  75. package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
  76. package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
  77. package/lib-es/utils/build-listing-query.js.map +1 -1
  78. package/lib-es/utils/build-update-data-query.js.map +1 -1
  79. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  80. package/lib-es/utils/get-default-query-params.js.map +1 -1
  81. package/lib-es/utils/hoc/withContext.js.map +1 -1
  82. package/lib-es/utils/hooks/useToggle.js.map +1 -1
  83. package/package.json +9 -10
  84. package/src/components/EntityManager/Entity/Entity.js +59 -65
  85. package/src/components/EntityManager/Entity/SideBarRelations/index.js +9 -23
  86. package/lib/components/InfoBoxes/InfoBoxes.js +0 -36
  87. package/lib/components/InfoBoxes/InfoBoxes.js.map +0 -1
  88. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +0 -44
  89. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  90. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  91. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  92. package/lib/components/InfoBoxes/hooks/useData.js +0 -42
  93. package/lib/components/InfoBoxes/hooks/useData.js.map +0 -1
  94. package/lib/components/InfoBoxes/hooks/useInfoBox.js +0 -26
  95. package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  96. package/lib/components/InfoBoxes/index.js +0 -12
  97. package/lib/components/InfoBoxes/index.js.map +0 -1
  98. package/lib/components/InfoBoxes/presentational/InfoBox.js +0 -46
  99. package/lib/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  100. package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
  101. package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
  102. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -30
  103. package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
  104. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  105. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
  106. package/lib-es/components/InfoBoxes/hooks/useData.js +0 -37
  107. package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
  108. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -19
  109. package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
  110. package/lib-es/components/InfoBoxes/index.js +0 -3
  111. package/lib-es/components/InfoBoxes/index.js.map +0 -1
  112. package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -31
  113. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
  114. package/src/components/InfoBoxes/InfoBoxes.js +0 -24
  115. package/src/components/InfoBoxes/container/InfoBoxContainer.js +0 -22
  116. package/src/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
  117. package/src/components/InfoBoxes/hooks/useData.js +0 -20
  118. package/src/components/InfoBoxes/hooks/useInfoBox.js +0 -13
  119. package/src/components/InfoBoxes/index.js +0 -3
  120. package/src/components/InfoBoxes/presentational/InfoBox.js +0 -34
@@ -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,
@@ -405,72 +403,68 @@ const Entity = ({
405
403
 
406
404
  return (
407
405
  <div className="page">
408
- <EntityHeader
409
- entityData={entityData}
410
- entityIdentifier={entityIdentifier}
411
- pageTitle={pageTitle}
412
- pageName={pageName}
413
- onSubmit={onSubmit}
414
- handlePublishAndUnpublish={handlePublishAndUnpublish}
415
- isSaveButtonAvailable={isSaveButtonAvailable}
416
- isEnablePublishButton={isEnablePublishButton}
417
- isEnablePreviewButton={isEnablePreviewButton}
418
- toggleCopyModal={setCopyModalStatus}
419
- toggleModal={setModalStatus}
420
- formData={formData}
421
- onViewUrl={onViewUrlHandler}
422
- saveButtonText={saveButtonText}
423
- />
424
- <div className="page-wrapper__content">
425
- <div className="tabs-wrapper tabs-wrapper__tab">
426
- <Prompt when={hasToDisplayPrompt} message={LEAVE_PAGE_MESSAGE} />
427
- {showModal && (
428
- <DeleteAction
429
- onClose={setModalStatus}
430
- deleteAction={onDelete}
431
- itemName={formData.values.name}
432
- />
433
- )}
434
- {copyModalStatus && (
435
- <CopyDataFromAction
436
- onClose={handleCopyDataFromClose}
437
- copyAction={onCopy}
438
- getFormData={getFormData}
439
- />
440
- )}
441
-
442
- <div className="page__content--fixed">
443
- <div className="page__content">
444
- <div className="content">
445
- <RenderHook hookKey={`entity:${action}:main:top`} entity={entity} schema={schema} />
446
- <InfoBoxes id={entity.id} schema={schema} />
447
- <Tabs
448
- enabled={showPageBuilderTabs}
449
- onTabChange={tabId => {
450
- client.writeQuery({
451
- query: GET_CURRENT_TAB_ID,
452
- data: { currentTabId: tabId }
453
- });
454
- setCurrentTabId(tabId);
455
- }}>
456
- <FormBuilder
457
- getIsFormValid={setIsFormValid}
458
- getFormValues={getFormValues}
459
- schema={schema}
460
- data={clonedFormData}
461
- onChange={onChangeFormValues}
462
- shouldCopyData={shouldCopyData}
463
- updateCopyData={updateCopyData}
464
- formValues={formValues}
465
- isNewEntity={isNewEntity}
466
- />
467
- </Tabs>
468
- </div>
406
+ <Prompt when={hasToDisplayPrompt} message={LEAVE_PAGE_MESSAGE} />
407
+ {showModal && (
408
+ <DeleteAction
409
+ onClose={setModalStatus}
410
+ deleteAction={onDelete}
411
+ itemName={formData.values.name}
412
+ />
413
+ )}
414
+ {copyModalStatus && (
415
+ <CopyDataFromAction
416
+ onClose={handleCopyDataFromClose}
417
+ copyAction={onCopy}
418
+ getFormData={getFormData}
419
+ />
420
+ )}
421
+
422
+ <div className="row row--display-row">
423
+ <div className="column column--three-quarters">
424
+ <EntityHeader
425
+ entityData={entityData}
426
+ entityIdentifier={entityIdentifier}
427
+ pageTitle={pageTitle}
428
+ pageName={pageName}
429
+ onSubmit={onSubmit}
430
+ handlePublishAndUnpublish={handlePublishAndUnpublish}
431
+ isSaveButtonAvailable={isSaveButtonAvailable}
432
+ isEnablePublishButton={isEnablePublishButton}
433
+ isEnablePreviewButton={isEnablePreviewButton}
434
+ toggleCopyModal={setCopyModalStatus}
435
+ toggleModal={setModalStatus}
436
+ formData={formData}
437
+ onViewUrl={onViewUrlHandler}
438
+ saveButtonText={saveButtonText}
439
+ />
440
+
441
+ <div className="page__content">
442
+ <div className="content">
443
+ <Tabs
444
+ enabled={showPageBuilderTabs}
445
+ onTabChange={tabId => {
446
+ client.writeQuery({
447
+ query: GET_CURRENT_TAB_ID,
448
+ data: { currentTabId: tabId }
449
+ });
450
+ setCurrentTabId(tabId);
451
+ }}>
452
+ <FormBuilder
453
+ getIsFormValid={setIsFormValid}
454
+ getFormValues={getFormValues}
455
+ schema={schema}
456
+ data={clonedFormData}
457
+ onChange={onChangeFormValues}
458
+ shouldCopyData={shouldCopyData}
459
+ updateCopyData={updateCopyData}
460
+ formValues={formValues}
461
+ isNewEntity={isNewEntity}
462
+ />
463
+ </Tabs>
469
464
  </div>
470
465
  </div>
471
466
  </div>
472
-
473
- <div className="column column--one-third page-sidebar">
467
+ <div className="column column--one-third">
474
468
  {showSideBarRelations && (
475
469
  <SideBarRelations
476
470
  entity={entity}
@@ -4,21 +4,16 @@ import uuidv1 from 'uuid/v1';
4
4
  import { useApolloClient } from '@apollo/client';
5
5
  import { getQuery } from '@blaze-cms/admin-ui-utils';
6
6
  import { formFieldTypes } from '@blaze-cms/react-form-builder';
7
- import classnames from 'classnames';
7
+ import Badge from '@blaze-react/badge';
8
8
  import { VersionsList } from '@blaze-cms/versioning-ui';
9
- import { PUBLISHED, UNPUBLISHED } from '../../../../constants';
9
+ import { PUBLISHED } from '../../../../constants';
10
10
 
11
11
  const SideBarRelations = ({ schema, onChange, formData, entity }) => {
12
12
  const { relation: RelationComponent } = formFieldTypes;
13
- const {
14
- formattedStatus,
15
- formattedUpdated,
16
- formattedCreated,
17
- formattedPublished,
18
- status
19
- } = formData;
13
+ const { formattedStatus, formattedUpdated, formattedCreated, formattedPublished } = formData;
20
14
  const client = useApolloClient();
21
15
  const [relationsComponents, setRelationsComponents] = useState(null);
16
+
22
17
  useEffect(
23
18
  () => {
24
19
  (async () => {
@@ -56,26 +51,17 @@ const SideBarRelations = ({ schema, onChange, formData, entity }) => {
56
51
  const { id: itemId } = entity;
57
52
  const { identifier: itemEntity, interfaces } = schema;
58
53
 
59
- const statusClassName = classnames('sidebar__status__badge', {
60
- 'sidebar__status__badge--published': status === PUBLISHED,
61
- 'sidebar__status__badge--unpublished': status === UNPUBLISHED
62
- });
63
-
64
54
  return (
65
55
  <div className="sidebar" data-testid="sideBarRelations-main-div">
66
56
  <div className="sidebar__content">
67
57
  {formattedCreated && (
68
58
  <div className="sidebar__status">
69
- <div className="sidebar__status__wrapper">
70
- <b>Status</b>
71
- <span className={statusClassName}>{formattedStatus}</span>
72
- </div>
73
- {formattedStatus === PUBLISHED && (
74
- <p>
75
- {formattedStatus} on: <span> {formattedPublished}</span>
76
- </p>
59
+ {formattedStatus && (
60
+ <Badge type="status" modifiers={formattedStatus}>
61
+ {formattedStatus}
62
+ {formattedStatus === PUBLISHED && `: ${formattedPublished}`}
63
+ </Badge>
77
64
  )}
78
-
79
65
  <p>
80
66
  Created: <span>{formattedCreated}</span>
81
67
  </p>
@@ -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"}