realgrid-react 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # RealGrid-React
2
+
3
+ ## Overview
4
+ `realgrid-react` is a React component for integrating RealGrid into your React applications. It provides a seamless way to add powerful grid functionalities to your project.
5
+
6
+ [RealGrid](https://www.npmjs.com/package/realgrid) React Wrapper
7
+
8
+ ## Table of Contents
9
+
10
+ - [Install](#install)
11
+ - [License](#license)
12
+ - [Usage](#usage)
13
+ - [Styles](#styles)
14
+ - [Library Target](#library-target)
15
+ - [Example](#example)
16
+ - [Support](#support)
17
+
18
+ ## Installation
19
+ To install the `realgrid-react` component, use npm or yarn:
20
+
21
+ ```bash
22
+ npm install realgrid-react
23
+ # or
24
+ yarn add realgrid-react
25
+ ```
26
+
27
+ ### License
28
+
29
+ > The License file is required for proper use. More information, visit: http://service.realgrid.com/start
30
+
31
+ ## Usage
32
+
33
+ ### basic example
34
+ Here's a basic example of how to use realgrid-react in your project:
35
+
36
+ ```jsx
37
+
38
+ import RealGrid from 'realgrid'
39
+ import '/realgrid/dist/realgrid-style.css'
40
+ import { useRef } from 'react'
41
+ import { RGDataColumn, RealGridReact } from 'realgrid-react'
42
+
43
+ const RealGridComponent = () => {
44
+ const grid = useRef(null)
45
+ const data = [
46
+ { id: 1, name: 'John Doe', age: 30 },
47
+ { id: 2, name: 'Jane Smith', age: 27 },
48
+ { id: 3, name: 'Alice Johnson', age: 35 },
49
+ { id: 4, name: 'Bob Brown', age: 22 },
50
+ { id: 5, name: 'Charlie Davis', age: 28 },
51
+ { id: 6, name: 'Dana White', age: 33 }
52
+ ]
53
+ RealGrid.setLicenseKey('Your LicenseKey')
54
+
55
+ return (
56
+ <>
57
+ <div style={{ width: '100%', height: '550px' }}>
58
+ <RealGridReact ref={grid} rows={data} autoGenerateField={true}>
59
+ <RGDataColumn name='id' fieldName='id' />
60
+ <RGDataColumn name='name' fieldName='name' />
61
+ <RGDataColumn name='age' fieldName='age' />
62
+ </RealGridReact>
63
+ </div>
64
+ </>
65
+ )
66
+ }
67
+
68
+ export default RealGridComponent
69
+
70
+
71
+ ```
72
+
73
+
74
+ ### styles
75
+
76
+ - The themes are located in './dist'
77
+
78
+ ``` jsx
79
+ import "../node_modules/realgrid/dist/realgrid-style.css";
80
+ ```
81
+
82
+ ### Library Target
83
+
84
+ - index.es.js for ES
85
+ - index.cjs.js for commonjs
86
+
87
+
88
+
89
+ ### Example
90
+ > visit: https://github.com/realgrid/realgrid2-examples
91
+
92
+ ### Support
93
+ If you encounter any issues or have questions,
94
+ please open an issue on GitHub or contact our support team at support@realgrid.com
95
+ or visit https://docs.realgrid.com/
@@ -0,0 +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){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(),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;
@@ -0,0 +1,437 @@
1
+ import { default as default_2 } from 'react';
2
+ import { ReactNode } from 'react';
3
+ import * as RealGrid from 'realgrid';
4
+
5
+ declare abstract class ComponentBase<T extends IComponentBase> extends default_2.Component<T> {
6
+ protected $parent?: RealBaseReact<{}>;
7
+ protected $model?: any;
8
+ constructor(props: T);
9
+ protected abstract mountCB: () => void;
10
+ protected abstract unMountCB: () => void;
11
+ protected _doUpdate(): void;
12
+ componentDidMount(): void;
13
+ componentWillUnmount(): void;
14
+ componentDidUpdate(prevProps: Readonly<{
15
+ [key in keyof T]: T[key];
16
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
17
+ render(): default_2.FunctionComponentElement<{
18
+ children?: default_2.ReactNode;
19
+ }>;
20
+ }
21
+
22
+ declare type GridType<G> = G extends RealGrid.GridView ? RealGrid.GridView : G extends RealGrid.TreeView ? RealGrid.TreeView : any;
23
+
24
+ declare interface IComponentBase {
25
+ children?: ReactNode;
26
+ $grid?: RealBaseReact<{}>;
27
+ }
28
+
29
+ declare interface IRealGridBaseProps<G> extends Omit<IComponentBase, '$grid'> {
30
+ /**
31
+ * DataField생성 여부.
32
+ *
33
+ * @remarks
34
+ * `true`이면 Column생성시 DataField도 생성한다.
35
+ *
36
+ * @defaultValue `false`
37
+ */
38
+ autoGenerateField?: boolean;
39
+ /**
40
+ * 그리드에 표시할 Data
41
+ */
42
+ rows?: RealGrid.DataValues[];
43
+ /**
44
+ * 그리드가 생성된 이후 호출된다.
45
+ *
46
+ * @param grid - 그리드 객체
47
+ * @returns
48
+ */
49
+ onInitialized?: (grid: GridType<G>) => void;
50
+ /**
51
+ * 그리드가 제거되기 직전에 호출된다.
52
+ * @param grid - 그리드 객체
53
+ * @returns
54
+ */
55
+ onDestroy?: (grid: GridType<G>) => void;
56
+ /**
57
+ * 행 스타일 변경을 위한 콜백
58
+ */
59
+ rowStyleCallback?: RealGrid.RowStyleCallback;
60
+ /**
61
+ * 셀 스타일 변경을 위한 콜백
62
+ */
63
+ cellStyleCallback?: RealGrid.CellStyleCallback;
64
+ gridProps?: RealGrid.GridOptions;
65
+ layout?: (string | Exclude<RealGrid.CellLayoutGroupItem, Function> | RealGrid.CellLayoutColumnItem)[];
66
+ onCurrentChanging?: (grid: GridType<G>, oldIndex: RealGrid.CellIndex, newIndex: RealGrid.CellIndex) => boolean;
67
+ onCurrentChanged?: (grid: GridType<G>, newIndex: RealGrid.CellIndex) => void;
68
+ onCurrentRowChanged?: (grid: GridType<G>, oldRow: number, newRow: number) => void;
69
+ onValidateColumn?: (grid: GridType<G>, column: RealGrid.GridColumn, inserting: boolean, value: any, itemIndex: number, dataRow: number) => RealGrid.ValidationError;
70
+ onValidateRow?: (grid: GridType<G>, itemIndex: number, dataRow: number, inserting: boolean, values: any[]) => RealGrid.ValidationError;
71
+ onValidationFail?: (grid: GridType<G>, itemIndex: number, column: RealGrid.GridColumn, error: RealGrid.ValidationError) => RealGrid.ValidationError;
72
+ onColumnCheckedChanged?: (grid: GridType<G>, column: RealGrid.GridColumn, checked: boolean) => void;
73
+ onMenuItemClicked?: (grid: GridType<G>, item: RealGrid.PopupMenuItem, clickData: RealGrid.ClickData) => void;
74
+ onContextMenuPopup?: (grid: GridType<G>, x: number, y: number, clickData: RealGrid.ClickData, menu: string, rightClick: boolean) => boolean | string;
75
+ onContextMenuItemClicked?: (grid: GridType<G>, item: RealGrid.PopupMenuItem, clickData: RealGrid.ClickData) => void;
76
+ onCellButtonClicked?: (grid: GridType<G>, index: RealGrid.CellIndex, column: RealGrid.GridColumn) => void;
77
+ onScrollToBottom?: (grid: GridType<G>) => void;
78
+ onTopIndexChanged?: (grid: GridType<G>, itemIndex: number) => void;
79
+ onTopIndexChanging?: (grid: GridType<G>, currentTop: number, delta: number, focusing: boolean, adjust: boolean) => number;
80
+ onLeftPosChanged?: (grid: GridType<G>, pos: number) => void;
81
+ onRowsDeleting?: (grid: GridType<G>, rows: number[]) => boolean;
82
+ onRowInserting?: (grid: GridType<G>, itemIndex: number, dataRow: number) => boolean;
83
+ onSelectionCleared?: (grid: GridType<G>) => void;
84
+ onSelectionChanged?: (grid: GridType<G>, selection: Selection) => void;
85
+ onSelectionAdded?: (grid: GridType<G>, selection: Selection) => void;
86
+ onSelectionEnded?: (grid: GridType<G>, selection: Selection) => void;
87
+ onShowEditor?: (grid: GridType<G>, index: RealGrid.CellIndex, props: any, attrs: any) => boolean;
88
+ onShowEditCommand?: (grid: GridType<G>, index: RealGrid.CellIndex) => boolean;
89
+ onHideEditor?: (grid: GridType<G>, index: RealGrid.CellIndex) => void;
90
+ onEditChange?: (grid: GridType<G>, index: RealGrid.CellIndex, value: any) => void;
91
+ onGetEditValue?: (grid: GridType<G>, index: RealGrid.CellIndex, editResult: Object) => void;
92
+ onEditCommit?: (grid: GridType<G>, index: RealGrid.CellIndex, oldValue: any, newValue: any) => boolean;
93
+ onEditCanceled?: (grid: GridType<G>, index: RealGrid.CellIndex) => void;
94
+ onItemEditCanceled?: (grid: GridType<G>, itemIndex: number, state: string) => void;
95
+ onItemEditCancel?: (grid: GridType<G>, itemIndex: number, state: string) => boolean;
96
+ onEditSearch?: (grid: GridType<G>, index: RealGrid.CellIndex, text: string) => void;
97
+ onSearchCellButtonClick?: (grid: GridType<G>, index: RealGrid.CellIndex, text: string) => void;
98
+ onCellEdited?: (grid: GridType<G>, itemIndex: number, row: number, field: number) => void;
99
+ onEditRowChanged?: (grid: GridType<G>, itemIndex: number, row: number, field: number, oldValue: any, newValue: any) => void;
100
+ onEditRowPasted?: (grid: GridType<G>, itemIndex: number, row: number, fields: number[], oldValues: any[], newValues: any[]) => void;
101
+ onRowsPasted?: (grid: GridType<G>, items: number[]) => void;
102
+ onCellPasting?: (grid: GridType<G>, index: RealGrid.CellIndex, value: any) => boolean;
103
+ onItemChecked?: (grid: GridType<G>, itemIndex: number, checked: boolean) => void;
104
+ onItemAllChecked?: (grid: GridType<G>, checked: boolean) => void;
105
+ onErrorClicked?: (grid: GridType<G>, error: string) => void;
106
+ onSorting?: (grid: GridType<G>, fields: number[], directions: string[]) => boolean;
107
+ onSortingChanged?: (grid: GridType<G>) => void;
108
+ onFiltering?: (grid: GridType<G>) => boolean;
109
+ onFilteringChanged?: (grid: GridType<G>, column: RealGrid.GridColumn, filter: RealGrid.ColumnFilter) => void;
110
+ onWheel?: (grid: GridType<G>, event: WheelEvent) => boolean;
111
+ onKeyDown?: (grid: GridType<G>, event: KeyboardEvent) => boolean;
112
+ onKeyPress?: (grid: GridType<G>, event: KeyboardEvent) => void;
113
+ onKeyUp?: (grid: GridType<G>, event: KeyboardEvent) => void;
114
+ onShowTooltip?: (grid: GridType<G>, index: RealGrid.CellIndex, value: any) => boolean | string;
115
+ onShowHeaderTooltip?: (grid: GridType<G>, column: RealGrid.GridColumn, value: any, layout: RealGrid.CellLayoutItem) => any;
116
+ onColumnPropertyChanged?: (grid: GridType<G>, column: RealGrid.GridColumn, property: string, newValue: any, oldValue: any) => void;
117
+ onLayoutPropertyChanged?: (grid: GridType<G>, layout: RealGrid.CellLayoutItem, property: string, newValue: any, oldValue: any) => void;
118
+ onGridActivated?: (grid: GridType<G>) => void;
119
+ onCopy?: (grid: GridType<G>, selection: Selection | Selection[], event: ClipboardEvent) => boolean;
120
+ onCut?: (grid: GridType<G>, selection: Selection | Selection[], event: ClipboardEvent) => boolean;
121
+ onPaste?: (grid: GridType<G>, index: RealGrid.CellIndex, event: ClipboardEvent) => boolean;
122
+ onPasted?: (grid: GridType<G>) => void;
123
+ onItemsChecked?: (grid: GridType<G>, items: number[], checked: boolean) => void;
124
+ onCellClicked?: (grid: GridType<G>, clickData: RealGrid.ClickData) => void;
125
+ onCellDblClicked?: (grid: GridType<G>, clickData: RealGrid.ClickData) => void;
126
+ onCellItemClicked?: (grid: GridType<G>, index: RealGrid.CellIndex, clickData: RealGrid.ClickData) => boolean;
127
+ onCommandStackChanged?: (grid: GridType<G>, undoable: boolean, redoable: boolean) => void;
128
+ onDataLoadComplated?: (grid: GridType<G>) => void;
129
+ onLayoutExpanding?: (grid: GridType<G>, layout: RealGrid.CellLayoutGroupItem) => boolean;
130
+ onLayoutExpanded?: (grid: GridType<G>, layout: RealGrid.CellLayoutGroupItem) => void;
131
+ onLayoutCollapsing?: (grid: GridType<G>, layout: RealGrid.CellLayoutGroupItem) => boolean;
132
+ onLayoutCollapsed?: (grid: GridType<G>, layout: RealGrid.CellLayoutGroupItem) => void;
133
+ dataProps?: RealGrid.DataOptions;
134
+ }
135
+
136
+ declare interface IRealGridCheckBar extends IComponentBase, RealGrid.CheckBar {
137
+ }
138
+
139
+ declare interface IRealGridDataColumn extends RealGrid.DataColumn {
140
+ field?: RealGrid.DataField;
141
+ }
142
+
143
+ declare interface IRealGridDataField extends IComponentBase, RealGrid.DataField {
144
+ }
145
+
146
+ declare interface IRealGridFilterPanel extends IComponentBase, RealGrid.FilterPanel {
147
+ }
148
+
149
+ declare interface IRealGridFooter extends IComponentBase, RealGrid.GridFooter {
150
+ }
151
+
152
+ declare interface IRealGridFooters extends IComponentBase, RealGrid.GridFooterCollection {
153
+ }
154
+
155
+ declare interface IRealGridGroupPanel extends IComponentBase, RealGrid.GroupPanel {
156
+ }
157
+
158
+ declare interface IRealGridHeader extends IComponentBase, RealGrid.GridHeader {
159
+ }
160
+
161
+ declare interface IRealGridheaderSummaries extends IComponentBase, RealGrid.HeaderSummaryCollection {
162
+ }
163
+
164
+ declare interface IRealGridHeaderSummary extends IComponentBase, RealGrid.HeaderSummary {
165
+ }
166
+
167
+ declare interface IRealGridLiteralColumn extends IComponentBase, RealGrid.LiteralColumn {
168
+ }
169
+
170
+ declare interface IRealGridRowIndicator extends IComponentBase, RealGrid.RowIndicator {
171
+ }
172
+
173
+ declare interface IRealGridSeriesColumn extends IComponentBase, RealGrid.SeriesColumn {
174
+ }
175
+
176
+ declare interface IRealGridStateBar extends IComponentBase, RealGrid.StateBar {
177
+ }
178
+
179
+ declare interface IRealGridTreeProps extends IRealGridBaseProps<RealGrid.TreeView> {
180
+ treeOptions?: RealGrid.TreeOptions;
181
+ treeField?: string;
182
+ needSorting?: boolean;
183
+ childrenField?: string;
184
+ iconField?: string;
185
+ json?: any;
186
+ rowsProp?: string;
187
+ childrenProp?: string;
188
+ iconProp?: string;
189
+ onTreeItemExpanding?: (tree: RealGrid.TreeView, itemIndex: number, rowId: number) => boolean;
190
+ onTreeItemExpanded?: (tree: RealGrid.TreeView, itemIndex: number, rowId: number) => void;
191
+ onTreeItemCollapsing?: (tree: RealGrid.TreeView, itemIndex: number, rowId: number) => void;
192
+ onTreeItemCollapsed?: (tree: RealGrid.TreeView, itemIndex: number, rowId: number) => void;
193
+ onTreeItemChanged?: (tree: RealGrid.TreeView, itemIndex: number, rowId: number) => void;
194
+ onRowCountChanged?: (provider: RealGrid.LocalTreeDataProvider, newCount: number) => void;
195
+ onRowAdding?: (provider: RealGrid.LocalTreeDataProvider, row: number, index: number, child: any) => boolean;
196
+ onRowAdded?: (provider: RealGrid.LocalTreeDataProvider, row: number) => void;
197
+ onRowsAdded?: (provider: RealGrid.LocalTreeDataProvider, parent: number, rows: number[]) => void;
198
+ onRowDeleting?: (provider: RealGrid.LocalTreeDataProvider, row: number) => boolean;
199
+ onRowDeleted?: (provider: RealGrid.LocalTreeDataProvider, row: number) => void;
200
+ onRowsDeleted?: (provider: RealGrid.LocalTreeDataProvider, rows: number[]) => void;
201
+ onRowUpdating?: (provider: RealGrid.LocalTreeDataProvider, row: number) => boolean;
202
+ onRowUpdated?: (provider: RealGrid.LocalTreeDataProvider, row: number) => void;
203
+ onRowsUpdating?: (provider: RealGrid.LocalTreeDataProvider, rows: number[]) => boolean;
204
+ onRowsUpdated?: (provider: RealGrid.LocalTreeDataProvider, rows: number[]) => void;
205
+ onValueChanged?: (provider: RealGrid.LocalTreeDataProvider, row: number, field: number) => void;
206
+ onDataChanged?: (provider: RealGrid.LocalTreeDataProvider) => void;
207
+ onRowStateChanged?: (provider: RealGrid.LocalTreeDataProvider, row: number) => void;
208
+ onRowStatesChanged?: (provider: RealGrid.LocalTreeDataProvider, rows: number[]) => void;
209
+ onRowSiblingMoving?: (provider: RealGrid.LocalTreeDataProvider, row: number, offset: number) => boolean;
210
+ onRowSiblingMoved?: (provider: RealGrid.LocalTreeDataProvider, row: number, offset: number) => void;
211
+ onRowsSiblingMoving?: (provider: RealGrid.LocalTreeDataProvider, rows: number[], offset: number) => boolean;
212
+ onRowsSiblingMoved?: (provider: RealGrid.LocalTreeDataProvider, rows: number[], offset: number) => void;
213
+ onRowParentChanging?: (provider: RealGrid.LocalTreeDataProvider, row: number, parent: number, index: number) => boolean;
214
+ onRowParentChanged?: (provider: RealGrid.LocalTreeDataProvider, row: number, parent: number, index: number) => void;
215
+ }
216
+
217
+ declare interface IRealGridViewProps extends IRealGridBaseProps<RealGrid.GridView> {
218
+ gridProps?: RealGrid.ViewOptions;
219
+ accessibility?: boolean;
220
+ waiOptions?: RealGrid.WaiOptions;
221
+ onPageChanging?: (grid: RealGrid.GridView, page: number) => boolean;
222
+ onPageChanged?: (grid: RealGrid.GridView, page: number) => void;
223
+ onPageCountChanged?: (grid: RealGrid.GridView, pageCount: number) => void;
224
+ onGrouping?: (grid: RealGrid.GridView, fields: number[]) => boolean;
225
+ onGrouped?: (grid: RealGrid.GridView) => void;
226
+ onExpanding?: (grid: RealGrid.GridView, itemIndex: number) => boolean;
227
+ onExpanded?: (grid: RealGrid.GridView, itemIndex: number) => void;
228
+ onCollapsing?: (grid: RealGrid.GridView, itemIndex: number) => boolean;
229
+ onCollapsed?: (grid: RealGrid.GridView, itemIndex: number) => void;
230
+ onRowCountChanged?: (provider: RealGrid.LocalDataProvider, newCount: number) => void;
231
+ onRowUpdating?: (provider: RealGrid.LocalDataProvider, row: number) => boolean;
232
+ onRowUpdated?: (provider: RealGrid.LocalDataProvider, row: number) => void;
233
+ onRowsUpdated?: (provider: RealGrid.LocalDataProvider, row: number, count: number) => void;
234
+ onRowListUpdated?: (provider: RealGrid.LocalDataProvider, rows: number[]) => void;
235
+ onDataRowInserting?: (provider: RealGrid.LocalDataProvider, row: number, values: RealGrid.DataValues) => boolean;
236
+ onRowInserted?: (provider: RealGrid.LocalDataProvider, row: number) => void;
237
+ onRowsInserted?: (provider: RealGrid.LocalDataProvider, row: number, count: number) => void;
238
+ onRowDeleting?: (provider: RealGrid.LocalDataProvider, row: number) => boolean;
239
+ onRowDeleted?: (provider: RealGrid.LocalDataProvider, row: number) => void;
240
+ onRowsDeleted?: (provider: RealGrid.LocalDataProvider, rows: number[]) => void;
241
+ onRowMoving?: (provider: RealGrid.LocalDataProvider, row: number, newRow: number) => boolean;
242
+ onRowMoved?: (provider: RealGrid.LocalDataProvider, row: number, newRow: number) => void;
243
+ onRowsMoving?: (provider: RealGrid.LocalDataProvider, row: number, count: number, newRow: number) => boolean;
244
+ onRowsMoved?: (provider: RealGrid.LocalDataProvider, row: number, count: number, newRow: number) => void;
245
+ onRowListMoving?: (provider: RealGrid.LocalDataProvider, rows: number[], newRow: number) => boolean;
246
+ onRowListMoved?: (provider: RealGrid.LocalDataProvider, rows: number[], newRow: number) => void;
247
+ onValueChanged?: (provider: RealGrid.LocalDataProvider, row: number, field: number) => void;
248
+ onDataChanged?: (provider: RealGrid.LocalDataProvider) => void;
249
+ onRowStateChanged?: (provider: RealGrid.LocalDataProvider, row: number) => void;
250
+ onRowStatesChanged?: (provider: RealGrid.LocalDataProvider, rows: number[]) => void;
251
+ onRowStatesCleared?: (provider: RealGrid.LocalDataProvider) => void;
252
+ onRestoreRows?: (provider: RealGrid.LocalDataProvider, rows: number[]) => void;
253
+ }
254
+
255
+ declare abstract class RealBaseReact<G, T = {}> extends default_2.Component<T & Omit<IRealGridBaseProps<G>, '$grid'>> {
256
+ protected _gridView: GridType<G> | null;
257
+ protected _dataProvider: RealGrid.DataProviderBase | null;
258
+ private _mountCBs;
259
+ private _mountTimer;
260
+ protected gridContainer: default_2.LegacyRef<HTMLDivElement>;
261
+ constructor(props: T);
262
+ abstract get gridView(): GridType<G>;
263
+ abstract get dataProvider(): RealGrid.LocalDataProvider | RealGrid.LocalTreeDataProvider;
264
+ protected abstract createObject: () => {
265
+ grid: GridType<G>;
266
+ dataProvider: RealGrid.DataProviderBase;
267
+ props: any;
268
+ };
269
+ protected abstract beforeDestroy: () => {
270
+ props: any;
271
+ };
272
+ protected getProps(props: T): T;
273
+ private $_connectEvents;
274
+ private $_executeCallback;
275
+ addCallback(callback: Function): void;
276
+ removeCallback(callback: Function): void;
277
+ componentDidMount(): void;
278
+ componentWillUnmount(): void;
279
+ componentDidUpdate(prevProps: IRealGridBaseProps<G>, prevState: Readonly<{}>, snapshot?: any): void;
280
+ render(): default_2.ReactNode;
281
+ }
282
+
283
+ export declare class RealGridReact extends RealBaseReact<GridType<RealGrid.GridView>, IRealGridViewProps> {
284
+ get gridView(): RealGrid.GridView;
285
+ get dataProvider(): RealGrid.LocalDataProvider;
286
+ protected createObject: () => {
287
+ grid: RealGrid.GridView;
288
+ dataProvider: RealGrid.LocalDataProvider;
289
+ props: any;
290
+ };
291
+ protected beforeDestroy: () => {
292
+ props: any;
293
+ };
294
+ componentDidMount(): void;
295
+ componentDidUpdate(prevProps: IRealGridViewProps, prevState: Readonly<{
296
+ isChildMounted: boolean;
297
+ }>, snapshot?: any): void;
298
+ }
299
+
300
+ export declare class RealTreeReact extends RealBaseReact<GridType<RealGrid.TreeView>, IRealGridTreeProps> {
301
+ get gridView(): RealGrid.TreeView;
302
+ get dataProvider(): RealGrid.LocalTreeDataProvider;
303
+ protected createObject: () => {
304
+ grid: GridType<RealGrid.TreeView>;
305
+ dataProvider: RealGrid.LocalTreeDataProvider;
306
+ props: any;
307
+ };
308
+ protected beforeDestroy: () => {
309
+ props: any;
310
+ };
311
+ componentDidMount(): void;
312
+ componentDidUpdate(prevProps: IRealGridTreeProps, prevState: Readonly<{}>, snapshot?: any): void;
313
+ }
314
+
315
+ export declare class RGCheckBar extends ComponentBase<IRealGridCheckBar> {
316
+ protected mountCB: () => void;
317
+ protected unMountCB: () => void;
318
+ }
319
+
320
+ /**
321
+ * DataColumn을 추가한다.
322
+ * 그리드의 autoGenerateField속성이 true이면 컬럼과 Field를 동시에 추가한다.
323
+ * textField외 dateField등 추가적인 값이 필요하면 field에 필요한 값들을 적어준다.
324
+ * field생성후에는 fieldName을 변경하기 위해서는 browser를 refresh해야 한다.
325
+ * <RGDataColumn field={{fieldName: "field", dataType: "date", datetimeFormat: "yyyyMMdd"}} .../>
326
+ */
327
+ export declare class RGDataColumn extends ComponentBase<IComponentBase & IRealGridDataColumn> implements IRealGridDataColumn {
328
+ static readonly CType = "$$RGColumn$$";
329
+ fieldName?: string;
330
+ mounted?: boolean;
331
+ private _column;
332
+ protected mountCB: () => void;
333
+ protected unMountCB: () => void;
334
+ componentDidMount(): void;
335
+ componentWillUnmount(): void;
336
+ componentDidUpdate(prevProps: Readonly<{
337
+ [key in keyof IRealGridDataColumn]: IRealGridDataColumn[key];
338
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
339
+ }
340
+
341
+ /**
342
+ * DataField를 추가한다.
343
+ *
344
+ */
345
+ export declare class RGDataField extends ComponentBase<IRealGridDataField> {
346
+ private _field;
347
+ protected mountCB: () => void;
348
+ protected unMountCB: () => void;
349
+ }
350
+
351
+ export declare class RGFilterPanel extends ComponentBase<Exclude<IRealGridFilterPanel, Function>> {
352
+ protected mountCB: () => void;
353
+ protected unMountCB: () => void;
354
+ }
355
+
356
+ /**
357
+ * Footer의 속성을 변경할때 사용한다.
358
+ */
359
+ export declare class RGFooter extends ComponentBase<IRealGridFooter> {
360
+ protected mountCB: () => void;
361
+ protected unMountCB: () => void;
362
+ }
363
+
364
+ /**
365
+ * Footer를 여러개 만들때 사용한다.
366
+ */
367
+ export declare class RGFooters extends ComponentBase<Exclude<IRealGridFooters, Function>> {
368
+ protected mountCB: () => void;
369
+ protected unMountCB: () => void;
370
+ }
371
+
372
+ export declare class RGGroupPanel extends ComponentBase<IRealGridGroupPanel> {
373
+ protected mountCB: () => void;
374
+ protected unMountCB: () => void;
375
+ }
376
+
377
+ export declare class RGHeader extends ComponentBase<IRealGridHeader> {
378
+ protected mountCB: () => void;
379
+ protected unMountCB: () => void;
380
+ }
381
+
382
+ /**
383
+ * 여러개의 headerSummary를 만들때 사용한다.
384
+ */
385
+ export declare class RGHeaderSummaries extends ComponentBase<Exclude<IRealGridheaderSummaries, Function>> {
386
+ protected mountCB: () => void;
387
+ protected unMountCB: () => void;
388
+ componentDidMount(): void;
389
+ componentWillUnmount(): void;
390
+ }
391
+
392
+ /**
393
+ * headerSummary의 속성을 변경한다.
394
+ */
395
+ export declare class RGHeaderSummary extends ComponentBase<IRealGridHeaderSummary> {
396
+ protected mountCB: () => void;
397
+ protected unMountCB: () => void;
398
+ }
399
+
400
+ export declare class RGLiteralColumn extends ComponentBase<IRealGridLiteralColumn> {
401
+ static readonly CType = "$$RGColumn$$";
402
+ private _column;
403
+ protected mountCB: () => void;
404
+ protected unMountCB: () => void;
405
+ componentDidMount(): void;
406
+ componentWillUnmount(): void;
407
+ componentDidUpdate(prevProps: Readonly<{
408
+ [key in keyof IRealGridLiteralColumn]: IRealGridLiteralColumn[key];
409
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
410
+ }
411
+
412
+ export declare class RGRowIndicator extends ComponentBase<IRealGridRowIndicator> {
413
+ protected mountCB: () => void;
414
+ protected unMountCB: () => void;
415
+ }
416
+
417
+ /**
418
+ * SeriesColumn을 추가한다.
419
+ */
420
+ export declare class RGSeriesColumn extends ComponentBase<IRealGridSeriesColumn> {
421
+ static readonly CType = "$$RGColumn$$";
422
+ private _column;
423
+ protected mountCB: () => void;
424
+ protected unMountCB: () => void;
425
+ componentDidMount(): void;
426
+ componentWillUnmount(): void;
427
+ componentDidUpdate(prevProps: Readonly<{
428
+ [key in keyof IRealGridSeriesColumn]: IRealGridSeriesColumn[key];
429
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
430
+ }
431
+
432
+ export declare class RGStateBar extends ComponentBase<IRealGridStateBar> {
433
+ protected mountCB: () => void;
434
+ protected unMountCB: () => void;
435
+ }
436
+
437
+ export { }
@@ -0,0 +1,442 @@
1
+ var f = Object.defineProperty;
2
+ var C = (n, r, t) => r in n ? f(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
3
+ var o = (n, r, t) => (C(n, typeof r != "symbol" ? r + "" : r, t), t);
4
+ import p from "react";
5
+ import * as u from "realgrid";
6
+ const m = (n, ...r) => (r.forEach((t) => {
7
+ for (const s in t) {
8
+ if (s === "children")
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;
12
+ }
13
+ }), n), c = (n, r = {}, t = {}) => {
14
+ n = n || {};
15
+ const s = ["children", "rows", "$grid"];
16
+ for (const [e, i] of Object.entries(r))
17
+ if (!s.includes(e))
18
+ if (!t.hasOwnProperty(e))
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"))
23
+ if (!(t[e] instanceof Object))
24
+ n[e] = t[e];
25
+ else {
26
+ const d = c({}, i, t[e]);
27
+ Object.keys(d).length && (n[e] = d);
28
+ }
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);
33
+ return n;
34
+ };
35
+ class w extends p.Component {
36
+ constructor(t) {
37
+ super(t);
38
+ // property field
39
+ o(this, "_gridView", null);
40
+ o(this, "_dataProvider", null);
41
+ // field
42
+ o(this, "_mountCBs", []);
43
+ o(this, "_mountTimer");
44
+ o(this, "gridContainer");
45
+ this.gridContainer = p.createRef();
46
+ }
47
+ getProps(t) {
48
+ return t || {};
49
+ }
50
+ // 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]));
54
+ }
55
+ $_executeCallback() {
56
+ if (this.gridView && (clearTimeout(this._mountTimer), !(!this._mountCBs || !this._mountCBs.length))) {
57
+ this.gridView.beginUpdate();
58
+ try {
59
+ this.dataProvider.beginUpdate();
60
+ try {
61
+ for (; this._mountCBs && this._mountCBs.length; ) {
62
+ const t = this._mountCBs.shift();
63
+ t == null || t.call(this);
64
+ }
65
+ } finally {
66
+ this.dataProvider.endUpdate();
67
+ }
68
+ } finally {
69
+ this.gridView.endUpdate(!0), this._mountTimer = null, this._mountCBs = [];
70
+ }
71
+ }
72
+ }
73
+ // public Method
74
+ addCallback(t) {
75
+ this._mountCBs.push(t), clearTimeout(this._mountTimer), this._mountTimer = setTimeout(() => {
76
+ this.$_executeCallback();
77
+ }, 20);
78
+ }
79
+ removeCallback(t) {
80
+ const s = this._mountCBs.indexOf(t);
81
+ s >= 0 && this._mountCBs.splice(s, 1);
82
+ }
83
+ componentDidMount() {
84
+ const { grid: t, dataProvider: s, props: e } = this.createObject();
85
+ if (this._gridView = t, this._dataProvider = s, this.$_executeCallback(), 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) {
86
+ const i = e.onInitialized.constructor.name;
87
+ i === "Function" ? e.onInitialized(t) : i === "AsyncFunction" && Promise.resolve(e.onInitialized(t));
88
+ }
89
+ }
90
+ componentWillUnmount() {
91
+ this.beforeDestroy(), this._gridView = this._gridView && this._gridView.destroy(), this._dataProvider = this._dataProvider && this._dataProvider.destroy();
92
+ }
93
+ componentDidUpdate(t, s, e) {
94
+ this.$_executeCallback();
95
+ const i = this.getProps(this.props) || {}, d = this.gridView, h = this.dataProvider;
96
+ this.$_connectEvents(d, h, i);
97
+ let l = c({}, t.dataProps, i.dataProps);
98
+ 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
+ }
100
+ render() {
101
+ const t = {};
102
+ t.$grid = this;
103
+ let s = 0;
104
+ 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)));
105
+ return p.createElement("div", { style: { width: "100%", height: "100%" }, ref: (i) => this.gridContainer = i }, e);
106
+ }
107
+ }
108
+ class P extends w {
109
+ constructor() {
110
+ super(...arguments);
111
+ o(this, "createObject", () => {
112
+ var i;
113
+ 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);
114
+ return s.setDataSource(e), {
115
+ grid: s,
116
+ dataProvider: e,
117
+ props: t
118
+ };
119
+ });
120
+ o(this, "beforeDestroy", () => {
121
+ const t = m({}, this.getProps(this.props));
122
+ return t.onDestroy && t.onDestroy.call(this, this.gridView), { props: t };
123
+ });
124
+ }
125
+ get gridView() {
126
+ return this._gridView;
127
+ }
128
+ get dataProvider() {
129
+ return this._dataProvider;
130
+ }
131
+ componentDidMount() {
132
+ var s;
133
+ super.componentDidMount();
134
+ const t = this.props.rows;
135
+ t && Array.isArray(t) && t.length > 0 && ((s = this.dataProvider) == null || s.setRows(t));
136
+ }
137
+ componentDidUpdate(t, s, e) {
138
+ super.componentDidUpdate(t, s, e), t.rows != this.props.rows && this.dataProvider.setRows(this.props.rows);
139
+ }
140
+ }
141
+ class V extends w {
142
+ constructor() {
143
+ super(...arguments);
144
+ o(this, "createObject", () => {
145
+ var i;
146
+ 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);
147
+ return s.setTreeOptions(t.treeOptions || {}), s.setDataSource(e), {
148
+ grid: s,
149
+ dataProvider: e,
150
+ props: t
151
+ };
152
+ });
153
+ o(this, "beforeDestroy", () => {
154
+ const t = m({}, this.getProps(this.props));
155
+ return t.onDestroy && t.onDestroy.call(this, this.gridView), { props: t };
156
+ });
157
+ }
158
+ get gridView() {
159
+ return this._gridView;
160
+ }
161
+ get dataProvider() {
162
+ return this._dataProvider;
163
+ }
164
+ componentDidMount() {
165
+ var s, e;
166
+ super.componentDidMount();
167
+ const t = this.props.rows;
168
+ 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);
169
+ }
170
+ componentDidUpdate(t, s, e) {
171
+ var d, h;
172
+ const i = this.props.rows;
173
+ (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);
174
+ }
175
+ }
176
+ class a extends p.Component {
177
+ // 실제로 어떤 모델 또는 객체를 참조하는지.
178
+ constructor(t) {
179
+ super(t);
180
+ o(this, "$parent");
181
+ o(this, "$model");
182
+ this.$parent = t.$grid;
183
+ }
184
+ _doUpdate() {
185
+ }
186
+ componentDidMount() {
187
+ const t = this.$parent;
188
+ t && t.addCallback(this.mountCB);
189
+ }
190
+ componentWillUnmount() {
191
+ const t = this.$parent;
192
+ t && (t.removeCallback(this.mountCB), this.unMountCB()), this.$model = null;
193
+ }
194
+ componentDidUpdate(t, s, e) {
195
+ let i = c({}, this.props, t);
196
+ this.$model && this.$model.assignFrom && this.$model.assignFrom(i), this._doUpdate();
197
+ }
198
+ render() {
199
+ return p.createElement(p.Fragment);
200
+ }
201
+ }
202
+ class g extends a {
203
+ constructor() {
204
+ super(...arguments);
205
+ o(this, "_column");
206
+ o(this, "mountCB", () => {
207
+ const t = this.$parent.gridView;
208
+ t && (this._column = this.$model = t.addColumn({ ...this.props, type: "series" }, this.props.displayIndex ?? -1));
209
+ });
210
+ o(this, "unMountCB", () => {
211
+ const t = this.$parent.gridView;
212
+ this._column && t && !t._view.disposing && t.removeColumn(this._column.name);
213
+ });
214
+ }
215
+ componentDidMount() {
216
+ super.componentDidMount();
217
+ }
218
+ componentWillUnmount() {
219
+ super.componentWillUnmount();
220
+ }
221
+ componentDidUpdate(t, s, e) {
222
+ if (super.componentDidUpdate(t, s, e), t.width !== this.props.width) {
223
+ const i = this.$model.layout;
224
+ i && (i.cellWidth = this.props.width);
225
+ }
226
+ }
227
+ }
228
+ o(g, "CType", "$$RGColumn$$");
229
+ class D extends a {
230
+ constructor() {
231
+ super(...arguments);
232
+ o(this, "mountCB", () => {
233
+ var t;
234
+ (t = this.$parent.gridView) == null || t.setStateBar({ ...this.props }), this.$model = this.$parent.gridView.stateBar;
235
+ });
236
+ o(this, "unMountCB", () => {
237
+ var t;
238
+ (t = this.$parent.gridView) == null || t.setStateBar({});
239
+ });
240
+ }
241
+ }
242
+ class v extends a {
243
+ constructor() {
244
+ super(...arguments);
245
+ o(this, "mountCB", () => {
246
+ var t;
247
+ (t = this.$parent.gridView) == null || t.setRowIndicator({ ...this.props }), this.$model = this.$parent.gridView.rowIndicator;
248
+ });
249
+ o(this, "unMountCB", () => {
250
+ });
251
+ }
252
+ }
253
+ class b extends a {
254
+ constructor() {
255
+ super(...arguments);
256
+ o(this, "mountCB", () => {
257
+ var t;
258
+ (t = this.$parent.gridView) == null || t.setHeaderSummaries({ ...this.props }), this.$model = this.$parent.gridView.headerSummaries;
259
+ });
260
+ o(this, "unMountCB", () => {
261
+ });
262
+ }
263
+ componentDidMount() {
264
+ super.componentDidMount();
265
+ }
266
+ componentWillUnmount() {
267
+ super.componentWillUnmount();
268
+ }
269
+ }
270
+ class R extends a {
271
+ constructor() {
272
+ super(...arguments);
273
+ o(this, "mountCB", () => {
274
+ var t;
275
+ (t = this.$parent.gridView) == null || t.setHeaderSummary({ ...this.props }), this.$model = this.$parent.gridView.headerSummary;
276
+ });
277
+ o(this, "unMountCB", () => {
278
+ });
279
+ }
280
+ }
281
+ class x extends a {
282
+ constructor() {
283
+ super(...arguments);
284
+ o(this, "mountCB", () => {
285
+ var t;
286
+ (t = this.$parent.gridView) == null || t.setHeader({ ...this.props }), this.$model = this.$parent.gridView.header;
287
+ });
288
+ o(this, "unMountCB", () => {
289
+ });
290
+ }
291
+ }
292
+ class M extends a {
293
+ constructor() {
294
+ super(...arguments);
295
+ o(this, "mountCB", () => {
296
+ var t;
297
+ this.$parent.gridView instanceof u.GridView && ((t = this.$parent.gridView) == null || t.setGroupPanel({ visible: !0, ...this.props }), this.$model = this.$parent.gridView.groupPanel);
298
+ });
299
+ o(this, "unMountCB", () => {
300
+ });
301
+ }
302
+ }
303
+ class S extends a {
304
+ constructor() {
305
+ super(...arguments);
306
+ o(this, "mountCB", () => {
307
+ var t;
308
+ (t = this.$parent.gridView) == null || t.setFooter({ ...this.props }), this.$model = this.$parent.gridView.footer;
309
+ });
310
+ o(this, "unMountCB", () => {
311
+ });
312
+ }
313
+ }
314
+ class F extends a {
315
+ constructor() {
316
+ super(...arguments);
317
+ o(this, "mountCB", () => {
318
+ var t;
319
+ (t = this.$parent.gridView) == null || t.setFooters({ ...this.props }), this.$model = this.$parent.gridView.footers;
320
+ });
321
+ o(this, "unMountCB", () => {
322
+ });
323
+ }
324
+ }
325
+ class U extends a {
326
+ constructor() {
327
+ super(...arguments);
328
+ o(this, "mountCB", () => {
329
+ var t;
330
+ (t = this.$parent.gridView) == null || t.setFilterPanel({ ...this.props }), this.$model = this.$parent.gridView.filterPanel;
331
+ });
332
+ o(this, "unMountCB", () => {
333
+ });
334
+ }
335
+ }
336
+ class O extends a {
337
+ constructor() {
338
+ super(...arguments);
339
+ o(this, "_field");
340
+ o(this, "mountCB", () => {
341
+ const t = this.$parent.gridView, s = t == null ? void 0 : t.getDataSource();
342
+ s && !s.fieldByName(this.props.fieldName) && (this._field = s.addField(this.props));
343
+ });
344
+ o(this, "unMountCB", () => {
345
+ if (this._field) {
346
+ const t = this.$parent.gridView, s = t == null ? void 0 : t.getDataSource();
347
+ s && s.removeField(this._field.fieldName);
348
+ }
349
+ });
350
+ }
351
+ }
352
+ class y extends a {
353
+ constructor() {
354
+ super(...arguments);
355
+ o(this, "fieldName");
356
+ o(this, "mounted");
357
+ o(this, "_column");
358
+ o(this, "mountCB", () => {
359
+ const t = this.$parent.gridView, s = this.$parent.props.autoGenerateField, e = t == null ? void 0 : t.getDataSource();
360
+ let i = this.props.fieldName;
361
+ 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));
362
+ });
363
+ o(this, "unMountCB", () => {
364
+ const t = this.$parent.gridView;
365
+ if (this._column && t && !t._view.disposing) {
366
+ let s = this._column.fieldName;
367
+ t.removeColumn(this._column.name);
368
+ const e = this.$parent.props.autoGenerateField, i = t == null ? void 0 : t.getDataSource();
369
+ e && s && i && (t.columnByField(s) || i.removeField(s));
370
+ }
371
+ });
372
+ }
373
+ componentDidMount() {
374
+ super.componentDidMount();
375
+ }
376
+ componentWillUnmount() {
377
+ super.componentWillUnmount();
378
+ }
379
+ componentDidUpdate(t, s, e) {
380
+ if (super.componentDidUpdate(t, s, e), t.width !== this.props.width) {
381
+ const i = this.$model.layout;
382
+ i && (i.cellWidth = this.props.width);
383
+ }
384
+ }
385
+ }
386
+ o(y, "CType", "$$RGColumn$$");
387
+ class G extends a {
388
+ constructor() {
389
+ super(...arguments);
390
+ o(this, "mountCB", () => {
391
+ var t;
392
+ (t = this.$parent.gridView) == null || t.setCheckBar({ ...this.props }), this.$model = this.$parent.gridView.checkBar;
393
+ });
394
+ o(this, "unMountCB", () => {
395
+ });
396
+ }
397
+ }
398
+ class $ extends a {
399
+ constructor() {
400
+ super(...arguments);
401
+ o(this, "_column");
402
+ o(this, "mountCB", () => {
403
+ const t = this.$parent.gridView;
404
+ t && (this._column = this.$model = t.addColumn({ ...this.props, type: "literal" }, this.props.displayIndex ?? -1));
405
+ });
406
+ o(this, "unMountCB", () => {
407
+ const t = this.$parent.gridView;
408
+ this._column && t && !t._view.disposing && t.removeColumn(this._column.name);
409
+ });
410
+ }
411
+ componentDidMount() {
412
+ super.componentDidMount();
413
+ }
414
+ componentWillUnmount() {
415
+ super.componentWillUnmount();
416
+ }
417
+ componentDidUpdate(t, s, e) {
418
+ if (super.componentDidUpdate(t, s, e), t.width !== this.props.width) {
419
+ const i = this.$model.layout;
420
+ i && (i.cellWidth = this.props.width);
421
+ }
422
+ }
423
+ }
424
+ o($, "CType", "$$RGColumn$$");
425
+ export {
426
+ G as RGCheckBar,
427
+ y as RGDataColumn,
428
+ O as RGDataField,
429
+ U as RGFilterPanel,
430
+ S as RGFooter,
431
+ F as RGFooters,
432
+ M as RGGroupPanel,
433
+ x as RGHeader,
434
+ b as RGHeaderSummaries,
435
+ R as RGHeaderSummary,
436
+ $ as RGLiteralColumn,
437
+ v as RGRowIndicator,
438
+ g as RGSeriesColumn,
439
+ D as RGStateBar,
440
+ P as RealGridReact,
441
+ V as RealTreeReact
442
+ };
package/license.txt ADDED
@@ -0,0 +1,3 @@
1
+ Copyright <2024> <WooriTech>
2
+
3
+ inquiry: https://realgrid.com/
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "realgrid-react",
3
+ "private": false,
4
+ "version": "0.9.0",
5
+ "description": "RealGrid2 wrapping Component for React",
6
+ "author": {
7
+ "name": "WooriTech",
8
+ "url": "http://www.realgrid.com",
9
+ "email": "support@realgrid.com"
10
+ },
11
+ "keywords": [
12
+ "realgrid",
13
+ "grid",
14
+ "datagrid",
15
+ "reports",
16
+ "dataviz",
17
+ "pivot",
18
+ "visualization",
19
+ "realreport",
20
+ "realchart"
21
+ ],
22
+ "type": "module",
23
+ "main": "./dist/index.cjs.js",
24
+ "module": "./dist/index.es.js",
25
+ "types": "./dist/index.d.ts",
26
+ "peerDependencies": {
27
+ "react": "^16.2.0 || ^17.0.0 || ^18.0.0",
28
+ "react-dom": "^16.2.0 || ^17.0.0 || ^18.0.0"
29
+ },
30
+ "dependencies": {
31
+ "realgrid": "^2.8.3"
32
+ }
33
+ }