@revolist/vue-datagrid 3.1.2 → 3.2.0
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/.webpack/webpack.config.js +1 -0
- package/.webpack/webpack.dev.js +2 -2
- package/dist/component.d.ts +12 -0
- package/dist/vgrid.d.ts +10 -0
- package/dist/vgrid.js +1 -0
- package/dist/vue-editor-adapter.d.ts +17 -0
- package/dist/vue-editor.d.ts +5 -0
- package/dist/vue-template.d.ts +4 -0
- package/package.json +18 -19
- package/public/index.ts +0 -2
- package/src/component.tsx +64 -57
- package/src/shims-tsx.d.ts +11 -2
- package/src/shims-vue.d.ts +4 -0
- package/.eslintrc.json +0 -30
- package/public/style.css +0 -0
package/.webpack/webpack.dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
3
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
4
|
-
const VueLoaderPlugin = require('vue-loader
|
|
4
|
+
const VueLoaderPlugin = require('vue-loader');
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
mode: 'development',
|
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
|
26
26
|
appMountId: 'app',
|
|
27
27
|
"exJs": [], // [ "dist/vgrid.js"],
|
|
28
28
|
}),
|
|
29
|
-
new VueLoaderPlugin(),
|
|
29
|
+
new VueLoaderPlugin.VueLoaderPlugin(),
|
|
30
30
|
],
|
|
31
31
|
resolve: {
|
|
32
32
|
extensions: [ '.tsx', '.ts', '.js', '.vue' ],
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Vue, { CreateElement } from "vue";
|
|
2
|
+
declare type WatchFunction = (this: Vue, newVal: any, oldVal: any) => void;
|
|
3
|
+
declare type WatchResult = {
|
|
4
|
+
[prop: string]: WatchFunction;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: {
|
|
7
|
+
name: string;
|
|
8
|
+
props: string[];
|
|
9
|
+
watch: WatchResult;
|
|
10
|
+
render(this: Vue, h: CreateElement): JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
package/dist/vgrid.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AsyncComponent } from "vue/types/options";
|
|
2
|
+
export declare const VGrid: AsyncComponent;
|
|
3
|
+
declare function install(Vue: any): void;
|
|
4
|
+
export declare const VGridPlugin: {
|
|
5
|
+
install: typeof install;
|
|
6
|
+
};
|
|
7
|
+
export declare const VGridVueTemplate: (cntr: import("vue").VueConstructor<import("vue").default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => import("vue").default<Record<string, any>, Record<string, any>, never, never, any>>>, customProps?: any) => (h: Function, p: any) => JSX.Element;
|
|
8
|
+
export declare const VGridVueTemplateConstructor: (vueConstructor: import("vue").VueConstructor<import("vue").default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => import("vue").default<Record<string, any>, Record<string, any>, never, never, any>>>, e: HTMLElement, p: Record<string, any>) => import("vue").default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => import("vue").default<Record<string, any>, Record<string, any>, never, never, any>> | null | undefined;
|
|
9
|
+
export declare const VGridVueEditor: (vueConstructor: import("vue/types/umd").VueConstructor<import("vue/types/umd")>) => (column: import("@revolist/revogrid/dist/types/interfaces").RevoGrid.ColumnDataSchemaModel, save: Function, close: Function) => import("./vue-editor-adapter").default;
|
|
10
|
+
export default VGrid;
|
package/dist/vgrid.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("@revolist/revogrid/custom-element"),require("vue")):"function"==typeof define&&define.amd?define("VGrid",["@revolist/revogrid/custom-element","vue"],r):"object"==typeof exports?exports.VGrid=r(require("@revolist/revogrid/custom-element"),require("vue")):e.VGrid=r(e["@revolist/revogrid/custom-element"],e.vue)}(self,((e,r)=>(()=>{"use strict";var t={239:r=>{r.exports=e},748:e=>{e.exports=r}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{VGrid:()=>m,VGridPlugin:()=>g,VGridVueEditor:()=>j,VGridVueTemplate:()=>b,VGridVueTemplateConstructor:()=>w,default:()=>C});var e=o(239),r=function(){return r=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},r.apply(this,arguments)},t=["rowHeaders","frameSize","rowSize","colSize","range","readonly","resize","canFocus","useClipboard","columns","source","pinnedTopSource","pinnedBottomSource","rowDefinitions","editors","plugins","columnTypes","theme","rowClass","autoSizeColumn","filter","canMoveColumns","trimmedRows","exporting","grouping","stretch"],n={},u=[];t.forEach((function(e){var r=e;n[r]=e,u.push(r),r=e.toLowerCase(),n[r]=e,u.push(r),r=e.split(/(?=[A-Z])/).join("-"),n[r]=e,u.push(r)}));var s=t.reduce((function(e,r){return e[r]=function(e){this.$refs.grid[r]=e},e}),{});const l={name:"vue-data-grid",props:u,watch:s,render:function(e){var t={};for(var n in this.$props)t[n]=this.$props[n];return e("revo-grid",{ref:"grid",domProps:t,on:r({},this.$listeners)})}};var c=o(748),a=o.n(c),d=function(){return d=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},d.apply(this,arguments)},p=function(e,r,t){if(!r)return null;var n;if((null==r?void 0:r.childNodes.length)&&(n=r.childNodes[0]),!n)return n=document.createElement("span"),r.appendChild(n),"object"==typeof e&&(e=a().extend(e)),new e({el:n,propsData:t});var o=n.__vue__;if(o)for(var i in t)o.$props[i]=t[i];return o};var f=function(){return f=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},f.apply(this,arguments)};const v=function(){function e(e,r,t,n){this.VueEditorConstructor=e,this.column=r,this.save=t,this.close=n,this.element=null,this.editCell=null}return e.prototype.componentDidRender=function(){},e.prototype.disconnectedCallback=function(){var e;null===(e=this.vueEl)||void 0===e||e.$destroy(),this.vueEl=void 0},e.prototype.render=function(e){var r=this;return e("span",{ref:function(e){return r.renderAdapter(e)}})},e.prototype.renderAdapter=function(e){if(e){var r=p(this.VueEditorConstructor,e,f(f({},this.editCell),{save:this.save,close:this.close}));r&&(this.vueEl=r)}},e}();var h=!1,m=function(r){!h&&(null==e?void 0:e.defineCustomElements)&&(null==e||e.defineCustomElements(),h=!0),r(l)},y=!1,g={install:function(e){y||(y=!0,e.component("vue-data-grid",m))}},b=function(e,r){return function(t,n){var o=r?d(d({},r),n):n;return t("span",{ref:function(r){return p(e,r,o)}})}},w=p,j=function(e){return function(r,t,n){return new v(e,r,t,n)}},V=null;"undefined"!=typeof window?V=window.Vue:void 0!==o.g&&(V=o.g.Vue),V&&V.use(g);const C=m})(),i})()));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Edition, RevoGrid } from '@revolist/revogrid/dist/types/interfaces';
|
|
2
|
+
import { VNode } from '@revolist/revogrid/dist/types/stencil-public-runtime';
|
|
3
|
+
import { VueConstructor } from 'vue/types/umd';
|
|
4
|
+
export default class VueEditorAdapter {
|
|
5
|
+
private VueEditorConstructor;
|
|
6
|
+
column: RevoGrid.ColumnDataSchemaModel;
|
|
7
|
+
private save;
|
|
8
|
+
private close;
|
|
9
|
+
element: Element | null;
|
|
10
|
+
editCell: Edition.EditCell | null;
|
|
11
|
+
private vueEl;
|
|
12
|
+
constructor(VueEditorConstructor: VueConstructor, column: RevoGrid.ColumnDataSchemaModel, save: Function, close: Function);
|
|
13
|
+
componentDidRender(): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
render(h: RevoGrid.HyperFunc<VNode>): JSX.Element;
|
|
16
|
+
private renderAdapter;
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RevoGrid } from '@revolist/revogrid/dist/types/interfaces';
|
|
2
|
+
import { VueConstructor } from 'vue/types/umd';
|
|
3
|
+
import VueEditorAdapter from './vue-editor-adapter';
|
|
4
|
+
declare const vueEditor: (vueConstructor: VueConstructor) => (column: RevoGrid.ColumnDataSchemaModel, save: Function, close: Function) => VueEditorAdapter;
|
|
5
|
+
export default vueEditor;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Vue, { VueConstructor } from 'vue';
|
|
2
|
+
export declare const vueTemplateConstructor: (vueConstructor: VueConstructor, e: HTMLElement, p: Record<string, any>) => Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>> | null | undefined;
|
|
3
|
+
declare const vueTemplate: (cntr: VueConstructor, customProps?: any) => (h: Function, p: any) => JSX.Element;
|
|
4
|
+
export default vueTemplate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolist/vue-datagrid",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Vue data grid spreadsheet",
|
|
5
5
|
"main": "dist/vgrid.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,25 +30,24 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/revolist/vue-datagrid#readme",
|
|
32
32
|
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@revolist/revogrid": "^3.2.0",
|
|
35
|
+
"@stencil/core": "^2.6.0"
|
|
36
|
+
},
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"sass": "^
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"typescript": "^4.0.3",
|
|
38
|
+
"@vue/compiler-sfc": "^3.2.37",
|
|
39
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
40
|
+
"html-webpack-plugin": "^5.5.0",
|
|
41
|
+
"sass": "^1.54.4",
|
|
42
|
+
"sass-loader": "^13.0.2",
|
|
43
|
+
"style-loader": "^3.3.1",
|
|
44
|
+
"ts-loader": "^9.3.1",
|
|
45
|
+
"typescript": "^4.7.4",
|
|
43
46
|
"vue": "^2.6.12",
|
|
44
|
-
"vue-loader": "^15.
|
|
45
|
-
"vue-
|
|
46
|
-
"webpack": "^5.
|
|
47
|
-
"webpack-cli": "^4.
|
|
48
|
-
"webpack-dev-server": "^
|
|
49
|
-
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"@revolist/revogrid": "^3.1.1",
|
|
52
|
-
"@stencil/core": "^2.6.0"
|
|
47
|
+
"vue-loader": "^15.10.0",
|
|
48
|
+
"vue-style-loader": "^4.1.3",
|
|
49
|
+
"webpack": "^5.74.0",
|
|
50
|
+
"webpack-cli": "^4.10.0",
|
|
51
|
+
"webpack-dev-server": "^4.10.0"
|
|
53
52
|
}
|
|
54
53
|
}
|
package/public/index.ts
CHANGED
package/src/component.tsx
CHANGED
|
@@ -1,75 +1,82 @@
|
|
|
1
|
-
import Vue, { CreateElement } from
|
|
2
|
-
import RevoGrid from
|
|
1
|
+
import Vue, { CreateElement } from "vue";
|
|
2
|
+
import RevoGrid from "@revolist/revogrid";
|
|
3
3
|
|
|
4
4
|
type Prop = keyof RevoGrid.Components.RevoGrid;
|
|
5
5
|
type Grid = RevoGrid.Components.RevoGrid;
|
|
6
6
|
type WatchFunction = (this: Vue, newVal: any, oldVal: any) => void;
|
|
7
|
-
type WatchResult = {[prop: string]: WatchFunction
|
|
7
|
+
type WatchResult = { [prop: string]: WatchFunction };
|
|
8
8
|
|
|
9
|
-
const props: Prop[]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
9
|
+
const props: Prop[] = [
|
|
10
|
+
"rowHeaders",
|
|
11
|
+
"frameSize",
|
|
12
|
+
"rowSize",
|
|
13
|
+
"colSize",
|
|
14
|
+
"range",
|
|
15
|
+
"readonly",
|
|
16
|
+
"resize",
|
|
17
|
+
"canFocus",
|
|
18
|
+
"useClipboard",
|
|
19
|
+
"columns",
|
|
20
|
+
"source",
|
|
21
|
+
"pinnedTopSource",
|
|
22
|
+
"pinnedBottomSource",
|
|
23
|
+
"rowDefinitions",
|
|
24
|
+
"editors",
|
|
25
|
+
"plugins",
|
|
26
|
+
"columnTypes",
|
|
27
|
+
"theme",
|
|
28
|
+
"rowClass",
|
|
29
|
+
"autoSizeColumn",
|
|
30
|
+
"filter",
|
|
31
|
+
"canMoveColumns",
|
|
32
|
+
"trimmedRows",
|
|
33
|
+
"exporting",
|
|
34
|
+
"grouping",
|
|
35
|
+
"stretch",
|
|
35
36
|
];
|
|
36
37
|
|
|
37
38
|
const propsKeys: Record<string, any> = {};
|
|
38
39
|
const propsExtended: string[] = [];
|
|
39
|
-
props.forEach(prop => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
props.forEach((prop) => {
|
|
41
|
+
let p: string = prop;
|
|
42
|
+
propsKeys[p] = prop; // regular
|
|
43
|
+
propsExtended.push(p);
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
p = prop.toLowerCase();
|
|
46
|
+
propsKeys[p] = prop; // lower cased
|
|
47
|
+
propsExtended.push(p);
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
p = prop.split(/(?=[A-Z])/).join("-");
|
|
50
|
+
propsKeys[p] = prop; // kebab
|
|
51
|
+
propsExtended.push(p);
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
const watch = props.reduce((res: WatchResult, p: Prop) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const watchFunc = function (this: Vue, newVal: any) {
|
|
56
|
+
const grid = this.$refs.grid as unknown as Grid;
|
|
57
|
+
grid[p] = newVal as never;
|
|
58
|
+
};
|
|
59
|
+
res[p] = watchFunc;
|
|
60
|
+
return res;
|
|
60
61
|
}, {});
|
|
61
62
|
|
|
62
63
|
export default {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
name: "vue-data-grid",
|
|
65
|
+
props: propsExtended,
|
|
66
|
+
watch,
|
|
67
|
+
render(this: Vue, h: CreateElement) {
|
|
68
|
+
const domProps: Record<string, any> = {};
|
|
69
|
+
for (const key in this.$props) {
|
|
70
|
+
domProps[key] = this.$props[key];
|
|
71
|
+
}
|
|
72
|
+
return (
|
|
73
|
+
<revo-grid
|
|
74
|
+
ref="grid"
|
|
75
|
+
domProps={domProps}
|
|
76
|
+
on={{
|
|
77
|
+
...this.$listeners,
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
},
|
|
75
82
|
};
|
package/src/shims-tsx.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
VNode,
|
|
3
|
+
JSXBase,
|
|
4
|
+
} from '@revolist/revogrid/dist/types/stencil-public-runtime';
|
|
2
5
|
|
|
3
6
|
declare global {
|
|
4
7
|
namespace JSX {
|
|
@@ -6,7 +9,13 @@ declare global {
|
|
|
6
9
|
interface Element extends VNode {}
|
|
7
10
|
// tslint:disable no-empty-interface
|
|
8
11
|
interface ElementClass extends Vue {}
|
|
9
|
-
|
|
12
|
+
|
|
13
|
+
type NativeElements = {
|
|
14
|
+
[K in keyof IntrinsicElementAttributes]: JSXBase.DOMAttributes<
|
|
15
|
+
IntrinsicElementAttributes[K]
|
|
16
|
+
>;
|
|
17
|
+
};
|
|
18
|
+
interface IntrinsicElements extends JSXBase.DOMAttributes {
|
|
10
19
|
[elem: string]: any;
|
|
11
20
|
}
|
|
12
21
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"commonjs": true,
|
|
5
|
-
"es6": true,
|
|
6
|
-
"node": true
|
|
7
|
-
},
|
|
8
|
-
"extends": "eslint:recommended",
|
|
9
|
-
"parserOptions": {
|
|
10
|
-
"sourceType": "module"
|
|
11
|
-
},
|
|
12
|
-
"rules": {
|
|
13
|
-
"indent": [
|
|
14
|
-
"error",
|
|
15
|
-
4
|
|
16
|
-
],
|
|
17
|
-
"linebreak-style": [
|
|
18
|
-
"error",
|
|
19
|
-
"unix"
|
|
20
|
-
],
|
|
21
|
-
"quotes": [
|
|
22
|
-
"error",
|
|
23
|
-
"single"
|
|
24
|
-
],
|
|
25
|
-
"semi": [
|
|
26
|
-
"error",
|
|
27
|
-
"always"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
package/public/style.css
DELETED
|
File without changes
|