slick-table 1.1.80 → 1.1.81

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/index.cjs.js CHANGED
@@ -319,40 +319,47 @@ return o.version="2.30.1",r(Mt),o.fn=ye,o.min=oC,o.max=rC,o.now=sC,o.utc=b,o.uni
319
319
  border-collapse: collapse;
320
320
  font-size: 12px;
321
321
  }
322
- table thead {
323
- border-bottom: 1px solid gray;
324
- }
325
322
  table th,
326
323
  table td {
327
- padding: 0 10px;
324
+ padding: 0 4px;
328
325
  font-weight: normal;
329
326
  }
330
- table td.text-center {
331
- text-align: center;
332
- }
333
- table td.text-right {
334
- text-align: right;
335
- }
336
- .heading {
337
- height: 30px;
327
+ .main-table > thead {
328
+ border-bottom: 1px solid gray;
338
329
  }
339
- .heading .table-name {
330
+ .client-name {
331
+ font-size: 16px;
332
+ font-weight: bold;
333
+ padding: 6px 4px;
340
334
  text-align: left;
341
335
  }
342
- .heading .date-stamp {
343
- text-align: right;
336
+ .empty-row {
337
+ height: 15px
344
338
  }
345
- .column-name {
346
- padding-top: 1em;
339
+ .font-bold {
347
340
  font-weight: bold;
348
341
  }
349
- .align-right {
350
- text-align: right;
342
+ .row-column-names {
343
+ border-bottom: 1px solid gray;
344
+ border-top: 1px solid gray;
345
+ line-height: 2.5;
346
+ }
347
+ .slick-table {
348
+ border-bottom: double gray;
349
+ }
350
+ .text-center {
351
+ text-align: center;
351
352
  }
352
- .align-left {
353
+ .text-left {
353
354
  text-align: left;
354
355
  }
355
- `;class Nb{constructor(){this.clientId=0,this.clientName="",this.cssStyles=aB}getClientName(){const t=document.createElement("tr"),n=document.createElement("th");return n.classList.add("align-left"),n.setAttribute("colspan","100%"),n.innerText=`${this.clientName} [${this.clientId}]`,t.append(n),t}getHtmlTemplate(t){const{body:n="",footer:o="",header:r="",styles:i="",title:a=""}=t;return`
356
+ .text-right {
357
+ text-align: right;
358
+ }
359
+ .w-full {
360
+ width: 100%;
361
+ }
362
+ `;class Nb{constructor(){this.clientId=0,this.clientName="",this.cssStyles=aB}getClientName(){const t=document.createElement("tr"),n=document.createElement("th");return n.classList.add("client-name"),n.setAttribute("colspan","100%"),n.innerText=`${this.clientName} [${this.clientId}]`,t.append(n),t}getHtmlTemplate(t){const{body:n="",footer:o="",header:r="",styles:i="",title:a=""}=t;return`
356
363
  <!doctype html>
357
364
  <html lang="en">
358
365
  <head>
@@ -367,11 +374,11 @@ return o.version="2.30.1",r(Mt),o.fn=ye,o.min=oC,o.max=rC,o.now=sC,o.utc=b,o.uni
367
374
  <style>${i}</style>
368
375
  </head>
369
376
  <body>
370
- <table>
377
+ <table class="main-table w-full">
371
378
  ${r}
372
379
  <tbody>
373
380
  <tr>
374
- <td>
381
+ <td colspan="100%">
375
382
  ${n}
376
383
  </td>
377
384
  </tr>
@@ -380,7 +387,7 @@ return o.version="2.30.1",r(Mt),o.fn=ye,o.min=oC,o.max=rC,o.now=sC,o.utc=b,o.uni
380
387
  </table>
381
388
  </body>
382
389
  </html>
383
- `}columnNames(t){const n=document.createElement("tr");return(t.grid?.getColumns()||[]).filter(a=>a.forPrint).forEach(({name:a})=>{const l=document.createElement("th");l.classList.add("column-name"),typeof a=="string"?l.innerText=a:l.innerText=" ",n.append(l)}),n}tableNameAndTime(t){const n=document.createElement("tr");n.classList.add("heading");const o=document.createElement("th");o.setAttribute("colspan","2"),o.classList.add("table-name"),o.innerText=t.name||t.id,n.append(o);const r=document.createElement("th");return r.setAttribute("colspan","100%"),r.classList.add("date-stamp"),r.innerText=xe().format("MM/DD/YYYY h:mm A"),n.append(r),n}createTableElement(t){const n=document.createElement("table");return n.append(this.createColumnNames(t)),n.append(this.createTbody(t)),n}createTbody(t){const n=document.createElement("tbody"),o=t.grid;if(!o)return n;const i=o.getColumns().filter(d=>d.forPrint),a=o.getData();return Hc(a).forEach((d,u)=>{const f=this.createTr(i,u,o);n.append(f)}),n.append(...this.totals(t)),n}filters(t){const n=[];if(t.filter){const o=t.filter.print(t);if(o.length){const r=document.createElement("tr"),i=document.createElement("th");i.setAttribute("colspan","100%"),i.classList.add("align-left"),i.innerText="Applied filters",r.append(i),n.push(r)}o.forEach(r=>{n.push(r)})}return n}totals(t){return[]}createHeader(t){const n=document.createElement("thead");return n.append(this.getClientName()),n.append(this.tableNameAndTime(t)),n.append(...this.filters(t)),n}createColumnNames(t){const n=document.createElement("thead");return n.append(this.columnNames(t)),n}createTr(t,n,o){const r=document.createElement("tr"),i=o.getData(),a=i.getItem(n),l=a.__group,d=a.__groupTotals;if(l){const u=document.createElement("td");u.setAttribute("colspan","100%"),u.innerText=jy(a.title),r.append(u)}else t.forEach(u=>{const f=document.createElement("td");u.cssClass&&f.classList.add(u.cssClass);const p=u.field,w=i.getItemMetadata(n)?.columns?.[p]?.formatter,b=u.printer||w||u.formatter;let m=a[p];if(d){const v=u.groupTotalsFormatter;m=v?v(a,u,o):""}else b&&(m=b(0,0,m,u,a,o));f.innerText=m||"",r.append(f)});return r}print(t,n,o){const r=window.open();r&&(this.clientId=n,this.clientName=o,iB(r.document,this.getHtmlTemplate({title:t.name||t.id,styles:this.cssStyles,header:this.createHeader(t).outerHTML,body:this.createTableElement(t).outerHTML,footer:this.createFooter().outerHTML})),r.print())}createFooter(){return document.createElement("tfoot")}}function lB(e){const t=document.querySelector(e);if(!t)return!0;const{scrollHeight:n,scrollWidth:o}=document.documentElement,{bottom:r,left:i,right:a,top:l}=t.getBoundingClientRect();return r<=0||i>=o||a<=0||l>=n}class cB{constructor(t){this.columnPicker=null,this.copiedRows=[],this.downloadManager=new VD,this.filter=new KN,this.hotKeysBehavior=new Wy,this.summaryColumnIds=[],this._grid=null,this._grouping={},this._isActive=!1,this._isEdited=!1,this._lastActiveCell={row:0,cell:0},this._observers=[],this._printer=new Nb;const{columnPicker:n,downloadManager:o,filter:r,hotKeys:i,id:a,name:l,printer:d,summaryColumnIds:u,totalCalculator:f}=t;this.id=a,this.name=l||"",n&&(this.columnPicker=n),o&&(this.downloadManager=o),r&&(this.filter=r,this.filter.tableId=a,this.filter.args={columnFilters:mo.columnFilters.get(this.id)}),i&&(this.hotKeysBehavior=i),d&&(this.printer=d),u&&(this.summaryColumnIds=u),f&&(this.totalCalculator=f)}createGrid(t,n,o){this.reset();const r=new LW(`#${this.id}`,t,n,o);return this.grid=r,r.onKeyDown.subscribe(pm(r)),this.filter.register(r,this.id),this.grid}handleKeyboardEvent(t){lB(`#${this.id}`)||this.hotKeysBehavior.handleKeyboardEvent(t,this)}get grid(){return this._grid}get grouping(){return this._grouping}get isEdited(){return this._isEdited}set grid(t){this._grid=t}set grouping(t){if(this._grouping={...this._grouping,...t},!this.grid)return;const n=this.grid.getData();this.grouping.isGrouped?n.setGrouping(this.grouping.groups||[]):n.setGrouping([])}set isEdited(t){this._isEdited=t,this.notifyObservers()}set printer(t){this._printer=t}get printer(){return this._printer}get isActive(){return this._isActive}set isActive(t){this._isActive=t}get lastActiveSell(){return this._lastActiveCell}set lastActiveSell(t){this._lastActiveCell=t}resizeCanvas(){console.log(""),this.grid?.resizeCanvas()}registerObservers(t){~this._observers.indexOf(t)||this._observers.push(t)}notifyObservers(){for(const t of this._observers)t(this)}deleteObserver(t){const n=this._observers.indexOf(t);this._observers.splice(n,1)}reset(){this.grid?.onKeyDown.unsubscribe(pm(this.grid)),this.grid?.getSelectionModel()&&this.grid.setSelectedRows([]),this.hotKeysBehavior.resetQueue(),this.isEdited=!1,this.isActive=!1,this.grid=null}}class dB extends Ta{constructor(){super(...arguments),this.clientId=0,this.clientName="",this.x=0,this.y=0}}const on=new dB;class uB extends Ta{constructor(){super(...arguments),this.x=0,this.y=0}}const fo=new uB;class hB extends Ta{constructor(){super(...arguments),this._open=!1,this.x=0,this.y=0}get open(){return this._open}set open(t){this._open=t,this.notify()}get table(){return this._table}set table(t){this._table=t}}const jn=new hB,fB=e=>{const t=e.getLength()-1;return e.getItem(t)},Bc=e=>{const t=e.getData(),n=t.getIdPropertyName(),o=t.getItems();let r=0;return o.forEach(i=>{i[n]>r&&(r=i[n])}),r+1},Hh=()=>{Db.commitCurrentEdit()};function zh(e){return e.ctrlKey||e.metaKey}function Yh(e){return zh(e)&&e.keyCode===Jr.KeyB}function Ab(e){return e.shiftKey&&e.keyCode===Jr.KeyDel}function pB(e){return e.altKey&&e.keyCode===Jr.KeyS}function Uh(e){return zh(e)&&e.keyCode===Jr.KeyY}function qh(e){return zh(e)&&e.keyCode===Jr.KeyZ}function mB(e){const t=e.getActiveCell();return!e.getSelectedRows().length&&!t}function Fb(e){const t=gB(e),o=e.getData().getItems(),r=o.findIndex(a=>a.id===t)+1,i=o.length;return r||i}const Hc=e=>{const t=[];for(let n=0;n<e.getLength();n++)t.push(e.getItem(n));return t},Lb=e=>{const t=e.getSelectedRows(),n=e.getData(),o=Hc(n),r=n.getItems(),i=[],a=n.getIdPropertyName();let l=Bc(e);t.length?t.forEach(d=>{i.push({...o[d],[a]:l++,isEdited:!0,isNew:!0})}):i.push({[a]:l,isEdited:!0,isNew:!0}),r.splice(Fb(e),0,...i),n.setItems(r),e.setSelectedRows([]),e.invalidate()},gB=e=>{const t=e.getData(),n=Hc(t),o=e.getActiveCell()?.row;return o!==void 0?(n[o]||n[n.length-1])?.id:0};function yB(e){return function(t){t.preventDefault(),Hh(),on.table=e,on.x=t.pageX||0,on.y=t.pageY||0,on.notify()}}function vB(e){return function(t){t.preventDefault(),Hh(),fo.table=e,fo.x=t.pageX||0,fo.y=t.pageY||0,fo.notify()}}class bB extends Ta{constructor(){super(...arguments),this._activeTable=null}get activeTable(){return this._activeTable}set activeTable(t){this._activeTable=t}}const ki=new bB,wB=e=>{function t(){if(e.id!==ki.activeTable?.id){e.isActive=!1;const o=e.grid;o?.resetActiveCell(),o?.setSelectedRows([])}}function n(){e.isActive=!0,ki.activeTable=e,ki.notify()}Fe.useEffect(()=>{ki.subscribe(t),document.addEventListener("keydown",e.handleKeyboardEvent.bind(e));const o=document.getElementById(e.id);if(o)return o.addEventListener("click",n,!0),()=>{ki.unsubscribe(t),document.removeEventListener("keydown",e.handleKeyboardEvent.bind(e)),o.removeEventListener("click",n,!0)}},[])},CB=e=>{const[t,n]=Fe.useState(SB(e));return Fe.useEffect(()=>{const o=r=>{n(i=>({...i,[r.id]:r.isEdited}))};return e.forEach(r=>{r.registerObservers(o)}),()=>{e.forEach(r=>{r.deleteObserver(o)})}},[]),Object.values(t).some(o=>o)};function SB(e){const t={};for(const n of e)t[n.id]=n.isEdited;return t}function _B(e){Fe.useEffect(()=>{function t(){e.grid?.resizeCanvas()}const n=Lv(t);return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[])}const xB=e=>{Fe.useEffect(()=>{function t(n){const o=n.grid;o&&n.totalCalculator?.calculate(o)}return e.registerObservers(t),()=>{e.deleteObserver(t)}},[])},RB=e=>{if(!e)return 0;if(typeof e=="number")return e;const t=e.replace(/\$|,|\s/g,""),n=t.replace(/\(|\)/g,"");return isNaN(Number(n))?0:t.startsWith("(")&&t.endsWith(")")?0-Number(n):Number(t)},Br=function(){const e=function(x,S,C,O){for(C=C||{},O=x.length;O--;C[x[O]]=S);return C},t=[1,3],n=[1,4],o=[1,5],r=[1,6],i=[1,7],a=[1,9],l=[1,10],d=[1,11],u=[1,12],f=[1,13],p=[1,14],y=[1,15],w=[5,6,7,8,9,10,11,12,14],b=[5,6,7,14],m=[5,6,7,8,9,14],v={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"+":6,"-":7,"*":8,"/":9,"^":10,"!":11,"%":12,"(":13,")":14,NUMBER:15,E:16,PI:17,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"+",7:"-",8:"*",9:"/",10:"^",11:"!",12:"%",13:"(",14:")",15:"NUMBER",16:"E",17:"PI"},productions_:[0,[3,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,2],[4,3],[4,1],[4,1],[4,1]],performAction:function(S,C,O,A,F,W,R){const $=W.length-1;switch(F){case 1:return W[$-1];case 2:this.$=W[$-2]+W[$];break;case 3:this.$=W[$-2]-W[$];break;case 4:this.$=W[$-2]*W[$];break;case 5:this.$=W[$-2]/W[$];break;case 6:this.$=Math.pow(W[$-2],W[$]);break;case 7:this.$=function K(G){return G==0?1:K(G-1)*G}(W[$-1]);break;case 8:this.$=W[$-1]/100;break;case 9:this.$=-W[$];break;case 10:this.$=W[$-1];break;case 11:this.$=Number(S);break;case 12:this.$=Math.E;break;case 13:this.$=Math.PI;break}},table:[{3:1,4:2,7:t,13:n,15:o,16:r,17:i},{1:[3]},{5:[1,8],6:a,7:l,8:d,9:u,10:f,11:p,12:y},{4:16,7:t,13:n,15:o,16:r,17:i},{4:17,7:t,13:n,15:o,16:r,17:i},e(w,[2,11]),e(w,[2,12]),e(w,[2,13]),{1:[2,1]},{4:18,7:t,13:n,15:o,16:r,17:i},{4:19,7:t,13:n,15:o,16:r,17:i},{4:20,7:t,13:n,15:o,16:r,17:i},{4:21,7:t,13:n,15:o,16:r,17:i},{4:22,7:t,13:n,15:o,16:r,17:i},e(w,[2,7]),e(w,[2,8]),e(w,[2,9]),{6:a,7:l,8:d,9:u,10:f,11:p,12:y,14:[1,23]},e(b,[2,2],{8:d,9:u,10:f,11:p,12:y}),e(b,[2,3],{8:d,9:u,10:f,11:p,12:y}),e(m,[2,4],{10:f,11:p,12:y}),e(m,[2,5],{10:f,11:p,12:y}),e([5,6,7,8,9,10,14],[2,6],{11:p,12:y}),e(w,[2,10])],defaultActions:{8:[2,1]},parseError:function(S,C){if(C.recoverable)this.trace(S);else{const O=new Error(S);throw O.hash=C,O}},parse:function(S){const C=this;let O=[0],A=[null],F=[];const W=this.table;let R="",$=0,K=0;const G=2,q=1,Y=F.slice.call(arguments,1),z=Object.create(this.lexer),ae={yy:{}};for(let le in this.yy)Object.prototype.hasOwnProperty.call(this.yy,le)&&(ae.yy[le]=this.yy[le]);z.setInput(S,ae.yy),ae.yy.lexer=z,ae.yy.parser=this,typeof z.yylloc>"u"&&(z.yylloc={});let N=z.yylloc;F.push(N);const M=z.options&&z.options.ranges;typeof ae.yy.parseError=="function"?this.parseError=ae.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;var L=function(){let le;return le=z.lex()||q,typeof le!="number"&&(le=C.symbols_[le]||le),le};let B,ne,oe,se;const j={};let ee,J,te,ce;for(;;){if(ne=O[O.length-1],this.defaultActions[ne]?oe=this.defaultActions[ne]:((B===null||typeof B>"u")&&(B=L()),oe=W[ne]&&W[ne][B]),typeof oe>"u"||!oe.length||!oe[0]){let le="";ce=[];for(ee in W[ne])this.terminals_[ee]&&ee>G&&ce.push("'"+this.terminals_[ee]+"'");z.showPosition?le="Parse error on line "+($+1)+`:
390
+ `}columnNames(t){const n=document.createElement("thead"),o=document.createElement("tr");o.classList.add("empty-row");const r=document.createElement("tr");return r.classList.add("row-column-names"),(t.grid?.getColumns()||[]).filter(d=>d.forPrint).forEach(({name:d})=>{const u=document.createElement("th");u.classList.add("text-left"),typeof d=="string"?u.innerText=d:u.innerText=" ",r.append(u)}),n.append(o),n.append(r),n}tableNameAndTime(t){const n=document.createElement("tr"),o=document.createElement("th");o.classList.add("text-left"),o.innerText=t.name||t.id,n.append(o);const r=document.createElement("th");return r.classList.add("text-right"),r.innerText=xe().format("MM/DD/YYYY h:mm A"),n.append(r),n}createTableElement(t){const n=document.createElement("table");return n.classList.add("slick-table"),n.style.width="100%",n.append(this.columnNames(t)),n.append(this.createTbody(t)),n}createTbody(t){const n=document.createElement("tbody"),o=t.grid;if(!o)return n;const i=o.getColumns().filter(d=>d.forPrint),a=o.getData();return Hc(a).forEach((d,u)=>{const f=this.createTr(i,u,o);n.append(f)}),n.append(...this.totals(t)),n}filters(t){const n=[];if(t.filter){const o=t.filter.print(t);if(o.length){const r=document.createElement("tr"),i=document.createElement("th");i.setAttribute("colspan","100%"),i.classList.add("text-left"),i.innerText="Applied filters",r.append(i),n.push(r)}o.forEach(r=>{n.push(r)})}return n}totals(t){return[]}createHeader(t){const n=document.createElement("thead");return n.append(this.getClientName()),n.append(this.tableNameAndTime(t)),n.append(...this.filters(t)),n}createTr(t,n,o){const r=document.createElement("tr"),i=o.getData(),a=i.getItem(n),l=a.__group,d=a.__groupTotals;if(l){const u=document.createElement("td");u.setAttribute("colspan","100%"),u.innerText=jy(a.title),r.append(u)}else t.forEach(u=>{const f=document.createElement("td");u.cssClass&&f.classList.add(u.cssClass);const p=u.field,w=i.getItemMetadata(n)?.columns?.[p]?.formatter,b=u.printer||w||u.formatter;let m=a[p];if(d){const v=u.groupTotalsFormatter;m=v?v(a,u,o):""}else b&&(m=b(0,0,m,u,a,o));f.innerText=m||"",r.append(f)});return r}print(t,n,o){const r=window.open();r&&(this.clientId=n,this.clientName=o,iB(r.document,this.getHtmlTemplate({title:t.name||t.id,styles:this.cssStyles,header:this.createHeader(t).outerHTML,body:this.createTableElement(t).outerHTML,footer:this.createFooter().outerHTML})),r.print())}createFooter(){return document.createElement("tfoot")}}function lB(e){const t=document.querySelector(e);if(!t)return!0;const{scrollHeight:n,scrollWidth:o}=document.documentElement,{bottom:r,left:i,right:a,top:l}=t.getBoundingClientRect();return r<=0||i>=o||a<=0||l>=n}class cB{constructor(t){this.columnPicker=null,this.copiedRows=[],this.downloadManager=new VD,this.filter=new KN,this.hotKeysBehavior=new Wy,this.summaryColumnIds=[],this._grid=null,this._grouping={},this._isActive=!1,this._isEdited=!1,this._lastActiveCell={row:0,cell:0},this._observers=[],this._printer=new Nb;const{columnPicker:n,downloadManager:o,filter:r,hotKeys:i,id:a,name:l,printer:d,summaryColumnIds:u,totalCalculator:f}=t;this.id=a,this.name=l||"",n&&(this.columnPicker=n),o&&(this.downloadManager=o),r&&(this.filter=r,this.filter.tableId=a,this.filter.args={columnFilters:mo.columnFilters.get(this.id)}),i&&(this.hotKeysBehavior=i),d&&(this.printer=d),u&&(this.summaryColumnIds=u),f&&(this.totalCalculator=f)}createGrid(t,n,o){this.reset();const r=new LW(`#${this.id}`,t,n,o);return this.grid=r,r.onKeyDown.subscribe(pm(r)),this.filter.register(r,this.id),this.grid}handleKeyboardEvent(t){lB(`#${this.id}`)||this.hotKeysBehavior.handleKeyboardEvent(t,this)}get grid(){return this._grid}get grouping(){return this._grouping}get isEdited(){return this._isEdited}set grid(t){this._grid=t}set grouping(t){if(this._grouping={...this._grouping,...t},!this.grid)return;const n=this.grid.getData();this.grouping.isGrouped?n.setGrouping(this.grouping.groups||[]):n.setGrouping([])}set isEdited(t){this._isEdited=t,this.notifyObservers()}set printer(t){this._printer=t}get printer(){return this._printer}get isActive(){return this._isActive}set isActive(t){this._isActive=t}get lastActiveSell(){return this._lastActiveCell}set lastActiveSell(t){this._lastActiveCell=t}resizeCanvas(){console.log(""),this.grid?.resizeCanvas()}registerObservers(t){~this._observers.indexOf(t)||this._observers.push(t)}notifyObservers(){for(const t of this._observers)t(this)}deleteObserver(t){const n=this._observers.indexOf(t);this._observers.splice(n,1)}reset(){this.grid?.onKeyDown.unsubscribe(pm(this.grid)),this.grid?.getSelectionModel()&&this.grid.setSelectedRows([]),this.hotKeysBehavior.resetQueue(),this.isEdited=!1,this.isActive=!1,this.grid=null}}class dB extends Ta{constructor(){super(...arguments),this.clientId=0,this.clientName="",this.x=0,this.y=0}}const on=new dB;class uB extends Ta{constructor(){super(...arguments),this.x=0,this.y=0}}const fo=new uB;class hB extends Ta{constructor(){super(...arguments),this._open=!1,this.x=0,this.y=0}get open(){return this._open}set open(t){this._open=t,this.notify()}get table(){return this._table}set table(t){this._table=t}}const jn=new hB,fB=e=>{const t=e.getLength()-1;return e.getItem(t)},Bc=e=>{const t=e.getData(),n=t.getIdPropertyName(),o=t.getItems();let r=0;return o.forEach(i=>{i[n]>r&&(r=i[n])}),r+1},Hh=()=>{Db.commitCurrentEdit()};function zh(e){return e.ctrlKey||e.metaKey}function Yh(e){return zh(e)&&e.keyCode===Jr.KeyB}function Ab(e){return e.shiftKey&&e.keyCode===Jr.KeyDel}function pB(e){return e.altKey&&e.keyCode===Jr.KeyS}function Uh(e){return zh(e)&&e.keyCode===Jr.KeyY}function qh(e){return zh(e)&&e.keyCode===Jr.KeyZ}function mB(e){const t=e.getActiveCell();return!e.getSelectedRows().length&&!t}function Fb(e){const t=gB(e),o=e.getData().getItems(),r=o.findIndex(a=>a.id===t)+1,i=o.length;return r||i}const Hc=e=>{const t=[];for(let n=0;n<e.getLength();n++)t.push(e.getItem(n));return t},Lb=e=>{const t=e.getSelectedRows(),n=e.getData(),o=Hc(n),r=n.getItems(),i=[],a=n.getIdPropertyName();let l=Bc(e);t.length?t.forEach(d=>{i.push({...o[d],[a]:l++,isEdited:!0,isNew:!0})}):i.push({[a]:l,isEdited:!0,isNew:!0}),r.splice(Fb(e),0,...i),n.setItems(r),e.setSelectedRows([]),e.invalidate()},gB=e=>{const t=e.getData(),n=Hc(t),o=e.getActiveCell()?.row;return o!==void 0?(n[o]||n[n.length-1])?.id:0};function yB(e){return function(t){t.preventDefault(),Hh(),on.table=e,on.x=t.pageX||0,on.y=t.pageY||0,on.notify()}}function vB(e){return function(t){t.preventDefault(),Hh(),fo.table=e,fo.x=t.pageX||0,fo.y=t.pageY||0,fo.notify()}}class bB extends Ta{constructor(){super(...arguments),this._activeTable=null}get activeTable(){return this._activeTable}set activeTable(t){this._activeTable=t}}const ki=new bB,wB=e=>{function t(){if(e.id!==ki.activeTable?.id){e.isActive=!1;const o=e.grid;o?.resetActiveCell(),o?.setSelectedRows([])}}function n(){e.isActive=!0,ki.activeTable=e,ki.notify()}Fe.useEffect(()=>{ki.subscribe(t),document.addEventListener("keydown",e.handleKeyboardEvent.bind(e));const o=document.getElementById(e.id);if(o)return o.addEventListener("click",n,!0),()=>{ki.unsubscribe(t),document.removeEventListener("keydown",e.handleKeyboardEvent.bind(e)),o.removeEventListener("click",n,!0)}},[])},CB=e=>{const[t,n]=Fe.useState(SB(e));return Fe.useEffect(()=>{const o=r=>{n(i=>({...i,[r.id]:r.isEdited}))};return e.forEach(r=>{r.registerObservers(o)}),()=>{e.forEach(r=>{r.deleteObserver(o)})}},[]),Object.values(t).some(o=>o)};function SB(e){const t={};for(const n of e)t[n.id]=n.isEdited;return t}function _B(e){Fe.useEffect(()=>{function t(){e.grid?.resizeCanvas()}const n=Lv(t);return window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[])}const xB=e=>{Fe.useEffect(()=>{function t(n){const o=n.grid;o&&n.totalCalculator?.calculate(o)}return e.registerObservers(t),()=>{e.deleteObserver(t)}},[])},RB=e=>{if(!e)return 0;if(typeof e=="number")return e;const t=e.replace(/\$|,|\s/g,""),n=t.replace(/\(|\)/g,"");return isNaN(Number(n))?0:t.startsWith("(")&&t.endsWith(")")?0-Number(n):Number(t)},Br=function(){const e=function(x,S,C,O){for(C=C||{},O=x.length;O--;C[x[O]]=S);return C},t=[1,3],n=[1,4],o=[1,5],r=[1,6],i=[1,7],a=[1,9],l=[1,10],d=[1,11],u=[1,12],f=[1,13],p=[1,14],y=[1,15],w=[5,6,7,8,9,10,11,12,14],b=[5,6,7,14],m=[5,6,7,8,9,14],v={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"+":6,"-":7,"*":8,"/":9,"^":10,"!":11,"%":12,"(":13,")":14,NUMBER:15,E:16,PI:17,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"+",7:"-",8:"*",9:"/",10:"^",11:"!",12:"%",13:"(",14:")",15:"NUMBER",16:"E",17:"PI"},productions_:[0,[3,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,2],[4,3],[4,1],[4,1],[4,1]],performAction:function(S,C,O,A,F,W,R){const $=W.length-1;switch(F){case 1:return W[$-1];case 2:this.$=W[$-2]+W[$];break;case 3:this.$=W[$-2]-W[$];break;case 4:this.$=W[$-2]*W[$];break;case 5:this.$=W[$-2]/W[$];break;case 6:this.$=Math.pow(W[$-2],W[$]);break;case 7:this.$=function K(G){return G==0?1:K(G-1)*G}(W[$-1]);break;case 8:this.$=W[$-1]/100;break;case 9:this.$=-W[$];break;case 10:this.$=W[$-1];break;case 11:this.$=Number(S);break;case 12:this.$=Math.E;break;case 13:this.$=Math.PI;break}},table:[{3:1,4:2,7:t,13:n,15:o,16:r,17:i},{1:[3]},{5:[1,8],6:a,7:l,8:d,9:u,10:f,11:p,12:y},{4:16,7:t,13:n,15:o,16:r,17:i},{4:17,7:t,13:n,15:o,16:r,17:i},e(w,[2,11]),e(w,[2,12]),e(w,[2,13]),{1:[2,1]},{4:18,7:t,13:n,15:o,16:r,17:i},{4:19,7:t,13:n,15:o,16:r,17:i},{4:20,7:t,13:n,15:o,16:r,17:i},{4:21,7:t,13:n,15:o,16:r,17:i},{4:22,7:t,13:n,15:o,16:r,17:i},e(w,[2,7]),e(w,[2,8]),e(w,[2,9]),{6:a,7:l,8:d,9:u,10:f,11:p,12:y,14:[1,23]},e(b,[2,2],{8:d,9:u,10:f,11:p,12:y}),e(b,[2,3],{8:d,9:u,10:f,11:p,12:y}),e(m,[2,4],{10:f,11:p,12:y}),e(m,[2,5],{10:f,11:p,12:y}),e([5,6,7,8,9,10,14],[2,6],{11:p,12:y}),e(w,[2,10])],defaultActions:{8:[2,1]},parseError:function(S,C){if(C.recoverable)this.trace(S);else{const O=new Error(S);throw O.hash=C,O}},parse:function(S){const C=this;let O=[0],A=[null],F=[];const W=this.table;let R="",$=0,K=0;const G=2,q=1,Y=F.slice.call(arguments,1),z=Object.create(this.lexer),ae={yy:{}};for(let le in this.yy)Object.prototype.hasOwnProperty.call(this.yy,le)&&(ae.yy[le]=this.yy[le]);z.setInput(S,ae.yy),ae.yy.lexer=z,ae.yy.parser=this,typeof z.yylloc>"u"&&(z.yylloc={});let N=z.yylloc;F.push(N);const M=z.options&&z.options.ranges;typeof ae.yy.parseError=="function"?this.parseError=ae.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;var L=function(){let le;return le=z.lex()||q,typeof le!="number"&&(le=C.symbols_[le]||le),le};let B,ne,oe,se;const j={};let ee,J,te,ce;for(;;){if(ne=O[O.length-1],this.defaultActions[ne]?oe=this.defaultActions[ne]:((B===null||typeof B>"u")&&(B=L()),oe=W[ne]&&W[ne][B]),typeof oe>"u"||!oe.length||!oe[0]){let le="";ce=[];for(ee in W[ne])this.terminals_[ee]&&ee>G&&ce.push("'"+this.terminals_[ee]+"'");z.showPosition?le="Parse error on line "+($+1)+`:
384
391
  `+z.showPosition()+`
385
392
  Expecting `+ce.join(", ")+", got '"+(this.terminals_[B]||B)+"'":le="Parse error on line "+($+1)+": Unexpected "+(B==q?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(le,{text:z.match,token:this.terminals_[B]||B,line:z.yylineno,loc:N,expected:ce})}if(oe[0]instanceof Array&&oe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ne+", token: "+B);switch(oe[0]){case 1:O.push(B),A.push(z.yytext),F.push(z.yylloc),O.push(oe[1]),B=null,K=z.yyleng,R=z.yytext,$=z.yylineno,N=z.yylloc;break;case 2:if(J=this.productions_[oe[1]][1],j.$=A[A.length-J],j._$={first_line:F[F.length-(J||1)].first_line,last_line:F[F.length-1].last_line,first_column:F[F.length-(J||1)].first_column,last_column:F[F.length-1].last_column},M&&(j._$.range=[F[F.length-(J||1)].range[0],F[F.length-1].range[1]]),se=this.performAction.apply(j,[R,K,$,ae.yy,oe[1],A,F].concat(Y)),typeof se<"u")return se;J&&(O=O.slice(0,-1*J*2),A=A.slice(0,-1*J),F=F.slice(0,-1*J)),O.push(this.productions_[oe[1]][0]),A.push(j.$),F.push(j._$),te=W[O[O.length-2]][O[O.length-1]],O.push(te);break;case 3:return!0}}return!0}},P=function(){return{EOF:1,parseError:function(C,O){if(this.yy.parser)this.yy.parser.parseError(C,O);else throw new Error(C)},setInput:function(S,C){return this.yy=C||this.yy||{},this._input=S,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){const S=this._input[0];return this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S,S.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),S},unput:function(S){const C=S.length,O=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-C),this.offset-=C;const A=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),O.length-1&&(this.yylineno-=O.length-1);const F=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:O?(O.length===A.length?this.yylloc.first_column:0)+A[A.length-O.length].length-O[0].length:this.yylloc.first_column-C},this.options.ranges&&(this.yylloc.range=[F[0],F[0]+this.yyleng-C]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
386
393
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(S){this.unput(this.match.slice(S))},pastInput:function(){const S=this.matched.substr(0,this.matched.length-this.match.length);return(S.length>20?"...":"")+S.substr(-20).replace(/\n/g,"")},upcomingInput:function(){let S=this.match;return S.length<20&&(S+=this._input.substr(0,20-S.length)),(S.substr(0,20)+(S.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){const S=this.pastInput(),C=new Array(S.length+1).join("-");return S+this.upcomingInput()+`
package/dist/index.es.js CHANGED
@@ -43836,39 +43836,46 @@ const GW = `
43836
43836
  border-collapse: collapse;
43837
43837
  font-size: 12px;
43838
43838
  }
43839
- table thead {
43840
- border-bottom: 1px solid gray;
43841
- }
43842
43839
  table th,
43843
43840
  table td {
43844
- padding: 0 10px;
43841
+ padding: 0 4px;
43845
43842
  font-weight: normal;
43846
43843
  }
43847
- table td.text-center {
43848
- text-align: center;
43849
- }
43850
- table td.text-right {
43851
- text-align: right;
43852
- }
43853
- .heading {
43854
- height: 30px;
43844
+ .main-table > thead {
43845
+ border-bottom: 1px solid gray;
43855
43846
  }
43856
- .heading .table-name {
43847
+ .client-name {
43848
+ font-size: 16px;
43849
+ font-weight: bold;
43850
+ padding: 6px 4px;
43857
43851
  text-align: left;
43858
43852
  }
43859
- .heading .date-stamp {
43860
- text-align: right;
43853
+ .empty-row {
43854
+ height: 15px
43861
43855
  }
43862
- .column-name {
43863
- padding-top: 1em;
43856
+ .font-bold {
43864
43857
  font-weight: bold;
43865
43858
  }
43866
- .align-right {
43867
- text-align: right;
43859
+ .row-column-names {
43860
+ border-bottom: 1px solid gray;
43861
+ border-top: 1px solid gray;
43862
+ line-height: 2.5;
43863
+ }
43864
+ .slick-table {
43865
+ border-bottom: double gray;
43868
43866
  }
43869
- .align-left {
43867
+ .text-center {
43868
+ text-align: center;
43869
+ }
43870
+ .text-left {
43870
43871
  text-align: left;
43871
43872
  }
43873
+ .text-right {
43874
+ text-align: right;
43875
+ }
43876
+ .w-full {
43877
+ width: 100%;
43878
+ }
43872
43879
  `;
43873
43880
  class KW {
43874
43881
  constructor() {
@@ -43876,7 +43883,7 @@ class KW {
43876
43883
  }
43877
43884
  getClientName() {
43878
43885
  const t = document.createElement("tr"), n = document.createElement("th");
43879
- return n.classList.add("align-left"), n.setAttribute("colspan", "100%"), n.innerText = `${this.clientName} [${this.clientId}]`, t.append(n), t;
43886
+ return n.classList.add("client-name"), n.setAttribute("colspan", "100%"), n.innerText = `${this.clientName} [${this.clientId}]`, t.append(n), t;
43880
43887
  }
43881
43888
  getHtmlTemplate(t) {
43882
43889
  const {
@@ -43901,11 +43908,11 @@ class KW {
43901
43908
  <style>${i}</style>
43902
43909
  </head>
43903
43910
  <body>
43904
- <table>
43911
+ <table class="main-table w-full">
43905
43912
  ${r}
43906
43913
  <tbody>
43907
43914
  <tr>
43908
- <td>
43915
+ <td colspan="100%">
43909
43916
  ${n}
43910
43917
  </td>
43911
43918
  </tr>
@@ -43917,23 +43924,23 @@ class KW {
43917
43924
  `;
43918
43925
  }
43919
43926
  columnNames(t) {
43920
- const n = document.createElement("tr");
43921
- return (t.grid?.getColumns() || []).filter((a) => a.forPrint).forEach(({ name: a }) => {
43922
- const l = document.createElement("th");
43923
- l.classList.add("column-name"), typeof a == "string" ? l.innerText = a : l.innerText = " ", n.append(l);
43924
- }), n;
43927
+ const n = document.createElement("thead"), o = document.createElement("tr");
43928
+ o.classList.add("empty-row");
43929
+ const r = document.createElement("tr");
43930
+ return r.classList.add("row-column-names"), (t.grid?.getColumns() || []).filter((d) => d.forPrint).forEach(({ name: d }) => {
43931
+ const u = document.createElement("th");
43932
+ u.classList.add("text-left"), typeof d == "string" ? u.innerText = d : u.innerText = " ", r.append(u);
43933
+ }), n.append(o), n.append(r), n;
43925
43934
  }
43926
43935
  tableNameAndTime(t) {
43927
- const n = document.createElement("tr");
43928
- n.classList.add("heading");
43929
- const o = document.createElement("th");
43930
- o.setAttribute("colspan", "2"), o.classList.add("table-name"), o.innerText = t.name || t.id, n.append(o);
43936
+ const n = document.createElement("tr"), o = document.createElement("th");
43937
+ o.classList.add("text-left"), o.innerText = t.name || t.id, n.append(o);
43931
43938
  const r = document.createElement("th");
43932
- return r.setAttribute("colspan", "100%"), r.classList.add("date-stamp"), r.innerText = xe().format("MM/DD/YYYY h:mm A"), n.append(r), n;
43939
+ return r.classList.add("text-right"), r.innerText = xe().format("MM/DD/YYYY h:mm A"), n.append(r), n;
43933
43940
  }
43934
43941
  createTableElement(t) {
43935
43942
  const n = document.createElement("table");
43936
- return n.append(this.createColumnNames(t)), n.append(this.createTbody(t)), n;
43943
+ return n.classList.add("slick-table"), n.style.width = "100%", n.append(this.columnNames(t)), n.append(this.createTbody(t)), n;
43937
43944
  }
43938
43945
  createTbody(t) {
43939
43946
  const n = document.createElement("tbody"), o = t.grid;
@@ -43950,7 +43957,7 @@ class KW {
43950
43957
  const o = t.filter.print(t);
43951
43958
  if (o.length) {
43952
43959
  const r = document.createElement("tr"), i = document.createElement("th");
43953
- i.setAttribute("colspan", "100%"), i.classList.add("align-left"), i.innerText = "Applied filters", r.append(i), n.push(r);
43960
+ i.setAttribute("colspan", "100%"), i.classList.add("text-left"), i.innerText = "Applied filters", r.append(i), n.push(r);
43954
43961
  }
43955
43962
  o.forEach((r) => {
43956
43963
  n.push(r);
@@ -43966,10 +43973,6 @@ class KW {
43966
43973
  const n = document.createElement("thead");
43967
43974
  return n.append(this.getClientName()), n.append(this.tableNameAndTime(t)), n.append(...this.filters(t)), n;
43968
43975
  }
43969
- createColumnNames(t) {
43970
- const n = document.createElement("thead");
43971
- return n.append(this.columnNames(t)), n;
43972
- }
43973
43976
  createTr(t, n, o) {
43974
43977
  const r = document.createElement("tr"), i = o.getData(), a = i.getItem(n), l = a.__group, d = a.__groupTotals;
43975
43978
  if (l) {
@@ -6,7 +6,7 @@ export declare class DefaultPrinter implements IPrinter {
6
6
  cssStyles: string;
7
7
  getClientName(): HTMLTableRowElement;
8
8
  getHtmlTemplate(args: IHtmlDocElements): string;
9
- columnNames(table: ISlickTable): HTMLTableRowElement;
9
+ columnNames(table: ISlickTable): HTMLTableSectionElement;
10
10
  tableNameAndTime(table: ISlickTable): HTMLTableRowElement;
11
11
  createTableElement(table: ISlickTable): HTMLTableElement;
12
12
  createTbody(table: ISlickTable): HTMLTableSectionElement;
@@ -14,7 +14,6 @@ export declare class DefaultPrinter implements IPrinter {
14
14
  /** for tables with total calculations */
15
15
  totals(_table: ISlickTable): HTMLTableRowElement[];
16
16
  createHeader(table: ISlickTable): HTMLTableSectionElement;
17
- createColumnNames(table: ISlickTable): HTMLTableSectionElement;
18
17
  createTr(columns: IColumn[], rowIndex: number, grid: SlickGrid): HTMLTableRowElement;
19
18
  print(table: ISlickTable, clientId: number, clientName: string): void;
20
19
  createFooter(): HTMLTableSectionElement;
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultPrinter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/model/SlickTable/printer/DefaultPrinter.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAa,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,qBAAa,cAAe,YAAW,QAAQ;IAC9C,QAAQ,SAAK;IACb,UAAU,SAAM;IAChB,SAAS,SAAa;IAEtB,aAAa,IAAI,mBAAmB;IAWpC,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM;IAsC/C,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB;IAmBpD,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB;IAkBzD,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB;IAMxD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB;IAmBxD,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,EAAE;IAmBlD,yCAAyC;IACzC,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,EAAE;IAGlD,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB;IAOzD,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB;IAK9D,QAAQ,CACP,OAAO,EAAE,OAAO,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,GACb,mBAAmB;IAkCtB,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAiBrE,YAAY,IAAI,uBAAuB;CAIvC"}
1
+ {"version":3,"file":"DefaultPrinter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/model/SlickTable/printer/DefaultPrinter.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAa,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,qBAAa,cAAe,YAAW,QAAQ;IAC9C,QAAQ,SAAK;IACb,UAAU,SAAM;IAChB,SAAS,SAAa;IAEtB,aAAa,IAAI,mBAAmB;IAWpC,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM;IAsC/C,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB;IAyBxD,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB;IAezD,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB;IAQxD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB;IAmBxD,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,EAAE;IAmBlD,yCAAyC;IACzC,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,EAAE;IAGlD,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB;IAOzD,QAAQ,CACP,OAAO,EAAE,OAAO,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,GACb,mBAAmB;IAkCtB,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAiBrE,YAAY,IAAI,uBAAuB;CAIvC"}
@@ -1,2 +1,2 @@
1
- export declare const cssStyles = "\n\t\thtml body {\n\t\t\tfont-family: Carlito, Calibri, Arial, Helvetica, sans-serif;\n\t\t\tfont-size: 12px;\n\t\t}\n\t\tbody table {\n\t\t\tmargin: 0 auto;\n\t\t\tborder-collapse: collapse;\n\t\t\tfont-size: 12px;\n\t\t}\n\t\ttable thead {\n\t\t\tborder-bottom: 1px solid gray;\n\t\t}\n\t\ttable th,\n\t\ttable td {\n\t\t\tpadding: 0 10px;\n\t\t\tfont-weight: normal;\n\t\t}\n\t\ttable td.text-center {\n\t\t\ttext-align: center;\n\t\t}\n\t\ttable td.text-right {\n\t\t\ttext-align: right;\n\t\t}\n\t\t.heading {\n\t\t\theight: 30px;\n\t\t}\n\t\t.heading .table-name {\n\t\t\ttext-align: left;\n\t\t}\n\t\t.heading .date-stamp {\n\t\t\ttext-align: right;\n\t\t}\n\t\t.column-name {\n\t\t\tpadding-top: 1em;\n\t\t\tfont-weight: bold;\n\t\t}\n\t\t.align-right {\n\t\t\ttext-align: right;\n\t\t}\n\t\t.align-left {\n\t\t\ttext-align: left;\n\t\t}\n\t";
1
+ export declare const cssStyles = "\n\t\thtml body {\n\t\t\tfont-family: Carlito, Calibri, Arial, Helvetica, sans-serif;\n\t\t\tfont-size: 12px;\n\t\t}\n\t\tbody table {\n\t\t\tmargin: 0 auto;\n\t\t\tborder-collapse: collapse;\n\t\t\tfont-size: 12px;\n\t\t}\n\t\ttable th,\n\t\ttable td {\n\t\t\tpadding: 0 4px;\n\t\t\tfont-weight: normal;\n\t\t}\n\t\t.main-table > thead {\n\t\t\tborder-bottom: 1px solid gray;\n\t\t}\n\t\t.client-name {\n\t\t\tfont-size: 16px;\n\t\t\tfont-weight: bold;\n\t\t\tpadding: 6px 4px;\n\t\t\ttext-align: left;\n\t\t}\n\t\t.empty-row {\n\t\t\theight: 15px\n\t\t}\n\t\t.font-bold {\n\t\t\tfont-weight: bold;\n\t\t}\n\t\t.row-column-names {\n\t\t\tborder-bottom: 1px solid gray;\n\t\t\tborder-top: 1px solid gray;\n\t\t\tline-height: 2.5;\n\t\t}\n\t\t.slick-table {\n\t\t\tborder-bottom: double gray;\n\t\t}\n\t\t.text-center {\n\t\t\ttext-align: center;\n\t\t}\n\t\t.text-left {\n\t\t\ttext-align: left;\n\t\t}\n\t\t.text-right {\n\t\t\ttext-align: right;\n\t\t}\n\t\t.w-full {\n\t\t\twidth: 100%;\n\t\t}\n\t";
2
2
  //# sourceMappingURL=cssStyles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cssStyles.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/shared/lib/slickgrid/model/SlickTable/printer/model/consts/cssStyles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,s1BA2CpB,CAAC"}
1
+ {"version":3,"file":"cssStyles.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/shared/lib/slickgrid/model/SlickTable/printer/model/consts/cssStyles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,6+BAkDpB,CAAC"}
@@ -8,8 +8,7 @@ export interface IPrinter {
8
8
  cssStyles: string;
9
9
  getClientName(): HTMLTableRowElement;
10
10
  getHtmlTemplate(args: IHtmlDocElements): string;
11
- columnNames(table: ISlickTable): HTMLTableRowElement;
12
- createColumnNames(table: ISlickTable): HTMLTableSectionElement;
11
+ columnNames(table: ISlickTable): HTMLTableSectionElement;
13
12
  createHeader(table: ISlickTable): HTMLTableSectionElement;
14
13
  createFooter(table: ISlickTable): HTMLTableSectionElement;
15
14
  createTableElement(table: ISlickTable): HTMLTableElement;
@@ -1 +1 @@
1
- {"version":3,"file":"IPrinter.d.ts","sourceRoot":"","sources":["../../../../../src/shared/model/types/IPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,IAAI,mBAAmB,CAAC;IACrC,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAChD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;IACrD,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IAC/D,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IAC1D,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IAC1D,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,CAAC;IACzD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IACzD,QAAQ,CACP,OAAO,EAAE,OAAO,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,GACb,mBAAmB,CAAC;IACvB,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACtE,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;IAC1D,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,EAAE,CAAC;CAClD"}
1
+ {"version":3,"file":"IPrinter.d.ts","sourceRoot":"","sources":["../../../../../src/shared/model/types/IPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,QAAQ;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,IAAI,mBAAmB,CAAC;IACrC,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAChD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IACzD,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IAC1D,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IAC1D,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,CAAC;IACzD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,CAAC;IACzD,QAAQ,CACP,OAAO,EAAE,OAAO,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,GACb,mBAAmB,CAAC;IACvB,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACtE,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;IAC1D,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,EAAE,CAAC;CAClD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slick-table",
3
- "version": "1.1.80",
3
+ "version": "1.1.81",
4
4
  "description": "Enhanced version of SlickGrid library",
5
5
  "private": false,
6
6
  "type": "module",
@@ -18,7 +18,7 @@ export class DefaultPrinter implements IPrinter {
18
18
  const result = document.createElement("tr");
19
19
 
20
20
  const name = document.createElement("th");
21
- name.classList.add("align-left");
21
+ name.classList.add("client-name");
22
22
  name.setAttribute("colspan", "100%");
23
23
  name.innerText = `${this.clientName} [${this.clientId}]`;
24
24
  result.append(name);
@@ -48,11 +48,11 @@ export class DefaultPrinter implements IPrinter {
48
48
  <style>${styles}</style>
49
49
  </head>
50
50
  <body>
51
- <table>
51
+ <table class="main-table w-full">
52
52
  ${header}
53
53
  <tbody>
54
54
  <tr>
55
- <td>
55
+ <td colspan="100%">
56
56
  ${body}
57
57
  </td>
58
58
  </tr>
@@ -63,38 +63,41 @@ export class DefaultPrinter implements IPrinter {
63
63
  </html>
64
64
  `;
65
65
  }
66
- columnNames(table: ISlickTable): HTMLTableRowElement {
67
- const result = document.createElement("tr");
66
+ columnNames(table: ISlickTable): HTMLTableSectionElement {
67
+ const result = document.createElement("thead");
68
+ const tr1 = document.createElement("tr");
69
+ tr1.classList.add("empty-row");
70
+ const tr2 = document.createElement("tr");
71
+ tr2.classList.add("row-column-names");
68
72
 
69
73
  const grid = table.grid;
70
74
  const columns: IColumn[] = grid?.getColumns() || [];
71
75
  const columnsFiltered = columns.filter((el) => el.forPrint);
72
-
73
76
  columnsFiltered.forEach(({ name }) => {
74
77
  const th = document.createElement("th");
75
- th.classList.add("column-name");
78
+ th.classList.add("text-left");
76
79
  if (typeof name === "string") {
77
80
  th.innerText = name;
78
81
  } else {
79
82
  th.innerText = " ";
80
83
  }
81
- result.append(th);
84
+ tr2.append(th);
82
85
  });
86
+
87
+ result.append(tr1);
88
+ result.append(tr2);
83
89
  return result;
84
90
  }
85
91
  tableNameAndTime(table: ISlickTable): HTMLTableRowElement {
86
92
  const result = document.createElement("tr");
87
- result.classList.add("heading");
88
93
 
89
94
  const tableName = document.createElement("th");
90
- tableName.setAttribute("colspan", "2");
91
- tableName.classList.add("table-name");
95
+ tableName.classList.add("text-left");
92
96
  tableName.innerText = table.name || table.id;
93
97
  result.append(tableName);
94
98
 
95
99
  const dateStamp = document.createElement("th");
96
- dateStamp.setAttribute("colspan", "100%");
97
- dateStamp.classList.add("date-stamp");
100
+ dateStamp.classList.add("text-right");
98
101
  dateStamp.innerText = moment().format("MM/DD/YYYY h:mm A");
99
102
  result.append(dateStamp);
100
103
 
@@ -102,7 +105,9 @@ export class DefaultPrinter implements IPrinter {
102
105
  }
103
106
  createTableElement(table: ISlickTable): HTMLTableElement {
104
107
  const result = document.createElement("table");
105
- result.append(this.createColumnNames(table));
108
+ result.classList.add("slick-table");
109
+ result.style.width = "100%";
110
+ result.append(this.columnNames(table));
106
111
  result.append(this.createTbody(table));
107
112
  return result;
108
113
  }
@@ -133,7 +138,7 @@ export class DefaultPrinter implements IPrinter {
133
138
  const tr = document.createElement("tr");
134
139
  const th = document.createElement("th");
135
140
  th.setAttribute("colspan", "100%");
136
- th.classList.add("align-left");
141
+ th.classList.add("text-left");
137
142
  th.innerText = "Applied filters";
138
143
  tr.append(th);
139
144
  result.push(tr);
@@ -155,11 +160,6 @@ export class DefaultPrinter implements IPrinter {
155
160
  result.append(...this.filters(table));
156
161
  return result;
157
162
  }
158
- createColumnNames(table: ISlickTable): HTMLTableSectionElement {
159
- const result = document.createElement("thead");
160
- result.append(this.columnNames(table));
161
- return result;
162
- }
163
163
  createTr(
164
164
  columns: IColumn[],
165
165
  rowIndex: number,
@@ -8,37 +8,44 @@ export const cssStyles = `
8
8
  border-collapse: collapse;
9
9
  font-size: 12px;
10
10
  }
11
- table thead {
12
- border-bottom: 1px solid gray;
13
- }
14
11
  table th,
15
12
  table td {
16
- padding: 0 10px;
13
+ padding: 0 4px;
17
14
  font-weight: normal;
18
15
  }
19
- table td.text-center {
20
- text-align: center;
21
- }
22
- table td.text-right {
23
- text-align: right;
24
- }
25
- .heading {
26
- height: 30px;
16
+ .main-table > thead {
17
+ border-bottom: 1px solid gray;
27
18
  }
28
- .heading .table-name {
19
+ .client-name {
20
+ font-size: 16px;
21
+ font-weight: bold;
22
+ padding: 6px 4px;
29
23
  text-align: left;
30
24
  }
31
- .heading .date-stamp {
32
- text-align: right;
25
+ .empty-row {
26
+ height: 15px
33
27
  }
34
- .column-name {
35
- padding-top: 1em;
28
+ .font-bold {
36
29
  font-weight: bold;
37
30
  }
38
- .align-right {
39
- text-align: right;
31
+ .row-column-names {
32
+ border-bottom: 1px solid gray;
33
+ border-top: 1px solid gray;
34
+ line-height: 2.5;
35
+ }
36
+ .slick-table {
37
+ border-bottom: double gray;
38
+ }
39
+ .text-center {
40
+ text-align: center;
40
41
  }
41
- .align-left {
42
+ .text-left {
42
43
  text-align: left;
43
44
  }
45
+ .text-right {
46
+ text-align: right;
47
+ }
48
+ .w-full {
49
+ width: 100%;
50
+ }
44
51
  `;
@@ -10,8 +10,7 @@ export interface IPrinter {
10
10
  cssStyles: string;
11
11
  getClientName(): HTMLTableRowElement;
12
12
  getHtmlTemplate(args: IHtmlDocElements): string;
13
- columnNames(table: ISlickTable): HTMLTableRowElement;
14
- createColumnNames(table: ISlickTable): HTMLTableSectionElement;
13
+ columnNames(table: ISlickTable): HTMLTableSectionElement;
15
14
  createHeader(table: ISlickTable): HTMLTableSectionElement;
16
15
  createFooter(table: ISlickTable): HTMLTableSectionElement;
17
16
  createTableElement(table: ISlickTable): HTMLTableElement;