@guiexpert/preact-table 1.0.1 → 1.0.2
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/ComponentRendererWrapper.d.ts +6 -0
- package/GuiexpertTable.d.ts +24 -0
- package/README.md +1 -1
- package/index.js +227 -0
- package/index.mjs +23115 -0
- package/package.json +1 -4
- package/.eslintrc.js +0 -23
- package/.idea/modules.xml +0 -8
- package/.idea/preact-table.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/jest.config.ts +0 -10
- package/project.json +0 -54
- package/src/ComponentRendererWrapper.ts +0 -60
- package/src/GuiexpertTable.tsx +0 -110
- package/tsconfig.json +0 -28
- package/tsconfig.lib.json +0 -16
- package/tsconfig.spec.json +0 -17
- package/vite.config.ts +0 -49
- /package/{src/index.ts → index.d.ts} +0 -0
package/package.json
CHANGED
package/.eslintrc.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: "@typescript-eslint/parser",
|
|
3
|
-
plugins: ["preact", "@typescript-eslint"],
|
|
4
|
-
extends: ["../../.eslintrc.json"],
|
|
5
|
-
ignorePatterns: ["!**/*"],
|
|
6
|
-
overrides: [
|
|
7
|
-
{
|
|
8
|
-
files: ["*.ts", "*.js", "*.tsx"],
|
|
9
|
-
parserOptions: {
|
|
10
|
-
project: ["libs/preact-table/tsconfig.*?.json"]
|
|
11
|
-
},
|
|
12
|
-
rules: {}
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
files: ["*.ts", "*.tsx"],
|
|
16
|
-
rules: {}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
files: ["*.js", "*.jsx"],
|
|
20
|
-
rules: {}
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
};
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/preact-table.iml" filepath="$PROJECT_DIR$/.idea/preact-table.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/preact-table.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/vcs.xml
DELETED
package/jest.config.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export default {
|
|
3
|
-
displayName: "preact-table",
|
|
4
|
-
preset: "../../jest.preset.js",
|
|
5
|
-
transform: {
|
|
6
|
-
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }]
|
|
7
|
-
},
|
|
8
|
-
moduleFileExtensions: ["ts", "js", "html"],
|
|
9
|
-
coverageDirectory: "../../coverage/libs/preact-table"
|
|
10
|
-
};
|
package/project.json
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@guiexpert/preact-table",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/preact-table/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"tags": [],
|
|
7
|
-
"targets": {
|
|
8
|
-
"lint": {
|
|
9
|
-
"executor": "@nrwl/linter:eslint",
|
|
10
|
-
"outputs": [
|
|
11
|
-
"{options.outputFile}"
|
|
12
|
-
],
|
|
13
|
-
"options": {
|
|
14
|
-
"lintFilePatterns": [
|
|
15
|
-
"libs/preact-table/**/*.{ts,spec.ts}"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"build": {
|
|
20
|
-
"executor": "@nrwl/vite:build",
|
|
21
|
-
"outputs": [
|
|
22
|
-
"{options.outputPath}"
|
|
23
|
-
],
|
|
24
|
-
"defaultConfiguration": "production",
|
|
25
|
-
"options": {
|
|
26
|
-
"outputPath": "dist/libs/preact-table"
|
|
27
|
-
},
|
|
28
|
-
"configurations": {
|
|
29
|
-
"development": {
|
|
30
|
-
"mode": "development"
|
|
31
|
-
},
|
|
32
|
-
"production": {
|
|
33
|
-
"mode": "production"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"test": {
|
|
38
|
-
"executor": "@nrwl/jest:jest",
|
|
39
|
-
"outputs": [
|
|
40
|
-
"{workspaceRoot}/coverage/{projectRoot}"
|
|
41
|
-
],
|
|
42
|
-
"options": {
|
|
43
|
-
"jestConfig": "libs/preact-table/jest.config.ts",
|
|
44
|
-
"passWithNoTests": true
|
|
45
|
-
},
|
|
46
|
-
"configurations": {
|
|
47
|
-
"ci": {
|
|
48
|
-
"ci": true,
|
|
49
|
-
"codeCoverage": true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from "@guiexpert/table";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export class ComponentRendererWrapper implements CellRendererIf {
|
|
6
|
-
|
|
7
|
-
constructor(
|
|
8
|
-
private readonly Component: any
|
|
9
|
-
//private readonly appContext: AppContext | null
|
|
10
|
-
) {
|
|
11
|
-
console.info(Component);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
render(
|
|
15
|
-
cellDiv: HTMLDivElement,
|
|
16
|
-
rowIndex: number,
|
|
17
|
-
columnIndex: number,
|
|
18
|
-
areaIdent: AreaIdent,
|
|
19
|
-
areaModel: AreaModelIf,
|
|
20
|
-
cellValue: any,
|
|
21
|
-
domService: DomServiceIf): RendererCleanupFnType | undefined {
|
|
22
|
-
|
|
23
|
-
const props = {
|
|
24
|
-
cellDiv,
|
|
25
|
-
rowIndex,
|
|
26
|
-
columnIndex,
|
|
27
|
-
areaIdent,
|
|
28
|
-
areaModel,
|
|
29
|
-
cellValue
|
|
30
|
-
};
|
|
31
|
-
const root = createRoot(cellDiv, {});
|
|
32
|
-
root.render(this.Component(props));
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
root.unmount();
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// private mount(
|
|
41
|
-
// component: any,
|
|
42
|
-
// props: (Data & VNodeProps) | null,
|
|
43
|
-
// appContext: AppContext | null,
|
|
44
|
-
// cellDiv: HTMLDivElement
|
|
45
|
-
// ) {
|
|
46
|
-
// let vNode: VNode = createVNode(component, props);
|
|
47
|
-
//
|
|
48
|
-
// vNode.appContext = appContext;
|
|
49
|
-
// render(vNode, cellDiv);
|
|
50
|
-
//
|
|
51
|
-
// const cleanupFn = () => {
|
|
52
|
-
// if (cellDiv) {
|
|
53
|
-
// render(null, cellDiv);
|
|
54
|
-
// }
|
|
55
|
-
// };
|
|
56
|
-
//
|
|
57
|
-
// return cleanupFn;
|
|
58
|
-
// }
|
|
59
|
-
|
|
60
|
-
}
|
package/src/GuiexpertTable.tsx
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Component, createRef } from "preact";
|
|
2
|
-
import {
|
|
3
|
-
GeModelChangeEvent,
|
|
4
|
-
GeMouseEvent,
|
|
5
|
-
SimpleDomService,
|
|
6
|
-
TableModelIf,
|
|
7
|
-
TableOptions,
|
|
8
|
-
TableScope
|
|
9
|
-
} from "@guiexpert/table";
|
|
10
|
-
import { GeCheckboxEventFn, GeModelChangeEventFn, GeMouseEventFn, GeTableReadyEventFn } from "@guiexpert/react-table";
|
|
11
|
-
|
|
12
|
-
export interface GuiexpertTableProps {
|
|
13
|
-
tableModel: TableModelIf,
|
|
14
|
-
tableOptions?: TableOptions,
|
|
15
|
-
mouseMoved?: GeMouseEventFn,
|
|
16
|
-
contextmenu?: GeMouseEventFn,
|
|
17
|
-
mouseClicked?: GeMouseEventFn,
|
|
18
|
-
mouseDragging?: GeMouseEventFn,
|
|
19
|
-
mouseDraggingEnd?: GeMouseEventFn,
|
|
20
|
-
checkboxChanged?: GeCheckboxEventFn,
|
|
21
|
-
modelChanged?: GeModelChangeEventFn,
|
|
22
|
-
tableReady?: GeTableReadyEventFn
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export class GuiexpertTable extends Component {
|
|
27
|
-
|
|
28
|
-
ref = createRef();
|
|
29
|
-
|
|
30
|
-
constructor(props: GuiexpertTableProps) {
|
|
31
|
-
super(props);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
componentDidMount() {
|
|
35
|
-
const myContainer: HTMLDivElement = this.ref.current;
|
|
36
|
-
this.initTable(myContainer, this.props as GuiexpertTableProps);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
componentWillUnmount() {
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
initTable(ele: HTMLDivElement, props: GuiexpertTableProps) {
|
|
43
|
-
const listener = {
|
|
44
|
-
onCheckboxChanged: (evt: any[]) => {
|
|
45
|
-
if (props.checkboxChanged) {
|
|
46
|
-
props.checkboxChanged(evt);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
onContextmenu: (evt: GeMouseEvent) => {
|
|
51
|
-
if (props.contextmenu) {
|
|
52
|
-
props.contextmenu(evt);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
onModelChanged: (evt: GeModelChangeEvent) => {
|
|
57
|
-
if (props.modelChanged) {
|
|
58
|
-
props.modelChanged(evt);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
onMouseClicked: (evt: GeMouseEvent) => {
|
|
63
|
-
if (props.mouseClicked) {
|
|
64
|
-
props.mouseClicked(evt);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
onMouseDragging: (evt: GeMouseEvent) => {
|
|
69
|
-
if (props.mouseDragging) {
|
|
70
|
-
props.mouseDragging(evt);
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
onMouseDraggingEnd: (evt: GeMouseEvent) => {
|
|
75
|
-
if (props.mouseDraggingEnd) {
|
|
76
|
-
props.mouseDraggingEnd(evt);
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
onMouseMoved: (evt: GeMouseEvent) => {
|
|
81
|
-
// if (mouseMoved) {
|
|
82
|
-
// mouseMoved(evt);
|
|
83
|
-
// }
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const tableScope = new TableScope(
|
|
88
|
-
ele, props.tableModel, new SimpleDomService(), props.tableOptions ?? new TableOptions(), listener
|
|
89
|
-
);
|
|
90
|
-
tableScope.firstInit();
|
|
91
|
-
if (props.tableReady) {
|
|
92
|
-
props.tableReady(tableScope.getApi());
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
render() {
|
|
97
|
-
return <div
|
|
98
|
-
ref={this.ref}
|
|
99
|
-
className="container-div"
|
|
100
|
-
style={{
|
|
101
|
-
width: "100%",
|
|
102
|
-
height: "100%",
|
|
103
|
-
backgroundColor: "transparent",
|
|
104
|
-
padding: "0",
|
|
105
|
-
margin: "0"
|
|
106
|
-
}} />;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export default GuiexpertTable;
|
package/tsconfig.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"strict": true,
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"jsx": "preserve",
|
|
11
|
-
"jsxFactory": "h",
|
|
12
|
-
"jsxFragmentFactory": "Fragment",
|
|
13
|
-
"jsxImportSource": "preact",
|
|
14
|
-
"types": [
|
|
15
|
-
"vite/client"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"files": [],
|
|
19
|
-
"include": [],
|
|
20
|
-
"references": [
|
|
21
|
-
{
|
|
22
|
-
"path": "./tsconfig.lib.json"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"path": "./tsconfig.spec.json"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
package/tsconfig.lib.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"types": [
|
|
7
|
-
"jest",
|
|
8
|
-
"node"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"jest.config.ts",
|
|
13
|
-
"src/**/*.test.ts",
|
|
14
|
-
"src/**/*.spec.ts",
|
|
15
|
-
"src/**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { defineConfig } from "vite";
|
|
3
|
-
import react from "@vitejs/plugin-react";
|
|
4
|
-
import viteTsConfigPaths from "vite-tsconfig-paths";
|
|
5
|
-
import dts from "vite-plugin-dts";
|
|
6
|
-
import { join } from "path";
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
cacheDir: "../../node_modules/.vite/preact-table",
|
|
10
|
-
|
|
11
|
-
plugins: [
|
|
12
|
-
dts({
|
|
13
|
-
entryRoot: "src",
|
|
14
|
-
tsConfigFilePath: join(__dirname, "tsconfig.lib.json"),
|
|
15
|
-
skipDiagnostics: true
|
|
16
|
-
}),
|
|
17
|
-
react(),
|
|
18
|
-
viteTsConfigPaths({
|
|
19
|
-
root: "../../"
|
|
20
|
-
})
|
|
21
|
-
],
|
|
22
|
-
|
|
23
|
-
// Uncomment this if you are using workers.
|
|
24
|
-
// worker: {
|
|
25
|
-
// plugins: [
|
|
26
|
-
// viteTsConfigPaths({
|
|
27
|
-
// root: '../../',
|
|
28
|
-
// }),
|
|
29
|
-
// ],
|
|
30
|
-
// },
|
|
31
|
-
|
|
32
|
-
// Configuration for building your library.
|
|
33
|
-
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
34
|
-
build: {
|
|
35
|
-
lib: {
|
|
36
|
-
// Could also be a dictionary or array of multiple entry points.
|
|
37
|
-
entry: "src/index.ts",
|
|
38
|
-
name: "preact-table",
|
|
39
|
-
fileName: "index",
|
|
40
|
-
// Change this to the formats you want to support.
|
|
41
|
-
// Don't forgot to update your package.json as well.
|
|
42
|
-
formats: ["es", "cjs"]
|
|
43
|
-
},
|
|
44
|
-
rollupOptions: {
|
|
45
|
-
// External packages that should not be bundled into your library.
|
|
46
|
-
external: ["preact", "preact-dom", "preact/jsx-runtime"]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
File without changes
|