@blaze-cms/react-page-builder 0.129.0-admin-updates.4 → 0.129.0-admin-updates.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -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-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/package.json +5 -5
- 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/tests/unit/src/components/List/helpers/get-list-component.test.js +21 -0
- 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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.129.0-admin-updates.5](https://github.com/thebyte9/blaze/compare/v0.129.0-admin-updates.4...v0.129.0-admin-updates.5) (2023-05-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* list az full render ([#3882](https://github.com/thebyte9/blaze/issues/3882)) ([443cc47](https://github.com/thebyte9/blaze/commit/443cc4771c2e72bcd7366858c9735b92f8d9aa89))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.129.0-admin-updates.4](https://github.com/thebyte9/blaze/compare/v0.129.0-admin-updates.3...v0.129.0-admin-updates.4) (2023-05-11)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
@@ -26,7 +26,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
26
26
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
27
|
var _client = require("@apollo/client");
|
|
28
28
|
var _helpers = require("@blaze-cms/utils/src/helpers");
|
|
29
|
-
var _components = require("./components");
|
|
30
29
|
var _ListRender = _interopRequireDefault(require("./ListRender"));
|
|
31
30
|
var _query = require("../../application/query");
|
|
32
31
|
var _helpers2 = require("../../helpers");
|
|
@@ -66,7 +65,7 @@ var ListBuilder = function ListBuilder(props) {
|
|
|
66
65
|
var _entities = (0, _slicedToArray2["default"])(entities, 1),
|
|
67
66
|
entity = _entities[0];
|
|
68
67
|
var isInfinite = paginationType === _constants.INFINITE;
|
|
69
|
-
var listComponent = getListComponent(isCard, paginationType);
|
|
68
|
+
var listComponent = (0, _helpers3.getListComponent)(isCard, paginationType);
|
|
70
69
|
var propsToDisplayValues = (0, _helpers2.checkPropsToUse)(propsToDisplay);
|
|
71
70
|
var entitiesTypes = entities.map(function (ent) {
|
|
72
71
|
return (0, _helpers2.getEntityData)(ent, mainSchemas[ent]);
|
|
@@ -206,9 +205,4 @@ ListBuilder.defaultProps = {
|
|
|
206
205
|
};
|
|
207
206
|
var _default = ListBuilder;
|
|
208
207
|
exports["default"] = _default;
|
|
209
|
-
function getListComponent(isCard, paginationType) {
|
|
210
|
-
var isNotClassic = paginationType !== _constants.CLASSIC;
|
|
211
|
-
if (isCard) return isNotClassic ? _components.CardRenderWithInfiniteScroll : _components.CardsRender;
|
|
212
|
-
return isNotClassic ? _components.FullRenderWithInfiniteScroll : _components.FullRender;
|
|
213
|
-
}
|
|
214
208
|
//# sourceMappingURL=ListBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBuilder.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_helpers","_components","_ListRender","_query","_helpers2","_helpers3","_constants","_constants2","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","ListBuilder","props","mainSchemas","isCard","isAZ","inheritedFilters","paginationType","entities","isTextSearchFilterApplied","itemId","parent","itemsPerPage","itemsToDisplay","limit","propsToDisplay","offset","entityData","sortby","sort","paginationIndex","omitWrappers","operator","filterOperator","currentSchema","filterEntitySchema","requiredSchema","searchValues","azFilter","sortProperties","itemListIds","_entities","_slicedToArray2","entity","isInfinite","INFINITE","listComponent","getListComponent","propsToDisplayValues","checkPropsToUse","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref","type","docType","entityTypes","_ref2","eType","entityFields","buildPropsQuery","itemsToDisplayToUse","limitToUse","shouldApplyDefaultSort","itemsPerPageToUse","getItemsPerPageToUse","initialOffset","getCurrentOffset","fields","buildQueryFields","action","getSearchPublishedContent","actionKey","SEARCH_PUBLISHED_CONTENT","updatedFilterBy","getUpdatedFilterBy","filterValues","buildSetFilters","filterBy","_filterEntitySchema$r","relations","stringProps","getStringTypeProps","values","azRawQuery","buildRawQuery","shouldReturnAggs","azVariables","getGenericRenderVariables","azAction","RAW_RESULTS","_useQuery","useQuery","variables","skip","data","error","loading","message","listAggregations","sortAggs","updatedAggregations","buildAzAggregations","rawQuery","createElement","_extends2","propTypes","PropTypes","array","isRequired","bool","number","string","defaultProps","_default","exports","isNotClassic","CLASSIC","CardRenderWithInfiniteScroll","CardsRender","FullRenderWithInfiniteScroll","FullRender"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAMA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAWA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAA0C,SAAAW,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAA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,CAACK,MAAM,CAACH,UAAU;EACrClF,cAAc,EAAEgF,qBAAS,CAACK,MAAM,CAACH,UAAU;EAC3ClG,cAAc,EAAEgG,qBAAS,CAACK,MAAM;EAChChF,QAAQ,EAAE2E,qBAAS,CAACK,MAAM;EAC1B/E,cAAc,EAAE0E,qBAAS,CAACC,KAAK;EAC/B1E,WAAW,EAAEyE,qBAAS,CAACC;AACzB,CAAC;AAEDvG,WAAW,CAAC4G,YAAY,GAAG;EACzB1F,IAAI,EAAE,EAAE;EACRD,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,CAAC,CAAC;EACdJ,cAAc,EAAE,EAAE;EAClBiB,WAAW,EAAE,IAAI;EACjBhB,KAAK,EAAE,CAAC;EACRO,YAAY,EAAE,KAAK;EACnBL,MAAM,EAAE,CAAC;EACTT,cAAc,EAAE,UAAU;EAC1BD,gBAAgB,EAAE,EAAE;EACpBsB,QAAQ,EAAE,EAAE;EACZC,cAAc,EAAE;AAClB,CAAC;AAAC,IAAAiF,QAAA,GAEa7G,WAAW;AAAA8G,OAAA,cAAAD,QAAA;AAC1B,SAASzE,gBAAgBA,CAACjC,MAAM,EAAEG,cAAc,EAAE;EAChD,IAAMyG,YAAY,GAAGzG,cAAc,KAAK0G,kBAAO;EAE/C,IAAI7G,MAAM,EAAE,OAAO4G,YAAY,GAAGE,wCAA4B,GAAGC,uBAAW;EAE5E,OAAOH,YAAY,GAAGI,wCAA4B,GAAGC,sBAAU;AACjE"}
|
|
1
|
+
{"version":3,"file":"ListBuilder.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_helpers","_ListRender","_query","_helpers2","_helpers3","_constants","_constants2","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","ListBuilder","props","mainSchemas","isCard","isAZ","inheritedFilters","paginationType","entities","isTextSearchFilterApplied","itemId","parent","itemsPerPage","itemsToDisplay","limit","propsToDisplay","offset","entityData","sortby","sort","paginationIndex","omitWrappers","operator","filterOperator","currentSchema","filterEntitySchema","requiredSchema","searchValues","azFilter","sortProperties","itemListIds","_entities","_slicedToArray2","entity","isInfinite","INFINITE","listComponent","getListComponent","propsToDisplayValues","checkPropsToUse","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref","type","docType","entityTypes","_ref2","eType","entityFields","buildPropsQuery","itemsToDisplayToUse","limitToUse","shouldApplyDefaultSort","itemsPerPageToUse","getItemsPerPageToUse","initialOffset","getCurrentOffset","fields","buildQueryFields","action","getSearchPublishedContent","actionKey","SEARCH_PUBLISHED_CONTENT","updatedFilterBy","getUpdatedFilterBy","filterValues","buildSetFilters","filterBy","_filterEntitySchema$r","relations","stringProps","getStringTypeProps","values","azRawQuery","buildRawQuery","shouldReturnAggs","azVariables","getGenericRenderVariables","azAction","RAW_RESULTS","_useQuery","useQuery","variables","skip","data","error","loading","message","listAggregations","sortAggs","updatedAggregations","buildAzAggregations","rawQuery","createElement","_extends2","propTypes","PropTypes","array","isRequired","bool","number","string","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAWA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA0C,SAAAU,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GA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AAEuF,qBAAS,CAACI,MAAM;EACxBzF,MAAM,EAAEqF,qBAAS,CAACC,KAAK;EACvBrF,IAAI,EAAEoF,qBAAS,CAACK,MAAM;EACtBtF,QAAQ,EAAEiF,qBAAS,CAACK,MAAM,CAACH,UAAU;EACrClF,cAAc,EAAEgF,qBAAS,CAACK,MAAM,CAACH,UAAU;EAC3ClG,cAAc,EAAEgG,qBAAS,CAACK,MAAM;EAChChF,QAAQ,EAAE2E,qBAAS,CAACK,MAAM;EAC1B/E,cAAc,EAAE0E,qBAAS,CAACC,KAAK;EAC/B1E,WAAW,EAAEyE,qBAAS,CAACC;AACzB,CAAC;AAEDvG,WAAW,CAAC4G,YAAY,GAAG;EACzB1F,IAAI,EAAE,EAAE;EACRD,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,CAAC,CAAC;EACdJ,cAAc,EAAE,EAAE;EAClBiB,WAAW,EAAE,IAAI;EACjBhB,KAAK,EAAE,CAAC;EACRO,YAAY,EAAE,KAAK;EACnBL,MAAM,EAAE,CAAC;EACTT,cAAc,EAAE,UAAU;EAC1BD,gBAAgB,EAAE,EAAE;EACpBsB,QAAQ,EAAE,EAAE;EACZC,cAAc,EAAE;AAClB,CAAC;AAAC,IAAAiF,QAAA,GAEa7G,WAAW;AAAA8G,OAAA,cAAAD,QAAA"}
|
|
@@ -28,6 +28,8 @@ require("core-js/modules/es.array.sort.js");
|
|
|
28
28
|
require("core-js/modules/es.regexp.exec.js");
|
|
29
29
|
require("core-js/modules/es.string.replace.js");
|
|
30
30
|
require("core-js/modules/es.array.concat.js");
|
|
31
|
+
require("core-js/modules/es.array.includes.js");
|
|
32
|
+
require("core-js/modules/es.string.includes.js");
|
|
31
33
|
var _react = _interopRequireWildcard(require("react"));
|
|
32
34
|
var _client = require("@apollo/client");
|
|
33
35
|
var _queryString = require("query-string");
|
|
@@ -147,8 +149,8 @@ var ListFactory = function ListFactory(props) {
|
|
|
147
149
|
if (requiredSchemaLoading || schemasLoading || itemQueryLoading || itemListLoading) return '';
|
|
148
150
|
if (hasErr) return errMsg;
|
|
149
151
|
var itemListIds = (0, _helpers3.getItemListIds)(itemListData);
|
|
150
|
-
var isCard = type
|
|
151
|
-
var isAZ = type
|
|
152
|
+
var isCard = !type.includes(_constants2.FULL);
|
|
153
|
+
var isAZ = type.includes(_constants.AZ_LIST_TYPE);
|
|
152
154
|
var genericProps = (0, _helpers2.getGenericProps)(props);
|
|
153
155
|
var _getSearchFilterType = (0, _helpers2.getSearchFilterType)(searchFilter, _constants2.TEXT_SEARCH),
|
|
154
156
|
_getSearchFilterType2 = (0, _slicedToArray2["default"])(_getSearchFilterType, 1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListFactory.js","names":["_react","_interopRequireWildcard","require","_client","_queryString","_propTypes","_interopRequireDefault","_router","_nextjsComponents","_query","_ListBuilder","_constants","_helpers","_helpers2","_helpers3","_hooks","_constants2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","ListFactory","props","legacyEntity","entity","entities","parent","name","filterByProperty","filterBy","omitWrappers","type","defaultSortBy","sortby","defaultSort","sort","searchFilter","filterOperator","operator","sortProperties","itemListName","_useContext","useContext","MainContext","isPreview","router","useRouter","asPath","parsedQuery","replace","_parseUrl","parseUrl","query","url","_parseUrl$query","_parseUrl$query2","querySort","querySortBy","queryItemListId","itemListId","_getSortProps","getSortProps","sortbyFilters","updatedSortProperties","getItemListId","parentEntity","itemEntity","parentId","itemId","updatedParentEntity","getUnpublishedEntityName","paginationIndex","getPaginationIndex","azFilter","getAzQueryFilter","entitiesToUse","_entitiesToUse","_slicedToArray2","filterEntity","_useGetEntitySchemasA","useGetEntitySchemasAsObj","concat","_toConsumableArray2","_useGetEntitySchemasA2","data","mainSchemas","schemasLoading","loading","schemasError","error","_mainSchemas$updatedP","currentSchema","_mainSchemas$filterEn","filterEntitySchema","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","requiredSchemaLoading","requiredSchemaError","inheritedFilters","getInheritedFilters","queryProps","getQueryProps","_ref","_ref$actions","actions","getAction","getPublished","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","ID","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","itemQueryError","itemQueryLoading","_useQuery2","getItemList","_useQuery2$data","itemListData","itemListError","itemListLoading","hasRequiredItemListDetails","errorsToCheck","_checkForError","checkForError","hasErr","errMsg","itemListIds","getItemListIds","isCard","FULL","isAZ","AZ_LIST_TYPE","genericProps","getGenericProps","_getSearchFilterType","getSearchFilterType","TEXT_SEARCH","_getSearchFilterType2","textFilter","shouldApplyTextFilter","propsToDisplay","getElasticsearchOperator","AND_OPERATOR","valuesText","buildSearchValuesText","_getQueryFilters","getQueryFilters","valuesAnd","valuesOr","isTextSearchFilterApplied","search_term","searchValues","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","listProps","createElement","propTypes","PropTypes","isRequired","string","array","bool","defaultProps","AND","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AAaA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AAA2E,SAAAe,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAjB,wBAAAqB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AC;AAED9I,WAAW,CAACgJ,SAAS,GAAG;EACtB3I,MAAM,EAAE4I,qBAAS,CAACrK,MAAM,CAACsK,UAAU;EACnCxI,IAAI,EAAEuI,qBAAS,CAACE,MAAM,CAACD,UAAU;EACjC/I,MAAM,EAAE8I,qBAAS,CAACE,MAAM;EACxB/I,QAAQ,EAAE6I,qBAAS,CAACG,KAAK;EACzB5I,QAAQ,EAAEyI,qBAAS,CAACG,KAAK;EACzB7I,gBAAgB,EAAE0I,qBAAS,CAACG,KAAK;EACjC3I,YAAY,EAAEwI,qBAAS,CAACI,IAAI;EAC5BpI,QAAQ,EAAEgI,qBAAS,CAACE,MAAM;EAC1B7I,IAAI,EAAE2I,qBAAS,CAACE,MAAM;EACtBvI,MAAM,EAAEqI,qBAAS,CAACG,KAAK;EACvBtI,IAAI,EAAEmI,qBAAS,CAACE,MAAM;EACtBpI,YAAY,EAAEkI,qBAAS,CAACrK,MAAM;EAC9BsC,cAAc,EAAE+H,qBAAS,CAACG,KAAK;EAC/BjI,YAAY,EAAE8H,qBAAS,CAACE;AAC1B,CAAC;AAEDnJ,WAAW,CAACsJ,YAAY,GAAG;EACzBnJ,MAAM,EAAE,EAAE;EACVC,QAAQ,EAAE,EAAE;EACZI,QAAQ,EAAE,EAAE;EACZD,gBAAgB,EAAE,EAAE;EACpBE,YAAY,EAAE,KAAK;EACnBH,IAAI,EAAE,EAAE;EACRM,MAAM,EAAE,EAAE;EACVM,cAAc,EAAE,EAAE;EAClBJ,IAAI,EAAE,EAAE;EACRG,QAAQ,EAAEsI,eAAG;EACbxI,YAAY,EAAE,CAAC,CAAC;EAChBI,YAAY,EAAE;AAChB,CAAC;AAAC,IAAAqI,QAAA,GAEaxJ,WAAW;AAAAyJ,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"ListFactory.js","names":["_react","_interopRequireWildcard","require","_client","_queryString","_propTypes","_interopRequireDefault","_router","_nextjsComponents","_query","_ListBuilder","_constants","_helpers","_helpers2","_helpers3","_hooks","_constants2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","ListFactory","props","legacyEntity","entity","entities","parent","name","filterByProperty","filterBy","omitWrappers","type","defaultSortBy","sortby","defaultSort","sort","searchFilter","filterOperator","operator","sortProperties","itemListName","_useContext","useContext","MainContext","isPreview","router","useRouter","asPath","parsedQuery","replace","_parseUrl","parseUrl","query","url","_parseUrl$query","_parseUrl$query2","querySort","querySortBy","queryItemListId","itemListId","_getSortProps","getSortProps","sortbyFilters","updatedSortProperties","getItemListId","parentEntity","itemEntity","parentId","itemId","updatedParentEntity","getUnpublishedEntityName","paginationIndex","getPaginationIndex","azFilter","getAzQueryFilter","entitiesToUse","_entitiesToUse","_slicedToArray2","filterEntity","_useGetEntitySchemasA","useGetEntitySchemasAsObj","concat","_toConsumableArray2","_useGetEntitySchemasA2","data","mainSchemas","schemasLoading","loading","schemasError","error","_mainSchemas$updatedP","currentSchema","_mainSchemas$filterEn","filterEntitySchema","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","requiredSchemaLoading","requiredSchemaError","inheritedFilters","getInheritedFilters","queryProps","getQueryProps","_ref","_ref$actions","actions","getAction","getPublished","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","ID","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","itemQueryError","itemQueryLoading","_useQuery2","getItemList","_useQuery2$data","itemListData","itemListError","itemListLoading","hasRequiredItemListDetails","errorsToCheck","_checkForError","checkForError","hasErr","errMsg","itemListIds","getItemListIds","isCard","includes","FULL","isAZ","AZ_LIST_TYPE","genericProps","getGenericProps","_getSearchFilterType","getSearchFilterType","TEXT_SEARCH","_getSearchFilterType2","textFilter","shouldApplyTextFilter","propsToDisplay","getElasticsearchOperator","AND_OPERATOR","valuesText","buildSearchValuesText","_getQueryFilters","getQueryFilters","valuesAnd","valuesOr","isTextSearchFilterApplied","search_term","searchValues","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","listProps","createElement","propTypes","PropTypes","isRequired","string","array","bool","defaultProps","AND","_default","exports"],"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,IAAAA,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vI,IAAI,EAAEoI,qBAAS,CAACE,MAAM;EACtBrI,YAAY,EAAEmI,qBAAS,CAACtK,MAAM;EAC9BsC,cAAc,EAAEgI,qBAAS,CAACG,KAAK;EAC/BlI,YAAY,EAAE+H,qBAAS,CAACE;AAC1B,CAAC;AAEDpJ,WAAW,CAACuJ,YAAY,GAAG;EACzBpJ,MAAM,EAAE,EAAE;EACVC,QAAQ,EAAE,EAAE;EACZI,QAAQ,EAAE,EAAE;EACZD,gBAAgB,EAAE,EAAE;EACpBE,YAAY,EAAE,KAAK;EACnBH,IAAI,EAAE,EAAE;EACRM,MAAM,EAAE,EAAE;EACVM,cAAc,EAAE,EAAE;EAClBJ,IAAI,EAAE,EAAE;EACRG,QAAQ,EAAEuI,eAAG;EACbzI,YAAY,EAAE,CAAC,CAAC;EAChBI,YAAY,EAAE;AAChB,CAAC;AAAC,IAAAsI,QAAA,GAEazJ,WAAW;AAAA0J,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_CardsRenderWrapper","_constants","_Wrapper","_helpers","_utils","_Pagination","_constants2","_hooks","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","CardsRender","_ref","orderedListData","gridModifier","children","entity","banner","omitWrappers","propsToDisplay","paginationType","parent","hasBanner","gtmData","itemsToDisplay","props","_objectWithoutProperties2","name","dataForGtm","_splitChildren","splitChildren","regularChildren","gtmChildren","bannerProps","type","BANNER","propsToDisplayModifiers","getPropsToDisplayModifiers","imageIds","map","_ref2","imageId","Boolean","_useGetImages","useGetImages","imagesData","data","imagesLoading","loading","updatedListWithImages","appendImages","WrapperToUse","Fragment","Wrapper","createElement","className","_extends2","listProps","cardChildren","LOAD_MORE","propTypes","PropTypes","string","isRequired","array","bool","oneOfType","defaultProps","_default","exports"],"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","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_CardsRenderWrapper","_constants","_Wrapper","_helpers","_utils","_Pagination","_constants2","_hooks","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","CardsRender","_ref","orderedListData","gridModifier","children","entity","banner","omitWrappers","propsToDisplay","paginationType","parent","hasBanner","gtmData","itemsToDisplay","props","_objectWithoutProperties2","name","dataForGtm","_splitChildren","splitChildren","regularChildren","gtmChildren","bannerProps","type","BANNER","propsToDisplayModifiers","getPropsToDisplayModifiers","imageIds","map","_ref2","imageId","Boolean","_useGetImages","useGetImages","imagesData","data","imagesLoading","loading","updatedListWithImages","appendImages","WrapperToUse","Fragment","Wrapper","createElement","className","_extends2","listProps","cardChildren","LOAD_MORE","propTypes","PropTypes","string","isRequired","array","bool","oneOfType","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OA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S,CAACC,MAAM,CAACC,UAAU;EAC3CzC,SAAS,EAAEuC,qBAAS,CAACI,IAAI;EACzBhD,MAAM,EAAE4C,qBAAS,CAACtE,MAAM;EACxB2B,YAAY,EAAE2C,qBAAS,CAACI,IAAI;EAC5BnD,YAAY,EAAE+C,qBAAS,CAACC,MAAM;EAC9B9C,MAAM,EAAE6C,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnChD,QAAQ,EAAE8C,qBAAS,CAACK,SAAS,CAAC,CAACL,qBAAS,CAACG,KAAK,EAAEH,qBAAS,CAACtE,MAAM,CAAC,CAAC;EAClEgC,OAAO,EAAEsC,qBAAS,CAACG,KAAK;EACxBxC,cAAc,EAAEqC,qBAAS,CAACG;AAC5B,CAAC;AAEDrD,WAAW,CAACwD,YAAY,GAAG;EACzBrD,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;AAAC,IAAA4C,QAAA,GAEazD,WAAW;AAAA0D,OAAA,cAAAD,QAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _components = require("../components");
|
|
9
|
+
var _constants = require("../../../constants");
|
|
10
|
+
function getListComponent(isCard, paginationType) {
|
|
11
|
+
var isNotClassic = paginationType !== _constants.CLASSIC;
|
|
12
|
+
if (isCard) return isNotClassic ? _components.CardRenderWithInfiniteScroll : _components.CardsRender;
|
|
13
|
+
return isNotClassic ? _components.FullRenderWithInfiniteScroll : _components.FullRender;
|
|
14
|
+
}
|
|
15
|
+
var _default = getListComponent;
|
|
16
|
+
exports["default"] = _default;
|
|
17
|
+
//# sourceMappingURL=get-list-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list-component.js","names":["_components","require","_constants","getListComponent","isCard","paginationType","isNotClassic","CLASSIC","CardRenderWithInfiniteScroll","CardsRender","FullRenderWithInfiniteScroll","FullRender","_default","exports"],"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,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AAEA,SAASE,gBAAgBA,CAACC,MAAM,EAAEC,cAAc,EAAE;EAChD,IAAMC,YAAY,GAAGD,cAAc,KAAKE,kBAAO;EAC/C,IAAIH,MAAM,EAAE,OAAOE,YAAY,GAAGE,wCAA4B,GAAGC,uBAAW;EAC5E,OAAOH,YAAY,GAAGI,wCAA4B,GAAGC,sBAAU;AACjE;AAAC,IAAAC,QAAA,GAEcT,gBAAgB;AAAAU,OAAA,cAAAD,QAAA"}
|
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "getItemsPerPageToUse", {
|
|
|
35
35
|
return _getItemsPerPageToUse["default"];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "getListComponent", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _getListComponent["default"];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
38
44
|
Object.defineProperty(exports, "getSortProps", {
|
|
39
45
|
enumerable: true,
|
|
40
46
|
get: function get() {
|
|
@@ -61,4 +67,5 @@ var _sortAggs = _interopRequireDefault(require("./sort-aggs"));
|
|
|
61
67
|
var _getItemsPerPageToUse = _interopRequireDefault(require("./get-items-per-page-to-use"));
|
|
62
68
|
var _getSortProps = _interopRequireDefault(require("./get-sort-props"));
|
|
63
69
|
var _hasRequiredItemListDetails = _interopRequireDefault(require("./has-required-item-list-details"));
|
|
70
|
+
var _getListComponent = _interopRequireDefault(require("./get-list-component"));
|
|
64
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_buildPaginationItems","_interopRequireDefault","require","_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":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildPaginationItems","_interopRequireDefault","require","_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,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,oBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,qBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,2BAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA"}
|
|
@@ -27,7 +27,7 @@ var SearchContentItems = function SearchContentItems(_ref) {
|
|
|
27
27
|
key: id
|
|
28
28
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
29
29
|
className: "search-content--results__wrapper"
|
|
30
|
-
},
|
|
30
|
+
}, image !== null && image !== void 0 && image.url ? /*#__PURE__*/_react["default"].createElement(_LazyImage["default"], {
|
|
31
31
|
src: image.url,
|
|
32
32
|
alt: name,
|
|
33
33
|
className: "search-content--results__image",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchContentItems.js","names":["_react","_interopRequireDefault","require","_BlazeLink","_LazyImage","SearchContentItems","_ref","_ref$results","results","onClick","map","item","url","id","name","image","createElement","href","key","className","src","alt","sizeKey","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA;EAAA,IAAAC,YAAA,GAAAD,IAAA,CAAME,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,EAAE,GAAAA,YAAA;IAAEE,OAAO,GAAAH,IAAA,CAAPG,OAAO;EAAA,OACjDD,OAAO,CAACE,GAAG,CAAC,UAAAC,IAAI,EAAI;IAClB,IAAI,CAACA,IAAI,CAACC,GAAG,EAAE,OAAO,IAAI;IAE1B,IAAQC,EAAE,GAAuBF,IAAI,CAA7BE,EAAE;MAAEC,IAAI,GAAiBH,IAAI,CAAzBG,IAAI;MAAEC,KAAK,GAAUJ,IAAI,CAAnBI,KAAK;MAAEH,GAAG,GAAKD,IAAI,CAAZC,GAAG;IAE5B,oBACEZ,MAAA,YAAAgB,aAAA,CAACb,UAAA,WAAS;MAACc,IAAI,EAAEL,GAAI;MAACH,OAAO,EAAEA,OAAQ;MAACS,GAAG,EAAEL;IAAG,gBAC9Cb,MAAA,YAAAgB,aAAA;MAAKG,SAAS,EAAC;IAAkC,
|
|
1
|
+
{"version":3,"file":"SearchContentItems.js","names":["_react","_interopRequireDefault","require","_BlazeLink","_LazyImage","SearchContentItems","_ref","_ref$results","results","onClick","map","item","url","id","name","image","createElement","href","key","className","src","alt","sizeKey","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAMG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA;EAAA,IAAAC,YAAA,GAAAD,IAAA,CAAME,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,EAAE,GAAAA,YAAA;IAAEE,OAAO,GAAAH,IAAA,CAAPG,OAAO;EAAA,OACjDD,OAAO,CAACE,GAAG,CAAC,UAAAC,IAAI,EAAI;IAClB,IAAI,CAACA,IAAI,CAACC,GAAG,EAAE,OAAO,IAAI;IAE1B,IAAQC,EAAE,GAAuBF,IAAI,CAA7BE,EAAE;MAAEC,IAAI,GAAiBH,IAAI,CAAzBG,IAAI;MAAEC,KAAK,GAAUJ,IAAI,CAAnBI,KAAK;MAAEH,GAAG,GAAKD,IAAI,CAAZC,GAAG;IAE5B,oBACEZ,MAAA,YAAAgB,aAAA,CAACb,UAAA,WAAS;MAACc,IAAI,EAAEL,GAAI;MAACH,OAAO,EAAEA,OAAQ;MAACS,GAAG,EAAEL;IAAG,gBAC9Cb,MAAA,YAAAgB,aAAA;MAAKG,SAAS,EAAC;IAAkC,GAC9CJ,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEH,GAAG,gBACTZ,MAAA,YAAAgB,aAAA,CAACZ,UAAA,WAAS;MACRgB,GAAG,EAAEL,KAAK,CAACH,GAAI;MACfS,GAAG,EAAEP,IAAK;MACVK,SAAS,EAAC,gCAAgC;MAC1CG,OAAO,EAAC;IAAe,CACxB,CAAC,GACA,IAAI,eACRtB,MAAA,YAAAgB,aAAA;MAAMG,SAAS,EAAC;IAAgC,GAAEL,IAAW,CAC1D,CACI,CAAC;EAEhB,CAAC,CAAC;AAAA;AAAC,IAAAS,QAAA,GAEUlB,kBAAkB;AAAAmB,OAAA,cAAAD,QAAA"}
|
|
@@ -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,EAC5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G;EACzBrE,IAAI,EAAE,EAAE;EACRD,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,CAAC,CAAC;EACdJ,cAAc,EAAE,EAAE;EAClBiB,WAAW,EAAE,IAAI;EACjBhB,KAAK,EAAE,CAAC;EACRO,YAAY,EAAE,KAAK;EACnBL,MAAM,EAAE,CAAC;EACTT,cAAc,EAAE,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;AACz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hF,WAAW,CAACsF,YAAY,GAAG;EACzBpE,IAAI,EAAE,EAAE;EACRD,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,CAAC,CAAC;EACdJ,cAAc,EAAE,EAAE;EAClBiB,WAAW,EAAE,IAAI;EACjBhB,KAAK,EAAE,CAAC;EACRO,YAAY,EAAE,KAAK;EACnBL,MAAM,EAAE,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,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,EAAEC,WAAW,QAAQ,yBAAyB;AAC9E,OAAOC,WAAW,MAAM,eAAe;AACvC,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,0BAA0B,QAAQ,WAAW;AACtF,SACEC,eAAe,EACfC,kBAAkB,EAClBC,aAAa,EACbC,wBAAwB,EACxBC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,aAAa,QACR,eAAe;AACtB,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AACnE,SAASC,wBAAwB,QAAQ,aAAa;AACtD,SAASC,YAAY,EAAEC,WAAW,EAAEC,EAAE,EAAEC,GAAG,EAAEC,IAAI,QAAQ,iBAAiB;AAE1E,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,MAAM,EAAEC,YAAY;IACpBC,QAAQ;IACRC,MAAM;IACNC,IAAI;IACJC,gBAAgB;IAChBC,QAAQ;IACRC,YAAY;IACZC,IAAI;IACJC,MAAM,EAAEC,aAAa;IACrBC,IAAI,EAAEC,WAAW;IACjBC,YAAY;IACZC,QAAQ,EAAEC,cAAc;IACxBC,cAAc;IACdC;EAC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AAQ,EAAE7C,SAAS,CAAC2H,MAAM;EAC1BxF,IAAI,EAAEnC,SAAS,CAAC2H,MAAM;EACtBnF,MAAM,EAAExC,SAAS,CAAC4H,KAAK;EACvBlF,IAAI,EAAE1C,SAAS,CAAC2H,MAAM;EACtB/E,YAAY,EAAE5C,SAAS,CAACyH,MAAM;EAC9B1E,cAAc,EAAE/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,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,EAAEC,WAAW,QAAQ,yBAAyB;AAC9E,OAAOC,WAAW,MAAM,eAAe;AACvC,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,0BAA0B,QAAQ,WAAW;AACtF,SACEC,eAAe,EACfC,kBAAkB,EAClBC,aAAa,EACbC,wBAAwB,EACxBC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,aAAa,QACR,eAAe;AACtB,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AACnE,SAASC,wBAAwB,QAAQ,aAAa;AACtD,SAASC,YAAY,EAAEC,WAAW,EAAEC,EAAE,EAAEC,GAAG,EAAEC,IAAI,QAAQ,iBAAiB;AAE1E,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,MAAM,EAAEC,YAAY;IACpBC,QAAQ;IACRC,MAAM;IACNC,IAAI;IACJC,gBAAgB;IAChBC,QAAQ;IACRC,YAAY;IACZC,IAAI;IACJC,MAAM,EAAEC,aAAa;IACrBC,IAAI,EAAEC,WAAW;IACjBC,YAAY;IACZC,QAAQ,EAAEC,cAAc;IACxBC,cAAc;IACdC;EACF,CAAC,GAAGlB,KAAK;EACT,MAAM;IAAEmB;EAAU,CAAC,GAAGpD,UAAU,CAACK,WAAW,CAAC;EAC7C,MAAMgD,MAAM,GAAGjD,SAAS,CAA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M;EACtBpF,MAAM,EAAExC,SAAS,CAAC6H,KAAK;EACvBnF,IAAI,EAAE1C,SAAS,CAAC4H,MAAM;EACtBhF,YAAY,EAAE5C,SAAS,CAAC0H,MAAM;EAC9B3E,cAAc,EAAE/C,SAAS,CAAC6H,KAAK;EAC/B7E,YAAY,EAAEhD,SAAS,CAAC4H;AAC1B,CAAC;AAED/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,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,OAAOC,OAAO,MAAM,kBAAkB;AACtC,SAASC,aAAa,EAAEC,YAAY,QAAQ,qBAAqB;AACjE,SAASC,0BAA0B,QAAQ,mBAAmB;AAC9D,OAAOC,cAAc,MAAM,eAAe;AAC1C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,MAAMC,WAAW,GAAGC,IAAA,IAcd;EAAA,IAde;MACnBC,eAAe;MACfC,YAAY;MACZC,QAAQ;MACRC,MAAM;MACNC,MAAM;MACNC,YAAY;MACZC,cAAc;MACdC,cAAc;MACdC,MAAM;MACNC,SAAS;MACTC,OAAO;MACPC;IAEF,CAAC,GAAAZ,IAAA;IADIa,KAAK,GAAAC,wBAAA,CAAAd,IAAA,EAAAe,SAAA;EAER,MAAM;IAAEC;EAAK,CAAC,GAAGH,KAAK;EACtB,MAAMI,UAAU,GAAGN,OAAO,IAAIV,eAAe;EAE7C,MAAM;IAAEiB,eAAe;IAAEC;EAAY,CAAC,GAAG1B,aAAa,CAACU,QAAQ,EAAEc,UAAU,EAAEb,MAAM,EAAE;IACnFY;EACF,CAAC,CAAC;EAEF,MAAMI,WAAW,GAAGf,MAAM,GAAAgB,aAAA,CAAAA,aAAA;IACpBZ,MAAM;IAAEC,SAAS;IAAEN,MAAM;IAAEG;EAAc,GAAKF,MAAM;IAAEiB,IAAI,EAAE/B;EAAM,KACpE,IAAI;EAER,MA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BxB,IAAI,EAAE3B,SAAS,CAACoD,MAAM,CAACC,UAAU;EACjCjC,MAAM,EAAEpB,SAAS,CAACsD,MAAM,CAACD,UAAU;EACnCzC,eAAe,EAAEZ,SAAS,CAACuD,KAAK,CAACF,UAAU;EAC3CnC,cAAc,EAAElB,SAAS,CAACuD,KAAK,CAACF,UAAU;EAC1ClC,cAAc,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
|
-
},
|
|
21
|
+
}, image !== null && image !== 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,GAC9CJ,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEH,GAAG,gBACTR,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.129.0-admin-updates.
|
|
3
|
+
"version": "0.129.0-admin-updates.5",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "0.129.0-admin-updates.
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.129.0-admin-updates.5",
|
|
31
31
|
"@blaze-cms/core-errors": "0.128.0-admin-updates.0",
|
|
32
32
|
"@blaze-cms/core-errors-ui": "0.129.0-admin-updates.2",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.5",
|
|
34
34
|
"@blaze-cms/nextjs-components": "0.129.0-admin-updates.2",
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "0.129.0-admin-updates.
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.129.0-admin-updates.5",
|
|
36
36
|
"@blaze-cms/setup-ui": "0.129.0-admin-updates.0",
|
|
37
|
-
"@blaze-cms/utils": "0.129.0-admin-updates.
|
|
37
|
+
"@blaze-cms/utils": "0.129.0-admin-updates.5",
|
|
38
38
|
"@blaze-cms/utils-handlebars": "0.129.0-admin-updates.2",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.5.19",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "76bf86db4e519fe6512e75f855a67a99323fee92"
|
|
93
93
|
}
|
|
@@ -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 (
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CardRenderWithInfiniteScroll,
|
|
3
|
+
CardsRender,
|
|
4
|
+
FullRender,
|
|
5
|
+
FullRenderWithInfiniteScroll
|
|
6
|
+
} from '../components';
|
|
7
|
+
import { CLASSIC } from '../../../constants';
|
|
8
|
+
|
|
9
|
+
function getListComponent(isCard, paginationType) {
|
|
10
|
+
const isNotClassic = paginationType !== CLASSIC;
|
|
11
|
+
if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;
|
|
12
|
+
return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default getListComponent;
|
|
@@ -6,3 +6,4 @@ 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';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import getListComponent from '../../../../../../src/components/List/helpers/get-list-component';
|
|
2
|
+
import {
|
|
3
|
+
CardRenderWithInfiniteScroll,
|
|
4
|
+
CardsRender,
|
|
5
|
+
FullRender,
|
|
6
|
+
FullRenderWithInfiniteScroll
|
|
7
|
+
} from '../../../../../../src/components/List/components';
|
|
8
|
+
import { CLASSIC } from '../../../../../../src/constants';
|
|
9
|
+
|
|
10
|
+
describe('getListComponent helper function', () => {
|
|
11
|
+
it('should correct listComponent based on props', () => {
|
|
12
|
+
const fullAz = getListComponent(false, 'aZ');
|
|
13
|
+
const cardAz = getListComponent(true, 'aZ');
|
|
14
|
+
const cardClassic = getListComponent(true, CLASSIC);
|
|
15
|
+
const fullClassic = getListComponent(false, CLASSIC);
|
|
16
|
+
expect(fullAz).toEqual(FullRenderWithInfiniteScroll);
|
|
17
|
+
expect(cardAz).toEqual(CardRenderWithInfiniteScroll);
|
|
18
|
+
expect(cardClassic).toEqual(CardsRender);
|
|
19
|
+
expect(fullClassic).toEqual(FullRender);
|
|
20
|
+
});
|
|
21
|
+
});
|
package/tests/unit/src/components/List/components/Cards/CardRenderWithInfiniteScroll.test.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import CardsRender from '../../../../../../../src/components/List/components/Cards';
|
|
2
|
-
import withInfiniteScroll from '../../../../../../../src/HOC/withInfiniteScroll';
|
|
3
|
-
|
|
4
|
-
jest.mock('../../../../../../../src/HOC/withInfiniteScroll', () => jest.fn(component => component));
|
|
5
|
-
|
|
6
|
-
describe('CardRenderWithInfiniteScroll component', () => {
|
|
7
|
-
it('should wrap FullRender with infinitieScroll HOC', async () => {
|
|
8
|
-
const CardRenderWithInfiniteScroll = await import('../../../../../../../src/components/List/components/Cards/CardRenderWithInfiniteScroll');
|
|
9
|
-
expect(CardRenderWithInfiniteScroll.default).toBe(CardsRender);
|
|
10
|
-
expect(withInfiniteScroll).toHaveBeenCalledWith(CardsRender);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import FullRender from '../../../../../../../src/components/List/components/Full';
|
|
2
|
-
import withInfiniteScroll from '../../../../../../../src/HOC/withInfiniteScroll';
|
|
3
|
-
|
|
4
|
-
jest.mock('../../../../../../../src/HOC/withInfiniteScroll', () => jest.fn(component => component));
|
|
5
|
-
|
|
6
|
-
describe('FullRenderWithInfiniteScroll component', () => {
|
|
7
|
-
it('should wrap FullRender with infinitieScroll HOC', async () => {
|
|
8
|
-
const FullRenderWithInfiniteScroll = await import('../../../../../../../src/components/List/components/Full/FullRenderWithInfiniteScroll');
|
|
9
|
-
expect(FullRenderWithInfiniteScroll.default).toBe(FullRender);
|
|
10
|
-
expect(withInfiniteScroll).toHaveBeenCalledWith(FullRender);
|
|
11
|
-
});
|
|
12
|
-
});
|