@usereactify/search 5.47.1 → 5.48.0-beta.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 +14 -0
- package/dist/package.json +1 -1
- package/dist/src/components/Filter/Filter.js +45 -10
- package/dist/src/components/Filter/Filter.js.map +1 -1
- package/dist/src/components/Result/Results.d.ts +0 -2
- package/dist/src/components/Result/Results.js +9 -21
- package/dist/src/components/Result/Results.js.map +1 -1
- package/dist/src/components/Sensor/SensorCollection.js +8 -80
- package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
- package/dist/src/components/Sensor/SensorCustom.js +6 -2
- package/dist/src/components/Sensor/SensorCustom.js.map +1 -1
- package/dist/src/components/Sensor/SensorInventoryAvailable.js +8 -44
- package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
- package/dist/src/components/Sensor/SensorPublished.js +7 -27
- package/dist/src/components/Sensor/SensorPublished.js.map +1 -1
- package/dist/src/components/Sensor/SensorSort.js +10 -203
- package/dist/src/components/Sensor/SensorSort.js.map +1 -1
- package/dist/src/hooks/reactivesearch/index.d.ts +0 -6
- package/dist/src/hooks/reactivesearch/index.js +0 -6
- package/dist/src/hooks/reactivesearch/index.js.map +1 -1
- package/dist/src/hooks/usePagination.js +1 -1
- package/dist/src/hooks/usePagination.js.map +1 -1
- package/dist/src/hooks/useSortBy.js +14 -17
- package/dist/src/hooks/useSortBy.js.map +1 -1
- package/dist/src/utility/curation.d.ts +7 -0
- package/dist/src/utility/curation.js +85 -0
- package/dist/src/utility/curation.js.map +1 -0
- package/dist/src/utility/filters.d.ts +6 -0
- package/dist/src/utility/filters.js +36 -0
- package/dist/src/utility/filters.js.map +1 -0
- package/dist/src/utility/props.d.ts +143 -10
- package/dist/src/utility/props.js +241 -25
- package/dist/src/utility/props.js.map +1 -1
- package/dist/src/utility/server.js +1 -1
- package/dist/src/utility/server.js.map +1 -1
- package/dist/src/utility/sortOption.d.ts +22 -0
- package/dist/src/utility/sortOption.js +198 -0
- package/dist/src/utility/sortOption.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.d.ts +0 -84
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +0 -21
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.d.ts +0 -86
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +0 -32
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.d.ts +0 -77
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +0 -124
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.d.ts +0 -83
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +0 -28
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.d.ts +0 -4
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +0 -32
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.d.ts +0 -6
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js +0 -38
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js.map +0 -1
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useReactiveFilterSharedProps = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const useReactiveReactProp_1 = require("./useReactiveReactProp");
|
|
9
|
-
/**
|
|
10
|
-
* For use with all @appbaseio/reactivesearch filter components
|
|
11
|
-
*/
|
|
12
|
-
const useReactiveFilterSharedProps = (filter) => {
|
|
13
|
-
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle, filter);
|
|
14
|
-
const nestedField = react_1.default.useMemo(() => {
|
|
15
|
-
const nestedFields = ["variants"];
|
|
16
|
-
const topField = filter.field.split(".")[0];
|
|
17
|
-
if (nestedFields.includes(topField))
|
|
18
|
-
return topField;
|
|
19
|
-
return undefined;
|
|
20
|
-
}, [filter]);
|
|
21
|
-
// define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants
|
|
22
|
-
// customQuery defines how this filter affects *other* components like the results component
|
|
23
|
-
const customQuery = react_1.default.useMemo(() => {
|
|
24
|
-
if (!filter.settingsHideUnavailable ||
|
|
25
|
-
!filter.field.startsWith("variants."))
|
|
26
|
-
return undefined;
|
|
27
|
-
return (value) => {
|
|
28
|
-
if (!value)
|
|
29
|
-
return {};
|
|
30
|
-
// reactivesearch sometimes returns string, sometimes string[]
|
|
31
|
-
const valueArray = "string" === typeof value ? [value] : value;
|
|
32
|
-
if (0 === valueArray.length)
|
|
33
|
-
return {};
|
|
34
|
-
return {
|
|
35
|
-
query: {
|
|
36
|
-
nested: {
|
|
37
|
-
path: "variants",
|
|
38
|
-
query: {
|
|
39
|
-
bool: {
|
|
40
|
-
must: [
|
|
41
|
-
{
|
|
42
|
-
match: {
|
|
43
|
-
"variants.available": "true",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
terms: {
|
|
48
|
-
[filter.field]: valueArray,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
}, [filter]);
|
|
59
|
-
// define a default query for when settingsHideUnavailable is enabled and the target field is inside variants
|
|
60
|
-
// defaultQuery defines how this filter affects itself i.e. the options displayed
|
|
61
|
-
const defaultQuery = react_1.default.useMemo(() => {
|
|
62
|
-
if (!filter.field.startsWith("variants.")) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
// override the aggregation query to filter the results by the variants.available attribute
|
|
66
|
-
return () => {
|
|
67
|
-
return {
|
|
68
|
-
aggs: {
|
|
69
|
-
reactivesearch_nested: {
|
|
70
|
-
nested: { path: "variants" },
|
|
71
|
-
aggs: {
|
|
72
|
-
reactify_nested_outer: {
|
|
73
|
-
filter: {
|
|
74
|
-
bool: {
|
|
75
|
-
minimum_should_match: 1,
|
|
76
|
-
should: [
|
|
77
|
-
{
|
|
78
|
-
match: {
|
|
79
|
-
"variants.available": "true",
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
match: {
|
|
84
|
-
"variants.available": filter.settingsHideUnavailable
|
|
85
|
-
? "true"
|
|
86
|
-
: "false",
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
aggs: {
|
|
93
|
-
[filter.field]: {
|
|
94
|
-
terms: {
|
|
95
|
-
field: filter.field,
|
|
96
|
-
size: 100,
|
|
97
|
-
order: { _count: "desc" },
|
|
98
|
-
},
|
|
99
|
-
aggs: {
|
|
100
|
-
parent_docs: { reverse_nested: {} },
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
}, [filter]);
|
|
111
|
-
const reactiveFilterSharedProps = react_1.default.useMemo(() => ({
|
|
112
|
-
nestedField,
|
|
113
|
-
customQuery,
|
|
114
|
-
defaultQuery,
|
|
115
|
-
URLParams: true,
|
|
116
|
-
componentId: filter.handle,
|
|
117
|
-
dataField: filter.field,
|
|
118
|
-
filterLabel: filter.name,
|
|
119
|
-
react: reactiveReactProp,
|
|
120
|
-
}), [filter, reactiveReactProp]);
|
|
121
|
-
return reactiveFilterSharedProps;
|
|
122
|
-
};
|
|
123
|
-
exports.useReactiveFilterSharedProps = useReactiveFilterSharedProps;
|
|
124
|
-
//# sourceMappingURL=useReactiveFilterSharedProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":"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","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 (!filter.field.startsWith(\"variants.\")) {\n return undefined;\n }\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 bool: {\n minimum_should_match: 1,\n should: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n match: {\n \"variants.available\": filter.settingsHideUnavailable\n ? \"true\"\n : \"false\",\n },\n },\n ],\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n aggs: {\n parent_docs: { reverse_nested: {} },\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"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { ConfigFilterOption } from "../../types/config";
|
|
2
|
-
/**
|
|
3
|
-
* For use with @appbaseio/reactivesearch RangeSlider component
|
|
4
|
-
*/
|
|
5
|
-
export declare const useReactiveFilterSliderProps: (filter: ConfigFilterOption) => {
|
|
6
|
-
showFilter: boolean;
|
|
7
|
-
rangeLabels: (min: number, max: number) => {
|
|
8
|
-
start: string;
|
|
9
|
-
end: string;
|
|
10
|
-
};
|
|
11
|
-
stepValue: number;
|
|
12
|
-
nestedField: string | undefined;
|
|
13
|
-
customQuery: ((value?: string | string[] | undefined) => {
|
|
14
|
-
query?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
query: {
|
|
17
|
-
nested: {
|
|
18
|
-
path: string;
|
|
19
|
-
query: {
|
|
20
|
-
bool: {
|
|
21
|
-
must: ({
|
|
22
|
-
match: {
|
|
23
|
-
"variants.available": string;
|
|
24
|
-
};
|
|
25
|
-
terms?: undefined;
|
|
26
|
-
} | {
|
|
27
|
-
terms: {
|
|
28
|
-
[x: string]: string[];
|
|
29
|
-
};
|
|
30
|
-
match?: undefined;
|
|
31
|
-
})[];
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
}) | undefined;
|
|
37
|
-
defaultQuery: (() => {
|
|
38
|
-
aggs: {
|
|
39
|
-
reactivesearch_nested: {
|
|
40
|
-
nested: {
|
|
41
|
-
path: string;
|
|
42
|
-
};
|
|
43
|
-
aggs: {
|
|
44
|
-
reactify_nested_outer: {
|
|
45
|
-
filter: {
|
|
46
|
-
bool: {
|
|
47
|
-
minimum_should_match: number;
|
|
48
|
-
should: {
|
|
49
|
-
match: {
|
|
50
|
-
"variants.available": string;
|
|
51
|
-
};
|
|
52
|
-
}[];
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
aggs: {
|
|
56
|
-
[x: string]: {
|
|
57
|
-
terms: {
|
|
58
|
-
field: string;
|
|
59
|
-
size: number;
|
|
60
|
-
order: {
|
|
61
|
-
_count: string;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
aggs: {
|
|
65
|
-
parent_docs: {
|
|
66
|
-
reverse_nested: {};
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
}) | undefined;
|
|
76
|
-
URLParams: boolean;
|
|
77
|
-
componentId: string;
|
|
78
|
-
dataField: string;
|
|
79
|
-
filterLabel: string;
|
|
80
|
-
react: {
|
|
81
|
-
and: string[];
|
|
82
|
-
};
|
|
83
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useReactiveFilterSliderProps = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const useReactiveFilterSharedProps_1 = require("./useReactiveFilterSharedProps");
|
|
9
|
-
/**
|
|
10
|
-
* For use with @appbaseio/reactivesearch RangeSlider component
|
|
11
|
-
*/
|
|
12
|
-
const useReactiveFilterSliderProps = (filter) => {
|
|
13
|
-
const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
|
|
14
|
-
const rangeLabelsFn = react_1.default.useCallback((min, max) => {
|
|
15
|
-
var _a, _b, _c, _d;
|
|
16
|
-
return ({
|
|
17
|
-
start: `${(_a = filter.displaySliderPrefix) !== null && _a !== void 0 ? _a : ""}${min}${(_b = filter.displaySliderSuffix) !== null && _b !== void 0 ? _b : ""}`,
|
|
18
|
-
end: `${(_c = filter.displaySliderPrefix) !== null && _c !== void 0 ? _c : ""}${max}${(_d = filter.displaySliderSuffix) !== null && _d !== void 0 ? _d : ""}`,
|
|
19
|
-
});
|
|
20
|
-
}, []);
|
|
21
|
-
const reactiveFilterSliderProps = react_1.default.useMemo(() => {
|
|
22
|
-
var _a, _b;
|
|
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 }));
|
|
24
|
-
}, [filter, reactiveFilterSharedProps]);
|
|
25
|
-
return reactiveFilterSliderProps;
|
|
26
|
-
};
|
|
27
|
-
exports.useReactiveFilterSliderProps = useReactiveFilterSliderProps;
|
|
28
|
-
//# sourceMappingURL=useReactiveFilterSliderProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useReactiveReactProp = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
9
|
-
const components_1 = require("../../components");
|
|
10
|
-
const useReactiveReactProp = (currentHandle, filter) => {
|
|
11
|
-
const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
|
|
12
|
-
const { filterStack } = (0, hooks_1.useFilters)();
|
|
13
|
-
const sensorIds = (0, components_1.SENSOR_IDS)(reactifySearchContext.options.mode, reactifySearchContext.config);
|
|
14
|
-
const reactProp = react_1.default.useMemo(() => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
if (filter && filter.settingsShowEmptyValues) {
|
|
17
|
-
return {
|
|
18
|
-
and: sensorIds,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
and: [
|
|
23
|
-
...sensorIds,
|
|
24
|
-
...((_a = reactifySearchContext.options.additionalComponentIds) !== null && _a !== void 0 ? _a : []),
|
|
25
|
-
...((_b = filterStack === null || filterStack === void 0 ? void 0 : filterStack.options.map((filter) => filter.handle)) !== null && _b !== void 0 ? _b : []),
|
|
26
|
-
].filter((handle) => handle !== currentHandle),
|
|
27
|
-
};
|
|
28
|
-
}, [filterStack, currentHandle, reactifySearchContext.options.additionalComponentIds]);
|
|
29
|
-
return reactProp;
|
|
30
|
-
};
|
|
31
|
-
exports.useReactiveReactProp = useReactiveReactProp;
|
|
32
|
-
//# sourceMappingURL=useReactiveReactProp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACzD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IAErC,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE/F,MAAM,SAAS,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QACnC,IAAI,MAAM,IAAI,MAAM,CAAC,uBAAuB,EAAE;YAC5C,OAAO;gBACL,GAAG,EAAE,SAAS;aACf,CAAC;SACH;QAED,OAAO;YACL,GAAG,EAAE;gBACH,GAAG,SAAS;gBACZ,GAAG,CAAC,MAAA,qBAAqB,CAAC,OAAO,CAAC,sBAAsB,mCAAI,EAAE,CAAC;gBAC/D,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,qBAAqB,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAEvF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA1BW,QAAA,oBAAoB,wBA0B/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 reactifySearchContext = useReactifySearchContext();\n const { filterStack } = useFilters();\n \n const sensorIds = SENSOR_IDS(reactifySearchContext.options.mode, reactifySearchContext.config);\n\n const reactProp = React.useMemo(() => {\n if (filter && filter.settingsShowEmptyValues) {\n return {\n and: sensorIds,\n };\n }\n\n return {\n and: [\n ...sensorIds,\n ...(reactifySearchContext.options.additionalComponentIds ?? []),\n ...(filterStack?.options.map((filter) => filter.handle) ?? []),\n ].filter((handle) => handle !== currentHandle),\n };\n }, [filterStack, currentHandle, reactifySearchContext.options.additionalComponentIds]);\n\n return reactProp;\n};\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactiveList from "@appbaseio/reactivesearch/lib/components/result/ReactiveList";
|
|
3
|
-
export declare const useReactiveReactiveListProps: (options: {
|
|
4
|
-
pageSize?: number;
|
|
5
|
-
scrollTarget?: React.ComponentProps<typeof ReactiveList>["scrollTarget"];
|
|
6
|
-
}) => React.ComponentProps<typeof ReactiveList>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useReactiveReactiveListProps = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
9
|
-
const useReactiveReactProp_1 = require("./useReactiveReactProp");
|
|
10
|
-
const useReactiveReactiveListProps = (options) => {
|
|
11
|
-
const { filterStack } = (0, hooks_1.useFilters)();
|
|
12
|
-
const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)();
|
|
13
|
-
const context = (0, hooks_1.useReactifySearchContext)();
|
|
14
|
-
const { includeFields, excludeFields } = context.options;
|
|
15
|
-
const size = react_1.default.useMemo(() => {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
return (_b = (_a = options.pageSize) !== null && _a !== void 0 ? _a : filterStack === null || filterStack === void 0 ? void 0 : filterStack.pageSize) !== null && _b !== void 0 ? _b : 20;
|
|
18
|
-
}, [options.pageSize, filterStack]);
|
|
19
|
-
const reactiveReactiveListProps = react_1.default.useMemo(() => ({
|
|
20
|
-
size,
|
|
21
|
-
URLParams: true,
|
|
22
|
-
showLoader: false,
|
|
23
|
-
dataField: "title",
|
|
24
|
-
showResultStats: false,
|
|
25
|
-
react: reactiveReactProp,
|
|
26
|
-
includeFields,
|
|
27
|
-
excludeFields,
|
|
28
|
-
scrollTarget: options.scrollTarget,
|
|
29
|
-
componentId: "page",
|
|
30
|
-
scrollOnChange: false,
|
|
31
|
-
pagination: (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType) !== "infinite_scroll",
|
|
32
|
-
infiniteScroll: (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType) === "infinite_scroll",
|
|
33
|
-
renderNoResults: () => null, // always use only render, otherwise both are shown
|
|
34
|
-
}), [filterStack, reactiveReactProp, options.pageSize]);
|
|
35
|
-
return reactiveReactiveListProps;
|
|
36
|
-
};
|
|
37
|
-
exports.useReactiveReactiveListProps = useReactiveReactiveListProps;
|
|
38
|
-
//# sourceMappingURL=useReactiveReactiveListProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveReactiveListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactiveListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAmE;AACnE,iEAA8D;AAEvD,MAAM,4BAA4B,GAAG,CAAC,OAG5C,EAA6C,EAAE;IAC9C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IACrC,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,GAAE,CAAC;IACjD,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAEzD,MAAM,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAC9B,OAAO,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,EAAE,CAAC;IACzD,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAEpC,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAG7C,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,OAAO;QAClB,eAAe,EAAE,KAAK;QACtB,KAAK,EAAE,iBAAiB;QACxB,aAAa;QACb,aAAa;QACb,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,WAAW,EAAE,MAAM;QACnB,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QAC7D,cAAc,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QACjE,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,mDAAmD;KACjF,CAAC,EACF,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,CACnD,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AApCW,QAAA,4BAA4B,gCAoCvC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@appbaseio/reactivesearch/lib/components/result/ReactiveList\";\n\nimport { useFilters, useReactifySearchContext } from \"../../hooks\";\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\nexport const useReactiveReactiveListProps = (options: {\n pageSize?: number;\n scrollTarget?: React.ComponentProps<typeof ReactiveList>[\"scrollTarget\"];\n}): React.ComponentProps<typeof ReactiveList> => {\n const { filterStack } = useFilters();\n const reactiveReactProp = useReactiveReactProp();\n const context = useReactifySearchContext();\n const { includeFields, excludeFields } = context.options;\n\n const size = React.useMemo(() => {\n return options.pageSize ?? filterStack?.pageSize ?? 20;\n }, [options.pageSize, filterStack]);\n\n const reactiveReactiveListProps = React.useMemo<\n React.ComponentProps<typeof ReactiveList>\n >(\n () => ({\n size,\n URLParams: true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: reactiveReactProp,\n includeFields,\n excludeFields,\n scrollTarget: options.scrollTarget,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: filterStack?.paginationType !== \"infinite_scroll\",\n infiniteScroll: filterStack?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n }),\n [filterStack, reactiveReactProp, options.pageSize]\n );\n\n return reactiveReactiveListProps;\n};\n"]}
|