@guiexpert/vue3-table 3.0.2 → 3.0.4

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.
@@ -1,4 +1,4 @@
1
- import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from '../../../table/src/index.ts';
1
+ import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from '../../../table/src';
2
2
  import { AppContext } from "@vue/runtime-core";
3
3
  export declare class ComponentRendererWrapper implements CellRendererIf {
4
4
  private readonly component;
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<{
16
16
  };
17
17
  }, {
18
18
  root: import("vue").Ref<null>;
19
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("tableReady" | "mouseClicked" | "mouseDragging" | "checkboxChanged" | "contextmenu" | "modelChanged" | "focusChanged" | "selectionChanged" | "mouseDraggingEnd" | "mouseMoved")[], "tableReady" | "mouseClicked" | "mouseDragging" | "checkboxChanged" | "contextmenu" | "modelChanged" | "focusChanged" | "selectionChanged" | "mouseDraggingEnd" | "mouseMoved", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("tableReady" | "mouseClicked" | "mouseDragging" | "checkboxChanged" | "contextmenu" | "modelChanged" | "focusChanged" | "selectionChanged" | "mouseDraggingEnd" | "mouseMoved")[], "tableReady" | "mouseClicked" | "mouseDragging" | "checkboxChanged" | "contextmenu" | "modelChanged" | "focusChanged" | "selectionChanged" | "mouseDraggingEnd" | "mouseMoved", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
20
  tableModel: {
21
21
  required: true;
22
22
  };
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@guiexpert/vue3-table",
3
+ "version": "3.0.4",
4
+ "type": "commonjs",
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
+ "vue": "^3.2.47",
26
+ "vue-i18n": "^9.2.2",
27
+ "vue-router": "^4.1.6"
28
+ },
29
+ "devDependencies": {
30
+ "@cypress/vue": "^5.0.4",
31
+ "@intlify/eslint-plugin-vue-i18n": "^2.0.0",
32
+ "@vitejs/plugin-vue": "^4.4.1",
33
+ "@vue/eslint-config-typescript": "^12.0.0",
34
+ "@vue/test-utils": "^2.4.1",
35
+ "eslint-plugin-vue": "^9.18.1",
36
+ "unplugin-vue-components": "^0.24.0",
37
+ "vue-eslint-parser": "^9.1.0",
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/jest.config.ts ADDED
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ displayName: "vue3-table",
3
+ globals: {
4
+ "vue-jest": {
5
+ tsConfig: "./libs/vue3-table/tsconfig.spec.json"
6
+ }
7
+ },
8
+ transform: {
9
+ "^.+\\.vue$": "@vue/vue3-jest",
10
+ "^.+\\.jsx$": "babel-jest",
11
+ "^.+\\.tsx?$": "ts-jest"
12
+ },
13
+ testEnvironmentOptions: {
14
+ customExportConditions: ["node", "node-addons"]
15
+ },
16
+ testEnvironment: "jsdom",
17
+ moduleFileExtensions: ["ts", "tsx", "js", "jsx", "vue"],
18
+ testTimeout: 10000
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/vue3-table",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "type": "commonjs",
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
- "npm-pub:vue3-table": "npm publish --access public"
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
+ "vue": "^3.2.47",
26
+ "vue-i18n": "^9.2.2",
27
+ "vue-router": "^4.1.6"
28
+ },
29
+ "devDependencies": {
30
+ "@cypress/vue": "^5.0.4",
31
+ "@intlify/eslint-plugin-vue-i18n": "^2.0.0",
32
+ "@vitejs/plugin-vue": "^4.4.1",
33
+ "@vue/eslint-config-typescript": "^12.0.0",
34
+ "@vue/test-utils": "^2.4.1",
35
+ "eslint-plugin-vue": "^9.18.1",
36
+ "unplugin-vue-components": "^0.24.0",
37
+ "vue-eslint-parser": "^9.1.0",
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,17 @@
1
+ // import fs from 'fs';
2
+ const fs = require('fs');
3
+
4
+ const packageJsonPath = 'package.json';
5
+
6
+ try {
7
+ const pack = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
8
+ const currentVersion = pack.version;
9
+ const [major, minor, patch] = currentVersion.split('.').map(Number);
10
+ const newPatchVersion = `${major}.${minor}.${patch + 1}`;
11
+ pack.version = newPatchVersion;
12
+ fs.writeFileSync(packageJsonPath, JSON.stringify(pack, null, 2));
13
+ console.log(`${pack.name} -> version patched to ${newPatchVersion}.`);
14
+
15
+ } catch (error) {
16
+ console.error('Error:', error);
17
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ plugins: []
3
+ };
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { default as GuiexpertTable } from "./lib/GuiexpertTable.vue";
2
+ export { ComponentRendererWrapper } from "./lib/ComponentRendererWrapper";
3
+ export { default } from "./lib/GuiexpertTablePlugin";
@@ -0,0 +1,61 @@
1
+ import { AreaIdent, AreaModelIf, CellRendererIf, DomServiceIf, RendererCleanupFnType } from "@guiexpert/table";
2
+ import { createVNode, render } from "vue";
3
+ import { AppContext, VNode, VNodeProps } from "@vue/runtime-core";
4
+
5
+ declare type Data = Record<string, unknown>;
6
+
7
+ export class ComponentRendererWrapper implements CellRendererIf {
8
+
9
+ constructor(
10
+ private readonly component: any,
11
+ private readonly appContext: AppContext | null
12
+ ) {
13
+ }
14
+
15
+ render(
16
+ cellDiv: HTMLDivElement,
17
+ rowIndex: number,
18
+ columnIndex: number,
19
+ areaIdent: AreaIdent,
20
+ areaModel: AreaModelIf,
21
+ cellValue: any,
22
+ _domService: DomServiceIf): RendererCleanupFnType | undefined {
23
+
24
+ const cleanupFn = this.mount(
25
+ this.component,
26
+ {
27
+ cellDiv,
28
+ rowIndex,
29
+ columnIndex,
30
+ areaIdent,
31
+ areaModel,
32
+ cellValue
33
+ },
34
+ this.appContext,
35
+ cellDiv
36
+ );
37
+ return cleanupFn;
38
+ }
39
+
40
+
41
+ private mount(
42
+ component: any,
43
+ props: (Data & VNodeProps) | null,
44
+ appContext: AppContext | null,
45
+ cellDiv: HTMLDivElement
46
+ ) {
47
+ let vNode: VNode = createVNode(component, props);
48
+
49
+ vNode.appContext = appContext;
50
+ render(vNode, cellDiv);
51
+
52
+ const cleanupFn = () => {
53
+ if (cellDiv) {
54
+ render(null, cellDiv);
55
+ }
56
+ };
57
+
58
+ return cleanupFn;
59
+ }
60
+
61
+ }
@@ -0,0 +1,9 @@
1
+ import { mount } from "@vue/test-utils";
2
+ import { expect, test } from "vitest";
3
+ import GuiexpertTable from "./GuiexpertTable.vue";
4
+
5
+ test("shows text", () => {
6
+ expect(GuiexpertTable).toBeTruthy();
7
+ const wrapper = mount(GuiexpertTable);
8
+ expect(wrapper.text()).toContain("GuiexpertTable");
9
+ });
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ class="container-div"
5
+ style="width: 100%; height: 100%; background-color: transparent; padding: 0; margin: 0">
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import {
11
+ FocusModelIf,
12
+ GeModelChangeEvent,
13
+ GeMouseEvent,
14
+ LicenseManager, SelectionModelIf,
15
+ SimpleDomService,
16
+ TableOptions,
17
+ TableScope
18
+ } from '@guiexpert/table';
19
+ import { defineComponent, onMounted, ref } from "vue";
20
+
21
+
22
+ export default defineComponent({
23
+ inheritAttrs: false,
24
+ props: {
25
+ tableModel: {
26
+ required: true
27
+ },
28
+ tableOptions: {
29
+ required: false,
30
+ default: new TableOptions()
31
+ },
32
+ debounceMouseClickDelay: {
33
+ required: false,
34
+ default: 150
35
+ },
36
+ licenseKey: {
37
+ default: '',
38
+ required: false
39
+ }
40
+ },
41
+ emits: [
42
+ "tableReady",
43
+ "mouseClicked",
44
+ "mouseDragging",
45
+ "checkboxChanged",
46
+ "contextmenu",
47
+ "modelChanged",
48
+ "focusChanged",
49
+ "selectionChanged",
50
+ "mouseDraggingEnd",
51
+ "mouseMoved"
52
+ ],
53
+
54
+ setup(props, { emit }) {
55
+ const root = ref(null);
56
+
57
+ const initTable = (ele: HTMLDivElement) => {
58
+
59
+ const listener = {
60
+
61
+ onSelectionChanged: (evt: SelectionModelIf) => {
62
+ emit("selectionChanged", evt);
63
+ },
64
+
65
+ onFocusChanged: (evt: FocusModelIf) => {
66
+ emit("focusChanged", evt);
67
+ },
68
+
69
+ onCheckboxChanged: (evt: any[]) => {
70
+ emit("checkboxChanged", evt);
71
+ },
72
+
73
+ onContextmenu: (evt: GeMouseEvent) => {
74
+ emit("contextmenu", evt);
75
+ },
76
+
77
+ onModelChanged: (evt: GeModelChangeEvent) => {
78
+ emit("modelChanged", evt);
79
+ },
80
+
81
+ onMouseClicked: (evt: GeMouseEvent) => {
82
+ emit("mouseClicked", evt);
83
+ },
84
+
85
+ onMouseDragging: (evt: GeMouseEvent) => {
86
+ emit("mouseDragging", evt);
87
+ },
88
+
89
+ onMouseDraggingEnd: (evt: GeMouseEvent) => {
90
+ emit("mouseDraggingEnd", evt);
91
+ },
92
+
93
+ onMouseMoved: (evt: GeMouseEvent) => {
94
+ emit("mouseMoved", evt);
95
+ }
96
+ };
97
+
98
+ const tableScope = new TableScope(
99
+ ele, props.tableModel, new SimpleDomService(), props.tableOptions, listener
100
+ );
101
+ tableScope.firstInit();
102
+ emit("tableReady", tableScope.getApi());
103
+ };
104
+
105
+
106
+ onMounted(() => {
107
+ if (root.value) {
108
+ initTable(root.value as HTMLDivElement);
109
+ }
110
+ });
111
+
112
+ if (props.licenseKey) LicenseManager.getInstance().setLicenseKey(props.licenseKey);
113
+
114
+ return {
115
+ root
116
+ };
117
+ }
118
+ });
119
+
120
+ </script>
121
+
122
+ <style >
123
+ @import "../../../table/css/main.css";
124
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { App } from "vue";
2
+ import {GuiexpertTable} from "../";
3
+
4
+ export default {
5
+ install: (app: App, options: { img: string } = { img: "" }) => {
6
+ app.component("GuiexpertTable", GuiexpertTable);
7
+ },
8
+ };
9
+
10
+ export { GuiexpertTable };
@@ -0,0 +1,15 @@
1
+ declare module "*.vue" {
2
+ import type { DefineComponent } from "vue";
3
+ import { TableModelIf } from "../../table/src";
4
+
5
+ import { TableModelIf, TableOptions } from "@guiexpert/table";
6
+
7
+ // eslint-disable-next-line
8
+ const component: DefineComponent<{
9
+ props: {
10
+ tableModel: TableModelIf,
11
+ tableOptions: TableOptions
12
+ },
13
+ }, {}, any>;
14
+ export default component;
15
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ // Enables stricter inference for data properties on `this`
5
+ "strict": true,
6
+ "allowJs": true,
7
+ "jsx": "preserve",
8
+ "esModuleInterop": true,
9
+ "allowSyntheticDefaultImports": true,
10
+ "target": "ESNext",
11
+ "paths": {
12
+ "@assets/*": [
13
+ "./src/assets/*"
14
+ ],
15
+ "@lib/*": [
16
+ "./src/lib/*",
17
+ "../../table/src/*"
18
+ ]
19
+ }
20
+ },
21
+ "references": [
22
+ {
23
+ "path": "./tsconfig.lib.json"
24
+ },
25
+ {
26
+ "path": "./tsconfig.spec.json"
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "types": [
6
+ "vue-i18n",
7
+ "node"
8
+ ],
9
+ "composite": true
10
+ },
11
+ "exclude": [
12
+ "**/*.spec.js",
13
+ "**/*.spec.jsx",
14
+ "**/*.spec.ts",
15
+ "**/*.spec.tsx"
16
+ ],
17
+ "include": [
18
+ "**/*.js",
19
+ "**/*.jsx",
20
+ "**/*.ts",
21
+ "**/*.tsx",
22
+ "**/*.vue",
23
+ "**/*.json"
24
+ ]
25
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": [
7
+ "vue-i18n",
8
+ "jest",
9
+ "node"
10
+ ],
11
+ "composite": true
12
+ },
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.spec.tsx",
16
+ "**/*.vue",
17
+ "**/*.d.ts",
18
+ "**/*.ts"
19
+ ]
20
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,62 @@
1
+ import { join } from "path";
2
+ import { defineConfig } from "vite";
3
+ import Vue from "@vitejs/plugin-vue";
4
+ import Components from "unplugin-vue-components/vite";
5
+ import {viteStaticCopy} from "vite-plugin-static-copy";
6
+ import dts from "vite-plugin-dts";
7
+
8
+ export default defineConfig({
9
+ assetsInclude: /\.(pdf|jpg|png|svg)$/,
10
+
11
+ resolve: {
12
+ alias: [
13
+ {
14
+ find: /@guiexpert\/table/,
15
+ replacement: join(__dirname, '..', 'table', 'src'),
16
+ },
17
+ ],
18
+ },
19
+
20
+ plugins: [
21
+ dts({
22
+ entryRoot: "src",
23
+ tsconfigPath: join(__dirname, "tsconfig.lib.json"),
24
+ }),
25
+ Vue(),
26
+ Components({
27
+ dirs: ["src/lib"]
28
+ }),
29
+ viteStaticCopy({
30
+ targets: [
31
+ {
32
+ src: 'README.md',
33
+ dest: './'
34
+ },
35
+ {
36
+ src: 'package.json',
37
+ dest: './'
38
+ }
39
+ ]
40
+ })
41
+ ],
42
+ build: {
43
+ lib: {
44
+ entry: join(__dirname, "./src/index.ts"),
45
+ name: "vue3-table",
46
+ fileName: (format) => (format === "es" ? "index.js" : "index.cjs"),
47
+ // Change this to the formats you want to support.
48
+ // Don't forget to update your package.json as well.
49
+ formats: ['es', 'cjs'],
50
+ },
51
+ rollupOptions: {
52
+ // externalize deps that shouldn't be bundled
53
+ external: ["vue"],
54
+ output: {
55
+ // globals to use in the UMD build for externalized deps
56
+ globals: {
57
+ vue: "Vue"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ });