@azrico/reactgrid 1.2.35 → 1.2.37
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 +28 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +21 -3
- package/dist/src/example.d.ts +4 -4
- package/dist/src/example.js +155 -112
- package/dist/src/func/func_child.d.ts +29 -29
- package/dist/src/func/func_child.js +73 -70
- package/dist/src/func/func_grid.d.ts +39 -39
- package/dist/src/func/func_grid.js +261 -275
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +60 -10
- package/dist/src/views/DataGrid.d.ts +79 -79
- package/dist/src/views/DataGrid.js +241 -195
- package/dist/src/views/index.d.ts +3 -3
- package/dist/src/views/index.js +23 -3
- package/package.json +1 -1
- package/src/views/DataGrid.tsx +32 -35
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.2.37](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.37) (2023-07-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* editable can be a function ([6ea857e](https://github.com/Azrideus/azrico-reactgrid/commit/6ea857e4f403d2a334dc5e74065f6b8033277ca4))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* DataGridDelayedSizeWrapper actual delayed ([2ddfd2f](https://github.com/Azrideus/azrico-reactgrid/commit/2ddfd2fb58c90bd906e1330f22f0ef7468d34afb))
|
|
16
|
+
* onCellSelectionChange ([95c8f54](https://github.com/Azrideus/azrico-reactgrid/commit/95c8f540e94dde0c7e245fb29fb6afc7172957ec))
|
|
17
|
+
* styling ([9018f75](https://github.com/Azrideus/azrico-reactgrid/commit/9018f7593e253720f751f52855a2d956dfc578ed))
|
|
18
|
+
|
|
19
|
+
### [1.2.36](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.36) (2023-07-09)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* editable can be a function ([6ea857e](https://github.com/Azrideus/azrico-reactgrid/commit/6ea857e4f403d2a334dc5e74065f6b8033277ca4))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* DataGridDelayedSizeWrapper actual delayed ([2ddfd2f](https://github.com/Azrideus/azrico-reactgrid/commit/2ddfd2fb58c90bd906e1330f22f0ef7468d34afb))
|
|
30
|
+
* onCellSelectionChange ([95c8f54](https://github.com/Azrideus/azrico-reactgrid/commit/95c8f540e94dde0c7e245fb29fb6afc7172957ec))
|
|
31
|
+
* styling ([9018f75](https://github.com/Azrideus/azrico-reactgrid/commit/9018f7593e253720f751f52855a2d956dfc578ed))
|
|
32
|
+
|
|
5
33
|
### [1.2.35](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.35) (2023-07-09)
|
|
6
34
|
|
|
7
35
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './src';
|
|
2
|
-
import { AzGrid } from './src';
|
|
3
|
-
export default AzGrid;
|
|
1
|
+
export * from './src';
|
|
2
|
+
import { AzGrid } from './src';
|
|
3
|
+
export default AzGrid;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
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 _src = require("./src");
|
|
9
|
+
Object.keys(_src).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] === _src[key]) return;
|
|
13
|
+
Object.defineProperty(exports, key, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _src[key];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
var _default = _src.AzGrid;
|
|
21
|
+
exports.default = _default;
|
package/dist/src/example.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './views/DataGrid';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export declare function ExampleGrid(): React.JSX.Element;
|
|
4
|
-
export default ExampleGrid;
|
|
1
|
+
export * from './views/DataGrid';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare function ExampleGrid(): React.JSX.Element;
|
|
4
|
+
export default ExampleGrid;
|
package/dist/src/example.js
CHANGED
|
@@ -1,118 +1,161 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
ExampleGrid: true
|
|
8
|
+
};
|
|
9
|
+
exports.ExampleGrid = ExampleGrid;
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
var _DataGrid = _interopRequireWildcard(require("./views/DataGrid"));
|
|
12
|
+
Object.keys(_DataGrid).forEach(function (key) {
|
|
13
|
+
if (key === "default" || key === "__esModule") return;
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
15
|
+
if (key in exports && exports[key] === _DataGrid[key]) return;
|
|
16
|
+
Object.defineProperty(exports, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _DataGrid[key];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
var _react = _interopRequireDefault(require("react"));
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
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); }
|
|
26
|
+
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; }
|
|
27
|
+
const columns = [{
|
|
28
|
+
name: 'name',
|
|
29
|
+
title: 'Name',
|
|
30
|
+
defaultFlex: 1
|
|
31
|
+
}, {
|
|
32
|
+
name: 'job',
|
|
33
|
+
title: 'Job',
|
|
34
|
+
type: 'combo',
|
|
35
|
+
items: ['None', 'Engineer', 'Doctor'],
|
|
36
|
+
defaultFlex: 1
|
|
37
|
+
}, {
|
|
38
|
+
name: 'age',
|
|
39
|
+
title: 'Age',
|
|
40
|
+
defaultFlex: 1
|
|
41
|
+
}];
|
|
23
42
|
const editableColumns = ['job', 'age'];
|
|
24
43
|
const contextMenuItems = ['test'];
|
|
25
44
|
function getData(delta, max = 200) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
const childrows = [];
|
|
41
|
-
if (index % 5 == 0) {
|
|
42
|
-
const sub_selfid = 's' + index;
|
|
43
|
-
childrows.push({
|
|
44
|
-
__table_id: sub_selfid,
|
|
45
|
-
__parent__table_id: String(index),
|
|
46
|
-
name: 'sub-' + index,
|
|
47
|
-
age: 20,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
currentObject['__children'] = childrows;
|
|
51
|
-
fd.push(currentObject);
|
|
45
|
+
const fd = [];
|
|
46
|
+
console.log('Delta:', delta);
|
|
47
|
+
for (let index = 0; index < max; index++) {
|
|
48
|
+
const currentObject = {
|
|
49
|
+
__table_id: String(index),
|
|
50
|
+
name: 'user-' + index,
|
|
51
|
+
age: 20,
|
|
52
|
+
job: 'None'
|
|
53
|
+
};
|
|
54
|
+
if (delta[index] && typeof delta[index] === 'object') {
|
|
55
|
+
for (const key in delta[index]) {
|
|
56
|
+
currentObject[key] = delta[index][key];
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
resolve(getData(delta));
|
|
64
|
-
}, 1000);
|
|
65
|
-
});
|
|
66
|
-
}, [ds_reset, delta]);
|
|
67
|
-
const details_dataSource = React.useCallback(async (dt) => {
|
|
68
|
-
//console.log('Start loading');
|
|
69
|
-
return await new Promise((resolve) => {
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
resolve(getData(delta, 5));
|
|
72
|
-
}, 1000);
|
|
73
|
-
});
|
|
74
|
-
}, [ds_reset, delta]);
|
|
75
|
-
function onEditComplete(params) {
|
|
76
|
-
const { value, columnId, rowId, ...rest } = params;
|
|
77
|
-
let new_rd = delta[rowId];
|
|
78
|
-
if (!new_rd)
|
|
79
|
-
new_rd = {};
|
|
80
|
-
new_rd[columnId] = value;
|
|
81
|
-
set_delta((d) => {
|
|
82
|
-
return { ...d, [rowId]: new_rd };
|
|
83
|
-
});
|
|
59
|
+
const childrows = [];
|
|
60
|
+
if (index % 5 == 0) {
|
|
61
|
+
const sub_selfid = 's' + index;
|
|
62
|
+
childrows.push({
|
|
63
|
+
__table_id: sub_selfid,
|
|
64
|
+
__parent__table_id: String(index),
|
|
65
|
+
name: 'sub-' + index,
|
|
66
|
+
age: 20
|
|
67
|
+
});
|
|
84
68
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
69
|
+
currentObject['__children'] = childrows;
|
|
70
|
+
fd.push(currentObject);
|
|
71
|
+
}
|
|
72
|
+
return fd;
|
|
73
|
+
}
|
|
74
|
+
function ExampleGrid() {
|
|
75
|
+
const [ds_reset, set_ds_reset] = _react.default.useState(0);
|
|
76
|
+
const [delta, set_delta] = _react.default.useState({});
|
|
77
|
+
const [delayed_reload, set_delayed_reload] = _react.default.useState(false);
|
|
78
|
+
const dataSource = _react.default.useCallback(async dt => {
|
|
79
|
+
//console.log('Start loading');
|
|
80
|
+
return await new Promise(resolve => {
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
resolve(getData(delta));
|
|
83
|
+
}, 1000);
|
|
84
|
+
});
|
|
85
|
+
}, [ds_reset, delta]);
|
|
86
|
+
const details_dataSource = _react.default.useCallback(async dt => {
|
|
87
|
+
//console.log('Start loading');
|
|
88
|
+
return await new Promise(resolve => {
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
resolve(getData(delta, 5));
|
|
91
|
+
}, 1000);
|
|
92
|
+
});
|
|
93
|
+
}, [ds_reset, delta]);
|
|
94
|
+
function onEditComplete(params) {
|
|
95
|
+
const {
|
|
96
|
+
value,
|
|
97
|
+
columnId,
|
|
98
|
+
rowId,
|
|
99
|
+
...rest
|
|
100
|
+
} = params;
|
|
101
|
+
let new_rd = delta[rowId];
|
|
102
|
+
if (!new_rd) new_rd = {};
|
|
103
|
+
new_rd[columnId] = value;
|
|
104
|
+
set_delta(d => {
|
|
105
|
+
return {
|
|
106
|
+
...d,
|
|
107
|
+
[rowId]: new_rd
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const onRowDoubleClick = _react.default.useCallback((index, rowdata) => {
|
|
112
|
+
console.log('dbl', (rowdata === null || rowdata === void 0 ? void 0 : rowdata.data) || rowdata);
|
|
113
|
+
}, []);
|
|
114
|
+
const onRowClick = _react.default.useCallback((index, rowdata) => {
|
|
115
|
+
//console.log(rowdata?.data || rowdata);
|
|
116
|
+
}, []);
|
|
117
|
+
_react.default.useEffect(() => {
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
set_delayed_reload(true);
|
|
120
|
+
}, 2000);
|
|
121
|
+
}, []);
|
|
122
|
+
const customColumns = _react.default.useMemo(() => {
|
|
123
|
+
if (!delayed_reload) return [];
|
|
124
|
+
return [{
|
|
125
|
+
name: 'name',
|
|
126
|
+
render: r => r.value + '^'
|
|
127
|
+
}];
|
|
128
|
+
}, [delayed_reload]);
|
|
129
|
+
return _react.default.createElement(_DataGrid.default, {
|
|
130
|
+
dark: true,
|
|
131
|
+
delayedSize: true,
|
|
132
|
+
details_dataSource: details_dataSource,
|
|
133
|
+
details_columns: columns,
|
|
134
|
+
onRowClick: onRowClick,
|
|
135
|
+
onRowDoubleClick: onRowDoubleClick,
|
|
136
|
+
allowChildRows: true,
|
|
137
|
+
// onSelectionChange={onSelectionChange}
|
|
138
|
+
// selected={selected}
|
|
139
|
+
contextMenuItems: contextMenuItems,
|
|
140
|
+
customColumns: customColumns,
|
|
141
|
+
columns: columns,
|
|
142
|
+
editableColumns: editableColumns,
|
|
143
|
+
editable: true,
|
|
144
|
+
onEditComplete: onEditComplete,
|
|
145
|
+
// leftColumns={leftColumns}
|
|
146
|
+
gridOptions: {
|
|
147
|
+
// defaultFilterValue: filterValue,
|
|
148
|
+
// remoteFilter: false,
|
|
149
|
+
// multiSelect: true,
|
|
150
|
+
// pagination: 'local',
|
|
151
|
+
// defaultLimit: 100,
|
|
152
|
+
// limit: 100,
|
|
153
|
+
// pageSizes: [100],
|
|
154
|
+
// rowIndexColumn: true,
|
|
155
|
+
// checkboxColumn: true,
|
|
156
|
+
},
|
|
157
|
+
dataSource: dataSource
|
|
158
|
+
});
|
|
117
159
|
}
|
|
118
|
-
|
|
160
|
+
var _default = ExampleGrid;
|
|
161
|
+
exports.default = _default;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
type mrow = {
|
|
2
|
-
__parent__table_id: any;
|
|
3
|
-
__table_id: any;
|
|
4
|
-
__children?: any[];
|
|
5
|
-
};
|
|
6
|
-
export declare function fix_parent_child_relations<T extends mrow>(rows: T[]): T[];
|
|
7
|
-
export declare class func_selection {
|
|
8
|
-
static getVirtualElement(x?: number, y?: number): {
|
|
9
|
-
getBoundingClientRect: () => {
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
|
-
top: number;
|
|
13
|
-
right: number;
|
|
14
|
-
bottom: number;
|
|
15
|
-
left: number;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
static generateGetBoundingClientRect(x?: number, y?: number): () => {
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
top: number;
|
|
22
|
-
right: number;
|
|
23
|
-
bottom: number;
|
|
24
|
-
left: number;
|
|
25
|
-
};
|
|
26
|
-
static get_selectedText(): string;
|
|
27
|
-
static has_selection(): boolean;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
1
|
+
type mrow = {
|
|
2
|
+
__parent__table_id: any;
|
|
3
|
+
__table_id: any;
|
|
4
|
+
__children?: any[];
|
|
5
|
+
};
|
|
6
|
+
export declare function fix_parent_child_relations<T extends mrow>(rows: T[]): T[];
|
|
7
|
+
export declare class func_selection {
|
|
8
|
+
static getVirtualElement(x?: number, y?: number): {
|
|
9
|
+
getBoundingClientRect: () => {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
top: number;
|
|
13
|
+
right: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
left: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
static generateGetBoundingClientRect(x?: number, y?: number): () => {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
top: number;
|
|
22
|
+
right: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
left: number;
|
|
25
|
+
};
|
|
26
|
+
static get_selectedText(): string;
|
|
27
|
+
static has_selection(): boolean;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -1,82 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fix_parent_child_relations = fix_parent_child_relations;
|
|
7
|
+
exports.func_selection = void 0;
|
|
1
8
|
function get_parentId(obj) {
|
|
2
|
-
|
|
9
|
+
return obj.__parent__table_id || obj.parent;
|
|
3
10
|
}
|
|
4
11
|
function get_selfId(obj) {
|
|
5
|
-
|
|
12
|
+
return obj.__table_id;
|
|
6
13
|
}
|
|
7
14
|
//given an array of rows, fixes parent,child relations
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
15
|
+
function fix_parent_child_relations(rows) {
|
|
16
|
+
if (!Array.isArray(rows)) rows = [];
|
|
17
|
+
const anyparentid = rows.find(r => get_parentId(r));
|
|
18
|
+
const anyselfid = rows.find(r => get_selfId(r));
|
|
19
|
+
if (!anyparentid || !anyselfid) return rows;
|
|
20
|
+
const converted_rows = rows.filter(r => r != null).map(r => {
|
|
21
|
+
return {
|
|
22
|
+
parent: get_parentId(r),
|
|
23
|
+
self: get_selfId(r),
|
|
24
|
+
data: r
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
const top_level_rows = converted_rows.filter(r => !r.parent);
|
|
28
|
+
const any_child = converted_rows.find(r => Boolean(r.parent));
|
|
29
|
+
if (any_child) {
|
|
30
|
+
//find children of top-level parents:
|
|
31
|
+
for (let index = 0; index < top_level_rows.length; index++) {
|
|
32
|
+
const mrow = top_level_rows[index];
|
|
33
|
+
assign_children(mrow, converted_rows);
|
|
28
34
|
}
|
|
29
|
-
|
|
35
|
+
}
|
|
36
|
+
return top_level_rows.map(r => r.data);
|
|
30
37
|
}
|
|
31
38
|
function assign_children(row, all_rows) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
row.data.__children = my_children.map((r) => r.data);
|
|
39
|
+
const my_children = all_rows.filter(s => row.self == s.parent);
|
|
40
|
+
if (my_children.length > 0) {
|
|
41
|
+
//find children of my children:
|
|
42
|
+
for (let index = 0; index < my_children.length; index++) {
|
|
43
|
+
const child = my_children[index];
|
|
44
|
+
assign_children(child, all_rows);
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
row.data.__children = my_children.map(r => r.data);
|
|
47
|
+
} else if (!Array.isArray(row.data.__children) || row.data.__children.length == 0) row.data.__children = undefined;
|
|
43
48
|
}
|
|
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
|
-
return text || '';
|
|
71
|
-
}
|
|
72
|
-
static has_selection() {
|
|
73
|
-
const slct = window.getSelection();
|
|
74
|
-
if (slct == null)
|
|
75
|
-
return false;
|
|
76
|
-
if (slct.type == null)
|
|
77
|
-
return func_selection.get_selectedText().length !== 0;
|
|
78
|
-
if (slct.type === 'Range')
|
|
79
|
-
return true;
|
|
80
|
-
return false;
|
|
49
|
+
class func_selection {
|
|
50
|
+
static getVirtualElement(x = 0, y = 0) {
|
|
51
|
+
const boundsRect = func_selection.generateGetBoundingClientRect(x, y);
|
|
52
|
+
return {
|
|
53
|
+
getBoundingClientRect: boundsRect
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static generateGetBoundingClientRect(x = 0, y = 0) {
|
|
57
|
+
return () => ({
|
|
58
|
+
width: 0,
|
|
59
|
+
height: 0,
|
|
60
|
+
top: y,
|
|
61
|
+
right: x,
|
|
62
|
+
bottom: y,
|
|
63
|
+
left: x
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
static get_selectedText() {
|
|
67
|
+
var text = '';
|
|
68
|
+
if (window.getSelection) {
|
|
69
|
+
var _window$getSelection;
|
|
70
|
+
text = (_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString();
|
|
71
|
+
} else if (document.selection && document.selection.type != 'Control') {
|
|
72
|
+
var _document$selection$c;
|
|
73
|
+
text = (_document$selection$c = document.selection.createRange()) === null || _document$selection$c === void 0 ? void 0 : _document$selection$c.text;
|
|
81
74
|
}
|
|
75
|
+
return text || '';
|
|
76
|
+
}
|
|
77
|
+
static has_selection() {
|
|
78
|
+
const slct = window.getSelection();
|
|
79
|
+
if (slct == null) return false;
|
|
80
|
+
if (slct.type == null) return func_selection.get_selectedText().length !== 0;
|
|
81
|
+
if (slct.type === 'Range') return true;
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
82
84
|
}
|
|
85
|
+
exports.func_selection = func_selection;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { ColumnDefinition } from '../views/DataGrid';
|
|
2
|
-
export type MakeWriteable<Type> = {
|
|
3
|
-
-readonly [Key in keyof Type]: Type[Key];
|
|
4
|
-
};
|
|
5
|
-
export type ModifyFields<T, R> = Omit<T, keyof R> & R;
|
|
6
|
-
export declare function ApplyDataSource(datasource: any, props: any): Promise<any>;
|
|
7
|
-
/**
|
|
8
|
-
* merges together all different props for columns
|
|
9
|
-
* to build a single final column data array
|
|
10
|
-
* @param column_data
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
export declare function ApplyColumnData(column_data: any): ColumnDefinition[];
|
|
14
|
-
export declare function to_datasource(arr: any[], idProperty: string, valueAsID?: boolean): any[];
|
|
15
|
-
/**
|
|
16
|
-
* Gets name of a column from its column object
|
|
17
|
-
* @param obj
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
export declare function get_col_name(obj: any): string;
|
|
21
|
-
/**
|
|
22
|
-
* Gets header of a column
|
|
23
|
-
* @param obj
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
export declare function get_col_header(obj: any): string;
|
|
27
|
-
/**
|
|
28
|
-
* Gets name of a column from its column object
|
|
29
|
-
* @param obj
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export declare function get_row_id(obj: any): any;
|
|
33
|
-
export declare function set_row_id(obj: any, val: undefined | string): any;
|
|
34
|
-
/**
|
|
35
|
-
* Gets default activation key for grid plugin
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
export declare function get_default_key(): string;
|
|
39
|
-
export declare function validateCache(current: any, old: any, looseCheck?: boolean): boolean;
|
|
1
|
+
import { ColumnDefinition } from '../views/DataGrid';
|
|
2
|
+
export type MakeWriteable<Type> = {
|
|
3
|
+
-readonly [Key in keyof Type]: Type[Key];
|
|
4
|
+
};
|
|
5
|
+
export type ModifyFields<T, R> = Omit<T, keyof R> & R;
|
|
6
|
+
export declare function ApplyDataSource(datasource: any, props: any): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* merges together all different props for columns
|
|
9
|
+
* to build a single final column data array
|
|
10
|
+
* @param column_data
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function ApplyColumnData(column_data: any): ColumnDefinition[];
|
|
14
|
+
export declare function to_datasource(arr: any[], idProperty: string, valueAsID?: boolean): any[];
|
|
15
|
+
/**
|
|
16
|
+
* Gets name of a column from its column object
|
|
17
|
+
* @param obj
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function get_col_name(obj: any): string;
|
|
21
|
+
/**
|
|
22
|
+
* Gets header of a column
|
|
23
|
+
* @param obj
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
export declare function get_col_header(obj: any): string;
|
|
27
|
+
/**
|
|
28
|
+
* Gets name of a column from its column object
|
|
29
|
+
* @param obj
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export declare function get_row_id(obj: any): any;
|
|
33
|
+
export declare function set_row_id(obj: any, val: undefined | string): any;
|
|
34
|
+
/**
|
|
35
|
+
* Gets default activation key for grid plugin
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export declare function get_default_key(): string;
|
|
39
|
+
export declare function validateCache(current: any, old: any, looseCheck?: boolean): boolean;
|