react-graph-grid 0.1.4 → 0.1.6

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.
Files changed (88) hide show
  1. package/README.md +4 -0
  2. package/{src/css → dist}/default.css +2 -1
  3. package/dist/index.esm.js +21 -0
  4. package/dist/index.js +56 -0
  5. package/dist/index10.esm.js +3844 -0
  6. package/dist/index10.js +3848 -0
  7. package/dist/index11.esm.js +4121 -0
  8. package/dist/index11.js +4125 -0
  9. package/dist/index12.esm.js +5238 -0
  10. package/dist/index12.js +5242 -0
  11. package/dist/index13.esm.js +5466 -0
  12. package/dist/index13.js +5470 -0
  13. package/dist/index14.esm.js +22 -0
  14. package/dist/index14.js +26 -0
  15. package/dist/index15.esm.js +402 -0
  16. package/dist/index15.js +403 -0
  17. package/dist/index16.esm.js +507 -0
  18. package/dist/index16.js +507 -0
  19. package/dist/index17.esm.js +256 -0
  20. package/dist/index17.js +257 -0
  21. package/dist/index18.esm.js +261 -0
  22. package/dist/index18.js +263 -0
  23. package/dist/index19.esm.js +623 -0
  24. package/dist/index19.js +624 -0
  25. package/dist/index2.esm.js +6 -0
  26. package/dist/index2.js +2 -0
  27. package/dist/index20.esm.js +219 -0
  28. package/dist/index20.js +220 -0
  29. package/dist/index21.esm.js +298 -0
  30. package/dist/index21.js +299 -0
  31. package/dist/index22.esm.js +662 -0
  32. package/dist/index22.js +663 -0
  33. package/dist/index23.esm.js +340 -0
  34. package/dist/index23.js +341 -0
  35. package/dist/index24.esm.js +269 -0
  36. package/dist/index24.js +270 -0
  37. package/dist/index25.esm.js +600 -0
  38. package/dist/index25.js +601 -0
  39. package/dist/index26.esm.js +245 -0
  40. package/dist/index26.js +246 -0
  41. package/dist/index27.esm.js +136 -0
  42. package/dist/index27.js +137 -0
  43. package/dist/index28.esm.js +70 -0
  44. package/dist/index28.js +70 -0
  45. package/dist/index29.esm.js +748 -0
  46. package/dist/index29.js +748 -0
  47. package/dist/index30.esm.js +363 -0
  48. package/dist/index30.js +363 -0
  49. package/dist/index4.esm.js +27 -0
  50. package/dist/index4.js +27 -0
  51. package/dist/index5.esm.js +35 -0
  52. package/dist/index5.js +39 -0
  53. package/dist/index6.esm.js +200 -0
  54. package/dist/index6.js +204 -0
  55. package/dist/index7.esm.js +9 -0
  56. package/dist/index7.js +13 -0
  57. package/dist/index8.esm.js +65 -0
  58. package/dist/index8.js +68 -0
  59. package/dist/index9.esm.js +102 -0
  60. package/dist/index9.js +103 -0
  61. package/package.json +6 -3
  62. package/eslint.config.js +0 -29
  63. package/index.html +0 -13
  64. package/index.js +0 -19
  65. package/npm.aps +0 -0
  66. package/src/Base.jsx +0 -81
  67. package/src/Card.jsx +0 -333
  68. package/src/Dropdown.jsx +0 -339
  69. package/src/FieldEdit.jsx +0 -376
  70. package/src/Graph.jsx +0 -482
  71. package/src/Grid.jsx +0 -887
  72. package/src/GridCD.jsx +0 -180
  73. package/src/GridDB.jsx +0 -897
  74. package/src/GridFE.jsx +0 -753
  75. package/src/GridFL.jsx +0 -468
  76. package/src/GridGR.jsx +0 -311
  77. package/src/GridPK.jsx +0 -414
  78. package/src/Modal.jsx +0 -511
  79. package/src/Overlay.jsx +0 -140
  80. package/src/Tests/DebugApp.jsx +0 -334
  81. package/src/Tests/TestData.jsx +0 -251
  82. package/src/Themes/DefaultGridTheme.jsx +0 -36
  83. package/src/Themes/Images.jsx +0 -438
  84. package/src/Themes/Translate.jsx +0 -76
  85. package/src/css/default_.css +0 -945
  86. package/src/main.jsx +0 -10
  87. package/vite.config.js +0 -14
  88. /package/{public → dist}/IM.svg +0 -0
package/src/GridCD.jsx DELETED
@@ -1,180 +0,0 @@
1
- /* eslint-disable no-mixed-operators */
2
- import { useState, useEffect } from 'react';
3
- import { GridFEClass } from './GridFE';
4
- import { Card } from './Card';
5
- // ==================================================================================================================================================================
6
- export function GridCD(props) {
7
- let grid = null;
8
-
9
- const [gridState, setState] = useState({ grid: grid, ind: 0 });
10
-
11
- grid = gridState.grid;
12
- let needGetRows = false;
13
- if (!grid || grid.uid !== props.uid && props.uid != null) {
14
- grid = null;
15
- if (props.findGrid) {
16
- grid = props.findGrid(props);
17
- }
18
- grid = grid || new GridCDClass(props);
19
- needGetRows = !props.noAutoRefresh && !grid.hasVisibleParentGrids();
20
- }
21
-
22
- if (props.init) {
23
- props.init(grid);
24
- }
25
-
26
- grid.refreshState = function () {
27
- setState({ grid: grid, ind: grid.stateind++ });
28
- }
29
-
30
- useEffect(() => {
31
- grid.setupEvents();
32
-
33
- if (needGetRows && (grid.rows.length <= 0 || grid.columns.length <= 0) || grid._forceRefresh) {
34
-
35
- grid._forceRefresh = false;
36
-
37
- grid._waitingRows = true;
38
- grid.getRows({ filters: grid.collectFilters(), grid: grid }).then(
39
- rows => {
40
- grid.rows = rows;
41
- grid.afterGetRows();
42
- grid.refreshState();
43
- }
44
- ).finally(() => {
45
- grid._waitingRows = false;
46
- grid.refreshState();
47
- });
48
- }
49
- else if (grid.columns.length <= 0 && grid.getColumns) {
50
- grid.prepareColumns().then(() => grid.refreshState());;
51
- }
52
-
53
- return () => {
54
- grid.clearEvents();
55
- }
56
- }, [grid, needGetRows])
57
-
58
- return (grid.render());
59
- }
60
-
61
- // ==================================================================================================================================================================
62
- export class GridCDClass extends GridFEClass {
63
-
64
- constructor(props) {
65
- super(props);
66
-
67
- const grid = this;
68
- grid.allowView = true;
69
-
70
- grid._buttonsDict['view'].getVisible = () => { return true; };
71
- }
72
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
73
- render() {
74
- return (
75
- <>
76
- {super.render()}
77
- </>
78
- )
79
- }
80
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
81
- renderPopupContent(wnd) {
82
- const grid = this;
83
- return grid.cardIsShowing ? grid.renderCardContent(wnd) : super.renderPopupContent(wnd);
84
- }
85
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
86
- renderCardContent() {
87
- const grid = this;
88
- return (
89
- grid.allowView == false ?
90
- <div
91
- className={`graph-filter-title graph-filter-required`}
92
- >
93
- {grid.translate('Insufficient rights to view')}
94
- </div>
95
- :
96
- <Card
97
- cardRow={grid.cardRow || {}}
98
- isNewRecord={grid.isNewRecord}
99
- allowEdit={grid.allowEdit}
100
- uid={(grid.uid || grid.id) + '_card_'}
101
- keyField={grid.keyField}
102
- level={grid.level + 1}
103
- findGrid={() => {
104
- const selRow = grid.cardRow || grid.selectedRow();
105
- if (grid._card && selRow && grid._card.changedRow[grid.keyField] === selRow[grid.keyField]) {
106
- return grid._card;
107
- }
108
- }}
109
- init={(card) => {
110
- if (grid._card == card) return;
111
-
112
- grid._card = card;
113
-
114
- card.visible = true;
115
- card.columns = [];
116
- for (let col of grid.columns) {
117
- const remGetRows = col.getRows;
118
- delete col._fieldEditObj;
119
- delete col.grid;
120
- delete col._filterEditObj;
121
- delete col.getRows;
122
-
123
- // WARNING !!! потенциальная ошибка, если пользователь в потомке напихает в колонку объектов или функций !!!
124
- let clone = structuredClone(col);
125
- card.columns.push(clone);
126
-
127
- clone.getRows = col.getRows = remGetRows;
128
-
129
- col.grid = grid;
130
- }
131
- card.close = (e) => {
132
- grid.onClosePopup(e);
133
- grid.refreshState();
134
- }
135
- }}
136
- >
137
- </Card>
138
- );
139
- }
140
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
141
- viewRecord(e) {
142
- const grid = this;
143
-
144
- const shift = (grid.level + 1) * 20;
145
-
146
- grid.cardPos = grid.cardPos || { x: 100 + shift, y: 100 + shift, w: 800, h: 600 };
147
- grid.popupPos = grid.cardPos;
148
-
149
- grid.cardRow = grid.selectedRow();
150
- grid.isNewRecord = false;
151
- grid.cardIsShowing = true;
152
- grid.popupIsShowing = true;
153
- grid.popupTitle = grid.title;
154
-
155
- grid.refreshState();
156
- }
157
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
158
- onClosePopup(e) {
159
- const grid = this;
160
-
161
- if (grid.cardIsShowing && grid._card) {
162
- if (grid._card.isEditing() && (grid.isNewRecord || grid.isRowChanged(grid._card.changedRow, grid.selectedRow()))) {
163
- e.cancel = !confirm(grid.translate('The row is changed. Discard changes?'));
164
- if (e.cancel) {
165
- return;
166
- }
167
- }
168
- delete grid._card;
169
- }
170
-
171
- super.onClosePopup(e);
172
-
173
- if (e.cancel) return;
174
-
175
- if (grid.cardIsShowing) {
176
- grid.cardIsShowing = false;
177
- }
178
- }
179
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
180
- }