@coveo/atomic 3.33.9-pre.a8ae421e2e → 3.33.9-pre.a90e222cec
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/atomic/_atomic.esm.js +1 -1
- package/dist/atomic/atomic.esm.js.map +1 -1
- package/dist/atomic/components/_index.d.ts +2 -0
- package/dist/atomic/components/_index.js +1 -0
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-category-facet.js +2 -2
- package/dist/atomic/components/atomic-category-facet.js.map +1 -1
- package/dist/atomic/components/atomic-facet.d.ts +11 -0
- package/dist/atomic/components/atomic-facet.js +470 -0
- package/dist/atomic/components/atomic-facet.js.map +1 -0
- package/dist/atomic/components/atomic-format-currency.js +1 -1
- package/dist/atomic/components/atomic-format-number.js +1 -1
- package/dist/atomic/components/atomic-format-unit.js +1 -1
- package/dist/atomic/components/atomic-insight-facet.js +4 -37
- package/dist/atomic/components/atomic-insight-facet.js.map +1 -1
- package/dist/atomic/components/atomic-insight-numeric-facet.js +2 -2
- package/dist/atomic/components/atomic-insight-numeric-facet.js.map +1 -1
- package/dist/atomic/components/atomic-numeric-facet.js +2 -2
- package/dist/atomic/components/atomic-numeric-facet.js.map +1 -1
- package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
- package/dist/atomic/components/atomic-quickview.js +1 -1
- package/dist/atomic/components/atomic-result-children.js +1 -1
- package/dist/atomic/components/atomic-result-fields-list.js +1 -1
- package/dist/atomic/components/atomic-result-link.js +1 -1
- package/dist/atomic/components/atomic-result-list.js +1 -1
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js +1 -1
- package/dist/atomic/components/atomic-search-box-recent-queries2.js +1 -1
- package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
- package/dist/atomic/components/atomic-tab-manager.js +1 -1
- package/dist/atomic/components/components/search/index.js +0 -1
- package/dist/atomic/components/components/search/lazy-index.js +0 -1
- package/dist/atomic/components/{stencil-facet-guard.js → facet-guard.js} +1 -2
- package/dist/atomic/components/facet-guard.js.map +1 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/components/stencil-facet-value.js +39 -0
- package/dist/atomic/components/stencil-facet-value.js.map +1 -0
- package/dist/atomic/{p-aa3ac5aa.js → p-1f059522.js} +1 -1
- package/dist/atomic/p-1f059522.js.map +1 -0
- package/dist/atomic/{p-05dba6e2.entry.js → p-20019654.entry.js} +2 -2
- package/dist/atomic/{p-d31377a4.entry.js → p-30411cd4.entry.js} +2 -2
- package/dist/atomic/p-30411cd4.entry.js.map +1 -0
- package/dist/atomic/{p-48d78fc6.entry.js → p-3e38aea6.entry.js} +2 -2
- package/dist/atomic/{p-104b5cde.entry.js → p-44ef70b6.entry.js} +2 -2
- package/dist/atomic/{p-d5f6d919.entry.js → p-4ae14373.entry.js} +2 -2
- package/dist/atomic/p-4ae14373.entry.js.map +1 -0
- package/dist/atomic/{p-10da7681.entry.js → p-4b9a166f.entry.js} +2 -2
- package/dist/atomic/{p-f35578fa.entry.js → p-4bdc6d5a.entry.js} +2 -2
- package/dist/atomic/p-4bdc6d5a.entry.js.map +1 -0
- package/dist/atomic/{p-24df7251.entry.js → p-516b8165.entry.js} +2 -2
- package/dist/atomic/p-5ca21deb.js +2 -0
- package/dist/atomic/p-5ca21deb.js.map +1 -0
- package/dist/atomic/{p-90000114.entry.js → p-600edff9.entry.js} +2 -2
- package/dist/atomic/{p-f78bed94.entry.js → p-62afcf79.entry.js} +2 -2
- package/dist/atomic/p-74822069.entry.js +2 -0
- package/dist/atomic/p-74822069.entry.js.map +1 -0
- package/dist/atomic/{p-257b6839.js → p-7b3c0d3f.js} +2 -2
- package/dist/atomic/{p-85f165af.entry.js → p-8acb1466.entry.js} +2 -2
- package/dist/atomic/{p-6606c417.entry.js → p-aa616502.entry.js} +2 -2
- package/dist/atomic/{p-8de09498.entry.js → p-c66047b4.entry.js} +2 -2
- package/dist/atomic/{p-618c6967.entry.js → p-d2d22ab2.entry.js} +2 -2
- package/dist/atomic/p-dbc0ce5c.entry.js +2 -0
- package/dist/atomic/p-dbc0ce5c.entry.js.map +1 -0
- package/dist/atomic/{p-c41e6a99.entry.js → p-df1d50c8.entry.js} +2 -2
- package/dist/atomic/{p-b5ed8ce2.entry.js → p-e3edbf14.entry.js} +2 -2
- package/dist/atomic/{p-cc68642f.entry.js → p-f073a78d.entry.js} +2 -2
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-a22139ed.js → analytics-config-b2bfc979.js} +2 -2
- package/dist/cjs/{analytics-config-a22139ed.js.map → analytics-config-b2bfc979.js.map} +1 -1
- package/dist/cjs/atomic-category-facet.cjs.entry.js +2 -2
- package/dist/cjs/atomic-category-facet.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-facet.cjs.entry.js +453 -0
- package/dist/cjs/atomic-facet.cjs.entry.js.map +1 -0
- package/dist/cjs/atomic-format-currency.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-number.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-unit.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-facet.cjs.entry.js +10 -38
- package/dist/cjs/atomic-insight-facet.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-numeric-facet.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-numeric-facet.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-numeric-facet.cjs.entry.js +2 -2
- package/dist/cjs/atomic-numeric-facet.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview.cjs.entry.js +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-children.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-link.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-list.cjs.entry.js +1 -1
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js +2 -2
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
- package/dist/cjs/atomic.cjs.js +1 -1
- package/dist/cjs/{stencil-facet-guard-9573df7f.js → facet-guard-328b588d.js} +1 -2
- package/dist/cjs/facet-guard-328b588d.js.map +1 -0
- package/dist/cjs/index-757bc886.js +4 -0
- package/dist/cjs/stencil-facet-value-e67c9332.js +41 -0
- package/dist/cjs/stencil-facet-value-e67c9332.js.map +1 -0
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-fd21d751.js → analytics-config-2e82e70d.js} +2 -2
- package/dist/esm/{analytics-config-fd21d751.js.map → analytics-config-2e82e70d.js.map} +1 -1
- package/dist/esm/atomic-category-facet.entry.js +2 -2
- package/dist/esm/atomic-category-facet.entry.js.map +1 -1
- package/dist/esm/atomic-facet.entry.js +449 -0
- package/dist/esm/atomic-facet.entry.js.map +1 -0
- package/dist/esm/atomic-format-currency.entry.js +1 -1
- package/dist/esm/atomic-format-number.entry.js +1 -1
- package/dist/esm/atomic-format-unit.entry.js +1 -1
- package/dist/esm/atomic-insight-facet.entry.js +10 -38
- package/dist/esm/atomic-insight-facet.entry.js.map +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-numeric-facet.entry.js +2 -2
- package/dist/esm/atomic-insight-numeric-facet.entry.js.map +1 -1
- package/dist/esm/atomic-numeric-facet.entry.js +2 -2
- package/dist/esm/atomic-numeric-facet.entry.js.map +1 -1
- package/dist/esm/atomic-quickview-modal.entry.js +1 -1
- package/dist/esm/atomic-quickview.entry.js +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-result-children.entry.js +1 -1
- package/dist/esm/atomic-result-fields-list.entry.js +1 -1
- package/dist/esm/atomic-result-link.entry.js +1 -1
- package/dist/esm/atomic-result-list.entry.js +1 -1
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js +2 -2
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-tab-manager.entry.js +1 -1
- package/dist/esm/atomic.js +1 -1
- package/dist/esm/{stencil-facet-guard-edbfa966.js → facet-guard-4b795e90.js} +1 -2
- package/dist/esm/facet-guard-4b795e90.js.map +1 -0
- package/dist/esm/index-3f35faca.js +4 -0
- package/dist/esm/stencil-facet-value-30dc9b6c.js +39 -0
- package/dist/esm/stencil-facet-value-30dc9b6c.js.map +1 -0
- package/dist/esm/version.js +2 -2
- package/dist/types/components/search/{atomic-facet → facets/atomic-facet}/atomic-facet.d.ts +9 -13
- package/dist/types/components/search/index.d.ts +0 -1
- package/dist/types/components.d.ts +173 -0
- package/docs/atomic-docs.json +718 -1
- package/package.json +3 -3
- package/dist/atomic/components/components/common/facets/depends-on.js +0 -62
- package/dist/atomic/components/components/common/facets/popover/popover-type.js +0 -5
- package/dist/atomic/components/components/search/atomic-facet/atomic-facet.js +0 -613
- package/dist/atomic/components/stencil-facet-guard.js.map +0 -1
- package/dist/atomic/p-745b06c3.entry.js +0 -2
- package/dist/atomic/p-745b06c3.entry.js.map +0 -1
- package/dist/atomic/p-aa3ac5aa.js.map +0 -1
- package/dist/atomic/p-d31377a4.entry.js.map +0 -1
- package/dist/atomic/p-d5f6d919.entry.js.map +0 -1
- package/dist/atomic/p-f35578fa.entry.js.map +0 -1
- package/dist/cjs/stencil-facet-guard-9573df7f.js.map +0 -1
- package/dist/esm/stencil-facet-guard-edbfa966.js.map +0 -1
- /package/dist/atomic/{p-05dba6e2.entry.js.map → p-20019654.entry.js.map} +0 -0
- /package/dist/atomic/{p-48d78fc6.entry.js.map → p-3e38aea6.entry.js.map} +0 -0
- /package/dist/atomic/{p-104b5cde.entry.js.map → p-44ef70b6.entry.js.map} +0 -0
- /package/dist/atomic/{p-10da7681.entry.js.map → p-4b9a166f.entry.js.map} +0 -0
- /package/dist/atomic/{p-24df7251.entry.js.map → p-516b8165.entry.js.map} +0 -0
- /package/dist/atomic/{p-90000114.entry.js.map → p-600edff9.entry.js.map} +0 -0
- /package/dist/atomic/{p-f78bed94.entry.js.map → p-62afcf79.entry.js.map} +0 -0
- /package/dist/atomic/{p-257b6839.js.map → p-7b3c0d3f.js.map} +0 -0
- /package/dist/atomic/{p-85f165af.entry.js.map → p-8acb1466.entry.js.map} +0 -0
- /package/dist/atomic/{p-6606c417.entry.js.map → p-aa616502.entry.js.map} +0 -0
- /package/dist/atomic/{p-8de09498.entry.js.map → p-c66047b4.entry.js.map} +0 -0
- /package/dist/atomic/{p-618c6967.entry.js.map → p-d2d22ab2.entry.js.map} +0 -0
- /package/dist/atomic/{p-c41e6a99.entry.js.map → p-df1d50c8.entry.js.map} +0 -0
- /package/dist/atomic/{p-b5ed8ce2.entry.js.map → p-e3edbf14.entry.js.map} +0 -0
- /package/dist/atomic/{p-cc68642f.entry.js.map → p-f073a78d.entry.js.map} +0 -0
- /package/dist/types/components/common/facets/{stencil-facet-guard.d.ts → facet-guard.d.ts} +0 -0
@@ -1,613 +0,0 @@
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
-
};
|
7
|
-
import { buildFacet, buildFacetConditionsManager, buildSearchStatus, buildTabManager, } from '@coveo/headless';
|
8
|
-
import { html, LitElement, nothing } from 'lit';
|
9
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
10
|
-
import { when } from 'lit/directives/when.js';
|
11
|
-
import { bindStateToController } from "../../../decorators/bind-state";
|
12
|
-
import { bindingGuard } from "../../../decorators/binding-guard";
|
13
|
-
import { bindings } from "../../../decorators/bindings";
|
14
|
-
import { errorGuard } from "../../../decorators/error-guard";
|
15
|
-
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles";
|
16
|
-
import { mapProperty } from "../../../utils/props-utils";
|
17
|
-
import { AriaLiveRegionController, FocusTargetController, } from '../../../utils/accessibility-utils';
|
18
|
-
import { getFieldCaptions } from '../../../utils/field-utils';
|
19
|
-
import { parseDependsOn } from '../../common/facets/depends-on';
|
20
|
-
import { renderFacetContainer } from '../../common/facets/facet-container/facet-container';
|
21
|
-
import { renderFacetHeader } from '../../common/facets/facet-header/facet-header';
|
22
|
-
import { announceFacetSearchResultsWithAriaLive } from '../../common/facets/facet-search/facet-search-aria-live';
|
23
|
-
import { renderFacetSearchInput } from '../../common/facets/facet-search/facet-search-input';
|
24
|
-
import { facetSearchInputGuard } from '../../common/facets/facet-search/facet-search-input-guard';
|
25
|
-
import { renderFacetSearchMatches } from '../../common/facets/facet-search/facet-search-matches';
|
26
|
-
import { shouldDisplaySearchResults, shouldUpdateFacetSearchComponent, } from '../../common/facets/facet-search/facet-search-utils';
|
27
|
-
import { renderFacetShowMoreLess } from '../../common/facets/facet-show-more-less/facet-show-more-less';
|
28
|
-
import { renderFacetValue, } from '../../common/facets/facet-value/facet-value';
|
29
|
-
import { renderFacetValuesGroup } from '../../common/facets/facet-values-group/facet-values-group';
|
30
|
-
import { initializePopover } from '../../common/facets/popover/popover-type';
|
31
|
-
import '../../common/atomic-facet-placeholder/atomic-facet-placeholder';
|
32
|
-
import { booleanConverter } from "../../../converters/boolean-converter";
|
33
|
-
import facetCommonStyles from '../../common/facets/facet-common.tw.css';
|
34
|
-
import facetSearchStyles from '../../common/facets/facet-search/facet-search.tw.css';
|
35
|
-
import facetValueBoxStyles from '../../common/facets/facet-value-box/facet-value-box.tw.css';
|
36
|
-
import facetValueCheckboxStyles from '../../common/facets/facet-value-checkbox/facet-value-checkbox.tw.css';
|
37
|
-
import facetValueExcludeStyles from '../../common/facets/facet-value-exclude/facet-value-exclude.tw.css';
|
38
|
-
/**
|
39
|
-
* A facet is a list of values for a certain field occurring in the results, ordered using a configurable criteria (e.g., number of occurrences).
|
40
|
-
* An `atomic-facet` displays a facet of the results for the current query.
|
41
|
-
*
|
42
|
-
* @part facet - The wrapper for the entire facet.
|
43
|
-
* @part placeholder - The placeholder shown before the first search is executed.
|
44
|
-
*
|
45
|
-
* @part label-button - The button that displays the label and allows to expand/collapse the facet.
|
46
|
-
* @part label-button-icon - The label button icon.
|
47
|
-
* @part clear-button - The button that resets the actively selected facet values.
|
48
|
-
* @part clear-button-icon - The clear button icon.
|
49
|
-
*
|
50
|
-
* @part search-wrapper - The search box wrapper.
|
51
|
-
* @part search-input - The search box input.
|
52
|
-
* @part search-icon - The search box submit button.
|
53
|
-
* @part search-clear-button - The button to clear the search box of input.
|
54
|
-
* @part more-matches - The label indicating there are more matches for the current facet search query.
|
55
|
-
* @part no-matches - The label indicating there are no matches for the current facet search query.
|
56
|
-
* @part matches-query - The highlighted query inside the matches labels.
|
57
|
-
* @part search-highlight - The highlighted query inside the facet values.
|
58
|
-
*
|
59
|
-
* @part values - The facet values container.
|
60
|
-
* @part value-label - The facet value label, common for all displays.
|
61
|
-
* @part value-count - The facet value count, common for all displays.
|
62
|
-
*
|
63
|
-
* @part value-checkbox - The facet value checkbox, available when display is 'checkbox'.
|
64
|
-
* @part value-checkbox-checked - The checked facet value checkbox, available when display is 'checkbox'.
|
65
|
-
* @part value-checkbox-label - The facet value checkbox clickable label, available when display is 'checkbox'.
|
66
|
-
* @part value-checkbox-icon - The facet value checkbox icon, available when display is 'checkbox'.
|
67
|
-
* @part value-link - The facet value when display is 'link'.
|
68
|
-
* @part value-link-selected - The selected facet value when display is 'link'.
|
69
|
-
* @part value-box - The facet value when display is 'box'.
|
70
|
-
* @part value-box-selected - The selected facet value when display is 'box'.
|
71
|
-
* @part value-exclude-button - The button to exclude a facet value, available when display is 'checkbox'.
|
72
|
-
*
|
73
|
-
* @part show-more - The show more results button.
|
74
|
-
* @part show-less - The show less results button.
|
75
|
-
* @part show-more-less-icon - The icons of the show more & show less buttons.
|
76
|
-
*/
|
77
|
-
let AtomicFacet = class AtomicFacet extends LitElement {
|
78
|
-
constructor() {
|
79
|
-
super(...arguments);
|
80
|
-
/**
|
81
|
-
* The non-localized label for the facet.
|
82
|
-
* Used in the `atomic-breadbox` component through the bindings store.
|
83
|
-
*/
|
84
|
-
this.label = 'no-label';
|
85
|
-
/**
|
86
|
-
* The tabs on which the facet can be displayed. This property should not be used at the same time as `tabs-excluded`.
|
87
|
-
*
|
88
|
-
* Set this property as a stringified JSON array, e.g.,
|
89
|
-
* ```html
|
90
|
-
* <atomic-facet tabs-included='["tabIDA", "tabIDB"]'></atomic-facet>
|
91
|
-
* ```
|
92
|
-
* If you don't set this property, the facet can be displayed on any tab. Otherwise, the facet can only be displayed on the specified tabs.
|
93
|
-
*/
|
94
|
-
this.tabsIncluded = [];
|
95
|
-
/**
|
96
|
-
* The tabs on which this facet must not be displayed. This property should not be used at the same time as `tabs-included`.
|
97
|
-
*
|
98
|
-
* Set this property as a stringified JSON array, e.g.,
|
99
|
-
* ```html
|
100
|
-
* <atomic-facet tabs-excluded='["tabIDA", "tabIDB"]'></atomic-facet>
|
101
|
-
* ```
|
102
|
-
* If you don't set this property, the facet can be displayed on any tab. Otherwise, the facet won't be displayed on any of the specified tabs.
|
103
|
-
*/
|
104
|
-
this.tabsExcluded = [];
|
105
|
-
/**
|
106
|
-
* The number of values to request for this facet.
|
107
|
-
* Also determines the number of additional values to request each time more values are shown.
|
108
|
-
*/
|
109
|
-
this.numberOfValues = 8;
|
110
|
-
/**
|
111
|
-
* Whether this facet should contain a search box.
|
112
|
-
*
|
113
|
-
*/
|
114
|
-
this.withSearch = true;
|
115
|
-
/**
|
116
|
-
* The sort criterion to apply to the returned facet values.
|
117
|
-
* Possible values are 'score', 'alphanumeric', 'alphanumericDescending', 'occurrences', alphanumericNatural', 'alphanumericNaturalDescending' and 'automatic'.
|
118
|
-
*/
|
119
|
-
this.sortCriteria = 'automatic';
|
120
|
-
/**
|
121
|
-
* Specifies how a result must match the selected facet values.
|
122
|
-
* Allowed values:
|
123
|
-
* - `atLeastOneValue`: A result will match if at least one of the corresponding facet values is selected.
|
124
|
-
* - `allValues`: A result will match if all corresponding facet values are selected.
|
125
|
-
*/
|
126
|
-
this.resultsMustMatch = 'atLeastOneValue';
|
127
|
-
/**
|
128
|
-
* Whether to display the facet values as checkboxes (multiple selection), links (single selection) or boxes (multiple selection).
|
129
|
-
* Possible values are 'checkbox', 'link', and 'box'.
|
130
|
-
*/
|
131
|
-
this.displayValuesAs = 'checkbox';
|
132
|
-
/**
|
133
|
-
* Specifies whether the facet is collapsed. When the facet is the child of an `atomic-facet-manager` component, the facet manager controls this property.
|
134
|
-
*/
|
135
|
-
this.isCollapsed = false;
|
136
|
-
/**
|
137
|
-
* The [heading level](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements) to use for the heading over the facet, from 1 to 6.
|
138
|
-
*/
|
139
|
-
this.headingLevel = 0;
|
140
|
-
/**
|
141
|
-
* Whether to exclude the parents of folded results when estimating the result count for each facet value.
|
142
|
-
*
|
143
|
-
*
|
144
|
-
* Note: Resulting count is only an estimation, in some cases this value could be incorrect.
|
145
|
-
*/
|
146
|
-
this.filterFacetCount = true;
|
147
|
-
/**
|
148
|
-
* Whether to allow excluding values from the facet.
|
149
|
-
*/
|
150
|
-
this.enableExclusion = false;
|
151
|
-
/**
|
152
|
-
* The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
|
153
|
-
* Note: A high injectionDepth may negatively impact the facet request performance.
|
154
|
-
* Minimum: `0`
|
155
|
-
* Default: `1000`
|
156
|
-
*/
|
157
|
-
this.injectionDepth = 1000;
|
158
|
-
/**
|
159
|
-
* The required facets and values for this facet to be displayed.
|
160
|
-
* Examples:
|
161
|
-
* ```html
|
162
|
-
* <atomic-facet facet-id="abc" field="objecttype" ...></atomic-facet>
|
163
|
-
*
|
164
|
-
* <!-- To show the facet when any value is selected in the facet with id "abc": -->
|
165
|
-
* <atomic-facet
|
166
|
-
* depends-on-abc
|
167
|
-
* ...
|
168
|
-
* ></atomic-facet>
|
169
|
-
*
|
170
|
-
* <!-- To show the facet when value "doc" is selected in the facet with id "abc": -->
|
171
|
-
* <atomic-facet
|
172
|
-
* depends-on-abc="doc"
|
173
|
-
* ...
|
174
|
-
* ></atomic-facet>
|
175
|
-
* ```
|
176
|
-
*/
|
177
|
-
this.dependsOn = {};
|
178
|
-
/**
|
179
|
-
* Specifies an explicit list of `allowedValues` in the Search API request, as a JSON string representation.
|
180
|
-
*
|
181
|
-
* If you specify a list of values for this option, the facet uses only these values (if they are available in
|
182
|
-
* the current result set).
|
183
|
-
*
|
184
|
-
* Example:
|
185
|
-
*
|
186
|
-
* The following facet only uses the `Contact`, `Account`, and `File` values of the `objecttype` field. Even if the
|
187
|
-
* current result set contains other `objecttype` values, such as `Message`, or `Product`, the facet does not use
|
188
|
-
* those other values.
|
189
|
-
*
|
190
|
-
* ```html
|
191
|
-
* <atomic-facet field="objecttype" allowed-values='["Contact","Account","File"]'></atomic-facet>
|
192
|
-
* ```
|
193
|
-
*
|
194
|
-
* The maximum amount of allowed values is 25.
|
195
|
-
*
|
196
|
-
* Default value is `undefined`, and the facet uses all available values for its `field` in the current result set.
|
197
|
-
*/
|
198
|
-
this.allowedValues = [];
|
199
|
-
/**
|
200
|
-
* Identifies the facet values that must appear at the top, in this order.
|
201
|
-
* This parameter can be used in conjunction with the `sortCriteria` parameter.
|
202
|
-
*
|
203
|
-
* Facet values not part of the `customSort` list will be sorted according to the `sortCriteria`.
|
204
|
-
*
|
205
|
-
* Example:
|
206
|
-
*
|
207
|
-
* The following facet will sort the `Contact`, `Account`, and `File` values at the top of the list for the `objecttype` field.
|
208
|
-
*
|
209
|
-
* If there are more than these 3 values available, the rest of the list will be sorted using `occurrences`.
|
210
|
-
*
|
211
|
-
* ```html
|
212
|
-
* <atomic-facet field="objecttype" custom-sort='["Contact","Account","File"]' sort-criteria='occurrences'></atomic-facet>
|
213
|
-
* ```
|
214
|
-
* The maximum amount of custom sort values is 25.
|
215
|
-
*
|
216
|
-
* The default value is `undefined`, and the facet values will be sorted using only the `sortCriteria`.
|
217
|
-
*/
|
218
|
-
this.customSort = [];
|
219
|
-
}
|
220
|
-
initialize() {
|
221
|
-
if ([...this.tabsIncluded].length > 0 &&
|
222
|
-
[...this.tabsExcluded].length > 0) {
|
223
|
-
console.warn('Values for both "tabs-included" and "tabs-excluded" have been provided. This is could lead to unexpected behaviors.');
|
224
|
-
}
|
225
|
-
if (this.displayValuesAs !== 'checkbox' && this.enableExclusion) {
|
226
|
-
console.warn('The "enableExclusion" property is only available when "displayValuesAs" is set to "checkbox".');
|
227
|
-
}
|
228
|
-
this.facet = buildFacet(this.bindings.engine, { options: this.facetOptions });
|
229
|
-
this.facetId = this.facet.state.facetId;
|
230
|
-
this.searchStatus = buildSearchStatus(this.bindings.engine);
|
231
|
-
this.tabManager = buildTabManager(this.bindings.engine);
|
232
|
-
this.initAriaLive();
|
233
|
-
this.initConditionManager();
|
234
|
-
this.initPopover();
|
235
|
-
this.registerFacet();
|
236
|
-
}
|
237
|
-
disconnectedCallback() {
|
238
|
-
super.disconnectedCallback();
|
239
|
-
this.facetConditionsManager?.stopWatching();
|
240
|
-
}
|
241
|
-
shouldUpdate(changedProperties) {
|
242
|
-
if (changedProperties.has('facetState')) {
|
243
|
-
const currentFacetState = this.facetState;
|
244
|
-
const previousFacetState = changedProperties.get('facetState');
|
245
|
-
if (previousFacetState && currentFacetState) {
|
246
|
-
return shouldUpdateFacetSearchComponent(currentFacetState.facetSearch, previousFacetState.facetSearch);
|
247
|
-
}
|
248
|
-
}
|
249
|
-
return super.shouldUpdate(changedProperties);
|
250
|
-
}
|
251
|
-
shouldRenderFacet() {
|
252
|
-
return (!this.searchStatusState.hasError &&
|
253
|
-
this.facetState.enabled &&
|
254
|
-
(!this.searchStatusState.firstSearchExecuted ||
|
255
|
-
this.facetState.values.length > 0));
|
256
|
-
}
|
257
|
-
render() {
|
258
|
-
return html `${when(this.shouldRenderFacet(), () => this.searchStatusState.firstSearchExecuted
|
259
|
-
? renderFacetContainer()(html `
|
260
|
-
${this.renderFacetHeader()}
|
261
|
-
${this.renderBody()}
|
262
|
-
`)
|
263
|
-
: html `<atomic-facet-placeholder
|
264
|
-
value-count="${this.numberOfValues}"
|
265
|
-
></atomic-facet-placeholder>`)}`;
|
266
|
-
}
|
267
|
-
renderFacetHeader() {
|
268
|
-
return html `${renderFacetHeader({
|
269
|
-
props: {
|
270
|
-
i18n: this.bindings.i18n,
|
271
|
-
label: this.definedLabel,
|
272
|
-
onClearFilters: () => {
|
273
|
-
this.focusTargets.header.focusAfterSearch();
|
274
|
-
this.facet.deselectAll();
|
275
|
-
},
|
276
|
-
numberOfActiveValues: this.activeValues.length,
|
277
|
-
isCollapsed: this.isCollapsed,
|
278
|
-
headingLevel: this.headingLevel,
|
279
|
-
onToggleCollapse: () => {
|
280
|
-
this.isCollapsed = !this.isCollapsed;
|
281
|
-
},
|
282
|
-
headerRef: (el) => this.focusTargets.header.setTarget(el),
|
283
|
-
},
|
284
|
-
})}`;
|
285
|
-
}
|
286
|
-
renderBody() {
|
287
|
-
if (this.isCollapsed) {
|
288
|
-
return nothing;
|
289
|
-
}
|
290
|
-
return html `
|
291
|
-
${facetSearchInputGuard({
|
292
|
-
canShowMoreValues: this.facetState.canShowMoreValues,
|
293
|
-
numberOfDisplayedValues: this.facetState.values.length,
|
294
|
-
withSearch: this.withSearch,
|
295
|
-
}, () => renderFacetSearchInput({
|
296
|
-
props: {
|
297
|
-
i18n: this.bindings.i18n,
|
298
|
-
label: this.definedLabel,
|
299
|
-
onChange: (value) => {
|
300
|
-
if (value === '') {
|
301
|
-
this.facet.facetSearch.clear();
|
302
|
-
return;
|
303
|
-
}
|
304
|
-
this.facet.facetSearch.updateCaptions(getFieldCaptions(this.field, this.bindings.i18n));
|
305
|
-
this.facet.facetSearch.updateText(value);
|
306
|
-
this.facet.facetSearch.search();
|
307
|
-
},
|
308
|
-
onClear: () => this.facet.facetSearch.clear(),
|
309
|
-
query: this.facetState.facetSearch.query,
|
310
|
-
},
|
311
|
-
}))}
|
312
|
-
${shouldDisplaySearchResults(this.facetState.facetSearch)
|
313
|
-
? html `${this.renderSearchResults()}${this.renderMatches()}`
|
314
|
-
: html `${this.renderValues()}${this.renderShowMoreLess()}`}
|
315
|
-
`;
|
316
|
-
}
|
317
|
-
renderValuesContainer(children, query) {
|
318
|
-
const classes = `mt-3 ${this.displayValuesAs === 'box' ? 'box-container' : ''}`;
|
319
|
-
return renderFacetValuesGroup({
|
320
|
-
props: {
|
321
|
-
i18n: this.bindings.i18n,
|
322
|
-
label: this.label,
|
323
|
-
query,
|
324
|
-
},
|
325
|
-
})(html `<ul class="${classes}" part="values">
|
326
|
-
${children}
|
327
|
-
</ul>`);
|
328
|
-
}
|
329
|
-
renderSearchResults() {
|
330
|
-
return this.renderValuesContainer(this.facet.state.facetSearch.values.map((value) => renderFacetValue({
|
331
|
-
props: {
|
332
|
-
...this.facetValueProps,
|
333
|
-
facetState: 'idle',
|
334
|
-
facetCount: value.count,
|
335
|
-
onExclude: () => this.facet.facetSearch.exclude(value),
|
336
|
-
onSelect: () => this.displayValuesAs === 'link'
|
337
|
-
? this.facet.facetSearch.singleSelect(value)
|
338
|
-
: this.facet.facetSearch.select(value),
|
339
|
-
facetValue: value.rawValue,
|
340
|
-
},
|
341
|
-
})));
|
342
|
-
}
|
343
|
-
renderValues() {
|
344
|
-
return this.renderValuesContainer(this.facet.state.values.map((value, i) => {
|
345
|
-
const shouldFocusOnShowLessAfterInteraction = i === 0;
|
346
|
-
const shouldFocusOnShowMoreAfterInteraction = i ===
|
347
|
-
(this.sortCriteria === 'automatic'
|
348
|
-
? 0
|
349
|
-
: this.facet.state.values.length - this.numberOfValues);
|
350
|
-
return renderFacetValue({
|
351
|
-
props: {
|
352
|
-
...this.facetValueProps,
|
353
|
-
facetCount: value.numberOfResults,
|
354
|
-
onExclude: () => this.facet.toggleExclude(value),
|
355
|
-
onSelect: () => this.displayValuesAs === 'link'
|
356
|
-
? this.facet.toggleSingleSelect(value)
|
357
|
-
: this.facet.toggleSelect(value),
|
358
|
-
facetValue: value.value,
|
359
|
-
facetState: value.state,
|
360
|
-
setRef: (btn) => {
|
361
|
-
if (shouldFocusOnShowLessAfterInteraction) {
|
362
|
-
this.showLessFocus?.setTarget(btn);
|
363
|
-
}
|
364
|
-
if (shouldFocusOnShowMoreAfterInteraction) {
|
365
|
-
this.showMoreFocus?.setTarget(btn);
|
366
|
-
}
|
367
|
-
},
|
368
|
-
},
|
369
|
-
});
|
370
|
-
}));
|
371
|
-
}
|
372
|
-
renderShowMoreLess() {
|
373
|
-
return renderFacetShowMoreLess({
|
374
|
-
props: {
|
375
|
-
label: this.label,
|
376
|
-
i18n: this.bindings.i18n,
|
377
|
-
onShowMore: () => {
|
378
|
-
this.focusTargets.showMore.focusAfterSearch();
|
379
|
-
this.facet.showMoreValues();
|
380
|
-
},
|
381
|
-
onShowLess: () => {
|
382
|
-
this.focusTargets.showLess.focusAfterSearch();
|
383
|
-
this.facet.showLessValues();
|
384
|
-
},
|
385
|
-
canShowMoreValues: this.facet.state.canShowMoreValues,
|
386
|
-
canShowLessValues: this.facet.state.canShowLessValues,
|
387
|
-
},
|
388
|
-
});
|
389
|
-
}
|
390
|
-
renderMatches() {
|
391
|
-
return renderFacetSearchMatches({
|
392
|
-
props: {
|
393
|
-
i18n: this.bindings.i18n,
|
394
|
-
query: this.facet.state.facetSearch.query,
|
395
|
-
numberOfMatches: this.facet.state.facetSearch.values.length,
|
396
|
-
hasMoreMatches: this.facet.state.facetSearch.moreValuesAvailable,
|
397
|
-
showMoreMatches: () => this.facet.facetSearch.showMoreResults(),
|
398
|
-
},
|
399
|
-
});
|
400
|
-
}
|
401
|
-
get activeValues() {
|
402
|
-
return this.facet.state.values.filter(({ state }) => state !== 'idle');
|
403
|
-
}
|
404
|
-
get facetOptions() {
|
405
|
-
return {
|
406
|
-
facetId: this.facetId,
|
407
|
-
field: this.field,
|
408
|
-
numberOfValues: this.numberOfValues,
|
409
|
-
sortCriteria: this.sortCriteria,
|
410
|
-
resultsMustMatch: this.resultsMustMatch,
|
411
|
-
facetSearch: { numberOfValues: this.numberOfValues },
|
412
|
-
filterFacetCount: this.filterFacetCount,
|
413
|
-
injectionDepth: this.injectionDepth,
|
414
|
-
allowedValues: this.allowedValues.length
|
415
|
-
? [...this.allowedValues]
|
416
|
-
: undefined,
|
417
|
-
customSort: this.customSort.length ? [...this.customSort] : undefined,
|
418
|
-
tabs: {
|
419
|
-
included: [...this.tabsIncluded],
|
420
|
-
excluded: [...this.tabsExcluded],
|
421
|
-
},
|
422
|
-
};
|
423
|
-
}
|
424
|
-
get facetValueProps() {
|
425
|
-
return {
|
426
|
-
facetSearchQuery: this.facetState.facetSearch.query,
|
427
|
-
displayValuesAs: this.displayValuesAs,
|
428
|
-
enableExclusion: this.enableExclusion,
|
429
|
-
field: this.field,
|
430
|
-
i18n: this.bindings.i18n,
|
431
|
-
};
|
432
|
-
}
|
433
|
-
get isHidden() {
|
434
|
-
return !this.facet.state.enabled || !this.facet.state.values.length;
|
435
|
-
}
|
436
|
-
get host() {
|
437
|
-
return this;
|
438
|
-
}
|
439
|
-
initConditionManager() {
|
440
|
-
this.facetConditionsManager = buildFacetConditionsManager(this.bindings.engine, {
|
441
|
-
facetId: this.facetId,
|
442
|
-
conditions: parseDependsOn(this.dependsOn),
|
443
|
-
});
|
444
|
-
}
|
445
|
-
registerFacet() {
|
446
|
-
this.bindings.store.registerFacet('facets', this.facetInfo);
|
447
|
-
}
|
448
|
-
initPopover() {
|
449
|
-
initializePopover(this.host, {
|
450
|
-
...this.facetInfo,
|
451
|
-
hasValues: () => !!this.facet.state.values.length,
|
452
|
-
numberOfActiveValues: () => this.activeValues.length,
|
453
|
-
});
|
454
|
-
}
|
455
|
-
initAriaLive() {
|
456
|
-
this.facetSearchAriaLive = new AriaLiveRegionController(this, 'facet-search');
|
457
|
-
announceFacetSearchResultsWithAriaLive(this.facet, this.label, (msg) => {
|
458
|
-
this.facetSearchAriaLive.message = msg;
|
459
|
-
}, this.bindings.i18n);
|
460
|
-
}
|
461
|
-
get facetInfo() {
|
462
|
-
return {
|
463
|
-
label: () => this.bindings.i18n.t(this.label),
|
464
|
-
facetId: this.facetId,
|
465
|
-
element: this.host,
|
466
|
-
isHidden: () => this.isHidden,
|
467
|
-
};
|
468
|
-
}
|
469
|
-
get definedLabel() {
|
470
|
-
return this.label === 'no-label' && this.facetState?.label
|
471
|
-
? this.facetState.label
|
472
|
-
: this.label;
|
473
|
-
}
|
474
|
-
get focusTargets() {
|
475
|
-
if (!this.showLessFocus) {
|
476
|
-
this.showLessFocus = new FocusTargetController(this, this.bindings);
|
477
|
-
}
|
478
|
-
if (!this.showMoreFocus) {
|
479
|
-
this.showMoreFocus = new FocusTargetController(this, this.bindings);
|
480
|
-
}
|
481
|
-
if (!this.headerFocus) {
|
482
|
-
this.headerFocus = new FocusTargetController(this, this.bindings);
|
483
|
-
}
|
484
|
-
return {
|
485
|
-
showLess: this.showLessFocus,
|
486
|
-
showMore: this.showMoreFocus,
|
487
|
-
header: this.headerFocus,
|
488
|
-
};
|
489
|
-
}
|
490
|
-
};
|
491
|
-
AtomicFacet.styles = [
|
492
|
-
facetCommonStyles,
|
493
|
-
facetSearchStyles,
|
494
|
-
facetValueCheckboxStyles,
|
495
|
-
facetValueExcludeStyles,
|
496
|
-
facetValueBoxStyles,
|
497
|
-
];
|
498
|
-
__decorate([
|
499
|
-
state()
|
500
|
-
], AtomicFacet.prototype, "bindings", void 0);
|
501
|
-
__decorate([
|
502
|
-
bindStateToController('facet'),
|
503
|
-
state()
|
504
|
-
], AtomicFacet.prototype, "facetState", void 0);
|
505
|
-
__decorate([
|
506
|
-
bindStateToController('searchStatus'),
|
507
|
-
state()
|
508
|
-
], AtomicFacet.prototype, "searchStatusState", void 0);
|
509
|
-
__decorate([
|
510
|
-
bindStateToController('tabManager'),
|
511
|
-
state()
|
512
|
-
], AtomicFacet.prototype, "tabManagerState", void 0);
|
513
|
-
__decorate([
|
514
|
-
state()
|
515
|
-
], AtomicFacet.prototype, "error", void 0);
|
516
|
-
__decorate([
|
517
|
-
property({ type: String, attribute: 'facet-id', reflect: true })
|
518
|
-
], AtomicFacet.prototype, "facetId", void 0);
|
519
|
-
__decorate([
|
520
|
-
property({ type: String, reflect: true })
|
521
|
-
], AtomicFacet.prototype, "label", void 0);
|
522
|
-
__decorate([
|
523
|
-
property({ type: String, reflect: true })
|
524
|
-
], AtomicFacet.prototype, "field", void 0);
|
525
|
-
__decorate([
|
526
|
-
property({
|
527
|
-
type: Array,
|
528
|
-
attribute: 'tabs-included',
|
529
|
-
reflect: true,
|
530
|
-
})
|
531
|
-
], AtomicFacet.prototype, "tabsIncluded", void 0);
|
532
|
-
__decorate([
|
533
|
-
property({
|
534
|
-
type: Array,
|
535
|
-
attribute: 'tabs-excluded',
|
536
|
-
reflect: true,
|
537
|
-
})
|
538
|
-
], AtomicFacet.prototype, "tabsExcluded", void 0);
|
539
|
-
__decorate([
|
540
|
-
property({ type: Number, attribute: 'number-of-values', reflect: true })
|
541
|
-
], AtomicFacet.prototype, "numberOfValues", void 0);
|
542
|
-
__decorate([
|
543
|
-
property({
|
544
|
-
type: Boolean,
|
545
|
-
converter: booleanConverter,
|
546
|
-
attribute: 'with-search',
|
547
|
-
reflect: true,
|
548
|
-
})
|
549
|
-
], AtomicFacet.prototype, "withSearch", void 0);
|
550
|
-
__decorate([
|
551
|
-
property({ type: String, attribute: 'sort-criteria', reflect: true })
|
552
|
-
], AtomicFacet.prototype, "sortCriteria", void 0);
|
553
|
-
__decorate([
|
554
|
-
property({ type: String, attribute: 'results-must-match', reflect: true })
|
555
|
-
], AtomicFacet.prototype, "resultsMustMatch", void 0);
|
556
|
-
__decorate([
|
557
|
-
property({ type: String, attribute: 'display-values-as', reflect: true })
|
558
|
-
], AtomicFacet.prototype, "displayValuesAs", void 0);
|
559
|
-
__decorate([
|
560
|
-
property({
|
561
|
-
type: Boolean,
|
562
|
-
converter: booleanConverter,
|
563
|
-
attribute: 'is-collapsed',
|
564
|
-
reflect: true,
|
565
|
-
})
|
566
|
-
], AtomicFacet.prototype, "isCollapsed", void 0);
|
567
|
-
__decorate([
|
568
|
-
property({ type: Number, attribute: 'heading-level', reflect: true })
|
569
|
-
], AtomicFacet.prototype, "headingLevel", void 0);
|
570
|
-
__decorate([
|
571
|
-
property({
|
572
|
-
type: Boolean,
|
573
|
-
converter: booleanConverter,
|
574
|
-
attribute: 'filter-facet-count',
|
575
|
-
reflect: true,
|
576
|
-
})
|
577
|
-
], AtomicFacet.prototype, "filterFacetCount", void 0);
|
578
|
-
__decorate([
|
579
|
-
property({
|
580
|
-
type: Boolean,
|
581
|
-
converter: booleanConverter,
|
582
|
-
attribute: 'enable-exclusion',
|
583
|
-
reflect: true,
|
584
|
-
})
|
585
|
-
], AtomicFacet.prototype, "enableExclusion", void 0);
|
586
|
-
__decorate([
|
587
|
-
property({ type: Number, attribute: 'injection-depth' })
|
588
|
-
], AtomicFacet.prototype, "injectionDepth", void 0);
|
589
|
-
__decorate([
|
590
|
-
mapProperty({ attributePrefix: 'depends-on' })
|
591
|
-
], AtomicFacet.prototype, "dependsOn", void 0);
|
592
|
-
__decorate([
|
593
|
-
property({
|
594
|
-
type: Array,
|
595
|
-
attribute: 'allowed-values',
|
596
|
-
})
|
597
|
-
], AtomicFacet.prototype, "allowedValues", void 0);
|
598
|
-
__decorate([
|
599
|
-
property({
|
600
|
-
type: Array,
|
601
|
-
attribute: 'custom-sort',
|
602
|
-
})
|
603
|
-
], AtomicFacet.prototype, "customSort", void 0);
|
604
|
-
__decorate([
|
605
|
-
bindingGuard(),
|
606
|
-
errorGuard()
|
607
|
-
], AtomicFacet.prototype, "render", null);
|
608
|
-
AtomicFacet = __decorate([
|
609
|
-
customElement('atomic-facet'),
|
610
|
-
bindings(),
|
611
|
-
withTailwindStyles
|
612
|
-
], AtomicFacet);
|
613
|
-
export { AtomicFacet };
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"stencil-facet-guard.js","mappings":";;;AAUA;MACa,UAAU,GAAyC,CAC9D,EAAC,QAAQ,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAC,EACpD,QAAQ;IAER,IAAI,QAAQ,IAAI,CAAC,OAAO,KAAK,mBAAmB,IAAI,CAAC,UAAU,CAAC,EAAE;QAChE,OAAO,EAAC,MAAM,OAAU,CAAC;KAC1B;IAED,OAAO,EAAC,QAAQ,QAAE,QAAQ,CAAY,CAAC;AACzC;;;;","names":[],"sources":["src/components/common/facets/stencil-facet-guard.tsx"],"sourcesContent":["import {Fragment, FunctionalComponent, h} from '@stencil/core';\nimport {Hidden} from '../stencil-hidden';\n\ninterface FacetGuardProps {\n hasError: boolean;\n enabled: boolean;\n firstSearchExecuted: boolean;\n hasResults: boolean;\n}\n\n// @deprecated - use the `when` directive instead for Lit\nexport const FacetGuard: FunctionalComponent<FacetGuardProps> = (\n {hasError, enabled, firstSearchExecuted, hasResults},\n children\n) => {\n if (hasError || !enabled || (firstSearchExecuted && !hasResults)) {\n return <Hidden></Hidden>;\n }\n\n return <Fragment>{children}</Fragment>;\n};\n"],"version":3}
|