@guiexpert/solid-table 1.0.14 → 1.0.15
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/.eslintrc.js +26 -0
- package/{ComponentRendererWrapper.d.ts → dist/ComponentRendererWrapper.d.ts} +1 -1
- package/{GuiexpertTableProps.d.ts → dist/GuiexpertTableProps.d.ts} +1 -1
- package/dist/README.md +97 -0
- package/{RendererPropsIf.d.ts → dist/RendererPropsIf.d.ts} +1 -1
- package/dist/index.cjs +254 -0
- package/{index.js → dist/index.js} +480 -465
- package/dist/package.json +44 -0
- package/jest.config.ts +10 -0
- package/package.json +29 -3
- package/patch.js +16 -0
- package/src/ComponentRendererWrapper.ts +37 -0
- package/src/GuiexpertTable.tsx +92 -0
- package/src/GuiexpertTableProps.tsx +29 -0
- package/src/RendererPropsIf.ts +10 -0
- package/src/index.ts +11 -0
- package/tsconfig.json +30 -0
- package/tsconfig.lib.json +16 -0
- package/tsconfig.spec.json +17 -0
- package/vite.config.ts +58 -0
- package/index.cjs +0 -254
- /package/{GuiexpertTable.d.ts → dist/GuiexpertTable.d.ts} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@guiexpert/solid-table",
|
|
3
|
+
"version": "1.0.14",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"lib": {
|
|
8
|
+
"entryFile": "src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"i": "pnpm i",
|
|
12
|
+
"build": "vite build",
|
|
13
|
+
"npm-pub:solid-table": "npm publish --access public"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./index.js",
|
|
18
|
+
"require": "./index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"tslib": "^2.3.0",
|
|
23
|
+
"@guiexpert/table": "workspace:^"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"solid-jest": "^0.2.0",
|
|
27
|
+
"solid-js": "^1.6.10",
|
|
28
|
+
"solid-testing-library": "^0.5.1",
|
|
29
|
+
"@types/react": "^18.2.37",
|
|
30
|
+
"@types/react-dom": "^18.2.15",
|
|
31
|
+
"@types/node": "^20.11.17",
|
|
32
|
+
"vite": "^5.1.1",
|
|
33
|
+
"vite-plugin-dts": "^3.7.2",
|
|
34
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
35
|
+
"vite-plugin-static-copy": "^0.17.0",
|
|
36
|
+
"vite-tsconfig-paths": "^4.2.1",
|
|
37
|
+
"vite-plugin-babel": "^1.2.0",
|
|
38
|
+
"vite-plugin-solid": "^2.7.2",
|
|
39
|
+
"@vitejs/plugin-react": "^4.1.1",
|
|
40
|
+
"ts-node": "10.9.1",
|
|
41
|
+
"tsconfig": "^7.0.0",
|
|
42
|
+
"typescript": "5.2.2"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
displayName: "solid-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/solid-table"
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/solid-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -8,12 +8,38 @@
|
|
|
8
8
|
"entryFile": "src/index.ts"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
11
|
+
"i": "pnpm i",
|
|
12
|
+
"patch-version": "node patch.js",
|
|
13
|
+
"build": "vite build",
|
|
14
|
+
"npm-pub": "npm publish --access public"
|
|
12
15
|
},
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|
|
15
18
|
"import": "./index.js",
|
|
16
19
|
"require": "./index.cjs"
|
|
17
20
|
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"tslib": "^2.3.0",
|
|
24
|
+
"@guiexpert/table": "workspace:^"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"solid-jest": "^0.2.0",
|
|
28
|
+
"solid-js": "^1.6.10",
|
|
29
|
+
"solid-testing-library": "^0.5.1",
|
|
30
|
+
"@types/react": "^18.2.37",
|
|
31
|
+
"@types/react-dom": "^18.2.15",
|
|
32
|
+
"@types/node": "^20.11.17",
|
|
33
|
+
"vite": "^5.1.1",
|
|
34
|
+
"vite-plugin-dts": "^3.7.2",
|
|
35
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
36
|
+
"vite-plugin-static-copy": "^0.17.0",
|
|
37
|
+
"vite-tsconfig-paths": "^4.2.1",
|
|
38
|
+
"vite-plugin-babel": "^1.2.0",
|
|
39
|
+
"vite-plugin-solid": "^2.7.2",
|
|
40
|
+
"@vitejs/plugin-react": "^4.1.1",
|
|
41
|
+
"ts-node": "10.9.1",
|
|
42
|
+
"tsconfig": "^7.0.0",
|
|
43
|
+
"typescript": "5.2.2"
|
|
18
44
|
}
|
|
19
|
-
}
|
|
45
|
+
}
|
package/patch.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
|
|
3
|
+
const packageJsonPath = 'package.json';
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
const pack = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
7
|
+
const currentVersion = pack.version;
|
|
8
|
+
const [major, minor, patch] = currentVersion.split('.').map(Number);
|
|
9
|
+
const newPatchVersion = `${major}.${minor}.${patch + 1}`;
|
|
10
|
+
pack.version = newPatchVersion;
|
|
11
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(pack, null, 2));
|
|
12
|
+
console.log(`${pack.name} -> version patched to ${newPatchVersion}.`);
|
|
13
|
+
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error:', error);
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from "@guiexpert/table";
|
|
2
|
+
import { JSX } from "solid-js/jsx-runtime";
|
|
3
|
+
import { mergeProps, render } from "solid-js/web";
|
|
4
|
+
|
|
5
|
+
export class ComponentRendererWrapper implements CellRendererIf {
|
|
6
|
+
|
|
7
|
+
constructor(
|
|
8
|
+
private readonly code: (props: any) => JSX.Element
|
|
9
|
+
) {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
render(
|
|
13
|
+
cellDiv: HTMLDivElement,
|
|
14
|
+
rowIndex: number,
|
|
15
|
+
columnIndex: number,
|
|
16
|
+
areaIdent: AreaIdent,
|
|
17
|
+
areaModel: AreaModelIf,
|
|
18
|
+
cellValue: any,
|
|
19
|
+
_domService: DomServiceIf): RendererCleanupFnType | undefined {
|
|
20
|
+
|
|
21
|
+
const props = mergeProps({
|
|
22
|
+
rowIndex,
|
|
23
|
+
columnIndex,
|
|
24
|
+
areaIdent,
|
|
25
|
+
areaModel,
|
|
26
|
+
cellValue
|
|
27
|
+
});
|
|
28
|
+
render(
|
|
29
|
+
() => this.code(props),
|
|
30
|
+
cellDiv
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {GuiexpertTableProps} from "./GuiexpertTableProps";
|
|
2
|
+
import {mergeProps, onMount} from "solid-js";
|
|
3
|
+
import {
|
|
4
|
+
EventListenerIf,
|
|
5
|
+
FocusModelIf,
|
|
6
|
+
LicenseManager,
|
|
7
|
+
SelectionModelIf,
|
|
8
|
+
SimpleDomService,
|
|
9
|
+
TableOptions,
|
|
10
|
+
TableScope
|
|
11
|
+
} from '@guiexpert/table';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Render a table component with specified properties
|
|
17
|
+
*
|
|
18
|
+
* @param {GuiexpertTableProps} props - The properties of the table component
|
|
19
|
+
* @returns {JSX.Element} - The rendered table component
|
|
20
|
+
*/
|
|
21
|
+
export default (props: GuiexpertTableProps) => {
|
|
22
|
+
|
|
23
|
+
let ref:any;
|
|
24
|
+
|
|
25
|
+
const merged = mergeProps({
|
|
26
|
+
tableModel: null,
|
|
27
|
+
tableOptions: new TableOptions()
|
|
28
|
+
}, props);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
onMount(() => {
|
|
32
|
+
const listener: EventListenerIf = {
|
|
33
|
+
onSelectionChanged(model: SelectionModelIf): void {
|
|
34
|
+
const e = new CustomEvent("selectionChanged", { detail: model, bubbles: true });
|
|
35
|
+
if (ref) ref.dispatchEvent(e);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
onFocusChanged(model: FocusModelIf): void{
|
|
39
|
+
const e = new CustomEvent("focusChanged", { detail: model, bubbles: true });
|
|
40
|
+
if (ref) ref.dispatchEvent(e);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
onCheckboxChanged: (evt: any) => {
|
|
44
|
+
const e = new CustomEvent("checkboxChanged", { detail: evt, bubbles: true });
|
|
45
|
+
if (ref) ref.dispatchEvent(e);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
onContextmenu: (evt: any) => {
|
|
49
|
+
const e = new CustomEvent("contextmenu", { detail: evt, bubbles: true });
|
|
50
|
+
if (ref) ref.dispatchEvent(e);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
onModelChanged: (evt: any) => {
|
|
54
|
+
const e = new CustomEvent("modelChanged", { detail: evt, bubbles: true });
|
|
55
|
+
if (ref) ref.dispatchEvent(e);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
onMouseClicked: (evt: any) => {
|
|
59
|
+
const e = new CustomEvent("mouseClicked", { detail: evt, bubbles: true });
|
|
60
|
+
if (ref) ref.dispatchEvent(e);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
onMouseDragging: (evt: any) => {
|
|
64
|
+
const e = new CustomEvent("mouseDragging", { detail: evt, bubbles: true });
|
|
65
|
+
if (ref) ref.dispatchEvent(e);
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
onMouseDraggingEnd: (evt: any) => {
|
|
69
|
+
const e = new CustomEvent("mouseDraggingEnd", { detail: evt, bubbles: true });
|
|
70
|
+
if (ref) ref.dispatchEvent(e);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
onMouseMoved: (evt: any) => {
|
|
74
|
+
const e = new CustomEvent("mouseMoved", { detail: evt, bubbles: true });
|
|
75
|
+
if (ref) ref.dispatchEvent(e);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const tableScope = new TableScope(
|
|
80
|
+
ref, merged.tableModel, new SimpleDomService(), merged.tableOptions, listener
|
|
81
|
+
);
|
|
82
|
+
tableScope.firstInit();
|
|
83
|
+
const e = new CustomEvent("tableReady", { detail: tableScope.getApi(), bubbles: true });
|
|
84
|
+
if (ref) ref.dispatchEvent(e);
|
|
85
|
+
|
|
86
|
+
if (merged.licenseKey) LicenseManager.getInstance().setLicenseKey(merged.licenseKey);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div ref={ref} />
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
FocusModelIf,
|
|
4
|
+
GeModelChangeEvent, GeMouseEvent, SelectionModelIf, TableApi, TableModelIf, TableOptions
|
|
5
|
+
} from '@guiexpert/table';
|
|
6
|
+
|
|
7
|
+
export type GeMouseEventFn = (evt: GeMouseEvent) => {};
|
|
8
|
+
export type GeCheckboxEventFn = (evt: any[]) => {};
|
|
9
|
+
export type GeTableReadyEventFn = (evt: TableApi) => {};
|
|
10
|
+
export type GeModelChangeEventFn = (evt: GeModelChangeEvent) => {};
|
|
11
|
+
export type GeSelectionChangeEventFn = (evt: SelectionModelIf) => {};
|
|
12
|
+
export type GeFocusChangeEventFn = (evt: FocusModelIf) => {};
|
|
13
|
+
|
|
14
|
+
export interface GuiexpertTableProps {
|
|
15
|
+
tableModel: TableModelIf,
|
|
16
|
+
tableOptions?: TableOptions,
|
|
17
|
+
mouseMoved?: GeMouseEventFn,
|
|
18
|
+
contextmenu?: GeMouseEventFn,
|
|
19
|
+
mouseClicked?: GeMouseEventFn,
|
|
20
|
+
mouseDragging?: GeMouseEventFn,
|
|
21
|
+
mouseDraggingEnd?: GeMouseEventFn,
|
|
22
|
+
checkboxChanged?: GeCheckboxEventFn,
|
|
23
|
+
modelChanged?: GeModelChangeEventFn,
|
|
24
|
+
selectionChanged?: GeSelectionChangeEventFn;
|
|
25
|
+
focusChanged?: GeFocusChangeEventFn;
|
|
26
|
+
tableReady?: GeTableReadyEventFn,
|
|
27
|
+
licenseKey?: string,
|
|
28
|
+
}
|
|
29
|
+
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentRendererWrapper } from "./ComponentRendererWrapper";
|
|
3
|
+
import * as GuiexpertTableProps from "./GuiexpertTableProps";
|
|
4
|
+
import GuiexpertTable from "./GuiexpertTable";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
GuiexpertTable,
|
|
9
|
+
GuiexpertTableProps,
|
|
10
|
+
ComponentRendererWrapper
|
|
11
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true,
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"jsx": "preserve",
|
|
12
|
+
"jsxImportSource": "solid-js",
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"types": [
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"files": [],
|
|
20
|
+
"include": ["src"],
|
|
21
|
+
"exclude": ["node_modules", "dist"],
|
|
22
|
+
"references": [
|
|
23
|
+
{
|
|
24
|
+
"path": "./tsconfig.lib.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "./tsconfig.spec.json"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import solidPlugin from 'vite-plugin-solid';
|
|
4
|
+
import dts from "vite-plugin-dts";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import {viteStaticCopy} from "vite-plugin-static-copy";
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
cacheDir: "../../node_modules/.vite/solid-table",
|
|
10
|
+
|
|
11
|
+
plugins: [
|
|
12
|
+
dts({
|
|
13
|
+
entryRoot: "src",
|
|
14
|
+
tsconfigPath: join(__dirname, "tsconfig.lib.json"),
|
|
15
|
+
|
|
16
|
+
}),
|
|
17
|
+
solidPlugin(),
|
|
18
|
+
|
|
19
|
+
viteStaticCopy({
|
|
20
|
+
targets: [
|
|
21
|
+
{
|
|
22
|
+
src: 'README.md',
|
|
23
|
+
dest: './'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
src: 'package.json',
|
|
27
|
+
dest: './'
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
// Configuration for building your library.
|
|
34
|
+
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
35
|
+
build: {
|
|
36
|
+
lib: {
|
|
37
|
+
// Could also be a dictionary or array of multiple entry points.
|
|
38
|
+
entry: "src/index.ts",
|
|
39
|
+
name: "solid-table",
|
|
40
|
+
fileName: "index",
|
|
41
|
+
// Change this to the formats you want to support.
|
|
42
|
+
// Don't forgot to update your package.json as well.
|
|
43
|
+
formats: ["es", "cjs"]
|
|
44
|
+
},
|
|
45
|
+
rollupOptions: {
|
|
46
|
+
// External packages that should not be bundled into your library.
|
|
47
|
+
external: ["solid", "react-dom", "react/jsx-runtime"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
resolve: {
|
|
51
|
+
alias: [
|
|
52
|
+
{
|
|
53
|
+
find: /@guiexpert\/table/,
|
|
54
|
+
replacement: join(__dirname, '..', 'table', 'src'),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
});
|