@foxy.io/elements 1.49.0-beta.1 → 1.49.0-beta.3
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/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-store-transaction-folder-form.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-d9457718.js → shared-1fa1abbd.js} +2 -2
- package/dist/cdn/shared-462566b0.js +1 -0
- package/dist/cdn/shared-4dc0bd88.js +1 -0
- package/dist/cdn/{shared-ec1daff0.js → shared-4ffaa9b7.js} +7 -7
- package/dist/cdn/{shared-07268049.js → shared-7c5881c1.js} +1 -1
- package/dist/cdn/translations/native-integration-form/en.json +1 -1
- package/dist/cdn/translations/store-form/en.json +5 -1
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +3 -0
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +7 -2
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.d.ts +3 -0
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js +11 -0
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js.map +1 -1
- package/dist/elements/internal/InternalPasswordControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalPasswordControl/index.js +1 -0
- package/dist/elements/internal/InternalPasswordControl/index.js.map +1 -1
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.d.ts +2 -0
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js +9 -1
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js.map +1 -1
- package/dist/elements/public/CopyToClipboard/CopyToClipboard.d.ts +1 -1
- package/dist/elements/public/CopyToClipboard/CopyToClipboard.js +19 -5
- package/dist/elements/public/CopyToClipboard/CopyToClipboard.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.d.ts +1 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +6 -0
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js +1 -1
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
- package/dist/elements/public/QueryBuilder/QueryBuilder.d.ts +4 -2
- package/dist/elements/public/QueryBuilder/QueryBuilder.js +27 -7
- package/dist/elements/public/QueryBuilder/QueryBuilder.js.map +1 -1
- package/dist/elements/public/QueryBuilder/components/SimpleDateRule.js +3 -1
- package/dist/elements/public/QueryBuilder/components/SimpleDateRule.js.map +1 -1
- package/dist/elements/public/QueryBuilder/components/SimpleNumberRule.js +15 -11
- package/dist/elements/public/QueryBuilder/components/SimpleNumberRule.js.map +1 -1
- package/dist/elements/public/QueryBuilder/types.d.ts +1 -0
- package/dist/elements/public/QueryBuilder/types.js.map +1 -1
- package/dist/elements/public/StoreForm/StoreForm.js +1 -0
- package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
- package/dist/elements/public/TransactionsTable/TransactionsTable.js +1 -1
- package/dist/elements/public/TransactionsTable/TransactionsTable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-6e0eccb8.js +0 -1
- package/dist/cdn/shared-759f65d8.js +0 -1
- /package/dist/cdn/{shared-eadf0d23.js → shared-084e1772.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-b0db52f7.js";import{h as t,P as e}from"./shared-021fbb51.js";import{F as i,t as o}from"./shared-8dd6e5cc.js";import{T as n,a,E as s}from"./shared-9a291941.js";import"./shared-0ea24ca2.js";import{O as r}from"./shared-ad470adf.js";import"./shared-be071e3d.js";import"./shared-591ee1bf.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-26b55da2.js";import{I as l}from"./shared-9a454e09.js";import"./shared-4cc1fb20.js";import{x as d}from"./shared-328aa161.js";import{c,h,r as
|
|
1
|
+
import"./shared-b0db52f7.js";import{h as t,P as e}from"./shared-021fbb51.js";import{F as i,t as o}from"./shared-8dd6e5cc.js";import{T as n,a,E as s}from"./shared-9a291941.js";import"./shared-0ea24ca2.js";import{O as r}from"./shared-ad470adf.js";import"./shared-be071e3d.js";import"./shared-591ee1bf.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-26b55da2.js";import{I as l}from"./shared-9a454e09.js";import"./shared-4cc1fb20.js";import{x as d}from"./shared-328aa161.js";import{c,h,r as u}from"./shared-ba5c42c7.js";import{_ as m}from"./shared-8f9014ff.js";import{i as p}from"./shared-53e42a77.js";import{c as _}from"./shared-4e709717.js";const f=t`<dom-module id="lumo-notification-card" theme-for="vaadin-notification-card">
|
|
2
2
|
<template>
|
|
3
3
|
<style>
|
|
4
4
|
:host {
|
|
@@ -277,4 +277,4 @@ class v extends(n(s(e))){static get template(){return t`
|
|
|
277
277
|
</style>
|
|
278
278
|
<vaadin-notification-card id="vaadin-notification-card" theme\$="[[theme]]">
|
|
279
279
|
</vaadin-notification-card>
|
|
280
|
-
`}static get is(){return"vaadin-notification"}static get version(){return"1.6.2"}static get properties(){return{duration:{type:Number,value:5e3},opened:{type:Boolean,value:!1,notify:!0,observer:"_openedChanged"},position:{type:String,value:"bottom-start",observer:"_positionChanged"},renderer:Function,_notificationTemplate:Object}}static get observers(){return["_durationChanged(duration, opened)","_templateOrRendererChanged(_notificationTemplate, renderer, opened)"]}ready(){super.ready(),this._observer=new i(this,(t=>{this._setTemplateFromNodes(t.addedNodes)}))}_setTemplateFromNodes(t){this._notificationTemplate=t.filter((t=>t.localName&&"template"===t.localName))[0]||this._notificationTemplate}render(){"function"==typeof this.renderer&&this.renderer(this._card,this)}_removeNewRendererOrTemplate(t,e,i,o){t!==e?this._notificationTemplate=void 0:i!==o&&(this.renderer=void 0)}_templateOrRendererChanged(t,e,i){if(t&&e)throw this._removeNewRendererOrTemplate(t,this._oldTemplate,e,this._oldRenderer),new Error("You should only use either a renderer or a template for notification content");this._oldTemplate=t;const o=this._oldRenderer!==e;if(this._oldRenderer=e,e){if(this._card=this.$["vaadin-notification-card"],o)for(;this._card.firstChild;)this._card.removeChild(this._card.firstChild);i&&(this._didAnimateNotificationAppend||this._animatedAppendNotificationCard(),this.render())}}open(){this.opened=!0}close(){this.opened=!1}get _container(){return g._container||(g._container=document.createElement("vaadin-notification-container"),document.body.appendChild(g._container)),g._container}_openedChanged(t){t?(this._container.opened=!0,this._instance||this.renderer||this._ensureTemplatized(),this._animatedAppendNotificationCard(),setTimeout((()=>this._updateShadyButtonStyles()))):this._card&&this._closeNotificationCard()}_ensureTemplatized(){if(this._notificationTemplate=this.querySelector("template")||this._notificationTemplate,!this._notificationTemplate)return;this._notificationTemplate._Templatizer||(this._notificationTemplate._Templatizer=o(this._notificationTemplate,this,{forwardHostProp:function(t,e){this._instance&&this._instance.forwardHostProp(t,e)}})),this._instance=new this._notificationTemplate._Templatizer({});const t=this._notificationTemplate.getRootNode(),e=t!==document;if(this._card=this.$["vaadin-notification-card"],this._cardContent=this._card.shadowRoot.querySelector('[part~="content"]'),e){if(this._cardContent.shadowRoot||this._cardContent.attachShadow({mode:"open"}),window.ShadyCSS&&!window.ShadyCSS.nativeShadow){var i=t.host&&t.host.localName;i&&-1===i.indexOf("-")&&(i=t.host.getAttribute("is")),i&&this._cardContent.setAttribute("is",i)}else{const e=Array.from(t.querySelectorAll("style")).reduce(((t,e)=>t+e.textContent),"").replace(/:host/g,":host-nomatch");if(e){const t=document.createElement("style");t.textContent=e,this._cardContent.shadowRoot.appendChild(t)}}this._cardContent.shadowRoot.appendChild(this._instance.root)}else this._card.appendChild(this._instance.root);this._card.setAttribute("aria-label",this._card.textContent.trim())}_animatedAppendNotificationCard(){if(this._card){this._card.setAttribute("opening",""),this._appendNotificationCard();const t=()=>{this._card.removeEventListener("animationend",t),this._card.removeAttribute("opening")};this._card.addEventListener("animationend",t),this._didAnimateNotificationAppend=!0}else this._didAnimateNotificationAppend=!1}_appendNotificationCard(){this._card&&(this._container.shadowRoot.querySelector(`slot[name="${this.position}"]`)?(this._card.slot=this.position,this._container.firstElementChild&&/top/.test(this.position)?this._container.insertBefore(this._card,this._container.firstElementChild):this._container.appendChild(this._card)):window.console.warn(`Invalid alignment parameter provided: position=${this.position}`))}_removeNotificationCard(){this._card.parentNode&&this._card.parentNode.removeChild(this._card),this._card.removeAttribute("closing"),this._container.opened=Boolean(this._container.firstElementChild)}_closeNotificationCard(){this._durationTimeoutId&&clearTimeout(this._durationTimeoutId),this._animatedRemoveNotificationCard()}_animatedRemoveNotificationCard(){this._card.setAttribute("closing","");const t=getComputedStyle(this._card).getPropertyValue("animation-name");if(t&&"none"!=t){const t=()=>{this._removeNotificationCard(),this._card.removeEventListener("animationend",t)};this._card.addEventListener("animationend",t)}else this._removeNotificationCard()}_positionChanged(t){this.opened&&this._animatedAppendNotificationCard()}_durationChanged(t,e){e&&(clearTimeout(this._durationTimeoutId),t>0&&(this._durationTimeoutId=setTimeout((()=>this.close()),t)))}_updateShadyButtonStyles(){window.ShadyCSS&&!this.__buttonStylesPending&&(customElements.whenDefined("vaadin-button").then((()=>{Array.from(this._card.querySelectorAll("*")).filter((t=>t instanceof customElements.get("vaadin-button"))).forEach((t=>{const e=["--_lumo-button-color","--_lumo-button-background-color","--_lumo-button-primary-color","--_lumo-button-primary-background-color"].reduce(((t,e)=>{const i=window.ShadyCSS.getComputedStyleValue(this._card,e);return i&&(t[e]=i),t}),{});t.updateStyles(e)})),this.__buttonStylesPending=!1})),this.__buttonStylesPending=!0)}}customElements.define(v.is,v),customElements.define(y.is,y),customElements.define(g.is,g);let b;d("vaadin-checkbox",c(b||(b=(t=>t)`:host([data-async-list-control]) label{display:flex}:host([data-async-list-control]) [part=label]{width:100%;margin:0!important}`)));let x,$=t=>t;const C=t=>class e extends t{static get properties(){return{positionTarget:{type:Object,value:null},horizontalAlign:{type:String,value:"start"},verticalAlign:{type:String,value:"top"},noHorizontalOverlap:{type:Boolean,value:!1},noVerticalOverlap:{type:Boolean,value:!1}}}static get observers(){return["__positionSettingsChanged(positionTarget, horizontalAlign, verticalAlign,\n noHorizontalOverlap, noVerticalOverlap)"]}constructor(){super();const t=this._updatePosition.bind(this);this.addEventListener("opened-changed",(e=>{const i=e.detail.value?"addEventListener":"removeEventListener";window[i]("scroll",t),window[i]("resize",t),e.detail.value&&this._updatePosition()}))}ready(){super.ready(),console.warn("PositionMixin is not considered stable and might change any time")}__positionSettingsChanged(){this._updatePosition()}_updatePosition(){if(!this.positionTarget)return;const t=getComputedStyle(this);this.__margins||(this.__margins={},["top","bottom","left","right"].forEach((e=>{this.__margins[e]=parseInt(t[e],10)})));const e="rtl"===t.direction,i=this.positionTarget.getBoundingClientRect(),o=this.__calculateHorizontalPosition(i,e),n=this.__calculateVerticalPosition(i),a=Object.assign({},o,n);this.__doSetPosition(a,e)}__calculateHorizontalPosition(t,i){const o=Math.max(this.__oldContentWidth||0,this.$.overlay.offsetWidth);this.__oldContentWidth=this.$.overlay.offsetWidth;const n=Math.min(window.innerWidth,document.documentElement.clientWidth),a=!i&&"start"===this.horizontalAlign||i&&"end"===this.horizontalAlign,s=!!this.style.left;return e.__calculatePositionInOneDimension(t,o,n,this.__margins,a,s,this.noHorizontalOverlap,{start:"left",end:"right"})}__calculateVerticalPosition(t){const i=Math.max(this.__oldContentHeight||0,this.$.overlay.offsetHeight);this.__oldContentHeight=this.$.overlay.offsetHeight;const o=Math.min(window.innerHeight,document.documentElement.clientHeight),n="top"===this.verticalAlign,a=!!this.style.top;return e.__calculatePositionInOneDimension(t,i,o,this.__margins,n,a,this.noVerticalOverlap,{start:"top",end:"bottom"})}static __calculatePositionInOneDimension(t,e,i,o,n,a,s,r){const l=i-t[s?r.end:r.start]-o[r.end],d=t[s?r.start:r.end]-o[r.start],c=n?l:d,h=n===(c>(n?d:l)||c>e),m=h?r.start:r.end,u=h?r.end:r.start,p=(h?t[s?r.end:r.start]:i-t[s?r.start:r.end])+"px",_={};return _[m]=p,_[u]="",_}__doSetPosition(t,e){Object.assign(this.style,t);const i=!e&&t.left||e&&t.right;this.style.alignItems=i?"flex-start":"flex-end",this.style.justifyContent=t.top?"flex-start":"flex-end"}};class w extends(C(r)){constructor(){super(...arguments),this.renderer=(t,e,i)=>{var o;const n=null!==(o=t.firstElementChild)&&void 0!==o?o:document.createElement("div");t.firstElementChild||t.appendChild(n);const a=i,s=h(x||(x=$` <div style="display:grid;gap:var(--lumo-space-m);padding:var(--lumo-space-s);min-width:22rem;max-width:35rem"> <foxy-query-builder lang="${0}" ns="${0}" .options="${0}" .value="${0}"> </foxy-query-builder> <div style="display:flex;justify-content:space-between"> <vaadin-button theme="primary" style="margin:0" @click="${0}"> <foxy-i18n lang="${0}" ns="${0}" key="search"></foxy-i18n> </vaadin-button> <vaadin-button theme="secondary contrast" style="margin:0" @click="${0}"> <foxy-i18n lang="${0}" ns="${0}" key="clear"></foxy-i18n> </vaadin-button> </div> </div> `),a.lang,`${a.ns} query-builder`.trim(),a.options,a.value,(()=>{var t;const e=null!==(t=n.querySelector("foxy-query-builder").value)&&void 0!==t?t:"";this.dispatchEvent(new CustomEvent("search",{detail:e}))}),a.lang,a.ns,(()=>this.dispatchEvent(new CustomEvent("search"))),a.lang,a.ns);m(s,n)}}static get is(){return"foxy-internal-async-list-control-filter-overlay"}}let k,S,E,T,P,A,O,R,j,B,N,z,I,H,D,L,V,q,F,W,M,Y,U,J,G=t=>t;customElements.define("foxy-internal-async-list-control",class extends l{constructor(){super(...arguments),this.keepDialogOpenOnDelete=!1,this.keepDialogOpenOnPost=!1,this.createPageHref=null,this.bulkActions=[],this.related=[],this.layout=null,this.actions=[],this.filters=[],this.limit=20,this.first=null,this.form=null,this.formProps={},this.item=null,this.itemProps={},this.wide=!1,this.hideWhenEmpty=!1,this.open=!1,this.alert=!1,this.hideDeleteButton=!1,this.hideCreateButton=!1,this.getPageHref=null,this.filter=null,this.__deletionConfimationCallback=null,this.__cachedCardRenderer=null,this.__activeBulkAction=null,this.__isFilterVisible=!1,this.__notification=null,this.__isSelecting=!1,this.__totalItems=0,this.__selection=[],this.__itemRenderer=t=>{var e;const i=this.__cardRenderer(t),o=h(k||(k=G`<div class="bg-contrast-5">${0}</div>`),i);if(!t.data)return o;if(this.__isSelecting)return h(S||(S=G` <vaadin-checkbox class="${0}" style="padding-left:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" data-async-list-control ?disabled="${0}" ?checked="${0}" @change="${0}"> ${0} </vaadin-checkbox> `),_({"block w-full":!0,"bg-contrast-5":"details"===this.layout}),this.disabled||!!this.__activeBulkAction,this.__selection.find((e=>e._links.self.href===t.data._links.self.href)),(e=>{e.currentTarget.checked?this.__selection=[...this.__selection,t.data]:this.__selection=this.__selection.filter((e=>e._links.self.href!==t.data._links.self.href))}),this.__cardRenderer(t));if("string"!=typeof(null===(e=this.getPageHref)||void 0===e?void 0:e.call(this,t.href,t.data))&&!this.form)return o;const n=this.disabledSelector.matches("card",!0),a=this.__cardRenderer(t);let s;const r=_({"rounded-t":"details"!==this.layout&&!t.previous,"rounded-b":!t.next,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block bg-contrast-5 transition-colors":!0,"hover-bg-contrast-10":!n});if(this.getPageHref)if(n)s=h(E||(E=G`<div class="${0}">${0}</div>`),r,a);else{const e=this.getPageHref(t.href,t.data);s=h(T||(T=G`<a class="${0}" href="${0}">${0}</a>`),r,e,a)}else{s=h(P||(P=G` <button ?disabled="${0}" class="${0}" @click="${0}">${0}</button> `),n,r,(e=>{const i=new CustomEvent("itemclick",{cancelable:!0,composed:!0,bubbles:!0,detail:t.href});if(this.dispatchEvent(i)){const i=e.currentTarget,o=this.__dialog;o.header="header_update",o.href=t.href,o.show(i)}}),a)}return this.hideDeleteButton&&!this.actions.length||this.readonly?s:h(A||(A=G` <foxy-swipe-actions class="block"> ${0} ${0} ${0} </foxy-swipe-actions> `),s,this.actions.map((e=>h(O||(O=G` <vaadin-button data-testclass="action" theme="${0}" class="h-full rounded-none relative" slot="action" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" infer="" key="${0}"> </foxy-i18n> <div class="${0}"> <foxy-spinner layout="no-label" infer="spinner" state="${0}"> </foxy-spinner> </div> </vaadin-button> `),e.theme,this.disabled,(()=>e.onClick(t.data)),_({"transition-opacity":!0,"opacity-0":"idle"!==e.state}),e.text,_({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===e.state}),e.state))),this.hideDeleteButton?"":h(R||(R=G` <vaadin-button theme="primary error" class="h-full rounded-none" slot="action" @click="${0}"> <foxy-i18n infer="" key="delete_button_text"></foxy-i18n> </vaadin-button> `),(t=>{const e=t.currentTarget;this.renderRoot.querySelector("#confirm").show(e),this.__deletionConfimationCallback=()=>{const t=e.parentElement.firstElementChild.querySelector("[href]");null==t||t.delete(),this.__deletionConfimationCallback=null}})))}}static get properties(){return u(u({},super.properties),{},{keepDialogOpenOnDelete:{type:Boolean,attribute:"keep-dialog-open-on-delete"},keepDialogOpenOnPost:{type:Boolean,attribute:"keep-dialog-open-on-post"},hideDeleteButton:{type:Boolean,attribute:"hide-delete-button"},hideCreateButton:{type:Boolean,attribute:"hide-create-button"},createPageHref:{attribute:"create-page-href"},getPageHref:{attribute:!1},related:{type:Array},layout:{},first:{},limit:{type:Number},form:{},formProps:{type:Object,attribute:"form-props"},item:{},itemProps:{type:Object,attribute:"item-props"},wide:{type:Boolean},open:{type:Boolean},hideWhenEmpty:{type:Boolean,attribute:"hide-when-empty"},alert:{type:Boolean},actions:{attribute:!1},bulkActions:{attribute:!1},filters:{type:Array},filter:{},__selection:{attribute:!1},__totalItems:{attribute:!1},__isSelecting:{attribute:!1},__notification:{attribute:!1},__isFilterVisible:{attribute:!1},__activeBulkAction:{attribute:!1}})}render(){const t=this.hideWhenEmpty&&!this.__totalItems;return h(j||(j=G`<div class="${0}">${0}</div>`),_({hidden:t}),super.render())}renderControl(){var t,e;const i=this.__renderActions(),o=this.__renderContent();return h(B||(B=G` ${0} ${0} ${0} <div class="mt-s text-s leading-xs text-error" ?hidden="${0}"> ${0} </div> <vaadin-notification position="bottom-end" duration="3000" theme="${0}" .renderer="${0}"> </vaadin-notification> `),this.form&&!this.__isSelecting?h(N||(N=G` <foxy-form-dialog parent="${0}" infer="dialog" id="form" ?wide="${0}" ?alert="${0}" ?keep-open-on-post="${0}" ?keep-open-on-delete="${0}" .related="${0}" .props="${0}" .form="${0}"> </foxy-form-dialog> `),p(null!==(t=this.first)&&void 0!==t?t:void 0),this.wide,this.alert,this.keepDialogOpenOnPost,this.keepDialogOpenOnDelete,this.related,this.formProps,this.form):"",this.hideDeleteButton||this.readonly||this.__isSelecting?"":h(z||(z=G` <foxy-internal-confirm-dialog message="delete_message" confirm="delete_confirm" cancel="delete_cancel" header="delete_header" theme="error" infer="" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> `),(t=>{var e;t.detail.cancelled||null===(e=this.__deletionConfimationCallback)||void 0===e||e.call(this)})),"details"===this.layout?h(I||(I=G` <foxy-internal-summary-control layout="details" count="${0}" infer="" ?open="${0}" @toggle="${0}"> ${0} <div class="p-0 bg-transparent">${0}</div> </foxy-internal-summary-control> `),p(this.open?void 0:`${this.__totalItems}`),this.open,(t=>{const e=t.currentTarget;this.open=e.open,t.composed||t.bubbles||this.dispatchEvent(new CustomEvent("toggle"))}),i.length?h(H||(H=G` <div class="flex gap-s"> <foxy-i18n infer="" class="mr-auto text-tertiary" key="total_items" .options="${0}"> </foxy-i18n> ${0} </div> `),{count:this.__totalItems},i):"",o):h(D||(D=G` <div class="flex gap-s items-center justify-between font-medium"> <span class="text-body mr-auto text-l"> ${0} </span> ${0} </div> <div class="text-secondary text-s" ?hidden="${0}"> ${0} </div> ${0} `),this.label&&"label"!==this.label?this.label:"",i,!this.helperText||"helper_text"===this.helperText,this.helperText,o),!this._errorMessage||this.disabled||this.readonly||this.__isSelecting,this._errorMessage,p(null===(e=this.__notification)||void 0===e?void 0:e.theme),(t=>{var e,i;t.firstElementChild||(t.innerHTML="<span></span>");const o=null===(e=this.__notification)||void 0===e?void 0:e.theme,n=h(L||(L=G` <foxy-i18n style="color:var(--lumo-${0}-color)" lang="${0}" key="${0}" ns="${0} pagination"> </foxy-i18n> `),o?`${o}-contrast`:"body-text",this.lang,null===(i=this.__notification)||void 0===i?void 0:i.key,this.ns);m(n,t.firstElementChild)}))}get __cardRenderer(){var t;const e=this.item;return(null===(t=this.__cachedCardRenderer)||void 0===t?void 0:t.item)!==e&&(this.__cachedCardRenderer={item:e,render:"string"==typeof e?new Function("ctx",`return ctx.html\`\n <${e}\n related=\${JSON.stringify(ctx.related)}\n parent=\${ctx.parent}\n style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"\n infer=""\n href=\${ctx.href}\n ...=\${ctx.spread(ctx.props)}\n >\n </${e}>\``):t=>h(V||(V=G` <div style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> `),null==e?void 0:e(t))}),this.__cachedCardRenderer.render}get __dialog(){return this.renderRoot.querySelector("#form")}__renderActions(){var t,e=this;return[this.filters.length>0&&!this.__isSelecting?h(q||(q=G` <foxy-internal-async-list-control-filter-overlay .noVerticalOverlap="${0}" .positionTarget="${0}" .model="${0}" ?opened="${0}" @vaadin-overlay-close="${0}" @search="${0}"> </foxy-internal-async-list-control-filter-overlay> <vaadin-button theme="tertiary-inline contrast" id="filters" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="search_button_text"></foxy-i18n> ${0} </vaadin-button> `),!0,this.renderRoot.querySelector("#filters"),{options:this.filters,value:null!==(t=this.filter)&&void 0!==t?t:"",lang:this.lang,ns:this.ns},this.__isFilterVisible,(()=>this.__isFilterVisible=!1),(t=>{var e;this.filter=null!==(e=t.detail)&&void 0!==e?e:""}),this.disabled,(()=>this.__isFilterVisible=!this.__isFilterVisible),this.filter?h(F||(F=G`<span>(${0})</span>`),this.filter.split("&").length):""):"",this.bulkActions.length>0&&this.first?h(W||(W=G` ${0} <vaadin-button theme="tertiary-inline contrast" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="${0}"> </foxy-i18n> </vaadin-button> `),this.__selection.length>0?this.bulkActions.map((t=>{var i;const o=`${t.name}_bulk_action_notification`,n=`${t.name}_bulk_action_caption`,a=(null===(i=this.__activeBulkAction)||void 0===i?void 0:i.name)===t.name;return h(M||(M=G` <vaadin-button data-testclass="bulk-action" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="${0}_${0}" .options="${0}"> </foxy-i18n> </vaadin-button> `),this.disabled||!!this.__activeBulkAction,(async function(){var i;e.__activeBulkAction=t;try{await t.onClick(e.__selection),e.__selection=[],e.__isSelecting=!1,e.__notification={key:`${o}_done`,theme:"success"}}catch(t){e.__notification={key:`${o}_fail`,theme:"error"}}finally{e.__activeBulkAction=null,null===(i=e.renderRoot.querySelector("vaadin-notification"))||void 0===i||i.open()}}),n,a?"busy":"idle",{count:this.__selection.length})})):"",this.disabled||!!this.__activeBulkAction,(()=>{this.__isSelecting=!this.__isSelecting,this.__selection=[]}),this.__isSelecting?"cancel_button_text":"select_button_text"):"",!this.form&&!this.createPageHref||this.readonly||this.hideCreateButton||this.__isSelecting?"":this.createPageHref&&!this.disabled?h(Y||(Y=G` <a class="rounded-s text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="create_button_text"> </foxy-i18n> </a> `),this.createPageHref):h(U||(U=G` <vaadin-button theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="create_button_text"></foxy-i18n> </vaadin-button> `),this.disabled,(t=>{t.preventDefault(),t.stopPropagation();const e=this.__dialog,i=t.currentTarget;e.header="header_create",e.href="",e.show(i)}))].filter((t=>!!t))}__renderContent(){var t,e;const i=this.helperText,o="details"===this.layout,n=this.label;let a;try{const i=new URL(null!==(t=this.first)&&void 0!==t?t:""),o=new URLSearchParams(null!==(e=this.filter)&&void 0!==e?e:"");i.searchParams.set("limit",String(this.limit)),o.forEach(((t,e)=>i.searchParams.set(e,t))),a=i.toString()}catch(t){a=void 0}return h(J||(J=G` <foxy-pagination first="${0}" infer="pagination" class="${0}"> <foxy-collection-page class="${0}" style="gap:1px" infer="card" .related="${0}" .props="${0}" .item="${0}" @update="${0}"> </foxy-collection-page> </foxy-pagination> `),p(a),_({hidden:o&&0===this.__totalItems}),_({"grid grid-cols-1 overflow-hidden":!0,rounded:!o,"mt-s":!o&&(!!n&&"label"!==n||!!i&&"helper_text"!==i)}),this.related,this.itemProps,this.__itemRenderer,(t=>{var e,i;const o=t.currentTarget;this.__totalItems=parseInt(null!==(i=null===(e=o.data)||void 0===e?void 0:e.total_items)&&void 0!==i?i:0)}))}}),customElements.define(w.is,w);
|
|
280
|
+
`}static get is(){return"vaadin-notification"}static get version(){return"1.6.2"}static get properties(){return{duration:{type:Number,value:5e3},opened:{type:Boolean,value:!1,notify:!0,observer:"_openedChanged"},position:{type:String,value:"bottom-start",observer:"_positionChanged"},renderer:Function,_notificationTemplate:Object}}static get observers(){return["_durationChanged(duration, opened)","_templateOrRendererChanged(_notificationTemplate, renderer, opened)"]}ready(){super.ready(),this._observer=new i(this,(t=>{this._setTemplateFromNodes(t.addedNodes)}))}_setTemplateFromNodes(t){this._notificationTemplate=t.filter((t=>t.localName&&"template"===t.localName))[0]||this._notificationTemplate}render(){"function"==typeof this.renderer&&this.renderer(this._card,this)}_removeNewRendererOrTemplate(t,e,i,o){t!==e?this._notificationTemplate=void 0:i!==o&&(this.renderer=void 0)}_templateOrRendererChanged(t,e,i){if(t&&e)throw this._removeNewRendererOrTemplate(t,this._oldTemplate,e,this._oldRenderer),new Error("You should only use either a renderer or a template for notification content");this._oldTemplate=t;const o=this._oldRenderer!==e;if(this._oldRenderer=e,e){if(this._card=this.$["vaadin-notification-card"],o)for(;this._card.firstChild;)this._card.removeChild(this._card.firstChild);i&&(this._didAnimateNotificationAppend||this._animatedAppendNotificationCard(),this.render())}}open(){this.opened=!0}close(){this.opened=!1}get _container(){return g._container||(g._container=document.createElement("vaadin-notification-container"),document.body.appendChild(g._container)),g._container}_openedChanged(t){t?(this._container.opened=!0,this._instance||this.renderer||this._ensureTemplatized(),this._animatedAppendNotificationCard(),setTimeout((()=>this._updateShadyButtonStyles()))):this._card&&this._closeNotificationCard()}_ensureTemplatized(){if(this._notificationTemplate=this.querySelector("template")||this._notificationTemplate,!this._notificationTemplate)return;this._notificationTemplate._Templatizer||(this._notificationTemplate._Templatizer=o(this._notificationTemplate,this,{forwardHostProp:function(t,e){this._instance&&this._instance.forwardHostProp(t,e)}})),this._instance=new this._notificationTemplate._Templatizer({});const t=this._notificationTemplate.getRootNode(),e=t!==document;if(this._card=this.$["vaadin-notification-card"],this._cardContent=this._card.shadowRoot.querySelector('[part~="content"]'),e){if(this._cardContent.shadowRoot||this._cardContent.attachShadow({mode:"open"}),window.ShadyCSS&&!window.ShadyCSS.nativeShadow){var i=t.host&&t.host.localName;i&&-1===i.indexOf("-")&&(i=t.host.getAttribute("is")),i&&this._cardContent.setAttribute("is",i)}else{const e=Array.from(t.querySelectorAll("style")).reduce(((t,e)=>t+e.textContent),"").replace(/:host/g,":host-nomatch");if(e){const t=document.createElement("style");t.textContent=e,this._cardContent.shadowRoot.appendChild(t)}}this._cardContent.shadowRoot.appendChild(this._instance.root)}else this._card.appendChild(this._instance.root);this._card.setAttribute("aria-label",this._card.textContent.trim())}_animatedAppendNotificationCard(){if(this._card){this._card.setAttribute("opening",""),this._appendNotificationCard();const t=()=>{this._card.removeEventListener("animationend",t),this._card.removeAttribute("opening")};this._card.addEventListener("animationend",t),this._didAnimateNotificationAppend=!0}else this._didAnimateNotificationAppend=!1}_appendNotificationCard(){this._card&&(this._container.shadowRoot.querySelector(`slot[name="${this.position}"]`)?(this._card.slot=this.position,this._container.firstElementChild&&/top/.test(this.position)?this._container.insertBefore(this._card,this._container.firstElementChild):this._container.appendChild(this._card)):window.console.warn(`Invalid alignment parameter provided: position=${this.position}`))}_removeNotificationCard(){this._card.parentNode&&this._card.parentNode.removeChild(this._card),this._card.removeAttribute("closing"),this._container.opened=Boolean(this._container.firstElementChild)}_closeNotificationCard(){this._durationTimeoutId&&clearTimeout(this._durationTimeoutId),this._animatedRemoveNotificationCard()}_animatedRemoveNotificationCard(){this._card.setAttribute("closing","");const t=getComputedStyle(this._card).getPropertyValue("animation-name");if(t&&"none"!=t){const t=()=>{this._removeNotificationCard(),this._card.removeEventListener("animationend",t)};this._card.addEventListener("animationend",t)}else this._removeNotificationCard()}_positionChanged(t){this.opened&&this._animatedAppendNotificationCard()}_durationChanged(t,e){e&&(clearTimeout(this._durationTimeoutId),t>0&&(this._durationTimeoutId=setTimeout((()=>this.close()),t)))}_updateShadyButtonStyles(){window.ShadyCSS&&!this.__buttonStylesPending&&(customElements.whenDefined("vaadin-button").then((()=>{Array.from(this._card.querySelectorAll("*")).filter((t=>t instanceof customElements.get("vaadin-button"))).forEach((t=>{const e=["--_lumo-button-color","--_lumo-button-background-color","--_lumo-button-primary-color","--_lumo-button-primary-background-color"].reduce(((t,e)=>{const i=window.ShadyCSS.getComputedStyleValue(this._card,e);return i&&(t[e]=i),t}),{});t.updateStyles(e)})),this.__buttonStylesPending=!1})),this.__buttonStylesPending=!0)}}customElements.define(v.is,v),customElements.define(y.is,y),customElements.define(g.is,g);let b;d("vaadin-checkbox",c(b||(b=(t=>t)`:host([data-async-list-control]) label{display:flex}:host([data-async-list-control]) [part=label]{width:100%;margin:0!important}`)));let x,$=t=>t;const C=t=>class e extends t{static get properties(){return{positionTarget:{type:Object,value:null},horizontalAlign:{type:String,value:"start"},verticalAlign:{type:String,value:"top"},noHorizontalOverlap:{type:Boolean,value:!1},noVerticalOverlap:{type:Boolean,value:!1}}}static get observers(){return["__positionSettingsChanged(positionTarget, horizontalAlign, verticalAlign,\n noHorizontalOverlap, noVerticalOverlap)"]}constructor(){super();const t=this._updatePosition.bind(this);this.addEventListener("opened-changed",(e=>{const i=e.detail.value?"addEventListener":"removeEventListener";window[i]("scroll",t),window[i]("resize",t),e.detail.value&&this._updatePosition()}))}ready(){super.ready(),console.warn("PositionMixin is not considered stable and might change any time")}__positionSettingsChanged(){this._updatePosition()}_updatePosition(){if(!this.positionTarget)return;const t=getComputedStyle(this);this.__margins||(this.__margins={},["top","bottom","left","right"].forEach((e=>{this.__margins[e]=parseInt(t[e],10)})));const e="rtl"===t.direction,i=this.positionTarget.getBoundingClientRect(),o=this.__calculateHorizontalPosition(i,e),n=this.__calculateVerticalPosition(i),a=Object.assign({},o,n);this.__doSetPosition(a,e)}__calculateHorizontalPosition(t,i){const o=Math.max(this.__oldContentWidth||0,this.$.overlay.offsetWidth);this.__oldContentWidth=this.$.overlay.offsetWidth;const n=Math.min(window.innerWidth,document.documentElement.clientWidth),a=!i&&"start"===this.horizontalAlign||i&&"end"===this.horizontalAlign,s=!!this.style.left;return e.__calculatePositionInOneDimension(t,o,n,this.__margins,a,s,this.noHorizontalOverlap,{start:"left",end:"right"})}__calculateVerticalPosition(t){const i=Math.max(this.__oldContentHeight||0,this.$.overlay.offsetHeight);this.__oldContentHeight=this.$.overlay.offsetHeight;const o=Math.min(window.innerHeight,document.documentElement.clientHeight),n="top"===this.verticalAlign,a=!!this.style.top;return e.__calculatePositionInOneDimension(t,i,o,this.__margins,n,a,this.noVerticalOverlap,{start:"top",end:"bottom"})}static __calculatePositionInOneDimension(t,e,i,o,n,a,s,r){const l=i-t[s?r.end:r.start]-o[r.end],d=t[s?r.start:r.end]-o[r.start],c=n?l:d,h=n===(c>(n?d:l)||c>e),u=h?r.start:r.end,m=h?r.end:r.start,p=(h?t[s?r.end:r.start]:i-t[s?r.start:r.end])+"px",_={};return _[u]=p,_[m]="",_}__doSetPosition(t,e){Object.assign(this.style,t);const i=!e&&t.left||e&&t.right;this.style.alignItems=i?"flex-start":"flex-end",this.style.justifyContent=t.top?"flex-start":"flex-end"}};class w extends(C(r)){constructor(){super(...arguments),this.renderer=(t,e,i)=>{var o;const n=null!==(o=t.firstElementChild)&&void 0!==o?o:document.createElement("div");t.firstElementChild||t.appendChild(n);const a=i,s=h(x||(x=$` <div style="display:grid;gap:var(--lumo-space-m);padding:var(--lumo-space-s);min-width:22rem;max-width:35rem"> <foxy-query-builder lang="${0}" ns="${0}" .options="${0}" .value="${0}"> </foxy-query-builder> <div style="display:flex;justify-content:space-between"> <vaadin-button theme="primary" style="margin:0" @click="${0}"> <foxy-i18n lang="${0}" ns="${0}" key="search"></foxy-i18n> </vaadin-button> <vaadin-button theme="secondary contrast" style="margin:0" @click="${0}"> <foxy-i18n lang="${0}" ns="${0}" key="clear"></foxy-i18n> </vaadin-button> </div> </div> `),a.lang,`${a.ns} query-builder`.trim(),a.options,a.value,(()=>{var t;const e=null!==(t=n.querySelector("foxy-query-builder").value)&&void 0!==t?t:"";this.dispatchEvent(new CustomEvent("search",{detail:e}))}),a.lang,a.ns,(()=>this.dispatchEvent(new CustomEvent("search"))),a.lang,a.ns);u(s,n)}}static get is(){return"foxy-internal-async-list-control-filter-overlay"}}let k,S,E,P,T,A,O,R,j,B,N,z,I,H,D,L,V,q,F,W,M,Y,U,J,G=t=>t;customElements.define("foxy-internal-async-list-control",class extends l{constructor(){super(...arguments),this.keepDialogOpenOnDelete=!1,this.keepDialogOpenOnPost=!1,this.createPageHref=null,this.bulkActions=[],this.related=[],this.layout=null,this.actions=[],this.filters=[],this.limit=20,this.first=null,this.form=null,this.formProps={},this.item=null,this.itemProps={},this.wide=!1,this.hideWhenEmpty=!1,this.open=!1,this.alert=!1,this.hideDeleteButton=!1,this.hideCreateButton=!1,this.getPageHref=null,this.filter=null,this.extendFilter=null,this.__deletionConfimationCallback=null,this.__cachedCardRenderer=null,this.__activeBulkAction=null,this.__isFilterVisible=!1,this.__notification=null,this.__isSelecting=!1,this.__totalItems=0,this.__selection=[],this.__itemRenderer=t=>{var e;const i=this.__cardRenderer(t),o=h(k||(k=G`<div class="bg-contrast-5">${0}</div>`),i);if(!t.data)return o;if(this.__isSelecting)return h(S||(S=G` <vaadin-checkbox class="${0}" style="padding-left:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" data-async-list-control ?disabled="${0}" ?checked="${0}" @change="${0}"> ${0} </vaadin-checkbox> `),_({"block w-full":!0,"bg-contrast-5":"details"===this.layout}),this.disabled||!!this.__activeBulkAction,this.__selection.find((e=>e._links.self.href===t.data._links.self.href)),(e=>{e.currentTarget.checked?this.__selection=[...this.__selection,t.data]:this.__selection=this.__selection.filter((e=>e._links.self.href!==t.data._links.self.href))}),this.__cardRenderer(t));if("string"!=typeof(null===(e=this.getPageHref)||void 0===e?void 0:e.call(this,t.href,t.data))&&!this.form)return o;const n=this.disabledSelector.matches("card",!0),a=this.__cardRenderer(t);let s;const r=_({"rounded-t":"details"!==this.layout&&!t.previous,"rounded-b":!t.next,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block bg-contrast-5 transition-colors":!0,"hover-bg-contrast-10":!n});if(this.getPageHref)if(n)s=h(E||(E=G`<div class="${0}">${0}</div>`),r,a);else{const e=this.getPageHref(t.href,t.data);s=h(P||(P=G`<a class="${0}" href="${0}">${0}</a>`),r,e,a)}else{s=h(T||(T=G` <button ?disabled="${0}" class="${0}" @click="${0}">${0}</button> `),n,r,(e=>{const i=new CustomEvent("itemclick",{cancelable:!0,composed:!0,bubbles:!0,detail:t.href});if(this.dispatchEvent(i)){const i=e.currentTarget,o=this.__dialog;o.header="header_update",o.href=t.href,o.show(i)}}),a)}return this.hideDeleteButton&&!this.actions.length||this.readonly?s:h(A||(A=G` <foxy-swipe-actions class="block"> ${0} ${0} ${0} </foxy-swipe-actions> `),s,this.actions.map((e=>h(O||(O=G` <vaadin-button data-testclass="action" theme="${0}" class="h-full rounded-none relative" slot="action" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" infer="" key="${0}"> </foxy-i18n> <div class="${0}"> <foxy-spinner layout="no-label" infer="spinner" state="${0}"> </foxy-spinner> </div> </vaadin-button> `),e.theme,this.disabled,(()=>e.onClick(t.data)),_({"transition-opacity":!0,"opacity-0":"idle"!==e.state}),e.text,_({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===e.state}),e.state))),this.hideDeleteButton?"":h(R||(R=G` <vaadin-button theme="primary error" class="h-full rounded-none" slot="action" @click="${0}"> <foxy-i18n infer="" key="delete_button_text"></foxy-i18n> </vaadin-button> `),(t=>{const e=t.currentTarget;this.renderRoot.querySelector("#confirm").show(e),this.__deletionConfimationCallback=()=>{const t=e.parentElement.firstElementChild.querySelector("[href]");null==t||t.delete(),this.__deletionConfimationCallback=null}})))}}static get properties(){return m(m({},super.properties),{},{keepDialogOpenOnDelete:{type:Boolean,attribute:"keep-dialog-open-on-delete"},keepDialogOpenOnPost:{type:Boolean,attribute:"keep-dialog-open-on-post"},hideDeleteButton:{type:Boolean,attribute:"hide-delete-button"},hideCreateButton:{type:Boolean,attribute:"hide-create-button"},createPageHref:{attribute:"create-page-href"},getPageHref:{attribute:!1},related:{type:Array},layout:{},first:{},limit:{type:Number},form:{},formProps:{type:Object,attribute:"form-props"},item:{},itemProps:{type:Object,attribute:"item-props"},wide:{type:Boolean},open:{type:Boolean},hideWhenEmpty:{type:Boolean,attribute:"hide-when-empty"},alert:{type:Boolean},actions:{attribute:!1},bulkActions:{attribute:!1},filters:{type:Array},filter:{},extendFilter:{type:Function,attribute:!1},__selection:{attribute:!1},__totalItems:{attribute:!1},__isSelecting:{attribute:!1},__notification:{attribute:!1},__isFilterVisible:{attribute:!1},__activeBulkAction:{attribute:!1}})}render(){const t=this.hideWhenEmpty&&!this.__totalItems;return h(j||(j=G`<div class="${0}">${0}</div>`),_({hidden:t}),super.render())}renderControl(){var t,e;const i=this.__renderActions(),o=this.__renderContent();return h(B||(B=G` ${0} ${0} ${0} <div class="mt-s text-s leading-xs text-error" ?hidden="${0}"> ${0} </div> <vaadin-notification position="bottom-end" duration="3000" theme="${0}" .renderer="${0}"> </vaadin-notification> `),this.form&&!this.__isSelecting?h(N||(N=G` <foxy-form-dialog parent="${0}" infer="dialog" id="form" ?wide="${0}" ?alert="${0}" ?keep-open-on-post="${0}" ?keep-open-on-delete="${0}" .related="${0}" .props="${0}" .form="${0}"> </foxy-form-dialog> `),p(null!==(t=this.first)&&void 0!==t?t:void 0),this.wide,this.alert,this.keepDialogOpenOnPost,this.keepDialogOpenOnDelete,this.related,this.formProps,this.form):"",this.hideDeleteButton||this.readonly||this.__isSelecting?"":h(z||(z=G` <foxy-internal-confirm-dialog message="delete_message" confirm="delete_confirm" cancel="delete_cancel" header="delete_header" theme="error" infer="" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> `),(t=>{var e;t.detail.cancelled||null===(e=this.__deletionConfimationCallback)||void 0===e||e.call(this)})),"details"===this.layout?h(I||(I=G` <foxy-internal-summary-control layout="details" count="${0}" infer="" ?open="${0}" @toggle="${0}"> ${0} <div class="p-0 bg-transparent">${0}</div> </foxy-internal-summary-control> `),p(this.open?void 0:`${this.__totalItems}`),this.open,(t=>{const e=t.currentTarget;this.open=e.open,t.composed||t.bubbles||this.dispatchEvent(new CustomEvent("toggle"))}),i.length?h(H||(H=G` <div class="flex gap-s"> <foxy-i18n infer="" class="mr-auto text-tertiary" key="total_items" .options="${0}"> </foxy-i18n> ${0} </div> `),{count:this.__totalItems},i):"",o):h(D||(D=G` <div class="flex gap-s items-center justify-between font-medium"> <span class="text-body mr-auto text-l"> ${0} </span> ${0} </div> <div class="text-secondary text-s" ?hidden="${0}"> ${0} </div> ${0} `),this.label&&"label"!==this.label?this.label:"",i,!this.helperText||"helper_text"===this.helperText,this.helperText,o),!this._errorMessage||this.disabled||this.readonly||this.__isSelecting,this._errorMessage,p(null===(e=this.__notification)||void 0===e?void 0:e.theme),(t=>{var e,i;t.firstElementChild||(t.innerHTML="<span></span>");const o=null===(e=this.__notification)||void 0===e?void 0:e.theme,n=h(L||(L=G` <foxy-i18n style="color:var(--lumo-${0}-color)" lang="${0}" key="${0}" ns="${0} pagination"> </foxy-i18n> `),o?`${o}-contrast`:"body-text",this.lang,null===(i=this.__notification)||void 0===i?void 0:i.key,this.ns);u(n,t.firstElementChild)}))}get __cardRenderer(){var t;const e=this.item;return(null===(t=this.__cachedCardRenderer)||void 0===t?void 0:t.item)!==e&&(this.__cachedCardRenderer={item:e,render:"string"==typeof e?new Function("ctx",`return ctx.html\`\n <${e}\n related=\${JSON.stringify(ctx.related)}\n parent=\${ctx.parent}\n style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"\n infer=""\n href=\${ctx.href}\n ...=\${ctx.spread(ctx.props)}\n >\n </${e}>\``):t=>h(V||(V=G` <div style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> `),null==e?void 0:e(t))}),this.__cachedCardRenderer.render}get __dialog(){return this.renderRoot.querySelector("#form")}__renderActions(){var t,e=this;return[this.filters.length>0&&!this.__isSelecting?h(q||(q=G` <foxy-internal-async-list-control-filter-overlay .noVerticalOverlap="${0}" .positionTarget="${0}" .model="${0}" ?opened="${0}" @vaadin-overlay-close="${0}" @search="${0}"> </foxy-internal-async-list-control-filter-overlay> <vaadin-button theme="tertiary-inline contrast" id="filters" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="search_button_text"></foxy-i18n> ${0} </vaadin-button> `),!0,this.renderRoot.querySelector("#filters"),{options:this.filters,value:null!==(t=this.filter)&&void 0!==t?t:"",lang:this.lang,ns:this.ns},this.__isFilterVisible,(()=>this.__isFilterVisible=!1),(t=>{var e;this.filter=null!==(e=t.detail)&&void 0!==e?e:""}),this.disabled,(()=>this.__isFilterVisible=!this.__isFilterVisible),this.filter?h(F||(F=G`<span>(${0})</span>`),this.filter.split("&").length):""):"",this.bulkActions.length>0&&this.first?h(W||(W=G` ${0} <vaadin-button theme="tertiary-inline contrast" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="${0}"> </foxy-i18n> </vaadin-button> `),this.__selection.length>0?this.bulkActions.map((t=>{var i;const o=`${t.name}_bulk_action_notification`,n=`${t.name}_bulk_action_caption`,a=(null===(i=this.__activeBulkAction)||void 0===i?void 0:i.name)===t.name;return h(M||(M=G` <vaadin-button data-testclass="bulk-action" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="${0}_${0}" .options="${0}"> </foxy-i18n> </vaadin-button> `),this.disabled||!!this.__activeBulkAction,(async function(){var i;e.__activeBulkAction=t;try{await t.onClick(e.__selection),e.__selection=[],e.__isSelecting=!1,e.__notification={key:`${o}_done`,theme:"success"}}catch(t){e.__notification={key:`${o}_fail`,theme:"error"}}finally{e.__activeBulkAction=null,null===(i=e.renderRoot.querySelector("vaadin-notification"))||void 0===i||i.open()}}),n,a?"busy":"idle",{count:this.__selection.length})})):"",this.disabled||!!this.__activeBulkAction,(()=>{this.__isSelecting=!this.__isSelecting,this.__selection=[]}),this.__isSelecting?"cancel_button_text":"select_button_text"):"",!this.form&&!this.createPageHref||this.readonly||this.hideCreateButton||this.__isSelecting?"":this.createPageHref&&!this.disabled?h(Y||(Y=G` <a class="rounded-s text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="create_button_text"> </foxy-i18n> </a> `),this.createPageHref):h(U||(U=G` <vaadin-button theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="pagination" key="create_button_text"></foxy-i18n> </vaadin-button> `),this.disabled,(t=>{t.preventDefault(),t.stopPropagation();const e=this.__dialog,i=t.currentTarget;e.header="header_create",e.href="",e.show(i)}))].filter((t=>!!t))}__renderContent(){var t,e,i;const o=this.helperText,n="details"===this.layout,a=this.label;let s;try{const o=new URL(null!==(t=this.first)&&void 0!==t?t:""),n=new URLSearchParams(null!==(e=this.filter)&&void 0!==e?e:"");o.searchParams.set("limit",String(this.limit)),n.forEach(((t,e)=>o.searchParams.set(e,t))),null===(i=this.extendFilter)||void 0===i||i.call(this,o.searchParams),s=o.toString()}catch(t){s=void 0}return h(J||(J=G` <foxy-pagination first="${0}" infer="pagination" class="${0}"> <foxy-collection-page class="${0}" style="gap:1px" infer="card" .related="${0}" .props="${0}" .item="${0}" @update="${0}"> </foxy-collection-page> </foxy-pagination> `),p(s),_({hidden:n&&0===this.__totalItems}),_({"grid grid-cols-1 overflow-hidden":!0,rounded:!n,"mt-s":!n&&(!!a&&"label"!==a||!!o&&"helper_text"!==o)}),this.related,this.itemProps,this.__itemRenderer,(t=>{var e,i;const o=t.currentTarget;this.__totalItems=parseInt(null!==(i=null===(e=o.data)||void 0===e?void 0:e.total_items)&&void 0!==i?i:0)}))}}),customElements.define(w.is,w);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./shared-31e75a4a.js";import"./shared-910d49eb.js";import"./foxy-copy-to-clipboard.js";import{I as e}from"./shared-9a454e09.js";import{x as t}from"./shared-328aa161.js";import{c as r,h as o,s as a}from"./shared-ba5c42c7.js";import{_ as i}from"./shared-8f9014ff.js";import{i as l}from"./shared-53e42a77.js";import{c as s}from"./shared-4e709717.js";let n;function m(e){var t,r,o;const a=null!==(t=null==e?void 0:e.separator)&&void 0!==t?t:"-",i=null!==(r=null==e?void 0:e.charset)&&void 0!==r?r:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l=null!==(o=null==e?void 0:e.length)&&void 0!==o?o:18;let s="";for(let e=0;e<l;e++)a&&e>0&&e%6==0&&(s+=a),s+=i[Math.floor(Math.random()*i.length)];return s}t("vaadin-password-field",r(n||(n=(e=>e)`:host([theme~=summary-item])::before{display:none}:host([theme~=summary-item]) .vaadin-text-field-container{display:grid;grid-template-columns:auto auto;grid-template-rows:repeat(3,min-content);gap:0 var(--lumo-space-m)}:host([theme~=summary-item]) [part=label]{font:normal var(--lumo-font-size-m) var(--lumo-font-family);color:var(--lumo-body-text-color)!important;grid-row:1;-webkit-text-fill-color:var(--lumo-body-text-color)!important}:host([theme~=summary-item]) [part=helper-text]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-secondary-text-color)!important;grid-row:2}:host([theme~=summary-item]) [part=helper-text]::before{display:none}:host([theme~=summary-item]) [part=error-message]{font:normal var(--lumo-font-size-s) var(--lumo-font-family);color:var(--lumo-error-text-color);grid-row:3}:host([theme~=summary-item]) [part=error-message],:host([theme~=summary-item]) [part=helper-text],:host([theme~=summary-item]) [part=label]{line-height:var(--lumo-line-height-xs);grid-column:1;padding:0}:host([theme~=summary-item]) [part=input-field]{grid-column:2;grid-row:1;padding:0;background:0 0;align-self:start;height:1em;--lumo-icon-size-m:1rem}:host([theme~=summary-item]) [part=input-field]::after,:host([theme~=summary-item][readonly]) [part=input-field] slot[name=suffix]{display:none}:host([theme~=summary-item]) [part=value]{line-height:var(--lumo-line-height-xs);text-align:right;min-height:auto;padding:0;margin-right:var(--lumo-space-xs);-webkit-mask-image:none}:host([theme~=summary-item][readonly]) [part=value]{margin-right:0}`)));let d,h,u,p,c=e=>e;customElements.define("foxy-internal-password-control",class extends e{constructor(){super(...arguments),this.generatorOptions=null,this.visibilityToggle=null,this.showGenerator=!1,this.layout=null}static get properties(){return i(i({},super.properties),{},{generatorOptions:{type:Object,attribute:"generator-options"},visibilityToggle:{attribute:"visibility-toggle"},showGenerator:{type:Boolean,attribute:"show-generator"},layout:{}})}renderControl(){var e;return o(d||(d=c` <vaadin-password-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" theme="${0}" class="w-full" ?reveal-button-hidden="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> ${0} ${0} </vaadin-password-field> `),l(this._errorMessage),this.helperText,this.placeholder,this.label,l(null!==(e=this.layout)&&void 0!==e?e:void 0),"copy"===this.visibilityToggle,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=t.value}),this.showGenerator?this.__renderGenerator():"","copy"===this.visibilityToggle?this.__renderCopyButton():"")}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}__renderCopyButton(){return o(h||(h=c` <foxy-copy-to-clipboard layout="icon-inline" infer="" slot="suffix" text="${0}"> </foxy-copy-to-clipboard> `),this._value)}__renderGenerator(){return o(u||(u=c` <div data-testid="generator" class="${0}" slot="suffix" @click="${0}"> ${0} </div> `),s({"w-s h-s flex items-center justify-center cursor-default transition-colors":!0,"text-contrast-60 hover-text-contrast-80":!this.disabled&&!this.readonly,"text-contrast-20":this.disabled||this.readonly}),(()=>{var e,t,r,o;let a,i=!1,l=0;do{a=m(null!==(e=this.generatorOptions)&&void 0!==e?e:void 0),i=null===(o=null===(r=null===(t=this.generatorOptions)||void 0===t?void 0:t.checkStrength)||void 0===r?void 0:r.call(t,a))||void 0===o||o,l++}while(!i&&l<100);if(!i)throw new Error("Failed to generate a strong password.");this._value=a;const s=this.renderRoot.querySelector("vaadin-password-field");null==s||s._setPasswordVisible(!0)}),a(p||(p=c`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.15em; height: 1.15em"><path d="M15.98 1.804a1 1 0 00-1.96 0l-.24 1.192a1 1 0 01-.784.785l-1.192.238a1 1 0 000 1.962l1.192.238a1 1 0 01.785.785l.238 1.192a1 1 0 001.962 0l.238-1.192a1 1 0 01.785-.785l1.192-.238a1 1 0 000-1.962l-1.192-.238a1 1 0 01-.785-.785l-.238-1.192zM6.949 5.684a1 1 0 00-1.898 0l-.683 2.051a1 1 0 01-.633.633l-2.051.683a1 1 0 000 1.898l2.051.684a1 1 0 01.633.632l.683 2.051a1 1 0 001.898 0l.683-2.051a1 1 0 01.633-.633l2.051-.683a1 1 0 000-1.898l-2.051-.683a1 1 0 01-.633-.633L6.95 5.684zM13.949 13.684a1 1 0 00-1.898 0l-.184.551a1 1 0 01-.632.633l-.551.183a1 1 0 000 1.898l.551.183a1 1 0 01.633.633l.183.551a1 1 0 001.898 0l.184-.551a1 1 0 01.632-.633l.551-.183a1 1 0 000-1.898l-.551-.184a1 1 0 01-.633-.632l-.183-.551z" /></svg>`)))}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./shared-be071e3d.js";import"./shared-1fa1abbd.js";import{I as e}from"./shared-9a454e09.js";import{I as t}from"./shared-084e1772.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-form-dialog.js";import"./shared-26b55da2.js";import{_ as s,m as i,F as r}from"./shared-8f9014ff.js";import{h as o,s as l}from"./shared-ba5c42c7.js";import{s as a}from"./shared-53e476fd.js";import{g as n}from"./shared-bab2ea2c.js";import{i as d}from"./shared-53e42a77.js";import{c as h}from"./shared-4e709717.js";import{u}from"./shared-fd8b44e3.js";let c,f=e=>e;let p,y,m,v,x,b,_,g,$=e=>e;customElements.define("foxy-internal-resource-picker-control-form",class extends t{constructor(){super(...arguments),this.selectionProps={}}static get properties(){return s(s({},super.properties),{},{selectionProps:{attribute:!1}})}renderBody(){return o(c||(c=f` <foxy-internal-async-list-control infer="selection" form="foxy-null" hide-delete-button hide-create-button @itemclick="${0}" ...="${0}"> </foxy-internal-async-list-control> `),(e=>{e.preventDefault(),this.edit({selection:e.detail}),this.submit()}),a(this.selectionProps))}}),customElements.define("foxy-internal-resource-picker-control",class extends e{constructor(){super(...arguments),this.getDisplayValueOptions=e=>({resource:e}),this.showCopyIdButton=!1,this.virtualHost=u("internal-resource-picker-control-"),this.getItemUrl=null,this.formProps={},this.filters=[],this.extendFilter=null,this.layout=null,this.first=null,this.item=null,this.form=null,this.__isErrorVisible=!1,this.__getItemRenderer=i((e=>new Function("ctx",`return ctx.html\`\n <${null!=e?e:"foxy-null"}\n related=\${JSON.stringify(ctx.related)}\n parent=\${ctx.parent}\n infer="card"\n href=\${ctx.href}\n ...=\${ctx.spread(ctx.props)}\n >\n </${null!=e?e:"foxy-null"}>\``)))}static get properties(){return s(s({},super.properties),{},{getDisplayValueOptions:{attribute:!1},showCopyIdButton:{type:Boolean,attribute:"show-copy-id-button"},virtualHost:{},getItemUrl:{attribute:!1},formProps:{type:Object},filters:{type:Array},extendFilter:{type:Function,attribute:!1},layout:{},first:{},item:{},form:{},__isErrorVisible:{attribute:!1}})}renderControl(){var e;const t=s(s({},this.formProps),{},{".selectionProps":{".extendFilter":this.extendFilter,".filters":this.filters,".first":this.first,".item":this.item}});return o(p||(p=$` <foxy-form-dialog parent="foxy://${0}/select" header="header" infer="dialog" alert .props="${0}" .form="${0}" @fetch="${0}" @hide="${0}"> </foxy-form-dialog> ${0} `),this.virtualHost,t,null!==(e=this.form)&&void 0!==e?e:"foxy-internal-resource-picker-control-form",this.__handleFetchEvent,(()=>this.__isErrorVisible=!0),"summary-item"===this.layout?this.__renderSummaryItemLayout():this.__renderStandaloneLayout())}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}updated(e){var t,s;super.updated(e),e.has("item")&&(null===(s=(t=this.__getItemRenderer.cache).clear)||void 0===s||s.call(t))}__clear(){this._value="",this.dispatchEvent(new CustomEvent("clear"))}__renderSummaryItemLayout(){const e=this.renderRoot.querySelector("#value");return o(y||(y=$` <div class="leading-xs"> <div class="flex items-center gap-xs"> <div class="text-m text-body whitespace-nowrap flex-1">${0}</div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <div class="truncate min-w-0"> ${0} </div> </button> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <div class="text-xs text-secondary">${0}</div> <div class="text-xs text-error" ?hidden="${0}"> ${0} </div> </div> </div> <foxy-nucleon infer="" href="${0}" id="value" @update="${0}"> </foxy-nucleon> `),this.label,this.t("select"),h({"text-right min-w-0 transition-colors transition-opacity":!0,"rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"cursor-pointer text-body hover-opacity-80":!this.disabled&&!this.readonly,"font-medium":!this.readonly}),this.disabled||this.readonly,(e=>{if(this.disabled||this.readonly)return;const t=e.currentTarget,s=this.renderRoot.querySelector("foxy-form-dialog");s.href="",s.show(t)}),this._value?o(m||(m=$` <foxy-i18n infer="" key="value" .options="${0}"> </foxy-i18n> `),(null==e?void 0:e.data)?this.getDisplayValueOptions(e.data):{context:(null==e?void 0:e.in("fail"))?"fail":"busy"}):this.placeholder,this.t("clear"),h({"rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,this.__clear,l(v||(v=$`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,this.disabled||this.readonly||!this.__isErrorVisible,this._errorMessage,d(this._value||void 0),(()=>this.requestUpdate()))}__renderStandaloneLayout(){var e,t,s,i,r;const l=this.__valueLoader,u="string"==typeof this._value?n(this._value):void 0,c="string"==typeof this._value?null===(e=this.getItemUrl)||void 0===e?void 0:e.call(this,this._value,null!==(t=null==l?void 0:l.data)&&void 0!==t?t:null):void 0;return o(x||(x=$` <div class="block group"> <div class="${0}"> <span class="mr-auto text-l">${0}</span> ${0} ${0} ${0} </div> <div class="text-secondary text-s" ?hidden="${0}">${0}</div> <button class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" ?disabled="${0}" @click="${0}"> <div class="${0}"> <foxy-nucleon class="block" infer="" href="${0}" id="valueLoader" @update="${0}"> ${0} </foxy-nucleon> </div> </button> <div class="mt-xs text-xs leading-xs text-error" ?hidden="${0}"> ${0} </div> </div> `),h({"flex items-center gap-s transition-colors font-medium":!0,"text-disabled":this.disabled}),this.label,c?o(b||(b=$` <a class="text-body rounded transition-opacity hover-opacity-90 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="view"></foxy-i18n> </a> `),c):"",this.showCopyIdButton&&null!==u?o(_||(_=$` <foxy-copy-to-clipboard layout="text" theme="contrast tertiary-inline" infer="copy-id" text="${0}"> </foxy-copy-to-clipboard> `),u):"",this.readonly||!this._value?"":o(g||(g=$` <vaadin-button theme="error tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="clear"></foxy-i18n> </vaadin-button> `),this.disabled,this.__clear),!this.helperText,this.helperText,h({"block w-full bg-contrast-5 rounded text-left transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer hover-bg-contrast-10":!this.disabled&&!this.readonly,"cursor-default":this.disabled||this.readonly,"mt-s":!!this.label||!!this.helperText}),this.disabled||this.readonly,(e=>{const t=e.currentTarget,s=this.renderRoot.querySelector("foxy-form-dialog");s.href="",s.show(t)}),h({"transition-opacity":!0,"opacity-50":this.disabled}),d(this._value||void 0),(()=>this.requestUpdate()),this.__getItemRenderer(this.item)({html:o,data:null!==(s=null==l?void 0:l.data)&&void 0!==s?s:null,href:this._value||"",related:[],parent:"",props:{},spread:a,simplifyNsLoading:this.simplifyNsLoading,disabled:this.disabled,disabledControls:this.disabledControls,readonly:this.readonly,readonlyControls:this.readonlyControls,hidden:this.hidden,hiddenControls:this.hiddenControls,templates:this.templates,previous:null,next:null,group:null!==(r=null===(i=this.nucleon)||void 0===i?void 0:i.group)&&void 0!==r?r:"",lang:this.lang,ns:this.ns}),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}__handleFetchEvent(e){if(!(e instanceof r))return;if(e.defaultPrevented)return;const{url:t,method:s}=e.request;return t===`foxy://${this.virtualHost}/select`&&"POST"===s?e.respondWith(this.__handleSelect(e.request)):t===`foxy://${this.virtualHost}/empty`&&"GET"===s?e.respondWith(this.__handleEmpty()):void 0}async __handleSelect(e){const t=await e.clone().json();return this._value=t.selection,new Response(JSON.stringify({_links:{self:{href:`foxy://${this.virtualHost}/empty`}},message:"Resource selected."}))}async __handleEmpty(){return new Response(JSON.stringify({_links:{self:{href:`foxy://${this.virtualHost}/empty`}},message:"Resource selected."}))}get __valueLoader(){return this.renderRoot.querySelector("#valueLoader")}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-591ee1bf.js";import"./shared-26b55da2.js";import{_ as e}from"./shared-8f9014ff.js";import{R as l,T as a,a as n}from"./shared-328aa161.js";import{C as t}from"./shared-41c9c53f.js";import{s as r,h as o,c as s,L as i}from"./shared-ba5c42c7.js";import{I as u}from"./shared-930e68b7.js";import{O as d,T as v}from"./shared-8874ec69.js";import{o as c}from"./shared-63c32024.js";import{c as p}from"./shared-4e709717.js";import{r as h}from"./shared-5fd5805c.js";import{i as f}from"./shared-53e42a77.js";import{s as b}from"./shared-2061be9a.js";import{p as g}from"./shared-f0fa0a88.js";let
|
|
1
|
+
import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-591ee1bf.js";import"./shared-26b55da2.js";import{_ as e}from"./shared-8f9014ff.js";import{R as l,T as a,a as n}from"./shared-328aa161.js";import{C as t}from"./shared-41c9c53f.js";import{s as r,h as o,c as s,L as i}from"./shared-ba5c42c7.js";import{I as u}from"./shared-930e68b7.js";import{O as d,T as v}from"./shared-8874ec69.js";import{o as c}from"./shared-63c32024.js";import{c as p}from"./shared-4e709717.js";import{r as h}from"./shared-5fd5805c.js";import{i as f}from"./shared-53e42a77.js";import{s as b}from"./shared-2061be9a.js";import{p as g}from"./shared-f0fa0a88.js";let y;const m=r(y||(y=(e=>e)`
|
|
2
2
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M26.4 14.7399C26.4 15.2922 25.9523 15.7399 25.4 15.7399H10.6C10.0477 15.7399 9.60001 15.2922 9.60001 14.7399V14.2C9.60001 13.6477 10.0477 13.2 10.6 13.2H25.4C25.9523 13.2 26.4 13.6477 26.4 14.2V14.7399ZM26.4 21.8C26.4 22.3523 25.9523 22.8 25.4 22.8H10.6C10.0477 22.8 9.60001 22.3523 9.60001 21.8V21.2601C9.60001 20.7078 10.0477 20.2601 10.6 20.2601H25.4C25.9523 20.2601 26.4 20.7078 26.4 21.2601V21.8Z" class="fill-current"/>
|
|
4
4
|
</svg>
|
|
@@ -6,12 +6,12 @@ import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-591ee1
|
|
|
6
6
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
7
|
<path d="M12.8656 14.6695C12.3425 14.4581 12 13.9503 12 13.386C12 12.3748 13.0489 11.7048 13.9663 12.1299L23.8937 16.7295C24.5323 17.0254 24.941 17.6652 24.941 18.369C24.941 19.0735 24.5316 19.7137 23.8921 20.0092L13.971 24.5938C13.0509 25.019 12 24.347 12 23.3334C12 22.7709 12.3394 22.264 12.8594 22.0496L21.341 18.3046L12.8656 14.6695Z" class="fill-current"/>
|
|
8
8
|
</svg>
|
|
9
|
-
`));let C;const
|
|
9
|
+
`));let C;const _=r(C||(C=(e=>e)`
|
|
10
10
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
11
|
<path d="M12.5 9.8C11.0088 9.8 9.8 11.0088 9.8 12.5V23.5C9.8 24.9912 11.0088 26.2 12.5 26.2H14C14.6627 26.2 15.2 25.6627 15.2 25C15.2 24.3373 14.6627 23.8 14 23.8H13.5C12.782 23.8 12.2 23.218 12.2 22.5V13.5C12.2 12.782 12.782 12.2 13.5 12.2H14C14.6627 12.2 15.2 11.6627 15.2 11C15.2 10.3373 14.6627 9.8 14 9.8H12.5Z" class="fill-current"/>
|
|
12
12
|
<path d="M22 9.8C21.3373 9.8 20.8 10.3373 20.8 11C20.8 11.6627 21.3373 12.2 22 12.2H22.5C23.218 12.2 23.8 12.782 23.8 13.5V22.5C23.8 23.218 23.218 23.8 22.5 23.8H22C21.3373 23.8 20.8 24.3373 20.8 25C20.8 25.6627 21.3373 26.2 22 26.2H23.5C24.9912 26.2 26.2 24.9912 26.2 23.5V12.5C26.2 11.0088 24.9912 9.8 23.5 9.8H22Z" class="fill-current"/>
|
|
13
13
|
</svg>
|
|
14
|
-
`));let
|
|
14
|
+
`));let w;const L=r(w||(w=(e=>e)`
|
|
15
15
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
16
16
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.05 23.58L20.04 23.59L17.64 21.19L18.7 20.13L20.05 21.48L22.54 19L23.6 20.06L20.06 23.6L20.05 23.58ZM18 8C12.5 8 8 12.5 8 18C8 23.5 12.5 28 18 28C23.5 28 28 23.5 28 18C28 12.5 23.5 8 18 8ZM13.34 12.28L14.75 13.69L16.16 12.28L17.22 13.34L15.81 14.75L17.22 16.16L16.16 17.22L14.75 15.81L13.34 17.22L12.28 16.16L13.69 14.75L12.28 13.34L13.34 12.28ZM18 26C15.8 26 13.8 25.1 12.3 23.7L23.7 12.3C25.1 13.8 26 15.8 26 18C26 22.4 22.4 26 18 26Z" class="fill-current"/>
|
|
17
17
|
</svg>
|
|
@@ -19,12 +19,12 @@ import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-591ee1
|
|
|
19
19
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
20
20
|
<path d="M22.8754 22.054C23.3985 22.2655 23.741 22.7733 23.741 23.3375C23.741 24.3487 22.6922 25.0187 21.7747 24.5936L11.8473 19.994C11.2087 19.6981 10.8 19.0583 10.8 18.3545C10.8 17.65 11.2094 17.0098 11.8489 16.7143L21.7701 12.1297C22.6902 11.7045 23.741 12.3765 23.741 13.3902C23.741 13.9526 23.4017 14.4596 22.8816 14.6739L14.4 18.4189L22.8754 22.054Z" class="fill-current"/>
|
|
21
21
|
</svg>
|
|
22
|
-
`));let k;const
|
|
22
|
+
`));let k;const A=r(k||(k=(e=>e)`
|
|
23
23
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
24
24
|
<path d="M22.8754 19.654C23.3985 19.8655 23.741 20.3733 23.741 20.9375C23.741 21.9487 22.6922 22.6187 21.7747 22.1936L11.8473 17.594C11.2087 17.2981 10.8 16.6584 10.8 15.9545C10.8 15.25 11.2094 14.6098 11.8489 14.3143L21.7701 9.72971C22.6902 9.30453 23.741 9.97655 23.741 10.9902C23.741 11.5527 23.4017 12.0596 22.8816 12.2739L14.4 16.0189L22.8754 19.654Z" class="fill-current"/>
|
|
25
25
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.9169 20.9941C11.2134 20.3281 11.9937 20.0286 12.6597 20.3251L22.8548 24.8643C23.5208 25.1608 23.8203 25.9411 23.5238 26.6071C23.2273 27.2731 22.447 27.5726 21.781 27.2761L11.5859 22.7369C10.9199 22.4404 10.6204 21.6601 10.9169 20.9941Z" class="fill-current"/>
|
|
26
26
|
</svg>
|
|
27
|
-
`));let
|
|
27
|
+
`));let O;const S=r(O||(O=(e=>e)`
|
|
28
28
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29
29
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.0049 7.11C24.6649 7.49107 24.8911 8.33507 24.51 8.99511L13.1621 28.6503C12.781 29.3103 11.937 29.5365 11.277 29.1554C10.6169 28.7743 10.3908 27.9303 10.7719 27.2703L22.1198 7.61511C22.5009 6.95507 23.3448 6.72892 24.0049 7.11Z" class="fill-current"/>
|
|
30
30
|
<path d="M17.5097 13.2H10.8C10.1373 13.2 9.60001 13.7373 9.60001 14.4V14.5399C9.60001 15.2026 10.1373 15.7399 10.8 15.7399H16.0433L17.5097 13.2Z" class="fill-current"/>
|
|
@@ -32,9 +32,9 @@ import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-591ee1
|
|
|
32
32
|
<path d="M17.9254 22.8H25.2C25.8627 22.8 26.4 22.2627 26.4 21.6V21.4601C26.4 20.7973 25.8627 20.2601 25.2 20.2601H19.3918L17.9254 22.8Z" class="fill-current"/>
|
|
33
33
|
<path d="M22.0015 15.7399H25.2C25.8627 15.7399 26.4 15.2026 26.4 14.5399V14.4C26.4 13.7373 25.8627 13.2 25.2 13.2H23.468L22.0015 15.7399Z" class="fill-current"/>
|
|
34
34
|
</svg>
|
|
35
|
-
`));let
|
|
35
|
+
`));let H;const D=r(H||(H=(e=>e)`
|
|
36
36
|
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
37
37
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C12.48 8 8 12.48 8 18C8 23.52 12.48 28 18 28C23.52 28 28 23.52 28 18C28 12.48 23.52 8 18 8ZM18 26C13.59 26 10 22.41 10 18C10 13.59 13.59 10 18 10C22.41 10 26 13.59 26 18C26 22.41 22.41 26 18 26Z" class="fill-current"/>
|
|
38
38
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.49 17.38C19.92 16.16 19.66 14.74 18.68 13.76C17.57 12.65 15.89 12.46 14.58 13.17L16.93 15.52L15.52 16.93L13.17 14.58C12.46 15.9 12.65 17.57 13.76 18.68C14.74 19.66 16.16 19.92 17.38 19.49L20.79 22.9C20.99 23.1 21.3 23.1 21.5 22.9L22.9 21.5C23.1 21.3 23.1 20.99 22.9 20.79L19.49 17.38Z" class="fill-current"/>
|
|
39
39
|
</svg>
|
|
40
|
-
`));let j,Z=e=>e;let I,T,N=e=>e;function z(e){return o(I||(I=N` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.t(e.label),p({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,e.disabled||e.readonly,(e=>"|"===e.key&&e.preventDefault()),(l=>{const a=l.currentTarget;e.onChange(a.value.replace(/\|/gi,""))}),p({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.label),e.disabled||e.readonly?"":o(T||(T=N` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}let B,V,E=e=>e;function G(l){var a,n;const{isFullSize:t,isNested:r,disableOr:s,readonly:i,disabled:u,rule:v}=l,{t:h,onConvert:f,onDelete:b,onChange:g}=l;return o(B||(B=E` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="${0}"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base">${0}</div> <div class="bg-base"> ${0} </div> </div> </div> </div> <div class="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:remove-circle-outline"> </iron-icon> </button> <button aria-label="${0}" class="${0}" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:add-circle-outline"> </iron-icon> </button> </div> </div> `),h("query_builder_rule"),p({"flex-1 bg-base rounded overflow-hidden border":!0,"border-contrast-10":!r&&!i,"border-contrast-50":!!r||i,"border-dashed":i,"border-solid":!i}),p({"text-tertiary":!i&&!u,"text-disabled":i||u,"w-m h-m":!0}),D,v.path&&v.name?o(V||(V=E` <div class="bg-contrast-10 grid gap-1px grid-cols-1 sm-grid-cols-2"> <div class="bg-base"> ${0} </div> <div class="bg-base"> ${0} </div> </div> `),z(e(e({},l),{},{value:v.path,label:"field",onChange:e=>{g({operator:null,value:"",path:e})}})),z(e(e({},l),{},{value:null!==(a=v.name)&&void 0!==a?a:"",label:"name",onChange:l=>g(e(e({},v),{},{name:l}))}))):z(e(e({},l),{},{value:v.path,label:"field",onChange:e=>g({operator:null,value:"",path:e})})),function(l){const{rule:a,operators:n,disabled:t,readonly:r,t:s,onChange:i}=l,{operator:u,value:v,path:h,name:f}=a,b={[d.GreaterThan]:$,[d.GreaterThanOrEqual]:c,[d.In]:w,[d.IsDefined]:L,[d.LessThan]:q,[d.LessThanOrEqual]:O,[d.Not]:H},g=Object.values(d).filter((e=>n.includes(e)&&(!!f||e!==d.IsDefined))),m=t||r||!g.length||!h;return o(j||(j=Z` <button title="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <div aria-hidden="true">${0}</div> </button> `),s(`operator_${null!=u?u:"equal"}`),p({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-body hover-bg-contrast-5":!m&&g.length>1,"cursor-default text-tertiary":!m&&g.length<=1,"text-disabled cursor-default":m}),m||g.length<=1,(()=>{var l;const n=u?g.indexOf(u):-1,t=null!==(l=g[n+1])&&void 0!==l?l:null;i(e(e({},a),{},{operator:t,value:v}))}),u?b[u]:y)}(l),z(e(e({},l),{},{disabled:u||!v.path,value:null!==(n=v.value)&&void 0!==n?n:"",label:"value",onChange:l=>g(e(e({},v),{},{value:l}))})),p({"-mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center":!0,"border-t border-b border-transparent divide-y divide-transparent":!0,hidden:!!t||i,flex:!t}),h("delete"),p({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!u,"cursor-default text-disabled":u,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!v.path}),u||i||!v.path,b,h("add_or_clause"),p({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-success hover-bg-contrast-5":!u,"cursor-default text-disabled":u,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!v.path||!!r||s}),u||i||!v.path||!!r||s,s,f)}let P,R,F,U,W=e=>e;function Q(l){const a=l.rules.some((e=>Array.isArray(e))),n=o(P||(P=W`<div class="${0}"></div>`),a?"h-xs":"mt-s"),t=o(R||(R=W` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-30"> ${0} </div> <div class="flex-1 border-t border-contrast-20"></div> <div class="w-m ml-s flex-shrink-0"></div> <div class="hidden sm-block w-m flex-shrink-0"></div> </div> `),l.t("or"));return o(F||(F=W` <div aria-label="${0}"> ${0} </div> `),l.t("query_builder_group"),h([...l.rules,null],((e,l)=>String(l)),((a,r)=>{const s=r>0?l.isNested?t:n:"";return null===a?[s,G(e(e({},l),{},{rule:{path:"",operator:null,value:""},isFullSize:!l.isNested&&0===l.rules.length,onChange:e=>l.onChange([...l.rules,e])}))]:Array.isArray(a)?[s,o(U||(U=W` <div class="bg-contrast-10 rounded-t-l rounded-b-l p-s -m-s"> ${0} </div> `),Q(e(e({},l),{},{rules:a,isNested:!0,onChange:e=>{const a=[...l.rules],n=e;a[r]=e.length>1?n:n[0],l.onChange(a)}})))]:[s,G(e(e({},l),{},{rule:a,onChange:e=>{const a=[...l.rules];a[r]=e,l.onChange(a)},onDelete:()=>{const e=l.rules.filter(((e,l)=>l!==r));l.onChange(e)},onConvert:()=>{const n=[...l.rules];n[r]=[a,e(e({},a),{},{operator:null,value:""})],l.onChange(n)}}))]})))}let J,K,X,Y,ee,le,ae=e=>e;function ne(e){const{t:l,disabled:a,readonly:n,current:t,options:s,onChange:i}=e;return o(J||(J=ae` <div class="${0}"> ${0} ${0} </div> `),p({"relative flex items-center gap-xs leading-m px-xs -m-xs rounded-s transition-colors":!0,"focus-within-ring-2 focus-within-ring-primary-50":!0,"text-contrast":!a&&!n,"hover-text-contrast-80":!a&&!n,"text-disabled":a,"text-contrast-80":n,"font-medium":!n}),"label"in t?o(K||(K=ae`<foxy-i18n infer="" key="${0}"></foxy-i18n>`),t.label):o(X||(X=ae`<span>${0}</span>`),t.rawLabel),n?"":o(Y||(Y=ae` ${0} <select class="${0}" ?disabled="${0}" @change="${0}"> ${0} </select> `),r(ee||(ee=ae`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="flex-shrink-0" style="width: 1em; height: 1em; transform: scale(1.25)"><path fill-rule="evenodd" d="M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z" clip-rule="evenodd" /></svg>`)),p({"absolute inset-0 opacity-0 focus-outline-none":!0,"cursor-pointer":!a,"cursor-default":a}),a,(e=>i(e.target.value)),s.map((e=>o(le||(le=ae` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.value,e.value===t.value,"label"in e?l(e.label):e.rawLabel)))))}let te,re,oe,se=e=>e;function ie(e){const{disabled:l,readonly:a,layout:n,label:t,value:r,type:s,min:i,t:u,onChange:d}=e;return o(te||(te=se` <label class="flex-shrink-0 flex items-center gap-s relative" style="min-width:${0}rem;max-width:50%"> <foxy-i18n infer="" class="${0}" key="${0}"> </foxy-i18n> <span class="${0}" ?hidden="${0}">${0}</span> ${0} </label> `),"number"===s?"4":"date"===s?"6":"8",p({"sr-only":"fixed"!==n}),t,p({"relative block whitespace-pre text-m":!0,"px-s py-xs -my-xs font-medium opacity-0":!a,"text-contrast-80":a}),"auto-grow"!==n&&!a,r||o(re||(re=se`<foxy-i18n infer="" key="value_empty"></foxy-i18n>`)),a?"":o(oe||(oe=se` <input placeholder="${0}" class="${0}" ?disabled="${0}" type="${0}" min="${0}" .value="${0}" @keydown="${0}" @input="${0}"> `),u("value_empty"),p({"appearance-none transition-all text-body text-m font-medium rounded-s":!0,"bg-base px-s py-xs -my-xs":!0,"opacity-50":l,"absolute inset-0":"auto-grow"===n,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0}),l,f(s),f(i),r,(e=>"|"===e.key&&e.preventDefault()),(e=>{const l=e.currentTarget;d(l.value.replace(/\|/gi,""))})))}let ue,de=e=>e;const ve=e=>{var l;const{operator:a,value:n,name:t}=null!==(l=e.rule)&&void 0!==l?l:{},{disabled:r,readonly:s,t:i}=e,u=d.Not,v=p({"text-disabled":r,"text-contrast-80":s}),c=null===a?"equal":a===u?u:null;return o(ue||(ue=de` <foxy-i18n class="${0}" infer="" key="name"></foxy-i18n> ${0} <foxy-i18n class="${0}" infer="" key="value"></foxy-i18n> ${0} ${0} `),v,ie({layout:"auto-grow",value:t||"",label:"name",type:"text",disabled:r,readonly:s,t:i,onChange:l=>{if(!l)return e.onChange(null);n?e.onChange({name:l}):e.onChange({name:l,operator:d.IsDefined,value:"true"})}}),v,ne({current:{label:c?`operator_${c}`:"value_any",value:null!=c?c:"any"},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:u}],disabled:r,readonly:s,t:i,onChange:l=>{if("any"!==l)return e.onChange({operator:"equal"===l?null:l,value:a===d.IsDefined?"":null!=n?n:"",name:null!=t?t:""});e.onChange(t?{operator:d.IsDefined,value:"true"}:null)}}),void 0===n||a===d.IsDefined?"":ie({layout:"auto-grow",label:"value",value:n||"",type:"text",disabled:r,readonly:s,t:i,onChange:l=>e.onChange({value:l})}))},ce=l=>{var a;const n=[{label:"value_any",value:"any"},{label:`${l.option.label}_true`,value:"true"},{label:`${l.option.label}_false`,value:"false"}];return ne(e(e({},l),{},{onChange:e=>l.onChange("any"===e?null:{value:e}),current:null!==(a=n.find((e=>{var a;return e.value===(null===(a=l.rule)||void 0===a?void 0:a.value)})))&&void 0!==a?a:n[0],options:n}))};let pe,he,fe=e=>e;const be=e=>{const{disabled:l,readonly:a,option:n,rule:t,t:r,onChange:s}=e,{min:i,label:u}=n,v=null==t?void 0:t.operator,c=null==t?void 0:t.value.includes(".."),p=null!=v?v:c?"range":"equal",h=void 0===v?"value_any":"range"===p?"range":`operator_${p}`;return o(pe||(pe=fe` ${0} ${0} `),ne({disabled:l,readonly:a,current:{label:h,value:void 0===v?"any":p},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not},{label:"operator_lessthanorequal",value:d.LessThanOrEqual},{label:"operator_lessthan",value:d.LessThan},{label:"operator_greaterthanorequal",value:d.GreaterThanOrEqual},{label:"operator_greaterthan",value:d.GreaterThan},{label:"range",value:"range"}],t:r,onChange:e=>{var l,a,r,o;if("any"===e)return s(null);if("range"===e){let e=parseFloat(null!==(l=null==t?void 0:t.value)&&void 0!==l?l:"");return isNaN(e)&&(e=0),s({operator:null,value:`${e}..${e+10}`})}return s({operator:"equal"===e?null:e,value:null!==(o=null!==(a=null==t?void 0:t.value)&&void 0!==a?a:null===(r=n.min)||void 0===r?void 0:r.toString())&&void 0!==o?o:"0"})}}),void 0===(null==t?void 0:t.value)?"":c?o(he||(he=fe` <foxy-i18n infer="" key="range_from"></foxy-i18n> ${0} <foxy-i18n infer="" key="range_to"></foxy-i18n> ${0} `),ie({disabled:l,readonly:a,layout:"auto-grow",label:"range_from",value:null==t?void 0:t.value.split("..")[0],type:"number",min:i,t:r,onChange:e=>{const l=null==t?void 0:t.value.split("..")[1];s({value:`${e||"0"}..${l}`})}}),ie({disabled:l,readonly:a,layout:"auto-grow",label:"range_to",value:null==t?void 0:t.value.split("..")[1],type:"number",min:i,t:r,onChange:e=>{const l=null==t?void 0:t.value.split("..")[0];s({value:`${l}..${e||"0"}`})}})):ie({disabled:l,readonly:a,layout:"auto-grow",label:u,value:(null==t?void 0:t.value)||"",type:"number",min:i,t:r,onChange:e=>s({value:e})}))};let ge,me=e=>e;const ye=e=>{const{disabled:l,readonly:a,option:n,rule:t,t:r,onChange:s}=e,{operator:i}=null!=t?t:{},{label:u}=n;return o(ge||(ge=me` ${0} ${0} `),ne({disabled:l,readonly:a,current:{label:void 0===i?"value_any":`operator_${null!=i?i:"equal"}`,value:void 0===i?"any":null!=i?i:"equal"},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not}],t:r,onChange:e=>{var l;return s("any"===e?null:{operator:"equal"===e?null:e,value:null!==(l=null==t?void 0:t.value)&&void 0!==l?l:""})}}),void 0===(null==t?void 0:t.value)?"":ie({disabled:l,readonly:a,layout:"auto-grow",label:u,value:(null==t?void 0:t.value)||"",t:r,onChange:e=>s({value:e})}))};let xe,$e,Ce=e=>e;const we=e=>{var l;const{operator:a,value:n}=null!==(l=e.rule)&&void 0!==l?l:{},{min:t,label:r}=e.option,{disabled:s,readonly:i,t:u,onChange:v}=e,c=null==n?void 0:n.includes(".."),p=null!=a?a:c?"range":"equal",h=void 0===a?"value_any":"range"===p?"range":`operator_${p}`;return o(xe||(xe=Ce` ${0} ${0} `),ne({disabled:s,readonly:i,t:u,current:{label:h,value:void 0===a?"any":p},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not},{label:"operator_lessthanorequal",value:d.LessThanOrEqual},{label:"operator_lessthan",value:d.LessThan},{label:"operator_greaterthanorequal",value:d.GreaterThanOrEqual},{label:"operator_greaterthan",value:d.GreaterThan},{label:"range",value:"range"}],onChange:e=>{if("any"===e)return v(null);if("range"===e){const e=new Date(null!=n?n:(new Date).toISOString()),l=new Date(e);e.setMonth(e.getMonth()-1),e.setHours(0,0,0,0),l.setHours(23,59,59,999);const a=e.toISOString(),t=l.toISOString();return v({operator:null,value:`${a}..${t}`})}return v({operator:"equal"===e?null:e,value:null!=n?n:(new Date).toISOString()})}}),void 0===n?"":c?o($e||($e=Ce` ${0} ${0} `),ie({disabled:s,readonly:i,layout:"fixed",label:"range_from",value:b(new Date(n.split("..")[0])),type:"date",min:t,t:u,onChange:e=>{var l,a;const t=null!==(l=g(e))&&void 0!==l?l:new Date,r=new Date(null!==(a=n.split("..")[1])&&void 0!==a?a:Date.now());t.setHours(0,0,0,0),r.setHours(23,59,59,999),v({value:`${t.toISOString()}..${r.toISOString()}`})}}),ie({disabled:s,readonly:i,layout:"fixed",label:"range_to",value:b(new Date(n.split("..")[1])),type:"date",min:t,t:u,onChange:e=>{var l,a;const t=new Date(null!==(l=n.split("..")[0])&&void 0!==l?l:Date.now()),r=null!==(a=g(e))&&void 0!==a?a:new Date;t.setHours(0,0,0,0),r.setHours(23,59,59,999),v({value:`${t.toISOString()}..${r.toISOString()}`})}})):ie({disabled:s,readonly:i,label:r,value:b(new Date(null!=n?n:Date.now())),type:"date",min:t,t:u,onChange:e=>{var l;v({value:(null!==(l=g(e))&&void 0!==l?l:new Date).toISOString()})}}))};let _e,Le=e=>e;const Me=e=>{const{disabled:l,readonly:a,option:n,rule:t,t:r,onChange:s}=e,{list:i}=n,u=null==i?void 0:i.find((e=>e.value===(null==t?void 0:t.value))),v=null==t?void 0:t.operator;return o(_e||(_e=Le` ${0} ${0} `),ne({disabled:l,readonly:a,current:{label:void 0===v?"value_any":`operator_${null!=v?v:"equal"}`,value:void 0===v?"any":null!=v?v:"equal"},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not}],t:r,onChange:e=>{var l,a,n;return s("any"===e?null:{operator:"equal"===e?null:e,value:null!==(n=null!==(l=null==t?void 0:t.value)&&void 0!==l?l:null===(a=null==i?void 0:i[0])||void 0===a?void 0:a.value)&&void 0!==n?n:""})}}),void 0===(null==t?void 0:t.value)?"":ne({disabled:l,readonly:a,current:null!=u?u:{label:"value_any",value:""},options:null!=i?i:[],t:r,onChange:e=>s({value:e})}))};let qe,ke,Oe=e=>e;function Se(e){const l=new Set,a=e=>{let a;if("string"==typeof e.name)a=e.path;else{const l=e.path.lastIndexOf(":");if(-1===l)return;a=e.path.substring(0,l)}a.length>0&&l.add(a)};for(const l of e)if(Array.isArray(l))for(const e of l)a(e);else a(l);return Array.from(l).join()}function He(e){let l=e.path;return e.name&&(l+=`:name[${e.name}]`),e.operator&&(l+=`:${e.operator}`),[l,e.value]}function Ae(e,l=!1){const a=new URLSearchParams;for(const l of e)if(Array.isArray(l)){const[e,...n]=l.map(He);if(e&&e[0]){const l=[e[1],...n.map((e=>e.join("=")))];a.append(e[0],l.join("|"))}}else{const[e,n]=He(l);e&&a.append(e,n)}if(!l){const l=Se(e);l?a.set("zoom",l):a.delete("zoom")}return a.toString()}let De;const je=s(De||(De=(e=>e)`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input{-moz-appearance:textfield}foxy-internal-summary-control[layout=details][count]:not([open]){--lumo-contrast-5pct:var(--lumo-primary-color-10pct);color:var(--lumo-primary-text-color)}`));function Ze(e,l){var a;const n=null!==(a=Object.values(d).find((l=>e.endsWith(`:${l}`))))&&void 0!==a?a:null;let t,r=e.substring(0,n?e.lastIndexOf(":"):void 0);const o=e.lastIndexOf("[");return r.endsWith("]")&&-1!==o&&(t=r.substring(o+1,r.length-1),r=r.substring(0,o),r.endsWith(":name")&&(r=r.substring(0,r.length-5))),{name:t,path:r,value:l,operator:n}}function Ie(e){const l=new URLSearchParams(e),a=[];for(const[e,n]of l.entries())n.includes("|")?a.push(n.split("|").map(((l,a)=>0===a?Ze(e,l):Ze(...l.split("="))))):a.push(Ze(e,n));return a}let Te,Ne,ze=e=>e;const Be=t(l(a(n(u(i),"query-builder"))));class Ve extends Be{constructor(){super(...arguments),this.reservedPaths=["zoom","limit","offset","order","fields"],this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(d),this.docsHref=null,this.options=null,this.value=null,this.__isAdvancedMode=!1}static zoom(e){return Se(Ie(e))}static get properties(){return e(e({},super.properties),{},{reservedPaths:{type:Array,attribute:"reserved-paths"},disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array},docsHref:{attribute:"docs-href"},options:{type:Array},value:{},__isAdvancedMode:{attribute:!1}})}static get styles(){return[super.styles,je]}render(){var l,a,n,t,r,s;const i=this.__isSimpleModeSupported,u=Ie(null!==(l=this.value)&&void 0!==l?l:""),d=null!==(a=this.operators)&&void 0!==a?a:[],c=null!==(n=this.options)&&void 0!==n?n:[],h=this.t.bind(this),b=e=>{this.value=Ae(e,this.disableZoom),this.dispatchEvent(new Ve.ChangeEvent("change"))};return i||this.__isAdvancedMode||(this.__isAdvancedMode=!0),o(Te||(Te=ze` <div class="space-y-m"> <div class="grid grid-cols-2 gap-xs p-xs bg-contrast-5 rounded" ?hidden="${0}"> <label class="${0}"> <foxy-i18n infer="" key="mode_simple${0}"> </foxy-i18n> <input class="sr-only" type="radio" name="mode" ?disabled="${0}" ?checked="${0}" @change="${0}"> </label> <label class="${0}"> <foxy-i18n infer="" key="mode_advanced"></foxy-i18n> <input class="sr-only" type="radio" name="mode" ?checked="${0}" @change="${0}"> </label> </div> ${0} </div> `),!(null===(t=this.options)||void 0===t?void 0:t.length),p({"p-xs rounded-s text-center font-medium transition-colors":!0,"bg-base ring-1 ring-contrast-5":!this.__isAdvancedMode&&i,"hover-bg-contrast-5":this.__isAdvancedMode&&i,"focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50":!0,"cursor-pointer":i,"text-disabled":!i}),i?"":"_unsupported",!i,!this.__isAdvancedMode,(()=>this.__isAdvancedMode=!1),p({"p-xs rounded-s text-center font-medium cursor-pointer transition-colors":!0,"bg-base ring-1 ring-contrast-5":this.__isAdvancedMode,"hover-bg-contrast-5":!this.__isAdvancedMode,"focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50":!0}),this.__isAdvancedMode,(()=>this.__isAdvancedMode=!0),this.__isAdvancedMode||!i?o(Ne||(Ne=ze` <p class="leading-s text-tertiary" ?hidden="${0}"> <foxy-i18n infer="" key="advanced_mode_notice"></foxy-i18n> <a target="_blank" class="cursor-pointer rounded-s text-secondary font-medium hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}" rel="nofollow noreferrer noopener"> <foxy-i18n infer="" key="api_reference_link"></foxy-i18n> </a> </p> ${0} `),null===this.docsHref,f(null!==(r=this.docsHref)&&void 0!==r?r:void 0),Q({disableOr:this.disableOr,disabled:this.disabled,readonly:this.readonly,rules:u,operators:d,onChange:b,options:c,t:h})):null===(s=this.__simpleModeOptions)||void 0===s?void 0:s.map((l=>function(l){var a;const{options:n,layout:t,rules:r,name:s,disabled:i,readonly:u,t:d,onChange:c}=l,h=n.filter((e=>r.find((l=>l.path===e.path)))),b=r.find((e=>"order"===e.path)),g=null===(a=null==b?void 0:b.value)||void 0===a?void 0:a.split(",").map((e=>{const[l,a="asc"]=decodeURIComponent(e).split(" ");return{path:l.trim(),order:a.trim()}}));return o(qe||(qe=Oe` <foxy-internal-summary-control aria-label="${0}" helper-text="" layout="${0}" label="${0}" count="${0}" infer=""> ${0} </foxy-internal-summary-control> `),l.t("query_builder_group"),f(t),t&&s?d(s):"",f(h.length||void 0),n.map((l=>{var a;const{type:n,label:t,list:s,path:h}=l,f={[v.Attribute]:ve,[v.Boolean]:ce,[v.String]:ye,[v.Number]:be,[v.Date]:we,[v.Any]:ye},b=s?Me:f[n],m=null===(a=null==g?void 0:g.find((e=>e.path===h)))||void 0===a?void 0:a.order,y=r.find((e=>e.path===h)),x=!!y||!!m;return o(ke||(ke=Oe` <div aria-label="${0}" class="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> <span class="transform scale-150 mr-auto ${0}">•</span> ${0} ${0} </div> `),d("query_builder_rule"),p({"flex flex-wrap items-center justify-end gap-s":!0,"bg-primary-10 text-primary":x}),t,x?"":"opacity-0",b({disabled:i,readonly:u,option:l,rule:y,t:d,onChange:l=>{if(l&&y)return Object.assign(y,l),c(r);if(l){const a={path:h,value:"",operator:null};return c([...r,e(e({},a),l)])}return c(r.filter((e=>e.path!==h)))}}),n===v.Date||n===v.Number?ne({disabled:i,readonly:u,t:d,current:{label:`order_${null!=m?m:"none"}${m?`_${n}`:""}`,value:null!=m?m:"none"},options:[{label:"order_none",value:"none"},{label:`order_asc_${n}`,value:"asc"},{label:`order_desc_${n}`,value:"desc"}],onChange:e=>{const l=(null!=g?g:[]).filter((e=>e.path!==h)).concat([{path:h,order:e}]).filter((e=>"none"!==e.order)).map((e=>`${e.path} ${e.order}`)).join(),a=r.filter((e=>"order"!==e.path));l&&a.push({path:"order",value:l,operator:null}),c(a)}}):"")})))}(e(e({},l),{},{disabled:this.disabled,readonly:this.readonly,rules:u,onChange:b,t:h})))))}get __isSimpleModeSupported(){var e;if(null===this.options)return!1;if(0===this.options.length)return!1;const l=Ie(null!==(e=this.value)&&void 0!==e?e:"");return 0===l.length||l.every((e=>{var l;return!Array.isArray(e)&&(e.operator!==d.In&&((e.operator!==d.IsDefined||"true"===e.value)&&!(!this.reservedPaths.includes(e.path)&&!(null===(l=this.options)||void 0===l?void 0:l.find((l=>l.path===e.path))))))}))}get __simpleModeOptions(){var l;return null===(l=this.options)||void 0===l?void 0:l.reduce(((l,a)=>{const n=l.find((e=>{var l;return e.name===(null===(l=a.group)||void 0===l?void 0:l.name)}));return n?n.options.push(a):l.push(e(e({},a.group),{},{options:[a]})),l}),[])}}Ve.ChangeEvent=class extends CustomEvent{},Ve.Operator=d,Ve.Type=v,customElements.define("foxy-query-builder",Ve);export{Ve as Q,Ie as p,Ae as s};
|
|
40
|
+
`));let j,Z=e=>e;let V,I,T=e=>e;function N(e){return o(V||(V=T` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> <input placeholder="${0}" class="${0}" .value="${0}" ?disabled="${0}" @keydown="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} </label> `),e.t(e.label),p({"bg-base relative flex h-m px-s font-medium w-full":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly,"flex max-w-full whitespace-nowrap":!0,"focus-outline-none":!0}),e.value,e.disabled||e.readonly,(e=>"|"===e.key&&e.preventDefault()),(l=>{const a=l.currentTarget;e.onChange(a.value.replace(/\|/gi,""))}),p({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!e.value,"sr-only":!e.value,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.label),e.disabled||e.readonly?"":o(I||(I=T` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}let z,B,E=e=>e;function G(l){var a,n;const{isFullSize:t,isNested:r,disableOr:s,readonly:i,disabled:u,rule:v}=l,{t:h,onConvert:f,onDelete:b,onChange:g}=l;return o(z||(z=E` <div class="flex items-center space-x-s" aria-label="${0}"> <div class="${0}"> <div class="bg-contrast-10"> <div class="grid gap-1px grid-vertical sm-grid-horizontal"> <div class="bg-base"> <div aria-hidden="true" class="${0}"> ${0} </div> </div> <div class="bg-base"> ${0} </div> <div class="bg-base">${0}</div> <div class="bg-base"> ${0} </div> </div> </div> </div> <div class="${0}"> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:remove-circle-outline"> </iron-icon> </button> <button aria-label="${0}" class="${0}" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:add-circle-outline"> </iron-icon> </button> </div> </div> `),h("query_builder_rule"),p({"flex-1 bg-base rounded overflow-hidden border":!0,"border-contrast-10":!r&&!i,"border-contrast-50":!!r||i,"border-dashed":i,"border-solid":!i}),p({"text-tertiary":!i&&!u,"text-disabled":i||u,"w-m h-m":!0}),D,v.path&&v.name?o(B||(B=E` <div class="bg-contrast-10 grid gap-1px grid-cols-1 sm-grid-cols-2"> <div class="bg-base"> ${0} </div> <div class="bg-base"> ${0} </div> </div> `),N(e(e({},l),{},{value:v.path,label:"field",onChange:e=>{g({operator:null,value:"",path:e})}})),N(e(e({},l),{},{value:null!==(a=v.name)&&void 0!==a?a:"",label:"name",onChange:l=>g(e(e({},v),{},{name:l}))}))):N(e(e({},l),{},{value:v.path,label:"field",onChange:e=>g({operator:null,value:"",path:e})})),function(l){const{rule:a,operators:n,disabled:t,readonly:r,t:s,onChange:i}=l,{operator:u,value:v,path:h,name:f}=a,b={[d.GreaterThan]:$,[d.GreaterThanOrEqual]:c,[d.In]:_,[d.IsDefined]:L,[d.LessThan]:q,[d.LessThanOrEqual]:A,[d.Not]:S},g=Object.values(d).filter((e=>n.includes(e)&&(!!f||e!==d.IsDefined))),y=t||r||!g.length||!h;return o(j||(j=Z` <button title="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <div aria-hidden="true">${0}</div> </button> `),s(`operator_${null!=u?u:"equal"}`),p({"flex items-center justify-center w-m h-m transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-body hover-bg-contrast-5":!y&&g.length>1,"cursor-default text-tertiary":!y&&g.length<=1,"text-disabled cursor-default":y}),y||g.length<=1,(()=>{var l;const n=u?g.indexOf(u):-1,t=null!==(l=g[n+1])&&void 0!==l?l:null;i(e(e({},a),{},{operator:t,value:v}))}),u?b[u]:m)}(l),N(e(e({},l),{},{disabled:u||!v.path,value:null!==(n=v.value)&&void 0!==n?n:"",label:"value",onChange:l=>g(e(e({},v),{},{value:l}))})),p({"-mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center":!0,"border-t border-b border-transparent divide-y divide-transparent":!0,hidden:!!t||i,flex:!t}),h("delete"),p({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!u,"cursor-default text-disabled":u,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!v.path}),u||i||!v.path,b,h("add_or_clause"),p({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-success hover-bg-contrast-5":!u,"cursor-default text-disabled":u,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0 pointer-events-none":!v.path||!!r||s}),u||i||!v.path||!!r||s,s,f)}let P,R,F,U,W=e=>e;function Q(l){const a=l.rules.some((e=>Array.isArray(e))),n=o(P||(P=W`<div class="${0}"></div>`),a?"h-xs":"mt-s"),t=o(R||(R=W` <div class="flex items-center h-s"> <div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-30"> ${0} </div> <div class="flex-1 border-t border-contrast-20"></div> <div class="w-m ml-s flex-shrink-0"></div> <div class="hidden sm-block w-m flex-shrink-0"></div> </div> `),l.t("or"));return o(F||(F=W` <div aria-label="${0}"> ${0} </div> `),l.t("query_builder_group"),h([...l.rules,null],((e,l)=>String(l)),((a,r)=>{const s=r>0?l.isNested?t:n:"";return null===a?[s,G(e(e({},l),{},{rule:{path:"",operator:null,value:""},isFullSize:!l.isNested&&0===l.rules.length,onChange:e=>l.onChange([...l.rules,e])}))]:Array.isArray(a)?[s,o(U||(U=W` <div class="bg-contrast-10 rounded-t-l rounded-b-l p-s -m-s"> ${0} </div> `),Q(e(e({},l),{},{rules:a,isNested:!0,onChange:e=>{const a=[...l.rules],n=e;a[r]=e.length>1?n:n[0],l.onChange(a)}})))]:[s,G(e(e({},l),{},{rule:a,onChange:e=>{const a=[...l.rules];a[r]=e,l.onChange(a)},onDelete:()=>{const e=l.rules.filter(((e,l)=>l!==r));l.onChange(e)},onConvert:()=>{const n=[...l.rules];n[r]=[a,e(e({},a),{},{operator:null,value:""})],l.onChange(n)}}))]})))}let J,K,X,Y,ee,le,ae=e=>e;function ne(e){const{t:l,disabled:a,readonly:n,current:t,options:s,onChange:i}=e;return o(J||(J=ae` <div class="${0}"> ${0} ${0} </div> `),p({"relative flex items-center gap-xs leading-m px-xs -m-xs rounded-s transition-colors":!0,"focus-within-ring-2 focus-within-ring-primary-50":!0,"text-contrast":!a&&!n,"hover-text-contrast-80":!a&&!n,"text-disabled":a,"text-contrast-80":n,"font-medium":!n}),"label"in t?o(K||(K=ae`<foxy-i18n infer="" key="${0}"></foxy-i18n>`),t.label):o(X||(X=ae`<span>${0}</span>`),t.rawLabel),n?"":o(Y||(Y=ae` ${0} <select class="${0}" ?disabled="${0}" @change="${0}"> ${0} </select> `),r(ee||(ee=ae`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="flex-shrink-0" style="width: 1em; height: 1em; transform: scale(1.25)"><path fill-rule="evenodd" d="M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z" clip-rule="evenodd" /></svg>`)),p({"absolute inset-0 opacity-0 focus-outline-none":!0,"cursor-pointer":!a,"cursor-default":a}),a,(e=>i(e.target.value)),s.map((e=>o(le||(le=ae` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.value,e.value===t.value,"label"in e?l(e.label):e.rawLabel)))))}let te,re,oe,se=e=>e;function ie(e){const{disabled:l,readonly:a,layout:n,label:t,value:r,type:s,min:i,t:u,onChange:d}=e;return o(te||(te=se` <label class="flex-shrink-0 flex items-center gap-s relative" style="min-width:${0}rem;max-width:50%"> <foxy-i18n infer="" class="${0}" key="${0}"> </foxy-i18n> <span class="${0}" ?hidden="${0}">${0}</span> ${0} </label> `),"number"===s?"4":"date"===s?"6":"8",p({"sr-only":"fixed"!==n}),t,p({"relative block whitespace-pre text-m":!0,"px-s py-xs -my-xs font-medium opacity-0":!a,"text-contrast-80":a}),"auto-grow"!==n&&!a,r||o(re||(re=se`<foxy-i18n infer="" key="value_empty"></foxy-i18n>`)),a?"":o(oe||(oe=se` <input placeholder="${0}" class="${0}" ?disabled="${0}" type="${0}" min="${0}" .value="${0}" @keydown="${0}" @input="${0}"> `),u("value_empty"),p({"appearance-none transition-all text-body text-m font-medium rounded-s":!0,"bg-base px-s py-xs -my-xs":!0,"opacity-50":l,"absolute inset-0":"auto-grow"===n,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0}),l,f(s),f(i),r,(e=>"|"===e.key&&e.preventDefault()),(e=>{const l=e.currentTarget;d(l.value.replace(/\|/gi,""))})))}let ue,de=e=>e;const ve=e=>{var l;const{operator:a,value:n,name:t}=null!==(l=e.rule)&&void 0!==l?l:{},{disabled:r,readonly:s,t:i}=e,u=d.Not,v=p({"text-disabled":r,"text-contrast-80":s}),c=null===a?"equal":a===u?u:null;return o(ue||(ue=de` <foxy-i18n class="${0}" infer="" key="name"></foxy-i18n> ${0} <foxy-i18n class="${0}" infer="" key="value"></foxy-i18n> ${0} ${0} `),v,ie({layout:"auto-grow",value:t||"",label:"name",type:"text",disabled:r,readonly:s,t:i,onChange:l=>{if(!l)return e.onChange(null);n?e.onChange({name:l}):e.onChange({name:l,operator:d.IsDefined,value:"true"})}}),v,ne({current:{label:c?`operator_${c}`:"value_any",value:null!=c?c:"any"},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:u}],disabled:r,readonly:s,t:i,onChange:l=>{if("any"!==l)return e.onChange({operator:"equal"===l?null:l,value:a===d.IsDefined?"":null!=n?n:"",name:null!=t?t:""});e.onChange(t?{operator:d.IsDefined,value:"true"}:null)}}),void 0===n||a===d.IsDefined?"":ie({layout:"auto-grow",label:"value",value:n||"",type:"text",disabled:r,readonly:s,t:i,onChange:l=>e.onChange({value:l})}))},ce=l=>{var a;const n=[{label:"value_any",value:"any"},{label:`${l.option.label}_true`,value:"true"},{label:`${l.option.label}_false`,value:"false"}];return ne(e(e({},l),{},{onChange:e=>l.onChange("any"===e?null:{value:e}),current:null!==(a=n.find((e=>{var a;return e.value===(null===(a=l.rule)||void 0===a?void 0:a.value)})))&&void 0!==a?a:n[0],options:n}))};let pe,he,fe=e=>e;const be=e=>{const{disabled:l,readonly:a,option:n,rule:t,t:r,onChange:s}=e,{min:i,label:u}=n,v=null==t?void 0:t.operator,c=null==t?void 0:t.value.includes(".."),p=null!=v?v:c?"range":"equal",h=void 0===v?"value_any":"range"===p?"range":`operator_${p}`;return o(pe||(pe=fe` ${0} ${0} `),ne({disabled:l,readonly:a,current:{label:h,value:void 0===v?"any":p},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not},{label:"operator_lessthanorequal",value:d.LessThanOrEqual},{label:"operator_lessthan",value:d.LessThan},{label:"operator_greaterthanorequal",value:d.GreaterThanOrEqual},{label:"operator_greaterthan",value:d.GreaterThan},{label:"range",value:"range"}],t:r,onChange:e=>{var l,a,r,o;if("any"===e)return s(null);if("range"===e){const e=parseFloat(null!==(l=null==t?void 0:t.value)&&void 0!==l?l:"");return isNaN(e)?s({operator:null,value:"..",invalid:!0}):s({operator:null,value:`${e}..${e+10}`})}const i=null!==(o=null!==(a=null==t?void 0:t.value)&&void 0!==a?a:null===(r=n.min)||void 0===r?void 0:r.toString())&&void 0!==o?o:"",u=i.includes("..")&&"range"!==e;return s({operator:"equal"===e?null:e,invalid:!i,value:u?i.split("..")[0]:i})}}),void 0===(null==t?void 0:t.value)?"":c?o(he||(he=fe` <foxy-i18n infer="" key="range_from"></foxy-i18n> ${0} <foxy-i18n infer="" key="range_to"></foxy-i18n> ${0} `),ie({disabled:l,readonly:a,layout:"auto-grow",label:"range_from",value:null==t?void 0:t.value.split("..")[0],type:"number",min:i,t:r,onChange:e=>{var l;const a=null!==(l=null==t?void 0:t.value.split("..")[1])&&void 0!==l?l:"";s({value:`${e}..${a}`,invalid:!e||!a})}}),ie({disabled:l,readonly:a,layout:"auto-grow",label:"range_to",value:null==t?void 0:t.value.split("..")[1],type:"number",min:i,t:r,onChange:e=>{const l=null==t?void 0:t.value.split("..")[0];s({value:`${l}..${e}`,invalid:!l||!e})}})):ie({disabled:l,readonly:a,layout:"auto-grow",label:u,value:(null==t?void 0:t.value)||"",type:"number",min:i,t:r,onChange:e=>s({value:e,invalid:!e})}))};let ge,ye=e=>e;const me=e=>{const{disabled:l,readonly:a,option:n,rule:t,t:r,onChange:s}=e,{operator:i}=null!=t?t:{},{label:u}=n;return o(ge||(ge=ye` ${0} ${0} `),ne({disabled:l,readonly:a,current:{label:void 0===i?"value_any":`operator_${null!=i?i:"equal"}`,value:void 0===i?"any":null!=i?i:"equal"},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not}],t:r,onChange:e=>{var l;return s("any"===e?null:{operator:"equal"===e?null:e,value:null!==(l=null==t?void 0:t.value)&&void 0!==l?l:""})}}),void 0===(null==t?void 0:t.value)?"":ie({disabled:l,readonly:a,layout:"auto-grow",label:u,value:(null==t?void 0:t.value)||"",t:r,onChange:e=>s({value:e})}))};let xe,$e,Ce=e=>e;const _e=e=>{var l;const{operator:a,value:n}=null!==(l=e.rule)&&void 0!==l?l:{},{min:t,label:r}=e.option,{disabled:s,readonly:i,t:u,onChange:v}=e,c=null==n?void 0:n.includes(".."),p=null!=a?a:c?"range":"equal",h=void 0===a?"value_any":"range"===p?"range":`operator_${p}`;return o(xe||(xe=Ce` ${0} ${0} `),ne({disabled:s,readonly:i,t:u,current:{label:h,value:void 0===a?"any":p},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not},{label:"operator_lessthanorequal",value:d.LessThanOrEqual},{label:"operator_lessthan",value:d.LessThan},{label:"operator_greaterthanorequal",value:d.GreaterThanOrEqual},{label:"operator_greaterthan",value:d.GreaterThan},{label:"range",value:"range"}],onChange:e=>{if("any"===e)return v(null);if("range"===e){const e=new Date(null!=n?n:(new Date).toISOString()),l=new Date(e);e.setMonth(e.getMonth()-1),e.setHours(0,0,0,0),l.setHours(23,59,59,999);const a=e.toISOString(),t=l.toISOString();return v({operator:null,value:`${a}..${t}`})}const l=null!=n?n:(new Date).toISOString(),a=l.includes("..")&&"range"!==e;return v({operator:"equal"===e?null:e,value:a?l.split("..")[0]:l})}}),void 0===n?"":c?o($e||($e=Ce` ${0} ${0} `),ie({disabled:s,readonly:i,layout:"fixed",label:"range_from",value:b(new Date(n.split("..")[0])),type:"date",min:t,t:u,onChange:e=>{var l,a;const t=null!==(l=g(e))&&void 0!==l?l:new Date,r=new Date(null!==(a=n.split("..")[1])&&void 0!==a?a:Date.now());t.setHours(0,0,0,0),r.setHours(23,59,59,999),v({value:`${t.toISOString()}..${r.toISOString()}`})}}),ie({disabled:s,readonly:i,layout:"fixed",label:"range_to",value:b(new Date(n.split("..")[1])),type:"date",min:t,t:u,onChange:e=>{var l,a;const t=new Date(null!==(l=n.split("..")[0])&&void 0!==l?l:Date.now()),r=null!==(a=g(e))&&void 0!==a?a:new Date;t.setHours(0,0,0,0),r.setHours(23,59,59,999),v({value:`${t.toISOString()}..${r.toISOString()}`})}})):ie({disabled:s,readonly:i,label:r,value:b(new Date(null!=n?n:Date.now())),type:"date",min:t,t:u,onChange:e=>{var l;v({value:(null!==(l=g(e))&&void 0!==l?l:new Date).toISOString()})}}))};let we,Le=e=>e;const Me=e=>{const{disabled:l,readonly:a,option:n,rule:t,t:r,onChange:s}=e,{list:i}=n,u=null==i?void 0:i.find((e=>e.value===(null==t?void 0:t.value))),v=null==t?void 0:t.operator;return o(we||(we=Le` ${0} ${0} `),ne({disabled:l,readonly:a,current:{label:void 0===v?"value_any":`operator_${null!=v?v:"equal"}`,value:void 0===v?"any":null!=v?v:"equal"},options:[{label:"value_any",value:"any"},{label:"operator_equal",value:"equal"},{label:"operator_not",value:d.Not}],t:r,onChange:e=>{var l,a,n;return s("any"===e?null:{operator:"equal"===e?null:e,value:null!==(n=null!==(l=null==t?void 0:t.value)&&void 0!==l?l:null===(a=null==i?void 0:i[0])||void 0===a?void 0:a.value)&&void 0!==n?n:""})}}),void 0===(null==t?void 0:t.value)?"":ne({disabled:l,readonly:a,current:null!=u?u:{label:"value_any",value:""},options:null!=i?i:[],t:r,onChange:e=>s({value:e})}))};let qe,ke,Ae=e=>e;function Oe(e){const l=new Set,a=e=>{let a;if("string"==typeof e.name)a=e.path;else{const l=e.path.lastIndexOf(":");if(-1===l)return;a=e.path.substring(0,l)}a.length>0&&l.add(a)};for(const l of e)if(Array.isArray(l))for(const e of l)a(e);else a(l);return Array.from(l).join()}function Se(e){let l=e.path;return e.name&&(l+=`:name[${e.name}]`),e.operator&&(l+=`:${e.operator}`),[l,e.value]}function He(e,l=!1){const a=new URLSearchParams;for(const l of e)if(Array.isArray(l)){const[e,...n]=l.map(Se);if(e&&e[0]){const l=[e[1],...n.map((e=>e.join("=")))];a.append(e[0],l.join("|"))}}else{const[e,n]=Se(l);e&&a.append(e,n)}if(!l){const l=Oe(e);l?a.set("zoom",l):a.delete("zoom")}return a.toString()}let De;const je=s(De||(De=(e=>e)`.gap-1px{gap:1px}.grid-vertical{grid-template:auto/var(--lumo-size-m) 1fr}:host([sm]) .sm-grid-horizontal{grid-template:auto/var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr}input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input{-moz-appearance:textfield}foxy-internal-summary-control[layout=details][count]:not([open]){--lumo-contrast-5pct:var(--lumo-primary-color-10pct);color:var(--lumo-primary-text-color)}`));function Ze(e,l){var a;const n=null!==(a=Object.values(d).find((l=>e.endsWith(`:${l}`))))&&void 0!==a?a:null;let t,r=e.substring(0,n?e.lastIndexOf(":"):void 0);const o=e.lastIndexOf("[");return r.endsWith("]")&&-1!==o&&(t=r.substring(o+1,r.length-1),r=r.substring(0,o),r.endsWith(":name")&&(r=r.substring(0,r.length-5))),{name:t,path:r,value:l,operator:n}}function Ve(e){const l=new URLSearchParams(e),a=[];for(const[e,n]of l.entries())n.includes("|")?a.push(n.split("|").map(((l,a)=>0===a?Ze(e,l):Ze(...l.split("="))))):a.push(Ze(e,n));return a}let Ie,Te,Ne=e=>e;const ze=t(l(a(n(u(i),"query-builder"))));class Be extends ze{constructor(){super(...arguments),this.reservedPaths=["zoom","limit","offset","order","fields"],this.disableZoom=!1,this.disableOr=!1,this.operators=Object.values(d),this.docsHref=null,this.options=null,this.__isAdvancedMode=!1,this.__reportedValue=null,this.__displayedValue=null}static zoom(e){return Oe(Ve(e))}static get properties(){return e(e({},super.properties),{},{reservedPaths:{type:Array,attribute:"reserved-paths"},disableZoom:{type:Boolean,attribute:"disable-zoom"},disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array},docsHref:{attribute:"docs-href"},options:{type:Array},value:{noAccessor:!0},__reportedValue:{attribute:!1},__displayedValue:{attribute:!1},__isAdvancedMode:{attribute:!1}})}static get styles(){return[super.styles,je]}get value(){return this.__reportedValue}set value(e){this.__reportedValue=e,this.__displayedValue=e}render(){var l,a,n,t,r,s;const i=this.__isSimpleModeSupported,u=Ve(null!==(l=this.__displayedValue)&&void 0!==l?l:""),d=null!==(a=this.operators)&&void 0!==a?a:[],c=null!==(n=this.options)&&void 0!==n?n:[],h=this.t.bind(this),b=e=>{this.__displayedValue=He(e,this.disableZoom);e.every((e=>Array.isArray(e)?e.every((e=>!e.invalid)):!e.invalid))&&(this.__reportedValue=this.__displayedValue,this.dispatchEvent(new Be.ChangeEvent("change")))};return i||this.__isAdvancedMode||(this.__isAdvancedMode=!0),o(Ie||(Ie=Ne` <div class="space-y-m"> <div class="grid grid-cols-2 gap-xs p-xs bg-contrast-5 rounded" ?hidden="${0}"> <label class="${0}"> <foxy-i18n infer="" key="mode_simple${0}"> </foxy-i18n> <input class="sr-only" type="radio" name="mode" ?disabled="${0}" ?checked="${0}" @change="${0}"> </label> <label class="${0}"> <foxy-i18n infer="" key="mode_advanced"></foxy-i18n> <input class="sr-only" type="radio" name="mode" ?checked="${0}" @change="${0}"> </label> </div> ${0} </div> `),!(null===(t=this.options)||void 0===t?void 0:t.length),p({"p-xs rounded-s text-center font-medium transition-colors":!0,"bg-base ring-1 ring-contrast-5":!this.__isAdvancedMode&&i,"hover-bg-contrast-5":this.__isAdvancedMode&&i,"focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50":!0,"cursor-pointer":i,"text-disabled":!i}),i?"":"_unsupported",!i,!this.__isAdvancedMode,(()=>this.__isAdvancedMode=!1),p({"p-xs rounded-s text-center font-medium cursor-pointer transition-colors":!0,"bg-base ring-1 ring-contrast-5":this.__isAdvancedMode,"hover-bg-contrast-5":!this.__isAdvancedMode,"focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50":!0}),this.__isAdvancedMode,(()=>this.__isAdvancedMode=!0),this.__isAdvancedMode||!i?o(Te||(Te=Ne` <p class="leading-s text-tertiary" ?hidden="${0}"> <foxy-i18n infer="" key="advanced_mode_notice"></foxy-i18n> <a target="_blank" class="cursor-pointer rounded-s text-secondary font-medium hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}" rel="nofollow noreferrer noopener"> <foxy-i18n infer="" key="api_reference_link"></foxy-i18n> </a> </p> ${0} `),null===this.docsHref,f(null!==(r=this.docsHref)&&void 0!==r?r:void 0),Q({disableOr:this.disableOr,disabled:this.disabled,readonly:this.readonly,rules:u,operators:d,onChange:b,options:c,t:h})):null===(s=this.__simpleModeOptions)||void 0===s?void 0:s.map((l=>function(l){var a;const{options:n,layout:t,rules:r,name:s,disabled:i,readonly:u,t:d,onChange:c}=l,h=n.filter((e=>r.find((l=>l.path===e.path)))),b=r.find((e=>"order"===e.path)),g=null===(a=null==b?void 0:b.value)||void 0===a?void 0:a.split(",").map((e=>{const[l,a="asc"]=decodeURIComponent(e).split(" ");return{path:l.trim(),order:a.trim()}}));return o(qe||(qe=Ae` <foxy-internal-summary-control aria-label="${0}" helper-text="" layout="${0}" label="${0}" count="${0}" infer=""> ${0} </foxy-internal-summary-control> `),l.t("query_builder_group"),f(t),t&&s?d(s):"",f(h.length||void 0),n.map((l=>{var a;const{type:n,label:t,list:s,path:h}=l,f={[v.Attribute]:ve,[v.Boolean]:ce,[v.String]:me,[v.Number]:be,[v.Date]:_e,[v.Any]:me},b=s?Me:f[n],y=null===(a=null==g?void 0:g.find((e=>e.path===h)))||void 0===a?void 0:a.order,m=r.find((e=>e.path===h)),x=!!m||!!y;return o(ke||(ke=Ae` <div aria-label="${0}" class="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> <span class="transform scale-150 mr-auto ${0}">•</span> ${0} ${0} </div> `),d("query_builder_rule"),p({"flex flex-wrap items-center justify-end gap-s":!0,"bg-primary-10 text-primary":x}),t,x?"":"opacity-0",b({disabled:i,readonly:u,option:l,rule:m,t:d,onChange:l=>{if(l&&m)return Object.assign(m,l),c(r);if(l){const a={path:h,value:"",operator:null};return c([...r,e(e({},a),l)])}return c(r.filter((e=>e.path!==h)))}}),n===v.Date||n===v.Number?ne({disabled:i,readonly:u,t:d,current:{label:`order_${null!=y?y:"none"}${y?`_${n}`:""}`,value:null!=y?y:"none"},options:[{label:"order_none",value:"none"},{label:`order_asc_${n}`,value:"asc"},{label:`order_desc_${n}`,value:"desc"}],onChange:e=>{const l=(null!=g?g:[]).filter((e=>e.path!==h)).concat([{path:h,order:e}]).filter((e=>"none"!==e.order)).map((e=>`${e.path} ${e.order}`)).join(),a=r.filter((e=>"order"!==e.path));l&&a.push({path:"order",value:l,operator:null}),c(a)}}):"")})))}(e(e({},l),{},{disabled:this.disabled,readonly:this.readonly,rules:u,onChange:b,t:h})))))}get __isSimpleModeSupported(){var e;if(null===this.options)return!1;if(0===this.options.length)return!1;const l=Ve(null!==(e=this.__displayedValue)&&void 0!==e?e:"");return 0===l.length||l.every((e=>{var l;return!Array.isArray(e)&&(e.operator!==d.In&&((e.operator!==d.IsDefined||"true"===e.value)&&!(!this.reservedPaths.includes(e.path)&&!(null===(l=this.options)||void 0===l?void 0:l.find((l=>l.path===e.path))))))}))}get __simpleModeOptions(){var l;return null===(l=this.options)||void 0===l?void 0:l.reduce(((l,a)=>{const n=l.find((e=>{var l;return e.name===(null===(l=a.group)||void 0===l?void 0:l.name)}));return n?n.options.push(a):l.push(e(e({},a.group),{},{options:[a]})),l}),[])}}Be.ChangeEvent=class extends CustomEvent{},Be.Operator=d,Be.Type=v,customElements.define("foxy-query-builder",Be);export{Be as Q,Ve as p,He as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-a6b2bd14.js";import"./shared-7a5d645f.js";import"./shared-
|
|
1
|
+
import"./shared-a6b2bd14.js";import"./shared-7a5d645f.js";import"./shared-462566b0.js";import"./shared-a9a8eb7c.js";import{I as e}from"./shared-084e1772.js";import{a as t}from"./shared-9a454e09.js";import"./shared-26b55da2.js";import{i as s}from"./shared-53e42a77.js";import{h as o}from"./shared-ba5c42c7.js";import{c as r,_ as n,B as i}from"./shared-8f9014ff.js";import{S as a,a as l}from"./shared-328aa161.js";import{v as d}from"./shared-b738ee96.js";import{c}from"./shared-4e709717.js";let h,p=e=>e;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends t{renderControl(){var e,t;const r=this.nucleon;return o(h||(h=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(t=null===(e=null==r?void 0:r.settings)||void 0===e?void 0:e.tos_checkbox_settings)||void 0===t?void 0:t.url))}});var u=r((function(e){!function(){const t=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(e,s=t,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=e||"";s[0].minDiversity=0,s[0].minLength=0;const n=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&n.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=n.filter((e=>new RegExp(`${e.regex}`).test(r))).map((e=>e.message)),i.length=r.length;let a=s.filter((e=>i.contains.length>=e.minDiversity)).filter((e=>i.length>=e.minLength)).sort(((e,t)=>t.id-e.id)).map((e=>({id:e.id,value:e.value})));return Object.assign(i,a[0]),i};e.exports={passwordStrength:s,defaultOptions:t}}()}));let m,f,_=e=>e;const g=a(l(e,"customer-form")),x=u.passwordStrength;class v extends g{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__passwordGeneratorOptions={checkStrength:e=>x(e).id>=2},this.__isAnonymousGetValue=()=>{var e;return!1===(null===(e=this.form)||void 0===e?void 0:e.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=e=>{const t="true"===e;this.edit({is_anonymous:t}),t&&this.form.password&&this.edit({password:""}),t&&this.form.password_old&&this.edit({password_old:""}),t&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return n(n({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:e,_links:t,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(t||s||e)||"password:v8n_required"),({password_old:e,password:t,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(t&&!e)||"password-old:v8n_required"))},({first_name:e})=>!e||e.length<=50||"first-name:v8n_too_long",({last_name:e})=>!e||e.length<=50||"last-name:v8n_too_long",({password:e})=>!e||x(e).id>=2||"password:v8n_too_weak",({password:e})=>!e||e.length<=50||"password:v8n_too_long",({tax_id:e})=>!e||e.length<=50||"tax-id:v8n_too_long",({email:e})=>e&&e.length>0||"email:v8n_required",({email:e})=>!e||e.length<=100||"email:v8n_too_long",({email:e})=>!e||d(e)||"email:v8n_invalid_email"]}get hiddenSelector(){const e=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(e.add("forgot-password"),e.add("is-anonymous"),this.form.password||e.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&e.add("legal-notice")):(!1!==this.form.is_anonymous&&(e.add("forgot-password"),e.add("password")),e.add("password-old"),e.add("legal-notice")),this.href&&(e.add("is-anonymous"),e.add("legal-notice")),new i(Array.from(e).join(" ").trim())}get headerTitleOptions(){var e,t;const s=this.data;return!s||(null===(e=s.first_name)||void 0===e?void 0:e.trim())||(null===(t=s.last_name)||void 0===t?void 0:t.trim())?super.headerTitleOptions:n(n({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var e;return(null===(e=this.data)||void 0===e?void 0:e.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return n(n({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const e=this.__refreshInterval;e&&clearInterval(e)}connectedCallback(){super.connectedCallback();const e=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=e}renderBody(){var e,t,s,r;const n=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(m||(m=_` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),c({"grid-cols-2":!n&&!i,hidden:n&&i,"gap-m":!0,grid:!n||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__passwordGeneratorOptions,this.__forgotPasswordHelperText,!this.data&&(null===(t=null===(e=this.settings)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=_` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:e})=>{this.edit({verification:{type:"hcaptcha",token:e}}),super.submit()})):"",super.renderBody())}submit(){var e,t,s,o,r;"hcaptcha"!==(null===(s=null===(t=null===(e=this.settings)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(e){const t=await super._sendPatch(e);if(e.password){const e={key:"password_change_success",options:{email:t.email}};this.status=e}return t}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t;try{t=(await e.json())._embedded["fx:errors"][0].message}catch(t){throw e}throw"Conflict"===t||t.startsWith("This email address is already in use")?["error:email_already_used"]:t.startsWith("Customer registration is disabled")?["error:registration_disabled"]:t.startsWith("Client verification failed")?["error:verification_failed"]:t.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:e}}get __forgotPasswordHelperText(){var e,t;const s=null===(e=this.data)||void 0===e?void 0:e.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(t=this.data)||void 0===t?void 0:t.forgot_password)&&s){const e=new Date(new Date(s).getTime()+18e5),t=Math.floor((e.getTime()-Date.now())/1e3/60);return t<=0?this.t(`${o}_expired_on`,{expiresOn:e}):this.t(`${o}_expires_in`,{expiresInMin:`${t}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var e;return(null===(e=this.data)||void 0===e?void 0:e.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",v);export{v as C,u};
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
},
|
|
338
338
|
"webhook-warning": {
|
|
339
339
|
"warning_text": "We are winding down support for custom services that rely on legacy webhooks and XML datafeed. Please consider using the new JSON webhooks instead.",
|
|
340
|
-
"link_text": "
|
|
340
|
+
"link_text": "See the documentation"
|
|
341
341
|
},
|
|
342
342
|
"webhook-legacy-xml-group-one": {
|
|
343
343
|
"label": "",
|
|
@@ -296,7 +296,11 @@
|
|
|
296
296
|
"label": "Unified order entry password",
|
|
297
297
|
"placeholder": "None",
|
|
298
298
|
"helper_text": "Set a master password here if you would like to be able to check out as your customers without having to know their password.",
|
|
299
|
-
"v8n_required": "Please reduce your UOE password to 100 characters"
|
|
299
|
+
"v8n_required": "Please reduce your UOE password to 100 characters",
|
|
300
|
+
"click_to_copy": "Click to copy",
|
|
301
|
+
"copying": "Copying",
|
|
302
|
+
"done": "Done",
|
|
303
|
+
"failed_to_copy": "Failed to copy"
|
|
300
304
|
},
|
|
301
305
|
"use-single-sign-on": {
|
|
302
306
|
"label": "Enable SSO",
|
|
@@ -49,7 +49,10 @@ export declare class InternalAsyncListControl extends InternalEditableControl {
|
|
|
49
49
|
hideCreateButton: boolean;
|
|
50
50
|
/** If set, renders list items as <a> tags. */
|
|
51
51
|
getPageHref: ((itemHref: string, item: unknown) => string | null) | null;
|
|
52
|
+
/** Filter applied to the dataset query. */
|
|
52
53
|
filter: string | null;
|
|
54
|
+
/** Function to extend the filters applied to the dataset query without making it obvious to the user. */
|
|
55
|
+
extendFilter: ((params: URLSearchParams) => void) | null;
|
|
53
56
|
private __deletionConfimationCallback;
|
|
54
57
|
private __cachedCardRenderer;
|
|
55
58
|
private __activeBulkAction;
|
|
@@ -48,7 +48,10 @@ export class InternalAsyncListControl extends InternalEditableControl {
|
|
|
48
48
|
this.hideCreateButton = false;
|
|
49
49
|
/** If set, renders list items as <a> tags. */
|
|
50
50
|
this.getPageHref = null;
|
|
51
|
+
/** Filter applied to the dataset query. */
|
|
51
52
|
this.filter = null;
|
|
53
|
+
/** Function to extend the filters applied to the dataset query without making it obvious to the user. */
|
|
54
|
+
this.extendFilter = null;
|
|
52
55
|
this.__deletionConfimationCallback = null;
|
|
53
56
|
this.__cachedCardRenderer = null;
|
|
54
57
|
this.__activeBulkAction = null;
|
|
@@ -213,6 +216,7 @@ export class InternalAsyncListControl extends InternalEditableControl {
|
|
|
213
216
|
bulkActions: { attribute: false },
|
|
214
217
|
filters: { type: Array },
|
|
215
218
|
filter: {},
|
|
219
|
+
extendFilter: { type: Function, attribute: false },
|
|
216
220
|
__selection: { attribute: false },
|
|
217
221
|
__totalItems: { attribute: false },
|
|
218
222
|
__isSelecting: { attribute: false },
|
|
@@ -505,7 +509,7 @@ export class InternalAsyncListControl extends InternalEditableControl {
|
|
|
505
509
|
].filter(v => !!v);
|
|
506
510
|
}
|
|
507
511
|
__renderContent() {
|
|
508
|
-
var _a, _b;
|
|
512
|
+
var _a, _b, _c;
|
|
509
513
|
const helperText = this.helperText;
|
|
510
514
|
const isDetails = this.layout === 'details';
|
|
511
515
|
const label = this.label;
|
|
@@ -515,9 +519,10 @@ export class InternalAsyncListControl extends InternalEditableControl {
|
|
|
515
519
|
const filter = new URLSearchParams((_b = this.filter) !== null && _b !== void 0 ? _b : '');
|
|
516
520
|
url.searchParams.set('limit', String(this.limit));
|
|
517
521
|
filter.forEach((value, key) => url.searchParams.set(key, value));
|
|
522
|
+
(_c = this.extendFilter) === null || _c === void 0 ? void 0 : _c.call(this, url.searchParams);
|
|
518
523
|
first = url.toString();
|
|
519
524
|
}
|
|
520
|
-
catch (
|
|
525
|
+
catch (_d) {
|
|
521
526
|
first = undefined;
|
|
522
527
|
}
|
|
523
528
|
return html `
|