@guiexpert/react-table 1.0.2 → 1.0.3

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.
@@ -0,0 +1,6 @@
1
+ import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from "@guiexpert/table";
2
+ export declare class ComponentRendererWrapper implements CellRendererIf {
3
+ private readonly Component;
4
+ constructor(Component: any);
5
+ render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
6
+ }
@@ -0,0 +1,19 @@
1
+ import { GeModelChangeEvent, GeMouseEvent, TableApi, TableModelIf, TableOptions } from "@guiexpert/table";
2
+ export type GeMouseEventFn = (evt: GeMouseEvent) => {};
3
+ export type GeCheckboxEventFn = (evt: any[]) => {};
4
+ export type GeTableReadyEventFn = (evt: TableApi) => {};
5
+ export type GeModelChangeEventFn = (evt: GeModelChangeEvent) => {};
6
+ export interface GuiexpertTableProps {
7
+ tableModel: TableModelIf;
8
+ tableOptions?: TableOptions;
9
+ mouseMoved?: GeMouseEventFn;
10
+ contextmenu?: GeMouseEventFn;
11
+ mouseClicked?: GeMouseEventFn;
12
+ mouseDragging?: GeMouseEventFn;
13
+ mouseDraggingEnd?: GeMouseEventFn;
14
+ checkboxChanged?: GeCheckboxEventFn;
15
+ modelChanged?: GeModelChangeEventFn;
16
+ tableReady?: GeTableReadyEventFn;
17
+ }
18
+ export declare function GuiexpertTable({ tableModel, tableOptions, mouseMoved, checkboxChanged, contextmenu, modelChanged, mouseClicked, mouseDragging, mouseDraggingEnd, tableReady }: GuiexpertTableProps): import("react/jsx-runtime").JSX.Element;
19
+ export default GuiexpertTable;
package/package.json CHANGED
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/react-table",
3
- "version": "1.0.2",
4
- "scripts": {
5
- "publish": "npm publish"
6
- },
3
+ "version": "1.0.3",
7
4
  "main": "./index.js",
8
5
  "types": "./index.d.ts",
9
6
  "exports": {
package/.eslintrc.json DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "extends": [
3
- "plugin:@nrwl/nx/react",
4
- "../../.eslintrc.json"
5
- ],
6
- "ignorePatterns": [
7
- "!**/*"
8
- ],
9
- "overrides": [
10
- {
11
- "files": [
12
- "*.ts",
13
- "*.tsx",
14
- "*.js",
15
- "*.jsx"
16
- ],
17
- "rules": {}
18
- },
19
- {
20
- "files": [
21
- "*.ts",
22
- "*.tsx"
23
- ],
24
- "rules": {}
25
- },
26
- {
27
- "files": [
28
- "*.js",
29
- "*.jsx"
30
- ],
31
- "rules": {}
32
- }
33
- ]
34
- }
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/react-table.iml" filepath="$PROJECT_DIR$/.idea/react-table.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -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
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
package/jest.config.ts DELETED
@@ -1,11 +0,0 @@
1
- /* eslint-disable */
2
- export default {
3
- displayName: "react-table",
4
- preset: "../../jest.preset.js",
5
- transform: {
6
- "^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "@nrwl/react/plugins/jest",
7
- "^.+\\.[tj]sx?$": ["babel-jest", { presets: ["@nrwl/react/babel"] }]
8
- },
9
- moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
10
- coverageDirectory: "../../coverage/libs/react-table"
11
- };
package/project.json DELETED
@@ -1,54 +0,0 @@
1
- {
2
- "name": "@guiexpert/react-table",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "libs/react-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/react-table/**/*.{ts,tsx,js,jsx}"
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/react-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/react-table/jest.config.ts",
44
- "passWithNoTests": true
45
- },
46
- "configurations": {
47
- "ci": {
48
- "ci": true,
49
- "codeCoverage": true
50
- }
51
- }
52
- }
53
- }
54
- }
@@ -1,39 +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
- ) {
10
- console.info(Component);
11
- }
12
-
13
- render(
14
- cellDiv: HTMLDivElement,
15
- rowIndex: number,
16
- columnIndex: number,
17
- areaIdent: AreaIdent,
18
- areaModel: AreaModelIf,
19
- cellValue: any,
20
- domService: DomServiceIf): RendererCleanupFnType | undefined {
21
-
22
- const props = {
23
- cellDiv,
24
- rowIndex,
25
- columnIndex,
26
- areaIdent,
27
- areaModel,
28
- cellValue
29
- };
30
- const root = createRoot(cellDiv, {});
31
- root.render(this.Component(props));
32
-
33
- return () => {
34
- root.unmount();
35
- };
36
- }
37
-
38
-
39
- }
@@ -1,126 +0,0 @@
1
- import {
2
- GeModelChangeEvent,
3
- GeMouseEvent,
4
- SimpleDomService,
5
- TableApi,
6
- TableModelIf,
7
- TableOptions,
8
- TableScope
9
- } from "@guiexpert/table";
10
- import React, { useEffect, useRef } from "react";
11
-
12
- export type GeMouseEventFn = (evt: GeMouseEvent) => {};
13
- export type GeCheckboxEventFn = (evt: any[]) => {};
14
- export type GeTableReadyEventFn = (evt: TableApi) => {};
15
- export type GeModelChangeEventFn = (evt: GeModelChangeEvent) => {};
16
-
17
- export interface GuiexpertTableProps {
18
- tableModel: TableModelIf,
19
- tableOptions?: TableOptions,
20
- mouseMoved?: GeMouseEventFn,
21
- contextmenu?: GeMouseEventFn,
22
- mouseClicked?: GeMouseEventFn,
23
- mouseDragging?: GeMouseEventFn,
24
- mouseDraggingEnd?: GeMouseEventFn,
25
- checkboxChanged?: GeCheckboxEventFn,
26
- modelChanged?: GeModelChangeEventFn,
27
- tableReady?: GeTableReadyEventFn
28
- }
29
-
30
- export function GuiexpertTable(
31
- {
32
- tableModel,
33
- tableOptions = new TableOptions(),
34
- mouseMoved,
35
- checkboxChanged,
36
- contextmenu,
37
- modelChanged,
38
- mouseClicked,
39
- mouseDragging,
40
- mouseDraggingEnd,
41
- tableReady
42
- }: GuiexpertTableProps) {
43
-
44
- const myContainer = useRef(null);
45
- let initialized = false;
46
-
47
- useEffect(() => {
48
- if (myContainer.current && !initialized) {
49
- initTable(myContainer.current);
50
- initialized = true;
51
- }
52
- });
53
-
54
- let root: HTMLDivElement | null;
55
-
56
- const initTable = (ele: HTMLDivElement) => {
57
- const listener = {
58
- onCheckboxChanged: (evt: any[]) => {
59
- if (checkboxChanged) {
60
- checkboxChanged(evt);
61
- }
62
- },
63
-
64
- onContextmenu: (evt: GeMouseEvent) => {
65
- if (contextmenu) {
66
- contextmenu(evt);
67
- }
68
- },
69
-
70
- onModelChanged: (evt: GeModelChangeEvent) => {
71
- if (modelChanged) {
72
- modelChanged(evt);
73
- }
74
- },
75
-
76
- onMouseClicked: (evt: GeMouseEvent) => {
77
- if (mouseClicked) {
78
- mouseClicked(evt);
79
- }
80
- },
81
-
82
- onMouseDragging: (evt: GeMouseEvent) => {
83
- if (mouseDragging) {
84
- mouseDragging(evt);
85
- }
86
- },
87
-
88
- onMouseDraggingEnd: (evt: GeMouseEvent) => {
89
- if (mouseDraggingEnd) {
90
- mouseDraggingEnd(evt);
91
- }
92
- },
93
-
94
- onMouseMoved: (evt: GeMouseEvent) => {
95
- if (mouseMoved) {
96
- mouseMoved(evt);
97
- }
98
- }
99
- };
100
-
101
- const tableScope = new TableScope(
102
- ele, tableModel, new SimpleDomService(), tableOptions, listener
103
- );
104
- tableScope.firstInit();
105
- if (tableReady) {
106
- tableReady(tableScope.getApi());
107
- }
108
- };
109
-
110
- return (
111
- <div
112
- ref={myContainer}
113
- className="container-div"
114
- style={{
115
- width: "100%",
116
- height: "100%",
117
- backgroundColor: "transparent",
118
- padding: "0",
119
- margin: "0"
120
- }}></div>
121
- );
122
- }
123
-
124
- export default GuiexpertTable;
125
-
126
-
@@ -1,8 +0,0 @@
1
- /*
2
- * Replace this with your own classes
3
- *
4
- * e.g.
5
- * .container {
6
- * }
7
- */
8
-
@@ -1,6 +0,0 @@
1
- describe("ReactTable", () => {
2
- // it("should render successfully", () => {
3
- // const { baseElement } = render(<ReactTable />);
4
- // expect(baseElement).toBeTruthy();
5
- // });
6
- });
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react-jsx",
4
- "allowJs": false,
5
- "esModuleInterop": false,
6
- "allowSyntheticDefaultImports": true,
7
- "strict": true,
8
- "types": [
9
- "vite/client"
10
- ]
11
- },
12
- "files": [],
13
- "include": [],
14
- "references": [
15
- {
16
- "path": "./tsconfig.lib.json"
17
- },
18
- {
19
- "path": "./tsconfig.spec.json"
20
- }
21
- ],
22
- "extends": "../../tsconfig.base.json"
23
- }
package/tsconfig.lib.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../dist/out-tsc",
5
- "types": [
6
- "node",
7
- "vite/client"
8
- ]
9
- },
10
- "files": [
11
- "../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
12
- "../../node_modules/@nrwl/react/typings/image.d.ts"
13
- ],
14
- "exclude": [
15
- "**/*.spec.ts",
16
- "**/*.test.ts",
17
- "**/*.spec.tsx",
18
- "**/*.test.tsx",
19
- "**/*.spec.js",
20
- "**/*.test.js",
21
- "**/*.spec.jsx",
22
- "**/*.test.jsx"
23
- ],
24
- "include": [
25
- "**/*.js",
26
- "**/*.jsx",
27
- "**/*.ts",
28
- "**/*.tsx"
29
- ]
30
- }
@@ -1,23 +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/**/*.test.tsx",
16
- "src/**/*.spec.tsx",
17
- "src/**/*.test.js",
18
- "src/**/*.spec.js",
19
- "src/**/*.test.jsx",
20
- "src/**/*.spec.jsx",
21
- "src/**/*.d.ts"
22
- ]
23
- }
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/react-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: "react-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: ["react", "react-dom", "react/jsx-runtime"]
47
- }
48
- }
49
- });
File without changes