@blaze-cms/react-page-builder 0.131.1 → 0.132.0-admin-updates.1
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 +101 -2
- package/lib/components/Button.js +2 -1
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsRender.js +13 -6
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/get-updated-items-to-display.js +55 -0
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib/components/Card/helpers/index.js +7 -0
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
- package/lib/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
- package/lib/components/Code/Code.js +7 -3
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +6 -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 +3 -2
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib/components/List/ListFactory.js +16 -11
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/get-list-query.js +43 -0
- package/lib/components/List/helpers/get-list-query.js.map +1 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js +21 -0
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib/components/List/helpers/index.js +14 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/List/helpers/strip-query-key.js +14 -0
- package/lib/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib/components/SearchContent/SearchContent.js +8 -8
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +17 -13
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +64 -83
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +3 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +17 -0
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js +49 -0
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +32 -0
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js +31 -0
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +18 -11
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +43 -0
- package/lib/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js +31 -11
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +19 -5
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +9 -5
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +2 -0
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +5 -2
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-query-key.js +16 -0
- package/lib/helpers/build-query-key.js.map +1 -0
- package/lib/helpers/build-set-filters.js +5 -1
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +8 -2
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-query-filters.js +6 -8
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +13 -2
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +2 -3
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +14 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +13 -8
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +56 -0
- package/lib/helpers/process-data-summary-value.js.map +1 -0
- package/lib-es/components/Button.js +2 -1
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +14 -7
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
- package/lib-es/components/Card/helpers/index.js +1 -0
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
- package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
- package/lib-es/components/Code/Code.js +8 -4
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +6 -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 +4 -3
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +16 -12
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/get-list-query.js +24 -0
- package/lib-es/components/List/helpers/get-list-query.js.map +1 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +12 -0
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +2 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/List/helpers/strip-query-key.js +6 -0
- package/lib-es/components/List/helpers/strip-query-key.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContent.js +8 -8
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +18 -13
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +48 -70
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +2 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +31 -0
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +18 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +19 -0
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +5 -4
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/index.js +2 -2
- package/lib-es/components/SearchFilter/index.js.map +1 -1
- package/lib-es/components/SearchFilter/searchFilterReducer.js +26 -0
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +1 -0
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js +26 -10
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +21 -4
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +8 -4
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +2 -0
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +4 -2
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-query-key.js +7 -0
- package/lib-es/helpers/build-query-key.js.map +1 -0
- package/lib-es/helpers/build-set-filters.js +5 -1
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-entities-with-banner.js +9 -2
- package/lib-es/helpers/get-entities-with-banner.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +6 -8
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +10 -2
- 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 +2 -0
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +12 -9
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/helpers/process-data-summary-value.js +36 -0
- package/lib-es/helpers/process-data-summary-value.js.map +1 -0
- package/package.json +10 -10
- package/src/components/Button.js +2 -1
- package/src/components/Card/CardsRender.js +27 -7
- package/src/components/Card/helpers/get-updated-items-to-display.js +32 -0
- package/src/components/Card/helpers/index.js +1 -0
- package/src/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
- package/src/components/Code/Code.js +7 -3
- package/src/components/DataSummary/helpers/build-loop-props-content.js +7 -3
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +6 -3
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
- package/src/components/List/ListFactory.js +25 -15
- package/src/components/List/helpers/get-list-query.js +28 -0
- package/src/components/List/helpers/get-list-specific-search-filter.js +10 -0
- package/src/components/List/helpers/index.js +2 -0
- package/src/components/List/helpers/strip-query-key.js +6 -0
- package/src/components/SearchContent/SearchContent.js +8 -8
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +21 -18
- package/src/components/SearchFilter/SearchFilterContainer.js +59 -67
- package/src/components/SearchFilter/helpers/build-filters-query.js +9 -1
- package/src/components/SearchFilter/helpers/build-new-url.js +8 -0
- package/src/components/SearchFilter/helpers/build-url-query.js +33 -0
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +17 -0
- package/src/components/SearchFilter/helpers/get-filter-values.js +21 -0
- package/src/components/SearchFilter/helpers/index.js +9 -7
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilter/searchFilterReducer.js +15 -0
- package/src/components/SearchFilterSort/SearchFilterSort.js +18 -8
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +14 -5
- package/src/components/SearchFilterSort/helpers/update-sort.js +7 -3
- package/src/helpers/build-inherited-filters.js +3 -1
- package/src/helpers/build-props-query.js +4 -2
- package/src/helpers/build-query-key.js +7 -0
- package/src/helpers/build-set-filters.js +2 -1
- package/src/helpers/get-entities-with-banner.js +3 -2
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +12 -4
- package/src/helpers/get-wrapped-value-with-link.js +6 -3
- package/src/helpers/index.js +2 -0
- package/src/helpers/parse-props-to-display.js +25 -21
- package/src/helpers/process-data-summary-value.js +22 -0
- package/tests/helpers/mocks.js +3 -5
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +72 -0
- package/tests/unit/src/components/Code/Code.test.js +5 -0
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +8 -0
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +50 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +1 -7
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +24 -7
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +4 -1
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +26 -19
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +10 -1
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +18 -0
- package/tests/unit/src/helpers/build-props-query.test.js +25 -0
- 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 +4 -0
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +52 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js +0 -15
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-query.js +0 -37
- package/lib/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +0 -43
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js +0 -23
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +0 -26
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
- package/src/components/SearchFilter/helpers/build-new-query.js +0 -6
- package/src/components/SearchFilter/helpers/build-query.js +0 -26
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,111 @@
|
|
|
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
|
-
|
|
6
|
+
# [0.132.0-admin-updates.1](https://github.com/thebyte9/blaze/compare/v0.131.1...v0.132.0-admin-updates.1) (2023-08-04)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
*
|
|
11
|
+
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([5bc7813](https://github.com/thebyte9/blaze/commit/5bc78136356ce826a92da7f8045ac4c2c44796ed))
|
|
12
|
+
* add second render ([24d7f7b](https://github.com/thebyte9/blaze/commit/24d7f7bcb26ad138b093fc1a04bc2fcaa304cdef))
|
|
13
|
+
* add second render ([885e1b4](https://github.com/thebyte9/blaze/commit/885e1b401a564e8212acb6e2f6189e53a6f6cc87))
|
|
14
|
+
* added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([54ecb64](https://github.com/thebyte9/blaze/commit/54ecb64eb2e36ffe7e8dacb39a20a6a06487ba5e))
|
|
15
|
+
* carousel - set min width to the content ([6d0dd8f](https://github.com/thebyte9/blaze/commit/6d0dd8fdd0381fa69c5b7a7084cc2960927d38a1))
|
|
16
|
+
* carousel - set min width to the content ([e8b9267](https://github.com/thebyte9/blaze/commit/e8b9267201cac2de4f8bdf7cb778ed26b4b5ca84))
|
|
17
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([30595ef](https://github.com/thebyte9/blaze/commit/30595ef155783e78adc4f153230dccb33556e2f8))
|
|
18
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([a8700c6](https://github.com/thebyte9/blaze/commit/a8700c63715f864a1178630d810216c274484b97))
|
|
19
|
+
* hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([e3a502c](https://github.com/thebyte9/blaze/commit/e3a502ca5b6b4f9028072e0b2fe19630a240b840))
|
|
20
|
+
* hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([f5b89e0](https://github.com/thebyte9/blaze/commit/f5b89e0624ab2318e4cd12510638341db354a0de))
|
|
21
|
+
* improve animation ([898a36e](https://github.com/thebyte9/blaze/commit/898a36e67379c8ec550d36cb23041e042b847d56))
|
|
22
|
+
* improve animation ([088bfb5](https://github.com/thebyte9/blaze/commit/088bfb54e36658944d2f13a67e0e90cc674eabca))
|
|
23
|
+
* remove log ([f56fc03](https://github.com/thebyte9/blaze/commit/f56fc0334900e314ea61ed1e6201febc29fdf7e6))
|
|
24
|
+
* reset search filters and handle single text property ([#3996](https://github.com/thebyte9/blaze/issues/3996)) ([85ddfdd](https://github.com/thebyte9/blaze/commit/85ddfdda1acc61f8bb6382630205cfb82ed2e5ac))
|
|
25
|
+
* set width to carousel container ([5926a7a](https://github.com/thebyte9/blaze/commit/5926a7a285c568514dfbca9360335c1e88836a0c))
|
|
26
|
+
* set width to carousel container ([7ff4e62](https://github.com/thebyte9/blaze/commit/7ff4e6242b2f31a83c605f5edec508ce256aab5a))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([fbf2d75](https://github.com/thebyte9/blaze/commit/fbf2d75f39597f83f78cd435277c07676a21c245))
|
|
32
|
+
* add sticky setting to column and row ([#3988](https://github.com/thebyte9/blaze/issues/3988)) ([85338da](https://github.com/thebyte9/blaze/commit/85338da6b76f8bc5a1c1179dde51bf61a05b2698))
|
|
33
|
+
* enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([d407785](https://github.com/thebyte9/blaze/commit/d407785489f44ec410b528307f7e7156f8f975a9))
|
|
34
|
+
* Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([cefef82](https://github.com/thebyte9/blaze/commit/cefef82d4ee113f70c156473bef9ab98cdffb3d2))
|
|
35
|
+
* Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([39c0af3](https://github.com/thebyte9/blaze/commit/39c0af3ed266369968139efe827a805ced71bd70))
|
|
36
|
+
* filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([4027759](https://github.com/thebyte9/blaze/commit/4027759ecf893976e9479db5d1c8d5aec8a2c031))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# [0.132.0-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.131.0...v0.132.0-admin-updates.0) (2023-07-27)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([3703a29](https://github.com/thebyte9/blaze/commit/3703a29d9a838f857863430d9223025900f29880))
|
|
46
|
+
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([d133a19](https://github.com/thebyte9/blaze/commit/d133a1965fdb447824dfdb87566809d7597a24b2))
|
|
47
|
+
* add second render ([488b2b6](https://github.com/thebyte9/blaze/commit/488b2b65b437db9beff90eaf38f6a8d2dc30f3a9))
|
|
48
|
+
* added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([f634575](https://github.com/thebyte9/blaze/commit/f634575cd6865dbc23391634c177efe4826d44c6))
|
|
49
|
+
* added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([1940547](https://github.com/thebyte9/blaze/commit/19405477315238fe8b14c974645675ec285ee85a))
|
|
50
|
+
* carousel - set min width to the content ([7313a94](https://github.com/thebyte9/blaze/commit/7313a947d816716c607afaed6eaa61c3f26b0e89))
|
|
51
|
+
* handle data summary urls in loops correctly ([#3993](https://github.com/thebyte9/blaze/issues/3993)) ([008e1a1](https://github.com/thebyte9/blaze/commit/008e1a1f24f065b4060302c2c32d1aa32dd8a007))
|
|
52
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([e0c37fc](https://github.com/thebyte9/blaze/commit/e0c37fcff2479f531f2f337b4e98b4edf57b4795))
|
|
53
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([04e4cb3](https://github.com/thebyte9/blaze/commit/04e4cb380520ea7c9b20860bf9cb4ea2facd27ad))
|
|
54
|
+
* hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([268eddc](https://github.com/thebyte9/blaze/commit/268eddcc71d42b3d63770554684bf79a5f163b7e))
|
|
55
|
+
* hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([e9e1a6d](https://github.com/thebyte9/blaze/commit/e9e1a6da969d9afc5f9ddaffcb7bf2238c84d898))
|
|
56
|
+
* improve animation ([b9111b5](https://github.com/thebyte9/blaze/commit/b9111b59f9f297f5b4701bf5c42b0acd718d9985))
|
|
57
|
+
* remove log ([9eac18f](https://github.com/thebyte9/blaze/commit/9eac18fa06744a11d8e57d5b4a1d58f488ada931))
|
|
58
|
+
* reset search filters and handle single text property ([#3996](https://github.com/thebyte9/blaze/issues/3996)) ([0160414](https://github.com/thebyte9/blaze/commit/016041454d30cc4cfc0a4c8e2d484fcedc2a631c))
|
|
59
|
+
* set width to carousel container ([d8f3ffb](https://github.com/thebyte9/blaze/commit/d8f3ffbdd22df47dcac88446828c2af5ac0f3318))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([6005cdf](https://github.com/thebyte9/blaze/commit/6005cdf0e18f2eea51cc7bc143cf34423743fe5e))
|
|
65
|
+
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([78b6ed2](https://github.com/thebyte9/blaze/commit/78b6ed2735e94e078d4b174777ba3a99fc1a6b4c))
|
|
66
|
+
* add sticky setting to column and row ([#3988](https://github.com/thebyte9/blaze/issues/3988)) ([1d1a219](https://github.com/thebyte9/blaze/commit/1d1a21901b23fe184e1eadf2bbb49551dd5f9b33))
|
|
67
|
+
* enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([67b3c7f](https://github.com/thebyte9/blaze/commit/67b3c7fee9ffd60526dae525fea4d87097742453))
|
|
68
|
+
* enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([5411725](https://github.com/thebyte9/blaze/commit/54117258b20ecb95b6359a8a412c8317b38b4fb3))
|
|
69
|
+
* Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([013fead](https://github.com/thebyte9/blaze/commit/013fead2b1fa467c084535d36404d3b80b9db02f))
|
|
70
|
+
* Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([3041c71](https://github.com/thebyte9/blaze/commit/3041c71418996a874138fa9ea9b509040264bf43))
|
|
71
|
+
* filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([2eed0ed](https://github.com/thebyte9/blaze/commit/2eed0ed09cedda3a9424d3b88cb16bb437eada50))
|
|
72
|
+
* filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([b18c177](https://github.com/thebyte9/blaze/commit/b18c177b9ad0c137fe98a979bfa6ca4baa5e214b))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [0.132.0-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.131.0...v0.132.0-admin-updates.0) (2023-07-27)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Bug Fixes
|
|
82
|
+
|
|
83
|
+
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([3703a29](https://github.com/thebyte9/blaze/commit/3703a29d9a838f857863430d9223025900f29880))
|
|
84
|
+
* add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([d133a19](https://github.com/thebyte9/blaze/commit/d133a1965fdb447824dfdb87566809d7597a24b2))
|
|
85
|
+
* add second render ([488b2b6](https://github.com/thebyte9/blaze/commit/488b2b65b437db9beff90eaf38f6a8d2dc30f3a9))
|
|
86
|
+
* added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([f634575](https://github.com/thebyte9/blaze/commit/f634575cd6865dbc23391634c177efe4826d44c6))
|
|
87
|
+
* added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([1940547](https://github.com/thebyte9/blaze/commit/19405477315238fe8b14c974645675ec285ee85a))
|
|
88
|
+
* carousel - set min width to the content ([7313a94](https://github.com/thebyte9/blaze/commit/7313a947d816716c607afaed6eaa61c3f26b0e89))
|
|
89
|
+
* handle data summary urls in loops correctly ([#3993](https://github.com/thebyte9/blaze/issues/3993)) ([008e1a1](https://github.com/thebyte9/blaze/commit/008e1a1f24f065b4060302c2c32d1aa32dd8a007))
|
|
90
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([e0c37fc](https://github.com/thebyte9/blaze/commit/e0c37fcff2479f531f2f337b4e98b4edf57b4795))
|
|
91
|
+
* hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([04e4cb3](https://github.com/thebyte9/blaze/commit/04e4cb380520ea7c9b20860bf9cb4ea2facd27ad))
|
|
92
|
+
* hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([268eddc](https://github.com/thebyte9/blaze/commit/268eddcc71d42b3d63770554684bf79a5f163b7e))
|
|
93
|
+
* hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([e9e1a6d](https://github.com/thebyte9/blaze/commit/e9e1a6da969d9afc5f9ddaffcb7bf2238c84d898))
|
|
94
|
+
* improve animation ([b9111b5](https://github.com/thebyte9/blaze/commit/b9111b59f9f297f5b4701bf5c42b0acd718d9985))
|
|
95
|
+
* remove log ([9eac18f](https://github.com/thebyte9/blaze/commit/9eac18fa06744a11d8e57d5b4a1d58f488ada931))
|
|
96
|
+
* reset search filters and handle single text property ([#3996](https://github.com/thebyte9/blaze/issues/3996)) ([0160414](https://github.com/thebyte9/blaze/commit/016041454d30cc4cfc0a4c8e2d484fcedc2a631c))
|
|
97
|
+
* set width to carousel container ([d8f3ffb](https://github.com/thebyte9/blaze/commit/d8f3ffbdd22df47dcac88446828c2af5ac0f3318))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Features
|
|
101
|
+
|
|
102
|
+
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([6005cdf](https://github.com/thebyte9/blaze/commit/6005cdf0e18f2eea51cc7bc143cf34423743fe5e))
|
|
103
|
+
* add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([78b6ed2](https://github.com/thebyte9/blaze/commit/78b6ed2735e94e078d4b174777ba3a99fc1a6b4c))
|
|
104
|
+
* add sticky setting to column and row ([#3988](https://github.com/thebyte9/blaze/issues/3988)) ([1d1a219](https://github.com/thebyte9/blaze/commit/1d1a21901b23fe184e1eadf2bbb49551dd5f9b33))
|
|
105
|
+
* enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([67b3c7f](https://github.com/thebyte9/blaze/commit/67b3c7fee9ffd60526dae525fea4d87097742453))
|
|
106
|
+
* enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([5411725](https://github.com/thebyte9/blaze/commit/54117258b20ecb95b6359a8a412c8317b38b4fb3))
|
|
107
|
+
* Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([013fead](https://github.com/thebyte9/blaze/commit/013fead2b1fa467c084535d36404d3b80b9db02f))
|
|
108
|
+
* Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([3041c71](https://github.com/thebyte9/blaze/commit/3041c71418996a874138fa9ea9b509040264bf43))
|
|
109
|
+
* filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([2eed0ed](https://github.com/thebyte9/blaze/commit/2eed0ed09cedda3a9424d3b88cb16bb437eada50))
|
|
110
|
+
* filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([b18c177](https://github.com/thebyte9/blaze/commit/b18c177b9ad0c137fe98a979bfa6ca4baa5e214b))
|
|
12
111
|
|
|
13
112
|
|
|
14
113
|
|
package/lib/components/Button.js
CHANGED
|
@@ -84,7 +84,8 @@ var Button = function Button(props) {
|
|
|
84
84
|
};
|
|
85
85
|
var logout = function logout() {
|
|
86
86
|
(0, _coreAuthUi.handleLogout)(client);
|
|
87
|
-
|
|
87
|
+
if ((0, _helpers.hasChildren)(children)) return setShowChildren(true);
|
|
88
|
+
return url ? router.reload(urlToUse) : router.reload();
|
|
88
89
|
};
|
|
89
90
|
var handleClick = function handleClick() {
|
|
90
91
|
if (isLogoutButton) logout();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["_react","_interopRequireWildcard","require","_reactCookie","_router","_classnames","_interopRequireDefault","_button","_coreAuthUi","_client","_propTypes","_utilsHandlebars","_ClickWrapper","_BlazeLink","_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","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties2","client","useApolloClient","router","useRouter","isLogoutButton","LOGOUT","_useCookies","useCookies","_useCookies2","_slicedToArray2","cookies","blazeCookie","blaze_auth","_useState","useState","_useState2","showChildren","setShowChildren","_useStringTemplate","useStringTemplate","_useStringTemplate$da","data","textToUse","afterClickTextToUse","urlToUse","useEffect","asPath","checkIfButtonShouldRender","hasChildren","logout","handleLogout","reload","handleClick","buttonType","modifiers","getClassModifiers","currentProps","href","title","DynamicButton","BlazeLink","BlazeButton","updateChildrensParent","itemId","itemEntity","renderedChildren","renderChildren","onClose","_getClickWrapperOptio","getClickWrapperOptions","shouldUseClickWrapper","wrapperProps","Wrapper","ClickWrapper","Fragment","contentClassName","classnames","createElement","className","_extends2","onClick","propTypes","PropTypes","string","size","bool","oneOfType","arrayOf","node","defaultProps","_default","withTitle","exports"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n url ? router.reload(urlToUse) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAT,uBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AACA,IAAAW,UAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,IAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,UAAA,GAAAd,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AAKoB,IAAAgB,SAAA;AAAA,SAAAC,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,SAAAnB,wBAAAuB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA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AAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRJ,IAAI,EAAE,EAAE;EACRE,GAAG,EAAE,IAAI;EACT2E,IAAI,EAAE,EAAE;EACR1E,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAAC,IAAA2E,QAAA,GAEa,IAAAC,cAAS,EAACtF,MAAM,CAAC;AAAAuF,OAAA,cAAAF,QAAA"}
|
|
1
|
+
{"version":3,"file":"Button.js","names":["_react","_interopRequireWildcard","require","_reactCookie","_router","_classnames","_interopRequireDefault","_button","_coreAuthUi","_client","_propTypes","_utilsHandlebars","_ClickWrapper","_BlazeLink","_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","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties2","client","useApolloClient","router","useRouter","isLogoutButton","LOGOUT","_useCookies","useCookies","_useCookies2","_slicedToArray2","cookies","blazeCookie","blaze_auth","_useState","useState","_useState2","showChildren","setShowChildren","_useStringTemplate","useStringTemplate","_useStringTemplate$da","data","textToUse","afterClickTextToUse","urlToUse","useEffect","asPath","checkIfButtonShouldRender","hasChildren","logout","handleLogout","reload","handleClick","buttonType","modifiers","getClassModifiers","currentProps","href","title","DynamicButton","BlazeLink","BlazeButton","updateChildrensParent","itemId","itemEntity","renderedChildren","renderChildren","onClose","_getClickWrapperOptio","getClickWrapperOptions","shouldUseClickWrapper","wrapperProps","Wrapper","ClickWrapper","Fragment","contentClassName","classnames","createElement","className","_extends2","onClick","propTypes","PropTypes","string","size","bool","oneOfType","arrayOf","node","defaultProps","_default","withTitle","exports"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n if (hasChildren(children)) return setShowChildren(true);\n return url ? router.reload(urlToUse) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAT,uBAAA,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BAAS,CAACC,MAAM;EAC7B3E,IAAI,EAAE0E,qBAAS,CAACC,MAAM;EACtBnE,cAAc,EAAEmE,iBAAM;EACtBxE,IAAI,EAAEuE,qBAAS,CAACC,MAAM;EACtB5E,IAAI,EAAE2E,qBAAS,CAACC,MAAM;EACtB1E,GAAG,EAAEyE,qBAAS,CAACC,MAAM;EACrBC,IAAI,EAAEF,qBAAS,CAACC,MAAM;EACtBzE,IAAI,EAAEwE,qBAAS,CAACC,MAAM;EACtBvE,KAAK,EAAEsE,qBAAS,CAACC,MAAM;EACvBpE,kBAAkB,EAAEsE,eAAI;EACxBxE,QAAQ,EAAEqE,qBAAS,CAACI,SAAS,CAAC,CAACJ,qBAAS,CAACK,OAAO,CAACL,qBAAS,CAACM,IAAI,CAAC,EAAEN,qBAAS,CAACM,IAAI,CAAC;AACnF,CAAC;AAEDnF,MAAM,CAACoF,YAAY,GAAG;EACpBxE,MAAM,EAAE,CAAC,CAAC;EACVH,WAAW,EAAE,EAAE;EACfN,IAAI,EAAE,EAAE;EACRQ,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRJ,IAAI,EAAE,EAAE;EACRE,GAAG,EAAE,IAAI;EACT2E,IAAI,EAAE,EAAE;EACR1E,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAAC,IAAA2E,QAAA,GAEa,IAAAC,cAAS,EAACtF,MAAM,CAAC;AAAAuF,OAAA,cAAAF,QAAA"}
|
|
@@ -146,6 +146,12 @@ 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
|
+
});
|
|
149
155
|
var _filterQuerySetup = (0, _helpers2.filterQuerySetup)({
|
|
150
156
|
getEntitySchemas: Object.values(requiredSchema),
|
|
151
157
|
entity: primaryEntityToUse,
|
|
@@ -154,21 +160,22 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
154
160
|
docType: docTypes,
|
|
155
161
|
filterOperator: filterOperator,
|
|
156
162
|
filterEntityRelations: filterEntityRelations,
|
|
157
|
-
itemsToDisplay:
|
|
163
|
+
itemsToDisplay: updatedItemsToDisplay,
|
|
158
164
|
entitySameAsCurrentItemEntity: entitySameAsCurrentItemEntity,
|
|
159
165
|
useRandomSort: useRandomSort
|
|
160
166
|
}),
|
|
161
167
|
limit = _filterQuerySetup.limit,
|
|
162
168
|
variables = _filterQuerySetup.variables;
|
|
169
|
+
var hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
|
|
163
170
|
var _useQuery2 = (0, _client.useQuery)(action, {
|
|
164
171
|
variables: variables,
|
|
165
172
|
fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
|
|
166
|
-
skip: (0, _helpers2.shouldReturn)(
|
|
173
|
+
skip: (0, _helpers2.shouldReturn)(hasNoFiltersOrItemsToDisplay, _loading, _load, schemaLoading, _error, _err, schemaError)
|
|
167
174
|
}),
|
|
168
175
|
cardData = _useQuery2.data,
|
|
169
176
|
cardsError = _useQuery2.error,
|
|
170
177
|
cardsLoading = _useQuery2.loading;
|
|
171
|
-
var imageIds =
|
|
178
|
+
var imageIds = updatedItemsToDisplay.map(function (_ref4) {
|
|
172
179
|
var imageId = _ref4.imageId;
|
|
173
180
|
return imageId;
|
|
174
181
|
}).filter(Boolean);
|
|
@@ -177,7 +184,7 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
177
184
|
imagesLoading = _useGetImages.loading;
|
|
178
185
|
var isLoading = (0, _helpers2.shouldReturn)(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
|
|
179
186
|
var hasError = (0, _helpers2.shouldReturn)(_error, _err, schemaError);
|
|
180
|
-
if (
|
|
187
|
+
if (hasNoFiltersOrItemsToDisplay) return null;
|
|
181
188
|
if (isLoading) return null;
|
|
182
189
|
if (hasError) return null;
|
|
183
190
|
if (cardsError) return cardsError.message;
|
|
@@ -185,13 +192,13 @@ var CardsRender = function CardsRender(_ref) {
|
|
|
185
192
|
if (!cardDataResults || !cardDataResults.length) return null;
|
|
186
193
|
cardDataResults = entitySameAsCurrentItemEntity ? (0, _helpers.removeExtraItems)(cardDataResults, limit, parentId) : cardDataResults;
|
|
187
194
|
if (!cardDataResults.length) return null;
|
|
188
|
-
var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults,
|
|
195
|
+
var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults, updatedItemsToDisplay);
|
|
189
196
|
var _splitChildren = (0, _helpers.splitChildren)(children, cardDataResults, graphqlEntityMap, {
|
|
190
197
|
name: variableProps.name
|
|
191
198
|
}),
|
|
192
199
|
regularChildren = _splitChildren.regularChildren,
|
|
193
200
|
gtmChildren = _splitChildren.gtmChildren;
|
|
194
|
-
var updatedCards = (0, _helpers.appendImages)(imagesData, orderedData,
|
|
201
|
+
var updatedCards = (0, _helpers.appendImages)(imagesData, orderedData, updatedItemsToDisplay);
|
|
195
202
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, gtmChildren && (0, _helpers.renderChildren)(gtmChildren), /*#__PURE__*/_react["default"].createElement(CardsContainer, (0, _extends2["default"])({
|
|
196
203
|
cardData: updatedCards,
|
|
197
204
|
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","_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":";;;;;;;;;;;;;;;;;;;;;;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,SAAS,GAAG;EACtB5I,QAAQ,EAAE6I,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClFpJ,MAAM,EAAEiJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACnCpJ,YAAY,EAAE+I,qBAAS,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"}
|
|
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 entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,QAAA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S,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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
require("core-js/modules/es.array.find.js");
|
|
12
|
+
require("core-js/modules/es.object.to-string.js");
|
|
13
|
+
require("core-js/modules/es.array.index-of.js");
|
|
14
|
+
require("core-js/modules/es.object.keys.js");
|
|
15
|
+
require("core-js/modules/es.array.is-array.js");
|
|
16
|
+
require("core-js/modules/es.array.for-each.js");
|
|
17
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
18
|
+
var getUpdatedItemsToDisplay = function getUpdatedItemsToDisplay(_ref) {
|
|
19
|
+
var parentSchema = _ref.parentSchema,
|
|
20
|
+
parentEntityData = _ref.parentEntityData,
|
|
21
|
+
_ref$itemsToDisplay = _ref.itemsToDisplay,
|
|
22
|
+
itemsToDisplay = _ref$itemsToDisplay === void 0 ? [] : _ref$itemsToDisplay,
|
|
23
|
+
_ref$inheritedFilters = _ref.inheritedFilters,
|
|
24
|
+
inheritedFilters = _ref$inheritedFilters === void 0 ? [] : _ref$inheritedFilters;
|
|
25
|
+
var idProp = inheritedFilters.find(function (filter) {
|
|
26
|
+
return filter.indexOf('id/') === 0;
|
|
27
|
+
});
|
|
28
|
+
if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;
|
|
29
|
+
var properties = parentSchema.properties;
|
|
30
|
+
var _idProp$split = idProp.split('/'),
|
|
31
|
+
_idProp$split2 = (0, _slicedToArray2["default"])(_idProp$split, 2),
|
|
32
|
+
entityKey = _idProp$split2[1];
|
|
33
|
+
if (!properties || !entityKey) return itemsToDisplay;
|
|
34
|
+
var queryValue = Object.keys(properties).find(function (propKey) {
|
|
35
|
+
return properties[propKey] && properties[propKey].relation && properties[propKey].relation.entityIdentifier === entityKey;
|
|
36
|
+
});
|
|
37
|
+
var parentValues = parentEntityData[queryValue];
|
|
38
|
+
if (!parentValues) return itemsToDisplay;
|
|
39
|
+
var updatedItemsToDisplay = (0, _toConsumableArray2["default"])(itemsToDisplay);
|
|
40
|
+
if (Array.isArray(parentValues)) {
|
|
41
|
+
parentValues.forEach(function (value) {
|
|
42
|
+
updatedItemsToDisplay.push({
|
|
43
|
+
displayItems: [value]
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
updatedItemsToDisplay.push({
|
|
48
|
+
displayItems: [parentValues]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return updatedItemsToDisplay;
|
|
52
|
+
};
|
|
53
|
+
var _default = getUpdatedItemsToDisplay;
|
|
54
|
+
exports["default"] = _default;
|
|
55
|
+
//# sourceMappingURL=get-updated-items-to-display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-updated-items-to-display.js","names":["getUpdatedItemsToDisplay","_ref","parentSchema","parentEntityData","_ref$itemsToDisplay","itemsToDisplay","_ref$inheritedFilters","inheritedFilters","idProp","find","filter","indexOf","properties","_idProp$split","split","_idProp$split2","_slicedToArray2","entityKey","queryValue","Object","keys","propKey","relation","entityIdentifier","parentValues","updatedItemsToDisplay","_toConsumableArray2","Array","isArray","forEach","value","push","displayItems","_default","exports"],"sources":["../../../../src/components/Card/helpers/get-updated-items-to-display.js"],"sourcesContent":["const getUpdatedItemsToDisplay = ({\n parentSchema,\n parentEntityData,\n itemsToDisplay = [],\n inheritedFilters = []\n}) => {\n const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);\n\n if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;\n const { properties } = parentSchema;\n const [, entityKey] = idProp.split('/');\n if (!properties || !entityKey) return itemsToDisplay;\n const queryValue = Object.keys(properties).find(\n propKey =>\n properties[propKey] &&\n properties[propKey].relation &&\n properties[propKey].relation.entityIdentifier === entityKey\n );\n const parentValues = parentEntityData[queryValue];\n if (!parentValues) return itemsToDisplay;\n const updatedItemsToDisplay = [...itemsToDisplay];\n if (Array.isArray(parentValues)) {\n parentValues.forEach(value => {\n updatedItemsToDisplay.push({ displayItems: [value] });\n });\n } else {\n updatedItemsToDisplay.push({ displayItems: [parentValues] });\n }\n return updatedItemsToDisplay;\n};\n\nexport default getUpdatedItemsToDisplay;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAMA,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAKxB;EAAA,IAJJC,YAAY,GAAAD,IAAA,CAAZC,YAAY;IACZC,gBAAgB,GAAAF,IAAA,CAAhBE,gBAAgB;IAAAC,mBAAA,GAAAH,IAAA,CAChBI,cAAc;IAAdA,cAAc,GAAAD,mBAAA,cAAG,EAAE,GAAAA,mBAAA;IAAAE,qBAAA,GAAAL,IAAA,CACnBM,gBAAgB;IAAhBA,gBAAgB,G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AAC;EAC9D;EACA,OAAOC,qBAAqB;AAC9B,CAAC;AAAC,IAAAQ,QAAA,GAEajC,wBAAwB;AAAAkC,OAAA,cAAAD,QAAA"}
|
|
@@ -29,6 +29,12 @@ 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
|
+
});
|
|
32
38
|
Object.defineProperty(exports, "getUpdatedSortProperties", {
|
|
33
39
|
enumerable: true,
|
|
34
40
|
get: function get() {
|
|
@@ -61,4 +67,5 @@ var _filterQuerySetup = _interopRequireDefault(require("./filter-query-setup"));
|
|
|
61
67
|
var _shouldReturn = _interopRequireDefault(require("./should-return"));
|
|
62
68
|
var _shouldSkipSingleQuery = _interopRequireDefault(require("./should-skip-single-query"));
|
|
63
69
|
var _getUpdatedSortProperties = _interopRequireDefault(require("./get-updated-sort-properties"));
|
|
70
|
+
var _getUpdatedItemsToDisplay = _interopRequireDefault(require("./get-updated-items-to-display"));
|
|
64
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_getPublishedListingUrl","_interopRequireDefault","require","_useDynamicSizeKey","_getDynamicGridClasses","_filtersSetup","_filterQuerySetup","_shouldReturn","_shouldSkipSingleQuery","_getUpdatedSortProperties","_getUpdatedItemsToDisplay"],"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';\nexport { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';\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;AACA,IAAAQ,yBAAA,GAAAT,sBAAA,CAAAC,OAAA"}
|
|
@@ -16,8 +16,8 @@ var SmoothScrollCarousel = function SmoothScrollCarousel(_ref) {
|
|
|
16
16
|
numberOfCards = _ref.numberOfCards;
|
|
17
17
|
var wrapperClassName = "cards-carousel-smooth".concat(bannerModifier);
|
|
18
18
|
var contentClassName = "cards-carousel--content smooth-scroll items-per-row-".concat(itemsPerRow);
|
|
19
|
-
var
|
|
20
|
-
var animationDuration = "".concat(
|
|
19
|
+
var animationTime = autoScrollTimer * numberOfCards / 1000;
|
|
20
|
+
var animationDuration = "".concat(animationTime < 1 ? 1 : animationTime, "s");
|
|
21
21
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
22
22
|
className: wrapperClassName
|
|
23
23
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmoothScrollCarousel.js","names":["_react","_interopRequireDefault","require","_propTypes","SmoothScrollCarousel","_ref","children","bannerModifier","itemsPerRow","autoScrollTimer","numberOfCards","wrapperClassName","concat","contentClassName","
|
|
1
|
+
{"version":3,"file":"SmoothScrollCarousel.js","names":["_react","_interopRequireDefault","require","_propTypes","SmoothScrollCarousel","_ref","children","bannerModifier","itemsPerRow","autoScrollTimer","numberOfCards","wrapperClassName","concat","contentClassName","animationTime","animationDuration","createElement","className","style","propTypes","PropTypes","string","number","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/CarouselWrapper/SmoothScrollCarousel.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst SmoothScrollCarousel = ({\n children,\n bannerModifier,\n itemsPerRow,\n autoScrollTimer,\n numberOfCards\n}) => {\n const wrapperClassName = `cards-carousel-smooth${bannerModifier}`;\n const contentClassName = `cards-carousel--content smooth-scroll items-per-row-${itemsPerRow}`;\n const animationTime = (autoScrollTimer * numberOfCards) / 1000;\n const animationDuration = `${animationTime < 1 ? 1 : animationTime}s`;\n\n return (\n <div className={wrapperClassName}>\n <div className={contentClassName} style={{ animationDuration }}>\n {children}\n </div>\n <div className={contentClassName} style={{ animationDuration }}>\n {children}\n </div>\n </div>\n );\n};\n\nSmoothScrollCarousel.propTypes = {\n bannerModifier: PropTypes.string,\n itemsPerRow: PropTypes.number,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n autoScrollTimer: PropTypes.number,\n numberOfCards: PropTypes.number\n};\n\nSmoothScrollCarousel.defaultProps = {\n itemsPerRow: 0,\n bannerModifier: '',\n children: [],\n autoScrollTimer: 0,\n numberOfCards: 1\n};\n\nexport default SmoothScrollCarousel;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAME,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAMpB;EAAA,IALJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,eAAe,GAAAJ,IAAA,CAAfI,eAAe;IACfC,aAAa,GAAAL,IAAA,CAAbK,aAAa;EAEb,IAAMC,gBAAgB,2BAAAC,MAAA,CAA2BL,cAAc,CAAE;EACjE,IAAMM,gBAAgB,0DAAAD,MAAA,CAA0DJ,WAAW,CAAE;EAC7F,IAAMM,aAAa,GAAIL,eAAe,GAAGC,aAAa,GAAI,IAAI;EAC9D,IAAMK,iBAAiB,MAAAH,MAAA,CAAME,aAAa,GAAG,CAAC,GAAG,CAAC,GAAGA,aAAa,MAAG;EAErE,oBACEd,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAEN;EAAiB,gBAC/BX,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAEJ,gBAAiB;IAACK,KAAK,EAAE;MAAEH,iBAAiB,EAAjBA;IAAkB;EAAE,GAC5DT,QACE,CAAC,eACNN,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAEJ,gBAAiB;IAACK,KAAK,EAAE;MAAEH,iBAAiB,EAAjBA;IAAkB;EAAE,GAC5DT,QACE,CACF,CAAC;AAEV,CAAC;AAEDF,oBAAoB,CAACe,SAAS,GAAG;EAC/BZ,cAAc,EAAEa,qBAAS,CAACC,MAAM;EAChCb,WAAW,EAAEY,qBAAS,CAACE,MAAM;EAC7BhB,QAAQ,EAAEc,qBAAS,CAACG,SAAS,CAAC,CAACH,qBAAS,CAACI,OAAO,CAACJ,qBAAS,CAACK,IAAI,CAAC,EAAEL,qBAAS,CAACK,IAAI,CAAC,CAAC;EAClFhB,eAAe,EAAEW,qBAAS,CAACE,MAAM;EACjCZ,aAAa,EAAEU,qBAAS,CAACE;AAC3B,CAAC;AAEDlB,oBAAoB,CAACsB,YAAY,GAAG;EAClClB,WAAW,EAAE,CAAC;EACdD,cAAc,EAAE,EAAE;EAClBD,QAAQ,EAAE,EAAE;EACZG,eAAe,EAAE,CAAC;EAClBC,aAAa,EAAE;AACjB,CAAC;AAAC,IAAAiB,QAAA,GAEavB,oBAAoB;AAAAwB,OAAA,cAAAD,QAAA"}
|
|
@@ -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", "disableWrapper"];
|
|
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,11 +38,13 @@ 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,
|
|
41
42
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
42
43
|
if (!embedCode) return null;
|
|
43
44
|
var parsedCode = (0, _htmlReactParser["default"])(embedCode, parserOptions);
|
|
44
45
|
var wrappedCode = (0, _helpers.wrapScriptTags)(parsedCode);
|
|
45
46
|
var modifiers = (0, _utils.getClassModifiers)(_constants.CODE, _objectSpread({}, otherProps));
|
|
47
|
+
if (disableWrapper) return wrappedCode;
|
|
46
48
|
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
|
|
47
49
|
modifiers: modifiers
|
|
48
50
|
}, wrappedCode);
|
|
@@ -50,12 +52,14 @@ var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
50
52
|
Code.propTypes = {
|
|
51
53
|
code: _propTypes["default"].string,
|
|
52
54
|
modifier: _propTypes["default"].string,
|
|
53
|
-
parserOptions: _propTypes["default"].object
|
|
55
|
+
parserOptions: _propTypes["default"].object,
|
|
56
|
+
disableWrapper: _propTypes["default"].bool
|
|
54
57
|
};
|
|
55
58
|
Code.defaultProps = {
|
|
56
59
|
code: '',
|
|
57
60
|
modifier: '',
|
|
58
|
-
parserOptions: {}
|
|
61
|
+
parserOptions: {},
|
|
62
|
+
disableWrapper: false
|
|
59
63
|
};
|
|
60
64
|
var _default = (0, _HOC.withTitle)(Code);
|
|
61
65
|
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","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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cAAA,CAAAoB,MAAA,EAAAlB,GAAA,EAAAH,MAAA,CAAAE,wBAAA,CAAAuB,MAAA,EAAAtB,GAAA,iBAAAkB,MAAA;AAE3C,IAAMS,IAAI,gBAAG,IAAAC,WAAI,EAAC,UAAAC,IAAA,
|
|
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","disableWrapper","otherProps","_objectWithoutProperties2","parsedCode","parseHTML","wrappedCode","wrapScriptTags","modifiers","getClassModifiers","CODE","createElement","propTypes","PropTypes","string","modifier","bool","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, disableWrapper, ...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 if (disableWrapper) return wrappedCode;\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 disableWrapper: PropTypes.bool\n};\n\nCode.defaultProps = {\n code: '',\n modifier: '',\n parserOptions: {},\n disableWrapper: false\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,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAZ,wBAAAgB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,w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
|
|
@@ -20,6 +20,7 @@ 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");
|
|
23
24
|
var getLoopValue = function getLoopValue(value) {
|
|
24
25
|
var keyField = value.keyField;
|
|
25
26
|
return value[keyField];
|
|
@@ -62,10 +63,12 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
62
63
|
modifier = _options$modifier === void 0 ? '' : _options$modifier;
|
|
63
64
|
return propertiesToDisplay.map(function (key) {
|
|
64
65
|
var loopValue = loopValues[key];
|
|
65
|
-
var
|
|
66
|
+
var loopValueItem = loopValue && loopValue[i];
|
|
67
|
+
var propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
66
68
|
if (!propValue) return null;
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
+
var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
|
|
70
|
+
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data, loopValueItem);
|
|
71
|
+
return [(0, _lodash["default"])(label), processedValue, linkToPublishedContent, modifier];
|
|
69
72
|
});
|
|
70
73
|
})).filter(Boolean);
|
|
71
74
|
loopPropsWithContent.push(propsArray);
|