@azrico/reactgrid 1.2.16 → 1.2.18
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 +4 -0
- package/dist/index.js +3 -21
- package/dist/src/example.js +118 -161
- package/dist/src/func/func_child.js +81 -84
- package/dist/src/func/func_grid.d.ts +1 -1
- package/dist/src/func/func_grid.js +278 -265
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +7 -25
- package/dist/src/views/DataGrid.js +223 -270
- package/dist/src/views/index.js +3 -23
- package/package.json +1 -1
- package/src/func/func_grid.ts +3 -2
- package/src/index.tsx +1 -0
- package/src/views/DataGrid.tsx +2 -2
- package/dist/src/themes/base_styles.css +0 -30
- package/dist/src/themes/grid.css +0 -20
|
@@ -1,274 +1,227 @@
|
|
|
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
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
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
|
-
|
|
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
|
-
/* -------------------------------------------------------------------------- */
|
|
1
|
+
import '@inovua/reactdatagrid-enterprise/index.css';
|
|
2
|
+
import '@inovua/reactdatagrid-enterprise/theme/default-dark.css';
|
|
3
|
+
import '@inovua/reactdatagrid-enterprise/theme/amber-dark.css';
|
|
4
|
+
import '../themes/base_styles.css';
|
|
5
|
+
import '../themes/grid.css';
|
|
6
|
+
import { ApplyColumnData, ApplyDataSource, _get_default_key, get_row_id, } from '../func/func_grid';
|
|
7
|
+
import { ContextMenu } from '@azrico/controls';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { func_selection } from '../func/func_child';
|
|
10
|
+
import ReactDataGrid from '@inovua/reactdatagrid-enterprise';
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
import { useComponentSize } from 'react-use-size';
|
|
13
|
+
/* -------------------------------------------------------------------------- */
|
|
14
|
+
const defaultOptions = {
|
|
15
|
+
//filterTypes: defaultfilterTypes,
|
|
16
|
+
remoteFilter: false,
|
|
17
|
+
remoteSort: false,
|
|
18
|
+
editStartEvent: 'click',
|
|
19
|
+
rowReorderColumn: false,
|
|
20
|
+
resizable: true,
|
|
21
|
+
columnUserSelect: true,
|
|
22
|
+
rowIndexColumn: true,
|
|
23
|
+
rowHeight: 35,
|
|
24
|
+
};
|
|
25
|
+
const forcedOptions = {
|
|
26
|
+
idProperty: '__table_id',
|
|
27
|
+
nodesProperty: '__children',
|
|
28
|
+
};
|
|
29
|
+
const dynamic_option_names = ['selected', 'cellSelection', 'loading', 'limit', 'skip'];
|
|
30
|
+
/* -------------------------------------------------------------------------- */
|
|
31
|
+
export function AzGrid(props) {
|
|
32
|
+
const gridRefBackup = React.useRef(null);
|
|
33
|
+
const gridRef = props.gridRef || gridRefBackup;
|
|
34
|
+
/* -------------------------------------------------------------------------- */
|
|
35
|
+
/* Columns */
|
|
36
|
+
/* -------------------------------------------------------------------------- */
|
|
37
|
+
const cached_columns = React.useMemo(() => {
|
|
38
|
+
return ApplyColumnData(props);
|
|
39
|
+
}, [
|
|
40
|
+
props.columns,
|
|
41
|
+
props.leftColumns,
|
|
42
|
+
props.rightColumns,
|
|
43
|
+
props.editableColumns,
|
|
44
|
+
props.columnExtensions,
|
|
45
|
+
props.customColumns,
|
|
46
|
+
]);
|
|
47
|
+
/* -------------------------------------------------------------------------- */
|
|
48
|
+
/* Row changes */
|
|
49
|
+
/* -------------------------------------------------------------------------- */
|
|
50
|
+
const cached_data = React.useRef();
|
|
51
|
+
const last_cache_info = React.useRef();
|
|
52
|
+
const dataSource = React.useCallback(async (dt) => {
|
|
53
|
+
return await ApplyDataSource(props.dataSource, {
|
|
54
|
+
skip: dt.skip,
|
|
55
|
+
limit: dt.limit,
|
|
56
|
+
cached_data: cached_data,
|
|
57
|
+
last_cache_info: last_cache_info,
|
|
58
|
+
});
|
|
59
|
+
}, [props.dataSource]);
|
|
60
|
+
const base_gridOptions = React.useMemo(() => {
|
|
61
|
+
const firstcolumn = cached_columns[0];
|
|
62
|
+
const licenseKey = props.licenseKey || _get_default_key();
|
|
63
|
+
const events = {
|
|
64
|
+
onSkipChange: props.onSkipChange,
|
|
65
|
+
onLimitChange: props.onLimitChange,
|
|
66
|
+
onEditComplete: props.onEditComplete,
|
|
67
|
+
};
|
|
68
|
+
const extra_ops = {
|
|
69
|
+
onSelectionChange: props.onSelectionChange,
|
|
70
|
+
onCellSelectionChange: props.onCellSelectionChange,
|
|
71
|
+
licenseKey: licenseKey,
|
|
72
|
+
editable: props.editable,
|
|
73
|
+
treeColumn: props.allowChildRows ? firstcolumn.name : undefined,
|
|
74
|
+
renderRowDetails: props.RowDetail,
|
|
75
|
+
theme: props.dark ? 'amber-dark' : 'default-light',
|
|
76
|
+
};
|
|
77
|
+
return { ...defaultOptions, ...events, ...extra_ops };
|
|
78
|
+
}, [
|
|
79
|
+
cached_columns,
|
|
80
|
+
props.allowChildRows,
|
|
81
|
+
props.editable,
|
|
82
|
+
props.RowDetail,
|
|
83
|
+
props.onEditComplete,
|
|
84
|
+
]);
|
|
85
|
+
const static_gridOptions = React.useMemo(() => {
|
|
86
|
+
return { ...base_gridOptions, ...props.gridOptions, ...forcedOptions };
|
|
87
|
+
}, [props.gridOptions, base_gridOptions, forcedOptions]);
|
|
88
|
+
const dynamic_gridOptions = React.useMemo(() => {
|
|
89
|
+
const res = {};
|
|
90
|
+
dynamic_option_names.map((r) => {
|
|
91
|
+
res[r] = props[r];
|
|
92
|
+
});
|
|
93
|
+
return res;
|
|
94
|
+
}, dynamic_option_names.map((r) => props[r]));
|
|
95
|
+
return (React.createElement(DataGridEventsWrapper, { ...props, gridRef: gridRef, static_gridOptions: static_gridOptions, dynamic_gridOptions: dynamic_gridOptions, columns: cached_columns, dataSource: dataSource, highlightedRow: props.highlightedRow }));
|
|
96
|
+
}
|
|
97
|
+
/* -------------------------------------------------------------------------- */
|
|
109
98
|
/**
|
|
110
99
|
* Wrapper for menu events
|
|
111
100
|
* @param props
|
|
112
101
|
* @returns
|
|
113
|
-
*/
|
|
114
|
-
function DataGridEventsWrapper(props) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
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
|
-
menuRow: menuRow,
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
/* -------------------------------------------------------------------------- */
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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;
|
|
102
|
+
*/
|
|
103
|
+
function DataGridEventsWrapper(props) {
|
|
104
|
+
/* -------------------------------------------------------------------------- */
|
|
105
|
+
const click_data = React.useRef(null);
|
|
106
|
+
const [menuAnchorEl, set_menuAnchorEl] = React.useState(null);
|
|
107
|
+
const [menuRow, set_menuRow] = React.useState(null);
|
|
108
|
+
/* --------------------------------- events --------------------------------- */
|
|
109
|
+
const onRowContextMenu = React.useCallback((rowProps, event) => {
|
|
110
|
+
if (func_selection.has_selection())
|
|
111
|
+
return;
|
|
112
|
+
update_menuRow(rowProps.data);
|
|
113
|
+
update_menuAnchorEl(func_selection.getVirtualElement(event.clientX, event.clientY));
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
}, []);
|
|
116
|
+
const onRowClick = React.useCallback((rowProps, event) => {
|
|
117
|
+
const nowDate = Date.now();
|
|
118
|
+
const lastclick = click_data.current[get_row_id(rowProps)];
|
|
119
|
+
if (lastclick) {
|
|
120
|
+
const diffTime = Math.abs(nowDate - lastclick);
|
|
121
|
+
if (diffTime < 400) {
|
|
122
|
+
click_data.current[get_row_id(rowProps)] = null;
|
|
123
|
+
return (props.onRowDoubleClick &&
|
|
124
|
+
props.onRowDoubleClick(rowProps.rowIndex, rowProps.data));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
click_data.current[get_row_id(rowProps)] = nowDate;
|
|
128
|
+
return props.onRowClick && props.onRowClick(rowProps.rowIndex, rowProps.data);
|
|
129
|
+
}, [props.onRowClick, props.onRowDoubleClick]);
|
|
130
|
+
React.useEffect(() => {
|
|
131
|
+
click_data.current = {};
|
|
132
|
+
}, [props.dataSource]);
|
|
133
|
+
/* ------------------------------- ContextMenu ------------------------------ */
|
|
134
|
+
const update_menuAnchorEl = React.useCallback((el) => {
|
|
135
|
+
if (el) {
|
|
136
|
+
set_menuAnchorEl(el);
|
|
137
|
+
}
|
|
138
|
+
else
|
|
139
|
+
set_menuAnchorEl(null);
|
|
140
|
+
}, []);
|
|
141
|
+
const update_menuRow = React.useCallback((r) => {
|
|
142
|
+
if (r) {
|
|
143
|
+
set_menuRow(r);
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
set_menuRow(null);
|
|
147
|
+
}, []);
|
|
148
|
+
/**
|
|
149
|
+
* Merge click events into grid options
|
|
150
|
+
*/
|
|
151
|
+
const static_gridOptions = React.useMemo(() => {
|
|
152
|
+
const events = {
|
|
153
|
+
onRowClick: onRowClick,
|
|
154
|
+
onRowContextMenu: onRowContextMenu,
|
|
155
|
+
};
|
|
156
|
+
return { ...props.static_gridOptions, ...events };
|
|
157
|
+
}, [props.static_gridOptions, onRowClick]);
|
|
158
|
+
const contextMenu = (React.createElement(ContextMenu, { menuAnchorEl: menuAnchorEl, set_menuAnchorEl: update_menuAnchorEl, menuRow: menuRow, items: props.contextMenuItems }));
|
|
159
|
+
if (props.details_dataSource) {
|
|
160
|
+
return (React.createElement(DataGridDetailsWrapper, { ...props, static_gridOptions: static_gridOptions },
|
|
161
|
+
contextMenu,
|
|
162
|
+
props.children));
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return (React.createElement(DataGridSizeWrapper, { ...props, static_gridOptions: static_gridOptions },
|
|
166
|
+
contextMenu,
|
|
167
|
+
props.children));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function DataGridDetailsWrapper(props) {
|
|
171
|
+
const cached_details_columns = React.useMemo(() => {
|
|
172
|
+
return ApplyColumnData(props.details_columns);
|
|
173
|
+
}, [props.details_columns]);
|
|
174
|
+
const cached_data = React.useRef();
|
|
175
|
+
const last_cache_info = React.useRef();
|
|
176
|
+
const dataSource = React.useCallback(async (dt) => {
|
|
177
|
+
const res = await ApplyDataSource(props.details_dataSource, {
|
|
178
|
+
skip: dt.skip,
|
|
179
|
+
limit: dt.limit,
|
|
180
|
+
cached_data: cached_data,
|
|
181
|
+
last_cache_info: last_cache_info,
|
|
182
|
+
});
|
|
183
|
+
console.log('ds', res);
|
|
184
|
+
return res;
|
|
185
|
+
}, [props.dataSource]);
|
|
186
|
+
const renderDetailsGrid = ({ data }) => {
|
|
187
|
+
return (React.createElement(ReactDataGrid, { defaultFilterValue: props.details_filter, dataSource: dataSource, columns: cached_details_columns }));
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Merge details into grid
|
|
191
|
+
*/
|
|
192
|
+
const static_gridOptions = React.useMemo(() => {
|
|
193
|
+
const finalresult = props.static_gridOptions || {};
|
|
194
|
+
finalresult['renderDetailsGrid'] = renderDetailsGrid;
|
|
195
|
+
return finalresult;
|
|
196
|
+
}, [props.static_gridOptions]);
|
|
197
|
+
return (React.createElement(DataGridSizeWrapper, { ...props, static_gridOptions: static_gridOptions }, props.children));
|
|
198
|
+
}
|
|
199
|
+
function DataGridSizeWrapper(props) {
|
|
200
|
+
if (props.delayedSize) {
|
|
201
|
+
return React.createElement(DataGridDelayedSize, { ...props });
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return React.createElement(DataGridFlexSize, { ...props });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/* -------------------------------------------------------------------------- */
|
|
208
|
+
function DataGridDelayedSize(props) {
|
|
209
|
+
const { ref, height, width } = useComponentSize();
|
|
210
|
+
return (React.createElement("div", { ref: ref, className: clsx(props.className, 'azgrid-nooverflow', 'azgrid-filler') },
|
|
211
|
+
React.createElement(ReactDataGrid, { ...props.static_gridOptions, ...props.dynamic_gridOptions, handle: (ref) => (props.gridRef.current = ref ? ref.current : null), className: 'azgrid-delayedresize', style: {
|
|
212
|
+
height: height,
|
|
213
|
+
width: width,
|
|
214
|
+
}, columns: props.columns, dataSource: props.dataSource }),
|
|
215
|
+
props.children));
|
|
216
|
+
}
|
|
217
|
+
function DataGridFlexSize(props) {
|
|
218
|
+
return (React.createElement("div", { className: clsx(props.className, 'azgrid-nooverflow', 'azgrid-filler') },
|
|
219
|
+
React.createElement(ReactDataGrid, { ...props.static_gridOptions, ...props.dynamic_gridOptions, handle: (ref) => (props.gridRef.current = ref ? ref.current : null), className: 'azgrid-filler', columns: props.columns, dataSource: props.dataSource }),
|
|
220
|
+
props.children));
|
|
221
|
+
}
|
|
222
|
+
/* -------------------------------------------------------------------------- */
|
|
223
|
+
/* -------------------------------------------------------------------------- */
|
|
224
|
+
/* -------------------------------------------------------------------------- */
|
|
225
|
+
/* -------------------------------------------------------------------------- */
|
|
226
|
+
/* -------------------------------------------------------------------------- */
|
|
227
|
+
export default AzGrid;
|
package/dist/src/views/index.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
1
|
+
export * from './DataGrid';
|
|
2
|
+
import AzGrid from './DataGrid';
|
|
3
|
+
export default AzGrid;
|
package/package.json
CHANGED
package/src/func/func_grid.ts
CHANGED
|
@@ -269,8 +269,9 @@ 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
|
|
272
|
+
export function set_row_id(obj: any, val: undefined | string): any {
|
|
273
|
+
if (val === undefined) delete obj.__table_id;
|
|
274
|
+
else obj.__table_id = val;
|
|
274
275
|
return obj.__table_id;
|
|
275
276
|
}
|
|
276
277
|
|
package/src/index.tsx
CHANGED
package/src/views/DataGrid.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ApplyColumnData,
|
|
9
9
|
ApplyDataSource,
|
|
10
10
|
ModifyFields,
|
|
11
|
-
|
|
11
|
+
_get_default_key,
|
|
12
12
|
get_row_id,
|
|
13
13
|
validateCache,
|
|
14
14
|
} from '../func/func_grid';
|
|
@@ -194,7 +194,7 @@ export function AzGrid(props: AzGridProps) {
|
|
|
194
194
|
|
|
195
195
|
const base_gridOptions = React.useMemo<AzGridOptions>(() => {
|
|
196
196
|
const firstcolumn = cached_columns[0];
|
|
197
|
-
const licenseKey = props.licenseKey ||
|
|
197
|
+
const licenseKey = props.licenseKey || _get_default_key();
|
|
198
198
|
const events: AzGridOptions = {
|
|
199
199
|
onSkipChange: props.onSkipChange,
|
|
200
200
|
onLimitChange: props.onLimitChange,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.azgrid-container {
|
|
2
|
-
height: 100%;
|
|
3
|
-
width: 100%;
|
|
4
|
-
}
|
|
5
|
-
.azgrid-borderbox {
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
}
|
|
8
|
-
.azgrid-filler {
|
|
9
|
-
height: 100%;
|
|
10
|
-
width: 100%;
|
|
11
|
-
}
|
|
12
|
-
.azgrid-nooverflow {
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
}
|
|
15
|
-
.azgrid-testborder {
|
|
16
|
-
border: 3px solid red;
|
|
17
|
-
}
|
|
18
|
-
.azgrid-pad50px {
|
|
19
|
-
padding: 50px;
|
|
20
|
-
}
|
|
21
|
-
.azgrid-nopad {
|
|
22
|
-
padding: 0;
|
|
23
|
-
}
|
|
24
|
-
.azgrid-nomargin {
|
|
25
|
-
margin: 0;
|
|
26
|
-
}
|
|
27
|
-
.azgrid-delayedresize {
|
|
28
|
-
transition-property: 'width,height';
|
|
29
|
-
transition-delay: 200ms;
|
|
30
|
-
}
|
package/dist/src/themes/grid.css
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/* .InovuaReactDataGrid {
|
|
2
|
-
--grid-bg: '#fff';
|
|
3
|
-
}
|
|
4
|
-
.InovuaReactDataGrid {
|
|
5
|
-
background: var(--grid-bg) !important;
|
|
6
|
-
}
|
|
7
|
-
.InovuaReactDataGrid__header {
|
|
8
|
-
background: var(--grid-bg) !important;
|
|
9
|
-
}
|
|
10
|
-
.InovuaReactDataGrid__row {
|
|
11
|
-
background: var(--grid-bg) !important;
|
|
12
|
-
}
|
|
13
|
-
.InovuaReactDataGrid__cell {
|
|
14
|
-
background: var(--grid-bg) !important;
|
|
15
|
-
} */
|
|
16
|
-
.InovuaReactDataGrid__cell .InovuaReactDataGrid__cell__content {
|
|
17
|
-
height: 100%;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
}
|