@esri/hub-common 9.49.0 → 10.0.0-next.1
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/dist/es2017/search/_internal/hubSearchItems.js +0 -43
- package/dist/es2017/search/_internal/hubSearchItems.js.map +1 -1
- package/dist/es2017/search/_internal/index.js +0 -1
- package/dist/es2017/search/_internal/index.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchGroups.js +0 -1
- package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchItems.js +1 -4
- package/dist/es2017/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/es2017/search/_internal/portalSearchUsers.js +0 -1
- package/dist/es2017/search/_internal/portalSearchUsers.js.map +1 -1
- package/dist/es2017/search/_searchContent.js +1 -5
- package/dist/es2017/search/_searchContent.js.map +1 -1
- package/dist/es2017/search/_searchGroups.js.map +1 -1
- package/dist/es2017/search/content-utils.js +2 -67
- package/dist/es2017/search/content-utils.js.map +1 -1
- package/dist/es2017/search/index.js +0 -1
- package/dist/es2017/search/index.js.map +1 -1
- package/dist/es2017/search/types/index.js +0 -2
- package/dist/es2017/search/types/index.js.map +1 -1
- package/dist/es2017/types.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchItems.js +1 -45
- package/dist/esm/search/_internal/hubSearchItems.js.map +1 -1
- package/dist/esm/search/_internal/index.js +0 -1
- package/dist/esm/search/_internal/index.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchGroups.js +0 -1
- package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchItems.js +2 -4
- package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/esm/search/_internal/portalSearchUsers.js +0 -1
- package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -1
- package/dist/esm/search/_searchContent.js +1 -5
- package/dist/esm/search/_searchContent.js.map +1 -1
- package/dist/esm/search/_searchGroups.js.map +1 -1
- package/dist/esm/search/content-utils.js +2 -70
- package/dist/esm/search/content-utils.js.map +1 -1
- package/dist/esm/search/index.js +0 -1
- package/dist/esm/search/index.js.map +1 -1
- package/dist/esm/search/types/index.js +0 -2
- package/dist/esm/search/types/index.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/node/search/_internal/hubSearchItems.js +1 -45
- package/dist/node/search/_internal/hubSearchItems.js.map +1 -1
- package/dist/node/search/_internal/index.js +0 -1
- package/dist/node/search/_internal/index.js.map +1 -1
- package/dist/node/search/_internal/portalSearchGroups.js +0 -1
- package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
- package/dist/node/search/_internal/portalSearchItems.js +0 -3
- package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/node/search/_internal/portalSearchUsers.js +0 -1
- package/dist/node/search/_internal/portalSearchUsers.js.map +1 -1
- package/dist/node/search/_searchContent.js +0 -4
- package/dist/node/search/_searchContent.js.map +1 -1
- package/dist/node/search/_searchGroups.js.map +1 -1
- package/dist/node/search/content-utils.js +3 -70
- package/dist/node/search/content-utils.js.map +1 -1
- package/dist/node/search/index.js +0 -1
- package/dist/node/search/index.js.map +1 -1
- package/dist/node/search/types/index.js +0 -2
- package/dist/node/search/types/index.js.map +1 -1
- package/dist/node/types.js.map +1 -1
- package/dist/types/search/_internal/hubSearchItems.d.ts +1 -2
- package/dist/types/search/_internal/index.d.ts +0 -1
- package/dist/types/search/_searchGroups.d.ts +1 -5
- package/dist/types/search/content-utils.d.ts +1 -18
- package/dist/types/search/index.d.ts +0 -1
- package/dist/types/search/types/ICatalog.d.ts +0 -5
- package/dist/types/search/types/ICollection.d.ts +0 -2
- package/dist/types/search/types/IHubSearchResponse.d.ts +0 -5
- package/dist/types/search/types/index.d.ts +0 -2
- package/dist/types/search/types/types.d.ts +0 -2
- package/dist/types/types.d.ts +0 -2
- package/dist/umd/common.umd.js +3 -327
- package/dist/umd/common.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/es2017/search/_internal/state.js +0 -155
- package/dist/es2017/search/_internal/state.js.map +0 -1
- package/dist/es2017/search/collectionState.js +0 -60
- package/dist/es2017/search/collectionState.js.map +0 -1
- package/dist/es2017/search/types/IFacet.js +0 -1
- package/dist/es2017/search/types/IFacet.js.map +0 -1
- package/dist/es2017/search/types/IFacetOption.js +0 -1
- package/dist/es2017/search/types/IFacetOption.js.map +0 -1
- package/dist/esm/search/_internal/state.js +0 -155
- package/dist/esm/search/_internal/state.js.map +0 -1
- package/dist/esm/search/collectionState.js +0 -61
- package/dist/esm/search/collectionState.js.map +0 -1
- package/dist/esm/search/types/IFacet.js +0 -1
- package/dist/esm/search/types/IFacet.js.map +0 -1
- package/dist/esm/search/types/IFacetOption.js +0 -1
- package/dist/esm/search/types/IFacetOption.js.map +0 -1
- package/dist/node/search/_internal/state.js +0 -166
- package/dist/node/search/_internal/state.js.map +0 -1
- package/dist/node/search/collectionState.js +0 -65
- package/dist/node/search/collectionState.js.map +0 -1
- package/dist/node/search/types/IFacet.js +0 -3
- package/dist/node/search/types/IFacet.js.map +0 -1
- package/dist/node/search/types/IFacetOption.js +0 -3
- package/dist/node/search/types/IFacetOption.js.map +0 -1
- package/dist/types/search/_internal/state.d.ts +0 -70
- package/dist/types/search/collectionState.d.ts +0 -19
- package/dist/types/search/types/IFacet.d.ts +0 -62
- package/dist/types/search/types/IFacetOption.d.ts +0 -30
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeCollectionState = exports.applyCollectionState = void 0;
|
|
4
|
-
const util_1 = require("../util");
|
|
5
|
-
const state_1 = require("./_internal/state");
|
|
6
|
-
/**
|
|
7
|
-
* Apply ICollectionState to an ICollection
|
|
8
|
-
*
|
|
9
|
-
* Typically used in a Gallery or Catalog component to
|
|
10
|
-
* set the inital state, based on values deserialized
|
|
11
|
-
* from a query string
|
|
12
|
-
* @param collection
|
|
13
|
-
* @param state
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
function applyCollectionState(collection, state) {
|
|
17
|
-
const updated = util_1.cloneObject(collection);
|
|
18
|
-
// Apply default query
|
|
19
|
-
if (state.query) {
|
|
20
|
-
updated.defaultQuery = state.query;
|
|
21
|
-
}
|
|
22
|
-
// Apply Sort State
|
|
23
|
-
updated.sortOption = state_1.applySortState(updated.sortOption, state.sort);
|
|
24
|
-
// Look for state props for the facets and apply them
|
|
25
|
-
updated.facets = updated.facets.map((facet) => {
|
|
26
|
-
// see if there is a key for this facet on the state
|
|
27
|
-
if (Object.keys(state).includes(facet.key)) {
|
|
28
|
-
const facetState = {};
|
|
29
|
-
facetState[facet.key] = state[facet.key];
|
|
30
|
-
return state_1.applyFacetState(facet, facetState);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// Ensure all options are not selected
|
|
34
|
-
// because they were not included in the state
|
|
35
|
-
facet.options.forEach((opt) => {
|
|
36
|
-
opt.selected = false;
|
|
37
|
-
});
|
|
38
|
-
return facet;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
//
|
|
42
|
-
return updated;
|
|
43
|
-
}
|
|
44
|
-
exports.applyCollectionState = applyCollectionState;
|
|
45
|
-
/**
|
|
46
|
-
* Serialize the current state of a collection into a hash that
|
|
47
|
-
* can be converted into a query string
|
|
48
|
-
* @param collection
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
function serializeCollectionState(collection) {
|
|
52
|
-
const state = {};
|
|
53
|
-
if (collection.defaultQuery) {
|
|
54
|
-
state.query = collection.defaultQuery;
|
|
55
|
-
}
|
|
56
|
-
if (collection.sortOption) {
|
|
57
|
-
state.sort = state_1.serializeSortState(collection.sortOption);
|
|
58
|
-
}
|
|
59
|
-
const facetState = (collection.facets || []).reduce((s, facet) => {
|
|
60
|
-
return Object.assign(Object.assign({}, s), state_1.serializeFacetState(facet));
|
|
61
|
-
}, {});
|
|
62
|
-
return Object.assign(Object.assign({}, state), facetState);
|
|
63
|
-
}
|
|
64
|
-
exports.serializeCollectionState = serializeCollectionState;
|
|
65
|
-
//# sourceMappingURL=collectionState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collectionState.js","sourceRoot":"","sources":["../../../src/search/collectionState.ts"],"names":[],"mappings":";;;AACA,kCAAsC;AAEtC,6CAK2B;AAE3B;;;;;;;;;GASG;AAEH,SAAgB,oBAAoB,CAClC,UAAuB,EACvB,KAAuB;IAEvB,MAAM,OAAO,GAAG,kBAAW,CAAC,UAAU,CAAC,CAAC;IAExC,sBAAsB;IACtB,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC;KACpC;IAED,mBAAmB;IACnB,OAAO,CAAC,UAAU,GAAG,sBAAc,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEpE,qDAAqD;IACrD,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5C,oDAAoD;QACpD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YAC1C,MAAM,UAAU,GAAG,EAAiB,CAAC;YACrC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,uBAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;SAC3C;aAAM;YACL,sCAAsC;YACtC,8CAA8C;YAC9C,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC5B,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;YACvB,CAAC,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;IAEH,EAAE;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAlCD,oDAkCC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,UAAuB;IAEvB,MAAM,KAAK,GAAqB,EAAE,CAAC;IAEnC,IAAI,UAAU,CAAC,YAAY,EAAE;QAC3B,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC;KACvC;IAED,IAAI,UAAU,CAAC,UAAU,EAAE;QACzB,KAAK,CAAC,IAAI,GAAG,0BAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;KACxD;IAED,MAAM,UAAU,GAAG,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAC/D,uCAAY,CAAC,GAAK,2BAAmB,CAAC,KAAK,CAAC,EAAG;IACjD,CAAC,EAAE,EAAiB,CAAC,CAAC;IAEtB,uCAAY,KAAK,GAAK,UAAU,EAAG;AACrC,CAAC;AAlBD,4DAkBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IFacet.js","sourceRoot":"","sources":["../../../../src/search/types/IFacet.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IFacetOption.js","sourceRoot":"","sources":["../../../../src/search/types/IFacetOption.ts"],"names":[],"mappings":""}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { IFacet, IFacetState, ISortOption } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* @private
|
|
4
|
-
* Apply the sortState to SortOptions
|
|
5
|
-
*
|
|
6
|
-
* @param sortOptions
|
|
7
|
-
* @param sortState
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare function applySortState(sortOptions: ISortOption, sortState: string): ISortOption;
|
|
11
|
-
/**
|
|
12
|
-
* @private
|
|
13
|
-
* Apply FacetState to a Facet
|
|
14
|
-
* @param facet
|
|
15
|
-
* @param state
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
export declare function applyFacetState(facet: IFacet, state: IFacetState): IFacet;
|
|
19
|
-
/**
|
|
20
|
-
* @private
|
|
21
|
-
* Apply the Facet State onto a single-select facet
|
|
22
|
-
*
|
|
23
|
-
* Intentionally mutates the facet.
|
|
24
|
-
* @param facet
|
|
25
|
-
* @param state
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
|
-
export declare function applySingleSelectFacetState(facet: IFacet, state: IFacetState): IFacet;
|
|
29
|
-
/**
|
|
30
|
-
* @private
|
|
31
|
-
* Serialize single-select facet into IFacetState
|
|
32
|
-
* @param facet
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
export declare function serializeSingleSelectFacetState(facet: IFacet): IFacetState;
|
|
36
|
-
/**
|
|
37
|
-
* @private
|
|
38
|
-
* Apply the Facet State onto a multi-select Facet
|
|
39
|
-
*
|
|
40
|
-
* Intentionally mutates the facet.
|
|
41
|
-
* @param facet
|
|
42
|
-
* @param state
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
export declare function applyMultiSelectFacetState(facet: IFacet, state: IFacetState): IFacet;
|
|
46
|
-
/**
|
|
47
|
-
* @private
|
|
48
|
-
* Serialize multi-select facet into IFacetState
|
|
49
|
-
* @param facet
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
export declare function serializeMultiSelectFacetState(facet: IFacet): IFacetState;
|
|
53
|
-
/**
|
|
54
|
-
* @private
|
|
55
|
-
* Serialize the state of the SortOption into a key/value pair
|
|
56
|
-
*
|
|
57
|
-
* Called from the Sort component
|
|
58
|
-
* @param sort
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
export declare function serializeSortState(sort: ISortOption): string;
|
|
62
|
-
/**
|
|
63
|
-
* @private
|
|
64
|
-
* Serialize the state of a facet into a key/value pair
|
|
65
|
-
*
|
|
66
|
-
* Called from the various facet components
|
|
67
|
-
* @param facet
|
|
68
|
-
* @returns
|
|
69
|
-
*/
|
|
70
|
-
export declare function serializeFacetState(facet: IFacet): IFacetState;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ICollection, ICollectionState } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Apply ICollectionState to an ICollection
|
|
4
|
-
*
|
|
5
|
-
* Typically used in a Gallery or Catalog component to
|
|
6
|
-
* set the inital state, based on values deserialized
|
|
7
|
-
* from a query string
|
|
8
|
-
* @param collection
|
|
9
|
-
* @param state
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare function applyCollectionState(collection: ICollection, state: ICollectionState): ICollection;
|
|
13
|
-
/**
|
|
14
|
-
* Serialize the current state of a collection into a hash that
|
|
15
|
-
* can be converted into a query string
|
|
16
|
-
* @param collection
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
export declare function serializeCollectionState(collection: ICollection): ICollectionState;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { IFacetOption } from "./IFacetOption";
|
|
2
|
-
/**
|
|
3
|
-
* Definition of a Facet shown in the Gallery UI.
|
|
4
|
-
*
|
|
5
|
-
* If a `field` is specified, the Facet will be "dynamic" in that
|
|
6
|
-
* it will request aggregations for the field and use the returned
|
|
7
|
-
* values to create the FacetOptions.
|
|
8
|
-
*
|
|
9
|
-
* `Facet` contains and array if `FacetOptions`. When selected
|
|
10
|
-
* in the UI, a FilterGroup is constructed from the `Facet.operation`
|
|
11
|
-
* and the `Filters` are from the selected `FacetOptions`.
|
|
12
|
-
*/
|
|
13
|
-
export interface IFacet {
|
|
14
|
-
/**
|
|
15
|
-
* Translated label for the facet
|
|
16
|
-
*/
|
|
17
|
-
label?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Unique key, used for query params and telemetry
|
|
20
|
-
*/
|
|
21
|
-
key?: string;
|
|
22
|
-
/**
|
|
23
|
-
* field to generate the facet from
|
|
24
|
-
*/
|
|
25
|
-
field?: string;
|
|
26
|
-
/**
|
|
27
|
-
* limit of aggregates returned. Max 200
|
|
28
|
-
*/
|
|
29
|
-
aggLimit?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Display for this facet. Not all facets will be compatible with all displays
|
|
32
|
-
*/
|
|
33
|
-
display?: "map" | "single-select" | "multi-select" | "date-range" | "histogram";
|
|
34
|
-
/**
|
|
35
|
-
* State of the Facet
|
|
36
|
-
*/
|
|
37
|
-
state?: "open" | "closed";
|
|
38
|
-
/**
|
|
39
|
-
* Individual options for this Facet
|
|
40
|
-
*/
|
|
41
|
-
options?: IFacetOption[];
|
|
42
|
-
/**
|
|
43
|
-
* Operation is passed into the FilterGroup that is constructed
|
|
44
|
-
* when the Facet is serialized.
|
|
45
|
-
* Implemetations should default to "OR" if not specified
|
|
46
|
-
*/
|
|
47
|
-
operation?: "OR" | "AND";
|
|
48
|
-
/**
|
|
49
|
-
* Number of facet options to show by default. Only applies to `multi-select`, and defaults to all.
|
|
50
|
-
*/
|
|
51
|
-
optionLimit?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Specifies how to order the facet options. Only applies to `multi-select`, and defaults to count.
|
|
54
|
-
* - count: orders by `option.count` in descending order of frequency
|
|
55
|
-
* - label: orders by `option.label` in ascending alphabetical order
|
|
56
|
-
*/
|
|
57
|
-
orderBy?: "count" | "label";
|
|
58
|
-
accordionClosed?: boolean;
|
|
59
|
-
type?: "single-select" | "multi-select" | "date-range" | "histogram";
|
|
60
|
-
pageSize?: number;
|
|
61
|
-
aggField?: string;
|
|
62
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Filter, FilterType } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Facet Option shown in the UI as either a radio button or checkbox
|
|
4
|
-
*/
|
|
5
|
-
export interface IFacetOption {
|
|
6
|
-
/**
|
|
7
|
-
* Translated label for the option
|
|
8
|
-
*/
|
|
9
|
-
label: string;
|
|
10
|
-
/**
|
|
11
|
-
* Unique key, used for query params and telemetry
|
|
12
|
-
*/
|
|
13
|
-
key: string;
|
|
14
|
-
/**
|
|
15
|
-
* For aggregate based Facets, the count of entries in the index with this value
|
|
16
|
-
*/
|
|
17
|
-
count?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Is this option selected when the UI loads
|
|
20
|
-
*/
|
|
21
|
-
selected: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Filters to be applied when this option is selected
|
|
24
|
-
*/
|
|
25
|
-
filters?: Array<Filter<FilterType>>;
|
|
26
|
-
/**
|
|
27
|
-
* DEPRECATED: Filter to be applied when this option is selected
|
|
28
|
-
*/
|
|
29
|
-
filter?: Filter<FilterType>;
|
|
30
|
-
}
|