@yongdall/theme 0.1.0 → 0.1.2
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/assets.yongdall.mjs +2 -2
- package/hooks.mjs +1 -1
- package/hooks.mjs.map +1 -1
- package/hooks.yongdall.mjs +14 -7
- package/hooks.yongdall.mjs.map +1 -1
- package/index.mjs +25 -25
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/theme-base.css +210 -0
- package/theme-base.css.map +1 -0
- package/{theme-tradition.css → theme-tabs.css} +41 -41
- package/theme-tabs.css.map +1 -0
- package/theme-tabs.mjs +0 -0
- package/theme-tradition.css.map +0 -1
- /package/{theme-tradition.mjs → theme-base.mjs} +0 -0
package/assets.yongdall.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const files = {"style.css":"style.css","theme-allSider.css":"theme-allSider.css","theme-
|
|
1
|
+
export const files = {"style.css":"style.css","theme-allSider.css":"theme-allSider.css","theme-base.css":"theme-base.css","theme-tabs.css":"theme-tabs.css"};
|
|
2
2
|
export const alias = {".":"index","hooks":"hooks"};
|
|
3
|
-
export const esm = {"hooks":"hooks.mjs","index":"index.mjs","style":"style.mjs","theme-allSider":"theme-allSider.mjs","theme-
|
|
3
|
+
export const esm = {"hooks":"hooks.mjs","index":"index.mjs","style":"style.mjs","theme-allSider":"theme-allSider.mjs","theme-base":"theme-base.mjs","theme-tabs":"theme-tabs.mjs"};
|
|
4
4
|
export const styles = ["style.css"];
|
|
5
5
|
export const hooks = "hooks";
|
|
6
6
|
export const nodeModules = {"@neeloong/components":{"esm":{".":"index.mjs"}}};
|
package/hooks.mjs
CHANGED
|
@@ -65,5 +65,5 @@ input {
|
|
|
65
65
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
`;let e=this.#a;e.type=`text`;let t=this.#o,n=this.#s;t.className=`dropdown`,n.className=`dropdown-list`,L&&t.setAttribute(`popover`,`manual`),e.addEventListener(`input`,()=>{this.#u()}),e.addEventListener(`focus`,()=>{this.#d()}),e.addEventListener(`blur`,()=>{let t=this.#e,n=e.value,r=this.required;if(!n){if(!t)return;if(r){e.value=t.label;return}this.#e=null,this.#t=null,this.#l();return}if(t?.label===n)return;let i=this.#c.find(e=>e.label===n);if(i){this.#e=i,this.#t=i.value,e.value=i.label,this.#l();return}if(!t){e.value=``;return}r?e.value=t.label:(e.value=``,this.#e=null,this.#t=null,this.#l())}),this.addEventListener(`keydown`,e=>{if(!this.#b)return;let t=this.#n;if(e.key===`ArrowDown`){if(e.preventDefault(),t?.parentNode!==n){let e=n.firstElementChild;if(!e){this.#n=null;return}this.#n=e,e.classList.add(`current`),e.scrollIntoView();return}let r=t.nextElementSibling;if(!r)return;t.classList.remove(`current`),this.#n=r,r.classList.add(`current`),r.scrollIntoView()}if(e.key===`ArrowUp`){if(e.preventDefault(),t?.parentNode!==n){let e=n.lastElementChild;if(!e){this.#n=null;return}this.#n=e,e.classList.add(`current`),e.scrollIntoView();return}let r=t.previousElementSibling;if(!r)return;t.classList.remove(`current`),this.#n=r,r.classList.add(`current`),r.scrollIntoView()}e.key===`Enter`&&(e.preventDefault(),t?.parentNode===n&&t.click())})}get options(){return this.#c}focus(){this.#a.focus()}set options(e){this.#c=e;let t=this.#o,n=this.#s;n.innerHTML=``;for(let t of e){let e=document.createElement(`div`);e.className=`option`,e.appendChild(document.createTextNode(`${Array(t.level||0).fill(` `).join(``)}${t.label}`||` `)),n.appendChild(e),e.addEventListener(`pointerdown`,e=>{e.preventDefault(),this.#f(t)}),e.addEventListener(`click`,e=>{e.preventDefault(),this.#f(t)}),e.addEventListener(`pointermove`,()=>{this.#n?.classList.remove(`current`),this.#n=e,e.classList.add(`current`)})}if(this.#n=n.firstElementChild,this.#n?.classList.add(`current`),t.scrollTop=0,t.scrollLeft=0,R(this.#a)){if(this.#a.value===this.current?.label)return;this.open=!0;return}let r=this.#t,i=this.#c.find(e=>e.value===r);if(i){if(i===this.#e)return;this.#e=i,this.#t=i.value,this.#a.value=i.label||``}}get active(){return R(this.#a)}#c=[];get current(){return this.#e}get value(){return this.#t}set value(e){if(e===this.#t)return;let t=this.#c.find(t=>t.value===e);if(!t){this.#e=null,this.#t=e,this.#a.value=e;return}t!==this.#e&&(this.#e=t,this.#t=t.value,this.#a.value=t.label||``)}#l(){this.dispatchEvent(new Event(`change`))}#u(){this.dispatchEvent(new Event(`input`))}#d(){this.open=!0,this.dispatchEvent(new Event(`focus`))}get text(){return this.#a.value}#f(e){this.#e=e,this.#t=e?.value,this.#a.value=e?.label||``,this.#l(),this.open=!1,this.#a.focus()}get open(){return this.getAttribute(`open`)!==null}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get readOnly(){return this.getAttribute(`readonly`)!==null}set readOnly(e){e?this.setAttribute(`readonly`,``):this.removeAttribute(`readonly`)}get required(){return this.getAttribute(`required`)!==null}set required(e){e?this.setAttribute(`required`,``):this.removeAttribute(`required`)}get placeholder(){return this.getAttribute(`placeholder`)||``}set placeholder(e){e?this.setAttribute(`placeholder`,e):this.removeAttribute(`placeholder`)}#p(){let e=this.#a.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=t-e.right,i=n-e.bottom,{top:a,left:o,width:s,height:c}=e,l=this.#s.getBoundingClientRect(),u=l.width-2,d=l.height-2,f=this.#o;f.style.maxWidth=``,f.style.minWidth=``,f.style.top=`${a+c}px`,f.style.minWidth=`${s}px`,f.style.maxHeight=`${n-a-c-4}px`,u<=t-o?(f.style.left=`${o}px`,f.style.right=``):u<=t-o?(f.style.left=`${o}px`,f.style.right=`${t-o}px`):(f.style.left=`${Math.max(0,Math.min((u-s)/2,o))}px`,f.style.right=``);let p=0;d<=i-20?(p=1,f.style.top=`${a+c}px`,f.style.minWidth=`${s}px`,f.style.bottom=``):d<=a?(p=1,f.style.top=``,f.style.bottom=`${i+c}px`):Math.max(o,r-20)<Math.min(u,e.right-o)?i-20>=a?(p=1,f.style.top=`${a+c}px`,f.style.minWidth=`${s}px`,f.style.bottom=``):d<=a&&(p=1,f.style.top=``,f.style.bottom=`${i+c}px`):u<=r-20||o<=r-20?(f.style.left=`${o+s}px`,f.style.maxWidth=`${r}px`,f.style.right=``):(f.style.left=``,f.style.right=`${r+s}px`,f.style.maxWidth=`${o}px`),p?u<=t-o?(f.style.left=`${o}px`,f.style.right=``):u<=t-o?(f.style.left=`${o}px`,f.style.right=`${t-o}px`):(f.style.left=`${Math.max(0,Math.min((u-s)/2,o))}px`,f.style.right=``):d<=n-a?(f.style.top=`${a}px`,f.style.bottom=``):d<a+c?(f.style.top=``,f.style.bottom=`${n-a}px`):(f.style.top=`${Math.max(0,Math.min(n-d,a))}px`,f.style.bottom=`0`)}#m=!1;#h=null;#g(){if(L&&this.#o.showPopover(),this.#m)return;this.#m=!0;let e=this;this.#h=requestAnimationFrame(function t(){e.#p(),e.#m&&(e.#h=requestAnimationFrame(t))})}#_(){L&&this.#o.hidePopover(),this.#m&&(this.#m=!1,cancelAnimationFrame(this.#h))}#v=e=>{this.contains(e.target)||(this.open=!1)};#y=!1;connectedCallback(){document.addEventListener(`click`,this.#v),this.#y=!0,this.#x()}disconnectedCallback(){document.removeEventListener(`click`,this.#v),this.#y=!1,this.#x()}#b=!1;#x(){let e=!this.readOnly&&!this.disabled&&this.open&&this.#y;this.#b!==e&&(this.#b=e,e?this.#g():this.#_())}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`open`:if(!this.#y)return;this.#x();return;case`placeholder`:this.#a.placeholder=n||``;return;case`readonly`:this.#a.readOnly=n!==null,this.#x();return;case`disabled`:this.#a.disabled=n!==null,this.#x();return}}static observedAttributes=[`open`,`placeholder`,`readonly`,`disabled`]};try{customElements.define(`yongdall-select`,ge)}catch{}function _e(e,t){if(!e||typeof e!=`string`)return r(()=>({where:[],orWhere:[]}));let a=n.parse(e),o=typeof t==`function`?r(()=>[n.fill(a.where,t),n.fill(a.orWhere,t)]):i([a.where,a.orWhere]);return r(()=>{let[e,t]=o.get();return{where:e,orWhere:t}})}var ve=(t,n)=>{let r=t.editable,i=t.store,s=c(t.field?.model||``);if(!r){let e=document.createElement(`span`),n=null;return t.listen(`focus`,()=>e.focus()),t.listen(`scrollIntoView`,()=>e.scrollIntoView()),i?(s.then(async r=>{let i=r.labelPattern||``;if(!o(i).length){a(()=>e.innerText=t.value||``,t.signal);return}async function c(){let t=n;if(!t){e.innerText=``;return}let{document:r}=await s.option(t);!r||t!==n||(e.innerText=u(i,r)||n)}function l(t){let r=t==``||t==null?null:t;r!==n&&(n=r,e.innerText=n||``,c())}a(()=>l(t.value),t.signal)}),e):(a(()=>{e.innerText=t.current[`${t.name}~label`]||t.value},t.signal),e)}let l=document.createElement(`yongdall-select`),p=null;l.addEventListener(`change`,()=>{p=l.value||null,t.value=p}),l.addEventListener(`change`,e=>t.emit(`change`,e)),l.addEventListener(`focus`,e=>t.emit(`focus`,e)),l.addEventListener(`blur`,e=>t.emit(`blur`,e)),t.listen(`focus`,()=>l.focus()),t.listen(`scrollIntoView`,()=>l.scrollIntoView()),a(()=>l.hidden=!!t.hidden,t.signal),a(()=>l.disabled=!!(t.readonly||t.disabled),t.signal),a(()=>l.placeholder=t.placeholder,t.signal),i&&a(()=>l.placeholder=i.placeholder||``,t.signal);function m(n){let r=t.store?.parent;if(!r||(r instanceof e&&(r=r.parent),!r))return null;let i=r,a=0;for(;n[a]===`?`;){a++;let t=i.parent;if(!t||(t instanceof e&&(t=t.parent),!t))break;i=t}for(;n[a]===`?`;)a++;let o=n.slice(a),s=i.child(o);return s?s.value:null}return s.then(async e=>{let r=``,i=[],o=null,c=_e(n?.filter,m),h=!1;function g(){h=!0,o&&clearTimeout(o);let e=l.text;r=e,o=setTimeout(async()=>{if(r!==e)return;let t=await s.options({...c.get(),query:e,limit:100});r===e&&(i=t,x())},300)}l.addEventListener(`input`,g),l.addEventListener(`focus`,()=>{h||g()}),f(()=>c.get(),()=>{l.active&&g()},{signal:t.signal});let _=e.labelPattern||``,v=t=>d(e,t),y=null;async function b(){let e=p;if(!e){y=null,x();return}let t=i.find(t=>v(t)===e);if(t){y=t,x();return}let{option:n}=await s.option(e);!n||e!==p||e===p&&(y=n,x())}function x(){let e=[...i],n=p;if(n){let t=y;t&&v(t)==n&&!e.find(e=>v(e)==n)&&e.push(t)}let r=e.map(e=>{let t=v(e);return{value:t,label:u(_,e)||t,data:e}});t.clearable&&r.unshift({value:``,label:``});let a=r.find(e=>e.value==p);l.value=a?.label||a?.value||``,l.options=r}function S(e){let t=e==``||e==null?null:e;t!==p&&(p=t,l.value=p||``,b())}a(()=>S(t.value),t.signal)}),l};function ye(e){return r(()=>{let t=[...e.get()],n=Object.create(null);for(let e;e=t.shift();){let r=e.children;n[e.value]=e.label;for(let e of r)t.push(e)}return n})}function*be(e,n){if(!e||!n||typeof n==`object`)return;let r=e.parent;if(r instanceof t)for(let[e,t]of Object.entries(n)){let n=r.child(e);n&&typeof t==`string`&&(yield e=>n.value=e[t])}}var xe=(t,n={})=>{let r=t.editable,o=t.store;if(!r){let e=document.createElement(`span`),r=i(``);t.listen(`focus`,()=>e.focus()),t.listen(`scrollIntoView`,()=>e.scrollIntoView());let o=ye(s(n,!1));function c(){let t=r.get();t===``?e.innerText=``:e.innerText=o.get()[t]??``}function l(e){let t=e??``;t!==r&&r.set(t)}return a(()=>l(t.value),t.signal),a(c,t.signal),e}function c(n){let r=t.store?.parent;if(!r||(r instanceof e&&(r=r.parent),!r))return null;let i=r,a=0;for(;n[a]===`?`;){a++;let t=i.parent;if(!t||(t instanceof e&&(t=t.parent),!t))break;i=t}for(;n[a]===`?`;)a++;let o=n.slice(a),s=i.child(o);return s?s.value:null}let l=s(n,c),u=document.createElement(`yongdall-select`),d=i(null),f=[...be(o,n.bind)];u.addEventListener(`change`,()=>{let e=u.value||null;if(d.set(e),t.value=e,!f.length)return;let n=u.current?.data;if(!(!n||typeof n!=`object`))for(let e of f)e(n)}),u.addEventListener(`change`,e=>t.emit(`change`,e)),u.addEventListener(`focus`,e=>t.emit(`focus`,e)),u.addEventListener(`blur`,e=>t.emit(`blur`,e)),t.listen(`focus`,()=>u.focus()),t.listen(`scrollIntoView`,()=>u.scrollIntoView()),a(()=>u.hidden=!!t.hidden,t.signal),a(()=>u.disabled=!!(t.readonly||t.disabled),t.signal),a(()=>u.placeholder=t.placeholder,t.signal),o&&a(()=>u.placeholder=o.placeholder||``,t.signal);let p=null;u.addEventListener(`input`,function(){p&&clearTimeout(p),p=setTimeout(()=>{},300)}),a(()=>{let e=[...l.get()];t.clearable&&e.unshift({value:``,label:``});let n=d.get();u.value=e.find(e=>e.value==n)?.value||``,u.options=e},t.signal);function m(e){let t=e==``||e==null?null:e;t!==d.get()&&(d.set(t),u.value=t||``)}return a(()=>m(t.value),t.signal),u},Se=e=>{let t=document.createElement(`div`),n=t.appendChild(document.createElement(`div`)).appendChild(document.createElement(`label`)),o=n.appendChild(document.createElement(`input`));n.appendChild(document.createTextNode(`全选`)),n.classList.add(`align-center`),o.type=`checkbox`;let s=t.appendChild(document.createElement(`div`)),c=new Set,u=r(()=>new Set(l.get().flatMap(e=>e.children?.map(e=>e.value)||[])));function d(){u.get().size===c.size?(o.indeterminate=!1,o.checked=!0):c.size?o.indeterminate=!0:(o.indeterminate=!1,o.checked=!1)}function f(){c=new Set;for(let{checked:e,value:t}of s.querySelectorAll(`input`))!e||!t||c.add(t);e.value=[...c].map(e=>({permission:e})),d()}function p(){for(let e of s.querySelectorAll(`input`))e.checked=c.has(e.value)}function m(){p(),d()}let h=i([]);function g(){s.innerHTML=``;let e=[];for(let{label:t,children:n}of l.get()){if(!n?.length)continue;let r=s.appendChild(document.createElement(`details`));r.open=!0,r.appendChild(document.createElement(`summary`)).appendChild(document.createTextNode(t));for(let{value:t,label:i}of n){let n=r.appendChild(document.createElement(`label`)),a=n.appendChild(document.createElement(`input`));a.type=`checkbox`,n.appendChild(document.createTextNode(i)),n.classList.add(`align-center`),n.classList.add(`inline`),a.value=String(t||``),a.addEventListener(`input`,f),e.push(a)}}h.set(e),m()}a(()=>g(),e.signal),o.addEventListener(`input`,()=>{if(!o.checked){for(let e of s.querySelectorAll(`input`))e.checked=!1;e.value=[];return}let t=new Set;for(let e of s.querySelectorAll(`input`))e.checked=!0,t.add(e.value);e.value=[...t].map(e=>({permission:e})),p()}),o.addEventListener(`change`,t=>e.emit(`change`,t)),o.addEventListener(`focus`,t=>e.emit(`focus`,t)),o.addEventListener(`blur`,t=>e.emit(`blur`,t));let _=r(()=>!!(!e.editable||e.disabled));e.listen(`focus`,()=>o.focus()),e.listen(`scrollIntoView`,()=>o.scrollIntoView()),a(()=>o.hidden=!!e.hidden,e.signal),a(()=>{let e=_.get();n.hidden=e;for(let t of h.get())t.disabled=e},e.signal),a(()=>o.readOnly=!!e.readonly,e.signal);function v(e){let t=new Set(Array.isArray(e)&&e.map(e=>e.permission)||[]);if(t.size===c.size){for(let e of c)if(!t.has(e))break;return}c=t,m()}return a(()=>v(e.value),e.signal),t};function z(e,t){let{inline:n,showLabel:r,quick:i}=t.style,o=document.createElement(n?`span`:`div`),s=t.field?.label??``;if(r){let e=o.appendChild(document.createElement(n?`span`:`div`));e.innerText=s}let c=e(n?o:o.appendChild(document.createElement(`div`)),i?s:``,e=>{t.value=e});return a(()=>c(t.value),t.signal),o}function Ce(e,t,n){let r=e.appendChild(document.createElement(`textarea`));return t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var B=z.bind(null,Ce);function we(e,t){let n=parseFloat(e);return Number.isFinite(n)?n:t?0:null}function Te(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(we(r.value))),e=>{r.value=e??``}}var V=z.bind(null,Te);function Ee(e,t){let n=parseInt(e);return Number.isFinite(n)?n:t?0:null}function De(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Ee(r.value))),e=>{r.value=e??``}}var H=z.bind(null,De);function Oe(e,t){if(!e)return t?0n:null;try{return BigInt(e)}catch{}return t?0n:null}function ke(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Oe(r.value))),e=>{r.value=e??``}}var U=z.bind(null,ke);function Ae(e,t,n){let r=e.appendChild(document.createElement(`input`));return t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var W=z.bind(null,Ae),G=e=>{let{inline:t,showLabel:n,quick:r}=e.style,i=document.createElement(t?`span`:`div`),o=i.appendChild(document.createElement(`label`)),s=o.appendChild(document.createElement(`input`));return s.type=`checkbox`,s.addEventListener(`input`,()=>{e.value=s.indeterminate?!!s.checked:null}),a(()=>{let t=e.value;if(typeof t==`boolean`){s.checked=t;return}s.indeterminate=!0,t!==null&&(e.value=null)},e.signal),n?o.insertBefore(document.createTextNode(e.field?.label??``),o.firstChild):r&&o.appendChild(document.createTextNode(e.field?.label??``)),i};function je(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`date`,r.step=`1`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var K=z.bind(null,je);function Me(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`time`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var q=z.bind(null,Me);function J(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`datetime-local`,r.step=`1`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var Y=z.bind(null,J);function Ne(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`url`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var X=z.bind(null,Ne);function Pe(e,t,n){let r=e.appendChild(document.createElement(`input`));return t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var Z=z.bind(null,Pe);function Fe(e){if(!e||typeof e!=`string`)return{};let{where:t,orWhere:r}=n.parse(e);return{where:t,orWhere:r}}var Q=(e,t)=>{let{inline:n,showLabel:r,quick:i}=e.style,o=document.createElement(n?`span`:`div`).appendChild(document.createElement(`label`)),s=o.appendChild(document.createElement(`yongdall-select`)),l=c(e.field?.model||``),f=null;return s.addEventListener(`change`,()=>{f=s.value||null,e.value=f}),l.then(async n=>{let r=``,i=[],o=null,c=Fe(t?.filter),p=!1;function m(){p=!0,o&&clearTimeout(o);let e=s.text;r=e,o=setTimeout(async()=>{if(r!==e)return;let t=await l.options({...c,query:e,limit:100});r===e&&(i=t,y())},300)}s.addEventListener(`input`,m),s.addEventListener(`focus`,()=>{p||m()});let h=n.labelPattern||``,g=e=>d(n,e),_=null;async function v(){let e=f;if(!e){_=null,y();return}let t=i.find(t=>g(t)===e);if(t){_=t,y();return}let{option:n}=await l.option(e);!n||e!==f||e===f&&(_=n,y())}function y(){let e=[...i],t=f;if(t){let n=_;n&&g(n)==t&&!e.find(e=>g(e)==t)&&e.push(n)}let n=e.map(e=>{let t=g(e);return{value:t,label:u(h,e)||t,data:e}});n.unshift({value:``,label:``});let r=n.find(e=>e.value==f);s.value=r?.label||r?.value||``,s.options=n}a(()=>{let t=e.value,n=t==``||t==null?null:t;n!==f&&(f=n,s.value=f||``,v())},e.signal)}),r?o.insertBefore(document.createTextNode(e.field?.label??``),o.firstChild):i&&(s.placeholder=e.field?.label??``),s},$=(e,t={})=>{let{inline:n,showLabel:i,quick:o}=e.style,c=document.createElement(n?`span`:`div`).appendChild(document.createElement(`label`)),l=c.appendChild(document.createElement(`yongdall-select`)),u=s(t),d=null;l.addEventListener(`change`,()=>{d=l.value||null,e.value=d});let f=null;function p(){f&&clearTimeout(f),f=setTimeout(()=>{},300)}l.addEventListener(`input`,p);let m=r(()=>{let e=[{value:``,label:``},...u.get()];return e.unshift({value:``,label:``}),e});return a(()=>{l.options=m.get()},e.signal),a(()=>{let t=e.value,n=t==``||t==null?null:t;n!==d&&(d=n,l.value=d||``)},e.signal),i?c.insertBefore(document.createTextNode(e.field?.label??``),c.firstChild):o&&(l.placeholder=e.field?.label??``),l};const Ie=[{type:`text`,input:v,filter:B,notFilter:B,filters:{"=":B,"!=":B}},{type:`string`,input:ie,filter:W,notFilter:W,filters:{"=":W,"!=":W}},{type:`bool`,input:ae,filter:G,notFilter:G,filters:{"=":G,"!=":G}},{type:`f32`,input:x,filter:V,notFilter:V,filters:{"=":V,"!=":V,">":V,">=":V,"<":V,"<=":V}},{type:`f64`,input:x,filter:V,notFilter:V,filters:{"=":V,"!=":V,">":V,">=":V,"<":V,"<=":V}},{type:`i16`,input:C,filter:H,notFilter:H,filters:{"=":H,"!=":H,">":H,">=":H,"<":H,"<=":H}},{type:`i32`,input:C,filter:H,notFilter:H,filters:{"=":H,"!=":H,">":H,">=":H,"<":H,"<=":H}},{type:`i64`,input:re,filter:U,notFilter:U,filters:{"=":U,"!=":U,">":U,">=":U,"<":U,"<=":U}},{type:`date`,input:ce,filter:K,notFilter:K,filters:{"=":K,"!=":K,">":K,">=":K,"<":K,"<=":K}},{type:`time`,input:E,filter:q,notFilter:q,filters:{"=":q,"!=":q,">":q,">=":q,"<":q,"<=":q}},{type:`uuid`,input:I,filter:Z,notFilter:Z,filters:{"=":Z,"!=":Z}},{type:`datetime`,input:k,filter:Y,notFilter:Y,filters:{"=":Y,"!=":Y,">":Y,">=":Y,"<":Y,"<=":Y}},{type:`timetz`,input:E,filter:q,notFilter:q,filters:{"=":q,"!=":q,">":q,">=":q,"<":q,"<=":q}},{type:`timestamp`,input:k,filter:Y,notFilter:Y,filters:{"=":Y,"!=":Y,">":Y,">=":Y,"<":Y,"<=":Y}},{type:`password`,input:A,filter:W,notFilter:W,filters:{"=":W,"!=":W}},{type:`uri`,input:N,filter:X,notFilter:X,filters:{"=":X,"!=":X}},{type:`document`,input:ve,filter:Q,notFilter:Q,filters:{"=":Q,"!=":Q}},{type:`select`,input:xe,filter:$,notFilter:$,filters:{"=":$,"!=":$}},{type:`submodel`,array:!0,renderer:`permission`,input:Se}],Le=[`style.css`];export{Ie as formFields,Le as styles};
|
|
68
|
+
`;let e=this.#a;e.type=`text`;let t=this.#o,n=this.#s;t.className=`dropdown`,n.className=`dropdown-list`,L&&t.setAttribute(`popover`,`manual`),e.addEventListener(`input`,()=>{this.#u()}),e.addEventListener(`focus`,()=>{this.#d()}),e.addEventListener(`blur`,()=>{let t=this.#e,n=e.value,r=this.required;if(!n){if(!t)return;if(r){e.value=t.label;return}this.#e=null,this.#t=null,this.#l();return}if(t?.label===n)return;let i=this.#c.find(e=>e.label===n);if(i){this.#e=i,this.#t=i.value,e.value=i.label,this.#l();return}if(!t){e.value=``;return}r?e.value=t.label:(e.value=``,this.#e=null,this.#t=null,this.#l())}),this.addEventListener(`keydown`,e=>{if(!this.#b)return;let t=this.#n;if(e.key===`ArrowDown`){if(e.preventDefault(),t?.parentNode!==n){let e=n.firstElementChild;if(!e){this.#n=null;return}this.#n=e,e.classList.add(`current`),e.scrollIntoView();return}let r=t.nextElementSibling;if(!r)return;t.classList.remove(`current`),this.#n=r,r.classList.add(`current`),r.scrollIntoView()}if(e.key===`ArrowUp`){if(e.preventDefault(),t?.parentNode!==n){let e=n.lastElementChild;if(!e){this.#n=null;return}this.#n=e,e.classList.add(`current`),e.scrollIntoView();return}let r=t.previousElementSibling;if(!r)return;t.classList.remove(`current`),this.#n=r,r.classList.add(`current`),r.scrollIntoView()}e.key===`Enter`&&(e.preventDefault(),t?.parentNode===n&&t.click())})}get options(){return this.#c}focus(){this.#a.focus()}set options(e){this.#c=e;let t=this.#o,n=this.#s;n.innerHTML=``;for(let t of e){let e=document.createElement(`div`);e.className=`option`,e.appendChild(document.createTextNode(`${Array(t.level||0).fill(` `).join(``)}${t.label}`||` `)),n.appendChild(e),e.addEventListener(`pointerdown`,e=>{e.preventDefault(),this.#f(t)}),e.addEventListener(`click`,e=>{e.preventDefault(),this.#f(t)}),e.addEventListener(`pointermove`,()=>{this.#n?.classList.remove(`current`),this.#n=e,e.classList.add(`current`)})}if(this.#n=n.firstElementChild,this.#n?.classList.add(`current`),t.scrollTop=0,t.scrollLeft=0,R(this.#a)){if(this.#a.value===this.current?.label)return;this.open=!0;return}let r=this.#t,i=this.#c.find(e=>e.value===r);if(i){if(i===this.#e)return;this.#e=i,this.#t=i.value,this.#a.value=i.label||``}}get active(){return R(this.#a)}#c=[];get current(){return this.#e}get value(){return this.#t}set value(e){if(e===this.#t)return;let t=this.#c.find(t=>t.value===e);if(!t){this.#e=null,this.#t=e,this.#a.value=e;return}t!==this.#e&&(this.#e=t,this.#t=t.value,this.#a.value=t.label||``)}#l(){this.dispatchEvent(new Event(`change`))}#u(){this.dispatchEvent(new Event(`input`))}#d(){this.open=!0,this.dispatchEvent(new Event(`focus`))}get text(){return this.#a.value}#f(e){this.#e=e,this.#t=e?.value,this.#a.value=e?.label||``,this.#l(),this.open=!1,this.#a.focus()}get open(){return this.getAttribute(`open`)!==null}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get disabled(){return this.getAttribute(`disabled`)!==null}set disabled(e){e?this.setAttribute(`disabled`,``):this.removeAttribute(`disabled`)}get readOnly(){return this.getAttribute(`readonly`)!==null}set readOnly(e){e?this.setAttribute(`readonly`,``):this.removeAttribute(`readonly`)}get required(){return this.getAttribute(`required`)!==null}set required(e){e?this.setAttribute(`required`,``):this.removeAttribute(`required`)}get placeholder(){return this.getAttribute(`placeholder`)||``}set placeholder(e){e?this.setAttribute(`placeholder`,e):this.removeAttribute(`placeholder`)}#p(){let e=this.#a.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight,r=t-e.right,i=n-e.bottom,{top:a,left:o,width:s,height:c}=e,l=this.#s.getBoundingClientRect(),u=l.width-2,d=l.height-2,f=this.#o;f.style.maxWidth=``,f.style.minWidth=``,f.style.top=`${a+c}px`,f.style.minWidth=`${s}px`,f.style.maxHeight=`${n-a-c-4}px`,u<=t-o?(f.style.left=`${o}px`,f.style.right=``):u<=t-o?(f.style.left=`${o}px`,f.style.right=`${t-o}px`):(f.style.left=`${Math.max(0,Math.min((u-s)/2,o))}px`,f.style.right=``);let p=0;d<=i-20?(p=1,f.style.top=`${a+c}px`,f.style.minWidth=`${s}px`,f.style.bottom=``):d<=a?(p=1,f.style.top=``,f.style.bottom=`${i+c}px`):Math.max(o,r-20)<Math.min(u,e.right-o)?i-20>=a?(p=1,f.style.top=`${a+c}px`,f.style.minWidth=`${s}px`,f.style.bottom=``):d<=a&&(p=1,f.style.top=``,f.style.bottom=`${i+c}px`):u<=r-20||o<=r-20?(f.style.left=`${o+s}px`,f.style.maxWidth=`${r}px`,f.style.right=``):(f.style.left=``,f.style.right=`${r+s}px`,f.style.maxWidth=`${o}px`),p?u<=t-o?(f.style.left=`${o}px`,f.style.right=``):u<=t-o?(f.style.left=`${o}px`,f.style.right=`${t-o}px`):(f.style.left=`${Math.max(0,Math.min((u-s)/2,o))}px`,f.style.right=``):d<=n-a?(f.style.top=`${a}px`,f.style.bottom=``):d<a+c?(f.style.top=``,f.style.bottom=`${n-a}px`):(f.style.top=`${Math.max(0,Math.min(n-d,a))}px`,f.style.bottom=`0`)}#m=!1;#h=null;#g(){if(L&&this.#o.showPopover(),this.#m)return;this.#m=!0;let e=this;this.#h=requestAnimationFrame(function t(){e.#p(),e.#m&&(e.#h=requestAnimationFrame(t))})}#_(){L&&this.#o.hidePopover(),this.#m&&(this.#m=!1,cancelAnimationFrame(this.#h))}#v=e=>{this.contains(e.target)||(this.open=!1)};#y=!1;connectedCallback(){document.addEventListener(`click`,this.#v),this.#y=!0,this.#x()}disconnectedCallback(){document.removeEventListener(`click`,this.#v),this.#y=!1,this.#x()}#b=!1;#x(){let e=!this.readOnly&&!this.disabled&&this.open&&this.#y;this.#b!==e&&(this.#b=e,e?this.#g():this.#_())}attributeChangedCallback(e,t,n){if(t!==n)switch(e){case`open`:if(!this.#y)return;this.#x();return;case`placeholder`:this.#a.placeholder=n||``;return;case`readonly`:this.#a.readOnly=n!==null,this.#x();return;case`disabled`:this.#a.disabled=n!==null,this.#x();return}}static observedAttributes=[`open`,`placeholder`,`readonly`,`disabled`]};try{customElements.define(`yongdall-select`,ge)}catch{}function _e(e,t){if(!e||typeof e!=`string`)return r(()=>({where:[],orWhere:[]}));let a=n.parse(e),o=typeof t==`function`?r(()=>[n.fill(a.where,t),n.fill(a.orWhere,t)]):i([a.where,a.orWhere]);return r(()=>{let[e,t]=o.get();return{where:e,orWhere:t}})}var ve=(t,n)=>{let r=t.editable,i=t.store,s=c(t.field?.model||``);if(!r){let e=document.createElement(`span`),n=null;return t.listen(`focus`,()=>e.focus()),t.listen(`scrollIntoView`,()=>e.scrollIntoView()),i?(s.then(async r=>{let i=r.labelPattern||``;if(!o(i).length){a(()=>e.innerText=t.value||``,t.signal);return}async function c(){let t=n;if(!t){e.innerText=``;return}let{option:r}=await s.option(t);!r||t!==n||(e.innerText=u(i,r)||n)}function l(t){let r=t==``||t==null?null:t;r!==n&&(n=r,e.innerText=n||``,c())}a(()=>l(t.value),t.signal)}),e):(a(()=>{e.innerText=t.current[`${t.name}~label`]||t.value},t.signal),e)}let l=document.createElement(`yongdall-select`),p=null;l.addEventListener(`change`,()=>{p=l.value||null,t.value=p}),l.addEventListener(`change`,e=>t.emit(`change`,e)),l.addEventListener(`focus`,e=>t.emit(`focus`,e)),l.addEventListener(`blur`,e=>t.emit(`blur`,e)),t.listen(`focus`,()=>l.focus()),t.listen(`scrollIntoView`,()=>l.scrollIntoView()),a(()=>l.hidden=!!t.hidden,t.signal),a(()=>l.disabled=!!(t.readonly||t.disabled),t.signal),a(()=>l.placeholder=t.placeholder,t.signal),i&&a(()=>l.placeholder=i.placeholder||``,t.signal);function m(n){let r=t.store?.parent;if(!r||(r instanceof e&&(r=r.parent),!r))return null;let i=r,a=0;for(;n[a]===`?`;){a++;let t=i.parent;if(!t||(t instanceof e&&(t=t.parent),!t))break;i=t}for(;n[a]===`?`;)a++;let o=n.slice(a),s=i.child(o);return s?s.value:null}return s.then(async e=>{let r=``,i=[],o=null,c=_e(n?.filter,m),h=!1;function g(){h=!0,o&&clearTimeout(o);let e=l.text;r=e,o=setTimeout(async()=>{if(r!==e)return;let t=await s.options({...c.get(),query:e,limit:100});r===e&&(i=t,x())},300)}l.addEventListener(`input`,g),l.addEventListener(`focus`,()=>{h||g()}),f(()=>c.get(),()=>{l.active&&g()},{signal:t.signal});let _=e.labelPattern||``,v=t=>d(e,t),y=null;async function b(){let e=p;if(!e){y=null,x();return}let t=i.find(t=>v(t)===e);if(t){y=t,x();return}let{option:n}=await s.option(e);!n||e!==p||e===p&&(y=n,x())}function x(){let e=[...i],n=p;if(n){let t=y;t&&v(t)==n&&!e.find(e=>v(e)==n)&&e.push(t)}let r=e.map(e=>{let t=v(e);return{value:t,label:u(_,e)||t,data:e}});t.clearable&&r.unshift({value:``,label:``});let a=r.find(e=>e.value==p);l.value=a?.label||a?.value||``,l.options=r}function S(e){let t=e==``||e==null?null:e;t!==p&&(p=t,l.value=p||``,b())}a(()=>S(t.value),t.signal)}),l};function ye(e){return r(()=>{let t=[...e.get()],n=Object.create(null);for(let e;e=t.shift();){let r=e.children;n[e.value]=e.label;for(let e of r)t.push(e)}return n})}function*be(e,n){if(!e||!n||typeof n==`object`)return;let r=e.parent;if(r instanceof t)for(let[e,t]of Object.entries(n)){let n=r.child(e);n&&typeof t==`string`&&(yield e=>n.value=e[t])}}var xe=(t,n={})=>{let r=t.editable,o=t.store;if(!r){let e=document.createElement(`span`),r=i(``);t.listen(`focus`,()=>e.focus()),t.listen(`scrollIntoView`,()=>e.scrollIntoView());let o=ye(s(n,!1));function c(){let t=r.get();t===``?e.innerText=``:e.innerText=o.get()[t]??``}function l(e){let t=e??``;t!==r&&r.set(t)}return a(()=>l(t.value),t.signal),a(c,t.signal),e}function c(n){let r=t.store?.parent;if(!r||(r instanceof e&&(r=r.parent),!r))return null;let i=r,a=0;for(;n[a]===`?`;){a++;let t=i.parent;if(!t||(t instanceof e&&(t=t.parent),!t))break;i=t}for(;n[a]===`?`;)a++;let o=n.slice(a),s=i.child(o);return s?s.value:null}let l=s(n,c),u=document.createElement(`yongdall-select`),d=i(null),f=[...be(o,n.bind)];u.addEventListener(`change`,()=>{let e=u.value||null;if(d.set(e),t.value=e,!f.length)return;let n=u.current?.data;if(!(!n||typeof n!=`object`))for(let e of f)e(n)}),u.addEventListener(`change`,e=>t.emit(`change`,e)),u.addEventListener(`focus`,e=>t.emit(`focus`,e)),u.addEventListener(`blur`,e=>t.emit(`blur`,e)),t.listen(`focus`,()=>u.focus()),t.listen(`scrollIntoView`,()=>u.scrollIntoView()),a(()=>u.hidden=!!t.hidden,t.signal),a(()=>u.disabled=!!(t.readonly||t.disabled),t.signal),a(()=>u.placeholder=t.placeholder,t.signal),o&&a(()=>u.placeholder=o.placeholder||``,t.signal);let p=null;u.addEventListener(`input`,function(){p&&clearTimeout(p),p=setTimeout(()=>{},300)}),a(()=>{let e=[...l.get()];t.clearable&&e.unshift({value:``,label:``});let n=d.get();u.value=e.find(e=>e.value==n)?.value||``,u.options=e},t.signal);function m(e){let t=e==``||e==null?null:e;t!==d.get()&&(d.set(t),u.value=t||``)}return a(()=>m(t.value),t.signal),u},Se=e=>{let t=document.createElement(`div`),n=t.appendChild(document.createElement(`div`)).appendChild(document.createElement(`label`)),o=n.appendChild(document.createElement(`input`));n.appendChild(document.createTextNode(`全选`)),n.classList.add(`align-center`),o.type=`checkbox`;let s=t.appendChild(document.createElement(`div`)),c=new Set,u=r(()=>new Set(l.get().flatMap(e=>e.children?.map(e=>e.value)||[])));function d(){u.get().size===c.size?(o.indeterminate=!1,o.checked=!0):c.size?o.indeterminate=!0:(o.indeterminate=!1,o.checked=!1)}function f(){c=new Set;for(let{checked:e,value:t}of s.querySelectorAll(`input`))!e||!t||c.add(t);e.value=[...c].map(e=>({permission:e})),d()}function p(){for(let e of s.querySelectorAll(`input`))e.checked=c.has(e.value)}function m(){p(),d()}let h=i([]);function g(){s.innerHTML=``;let e=[];for(let{label:t,children:n}of l.get()){if(!n?.length)continue;let r=s.appendChild(document.createElement(`details`));r.open=!0,r.appendChild(document.createElement(`summary`)).appendChild(document.createTextNode(t));for(let{value:t,label:i}of n){let n=r.appendChild(document.createElement(`label`)),a=n.appendChild(document.createElement(`input`));a.type=`checkbox`,n.appendChild(document.createTextNode(i)),n.classList.add(`align-center`),n.classList.add(`inline`),a.value=String(t||``),a.addEventListener(`input`,f),e.push(a)}}h.set(e),m()}a(()=>g(),e.signal),o.addEventListener(`input`,()=>{if(!o.checked){for(let e of s.querySelectorAll(`input`))e.checked=!1;e.value=[];return}let t=new Set;for(let e of s.querySelectorAll(`input`))e.checked=!0,t.add(e.value);e.value=[...t].map(e=>({permission:e})),p()}),o.addEventListener(`change`,t=>e.emit(`change`,t)),o.addEventListener(`focus`,t=>e.emit(`focus`,t)),o.addEventListener(`blur`,t=>e.emit(`blur`,t));let _=r(()=>!!(!e.editable||e.disabled));e.listen(`focus`,()=>o.focus()),e.listen(`scrollIntoView`,()=>o.scrollIntoView()),a(()=>o.hidden=!!e.hidden,e.signal),a(()=>{let e=_.get();n.hidden=e;for(let t of h.get())t.disabled=e},e.signal),a(()=>o.readOnly=!!e.readonly,e.signal);function v(e){let t=new Set(Array.isArray(e)&&e.map(e=>e.permission)||[]);if(t.size===c.size){for(let e of c)if(!t.has(e))break;return}c=t,m()}return a(()=>v(e.value),e.signal),t};function z(e,t){let{inline:n,showLabel:r,quick:i}=t.style,o=document.createElement(n?`span`:`div`),s=t.field?.label??``;if(r){let e=o.appendChild(document.createElement(n?`span`:`div`));e.innerText=s}let c=e(n?o:o.appendChild(document.createElement(`div`)),i?s:``,e=>{t.value=e});return a(()=>c(t.value),t.signal),o}function Ce(e,t,n){let r=e.appendChild(document.createElement(`textarea`));return t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var B=z.bind(null,Ce);function we(e,t){let n=parseFloat(e);return Number.isFinite(n)?n:t?0:null}function Te(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(we(r.value))),e=>{r.value=e??``}}var V=z.bind(null,Te);function Ee(e,t){let n=parseInt(e);return Number.isFinite(n)?n:t?0:null}function De(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Ee(r.value))),e=>{r.value=e??``}}var H=z.bind(null,De);function Oe(e,t){if(!e)return t?0n:null;try{return BigInt(e)}catch{}return t?0n:null}function ke(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Oe(r.value))),e=>{r.value=e??``}}var U=z.bind(null,ke);function Ae(e,t,n){let r=e.appendChild(document.createElement(`input`));return t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var W=z.bind(null,Ae),G=e=>{let{inline:t,showLabel:n,quick:r}=e.style,i=document.createElement(t?`span`:`div`),o=i.appendChild(document.createElement(`label`)),s=o.appendChild(document.createElement(`input`));return s.type=`checkbox`,s.addEventListener(`input`,()=>{e.value=s.indeterminate?!!s.checked:null}),a(()=>{let t=e.value;if(typeof t==`boolean`){s.checked=t;return}s.indeterminate=!0,t!==null&&(e.value=null)},e.signal),n?o.insertBefore(document.createTextNode(e.field?.label??``),o.firstChild):r&&o.appendChild(document.createTextNode(e.field?.label??``)),i};function je(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`date`,r.step=`1`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var K=z.bind(null,je);function Me(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`time`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var q=z.bind(null,Me);function J(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`datetime-local`,r.step=`1`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var Y=z.bind(null,J);function Ne(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`url`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var X=z.bind(null,Ne);function Pe(e,t,n){let r=e.appendChild(document.createElement(`input`));return t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(r.value||null)),e=>{r.value=e??``}}var Z=z.bind(null,Pe);function Fe(e){if(!e||typeof e!=`string`)return{};let{where:t,orWhere:r}=n.parse(e);return{where:t,orWhere:r}}var Q=(e,t)=>{let{inline:n,showLabel:r,quick:i}=e.style,o=document.createElement(n?`span`:`div`).appendChild(document.createElement(`label`)),s=o.appendChild(document.createElement(`yongdall-select`)),l=c(e.field?.model||``),f=null;return s.addEventListener(`change`,()=>{f=s.value||null,e.value=f}),l.then(async n=>{let r=``,i=[],o=null,c=Fe(t?.filter),p=!1;function m(){p=!0,o&&clearTimeout(o);let e=s.text;r=e,o=setTimeout(async()=>{if(r!==e)return;let t=await l.options({...c,query:e,limit:100});r===e&&(i=t,y())},300)}s.addEventListener(`input`,m),s.addEventListener(`focus`,()=>{p||m()});let h=n.labelPattern||``,g=e=>d(n,e),_=null;async function v(){let e=f;if(!e){_=null,y();return}let t=i.find(t=>g(t)===e);if(t){_=t,y();return}let{option:n}=await l.option(e);!n||e!==f||e===f&&(_=n,y())}function y(){let e=[...i],t=f;if(t){let n=_;n&&g(n)==t&&!e.find(e=>g(e)==t)&&e.push(n)}let n=e.map(e=>{let t=g(e);return{value:t,label:u(h,e)||t,data:e}});n.unshift({value:``,label:``});let r=n.find(e=>e.value==f);s.value=r?.label||r?.value||``,s.options=n}a(()=>{let t=e.value,n=t==``||t==null?null:t;n!==f&&(f=n,s.value=f||``,v())},e.signal)}),r?o.insertBefore(document.createTextNode(e.field?.label??``),o.firstChild):i&&(s.placeholder=e.field?.label??``),s},$=(e,t={})=>{let{inline:n,showLabel:i,quick:o}=e.style,c=document.createElement(n?`span`:`div`).appendChild(document.createElement(`label`)),l=c.appendChild(document.createElement(`yongdall-select`)),u=s(t),d=null;l.addEventListener(`change`,()=>{d=l.value||null,e.value=d});let f=null;function p(){f&&clearTimeout(f),f=setTimeout(()=>{},300)}l.addEventListener(`input`,p);let m=r(()=>{let e=[{value:``,label:``},...u.get()];return e.unshift({value:``,label:``}),e});return a(()=>{l.options=m.get()},e.signal),a(()=>{let t=e.value,n=t==``||t==null?null:t;n!==d&&(d=n,l.value=d||``)},e.signal),i?c.insertBefore(document.createTextNode(e.field?.label??``),c.firstChild):o&&(l.placeholder=e.field?.label??``),l};const Ie=[{type:`text`,input:v,filter:B,notFilter:B,filters:{"=":B,"!=":B}},{type:`string`,input:ie,filter:W,notFilter:W,filters:{"=":W,"!=":W}},{type:`bool`,input:ae,filter:G,notFilter:G,filters:{"=":G,"!=":G}},{type:`f32`,input:x,filter:V,notFilter:V,filters:{"=":V,"!=":V,">":V,">=":V,"<":V,"<=":V}},{type:`f64`,input:x,filter:V,notFilter:V,filters:{"=":V,"!=":V,">":V,">=":V,"<":V,"<=":V}},{type:`i16`,input:C,filter:H,notFilter:H,filters:{"=":H,"!=":H,">":H,">=":H,"<":H,"<=":H}},{type:`i32`,input:C,filter:H,notFilter:H,filters:{"=":H,"!=":H,">":H,">=":H,"<":H,"<=":H}},{type:`i64`,input:re,filter:U,notFilter:U,filters:{"=":U,"!=":U,">":U,">=":U,"<":U,"<=":U}},{type:`date`,input:ce,filter:K,notFilter:K,filters:{"=":K,"!=":K,">":K,">=":K,"<":K,"<=":K}},{type:`time`,input:E,filter:q,notFilter:q,filters:{"=":q,"!=":q,">":q,">=":q,"<":q,"<=":q}},{type:`uuid`,input:I,filter:Z,notFilter:Z,filters:{"=":Z,"!=":Z}},{type:`datetime`,input:k,filter:Y,notFilter:Y,filters:{"=":Y,"!=":Y,">":Y,">=":Y,"<":Y,"<=":Y}},{type:`timetz`,input:E,filter:q,notFilter:q,filters:{"=":q,"!=":q,">":q,">=":q,"<":q,"<=":q}},{type:`timestamp`,input:k,filter:Y,notFilter:Y,filters:{"=":Y,"!=":Y,">":Y,">=":Y,"<":Y,"<=":Y}},{type:`password`,input:A,filter:W,notFilter:W,filters:{"=":W,"!=":W}},{type:`uri`,input:N,filter:X,notFilter:X,filters:{"=":X,"!=":X}},{type:`document`,input:ve,filter:Q,notFilter:Q,filters:{"=":Q,"!=":Q}},{type:`select`,input:xe,filter:$,notFilter:$,filters:{"=":$,"!=":$}},{type:`submodel`,array:!0,renderer:`permission`,input:Se}],Le=[`style.css`];export{Ie as formFields,Le as styles};
|
|
69
69
|
//# sourceMappingURL=hooks.mjs.map
|