@azrico/reactgrid 1.2.14 → 1.2.16
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/CHANGELOG.md +9 -0
- package/dist/index.js +21 -3
- package/dist/src/example.js +161 -118
- package/dist/src/func/func_child.js +84 -81
- package/dist/src/func/func_grid.d.ts +1 -0
- package/dist/src/func/func_grid.js +265 -271
- package/dist/src/index.js +25 -6
- package/dist/src/themes/base_styles.css +30 -0
- package/dist/src/themes/grid.css +20 -0
- package/dist/src/views/DataGrid.js +270 -223
- package/dist/src/views/index.js +23 -3
- package/package.json +1 -1
- package/src/func/func_grid.ts +4 -0
- package/src/views/DataGrid.tsx +1 -1
|
@@ -1,227 +1,274 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AzGrid = AzGrid;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("@inovua/reactdatagrid-enterprise/index.css");
|
|
9
|
+
require("@inovua/reactdatagrid-enterprise/theme/default-dark.css");
|
|
10
|
+
require("@inovua/reactdatagrid-enterprise/theme/amber-dark.css");
|
|
11
|
+
require("../themes/base_styles.css");
|
|
12
|
+
require("../themes/grid.css");
|
|
13
|
+
var _func_grid = require("../func/func_grid");
|
|
14
|
+
var _controls = require("@azrico/controls");
|
|
15
|
+
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _func_child = require("../func/func_child");
|
|
17
|
+
var _reactdatagridEnterprise = _interopRequireDefault(require("@inovua/reactdatagrid-enterprise"));
|
|
18
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
|
+
var _reactUseSize = require("react-use-size");
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
/* -------------------------------------------------------------------------- */
|
|
22
|
+
const defaultOptions = {
|
|
23
|
+
//filterTypes: defaultfilterTypes,
|
|
24
|
+
remoteFilter: false,
|
|
25
|
+
remoteSort: false,
|
|
26
|
+
editStartEvent: 'click',
|
|
27
|
+
rowReorderColumn: false,
|
|
28
|
+
resizable: true,
|
|
29
|
+
columnUserSelect: true,
|
|
30
|
+
rowIndexColumn: true,
|
|
31
|
+
rowHeight: 35
|
|
32
|
+
};
|
|
33
|
+
const forcedOptions = {
|
|
34
|
+
idProperty: '__table_id',
|
|
35
|
+
nodesProperty: '__children'
|
|
36
|
+
};
|
|
37
|
+
const dynamic_option_names = ['selected', 'cellSelection', 'loading', 'limit', 'skip'];
|
|
38
|
+
/* -------------------------------------------------------------------------- */
|
|
39
|
+
function AzGrid(props) {
|
|
40
|
+
const gridRefBackup = _react.default.useRef(null);
|
|
41
|
+
const gridRef = props.gridRef || gridRefBackup;
|
|
42
|
+
/* -------------------------------------------------------------------------- */
|
|
43
|
+
/* Columns */
|
|
44
|
+
/* -------------------------------------------------------------------------- */
|
|
45
|
+
const cached_columns = _react.default.useMemo(() => {
|
|
46
|
+
return (0, _func_grid.ApplyColumnData)(props);
|
|
47
|
+
}, [props.columns, props.leftColumns, props.rightColumns, props.editableColumns, props.columnExtensions, props.customColumns]);
|
|
48
|
+
/* -------------------------------------------------------------------------- */
|
|
49
|
+
/* Row changes */
|
|
50
|
+
/* -------------------------------------------------------------------------- */
|
|
51
|
+
const cached_data = _react.default.useRef();
|
|
52
|
+
const last_cache_info = _react.default.useRef();
|
|
53
|
+
const dataSource = _react.default.useCallback(async dt => {
|
|
54
|
+
return await (0, _func_grid.ApplyDataSource)(props.dataSource, {
|
|
55
|
+
skip: dt.skip,
|
|
56
|
+
limit: dt.limit,
|
|
57
|
+
cached_data: cached_data,
|
|
58
|
+
last_cache_info: last_cache_info
|
|
59
|
+
});
|
|
60
|
+
}, [props.dataSource]);
|
|
61
|
+
const base_gridOptions = _react.default.useMemo(() => {
|
|
62
|
+
const firstcolumn = cached_columns[0];
|
|
63
|
+
const licenseKey = props.licenseKey || (0, _func_grid.get_default_key)();
|
|
64
|
+
const events = {
|
|
65
|
+
onSkipChange: props.onSkipChange,
|
|
66
|
+
onLimitChange: props.onLimitChange,
|
|
67
|
+
onEditComplete: props.onEditComplete
|
|
68
|
+
};
|
|
69
|
+
const extra_ops = {
|
|
70
|
+
onSelectionChange: props.onSelectionChange,
|
|
71
|
+
onCellSelectionChange: props.onCellSelectionChange,
|
|
72
|
+
licenseKey: licenseKey,
|
|
73
|
+
editable: props.editable,
|
|
74
|
+
treeColumn: props.allowChildRows ? firstcolumn.name : undefined,
|
|
75
|
+
renderRowDetails: props.RowDetail,
|
|
76
|
+
theme: props.dark ? 'amber-dark' : 'default-light'
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
...defaultOptions,
|
|
80
|
+
...events,
|
|
81
|
+
...extra_ops
|
|
82
|
+
};
|
|
83
|
+
}, [cached_columns, props.allowChildRows, props.editable, props.RowDetail, props.onEditComplete]);
|
|
84
|
+
const static_gridOptions = _react.default.useMemo(() => {
|
|
85
|
+
return {
|
|
86
|
+
...base_gridOptions,
|
|
87
|
+
...props.gridOptions,
|
|
88
|
+
...forcedOptions
|
|
89
|
+
};
|
|
90
|
+
}, [props.gridOptions, base_gridOptions, forcedOptions]);
|
|
91
|
+
const dynamic_gridOptions = _react.default.useMemo(() => {
|
|
92
|
+
const res = {};
|
|
93
|
+
dynamic_option_names.map(r => {
|
|
94
|
+
res[r] = props[r];
|
|
95
|
+
});
|
|
96
|
+
return res;
|
|
97
|
+
}, dynamic_option_names.map(r => props[r]));
|
|
98
|
+
return _react.default.createElement(DataGridEventsWrapper, {
|
|
99
|
+
...props,
|
|
100
|
+
gridRef: gridRef,
|
|
101
|
+
static_gridOptions: static_gridOptions,
|
|
102
|
+
dynamic_gridOptions: dynamic_gridOptions,
|
|
103
|
+
columns: cached_columns,
|
|
104
|
+
dataSource: dataSource,
|
|
105
|
+
highlightedRow: props.highlightedRow
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/* -------------------------------------------------------------------------- */
|
|
98
109
|
/**
|
|
99
110
|
* Wrapper for menu events
|
|
100
111
|
* @param props
|
|
101
112
|
* @returns
|
|
102
|
-
*/
|
|
103
|
-
function DataGridEventsWrapper(props) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
/* -------------------------------------------------------------------------- */
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
113
|
+
*/
|
|
114
|
+
function DataGridEventsWrapper(props) {
|
|
115
|
+
/* -------------------------------------------------------------------------- */
|
|
116
|
+
const click_data = _react.default.useRef(null);
|
|
117
|
+
const [menuAnchorEl, set_menuAnchorEl] = _react.default.useState(null);
|
|
118
|
+
const [menuRow, set_menuRow] = _react.default.useState(null);
|
|
119
|
+
/* --------------------------------- events --------------------------------- */
|
|
120
|
+
const onRowContextMenu = _react.default.useCallback((rowProps, event) => {
|
|
121
|
+
if (_func_child.func_selection.has_selection()) return;
|
|
122
|
+
update_menuRow(rowProps.data);
|
|
123
|
+
update_menuAnchorEl(_func_child.func_selection.getVirtualElement(event.clientX, event.clientY));
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
}, []);
|
|
126
|
+
const onRowClick = _react.default.useCallback((rowProps, event) => {
|
|
127
|
+
const nowDate = Date.now();
|
|
128
|
+
const lastclick = click_data.current[(0, _func_grid.get_row_id)(rowProps)];
|
|
129
|
+
if (lastclick) {
|
|
130
|
+
const diffTime = Math.abs(nowDate - lastclick);
|
|
131
|
+
if (diffTime < 400) {
|
|
132
|
+
click_data.current[(0, _func_grid.get_row_id)(rowProps)] = null;
|
|
133
|
+
return props.onRowDoubleClick && props.onRowDoubleClick(rowProps.rowIndex, rowProps.data);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
click_data.current[(0, _func_grid.get_row_id)(rowProps)] = nowDate;
|
|
137
|
+
return props.onRowClick && props.onRowClick(rowProps.rowIndex, rowProps.data);
|
|
138
|
+
}, [props.onRowClick, props.onRowDoubleClick]);
|
|
139
|
+
_react.default.useEffect(() => {
|
|
140
|
+
click_data.current = {};
|
|
141
|
+
}, [props.dataSource]);
|
|
142
|
+
/* ------------------------------- ContextMenu ------------------------------ */
|
|
143
|
+
const update_menuAnchorEl = _react.default.useCallback(el => {
|
|
144
|
+
if (el) {
|
|
145
|
+
set_menuAnchorEl(el);
|
|
146
|
+
} else set_menuAnchorEl(null);
|
|
147
|
+
}, []);
|
|
148
|
+
const update_menuRow = _react.default.useCallback(r => {
|
|
149
|
+
if (r) {
|
|
150
|
+
set_menuRow(r);
|
|
151
|
+
} else set_menuRow(null);
|
|
152
|
+
}, []);
|
|
153
|
+
/**
|
|
154
|
+
* Merge click events into grid options
|
|
155
|
+
*/
|
|
156
|
+
const static_gridOptions = _react.default.useMemo(() => {
|
|
157
|
+
const events = {
|
|
158
|
+
onRowClick: onRowClick,
|
|
159
|
+
onRowContextMenu: onRowContextMenu
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
...props.static_gridOptions,
|
|
163
|
+
...events
|
|
164
|
+
};
|
|
165
|
+
}, [props.static_gridOptions, onRowClick]);
|
|
166
|
+
const contextMenu = _react.default.createElement(_controls.ContextMenu, {
|
|
167
|
+
menuAnchorEl: menuAnchorEl,
|
|
168
|
+
set_menuAnchorEl: update_menuAnchorEl,
|
|
169
|
+
menuRow: menuRow,
|
|
170
|
+
items: props.contextMenuItems
|
|
171
|
+
});
|
|
172
|
+
if (props.details_dataSource) {
|
|
173
|
+
return _react.default.createElement(DataGridDetailsWrapper, {
|
|
174
|
+
...props,
|
|
175
|
+
static_gridOptions: static_gridOptions
|
|
176
|
+
}, contextMenu, props.children);
|
|
177
|
+
} else {
|
|
178
|
+
return _react.default.createElement(DataGridSizeWrapper, {
|
|
179
|
+
...props,
|
|
180
|
+
static_gridOptions: static_gridOptions
|
|
181
|
+
}, contextMenu, props.children);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function DataGridDetailsWrapper(props) {
|
|
185
|
+
const cached_details_columns = _react.default.useMemo(() => {
|
|
186
|
+
return (0, _func_grid.ApplyColumnData)(props.details_columns);
|
|
187
|
+
}, [props.details_columns]);
|
|
188
|
+
const cached_data = _react.default.useRef();
|
|
189
|
+
const last_cache_info = _react.default.useRef();
|
|
190
|
+
const dataSource = _react.default.useCallback(async dt => {
|
|
191
|
+
const res = await (0, _func_grid.ApplyDataSource)(props.details_dataSource, {
|
|
192
|
+
skip: dt.skip,
|
|
193
|
+
limit: dt.limit,
|
|
194
|
+
cached_data: cached_data,
|
|
195
|
+
last_cache_info: last_cache_info
|
|
196
|
+
});
|
|
197
|
+
console.log('ds', res);
|
|
198
|
+
return res;
|
|
199
|
+
}, [props.dataSource]);
|
|
200
|
+
const renderDetailsGrid = ({
|
|
201
|
+
data
|
|
202
|
+
}) => {
|
|
203
|
+
return _react.default.createElement(_reactdatagridEnterprise.default, {
|
|
204
|
+
defaultFilterValue: props.details_filter,
|
|
205
|
+
dataSource: dataSource,
|
|
206
|
+
columns: cached_details_columns
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Merge details into grid
|
|
211
|
+
*/
|
|
212
|
+
const static_gridOptions = _react.default.useMemo(() => {
|
|
213
|
+
const finalresult = props.static_gridOptions || {};
|
|
214
|
+
finalresult['renderDetailsGrid'] = renderDetailsGrid;
|
|
215
|
+
return finalresult;
|
|
216
|
+
}, [props.static_gridOptions]);
|
|
217
|
+
return _react.default.createElement(DataGridSizeWrapper, {
|
|
218
|
+
...props,
|
|
219
|
+
static_gridOptions: static_gridOptions
|
|
220
|
+
}, props.children);
|
|
221
|
+
}
|
|
222
|
+
function DataGridSizeWrapper(props) {
|
|
223
|
+
if (props.delayedSize) {
|
|
224
|
+
return _react.default.createElement(DataGridDelayedSize, {
|
|
225
|
+
...props
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
return _react.default.createElement(DataGridFlexSize, {
|
|
229
|
+
...props
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/* -------------------------------------------------------------------------- */
|
|
234
|
+
function DataGridDelayedSize(props) {
|
|
235
|
+
const {
|
|
236
|
+
ref,
|
|
237
|
+
height,
|
|
238
|
+
width
|
|
239
|
+
} = (0, _reactUseSize.useComponentSize)();
|
|
240
|
+
return _react.default.createElement("div", {
|
|
241
|
+
ref: ref,
|
|
242
|
+
className: (0, _clsx.default)(props.className, 'azgrid-nooverflow', 'azgrid-filler')
|
|
243
|
+
}, _react.default.createElement(_reactdatagridEnterprise.default, {
|
|
244
|
+
...props.static_gridOptions,
|
|
245
|
+
...props.dynamic_gridOptions,
|
|
246
|
+
handle: ref => props.gridRef.current = ref ? ref.current : null,
|
|
247
|
+
className: 'azgrid-delayedresize',
|
|
248
|
+
style: {
|
|
249
|
+
height: height,
|
|
250
|
+
width: width
|
|
251
|
+
},
|
|
252
|
+
columns: props.columns,
|
|
253
|
+
dataSource: props.dataSource
|
|
254
|
+
}), props.children);
|
|
255
|
+
}
|
|
256
|
+
function DataGridFlexSize(props) {
|
|
257
|
+
return _react.default.createElement("div", {
|
|
258
|
+
className: (0, _clsx.default)(props.className, 'azgrid-nooverflow', 'azgrid-filler')
|
|
259
|
+
}, _react.default.createElement(_reactdatagridEnterprise.default, {
|
|
260
|
+
...props.static_gridOptions,
|
|
261
|
+
...props.dynamic_gridOptions,
|
|
262
|
+
handle: ref => props.gridRef.current = ref ? ref.current : null,
|
|
263
|
+
className: 'azgrid-filler',
|
|
264
|
+
columns: props.columns,
|
|
265
|
+
dataSource: props.dataSource
|
|
266
|
+
}), props.children);
|
|
267
|
+
}
|
|
268
|
+
/* -------------------------------------------------------------------------- */
|
|
269
|
+
/* -------------------------------------------------------------------------- */
|
|
270
|
+
/* -------------------------------------------------------------------------- */
|
|
271
|
+
/* -------------------------------------------------------------------------- */
|
|
272
|
+
/* -------------------------------------------------------------------------- */
|
|
273
|
+
var _default = AzGrid;
|
|
274
|
+
exports.default = _default;
|
package/dist/src/views/index.js
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _DataGrid = _interopRequireWildcard(require("./DataGrid"));
|
|
9
|
+
Object.keys(_DataGrid).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
12
|
+
if (key in exports && exports[key] === _DataGrid[key]) return;
|
|
13
|
+
Object.defineProperty(exports, key, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _DataGrid[key];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
var _default = _DataGrid.default;
|
|
23
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/src/func/func_grid.ts
CHANGED
|
@@ -269,6 +269,10 @@ export function get_row_id(obj: any): any {
|
|
|
269
269
|
if (typeof obj != 'object') return '-1';
|
|
270
270
|
return obj.__table_id || obj.id || '-1';
|
|
271
271
|
}
|
|
272
|
+
export function set_row_id(obj: any, val): any {
|
|
273
|
+
obj.__table_id = val;
|
|
274
|
+
return obj.__table_id;
|
|
275
|
+
}
|
|
272
276
|
|
|
273
277
|
/**
|
|
274
278
|
* Gets default activation key for grid plugin
|
package/src/views/DataGrid.tsx
CHANGED
|
@@ -159,6 +159,7 @@ const dynamic_option_names = ['selected', 'cellSelection', 'loading', 'limit', '
|
|
|
159
159
|
export function AzGrid(props: AzGridProps) {
|
|
160
160
|
const gridRefBackup = React.useRef<any>(null);
|
|
161
161
|
const gridRef = props.gridRef || gridRefBackup;
|
|
162
|
+
|
|
162
163
|
/* -------------------------------------------------------------------------- */
|
|
163
164
|
/* Columns */
|
|
164
165
|
/* -------------------------------------------------------------------------- */
|
|
@@ -432,7 +433,6 @@ function DataGridFlexSize(props: DataGridWrapperProps) {
|
|
|
432
433
|
className={'azgrid-filler'}
|
|
433
434
|
columns={props.columns}
|
|
434
435
|
dataSource={props.dataSource}
|
|
435
|
-
onCellSelectionChange
|
|
436
436
|
/>
|
|
437
437
|
{props.children}
|
|
438
438
|
</div>
|