@usereactify/search 5.40.0 → 5.41.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
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.41.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.40.0...release-v5.41.0) (2023-12-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* allow rendering ClearAll content even if no filters selected with showWhenEmpty prop ([913f812](https://bitbucket.org/usereactify/reactify-search-ui/commit/913f812b11b91fdf8892271467391c068944f107))
|
|
11
|
+
|
|
5
12
|
## [5.40.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.39.0...release-v5.40.0) (2023-12-07)
|
|
6
13
|
|
|
7
14
|
|
package/dist/package.json
CHANGED
|
@@ -47,7 +47,7 @@ const ClearAll = (props) => {
|
|
|
47
47
|
}
|
|
48
48
|
renderProps.clearValues();
|
|
49
49
|
};
|
|
50
|
-
if (!selectedFilters.length) {
|
|
50
|
+
if (props.showWhenEmpty !== true && !selectedFilters.length) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
return react_1.default.createElement(RenderComponent, { clearAll: handleClearAll });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qHAA6F;AAE7F,iDAAmD;AACnD,uCAAyC;
|
|
1
|
+
{"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qHAA6F;AAE7F,iDAAmD;AACnD,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,EAAE;wBAClC,IAAI,MAAM,CAAC,WAAW,KAAK,OAAO,EAAE;4BAClC,MAAM,KAAK,GAAG,IAAI,WAAW,CAG1B,8BAA8B,MAAM,CAAC,MAAM,SAAS,EAAE;gCACvD,MAAM,EAAE;oCACN,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,KAAK,EAAE,EAAE;iCACV;6BACF,CAAC,CAAC;4BACH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;yBAC7B;qBACF;iBACF;gBACD,WAAW,CAAC,WAAW,EAAE,CAAC;YAC5B,CAAC,CAAC;YAEF,IAAI,KAAK,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3D,OAAO,IAAI,CAAC;aACb;YAED,OAAO,8BAAC,eAAe,IAAC,QAAQ,EAAE,cAAc,GAAI,CAAC;QACvD,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,QAAQ,YAyDnB","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@appbaseio/reactivesearch/lib/components/basic/SelectedFilters\";\n\nimport { ExampleClearAll } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type ClearAllProps = {\n /** Render method */\n render?: React.FC<{\n clearAll: () => void;\n }>;\n /** Render the component even when there are no filters selected (default: false) */\n showWhenEmpty?: boolean;\n};\n\nexport const ClearAll: React.FC<ClearAllProps> = (props) => {\n const RenderComponent = props.render ?? ExampleClearAll;\n\n const filtersHook = useFilters();\n\n return (\n <SelectedFilters\n render={(renderProps) => {\n const selectedFilters = Object.values(renderProps.selectedValues)\n .map((value) => value)\n .filter(\n (item: any) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n );\n\n const handleClearAll = () => {\n for (const filter of filtersHook.filters ?? []) {\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n }\n }\n renderProps.clearValues();\n };\n\n if (props.showWhenEmpty !== true && !selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent clearAll={handleClearAll} />;\n }}\n />\n );\n};\n"]}
|