@usereactify/search 5.6.1 → 5.8.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 +15 -0
- package/dist/package.json +1 -1
- package/dist/src/components/Example/ExampleFilterRange.js +3 -1
- package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
- package/dist/src/components/Example/ExampleFiltersSelected.js +16 -5
- package/dist/src/components/Example/ExampleFiltersSelected.js.map +1 -1
- package/dist/src/components/Filter/Filter.js +25 -5
- package/dist/src/components/Filter/Filter.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +1 -3
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +1 -3
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +1 -3
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.d.ts +2 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +8 -3
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -1
- package/dist/src/hooks/useFilterRangeProps.d.ts +1 -1
- package/dist/src/hooks/useFilterRangeProps.js +15 -7
- package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
- package/dist/src/types/firestore.d.ts +2 -1
- package/dist/src/types/firestore.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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.8.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.7.0...release-v5.8.0) (2022-10-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* support filter option for displaying empty values ([9e66934](https://bitbucket.org/usereactify/reactify-search-ui/commit/9e66934714ef4ceb6563ce3d9be76e72453e7557))
|
|
11
|
+
|
|
12
|
+
## [5.7.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.6.1...release-v5.7.0) (2022-10-12)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add support for multiple select ranges ([7c35973](https://bitbucket.org/usereactify/reactify-search-ui/commit/7c3597332bfd68088dbd454c4f0a2dd80ce1cd95))
|
|
18
|
+
* update examples for range and selected filters ([b264aa2](https://bitbucket.org/usereactify/reactify-search-ui/commit/b264aa2af8a8bbddd76e48c22575c6b082777ec6))
|
|
19
|
+
|
|
5
20
|
### [5.6.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.6.0...release-v5.6.1) (2022-10-11)
|
|
6
21
|
|
|
7
22
|
|
package/dist/package.json
CHANGED
|
@@ -10,7 +10,9 @@ const ExampleFilterRange = (props) => {
|
|
|
10
10
|
react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
|
|
11
11
|
react_1.default.createElement("ul", { className: "rs__filter__list" }, props.filterRangeProps.options.map((option) => (react_1.default.createElement("li", { key: option.key, className: "rs__filter__list-item" },
|
|
12
12
|
react_1.default.createElement("label", { className: "rs__filter__list-item-label" },
|
|
13
|
-
react_1.default.createElement("input", { className: "rs__filter__list-item-input", value: option.key, type: "
|
|
13
|
+
react_1.default.createElement("input", { className: "rs__filter__list-item-input", value: option.key, type: "multi" === props.filterRangeProps.filter.displayType
|
|
14
|
+
? "checkbox"
|
|
15
|
+
: "radio", checked: option.checked, onChange: (event) => props.filterRangeProps.handleChange(event.target.value) }),
|
|
14
16
|
react_1.default.createElement("span", { className: "rs__filter__list-item-key" }, option.label))))))));
|
|
15
17
|
};
|
|
16
18
|
exports.ExampleFilterRange = ExampleFilterRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFilterRange.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterRange.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,sCAAI,SAAS,EAAC,kBAAkB,IAC7B,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC9C,sCAAI,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,EAAC,uBAAuB;YACpD,yCAAO,SAAS,EAAC,6BAA6B;gBAC5C,yCACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,MAAM,CAAC,GAAG,EACjB,IAAI,
|
|
1
|
+
{"version":3,"file":"ExampleFilterRange.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterRange.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,sCAAI,SAAS,EAAC,kBAAkB,IAC7B,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC9C,sCAAI,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,EAAC,uBAAuB;YACpD,yCAAO,SAAS,EAAC,6BAA6B;gBAC5C,yCACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,MAAM,CAAC,GAAG,EACjB,IAAI,EACF,OAAO,KAAK,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,WAAW;wBACnD,CAAC,CAAC,UAAU;wBACZ,CAAC,CAAC,OAAO,EAEb,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAEzD;gBACF,wCAAM,SAAS,EAAC,2BAA2B,IAAE,MAAM,CAAC,KAAK,CAAQ,CAC3D,CACL,CACN,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,kBAAkB,sBA8B7B","sourcesContent":["import React from \"react\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterRangeProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterRange\"]>\n>;\n\nexport const ExampleFilterRange: React.FC<ExampleFilterRangeProps> = (\n props\n) => {\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <ul className=\"rs__filter__list\">\n {props.filterRangeProps.options.map((option) => (\n <li key={option.key} className=\"rs__filter__list-item\">\n <label className=\"rs__filter__list-item-label\">\n <input\n className=\"rs__filter__list-item-input\"\n value={option.key}\n type={\n \"multi\" === props.filterRangeProps.filter.displayType\n ? \"checkbox\"\n : \"radio\"\n }\n checked={option.checked}\n onChange={(event) =>\n props.filterRangeProps.handleChange(event.target.value)\n }\n />\n <span className=\"rs__filter__list-item-key\">{option.label}</span>\n </label>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"]}
|
|
@@ -13,11 +13,22 @@ const ExampleFiltersSelected = (props) => {
|
|
|
13
13
|
react_1.default.createElement("span", { className: "rs__filters-selected__list-item-label" },
|
|
14
14
|
selectedFilter.label,
|
|
15
15
|
": "),
|
|
16
|
-
react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" },
|
|
17
|
-
? selectedFilter.value.join(", ")
|
|
18
|
-
: typeof selectedFilter.value !== "string"
|
|
19
|
-
? `${selectedFilter.value.start}-${selectedFilter.value.end}`
|
|
20
|
-
: selectedFilter.value))))))));
|
|
16
|
+
react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, parseFromSelectedValue(selectedFilter.value)))))))));
|
|
21
17
|
};
|
|
22
18
|
exports.ExampleFiltersSelected = ExampleFiltersSelected;
|
|
19
|
+
const parseFromSelectedValue = (value) => {
|
|
20
|
+
const labelString = typeof value === "string" ? value : false;
|
|
21
|
+
const labelObject = !Array.isArray(value) && typeof value === "object"
|
|
22
|
+
? `${value.start}-${value.end}`.replace("-0", "+")
|
|
23
|
+
: false;
|
|
24
|
+
const labelArray = Array.isArray(value) && typeof value[0] === "string"
|
|
25
|
+
? value.join(", ")
|
|
26
|
+
: false;
|
|
27
|
+
const labelArrayObject = Array.isArray(value) && typeof value[0] === "object"
|
|
28
|
+
? value
|
|
29
|
+
.map((item) => `${item.start}-${item.end}`.replace("-0", "+"))
|
|
30
|
+
.join(", ")
|
|
31
|
+
: false;
|
|
32
|
+
return labelString || labelObject || labelArray || labelArrayObject;
|
|
33
|
+
};
|
|
23
34
|
//# sourceMappingURL=ExampleFiltersSelected.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,sBAAsB;QACnC,sCAAI,SAAS,EAAC,4BAA4B,IAAE,kBAAkB,CAAM;QACpE,sCAAI,SAAS,EAAC,4BAA4B,IACvC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAC7C,sCACE,GAAG,EAAE,cAAc,CAAC,GAAG,EACvB,SAAS,EAAC,iCAAiC;YAE3C,yCACE,SAAS,EAAC,uCAAuC,EACjD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC;gBAErD,wCAAM,SAAS,EAAC,uCAAuC;oBACpD,cAAc,CAAC,KAAK;oBACpB,IAAI,CACA;gBACP,wCAAM,SAAS,EAAC,uCAAuC,IACpD,KAAK,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"ExampleFiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,sBAAsB;QACnC,sCAAI,SAAS,EAAC,4BAA4B,IAAE,kBAAkB,CAAM;QACpE,sCAAI,SAAS,EAAC,4BAA4B,IACvC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAC7C,sCACE,GAAG,EAAE,cAAc,CAAC,GAAG,EACvB,SAAS,EAAC,iCAAiC;YAE3C,yCACE,SAAS,EAAC,uCAAuC,EACjD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,CAAC;gBAErD,wCAAM,SAAS,EAAC,uCAAuC;oBACpD,cAAc,CAAC,KAAK;oBACpB,IAAI,CACA;gBACP,wCAAM,SAAS,EAAC,uCAAuC,IACpD,sBAAsB,CAAC,cAAc,CAAC,KAAK,CAAC,CACxC,CACD,CACL,CACN,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,sBAAsB,0BA6BjC;AAEF,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC5C,MAAM,WAAW,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAE9D,MAAM,WAAW,GACf,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAChD,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;QAClD,CAAC,CAAC,KAAK,CAAC;IAEZ,MAAM,UAAU,GACd,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;QAClD,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC,CAAC,KAAK,CAAC;IAEZ,MAAM,gBAAgB,GACpB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;QAClD,CAAC,CAAC,KAAK;aACF,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC7D,IAAI,CAAC,IAAI,CAAC;QACf,CAAC,CAAC,KAAK,CAAC;IAEZ,OAAO,WAAW,IAAI,WAAW,IAAI,UAAU,IAAI,gBAAgB,CAAC;AACtE,CAAC,CAAC","sourcesContent":["import React from \"react\";\n\nimport { FiltersSelectedProps } from \"../../components\";\n\nexport type ExampleFiltersSelectedProps = React.ComponentProps<\n NonNullable<FiltersSelectedProps[\"render\"]>\n>;\n\nexport const ExampleFiltersSelected: React.FC<ExampleFiltersSelectedProps> = (\n props\n) => {\n return (\n <div className=\"rs__filters-selected\">\n <h3 className=\"rs__filters-selected__name\">{\"Filters Selected\"}</h3>\n <ul className=\"rs__filters-selected__list\">\n {props.selectedFilters.map((selectedFilter) => (\n <li\n key={selectedFilter.key}\n className=\"rs__filters-selected__list-item\"\n >\n <label\n className=\"rs__filters-selected__list-item-label\"\n onClick={() => props.handleRemove(selectedFilter.key)}\n >\n <span className=\"rs__filters-selected__list-item-label\">\n {selectedFilter.label}\n {\": \"}\n </span>\n <span className=\"rs__filters-selected__list-item-value\">\n {parseFromSelectedValue(selectedFilter.value)}\n </span>\n </label>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n\nconst parseFromSelectedValue = (value: any) => {\n const labelString = typeof value === \"string\" ? value : false;\n\n const labelObject =\n !Array.isArray(value) && typeof value === \"object\"\n ? `${value.start}-${value.end}`.replace(\"-0\", \"+\")\n : false;\n\n const labelArray =\n Array.isArray(value) && typeof value[0] === \"string\"\n ? value.join(\", \")\n : false;\n\n const labelArrayObject =\n Array.isArray(value) && typeof value[0] === \"object\"\n ? value\n .map((item) => `${item.start}-${item.end}`.replace(\"-0\", \"+\"))\n .join(\", \")\n : false;\n\n return labelString || labelObject || labelArray || labelArrayObject;\n};\n"]}
|
|
@@ -20,21 +20,29 @@ const MultiList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/compo
|
|
|
20
20
|
const SingleList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/list/SingleList"));
|
|
21
21
|
const DynamicRangeSlider_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider"));
|
|
22
22
|
const SingleRange_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/SingleRange"));
|
|
23
|
+
const MultiRange_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/MultiRange"));
|
|
23
24
|
const hooks_1 = require("../../hooks");
|
|
24
25
|
const components_1 = require("../../components");
|
|
25
26
|
const Filter = (props) => {
|
|
26
27
|
if ("single" === props.filter.displayType) {
|
|
28
|
+
if ("range" === props.filter.displayView) {
|
|
29
|
+
return react_1.default.createElement(FilterRangeSingle, Object.assign({}, props));
|
|
30
|
+
}
|
|
27
31
|
return react_1.default.createElement(FilterSingleList, Object.assign({}, props));
|
|
28
32
|
}
|
|
29
33
|
if ("multi" === props.filter.displayType) {
|
|
34
|
+
if ("range" === props.filter.displayView) {
|
|
35
|
+
return react_1.default.createElement(FilterRangeMulti, Object.assign({}, props));
|
|
36
|
+
}
|
|
30
37
|
return react_1.default.createElement(FilterMultiList, Object.assign({}, props));
|
|
31
38
|
}
|
|
32
|
-
if ("range" === props.filter.displayType) {
|
|
33
|
-
return react_1.default.createElement(FilterRange, Object.assign({}, props));
|
|
34
|
-
}
|
|
35
39
|
if ("slider" === props.filter.displayType) {
|
|
36
40
|
return react_1.default.createElement(FilterSlider, Object.assign({}, props));
|
|
37
41
|
}
|
|
42
|
+
// TODO: Legacy range filter, migrate to new single and multi ranges
|
|
43
|
+
if ("range" === props.filter.displayType) {
|
|
44
|
+
return react_1.default.createElement(FilterRangeSingle, Object.assign({}, props));
|
|
45
|
+
}
|
|
38
46
|
console.log(`filter with display type "${props.filter.displayType}" not yet supported`);
|
|
39
47
|
return null;
|
|
40
48
|
};
|
|
@@ -47,7 +55,19 @@ const FilterMultiList = (props) => {
|
|
|
47
55
|
const reactiveFilterListProps = (0, hooks_1.useReactiveFilterListProps)(props.filter);
|
|
48
56
|
return (react_1.default.createElement(MultiList_1.default, Object.assign({}, reactiveFilterListProps, { render: (reactivesearchFilterProps) => (react_1.default.createElement(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
|
|
49
57
|
};
|
|
50
|
-
const
|
|
58
|
+
const FilterRangeSingle = (props) => {
|
|
59
|
+
var _a;
|
|
60
|
+
const reactiveFilterRangeProps = (0, hooks_1.useReactiveFilterRangeProps)(props.filter);
|
|
61
|
+
const filterRangeProps = (0, hooks_1.useFilterRangeProps)(props.filter);
|
|
62
|
+
const RenderRangeComponent = (_a = props.renderFilterRange) !== null && _a !== void 0 ? _a : components_1.ExampleFilterRange;
|
|
63
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
64
|
+
react_1.default.createElement("div", { style: {
|
|
65
|
+
display: "none",
|
|
66
|
+
} },
|
|
67
|
+
react_1.default.createElement(SingleRange_1.default, Object.assign({}, reactiveFilterRangeProps, { value: filterRangeProps.values[0], onChange: filterRangeProps.handleChange }))),
|
|
68
|
+
react_1.default.createElement(RenderRangeComponent, { filterRangeProps: filterRangeProps, filter: props.filter })));
|
|
69
|
+
};
|
|
70
|
+
const FilterRangeMulti = (props) => {
|
|
51
71
|
var _a;
|
|
52
72
|
const reactiveFilterRangeProps = (0, hooks_1.useReactiveFilterRangeProps)(props.filter);
|
|
53
73
|
const filterRangeProps = (0, hooks_1.useFilterRangeProps)(props.filter);
|
|
@@ -56,7 +76,7 @@ const FilterRange = (props) => {
|
|
|
56
76
|
react_1.default.createElement("div", { style: {
|
|
57
77
|
display: "none",
|
|
58
78
|
} },
|
|
59
|
-
react_1.default.createElement(
|
|
79
|
+
react_1.default.createElement(MultiRange_1.default, Object.assign({}, reactiveFilterRangeProps, { value: filterRangeProps.values, onChange: filterRangeProps.handleChange }))),
|
|
60
80
|
react_1.default.createElement(RenderRangeComponent, { filterRangeProps: filterRangeProps, filter: props.filter })));
|
|
61
81
|
};
|
|
62
82
|
const FilterSlider = (props) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,wGAAgF;AAChF,0GAAkF;AAClF,2HAAmG;AACnG,6GAAqF;AAMrF,uCAOqB;AACrB,iDAI0B;AAsBnB,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;KACxC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,E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AAiB,EACpC,MAAM,EAAE,KAAK,CAAC,MAAM,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,qFAAqF;AACrF,MAAM,eAAe,GAEjB,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,yBAAyB,KACzD,KAAK,EADyD,UAAU,UACxE,KAAK,EADD,2DAAsE,CACrE,CAAC;IAER,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAE9E,+CAA+C;IAC/C,IAAI,CAAC,KAAK,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,gBAAgB,EAAE;QACpB,MAAM,SAAS,GAAG,gBAAgB,CAAC;QACnC,OAAO,CACL,8BAAC,SAAS,kBACR,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;KACH;IAED,OAAO,CACL,8BAAC,8BAAiB,kBAChB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport MultiList from \"@appbaseio/reactivesearch/lib/components/list/MultiList\";\nimport SingleList from \"@appbaseio/reactivesearch/lib/components/list/SingleList\";\nimport DynamicRangeSlider from \"@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider\";\nimport SingleRange from \"@appbaseio/reactivesearch/lib/components/range/SingleRange\";\n\nimport type {\n ConfigFilterOption,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useReactiveFilterListProps,\n useReactiveFilterRangeProps,\n useReactiveFilterSliderProps,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterOption;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterOption;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterOption;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterOption;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n }>;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n return <FilterMultiList {...props} />;\n }\n\n if (\"range\" === props.filter.displayType) {\n return <FilterRange {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n console.log(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <SingleList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <MultiList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRange: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...reactiveFilterRangeProps}\n value={filterRangeProps.value}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n const filterSliderProps = useFilterSliderProps(props.filter);\n\n const RenderSliderComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <>\n {props.renderFilterSlider ? (\n <div\n style={{\n display: \"none\",\n }}\n >\n <DynamicRangeSlider\n {...reactiveFilterSliderProps}\n value={() => filterSliderProps.value}\n onChange={(value) =>\n filterSliderProps.handleChange({\n start: value[0],\n end: value[1],\n })\n }\n />\n </div>\n ) : null}\n <RenderSliderComponent\n filterSliderProps={filterSliderProps}\n filter={props.filter}\n />\n </>\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (0 === filterListProps.options.length) {\n return null;\n }\n\n if (renderFilterList) {\n const Component = renderFilterList;\n return (\n <Component\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n }\n\n return (\n <ExampleFilterList\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,wGAAgF;AAChF,0GAAkF;AAClF,2HAAmG;AACnG,6GAAqF;AACrF,2GAAmF;AAMnF,uCAOqB;AACrB,iDAI0B;AAsBnB,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE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BAAgB,EAAE,yBAAyB,KACzD,KAAK,EADyD,UAAU,UACxE,KAAK,EADD,2DAAsE,CACrE,CAAC;IAER,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAE9E,+CAA+C;IAC/C,IAAI,CAAC,KAAK,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,gBAAgB,EAAE;QACpB,MAAM,SAAS,GAAG,gBAAgB,CAAC;QACnC,OAAO,CACL,8BAAC,SAAS,kBACR,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;KACH;IAED,OAAO,CACL,8BAAC,8BAAiB,kBAChB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport MultiList from \"@appbaseio/reactivesearch/lib/components/list/MultiList\";\nimport SingleList from \"@appbaseio/reactivesearch/lib/components/list/SingleList\";\nimport DynamicRangeSlider from \"@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider\";\nimport SingleRange from \"@appbaseio/reactivesearch/lib/components/range/SingleRange\";\nimport MultiRange from \"@appbaseio/reactivesearch/lib/components/range/MultiRange\";\n\nimport type {\n ConfigFilterOption,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useReactiveFilterListProps,\n useReactiveFilterRangeProps,\n useReactiveFilterSliderProps,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterOption;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterOption;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterOption;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterOption;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n }>;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeSingle {...props} />;\n }\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeMulti {...props} />;\n }\n return <FilterMultiList {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n // TODO: Legacy range filter, migrate to new single and multi ranges\n if (\"range\" === props.filter.displayType) {\n return <FilterRangeSingle {...props} />;\n }\n\n console.log(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <SingleList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <MultiList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRangeSingle: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...reactiveFilterRangeProps}\n value={filterRangeProps.values[0]}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterRangeMulti: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <MultiRange\n {...reactiveFilterRangeProps}\n value={filterRangeProps.values}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n const filterSliderProps = useFilterSliderProps(props.filter);\n\n const RenderSliderComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <>\n {props.renderFilterSlider ? (\n <div\n style={{\n display: \"none\",\n }}\n >\n <DynamicRangeSlider\n {...reactiveFilterSliderProps}\n value={() => filterSliderProps.value}\n onChange={(value) =>\n filterSliderProps.handleChange({\n start: value[0],\n end: value[1],\n })\n }\n />\n </div>\n ) : null}\n <RenderSliderComponent\n filterSliderProps={filterSliderProps}\n filter={props.filter}\n />\n </>\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (0 === filterListProps.options.length) {\n return null;\n }\n\n if (renderFilterList) {\n const Component = renderFilterList;\n return (\n <Component\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n }\n\n return (\n <ExampleFilterList\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
|
|
@@ -6,17 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useReactiveFilterListProps = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const useReactiveFilterSharedProps_1 = require("./useReactiveFilterSharedProps");
|
|
9
|
-
const useReactiveReactProp_1 = require("./useReactiveReactProp");
|
|
10
9
|
/**
|
|
11
10
|
* For use with @appbaseio/reactivesearch SingleList and MultiList components
|
|
12
11
|
*/
|
|
13
12
|
const useReactiveFilterListProps = (filter) => {
|
|
14
|
-
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
|
|
15
13
|
const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
|
|
16
14
|
const reactiveFilterListProps = react_1.default.useMemo(() => {
|
|
17
15
|
var _a, _b, _c;
|
|
18
16
|
return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { size: parseInt(filter.displaySize) || undefined, showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, showLoadMore: (_b = filter.settingsShowMore) !== null && _b !== void 0 ? _b : false, showSearch: (_c = filter.settingsShowSearch) !== null && _c !== void 0 ? _c : false, showRadio: false, showCheckbox: false }));
|
|
19
|
-
}, [filter,
|
|
17
|
+
}, [filter, reactiveFilterSharedProps]);
|
|
20
18
|
return reactiveFilterListProps;
|
|
21
19
|
};
|
|
22
20
|
exports.useReactiveFilterListProps = useReactiveFilterListProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveFilterListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E
|
|
1
|
+
{"version":3,"file":"useReactiveFilterListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACvE,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,uBAAuB,GAAG,eAAK,CAAC,OAAO,CAC3C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,SAAS,EAC/C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,YAAY,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,KAAK,EAC9C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,KAAK,EAC9C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,yBAAyB,CAAC,CACpC,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AAjBW,QAAA,0BAA0B,8BAiBrC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleList and MultiList components\n */\nexport const useReactiveFilterListProps = (filter: ConfigFilterOption) => {\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterListProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n size: parseInt(filter.displaySize) || undefined,\n showFilter: filter.settingsShowFilter ?? true,\n showLoadMore: filter.settingsShowMore ?? false,\n showSearch: filter.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveFilterSharedProps]\n );\n\n return reactiveFilterListProps;\n};\n"]}
|
|
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useReactiveFilterRangeProps = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const useReactiveFilterSharedProps_1 = require("./useReactiveFilterSharedProps");
|
|
9
|
-
const useReactiveReactProp_1 = require("./useReactiveReactProp");
|
|
10
9
|
/**
|
|
11
10
|
* For use with @appbaseio/reactivesearch SingleRange and MultiRange components
|
|
12
11
|
*/
|
|
13
12
|
const useReactiveFilterRangeProps = (filter) => {
|
|
14
|
-
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
|
|
15
13
|
const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
|
|
16
14
|
const data = react_1.default.useMemo(() => {
|
|
17
15
|
var _a, _b;
|
|
@@ -27,7 +25,7 @@ const useReactiveFilterRangeProps = (filter) => {
|
|
|
27
25
|
const reactiveFilterRangeProps = react_1.default.useMemo(() => {
|
|
28
26
|
var _a;
|
|
29
27
|
return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, showRadio: false, showCheckbox: false, data: data }));
|
|
30
|
-
}, [filter,
|
|
28
|
+
}, [filter, reactiveFilterSharedProps]);
|
|
31
29
|
return reactiveFilterRangeProps;
|
|
32
30
|
};
|
|
33
31
|
exports.useReactiveFilterRangeProps = useReactiveFilterRangeProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveFilterRangeProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iFAA8E;
|
|
1
|
+
{"version":3,"file":"useReactiveFilterRangeProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iFAA8E;AAE9E;;GAEG;AACI,MAAM,2BAA2B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACxE,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAC9B,OAAO,CACL,MAAA,MAAA,MAAM,CAAC,mBAAmB,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACzC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC9C,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB;aACnD,CAAC;QACJ,CAAC,CAAC,mCAAI,EAAE,CACT,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,wBAAwB,GAAG,eAAK,CAAC,OAAO,CAC5C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,EACnB,IAAI,EAAE,IAAI,IACV,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,yBAAyB,CAAC,CACpC,CAAC;IAEF,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AA5BW,QAAA,2BAA2B,+BA4BtC","sourcesContent":["import React from \"react\";\n\nimport { ConfigFilterOption } from \"../../types\";\n\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleRange and MultiRange components\n */\nexport const useReactiveFilterRangeProps = (filter: ConfigFilterOption) => {\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const data = React.useMemo(() => {\n return (\n filter.displayRangeOptions?.map((option) => {\n const [label, start, end] = option.split(\":\");\n return {\n label: label,\n start: start ? parseInt(start) : 0,\n end: end ? parseInt(end) : Number.MAX_SAFE_INTEGER,\n };\n }) ?? []\n );\n }, []);\n\n const reactiveFilterRangeProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n data: data,\n }),\n [filter, reactiveFilterSharedProps]\n );\n\n return reactiveFilterRangeProps;\n};\n"]}
|
|
@@ -10,7 +10,7 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
|
|
|
10
10
|
* For use with all @appbaseio/reactivesearch filter components
|
|
11
11
|
*/
|
|
12
12
|
const useReactiveFilterSharedProps = (filter) => {
|
|
13
|
-
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
|
|
13
|
+
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle, filter);
|
|
14
14
|
const nestedField = react_1.default.useMemo(() => {
|
|
15
15
|
const nestedFields = ["variants"];
|
|
16
16
|
const topField = filter.field.split(".")[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/h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AAC,KAAK;QACvB,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,KAAK,EAAE,iBAAiB;KACzB,CAAC,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA3GW,QAAA,4BAA4B,gCA2GvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle, filter);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n const reactiveFilterSharedProps = React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSharedProps;\n};\n"]}
|
|
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useReactiveFilterSliderProps = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const useReactiveFilterSharedProps_1 = require("./useReactiveFilterSharedProps");
|
|
9
|
-
const useReactiveReactProp_1 = require("./useReactiveReactProp");
|
|
10
9
|
/**
|
|
11
10
|
* For use with @appbaseio/reactivesearch RangeSlider component
|
|
12
11
|
*/
|
|
13
12
|
const useReactiveFilterSliderProps = (filter) => {
|
|
14
|
-
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
|
|
15
13
|
const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
|
|
16
14
|
const rangeLabelsFn = react_1.default.useCallback((min, max) => {
|
|
17
15
|
var _a, _b, _c, _d;
|
|
@@ -23,7 +21,7 @@ const useReactiveFilterSliderProps = (filter) => {
|
|
|
23
21
|
const reactiveFilterSliderProps = react_1.default.useMemo(() => {
|
|
24
22
|
var _a, _b;
|
|
25
23
|
return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, rangeLabels: rangeLabelsFn, stepValue: (_b = parseInt(filter.displaySliderStep)) !== null && _b !== void 0 ? _b : undefined }));
|
|
26
|
-
}, [filter,
|
|
24
|
+
}, [filter, reactiveFilterSharedProps]);
|
|
27
25
|
return reactiveFilterSliderProps;
|
|
28
26
|
};
|
|
29
27
|
exports.useReactiveFilterSliderProps = useReactiveFilterSliderProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveFilterSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E
|
|
1
|
+
{"version":3,"file":"useReactiveFilterSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,aAAa,GAAG,eAAK,CAAC,WAAW,CACrC,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;;QAAC,OAAA,CAAC;YAC7B,KAAK,EAAE,GAAG,MAAA,MAAM,CAAC,mBAAmB,mCAAI,EAAE,GAAG,GAAG,GAC9C,MAAA,MAAM,CAAC,mBAAmB,mCAAI,EAChC,EAAE;YACF,GAAG,EAAE,GAAG,MAAA,MAAM,CAAC,mBAAmB,mCAAI,EAAE,GAAG,GAAG,GAC5C,MAAA,MAAM,CAAC,mBAAmB,mCAAI,EAChC,EAAE;SACH,CAAC,CAAA;KAAA,EACF,EAAE,CACH,CAAC;IAEF,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,WAAW,EAAE,aAAa,EAC1B,SAAS,EAAE,MAAA,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,mCAAI,SAAS,IAC1D,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,yBAAyB,CAAC,CACpC,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA1BW,QAAA,4BAA4B,gCA0BvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\n/**\n * For use with @appbaseio/reactivesearch RangeSlider component\n */\nexport const useReactiveFilterSliderProps = (filter: ConfigFilterOption) => {\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const rangeLabelsFn = React.useCallback(\n (min: number, max: number) => ({\n start: `${filter.displaySliderPrefix ?? \"\"}${min}${\n filter.displaySliderSuffix ?? \"\"\n }`,\n end: `${filter.displaySliderPrefix ?? \"\"}${max}${\n filter.displaySliderSuffix ?? \"\"\n }`,\n }),\n []\n );\n\n const reactiveFilterSliderProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n rangeLabels: rangeLabelsFn,\n stepValue: parseInt(filter.displaySliderStep) ?? undefined,\n }),\n [filter, reactiveFilterSharedProps]\n );\n\n return reactiveFilterSliderProps;\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ConfigFilterOption } from "../../types";
|
|
2
|
+
export declare const useReactiveReactProp: (currentHandle?: string | undefined, filter?: ConfigFilterOption | undefined) => {
|
|
2
3
|
and: string[];
|
|
3
4
|
};
|
|
@@ -7,20 +7,25 @@ exports.useReactiveReactProp = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
|
-
const useReactiveReactProp = (currentHandle) => {
|
|
10
|
+
const useReactiveReactProp = (currentHandle, filter) => {
|
|
11
11
|
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
12
12
|
const { filterStack } = (0, hooks_1.useFilters)();
|
|
13
|
-
|
|
13
|
+
const reactProp = react_1.default.useMemo(() => {
|
|
14
14
|
var _a, _b;
|
|
15
|
+
if (filter && filter.settingsShowEmptyValues) {
|
|
16
|
+
return {
|
|
17
|
+
and: components_1.SENSOR_IDS,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
15
20
|
return {
|
|
16
21
|
and: [
|
|
17
|
-
"SearchInput",
|
|
18
22
|
...components_1.SENSOR_IDS,
|
|
19
23
|
...((_a = options.additionalComponentIds) !== null && _a !== void 0 ? _a : []),
|
|
20
24
|
...((_b = filterStack === null || filterStack === void 0 ? void 0 : filterStack.options.map((filter) => filter.handle)) !== null && _b !== void 0 ? _b : []),
|
|
21
25
|
].filter((handle) => handle !== currentHandle),
|
|
22
26
|
};
|
|
23
27
|
}, [filterStack, currentHandle, options.additionalComponentIds]);
|
|
28
|
+
return reactProp;
|
|
24
29
|
};
|
|
25
30
|
exports.useReactiveReactProp = useReactiveReactProp;
|
|
26
31
|
//# sourceMappingURL=useReactiveReactProp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveReactProp.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactProp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAmE;AACnE,iDAA8C;
|
|
1
|
+
{"version":3,"file":"useReactiveReactProp.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactProp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAmE;AACnE,iDAA8C;AAGvC,MAAM,oBAAoB,GAAG,CAClC,aAAsB,EACtB,MAA2B,EAC3B,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC/C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IAErC,MAAM,SAAS,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QACnC,IAAI,MAAM,IAAI,MAAM,CAAC,uBAAuB,EAAE;YAC5C,OAAO;gBACL,GAAG,EAAE,uBAAU;aAChB,CAAC;SACH;QAED,OAAO;YACL,GAAG,EAAE;gBACH,GAAG,uBAAU;gBACb,GAAG,CAAC,MAAA,OAAO,CAAC,sBAAsB,mCAAI,EAAE,CAAC;gBACzC,GAAG,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;aAC/D,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,CAAC;SAC/C,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAEjE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAxBW,QAAA,oBAAoB,wBAwB/B","sourcesContent":["import React from \"react\";\n\nimport { useReactifySearchContext, useFilters } from \"../../hooks\";\nimport { SENSOR_IDS } from \"../../components\";\nimport { ConfigFilterOption } from \"../../types\";\n\nexport const useReactiveReactProp = (\n currentHandle?: string,\n filter?: ConfigFilterOption\n) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilters();\n\n const reactProp = React.useMemo(() => {\n if (filter && filter.settingsShowEmptyValues) {\n return {\n and: SENSOR_IDS,\n };\n }\n\n return {\n and: [\n ...SENSOR_IDS,\n ...(options.additionalComponentIds ?? []),\n ...(filterStack?.options.map((filter) => filter.handle) ?? []),\n ].filter((handle) => handle !== currentHandle),\n };\n }, [filterStack, currentHandle, options.additionalComponentIds]);\n\n return reactProp;\n};\n"]}
|
|
@@ -9,7 +9,7 @@ const hooks_1 = require("../hooks");
|
|
|
9
9
|
const utility_1 = require("../utility");
|
|
10
10
|
const useFilterRangeProps = (filter) => {
|
|
11
11
|
const { track } = (0, hooks_1.useAnalytics)();
|
|
12
|
-
const [
|
|
12
|
+
const [filterValues, setFilterValues] = react_1.default.useState([]);
|
|
13
13
|
const handleChange = react_1.default.useCallback((key) => {
|
|
14
14
|
utility_1.debug.breadcrumb({
|
|
15
15
|
category: "filter",
|
|
@@ -20,8 +20,16 @@ const useFilterRangeProps = (filter) => {
|
|
|
20
20
|
value: key,
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
|
-
utility_1.debug.log("
|
|
24
|
-
|
|
23
|
+
utility_1.debug.log("useFilterRangeMultiProps", "handleChange[key]", key);
|
|
24
|
+
if (filter.displayType === "multi") {
|
|
25
|
+
const selected = filterValues.find((item) => item === key)
|
|
26
|
+
? filterValues.filter((value) => value !== key)
|
|
27
|
+
: [...filterValues, key];
|
|
28
|
+
setFilterValues(selected);
|
|
29
|
+
}
|
|
30
|
+
if (filter.displayType === "single") {
|
|
31
|
+
setFilterValues([key]);
|
|
32
|
+
}
|
|
25
33
|
track({
|
|
26
34
|
eventName: "filterChange",
|
|
27
35
|
payload: {
|
|
@@ -29,7 +37,7 @@ const useFilterRangeProps = (filter) => {
|
|
|
29
37
|
value: key,
|
|
30
38
|
},
|
|
31
39
|
});
|
|
32
|
-
}, [filter]);
|
|
40
|
+
}, [filter, filterValues]);
|
|
33
41
|
const filterRangeProps = react_1.default.useMemo(() => {
|
|
34
42
|
var _a, _b;
|
|
35
43
|
const options = (_b = (_a = filter.displayRangeOptions) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
@@ -37,16 +45,16 @@ const useFilterRangeProps = (filter) => {
|
|
|
37
45
|
return {
|
|
38
46
|
key: key,
|
|
39
47
|
label: filter.settingsUppercase ? key.toUpperCase() : key,
|
|
40
|
-
checked:
|
|
48
|
+
checked: filterValues.includes(key),
|
|
41
49
|
};
|
|
42
50
|
})) !== null && _b !== void 0 ? _b : [];
|
|
43
51
|
return {
|
|
44
52
|
handleChange,
|
|
45
53
|
filter,
|
|
46
|
-
|
|
54
|
+
values: filterValues,
|
|
47
55
|
options,
|
|
48
56
|
};
|
|
49
|
-
}, [filter,
|
|
57
|
+
}, [filter, filterValues, handleChange]);
|
|
50
58
|
return filterRangeProps;
|
|
51
59
|
};
|
|
52
60
|
exports.useFilterRangeProps = useFilterRangeProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilterRangeProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,oCAAwC;AACxC,wCAAmC;AAE5B,MAAM,mBAAmB,GAAG,CACjC,MAA0B,EAU1B,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"useFilterRangeProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,oCAAwC;AACxC,wCAAmC;AAE5B,MAAM,mBAAmB,GAAG,CACjC,MAA0B,EAU1B,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAW,EAAE,CAAC,CAAC;IAErE,MAAM,YAAY,GAAG,eAAK,CAAC,WAAW,CACpC,CAAC,GAAW,EAAE,EAAE;QACd,eAAK,CAAC,UAAU,CAAC;YACf,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,uBAAuB;YAChC,IAAI,EAAE;gBACJ,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,KAAK,EAAE,GAAG;aACX;SACF,CAAC,CAAC;QAEH,eAAK,CAAC,GAAG,CAAC,0BAA0B,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAC;QAEhE,IAAI,MAAM,CAAC,WAAW,KAAK,OAA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AAE,YAAY,CAAC,CAAC,CAAC;IAEzC,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAvEW,QAAA,mBAAmB,uBAuE9B","sourcesContent":["import React from \"react\";\n\nimport { ConfigFilterOption } from \"../types/config\";\nimport { useAnalytics } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport const useFilterRangeProps = (\n filter: ConfigFilterOption\n): {\n filter: ConfigFilterOption;\n options: Array<{\n key: string;\n label: string;\n checked: boolean;\n }>;\n values: string[];\n handleChange: (key: string) => void;\n} => {\n const { track } = useAnalytics();\n const [filterValues, setFilterValues] = React.useState<string[]>([]);\n\n const handleChange = React.useCallback(\n (key: string) => {\n debug.breadcrumb({\n category: \"filter\",\n message: \"filter option changed\",\n data: {\n filter: filter.name,\n field: filter.field,\n value: key,\n },\n });\n\n debug.log(\"useFilterRangeMultiProps\", \"handleChange[key]\", key);\n\n if (filter.displayType === \"multi\") {\n const selected = filterValues.find((item: string) => item === key)\n ? filterValues.filter((value) => value !== key)\n : [...filterValues, key];\n\n setFilterValues(selected);\n }\n if (filter.displayType === \"single\") {\n setFilterValues([key]);\n }\n\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: key,\n },\n });\n },\n [filter, filterValues]\n );\n\n const filterRangeProps = React.useMemo(() => {\n const options =\n filter.displayRangeOptions?.map((option) => {\n const [key] = option.split(\":\");\n return {\n key: key,\n label: filter.settingsUppercase ? key.toUpperCase() : key,\n checked: filterValues.includes(key),\n };\n }) ?? [];\n\n return {\n handleChange,\n filter,\n values: filterValues,\n options,\n };\n }, [filter, filterValues, handleChange]);\n\n return filterRangeProps;\n};\n"]}
|
|
@@ -135,7 +135,7 @@ export interface FilterOption {
|
|
|
135
135
|
displaySliderSuffix?: string;
|
|
136
136
|
displayRangeOptions?: Array<string>;
|
|
137
137
|
displayType: "multi" | "single" | "range" | "slider";
|
|
138
|
-
displayView: "list" | "check" | "swatch" | "box";
|
|
138
|
+
displayView: "list" | "check" | "swatch" | "range" | "box";
|
|
139
139
|
enabled: boolean;
|
|
140
140
|
field: string;
|
|
141
141
|
id: string;
|
|
@@ -147,6 +147,7 @@ export interface FilterOption {
|
|
|
147
147
|
settingsShowFilter: boolean;
|
|
148
148
|
settingsShowMore: boolean;
|
|
149
149
|
settingsShowSearch: boolean;
|
|
150
|
+
settingsShowEmptyValues: boolean;
|
|
150
151
|
settingsUppercase: boolean;
|
|
151
152
|
settingsHideUnavailable: boolean;
|
|
152
153
|
valuesExclude: Array<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../../src/types/firestore.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"firestore.js","sourceRoot":"","sources":["../../../src/types/firestore.ts"],"names":[],"mappings":";;;AAmOA,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,2CAAyB,CAAA;IACzB,yCAAuB,CAAA;IACvB,+CAA6B,CAAA;IAC7B,yCAAuB,CAAA;IACvB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;AACrB,CAAC,EARW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAQzB;AAyBD,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,8BAAmB,CAAA;AACrB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB","sourcesContent":["// @todo this is so we don't need to import firebase\ntype Timestamp = string;\n\nimport { ShopifyProduct } from \"./shopify\";\nimport { ElasticDataType } from \"./elastic\";\n\nexport interface Log {\n id: string;\n keywords: string[];\n message: string;\n platform: \"reactify\" | \"shopify\" | \"elastic\";\n percentCompleted: number;\n action?: {\n type: \"retry\";\n label: string;\n task: Task[\"taskId\"];\n };\n step:\n | \"download\"\n | \"transform\"\n | \"merge\"\n | \"upload\"\n | \"cleanup\"\n | \"complete\"\n | \"sync\";\n title: string;\n type: \"bulk\";\n data?: string; // JSON sringified data\n progress: \"new\" | \"error\" | \"complete\" | \"partiallyComplete\";\n status: \"success\" | \"info\" | \"warning\" | \"critical\"; // polaris banner status\n createdAt: Timestamp;\n updatedAt?: Timestamp;\n finishedAt?: Timestamp;\n}\n\nexport interface Task {\n logId: string;\n taskId:\n | \"download\"\n | \"transform\"\n | \"merge\"\n | \"upload\"\n | \"cleanup\"\n | \"refreshDefinedFields\"\n | \"install\";\n firstRun: boolean;\n createdAt: Timestamp;\n updatedAt?: Timestamp;\n}\n\nexport interface TaskDownload extends Task {\n taskId: \"download\";\n type: \"collection\" | \"product\";\n productUrl?: string;\n collectionUrl?: string;\n}\n\nexport interface TaskTransform extends Task {\n taskId: \"transform\";\n productUrl: string;\n collectionUrl: string;\n}\n\nexport interface TaskMerge extends Task {\n taskId: \"merge\";\n productCount: number;\n collectionCount: number;\n startAfterId?: string;\n}\n\nexport interface TaskUpload extends Task {\n taskId: \"upload\";\n productCount: number;\n collectionCount: number;\n startAfterId?: string;\n}\n\nexport interface TaskCleanup extends Task {\n taskId: \"cleanup\";\n}\n\nexport interface TaskRefreshDefinedFields extends Task {\n taskId: \"refreshDefinedFields\";\n}\n\nexport interface TaskInstall extends Task {\n taskId: \"install\";\n}\n\nexport interface Lock {\n logId: string;\n taskType: \"sync\";\n createdAt: Timestamp;\n}\n\nexport interface SettingsInstance {\n index: string;\n cloudId: string;\n endpoint: string;\n password: string;\n username: string;\n syncFrequency: string;\n syncThreshold: number;\n provider: \"elastic\" | \"aws\";\n storefrontAccessToken: string;\n customMappings: string; // JSON sringified data\n}\n\nexport interface SettingsProduct {\n tagChild?: string;\n tagKeys?: string[];\n tagParent?: string;\n syncObjects: string[];\n tagExclude?: string[];\n tagSeparator?: string;\n metafieldWhitelist?: string[];\n}\n\nexport interface SettingsCurations {\n moreInfo?: boolean;\n pageSize?: number;\n gridColumns?: number;\n}\n\nexport interface Field {\n id: string;\n field: string;\n enabled: boolean;\n importance: number;\n searchType: \"always_search\" | \"search_page\" | \"instant_search\";\n}\n\nexport interface DefinedField {\n label: string;\n value: string;\n type: ElasticDataType;\n}\n\nexport interface Sort {\n id: string;\n name: string;\n handle: string;\n field: string;\n position: number;\n enabled: boolean;\n direction: \"desc\" | \"asc\";\n visibility: \"all\" | \"search\" | \"collection\";\n}\n\nexport interface Filter {\n id: string;\n name: string;\n handle: string;\n enabled: boolean;\n pageSize: number;\n keywords: string[];\n defaultSort: string;\n collections: string[];\n type: \"search\" | \"collection\";\n paginationType: \"pagination\" | \"load_more\" | \"next_prev\" | \"infinite_scroll\";\n inventoryVisibility:\n | \"show_all\"\n | \"hide_products\"\n | \"hide_variants\"\n | \"hide_all\";\n}\n\nexport interface FilterOption {\n displaySize: string;\n displaySliderInterval: string;\n displaySliderStep: string;\n displaySliderPrefix?: string;\n displaySliderSuffix?: string;\n displayRangeOptions?: Array<string>; // formatted like \"<label>:<start>:<end>\"\n displayType: \"multi\" | \"single\" | \"range\" | \"slider\";\n displayView: \"list\" | \"check\" | \"swatch\" | \"range\" | \"box\";\n enabled: boolean;\n field: string;\n id: string;\n name: string;\n handle: string;\n position: number;\n settingsCollapsedDesktop: boolean;\n settingsCollapsedMobile: boolean;\n settingsShowFilter: boolean;\n settingsShowMore: boolean;\n settingsShowSearch: boolean;\n settingsShowEmptyValues: boolean;\n settingsUppercase: boolean;\n settingsHideUnavailable: boolean;\n valuesExclude: Array<string>;\n valuesManual: Array<string>;\n valuesShow: \"all\" | \"manual\";\n}\n\nexport interface Redirect {\n id: string;\n url: string;\n query: string;\n enabled: boolean;\n keywords: string[];\n}\n\nexport interface Curation {\n id: string;\n title: string;\n status: CurationStatus;\n published: boolean;\n keywords: string[];\n searchTerm?: string;\n longRunningTask?: boolean;\n collectionHandle?: string;\n type: \"collection\" | \"search\";\n boosting?: {\n groupings?: BoostGrouping[];\n sortings?: BoostSorting[];\n };\n sort?: CurationSort;\n}\n\nexport interface CurationSort {\n sortTag?: string;\n sortOption: string;\n sortDirection: \"asc\" | \"desc\";\n sortVariantOption?: \"option1\" | \"option2\" | \"option3\";\n}\n\nexport enum CurationStatus {\n Draft = \"draft\",\n Publishing = \"publishing\",\n Published = \"published\",\n Unpublishing = \"unpublishing\",\n Resetting = \"resetting\",\n Pinning = \"pinning\",\n Sorting = \"sorting\",\n}\n\nexport interface CurationHiding {\n productId: number;\n productHandle: string;\n}\n\nexport interface BoostGrouping {\n key: string;\n value: string;\n field: string;\n position: number;\n operation: string;\n}\n\nexport interface BoostSorting {\n key: string;\n field: string;\n query?: string;\n position: number;\n direction: \"asc\" | \"desc\";\n}\n\nexport type Pin = PinProduct | PinCallout;\n\nexport enum PinType {\n Product = \"product\",\n Callout = \"callout\",\n}\n\nexport interface PinProduct {\n key: string;\n type: PinType.Product;\n position: number;\n productId: number;\n productHandle: string;\n}\n\nexport interface PinCallout {\n key: string;\n type: PinType.Callout;\n position: number;\n calloutId: string;\n}\n\nexport interface Callout {\n id: string;\n link: string;\n title: string;\n content: string;\n enabled: boolean;\n textColor: string;\n keywords: string[];\n mobileImage: string;\n mobileVideo: string;\n desktopVideo: string;\n desktopImage: string;\n backgroundColor: string;\n visibility: \"desktop\" | \"mobile\" | \"all\";\n displayColumns: string; // @todo this should be a number\n displayRows: string; // @todo this should be a number\n selectedDates?: {\n end: Timestamp;\n start: Timestamp;\n };\n}\n\nexport interface Synonym {\n id: string;\n name: string;\n enabled: boolean;\n keywords: string[];\n synonyms: string[];\n type: \"group\" | \"oneway\";\n}\n\nexport interface MergedValue {\n id: string;\n name: string;\n field: string;\n keywords: string[];\n values: string[];\n}\n\nexport interface Collection {\n title: string;\n handle: string;\n shopifyId: string;\n productIds: string[];\n storefrontId: string;\n legacyResourceId: number;\n}\n\n// product is the shopify product with edges and nodes normalised\nexport type Product = Omit<\n ShopifyProduct,\n \"variants\" | \"images\" | \"media\" | \"metafields\"\n> & {\n variants: (Omit<\n ShopifyProduct[\"variants\"][\"edges\"][0][\"node\"],\n \"presentmentPrices\"\n > & {\n images?: ShopifyProduct[\"images\"][\"edges\"][0][\"node\"][]; // from child product if this variant is from a child\n presentmentPrices: ShopifyProduct[\"variants\"][\"edges\"][0][\"node\"][\"presentmentPrices\"][\"edges\"][0][\"node\"][];\n })[];\n images: ShopifyProduct[\"images\"][\"edges\"][0][\"node\"][];\n media: ShopifyProduct[\"media\"][\"edges\"][0][\"node\"][];\n metafields: ShopifyProduct[\"metafields\"][\"edges\"][0][\"node\"][];\n};\n"]}
|