@blaze-cms/react-page-builder 0.133.0-alpha.0 → 0.133.0-project-admin-customisations.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/lib/components/ContentGroupSection/ContentGroupSection.js +1 -4
- package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js +4 -8
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/package.json +10 -10
- package/src/components/ContentGroupSection/ContentGroupSection.js +1 -1
- package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,22 @@
|
|
|
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.133.0-
|
|
6
|
+
# [0.133.0-project-admin-customisations.0](https://github.com/thebyte9/blaze/compare/v0.132.0...v0.133.0-project-admin-customisations.0) (2023-09-01)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
11
|
* added score sort when search filter is applied ([#3231](https://github.com/thebyte9/blaze/issues/3231)) ([a8a086c](https://github.com/thebyte9/blaze/commit/a8a086cb3b44e8f906f8b11b992c193282f0e249))
|
|
12
12
|
* added sort to az lists ([#3899](https://github.com/thebyte9/blaze/issues/3899)) ([f9d6fa5](https://github.com/thebyte9/blaze/commit/f9d6fa519749025057b44a704975409cfd416ea0))
|
|
13
|
+
* handle data summary urls in loops correctly ([#3993](https://github.com/thebyte9/blaze/issues/3993)) ([008e1a1](https://github.com/thebyte9/blaze/commit/008e1a1f24f065b4060302c2c32d1aa32dd8a007))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.129.0-project-admin-customisations.1](https://github.com/thebyte9/blaze/compare/v0.129.0-project-admin-customisations.0...v0.129.0-project-admin-customisations.1) (2023-05-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# [0.129.0-project-admin-customisations.0](https://github.com/thebyte9/blaze/compare/v0.128.2...v0.129.0-project-admin-customisations.0) (2023-05-03)
|
|
13
22
|
|
|
14
23
|
|
|
15
24
|
|
|
@@ -7,15 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
require("core-js/modules/es.function.name.js");
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
10
|
var _react = _interopRequireDefault(require("react"));
|
|
12
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
12
|
var _helpers = require("../../helpers");
|
|
14
|
-
var _excluded = ["children", "name"];
|
|
15
13
|
var ContentGroupSection = function ContentGroupSection(_ref) {
|
|
16
14
|
var children = _ref.children,
|
|
17
|
-
name = _ref.name
|
|
18
|
-
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
15
|
+
name = _ref.name;
|
|
19
16
|
if (!(0, _helpers.hasChildren)(children)) return null;
|
|
20
17
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
21
18
|
key: name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroupSection.js","names":["_react","_interopRequireDefault","require","_propTypes","_helpers","
|
|
1
|
+
{"version":3,"file":"ContentGroupSection.js","names":["_react","_interopRequireDefault","require","_propTypes","_helpers","ContentGroupSection","_ref","children","name","hasChildren","createElement","key","className","propTypes","PropTypes","oneOfType","arrayOf","node","string","defaultProps","_default","exports"],"sources":["../../../src/components/ContentGroupSection/ContentGroupSection.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { hasChildren } from '../../helpers';\n\nconst ContentGroupSection = ({ children, name }) => {\n if (!hasChildren(children)) return null;\n\n return (\n <div key={name} className=\"content-group-section\">\n {children}\n </div>\n );\n};\n\nContentGroupSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n name: PropTypes.string\n};\n\nContentGroupSection.defaultProps = { children: null, name: '' };\n\nexport default ContentGroupSection;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAMG,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAA2B;EAAA,IAArBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;EAC3C,IAAI,CAAC,IAAAC,oBAAW,EAACF,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvC,oBACEP,MAAA,YAAAU,aAAA;IAAKC,GAAG,EAAEH,IAAK;IAACI,SAAS,EAAC;EAAuB,GAC9CL,QACE,CAAC;AAEV,CAAC;AAEDF,mBAAmB,CAACQ,SAAS,GAAG;EAC9BN,QAAQ,EAAEO,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClFT,IAAI,EAAEM,qBAAS,CAACI;AAClB,CAAC;AAEDb,mBAAmB,CAACc,YAAY,GAAG;EAAEZ,QAAQ,EAAE,IAAI;EAAEC,IAAI,EAAE;AAAG,CAAC;AAAC,IAAAY,QAAA,GAEjDf,mBAAmB;AAAAgB,OAAA,cAAAD,QAAA"}
|
|
@@ -63,10 +63,11 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
63
63
|
modifier = _options$modifier === void 0 ? '' : _options$modifier;
|
|
64
64
|
return propertiesToDisplay.map(function (key) {
|
|
65
65
|
var loopValue = loopValues[key];
|
|
66
|
-
var
|
|
66
|
+
var loopValueItem = loopValue && loopValue[i];
|
|
67
|
+
var propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
67
68
|
if (!propValue) return null;
|
|
68
69
|
var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
|
|
69
|
-
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data);
|
|
70
|
+
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data, loopValueItem);
|
|
70
71
|
return [(0, _lodash["default"])(label), processedValue, linkToPublishedContent, modifier];
|
|
71
72
|
});
|
|
72
73
|
})).filter(Boolean);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","loopValueItem","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"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"}
|
|
@@ -11,10 +11,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var getLinkToPublishedContent = function getLinkToPublishedContent() {
|
|
12
12
|
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
13
13
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
|
+
var currentValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
14
15
|
var _key$split = key.split('.'),
|
|
15
16
|
_key$split2 = (0, _slicedToArray2["default"])(_key$split, 1),
|
|
16
17
|
baseKey = _key$split2[0];
|
|
17
18
|
if (!props[baseKey]) return '';
|
|
19
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
18
20
|
var content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
19
21
|
return content && content.url ? content.url : '';
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","arguments","length","undefined","props","_key$split","split","_key$split2","_slicedToArray2","baseKey","content","Array","isArray","
|
|
1
|
+
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","arguments","length","undefined","props","currentValue","_key$split","split","_key$split2","_slicedToArray2","baseKey","url","content","Array","isArray","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n\n if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;\n\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":";;;;;;;;;;AAAA,IAAMA,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAA,EAAkD;EAAA,IAA9CC,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IAAEG,KAAK,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAAEI,YAAY,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAC1E,IAAAK,UAAA,GAAkBN,GAAG,CAACO,KAAK,CAAC,GAAG,CAAC;IAAAC,WAAA,OAAAC,eAAA,aAAAH,UAAA;IAAzBI,OAAO,GAAAF,WAAA;EACd,IAAI,CAACJ,KAAK,CAACM,OAAO,CAAC,EAAE,OAAO,EAAE;EAE9B,IAAIL,YAAY,IAAI,OAAOA,YAAY,CAACM,GAAG,KAAK,WAAW,EAAE,OAAON,YAAY,CAACM,GAAG;EAEpF,IAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACV,KAAK,CAACM,OAAO,CAAC,CAAC,GAAGN,KAAK,CAACM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGN,KAAK,CAACM,OAAO,CAAC;EAClF,OAAOE,OAAO,IAAIA,OAAO,CAACD,GAAG,GAAGC,OAAO,CAACD,GAAG,GAAG,EAAE;AAClD,CAAC;AAAC,IAAAI,QAAA,GAEahB,yBAAyB;AAAAiB,OAAA,cAAAD,QAAA"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
const _excluded = ["children", "name"];
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
3
|
import { hasChildren } from '../../helpers';
|
|
6
|
-
const ContentGroupSection =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} = _ref,
|
|
11
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
4
|
+
const ContentGroupSection = ({
|
|
5
|
+
children,
|
|
6
|
+
name
|
|
7
|
+
}) => {
|
|
12
8
|
if (!hasChildren(children)) return null;
|
|
13
9
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
10
|
key: name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","
|
|
1
|
+
{"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","children","name","createElement","key","className","propTypes","oneOfType","arrayOf","node","string","defaultProps"],"sources":["../../../src/components/ContentGroupSection/ContentGroupSection.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { hasChildren } from '../../helpers';\n\nconst ContentGroupSection = ({ children, name }) => {\n if (!hasChildren(children)) return null;\n\n return (\n <div key={name} className=\"content-group-section\">\n {children}\n </div>\n );\n};\n\nContentGroupSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n name: PropTypes.string\n};\n\nContentGroupSection.defaultProps = { children: null, name: '' };\n\nexport default ContentGroupSection;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAK,CAAC,KAAK;EAClD,IAAI,CAACH,WAAW,CAACE,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvC,oBACEJ,KAAA,CAAAM,aAAA;IAAKC,GAAG,EAAEF,IAAK;IAACG,SAAS,EAAC;EAAuB,GAC9CJ,QACE,CAAC;AAEV,CAAC;AAEDD,mBAAmB,CAACM,SAAS,GAAG;EAC9BL,QAAQ,EAAEH,SAAS,CAACS,SAAS,CAAC,CAACT,SAAS,CAACU,OAAO,CAACV,SAAS,CAACW,IAAI,CAAC,EAAEX,SAAS,CAACW,IAAI,CAAC,CAAC;EAClFP,IAAI,EAAEJ,SAAS,CAACY;AAClB,CAAC;AAEDV,mBAAmB,CAACW,YAAY,GAAG;EAAEV,QAAQ,EAAE,IAAI;EAAEC,IAAI,EAAE;AAAG,CAAC;AAE/D,eAAeF,mBAAmB"}
|
|
@@ -44,10 +44,11 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
44
44
|
} = options;
|
|
45
45
|
return propertiesToDisplay.map(key => {
|
|
46
46
|
const loopValue = loopValues[key];
|
|
47
|
-
const
|
|
47
|
+
const loopValueItem = loopValue && loopValue[i];
|
|
48
|
+
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
48
49
|
if (!propValue) return null;
|
|
49
50
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
50
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
51
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
|
|
51
52
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
52
53
|
});
|
|
53
54
|
})).filter(Boolean);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","loopValueItem","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
4
5
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
5
6
|
return content && content.url ? content.url : '';
|
|
6
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","baseKey","split","content","Array","isArray"
|
|
1
|
+
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","currentValue","baseKey","split","url","content","Array","isArray"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n\n if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;\n\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":"AAAA,MAAMA,yBAAyB,GAAGA,CAACC,GAAG,GAAG,EAAE,EAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,YAAY,GAAG,IAAI,KAAK;EAC/E,MAAM,CAACC,OAAO,CAAC,GAAGH,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC;EAChC,IAAI,CAACH,KAAK,CAACE,OAAO,CAAC,EAAE,OAAO,EAAE;EAE9B,IAAID,YAAY,IAAI,OAAOA,YAAY,CAACG,GAAG,KAAK,WAAW,EAAE,OAAOH,YAAY,CAACG,GAAG;EAEpF,MAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACP,KAAK,CAACE,OAAO,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC;EAClF,OAAOG,OAAO,IAAIA,OAAO,CAACD,GAAG,GAAGC,OAAO,CAACD,GAAG,GAAG,EAAE;AAClD,CAAC;AAED,eAAeN,yBAAyB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.133.0-
|
|
3
|
+
"version": "0.133.0-project-admin-customisations.0",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/core-errors-ui": "
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.133.0-project-admin-customisations.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.133.0-project-admin-customisations.0",
|
|
32
|
+
"@blaze-cms/core-errors-ui": "0.133.0-project-admin-customisations.0",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.5",
|
|
34
|
-
"@blaze-cms/nextjs-components": "
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "
|
|
36
|
-
"@blaze-cms/setup-ui": "
|
|
37
|
-
"@blaze-cms/utils": "
|
|
38
|
-
"@blaze-cms/utils-handlebars": "
|
|
34
|
+
"@blaze-cms/nextjs-components": "0.133.0-project-admin-customisations.0",
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.133.0-project-admin-customisations.0",
|
|
36
|
+
"@blaze-cms/setup-ui": "0.133.0-project-admin-customisations.0",
|
|
37
|
+
"@blaze-cms/utils": "0.133.0-project-admin-customisations.0",
|
|
38
|
+
"@blaze-cms/utils-handlebars": "0.133.0-project-admin-customisations.0",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.5.19",
|
|
41
41
|
"@blaze-react/checkboxes": "0.5.31",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "aaf10121050962f9219e752b37ad56e8b5bf265b"
|
|
93
93
|
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { hasChildren } from '../../helpers';
|
|
4
4
|
|
|
5
|
-
const ContentGroupSection = ({ children, name
|
|
5
|
+
const ContentGroupSection = ({ children, name }) => {
|
|
6
6
|
if (!hasChildren(children)) return null;
|
|
7
7
|
|
|
8
8
|
return (
|
|
@@ -45,11 +45,12 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
45
45
|
|
|
46
46
|
return propertiesToDisplay.map(key => {
|
|
47
47
|
const loopValue = loopValues[key];
|
|
48
|
-
const
|
|
48
|
+
const loopValueItem = loopValue && loopValue[i];
|
|
49
|
+
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
49
50
|
if (!propValue) return null;
|
|
50
51
|
|
|
51
52
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
52
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
53
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
|
|
53
54
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
54
55
|
});
|
|
55
56
|
})
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
+
|
|
5
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
6
|
+
|
|
4
7
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
5
8
|
return content && content.url ? content.url : '';
|
|
6
9
|
};
|
|
@@ -90,4 +90,45 @@ describe('buildLoopPropsContent helper function', () => {
|
|
|
90
90
|
});
|
|
91
91
|
expect.hasAssertions();
|
|
92
92
|
});
|
|
93
|
+
|
|
94
|
+
it('should nested items with urls', () => {
|
|
95
|
+
const data = {
|
|
96
|
+
nestedLoopProp: [
|
|
97
|
+
{
|
|
98
|
+
nestedValue: 'abc',
|
|
99
|
+
url: 'http://blazecms.app/abc'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
nestedValue: '123',
|
|
103
|
+
url: 'http://blazecms.app/123'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
nestedValue: 'no url',
|
|
107
|
+
url: null
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
const withUrl = buildLoopPropsContent(
|
|
112
|
+
mockedLoopProps,
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
bold: false,
|
|
116
|
+
enableLink: true,
|
|
117
|
+
label: '',
|
|
118
|
+
modifier: '',
|
|
119
|
+
prefix: '',
|
|
120
|
+
propertiesToDisplay: ['nestedLoopProp.nestedValue'],
|
|
121
|
+
shouldStrip: true
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
0,
|
|
125
|
+
data
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
withUrl.forEach(([, value, url], index) => {
|
|
129
|
+
expect(value).toEqual(data.nestedLoopProp[index].nestedValue);
|
|
130
|
+
expect(url).toEqual(data.nestedLoopProp[index].url || '');
|
|
131
|
+
});
|
|
132
|
+
expect.hasAssertions();
|
|
133
|
+
});
|
|
93
134
|
});
|
|
@@ -38,4 +38,25 @@ describe('get link to published content', () => {
|
|
|
38
38
|
const result = getLinkToPublishedContent(publishedKey, props);
|
|
39
39
|
expect(result).toEqual('');
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
it('should return url from the currentValue', () => {
|
|
43
|
+
const currentValue = { url: 'currentValueUrl' };
|
|
44
|
+
const props = { content: [content] };
|
|
45
|
+
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
46
|
+
expect(result).toEqual(currentValue.url);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should return url from the currentValue even if falsey', () => {
|
|
50
|
+
const currentValue = { url: null };
|
|
51
|
+
const props = { content: [content] };
|
|
52
|
+
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
53
|
+
expect(result).toEqual(currentValue.url);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should not return url from the currentValue if not set', () => {
|
|
57
|
+
const currentValue = {};
|
|
58
|
+
const props = { content: [content] };
|
|
59
|
+
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
60
|
+
expect(result).toEqual(content.url);
|
|
61
|
+
});
|
|
41
62
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Placeholder component should render PlaceholderIcon 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="editor-view__placeholder"
|
|
7
|
+
data-testid="placeholder-icon"
|
|
8
|
+
>
|
|
9
|
+
<svg
|
|
10
|
+
height="25px"
|
|
11
|
+
version="1.1"
|
|
12
|
+
viewBox="0 0 16 16"
|
|
13
|
+
width="25px"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<title>
|
|
17
|
+
card
|
|
18
|
+
</title>
|
|
19
|
+
<g
|
|
20
|
+
fill="none"
|
|
21
|
+
fill-rule="evenodd"
|
|
22
|
+
id="Icons"
|
|
23
|
+
stroke="none"
|
|
24
|
+
stroke-width="1"
|
|
25
|
+
>
|
|
26
|
+
<g
|
|
27
|
+
id="card"
|
|
28
|
+
transform="translate(-261.000000, -216.000000)"
|
|
29
|
+
>
|
|
30
|
+
<g
|
|
31
|
+
transform="translate(261.000000, 216.000000)"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
d="M15,1 L15,9.53124644 L14.998,9.531 L14.9986024,7.67959976 L11.4210663,4.62547112 L7.4590683,8.08893259 C7.08560181,8.77082265 6.07591438,8.77082265 5.51715851,8.27688661 L3.50145721,6.5 L1,8.77 L1,7.323 L2.58011188,5.9054667 C3.10161735,5.44445974 3.91799869,5.41372594 4.47882094,5.81326531 L4.59488493,5.9054667 L6.4402744,7.56106172 L10.4252459,3.98593625 C10.9840017,3.49200022 11.8812631,3.49200022 12.4400189,3.98593625 L14.9986024,6.28137475 L14.998,1 Z M6.14778213,2.60821539 C6.69719001,2.60821539 7.14257312,3.0379169 7.14257312,3.56798059 C7.14257312,4.09804429 6.69719002,4.52774581 6.14778213,4.52774581 C5.88422964,4.52580316 5.6316942,4.42547921 5.44313851,4.24781429 C5.25594548,4.06784498 5.15142164,3.82293899 5.15297371,3.56798059 C5.15297371,3.0379169 5.59837425,2.60821539 6.14778213,2.60821539 Z"
|
|
35
|
+
fill="#63779C"
|
|
36
|
+
fill-rule="nonzero"
|
|
37
|
+
id="Combined-Shape"
|
|
38
|
+
/>
|
|
39
|
+
<path
|
|
40
|
+
d="M3,13 C3,12.7238576 3.22385763,12.5 3.5,12.5 L12.5,12.5 C12.7761424,12.5 13,12.7238576 13,13 C13,13.2761424 12.7761424,13.5 12.5,13.5 L3.5,13.5 C3.22385763,13.5 3,13.2761424 3,13 Z"
|
|
41
|
+
fill="#899BBC"
|
|
42
|
+
fill-rule="nonzero"
|
|
43
|
+
id="Shape"
|
|
44
|
+
/>
|
|
45
|
+
<rect
|
|
46
|
+
height="15"
|
|
47
|
+
id="Rectangle"
|
|
48
|
+
rx="2"
|
|
49
|
+
stroke="#899BBC"
|
|
50
|
+
width="15"
|
|
51
|
+
x="0.5"
|
|
52
|
+
y="0.5"
|
|
53
|
+
/>
|
|
54
|
+
<line
|
|
55
|
+
id="Line-2"
|
|
56
|
+
stroke="#63779C"
|
|
57
|
+
stroke-linecap="square"
|
|
58
|
+
x1="0.5"
|
|
59
|
+
x2="15.5"
|
|
60
|
+
y1="10.5"
|
|
61
|
+
y2="10.5"
|
|
62
|
+
/>
|
|
63
|
+
</g>
|
|
64
|
+
</g>
|
|
65
|
+
</g>
|
|
66
|
+
</svg>
|
|
67
|
+
<span>
|
|
68
|
+
card
|
|
69
|
+
</span>
|
|
70
|
+
</div>
|
|
71
|
+
</DocumentFragment>
|
|
72
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
5
|
+
|
|
6
|
+
import PlaceholderIcon from '../../../../../../blaze-plugin-page-builder-ui/src/components/EditorView/PlaceholderIcon';
|
|
7
|
+
import { CardIcon } from '../../../../../../blaze-plugin-page-builder-ui/src/components/EditorView/Icons';
|
|
8
|
+
|
|
9
|
+
const mockedProps = {
|
|
10
|
+
type: 'card',
|
|
11
|
+
icon: CardIcon
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('Placeholder component', () => {
|
|
15
|
+
it('should render PlaceholderIcon', () => {
|
|
16
|
+
const { asFragment, getByTestId } = render(PlaceholderIcon, mockedProps);
|
|
17
|
+
expect(getByTestId('placeholder-icon')).toBeDefined();
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
});
|