@blaze-cms/react-page-builder 0.128.0-admin-updates.9 → 0.128.0-admin-updates.10

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 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.128.0-admin-updates.10](https://github.com/thebyte9/blaze/compare/v0.128.0-admin-updates.9...v0.128.0-admin-updates.10) (2023-04-06)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fixed multiple props not working for links ([92d9b09](https://github.com/thebyte9/blaze/commit/92d9b09f193e7e2e9f41f0df7b94054eb79f24f3))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.128.0-admin-updates.9](https://github.com/thebyte9/blaze/compare/v0.128.0-admin-updates.8...v0.128.0-admin-updates.9) (2023-04-06)
7
18
 
8
19
 
@@ -7,13 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports["default"] = void 0;
8
8
  require("core-js/modules/es.array.filter.js");
9
9
  require("core-js/modules/es.object.to-string.js");
10
+ require("core-js/modules/es.array.flat.js");
11
+ require("core-js/modules/es.array.unscopables.flat.js");
10
12
  require("core-js/modules/es.array.map.js");
11
- var getLinkProps = function getLinkProps(props) {
13
+ var getLinkProps = function getLinkProps() {
14
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
12
15
  return props.map(function (_ref) {
13
16
  var propertiesToDisplay = _ref.propertiesToDisplay,
14
17
  enableLink = _ref.enableLink;
15
- return enableLink && propertiesToDisplay && propertiesToDisplay[0];
16
- }).filter(Boolean);
18
+ return enableLink && propertiesToDisplay;
19
+ }).flat().filter(Boolean);
17
20
  };
18
21
  var _default = getLinkProps;
19
22
  exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"get-link-props.js","names":["getLinkProps","props","map","_ref","propertiesToDisplay","enableLink","filter","Boolean","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/get-link-props.js"],"sourcesContent":["const getLinkProps = props =>\n props\n .map(\n ({ propertiesToDisplay, enableLink }) =>\n enableLink && propertiesToDisplay && propertiesToDisplay[0]\n )\n .filter(Boolean);\n\nexport default getLinkProps;\n"],"mappings":";;;;;;;;;;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK;EAAA,OACxBA,KAAK,CACFC,GAAG,CACF,UAAAC,IAAA;IAAA,IAAGC,mBAAmB,GAAAD,IAAA,CAAnBC,mBAAmB;MAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAA,OAChCA,UAAU,IAAID,mBAAmB,IAAIA,mBAAmB,CAAC,CAAC,CAAC;EAAA,EAC9D,CACAE,MAAM,CAACC,OAAO,CAAC;AAAA;AAAC,IAAAC,QAAA,GAENR,YAAY;AAAAS,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"get-link-props.js","names":["getLinkProps","props","arguments","length","undefined","map","_ref","propertiesToDisplay","enableLink","flat","filter","Boolean","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/get-link-props.js"],"sourcesContent":["const getLinkProps = (props = []) =>\n props\n .map(({ propertiesToDisplay, enableLink }) => enableLink && propertiesToDisplay)\n .flat()\n .filter(Boolean);\n\nexport default getLinkProps;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAA;EAAA,IAAIC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,OAC9BD,KAAK,CACFI,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,mBAAmB,GAAAD,IAAA,CAAnBC,mBAAmB;MAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAA,OAAOA,UAAU,IAAID,mBAAmB;EAAA,EAAC,CAC/EE,IAAI,EAAE,CACNC,MAAM,CAACC,OAAO,CAAC;AAAA;AAAC,IAAAC,QAAA,GAENZ,YAAY;AAAAa,OAAA,cAAAD,QAAA"}
@@ -1,6 +1,6 @@
1
- const getLinkProps = props => props.map(({
1
+ const getLinkProps = (props = []) => props.map(({
2
2
  propertiesToDisplay,
3
3
  enableLink
4
- }) => enableLink && propertiesToDisplay && propertiesToDisplay[0]).filter(Boolean);
4
+ }) => enableLink && propertiesToDisplay).flat().filter(Boolean);
5
5
  export default getLinkProps;
6
6
  //# sourceMappingURL=get-link-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-link-props.js","names":["getLinkProps","props","map","propertiesToDisplay","enableLink","filter","Boolean"],"sources":["../../../../src/components/DataSummary/helpers/get-link-props.js"],"sourcesContent":["const getLinkProps = props =>\n props\n .map(\n ({ propertiesToDisplay, enableLink }) =>\n enableLink && propertiesToDisplay && propertiesToDisplay[0]\n )\n .filter(Boolean);\n\nexport default getLinkProps;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGC,KAAK,IACxBA,KAAK,CACFC,GAAG,CACF,CAAC;EAAEC,mBAAmB;EAAEC;AAAW,CAAC,KAClCA,UAAU,IAAID,mBAAmB,IAAIA,mBAAmB,CAAC,CAAC,CAAC,CAC9D,CACAE,MAAM,CAACC,OAAO,CAAC;AAEpB,eAAeN,YAAY"}
1
+ {"version":3,"file":"get-link-props.js","names":["getLinkProps","props","map","propertiesToDisplay","enableLink","flat","filter","Boolean"],"sources":["../../../../src/components/DataSummary/helpers/get-link-props.js"],"sourcesContent":["const getLinkProps = (props = []) =>\n props\n .map(({ propertiesToDisplay, enableLink }) => enableLink && propertiesToDisplay)\n .flat()\n .filter(Boolean);\n\nexport default getLinkProps;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGA,CAACC,KAAK,GAAG,EAAE,KAC9BA,KAAK,CACFC,GAAG,CAAC,CAAC;EAAEC,mBAAmB;EAAEC;AAAW,CAAC,KAAKA,UAAU,IAAID,mBAAmB,CAAC,CAC/EE,IAAI,EAAE,CACNC,MAAM,CAACC,OAAO,CAAC;AAEpB,eAAeP,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/react-page-builder",
3
- "version": "0.128.0-admin-updates.9",
3
+ "version": "0.128.0-admin-updates.10",
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": "8a5dc83e476037d70f6901054961e1c1b3a254f5"
92
+ "gitHead": "0d80fc554bc3becc000b14b7a182ae9851696cdd"
93
93
  }
@@ -1,9 +1,7 @@
1
- const getLinkProps = props =>
1
+ const getLinkProps = (props = []) =>
2
2
  props
3
- .map(
4
- ({ propertiesToDisplay, enableLink }) =>
5
- enableLink && propertiesToDisplay && propertiesToDisplay[0]
6
- )
3
+ .map(({ propertiesToDisplay, enableLink }) => enableLink && propertiesToDisplay)
4
+ .flat()
7
5
  .filter(Boolean);
8
6
 
9
7
  export default getLinkProps;
@@ -0,0 +1,35 @@
1
+ import '@testing-library/jest-dom/extend-expect';
2
+ import getLinkProps from '../../../../../../src/components/DataSummary/helpers/get-link-props';
3
+
4
+ describe('get link props helper', () => {
5
+ const noProps = getLinkProps();
6
+
7
+ const withEnableLink = getLinkProps([
8
+ { enableLink: true, propertiesToDisplay: ['prop1', 'prop2'] }
9
+ ]);
10
+
11
+ const multipleProps = getLinkProps([
12
+ { enableLink: true, propertiesToDisplay: ['prop1', 'prop2'] },
13
+ { enableLink: true, propertiesToDisplay: ['prop3'] },
14
+ { enableLink: true, propertiesToDisplay: [] },
15
+ { enableLink: false, propertiesToDisplay: ['prop4'] }
16
+ ]);
17
+
18
+ it('should always return an array', () => {
19
+ expect(Array.isArray(noProps)).toEqual(true);
20
+ expect(Array.isArray(withEnableLink)).toEqual(true);
21
+ expect(Array.isArray(multipleProps)).toEqual(true);
22
+ });
23
+
24
+ it('should return empty array if no props are passed', () => {
25
+ expect(noProps).toEqual([]);
26
+ });
27
+
28
+ it('should return props if enableLink is true', () => {
29
+ expect(withEnableLink).toEqual(['prop1', 'prop2']);
30
+ });
31
+
32
+ it('should return props if enableLink is true and props are nested', () => {
33
+ expect(multipleProps).toEqual(['prop1', 'prop2', 'prop3']);
34
+ });
35
+ });