@blaze-cms/react-page-builder 0.143.0 → 0.144.0-alpha.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 +22 -0
- package/lib/components/Card/CardsRender.js +1 -1
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js +17 -8
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js +29 -5
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +2 -0
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DateTime/DateTime.js +1 -1
- package/lib/components/DateTime/DateTime.js.map +1 -1
- package/lib/components/List/ListRender.js +5 -7
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/helpers/get-sort-props.js +1 -1
- package/lib/components/List/helpers/get-sort-props.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +17 -6
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/helpers/build-raw-query.js +2 -2
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/hooks/helpers/getVariant.js.map +1 -1
- package/lib/variants/SlideSummary/SlideSummary.js +27 -0
- package/lib/variants/SlideSummary/SlideSummary.js.map +1 -0
- package/lib/variants/SlideSummary/index.js +43 -0
- package/lib/variants/SlideSummary/index.js.map +1 -0
- package/lib/variants/index.js +3 -1
- package/lib/variants/index.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +1 -1
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryFactory.js +29 -21
- package/lib-es/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryRender.js +27 -6
- package/lib-es/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DateTime/DateTime.js +1 -1
- package/lib-es/components/DateTime/DateTime.js.map +1 -1
- package/lib-es/components/List/ListRender.js +3 -5
- package/lib-es/components/List/ListRender.js.map +1 -1
- package/lib-es/components/List/helpers/get-sort-props.js +1 -1
- package/lib-es/components/List/helpers/get-sort-props.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +16 -6
- package/lib-es/components/SearchContent/SearchContent.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/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/helpers/build-raw-query.js +2 -2
- package/lib-es/helpers/build-raw-query.js.map +1 -1
- package/lib-es/hooks/helpers/getVariant.js.map +1 -1
- package/lib-es/variants/SlideSummary/SlideSummary.js +21 -0
- package/lib-es/variants/SlideSummary/SlideSummary.js.map +1 -0
- package/lib-es/variants/SlideSummary/index.js +12 -0
- package/lib-es/variants/SlideSummary/index.js.map +1 -0
- package/lib-es/variants/index.js +3 -1
- package/lib-es/variants/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Card/CardsRender.js +4 -3
- package/src/components/DataSummary/DataSummaryFactory.js +17 -5
- package/src/components/DataSummary/DataSummaryRender.js +32 -4
- package/src/components/DataSummary/helpers/build-loop-props-content.js +8 -3
- package/src/components/DateTime/DateTime.js +1 -1
- package/src/components/List/ListRender.js +4 -5
- package/src/components/List/helpers/get-sort-props.js +1 -1
- package/src/components/SearchContent/SearchContent.js +16 -6
- package/src/components/SearchContent/SearchContentItems.js +1 -1
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +0 -2
- package/src/helpers/build-raw-query.js +15 -13
- package/src/hooks/helpers/getVariant.js +1 -0
- package/src/variants/SlideSummary/SlideSummary.js +15 -0
- package/src/variants/SlideSummary/index.js +12 -0
- package/src/variants/index.js +3 -1
- package/tests/helpers/mocks.js +19 -16
- package/tests/unit/src/components/List/helpers/get-sort-props.test.js +10 -0
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +1 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.144.0-alpha.0](https://github.com/thebyte9/blaze/compare/v0.143.1...v0.144.0-alpha.0) (2024-07-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* search component single search result navigate to item ([#4398](https://github.com/thebyte9/blaze/issues/4398)) ([a12c07c](https://github.com/thebyte9/blaze/commit/a12c07c0767662a959c2d7a1c7f81e10b00b8f22))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.143.1](https://github.com/thebyte9/blaze/compare/v0.143.0...v0.143.1) (2024-07-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* handle item to display component sort when sort not applied ([#4417](https://github.com/thebyte9/blaze/issues/4417)) ([895c35d](https://github.com/thebyte9/blaze/commit/895c35dd06cf9722b32a0e2decaf7bde52f531bb))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [0.143.0](https://github.com/thebyte9/blaze/compare/v0.143.0-alpha.1...v0.143.0) (2024-06-20)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
@@ -195,7 +195,7 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
195
195
|
if (!cardDataResults || !cardDataResults.length) return null;
|
|
196
196
|
cardDataResults = entitySameAsCurrentItemEntity ? (0, _helpers.removeExtraItems)(cardDataResults, limit, parentId) : cardDataResults;
|
|
197
197
|
if (!cardDataResults.length) return null;
|
|
198
|
-
var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults, updatedItemsToDisplay);
|
|
198
|
+
var orderedData = useRandomSort || updatedSortProperties.length ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults, updatedItemsToDisplay);
|
|
199
199
|
var _splitChildren = (0, _helpers.splitChildren)(children, cardDataResults, graphqlEntityMap, {
|
|
200
200
|
name: variableProps.name
|
|
201
201
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_client","_dynamic","_interopRequireDefault","_propTypes","_nextjsComponents","_query","_constants","_hooks","_helpers","_helpers2","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_getRequireWildcardCache","WeakMap","__esModule","_typeof2","has","get","n","__proto__","a","u","prototype","hasOwnProperty","call","i","set","CardsContainer","dynamic","Promise","resolve","then","CardsRender","_ref","legacyEntity","entity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties2","_useContext","useContext","MainContext","isPreview","_otherProps$parent","parent","parentId","itemId","parentEntity","itemEntity","_otherProps$filterBy","filterBy","_otherProps$filterByP","filterByProperty","sortby","sort","_otherProps$sortPrope","sortProperties","_otherProps$operator","operator","filterOperator","AND","useRandomSort","_getUpdatedSortProper","getUpdatedSortProperties","_getUpdatedSortProper2","_slicedToArray2","updatedSortProperties","sortbyFilters","variableProps","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","getUnpublishedEntityName","allEntityNames","concat","_toConsumableArray2","uniqueEntityNames","Set","_useGetEntitySchemasA","useGetEntitySchemasAsObj","_useGetEntitySchemasA2","data","mainSchemas","_loading","loading","_error","error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref2","type","docType","entityTypes","_ref3","eType","style","_filtersSetup","filtersSetup","currentSchema","itemEntityUpdated","isFull","FULL","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","shouldSkipSingleQuery","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","parentEntityData","_err","_load","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","schemaLoading","schemaError","updatedFilterBy","getUpdatedFilterBy","updatedItemsToDisplay","getUpdatedItemsToDisplay","_filterQuerySetup","filterQuerySetup","getEntitySchemas","values","limit","hasNoFiltersOrItemsToDisplay","_useQuery2","fetchPolicy","shouldReturn","_useQuery2$data","cardData","cardsError","imageIds","_ref4","imageId","Boolean","_useGetImages","useGetImages","imagesData","imagesLoading","isLoading","hasError","message","_ref5","SEARCH_PUBLISHED_CONTENT","cardDataResults","results","removeExtraItems","orderedData","sortResponseData","_splitChildren","splitChildren","name","regularChildren","gtmChildren","updatedCards","appendImages","createElement","Fragment","renderChildren","_extends2","cardChildren","propTypes","PropTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps","_default","exports"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND, FULL } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.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\n const { style } = otherProps;\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName,\n isFull: style === FULL\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData = {}, error: cardsError } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT] || {};\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAWA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B,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAEDvC,WAAW,CAAC0J,SAAS,GAAG;EACtBnJ,QAAQ,EAAEoJ,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClF3J,MAAM,EAAEwJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACnC3J,YAAY,EAAEsJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACzC1J,cAAc,EAAEqJ,qBAAS,CAACM,KAAK;EAC/B7J,QAAQ,EAAEuJ,qBAAS,CAACM;AACtB,CAAC;AAEDjK,WAAW,CAACkK,YAAY,GAAG;EACzB3J,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA+J,QAAA,GAAAC,OAAA,cAEapK,WAAW"}
|
|
1
|
+
{"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_client","_dynamic","_interopRequireDefault","_propTypes","_nextjsComponents","_query","_constants","_hooks","_helpers","_helpers2","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_getRequireWildcardCache","WeakMap","__esModule","_typeof2","has","get","n","__proto__","a","u","prototype","hasOwnProperty","call","i","set","CardsContainer","dynamic","Promise","resolve","then","CardsRender","_ref","legacyEntity","entity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties2","_useContext","useContext","MainContext","isPreview","_otherProps$parent","parent","parentId","itemId","parentEntity","itemEntity","_otherProps$filterBy","filterBy","_otherProps$filterByP","filterByProperty","sortby","sort","_otherProps$sortPrope","sortProperties","_otherProps$operator","operator","filterOperator","AND","useRandomSort","_getUpdatedSortProper","getUpdatedSortProperties","_getUpdatedSortProper2","_slicedToArray2","updatedSortProperties","sortbyFilters","variableProps","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","getUnpublishedEntityName","allEntityNames","concat","_toConsumableArray2","uniqueEntityNames","Set","_useGetEntitySchemasA","useGetEntitySchemasAsObj","_useGetEntitySchemasA2","data","mainSchemas","_loading","loading","_error","error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref2","type","docType","entityTypes","_ref3","eType","style","_filtersSetup","filtersSetup","currentSchema","itemEntityUpdated","isFull","FULL","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","shouldSkipSingleQuery","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","parentEntityData","_err","_load","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","schemaLoading","schemaError","updatedFilterBy","getUpdatedFilterBy","updatedItemsToDisplay","getUpdatedItemsToDisplay","_filterQuerySetup","filterQuerySetup","getEntitySchemas","values","limit","hasNoFiltersOrItemsToDisplay","_useQuery2","fetchPolicy","shouldReturn","_useQuery2$data","cardData","cardsError","imageIds","_ref4","imageId","Boolean","_useGetImages","useGetImages","imagesData","imagesLoading","isLoading","hasError","message","_ref5","SEARCH_PUBLISHED_CONTENT","cardDataResults","results","removeExtraItems","orderedData","sortResponseData","_splitChildren","splitChildren","name","regularChildren","gtmChildren","updatedCards","appendImages","createElement","Fragment","renderChildren","_extends2","cardChildren","propTypes","PropTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps","_default","exports"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND, FULL } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.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\n const { style } = otherProps;\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName,\n isFull: style === FULL\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData = {}, error: cardsError } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT] || {};\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData =\n useRandomSort || updatedSortProperties.length\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,MAA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EAAEA,WAAY;IACzBO,YAAY,EAAER,eAAgB;IAC9BjF,gBAAgB,EAAEA;EAAiB,GAC/BzB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAEDvC,WAAW,CAAC0J,SAAS,GAAG;EACtBnJ,QAAQ,EAAEoJ,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClF3J,MAAM,EAAEwJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACnC3J,YAAY,EAAEsJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACzC1J,cAAc,EAAEqJ,qBAAS,CAACM,KAAK;EAC/B7J,QAAQ,EAAEuJ,qBAAS,CAACM;AACtB,CAAC;AAEDjK,WAAW,CAACkK,YAAY,GAAG;EACzB3J,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA+J,QAAA,GAAAC,OAAA,cAEapK,WAAW"}
|
|
@@ -13,7 +13,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
15
|
exports["default"] = void 0;
|
|
16
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
17
|
var _client = require("@apollo/client");
|
|
19
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -22,7 +21,6 @@ var _query = require("../../application/query");
|
|
|
22
21
|
var _helpers = require("../../helpers");
|
|
23
22
|
var _helpers2 = require("./helpers");
|
|
24
23
|
var _DataSummaryRender = _interopRequireDefault(require("./DataSummaryRender"));
|
|
25
|
-
var _excluded = ["entity", "dataRecordId", "propsToDisplay", "type", "useSelectedEntity", "elementTitle", "modifier", "headingStyle", "loopProperties", "loopLimit"];
|
|
26
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
28
26
|
var DataSummaryFactory = function DataSummaryFactory(_ref) {
|
|
@@ -36,8 +34,10 @@ var DataSummaryFactory = function DataSummaryFactory(_ref) {
|
|
|
36
34
|
headingStyle = _ref.headingStyle,
|
|
37
35
|
loopProperties = _ref.loopProperties,
|
|
38
36
|
loopLimit = _ref.loopLimit,
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
variant = _ref.variant,
|
|
38
|
+
VariantComponent = _ref.VariantComponent,
|
|
39
|
+
parent = _ref.parent;
|
|
40
|
+
var entityForQuery = useSelectedEntity ? entity : parent.itemEntity;
|
|
41
41
|
var _useQuery = (0, _client.useQuery)(_query.getSingleEntitySchema, {
|
|
42
42
|
variables: {
|
|
43
43
|
id: entityForQuery
|
|
@@ -56,7 +56,8 @@ var DataSummaryFactory = function DataSummaryFactory(_ref) {
|
|
|
56
56
|
var linkProps = (0, _helpers2.getLinkProps)(propsToDisplay);
|
|
57
57
|
var propsQueryString = (0, _helpers.buildPropsQuery)(data, propsToDisplayValues, null, linkProps);
|
|
58
58
|
var dataSummaryQuery = (0, _helpers2.getDataSummaryQuery)(data, isPreview, propsQueryString);
|
|
59
|
-
var recordId = dataRecordId[0] ||
|
|
59
|
+
var recordId = dataRecordId[0] || parent.itemId;
|
|
60
|
+
var isSlider = variant === 'slideSummary';
|
|
60
61
|
return /*#__PURE__*/_react["default"].createElement(_DataSummaryRender["default"], {
|
|
61
62
|
recordId: recordId,
|
|
62
63
|
propsToDisplay: propsToDisplay,
|
|
@@ -66,10 +67,14 @@ var DataSummaryFactory = function DataSummaryFactory(_ref) {
|
|
|
66
67
|
type: type,
|
|
67
68
|
elementTitle: elementTitle,
|
|
68
69
|
modifier: modifier,
|
|
69
|
-
htmlTag: headingStyle
|
|
70
|
+
htmlTag: headingStyle,
|
|
71
|
+
variant: variant,
|
|
72
|
+
VariantComponent: VariantComponent,
|
|
73
|
+
isSlider: isSlider
|
|
70
74
|
});
|
|
71
75
|
};
|
|
72
76
|
DataSummaryFactory.propTypes = {
|
|
77
|
+
parent: _propTypes["default"].object.isRequired,
|
|
73
78
|
type: _propTypes["default"].string,
|
|
74
79
|
dataRecordId: _propTypes["default"].array,
|
|
75
80
|
propsToDisplay: _propTypes["default"].array,
|
|
@@ -79,7 +84,9 @@ DataSummaryFactory.propTypes = {
|
|
|
79
84
|
modifier: _propTypes["default"].string,
|
|
80
85
|
headingStyle: _propTypes["default"].string,
|
|
81
86
|
loopProperties: _propTypes["default"].array,
|
|
82
|
-
loopLimit: _propTypes["default"].number
|
|
87
|
+
loopLimit: _propTypes["default"].number,
|
|
88
|
+
variant: _propTypes["default"].string,
|
|
89
|
+
VariantComponent: _propTypes["default"].func
|
|
83
90
|
};
|
|
84
91
|
DataSummaryFactory.defaultProps = {
|
|
85
92
|
type: 'text',
|
|
@@ -91,7 +98,9 @@ DataSummaryFactory.defaultProps = {
|
|
|
91
98
|
modifier: '',
|
|
92
99
|
headingStyle: 'h2',
|
|
93
100
|
loopProperties: [],
|
|
94
|
-
loopLimit: 0
|
|
101
|
+
loopLimit: 0,
|
|
102
|
+
variant: null,
|
|
103
|
+
VariantComponent: null
|
|
95
104
|
};
|
|
96
105
|
var _default = exports["default"] = DataSummaryFactory;
|
|
97
106
|
//# sourceMappingURL=DataSummaryFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSummaryFactory.js","names":["_react","_interopRequireWildcard","require","_client","_propTypes","_interopRequireDefault","_nextjsComponents","_query","_helpers","_helpers2","_DataSummaryRender","
|
|
1
|
+
{"version":3,"file":"DataSummaryFactory.js","names":["_react","_interopRequireWildcard","require","_client","_propTypes","_interopRequireDefault","_nextjsComponents","_query","_helpers","_helpers2","_DataSummaryRender","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","DataSummaryFactory","_ref","entity","dataRecordId","propsToDisplay","type","useSelectedEntity","elementTitle","modifier","headingStyle","loopProperties","loopLimit","variant","VariantComponent","parent","entityForQuery","itemEntity","_useQuery","useQuery","getSingleEntitySchema","variables","id","data","error","loading","_useContext","useContext","MainContext","isPreview","message","length","propsToDisplayValues","checkPropsToUse","linkProps","getLinkProps","propsQueryString","buildPropsQuery","dataSummaryQuery","getDataSummaryQuery","recordId","itemId","isSlider","createElement","query","htmlTag","propTypes","PropTypes","object","isRequired","string","array","bool","number","func","defaultProps","_default","exports"],"sources":["../../../src/components/DataSummary/DataSummaryFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { getSingleEntitySchema } from '../../application/query';\nimport { buildPropsQuery, checkPropsToUse } from '../../helpers';\nimport { getDataSummaryQuery, getLinkProps } from './helpers';\nimport DataSummaryRender from './DataSummaryRender';\n\nconst DataSummaryFactory = ({\n entity,\n dataRecordId,\n propsToDisplay,\n type,\n useSelectedEntity,\n elementTitle,\n modifier,\n headingStyle,\n loopProperties,\n loopLimit,\n variant,\n VariantComponent,\n parent\n}) => {\n const entityForQuery = useSelectedEntity ? entity : parent.itemEntity;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entityForQuery }\n });\n\n const { isPreview } = useContext(MainContext);\n if (loading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const linkProps = getLinkProps(propsToDisplay);\n const propsQueryString = buildPropsQuery(data, propsToDisplayValues, null, linkProps);\n const dataSummaryQuery = getDataSummaryQuery(data, isPreview, propsQueryString);\n const recordId = dataRecordId[0] || parent.itemId;\n const isSlider = variant === 'slideSummary';\n\n return (\n <DataSummaryRender\n recordId={recordId}\n propsToDisplay={propsToDisplay}\n loopProperties={loopProperties}\n loopLimit={loopLimit}\n query={dataSummaryQuery}\n type={type}\n elementTitle={elementTitle}\n modifier={modifier}\n htmlTag={headingStyle}\n variant={variant}\n VariantComponent={VariantComponent}\n isSlider={isSlider}\n />\n );\n};\n\nDataSummaryFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n type: PropTypes.string,\n dataRecordId: PropTypes.array,\n propsToDisplay: PropTypes.array,\n entity: PropTypes.string,\n useSelectedEntity: PropTypes.bool,\n elementTitle: PropTypes.string,\n modifier: PropTypes.string,\n headingStyle: PropTypes.string,\n loopProperties: PropTypes.array,\n loopLimit: PropTypes.number,\n variant: PropTypes.string,\n VariantComponent: PropTypes.func\n};\n\nDataSummaryFactory.defaultProps = {\n type: 'text',\n dataRecordId: [],\n propsToDisplay: [],\n useSelectedEntity: true,\n entity: '',\n elementTitle: '',\n modifier: '',\n headingStyle: 'h2',\n loopProperties: [],\n loopLimit: 0,\n variant: null,\n VariantComponent: null\n};\n\nexport default DataSummaryFactory;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,I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AEqC,qBAAS,CAACG,MAAM;EAC9BvC,cAAc,EAAEoC,qBAAS,CAACI,KAAK;EAC/BvC,SAAS,EAAEmC,qBAAS,CAACM,MAAM;EAC3BxC,OAAO,EAAEkC,qBAAS,CAACG,MAAM;EACzBpC,gBAAgB,EAAEiC,qBAAS,CAACO;AAC9B,CAAC;AAEDrD,kBAAkB,CAACsD,YAAY,GAAG;EAChCjD,IAAI,EAAE,MAAM;EACZF,YAAY,EAAE,EAAE;EAChBC,cAAc,EAAE,EAAE;EAClBE,iBAAiB,EAAE,IAAI;EACvBJ,MAAM,EAAE,EAAE;EACVK,YAAY,EAAE,EAAE;EAChBC,QAAQ,EAAE,EAAE;EACZC,YAAY,EAAE,IAAI;EAClBC,cAAc,EAAE,EAAE;EAClBC,SAAS,EAAE,CAAC;EACZC,OAAO,EAAE,IAAI;EACbC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAA0C,QAAA,GAAAC,OAAA,cAEaxD,kBAAkB"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
|
+
require("core-js/modules/es.array.map.js");
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _client = require("@apollo/client");
|
|
@@ -13,7 +14,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
14
|
var _DataSummaryTypes = require("./DataSummaryTypes");
|
|
14
15
|
var _utils = require("../../utils");
|
|
15
16
|
var _helpers = require("./helpers");
|
|
16
|
-
var
|
|
17
|
+
var _helpers2 = require("../../helpers");
|
|
18
|
+
var _excluded = ["type", "htmlTag", "recordId", "query", "propsToDisplay", "elementTitle", "loopProperties", "loopLimit", "VariantComponent", "isSlider"];
|
|
17
19
|
var DataSummaryRender = function DataSummaryRender(_ref) {
|
|
18
20
|
var type = _ref.type,
|
|
19
21
|
htmlTag = _ref.htmlTag,
|
|
@@ -23,7 +25,10 @@ var DataSummaryRender = function DataSummaryRender(_ref) {
|
|
|
23
25
|
elementTitle = _ref.elementTitle,
|
|
24
26
|
loopProperties = _ref.loopProperties,
|
|
25
27
|
loopLimit = _ref.loopLimit,
|
|
28
|
+
VariantComponent = _ref.VariantComponent,
|
|
29
|
+
isSlider = _ref.isSlider,
|
|
26
30
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
31
|
+
var SummaryComponent = _DataSummaryTypes.summaryComponents[type];
|
|
27
32
|
var _useQuery = (0, _client.useQuery)(query, {
|
|
28
33
|
variables: {
|
|
29
34
|
id: recordId
|
|
@@ -38,10 +43,22 @@ var DataSummaryRender = function DataSummaryRender(_ref) {
|
|
|
38
43
|
var entityData = data.entityData;
|
|
39
44
|
var shouldLoop = loopProperties && loopProperties.length;
|
|
40
45
|
var modifier = (0, _utils.getClassModifiers)('list', otherProps);
|
|
41
|
-
var summaryPropsWithContent = shouldLoop ? (0, _helpers.buildLoopPropsContent)(loopProperties, propsToDisplay, loopLimit, entityData) : (0, _helpers.buildPropsToDisplayWithContent)(entityData, propsToDisplay);
|
|
46
|
+
var summaryPropsWithContent = shouldLoop ? (0, _helpers.buildLoopPropsContent)(loopProperties, propsToDisplay, loopLimit, entityData, isSlider) : (0, _helpers.buildPropsToDisplayWithContent)(entityData, propsToDisplay);
|
|
42
47
|
var summaryPropsWithCleanContent = (0, _helpers.stripSummaryPropsContent)(propsToDisplay, summaryPropsWithContent);
|
|
43
|
-
var
|
|
48
|
+
var parsedPropsToDisplay = (0, _helpers2.parsePropsToDisplay)(entityData, propsToDisplay);
|
|
44
49
|
if (!summaryPropsWithCleanContent.length) return null;
|
|
50
|
+
if (VariantComponent) return /*#__PURE__*/_react["default"].createElement(VariantComponent, {
|
|
51
|
+
propsToDisplay: propsToDisplay,
|
|
52
|
+
summaryPropsWithContent: summaryPropsWithCleanContent,
|
|
53
|
+
parsedPropsToDisplay: parsedPropsToDisplay
|
|
54
|
+
}, summaryPropsWithContent.map(function (summaryProps) {
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(SummaryComponent, {
|
|
56
|
+
modifier: modifier,
|
|
57
|
+
elementTitle: elementTitle,
|
|
58
|
+
summaryPropsWithContent: summaryProps,
|
|
59
|
+
htmlTag: htmlTag
|
|
60
|
+
});
|
|
61
|
+
}));
|
|
45
62
|
return /*#__PURE__*/_react["default"].createElement(SummaryComponent, {
|
|
46
63
|
modifier: modifier,
|
|
47
64
|
elementTitle: elementTitle,
|
|
@@ -50,16 +67,22 @@ var DataSummaryRender = function DataSummaryRender(_ref) {
|
|
|
50
67
|
});
|
|
51
68
|
};
|
|
52
69
|
DataSummaryRender.propTypes = {
|
|
70
|
+
entities: _propTypes["default"].array.isRequired,
|
|
71
|
+
mainSchemas: _propTypes["default"].object.isRequired,
|
|
72
|
+
isSlider: _propTypes["default"].bool.isRequired,
|
|
53
73
|
type: _propTypes["default"].string,
|
|
74
|
+
name: _propTypes["default"].string,
|
|
54
75
|
query: _propTypes["default"].object,
|
|
55
76
|
recordId: _propTypes["default"].string,
|
|
56
77
|
propsToDisplay: _propTypes["default"].array,
|
|
57
78
|
elementTitle: _propTypes["default"].string,
|
|
58
79
|
htmlTag: _propTypes["default"].string,
|
|
59
80
|
loopProperties: _propTypes["default"].array,
|
|
60
|
-
loopLimit: _propTypes["default"].number
|
|
81
|
+
loopLimit: _propTypes["default"].number,
|
|
82
|
+
VariantComponent: _propTypes["default"].func
|
|
61
83
|
};
|
|
62
84
|
DataSummaryRender.defaultProps = {
|
|
85
|
+
name: '',
|
|
63
86
|
type: 'text',
|
|
64
87
|
query: {},
|
|
65
88
|
recordId: '',
|
|
@@ -67,7 +90,8 @@ DataSummaryRender.defaultProps = {
|
|
|
67
90
|
elementTitle: '',
|
|
68
91
|
htmlTag: 'h2',
|
|
69
92
|
loopProperties: [],
|
|
70
|
-
loopLimit: 0
|
|
93
|
+
loopLimit: 0,
|
|
94
|
+
VariantComponent: null
|
|
71
95
|
};
|
|
72
96
|
var _default = exports["default"] = DataSummaryRender;
|
|
73
97
|
//# sourceMappingURL=DataSummaryRender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSummaryRender.js","names":["_react","_interopRequireDefault","require","_client","_propTypes","_DataSummaryTypes","_utils","_helpers","_excluded","DataSummaryRender","_ref","type","htmlTag","recordId","query","propsToDisplay","elementTitle","loopProperties","loopLimit","otherProps","_objectWithoutProperties2","_useQuery","useQuery","variables","id","data","error","loading","message","entityData","shouldLoop","length","modifier","getClassModifiers","summaryPropsWithContent","buildLoopPropsContent","buildPropsToDisplayWithContent","summaryPropsWithCleanContent","stripSummaryPropsContent","
|
|
1
|
+
{"version":3,"file":"DataSummaryRender.js","names":["_react","_interopRequireDefault","require","_client","_propTypes","_DataSummaryTypes","_utils","_helpers","_helpers2","_excluded","DataSummaryRender","_ref","type","htmlTag","recordId","query","propsToDisplay","elementTitle","loopProperties","loopLimit","VariantComponent","isSlider","otherProps","_objectWithoutProperties2","SummaryComponent","summaryComponents","_useQuery","useQuery","variables","id","data","error","loading","message","entityData","shouldLoop","length","modifier","getClassModifiers","summaryPropsWithContent","buildLoopPropsContent","buildPropsToDisplayWithContent","summaryPropsWithCleanContent","stripSummaryPropsContent","parsedPropsToDisplay","parsePropsToDisplay","createElement","map","summaryProps","propTypes","entities","PropTypes","array","isRequired","mainSchemas","object","bool","string","name","number","func","defaultProps","_default","exports"],"sources":["../../../src/components/DataSummary/DataSummaryRender.js"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { summaryComponents } from './DataSummaryTypes';\nimport { getClassModifiers } from '../../utils';\nimport {\n buildPropsToDisplayWithContent,\n stripSummaryPropsContent,\n buildLoopPropsContent\n} from './helpers';\nimport { parsePropsToDisplay } from '../../helpers';\n\nconst DataSummaryRender = ({\n type,\n htmlTag,\n recordId,\n query,\n propsToDisplay,\n elementTitle,\n loopProperties,\n loopLimit,\n VariantComponent,\n isSlider,\n ...otherProps\n}) => {\n const SummaryComponent = summaryComponents[type];\n const { data, error, loading } = useQuery(query, {\n variables: { id: recordId }\n });\n\n if (loading) return '';\n if (error) return error.message;\n if (!data || !data.entityData) return null;\n\n const { entityData } = data;\n const shouldLoop = loopProperties && loopProperties.length;\n const modifier = getClassModifiers('list', otherProps);\n const summaryPropsWithContent = shouldLoop\n ? buildLoopPropsContent(loopProperties, propsToDisplay, loopLimit, entityData, isSlider)\n : buildPropsToDisplayWithContent(entityData, propsToDisplay);\n\n const summaryPropsWithCleanContent = stripSummaryPropsContent(\n propsToDisplay,\n summaryPropsWithContent\n );\n const parsedPropsToDisplay = parsePropsToDisplay(entityData, propsToDisplay);\n if (!summaryPropsWithCleanContent.length) return null;\n\n if (VariantComponent)\n return (\n <VariantComponent\n propsToDisplay={propsToDisplay}\n summaryPropsWithContent={summaryPropsWithCleanContent}\n parsedPropsToDisplay={parsedPropsToDisplay}>\n {summaryPropsWithContent.map(summaryProps => (\n <SummaryComponent\n modifier={modifier}\n elementTitle={elementTitle}\n summaryPropsWithContent={summaryProps}\n htmlTag={htmlTag}\n />\n ))}\n </VariantComponent>\n );\n\n return (\n <SummaryComponent\n modifier={modifier}\n elementTitle={elementTitle}\n summaryPropsWithContent={summaryPropsWithCleanContent}\n htmlTag={htmlTag}\n />\n );\n};\n\nDataSummaryRender.propTypes = {\n entities: PropTypes.array.isRequired,\n mainSchemas: PropTypes.object.isRequired,\n isSlider: PropTypes.bool.isRequired,\n type: PropTypes.string,\n name: PropTypes.string,\n query: PropTypes.object,\n recordId: PropTypes.string,\n propsToDisplay: PropTypes.array,\n elementTitle: PropTypes.string,\n htmlTag: PropTypes.string,\n loopProperties: PropTypes.array,\n loopLimit: PropTypes.number,\n VariantComponent: PropTypes.func\n};\n\nDataSummaryRender.defaultProps = {\n name: '',\n type: 'text',\n query: {},\n recordId: '',\n prop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YAAY,EAAEA,YAAa;IAC3BsB,uBAAuB,EAAEG,4BAA6B;IACtD7B,OAAO,EAAEA;EAAQ,CAClB,CAAC;AAEN,CAAC;AAEDH,iBAAiB,CAACuC,SAAS,GAAG;EAC5BC,QAAQ,EAAEC,qBAAS,CAACC,KAAK,CAACC,UAAU;EACpCC,WAAW,EAAEH,qBAAS,CAACI,MAAM,CAACF,UAAU;EACxChC,QAAQ,EAAE8B,qBAAS,CAACK,IAAI,CAACH,UAAU;EACnCzC,IAAI,EAAEuC,qBAAS,CAACM,MAAM;EACtBC,IAAI,EAAEP,qBAAS,CAACM,MAAM;EACtB1C,KAAK,EAAEoC,qBAAS,CAACI,MAAM;EACvBzC,QAAQ,EAAEqC,qBAAS,CAACM,MAAM;EAC1BzC,cAAc,EAAEmC,qBAAS,CAACC,KAAK;EAC/BnC,YAAY,EAAEkC,qBAAS,CAACM,MAAM;EAC9B5C,OAAO,EAAEsC,qBAAS,CAACM,MAAM;EACzBvC,cAAc,EAAEiC,qBAAS,CAACC,KAAK;EAC/BjC,SAAS,EAAEgC,qBAAS,CAACQ,MAAM;EAC3BvC,gBAAgB,EAAE+B,qBAAS,CAACS;AAC9B,CAAC;AAEDlD,iBAAiB,CAACmD,YAAY,GAAG;EAC/BH,IAAI,EAAE,EAAE;EACR9C,IAAI,EAAE,MAAM;EACZG,KAAK,EAAE,CAAC,CAAC;EACTD,QAAQ,EAAE,EAAE;EACZE,cAAc,EAAE,EAAE;EAClBC,YAAY,EAAE,EAAE;EAChBJ,OAAO,EAAE,IAAI;EACbK,cAAc,EAAE,EAAE;EAClBC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAA0C,QAAA,GAAAC,OAAA,cAEarD,iBAAiB"}
|
|
@@ -49,6 +49,7 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
49
49
|
var propsToDisplay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
50
50
|
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
51
51
|
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
52
|
+
var isSlider = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
52
53
|
var loopPropsWithContent = [];
|
|
53
54
|
var _separateValues = separateValues(propsToDisplay, loopProps, data),
|
|
54
55
|
_separateValues2 = (0, _slicedToArray2["default"])(_separateValues, 2),
|
|
@@ -76,6 +77,7 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
76
77
|
for (var i = 0; i < loopLimit; i += 1) {
|
|
77
78
|
_loop(i);
|
|
78
79
|
}
|
|
80
|
+
if (isSlider) return loopPropsWithContent;
|
|
79
81
|
return (0, _lodash2["default"])(loopPropsWithContent);
|
|
80
82
|
};
|
|
81
83
|
var _default = exports["default"] = buildLoopPropsContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","loopValueItem","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = []
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","isSlider","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","loopValueItem","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (\n loopProps = [],\n propsToDisplay = [],\n limit = 0,\n data = {},\n isSlider = false\n) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n if (isSlider) return loopPropsWithContent;\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAMM,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK,EAAI;EAC5B,IAAQC,QAAQ,GAAKD,KAAK,CAAlBC,QAAQ;EAChB,OAAOD,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED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aAAa,CAAC;QAClF,OAAO,CAAC,IAAAM,kBAAU,EAACX,KAAK,CAAC,EAAEO,cAAc,EAAEE,sBAAsB,EAAEP,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACU,MAAM,CAACC,OAAO,CAAC;IACjBxB,oBAAoB,CAACyB,IAAI,CAACjB,UAAU,CAAC;EACvC,CAAC;EAlBD,KAAK,IAAID,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAS,EAAEG,CAAC,IAAI,CAAC;IAAAD,KAAA,CAAAC,CAAA;EAAA;EAmBrC,IAAIR,QAAQ,EAAE,OAAOC,oBAAoB;EACzC,OAAO,IAAAS,mBAAO,EAACT,oBAAoB,CAAC;AACtC,CAAC;AAAC,IAAA0B,QAAA,GAAAC,OAAA,cAEajC,qBAAqB"}
|
|
@@ -16,7 +16,7 @@ var DateTime = function DateTime(_ref) {
|
|
|
16
16
|
var format = _ref.format,
|
|
17
17
|
customFormat = _ref.customFormat,
|
|
18
18
|
modifier = _ref.modifier;
|
|
19
|
-
var dateFormat = customFormat
|
|
19
|
+
var dateFormat = customFormat || format;
|
|
20
20
|
if (!dateFormat) return null;
|
|
21
21
|
var formatedDate = (0, _dayjs["default"])().format(dateFormat);
|
|
22
22
|
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","names":["_react","_interopRequireDefault","require","_propTypes","_dayjs","_localizedFormat","_Wrapper","dayjs","extend","LocalizedFormat","DateTime","_ref","format","customFormat","modifier","dateFormat","
|
|
1
|
+
{"version":3,"file":"DateTime.js","names":["_react","_interopRequireDefault","require","_propTypes","_dayjs","_localizedFormat","_Wrapper","dayjs","extend","LocalizedFormat","DateTime","_ref","format","customFormat","modifier","dateFormat","formatedDate","createElement","className","modifiers","propTypes","PropTypes","string","isRequired","defaultProps","_default","exports"],"sources":["../../../src/components/DateTime/DateTime.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport dayjs from 'dayjs';\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat';\nimport Wrapper from '../Wrapper';\n\ndayjs.extend(LocalizedFormat);\n\nconst DateTime = ({ format, customFormat, modifier }) => {\n const dateFormat = customFormat || format;\n\n if (!dateFormat) return null;\n\n const formatedDate = dayjs().format(dateFormat);\n\n return (\n <Wrapper className=\"date\" modifiers={modifier}>\n {formatedDate}\n </Wrapper>\n );\n};\n\nDateTime.propTypes = {\n format: PropTypes.string.isRequired,\n customFormat: PropTypes.string,\n modifier: PropTypes.string\n};\n\nDateTime.defaultProps = {\n modifier: null,\n customFormat: ''\n};\n\nexport default DateTime;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEAK,iBAAK,CAACC,MAAM,CAACC,2BAAe,CAAC;AAE7B,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAA2C;EAAA,IAArCC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAChD,IAAMC,UAAU,GAAGF,YAAY,IAAID,MAAM;EAEzC,IAAI,CAACG,UAAU,EAAE,OAAO,IAAI;EAE5B,IAAMC,YAAY,GAAG,IAAAT,iBAAK,EAAC,CAAC,CAACK,MAAM,CAACG,UAAU,CAAC;EAE/C,oBACEf,MAAA,YAAAiB,aAAA,CAACX,QAAA,WAAO;IAACY,SAAS,EAAC,MAAM;IAACC,SAAS,EAAEL;EAAS,GAC3CE,YACM,CAAC;AAEd,CAAC;AAEDN,QAAQ,CAACU,SAAS,GAAG;EACnBR,MAAM,EAAES,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCV,YAAY,EAAEQ,qBAAS,CAACC,MAAM;EAC9BR,QAAQ,EAAEO,qBAAS,CAACC;AACtB,CAAC;AAEDZ,QAAQ,CAACc,YAAY,GAAG;EACtBV,QAAQ,EAAE,IAAI;EACdD,YAAY,EAAE;AAChB,CAAC;AAAC,IAAAY,QAAA,GAAAC,OAAA,cAEahB,QAAQ"}
|
|
@@ -13,10 +13,9 @@ var _client = require("@apollo/client");
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _Pagination = _interopRequireDefault(require("./components/Pagination"));
|
|
15
15
|
var _Header = _interopRequireDefault(require("./components/Header"));
|
|
16
|
-
var _helpers = require("../../helpers");
|
|
17
16
|
var _constants = require("../../constants");
|
|
18
17
|
var _hooks = require("../../hooks");
|
|
19
|
-
var
|
|
18
|
+
var _helpers = require("./helpers");
|
|
20
19
|
var ListRender = function ListRender(props) {
|
|
21
20
|
var variables = props.variables,
|
|
22
21
|
actionKey = props.actionKey,
|
|
@@ -42,7 +41,7 @@ var ListRender = function ListRender(props) {
|
|
|
42
41
|
props: props
|
|
43
42
|
}),
|
|
44
43
|
updatedVariables = _useAppSyncEventHook.data;
|
|
45
|
-
var boostedVariables = (0,
|
|
44
|
+
var boostedVariables = (0, _helpers.buildQueryBooster)(props, updatedVariables);
|
|
46
45
|
var _useQuery = (0, _client.useQuery)(action, {
|
|
47
46
|
variables: boostedVariables
|
|
48
47
|
}),
|
|
@@ -56,9 +55,8 @@ var ListRender = function ListRender(props) {
|
|
|
56
55
|
if (!data[actionKey] || !data[actionKey].results) return null;
|
|
57
56
|
var listData = data[actionKey].results;
|
|
58
57
|
var listTotal = data[actionKey].total;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var currentListLength = orderedListData.length;
|
|
58
|
+
if (!listData || !listData.length) return null;
|
|
59
|
+
var currentListLength = listData.length;
|
|
62
60
|
var currentPage = Math.ceil((initialOffset + currentListLength) / itemsPerPageToUse);
|
|
63
61
|
var totalDisplay = limitToUse && listTotal > limitToUse ? limitToUse : listTotal;
|
|
64
62
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -70,7 +68,7 @@ var ListRender = function ListRender(props) {
|
|
|
70
68
|
}), displayTotal && /*#__PURE__*/_react["default"].createElement("div", {
|
|
71
69
|
className: "list_total_results w-full text-left p-4"
|
|
72
70
|
}, "Total results: ", totalDisplay), /*#__PURE__*/_react["default"].createElement(ListComponent, (0, _extends2["default"])({
|
|
73
|
-
orderedListData:
|
|
71
|
+
orderedListData: listData,
|
|
74
72
|
isInfinite: isInfinite,
|
|
75
73
|
initialOffset: initialOffset,
|
|
76
74
|
actionKey: actionKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListRender.js","names":["_react","_interopRequireDefault","require","_client","_propTypes","_Pagination","_Header","
|
|
1
|
+
{"version":3,"file":"ListRender.js","names":["_react","_interopRequireDefault","require","_client","_propTypes","_Pagination","_Header","_constants","_hooks","_helpers","ListRender","props","variables","actionKey","action","name","itemsToDisplay","itemsPerPageToUse","limitToUse","initialOffset","isInfinite","omitWrappers","paginationType","ListComponent","listComponent","query","url","listAggregations","isAZ","azFilter","displayTotal","_useAppSyncEventHook","useAppSyncEventHook","eventName","data","updatedVariables","boostedVariables","buildQueryBooster","_useQuery","useQuery","_useQuery$data","error","loading","fetchMore","message","results","listData","listTotal","total","length","currentListLength","currentPage","Math","ceil","totalDisplay","createElement","Fragment","className","_extends2","orderedListData","LOAD_MORE","itemsPerPage","propTypes","PropTypes","string","isRequired","object","number","bool","func","array","defaultProps","_default","exports"],"sources":["../../../src/components/List/ListRender.js"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport ListPagination from './components/Pagination';\nimport ListHeader from './components/Header';\nimport { LOAD_MORE } from '../../constants';\nimport { useAppSyncEventHook } from '../../hooks';\nimport { buildQueryBooster } from './helpers';\n\nconst ListRender = props => {\n const {\n variables,\n actionKey,\n action,\n name,\n itemsToDisplay,\n itemsPerPageToUse,\n limitToUse,\n initialOffset,\n isInfinite,\n omitWrappers,\n paginationType,\n listComponent: ListComponent,\n query,\n url,\n listAggregations,\n isAZ,\n azFilter,\n displayTotal\n } = props;\n const { data: updatedVariables } = useAppSyncEventHook({\n eventName: 'list:query-variables',\n data: variables,\n props\n });\n const boostedVariables = buildQueryBooster(props, updatedVariables);\n\n const { data = {}, error, loading, fetchMore } = useQuery(action, {\n variables: boostedVariables\n });\n\n if (loading) return '';\n if (error) return error.message;\n if (!data[actionKey] || !data[actionKey].results) return null;\n\n const listData = data[actionKey].results;\n const listTotal = data[actionKey].total;\n\n if (!listData || !listData.length) return null;\n const { length: currentListLength } = listData;\n const currentPage = Math.ceil((initialOffset + currentListLength) / itemsPerPageToUse);\n const totalDisplay = limitToUse && listTotal > limitToUse ? limitToUse : listTotal;\n\n return (\n <>\n <span className=\"list-top\" />\n {isAZ && <ListHeader name={name} listAggregations={listAggregations} azFilter={azFilter} />}\n {displayTotal && (\n <div className=\"list_total_results w-full text-left p-4\">Total results: {totalDisplay}</div>\n )}\n <ListComponent\n orderedListData={listData}\n isInfinite={isInfinite}\n initialOffset={initialOffset}\n actionKey={actionKey}\n limitToUse={limitToUse}\n fetchMore={fetchMore}\n omitWrappers={omitWrappers}\n itemsPerPageToUse={itemsPerPageToUse || listData.length}\n listTotal={listTotal}\n currentListLength={currentListLength}\n currentPage={currentPage}\n query={query}\n url={url}\n itemsToDisplay={itemsToDisplay}\n {...props}\n />\n {paginationType !== LOAD_MORE && (\n <ListPagination\n limitToUse={limitToUse}\n itemsPerPage={itemsPerPageToUse}\n listTotal={listTotal}\n name={name}\n isInfinite={isInfinite}\n currentListLength={currentListLength}\n paginationType={paginationType}\n currentPage={currentPage}\n query={query}\n url={url}\n />\n )}\n </>\n );\n};\n\nListRender.propTypes = {\n name: PropTypes.string.isRequired,\n paginationType: PropTypes.string.isRequired,\n variables: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n action: PropTypes.object.isRequired,\n itemsPerPageToUse: PropTypes.number.isRequired,\n limitToUse: PropTypes.number.isRequired,\n initialOffset: PropTypes.number.isRequired,\n isInfinite: PropTypes.bool.isRequired,\n omitWrappers: PropTypes.bool,\n query: PropTypes.object.isRequired,\n url: PropTypes.string.isRequired,\n listComponent: PropTypes.func.isRequired,\n isAZ: PropTypes.bool.isRequired,\n azFilter: PropTypes.string.isRequired,\n listAggregations: PropTypes.array,\n itemsToDisplay: PropTypes.array,\n displayTotal: PropTypes.bool\n};\n\nListRender.defaultProps = {\n omitWrappers: false,\n itemsToDisplay: [],\n listAggregations: [],\n displayTotal: false\n};\n\nexport default ListRender;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAEA,IAAMQ,UAAU,GAAG,SAAbA,UAAUA,CAAGC,KAAK,EAAI;EAC1B,IACEC,SAAS,GAkBPD,KAAK,CAlBPC,SAAS;IACTC,SAAS,GAiBPF,KAAK,CAjBPE,SAAS;IACTC,MAAM,GAgBJH,KAAK,CAhBPG,MAAM;IACNC,IAAI,GAeFJ,KAAK,CAfPI,IAAI;IACJC,cAAc,GAcZL,KAAK,CAdPK,cAAc;IACdC,iBAAiB,GAafN,KAAK,CAbPM,iBAAiB;IACjBC,UAAU,GAYRP,KAAK,CAZPO,UAAU;IACVC,aAAa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AACK,IAAI,CAACH,UAAU;EAC/BpC,QAAQ,EAAEkC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACrCtC,gBAAgB,EAAEoC,qBAAS,CAACO,KAAK;EACjCtD,cAAc,EAAE+C,qBAAS,CAACO,KAAK;EAC/BxC,YAAY,EAAEiC,qBAAS,CAACK;AAC1B,CAAC;AAED1D,UAAU,CAAC6D,YAAY,GAAG;EACxBlD,YAAY,EAAE,KAAK;EACnBL,cAAc,EAAE,EAAE;EAClBW,gBAAgB,EAAE,EAAE;EACpBG,YAAY,EAAE;AAChB,CAAC;AAAC,IAAA0C,QAAA,GAAAC,OAAA,cAEa/D,UAAU"}
|
|
@@ -20,7 +20,7 @@ var getSortProps = function getSortProps(_ref) {
|
|
|
20
20
|
defaultSortBy = _ref.defaultSortBy,
|
|
21
21
|
isTextSearchFilterApplied = _ref.isTextSearchFilterApplied;
|
|
22
22
|
var updatedSortProperties = (0, _toConsumableArray2["default"])(sortProperties);
|
|
23
|
-
if (!querySort && !sortProperties.length) {
|
|
23
|
+
if (!querySort && !sortProperties.length && defaultSortBy && defaultSortBy.length) {
|
|
24
24
|
updatedSortProperties.unshift({
|
|
25
25
|
sort: defaultSort,
|
|
26
26
|
propsToDisplay: defaultSortBy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sort-props.js","names":["getSortProps","_ref","querySort","sortProperties","defaultSort","querySortBy","defaultSortBy","isTextSearchFilterApplied","updatedSortProperties","_toConsumableArray2","length","unshift","sort","propsToDisplay","isScore","sortbyFilters","map","_ref2","filterProps","filter","Boolean","flat","_default","exports"],"sources":["../../../../src/components/List/helpers/get-sort-props.js"],"sourcesContent":["const getSortProps = ({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy,\n isTextSearchFilterApplied\n}) => {\n const updatedSortProperties = [...sortProperties];\n if (!querySort && !sortProperties.length) {\n updatedSortProperties.unshift({ sort: defaultSort, propsToDisplay: defaultSortBy });\n }\n if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });\n if (querySort) updatedSortProperties.unshift({ sort: querySort, propsToDisplay: [querySortBy] });\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay: filterProps }) => filterProps)\n .filter(Boolean)\n .flat();\n return { sortbyFilters, updatedSortProperties };\n};\n\nexport default getSortProps;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAOZ;EAAA,IANJC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,yBAAyB,GAAAN,IAAA,CAAzBM,yBAAyB;EAEzB,IAAMC,qBAAqB,OAAAC,mBAAA,aAAON,cAAc,CAAC;EACjD,IAAI,CAACD,SAAS,IAAI,CAACC,cAAc,CAACO,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"get-sort-props.js","names":["getSortProps","_ref","querySort","sortProperties","defaultSort","querySortBy","defaultSortBy","isTextSearchFilterApplied","updatedSortProperties","_toConsumableArray2","length","unshift","sort","propsToDisplay","isScore","sortbyFilters","map","_ref2","filterProps","filter","Boolean","flat","_default","exports"],"sources":["../../../../src/components/List/helpers/get-sort-props.js"],"sourcesContent":["const getSortProps = ({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy,\n isTextSearchFilterApplied\n}) => {\n const updatedSortProperties = [...sortProperties];\n if (!querySort && !sortProperties.length && defaultSortBy && defaultSortBy.length) {\n updatedSortProperties.unshift({ sort: defaultSort, propsToDisplay: defaultSortBy });\n }\n if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });\n if (querySort) updatedSortProperties.unshift({ sort: querySort, propsToDisplay: [querySortBy] });\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay: filterProps }) => filterProps)\n .filter(Boolean)\n .flat();\n return { sortbyFilters, updatedSortProperties };\n};\n\nexport default getSortProps;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAOZ;EAAA,IANJC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,yBAAyB,GAAAN,IAAA,CAAzBM,yBAAyB;EAEzB,IAAMC,qBAAqB,OAAAC,mBAAA,aAAON,cAAc,CAAC;EACjD,IAAI,CAACD,SAAS,IAAI,CAACC,cAAc,CAACO,MAAM,IAAIJ,aAAa,IAAIA,aAAa,CAACI,MAAM,EAAE;IACjFF,qBAAqB,CAACG,OAAO,CAAC;MAAEC,IAAI,EAAER,WAAW;MAAES,cAAc,EAAEP;IAAc,CAAC,CAAC;EACrF;EACA,IAAIC,yBAAyB,EAAEC,qBAAqB,CAACG,OAAO,CAAC;IAAEG,OAAO,EAAE;EAAK,CAAC,CAAC;EAC/E,IAAIZ,SAAS,EAAEM,qBAAqB,CAACG,OAAO,CAAC;IAAEC,IAAI,EAAEV,SAAS;IAAEW,cAAc,EAAE,CAACR,WAAW;EAAE,CAAC,CAAC;EAEhG,IAAMU,aAAa,GAAGP,qBAAqB,CACxCQ,GAAG,CAAC,UAAAC,KAAA;IAAA,IAAmBC,WAAW,GAAAD,KAAA,CAA3BJ,cAAc;IAAA,OAAoBK,WAAW;EAAA,EAAC,CACrDC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,CAAC;EACT,OAAO;IAAEN,aAAa,EAAbA,aAAa;IAAEP,qBAAqB,EAArBA;EAAsB,CAAC;AACjD,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,cAEavB,YAAY"}
|