@blaze-cms/react-page-builder 0.131.0-admin-updates.2 → 0.131.0-admin-updates.5
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 +19 -0
- 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/helpers/get-entities-with-banner.js +8 -2
- package/lib/helpers/get-entities-with-banner.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/lib-es/helpers/get-entities-with-banner.js +9 -2
- package/lib-es/helpers/get-entities-with-banner.js.map +1 -1
- package/package.json +2 -2
- 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/src/helpers/get-entities-with-banner.js +3 -2
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.131.0-admin-updates.5](https://github.com/thebyte9/blaze/compare/v0.131.0-admin-updates.4...v0.131.0-admin-updates.5) (2023-07-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* handle data summary urls in loops correctly ([#3993](https://github.com/thebyte9/blaze/issues/3993)) ([008e1a1](https://github.com/thebyte9/blaze/commit/008e1a1f24f065b4060302c2c32d1aa32dd8a007))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.131.0-admin-updates.4](https://github.com/thebyte9/blaze/compare/v0.131.0-admin-updates.3...v0.131.0-admin-updates.4) (2023-07-17)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.131.0-admin-updates.2](https://github.com/thebyte9/blaze/compare/v0.131.0-admin-updates.1...v0.131.0-admin-updates.2) (2023-07-11)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -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"}
|
|
@@ -26,11 +26,17 @@ function getEntitiesWithBanner(entities, options, hasNewBannerSettings) {
|
|
|
26
26
|
return entities.map(function (currentEntity) {
|
|
27
27
|
var parent = options.parent,
|
|
28
28
|
transform = options.transform,
|
|
29
|
-
limit = options.limit
|
|
29
|
+
limit = options.limit,
|
|
30
|
+
banner = options.banner;
|
|
31
|
+
var _ref = banner || {},
|
|
32
|
+
adunit = _ref.adunit,
|
|
33
|
+
baseAdunit = _ref.baseAdunit;
|
|
30
34
|
return _objectSpread(_objectSpread({}, currentEntity), {}, {
|
|
31
35
|
parent: parent,
|
|
32
36
|
limit: limit,
|
|
33
|
-
transform: transform
|
|
37
|
+
transform: transform,
|
|
38
|
+
adunit: adunit,
|
|
39
|
+
baseAdunit: baseAdunit
|
|
34
40
|
});
|
|
35
41
|
});
|
|
36
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entities-with-banner.js","names":["_injectBannersToEntities","_interopRequireDefault","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getEntitiesWithBanner","entities","options","hasNewBannerSettings","hasBanner","map","currentEntity","parent","transform","limit","injectBannersToEntities"],"sources":["../../src/helpers/get-entities-with-banner.js"],"sourcesContent":["import injectBannersToEntities from './inject-banners-to-entities';\n\nexport default function getEntitiesWithBanner(entities, options, hasNewBannerSettings) {\n const { hasBanner } = options;\n if (hasNewBannerSettings) {\n return entities.map(currentEntity => {\n const { parent, transform, limit } = options;\n return { ...currentEntity, parent, limit, transform };\n });\n }\n if (!hasBanner) return entities;\n\n return injectBannersToEntities(entities, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,wBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmE,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,aAAAP,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAkB,yBAAA,GAAAlB,MAAA,CAAAmB,gBAAA,CAAAT,MAAA,EAAAV,MAAA,CAAAkB,yBAAA,CAAAJ,MAAA,KAAAlB,OAAA,CAAAI,MAAA,CAAAc,MAAA,GAAAC,OAAA,WAAAC,GAAA,IAAAhB,MAAA,CAAAoB,cAAA,CAAAV,MAAA,EAAAM,GAAA,EAAAhB,MAAA,CAAAK,wBAAA,CAAAS,MAAA,EAAAE,GAAA,iBAAAN,MAAA;AAEpD,SAASW,qBAAqBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,oBAAoB,EAAE;EACrF,IAAQC,SAAS,GAAKF,OAAO,CAArBE,SAAS;EACjB,IAAID,oBAAoB,EAAE;IACxB,OAAOF,QAAQ,CAACI,GAAG,CAAC,UAAAC,aAAa,EAAI;MACnC,IAAQC,MAAM,
|
|
1
|
+
{"version":3,"file":"get-entities-with-banner.js","names":["_injectBannersToEntities","_interopRequireDefault","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getEntitiesWithBanner","entities","options","hasNewBannerSettings","hasBanner","map","currentEntity","parent","transform","limit","banner","_ref","adunit","baseAdunit","injectBannersToEntities"],"sources":["../../src/helpers/get-entities-with-banner.js"],"sourcesContent":["import injectBannersToEntities from './inject-banners-to-entities';\n\nexport default function getEntitiesWithBanner(entities, options, hasNewBannerSettings) {\n const { hasBanner } = options;\n if (hasNewBannerSettings) {\n return entities.map(currentEntity => {\n const { parent, transform, limit, banner } = options;\n const { adunit, baseAdunit } = banner || {};\n return { ...currentEntity, parent, limit, transform, adunit, baseAdunit };\n });\n }\n if (!hasBanner) return entities;\n\n return injectBannersToEntities(entities, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,wBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmE,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,aAAAP,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAkB,yBAAA,GAAAlB,MAAA,CAAAmB,gBAAA,CAAAT,MAAA,EAAAV,MAAA,CAAAkB,yBAAA,CAAAJ,MAAA,KAAAlB,OAAA,CAAAI,MAAA,CAAAc,MAAA,GAAAC,OAAA,WAAAC,GAAA,IAAAhB,MAAA,CAAAoB,cAAA,CAAAV,MAAA,EAAAM,GAAA,EAAAhB,MAAA,CAAAK,wBAAA,CAAAS,MAAA,EAAAE,GAAA,iBAAAN,MAAA;AAEpD,SAASW,qBAAqBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,oBAAoB,EAAE;EACrF,IAAQC,SAAS,GAAKF,OAAO,CAArBE,SAAS;EACjB,IAAID,oBAAoB,EAAE;IACxB,OAAOF,QAAQ,CAACI,GAAG,CAAC,UAAAC,aAAa,EAAI;MACnC,IAAQC,MAAM,GAA+BL,OAAO,CAA5CK,MAAM;QAAEC,SAAS,GAAoBN,OAAO,CAApCM,SAAS;QAAEC,KAAK,GAAaP,OAAO,CAAzBO,KAAK;QAAEC,MAAM,GAAKR,OAAO,CAAlBQ,MAAM;MACxC,IAAAC,IAAA,GAA+BD,MAAM,IAAI,CAAC,CAAC;QAAnCE,MAAM,GAAAD,IAAA,CAANC,MAAM;QAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;MAC1B,OAAAzB,aAAA,CAAAA,aAAA,KAAYkB,aAAa;QAAEC,MAAM,EAANA,MAAM;QAAEE,KAAK,EAALA,KAAK;QAAED,SAAS,EAATA,SAAS;QAAEI,MAAM,EAANA,MAAM;QAAEC,UAAU,EAAVA;MAAU;IACzE,CAAC,CAAC;EACJ;EACA,IAAI,CAACT,SAAS,EAAE,OAAOH,QAAQ;EAE/B,OAAO,IAAAa,mCAAuB,EAACb,QAAQ,EAAEC,OAAO,CAAC;AACnD"}
|
|
@@ -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"}
|
|
@@ -11,12 +11,19 @@ export default function getEntitiesWithBanner(entities, options, hasNewBannerSet
|
|
|
11
11
|
const {
|
|
12
12
|
parent,
|
|
13
13
|
transform,
|
|
14
|
-
limit
|
|
14
|
+
limit,
|
|
15
|
+
banner
|
|
15
16
|
} = options;
|
|
17
|
+
const {
|
|
18
|
+
adunit,
|
|
19
|
+
baseAdunit
|
|
20
|
+
} = banner || {};
|
|
16
21
|
return _objectSpread(_objectSpread({}, currentEntity), {}, {
|
|
17
22
|
parent,
|
|
18
23
|
limit,
|
|
19
|
-
transform
|
|
24
|
+
transform,
|
|
25
|
+
adunit,
|
|
26
|
+
baseAdunit
|
|
20
27
|
});
|
|
21
28
|
});
|
|
22
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entities-with-banner.js","names":["injectBannersToEntities","getEntitiesWithBanner","entities","options","hasNewBannerSettings","hasBanner","map","currentEntity","parent","transform","limit","_objectSpread"],"sources":["../../src/helpers/get-entities-with-banner.js"],"sourcesContent":["import injectBannersToEntities from './inject-banners-to-entities';\n\nexport default function getEntitiesWithBanner(entities, options, hasNewBannerSettings) {\n const { hasBanner } = options;\n if (hasNewBannerSettings) {\n return entities.map(currentEntity => {\n const { parent, transform, limit } = options;\n return { ...currentEntity, parent, limit, transform };\n });\n }\n if (!hasBanner) return entities;\n\n return injectBannersToEntities(entities, options);\n}\n"],"mappings":";;;AAAA,OAAOA,uBAAuB,MAAM,8BAA8B;AAElE,eAAe,SAASC,qBAAqBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,oBAAoB,EAAE;EACrF,MAAM;IAAEC;EAAU,CAAC,GAAGF,OAAO;EAC7B,IAAIC,oBAAoB,EAAE;IACxB,OAAOF,QAAQ,CAACI,GAAG,CAACC,aAAa,IAAI;MACnC,MAAM;QAAEC,MAAM;QAAEC,SAAS;QAAEC;
|
|
1
|
+
{"version":3,"file":"get-entities-with-banner.js","names":["injectBannersToEntities","getEntitiesWithBanner","entities","options","hasNewBannerSettings","hasBanner","map","currentEntity","parent","transform","limit","banner","adunit","baseAdunit","_objectSpread"],"sources":["../../src/helpers/get-entities-with-banner.js"],"sourcesContent":["import injectBannersToEntities from './inject-banners-to-entities';\n\nexport default function getEntitiesWithBanner(entities, options, hasNewBannerSettings) {\n const { hasBanner } = options;\n if (hasNewBannerSettings) {\n return entities.map(currentEntity => {\n const { parent, transform, limit, banner } = options;\n const { adunit, baseAdunit } = banner || {};\n return { ...currentEntity, parent, limit, transform, adunit, baseAdunit };\n });\n }\n if (!hasBanner) return entities;\n\n return injectBannersToEntities(entities, options);\n}\n"],"mappings":";;;AAAA,OAAOA,uBAAuB,MAAM,8BAA8B;AAElE,eAAe,SAASC,qBAAqBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,oBAAoB,EAAE;EACrF,MAAM;IAAEC;EAAU,CAAC,GAAGF,OAAO;EAC7B,IAAIC,oBAAoB,EAAE;IACxB,OAAOF,QAAQ,CAACI,GAAG,CAACC,aAAa,IAAI;MACnC,MAAM;QAAEC,MAAM;QAAEC,SAAS;QAAEC,KAAK;QAAEC;MAAO,CAAC,GAAGR,OAAO;MACpD,MAAM;QAAES,MAAM;QAAEC;MAAW,CAAC,GAAGF,MAAM,IAAI,CAAC,CAAC;MAC3C,OAAAG,aAAA,CAAAA,aAAA,KAAYP,aAAa;QAAEC,MAAM;QAAEE,KAAK;QAAED,SAAS;QAAEG,MAAM;QAAEC;MAAU;IACzE,CAAC,CAAC;EACJ;EACA,IAAI,CAACR,SAAS,EAAE,OAAOH,QAAQ;EAE/B,OAAOF,uBAAuB,CAACE,QAAQ,EAAEC,OAAO,CAAC;AACnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.131.0-admin-updates.
|
|
3
|
+
"version": "0.131.0-admin-updates.5",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "c6c3a39d4330d02cedf6db63cd6184441823039e"
|
|
93
93
|
}
|
|
@@ -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
|
};
|
|
@@ -4,8 +4,9 @@ export default function getEntitiesWithBanner(entities, options, hasNewBannerSet
|
|
|
4
4
|
const { hasBanner } = options;
|
|
5
5
|
if (hasNewBannerSettings) {
|
|
6
6
|
return entities.map(currentEntity => {
|
|
7
|
-
const { parent, transform, limit } = options;
|
|
8
|
-
|
|
7
|
+
const { parent, transform, limit, banner } = options;
|
|
8
|
+
const { adunit, baseAdunit } = banner || {};
|
|
9
|
+
return { ...currentEntity, parent, limit, transform, adunit, baseAdunit };
|
|
9
10
|
});
|
|
10
11
|
}
|
|
11
12
|
if (!hasBanner) return entities;
|
|
@@ -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
|
});
|