@ninebone/table 0.0.352 → 0.0.354
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nine-table.umd.js
CHANGED
|
@@ -363,5 +363,5 @@
|
|
|
363
363
|
<nine-table-analysis></nine-table-analysis>
|
|
364
364
|
</nine-table-body>
|
|
365
365
|
<nine-table-footer></nine-table-footer>
|
|
366
|
-
`;const l=t(this,k).shadowRoot.querySelectorAll("nine-table-sheet");l==null||l.forEach((c,d)=>{e[d]&&setTimeout(()=>{c.generate(e[d]),s&&t(this,yt).call(this)})})},"#render"));b(this,k,i),t(this,Ot).call(this)}};k=new WeakMap,Ot=new WeakMap,yt=new WeakMap,zt=new WeakMap,a(re,"LayoutManager");let Kt=re;const le=class le{constructor(i){h(this,pt);h(this,nt,-1);w(this,"count",a(()=>t(this,pt).rawRecords.length,"count"));b(this,pt,i)}get at(){return t(this,nt)}set at(i){b(this,nt,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,nt)}"]`)&&setTimeout(()=>{})}};pt=new WeakMap,nt=new WeakMap,a(le,"ngRow");let Zt=le;const C=class C{constructor(i,e){h(this,L);h(this,R);h(this,H,[]);h(this,ot,[]);h(this,Dt,0);h(this,B,[]);h(this,Nt,a(()=>{b(this,B,[]);const i=t(this,L).template||[];Array.from(i).forEach(e=>{var s;t(this,B).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,R).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,mt).call(this)),e.__ng.height=t(this,B).slice()})},"#initialize"));h(this,Z,a(()=>{t(this,L).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));w(this,"get",a((i,e)=>{var r;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return t(this,rt).call(this,s);if(i<0||i>=s.length)return null;const o=typeof((r=t(this,L).fields)==null?void 0:r.get)=="function"?t(this,L).fields.get():[];if(e!=null){const n=o.indexOf(e);return n>=0?s[i].v[n]:null}return t(this,rt).call(this,s[i])},"get"));w(this,"set",a(i=>{this.clear(),this.add(i,!1),t(this,Z).call(this)},"set"));h(this,mt,a(()=>({rowState:C.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,B).slice(),o:{},c:{},_:[0,0,0,0,C.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,B).slice(),-1,{},{}]}),"#getDefaultMeta"));w(this,"reset",a(()=>{b(this,H,[]),b(this,ot,[]),t(this,Z).call(this)},"reset"));w(this,"clear",a(()=>{var i;t(this,R).rawRecords=[],b(this,H,[]),b(this,ot,[]),(i=t(this,R).viewRecords)!=null&&i.reset&&t(this,R).viewRecords.reset()},"clear"));h(this,Bt,a(i=>{var o;Array.isArray(i)||(i=[i]);const e=typeof((o=t(this,L).fields)==null?void 0:o.get)=="function"?t(this,L).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(r=>{const n={v:[]};e.forEach(l=>{n.v.push(r[l]!==void 0&&r[l]!==null?r[l]:"")}),s.push(n)}),s},"#json2Array"));h(this,Pt,a(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,mt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=C.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));w(this,"add",a((i,e=!0)=>{i===void 0&&(i={});const s=t(this,Bt).call(this,i);t(this,R).rawRecords=t(this,R).rawRecords.concat(t(this,Pt).call(this,s)),this.resetRecords();const o=this.count()-1;return e||s.forEach((r,n)=>{const l=t(this,R).rawRecords[o-n];l&&(l.__ng.rowState=C.ROW_STATE.EMPTY)}),t(this,Z).call(this),o},"add"));w(this,"delete",a(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,R).host.row.at]:e=[parseInt(i,10)],e.sort((s,o)=>o-s).forEach(s=>{if(t(this,H)[s]){const o=t(this,H)[s].__ng.rowid;t(this,H)[s].__ng.rowState===C.ROW_STATE.INSERT?t(this,R).rawRecords=t(this,R).rawRecords.filter(r=>r.__ng.rowid!==o):t(this,R).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=C.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,Z).call(this)},"delete"));w(this,"setValue",a((i,e,s)=>{var c;i=parseInt(i,10);const r=(typeof((c=t(this,L).fields)==null?void 0:c.get)=="function"?t(this,L).fields.get():[]).indexOf(e);if(r<0)return;const n=this.getValidData()[i];if(!n)return;const l=n.v[r];l!==s&&n.__ng.rowState!==C.ROW_STATE.INSERT&&(n.__ng.o.hasOwnProperty(e)||(n.__ng.o[e]=l),n.__ng.rowState=C.ROW_STATE.UPDATE),n.v[r]=s},"setValue"));w(this,"resetRecords",a(()=>{b(this,ot,t(this,R).rawRecords.filter(i=>!i.__ng.deleted)),b(this,H,t(this,R).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,R).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,H).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));w(this,"getValidData",a(()=>(t(this,H).length===0&&t(this,R).rawRecords.length>0&&this.resetRecords(),t(this,H)),"getValidData"));h(this,rt,a(i=>{var n;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,o=typeof((n=t(this,L).fields)==null?void 0:n.get)=="function"?t(this,L).fields.get():[],r=s.filter(l=>!l.__ng.deleted).map(l=>{const c={};return o.forEach((d,f)=>{c[d]=l.v?l.v[f]:l[d]}),c.__ng=l.__ng,c});return e?r[0]:r},"#conv"));w(this,"count",a(()=>this.getValidData().length,"count"));b(this,L,i),b(this,R,e),t(this,Nt).call(this)}get source(){return t(this,rt).call(this,t(this,R).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++ue(this,Dt)._}get length(){return t(this,H).length}getRowCount(){return this.length}};L=new WeakMap,R=new WeakMap,H=new WeakMap,ot=new WeakMap,Dt=new WeakMap,B=new WeakMap,Nt=new WeakMap,Z=new WeakMap,mt=new WeakMap,Bt=new WeakMap,Pt=new WeakMap,rt=new WeakMap,a(C,"ngData"),w(C,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Gt=C;const ae=class ae{constructor(i){h(this,G);b(this,G,i),this.row=new Zt(this),this.data=new Gt(t(this,G),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,G).view)!=null&&e.redraw&&t(this,G).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var o,r;const s=parseInt(e,10);if(!(s>=this.data.count()))return(r=(o=this.data.getValidData()[s])==null?void 0:o.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,o)=>{e=parseInt(e,10),this.data.setValue(e,s,o)},this.setDataSource([])}};G=new WeakMap,a(ae,"ngDataManager");let Jt=ae;const ce=class ce extends HTMLElement{constructor(){super();h(this,J);h(this,Yt);this.
|
|
366
|
+
`;const l=t(this,k).shadowRoot.querySelectorAll("nine-table-sheet");l==null||l.forEach((c,d)=>{e[d]&&setTimeout(()=>{c.generate(e[d]),s&&t(this,yt).call(this)})})},"#render"));b(this,k,i),t(this,Ot).call(this)}};k=new WeakMap,Ot=new WeakMap,yt=new WeakMap,zt=new WeakMap,a(re,"LayoutManager");let Kt=re;const le=class le{constructor(i){h(this,pt);h(this,nt,-1);w(this,"count",a(()=>t(this,pt).rawRecords.length,"count"));b(this,pt,i)}get at(){return t(this,nt)}set at(i){b(this,nt,parseInt(i,10)),body&&!body.querySelector(`tbody.bindable tr[data-row="${t(this,nt)}"]`)&&setTimeout(()=>{})}};pt=new WeakMap,nt=new WeakMap,a(le,"ngRow");let Zt=le;const C=class C{constructor(i,e){h(this,L);h(this,R);h(this,H,[]);h(this,ot,[]);h(this,Dt,0);h(this,B,[]);h(this,Nt,a(()=>{b(this,B,[]);const i=t(this,L).template||[];Array.from(i).forEach(e=>{var s;t(this,B).push(((s=e.getBoundingClientRect)==null?void 0:s.call(e).height)||24)}),(t(this,R).rawRecords||[]).forEach(e=>{e.__ng||(e.__ng=t(this,mt).call(this)),e.__ng.height=t(this,B).slice()})},"#initialize"));h(this,Z,a(()=>{t(this,L).shadowRoot.querySelectorAll("nine-table-sheet").forEach(i=>{i.invalidate()})},"#invalidate"));w(this,"get",a((i,e)=>{var r;const s=this.getValidData();if(!s||s.length<=0)return;if(i==null)return t(this,rt).call(this,s);if(i<0||i>=s.length)return null;const o=typeof((r=t(this,L).fields)==null?void 0:r.get)=="function"?t(this,L).fields.get():[];if(e!=null){const n=o.indexOf(e);return n>=0?s[i].v[n]:null}return t(this,rt).call(this,s[i])},"get"));w(this,"set",a(i=>{this.clear(),this.add(i,!1),t(this,Z).call(this)},"set"));h(this,mt,a(()=>({rowState:C.ROW_STATE.EMPTY,deleted:!1,filtered:!1,height:t(this,B).slice(),o:{},c:{},_:[0,0,0,0,C.ROW_STATE.EMPTY,!1,!1,!0,!1,!0,!0,!1,t(this,B).slice(),-1,{},{}]}),"#getDefaultMeta"));w(this,"reset",a(()=>{b(this,H,[]),b(this,ot,[]),t(this,Z).call(this)},"reset"));w(this,"clear",a(()=>{var i;t(this,R).rawRecords=[],b(this,H,[]),b(this,ot,[]),(i=t(this,R).viewRecords)!=null&&i.reset&&t(this,R).viewRecords.reset()},"clear"));h(this,Bt,a(i=>{var o;Array.isArray(i)||(i=[i]);const e=typeof((o=t(this,L).fields)==null?void 0:o.get)=="function"?t(this,L).fields.get():Object.keys(i[0]||{}),s=[];return i.forEach(r=>{const n={v:[]};e.forEach(l=>{n.v.push(r[l]!==void 0&&r[l]!==null?r[l]:"")}),s.push(n)}),s},"#json2Array"));h(this,Pt,a(i=>(Array.isArray(i)||(i=[i]),i.forEach(e=>{e.__ng=t(this,mt).call(this),e.__ng.rowid=this.nextId,e.__ng.rowState=C.ROW_STATE.INSERT,e.__ng._[0]=e.__ng.rowid}),i),"#defaultInsert"));w(this,"add",a((i,e=!0)=>{i===void 0&&(i={});const s=t(this,Bt).call(this,i);t(this,R).rawRecords=t(this,R).rawRecords.concat(t(this,Pt).call(this,s)),this.resetRecords();const o=this.count()-1;return e||s.forEach((r,n)=>{const l=t(this,R).rawRecords[o-n];l&&(l.__ng.rowState=C.ROW_STATE.EMPTY)}),t(this,Z).call(this),o},"add"));w(this,"delete",a(i=>{let e=[];Array.isArray(i)?e=i:typeof i>"u"?e=[t(this,R).host.row.at]:e=[parseInt(i,10)],e.sort((s,o)=>o-s).forEach(s=>{if(t(this,H)[s]){const o=t(this,H)[s].__ng.rowid;t(this,H)[s].__ng.rowState===C.ROW_STATE.INSERT?t(this,R).rawRecords=t(this,R).rawRecords.filter(r=>r.__ng.rowid!==o):t(this,R).rawRecords.forEach(r=>{r.__ng.rowid===o&&(r.__ng.deleted=!0,r.__ng.rowState=C.ROW_STATE.DELETE)})}}),this.resetRecords(),t(this,Z).call(this)},"delete"));w(this,"setValue",a((i,e,s)=>{var c;i=parseInt(i,10);const r=(typeof((c=t(this,L).fields)==null?void 0:c.get)=="function"?t(this,L).fields.get():[]).indexOf(e);if(r<0)return;const n=this.getValidData()[i];if(!n)return;const l=n.v[r];l!==s&&n.__ng.rowState!==C.ROW_STATE.INSERT&&(n.__ng.o.hasOwnProperty(e)||(n.__ng.o[e]=l),n.__ng.rowState=C.ROW_STATE.UPDATE),n.v[r]=s},"setValue"));w(this,"resetRecords",a(()=>{b(this,ot,t(this,R).rawRecords.filter(i=>!i.__ng.deleted)),b(this,H,t(this,R).rawRecords.filter(i=>!i.__ng.deleted&&!i.__ng.filtered)),t(this,R).rawRecords.forEach((i,e)=>{i.__ng.rowidx=e}),t(this,H).forEach((i,e)=>{i.__ng.i=e})},"resetRecords"));w(this,"getValidData",a(()=>(t(this,H).length===0&&t(this,R).rawRecords.length>0&&this.resetRecords(),t(this,H)),"getValidData"));h(this,rt,a(i=>{var n;if(!i)return i;const e=!Array.isArray(i),s=e?[i]:i,o=typeof((n=t(this,L).fields)==null?void 0:n.get)=="function"?t(this,L).fields.get():[],r=s.filter(l=>!l.__ng.deleted).map(l=>{const c={};return o.forEach((d,f)=>{c[d]=l.v?l.v[f]:l[d]}),c.__ng=l.__ng,c});return e?r[0]:r},"#conv"));w(this,"count",a(()=>this.getValidData().length,"count"));b(this,L,i),b(this,R,e),t(this,Nt).call(this)}get source(){return t(this,rt).call(this,t(this,R).rawRecords)}set source(i){this.clear(),this.add(i,!1)}get nextId(){return++ue(this,Dt)._}get length(){return t(this,H).length}getRowCount(){return this.length}};L=new WeakMap,R=new WeakMap,H=new WeakMap,ot=new WeakMap,Dt=new WeakMap,B=new WeakMap,Nt=new WeakMap,Z=new WeakMap,mt=new WeakMap,Bt=new WeakMap,Pt=new WeakMap,rt=new WeakMap,a(C,"ngData"),w(C,"ROW_STATE",{EMPTY:"EMPTY",NORMAL:"NORMAL",INSERT:"INSERT",UPDATE:"UPDATE",DELETE:"DELETE"});let Gt=C;const ae=class ae{constructor(i){h(this,G);b(this,G,i),this.row=new Zt(this),this.data=new Gt(t(this,G),this),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.pageCnt=25,this.viewRecords.reset=()=>{var e;(e=t(this,G).view)!=null&&e.redraw&&t(this,G).view.redraw()},this.setDataSource=e=>{this.data&&this.data.reset(),this.rawRecords=[],this.viewRecords=[],this.delRecords=[],this.data.set(e||[])},this.getRowState=e=>{var o,r;const s=parseInt(e,10);if(!(s>=this.data.count()))return(r=(o=this.data.getValidData()[s])==null?void 0:o.__ng)==null?void 0:r.rowState},this.getRowPosition=()=>this.row.at,this.setRowPosition=e=>{this.row.at=e},this.scrollTo_V1=e=>(e<0&&(e=0),e>=this.rawRecords.length&&(e=this.rawRecords.length-1),this.viewRecords.rawIndex=e,this.viewRecords.reset&&this.viewRecords.reset(),!(e<=0||e>=this.rawRecords.length-1)),this.getColumn=(e,s)=>this.data.get(e,s),this.setColumn=(e,s,o)=>{e=parseInt(e,10),this.data.setValue(e,s,o)},this.setDataSource([])}};G=new WeakMap,a(ae,"ngDataManager");let Jt=ae;const ce=class ce extends HTMLElement{constructor(){super();h(this,J);h(this,Yt);this.attachShadow({mode:"open"}),b(this,J,new Jt(this))}connectedCallback(){this.fields=new Ft(this),b(this,Yt,new Kt(this)),v.log("NineTable connected."),this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{target:this}}))}disconnectedCallback(){v.log("NineTable disconnected.")}get data(){return t(this,J).data}get row(){return t(this,J).row}get dataManager(){return t(this,J)}};J=new WeakMap,Yt=new WeakMap,a(ce,"NineTable");let Qt=ce;customElements.get("nine-table")||customElements.define("nine-table",Qt)});
|
|
367
367
|
//# sourceMappingURL=nine-table.umd.js.map
|