@blaze-cms/react-page-builder 0.131.0-core-styles.0 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -13
- package/lib/HOC/recreateOnNavigation.js +29 -0
- package/lib/HOC/recreateOnNavigation.js.map +1 -0
- package/lib/components/Button.js +1 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardsRender.js +6 -13
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Card/helpers/index.js +0 -7
- package/lib/components/Card/helpers/index.js.map +1 -1
- package/lib/components/Code/Code.js +3 -7
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +2 -3
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/Layout/Layout.js +3 -2
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Layout/LayoutFactory.js +35 -0
- package/lib/components/Layout/LayoutFactory.js.map +1 -0
- package/lib/components/Layout/LayoutWithStickyTimer.js +66 -0
- package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -0
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/Layout/index.js.map +1 -1
- package/lib/components/List/ListFactory.js +11 -16
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/index.js +0 -14
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +6 -8
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +11 -17
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +85 -63
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +1 -3
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-new-query.js +15 -0
- package/lib/components/SearchFilter/helpers/build-new-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-query.js +37 -0
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +43 -0
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
- package/lib/components/SearchFilter/helpers/index.js +11 -18
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/index.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js +11 -31
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +5 -19
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js +5 -9
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js +0 -2
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-props-query.js +2 -5
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-set-filters.js +1 -5
- package/lib/helpers/build-set-filters.js.map +1 -1
- package/lib/helpers/get-query-filters.js +8 -6
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js +2 -13
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +3 -2
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/index.js +0 -14
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +8 -13
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/utils/get-class-modifiers.js +1 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib-es/HOC/recreateOnNavigation.js +20 -0
- package/lib-es/HOC/recreateOnNavigation.js.map +1 -0
- package/lib-es/components/Button.js +1 -2
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardsRender.js +7 -14
- package/lib-es/components/Card/CardsRender.js.map +1 -1
- package/lib-es/components/Card/helpers/index.js +0 -1
- package/lib-es/components/Card/helpers/index.js.map +1 -1
- package/lib-es/components/Code/Code.js +4 -8
- package/lib-es/components/Code/Code.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +1 -3
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -4
- package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib-es/components/Layout/Layout.js +3 -2
- package/lib-es/components/Layout/Layout.js.map +1 -1
- package/lib-es/components/Layout/LayoutFactory.js +14 -0
- package/lib-es/components/Layout/LayoutFactory.js.map +1 -0
- package/lib-es/components/Layout/LayoutWithStickyTimer.js +42 -0
- package/lib-es/components/Layout/LayoutWithStickyTimer.js.map +1 -0
- package/lib-es/components/Layout/index.js +2 -2
- package/lib-es/components/Layout/index.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +12 -16
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/index.js +0 -2
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +6 -8
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +11 -18
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +72 -47
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +0 -2
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-new-query.js +6 -0
- package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js +23 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +26 -0
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/index.js +4 -5
- 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/SearchFilterSort/SearchFilterSort.js +10 -26
- package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +4 -21
- package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js +4 -8
- package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib-es/helpers/build-inherited-filters.js +0 -2
- package/lib-es/helpers/build-inherited-filters.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +2 -4
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/helpers/build-set-filters.js +1 -5
- package/lib-es/helpers/build-set-filters.js.map +1 -1
- package/lib-es/helpers/get-query-filters.js +8 -6
- package/lib-es/helpers/get-query-filters.js.map +1 -1
- package/lib-es/helpers/get-query-props.js +2 -10
- package/lib-es/helpers/get-query-props.js.map +1 -1
- package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
- package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib-es/helpers/index.js +0 -2
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/parse-props-to-display.js +9 -12
- package/lib-es/helpers/parse-props-to-display.js.map +1 -1
- package/lib-es/utils/get-class-modifiers.js +1 -1
- package/lib-es/utils/get-class-modifiers.js.map +1 -1
- package/package.json +10 -10
- package/src/HOC/recreateOnNavigation.js +21 -0
- package/src/components/Button.js +1 -2
- package/src/components/Card/CardsRender.js +7 -27
- package/src/components/Card/helpers/index.js +0 -1
- package/src/components/Code/Code.js +3 -7
- package/src/components/DataSummary/helpers/build-loop-props-content.js +1 -4
- package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -6
- package/src/components/Layout/Layout.js +29 -32
- package/src/components/Layout/LayoutFactory.js +17 -0
- package/src/components/Layout/LayoutWithStickyTimer.js +40 -0
- package/src/components/Layout/index.js +2 -2
- package/src/components/List/ListFactory.js +15 -25
- package/src/components/List/helpers/index.js +0 -2
- package/src/components/SearchContent/SearchContent.js +6 -8
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +12 -21
- package/src/components/SearchFilter/SearchFilterContainer.js +69 -57
- package/src/components/SearchFilter/helpers/build-filters-query.js +1 -9
- package/src/components/SearchFilter/helpers/build-new-query.js +6 -0
- package/src/components/SearchFilter/helpers/build-query.js +26 -0
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +30 -0
- package/src/components/SearchFilter/helpers/index.js +7 -9
- package/src/components/SearchFilter/index.js +2 -2
- package/src/components/SearchFilterSort/SearchFilterSort.js +8 -18
- package/src/components/SearchFilterSort/helpers/handle-sort-update.js +5 -14
- package/src/components/SearchFilterSort/helpers/update-sort.js +3 -7
- package/src/helpers/build-inherited-filters.js +1 -3
- package/src/helpers/build-props-query.js +2 -4
- package/src/helpers/build-set-filters.js +1 -2
- package/src/helpers/get-query-filters.js +4 -4
- package/src/helpers/get-query-props.js +4 -12
- package/src/helpers/get-wrapped-value-with-link.js +3 -6
- package/src/helpers/index.js +0 -2
- package/src/helpers/parse-props-to-display.js +21 -25
- package/src/utils/get-class-modifiers.js +1 -1
- package/tests/helpers/mocks.js +5 -3
- package/tests/unit/src/HOC/recreateOnNavigation.test.js +28 -0
- package/tests/unit/src/components/Code/Code.test.js +0 -5
- package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +0 -8
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -9
- package/tests/unit/src/components/Layout/Layout.test.js +1 -1
- package/tests/unit/src/components/Layout/LayoutFactory.test.js +53 -0
- package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +7 -1
- 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 +7 -24
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
- package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +1 -4
- package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +19 -26
- package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +1 -10
- package/tests/unit/src/helpers/build-props-query.test.js +0 -25
- package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
- package/tests/unit/src/helpers/parse-props-to-display.test.js +0 -4
- package/lib/components/Card/helpers/get-updated-items-to-display.js +0 -55
- package/lib/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib/components/List/helpers/get-list-query.js +0 -43
- package/lib/components/List/helpers/get-list-query.js.map +0 -1
- package/lib/components/List/helpers/get-list-specific-search-filter.js +0 -21
- package/lib/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
- package/lib/components/List/helpers/strip-query-key.js +0 -14
- package/lib/components/List/helpers/strip-query-key.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-new-url.js +0 -17
- package/lib/components/SearchFilter/helpers/build-new-url.js.map +0 -1
- package/lib/components/SearchFilter/helpers/build-url-query.js +0 -48
- package/lib/components/SearchFilter/helpers/build-url-query.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -32
- package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
- package/lib/components/SearchFilter/helpers/get-filter-values.js +0 -31
- package/lib/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
- package/lib/components/SearchFilter/searchFilterReducer.js +0 -45
- package/lib/components/SearchFilter/searchFilterReducer.js.map +0 -1
- package/lib/helpers/build-query-key.js +0 -16
- package/lib/helpers/build-query-key.js.map +0 -1
- package/lib/helpers/process-data-summary-value.js +0 -56
- package/lib/helpers/process-data-summary-value.js.map +0 -1
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +0 -1
- package/lib-es/components/List/helpers/get-list-query.js +0 -24
- package/lib-es/components/List/helpers/get-list-query.js.map +0 -1
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js +0 -12
- package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +0 -1
- package/lib-es/components/List/helpers/strip-query-key.js +0 -6
- package/lib-es/components/List/helpers/strip-query-key.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-new-url.js +0 -8
- package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/build-url-query.js +0 -30
- package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -18
- package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +0 -1
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js +0 -19
- package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +0 -1
- package/lib-es/components/SearchFilter/searchFilterReducer.js +0 -28
- package/lib-es/components/SearchFilter/searchFilterReducer.js.map +0 -1
- package/lib-es/helpers/build-query-key.js +0 -7
- package/lib-es/helpers/build-query-key.js.map +0 -1
- package/lib-es/helpers/process-data-summary-value.js +0 -36
- package/lib-es/helpers/process-data-summary-value.js.map +0 -1
- package/src/components/Card/helpers/get-updated-items-to-display.js +0 -32
- package/src/components/List/helpers/get-list-query.js +0 -28
- package/src/components/List/helpers/get-list-specific-search-filter.js +0 -10
- package/src/components/List/helpers/strip-query-key.js +0 -6
- package/src/components/SearchFilter/helpers/build-new-url.js +0 -8
- package/src/components/SearchFilter/helpers/build-url-query.js +0 -31
- package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +0 -17
- package/src/components/SearchFilter/helpers/get-filter-values.js +0 -21
- package/src/components/SearchFilter/searchFilterReducer.js +0 -15
- package/src/helpers/build-query-key.js +0 -7
- package/src/helpers/process-data-summary-value.js +0 -22
- package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +0 -72
- package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +0 -18
- package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +0 -52
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SEARCH_TERM, TEXT_SEARCH } from '../constants';
|
|
2
|
-
import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
3
|
-
const getFilterValues = (filterData, filters, query) => {
|
|
4
|
-
const filterValues = {};
|
|
5
|
-
filterValues[SEARCH_TERM] = query[SEARCH_TERM] || '';
|
|
6
|
-
filters.forEach(filterProps => {
|
|
7
|
-
const {
|
|
8
|
-
propsToDisplay: [key],
|
|
9
|
-
type
|
|
10
|
-
} = filterProps;
|
|
11
|
-
if (type === TEXT_SEARCH) return;
|
|
12
|
-
const data = filterData && filterData[key] ? filterData[key] : {};
|
|
13
|
-
filterValues[key] = getFilterValueFromQuery(key, filterProps, data, query);
|
|
14
|
-
});
|
|
15
|
-
filterValues.dataNotSet = !filterData;
|
|
16
|
-
return filterValues;
|
|
17
|
-
};
|
|
18
|
-
export default getFilterValues;
|
|
19
|
-
//# sourceMappingURL=get-filter-values.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-filter-values.js","names":["SEARCH_TERM","TEXT_SEARCH","getFilterValueFromQuery","getFilterValues","filterData","filters","query","filterValues","forEach","filterProps","propsToDisplay","key","type","data","dataNotSet"],"sources":["../../../../src/components/SearchFilter/helpers/get-filter-values.js"],"sourcesContent":["import { SEARCH_TERM, TEXT_SEARCH } from '../constants';\nimport getFilterValueFromQuery from './get-filter-value-from-query';\n\nconst getFilterValues = (filterData, filters, query) => {\n const filterValues = {};\n filterValues[SEARCH_TERM] = query[SEARCH_TERM] || '';\n\n filters.forEach(filterProps => {\n const {\n propsToDisplay: [key],\n type\n } = filterProps;\n if (type === TEXT_SEARCH) return;\n const data = filterData && filterData[key] ? filterData[key] : {};\n filterValues[key] = getFilterValueFromQuery(key, filterProps, data, query);\n });\n filterValues.dataNotSet = !filterData;\n return filterValues;\n};\n\nexport default getFilterValues;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,WAAW,QAAQ,cAAc;AACvD,OAAOC,uBAAuB,MAAM,+BAA+B;AAEnE,MAAMC,eAAe,GAAGA,CAACC,UAAU,EAAEC,OAAO,EAAEC,KAAK,KAAK;EACtD,MAAMC,YAAY,GAAG,CAAC,CAAC;EACvBA,YAAY,CAACP,WAAW,CAAC,GAAGM,KAAK,CAACN,WAAW,CAAC,IAAI,EAAE;EAEpDK,OAAO,CAACG,OAAO,CAACC,WAAW,IAAI;IAC7B,MAAM;MACJC,cAAc,EAAE,CAACC,GAAG,CAAC;MACrBC;IACF,CAAC,GAAGH,WAAW;IACf,IAAIG,IAAI,KAAKX,WAAW,EAAE;IAC1B,MAAMY,IAAI,GAAGT,UAAU,IAAIA,UAAU,CAACO,GAAG,CAAC,GAAGP,UAAU,CAACO,GAAG,CAAC,GAAG,CAAC,CAAC;IACjEJ,YAAY,CAACI,GAAG,CAAC,GAAGT,uBAAuB,CAACS,GAAG,EAAEF,WAAW,EAAEI,IAAI,EAAEP,KAAK,CAAC;EAC5E,CAAC,CAAC;EACFC,YAAY,CAACO,UAAU,GAAG,CAACV,UAAU;EACrC,OAAOG,YAAY;AACrB,CAAC;AAED,eAAeJ,eAAe"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
-
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
|
-
const searchFilterReducer = (state, action) => {
|
|
5
|
-
const {
|
|
6
|
-
newValues,
|
|
7
|
-
type,
|
|
8
|
-
shouldSearch = true
|
|
9
|
-
} = action;
|
|
10
|
-
switch (type) {
|
|
11
|
-
case 'update':
|
|
12
|
-
return _objectSpread(_objectSpread(_objectSpread({}, state), newValues), {}, {
|
|
13
|
-
shouldSearch
|
|
14
|
-
});
|
|
15
|
-
case 'resetSearch':
|
|
16
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
17
|
-
shouldSearch: false
|
|
18
|
-
});
|
|
19
|
-
case 'reset':
|
|
20
|
-
return _objectSpread(_objectSpread({}, newValues), {}, {
|
|
21
|
-
shouldSearch: false
|
|
22
|
-
});
|
|
23
|
-
default:
|
|
24
|
-
throw new Error();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
export default searchFilterReducer;
|
|
28
|
-
//# sourceMappingURL=searchFilterReducer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchFilterReducer.js","names":["searchFilterReducer","state","action","newValues","type","shouldSearch","_objectSpread","Error"],"sources":["../../../src/components/SearchFilter/searchFilterReducer.js"],"sourcesContent":["const searchFilterReducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\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\nexport default searchFilterReducer;\n"],"mappings":";;;AAAA,MAAMA,mBAAmB,GAAGA,CAACC,KAAK,EAAEC,MAAM,KAAK;EAC7C,MAAM;IAAEC,SAAS;IAAEC,IAAI;IAAEC,YAAY,GAAG;EAAK,CAAC,GAAGH,MAAM;EACvD,QAAQE,IAAI;IACV,KAAK,QAAQ;MACX,OAAAE,aAAA,CAAAA,aAAA,CAAAA,aAAA,KAAYL,KAAK,GAAKE,SAAS;QAAEE;MAAY;IAC/C,KAAK,aAAa;MAChB,OAAAC,aAAA,CAAAA,aAAA,KAAYL,KAAK;QAAEI,YAAY,EAAE;MAAK;IACxC,KAAK,OAAO;MACV,OAAAC,aAAA,CAAAA,aAAA,KAAYH,SAAS;QAAEE,YAAY,EAAE;MAAK;IAC5C;MACE,MAAM,IAAIE,KAAK,CAAC,CAAC;EACrB;AACF,CAAC;AAED,eAAeP,mBAAmB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const buildQueryKey = (key, listName) => {
|
|
2
|
-
const listNameKey = listName ? `pb[${listName}]` : '';
|
|
3
|
-
const wrappedSearchKey = listNameKey ? `[${key}]` : key;
|
|
4
|
-
return `${listNameKey}${wrappedSearchKey}`;
|
|
5
|
-
};
|
|
6
|
-
export default buildQueryKey;
|
|
7
|
-
//# sourceMappingURL=build-query-key.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-query-key.js","names":["buildQueryKey","key","listName","listNameKey","wrappedSearchKey"],"sources":["../../src/helpers/build-query-key.js"],"sourcesContent":["const buildQueryKey = (key, listName) => {\n const listNameKey = listName ? `pb[${listName}]` : '';\n const wrappedSearchKey = listNameKey ? `[${key}]` : key;\n return `${listNameKey}${wrappedSearchKey}`;\n};\n\nexport default buildQueryKey;\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGA,CAACC,GAAG,EAAEC,QAAQ,KAAK;EACvC,MAAMC,WAAW,GAAGD,QAAQ,GAAI,MAAKA,QAAS,GAAE,GAAG,EAAE;EACrD,MAAME,gBAAgB,GAAGD,WAAW,GAAI,IAAGF,GAAI,GAAE,GAAGA,GAAG;EACvD,OAAQ,GAAEE,WAAY,GAAEC,gBAAiB,EAAC;AAC5C,CAAC;AAED,eAAeJ,aAAa"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const getUpdatedItemsToDisplay = ({
|
|
2
|
-
parentSchema,
|
|
3
|
-
parentEntityData,
|
|
4
|
-
itemsToDisplay = [],
|
|
5
|
-
inheritedFilters = []
|
|
6
|
-
}) => {
|
|
7
|
-
const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);
|
|
8
|
-
|
|
9
|
-
if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;
|
|
10
|
-
const { properties } = parentSchema;
|
|
11
|
-
const [, entityKey] = idProp.split('/');
|
|
12
|
-
if (!properties || !entityKey) return itemsToDisplay;
|
|
13
|
-
const queryValue = Object.keys(properties).find(
|
|
14
|
-
propKey =>
|
|
15
|
-
properties[propKey] &&
|
|
16
|
-
properties[propKey].relation &&
|
|
17
|
-
properties[propKey].relation.entityIdentifier === entityKey
|
|
18
|
-
);
|
|
19
|
-
const parentValues = parentEntityData[queryValue];
|
|
20
|
-
if (!parentValues) return itemsToDisplay;
|
|
21
|
-
const updatedItemsToDisplay = [...itemsToDisplay];
|
|
22
|
-
if (Array.isArray(parentValues)) {
|
|
23
|
-
parentValues.forEach(value => {
|
|
24
|
-
updatedItemsToDisplay.push({ displayItems: [value] });
|
|
25
|
-
});
|
|
26
|
-
} else {
|
|
27
|
-
updatedItemsToDisplay.push({ displayItems: [parentValues] });
|
|
28
|
-
}
|
|
29
|
-
return updatedItemsToDisplay;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default getUpdatedItemsToDisplay;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import stripQueryKey from './strip-query-key';
|
|
2
|
-
|
|
3
|
-
const getListQuery = (query, hasListSpecificFilters, name) => {
|
|
4
|
-
const updatedQuery = {};
|
|
5
|
-
const listKey = `pb[${name}]`;
|
|
6
|
-
const paginationKey = `${listKey}[page]`;
|
|
7
|
-
const sortKey = `${listKey}[sort]`;
|
|
8
|
-
const sortByKey = `${listKey}[sortby]`;
|
|
9
|
-
|
|
10
|
-
Object.keys(query).forEach(queryKey => {
|
|
11
|
-
const isListKey = queryKey.indexOf(`${listKey}`) !== -1;
|
|
12
|
-
const decodedQueryValue = Array.isArray(query[queryKey])
|
|
13
|
-
? query[queryKey].map(value => decodeURIComponent(value))
|
|
14
|
-
: decodeURIComponent(query[queryKey]);
|
|
15
|
-
if (hasListSpecificFilters) {
|
|
16
|
-
const strippedKey = stripQueryKey(queryKey, listKey, paginationKey);
|
|
17
|
-
if (isListKey) updatedQuery[strippedKey] = decodedQueryValue;
|
|
18
|
-
} else {
|
|
19
|
-
if (queryKey.indexOf('pb[') === -1) updatedQuery[queryKey] = decodedQueryValue;
|
|
20
|
-
if (queryKey.indexOf(paginationKey) !== -1) updatedQuery[queryKey] = decodedQueryValue;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
updatedQuery.sort = query[sortKey] || query.sort;
|
|
24
|
-
updatedQuery.sortby = query[sortByKey] || query.sortby;
|
|
25
|
-
return updatedQuery;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default getListQuery;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const getListSpecificSearchFilter = (searchFilters, listName) => {
|
|
2
|
-
const searchFilterMatch = searchFilters.find(
|
|
3
|
-
({ settings: { listComponentName } }) => listComponentName === listName
|
|
4
|
-
);
|
|
5
|
-
const hasListSpecificFilters = !!searchFilterMatch;
|
|
6
|
-
const searchFilterToUse = searchFilterMatch || searchFilters[0] || {};
|
|
7
|
-
return [searchFilterToUse, hasListSpecificFilters];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default getListSpecificSearchFilter;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const buildNewUrl = (url, currentUrl, queryParams, hashBit) => {
|
|
2
|
-
const encodedQuery = encodeURI(queryParams);
|
|
3
|
-
const baseUrl = url || currentUrl;
|
|
4
|
-
const newUrl = encodedQuery ? `${baseUrl}?${encodedQuery}` : `${baseUrl}`;
|
|
5
|
-
return hashBit ? `${newUrl}#${hashBit}` : newUrl;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default buildNewUrl;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SEARCH_TERM, TEXT_SEARCH } from '../constants';
|
|
2
|
-
import parseFilterValue from './parse-filter-value';
|
|
3
|
-
import { buildQueryKey } from '../../../helpers';
|
|
4
|
-
|
|
5
|
-
const buildUrlQuery = (filterValues, filters, listComponentName = '', query = {}) => {
|
|
6
|
-
const newQuery = [];
|
|
7
|
-
const queryKeys = [];
|
|
8
|
-
const searchValue = filterValues[SEARCH_TERM];
|
|
9
|
-
const searchKey = buildQueryKey(SEARCH_TERM, listComponentName);
|
|
10
|
-
queryKeys.push(searchKey);
|
|
11
|
-
if (searchValue) newQuery.push(`${searchKey}=${searchValue}`);
|
|
12
|
-
|
|
13
|
-
filters.forEach(({ propsToDisplay, type }) => {
|
|
14
|
-
if (type === TEXT_SEARCH) return;
|
|
15
|
-
propsToDisplay.forEach(prop => {
|
|
16
|
-
const value = filterValues[prop];
|
|
17
|
-
const filterKey = buildQueryKey(prop, listComponentName);
|
|
18
|
-
queryKeys.push(filterKey);
|
|
19
|
-
const parsedValue = parseFilterValue(filterKey, type, value, newQuery);
|
|
20
|
-
if (parsedValue && !newQuery.includes(parsedValue)) newQuery.push(parsedValue);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
Object.keys(query).forEach(key => {
|
|
25
|
-
if (queryKeys.indexOf(key) === -1) newQuery.push(`${key}=${query[key]}`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return newQuery.join('&');
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default buildUrlQuery;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RANGE, CHECKBOX_SELECT } from '../constants';
|
|
2
|
-
|
|
3
|
-
const getFilterRangesAndCheckboxesValues = filters => {
|
|
4
|
-
const checkboxSelectValues = [];
|
|
5
|
-
const rangeValues = [];
|
|
6
|
-
|
|
7
|
-
filters.forEach(({ type, propsToDisplay }) => {
|
|
8
|
-
if (CHECKBOX_SELECT.includes(type)) {
|
|
9
|
-
checkboxSelectValues.push(propsToDisplay[0]);
|
|
10
|
-
} else if (type === RANGE) {
|
|
11
|
-
rangeValues.push(...propsToDisplay);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return [checkboxSelectValues, rangeValues];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default getFilterRangesAndCheckboxesValues;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SEARCH_TERM, TEXT_SEARCH } from '../constants';
|
|
2
|
-
import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
3
|
-
|
|
4
|
-
const getFilterValues = (filterData, filters, query) => {
|
|
5
|
-
const filterValues = {};
|
|
6
|
-
filterValues[SEARCH_TERM] = query[SEARCH_TERM] || '';
|
|
7
|
-
|
|
8
|
-
filters.forEach(filterProps => {
|
|
9
|
-
const {
|
|
10
|
-
propsToDisplay: [key],
|
|
11
|
-
type
|
|
12
|
-
} = filterProps;
|
|
13
|
-
if (type === TEXT_SEARCH) return;
|
|
14
|
-
const data = filterData && filterData[key] ? filterData[key] : {};
|
|
15
|
-
filterValues[key] = getFilterValueFromQuery(key, filterProps, data, query);
|
|
16
|
-
});
|
|
17
|
-
filterValues.dataNotSet = !filterData;
|
|
18
|
-
return filterValues;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default getFilterValues;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const searchFilterReducer = (state, action) => {
|
|
2
|
-
const { newValues, type, shouldSearch = true } = action;
|
|
3
|
-
switch (type) {
|
|
4
|
-
case 'update':
|
|
5
|
-
return { ...state, ...newValues, shouldSearch };
|
|
6
|
-
case 'resetSearch':
|
|
7
|
-
return { ...state, shouldSearch: false };
|
|
8
|
-
case 'reset':
|
|
9
|
-
return { ...newValues, shouldSearch: false };
|
|
10
|
-
default:
|
|
11
|
-
throw new Error();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default searchFilterReducer;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import components from '../components';
|
|
3
|
-
|
|
4
|
-
const { code: Code } = components;
|
|
5
|
-
|
|
6
|
-
const renderCode = value => <Code code={value} disableWrapper />;
|
|
7
|
-
|
|
8
|
-
const processDataSummaryValue = (objPropValue, { isHtml }) => {
|
|
9
|
-
let pValue = objPropValue;
|
|
10
|
-
if (isHtml) {
|
|
11
|
-
pValue = Array.isArray(objPropValue)
|
|
12
|
-
? objPropValue.map(({ keyField, [keyField]: value, ...otherProps }) => ({
|
|
13
|
-
[keyField]: renderCode(value),
|
|
14
|
-
keyField,
|
|
15
|
-
...otherProps
|
|
16
|
-
}))
|
|
17
|
-
: renderCode(objPropValue);
|
|
18
|
-
}
|
|
19
|
-
return pValue;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default processDataSummaryValue;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
2
|
-
import getUpdatedItemsToDisplay from '../../../../../../src/components/Card/helpers/get-updated-items-to-display';
|
|
3
|
-
|
|
4
|
-
const mockedProps = {
|
|
5
|
-
itemsToDisplay: [
|
|
6
|
-
{
|
|
7
|
-
displayItems: ['54321']
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
parentEntityData: {
|
|
11
|
-
authorIds: ['12345']
|
|
12
|
-
},
|
|
13
|
-
parentSchema: {
|
|
14
|
-
properties: {
|
|
15
|
-
authorIds: {
|
|
16
|
-
relation: {
|
|
17
|
-
entityIdentifier: 'author'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
inheritedFilters: ['id/author']
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
describe('getUpdatedItemsToDisplay helper function', () => {
|
|
26
|
-
it('should return empty array if no props passed', () => {
|
|
27
|
-
const emptyArray = getUpdatedItemsToDisplay({});
|
|
28
|
-
expect(emptyArray).toEqual([]);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should return old itemsToDisplay itemsToDisplay if no idProp match, no parentSchema or no parentEntityData', () => {
|
|
32
|
-
const onlyItemsToDisplayPassed = getUpdatedItemsToDisplay({
|
|
33
|
-
itemsToDisplay: mockedProps.itemsToDisplay
|
|
34
|
-
});
|
|
35
|
-
const noIdPropMatch = getUpdatedItemsToDisplay({
|
|
36
|
-
...mockedProps,
|
|
37
|
-
inheritedFilters: ['notid/author']
|
|
38
|
-
});
|
|
39
|
-
const noParentSchema = getUpdatedItemsToDisplay({
|
|
40
|
-
...mockedProps,
|
|
41
|
-
parentSchema: null
|
|
42
|
-
});
|
|
43
|
-
const noParentEntityData = getUpdatedItemsToDisplay({
|
|
44
|
-
...mockedProps,
|
|
45
|
-
parentEntityData: null
|
|
46
|
-
});
|
|
47
|
-
expect(onlyItemsToDisplayPassed).toEqual(mockedProps.itemsToDisplay);
|
|
48
|
-
expect(noIdPropMatch).toEqual(mockedProps.itemsToDisplay);
|
|
49
|
-
expect(noParentSchema).toEqual(mockedProps.itemsToDisplay);
|
|
50
|
-
expect(noParentEntityData).toEqual(mockedProps.itemsToDisplay);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should return old itemsToDisplay if parentSchema has no propMatch with idProp entity', () => {
|
|
54
|
-
const sameItemsToDisplay = getUpdatedItemsToDisplay({
|
|
55
|
-
...mockedProps,
|
|
56
|
-
inheritedFilters: ['id/noentitymatch']
|
|
57
|
-
});
|
|
58
|
-
expect(sameItemsToDisplay).toEqual(mockedProps.itemsToDisplay);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should return updated itemsToDisplay otherwise', () => {
|
|
62
|
-
const sameItemsToDisplay = getUpdatedItemsToDisplay({
|
|
63
|
-
...mockedProps
|
|
64
|
-
});
|
|
65
|
-
expect(sameItemsToDisplay).toEqual([
|
|
66
|
-
...mockedProps.itemsToDisplay,
|
|
67
|
-
{
|
|
68
|
-
displayItems: ['12345']
|
|
69
|
-
}
|
|
70
|
-
]);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`get wrapped value with link func should return array with correponding value and link 1`] = `
|
|
4
|
-
<React.Fragment>
|
|
5
|
-
<React.Fragment>
|
|
6
|
-
test-name
|
|
7
|
-
,
|
|
8
|
-
</React.Fragment>
|
|
9
|
-
|
|
10
|
-
</React.Fragment>
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
exports[`get wrapped value with link func should return array with correponding value and link 2`] = `
|
|
14
|
-
<React.Fragment>
|
|
15
|
-
test-name2
|
|
16
|
-
|
|
17
|
-
</React.Fragment>
|
|
18
|
-
`;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import processDataSummaryValue from '../../../../src/helpers/process-data-summary-value';
|
|
6
|
-
import components from '../../../../src/components';
|
|
7
|
-
|
|
8
|
-
const { code: Code } = components;
|
|
9
|
-
|
|
10
|
-
const keyField = 'name';
|
|
11
|
-
const john = { keyField, name: 'John', age: 30 };
|
|
12
|
-
const jane = { keyField, name: 'Jane', age: 25 };
|
|
13
|
-
|
|
14
|
-
describe('processDataSummaryValue', () => {
|
|
15
|
-
test('should return the same value when isHtml is false', () => {
|
|
16
|
-
const value = 'Hello, world!';
|
|
17
|
-
const result = processDataSummaryValue(value, { isHtml: false });
|
|
18
|
-
expect(result).toBe(value);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('should render code when isHtml is true and objPropValue is a string', () => {
|
|
22
|
-
const value = 'value';
|
|
23
|
-
const result = processDataSummaryValue(value, { isHtml: true });
|
|
24
|
-
const expectedResult = <Code code={value} disableWrapper />;
|
|
25
|
-
expect(result).toEqual(expectedResult);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('should render code for each object property when isHtml is true and objPropValue is an array of objects', () => {
|
|
29
|
-
const value = [john, jane];
|
|
30
|
-
const result = processDataSummaryValue(value, { isHtml: true });
|
|
31
|
-
const expectedResult = [
|
|
32
|
-
{
|
|
33
|
-
keyField,
|
|
34
|
-
name: <Code code={john.name} disableWrapper />,
|
|
35
|
-
age: 30
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
keyField,
|
|
39
|
-
name: <Code code={jane.name} disableWrapper />,
|
|
40
|
-
age: 25
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
expect(result).toEqual(expectedResult);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('should not render code for the only property when isHtml is false and objPropValue is an object', () => {
|
|
47
|
-
const value = [john];
|
|
48
|
-
const result = processDataSummaryValue(value, { isHtml: false });
|
|
49
|
-
const expectedResult = [john];
|
|
50
|
-
expect(result).toEqual(expectedResult);
|
|
51
|
-
});
|
|
52
|
-
});
|