@guiexpert/solid-table 1.1.96 → 1.1.97
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/DetailComponentRendererWrapper.d.ts +28 -0
- package/GuiexpertTableProps.d.ts +4 -1
- package/index.cjs +1 -1
- package/index.d.ts +3 -1
- package/index.js +50 -39
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DetailRenderContextIf, DetailRendererIf, TableApi } from '@guiexpert/table';
|
|
2
|
+
import { JSX } from 'solid-js/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The props of a Solid component that renders a detail row (master/detail).
|
|
6
|
+
*
|
|
7
|
+
* @since 1.1.97
|
|
8
|
+
*/
|
|
9
|
+
export interface DetailComponentProps<T = any> {
|
|
10
|
+
row: T;
|
|
11
|
+
rowIndex: number;
|
|
12
|
+
tableApi: TableApi;
|
|
13
|
+
context: DetailRenderContextIf<T>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders a Solid component as the content of a detail row (master/detail, `tableOptions.masterDetail`). Mounted
|
|
17
|
+
* once when the detail row becomes visible, kept while scrolling, disposed when the row is collapsed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* masterDetail: { detailHeight: 180, detailRenderer: new DetailComponentRendererWrapper(OrderItems) }
|
|
21
|
+
*
|
|
22
|
+
* @since 1.1.97
|
|
23
|
+
*/
|
|
24
|
+
export declare class DetailComponentRendererWrapper<T = any> implements DetailRendererIf<T> {
|
|
25
|
+
private readonly code;
|
|
26
|
+
constructor(code: (props: DetailComponentProps<T>) => JSX.Element);
|
|
27
|
+
render(container: HTMLDivElement, row: T, context: DetailRenderContextIf<T>): () => void;
|
|
28
|
+
}
|
package/GuiexpertTableProps.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FocusModelIf, GeBatchEditEvent, GeModelChangeEvent, GeMouseEvent, GeRowDragEvent, GeScrollEvent, GeStateChangeEvent, SelectionModelIf, TableApi, TableModelIf, TableOptions } from '@guiexpert/table';
|
|
1
|
+
import { FocusModelIf, GeBatchEditEvent, GeDetailEvent, GeModelChangeEvent, GeMouseEvent, GeRowDragEvent, GeScrollEvent, GeStateChangeEvent, SelectionModelIf, TableApi, TableModelIf, TableOptions } from '@guiexpert/table';
|
|
2
2
|
|
|
3
3
|
export type GeMouseEventFn = (evt: GeMouseEvent) => void;
|
|
4
4
|
export type GeCheckboxEventFn = (evt: any[]) => void;
|
|
@@ -10,6 +10,7 @@ export type GeScrollEventFn = (evt: GeScrollEvent) => void;
|
|
|
10
10
|
export type GeStateChangeEventFn = (evt: GeStateChangeEvent) => void;
|
|
11
11
|
export type GeRowDragEventFn = (evt: GeRowDragEvent) => void;
|
|
12
12
|
export type GeBatchEditEventFn = (evt: GeBatchEditEvent) => void;
|
|
13
|
+
export type GeDetailEventFn = (evt: GeDetailEvent) => void;
|
|
13
14
|
export interface GuiexpertTableProps {
|
|
14
15
|
tableModel: TableModelIf;
|
|
15
16
|
tableOptions?: TableOptions;
|
|
@@ -35,6 +36,8 @@ export interface GuiexpertTableProps {
|
|
|
35
36
|
rowDragEnd?: GeRowDragEventFn;
|
|
36
37
|
/** Batch edit: values marked, set back, written or discarded (since 1.1.96). */
|
|
37
38
|
batchEditChanged?: GeBatchEditEventFn;
|
|
39
|
+
/** Master/detail: a detail row was expanded or collapsed (since 1.1.97). */
|
|
40
|
+
detailExpandedChanged?: GeDetailEventFn;
|
|
38
41
|
tableReady?: GeTableReadyEventFn;
|
|
39
42
|
licenseKey?: string;
|
|
40
43
|
/**
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("solid-js/web"),s=require("solid-js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("solid-js/web"),s=require("solid-js"),c=require("@guiexpert/table");class b{constructor(t){this.code=t}render(t,n,o,i,r,d,h){const e=g.mergeProps({rowIndex:n,columnIndex:o,areaIdent:i,areaModel:r,cellValue:d});return g.render(()=>this.code(e),t)}}class m{constructor(t){this.code=t}render(t,n,o){const i={row:n,rowIndex:o.rowIndex,tableApi:o.tableApi,context:o};return g.render(()=>this.code(i),t)}}var f=g.template("<div>");const w=u=>{let t;const n=s.mergeProps({tableModel:null,tableOptions:new c.TableOptions},u),o=(e,a,l)=>{l&&l(a),t&&t.dispatchEvent(new CustomEvent(e,{detail:a,bubbles:e!=="scroll"}))},i={onSelectionChanged:e=>o("selectionChanged",e,n.selectionChanged),onFocusChanged:e=>o("focusChanged",e,n.focusChanged),onScroll:e=>o("scroll",e,n.scroll),onCheckboxChanged:e=>o("checkboxChanged",e,n.checkboxChanged),onContextmenu:e=>o("contextmenu",e,n.contextmenu),onModelChanged:e=>o("modelChanged",e,n.modelChanged),onMouseClicked:e=>o("mouseClicked",e,n.mouseClicked),onMouseDragging:e=>o("mouseDragging",e,n.mouseDragging),onMouseDraggingEnd:e=>o("mouseDraggingEnd",e,n.mouseDraggingEnd),onMouseMoved:e=>o("mouseMoved",e,n.mouseMoved),onStateChanged:e=>o("stateChanged",e,n.stateChanged),onRowDragStart:e=>o("rowDragStart",e,n.rowDragStart),onRowDragMove:e=>o("rowDragMove",e,n.rowDragMove),onRowDragEnd:e=>o("rowDragEnd",e,n.rowDragEnd),onBatchEditChanged:e=>o("batchEditChanged",e,n.batchEditChanged),onDetailExpandedChanged:e=>o("detailExpandedChanged",e,n.detailExpandedChanged)};let r,d=!1;const h=e=>{e?(r==null||r.showLoadingOverlay(),d=!0):d&&(r==null||r.hideOverlay(),d=!1)};return s.createEffect(()=>{const e=n.tableModel,a=n.tableOptions,l=t;if(!l||!e)return;const C=s.untrack(()=>{const p=new c.TableScope(l,e,new c.SimpleDomService,a??new c.TableOptions,i);return p.firstInit(),r=p,d=!1,h(!!n.loading),o("tableReady",p.getApi(),n.tableReady),p});s.onCleanup(()=>{r===C&&(r=void 0),C.destroy()})}),s.createEffect(()=>{const e=!!n.loading;s.untrack(()=>h(e))}),s.createEffect(()=>{const e=n.licenseKey;e&&c.LicenseManager.getInstance().setLicenseKey(e)}),(()=>{var e=f(),a=t;return typeof a=="function"?g.use(a,e):t=e,e})()};exports.ComponentRendererWrapper=b;exports.DetailComponentRendererWrapper=m;exports.GuiexpertTable=w;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ComponentRendererWrapper } from './ComponentRendererWrapper.js';
|
|
2
|
+
import { DetailComponentRendererWrapper } from './DetailComponentRendererWrapper.js';
|
|
2
3
|
import { default as GuiexpertTable } from './GuiexpertTable.js';
|
|
3
4
|
|
|
4
5
|
export * from './GuiexpertTableProps.js';
|
|
5
|
-
export { GuiexpertTable, ComponentRendererWrapper };
|
|
6
|
+
export { GuiexpertTable, ComponentRendererWrapper, DetailComponentRendererWrapper };
|
|
7
|
+
export type { DetailComponentProps } from './DetailComponentRendererWrapper.js';
|
package/index.js
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
|
-
import { mergeProps as
|
|
2
|
-
import { mergeProps as
|
|
3
|
-
import { TableOptions as
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
6
|
-
this.code =
|
|
1
|
+
import { mergeProps as f, render as C, use as b, template as w } from "solid-js/web";
|
|
2
|
+
import { mergeProps as D, createEffect as p, untrack as u, onCleanup as v } from "solid-js";
|
|
3
|
+
import { TableOptions as m, LicenseManager as E, TableScope as M, SimpleDomService as x } from "@guiexpert/table";
|
|
4
|
+
class O {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
this.code = t;
|
|
7
7
|
}
|
|
8
|
-
render(
|
|
9
|
-
const e =
|
|
8
|
+
render(t, o, n, d, a, s, c) {
|
|
9
|
+
const e = f({
|
|
10
10
|
rowIndex: o,
|
|
11
11
|
columnIndex: n,
|
|
12
|
-
areaIdent:
|
|
13
|
-
areaModel:
|
|
12
|
+
areaIdent: d,
|
|
13
|
+
areaModel: a,
|
|
14
14
|
cellValue: s
|
|
15
15
|
});
|
|
16
|
-
return
|
|
16
|
+
return C(
|
|
17
17
|
() => this.code(e),
|
|
18
|
-
|
|
18
|
+
t
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
class I {
|
|
23
|
+
constructor(t) {
|
|
24
|
+
this.code = t;
|
|
25
|
+
}
|
|
26
|
+
render(t, o, n) {
|
|
27
|
+
const d = { row: o, rowIndex: n.rowIndex, tableApi: n.tableApi, context: n };
|
|
28
|
+
return C(() => this.code(d), t);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var y = /* @__PURE__ */ w("<div>");
|
|
32
|
+
const L = (g) => {
|
|
33
|
+
let t;
|
|
34
|
+
const o = D({
|
|
26
35
|
tableModel: null,
|
|
27
|
-
tableOptions: new
|
|
28
|
-
},
|
|
29
|
-
|
|
36
|
+
tableOptions: new m()
|
|
37
|
+
}, g), n = (e, r, i) => {
|
|
38
|
+
i && i(r), t && t.dispatchEvent(new CustomEvent(e, {
|
|
30
39
|
detail: r,
|
|
31
40
|
bubbles: e !== "scroll"
|
|
32
41
|
}));
|
|
33
|
-
},
|
|
42
|
+
}, d = {
|
|
34
43
|
onSelectionChanged: (e) => n("selectionChanged", e, o.selectionChanged),
|
|
35
44
|
onFocusChanged: (e) => n("focusChanged", e, o.focusChanged),
|
|
36
45
|
onScroll: (e) => n("scroll", e, o.scroll),
|
|
@@ -45,35 +54,37 @@ const L = (h) => {
|
|
|
45
54
|
onRowDragStart: (e) => n("rowDragStart", e, o.rowDragStart),
|
|
46
55
|
onRowDragMove: (e) => n("rowDragMove", e, o.rowDragMove),
|
|
47
56
|
onRowDragEnd: (e) => n("rowDragEnd", e, o.rowDragEnd),
|
|
48
|
-
onBatchEditChanged: (e) => n("batchEditChanged", e, o.batchEditChanged)
|
|
57
|
+
onBatchEditChanged: (e) => n("batchEditChanged", e, o.batchEditChanged),
|
|
58
|
+
onDetailExpandedChanged: (e) => n("detailExpandedChanged", e, o.detailExpandedChanged)
|
|
49
59
|
};
|
|
50
|
-
let
|
|
51
|
-
const
|
|
52
|
-
e ? (
|
|
60
|
+
let a, s = !1;
|
|
61
|
+
const c = (e) => {
|
|
62
|
+
e ? (a == null || a.showLoadingOverlay(), s = !0) : s && (a == null || a.hideOverlay(), s = !1);
|
|
53
63
|
};
|
|
54
|
-
return
|
|
55
|
-
const e = o.tableModel, r = o.tableOptions,
|
|
56
|
-
if (!
|
|
64
|
+
return p(() => {
|
|
65
|
+
const e = o.tableModel, r = o.tableOptions, i = t;
|
|
66
|
+
if (!i || !e)
|
|
57
67
|
return;
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
return
|
|
68
|
+
const h = u(() => {
|
|
69
|
+
const l = new M(i, e, new x(), r ?? new m(), d);
|
|
70
|
+
return l.firstInit(), a = l, s = !1, c(!!o.loading), n("tableReady", l.getApi(), o.tableReady), l;
|
|
61
71
|
});
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
v(() => {
|
|
73
|
+
a === h && (a = void 0), h.destroy();
|
|
64
74
|
});
|
|
65
|
-
}),
|
|
75
|
+
}), p(() => {
|
|
66
76
|
const e = !!o.loading;
|
|
67
|
-
u(() =>
|
|
68
|
-
}),
|
|
77
|
+
u(() => c(e));
|
|
78
|
+
}), p(() => {
|
|
69
79
|
const e = o.licenseKey;
|
|
70
|
-
e &&
|
|
80
|
+
e && E.getInstance().setLicenseKey(e);
|
|
71
81
|
}), (() => {
|
|
72
|
-
var e =
|
|
73
|
-
return typeof r == "function" ? b(r, e) :
|
|
82
|
+
var e = y(), r = t;
|
|
83
|
+
return typeof r == "function" ? b(r, e) : t = e, e;
|
|
74
84
|
})();
|
|
75
85
|
};
|
|
76
86
|
export {
|
|
77
|
-
|
|
87
|
+
O as ComponentRendererWrapper,
|
|
88
|
+
I as DetailComponentRendererWrapper,
|
|
78
89
|
L as GuiexpertTable
|
|
79
90
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/solid-table",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.97",
|
|
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.97"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"solid-js": "^1.0.0"
|