realgrid-react 0.9.4 → 0.9.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/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var C=Object.defineProperty;var $=(o,r,t)=>r in o?C(o,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[r]=t;var n=(o,r,t)=>($(o,typeof r!="symbol"?r+"":r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),_=require("realgrid");function B(o){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>o[t]})}}return r.default=o,Object.freeze(r)}const u=B(_),m=(o,...r)=>(r.forEach(t=>{for(const s in t){if(s==="children")continue;const e=t[s];e===null?o[s]=null:e===void 0?delete o[s]:Array.isArray(e)?o[s]=[...e]:typeof e=="object"?e instanceof Date?o[s]=new Date(e):o[s]=m(o[s]==null?{}:o[s],e):o[s]=e}}),o),h=(o,r={},t={})=>{o=o||{};const s=["children","rows","$grid"];for(const[e,i]of Object.entries(r))if(!s.includes(e))if(!t.hasOwnProperty(e))o[e]=null;else if(Array.isArray(i))(!t[e]||JSON.stringify(i)!=JSON.stringify(t[e]))&&(o[e]=t[e]);else if(i instanceof Object&&!(i instanceof Date||Array.isArray(i)||typeof i=="function"))if(!(t[e]instanceof Object))o[e]=t[e];else{const d=h({},i,t[e]);Object.keys(d).length&&(o[e]=d)}else typeof i=="function"?i.toString()!==t[e].toString()&&(o[e]=t[e]):i!==t[e]&&(o[e]=t[e]);for(const[e,i]of Object.entries(t))s.includes(e)||r.hasOwnProperty(e)||(o[e]=i);return o};class w extends l.Component{constructor(t){super(t);n(this,"_gridView",null);n(this,"_dataProvider",null);n(this,"_mountCBs",[]);n(this,"_mountTimer");n(this,"gridContainer");this.gridContainer=l.createRef()}getProps(t){return t||{}}$_connectEvents(t,s,e){for(let i in e)i&&typeof i=="string"&&i.startsWith("on")&&(t.hasOwnProperty(i)&&(t[i]=e[i]),s.hasOwnProperty(i)&&(s[i]=e[i]),i==="onDataRowInserting"&&(s.onRowInserting=e[i]))}$_executeCallback(){if(this.gridView&&(clearTimeout(this._mountTimer),!(!this._mountCBs||!this._mountCBs.length))){this.gridView.beginUpdate();try{this.dataProvider.beginUpdate();try{for(;this._mountCBs&&this._mountCBs.length;){const t=this._mountCBs.shift();t==null||t.call(this)}}finally{this.dataProvider.endUpdate()}}finally{this.gridView.endUpdate(!0),this._mountTimer=null,this._mountCBs=[]}}}addCallback(t){this._mountCBs.push(t),clearTimeout(this._mountTimer),this._mountTimer=setTimeout(()=>{this.$_executeCallback()},20)}removeCallback(t){if(this._mountCBs){const s=this._mountCBs.indexOf(t);s>=0&&this._mountCBs.splice(s,1)}}componentDidMount(){const{grid:t,dataProvider:s,props:e}=this.createObject();if(this._gridView=t,this._dataProvider=s,this.$_executeCallback(),this.$_connectEvents(t,s,e),t.setOptions(e.gridProps||{}),s.setOptions(e.dataProps||{}),e.rowStyleCallback&&t.setRowStyleCallback(e.rowStyleCallback),e.cellStyleCallback&&t.setCellStyleCallback(e.cellStyleCallback),e.layout&&t.setColumnLayout(e.layout),e.onInitialized){const i=e.onInitialized.constructor.name;i==="Function"?e.onInitialized(t):i==="AsyncFunction"&&Promise.resolve(e.onInitialized(t))}}componentWillUnmount(){this.beforeDestroy(),this._gridView=this._gridView&&this._gridView.destroy(),this._dataProvider=this._dataProvider&&this._dataProvider.destroy()}componentDidUpdate(t,s,e){this.$_executeCallback();const i=this.getProps(this.props)||{},d=this.gridView,c=this.dataProvider;this.$_connectEvents(d,c,i);let p=h({},t.dataProps,i.dataProps);c.setOptions(p),p=h({},t.gridProps,i.gridProps),d.setOptions(p),p=h([],t.layout||[],i.layout||[]),p&&p.length>0&&d.setColumnLayout(i.layout)}render(){const t={};t.$grid=this;let s=0;const e=l.Children.map(this.props.children,i=>(i&&i.type.CType==="$$RGColumn$$"?t.displayIndex=s++:delete t.displayIndex,i&&l.cloneElement(i,t)));return l.createElement("div",{style:{width:"100%",height:"100%"},ref:i=>this.gridContainer=i},e)}}class R extends w{constructor(){super(...arguments);n(this,"createObject",()=>{var i;const t=m({},this.getProps(this.props)),s=new u.GridView(this.gridContainer,t.accessibility,t.waiOptions),e=new u.LocalDataProvider((i=t.dataProps)==null?void 0:i.undoable);return s.setDataSource(e),{grid:s,dataProvider:e,props:t}});n(this,"beforeDestroy",()=>{const t=m({},this.getProps(this.props));return t.onDestroy&&t.onDestroy.call(this,this.gridView),{props:t}})}get gridView(){return this._gridView}get dataProvider(){return this._dataProvider}componentDidMount(){var s;super.componentDidMount();const t=this.props.rows;t&&Array.isArray(t)&&t.length>0&&((s=this.dataProvider)==null||s.setRows(t))}componentDidUpdate(t,s,e){super.componentDidUpdate(t,s,e),t.rows!=this.props.rows&&this.dataProvider.setRows(this.props.rows)}}class P extends w{constructor(){super(...arguments);n(this,"createObject",()=>{var i;const t=m({},this.getProps(this.props)),s=new u.TreeView(this.gridContainer),e=new u.LocalTreeDataProvider((i=t.dataProps)==null?void 0:i.undoable);return s.setTreeOptions(t.treeOptions||{}),s.setDataSource(e),{grid:s,dataProvider:e,props:t}});n(this,"beforeDestroy",()=>{const t=m({},this.getProps(this.props));return t.onDestroy&&t.onDestroy.call(this,this.gridView),{props:t}})}get gridView(){return this._gridView}get dataProvider(){return this._dataProvider}componentDidMount(){var s,e;super.componentDidMount();const t=this.props.rows;Array.isArray(t)?(s=this.dataProvider)==null||s.setRows(t,this.props.treeField,this.props.needSorting,this.props.childrenField,this.props.iconField):(e=this.dataProvider)==null||e.setObjectRows(this.props.json,this.props.rowsProp,this.props.childrenProp,this.props.iconProp)}componentDidUpdate(t,s,e){var d,c;const i=this.props.rows;(this.props.treeField||this.props.rowsProp)&&t.rows!==i&&(Array.isArray(i)?(d=this.dataProvider)==null||d.setRows(i,this.props.treeField,this.props.needSorting,this.props.childrenField,this.props.iconField):(c=this.dataProvider)==null||c.setObjectRows(this.props.json,this.props.rowsProp,this.props.childrenProp,this.props.iconProp)),super.componentDidUpdate(t,s,e)}}class a extends l.Component{constructor(t){super(t);n(this,"$parent");n(this,"$model");this.$parent=t.$grid}_doUpdate(){}componentDidMount(){const t=this.$parent;t&&t.addCallback(this.mountCB)}componentWillUnmount(){const t=this.$parent;t&&(t.removeCallback(this.mountCB),this.unMountCB()),this.$model=null}componentDidUpdate(t,s,e){let i=h({},this.props,t);this.$model&&this.$model.assignFrom&&this.$model.assignFrom(i),this._doUpdate()}render(){return l.createElement(l.Fragment)}}class f extends a{constructor(){super(...arguments);n(this,"_column");n(this,"mountCB",()=>{const t=this.$parent.gridView;t&&(this._column=this.$model=t.addColumn({...this.props,type:"series"},this.props.displayIndex??-1))});n(this,"unMountCB",()=>{const t=this.$parent.gridView;this._column&&t&&!t._view.disposing&&t.removeColumn(this._column.name)})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}componentDidUpdate(t,s,e){if(super.componentDidUpdate(t,s,e),t.width!==this.props.width){const i=this.$model.layout;i&&(i.cellWidth=this.props.width)}}}n(f,"CType","$$RGColumn$$");class D extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setStateBar({...this.props}),this.$model=this.$parent.gridView.stateBar});n(this,"unMountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setStateBar({})})}}class V extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setRowIndicator({...this.props}),this.$model=this.$parent.gridView.rowIndicator});n(this,"unMountCB",()=>{})}}class b extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setHeaderSummaries({...this.props}),this.$model=this.$parent.gridView.headerSummaries});n(this,"unMountCB",()=>{})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}}class G extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setHeaderSummary({...this.props}),this.$model=this.$parent.gridView.headerSummary});n(this,"unMountCB",()=>{})}}class v extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setHeader({...this.props}),this.$model=this.$parent.gridView.header});n(this,"unMountCB",()=>{})}}class S extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;this.$parent.gridView instanceof u.GridView&&((t=this.$parent.gridView)==null||t.setGroupPanel({visible:!0,...this.props}),this.$model=this.$parent.gridView.groupPanel)});n(this,"unMountCB",()=>{})}}class F extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setFooter({...this.props}),this.$model=this.$parent.gridView.footer});n(this,"unMountCB",()=>{})}}class M extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setFooters({...this.props}),this.$model=this.$parent.gridView.footers});n(this,"unMountCB",()=>{})}}class x extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setFilterPanel({...this.props}),this.$model=this.$parent.gridView.filterPanel});n(this,"unMountCB",()=>{})}}class O extends a{constructor(){super(...arguments);n(this,"_field");n(this,"mountCB",()=>{const t=this.$parent.gridView,s=t==null?void 0:t.getDataSource();s&&!s.fieldByName(this.props.fieldName)&&(this._field=s.addField(this.props))});n(this,"unMountCB",()=>{if(this._field){const t=this.$parent.gridView,s=t==null?void 0:t.getDataSource();s&&s.removeField(this._field.fieldName)}})}}class g extends a{constructor(){super(...arguments);n(this,"fieldName");n(this,"mounted");n(this,"_column");n(this,"mountCB",()=>{const t=this.$parent.gridView,s=this.$parent.props.autoGenerateField,e=t==null?void 0:t.getDataSource();let i=this.props.fieldName;s&&(!i&&this.props.field&&(i=this.props.field.fieldName),e&&!e.fieldByName(i)&&e.addField(this.props.field||i)),t&&(this._column=this.$model=t.addColumn({...this.props,fieldName:i},this.props.displayIndex??-1))});n(this,"unMountCB",()=>{const t=this.$parent.gridView;if(this._column&&t&&!t._view.disposing){let s=this._column.fieldName;t.removeColumn(this._column.name);const e=this.$parent.props.autoGenerateField,i=t==null?void 0:t.getDataSource();e&&s&&i&&(t.columnByField(s)||i.removeField(s))}})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}componentDidUpdate(t,s,e){if(super.componentDidUpdate(t,s,e),t.width!==this.props.width){const i=this.$model.layout;i&&(i.cellWidth=this.props.width)}}}n(g,"CType","$$RGColumn$$");class U extends a{constructor(){super(...arguments);n(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setCheckBar({...this.props}),this.$model=this.$parent.gridView.checkBar});n(this,"unMountCB",()=>{})}}class y extends a{constructor(){super(...arguments);n(this,"_column");n(this,"mountCB",()=>{const t=this.$parent.gridView;t&&(this._column=this.$model=t.addColumn({...this.props,type:"literal"},this.props.displayIndex??-1))});n(this,"unMountCB",()=>{const t=this.$parent.gridView;this._column&&t&&!t._view.disposing&&t.removeColumn(this._column.name)})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}componentDidUpdate(t,s,e){if(super.componentDidUpdate(t,s,e),t.width!==this.props.width){const i=this.$model.layout;i&&(i.cellWidth=this.props.width)}}}n(y,"CType","$$RGColumn$$");exports.RGCheckBar=U;exports.RGDataColumn=g;exports.RGDataField=O;exports.RGFilterPanel=x;exports.RGFooter=F;exports.RGFooters=M;exports.RGGroupPanel=S;exports.RGHeader=v;exports.RGHeaderSummaries=b;exports.RGHeaderSummary=G;exports.RGLiteralColumn=y;exports.RGRowIndicator=V;exports.RGSeriesColumn=f;exports.RGStateBar=D;exports.RealGridReact=R;exports.RealTreeReact=P;
1
+ "use strict";var y=Object.defineProperty;var $=(n,r,t)=>r in n?y(n,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[r]=t;var o=(n,r,t)=>($(n,typeof r!="symbol"?r+"":r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),_=require("realgrid");function R(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return r.default=n,Object.freeze(r)}const u=R(_),m=(n,...r)=>(r.forEach(t=>{for(const i in t){if(i==="children")continue;const e=t[i];e===null?n[i]=null:e===void 0?delete n[i]:Array.isArray(e)?n[i]=[...e]:typeof e=="object"?e instanceof Date?n[i]=new Date(e):n[i]=m(n[i]==null?{}:n[i],e):n[i]=e}}),n),h=(n,r={},t={})=>{n=n||{};const i=["children","rows","$grid"];for(const[e,s]of Object.entries(r))if(!i.includes(e))if(!t.hasOwnProperty(e))n[e]=null;else if(Array.isArray(s))(!t[e]||JSON.stringify(s)!=JSON.stringify(t[e]))&&(n[e]=t[e]);else if(s instanceof Object&&!(s instanceof Date||Array.isArray(s)||typeof s=="function"))if(!(t[e]instanceof Object))n[e]=t[e];else{const d=h({},s,t[e]);Object.keys(d).length&&(n[e]=d)}else typeof s=="function"?s.toString()!==t[e].toString()&&(n[e]=t[e]):s!==t[e]&&(n[e]=t[e]);for(const[e,s]of Object.entries(t))i.includes(e)||r.hasOwnProperty(e)||(n[e]=s);return n};class w extends l.Component{constructor(t){super(t);o(this,"_gridView",null);o(this,"_dataProvider",null);o(this,"_mountCBs",[]);o(this,"_mountTimer");o(this,"_columnsChanged");o(this,"gridContainer");this.gridContainer=l.createRef()}getProps(t){return t||{}}$_connectEvents(t,i,e){for(let s in e)s&&typeof s=="string"&&s.startsWith("on")&&(t.hasOwnProperty(s)&&(t[s]=e[s]),i.hasOwnProperty(s)&&(i[s]=e[s]),s==="onDataRowInserting"&&(i.onRowInserting=e[s]))}$_executeCallback(){var t;if(this.gridView&&(clearTimeout(this._mountTimer),!(!this._mountCBs||!this._mountCBs.length))){this.gridView.beginUpdate();try{this.dataProvider.beginUpdate();try{for(;this._mountCBs&&this._mountCBs.length;){const i=this._mountCBs.shift();i==null||i.call(this)}}finally{this.dataProvider.endUpdate()}}finally{this._columnsChanged&&this.props.onRGDataColumnsChanged&&((t=this.props)==null||t.onRGDataColumnsChanged(this.gridView),this._columnsChanged=!1),this.gridView.endUpdate(!0),this._mountTimer=null,this._mountCBs=[]}}}addCallback(t,i){this._mountCBs.push(t),clearTimeout(this._mountTimer),this._columnsChanged=i==="column",this._mountTimer=setTimeout(()=>{this.$_executeCallback()},20)}removeCallback(t){if(this._mountCBs){const i=this._mountCBs.indexOf(t);i>=0&&this._mountCBs.splice(i,1)}}componentDidMount(){const{grid:t,dataProvider:i,props:e}=this.createObject();if(this._gridView=t,this._dataProvider=i,this.$_executeCallback(),this.$_connectEvents(t,i,e),t.setOptions(e.gridProps||{}),i.setOptions(e.dataProps||{}),e.rowStyleCallback&&t.setRowStyleCallback(e.rowStyleCallback),e.cellStyleCallback&&t.setCellStyleCallback(e.cellStyleCallback),e.layout&&t.setColumnLayout(e.layout),e.onInitialized){const s=e.onInitialized.constructor.name;s==="Function"?e.onInitialized(t):s==="AsyncFunction"&&Promise.resolve(e.onInitialized(t))}}componentWillUnmount(){this.beforeDestroy(),this._gridView=this._gridView&&this._gridView.destroy(),this._dataProvider=this._dataProvider&&this._dataProvider.destroy()}componentDidUpdate(t,i,e){this.$_executeCallback();const s=this.getProps(this.props)||{},d=this.gridView,c=this.dataProvider;this.$_connectEvents(d,c,s);let p=h({},t.dataProps,s.dataProps);c.setOptions(p),p=h({},t.gridProps,s.gridProps),d.setOptions(p),p=h([],t.layout||[],s.layout||[]),p&&p.length>0&&d.setColumnLayout(s.layout)}render(){const t={};t.$grid=this;let i=0;const e=l.Children.map(this.props.children,s=>(s&&s.type.CType==="$$RGColumn$$"?t.displayIndex=i++:delete t.displayIndex,s&&l.cloneElement(s,t)));return l.createElement("div",{style:{width:"100%",height:"100%"},ref:s=>this.gridContainer=s},e)}}class B extends w{constructor(){super(...arguments);o(this,"createObject",()=>{var s;const t=m({},this.getProps(this.props)),i=new u.GridView(this.gridContainer,t.accessibility,t.waiOptions),e=new u.LocalDataProvider((s=t.dataProps)==null?void 0:s.undoable);return i.setDataSource(e),{grid:i,dataProvider:e,props:t}});o(this,"beforeDestroy",()=>{const t=m({},this.getProps(this.props));return t.onDestroy&&t.onDestroy.call(this,this.gridView),{props:t}})}get gridView(){return this._gridView}get dataProvider(){return this._dataProvider}componentDidMount(){var i;super.componentDidMount();const t=this.props.rows;t&&Array.isArray(t)&&t.length>0&&((i=this.dataProvider)==null||i.setRows(t))}componentDidUpdate(t,i,e){super.componentDidUpdate(t,i,e),t.rows!=this.props.rows&&this.dataProvider.setRows(this.props.rows)}}class P extends w{constructor(){super(...arguments);o(this,"createObject",()=>{var s;const t=m({},this.getProps(this.props)),i=new u.TreeView(this.gridContainer),e=new u.LocalTreeDataProvider((s=t.dataProps)==null?void 0:s.undoable);return i.setTreeOptions(t.treeOptions||{}),i.setDataSource(e),{grid:i,dataProvider:e,props:t}});o(this,"beforeDestroy",()=>{const t=m({},this.getProps(this.props));return t.onDestroy&&t.onDestroy.call(this,this.gridView),{props:t}})}get gridView(){return this._gridView}get dataProvider(){return this._dataProvider}componentDidMount(){var i,e;super.componentDidMount();const t=this.props.rows;Array.isArray(t)?(i=this.dataProvider)==null||i.setRows(t,this.props.treeField,this.props.needSorting,this.props.childrenField,this.props.iconField):(e=this.dataProvider)==null||e.setObjectRows(this.props.json,this.props.rowsProp,this.props.childrenProp,this.props.iconProp)}componentDidUpdate(t,i,e){var d,c;const s=this.props.rows;(this.props.treeField||this.props.rowsProp)&&t.rows!==s&&(Array.isArray(s)?(d=this.dataProvider)==null||d.setRows(s,this.props.treeField,this.props.needSorting,this.props.childrenField,this.props.iconField):(c=this.dataProvider)==null||c.setObjectRows(this.props.json,this.props.rowsProp,this.props.childrenProp,this.props.iconProp)),super.componentDidUpdate(t,i,e)}}class a extends l.Component{constructor(t){super(t);o(this,"$parent");o(this,"$model");o(this,"_type");this.$parent=t.$grid}_doUpdate(){}componentDidMount(){const t=this.$parent;t&&t.addCallback(this.mountCB,this._type)}componentWillUnmount(){const t=this.$parent;t&&(t.removeCallback(this.mountCB),this.unMountCB()),this.$model=null}componentDidUpdate(t,i,e){let s=h({},this.props,t);this.$model&&this.$model.assignFrom&&this.$model.assignFrom(s),this._doUpdate()}render(){return l.createElement(l.Fragment)}}class f extends a{constructor(){super(...arguments);o(this,"_column");o(this,"mountCB",()=>{const t=this.$parent.gridView;t&&(this._column=this.$model=t.addColumn({...this.props,type:"series"},this.props.displayIndex??-1))});o(this,"unMountCB",()=>{const t=this.$parent.gridView;this._column&&t&&!t._view.disposing&&t.removeColumn(this._column.name)})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}componentDidUpdate(t,i,e){if(super.componentDidUpdate(t,i,e),t.width!==this.props.width){const s=this.$model.layout;s&&(s.cellWidth=this.props.width)}}}o(f,"CType","$$RGColumn$$");class D extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setStateBar({...this.props}),this.$model=this.$parent.gridView.stateBar});o(this,"unMountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setStateBar({})})}}class V extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setRowIndicator({...this.props}),this.$model=this.$parent.gridView.rowIndicator});o(this,"unMountCB",()=>{})}}class b extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setHeaderSummaries({...this.props}),this.$model=this.$parent.gridView.headerSummaries});o(this,"unMountCB",()=>{})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}}class G extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setHeaderSummary({...this.props}),this.$model=this.$parent.gridView.headerSummary});o(this,"unMountCB",()=>{})}}class v extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setHeader({...this.props}),this.$model=this.$parent.gridView.header});o(this,"unMountCB",()=>{})}}class S extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;this.$parent.gridView instanceof u.GridView&&((t=this.$parent.gridView)==null||t.setGroupPanel({visible:!0,...this.props}),this.$model=this.$parent.gridView.groupPanel)});o(this,"unMountCB",()=>{})}}class F extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setFooter({...this.props}),this.$model=this.$parent.gridView.footer});o(this,"unMountCB",()=>{})}}class M extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setFooters({...this.props}),this.$model=this.$parent.gridView.footers});o(this,"unMountCB",()=>{})}}class x extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setFilterPanel({...this.props}),this.$model=this.$parent.gridView.filterPanel});o(this,"unMountCB",()=>{})}}class O extends a{constructor(){super(...arguments);o(this,"_field");o(this,"mountCB",()=>{const t=this.$parent.gridView,i=t==null?void 0:t.getDataSource();i&&!i.fieldByName(this.props.fieldName)&&(this._field=i.addField(this.props))});o(this,"unMountCB",()=>{if(this._field){const t=this.$parent.gridView,i=t==null?void 0:t.getDataSource();i&&i.removeField(this._field.fieldName)}})}}class g extends a{constructor(){super(...arguments);o(this,"fieldName");o(this,"mounted");o(this,"_column");o(this,"mountCB",()=>{const t=this.$parent.gridView,i=this.$parent.props.autoGenerateField,e=t==null?void 0:t.getDataSource();let s=this.props.fieldName;i&&(!s&&this.props.field&&(s=this.props.field.fieldName),e&&!e.fieldByName(s)&&e.addField(this.props.field||s)),t&&(this._column=this.$model=t.addColumn({...this.props,fieldName:s},this.props.displayIndex??-1))});o(this,"unMountCB",()=>{const t=this.$parent.gridView;if(this._column&&t&&!t._view.disposing){let i=this._column.fieldName;t.removeColumn(this._column.name);const e=this.$parent.props.autoGenerateField,s=t==null?void 0:t.getDataSource();e&&i&&s&&(t.columnByField(i)||s.removeField(i))}})}componentDidMount(){this._type="column",super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}componentDidUpdate(t,i,e){if(super.componentDidUpdate(t,i,e),t.width!==this.props.width){const s=this.$model.layout;s&&(s.cellWidth=this.props.width)}}}o(g,"CType","$$RGColumn$$");class U extends a{constructor(){super(...arguments);o(this,"mountCB",()=>{var t;(t=this.$parent.gridView)==null||t.setCheckBar({...this.props}),this.$model=this.$parent.gridView.checkBar});o(this,"unMountCB",()=>{})}}class C extends a{constructor(){super(...arguments);o(this,"_column");o(this,"mountCB",()=>{const t=this.$parent.gridView;t&&(this._column=this.$model=t.addColumn({...this.props,type:"literal"},this.props.displayIndex??-1))});o(this,"unMountCB",()=>{const t=this.$parent.gridView;this._column&&t&&!t._view.disposing&&t.removeColumn(this._column.name)})}componentDidMount(){super.componentDidMount()}componentWillUnmount(){super.componentWillUnmount()}componentDidUpdate(t,i,e){if(super.componentDidUpdate(t,i,e),t.width!==this.props.width){const s=this.$model.layout;s&&(s.cellWidth=this.props.width)}}}o(C,"CType","$$RGColumn$$");exports.RGCheckBar=U;exports.RGDataColumn=g;exports.RGDataField=O;exports.RGFilterPanel=x;exports.RGFooter=F;exports.RGFooters=M;exports.RGGroupPanel=S;exports.RGHeader=v;exports.RGHeaderSummaries=b;exports.RGHeaderSummary=G;exports.RGLiteralColumn=C;exports.RGRowIndicator=V;exports.RGSeriesColumn=f;exports.RGStateBar=D;exports.RealGridReact=B;exports.RealTreeReact=P;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ declare abstract class ComponentBase<T extends IComponentBase> extends default_2
8
8
  constructor(props: T);
9
9
  protected abstract mountCB: () => void;
10
10
  protected abstract unMountCB: () => void;
11
+ protected _type: string;
11
12
  protected _doUpdate(): void;
12
13
  componentDidMount(): void;
13
14
  componentWillUnmount(): void;
@@ -61,6 +62,10 @@ declare interface IRealGridBaseProps<G> extends Omit<IComponentBase, '$grid'> {
61
62
  * 셀 스타일 변경을 위한 콜백
62
63
  */
63
64
  cellStyleCallback?: RealGrid.CellStyleCallback;
65
+ /**
66
+ * RGDataColumn이 변경되었을때 호출되는 콜백
67
+ */
68
+ onRGDataColumnsChanged?: (grid: GridType<G>) => void;
64
69
  gridProps?: RealGrid.GridOptions;
65
70
  layout?: (string | Exclude<RealGrid.CellLayoutGroupItem, Function> | RealGrid.CellLayoutColumnItem)[];
66
71
  onCurrentChanging?: (grid: GridType<G>, oldIndex: RealGrid.CellIndex, newIndex: RealGrid.CellIndex) => boolean;
@@ -257,6 +262,7 @@ declare abstract class RealBaseReact<G, T = {}> extends default_2.Component<T &
257
262
  protected _dataProvider: RealGrid.DataProviderBase | null;
258
263
  private _mountCBs;
259
264
  private _mountTimer;
265
+ protected _columnsChanged: boolean;
260
266
  protected gridContainer: default_2.LegacyRef<HTMLDivElement>;
261
267
  constructor(props: T);
262
268
  abstract get gridView(): GridType<G>;
@@ -272,7 +278,7 @@ declare abstract class RealBaseReact<G, T = {}> extends default_2.Component<T &
272
278
  protected getProps(props: T): T;
273
279
  private $_connectEvents;
274
280
  private $_executeCallback;
275
- addCallback(callback: Function): void;
281
+ addCallback(callback: Function, type: string): void;
276
282
  removeCallback(callback: Function): void;
277
283
  componentDidMount(): void;
278
284
  componentWillUnmount(): void;
package/dist/index.es.js CHANGED
@@ -4,32 +4,32 @@ var o = (n, r, t) => (C(n, typeof r != "symbol" ? r + "" : r, t), t);
4
4
  import p from "react";
5
5
  import * as u from "realgrid";
6
6
  const m = (n, ...r) => (r.forEach((t) => {
7
- for (const s in t) {
8
- if (s === "children")
7
+ for (const i in t) {
8
+ if (i === "children")
9
9
  continue;
10
- const e = t[s];
11
- e === null ? n[s] = null : e === void 0 ? delete n[s] : Array.isArray(e) ? n[s] = [...e] : typeof e == "object" ? e instanceof Date ? n[s] = new Date(e) : n[s] = m(n[s] == null ? {} : n[s], e) : n[s] = e;
10
+ const e = t[i];
11
+ e === null ? n[i] = null : e === void 0 ? delete n[i] : Array.isArray(e) ? n[i] = [...e] : typeof e == "object" ? e instanceof Date ? n[i] = new Date(e) : n[i] = m(n[i] == null ? {} : n[i], e) : n[i] = e;
12
12
  }
13
13
  }), n), c = (n, r = {}, t = {}) => {
14
14
  n = n || {};
15
- const s = ["children", "rows", "$grid"];
16
- for (const [e, i] of Object.entries(r))
17
- if (!s.includes(e))
15
+ const i = ["children", "rows", "$grid"];
16
+ for (const [e, s] of Object.entries(r))
17
+ if (!i.includes(e))
18
18
  if (!t.hasOwnProperty(e))
19
19
  n[e] = null;
20
- else if (Array.isArray(i))
21
- (!t[e] || JSON.stringify(i) != JSON.stringify(t[e])) && (n[e] = t[e]);
22
- else if (i instanceof Object && !(i instanceof Date || Array.isArray(i) || typeof i == "function"))
20
+ else if (Array.isArray(s))
21
+ (!t[e] || JSON.stringify(s) != JSON.stringify(t[e])) && (n[e] = t[e]);
22
+ else if (s instanceof Object && !(s instanceof Date || Array.isArray(s) || typeof s == "function"))
23
23
  if (!(t[e] instanceof Object))
24
24
  n[e] = t[e];
25
25
  else {
26
- const d = c({}, i, t[e]);
26
+ const d = c({}, s, t[e]);
27
27
  Object.keys(d).length && (n[e] = d);
28
28
  }
29
29
  else
30
- typeof i == "function" ? i.toString() !== t[e].toString() && (n[e] = t[e]) : i !== t[e] && (n[e] = t[e]);
31
- for (const [e, i] of Object.entries(t))
32
- s.includes(e) || r.hasOwnProperty(e) || (n[e] = i);
30
+ typeof s == "function" ? s.toString() !== t[e].toString() && (n[e] = t[e]) : s !== t[e] && (n[e] = t[e]);
31
+ for (const [e, s] of Object.entries(t))
32
+ i.includes(e) || r.hasOwnProperty(e) || (n[e] = s);
33
33
  return n;
34
34
  };
35
35
  class w extends p.Component {
@@ -41,6 +41,7 @@ class w extends p.Component {
41
41
  // field
42
42
  o(this, "_mountCBs", []);
43
43
  o(this, "_mountTimer");
44
+ o(this, "_columnsChanged");
44
45
  o(this, "gridContainer");
45
46
  this.gridContainer = p.createRef();
46
47
  }
@@ -48,73 +49,74 @@ class w extends p.Component {
48
49
  return t || {};
49
50
  }
50
51
  // private methods
51
- $_connectEvents(t, s, e) {
52
- for (let i in e)
53
- i && typeof i == "string" && i.startsWith("on") && (t.hasOwnProperty(i) && (t[i] = e[i]), s.hasOwnProperty(i) && (s[i] = e[i]), i === "onDataRowInserting" && (s.onRowInserting = e[i]));
52
+ $_connectEvents(t, i, e) {
53
+ for (let s in e)
54
+ s && typeof s == "string" && s.startsWith("on") && (t.hasOwnProperty(s) && (t[s] = e[s]), i.hasOwnProperty(s) && (i[s] = e[s]), s === "onDataRowInserting" && (i.onRowInserting = e[s]));
54
55
  }
55
56
  $_executeCallback() {
57
+ var t;
56
58
  if (this.gridView && (clearTimeout(this._mountTimer), !(!this._mountCBs || !this._mountCBs.length))) {
57
59
  this.gridView.beginUpdate();
58
60
  try {
59
61
  this.dataProvider.beginUpdate();
60
62
  try {
61
63
  for (; this._mountCBs && this._mountCBs.length; ) {
62
- const t = this._mountCBs.shift();
63
- t == null || t.call(this);
64
+ const i = this._mountCBs.shift();
65
+ i == null || i.call(this);
64
66
  }
65
67
  } finally {
66
68
  this.dataProvider.endUpdate();
67
69
  }
68
70
  } finally {
69
- this.gridView.endUpdate(!0), this._mountTimer = null, this._mountCBs = [];
71
+ this._columnsChanged && this.props.onRGDataColumnsChanged && ((t = this.props) == null || t.onRGDataColumnsChanged(this.gridView), this._columnsChanged = !1), this.gridView.endUpdate(!0), this._mountTimer = null, this._mountCBs = [];
70
72
  }
71
73
  }
72
74
  }
73
75
  // public Method
74
- addCallback(t) {
75
- this._mountCBs.push(t), clearTimeout(this._mountTimer), this._mountTimer = setTimeout(() => {
76
+ addCallback(t, i) {
77
+ this._mountCBs.push(t), clearTimeout(this._mountTimer), this._columnsChanged = i === "column", this._mountTimer = setTimeout(() => {
76
78
  this.$_executeCallback();
77
79
  }, 20);
78
80
  }
79
81
  removeCallback(t) {
80
82
  if (this._mountCBs) {
81
- const s = this._mountCBs.indexOf(t);
82
- s >= 0 && this._mountCBs.splice(s, 1);
83
+ const i = this._mountCBs.indexOf(t);
84
+ i >= 0 && this._mountCBs.splice(i, 1);
83
85
  }
84
86
  }
85
87
  componentDidMount() {
86
- const { grid: t, dataProvider: s, props: e } = this.createObject();
87
- if (this._gridView = t, this._dataProvider = s, this.$_executeCallback(), this.$_connectEvents(t, s, e), t.setOptions(e.gridProps || {}), s.setOptions(e.dataProps || {}), e.rowStyleCallback && t.setRowStyleCallback(e.rowStyleCallback), e.cellStyleCallback && t.setCellStyleCallback(e.cellStyleCallback), e.layout && t.setColumnLayout(e.layout), e.onInitialized) {
88
- const i = e.onInitialized.constructor.name;
89
- i === "Function" ? e.onInitialized(t) : i === "AsyncFunction" && Promise.resolve(e.onInitialized(t));
88
+ const { grid: t, dataProvider: i, props: e } = this.createObject();
89
+ if (this._gridView = t, this._dataProvider = i, this.$_executeCallback(), this.$_connectEvents(t, i, e), t.setOptions(e.gridProps || {}), i.setOptions(e.dataProps || {}), e.rowStyleCallback && t.setRowStyleCallback(e.rowStyleCallback), e.cellStyleCallback && t.setCellStyleCallback(e.cellStyleCallback), e.layout && t.setColumnLayout(e.layout), e.onInitialized) {
90
+ const s = e.onInitialized.constructor.name;
91
+ s === "Function" ? e.onInitialized(t) : s === "AsyncFunction" && Promise.resolve(e.onInitialized(t));
90
92
  }
91
93
  }
92
94
  componentWillUnmount() {
93
95
  this.beforeDestroy(), this._gridView = this._gridView && this._gridView.destroy(), this._dataProvider = this._dataProvider && this._dataProvider.destroy();
94
96
  }
95
- componentDidUpdate(t, s, e) {
97
+ componentDidUpdate(t, i, e) {
96
98
  this.$_executeCallback();
97
- const i = this.getProps(this.props) || {}, d = this.gridView, h = this.dataProvider;
98
- this.$_connectEvents(d, h, i);
99
- let l = c({}, t.dataProps, i.dataProps);
100
- h.setOptions(l), l = c({}, t.gridProps, i.gridProps), d.setOptions(l), l = c([], t.layout || [], i.layout || []), l && l.length > 0 && d.setColumnLayout(i.layout);
99
+ const s = this.getProps(this.props) || {}, d = this.gridView, h = this.dataProvider;
100
+ this.$_connectEvents(d, h, s);
101
+ let l = c({}, t.dataProps, s.dataProps);
102
+ h.setOptions(l), l = c({}, t.gridProps, s.gridProps), d.setOptions(l), l = c([], t.layout || [], s.layout || []), l && l.length > 0 && d.setColumnLayout(s.layout);
101
103
  }
102
104
  render() {
103
105
  const t = {};
104
106
  t.$grid = this;
105
- let s = 0;
106
- const e = p.Children.map(this.props.children, (i) => (i && i.type.CType === "$$RGColumn$$" ? t.displayIndex = s++ : delete t.displayIndex, i && p.cloneElement(i, t)));
107
- return p.createElement("div", { style: { width: "100%", height: "100%" }, ref: (i) => this.gridContainer = i }, e);
107
+ let i = 0;
108
+ const e = p.Children.map(this.props.children, (s) => (s && s.type.CType === "$$RGColumn$$" ? t.displayIndex = i++ : delete t.displayIndex, s && p.cloneElement(s, t)));
109
+ return p.createElement("div", { style: { width: "100%", height: "100%" }, ref: (s) => this.gridContainer = s }, e);
108
110
  }
109
111
  }
110
- class P extends w {
112
+ class D extends w {
111
113
  constructor() {
112
114
  super(...arguments);
113
115
  o(this, "createObject", () => {
114
- var i;
115
- const t = m({}, this.getProps(this.props)), s = new u.GridView(this.gridContainer, t.accessibility, t.waiOptions), e = new u.LocalDataProvider((i = t.dataProps) == null ? void 0 : i.undoable);
116
- return s.setDataSource(e), {
117
- grid: s,
116
+ var s;
117
+ const t = m({}, this.getProps(this.props)), i = new u.GridView(this.gridContainer, t.accessibility, t.waiOptions), e = new u.LocalDataProvider((s = t.dataProps) == null ? void 0 : s.undoable);
118
+ return i.setDataSource(e), {
119
+ grid: i,
118
120
  dataProvider: e,
119
121
  props: t
120
122
  };
@@ -131,23 +133,23 @@ class P extends w {
131
133
  return this._dataProvider;
132
134
  }
133
135
  componentDidMount() {
134
- var s;
136
+ var i;
135
137
  super.componentDidMount();
136
138
  const t = this.props.rows;
137
- t && Array.isArray(t) && t.length > 0 && ((s = this.dataProvider) == null || s.setRows(t));
139
+ t && Array.isArray(t) && t.length > 0 && ((i = this.dataProvider) == null || i.setRows(t));
138
140
  }
139
- componentDidUpdate(t, s, e) {
140
- super.componentDidUpdate(t, s, e), t.rows != this.props.rows && this.dataProvider.setRows(this.props.rows);
141
+ componentDidUpdate(t, i, e) {
142
+ super.componentDidUpdate(t, i, e), t.rows != this.props.rows && this.dataProvider.setRows(this.props.rows);
141
143
  }
142
144
  }
143
- class V extends w {
145
+ class P extends w {
144
146
  constructor() {
145
147
  super(...arguments);
146
148
  o(this, "createObject", () => {
147
- var i;
148
- const t = m({}, this.getProps(this.props)), s = new u.TreeView(this.gridContainer), e = new u.LocalTreeDataProvider((i = t.dataProps) == null ? void 0 : i.undoable);
149
- return s.setTreeOptions(t.treeOptions || {}), s.setDataSource(e), {
150
- grid: s,
149
+ var s;
150
+ const t = m({}, this.getProps(this.props)), i = new u.TreeView(this.gridContainer), e = new u.LocalTreeDataProvider((s = t.dataProps) == null ? void 0 : s.undoable);
151
+ return i.setTreeOptions(t.treeOptions || {}), i.setDataSource(e), {
152
+ grid: i,
151
153
  dataProvider: e,
152
154
  props: t
153
155
  };
@@ -164,15 +166,15 @@ class V extends w {
164
166
  return this._dataProvider;
165
167
  }
166
168
  componentDidMount() {
167
- var s, e;
169
+ var i, e;
168
170
  super.componentDidMount();
169
171
  const t = this.props.rows;
170
- Array.isArray(t) ? (s = this.dataProvider) == null || s.setRows(t, this.props.treeField, this.props.needSorting, this.props.childrenField, this.props.iconField) : (e = this.dataProvider) == null || e.setObjectRows(this.props.json, this.props.rowsProp, this.props.childrenProp, this.props.iconProp);
172
+ Array.isArray(t) ? (i = this.dataProvider) == null || i.setRows(t, this.props.treeField, this.props.needSorting, this.props.childrenField, this.props.iconField) : (e = this.dataProvider) == null || e.setObjectRows(this.props.json, this.props.rowsProp, this.props.childrenProp, this.props.iconProp);
171
173
  }
172
- componentDidUpdate(t, s, e) {
174
+ componentDidUpdate(t, i, e) {
173
175
  var d, h;
174
- const i = this.props.rows;
175
- (this.props.treeField || this.props.rowsProp) && t.rows !== i && (Array.isArray(i) ? (d = this.dataProvider) == null || d.setRows(i, this.props.treeField, this.props.needSorting, this.props.childrenField, this.props.iconField) : (h = this.dataProvider) == null || h.setObjectRows(this.props.json, this.props.rowsProp, this.props.childrenProp, this.props.iconProp)), super.componentDidUpdate(t, s, e);
176
+ const s = this.props.rows;
177
+ (this.props.treeField || this.props.rowsProp) && t.rows !== s && (Array.isArray(s) ? (d = this.dataProvider) == null || d.setRows(s, this.props.treeField, this.props.needSorting, this.props.childrenField, this.props.iconField) : (h = this.dataProvider) == null || h.setObjectRows(this.props.json, this.props.rowsProp, this.props.childrenProp, this.props.iconProp)), super.componentDidUpdate(t, i, e);
176
178
  }
177
179
  }
178
180
  class a extends p.Component {
@@ -181,27 +183,28 @@ class a extends p.Component {
181
183
  super(t);
182
184
  o(this, "$parent");
183
185
  o(this, "$model");
186
+ o(this, "_type");
184
187
  this.$parent = t.$grid;
185
188
  }
186
189
  _doUpdate() {
187
190
  }
188
191
  componentDidMount() {
189
192
  const t = this.$parent;
190
- t && t.addCallback(this.mountCB);
193
+ t && t.addCallback(this.mountCB, this._type);
191
194
  }
192
195
  componentWillUnmount() {
193
196
  const t = this.$parent;
194
197
  t && (t.removeCallback(this.mountCB), this.unMountCB()), this.$model = null;
195
198
  }
196
- componentDidUpdate(t, s, e) {
197
- let i = c({}, this.props, t);
198
- this.$model && this.$model.assignFrom && this.$model.assignFrom(i), this._doUpdate();
199
+ componentDidUpdate(t, i, e) {
200
+ let s = c({}, this.props, t);
201
+ this.$model && this.$model.assignFrom && this.$model.assignFrom(s), this._doUpdate();
199
202
  }
200
203
  render() {
201
204
  return p.createElement(p.Fragment);
202
205
  }
203
206
  }
204
- class $ extends a {
207
+ class g extends a {
205
208
  constructor() {
206
209
  super(...arguments);
207
210
  o(this, "_column");
@@ -220,15 +223,15 @@ class $ extends a {
220
223
  componentWillUnmount() {
221
224
  super.componentWillUnmount();
222
225
  }
223
- componentDidUpdate(t, s, e) {
224
- if (super.componentDidUpdate(t, s, e), t.width !== this.props.width) {
225
- const i = this.$model.layout;
226
- i && (i.cellWidth = this.props.width);
226
+ componentDidUpdate(t, i, e) {
227
+ if (super.componentDidUpdate(t, i, e), t.width !== this.props.width) {
228
+ const s = this.$model.layout;
229
+ s && (s.cellWidth = this.props.width);
227
230
  }
228
231
  }
229
232
  }
230
- o($, "CType", "$$RGColumn$$");
231
- class D extends a {
233
+ o(g, "CType", "$$RGColumn$$");
234
+ class V extends a {
232
235
  constructor() {
233
236
  super(...arguments);
234
237
  o(this, "mountCB", () => {
@@ -252,7 +255,7 @@ class v extends a {
252
255
  });
253
256
  }
254
257
  }
255
- class b extends a {
258
+ class R extends a {
256
259
  constructor() {
257
260
  super(...arguments);
258
261
  o(this, "mountCB", () => {
@@ -269,7 +272,7 @@ class b extends a {
269
272
  super.componentWillUnmount();
270
273
  }
271
274
  }
272
- class R extends a {
275
+ class b extends a {
273
276
  constructor() {
274
277
  super(...arguments);
275
278
  o(this, "mountCB", () => {
@@ -335,58 +338,58 @@ class U extends a {
335
338
  });
336
339
  }
337
340
  }
338
- class O extends a {
341
+ class G extends a {
339
342
  constructor() {
340
343
  super(...arguments);
341
344
  o(this, "_field");
342
345
  o(this, "mountCB", () => {
343
- const t = this.$parent.gridView, s = t == null ? void 0 : t.getDataSource();
344
- s && !s.fieldByName(this.props.fieldName) && (this._field = s.addField(this.props));
346
+ const t = this.$parent.gridView, i = t == null ? void 0 : t.getDataSource();
347
+ i && !i.fieldByName(this.props.fieldName) && (this._field = i.addField(this.props));
345
348
  });
346
349
  o(this, "unMountCB", () => {
347
350
  if (this._field) {
348
- const t = this.$parent.gridView, s = t == null ? void 0 : t.getDataSource();
349
- s && s.removeField(this._field.fieldName);
351
+ const t = this.$parent.gridView, i = t == null ? void 0 : t.getDataSource();
352
+ i && i.removeField(this._field.fieldName);
350
353
  }
351
354
  });
352
355
  }
353
356
  }
354
- class g extends a {
357
+ class y extends a {
355
358
  constructor() {
356
359
  super(...arguments);
357
360
  o(this, "fieldName");
358
361
  o(this, "mounted");
359
362
  o(this, "_column");
360
363
  o(this, "mountCB", () => {
361
- const t = this.$parent.gridView, s = this.$parent.props.autoGenerateField, e = t == null ? void 0 : t.getDataSource();
362
- let i = this.props.fieldName;
363
- s && (!i && this.props.field && (i = this.props.field.fieldName), e && !e.fieldByName(i) && e.addField(this.props.field || i)), t && (this._column = this.$model = t.addColumn({ ...this.props, fieldName: i }, this.props.displayIndex ?? -1));
364
+ const t = this.$parent.gridView, i = this.$parent.props.autoGenerateField, e = t == null ? void 0 : t.getDataSource();
365
+ let s = this.props.fieldName;
366
+ i && (!s && this.props.field && (s = this.props.field.fieldName), e && !e.fieldByName(s) && e.addField(this.props.field || s)), t && (this._column = this.$model = t.addColumn({ ...this.props, fieldName: s }, this.props.displayIndex ?? -1));
364
367
  });
365
368
  o(this, "unMountCB", () => {
366
369
  const t = this.$parent.gridView;
367
370
  if (this._column && t && !t._view.disposing) {
368
- let s = this._column.fieldName;
371
+ let i = this._column.fieldName;
369
372
  t.removeColumn(this._column.name);
370
- const e = this.$parent.props.autoGenerateField, i = t == null ? void 0 : t.getDataSource();
371
- e && s && i && (t.columnByField(s) || i.removeField(s));
373
+ const e = this.$parent.props.autoGenerateField, s = t == null ? void 0 : t.getDataSource();
374
+ e && i && s && (t.columnByField(i) || s.removeField(i));
372
375
  }
373
376
  });
374
377
  }
375
378
  componentDidMount() {
376
- super.componentDidMount();
379
+ this._type = "column", super.componentDidMount();
377
380
  }
378
381
  componentWillUnmount() {
379
382
  super.componentWillUnmount();
380
383
  }
381
- componentDidUpdate(t, s, e) {
382
- if (super.componentDidUpdate(t, s, e), t.width !== this.props.width) {
383
- const i = this.$model.layout;
384
- i && (i.cellWidth = this.props.width);
384
+ componentDidUpdate(t, i, e) {
385
+ if (super.componentDidUpdate(t, i, e), t.width !== this.props.width) {
386
+ const s = this.$model.layout;
387
+ s && (s.cellWidth = this.props.width);
385
388
  }
386
389
  }
387
390
  }
388
- o(g, "CType", "$$RGColumn$$");
389
- class G extends a {
391
+ o(y, "CType", "$$RGColumn$$");
392
+ class O extends a {
390
393
  constructor() {
391
394
  super(...arguments);
392
395
  o(this, "mountCB", () => {
@@ -397,7 +400,7 @@ class G extends a {
397
400
  });
398
401
  }
399
402
  }
400
- class y extends a {
403
+ class $ extends a {
401
404
  constructor() {
402
405
  super(...arguments);
403
406
  o(this, "_column");
@@ -416,29 +419,29 @@ class y extends a {
416
419
  componentWillUnmount() {
417
420
  super.componentWillUnmount();
418
421
  }
419
- componentDidUpdate(t, s, e) {
420
- if (super.componentDidUpdate(t, s, e), t.width !== this.props.width) {
421
- const i = this.$model.layout;
422
- i && (i.cellWidth = this.props.width);
422
+ componentDidUpdate(t, i, e) {
423
+ if (super.componentDidUpdate(t, i, e), t.width !== this.props.width) {
424
+ const s = this.$model.layout;
425
+ s && (s.cellWidth = this.props.width);
423
426
  }
424
427
  }
425
428
  }
426
- o(y, "CType", "$$RGColumn$$");
429
+ o($, "CType", "$$RGColumn$$");
427
430
  export {
428
- G as RGCheckBar,
429
- g as RGDataColumn,
430
- O as RGDataField,
431
+ O as RGCheckBar,
432
+ y as RGDataColumn,
433
+ G as RGDataField,
431
434
  U as RGFilterPanel,
432
435
  S as RGFooter,
433
436
  F as RGFooters,
434
437
  M as RGGroupPanel,
435
438
  x as RGHeader,
436
- b as RGHeaderSummaries,
437
- R as RGHeaderSummary,
438
- y as RGLiteralColumn,
439
+ R as RGHeaderSummaries,
440
+ b as RGHeaderSummary,
441
+ $ as RGLiteralColumn,
439
442
  v as RGRowIndicator,
440
- $ as RGSeriesColumn,
441
- D as RGStateBar,
442
- P as RealGridReact,
443
- V as RealTreeReact
443
+ g as RGSeriesColumn,
444
+ V as RGStateBar,
445
+ D as RealGridReact,
446
+ P as RealTreeReact
444
447
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "realgrid-react",
3
3
  "private": false,
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "description": "RealGrid2 wrapping Component for React",
6
6
  "author": {
7
7
  "name": "WooriTech",