@foxy.io/elements 1.32.0-beta.2 → 1.32.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-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -64
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/shared-f1b29592.js +64 -0
- package/dist/cdn/translations/coupon-form/en.json +8 -52
- package/dist/elements/internal/InternalArrayMapControl/InternalArrayMapControl.d.ts +12 -0
- package/dist/elements/internal/InternalArrayMapControl/InternalArrayMapControl.js +277 -0
- package/dist/elements/internal/InternalArrayMapControl/InternalArrayMapControl.js.map +1 -0
- package/dist/elements/internal/InternalArrayMapControl/index.d.ts +4 -0
- package/dist/elements/internal/InternalArrayMapControl/index.js +6 -0
- package/dist/elements/internal/InternalArrayMapControl/index.js.map +1 -0
- package/dist/elements/public/CouponForm/CouponForm.d.ts +2 -3
- package/dist/elements/public/CouponForm/CouponForm.js +51 -25
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/index.d.ts +1 -0
- package/dist/elements/public/CouponForm/index.js +1 -0
- package/dist/elements/public/CouponForm/index.js.map +1 -1
- package/dist/elements/public/QueryBuilder/utils/parse.js +3 -1
- package/dist/elements/public/QueryBuilder/utils/parse.js.map +1 -1
- package/dist/elements/public/QueryBuilder/utils/stringify.js +10 -3
- package/dist/elements/public/QueryBuilder/utils/stringify.js.map +1 -1
- package/dist/elements/public/Transaction/index.d.ts +1 -0
- package/dist/elements/public/Transaction/index.js +1 -0
- package/dist/elements/public/Transaction/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import"./shared-64d9ac2a.js";import"./shared-e1850e5f.js";import{_ as e}from"./shared-d1195c27.js";import{s as l,h as t,c as a,L as s}from"./shared-dc73b9a5.js";import{T as n,O as r}from"./shared-8874ec69.js";import{o}from"./shared-8438d4ca.js";import{c as i}from"./shared-4e709717.js";import{i as d}from"./shared-9803aa7c.js";import{a as u}from"./shared-79d0699c.js";import{r as c}from"./shared-a0c6a159.js";import{R as v,T as p,a as b}from"./shared-4efc6bb8.js";import{I as h}from"./shared-17a61265.js";import{C as f}from"./shared-d1cb97c6.js";let g;const m=l(g||(g=(e=>e)`
|
|
2
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
</svg>
|
|
5
|
+
`));let C;const y=l(C||(C=(e=>e)`
|
|
6
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
</svg>
|
|
9
|
+
`));let x;const w=l(x||(x=(e=>e)`
|
|
10
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
<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
|
+
</svg>
|
|
14
|
+
`));let V;const $=l(V||(V=(e=>e)`
|
|
15
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
</svg>
|
|
18
|
+
`));let H;const L=l(H||(H=(e=>e)`
|
|
19
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
</svg>
|
|
22
|
+
`));let M;const Z=l(M||(M=(e=>e)`
|
|
23
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
<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
|
+
</svg>
|
|
27
|
+
`));let O;const j=l(O||(O=(e=>e)`
|
|
28
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
<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"/>
|
|
31
|
+
<path d="M13.4336 20.2601H10.8C10.1373 20.2601 9.60001 20.7973 9.60001 21.4601V21.6C9.60001 22.2627 10.1373 22.8 10.8 22.8H11.9671L13.4336 20.2601Z" class="fill-current"/>
|
|
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
|
+
<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
|
+
</svg>
|
|
35
|
+
`));let I;const N=l(I||(I=(e=>e)`
|
|
36
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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
|
+
<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
|
+
</svg>
|
|
40
|
+
`));let A;const B=l(A||(A=(e=>e)`
|
|
41
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
42
|
+
<path d="M10 13V15C10 15.55 9.55 16 9 16H8V20H9C9.55 20 10 20.45 10 21V23C10 24.65 11.35 26 13 26H16V24H13C12.45 24 12 23.55 12 23V21C12 19.7 11.16 18.58 10 18.17V17.83C11.16 17.42 12 16.3 12 15V13C12 12.45 12.45 12 13 12H16V10H13C11.35 10 10 11.35 10 13Z" class="fill-current"/>
|
|
43
|
+
<path d="M27 16C26.45 16 26 15.55 26 15V13C26 11.35 24.65 10 23 10H20V12H23C23.55 12 24 12.45 24 13V15C24 16.3 24.84 17.42 26 17.83V18.17C24.84 18.58 24 19.69 24 21V23C24 23.55 23.55 24 23 24H20V26H23C24.65 26 26 24.65 26 23V21C26 20.45 26.45 20 27 20H28V16H27Z" class="fill-current"/>
|
|
44
|
+
</svg>
|
|
45
|
+
`));let T;const _=l(T||(T=(e=>e)`
|
|
46
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
47
|
+
<path d="M23.8333 17.0588H22.0833V11.7647H20.3333V10H23.8333V17.0588Z" class="fill-current"/>
|
|
48
|
+
<path d="M15.6667 10H12.1667C11.525 10 11 10.5294 11 11.1765V15.8824C11 16.5294 11.525 17.0588 12.1667 17.0588H15.6667C16.3083 17.0588 16.8333 16.5294 16.8333 15.8824V11.1765C16.8333 10.5294 16.3083 10 15.6667 10ZM15.0833 15.2941H12.75V11.7647H15.0833V15.2941Z" class="fill-current"/>
|
|
49
|
+
<path d="M15.6667 26.4706H13.9167V21.1765H12.1667V19.4118H15.6667V26.4706Z" class="fill-current"/>
|
|
50
|
+
<path d="M23.8333 19.4118H20.3333C19.6917 19.4118 19.1667 19.9412 19.1667 20.5882V25.2941C19.1667 25.9412 19.6917 26.4706 20.3333 26.4706H23.8333C24.475 26.4706 25 25.9412 25 25.2941V20.5882C25 19.9412 24.475 19.4118 23.8333 19.4118ZM23.25 24.7059H20.9167V21.1765H23.25V24.7059Z" class="fill-current"/>
|
|
51
|
+
</svg>
|
|
52
|
+
`));let D;const S=l(D||(D=(e=>e)`
|
|
53
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
54
|
+
<path d="M25 10H24V8H22V10H14V8H12V10H11C9.89 10 9.01 10.9 9.01 12L9 26C9 27.1 9.89 28 11 28H25C26.1 28 27 27.1 27 26V12C27 10.9 26.1 10 25 10ZM25 26H11V16H25V26ZM25 14H11V12H25V14ZM23 19H18V24H23V19Z" class="fill-current"/>
|
|
55
|
+
</svg>
|
|
56
|
+
`));let k;const z=l(k||(k=(e=>e)`
|
|
57
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
58
|
+
<path d="M26.5 16L27 14H23L24 10H22L21 14H17L18 10H16L15 14H11L10.5 16H14.5L13.5 20H9.5L9 22H13L12 26H14L15 22H19L18 26H20L21 22H25L25.5 20H21.5L22.5 16H26.5ZM19.5 20H15.5L16.5 16H20.5L19.5 20Z" class="fill-current"/>
|
|
59
|
+
</svg>
|
|
60
|
+
`));let E;const R=l(E||(E=(e=>e)`
|
|
61
|
+
<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
62
|
+
<path d="M11 11V14H16.5V26H19.5V14H25V11H11Z" class="fill-current"/>
|
|
63
|
+
</svg>
|
|
64
|
+
`));let q,U,G,W,F,Q=e=>e;function J(e){var l,a,s;const n=null===(a=null===(l=e.list)||void 0===l?void 0:l.every((l=>l.value!==e.value)))||void 0===a||a;return t(q||(q=Q` <label class="${0}"> <div class="relative flex-1 min-w-0 overflow-hidden"> <select class="${0}" ?disabled="${0}" @change="${0}"> ${0} ${0} </select> </div> ${0} </label> `),i({"flex items-center transition-colors group text-tertiary":!0,"cursor-pointer hover-bg-contrast-5":!e.disabled&&!e.readonly,"cursor-default":e.disabled||e.readonly}),i({"bg-transparent relative appearance-none flex h-m px-s":!0,"font-medium w-full max-w-full whitespace-nowrap focus-outline-none":!0,"text-tertiary":n&&!e.disabled,"text-body":!n&&!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":!n&&e.readonly,"cursor-pointer":!e.disabled&&!e.readonly,"cursor-default":e.disabled||e.readonly}),e.disabled||e.readonly,(l=>{const t=l.currentTarget,a=t.options[t.options.selectedIndex].value;e.onChange(a)}),n?t(U||(U=Q` <option value="" disabled="disabled" ?selected="${0}">${0}</option> `),n,e.t(e.label)):"",null===(s=e.list)||void 0===s?void 0:s.map((({label:l,value:a})=>t(G||(G=Q` <option value="${0}" ?selected="${0}"> ${0} </option> `),a,a===e.value,e.t(l)))),n?"":t(W||(W=Q` <span class="${0}"> ${0} </span> ${0} `),i({"font-tnum text-xs font-medium border mr-s px-xs rounded-s border-current inline-block":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.label),e.clearable&&!e.readonly?t(F||(F=Q` <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon aria-hidden="true" class="icon-inline text-l" icon="icons:remove-circle-outline"> </iron-icon> </button> `),e.t("delete"),i({"w-s h-s mr-xs flex items-center justify-center transition-colors rounded-full":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"hover-bg-contrast-5 hover-text-error text-body":!e.disabled,"text-disabled":e.disabled}),e.disabled,(()=>e.onChange(""))):""))}let K,P,X,Y,ee,le=e=>e;function te(e){var l;const a=`${null!==(l=e.id)&&void 0!==l?l:String(Math.floor(Math.random()*Math.pow(10,8)))}-list`,s=!!e.displayValue;let n=e.value;if("date"===e.type){const l=new Date(e.value);n=isNaN(l.getTime())?"":u(l)}return t(K||(K=le` <label class="relative flex items-center cursor-text group text-tertiary"> <div class="relative flex-1 min-w-0 overflow-hidden"> ${0} <input placeholder="${0}" class="${0}" list="${0}" type="${0}" max="${0}" .value="${0}" ?disabled="${0}" @input="${0}"> </div> <span class="${0}"> ${0} </span> ${0} ${0} </label> `),s?t(P||(P=le` <div aria-hidden="true" class="${0}"> <div class="truncate">${0}</div> </div> `),i({"absolute inset-0 h-m px-s font-medium flex items-center":!0,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.displayValue)):"",n||"date"===e.type?"":e.t(e.label),i({"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,"opacity-0 focus-opacity-100":s}),d(e.list?a:void 0),"date"===e.type?"datetime-local":e.type,d("date"===e.type?"9999-12-31T23:59":""),n,e.disabled||e.readonly,(l=>{const t=l.currentTarget;let a=t.value;try{if("date"===e.type){const e=new Date(t.value);isNaN(e.getTime())||(a=e.toISOString())}}catch(e){}e.onChange(a)}),i({"font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s":!0,"inline-block":!!n||"date"===e.type,"sr-only":!n&&"date"!==e.type,"text-body":!e.disabled&&!e.readonly,"text-disabled":e.disabled,"text-secondary":e.readonly}),e.t(e.label),e.list?t(X||(X=le` <datalist id="${0}"> ${0} </datalist> `),a,e.list.map((({label:l,value:a})=>t(Y||(Y=le`<option value="${0}">${0}</option>`),a,e.t(l))))):"",e.disabled||e.readonly?"":t(ee||(ee=le` <div class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"></div> `)))}let ae,se,ne=e=>e;let re,oe=e=>e;function ie({parsedValue:l,disabled:t,readonly:a,options:s,option:n,t:r,onChange:o}){return te({displayValue:null==n?void 0:n.label,disabled:t,readonly:a,value:l.path,label:"field",list:s.map((l=>e(e({},l),{},{value:l.path}))),type:"text",id:"path",t:r,onChange:e=>o({operator:null,value:"",path:e})})}let de,ue=e=>e;let ce,ve,pe=e=>e;function be(l){var a,s;const{parsedValue:d,isFullSize:u,isNested:v,readonly:p,disabled:b,options:h,t:f,onConvert:g,onDelete:C,onChange:x}=l,V=null!==(a=h.find((e=>e.path===d.path)))&&void 0!==a?a:null,H=null!==(s=null==V?void 0:V.type)&&void 0!==s?s:n.Any,M=d.operator,O={parsedValue:d,operators:l.operators,disabled:b,readonly:p,options:h,option:V,t:f,onChange:x},I={[n.Attribute]:B,[n.Boolean]:_,[n.Number]:z,[n.String]:R,[n.Date]:S,[n.Any]:N};return t(ce||(ce=pe` <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" title="${0}"> <div class="${0}" aria-hidden="true"> ${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}" @click="${0}"> <iron-icon aria-hidden="true" class="m-auto icon-inline text-xl" icon="icons:add-circle-outline"> </iron-icon> </button> </div> </div> `),f("query_builder_rule"),i({"flex-1 bg-base rounded overflow-hidden border":!0,"border-contrast-10":!v&&!p,"border-contrast-50":!!v||p,"border-dashed":p,"border-solid":!p}),f(`type_${H}`),i({"w-m h-m":!0,"text-tertiary":!p&&!b,"text-disabled":p||b}),V?I[H]:N,d.path&&(H===n.Attribute||d.name)?t(ve||(ve=pe` <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> `),ie(O),function(l){var t;return te({disabled:l.disabled,readonly:l.readonly,value:null!==(t=l.parsedValue.name)&&void 0!==t?t:"",label:"name",type:"text",t:l.t,onChange:t=>l.onChange(e(e({},l.parsedValue),{},{name:t}))})}(O)):ie(O),function(l){const a=l.parsedValue.operator,s={[r.GreaterThan]:y,[r.GreaterThanOrEqual]:o,[r.In]:w,[r.IsDefined]:$,[r.LessThan]:L,[r.LessThanOrEqual]:Z,[r.Not]:j},d={[n.Attribute]:[r.In,r.Not,r.IsDefined],[n.Boolean]:[],[n.String]:[r.In,r.Not],[n.Number]:[r.In,r.Not,r.GreaterThan,r.LessThan,r.GreaterThanOrEqual,r.LessThanOrEqual],[n.Date]:[r.In,r.Not],[n.Any]:Object.values(r)},u=(l.option?d[l.option.type]:l.parsedValue.name?Object.values(r):Object.values(r).filter((e=>e!==r.IsDefined))).filter((e=>l.operators.includes(e))),c=l.disabled||l.readonly||0===u.length||!l.parsedValue.path;return t(re||(re=oe` <button title="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <div aria-hidden="true">${0}</div> </button> `),l.t(`operator_${null!=a?a:"equal"}`),i({"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":!c&&u.length>1,"cursor-default text-tertiary":!c&&u.length<=1,"text-disabled cursor-default":c}),c||u.length<=1,(()=>{var t;const s=a?u.indexOf(a):-1,n=null!==(t=u[s+1])&&void 0!==t?t:null;l.onChange(e(e({},l.parsedValue),{},{operator:n,value:l.parsedValue.value}))}),a?s[a]:m)}(O),M===r.In?function(l){var a,s,r,o;const i=(null===(a=l.option)||void 0===a?void 0:a.list)?J:te,d=l.parsedValue.value.split(","),u=null!==(r=null===(s=l.option)||void 0===s?void 0:s.type)&&void 0!==r?r:n.Any,v=u===n.Number?"number":u===n.Date?"date":"text",p=null===(o=l.option)||void 0===o?void 0:o.list,b=[...d.filter((e=>!!e))];return l.readonly||b.push(null),t(ae||(ae=ne` <div class="bg-contrast-10 grid grid-cols-1 gap-1px"> ${0} </div> `),c(b,((e,l)=>l),((a,s)=>{var n;return t(se||(se=ne` <div class="bg-base"> ${0} </div> `),i({type:v,list:p,t:l.t,value:null!=a?a:"",label:a?String(s+1):"add_value",disabled:l.disabled,readonly:l.readonly,clearable:!0,displayValue:null===(n=null==p?void 0:p.find((e=>e.value===a)))||void 0===n?void 0:n.label,onChange:t=>{t?d[s]=t:d.splice(s,1),l.onChange(e(e({},l.parsedValue),{},{value:d.join(",")}))}}))})))}(O):M===r.IsDefined?function(l){return J({readonly:l.readonly,disabled:l.disabled,value:l.parsedValue.value,label:"value",list:[{label:"is_defined_true",value:"true"},{label:"is_defined_false",value:"false"}],t:l.t,onChange:t=>l.onChange(e(e({},l.parsedValue),{},{value:t}))})}(O):H===n.Boolean?function(l){var t,a,s,n,r,o;const{parsedValue:i,option:d,readonly:u,disabled:c,t:v,onChange:p}=l,b=null!==(s=null===(a=null===(t=null==d?void 0:d.list)||void 0===t?void 0:t.find((e=>"false"===e.value)))||void 0===a?void 0:a.label)&&void 0!==s?s:"false",h=[{label:null!==(o=null===(r=null===(n=null==d?void 0:d.list)||void 0===n?void 0:n.find((e=>"true"===e.value)))||void 0===r?void 0:r.label)&&void 0!==o?o:"true",value:"true"},{label:b,value:"false"}];return J({disabled:c,readonly:u,value:i.value,label:"value",list:h,t:v,onChange:l=>p(e(e({},i),{},{value:l}))})}(O):null===M&&[n.Number,n.Date].includes(H)?function(l){var a,s,r;const{t:o,parsedValue:i,option:d,readonly:u,disabled:c,onChange:v}=l,p=i.value.split(".."),b=p.length>=1?p[0]:"",h=p.length>=2?p[1]:"",f=(null==d?void 0:d.list)?J:te,g=null!==(a=null==d?void 0:d.type)&&void 0!==a?a:n.Any,m=g===n.Number?"number":g===n.Date?"date":"text",C=null==d?void 0:d.list;return t(de||(de=ue` <div class="grid bg-contrast-10 gap-1px grid-cols-1 grid-rows-2 sm-grid-cols-2 sm-grid-rows-1"> <div class="bg-base"> ${0} </div> <div class="bg-base"> ${0} </div> </div> `),f({displayValue:null===(s=null==C?void 0:C.find((e=>e.value===b)))||void 0===s?void 0:s.label,readonly:u,disabled:c,value:b,label:"range_from",type:m,list:C,t:o,onChange:l=>v(e(e({},i),{},{value:`${l}..${h}`}))}),f({displayValue:null===(r=null==C?void 0:C.find((e=>e.value===h)))||void 0===r?void 0:r.label,readonly:u,disabled:c,label:"range_to",value:h,type:m,list:C,t:o,onChange:l=>v(e(e({},i),{},{value:`${b}..${l}`}))}))}(O):function(l){var t,a,s,r;const{t:o,option:i,parsedValue:d,readonly:u,disabled:c,onChange:v}=l,p=(null==i?void 0:i.list)?J:te,b=null!==(t=null==i?void 0:i.type)&&void 0!==t?t:n.Any;return p({displayValue:null===(s=null===(a=null==i?void 0:i.list)||void 0===a?void 0:a.find((e=>e.value===d.value)))||void 0===s?void 0:s.label,readonly:u,disabled:c||!d.path,value:null!==(r=d.value)&&void 0!==r?r:"",label:"value",type:b===n.Number?"number":b===n.Date?"date":"text",list:null==i?void 0:i.list,t:o,onChange:l=>v(e(e({},d),{},{value:l}))})}(O),i({"-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:!!u||p,flex:!u}),f("delete"),i({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-secondary hover-bg-contrast-5 hover-text-error":!b,"cursor-default text-disabled":b,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0":!d.path}),b||p||!d.path,C,f("add_or_clause"),i({"box-content flex w-m h-m rounded-full transition-colors":!0,"text-success hover-bg-contrast-5":!b,"cursor-default text-disabled":b,"focus-outline-none focus-ring-2 ring-primary-50":!0,"opacity-0":!d.path||!!v||l.disableOr}),b||p||!d.path,g)}let he,fe,ge,me,Ce=e=>e;function ye(l){const a=l.parsedValues.some((e=>Array.isArray(e))),s=t(he||(he=Ce`<div class="${0}"></div>`),a?"h-xs":"mt-s"),n=t(fe||(fe=Ce` <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 t(ge||(ge=Ce` <div aria-label="${0}"> ${0} </div> `),l.t("query_builder_group"),c([...l.parsedValues,null],((e,l)=>String(l)),((a,r)=>{const o=r>0?l.isNested?n:s:"";return null===a?[o,be({operators:l.operators,disableOr:l.disableOr,isFullSize:!l.isNested&&0===l.parsedValues.length,isNested:l.isNested,disabled:l.disabled,readonly:l.readonly,options:l.options,parsedValue:{path:"",operator:null,value:""},t:l.t,onChange:e=>l.onChange([...l.parsedValues,e])})]:Array.isArray(a)?[o,t(me||(me=Ce` <div class="bg-contrast-10 rounded-t-l rounded-b-l p-s -m-s"> ${0} </div> `),ye({parsedValues:a,disableOr:l.disableOr,operators:l.operators,isNested:!0,disabled:l.disabled,readonly:l.readonly,options:l.options,t:l.t,onChange:e=>{const t=[...l.parsedValues],a=e;t[r]=e.length>1?a:a[0],l.onChange(t)}}))]:[o,be({parsedValue:a,disableOr:l.disableOr,operators:l.operators,isNested:l.isNested,disabled:l.disabled,readonly:l.readonly,options:l.options,t:l.t,onChange:e=>{const t=[...l.parsedValues];t[r]=e,l.onChange(t)},onDelete:()=>{const e=l.parsedValues.filter(((e,l)=>l!==r));l.onChange(e)},onConvert:()=>{const t=[...l.parsedValues];t[r]=[a,e(e({},a),{},{operator:null,value:""})],l.onChange(t)}})]})))}function xe(e){var l;const t=e.indexOf("="),a=decodeURIComponent(e.substring(0,t)),s=decodeURIComponent(e.substring(t+1)),n=null!==(l=Object.values(r).find((e=>a.endsWith(`:${e}`))))&&void 0!==l?l:null;let o,i=a.substring(0,n?a.lastIndexOf(":"):void 0);const d=a.lastIndexOf("[");return i.endsWith("]")&&-1!==d&&(o=i.substring(d+1,i.length-1),i=i.substring(0,d),i.endsWith(":name")&&(i=i.substring(0,i.length-5))),{name:o,path:i,value:s,operator:n}}function we(e){return e.split("&").filter((e=>!!e)).map((e=>{const[l,t]=e.split("=").map(decodeURIComponent);return(null==t?void 0:t.includes("|"))?`${encodeURIComponent(l)}=${t}`.split("|").map((e=>xe(e))):xe(e)}))}function Ve(e){let l=e.path;return e.name&&(l+=`:name[${e.name}]`),e.operator&&(l+=`:${e.operator}`),l=`${encodeURIComponent(l)}=${encodeURIComponent(e.value)}`,"="===l?"":l}function $e(e){const l=e.reduce(((e,l)=>{if(Array.isArray(l)){let t=l[0].path;l[0].name&&(t+=`:name[${l[0].name}]`),l[0].operator&&(t+=`:${l[0].operator}`);const a=[l[0].value,...l.slice(1).map((e=>decodeURIComponent(Ve(e))))];e.push(`${t}=${encodeURIComponent(a.join("|"))}`)}else"zoom"!==l.path&&e.push(Ve(l));return e}),[]),t=He(e).join(",");return t&&l.push(`zoom=${encodeURIComponent(t)}`),l.join("&")}function He(e){return e.map((e=>{if(Array.isArray(e))return He(e);if(e.name)return[e.path];const l=e.path.split(":");return l.slice(0,l.length-1)})).flat().sort(((e,l)=>l.length-e.length)).filter(((e,l,t)=>t.every(((t,a)=>(a>=l||t!==e)&&!t.startsWith(`${e}:`)))))}let Le;const Me=a(Le||(Le=(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}`)),Ze=f(v(p(b(h(s),"query-builder"))));class Oe extends Ze{constructor(){super(...arguments),this.operators=Object.values(r),this.disableOr=!1,this.options=null,this.value=null}static get properties(){return e(e({},super.properties),{},{disableOr:{type:Boolean,attribute:"disable-or"},operators:{type:Array},options:{type:Array},value:{type:String}})}static get styles(){return[super.styles,Me]}render(){var e,l,t;const a=new Set(["zoom","limit","offset","order","fields"]),s=[],n=[];return we(null!==(e=this.value)&&void 0!==e?e:"").forEach((e=>{Array.isArray(e)||!a.has(e.path)?n.push(e):s.push(e)})),ye({parsedValues:n,disableOr:this.disableOr,operators:null!==(l=this.operators)&&void 0!==l?l:[],disabled:this.disabled,readonly:this.readonly,options:null!==(t=this.options)&&void 0!==t?t:[],t:this.t.bind(this),onChange:e=>{this.value=$e([...e,...s]),this.dispatchEvent(new Oe.ChangeEvent("change"))}})}}Oe.ChangeEvent=class extends CustomEvent{},Oe.Operator=r,Oe.Type=n,customElements.define("foxy-query-builder",Oe);export{Oe as Q,we as p,$e as s};
|
|
@@ -535,42 +535,10 @@
|
|
|
535
535
|
"label": "Item option restrictions",
|
|
536
536
|
"helper_text": "This restricts the usage of a coupon code based on an item option's name and value. When defined, the coupon will only apply to items with the specified option name and value. Wildcards are allowed.",
|
|
537
537
|
"v8n_too_long": "Unfortunately we are unable to store that many item option restrictions at the moment. Please reduce the number of rules in this section until this message disappears.",
|
|
538
|
-
"
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
"date": "{{value, date}}",
|
|
543
|
-
"date_created": "Created on",
|
|
544
|
-
"date_modified": "Last updated on",
|
|
545
|
-
"delete": "Delete",
|
|
546
|
-
"field": "Option name",
|
|
547
|
-
"hidden": "Hidden",
|
|
548
|
-
"is_defined_false": "Not defined",
|
|
549
|
-
"is_defined_true": "Defined",
|
|
550
|
-
"name": "Name",
|
|
551
|
-
"operator_equal": "Equal",
|
|
552
|
-
"operator_greaterthan": "Greater than",
|
|
553
|
-
"operator_greaterthanorequal": "Greater than or equal",
|
|
554
|
-
"operator_in": "One of",
|
|
555
|
-
"operator_isdefined": "Is defined",
|
|
556
|
-
"operator_lessthan": "Less than",
|
|
557
|
-
"operator_lessthanorequal": "Less than or equal",
|
|
558
|
-
"operator_not": "Not equal",
|
|
559
|
-
"or": "Or",
|
|
560
|
-
"query_builder_group": "Group of filters",
|
|
561
|
-
"query_builder_rule": "Filter",
|
|
562
|
-
"range_from": "From",
|
|
563
|
-
"range_to": "To",
|
|
564
|
-
"type": "Type",
|
|
565
|
-
"type_any": "Field of unknown type",
|
|
566
|
-
"type_attribute": "Key-value resource",
|
|
567
|
-
"type_date": "Date field",
|
|
568
|
-
"type_here": "Type here...",
|
|
569
|
-
"type_number": "Numeric field",
|
|
570
|
-
"type_string": "Text field",
|
|
571
|
-
"used_codes": "Codes used",
|
|
572
|
-
"value": "Option value"
|
|
573
|
-
}
|
|
538
|
+
"delete": "Delete",
|
|
539
|
+
"add_value": "Add value",
|
|
540
|
+
"option_name": "Option name",
|
|
541
|
+
"rule": "Rule"
|
|
574
542
|
},
|
|
575
543
|
"category-restrictions": {
|
|
576
544
|
"label": "Item category restrictions",
|
|
@@ -603,15 +571,10 @@
|
|
|
603
571
|
"add_or_clause": "Add OR clause",
|
|
604
572
|
"add_value": "Add value",
|
|
605
573
|
"code": "Code",
|
|
606
|
-
"date": "{{value, date}}",
|
|
607
|
-
"date_created": "Created on",
|
|
608
|
-
"date_modified": "Last updated on",
|
|
609
574
|
"delete": "Delete",
|
|
610
|
-
"field": "
|
|
611
|
-
"hidden": "Hidden",
|
|
575
|
+
"field": "Attribute name",
|
|
612
576
|
"is_defined_false": "Not defined",
|
|
613
577
|
"is_defined_true": "Defined",
|
|
614
|
-
"name": "Name",
|
|
615
578
|
"operator_equal": "Equal",
|
|
616
579
|
"operator_greaterthan": "Greater than",
|
|
617
580
|
"operator_greaterthanorequal": "Greater than or equal",
|
|
@@ -621,19 +584,12 @@
|
|
|
621
584
|
"operator_lessthanorequal": "Less than or equal",
|
|
622
585
|
"operator_not": "Not equal",
|
|
623
586
|
"or": "Or",
|
|
624
|
-
"query_builder_group": "Group of
|
|
625
|
-
"query_builder_rule": "
|
|
626
|
-
"range_from": "From",
|
|
627
|
-
"range_to": "To",
|
|
587
|
+
"query_builder_group": "Group of rules",
|
|
588
|
+
"query_builder_rule": "Rule",
|
|
628
589
|
"type": "Type",
|
|
629
590
|
"type_any": "Field of unknown type",
|
|
630
|
-
"type_attribute": "Key-value resource",
|
|
631
|
-
"type_date": "Date field",
|
|
632
591
|
"type_here": "Type here...",
|
|
633
|
-
"
|
|
634
|
-
"type_string": "Text field",
|
|
635
|
-
"used_codes": "Codes used",
|
|
636
|
-
"value": "Value"
|
|
592
|
+
"value": "Attribute value"
|
|
637
593
|
}
|
|
638
594
|
},
|
|
639
595
|
"customer-subscription-restrictions": {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSResultArray, TemplateResult } from 'lit-element';
|
|
2
|
+
import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';
|
|
3
|
+
declare const InternalArrayMapControl_base: typeof InternalEditableControl;
|
|
4
|
+
declare class InternalArrayMapControl extends InternalArrayMapControl_base {
|
|
5
|
+
static get styles(): CSSResultArray;
|
|
6
|
+
renderControl(): TemplateResult;
|
|
7
|
+
protected get _value(): Record<string, string[]>;
|
|
8
|
+
protected set _value(value: Record<string, string[]>);
|
|
9
|
+
private __renderRule;
|
|
10
|
+
private __renderInput;
|
|
11
|
+
}
|
|
12
|
+
export { InternalArrayMapControl };
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
|
|
2
|
+
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
3
|
+
import { css, html, svg } from 'lit-element';
|
|
4
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
5
|
+
import { repeat } from 'lit-html/directives/repeat';
|
|
6
|
+
class InternalArrayMapControl extends ResponsiveMixin(InternalEditableControl) {
|
|
7
|
+
static get styles() {
|
|
8
|
+
return [
|
|
9
|
+
super.styles,
|
|
10
|
+
css `.gap-1px{
|
|
11
|
+
gap:1px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.grid-vertical{
|
|
15
|
+
grid-template:auto / var(--lumo-size-m) 1fr;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([sm]) .sm-grid-horizontal{
|
|
19
|
+
grid-template:auto / var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr;
|
|
20
|
+
}
|
|
21
|
+
`,
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
renderControl() {
|
|
25
|
+
const divider = html `
|
|
26
|
+
<div class="flex items-center h-s">
|
|
27
|
+
<div class="w-m text-center leading-none uppercase font-medium text-xs text-contrast-20">
|
|
28
|
+
<foxy-i18n infer="" key="or"></foxy-i18n>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="flex-1 border-t border-contrast-10"></div>
|
|
32
|
+
<div class="w-m ml-s flex-shrink-0"></div>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
35
|
+
return html `
|
|
36
|
+
<div class="mb-s" ?hidden=${!this.label && !this.helperText}>
|
|
37
|
+
<p class="font-medium text-body text-l" ?hidden=${!this.label}>${this.label}</p>
|
|
38
|
+
<p class="text-s text-secondary" ?hidden=${!this.helperText}>${this.helperText}</p>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div
|
|
42
|
+
class="rounded bg-contrast-5"
|
|
43
|
+
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
44
|
+
>
|
|
45
|
+
${repeat([...Object.entries(this._value || {}), null], (rule, ruleIndex) => String(ruleIndex), (rule, ruleIndex) => {
|
|
46
|
+
if (rule === null) {
|
|
47
|
+
return [
|
|
48
|
+
ruleIndex > 0 ? divider : '',
|
|
49
|
+
this.__renderRule({
|
|
50
|
+
onChange: ({ key, items }) => {
|
|
51
|
+
var _a;
|
|
52
|
+
this._value = {
|
|
53
|
+
...this._value,
|
|
54
|
+
[key]: [...((_a = this._value[key]) !== null && _a !== void 0 ? _a : []), ...items],
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
return [
|
|
61
|
+
ruleIndex > 0 ? divider : '',
|
|
62
|
+
this.__renderRule({
|
|
63
|
+
rule: { key: rule[0], items: rule[1] },
|
|
64
|
+
onChange: updatedRule => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const newValue = {};
|
|
67
|
+
const oldKeys = Object.keys(this._value);
|
|
68
|
+
for (let i = 0; i < oldKeys.length; i++) {
|
|
69
|
+
const oldKey = oldKeys[i];
|
|
70
|
+
if (oldKey === rule[0]) {
|
|
71
|
+
if (updatedRule.key === oldKey) {
|
|
72
|
+
newValue[oldKey] = updatedRule.items;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const existingItems = (_a = this._value[updatedRule.key]) !== null && _a !== void 0 ? _a : [];
|
|
76
|
+
if (i > oldKeys.indexOf(updatedRule.key)) {
|
|
77
|
+
newValue[updatedRule.key] = [...existingItems, ...updatedRule.items];
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
newValue[updatedRule.key] = [...updatedRule.items, ...existingItems];
|
|
81
|
+
oldKeys.splice(oldKeys.indexOf(updatedRule.key), 1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
newValue[oldKey] = (_b = this._value[oldKey]) !== null && _b !== void 0 ? _b : [];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
this._value = newValue;
|
|
90
|
+
},
|
|
91
|
+
onDelete: () => {
|
|
92
|
+
const newValue = { ...this._value };
|
|
93
|
+
delete newValue[rule[0]];
|
|
94
|
+
this._value = newValue;
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
];
|
|
98
|
+
})}
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<p
|
|
102
|
+
class="text-s text-error mt-s"
|
|
103
|
+
?hidden=${!this._errorMessage || this.disabled || this.readonly}
|
|
104
|
+
>
|
|
105
|
+
${this._errorMessage}
|
|
106
|
+
</p>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
get _value() {
|
|
110
|
+
var _a;
|
|
111
|
+
return (_a = super._value) !== null && _a !== void 0 ? _a : {};
|
|
112
|
+
}
|
|
113
|
+
set _value(value) {
|
|
114
|
+
super._value = value;
|
|
115
|
+
}
|
|
116
|
+
__renderRule({ rule, onDelete, onChange }) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
const items = (_a = rule === null || rule === void 0 ? void 0 : rule.items) !== null && _a !== void 0 ? _a : [];
|
|
119
|
+
return html `
|
|
120
|
+
<div class="flex items-center space-x-s" aria-label=${this.t('rule')}>
|
|
121
|
+
<div class="flex-1 bg-base rounded-s overflow-hidden border border-contrast-10">
|
|
122
|
+
<div class="bg-contrast-10">
|
|
123
|
+
<div class="grid gap-1px grid-vertical sm-grid-horizontal">
|
|
124
|
+
<div class="bg-base">
|
|
125
|
+
<div
|
|
126
|
+
aria-hidden="true"
|
|
127
|
+
class=${classMap({
|
|
128
|
+
'text-tertiary': !this.readonly && !this.disabled,
|
|
129
|
+
'text-disabled': this.readonly || this.disabled,
|
|
130
|
+
'w-m h-m': true,
|
|
131
|
+
})}
|
|
132
|
+
>
|
|
133
|
+
${svg `<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><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"/><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"/></svg>`}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="bg-base">
|
|
137
|
+
${this.__renderInput({
|
|
138
|
+
value: (_b = rule === null || rule === void 0 ? void 0 : rule.key) !== null && _b !== void 0 ? _b : '',
|
|
139
|
+
label: this.t('option_name'),
|
|
140
|
+
onChange: newPath => {
|
|
141
|
+
if (newPath === undefined) {
|
|
142
|
+
onDelete === null || onDelete === void 0 ? void 0 : onDelete();
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
onChange({ key: newPath, items });
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
})}
|
|
149
|
+
</div>
|
|
150
|
+
<div class="bg-base">
|
|
151
|
+
<div
|
|
152
|
+
class=${classMap({
|
|
153
|
+
'flex items-center justify-center w-m h-m transition-colors': true,
|
|
154
|
+
'focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50': true,
|
|
155
|
+
'cursor-default text-tertiary': !(this.disabled || this.readonly),
|
|
156
|
+
'text-disabled cursor-default': this.disabled || this.readonly,
|
|
157
|
+
})}
|
|
158
|
+
>
|
|
159
|
+
<div aria-hidden="true">
|
|
160
|
+
${svg `<svg class="w-full h-full" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"><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"/><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"/></svg>`}
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
<div class="bg-base">
|
|
165
|
+
<div class="bg-contrast-10 grid grid-cols-1 gap-1px">
|
|
166
|
+
${repeat(this.readonly ? items : [...items, null], (value, index) => index, (value, index) => html `
|
|
167
|
+
<div class="bg-base">
|
|
168
|
+
${this.__renderInput({
|
|
169
|
+
value: value !== null && value !== void 0 ? value : '',
|
|
170
|
+
label: value ? String(index + 1) : this.t('add_value'),
|
|
171
|
+
onChange: newValue => {
|
|
172
|
+
const newItems = [...items];
|
|
173
|
+
if (newValue) {
|
|
174
|
+
if (value === null) {
|
|
175
|
+
newItems.push(newValue);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
newItems[index] = newValue;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
newItems.splice(index, 1);
|
|
183
|
+
}
|
|
184
|
+
if (rule)
|
|
185
|
+
onChange({ key: rule.key, items: newItems });
|
|
186
|
+
},
|
|
187
|
+
})}
|
|
188
|
+
</div>
|
|
189
|
+
`)}
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div
|
|
197
|
+
class="flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent"
|
|
198
|
+
?hidden=${this.readonly || Object.keys(this._value).length === 0}
|
|
199
|
+
>
|
|
200
|
+
<button
|
|
201
|
+
aria-label=${this.t('delete')}
|
|
202
|
+
class=${classMap({
|
|
203
|
+
'box-content flex items-center justify-center': true,
|
|
204
|
+
'w-m h-m rounded-full transition-colors': true,
|
|
205
|
+
'text-secondary hover-bg-contrast-5 hover-text-error': !this.disabled,
|
|
206
|
+
'cursor-default text-disabled': this.disabled,
|
|
207
|
+
'focus-outline-none focus-ring-2 ring-primary-50': true,
|
|
208
|
+
'opacity-0 pointer-events-none': !rule,
|
|
209
|
+
})}
|
|
210
|
+
?disabled=${this.disabled || this.readonly || !rule}
|
|
211
|
+
@click=${() => onDelete === null || onDelete === void 0 ? void 0 : onDelete()}
|
|
212
|
+
>
|
|
213
|
+
${svg `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-l" style="width: 1.25em; height: 1.25em"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`}
|
|
214
|
+
</button>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
__renderInput(params) {
|
|
220
|
+
return html `
|
|
221
|
+
<label class="relative flex items-center cursor-text group text-tertiary">
|
|
222
|
+
<div class="relative flex-1 min-w-0 overflow-hidden">
|
|
223
|
+
<input
|
|
224
|
+
placeholder=${params.label}
|
|
225
|
+
class=${classMap({
|
|
226
|
+
'bg-base relative flex h-m px-s font-medium w-full': true,
|
|
227
|
+
'text-body': !this.disabled && !this.readonly,
|
|
228
|
+
'text-disabled': this.disabled,
|
|
229
|
+
'text-secondary': this.readonly,
|
|
230
|
+
'flex max-w-full whitespace-nowrap': true,
|
|
231
|
+
'focus-outline-none': true,
|
|
232
|
+
})}
|
|
233
|
+
.value=${params.value}
|
|
234
|
+
?disabled=${this.disabled || this.readonly}
|
|
235
|
+
@keydown=${(evt) => {
|
|
236
|
+
const input = evt.currentTarget;
|
|
237
|
+
if (evt.key === 'Backspace' && !input.value)
|
|
238
|
+
params.onChange();
|
|
239
|
+
}}
|
|
240
|
+
@change=${(evt) => {
|
|
241
|
+
const input = evt.currentTarget;
|
|
242
|
+
if (!input.value)
|
|
243
|
+
params.onChange();
|
|
244
|
+
}}
|
|
245
|
+
@input=${(evt) => {
|
|
246
|
+
const input = evt.currentTarget;
|
|
247
|
+
params.onChange(input.value);
|
|
248
|
+
}}
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<span
|
|
253
|
+
class=${classMap({
|
|
254
|
+
'font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s': true,
|
|
255
|
+
'inline-block': !!params.value,
|
|
256
|
+
'sr-only': !params.value,
|
|
257
|
+
'text-body': !this.disabled && !this.readonly,
|
|
258
|
+
'text-disabled': this.disabled,
|
|
259
|
+
'text-secondary': this.readonly,
|
|
260
|
+
})}
|
|
261
|
+
>
|
|
262
|
+
${this.t(params.label)}
|
|
263
|
+
</span>
|
|
264
|
+
|
|
265
|
+
${this.disabled || this.readonly
|
|
266
|
+
? ''
|
|
267
|
+
: html `
|
|
268
|
+
<div
|
|
269
|
+
class="absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none"
|
|
270
|
+
></div>
|
|
271
|
+
`}
|
|
272
|
+
</label>
|
|
273
|
+
`;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
export { InternalArrayMapControl };
|
|
277
|
+
//# sourceMappingURL=InternalArrayMapControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalArrayMapControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalArrayMapControl/InternalArrayMapControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAMpD,MAAM,uBAAwB,SAAQ,eAAe,CAAC,uBAAuB,CAAC;IAC5E,MAAM,KAAK,MAAM;QACf,OAAO;YACL,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,CAAC,GAAkB,EAAE,EAAE;YAChC,MAAM,KAAK,GAAG,GAAG,CAAC,aAAiC,CAAC;YACpD,IAAI,GAAG,CAAC,GAAG,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,KAAK;gBAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACjE,CAAC;sBACS,CAAC,GAAU,EAAE,EAAE;YACvB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAiC,CAAC;YACpD,IAAI,CAAC,KAAK,CAAC,KAAK;gBAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,CAAC;qBACQ,CAAC,GAAU,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAiC,CAAC;YACpD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;;;;;kBAKK,QAAQ,CAAC;YACf,0EAA0E,EAAE,IAAI;YAChF,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;YAC9B,SAAS,EAAE,CAAC,MAAM,CAAC,KAAK;YACxB,WAAW,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;YAC7C,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,gBAAgB,EAAE,IAAI,CAAC,QAAQ;SAChC,CAAC;;YAEA,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;;;UAGtB,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YAC9B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,IAAI,CAAA;;;;aAIH;;KAER,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["import type { CSSResultArray, TemplateResult } from 'lit-element';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { css, html, svg } from 'lit-element';\nimport { classMap } from '../../../utils/class-map';\nimport { repeat } from 'lit-html/directives/repeat';\n\ntype InputParams = { label: string; value: string; onChange: (newValue?: string) => void };\ntype RuleParams = { rule?: Rule; onChange: (newRule: Rule) => void; onDelete?: () => void };\ntype Rule = { key: string; items: string[] };\n\nclass InternalArrayMapControl extends ResponsiveMixin(InternalEditableControl) {\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .gap-1px {\n gap: 1px;\n }\n\n .grid-vertical {\n grid-template: auto / var(--lumo-size-m) 1fr;\n }\n\n :host([sm]) .sm-grid-horizontal {\n grid-template: auto / var(--lumo-size-m) 1fr var(--lumo-size-m) 1fr;\n }\n `,\n ];\n }\n\n renderControl(): TemplateResult {\n const divider = html`\n <div class=\"flex items-center h-s\">\n <div class=\"w-m text-center leading-none uppercase font-medium text-xs text-contrast-20\">\n <foxy-i18n infer=\"\" key=\"or\"></foxy-i18n>\n </div>\n\n <div class=\"flex-1 border-t border-contrast-10\"></div>\n <div class=\"w-m ml-s flex-shrink-0\"></div>\n </div>\n `;\n\n return html`\n <div class=\"mb-s\" ?hidden=${!this.label && !this.helperText}>\n <p class=\"font-medium text-body text-l\" ?hidden=${!this.label}>${this.label}</p>\n <p class=\"text-s text-secondary\" ?hidden=${!this.helperText}>${this.helperText}</p>\n </div>\n\n <div\n class=\"rounded bg-contrast-5\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${repeat(\n [...Object.entries(this._value || {}), null],\n (rule, ruleIndex) => String(ruleIndex),\n (rule, ruleIndex) => {\n if (rule === null) {\n return [\n ruleIndex > 0 ? divider : '',\n this.__renderRule({\n onChange: ({ key, items }) => {\n this._value = {\n ...this._value,\n [key]: [...(this._value[key] ?? []), ...items],\n };\n },\n }),\n ];\n }\n\n return [\n ruleIndex > 0 ? divider : '',\n this.__renderRule({\n rule: { key: rule[0], items: rule[1] },\n onChange: updatedRule => {\n const newValue: Record<string, string[]> = {};\n const oldKeys = Object.keys(this._value);\n\n for (let i = 0; i < oldKeys.length; i++) {\n const oldKey = oldKeys[i];\n if (oldKey === rule[0]) {\n if (updatedRule.key === oldKey) {\n newValue[oldKey] = updatedRule.items;\n } else {\n const existingItems = this._value[updatedRule.key] ?? [];\n if (i > oldKeys.indexOf(updatedRule.key)) {\n newValue[updatedRule.key] = [...existingItems, ...updatedRule.items];\n } else {\n newValue[updatedRule.key] = [...updatedRule.items, ...existingItems];\n oldKeys.splice(oldKeys.indexOf(updatedRule.key), 1);\n }\n }\n } else {\n newValue[oldKey] = this._value[oldKey] ?? [];\n }\n }\n\n this._value = newValue;\n },\n onDelete: () => {\n const newValue = { ...this._value };\n delete newValue[rule[0]];\n this._value = newValue;\n },\n }),\n ];\n }\n )}\n </div>\n\n <p\n class=\"text-s text-error mt-s\"\n ?hidden=${!this._errorMessage || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n `;\n }\n\n protected get _value(): Record<string, string[]> {\n return (super._value as Record<string, string[]>) ?? {};\n }\n\n protected set _value(value: Record<string, string[]>) {\n super._value = value;\n }\n\n private __renderRule({ rule, onDelete, onChange }: RuleParams) {\n const items = rule?.items ?? [];\n\n return html`\n <div class=\"flex items-center space-x-s\" aria-label=${this.t('rule')}>\n <div class=\"flex-1 bg-base rounded-s overflow-hidden border border-contrast-10\">\n <div class=\"bg-contrast-10\">\n <div class=\"grid gap-1px grid-vertical sm-grid-horizontal\">\n <div class=\"bg-base\">\n <div\n aria-hidden=\"true\"\n class=${classMap({\n 'text-tertiary': !this.readonly && !this.disabled,\n 'text-disabled': this.readonly || this.disabled,\n 'w-m h-m': true,\n })}\n >\n ${svg`<svg class=\"w-full h-full\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><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\"/><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\"/></svg>`}\n </div>\n </div>\n <div class=\"bg-base\">\n ${this.__renderInput({\n value: rule?.key ?? '',\n label: this.t('option_name'),\n onChange: newPath => {\n if (newPath === undefined) {\n onDelete?.();\n } else {\n onChange({ key: newPath, items });\n }\n },\n })}\n </div>\n <div class=\"bg-base\">\n <div\n class=${classMap({\n 'flex items-center justify-center w-m h-m transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50': true,\n 'cursor-default text-tertiary': !(this.disabled || this.readonly),\n 'text-disabled cursor-default': this.disabled || this.readonly,\n })}\n >\n <div aria-hidden=\"true\">\n ${svg`<svg class=\"w-full h-full\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><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\"/><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\"/></svg>`}\n </div>\n </div>\n </div>\n <div class=\"bg-base\">\n <div class=\"bg-contrast-10 grid grid-cols-1 gap-1px\">\n ${repeat(\n this.readonly ? items : [...items, null],\n (value, index) => index,\n (value, index) => html`\n <div class=\"bg-base\">\n ${this.__renderInput({\n value: value ?? '',\n label: value ? String(index + 1) : this.t('add_value'),\n onChange: newValue => {\n const newItems = [...items];\n\n if (newValue) {\n if (value === null) {\n newItems.push(newValue);\n } else {\n newItems[index] = newValue;\n }\n } else {\n newItems.splice(index, 1);\n }\n\n if (rule) onChange({ key: rule.key, items: newItems });\n },\n })}\n </div>\n `\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div\n class=\"flex -mr-s self-start flex-col sm-flex-row flex-shrink-0 items-center border-t border-b border-transparent divide-y divide-transparent\"\n ?hidden=${this.readonly || Object.keys(this._value).length === 0}\n >\n <button\n aria-label=${this.t('delete')}\n class=${classMap({\n 'box-content flex items-center justify-center': true,\n 'w-m h-m rounded-full transition-colors': true,\n 'text-secondary hover-bg-contrast-5 hover-text-error': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n 'focus-outline-none focus-ring-2 ring-primary-50': true,\n 'opacity-0 pointer-events-none': !rule,\n })}\n ?disabled=${this.disabled || this.readonly || !rule}\n @click=${() => onDelete?.()}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"text-l\" style=\"width: 1.25em; height: 1.25em\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z\" /></svg>`}\n </button>\n </div>\n </div>\n `;\n }\n\n private __renderInput(params: InputParams) {\n return html`\n <label class=\"relative flex items-center cursor-text group text-tertiary\">\n <div class=\"relative flex-1 min-w-0 overflow-hidden\">\n <input\n placeholder=${params.label}\n class=${classMap({\n 'bg-base relative flex h-m px-s font-medium w-full': true,\n 'text-body': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n 'text-secondary': this.readonly,\n 'flex max-w-full whitespace-nowrap': true, // ugh safari\n 'focus-outline-none': true,\n })}\n .value=${params.value}\n ?disabled=${this.disabled || this.readonly}\n @keydown=${(evt: KeyboardEvent) => {\n const input = evt.currentTarget as HTMLInputElement;\n if (evt.key === 'Backspace' && !input.value) params.onChange();\n }}\n @change=${(evt: Event) => {\n const input = evt.currentTarget as HTMLInputElement;\n if (!input.value) params.onChange();\n }}\n @input=${(evt: Event) => {\n const input = evt.currentTarget as HTMLInputElement;\n params.onChange(input.value);\n }}\n />\n </div>\n\n <span\n class=${classMap({\n 'font-tnum text-xs font-medium border border-current mr-s px-xs rounded-s': true,\n 'inline-block': !!params.value,\n 'sr-only': !params.value,\n 'text-body': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n 'text-secondary': this.readonly,\n })}\n >\n ${this.t(params.label)}\n </span>\n\n ${this.disabled || this.readonly\n ? ''\n : html`\n <div\n class=\"absolute inset-0 transition-colors bg-transparent group-hover-bg-contrast-5 pointer-events-none\"\n ></div>\n `}\n </label>\n `;\n }\n}\n\nexport { InternalArrayMapControl };\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../../public/I18n/index.js";
|
|
2
|
+
import "../InternalEditableControl/index.js";
|
|
3
|
+
import { InternalArrayMapControl } from "./InternalArrayMapControl.js";
|
|
4
|
+
customElements.define('foxy-internal-array-map-control', InternalArrayMapControl);
|
|
5
|
+
export { InternalArrayMapControl };
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalArrayMapControl/index.ts"],"names":[],"mappings":"AAAA,oCAAiC;AAEjC,6CAA0C;AAE1C,OAAO,EAAE,uBAAuB,EAAE,qCAAkC;AAEpE,cAAc,CAAC,MAAM,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC;AAElF,OAAO,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["import '../../public/I18n/index';\n\nimport '../InternalEditableControl/index';\n\nimport { InternalArrayMapControl } from './InternalArrayMapControl';\n\ncustomElements.define('foxy-internal-array-map-control', InternalArrayMapControl);\n\nexport { InternalArrayMapControl };\n"]}
|
|
@@ -16,13 +16,12 @@ export declare class CouponForm extends Base<Data> {
|
|
|
16
16
|
static get properties(): PropertyDeclarations;
|
|
17
17
|
static get v8n(): NucleonV8N<Data>;
|
|
18
18
|
getTransactionPageHref: TransactionPageHrefGetter | null;
|
|
19
|
+
private readonly __customerAttributeRestrictionsGetValue;
|
|
20
|
+
private readonly __customerAttributeRestrictionsSetValue;
|
|
19
21
|
private readonly __customerSubscriptionRestrictionsGetValue;
|
|
20
22
|
private readonly __customerSubscriptionRestrictionsSetValue;
|
|
21
23
|
private readonly __productCodeRestrictionsGetValue;
|
|
22
24
|
private readonly __productCodeRestrictionsSetValue;
|
|
23
|
-
private readonly __itemOptionRestrictionsOperators;
|
|
24
|
-
private readonly __itemOptionRestrictionsGetValue;
|
|
25
|
-
private readonly __itemOptionRestrictionsSetValue;
|
|
26
25
|
private readonly __storeLoaderId;
|
|
27
26
|
private readonly __codesFilters;
|
|
28
27
|
private __couponCodesActions;
|