@blaze-cms/react-page-builder 0.130.0-admin-updates.4 → 0.130.0-admin-updates.8
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 +28 -0
- 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 +3 -1
- 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/SearchContent/SearchContent.js +8 -6
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +2 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-query.js +3 -2
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +5 -2
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +2 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.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/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 +7 -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/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 +3 -1
- 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/SearchContent/SearchContent.js +8 -6
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +2 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +3 -2
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +7 -2
- 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-props-query.js +4 -2
- package/lib-es/helpers/build-props-query.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 +1 -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 +2 -2
- package/src/components/Code/Code.js +7 -3
- package/src/components/DataSummary/helpers/build-loop-props-content.js +4 -1
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +6 -3
- package/src/components/SearchContent/SearchContent.js +8 -6
- package/src/components/SearchFilter/SearchFilterContainer.js +2 -1
- package/src/components/SearchFilter/helpers/build-new-query.js +3 -2
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +7 -3
- package/src/components/SearchFilterSort/helpers/update-sort.js +2 -2
- package/src/helpers/build-props-query.js +4 -2
- package/src/helpers/get-wrapped-value-with-link.js +6 -3
- package/src/helpers/index.js +1 -0
- package/src/helpers/parse-props-to-display.js +25 -21
- package/src/helpers/process-data-summary-value.js +22 -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 +9 -0
- package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +15 -1
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +9 -3
- 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
|
@@ -139,7 +139,8 @@ const SearchFilterContainer = ({
|
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
const
|
|
142
|
+
const hashBit = asPath.split('#')[1];
|
|
143
|
+
const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues, hashBit);
|
|
143
144
|
scrollToFirstList();
|
|
144
145
|
setUrlPath(newUrl);
|
|
145
146
|
return router.push('/Resolver', newUrl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilterContainer.js","names":["React","useState","useRef","useReducer","useEffect","useRouter","useQuery","PropTypes","parseUrl","stringify","SearchFilter","withTitle","getSearchPublishedContent","buildNewQuery","buildRawQueryStringified","getInitialFilterValues","buildFiltersQuery","getEntityData","RAW_RESULTS","RANGE","CHECKBOX_SELECT","SCROLL_OFFSET","reducer","state","action","newValues","type","shouldSearch","_objectSpread","Error","SearchFilterContainer","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","router","asPath","searchFilterRef","key","setKey","displaySearchFilter","setDisplaySearchFilter","urlPath","setUrlPath","currentUrl","query","sort","sortby","filterValues","dispatch","hasUrl","sortValues","baseQuery","checkboxSelectValues","rangeValues","forEach","propsToDisplay","includes","push","docType","filtersQuery","queryKeys","Object","keys","rawQueryStringified","data","error","variables","limit","skip","message","length","searchPublishedContent","rawResults","aggregations","filterData","dataNotSet","initialFilterValues","handleSearch","newQuery","scrollToFirstList","shallow","scroll","then","Date","now","newUrl","list","document","getElementsByClassName","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","getBoundingClientRect","createElement","setAppliedFilters","propTypes","string","array","isRequired","bool","number","defaultProps"],"sources":["../../../src/components/SearchFilter/SearchFilterContainer.js"],"sourcesContent":["import React, { useState, useRef, useReducer, useEffect } from 'react';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { parseUrl, stringify } from 'query-string';\nimport SearchFilter from './SearchFilter';\nimport { withTitle } from '../../HOC';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildNewQuery,\n buildRawQueryStringified,\n getInitialFilterValues,\n buildFiltersQuery\n} from './helpers';\nimport { getEntityData } from '../../helpers';\nimport { RAW_RESULTS, RANGE, CHECKBOX_SELECT } from './constants';\nimport { SCROLL_OFFSET } from '../../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch: false };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilterContainer = ({\n entity,\n url,\n filters,\n name,\n isCollapsedOnResponsive,\n groupAfterMobile,\n groupAfterDesktop,\n filterBy,\n filterByProperty,\n shouldAddFilters\n}) => {\n const router = useRouter();\n const { asPath } = router;\n const searchFilterRef = useRef(null);\n const [key, setKey] = useState(`filter-${name}`);\n const [displaySearchFilter, setDisplaySearchFilter] = useState(false);\n const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update\n const {\n url: currentUrl,\n query: { sort, sortby },\n query\n } = parseUrl(urlPath);\n const [filterValues, dispatch] = useReducer(\n reducer,\n getInitialFilterValues(null, filters, query)\n );\n\n useEffect(\n () => {\n if (asPath) setUrlPath(asPath);\n },\n [asPath]\n );\n\n const hasUrl = !!url;\n\n const sortValues = sort && sortby ? stringify({ sort, sortby }) : '';\n const baseQuery = sortValues ? `${currentUrl}?${sortValues}` : currentUrl;\n\n const action = getSearchPublishedContent(RAW_RESULTS);\n const checkboxSelectValues = [];\n const rangeValues = [];\n\n filters.forEach(({ type, propsToDisplay }) => {\n if (CHECKBOX_SELECT.includes(type)) {\n checkboxSelectValues.push(propsToDisplay[0]);\n } else if (type === RANGE) {\n rangeValues.push(...propsToDisplay);\n }\n });\n\n const { docType } = getEntityData(entity);\n\n const filtersQuery = shouldAddFilters\n ? buildFiltersQuery({\n query: filterValues,\n filterBy,\n filterByProperty,\n rangeValues,\n queryKeys: Object.keys(query)\n })\n : [];\n\n const rawQueryStringified = buildRawQueryStringified(\n checkboxSelectValues,\n rangeValues,\n docType,\n filtersQuery\n );\n\n const { data, error } = useQuery(action, {\n variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results\n skip: !rawQueryStringified\n });\n\n if (error) return error.message;\n if (!filters.length) return null;\n\n const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =\n data || {};\n\n if (filterValues.dataNotSet && filterData) {\n const initialFilterValues = getInitialFilterValues(filterData, filters, query);\n dispatch({ newValues: initialFilterValues, shouldSearch: false, type: 'update' });\n }\n\n const handleSearch = newQuery => {\n setDisplaySearchFilter(false);\n\n if (!newQuery) {\n scrollToFirstList();\n setUrlPath(baseQuery);\n return router.push('/Resolver', baseQuery, { shallow: !hasUrl, scroll: false }).then(() => {\n setKey(`filter-${name}:${Date.now()}`); // remove after range component update\n });\n }\n const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues);\n scrollToFirstList();\n setUrlPath(newUrl);\n return router.push('/Resolver', newUrl, { shallow: !hasUrl, scroll: false });\n };\n\n const scrollToFirstList = () => {\n const [list] = document.getElementsByClassName('list-top');\n const shouldScrollToFirstList = !hasUrl && list;\n\n if (shouldScrollToFirstList) {\n window.scrollTo({\n left: 0,\n top: window.pageYOffset - SCROLL_OFFSET + list.getBoundingClientRect().top\n });\n } else {\n window.scrollTo(0, 0);\n }\n };\n if (!filterValues) return '';\n\n return (\n <SearchFilter\n key={key}\n setAppliedFilters={dispatch}\n searchFilterRef={searchFilterRef}\n data={filterData}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n handleSearch={handleSearch}\n filterValues={filterValues}\n name={name}\n isCollapsedOnResponsive={isCollapsedOnResponsive}\n displaySearchFilter={displaySearchFilter}\n setDisplaySearchFilter={setDisplaySearchFilter}\n groupAfterMobile={groupAfterMobile}\n groupAfterDesktop={groupAfterDesktop}\n />\n );\n};\n\nSearchFilterContainer.propTypes = {\n entity: PropTypes.string,\n url: PropTypes.string,\n filters: PropTypes.array,\n name: PropTypes.string.isRequired,\n isCollapsedOnResponsive: PropTypes.bool,\n groupAfterMobile: PropTypes.number,\n groupAfterDesktop: PropTypes.number,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n shouldAddFilters: PropTypes.bool\n};\n\nSearchFilterContainer.defaultProps = {\n url: null,\n filters: [],\n entity: '',\n isCollapsedOnResponsive: true,\n groupAfterMobile: 0,\n groupAfterDesktop: 0,\n filterBy: [],\n filterByProperty: [],\n shouldAddFilters: false\n};\n\nexport default withTitle(SearchFilterContainer);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,E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E,EAAE;EACVI,uBAAuB,EAAE,IAAI;EAC7BC,gBAAgB,EAAE,CAAC;EACnBC,iBAAiB,EAAE,CAAC;EACpBC,QAAQ,EAAE,EAAE;EACZC,gBAAgB,EAAE,EAAE;EACpBC,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAe7B,SAAS,CAACmB,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"SearchFilterContainer.js","names":["React","useState","useRef","useReducer","useEffect","useRouter","useQuery","PropTypes","parseUrl","stringify","SearchFilter","withTitle","getSearchPublishedContent","buildNewQuery","buildRawQueryStringified","getInitialFilterValues","buildFiltersQuery","getEntityData","RAW_RESULTS","RANGE","CHECKBOX_SELECT","SCROLL_OFFSET","reducer","state","action","newValues","type","shouldSearch","_objectSpread","Error","SearchFilterContainer","entity","url","filters","name","isCollapsedOnResponsive","groupAfterMobile","groupAfterDesktop","filterBy","filterByProperty","shouldAddFilters","router","asPath","searchFilterRef","key","setKey","displaySearchFilter","setDisplaySearchFilter","urlPath","setUrlPath","currentUrl","query","sort","sortby","filterValues","dispatch","hasUrl","sortValues","baseQuery","checkboxSelectValues","rangeValues","forEach","propsToDisplay","includes","push","docType","filtersQuery","queryKeys","Object","keys","rawQueryStringified","data","error","variables","limit","skip","message","length","searchPublishedContent","rawResults","aggregations","filterData","dataNotSet","initialFilterValues","handleSearch","newQuery","scrollToFirstList","shallow","scroll","then","Date","now","hashBit","split","newUrl","list","document","getElementsByClassName","shouldScrollToFirstList","window","scrollTo","left","top","pageYOffset","getBoundingClientRect","createElement","setAppliedFilters","propTypes","string","array","isRequired","bool","number","defaultProps"],"sources":["../../../src/components/SearchFilter/SearchFilterContainer.js"],"sourcesContent":["import React, { useState, useRef, useReducer, useEffect } from 'react';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { parseUrl, stringify } from 'query-string';\nimport SearchFilter from './SearchFilter';\nimport { withTitle } from '../../HOC';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildNewQuery,\n buildRawQueryStringified,\n getInitialFilterValues,\n buildFiltersQuery\n} from './helpers';\nimport { getEntityData } from '../../helpers';\nimport { RAW_RESULTS, RANGE, CHECKBOX_SELECT } from './constants';\nimport { SCROLL_OFFSET } from '../../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch: false };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilterContainer = ({\n entity,\n url,\n filters,\n name,\n isCollapsedOnResponsive,\n groupAfterMobile,\n groupAfterDesktop,\n filterBy,\n filterByProperty,\n shouldAddFilters\n}) => {\n const router = useRouter();\n const { asPath } = router;\n const searchFilterRef = useRef(null);\n const [key, setKey] = useState(`filter-${name}`);\n const [displaySearchFilter, setDisplaySearchFilter] = useState(false);\n const [urlPath, setUrlPath] = useState(asPath); // used as asPath can take too long to update\n const {\n url: currentUrl,\n query: { sort, sortby },\n query\n } = parseUrl(urlPath);\n const [filterValues, dispatch] = useReducer(\n reducer,\n getInitialFilterValues(null, filters, query)\n );\n\n useEffect(\n () => {\n if (asPath) setUrlPath(asPath);\n },\n [asPath]\n );\n\n const hasUrl = !!url;\n\n const sortValues = sort && sortby ? stringify({ sort, sortby }) : '';\n const baseQuery = sortValues ? `${currentUrl}?${sortValues}` : currentUrl;\n\n const action = getSearchPublishedContent(RAW_RESULTS);\n const checkboxSelectValues = [];\n const rangeValues = [];\n\n filters.forEach(({ type, propsToDisplay }) => {\n if (CHECKBOX_SELECT.includes(type)) {\n checkboxSelectValues.push(propsToDisplay[0]);\n } else if (type === RANGE) {\n rangeValues.push(...propsToDisplay);\n }\n });\n\n const { docType } = getEntityData(entity);\n\n const filtersQuery = shouldAddFilters\n ? buildFiltersQuery({\n query: filterValues,\n filterBy,\n filterByProperty,\n rangeValues,\n queryKeys: Object.keys(query)\n })\n : [];\n\n const rawQueryStringified = buildRawQueryStringified(\n checkboxSelectValues,\n rangeValues,\n docType,\n filtersQuery\n );\n\n const { data, error } = useQuery(action, {\n variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results\n skip: !rawQueryStringified\n });\n\n if (error) return error.message;\n if (!filters.length) return null;\n\n const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =\n data || {};\n\n if (filterValues.dataNotSet && filterData) {\n const initialFilterValues = getInitialFilterValues(filterData, filters, query);\n dispatch({ newValues: initialFilterValues, shouldSearch: false, type: 'update' });\n }\n\n const handleSearch = newQuery => {\n setDisplaySearchFilter(false);\n\n if (!newQuery) {\n scrollToFirstList();\n setUrlPath(baseQuery);\n return router.push('/Resolver', baseQuery, { shallow: !hasUrl, scroll: false }).then(() => {\n setKey(`filter-${name}:${Date.now()}`); // remove after range component update\n });\n }\n const hashBit = asPath.split('#')[1];\n const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues, hashBit);\n scrollToFirstList();\n setUrlPath(newUrl);\n return router.push('/Resolver', newUrl, { shallow: !hasUrl, scroll: false });\n };\n\n const scrollToFirstList = () => {\n const [list] = document.getElementsByClassName('list-top');\n const shouldScrollToFirstList = !hasUrl && list;\n\n if (shouldScrollToFirstList) {\n window.scrollTo({\n left: 0,\n top: window.pageYOffset - SCROLL_OFFSET + list.getBoundingClientRect().top\n });\n } else {\n window.scrollTo(0, 0);\n }\n };\n if (!filterValues) return '';\n\n return (\n <SearchFilter\n key={key}\n setAppliedFilters={dispatch}\n searchFilterRef={searchFilterRef}\n data={filterData}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n handleSearch={handleSearch}\n filterValues={filterValues}\n name={name}\n isCollapsedOnResponsive={isCollapsedOnResponsive}\n displaySearchFilter={displaySearchFilter}\n setDisplaySearchFilter={setDisplaySearchFilter}\n groupAfterMobile={groupAfterMobile}\n groupAfterDesktop={groupAfterDesktop}\n />\n );\n};\n\nSearchFilterContainer.propTypes = {\n entity: PropTypes.string,\n url: PropTypes.string,\n filters: PropTypes.array,\n name: PropTypes.string.isRequired,\n isCollapsedOnResponsive: PropTypes.bool,\n groupAfterMobile: PropTypes.number,\n groupAfterDesktop: PropTypes.number,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n shouldAddFilters: PropTypes.bool\n};\n\nSearchFilterContainer.defaultProps = {\n url: null,\n filters: [],\n entity: '',\n isCollapsedOnResponsive: true,\n groupAfterMobile: 0,\n groupAfterDesktop: 0,\n filterBy: [],\n filterByProperty: [],\n shouldAddFilters: false\n};\n\nexport default withTitle(SearchFilterContainer);\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AACtE,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,cAAc;AAClD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SACEC,aAAa,EACbC,wBAAwB,EACxBC,sBAAsB,EACtBC,iBAAiB,QACZ,WAAW;AAClB,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,WAAW,EAAEC,KAAK,EAAEC,eAAe,QAAQ,aAAa;AACjE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,MAAMC,OAAO,GAAGA,CAACC,KAAK,EAAEC,MAAM,KAAK;EACjC,MAAM;IAAEC,SAAS;IAAEC,IAAI;IAAEC,YAAY,GAAG;EAAK,CAAC,GAAGH,MAAM;EAEvD,QAAQE,IAAI;IACV,KAAK,QAAQ;MACX,OAAAE,aAAA,CAAAA,aAAA,CAAAA,aAAA,KAAYL,KAAK,GAAKE,SAAS;QAAEE;MAAY;IAC/C,KAAK,aAAa;MAChB,OA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6E,SAAS,GAAG;EAChC5E,MAAM,EAAExB,SAAS,CAACqG,MAAM;EACxB5E,GAAG,EAAEzB,SAAS,CAACqG,MAAM;EACrB3E,OAAO,EAAE1B,SAAS,CAACsG,KAAK;EACxB3E,IAAI,EAAE3B,SAAS,CAACqG,MAAM,CAACE,UAAU;EACjC3E,uBAAuB,EAAE5B,SAAS,CAACwG,IAAI;EACvC3E,gBAAgB,EAAE7B,SAAS,CAACyG,MAAM;EAClC3E,iBAAiB,EAAE9B,SAAS,CAACyG,MAAM;EACnC1E,QAAQ,EAAE/B,SAAS,CAACsG,KAAK;EACzBtE,gBAAgB,EAAEhC,SAAS,CAACsG,KAAK;EACjCrE,gBAAgB,EAAEjC,SAAS,CAACwG;AAC9B,CAAC;AAEDjF,qBAAqB,CAACmF,YAAY,GAAG;EACnCjF,GAAG,EAAE,IAAI;EACTC,OAAO,EAAE,EAAE;EACXF,MAAM,EAAE,EAAE;EACVI,uBAAuB,EAAE,IAAI;EAC7BC,gBAAgB,EAAE,CAAC;EACnBC,iBAAiB,EAAE,CAAC;EACpBC,QAAQ,EAAE,EAAE;EACZC,gBAAgB,EAAE,EAAE;EACpBC,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAe7B,SAAS,CAACmB,qBAAqB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const buildNewQuery = (url, currentUrl, queryParams, sortValues) => {
|
|
1
|
+
const buildNewQuery = (url, currentUrl, queryParams, sortValues, hashBit) => {
|
|
2
2
|
const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;
|
|
3
|
-
|
|
3
|
+
const withSortValues = sortValues ? `${newUrl}&${sortValues}` : newUrl;
|
|
4
|
+
return hashBit ? `${withSortValues}#${hashBit}` : withSortValues;
|
|
4
5
|
};
|
|
5
6
|
export default buildNewQuery;
|
|
6
7
|
//# sourceMappingURL=build-new-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-new-query.js","names":["buildNewQuery","url","currentUrl","queryParams","sortValues","newUrl"],"sources":["../../../../src/components/SearchFilter/helpers/build-new-query.js"],"sourcesContent":["const buildNewQuery = (url, currentUrl, queryParams, sortValues) => {\n const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;\n
|
|
1
|
+
{"version":3,"file":"build-new-query.js","names":["buildNewQuery","url","currentUrl","queryParams","sortValues","hashBit","newUrl","withSortValues"],"sources":["../../../../src/components/SearchFilter/helpers/build-new-query.js"],"sourcesContent":["const buildNewQuery = (url, currentUrl, queryParams, sortValues, hashBit) => {\n const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;\n const withSortValues = sortValues ? `${newUrl}&${sortValues}` : newUrl;\n return hashBit ? `${withSortValues}#${hashBit}` : withSortValues;\n};\n\nexport default buildNewQuery;\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGA,CAACC,GAAG,EAAEC,UAAU,EAAEC,WAAW,EAAEC,UAAU,EAAEC,OAAO,KAAK;EAC3E,MAAMC,MAAM,GAAGL,GAAG,GAAI,GAAEA,GAAI,IAAGE,WAAY,EAAC,GAAI,GAAED,UAAW,IAAGC,WAAY,EAAC;EAC7E,MAAMI,cAAc,GAAGH,UAAU,GAAI,GAAEE,MAAO,IAAGF,UAAW,EAAC,GAAGE,MAAM;EACtE,OAAOD,OAAO,GAAI,GAAEE,cAAe,IAAGF,OAAQ,EAAC,GAAGE,cAAc;AAClE,CAAC;AAED,eAAeP,aAAa"}
|
|
@@ -7,15 +7,20 @@ const handleSortUpdate = (router, value, query, url, selectLabel) => {
|
|
|
7
7
|
shallow: true,
|
|
8
8
|
scroll: false
|
|
9
9
|
};
|
|
10
|
+
const {
|
|
11
|
+
asPath
|
|
12
|
+
} = router;
|
|
13
|
+
const hashBit = asPath.split('#')[1];
|
|
14
|
+
const parsedHash = hashBit ? `#${hashBit}` : '';
|
|
10
15
|
Object.keys(query).forEach(key => {
|
|
11
16
|
if (key.indexOf(PAGINATION_QUERY) !== -1) return;
|
|
12
17
|
if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];
|
|
13
18
|
});
|
|
14
19
|
if (value === DEFAULT_SORT || value === selectLabel) {
|
|
15
20
|
const stringifiedQuery = stringify(queryWithoutSort);
|
|
16
|
-
return stringifiedQuery ? router.push(`/Resolver`, `${url}?${stringifiedQuery}`, routerOptions) : router.push(`/Resolver`, url
|
|
21
|
+
return stringifiedQuery ? router.push(`/Resolver`, `${url}?${stringifiedQuery}${parsedHash}`, routerOptions) : router.push(`/Resolver`, `${url}${parsedHash}`, routerOptions);
|
|
17
22
|
}
|
|
18
|
-
const updatedSortUrl = updateSort(value, queryWithoutSort, url);
|
|
23
|
+
const updatedSortUrl = updateSort(value, queryWithoutSort, url, parsedHash);
|
|
19
24
|
return router.push('/Resolver', updatedSortUrl, routerOptions);
|
|
20
25
|
};
|
|
21
26
|
export default handleSortUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-sort-update.js","names":["stringify","DEFAULT_SORT","SORT","SORTBY","PAGINATION_QUERY","updateSort","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","Object","keys","forEach","key","indexOf","stringifiedQuery","push","updatedSortUrl"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = (router, value, query, url, selectLabel) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}`, routerOptions)\n : router.push(`/Resolver`, url
|
|
1
|
+
{"version":3,"file":"handle-sort-update.js","names":["stringify","DEFAULT_SORT","SORT","SORTBY","PAGINATION_QUERY","updateSort","handleSortUpdate","router","value","query","url","selectLabel","queryWithoutSort","routerOptions","shallow","scroll","asPath","hashBit","split","parsedHash","Object","keys","forEach","key","indexOf","stringifiedQuery","push","updatedSortUrl"],"sources":["../../../../src/components/SearchFilterSort/helpers/handle-sort-update.js"],"sourcesContent":["import { stringify } from 'query-string';\nimport { DEFAULT_SORT, SORT, SORTBY, PAGINATION_QUERY } from '../constants';\nimport updateSort from './update-sort';\n\nconst handleSortUpdate = (router, value, query, url, selectLabel) => {\n const queryWithoutSort = {};\n const routerOptions = { shallow: true, scroll: false };\n\n const { asPath } = router;\n const hashBit = asPath.split('#')[1];\n const parsedHash = hashBit ? `#${hashBit}` : '';\n Object.keys(query).forEach(key => {\n if (key.indexOf(PAGINATION_QUERY) !== -1) return;\n if (key !== SORTBY && key !== SORT) queryWithoutSort[key] = query[key];\n });\n if (value === DEFAULT_SORT || value === selectLabel) {\n const stringifiedQuery = stringify(queryWithoutSort);\n\n return stringifiedQuery\n ? router.push(`/Resolver`, `${url}?${stringifiedQuery}${parsedHash}`, routerOptions)\n : router.push(`/Resolver`, `${url}${parsedHash}`, routerOptions);\n }\n const updatedSortUrl = updateSort(value, queryWithoutSort, url, parsedHash);\n return router.push('/Resolver', updatedSortUrl, routerOptions);\n};\n\nexport default handleSortUpdate;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,YAAY,EAAEC,IAAI,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,cAAc;AAC3E,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAMC,gBAAgB,GAAGA,CAACC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,GAAG,EAAEC,WAAW,KAAK;EACnE,MAAMC,gBAAgB,GAAG,CAAC,CAAC;EAC3B,MAAMC,aAAa,GAAG;IAAEC,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAM,CAAC;EAEtD,MAAM;IAAEC;EAAO,CAAC,GAAGT,MAAM;EACzB,MAAMU,OAAO,GAAGD,MAAM,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EACpC,MAAMC,UAAU,GAAGF,OAAO,GAAI,IAAGA,OAAQ,EAAC,GAAG,EAAE;EAC/CG,MAAM,CAACC,IAAI,CAACZ,KAAK,CAAC,CAACa,OAAO,CAACC,GAAG,IAAI;IAChC,IAAIA,GAAG,CAACC,OAAO,CAACpB,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE;IAC1C,IAAImB,GAAG,KAAKpB,MAAM,IAAIoB,GAAG,KAAKrB,IAAI,EAAEU,gBAAgB,CAACW,GAAG,CAAC,GAAGd,KAAK,CAACc,GAAG,CAAC;EACxE,CAAC,CAAC;EACF,IAAIf,KAAK,KAAKP,YAAY,IAAIO,KAAK,KAAKG,WAAW,EAAE;IACnD,MAAMc,gBAAgB,GAAGzB,SAAS,CAACY,gBAAgB,CAAC;IAEpD,OAAOa,gBAAgB,GACnBlB,MAAM,CAACmB,IAAI,CAAE,WAAU,EAAG,GAAEhB,GAAI,IAAGe,gBAAiB,GAAEN,UAAW,EAAC,EAAEN,aAAa,CAAC,GAClFN,MAAM,CAACmB,IAAI,CAAE,WAAU,EAAG,GAAEhB,GAAI,GAAES,UAAW,EAAC,EAAEN,aAAa,CAAC;EACpE;EACA,MAAMc,cAAc,GAAGtB,UAAU,CAACG,KAAK,EAAEI,gBAAgB,EAAEF,GAAG,EAAES,UAAU,CAAC;EAC3E,OAAOZ,MAAM,CAACmB,IAAI,CAAC,WAAW,EAAEC,cAAc,EAAEd,aAAa,CAAC;AAChE,CAAC;AAED,eAAeP,gBAAgB"}
|
|
@@ -2,14 +2,14 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
import { stringify } from 'query-string';
|
|
5
|
-
const updateSort = (value, query, url) => {
|
|
5
|
+
const updateSort = (value, query, url, hashBit = '') => {
|
|
6
6
|
const [newSortBy, newSort] = value.split(':');
|
|
7
7
|
const updatedQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
8
8
|
sortby: newSortBy,
|
|
9
9
|
sort: newSort
|
|
10
10
|
});
|
|
11
11
|
const parsedQuery = stringify(updatedQuery);
|
|
12
|
-
return `${url}?${parsedQuery}`;
|
|
12
|
+
return `${url}?${parsedQuery}${hashBit}`;
|
|
13
13
|
};
|
|
14
14
|
export default updateSort;
|
|
15
15
|
//# sourceMappingURL=update-sort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sort.js","names":["stringify","updateSort","value","query","url","newSortBy","newSort","split","updatedQuery","_objectSpread","sortby","sort","parsedQuery"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\n\nconst updateSort = (value, query, url) => {\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, sortby: newSortBy, sort: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,MAAMC,UAAU,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,GAAG,KAAK;
|
|
1
|
+
{"version":3,"file":"update-sort.js","names":["stringify","updateSort","value","query","url","hashBit","newSortBy","newSort","split","updatedQuery","_objectSpread","sortby","sort","parsedQuery"],"sources":["../../../../src/components/SearchFilterSort/helpers/update-sort.js"],"sourcesContent":["import { stringify } from 'query-string';\n\nconst updateSort = (value, query, url, hashBit = '') => {\n const [newSortBy, newSort] = value.split(':');\n const updatedQuery = { ...query, sortby: newSortBy, sort: newSort };\n const parsedQuery = stringify(updatedQuery);\n return `${url}?${parsedQuery}${hashBit}`;\n};\n\nexport default updateSort;\n"],"mappings":";;;AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,MAAMC,UAAU,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,GAAG,EAAEC,OAAO,GAAG,EAAE,KAAK;EACtD,MAAM,CAACC,SAAS,EAAEC,OAAO,CAAC,GAAGL,KAAK,CAACM,KAAK,CAAC,GAAG,CAAC;EAC7C,MAAMC,YAAY,GAAAC,aAAA,CAAAA,aAAA,KAAQP,KAAK;IAAEQ,MAAM,EAAEL,SAAS;IAAEM,IAAI,EAAEL;EAAO,EAAE;EACnE,MAAMM,WAAW,GAAGb,SAAS,CAACS,YAAY,CAAC;EAC3C,OAAQ,GAAEL,GAAI,IAAGS,WAAY,GAAER,OAAQ,EAAC;AAC1C,CAAC;AAED,eAAeJ,UAAU"}
|
|
@@ -28,16 +28,18 @@ const buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, link
|
|
|
28
28
|
};
|
|
29
29
|
const buildComplexProps = (shouldAddCategoryProps, props, {
|
|
30
30
|
relations = [],
|
|
31
|
-
dynamicProperties = {}
|
|
31
|
+
dynamicProperties = {},
|
|
32
|
+
properties = {}
|
|
32
33
|
}, linkProps) => Object.keys(props).map(base => {
|
|
33
34
|
const nestedProps = props[base];
|
|
34
35
|
const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));
|
|
36
|
+
const matchingProperty = !!properties[base];
|
|
35
37
|
const matchingRelation = relations.find(({
|
|
36
38
|
localField
|
|
37
39
|
}) => localField === base);
|
|
38
40
|
const matchingDynamicProp = Object.keys(dynamicProperties).find(dynamicKey => dynamicKey === base);
|
|
39
41
|
if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');
|
|
40
|
-
if (hasLink && (!!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
|
|
42
|
+
if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp)) nestedProps.push('url');
|
|
41
43
|
const jointNestedProps = nestedProps.join(',');
|
|
42
44
|
if (base === 'category' && shouldAddCategoryProps) return `${base}{${jointNestedProps}, ${categoryProps}}`;
|
|
43
45
|
if (base.includes('published')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-query.js","names":["CATEGORY_ID","ID","PREHEADER_PROP","HEADLINE_PROP","defaultProps","categoryProps","checkProps","props","Object","keys","filter","prop","length","buildPropsQuery","entitySchema","extraProps","cardOptions","linkProps","parsedSchema","getEntitySchema","extraPropsHaveCategory","includes","typeBasedProps","shouldAddCategoryProps","getTypeBaseProps","allProps","uniqueProps","Set","basicProps","nestedProps","forEach","push","base","nested","split","complexProps","buildComplexProps","join","relations","dynamicProperties","map","hasLink","find","linkProp","matchingRelation","localField","matchingDynamicProp","dynamicKey","jointNestedProps","isCard","displayCategory","displayThumbnail","interfaces","
|
|
1
|
+
{"version":3,"file":"build-props-query.js","names":["CATEGORY_ID","ID","PREHEADER_PROP","HEADLINE_PROP","defaultProps","categoryProps","checkProps","props","Object","keys","filter","prop","length","buildPropsQuery","entitySchema","extraProps","cardOptions","linkProps","parsedSchema","getEntitySchema","extraPropsHaveCategory","includes","typeBasedProps","shouldAddCategoryProps","getTypeBaseProps","allProps","uniqueProps","Set","basicProps","nestedProps","forEach","push","base","nested","split","complexProps","buildComplexProps","join","relations","dynamicProperties","properties","map","hasLink","find","linkProp","matchingProperty","matchingRelation","localField","matchingDynamicProp","dynamicKey","jointNestedProps","isCard","displayCategory","displayThumbnail","interfaces","isContent","hasCategory","hasPreheader","getCategoyProps","getContentProps","url"],"sources":["../../src/helpers/build-props-query.js"],"sourcesContent":["import { CATEGORY_ID, ID, PREHEADER_PROP, HEADLINE_PROP } from '../constants';\n\nconst defaultProps = [ID, 'name'];\nconst categoryProps = 'id publishedListingPage{id, url}';\n\nconst checkProps = props =>\n !!(props && Object.keys(props).filter(prop => prop === CATEGORY_ID).length);\n\nconst buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, linkProps = []) => {\n const parsedSchema = entitySchema.getEntitySchema ? entitySchema.getEntitySchema : entitySchema;\n const extraPropsHaveCategory = !!extraProps.filter(prop => prop.includes('category.')).length;\n const { typeBasedProps, shouldAddCategoryProps } = getTypeBaseProps(\n parsedSchema,\n cardOptions,\n extraPropsHaveCategory\n );\n\n const allProps = [...typeBasedProps, ...extraProps];\n const uniqueProps = [...new Set([...allProps])];\n const basicProps = [];\n const nestedProps = {};\n uniqueProps.forEach(prop => {\n if (prop) {\n if (!prop.includes('.')) {\n basicProps.push(prop);\n return;\n }\n const [base, nested] = prop.split('.');\n if (!nestedProps[base]) nestedProps[base] = [nested];\n else nestedProps[base].push(nested);\n }\n });\n\n const complexProps = buildComplexProps(\n shouldAddCategoryProps,\n nestedProps,\n parsedSchema,\n linkProps\n );\n\n return [...basicProps, ...complexProps].join(',');\n};\n\nconst buildComplexProps = (\n shouldAddCategoryProps,\n props,\n { relations = [], dynamicProperties = {}, properties = {} },\n linkProps\n) =>\n Object.keys(props).map(base => {\n const nestedProps = props[base];\n const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));\n const matchingProperty = !!properties[base];\n const matchingRelation = relations.find(({ localField }) => localField === base);\n const matchingDynamicProp = Object.keys(dynamicProperties).find(\n dynamicKey => dynamicKey === base\n );\n\n if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');\n if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp))\n nestedProps.push('url');\n const jointNestedProps = nestedProps.join(',');\n if (base === 'category' && shouldAddCategoryProps)\n return `${base}{${jointNestedProps}, ${categoryProps}}`;\n if (base.includes('published')) {\n return `${base}{${jointNestedProps},url}`;\n }\n return `${base}{${jointNestedProps}}`;\n });\n\nconst getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) => {\n const isCard = !!cardOptions;\n const { displayCategory = true, displayThumbnail = true } = cardOptions || {};\n\n const shouldAddCategoryProps =\n (isCard && displayCategory) || (!isCard && !extraPropsHaveCategory);\n\n if (!isCard) return { typeBasedProps: [ID], shouldAddCategoryProps };\n\n const { interfaces, properties, dynamicProperties, relations } = entitySchema;\n\n const isContent = !!interfaces.includes('content/content');\n const hasCategory = checkProps(properties) || checkProps(dynamicProperties);\n const hasPreheader = properties[PREHEADER_PROP];\n\n const typeBasedProps = [...defaultProps];\n\n typeBasedProps.push(...getCategoyProps(shouldAddCategoryProps, hasCategory, hasPreheader));\n typeBasedProps.push(...getContentProps(isContent));\n\n if (properties.url || dynamicProperties.url) typeBasedProps.push('url');\n\n if (displayThumbnail && relations.find(({ localField }) => localField === 'image')) {\n typeBasedProps.push('image.id', 'image.url', 'image.data');\n }\n\n return { typeBasedProps, shouldAddCategoryProps };\n};\n\nconst getContentProps = isContent => (isContent ? ['url', 'sponsored', 'featured'] : []);\n\nconst getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {\n if (!shouldAddCategoryProps) return [];\n const props = [];\n if (hasCategory)\n props.push('category.name', 'category.listingPageId', 'category.listingPageEntity');\n\n if (hasPreheader) {\n props.push(`${PREHEADER_PROP}{name}`);\n props.push(HEADLINE_PROP);\n }\n\n return props;\n};\n\nexport default buildPropsQuery;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,EAAE,EAAEC,cAAc,EAAEC,aAAa,QAAQ,cAAc;AAE7E,MAAMC,YAAY,GAAG,CAACH,EAAE,EAAE,MAAM,CAAC;AACjC,MAAMI,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,cAAc,CAACS,IAAI,CAAC,GAAG2B,eAAe,CAACnC,sBAAsB,EAAEiC,WAAW,EAAEC,YAAY,CAAC,CAAC;EAC1FnC,cAAc,CAACS,IAAI,CAAC,GAAG4B,eAAe,CAACJ,SAAS,CAAC,CAAC;EAElD,IAAIf,UAAU,CAACoB,GAAG,IAAIrB,iBAAiB,CAACqB,GAAG,EAAEtC,cAAc,CAACS,IAAI,CAAC,KAAK,CAAC;EAEvE,IAAIsB,gBAAgB,IAAIf,SAAS,CAACK,IAAI,CAAC,CAAC;IAAEI;EAAW,CAAC,KAAKA,UAAU,KAAK,OAAO,CAAC,EAAE;IAClFzB,cAAc,CAACS,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,CAAC;EAC5D;EAEA,OAAO;IAAET,cAAc;IAAEC;EAAuB,CAAC;AACnD,CAAC;AAED,MAAMoC,eAAe,GAAGJ,SAAS,IAAKA,SAAS,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAG;AAExF,MAAMG,eAAe,GAAGA,CAACnC,sBAAsB,EAAEiC,WAAW,EAAEC,YAAY,KAAK;EAC7E,IAAI,CAAClC,sBAAsB,EAAE,OAAO,EAAE;EACtC,MAAMhB,KAAK,GAAG,EAAE;EAChB,IAAIiD,WAAW,EACbjD,KAAK,CAACwB,IAAI,CAAC,eAAe,EAAE,wBAAwB,EAAE,4BAA4B,CAAC;EAErF,IAAI0B,YAAY,EAAE;IAChBlD,KAAK,CAACwB,IAAI,CAAE,GAAE7B,cAAe,QAAO,CAAC;IACrCK,KAAK,CAACwB,IAAI,CAAC5B,aAAa,CAAC;EAC3B;EAEA,OAAOI,KAAK;AACd,CAAC;AAED,eAAeM,eAAe"}
|
|
@@ -9,11 +9,11 @@ const getWrappedValueWithLink = (value, link, keyPrefix = '') => {
|
|
|
9
9
|
} = arrValue;
|
|
10
10
|
const keyValue = arrValue[keyField];
|
|
11
11
|
const isLastItem = index === value.length - 1;
|
|
12
|
-
const keyFieldValue = isLastItem ? keyValue :
|
|
12
|
+
const keyFieldValue = isLastItem ? keyValue : /*#__PURE__*/React.createElement(React.Fragment, null, keyValue, ", ");
|
|
13
13
|
return url ? /*#__PURE__*/React.createElement(BlazeLink, {
|
|
14
14
|
key: [keyPrefix, index].join('-'),
|
|
15
15
|
href: url
|
|
16
|
-
},
|
|
16
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, keyFieldValue, " ")) : /*#__PURE__*/React.createElement(React.Fragment, null, keyFieldValue, " ");
|
|
17
17
|
});
|
|
18
18
|
return arrayResults.length ? arrayResults : null;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-wrapped-value-with-link.js","names":["React","BlazeLink","getWrappedValueWithLink","value","link","keyPrefix","Array","isArray","arrayResults","map","arrValue","index","keyField","url","keyValue","isLastItem","length","keyFieldValue","
|
|
1
|
+
{"version":3,"file":"get-wrapped-value-with-link.js","names":["React","BlazeLink","getWrappedValueWithLink","value","link","keyPrefix","Array","isArray","arrayResults","map","arrValue","index","keyField","url","keyValue","isLastItem","length","keyFieldValue","createElement","Fragment","key","join","href"],"sources":["../../src/helpers/get-wrapped-value-with-link.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../components/BlazeLink';\n\nconst getWrappedValueWithLink = (value, link, keyPrefix = '') => {\n if (Array.isArray(value)) {\n const arrayResults = value.map((arrValue, index) => {\n const { keyField, url } = arrValue;\n const keyValue = arrValue[keyField];\n\n const isLastItem = index === value.length - 1;\n const keyFieldValue = isLastItem ? keyValue : <>{keyValue}, </>;\n\n return url ? (\n <BlazeLink key={[keyPrefix, index].join('-')} href={url}>\n {<>{keyFieldValue} </>}\n </BlazeLink>\n ) : (\n <>{keyFieldValue} </>\n );\n });\n\n return arrayResults.length ? arrayResults : null;\n }\n\n return link ? <BlazeLink href={link}>{value}</BlazeLink> : value;\n};\n\nexport default getWrappedValueWithLink;\n"],"mappings":"AAAA,OAAOA,KAAK,MA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@@ export { default as getParsedPropValues } from './get-parsed-prop-values';
|
|
|
51
51
|
export { default as getSanitizedPropValues } from './get-sanitized-prop-values';
|
|
52
52
|
export { default as appendImages } from './append-images';
|
|
53
53
|
export { default as parseTextBlock } from './parse-TextBlock';
|
|
54
|
+
export { default as processDataSummaryValue } from './process-data-summary-value';
|
|
54
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","buildInheritedFilters","buildLinkExtraProps","buildPropsQuery","buildQueryFields","buildRawQuery","buildRawQueryBase","buildSearchValuesCheckboxSelect","buildSearchValuesText","buildSetFilters","checkPropsToUse","getElasticsearchOperator","getClickWrapperOptions","getEntitiesWithBanner","getEntityData","getEntityRenderProps","getGenericProps","getGenericRenderVariables","getImageIds","getInheritedFilters","getModifiers","getNotEqualQuery","getPaginationIndex","getParsedSummaryValue","getQueryFilters","getQueryProps","getRequiredSchemas","getSearchFilterType","getUnpublishedEntityName","getWrappedValueWithLink","getItemsToDisplayIds","isBrowser","isFilterEntitysId","isObject","isUsingRelationImage","parsePropsToDisplay","renderChildren","shouldRenderWaypoint","shouldShowProperty","sortResponseData","splitChildren","getCurrentOffset","updateChildrensParent","getDisplayCountData","buildImageProperties","getUpdatedFilterBy","checkForError","removeUnwantedCharacters","hasChildren","removeExtraItems","getParsedPropValues","getSanitizedPropValues","appendImages","parseTextBlock"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildInheritedFilters } from './build-inherited-filters';\nexport { default as buildLinkExtraProps } from './build-link-extra-props';\nexport { default as buildPropsQuery } from './build-props-query';\nexport { default as buildQueryFields } from './build-query-fields';\nexport { default as buildRawQuery } from './build-raw-query';\nexport { default as buildRawQueryBase } from './build-raw-query-base';\nexport { default as buildSearchValuesCheckboxSelect } from './build-search-values-checkbox-select';\nexport { default as buildSearchValuesText } from './build-search-values-text';\nexport { default as buildSetFilters } from './build-set-filters';\nexport { default as checkPropsToUse } from './check-props-to-use';\nexport { default as getElasticsearchOperator } from './get-elasticsearch-operator';\nexport { default as getClickWrapperOptions } from './get-click-wrapper-options';\nexport { default as getEntitiesWithBanner } from './get-entities-with-banner';\nexport { default as getEntityData } from './get-entity-data';\nexport { default as getEntityRenderProps } from './get-entity-render-props';\nexport { default as getGenericProps } from './get-generic-props';\nexport { default as getGenericRenderVariables } from './get-generic-render-variables';\nexport { default as getImageIds } from './get-image-ids';\nexport { default as getInheritedFilters } from './get-inherited-filters';\nexport { default as getModifiers } from './get-modifiers';\nexport { default as getNotEqualQuery } from './get-not-equal-query';\nexport { default as getPaginationIndex } from './get-pagination-index';\nexport { default as getParsedSummaryValue } from './get-parsed-summary-value';\nexport { default as getQueryFilters } from './get-query-filters';\nexport { default as getQueryProps } from './get-query-props';\nexport { default as getRequiredSchemas } from './get-required-schemas';\nexport { default as getSearchFilterType } from './get-search-filter-type';\nexport { default as getUnpublishedEntityName } from './get-unpublished-entity-name';\nexport { default as getWrappedValueWithLink } from './get-wrapped-value-with-link';\nexport { default as getItemsToDisplayIds } from './get-items-to-display-ids';\nexport { default as isBrowser } from './is-browser';\nexport { default as isFilterEntitysId } from './is-filter-entitys-id';\nexport { default as isObject } from './is-object';\nexport { default as isUsingRelationImage } from './is-using-relation-image';\nexport { default as parsePropsToDisplay } from './parse-props-to-display';\nexport { default as renderChildren } from './render-children';\nexport { default as shouldRenderWaypoint } from './should-render-waypoint';\nexport { default as shouldShowProperty } from './should-show-property';\nexport { default as sortResponseData } from './sort-response-data';\nexport { default as splitChildren } from './split-children';\nexport { default as getCurrentOffset } from './get-current-offset';\nexport { default as updateChildrensParent } from './update-childrens-parent';\nexport { default as getDisplayCountData } from './get-display-count-data';\nexport { default as buildImageProperties } from './build-image-properties';\nexport { default as getUpdatedFilterBy } from './get-updated-filter-by';\nexport { default as checkForError } from './check-for-error';\nexport { default as removeUnwantedCharacters } from './remove-unwanted-characters';\nexport { default as hasChildren } from './has-children';\nexport { default as removeExtraItems } from './remove-extra-items';\nexport { default as getParsedPropValues } from './get-parsed-prop-values';\nexport { default as getSanitizedPropValues } from './get-sanitized-prop-values';\nexport { default as appendImages } from './append-images';\nexport { default as parseTextBlock } from './parse-TextBlock';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAAqB,QAAQ,2BAA2B;AAC5E,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,0BAA0B;AACzE,SAASF,OAAO,IAAIG,eAAe,QAAQ,qBAAqB;AAChE,SAASH,OAAO,IAAII,gBAAgB,QAAQ,sBAAsB;AAClE,SAASJ,OAAO,IAAIK,aAAa,QAAQ,mBAAmB;AAC5D,SAASL,OAAO,IAAIM,iBAAiB,QAAQ,wBAAwB;AACrE,SAASN,OAAO,IAAIO,+BAA+B,QAAQ,uCAAuC;AAClG,SAASP,OAAO,IAAIQ,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASR,OAAO,IAAIS,eAAe,QAAQ,qBAAqB;AAChE,SAAST,OAAO,IAAIU,eAAe,QAAQ,sBAAsB;AACjE,SAASV,OAAO,IAAIW,wBAAwB,QAAQ,8BAA8B;AAClF,SAASX,OAAO,IAAIY,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASZ,OAAO,IAAIa,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASb,OAAO,IAAIc,aAAa,QAAQ,mBAAmB;AAC5D,SAASd,OAAO,IAAIe,oBAAoB,QAAQ,2BAA2B;AAC3E,SAASf,OAAO,IAAIgB,eAAe,QAAQ,qBAAqB;AAChE,SAAShB,OAAO,IAAIiB,yBAAyB,QAAQ,gCAAgC;AACrF,SAASjB,OAAO,IAAIkB,WAAW,QAAQ,iBAAiB;AACxD,SAASlB,OAAO,IAAImB,mBAAmB,QAAQ,yBAAyB;AACxE,SAASnB,OAAO,IAAIoB,YAAY,QAAQ,iBAAiB;AACzD,SAASpB,OAAO,IAAIqB,gBAAgB,QAAQ,uBAAuB;AACnE,SAASrB,OAAO,IAAIsB,kBAAkB,QAAQ,wBAAwB;AACtE,SAASt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AAC5D,SAAS9C,OAAO,IAAI+C,wBAAwB,QAAQ,8BAA8B;AAClF,SAAS/C,OAAO,IAAIgD,WAAW,QAAQ,gBAAgB;AACvD,SAAShD,OAAO,IAAIiD,gBAAgB,QAAQ,sBAAsB;AAClE,SAASjD,OAAO,IAAIkD,mBAAmB,QAAQ,0BAA0B;AACzE,SAASlD,OAAO,IAAImD,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASnD,OAAO,IAAIoD,YAAY,QAAQ,iBAAiB;AACzD,SAASpD,OAAO,IAAIqD,cAAc,QAAQ,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","buildInheritedFilters","buildLinkExtraProps","buildPropsQuery","buildQueryFields","buildRawQuery","buildRawQueryBase","buildSearchValuesCheckboxSelect","buildSearchValuesText","buildSetFilters","checkPropsToUse","getElasticsearchOperator","getClickWrapperOptions","getEntitiesWithBanner","getEntityData","getEntityRenderProps","getGenericProps","getGenericRenderVariables","getImageIds","getInheritedFilters","getModifiers","getNotEqualQuery","getPaginationIndex","getParsedSummaryValue","getQueryFilters","getQueryProps","getRequiredSchemas","getSearchFilterType","getUnpublishedEntityName","getWrappedValueWithLink","getItemsToDisplayIds","isBrowser","isFilterEntitysId","isObject","isUsingRelationImage","parsePropsToDisplay","renderChildren","shouldRenderWaypoint","shouldShowProperty","sortResponseData","splitChildren","getCurrentOffset","updateChildrensParent","getDisplayCountData","buildImageProperties","getUpdatedFilterBy","checkForError","removeUnwantedCharacters","hasChildren","removeExtraItems","getParsedPropValues","getSanitizedPropValues","appendImages","parseTextBlock","processDataSummaryValue"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildInheritedFilters } from './build-inherited-filters';\nexport { default as buildLinkExtraProps } from './build-link-extra-props';\nexport { default as buildPropsQuery } from './build-props-query';\nexport { default as buildQueryFields } from './build-query-fields';\nexport { default as buildRawQuery } from './build-raw-query';\nexport { default as buildRawQueryBase } from './build-raw-query-base';\nexport { default as buildSearchValuesCheckboxSelect } from './build-search-values-checkbox-select';\nexport { default as buildSearchValuesText } from './build-search-values-text';\nexport { default as buildSetFilters } from './build-set-filters';\nexport { default as checkPropsToUse } from './check-props-to-use';\nexport { default as getElasticsearchOperator } from './get-elasticsearch-operator';\nexport { default as getClickWrapperOptions } from './get-click-wrapper-options';\nexport { default as getEntitiesWithBanner } from './get-entities-with-banner';\nexport { default as getEntityData } from './get-entity-data';\nexport { default as getEntityRenderProps } from './get-entity-render-props';\nexport { default as getGenericProps } from './get-generic-props';\nexport { default as getGenericRenderVariables } from './get-generic-render-variables';\nexport { default as getImageIds } from './get-image-ids';\nexport { default as getInheritedFilters } from './get-inherited-filters';\nexport { default as getModifiers } from './get-modifiers';\nexport { default as getNotEqualQuery } from './get-not-equal-query';\nexport { default as getPaginationIndex } from './get-pagination-index';\nexport { default as getParsedSummaryValue } from './get-parsed-summary-value';\nexport { default as getQueryFilters } from './get-query-filters';\nexport { default as getQueryProps } from './get-query-props';\nexport { default as getRequiredSchemas } from './get-required-schemas';\nexport { default as getSearchFilterType } from './get-search-filter-type';\nexport { default as getUnpublishedEntityName } from './get-unpublished-entity-name';\nexport { default as getWrappedValueWithLink } from './get-wrapped-value-with-link';\nexport { default as getItemsToDisplayIds } from './get-items-to-display-ids';\nexport { default as isBrowser } from './is-browser';\nexport { default as isFilterEntitysId } from './is-filter-entitys-id';\nexport { default as isObject } from './is-object';\nexport { default as isUsingRelationImage } from './is-using-relation-image';\nexport { default as parsePropsToDisplay } from './parse-props-to-display';\nexport { default as renderChildren } from './render-children';\nexport { default as shouldRenderWaypoint } from './should-render-waypoint';\nexport { default as shouldShowProperty } from './should-show-property';\nexport { default as sortResponseData } from './sort-response-data';\nexport { default as splitChildren } from './split-children';\nexport { default as getCurrentOffset } from './get-current-offset';\nexport { default as updateChildrensParent } from './update-childrens-parent';\nexport { default as getDisplayCountData } from './get-display-count-data';\nexport { default as buildImageProperties } from './build-image-properties';\nexport { default as getUpdatedFilterBy } from './get-updated-filter-by';\nexport { default as checkForError } from './check-for-error';\nexport { default as removeUnwantedCharacters } from './remove-unwanted-characters';\nexport { default as hasChildren } from './has-children';\nexport { default as removeExtraItems } from './remove-extra-items';\nexport { default as getParsedPropValues } from './get-parsed-prop-values';\nexport { default as getSanitizedPropValues } from './get-sanitized-prop-values';\nexport { default as appendImages } from './append-images';\nexport { default as parseTextBlock } from './parse-TextBlock';\nexport { default as processDataSummaryValue } from './process-data-summary-value';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAAqB,QAAQ,2BAA2B;AAC5E,SAASD,OAAO,IAAIE,mBAAmB,QAAQ,0BAA0B;AACzE,SAASF,OAAO,IAAIG,eAAe,QAAQ,qBAAqB;AAChE,SAASH,OAAO,IAAII,gBAAgB,QAAQ,sBAAsB;AAClE,SAASJ,OAAO,IAAIK,aAAa,QAAQ,mBAAmB;AAC5D,SAASL,OAAO,IAAIM,iBAAiB,QAAQ,wBAAwB;AACrE,SAASN,OAAO,IAAIO,+BAA+B,QAAQ,uCAAuC;AAClG,SAASP,OAAO,IAAIQ,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASR,OAAO,IAAIS,eAAe,QAAQ,qBAAqB;AAChE,SAAST,OAAO,IAAIU,eAAe,QAAQ,sBAAsB;AACjE,SAASV,OAAO,IAAIW,wBAAwB,QAAQ,8BAA8B;AAClF,SAASX,OAAO,IAAIY,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASZ,OAAO,IAAIa,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASb,OAAO,IAAIc,aAAa,QAAQ,mBAAmB;AAC5D,SAASd,OAAO,IAAIe,oBAAoB,QAAQ,2BAA2B;AAC3E,SAASf,OAAO,IAAIgB,eAAe,QAAQ,qBAAqB;AAChE,SAAShB,OAAO,IAAIiB,yBAAyB,QAAQ,gCAAgC;AACrF,SAASjB,OAAO,IAAIkB,WAAW,QAAQ,iBAAiB;AACxD,SAASlB,OAAO,IAAImB,mBAAmB,QAAQ,yBAAyB;AACxE,SAASnB,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AAS3C,OAAO,IAAI4C,oBAAoB,QAAQ,0BAA0B;AAC1E,SAAS5C,OAAO,IAAI6C,kBAAkB,QAAQ,yBAAyB;AACvE,SAAS7C,OAAO,IAAI8C,aAAa,QAAQ,mBAAmB;AAC5D,SAAS9C,OAAO,IAAI+C,wBAAwB,QAAQ,8BAA8B;AAClF,SAAS/C,OAAO,IAAIgD,WAAW,QAAQ,gBAAgB;AACvD,SAAShD,OAAO,IAAIiD,gBAAgB,QAAQ,sBAAsB;AAClE,SAASjD,OAAO,IAAIkD,mBAAmB,QAAQ,0BAA0B;AACzE,SAASlD,OAAO,IAAImD,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASnD,OAAO,IAAIoD,YAAY,QAAQ,iBAAiB;AACzD,SAASpD,OAAO,IAAIqD,cAAc,QAAQ,mBAAmB;AAC7D,SAASrD,OAAO,IAAIsD,uBAAuB,QAAQ,8BAA8B"}
|
|
@@ -4,18 +4,20 @@ import isObject from './is-object';
|
|
|
4
4
|
import getParsedPropValues from './get-parsed-prop-values';
|
|
5
5
|
import getSanitizedPropValues from './get-sanitized-prop-values';
|
|
6
6
|
import { BOLD_TAG, BLANK_SPACE_UNICODE_STRING } from '../constants';
|
|
7
|
+
import processDataSummaryValue from './process-data-summary-value';
|
|
7
8
|
|
|
8
9
|
// TODO this helper should be removed if database is wiped clean and all elements change to new props struc
|
|
9
10
|
const parsePropsToDisplay = (props = {}, propsToDisplay = []) => {
|
|
10
11
|
if (!isObject(propsToDisplay[0])) return at(props, propsToDisplay).filter(Boolean);
|
|
11
|
-
return propsToDisplay.map(({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
return propsToDisplay.map((options, currentIndex) => {
|
|
13
|
+
const {
|
|
14
|
+
bold,
|
|
15
|
+
propertiesToDisplay,
|
|
16
|
+
prefix,
|
|
17
|
+
suffix,
|
|
18
|
+
shouldStrip,
|
|
19
|
+
enableLink
|
|
20
|
+
} = options;
|
|
19
21
|
const Wrapper = bold ? BOLD_TAG : Fragment;
|
|
20
22
|
const parsedPropValues = getParsedPropValues({
|
|
21
23
|
propertiesToDisplay,
|
|
@@ -26,7 +28,8 @@ const parsePropsToDisplay = (props = {}, propsToDisplay = []) => {
|
|
|
26
28
|
const sanitizedPropValues = getSanitizedPropValues(parsedPropValues);
|
|
27
29
|
if (!sanitizedPropValues || !sanitizedPropValues.length) return null;
|
|
28
30
|
const stringEndBlank = currentIndex + 1 === propsToDisplay.length ? '' : BLANK_SPACE_UNICODE_STRING;
|
|
29
|
-
|
|
31
|
+
const processedValue = Array.isArray(sanitizedPropValues) ? sanitizedPropValues.map(value => processDataSummaryValue(value, options)) : processDataSummaryValue(sanitizedPropValues, options);
|
|
32
|
+
return /*#__PURE__*/React.createElement(Wrapper, null, prefix, " ", processedValue, " ", suffix, stringEndBlank);
|
|
30
33
|
});
|
|
31
34
|
};
|
|
32
35
|
export default parsePropsToDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-props-to-display.js","names":["React","Fragment","at","isObject","getParsedPropValues","getSanitizedPropValues","BOLD_TAG","BLANK_SPACE_UNICODE_STRING","parsePropsToDisplay","props","propsToDisplay","filter","Boolean","map","bold","propertiesToDisplay","prefix","suffix","shouldStrip","enableLink","
|
|
1
|
+
{"version":3,"file":"parse-props-to-display.js","names":["React","Fragment","at","isObject","getParsedPropValues","getSanitizedPropValues","BOLD_TAG","BLANK_SPACE_UNICODE_STRING","processDataSummaryValue","parsePropsToDisplay","props","propsToDisplay","filter","Boolean","map","options","currentIndex","bold","propertiesToDisplay","prefix","suffix","shouldStrip","enableLink","Wrapper","parsedPropValues","sanitizedPropValues","length","stringEndBlank","processedValue","Array","isArray","value","createElement"],"sources":["../../src/helpers/parse-props-to-display.js"],"sourcesContent":["import React, { Fragment } from 'react';\nimport at from 'lodash.at';\nimport isObject from './is-object';\nimport getParsedPropValues from './get-parsed-prop-values';\nimport getSanitizedPropValues from './get-sanitized-prop-values';\nimport { BOLD_TAG, BLANK_SPACE_UNICODE_STRING } from '../constants';\nimport processDataSummaryValue from './process-data-summary-value';\n\n// TODO this helper should be removed if database is wiped clean and all elements change to new props struc\nconst parsePropsToDisplay = (props = {}, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) return at(props, propsToDisplay).filter(Boolean);\n\n return propsToDisplay.map((options, currentIndex) => {\n const { bold, propertiesToDisplay, prefix, suffix, shouldStrip, enableLink } = options;\n const Wrapper = bold ? BOLD_TAG : Fragment;\n\n const parsedPropValues = getParsedPropValues({\n propertiesToDisplay,\n props,\n enableLink,\n shouldStrip\n });\n\n const sanitizedPropValues = getSanitizedPropValues(parsedPropValues);\n if (!sanitizedPropValues || !sanitizedPropValues.length) return null;\n const stringEndBlank =\n currentIndex + 1 === propsToDisplay.length ? '' : BLANK_SPACE_UNICODE_STRING;\n\n const processedValue = Array.isArray(sanitizedPropValues)\n ? sanitizedPropValues.map(value => processDataSummaryValue(value, options))\n : processDataSummaryValue(sanitizedPropValues, options);\n\n return (\n <Wrapper>\n {prefix} {processedValue} {suffix}\n {stringEndBlank}\n </Wrapper>\n );\n });\n};\n\nexport default parsePropsToDisplay;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,QAAQ,EAAEC,0BAA0B,QAAQ,cAAc;AACnE,OAAOC,uBAAuB,MAAM,8BAA8B;;AAElE;AACA,MAAMC,mBAAmB,GAAGA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAEC,cAAc,GAAG,EAAE,KAAK;EAC/D,IAAI,CAACR,QAAQ,CAACQ,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,OAAOT,EAAE,CAACQ,KAAK,EAAEC,cAAc,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;EAElF,OAAOF,cAAc,CAACG,GAAG,CAAC,CAACC,OAAO,EAAEC,YAAY,KAAK;IACnD,MAAM;MAAEC,IAAI;MAAEC,mBAAmB;MAAEC,MAAM;MAAEC,MAAM;MAAEC,WAAW;MAAEC;IAAW,CAAC,GAAGP,OAAO;IACtF,MAAMQ,OAAO,GAAGN,IAAI,GAAGX,QAAQ,GAAGL,QAAQ;IAE1C,MAAMuB,gBAAgB,GAAGpB,mBAAmB,CAAC;MAC3Cc,mBAAmB;MACnBR,KAAK;MACLY,UAAU;MACVD;IACF,CAAC,CAAC;IAEF,MAAMI,mBAAmB,GAAGpB,sBAAsB,CAACmB,gBAAgB,CAAC;IACpE,IAAI,CAACC,mBAAmB,IAAI,CAACA,mBAAmB,CAACC,MAAM,EAAE,OAAO,IAAI;IACpE,MAAMC,cAAc,GAClBX,YAAY,GAAG,CAAC,KAAKL,cAAc,CAACe,MAAM,GAAG,EAAE,GAAGnB,0BAA0B;IAE9E,MAAMqB,cAAc,GAAGC,KAAK,CAACC,OAAO,CAACL,mBAAmB,CAAC,GACrDA,mBAAmB,CAACX,GAAG,CAACiB,KAAK,IAAIvB,uBAAuB,CAACuB,KAAK,EAAEhB,OAAO,CAAC,CAAC,GACzEP,uBAAuB,CAACiB,mBAAmB,EAAEV,OAAO,CAAC;IAEzD,oBACEf,KAAA,CAAAgC,aAAA,CAACT,OAAO,QACLJ,MAAM,EAAC,GAAC,EAACS,cAAc,EAAC,GAAC,EAACR,MAAM,EAChCO,cACM,CAAC;EAEd,CAAC,CAAC;AACJ,CAAC;AAED,eAAelB,mBAAmB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
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; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import components from '../components';
|
|
9
|
+
const {
|
|
10
|
+
code: Code
|
|
11
|
+
} = components;
|
|
12
|
+
const renderCode = value => /*#__PURE__*/React.createElement(Code, {
|
|
13
|
+
code: value,
|
|
14
|
+
disableWrapper: true
|
|
15
|
+
});
|
|
16
|
+
const processDataSummaryValue = (objPropValue, {
|
|
17
|
+
isHtml
|
|
18
|
+
}) => {
|
|
19
|
+
let pValue = objPropValue;
|
|
20
|
+
if (isHtml) {
|
|
21
|
+
pValue = Array.isArray(objPropValue) ? objPropValue.map(_ref => {
|
|
22
|
+
let {
|
|
23
|
+
keyField,
|
|
24
|
+
[keyField]: value
|
|
25
|
+
} = _ref,
|
|
26
|
+
otherProps = _objectWithoutProperties(_ref, ["keyField", keyField].map(_toPropertyKey));
|
|
27
|
+
return _objectSpread({
|
|
28
|
+
[keyField]: renderCode(value),
|
|
29
|
+
keyField
|
|
30
|
+
}, otherProps);
|
|
31
|
+
}) : renderCode(objPropValue);
|
|
32
|
+
}
|
|
33
|
+
return pValue;
|
|
34
|
+
};
|
|
35
|
+
export default processDataSummaryValue;
|
|
36
|
+
//# sourceMappingURL=process-data-summary-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-data-summary-value.js","names":["React","components","code","Code","renderCode","value","createElement","disableWrapper","processDataSummaryValue","objPropValue","isHtml","pValue","Array","isArray","map","_ref","keyField","otherProps","_objectWithoutProperties","_toPropertyKey","_objectSpread"],"sources":["../../src/helpers/process-data-summary-value.js"],"sourcesContent":["import React from 'react';\nimport components from '../components';\n\nconst { code: Code } = components;\n\nconst renderCode = value => <Code code={value} disableWrapper />;\n\nconst processDataSummaryValue = (objPropValue, { isHtml }) => {\n let pValue = objPropValue;\n if (isHtml) {\n pValue = Array.isArray(objPropValue)\n ? objPropValue.map(({ keyField, [keyField]: value, ...otherProps }) => ({\n [keyField]: renderCode(value),\n keyField,\n ...otherProps\n }))\n : renderCode(objPropValue);\n }\n return pValue;\n};\n\nexport default processDataSummaryValue;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,eAAe;AAEtC,MAAM;EAAEC,IAAI,EAAEC;AAAK,CAAC,GAAGF,UAAU;AAEjC,MAAMG,UAAU,GAAGC,KAAK,iBAAIL,KAAA,CAAAM,aAAA,CAACH,IAAI;EAACD,IAAI,EAAEG,KAAM;EAACE,cAAc;AAAA,CAAE,CAAC;AAEhE,MAAMC,uBAAuB,GAAGA,CAACC,YAAY,EAAE;EAAEC;AAAO,CAAC,KAAK;EAC5D,IAAIC,MAAM,GAAGF,YAAY;EACzB,IAAIC,MAAM,EAAE;IACVC,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACJ,YAAY,CAAC,GAChCA,YAAY,CAACK,GAAG,CAACC,IAAA;MAAA,IAAC;UAAEC,QAAQ;UAAE,CAACA,QAAQ,GAAGX;QAAqB,CAAC,GAAAU,IAAA;QAAZE,UAAU,GAAAC,wBAAA,CAAAH,IAAA,eAA/BC,QAAQ,EAAAF,GAAA,CAAAK,cAAA;MAAA,OAAAC,aAAA;QACrC,CAACJ,QAAQ,GAAGZ,UAAU,CAACC,KAAK,CAAC;QAC7BW;MAAQ,GACLC,UAAU;IAAA,CACb,CAAC,GACHb,UAAU,CAACK,YAAY,CAAC;EAC9B;EACA,OAAOE,MAAM;AACf,CAAC;AAED,eAAeH,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.130.0-admin-updates.
|
|
3
|
+
"version": "0.130.0-admin-updates.8",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "4b393fc952a6c63e502d86863a62d56f5f32f69f"
|
|
93
93
|
}
|
|
@@ -7,26 +7,30 @@ import { getClassModifiers } from '../../utils';
|
|
|
7
7
|
import { CODE } from '../../constants';
|
|
8
8
|
import { wrapScriptTags } from './helpers';
|
|
9
9
|
|
|
10
|
-
const Code = memo(({ code: embedCode, parserOptions, ...otherProps }) => {
|
|
10
|
+
const Code = memo(({ code: embedCode, parserOptions, disableWrapper, ...otherProps }) => {
|
|
11
11
|
if (!embedCode) return null;
|
|
12
12
|
|
|
13
13
|
const parsedCode = parseHTML(embedCode, parserOptions);
|
|
14
14
|
const wrappedCode = wrapScriptTags(parsedCode);
|
|
15
15
|
const modifiers = getClassModifiers(CODE, { ...otherProps });
|
|
16
16
|
|
|
17
|
+
if (disableWrapper) return wrappedCode;
|
|
18
|
+
|
|
17
19
|
return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
Code.propTypes = {
|
|
21
23
|
code: PropTypes.string,
|
|
22
24
|
modifier: PropTypes.string,
|
|
23
|
-
parserOptions: PropTypes.object
|
|
25
|
+
parserOptions: PropTypes.object,
|
|
26
|
+
disableWrapper: PropTypes.bool
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
Code.defaultProps = {
|
|
27
30
|
code: '',
|
|
28
31
|
modifier: '',
|
|
29
|
-
parserOptions: {}
|
|
32
|
+
parserOptions: {},
|
|
33
|
+
disableWrapper: false
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
export default withTitle(Code);
|
|
@@ -3,6 +3,7 @@ import flatten from 'lodash.flatten';
|
|
|
3
3
|
import getLinkToPublishedContent from './get-link-to-published-content';
|
|
4
4
|
import getLoopPropsLimit from './get-loop-props-limit';
|
|
5
5
|
import getPropValue from './get-prop-value';
|
|
6
|
+
import { processDataSummaryValue } from '../../../helpers';
|
|
6
7
|
|
|
7
8
|
const getLoopValue = value => {
|
|
8
9
|
const { keyField } = value;
|
|
@@ -46,8 +47,10 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
46
47
|
const loopValue = loopValues[key];
|
|
47
48
|
const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
48
49
|
if (!propValue) return null;
|
|
50
|
+
|
|
51
|
+
const processedValue = processDataSummaryValue(propValue, options);
|
|
49
52
|
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
50
|
-
return [upperFirst(label),
|
|
53
|
+
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
51
54
|
});
|
|
52
55
|
})
|
|
53
56
|
).filter(Boolean);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import upperFirst from 'lodash.upperfirst';
|
|
2
2
|
import flatten from 'lodash.flatten';
|
|
3
|
-
import { isObject } from '../../../helpers';
|
|
3
|
+
import { isObject, processDataSummaryValue } from '../../../helpers';
|
|
4
4
|
import getLinkToPublishedContent from './get-link-to-published-content';
|
|
5
5
|
import getPropValue from './get-prop-value';
|
|
6
6
|
import getLinkBasedOnValue from './get-link-based-on-value';
|
|
@@ -27,15 +27,18 @@ const buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {
|
|
|
27
27
|
const objPropValue = getPropValue(key, props, options);
|
|
28
28
|
if (!objPropValue) return null;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const processedValue = processDataSummaryValue(objPropValue, options);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const link = getLink(enableLink, key, props, processedValue);
|
|
33
|
+
|
|
34
|
+
return [upperFirst(label), processedValue, link, modifier];
|
|
33
35
|
});
|
|
34
36
|
})
|
|
35
37
|
).filter(Boolean);
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export default buildPropsToDisplayWithContent;
|
|
41
|
+
|
|
39
42
|
function getLink(enableLink, key, props, objPropValue) {
|
|
40
43
|
let link = '';
|
|
41
44
|
if (enableLink) {
|
|
@@ -10,12 +10,12 @@ const SearchContent = ({
|
|
|
10
10
|
searchInputAlignment,
|
|
11
11
|
searchInputWrapperMobile,
|
|
12
12
|
searchInputWrapperDesktop,
|
|
13
|
-
collapsible,
|
|
14
13
|
isMobile,
|
|
15
14
|
placeholder,
|
|
16
|
-
modifier
|
|
15
|
+
modifier,
|
|
16
|
+
collapsedSearch
|
|
17
17
|
}) => {
|
|
18
|
-
const [collapsed, setCollapsed] = useState(
|
|
18
|
+
const [collapsed, setCollapsed] = useState(collapsedSearch);
|
|
19
19
|
const router = useRouter();
|
|
20
20
|
|
|
21
21
|
const { results, searchTerm, setSearchTerm, debouncedSearchTerm } = useDebounceSearch({
|
|
@@ -50,7 +50,7 @@ const SearchContent = ({
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const handleOnBlur = () => {
|
|
53
|
-
if (!
|
|
53
|
+
if (!collapsedSearch) return;
|
|
54
54
|
if (!debouncedSearchTerm || debouncedSearchTerm === '') setCollapsed(true);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -120,7 +120,8 @@ SearchContent.propTypes = {
|
|
|
120
120
|
isMobile: PropTypes.bool,
|
|
121
121
|
collapsible: PropTypes.bool,
|
|
122
122
|
entities: PropTypes.array.isRequired,
|
|
123
|
-
modifier: PropTypes.string
|
|
123
|
+
modifier: PropTypes.string,
|
|
124
|
+
collapsedSearch: PropTypes.bool
|
|
124
125
|
};
|
|
125
126
|
|
|
126
127
|
SearchContent.defaultProps = {
|
|
@@ -130,7 +131,8 @@ SearchContent.defaultProps = {
|
|
|
130
131
|
placeholder: '',
|
|
131
132
|
isMobile: false,
|
|
132
133
|
collapsible: false,
|
|
133
|
-
modifier: ''
|
|
134
|
+
modifier: '',
|
|
135
|
+
collapsedSearch: false
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
export default SearchContent;
|
|
@@ -128,7 +128,8 @@ const SearchFilterContainer = ({
|
|
|
128
128
|
setKey(`filter-${name}:${Date.now()}`); // remove after range component update
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const hashBit = asPath.split('#')[1];
|
|
132
|
+
const newUrl = buildNewQuery(url, currentUrl, newQuery, sortValues, hashBit);
|
|
132
133
|
scrollToFirstList();
|
|
133
134
|
setUrlPath(newUrl);
|
|
134
135
|
return router.push('/Resolver', newUrl, { shallow: !hasUrl, scroll: false });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const buildNewQuery = (url, currentUrl, queryParams, sortValues) => {
|
|
1
|
+
const buildNewQuery = (url, currentUrl, queryParams, sortValues, hashBit) => {
|
|
2
2
|
const newUrl = url ? `${url}?${queryParams}` : `${currentUrl}?${queryParams}`;
|
|
3
|
-
|
|
3
|
+
const withSortValues = sortValues ? `${newUrl}&${sortValues}` : newUrl;
|
|
4
|
+
return hashBit ? `${withSortValues}#${hashBit}` : withSortValues;
|
|
4
5
|
};
|
|
5
6
|
|
|
6
7
|
export default buildNewQuery;
|