@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.
@@ -1,274 +1,227 @@
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
- /* -------------------------------------------------------------------------- */
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
- 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;
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;
@@ -1,23 +1,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;
1
+ export * from './DataGrid';
2
+ import AzGrid from './DataGrid';
3
+ export default AzGrid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -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 = val;
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
@@ -1,4 +1,5 @@
1
1
  export * from './views/DataGrid';
2
+ export { get_row_id, set_row_id } from './func/func_grid';
2
3
 
3
4
  import AzGrid from './views/DataGrid';
4
5
  import ExampleGrid from './example';
@@ -8,7 +8,7 @@ import {
8
8
  ApplyColumnData,
9
9
  ApplyDataSource,
10
10
  ModifyFields,
11
- get_default_key,
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 || get_default_key();
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
- }
@@ -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
- }