@blaze-cms/react-page-builder 0.129.0 → 0.130.0-structured-data.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 +20 -0
- package/lib/components/Card/CardsContainer.js +15 -10
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/CarouselWrapper/CarouselWrapper.js +29 -0
- package/lib/components/CarouselWrapper/CarouselWrapper.js.map +1 -0
- package/lib/components/{CarouselWrapper.js → CarouselWrapper/DefaultCarousel.js} +8 -11
- package/lib/components/CarouselWrapper/DefaultCarousel.js.map +1 -0
- package/lib/components/CarouselWrapper/SmoothScrollCarousel.js +51 -0
- package/lib/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -0
- package/lib/components/CarouselWrapper/index.js +12 -0
- package/lib/components/CarouselWrapper/index.js.map +1 -0
- package/lib/components/List/ListBuilder.js +1 -7
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +4 -2
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/helpers/get-list-component.js +17 -0
- package/lib/components/List/helpers/get-list-component.js.map +1 -0
- package/lib/components/List/helpers/index.js +7 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +26 -1
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib-es/components/Card/CardsContainer.js +15 -10
- package/lib-es/components/Card/CardsContainer.js.map +1 -1
- package/lib-es/components/CarouselWrapper/CarouselWrapper.js +22 -0
- package/lib-es/components/CarouselWrapper/CarouselWrapper.js.map +1 -0
- package/lib-es/components/{CarouselWrapper.js → CarouselWrapper/DefaultCarousel.js} +8 -11
- package/lib-es/components/CarouselWrapper/DefaultCarousel.js.map +1 -0
- package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js +43 -0
- package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -0
- package/lib-es/components/CarouselWrapper/index.js +3 -0
- package/lib-es/components/CarouselWrapper/index.js.map +1 -0
- package/lib-es/components/List/ListBuilder.js +2 -8
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +2 -2
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib-es/components/List/helpers/get-list-component.js +9 -0
- package/lib-es/components/List/helpers/get-list-component.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +1 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib-es/helpers/get-entities-with-banner.js +18 -1
- package/lib-es/helpers/get-entities-with-banner.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Card/CardsContainer.js +17 -8
- package/src/components/CarouselWrapper/CarouselWrapper.js +19 -0
- package/src/components/{CarouselWrapper.js → CarouselWrapper/DefaultCarousel.js} +9 -10
- package/src/components/CarouselWrapper/SmoothScrollCarousel.js +44 -0
- package/src/components/CarouselWrapper/index.js +3 -0
- package/src/components/List/ListBuilder.js +2 -15
- package/src/components/List/ListFactory.js +2 -2
- package/src/components/List/components/Cards/CardsRender.js +0 -1
- package/src/components/List/helpers/get-list-component.js +15 -0
- package/src/components/List/helpers/index.js +1 -0
- package/src/helpers/get-entities-with-banner.js +7 -2
- package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +1 -0
- package/tests/unit/src/components/CarouselWrapper.test.js +9 -0
- package/tests/unit/src/components/List/helpers/get-list-component.test.js +21 -0
- package/tests/unit/src/components/__snapshots__/CarouselWrapper.test.js.snap +53 -0
- package/lib/components/CarouselWrapper.js.map +0 -1
- package/lib-es/components/CarouselWrapper.js.map +0 -1
- package/tests/unit/src/components/List/components/Cards/CardRenderWithInfiniteScroll.test.js +0 -12
- package/tests/unit/src/components/List/components/Full/FullRenderWithInfiniteScroll.test.js +0 -12
|
@@ -6,12 +6,11 @@ import React from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useQuery } from '@apollo/client';
|
|
8
8
|
import { getStringTypeProps } from '@blaze-cms/utils/src/helpers';
|
|
9
|
-
import { CardRenderWithInfiniteScroll, CardsRender, FullRender, FullRenderWithInfiniteScroll } from './components';
|
|
10
9
|
import ListRender from './ListRender';
|
|
11
10
|
import { getSearchPublishedContent } from '../../application/query';
|
|
12
11
|
import { buildRawQuery, buildQueryFields, buildSetFilters, getGenericRenderVariables, getEntityData, getCurrentOffset, getUpdatedFilterBy, checkPropsToUse, buildPropsQuery } from '../../helpers';
|
|
13
|
-
import { sortAggs, getItemsPerPageToUse, buildAzAggregations } from './helpers';
|
|
14
|
-
import { SEARCH_PUBLISHED_CONTENT, INFINITE
|
|
12
|
+
import { sortAggs, getItemsPerPageToUse, buildAzAggregations, getListComponent } from './helpers';
|
|
13
|
+
import { SEARCH_PUBLISHED_CONTENT, INFINITE } from '../../constants';
|
|
15
14
|
import { RAW_RESULTS } from './constants';
|
|
16
15
|
const ListBuilder = props => {
|
|
17
16
|
const {
|
|
@@ -184,9 +183,4 @@ ListBuilder.defaultProps = {
|
|
|
184
183
|
sortProperties: []
|
|
185
184
|
};
|
|
186
185
|
export default ListBuilder;
|
|
187
|
-
function getListComponent(isCard, paginationType) {
|
|
188
|
-
const isNotClassic = paginationType !== CLASSIC;
|
|
189
|
-
if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;
|
|
190
|
-
return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;
|
|
191
|
-
}
|
|
192
186
|
//# sourceMappingURL=ListBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBuilder.js","names":["React","PropTypes","useQuery","getStringTypeProps","CardRenderWithInfiniteScroll","CardsRender","FullRender","FullRenderWithInfiniteScroll","ListRender","getSearchPublishedContent","buildRawQuery","buildQueryFields","buildSetFilters","getGenericRenderVariables","getEntityData","getCurrentOffset","getUpdatedFilterBy","checkPropsToUse","buildPropsQuery","sortAggs","getItemsPerPageToUse","buildAzAggregations","SEARCH_PUBLISHED_CONTENT","INFINITE","CLASSIC","RAW_RESULTS","ListBuilder","props","mainSchemas","isCard","isAZ","inheritedFilters","paginationType","entities","isTextSearchFilterApplied","parent","itemId","itemsPerPage","itemsToDisplay","limit","propsToDisplay","offset","entityData","sortby","sort","paginationIndex","omitWrappers","operator","filterOperator","currentSchema","filterEntitySchema","requiredSchema","searchValues","azFilter","sortProperties","itemListIds","entity","isInfinite","listComponent","getListComponent","propsToDisplayValues","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","_objectSpread","docTypes","docType","type","entityTypes","eType","entityFields","itemsToDisplayToUse","limitToUse","length","shouldApplyDefaultSort","itemsPerPageToUse","initialOffset","fields","action","actionKey","updatedFilterBy","filterValues","filterBy","relations","stringProps","Object","values","azRawQuery","shouldReturnAggs","azVariables","azAction","data","error","loading","variables","skip","message","listAggregations","updatedAggregations","rawQuery","createElement","_extends","propTypes","array","isRequired","object","bool","number","string","defaultProps","isNotClassic"],"sources":["../../../src/components/List/ListBuilder.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getStringTypeProps } from '@blaze-cms/utils/src/helpers';\nimport {\n CardRenderWithInfiniteScroll,\n CardsRender,\n FullRender,\n FullRenderWithInfiniteScroll\n} from './components';\nimport ListRender from './ListRender';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildRawQuery,\n buildQueryFields,\n buildSetFilters,\n getGenericRenderVariables,\n getEntityData,\n getCurrentOffset,\n getUpdatedFilterBy,\n checkPropsToUse,\n buildPropsQuery\n} from '../../helpers';\nimport { sortAggs, getItemsPerPageToUse, buildAzAggregations } from './helpers';\nimport { SEARCH_PUBLISHED_CONTENT, INFINITE, CLASSIC } from '../../constants';\nimport { RAW_RESULTS } from './constants';\n\nconst ListBuilder = props => {\n const {\n mainSchemas,\n isCard,\n isAZ,\n inheritedFilters,\n paginationType,\n entities,\n isTextSearchFilterApplied,\n parent: { itemId },\n itemsPerPage,\n itemsToDisplay,\n limit,\n propsToDisplay,\n offset,\n entityData,\n sortby,\n sort,\n paginationIndex,\n omitWrappers,\n operator,\n filterOperator,\n currentSchema,\n filterEntitySchema,\n requiredSchema,\n searchValues,\n azFilter,\n sortProperties,\n itemListIds\n } = props;\n\n const [entity] = entities;\n const isInfinite = paginationType === INFINITE;\n const listComponent = getListComponent(isCard, paginationType);\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const entitiesTypes = entities.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n const entityFields = buildPropsQuery(filterEntitySchema, propsToDisplayValues, props) || '';\n const itemsToDisplayToUse = itemListIds || itemsToDisplay;\n const limitToUse = limit || itemsToDisplayToUse.length;\n const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;\n const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);\n const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);\n const fields = buildQueryFields(entityFields, entityTypes, !isCard);\n const action = getSearchPublishedContent(fields);\n const actionKey = SEARCH_PUBLISHED_CONTENT;\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n entityData,\n currentSchema,\n filterEntitySchema,\n itemId,\n props\n );\n\n const filterValues =\n updatedFilterBy && updatedFilterBy.length\n ? buildSetFilters({ ...props, filterBy: updatedFilterBy })\n : buildSetFilters({ ...props });\n\n const { relations = [] } = filterEntitySchema;\n const stringProps = getStringTypeProps(entity, relations, Object.values(requiredSchema));\n\n const azRawQuery = buildRawQuery(\n docTypes,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps\n },\n itemId,\n itemsToDisplayToUse,\n shouldApplyDefaultSort,\n { shouldReturnAggs: true, isAZ }\n );\n\n const azVariables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n azRawQuery,\n isTextSearchFilterApplied\n );\n\n const azAction = getSearchPublishedContent(RAW_RESULTS);\n const { data, error, loading } = useQuery(azAction, {\n variables: azVariables,\n skip: !isAZ\n });\n if (loading) return '';\n if (error) return error.message;\n\n const listAggregations = isAZ ? sortAggs(data) : [];\n const updatedAggregations = buildAzAggregations(listAggregations);\n\n const rawQuery = buildRawQuery(\n docTypes,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps,\n azFilter\n },\n itemId,\n itemsToDisplayToUse,\n shouldApplyDefaultSort,\n { shouldReturnAggs: false, isAZ }\n );\n\n const variables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n rawQuery,\n isTextSearchFilterApplied\n );\n\n return (\n <ListRender\n variables={variables}\n isInfinite={isInfinite}\n initialOffset={initialOffset}\n actionKey={actionKey}\n limitToUse={limitToUse}\n itemsPerPageToUse={itemsPerPageToUse}\n action={action}\n omitWrappers={omitWrappers}\n listComponent={listComponent}\n listAggregations={updatedAggregations}\n isAZ={isAZ}\n azFilter={azFilter}\n graphqlEntityMap={graphqlEntityMap}\n {...props}\n itemsToDisplay={itemsToDisplayToUse}\n />\n );\n};\n\nListBuilder.propTypes = {\n entities: PropTypes.array.isRequired,\n mainSchemas: PropTypes.object.isRequired,\n isCard: PropTypes.bool.isRequired,\n isAZ: PropTypes.bool.isRequired,\n isTextSearchFilterApplied: PropTypes.bool.isRequired,\n parent: PropTypes.object.isRequired,\n itemsPerPage: PropTypes.number.isRequired,\n paginationIndex: PropTypes.number.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n currentSchema: PropTypes.object.isRequired,\n filterEntitySchema: PropTypes.object.isRequired,\n requiredSchema: PropTypes.object.isRequired,\n searchValues: PropTypes.object.isRequired,\n inheritedFilters: PropTypes.array,\n entityData: PropTypes.object,\n itemsToDisplay: PropTypes.array,\n limit: PropTypes.number,\n omitWrappers: PropTypes.bool,\n offset: PropTypes.number,\n sortby: PropTypes.array,\n sort: PropTypes.string,\n operator: PropTypes.string.isRequired,\n filterOperator: PropTypes.string.isRequired,\n paginationType: PropTypes.string,\n azFilter: PropTypes.string,\n sortProperties: PropTypes.array,\n itemListIds: PropTypes.array\n};\n\nListBuilder.defaultProps = {\n sort: '',\n sortby: [],\n entityData: {},\n itemsToDisplay: [],\n itemListIds: null,\n limit: 0,\n omitWrappers: false,\n offset: 0,\n paginationType: 'infinite',\n inheritedFilters: [],\n azFilter: '',\n sortProperties: []\n};\n\nexport default ListBuilder;\nfunction getListComponent(isCard, paginationType) {\n const isNotClassic = paginationType !== CLASSIC;\n\n if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;\n\n return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SACEC,4BAA4B,EAC5BC,WAAW,EACXC,UAAU,EACVC,4BAA4B,QACvB,cAAc;AACrB,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SACEC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,yBAAyB,EACzBC,aAAa,EACbC,gBAAgB,EAChBC,kBAAkB,EAClBC,eA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UAAU;EAC1BD,gBAAgB,EAAE,EAAE;EACpBsB,QAAQ,EAAE,EAAE;EACZC,cAAc,EAAE;AAClB,CAAC;AAED,eAAe5B,WAAW;AAC1B,SAASiC,gBAAgBA,CAAC9B,MAAM,EAAEG,cAAc,EAAE;EAChD,MAAMkF,YAAY,GAAGlF,cAAc,KAAKR,OAAO;EAE/C,IAAIK,MAAM,EAAE,OAAOqF,YAAY,GAAG9G,4BAA4B,GAAGC,WAAW;EAE5E,OAAO6G,YAAY,GAAG3G,4BAA4B,GAAGD,UAAU;AACjE"}
|
|
1
|
+
{"version":3,"file":"ListBuilder.js","names":["React","PropTypes","useQuery","getStringTypeProps","ListRender","getSearchPublishedContent","buildRawQuery","buildQueryFields","buildSetFilters","getGenericRenderVariables","getEntityData","getCurrentOffset","getUpdatedFilterBy","checkPropsToUse","buildPropsQuery","sortAggs","getItemsPerPageToUse","buildAzAggregations","getListComponent","SEARCH_PUBLISHED_CONTENT","INFINITE","RAW_RESULTS","ListBuilder","props","mainSchemas","isCard","isAZ","inheritedFilters","paginationType","entities","isTextSearchFilterApplied","parent","itemId","itemsPerPage","itemsToDisplay","limit","propsToDisplay","offset","entityData","sortby","sort","paginationIndex","omitWrappers","operator","filterOperator","currentSchema","filterEntitySchema","requiredSchema","searchValues","azFilter","sortProperties","itemListIds","entity","isInfinite","listComponent","propsToDisplayValues","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","_objectSpread","docTypes","docType","type","entityTypes","eType","entityFields","itemsToDisplayToUse","limitToUse","length","shouldApplyDefaultSort","itemsPerPageToUse","initialOffset","fields","action","actionKey","updatedFilterBy","filterValues","filterBy","relations","stringProps","Object","values","azRawQuery","shouldReturnAggs","azVariables","azAction","data","error","loading","variables","skip","message","listAggregations","updatedAggregations","rawQuery","createElement","_extends","propTypes","array","isRequired","object","bool","number","string","defaultProps"],"sources":["../../../src/components/List/ListBuilder.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getStringTypeProps } from '@blaze-cms/utils/src/helpers';\nimport ListRender from './ListRender';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildRawQuery,\n buildQueryFields,\n buildSetFilters,\n getGenericRenderVariables,\n getEntityData,\n getCurrentOffset,\n getUpdatedFilterBy,\n checkPropsToUse,\n buildPropsQuery\n} from '../../helpers';\nimport { sortAggs, getItemsPerPageToUse, buildAzAggregations, getListComponent } from './helpers';\nimport { SEARCH_PUBLISHED_CONTENT, INFINITE } from '../../constants';\nimport { RAW_RESULTS } from './constants';\n\nconst ListBuilder = props => {\n const {\n mainSchemas,\n isCard,\n isAZ,\n inheritedFilters,\n paginationType,\n entities,\n isTextSearchFilterApplied,\n parent: { itemId },\n itemsPerPage,\n itemsToDisplay,\n limit,\n propsToDisplay,\n offset,\n entityData,\n sortby,\n sort,\n paginationIndex,\n omitWrappers,\n operator,\n filterOperator,\n currentSchema,\n filterEntitySchema,\n requiredSchema,\n searchValues,\n azFilter,\n sortProperties,\n itemListIds\n } = props;\n\n const [entity] = entities;\n const isInfinite = paginationType === INFINITE;\n const listComponent = getListComponent(isCard, paginationType);\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const entitiesTypes = entities.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n const entityFields = buildPropsQuery(filterEntitySchema, propsToDisplayValues, props) || '';\n const itemsToDisplayToUse = itemListIds || itemsToDisplay;\n const limitToUse = limit || itemsToDisplayToUse.length;\n const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;\n const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);\n const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);\n const fields = buildQueryFields(entityFields, entityTypes, !isCard);\n const action = getSearchPublishedContent(fields);\n const actionKey = SEARCH_PUBLISHED_CONTENT;\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n entityData,\n currentSchema,\n filterEntitySchema,\n itemId,\n props\n );\n\n const filterValues =\n updatedFilterBy && updatedFilterBy.length\n ? buildSetFilters({ ...props, filterBy: updatedFilterBy })\n : buildSetFilters({ ...props });\n\n const { relations = [] } = filterEntitySchema;\n const stringProps = getStringTypeProps(entity, relations, Object.values(requiredSchema));\n\n const azRawQuery = buildRawQuery(\n docTypes,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps\n },\n itemId,\n itemsToDisplayToUse,\n shouldApplyDefaultSort,\n { shouldReturnAggs: true, isAZ }\n );\n\n const azVariables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n azRawQuery,\n isTextSearchFilterApplied\n );\n\n const azAction = getSearchPublishedContent(RAW_RESULTS);\n const { data, error, loading } = useQuery(azAction, {\n variables: azVariables,\n skip: !isAZ\n });\n if (loading) return '';\n if (error) return error.message;\n\n const listAggregations = isAZ ? sortAggs(data) : [];\n const updatedAggregations = buildAzAggregations(listAggregations);\n\n const rawQuery = buildRawQuery(\n docTypes,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps,\n azFilter\n },\n itemId,\n itemsToDisplayToUse,\n shouldApplyDefaultSort,\n { shouldReturnAggs: false, isAZ }\n );\n\n const variables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n rawQuery,\n isTextSearchFilterApplied\n );\n\n return (\n <ListRender\n variables={variables}\n isInfinite={isInfinite}\n initialOffset={initialOffset}\n actionKey={actionKey}\n limitToUse={limitToUse}\n itemsPerPageToUse={itemsPerPageToUse}\n action={action}\n omitWrappers={omitWrappers}\n listComponent={listComponent}\n listAggregations={updatedAggregations}\n isAZ={isAZ}\n azFilter={azFilter}\n graphqlEntityMap={graphqlEntityMap}\n {...props}\n itemsToDisplay={itemsToDisplayToUse}\n />\n );\n};\n\nListBuilder.propTypes = {\n entities: PropTypes.array.isRequired,\n mainSchemas: PropTypes.object.isRequired,\n isCard: PropTypes.bool.isRequired,\n isAZ: PropTypes.bool.isRequired,\n isTextSearchFilterApplied: PropTypes.bool.isRequired,\n parent: PropTypes.object.isRequired,\n itemsPerPage: PropTypes.number.isRequired,\n paginationIndex: PropTypes.number.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n currentSchema: PropTypes.object.isRequired,\n filterEntitySchema: PropTypes.object.isRequired,\n requiredSchema: PropTypes.object.isRequired,\n searchValues: PropTypes.object.isRequired,\n inheritedFilters: PropTypes.array,\n entityData: PropTypes.object,\n itemsToDisplay: PropTypes.array,\n limit: PropTypes.number,\n omitWrappers: PropTypes.bool,\n offset: PropTypes.number,\n sortby: PropTypes.array,\n sort: PropTypes.string,\n operator: PropTypes.string.isRequired,\n filterOperator: PropTypes.string.isRequired,\n paginationType: PropTypes.string,\n azFilter: PropTypes.string,\n sortProperties: PropTypes.array,\n itemListIds: PropTypes.array\n};\n\nListBuilder.defaultProps = {\n sort: '',\n sortby: [],\n entityData: {},\n itemsToDisplay: [],\n itemListIds: null,\n limit: 0,\n omitWrappers: false,\n offset: 0,\n paginationType: 'infinite',\n inheritedFilters: [],\n azFilter: '',\n sortProperties: []\n};\n\nexport default ListBuilder;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SACEC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,yBAAyB,EAC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E,CAAC;EACTT,cAAc,EAAE,UAAU;EAC1BD,gBAAgB,EAAE,EAAE;EACpBsB,QAAQ,EAAE,EAAE;EACZC,cAAc,EAAE;AAClB,CAAC;AAED,eAAe5B,WAAW"}
|
|
@@ -125,8 +125,8 @@ const ListFactory = props => {
|
|
|
125
125
|
if (requiredSchemaLoading || schemasLoading || itemQueryLoading || itemListLoading) return '';
|
|
126
126
|
if (hasErr) return errMsg;
|
|
127
127
|
const itemListIds = getItemListIds(itemListData);
|
|
128
|
-
const isCard = type
|
|
129
|
-
const isAZ = type
|
|
128
|
+
const isCard = !type.includes(FULL);
|
|
129
|
+
const isAZ = type.includes(AZ_LIST_TYPE);
|
|
130
130
|
const genericProps = getGenericProps(props);
|
|
131
131
|
const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);
|
|
132
132
|
const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListFactory.js","names":["React","useContext","useQuery","parseUrl","PropTypes","useRouter","MainContext","generateSingleItemQuery","getItemList","ListBuilder","AZ_LIST_TYPE","getAzQueryFilter","getSortProps","hasRequiredItemListDetails","getGenericProps","getRequiredSchemas","checkForError","getUnpublishedEntityName","getPaginationIndex","getSearchFilterType","getElasticsearchOperator","buildSearchValuesText","getQueryFilters","getInheritedFilters","getQueryProps","getItemListId","getItemListIds","useGetEntitySchemasAsObj","AND_OPERATOR","TEXT_SEARCH","ID","AND","FULL","ListFactory","props","entity","legacyEntity","entities","parent","name","filterByProperty","filterBy","omitWrappers","type","sortby","defaultSortBy","sort","defaultSort","searchFilter","operator","filterOperator","sortProperties","itemListName","isPreview","router","asPath","parsedQuery","replace","query","url","querySort","querySortBy","itemListId","queryItemListId","sortbyFilters","updatedSortProperties","itemEntity","parentEntity","itemId","parentId","updatedParentEntity","paginationIndex","azFilter","entitiesToUse","length","filterEntity","data","mainSchemas","loading","schemasLoading","error","schemasError","currentSchema","filterEntitySchema","requiredSchema","requiredSchemaLoading","requiredSchemaError","inheritedFilters","queryProps","actions","getAction","get","getPublished","entityData","itemQueryError","itemQueryLoading","variables","id","skip","itemListData","itemListError","itemListLoading","errorsToCheck","hasErr","errMsg","itemListIds","isCard","isAZ","genericProps","textFilter","shouldApplyTextFilter","propsToDisplay","valuesText","valuesAnd","valuesOr","isTextSearchFilterApplied","search_term","searchValues","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","listProps","_objectSpread","createElement","propTypes","object","isRequired","string","array","bool","defaultProps"],"sources":["../../../src/components/List/ListFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery, getItemList } from '../../application/query';\nimport ListBuilder from './ListBuilder';\nimport { AZ_LIST_TYPE } from './constants';\nimport { getAzQueryFilter, getSortProps, hasRequiredItemListDetails } from './helpers';\nimport {\n getGenericProps,\n getRequiredSchemas,\n checkForError,\n getUnpublishedEntityName,\n getPaginationIndex,\n getSearchFilterType,\n getElasticsearchOperator,\n buildSearchValuesText,\n getQueryFilters,\n getInheritedFilters,\n getQueryProps\n} from '../../helpers';\nimport { getItemListId, getItemListIds } from '../ItemList/helpers';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\nimport { AND_OPERATOR, TEXT_SEARCH, ID, AND, FULL } from '../../constants';\n\nconst ListFactory = props => {\n const {\n entity: legacyEntity,\n entities,\n parent,\n name,\n filterByProperty,\n filterBy,\n omitWrappers,\n type,\n sortby: defaultSortBy,\n sort: defaultSort,\n searchFilter,\n operator: filterOperator,\n sortProperties,\n itemListName\n } = props;\n const { isPreview } = useContext(MainContext);\n const router = useRouter();\n const { asPath } = router;\n const parsedQuery = asPath.replace(/%5D/g, ']').replace(/%5B/g, '[');\n const {\n query,\n url,\n query: { sort: querySort, sortby: querySortBy, itemListId: queryItemListId } = {}\n } = parseUrl(parsedQuery);\n const { sortbyFilters, updatedSortProperties } = getSortProps({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy\n });\n\n const itemListId = getItemListId(itemListName, queryItemListId);\n const { itemEntity: parentEntity, itemId: parentId } = parent;\n const updatedParentEntity = getUnpublishedEntityName(parentEntity);\n const paginationIndex = getPaginationIndex(query, name);\n const azFilter = getAzQueryFilter(query, name);\n\n const entitiesToUse = entities && entities.length ? entities : [legacyEntity];\n const [filterEntity] = entitiesToUse;\n const {\n data: mainSchemas = {},\n loading: schemasLoading,\n error: schemasError\n } = useGetEntitySchemasAsObj([updatedParentEntity, ...entitiesToUse]);\n\n const {\n [updatedParentEntity]: currentSchema = {},\n [filterEntity]: filterEntitySchema = {}\n } = mainSchemas;\n\n const {\n data: requiredSchema = {},\n loading: requiredSchemaLoading,\n error: requiredSchemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n schemasLoading\n );\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n const queryProps = getQueryProps(inheritedFilters, currentSchema, filterEntitySchema);\n const { actions = {} } = currentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n\n const {\n data: { entityData = {} } = {},\n error: itemQueryError,\n loading: itemQueryLoading\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: schemasLoading || (!inheritedFilters.length && queryProps === ID)\n });\n\n const { data: itemListData = {}, error: itemListError, loading: itemListLoading } = useQuery(\n getItemList,\n {\n variables: { id: itemListId },\n skip: !itemListId\n }\n );\n\n if (!hasRequiredItemListDetails({ itemListName, router, itemListId, queryItemListId })) return '';\n\n const errorsToCheck = [schemasError, requiredSchemaError, itemQueryError, itemListError];\n const { hasErr, errMsg } = checkForError(errorsToCheck);\n\n if (requiredSchemaLoading || schemasLoading || itemQueryLoading || itemListLoading) return '';\n if (hasErr) return errMsg;\n\n const itemListIds = getItemListIds(itemListData);\n const isCard = type !== FULL;\n const isAZ = type === AZ_LIST_TYPE;\n const genericProps = getGenericProps(props);\n const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);\n const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;\n const operator = shouldApplyTextFilter ? getElasticsearchOperator(textFilter) : AND_OPERATOR;\n const valuesText = shouldApplyTextFilter ? buildSearchValuesText(textFilter, query) : [];\n const { valuesAnd, valuesOr } = getQueryFilters(searchFilter, query);\n const isTextSearchFilterApplied = !!(\n query.search_term &&\n searchFilter &&\n getSearchFilterType(searchFilter, TEXT_SEARCH).length\n );\n\n const searchValues = {\n searchValuesText: valuesText,\n searchValuesCheckboxSelectRange: valuesAnd,\n searchValuesCheckboxOr: valuesOr\n };\n const listProps = {\n ...props,\n ...genericProps,\n query,\n url,\n isCard,\n isAZ,\n router,\n sort: null,\n sortby: null,\n sortProperties: updatedSortProperties,\n azFilter,\n searchValues,\n filterEntitySchema,\n requiredSchema,\n currentSchema,\n omitWrappers,\n operator,\n isTextSearchFilterApplied,\n paginationIndex,\n entityData,\n inheritedFilters,\n filterOperator,\n itemListIds,\n entities: entitiesToUse,\n mainSchemas\n };\n\n return <ListBuilder {...listProps} />;\n};\n\nListFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n type: PropTypes.string.isRequired,\n entity: PropTypes.string,\n entities: PropTypes.array,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n omitWrappers: PropTypes.bool,\n operator: PropTypes.string,\n name: PropTypes.string,\n sortby: PropTypes.array,\n sort: PropTypes.string,\n searchFilter: PropTypes.object,\n sortProperties: PropTypes.array,\n itemListName: PropTypes.string\n};\n\nListFactory.defaultProps = {\n entity: '',\n entities: [],\n filterBy: [],\n filterByProperty: [],\n omitWrappers: false,\n name: '',\n sortby: [],\n sortProperties: [],\n sort: '',\n operator: AND,\n searchFilter: {},\n itemListName: ''\n};\n\nexport default ListFactory;\n"],"mappings":";;;AAAA,OA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C,SAAS,CAAC4H,KAAK;EAC/B5E,YAAY,EAAEhD,SAAS,CAAC2H;AAC1B,CAAC;AAED9F,WAAW,CAACiG,YAAY,GAAG;EACzB/F,MAAM,EAAE,EAAE;EACVE,QAAQ,EAAE,EAAE;EACZI,QAAQ,EAAE,EAAE;EACZD,gBAAgB,EAAE,EAAE;EACpBE,YAAY,EAAE,KAAK;EACnBH,IAAI,EAAE,EAAE;EACRK,MAAM,EAAE,EAAE;EACVO,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRG,QAAQ,EAAElB,GAAG;EACbiB,YAAY,EAAE,CAAC,CAAC;EAChBI,YAAY,EAAE;AAChB,CAAC;AAED,eAAenB,WAAW"}
|
|
1
|
+
{"version":3,"file":"ListFactory.js","names":["React","useContext","useQuery","parseUrl","PropTypes","useRouter","MainContext","generateSingleItemQuery","getItemList","ListBuilder","AZ_LIST_TYPE","getAzQueryFilter","getSortProps","hasRequiredItemListDetails","getGenericProps","getRequiredSchemas","checkForError","getUnpublishedEntityName","getPaginationIndex","getSearchFilterType","getElasticsearchOperator","buildSearchValuesText","getQueryFilters","getInheritedFilters","getQueryProps","getItemListId","getItemListIds","useGetEntitySchemasAsObj","AND_OPERATOR","TEXT_SEARCH","ID","AND","FULL","ListFactory","props","entity","legacyEntity","entities","parent","name","filterByProperty","filterBy","omitWrappers","type","sortby","defaultSortBy","sort","defaultSort","searchFilter","operator","filterOperator","sortProperties","itemListName","isPreview","router","asPath","parsedQuery","replace","query","url","querySort","querySortBy","itemListId","queryItemListId","sortbyFilters","updatedSortProperties","itemEntity","parentEntity","itemId","parentId","updatedParentEntity","paginationIndex","azFilter","entitiesToUse","length","filterEntity","data","mainSchemas","loading","schemasLoading","error","schemasError","currentSchema","filterEntitySchema","requiredSchema","requiredSchemaLoading","requiredSchemaError","inheritedFilters","queryProps","actions","getAction","get","getPublished","entityData","itemQueryError","itemQueryLoading","variables","id","skip","itemListData","itemListError","itemListLoading","errorsToCheck","hasErr","errMsg","itemListIds","isCard","includes","isAZ","genericProps","textFilter","shouldApplyTextFilter","propsToDisplay","valuesText","valuesAnd","valuesOr","isTextSearchFilterApplied","search_term","searchValues","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","listProps","_objectSpread","createElement","propTypes","object","isRequired","string","array","bool","defaultProps"],"sources":["../../../src/components/List/ListFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery, getItemList } from '../../application/query';\nimport ListBuilder from './ListBuilder';\nimport { AZ_LIST_TYPE } from './constants';\nimport { getAzQueryFilter, getSortProps, hasRequiredItemListDetails } from './helpers';\nimport {\n getGenericProps,\n getRequiredSchemas,\n checkForError,\n getUnpublishedEntityName,\n getPaginationIndex,\n getSearchFilterType,\n getElasticsearchOperator,\n buildSearchValuesText,\n getQueryFilters,\n getInheritedFilters,\n getQueryProps\n} from '../../helpers';\nimport { getItemListId, getItemListIds } from '../ItemList/helpers';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\nimport { AND_OPERATOR, TEXT_SEARCH, ID, AND, FULL } from '../../constants';\n\nconst ListFactory = props => {\n const {\n entity: legacyEntity,\n entities,\n parent,\n name,\n filterByProperty,\n filterBy,\n omitWrappers,\n type,\n sortby: defaultSortBy,\n sort: defaultSort,\n searchFilter,\n operator: filterOperator,\n sortProperties,\n itemListName\n } = props;\n const { isPreview } = useContext(MainContext);\n const router = useRouter();\n const { asPath } = router;\n const parsedQuery = asPath.replace(/%5D/g, ']').replace(/%5B/g, '[');\n const {\n query,\n url,\n query: { sort: querySort, sortby: querySortBy, itemListId: queryItemListId } = {}\n } = parseUrl(parsedQuery);\n const { sortbyFilters, updatedSortProperties } = getSortProps({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy\n });\n\n const itemListId = getItemListId(itemListName, queryItemListId);\n const { itemEntity: parentEntity, itemId: parentId } = parent;\n const updatedParentEntity = getUnpublishedEntityName(parentEntity);\n const paginationIndex = getPaginationIndex(query, name);\n const azFilter = getAzQueryFilter(query, name);\n\n const entitiesToUse = entities && entities.length ? entities : [legacyEntity];\n const [filterEntity] = entitiesToUse;\n const {\n data: mainSchemas = {},\n loading: schemasLoading,\n error: schemasError\n } = useGetEntitySchemasAsObj([updatedParentEntity, ...entitiesToUse]);\n\n const {\n [updatedParentEntity]: currentSchema = {},\n [filterEntity]: filterEntitySchema = {}\n } = mainSchemas;\n\n const {\n data: requiredSchema = {},\n loading: requiredSchemaLoading,\n error: requiredSchemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n schemasLoading\n );\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n const queryProps = getQueryProps(inheritedFilters, currentSchema, filterEntitySchema);\n const { actions = {} } = currentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n\n const {\n data: { entityData = {} } = {},\n error: itemQueryError,\n loading: itemQueryLoading\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: schemasLoading || (!inheritedFilters.length && queryProps === ID)\n });\n\n const { data: itemListData = {}, error: itemListError, loading: itemListLoading } = useQuery(\n getItemList,\n {\n variables: { id: itemListId },\n skip: !itemListId\n }\n );\n\n if (!hasRequiredItemListDetails({ itemListName, router, itemListId, queryItemListId })) return '';\n\n const errorsToCheck = [schemasError, requiredSchemaError, itemQueryError, itemListError];\n const { hasErr, errMsg } = checkForError(errorsToCheck);\n\n if (requiredSchemaLoading || schemasLoading || itemQueryLoading || itemListLoading) return '';\n if (hasErr) return errMsg;\n\n const itemListIds = getItemListIds(itemListData);\n const isCard = !type.includes(FULL);\n const isAZ = type.includes(AZ_LIST_TYPE);\n const genericProps = getGenericProps(props);\n const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);\n const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;\n const operator = shouldApplyTextFilter ? getElasticsearchOperator(textFilter) : AND_OPERATOR;\n const valuesText = shouldApplyTextFilter ? buildSearchValuesText(textFilter, query) : [];\n const { valuesAnd, valuesOr } = getQueryFilters(searchFilter, query);\n const isTextSearchFilterApplied = !!(\n query.search_term &&\n searchFilter &&\n getSearchFilterType(searchFilter, TEXT_SEARCH).length\n );\n\n const searchValues = {\n searchValuesText: valuesText,\n searchValuesCheckboxSelectRange: valuesAnd,\n searchValuesCheckboxOr: valuesOr\n };\n const listProps = {\n ...props,\n ...genericProps,\n query,\n url,\n isCard,\n isAZ,\n router,\n sort: null,\n sortby: null,\n sortProperties: updatedSortProperties,\n azFilter,\n searchValues,\n filterEntitySchema,\n requiredSchema,\n currentSchema,\n omitWrappers,\n operator,\n isTextSearchFilterApplied,\n paginationIndex,\n entityData,\n inheritedFilters,\n filterOperator,\n itemListIds,\n entities: entitiesToUse,\n mainSchemas\n };\n\n return <ListBuilder {...listProps} />;\n};\n\nListFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n type: PropTypes.string.isRequired,\n entity: PropTypes.string,\n entities: PropTypes.array,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n omitWrappers: PropTypes.bool,\n operator: PropTypes.string,\n name: PropTypes.string,\n sortby: PropTypes.array,\n sort: PropTypes.string,\n searchFilter: PropTypes.object,\n sortProperties: PropTypes.array,\n itemListName: PropTypes.string\n};\n\nListFactory.defaultProps = {\n entity: '',\n entities: [],\n filterBy: [],\n filterByProperty: [],\n omitWrappers: false,\n name: '',\n sortby: [],\n sortProperties: [],\n sort: '',\n operator: AND,\n searchFilter: {},\n itemListName: ''\n};\n\nexport default ListFactory;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,SAAS,MA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AED/F,WAAW,CAACkG,YAAY,GAAG;EACzBhG,MAAM,EAAE,EAAE;EACVE,QAAQ,EAAE,EAAE;EACZI,QAAQ,EAAE,EAAE;EACZD,gBAAgB,EAAE,EAAE;EACpBE,YAAY,EAAE,KAAK;EACnBH,IAAI,EAAE,EAAE;EACRK,MAAM,EAAE,EAAE;EACVO,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRG,QAAQ,EAAElB,GAAG;EACbiB,YAAY,EAAE,CAAC,CAAC;EAChBI,YAAY,EAAE;AAChB,CAAC;AAED,eAAenB,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardsRender.js","names":["React","Fragment","PropTypes","CardsRenderWrapper","BANNER","Wrapper","splitChildren","appendImages","getPropsToDisplayModifiers","ListPagination","LOAD_MORE","useGetImages","CardsRender","_ref","orderedListData","gridModifier","children","entity","banner","omitWrappers","propsToDisplay","paginationType","parent","hasBanner","gtmData","itemsToDisplay","props","_objectWithoutProperties","_excluded","name","dataForGtm","regularChildren","gtmChildren","bannerProps","_objectSpread","type","propsToDisplayModifiers","imageIds","map","imageId","filter","Boolean","data","imagesData","loading","imagesLoading","updatedListWithImages","WrapperToUse","createElement","className","_extends","listProps","cardChildren","propTypes","string","isRequired","object","array","bool","oneOfType","defaultProps"],"sources":["../../../../../src/components/List/components/Cards/CardsRender.js"],"sourcesContent":["import React, { Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport CardsRenderWrapper from './CardsRenderWrapper';\nimport { BANNER } from '../../constants';\nimport Wrapper from '../../../Wrapper';\nimport { splitChildren, appendImages } from '../../../../helpers';\nimport { getPropsToDisplayModifiers } from '../../../../utils';\nimport ListPagination from '../Pagination';\nimport { LOAD_MORE } from '../../../../constants';\nimport { useGetImages } from '../../../../hooks';\n\nconst CardsRender = ({\n orderedListData,\n gridModifier,\n children,\n entity,\n banner,\n omitWrappers,\n propsToDisplay,\n paginationType,\n parent,\n hasBanner,\n gtmData,\n itemsToDisplay,\n ...props\n}) => {\n const { name } = props;\n const dataForGtm = gtmData || orderedListData;\n\n const { regularChildren, gtmChildren } = splitChildren(children, dataForGtm, entity, {\n name\n });\n\n const bannerProps = banner\n ? { parent, hasBanner, entity, propsToDisplay, ...banner, type: BANNER }\n : null;\n\n const propsToDisplayModifiers = getPropsToDisplayModifiers(propsToDisplay);\n const imageIds = itemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n if (imagesLoading) return '';\n const updatedListWithImages = appendImages(imagesData, orderedListData, itemsToDisplay);\n
|
|
1
|
+
{"version":3,"file":"CardsRender.js","names":["React","Fragment","PropTypes","CardsRenderWrapper","BANNER","Wrapper","splitChildren","appendImages","getPropsToDisplayModifiers","ListPagination","LOAD_MORE","useGetImages","CardsRender","_ref","orderedListData","gridModifier","children","entity","banner","omitWrappers","propsToDisplay","paginationType","parent","hasBanner","gtmData","itemsToDisplay","props","_objectWithoutProperties","_excluded","name","dataForGtm","regularChildren","gtmChildren","bannerProps","_objectSpread","type","propsToDisplayModifiers","imageIds","map","imageId","filter","Boolean","data","imagesData","loading","imagesLoading","updatedListWithImages","WrapperToUse","createElement","className","_extends","listProps","cardChildren","propTypes","string","isRequired","object","array","bool","oneOfType","defaultProps"],"sources":["../../../../../src/components/List/components/Cards/CardsRender.js"],"sourcesContent":["import React, { Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport CardsRenderWrapper from './CardsRenderWrapper';\nimport { BANNER } from '../../constants';\nimport Wrapper from '../../../Wrapper';\nimport { splitChildren, appendImages } from '../../../../helpers';\nimport { getPropsToDisplayModifiers } from '../../../../utils';\nimport ListPagination from '../Pagination';\nimport { LOAD_MORE } from '../../../../constants';\nimport { useGetImages } from '../../../../hooks';\n\nconst CardsRender = ({\n orderedListData,\n gridModifier,\n children,\n entity,\n banner,\n omitWrappers,\n propsToDisplay,\n paginationType,\n parent,\n hasBanner,\n gtmData,\n itemsToDisplay,\n ...props\n}) => {\n const { name } = props;\n const dataForGtm = gtmData || orderedListData;\n\n const { regularChildren, gtmChildren } = splitChildren(children, dataForGtm, entity, {\n name\n });\n\n const bannerProps = banner\n ? { parent, hasBanner, entity, propsToDisplay, ...banner, type: BANNER }\n : null;\n\n const propsToDisplayModifiers = getPropsToDisplayModifiers(propsToDisplay);\n const imageIds = itemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n if (imagesLoading) return '';\n const updatedListWithImages = appendImages(imagesData, orderedListData, itemsToDisplay);\n const WrapperToUse = omitWrappers ? Fragment : Wrapper;\n\n return (\n <>\n <WrapperToUse className=\"list list--compact\">\n <CardsRenderWrapper\n orderedListData={updatedListWithImages}\n listProps={props}\n bannerProps={bannerProps}\n cardChildren={regularChildren}\n gtmChildren={gtmChildren}\n omitWrappers={omitWrappers}\n propsToDisplay={propsToDisplay}\n propsToDisplayModifiers={propsToDisplayModifiers}\n gridModifier={gridModifier}\n entity={entity}\n parent={parent}\n {...props}\n />\n </WrapperToUse>\n\n {paginationType === LOAD_MORE && (\n <ListPagination paginationType={paginationType} parent={parent} {...props} />\n )}\n </>\n );\n};\n\nCardsRender.propTypes = {\n name: PropTypes.string.isRequired,\n parent: PropTypes.object.isRequired,\n orderedListData: PropTypes.array.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n paginationType: PropTypes.string.isRequired,\n hasBanner: PropTypes.bool,\n banner: PropTypes.object,\n omitWrappers: PropTypes.bool,\n gridModifier: PropTypes.string,\n entity: PropTypes.string.isRequired,\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),\n gtmData: PropTypes.array,\n itemsToDisplay: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n gridModifier: '',\n children: null,\n hasBanner: false,\n banner: null,\n omitWrappers: false,\n gtmData: null,\n itemsToDisplay: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QA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EAAEnB,SAAS,CAACoD,MAAM,CAACC,UAAU;EAC3ChC,SAAS,EAAErB,SAAS,CAACwD,IAAI;EACzBxC,MAAM,EAAEhB,SAAS,CAACsD,MAAM;EACxBrC,YAAY,EAAEjB,SAAS,CAACwD,IAAI;EAC5B3C,YAAY,EAAEb,SAAS,CAACoD,MAAM;EAC9BrC,MAAM,EAAEf,SAAS,CAACoD,MAAM,CAACC,UAAU;EACnCvC,QAAQ,EAAEd,SAAS,CAACyD,SAAS,CAAC,CAACzD,SAAS,CAACuD,KAAK,EAAEvD,SAAS,CAACsD,MAAM,CAAC,CAAC;EAClEhC,OAAO,EAAEtB,SAAS,CAACuD,KAAK;EACxBhC,cAAc,EAAEvB,SAAS,CAACuD;AAC5B,CAAC;AAED7C,WAAW,CAACgD,YAAY,GAAG;EACzB7C,YAAY,EAAE,EAAE;EAChBC,QAAQ,EAAE,IAAI;EACdO,SAAS,EAAE,KAAK;EAChBL,MAAM,EAAE,IAAI;EACZC,YAAY,EAAE,KAAK;EACnBK,OAAO,EAAE,IAAI;EACbC,cAAc,EAAE;AAClB,CAAC;AAED,eAAeb,WAAW"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CardRenderWithInfiniteScroll, CardsRender, FullRender, FullRenderWithInfiniteScroll } from '../components';
|
|
2
|
+
import { CLASSIC } from '../../../constants';
|
|
3
|
+
function getListComponent(isCard, paginationType) {
|
|
4
|
+
const isNotClassic = paginationType !== CLASSIC;
|
|
5
|
+
if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;
|
|
6
|
+
return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;
|
|
7
|
+
}
|
|
8
|
+
export default getListComponent;
|
|
9
|
+
//# sourceMappingURL=get-list-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list-component.js","names":["CardRenderWithInfiniteScroll","CardsRender","FullRender","FullRenderWithInfiniteScroll","CLASSIC","getListComponent","isCard","paginationType","isNotClassic"],"sources":["../../../../src/components/List/helpers/get-list-component.js"],"sourcesContent":["import {\n CardRenderWithInfiniteScroll,\n CardsRender,\n FullRender,\n FullRenderWithInfiniteScroll\n} from '../components';\nimport { CLASSIC } from '../../../constants';\n\nfunction getListComponent(isCard, paginationType) {\n const isNotClassic = paginationType !== CLASSIC;\n if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;\n return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;\n}\n\nexport default getListComponent;\n"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,WAAW,EACXC,UAAU,EACVC,4BAA4B,QACvB,eAAe;AACtB,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,gBAAgBA,CAACC,MAAM,EAAEC,cAAc,EAAE;EAChD,MAAMC,YAAY,GAAGD,cAAc,KAAKH,OAAO;EAC/C,IAAIE,MAAM,EAAE,OAAOE,YAAY,GAAGR,4BAA4B,GAAGC,WAAW;EAC5E,OAAOO,YAAY,GAAGL,4BAA4B,GAAGD,UAAU;AACjE;AAEA,eAAeG,gBAAgB"}
|
|
@@ -6,4 +6,5 @@ export { default as sortAggs } from './sort-aggs';
|
|
|
6
6
|
export { default as getItemsPerPageToUse } from './get-items-per-page-to-use';
|
|
7
7
|
export { default as getSortProps } from './get-sort-props';
|
|
8
8
|
export { default as hasRequiredItemListDetails } from './has-required-item-list-details';
|
|
9
|
+
export { default as getListComponent } from './get-list-component';
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","buildPaginationItems","getAzQueryFilter","buildAzAggregations","buildAzUrl","sortAggs","getItemsPerPageToUse","getSortProps","hasRequiredItemListDetails"],"sources":["../../../../src/components/List/helpers/index.js"],"sourcesContent":["export { default as buildPaginationItems } from './build-pagination-items';\nexport { default as getAzQueryFilter } from './get-az-query-filter';\nexport { default as buildAzAggregations } from './build-az-aggregations';\nexport { default as buildAzUrl } from './build-az-url';\nexport { default as sortAggs } from './sort-aggs';\nexport { default as getItemsPerPageToUse } from './get-items-per-page-to-use';\nexport { default as getSortProps } from './get-sort-props';\nexport { default as hasRequiredItemListDetails } from './has-required-item-list-details';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,0BAA0B;AAC1E,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,uBAAuB;AACnE,SAASF,OAAO,IAAIG,mBAAmB,QAAQ,yBAAyB;AACxE,SAASH,OAAO,IAAII,UAAU,QAAQ,gBAAgB;AACtD,SAASJ,OAAO,IAAIK,QAAQ,QAAQ,aAAa;AACjD,SAASL,OAAO,IAAIM,oBAAoB,QAAQ,6BAA6B;AAC7E,SAASN,OAAO,IAAIO,YAAY,QAAQ,kBAAkB;AAC1D,SAASP,OAAO,IAAIQ,0BAA0B,QAAQ,kCAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","buildPaginationItems","getAzQueryFilter","buildAzAggregations","buildAzUrl","sortAggs","getItemsPerPageToUse","getSortProps","hasRequiredItemListDetails","getListComponent"],"sources":["../../../../src/components/List/helpers/index.js"],"sourcesContent":["export { default as buildPaginationItems } from './build-pagination-items';\nexport { default as getAzQueryFilter } from './get-az-query-filter';\nexport { default as buildAzAggregations } from './build-az-aggregations';\nexport { default as buildAzUrl } from './build-az-url';\nexport { default as sortAggs } from './sort-aggs';\nexport { default as getItemsPerPageToUse } from './get-items-per-page-to-use';\nexport { default as getSortProps } from './get-sort-props';\nexport { default as hasRequiredItemListDetails } from './has-required-item-list-details';\nexport { default as getListComponent } from './get-list-component';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,0BAA0B;AAC1E,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,uBAAuB;AACnE,SAASF,OAAO,IAAIG,mBAAmB,QAAQ,yBAAyB;AACxE,SAASH,OAAO,IAAII,UAAU,QAAQ,gBAAgB;AACtD,SAASJ,OAAO,IAAIK,QAAQ,QAAQ,aAAa;AACjD,SAASL,OAAO,IAAIM,oBAAoB,QAAQ,6BAA6B;AAC7E,SAASN,OAAO,IAAIO,YAAY,QAAQ,kBAAkB;AAC1D,SAASP,OAAO,IAAIQ,0BAA0B,QAAQ,kCAAkC;AACxF,SAASR,OAAO,IAAIS,gBAAgB,QAAQ,sBAAsB"}
|
|
@@ -18,7 +18,7 @@ const SearchContentItems = ({
|
|
|
18
18
|
key: id
|
|
19
19
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
20
|
className: "search-content--results__wrapper"
|
|
21
|
-
}, image
|
|
21
|
+
}, (image === null || image === void 0 ? void 0 : image.url) ? /*#__PURE__*/React.createElement(LazyImage, {
|
|
22
22
|
src: image.url,
|
|
23
23
|
alt: name,
|
|
24
24
|
className: "search-content--results__image",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchContentItems.js","names":["React","BlazeLink","LazyImage","SearchContentItems","results","onClick","map","item","url","id","name","image","createElement","href","key","className","src","alt","sizeKey"],"sources":["../../../src/components/SearchContent/SearchContentItems.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../BlazeLink';\nimport LazyImage from '../LazyImage';\n\nconst SearchContentItems = ({ results = [], onClick }) =>\n results.map(item => {\n if (!item.url) return null;\n\n const { id, name, image, url } = item;\n\n return (\n <BlazeLink href={url} onClick={onClick} key={id}>\n <div className=\"search-content--results__wrapper\">\n {image?.url ? (\n <LazyImage\n src={image.url}\n alt={name}\n className=\"search-content--results__image\"\n sizeKey=\"search-result\"\n />\n ) : null}\n <span className=\"search-content--results__title\">{name}</span>\n </div>\n </BlazeLink>\n );\n });\n\nexport default SearchContentItems;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,OAAO,GAAG,EAAE;EAAEC;AAAQ,CAAC,KACnDD,OAAO,CAACE,GAAG,CAACC,IAAI,IAAI;EAClB,IAAI,CAACA,IAAI,CAACC,GAAG,EAAE,OAAO,IAAI;EAE1B,MAAM;IAAEC,EAAE;IAAEC,IAAI;IAAEC,KAAK;IAAEH;EAAI,CAAC,GAAGD,IAAI;EAErC,oBACEP,KAAA,CAAAY,aAAA,CAACX,SAAS;IAACY,IAAI,EAAEL,GAAI;IAACH,OAAO,EAAEA,OAAQ;IAACS,GAAG,EAAEL;EAAG,gBAC9CT,KAAA,CAAAY,aAAA;IAAKG,SAAS,EAAC;EAAkC,
|
|
1
|
+
{"version":3,"file":"SearchContentItems.js","names":["React","BlazeLink","LazyImage","SearchContentItems","results","onClick","map","item","url","id","name","image","createElement","href","key","className","src","alt","sizeKey"],"sources":["../../../src/components/SearchContent/SearchContentItems.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../BlazeLink';\nimport LazyImage from '../LazyImage';\n\nconst SearchContentItems = ({ results = [], onClick }) =>\n results.map(item => {\n if (!item.url) return null;\n\n const { id, name, image, url } = item;\n\n return (\n <BlazeLink href={url} onClick={onClick} key={id}>\n <div className=\"search-content--results__wrapper\">\n {image?.url ? (\n <LazyImage\n src={image.url}\n alt={name}\n className=\"search-content--results__image\"\n sizeKey=\"search-result\"\n />\n ) : null}\n <span className=\"search-content--results__title\">{name}</span>\n </div>\n </BlazeLink>\n );\n });\n\nexport default SearchContentItems;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,OAAO,GAAG,EAAE;EAAEC;AAAQ,CAAC,KACnDD,OAAO,CAACE,GAAG,CAACC,IAAI,IAAI;EAClB,IAAI,CAACA,IAAI,CAACC,GAAG,EAAE,OAAO,IAAI;EAE1B,MAAM;IAAEC,EAAE;IAAEC,IAAI;IAAEC,KAAK;IAAEH;EAAI,CAAC,GAAGD,IAAI;EAErC,oBACEP,KAAA,CAAAY,aAAA,CAACX,SAAS;IAACY,IAAI,EAAEL,GAAI;IAACH,OAAO,EAAEA,OAAQ;IAACS,GAAG,EAAEL;EAAG,gBAC9CT,KAAA,CAAAY,aAAA;IAAKG,SAAS,EAAC;EAAkC,GAC9C,CAAAJ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEH,GAAG,iBACTR,KAAA,CAAAY,aAAA,CAACV,SAAS;IACRc,GAAG,EAAEL,KAAK,CAACH,GAAI;IACfS,GAAG,EAAEP,IAAK;IACVK,SAAS,EAAC,gCAAgC;IAC1CG,OAAO,EAAC;EAAe,CACxB,CAAC,GACA,IAAI,eACRlB,KAAA,CAAAY,aAAA;IAAMG,SAAS,EAAC;EAAgC,GAAEL,IAAW,CAC1D,CACI,CAAC;AAEhB,CAAC,CAAC;AAEJ,eAAeP,kBAAkB"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1
4
|
import injectBannersToEntities from './inject-banners-to-entities';
|
|
2
|
-
export default function getEntitiesWithBanner(entities, options) {
|
|
5
|
+
export default function getEntitiesWithBanner(entities, options, hasNewBannerSettings) {
|
|
3
6
|
const {
|
|
4
7
|
hasBanner
|
|
5
8
|
} = options;
|
|
9
|
+
if (hasNewBannerSettings) {
|
|
10
|
+
return entities.map(currentEntity => {
|
|
11
|
+
const {
|
|
12
|
+
parent,
|
|
13
|
+
transform,
|
|
14
|
+
limit
|
|
15
|
+
} = options;
|
|
16
|
+
return _objectSpread(_objectSpread({}, currentEntity), {}, {
|
|
17
|
+
parent,
|
|
18
|
+
limit,
|
|
19
|
+
transform
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
6
23
|
if (!hasBanner) return entities;
|
|
7
24
|
return injectBannersToEntities(entities, options);
|
|
8
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entities-with-banner.js","names":["injectBannersToEntities","getEntitiesWithBanner","entities","options","hasBanner"],"sources":["../../src/helpers/get-entities-with-banner.js"],"sourcesContent":["import injectBannersToEntities from './inject-banners-to-entities';\n\nexport default function getEntitiesWithBanner(entities, options) {\n const { hasBanner } = options;\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,EAAE;
|
|
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;MAAM,CAAC,GAAGP,OAAO;MAC5C,OAAAQ,aAAA,CAAAA,aAAA,KAAYJ,aAAa;QAAEC,MAAM;QAAEE,KAAK;QAAED;MAAS;IACrD,CAAC,CAAC;EACJ;EACA,IAAI,CAACJ,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.
|
|
3
|
+
"version": "0.130.0-structured-data.0",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@blaze-cms/core-errors": "^0.127.0",
|
|
32
32
|
"@blaze-cms/core-errors-ui": "^0.128.1",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.5",
|
|
34
|
-
"@blaze-cms/nextjs-components": "
|
|
34
|
+
"@blaze-cms/nextjs-components": "0.130.0-structured-data.0",
|
|
35
35
|
"@blaze-cms/plugin-search-ui": "^0.129.0",
|
|
36
36
|
"@blaze-cms/setup-ui": "^0.128.1",
|
|
37
37
|
"@blaze-cms/utils": "^0.129.0",
|
|
38
|
-
"@blaze-cms/utils-handlebars": "
|
|
38
|
+
"@blaze-cms/utils-handlebars": "0.130.0-structured-data.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": "0716662b9ba2c9572cde8ae6322177bf4afe2929"
|
|
93
93
|
}
|
|
@@ -27,6 +27,7 @@ const CardContainer = ({
|
|
|
27
27
|
name,
|
|
28
28
|
designConfig,
|
|
29
29
|
itemsPerRow,
|
|
30
|
+
enableSmoothScroll,
|
|
30
31
|
enableCarousel,
|
|
31
32
|
bannerModifier,
|
|
32
33
|
priorityLimit,
|
|
@@ -41,16 +42,13 @@ const CardContainer = ({
|
|
|
41
42
|
const { banner } = cardProps;
|
|
42
43
|
// TODO: remove this check and all associated code once old banner setup is no longer supported
|
|
43
44
|
const hasNewBannerSettings = checkNewBannerSettings(banner);
|
|
44
|
-
const parsedCardsData = hasNewBannerSettings
|
|
45
|
-
? cardData
|
|
46
|
-
: getEntitiesWithBanner(cardData, cardProps);
|
|
45
|
+
const parsedCardsData = getEntitiesWithBanner(cardData, cardProps, hasNewBannerSettings);
|
|
47
46
|
const propsToDisplayModifiers = getPropsToDisplayModifiers(propsToDisplay);
|
|
48
47
|
const dynamicWrapperSizes = enableCarousel
|
|
49
48
|
? ''
|
|
50
49
|
: getDynamicGridClasses('grid', itemsPerRow, designConfig);
|
|
51
50
|
const CardWrapper = enableCarousel ? CarouselWrapper : Wrapper;
|
|
52
51
|
let bannerIndex = 0;
|
|
53
|
-
const bannerProps = banner ? { ...cardProps, ...banner, type: 'banner' } : null;
|
|
54
52
|
|
|
55
53
|
return (
|
|
56
54
|
<CardWrapper
|
|
@@ -59,13 +57,15 @@ const CardContainer = ({
|
|
|
59
57
|
itemsPerRow={itemsPerRow}
|
|
60
58
|
bannerModifier={bannerModifier}
|
|
61
59
|
enableAutoScroll={enableAutoScroll}
|
|
62
|
-
|
|
60
|
+
enableSmoothScroll={enableSmoothScroll}
|
|
61
|
+
autoScrollTimer={autoScrollTimer}
|
|
62
|
+
numberOfCards={parsedCardsData.length}>
|
|
63
63
|
{parsedCardsData.map((currentEntity, index) => {
|
|
64
64
|
const { baseAdunit, id, ...entityProps } = currentEntity;
|
|
65
|
-
const shouldRenderBanner = !!
|
|
65
|
+
const shouldRenderBanner = !!banner && checkIfShouldRenderBanner(index, banner);
|
|
66
66
|
const extraProps = parsePropsToDisplay(entityProps, propsToDisplay);
|
|
67
67
|
const dynamicKey = [itemId, index].join('-');
|
|
68
|
-
const priority = priorityLimit > 0 && index + 1 <= priorityLimit;
|
|
68
|
+
const priority = !!enableSmoothScroll || (priorityLimit > 0 && index + 1 <= priorityLimit);
|
|
69
69
|
if (hasNewBannerSettings && shouldRenderBanner) bannerIndex += 1;
|
|
70
70
|
if (!hasNewBannerSettings && baseAdunit) bannerIndex += 1;
|
|
71
71
|
const parsedCardProps = {
|
|
@@ -98,7 +98,14 @@ const CardContainer = ({
|
|
|
98
98
|
<>
|
|
99
99
|
<Card key={id} {...parsedCardProps} />
|
|
100
100
|
{shouldRenderBanner && (
|
|
101
|
-
<Banner
|
|
101
|
+
<Banner
|
|
102
|
+
key={dynamicKey}
|
|
103
|
+
{...entityProps}
|
|
104
|
+
renderCounter={bannerIndex}
|
|
105
|
+
entity={graphqlEntityMap[entityProps.__typename]}
|
|
106
|
+
baseAdunit={baseAdunit}
|
|
107
|
+
modifier={modifier}
|
|
108
|
+
/>
|
|
102
109
|
)}
|
|
103
110
|
</>
|
|
104
111
|
);
|
|
@@ -135,6 +142,7 @@ CardContainer.propTypes = {
|
|
|
135
142
|
style: PropTypes.string,
|
|
136
143
|
designConfig: PropTypes.object,
|
|
137
144
|
itemsPerRow: PropTypes.number,
|
|
145
|
+
enableSmoothScroll: PropTypes.bool,
|
|
138
146
|
enableCarousel: PropTypes.bool,
|
|
139
147
|
bannerModifier: PropTypes.string,
|
|
140
148
|
priorityLimit: PropTypes.number,
|
|
@@ -158,6 +166,7 @@ CardContainer.defaultProps = {
|
|
|
158
166
|
style: 'portrait',
|
|
159
167
|
designConfig: {},
|
|
160
168
|
itemsPerRow: 1,
|
|
169
|
+
enableSmoothScroll: false,
|
|
161
170
|
enableCarousel: false,
|
|
162
171
|
bannerModifier: '',
|
|
163
172
|
priorityLimit: 0,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import DefaultCarousel from './DefaultCarousel';
|
|
4
|
+
import SmoothScrollCarousel from './SmoothScrollCarousel';
|
|
5
|
+
|
|
6
|
+
const CarouselWrapper = ({ enableSmoothScroll, ...props }) => {
|
|
7
|
+
if (enableSmoothScroll) return <SmoothScrollCarousel {...props} />;
|
|
8
|
+
return <DefaultCarousel {...props} />;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
CarouselWrapper.propTypes = {
|
|
12
|
+
enableSmoothScroll: PropTypes.bool
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
CarouselWrapper.defaultProps = {
|
|
16
|
+
enableSmoothScroll: false
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default CarouselWrapper;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const DefaultCarousel = ({
|
|
5
5
|
children,
|
|
6
6
|
bannerModifier,
|
|
7
7
|
itemsPerRow,
|
|
8
8
|
enableAutoScroll,
|
|
9
|
-
autoScrollTimer
|
|
10
|
-
arrowSize
|
|
9
|
+
autoScrollTimer
|
|
11
10
|
}) => {
|
|
12
11
|
const ref = useRef();
|
|
13
12
|
const [buttonDisplay, setButtonDisplays] = useState({ displayLeft: false, displayRight: true });
|
|
@@ -84,6 +83,7 @@ const CarouselWrapper = ({
|
|
|
84
83
|
</button>
|
|
85
84
|
)}
|
|
86
85
|
</div>
|
|
86
|
+
|
|
87
87
|
<div className="cards-carousel--right-button-wrapper">
|
|
88
88
|
{displayRight && (
|
|
89
89
|
<button
|
|
@@ -97,6 +97,7 @@ const CarouselWrapper = ({
|
|
|
97
97
|
</button>
|
|
98
98
|
)}
|
|
99
99
|
</div>
|
|
100
|
+
|
|
100
101
|
<div className={contentClassName} ref={ref} onScroll={handleScroll}>
|
|
101
102
|
{children}
|
|
102
103
|
</div>
|
|
@@ -104,22 +105,20 @@ const CarouselWrapper = ({
|
|
|
104
105
|
);
|
|
105
106
|
};
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
DefaultCarousel.propTypes = {
|
|
108
109
|
bannerModifier: PropTypes.string,
|
|
109
110
|
itemsPerRow: PropTypes.number,
|
|
110
111
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
111
112
|
enableAutoScroll: PropTypes.bool,
|
|
112
|
-
autoScrollTimer: PropTypes.number
|
|
113
|
-
arrowSize: PropTypes.number
|
|
113
|
+
autoScrollTimer: PropTypes.number
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
DefaultCarousel.defaultProps = {
|
|
117
117
|
itemsPerRow: 0,
|
|
118
118
|
bannerModifier: '',
|
|
119
119
|
children: [],
|
|
120
120
|
enableAutoScroll: false,
|
|
121
|
-
autoScrollTimer: 0
|
|
122
|
-
arrowSize: 14
|
|
121
|
+
autoScrollTimer: 0
|
|
123
122
|
};
|
|
124
123
|
|
|
125
|
-
export default
|
|
124
|
+
export default DefaultCarousel;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
const SmoothScrollCarousel = ({
|
|
5
|
+
children,
|
|
6
|
+
bannerModifier,
|
|
7
|
+
itemsPerRow,
|
|
8
|
+
autoScrollTimer,
|
|
9
|
+
numberOfCards
|
|
10
|
+
}) => {
|
|
11
|
+
const wrapperClassName = `cards-carousel-smooth${bannerModifier}`;
|
|
12
|
+
const contentClassName = `cards-carousel--content smooth-scroll items-per-row-${itemsPerRow}`;
|
|
13
|
+
const aimationTime = (autoScrollTimer * numberOfCards) / 1000;
|
|
14
|
+
const animationDuration = `${aimationTime < 1 ? 1 : aimationTime}s`;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={wrapperClassName}>
|
|
18
|
+
<div className={contentClassName} style={{ animationDuration }}>
|
|
19
|
+
{children}
|
|
20
|
+
</div>
|
|
21
|
+
<div className={contentClassName} style={{ animationDuration }}>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
SmoothScrollCarousel.propTypes = {
|
|
29
|
+
bannerModifier: PropTypes.string,
|
|
30
|
+
itemsPerRow: PropTypes.number,
|
|
31
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
32
|
+
autoScrollTimer: PropTypes.number,
|
|
33
|
+
numberOfCards: PropTypes.number
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
SmoothScrollCarousel.defaultProps = {
|
|
37
|
+
itemsPerRow: 0,
|
|
38
|
+
bannerModifier: '',
|
|
39
|
+
children: [],
|
|
40
|
+
autoScrollTimer: 0,
|
|
41
|
+
numberOfCards: 1
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default SmoothScrollCarousel;
|
|
@@ -2,12 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useQuery } from '@apollo/client';
|
|
4
4
|
import { getStringTypeProps } from '@blaze-cms/utils/src/helpers';
|
|
5
|
-
import {
|
|
6
|
-
CardRenderWithInfiniteScroll,
|
|
7
|
-
CardsRender,
|
|
8
|
-
FullRender,
|
|
9
|
-
FullRenderWithInfiniteScroll
|
|
10
|
-
} from './components';
|
|
11
5
|
import ListRender from './ListRender';
|
|
12
6
|
import { getSearchPublishedContent } from '../../application/query';
|
|
13
7
|
import {
|
|
@@ -21,8 +15,8 @@ import {
|
|
|
21
15
|
checkPropsToUse,
|
|
22
16
|
buildPropsQuery
|
|
23
17
|
} from '../../helpers';
|
|
24
|
-
import { sortAggs, getItemsPerPageToUse, buildAzAggregations } from './helpers';
|
|
25
|
-
import { SEARCH_PUBLISHED_CONTENT, INFINITE
|
|
18
|
+
import { sortAggs, getItemsPerPageToUse, buildAzAggregations, getListComponent } from './helpers';
|
|
19
|
+
import { SEARCH_PUBLISHED_CONTENT, INFINITE } from '../../constants';
|
|
26
20
|
import { RAW_RESULTS } from './constants';
|
|
27
21
|
|
|
28
22
|
const ListBuilder = props => {
|
|
@@ -234,10 +228,3 @@ ListBuilder.defaultProps = {
|
|
|
234
228
|
};
|
|
235
229
|
|
|
236
230
|
export default ListBuilder;
|
|
237
|
-
function getListComponent(isCard, paginationType) {
|
|
238
|
-
const isNotClassic = paginationType !== CLASSIC;
|
|
239
|
-
|
|
240
|
-
if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;
|
|
241
|
-
|
|
242
|
-
return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;
|
|
243
|
-
}
|
|
@@ -117,8 +117,8 @@ const ListFactory = props => {
|
|
|
117
117
|
if (hasErr) return errMsg;
|
|
118
118
|
|
|
119
119
|
const itemListIds = getItemListIds(itemListData);
|
|
120
|
-
const isCard = type
|
|
121
|
-
const isAZ = type
|
|
120
|
+
const isCard = !type.includes(FULL);
|
|
121
|
+
const isAZ = type.includes(AZ_LIST_TYPE);
|
|
122
122
|
const genericProps = getGenericProps(props);
|
|
123
123
|
const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);
|
|
124
124
|
const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;
|
|
@@ -40,7 +40,6 @@ const CardsRender = ({
|
|
|
40
40
|
const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);
|
|
41
41
|
if (imagesLoading) return '';
|
|
42
42
|
const updatedListWithImages = appendImages(imagesData, orderedListData, itemsToDisplay);
|
|
43
|
-
|
|
44
43
|
const WrapperToUse = omitWrappers ? Fragment : Wrapper;
|
|
45
44
|
|
|
46
45
|
return (
|