@coveo/atomic 3.34.0-pre.b099da8035 → 3.34.0-pre.b429ebe8aa
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 +0 -4
- package/dist/atomic/components/_index.js +0 -2
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-category-facet.js +1 -1
- package/dist/atomic/components/atomic-facet.js +1 -1
- package/dist/atomic/components/atomic-field-condition.js +1 -1
- package/dist/atomic/components/atomic-field-condition.js.map +1 -1
- 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-history-toggle.js +2 -2
- package/dist/atomic/components/atomic-insight-history-toggle.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-children-template.js +1 -1
- package/dist/atomic/components/atomic-insight-result-children-template.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-template.js +1 -1
- package/dist/atomic/components/atomic-insight-result-template.js.map +1 -1
- package/dist/atomic/components/atomic-insight-user-actions-toggle.js +2 -2
- package/dist/atomic/components/atomic-insight-user-actions-toggle.js.map +1 -1
- package/dist/atomic/components/atomic-numeric-facet.js +1 -1
- package/dist/atomic/components/atomic-quickview-modal2.js +23 -23
- package/dist/atomic/components/atomic-quickview-modal2.js.map +1 -1
- package/dist/atomic/components/atomic-quickview.js +1 -1
- package/dist/atomic/components/atomic-recs-result-template.js +1 -1
- package/dist/atomic/components/atomic-recs-result-template.js.map +1 -1
- package/dist/atomic/components/atomic-result-children-template.js +1 -1
- package/dist/atomic/components/atomic-result-children-template.js.map +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-result-list.js.map +1 -1
- package/dist/atomic/components/atomic-result-table-placeholder2.js +1 -1
- package/dist/atomic/components/atomic-result-template.js +1 -1
- package/dist/atomic/components/atomic-result-template.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js +1 -1
- package/dist/atomic/components/atomic-search-box.js +5 -11
- package/dist/atomic/components/atomic-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
- package/dist/atomic/components/atomic-sort-dropdown.js +2 -2
- package/dist/atomic/components/atomic-sort-expression.js +1 -1
- package/dist/atomic/components/atomic-tab-manager.js +1 -1
- package/dist/atomic/components/clock.js +2 -2
- package/dist/atomic/components/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.js +17 -32
- package/dist/atomic/components/components/commerce/atomic-product-field-condition/atomic-product-field-condition.js +4 -3
- package/dist/atomic/components/components/commerce/atomic-product-template/atomic-product-template.js +3 -2
- package/dist/atomic/components/components/common/item-list/table-layout.js +1 -1
- package/dist/atomic/components/components/common/product-template/product-template-controller.js +16 -81
- package/dist/atomic/components/components/common/template-controller/base-template-controller.js +89 -0
- package/dist/atomic/components/components/common/{product-template/product-template-common.js → template-controller/template-utils.js} +11 -12
- package/dist/atomic/components/components/common/validate-props-controller/validate-props-controller.js +50 -0
- package/dist/atomic/components/components/search/atomic-relevance-inspector/atomic-relevance-inspector.js +100 -0
- package/dist/atomic/components/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.js +137 -0
- package/dist/atomic/components/components/search/atomic-search-interface/atomic-search-interface.js +11 -24
- package/dist/atomic/components/components/search/index.js +2 -0
- package/dist/atomic/components/components/search/lazy-index.js +2 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/components/{result-template-common.js → stencil-result-template-common.js} +1 -1
- package/dist/atomic/components/stencil-result-template-common.js.map +1 -0
- package/dist/atomic/components/table-element-utils.js.map +1 -1
- package/dist/atomic/components/utils/compare-utils.js +49 -0
- package/dist/atomic/{p-475124d2.entry.js → p-01511388.entry.js} +2 -2
- package/dist/atomic/{p-60800b2f.entry.js → p-0ed76e65.entry.js} +2 -2
- package/dist/atomic/{p-7fd5b6ac.entry.js → p-2213060b.entry.js} +2 -2
- package/dist/atomic/p-2213060b.entry.js.map +1 -0
- package/dist/atomic/{p-e7a25b00.entry.js → p-2895c42c.entry.js} +2 -2
- package/dist/atomic/p-2895c42c.entry.js.map +1 -0
- package/dist/atomic/{p-16f6c1f3.entry.js → p-2fb49fe8.entry.js} +2 -2
- package/dist/atomic/{p-13391e75.entry.js → p-3549a469.entry.js} +2 -2
- package/dist/atomic/{p-88af4470.entry.js → p-40c1dfcb.entry.js} +2 -2
- package/dist/atomic/{p-2250f505.js → p-4da8f827.js} +2 -2
- package/dist/atomic/p-4da8f827.js.map +1 -0
- package/dist/atomic/{p-1e59ce29.entry.js → p-4f34763d.entry.js} +2 -2
- package/dist/atomic/{p-7c3c5f07.entry.js → p-4f4c9a03.entry.js} +2 -2
- package/dist/atomic/p-4f4c9a03.entry.js.map +1 -0
- package/dist/atomic/{p-20764605.entry.js → p-52d5461a.entry.js} +2 -2
- package/dist/atomic/{p-406a288c.entry.js → p-6078667f.entry.js} +2 -2
- package/dist/atomic/{p-992bc2dc.js → p-60be00ad.js} +2 -2
- package/dist/atomic/{p-62e85c20.entry.js → p-6694e114.entry.js} +2 -2
- package/dist/atomic/p-6694e114.entry.js.map +1 -0
- package/dist/atomic/p-6f1bffa2.entry.js +2 -0
- package/dist/atomic/p-6f1bffa2.entry.js.map +1 -0
- package/dist/atomic/{p-3cbab25b.entry.js → p-7e971d15.entry.js} +2 -2
- package/dist/atomic/{p-4601eb93.entry.js → p-83d3857f.entry.js} +2 -2
- package/dist/atomic/{p-a1e5f767.entry.js → p-86f950a5.entry.js} +2 -2
- package/dist/atomic/p-86f950a5.entry.js.map +1 -0
- package/dist/atomic/{p-dbcef3a9.entry.js → p-87f69e53.entry.js} +2 -2
- package/dist/atomic/{p-6289adc7.entry.js → p-9239be63.entry.js} +2 -2
- package/dist/atomic/{p-aaea2ca1.entry.js → p-9a6ec803.entry.js} +2 -2
- package/dist/atomic/{p-aac849b0.entry.js → p-a3fac2ec.entry.js} +2 -2
- package/dist/atomic/{p-373448df.entry.js → p-a46d36dd.entry.js} +2 -2
- package/dist/atomic/p-a46d36dd.entry.js.map +1 -0
- package/dist/atomic/{p-e398835b.entry.js → p-b2b9e83f.entry.js} +2 -2
- package/dist/atomic/{p-8fdef8a3.entry.js → p-b313058c.entry.js} +2 -2
- package/dist/atomic/{p-0bdd730f.entry.js → p-b6ae0244.entry.js} +2 -2
- package/dist/atomic/{p-3a7a1a00.entry.js → p-bbfe727a.entry.js} +2 -2
- package/dist/atomic/{p-acd1a1d3.js → p-be0518ae.js} +1 -1
- package/dist/atomic/p-be0518ae.js.map +1 -0
- package/dist/atomic/{p-97ce3384.entry.js → p-be2a43f4.entry.js} +2 -2
- package/dist/atomic/{p-a5714bc4.entry.js → p-d211a422.entry.js} +2 -2
- package/dist/atomic/{p-c280cd05.js → p-e1cc5150.js} +1 -1
- package/dist/atomic/{p-9260dd7d.entry.js → p-ebd00891.entry.js} +2 -2
- package/dist/atomic/p-ebd00891.entry.js.map +1 -0
- package/dist/atomic/{p-5678a2ce.entry.js → p-f676b5ba.entry.js} +2 -2
- package/dist/atomic/p-f676b5ba.entry.js.map +1 -0
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-f75fd435.js → analytics-config-7fafe2ee.js} +2 -2
- package/dist/cjs/{analytics-config-f75fd435.js.map → analytics-config-7fafe2ee.js.map} +1 -1
- package/dist/cjs/atomic-category-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-field-condition.cjs.entry.js +3 -3
- package/dist/cjs/atomic-field-condition.cjs.entry.js.map +1 -1
- 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-history-toggle.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js +5 -5
- package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-template.cjs.entry.js +5 -5
- package/dist/cjs/atomic-insight-result-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-numeric-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js +23 -23
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js.map +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-recs-result-template.cjs.entry.js +5 -5
- package/dist/cjs/atomic-recs-result-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-children-template.cjs.entry.js +4 -4
- package/dist/cjs/atomic-result-children-template.cjs.entry.js.map +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 +2 -2
- package/dist/cjs/atomic-result-list.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-placeholder_8.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-template.cjs.entry.js +4 -4
- package/dist/cjs/atomic-result-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js +76 -0
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js.map +1 -0
- package/dist/cjs/atomic-search-box.cjs.entry.js +3 -3
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-sort-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/atomic-sort-expression.cjs.entry.js +1 -1
- package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
- package/dist/cjs/atomic.cjs.js +1 -1
- package/dist/cjs/clock-7aeb19d0.js +7 -0
- package/dist/cjs/clock-7aeb19d0.js.map +1 -0
- package/dist/cjs/index-757bc886.js +2 -6
- package/dist/cjs/{result-template-common-84bd4057.js → stencil-result-template-common-bb38948f.js} +2 -2
- package/dist/cjs/stencil-result-template-common-bb38948f.js.map +1 -0
- package/dist/cjs/{table-element-utils-4865b735.js → table-element-utils-2cc6dc82.js} +1 -1
- package/dist/cjs/table-element-utils-2cc6dc82.js.map +1 -0
- package/dist/cjs/version.cjs.js +1 -1
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-870dc878.js → analytics-config-a8c239d1.js} +2 -2
- package/dist/esm/{analytics-config-870dc878.js.map → analytics-config-a8c239d1.js.map} +1 -1
- package/dist/esm/atomic-category-facet.entry.js +1 -1
- package/dist/esm/atomic-facet.entry.js +1 -1
- package/dist/esm/atomic-field-condition.entry.js +2 -2
- package/dist/esm/atomic-field-condition.entry.js.map +1 -1
- 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-history-toggle.entry.js +2 -2
- package/dist/esm/atomic-insight-history-toggle.entry.js.map +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-result-children-template.entry.js +2 -2
- package/dist/esm/atomic-insight-result-children-template.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-template.entry.js +2 -2
- package/dist/esm/atomic-insight-result-template.entry.js.map +1 -1
- package/dist/esm/atomic-insight-user-actions-toggle.entry.js +2 -2
- package/dist/esm/atomic-insight-user-actions-toggle.entry.js.map +1 -1
- package/dist/esm/atomic-numeric-facet.entry.js +1 -1
- package/dist/esm/atomic-quickview-modal.entry.js +23 -23
- package/dist/esm/atomic-quickview-modal.entry.js.map +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-recs-result-template.entry.js +2 -2
- package/dist/esm/atomic-recs-result-template.entry.js.map +1 -1
- package/dist/esm/atomic-result-children-template.entry.js +2 -2
- package/dist/esm/atomic-result-children-template.entry.js.map +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 +2 -2
- package/dist/esm/atomic-result-list.entry.js.map +1 -1
- package/dist/esm/atomic-result-placeholder_8.entry.js +1 -1
- package/dist/esm/atomic-result-template.entry.js +2 -2
- package/dist/esm/atomic-result-template.entry.js.map +1 -1
- package/dist/esm/atomic-search-box-query-suggestions.entry.js +72 -0
- package/dist/esm/atomic-search-box-query-suggestions.entry.js.map +1 -0
- package/dist/esm/atomic-search-box.entry.js +3 -3
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-sort-dropdown.entry.js +2 -2
- package/dist/esm/atomic-sort-expression.entry.js +1 -1
- package/dist/esm/atomic-tab-manager.entry.js +1 -1
- package/dist/esm/atomic.js +1 -1
- package/dist/esm/clock-b1f5d7f7.js +5 -0
- package/dist/esm/clock-b1f5d7f7.js.map +1 -0
- package/dist/esm/index-3f35faca.js +2 -6
- package/dist/esm/{result-template-common-995b94f8.js → stencil-result-template-common-19af5cfb.js} +2 -2
- package/dist/esm/stencil-result-template-common-19af5cfb.js.map +1 -0
- package/dist/esm/{table-element-utils-49d22ec6.js → table-element-utils-1dbc5ef6.js} +1 -1
- package/dist/esm/table-element-utils-1dbc5ef6.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.d.ts +2 -3
- package/dist/types/components/common/facets/facet-search/facet-search-input-guard.d.ts +1 -1
- package/dist/types/components/common/no-items/guard.d.ts +1 -1
- package/dist/types/components/common/product-template/product-template-controller.d.ts +9 -19
- package/dist/types/components/common/product-template/stencil-product-template-common.d.ts +1 -1
- package/dist/types/components/common/refine-modal/guard.d.ts +1 -1
- package/dist/types/components/common/result-templates/result-template-controller.d.ts +16 -0
- package/dist/types/components/common/sort/sort-guard.d.ts +1 -1
- package/dist/types/components/common/template-controller/base-template-controller.d.ts +36 -0
- package/dist/types/components/common/template-controller/template-utils.d.ts +11 -0
- package/dist/types/components/common/validate-props-controller/validate-props-controller.d.ts +32 -0
- package/dist/types/components/insight/result-templates/atomic-insight-result-children-template/atomic-insight-result-children-template.d.ts +1 -1
- package/dist/types/components/search/atomic-relevance-inspector/atomic-relevance-inspector.d.ts +18 -8
- package/dist/types/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.d.ts +45 -0
- package/dist/types/components/search/atomic-search-interface/atomic-search-interface.d.ts +5 -3
- package/dist/types/components/search/index.d.ts +2 -0
- package/dist/types/components/search/result-templates/atomic-result-children-template/atomic-result-children-template.d.ts +1 -1
- package/dist/types/components.d.ts +0 -102
- package/dist/types/directives/hierarchical-path.d.ts +1 -1
- package/dist/types/utils/compare-utils.d.ts +9 -0
- package/docs/atomic-docs.json +1 -185
- package/package.json +1 -1
- package/dist/atomic/components/atomic-relevance-inspector.d.ts +0 -11
- package/dist/atomic/components/atomic-relevance-inspector.js +0 -53
- package/dist/atomic/components/atomic-relevance-inspector.js.map +0 -1
- package/dist/atomic/components/atomic-search-box-recent-queries.d.ts +0 -11
- package/dist/atomic/components/atomic-search-box-recent-queries.js +0 -8
- package/dist/atomic/components/atomic-search-box-recent-queries.js.map +0 -1
- package/dist/atomic/components/atomic-search-box-recent-queries2.js +0 -183
- package/dist/atomic/components/atomic-search-box-recent-queries2.js.map +0 -1
- package/dist/atomic/components/result-template-common.js.map +0 -1
- package/dist/atomic/p-2250f505.js.map +0 -1
- package/dist/atomic/p-373448df.entry.js.map +0 -1
- package/dist/atomic/p-5678a2ce.entry.js.map +0 -1
- package/dist/atomic/p-62e85c20.entry.js.map +0 -1
- package/dist/atomic/p-7c3c5f07.entry.js.map +0 -1
- package/dist/atomic/p-7fd5b6ac.entry.js.map +0 -1
- package/dist/atomic/p-9260dd7d.entry.js.map +0 -1
- package/dist/atomic/p-a1e5f767.entry.js.map +0 -1
- package/dist/atomic/p-acd1a1d3.js.map +0 -1
- package/dist/atomic/p-de687bed.entry.js +0 -2
- package/dist/atomic/p-de687bed.entry.js.map +0 -1
- package/dist/atomic/p-df4397ab.entry.js +0 -2
- package/dist/atomic/p-df4397ab.entry.js.map +0 -1
- package/dist/atomic/p-e7a25b00.entry.js.map +0 -1
- package/dist/cjs/atomic-relevance-inspector.cjs.entry.js +0 -38
- package/dist/cjs/atomic-relevance-inspector.cjs.entry.js.map +0 -1
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js +0 -234
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +0 -1
- package/dist/cjs/clock-f03ff827.js +0 -7
- package/dist/cjs/clock-f03ff827.js.map +0 -1
- package/dist/cjs/result-template-common-84bd4057.js.map +0 -1
- package/dist/cjs/table-element-utils-4865b735.js.map +0 -1
- package/dist/esm/atomic-relevance-inspector.entry.js +0 -34
- package/dist/esm/atomic-relevance-inspector.entry.js.map +0 -1
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js +0 -229
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +0 -1
- package/dist/esm/clock-add3e9a5.js +0 -5
- package/dist/esm/clock-add3e9a5.js.map +0 -1
- package/dist/esm/result-template-common-995b94f8.js.map +0 -1
- package/dist/esm/table-element-utils-49d22ec6.js.map +0 -1
- package/dist/types/components/common/product-template/product-template-common.d.ts +0 -6
- package/dist/types/components/search/search-box-suggestions/atomic-search-box-recent-queries/atomic-search-box-recent-queries.d.ts +0 -37
- /package/dist/atomic/components/components/{search/atomic-table-result → common}/table-element-utils.js +0 -0
- /package/dist/atomic/{p-475124d2.entry.js.map → p-01511388.entry.js.map} +0 -0
- /package/dist/atomic/{p-60800b2f.entry.js.map → p-0ed76e65.entry.js.map} +0 -0
- /package/dist/atomic/{p-16f6c1f3.entry.js.map → p-2fb49fe8.entry.js.map} +0 -0
- /package/dist/atomic/{p-13391e75.entry.js.map → p-3549a469.entry.js.map} +0 -0
- /package/dist/atomic/{p-88af4470.entry.js.map → p-40c1dfcb.entry.js.map} +0 -0
- /package/dist/atomic/{p-1e59ce29.entry.js.map → p-4f34763d.entry.js.map} +0 -0
- /package/dist/atomic/{p-20764605.entry.js.map → p-52d5461a.entry.js.map} +0 -0
- /package/dist/atomic/{p-406a288c.entry.js.map → p-6078667f.entry.js.map} +0 -0
- /package/dist/atomic/{p-992bc2dc.js.map → p-60be00ad.js.map} +0 -0
- /package/dist/atomic/{p-3cbab25b.entry.js.map → p-7e971d15.entry.js.map} +0 -0
- /package/dist/atomic/{p-4601eb93.entry.js.map → p-83d3857f.entry.js.map} +0 -0
- /package/dist/atomic/{p-dbcef3a9.entry.js.map → p-87f69e53.entry.js.map} +0 -0
- /package/dist/atomic/{p-6289adc7.entry.js.map → p-9239be63.entry.js.map} +0 -0
- /package/dist/atomic/{p-aaea2ca1.entry.js.map → p-9a6ec803.entry.js.map} +0 -0
- /package/dist/atomic/{p-aac849b0.entry.js.map → p-a3fac2ec.entry.js.map} +0 -0
- /package/dist/atomic/{p-e398835b.entry.js.map → p-b2b9e83f.entry.js.map} +0 -0
- /package/dist/atomic/{p-8fdef8a3.entry.js.map → p-b313058c.entry.js.map} +0 -0
- /package/dist/atomic/{p-0bdd730f.entry.js.map → p-b6ae0244.entry.js.map} +0 -0
- /package/dist/atomic/{p-3a7a1a00.entry.js.map → p-bbfe727a.entry.js.map} +0 -0
- /package/dist/atomic/{p-97ce3384.entry.js.map → p-be2a43f4.entry.js.map} +0 -0
- /package/dist/atomic/{p-a5714bc4.entry.js.map → p-d211a422.entry.js.map} +0 -0
- /package/dist/atomic/{p-c280cd05.js.map → p-e1cc5150.js.map} +0 -0
- /package/dist/types/components/common/result-templates/{result-template-common.d.ts → stencil-result-template-common.d.ts} +0 -0
- /package/dist/types/components/{search/atomic-table-result → common}/table-element-utils.d.ts +0 -0
@@ -1,183 +0,0 @@
|
|
1
|
-
import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
2
|
-
import { HighlightUtils, buildRecentQueriesList } from '@coveo/headless';
|
3
|
-
import { C as Clock } from './clock.js';
|
4
|
-
import { a as SafeStorage, S as StorageItems } from './local-storage-utils.js';
|
5
|
-
import { o as once } from './utils.js';
|
6
|
-
import { e as encodeForDomAttribute } from './string-utils.js';
|
7
|
-
import { d as dispatchSearchBoxSuggestionsEvent } from './suggestions-events.js';
|
8
|
-
|
9
|
-
const getPartialRecentQueryElement = (value, i18n) => {
|
10
|
-
return {
|
11
|
-
part: 'recent-query-item',
|
12
|
-
query: value,
|
13
|
-
key: `recent-${encodeForDomAttribute(value)}`,
|
14
|
-
ariaLabel: i18n.t('recent-query-suggestion-label', {
|
15
|
-
query: value,
|
16
|
-
interpolation: { escapeValue: false },
|
17
|
-
}),
|
18
|
-
};
|
19
|
-
};
|
20
|
-
const getPartialRecentQueryClearElement = (i18n) => {
|
21
|
-
return {
|
22
|
-
key: 'recent-query-clear',
|
23
|
-
ariaLabel: i18n.t('clear-recent-searches', {
|
24
|
-
interpolation: { escapeValue: false },
|
25
|
-
}),
|
26
|
-
part: 'recent-query-title-item suggestion-divider',
|
27
|
-
hideIfLast: true,
|
28
|
-
};
|
29
|
-
};
|
30
|
-
const RecentQueriesContainer = (_, children) => {
|
31
|
-
return (h("div", { part: "recent-query-content", class: "flex items-center text-left break-all" }, children));
|
32
|
-
};
|
33
|
-
const RecentQueryIcon = ({ icon, }) => {
|
34
|
-
return (h("atomic-icon", { part: "recent-query-icon", icon: icon, class: "mr-2 h-4 w-4 shrink-0" }));
|
35
|
-
};
|
36
|
-
const RecentQueryText = ({ query, value, }) => {
|
37
|
-
if (query === '') {
|
38
|
-
return (h("span", { part: "recent-query-text", class: "line-clamp-2 break-all" }, value));
|
39
|
-
}
|
40
|
-
return (h("span", { part: "recent-query-text", class: "line-clamp-2 break-all", innerHTML: HighlightUtils.highlightString({
|
41
|
-
content: value,
|
42
|
-
openingDelimiter: '<span part="recent-query-text-highlight" class="font-bold">',
|
43
|
-
closingDelimiter: '</span>',
|
44
|
-
highlights: [
|
45
|
-
{
|
46
|
-
offset: query.length,
|
47
|
-
length: value.length - query.length,
|
48
|
-
},
|
49
|
-
],
|
50
|
-
}) }));
|
51
|
-
};
|
52
|
-
const RecentQueryClear = ({ i18n, }) => {
|
53
|
-
return (h("div", { part: "recent-query-title-content", class: "flex w-full justify-between" },
|
54
|
-
h("span", { class: "font-bold", part: "recent-query-title" }, i18n.t('recent-searches')),
|
55
|
-
h("span", { part: "recent-query-clear" }, i18n.t('clear'))));
|
56
|
-
};
|
57
|
-
|
58
|
-
const AtomicSearchBoxRecentQueries = /*@__PURE__*/ proxyCustomElement(class AtomicSearchBoxRecentQueries extends HTMLElement {
|
59
|
-
constructor() {
|
60
|
-
super();
|
61
|
-
this.__registerHost();
|
62
|
-
this.__attachShadow();
|
63
|
-
/**
|
64
|
-
* The maximum number of suggestions that will be displayed if the user has typed something into the input field.
|
65
|
-
*/
|
66
|
-
this.maxWithQuery = 3;
|
67
|
-
this.warnUser = once(() => this.bindings.engine.logger.warn('Because analytics are disabled, the recent queries feature is deactivated.'));
|
68
|
-
this.error = undefined;
|
69
|
-
this.icon = undefined;
|
70
|
-
this.maxWithQuery = 3;
|
71
|
-
this.maxWithoutQuery = undefined;
|
72
|
-
}
|
73
|
-
componentWillLoad() {
|
74
|
-
try {
|
75
|
-
dispatchSearchBoxSuggestionsEvent((bindings) => {
|
76
|
-
this.bindings = bindings;
|
77
|
-
return this.initialize();
|
78
|
-
}, this.host, ['atomic-search-box']);
|
79
|
-
}
|
80
|
-
catch (error) {
|
81
|
-
this.error = error;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
renderIcon() {
|
85
|
-
return this.icon || Clock;
|
86
|
-
}
|
87
|
-
initialize() {
|
88
|
-
this.storage = new SafeStorage();
|
89
|
-
this.recentQueriesList = buildRecentQueriesList(this.bindings.engine, {
|
90
|
-
initialState: { queries: this.retrieveLocalStorage() },
|
91
|
-
options: { maxLength: 1000, clearFilters: this.bindings.clearFilters },
|
92
|
-
});
|
93
|
-
this.recentQueriesList.subscribe(() => this.updateLocalStorage());
|
94
|
-
return {
|
95
|
-
position: Array.from(this.host.parentNode.children).indexOf(this.host),
|
96
|
-
renderItems: () => this.renderItems(),
|
97
|
-
};
|
98
|
-
}
|
99
|
-
retrieveLocalStorage() {
|
100
|
-
return this.storage.getParsedJSON(StorageItems.RECENT_QUERIES, []);
|
101
|
-
}
|
102
|
-
updateLocalStorage() {
|
103
|
-
if (!this.recentQueriesList.state.analyticsEnabled) {
|
104
|
-
return this.disableFeature();
|
105
|
-
}
|
106
|
-
return this.storage.setJSON(StorageItems.RECENT_QUERIES, this.recentQueriesList.state.queries);
|
107
|
-
}
|
108
|
-
disableFeature() {
|
109
|
-
this.warnUser();
|
110
|
-
this.storage.removeItem(StorageItems.RECENT_QUERIES);
|
111
|
-
}
|
112
|
-
renderItems() {
|
113
|
-
if (!this.recentQueriesList.state.analyticsEnabled) {
|
114
|
-
return [];
|
115
|
-
}
|
116
|
-
const query = this.bindings.searchBoxController.state.value;
|
117
|
-
const hasQuery = query !== '';
|
118
|
-
const max = hasQuery ? this.maxWithQuery : this.maxWithoutQuery;
|
119
|
-
const filteredQueries = this.recentQueriesList.state.queries
|
120
|
-
.filter((recentQuery) => recentQuery.toLowerCase().startsWith(query.toLowerCase()))
|
121
|
-
.slice(0, max);
|
122
|
-
const suggestionElements = filteredQueries.map((value) => this.renderItem(value));
|
123
|
-
if (suggestionElements.length) {
|
124
|
-
suggestionElements.unshift(this.renderClear());
|
125
|
-
}
|
126
|
-
return suggestionElements;
|
127
|
-
}
|
128
|
-
renderClear() {
|
129
|
-
const partialItem = getPartialRecentQueryClearElement(this.bindings.i18n);
|
130
|
-
return {
|
131
|
-
...partialItem,
|
132
|
-
content: h(RecentQueryClear, { i18n: this.bindings.i18n }),
|
133
|
-
onSelect: () => {
|
134
|
-
this.recentQueriesList.clear();
|
135
|
-
this.bindings.triggerSuggestions();
|
136
|
-
},
|
137
|
-
};
|
138
|
-
}
|
139
|
-
renderItem(value) {
|
140
|
-
const query = this.bindings.searchBoxController.state.value;
|
141
|
-
const partialItem = getPartialRecentQueryElement(value, this.bindings.i18n);
|
142
|
-
return {
|
143
|
-
...partialItem,
|
144
|
-
content: (h(RecentQueriesContainer, null, h(RecentQueryIcon, { icon: this.renderIcon() }), h(RecentQueryText, { query: query, value: value }))),
|
145
|
-
onSelect: () => {
|
146
|
-
if (this.bindings.isStandalone) {
|
147
|
-
this.bindings.searchBoxController.updateText(value);
|
148
|
-
this.bindings.searchBoxController.submit();
|
149
|
-
return;
|
150
|
-
}
|
151
|
-
this.recentQueriesList.executeRecentQuery(this.recentQueriesList.state.queries.indexOf(value));
|
152
|
-
},
|
153
|
-
};
|
154
|
-
}
|
155
|
-
render() {
|
156
|
-
if (this.error) {
|
157
|
-
return (h("atomic-component-error", { key: '8b84892b677e093e1d3a077ba76851ccbbc6c0b1', element: this.host, error: this.error }));
|
158
|
-
}
|
159
|
-
}
|
160
|
-
get host() { return this; }
|
161
|
-
}, [1, "atomic-search-box-recent-queries", {
|
162
|
-
"icon": [1],
|
163
|
-
"maxWithQuery": [514, "max-with-query"],
|
164
|
-
"maxWithoutQuery": [514, "max-without-query"],
|
165
|
-
"error": [32]
|
166
|
-
}]);
|
167
|
-
function defineCustomElement() {
|
168
|
-
if (typeof customElements === "undefined") {
|
169
|
-
return;
|
170
|
-
}
|
171
|
-
const components = ["atomic-search-box-recent-queries"];
|
172
|
-
components.forEach(tagName => { switch (tagName) {
|
173
|
-
case "atomic-search-box-recent-queries":
|
174
|
-
if (!customElements.get(tagName)) {
|
175
|
-
customElements.define(tagName, AtomicSearchBoxRecentQueries);
|
176
|
-
}
|
177
|
-
break;
|
178
|
-
} });
|
179
|
-
}
|
180
|
-
|
181
|
-
export { AtomicSearchBoxRecentQueries as A, defineCustomElement as d };
|
182
|
-
|
183
|
-
//# sourceMappingURL=atomic-search-box-recent-queries2.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"atomic-search-box-recent-queries2.js","mappings":";;;;;;;;AAMO,MAAM,4BAA4B,GAAG,CAC1C,KAAa,EACb,IAAU;IAEV,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,KAAK;QACZ,GAAG,EAAE,UAAU,qBAAqB,CAAC,KAAK,CAAC,EAAE;QAC7C,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,+BAA+B,EAAE;YACjD,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,EAAC,WAAW,EAAE,KAAK,EAAC;SACpC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,iCAAiC,GAAG,CAC/C,IAAU;IAKV,OAAO;QACL,GAAG,EAAE,oBAAoB;QACzB,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,uBAAuB,EAAE;YACzC,aAAa,EAAE,EAAC,WAAW,EAAE,KAAK,EAAC;SACpC,CAAC;QACF,IAAI,EAAE,4CAA4C;QAClD,UAAU,EAAE,IAAI;KACjB,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,sBAAsB,GAAwB,CAAC,CAAC,EAAE,QAAQ;IACrE,QACE,WACE,IAAI,EAAC,sBAAsB,EAC3B,KAAK,EAAC,uCAAu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ACF;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/common/suggestions/stencil-recent-queries.tsx","src/components/search/search-box-suggestions/atomic-search-box-recent-queries/atomic-search-box-recent-queries.tsx"],"sourcesContent":["import {HighlightUtils} from '@coveo/headless';\nimport {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {encodeForDomAttribute} from '../../../utils/string-utils';\nimport {SearchBoxSuggestionElement} from './suggestions-types';\n\nexport const getPartialRecentQueryElement = (\n value: string,\n i18n: i18n\n): Pick<SearchBoxSuggestionElement, 'ariaLabel' | 'key' | 'query' | 'part'> => {\n return {\n part: 'recent-query-item',\n query: value,\n key: `recent-${encodeForDomAttribute(value)}`,\n ariaLabel: i18n.t('recent-query-suggestion-label', {\n query: value,\n interpolation: {escapeValue: false},\n }),\n };\n};\n\nexport const getPartialRecentQueryClearElement = (\n i18n: i18n\n): Pick<\n SearchBoxSuggestionElement,\n 'ariaLabel' | 'key' | 'part' | 'hideIfLast'\n> => {\n return {\n key: 'recent-query-clear',\n ariaLabel: i18n.t('clear-recent-searches', {\n interpolation: {escapeValue: false},\n }),\n part: 'recent-query-title-item suggestion-divider',\n hideIfLast: true,\n };\n};\n\nexport const RecentQueriesContainer: FunctionalComponent = (_, children) => {\n return (\n <div\n part=\"recent-query-content\"\n class=\"flex items-center text-left break-all\"\n >\n {children}\n </div>\n );\n};\n\ninterface RecentQueryIconProps {\n icon: string;\n}\n\nexport const RecentQueryIcon: FunctionalComponent<RecentQueryIconProps> = ({\n icon,\n}) => {\n return (\n <atomic-icon\n part=\"recent-query-icon\"\n icon={icon}\n class=\"mr-2 h-4 w-4 shrink-0\"\n ></atomic-icon>\n );\n};\n\ninterface RecentQueryTextProps {\n query: string;\n value: string;\n}\n\nexport const RecentQueryText: FunctionalComponent<RecentQueryTextProps> = ({\n query,\n value,\n}) => {\n if (query === '') {\n return (\n <span part=\"recent-query-text\" class=\"line-clamp-2 break-all\">\n {value}\n </span>\n );\n }\n return (\n <span\n part=\"recent-query-text\"\n class=\"line-clamp-2 break-all\"\n innerHTML={HighlightUtils.highlightString({\n content: value,\n openingDelimiter:\n '<span part=\"recent-query-text-highlight\" class=\"font-bold\">',\n closingDelimiter: '</span>',\n highlights: [\n {\n offset: query.length,\n length: value.length - query.length,\n },\n ],\n })}\n ></span>\n );\n};\n\ninterface RecentQueryClearProps {\n i18n: i18n;\n}\n\nexport const RecentQueryClear: FunctionalComponent<RecentQueryClearProps> = ({\n i18n,\n}) => {\n return (\n <div part=\"recent-query-title-content\" class=\"flex w-full justify-between\">\n <span class=\"font-bold\" part=\"recent-query-title\">\n {i18n.t('recent-searches')}\n </span>\n <span part=\"recent-query-clear\">{i18n.t('clear')}</span>\n </div>\n );\n};\n","import {\n buildRecentQueriesList,\n RecentQueriesList,\n SearchBox,\n} from '@coveo/headless';\nimport {Component, Element, Prop, State, h} from '@stencil/core';\nimport Clock from '../../../../images/clock.svg';\nimport {SafeStorage, StorageItems} from '../../../../utils/local-storage-utils';\nimport {once} from '../../../../utils/utils';\nimport {\n getPartialRecentQueryClearElement,\n getPartialRecentQueryElement,\n RecentQueriesContainer,\n RecentQueryClear,\n RecentQueryIcon,\n RecentQueryText,\n} from '../../../common/suggestions/stencil-recent-queries';\nimport {\n dispatchSearchBoxSuggestionsEvent,\n} from '../../../common/suggestions/suggestions-events';\nimport type {\n SearchBoxSuggestionElement,\n SearchBoxSuggestions,\n SearchBoxSuggestionsBindings,\n} from '../../../common/suggestions/suggestions-types';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.\n */\n@Component({\n tag: 'atomic-search-box-recent-queries',\n shadow: true,\n})\nexport class AtomicSearchBoxRecentQueries {\n private bindings!: SearchBoxSuggestionsBindings<SearchBox, Bindings>;\n private recentQueriesList!: RecentQueriesList;\n private storage!: SafeStorage;\n\n @Element() private host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The SVG icon to display.\n *\n * - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location.\n * - Use a value that starts with `assets://`, to display an icon from the Atomic package.\n * - Use a stringified SVG to display it directly.\n */\n @Prop() public icon?: string;\n\n /**\n * The maximum number of suggestions that will be displayed if the user has typed something into the input field.\n */\n @Prop({reflect: true}) public maxWithQuery = 3;\n /**\n * The maximum number of suggestions that will be displayed initially when the input field is empty.\n */\n @Prop({reflect: true}) public maxWithoutQuery?: number;\n\n componentWillLoad() {\n try {\n dispatchSearchBoxSuggestionsEvent<SearchBox, Bindings>(\n (bindings) => {\n this.bindings = bindings;\n return this.initialize();\n },\n this.host,\n ['atomic-search-box']\n );\n } catch (error) {\n this.error = error as Error;\n }\n }\n\n private renderIcon() {\n return this.icon || Clock;\n }\n\n private initialize(): SearchBoxSuggestions {\n this.storage = new SafeStorage();\n this.recentQueriesList = buildRecentQueriesList(this.bindings.engine, {\n initialState: {queries: this.retrieveLocalStorage()},\n options: {maxLength: 1000, clearFilters: this.bindings.clearFilters},\n });\n\n this.recentQueriesList.subscribe(() => this.updateLocalStorage());\n\n return {\n position: Array.from(this.host.parentNode!.children).indexOf(this.host),\n renderItems: () => this.renderItems(),\n };\n }\n\n private retrieveLocalStorage() {\n return this.storage.getParsedJSON(StorageItems.RECENT_QUERIES, []);\n }\n\n private updateLocalStorage() {\n if (!this.recentQueriesList.state.analyticsEnabled) {\n return this.disableFeature();\n }\n\n return this.storage.setJSON(\n StorageItems.RECENT_QUERIES,\n this.recentQueriesList.state.queries\n );\n }\n\n private warnUser = once(() =>\n this.bindings.engine.logger.warn(\n 'Because analytics are disabled, the recent queries feature is deactivated.'\n )\n );\n\n private disableFeature() {\n this.warnUser();\n this.storage.removeItem(StorageItems.RECENT_QUERIES);\n }\n\n private renderItems(): SearchBoxSuggestionElement[] {\n if (!this.recentQueriesList.state.analyticsEnabled) {\n return [];\n }\n\n const query = this.bindings.searchBoxController.state.value;\n const hasQuery = query !== '';\n const max = hasQuery ? this.maxWithQuery : this.maxWithoutQuery;\n const filteredQueries = this.recentQueriesList.state.queries\n .filter((recentQuery) =>\n recentQuery.toLowerCase().startsWith(query.toLowerCase())\n )\n .slice(0, max);\n\n const suggestionElements: SearchBoxSuggestionElement[] =\n filteredQueries.map((value) => this.renderItem(value));\n if (suggestionElements.length) {\n suggestionElements.unshift(this.renderClear());\n }\n\n return suggestionElements;\n }\n\n private renderClear(): SearchBoxSuggestionElement {\n const partialItem = getPartialRecentQueryClearElement(this.bindings.i18n);\n\n return {\n ...partialItem,\n content: <RecentQueryClear i18n={this.bindings.i18n} />,\n onSelect: () => {\n this.recentQueriesList.clear();\n this.bindings.triggerSuggestions();\n },\n };\n }\n\n private renderItem(value: string): SearchBoxSuggestionElement {\n const query = this.bindings.searchBoxController.state.value;\n const partialItem = getPartialRecentQueryElement(value, this.bindings.i18n);\n return {\n ...partialItem,\n content: (\n <RecentQueriesContainer>\n <RecentQueryIcon icon={this.renderIcon()} />\n <RecentQueryText query={query} value={value} />\n </RecentQueriesContainer>\n ),\n\n onSelect: () => {\n if (this.bindings.isStandalone) {\n this.bindings.searchBoxController.updateText(value);\n this.bindings.searchBoxController.submit();\n return;\n }\n\n this.recentQueriesList.executeRecentQuery(\n this.recentQueriesList.state.queries.indexOf(value)\n );\n },\n };\n }\n\n public render() {\n if (this.error) {\n return (\n <atomic-component-error\n element={this.host}\n error={this.error}\n ></atomic-component-error>\n );\n }\n }\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"result-template-common.js","mappings":";;;;;;SA0BgB,mBAAmB,CAAC,IAAU;IAC5C,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;QAC7B,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,UAAU,CAAC;KACnB;IACD,IACE,aAAa,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC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CAAC;QACxC,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;KACzE;IAED,IAAI,YAAY,EAAE;QAChB,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,CAAC;KAC5E;IACD,OAAO,UAAU,CAAC;AACpB;;;;","names":[],"sources":["src/components/common/result-templates/result-template-common.tsx"],"sourcesContent":["import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '../../../utils/utils';\nimport {tableElementTagName} from '../../search/atomic-table-result/table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/item-layout-sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["getTemplateNodeType","node","isResultSectionNode","isVisualNode","isElementNode","tagName","toLowerCase","tableElementTagName","groupNodesByType","nodes","aggregate","Array","from","ResultTemplateCommon","constructor","host","setError","validParents","allowEmpty","this","matchConditions","gridCellLinkTarget","validateTemplate","hasValidParent","map","p","toUpperCase","includes","parentElement","nodeName","Error","join","attributes","getNamedItem","value","template","querySelector","innerHTML","trim","content","console","warn","section","sectionNodes","other","otherNodes","childNodes","length","getTemplate","conditions","error","concat","getTemplateElement","linkContent","getLinkTemplateElement","priority","renderIfError","h","element","getDefaultLinkTemplateElement","linkTemplate","document","createElement","makeMatchConditions","mustMatch","mustNotMatch","field","push","ResultTemplatesHelpers","fieldMustMatch","fieldMustNotMatch","makeDefinedConditions","ifDefined","ifNotDefined","fieldNames","split","fieldsMustBeDefined","fieldsMustNotBeDefined"],"sources":["src/components/common/result-templates/result-template-common.tsx"],"sourcesContent":["import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '../../../utils/utils';\nimport {tableElementTagName} from '../../search/atomic-table-result/table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/item-layout-sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n"],"mappings":"2NA0BgBA,EAAoBC,GAClC,GAAIC,EAAoBD,GAAO,CAC7B,MAAO,S,CAET,IAAKE,EAAaF,GAAO,CACvB,MAAO,U,CAET,GACEG,EAAcH,IACdA,EAAKI,QAAQC,gBAAkBC,EAC/B,CACA,MAAO,yB,CAET,MAAO,OACT,CAEA,SAASC,EAAiBC,GACxB,OAAOC,EAAUC,MAAMC,KAAKH,IAASR,GAASD,EAAoBC,IACpE,C,MAEaY,EAKX,WAAAC,EAAYC,KACVA,EAAIC,SACJA,EAAQC,aACRA,EAAYC,WACZA,EAAa,QAPRC,KAAAC,gBAA6C,GAC5CD,KAAAE,mBAAiC,QAQvCF,KAAKJ,KAAOA,EACZI,KAAKG,iBAAiBP,EAAMC,EAAUC,EAAcC,E,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E,mBAAqB,gCAAgCF,KAAKE,2BAA6B,0BAC5I,OAAOuC,C,CAGT,sBAAAN,CAAuBvC,GACrB,OACEA,EAAKqB,cAAmC,0BACxCjB,KAAKwC,+B,EAKX,SAASP,EAAmBrC,GAC1B,OAAOA,EAAKqB,cAAmC,uBACjD,C,SAEgB2B,EACdC,EACAC,GAEA,MAAMhB,EAAwC,GAC9C,IAAK,MAAMiB,KAASF,EAAW,CAC7Bf,EAAWkB,KACTC,EAAuBC,eAAeH,EAAOF,EAAUE,I,CAI3D,IAAK,MAAMA,KAASD,EAAc,CAChChB,EAAWkB,KACTC,EAAuBE,kBAAkBJ,EAAOD,EAAaC,I,CAGjE,OAAOjB,CACT,C,SAEgBsB,EACdC,EACAC,GAEA,MAAMxB,EAAwC,GAC9C,GAAIuB,EAAW,CACb,MAAME,EAAaF,EAAUG,MAAM,KACnC1B,EAAWkB,KAAKC,EAAuBQ,oBAAoBF,G,CAG7D,GAAID,EAAc,CAChB,MAAMC,EAAaD,EAAaE,MAAM,KACtC1B,EAAWkB,KAAKC,EAAuBS,uBAAuBH,G,CAEhE,OAAOzB,CACT,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultTemplate","constructor","hostRef","this","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","allowEmpty","componentWillLoad","matchConditions","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/search/result-templates/atomic-result-template/atomic-result-template.tsx"],"sourcesContent":["import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, Method, State} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * A [result template](https://docs.coveo.com/en/atomic/latest/usage/displaying-results#defining-a-result-template) determines the format of the query results, depending on the conditions that are defined for each template.\n *\n * @slot default - Mandatory. A `template` element that defines the structure of the result item.\n * @slot link - A `template` element that contains a single `atomic-result-link` component.\n *\n * **Note:** Any `<script>` tags that are defined inside a `<template>` element will not be executed when the results are being rendered.\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-result-template',\n shadow: true,\n})\nexport class AtomicResultTemplate {\n private resultTemplateCommon!: ResultTemplateCommon;\n\n @State() public error!: Error;\n\n @Element() public host!: HTMLDivElement;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: [\n 'atomic-result-list',\n 'atomic-folded-result-list',\n 'atomic-search-box-instant-results',\n ],\n allowEmpty: true,\n });\n }\n\n public componentWillLoad() {\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"gpBAsBaA,EAAoB,MAkC/B,WAAAC,CAAAC,G,UApBeC,KAAAC,WAAwC,GAMVD,KAAAE,UAGzC,GAMyCF,KAAAG,aAGzC,G,qCAlBmD,G,eASnD,G,kBASA,E,CAIJ,iBAAAC,GACEJ,KAAKK,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMP,KAAKO,KACXC,SAAWC,IACTT,KAAKU,MAAQD,CAAG,EAElBE,aAAc,CACZ,qBACA,4BACA,qCAEFC,WAAY,M,CAIT,iBAAAC,GACLb,KAAKK,qBAAqBS,gBAAkBC,EAC1Cf,KAAKE,UACLF,KAAKG,a,CAQF,iBAAMa,GACX,OAAOhB,KAAKK,qBAAqBW,YAAYhB,KAAKC,WAAYD,KAAKU,M,CAG9D,MAAAO,GACL,OAAOjB,KAAKK,qBAAqBa,cAAclB,KAAKU,M,6BA/CTS,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAScF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["getFieldTableColumns","props","itemRenderingFunction","getFieldTableColumnsFromRenderingFunction","getFieldTableColumnsFromHTMLTemplate","contentOfRenderingFunction","document","createElement","contentOfRenderingFunctionAsString","firstItem","innerHTML","Array","from","querySelectorAll","tableElementTagName","templateContentForFirstItem","DisplayTable","children","fieldColumns","length","logger","error","host","h","class","listClasses","part","map","column","value","getAttribute","DisplayTableRow","key","rowIndex","setRef","ref","element","DisplayTableData","renderItem","TabGuard","tabsIncluded","tabsExcluded","activeTab","shouldDisplayOnCurrentTab","Hidden","Fragment","atomicResultListCss","AtomicResultListStyle0","AtomicResultList","this","loadingFlag","randomID","resultTemplateRegistered","isAppLoaded","templateHasError","display","density","imageSize","setRenderFunction","resultRenderingFunction","focusTarget","nextNewResultTarget","FocusTargetController","initialize","includes","console","warn","tabManager","buildTabManager","bindings","engine","resultList","buildResultList","resultsPerPage","buildResultsPerPage","itemTemplateProvider","ItemTemplateProvider","includeDefaultTemplate","templateElements","getResultTemplateRegistered","getTemplateHasError","setResultTemplateRegistered","setTemplateHasError","resultListCommon","ItemListCommon","engineSubscribe","subscribe","getCurrentNumberOfItems","resultListState","results","getIsLoading","isLoading","nextNewItemTarget","store","createAppLoadedListener","watchTabManagerState","newValue","oldValue","unsetLoadingFlag","render","updateBreakpoints","computeListDisplayClasses","tabManagerState","ItemListGuard","hasError","hasTemplate","firstRequestExecuted","firstSearchExecuted","hasItems","hasResults","DisplayWrapper","ResultsPlaceholdersGuard","displayPlaceholders","numberOfPlaceholders","resultsPerPageState","numberOfResults","ItemDisplayGuard","renderAsTable","renderAsGrid","renderAsList","getPropsForAtomicResult","result","interactiveResult","buildInteractiveResult","options","renderingFunction","getResultId","uniqueId","searchResponseId","content","getTemplateContent","linkContent","getLinkTemplateContent","getEmptyLinkTemplateContent","getItemListDisplayClasses","i","propsForAtomicResult","DisplayGrid","selectorForItem","item","setNewResultRef","propsForTableColumns","__decorate","InitializeBindings","BindStateToController","ArrayProp"],"sources":["src/components/common/item-list/stencil-display-table.tsx","src/components/common/tabs/tab-guard.tsx","src/components/search/result-lists/atomic-result-list/atomic-result-list.pcss?tag=atomic-result-list&encapsulation=shadow","src/components/search/result-lists/atomic-result-list/atomic-result-list.tsx"],"sourcesContent":["// The Lit equivalent of this file is table-layout.ts\nimport {FunctionalComponent, VNode, h} from '@stencil/core';\nimport {tableElementTagName} from '../../search/atomic-table-result/table-element-utils.js';\nimport {AnyItem} from './unfolded-item.js';\nimport {ItemRenderingFunction} from './stencil-item-list-common.js';\n\ninterface TableColumnsProps {\n templateContentForFirstItem: DocumentFragment;\n firstItem: AnyItem;\n itemRenderingFunction?: ItemRenderingFunction;\n}\n\nexport interface DisplayTableProps extends TableColumnsProps {\n logger: Pick<Console, 'error'>;\n host: HTMLElement;\n listClasses: string;\n}\n\nexport interface TableDataProps extends TableColumnsProps {\n key: string;\n}\n\nexport interface DisplayTableRowProps {\n key: string;\n rowIndex: number;\n setRef: (element?: HTMLElement) => void;\n}\n\nconst getFieldTableColumns = (props: TableColumnsProps) => {\n if (props.itemRenderingFunction) {\n return getFieldTableColumnsFromRenderingFunction(props);\n }\n return getFieldTableColumnsFromHTMLTemplate(props);\n};\n\nconst getFieldTableColumnsFromRenderingFunction = (\n props: Pick<TableColumnsProps, 'itemRenderingFunction' | 'firstItem'>\n): HTMLAtomicTableElementElement[] => {\n const contentOfRenderingFunction = document.createElement('div');\n\n const contentOfRenderingFunctionAsString = props.itemRenderingFunction!(\n props.firstItem,\n document.createElement('div')\n );\n contentOfRenderingFunction.innerHTML = contentOfRenderingFunctionAsString;\n\n return Array.from(\n contentOfRenderingFunction.querySelectorAll(tableElementTagName)\n );\n};\n\nconst getFieldTableColumnsFromHTMLTemplate = (\n props: Pick<DisplayTableProps, 'templateContentForFirstItem'>\n): HTMLAtomicTableElementElement[] =>\n Array.from(\n props.templateContentForFirstItem.querySelectorAll(tableElementTagName)\n );\n\nexport const DisplayTable: FunctionalComponent<DisplayTableProps> = (\n props,\n children\n) => {\n const fieldColumns = getFieldTableColumns(props);\n\n if (!fieldColumns.length) {\n props.logger.error(\n 'atomic-table-element elements missing in the template to display columns.',\n props.host\n );\n }\n\n return (\n <table class={`list-root ${props.listClasses}`} part=\"result-table\">\n <thead part=\"result-table-heading\">\n <tr part=\"result-table-heading-row\">\n {fieldColumns.map((column) => (\n <th part=\"result-table-heading-cell\">\n <atomic-text value={column.getAttribute('label')!}></atomic-text>\n </th>\n ))}\n </tr>\n </thead>\n <tbody part=\"result-table-body\">{...children}</tbody>\n </table>\n );\n};\n\nexport const DisplayTableRow: FunctionalComponent<DisplayTableRowProps> = (\n {key, rowIndex, setRef},\n children\n) => {\n return (\n <tr\n key={key}\n part={\n 'result-table-row ' +\n (rowIndex % 2 === 1 ? 'result-table-row-even' : 'result-table-row-odd')\n }\n ref={(element) => setRef(element)}\n >\n {...children}\n </tr>\n );\n};\n\nexport const DisplayTableData: FunctionalComponent<\n TableDataProps & {\n renderItem: (content: HTMLAtomicTableElementElement) => VNode;\n }\n> = (props) => {\n const fieldColumns = getFieldTableColumns(props);\n\n return fieldColumns.map((column) => {\n const key = column.getAttribute('label')! + props.key;\n return (\n <td key={key} part=\"result-table-cell\">\n {props.renderItem(column)}\n </td>\n );\n });\n};\n","import {Fragment, FunctionalComponent, h} from '@stencil/core';\nimport {shouldDisplayOnCurrentTab} from '../../../utils/tab-utils';\nimport {Hidden} from '../stencil-hidden';\n\ninterface TabGuardProps {\n tabsIncluded: string | string[];\n tabsExcluded: string | string[];\n activeTab: string;\n}\n\nexport const TabGuard: FunctionalComponent<TabGuardProps> = (\n {tabsIncluded, tabsExcluded, activeTab},\n children\n) => {\n if (\n !shouldDisplayOnCurrentTab([...tabsIncluded], [...tabsExcluded], activeTab)\n ) {\n return <Hidden></Hidden>;\n }\n return <Fragment>{...children}</Fragment>;\n};\n","@import '../../../../global/global.pcss';\n@import '../../../common/item-list/styles/placeholders.pcss';\n@import '../../../common/item-list/styles/table-display.pcss';\n@import '../../../common/item-list/styles/list-display.pcss';\n@import '../../../common/item-list/styles/grid-display.pcss';\n\natomic-result:not(.hydrated) {\n visibility: hidden;\n}\n","import {\n ResultList,\n ResultListState,\n buildResultList,\n ResultsPerPageState,\n ResultsPerPage,\n buildResultsPerPage,\n buildInteractiveResult,\n Result,\n TabManager,\n TabManagerState,\n buildTabManager,\n} from '@coveo/headless';\nimport {Component, Element, State, Prop, Method, h, Watch} from '@stencil/core';\nimport {\n BindStateToController,\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {ArrayProp} from '../../../../utils/props-utils';\nimport {FocusTargetController} from '../../../../utils/stencil-accessibility-utils';\nimport {randomID} from '../../../../utils/utils';\nimport {ResultsPlaceholdersGuard} from '../../../common/atomic-result-placeholder/stencil-placeholders';\nimport {createAppLoadedListener} from '../../../common/interface/store';\nimport {ItemDisplayGuard} from '../../../common/item-list/item-display-guard';\nimport {ItemListGuard} from '../../../common/item-list/item-list-guard';\nimport {ItemTemplateProvider} from '../../../common/item-list/item-template-provider';\nimport {DisplayGrid} from '../../../common/item-list/stencil-display-grid';\nimport {\n DisplayTableData,\n DisplayTable,\n DisplayTableRow,\n} from '../../../common/item-list/stencil-display-table';\nimport {DisplayWrapper} from '../../../common/item-list/stencil-display-wrapper';\nimport {\n ItemListCommon,\n ItemRenderingFunction,\n} from '../../../common/item-list/stencil-item-list-common';\nimport {\n ItemDisplayDensity,\n ItemDisplayImageSize,\n ItemDisplayLayout,\n getItemListDisplayClasses,\n} from '../../../common/layout/display-options';\nimport {TabGuard} from '../../../common/tabs/tab-guard';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-result-list` component is responsible for displaying query results by applying one or more result templates.\n *\n * @slot default - The default slot where the result templates are inserted.\n * @part result-list - The element containing every result of a result list\n * @part outline - The element displaying an outline or a divider around a result\n * @part result-list-grid-clickable-container - The parent of the result & the clickable link encompassing it, when results are displayed as a grid\n * @part result-list-grid-clickable - The clickable link encompassing the result when results are displayed as a grid\n * @part result-table - The element of the result table containing a heading and a body\n * @part result-table-heading - The element containing the row of cells in the result table's heading\n * @part result-table-heading-row - The element containing cells of the result table's heading\n * @part result-table-heading-cell - The element representing a cell of the result table's heading\n * @part result-table-body - The element containing the rows of the result table's body\n * @part result-table-row - The element containing the cells of a row in the result table's body\n * @part result-table-row-odd - The element containing the cells of an odd row in the result table's body\n * @part result-table-row-even - The element containing the cells of an even row in the result table's body\n * @part result-table-cell - The element representing a cell of the result table's body\n */\n@Component({\n tag: 'atomic-result-list',\n styleUrl: 'atomic-result-list.pcss',\n shadow: true,\n})\nexport class AtomicResultList implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n public resultList!: ResultList;\n public resultsPerPage!: ResultsPerPage;\n private loadingFlag = randomID('firstResultLoaded-');\n private itemRenderingFunction: ItemRenderingFunction;\n private nextNewResultTarget?: FocusTargetController;\n private itemTemplateProvider!: ItemTemplateProvider;\n private resultListCommon!: ItemListCommon;\n\n @Element() public host!: HTMLDivElement;\n\n @BindStateToController('resultList')\n @State()\n private resultListState!: ResultListState;\n @BindStateToController('resultsPerPage')\n @State()\n private resultsPerPageState!: ResultsPerPageState;\n public tabManager!: TabManager;\n @BindStateToController('tabManager')\n @State()\n public tabManagerState!: TabManagerState;\n @State() private resultTemplateRegistered = false;\n @State() public error!: Error;\n @State() private isAppLoaded = false;\n\n @State() private templateHasError = false;\n\n /**\n * The desired layout to use when displaying results. Layouts affect how many results to display per row and how visually distinct they are from each other.\n */\n @Prop({reflect: true}) public display: ItemDisplayLayout = 'list';\n /**\n * The spacing of various elements in the result list, including the gap between results, the gap between parts of a result, and the font sizes of different parts in a result.\n */\n @Prop({reflect: true}) public density: ItemDisplayDensity = 'normal';\n\n /**\n * The expected size of the image displayed in the results.\n */\n @Prop({reflect: true, mutable: true})\n public imageSize: ItemDisplayImageSize = 'icon';\n\n /**\n * The tabs on which the result list can be displayed. This property should not be used at the same time as `tabs-excluded`.\n *\n * Set this property as a stringified JSON array, e.g.,\n * ```html\n * <atomic-result-list tabs-included='[\"tabIDA\", \"tabIDB\"]'></atomic-result-list snippet>\n * ```\n * If you don't set this property, the result list can be displayed on any tab. Otherwise, the result list can only be displayed on the specified tabs.\n */\n @ArrayProp()\n @Prop({reflect: true, mutable: true})\n public tabsIncluded: string[] | string = '[]';\n\n /**\n * The tabs on which this result list must not be displayed. This property should not be used at the same time as `tabs-included`.\n *\n * Set this property as a stringified JSON array, e.g.,\n * ```html\n * <atomic-result-list tabs-excluded='[\"tabIDA\", \"tabIDB\"]'></atomic-result-list>\n * ```\n * If you don't set this property, the result list can be displayed on any tab. Otherwise, the result list won't be displayed on any of the specified tabs.\n */\n @ArrayProp()\n @Prop({reflect: true, mutable: true})\n public tabsExcluded: string[] | string = '[]';\n\n /**\n * Sets a rendering function to bypass the standard HTML template mechanism for rendering results.\n * You can use this function while working with web frameworks that don't use plain HTML syntax, e.g., React, Angular or Vue.\n *\n * Do not use this method if you integrate Atomic in a plain HTML deployment.\n *\n * @param resultRenderingFunction\n */\n @Method() public async setRenderFunction(\n resultRenderingFunction: ItemRenderingFunction\n ) {\n this.itemRenderingFunction = resultRenderingFunction;\n }\n\n public get focusTarget() {\n if (!this.nextNewResultTarget) {\n this.nextNewResultTarget = new FocusTargetController(this);\n }\n return this.nextNewResultTarget;\n }\n\n public initialize() {\n if (this.host.innerHTML.includes('<atomic-result-children')) {\n console.warn(\n 'Folded results will not render any children for the \"atomic-result-list\". Please use \"atomic-folded-result-list\" instead.'\n );\n }\n this.tabManager = buildTabManager(this.bindings.engine);\n this.resultList = buildResultList(this.bindings.engine);\n this.resultsPerPage = buildResultsPerPage(this.bindings.engine);\n this.itemTemplateProvider = new ItemTemplateProvider({\n includeDefaultTemplate: true,\n templateElements: Array.from(\n this.host.querySelectorAll('atomic-result-template')\n ),\n getResultTemplateRegistered: () => this.resultTemplateRegistered,\n getTemplateHasError: () => this.templateHasError,\n setResultTemplateRegistered: (value: boolean) => {\n this.resultTemplateRegistered = value;\n },\n setTemplateHasError: (value: boolean) => {\n this.templateHasError = value;\n },\n bindings: this.bindings,\n });\n\n this.resultListCommon = new ItemListCommon({\n engineSubscribe: this.bindings.engine.subscribe,\n getCurrentNumberOfItems: () => this.resultListState.results.length,\n getIsLoading: () => this.resultListState.isLoading,\n host: this.host,\n loadingFlag: this.loadingFlag,\n nextNewItemTarget: this.focusTarget,\n store: this.bindings.store,\n });\n createAppLoadedListener(this.bindings.store, (isAppLoaded) => {\n this.isAppLoaded = isAppLoaded;\n });\n }\n\n @Watch('tabManagerState')\n watchTabManagerState(\n newValue: {activeTab: string},\n oldValue: {activeTab: string}\n ) {\n if (newValue?.activeTab !== oldValue?.activeTab) {\n this.bindings.store.unsetLoadingFlag(this.loadingFlag);\n }\n }\n\n public render() {\n this.resultListCommon.updateBreakpoints();\n const listClasses = this.computeListDisplayClasses();\n\n return (\n <TabGuard\n tabsIncluded={this.tabsIncluded}\n tabsExcluded={this.tabsExcluded}\n activeTab={this.tabManagerState.activeTab}\n >\n <ItemListGuard\n hasError={this.resultListState.hasError}\n hasTemplate={this.resultTemplateRegistered}\n templateHasError={this.itemTemplateProvider.hasError}\n firstRequestExecuted={this.resultListState.firstSearchExecuted}\n hasItems={this.resultListState.hasResults}\n >\n <DisplayWrapper display={this.display} listClasses={listClasses}>\n <ResultsPlaceholdersGuard\n density={this.density}\n display={this.display}\n imageSize={this.imageSize}\n displayPlaceholders={!this.isAppLoaded}\n numberOfPlaceholders={this.resultsPerPageState.numberOfResults}\n ></ResultsPlaceholdersGuard>\n <ItemDisplayGuard\n firstRequestExecuted={this.resultListState.firstSearchExecuted}\n hasItems={this.resultListState.hasResults}\n >\n {this.display === 'table'\n ? this.renderAsTable()\n : this.display === 'grid'\n ? this.renderAsGrid()\n : this.renderAsList()}\n </ItemDisplayGuard>\n </DisplayWrapper>\n </ItemListGuard>\n </TabGuard>\n );\n }\n\n private getPropsForAtomicResult(result: Result) {\n return {\n interactiveResult: buildInteractiveResult(this.bindings.engine, {\n options: {result},\n }),\n result,\n renderingFunction: this.itemRenderingFunction,\n loadingFlag: this.loadingFlag,\n key: this.resultListCommon.getResultId(\n result.uniqueId,\n this.resultListState.searchResponseId,\n this.density,\n this.imageSize\n ),\n content: this.itemTemplateProvider.getTemplateContent(result),\n linkContent:\n this.display === 'grid'\n ? this.itemTemplateProvider.getLinkTemplateContent(result)\n : this.itemTemplateProvider.getEmptyLinkTemplateContent(),\n store: this.bindings.store,\n density: this.density,\n imageSize: this.imageSize,\n display: this.display,\n };\n }\n\n private computeListDisplayClasses() {\n const displayPlaceholders = !this.isAppLoaded;\n\n return getItemListDisplayClasses(\n this.display,\n this.density,\n this.imageSize,\n this.resultListState.firstSearchExecuted &&\n this.resultListState.isLoading,\n displayPlaceholders\n );\n }\n\n private renderAsGrid() {\n return this.resultListState.results.map((result, i) => {\n const propsForAtomicResult = this.getPropsForAtomicResult(result);\n return (\n <DisplayGrid\n selectorForItem=\"atomic-result\"\n item={result}\n {...propsForAtomicResult.interactiveResult}\n setRef={(element) =>\n element && this.resultListCommon.setNewResultRef(element, i)\n }\n >\n <atomic-result {...this} {...propsForAtomicResult}></atomic-result>\n </DisplayGrid>\n );\n });\n }\n\n private renderAsTable() {\n if (!this.resultListState.hasResults) {\n return;\n }\n const listClasses = this.computeListDisplayClasses();\n const firstItem = this.resultListState.results[0];\n\n const propsForTableColumns = {\n firstItem,\n templateContentForFirstItem:\n this.itemTemplateProvider.getTemplateContent(firstItem),\n };\n\n return (\n <DisplayTable\n {...propsForTableColumns}\n listClasses={listClasses}\n logger={this.bindings.engine.logger}\n itemRenderingFunction={this.itemRenderingFunction}\n host={this.host}\n >\n {this.resultListState.results.map((result, i) => {\n const propsForAtomicResult = this.getPropsForAtomicResult(result);\n return (\n <DisplayTableRow\n {...propsForAtomicResult}\n rowIndex={i}\n setRef={(element) =>\n element && this.resultListCommon.setNewResultRef(element, i)\n }\n >\n <DisplayTableData\n {...propsForTableColumns}\n {...propsForAtomicResult}\n renderItem={(content) => {\n return (\n <atomic-result\n {...propsForAtomicResult}\n content={content}\n ></atomic-result>\n );\n }}\n ></DisplayTableData>\n </DisplayTableRow>\n );\n })}\n </DisplayTable>\n );\n }\n\n private renderAsList() {\n return this.resultListState.results.map((result, i) => {\n const propsForAtomicResult = this.getPropsForAtomicResult(result);\n return (\n <atomic-result\n {...propsForAtomicResult}\n ref={(element) =>\n element && this.resultListCommon.setNewResultRef(element, i)\n }\n part=\"outline\"\n ></atomic-result>\n );\n });\n }\n}\n"],"mappings":"u5BA4BA,MAAMA,EAAwBC,IAC5B,GAAIA,EAAMC,sBAAuB,CAC/B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AOlD,OAC7BlB,sBAAuB+C,KAAK/C,sBAC5BoB,KAAM2B,KAAK3B,MAEV2B,KAAKuC,gBAAgBC,QAAQ9D,KAAI,CAAC8F,EAAQc,KACzC,MAAMC,EAAuBvF,KAAKuE,wBAAwBC,GAC1D,OACElG,EAACQ,EAAe,IACVyG,EACJvG,SAAUsG,EACVrG,OAASE,GACPA,GAAWa,KAAKkC,iBAAiByD,gBAAgBxG,EAASmG,IAG5DhH,EAACc,EAAgB,IACXwG,KACAL,EACJlG,WAAa2F,GAET1G,EAAA,oBACMiH,EACJP,QAASA,MAKD,I,CAOpB,YAAAV,GACN,OAAOtE,KAAKuC,gBAAgBC,QAAQ9D,KAAI,CAAC8F,EAAQc,KAC/C,MAAMC,EAAuBvF,KAAKuE,wBAAwBC,GAC1D,OACElG,EAAA,oBACMiH,EACJrG,IAAMC,GACJA,GAAWa,KAAKkC,iBAAiByD,gBAAgBxG,EAASmG,GAE5D7G,KAAK,WACU,G,oGAxSMoH,EAAA,CAA5BC,K,+BAaOD,EAAA,CAFPE,EAAsB,e,sCAKfF,EAAA,CAFPE,EAAsB,mB,0CAMhBF,EAAA,CAFNE,EAAsB,e,sCAmChBF,EAAA,CAFNG,K,mCAeMH,EAAA,CAFNG,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultChildrenTemplate","constructor","hostRef","this","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","getTemplate","componentWillLoad","matchConditions","makeMatchConditions","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/search/result-templates/atomic-result-children-template/atomic-result-children-template.tsx"],"sourcesContent":["import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, State, Method} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * The `atomic-result-children-template` component determines the format of the child results, depending on the conditions that are defined for each template. A `template` element must be the child of an `atomic-result-children-template`, and an `atomic-result-children` must be the parent of each `atomic-result-children-template`.\n *\n * Note: Any `<script>` tags defined inside of a `<template>` element will not be executed when results are being rendered.\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-result-children-template',\n shadow: true,\n})\nexport class AtomicResultChildrenTemplate {\n @Element() public host!: HTMLDivElement;\n\n @State() public error!: Error;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n public resultTemplateCommon!: ResultTemplateCommon;\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-result-children'],\n });\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public componentWillLoad() {\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"gpBAmBaA,EAA4B,MAkCvC,WAAAC,CAAAC,G,UAtBeC,KAAAC,WAAwC,GAMVD,KAAAE,UAGzC,GAMyCF,KAAAG,aAGzC,G,qCAlBmD,G,eASnD,G,kBASA,E,CAMJ,iBAAAC,GACEJ,KAAKK,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMP,KAAKO,KACXC,SAAWC,IACTT,KAAKU,MAAQD,CAAG,EAElBE,aAAc,CAAC,2B,CAQZ,iBAAMC,GACX,OAAOZ,KAAKK,qBAAqBO,YAAYZ,KAAKC,WAAYD,KAAKU,M,CAG9D,iBAAAG,GACLb,KAAKK,qBAAqBS,gBAAkBC,EAC1Cf,KAAKE,UACLF,KAAKG,a,CAIF,MAAAa,GACL,OAAOhB,KAAKK,qBAAqBY,cAAcjB,KAAKU,M,6BA5CTQ,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAScF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["identifierKeywordsSection","QuickviewSidebar","props","words","minimized","numberOfWords","Object","values","length","minimizeButton","h","MinimizeButton","wordsLength","class","HighlightKeywordsCheckbox","Keywords","i18n","onMinimize","highlightKeywords","IconButton","partPrefix","icon","MinimizeIcon","style","title","t","ariaLabel","onClick","badge","undefined","ariaExpanded","toString","ariaControls","onHighlightKeywords","Fragment","StencilCheckbox","text","id","checked","highlightNone","onToggle","htmlFor","map","keyword","wordIsEnabled","keywords","enabled","key","backgroundColor","color","Intl","NumberFormat","language","notation","format","occurrences","FieldsetGroup","label","ArrowDown","disabled","navigateForward","ArrowUp","navigateBackward","tabIndex","ariaPressed","Remove","Add","indexIdentifier","documentIdentifierInIframe","writeDocument","documentWriter","content","open","write","close","scrollingElement","scrollTop","currentResultAlreadyWrittenToDocument","uniqueIdentifier","currentDocIdentifier","getElementById","textContent","ensureSameResultIsNotOverwritten","docIdentifier","createElement","display","setAttribute","body","appendChild","warnAboutLimitedUsageQuickview","logger","warn","QuickviewIframe","onSetIframeRef","sandbox","src","waitForIframeContentToBeWritten","Promise","resolve","setTimeout","ref","async","el","iframeRef","contentDocument","buildPreviewBar","previewBarId","bar","innerHTML","position","top","right","width","height","buildPreviewUnit","word","wordElement","docHeight","previewUnit","elementPosition","getBoundingClientRect","border","previewBorderColor","buildQuickviewPreviewBar","iframe","remove","scrollHeight","forEach","elements","rgbToHsv","r","g","b","max","Math","min","v","d","s","hsvToRgb","i","floor","f","p","q","round","HIGHLIGHT_PREFIX","QuickviewWordHighlight","constructor","stemmingInfoFromIndex","keywordElementInIframe","this","currentNavigationPosition","parsed","parseKeywordIdentifier","getText","keywordIdentifier","focusedColor","computeInvertedColor","computeSaturatedColor","addElement","push","highlightNavigation","putElementIntoView","isTaggedWord","element","nodeName","toLowerCase","currentElement","otherElements","filter","scrollIntoView","innerTextOfHTMLElement","getHighlightedInnerText","resolveOriginalTerm","trim","highlight","found","keys","find","originalTerm","originalTermMatch","stemmingExpansions","stemmingExpansionMatch","stemmingExpansion","getTextOfHTMLElement","children","Array","from","parts","substring","match","keywordTermPart","parseInt","innerText","extractRgb","newSaturation","rSaturated","gSaturated","bSaturated","rgbExtracted","getWordsHighlights","wordsHighlights","querySelectorAll","wordHTMLElementToHighlight","wordHighlight","alreadyScannedKeyword","atomicQuickviewModalCss","AtomicQuickviewModalStyle0","AtomicQuickviewModal","minimizeSidebar","watchHighlightKeywords","handleHighlightsScripts","componentWillLoad","bindings","store","isMobile","reset","result","interactiveResult","renderHeader","headerContent","buildInteractiveResult","engine","options","LinkWithItemAnalytics","href","clickUri","onSelect","select","onBeginDelayedSelect","beginDelayedSelect","onCancelPendingSelect","cancelPendingSelect","className","part","CloseIcon","onClose","slot","renderBody","minimize","quickviewSrc","quickviewUniqueIdentifier","termsToHighlight","renderFooter","Button","previousQuickview","emit","current","first","total","nextQuickview","modalCloseCallback","isOpen","highlightScriptId","state","resultPreview","contentURL","enableHighlights","removeDisableHighlightScript","enableHighlightsSpecificKeyword","identifier","disableHighlights","createDisableHighlightScript","disableHighlightsSpecificKeyword","doc","contentWindow","document","head","scriptId","createStyleElement","createTextNode","flatPhrasesToHighlight","phrasesToHighlight","search","response","entries","phrase","flatMap","keywordEntry","keywordStemming","requestId","uniqueId","render","fullscreen","exportparts","ATOMIC_MODAL_EXPORT_PARTS","__decorate","InitializeBindings"],"sources":["src/components/search/result-template-components/atomic-quickview-sidebar/atomic-quickview-sidebar.tsx","src/components/search/result-template-components/quickview-iframe/quickview-iframe.tsx","src/components/search/result-template-components/quickview-preview-bar/quickview-preview-bar.ts","src/utils/color-utils.ts","src/components/search/result-template-components/quickview-word-highlight/quickview-word-highlight.tsx","src/components/search/result-template-components/atomic-quickview-modal/atomic-quickview-modal.pcss?tag=atomic-quickview-modal&encapsulation=shadow","src/components/search/result-template-components/atomic-quickview-modal/atomic-quickview-modal.tsx"],"sourcesContent":["import {Fragment, FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport Add from '../../../../images/add.svg';\nimport ArrowDown from '../../../../images/arrow-bottom-rounded.svg';\nimport ArrowUp from '../../../../images/arrow-top-rounded.svg';\nimport MinimizeIcon from '../../../../images/menu.svg';\nimport Remove from '../../../../images/remove.svg';\nimport {IconButton} from '../../../common/stencil-iconButton';\nimport {StencilCheckbox} from '../../../common/stencil-checkbox';\nimport {FieldsetGroup} from '../../../common/stencil-fieldset-group';\nimport type {HighlightKeywords} from '../atomic-quickview-modal/atomic-quickview-modal';\nimport {QuickviewWordHighlight} from '../quickview-word-highlight/quickview-word-highlight';\n\nconst identifierKeywordsSection = 'coveo-quickview-sidebar-keywords';\n\nexport interface QuickviewSidebarProps {\n words: Record<string, QuickviewWordHighlight>;\n i18n: i18n;\n highlightKeywords: HighlightKeywords;\n onHighlightKeywords: (highlight: HighlightKeywords) => void;\n minimized: boolean;\n onMinimize: (minimize: boolean) => void;\n}\n\nexport const QuickviewSidebar: FunctionalComponent<QuickviewSidebarProps> = (\n props\n) => {\n const {words, minimized} = props;\n const numberOfWords = Object.values(words).length;\n\n if (numberOfWords === 0) {\n return;\n }\n\n const minimizeButton = (\n <MinimizeButton {...props} wordsLength={numberOfWords} />\n );\n\n return (\n <div class=\"border-neutral h-full border-r p-4\">\n {minimized && minimizeButton}\n <div class=\"flex items-center justify-between\">\n <div class=\"flex items-center\">\n <HighlightKeywordsCheckbox {...props} />\n </div>\n {!minimized && <div>{minimizeButton}</div>}\n </div>\n\n {!minimized && <Keywords {...props} words={words} />}\n </div>\n );\n};\n\nconst MinimizeButton: FunctionalComponent<\n Pick<\n QuickviewSidebarProps,\n 'i18n' | 'minimized' | 'onMinimize' | 'highlightKeywords'\n > & {wordsLength: number}\n> = ({i18n, minimized, onMinimize, highlightKeywords, wordsLength}) => (\n <IconButton\n partPrefix=\"sidebar-minimize\"\n icon={MinimizeIcon}\n style=\"text-transparent\"\n title={i18n.t('quickview-toggle-navigation')}\n ariaLabel={i18n.t('quickview-toggle-navigation')}\n onClick={() => onMinimize(!minimized)}\n badge={\n highlightKeywords && minimized ? <slot>{wordsLength}</slot> : undefined\n }\n class={`w-fit ${minimized ? '' : 'ml-auto'}`}\n ariaExpanded={(!minimized).toString()}\n ariaControls={identifierKeywordsSection}\n />\n);\n\nconst HighlightKeywordsCheckbox: FunctionalComponent<\n Pick<\n QuickviewSidebarProps,\n 'i18n' | 'highlightKeywords' | 'onHighlightKeywords' | 'minimized'\n >\n> = ({i18n, highlightKeywords, onHighlightKeywords, minimized}) => (\n <Fragment>\n <StencilCheckbox\n text={i18n.t('keywords-highlight')}\n class=\"mr-2\"\n id=\"atomic-quickview-sidebar-highlight-keywords\"\n checked={!highlightKeywords.highlightNone}\n onToggle={(checked) =>\n onHighlightKeywords({\n ...highlightKeywords,\n highlightNone: !checked,\n })\n }\n ></StencilCheckbox>\n {!minimized && (\n <label\n class=\"cursor-pointer font-bold whitespace-nowrap\"\n htmlFor=\"atomic-quickview-sidebar-highlight-keywords\"\n >\n {i18n.t('keywords-highlight')}\n </label>\n )}\n </Fragment>\n);\n\nconst Keywords: FunctionalComponent<\n Pick<\n QuickviewSidebarProps,\n 'i18n' | 'onHighlightKeywords' | 'highlightKeywords'\n > & {\n words: Record<string, QuickviewWordHighlight>;\n }\n> = ({words, i18n, highlightKeywords, onHighlightKeywords}) => {\n return (\n <div id={identifierKeywordsSection}>\n {Object.values(words).map((keyword) => {\n const wordIsEnabled =\n !highlightKeywords.highlightNone &&\n (highlightKeywords.keywords[keyword.text] === undefined ||\n highlightKeywords.keywords[keyword.text].enabled === true);\n\n return (\n <div\n key={keyword.text}\n class=\"my-4 flex w-100 items-center justify-between gap-x-2\"\n >\n <div\n class={`bg-background border-neutral flex grow items-center overflow-x-auto rounded-lg border ${\n !wordIsEnabled ? 'pointer-events-none opacity-50' : ''\n }`}\n >\n <div\n class=\"flex grow items-center border-r p-4\"\n aria-hidden=\"true\"\n >\n <div\n class=\"mr-2 h-5 w-5 flex-none\"\n style={{backgroundColor: keyword.color}}\n ></div>\n <div class=\"mr-2 grow whitespace-nowrap\">{keyword.text}</div>\n <div class=\"flex-none\">\n (\n {new Intl.NumberFormat(i18n.language, {\n notation: 'compact',\n }).format(keyword.occurrences)}\n )\n </div>\n </div>\n <FieldsetGroup\n label={i18n.t('quickview-navigate-keywords', {\n occurrences: keyword.occurrences,\n keyword: keyword.text,\n })}\n >\n <div class=\"flex px-2\">\n <IconButton\n partPrefix=\"sidebar-next\"\n icon={ArrowDown}\n disabled={!wordIsEnabled}\n style=\"text-transparent\"\n class=\"border-0\"\n ariaLabel={i18n.t('next')}\n title={i18n.t('next')}\n onClick={() => keyword.navigateForward()}\n />\n <IconButton\n partPrefix=\"sidebar-previous\"\n icon={ArrowUp}\n disabled={!wordIsEnabled}\n style=\"text-transparent\"\n class=\"border-0\"\n ariaLabel={i18n.t('previous')}\n title={i18n.t('previous')}\n onClick={() => keyword.navigateBackward()}\n />\n </div>\n </FieldsetGroup>\n </div>\n <IconButton\n partPrefix=\"sidebar-remove-word\"\n class={`${\n highlightKeywords.highlightNone\n ? 'pointer-events-none opacity-50'\n : ''\n }`}\n tabIndex={highlightKeywords.highlightNone ? '-1' : '0'}\n ariaPressed={(!wordIsEnabled).toString()}\n style=\"text-transparent\"\n icon={wordIsEnabled ? Remove : Add}\n ariaLabel={i18n.t('quickview-remove-word')}\n onClick={() => {\n onHighlightKeywords({\n ...highlightKeywords,\n keywords: {\n ...highlightKeywords.keywords,\n [keyword.text]: {\n enabled: !wordIsEnabled,\n indexIdentifier: keyword.indexIdentifier,\n },\n },\n });\n }}\n />\n </div>\n );\n })}\n </div>\n );\n};\n","import {SearchEngine} from '@coveo/headless';\nimport {FunctionalComponent, h} from '@stencil/core';\n\nconst documentIdentifierInIframe = 'CoveoDocIdentifier';\n\nconst writeDocument = (documentWriter: Document, content: string) => {\n documentWriter.open();\n documentWriter.write(content);\n documentWriter.close();\n if (documentWriter.scrollingElement) {\n documentWriter.scrollingElement.scrollTop = 0;\n }\n};\n\nconst currentResultAlreadyWrittenToDocument = (\n documentWriter: Document,\n uniqueIdentifier: string\n) => {\n const currentDocIdentifier = documentWriter.getElementById(\n documentIdentifierInIframe\n );\n\n return (\n currentDocIdentifier &&\n currentDocIdentifier.textContent === uniqueIdentifier\n );\n};\n\nconst ensureSameResultIsNotOverwritten = (\n documentWriter: Document,\n uniqueIdentifier: string\n) => {\n const docIdentifier = documentWriter.createElement('div');\n docIdentifier.style.display = 'none';\n docIdentifier.setAttribute('aria-hidden', 'true');\n docIdentifier.id = documentIdentifierInIframe;\n docIdentifier.textContent = uniqueIdentifier;\n documentWriter.body.appendChild(docIdentifier);\n};\n\nconst warnAboutLimitedUsageQuickview = (logger?: SearchEngine['logger']) => {\n logger?.warn(\n 'Quickview initialized in restricted mode due to incompatible sandboxing environment. Keywords hit navigation will be disabled.'\n );\n};\n\nexport const QuickviewIframe: FunctionalComponent<{\n title: string;\n content?: string;\n onSetIframeRef: (ref: HTMLIFrameElement) => void;\n uniqueIdentifier?: string;\n sandbox?: string;\n src?: string;\n logger?: SearchEngine['logger'];\n}> = ({title, onSetIframeRef, uniqueIdentifier, content, sandbox, src, logger}) => {\n // When a document is written with document.open/document.write/document.close\n // it is not synchronous and the content of the iframe is only available to be queried at the end of the current call stack.\n // This add a \"wait\" (setTimeout 0) before calling the `onSetIframeRef` from the parent modal quickview\n const waitForIframeContentToBeWritten = () => {\n return new Promise((resolve) => setTimeout(resolve));\n };\n\n return (\n <iframe\n title={title}\n src=\"about:blank\"\n class=\"h-full w-full\"\n sandbox={sandbox}\n ref={async (el) => {\n const iframeRef = el as HTMLIFrameElement;\n\n if (!uniqueIdentifier || !content) {\n return;\n }\n\n const documentWriter = iframeRef.contentDocument;\n if (!documentWriter) {\n if (src) {\n warnAboutLimitedUsageQuickview(logger);\n iframeRef.src = src;\n }\n\n return;\n }\n if (\n currentResultAlreadyWrittenToDocument(\n documentWriter,\n uniqueIdentifier\n )\n ) {\n return;\n }\n\n writeDocument(documentWriter, content);\n ensureSameResultIsNotOverwritten(documentWriter, uniqueIdentifier);\n\n await waitForIframeContentToBeWritten();\n onSetIframeRef(iframeRef);\n }}\n ></iframe>\n );\n};\n","import type {HighlightKeywords} from '../atomic-quickview-modal/atomic-quickview-modal';\nimport type {QuickviewWordHighlight} from '../quickview-word-highlight/quickview-word-highlight';\n\nconst buildPreviewBar = (documentWriter: Document) => {\n const previewBarId = 'CoveoPreviewBar';\n const bar =\n documentWriter.getElementById(previewBarId) ||\n documentWriter.createElement('div');\n\n bar.id = previewBarId;\n bar.innerHTML = '';\n bar.style.position = 'fixed';\n bar.style.top = '0';\n bar.style.right = '0';\n bar.style.width = '15px';\n bar.style.height = '100%';\n bar.setAttribute('aria-hidden', 'true');\n return bar;\n};\n\nconst buildPreviewUnit = (\n documentWriter: Document,\n word: QuickviewWordHighlight,\n wordElement: HTMLElement,\n docHeight: number,\n highlightKeywords: HighlightKeywords\n) => {\n const previewUnit = documentWriter.createElement('div');\n if (highlightKeywords.keywords[word.text]?.enabled === false) {\n previewUnit.style.display = 'none';\n return previewUnit;\n }\n\n const elementPosition = wordElement.getBoundingClientRect().top;\n\n previewUnit.style.position = 'absolute';\n previewUnit.style.top = `${(elementPosition / docHeight) * 100}%`;\n previewUnit.style.width = '100%';\n previewUnit.style.height = '1px';\n previewUnit.style.border = `1px solid ${word.previewBorderColor}`;\n previewUnit.style.backgroundColor = word.color;\n return previewUnit;\n};\n\nexport const buildQuickviewPreviewBar = (\n words: Record<string, QuickviewWordHighlight>,\n highlightKeywords: HighlightKeywords,\n iframe?: HTMLIFrameElement\n) => {\n if (!iframe) {\n return;\n }\n const documentWriter = iframe.contentDocument;\n if (!documentWriter) {\n return;\n }\n const bar = buildPreviewBar(documentWriter);\n if (highlightKeywords.highlightNone) {\n bar.remove();\n return;\n }\n const docHeight = documentWriter.body.scrollHeight;\n\n Object.values(words).forEach((word) => {\n word.elements.forEach((wordElement) => {\n const previewUnit = buildPreviewUnit(\n documentWriter,\n word,\n wordElement,\n docHeight,\n highlightKeywords\n );\n\n bar.appendChild(previewUnit);\n });\n });\n documentWriter.body.appendChild(bar);\n};\n","export const rgbToHsv = (r: number, g: number, b: number) => {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n\n let h: number;\n const v = max;\n\n const d = max - min;\n const s = max === 0 ? 0 : d / max;\n\n if (max === min) {\n h = 0;\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n default:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n\n return {h, s, v};\n};\n\nexport const hsvToRgb = (h: number, s: number, v: number) => {\n let r: number, g: number, b: number;\n\n const i = Math.floor(h * 6);\n const f = h * 6 - i;\n const p = v * (1 - s);\n const q = v * (1 - f * s);\n const t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n default:\n r = v;\n g = p;\n b = q;\n break;\n }\n\n return {\n r: Math.round(r),\n g: Math.round(g),\n b: Math.round(b),\n };\n};\n","import {TermsToHighlight} from '@coveo/headless';\nimport {hsvToRgb, rgbToHsv} from '../../../../utils/color-utils';\n\nexport const HIGHLIGHT_PREFIX = 'CoveoHighlight';\nexport class QuickviewWordHighlight {\n public text: string;\n public indexIdentifier: string;\n public occurrences = 0;\n public color: string;\n public focusedColor: string;\n public previewBorderColor: string;\n public elements: HTMLElement[] = [];\n\n private currentNavigationPosition = -1;\n\n constructor(\n private stemmingInfoFromIndex: TermsToHighlight,\n keywordElementInIframe: HTMLElement\n ) {\n const parsed = this.parseKeywordIdentifier(keywordElementInIframe);\n if (!parsed) {\n throw 'Invalid keyword identifier for quickview';\n }\n\n this.text = this.getText(keywordElementInIframe);\n this.indexIdentifier = `${parsed.keywordIdentifier}`;\n this.color = keywordElementInIframe.style.backgroundColor;\n this.focusedColor = this.computeInvertedColor();\n this.previewBorderColor = this.computeSaturatedColor();\n\n this.addElement(keywordElementInIframe);\n }\n\n public addElement(keywordElementInIframe: HTMLElement) {\n this.occurrences++;\n this.elements.push(keywordElementInIframe);\n }\n\n public navigateForward() {\n this.currentNavigationPosition++;\n if (this.currentNavigationPosition >= this.elements.length) {\n this.currentNavigationPosition = 0;\n }\n this.highlightNavigation();\n this.putElementIntoView();\n return this.elements[this.currentNavigationPosition];\n }\n\n public navigateBackward() {\n this.currentNavigationPosition--;\n if (this.currentNavigationPosition < 0) {\n this.currentNavigationPosition = this.elements.length - 1;\n }\n this.highlightNavigation();\n this.putElementIntoView();\n return this.elements[this.currentNavigationPosition];\n }\n\n private isTaggedWord(element: HTMLElement) {\n return element.nodeName.toLowerCase() === 'coveotaggedword';\n }\n\n private highlightNavigation() {\n const currentElement = this.elements[this.currentNavigationPosition];\n const otherElements = this.elements.filter((el) => el !== currentElement);\n currentElement.style.color = this.color;\n currentElement.style.backgroundColor = this.focusedColor;\n otherElements.forEach((element) => {\n element.style.color = '';\n element.style.backgroundColor = this.color;\n });\n }\n\n private putElementIntoView() {\n const element = this.elements[this.currentNavigationPosition];\n element.scrollIntoView();\n }\n\n private getText(element: HTMLElement) {\n const innerTextOfHTMLElement = this.getHighlightedInnerText(element);\n return this.resolveOriginalTerm(innerTextOfHTMLElement).trim();\n }\n\n private resolveOriginalTerm(highlight: string): string {\n // First try to find either an exact match between the highlight and the original non-stemmed keyword.\n // Otherwise try to find a match between the highlight and the stemming keyword expansions\n // If nothing is found (which should not normally happen...), simply return the highlight keyword as is.\n\n const found = Object.keys(this.stemmingInfoFromIndex).find(\n (originalTerm) => {\n const originalTermMatch =\n originalTerm.toLowerCase() === highlight.toLowerCase();\n if (originalTermMatch) {\n return true;\n }\n const stemmingExpansions = this.stemmingInfoFromIndex[originalTerm];\n if (!stemmingExpansions) {\n return false;\n }\n\n const stemmingExpansionMatch = stemmingExpansions.find(\n (stemmingExpansion) =>\n stemmingExpansion.toLowerCase() === highlight.toLowerCase()\n );\n return stemmingExpansionMatch;\n }\n );\n return found || highlight;\n }\n\n private getHighlightedInnerText(element: HTMLElement): string {\n if (!this.isTaggedWord(element)) {\n return this.getTextOfHTMLElement(element);\n }\n\n const children = Array.from(element.children) as HTMLElement[];\n if (children.length >= 1) {\n return this.getTextOfHTMLElement(children[0]);\n }\n\n return '';\n }\n\n private parseKeywordIdentifier(element: HTMLElement) {\n const parts = element.id\n .substring(HIGHLIGHT_PREFIX.length + 1)\n .match(/^([0-9]+)\\.([0-9]+)\\.([0-9]+)$/);\n\n if (!parts || parts.length <= 3) {\n return null;\n }\n\n return {\n keywordIdentifier: parts[1],\n keywordTermPart: parseInt(parts[3], 10),\n };\n }\n\n private getTextOfHTMLElement(el: HTMLElement) {\n return el.innerText || el.textContent || '';\n }\n\n private computeInvertedColor() {\n const {r, g, b} = this.extractRgb();\n return `rgb(${255 - r}, ${255 - g}, ${255 - b})`;\n }\n\n private computeSaturatedColor() {\n const {r, g, b} = this.extractRgb();\n const {h, s, v} = rgbToHsv(r, g, b);\n let newSaturation = s * 2;\n if (newSaturation > 1) {\n newSaturation = 1;\n }\n const {\n r: rSaturated,\n g: gSaturated,\n b: bSaturated,\n } = hsvToRgb(h, newSaturation, v);\n return `rgb(${rSaturated}, ${gSaturated}, ${bSaturated})`;\n }\n\n private extractRgb() {\n const rgbExtracted = this.color.match(/\\d+/g);\n if (!rgbExtracted) {\n return {r: 255, g: 255, b: 255};\n }\n\n return {\n r: parseInt(rgbExtracted[0], 10),\n g: parseInt(rgbExtracted[1], 10),\n b: parseInt(rgbExtracted[2], 10),\n };\n }\n}\n\nexport const getWordsHighlights = (\n stemmingInfoFromIndex: TermsToHighlight,\n iframe?: HTMLIFrameElement\n) => {\n const wordsHighlights: Record<string, QuickviewWordHighlight> = {};\n if (!iframe) {\n return wordsHighlights;\n }\n\n iframe.contentDocument?.body\n .querySelectorAll(`[id^=\"${HIGHLIGHT_PREFIX}\"]`)\n .forEach((el) => {\n const wordHTMLElementToHighlight = el as HTMLElement;\n\n const wordHighlight = new QuickviewWordHighlight(\n stemmingInfoFromIndex,\n wordHTMLElementToHighlight\n );\n\n if (!wordHighlight.text) {\n return;\n }\n\n const alreadyScannedKeyword =\n wordsHighlights[wordHighlight.indexIdentifier];\n\n if (alreadyScannedKeyword) {\n alreadyScannedKeyword.addElement(wordHTMLElementToHighlight);\n } else {\n wordsHighlights[wordHighlight.indexIdentifier] = wordHighlight;\n }\n });\n\n return wordsHighlights;\n};\n","@import '../../../../global/global.pcss';\n@reference '../../../../utils/tailwind-utilities/link-style.css';\n\n.atomic-quickview-modal {\n &::part(backdrop) {\n grid-template-columns: 1fr max(80vw, 30rem) 1fr;\n }\n &::part(body),\n &::part(header),\n &::part(footer) {\n @apply max-w-full;\n }\n\n &::part(footer) {\n @apply flex justify-center;\n }\n\n &::part(body-wrapper) {\n @apply h-full overflow-hidden p-0;\n }\n\n &::part(body) {\n @apply h-full;\n }\n\n &::part(backdrop) {\n grid-template-rows: 1fr 100% 3fr;\n }\n\n &::part(header-wrapper) {\n @apply bg-neutral-light;\n }\n\n a {\n @apply link-style;\n }\n}\n","import {\n buildInteractiveResult,\n Result,\n InteractiveResult,\n TermsToHighlight,\n} from '@coveo/headless';\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n Method,\n VNode,\n Fragment,\n} from '@stencil/core';\nimport CloseIcon from '../../../../images/close.svg';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {ATOMIC_MODAL_EXPORT_PARTS} from '../../../common/atomic-modal/export-parts';\nimport {IconButton} from '../../../common/stencil-iconButton';\nimport {LinkWithItemAnalytics} from '../../../common/item-link/stencil-item-link';\nimport {Button} from '../../../common/stencil-button';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {QuickviewSidebar} from '../atomic-quickview-sidebar/atomic-quickview-sidebar';\nimport {QuickviewIframe} from '../quickview-iframe/quickview-iframe';\nimport {buildQuickviewPreviewBar} from '../quickview-preview-bar/quickview-preview-bar';\nimport {\n getWordsHighlights,\n HIGHLIGHT_PREFIX,\n QuickviewWordHighlight,\n} from '../quickview-word-highlight/quickview-word-highlight';\n\nexport interface HighlightKeywords {\n highlightNone: boolean;\n keywords: {\n [text: string]: {\n indexIdentifier: string;\n enabled: boolean;\n };\n };\n}\n\n/**\n * The modal opened when clicking on a quickview button.\n * Do not use this component directly; use `atomic-quickview` instead.\n *\n * @part backdrop - The transparent backdrop hiding the content behind the modal.\n * @part container - The modal's outermost container with the outline and background.\n * @part header-wrapper - The wrapper around the header.\n * @part header - The header at the top of the modal.\n * @part header-ruler - The horizontal ruler underneath the header.\n * @part body-wrapper - The wrapper around the body.\n * @part body - The body of the modal, between the header and the footer.\n * @part footer-wrapper - The wrapper with a shadow or background color around the footer.\n * @part footer - The footer at the bottom of the modal.\n * @part quickview-modal-header-icon - The close icon of the modal.\n * @part quickview-modal-header-title - The title of the modal.\n */\n@Component({\n tag: 'atomic-quickview-modal',\n styleUrl: 'atomic-quickview-modal.pcss',\n shadow: true,\n})\nexport class AtomicQuickviewModal implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @State() public error!: Error;\n\n @State() private highlightKeywords: HighlightKeywords = {\n highlightNone: false,\n keywords: {},\n };\n @Watch('highlightKeywords')\n watchHighlightKeywords() {\n this.handleHighlightsScripts();\n }\n\n @Event({eventName: 'atomic/quickview/next'}) nextQuickview?: EventEmitter;\n @Event({eventName: 'atomic/quickview/previous'})\n previousQuickview?: EventEmitter;\n\n @State() private minimizeSidebar = false;\n @State() private words: Record<string, QuickviewWordHighlight> = {};\n private iframeRef?: HTMLIFrameElement;\n\n @Prop({mutable: true, reflect: false}) content?: string;\n @Prop({mutable: true, reflect: false}) result?: Result;\n @Prop() current?: number;\n @Prop() total?: number;\n @Prop() sandbox?: string;\n @Prop() modalCloseCallback?: () => void;\n\n private interactiveResult?: InteractiveResult;\n\n public componentWillLoad(): void {\n this.minimizeSidebar = this.bindings.store.isMobile();\n }\n\n @Method()\n public async reset() {\n this.highlightKeywords = {\n highlightNone: false,\n keywords: {},\n };\n this.minimizeSidebar = false;\n this.iframeRef = undefined;\n this.content = undefined;\n this.result = undefined;\n this.interactiveResult = undefined;\n }\n\n private renderHeader() {\n let headerContent: VNode | null = null;\n if (this.result) {\n this.interactiveResult = buildInteractiveResult(this.bindings.engine, {\n options: {result: this.result},\n });\n headerContent = (\n <Fragment>\n <LinkWithItemAnalytics\n href={this.result?.clickUri}\n onSelect={() => this.interactiveResult?.select()}\n onBeginDelayedSelect={() =>\n this.interactiveResult?.beginDelayedSelect()\n }\n onCancelPendingSelect={() =>\n this.interactiveResult?.cancelPendingSelect()\n }\n className=\"truncate\"\n part=\"quickview-modal-header-title\"\n >\n {this.result.title}\n </LinkWithItemAnalytics>\n <IconButton\n partPrefix=\"quickview-modal-header\"\n icon={CloseIcon}\n onClick={() => this.onClose()}\n ariaLabel={this.bindings.i18n.t('close')}\n style=\"text-transparent\"\n title={this.bindings.i18n.t('close')}\n />\n </Fragment>\n );\n }\n return (\n <div slot=\"header\" class=\"flex w-full items-center justify-between\">\n {headerContent}\n </div>\n );\n }\n\n private renderBody() {\n return (\n <div slot=\"body\" class=\"grid h-full grid-cols-[min-content_auto]\">\n <div\n class=\"h-full overflow-y-auto\"\n style={{backgroundColor: 'var(--atomic-neutral-light)'}}\n >\n <QuickviewSidebar\n words={this.words}\n i18n={this.bindings.i18n}\n highlightKeywords={this.highlightKeywords}\n onHighlightKeywords={(highlight) =>\n (this.highlightKeywords = highlight)\n }\n minimized={this.minimizeSidebar}\n onMinimize={(minimize) => (this.minimizeSidebar = minimize)}\n />\n </div>\n <div class=\"relative overflow-auto\">\n <QuickviewIframe\n title={this.result?.title ?? this.bindings.i18n.t('preview-modal-title')} \n logger={this.logger}\n src={this.quickviewSrc}\n sandbox={this.sandbox}\n uniqueIdentifier={this.quickviewUniqueIdentifier}\n content={this.content}\n onSetIframeRef={async (ref) => {\n this.iframeRef = ref;\n this.words = getWordsHighlights(\n this.termsToHighlight,\n this.iframeRef\n );\n this.handleHighlightsScripts();\n }}\n />\n {buildQuickviewPreviewBar(\n this.words,\n this.highlightKeywords,\n this.iframeRef\n )}\n </div>\n </div>\n );\n }\n\n private renderFooter() {\n return (\n <div slot=\"footer\" class=\"flex items-center gap-2\">\n <Button\n class=\"p-2\"\n style=\"square-neutral\"\n onClick={() => this.previousQuickview?.emit()}\n disabled={this.current === 1}\n text={this.bindings.i18n.t('quickview-previous')}\n ></Button>\n <p class=\"text-center\">\n {this.bindings.i18n.t('showing-results-of', {\n first: this.current,\n total: this.total,\n })}\n </p>\n <Button\n class=\"p-2\"\n style=\"square-neutral\"\n onClick={() => this.nextQuickview?.emit()}\n disabled={this.current === this.total}\n text={this.bindings.i18n.t('quickview-next')}\n ></Button>\n </div>\n );\n }\n\n private onClose() {\n this.content = undefined;\n this.result = undefined;\n this.modalCloseCallback && this.modalCloseCallback();\n }\n\n private get isOpen() {\n return !!this.content && !!this.result;\n }\n\n private get highlightScriptId() {\n return 'CoveoDisableHighlightStyle';\n }\n\n private get logger() {\n return this.bindings.engine.logger;\n }\n\n private get quickviewSrc() {\n return this.bindings.engine.state.resultPreview?.contentURL;\n }\n\n private enableHighlights() {\n this.removeDisableHighlightScript();\n }\n\n private enableHighlightsSpecificKeyword(identifier: string) {\n this.removeDisableHighlightScript(identifier);\n }\n\n private disableHighlights() {\n this.createDisableHighlightScript();\n }\n\n private disableHighlightsSpecificKeyword(identifier: string) {\n this.createDisableHighlightScript(identifier);\n }\n\n private removeDisableHighlightScript(identifier?: string) {\n const doc = this.iframeRef?.contentWindow?.document;\n if (!doc) {\n return;\n }\n doc\n .getElementById(\n `${this.highlightScriptId}${identifier ? `:${identifier}` : ''}`\n )\n ?.remove();\n }\n\n private createDisableHighlightScript(identifier?: string) {\n const doc = this.iframeRef?.contentWindow?.document;\n if (!doc) {\n return;\n }\n\n const head = doc.head;\n const scriptId = `${this.highlightScriptId}${\n identifier ? `:${identifier}` : ''\n }`;\n const style =\n doc.getElementById(scriptId) || this.bindings.createStyleElement();\n style.setAttribute('id', scriptId);\n head.appendChild(style);\n style.appendChild(\n doc.createTextNode(`[id^=\"${HIGHLIGHT_PREFIX}${\n identifier ? `:${identifier}` : ''\n }\"] {\n background-color: inherit !important;\n color: inherit !important;\n }`)\n );\n }\n\n private get termsToHighlight() {\n const flatPhrasesToHighlight: TermsToHighlight = {};\n\n const phrasesToHighlight =\n this.bindings.engine.state.search.response.phrasesToHighlight;\n\n Object.entries(phrasesToHighlight).forEach(([phrase, keywords]) => {\n flatPhrasesToHighlight[phrase] = Object.entries(keywords).flatMap(\n ([keywordEntry, keywordStemming]) => {\n return [keywordEntry, ...keywordStemming];\n }\n );\n });\n\n return {\n ...this.bindings.engine.state.search.response.termsToHighlight,\n ...flatPhrasesToHighlight,\n };\n }\n\n private get requestId() {\n return this.bindings.engine.state.search.requestId;\n }\n\n private get quickviewUniqueIdentifier() {\n return this.result?.uniqueId + this.requestId;\n }\n\n private handleHighlightsScripts() {\n if (!this.highlightKeywords.highlightNone) {\n this.enableHighlights();\n } else {\n this.disableHighlights();\n }\n Object.values(this.highlightKeywords.keywords).forEach((word) => {\n if (word.enabled) {\n this.enableHighlightsSpecificKeyword(word.indexIdentifier);\n } else {\n this.disableHighlightsSpecificKeyword(word.indexIdentifier);\n }\n });\n }\n\n public render() {\n return (\n <atomic-modal\n fullscreen={this.bindings.store.isMobile()}\n class={'atomic-quickview-modal'}\n isOpen={this.isOpen}\n close={() => this.onClose()}\n exportparts={ATOMIC_MODAL_EXPORT_PARTS}\n >\n {this.renderHeader()}\n {this.renderBody()}\n {this.renderFooter()}\n </atomic-modal>\n );\n }\n}\n"],"mappings":"srDAaA,MAAMA,EAA4B,mCAW3B,MAAMC,EACXC,IAEA,MAAMC,MAACA,EAAKC,UAAEA,GAAaF,EAC3B,MAAMG,EAAgBC,OAAOC,OAAOJ,GAAOK,OAE3C,GAAIH,IAAkB,EAAG,CACvB,M,CAGF,MAAMI,EACJC,EAACC,EAAc,IAAKT,EAAOU,YAAaP,IAG1C,OACEK,EAAA,OAAKG,MAAM,sCACRT,GAAaK,EACdC,EAAA,OAAKG,MAAM,qCACTH,EAAA,OAAKG,MAAM,qBACTH,EAACI,EAAyB,IAAKZ,MAE/BE,GAAaM,EAAA,WAAMD,KAGrBL,GAAaM,EAACK,EAAQ,IAAKb,EAAOC,MAAOA,IACvC,EAIV,MAAMQ,EAKF,EAAEK,OAAMZ,YAAWa,aAAYC,oBAAmBN,iBACpDF,EAACS,EAAU,CACTC,WAAW,mBACXC,KAAMC,EAC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KsG,OACbnL,MAAO,IAAM6E,KAAKsF,UAClBgD,YAAaC,GAEZvI,KAAKqE,eACLrE,KAAKwF,aACLxF,KAAK6F,e,8EA9RiB2C,EAAA,CAA5BC,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicFieldConditionCss","AtomicFieldConditionStyle0","AtomicFieldCondition","this","mustMatch","mustNotMatch","conditions","shouldBeRemoved","componentWillLoad","ifDefined","fieldNames","split","push","ResultTemplatesHelpers","fieldsMustBeDefined","ifNotDefined","fieldsMustNotBeDefined","makeMatchConditions","render","every","condition","result","h","componentDidLoad","host","remove","__decorate","MapProp","splitValues","ResultContext"],"sources":["src/components/search/result-template-components/atomic-field-condition/atomic-field-condition.pcss?tag=atomic-field-condition","src/components/search/result-template-components/atomic-field-condition/atomic-field-condition.tsx"],"sourcesContent":["atomic-field-condition {\n max-width: 100%;\n}\n","import {\n Result,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {Component, Prop, h, Element} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {makeMatchConditions} from '../../../common/result-templates/result-template-common';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-field-condition` component takes a list of conditions that, if fulfilled, apply the template in which it's defined.\n * The condition properties can be based on any top-level result property of the `result` object, not restricted to fields (e.g., `isRecommendation`).\n *\n * @slot default - The content to display if the conditions are met.\n *\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-field-condition',\n styleUrl: 'atomic-field-condition.pcss',\n shadow: false,\n})\nexport class AtomicFieldCondition {\n @Element() host!: HTMLElement;\n\n /**\n * Verifies whether the specified fields are defined.\n */\n @Prop({reflect: true}) ifDefined?: string;\n /**\n * Verifies whether the specified fields are not defined.\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) mustMatch: Record<string, string[]> =\n {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) mustNotMatch: Record<string, string[]> =\n {};\n\n private conditions: ResultTemplateCondition[] = [];\n private shouldBeRemoved = false;\n\n @ResultContext() private result!: Result;\n\n public componentWillLoad() {\n if (this.ifDefined) {\n const fieldNames = this.ifDefined.split(',');\n this.conditions.push(\n ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames)\n );\n }\n\n if (this.ifNotDefined) {\n const fieldNames = this.ifNotDefined.split(',');\n this.conditions.push(\n ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames)\n );\n }\n\n this.conditions.push(\n ...makeMatchConditions(this.mustMatch, this.mustNotMatch)\n );\n }\n\n public render() {\n if (!this.conditions.every((condition) => condition(this.result))) {\n this.shouldBeRemoved = true;\n return '';\n }\n\n return <slot />;\n }\n\n public componentDidLoad() {\n this.shouldBeRemoved && this.host.remove();\n }\n}\n"],"mappings":"4aAAA,MAAMA,EAA0B,yCAChC,MAAAC,EAAeD,E,iXCuBFE,EAAoB,M,yBAgBOC,KAAAC,UACpC,GAMoCD,KAAAE,aACpC,GAEMF,KAAAG,WAAwC,GACxCH,KAAAI,gBAAkB,M,oEAVxB,G,kBAOA,E,CAOK,iBAAAC,GACL,GAAIL,KAAKM,UAAW,CAClB,MAAMC,EAAaP,KAAKM,UAAUE,MAAM,KACxCR,KAAKG,WAAWM,KACdC,EAAuBC,oBAAoBJ,G,CAI/C,GAAIP,KAAKY,aAAc,CACrB,MAAML,EAAaP,KAAKY,aAAaJ,MAAM,KAC3CR,KAAKG,WAAWM,KACdC,EAAuBG,uBAAuBN,G,CAIlDP,KAAKG,WAAWM,QACXK,EAAoBd,KAAKC,UAAWD,KAAKE,c,CAIzC,MAAAa,GACL,IAAKf,KAAKG,WAAWa,OAAOC,GAAcA,EAAUjB,KAAKkB,UAAU,CACjElB,KAAKI,gBAAkB,KACvB,MAAO,E,CAGT,OAAOe,EAAA,Y,CAGF,gBAAAC,GACLpB,KAAKI,iBAAmBJ,KAAKqB,KAAKC,Q,6BA7CEC,EAAA,CAA7BC,EAAQ,CAACC,YAAa,Q,gCAOOF,EAAA,CAA7BC,EAAQ,CAACC,YAAa,Q,mCAMNF,EAAA,CAAxBG,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicInsightResultChildrenTemplate","constructor","hostRef","this","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","componentWillLoad","makeDefinedConditions","ifDefined","ifNotDefined","matchConditions","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/insight/result-templates/atomic-insight-result-children-template/atomic-insight-result-children-template.tsx"],"sourcesContent":["import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, State, Method} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-children-template',\n shadow: true,\n})\nexport class AtomicInsightResultChildrenTemplate {\n @Element() public host!: HTMLDivElement;\n\n @State() public error!: Error;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n public resultTemplateCommon!: ResultTemplateCommon;\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-insight-result-children'],\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"upBAgBaA,EAAmC,MAkD9C,WAAAC,CAAAC,G,UAtCeC,KAAAC,WAAwC,GAqBVD,KAAAE,UAGzC,GAOyCF,KAAAG,aAGzC,G,qCAlCmD,G,oEAwBnD,G,kBAUA,E,CAMJ,iBAAAC,GACEJ,KAAKK,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMP,KAAKO,KACXC,SAAWC,IACTT,KAAKU,MAAQD,CAAG,EAElBE,aAAc,CAAC,mC,CAIZ,iBAAAC,GACLZ,KAAKC,WAAaY,EAAsBb,KAAKc,UAAWd,KAAKe,cAC7Df,KAAKK,qBAAqBW,gBAAkBC,EAC1CjB,KAAKE,UACLF,KAAKG,a,CAQF,iBAAMe,GACX,OAAOlB,KAAKK,qBAAqBa,YAAYlB,KAAKC,WAAYD,KAAKU,M,CAG9D,MAAAS,GACL,OAAOnB,KAAKK,qBAAqBe,cAAcpB,KAAKU,M,6BA9CTW,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAUcF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicInsightResultTemplate","constructor","hostRef","this","matchConditions","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","allowEmpty","componentWillLoad","makeDefinedConditions","ifDefined","ifNotDefined","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/insight/result-templates/atomic-insight-result-template/atomic-insight-result-template.tsx"],"sourcesContent":["import {\n ResultTemplate as InsightResultTemplate,\n ResultTemplateCondition as InsightResultTemplateCondition,\n} from '@coveo/headless/insight';\nimport {Component, Element, Prop, Method, State} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-template',\n shadow: true,\n})\nexport class AtomicInsightResultTemplate {\n private resultTemplateCommon!: ResultTemplateCommon;\n\n @State() public error!: Error;\n\n @Element() public host!: HTMLDivElement;\n public matchConditions: InsightResultTemplateCondition[] = [];\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: InsightResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: [\n 'atomic-insight-result-list',\n 'atomic-insight-folded-result-list',\n ],\n allowEmpty: true,\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<InsightResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"upBAmBaA,EAA2B,MAmDtC,WAAAC,CAAAC,G,UA7COC,KAAAC,gBAAoD,GAS5CD,KAAAE,WAA+C,GAqBjBF,KAAAG,UAGzC,GAOyCH,KAAAI,aAGzC,G,qCAlC0D,G,oEAwB1D,G,kBAUA,E,CAIJ,iBAAAC,GACEL,KAAKM,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMR,KAAKQ,KACXC,SAAWC,IACTV,KAAKW,MAAQD,CAAG,EAElBE,aAAc,CACZ,6BACA,qCAEFC,WAAY,M,CAIT,iBAAAC,GACLd,KAAKE,WAAaa,EAAsBf,KAAKgB,UAAWhB,KAAKiB,cAC7DjB,KAAKM,qBAAqBL,gBAAkBiB,EAC1ClB,KAAKG,UACLH,KAAKI,a,CAQF,iBAAMe,GACX,OAAOnB,KAAKM,qBAAqBa,YAAYnB,KAAKE,WAAYF,KAAKW,M,CAG9D,MAAAS,GACL,OAAOpB,KAAKM,qBAAqBe,cAAcrB,KAAKW,M,6BAhDTW,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAUcF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["tableElementTagName"],"sources":["src/components/search/atomic-table-result/table-element-utils.ts"],"sourcesContent":["export const tableElementTagName = 'atomic-table-element';\n"],"mappings":"MAAaA,EAAsB,8B","ignoreList":[]}
|