slick-table 0.0.24 → 0.0.26
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
|
@@ -278,4 +278,4 @@ return r.version="2.30.1",s(Ke),r.fn=X,r.min=Ud,r.max=Gd,r.now=qd,r.utc=R,r.unix
|
|
|
278
278
|
.align_left {
|
|
279
279
|
text-align: left;
|
|
280
280
|
}
|
|
281
|
-
`;class Au{constructor(){this.clientId=0,this.clientName="",this.cssStyles=Rb}getClientName(){const t=document.createElement("tr"),i=document.createElement("th");return i.classList.add("align_left"),i.setAttribute("colspan","100%"),i.innerText=`${this.clientName} [${this.clientId}]`,t.append(i),t}columnNames(t){const i=document.createElement("tr");return(t.grid?.getColumns()||[]).filter(l=>l.forPrint).forEach(({name:l})=>{const c=document.createElement("th");c.classList.add("column_name"),typeof l=="string"?c.innerText=l:c.innerText=" ",i.append(c)}),i}tableNameAndTime(t){const i=document.createElement("tr");i.classList.add("heading");const r=document.createElement("th");r.setAttribute("colspan","2"),r.classList.add("table_name"),r.innerText=t.name||t.id,i.append(r);const s=document.createElement("th");return s.setAttribute("colspan","100%"),s.classList.add("date_stamp"),s.innerText=ee().format("MM/DD/YYYY h:mm A"),i.append(s),i}createStyleElement(){const t=document.createElement("style");return t.innerHTML=this.cssStyles,t}createTableElement(t){const i=document.createElement("table");return i.append(this.createThead(t)),i.append(this.createTbody(t)),i}createTbody(t){const i=document.createElement("tbody"),r=t.grid;if(!r)return i;const o=r.getColumns().filter(d=>d.forPrint),l=r.getData();return s_(l).forEach((d,f)=>{const p=this.createTr(o,f,r);i.append(p)}),i.append(...this.totals(t)),i}filters(t){const i=[];if(t.filter){const r=t.filter.print(t);if(r.length){const s=document.createElement("tr"),o=document.createElement("th");o.setAttribute("colspan","100%"),o.classList.add("align_left"),o.innerText="Applied filters",s.append(o),i.push(s)}r.forEach(s=>{i.push(s)})}return i}totals(t){return[]}createThead(t){const i=document.createElement("thead");return i.append(this.getClientName()),i.append(this.tableNameAndTime(t)),i.append(...this.filters(t)),i.append(this.columnNames(t)),i}createTr(t,i,r){const s=document.createElement("tr"),o=r.getData(),l=o.getItem(i),c=l.__group,d=l.__groupTotals;if(c){const f=document.createElement("td");f.setAttribute("colspan","100%"),f.innerText=Pu(l.title),s.append(f)}else t.forEach(f=>{const p=document.createElement("td");f.cssClass&&p.classList.add(f.cssClass);const m=f.field,D=o.getItemMetadata(i)?.columns?.[m]?.formatter,R=f.printer||D||f.formatter;let y=l[m];if(d){const P=f.groupTotalsFormatter;y=P?P(l,f,r):""}else R&&(y=R(0,0,y,f,l,r));p.innerText=y||"",s.append(p)});return s}print(t,i,r){this.clientId=i,this.clientName=r;const s=window.open(),o=document.createElement("title");o.innerText=t.name||t.id;const l=s.document.querySelector("head");l.append(o),l.append(this.createStyleElement()),s.document.querySelector("body").append(this.createTableElement(t)),s.print()}}function Eb(e){const t=document.querySelector(e);if(!t)return!0;const{scrollHeight:i,scrollWidth:r}=document.documentElement,{bottom:s,left:o,right:l,top:c}=t.getBoundingClientRect();return s<=0||o>=r||l<=0||c>=i}class kb{constructor(t){this.hotKeysBehavior=new Ou,this.filter=new wb,this.downloadManager=new gb,this._grid=null,this._grouping={},this._isActive=!1,this._isEdited=!1,this._observers=[],this._printer=new Au;const{downloadManager:i,filter:r,hotKeys:s,id:o,name:l,printer:c}=t;this.id=o,this.name=l||"",s&&(this.hotKeysBehavior=s),c&&(this.printer=c),r&&(this.filter=r),i&&(this.downloadManager=i)}createGrid(t,i,r){this.reset();const s=new r_(`#${this.id}`,t,i,r);return this.grid=s,s.onKeyDown.subscribe(Ah(s)),this.filter.register(s,this.id),this.grid}handleKeyboardEvent(t){Eb(`#${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 i=this.grid.getData();this.grouping.isGrouped?i.setGrouping(this.grouping.groups||[]):i.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}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 i=this._observers.indexOf(t);this._observers.splice(i,1)}reset(){this.grid?.onKeyDown.unsubscribe(Ah(this.grid)),this.grid?.getSelectionModel()&&this.grid.setSelectedRows([]),this.hotKeysBehavior.resetQueue(),this.isEdited=!1,this.isActive=!1,this.grid=null}}class Tb extends na{constructor(){super(...arguments),this.x=0,this.y=0}}new Tb;exports.DefaultPrinter=Au;exports.DeletedRowsFilter=vb;exports.SlickTable=kb;exports.WithoutHotKeys=Ou;
|
|
281
|
+
`;class Au{constructor(){this.clientId=0,this.clientName="",this.cssStyles=Rb}getClientName(){const t=document.createElement("tr"),i=document.createElement("th");return i.classList.add("align_left"),i.setAttribute("colspan","100%"),i.innerText=`${this.clientName} [${this.clientId}]`,t.append(i),t}columnNames(t){const i=document.createElement("tr");return(t.grid?.getColumns()||[]).filter(l=>l.forPrint).forEach(({name:l})=>{const c=document.createElement("th");c.classList.add("column_name"),typeof l=="string"?c.innerText=l:c.innerText=" ",i.append(c)}),i}tableNameAndTime(t){const i=document.createElement("tr");i.classList.add("heading");const r=document.createElement("th");r.setAttribute("colspan","2"),r.classList.add("table_name"),r.innerText=t.name||t.id,i.append(r);const s=document.createElement("th");return s.setAttribute("colspan","100%"),s.classList.add("date_stamp"),s.innerText=ee().format("MM/DD/YYYY h:mm A"),i.append(s),i}createStyleElement(){const t=document.createElement("style");return t.innerHTML=this.cssStyles,t}createTableElement(t){const i=document.createElement("table");return i.append(this.createThead(t)),i.append(this.createTbody(t)),i}createTbody(t){const i=document.createElement("tbody"),r=t.grid;if(!r)return i;const o=r.getColumns().filter(d=>d.forPrint),l=r.getData();return s_(l).forEach((d,f)=>{const p=this.createTr(o,f,r);i.append(p)}),i.append(...this.totals(t)),i}filters(t){const i=[];if(t.filter){const r=t.filter.print(t);if(r.length){const s=document.createElement("tr"),o=document.createElement("th");o.setAttribute("colspan","100%"),o.classList.add("align_left"),o.innerText="Applied filters",s.append(o),i.push(s)}r.forEach(s=>{i.push(s)})}return i}totals(t){return[]}createThead(t){const i=document.createElement("thead");return i.append(this.getClientName()),i.append(this.tableNameAndTime(t)),i.append(...this.filters(t)),i.append(this.columnNames(t)),i}createTr(t,i,r){const s=document.createElement("tr"),o=r.getData(),l=o.getItem(i),c=l.__group,d=l.__groupTotals;if(c){const f=document.createElement("td");f.setAttribute("colspan","100%"),f.innerText=Pu(l.title),s.append(f)}else t.forEach(f=>{const p=document.createElement("td");f.cssClass&&p.classList.add(f.cssClass);const m=f.field,D=o.getItemMetadata(i)?.columns?.[m]?.formatter,R=f.printer||D||f.formatter;let y=l[m];if(d){const P=f.groupTotalsFormatter;y=P?P(l,f,r):""}else R&&(y=R(0,0,y,f,l,r));p.innerText=y||"",s.append(p)});return s}print(t,i,r){this.clientId=i,this.clientName=r;const s=window.open(),o=document.createElement("title");o.innerText=t.name||t.id;const l=s.document.querySelector("head");l.append(o),l.append(this.createStyleElement()),s.document.querySelector("body").append(this.createTableElement(t)),s.print()}}function Eb(e){const t=document.querySelector(e);if(!t)return!0;const{scrollHeight:i,scrollWidth:r}=document.documentElement,{bottom:s,left:o,right:l,top:c}=t.getBoundingClientRect();return s<=0||o>=r||l<=0||c>=i}class kb{constructor(t){this.hotKeysBehavior=new Ou,this.filter=new wb,this.downloadManager=new gb,this._grid=null,this._grouping={},this._isActive=!1,this._isEdited=!1,this._lastActiveCell={row:0,cell:0},this._observers=[],this._printer=new Au;const{downloadManager:i,filter:r,hotKeys:s,id:o,name:l,printer:c}=t;this.id=o,this.name=l||"",s&&(this.hotKeysBehavior=s),c&&(this.printer=c),r&&(this.filter=r),i&&(this.downloadManager=i)}createGrid(t,i,r){this.reset();const s=new r_(`#${this.id}`,t,i,r);return this.grid=s,s.onKeyDown.subscribe(Ah(s)),this.filter.register(s,this.id),this.grid}handleKeyboardEvent(t){Eb(`#${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 i=this.grid.getData();this.grouping.isGrouped?i.setGrouping(this.grouping.groups||[]):i.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 i=this._observers.indexOf(t);this._observers.splice(i,1)}reset(){this.grid?.onKeyDown.unsubscribe(Ah(this.grid)),this.grid?.getSelectionModel()&&this.grid.setSelectedRows([]),this.hotKeysBehavior.resetQueue(),this.isEdited=!1,this.isActive=!1,this.grid=null}}class Tb extends na{constructor(){super(...arguments),this.x=0,this.y=0}}new Tb;exports.DefaultPrinter=Au;exports.DeletedRowsFilter=vb;exports.SlickTable=kb;exports.WithoutHotKeys=Ou;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DefaultPrinter, DeletedRowsFilter, SlickTable, WithoutHotKeys, } from './shared/lib/slickgrid';
|
|
2
|
-
export type { IPrinter, ISlickTable } from './shared/model/types';
|
|
2
|
+
export type { IPrinter, ISlickTable, IColumn, IFilter, IHotKeysBehavior, } from './shared/model/types';
|
package/dist/index.es.js
CHANGED
|
@@ -18711,7 +18711,7 @@ function xb(e) {
|
|
|
18711
18711
|
}
|
|
18712
18712
|
class Ob {
|
|
18713
18713
|
constructor(t) {
|
|
18714
|
-
this.hotKeysBehavior = new wb(), this.filter = new Cb(), this.downloadManager = new vb(), this._grid = null, this._grouping = {}, this._isActive = !1, this._isEdited = !1, this._observers = [], this._printer = new Tb();
|
|
18714
|
+
this.hotKeysBehavior = new wb(), this.filter = new Cb(), this.downloadManager = new vb(), this._grid = null, this._grouping = {}, this._isActive = !1, this._isEdited = !1, this._lastActiveCell = { row: 0, cell: 0 }, this._observers = [], this._printer = new Tb();
|
|
18715
18715
|
const { downloadManager: i, filter: r, hotKeys: s, id: o, name: l, printer: c } = t;
|
|
18716
18716
|
this.id = o, this.name = l || "", s && (this.hotKeysBehavior = s), c && (this.printer = c), r && (this.filter = r), i && (this.downloadManager = i);
|
|
18717
18717
|
}
|
|
@@ -18755,6 +18755,12 @@ class Ob {
|
|
|
18755
18755
|
set isActive(t) {
|
|
18756
18756
|
this._isActive = t;
|
|
18757
18757
|
}
|
|
18758
|
+
get lastActiveSell() {
|
|
18759
|
+
return this._lastActiveCell;
|
|
18760
|
+
}
|
|
18761
|
+
set lastActiveSell(t) {
|
|
18762
|
+
this._lastActiveCell = t;
|
|
18763
|
+
}
|
|
18758
18764
|
resizeCanvas() {
|
|
18759
18765
|
console.log(""), this.grid?.resizeCanvas();
|
|
18760
18766
|
}
|
|
@@ -10,6 +10,7 @@ export declare class SlickTable implements ISlickTable {
|
|
|
10
10
|
private _grouping;
|
|
11
11
|
private _isActive;
|
|
12
12
|
private _isEdited;
|
|
13
|
+
private _lastActiveCell;
|
|
13
14
|
private readonly _observers;
|
|
14
15
|
private _printer;
|
|
15
16
|
constructor(args: {
|
|
@@ -32,6 +33,14 @@ export declare class SlickTable implements ISlickTable {
|
|
|
32
33
|
get printer(): IPrinter;
|
|
33
34
|
get isActive(): boolean;
|
|
34
35
|
set isActive(isActive: boolean);
|
|
36
|
+
get lastActiveSell(): {
|
|
37
|
+
row: number;
|
|
38
|
+
cell: number;
|
|
39
|
+
};
|
|
40
|
+
set lastActiveSell(cell: {
|
|
41
|
+
row: number;
|
|
42
|
+
cell: number;
|
|
43
|
+
});
|
|
35
44
|
resizeCanvas(): void;
|
|
36
45
|
registerObservers(observer: IObserver): void;
|
|
37
46
|
notifyObservers(): void;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slick-table",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "Enhanced version of SlickGrid library",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
8
8
|
"module": "./dist/index.es.js",
|
|
9
|
-
"types": "dist/
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": "./dist/index.es.js",
|
package/dist/types/index.d.ts
DELETED