@yongdall/theme 0.4.0 → 0.4.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/hooks.mjs +2 -2
- package/hooks.mjs.map +1 -1
- package/index.mjs +25 -25
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/hooks.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ArrayStore as e,BindObjectStore as t,Pagination as n,Search as r,createComputed as i,createQuickFilters as a,createShowField as o,createState as s,effect as c,getPatternFields as l,getPermissionFields as u,getPrimaryFields as d,importStyle as f,importWidget as p,modelService as m,permissionsService as h,renderForm as g,runPattern as _,showFilterDialog as v,toId as y,waitAbortSignal as ee,watch as te}from"@yongdall/web";import{Check as ne,Source as re}from"@neeloong/table";function b(e){let t=document.createElement(`div`),n=t;return n.style.overflow=`hidden`,n.style.whiteSpace=`nowrap`,n.style.textOverflow=`ellipsis`,e.listen(`scrollIntoView`,()=>t.scrollIntoView()),[t,e=>{n.title=n.innerText=e??``}]}function x(e,t,n,r,i){let a=e.editable,o=e.field?.nullable?null:i,[s,l]=(a?t:n)(e,t=>{o=r(t,e.field?.nullable),e.value=o});function u(e,t){!t&&e===o||(o=e,l(e))}return u(e.value,!0),c(()=>u(e.value),e.signal),s}function ie(e){let t=document.createElement(`div`),n=t;return e.listen(`scrollIntoView`,()=>t.scrollIntoView()),[t,e=>{n.innerText=e??``}]}function ae(e,t){return e||!t?e:null}function oe(e,t){let n=document.createElement(`textarea`);return n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var se=e=>x(e,oe,ie,ae,``);function ce(e,t){let n=parseFloat(e);return Number.isFinite(n)?n:t?null:0}function le(e,t){let n=document.createElement(`input`);return n.type=`number`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var S=e=>x(e,le,b,ce,0);function C(e,t){let n=parseInt(e);return Number.isFinite(n)?n:t?null:0}function w(e,t){let n=document.createElement(`input`);return n.type=`number`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var T=e=>x(e,w,b,C,0);function ue(e,t){if(!e)return t?null:0n;try{return BigInt(e)}catch{}return t?null:0n}function de(e,t){let n=document.createElement(`input`);return n.type=`number`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var E=e=>x(e,de,b,ue,0n);function fe(e,t){return e||!t?e:null}function pe(e,t){let n=document.createElement(`input`);return n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var D=e=>x(e,pe,b,fe,``),O=e=>{let t=document.createElement(`input`);t.type=`checkbox`;let n=e.editable,r=e.field?.nullable?null:!1;n?(t.addEventListener(`input`,()=>{r=!!t.checked,e.value=r}),t.addEventListener(`change`,t=>e.emit(`change`,t)),t.addEventListener(`focus`,t=>e.emit(`focus`,t)),t.addEventListener(`blur`,t=>e.emit(`blur`,t))):t.disabled=!0,c(()=>t.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>t.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>t.focus()),e.listen(`scrollIntoView`,()=>t.scrollIntoView());function i(n){let i=!e.field?.nullable||typeof n==`boolean`?!!n:null;i!==r&&(r=i,t.checked=!!i)}return c(()=>i(e.value),e.signal),t};function me(e,t){return Number.isFinite(new Date(e).valueOf())?e:t?null:``}function he(e,t){let n=document.createElement(`input`);return n.type=`date`,n.step=`1`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var k=e=>x(e,he,b,me,``);function A(e,t){let n=new Date(e);return Number.isFinite(n)?e:t?null:``}function j(e,t){let n=document.createElement(`input`);return n.type=`time`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var ge=e=>x(e,j,b,A,``);function M(e,t){let n=new Date(e);return Number.isFinite(n.valueOf())?n:null}function N(e,t){return e.valueOf()?`${[`${e.getFullYear()}`.padStart(4,`0`),`${e.getMonth()+1}`.padStart(2,`0`),`${e.getDate()}`.padStart(2,`0`)].join(`-`)}${t}${[`${e.getHours()}`.padStart(2,`0`),`${e.getMinutes()}`.padStart(2,`0`),`${e.getSeconds()}`.padStart(2,`0`)].join(`:`)}`:``}function P(e,t=`T`){return e instanceof Date?N(e,t):N(new Date(e),t)??``}function F(e){let t=document.createElement(`div`),n=t;return n.style.overflow=`hidden`,n.style.whiteSpace=`nowrap`,n.style.textOverflow=`ellipsis`,e.listen(`scrollIntoView`,()=>t.scrollIntoView()),[t,e=>{n.title=n.innerText=P(e,` `)}]}function I(e,t){let n=document.createElement(`input`);return n.type=`datetime-local`,n.step=`1`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=P(e)}]}var L=e=>x(e,I,F,M,null);function R(e,t){return e||!t?e:null}function _e(e,t){let n=document.createElement(`input`);return n.type=`password`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var z=e=>x(e,_e,b,R,``);function ve(e,t){return e||!t?e:null}function ye(e,t){let n=document.createElement(`input`);return n.type=`url`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var B=e=>x(e,ye,b,ve,``);function be(e,t){return e||!t?e:null}function xe(e,t){let n=document.createElement(`input`);return n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var Se=e=>x(e,xe,b,be,``);f(`@neeloong/table/style.css`);async function Ce(t,f,p,m,h,g){let b=ee(m,!0),x=await Promise.race([p.loadScript(),b]);if(!x)return Promise.reject();let ie=g?.fields,ae=g?.queryFilters||[];function oe(n){let r=t?.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 se=r.parse(g?.search||``),ce=i(()=>r.fill(se.where,oe)),le=i(()=>r.fill(se.orWhere,oe)),S=s([]),C=s(100),w=s(1),T=s([]),ue=f.appendChild(document.createElement(`div`)),de=ue.appendChild(document.createElement(`div`)),E=ue.appendChild(document.createElement(`div`)),fe=f.appendChild(document.createElement(`div`)),pe=f.appendChild(document.createElement(`div`)),D=new re({idKey:`_`,parentKey:`parent`});D.selectable=!0;let O=x.fields,me=u(`options`,x.permissions||[],x),he=Object.entries(O).filter(([,{type:e}])=>e&&typeof e!=`object`).filter(([e])=>me.has(e)),k=d(x),A=x.labelPattern||``,j=[];for(let{field:e,width:t,label:n}of ie||[]){if(!e||!Object.hasOwn(O,e))continue;let r=O[e];if(!r)continue;let i=r.type;!i||typeof i!=`string`||j.push({name:e,width:t||void 0,title:n||r.label||``,field:r})}if(!j.length){for(let[e,t]of he)if(j.push({name:e,title:t.label||``,field:t}),j.length>=4)break}let ge=[...new Set([...j.map(e=>e.name),...k,...l(A)])];c(()=>D.setValue(T.get()),m);let M=j.map(({name:e,field:t,title:n,width:r})=>({field:e,title:n,width:r,resizable:!0,render(n){let r=document.createElement(`div`),i=o(e,t,{},n.data);return r.appendChild(i.root),{root:r,destroy(){i.destroy()},setHidden(){},update(n){i.destroy(),r.innerHTML=``,i=o(e,t,{},n.data),r.appendChild(i.root)}}}}));M.unshift({field:`_`,width:200,resizable:!0,render(e){let t=e.data,n=document.createElement(`div`),r=_(A,t)||k.map(e=>t[e]).join(`$`);return n.appendChild(document.createTextNode(r)),{root:n,destroy(){},setHidden(){},update(e){let t=e.data,r=_(A,t)||k.map(e=>t[e]).join(`$`);n.innerHTML=``,n.appendChild(document.createTextNode(r))}}}}),h&&M.unshift({field:`_`,extensions:[ne],render(e){return{root:document.createElement(`div`),destroy(){},setHidden(){},update(){}}}});let N=D.createGroup(M,2),P=document.createElement(`table`);N.createHeader(P.appendChild(document.createElement(`div`))),N.createBody(P.appendChild(document.createElement(`div`)));let F=new n;te(()=>C.get(),e=>F.size=e||100,{immediate:!0,signal:m}),te(()=>w.get(),e=>F.page=e||1,{immediate:!0,signal:m}),F.listen(()=>{w.set(F.page),C.set(F.size)});let I=0,L=s(!1);async function R(){if(!m.aborted&&!L.get())try{L.set(!0),I++;let e=I,{options:t,total:n}=await p.options({limit:C.get(),page:w.get(),where:[...S.get()||[],...ce.get()||[]],or:le.get(),select:ge,total:!0});if(m.aborted||e!==I)return;T.set(t.map(e=>({...e,_:y(e,k)}))),F.total=n}finally{L.set(!1)}}function _e(){x&&v(x,S.get(),f).then(e=>{S.set(e)}).catch(()=>{})}function z(e,t,n){let r=document.createElement(`button`);r.appendChild(document.createTextNode(e));let a=i(()=>!!n?.get());return c(()=>{r.disabled=a.get()},m),r.addEventListener(`click`,e=>{a.get()||e.defaultPrevented||t()}),r}let{promise:ve,reject:ye,resolve:B}=Promise.withResolvers();return E.appendChild(z(`刷新`,R,L)),E.appendChild(z(`过滤`,_e)),E.appendChild(z(`确定`,()=>{let e=[];if(h){if(e=D.checked,!e.length)return B([])}else{let t=D.selectedId;if(!t)return B(null);e=[t]}if(!e.length){B(h?[]:null);return}let t=T.get(),n=Object.fromEntries(t.map(e=>[e._,e])),r=[...new Set(e.map(e=>n[e]).filter(Boolean))].map(e=>({value:e._,label:_(A,e)||e._,data:e}));B(h?r:r[0])})),E.appendChild(z(`取消`,()=>{ye()})),de.classList.add(`QueryFilters`),a({get(){return S.get()||[]},set(e){S.set(e),R()}},de,ae||[],{fields:x.fields,signal:m,inline:!0}),fe.appendChild(P),pe.appendChild(F.root),te([()=>S.get(),()=>C.get(),()=>w.get()],R,{signal:m,immediate:!0}),Promise.race([ve,b]).finally(()=>{ue.remove(),fe.remove(),pe.remove()})}var we=e=>{let t=e.editable,n=e.store||null,r=m(e.field?.model||``),i=document.createElement(`div`);i.classList=`InputDocument`;let a=i.appendChild(document.createElement(`div`)),o=a.appendChild(document.createElement(`div`)),u=a.appendChild(document.createElement(`div`));o.classList=`InputDocument-placeholder`,e.listen(`scrollIntoView`,()=>a.scrollIntoView()),e.listen(`focus`,()=>a.focus());let d=null,f=null,p=s(),h=null;return c(()=>o.innerText=e.placeholder,e.signal),c(()=>{let e=p.get()||``;u.innerText=e,o.hidden=!!e},e.signal),c(async()=>{let t=e.value,n=t==``||t==null?null:t;if(d===n)return;d=n;let i=e.current[`${e.name}~label`];if(i){f=null,d=null,p.set(i);return}if(f=d,p.set(d||``),!d)return;let a=await r;if(!a)return;let o=a.labelPattern||``;if(!l(o).length)return;let{option:s}=await r.option(d);!s||d!==f||p.set(_(o,s)||d)},e.signal),t?(a.classList=`InputDocument-text`,c(()=>{e.readonly||e.disabled?(a.removeAttribute(`tabIndex`),h?.abort(),h=null,a.setAttribute(`disabled`,``)):(a.tabIndex=0,a.removeAttribute(`disabled`))},e.signal),a.addEventListener(`click`,async()=>{if(e.readonly||e.disabled)return;h?.abort(),h=new AbortController,e.emit(`focus`,null);let t=i.appendChild(document.createElement(`dialog`));t.showModal();try{let i=await Ce(n,t,r,AbortSignal.any([h.signal,e.signal]),!1,e.source),a=Array.isArray(i)?i[0]:i;if(!a){if(!e.value)return;(e.clearable||e.nullable)&&(d=``,f=null,e.value=e.nullable?null:``,p.set(``),e.emit(`change`,null));return}let o=a.value;if(o===e.value)return;d=o,e.value=o,f=null,p.set(a.label||o),e.emit(`change`,o),e.bind?.(a.data)}finally{t.remove(),e.emit(`blur`,null)}}),i):i};function Te(e,t){return e.length===t.length?e.findIndex((e,n)=>e!=t[n])===-1:!1}var Ee=e=>{let t=e.editable,n=e.store||null,r=m(e.field?.model||``),i=document.createElement(`div`);i.classList=`InputDocument`;let a=i.appendChild(document.createElement(`div`)),o=a.appendChild(document.createElement(`div`)),u=a.appendChild(document.createElement(`div`));o.classList=`InputDocument-placeholder`,e.listen(`scrollIntoView`,()=>a.scrollIntoView()),e.listen(`focus`,()=>a.focus());let f=[],p=[],h=s([]),g=null;return c(()=>o.innerText=e.placeholder,e.signal),c(()=>{let e=h.get();u.innerHTML=``;for(let t of e){let e=u.appendChild(document.createElement(`span`));e.innerText=t,e.classList=`InputDocument-Item`}o.hidden=!!e.length},e.signal),c(async()=>{let t=e.value,n=(Array.isArray(t)?t:[t]).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).filter(Boolean);if(Te(f,n))return;f=n;let i=e.current[`${e.name}~label`];if(i){p=[],f=[],h.set(i);return}if(p=f,h.set(f),!f.length)return;let a=await r;if(!a)return;let o=a.labelPattern||``;if(!l(o).length)return;let{options:s}=await r.options({primary:f,limit:f.length*10});if(!s.length||f!==p)return;let c=d(a),u=Object.fromEntries(s.map(e=>[y(e,c),e]));f.map(e=>{let t=Object.hasOwn(u,e)&&u[e];return t&&_(o,t)||e}),h.set(f.map(e=>{let t=Object.hasOwn(u,e)&&u[e];return t&&_(o,t)||e}))},e.signal),t?(a.classList=`InputDocument-text`,c(()=>{e.readonly||e.disabled?(a.removeAttribute(`tabIndex`),g?.abort(),g=null,a.setAttribute(`disabled`,``)):(a.tabIndex=0,a.removeAttribute(`disabled`))},e.signal),a.addEventListener(`click`,async()=>{if(e.readonly||e.disabled)return;g?.abort(),g=new AbortController,e.emit(`focus`,null);let t=i.appendChild(document.createElement(`dialog`));t.showModal();try{let i=await Ce(n,t,r,AbortSignal.any([g.signal,e.signal]),!0,e.source),a=Array.isArray(i)?i:i?[i]:[];if(!a.length){if(!e.value?.length)return;e.clearable||e.nullable?(f=[],p=[],e.value=e.nullable?null:[],h.set([]),e.emit(`change`,null)):e.value=[];return}let o=a.map(e=>e.value);if(Te(o,e.value))return;f=o,e.value=o,p=[],h.set(a.map(e=>e.label||e.value)),e.emit(`change`,null)}finally{t.remove(),e.emit(`blur`,null)}}),i):i},De=e=>{if(!e.editable){let t=document.createElement(`span`),n=s(``);e.listen(`focus`,()=>t.focus()),e.listen(`scrollIntoView`,()=>t.scrollIntoView());function r(){let r=n.get();r===``?t.innerText=``:t.innerText=e.source.labels[r]??r}function i(e){let t=e??``;t!==n&&n.set(t)}return c(()=>i(e.value),e.signal),c(r,e.signal),t}let t=document.createElement(`select`);t.addEventListener(`change`,()=>{let n=t.value||null;if(e.value=n,!n)return;let r=e.source.map;e.bind?.(Object.hasOwn(r,n)&&r[n])}),t.addEventListener(`change`,t=>e.emit(`change`,t)),t.addEventListener(`focus`,t=>e.emit(`focus`,t)),t.addEventListener(`blur`,t=>e.emit(`blur`,t)),e.listen(`focus`,()=>t.focus()),e.listen(`scrollIntoView`,()=>t.scrollIntoView()),c(()=>t.disabled=!!(e.readonly||e.disabled),e.signal);let n=i(()=>{let t=e.source.levelTree;return e.clearable?[{value:``,label:e.field?.label??``,disabled:!1,level:0},...t]:t});c(()=>{t.innerHTML=``;for(let{value:e,label:r,disabled:i,level:a}of n.get()){let n=document.createElement(`option`);n.value=`${e}`,n.label=`${Array(a).fill(` `).join(``)}${r}`,i&&(n.disabled=i),t.appendChild(n)}t.value=e.value||``},e.signal);function r(e){t.value=(e==``||e==null?null:e)||``}return c(()=>r(e.value),e.signal),t};const Oe=HTMLElement.prototype.hasOwnProperty(`popover`);function ke(e){let t=e;for(;t;){let e=t.getRootNode();if(!e)return!1;if(e===document)return document.activeElement===t;if(!(e instanceof ShadowRoot)||e.activeElement!==t)return!1;let n=e.host;if(!n)return!1;t=n}}var Ae=class extends HTMLElement{#e=null;#t=null;#n=null;#r=this.attachShadow({mode:`closed`});#i=this.#r.appendChild(document.createElement(`style`));#a=this.#r.appendChild(document.createElement(`input`));#o=this.#r.appendChild(document.createElement(`div`));#s=this.#o.appendChild(document.createElement(`div`));constructor(){super(),this.#i.textContent=`:host {
|
|
1
|
+
import{BindObjectStore as e,Code128 as t,PageIdent as n,Pagination as r,createComputed as i,createQuickFilters as a,createShowField as o,createState as s,effect as c,getPatternFields as l,getPermissionFields as u,getPrimaryFields as d,importStyle as f,importWidget as p,modelService as m,permissionsService as h,renderForm as g,runPattern as _,showFilterDialog as v,toId as y,waitAbortSignal as b,watch as ee}from"@yongdall/web";import{Check as te,Source as ne}from"@neeloong/table";function x(e){let t=document.createElement(`div`),n=t;return n.style.overflow=`hidden`,n.style.whiteSpace=`nowrap`,n.style.textOverflow=`ellipsis`,e.listen(`scrollIntoView`,()=>t.scrollIntoView()),[t,e=>{n.title=n.innerText=e??``}]}function S(e,t,n,r,i){let a=e.editable,o=e.field?.nullable?null:i,[s,l]=(a?t:n)(e,t=>{o=r(t,e.field?.nullable),e.value=o});function u(e,t){!t&&e===o||(o=e,l(e))}return u(e.value,!0),c(()=>u(e.value),e.signal),s}function re(e){let t=document.createElement(`div`),n=t;return e.listen(`scrollIntoView`,()=>t.scrollIntoView()),[t,e=>{n.innerText=e??``}]}function C(e,t){return e||!t?e:null}function w(e,t){let n=document.createElement(`textarea`);return n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var T=e=>S(e,w,re,C,``);function E(e,t){let n=parseFloat(e);return Number.isFinite(n)?n:t?null:0}function D(e,t){let n=document.createElement(`input`);return n.type=`number`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var O=e=>S(e,D,x,E,0);function k(e,t){let n=parseInt(e);return Number.isFinite(n)?n:t?null:0}function ie(e,t){let n=document.createElement(`input`);return n.type=`number`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var ae=e=>S(e,ie,x,k,0);function A(e,t){if(!e)return t?null:0n;try{return BigInt(e)}catch{}return t?null:0n}function j(e,t){let n=document.createElement(`input`);return n.type=`number`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var oe=e=>S(e,j,x,A,0n);function se(e,t){return e||!t?e:null}function M(e,t){let n=document.createElement(`input`);return n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var N=e=>S(e,M,x,se,``),ce=e=>{let t=document.createElement(`input`);t.type=`checkbox`;let n=e.editable,r=e.field?.nullable?null:!1;n?(t.addEventListener(`input`,()=>{r=!!t.checked,e.value=r}),t.addEventListener(`change`,t=>e.emit(`change`,t)),t.addEventListener(`focus`,t=>e.emit(`focus`,t)),t.addEventListener(`blur`,t=>e.emit(`blur`,t))):t.disabled=!0,c(()=>t.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>t.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>t.focus()),e.listen(`scrollIntoView`,()=>t.scrollIntoView());function i(n){let i=!e.field?.nullable||typeof n==`boolean`?!!n:null;i!==r&&(r=i,t.checked=!!i)}return c(()=>i(e.value),e.signal),t};function P(e,t){return Number.isFinite(new Date(e).valueOf())?e:t?null:``}function le(e,t){let n=document.createElement(`input`);return n.type=`date`,n.step=`1`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var F=e=>S(e,le,x,P,``);function I(e,t){let n=new Date(e);return Number.isFinite(n)?e:t?null:``}function L(e,t){let n=document.createElement(`input`);return n.type=`time`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var R=e=>S(e,L,x,I,``);function z(e,t){let n=new Date(e);return Number.isFinite(n.valueOf())?n:null}function ue(e,t){return e.valueOf()?`${[`${e.getFullYear()}`.padStart(4,`0`),`${e.getMonth()+1}`.padStart(2,`0`),`${e.getDate()}`.padStart(2,`0`)].join(`-`)}${t}${[`${e.getHours()}`.padStart(2,`0`),`${e.getMinutes()}`.padStart(2,`0`),`${e.getSeconds()}`.padStart(2,`0`)].join(`:`)}`:``}function B(e,t=`T`){return e instanceof Date?ue(e,t):ue(new Date(e),t)??``}function de(e){let t=document.createElement(`div`),n=t;return n.style.overflow=`hidden`,n.style.whiteSpace=`nowrap`,n.style.textOverflow=`ellipsis`,e.listen(`scrollIntoView`,()=>t.scrollIntoView()),[t,e=>{n.title=n.innerText=B(e,` `)}]}function fe(e,t){let n=document.createElement(`input`);return n.type=`datetime-local`,n.step=`1`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=B(e)}]}var V=e=>S(e,fe,de,z,null);function pe(e,t){return e||!t?e:null}function me(e,t){let n=document.createElement(`input`);return n.type=`password`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var he=e=>S(e,me,x,pe,``);function ge(e,t){return e||!t?e:null}function _e(e,t){let n=document.createElement(`input`);return n.type=`url`,n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var ve=e=>S(e,_e,x,ge,``);function ye(e,t){return e||!t?e:null}function be(e,t){let n=document.createElement(`input`);return n.addEventListener(`input`,()=>t(n.value)),n.addEventListener(`input`,t=>e.emit(`input`,t)),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal),c(()=>n.placeholder=e.placeholder,e.signal),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),[n,e=>{n.value=e??``}]}var xe=e=>S(e,be,x,ye,``);f(`@neeloong/table/style.css`);async function Se(e,t,n,f,p,m){let h=b(f,!0),g=await Promise.race([n.loadScript(),h]);if(!g)return Promise.reject();let x=m.label||g.labelPattern||``,S=m.fields,re=m.queryFilters||[],C=s([]),w=s(100),T=s(1),E=s([]),D=t.appendChild(document.createElement(`div`)),O=D.appendChild(document.createElement(`div`)),k=D.appendChild(document.createElement(`div`)),ie=t.appendChild(document.createElement(`div`)),ae=t.appendChild(document.createElement(`div`)),A=new ne({idKey:`_`,parentKey:`parent`});A.selectable=!0;let j=g.fields,oe=u(`options`,g.permissions||[],g),se=Object.entries(j).filter(([,{type:e}])=>e&&typeof e!=`object`).filter(([e])=>oe.has(e)),M=d(g),N=[];for(let{field:e,width:t,label:n,align:r,enableLink:i}of S||[]){if(!e||!Object.hasOwn(j,e))continue;let a=j[e];if(!a)continue;let o=a.type;!o||typeof o!=`string`||N.push({name:e,width:t||void 0,title:n||a.label||``,field:a,align:r,enableLink:i})}if(!N.length){for(let[e,t]of se)if(N.push({name:e,title:t.label||``,field:t}),N.length>=4)break}let ce=[...new Set([...N.map(e=>e.name),...M,...l(x)])];c(()=>A.setValue(E.get()),f);let P=N.map(({name:e,field:t,title:n,width:r,align:i,enableLink:a})=>({field:e,title:n,width:r,resizable:!0,render(r){let s=document.createElement(`div`);i&&(s.style.textAlign=i);let c=o(e,t,{enableLink:a},r.data);return s.appendChild(c.root),{root:s,destroy(){c.destroy()},setHidden(){},update(n){c.destroy(),s.innerHTML=``,c=o(e,t,{enableLink:a},n.data),s.appendChild(c.root)},header(){let e=document.createElement(`span`);return e.innerText=n,i&&(e.style.textAlign=i),{root:e,update(){},destroy(){}}}}}}));P.unshift({field:`_`,width:200,resizable:!0,render(e){let t=e.data,n=document.createElement(`div`),r=_(x,t)||M.map(e=>t[e]).join(`$`);return n.appendChild(document.createTextNode(r)),{root:n,destroy(){},setHidden(){},update(e){let t=e.data,r=_(x,t)||M.map(e=>t[e]).join(`$`);n.innerHTML=``,n.appendChild(document.createTextNode(r))}}}}),p&&P.unshift({field:`_`,extensions:[te],render(e){return{root:document.createElement(`div`),destroy(){},setHidden(){},update(){}}}});let le=A.createGroup(P,2),F=document.createElement(`table`);le.createHeader(F.appendChild(document.createElement(`div`))),le.createBody(F.appendChild(document.createElement(`div`)));let I=new r;ee(()=>w.get(),e=>I.size=e||100,{immediate:!0,signal:f}),ee(()=>T.get(),e=>I.page=e||1,{immediate:!0,signal:f}),I.listen(()=>{T.set(I.page),w.set(I.size)});let L=0,R=s(!1);async function z(){if(!f.aborted&&!R.get())try{R.set(!0),L++;let e=L,{options:t,total:r}=await n.options({limit:w.get(),page:T.get(),where:[...C.get()||[],...m.where||[]],or:m.orWhere||[],select:ce,total:!0});if(f.aborted||e!==L)return;E.set(t.map(e=>({...e,_:y(e,M)}))),I.total=r}finally{R.set(!1)}}function ue(){g&&v(g,C.get(),t).then(e=>{C.set(e)}).catch(()=>{})}function B(e,t,n){let r=document.createElement(`button`);r.appendChild(document.createTextNode(e));let a=i(()=>!!n?.get());return c(()=>{r.disabled=a.get()},f),r.addEventListener(`click`,e=>{a.get()||e.defaultPrevented||t()}),r}let{promise:de,reject:fe,resolve:V}=Promise.withResolvers();return k.appendChild(B(`刷新`,z,R)),k.appendChild(B(`过滤`,ue)),k.appendChild(B(`确定`,()=>{let e=[];if(p){if(e=A.checked,!e.length)return V([])}else{let t=A.selectedId;if(!t)return V(null);e=[t]}if(!e.length){V(p?[]:null);return}let t=E.get(),n=Object.fromEntries(t.map(e=>[e._,e])),r=[...new Set(e.map(e=>n[e]).filter(Boolean))].map(e=>({value:e._,label:_(x,e)||e._,data:e}));V(p?r:r[0])})),k.appendChild(B(`取消`,()=>{fe()})),O.classList.add(`QueryFilters`),a({get(){return C.get()||[]},set(e){C.set(e),z()}},O,re||[],{fields:g.fields,signal:f,inline:!0}),ie.appendChild(F),ae.appendChild(I.root),ee([()=>C.get(),()=>w.get(),()=>T.get()],z,{signal:f,immediate:!0}),Promise.race([de,h]).finally(()=>{D.remove(),ie.remove(),ae.remove()})}var Ce=e=>{let t=e.editable,r=e.store||null,i=e.source.model||``,a=m(i),o=document.createElement(`div`);o.classList=`InputDocument`;let u=o.appendChild(document.createElement(`div`)),d=u.appendChild(document.createElement(`div`)),f=e.style.enableLink&&i,p=u.appendChild(document.createElement(f?`a`:`div`));d.classList=`InputDocument-placeholder`,e.listen(`scrollIntoView`,()=>u.scrollIntoView()),e.listen(`focus`,()=>u.focus());let h=null,g=null,v=s(),y=s(),b=null;return c(()=>d.innerText=e.placeholder,e.signal),c(()=>{let e=v.get()||``;p.innerText=e,d.hidden=!!e},e.signal),f&&c(()=>{let e=y.get()||``;if(!e)p.removeAttribute(`href`),p.tabIndex=-1;else{p.removeAttribute(`tabIndex`);let t=n.stringify({type:`model`,model:i,id:e});p.setAttribute(`href`,t)}},e.signal),c(async()=>{let t=e.value,n=t==``||t==null?null:t;if(h===n)return;h=n;let r=e.current[`${e.name}~label`];if(y.set(h),r){g=null,h=null,v.set(r);return}if(g=h,v.set(h||``),!h)return;let i=await a;if(!i)return;let o=i.labelPattern||``;if(!l(o).length)return;let{option:s}=await a.option(h);!s||h!==g||v.set(_(o,s)||h)},e.signal),t?(u.classList=`InputDocument-text`,c(()=>{e.readonly||e.disabled?(u.removeAttribute(`tabIndex`),b?.abort(),b=null,u.setAttribute(`disabled`,``)):(u.tabIndex=0,u.removeAttribute(`disabled`))},e.signal),u.addEventListener(`click`,async()=>{if(e.readonly||e.disabled)return;b?.abort(),b=new AbortController,e.emit(`focus`,null);let t=o.appendChild(document.createElement(`dialog`));t.showModal();try{let n=await Se(r,t,a,AbortSignal.any([b.signal,e.signal]),!1,e.source),i=Array.isArray(n)?n[0]:n;if(!i){if(!e.value)return;(e.clearable||e.nullable)&&(h=``,g=null,e.value=e.nullable?null:``,v.set(``),y.set(``),e.emit(`change`,null));return}let o=i.value;if(o===e.value)return;h=o,e.value=o,g=null,y.set(o),v.set(i.label||o),e.emit(`change`,o),e.bind?.(i.data)}finally{t.remove(),e.emit(`blur`,null)}}),o):o};function we(e,t){return e.length===t.length?e.findIndex((e,n)=>e!=t[n])===-1:!1}var Te=e=>{let t=e.editable,n=e.store||null,r=m(e.source.model||``),i=document.createElement(`div`);i.classList=`InputDocument`;let a=i.appendChild(document.createElement(`div`)),o=a.appendChild(document.createElement(`div`)),u=a.appendChild(document.createElement(`div`));o.classList=`InputDocument-placeholder`,e.listen(`scrollIntoView`,()=>a.scrollIntoView()),e.listen(`focus`,()=>a.focus());let f=[],p=[],h=s([]),g=null;return c(()=>o.innerText=e.placeholder,e.signal),c(()=>{let e=h.get();u.innerHTML=``;for(let t of e){let e=u.appendChild(document.createElement(`span`));e.innerText=t,e.classList=`InputDocument-Item`}o.hidden=!!e.length},e.signal),c(async()=>{let t=e.value,n=(Array.isArray(t)?t:[t]).map(e=>typeof e==`string`||typeof e==`number`?String(e):``).filter(Boolean);if(we(f,n))return;f=n;let i=e.current[`${e.name}~label`];if(i){p=[],f=[],h.set(i);return}if(p=f,h.set(f),!f.length)return;let a=await r;if(!a)return;let o=a.labelPattern||``;if(!l(o).length)return;let{options:s}=await r.options({primary:f,limit:f.length*10});if(!s.length||f!==p)return;let c=d(a),u=Object.fromEntries(s.map(e=>[y(e,c),e]));f.map(e=>{let t=Object.hasOwn(u,e)&&u[e];return t&&_(o,t)||e}),h.set(f.map(e=>{let t=Object.hasOwn(u,e)&&u[e];return t&&_(o,t)||e}))},e.signal),t?(a.classList=`InputDocument-text`,c(()=>{e.readonly||e.disabled?(a.removeAttribute(`tabIndex`),g?.abort(),g=null,a.setAttribute(`disabled`,``)):(a.tabIndex=0,a.removeAttribute(`disabled`))},e.signal),a.addEventListener(`click`,async()=>{if(e.readonly||e.disabled)return;g?.abort(),g=new AbortController,e.emit(`focus`,null);let t=i.appendChild(document.createElement(`dialog`));t.showModal();try{let i=await Se(n,t,r,AbortSignal.any([g.signal,e.signal]),!0,e.source),a=Array.isArray(i)?i:i?[i]:[];if(!a.length){if(!e.value?.length)return;e.clearable||e.nullable?(f=[],p=[],e.value=e.nullable?null:[],h.set([]),e.emit(`change`,null)):e.value=[];return}let o=a.map(e=>e.value);if(we(o,e.value))return;f=o,e.value=o,p=[],h.set(a.map(e=>e.label||e.value)),e.emit(`change`,null)}finally{t.remove(),e.emit(`blur`,null)}}),i):i},Ee=e=>{if(!e.editable){let t=document.createElement(`span`),n=s(``);e.listen(`focus`,()=>t.focus()),e.listen(`scrollIntoView`,()=>t.scrollIntoView());function r(){let r=n.get();r===``?t.innerText=``:t.innerText=e.source.labels[r]??r}function i(e){let t=e??``;t!==n&&n.set(t)}return c(()=>i(e.value),e.signal),c(r,e.signal),t}let t=i(()=>``in e.source.labels),n=document.createElement(`select`);n.addEventListener(`change`,()=>{let r=n.value||(e.nullable&&!t.get()?null:``);if(e.value=r,!r)return;let i=e.source.map;e.bind?.(Object.hasOwn(i,r)&&i[r])}),n.addEventListener(`change`,t=>e.emit(`change`,t)),n.addEventListener(`focus`,t=>e.emit(`focus`,t)),n.addEventListener(`blur`,t=>e.emit(`blur`,t)),e.listen(`focus`,()=>n.focus()),e.listen(`scrollIntoView`,()=>n.scrollIntoView()),c(()=>n.disabled=!!(e.readonly||e.disabled),e.signal);let r=i(()=>{let t=e.source.levelTree;return e.clearable?[{value:``,label:e.field?.label??``,disabled:!1,level:0},...t]:t});c(()=>{n.innerHTML=``;for(let{value:e,label:t,disabled:i,level:a}of r.get()){let r=document.createElement(`option`);r.value=`${e}`,r.label=`${Array(a).fill(` `).join(``)}${t}`,i&&(r.disabled=i),n.appendChild(r)}n.value=e.value||``},e.signal);function a(e){n.value=(e==``||e==null?null:e)||``}return c(()=>a(e.value),e.signal),n};const De=HTMLElement.prototype.hasOwnProperty(`popover`);function Oe(e){let t=e;for(;t;){let e=t.getRootNode();if(!e)return!1;if(e===document)return document.activeElement===t;if(!(e instanceof ShadowRoot)||e.activeElement!==t)return!1;let n=e.host;if(!n)return!1;t=n}}var ke=class extends HTMLElement{#e=null;#t=null;#n=null;#r=this.attachShadow({mode:`closed`});#i=this.#r.appendChild(document.createElement(`style`));#a=this.#r.appendChild(document.createElement(`input`));#o=this.#r.appendChild(document.createElement(`div`));#s=this.#o.appendChild(document.createElement(`div`));constructor(){super(),this.#i.textContent=`:host {
|
|
2
2
|
display: contents;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -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`,Oe&&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,ke(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 ke(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(Oe&&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))})}#_(){Oe&&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`,Ae)}catch{}var V=e=>{let{inline:t,showLabel:n,quick:r}=e.style,a=document.createElement(t?`span`:`div`).appendChild(document.createElement(`label`)),o=a.appendChild(document.createElement(`yongdall-select`)),s=null;o.addEventListener(`change`,()=>{s=o.value||null,e.value=s});let l=null;function u(){l&&clearTimeout(l),l=setTimeout(()=>{},300)}o.addEventListener(`input`,u);let d=i(()=>{let t=[...e.source.options];return t.unshift({value:``,label:``}),t});return c(()=>{o.options=d.get()},e.signal),c(()=>{let t=e.value,n=t==``||t==null?null:t;n!==s&&(s=n,o.value=s||``)},e.signal),n?a.insertBefore(document.createTextNode(e.field?.label??``),a.firstChild):r&&(o.placeholder=e.field?.label??``),o},je=e=>{let t=document.createElement(`div`),n=t.appendChild(document.createElement(`div`)).appendChild(document.createElement(`label`)),r=n.appendChild(document.createElement(`input`));n.appendChild(document.createTextNode(`全选`)),n.classList.add(`align-center`),r.type=`checkbox`;let a=t.appendChild(document.createElement(`div`)),o=new Set,l=i(()=>new Set(h.get().flatMap(e=>e.children?.map(e=>e.value)||[])));function u(){l.get().size===o.size?(r.indeterminate=!1,r.checked=!0):o.size?r.indeterminate=!0:(r.indeterminate=!1,r.checked=!1)}function d(){o=new Set;for(let{checked:e,value:t}of a.querySelectorAll(`input`))!e||!t||o.add(t);e.value=[...o].map(e=>({permission:e})),u()}function f(){for(let e of a.querySelectorAll(`input`))e.checked=o.has(e.value)}function p(){f(),u()}let m=s([]);function g(){a.innerHTML=``;let e=[];for(let{label:t,children:n}of h.get()){if(!n?.length)continue;let r=a.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`,d),e.push(a)}}m.set(e),p()}c(()=>g(),e.signal),r.addEventListener(`input`,()=>{if(!r.checked){for(let e of a.querySelectorAll(`input`))e.checked=!1;e.value=[];return}let t=new Set;for(let e of a.querySelectorAll(`input`))e.checked=!0,t.add(e.value);e.value=[...t].map(e=>({permission:e})),f()}),r.addEventListener(`change`,t=>e.emit(`change`,t)),r.addEventListener(`focus`,t=>e.emit(`focus`,t)),r.addEventListener(`blur`,t=>e.emit(`blur`,t));let _=i(()=>!!(!e.editable||e.disabled));e.listen(`focus`,()=>r.focus()),e.listen(`scrollIntoView`,()=>r.scrollIntoView()),c(()=>r.hidden=!!e.hidden,e.signal),c(()=>{let e=_.get();n.hidden=e;for(let t of m.get())t.disabled=e},e.signal),c(()=>r.readOnly=!!e.readonly,e.signal);function v(e){let t=new Set(Array.isArray(e)&&e.map(e=>e.permission)||[]);if(t.size===o.size){for(let e of o)if(!t.has(e))break;return}o=t,p()}return c(()=>v(e.value),e.signal),t};function Me(e,n){return(r,i)=>{let{signal:a,editable:o,store:s}=r;if(!s||a.aborted)return;let c=new t(e,s,a),{enableLink:l,design:u}=r.style;r.root.style.inlineSize=`100%`,g(c,r.root,{enableLink:l,design:u,layout:n,editable:o,signal:a})}}async function Ne(e){if(typeof e==`string`)return p(e);if(!e||typeof e!=`object`)return null;let{widget:t,schema:n,layout:r}=e;return typeof t==`string`&&t?p(t):n&&typeof n==`object`?Me(n,r):null}var Pe=e=>{let t=null,n=null,r=document.createElement(`div`);async function i(i){if(e.signal.aborted||i===t)return;t=i,n?.abort(),n=new AbortController;let a=AbortSignal.any([n.signal,e.signal]),o=await Ne(i);typeof o==`function`&&(a.aborted||o({root:r,get store(){return e.store},get style(){return e.style},get field(){return e.field},get name(){return e.name},get value(){return e.value},set value(t){e.value=t},get current(){return e.current},get destroyed(){return e.destroyed},get readonly(){return e.readonly},get editable(){return e.editable},get required(){return e.required},get nullable(){return e.nullable},get disabled(){return e.disabled},get clearable(){return e.clearable},get hidden(){return e.hidden},get label(){return e.label},get placeholder(){return e.placeholder},get description(){return e.description},get source(){return e.source},get signal(){return a},listen(t,n){return e.listen(t,n)},emit(t,n){return e.emit(t,n)},get bind(){return e.bind}},typeof i==`object`&&i||{}))}let a=null;return c(()=>{let t=e.source.configurator||null;a!==null&&cancelIdleCallback(a),a=requestIdleCallback(()=>{a=null,i(t)})},e.signal),r};function H(e,t){let{inline:n,showLabel:r,quick:i}=t.style,a=document.createElement(n?`span`:`div`),o=t.field?.label??``;if(r){let e=a.appendChild(document.createElement(n?`span`:`div`));e.innerText=o}let s=e(n?a:a.appendChild(document.createElement(`div`)),i?o:``,e=>{t.value=e});return c(()=>s(t.value),t.signal),a}function Fe(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 U=H.bind(null,Fe);function Ie(e,t){let n=parseFloat(e);return Number.isFinite(n)?n:t?0:null}function Le(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Ie(r.value))),e=>{r.value=e??``}}var W=H.bind(null,Le);function Re(e,t){let n=parseInt(e);return Number.isFinite(n)?n:t?0:null}function ze(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Re(r.value))),e=>{r.value=e??``}}var G=H.bind(null,ze);function Be(e,t){if(!e)return t?0n:null;try{return BigInt(e)}catch{}return t?0n:null}function Ve(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Be(r.value))),e=>{r.value=e??``}}var K=H.bind(null,Ve);function He(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 q=H.bind(null,He),Ue=e=>{let{inline:t,showLabel:n,quick:r}=e.style,i=document.createElement(t?`span`:`div`),a=i.appendChild(document.createElement(`label`)),o=a.appendChild(document.createElement(`input`));return o.type=`checkbox`,o.addEventListener(`input`,()=>{e.value=o.indeterminate?null:!!o.checked}),c(()=>{let t=e.value;if(typeof t==`boolean`){o.checked=t;return}if(t===`false`||t===`0`||t===0){o.checked=!1;return}if(t===`true`||t===`1`||t===1){o.checked=!0;return}o.indeterminate=!0,t!==null&&(e.value=null)},e.signal),n?a.insertBefore(document.createTextNode(e.field?.label??``),a.firstChild):r&&a.appendChild(document.createTextNode(e.field?.label??``)),i};function We(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 J=H.bind(null,We);function Ge(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 Y=H.bind(null,Ge);function Ke(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 X=H.bind(null,Ke);function qe(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 Je=H.bind(null,qe);function Ye(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 Xe=H.bind(null,Ye),Z=e=>{let{inline:t,showLabel:n,quick:r}=e.style,i=e.field?.model||``,a=document.createElement(t?`span`:`div`),o=a.appendChild(document.createElement(`label`));a.classList=`InputDocument`;let u=o.appendChild(document.createElement(`div`)),d=u.appendChild(document.createElement(`div`)),f=u.appendChild(document.createElement(`div`));d.classList=`InputDocument-placeholder`;let p=null,h=null,g=s(),v=null,y=e.field?.label??``;if(d.innerText=r?y:``,c(()=>{let e=g.get()||``;f.innerText=e,d.hidden=!!e},e.signal),c(async()=>{let t=e.value,n=t==``||t==null?null:t;if(p===n||(p=n,h=p,g.set(p||``),!p)||!i)return;let r=m(i),a=await r;if(!a)return;let o=a.labelPattern||``;if(!l(o).length)return;let{option:s}=await r.option(p);!s||p!==h||g.set(_(o,s)||p)},e.signal),n&&o.insertBefore(document.createTextNode(y),o.firstChild),!i)return a;let ee=m(i);return u.classList=`InputDocument-text`,u.tabIndex=0,u.addEventListener(`click`,async()=>{v?.abort(),v=new AbortController;let t=a.appendChild(document.createElement(`dialog`));t.showModal();try{let n=await Ce(null,t,ee,AbortSignal.any([v.signal,e.signal]),!1,e.source),r=Array.isArray(n)?n[0]:n;if(!r){if(!e.value)return;p=``,h=null,e.value=null,g.set(``);return}let i=r.value;if(i===e.value)return;p=i,e.value=i,h=null,g.set(r.label||i)}finally{t.remove()}}),a},Ze=e=>{let{inline:t,showLabel:n,quick:r}=e.style,a=document.createElement(t?`span`:`div`).appendChild(document.createElement(`label`)),o=a.appendChild(document.createElement(`select`));o.addEventListener(`change`,()=>{e.value=o.value||null});let s=i(()=>{let t=e.source.levelTree;return[{value:``,label:r&&e.field?.label||``,disabled:!1,level:0},...t]});return c(()=>{o.innerHTML=``;for(let{value:e,label:t,disabled:n,level:r}of s.get()){let i=document.createElement(`option`);i.value=`${e}`,i.label=`${Array(r).fill(` `).join(``)}${t}`,n&&(i.disabled=n),o.appendChild(i)}o.value=e.value||``},e.signal),c(()=>{let t=e.value;o.value=(t==``||t==null?null:t)||``},e.signal),n&&a.insertBefore(document.createTextNode(e.field?.label??``),a.firstChild),o};function Qe(e){if(typeof e!=`string`)return!!e;switch(e.toLowerCase()){case``:case`0`:case`n`:case`f`:case`no`:case`off`:case`false`:return!1}return!0}function Q(e,t){if([e,t].filter(e=>(e??null)===null).length===1)return!1;let n=e??null,r=t??null;return Object.is(n,r)?!0:n===null||r===null?!1:typeof e==`boolean`||typeof t==`boolean`?Qe(e)===Qe(t):e==t}function $e(e,t){if(Array.isArray(t)){for(let n of e)if(Array.isArray(n)){if(n.length!==t.length)continue;if(t.findIndex((e,t)=>!Q(n[t],e))<0)return!0}else for(let e of t)if(Q(n,e))return!0}else for(let n of e)if(Q(n,t))return!0;return!1}function et(e,t){if(Array.isArray(t))return null;let n=t??null,r=n===null?``:String(n);for(let t of e){let e=(Array.isArray(t)?t[0]:t)??null;if(!(e===null||e===``)&&r.includes(String(e)))return}return!1}function tt(e,t){if(Array.isArray(t)){for(let n of e)if(Array.isArray(n)&&n.length===t.length&&t.findIndex((e,t)=>!Q(n[t],e))<0)return!0}else for(let n of e)if(Array.isArray(n)&&n.length===t.length){for(let e of n)if(Q(e,t))return!0}return!1}function $(e,t,n){if(((Array.isArray(n)?n[0]:n)??null)===null)return null;for(let r of t){if(Array.isArray(r)||(r??null)===null)continue;let t=e(r,n);if(typeof t==`boolean`)return t}return!1}function nt(e,t){return $((e,t)=>e>t,e,t)}function rt(e,t){return $((e,t)=>e>=t,e,t)}function it(e,t){return $((e,t)=>e<t,e,t)}function at(e,t){return $((e,t)=>e<=t,e,t)}const ot=[{not:`!=`,notLabel:`≠`,value:$e,filters:{gt:{value:nt},ge:{value:rt},lt:{value:it},le:{value:at},in:{value:$e,not:`nin`},contains:{value:et}}},{array:!0,not:`!=`,notLabel:`≠`,value:tt,filters:{in:{value:tt,not:`nin`}}},{type:`text`,input:se,filter:U,notFilter:U,filters:{ne:{filter:U,label:`≠`},gt:{filter:U,label:`>`},ge:{filter:U,label:`≥`},lt:{filter:U,label:`<`},le:{filter:U,label:`≤`},contains:{filter:U,label:`包含`}}},{type:`string`,input:D,filter:q,notFilter:q,filters:{ne:{filter:q,label:`≠`},gt:{filter:q,label:`>`},ge:{filter:q,label:`≥`},lt:{filter:q,label:`<`},le:{filter:q,label:`≤`},contains:{filter:q,label:`包含`}}},{type:`bool`,input:O,filter:Ue,notFilter:Ue,filters:{ne:{filter:Ue,label:`≠`}}},{type:`f32`,input:S,filter:W,notFilter:W,filters:{ne:{filter:W,label:`≠`},gt:{filter:W,label:`>`},ge:{filter:W,label:`≥`},lt:{filter:W,label:`<`},le:{filter:W,label:`≤`}}},{type:`f64`,input:S,filter:W,notFilter:W,filters:{ne:{filter:W,label:`≠`},gt:{filter:W,label:`>`},ge:{filter:W,label:`≥`},lt:{filter:W,label:`<`},le:{filter:W,label:`≤`}}},{type:`decimal`,input:S,filter:W,notFilter:W,filters:{ne:{filter:W,label:`≠`},gt:{filter:W,label:`>`},ge:{filter:W,label:`≥`},lt:{filter:W,label:`<`},le:{filter:W,label:`≤`}}},{type:`numeric`,input:S,filter:W,notFilter:W,filters:{ne:{filter:W,label:`≠`},gt:{filter:W,label:`>`},ge:{filter:W,label:`≥`},lt:{filter:W,label:`<`},le:{filter:W,label:`≤`}}},{type:`money`,input:S,filter:W,notFilter:W,filters:{ne:{filter:W,label:`≠`},gt:{filter:W,label:`>`},ge:{filter:W,label:`≥`},lt:{filter:W,label:`<`},le:{filter:W,label:`≤`}}},{type:`i16`,input:T,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`i32`,input:T,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`i64`,input:E,filter:K,notFilter:K,filters:{ne:{filter:K,label:`≠`},gt:{filter:K,label:`>`},ge:{filter:K,label:`≥`},lt:{filter:K,label:`<`},le:{filter:K,label:`≤`}}},{type:`date`,input:k,filter:J,notFilter:J,filters:{ne:{filter:J,label:`≠`},gt:{filter:J,label:`>`},ge:{filter:J,label:`≥`},lt:{filter:J,label:`<`},le:{filter:J,label:`≤`}}},{type:`time`,input:ge,filter:Y,notFilter:Y,filters:{ne:{filter:Y,label:`≠`},gt:{filter:Y,label:`>`},ge:{filter:Y,label:`≥`},lt:{filter:Y,label:`<`},le:{filter:Y,label:`≤`}}},{type:`uuid`,input:Se,filter:Xe,notFilter:Xe,filters:{ne:{filter:Xe,label:`≠`}}},{type:`datetime`,input:L,filter:X,notFilter:X,filters:{ne:{filter:X,label:`≠`},gt:{filter:X,label:`>`},ge:{filter:X,label:`≥`},lt:{filter:X,label:`<`},le:{filter:X,label:`≤`}}},{type:`timetz`,input:ge,filter:Y,notFilter:Y,filters:{ne:{filter:Y,label:`≠`},gt:{filter:Y,label:`>`},ge:{filter:Y,label:`≥`},lt:{filter:Y,label:`<`},le:{filter:Y,label:`≤`}}},{type:`timestamp`,input:L,filter:X,notFilter:X,filters:{ne:{filter:X,label:`≠`},gt:{filter:X,label:`>`},ge:{filter:X,label:`≥`},lt:{filter:X,label:`<`},le:{filter:X,label:`≤`}}},{renderer:`password`,input:z,filter:q,notFilter:q,filters:{ne:{filter:q,label:`≠`}}},{renderer:`uri`,input:B,filter:Je,notFilter:Je,filters:{ne:{filter:Je,label:`≠`}}},{renderer:`document`,input:we,filter:Z,notFilter:Z,filters:{ne:{filter:Z,label:`≠`}}},{array:!0,renderer:`document`,input:Ee,filter:Z,notFilter:Z,filters:{ne:{filter:Z,label:`≠`}}},{renderer:`select`,input:De,filter:Ze,notFilter:Ze,filters:{ne:{filter:Ze,label:`≠`}}},{renderer:`search`,input:V,filter:V,notFilter:V,filters:{ne:{filter:V,label:`≠`}}},{renderer:`configuration`,input:Pe},{type:`submodel`,array:!0,renderer:`permission`,input:je}],st=[`style.css`];export{ot as formFields,st as styles};
|
|
68
|
+
`;let e=this.#a;e.type=`text`;let t=this.#o,n=this.#s;t.className=`dropdown`,n.className=`dropdown-list`,De&&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,Oe(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 Oe(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(De&&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))})}#_(){De&&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`,ke)}catch{}var H=e=>{let{inline:t,showLabel:n,quick:r}=e.style,a=document.createElement(t?`span`:`div`).appendChild(document.createElement(`label`)),o=a.appendChild(document.createElement(`yongdall-select`)),s=null;o.addEventListener(`change`,()=>{s=o.value||null,e.value=s});let l=null;function u(){l&&clearTimeout(l),l=setTimeout(()=>{},300)}o.addEventListener(`input`,u);let d=i(()=>{let t=[...e.source.options];return t.unshift({value:``,label:``}),t});return c(()=>{o.options=d.get()},e.signal),c(()=>{let t=e.value,n=t==``||t==null?null:t;n!==s&&(s=n,o.value=s||``)},e.signal),n?a.insertBefore(document.createTextNode(e.field?.label??``),a.firstChild):r&&(o.placeholder=e.field?.label??``),o},Ae=e=>{let t=document.createElement(`div`),n=t.appendChild(document.createElement(`div`)).appendChild(document.createElement(`label`)),r=n.appendChild(document.createElement(`input`));n.appendChild(document.createTextNode(`全选`)),n.classList.add(`align-center`),r.type=`checkbox`;let a=t.appendChild(document.createElement(`div`)),o=new Set,l=i(()=>new Set(h.get().flatMap(e=>e.children?.map(e=>e.value)||[])));function u(){l.get().size===o.size?(r.indeterminate=!1,r.checked=!0):o.size?r.indeterminate=!0:(r.indeterminate=!1,r.checked=!1)}function d(){o=new Set;for(let{checked:e,value:t}of a.querySelectorAll(`input`))!e||!t||o.add(t);e.value=[...o].map(e=>({permission:e})),u()}function f(){for(let e of a.querySelectorAll(`input`))e.checked=o.has(e.value)}function p(){f(),u()}let m=s([]);function g(){a.innerHTML=``;let e=[];for(let{label:t,children:n}of h.get()){if(!n?.length)continue;let r=a.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`,d),e.push(a)}}m.set(e),p()}c(()=>g(),e.signal),r.addEventListener(`input`,()=>{if(!r.checked){for(let e of a.querySelectorAll(`input`))e.checked=!1;e.value=[];return}let t=new Set;for(let e of a.querySelectorAll(`input`))e.checked=!0,t.add(e.value);e.value=[...t].map(e=>({permission:e})),f()}),r.addEventListener(`change`,t=>e.emit(`change`,t)),r.addEventListener(`focus`,t=>e.emit(`focus`,t)),r.addEventListener(`blur`,t=>e.emit(`blur`,t));let _=i(()=>!!(!e.editable||e.disabled));e.listen(`focus`,()=>r.focus()),e.listen(`scrollIntoView`,()=>r.scrollIntoView()),c(()=>r.hidden=!!e.hidden,e.signal),c(()=>{let e=_.get();n.hidden=e;for(let t of m.get())t.disabled=e},e.signal),c(()=>r.readOnly=!!e.readonly,e.signal);function v(e){let t=new Set(Array.isArray(e)&&e.map(e=>e.permission)||[]);if(t.size===o.size){for(let e of o)if(!t.has(e))break;return}o=t,p()}return c(()=>v(e.value),e.signal),t};function je(t,n){return(r,i)=>{let{signal:a,editable:o,store:s}=r;if(!s||a.aborted)return;let c=new e(t,s,a),{enableLink:l,design:u}=r.style;r.root.style.inlineSize=`100%`,g(c,r.root,{enableLink:l,design:u,layout:n,editable:o,signal:a})}}async function Me(e){if(typeof e==`string`)return p(e);if(!e||typeof e!=`object`)return null;let{widget:t,schema:n,layout:r}=e;return typeof t==`string`&&t?p(t):n&&typeof n==`object`?je(n,r):null}var Ne=e=>{let t=null,n=null,r=document.createElement(`div`);async function i(i){if(e.signal.aborted||i===t)return;t=i,n?.abort(),n=new AbortController;let a=AbortSignal.any([n.signal,e.signal]),o=await Me(i);typeof o==`function`&&(a.aborted||o({root:r,get store(){return e.store},get style(){return e.style},get field(){return e.field},get name(){return e.name},get value(){return e.value},set value(t){e.value=t},get current(){return e.current},get destroyed(){return e.destroyed},get readonly(){return e.readonly},get editable(){return e.editable},get required(){return e.required},get nullable(){return e.nullable},get disabled(){return e.disabled},get clearable(){return e.clearable},get hidden(){return e.hidden},get label(){return e.label},get placeholder(){return e.placeholder},get description(){return e.description},get source(){return e.source},get signal(){return a},listen(t,n){return e.listen(t,n)},emit(t,n){return e.emit(t,n)},get bind(){return e.bind}},typeof i==`object`&&i||{}))}let a=null;return c(()=>{let t=e.source.configurator||null;a!==null&&cancelIdleCallback(a),a=requestIdleCallback(()=>{a=null,i(t)})},e.signal),r};function Pe(e,n,r){let i=t.encode(r);if(!i?.length){n.setAttribute(`d`,``);return}let a=[];for(let e=0;e<i.length;e++){if(!i[e])continue;let t=e-i.length/2,n=1;for(;i[e+1];)n++,e++;a.push(`M${t} -0.5h${n}v1h-${n}Z`)}if(!a.length){n.setAttribute(`d`,``);return}let o=i.length;e.setAttribute(`viewBox`,`${-o/2-10} -0.5 ${o+20} 1`),n.setAttribute(`d`,a.join(` `))}var Fe=e=>{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);t.setAttribute(`preserveAspectRatio`,`none`);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);t.appendChild(n),t.style.blockSize=`var(--input-height)`,t.style.inlineSize=`100%`,n.setAttribute(`fill`,`black`),e.listen(`focus`,()=>t.focus()),e.listen(`scrollIntoView`,()=>t.scrollIntoView());let r=``;return c(()=>{let i=String(e.value??``).replace(/[^\0-\x7f]+/g,``);i!==r&&(r=i,Pe(t,n,i))},e.signal),t};function U(e,t){let{inline:n,showLabel:r,quick:i}=t.style,a=document.createElement(n?`span`:`div`),o=t.field?.label??``;if(r){let e=a.appendChild(document.createElement(n?`span`:`div`));e.innerText=o}let s=e(n?a:a.appendChild(document.createElement(`div`)),i?o:``,e=>{t.value=e});return c(()=>s(t.value),t.signal),a}function Ie(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 W=U.bind(null,Ie);function Le(e,t){let n=parseFloat(e);return Number.isFinite(n)?n:t?0:null}function Re(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Le(r.value))),e=>{r.value=e??``}}var G=U.bind(null,Re);function ze(e,t){let n=parseInt(e);return Number.isFinite(n)?n:t?0:null}function Be(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(ze(r.value))),e=>{r.value=e??``}}var K=U.bind(null,Be);function Ve(e,t){if(!e)return t?0n:null;try{return BigInt(e)}catch{}return t?0n:null}function He(e,t,n){let r=e.appendChild(document.createElement(`input`));return r.type=`number`,t&&(r.placeholder=t),r.addEventListener(`input`,()=>n(Ve(r.value))),e=>{r.value=e??``}}var q=U.bind(null,He);function Ue(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 J=U.bind(null,Ue),We=e=>{let{inline:t,showLabel:n,quick:r}=e.style,i=document.createElement(t?`span`:`div`),a=i.appendChild(document.createElement(`label`)),o=a.appendChild(document.createElement(`input`));return o.type=`checkbox`,o.addEventListener(`input`,()=>{e.value=o.indeterminate?null:!!o.checked}),c(()=>{let t=e.value;if(typeof t==`boolean`){o.checked=t;return}if(t===`false`||t===`0`||t===0){o.checked=!1;return}if(t===`true`||t===`1`||t===1){o.checked=!0;return}o.indeterminate=!0,t!==null&&(e.value=null)},e.signal),n?a.insertBefore(document.createTextNode(e.field?.label??``),a.firstChild):r&&a.appendChild(document.createTextNode(e.field?.label??``)),i};function Ge(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 Y=U.bind(null,Ge);function Ke(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 X=U.bind(null,Ke);function qe(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 Z=U.bind(null,qe);function Je(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 Ye=U.bind(null,Je);function Xe(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 Ze=U.bind(null,Xe),Q=e=>{let{inline:t,showLabel:n,quick:r}=e.style,i=e.source.model||``,a=document.createElement(t?`span`:`div`),o=a.appendChild(document.createElement(`label`));a.classList=`InputDocument`;let u=o.appendChild(document.createElement(`div`)),d=u.appendChild(document.createElement(`div`)),f=u.appendChild(document.createElement(`div`));d.classList=`InputDocument-placeholder`;let p=null,h=null,g=s(),v=null,y=e.field?.label??``;if(d.innerText=r?y:``,c(()=>{let e=g.get()||``;f.innerText=e,d.hidden=!!e},e.signal),c(async()=>{let t=e.value,n=t==``||t==null?null:t;if(p===n||(p=n,h=p,g.set(p||``),!p)||!i)return;let r=m(i),a=await r;if(!a)return;let o=a.labelPattern||``;if(!l(o).length)return;let{option:s}=await r.option(p);!s||p!==h||g.set(_(o,s)||p)},e.signal),n&&o.insertBefore(document.createTextNode(y),o.firstChild),!i)return a;let b=m(i);return u.classList=`InputDocument-text`,u.tabIndex=0,u.addEventListener(`click`,async()=>{v?.abort(),v=new AbortController;let t=a.appendChild(document.createElement(`dialog`));t.showModal();try{let n=await Se(null,t,b,AbortSignal.any([v.signal,e.signal]),!1,e.source),r=Array.isArray(n)?n[0]:n;if(!r){if(!e.value)return;p=``,h=null,e.value=null,g.set(``);return}let i=r.value;if(i===e.value)return;p=i,e.value=i,h=null,g.set(r.label||i)}finally{t.remove()}}),a},Qe=e=>{let{inline:t,showLabel:n,quick:r}=e.style,a=document.createElement(t?`span`:`div`).appendChild(document.createElement(`label`)),o=a.appendChild(document.createElement(`select`));o.addEventListener(`change`,()=>{e.value=o.value||null});let s=i(()=>{let t=e.source.levelTree;return[{value:``,label:r&&e.field?.label||``,disabled:!1,level:0},...t]});return c(()=>{o.innerHTML=``;for(let{value:e,label:t,disabled:n,level:r}of s.get()){let i=document.createElement(`option`);i.value=`${e}`,i.label=`${Array(r).fill(` `).join(``)}${t}`,n&&(i.disabled=n),o.appendChild(i)}o.value=e.value||``},e.signal),c(()=>{let t=e.value;o.value=(t==``||t==null?null:t)||``},e.signal),n&&a.insertBefore(document.createTextNode(e.field?.label??``),a.firstChild),o};function $e(e){if(typeof e!=`string`)return!!e;switch(e.toLowerCase()){case``:case`0`:case`n`:case`f`:case`no`:case`off`:case`false`:return!1}return!0}function $(e,t){if([e,t].filter(e=>(e??null)===null).length===1)return!1;let n=e??null,r=t??null;return Object.is(n,r)?!0:n===null||r===null?!1:typeof e==`boolean`||typeof t==`boolean`?$e(e)===$e(t):e==t}function et(e,t){if(Array.isArray(t)){for(let n of e)if(Array.isArray(n)){if(n.length!==t.length)continue;if(t.findIndex((e,t)=>!$(n[t],e))<0)return!0}else for(let e of t)if($(n,e))return!0}else for(let n of e)if($(n,t))return!0;return!1}function tt(e,t){if(Array.isArray(t))return null;let n=t??null,r=n===null?``:String(n);for(let t of e){let e=(Array.isArray(t)?t[0]:t)??null;if(!(e===null||e===``)&&r.includes(String(e)))return}return!1}function nt(e,t){if(Array.isArray(t)){for(let n of e)if(Array.isArray(n)&&n.length===t.length&&t.findIndex((e,t)=>!$(n[t],e))<0)return!0}else for(let n of e)if(Array.isArray(n)&&n.length===t.length){for(let e of n)if($(e,t))return!0}return!1}function rt(e,t,n){if(((Array.isArray(n)?n[0]:n)??null)===null)return null;for(let r of t){if(Array.isArray(r)||(r??null)===null)continue;let t=e(r,n);if(typeof t==`boolean`)return t}return!1}function it(e,t){return rt((e,t)=>e>t,e,t)}function at(e,t){return rt((e,t)=>e>=t,e,t)}function ot(e,t){return rt((e,t)=>e<t,e,t)}function st(e,t){return rt((e,t)=>e<=t,e,t)}const ct=[{not:`!=`,notLabel:`≠`,value:et,filters:{gt:{value:it},ge:{value:at},lt:{value:ot},le:{value:st},in:{value:et,not:`nin`},contains:{value:tt}}},{array:!0,not:`!=`,notLabel:`≠`,value:nt,filters:{in:{value:nt,not:`nin`}}},{type:`text`,input:T,filter:W,notFilter:W,filters:{ne:{filter:W,label:`≠`},gt:{filter:W,label:`>`},ge:{filter:W,label:`≥`},lt:{filter:W,label:`<`},le:{filter:W,label:`≤`},contains:{filter:W,label:`包含`}}},{type:`string`,input:N,filter:J,notFilter:J,filters:{ne:{filter:J,label:`≠`},gt:{filter:J,label:`>`},ge:{filter:J,label:`≥`},lt:{filter:J,label:`<`},le:{filter:J,label:`≤`},contains:{filter:J,label:`包含`}}},{type:`bool`,input:ce,filter:We,notFilter:We,filters:{ne:{filter:We,label:`≠`}}},{type:`f32`,input:O,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`f64`,input:O,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`decimal`,input:O,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`numeric`,input:O,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`money`,input:O,filter:G,notFilter:G,filters:{ne:{filter:G,label:`≠`},gt:{filter:G,label:`>`},ge:{filter:G,label:`≥`},lt:{filter:G,label:`<`},le:{filter:G,label:`≤`}}},{type:`i16`,input:ae,filter:K,notFilter:K,filters:{ne:{filter:K,label:`≠`},gt:{filter:K,label:`>`},ge:{filter:K,label:`≥`},lt:{filter:K,label:`<`},le:{filter:K,label:`≤`}}},{type:`i32`,input:ae,filter:K,notFilter:K,filters:{ne:{filter:K,label:`≠`},gt:{filter:K,label:`>`},ge:{filter:K,label:`≥`},lt:{filter:K,label:`<`},le:{filter:K,label:`≤`}}},{type:`i64`,input:oe,filter:q,notFilter:q,filters:{ne:{filter:q,label:`≠`},gt:{filter:q,label:`>`},ge:{filter:q,label:`≥`},lt:{filter:q,label:`<`},le:{filter:q,label:`≤`}}},{type:`date`,input:F,filter:Y,notFilter:Y,filters:{ne:{filter:Y,label:`≠`},gt:{filter:Y,label:`>`},ge:{filter:Y,label:`≥`},lt:{filter:Y,label:`<`},le:{filter:Y,label:`≤`}}},{type:`time`,input:R,filter:X,notFilter:X,filters:{ne:{filter:X,label:`≠`},gt:{filter:X,label:`>`},ge:{filter:X,label:`≥`},lt:{filter:X,label:`<`},le:{filter:X,label:`≤`}}},{type:`uuid`,input:xe,filter:Ze,notFilter:Ze,filters:{ne:{filter:Ze,label:`≠`}}},{type:`datetime`,input:V,filter:Z,notFilter:Z,filters:{ne:{filter:Z,label:`≠`},gt:{filter:Z,label:`>`},ge:{filter:Z,label:`≥`},lt:{filter:Z,label:`<`},le:{filter:Z,label:`≤`}}},{type:`timetz`,input:R,filter:X,notFilter:X,filters:{ne:{filter:X,label:`≠`},gt:{filter:X,label:`>`},ge:{filter:X,label:`≥`},lt:{filter:X,label:`<`},le:{filter:X,label:`≤`}}},{type:`timestamp`,input:V,filter:Z,notFilter:Z,filters:{ne:{filter:Z,label:`≠`},gt:{filter:Z,label:`>`},ge:{filter:Z,label:`≥`},lt:{filter:Z,label:`<`},le:{filter:Z,label:`≤`}}},{renderer:`password`,input:he,filter:J,notFilter:J,filters:{ne:{filter:J,label:`≠`}}},{renderer:`uri`,input:ve,filter:Ye,notFilter:Ye,filters:{ne:{filter:Ye,label:`≠`}}},{renderer:`document`,input:Ce,filter:Q,notFilter:Q,filters:{ne:{filter:Q,label:`≠`}}},{array:!0,renderer:`document`,input:Te,filter:Q,notFilter:Q,filters:{ne:{filter:Q,label:`≠`}}},{renderer:`select`,input:Ee,filter:Qe,notFilter:Qe,filters:{ne:{filter:Qe,label:`≠`}}},{renderer:`search`,input:H,filter:H,notFilter:H,filters:{ne:{filter:H,label:`≠`}}},{renderer:`code128`,input:Fe},{renderer:`barcode`,input:Fe},{renderer:`configuration`,input:Ne},{type:`submodel`,array:!0,renderer:`permission`,input:Ae}],lt=[`style.css`];export{ct as formFields,lt as styles};
|
|
69
69
|
//# sourceMappingURL=hooks.mjs.map
|