@blaze-cms/react-page-builder 0.147.0-rc-eagle.4 → 0.147.0-rc-eagle.6
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/lib/components/ContentGroup/ContentGroup.js +40 -8
- package/lib/components/ContentGroup/ContentGroup.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupDataFetcher.js +96 -0
- package/lib/components/ContentGroup/ContentGroupDataFetcher.js.map +1 -0
- package/lib/components/ContentGroup/helpers/build-data-sections.js +46 -0
- package/lib/components/ContentGroup/helpers/build-data-sections.js.map +1 -0
- package/lib/components/ContentGroup/helpers/index.js +7 -0
- package/lib/components/ContentGroup/helpers/index.js.map +1 -1
- package/lib/components/ContentGroupSection/ContentGroupSection.js +3 -2
- package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib/components/Iframe/Iframe.js +16 -6
- package/lib/components/Iframe/Iframe.js.map +1 -1
- package/lib/components/Layout/Layout.js +14 -3
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/helpers/get-component-id.js +9 -3
- package/lib/helpers/get-component-id.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroup.js +41 -9
- package/lib-es/components/ContentGroup/ContentGroup.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupDataFetcher.js +88 -0
- package/lib-es/components/ContentGroup/ContentGroupDataFetcher.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/build-data-sections.js +38 -0
- package/lib-es/components/ContentGroup/helpers/build-data-sections.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/index.js +2 -1
- package/lib-es/components/ContentGroup/helpers/index.js.map +1 -1
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js +3 -2
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib-es/components/Iframe/Iframe.js +16 -6
- package/lib-es/components/Iframe/Iframe.js.map +1 -1
- package/lib-es/components/Layout/Layout.js +14 -3
- package/lib-es/components/Layout/Layout.js.map +1 -1
- package/lib-es/helpers/get-component-id.js +9 -3
- package/lib-es/helpers/get-component-id.js.map +1 -1
- package/package.json +6 -6
- package/src/components/ContentGroup/ContentGroup.js +54 -8
- package/src/components/ContentGroup/ContentGroupDataFetcher.js +74 -0
- package/src/components/ContentGroup/helpers/build-data-sections.js +35 -0
- package/src/components/ContentGroup/helpers/index.js +2 -1
- package/src/components/ContentGroupSection/ContentGroupSection.js +2 -2
- package/src/components/Iframe/Iframe.js +22 -6
- package/src/components/Layout/Layout.js +13 -2
- package/src/helpers/get-component-id.js +7 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["contentType", "isFaqContent", "children", "customHtmlProps"],
|
|
4
|
+
const _excluded = ["contentType", "isFaqContent", "children", "customHtmlProps", "simpleData", "dataProperty"],
|
|
5
5
|
_excluded2 = ["topWrapperProps"];
|
|
6
6
|
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; }
|
|
7
7
|
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) { _defineProperty(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; }
|
|
@@ -10,7 +10,8 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import { CONTENT_GROUP_TYPES } from './constants';
|
|
11
11
|
import ContentGroupTabs from './ContentGroupTabs';
|
|
12
12
|
import ContentGroupAccordion from './ContentGroupAccordion';
|
|
13
|
-
import
|
|
13
|
+
import ContentGroupDataFetcher from './ContentGroupDataFetcher';
|
|
14
|
+
import { getSectionsData, buildDataSections } from './helpers';
|
|
14
15
|
import getStructuredDataProperties from './helpers/get-structured-data-properties';
|
|
15
16
|
import { getCustomHtmlProperties } from '../../helpers';
|
|
16
17
|
const VALID_TYPES = Object.values(CONTENT_GROUP_TYPES);
|
|
@@ -20,10 +21,15 @@ const ContentGroup = _ref => {
|
|
|
20
21
|
contentType,
|
|
21
22
|
isFaqContent,
|
|
22
23
|
children,
|
|
23
|
-
customHtmlProps
|
|
24
|
+
customHtmlProps,
|
|
25
|
+
simpleData,
|
|
26
|
+
dataProperty
|
|
24
27
|
} = _ref,
|
|
25
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
const
|
|
29
|
+
const hasSimpleData = Array.isArray(simpleData) && simpleData.length > 0;
|
|
30
|
+
const dataPropertyName = Array.isArray(dataProperty) ? dataProperty[0] : dataProperty;
|
|
31
|
+
const hasDataProperty = !!dataPropertyName;
|
|
32
|
+
const childGroupSections = children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$child = _children$props.children) === null || _children$props$child === void 0 ? void 0 : _children$props$child[1];
|
|
27
33
|
const GroupComponent = useMemo(() => contentType === CONTENT_GROUP_TYPES.ACCORDION ? ContentGroupAccordion : ContentGroupTabs, [contentType]);
|
|
28
34
|
const WrapperComponent = useMemo(() => !isFaqContent ? Fragment : 'div', [isFaqContent]);
|
|
29
35
|
const _useMemo = useMemo(() => {
|
|
@@ -38,8 +44,26 @@ const ContentGroup = _ref => {
|
|
|
38
44
|
topWrapperProps
|
|
39
45
|
} = _useMemo,
|
|
40
46
|
schemaProperties = _objectWithoutProperties(_useMemo, _excluded2);
|
|
41
|
-
if (!
|
|
42
|
-
|
|
47
|
+
if (!VALID_TYPES.includes(contentType)) return '';
|
|
48
|
+
if (!hasSimpleData && hasDataProperty) {
|
|
49
|
+
return /*#__PURE__*/React.createElement(WrapperComponent, topWrapperProps, /*#__PURE__*/React.createElement(ContentGroupDataFetcher, _extends({
|
|
50
|
+
dataProperty: dataPropertyName,
|
|
51
|
+
contentType: contentType
|
|
52
|
+
}, props, schemaProperties)));
|
|
53
|
+
}
|
|
54
|
+
let groupSections;
|
|
55
|
+
let sectionsData;
|
|
56
|
+
if (hasSimpleData) {
|
|
57
|
+
({
|
|
58
|
+
groupSections,
|
|
59
|
+
sectionsData
|
|
60
|
+
} = buildDataSections(simpleData));
|
|
61
|
+
} else {
|
|
62
|
+
groupSections = childGroupSections;
|
|
63
|
+
if (!groupSections || !groupSections.length) return '';
|
|
64
|
+
sectionsData = getSectionsData(groupSections);
|
|
65
|
+
}
|
|
66
|
+
if (!groupSections || !groupSections.length) return '';
|
|
43
67
|
return /*#__PURE__*/React.createElement(WrapperComponent, topWrapperProps, /*#__PURE__*/React.createElement(GroupComponent, _extends({
|
|
44
68
|
contentType: contentType,
|
|
45
69
|
groupSections: groupSections,
|
|
@@ -47,17 +71,25 @@ const ContentGroup = _ref => {
|
|
|
47
71
|
}, props, schemaProperties)));
|
|
48
72
|
};
|
|
49
73
|
ContentGroup.propTypes = {
|
|
50
|
-
children: PropTypes.object
|
|
74
|
+
children: PropTypes.object,
|
|
51
75
|
contentType: PropTypes.oneOf(VALID_TYPES).isRequired,
|
|
52
76
|
isFaqContent: PropTypes.bool,
|
|
53
77
|
customHtmlProps: PropTypes.arrayOf(PropTypes.shape({
|
|
54
78
|
name: PropTypes.string,
|
|
55
79
|
value: PropTypes.string
|
|
56
|
-
}))
|
|
80
|
+
})),
|
|
81
|
+
simpleData: PropTypes.arrayOf(PropTypes.shape({
|
|
82
|
+
label: PropTypes.string,
|
|
83
|
+
text: PropTypes.string
|
|
84
|
+
})),
|
|
85
|
+
dataProperty: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)])
|
|
57
86
|
};
|
|
58
87
|
ContentGroup.defaultProps = {
|
|
88
|
+
children: null,
|
|
59
89
|
isFaqContent: false,
|
|
60
|
-
customHtmlProps: []
|
|
90
|
+
customHtmlProps: [],
|
|
91
|
+
simpleData: null,
|
|
92
|
+
dataProperty: null
|
|
61
93
|
};
|
|
62
94
|
export default ContentGroup;
|
|
63
95
|
//# sourceMappingURL=ContentGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroup.js","names":["React","Fragment","useMemo","PropTypes","CONTENT_GROUP_TYPES","ContentGroupTabs","ContentGroupAccordion","getSectionsData","getStructuredDataProperties","getCustomHtmlProperties","VALID_TYPES","Object","values","ContentGroup","_ref","_children$props","_children$props$child","contentType","isFaqContent","children","customHtmlProps","props","_objectWithoutProperties","_excluded","
|
|
1
|
+
{"version":3,"file":"ContentGroup.js","names":["React","Fragment","useMemo","PropTypes","CONTENT_GROUP_TYPES","ContentGroupTabs","ContentGroupAccordion","ContentGroupDataFetcher","getSectionsData","buildDataSections","getStructuredDataProperties","getCustomHtmlProperties","VALID_TYPES","Object","values","ContentGroup","_ref","_children$props","_children$props$child","contentType","isFaqContent","children","customHtmlProps","simpleData","dataProperty","props","_objectWithoutProperties","_excluded","hasSimpleData","Array","isArray","length","dataPropertyName","hasDataProperty","childGroupSections","GroupComponent","ACCORDION","WrapperComponent","_useMemo","structuredDataProperties","_objectSpread","topWrapperProps","schemaProperties","_excluded2","includes","createElement","_extends","groupSections","sectionsData","propTypes","object","oneOf","isRequired","bool","arrayOf","shape","name","string","value","label","text","oneOfType","defaultProps"],"sources":["../../../src/components/ContentGroup/ContentGroup.js"],"sourcesContent":["import React, { Fragment, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { CONTENT_GROUP_TYPES } from './constants';\nimport ContentGroupTabs from './ContentGroupTabs';\nimport ContentGroupAccordion from './ContentGroupAccordion';\nimport ContentGroupDataFetcher from './ContentGroupDataFetcher';\nimport { getSectionsData, buildDataSections } from './helpers';\nimport getStructuredDataProperties from './helpers/get-structured-data-properties';\nimport { getCustomHtmlProperties } from '../../helpers';\n\nconst VALID_TYPES = Object.values(CONTENT_GROUP_TYPES);\n\nconst ContentGroup = ({\n contentType,\n isFaqContent,\n children,\n customHtmlProps,\n simpleData,\n dataProperty,\n ...props\n}) => {\n const hasSimpleData = Array.isArray(simpleData) && simpleData.length > 0;\n const dataPropertyName = Array.isArray(dataProperty) ? dataProperty[0] : dataProperty;\n const hasDataProperty = !!dataPropertyName;\n\n const childGroupSections = children?.props?.children?.[1];\n\n const GroupComponent = useMemo(\n () =>\n contentType === CONTENT_GROUP_TYPES.ACCORDION ? ContentGroupAccordion : ContentGroupTabs,\n [contentType]\n );\n const WrapperComponent = useMemo(() => (!isFaqContent ? Fragment : 'div'), [isFaqContent]);\n\n const { topWrapperProps, ...schemaProperties } = useMemo(() => {\n const structuredDataProperties = getStructuredDataProperties(isFaqContent);\n return {\n ...structuredDataProperties,\n topWrapperProps: {\n ...structuredDataProperties.topWrapperProps,\n ...getCustomHtmlProperties({ customHtmlProps })\n }\n };\n }, [isFaqContent, customHtmlProps]);\n\n if (!VALID_TYPES.includes(contentType)) return '';\n\n if (!hasSimpleData && hasDataProperty) {\n return (\n <WrapperComponent {...topWrapperProps}>\n <ContentGroupDataFetcher\n dataProperty={dataPropertyName}\n contentType={contentType}\n {...props}\n {...schemaProperties}\n />\n </WrapperComponent>\n );\n }\n\n let groupSections;\n let sectionsData;\n\n if (hasSimpleData) {\n ({ groupSections, sectionsData } = buildDataSections(simpleData));\n } else {\n groupSections = childGroupSections;\n if (!groupSections || !groupSections.length) return '';\n sectionsData = getSectionsData(groupSections);\n }\n if (!groupSections || !groupSections.length) return '';\n\n return (\n <WrapperComponent {...topWrapperProps}>\n <GroupComponent\n contentType={contentType}\n groupSections={groupSections}\n sectionsData={sectionsData}\n {...props}\n {...schemaProperties}\n />\n </WrapperComponent>\n );\n};\n\nContentGroup.propTypes = {\n children: PropTypes.object,\n contentType: PropTypes.oneOf(VALID_TYPES).isRequired,\n isFaqContent: PropTypes.bool,\n customHtmlProps: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.string\n })\n ),\n simpleData: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n text: PropTypes.string\n })\n ),\n dataProperty: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)])\n};\n\nContentGroup.defaultProps = {\n children: null,\n isFaqContent: false,\n customHtmlProps: [],\n simpleData: null,\n dataProperty: null\n};\n\nexport default ContentGroup;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,mBAAmB,QAAQ,aAAa;AACjD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,OAAOC,uBAAuB,MAAM,2BAA2B;AAC/D,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,WAAW;AAC9D,OAAOC,2BAA2B,MAAM,0CAA0C;AAClF,SAASC,uBAAuB,QAAQ,eAAe;AAEvD,MAAMC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACV,mBAAmB,CAAC;AAEtD,MAAMW,YAAY,GAAGC,IAAA,IAQf;EAAA,IAAAC,eAAA,EAAAC,qBAAA;EAAA,IARgB;MACpBC,WAAW;MACXC,YAAY;MACZC,QAAQ;MACRC,eAAe;MACfC,UAAU;MACVC;IAEF,CAAC,GAAAR,IAAA;IADIS,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA;EAER,MAAMC,aAAa,GAAGC,KAAK,CAACC,OAAO,CAACP,UAAU,CAAC,IAAIA,UAAU,CAACQ,MAAM,GAAG,CAAC;EACxE,MAAMC,gBAAgB,GAAGH,KAAK,CAACC,OAAO,CAACN,YAAY,CAAC,GAAGA,YAAY,CAAC,CAAC,CAAC,GAAGA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,EAAEzD,SAAS,CAACsD;EAClB,CAAC,CACH,CAAC;EACDjC,YAAY,EAAErB,SAAS,CAAC0D,SAAS,CAAC,CAAC1D,SAAS,CAACsD,MAAM,EAAEtD,SAAS,CAACmD,OAAO,CAACnD,SAAS,CAACsD,MAAM,CAAC,CAAC;AAC3F,CAAC;AAED1C,YAAY,CAAC+C,YAAY,GAAG;EAC1BzC,QAAQ,EAAE,IAAI;EACdD,YAAY,EAAE,KAAK;EACnBE,eAAe,EAAE,EAAE;EACnBC,UAAU,EAAE,IAAI;EAChBC,YAAY,EAAE;AAChB,CAAC;AAED,eAAeT,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["dataProperty", "parent", "contentType"];
|
|
4
|
+
import React, { useContext, useMemo } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { useQuery, gql } from '@apollo/client';
|
|
7
|
+
import { MainContext } from '@blaze-cms/nextjs-components';
|
|
8
|
+
import { getSingleEntitySchema, generateSingleItemQuery } from '../../application/query';
|
|
9
|
+
import ContentGroupTabs from './ContentGroupTabs';
|
|
10
|
+
import ContentGroupAccordion from './ContentGroupAccordion';
|
|
11
|
+
import { buildDataSections } from './helpers';
|
|
12
|
+
import { CONTENT_GROUP_TYPES } from './constants';
|
|
13
|
+
const PLACEHOLDER_QUERY = gql`
|
|
14
|
+
query {
|
|
15
|
+
__typename
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
const ContentGroupDataFetcher = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
dataProperty,
|
|
21
|
+
parent,
|
|
22
|
+
contentType
|
|
23
|
+
} = _ref,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
const {
|
|
26
|
+
isPreview
|
|
27
|
+
} = useContext(MainContext);
|
|
28
|
+
const dataPropertyName = Array.isArray(dataProperty) ? dataProperty[0] : dataProperty;
|
|
29
|
+
const {
|
|
30
|
+
data: schemaData,
|
|
31
|
+
loading: schemaLoading
|
|
32
|
+
} = useQuery(getSingleEntitySchema, {
|
|
33
|
+
variables: {
|
|
34
|
+
id: parent === null || parent === void 0 ? void 0 : parent.itemEntity
|
|
35
|
+
},
|
|
36
|
+
skip: !(parent === null || parent === void 0 ? void 0 : parent.itemEntity) || !dataPropertyName
|
|
37
|
+
});
|
|
38
|
+
const dataQuery = useMemo(() => {
|
|
39
|
+
if (!schemaData) return null;
|
|
40
|
+
const {
|
|
41
|
+
getEntitySchema
|
|
42
|
+
} = schemaData;
|
|
43
|
+
const {
|
|
44
|
+
actions: {
|
|
45
|
+
getPublished,
|
|
46
|
+
get
|
|
47
|
+
} = {}
|
|
48
|
+
} = getEntitySchema;
|
|
49
|
+
const actionKey = isPreview ? get : getPublished || get;
|
|
50
|
+
if (!actionKey) return null;
|
|
51
|
+
return generateSingleItemQuery(actionKey, `${dataPropertyName} { label text }`);
|
|
52
|
+
}, [schemaData, isPreview, dataPropertyName]);
|
|
53
|
+
const {
|
|
54
|
+
data: recordData,
|
|
55
|
+
loading: recordLoading
|
|
56
|
+
} = useQuery(dataQuery || PLACEHOLDER_QUERY, {
|
|
57
|
+
variables: {
|
|
58
|
+
id: parent === null || parent === void 0 ? void 0 : parent.itemId
|
|
59
|
+
},
|
|
60
|
+
skip: !dataQuery || !(parent === null || parent === void 0 ? void 0 : parent.itemId)
|
|
61
|
+
});
|
|
62
|
+
if (schemaLoading || recordLoading) return '';
|
|
63
|
+
if (!(recordData === null || recordData === void 0 ? void 0 : recordData.entityData)) return null;
|
|
64
|
+
const propertyData = recordData.entityData[dataPropertyName];
|
|
65
|
+
if (!propertyData || !propertyData.length) return null;
|
|
66
|
+
const {
|
|
67
|
+
groupSections,
|
|
68
|
+
sectionsData
|
|
69
|
+
} = buildDataSections(propertyData);
|
|
70
|
+
if (!groupSections.length) return null;
|
|
71
|
+
const GroupComponent = contentType === CONTENT_GROUP_TYPES.ACCORDION ? ContentGroupAccordion : ContentGroupTabs;
|
|
72
|
+
return /*#__PURE__*/React.createElement(GroupComponent, _extends({
|
|
73
|
+
contentType: contentType,
|
|
74
|
+
groupSections: groupSections,
|
|
75
|
+
sectionsData: sectionsData
|
|
76
|
+
}, props));
|
|
77
|
+
};
|
|
78
|
+
ContentGroupDataFetcher.propTypes = {
|
|
79
|
+
dataProperty: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
80
|
+
parent: PropTypes.object,
|
|
81
|
+
contentType: PropTypes.string.isRequired
|
|
82
|
+
};
|
|
83
|
+
ContentGroupDataFetcher.defaultProps = {
|
|
84
|
+
dataProperty: null,
|
|
85
|
+
parent: null
|
|
86
|
+
};
|
|
87
|
+
export default ContentGroupDataFetcher;
|
|
88
|
+
//# sourceMappingURL=ContentGroupDataFetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentGroupDataFetcher.js","names":["React","useContext","useMemo","PropTypes","useQuery","gql","MainContext","getSingleEntitySchema","generateSingleItemQuery","ContentGroupTabs","ContentGroupAccordion","buildDataSections","CONTENT_GROUP_TYPES","PLACEHOLDER_QUERY","ContentGroupDataFetcher","_ref","dataProperty","parent","contentType","props","_objectWithoutProperties","_excluded","isPreview","dataPropertyName","Array","isArray","data","schemaData","loading","schemaLoading","variables","id","itemEntity","skip","dataQuery","getEntitySchema","actions","getPublished","get","actionKey","recordData","recordLoading","itemId","entityData","propertyData","length","groupSections","sectionsData","GroupComponent","ACCORDION","createElement","_extends","propTypes","oneOfType","string","arrayOf","object","isRequired","defaultProps"],"sources":["../../../src/components/ContentGroup/ContentGroupDataFetcher.js"],"sourcesContent":["import React, { useContext, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery, gql } from '@apollo/client';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { getSingleEntitySchema, generateSingleItemQuery } from '../../application/query';\nimport ContentGroupTabs from './ContentGroupTabs';\nimport ContentGroupAccordion from './ContentGroupAccordion';\nimport { buildDataSections } from './helpers';\nimport { CONTENT_GROUP_TYPES } from './constants';\n\nconst PLACEHOLDER_QUERY = gql`\n query {\n __typename\n }\n`;\n\nconst ContentGroupDataFetcher = ({ dataProperty, parent, contentType, ...props }) => {\n const { isPreview } = useContext(MainContext);\n const dataPropertyName = Array.isArray(dataProperty) ? dataProperty[0] : dataProperty;\n\n const { data: schemaData, loading: schemaLoading } = useQuery(getSingleEntitySchema, {\n variables: { id: parent?.itemEntity },\n skip: !parent?.itemEntity || !dataPropertyName\n });\n\n const dataQuery = useMemo(() => {\n if (!schemaData) return null;\n const { getEntitySchema } = schemaData;\n const { actions: { getPublished, get } = {} } = getEntitySchema;\n const actionKey = isPreview ? get : getPublished || get;\n if (!actionKey) return null;\n return generateSingleItemQuery(actionKey, `${dataPropertyName} { label text }`);\n }, [schemaData, isPreview, dataPropertyName]);\n\n const { data: recordData, loading: recordLoading } = useQuery(dataQuery || PLACEHOLDER_QUERY, {\n variables: { id: parent?.itemId },\n skip: !dataQuery || !parent?.itemId\n });\n\n if (schemaLoading || recordLoading) return '';\n if (!recordData?.entityData) return null;\n\n const propertyData = recordData.entityData[dataPropertyName];\n if (!propertyData || !propertyData.length) return null;\n\n const { groupSections, sectionsData } = buildDataSections(propertyData);\n\n if (!groupSections.length) return null;\n\n const GroupComponent =\n contentType === CONTENT_GROUP_TYPES.ACCORDION ? ContentGroupAccordion : ContentGroupTabs;\n\n return (\n <GroupComponent\n contentType={contentType}\n groupSections={groupSections}\n sectionsData={sectionsData}\n {...props}\n />\n );\n};\n\nContentGroupDataFetcher.propTypes = {\n dataProperty: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),\n parent: PropTypes.object,\n contentType: PropTypes.string.isRequired\n};\n\nContentGroupDataFetcher.defaultProps = {\n dataProperty: null,\n parent: null\n};\n\nex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AAA,CAAAkD,aAAA,CAACF,cAAc,EAAAG,QAAA;IACbjC,WAAW,EAAEA,WAAY;IACzB4B,aAAa,EAAEA,aAAc;IAC7BC,YAAY,EAAEA;EAAa,GACvB5B,KAAK,CACV,CAAC;AAEN,CAAC;AAEDL,uBAAuB,CAACsC,SAAS,GAAG;EAClCpC,YAAY,EAAEb,SAAS,CAACkD,SAAS,CAAC,CAAClD,SAAS,CAACmD,MAAM,EAAEnD,SAAS,CAACoD,OAAO,CAACpD,SAAS,CAACmD,MAAM,CAAC,CAAC,CAAC;EAC1FrC,MAAM,EAAEd,SAAS,CAACqD,MAAM;EACxBtC,WAAW,EAAEf,SAAS,CAACmD,MAAM,CAACG;AAChC,CAAC;AAED3C,uBAAuB,CAAC4C,YAAY,GAAG;EACrC1C,YAAY,EAAE,IAAI;EAClBC,MAAM,EAAE;AACV,CAAC;AAED,eAAeH,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import dynamic from 'next/dynamic';
|
|
3
|
+
import getComponentId from '../../../helpers/get-component-id';
|
|
4
|
+
const TextBlock = dynamic(() => import('../../TextBlock'));
|
|
5
|
+
const ContentGroupSection = dynamic(() => import('../../ContentGroupSection'));
|
|
6
|
+
const buildDataSections = (items = []) => {
|
|
7
|
+
const itemData = items.map((item, i) => {
|
|
8
|
+
if (!item || !item.text || !item.label) return null;
|
|
9
|
+
const sectionName = getComponentId(item.label || `section-${i}`, true, true);
|
|
10
|
+
return {
|
|
11
|
+
sectionName,
|
|
12
|
+
label: item.label,
|
|
13
|
+
sectionContent: /*#__PURE__*/React.createElement(ContentGroupSection, {
|
|
14
|
+
key: sectionName,
|
|
15
|
+
name: sectionName,
|
|
16
|
+
disableChildCheck: true
|
|
17
|
+
}, /*#__PURE__*/React.createElement(TextBlock, {
|
|
18
|
+
html: item.text,
|
|
19
|
+
name: `${sectionName}-text`
|
|
20
|
+
}))
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
return itemData.filter(Boolean).reduce((acc, {
|
|
24
|
+
sectionName,
|
|
25
|
+
label,
|
|
26
|
+
sectionContent
|
|
27
|
+
}) => {
|
|
28
|
+
if (!sectionName || !sectionContent) return acc;
|
|
29
|
+
acc.groupSections.push(sectionContent);
|
|
30
|
+
acc.sectionsData.push([sectionName, label]);
|
|
31
|
+
return acc;
|
|
32
|
+
}, {
|
|
33
|
+
groupSections: [],
|
|
34
|
+
sectionsData: []
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export default buildDataSections;
|
|
38
|
+
//# sourceMappingURL=build-data-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-data-sections.js","names":["React","dynamic","getComponentId","TextBlock","ContentGroupSection","buildDataSections","items","itemData","map","item","i","text","label","sectionName","sectionContent","createElement","key","name","disableChildCheck","html","filter","Boolean","reduce","acc","groupSections","push","sectionsData"],"sources":["../../../../src/components/ContentGroup/helpers/build-data-sections.js"],"sourcesContent":["import React from 'react';\nimport dynamic from 'next/dynamic';\nimport getComponentId from '../../../helpers/get-component-id';\n\nconst TextBlock = dynamic(() => import('../../TextBlock'));\nconst ContentGroupSection = dynamic(() => import('../../ContentGroupSection'));\n\nconst buildDataSections = (items = []) => {\n const itemData = items.map((item, i) => {\n if (!item || !item.text || !item.label) return null;\n\n const sectionName = getComponentId(item.label || `section-${i}`, true, true);\n return {\n sectionName,\n label: item.label,\n sectionContent: (\n <ContentGroupSection key={sectionName} name={sectionName} disableChildCheck>\n <TextBlock html={item.text} name={`${sectionName}-text`} />\n </ContentGroupSection>\n )\n };\n });\n\n return itemData.filter(Boolean).reduce(\n (acc, { sectionName, label, sectionContent }) => {\n if (!sectionName || !sectionContent) return acc;\n acc.groupSections.push(sectionContent);\n acc.sectionsData.push([sectionName, label]);\n return acc;\n },\n { groupSections: [], sectionsData: [] }\n );\n};\n\nexport default buildDataSections;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,O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C,CAACZ,WAAW,EAAED,KAAK,CAAC,CAAC;IAC3C,OAAOW,GAAG;EACZ,CAAC,EACD;IAAEC,aAAa,EAAE,EAAE;IAAEE,YAAY,EAAE;EAAG,CACxC,CAAC;AACH,CAAC;AAED,eAAerB,iBAAiB","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import getSectionsData from './get-sections-data';
|
|
2
2
|
import getActiveTab from './get-active-tab';
|
|
3
|
-
|
|
3
|
+
import buildDataSections from './build-data-sections';
|
|
4
|
+
export { getSectionsData, getActiveTab, buildDataSections };
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getSectionsData","getActiveTab"],"sources":["../../../../src/components/ContentGroup/helpers/index.js"],"sourcesContent":["import getSectionsData from './get-sections-data';\nimport getActiveTab from './get-active-tab';\n\nexport { getSectionsData, getActiveTab };\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,qBAAqB;AACjD,OAAOC,YAAY,MAAM,kBAAkB;
|
|
1
|
+
{"version":3,"file":"index.js","names":["getSectionsData","getActiveTab","buildDataSections"],"sources":["../../../../src/components/ContentGroup/helpers/index.js"],"sourcesContent":["import getSectionsData from './get-sections-data';\nimport getActiveTab from './get-active-tab';\nimport buildDataSections from './build-data-sections';\n\nexport { getSectionsData, getActiveTab, buildDataSections };\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,qBAAqB;AACjD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,iBAAiB,MAAM,uBAAuB;AAErD,SAASF,eAAe,EAAEC,YAAY,EAAEC,iBAAiB","ignoreList":[]}
|
|
@@ -3,9 +3,10 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { hasChildren } from '../../helpers';
|
|
4
4
|
const ContentGroupSection = ({
|
|
5
5
|
children,
|
|
6
|
-
name
|
|
6
|
+
name,
|
|
7
|
+
disableChildCheck
|
|
7
8
|
}) => {
|
|
8
|
-
if (!hasChildren(children)) return null;
|
|
9
|
+
if (!disableChildCheck && !hasChildren(children)) return null;
|
|
9
10
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
11
|
key: name,
|
|
11
12
|
className: "content-group-section"
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","children","name","disableChildCheck","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, disableChildCheck }) => {\n if (!disableChildCheck && !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,IAAI;EAAEC;AAAkB,CAAC,KAAK;EACrE,IAAI,CAACA,iBAAiB,IAAI,CAACJ,WAAW,CAACE,QAAQ,CAAC,EAAE,OAAO,IAAI;EAE7D,oBACEJ,KAAA,CAAAO,aAAA;IAAKC,GAAG,EAAEH,IAAK;IAACI,SAAS,EAAC;EAAuB,GAC9CL,QACE,CAAC;AAEV,CAAC;AAEDD,mBAAmB,CAACO,SAAS,GAAG;EAC9BN,QAAQ,EAAEH,SAAS,CAACU,SAAS,CAAC,CAACV,SAAS,CAACW,OAAO,CAACX,SAAS,CAACY,IAAI,CAAC,EAAEZ,SAAS,CAACY,IAAI,CAAC,CAAC;EAClFR,IAAI,EAAEJ,SAAS,CAACa;AAClB,CAAC;AAEDX,mBAAmB,CAACY,YAAY,GAAG;EAAEX,QAAQ,EAAE,IAAI;EAAEC,IAAI,EAAE;AAAG,CAAC;AAE/D,eAAeF,mBAAmB","ignoreList":[]}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import IframeResizer from 'iframe-resizer-react';
|
|
4
|
+
import { useStringTemplate } from '@blaze-cms/utils-handlebars';
|
|
4
5
|
import { IFRAME_CLASS, DEFAULT_WIDTH } from './constants';
|
|
6
|
+
const UNSAFE_URL_PATTERN = /^(javascript|data):/i;
|
|
7
|
+
const isSafeUrl = url => !UNSAFE_URL_PATTERN.test(url.trim());
|
|
5
8
|
const Iframe = ({
|
|
6
9
|
src,
|
|
7
10
|
modifier,
|
|
8
11
|
width,
|
|
9
12
|
height,
|
|
10
|
-
enableScrolling
|
|
13
|
+
enableScrolling,
|
|
14
|
+
parent
|
|
11
15
|
}) => {
|
|
12
|
-
|
|
16
|
+
const {
|
|
17
|
+
data: [resolvedSrc]
|
|
18
|
+
} = useStringTemplate(parent, [src || '']);
|
|
19
|
+
if (!resolvedSrc || !isSafeUrl(resolvedSrc)) return null;
|
|
13
20
|
const modifierString = modifier ? ` ${modifier}` : '';
|
|
14
21
|
const iframeClassName = `${IFRAME_CLASS}${modifierString}`;
|
|
15
22
|
const defaultWidth = !width ? DEFAULT_WIDTH : {};
|
|
@@ -18,7 +25,7 @@ const Iframe = ({
|
|
|
18
25
|
}, /*#__PURE__*/React.createElement(IframeResizer, {
|
|
19
26
|
scrolling: enableScrolling,
|
|
20
27
|
autoResize: true,
|
|
21
|
-
src:
|
|
28
|
+
src: resolvedSrc,
|
|
22
29
|
sizeHeight: !height,
|
|
23
30
|
height: height,
|
|
24
31
|
width: width,
|
|
@@ -26,17 +33,20 @@ const Iframe = ({
|
|
|
26
33
|
}));
|
|
27
34
|
};
|
|
28
35
|
Iframe.propTypes = {
|
|
29
|
-
src: PropTypes.string
|
|
36
|
+
src: PropTypes.string,
|
|
30
37
|
enableScrolling: PropTypes.bool,
|
|
31
38
|
modifier: PropTypes.string,
|
|
32
39
|
width: PropTypes.string,
|
|
33
|
-
height: PropTypes.string
|
|
40
|
+
height: PropTypes.string,
|
|
41
|
+
parent: PropTypes.object
|
|
34
42
|
};
|
|
35
43
|
Iframe.defaultProps = {
|
|
44
|
+
src: '',
|
|
36
45
|
enableScrolling: false,
|
|
37
46
|
modifier: '',
|
|
38
47
|
width: '',
|
|
39
|
-
height: ''
|
|
48
|
+
height: '',
|
|
49
|
+
parent: {}
|
|
40
50
|
};
|
|
41
51
|
export default Iframe;
|
|
42
52
|
//# sourceMappingURL=Iframe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Iframe.js","names":["React","PropTypes","IframeResizer","IFRAME_CLASS","DEFAULT_WIDTH","Iframe","src","modifier","width","height","enableScrolling","modifierString","iframeClassName","defaultWidth","createElement","className","scrolling","autoResize","sizeHeight","style","propTypes","string","
|
|
1
|
+
{"version":3,"file":"Iframe.js","names":["React","PropTypes","IframeResizer","useStringTemplate","IFRAME_CLASS","DEFAULT_WIDTH","UNSAFE_URL_PATTERN","isSafeUrl","url","test","trim","Iframe","src","modifier","width","height","enableScrolling","parent","data","resolvedSrc","modifierString","iframeClassName","defaultWidth","createElement","className","scrolling","autoResize","sizeHeight","style","propTypes","string","bool","object","defaultProps"],"sources":["../../../src/components/Iframe/Iframe.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport IframeResizer from 'iframe-resizer-react';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport { IFRAME_CLASS, DEFAULT_WIDTH } from './constants';\n\nconst UNSAFE_URL_PATTERN = /^(javascript|data):/i;\n\nconst isSafeUrl = url => !UNSAFE_URL_PATTERN.test(url.trim());\n\nconst Iframe = ({ src, modifier, width, height, enableScrolling, parent }) => {\n const {\n data: [resolvedSrc]\n } = useStringTemplate(parent, [src || '']);\n if (!resolvedSrc || !isSafeUrl(resolvedSrc)) return null;\n const modifierString = modifier ? ` ${modifier}` : '';\n const iframeClassName = `${IFRAME_CLASS}${modifierString}`;\n const defaultWidth = !width ? DEFAULT_WIDTH : {};\n return (\n <div className={iframeClassName}>\n <IframeResizer\n scrolling={enableScrolling}\n autoResize\n src={resolvedSrc}\n sizeHeight={!height}\n height={height}\n width={width}\n style={defaultWidth}\n />\n </div>\n );\n};\n\nIframe.propTypes = {\n src: PropTypes.string,\n enableScrolling: PropTypes.bool,\n modifier: PropTypes.string,\n width: PropTypes.string,\n height: PropTypes.string,\n parent: PropTypes.object\n};\n\nIframe.defaultProps = {\n src: '',\n enableScrolling: false,\n modifier: '',\n width: '',\n height: '',\n parent: {}\n};\n\nexport default Iframe;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY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B,QAAQ,EAAEZ,SAAS,CAAC6B,MAAM;EAC1BhB,KAAK,EAAEb,SAAS,CAAC6B,MAAM;EACvBf,MAAM,EAAEd,SAAS,CAAC6B,MAAM;EACxBb,MAAM,EAAEhB,SAAS,CAAC+B;AACpB,CAAC;AAEDrB,MAAM,CAACsB,YAAY,GAAG;EACpBrB,GAAG,EAAE,EAAE;EACPI,eAAe,EAAE,KAAK;EACtBH,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVE,MAAM,EAAE,CAAC;AACX,CAAC;AAED,eAAeN,MAAM","ignoreList":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "tagType", "dataNoSnippet", "sticky", "VariantComponent", "customHtmlProps"];
|
|
4
|
+
const _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "backgroundImageUrl", "parent", "tagType", "dataNoSnippet", "sticky", "VariantComponent", "customHtmlProps"];
|
|
5
5
|
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; }
|
|
6
6
|
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) { _defineProperty(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; }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import { useStringTemplate } from '@blaze-cms/utils-handlebars';
|
|
9
10
|
import Wrapper from '../Wrapper';
|
|
10
11
|
import { getClassModifiers } from '../../utils';
|
|
11
12
|
import { useGetImages } from '../../hooks';
|
|
@@ -19,6 +20,8 @@ const Layout = React.forwardRef((_ref, ref) => {
|
|
|
19
20
|
settings,
|
|
20
21
|
modifier,
|
|
21
22
|
backgroundImage,
|
|
23
|
+
backgroundImageUrl,
|
|
24
|
+
parent,
|
|
22
25
|
tagType,
|
|
23
26
|
dataNoSnippet,
|
|
24
27
|
sticky,
|
|
@@ -26,15 +29,19 @@ const Layout = React.forwardRef((_ref, ref) => {
|
|
|
26
29
|
customHtmlProps = []
|
|
27
30
|
} = _ref,
|
|
28
31
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
const {
|
|
33
|
+
data: [resolvedBackgroundImageUrl]
|
|
34
|
+
} = useStringTemplate(parent, [backgroundImageUrl || '']);
|
|
29
35
|
const {
|
|
30
36
|
data: {
|
|
31
37
|
getFile: {
|
|
32
38
|
url = null
|
|
33
39
|
} = {}
|
|
34
40
|
}
|
|
35
|
-
} = useGetImages(backgroundImage);
|
|
41
|
+
} = useGetImages(backgroundImage, false, !!resolvedBackgroundImageUrl);
|
|
42
|
+
const backgroundUrl = resolvedBackgroundImageUrl || url;
|
|
36
43
|
const style = getStylesToUpdate({
|
|
37
|
-
backgroundImage:
|
|
44
|
+
backgroundImage: backgroundUrl
|
|
38
45
|
});
|
|
39
46
|
const {
|
|
40
47
|
title
|
|
@@ -69,6 +76,8 @@ Layout.propTypes = {
|
|
|
69
76
|
}),
|
|
70
77
|
modifier: PropTypes.string,
|
|
71
78
|
backgroundImage: PropTypes.string,
|
|
79
|
+
backgroundImageUrl: PropTypes.string,
|
|
80
|
+
parent: PropTypes.object,
|
|
72
81
|
tagType: PropTypes.string,
|
|
73
82
|
dataNoSnippet: PropTypes.bool,
|
|
74
83
|
VariantComponent: PropTypes.func,
|
|
@@ -83,6 +92,8 @@ Layout.defaultProps = {
|
|
|
83
92
|
title: ''
|
|
84
93
|
},
|
|
85
94
|
backgroundImage: '',
|
|
95
|
+
backgroundImageUrl: '',
|
|
96
|
+
parent: {},
|
|
86
97
|
modifier: '',
|
|
87
98
|
tagType: '',
|
|
88
99
|
dataNoSnippet: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","names":["React","PropTypes","Wrapper","getClassModifiers","useGetImages","getStylesToUpdate","checkIfRowHasColumns","renderChildren","hasChildren","getCustomHtmlProperties","COLUMN","Layout","forwardRef","_ref","ref","type","children","settings","modifier","backgroundImage","tagType","dataNoSnippet","sticky","VariantComponent","customHtmlProps","otherProps","_objectWithoutProperties","_excluded","data","getFile","url","style","title","classModifiers","_objectSpread","additionalRowModifier","otherWrapperProps","customHtmlProperties","WrapperComponent","createElement","_extends","className","modifiers","propTypes","string","isRequired","bool","shape","func","arrayOf","name","value","oneOfType","node","defaultProps"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren, getCustomHtmlProperties } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = React.forwardRef(\n (\n {\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n tagType,\n dataNoSnippet,\n sticky,\n VariantComponent,\n customHtmlProps = [],\n ...otherProps\n },\n ref\n ) => {\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage);\n const style = getStylesToUpdate({ backgroundImage:
|
|
1
|
+
{"version":3,"file":"Layout.js","names":["React","PropTypes","useStringTemplate","Wrapper","getClassModifiers","useGetImages","getStylesToUpdate","checkIfRowHasColumns","renderChildren","hasChildren","getCustomHtmlProperties","COLUMN","Layout","forwardRef","_ref","ref","type","children","settings","modifier","backgroundImage","backgroundImageUrl","parent","tagType","dataNoSnippet","sticky","VariantComponent","customHtmlProps","otherProps","_objectWithoutProperties","_excluded","data","resolvedBackgroundImageUrl","getFile","url","backgroundUrl","style","title","classModifiers","_objectSpread","additionalRowModifier","otherWrapperProps","customHtmlProperties","WrapperComponent","createElement","_extends","className","modifiers","propTypes","string","isRequired","bool","shape","object","func","arrayOf","name","value","oneOfType","node","defaultProps"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren, getCustomHtmlProperties } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = React.forwardRef(\n (\n {\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n backgroundImageUrl,\n parent,\n tagType,\n dataNoSnippet,\n sticky,\n VariantComponent,\n customHtmlProps = [],\n ...otherProps\n },\n ref\n ) => {\n const {\n data: [resolvedBackgroundImageUrl]\n } = useStringTemplate(parent, [backgroundImageUrl || '']);\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage, false, !!resolvedBackgroundImageUrl);\n const backgroundUrl = resolvedBackgroundImageUrl || url;\n const style = getStylesToUpdate({ backgroundImage: backgroundUrl });\n const { title } = settings;\n const classModifiers = getClassModifiers(type, { modifier, sticky, ...otherProps });\n const additionalRowModifier = checkIfRowHasColumns(type, children) ? ' display-row' : '';\n\n if (type === COLUMN && !hasChildren(children)) return null;\n\n const otherWrapperProps = {};\n if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;\n\n const customHtmlProperties = getCustomHtmlProperties({ customHtmlProps });\n\n const WrapperComponent = VariantComponent || Wrapper;\n\n return (\n <WrapperComponent\n ref={ref}\n tagType={tagType}\n className={type}\n modifiers={`${classModifiers}${additionalRowModifier}`}\n style={style}\n {...otherWrapperProps}\n {...customHtmlProperties}>\n {title && <h2 className=\"heading heading--section\">{title}</h2>}\n {renderChildren(children, otherProps)}\n </WrapperComponent>\n );\n }\n);\n\nLayout.propTypes = {\n type: PropTypes.string.isRequired,\n sticky: PropTypes.bool,\n settings: PropTypes.shape({\n title: PropTypes.string\n }),\n modifier: PropTypes.string,\n backgroundImage: PropTypes.string,\n backgroundImageUrl: PropTypes.string,\n parent: PropTypes.object,\n tagType: PropTypes.string,\n dataNoSnippet: PropTypes.bool,\n VariantComponent: PropTypes.func,\n customHtmlProps: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.string\n })\n ),\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nLayout.defaultProps = {\n settings: {\n title: ''\n },\n backgroundImage: '',\n backgroundImageUrl: '',\n parent: {},\n modifier: '',\n tagType: '',\n dataNoSnippet: false,\n sticky: false,\n VariantComponent: null,\n customHtmlProps: []\n};\n\nexport default Layout;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,iBAAiB,EAAEC,oBAAoB,QAAQ,WAAW;AACnE,SAASC,cAAc,EAAEC,WAAW,EAAEC,uBAAuB,QAAQ,eAAe;AACpF,SAASC,MAAM,QAAQ,iBAAiB;AAExC,MAAMC,MAAM,GAAGZ,KAAK,CAACa,UAAU,CAC7B,CAAAC,IAAA,EAgBEC,GAAG,KACA;EAAA,IAhBH;MACEC,IAAI;MACJC,QAAQ;MACRC,QAAQ;MACRC,QAAQ;MACRC,eAAe;MACfC,kBAAkB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C,CAACT;AACrF,CAAC;AAEDtC,MAAM,CAACgD,YAAY,GAAG;EACpB1C,QAAQ,EAAE;IACRmB,KAAK,EAAE;EACT,CAAC;EACDjB,eAAe,EAAE,EAAE;EACnBC,kBAAkB,EAAE,EAAE;EACtBC,MAAM,EAAE,CAAC,CAAC;EACVH,QAAQ,EAAE,EAAE;EACZI,OAAO,EAAE,EAAE;EACXC,aAAa,EAAE,KAAK;EACpBC,MAAM,EAAE,KAAK;EACbC,gBAAgB,EAAE,IAAI;EACtBC,eAAe,EAAE;AACnB,CAAC;AAED,eAAef,MAAM","ignoreList":[]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import cssesc from 'cssesc';
|
|
2
2
|
import { COMPONENT_ID_PREFIX } from '../constants';
|
|
3
|
-
const getComponentId = componentName
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const getComponentId = (componentName, noPrefix = false, toLowerCase = false) => {
|
|
4
|
+
let id = `${noPrefix ? '' : COMPONENT_ID_PREFIX}${componentName.replace(/\s+/g, '-')}`;
|
|
5
|
+
if (toLowerCase) {
|
|
6
|
+
id = id.toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
return cssesc(id, {
|
|
9
|
+
isIdentifier: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
6
12
|
export default getComponentId;
|
|
7
13
|
//# sourceMappingURL=get-component-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-component-id.js","names":["cssesc","COMPONENT_ID_PREFIX","getComponentId","componentName","replace","isIdentifier"],"sources":["../../src/helpers/get-component-id.js"],"sourcesContent":["import cssesc from 'cssesc';\nimport { COMPONENT_ID_PREFIX } from '../constants';\n\nconst getComponentId = componentName
|
|
1
|
+
{"version":3,"file":"get-component-id.js","names":["cssesc","COMPONENT_ID_PREFIX","getComponentId","componentName","noPrefix","toLowerCase","id","replace","isIdentifier"],"sources":["../../src/helpers/get-component-id.js"],"sourcesContent":["import cssesc from 'cssesc';\nimport { COMPONENT_ID_PREFIX } from '../constants';\n\nconst getComponentId = (componentName, noPrefix = false, toLowerCase = false) => {\n let id = `${noPrefix ? '' : COMPONENT_ID_PREFIX}${componentName.replace(/\\s+/g, '-')}`;\n if (toLowerCase) {\n id = id.toLowerCase();\n }\n return cssesc(id, { isIdentifier: true });\n};\n\nexport default getComponentId;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ,cAAc;AAElD,MAAMC,cAAc,GAAGA,CAACC,aAAa,EAAEC,QAAQ,GAAG,KAAK,EAAEC,WAAW,GAAG,KAAK,KAAK;EAC/E,IAAIC,EAAE,GAAG,GAAGF,QAAQ,GAAG,EAAE,GAAGH,mBAAmB,GAAGE,aAAa,CAACI,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;EACtF,IAAIF,WAAW,EAAE;IACfC,EAAE,GAAGA,EAAE,CAACD,WAAW,CAAC,CAAC;EACvB;EACA,OAAOL,MAAM,CAACM,EAAE,EAAE;IAAEE,YAAY,EAAE;EAAK,CAAC,CAAC;AAC3C,CAAC;AAED,eAAeN,cAAc","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.147.0-rc-eagle.
|
|
3
|
+
"version": "0.147.0-rc-eagle.6",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@blaze-cms/core-errors": "0.147.0-rc-eagle.4",
|
|
37
37
|
"@blaze-cms/core-errors-ui": "0.147.0-rc-eagle.4",
|
|
38
38
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.7",
|
|
39
|
-
"@blaze-cms/nextjs-components": "0.147.0-rc-eagle.
|
|
40
|
-
"@blaze-cms/plugin-search-ui": "0.147.0-rc-eagle.
|
|
39
|
+
"@blaze-cms/nextjs-components": "0.147.0-rc-eagle.6",
|
|
40
|
+
"@blaze-cms/plugin-search-ui": "0.147.0-rc-eagle.6",
|
|
41
41
|
"@blaze-cms/setup-ui": "0.147.0-rc-eagle.4",
|
|
42
42
|
"@blaze-cms/utils": "0.147.0-rc-eagle.4",
|
|
43
|
-
"@blaze-cms/utils-handlebars": "0.147.0-rc-eagle.
|
|
43
|
+
"@blaze-cms/utils-handlebars": "0.147.0-rc-eagle.6",
|
|
44
44
|
"@blaze-react/badge": "^0.7.0",
|
|
45
45
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
46
46
|
"@blaze-react/button": "0.8.0-alpha.82",
|
|
@@ -70,7 +70,6 @@
|
|
|
70
70
|
"react-jw-player": "^1.19.1",
|
|
71
71
|
"react-player": "^2.10.1",
|
|
72
72
|
"react-waypoint": "^9.0.2",
|
|
73
|
-
"regenerator-runtime": "^0.13.3",
|
|
74
73
|
"uuid": "^3.3.3",
|
|
75
74
|
"video-react": "0.14.1"
|
|
76
75
|
},
|
|
@@ -89,5 +88,6 @@
|
|
|
89
88
|
"eslintIgnore": [
|
|
90
89
|
"lib/*",
|
|
91
90
|
"lib-es/*"
|
|
92
|
-
]
|
|
91
|
+
],
|
|
92
|
+
"gitHead": "bcec507f4cd89a2573e960c326852e44b103feb0"
|
|
93
93
|
}
|