react-graph-grid 0.0.5 → 0.0.7
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 +9 -1
- package/package.json +1 -1
- package/src/Dropdown.jsx +3 -3
- package/src/Grid.jsx +3 -1
- package/src/GridDB.jsx +6 -3
- package/src/GridFE.jsx +10 -5
- package/src/GridFL.jsx +12 -11
- package/src/Modal.jsx +3 -2
- package/src/Tests/DebugApp.jsx +1 -1
- package/src/css/default.css +0 -1
package/README.md
CHANGED
|
@@ -132,4 +132,12 @@ For more examples see DebugApp.jsx
|
|
|
132
132
|
|
|
133
133
|
0.0.5 version
|
|
134
134
|
|
|
135
|
-
"Adjust column visibility" option added to GridFE.jsx module
|
|
135
|
+
"Adjust column visibility" option added to GridFE.jsx module
|
|
136
|
+
|
|
137
|
+
0.0.6 version
|
|
138
|
+
|
|
139
|
+
Fixed GridFE.showColumnsSettings() function
|
|
140
|
+
|
|
141
|
+
0.0.7 version
|
|
142
|
+
|
|
143
|
+
Fixed GridDB and its dropdown communication
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mikhail Razumtsev",
|
|
4
4
|
"description": "A React package containing a grid that can communicate with other grids through a connection graph",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.7",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite --port 4000",
|
package/src/Dropdown.jsx
CHANGED
|
@@ -227,7 +227,7 @@ export class DropdownClass extends ModalClass {
|
|
|
227
227
|
|
|
228
228
|
dd.refreshState();
|
|
229
229
|
|
|
230
|
-
dd.getItems({ filter: dd.filter, pageSize: dd.pageSize, pageNumber: dd.pageNumber }).then(
|
|
230
|
+
dd.getItems({ self: dd, filter: dd.filter, pageSize: dd.pageSize, pageNumber: dd.pageNumber }).then(
|
|
231
231
|
items => {
|
|
232
232
|
afterGetItems(items);
|
|
233
233
|
}
|
|
@@ -259,7 +259,7 @@ export class DropdownClass extends ModalClass {
|
|
|
259
259
|
}
|
|
260
260
|
else {
|
|
261
261
|
if (dd.opt.onItemClick) {
|
|
262
|
-
dd.opt.onItemClick({ owner: dd.opt.owner, itemId: itemId,
|
|
262
|
+
dd.opt.onItemClick({ owner: dd.opt.owner, itemId: itemId, self: dd, clientX: e.clientX, clientY: e.clientY, target: e.target });
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
const clickedItem = dd.items.find(function (item) {
|
|
@@ -286,7 +286,7 @@ export class DropdownClass extends ModalClass {
|
|
|
286
286
|
case 'enter':
|
|
287
287
|
if (!dd.activeItem) return;
|
|
288
288
|
|
|
289
|
-
dd.opt.onItemClick({ owner: dd.opt.owner, itemId: dd.activeItem.id,
|
|
289
|
+
dd.opt.onItemClick({ owner: dd.opt.owner, itemId: dd.activeItem.id, self: dd });
|
|
290
290
|
dd.close();
|
|
291
291
|
break;
|
|
292
292
|
case 'down':
|
package/src/Grid.jsx
CHANGED
|
@@ -166,7 +166,9 @@ export class GridClass extends BaseComponent {
|
|
|
166
166
|
grid._waitingRows = false;
|
|
167
167
|
grid.refreshState();
|
|
168
168
|
}
|
|
169
|
-
).
|
|
169
|
+
).catch(() => {
|
|
170
|
+
grid._waitingRows = false;
|
|
171
|
+
}).finally(() => {
|
|
170
172
|
grid._waitingRows = false;
|
|
171
173
|
grid.refreshState();
|
|
172
174
|
});
|
package/src/GridDB.jsx
CHANGED
|
@@ -152,10 +152,13 @@ export class GridDBClass extends GridPKClass {
|
|
|
152
152
|
{super.render()}
|
|
153
153
|
{grid.renderPager(true)}
|
|
154
154
|
<Dropdown
|
|
155
|
-
init={(dd) => {
|
|
155
|
+
init={(dd) => {
|
|
156
|
+
grid.menuDropdown = dd;
|
|
157
|
+
dd._grid = grid;
|
|
158
|
+
}}
|
|
156
159
|
closeWhenMiss={true}
|
|
157
|
-
getItems={(e) => { return
|
|
158
|
-
onItemClick={(e) => {
|
|
160
|
+
getItems={(e) => { return e.self._grid.getGridSettings(e); }}
|
|
161
|
+
onItemClick={(e) => { e.self._grid.onSettingsItemClick(e.itemId); }}>
|
|
159
162
|
</Dropdown>
|
|
160
163
|
</>
|
|
161
164
|
)
|
package/src/GridFE.jsx
CHANGED
|
@@ -540,6 +540,13 @@ export class GridFEClass extends GridFLClass {
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
543
|
+
applyColumnsVisibility() {
|
|
544
|
+
const grid = this;
|
|
545
|
+
for (let col of grid.columns) {
|
|
546
|
+
col.visible = col._newVisible;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
543
550
|
showColumnsSettings() {
|
|
544
551
|
const grid = this;
|
|
545
552
|
grid.popupIsShowing = true;
|
|
@@ -556,11 +563,9 @@ export class GridFEClass extends GridFLClass {
|
|
|
556
563
|
{
|
|
557
564
|
title: grid.translate('OK'),
|
|
558
565
|
onClick: (e) => {
|
|
559
|
-
|
|
560
|
-
col.visible = col._newVisible;
|
|
561
|
-
}
|
|
566
|
+
grid.applyColumnsVisibility();
|
|
562
567
|
grid.columnsSettingsIsShowing = false;
|
|
563
|
-
grid.onClosePopup();
|
|
568
|
+
grid.onClosePopup(e);
|
|
564
569
|
grid.refreshState();
|
|
565
570
|
}
|
|
566
571
|
},
|
|
@@ -568,7 +573,7 @@ export class GridFEClass extends GridFLClass {
|
|
|
568
573
|
title: grid.translate('Cancel'),
|
|
569
574
|
onClick: (e) => {
|
|
570
575
|
grid.columnsSettingsIsShowing = false;
|
|
571
|
-
grid.onClosePopup();
|
|
576
|
+
grid.onClosePopup(e);
|
|
572
577
|
grid.refreshState();
|
|
573
578
|
}
|
|
574
579
|
},
|
package/src/GridFL.jsx
CHANGED
|
@@ -17,7 +17,7 @@ export function GridFL(props) {
|
|
|
17
17
|
grid = props.findGrid(props);
|
|
18
18
|
}
|
|
19
19
|
grid = grid || new GridFLClass(props);
|
|
20
|
-
needGetRows = !props.noAutoRefresh && !grid.hasVisibleParentGrids();
|
|
20
|
+
needGetRows = !props.noAutoRefresh && grid.hasVisibleParentGrids && !grid.hasVisibleParentGrids();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (props.init) {
|
|
@@ -77,25 +77,26 @@ export class GridFLClass extends GridDBClass {
|
|
|
77
77
|
<>
|
|
78
78
|
{super.render()}
|
|
79
79
|
<Dropdown
|
|
80
|
-
getItems={(e) => { return
|
|
81
|
-
onItemClick={(e) => {
|
|
80
|
+
getItems={(e) => { return e.self._grid.getAutocomleteItems(e); }}
|
|
81
|
+
onItemClick={(e) => { e.self._grid.onAutocomleteItemClick(e); }}
|
|
82
82
|
closeWhenMiss={true}
|
|
83
83
|
init={(dd) => {
|
|
84
84
|
if (grid._autocompleteDropdown) {
|
|
85
85
|
dd.visible = grid._autocompleteDropdown.visible;
|
|
86
86
|
}
|
|
87
87
|
grid._autocompleteDropdown = dd;
|
|
88
|
+
dd._grid = grid;
|
|
88
89
|
if (grid._autocompleteRect) {
|
|
89
90
|
dd.opt.parentRect = grid._autocompleteRect;
|
|
90
91
|
}
|
|
91
92
|
}}
|
|
92
|
-
onClose={() => {
|
|
93
|
-
if (
|
|
94
|
-
delete
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
onClose={(e) => {
|
|
94
|
+
if (e.self._grid._inputingColumn) {
|
|
95
|
+
delete e.self._grid._inputingColumn;
|
|
96
|
+
if (e.self._grid.needRefresh()) {
|
|
97
|
+
e.self._grid.pageNumber = 1;
|
|
98
|
+
e.self._grid.selectedRowIndex = 0;
|
|
99
|
+
e.self._grid.refresh();
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
}}
|
|
@@ -280,7 +281,7 @@ export class GridFLClass extends GridDBClass {
|
|
|
280
281
|
return;
|
|
281
282
|
}
|
|
282
283
|
|
|
283
|
-
e.
|
|
284
|
+
e.self.items = [];
|
|
284
285
|
grid._autocompleteDropdown.items = [];
|
|
285
286
|
grid._autocompleteDropdown.visible = false;
|
|
286
287
|
|
package/src/Modal.jsx
CHANGED
|
@@ -69,6 +69,7 @@ export class ModalClass extends BaseComponent {
|
|
|
69
69
|
wnd.opt.noHeader = props.noHeader;
|
|
70
70
|
wnd.opt.noFooter = props.noFooter;
|
|
71
71
|
wnd.opt.noPadding = props.noPadding;
|
|
72
|
+
wnd.opt.noBodyOverflow = props.noBodyOverflow;
|
|
72
73
|
|
|
73
74
|
wnd.opt.margin = props.margin;
|
|
74
75
|
wnd.opt.padding = props.padding;
|
|
@@ -184,7 +185,7 @@ export class ModalClass extends BaseComponent {
|
|
|
184
185
|
key={`window_${wnd.id}_body_`}
|
|
185
186
|
wnd-body={1}
|
|
186
187
|
className={wnd.opt.bodyClass}
|
|
187
|
-
style={{ padding: wnd.opt.noPadding ? '0' : '', overflow: 'auto', height: '100%' }}
|
|
188
|
+
style={{ padding: wnd.opt.noPadding ? '0' : '', overflow: wnd.opt.noBodyOverflow ? 'hidden' : 'auto', height: '100%' }}
|
|
188
189
|
>
|
|
189
190
|
{wnd.renderContent(wnd)}
|
|
190
191
|
</div>
|
|
@@ -309,7 +310,7 @@ export class ModalClass extends BaseComponent {
|
|
|
309
310
|
const wnd = this;
|
|
310
311
|
|
|
311
312
|
if (wnd.onClose) {
|
|
312
|
-
const ev = {};
|
|
313
|
+
const ev = { self: wnd };
|
|
313
314
|
wnd.onClose(ev);
|
|
314
315
|
if (ev.cancel) return;
|
|
315
316
|
}
|
package/src/Tests/DebugApp.jsx
CHANGED
|
@@ -134,7 +134,7 @@ function DebugApp() {
|
|
|
134
134
|
}
|
|
135
135
|
</div>
|
|
136
136
|
<Dropdown init={(dd) => { wnd.ddComponent = dd; }} getItems={GetPopupItems}
|
|
137
|
-
onItemClick={(e) => { /*console.log('Item clicked: ' + e.itemId); */e.
|
|
137
|
+
onItemClick={(e) => { /*console.log('Item clicked: ' + e.itemId); */e.self.clickedItem = e.itemId; wnd.refreshState(); }}
|
|
138
138
|
>
|
|
139
139
|
</Dropdown>
|
|
140
140
|
</>
|