@blaze-cms/plugin-data-ui 0.146.0-tooltips.8 → 0.146.0-tooltips.9
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 +11 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +9 -2
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxTooltip.js +40 -0
- package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +4 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +3 -0
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +8 -2
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +4 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js +3 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/package.json +3 -2
- package/src/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +2 -0
- package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +5 -3
- package/src/components/InfoBoxes/InfoBoxTooltip.js +32 -0
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +2 -0
- package/src/components/InfoBoxes/presentational/InfoBox.js +4 -2
- package/src/components/ListingTable/mappers/populate-rows.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.146.0-tooltips.9](https://github.com/thebyte9/blaze/compare/v0.146.0-tooltips.8...v0.146.0-tooltips.9) (2025-04-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update info box properties to support tooltips ([#4701](https://github.com/thebyte9/blaze/issues/4701)) ([08ed041](https://github.com/thebyte9/blaze/commit/08ed041c9432f02e82e4846974cda65ae6c15a26))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.146.0-tooltips.8](https://github.com/thebyte9/blaze/compare/v0.146.0-tooltips.7...v0.146.0-tooltips.8) (2025-03-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @blaze-cms/plugin-data-ui
|
|
@@ -21,7 +21,7 @@ function buildDynamicQuery(_ref) {
|
|
|
21
21
|
}
|
|
22
22
|
if (displayProperties.adminMainInfoProperty && Array.isArray(displayProperties.adminMainInfoProperty)) {
|
|
23
23
|
var fields = displayProperties.adminMainInfoProperty.map(function (infoProperty) {
|
|
24
|
-
return "".concat(infoProperty, " {\n label\n value\n showLabel\n }");
|
|
24
|
+
return "".concat(infoProperty, " {\n label\n value\n showLabel\n tooltipIcon\n tooltipContent\n }");
|
|
25
25
|
});
|
|
26
26
|
return (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.map(function (field) {
|
|
27
27
|
return field;
|
package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["_client","require","_coreErrors","_templateObject","buildDynamicQuery","_ref","id","schema","displayProperties","actions","get","properties","BlazeError","adminMainInfoProperty","Array","isArray","fields","map","infoProperty","concat","gql","_taggedTemplateLiteral2","field"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/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, displayProperties }) {\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 if (\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ) {\n const fields = displayProperties.adminMainInfoProperty.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAoD,IAAAE,eAAA;AAErC,SAASC,iBAAiBA,CAAAC,IAAA,EAAoC;EAAA,IAAjCC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,iBAAiB,GAAAH,IAAA,CAAjBG,iBAAiB;EACvE,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,gFACF,CAAC;EACH;EAEA,IACEJ,iBAAiB,CAACK,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACP,iBAAiB,CAACK,qBAAqB,CAAC,EACtD;IACA,IAAMG,MAAM,GAAGR,iBAAiB,CAACK,qBAAqB,CAACI,GAAG,CACxD,UAAAC,YAAY;MAAA,UAAAC,MAAA,CACPD,YAAY;IAAA,
|
|
1
|
+
{"version":3,"file":"build-dynamic-query.js","names":["_client","require","_coreErrors","_templateObject","buildDynamicQuery","_ref","id","schema","displayProperties","actions","get","properties","BlazeError","adminMainInfoProperty","Array","isArray","fields","map","infoProperty","concat","gql","_taggedTemplateLiteral2","field"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/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, displayProperties }) {\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 if (\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ) {\n const fields = displayProperties.adminMainInfoProperty.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n tooltipIcon\n tooltipContent\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n }\n\n return null;\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAoD,IAAAE,eAAA;AAErC,SAASC,iBAAiBA,CAAAC,IAAA,EAAoC;EAAA,IAAjCC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,iBAAiB,GAAAH,IAAA,CAAjBG,iBAAiB;EACvE,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,gFACF,CAAC;EACH;EAEA,IACEJ,iBAAiB,CAACK,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACP,iBAAiB,CAACK,qBAAqB,CAAC,EACtD;IACA,IAAMG,MAAM,GAAGR,iBAAiB,CAACK,qBAAqB,CAACI,GAAG,CACxD,UAAAC,YAAY;MAAA,UAAAC,MAAA,CACPD,YAAY;IAAA,CAOnB,CAAC;IAED,WAAOE,WAAG,EAAAjB,eAAA,KAAAA,eAAA,OAAAkB,uBAAA,6IACNd,MAAM,CAACE,OAAO,CAACC,GAAG,EAEjBM,MAAM,CAACC,GAAG,CAAC,UAAAK,KAAK;MAAA,OAAIA,KAAK;IAAA,EAAC;EAIjC;EAEA,OAAO,IAAI;AACb"}
|
package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js
CHANGED
|
@@ -10,10 +10,12 @@ require("core-js/modules/es.array.map.js");
|
|
|
10
10
|
require("core-js/modules/es.array.filter.js");
|
|
11
11
|
require("core-js/modules/es.object.to-string.js");
|
|
12
12
|
require("core-js/modules/es.object.values.js");
|
|
13
|
+
require("core-js/modules/es.array.concat.js");
|
|
13
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
15
|
var _react = _interopRequireDefault(require("react"));
|
|
15
16
|
var _InfoBoxValue = _interopRequireDefault(require("../../../../InfoBoxes/presentational/InfoBoxValue"));
|
|
16
17
|
var _InfoBoxLabel = _interopRequireDefault(require("../../../../InfoBoxes/presentational/InfoBoxLabel"));
|
|
18
|
+
var _InfoBoxTooltip = _interopRequireDefault(require("../../../../InfoBoxes/InfoBoxTooltip"));
|
|
17
19
|
var CustomSidebarInfo = function CustomSidebarInfo(_ref) {
|
|
18
20
|
var items = _ref.items,
|
|
19
21
|
customSidebarInfoKey = _ref.customSidebarInfoKey;
|
|
@@ -21,10 +23,15 @@ var CustomSidebarInfo = function CustomSidebarInfo(_ref) {
|
|
|
21
23
|
var customSidebarInfoItems = items.map(function (item) {
|
|
22
24
|
return Object.values(item).map(function (info) {
|
|
23
25
|
if (!info.label || !info.value) return null;
|
|
24
|
-
return /*#__PURE__*/_react["default"].createElement("p",
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement("p", {
|
|
27
|
+
key: "".concat(customSidebarInfoKey, "-").concat(info.label.toLowerCase())
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_InfoBoxLabel["default"], {
|
|
25
29
|
item: info
|
|
26
30
|
}), /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_InfoBoxValue["default"], {
|
|
27
31
|
item: info
|
|
32
|
+
}), /*#__PURE__*/_react["default"].createElement(_InfoBoxTooltip["default"], {
|
|
33
|
+
info: info,
|
|
34
|
+
position: "left"
|
|
28
35
|
})));
|
|
29
36
|
}).filter(Boolean);
|
|
30
37
|
});
|
|
@@ -35,9 +42,9 @@ var CustomSidebarInfo = function CustomSidebarInfo(_ref) {
|
|
|
35
42
|
className: "custom-sidebar-info--container"
|
|
36
43
|
}, customSidebarInfoItems));
|
|
37
44
|
};
|
|
38
|
-
var _default = exports["default"] = CustomSidebarInfo;
|
|
39
45
|
CustomSidebarInfo.propTypes = {
|
|
40
46
|
customSidebarInfoKey: _propTypes["default"].string.isRequired,
|
|
41
47
|
items: _propTypes["default"].array.isRequired
|
|
42
48
|
};
|
|
49
|
+
var _default = exports["default"] = CustomSidebarInfo;
|
|
43
50
|
//# sourceMappingURL=CustomSidebarInfo.js.map
|
package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomSidebarInfo.js","names":["_propTypes","_interopRequireDefault","require","_react","_InfoBoxValue","_InfoBoxLabel","CustomSidebarInfo","_ref","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","
|
|
1
|
+
{"version":3,"file":"CustomSidebarInfo.js","names":["_propTypes","_interopRequireDefault","require","_react","_InfoBoxValue","_InfoBoxLabel","_InfoBoxTooltip","CustomSidebarInfo","_ref","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","key","concat","toLowerCase","position","filter","Boolean","className","propTypes","PropTypes","string","isRequired","array","_default","exports"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';\nimport InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';\nimport InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';\n\nconst CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {\n if (!items) return null;\n\n const customSidebarInfoItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <p key={`${customSidebarInfoKey}-${info.label.toLowerCase()}`}>\n <InfoBoxLabel item={info} />\n <span>\n <InfoBoxValue item={info} />\n <InfoBoxTooltip info={info} position=\"left\" />\n </span>\n </p>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"custom-sidebar-info\" key={customSidebarInfoKey}>\n <div className=\"custom-sidebar-info--container\">{customSidebarInfoItems}</div>\n </div>\n );\n};\n\nCustomSidebarInfo.propTypes = {\n customSidebarInfoKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n\nexport default CustomS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AC;EAED,oBACEtB,MAAA,YAAAgB,aAAA;IAAKO,SAAS,EAAC,qBAAqB;IAACN,GAAG,EAAEV;EAAqB,gBAC7DP,MAAA,YAAAgB,aAAA;IAAKO,SAAS,EAAC;EAAgC,GAAEf,sBAA4B,CAC1E,CAAC;AAEV,CAAC;AAEDJ,iBAAiB,CAACoB,SAAS,GAAG;EAC5BjB,oBAAoB,EAAEkB,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjDrB,KAAK,EAAEmB,qBAAS,CAACG,KAAK,CAACD;AACzB,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEa1B,iBAAiB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _tooltip = _interopRequireDefault(require("@blaze-react/tooltip"));
|
|
14
|
+
var _excluded = ["info"];
|
|
15
|
+
var InfoBoxTooltip = function InfoBoxTooltip(_ref) {
|
|
16
|
+
var info = _ref.info,
|
|
17
|
+
tooltipProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
18
|
+
var tooltipContent = info.tooltipContent,
|
|
19
|
+
tooltipIcon = info.tooltipIcon;
|
|
20
|
+
if (!tooltipContent) return null;
|
|
21
|
+
var renderTooltipIcon = function renderTooltipIcon(icon) {
|
|
22
|
+
if (!icon) return null;
|
|
23
|
+
return /*#__PURE__*/_react["default"].createElement("i", {
|
|
24
|
+
className: "".concat(icon, " info-box--icon")
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_tooltip["default"], (0, _extends2["default"])({
|
|
28
|
+
tooltipContent: tooltipContent,
|
|
29
|
+
trigger: "click",
|
|
30
|
+
className: "info-box--tooltip"
|
|
31
|
+
}, tooltipProps), renderTooltipIcon(tooltipIcon));
|
|
32
|
+
};
|
|
33
|
+
InfoBoxTooltip.propTypes = {
|
|
34
|
+
info: _propTypes["default"].shape({
|
|
35
|
+
tooltipContent: _propTypes["default"].node,
|
|
36
|
+
tooltipIcon: _propTypes["default"].string
|
|
37
|
+
}).isRequired
|
|
38
|
+
};
|
|
39
|
+
var _default = exports["default"] = InfoBoxTooltip;
|
|
40
|
+
//# sourceMappingURL=InfoBoxTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxTooltip.js","names":["_react","_interopRequireDefault","require","_propTypes","_tooltip","_excluded","InfoBoxTooltip","_ref","info","tooltipProps","_objectWithoutProperties2","tooltipContent","tooltipIcon","renderTooltipIcon","icon","createElement","className","concat","_extends2","trigger","propTypes","PropTypes","shape","node","string","isRequired","_default","exports"],"sources":["../../../src/components/InfoBoxes/InfoBoxTooltip.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tooltip from '@blaze-react/tooltip';\n\nconst InfoBoxTooltip = ({ info, ...tooltipProps }) => {\n const { tooltipContent, tooltipIcon } = info;\n if (!tooltipContent) return null;\n\n const renderTooltipIcon = icon => {\n if (!icon) return null;\n return <i className={`${icon} info-box--icon`} />;\n };\n\n return (\n <Tooltip\n tooltipContent={tooltipContent}\n trigger=\"click\"\n className=\"info-box--tooltip\"\n {...tooltipProps}>\n {renderTooltipIcon(tooltipIcon)}\n </Tooltip>\n );\n};\n\nInfoBoxTooltip.propTypes = {\n info: PropTypes.shape({\n tooltipContent: PropTypes.node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|
20
20
|
throw new _coreErrors.BlazeError('DataEntity query requires get action, properties and fields from entity schema');
|
|
21
21
|
}
|
|
22
22
|
var fields = properties.map(function (infoProperty) {
|
|
23
|
-
return "".concat(infoProperty, " {\n label\n value\n showLabel\n url\n }");
|
|
23
|
+
return "".concat(infoProperty, " {\n label\n value\n showLabel\n url\n tooltipIcon\n tooltipContent\n }");
|
|
24
24
|
});
|
|
25
25
|
return (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.map(function (field) {
|
|
26
26
|
return field;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["_client","require","_coreErrors","_templateObject","buildDynamicQuery","_ref","id","schema","properties","actions","get","BlazeError","fields","map","infoProperty","concat","gql","_taggedTemplateLiteral2","field"],"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, properties }) {\n if (!id) return null;\n\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 = properties.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n url\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAoD,IAAAE,eAAA;AAErC,SAASC,iBAAiBA,CAAAC,IAAA,EAA6B;EAAA,IAA1BC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;EAChE,IAAI,CAACF,EAAE,EAAE,OAAO,IAAI;EAEpB,IAAI,CAACC,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACC,UAAU,EAAE;IAC3E,MAAM,IAAIG,sBAAU,CAClB,gFACF,CAAC;EACH;EAEA,IAAMC,MAAM,GAAGJ,UAAU,CAACK,GAAG,CAC3B,UAAAC,YAAY;IAAA,UAAAC,MAAA,CACPD,YAAY;EAAA,
|
|
1
|
+
{"version":3,"file":"build-dynamic-query.js","names":["_client","require","_coreErrors","_templateObject","buildDynamicQuery","_ref","id","schema","properties","actions","get","BlazeError","fields","map","infoProperty","concat","gql","_taggedTemplateLiteral2","field"],"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, properties }) {\n if (!id) return null;\n\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 = properties.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n url\n tooltipIcon\n tooltipContent\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAoD,IAAAE,eAAA;AAErC,SAASC,iBAAiBA,CAAAC,IAAA,EAA6B;EAAA,IAA1BC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;EAChE,IAAI,CAACF,EAAE,EAAE,OAAO,IAAI;EAEpB,IAAI,CAACC,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACC,UAAU,EAAE;IAC3E,MAAM,IAAIG,sBAAU,CAClB,gFACF,CAAC;EACH;EAEA,IAAMC,MAAM,GAAGJ,UAAU,CAACK,GAAG,CAC3B,UAAAC,YAAY;IAAA,UAAAC,MAAA,CACPD,YAAY;EAAA,CAQnB,CAAC;EAED,WAAOE,WAAG,EAAAb,eAAA,KAAAA,eAAA,OAAAc,uBAAA,kIACNV,MAAM,CAACE,OAAO,CAACC,GAAG,EAEhBE,MAAM,CAACC,GAAG,CAAC,UAAAK,KAAK;IAAA,OAAIA,KAAK;EAAA,EAAC;AAIlC"}
|
|
@@ -15,6 +15,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _InfoBoxValue = _interopRequireDefault(require("./InfoBoxValue"));
|
|
17
17
|
var _InfoBoxLabel = _interopRequireDefault(require("./InfoBoxLabel"));
|
|
18
|
+
var _InfoBoxTooltip = _interopRequireDefault(require("../InfoBoxTooltip"));
|
|
18
19
|
var InfoBox = function InfoBox(_ref) {
|
|
19
20
|
var items = _ref.items,
|
|
20
21
|
infoBoxKey = _ref.infoBoxKey;
|
|
@@ -33,6 +34,8 @@ var InfoBox = function InfoBox(_ref) {
|
|
|
33
34
|
className: "info-box--value"
|
|
34
35
|
}, /*#__PURE__*/_react["default"].createElement(_InfoBoxValue["default"], {
|
|
35
36
|
item: info
|
|
37
|
+
}), /*#__PURE__*/_react["default"].createElement(_InfoBoxTooltip["default"], {
|
|
38
|
+
info: info
|
|
36
39
|
})));
|
|
37
40
|
}).filter(Boolean);
|
|
38
41
|
});
|
|
@@ -43,9 +46,9 @@ var InfoBox = function InfoBox(_ref) {
|
|
|
43
46
|
className: "info-box--container"
|
|
44
47
|
}, infoBoxItems));
|
|
45
48
|
};
|
|
46
|
-
var _default = exports["default"] = InfoBox;
|
|
47
49
|
InfoBox.propTypes = {
|
|
48
50
|
infoBoxKey: _propTypes["default"].string.isRequired,
|
|
49
51
|
items: _propTypes["default"].array.isRequired
|
|
50
52
|
};
|
|
53
|
+
var _default = exports["default"] = InfoBox;
|
|
51
54
|
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBox.js","names":["_propTypes","_interopRequireDefault","require","_react","_InfoBoxValue","_InfoBoxLabel","InfoBox","_ref","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","createElement","className","key","concat","toLowerCase","filter","Boolean","
|
|
1
|
+
{"version":3,"file":"InfoBox.js","names":["_propTypes","_interopRequireDefault","require","_react","_InfoBoxValue","_InfoBoxLabel","_InfoBoxTooltip","InfoBox","_ref","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","createElement","className","key","concat","toLowerCase","filter","Boolean","propTypes","PropTypes","string","isRequired","array","_default","exports"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxValue from './InfoBoxValue';\nimport InfoBoxLabel from './InfoBoxLabel';\nimport InfoBoxTooltip from '../InfoBoxTooltip';\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\">\n <InfoBoxLabel item={info} />\n </div>\n <div className=\"info-box--value\">\n <InfoBoxValue item={info} />\n <InfoBoxTooltip info={info} />\n </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\nInfoBox.propTypes = {\n infoBo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AACb,eAAA,WAAc;QAACU,IAAI,EAAEA;MAAK,CAAE,CAC1B,CACF,CAAC;IAEV,CAAC,CAAC,CACDQ,MAAM,CAACC,OAAO,CAAC;EAAA,CACpB,CAAC;EAED,oBACEtB,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAC,UAAU;IAACC,GAAG,EAAEX;EAAW,gBACxCP,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAC;EAAqB,GAAET,YAAkB,CACrD,CAAC;AAEV,CAAC;AAEDJ,OAAO,CAACmB,SAAS,GAAG;EAClBhB,UAAU,EAAEiB,qBAAS,CAACC,MAAM,CAACC,UAAU;EACvCpB,KAAK,EAAEkB,qBAAS,CAACG,KAAK,CAACD;AACzB,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEazB,OAAO"}
|
|
@@ -32,6 +32,7 @@ var _TableActions = _interopRequireDefault(require("../TableActions"));
|
|
|
32
32
|
var _constants = require("../../../constants");
|
|
33
33
|
var _InfoBoxValue = _interopRequireDefault(require("../../InfoBoxes/presentational/InfoBoxValue"));
|
|
34
34
|
var _InfoBoxLabel = _interopRequireDefault(require("../../InfoBoxes/presentational/InfoBoxLabel"));
|
|
35
|
+
var _InfoBoxTooltip = _interopRequireDefault(require("../../InfoBoxes/InfoBoxTooltip"));
|
|
35
36
|
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; }
|
|
36
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["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; }
|
|
37
38
|
var formatRows = exports.formatRows = function formatRows(_ref) {
|
|
@@ -88,6 +89,8 @@ var buildArrayRowContent = function buildArrayRowContent(rowData) {
|
|
|
88
89
|
className: "table-row-list__group__item__value"
|
|
89
90
|
}, /*#__PURE__*/_react["default"].createElement(_InfoBoxValue["default"], {
|
|
90
91
|
item: item
|
|
92
|
+
}), /*#__PURE__*/_react["default"].createElement(_InfoBoxTooltip["default"], {
|
|
93
|
+
info: item
|
|
91
94
|
})));
|
|
92
95
|
}));
|
|
93
96
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate-rows.js","names":["_react","_interopRequireDefault","require","_reactRouterDom","_pluginRenderHooksUi","_TableActions","_constants","_InfoBoxValue","_InfoBoxLabel","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","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';\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 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 </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;AAAuE,SAAAO,QAAAC,CAAA,EAAAC,CAAA,QAAAC,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SAAAD,mBAAA,aAAQlB,iBAAiB,CAAC;EAE3F,IAAMC,aAAa,GAAAlE,aAAA,CAAAA,aAAA,KAAQ8E,UAAU,GAAKE,iBAAiB,CAAE;EAC7D,IAAAK,oBAAA,GAA2CrB,mBAAmB,CAC5DkB,aAAa,EACbhB,aAAa,EACbvD,IACF,CAAC;IAJOwD,OAAO,GAAAkB,oBAAA,CAAPlB,OAAO;IAAEC,MAAM,GAAAiB,oBAAA,CAANjB,MAAM;IAAEM,aAAa,GAAAW,oBAAA,CAAbX,aAAa;EAKtC,IAAAY,QAAA,OAAAC,eAAA,aAAsBpB,OAAO;IAAtBnD,WAAW,GAAAsE,QAAA;EAElB,OAAO;IACLE,cAAc,EAAE,IAAI;IACpBC,IAAI,EAAE,IAAI;IACVtB,OAAO,EAAPA,OAAO;IACPC,MAAM,EAANA,MAAM;IACNsB,OAAO,MAAAP,mBAAA,aAAMF,cAAc,CAAC;IAC5BtE,IAAI,EAAEH,UAAU,CAAC;MACfQ,WAAW,EAAXA,WAAW;MACXL,IAAI,EAAE+D,aAAa;MACnB9D,GAAG,EAAHA,GAAG;MACHC,WAAW,EAAXA,WAAW;MACXI,SAAS,EAATA,SAAS;MACTC,YAAY,EAAZA;IACF,CAAC,CAAC;IACFD,SAAS,EAATA;EACF,CAAC;AACH,CAAC"}
|
|
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\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,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,aAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,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Ac,CAAC;IAC5BvE,IAAI,EAAEH,UAAU,CAAC;MACfQ,WAAW,EAAXA,WAAW;MACXL,IAAI,EAAEgE,aAAa;MACnB/D,GAAG,EAAHA,GAAG;MACHC,WAAW,EAAXA,WAAW;MACXI,SAAS,EAATA,SAAS;MACTC,YAAY,EAAZA;IACF,CAAC,CAAC;IACFD,SAAS,EAATA;EACF,CAAC;AACH,CAAC"}
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","displayProperties","actions","get","properties","adminMainInfoProperty","Array","isArray","fields","map","infoProperty","field"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/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, displayProperties }) {\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 if (\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ) {\n const fields = displayProperties.adminMainInfoProperty.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n }\n\n return null;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAE;EAC3E,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,gFACF,CAAC;EACH;EAEA,IACEI,iBAAiB,CAACI,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACN,iBAAiB,CAACI,qBAAqB,CAAC,EACtD;IACA,MAAMG,MAAM,GAAGP,iBAAiB,CAACI,qBAAqB,CAACI,GAAG,CACxDC,YAAY,IACT,GAAEA,YAAa;AACxB;AACA;AACA;AACA,QACI,CAAC;IAED,OAAOd,GAAI;AACf,QAAQI,MAAM,CAACE,OAAO,CAACC,GAAI;AAC3B;AACA,SAASK,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAE;AACpC;AACA;AACA,MAAM;EACJ;EAEA,OAAO,IAAI;AACb"}
|
|
1
|
+
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","displayProperties","actions","get","properties","adminMainInfoProperty","Array","isArray","fields","map","infoProperty","field"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/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, displayProperties }) {\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 if (\n displayProperties.adminMainInfoProperty &&\n Array.isArray(displayProperties.adminMainInfoProperty)\n ) {\n const fields = displayProperties.adminMainInfoProperty.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n tooltipIcon\n tooltipContent\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n }\n\n return null;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAE;EAC3E,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,gFACF,CAAC;EACH;EAEA,IACEI,iBAAiB,CAACI,qBAAqB,IACvCC,KAAK,CAACC,OAAO,CAACN,iBAAiB,CAACI,qBAAqB,CAAC,EACtD;IACA,MAAMG,MAAM,GAAGP,iBAAiB,CAACI,qBAAqB,CAACI,GAAG,CACxDC,YAAY,IACT,GAAEA,YAAa;AACxB;AACA;AACA;AACA;AACA;AACA,QACI,CAAC;IAED,OAAOd,GAAI;AACf,QAAQI,MAAM,CAACE,OAAO,CAACC,GAAI;AAC3B;AACA,SAASK,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAE;AACpC;AACA;AACA,MAAM;EACJ;EAEA,OAAO,IAAI;AACb"}
|
package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js
CHANGED
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';
|
|
4
4
|
import InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';
|
|
5
6
|
const CustomSidebarInfo = ({
|
|
6
7
|
items,
|
|
7
8
|
customSidebarInfoKey
|
|
@@ -9,10 +10,15 @@ const CustomSidebarInfo = ({
|
|
|
9
10
|
if (!items) return null;
|
|
10
11
|
const customSidebarInfoItems = items.map(item => Object.values(item).map(info => {
|
|
11
12
|
if (!info.label || !info.value) return null;
|
|
12
|
-
return /*#__PURE__*/React.createElement("p",
|
|
13
|
+
return /*#__PURE__*/React.createElement("p", {
|
|
14
|
+
key: `${customSidebarInfoKey}-${info.label.toLowerCase()}`
|
|
15
|
+
}, /*#__PURE__*/React.createElement(InfoBoxLabel, {
|
|
13
16
|
item: info
|
|
14
17
|
}), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
15
18
|
item: info
|
|
19
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
20
|
+
info: info,
|
|
21
|
+
position: "left"
|
|
16
22
|
})));
|
|
17
23
|
}).filter(Boolean));
|
|
18
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -22,9 +28,9 @@ const CustomSidebarInfo = ({
|
|
|
22
28
|
className: "custom-sidebar-info--container"
|
|
23
29
|
}, customSidebarInfoItems));
|
|
24
30
|
};
|
|
25
|
-
export default CustomSidebarInfo;
|
|
26
31
|
CustomSidebarInfo.propTypes = {
|
|
27
32
|
customSidebarInfoKey: PropTypes.string.isRequired,
|
|
28
33
|
items: PropTypes.array.isRequired
|
|
29
34
|
};
|
|
35
|
+
export default CustomSidebarInfo;
|
|
30
36
|
//# sourceMappingURL=CustomSidebarInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomSidebarInfo.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","CustomSidebarInfo","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","filter","Boolean","className","
|
|
1
|
+
{"version":3,"file":"CustomSidebarInfo.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","InfoBoxTooltip","CustomSidebarInfo","items","customSidebarInfoKey","customSidebarInfoItems","map","item","Object","values","info","label","value","createElement","key","toLowerCase","position","filter","Boolean","className","propTypes","string","isRequired","array"],"sources":["../../../../../../src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';\nimport InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';\nimport InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';\n\nconst CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {\n if (!items) return null;\n\n const customSidebarInfoItems = items.map(item =>\n Object.values(item)\n .map(info => {\n if (!info.label || !info.value) return null;\n\n return (\n <p key={`${customSidebarInfoKey}-${info.label.toLowerCase()}`}>\n <InfoBoxLabel item={info} />\n <span>\n <InfoBoxValue item={info} />\n <InfoBoxTooltip info={info} position=\"left\" />\n </span>\n </p>\n );\n })\n .filter(Boolean)\n );\n\n return (\n <div className=\"custom-sidebar-info\" key={customSidebarInfoKey}>\n <div className=\"custom-sidebar-info--container\">{customSidebarInfoItems}</div>\n </div>\n );\n};\n\nCustomSidebarInfo.propTypes = {\n customSidebarInfoKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n\nexport default CustomSidebarInfo;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,mDAAmD;AAC5E,OAAOC,YAAY,MAAM,mDAAmD;AAC5E,OAAOC,cAAc,MAAM,sCAAsC;AAEjE,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAqB,CAAC,KAAK;EAC7D,IAAI,CAACD,KAAK,EAAE,OAAO,IAAI;EAEvB,MAAME,sBAAsB,GAAGF,KAAK,CAACG,GAAG,CAACC,IAAI,IAC3CC,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,oBACEd,KAAA,CAAAe,aAAA;MAAGC,GAAG,EAAG,GAAEV,oBAAqB,IAAGM,IAAI,CAACC,KAAK,CAACI,WAAW,CAAC,CAAE;IAAE,gBAC5DjB,KAAA,CAAAe,aAAA,CAACb,YAAY;MAACO,IAAI,EAAEG;IAAK,CAAE,CAAC,eAC5BZ,KAAA,CAAAe,aAAA,4BACEf,KAAA,CAAAe,aAAA,CAACd,YAAY;MAACQ,IAAI,EAAEG;IAAK,CAAE,CAAC,eAC5BZ,KAAA,CAAAe,aAAA,CAACZ,cAAc;MAACS,IAAI,EAAEA,IAAK;MAACM,QAAQ,EAAC;IAAM,CAAE,CACzC,CACL,CAAC;EAER,CAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEpB,KAAA,CAAAe,aAAA;IAAKM,SAAS,EAAC,qBAAqB;IAACL,GAAG,EAAEV;EAAqB,gBAC7DN,KAAA,CAAAe,aAAA;IAAKM,SAAS,EAAC;EAAgC,GAAEd,sBAA4B,CAC1E,CAAC;AAEV,CAAC;AAEDH,iBAAiB,CAACkB,SAAS,GAAG;EAC5BhB,oBAAoB,EAAEP,SAAS,CAACwB,MAAM,CAACC,UAAU;EACjDnB,KAAK,EAAEN,SAAS,CAAC0B,KAAK,CAACD;AACzB,CAAC;AAED,eAAepB,iBAAiB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["info"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Tooltip from '@blaze-react/tooltip';
|
|
7
|
+
const InfoBoxTooltip = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
info
|
|
10
|
+
} = _ref,
|
|
11
|
+
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
const {
|
|
13
|
+
tooltipContent,
|
|
14
|
+
tooltipIcon
|
|
15
|
+
} = info;
|
|
16
|
+
if (!tooltipContent) return null;
|
|
17
|
+
const renderTooltipIcon = icon => {
|
|
18
|
+
if (!icon) return null;
|
|
19
|
+
return /*#__PURE__*/React.createElement("i", {
|
|
20
|
+
className: `${icon} info-box--icon`
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
24
|
+
tooltipContent: tooltipContent,
|
|
25
|
+
trigger: "click",
|
|
26
|
+
className: "info-box--tooltip"
|
|
27
|
+
}, tooltipProps), renderTooltipIcon(tooltipIcon));
|
|
28
|
+
};
|
|
29
|
+
InfoBoxTooltip.propTypes = {
|
|
30
|
+
info: PropTypes.shape({
|
|
31
|
+
tooltipContent: PropTypes.node,
|
|
32
|
+
tooltipIcon: PropTypes.string
|
|
33
|
+
}).isRequired
|
|
34
|
+
};
|
|
35
|
+
export default InfoBoxTooltip;
|
|
36
|
+
//# sourceMappingURL=InfoBoxTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoBoxTooltip.js","names":["React","PropTypes","Tooltip","InfoBoxTooltip","_ref","info","tooltipProps","_objectWithoutProperties","_excluded","tooltipContent","tooltipIcon","renderTooltipIcon","icon","createElement","className","_extends","trigger","propTypes","shape","node","string","isRequired"],"sources":["../../../src/components/InfoBoxes/InfoBoxTooltip.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tooltip from '@blaze-react/tooltip';\n\nconst InfoBoxTooltip = ({ info, ...tooltipProps }) => {\n const { tooltipContent, tooltipIcon } = info;\n if (!tooltipContent) return null;\n\n const renderTooltipIcon = icon => {\n if (!icon) return null;\n return <i className={`${icon} info-box--icon`} />;\n };\n\n return (\n <Tooltip\n tooltipContent={tooltipContent}\n trigger=\"click\"\n className=\"info-box--tooltip\"\n {...tooltipProps}>\n {renderTooltipIcon(tooltipIcon)}\n </Tooltip>\n );\n};\n\nInfoBoxTooltip.propTypes = {\n info: PropTypes.shape({\n tooltipContent: PropTypes.node,\n tooltipIcon: PropTypes.string\n }).isRequired\n};\n\nexport default InfoBoxTooltip;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,sBAAsB;AAE1C,MAAMC,cAAc,GAAGC,IAAA,IAA+B;EAAA,IAA9B;MAAEC;IAAsB,CAAC,GAAAD,IAAA;IAAdE,YAAY,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAC7C,MAAM;IAAEC,cAAc;IAAEC;EAAY,CAAC,GAAGL,IAAI;EAC5C,IAAI,CAACI,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,iBAAiB,GAAGC,IAAI,IAAI;IAChC,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;IACtB,oBAAOZ,KAAA,CAAAa,aAAA;MAAGC,SAAS,EAAG,GAAEF,IAAK;IAAiB,CAAE,CAAC;EACnD,CAAC;EAED,oBACEZ,KAAA,CAAAa,aAAA,CAACX,OAAO,EAAAa,QAAA;IACNN,cAAc,EAAEA,cAAe;IAC/BO,OAAO,EAAC,OAAO;IACfF,SAAS,EAAC;EAAmB,GACzBR,YAAY,GACfK,iBAAiB,CAACD,WAAW,CACvB,CAAC;AAEd,CAAC;AAEDP,cAAc,CAACc,SAAS,GAAG;EACzBZ,IAAI,EAAEJ,SAAS,CAACiB,KAAK,CAAC;IACpBT,cAAc,EAAER,SAAS,CAACkB,IAAI;IAC9BT,WAAW,EAAET,SAAS,CAACmB;EACzB,CAAC,CAAC,CAACC;AACL,CAAC;AAED,eAAelB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","properties","actions","get","fields","map","infoProperty","field"],"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, properties }) {\n if (!id) return null;\n\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 = properties.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n url\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAW,CAAC,EAAE;EACpE,IAAI,CAACF,EAAE,EAAE,OAAO,IAAI;EAEpB,IAAI,CAACC,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACC,UAAU,EAAE;IAC3E,MAAM,IAAIJ,UAAU,CAClB,gFACF,CAAC;EACH;EAEA,MAAMO,MAAM,GAAGH,UAAU,CAACI,GAAG,CAC3BC,YAAY,IACT,GAAEA,YAAa;AACtB;AACA;AACA;AACA;AACA,MACE,CAAC;EAED,OAAOV,GAAI;AACb,MAAMI,MAAM,CAACE,OAAO,CAACC,GAAI;AACzB;AACA,QAAQC,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAE;AACnC;AACA;AACA,IAAI;AACJ"}
|
|
1
|
+
{"version":3,"file":"build-dynamic-query.js","names":["gql","BlazeError","buildDynamicQuery","id","schema","properties","actions","get","fields","map","infoProperty","field"],"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, properties }) {\n if (!id) return null;\n\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 = properties.map(\n infoProperty =>\n `${infoProperty} {\n label\n value\n showLabel\n url\n tooltipIcon\n tooltipContent\n }`\n );\n\n return gql`query getInfoBoxData($id: String!){\n ${schema.actions.get}( id: $id ) {\n id\n ${fields.map(field => field)}\n __typename\n }\n }`;\n}\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,eAAe,SAASC,iBAAiBA,CAAC;EAAEC,EAAE;EAAEC,MAAM;EAAEC;AAAW,CAAC,EAAE;EACpE,IAAI,CAACF,EAAE,EAAE,OAAO,IAAI;EAEpB,IAAI,CAACC,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,IAAI,CAACF,MAAM,CAACE,OAAO,CAACC,GAAG,IAAI,CAACH,MAAM,CAACC,UAAU,EAAE;IAC3E,MAAM,IAAIJ,UAAU,CAClB,gFACF,CAAC;EACH;EAEA,MAAMO,MAAM,GAAGH,UAAU,CAACI,GAAG,CAC3BC,YAAY,IACT,GAAEA,YAAa;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,MACE,CAAC;EAED,OAAOV,GAAI;AACb,MAAMI,MAAM,CAACE,OAAO,CAACC,GAAI;AACzB;AACA,QAAQC,MAAM,CAACC,GAAG,CAACE,KAAK,IAAIA,KAAK,CAAE;AACnC;AACA;AACA,IAAI;AACJ"}
|
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import InfoBoxValue from './InfoBoxValue';
|
|
4
4
|
import InfoBoxLabel from './InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../InfoBoxTooltip';
|
|
5
6
|
const InfoBox = ({
|
|
6
7
|
items,
|
|
7
8
|
infoBoxKey
|
|
@@ -20,6 +21,8 @@ const InfoBox = ({
|
|
|
20
21
|
className: "info-box--value"
|
|
21
22
|
}, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
22
23
|
item: info
|
|
24
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
25
|
+
info: info
|
|
23
26
|
})));
|
|
24
27
|
}).filter(Boolean));
|
|
25
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -29,9 +32,9 @@ const InfoBox = ({
|
|
|
29
32
|
className: "info-box--container"
|
|
30
33
|
}, infoBoxItems));
|
|
31
34
|
};
|
|
32
|
-
export default InfoBox;
|
|
33
35
|
InfoBox.propTypes = {
|
|
34
36
|
infoBoxKey: PropTypes.string.isRequired,
|
|
35
37
|
items: PropTypes.array.isRequired
|
|
36
38
|
};
|
|
39
|
+
export default InfoBox;
|
|
37
40
|
//# sourceMappingURL=InfoBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","InfoBox","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","createElement","className","key","toLowerCase","filter","Boolean","propTypes","string","isRequired","array"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxValue from './InfoBoxValue';\nimport InfoBoxLabel from './InfoBoxLabel';\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\">\n <InfoBoxLabel item={info} />\n </div>\n <div className=\"info-box--value\">\n <InfoBoxValue item={info} />\n </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\
|
|
1
|
+
{"version":3,"file":"InfoBox.js","names":["PropTypes","React","InfoBoxValue","InfoBoxLabel","InfoBoxTooltip","InfoBox","items","infoBoxKey","infoBoxItems","map","item","Object","values","info","label","value","createElement","className","key","toLowerCase","filter","Boolean","propTypes","string","isRequired","array"],"sources":["../../../../src/components/InfoBoxes/presentational/InfoBox.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport InfoBoxValue from './InfoBoxValue';\nimport InfoBoxLabel from './InfoBoxLabel';\nimport InfoBoxTooltip from '../InfoBoxTooltip';\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\">\n <InfoBoxLabel item={info} />\n </div>\n <div className=\"info-box--value\">\n <InfoBoxValue item={info} />\n <InfoBoxTooltip info={info} />\n </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\nInfoBox.propTypes = {\n infoBoxKey: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired\n};\n\nexport default InfoBox;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,cAAc,MAAM,mBAAmB;AAE9C,MAAMC,OAAO,GAAGA,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,oBACEd,KAAA,CAAAe,aAAA;MAAKC,SAAS,EAAC,gBAAgB;MAACC,GAAG,EAAG,GAAEX,UAAW,IAAGM,IAAI,CAACC,KAAK,CAACK,WAAW,CAAC,CAAE;IAAE,gBAC/ElB,KAAA,CAAAe,aAAA;MAAKC,SAAS,EAAC;IAAiB,gBAC9BhB,KAAA,CAAAe,aAAA,CAACb,YAAY;MAACO,IAAI,EAAEG;IAAK,CAAE,CACxB,CAAC,eACNZ,KAAA,CAAAe,aAAA;MAAKC,SAAS,EAAC;IAAiB,gBAC9BhB,KAAA,CAAAe,aAAA,CAACd,YAAY;MAACQ,IAAI,EAAEG;IAAK,CAAE,CAAC,eAC5BZ,KAAA,CAAAe,aAAA,CAACZ,cAAc;MAACS,IAAI,EAAEA;IAAK,CAAE,CAC1B,CACF,CAAC;EAEV,CAAC,CAAC,CACDO,MAAM,CAACC,OAAO,CACnB,CAAC;EAED,oBACEpB,KAAA,CAAAe,aAAA;IAAKC,SAAS,EAAC,UAAU;IAACC,GAAG,EAAEX;EAAW,gBACxCN,KAAA,CAAAe,aAAA;IAAKC,SAAS,EAAC;EAAqB,GAAET,YAAkB,CACrD,CAAC;AAEV,CAAC;AAEDH,OAAO,CAACiB,SAAS,GAAG;EAClBf,UAAU,EAAEP,SAAS,CAACuB,MAAM,CAACC,UAAU;EACvClB,KAAK,EAAEN,SAAS,CAACyB,KAAK,CAACD;AACzB,CAAC;AAED,eAAenB,OAAO"}
|
|
@@ -8,6 +8,7 @@ import TableActions from '../TableActions';
|
|
|
8
8
|
import { ACTIONS } from '../../../constants';
|
|
9
9
|
import InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';
|
|
10
10
|
import InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';
|
|
11
|
+
import InfoBoxTooltip from '../../InfoBoxes/InfoBoxTooltip';
|
|
11
12
|
const formatRows = ({
|
|
12
13
|
rows,
|
|
13
14
|
url,
|
|
@@ -60,6 +61,8 @@ const buildArrayRowContent = rowData => /*#__PURE__*/React.createElement("div",
|
|
|
60
61
|
className: "table-row-list__group__item__value"
|
|
61
62
|
}, /*#__PURE__*/React.createElement(InfoBoxValue, {
|
|
62
63
|
item: item
|
|
64
|
+
}), /*#__PURE__*/React.createElement(InfoBoxTooltip, {
|
|
65
|
+
info: item
|
|
63
66
|
})))));
|
|
64
67
|
}));
|
|
65
68
|
const buildArrayRowData = rowData => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate-rows.js","names":["React","Link","RenderHook","TableActions","ACTIONS","InfoBoxValue","InfoBoxLabel","formatRows","rows","url","toggleModal","label","firstColumn","isEnquiry","entitySchema","map","data","editUrl","id","rowProps","_objectSpread","createElement","Fragment","to","role","hookKey","schema","value","column","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","buildArrayRowContent","rowData","className","rowGroup","item","buildArrayRowData","groupSize","Math","ceil","group1","slice","group2","group3","dataGroups","getParsedRowData","Object","keys","reduce","acc","key","parsedData","Array","isArray","getColumnsAndLabels","listingProperties","allProperties","columns","labels","forEach","listingProperty","propKey","includes","split","push","parsedRowData","populateRows","schemaId","properties","dynamicProperties","formProperties","columnOptions","identification","sort","orderBy"],"sources":["../../../../src/components/ListingTable/mappers/populate-rows.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';\nimport TableActions from '../TableActions';\nimport { ACTIONS } from '../../../constants';\nimport InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';\nimport InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';\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 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 </span>\n </div>\n ))}\n </div>\n );\n })}\n </div>\n);\n\nconst buildArrayRowData = rowData => {\n const groupSize = Math.ceil(rowData.length / 3);\n const group1 = rowData.slice(0, groupSize);\n const group2 = rowData.slice(groupSize, groupSize * 2);\n const group3 = rowData.slice(groupSize * 2);\n const dataGroups = [group1, group2, group3];\n\n return buildArrayRowContent(dataGroups);\n};\n\nconst getParsedRowData = rows =>\n rows.map(rowData =>\n Object.keys(rowData).reduce((acc, key) => {\n const parsedData = Array.isArray(rowData[key])\n ? buildArrayRowData(rowData[key])\n : rowData[key];\n return { ...acc, [key]: parsedData };\n }, {})\n );\n\nconst getColumnsAndLabels = (listingProperties, allProperties, rows) => {\n const columns = [];\n const labels = {};\n\n listingProperties.forEach(listingProperty => {\n const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;\n const { label } = allProperties[propKey] || {};\n columns.push(propKey);\n labels[propKey] = label || getSanitizedColumnLabel(propKey);\n });\n const parsedRowData = getParsedRowData(rows);\n\n return { columns, labels, parsedRowData };\n};\n\nconst populateRows = ({ toggleModal, url, entitySchema, rows }) => {\n const {\n id: schemaId,\n listingProperties,\n properties,\n dynamicProperties = {},\n formProperties\n } = entitySchema;\n\n const isEnquiry = schemaId === 'enquiry';\n const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];\n\n const allProperties = { ...properties, ...dynamicProperties };\n const { columns, labels, parsedRowData } = getColumnsAndLabels(\n columnOptions,\n allProperties,\n rows\n );\n const [firstColumn] = columns;\n\n return {\n identification: 'id',\n sort: null,\n columns,\n labels,\n orderBy: [...formProperties],\n rows: formatRows({\n firstColumn,\n rows: parsedRowData,\n url,\n toggleModal,\n isEnquiry,\n entitySchema\n }),\n isEnquiry\n };\n};\n\nexport { populateRows, formatRows, getParsedRowData };\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAOC,YAAY,MAAM,6CAA6C;AACtE,OAAOC,YAAY,MAAM,6CAA6C;
|
|
1
|
+
{"version":3,"file":"populate-rows.js","names":["React","Link","RenderHook","TableActions","ACTIONS","InfoBoxValue","InfoBoxLabel","InfoBoxTooltip","formatRows","rows","url","toggleModal","label","firstColumn","isEnquiry","entitySchema","map","data","editUrl","id","rowProps","_objectSpread","createElement","Fragment","to","role","hookKey","schema","value","column","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","buildArrayRowContent","rowData","className","rowGroup","item","info","buildArrayRowData","groupSize","Math","ceil","group1","slice","group2","group3","dataGroups","getParsedRowData","Object","keys","reduce","acc","key","parsedData","Array","isArray","getColumnsAndLabels","listingProperties","allProperties","columns","labels","forEach","listingProperty","propKey","includes","split","push","parsedRowData","populateRows","schemaId","properties","dynamicProperties","formProperties","columnOptions","identification","sort","orderBy"],"sources":["../../../../src/components/ListingTable/mappers/populate-rows.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';\nimport TableActions from '../TableActions';\nimport { ACTIONS } from '../../../constants';\nimport InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';\nimport InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';\nimport InfoBoxTooltip from '../../InfoBoxes/InfoBoxTooltip';\n\nconst formatRows = ({\n rows,\n url,\n toggleModal,\n label,\n firstColumn = 'name',\n isEnquiry,\n entitySchema\n}) =>\n rows.map(data => {\n const editUrl = `${url}/update/${data.id}`;\n\n const rowProps = {\n ...data,\n [firstColumn]: (\n <>\n <Link to={editUrl} role=\"button\">\n {data[firstColumn]}\n </Link>\n <RenderHook\n hookKey=\"entity:listing:table:row:column:after\"\n schema={entitySchema}\n data={data}\n value={data[firstColumn]}\n column={firstColumn}\n />\n </>\n )\n };\n if (!isEnquiry)\n rowProps.actions = (\n <TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />\n );\n return rowProps;\n });\n\nconst getSanitizedColumnLabel = columnProp => {\n let sanitizedChar = '';\n\n for (let index = 0; index < columnProp.length; index += 1) {\n if (index && columnProp[index] === columnProp[index].toUpperCase())\n sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;\n else sanitizedChar += columnProp[index];\n }\n return sanitizedChar;\n};\n\nconst buildArrayRowContent = rowData => (\n <div className=\"table-row-list\">\n {rowData.map(rowGroup => {\n if (!rowGroup.length) return null;\n return (\n <div className=\"table-row-list__group\">\n {rowGroup.map(item => (\n <div className=\"table-row-list__group__item\">\n <span className=\"table-row-list__group__item__label\">\n <InfoBoxLabel item={item} />\n </span>\n <span className=\"table-row-list__group__item__value\">\n <InfoBoxValue item={item} />\n <InfoBoxTooltip info={item} />\n </span>\n </div>\n ))}\n </div>\n );\n })}\n </div>\n);\n\nconst buildArrayRowData = rowData => {\n const groupSize = Math.ceil(rowData.length / 3);\n const group1 = rowData.slice(0, groupSize);\n const group2 = rowData.slice(groupSize, groupSize * 2);\n const group3 = rowData.slice(groupSize * 2);\n const dataGroups = [group1, group2, group3];\n\n return buildArrayRowContent(dataGroups);\n};\n\nconst getParsedRowData = rows =>\n rows.map(rowData =>\n Object.keys(rowData).reduce((acc, key) => {\n const parsedData = Array.isArray(rowData[key])\n ? buildArrayRowData(rowData[key])\n : rowData[key];\n return { ...acc, [key]: parsedData };\n }, {})\n );\n\nconst getColumnsAndLabels = (listingProperties, allProperties, rows) => {\n const columns = [];\n const labels = {};\n\n listingProperties.forEach(listingProperty => {\n const propKey = listingProperty.includes(' ') ? listingProperty.split(' ')[0] : listingProperty;\n const { label } = allProperties[propKey] || {};\n columns.push(propKey);\n labels[propKey] = label || getSanitizedColumnLabel(propKey);\n });\n const parsedRowData = getParsedRowData(rows);\n\n return { columns, labels, parsedRowData };\n};\n\nconst populateRows = ({ toggleModal, url, entitySchema, rows }) => {\n const {\n id: schemaId,\n listingProperties,\n properties,\n dynamicProperties = {},\n formProperties\n } = entitySchema;\n\n const isEnquiry = schemaId === 'enquiry';\n const columnOptions = !isEnquiry ? [...listingProperties, ACTIONS] : [...listingProperties];\n\n const allProperties = { ...properties, ...dynamicProperties };\n const { columns, labels, parsedRowData } = getColumnsAndLabels(\n columnOptions,\n allProperties,\n rows\n );\n const [firstColumn] = columns;\n\n return {\n identification: 'id',\n sort: null,\n columns,\n labels,\n orderBy: [...formProperties],\n rows: formatRows({\n firstColumn,\n rows: parsedRowData,\n url,\n toggleModal,\n isEnquiry,\n entitySchema\n }),\n isEnquiry\n };\n};\n\nexport { populateRows, formatRows, getParsedRowData };\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,OAAOC,YAAY,MAAM,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ED,SAAS6D,YAAY,EAAEnE,UAAU,EAAE8C,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-data-ui",
|
|
3
|
-
"version": "0.146.0-tooltips.
|
|
3
|
+
"version": "0.146.0-tooltips.9",
|
|
4
4
|
"description": "Blaze plugin data ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@blaze-react/select": "0.8.0-alpha.100",
|
|
42
42
|
"@blaze-react/table": "0.8.0-alpha.74",
|
|
43
43
|
"@blaze-react/toaster": "0.5.17",
|
|
44
|
+
"@blaze-react/tooltip": "0.8.0-alpha.100",
|
|
44
45
|
"@blaze-react/utils": "0.5.15",
|
|
45
46
|
"core-js": "^3.2.1",
|
|
46
47
|
"lodash.differencewith": "^4.5.0",
|
|
@@ -67,5 +68,5 @@
|
|
|
67
68
|
"lib/*",
|
|
68
69
|
"lib-es/*"
|
|
69
70
|
],
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "fe5d3a5a089071c3b1b8627907be0f6f4b2275ed"
|
|
71
72
|
}
|
package/src/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js
CHANGED
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import InfoBoxValue from '../../../../InfoBoxes/presentational/InfoBoxValue';
|
|
4
4
|
import InfoBoxLabel from '../../../../InfoBoxes/presentational/InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../../../../InfoBoxes/InfoBoxTooltip';
|
|
5
6
|
|
|
6
7
|
const CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {
|
|
7
8
|
if (!items) return null;
|
|
@@ -12,10 +13,11 @@ const CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {
|
|
|
12
13
|
if (!info.label || !info.value) return null;
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
|
-
<p>
|
|
16
|
+
<p key={`${customSidebarInfoKey}-${info.label.toLowerCase()}`}>
|
|
16
17
|
<InfoBoxLabel item={info} />
|
|
17
18
|
<span>
|
|
18
19
|
<InfoBoxValue item={info} />
|
|
20
|
+
<InfoBoxTooltip info={info} position="left" />
|
|
19
21
|
</span>
|
|
20
22
|
</p>
|
|
21
23
|
);
|
|
@@ -30,9 +32,9 @@ const CustomSidebarInfo = ({ items, customSidebarInfoKey }) => {
|
|
|
30
32
|
);
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
export default CustomSidebarInfo;
|
|
34
|
-
|
|
35
35
|
CustomSidebarInfo.propTypes = {
|
|
36
36
|
customSidebarInfoKey: PropTypes.string.isRequired,
|
|
37
37
|
items: PropTypes.array.isRequired
|
|
38
38
|
};
|
|
39
|
+
|
|
40
|
+
export default CustomSidebarInfo;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Tooltip from '@blaze-react/tooltip';
|
|
4
|
+
|
|
5
|
+
const InfoBoxTooltip = ({ info, ...tooltipProps }) => {
|
|
6
|
+
const { tooltipContent, tooltipIcon } = info;
|
|
7
|
+
if (!tooltipContent) return null;
|
|
8
|
+
|
|
9
|
+
const renderTooltipIcon = icon => {
|
|
10
|
+
if (!icon) return null;
|
|
11
|
+
return <i className={`${icon} info-box--icon`} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Tooltip
|
|
16
|
+
tooltipContent={tooltipContent}
|
|
17
|
+
trigger="click"
|
|
18
|
+
className="info-box--tooltip"
|
|
19
|
+
{...tooltipProps}>
|
|
20
|
+
{renderTooltipIcon(tooltipIcon)}
|
|
21
|
+
</Tooltip>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
InfoBoxTooltip.propTypes = {
|
|
26
|
+
info: PropTypes.shape({
|
|
27
|
+
tooltipContent: PropTypes.node,
|
|
28
|
+
tooltipIcon: PropTypes.string
|
|
29
|
+
}).isRequired
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default InfoBoxTooltip;
|
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import InfoBoxValue from './InfoBoxValue';
|
|
4
4
|
import InfoBoxLabel from './InfoBoxLabel';
|
|
5
|
+
import InfoBoxTooltip from '../InfoBoxTooltip';
|
|
5
6
|
|
|
6
7
|
const InfoBox = ({ items, infoBoxKey }) => {
|
|
7
8
|
if (!items) return null;
|
|
@@ -18,6 +19,7 @@ const InfoBox = ({ items, infoBoxKey }) => {
|
|
|
18
19
|
</div>
|
|
19
20
|
<div className="info-box--value">
|
|
20
21
|
<InfoBoxValue item={info} />
|
|
22
|
+
<InfoBoxTooltip info={info} />
|
|
21
23
|
</div>
|
|
22
24
|
</div>
|
|
23
25
|
);
|
|
@@ -32,9 +34,9 @@ const InfoBox = ({ items, infoBoxKey }) => {
|
|
|
32
34
|
);
|
|
33
35
|
};
|
|
34
36
|
|
|
35
|
-
export default InfoBox;
|
|
36
|
-
|
|
37
37
|
InfoBox.propTypes = {
|
|
38
38
|
infoBoxKey: PropTypes.string.isRequired,
|
|
39
39
|
items: PropTypes.array.isRequired
|
|
40
40
|
};
|
|
41
|
+
|
|
42
|
+
export default InfoBox;
|
|
@@ -5,6 +5,7 @@ import TableActions from '../TableActions';
|
|
|
5
5
|
import { ACTIONS } from '../../../constants';
|
|
6
6
|
import InfoBoxValue from '../../InfoBoxes/presentational/InfoBoxValue';
|
|
7
7
|
import InfoBoxLabel from '../../InfoBoxes/presentational/InfoBoxLabel';
|
|
8
|
+
import InfoBoxTooltip from '../../InfoBoxes/InfoBoxTooltip';
|
|
8
9
|
|
|
9
10
|
const formatRows = ({
|
|
10
11
|
rows,
|
|
@@ -17,6 +18,7 @@ const formatRows = ({
|
|
|
17
18
|
}) =>
|
|
18
19
|
rows.map(data => {
|
|
19
20
|
const editUrl = `${url}/update/${data.id}`;
|
|
21
|
+
|
|
20
22
|
const rowProps = {
|
|
21
23
|
...data,
|
|
22
24
|
[firstColumn]: (
|
|
@@ -65,6 +67,7 @@ const buildArrayRowContent = rowData => (
|
|
|
65
67
|
</span>
|
|
66
68
|
<span className="table-row-list__group__item__value">
|
|
67
69
|
<InfoBoxValue item={item} />
|
|
70
|
+
<InfoBoxTooltip info={item} />
|
|
68
71
|
</span>
|
|
69
72
|
</div>
|
|
70
73
|
))}
|