@blaze-cms/react-page-builder 0.130.0-admin-updates.9 → 0.130.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -71
- package/lib/components/Card/CardsRender.js +6 -13
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/index.js +0 -7
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/Code/Code.js +3 -7
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +2 -3
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/Layout/Layout.js +10 -4
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +6 -8
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +1 -2
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-query.js +2 -3
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +2 -5
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +1 -2
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +0 -2
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +2 -5
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-set-filters.js +1 -5
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +2 -13
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +3 -2
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +0 -7
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +8 -13
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +7 -14
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/index.js +0 -1
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/Code/Code.js +4 -8
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -4
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/Layout/Layout.js +11 -5
- package/lib-es/components/Layout/Layout.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +6 -8
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +1 -2
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +2 -3
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +2 -7
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +0 -2
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +2 -4
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-set-filters.js +1 -5
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +2 -10
- package/lib-es/helpers/get-query-props.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/index.js +0 -1
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +9 -12
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/package.json +10 -10
- package/src/components/Card/CardsRender.js +7 -27
- package/src/components/Card/helpers/index.js +0 -1
- package/src/components/Code/Code.js +3 -7
- package/src/components/DataSummary/helpers/build-loop-props-content.js +1 -4
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -6
- package/src/components/Layout/Layout.js +9 -2
- package/src/components/SearchContent/SearchContent.js +6 -8
- package/src/components/SearchFilter/SearchFilterContainer.js +1 -2
- package/src/components/SearchFilter/helpers/build-new-query.js +2 -3
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +3 -7
- package/src/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/src/helpers/build-inherited-filters.js +1 -3
- package/src/helpers/build-props-query.js +2 -4
- package/src/helpers/build-set-filters.js +1 -2
- package/src/helpers/get-query-props.js +4 -12
- package/src/helpers/get-wrapped-value-with-link.js +3 -6
- package/src/helpers/index.js +0 -1
- package/src/helpers/parse-props-to-display.js +21 -25
- package/tests/unit/src/components/Code/Code.test.js +0 -5
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +0 -8
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -9
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +1 -15
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +3 -9
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +1 -10
- package/tests/unit/src/helpers/build-props-query.test.js +0 -25
- package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
- package/tests/unit/src/helpers/parse-props-to-display.test.js +0 -4
- package/lib/components/Card/helpers/get-updated-items-to-display.js +0 -55
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib/helpers/process-data-summary-value.js +0 -56
- package/lib/helpers/process-data-summary-value.js.map +0 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib-es/helpers/process-data-summary-value.js +0 -36
- package/lib-es/helpers/process-data-summary-value.js.map +0 -1
- package/src/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/src/helpers/process-data-summary-value.js +0 -22
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +0 -72
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +0 -18
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +0 -52
package/CHANGELOG.md
CHANGED
|
@@ -3,87 +3,20 @@
|
|
|
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.130.0-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([332f99f](https://github.com/thebyte9/blaze/commit/332f99f84e10328f86996b5d0f0a54a5f24a6693))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [0.130.0-admin-updates.8](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.7...v0.130.0-admin-updates.8) (2023-06-29)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
* enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([e1442ac](https://github.com/thebyte9/blaze/commit/e1442acfa141f6d7d4c5d7e0366e531410ff4f7c))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# [0.130.0-admin-updates.6](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.5...v0.130.0-admin-updates.6) (2023-06-27)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### Bug Fixes
|
|
32
|
-
|
|
33
|
-
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([4581f67](https://github.com/thebyte9/blaze/commit/4581f671fc5712fe1a38837cef9b87d1f444307d))
|
|
34
|
-
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([263b2be](https://github.com/thebyte9/blaze/commit/263b2be88f9fe4f10c05d8f922ad5f4853c133e1))
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Features
|
|
38
|
-
|
|
39
|
-
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([8724c96](https://github.com/thebyte9/blaze/commit/8724c96d6dee42355d2fb4557c7f011f9ac4eb38))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# [0.130.0-admin-updates.4](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.3...v0.130.0-admin-updates.4) (2023-06-23)
|
|
46
|
-
|
|
47
|
-
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# [0.130.0-admin-updates.2](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.1...v0.130.0-admin-updates.2) (2023-06-13)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Bug Fixes
|
|
57
|
-
|
|
58
|
-
* fixed banner not recieveng bannerProps from cards ([#3952](https://github.com/thebyte9/blaze/issues/3952)) ([ca41d15](https://github.com/thebyte9/blaze/commit/ca41d15acdc30e345a542b39f72bfdaffa949fee))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# [0.130.0-admin-updates.1](https://github.com/thebyte9/blaze/compare/v0.130.0-admin-updates.0...v0.130.0-admin-updates.1) (2023-06-12)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Bug Fixes
|
|
68
|
-
|
|
69
|
-
* added smooth scroll time check ([#3937](https://github.com/thebyte9/blaze/issues/3937)) ([a20a22d](https://github.com/thebyte9/blaze/commit/a20a22d59e813563ebdd017270555d518635d5de))
|
|
70
|
-
* fixed title repeat ([#3936](https://github.com/thebyte9/blaze/issues/3936)) ([ae57a5e](https://github.com/thebyte9/blaze/commit/ae57a5e53880ff8caa1bd47a50126a97659884fa))
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
# [0.130.0-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.129.0...v0.130.0-admin-updates.0) (2023-05-24)
|
|
6
|
+
# [0.130.0-alpha.0](https://github.com/thebyte9/blaze/compare/v0.129.0...v0.130.0-alpha.0) (2023-07-04)
|
|
77
7
|
|
|
78
8
|
|
|
79
9
|
### Bug Fixes
|
|
80
10
|
|
|
81
11
|
* added basic style for smooth auto scrolling ([42ab95b](https://github.com/thebyte9/blaze/commit/42ab95b74c9fc77cfa735bc3b6c38ad562a628d6))
|
|
12
|
+
* added smooth scroll time check ([#3937](https://github.com/thebyte9/blaze/issues/3937)) ([a20a22d](https://github.com/thebyte9/blaze/commit/a20a22d59e813563ebdd017270555d518635d5de))
|
|
82
13
|
* added smoothScroll option ([48e1c23](https://github.com/thebyte9/blaze/commit/48e1c23eb5c2132e13f7750d5fef249c913d8292))
|
|
83
14
|
* added timer control to smooth scroll ([8715a1d](https://github.com/thebyte9/blaze/commit/8715a1d821b6e77cf5de9cc7c1e562f777819861))
|
|
15
|
+
* fixed banner not recieveng bannerProps from cards ([#3952](https://github.com/thebyte9/blaze/issues/3952)) ([ca41d15](https://github.com/thebyte9/blaze/commit/ca41d15acdc30e345a542b39f72bfdaffa949fee))
|
|
84
16
|
* fixed code smells ([e9dc382](https://github.com/thebyte9/blaze/commit/e9dc38254a13cb696a48a3dc712d9cf8864d13a8))
|
|
85
17
|
* fixed css clashes ([63c20ee](https://github.com/thebyte9/blaze/commit/63c20ee219a99a25606011883cbc6e7ad1896258))
|
|
86
18
|
* fixed stuttering on smooth scroll ([5c3ff31](https://github.com/thebyte9/blaze/commit/5c3ff31eb2e6adec20750e8c97320674817a03a5))
|
|
19
|
+
* fixed title repeat ([#3936](https://github.com/thebyte9/blaze/issues/3936)) ([ae57a5e](https://github.com/thebyte9/blaze/commit/ae57a5e53880ff8caa1bd47a50126a97659884fa))
|
|
87
20
|
* list az full render ([#3882](https://github.com/thebyte9/blaze/issues/3882)) ([899556e](https://github.com/thebyte9/blaze/commit/899556ec005235367c1002d35c03ac953d5c6991))
|
|
88
21
|
* updated snapshots ([8ce52c4](https://github.com/thebyte9/blaze/commit/8ce52c4f7ed243cc1f7d3454d0f1afc4a803d6f5))
|
|
89
22
|
|
|
@@ -146,12 +146,6 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
146
146
|
schemaLoading = _useGetEntitySchemasA3.loading,
|
|
147
147
|
schemaError = _useGetEntitySchemasA3.error;
|
|
148
148
|
var updatedFilterBy = (0, _helpers.getUpdatedFilterBy)(inheritedFilters, parentEntityData, parentSchema, filterEntitySchema, parentId, variableProps);
|
|
149
|
-
var updatedItemsToDisplay = (0, _helpers2.getUpdatedItemsToDisplay)({
|
|
150
|
-
itemsToDisplay: itemsToDisplay,
|
|
151
|
-
inheritedFilters: inheritedFilters,
|
|
152
|
-
parentSchema: parentSchema,
|
|
153
|
-
parentEntityData: parentEntityData
|
|
154
|
-
});
|
|
155
149
|
var _filterQuerySetup = (0, _helpers2.filterQuerySetup)({
|
|
156
150
|
getEntitySchemas: Object.values(requiredSchema),
|
|
157
151
|
entity: primaryEntityToUse,
|
|
@@ -160,22 +154,21 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
160
154
|
docType: docTypes,
|
|
161
155
|
filterOperator: filterOperator,
|
|
162
156
|
filterEntityRelations: filterEntityRelations,
|
|
163
|
-
itemsToDisplay:
|
|
157
|
+
itemsToDisplay: itemsToDisplay,
|
|
164
158
|
entitySameAsCurrentItemEntity: entitySameAsCurrentItemEntity,
|
|
165
159
|
useRandomSort: useRandomSort
|
|
166
160
|
}),
|
|
167
161
|
limit = _filterQuerySetup.limit,
|
|
168
162
|
variables = _filterQuerySetup.variables;
|
|
169
|
-
var hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
|
|
170
163
|
var _useQuery2 = (0, _client.useQuery)(action, {
|
|
171
164
|
variables: variables,
|
|
172
165
|
fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
|
|
173
|
-
skip: (0, _helpers2.shouldReturn)(
|
|
166
|
+
skip: (0, _helpers2.shouldReturn)(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)
|
|
174
167
|
}),
|
|
175
168
|
cardData = _useQuery2.data,
|
|
176
169
|
cardsError = _useQuery2.error,
|
|
177
170
|
cardsLoading = _useQuery2.loading;
|
|
178
|
-
var imageIds =
|
|
171
|
+
var imageIds = itemsToDisplay.map(function (_ref4) {
|
|
179
172
|
var imageId = _ref4.imageId;
|
|
180
173
|
return imageId;
|
|
181
174
|
}).filter(Boolean);
|
|
@@ -184,7 +177,7 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
184
177
|
imagesLoading = _useGetImages.loading;
|
|
185
178
|
var isLoading = (0, _helpers2.shouldReturn)(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
|
|
186
179
|
var hasError = (0, _helpers2.shouldReturn)(_error, _err, schemaError);
|
|
187
|
-
if (
|
|
180
|
+
if (!updatedFilterBy) return null;
|
|
188
181
|
if (isLoading) return null;
|
|
189
182
|
if (hasError) return null;
|
|
190
183
|
if (cardsError) return cardsError.message;
|
|
@@ -192,13 +185,13 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
192
185
|
if (!cardDataResults || !cardDataResults.length) return null;
|
|
193
186
|
cardDataResults = entitySameAsCurrentItemEntity ? (0, _helpers.removeExtraItems)(cardDataResults, limit, parentId) : cardDataResults;
|
|
194
187
|
if (!cardDataResults.length) return null;
|
|
195
|
-
var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults,
|
|
188
|
+
var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults, itemsToDisplay);
|
|
196
189
|
var _splitChildren = (0, _helpers.splitChildren)(children, cardDataResults, graphqlEntityMap, {
|
|
197
190
|
name: variableProps.name
|
|
198
191
|
}),
|
|
199
192
|
regularChildren = _splitChildren.regularChildren,
|
|
200
193
|
gtmChildren = _splitChildren.gtmChildren;
|
|
201
|
-
var updatedCards = (0, _helpers.appendImages)(imagesData, orderedData,
|
|
194
|
+
var updatedCards = (0, _helpers.appendImages)(imagesData, orderedData, itemsToDisplay);
|
|
202
195
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, gtmChildren && (0, _helpers.renderChildren)(gtmChildren), /*#__PURE__*/_react["default"].createElement(CardsContainer, (0, _extends2["default"])({
|
|
203
196
|
cardData: updatedCards,
|
|
204
197
|
entity: primaryEntityToUse,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_client","_dynamic","_interopRequireDefault","_propTypes","_nextjsComponents","_query","_constants","_hooks","_helpers","_helpers2","_excluded","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","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof2","cache","has","get","newObj","hasPropertyDescriptor","prototype","hasOwnProperty","call","desc","set","CardsContainer","dynamic","Promise","resolve","then","CardsRender","_ref","legacyEntity","entity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties2","_useContext","useContext","MainContext","isPreview","_otherProps$parent","parent","parentId","itemId","parentEntity","itemEntity","_otherProps$filterBy","filterBy","_otherProps$filterByP","filterByProperty","sortby","sort","_otherProps$sortPrope","sortProperties","_otherProps$operator","operator","filterOperator","AND","useRandomSort","_getUpdatedSortProper","getUpdatedSortProperties","_getUpdatedSortProper2","_slicedToArray2","updatedSortProperties","sortbyFilters","variableProps","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","getUnpublishedEntityName","allEntityNames","concat","_toConsumableArray2","uniqueEntityNames","Set","_useGetEntitySchemasA","useGetEntitySchemasAsObj","_useGetEntitySchemasA2","data","mainSchemas","_loading","loading","_error","error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref2","type","docType","entityTypes","_ref3","eType","_filtersSetup","filtersSetup","currentSchema","itemEntityUpdated","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","shouldSkipSingleQuery","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","parentEntityData","_err","_load","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","schemaLoading","schemaError","updatedFilterBy","getUpdatedFilterBy","updatedItemsToDisplay","getUpdatedItemsToDisplay","_filterQuerySetup","filterQuerySetup","getEntitySchemas","values","limit","hasNoFiltersOrItemsToDisplay","_useQuery2","fetchPolicy","shouldReturn","cardData","cardsError","cardsLoading","imageIds","_ref4","imageId","Boolean","_useGetImages","useGetImages","imagesData","imagesLoading","isLoading","hasError","message","cardDataResults","SEARCH_PUBLISHED_CONTENT","results","removeExtraItems","orderedData","sortResponseData","_splitChildren","splitChildren","name","regularChildren","gtmChildren","updatedCards","appendImages","createElement","Fragment","renderChildren","_extends2","cardChildren","propTypes","PropTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps","_default","exports"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT];\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n ent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,MAAA,YAAA+M,aAAA,CAAA/M,MAAA,YAAAgN,QAAA,QACGJ,WAAW,IAAI,IAAAK,uBAAc,EAACL,WAAW,CAAC,eAC3C5M,MAAA,YAAA+M,aAAA,CAACtJ,cAAc,MAAAyJ,SAAA;IACb9B,QAAQ,EAAEyB,YAAa;IACvB5I,MAAM,EAAEsC,kBAAmB;IAC3BqG,WAAW,EAAEA,WAAY;IACzBO,YAAY,EAAER,eAAgB;IAC9B7E,gBAAgB,EAAEA;EAAiB,GAC/BzB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAEDvC,WAAW,CAACsJ,SAAS,GAAG;EACtB/I,QAAQ,EAAEgJ,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClFvJ,MAAM,EAAEoJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACnCvJ,YAAY,EAAEkJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACzCtJ,cAAc,EAAEiJ,qBAAS,CAACM,KAAK;EAC/BzJ,QAAQ,EAAEmJ,qBAAS,CAACM;AACtB,CAAC;AAED7J,WAAW,CAAC8J,YAAY,GAAG;EACzBvJ,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA2J,QAAA,GAEa/J,WAAW;AAAAgK,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_client","_dynamic","_interopRequireDefault","_propTypes","_nextjsComponents","_query","_constants","_hooks","_helpers","_helpers2","_excluded","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","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof2","cache","has","get","newObj","hasPropertyDescriptor","prototype","hasOwnProperty","call","desc","set","CardsContainer","dynamic","Promise","resolve","then","CardsRender","_ref","legacyEntity","entity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties2","_useContext","useContext","MainContext","isPreview","_otherProps$parent","parent","parentId","itemId","parentEntity","itemEntity","_otherProps$filterBy","filterBy","_otherProps$filterByP","filterByProperty","sortby","sort","_otherProps$sortPrope","sortProperties","_otherProps$operator","operator","filterOperator","AND","useRandomSort","_getUpdatedSortProper","getUpdatedSortProperties","_getUpdatedSortProper2","_slicedToArray2","updatedSortProperties","sortbyFilters","variableProps","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","getUnpublishedEntityName","allEntityNames","concat","_toConsumableArray2","uniqueEntityNames","Set","_useGetEntitySchemasA","useGetEntitySchemasAsObj","_useGetEntitySchemasA2","data","mainSchemas","_loading","loading","_error","error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref2","type","docType","entityTypes","_ref3","eType","_filtersSetup","filtersSetup","currentSchema","itemEntityUpdated","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","shouldSkipSingleQuery","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","parentEntityData","_err","_load","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","schemaLoading","schemaError","updatedFilterBy","getUpdatedFilterBy","_filterQuerySetup","filterQuerySetup","getEntitySchemas","values","limit","_useQuery2","fetchPolicy","shouldReturn","cardData","cardsError","cardsLoading","imageIds","_ref4","imageId","Boolean","_useGetImages","useGetImages","imagesData","imagesLoading","isLoading","hasError","message","cardDataResults","SEARCH_PUBLISHED_CONTENT","results","removeExtraItems","orderedData","sortResponseData","_splitChildren","splitChildren","name","regularChildren","gtmChildren","updatedCards","appendImages","createElement","Fragment","renderChildren","_extends2","cardChildren","propTypes","PropTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps","_default","exports"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName\n });\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)\n });\n\n const imageIds = itemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (!updatedFilterBy) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT];\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, itemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, itemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,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S,CAACI,MAAM,CAACC,UAAU;EACzCnJ,cAAc,EAAE8I,qBAAS,CAACM,KAAK;EAC/BtJ,QAAQ,EAAEgJ,qBAAS,CAACM;AACtB,CAAC;AAED1J,WAAW,CAAC2J,YAAY,GAAG;EACzBpJ,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAAwJ,QAAA,GAEa5J,WAAW;AAAA6J,OAAA,cAAAD,QAAA"}
|
|
@@ -29,12 +29,6 @@ Object.defineProperty(exports, "getPublishedListingUrl", {
|
|
|
29
29
|
return _getPublishedListingUrl["default"];
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports, "getUpdatedItemsToDisplay", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return _getUpdatedItemsToDisplay["default"];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
32
|
Object.defineProperty(exports, "getUpdatedSortProperties", {
|
|
39
33
|
enumerable: true,
|
|
40
34
|
get: function get() {
|
|
@@ -67,5 +61,4 @@ var _filterQuerySetup = _interopRequireDefault(require("./filter-query-setup"));
|
|
|
67
61
|
var _shouldReturn = _interopRequireDefault(require("./should-return"));
|
|
68
62
|
var _shouldSkipSingleQuery = _interopRequireDefault(require("./should-skip-single-query"));
|
|
69
63
|
var _getUpdatedSortProperties = _interopRequireDefault(require("./get-updated-sort-properties"));
|
|
70
|
-
var _getUpdatedItemsToDisplay = _interopRequireDefault(require("./get-updated-items-to-display"));
|
|
71
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_getPublishedListingUrl","_interopRequireDefault","require","_useDynamicSizeKey","_getDynamicGridClasses","_filtersSetup","_filterQuerySetup","_shouldReturn","_shouldSkipSingleQuery","_getUpdatedSortProperties"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_getPublishedListingUrl","_interopRequireDefault","require","_useDynamicSizeKey","_getDynamicGridClasses","_filtersSetup","_filterQuerySetup","_shouldReturn","_shouldSkipSingleQuery","_getUpdatedSortProperties"],"sources":["../../../../src/components/Card/helpers/index.js"],"sourcesContent":["export { default as getPublishedListingUrl } from './get-published-listing-url';\nexport { default as useDynamicSizeKey } from './use-dynamic-size-key';\nexport { default as getDynamicGridClasses } from './get-dynamic-grid-classes';\nexport { default as filtersSetup } from './filters-setup';\nexport { default as filterQuerySetup } from './filter-query-setup';\nexport { default as shouldReturn } from './should-return';\nexport { default as shouldSkipSingleQuery } from './should-skip-single-query';\nexport { default as getUpdatedSortProperties } from './get-updated-sort-properties';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA"}
|
|
@@ -30,7 +30,7 @@ var _HOC = require("../../HOC");
|
|
|
30
30
|
var _utils = require("../../utils");
|
|
31
31
|
var _constants = require("../../constants");
|
|
32
32
|
var _helpers = require("./helpers");
|
|
33
|
-
var _excluded = ["code", "parserOptions"
|
|
33
|
+
var _excluded = ["code", "parserOptions"];
|
|
34
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
36
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -38,13 +38,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
38
38
|
var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
39
39
|
var embedCode = _ref.code,
|
|
40
40
|
parserOptions = _ref.parserOptions,
|
|
41
|
-
disableWrapper = _ref.disableWrapper,
|
|
42
41
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
43
42
|
if (!embedCode) return null;
|
|
44
43
|
var parsedCode = (0, _htmlReactParser["default"])(embedCode, parserOptions);
|
|
45
44
|
var wrappedCode = (0, _helpers.wrapScriptTags)(parsedCode);
|
|
46
45
|
var modifiers = (0, _utils.getClassModifiers)(_constants.CODE, _objectSpread({}, otherProps));
|
|
47
|
-
if (disableWrapper) return wrappedCode;
|
|
48
46
|
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
|
|
49
47
|
modifiers: modifiers
|
|
50
48
|
}, wrappedCode);
|
|
@@ -52,14 +50,12 @@ var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
52
50
|
Code.propTypes = {
|
|
53
51
|
code: _propTypes["default"].string,
|
|
54
52
|
modifier: _propTypes["default"].string,
|
|
55
|
-
parserOptions: _propTypes["default"].object
|
|
56
|
-
disableWrapper: _propTypes["default"].bool
|
|
53
|
+
parserOptions: _propTypes["default"].object
|
|
57
54
|
};
|
|
58
55
|
Code.defaultProps = {
|
|
59
56
|
code: '',
|
|
60
57
|
modifier: '',
|
|
61
|
-
parserOptions: {}
|
|
62
|
-
disableWrapper: false
|
|
58
|
+
parserOptions: {}
|
|
63
59
|
};
|
|
64
60
|
var _default = (0, _HOC.withTitle)(Code);
|
|
65
61
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Code.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_htmlReactParser","_Wrapper","_HOC","_utils","_constants","_helpers","_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","Code","memo","_ref","embedCode","code","parserOptions","
|
|
1
|
+
{"version":3,"file":"Code.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_htmlReactParser","_Wrapper","_HOC","_utils","_constants","_helpers","_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","Code","memo","_ref","embedCode","code","parserOptions","otherProps","_objectWithoutProperties2","parsedCode","parseHTML","wrappedCode","wrapScriptTags","modifiers","getClassModifiers","CODE","createElement","propTypes","PropTypes","string","modifier","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/Code/Code.js"],"sourcesContent":["import React, { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport Wrapper from '../Wrapper';\nimport { withTitle } from '../../HOC';\nimport { getClassModifiers } from '../../utils';\nimport { CODE } from '../../constants';\nimport { wrapScriptTags } from './helpers';\n\nconst Code = memo(({ code: embedCode, parserOptions, ...otherProps }) => {\n if (!embedCode) return null;\n\n const parsedCode = parseHTML(embedCode, parserOptions);\n const wrappedCode = wrapScriptTags(parsedCode);\n const modifiers = getClassModifiers(CODE, { ...otherProps });\n\n return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;\n});\n\nCode.propTypes = {\n code: PropTypes.string,\n modifier: PropTypes.string,\n parserOptions: PropTypes.object\n};\n\nCode.defaultProps = {\n code: '',\n modifier: '',\n parserOptions: {}\n};\n\nexport default withTitle(Code);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAA2C,IAAAS,SAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OA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AACC,eAAI,EAAAxB,aAAA,KAAOgB,UAAU,CAAE,CAAC;EAE5D,oBAAO7D,MAAA,YAAAsE,aAAA,CAAChE,QAAA,WAAO;IAAC6D,SAAS,EAAEA;EAAU,GAAEF,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFV,IAAI,CAACgB,SAAS,GAAG;EACfZ,IAAI,EAAEa,qBAAS,CAACC,MAAM;EACtBC,QAAQ,EAAEF,qBAAS,CAACC,MAAM;EAC1Bb,aAAa,EAAEY,qBAAS,CAACrC;AAC3B,CAAC;AAEDoB,IAAI,CAACoB,YAAY,GAAG;EAClBhB,IAAI,EAAE,EAAE;EACRe,QAAQ,EAAE,EAAE;EACZd,aAAa,EAAE,CAAC;AAClB,CAAC;AAAC,IAAAgB,QAAA,GAEa,IAAAC,cAAS,EAACtB,IAAI,CAAC;AAAAuB,OAAA,cAAAF,QAAA"}
|
|
@@ -20,7 +20,6 @@ var _lodash2 = _interopRequireDefault(require("lodash.flatten"));
|
|
|
20
20
|
var _getLinkToPublishedContent = _interopRequireDefault(require("./get-link-to-published-content"));
|
|
21
21
|
var _getLoopPropsLimit = _interopRequireDefault(require("./get-loop-props-limit"));
|
|
22
22
|
var _getPropValue = _interopRequireDefault(require("./get-prop-value"));
|
|
23
|
-
var _helpers = require("../../../helpers");
|
|
24
23
|
var getLoopValue = function getLoopValue(value) {
|
|
25
24
|
var keyField = value.keyField;
|
|
26
25
|
return value[keyField];
|
|
@@ -65,9 +64,8 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
65
64
|
var loopValue = loopValues[key];
|
|
66
65
|
var propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
67
66
|
if (!propValue) return null;
|
|
68
|
-
var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
|
|
69
67
|
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data);
|
|
70
|
-
return [(0, _lodash["default"])(label),
|
|
68
|
+
return [(0, _lodash["default"])(label), propValue, linkToPublishedContent, modifier];
|
|
71
69
|
});
|
|
72
70
|
})).filter(Boolean);
|
|
73
71
|
loopPropsWithContent.push(propsArray);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","propValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label), propValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAMK,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK,EAAI;EAC5B,IAAQC,QAAQ,GAAKD,KAAK,CAAlBC,QAAQ;EAChB,OAAOD,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,cAAc,EAAEC,SAAS,EAAEC,IAAI,EAAK;EAC1D,IAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,IAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAAC,UAAAC,OAAO,EAAI;IAChC,IAAQC,mBAAmB,GAAKD,OAAO,CAA/BC,mBAAmB;IAC3BA,mBAAmB,CAACF,OAAO,CAAC,UAAAG,IAAI,EAAI;MAClC,IAAMX,KAAK,GAAG,IAAAY,wBAA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) return null;
|
|
38
38
|
var objPropValue = (0, _getPropValue["default"])(key, props, options);
|
|
39
39
|
if (!objPropValue) return null;
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
return [(0, _lodash["default"])(label), processedValue, link, modifier];
|
|
40
|
+
var link = getLink(enableLink, key, props, objPropValue);
|
|
41
|
+
return [(0, _lodash["default"])(label), objPropValue, link, modifier];
|
|
43
42
|
});
|
|
44
43
|
})).filter(Boolean);
|
|
45
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-to-display-with-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_helpers","_getLinkToPublishedContent","_getPropValue","_getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","arguments","length","undefined","isObject","map","key","propValue","getPropValue","propName","split","join","upperFirst","filter","Boolean","flatten","options","propertiesToDisplay","label","_options$modifier","modifier","enableLink","objPropValue","
|
|
1
|
+
{"version":3,"file":"build-props-to-display-with-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_helpers","_getLinkToPublishedContent","_getPropValue","_getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","arguments","length","undefined","isObject","map","key","propValue","getPropValue","propName","split","join","upperFirst","filter","Boolean","flatten","options","propertiesToDisplay","label","_options$modifier","modifier","enableLink","objPropValue","link","getLink","_default","exports","getLinkToPublishedContent","getLinkBasedOnValue"],"sources":["../../../../src/components/DataSummary/helpers/build-props-to-display-with-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport { isObject } from '../../../helpers';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getPropValue from './get-prop-value';\nimport getLinkBasedOnValue from './get-link-based-on-value';\n\nconst buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) {\n return propsToDisplay\n .map(key => {\n if (!key) return null;\n const propValue = getPropValue(key, props);\n if (!propValue) return null;\n const propName = key.split('.').join(' ');\n return [upperFirst(propName), propValue, '', ''];\n })\n .filter(Boolean);\n }\n\n return flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '', enableLink } = options;\n return propertiesToDisplay.map(key => {\n if (!key) return null;\n\n const objPropValue = getPropValue(key, props, options);\n if (!objPropValue) return null;\n\n const link = getLink(enableLink, key, props, objPropValue);\n\n return [upperFirst(label), objPropValue, link, modifier];\n });\n })\n ).filter(Boolean);\n};\n\nexport default buildPropsToDisplayWithContent;\nfunction getLink(enableLink, key, props, objPropValue) {\n let link = '';\n if (enableLink) {\n link = getLinkToPublishedContent(key, props);\n if (!link) {\n link = getLinkBasedOnValue(objPropValue);\n }\n }\n return link;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,oBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAMM,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAAIC,KAAK,EAA0B;EAAA,IAAxBC,cAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAChE,IAAI,CAAC,IAAAG,iBAAQ,EAACJ,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;IAChC,OAAOA,cAAc,CAClBK,GAAG,CAAC,UAAAC,GAAG,EAAI;MACV,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MACrB,IAAMC,SAAS,GAAG,IAAAC,wBAAY,EAACF,GAAG,EAAEP,KAAK,CAAC;MAC1C,IAAI,CAACQ,SAAS,EAAE,OAAO,IAAI;MAC3B,IAAME,QAAQ,GAAGH,GAAG,CAACI,KAAK,CAA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AAI,qCAAyB,EAACrB,GAAG,EAAEP,KAAK,CAAC;IAC5C,IAAI,CAACwB,IAAI,EAAE;MACTA,IAAI,GAAG,IAAAK,+BAAmB,EAACN,YAAY,CAAC;IAC1C;EACF;EACA,OAAOC,IAAI;AACb"}
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
exports["default"] = void 0;
|
|
18
18
|
require("core-js/modules/es.array.concat.js");
|
|
19
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
19
20
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
21
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
22
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -26,7 +27,7 @@ var _hooks = require("../../hooks");
|
|
|
26
27
|
var _helpers = require("./helpers");
|
|
27
28
|
var _helpers2 = require("../../helpers");
|
|
28
29
|
var _constants = require("../../constants");
|
|
29
|
-
var _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "tagType"];
|
|
30
|
+
var _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "tagType", "dataNoSnippet"];
|
|
30
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
33
|
var Layout = function Layout(_ref) {
|
|
@@ -36,6 +37,7 @@ var Layout = function Layout(_ref) {
|
|
|
36
37
|
modifier = _ref.modifier,
|
|
37
38
|
backgroundImage = _ref.backgroundImage,
|
|
38
39
|
tagType = _ref.tagType,
|
|
40
|
+
dataNoSnippet = _ref.dataNoSnippet,
|
|
39
41
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
40
42
|
var _useGetImages = (0, _hooks.useGetImages)(backgroundImage),
|
|
41
43
|
_useGetImages$data$ge = _useGetImages.data.getFile,
|
|
@@ -51,12 +53,14 @@ var Layout = function Layout(_ref) {
|
|
|
51
53
|
}, otherProps));
|
|
52
54
|
var additionalRowModifier = (0, _helpers.checkIfRowHasColumns)(type, children) ? ' display-row' : '';
|
|
53
55
|
if (type === _constants.COLUMN && !(0, _helpers2.hasChildren)(children)) return null;
|
|
54
|
-
|
|
56
|
+
var otherWrapperProps = {};
|
|
57
|
+
if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;
|
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], (0, _extends2["default"])({
|
|
55
59
|
tagType: tagType,
|
|
56
60
|
className: type,
|
|
57
61
|
modifiers: "".concat(classModifiers).concat(additionalRowModifier),
|
|
58
62
|
style: style
|
|
59
|
-
}, title && /*#__PURE__*/_react["default"].createElement("h2", {
|
|
63
|
+
}, otherWrapperProps), title && /*#__PURE__*/_react["default"].createElement("h2", {
|
|
60
64
|
className: "heading heading--section"
|
|
61
65
|
}, title), (0, _helpers2.renderChildren)(children, otherProps));
|
|
62
66
|
};
|
|
@@ -68,6 +72,7 @@ Layout.propTypes = {
|
|
|
68
72
|
modifier: _propTypes["default"].string,
|
|
69
73
|
backgroundImage: _propTypes["default"].string,
|
|
70
74
|
tagType: _propTypes["default"].string,
|
|
75
|
+
dataNoSnippet: _propTypes["default"].bool,
|
|
71
76
|
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired
|
|
72
77
|
};
|
|
73
78
|
Layout.defaultProps = {
|
|
@@ -76,7 +81,8 @@ Layout.defaultProps = {
|
|
|
76
81
|
},
|
|
77
82
|
backgroundImage: '',
|
|
78
83
|
modifier: '',
|
|
79
|
-
tagType: ''
|
|
84
|
+
tagType: '',
|
|
85
|
+
dataNoSnippet: false
|
|
80
86
|
};
|
|
81
87
|
var _default = Layout;
|
|
82
88
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","names":["_react","_interopRequireDefault","require","_propTypes","_Wrapper","_utils","_hooks","_helpers","_helpers2","_constants","_excluded","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","Layout","_ref","type","children","settings","modifier","backgroundImage","tagType","otherProps","_objectWithoutProperties2","_useGetImages","useGetImages","_useGetImages$data$ge","data","getFile","_useGetImages$data$ge2","_useGetImages$data$ge3","url","style","getStylesToUpdate","title","classModifiers","getClassModifiers","additionalRowModifier","checkIfRowHasColumns","COLUMN","hasChildren","createElement","className","modifiers","concat","renderChildren","propTypes","PropTypes","string","isRequired","shape","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = ({\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n tagType,\n ...otherProps\n}) => {\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage);\n\n const style = getStylesToUpdate({ backgroundImage: url });\n const { title } = settings;\n\n const classModifiers = getClassModifiers(type, { modifier, ...otherProps });\n const additionalRowModifier = checkIfRowHasColumns(type, children) ? ' display-row' : '';\n\n if (type === COLUMN && !hasChildren(children)) return null;\n\n return (\n <Wrapper\n tagType={tagType}\n className={type}\n modifiers={`${classModifiers}${additionalRowModifier}`}\n style={style}>\n {title && <h2 className=\"heading heading--section\">{title}</h2>}\n {renderChildren(children, otherProps)}\n </Wrapper>\n );\n};\n\nLayout.propTypes = {\n type: PropTypes.string.isRequired,\n settings: PropTypes.shape({\n title: PropTypes.string\n }),\n modifier: PropTypes.string,\n backgroundImage: PropTypes.string,\n tagType: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nLayout.defaultProps = {\n settings: {\n title: ''\n },\n backgroundImage: '',\n modifier: '',\n tagType: ''\n};\n\nexport default Layout;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Layout.js","names":["_react","_interopRequireDefault","require","_propTypes","_Wrapper","_utils","_hooks","_helpers","_helpers2","_constants","_excluded","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","Layout","_ref","type","children","settings","modifier","backgroundImage","tagType","dataNoSnippet","otherProps","_objectWithoutProperties2","_useGetImages","useGetImages","_useGetImages$data$ge","data","getFile","_useGetImages$data$ge2","_useGetImages$data$ge3","url","style","getStylesToUpdate","title","classModifiers","getClassModifiers","additionalRowModifier","checkIfRowHasColumns","COLUMN","hasChildren","otherWrapperProps","createElement","_extends2","className","modifiers","concat","renderChildren","propTypes","PropTypes","string","isRequired","shape","bool","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = ({\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n tagType,\n dataNoSnippet,\n ...otherProps\n}) => {\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage);\n\n const style = getStylesToUpdate({ backgroundImage: url });\n const { title } = settings;\n\n const classModifiers = getClassModifiers(type, { modifier, ...otherProps });\n const additionalRowModifier = checkIfRowHasColumns(type, children) ? ' display-row' : '';\n\n if (type === COLUMN && !hasChildren(children)) return null;\n\n const otherWrapperProps = {};\n if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;\n\n return (\n <Wrapper\n tagType={tagType}\n className={type}\n modifiers={`${classModifiers}${additionalRowModifier}`}\n style={style}\n {...otherWrapperProps}>\n {title && <h2 className=\"heading heading--section\">{title}</h2>}\n {renderChildren(children, otherProps)}\n </Wrapper>\n );\n};\n\nLayout.propTypes = {\n type: PropTypes.string.isRequired,\n settings: PropTypes.shape({\n title: PropTypes.string\n }),\n modifier: PropTypes.string,\n backgroundImage: PropTypes.string,\n tagType: PropTypes.string,\n dataNoSnippet: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nLayout.defaultProps = {\n settings: {\n title: ''\n },\n backgroundImage: '',\n modifier: '',\n tagType: '',\n dataNoSnippet: false\n};\n\nexport default Layout;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAC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SAAS,EAAE7B,IAAK;IAChB8B,SAAS,KAAAC,MAAA,CAAKX,cAAc,EAAAW,MAAA,CAAGT,qBAAqB,CAAG;IACvDL,KAAK,EAAEA;EAAM,GACTS,iBAAiB,GACpBP,KAAK,iBAAIzD,MAAA,YAAAiE,aAAA;IAAIE,SAAS,EAAC;EAA0B,GAAEV,KAAU,CAAC,EAC9D,IAAAa,wBAAc,EAAC/B,QAAQ,EAAEM,UAAU,CAC7B,CAAC;AAEd,CAAC;AAEDT,MAAM,CAACmC,SAAS,GAAG;EACjBjC,IAAI,EAAEkC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjClC,QAAQ,EAAEgC,qBAAS,CAACG,KAAK,CAAC;IACxBlB,KAAK,EAAEe,qBAAS,CAACC;EACnB,CAAC,CAAC;EACFhC,QAAQ,EAAE+B,qBAAS,CAACC,MAAM;EAC1B/B,eAAe,EAAE8B,qBAAS,CAACC,MAAM;EACjC9B,OAAO,EAAE6B,qBAAS,CAACC,MAAM;EACzB7B,aAAa,EAAE4B,qBAAS,CAACI,IAAI;EAC7BrC,QAAQ,EAAEiC,qBAAS,CAACK,SAAS,CAAC,CAACL,qBAAS,CAACM,OAAO,CAACN,qBAAS,CAACO,IAAI,CAAC,EAAEP,qBAAS,CAACO,IAAI,CAAC,CAAC,CAACL;AACrF,CAAC;AAEDtC,MAAM,CAAC4C,YAAY,GAAG;EACpBxC,QAAQ,EAAE;IACRiB,KAAK,EAAE;EACT,CAAC;EACDf,eAAe,EAAE,EAAE;EACnBD,QAAQ,EAAE,EAAE;EACZE,OAAO,EAAE,EAAE;EACXC,aAAa,EAAE;AACjB,CAAC;AAAC,IAAAqC,QAAA,GAEa7C,MAAM;AAAA8C,OAAA,cAAAD,QAAA"}
|
|
@@ -29,11 +29,11 @@ var SearchContent = function SearchContent(_ref) {
|
|
|
29
29
|
searchInputAlignment = _ref.searchInputAlignment,
|
|
30
30
|
searchInputWrapperMobile = _ref.searchInputWrapperMobile,
|
|
31
31
|
searchInputWrapperDesktop = _ref.searchInputWrapperDesktop,
|
|
32
|
+
collapsible = _ref.collapsible,
|
|
32
33
|
isMobile = _ref.isMobile,
|
|
33
34
|
placeholder = _ref.placeholder,
|
|
34
|
-
modifier = _ref.modifier
|
|
35
|
-
|
|
36
|
-
var _useState = (0, _react.useState)(collapsedSearch),
|
|
35
|
+
modifier = _ref.modifier;
|
|
36
|
+
var _useState = (0, _react.useState)(collapsible),
|
|
37
37
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
38
38
|
collapsed = _useState2[0],
|
|
39
39
|
setCollapsed = _useState2[1];
|
|
@@ -67,7 +67,7 @@ var SearchContent = function SearchContent(_ref) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
var handleOnBlur = function handleOnBlur() {
|
|
70
|
-
if (!
|
|
70
|
+
if (!collapsible) return;
|
|
71
71
|
if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);
|
|
72
72
|
};
|
|
73
73
|
var handleClearSearchResults = function handleClearSearchResults() {
|
|
@@ -135,8 +135,7 @@ SearchContent.propTypes = {
|
|
|
135
135
|
isMobile: _propTypes["default"].bool,
|
|
136
136
|
collapsible: _propTypes["default"].bool,
|
|
137
137
|
entities: _propTypes["default"].array.isRequired,
|
|
138
|
-
modifier: _propTypes["default"].string
|
|
139
|
-
collapsedSearch: _propTypes["default"].bool
|
|
138
|
+
modifier: _propTypes["default"].string
|
|
140
139
|
};
|
|
141
140
|
SearchContent.defaultProps = {
|
|
142
141
|
searchInputAlignment: '',
|
|
@@ -145,8 +144,7 @@ SearchContent.defaultProps = {
|
|
|
145
144
|
placeholder: '',
|
|
146
145
|
isMobile: false,
|
|
147
146
|
collapsible: false,
|
|
148
|
-
modifier: ''
|
|
149
|
-
collapsedSearch: false
|
|
147
|
+
modifier: ''
|
|
150
148
|
};
|
|
151
149
|
var _default = SearchContent;
|
|
152
150
|
exports["default"] = _default;
|