@guiexpert/svelte-table 1.0.11 → 4.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/.eslintrc.js +30 -0
- package/{ComponentRendererWrapper.d.ts → dist/ComponentRendererWrapper.d.ts} +1 -1
- package/dist/README.md +103 -0
- package/dist/index.cjs +254 -0
- package/{index.js → dist/index.js} +164 -144
- package/dist/package.json +50 -0
- package/package.json +34 -3
- package/patch.js +16 -0
- package/src/ComponentRendererWrapper.ts +38 -0
- package/src/GuiexpertTable.svelte +67 -0
- package/src/index.ts +2 -0
- package/src/vite-env.d.ts +2 -0
- package/svelte.config.cjs +10 -0
- package/tsconfig.json +30 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.spec.json +18 -0
- package/vite.config.mts +70 -0
- package/index.cjs +0 -254
- /package/{GuiexpertTable.svelte.d.ts → dist/GuiexpertTable.svelte.d.ts} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@guiexpert/svelte-table",
|
|
3
|
+
"version": "4.0.2",
|
|
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
|
+
"patch-version": "node patch.js",
|
|
13
|
+
"build": "vite build",
|
|
14
|
+
"npm-pub": "npm publish --access public"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./index.js",
|
|
19
|
+
"require": "./index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"tslib": "^2.3.0",
|
|
24
|
+
"@guiexpert/table": "workspace:^",
|
|
25
|
+
"preact": "^10.19.4"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"svelte": "^4.2.1",
|
|
29
|
+
"svelte-check": "^2.10.2",
|
|
30
|
+
"svelte-jester": "^2.3.2",
|
|
31
|
+
"svelte-preprocess": "^5.0.4",
|
|
32
|
+
"@sveltejs/vite-plugin-svelte": "^2.5.2",
|
|
33
|
+
"@testing-library/svelte": "^4.0.5",
|
|
34
|
+
"@tsconfig/svelte": "^4.0.1",
|
|
35
|
+
"eslint-plugin-svelte3": "^4.0.0",
|
|
36
|
+
"@types/react": "^18.2.37",
|
|
37
|
+
"@types/react-dom": "^18.2.15",
|
|
38
|
+
"@types/node": "^20.11.17",
|
|
39
|
+
"vite": "^5.1.1",
|
|
40
|
+
"vite-plugin-dts": "^3.7.2",
|
|
41
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
42
|
+
"vite-plugin-static-copy": "^0.17.0",
|
|
43
|
+
"vite-tsconfig-paths": "^4.2.1",
|
|
44
|
+
"vite-plugin-babel": "^1.2.0",
|
|
45
|
+
"@vitejs/plugin-react": "^4.1.1",
|
|
46
|
+
"ts-node": "10.9.1",
|
|
47
|
+
"tsconfig": "^7.0.0",
|
|
48
|
+
"typescript": "5.2.2"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/svelte-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -8,12 +8,43 @@
|
|
|
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
|
+
"preact": "^10.19.4"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"svelte": "^4.2.1",
|
|
29
|
+
"svelte-check": "^2.10.2",
|
|
30
|
+
"svelte-jester": "^2.3.2",
|
|
31
|
+
"svelte-preprocess": "^5.0.4",
|
|
32
|
+
"@sveltejs/vite-plugin-svelte": "^2.5.2",
|
|
33
|
+
"@testing-library/svelte": "^4.0.5",
|
|
34
|
+
"@tsconfig/svelte": "^4.0.1",
|
|
35
|
+
"eslint-plugin-svelte3": "^4.0.0",
|
|
36
|
+
"@types/react": "^18.2.37",
|
|
37
|
+
"@types/react-dom": "^18.2.15",
|
|
38
|
+
"@types/node": "^20.11.17",
|
|
39
|
+
"vite": "^5.1.1",
|
|
40
|
+
"vite-plugin-dts": "^3.7.2",
|
|
41
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
42
|
+
"vite-plugin-static-copy": "^0.17.0",
|
|
43
|
+
"vite-tsconfig-paths": "^4.2.1",
|
|
44
|
+
"vite-plugin-babel": "^1.2.0",
|
|
45
|
+
"@vitejs/plugin-react": "^4.1.1",
|
|
46
|
+
"ts-node": "10.9.1",
|
|
47
|
+
"tsconfig": "^7.0.0",
|
|
48
|
+
"typescript": "5.2.2"
|
|
18
49
|
}
|
|
19
|
-
}
|
|
50
|
+
}
|
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,38 @@
|
|
|
1
|
+
import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from "@guiexpert/table";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class ComponentRendererWrapper implements CellRendererIf {
|
|
5
|
+
|
|
6
|
+
constructor(
|
|
7
|
+
private readonly Component:any
|
|
8
|
+
) {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
render(
|
|
12
|
+
cellDiv: HTMLDivElement,
|
|
13
|
+
rowIndex: number,
|
|
14
|
+
columnIndex: number,
|
|
15
|
+
areaIdent: AreaIdent,
|
|
16
|
+
areaModel: AreaModelIf,
|
|
17
|
+
cellValue: any,
|
|
18
|
+
_domService: DomServiceIf): RendererCleanupFnType | undefined {
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const c = new this.Component({
|
|
22
|
+
target: cellDiv,
|
|
23
|
+
props: {
|
|
24
|
+
cellDiv,
|
|
25
|
+
rowIndex,
|
|
26
|
+
columnIndex,
|
|
27
|
+
areaIdent,
|
|
28
|
+
areaModel,
|
|
29
|
+
cellValue
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return () => {
|
|
33
|
+
c.$destroy();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, onMount } from 'svelte';
|
|
3
|
+
import { EventListenerIf, FocusModelIf, LicenseManager, SelectionModelIf, SimpleDomService, TableOptions, TableScope } from '../../table/src'; // "@guiexpert/table";
|
|
4
|
+
|
|
5
|
+
export let tableModel: any;
|
|
6
|
+
export let tableOptions = new TableOptions();
|
|
7
|
+
export let licenseKey: string | undefined;
|
|
8
|
+
|
|
9
|
+
let root: any;
|
|
10
|
+
const dispatch = createEventDispatcher();
|
|
11
|
+
|
|
12
|
+
onMount(() => {
|
|
13
|
+
|
|
14
|
+
const listener: EventListenerIf = {
|
|
15
|
+
onSelectionChanged(model: SelectionModelIf): void {
|
|
16
|
+
dispatch('selectionChanged', model);
|
|
17
|
+
},
|
|
18
|
+
onFocusChanged(model: FocusModelIf): void{
|
|
19
|
+
dispatch('focusChanged', model);
|
|
20
|
+
},
|
|
21
|
+
onCheckboxChanged: (evt: any) => {
|
|
22
|
+
dispatch('checkboxChanged', evt);
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
onContextmenu: (evt: any) => {
|
|
26
|
+
dispatch('contextmenu', evt);
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
onModelChanged: (evt: any) => {
|
|
30
|
+
dispatch('modelChanged', evt);
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
onMouseClicked: (evt: any) => {
|
|
34
|
+
dispatch('mouseClicked', evt);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
onMouseDragging: (evt: any) => {
|
|
38
|
+
dispatch('mouseDragging', evt);
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
onMouseDraggingEnd: (evt: any) => {
|
|
42
|
+
dispatch('mouseDraggingEnd', evt);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
onMouseMoved: (evt: any) => {
|
|
46
|
+
dispatch('mouseMoved', evt);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const tableScope = new TableScope(
|
|
51
|
+
root, tableModel, new SimpleDomService(), tableOptions, listener
|
|
52
|
+
);
|
|
53
|
+
tableScope.firstInit();
|
|
54
|
+
dispatch('tableReady', tableScope.getApi());
|
|
55
|
+
|
|
56
|
+
if (licenseKey) LicenseManager.getInstance().setLicenseKey(licenseKey);
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<div
|
|
61
|
+
bind:this={root}
|
|
62
|
+
class="ge-table"
|
|
63
|
+
style="width: 100%; height: 100%; background-color: transparent; padding: 0; margin: 0"></div>
|
|
64
|
+
|
|
65
|
+
<style>
|
|
66
|
+
|
|
67
|
+
</style>
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const sveltePreprocess = require("svelte-preprocess");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
// Consult https://github.com/sveltejs/svelte-preprocess
|
|
5
|
+
// for more information about preprocessors
|
|
6
|
+
preprocess: sveltePreprocess(),
|
|
7
|
+
vitePlugin: {
|
|
8
|
+
prebundleSvelteLibraries: false
|
|
9
|
+
}
|
|
10
|
+
};
|
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": false,
|
|
11
|
+
"jsx": "preserve",
|
|
12
|
+
"jsxImportSource": "svelte-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,18 @@
|
|
|
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
|
+
"**/*.spec.ts",
|
|
13
|
+
"**/*.spec.tsx",
|
|
14
|
+
"**/*.spec.js",
|
|
15
|
+
"**/*.spec.jsx",
|
|
16
|
+
"**/*.d.ts"
|
|
17
|
+
]
|
|
18
|
+
}
|
package/vite.config.mts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
import {defineConfig} from "vite";
|
|
3
|
+
import {svelte} from '@sveltejs/vite-plugin-svelte';
|
|
4
|
+
import dts from "vite-plugin-dts";
|
|
5
|
+
import {join} from "path";
|
|
6
|
+
import {viteStaticCopy} from "vite-plugin-static-copy";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
cacheDir: "../../node_modules/.vite/svelte-table",
|
|
11
|
+
|
|
12
|
+
plugins: [
|
|
13
|
+
dts({
|
|
14
|
+
entryRoot: "src",
|
|
15
|
+
tsconfigPath: join(__dirname, "tsconfig.lib.json"),
|
|
16
|
+
|
|
17
|
+
}),
|
|
18
|
+
svelte({
|
|
19
|
+
prebundleSvelteLibraries: true
|
|
20
|
+
}),
|
|
21
|
+
|
|
22
|
+
viteStaticCopy({
|
|
23
|
+
targets: [
|
|
24
|
+
{
|
|
25
|
+
src: 'README.md',
|
|
26
|
+
dest: './'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
src: 'package.json',
|
|
30
|
+
dest: './'
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
// Uncomment this if you are using workers.
|
|
37
|
+
// worker: {
|
|
38
|
+
// plugins: [
|
|
39
|
+
// viteTsConfigPaths({
|
|
40
|
+
// root: '../../',
|
|
41
|
+
// }),
|
|
42
|
+
// ],
|
|
43
|
+
// },
|
|
44
|
+
|
|
45
|
+
// Configuration for building your library.
|
|
46
|
+
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
47
|
+
build: {
|
|
48
|
+
lib: {
|
|
49
|
+
// Could also be a dictionary or array of multiple entry points.
|
|
50
|
+
entry: "src/index.ts",
|
|
51
|
+
name: "svelte-table",
|
|
52
|
+
fileName: "index",
|
|
53
|
+
// Change this to the formats you want to support.
|
|
54
|
+
// Don't forgot to update your package.json as well.
|
|
55
|
+
formats: ["es", "cjs"]
|
|
56
|
+
},
|
|
57
|
+
rollupOptions: {
|
|
58
|
+
// External packages that should not be bundled into your library.
|
|
59
|
+
external: ["svelte", "react-dom", "react/jsx-runtime"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
resolve: {
|
|
63
|
+
alias: [
|
|
64
|
+
{
|
|
65
|
+
find: /@guiexpert\/table/,
|
|
66
|
+
replacement: join(__dirname, '..', 'table', 'src'),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
}
|
|
70
|
+
});
|