@usereactify/search 5.41.0 → 5.42.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 +7 -0
- package/dist/package.json +1 -1
- package/dist/src/components/Sensor/SensorCustom.d.ts +2 -0
- package/dist/src/components/Sensor/SensorCustom.js +16 -0
- package/dist/src/components/Sensor/SensorCustom.js.map +1 -0
- package/dist/src/components/Sensor/Sensors.js +5 -2
- package/dist/src/components/Sensor/Sensors.js.map +1 -1
- package/dist/src/components/Sensor/index.d.ts +2 -1
- package/dist/src/components/Sensor/index.js +15 -7
- package/dist/src/components/Sensor/index.js.map +1 -1
- package/dist/src/components/Suggestions/Suggestions.js +3 -1
- package/dist/src/components/Suggestions/Suggestions.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +6 -5
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -1
- package/dist/src/types/config.d.ts +4 -0
- package/dist/src/types/config.js.map +1 -1
- package/package.json +1 -1
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.42.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.41.0...release-v5.42.0) (2023-12-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add support for custom sensors via config ([71ce82f](https://bitbucket.org/usereactify/reactify-search-ui/commit/71ce82f16630d74d156e3d58fc716d7b9ef36a05))
|
|
11
|
+
|
|
5
12
|
## [5.41.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.40.0...release-v5.41.0) (2023-12-18)
|
|
6
13
|
|
|
7
14
|
|
package/dist/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
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.SensorCustom = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const SensorCustom = () => {
|
|
11
|
+
const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
|
|
12
|
+
const sensors = reactifySearchContext.options.mode === "collection" ? reactifySearchContext.config.sensors.collection : reactifySearchContext.config.sensors.search;
|
|
13
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, sensors.map((item, index) => react_1.default.createElement(ReactiveComponent_1.default, { componentId: `SensorCustom_${index}`, customQuery: () => item }))));
|
|
14
|
+
};
|
|
15
|
+
exports.SensorCustom = SensorCustom;
|
|
16
|
+
//# sourceMappingURL=SensorCustom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorCustom.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorCustom.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,uCAAuD;AAEhD,MAAM,YAAY,GAAa,GAAG,EAAE;IACzC,MAAM,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAEzD,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IAEpK,OAAO,CACL,8DACG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC3B,8BAAC,2BAAiB,IAChB,WAAW,EAAE,gBAAgB,KAAK,EAAE,EACpC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,GACvB,CACH,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent\";\n\nimport { useReactifySearchContext } from \"../../hooks\";\n\nexport const SensorCustom: React.FC = () => {\n const reactifySearchContext = useReactifySearchContext();\n\n const sensors = reactifySearchContext.options.mode === \"collection\" ? reactifySearchContext.config.sensors.collection : reactifySearchContext.config.sensors.search;\n\n return (\n <>\n {sensors.map((item, index) => \n <ReactiveComponent\n componentId={`SensorCustom_${index}`}\n customQuery={() => item}\n />\n )}\n </>\n );\n};\n"]}
|
|
@@ -11,6 +11,7 @@ const SensorPublished_1 = require("./SensorPublished");
|
|
|
11
11
|
const SensorCollection_1 = require("./SensorCollection");
|
|
12
12
|
const SensorSearchTerm_1 = require("./SensorSearchTerm");
|
|
13
13
|
const SensorInventoryAvailable_1 = require("./SensorInventoryAvailable");
|
|
14
|
+
const SensorCustom_1 = require("./SensorCustom");
|
|
14
15
|
const Sensors = () => {
|
|
15
16
|
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
16
17
|
if (options.mode === "search" || options.mode === "instant-search") {
|
|
@@ -18,14 +19,16 @@ const Sensors = () => {
|
|
|
18
19
|
react_1.default.createElement(SensorSort_1.SensorSort, null),
|
|
19
20
|
react_1.default.createElement(SensorPublished_1.SensorPublished, null),
|
|
20
21
|
react_1.default.createElement(SensorSearchTerm_1.SensorSearchTerm, null),
|
|
21
|
-
react_1.default.createElement(SensorInventoryAvailable_1.SensorInventoryAvailable, null)
|
|
22
|
+
react_1.default.createElement(SensorInventoryAvailable_1.SensorInventoryAvailable, null),
|
|
23
|
+
react_1.default.createElement(SensorCustom_1.SensorCustom, null)));
|
|
22
24
|
}
|
|
23
25
|
if (options.mode === "collection") {
|
|
24
26
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
25
27
|
react_1.default.createElement(SensorSort_1.SensorSort, null),
|
|
26
28
|
react_1.default.createElement(SensorPublished_1.SensorPublished, null),
|
|
27
29
|
react_1.default.createElement(SensorCollection_1.SensorCollection, null),
|
|
28
|
-
react_1.default.createElement(SensorInventoryAvailable_1.SensorInventoryAvailable, null)
|
|
30
|
+
react_1.default.createElement(SensorInventoryAvailable_1.SensorInventoryAvailable, null),
|
|
31
|
+
react_1.default.createElement(SensorCustom_1.SensorCustom, null)));
|
|
29
32
|
}
|
|
30
33
|
return null;
|
|
31
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sensors.js","sourceRoot":"","sources":["../../../../src/components/Sensor/Sensors.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAuD;AAEvD,6CAA0C;AAC1C,uDAAoD;AACpD,yDAAsD;AACtD,yDAAsD;AACtD,yEAAsE;
|
|
1
|
+
{"version":3,"file":"Sensors.js","sourceRoot":"","sources":["../../../../src/components/Sensor/Sensors.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAuD;AAEvD,6CAA0C;AAC1C,uDAAoD;AACpD,yDAAsD;AACtD,yDAAsD;AACtD,yEAAsE;AACtE,iDAA8C;AAMvC,MAAM,OAAO,GAA2B,GAAG,EAAE;IAClD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE;QAClE,OAAO,CACL;YACE,8BAAC,uBAAU,OAAG;YACd,8BAAC,iCAAe,OAAG;YACnB,8BAAC,mCAAgB,OAAG;YACpB,8BAAC,mDAAwB,OAAG;YAC5B,8BAAC,2BAAY,OAAG,CACf,CACJ,CAAC;KACH;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE;QACjC,OAAO,CACL;YACE,8BAAC,uBAAU,OAAG;YACd,8BAAC,iCAAe,OAAG;YACnB,8BAAC,mCAAgB,OAAG;YACpB,8BAAC,mDAAwB,OAAG;YAC5B,8BAAC,2BAAY,OAAG,CACf,CACJ,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA5BW,QAAA,OAAO,WA4BlB","sourcesContent":["import React from \"react\";\n\nimport { useReactifySearchContext } from \"../../hooks\";\n\nimport { SensorSort } from \"./SensorSort\";\nimport { SensorPublished } from \"./SensorPublished\";\nimport { SensorCollection } from \"./SensorCollection\";\nimport { SensorSearchTerm } from \"./SensorSearchTerm\";\nimport { SensorInventoryAvailable } from \"./SensorInventoryAvailable\";\nimport { SensorCustom } from \"./SensorCustom\";\n\nexport type SensorsProps = {\n /** This component does not support any props */\n};\n\nexport const Sensors: React.FC<SensorsProps> = () => {\n const { options } = useReactifySearchContext();\n\n if (options.mode === \"search\" || options.mode === \"instant-search\") {\n return (\n <>\n <SensorSort />\n <SensorPublished />\n <SensorSearchTerm />\n <SensorInventoryAvailable />\n <SensorCustom />\n </>\n );\n }\n\n if (options.mode === \"collection\") {\n return (\n <>\n <SensorSort />\n <SensorPublished />\n <SensorCollection />\n <SensorInventoryAvailable />\n <SensorCustom />\n </>\n );\n }\n\n return null;\n};\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Config } from "../../types";
|
|
1
2
|
export * from "./SensorSort";
|
|
2
3
|
export * from "./SensorPublished";
|
|
3
4
|
export * from "./SensorCollection";
|
|
4
5
|
export * from "./SensorSearchTerm";
|
|
5
6
|
export * from "./SensorInventoryAvailable";
|
|
6
7
|
export * from "./Sensors";
|
|
7
|
-
export declare const SENSOR_IDS: string[];
|
|
8
|
+
export declare const SENSOR_IDS: (mode: "search" | "collection" | "instant-search", config: Config) => string[];
|
|
@@ -18,11 +18,19 @@ __exportStar(require("./SensorSearchTerm"), exports);
|
|
|
18
18
|
__exportStar(require("./SensorInventoryAvailable"), exports);
|
|
19
19
|
__exportStar(require("./Sensors"), exports);
|
|
20
20
|
// this is consumed by the react prop in various components
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const SENSOR_IDS = (mode, config) => {
|
|
22
|
+
const sensorIds = [
|
|
23
|
+
"SensorSort",
|
|
24
|
+
"SensorPublished",
|
|
25
|
+
"SensorCollection",
|
|
26
|
+
"SensorSearchTerm",
|
|
27
|
+
"SensorInventoryAvailable",
|
|
28
|
+
];
|
|
29
|
+
const customSensors = mode === "collection" ? config.sensors.collection : config.sensors.search;
|
|
30
|
+
if (customSensors.length > 0) {
|
|
31
|
+
sensorIds.push(...customSensors.map((item, index) => `SensorCustom_${index}`));
|
|
32
|
+
}
|
|
33
|
+
return sensorIds;
|
|
34
|
+
};
|
|
35
|
+
exports.SENSOR_IDS = SENSOR_IDS;
|
|
28
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sensor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sensor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAEA,+CAA6B;AAC7B,oDAAkC;AAClC,qDAAmC;AACnC,qDAAmC;AACnC,6DAA2C;AAE3C,4CAA0B;AAE1B,2DAA2D;AACpD,MAAM,UAAU,GAAG,CAAC,IAAgD,EAAE,MAAc,EAAE,EAAE;IAC7F,MAAM,SAAS,GAAG;QAChB,YAAY;QACZ,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,0BAA0B;KAC3B,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IAChG,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,SAAS,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC,CAAC;KAChF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA;AAdY,QAAA,UAAU,cActB","sourcesContent":["import { Config } from \"../../types\";\n\nexport * from \"./SensorSort\";\nexport * from \"./SensorPublished\";\nexport * from \"./SensorCollection\";\nexport * from \"./SensorSearchTerm\";\nexport * from \"./SensorInventoryAvailable\";\n\nexport * from \"./Sensors\";\n\n// this is consumed by the react prop in various components\nexport const SENSOR_IDS = (mode: \"search\" | \"collection\" | \"instant-search\", config: Config) => {\n const sensorIds = [\n \"SensorSort\",\n \"SensorPublished\",\n \"SensorCollection\",\n \"SensorSearchTerm\",\n \"SensorInventoryAvailable\",\n ];\n const customSensors = mode === \"collection\" ? config.sensors.collection : config.sensors.search;\n if (customSensors.length > 0) {\n sensorIds.push(...customSensors.map((item, index) => `SensorCustom_${index}`));\n }\n\n return sensorIds;\n}"]}
|
|
@@ -10,7 +10,9 @@ const hooks_1 = require("../../hooks");
|
|
|
10
10
|
const Suggestions = (props) => {
|
|
11
11
|
var _a;
|
|
12
12
|
const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleSuggestions;
|
|
13
|
+
const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
|
|
13
14
|
const { searchTerm } = (0, hooks_1.useSearch)();
|
|
15
|
+
const sensorIds = (0, components_1.SENSOR_IDS)(reactifySearchContext.options.mode, reactifySearchContext.config);
|
|
14
16
|
return (react_1.default.createElement(components_1.CustomComponent, { componentId: "SensorSuggestions", defaultQuery: () => {
|
|
15
17
|
return {
|
|
16
18
|
suggest: {
|
|
@@ -25,7 +27,7 @@ const Suggestions = (props) => {
|
|
|
25
27
|
},
|
|
26
28
|
};
|
|
27
29
|
}, react: {
|
|
28
|
-
and:
|
|
30
|
+
and: sensorIds,
|
|
29
31
|
}, render: (renderProps) => {
|
|
30
32
|
var _a, _b, _c;
|
|
31
33
|
const props = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAI0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAI0B;AAC1B,uCAAkE;AAa3D,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;;IAC/D,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,+BAAkB,CAAC;IAE3D,MAAM,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAEzD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE/F,OAAO,CACL,8BAAC,4BAAe,IACd,WAAW,EAAC,mBAAmB,EAC/B,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,WAAW,EAAE;wBACX,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE;4BACJ,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,IAAI,EAAE,OAAO;4BACb,YAAY,EAAE,QAAQ;yBACvB;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,EACD,KAAK,EAAE;YACL,GAAG,EAAE,SAAS;SACf,EACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;;YACtB,MAAM,KAAK,GAEP;gBACF,WAAW,EAAE,EAAE;aAChB,CAAC;YAEF,IAAI,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,OAAO,0CAAE,WAAW,CAAC,MAAM,EAAE;gBACpD,MAAM,OAAO,GACX,MAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACrC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CACnD,0CAAE,OAAO,CAAC;gBACb,KAAK,CAAC,WAAW,CAAC,IAAI,CACpB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAsC,EAAE,EAAE,CAAC,CAAC;oBAC1D,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAC,CACJ,CAAC;aACH;YAED,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;QACxC,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,WAAW,eAoDtB","sourcesContent":["import React from \"react\";\n\nimport {\n CustomComponent,\n ExampleSuggestions,\n SENSOR_IDS,\n} from \"../../components\";\nimport { useReactifySearchContext, useSearch } from \"../../hooks\";\n\nexport type SuggestionsProps = {\n /** The field which should be used for autocompletion */\n field: \"title\";\n /** Render method */\n render?: React.FC<{\n suggestions: Array<{\n text: string;\n }>;\n }>;\n};\n\nexport const Suggestions: React.FC<SuggestionsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleSuggestions;\n\n const reactifySearchContext = useReactifySearchContext();\n\n const { searchTerm } = useSearch();\n\n const sensorIds = SENSOR_IDS(reactifySearchContext.options.mode, reactifySearchContext.config);\n\n return (\n <CustomComponent\n componentId=\"SensorSuggestions\"\n defaultQuery={() => {\n return {\n suggest: {\n suggestions: {\n text: searchTerm,\n term: {\n field: props.field,\n sort: \"score\",\n suggest_mode: \"always\",\n },\n },\n },\n };\n }}\n react={{\n and: sensorIds,\n }}\n render={(renderProps) => {\n const props: React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n > = {\n suggestions: [],\n };\n\n if (renderProps.rawData?.suggest?.suggestions.length) {\n const options =\n renderProps.rawData.suggest.suggestions[\n renderProps.rawData.suggest.suggestions.length - 1\n ]?.options;\n props.suggestions.push(\n ...options.map((option: { text: string; freq: number }) => ({\n text: option.text,\n }))\n );\n }\n\n return <RenderComponent {...props} />;\n }}\n />\n );\n};\n"]}
|
|
@@ -8,23 +8,24 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const hooks_1 = require("../../hooks");
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
10
|
const useReactiveReactProp = (currentHandle, filter) => {
|
|
11
|
-
const
|
|
11
|
+
const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
|
|
12
12
|
const { filterStack } = (0, hooks_1.useFilters)();
|
|
13
|
+
const sensorIds = (0, components_1.SENSOR_IDS)(reactifySearchContext.options.mode, reactifySearchContext.config);
|
|
13
14
|
const reactProp = react_1.default.useMemo(() => {
|
|
14
15
|
var _a, _b;
|
|
15
16
|
if (filter && filter.settingsShowEmptyValues) {
|
|
16
17
|
return {
|
|
17
|
-
and:
|
|
18
|
+
and: sensorIds,
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
return {
|
|
21
22
|
and: [
|
|
22
|
-
...
|
|
23
|
-
...((_a = options.additionalComponentIds) !== null && _a !== void 0 ? _a : []),
|
|
23
|
+
...sensorIds,
|
|
24
|
+
...((_a = reactifySearchContext.options.additionalComponentIds) !== null && _a !== void 0 ? _a : []),
|
|
24
25
|
...((_b = filterStack === null || filterStack === void 0 ? void 0 : filterStack.options.map((filter) => filter.handle)) !== null && _b !== void 0 ? _b : []),
|
|
25
26
|
].filter((handle) => handle !== currentHandle),
|
|
26
27
|
};
|
|
27
|
-
}, [filterStack, currentHandle, options.additionalComponentIds]);
|
|
28
|
+
}, [filterStack, currentHandle, reactifySearchContext.options.additionalComponentIds]);
|
|
28
29
|
return reactProp;
|
|
29
30
|
};
|
|
30
31
|
exports.useReactiveReactProp = useReactiveReactProp;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"]}
|
|
@@ -12,6 +12,10 @@ export interface Config {
|
|
|
12
12
|
filters: Array<ConfigFilter>;
|
|
13
13
|
redirects: Array<ConfigRedirect>;
|
|
14
14
|
curations: Array<ConfigCuration>;
|
|
15
|
+
sensors: {
|
|
16
|
+
search: Array<unknown>;
|
|
17
|
+
collection: Array<unknown>;
|
|
18
|
+
};
|
|
15
19
|
}
|
|
16
20
|
export declare type ConfigSort = Omit<Sort, "enabled">;
|
|
17
21
|
export declare type ConfigField = Omit<Field, "enabled">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Sort,\n Filter,\n FilterOption,\n Redirect,\n Field,\n Curation,\n} from \"./firestore\";\n\n// when exposed as config, most resources have the `enabled` and `keywords` attributes removed\n// curation boosting groupings and sortings both have a json encoded elastic query added to them\nexport interface Config {\n index: string;\n endpoint: string;\n version: string;\n cache: {\n enabled: boolean;\n seconds: number;\n };\n sort: Array<ConfigSort>;\n fields: Array<ConfigField>;\n filters: Array<ConfigFilter>;\n redirects: Array<ConfigRedirect>;\n curations: Array<ConfigCuration>;\n}\n\nexport type ConfigSort = Omit<Sort, \"enabled\">;\nexport type ConfigField = Omit<Field, \"enabled\">;\nexport type ConfigRedirect = Omit<Redirect, \"enabled\" | \"keywords\">;\nexport type ConfigFilter = Omit<Filter, \"enabled\" | \"keywords\"> & {\n options: Omit<FilterOption, \"enabled\">[];\n};\nexport type ConfigFilterOption = Omit<FilterOption, \"enabled\">;\nexport type ConfigCuration = Omit<\n Curation,\n \"keywords\" | \"boosting\" | \"longRunningTask\" | \"callouts\"\n> & {\n boosting: {\n groupings: (NonNullable<\n NonNullable<Curation[\"boosting\"]>[\"groupings\"]\n >[0] & { query: string })[];\n sortings: (NonNullable<NonNullable<Curation[\"boosting\"]>[\"sortings\"]>[0] & {\n query: string;\n })[];\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Sort,\n Filter,\n FilterOption,\n Redirect,\n Field,\n Curation,\n} from \"./firestore\";\n\n// when exposed as config, most resources have the `enabled` and `keywords` attributes removed\n// curation boosting groupings and sortings both have a json encoded elastic query added to them\nexport interface Config {\n index: string;\n endpoint: string;\n version: string;\n cache: {\n enabled: boolean;\n seconds: number;\n };\n sort: Array<ConfigSort>;\n fields: Array<ConfigField>;\n filters: Array<ConfigFilter>;\n redirects: Array<ConfigRedirect>;\n curations: Array<ConfigCuration>;\n sensors: {\n search: Array<unknown>;\n collection: Array<unknown>;\n };\n}\n\nexport type ConfigSort = Omit<Sort, \"enabled\">;\nexport type ConfigField = Omit<Field, \"enabled\">;\nexport type ConfigRedirect = Omit<Redirect, \"enabled\" | \"keywords\">;\nexport type ConfigFilter = Omit<Filter, \"enabled\" | \"keywords\"> & {\n options: Omit<FilterOption, \"enabled\">[];\n};\nexport type ConfigFilterOption = Omit<FilterOption, \"enabled\">;\nexport type ConfigCuration = Omit<\n Curation,\n \"keywords\" | \"boosting\" | \"longRunningTask\" | \"callouts\"\n> & {\n boosting: {\n groupings: (NonNullable<\n NonNullable<Curation[\"boosting\"]>[\"groupings\"]\n >[0] & { query: string })[];\n sortings: (NonNullable<NonNullable<Curation[\"boosting\"]>[\"sortings\"]>[0] & {\n query: string;\n })[];\n };\n};\n"]}
|