@guiexpert/preact-table 10.1.94 → 10.1.96
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/GuiexpertTable.d.ts +9 -1
- package/index.cjs +1 -1
- package/index.js +78 -62
- package/package.json +2 -2
package/GuiexpertTable.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'preact';
|
|
2
|
-
import { FocusModelIf, GeModelChangeEvent, GeMouseEvent, GeScrollEvent, GeStateChangeEvent, SelectionModelIf, TableApi, TableModelIf, TableOptions } from '@guiexpert/table';
|
|
2
|
+
import { FocusModelIf, GeModelChangeEvent, GeBatchEditEvent, GeMouseEvent, GeRowDragEvent, GeScrollEvent, GeStateChangeEvent, SelectionModelIf, TableApi, TableModelIf, TableOptions } from '@guiexpert/table';
|
|
3
3
|
|
|
4
4
|
export type GeMouseEventFn = (evt: GeMouseEvent) => void;
|
|
5
5
|
export type GeCheckboxEventFn = (evt: any[]) => void;
|
|
@@ -9,6 +9,8 @@ export type GeSelectionChangeEventFn = (evt: SelectionModelIf) => void;
|
|
|
9
9
|
export type GeFocusChangeEventFn = (evt: FocusModelIf) => void;
|
|
10
10
|
export type GeScrollEventFn = (evt: GeScrollEvent) => void;
|
|
11
11
|
export type GeStateChangeEventFn = (evt: GeStateChangeEvent) => void;
|
|
12
|
+
export type GeRowDragEventFn = (evt: GeRowDragEvent) => void;
|
|
13
|
+
export type GeBatchEditEventFn = (evt: GeBatchEditEvent) => void;
|
|
12
14
|
export interface GuiexpertTableProps {
|
|
13
15
|
tableModel: TableModelIf;
|
|
14
16
|
tableOptions?: TableOptions;
|
|
@@ -30,6 +32,12 @@ export interface GuiexpertTableProps {
|
|
|
30
32
|
* @since 1.1.92
|
|
31
33
|
*/
|
|
32
34
|
stateChanged?: GeStateChangeEventFn;
|
|
35
|
+
/** Row drag (since 1.1.95, handles via `ColumnDef.rowDrag`): started / target changed / ended ("end" or "cancel"). */
|
|
36
|
+
rowDragStart?: GeRowDragEventFn;
|
|
37
|
+
rowDragMove?: GeRowDragEventFn;
|
|
38
|
+
rowDragEnd?: GeRowDragEventFn;
|
|
39
|
+
/** Batch edit: values marked, set back, written or discarded (since 1.1.96). */
|
|
40
|
+
batchEditChanged?: GeBatchEditEventFn;
|
|
33
41
|
/**
|
|
34
42
|
* `true` shows the loading overlay ("Loading…" with a CSS spinner) over the body, `false` hides it.
|
|
35
43
|
* Changing it does **not** re-create the table. Texts: `tableOptions.overlayOptions`. @since 1.1.92
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var b=Object.defineProperty;var u=(r,a,o)=>a in r?b(r,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[a]=o;var h=(r,a,o)=>u(r,typeof a!="symbol"?a+"":a,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("preact/jsx-runtime"),d=require("preact"),c=require("@guiexpert/table");class m extends d.Component{constructor(o){super(o);h(this,"ref",d.createRef());h(this,"tableScope");h(this,"shownByProp",!1)}componentDidMount(){const o=this.ref.current;o&&this.initTable(o,this.props)}componentDidUpdate(o){const s=this.ref.current;s&&(o.tableModel!==this.props.tableModel||o.tableOptions!==this.props.tableOptions)&&this.initTable(s,this.props),!!o.loading!=!!this.props.loading&&this.applyLoading(),this.props.licenseKey&&this.props.licenseKey!==o.licenseKey&&c.LicenseManager.getInstance().setLicenseKey(this.props.licenseKey)}componentWillUnmount(){this.destroyTable()}initTable(o,s){var p;this.destroyTable();const i=()=>this.props,g={onSelectionChanged:t=>{var e,n;return(n=(e=i()).selectionChanged)==null?void 0:n.call(e,t)},onFocusChanged:t=>{var e,n;return(n=(e=i()).focusChanged)==null?void 0:n.call(e,t)},onScroll:t=>{var e,n;return(n=(e=i()).scroll)==null?void 0:n.call(e,t)},onCheckboxChanged:t=>{var e,n;return(n=(e=i()).checkboxChanged)==null?void 0:n.call(e,t)},onContextmenu:t=>{var e,n;return(n=(e=i()).contextmenu)==null?void 0:n.call(e,t)},onModelChanged:t=>{var e,n;return(n=(e=i()).modelChanged)==null?void 0:n.call(e,t)},onMouseClicked:t=>{var e,n;return(n=(e=i()).mouseClicked)==null?void 0:n.call(e,t)},onMouseDragging:t=>{var e,n;return(n=(e=i()).mouseDragging)==null?void 0:n.call(e,t)},onMouseDraggingEnd:t=>{var e,n;return(n=(e=i()).mouseDraggingEnd)==null?void 0:n.call(e,t)},onMouseMoved:t=>{var e,n;return(n=(e=i()).mouseMoved)==null?void 0:n.call(e,t)},onStateChanged:t=>{var e,n;return(n=(e=i()).stateChanged)==null?void 0:n.call(e,t)},onRowDragStart:t=>{var e,n;return(n=(e=i()).rowDragStart)==null?void 0:n.call(e,t)},onRowDragMove:t=>{var e,n;return(n=(e=i()).rowDragMove)==null?void 0:n.call(e,t)},onRowDragEnd:t=>{var e,n;return(n=(e=i()).rowDragEnd)==null?void 0:n.call(e,t)},onBatchEditChanged:t=>{var e,n;return(n=(e=i()).batchEditChanged)==null?void 0:n.call(e,t)}},l=new c.TableScope(o,s.tableModel,new c.SimpleDomService,s.tableOptions??new c.TableOptions,g);this.tableScope=l,l.firstInit(),this.shownByProp=!1,this.applyLoading(),(p=s.tableReady)==null||p.call(s,l.getApi()),s.licenseKey&&c.LicenseManager.getInstance().setLicenseKey(s.licenseKey)}applyLoading(){var o,s;this.props.loading?((o=this.tableScope)==null||o.showLoadingOverlay(),this.shownByProp=!0):this.shownByProp&&((s=this.tableScope)==null||s.hideOverlay(),this.shownByProp=!1)}destroyTable(){var o;(o=this.tableScope)==null||o.destroy(),this.tableScope=void 0}render(){return y.jsx("div",{ref:this.ref,className:"container-div",style:{width:"100%",height:"100%",backgroundColor:"transparent",padding:"0",margin:"0"}})}}class C{constructor(a){this.Component=a}render(a,o,s,i,g,l,p){const t={cellDiv:a,rowIndex:o,columnIndex:s,areaIdent:i,areaModel:g,cellValue:l};return d.render(d.h(this.Component,t),a),()=>{d.render(null,a)}}}exports.ComponentRendererWrapper=C;exports.GuiexpertTable=m;
|
package/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var b = (r,
|
|
3
|
-
var
|
|
2
|
+
var b = (r, a, o) => a in r ? m(r, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[a] = o;
|
|
3
|
+
var h = (r, a, o) => b(r, typeof a != "symbol" ? a + "" : a, o);
|
|
4
4
|
import { jsx as y } from "preact/jsx-runtime";
|
|
5
|
-
import { Component as u, createRef as
|
|
6
|
-
import { LicenseManager as
|
|
7
|
-
class
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { Component as u, createRef as C, render as g, h as f } from "preact";
|
|
6
|
+
import { LicenseManager as p, TableScope as w, SimpleDomService as S, TableOptions as M } from "@guiexpert/table";
|
|
7
|
+
class L extends u {
|
|
8
|
+
constructor(o) {
|
|
9
|
+
super(o);
|
|
10
|
+
h(this, "ref", C());
|
|
11
|
+
h(this, "tableScope");
|
|
12
12
|
/** the overlay was shown by the loading prop: loading={false} hides only that one */
|
|
13
|
-
|
|
13
|
+
h(this, "shownByProp", !1);
|
|
14
14
|
}
|
|
15
15
|
componentDidMount() {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const o = this.ref.current;
|
|
17
|
+
o && this.initTable(o, this.props);
|
|
18
18
|
}
|
|
19
|
-
componentDidUpdate(
|
|
19
|
+
componentDidUpdate(o) {
|
|
20
20
|
const s = this.ref.current;
|
|
21
|
-
s && (
|
|
21
|
+
s && (o.tableModel !== this.props.tableModel || o.tableOptions !== this.props.tableOptions) && this.initTable(s, this.props), !!o.loading != !!this.props.loading && this.applyLoading(), this.props.licenseKey && this.props.licenseKey !== o.licenseKey && p.getInstance().setLicenseKey(this.props.licenseKey);
|
|
22
22
|
}
|
|
23
23
|
componentWillUnmount() {
|
|
24
24
|
this.destroyTable();
|
|
@@ -27,72 +27,88 @@ class O extends u {
|
|
|
27
27
|
* Creates the table in `ele` (a table created before is destroyed first) and calls `tableReady`.
|
|
28
28
|
* The event callbacks are always taken from the current props.
|
|
29
29
|
*/
|
|
30
|
-
initTable(
|
|
31
|
-
var
|
|
30
|
+
initTable(o, s) {
|
|
31
|
+
var c;
|
|
32
32
|
this.destroyTable();
|
|
33
|
-
const
|
|
34
|
-
onSelectionChanged: (
|
|
33
|
+
const i = () => this.props, d = {
|
|
34
|
+
onSelectionChanged: (t) => {
|
|
35
35
|
var e, n;
|
|
36
|
-
return (n = (e =
|
|
36
|
+
return (n = (e = i()).selectionChanged) == null ? void 0 : n.call(e, t);
|
|
37
37
|
},
|
|
38
|
-
onFocusChanged: (
|
|
38
|
+
onFocusChanged: (t) => {
|
|
39
39
|
var e, n;
|
|
40
|
-
return (n = (e =
|
|
40
|
+
return (n = (e = i()).focusChanged) == null ? void 0 : n.call(e, t);
|
|
41
41
|
},
|
|
42
|
-
onScroll: (
|
|
42
|
+
onScroll: (t) => {
|
|
43
43
|
var e, n;
|
|
44
|
-
return (n = (e =
|
|
44
|
+
return (n = (e = i()).scroll) == null ? void 0 : n.call(e, t);
|
|
45
45
|
},
|
|
46
|
-
onCheckboxChanged: (
|
|
46
|
+
onCheckboxChanged: (t) => {
|
|
47
47
|
var e, n;
|
|
48
|
-
return (n = (e =
|
|
48
|
+
return (n = (e = i()).checkboxChanged) == null ? void 0 : n.call(e, t);
|
|
49
49
|
},
|
|
50
|
-
onContextmenu: (
|
|
50
|
+
onContextmenu: (t) => {
|
|
51
51
|
var e, n;
|
|
52
|
-
return (n = (e =
|
|
52
|
+
return (n = (e = i()).contextmenu) == null ? void 0 : n.call(e, t);
|
|
53
53
|
},
|
|
54
|
-
onModelChanged: (
|
|
54
|
+
onModelChanged: (t) => {
|
|
55
55
|
var e, n;
|
|
56
|
-
return (n = (e =
|
|
56
|
+
return (n = (e = i()).modelChanged) == null ? void 0 : n.call(e, t);
|
|
57
57
|
},
|
|
58
|
-
onMouseClicked: (
|
|
58
|
+
onMouseClicked: (t) => {
|
|
59
59
|
var e, n;
|
|
60
|
-
return (n = (e =
|
|
60
|
+
return (n = (e = i()).mouseClicked) == null ? void 0 : n.call(e, t);
|
|
61
61
|
},
|
|
62
|
-
onMouseDragging: (
|
|
62
|
+
onMouseDragging: (t) => {
|
|
63
63
|
var e, n;
|
|
64
|
-
return (n = (e =
|
|
64
|
+
return (n = (e = i()).mouseDragging) == null ? void 0 : n.call(e, t);
|
|
65
65
|
},
|
|
66
|
-
onMouseDraggingEnd: (
|
|
66
|
+
onMouseDraggingEnd: (t) => {
|
|
67
67
|
var e, n;
|
|
68
|
-
return (n = (e =
|
|
68
|
+
return (n = (e = i()).mouseDraggingEnd) == null ? void 0 : n.call(e, t);
|
|
69
69
|
},
|
|
70
|
-
onMouseMoved: (
|
|
70
|
+
onMouseMoved: (t) => {
|
|
71
71
|
var e, n;
|
|
72
|
-
return (n = (e =
|
|
72
|
+
return (n = (e = i()).mouseMoved) == null ? void 0 : n.call(e, t);
|
|
73
73
|
},
|
|
74
|
-
onStateChanged: (
|
|
74
|
+
onStateChanged: (t) => {
|
|
75
75
|
var e, n;
|
|
76
|
-
return (n = (e =
|
|
76
|
+
return (n = (e = i()).stateChanged) == null ? void 0 : n.call(e, t);
|
|
77
|
+
},
|
|
78
|
+
onRowDragStart: (t) => {
|
|
79
|
+
var e, n;
|
|
80
|
+
return (n = (e = i()).rowDragStart) == null ? void 0 : n.call(e, t);
|
|
81
|
+
},
|
|
82
|
+
onRowDragMove: (t) => {
|
|
83
|
+
var e, n;
|
|
84
|
+
return (n = (e = i()).rowDragMove) == null ? void 0 : n.call(e, t);
|
|
85
|
+
},
|
|
86
|
+
onRowDragEnd: (t) => {
|
|
87
|
+
var e, n;
|
|
88
|
+
return (n = (e = i()).rowDragEnd) == null ? void 0 : n.call(e, t);
|
|
89
|
+
},
|
|
90
|
+
onBatchEditChanged: (t) => {
|
|
91
|
+
var e, n;
|
|
92
|
+
return (n = (e = i()).batchEditChanged) == null ? void 0 : n.call(e, t);
|
|
77
93
|
}
|
|
78
|
-
}, l = new
|
|
79
|
-
|
|
94
|
+
}, l = new w(
|
|
95
|
+
o,
|
|
80
96
|
s.tableModel,
|
|
81
|
-
new
|
|
82
|
-
s.tableOptions ?? new
|
|
83
|
-
|
|
97
|
+
new S(),
|
|
98
|
+
s.tableOptions ?? new M(),
|
|
99
|
+
d
|
|
84
100
|
);
|
|
85
|
-
this.tableScope = l, l.firstInit(), this.shownByProp = !1, this.applyLoading(), (
|
|
101
|
+
this.tableScope = l, l.firstInit(), this.shownByProp = !1, this.applyLoading(), (c = s.tableReady) == null || c.call(s, l.getApi()), s.licenseKey && p.getInstance().setLicenseKey(s.licenseKey);
|
|
86
102
|
}
|
|
87
103
|
/** Shows or hides the loading overlay according to the `loading` prop. */
|
|
88
104
|
applyLoading() {
|
|
89
|
-
var
|
|
90
|
-
this.props.loading ? ((
|
|
105
|
+
var o, s;
|
|
106
|
+
this.props.loading ? ((o = this.tableScope) == null || o.showLoadingOverlay(), this.shownByProp = !0) : this.shownByProp && ((s = this.tableScope) == null || s.hideOverlay(), this.shownByProp = !1);
|
|
91
107
|
}
|
|
92
108
|
/** Releases the table (listeners, resize observer, cell renderers). */
|
|
93
109
|
destroyTable() {
|
|
94
|
-
var
|
|
95
|
-
(
|
|
110
|
+
var o;
|
|
111
|
+
(o = this.tableScope) == null || o.destroy(), this.tableScope = void 0;
|
|
96
112
|
}
|
|
97
113
|
render() {
|
|
98
114
|
return /* @__PURE__ */ y(
|
|
@@ -111,21 +127,21 @@ class O extends u {
|
|
|
111
127
|
);
|
|
112
128
|
}
|
|
113
129
|
}
|
|
114
|
-
class
|
|
115
|
-
constructor(
|
|
116
|
-
this.Component =
|
|
130
|
+
class v {
|
|
131
|
+
constructor(a) {
|
|
132
|
+
this.Component = a;
|
|
117
133
|
}
|
|
118
|
-
render(
|
|
119
|
-
const
|
|
120
|
-
cellDiv:
|
|
121
|
-
rowIndex:
|
|
134
|
+
render(a, o, s, i, d, l, c) {
|
|
135
|
+
const t = {
|
|
136
|
+
cellDiv: a,
|
|
137
|
+
rowIndex: o,
|
|
122
138
|
columnIndex: s,
|
|
123
|
-
areaIdent:
|
|
124
|
-
areaModel:
|
|
139
|
+
areaIdent: i,
|
|
140
|
+
areaModel: d,
|
|
125
141
|
cellValue: l
|
|
126
142
|
};
|
|
127
|
-
return
|
|
128
|
-
|
|
143
|
+
return g(f(this.Component, t), a), () => {
|
|
144
|
+
g(null, a);
|
|
129
145
|
};
|
|
130
146
|
}
|
|
131
147
|
// private mount(
|
|
@@ -149,6 +165,6 @@ class k {
|
|
|
149
165
|
// }
|
|
150
166
|
}
|
|
151
167
|
export {
|
|
152
|
-
|
|
153
|
-
|
|
168
|
+
v as ComponentRendererWrapper,
|
|
169
|
+
L as GuiexpertTable
|
|
154
170
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/preact-table",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.96",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"tslib": "^2.3.0",
|
|
34
|
-
"@guiexpert/table": "^1.1.
|
|
34
|
+
"@guiexpert/table": "^1.1.96"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"preact": "^10.0.0"
|