realgrid-vue2 0.9.6 → 0.9.8

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/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("realgrid"),r=require("vue");function f(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const m=f(w),C=t=>t.replace(/-./g,e=>e[1].toUpperCase()),$=t=>t.charAt(0).toUpperCase()+t.slice(1),s=(t,e="")=>{const n={};for(let i in t)n[C(e?`${e}-${i}`:i)]=r.toRaw(t[i]);return n},p=(t,e={},n={})=>{t=t||{};const i=["children"];for(const[o,a]of Object.entries(e))if(!i.includes(o))if(!n.hasOwnProperty(o))t[o]=null;else if(Array.isArray(a))(!n[o]||JSON.stringify(a)!=JSON.stringify(n[o]))&&(t[o]=n[o]);else if(a instanceof Object&&!(a instanceof Date||Array.isArray(a)||typeof a=="function"))if(!(n[o]instanceof Object))t[o]=n[o];else{const d=p({},a,n[o]);d&&Object.keys(d).length>0&&(t[o]=d)}else a!==n[o]&&(t[o]=n[o]);for(const[o,a]of Object.entries(n))i.includes(o)||e.hasOwnProperty(o)||(t[o]=a);return t},y=(t,e,n)=>{for(const[i,o]of Object.entries(n))i&&typeof o=="function"&&i.startsWith("on")&&(i==="onRowInserting"?t.onRowInserting=o:i==="onDataRowInserting"?e.onRowInserting=o:(t.hasOwnProperty(i)&&(t[i]=o),e.hasOwnProperty(i)&&(e[i]=o)))},F=()=>r.defineComponent({name:"RealGridBase",props:{disabled:Boolean,gridProps:Object,dataProps:Object,locale:Object,autoGenerateField:Boolean,rows:Array,rowStyleCallback:Function,cellStyleCallback:Function,layout:Array,onInitialized:Function,onDestroy:Function,onCurrentChanging:Function,onCurrentChanged:Function,onCurrentRowChanged:Function,onValidateColumn:Function,onValidateRow:Function,onValidationFail:Function,onColumnCheckedChanged:Function,onMenuItemClicked:Function,onContextMenuPopup:Function,onContextMenuItemClicked:Function,onCellButtonClicked:Function,onScrollToBottom:Function,onTopIndexChanged:Function,onTopIndexChanging:Function,onLeftPosChanged:Function,onRowsDeleting:Function,onRowInserting:Function,onSelectionCleared:Function,onSelectionChanged:Function,onSelectionAdded:Function,onSelectionEnded:Function,onShowEditor:Function,onShowEditCommand:Function,onHideEditor:Function,onEditChange:Function,onGetEditValue:Function,onEditCommit:Function,onEditCanceled:Function,onItemEditCanceled:Function,onItemEditCancel:Function,onEditSearch:Function,onSearchCellButtonClick:Function,onCellEdited:Function,onEditRowChanged:Function,onEditRowPasted:Function,onRowsPasted:Function,onCellPasting:Function,onItemChecked:Function,onItemAllChecked:Function,onErrorClicked:Function,onSorting:Function,onSortingChanged:Function,onFiltering:Function,onFilteringChanged:Function,onWheel:Function,onKeyDown:Function,onKeyPress:Function,onKeyUp:Function,onShowTooltip:Function,onShowHeaderTooltip:Function,onColumnPropertyChanged:Function,onLayoutPropertyChanged:Function,onGridActivated:Function,onCopy:Function,onPaste:Function,onPasted:Function,onItemsChecked:Function,onCellClicked:Function,onCellDblClicked:Function,onCellItemClicked:Function,onCommandStackChanged:Function,onDataLoadComplated:Function,onLayoutExpanding:Function,onLayoutExpanded:Function,onLayoutCollapsing:Function,onLayoutCollapsed:Function,onGridFocusChanged:Function},data(){return{$dataProvider:null,$gridView:null,_mountTimer:null,_mountCBs:[]}},mounted(){const t=this.$el,e=s(this.$props);if(this.$listeners){for(const[o,a]of Object.entries(this.$listeners))if(o&&typeof a=="function")if(o==="row-inserting")e.onRowInserting=a;else if(o==="data-row-inserting")e.onDataRowInserting=a;else{const d="on"+$(C(o));e.hasOwnProperty(d)&&(e[d]=a)}}const{grid:n,dataProvider:i}=this._createGrid(t,e);this.$dataProvider=i,this.$gridView=n,this.executeCB(),y(n,i,e),this._applyOptions(e),e.layout&&n.setColumnLayout(e.layout),this._doInitProc(n,e),this._setData(e)},computed:{dataProvider:{get(){return this.$data.$dataProvider},set(t){this.$dataProvider=t}},gridView:{get(){return this.$data.$gridView},set(t){this.$gridView=t}}},unmounted(){const t=s(this.$props),e=s(this.$attrs,"on"),n=t.onDestroy||e.onDestroy;n&&n(this.gridView),this.gridView=this.gridView&&this.gridView.destroy(),this.dataProvider=this.dataProvider&&this.dataProvider.destroy()},destroyed(){const t=s(this.$props),e=s(this.$attrs,"on"),n=t.onDestroy||e.onDestroy;n&&n(this.gridView),this.gridView=this.gridView&&this.gridView.destroy(),this.dataProvider=this.dataProvider&&this.dataProvider.destroy()},watch:{gridProps:{handler(t,e){const n=p({},e,t);this.gridView&&n&&Object.keys(n).length>0&&this.gridView.setOptions(n)},deep:!0},disabled(t,e){this.gridView&&(this.gridView.disabled=t)},dataProps:{handler(t,e){const n=p({},e,t);this.dataProvider&&n&&Object.keys(n).length>0&&this.dataProvider.setOptions(n)},deep:!0},locale:{handler(t,e){t&&m.default.setLocale(t)}},layout:{handler(t,e){this.gridView&&this.gridView.setColumnLayout(t)},deep:!0}},methods:{addCallback(t){this.$data._mountCBs.push(t),clearTimeout(this.$data._mountTimer);const e=this;this.$data._mountTimer=window.setTimeout(function(){e.executeCB()},20)},removeCallback(t){if(this.$data._mountCBs.indexOf(t)>=0){const e=this.$data._mountCBs.indexOf(t);this.$data._mountCBs.splice(e,1)}},executeCB(){const t=this.$gridView,e=this.$dataProvider;if(!!t&&(clearTimeout(this._mountTimer),t&&t._view)){t.beginUpdate();try{e==null||e.beginUpdate();try{const n=this.$data._mountCBs.sort((i,o)=>(i.$mountSeq==null?-1:i.$mountSeq)-(o.$mountSeq==null?-1:o.$mountSeq));for(;n&&n.length;){const i=n.shift();i==null||i.call(this,t)}}finally{e==null||e.endUpdate()}}finally{t.endUpdate(!0),this.$data._mountTimer=null,this.$data._mountCBs=[]}}},_applyOptions(t){const e=this.$gridView,n=this.$dataProvider;if(e)for(let[i,o]of Object.entries(t))switch(i){case"gridProps":o&&e.setOptions(o);break;case"disabled":e&&(e.disabled=!!o);break;case"dataProps":o&&(n==null||n.setOptions(o));break;case"layout":o&&e&&e.setColumnLayout(o);break;case"rowStyleCallback":e.setRowStyleCallback(o);break;case"cellStyleCallback":e.setCellStyleCallback(o);break;case"locale":o&&m.default.setLocale(o);break}this._doApplyOptions(t)},_createGrid(t,e){return{grid:null,dataProvider:null}},_doInitProc(t,e){const n=e.onInitialized;if(n){const i=n.constructor.name;i==="Function"?n(t):i==="AsyncFunction"&&Promise.resolve(n(t))}},_doApplyOptions(t){},_setData(t){}},render(){var a,d;const t=c=>{const l=[];if(Array.isArray(c))for(let h of c)Array.isArray(h.children)?l.push(...t(h.children)):l.push(h);return l},e=[];for(let c of Object.keys(this.$slots)){let l=this.$slots[c];typeof l=="function"&&(l=l()),e.push(...t(l))}let n=0;for(let c=0;c<e.length;c++){const l=e[c];if(l.type instanceof Object&&l.type.hasOwnProperty("name")){const h=l.type.name;h&&/^RG.+Column$/.exec(h)&&(l.props=l.props||{},l.props&&((d=(a=l.props).displayIndex)!=null||(a.displayIndex=n++)))}l.$mountSeq=c}const i=this.$attrs.style?this.$attrs.style:{width:"100%",height:"100%"};return r.h("div",{style:i},e)}}),R=r.defineComponent({name:"RealGridVue",extends:F(),props:{accessibility:Boolean,waiOptions:Object,onPageChanging:Function,onPageChanged:Function,onPageCountChanged:Function,onGrouping:Function,onGrouped:Function,onExpanding:Function,onExpanded:Function,onCollapsing:Function,onCollapsed:Function,onRowCountChanged:Function,onRowUpdating:Function,onRowUpdated:Function,onRowsUpdated:Function,onRowListUpdated:Function,onDataRowInserting:Function,onRowInserted:Function,onRowsInserted:Function,onRowDeleting:Function,onRowDeleted:Function,onRowsDeleted:Function,onRowMoving:Function,onRowMoved:Function,onRowsMoving:Function,onRowsMoved:Function,onRowListMoving:Function,onRowListMoved:Function,onValueChanged:Function,onDataChanged:Function,onRowStateChanged:Function,onRowStatesChanged:Function,onRowStatesCleared:Function,onRestoreRows:Function},data(){return{$dataProvider:null,$gridView:null}},watch:{rows:{handler(t,e){var n;if(this.$data._mountTimer!=null){const i=()=>{r.nextTick(()=>{var o;(o=this.$dataProvider)==null||o.setRows(t)})};i.$mountSeq=1/0,this.addCallback(i)}else(n=this.$dataProvider)==null||n.setRows(t)}}},methods:{_createGrid(t,e){var o;const n=new m.default.GridView(t,e==null?void 0:e.accessibility,e==null?void 0:e.waiOptions),i=new m.default.LocalDataProvider((o=e.dataProps)==null?void 0:o.undoable);return n.setDataSource(i),{grid:n,dataProvider:i}},_doApplyOptions(t){},_setData(t){var e;t.rows&&((e=this.$dataProvider)==null||e.setRows(t.rows))}}}),g=r.defineComponent({name:"RealTreeVue",extends:F(),props:{treeOptions:Object,treeField:String,needSorting:Boolean,childrenField:String,iconField:String,json:Object,rowsProp:String,childrenProp:String,iconProp:String,onTreeItemExpanding:Function,onTreeItemExpanded:Function,onTreeItemCollapsing:Function,onTreeItemCollapsed:Function,onTreeItemChanged:Function,onRowCountChanged:Function,onRowAdding:Function,onRowAdded:Function,onRowsAdded:Function,onRowDeleting:Function,onRowDeleted:Function,onRowsDeleted:Function,onRowUpdating:Function,onRowUpdated:Function,onRowsUpdating:Function,onRowsUpdated:Function,onValueChanged:Function,onDataChanged:Function,onRowStateChanged:Function,onRowStatesChanged:Function,onRowSiblingMoving:Function,onRowSiblingMoved:Function,onRowsSiblingMoving:Function,onRowsSiblingMoved:Function,onRowParentChanging:Function,onRowParentChanged:Function},data(){return{$gridView:null,$dataProvider:null}},computed:{gridView:{get(){return this.$data.$gridView},set(t){this.$gridView=t}},dataProvider:{get(){return this.$data.$dataProvider},set(t){this.$dataProvider=t}}},methods:{_createGrid(t,e){var o;const n=new m.TreeView(t),i=new m.LocalTreeDataProvider((o=e.dataProps)==null?void 0:o.undoable);return n.setDataSource(i),{grid:n,dataProvider:i}},_doApplyOptions(t){var e;for(const[n,i]of Object.entries(t))switch(n){case"treeOptions":i&&((e=this.$gridView)==null||e.setTreeOptions(i));break}},_setData(t){var e,n;t.rows?(e=this.$dataProvider)==null||e.setRows(t.rows,this.treeField,this.needSorting,this.childrenField,this.iconField):t.json&&((n=this.$dataProvider)==null||n.setObjectRows(t.json,this.rowsProp,this.childrenProp,this.iconProp))}},watch:{rows:{handler(t,e){var n;if(this.$data._mountTimer!=null){const i=()=>{r.nextTick(()=>{var o;(o=this.$dataProvider)==null||o.setRows(t,this.treeField,this.needSorting,this.childrenField,this.iconField)})};i.$mountSeq=1/0,this.addCallback(i)}else(n=this.$dataProvider)==null||n.setRows(t,this.treeField,this.needSorting,this.childrenField,this.iconField)}},json:{handler(t,e){var n;if(this.$data._mountTimer!=null){const i=()=>{r.nextTick(()=>{var o;(o=this.$dataProvider)==null||o.setObjectRows(t,this.rowsProp,this.childrenProp,this.iconProp)})};i.$mountSeq=1/0,this.addCallback(i)}else(n=this.$dataProvider)==null||n.setObjectRows(t,this.rowsProp,this.childrenProp,this.iconProp)}}}}),u=r.defineComponent({name:"ComponentBase",props:{},data(){return{$model:null,$oldValue:null}},mounted(){const t=this.$parent;t&&(this.$oldValue=s(this.$attrs),this.mountCB.$mountSeq=this._vnode.$mountSeq,t.addCallback(this.mountCB))},unmounted(){const t=this.$parent;t&&(t.removeCallback(this.mountCB),t.addCallback(this.unmountCB))},destroyed(){const t=this.$parent;t&&(t.removeCallback(this.mountCB),t.addCallback(this.unmountCB))},watch:{$attrs:{handler(t,e){var o;const n=s(t),i=p({},s(this.$data.$oldValue),s(t));if(i&&Object.keys(i).length>0){const a=(o=this.$data)==null?void 0:o.$model;a&&a.assignFrom(n),this._doWatchAttrs(i),this.$oldValue=n}},deep:!0}},methods:{mountCB(){},unmountCB(){},_doWatchAttrs(t){}},render(){}}),P=r.defineComponent({name:"RGSeriesColumn",extends:u,data(){return{}},props:{},methods:{mountCB(t){var n,i;if(s((n=this.$parent)==null?void 0:n.$attrs)){const o=s(this.$attrs);t&&(this.$model=t.addColumn({...o,type:"series"},(i=o.displayIndex)!=null?i:-1))}},unmountCB(t){this.$data.$model&&t.removeColumn(this.$model.name)},_doWatchAttrs(t){if(t.hasOwnProperty("width")&&!isNaN(t.width)){const n=this.$data.$model.layout;n&&(n.cellWidth=t.width)}}}}),S=r.defineComponent({name:"RGStateBar",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setStateBar(s(this.$attrs)),this.$model=t.stateBar}}}),b=r.defineComponent({name:"RGRowIndicator",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setRowIndicator(s(this.$attrs)),this.$model=t.rowIndicator}}}),G=r.defineComponent({name:"RGHeaderSummaries",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setHeaderSummaries(s(this.$attrs)),this.$model=t.headerSummaries}}}),k=r.defineComponent({name:"RGHeaderSummary",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setHeaderSummary(s(this.$attrs)),this.$model=t.headerSummary}}}),v=r.defineComponent({name:"RGHeader",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setHeader(s(this.$attrs)),this.$model=t.header}}}),B=r.defineComponent({name:"RGGroupPanel",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setGroupPanel(s(this.$attrs)),this.$model=t.groupPanel}}}),O=r.defineComponent({name:"RGFooter",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setFooter(s(this.$attrs)),this.$model=t.footer}}}),V=r.defineComponent({name:"RGFooters",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setFooters(s(this.$attrs)),this.$model=t.footer}}}),_=r.defineComponent({name:"RGFilterPanel",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setFilterPanel(s(this.$attrs)),this.$model=t.filterPanel}}}),x=r.defineComponent({name:"RGDataField",extends:u,props:{},data(){return{}},methods:{mountCB(t){const e=s(this.$attrs);if(e.fieldName){const n=t.getDataSource();n.fieldByName(e.fieldName)||(this.$model=n.addField(e,!0))}},unmountDB(t){this.$model&&t.getDataSource().removeField(this.$model)}}}),D=r.defineComponent({name:"RGDataColumn",extends:u,data(){return{}},props:{},methods:{mountCB(t){var n,i;const e=s((n=this.$parent)==null?void 0:n.$props);if(e){const o=e.autoGenerateField,a=t==null?void 0:t.getDataSource(),d=s(this.$attrs);let c=d.fieldName;o&&(!c&&d.field&&(c=d.field.fieldName),a&&!a.fieldByName(c)&&a.addField(d.field||c)),t&&(this.$model=t.addColumn({...d,fieldName:c},(i=d.displayIndex)!=null?i:-1))}},unmountCB(t){var n;this.$data.$model&&t.removeColumn(this.$data.$model.name);const e=s((n=this.$parent)==null?void 0:n.$props);if(e){const i=e.autoGenerateField,o=t==null?void 0:t.getDataSource(),a=s(this.$attrs);let d=a.fieldName;i&&(!d&&a.field&&(d=a.field.fieldName),t.columnByField(d)||o.removeField(d))}},_doWatchAttrs(t){if(t.hasOwnProperty("width")&&!isNaN(t.width)){const n=this.$data.$model.layout;n&&(n.cellWidth=t.width)}}}}),I=r.defineComponent({name:"RGLiteralColumn",extends:u,data(){return{}},props:{},methods:{mountCB(t){var n,i;if(s((n=this.$parent)==null?void 0:n.$attrs)){const o=s(this.$attrs);t&&(this.$model=t.addColumn({...o,type:"literal"},(i=o.displayIndex)!=null?i:-1))}},unmountCB(t){this.$data.$model&&t.removeColumn(this.$model.name)},_doWatchAttrs(t){if(t.hasOwnProperty("width")&&!isNaN(t.width)){const n=this.$data.$model.layout;n&&(n.cellWidth=t.width)}}}}),T=r.defineComponent({name:"RGCheckBar",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setCheckBar(s(this.$attrs)),this.$model=t.checkBar}}});exports.RGCheckBar=T;exports.RGDataColumn=D;exports.RGDataField=x;exports.RGFilterPanel=_;exports.RGFooter=O;exports.RGFooters=V;exports.RGGroupPanel=B;exports.RGHeader=v;exports.RGHeaderSummaries=G;exports.RGHeaderSummary=k;exports.RGLiteralColumn=I;exports.RGRowIndicator=b;exports.RGSeriesColumn=P;exports.RGStateBar=S;exports.RealGridVue=R;exports.RealTreeVue=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("realgrid"),r=require("vue");function f(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const m=f(w),C=t=>t.replace(/-./g,e=>e[1].toUpperCase()),$=t=>t.charAt(0).toUpperCase()+t.slice(1),s=(t,e="")=>{const n={};for(let i in t)n[C(e?`${e}-${i}`:i)]=r.toRaw(t[i]);return n},p=(t,e={},n={})=>{t=t||{};const i=["children"];for(const[o,a]of Object.entries(e))if(!i.includes(o))if(!n.hasOwnProperty(o))t[o]=null;else if(Array.isArray(a))(!n[o]||JSON.stringify(a)!=JSON.stringify(n[o]))&&(t[o]=n[o]);else if(a instanceof Object&&!(a instanceof Date||Array.isArray(a)||typeof a=="function"))if(!(n[o]instanceof Object))t[o]=n[o];else{const d=p({},a,n[o]);d&&Object.keys(d).length>0&&(t[o]=d)}else a!==n[o]&&(t[o]=n[o]);for(const[o,a]of Object.entries(n))i.includes(o)||e.hasOwnProperty(o)||(t[o]=a);return t},y=(t,e,n)=>{for(const[i,o]of Object.entries(n))i&&typeof o=="function"&&i.startsWith("on")&&(i==="onRowInserting"?t.onRowInserting=o:i==="onDataRowInserting"?e.onRowInserting=o:(t.hasOwnProperty(i)&&(t[i]=o),e.hasOwnProperty(i)&&(e[i]=o)))},F=()=>r.defineComponent({name:"RealGridBase",props:{disabled:Boolean,gridProps:Object,dataProps:Object,locale:Object,autoGenerateField:Boolean,rows:Array,rowStyleCallback:Function,cellStyleCallback:Function,layout:Array,onInitialized:Function,onDestroy:Function,onCurrentChanging:Function,onCurrentChanged:Function,onCurrentRowChanged:Function,onValidateColumn:Function,onValidateRow:Function,onValidationFail:Function,onColumnCheckedChanged:Function,onMenuItemClicked:Function,onContextMenuPopup:Function,onContextMenuItemClicked:Function,onCellButtonClicked:Function,onScrollToBottom:Function,onTopIndexChanged:Function,onTopIndexChanging:Function,onLeftPosChanged:Function,onRowsDeleting:Function,onRowInserting:Function,onSelectionCleared:Function,onSelectionChanged:Function,onSelectionAdded:Function,onSelectionEnded:Function,onShowEditor:Function,onShowEditCommand:Function,onHideEditor:Function,onEditChange:Function,onGetEditValue:Function,onEditCommit:Function,onEditCanceled:Function,onItemEditCanceled:Function,onItemEditCancel:Function,onEditSearch:Function,onSearchCellButtonClick:Function,onCellEdited:Function,onEditRowChanged:Function,onEditRowPasted:Function,onRowsPasted:Function,onCellPasting:Function,onItemChecked:Function,onItemAllChecked:Function,onErrorClicked:Function,onSorting:Function,onSortingChanged:Function,onFiltering:Function,onFilteringChanged:Function,onWheel:Function,onKeyDown:Function,onKeyPress:Function,onKeyUp:Function,onShowRowBarTooltip:Function,onShowTooltip:Function,onShowHeaderTooltip:Function,onColumnPropertyChanged:Function,onLayoutPropertyChanged:Function,onGridActivated:Function,onCopy:Function,onPaste:Function,onPasted:Function,onItemsChecked:Function,onCellClicked:Function,onCellDblClicked:Function,onCellItemClicked:Function,onCommandStackChanged:Function,onDataLoadComplated:Function,onLayoutExpanding:Function,onLayoutExpanded:Function,onLayoutCollapsing:Function,onLayoutCollapsed:Function,onGridFocusChanged:Function},data(){return{$dataProvider:null,$gridView:null,_mountTimer:null,_mountCBs:[]}},mounted(){const t=this.$el,e=s(this.$props);if(this.$listeners){for(const[o,a]of Object.entries(this.$listeners))if(o&&typeof a=="function")if(o==="row-inserting")e.onRowInserting=a;else if(o==="data-row-inserting")e.onDataRowInserting=a;else{const d="on"+$(C(o));e.hasOwnProperty(d)&&(e[d]=a)}}const{grid:n,dataProvider:i}=this._createGrid(t,e);this.$dataProvider=i,this.$gridView=n,this.executeCB(),y(n,i,e),this._applyOptions(e),e.layout&&n.setColumnLayout(e.layout),this._setData(e)},computed:{dataProvider:{get(){return this.$data.$dataProvider},set(t){this.$dataProvider=t}},gridView:{get(){return this.$data.$gridView},set(t){this.$gridView=t}}},unmounted(){const t=s(this.$props),e=s(this.$attrs,"on"),n=t.onDestroy||e.onDestroy;n&&n(this.gridView),this.gridView=this.gridView&&this.gridView.destroy(),this.dataProvider=this.dataProvider&&this.dataProvider.destroy()},destroyed(){const t=s(this.$props),e=s(this.$attrs,"on"),n=t.onDestroy||e.onDestroy;n&&n(this.gridView),this.gridView=this.gridView&&this.gridView.destroy(),this.dataProvider=this.dataProvider&&this.dataProvider.destroy()},watch:{gridProps:{handler(t,e){const n=p({},e,t);this.gridView&&n&&Object.keys(n).length>0&&this.gridView.setOptions(n)},deep:!0},disabled(t,e){this.gridView&&(this.gridView.disabled=t)},dataProps:{handler(t,e){const n=p({},e,t);this.dataProvider&&n&&Object.keys(n).length>0&&this.dataProvider.setOptions(n)},deep:!0},locale:{handler(t,e){t&&m.default.setLocale(t)}},layout:{handler(t,e){this.gridView&&this.gridView.setColumnLayout(t)},deep:!0}},methods:{addCallback(t){this.$data._mountCBs.push(t),clearTimeout(this.$data._mountTimer);const e=this;this.$data._mountTimer=window.setTimeout(function(){e.executeCB()},20)},removeCallback(t){if(this.$data._mountCBs.indexOf(t)>=0){const e=this.$data._mountCBs.indexOf(t);this.$data._mountCBs.splice(e,1)}},executeCB(){const t=this.$gridView,e=this.$dataProvider;if(!!t&&(clearTimeout(this._mountTimer),t&&t._view)){t.beginUpdate();try{e==null||e.beginUpdate();try{const n=this.$data._mountCBs.sort((i,o)=>(i.$mountSeq==null?-1:i.$mountSeq)-(o.$mountSeq==null?-1:o.$mountSeq));for(;n&&n.length;){const i=n.shift();i==null||i.call(this,t)}}finally{e==null||e.endUpdate()}}finally{t.endUpdate(!0),this.$data._mountTimer=null,this.$data._mountCBs=[]}}},_applyOptions(t){const e=this.$gridView,n=this.$dataProvider;if(e)for(let[i,o]of Object.entries(t))switch(i){case"gridProps":o&&e.setOptions(o);break;case"disabled":e&&(e.disabled=!!o);break;case"dataProps":o&&(n==null||n.setOptions(o));break;case"layout":o&&e&&e.setColumnLayout(o);break;case"rowStyleCallback":e.setRowStyleCallback(o);break;case"cellStyleCallback":e.setCellStyleCallback(o);break;case"locale":o&&m.default.setLocale(o);break}this._doApplyOptions(t)},_createGrid(t,e){return{grid:null,dataProvider:null}},_doInitProc(t,e){const n=e.onInitialized;if(n){const i=n.constructor.name;i==="Function"?n(t):i==="AsyncFunction"&&Promise.resolve(n(t))}},_doApplyOptions(t){},_setData(t){}},render(){var a,d;const t=c=>{const l=[];if(Array.isArray(c))for(let h of c)Array.isArray(h.children)?l.push(...t(h.children)):l.push(h);return l},e=[];for(let c of Object.keys(this.$slots)){let l=this.$slots[c];typeof l=="function"&&(l=l()),e.push(...t(l))}let n=0;for(let c=0;c<e.length;c++){const l=e[c];if(l.type instanceof Object&&l.type.hasOwnProperty("name")){const h=l.type.name;h&&/^RG.+Column$/.exec(h)&&(l.props=l.props||{},l.props&&((d=(a=l.props).displayIndex)!=null||(a.displayIndex=n++)))}l.$mountSeq=c}const i=this.$attrs.style?this.$attrs.style:{width:"100%",height:"100%"};return r.h("div",{style:i},e)}}),R=r.defineComponent({name:"RealGridVue",extends:F(),props:{accessibility:Boolean,waiOptions:Object,onPageChanging:Function,onPageChanged:Function,onPageCountChanged:Function,onGrouping:Function,onGrouped:Function,onExpanding:Function,onExpanded:Function,onCollapsing:Function,onCollapsed:Function,onRowCountChanged:Function,onRowUpdating:Function,onRowUpdated:Function,onRowsUpdated:Function,onRowListUpdated:Function,onDataRowInserting:Function,onRowInserted:Function,onRowsInserted:Function,onRowDeleting:Function,onRowDeleted:Function,onRowsDeleted:Function,onRowMoving:Function,onRowMoved:Function,onRowsMoving:Function,onRowsMoved:Function,onRowListMoving:Function,onRowListMoved:Function,onValueChanged:Function,onDataChanged:Function,onRowStateChanged:Function,onRowStatesChanged:Function,onRowStatesCleared:Function,onRestoreRows:Function},data(){return{$dataProvider:null,$gridView:null}},watch:{rows:{handler(t,e){var n;if(this.$data._mountTimer!=null){const i=()=>{r.nextTick(()=>{var o;(o=this.$dataProvider)==null||o.setRows(t)})};i.$mountSeq=1/0,this.addCallback(i)}else(n=this.$dataProvider)==null||n.setRows(t)}}},methods:{_createGrid(t,e){var o;const n=new m.default.GridView(t,e==null?void 0:e.accessibility,e==null?void 0:e.waiOptions),i=new m.default.LocalDataProvider((o=e.dataProps)==null?void 0:o.undoable);return n.setDataSource(i),{grid:n,dataProvider:i}},_doApplyOptions(t){},_setData(t){var e;t.rows&&((e=this.$dataProvider)==null||e.setRows(t.rows))}}}),g=r.defineComponent({name:"RealTreeVue",extends:F(),props:{treeOptions:Object,treeField:String,needSorting:Boolean,childrenField:String,iconField:String,json:Object,rowsProp:String,childrenProp:String,iconProp:String,onTreeItemExpanding:Function,onTreeItemExpanded:Function,onTreeItemCollapsing:Function,onTreeItemCollapsed:Function,onTreeItemChanged:Function,onRowCountChanged:Function,onRowAdding:Function,onRowAdded:Function,onRowsAdded:Function,onRowDeleting:Function,onRowDeleted:Function,onRowsDeleted:Function,onRowUpdating:Function,onRowUpdated:Function,onRowsUpdating:Function,onRowsUpdated:Function,onValueChanged:Function,onDataChanged:Function,onRowStateChanged:Function,onRowStatesChanged:Function,onRowSiblingMoving:Function,onRowSiblingMoved:Function,onRowsSiblingMoving:Function,onRowsSiblingMoved:Function,onRowParentChanging:Function,onRowParentChanged:Function},data(){return{$gridView:null,$dataProvider:null}},computed:{gridView:{get(){return this.$data.$gridView},set(t){this.$gridView=t}},dataProvider:{get(){return this.$data.$dataProvider},set(t){this.$dataProvider=t}}},methods:{_createGrid(t,e){var o;const n=new m.TreeView(t),i=new m.LocalTreeDataProvider((o=e.dataProps)==null?void 0:o.undoable);return n.setDataSource(i),{grid:n,dataProvider:i}},_doApplyOptions(t){var e;for(const[n,i]of Object.entries(t))switch(n){case"treeOptions":i&&((e=this.$gridView)==null||e.setTreeOptions(i));break}},_setData(t){var e,n;t.rows?(e=this.$dataProvider)==null||e.setRows(t.rows,this.treeField,this.needSorting,this.childrenField,this.iconField):t.json&&((n=this.$dataProvider)==null||n.setObjectRows(t.json,this.rowsProp,this.childrenProp,this.iconProp))}},watch:{rows:{handler(t,e){var n;if(this.$data._mountTimer!=null){const i=()=>{r.nextTick(()=>{var o;(o=this.$dataProvider)==null||o.setRows(t,this.treeField,this.needSorting,this.childrenField,this.iconField)})};i.$mountSeq=1/0,this.addCallback(i)}else(n=this.$dataProvider)==null||n.setRows(t,this.treeField,this.needSorting,this.childrenField,this.iconField)}},json:{handler(t,e){var n;if(this.$data._mountTimer!=null){const i=()=>{r.nextTick(()=>{var o;(o=this.$dataProvider)==null||o.setObjectRows(t,this.rowsProp,this.childrenProp,this.iconProp)})};i.$mountSeq=1/0,this.addCallback(i)}else(n=this.$dataProvider)==null||n.setObjectRows(t,this.rowsProp,this.childrenProp,this.iconProp)}}}}),u=r.defineComponent({name:"ComponentBase",props:{},data(){return{$model:null,$oldValue:null}},mounted(){const t=this.$parent;t&&(this.$oldValue=s(this.$attrs),this.mountCB.$mountSeq=this._vnode.$mountSeq,t.addCallback(this.mountCB))},unmounted(){const t=this.$parent;t&&(t.removeCallback(this.mountCB),t.addCallback(this.unmountCB))},destroyed(){const t=this.$parent;t&&(t.removeCallback(this.mountCB),t.addCallback(this.unmountCB))},watch:{$attrs:{handler(t,e){var o;const n=s(t),i=p({},s(this.$data.$oldValue),s(t));if(i&&Object.keys(i).length>0){const a=(o=this.$data)==null?void 0:o.$model;a&&a.assignFrom(n),this._doWatchAttrs(i),this.$oldValue=n}},deep:!0}},methods:{mountCB(){},unmountCB(){},_doWatchAttrs(t){}},render(){}}),P=r.defineComponent({name:"RGSeriesColumn",extends:u,data(){return{}},props:{},methods:{mountCB(t){var n,i;if(s((n=this.$parent)==null?void 0:n.$attrs)){const o=s(this.$attrs);t&&(this.$model=t.addColumn({...o,type:"series"},(i=o.displayIndex)!=null?i:-1))}},unmountCB(t){this.$data.$model&&t.removeColumn(this.$model.name)},_doWatchAttrs(t){if(t.hasOwnProperty("width")&&!isNaN(t.width)){const n=this.$data.$model.layout;n&&(n.cellWidth=t.width)}}}}),S=r.defineComponent({name:"RGStateBar",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setStateBar(s(this.$attrs)),this.$model=t.stateBar}}}),b=r.defineComponent({name:"RGRowIndicator",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setRowIndicator(s(this.$attrs)),this.$model=t.rowIndicator}}}),G=r.defineComponent({name:"RGHeaderSummaries",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setHeaderSummaries(s(this.$attrs)),this.$model=t.headerSummaries}}}),k=r.defineComponent({name:"RGHeaderSummary",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setHeaderSummary(s(this.$attrs)),this.$model=t.headerSummary}}}),B=r.defineComponent({name:"RGHeader",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setHeader(s(this.$attrs)),this.$model=t.header}}}),v=r.defineComponent({name:"RGGroupPanel",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setGroupPanel(s(this.$attrs)),this.$model=t.groupPanel}}}),O=r.defineComponent({name:"RGFooter",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setFooter(s(this.$attrs)),this.$model=t.footer}}}),V=r.defineComponent({name:"RGFooters",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setFooters(s(this.$attrs)),this.$model=t.footer}}}),_=r.defineComponent({name:"RGFilterPanel",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setFilterPanel(s(this.$attrs)),this.$model=t.filterPanel}}}),x=r.defineComponent({name:"RGDataField",extends:u,props:{},data(){return{}},methods:{mountCB(t){const e=s(this.$attrs);if(e.fieldName){const n=t.getDataSource();n.fieldByName(e.fieldName)||(this.$model=n.addField(e,!0))}},unmountDB(t){this.$model&&t.getDataSource().removeField(this.$model)}}}),D=r.defineComponent({name:"RGDataColumn",extends:u,data(){return{}},props:{},methods:{mountCB(t){var n,i;const e=s((n=this.$parent)==null?void 0:n.$props);if(e){const o=e.autoGenerateField,a=t==null?void 0:t.getDataSource(),d=s(this.$attrs);let c=d.fieldName;o&&(!c&&d.field&&(c=d.field.fieldName),a&&!a.fieldByName(c)&&a.addField(d.field||c)),t&&(this.$model=t.addColumn({...d,fieldName:c},(i=d.displayIndex)!=null?i:-1))}},unmountCB(t){var n;this.$data.$model&&t.removeColumn(this.$data.$model.name);const e=s((n=this.$parent)==null?void 0:n.$props);if(e){const i=e.autoGenerateField,o=t==null?void 0:t.getDataSource(),a=s(this.$attrs);let d=a.fieldName;i&&(!d&&a.field&&(d=a.field.fieldName),t.columnByField(d)||o.removeField(d))}},_doWatchAttrs(t){if(t.hasOwnProperty("width")&&!isNaN(t.width)){const n=this.$data.$model.layout;n&&(n.cellWidth=t.width)}}}}),I=r.defineComponent({name:"RGLiteralColumn",extends:u,data(){return{}},props:{},methods:{mountCB(t){var n,i;if(s((n=this.$parent)==null?void 0:n.$attrs)){const o=s(this.$attrs);t&&(this.$model=t.addColumn({...o,type:"literal"},(i=o.displayIndex)!=null?i:-1))}},unmountCB(t){this.$data.$model&&t.removeColumn(this.$model.name)},_doWatchAttrs(t){if(t.hasOwnProperty("width")&&!isNaN(t.width)){const n=this.$data.$model.layout;n&&(n.cellWidth=t.width)}}}}),T=r.defineComponent({name:"RGCheckBar",extends:u,props:{},data(){return{}},methods:{mountCB(t){t.setCheckBar(s(this.$attrs)),this.$model=t.checkBar}}});exports.RGCheckBar=T;exports.RGDataColumn=D;exports.RGDataField=x;exports.RGFilterPanel=_;exports.RGFooter=O;exports.RGFooters=V;exports.RGGroupPanel=v;exports.RGHeader=B;exports.RGHeaderSummaries=G;exports.RGHeaderSummary=k;exports.RGLiteralColumn=I;exports.RGRowIndicator=b;exports.RGSeriesColumn=P;exports.RGStateBar=S;exports.RealGridVue=R;exports.RealTreeVue=g;
package/dist/index.d.ts CHANGED
@@ -176,8 +176,9 @@ export declare const RealGridVue: DefineComponent<{
176
176
  onKeyDown: PropType<(grid: RealGrid.GridView, event: KeyboardEvent) => boolean>;
177
177
  onKeyPress: PropType<(grid: RealGrid.GridView, event: KeyboardEvent) => void>;
178
178
  onKeyUp: PropType<(grid: RealGrid.GridView, event: KeyboardEvent) => void>;
179
- onShowTooltip: PropType<(grid: RealGrid.GridView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string>;
180
- onShowHeaderTooltip: PropType<(grid: RealGrid.GridView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => string>;
179
+ onShowRowBarTooltip: PropType<(grid: RealGrid.GridView, cellType: RealGrid.GridCellType, itemIndex: number, dataRow: number) => string | RealGrid.TooltipOptions>;
180
+ onShowTooltip: PropType<(grid: RealGrid.GridView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
181
+ onShowHeaderTooltip: PropType<(grid: RealGrid.GridView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
181
182
  onColumnPropertyChanged: PropType<(grid: RealGrid.GridView, column: RealGrid.GridColumn, property: string, newValue: any, oldValue: any) => void>;
182
183
  onLayoutPropertyChanged: PropType<(grid: RealGrid.GridView, layout: RealGrid.CellLayoutItem, property: string, newValue: any, oldValue: any) => void>;
183
184
  onGridActivated: PropType<(grid: RealGrid.GridView) => void>;
@@ -281,8 +282,9 @@ export declare const RealGridVue: DefineComponent<{
281
282
  onKeyDown: PropType<(grid: RealGrid.GridView, event: KeyboardEvent) => boolean>;
282
283
  onKeyPress: PropType<(grid: RealGrid.GridView, event: KeyboardEvent) => void>;
283
284
  onKeyUp: PropType<(grid: RealGrid.GridView, event: KeyboardEvent) => void>;
284
- onShowTooltip: PropType<(grid: RealGrid.GridView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string>;
285
- onShowHeaderTooltip: PropType<(grid: RealGrid.GridView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => string>;
285
+ onShowRowBarTooltip: PropType<(grid: RealGrid.GridView, cellType: RealGrid.GridCellType, itemIndex: number, dataRow: number) => string | RealGrid.TooltipOptions>;
286
+ onShowTooltip: PropType<(grid: RealGrid.GridView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
287
+ onShowHeaderTooltip: PropType<(grid: RealGrid.GridView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
286
288
  onColumnPropertyChanged: PropType<(grid: RealGrid.GridView, column: RealGrid.GridColumn, property: string, newValue: any, oldValue: any) => void>;
287
289
  onLayoutPropertyChanged: PropType<(grid: RealGrid.GridView, layout: RealGrid.CellLayoutItem, property: string, newValue: any, oldValue: any) => void>;
288
290
  onGridActivated: PropType<(grid: RealGrid.GridView) => void>;
@@ -463,8 +465,9 @@ export declare const RealTreeVue: DefineComponent<{
463
465
  onKeyDown: PropType<(grid: RealGrid.TreeView, event: KeyboardEvent) => boolean>;
464
466
  onKeyPress: PropType<(grid: RealGrid.TreeView, event: KeyboardEvent) => void>;
465
467
  onKeyUp: PropType<(grid: RealGrid.TreeView, event: KeyboardEvent) => void>;
466
- onShowTooltip: PropType<(grid: RealGrid.TreeView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string>;
467
- onShowHeaderTooltip: PropType<(grid: RealGrid.TreeView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => string>;
468
+ onShowRowBarTooltip: PropType<(grid: RealGrid.TreeView, cellType: RealGrid.GridCellType, itemIndex: number, dataRow: number) => string | RealGrid.TooltipOptions>;
469
+ onShowTooltip: PropType<(grid: RealGrid.TreeView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
470
+ onShowHeaderTooltip: PropType<(grid: RealGrid.TreeView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
468
471
  onColumnPropertyChanged: PropType<(grid: RealGrid.TreeView, column: RealGrid.GridColumn, property: string, newValue: any, oldValue: any) => void>;
469
472
  onLayoutPropertyChanged: PropType<(grid: RealGrid.TreeView, layout: RealGrid.CellLayoutItem, property: string, newValue: any, oldValue: any) => void>;
470
473
  onGridActivated: PropType<(grid: RealGrid.TreeView) => void>;
@@ -568,8 +571,9 @@ export declare const RealTreeVue: DefineComponent<{
568
571
  onKeyDown: PropType<(grid: RealGrid.TreeView, event: KeyboardEvent) => boolean>;
569
572
  onKeyPress: PropType<(grid: RealGrid.TreeView, event: KeyboardEvent) => void>;
570
573
  onKeyUp: PropType<(grid: RealGrid.TreeView, event: KeyboardEvent) => void>;
571
- onShowTooltip: PropType<(grid: RealGrid.TreeView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string>;
572
- onShowHeaderTooltip: PropType<(grid: RealGrid.TreeView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => string>;
574
+ onShowRowBarTooltip: PropType<(grid: RealGrid.TreeView, cellType: RealGrid.GridCellType, itemIndex: number, dataRow: number) => string | RealGrid.TooltipOptions>;
575
+ onShowTooltip: PropType<(grid: RealGrid.TreeView, index: RealGrid.CellIndex, value: any, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
576
+ onShowHeaderTooltip: PropType<(grid: RealGrid.TreeView, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem, isEllipsis: boolean) => boolean | string | RealGrid.TooltipOptions>;
573
577
  onColumnPropertyChanged: PropType<(grid: RealGrid.TreeView, column: RealGrid.GridColumn, property: string, newValue: any, oldValue: any) => void>;
574
578
  onLayoutPropertyChanged: PropType<(grid: RealGrid.TreeView, layout: RealGrid.CellLayoutItem, property: string, newValue: any, oldValue: any) => void>;
575
579
  onGridActivated: PropType<(grid: RealGrid.TreeView) => void>;
package/dist/index.es.js CHANGED
@@ -1,35 +1,35 @@
1
1
  import * as m from "realgrid";
2
2
  import { toRaw as $, defineComponent as d, h as y, nextTick as F } from "vue";
3
- const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charAt(0).toUpperCase() + t.slice(1), a = (t, e = "") => {
4
- const n = {};
3
+ const w = (t) => t.replace(/-./g, (n) => n[1].toUpperCase()), f = (t) => t.charAt(0).toUpperCase() + t.slice(1), a = (t, n = "") => {
4
+ const e = {};
5
5
  for (let i in t)
6
- n[C(e ? `${e}-${i}` : i)] = $(t[i]);
7
- return n;
8
- }, p = (t, e = {}, n = {}) => {
6
+ e[w(n ? `${n}-${i}` : i)] = $(t[i]);
7
+ return e;
8
+ }, p = (t, n = {}, e = {}) => {
9
9
  t = t || {};
10
10
  const i = ["children"];
11
- for (const [o, s] of Object.entries(e))
11
+ for (const [o, s] of Object.entries(n))
12
12
  if (!i.includes(o))
13
- if (!n.hasOwnProperty(o))
13
+ if (!e.hasOwnProperty(o))
14
14
  t[o] = null;
15
15
  else if (Array.isArray(s))
16
- (!n[o] || JSON.stringify(s) != JSON.stringify(n[o])) && (t[o] = n[o]);
16
+ (!e[o] || JSON.stringify(s) != JSON.stringify(e[o])) && (t[o] = e[o]);
17
17
  else if (s instanceof Object && !(s instanceof Date || Array.isArray(s) || typeof s == "function"))
18
- if (!(n[o] instanceof Object))
19
- t[o] = n[o];
18
+ if (!(e[o] instanceof Object))
19
+ t[o] = e[o];
20
20
  else {
21
- const r = p({}, s, n[o]);
21
+ const r = p({}, s, e[o]);
22
22
  r && Object.keys(r).length > 0 && (t[o] = r);
23
23
  }
24
24
  else
25
- s !== n[o] && (t[o] = n[o]);
26
- for (const [o, s] of Object.entries(n))
27
- i.includes(o) || e.hasOwnProperty(o) || (t[o] = s);
25
+ s !== e[o] && (t[o] = e[o]);
26
+ for (const [o, s] of Object.entries(e))
27
+ i.includes(o) || n.hasOwnProperty(o) || (t[o] = s);
28
28
  return t;
29
- }, g = (t, e, n) => {
30
- for (const [i, o] of Object.entries(n))
31
- i && typeof o == "function" && i.startsWith("on") && (i === "onRowInserting" ? t.onRowInserting = o : i === "onDataRowInserting" ? e.onRowInserting = o : (t.hasOwnProperty(i) && (t[i] = o), e.hasOwnProperty(i) && (e[i] = o)));
32
- }, w = () => d({
29
+ }, g = (t, n, e) => {
30
+ for (const [i, o] of Object.entries(e))
31
+ i && typeof o == "function" && i.startsWith("on") && (i === "onRowInserting" ? t.onRowInserting = o : i === "onDataRowInserting" ? n.onRowInserting = o : (t.hasOwnProperty(i) && (t[i] = o), n.hasOwnProperty(i) && (n[i] = o)));
32
+ }, C = () => d({
33
33
  name: "RealGridBase",
34
34
  props: {
35
35
  disabled: Boolean,
@@ -91,6 +91,7 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
91
91
  onKeyDown: Function,
92
92
  onKeyPress: Function,
93
93
  onKeyUp: Function,
94
+ onShowRowBarTooltip: Function,
94
95
  onShowTooltip: Function,
95
96
  onShowHeaderTooltip: Function,
96
97
  onColumnPropertyChanged: Function,
@@ -120,21 +121,21 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
120
121
  };
121
122
  },
122
123
  mounted() {
123
- const t = this.$el, e = a(this.$props);
124
+ const t = this.$el, n = a(this.$props);
124
125
  if (this.$listeners) {
125
126
  for (const [o, s] of Object.entries(this.$listeners))
126
127
  if (o && typeof s == "function")
127
128
  if (o === "row-inserting")
128
- e.onRowInserting = s;
129
+ n.onRowInserting = s;
129
130
  else if (o === "data-row-inserting")
130
- e.onDataRowInserting = s;
131
+ n.onDataRowInserting = s;
131
132
  else {
132
- const r = "on" + f(C(o));
133
- e.hasOwnProperty(r) && (e[r] = s);
133
+ const r = "on" + f(w(o));
134
+ n.hasOwnProperty(r) && (n[r] = s);
134
135
  }
135
136
  }
136
- const { grid: n, dataProvider: i } = this._createGrid(t, e);
137
- this.$dataProvider = i, this.$gridView = n, this.executeCB(), g(n, i, e), this._applyOptions(e), e.layout && n.setColumnLayout(e.layout), this._doInitProc(n, e), this._setData(e);
137
+ const { grid: e, dataProvider: i } = this._createGrid(t, n);
138
+ this.$dataProvider = i, this.$gridView = e, this.executeCB(), g(e, i, n), this._applyOptions(n), n.layout && e.setColumnLayout(n.layout), this._setData(n);
138
139
  },
139
140
  computed: {
140
141
  dataProvider: {
@@ -155,38 +156,38 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
155
156
  }
156
157
  },
157
158
  unmounted() {
158
- const t = a(this.$props), e = a(this.$attrs, "on"), n = t.onDestroy || e.onDestroy;
159
- n && n(this.gridView), this.gridView = this.gridView && this.gridView.destroy(), this.dataProvider = this.dataProvider && this.dataProvider.destroy();
159
+ const t = a(this.$props), n = a(this.$attrs, "on"), e = t.onDestroy || n.onDestroy;
160
+ e && e(this.gridView), this.gridView = this.gridView && this.gridView.destroy(), this.dataProvider = this.dataProvider && this.dataProvider.destroy();
160
161
  },
161
162
  destroyed() {
162
- const t = a(this.$props), e = a(this.$attrs, "on"), n = t.onDestroy || e.onDestroy;
163
- n && n(this.gridView), this.gridView = this.gridView && this.gridView.destroy(), this.dataProvider = this.dataProvider && this.dataProvider.destroy();
163
+ const t = a(this.$props), n = a(this.$attrs, "on"), e = t.onDestroy || n.onDestroy;
164
+ e && e(this.gridView), this.gridView = this.gridView && this.gridView.destroy(), this.dataProvider = this.dataProvider && this.dataProvider.destroy();
164
165
  },
165
166
  watch: {
166
167
  gridProps: {
167
- handler(t, e) {
168
- const n = p({}, e, t);
169
- this.gridView && n && Object.keys(n).length > 0 && this.gridView.setOptions(n);
168
+ handler(t, n) {
169
+ const e = p({}, n, t);
170
+ this.gridView && e && Object.keys(e).length > 0 && this.gridView.setOptions(e);
170
171
  },
171
172
  deep: !0
172
173
  },
173
- disabled(t, e) {
174
+ disabled(t, n) {
174
175
  this.gridView && (this.gridView.disabled = t);
175
176
  },
176
177
  dataProps: {
177
- handler(t, e) {
178
- const n = p({}, e, t);
179
- this.dataProvider && n && Object.keys(n).length > 0 && this.dataProvider.setOptions(n);
178
+ handler(t, n) {
179
+ const e = p({}, n, t);
180
+ this.dataProvider && e && Object.keys(e).length > 0 && this.dataProvider.setOptions(e);
180
181
  },
181
182
  deep: !0
182
183
  },
183
184
  locale: {
184
- handler(t, e) {
185
+ handler(t, n) {
185
186
  t && m.default.setLocale(t);
186
187
  }
187
188
  },
188
189
  layout: {
189
- handler(t, e) {
190
+ handler(t, n) {
190
191
  this.gridView && this.gridView.setColumnLayout(t);
191
192
  },
192
193
  deep: !0
@@ -195,31 +196,31 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
195
196
  methods: {
196
197
  addCallback(t) {
197
198
  this.$data._mountCBs.push(t), clearTimeout(this.$data._mountTimer);
198
- const e = this;
199
+ const n = this;
199
200
  this.$data._mountTimer = window.setTimeout(function() {
200
- e.executeCB();
201
+ n.executeCB();
201
202
  }, 20);
202
203
  },
203
204
  removeCallback(t) {
204
205
  if (this.$data._mountCBs.indexOf(t) >= 0) {
205
- const e = this.$data._mountCBs.indexOf(t);
206
- this.$data._mountCBs.splice(e, 1);
206
+ const n = this.$data._mountCBs.indexOf(t);
207
+ this.$data._mountCBs.splice(n, 1);
207
208
  }
208
209
  },
209
210
  executeCB() {
210
- const t = this.$gridView, e = this.$dataProvider;
211
+ const t = this.$gridView, n = this.$dataProvider;
211
212
  if (!!t && (clearTimeout(this._mountTimer), t && t._view)) {
212
213
  t.beginUpdate();
213
214
  try {
214
- e == null || e.beginUpdate();
215
+ n == null || n.beginUpdate();
215
216
  try {
216
- const n = this.$data._mountCBs.sort((i, o) => (i.$mountSeq == null ? -1 : i.$mountSeq) - (o.$mountSeq == null ? -1 : o.$mountSeq));
217
- for (; n && n.length; ) {
218
- const i = n.shift();
217
+ const e = this.$data._mountCBs.sort((i, o) => (i.$mountSeq == null ? -1 : i.$mountSeq) - (o.$mountSeq == null ? -1 : o.$mountSeq));
218
+ for (; e && e.length; ) {
219
+ const i = e.shift();
219
220
  i == null || i.call(this, t);
220
221
  }
221
222
  } finally {
222
- e == null || e.endUpdate();
223
+ n == null || n.endUpdate();
223
224
  }
224
225
  } finally {
225
226
  t.endUpdate(!0), this.$data._mountTimer = null, this.$data._mountCBs = [];
@@ -227,27 +228,27 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
227
228
  }
228
229
  },
229
230
  _applyOptions(t) {
230
- const e = this.$gridView, n = this.$dataProvider;
231
- if (e)
231
+ const n = this.$gridView, e = this.$dataProvider;
232
+ if (n)
232
233
  for (let [i, o] of Object.entries(t))
233
234
  switch (i) {
234
235
  case "gridProps":
235
- o && e.setOptions(o);
236
+ o && n.setOptions(o);
236
237
  break;
237
238
  case "disabled":
238
- e && (e.disabled = !!o);
239
+ n && (n.disabled = !!o);
239
240
  break;
240
241
  case "dataProps":
241
- o && (n == null || n.setOptions(o));
242
+ o && (e == null || e.setOptions(o));
242
243
  break;
243
244
  case "layout":
244
- o && e && e.setColumnLayout(o);
245
+ o && n && n.setColumnLayout(o);
245
246
  break;
246
247
  case "rowStyleCallback":
247
- e.setRowStyleCallback(o);
248
+ n.setRowStyleCallback(o);
248
249
  break;
249
250
  case "cellStyleCallback":
250
- e.setCellStyleCallback(o);
251
+ n.setCellStyleCallback(o);
251
252
  break;
252
253
  case "locale":
253
254
  o && m.default.setLocale(o);
@@ -255,17 +256,17 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
255
256
  }
256
257
  this._doApplyOptions(t);
257
258
  },
258
- _createGrid(t, e) {
259
+ _createGrid(t, n) {
259
260
  return {
260
261
  grid: null,
261
262
  dataProvider: null
262
263
  };
263
264
  },
264
- _doInitProc(t, e) {
265
- const n = e.onInitialized;
266
- if (n) {
267
- const i = n.constructor.name;
268
- i === "Function" ? n(t) : i === "AsyncFunction" && Promise.resolve(n(t));
265
+ _doInitProc(t, n) {
266
+ const e = n.onInitialized;
267
+ if (e) {
268
+ const i = e.constructor.name;
269
+ i === "Function" ? e(t) : i === "AsyncFunction" && Promise.resolve(e(t));
269
270
  }
270
271
  },
271
272
  _doApplyOptions(t) {
@@ -281,26 +282,26 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
281
282
  for (let h of c)
282
283
  Array.isArray(h.children) ? l.push(...t(h.children)) : l.push(h);
283
284
  return l;
284
- }, e = [];
285
+ }, n = [];
285
286
  for (let c of Object.keys(this.$slots)) {
286
287
  let l = this.$slots[c];
287
- typeof l == "function" && (l = l()), e.push(...t(l));
288
+ typeof l == "function" && (l = l()), n.push(...t(l));
288
289
  }
289
- let n = 0;
290
- for (let c = 0; c < e.length; c++) {
291
- const l = e[c];
290
+ let e = 0;
291
+ for (let c = 0; c < n.length; c++) {
292
+ const l = n[c];
292
293
  if (l.type instanceof Object && l.type.hasOwnProperty("name")) {
293
294
  const h = l.type.name;
294
- h && /^RG.+Column$/.exec(h) && (l.props = l.props || {}, l.props && ((r = (s = l.props).displayIndex) != null || (s.displayIndex = n++)));
295
+ h && /^RG.+Column$/.exec(h) && (l.props = l.props || {}, l.props && ((r = (s = l.props).displayIndex) != null || (s.displayIndex = e++)));
295
296
  }
296
297
  l.$mountSeq = c;
297
298
  }
298
299
  const i = this.$attrs.style ? this.$attrs.style : { width: "100%", height: "100%" };
299
- return y("div", { style: i }, e);
300
+ return y("div", { style: i }, n);
300
301
  }
301
302
  }), P = d({
302
303
  name: "RealGridVue",
303
- extends: w(),
304
+ extends: C(),
304
305
  props: {
305
306
  accessibility: Boolean,
306
307
  waiOptions: Object,
@@ -345,8 +346,8 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
345
346
  },
346
347
  watch: {
347
348
  rows: {
348
- handler(t, e) {
349
- var n;
349
+ handler(t, n) {
350
+ var e;
350
351
  if (this.$data._mountTimer != null) {
351
352
  const i = () => {
352
353
  F(() => {
@@ -356,29 +357,29 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
356
357
  };
357
358
  i.$mountSeq = 1 / 0, this.addCallback(i);
358
359
  } else
359
- (n = this.$dataProvider) == null || n.setRows(t);
360
+ (e = this.$dataProvider) == null || e.setRows(t);
360
361
  }
361
362
  }
362
363
  },
363
364
  methods: {
364
- _createGrid(t, e) {
365
+ _createGrid(t, n) {
365
366
  var o;
366
- const n = new m.default.GridView(t, e == null ? void 0 : e.accessibility, e == null ? void 0 : e.waiOptions), i = new m.default.LocalDataProvider((o = e.dataProps) == null ? void 0 : o.undoable);
367
- return n.setDataSource(i), {
368
- grid: n,
367
+ const e = new m.default.GridView(t, n == null ? void 0 : n.accessibility, n == null ? void 0 : n.waiOptions), i = new m.default.LocalDataProvider((o = n.dataProps) == null ? void 0 : o.undoable);
368
+ return e.setDataSource(i), {
369
+ grid: e,
369
370
  dataProvider: i
370
371
  };
371
372
  },
372
373
  _doApplyOptions(t) {
373
374
  },
374
375
  _setData(t) {
375
- var e;
376
- t.rows && ((e = this.$dataProvider) == null || e.setRows(t.rows));
376
+ var n;
377
+ t.rows && ((n = this.$dataProvider) == null || n.setRows(t.rows));
377
378
  }
378
379
  }
379
380
  }), S = d({
380
381
  name: "RealTreeVue",
381
- extends: w(),
382
+ extends: C(),
382
383
  props: {
383
384
  treeOptions: Object,
384
385
  treeField: String,
@@ -441,32 +442,32 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
441
442
  }
442
443
  },
443
444
  methods: {
444
- _createGrid(t, e) {
445
+ _createGrid(t, n) {
445
446
  var o;
446
- const n = new m.TreeView(t), i = new m.LocalTreeDataProvider((o = e.dataProps) == null ? void 0 : o.undoable);
447
- return n.setDataSource(i), {
448
- grid: n,
447
+ const e = new m.TreeView(t), i = new m.LocalTreeDataProvider((o = n.dataProps) == null ? void 0 : o.undoable);
448
+ return e.setDataSource(i), {
449
+ grid: e,
449
450
  dataProvider: i
450
451
  };
451
452
  },
452
453
  _doApplyOptions(t) {
453
- var e;
454
- for (const [n, i] of Object.entries(t))
455
- switch (n) {
454
+ var n;
455
+ for (const [e, i] of Object.entries(t))
456
+ switch (e) {
456
457
  case "treeOptions":
457
- i && ((e = this.$gridView) == null || e.setTreeOptions(i));
458
+ i && ((n = this.$gridView) == null || n.setTreeOptions(i));
458
459
  break;
459
460
  }
460
461
  },
461
462
  _setData(t) {
462
- var e, n;
463
- t.rows ? (e = this.$dataProvider) == null || e.setRows(t.rows, this.treeField, this.needSorting, this.childrenField, this.iconField) : t.json && ((n = this.$dataProvider) == null || n.setObjectRows(t.json, this.rowsProp, this.childrenProp, this.iconProp));
463
+ var n, e;
464
+ t.rows ? (n = this.$dataProvider) == null || n.setRows(t.rows, this.treeField, this.needSorting, this.childrenField, this.iconField) : t.json && ((e = this.$dataProvider) == null || e.setObjectRows(t.json, this.rowsProp, this.childrenProp, this.iconProp));
464
465
  }
465
466
  },
466
467
  watch: {
467
468
  rows: {
468
- handler(t, e) {
469
- var n;
469
+ handler(t, n) {
470
+ var e;
470
471
  if (this.$data._mountTimer != null) {
471
472
  const i = () => {
472
473
  F(() => {
@@ -476,12 +477,12 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
476
477
  };
477
478
  i.$mountSeq = 1 / 0, this.addCallback(i);
478
479
  } else
479
- (n = this.$dataProvider) == null || n.setRows(t, this.treeField, this.needSorting, this.childrenField, this.iconField);
480
+ (e = this.$dataProvider) == null || e.setRows(t, this.treeField, this.needSorting, this.childrenField, this.iconField);
480
481
  }
481
482
  },
482
483
  json: {
483
- handler(t, e) {
484
- var n;
484
+ handler(t, n) {
485
+ var e;
485
486
  if (this.$data._mountTimer != null) {
486
487
  const i = () => {
487
488
  F(() => {
@@ -491,7 +492,7 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
491
492
  };
492
493
  i.$mountSeq = 1 / 0, this.addCallback(i);
493
494
  } else
494
- (n = this.$dataProvider) == null || n.setObjectRows(t, this.rowsProp, this.childrenProp, this.iconProp);
495
+ (e = this.$dataProvider) == null || e.setObjectRows(t, this.rowsProp, this.childrenProp, this.iconProp);
495
496
  }
496
497
  }
497
498
  }
@@ -518,12 +519,12 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
518
519
  },
519
520
  watch: {
520
521
  $attrs: {
521
- handler(t, e) {
522
+ handler(t, n) {
522
523
  var o;
523
- const n = a(t), i = p({}, a(this.$data.$oldValue), a(t));
524
+ const e = a(t), i = p({}, a(this.$data.$oldValue), a(t));
524
525
  if (i && Object.keys(i).length > 0) {
525
526
  const s = (o = this.$data) == null ? void 0 : o.$model;
526
- s && s.assignFrom(n), this._doWatchAttrs(i), this.$oldValue = n;
527
+ s && s.assignFrom(e), this._doWatchAttrs(i), this.$oldValue = e;
527
528
  }
528
529
  },
529
530
  deep: !0
@@ -548,8 +549,8 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
548
549
  props: {},
549
550
  methods: {
550
551
  mountCB(t) {
551
- var n, i;
552
- if (a((n = this.$parent) == null ? void 0 : n.$attrs)) {
552
+ var e, i;
553
+ if (a((e = this.$parent) == null ? void 0 : e.$attrs)) {
553
554
  const o = a(this.$attrs);
554
555
  t && (this.$model = t.addColumn({ ...o, type: "series" }, (i = o.displayIndex) != null ? i : -1));
555
556
  }
@@ -559,8 +560,8 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
559
560
  },
560
561
  _doWatchAttrs(t) {
561
562
  if (t.hasOwnProperty("width") && !isNaN(t.width)) {
562
- const n = this.$data.$model.layout;
563
- n && (n.cellWidth = t.width);
563
+ const e = this.$data.$model.layout;
564
+ e && (e.cellWidth = t.width);
564
565
  }
565
566
  }
566
567
  }
@@ -681,10 +682,10 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
681
682
  },
682
683
  methods: {
683
684
  mountCB(t) {
684
- const e = a(this.$attrs);
685
- if (e.fieldName) {
686
- const n = t.getDataSource();
687
- n.fieldByName(e.fieldName) || (this.$model = n.addField(e, !0));
685
+ const n = a(this.$attrs);
686
+ if (n.fieldName) {
687
+ const e = t.getDataSource();
688
+ e.fieldByName(n.fieldName) || (this.$model = e.addField(n, !0));
688
689
  }
689
690
  },
690
691
  unmountDB(t) {
@@ -700,28 +701,28 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
700
701
  props: {},
701
702
  methods: {
702
703
  mountCB(t) {
703
- var n, i;
704
- const e = a((n = this.$parent) == null ? void 0 : n.$props);
705
- if (e) {
706
- const o = e.autoGenerateField, s = t == null ? void 0 : t.getDataSource(), r = a(this.$attrs);
704
+ var e, i;
705
+ const n = a((e = this.$parent) == null ? void 0 : e.$props);
706
+ if (n) {
707
+ const o = n.autoGenerateField, s = t == null ? void 0 : t.getDataSource(), r = a(this.$attrs);
707
708
  let c = r.fieldName;
708
709
  o && (!c && r.field && (c = r.field.fieldName), s && !s.fieldByName(c) && s.addField(r.field || c)), t && (this.$model = t.addColumn({ ...r, fieldName: c }, (i = r.displayIndex) != null ? i : -1));
709
710
  }
710
711
  },
711
712
  unmountCB(t) {
712
- var n;
713
+ var e;
713
714
  this.$data.$model && t.removeColumn(this.$data.$model.name);
714
- const e = a((n = this.$parent) == null ? void 0 : n.$props);
715
- if (e) {
716
- const i = e.autoGenerateField, o = t == null ? void 0 : t.getDataSource(), s = a(this.$attrs);
715
+ const n = a((e = this.$parent) == null ? void 0 : e.$props);
716
+ if (n) {
717
+ const i = n.autoGenerateField, o = t == null ? void 0 : t.getDataSource(), s = a(this.$attrs);
717
718
  let r = s.fieldName;
718
719
  i && (!r && s.field && (r = s.field.fieldName), t.columnByField(r) || o.removeField(r));
719
720
  }
720
721
  },
721
722
  _doWatchAttrs(t) {
722
723
  if (t.hasOwnProperty("width") && !isNaN(t.width)) {
723
- const n = this.$data.$model.layout;
724
- n && (n.cellWidth = t.width);
724
+ const e = this.$data.$model.layout;
725
+ e && (e.cellWidth = t.width);
725
726
  }
726
727
  }
727
728
  }
@@ -734,8 +735,8 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
734
735
  props: {},
735
736
  methods: {
736
737
  mountCB(t) {
737
- var n, i;
738
- if (a((n = this.$parent) == null ? void 0 : n.$attrs)) {
738
+ var e, i;
739
+ if (a((e = this.$parent) == null ? void 0 : e.$attrs)) {
739
740
  const o = a(this.$attrs);
740
741
  t && (this.$model = t.addColumn({ ...o, type: "literal" }, (i = o.displayIndex) != null ? i : -1));
741
742
  }
@@ -745,8 +746,8 @@ const C = (t) => t.replace(/-./g, (e) => e[1].toUpperCase()), f = (t) => t.charA
745
746
  },
746
747
  _doWatchAttrs(t) {
747
748
  if (t.hasOwnProperty("width") && !isNaN(t.width)) {
748
- const n = this.$data.$model.layout;
749
- n && (n.cellWidth = t.width);
749
+ const e = this.$data.$model.layout;
750
+ e && (e.cellWidth = t.width);
750
751
  }
751
752
  }
752
753
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "realgrid-vue2",
3
3
  "private": false,
4
- "version": "0.9.6",
4
+ "version": "0.9.8",
5
5
  "description": "RealGrid2 wrapping Component for Vue2",
6
6
  "author": {
7
7
  "name": "WooriTech",