@coveo/atomic 3.35.0-pre.b985e047c6 → 3.35.0-pre.c5c77d8c36
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 -2
- package/dist/atomic/components/_index.js +20 -22
- 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-insight-result-action.js +2 -2
- package/dist/atomic/components/atomic-insight-result-action.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js +2 -2
- package/dist/atomic/components/atomic-insight-result-attach-to-case-action.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-attach-to-case-indicator.js +2 -2
- package/dist/atomic/components/atomic-insight-result-attach-to-case-indicator.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-quickview-action.js +2 -2
- package/dist/atomic/components/atomic-insight-result-quickview-action.js.map +1 -1
- package/dist/atomic/components/atomic-insight-search-box.js +29 -2
- package/dist/atomic/components/atomic-insight-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-ipx-result-link.js +2 -2
- package/dist/atomic/components/atomic-ipx-result-link.js.map +1 -1
- package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
- package/dist/atomic/components/atomic-quickview.js +2 -2
- package/dist/atomic/components/atomic-quickview.js.map +1 -1
- package/dist/atomic/components/atomic-recs-interface.js +1 -1
- package/dist/atomic/components/atomic-result-badge.js +1 -1
- package/dist/atomic/components/atomic-result-badge.js.map +1 -1
- package/dist/atomic/components/atomic-result-children.js +2 -2
- package/dist/atomic/components/atomic-result-children.js.map +1 -1
- package/dist/atomic/components/atomic-result-date.js +1 -1
- package/dist/atomic/components/atomic-result-date.js.map +1 -1
- package/dist/atomic/components/atomic-result-fields-list.js +2 -2
- package/dist/atomic/components/atomic-result-fields-list.js.map +1 -1
- package/dist/atomic/components/atomic-result-html.js +1 -1
- package/dist/atomic/components/atomic-result-html.js.map +1 -1
- package/dist/atomic/components/atomic-result-icon.js +1 -1
- package/dist/atomic/components/atomic-result-icon.js.map +1 -1
- package/dist/atomic/components/atomic-result-image.js +1 -1
- package/dist/atomic/components/atomic-result-image.js.map +1 -1
- package/dist/atomic/components/atomic-result-link.js +2 -2
- package/dist/atomic/components/atomic-result-link.js.map +1 -1
- package/dist/atomic/components/atomic-result-localized-text.js +1 -1
- package/dist/atomic/components/atomic-result-localized-text.js.map +1 -1
- package/dist/atomic/components/atomic-result-multi-value-text.js +1 -1
- package/dist/atomic/components/atomic-result-multi-value-text.js.map +1 -1
- package/dist/atomic/components/atomic-result-number.js +1 -1
- package/dist/atomic/components/atomic-result-number.js.map +1 -1
- package/dist/atomic/components/atomic-result-printable-uri.js +1 -1
- package/dist/atomic/components/atomic-result-printable-uri.js.map +1 -1
- package/dist/atomic/components/atomic-result-rating.js +1 -1
- package/dist/atomic/components/atomic-result-rating.js.map +1 -1
- package/dist/atomic/components/atomic-result-text2.js +1 -1
- package/dist/atomic/components/atomic-result-text2.js.map +1 -1
- package/dist/atomic/components/atomic-result-timespan.js +1 -1
- package/dist/atomic/components/atomic-result-timespan.js.map +1 -1
- package/dist/atomic/components/atomic-result2.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-instant-results.js +37 -2
- package/dist/atomic/components/atomic-search-box-instant-results.js.map +1 -1
- package/dist/atomic/components/atomic-search-box.js +1 -7
- 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-smart-snippet-source2.js +1 -1
- package/dist/atomic/components/atomic-smart-snippet-source2.js.map +1 -1
- package/dist/atomic/components/atomic-tab-manager.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-children/atomic-product-children.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-description/atomic-product-description.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-excerpt/atomic-product-excerpt.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-field-condition/atomic-product-field-condition.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-image/atomic-product-image.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-link/atomic-product-link.js +2 -1
- package/dist/atomic/components/components/commerce/atomic-product-multi-value-text/atomic-product-multi-value-text.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-numeric-field-value/atomic-product-numeric-field-value.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-price/atomic-product-price.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-rating/atomic-product-rating.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-product-text/atomic-product-text.js +1 -1
- package/dist/atomic/components/components/commerce/product-template-component-utils/context/interactive-product-context-controller.js +25 -0
- package/dist/atomic/components/components/commerce/product-template-component-utils/context/product-context-controller.js +29 -0
- package/dist/atomic/components/components/common/suggestions/query-suggestions.js +11 -16
- package/dist/atomic/components/components/search/atomic-search-box-query-suggestions/atomic-search-box-query-suggestions.js +104 -0
- package/dist/atomic/components/components/search/index.js +1 -0
- package/dist/atomic/components/components/search/lazy-index.js +1 -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-decorators.js → stencil-result-template-decorators.js} +6 -2
- package/dist/atomic/components/stencil-result-template-decorators.js.map +1 -0
- package/dist/atomic/index.esm.js +1 -1
- package/dist/atomic/index.esm.js.map +1 -1
- package/dist/atomic/{p-955092ed.entry.js → p-01096d1c.entry.js} +2 -2
- package/dist/atomic/p-01096d1c.entry.js.map +1 -0
- package/dist/atomic/{p-874f0a4c.entry.js → p-060b94d2.entry.js} +2 -2
- package/dist/atomic/{p-82cd6398.entry.js → p-154cbbfe.entry.js} +2 -2
- package/dist/atomic/{p-82cd6398.entry.js.map → p-154cbbfe.entry.js.map} +1 -1
- package/dist/atomic/{p-db3b11ca.entry.js → p-2033533c.entry.js} +2 -2
- package/dist/atomic/{p-db3b11ca.entry.js.map → p-2033533c.entry.js.map} +1 -1
- package/dist/atomic/{p-4069d801.entry.js → p-268ce7ca.entry.js} +2 -2
- package/dist/atomic/p-268ce7ca.entry.js.map +1 -0
- package/dist/atomic/{p-82df2024.entry.js → p-326c1f55.entry.js} +2 -2
- package/dist/atomic/{p-e9dc8e90.entry.js → p-3ec45f9c.entry.js} +2 -2
- package/dist/atomic/p-3ec45f9c.entry.js.map +1 -0
- package/dist/atomic/{p-18684d4c.js → p-4080f740.js} +1 -1
- package/dist/atomic/p-4080f740.js.map +1 -0
- package/dist/atomic/{p-8d5228da.entry.js → p-42fffab2.entry.js} +2 -2
- package/dist/atomic/p-42fffab2.entry.js.map +1 -0
- package/dist/atomic/{p-190ddaca.entry.js → p-4cf97b0a.entry.js} +2 -2
- package/dist/atomic/p-4cf97b0a.entry.js.map +1 -0
- package/dist/atomic/{p-78427c6a.entry.js → p-5a9460ab.entry.js} +2 -2
- package/dist/atomic/p-5a9460ab.entry.js.map +1 -0
- package/dist/atomic/{p-15547bd5.entry.js → p-61b3f5ce.entry.js} +2 -2
- package/dist/atomic/p-61b3f5ce.entry.js.map +1 -0
- package/dist/atomic/{p-1ff7a9da.entry.js → p-6a3b139f.entry.js} +2 -2
- package/dist/atomic/p-6a3b139f.entry.js.map +1 -0
- package/dist/atomic/{p-df8d38ca.entry.js → p-7015679e.entry.js} +2 -2
- package/dist/atomic/p-7015679e.entry.js.map +1 -0
- package/dist/atomic/{p-dea22a8d.entry.js → p-886b184f.entry.js} +2 -2
- package/dist/atomic/p-886b184f.entry.js.map +1 -0
- package/dist/atomic/{p-ed413091.entry.js → p-8a30d1e9.entry.js} +2 -2
- package/dist/atomic/{p-b3f6561d.entry.js → p-8e964890.entry.js} +2 -2
- package/dist/atomic/p-8e964890.entry.js.map +1 -0
- package/dist/atomic/{p-182f9112.entry.js → p-a413f820.entry.js} +2 -2
- package/dist/atomic/p-a413f820.entry.js.map +1 -0
- package/dist/atomic/{p-5cab535b.entry.js → p-c5bd7f8d.entry.js} +2 -2
- package/dist/atomic/p-c5bd7f8d.entry.js.map +1 -0
- package/dist/atomic/{p-852cc16d.entry.js → p-cacb7fd8.entry.js} +2 -2
- package/dist/atomic/p-cacb7fd8.entry.js.map +1 -0
- package/dist/atomic/{p-c5164dbf.entry.js → p-cee86cff.entry.js} +2 -2
- package/dist/atomic/p-cee86cff.entry.js.map +1 -0
- package/dist/atomic/{p-4cb91ee7.entry.js → p-d5402772.entry.js} +2 -2
- package/dist/atomic/p-d5402772.entry.js.map +1 -0
- package/dist/atomic/p-d55668a3.entry.js +2 -0
- package/dist/atomic/p-d55668a3.entry.js.map +1 -0
- package/dist/atomic/{p-e6dc9de7.entry.js → p-da141605.entry.js} +2 -2
- package/dist/atomic/p-da141605.entry.js.map +1 -0
- package/dist/atomic/{p-a1798150.entry.js → p-dd258eaa.entry.js} +2 -2
- package/dist/atomic/p-dd258eaa.entry.js.map +1 -0
- package/dist/atomic/{p-945ddd53.entry.js → p-e1dbe31d.entry.js} +2 -2
- package/dist/atomic/p-e1dbe31d.entry.js.map +1 -0
- package/dist/atomic/{p-448091f7.entry.js → p-ecd3c0a9.entry.js} +2 -2
- package/dist/atomic/p-ecd3c0a9.entry.js.map +1 -0
- package/dist/atomic/{p-c2a5dac0.entry.js → p-f2c4209d.entry.js} +2 -2
- package/dist/atomic/{p-57049cd2.entry.js → p-f2c89d7c.entry.js} +2 -2
- package/dist/atomic/p-f2c89d7c.entry.js.map +1 -0
- package/dist/atomic/p-f800678c.entry.js.map +1 -1
- package/dist/cjs/_index.cjs.js +20 -20
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/atomic-field-condition.cjs.entry.js +2 -2
- package/dist/cjs/atomic-field-condition.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-action.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-action.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-attach-to-case-action.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-attach-to-case-indicator.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-attach-to-case-indicator.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-quickview-action.cjs.entry.js +3 -3
- package/dist/cjs/atomic-insight-result-quickview-action.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-search-box.cjs.entry.js +30 -4
- package/dist/cjs/atomic-insight-search-box.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-ipx-result-link.cjs.entry.js +4 -4
- package/dist/cjs/atomic-ipx-result-link.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview.cjs.entry.js +3 -3
- package/dist/cjs/atomic-quickview.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-badge.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-children.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-children.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-date.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-date.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-html.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-html.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-icon.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-image.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-image.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-link.cjs.entry.js +4 -4
- package/dist/cjs/atomic-result-link.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-localized-text.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-localized-text.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-multi-value-text.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-multi-value-text.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-number.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-number.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-printable-uri.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-printable-uri.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-rating.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-rating.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-text_2.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-text_2.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-timespan.cjs.entry.js +2 -2
- package/dist/cjs/atomic-result-timespan.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-smart-snippet-answer_2.cjs.entry.js +1 -1
- package/dist/cjs/atomic-smart-snippet-answer_2.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
- package/dist/cjs/atomic.cjs.js +1 -1
- package/dist/cjs/index-757bc886.js +0 -4
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{result-template-decorators-432d11a9.js → stencil-result-template-decorators-28b05aaf.js} +6 -2
- package/dist/cjs/stencil-result-template-decorators-28b05aaf.js.map +1 -0
- package/dist/cjs/version.cjs.js +1 -1
- package/dist/esm/_index.js +19 -19
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/atomic-field-condition.entry.js +1 -1
- package/dist/esm/atomic-field-condition.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-action.entry.js +2 -2
- package/dist/esm/atomic-insight-result-action.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js +2 -2
- package/dist/esm/atomic-insight-result-attach-to-case-action.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-attach-to-case-indicator.entry.js +2 -2
- package/dist/esm/atomic-insight-result-attach-to-case-indicator.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-quickview-action.entry.js +2 -2
- package/dist/esm/atomic-insight-result-quickview-action.entry.js.map +1 -1
- package/dist/esm/atomic-insight-search-box.entry.js +29 -3
- package/dist/esm/atomic-insight-search-box.entry.js.map +1 -1
- package/dist/esm/atomic-ipx-result-link.entry.js +2 -2
- package/dist/esm/atomic-ipx-result-link.entry.js.map +1 -1
- package/dist/esm/atomic-quickview-modal.entry.js +1 -1
- package/dist/esm/atomic-quickview.entry.js +2 -2
- package/dist/esm/atomic-quickview.entry.js.map +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-result-badge.entry.js +1 -1
- package/dist/esm/atomic-result-badge.entry.js.map +1 -1
- package/dist/esm/atomic-result-children.entry.js +2 -2
- package/dist/esm/atomic-result-children.entry.js.map +1 -1
- package/dist/esm/atomic-result-date.entry.js +1 -1
- package/dist/esm/atomic-result-date.entry.js.map +1 -1
- package/dist/esm/atomic-result-fields-list.entry.js +2 -2
- package/dist/esm/atomic-result-fields-list.entry.js.map +1 -1
- package/dist/esm/atomic-result-html.entry.js +1 -1
- package/dist/esm/atomic-result-html.entry.js.map +1 -1
- package/dist/esm/atomic-result-icon.entry.js +1 -1
- package/dist/esm/atomic-result-icon.entry.js.map +1 -1
- package/dist/esm/atomic-result-image.entry.js +1 -1
- package/dist/esm/atomic-result-image.entry.js.map +1 -1
- package/dist/esm/atomic-result-link.entry.js +2 -2
- package/dist/esm/atomic-result-link.entry.js.map +1 -1
- package/dist/esm/atomic-result-localized-text.entry.js +2 -2
- package/dist/esm/atomic-result-localized-text.entry.js.map +1 -1
- package/dist/esm/atomic-result-multi-value-text.entry.js +1 -1
- package/dist/esm/atomic-result-multi-value-text.entry.js.map +1 -1
- package/dist/esm/atomic-result-number.entry.js +1 -1
- package/dist/esm/atomic-result-number.entry.js.map +1 -1
- package/dist/esm/atomic-result-printable-uri.entry.js +1 -1
- package/dist/esm/atomic-result-printable-uri.entry.js.map +1 -1
- package/dist/esm/atomic-result-rating.entry.js +1 -1
- package/dist/esm/atomic-result-rating.entry.js.map +1 -1
- package/dist/esm/atomic-result-text_2.entry.js +1 -1
- package/dist/esm/atomic-result-text_2.entry.js.map +1 -1
- package/dist/esm/atomic-result-timespan.entry.js +1 -1
- package/dist/esm/atomic-result-timespan.entry.js.map +1 -1
- package/dist/esm/atomic-result.entry.js.map +1 -1
- package/dist/esm/atomic-smart-snippet-answer_2.entry.js +1 -1
- package/dist/esm/atomic-smart-snippet-answer_2.entry.js.map +1 -1
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-tab-manager.entry.js +1 -1
- package/dist/esm/atomic.js +1 -1
- package/dist/esm/index-3f35faca.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{result-template-decorators-2ed76ea9.js → stencil-result-template-decorators-f989bc6b.js} +6 -2
- package/dist/esm/stencil-result-template-decorators-f989bc6b.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/components/commerce/atomic-product/atomic-product.d.ts +1 -1
- package/dist/types/components/commerce/product-template-component-utils/context/fetch-product-context.d.ts +12 -0
- package/dist/types/components/commerce/product-template-component-utils/context/interactive-product-context-controller.d.ts +27 -0
- package/dist/types/components/commerce/product-template-component-utils/context/product-context-controller.d.ts +33 -0
- package/dist/types/components/commerce/product-template-component-utils/{stencil-product-template-decorators.d.ts → context/stencil-product-template-decorators.d.ts} +1 -1
- package/dist/types/components/common/smart-snippets/atomic-smart-snippet-source.d.ts +1 -1
- package/dist/types/components/search/atomic-result/atomic-result.d.ts +1 -1
- package/dist/types/components/search/{search-box-suggestions/atomic-search-box-query-suggestions → atomic-search-box-query-suggestions}/atomic-search-box-query-suggestions.d.ts +15 -6
- package/dist/types/components/search/index.d.ts +1 -0
- package/dist/types/components/search/result-template-component-utils/context/fetch-result-context.d.ts +8 -0
- package/dist/types/components/search/result-template-component-utils/context/interactive-result-context-controller.d.ts +12 -0
- package/dist/types/components/search/result-template-component-utils/context/result-context-controller.d.ts +18 -0
- package/dist/types/components/search/{result-template-components/result-template-decorators.d.ts → result-template-component-utils/context/stencil-result-template-decorators.d.ts} +6 -2
- package/dist/types/components.d.ts +0 -49
- package/dist/types/index.d.ts +3 -3
- package/docs/atomic-docs.json +3 -102
- package/package.json +1 -10
- package/dist/atomic/components/atomic-search-box-query-suggestions.d.ts +0 -11
- package/dist/atomic/components/atomic-search-box-query-suggestions.js +0 -8
- package/dist/atomic/components/atomic-search-box-query-suggestions.js.map +0 -1
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js +0 -89
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js.map +0 -1
- package/dist/atomic/components/components/common/item-list/fetch-item-context.js +0 -15
- package/dist/atomic/components/decorators/commerce/product-template-decorators.js +0 -68
- package/dist/atomic/components/result-template-decorators.js.map +0 -1
- package/dist/atomic/components/stencil-query-suggestions.js +0 -33
- package/dist/atomic/components/stencil-query-suggestions.js.map +0 -1
- package/dist/atomic/components/suggestions-events.js +0 -40
- package/dist/atomic/components/suggestions-events.js.map +0 -1
- package/dist/atomic/p-15547bd5.entry.js.map +0 -1
- package/dist/atomic/p-182f9112.entry.js.map +0 -1
- package/dist/atomic/p-18684d4c.js.map +0 -1
- package/dist/atomic/p-190ddaca.entry.js.map +0 -1
- package/dist/atomic/p-1ff7a9da.entry.js.map +0 -1
- package/dist/atomic/p-4069d801.entry.js.map +0 -1
- package/dist/atomic/p-448091f7.entry.js.map +0 -1
- package/dist/atomic/p-4cb91ee7.entry.js.map +0 -1
- package/dist/atomic/p-57049cd2.entry.js.map +0 -1
- package/dist/atomic/p-5cab535b.entry.js.map +0 -1
- package/dist/atomic/p-78427c6a.entry.js.map +0 -1
- package/dist/atomic/p-852cc16d.entry.js.map +0 -1
- package/dist/atomic/p-8d5228da.entry.js.map +0 -1
- package/dist/atomic/p-945ddd53.entry.js.map +0 -1
- package/dist/atomic/p-955092ed.entry.js.map +0 -1
- package/dist/atomic/p-a1798150.entry.js.map +0 -1
- package/dist/atomic/p-af93b44c.js +0 -2
- package/dist/atomic/p-af93b44c.js.map +0 -1
- package/dist/atomic/p-b3f6561d.entry.js.map +0 -1
- package/dist/atomic/p-c5164dbf.entry.js.map +0 -1
- package/dist/atomic/p-ca1425cc.entry.js +0 -2
- package/dist/atomic/p-ca1425cc.entry.js.map +0 -1
- package/dist/atomic/p-dea22a8d.entry.js.map +0 -1
- package/dist/atomic/p-df8d38ca.entry.js.map +0 -1
- package/dist/atomic/p-e6dc9de7.entry.js.map +0 -1
- package/dist/atomic/p-e8176ac8.entry.js +0 -2
- package/dist/atomic/p-e8176ac8.entry.js.map +0 -1
- package/dist/atomic/p-e9dc8e90.entry.js.map +0 -1
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js +0 -76
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js.map +0 -1
- package/dist/cjs/result-template-decorators-432d11a9.js.map +0 -1
- package/dist/cjs/stencil-query-suggestions-03268ecc.js +0 -38
- package/dist/cjs/stencil-query-suggestions-03268ecc.js.map +0 -1
- package/dist/esm/atomic-search-box-query-suggestions.entry.js +0 -72
- package/dist/esm/atomic-search-box-query-suggestions.entry.js.map +0 -1
- package/dist/esm/result-template-decorators-2ed76ea9.js.map +0 -1
- package/dist/esm/stencil-query-suggestions-5d6a46d7.js +0 -33
- package/dist/esm/stencil-query-suggestions-5d6a46d7.js.map +0 -1
- package/dist/types/decorators/commerce/product-template-decorators.d.ts +0 -68
- package/dist/types/types/open-api.d.ts +0 -3
- /package/dist/atomic/{p-874f0a4c.entry.js.map → p-060b94d2.entry.js.map} +0 -0
- /package/dist/atomic/{p-82df2024.entry.js.map → p-326c1f55.entry.js.map} +0 -0
- /package/dist/atomic/{p-ed413091.entry.js.map → p-8a30d1e9.entry.js.map} +0 -0
- /package/dist/atomic/{p-c2a5dac0.entry.js.map → p-f2c4209d.entry.js.map} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-image.entry.cjs.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,uKAAuK,CAAC;AACrM,gCAAe,oBAAoB;;;;;;;;;;;;MCiBtB,iBAAiB;;;QAIX,gBAAW,GAAG,KAAK,CAAC;2BAAN,KAAK;;;;;IAqBpC,IAAW,GAAG;QACZ,MAAM,KAAK,GAAGA,+BAAsB,CAAC,iBAAiB,CACpD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAC;QACF,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;KAChD;IAED,IAAY,OAAO;QACjB,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,MAAM,KAAK,GAAGA,+BAAsB,CAAC,iBAAiB,CACpD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,aAAa,CACnB,CAAC;YAEF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;gBACxD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;aACjB;YAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC7B,OAAO,KAAK,CAAC;aACd;SACF;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAoB,EAAE;YAChD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;SAC5B,CAAC,CAAC;KACJ;IAEO,UAAU,CAAC,OAAe;QAChC,IAAI,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G,CAAC,EACxB,OAAO,EAAE,MAAM,IAAI,CAAC,gBAAgB,EAAE,EACtC,OAAO,EAAC,MAAM,GACd,EACF;KACH;;;AAxG4B;IAA5BC,sCAAkB,EAAE;mDAA4B;AACxB;IAAxBC,6CAAa,EAAE;iDAAyB;;;;;","names":["ResultTemplatesHelpers","h","filterProtocol","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-image/atomic-result-image.pcss?tag=atomic-result-image","src/components/search/result-template-components/atomic-result-image/atomic-result-image.tsx"],"sourcesContent":["atomic-result-image {\n display: grid;\n place-items: center;\n grid-template-rows: 100%;\n width: 100%;\n height: 100%;\n\n img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n}\n","import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, h, Prop, Element, State} from '@stencil/core';\nimport {\n InitializeBindings,\n InitializableComponent,\n} from '../../../../utils/initialization-utils';\nimport {filterProtocol} from '../../../../utils/xss-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-image` component renders an image from a result field.\n */\n@Component({\n tag: 'atomic-result-image',\n styleUrl: 'atomic-result-image.pcss',\n shadow: false,\n})\nexport class AtomicResultImage implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() private host!: HTMLElement;\n @State() private useFallback = false;\n\n /**\n * The result field which the component should use. This will look for the field in the Result object first, then in the Result.raw object. It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field!: string;\n\n /**\n * The result field that contains the alt text for the image. This will look for the field in the Result object first, then in the Result.raw object\n *\n * If the field is not specified, or does not contain a valid value, the alt text will be set to \"Image for {productName}\".\n */\n @Prop({reflect: true}) imageAltField?: string;\n\n /**\n * An optional fallback image URL that will be used in case the specified image field is not available or encounters an error.\n */\n @Prop({reflect: true}) fallback?: string;\n\n public error!: Error;\n\n public get url() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n return Array.isArray(value) ? value[0] : value;\n }\n\n private get altText(): string {\n if (this.imageAltField) {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.imageAltField\n );\n\n if (Array.isArray(value) && typeof value[0] === 'string') {\n return value[0];\n }\n\n if (typeof value === 'string') {\n return value;\n }\n }\n\n return this.bindings.i18n.t('image-alt-fallback', {\n itemName: this.result.title,\n });\n }\n\n private logWarning(message: string) {\n this.bindings.engine.logger.warn(message, this.host);\n }\n\n private handleImageError() {\n const message = `The image url \"${this.url}\" is not valid or could not be loaded. You might want to add a \"fallback\" property.`;\n\n this.fallback ? (this.useFallback = true) : this.logWarning(message);\n }\n\n private handleMissingFallback(message: string) {\n if (!this.fallback) {\n this.logWarning(message);\n this.host.remove();\n return null;\n }\n return this.fallback;\n }\n\n private validateUrl(url: string) {\n if (!url) {\n const message = `\"${this.field}\" is missing. Please review your indexation. You might want to add a \"fallback\" property.`;\n return this.handleMissingFallback(message);\n }\n\n if (typeof url !== 'string') {\n const message = `Expected \"${this.field}\" to be a text field. Please review your indexation. You might want to add a \"fallback\" property.`;\n return this.handleMissingFallback(message);\n }\n\n return url;\n }\n\n public render() {\n let url = this.useFallback ? this.fallback : this.url;\n\n if (!this.useFallback) {\n url = this.validateUrl(url);\n if (!url) {\n return;\n }\n }\n\n return (\n <img\n alt={this.altText}\n src={filterProtocol(url)}\n onError={() => this.handleImageError()}\n loading=\"lazy\"\n />\n );\n }\n}\n"],"version":3}
|
@@ -10,7 +10,7 @@ const resultUtils = require('./result-utils-3313d650.js');
|
|
10
10
|
const slotUtils = require('./slot-utils-a30cb814.js');
|
11
11
|
const attributesSlot = require('./attributes-slot-4e7d7a75.js');
|
12
12
|
const stencilItemLink = require('./stencil-item-link-9feaef61.js');
|
13
|
-
const
|
13
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
14
14
|
require('./dom-utils-d4790328.js');
|
15
15
|
require('./init-queue-a18aa323.js');
|
16
16
|
require('./initialization-lit-stencil-common-utils-730030b0.js');
|
@@ -50,7 +50,7 @@ const AtomicResultLink = class {
|
|
50
50
|
const href = bueno.isUndefined(this.hrefTemplate)
|
51
51
|
? this.result.clickUri
|
52
52
|
: resultUtils.buildStringTemplateFromResult(this.hrefTemplate, this.result, this.bindings);
|
53
|
-
return (index.h(stencilItemLink.LinkWithItemAnalytics, { key: '
|
53
|
+
return (index.h(stencilItemLink.LinkWithItemAnalytics, { key: '2fb80cc69085cae4810fb109ab615684630d88ba', href: href, onSelect: () => this.interactiveResult.select(), onBeginDelayedSelect: () => this.interactiveResult.beginDelayedSelect(), onCancelPendingSelect: () => this.interactiveResult.cancelPendingSelect(), attributes: this.linkAttributes, stopPropagation: this.stopPropagation }, this.hasDefaultSlot ? (index.h("slot", null)) : (index.h("atomic-result-text", { field: "title", default: "no-title" }))));
|
54
54
|
}
|
55
55
|
get host() { return index.getElement(this); }
|
56
56
|
};
|
@@ -58,10 +58,10 @@ __decorate([
|
|
58
58
|
initializationUtils.InitializeBindings()
|
59
59
|
], AtomicResultLink.prototype, "bindings", void 0);
|
60
60
|
__decorate([
|
61
|
-
|
61
|
+
stencilResultTemplateDecorators.ResultContext()
|
62
62
|
], AtomicResultLink.prototype, "result", void 0);
|
63
63
|
__decorate([
|
64
|
-
|
64
|
+
stencilResultTemplateDecorators.InteractiveResultContext()
|
65
65
|
], AtomicResultLink.prototype, "interactiveResult", void 0);
|
66
66
|
AtomicResultLink.style = AtomicResultLinkStyle0;
|
67
67
|
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-link.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAA,MAAM,mBAAmB,GAAG,g5kEAAg5kE,CAAC;AAC76kE,+BAAe,mBAAmB;;;;;;;;;;;;MC4BrB,gBAAgB;;;;;IA0BpB,UAAU;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,CAC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","isUndefined","buildStringTemplateFromResult","h","LinkWithItemAnalytics","InitializeBindings","ResultContext","InteractiveResultContext"],"sources":["src/components/search/result-template-components/atomic-result-link/atomic-result-link.pcss?tag=atomic-result-link","src/components/search/result-template-components/atomic-result-link/atomic-result-link.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n@reference '../../../../utils/tailwind-utilities/link-style.css';\natomic-result-link {\n a {\n @apply link-style;\n }\n}\n","import {isUndefined} from '@coveo/bueno';\nimport {InteractiveResult} from '@coveo/headless';\nimport {Component, h, Prop, Element} from '@stencil/core';\nimport {buildCustomEvent} from '../../../../utils/event-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {buildStringTemplateFromResult} from '../../../../utils/result-utils';\nimport {getDefaultSlotFromHost} from '../../../../utils/slot-utils';\nimport {AnyUnfoldedItem} from '../../../common/item-list/unfolded-item';\nimport {getAttributesFromLinkSlot} from '../../../common/item-link/attributes-slot';\nimport {LinkWithItemAnalytics} from '../../../common/item-link/stencil-item-link';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {\n InteractiveResultContext,\n ResultContext,\n} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-link` component automatically transforms a search result title into a clickable link that points to the original item.\n * @slot default - Lets you display alternative content inside the link\n * @slot attributes - Lets you pass [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes) down to the link element, overriding other attributes, to be used exclusively with an \"a\" tag such as `<a slot=\"attributes\" target=\"_blank\" download></a>`.\n */\n@Component({\n tag: 'atomic-result-link',\n styleUrl: 'atomic-result-link.pcss',\n shadow: false,\n})\nexport class AtomicResultLink implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n public error!: Error;\n\n @ResultContext() private result!: AnyUnfoldedItem;\n @InteractiveResultContext() private interactiveResult!: InteractiveResult;\n\n @Element() private host!: HTMLElement;\n\n /**\n * Specifies a template literal from which to generate the `href` attribute value (see\n * [Template literals](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals)).\n *\n * The template literal can reference any number of result properties from the parent result. It can also reference the window object.\n *\n * For example, the following markup generates an `href` value such as `http://uri.com?id=itemTitle`, using the result's `clickUri` and `itemtitle` fields.\n * ```html\n * <atomic-result-link href-template='${clickUri}?id=${raw.itemtitle}'></atomic-result-link>\n * ```\n */\n @Prop({reflect: true}) hrefTemplate?: string;\n\n private hasDefaultSlot!: boolean;\n private linkAttributes?: Attr[];\n private stopPropagation?: boolean;\n\n public initialize() {\n this.host.dispatchEvent(\n buildCustomEvent(\n 'atomic/resolveStopPropagation',\n (stopPropagation: boolean) => {\n this.stopPropagation = stopPropagation;\n }\n )\n );\n }\n\n public connectedCallback() {\n const slotName = 'attributes';\n this.hasDefaultSlot = !!getDefaultSlotFromHost(this.host);\n this.linkAttributes = getAttributesFromLinkSlot(this.host, slotName);\n }\n\n public render() {\n const href = isUndefined(this.hrefTemplate)\n ? this.result.clickUri\n : buildStringTemplateFromResult(\n this.hrefTemplate,\n this.result,\n this.bindings\n );\n\n return (\n <LinkWithItemAnalytics\n href={href}\n onSelect={() => this.interactiveResult.select()}\n onBeginDelayedSelect={() => this.interactiveResult.beginDelayedSelect()}\n onCancelPendingSelect={() =>\n this.interactiveResult.cancelPendingSelect()\n }\n attributes={this.linkAttributes}\n stopPropagation={this.stopPropagation}\n >\n {this.hasDefaultSlot ? (\n <slot />\n ) : (\n <atomic-result-text\n field=\"title\"\n default=\"no-title\"\n ></atomic-result-text>\n )}\n </LinkWithItemAnalytics>\n );\n }\n}\n"],"version":3}
|
@@ -5,9 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index = require('./index-757bc886.js');
|
6
6
|
const bueno = require('@coveo/bueno');
|
7
7
|
const headless = require('@coveo/headless');
|
8
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
8
9
|
const initializationUtils = require('./initialization-utils-92f1b080.js');
|
9
10
|
const propsUtils = require('./props-utils-15a042f3.js');
|
10
|
-
|
11
|
+
require('./stencil-item-decorators-43a96f33.js');
|
11
12
|
require('./dom-utils-d4790328.js');
|
12
13
|
require('./event-utils-9bfcf3c5.js');
|
13
14
|
require('./init-queue-a18aa323.js');
|
@@ -15,7 +16,6 @@ require('./initialization-lit-stencil-common-utils-730030b0.js');
|
|
15
16
|
require('./utils-12b49e87.js');
|
16
17
|
require('./purify-85b542e2.js');
|
17
18
|
require('./_commonjsHelpers-b3309d7b.js');
|
18
|
-
require('./stencil-item-decorators-43a96f33.js');
|
19
19
|
|
20
20
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
21
21
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
@@ -71,7 +71,7 @@ __decorate([
|
|
71
71
|
initializationUtils.InitializeBindings()
|
72
72
|
], AtomicResultLocalizedText.prototype, "bindings", void 0);
|
73
73
|
__decorate([
|
74
|
-
|
74
|
+
stencilResultTemplateDecorators.ResultContext()
|
75
75
|
], AtomicResultLocalizedText.prototype, "result", void 0);
|
76
76
|
__decorate([
|
77
77
|
propsUtils.MapProp()
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-localized-text.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+Ba,yBAAyB;;;;;;QAYjB,UAAK,GAA2B,EAAE,CAAC;;;qBAAH,EAAE;;;IAMrD,MAAM;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE;YAC1C,GAAG,IAAI,CAAC,gBAAgB,EAAE;YAC1B,GAAG,IAAI,CAAC,eAAe,EAAE;SAC1B,CAAC,CAAC;KACJ;IAEO,gBAAgB;QACtB,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAA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AAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,aAAa,CAAC;YAC5D,MAAM,aAAa,GAAGA,+BAAsB,CAAC,iBAAiB,CAC5D,IAAI,CAAC,MAAM,EACX,SAAS,CACV,CAAC;YACF,IAAI,CAACC,uBAAiB,CAAC,aAAa,CAAC,EAAE;gBACrC,GAAG,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;aACpC;SACF,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;KACZ;IAEO,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO,EAAE,CAAC;SACX;QACD,OAAO;YACL,KAAK,EACFD,+BAAsB,CAAC,iBAAiB,CACvC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAW,CACN,IAAI,CAAC;SACpB,CAAC;KACH;;AArD4B;IAA5BE,sCAAkB,EAAE;2DAA4B;AAGxB;IAAxBC,6CAAa,EAAE;yDAAyB;AAQtB;IAAVC,kBAAO,EAAE;wDAAoC;;;;","names":["ResultTemplatesHelpers","isNullOrUndefined","InitializeBindings","ResultContext","MapProp"],"sources":["src/components/search/result-template-components/atomic-result-localized-text/atomic-result-localized-text.ts"],"sourcesContent":["import {isNullOrUndefined} from '@coveo/bueno';\nimport {type Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, State} from '@stencil/core';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\nimport {\n type InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {MapProp} from '../../../../utils/props-utils';\nimport type {Bindings} from '../../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-result-localized-text` component renders a target i18n localized string using the values of a target field.\n *\n * Given this i18n configuration:\n * ```\n * searchInterface.i18n.addResourceBundle('en', 'translation', {\n * classic_book_advert: 'Classic book from {{name}}',\n * });\n * ```\n *\n * The component could be configured in such a way to replace `{{name}}` with the `author` field value from the result item:\n * ```\n * <atomic-result-localized-text locale-key=\"classic_book_advert\" field-author=\"name\"></atomic-result-localized-text>\n * ```\n *\n * @MapProp name: field;attr: field;docs: The field from which to extract the target string and the variable used to map it to the target i18n parameter. For example, the following configuration extracts the value of `author` from a result, and assign it to the i18n parameter `name`: `field-author=\"name\"`;type: Record<string, string> ;default: {}\n */\n@Component({\n tag: 'atomic-result-localized-text',\n})\nexport class AtomicResultLocalizedText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @State() public error!: Error;\n\n @ResultContext() private result!: Result;\n /**\n * The i18n translation key.\n */\n @Prop() localeKey!: string;\n /**\n * The field value to dynamically evaluate.\n */\n @Prop() @MapProp() field: Record<string, string> = {};\n /**\n * The numerical field value used to determine whether to use the singular or plural value of a translation.\n * */\n @Prop() fieldCount?: string;\n\n render() {\n return this.bindings.i18n.t(this.localeKey, {\n ...this.parseFieldValues(),\n ...this.parseFieldCount(),\n });\n }\n\n private parseFieldValues() {\n const ret: Record<string, unknown> = {};\n if (Object.keys(this.field).length === 0) {\n return ret;\n }\n Object.entries(this.field).forEach(([fieldName, i18nParameter]) => {\n const fieldValueRaw = ResultTemplatesHelpers.getResultProperty(\n this.result,\n fieldName\n );\n if (!isNullOrUndefined(fieldValueRaw)) {\n ret[i18nParameter] = fieldValueRaw;\n }\n });\n\n return ret;\n }\n\n private parseFieldCount() {\n if (!this.fieldCount) {\n return {};\n }\n return {\n count:\n (ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.fieldCount!\n ) as number) ?? 1,\n };\n }\n}\n"],"version":3}
|
@@ -7,7 +7,7 @@ const headless = require('@coveo/headless');
|
|
7
7
|
const fieldUtils = require('./field-utils-a715deca.js');
|
8
8
|
const initializationUtils = require('./initialization-utils-92f1b080.js');
|
9
9
|
const utils = require('./utils-12b49e87.js');
|
10
|
-
const
|
10
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
11
11
|
require('./dom-utils-d4790328.js');
|
12
12
|
require('./event-utils-9bfcf3c5.js');
|
13
13
|
require('./init-queue-a18aa323.js');
|
@@ -132,7 +132,7 @@ __decorate([
|
|
132
132
|
initializationUtils.InitializeBindings()
|
133
133
|
], AtomicResultMultiValueText.prototype, "bindings", void 0);
|
134
134
|
__decorate([
|
135
|
-
|
135
|
+
stencilResultTemplateDecorators.ResultContext()
|
136
136
|
], AtomicResultMultiValueText.prototype, "result", void 0);
|
137
137
|
AtomicResultMultiValueText.style = AtomicResultMultiValueTextStyle0;
|
138
138
|
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-multi-value-text.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;AAAA,MAAM,6BAA6B,GAAG,gJAAgJ,CAAC;AACvL,yCAAe,6BAA6B;;;;;;;;;;;;MCyB/B,0BAA0B;;;;;;;QAqBP,uBAAkB,GAAG,CAAC,CAAC;;;;QAKvB,cAAS,GAAkB,IAAI,CAAC;QAEtD,iBAAY,GAAoB,IAAI,CAAC;;;kCAPM,CAAC;yBAKK,IAAI;;IAItD,UAAU;QACf,IAAI,CAAC,iBAAiB,GAAGA,+BAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACvE;IAED,IAAY,YAAY;QACtB,MAAM,KAAK,GAAGC,+BAAsB,CAAC,iBAAiB,CACpD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAC;QAEF,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;SACxC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACpD,IAAI,CAAC,KAA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AAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5D;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACzC;QACD,IAAI,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YACtC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,eAAe,CAClB,MAAM,CAAC,uBAAuB,GAAG,CAAC,CAAC,EACnC,mBAAmB,CACpB,CACF,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,GAAG,uBAAuB,CAAC,CAAC,CAAC;SAC3E;QACD,OAAO,KAAK,CAAC;KACd;IAEM,mBAAmB;QACxB,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO;SACR;QACD,QACEA,gBAAI,IAAI,EAAC,8BAA8B,OACjC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CACxC,EACL;KACH;;;AAjK4B;IAA5BC,sCAAkB,EAAE;4DAA4B;AACxB;IAAxBC,sCAAa,EAAE;0DAAyB;;;;;","names":["buildBreadcrumbManager","ResultTemplatesHelpers","getFieldValueCaption","titleToKebab","h","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-multi-value-text/atomic-result-multi-value-text.pcss?tag=atomic-result-multi-value-text&encapsulation=shadow","src/components/search/result-template-components/atomic-result-multi-value-text/atomic-result-multi-value-text.tsx"],"sourcesContent":[":host {\n > ul {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n\n li {\n display: inline-block;\n }\n }\n}\n\n.separator {\n &::before {\n display: inline;\n content: ',\\00a0';\n }\n}\n","import {\n BreadcrumbManager,\n buildBreadcrumbManager,\n Result,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {Component, Element, Prop, h, State, VNode} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {titleToKebab} from '../../../../utils/utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-multi-value-text` component renders the values of a multi-value string field.\n * @part result-multi-value-text-list - The list of field values.\n * @part result-multi-value-text-separator - The separator to display between each of the field values.\n * @part result-multi-value-text-value - A field value.\n * @part result-multi-value-text-value-more - A label indicating some values were omitted.\n * @slot result-multi-value-text-value-* - A custom caption value that's specified for a given part of a multi-text field value. For example, if you want to use `Off-Campus Resident` as a caption value for `Off-campus apartment` in `Off-campus apartment;On-campus apartment`, you'd use `<span slot=\"result-multi-value-text-value-off-campus-apartment\">Off-Campus Resident</span>`). The suffix of this slot corresponds with the field value, written in kebab case.\n */\n@Component({\n tag: 'atomic-result-multi-value-text',\n styleUrl: 'atomic-result-multi-value-text.pcss',\n shadow: true,\n})\nexport class AtomicResultMultiValueText {\n public breadcrumbManager!: BreadcrumbManager;\n\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The field that the component should use.\n * The component will try to find this field in the `Result.raw` object unless it finds it in the `Result` object first.\n * Make sure this field is present in the `fieldsToInclude` property of the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n\n /**\n * The maximum number of field values to display.\n * If there are _n_ more values than the specified maximum, the last displayed value will be \"_n_ more...\".\n */\n @Prop({reflect: true}) public maxValuesToDisplay = 3;\n\n /**\n * The delimiter used to separate values when the field isn't indexed as a multi value field.\n */\n @Prop({reflect: true}) public delimiter: string | null = null;\n\n private sortedValues: string[] | null = null;\n\n public initialize() {\n this.breadcrumbManager = buildBreadcrumbManager(this.bindings.engine);\n }\n\n private get resultValues() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n\n if (value === null) {\n return null;\n }\n\n if (Array.isArray(value)) {\n return value.map((v) => `${v}`.trim());\n }\n\n if (typeof value !== 'string' || value.trim() === '') {\n this.error = new Error(\n `Could not parse \"${value}\" from field \"${this.field}\" as a string array.`\n );\n return null;\n }\n\n return this.delimiter\n ? value.split(this.delimiter).map((value) => value.trim())\n : [value];\n }\n\n private get facetSelectedValues() {\n return this.breadcrumbManager.state.facetBreadcrumbs\n .filter((facet) => facet.field === this.field)\n .reduce(\n (values, facet) => [\n ...values,\n ...facet.values.map(({value}) => value.value),\n ],\n [] as string[]\n );\n }\n\n private updateSortedValues() {\n const allValues = this.resultValues;\n if (allValues === null) {\n this.sortedValues = null;\n return;\n }\n const allValuesSet = new Set(allValues);\n const firstValues = this.facetSelectedValues.filter((value) =>\n allValuesSet.has(value)\n );\n this.sortedValues = Array.from(\n allValues.reduce((set, value) => set.add(value), new Set(firstValues))\n );\n }\n\n private getShouldDisplayLabel(values: string[]) {\n return (\n this.maxValuesToDisplay > 0 && values.length > this.maxValuesToDisplay\n );\n }\n\n private getNumberOfValuesToDisplay(values: string[]) {\n return Math.min(values.length, this.maxValuesToDisplay);\n }\n\n private renderValue(value: string) {\n const label = getFieldValueCaption(this.field, value, this.bindings.i18n);\n const kebabValue = titleToKebab(value);\n return (\n <li key={value} part=\"result-multi-value-text-value\">\n <slot name={`result-multi-value-text-value-${kebabValue}`}>\n {label}\n </slot>\n </li>\n );\n }\n\n private renderSeparator(beforeValue: string, afterValue: string) {\n return (\n <li\n aria-hidden=\"true\"\n part=\"result-multi-value-text-separator\"\n key={`${beforeValue}~${afterValue}`}\n class=\"separator\"\n ></li>\n );\n }\n\n private renderMoreLabel(value: number) {\n return (\n <li key=\"more-field-values\" part=\"result-multi-value-text-value-more\">\n {this.bindings.i18n.t('n-more', {value})}\n </li>\n );\n }\n\n private renderListItems(values: string[]) {\n const numberOfValuesToDisplay = this.getNumberOfValuesToDisplay(values);\n\n const nodes: VNode[] = [];\n for (let i = 0; i < numberOfValuesToDisplay; i++) {\n if (i > 0) {\n nodes.push(this.renderSeparator(values[i - 1], values[i]));\n }\n nodes.push(this.renderValue(values[i]));\n }\n if (this.getShouldDisplayLabel(values)) {\n nodes.push(\n this.renderSeparator(\n values[numberOfValuesToDisplay - 1],\n 'more-field-values'\n )\n );\n nodes.push(this.renderMoreLabel(values.length - numberOfValuesToDisplay));\n }\n return nodes;\n }\n\n public componentWillRender() {\n this.updateSortedValues();\n }\n\n public render() {\n if (this.sortedValues === null) {\n this.host.remove();\n return;\n }\n return (\n <ul part=\"result-multi-value-text-list\">\n {...this.renderListItems(this.sortedValues)}\n </ul>\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"atomic-result-multi-value-text.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;AAAA,MAAM,6BAA6B,GAAG,gJAAgJ,CAAC;AACvL,yCAAe,6BAA6B;;;;;;;;;;;;MCyB/B,0BAA0B;;;;;;;QAqBP,uBAAkB,GAAG,CAAC,CAAC;;;;QAKvB,cAAS,GAAkB,IAAI,CAAC;QAEtD,iBAAY,GAAoB,IAAI,CAAC;;;kCAPM,CAAC;yBAKK,IAAI;;IAItD,UAAU;QACf,IAAI,CAAC,iBAAiB,GAAGA,+BAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KACvE;IAED,IAAY,YAAY;QACtB,MAAM,KAAK,GAAGC,+BAAsB,CAAC,iBAAiB,CACpD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAC;QAEF,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC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MAAM,CAAC,CAAC;QAExE,MAAM,KAAK,GAAY,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,EAAE,CAAC,EAAE,EAAE;YAChD,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5D;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACzC;QACD,IAAI,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YACtC,KAAK,CAAC,IAAI,CACR,IAAI,CAAC,eAAe,CAClB,MAAM,CAAC,uBAAuB,GAAG,CAAC,CAAC,EACnC,mBAAmB,CACpB,CACF,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,GAAG,uBAAuB,CAAC,CAAC,CAAC;SAC3E;QACD,OAAO,KAAK,CAAC;KACd;IAEM,mBAAmB;QACxB,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO;SACR;QACD,QACEA,gBAAI,IAAI,EAAC,8BAA8B,OACjC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CACxC,EACL;KACH;;;AAjK4B;IAA5BC,sCAAkB,EAAE;4DAA4B;AACxB;IAAxBC,6CAAa,EAAE;0DAAyB;;;;;","names":["buildBreadcrumbManager","ResultTemplatesHelpers","getFieldValueCaption","titleToKebab","h","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-multi-value-text/atomic-result-multi-value-text.pcss?tag=atomic-result-multi-value-text&encapsulation=shadow","src/components/search/result-template-components/atomic-result-multi-value-text/atomic-result-multi-value-text.tsx"],"sourcesContent":[":host {\n > ul {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n\n li {\n display: inline-block;\n }\n }\n}\n\n.separator {\n &::before {\n display: inline;\n content: ',\\00a0';\n }\n}\n","import {\n BreadcrumbManager,\n buildBreadcrumbManager,\n Result,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {Component, Element, Prop, h, State, VNode} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {titleToKebab} from '../../../../utils/utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-multi-value-text` component renders the values of a multi-value string field.\n * @part result-multi-value-text-list - The list of field values.\n * @part result-multi-value-text-separator - The separator to display between each of the field values.\n * @part result-multi-value-text-value - A field value.\n * @part result-multi-value-text-value-more - A label indicating some values were omitted.\n * @slot result-multi-value-text-value-* - A custom caption value that's specified for a given part of a multi-text field value. For example, if you want to use `Off-Campus Resident` as a caption value for `Off-campus apartment` in `Off-campus apartment;On-campus apartment`, you'd use `<span slot=\"result-multi-value-text-value-off-campus-apartment\">Off-Campus Resident</span>`). The suffix of this slot corresponds with the field value, written in kebab case.\n */\n@Component({\n tag: 'atomic-result-multi-value-text',\n styleUrl: 'atomic-result-multi-value-text.pcss',\n shadow: true,\n})\nexport class AtomicResultMultiValueText {\n public breadcrumbManager!: BreadcrumbManager;\n\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The field that the component should use.\n * The component will try to find this field in the `Result.raw` object unless it finds it in the `Result` object first.\n * Make sure this field is present in the `fieldsToInclude` property of the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n\n /**\n * The maximum number of field values to display.\n * If there are _n_ more values than the specified maximum, the last displayed value will be \"_n_ more...\".\n */\n @Prop({reflect: true}) public maxValuesToDisplay = 3;\n\n /**\n * The delimiter used to separate values when the field isn't indexed as a multi value field.\n */\n @Prop({reflect: true}) public delimiter: string | null = null;\n\n private sortedValues: string[] | null = null;\n\n public initialize() {\n this.breadcrumbManager = buildBreadcrumbManager(this.bindings.engine);\n }\n\n private get resultValues() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n\n if (value === null) {\n return null;\n }\n\n if (Array.isArray(value)) {\n return value.map((v) => `${v}`.trim());\n }\n\n if (typeof value !== 'string' || value.trim() === '') {\n this.error = new Error(\n `Could not parse \"${value}\" from field \"${this.field}\" as a string array.`\n );\n return null;\n }\n\n return this.delimiter\n ? value.split(this.delimiter).map((value) => value.trim())\n : [value];\n }\n\n private get facetSelectedValues() {\n return this.breadcrumbManager.state.facetBreadcrumbs\n .filter((facet) => facet.field === this.field)\n .reduce(\n (values, facet) => [\n ...values,\n ...facet.values.map(({value}) => value.value),\n ],\n [] as string[]\n );\n }\n\n private updateSortedValues() {\n const allValues = this.resultValues;\n if (allValues === null) {\n this.sortedValues = null;\n return;\n }\n const allValuesSet = new Set(allValues);\n const firstValues = this.facetSelectedValues.filter((value) =>\n allValuesSet.has(value)\n );\n this.sortedValues = Array.from(\n allValues.reduce((set, value) => set.add(value), new Set(firstValues))\n );\n }\n\n private getShouldDisplayLabel(values: string[]) {\n return (\n this.maxValuesToDisplay > 0 && values.length > this.maxValuesToDisplay\n );\n }\n\n private getNumberOfValuesToDisplay(values: string[]) {\n return Math.min(values.length, this.maxValuesToDisplay);\n }\n\n private renderValue(value: string) {\n const label = getFieldValueCaption(this.field, value, this.bindings.i18n);\n const kebabValue = titleToKebab(value);\n return (\n <li key={value} part=\"result-multi-value-text-value\">\n <slot name={`result-multi-value-text-value-${kebabValue}`}>\n {label}\n </slot>\n </li>\n );\n }\n\n private renderSeparator(beforeValue: string, afterValue: string) {\n return (\n <li\n aria-hidden=\"true\"\n part=\"result-multi-value-text-separator\"\n key={`${beforeValue}~${afterValue}`}\n class=\"separator\"\n ></li>\n );\n }\n\n private renderMoreLabel(value: number) {\n return (\n <li key=\"more-field-values\" part=\"result-multi-value-text-value-more\">\n {this.bindings.i18n.t('n-more', {value})}\n </li>\n );\n }\n\n private renderListItems(values: string[]) {\n const numberOfValuesToDisplay = this.getNumberOfValuesToDisplay(values);\n\n const nodes: VNode[] = [];\n for (let i = 0; i < numberOfValuesToDisplay; i++) {\n if (i > 0) {\n nodes.push(this.renderSeparator(values[i - 1], values[i]));\n }\n nodes.push(this.renderValue(values[i]));\n }\n if (this.getShouldDisplayLabel(values)) {\n nodes.push(\n this.renderSeparator(\n values[numberOfValuesToDisplay - 1],\n 'more-field-values'\n )\n );\n nodes.push(this.renderMoreLabel(values.length - numberOfValuesToDisplay));\n }\n return nodes;\n }\n\n public componentWillRender() {\n this.updateSortedValues();\n }\n\n public render() {\n if (this.sortedValues === null) {\n this.host.remove();\n return;\n }\n return (\n <ul part=\"result-multi-value-text-list\">\n {...this.renderListItems(this.sortedValues)}\n </ul>\n );\n }\n}\n"],"version":3}
|
@@ -6,7 +6,7 @@ const index = require('./index-757bc886.js');
|
|
6
6
|
const headless = require('@coveo/headless');
|
7
7
|
const initializationUtils = require('./initialization-utils-92f1b080.js');
|
8
8
|
const formatCommon = require('./format-common-4aa8aa88.js');
|
9
|
-
const
|
9
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
10
10
|
require('./dom-utils-d4790328.js');
|
11
11
|
require('./event-utils-9bfcf3c5.js');
|
12
12
|
require('./init-queue-a18aa323.js');
|
@@ -81,7 +81,7 @@ __decorate([
|
|
81
81
|
initializationUtils.InitializeBindings()
|
82
82
|
], AtomicResultNumber.prototype, "bindings", void 0);
|
83
83
|
__decorate([
|
84
|
-
|
84
|
+
stencilResultTemplateDecorators.ResultContext()
|
85
85
|
], AtomicResultNumber.prototype, "result", void 0);
|
86
86
|
|
87
87
|
exports.atomic_result_number = AtomicResultNumber;
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-number.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAmBa,kBAAkB;;;QAepB,cAAS,GAAoBA,mCAAsB,CAAC;QAEpD,mBAAc,GAAkB,IAAI,CAAC;;;yBAFRA,mCAAsB;8BAEnB,IAAI;;IAGtC,SAAS,CAAC,KAAmC;QAClD,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;KAC/B;IAEO,UAAU;QAChB,MAAM,KAAK,GAAGC,+BAAsB,CAAC,iBAAiB,CACpD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAC;QACF,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QACD,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;YAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CACpB,oBAAoB,KAAK,iBAAiB,IAAI,CAAC,KAAK,gBAAgB,CACrE,CAAC;YACF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,aAAa,CAAC;KACtB;IAEO,WAAW,CAAC,KAAa;QAC/B,IAAI;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAqB,CAAC,CAAC;SACxE;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,KAAc,CAAC;YAC5B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;SACzB;KACF;IAEO,oBAAoB;QAC1B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,CAAC;SACb;QACD,OAAO,aAAa,CAAC;KACtB;IAEO,WAAW,CAAC,KAAa;QAC/B,IAAI;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAqB,CAAC,CAAC;SACxE;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,KAAc,CAAC;YAC5B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;SACzB;KACF;IAEO,oBAAoB;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC/C;KACF;IAED,mBAAmB;QACjB,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC7B;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO;SACR;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;KAC5B;;;AArE4B;IAA5BC,sCAAkB,EAAE;oDAA4B;AACxB;IAAxBC,6CAAa,EAAE;kDAAyB;;;;","names":["defaultNumberFormatter","ResultTemplatesHelpers","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-number/atomic-result-number.tsx"],"sourcesContent":["import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, Element, State, Listen} from '@stencil/core';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {\n defaultNumberFormatter,\n NumberFormatter,\n} from '../../../common/formats/format-common';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-number` component renders the value of a number result field.\n *\n * @slot default - The number can be formatted by adding a `atomic-format-number`, `atomic-format-currency` or `atomic-format-unit` component into this component.\n */\n@Component({\n tag: 'atomic-result-number',\n shadow: false,\n})\nexport class AtomicResultNumber {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The field that the component should use.\n * The component will try to find this field in the `Result.raw` object unless it finds it in the `Result` object first.\n * Make sure this field is present in the `fieldsToInclude` property of the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field!: string;\n\n @State() formatter: NumberFormatter = defaultNumberFormatter;\n\n @State() valueToDisplay: string | null = null;\n\n @Listen('atomic/numberFormat')\n public setFormat(event: CustomEvent<NumberFormatter>) {\n event.preventDefault();\n event.stopPropagation();\n this.formatter = event.detail;\n }\n\n private parseValue() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n if (value === null) {\n return null;\n }\n const valueAsNumber = parseFloat(`${value}`);\n if (Number.isNaN(valueAsNumber)) {\n this.error = new Error(\n `Could not parse \"${value}\" from field \"${this.field}\" as a number.`\n );\n return null;\n }\n return valueAsNumber;\n }\n\n private formatValue(value: number) {\n try {\n return this.formatter(value, this.bindings.i18n.languages as string[]);\n } catch (error) {\n this.error = error as Error;\n return value.toString();\n }\n }\n\n private updateValueToDisplay() {\n const value = this.parseValue();\n if (value !== null) {\n this.valueToDisplay = this.formatValue(value);\n }\n }\n\n componentWillRender() {\n this.updateValueToDisplay();\n }\n\n public render() {\n if (this.valueToDisplay === null) {\n this.host.remove();\n return;\n }\n return this.valueToDisplay;\n }\n}\n"],"version":3}
|
@@ -11,7 +11,7 @@ const stencilAccessibilityUtils = require('./stencil-accessibility-utils-86cc707
|
|
11
11
|
const utils = require('./utils-12b49e87.js');
|
12
12
|
const attributesSlot = require('./attributes-slot-4e7d7a75.js');
|
13
13
|
const stencilItemLink = require('./stencil-item-link-9feaef61.js');
|
14
|
-
const
|
14
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
15
15
|
require('./dom-utils-d4790328.js');
|
16
16
|
require('./event-utils-9bfcf3c5.js');
|
17
17
|
require('./init-queue-a18aa323.js');
|
@@ -124,7 +124,7 @@ __decorate([
|
|
124
124
|
initializationUtils.InitializeBindings()
|
125
125
|
], AtomicResultPrintableUri.prototype, "bindings", void 0);
|
126
126
|
__decorate([
|
127
|
-
|
127
|
+
stencilResultTemplateDecorators.ResultContext()
|
128
128
|
], AtomicResultPrintableUri.prototype, "result", void 0);
|
129
129
|
AtomicResultPrintableUri.style = AtomicResultPrintableUriStyle0;
|
130
130
|
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-printable-uri.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,2BAA2B,GAAG,w/lEAAw/lE,CAAC;AAC7hmE,uCAAe,2BAA2B;;;;;;;;;;;;MC0B7B,wBAAwB;;;QAK1B,iBAAY,GAAG,KAAK,CAAC;;;;QAMP,qBAAgB,GAAG,CAAC,CAAC;4BANpB,KAAK;;gCAMa,CAAC;;IAO3C,IAAY,WAAW;QACrB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC3B,IAAI,CAAC,iBAAiB,GAAG,IAAIA,+CAAqB,CAAC,IAAI,CAAC,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC;KAC/B;IAEM,iBAAiB;QACtB,IAAI;YACF,IAAIC,YAAM,CAAC;gBACT,gBAAgB,EAAE,IAAIC,iBAAW,CAAC,EAAC,GAAG,EAAE,CAAC,EAAC,CAAC;aAC5C,CAAC,CAAC,QAAQ,CAAC,EAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAC,CAAC,CAAC;SACxD;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,KAAc,CAAC;SAC7B;QACD,MAAM,QAAQ,GAAG,YAAY,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAGC,wCAAyB,CAAC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,SAAS,CAAC,EAAE,CAAC;kBAC1D,SAAS,IAGd,OAAO,CACc,EACxB;KACH;IAEM,MAAM;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,QACEH,8BAAgB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAG,OAAO,CAAM,EACrE;SACH;QAED,OAAO,IAAI,CAAC,UAAU,CACpBA,gCAAoB,KAAK,EAAC,cAAc,GAAsB,EAC9D,IAAI,CAAC,MAAM,CAAC,QAAQ,EACpB,KAAK,CACN,CAAC;KACH;;;AAhJ4B;IAA5BI,sCAAkB,EAAE;0DAA4B;AACxB;IAAxBC,sCAAa,EAAE;wDAAyB;;;;;","names":["FocusTargetController","Schema","NumberValue","getAttributesFromLinkSlot","buildInteractiveResult","h","parseXML","Arrow","LinkWithItemAnalytics","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-printable-uri/atomic-result-printable-uri.pcss?tag=atomic-result-printable-uri","src/components/search/result-template-components/atomic-result-printable-uri/atomic-result-printable-uri.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n\natomic-result-printable-uri {\n max-width: 100%;\n word-break: break-word;\n\n a,\n button {\n @apply text-primary;\n\n &:hover,\n &:focus-visible {\n text-decoration: underline;\n @apply text-primary;\n }\n\n &:focus {\n outline: none;\n }\n\n &:visited {\n @apply text-visited;\n }\n }\n\n ul {\n display: flex;\n flex-wrap: wrap;\n }\n\n li {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n\n a {\n display: inline-block;\n vertical-align: middle;\n max-width: 100%;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n white-space: nowrap;\n &:last-child {\n white-space: normal;\n\n &::after {\n content: none;\n }\n }\n\n .result-printable-uri-separator {\n display: inline-block;\n margin: 0 0.5rem;\n vertical-align: middle;\n width: 0.75rem;\n height: 0.75rem;\n @apply text-neutral-dark;\n }\n }\n}\n","import {Schema, NumberValue} from '@coveo/bueno';\nimport {\n buildInteractiveResult,\n InteractiveResult,\n Result,\n} from '@coveo/headless';\nimport {Component, Element, h, Prop, State, VNode} from '@stencil/core';\nimport Arrow from '../../../../images/arrow-right.svg';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {FocusTargetController} from '../../../../utils/stencil-accessibility-utils';\nimport {parseXML} from '../../../../utils/utils';\nimport {getAttributesFromLinkSlot} from '../../../common/item-link/attributes-slot';\nimport {LinkWithItemAnalytics} from '../../../common/item-link/stencil-item-link';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-printable-uri` component displays the URI, or path, to access a result.\n *\n * @slot attributes - Lets you pass [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes) down to anchor elements, overriding other attributes.\n * To be used exclusively in anchor elements, such as: `<a slot=\"attributes\" target=\"_blank\" download></a>`.\n */\n@Component({\n tag: 'atomic-result-printable-uri',\n styleUrl: 'atomic-result-printable-uri.pcss',\n shadow: false,\n})\nexport class AtomicResultPrintableUri {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() public host!: HTMLElement;\n\n @State() listExpanded = false;\n @State() error!: Error;\n\n /**\n * The maximum number of Uri parts to display. This has to be over the minimum of `3` in order to be effective. Putting `Infinity` will disable the ellipsis.\n */\n @Prop({reflect: true}) maxNumberOfParts = 5;\n\n private expandedPartFocus?: FocusTargetController;\n\n private interactiveResult!: InteractiveResult;\n private linkAttributes?: Attr[];\n\n private get focusTarget() {\n if (!this.expandedPartFocus) {\n this.expandedPartFocus = new FocusTargetController(this);\n }\n return this.expandedPartFocus;\n }\n\n public connectedCallback() {\n try {\n new Schema({\n maxNumberOfParts: new NumberValue({min: 3}),\n }).validate({maxNumberOfParts: this.maxNumberOfParts});\n } catch (error) {\n this.error = error as Error;\n }\n const slotName = 'attributes';\n this.linkAttributes = getAttributesFromLinkSlot(this.host, slotName);\n }\n\n public initialize() {\n this.interactiveResult = buildInteractiveResult(this.bindings.engine, {\n options: {result: this.result},\n });\n }\n\n private getIndexOfEllipsis(parentsCount: number) {\n const valuesToHide = Math.max(2, parentsCount - this.maxNumberOfParts);\n const valuesToShowBeforeEllipsis = parentsCount - valuesToHide - 1;\n return valuesToShowBeforeEllipsis;\n }\n\n private renderEllipsis() {\n return (\n <li>\n <button\n aria-label={this.bindings.i18n.t('collapsed-uri-parts')}\n onClick={(e) => {\n e.stopPropagation();\n this.focusTarget.focusOnNextTarget();\n this.listExpanded = true;\n }}\n >\n ...\n </button>\n {this.renderSeparator()}\n </li>\n );\n }\n\n private get allParents() {\n const parentsXml = parseXML(`${this.result.raw.parents}`);\n const parents = Array.from(parentsXml.getElementsByTagName('parent'));\n const ellipsisIndex = this.getIndexOfEllipsis(parents.length);\n return parents.map((parent, i) => {\n const name = parent.getAttribute('name');\n const uri = parent.getAttribute('uri')!;\n return (\n <li>\n {this.renderLink(name, uri, i === ellipsisIndex)}\n {i === parents.length - 1 ? null : this.renderSeparator()}\n </li>\n );\n });\n }\n\n private renderSeparator() {\n return (\n <atomic-icon\n class=\"result-printable-uri-separator\"\n icon={Arrow}\n role=\"separator\"\n ></atomic-icon>\n );\n }\n\n private renderParents() {\n const parents = this.allParents;\n if (this.listExpanded || parents.length <= this.maxNumberOfParts) {\n return parents;\n }\n\n return [\n parents.slice(0, this.getIndexOfEllipsis(parents.length)),\n this.renderEllipsis(),\n parents.slice(-1),\n ];\n }\n\n private renderLink(\n content: VNode | string | null,\n uri: string,\n shouldSetTarget: boolean\n ) {\n return (\n <LinkWithItemAnalytics\n href={uri}\n title={typeof content === 'string' ? content : undefined}\n onSelect={() => this.interactiveResult.select()}\n onBeginDelayedSelect={() => this.interactiveResult.beginDelayedSelect()}\n onCancelPendingSelect={() =>\n this.interactiveResult.cancelPendingSelect()\n }\n attributes={this.linkAttributes}\n ref={\n shouldSetTarget\n ? (el?: HTMLAnchorElement) => this.focusTarget.setTarget(el)\n : undefined\n }\n >\n {content}\n </LinkWithItemAnalytics>\n );\n }\n\n public render() {\n const parents = this.renderParents();\n if (parents.length) {\n return (\n <ul aria-label={this.bindings.i18n.t('printable-uri')}>{parents}</ul>\n );\n }\n\n return this.renderLink(\n <atomic-result-text field=\"printableUri\"></atomic-result-text>,\n this.result.clickUri,\n false\n );\n }\n}\n"],"version":3}
|
1
|
+
{"file":"atomic-result-printable-uri.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,2BAA2B,GAAG,w/lEAAw/lE,CAAC;AAC7hmE,uCAAe,2BAA2B;;;;;;;;;;;;MC0B7B,wBAAwB;;;QAK1B,iBAAY,GAAG,KAAK,CAAC;;;;QAMP,qBAAgB,GAAG,CAAC,CAAC;4BANpB,KAAK;;gCAMa,CAAC;;IAO3C,IAAY,WAAW;QACrB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC3B,IAAI,CAAC,iBAAiB,GAAG,IAAIA,+CAAqB,CAAC,IAAI,CAAC,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC;KAC/B;IAEM,iBAAiB;QACtB,IAAI;YACF,IAAIC,YAAM,CAAC;gBACT,gBAAgB,EAAE,IAAIC,iBAAW,CAAC,EAAC,GAAG,EAAE,CAAC,EAAC,CAAC;aAC5C,CAAC,CAAC,QAAQ,CAAC,EAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAC,CAAC,CAAC;SACxD;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,KAAc,CAAC;SAC7B;QACD,MAAM,QAAQ,GAAG,YAAY,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAGC,wCAAyB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACtE;IAEM,UAAU;QACf,IAAI,CAAC,iBAAiB,GAAGC,+BAAsB,CAAC,IAAI,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AAa,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,QACEH,8BAAgB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAG,OAAO,CAAM,EACrE;SACH;QAED,OAAO,IAAI,CAAC,UAAU,CACpBA,gCAAoB,KAAK,EAAC,cAAc,GAAsB,EAC9D,IAAI,CAAC,MAAM,CAAC,QAAQ,EACpB,KAAK,CACN,CAAC;KACH;;;AAhJ4B;IAA5BI,sCAAkB,EAAE;0DAA4B;AACxB;IAAxBC,6CAAa,EAAE;wDAAyB;;;;;","names":["FocusTargetController","Schema","NumberValue","getAttributesFromLinkSlot","buildInteractiveResult","h","parseXML","Arrow","LinkWithItemAnalytics","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-printable-uri/atomic-result-printable-uri.pcss?tag=atomic-result-printable-uri","src/components/search/result-template-components/atomic-result-printable-uri/atomic-result-printable-uri.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n\natomic-result-printable-uri {\n max-width: 100%;\n word-break: break-word;\n\n a,\n button {\n @apply text-primary;\n\n &:hover,\n &:focus-visible {\n text-decoration: underline;\n @apply text-primary;\n }\n\n &:focus {\n outline: none;\n }\n\n &:visited {\n @apply text-visited;\n }\n }\n\n ul {\n display: flex;\n flex-wrap: wrap;\n }\n\n li {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n\n a {\n display: inline-block;\n vertical-align: middle;\n max-width: 100%;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n white-space: nowrap;\n &:last-child {\n white-space: normal;\n\n &::after {\n content: none;\n }\n }\n\n .result-printable-uri-separator {\n display: inline-block;\n margin: 0 0.5rem;\n vertical-align: middle;\n width: 0.75rem;\n height: 0.75rem;\n @apply text-neutral-dark;\n }\n }\n}\n","import {Schema, NumberValue} from '@coveo/bueno';\nimport {\n buildInteractiveResult,\n InteractiveResult,\n Result,\n} from '@coveo/headless';\nimport {Component, Element, h, Prop, State, VNode} from '@stencil/core';\nimport Arrow from '../../../../images/arrow-right.svg';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {FocusTargetController} from '../../../../utils/stencil-accessibility-utils';\nimport {parseXML} from '../../../../utils/utils';\nimport {getAttributesFromLinkSlot} from '../../../common/item-link/attributes-slot';\nimport {LinkWithItemAnalytics} from '../../../common/item-link/stencil-item-link';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-printable-uri` component displays the URI, or path, to access a result.\n *\n * @slot attributes - Lets you pass [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes) down to anchor elements, overriding other attributes.\n * To be used exclusively in anchor elements, such as: `<a slot=\"attributes\" target=\"_blank\" download></a>`.\n */\n@Component({\n tag: 'atomic-result-printable-uri',\n styleUrl: 'atomic-result-printable-uri.pcss',\n shadow: false,\n})\nexport class AtomicResultPrintableUri {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() public host!: HTMLElement;\n\n @State() listExpanded = false;\n @State() error!: Error;\n\n /**\n * The maximum number of Uri parts to display. This has to be over the minimum of `3` in order to be effective. Putting `Infinity` will disable the ellipsis.\n */\n @Prop({reflect: true}) maxNumberOfParts = 5;\n\n private expandedPartFocus?: FocusTargetController;\n\n private interactiveResult!: InteractiveResult;\n private linkAttributes?: Attr[];\n\n private get focusTarget() {\n if (!this.expandedPartFocus) {\n this.expandedPartFocus = new FocusTargetController(this);\n }\n return this.expandedPartFocus;\n }\n\n public connectedCallback() {\n try {\n new Schema({\n maxNumberOfParts: new NumberValue({min: 3}),\n }).validate({maxNumberOfParts: this.maxNumberOfParts});\n } catch (error) {\n this.error = error as Error;\n }\n const slotName = 'attributes';\n this.linkAttributes = getAttributesFromLinkSlot(this.host, slotName);\n }\n\n public initialize() {\n this.interactiveResult = buildInteractiveResult(this.bindings.engine, {\n options: {result: this.result},\n });\n }\n\n private getIndexOfEllipsis(parentsCount: number) {\n const valuesToHide = Math.max(2, parentsCount - this.maxNumberOfParts);\n const valuesToShowBeforeEllipsis = parentsCount - valuesToHide - 1;\n return valuesToShowBeforeEllipsis;\n }\n\n private renderEllipsis() {\n return (\n <li>\n <button\n aria-label={this.bindings.i18n.t('collapsed-uri-parts')}\n onClick={(e) => {\n e.stopPropagation();\n this.focusTarget.focusOnNextTarget();\n this.listExpanded = true;\n }}\n >\n ...\n </button>\n {this.renderSeparator()}\n </li>\n );\n }\n\n private get allParents() {\n const parentsXml = parseXML(`${this.result.raw.parents}`);\n const parents = Array.from(parentsXml.getElementsByTagName('parent'));\n const ellipsisIndex = this.getIndexOfEllipsis(parents.length);\n return parents.map((parent, i) => {\n const name = parent.getAttribute('name');\n const uri = parent.getAttribute('uri')!;\n return (\n <li>\n {this.renderLink(name, uri, i === ellipsisIndex)}\n {i === parents.length - 1 ? null : this.renderSeparator()}\n </li>\n );\n });\n }\n\n private renderSeparator() {\n return (\n <atomic-icon\n class=\"result-printable-uri-separator\"\n icon={Arrow}\n role=\"separator\"\n ></atomic-icon>\n );\n }\n\n private renderParents() {\n const parents = this.allParents;\n if (this.listExpanded || parents.length <= this.maxNumberOfParts) {\n return parents;\n }\n\n return [\n parents.slice(0, this.getIndexOfEllipsis(parents.length)),\n this.renderEllipsis(),\n parents.slice(-1),\n ];\n }\n\n private renderLink(\n content: VNode | string | null,\n uri: string,\n shouldSetTarget: boolean\n ) {\n return (\n <LinkWithItemAnalytics\n href={uri}\n title={typeof content === 'string' ? content : undefined}\n onSelect={() => this.interactiveResult.select()}\n onBeginDelayedSelect={() => this.interactiveResult.beginDelayedSelect()}\n onCancelPendingSelect={() =>\n this.interactiveResult.cancelPendingSelect()\n }\n attributes={this.linkAttributes}\n ref={\n shouldSetTarget\n ? (el?: HTMLAnchorElement) => this.focusTarget.setTarget(el)\n : undefined\n }\n >\n {content}\n </LinkWithItemAnalytics>\n );\n }\n\n public render() {\n const parents = this.renderParents();\n if (parents.length) {\n return (\n <ul aria-label={this.bindings.i18n.t('printable-uri')}>{parents}</ul>\n );\n }\n\n return this.renderLink(\n <atomic-result-text field=\"printableUri\"></atomic-result-text>,\n this.result.clickUri,\n false\n );\n }\n}\n"],"version":3}
|
@@ -6,7 +6,7 @@ const index = require('./index-757bc886.js');
|
|
6
6
|
const headless = require('@coveo/headless');
|
7
7
|
const stencilRating = require('./stencil-rating-a40e50dd.js');
|
8
8
|
const initializationUtils = require('./initialization-utils-92f1b080.js');
|
9
|
-
const
|
9
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
10
10
|
require('./dom-utils-d4790328.js');
|
11
11
|
require('./event-utils-9bfcf3c5.js');
|
12
12
|
require('./init-queue-a18aa323.js');
|
@@ -80,7 +80,7 @@ __decorate([
|
|
80
80
|
initializationUtils.InitializeBindings()
|
81
81
|
], AtomicResultRating.prototype, "bindings", void 0);
|
82
82
|
__decorate([
|
83
|
-
|
83
|
+
stencilResultTemplateDecorators.ResultContext()
|
84
84
|
], AtomicResultRating.prototype, "result", void 0);
|
85
85
|
AtomicResultRating.style = AtomicResultRatingStyle0;
|
86
86
|
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-rating.entry.cjs.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,qBAAqB,GAAG,03jEAA03jE,CAAC;AACz5jE,iCAAe,qBAAqB;;;;;;;;;;;;MCwBvB,kBAAkB;;;;;;QAaC,oBAAe,GAAG,CAAC,CAAC;;;;;;;;;;;;;;QAepB,SAAI,GAAGA,kBAAI,CAAC;QAIjC,kBAAa,GAAkB,IAAI,CAAC;;+BAnBG,CAAC;oBAeZA,kBAAI;;6BAID,IAAI;;IAEpC,mBAAmB;QACzB,MAAM,KAAK,GAAGC,+BAAsB,CAAC,iBAAiB,CACpD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACX,CAAC;QACF,IAAI;YACF,IAA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oB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;SAC9D;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;YACpE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3B;KACF;IAED,mBAAmB;QACjB,IAAI,CAAC,mBAAmB,EAAE,CAAC;KAC5B;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;YAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO;SACR;QACD,QACEC,QAACC,oBAAM,IACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EACxB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,kBAAkB,EAAE,IAAI,CAAC,eAAe,EACxC,mBAAmB,EAAE,IAAI,CAAC,aAAa,EACvC,QAAQ,EAAE,KAAK,GACP,EACV;KACH;;;AAhE4B;IAA5BC,sCAAkB,EAAE;oDAA4B;AACxB;IAAxBC,6CAAa,EAAE;kDAAyB;;;;;","names":["Star","ResultTemplatesHelpers","computeNumberOfStars","h","Rating","InitializeBindings","ResultContext"],"sources":["src/components/search/result-template-components/atomic-result-rating/atomic-result-rating.pcss?tag=atomic-result-rating&encapsulation=shadow","src/components/search/result-template-components/atomic-result-rating/atomic-result-rating.tsx"],"sourcesContent":["@import '../../../../global/global.pcss';\n@import '../../../common/atomic-rating/atomic-rating.pcss';\n","import {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Element, Prop, h, State} from '@stencil/core';\nimport Star from '../../../../images/star.svg';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {\n Rating,\n computeNumberOfStars,\n} from '../../../common/atomic-rating/stencil-rating';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-rating` element renders a star rating.\n *\n * @part value-rating - The wrapper that contains the row of inactive stars and the row of active stars.\n * @part value-rating-icon - The individual star icons used in the rating display.\n */\n@Component({\n tag: 'atomic-result-rating',\n styleUrl: 'atomic-result-rating.pcss',\n shadow: true,\n})\nexport class AtomicResultRating implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n @Element() host!: HTMLElement;\n\n /**\n * The field whose values you want to display as a rating.\n */\n @Prop({reflect: true}) public field!: string;\n\n /**\n * The maximum value of the field. This value is also used as the number of icons to be displayed.\n */\n @Prop({reflect: true}) public maxValueInIndex = 5;\n\n /**\n * The SVG icon to use to display the rating.\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 * When using a custom icon, at least part of your icon should have the color set to `fill=\"currentColor\"`.\n * This part of the SVG will take on the colors set in the following [variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties):\n *\n * - `--atomic-rating-icon-active-color`\n * - `--atomic-rating-icon-inactive-color`\n */\n @Prop({reflect: true}) public icon = Star;\n\n @State() public error!: Error;\n\n @State() numberOfStars: number | null = null;\n\n private updateNumberOfStars() {\n const value = ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n );\n try {\n this.numberOfStars = computeNumberOfStars(value, this.field);\n } catch (error) {\n this.error = error instanceof Error ? error : new Error(`${error}`);\n this.numberOfStars = null;\n }\n }\n\n componentWillRender() {\n this.updateNumberOfStars();\n }\n\n render() {\n if (this.numberOfStars === null) {\n this.host.remove();\n return;\n }\n return (\n <Rating\n i18n={this.bindings.i18n}\n icon={this.icon}\n numberOfTotalIcons={this.maxValueInIndex}\n numberOfActiveIcons={this.numberOfStars}\n iconSize={0.875}\n ></Rating>\n );\n }\n}\n"],"version":3}
|
@@ -8,7 +8,7 @@ const fieldUtils = require('./field-utils-a715deca.js');
|
|
8
8
|
const initializationUtils = require('./initialization-utils-92f1b080.js');
|
9
9
|
const resultUtils = require('./result-utils-3313d650.js');
|
10
10
|
const bueno = require('@coveo/bueno');
|
11
|
-
const
|
11
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
12
12
|
require('./dom-utils-d4790328.js');
|
13
13
|
require('./event-utils-9bfcf3c5.js');
|
14
14
|
require('./init-queue-a18aa323.js');
|
@@ -95,7 +95,7 @@ __decorate$1([
|
|
95
95
|
initializationUtils.InitializeBindings()
|
96
96
|
], AtomicResultText.prototype, "bindings", void 0);
|
97
97
|
__decorate$1([
|
98
|
-
|
98
|
+
stencilResultTemplateDecorators.ResultContext()
|
99
99
|
], AtomicResultText.prototype, "result", void 0);
|
100
100
|
|
101
101
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-text.atomic-text.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;SAEgB,0BAA0B,CACxC,KAAa,EACb,YAAqB,EACrB,IAAiB,EACjB,MAA8B;IAE9B,IAAIA,aAAO,CAAC,YAAY,CAAC,EAAE;QACzB,MAAM,CAAC,KAAK,CACV,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,2CAA2C,KAAK,kBAAkB,YAAY,IAAI,EAChH,IAAI,CACL,CAAC;KACH;AACH;;ACDO,MAAM,gBAAgB,GAAG,CAC9B,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAmB,EACxE,QAAiB;IAEjB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAErD,IAAIC,iBAAW,CAAC,YA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IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAClE;KACF;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;KAC7B;;AA3B4B;IAA5BD,sCAAkB,EAAE;4CAA4B;;;;;","names":["isArray","isUndefined","h","Fragment","Host","getStringValueFromResultOrNull","ResultTemplatesHelpers","getFieldValueCaption","HighlightUtils","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/common/item-text/field-warning.ts","src/components/common/item-text/stencil-item-text-fallback.tsx","src/components/common/item-text/render-highlights.ts","src/components/common/item-text/stencil-item-text-highlighted.tsx","src/components/search/result-template-components/atomic-result-text/atomic-result-text.tsx","src/components/search/atomic-text/atomic-text.tsx"],"sourcesContent":["import {isArray} from '@coveo/bueno';\n\nexport function possiblyWarnOnBadFieldType(\n field: string,\n itemValueRaw: unknown,\n host: HTMLElement,\n logger: Pick<Console, 'error'>\n) {\n if (isArray(itemValueRaw)) {\n logger.error(\n `${host.nodeName.toLowerCase()} cannot be used with multi value field \"${field}\" with values \"${itemValueRaw}\".`,\n host\n );\n }\n}\n","import {isUndefined} from '@coveo/bueno';\nimport {Fragment, FunctionalComponent, VNode, h} from '@stencil/core';\nimport {possiblyWarnOnBadFieldType} from './field-warning';\n\nexport interface ItemTextProps<T> {\n logger: Pick<Console, 'error'>;\n host: HTMLElement;\n defaultValue: string | undefined;\n field: string;\n item: T;\n getProperty: (result: T, property: string) => unknown;\n}\n\nexport const ItemTextFallback = <T,>(\n {field, host, logger, defaultValue, item, getProperty}: ItemTextProps<T>,\n children: VNode[]\n): FunctionalComponent<ItemTextProps<T>> | null => {\n const raw = getProperty(item, field);\n possiblyWarnOnBadFieldType(field, raw, host, logger);\n\n if (isUndefined(defaultValue)) {\n host.remove();\n return null;\n } else {\n return <Fragment>{children}</Fragment>;\n }\n};\n","export type HighlightKeywords = {\n offset: number;\n length: number;\n};\n\nexport type HighlightString = (params: {\n content: string;\n openingDelimiter: string;\n closingDelimiter: string;\n highlights: HighlightKeywords[];\n}) => string;\n\nexport function renderWithHighlights(\n value: string,\n highlights: HighlightKeywords[],\n highlightString: HighlightString\n) {\n const openingDelimiter = '_openingDelimiter_';\n const closingDelimiter = '_closingDelimiter_';\n const highlightedValue = highlightString({\n content: value,\n openingDelimiter,\n closingDelimiter,\n highlights,\n });\n return highlightedValue\n .replace(new RegExp(openingDelimiter, 'g'), '<b>')\n .replace(new RegExp(closingDelimiter, 'g'), '</b>');\n}\n","import {FunctionalComponent, h, Host} from '@stencil/core';\nimport {\n HighlightKeywords,\n HighlightString,\n renderWithHighlights,\n} from './render-highlights';\n\nexport interface ItemTextHighlightedProps {\n textValue: string;\n highlightKeywords: HighlightKeywords[];\n onError: (error: Error) => void;\n highlightString: HighlightString;\n}\n\nexport const ItemTextHighlighted: FunctionalComponent<\n ItemTextHighlightedProps\n> = ({highlightKeywords, highlightString, onError, textValue}) => {\n try {\n const highlightedValue = renderWithHighlights(\n textValue,\n highlightKeywords,\n highlightString\n );\n\n // deepcode ignore ReactSetInnerHtml: This is not React code\n return <Host innerHTML={highlightedValue}></Host>;\n } catch (error) {\n onError(error as Error);\n }\n};\n","import {HighlightUtils, Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, h, Element, State} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {getStringValueFromResultOrNull} from '../../../../utils/result-utils';\nimport {ItemTextFallback} from '../../../common/item-text/stencil-item-text-fallback';\nimport {ItemTextHighlighted} from '../../../common/item-text/stencil-item-text-highlighted';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-result-text` component renders the value of a string result field.\n */\n@Component({\n tag: 'atomic-result-text',\n shadow: false,\n})\nexport class AtomicResultText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() private host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The result field which the component should use.\n * This will look in the Result object first, and then in the Result.raw object for the fields.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n /**\n * When this is set to `true`, the component attempts to highlight text based on the highlighting properties provided by the search API response.\n */\n @Prop({reflect: true}) public shouldHighlight = true;\n\n /**\n * The locale key for the text to display when the configured field has no value.\n */\n @Prop({reflect: true}) public default?: string;\n\n public render() {\n const resultValueAsString = getStringValueFromResultOrNull(\n this.result,\n this.field\n );\n\n if (resultValueAsString === null) {\n return (\n <ItemTextFallback\n field={this.field}\n host={this.host}\n logger={this.bindings.engine.logger}\n defaultValue={this.default}\n item={this.result}\n getProperty={ResultTemplatesHelpers.getResultProperty}\n >\n <atomic-text\n value={getFieldValueCaption(\n this.field,\n this.default!,\n this.bindings.i18n\n )}\n ></atomic-text>\n </ItemTextFallback>\n );\n }\n\n const textValue = `${resultValueAsString}`;\n const highlightKeywords = ResultTemplatesHelpers.getResultProperty(\n this.result,\n `${this.field}Highlights`\n ) as HighlightUtils.HighlightKeyword[];\n\n return this.shouldHighlight && highlightKeywords ? (\n <ItemTextHighlighted\n textValue={textValue}\n highlightKeywords={highlightKeywords}\n highlightString={HighlightUtils.highlightString}\n onError={(error) => (this.error = error)}\n ></ItemTextHighlighted>\n ) : (\n getFieldValueCaption(this.field, textValue, this.bindings.i18n)\n );\n }\n}\n","import {Component, Prop, State} from '@stencil/core';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {Bindings} from '../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-text` component leverages the I18n translation module through the atomic-search-interface.\n */\n@Component({\n tag: 'atomic-text',\n shadow: true,\n})\nexport class AtomicText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n\n private strings = {\n value: () =>\n this.bindings.i18n.t(this.value, {\n count: this.count,\n }),\n };\n @State() public error!: Error;\n\n /**\n * The string key value.\n */\n @Prop({reflect: true}) public value!: string;\n /**\n * The count value used for plurals.\n */\n @Prop({reflect: true}) public count?: number;\n\n public connectedCallback() {\n if (!this.value) {\n this.error = new Error('The \"value\" attribute must be defined.');\n }\n }\n\n public render() {\n return this.strings.value();\n }\n}\n"],"version":3}
|
1
|
+
{"file":"atomic-result-text.atomic-text.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;SAEgB,0BAA0B,CACxC,KAAa,EACb,YAAqB,EACrB,IAAiB,EACjB,MAA8B;IAE9B,IAAIA,aAAO,CAAC,YAAY,CAAC,EAAE;QACzB,MAAM,CAAC,KAAK,CACV,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,2CAA2C,KAAK,kBAAkB,YAAY,IAAI,EAChH,IAAI,CACL,CAAC;KACH;AACH;;ACDO,MAAM,gBAAgB,GAAG,CAC9B,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAmB,EACxE,QAAiB;IAEjB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,0BAA0B,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAErD,IAAIC,iBAAW,CAAC,YAAY,CAAC,EAAE;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;KACb;SAAM;QACL,OAAOC,QAACC,cAAQ,QAAE,QAAQ,CAAY,CAAC;KACxC;AACH,CAAC;;SCde,oBAAoB,CAClC,KAAa,EACb,UAA+B,EAC/B,eAAgC;IAEhC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;IAC9C,MAAM,gBAAgB,GAAG,eAAe,CAAC;QACvC,OAAO,EAAE,KAAK;QACd,gBAAgB;QAChB,gBAAgB;QAChB,UAAU;KACX,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CAAC;QAC3C,MAAM,iBAAiB,GAAGD,+BAAsB,CAAC,iBAAiB,CAChE,IAAI,CAAC,MAAM,EACX,GAAG,IAAI,CAAC,KAAK,YAAY,CACW,CAAC;QAEvC,OAAO,IAAI,CAAC,eAAe,IAAI,iBAAiB,IAC9CJ,QAAC,mBAAmB,IAClB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAEM,uBAAc,CAAC,eAAe,EAC/C,OAAO,EAAE,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GACnB,KAEvBD,+BAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAChE,CAAC;KACH;;;AAlE4BE;IAA5BC,sCAAkB,EAAE;kDAA4B;AACxBD;IAAxBE,6CAAa,EAAE;gDAAyB;;;;;;;;;;;;MCR9B,UAAU;;;QAGb,YAAO,GAAG;YAChB,KAAK,EAAE,MACL,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC;SACL,CAAC;;;;;IAYK,iBAAiB;QACtB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAClE;KACF;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;KAC7B;;AA3B4B;IAA5BD,sCAAkB,EAAE;4CAA4B;;;;;","names":["isArray","isUndefined","h","Fragment","Host","getStringValueFromResultOrNull","ResultTemplatesHelpers","getFieldValueCaption","HighlightUtils","__decorate","InitializeBindings","ResultContext"],"sources":["src/components/common/item-text/field-warning.ts","src/components/common/item-text/stencil-item-text-fallback.tsx","src/components/common/item-text/render-highlights.ts","src/components/common/item-text/stencil-item-text-highlighted.tsx","src/components/search/result-template-components/atomic-result-text/atomic-result-text.tsx","src/components/search/atomic-text/atomic-text.tsx"],"sourcesContent":["import {isArray} from '@coveo/bueno';\n\nexport function possiblyWarnOnBadFieldType(\n field: string,\n itemValueRaw: unknown,\n host: HTMLElement,\n logger: Pick<Console, 'error'>\n) {\n if (isArray(itemValueRaw)) {\n logger.error(\n `${host.nodeName.toLowerCase()} cannot be used with multi value field \"${field}\" with values \"${itemValueRaw}\".`,\n host\n );\n }\n}\n","import {isUndefined} from '@coveo/bueno';\nimport {Fragment, FunctionalComponent, VNode, h} from '@stencil/core';\nimport {possiblyWarnOnBadFieldType} from './field-warning';\n\nexport interface ItemTextProps<T> {\n logger: Pick<Console, 'error'>;\n host: HTMLElement;\n defaultValue: string | undefined;\n field: string;\n item: T;\n getProperty: (result: T, property: string) => unknown;\n}\n\nexport const ItemTextFallback = <T,>(\n {field, host, logger, defaultValue, item, getProperty}: ItemTextProps<T>,\n children: VNode[]\n): FunctionalComponent<ItemTextProps<T>> | null => {\n const raw = getProperty(item, field);\n possiblyWarnOnBadFieldType(field, raw, host, logger);\n\n if (isUndefined(defaultValue)) {\n host.remove();\n return null;\n } else {\n return <Fragment>{children}</Fragment>;\n }\n};\n","export type HighlightKeywords = {\n offset: number;\n length: number;\n};\n\nexport type HighlightString = (params: {\n content: string;\n openingDelimiter: string;\n closingDelimiter: string;\n highlights: HighlightKeywords[];\n}) => string;\n\nexport function renderWithHighlights(\n value: string,\n highlights: HighlightKeywords[],\n highlightString: HighlightString\n) {\n const openingDelimiter = '_openingDelimiter_';\n const closingDelimiter = '_closingDelimiter_';\n const highlightedValue = highlightString({\n content: value,\n openingDelimiter,\n closingDelimiter,\n highlights,\n });\n return highlightedValue\n .replace(new RegExp(openingDelimiter, 'g'), '<b>')\n .replace(new RegExp(closingDelimiter, 'g'), '</b>');\n}\n","import {FunctionalComponent, h, Host} from '@stencil/core';\nimport {\n HighlightKeywords,\n HighlightString,\n renderWithHighlights,\n} from './render-highlights';\n\nexport interface ItemTextHighlightedProps {\n textValue: string;\n highlightKeywords: HighlightKeywords[];\n onError: (error: Error) => void;\n highlightString: HighlightString;\n}\n\nexport const ItemTextHighlighted: FunctionalComponent<\n ItemTextHighlightedProps\n> = ({highlightKeywords, highlightString, onError, textValue}) => {\n try {\n const highlightedValue = renderWithHighlights(\n textValue,\n highlightKeywords,\n highlightString\n );\n\n // deepcode ignore ReactSetInnerHtml: This is not React code\n return <Host innerHTML={highlightedValue}></Host>;\n } catch (error) {\n onError(error as Error);\n }\n};\n","import {HighlightUtils, Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, h, Element, State} from '@stencil/core';\nimport {getFieldValueCaption} from '../../../../utils/field-utils';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../../utils/initialization-utils';\nimport {getStringValueFromResultOrNull} from '../../../../utils/result-utils';\nimport {ItemTextFallback} from '../../../common/item-text/stencil-item-text-fallback';\nimport {ItemTextHighlighted} from '../../../common/item-text/stencil-item-text-highlighted';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\n/**\n * The `atomic-result-text` component renders the value of a string result field.\n */\n@Component({\n tag: 'atomic-result-text',\n shadow: false,\n})\nexport class AtomicResultText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n @ResultContext() private result!: Result;\n\n @Element() private host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The result field which the component should use.\n * This will look in the Result object first, and then in the Result.raw object for the fields.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) public field!: string;\n /**\n * When this is set to `true`, the component attempts to highlight text based on the highlighting properties provided by the search API response.\n */\n @Prop({reflect: true}) public shouldHighlight = true;\n\n /**\n * The locale key for the text to display when the configured field has no value.\n */\n @Prop({reflect: true}) public default?: string;\n\n public render() {\n const resultValueAsString = getStringValueFromResultOrNull(\n this.result,\n this.field\n );\n\n if (resultValueAsString === null) {\n return (\n <ItemTextFallback\n field={this.field}\n host={this.host}\n logger={this.bindings.engine.logger}\n defaultValue={this.default}\n item={this.result}\n getProperty={ResultTemplatesHelpers.getResultProperty}\n >\n <atomic-text\n value={getFieldValueCaption(\n this.field,\n this.default!,\n this.bindings.i18n\n )}\n ></atomic-text>\n </ItemTextFallback>\n );\n }\n\n const textValue = `${resultValueAsString}`;\n const highlightKeywords = ResultTemplatesHelpers.getResultProperty(\n this.result,\n `${this.field}Highlights`\n ) as HighlightUtils.HighlightKeyword[];\n\n return this.shouldHighlight && highlightKeywords ? (\n <ItemTextHighlighted\n textValue={textValue}\n highlightKeywords={highlightKeywords}\n highlightString={HighlightUtils.highlightString}\n onError={(error) => (this.error = error)}\n ></ItemTextHighlighted>\n ) : (\n getFieldValueCaption(this.field, textValue, this.bindings.i18n)\n );\n }\n}\n","import {Component, Prop, State} from '@stencil/core';\nimport {\n InitializableComponent,\n InitializeBindings,\n} from '../../../utils/initialization-utils';\nimport {Bindings} from '../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-text` component leverages the I18n translation module through the atomic-search-interface.\n */\n@Component({\n tag: 'atomic-text',\n shadow: true,\n})\nexport class AtomicText implements InitializableComponent {\n @InitializeBindings() public bindings!: Bindings;\n\n private strings = {\n value: () =>\n this.bindings.i18n.t(this.value, {\n count: this.count,\n }),\n };\n @State() public error!: Error;\n\n /**\n * The string key value.\n */\n @Prop({reflect: true}) public value!: string;\n /**\n * The count value used for plurals.\n */\n @Prop({reflect: true}) public count?: number;\n\n public connectedCallback() {\n if (!this.value) {\n this.error = new Error('The \"value\" attribute must be defined.');\n }\n }\n\n public render() {\n return this.strings.value();\n }\n}\n"],"version":3}
|
@@ -8,7 +8,7 @@ const headless = require('@coveo/headless');
|
|
8
8
|
const dayjs_min = require('./dayjs.min-8b80e6d1.js');
|
9
9
|
const _commonjsHelpers = require('./_commonjsHelpers-b3309d7b.js');
|
10
10
|
const initializationUtils = require('./initialization-utils-92f1b080.js');
|
11
|
-
const
|
11
|
+
const stencilResultTemplateDecorators = require('./stencil-result-template-decorators-28b05aaf.js');
|
12
12
|
require('./dom-utils-d4790328.js');
|
13
13
|
require('./event-utils-9bfcf3c5.js');
|
14
14
|
require('./init-queue-a18aa323.js');
|
@@ -91,7 +91,7 @@ __decorate([
|
|
91
91
|
initializationUtils.InitializeBindings()
|
92
92
|
], AtomicResultTimespan.prototype, "bindings", void 0);
|
93
93
|
__decorate([
|
94
|
-
|
94
|
+
stencilResultTemplateDecorators.ResultContext()
|
95
95
|
], AtomicResultTimespan.prototype, "result", void 0);
|
96
96
|
|
97
97
|
exports.atomic_result_timespan = AtomicResultTimespan;
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"atomic-result-timespan.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAA,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAsD,eAAe,CAAC,GAAkI,CAAC,CAACA,+BAAI,EAAE,UAAU,CAAc,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,qFAAqF,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,qKAAqK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAA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I,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;gBAC1C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;aACvC,CAAC,CAAC;SACJ;QAED,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE;gBACxC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;aACrC,CAAC,CAAC;SACJ;QAED,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACpC;IAED,IAAY,KAAK;QACf,OAAOG,+BAAsB,CAAC,iBAAiB,CAC7C,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACD,CAAC;KACb;;AA7EM;IADNC,sCAAkB,EAAE;sDACM;AAEF;IAAxBC,sCAAa,EAAE;oDAAyB;;;;","names":["this","dayjs","Schema","StringValue","ResultTemplatesHelpers","InitializeBindings","ResultContext"],"sources":["../../node_modules/dayjs/plugin/duration.js","src/components/search/result-template-components/atomic-result-timespan/atomic-result-timespan.tsx"],"sourcesContent":["!function(t,s){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=s():\"function\"==typeof define&&define.amd?define(s):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs_plugin_duration=s()}(this,(function(){\"use strict\";var t,s,n=1e3,i=6e4,e=36e5,r=864e5,o=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,d=2628e6,a=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:u,months:d,days:r,hours:e,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},c=function(t){return t instanceof g},f=function(t,s,n){return new g(t,n,s.$l)},m=function(t){return s.p(t)+\"s\"},l=function(t){return t<0},$=function(t){return l(t)?Math.ceil(t):Math.floor(t)},y=function(t){return Math.abs(t)},v=function(t,s){return t?l(t)?{negative:!0,format:\"\"+y(t)+s}:{negative:!1,format:\"\"+t+s}:{negative:!1,format:\"\"}},g=function(){function l(t,s,n){var i=this;if(this.$d={},this.$l=n,void 0===t&&(this.$ms=0,this.parseFromMilliseconds()),s)return f(t*h[m(s)],this);if(\"number\"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if(\"object\"==typeof t)return Object.keys(t).forEach((function(s){i.$d[m(s)]=t[s]})),this.calMilliseconds(),this;if(\"string\"==typeof t){var e=t.match(a);if(e){var r=e.slice(2).map((function(t){return null!=t?Number(t):0}));return this.$d.years=r[0],this.$d.months=r[1],this.$d.weeks=r[2],this.$d.days=r[3],this.$d.hours=r[4],this.$d.minutes=r[5],this.$d.seconds=r[6],this.calMilliseconds(),this}}return this}var y=l.prototype;return y.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce((function(s,n){return s+(t.$d[n]||0)*h[n]}),0)},y.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=$(t/u),t%=u,this.$d.months=$(t/d),t%=d,this.$d.days=$(t/r),t%=r,this.$d.hours=$(t/e),t%=e,this.$d.minutes=$(t/i),t%=i,this.$d.seconds=$(t/n),t%=n,this.$d.milliseconds=t},y.toISOString=function(){var t=v(this.$d.years,\"Y\"),s=v(this.$d.months,\"M\"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=v(n,\"D\"),e=v(this.$d.hours,\"H\"),r=v(this.$d.minutes,\"M\"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3,o=Math.round(1e3*o)/1e3);var u=v(o,\"S\"),d=t.negative||s.negative||i.negative||e.negative||r.negative||u.negative,a=e.format||r.format||u.format?\"T\":\"\",h=(d?\"-\":\"\")+\"P\"+t.format+s.format+i.format+a+e.format+r.format+u.format;return\"P\"===h||\"-P\"===h?\"P0D\":h},y.toJSON=function(){return this.toISOString()},y.format=function(t){var n=t||\"YYYY-MM-DDTHH:mm:ss\",i={Y:this.$d.years,YY:s.s(this.$d.years,2,\"0\"),YYYY:s.s(this.$d.years,4,\"0\"),M:this.$d.months,MM:s.s(this.$d.months,2,\"0\"),D:this.$d.days,DD:s.s(this.$d.days,2,\"0\"),H:this.$d.hours,HH:s.s(this.$d.hours,2,\"0\"),m:this.$d.minutes,mm:s.s(this.$d.minutes,2,\"0\"),s:this.$d.seconds,ss:s.s(this.$d.seconds,2,\"0\"),SSS:s.s(this.$d.milliseconds,3,\"0\")};return n.replace(o,(function(t,s){return s||String(i[t])}))},y.as=function(t){return this.$ms/h[m(t)]},y.get=function(t){var s=this.$ms,n=m(t);return\"milliseconds\"===n?s%=1e3:s=\"weeks\"===n?$(s/h[n]):this.$d[n],s||0},y.add=function(t,s,n){var i;return i=s?t*h[m(s)]:c(t)?t.$ms:f(t,this).$ms,f(this.$ms+i*(n?-1:1),this)},y.subtract=function(t,s){return this.add(t,s,!0)},y.locale=function(t){var s=this.clone();return s.$l=t,s},y.clone=function(){return f(this.$ms,this)},y.humanize=function(s){return t().add(this.$ms,\"ms\").locale(this.$l).fromNow(!s)},y.valueOf=function(){return this.asMilliseconds()},y.milliseconds=function(){return this.get(\"milliseconds\")},y.asMilliseconds=function(){return this.as(\"milliseconds\")},y.seconds=function(){return this.get(\"seconds\")},y.asSeconds=function(){return this.as(\"seconds\")},y.minutes=function(){return this.get(\"minutes\")},y.asMinutes=function(){return this.as(\"minutes\")},y.hours=function(){return this.get(\"hours\")},y.asHours=function(){return this.as(\"hours\")},y.days=function(){return this.get(\"days\")},y.asDays=function(){return this.as(\"days\")},y.weeks=function(){return this.get(\"weeks\")},y.asWeeks=function(){return this.as(\"weeks\")},y.months=function(){return this.get(\"months\")},y.asMonths=function(){return this.as(\"months\")},y.years=function(){return this.get(\"years\")},y.asYears=function(){return this.as(\"years\")},l}(),p=function(t,s,n){return t.add(s.years()*n,\"y\").add(s.months()*n,\"M\").add(s.days()*n,\"d\").add(s.hours()*n,\"h\").add(s.minutes()*n,\"m\").add(s.seconds()*n,\"s\").add(s.milliseconds()*n,\"ms\")};return function(n,i,e){t=e,s=e().$utils(),e.duration=function(t,s){var n=e.locale();return f(t,{$l:n},s)},e.isDuration=c;var r=i.prototype.add,o=i.prototype.subtract;i.prototype.add=function(t,s){return c(t)?p(this,t,1):r.bind(this)(t,s)},i.prototype.subtract=function(t,s){return c(t)?p(this,t,-1):o.bind(this)(t,s)}}}));","import {Schema, StringValue} from '@coveo/bueno';\nimport {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, State} from '@stencil/core';\nimport dayjs from 'dayjs';\nimport {DurationUnitType} from 'dayjs/plugin/duration';\nimport duration from 'dayjs/plugin/duration';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '../result-template-decorators';\n\ndayjs.extend(duration);\n\n/**\n * The `atomic-result-timespan` component renders a target result number field value as a duration.\n */\n@Component({\n tag: 'atomic-result-timespan',\n})\nexport class AtomicResultTimespan {\n @InitializeBindings()\n public bindings!: Bindings;\n\n @ResultContext() private result!: Result;\n\n @State() public error!: Error;\n\n /**\n * The target result field.\n * The component first looks for the field in the Result object, and then in the Result.raw object.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field!: string;\n /**\n * The unit of measurement of the field value.\n * Available units: https://day.js.org/docs/en/durations/creating\n */\n @Prop({reflect: true}) unit = 'ms';\n /**\n * The format to apply to the result field value.\n *\n * By default, the format is HH:mm:ss when the duration is under a day, and it is an approximation when longer (days, months or years).\n *\n * The string displayed when there is an approximation can be modified with [localization](https://docs.coveo.com/en/atomic/latest/usage/atomic-localization/).\n *\n * Available formats: https://day.js.org/docs/en/durations/format\n */\n @Prop({reflect: true}) format?: string;\n\n public initialize() {\n new Schema({\n field: new StringValue({required: true, emptyAllowed: false}),\n }).validate({\n field: this.field,\n });\n if (!this.value) {\n this.error = new Error(`No value found for field ${this.field}`);\n return;\n }\n if (isNaN(this.value)) {\n this.error = new Error(\n `Value ${this.value} for field ${this.field} is not a number`\n );\n }\n }\n\n public render() {\n const duration = dayjs.duration(this.value, this.unit as DurationUnitType);\n if (this.format) {\n return duration.format(this.format);\n }\n\n if (duration.asYears() >= 1) {\n return this.bindings.i18n.t('approx_year', {\n count: Math.round(duration.asYears()),\n });\n }\n\n if (duration.asMonths() >= 1) {\n return this.bindings.i18n.t('approx_month', {\n count: Math.round(duration.asMonths()),\n });\n }\n\n if (duration.asDays() >= 1) {\n return this.bindings.i18n.t('approx_day', {\n count: Math.round(duration.asDays()),\n });\n }\n\n return duration.format('HH:mm:ss');\n }\n\n private get value() {\n return ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n ) as number;\n }\n}\n"],"version":3}
|
1
|
+
{"file":"atomic-result-timespan.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAA,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAsD,eAAe,CAAC,GAAkI,CAAC,CAACA,+BAAI,EAAE,UAAU,CAAc,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,qFAAqF,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,qKAAqK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CA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IAAI,IAAI,CAAC,MAAM,EAAE;YACf,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACrC;QAED,IAAI,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE;gBACzC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;aACtC,CAAC,CAAC;SACJ;QAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;gBAC1C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;aACvC,CAAC,CAAC;SACJ;QAED,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE;gBACxC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;aACrC,CAAC,CAAC;SACJ;QAED,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACpC;IAED,IAAY,KAAK;QACf,OAAOG,+BAAsB,CAAC,iBAAiB,CAC7C,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,KAAK,CACD,CAAC;KACb;;AA7EM;IADNC,sCAAkB,EAAE;sDACM;AAEF;IAAxBC,6CAAa,EAAE;oDAAyB;;;;","names":["this","dayjs","Schema","StringValue","ResultTemplatesHelpers","InitializeBindings","ResultContext"],"sources":["../../node_modules/dayjs/plugin/duration.js","src/components/search/result-template-components/atomic-result-timespan/atomic-result-timespan.tsx"],"sourcesContent":["!function(t,s){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=s():\"function\"==typeof define&&define.amd?define(s):(t=\"undefined\"!=typeof globalThis?globalThis:t||self).dayjs_plugin_duration=s()}(this,(function(){\"use strict\";var t,s,n=1e3,i=6e4,e=36e5,r=864e5,o=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,u=31536e6,d=2628e6,a=/^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:u,months:d,days:r,hours:e,minutes:i,seconds:n,milliseconds:1,weeks:6048e5},c=function(t){return t instanceof g},f=function(t,s,n){return new g(t,n,s.$l)},m=function(t){return s.p(t)+\"s\"},l=function(t){return t<0},$=function(t){return l(t)?Math.ceil(t):Math.floor(t)},y=function(t){return Math.abs(t)},v=function(t,s){return t?l(t)?{negative:!0,format:\"\"+y(t)+s}:{negative:!1,format:\"\"+t+s}:{negative:!1,format:\"\"}},g=function(){function l(t,s,n){var i=this;if(this.$d={},this.$l=n,void 0===t&&(this.$ms=0,this.parseFromMilliseconds()),s)return f(t*h[m(s)],this);if(\"number\"==typeof t)return this.$ms=t,this.parseFromMilliseconds(),this;if(\"object\"==typeof t)return Object.keys(t).forEach((function(s){i.$d[m(s)]=t[s]})),this.calMilliseconds(),this;if(\"string\"==typeof t){var e=t.match(a);if(e){var r=e.slice(2).map((function(t){return null!=t?Number(t):0}));return this.$d.years=r[0],this.$d.months=r[1],this.$d.weeks=r[2],this.$d.days=r[3],this.$d.hours=r[4],this.$d.minutes=r[5],this.$d.seconds=r[6],this.calMilliseconds(),this}}return this}var y=l.prototype;return y.calMilliseconds=function(){var t=this;this.$ms=Object.keys(this.$d).reduce((function(s,n){return s+(t.$d[n]||0)*h[n]}),0)},y.parseFromMilliseconds=function(){var t=this.$ms;this.$d.years=$(t/u),t%=u,this.$d.months=$(t/d),t%=d,this.$d.days=$(t/r),t%=r,this.$d.hours=$(t/e),t%=e,this.$d.minutes=$(t/i),t%=i,this.$d.seconds=$(t/n),t%=n,this.$d.milliseconds=t},y.toISOString=function(){var t=v(this.$d.years,\"Y\"),s=v(this.$d.months,\"M\"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=v(n,\"D\"),e=v(this.$d.hours,\"H\"),r=v(this.$d.minutes,\"M\"),o=this.$d.seconds||0;this.$d.milliseconds&&(o+=this.$d.milliseconds/1e3,o=Math.round(1e3*o)/1e3);var u=v(o,\"S\"),d=t.negative||s.negative||i.negative||e.negative||r.negative||u.negative,a=e.format||r.format||u.format?\"T\":\"\",h=(d?\"-\":\"\")+\"P\"+t.format+s.format+i.format+a+e.format+r.format+u.format;return\"P\"===h||\"-P\"===h?\"P0D\":h},y.toJSON=function(){return this.toISOString()},y.format=function(t){var n=t||\"YYYY-MM-DDTHH:mm:ss\",i={Y:this.$d.years,YY:s.s(this.$d.years,2,\"0\"),YYYY:s.s(this.$d.years,4,\"0\"),M:this.$d.months,MM:s.s(this.$d.months,2,\"0\"),D:this.$d.days,DD:s.s(this.$d.days,2,\"0\"),H:this.$d.hours,HH:s.s(this.$d.hours,2,\"0\"),m:this.$d.minutes,mm:s.s(this.$d.minutes,2,\"0\"),s:this.$d.seconds,ss:s.s(this.$d.seconds,2,\"0\"),SSS:s.s(this.$d.milliseconds,3,\"0\")};return n.replace(o,(function(t,s){return s||String(i[t])}))},y.as=function(t){return this.$ms/h[m(t)]},y.get=function(t){var s=this.$ms,n=m(t);return\"milliseconds\"===n?s%=1e3:s=\"weeks\"===n?$(s/h[n]):this.$d[n],s||0},y.add=function(t,s,n){var i;return i=s?t*h[m(s)]:c(t)?t.$ms:f(t,this).$ms,f(this.$ms+i*(n?-1:1),this)},y.subtract=function(t,s){return this.add(t,s,!0)},y.locale=function(t){var s=this.clone();return s.$l=t,s},y.clone=function(){return f(this.$ms,this)},y.humanize=function(s){return t().add(this.$ms,\"ms\").locale(this.$l).fromNow(!s)},y.valueOf=function(){return this.asMilliseconds()},y.milliseconds=function(){return this.get(\"milliseconds\")},y.asMilliseconds=function(){return this.as(\"milliseconds\")},y.seconds=function(){return this.get(\"seconds\")},y.asSeconds=function(){return this.as(\"seconds\")},y.minutes=function(){return this.get(\"minutes\")},y.asMinutes=function(){return this.as(\"minutes\")},y.hours=function(){return this.get(\"hours\")},y.asHours=function(){return this.as(\"hours\")},y.days=function(){return this.get(\"days\")},y.asDays=function(){return this.as(\"days\")},y.weeks=function(){return this.get(\"weeks\")},y.asWeeks=function(){return this.as(\"weeks\")},y.months=function(){return this.get(\"months\")},y.asMonths=function(){return this.as(\"months\")},y.years=function(){return this.get(\"years\")},y.asYears=function(){return this.as(\"years\")},l}(),p=function(t,s,n){return t.add(s.years()*n,\"y\").add(s.months()*n,\"M\").add(s.days()*n,\"d\").add(s.hours()*n,\"h\").add(s.minutes()*n,\"m\").add(s.seconds()*n,\"s\").add(s.milliseconds()*n,\"ms\")};return function(n,i,e){t=e,s=e().$utils(),e.duration=function(t,s){var n=e.locale();return f(t,{$l:n},s)},e.isDuration=c;var r=i.prototype.add,o=i.prototype.subtract;i.prototype.add=function(t,s){return c(t)?p(this,t,1):r.bind(this)(t,s)},i.prototype.subtract=function(t,s){return c(t)?p(this,t,-1):o.bind(this)(t,s)}}}));","import {Schema, StringValue} from '@coveo/bueno';\nimport {Result, ResultTemplatesHelpers} from '@coveo/headless';\nimport {Component, Prop, State} from '@stencil/core';\nimport dayjs from 'dayjs';\nimport {DurationUnitType} from 'dayjs/plugin/duration';\nimport duration from 'dayjs/plugin/duration';\nimport {InitializeBindings} from '../../../../utils/initialization-utils';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\nimport {ResultContext} from '@/src/components/search/result-template-component-utils/context/stencil-result-template-decorators';\n\ndayjs.extend(duration);\n\n/**\n * The `atomic-result-timespan` component renders a target result number field value as a duration.\n */\n@Component({\n tag: 'atomic-result-timespan',\n})\nexport class AtomicResultTimespan {\n @InitializeBindings()\n public bindings!: Bindings;\n\n @ResultContext() private result!: Result;\n\n @State() public error!: Error;\n\n /**\n * The target result field.\n * The component first looks for the field in the Result object, and then in the Result.raw object.\n * It is important to include the necessary field in the `atomic-search-interface` component.\n */\n @Prop({reflect: true}) field!: string;\n /**\n * The unit of measurement of the field value.\n * Available units: https://day.js.org/docs/en/durations/creating\n */\n @Prop({reflect: true}) unit = 'ms';\n /**\n * The format to apply to the result field value.\n *\n * By default, the format is HH:mm:ss when the duration is under a day, and it is an approximation when longer (days, months or years).\n *\n * The string displayed when there is an approximation can be modified with [localization](https://docs.coveo.com/en/atomic/latest/usage/atomic-localization/).\n *\n * Available formats: https://day.js.org/docs/en/durations/format\n */\n @Prop({reflect: true}) format?: string;\n\n public initialize() {\n new Schema({\n field: new StringValue({required: true, emptyAllowed: false}),\n }).validate({\n field: this.field,\n });\n if (!this.value) {\n this.error = new Error(`No value found for field ${this.field}`);\n return;\n }\n if (isNaN(this.value)) {\n this.error = new Error(\n `Value ${this.value} for field ${this.field} is not a number`\n );\n }\n }\n\n public render() {\n const duration = dayjs.duration(this.value, this.unit as DurationUnitType);\n if (this.format) {\n return duration.format(this.format);\n }\n\n if (duration.asYears() >= 1) {\n return this.bindings.i18n.t('approx_year', {\n count: Math.round(duration.asYears()),\n });\n }\n\n if (duration.asMonths() >= 1) {\n return this.bindings.i18n.t('approx_month', {\n count: Math.round(duration.asMonths()),\n });\n }\n\n if (duration.asDays() >= 1) {\n return this.bindings.i18n.t('approx_day', {\n count: Math.round(duration.asDays()),\n });\n }\n\n return duration.format('HH:mm:ss');\n }\n\n private get value() {\n return ResultTemplatesHelpers.getResultProperty(\n this.result,\n this.field\n ) as number;\n }\n}\n"],"version":3}
|