@guiexpert/svelte-table 0.0.1 → 1.0.1

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 ADDED
@@ -0,0 +1,30 @@
1
+ module.exports = {
2
+ parser: "@typescript-eslint/parser",
3
+ plugins: ["svelte3", "@typescript-eslint"],
4
+ extends: ["../../.eslintrc.json"],
5
+ ignorePatterns: ["!**/*", "vitest.config.ts"],
6
+ overrides: [
7
+ {
8
+ files: ["*.ts", "*.js", "*.svelte"],
9
+ parserOptions: {
10
+ project: ["libs/svelte-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
+ files: ["*.svelte"],
24
+ processor: "svelte3/svelte3"
25
+ }
26
+ ],
27
+ settings: {
28
+ "svelte3/typescript": require("typescript")
29
+ }
30
+ };
@@ -0,0 +1,8 @@
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/svelte-table.iml" filepath="$PROJECT_DIR$/.idea/svelte-table.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
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 ADDED
@@ -0,0 +1,6 @@
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/README.md ADDED
@@ -0,0 +1,104 @@
1
+
2
+ # SvelteTable (GuiExpert Table)
3
+
4
+ This is the Svelte component of the GuiExpert Table Project.
5
+
6
+ ## Become a master at creating web applications with large tables
7
+
8
+ This is the UI-agnostic table component for your next web app. 😊
9
+
10
+ <img src="https://raw.githubusercontent.com/guiexperttable/table-website/main/src/assets/screens/heatmap.png" width="50%">
11
+
12
+ ### Features
13
+ - Handle large datasets easily
14
+ - Excellent performance for large tables by vertical and horizontal virtual scrolling
15
+ - Fully-featured (advanced sorting and filtering)
16
+ - Highly customizable data grid
17
+ - Outstanding performance
18
+ - No third-party dependencies
19
+ - UI-agnostic
20
+ - Column Interactions (resize, reorder)
21
+ - Sorting Rows
22
+ - Row, Column, and Range Selection
23
+ - Single and Multi Selection
24
+ - UI-agnostic
25
+ - Row and Column Spanning
26
+ - Fixed Columns (Left and Right)
27
+ - Tree table (Hierarchical View)
28
+ - Accessibility support: Keyboard Shortcuts
29
+ - Custom Filtering
30
+ - In-place Cell Editing
31
+ - Userdefined Key and Mouse Events
32
+ - Customizable Look & Feel (via CSS variables)
33
+ - Row sorting
34
+ - Column Reordering (Drag and Drop)
35
+ - State Persistence (Row Sorting, Column Order, Selection)
36
+ - Customizable Cell Contents via Renderer for Header, Body and Footer
37
+ - Full control over the HTML structure and style
38
+
39
+
40
+ ## Links
41
+
42
+ - [Demos](https://gui.expert/demos)
43
+ - [Documentation](https://gui.expert/doc)
44
+ - [API](https://gui.expert/api)
45
+
46
+ ## Get Started
47
+
48
+ Add the following two NPM packages to your existing Svelte project (run this in your project root directory):
49
+
50
+ ```
51
+ npm install --save @guiexpert/table @guiexpert/svelte-table
52
+ ```
53
+
54
+ Add SvelteTable component to a template:
55
+
56
+ ```
57
+ <SvelteTable
58
+ on:mouseClicked={handleMouseClicked}
59
+ on:tableReady={handleTableReady}
60
+ tableModel={tableModel}
61
+ tableOptions={tableOptions}
62
+ ></SvelteTable>
63
+ ```
64
+
65
+ Import the following classes in your component:
66
+ ```
67
+ <script lang="ts">
68
+
69
+ import { SvelteTable } from "@guiexpert/svelte-table";
70
+ import {
71
+ GeMouseEvent,
72
+ TableApi
73
+ TableModelFactory,
74
+ TableModelIf,
75
+ TableOptions,
76
+ TableOptionsIf
77
+ } from "@guiexpert/table";
78
+ ```
79
+
80
+
81
+ Add a tableModel property and a onTableReady method to the component:
82
+
83
+ ```
84
+ const tableModel: TableModelIf = TableModelFactory
85
+ .createByArrayOfArraysParams<any>(param: {
86
+ columnLabels: [
87
+ ['Header 1', 'Header 2']
88
+ ],
89
+ data: [
90
+ ['Text 1a', 'Text 2a'],
91
+ ['Text 1b', 'Text 2b'],
92
+ ]
93
+ };
94
+
95
+ function onTableReady(api: TableApi) {
96
+ console.info("onTableReady API:", api);
97
+ }
98
+ ```
99
+
100
+ There are numerous possibilities to create table models.
101
+ Please refer to the [Documentation](https://gui.expert/doc) for further information or the [Demo](https://gui.expert/demos) section for examples.
102
+
103
+
104
+
package/package.json CHANGED
@@ -1,5 +1,15 @@
1
1
  {
2
2
  "name": "@guiexpert/svelte-table",
3
- "version": "0.0.1",
4
- "type": "commonjs"
3
+ "version": "1.0.1",
4
+ "scripts": {
5
+ "publish": "npm publish"
6
+ },
7
+ "main": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./index.mjs",
12
+ "require": "./index.js"
13
+ }
14
+ }
5
15
  }
package/project.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@guiexpert/svelte-table",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/svelte-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/svelte-table/**/*.{ts,svelte,spec.ts}"
16
+ ]
17
+ }
18
+ },
19
+ "check": {
20
+ "executor": "nx:run-commands",
21
+ "options": {
22
+ "command": "svelte-check",
23
+ "cwd": "libs/svelte-table"
24
+ }
25
+ },
26
+ "test": {
27
+ "executor": "@nxext/vitest:vitest",
28
+ "options": {
29
+ "vitestConfig": "libs/svelte-table/vitest.config.ts"
30
+ }
31
+ }
32
+ }
33
+ }
@@ -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
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,59 @@
1
+ <script>
2
+ import { createEventDispatcher, onMount } from "svelte";
3
+ import { SimpleDomService, TableOptions, TableScope } from "@guiexpert/table";
4
+
5
+ export let tableModel;
6
+ export let tableOptions = new TableOptions();
7
+
8
+ let root;
9
+ const dispatch = createEventDispatcher();
10
+
11
+ onMount(() => {
12
+
13
+ const listener = {
14
+ onCheckboxChanged: (evt) => {
15
+ dispatch("checkboxChanged", evt);
16
+ },
17
+
18
+ onContextmenu: (evt) => {
19
+ dispatch("contextmenu", evt);
20
+ },
21
+
22
+ onModelChanged: (evt) => {
23
+ dispatch("modelChanged", evt);
24
+ },
25
+
26
+ onMouseClicked: (evt) => {
27
+ dispatch("mouseClicked", evt);
28
+ },
29
+
30
+ onMouseDragging: (evt) => {
31
+ dispatch("mouseDragging", evt);
32
+ },
33
+
34
+ onMouseDraggingEnd: (evt) => {
35
+ dispatch("mouseDraggingEnd", evt);
36
+ },
37
+
38
+ onMouseMoved: (evt) => {
39
+ dispatch("mouseMoved", evt);
40
+ }
41
+ };
42
+
43
+ const tableScope = new TableScope(
44
+ root, tableModel, new SimpleDomService(), tableOptions, listener
45
+ );
46
+ tableScope.firstInit();
47
+ dispatch("tableReady", tableScope.getApi());
48
+ });
49
+ </script>
50
+
51
+ <div
52
+ bind:this={root}
53
+ class="ge-table"
54
+ style="width: 100%; height: 100%; background-color: transparent; padding: 0; margin: 0">
55
+ </div>
56
+
57
+ <style>
58
+
59
+ </style>
@@ -1,2 +1,2 @@
1
- export { default as SvelteTable } from "./SvelteTable.svelte";
1
+ export { default as GuiexpertTable } from "./GuiexpertTable.svelte";
2
2
  export { ComponentRendererWrapper } from "./ComponentRendererWrapper";
@@ -0,0 +1,7 @@
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
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "moduleResolution": "node",
5
+ "target": "es2017",
6
+ /**
7
+ Svelte Preprocess cannot figure out whether you have a value or a type, so tell TypeScript
8
+ to enforce using `import type` instead of `import` for Types.
9
+ */
10
+ "importsNotUsedAsValues": "error",
11
+ "isolatedModules": true,
12
+ /**
13
+ To have warnings/errors of the Svelte compiler at the correct position,
14
+ enable source maps by default.
15
+ */
16
+ "sourceMap": true,
17
+ /** Requests the runtime types from the svelte modules by default. Needed for TS files or else you get errors. */
18
+ "types": [
19
+ "svelte"
20
+ ],
21
+ "strict": false,
22
+ "esModuleInterop": true,
23
+ "skipLibCheck": true,
24
+ "forceConsistentCasingInFileNames": true,
25
+ /** Needed for the vite-tsconfig-paths vite plugin. */
26
+ "checkJs": true
27
+ },
28
+ "files": [],
29
+ "include": [],
30
+ "references": [
31
+ {
32
+ "path": "./tsconfig.lib.json"
33
+ },
34
+ {
35
+ "path": "./tsconfig.spec.json"
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc"
5
+ },
6
+ "include": [
7
+ "src/**/*"
8
+ ],
9
+ "exclude": [
10
+ "**/*.spec.ts",
11
+ "**/*_spec.ts",
12
+ "public/*"
13
+ ]
14
+ }
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ import { mergeConfig } from "vite";
2
+ import { svelte } from "@sveltejs/vite-plugin-svelte";
3
+ import baseConfig from "../../vitest.config";
4
+
5
+ export default mergeConfig(baseConfig, {
6
+ plugins: [svelte({ hot: !process.env.VITEST })]
7
+ });
@@ -1,6 +0,0 @@
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
- }