@revolist/vue3-datagrid 3.2.1 → 3.2.5
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.dev.js +1 -1
- package/dist/revogrid.d.ts +46 -0
- package/dist/vgrid.d.ts +9 -0
- package/dist/vgrid.js +1 -1
- package/dist/vue-component-lib/utils.d.ts +20 -0
- package/dist/vue-editor-adapter.d.ts +16 -0
- package/dist/vue-editor.d.ts +4 -0
- package/dist/vue-template.d.ts +6 -0
- package/package.json +19 -18
- package/src/revogrid.ts +13 -13
- package/src/vue-component-lib/utils.ts +107 -46
- package/tsconfig.json +1 -1
package/.webpack/webpack.dev.js
CHANGED
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
|
33
33
|
extensions: [ '.tsx', '.ts', '.js', '.vue' ],
|
|
34
34
|
alias: {
|
|
35
35
|
'vue$': 'vue/dist/vue.esm-bundler.js',
|
|
36
|
-
'@revolist/vue-datagrid': path.resolve(__dirname, '../
|
|
36
|
+
'@revolist/vue-datagrid': path.resolve(__dirname, '../dist/vgrid')
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
module: {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { JSX } from '@revolist/revogrid';
|
|
2
|
+
export declare const RevoGrid: import("vue").DefineComponent<JSX.RevoGrid & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevoGrid & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
|
3
|
+
export declare const RevogrClipboard: import("vue").DefineComponent<JSX.RevogrClipboard & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrClipboard & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
|
4
|
+
export declare const RevogrData: import("vue").DefineComponent<JSX.RevogrData & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrData & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
5
|
+
rowSelectionStore?: any;
|
|
6
|
+
viewportRow?: any;
|
|
7
|
+
viewportCol?: any;
|
|
8
|
+
dimensionRow?: any;
|
|
9
|
+
colData?: any;
|
|
10
|
+
dataStore?: any;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const RevogrEdit: import("vue").DefineComponent<JSX.RevogrEdit & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrEdit & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
|
13
|
+
export declare const RevogrFilterPanel: import("vue").DefineComponent<JSX.RevogrFilterPanel & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrFilterPanel & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
|
14
|
+
export declare const RevogrFocus: import("vue").DefineComponent<JSX.RevogrFocus & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrFocus & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
15
|
+
dimensionRow?: any;
|
|
16
|
+
selectionStore?: any;
|
|
17
|
+
dimensionCol?: any;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const RevogrHeader: import("vue").DefineComponent<JSX.RevogrHeader & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrHeader & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
20
|
+
viewportCol?: any;
|
|
21
|
+
selectionStore?: any;
|
|
22
|
+
dimensionCol?: any;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const RevogrOrderEditor: import("vue").DefineComponent<JSX.RevogrOrderEditor & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrOrderEditor & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
25
|
+
dimensionRow?: any;
|
|
26
|
+
dataStore?: any;
|
|
27
|
+
dimensionCol?: any;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const RevogrOverlaySelection: import("vue").DefineComponent<JSX.RevogrOverlaySelection & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrOverlaySelection & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
30
|
+
dimensionRow?: any;
|
|
31
|
+
colData?: any;
|
|
32
|
+
dataStore?: any;
|
|
33
|
+
selectionStore?: any;
|
|
34
|
+
dimensionCol?: any;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const RevogrRowHeaders: import("vue").DefineComponent<JSX.RevogrRowHeaders & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrRowHeaders & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
|
37
|
+
export declare const RevogrScrollVirtual: import("vue").DefineComponent<JSX.RevogrScrollVirtual & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrScrollVirtual & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
38
|
+
viewportStore?: any;
|
|
39
|
+
dimensionStore?: any;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const RevogrTempRange: import("vue").DefineComponent<JSX.RevogrTempRange & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrTempRange & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {
|
|
42
|
+
dimensionRow?: any;
|
|
43
|
+
selectionStore?: any;
|
|
44
|
+
dimensionCol?: any;
|
|
45
|
+
}>;
|
|
46
|
+
export declare const RevogrViewportScroll: import("vue").DefineComponent<JSX.RevogrViewportScroll & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<JSX.RevogrViewportScroll & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
package/dist/vgrid.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { App } from "vue";
|
|
2
|
+
export declare const VGrid: import("vue").DefineComponent<import("@revolist/revogrid/dist/types/components").JSX.RevoGrid & import("./vue-component-lib/utils").InputProps<string | number | boolean>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("@revolist/revogrid/dist/types/components").JSX.RevoGrid & import("./vue-component-lib/utils").InputProps<string | number | boolean>>, {}>;
|
|
3
|
+
export declare const VGridPlugin: {
|
|
4
|
+
install(app: App): void;
|
|
5
|
+
};
|
|
6
|
+
export declare const VGridVueTemplate: (vueConstructor: any) => (h: import("@revolist/revogrid/dist/types/interfaces").RevoGrid.HyperFunc<import("@revolist/revogrid/dist/types/stencil-public-runtime").VNode>, p: import("@revolist/revogrid/dist/types/interfaces").RevoGrid.ColumnDataSchemaModel) => JSX.Element;
|
|
7
|
+
export declare const VGridVueTemplateConstructor: (vueConstructor: import("vue").DefineComponent<{}, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>, e: HTMLElement, p: Record<string, any>) => any;
|
|
8
|
+
export declare const VGridVueEditor: (vueConstructor: any) => (column: import("@revolist/revogrid/dist/types/interfaces").RevoGrid.ColumnDataSchemaModel, save: Function, close: Function) => import("./vue-editor-adapter").default;
|
|
9
|
+
export default VGrid;
|
package/dist/vgrid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o(require("vue"),require("@revolist/revogrid/custom-element")):"function"==typeof define&&define.amd?define("VGrid",["vue","@revolist/revogrid/custom-element"],o):"object"==typeof exports?exports.VGrid=o(require("vue"),require("@revolist/revogrid/custom-element")):e.VGrid=o(e.vue,e["@revolist/revogrid/custom-element"])}(self,((e,o)=>(()=>{"use strict";var r={239:e=>{e.exports=o},748:o=>{o.exports=e}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var s=t[e]={exports:{}};return r[e](s,s.exports,n),s.exports}n.d=(e,o)=>{for(var r in o)n.o(o,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},n.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{n.r(s),n.d(s,{VGrid:()=>p,VGridPlugin:()=>m,VGridVueEditor:()=>h,VGridVueTemplate:()=>b,VGridVueTemplateConstructor:()=>g,default:()=>y});var e=n(748),o=n(239);const r="update:modelValue",t=Symbol(),i={default:t},l=e=>(null==e?void 0:e.split(" "))||[],a=(e,o,r=[])=>{var t;return[...Array.from((null===(t=e.value)||void 0===t?void 0:t.classList)||[]),...r].filter(((e,r,t)=>!o.has(e)&&t.indexOf(e)===r))},d=((o,n,s=[],d,u,c)=>{void 0!==n&&n();const f=(0,e.defineComponent)(((n,{attrs:s,slots:i,emit:f})=>{var p;let v=n[d];const m=(0,e.ref)(),b=new Set(l(s.class)),g=e=>{e.el&&(Array.isArray(u)?u:[u]).forEach((o=>{e.el.addEventListener(o.toLowerCase(),(e=>{v=(null==e?void 0:e.target)[d],f(r,v),c&&f(c,e)}))}))},h=(0,e.getCurrentInstance)(),y=(null===(p=null==h?void 0:h.appContext)||void 0===p?void 0:p.provides.navManager)?(0,e.inject)("navManager"):void 0;return()=>{v=n[d],l(s.class).forEach((e=>{b.add(e)}));const r=n.onClick;let c={ref:m,class:a(m,b),onClick:e=>{void 0!==r&&r(e),e.defaultPrevented||(e=>{const{routerLink:o}=n;if(o!==t)if(void 0!==y){let o={event:e};for(const e in n){const r=n[e];n.hasOwnProperty(e)&&e.startsWith("router")&&r!==t&&(o[e]=r)}y.navigate(o)}else console.warn("Tried to navigate, but no router was found. Make sure you have mounted Vue Router.")})(e)},onVnodeBeforeMount:u?g:void 0};for(const e in n){const o=n[e];n.hasOwnProperty(e)&&o!==t&&(c[e]=o)}return d&&(n.modelValue!==t?c=Object.assign(Object.assign({},c),{[d]:n.modelValue}):v!==t&&(c=Object.assign(Object.assign({},c),{[d]:v}))),(0,e.h)(o,c,i.default&&i.default())}}));return f.displayName=o,f.props={routerLink:i},s.forEach((e=>{f.props[e]=i})),d&&(f.props.modelValue=i,f.emits=[r,c]),f})("revo-grid",void 0,["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","beforeedit","beforerangeedit","afteredit","beforeautofill","beforeaange","roworderchanged","beforesourcesortingapply","beforesortingapply","beforesorting","rowdragstart","headerclick","beforecellfocus","beforefocuslost","beforesourceset","aftersourceset","beforecolumnsset","beforecolumnapplied","aftercolumnsset","beforefilterapply","beforefiltertrimmed","beforetrimmed","aftertrimmed","viewportscroll","beforeexport","beforeeditstart","aftercolumnresize"]),u=(o,r,t)=>{if(!r)return null;let n;(null==r?void 0:r.childNodes.length)&&(n=r.childNodes[0]),n||(n=document.createElement("span"),r.appendChild(n));let s=n._vnode;if(s)for(const e in t)s.component.props[e]=t[e];else{const r=(0,e.createVNode)(o,t);(0,e.render)(r,n)}return s};class c{constructor(e,o,r,t){this.VueEditorConstructor=e,this.column=o,this.save=r,this.close=t,this.element=null,this.editCell=null}componentDidRender(){}disconnectedCallback(){var e;null===(e=this.vueEl)||void 0===e||e.$destroy(),this.vueEl=void 0}render(e){return e("span",{ref:e=>{this.vueEl=u(this.VueEditorConstructor,e,Object.assign(Object.assign({},this.editCell),{column:this.column,save:this.save,close:this.close}))}})}}let f=!1;const p=(0,e.defineAsyncComponent)((()=>new Promise((e=>(!f&&o&&(o.defineCustomElements(),f=!0),e(d))))));let v=!1;const m={install(e){v||(v=!0,e.component("vue-data-grid",p))}},b=e=>(o,r)=>o("span",{ref:o=>u(e,o,r)}),g=u,h=e=>function(o,r,t){return new c(e,o,r,t)},y=p})(),s})()));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface InputProps<T> {
|
|
2
|
+
modelValue?: T;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Create a callback to define a Vue component wrapper around a Web Component.
|
|
6
|
+
*
|
|
7
|
+
* @prop name - The component tag name (i.e. `ion-button`)
|
|
8
|
+
* @prop componentProps - An array of properties on the
|
|
9
|
+
* component. These usually match up with the @Prop definitions
|
|
10
|
+
* in each component's TSX file.
|
|
11
|
+
* @prop customElement - An option custom element instance to pass
|
|
12
|
+
* to customElements.define. Only set if `includeImportCustomElements: true` in your config.
|
|
13
|
+
* @prop modelProp - The prop that v-model binds to (i.e. value)
|
|
14
|
+
* @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)
|
|
15
|
+
* @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been
|
|
16
|
+
* correctly updated when a user's event callback fires.
|
|
17
|
+
*/
|
|
18
|
+
export declare const defineContainer: <Props, VModelType = string | number | boolean>(name: string, defineCustomElement: any, componentProps?: string[], modelProp?: string, modelUpdateEvent?: string, externalModelUpdateEvent?: string) => import("vue").DefineComponent<Props & InputProps<VModelType>, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<Props & InputProps<VModelType> extends infer T ? T extends Props & InputProps<VModelType> ? T extends import("vue").ComponentPropsOptions<{
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
}> ? import("vue").ExtractPropTypes<T> : T : never : never>, import("vue").ExtractDefaultPropTypes<Props & InputProps<VModelType>>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Edition, RevoGrid } from '@revolist/revogrid/dist/types/interfaces';
|
|
2
|
+
import { VNode } from '@revolist/revogrid/dist/types/stencil-public-runtime';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
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: DefineComponent, column: RevoGrid.ColumnDataSchemaModel, save: Function, close: Function);
|
|
13
|
+
componentDidRender(): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
render(h: RevoGrid.HyperFunc<VNode>): JSX.Element;
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RevoGrid } from "@revolist/revogrid/dist/types/interfaces";
|
|
2
|
+
import VueEditorAdapter from './vue-editor-adapter';
|
|
3
|
+
declare const vueEditor: (vueConstructor: any) => (column: RevoGrid.ColumnDataSchemaModel, save: Function, close: Function) => VueEditorAdapter;
|
|
4
|
+
export default vueEditor;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RevoGrid } from '@revolist/revogrid/dist/types/interfaces';
|
|
2
|
+
import { VNode } from '@revolist/revogrid/dist/types/stencil-public-runtime';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
export declare const vueTemplateConstructor: (vueConstructor: DefineComponent, e: HTMLElement | null, p: Record<string, any>) => any;
|
|
5
|
+
declare const vueTemplate: (vueConstructor: any) => (h: RevoGrid.HyperFunc<VNode>, p: RevoGrid.ColumnDataSchemaModel) => JSX.Element;
|
|
6
|
+
export default vueTemplate;
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolist/vue3-datagrid",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "Vue 3
|
|
3
|
+
"version": "3.2.5",
|
|
4
|
+
"description": "Vue 3 DataGrid Spreadsheet",
|
|
5
5
|
"main": "dist/vgrid.js",
|
|
6
|
+
"types": "dist/vgrid.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "webpack --config ./.webpack/webpack.config.js --mode production",
|
|
8
9
|
"serve": "webpack serve --config ./.webpack/webpack.dev.js"
|
|
@@ -33,24 +34,24 @@
|
|
|
33
34
|
"homepage": "https://github.com/revolist/vue3-datagrid#readme",
|
|
34
35
|
"license": "MIT",
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@revolist/revogrid": "^3.2.
|
|
37
|
-
"@stencil/core": "^2.
|
|
37
|
+
"@revolist/revogrid": "^3.2.6",
|
|
38
|
+
"@stencil/core": "^2.17.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@vue/compiler-sfc": "^3.
|
|
41
|
-
"clean-webpack-plugin": "^
|
|
42
|
-
"css-loader": "^
|
|
43
|
-
"html-webpack-plugin": "^
|
|
44
|
-
"sass": "^1.
|
|
41
|
+
"@vue/compiler-sfc": "^3.2.37",
|
|
42
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
43
|
+
"css-loader": "^6.7.1",
|
|
44
|
+
"html-webpack-plugin": "^5.5.0",
|
|
45
|
+
"sass": "^1.54.4",
|
|
45
46
|
"sass-loader": "^13.0.2",
|
|
46
|
-
"style-loader": "^
|
|
47
|
-
"ts-loader": "^
|
|
48
|
-
"typescript": "^4.
|
|
49
|
-
"vue": "^3.
|
|
50
|
-
"vue-loader": "^
|
|
51
|
-
"vue-style-loader": "^4.1.
|
|
52
|
-
"webpack": "^5.
|
|
53
|
-
"webpack-cli": "^4.
|
|
54
|
-
"webpack-dev-server": "^
|
|
47
|
+
"style-loader": "^3.3.1",
|
|
48
|
+
"ts-loader": "^9.3.1",
|
|
49
|
+
"typescript": "^4.7.4",
|
|
50
|
+
"vue": "^3.2.37",
|
|
51
|
+
"vue-loader": "^17.0.0",
|
|
52
|
+
"vue-style-loader": "^4.1.3",
|
|
53
|
+
"webpack": "^5.74.0",
|
|
54
|
+
"webpack-cli": "^4.10.0",
|
|
55
|
+
"webpack-dev-server": "^4.10.0"
|
|
55
56
|
}
|
|
56
57
|
}
|
package/src/revogrid.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { JSX } from '@revolist/revogrid';
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
export const RevoGrid = /*@__PURE__*/ defineContainer<JSX.RevoGrid>('revo-grid', [
|
|
11
|
+
export const RevoGrid = /*@__PURE__*/ defineContainer<JSX.RevoGrid>('revo-grid', undefined, [
|
|
12
12
|
'rowHeaders',
|
|
13
13
|
'frameSize',
|
|
14
14
|
'rowSize',
|
|
@@ -64,13 +64,13 @@ export const RevoGrid = /*@__PURE__*/ defineContainer<JSX.RevoGrid>('revo-grid',
|
|
|
64
64
|
]);
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
export const RevogrClipboard = /*@__PURE__*/ defineContainer<JSX.RevogrClipboard>('revogr-clipboard', [
|
|
67
|
+
export const RevogrClipboard = /*@__PURE__*/ defineContainer<JSX.RevogrClipboard>('revogr-clipboard', undefined, [
|
|
68
68
|
'copyRegion',
|
|
69
69
|
'pasteRegion'
|
|
70
70
|
]);
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
export const RevogrData = /*@__PURE__*/ defineContainer<JSX.RevogrData>('revogr-data', [
|
|
73
|
+
export const RevogrData = /*@__PURE__*/ defineContainer<JSX.RevogrData>('revogr-data', undefined, [
|
|
74
74
|
'readonly',
|
|
75
75
|
'range',
|
|
76
76
|
'canDrag',
|
|
@@ -85,7 +85,7 @@ export const RevogrData = /*@__PURE__*/ defineContainer<JSX.RevogrData>('revogr-
|
|
|
85
85
|
]);
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
export const RevogrEdit = /*@__PURE__*/ defineContainer<JSX.RevogrEdit>('revogr-edit', [
|
|
88
|
+
export const RevogrEdit = /*@__PURE__*/ defineContainer<JSX.RevogrEdit>('revogr-edit', undefined, [
|
|
89
89
|
'editCell',
|
|
90
90
|
'column',
|
|
91
91
|
'editor',
|
|
@@ -94,7 +94,7 @@ export const RevogrEdit = /*@__PURE__*/ defineContainer<JSX.RevogrEdit>('revogr-
|
|
|
94
94
|
]);
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
export const RevogrFilterPanel = /*@__PURE__*/ defineContainer<JSX.RevogrFilterPanel>('revogr-filter-panel', [
|
|
97
|
+
export const RevogrFilterPanel = /*@__PURE__*/ defineContainer<JSX.RevogrFilterPanel>('revogr-filter-panel', undefined, [
|
|
98
98
|
'uuid',
|
|
99
99
|
'filterItems',
|
|
100
100
|
'filterTypes',
|
|
@@ -106,14 +106,14 @@ export const RevogrFilterPanel = /*@__PURE__*/ defineContainer<JSX.RevogrFilterP
|
|
|
106
106
|
]);
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
export const RevogrFocus = /*@__PURE__*/ defineContainer<JSX.RevogrFocus>('revogr-focus', [
|
|
109
|
+
export const RevogrFocus = /*@__PURE__*/ defineContainer<JSX.RevogrFocus>('revogr-focus', undefined, [
|
|
110
110
|
'selectionStore',
|
|
111
111
|
'dimensionRow',
|
|
112
112
|
'dimensionCol'
|
|
113
113
|
]);
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
export const RevogrHeader = /*@__PURE__*/ defineContainer<JSX.RevogrHeader>('revogr-header', [
|
|
116
|
+
export const RevogrHeader = /*@__PURE__*/ defineContainer<JSX.RevogrHeader>('revogr-header', undefined, [
|
|
117
117
|
'viewportCol',
|
|
118
118
|
'dimensionCol',
|
|
119
119
|
'selectionStore',
|
|
@@ -129,7 +129,7 @@ export const RevogrHeader = /*@__PURE__*/ defineContainer<JSX.RevogrHeader>('rev
|
|
|
129
129
|
]);
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
export const RevogrOrderEditor = /*@__PURE__*/ defineContainer<JSX.RevogrOrderEditor>('revogr-order-editor', [
|
|
132
|
+
export const RevogrOrderEditor = /*@__PURE__*/ defineContainer<JSX.RevogrOrderEditor>('revogr-order-editor', undefined, [
|
|
133
133
|
'parent',
|
|
134
134
|
'dimensionRow',
|
|
135
135
|
'dimensionCol',
|
|
@@ -142,7 +142,7 @@ export const RevogrOrderEditor = /*@__PURE__*/ defineContainer<JSX.RevogrOrderEd
|
|
|
142
142
|
]);
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
export const RevogrOverlaySelection = /*@__PURE__*/ defineContainer<JSX.RevogrOverlaySelection>('revogr-overlay-selection', [
|
|
145
|
+
export const RevogrOverlaySelection = /*@__PURE__*/ defineContainer<JSX.RevogrOverlaySelection>('revogr-overlay-selection', undefined, [
|
|
146
146
|
'readonly',
|
|
147
147
|
'range',
|
|
148
148
|
'canDrag',
|
|
@@ -167,7 +167,7 @@ export const RevogrOverlaySelection = /*@__PURE__*/ defineContainer<JSX.RevogrOv
|
|
|
167
167
|
]);
|
|
168
168
|
|
|
169
169
|
|
|
170
|
-
export const RevogrRowHeaders = /*@__PURE__*/ defineContainer<JSX.RevogrRowHeaders>('revogr-row-headers', [
|
|
170
|
+
export const RevogrRowHeaders = /*@__PURE__*/ defineContainer<JSX.RevogrRowHeaders>('revogr-row-headers', undefined, [
|
|
171
171
|
'height',
|
|
172
172
|
'dataPorts',
|
|
173
173
|
'headerProp',
|
|
@@ -179,7 +179,7 @@ export const RevogrRowHeaders = /*@__PURE__*/ defineContainer<JSX.RevogrRowHeade
|
|
|
179
179
|
]);
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
export const RevogrScrollVirtual = /*@__PURE__*/ defineContainer<JSX.RevogrScrollVirtual>('revogr-scroll-virtual', [
|
|
182
|
+
export const RevogrScrollVirtual = /*@__PURE__*/ defineContainer<JSX.RevogrScrollVirtual>('revogr-scroll-virtual', undefined, [
|
|
183
183
|
'dimension',
|
|
184
184
|
'viewportStore',
|
|
185
185
|
'dimensionStore',
|
|
@@ -187,14 +187,14 @@ export const RevogrScrollVirtual = /*@__PURE__*/ defineContainer<JSX.RevogrScrol
|
|
|
187
187
|
]);
|
|
188
188
|
|
|
189
189
|
|
|
190
|
-
export const RevogrTempRange = /*@__PURE__*/ defineContainer<JSX.RevogrTempRange>('revogr-temp-range', [
|
|
190
|
+
export const RevogrTempRange = /*@__PURE__*/ defineContainer<JSX.RevogrTempRange>('revogr-temp-range', undefined, [
|
|
191
191
|
'selectionStore',
|
|
192
192
|
'dimensionRow',
|
|
193
193
|
'dimensionCol'
|
|
194
194
|
]);
|
|
195
195
|
|
|
196
196
|
|
|
197
|
-
export const RevogrViewportScroll = /*@__PURE__*/ defineContainer<JSX.RevogrViewportScroll>('revogr-viewport-scroll', [
|
|
197
|
+
export const RevogrViewportScroll = /*@__PURE__*/ defineContainer<JSX.RevogrViewportScroll>('revogr-viewport-scroll', undefined, [
|
|
198
198
|
'contentWidth',
|
|
199
199
|
'contentHeight',
|
|
200
200
|
'scrollViewport',
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { VNode, defineComponent, getCurrentInstance, h, inject, ref, Ref } from 'vue';
|
|
2
2
|
|
|
3
|
-
export interface InputProps
|
|
4
|
-
modelValue
|
|
3
|
+
export interface InputProps<T> {
|
|
4
|
+
modelValue?: T;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
const UPDATE_VALUE_EVENT = 'update:modelValue';
|
|
8
8
|
const MODEL_VALUE = 'modelValue';
|
|
9
9
|
const ROUTER_LINK_VALUE = 'routerLink';
|
|
10
10
|
const NAV_MANAGER = 'navManager';
|
|
11
|
-
const
|
|
11
|
+
const ROUTER_PROP_PREFIX = 'router';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Starting in Vue 3.1.0, all properties are
|
|
15
|
+
* added as keys to the props object, even if
|
|
16
|
+
* they are not being used. In order to correctly
|
|
17
|
+
* account for both value props and v-model props,
|
|
18
|
+
* we need to check if the key exists for Vue <3.1.0
|
|
19
|
+
* and then check if it is not undefined for Vue >= 3.1.0.
|
|
20
|
+
* See https://github.com/vuejs/vue-next/issues/3889
|
|
21
|
+
*/
|
|
22
|
+
const EMPTY_PROP = Symbol();
|
|
23
|
+
const DEFAULT_EMPTY_PROP = { default: EMPTY_PROP };
|
|
12
24
|
|
|
13
25
|
interface NavManager<T = any> {
|
|
14
26
|
navigate: (options: T) => void;
|
|
15
27
|
}
|
|
16
28
|
|
|
17
|
-
interface ComponentOptions {
|
|
18
|
-
modelProp?: string;
|
|
19
|
-
modelUpdateEvent?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
29
|
const getComponentClasses = (classes: unknown) => {
|
|
23
30
|
return (classes as string)?.split(' ') || [];
|
|
24
31
|
};
|
|
@@ -35,39 +42,56 @@ const getElementClasses = (ref: Ref<HTMLElement | undefined>, componentClasses:
|
|
|
35
42
|
* @prop componentProps - An array of properties on the
|
|
36
43
|
* component. These usually match up with the @Prop definitions
|
|
37
44
|
* in each component's TSX file.
|
|
38
|
-
* @prop
|
|
39
|
-
*
|
|
40
|
-
*
|
|
45
|
+
* @prop customElement - An option custom element instance to pass
|
|
46
|
+
* to customElements.define. Only set if `includeImportCustomElements: true` in your config.
|
|
47
|
+
* @prop modelProp - The prop that v-model binds to (i.e. value)
|
|
48
|
+
* @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)
|
|
49
|
+
* @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been
|
|
50
|
+
* correctly updated when a user's event callback fires.
|
|
41
51
|
*/
|
|
42
|
-
export const defineContainer = <Props
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
export const defineContainer = <Props, VModelType=string|number|boolean>(
|
|
53
|
+
name: string,
|
|
54
|
+
defineCustomElement: any,
|
|
55
|
+
componentProps: string[] = [],
|
|
56
|
+
modelProp?: string,
|
|
57
|
+
modelUpdateEvent?: string,
|
|
58
|
+
externalModelUpdateEvent?: string
|
|
59
|
+
) => {
|
|
45
60
|
/**
|
|
46
61
|
* Create a Vue component wrapper around a Web Component.
|
|
47
62
|
* Note: The `props` here are not all properties on a component.
|
|
48
63
|
* They refer to whatever properties are set on an instance of a component.
|
|
49
64
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
|
|
66
|
+
if (defineCustomElement !== undefined) {
|
|
67
|
+
defineCustomElement();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const Container = defineComponent<Props & InputProps<VModelType>>((props: any, { attrs, slots, emit }) => {
|
|
71
|
+
let modelPropValue = props[modelProp];
|
|
52
72
|
const containerRef = ref<HTMLElement>();
|
|
53
73
|
const classes = new Set(getComponentClasses(attrs.class));
|
|
54
74
|
const onVnodeBeforeMount = (vnode: VNode) => {
|
|
55
75
|
// Add a listener to tell Vue to update the v-model
|
|
56
76
|
if (vnode.el) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];
|
|
78
|
+
eventsNames.forEach((eventName: string) => {
|
|
79
|
+
vnode.el!.addEventListener(eventName.toLowerCase(), (e: Event) => {
|
|
80
|
+
modelPropValue = (e?.target as any)[modelProp];
|
|
81
|
+
emit(UPDATE_VALUE_EVENT, modelPropValue);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* We need to emit the change event here
|
|
85
|
+
* rather than on the web component to ensure
|
|
86
|
+
* that any v-model bindings have been updated.
|
|
87
|
+
* Otherwise, the developer will listen on the
|
|
88
|
+
* native web component, but the v-model will
|
|
89
|
+
* not have been updated yet.
|
|
90
|
+
*/
|
|
91
|
+
if (externalModelUpdateEvent) {
|
|
92
|
+
emit(externalModelUpdateEvent, e);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
71
95
|
});
|
|
72
96
|
}
|
|
73
97
|
};
|
|
@@ -76,16 +100,18 @@ export const defineContainer = <Props>(name: string, componentProps: string[] =
|
|
|
76
100
|
const hasRouter = currentInstance?.appContext?.provides[NAV_MANAGER];
|
|
77
101
|
const navManager: NavManager | undefined = hasRouter ? inject(NAV_MANAGER) : undefined;
|
|
78
102
|
const handleRouterLink = (ev: Event) => {
|
|
79
|
-
const { routerLink } = props
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
const routerProps = Object.keys(props).filter(p => p.startsWith(ROUTER_PROP_REFIX));
|
|
103
|
+
const { routerLink } = props;
|
|
104
|
+
if (routerLink === EMPTY_PROP) return;
|
|
83
105
|
|
|
84
106
|
if (navManager !== undefined) {
|
|
85
107
|
let navigationPayload: any = { event: ev };
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
for (const key in props) {
|
|
109
|
+
const value = props[key];
|
|
110
|
+
if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {
|
|
111
|
+
navigationPayload[key] = value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
89
115
|
navManager.navigate(navigationPayload);
|
|
90
116
|
} else {
|
|
91
117
|
console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');
|
|
@@ -93,11 +119,13 @@ export const defineContainer = <Props>(name: string, componentProps: string[] =
|
|
|
93
119
|
}
|
|
94
120
|
|
|
95
121
|
return () => {
|
|
122
|
+
modelPropValue = props[modelProp];
|
|
123
|
+
|
|
96
124
|
getComponentClasses(attrs.class).forEach(value => {
|
|
97
125
|
classes.add(value);
|
|
98
126
|
});
|
|
99
127
|
|
|
100
|
-
const oldClick =
|
|
128
|
+
const oldClick = props.onClick;
|
|
101
129
|
const handleClick = (ev: Event) => {
|
|
102
130
|
if (oldClick !== undefined) {
|
|
103
131
|
oldClick(ev);
|
|
@@ -107,18 +135,43 @@ export const defineContainer = <Props>(name: string, componentProps: string[] =
|
|
|
107
135
|
}
|
|
108
136
|
}
|
|
109
137
|
|
|
110
|
-
let propsToAdd = {
|
|
111
|
-
...props,
|
|
138
|
+
let propsToAdd: any = {
|
|
112
139
|
ref: containerRef,
|
|
113
140
|
class: getElementClasses(containerRef, classes),
|
|
114
141
|
onClick: handleClick,
|
|
115
142
|
onVnodeBeforeMount: (modelUpdateEvent) ? onVnodeBeforeMount : undefined
|
|
116
143
|
};
|
|
117
144
|
|
|
145
|
+
/**
|
|
146
|
+
* We can use Object.entries here
|
|
147
|
+
* to avoid the hasOwnProperty check,
|
|
148
|
+
* but that would require 2 iterations
|
|
149
|
+
* where as this only requires 1.
|
|
150
|
+
*/
|
|
151
|
+
for (const key in props) {
|
|
152
|
+
const value = props[key];
|
|
153
|
+
if (props.hasOwnProperty(key) && value !== EMPTY_PROP) {
|
|
154
|
+
propsToAdd[key] = value;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
118
158
|
if (modelProp) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
159
|
+
/**
|
|
160
|
+
* If form value property was set using v-model
|
|
161
|
+
* then we should use that value.
|
|
162
|
+
* Otherwise, check to see if form value property
|
|
163
|
+
* was set as a static value (i.e. no v-model).
|
|
164
|
+
*/
|
|
165
|
+
if (props[MODEL_VALUE] !== EMPTY_PROP) {
|
|
166
|
+
propsToAdd = {
|
|
167
|
+
...propsToAdd,
|
|
168
|
+
[modelProp]: props[MODEL_VALUE]
|
|
169
|
+
}
|
|
170
|
+
} else if (modelPropValue !== EMPTY_PROP) {
|
|
171
|
+
propsToAdd = {
|
|
172
|
+
...propsToAdd,
|
|
173
|
+
[modelProp]: modelPropValue
|
|
174
|
+
}
|
|
122
175
|
}
|
|
123
176
|
}
|
|
124
177
|
|
|
@@ -127,10 +180,18 @@ export const defineContainer = <Props>(name: string, componentProps: string[] =
|
|
|
127
180
|
});
|
|
128
181
|
|
|
129
182
|
Container.displayName = name;
|
|
130
|
-
|
|
183
|
+
|
|
184
|
+
Container.props = {
|
|
185
|
+
[ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
componentProps.forEach(componentProp => {
|
|
189
|
+
Container.props[componentProp] = DEFAULT_EMPTY_PROP;
|
|
190
|
+
});
|
|
191
|
+
|
|
131
192
|
if (modelProp) {
|
|
132
|
-
Container.props
|
|
133
|
-
Container.emits = [UPDATE_VALUE_EVENT,
|
|
193
|
+
Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;
|
|
194
|
+
Container.emits = [UPDATE_VALUE_EVENT, externalModelUpdateEvent];
|
|
134
195
|
}
|
|
135
196
|
|
|
136
197
|
return Container;
|