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
@@ -1,334 +0,0 @@
1
- import { useState } from 'react';
2
- import { TestData } from '../Tests/TestData';
3
- import { Overlay } from '../Overlay';
4
- import { Modal } from '../Modal';
5
- import { Dropdown } from '../Dropdown';
6
- import { Grid } from '../Grid';
7
- import { GridGR } from '../GridGR';
8
- import { GridDB } from '../GridDB';
9
- import { GridFL } from '../GridFL';
10
- import { GridFE } from '../GridFE';
11
- import { GridCD } from '../GridCD';
12
- import { FieldEdit } from '../FieldEdit';
13
- //import { GridINU } from '../GridINU';
14
- //import { GraphComponent } from '../GraphComponent';
15
-
16
- export function DebugApp() {
17
- const [state, setState] = useState({ menuItem: - 2 });
18
-
19
- window._logEnabled = true;
20
-
21
- const GetFamily = function (e) {
22
- return new Promise(function (resolve, reject) {
23
-
24
- const rows = new TestData().getFamily(e);
25
-
26
- if (rows != null) {
27
- resolve(rows);
28
- } else {
29
- reject(Error("Error getting rows"));
30
- }
31
- });
32
- };
33
-
34
- const GetButtons = function () {
35
- return [
36
- {
37
- id: 1,
38
- name: 'info',
39
- title: 'Persone Info',
40
- label: 'Persone Info',
41
- click: function (e) {
42
- const selRow = e.grid.selectedRowIndex >= 0 && e.grid.rows.length > 0 ? e.grid.rows[e.grid.selectedRowIndex] : null;
43
- if (!selRow) return;
44
-
45
- alert(`Persone Name = ${selRow.Name}, Persone Birth Day = ${selRow.Date}`);
46
- },
47
- getDisabled: function (e) {
48
- return !e.grid.rows || e.grid.rows.length <= 0;
49
- }
50
- },
51
- {
52
- id: 2,
53
- name: 'clear',
54
- title: 'Clear console',
55
- label: 'Clear console',
56
- click: function () {
57
- console.clear();
58
- },
59
- }
60
- ]
61
- }
62
-
63
- const GetCities = function (e) {
64
- return new Promise(function (resolve, reject) {
65
-
66
- const rows = new TestData().getCity(e);
67
-
68
- if (rows != null) {
69
- resolve(rows);
70
- } else {
71
- reject(Error("Error getting rows"));
72
- }
73
- });
74
- };
75
-
76
- const GetCityColumns = function () {
77
- return new TestData().GetCityColumns();
78
- }
79
-
80
- const GetFamilyColumns = function () {
81
- return new TestData().GetFamilyColumns();
82
- }
83
-
84
- const ResetColumnsOrder = function () {
85
- const grid = window.gridComponent;
86
- if (!grid) return;
87
-
88
- grid.resetColumnsOrderToDefault();
89
- }
90
-
91
- const ResetColumnsWidths = function () {
92
- const grid = window.gridComponent;
93
- if (!grid) return;
94
-
95
- grid.resetColumnsWidthsToDefault();
96
- }
97
-
98
- const GetPopupItems = function () {
99
- return new Promise(function (resolve) {
100
-
101
- const items = [
102
- { id: 1, text: 'test 1 item' },
103
- { id: 2, text: 'test 2 item' },
104
- { id: 3, text: 'test 3 item' },
105
- { id: 4, text: 'test 4 item' },
106
- { id: 5, text: 'test 5 item' }
107
- ];
108
- resolve(items);
109
- });
110
- };
111
-
112
- const drawGridInModal = function () {
113
- return (
114
- <>
115
- <div className="div-on-menu">
116
- <button onClick={() => { console.clear() }} className="modal-window-footer-button">Clear console</button>
117
- </div>
118
- <Grid getRows={GetFamily}
119
- init={(grid) => { window.gridComponent = grid }}
120
- ></Grid>
121
- </>
122
- )
123
- }
124
-
125
- const drawDropdownInModal = function (wnd) {
126
- return (
127
- <>
128
- <div className="div-on-menu">
129
- <button onClick={() => { console.clear() }} className="modal-window-footer-button">Clear console</button>
130
- <button onClick={(e) => { wnd.ddComponent.popup(e); }} className="modal-window-footer-button">Show Dropdown</button>
131
- </div>
132
- <div>
133
- {
134
- wnd.ddComponent && wnd.ddComponent.clickedItem ? <span>{'Item Clicked : ' + wnd.ddComponent.clickedItem}</span> : <></>
135
- }
136
- </div>
137
- <Dropdown init={(dd) => { wnd.ddComponent = dd; }} getItems={GetPopupItems}
138
- onItemClick={(e) => { /*console.log('Item clicked: ' + e.itemId); */e.self.clickedItem = e.itemId; wnd.refreshState(); }}
139
- >
140
- </Dropdown>
141
- </>
142
- )
143
- }
144
-
145
- const drawClearConsole = function () {
146
- return (
147
- <button onClick={() => { console.clear() }} className="modal-window-footer-button">Clear console</button>
148
- );
149
- }
150
-
151
- const drawTest = function () {
152
- return (<></>);
153
- }
154
-
155
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
156
- const getTestApp = () => {
157
- console.log('state == ' + state.menuItem);
158
- switch (state.menuItem) {
159
- case 0:
160
- return <></>
161
- case 1:
162
- return (
163
- <>
164
- <div className="div-on-menu">
165
- 1. Drag column to reorder
166
- 2. Doubleclick on divider to autowidth
167
- </div>
168
- <div className="div-on-menu">
169
- <button onClick={() => ResetColumnsOrder()} className="modal-window-footer-button">Reset columns order</button>
170
- <button onClick={() => ResetColumnsWidths()} className="modal-window-footer-button">Reset columns widths</button>
171
- {drawClearConsole()}
172
- </div>
173
- <Grid getRows={GetFamily} init={(grid) => { window.gridComponent = grid; }}></Grid>
174
- </>
175
- )
176
- case 2:
177
- return (
178
- <>
179
- <div className="div-on-menu">
180
- {drawClearConsole()}
181
- </div>
182
-
183
- <Overlay init={(ovl) => { window.overlayComponent = ovl }} closeWhenEscape={true} closeWhenClick={true}></Overlay>
184
- </>
185
- )
186
- case 3:
187
- return (
188
- <>
189
- <Modal uid="m01" isModal={true} renderContent={() => { return drawGridInModal() }} closeWhenEscape={true}
190
- pos={{ x: 100, y: 100, w: 600, h: 450 }} title='Modal Grid'></Modal>
191
- </>
192
- )
193
- case 4:
194
- return (
195
- <>
196
- <Modal uid="m02" isModal={true} title="Dropdown" renderContent={(wnd) => { return drawDropdownInModal(wnd) }} closeWhenEscape={true}
197
- dimensionsByContent={true}
198
- pos={{ x: 100, y: 100, w: 300, h: 250 }}></Modal>
199
- </>
200
- )
201
- case 5:
202
- return (
203
- <>
204
- <div className="div-on-menu">
205
- Change the active record in the parent grid to see the child rows.
206
- </div>
207
- <div className="div-on-menu">
208
- {drawClearConsole()}
209
- </div>
210
- <div className="div-with-grid">
211
- <GridGR uid="people" getRows={GetFamily}></GridGR>
212
- </div>
213
- <div className="div-with-grid">
214
- <GridGR uid="cities" parentGrids="people" getRows={GetCities} getColumns={GetCityColumns}></GridGR>
215
- </div>
216
- </>
217
- );
218
- case 6:
219
- return (
220
- <>
221
- <div className="div-on-menu">
222
- Grid with pager, pocket and sortable columns. Hold shift to sort by multiple columns.
223
- </div>
224
- <div className="div-with-grid">
225
- <GridDB getRows={GetFamily} buttons={GetButtons()} getColumns={GetFamilyColumns} multi={true}></GridDB>
226
- </div>
227
- </>
228
- );
229
- case 7:
230
- return (
231
- <>
232
- <div className="div-on-menu">
233
- Grid with column filters.
234
- </div>
235
- <div className="div-with-grid">
236
- <GridFL getRows={GetFamily} buttons={GetButtons()} getColumns={GetFamilyColumns}></GridFL>
237
- </div>
238
- </>
239
- );
240
- case 8:
241
- return (
242
- <>
243
- <Modal uid="m01" isModal={true} closeWhenEscape={true}
244
- renderContent={() => {
245
- return (
246
- <div className="div-with-grid">
247
- <span>Persona</span>
248
- <FieldEdit
249
- column={{
250
- id: 1,
251
- name: 'Persona',
252
- getRows: GetFamily,
253
- refKeyField: 'Id',
254
- refNameField: 'Name',
255
- type: 'lookup',
256
- }}
257
- >
258
- </FieldEdit>
259
- <br></br>
260
- <span>Age</span>
261
- <FieldEdit
262
- column={{
263
- id: 2,
264
- name: 'Age',
265
- }}
266
- >
267
- </FieldEdit>
268
- </div>
269
- );
270
- }}
271
- pos={{ x: 100, y: 100, w: 400, h: 200 }} title='Field Edit'>
272
- </Modal>
273
- </>
274
- )
275
- case 9:
276
- return (
277
- <>
278
- <div className="div-on-menu">
279
- Editable grid.
280
- </div>
281
- <div className="div-with-grid">
282
- <GridFE getRows={GetFamily} getColumns={GetFamilyColumns} allowEdit={true}></GridFE>
283
- </div>
284
- </>
285
- );
286
- case 10:
287
- return (
288
- <>
289
- <div className="div-on-menu">
290
- Editable grid with card-based record view.
291
- </div>
292
- <div className="div-with-grid">
293
- <GridCD getRows={GetFamily} getColumns={GetFamilyColumns} allowEdit={true}></GridCD>
294
- </div>
295
- </>
296
- );
297
- case 11:
298
- return (
299
- <>
300
- {drawTest()}
301
- </>
302
- );
303
- default:
304
- return null;
305
- }
306
- };
307
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
308
- return (
309
- <div >
310
- <select onChange={(e) => {
311
- //console.log('this == ' + e);
312
- setState({ menuItem: e.target.selectedIndex });
313
- }}>
314
- <option>0. None</option>
315
- <option>1. React Grid</option>
316
- <option>2. Overlay</option>
317
- <option>3. Modal</option>
318
- <option>4. Dropdown</option>
319
- <option>5. Two Grids</option>
320
- <option>6. GridDB</option>
321
- <option>7. GridFL</option>
322
- <option>8. Field Edit</option>
323
- <option>9. GridFE</option>
324
- <option>10. GridCD</option>
325
- <option>11. TEST</option>
326
- </select>
327
- <div className="div-on-menu">
328
- {getTestApp()}
329
- </div>
330
- </div>
331
- );
332
- }
333
-
334
- export default DebugApp;
@@ -1,251 +0,0 @@
1
- import { GraphClass, WaveType } from '../Graph';
2
- import { BaseComponent, NodeStatus, FilterType } from '../Base';
3
- export class TestData {
4
-
5
- //constructor() {
6
- //}
7
-
8
- getFamily(e) {
9
- e = e || { grid: {} };
10
-
11
- const family = [
12
- { Id: 1, ParentId: [3, 4], Name: 'Mikle', SecondName: 'Razumtsev', Date: '26/01/1979', Comment: 'Good boy', Hometown: 'Voronezh', HometownId: 1 },
13
- { Id: 2, ParentId: [0], Name: 'Nataly', SecondName: 'Sche..', Date: '14/01/1999', Comment: 'Good girl', Hometown: 'Hanty-Mansiysk', HometownId: 12 },
14
- { Id: 3, ParentId: [11, 23], Name: 'Lyuda', SecondName: 'Razumtseva', Date: '03/07/1953', Comment: 'Mommy', Hometown: 'Novosibirsk', HometownId: 8 },
15
- { Id: 4, ParentId: [5, 22], Name: 'Borya', SecondName: 'Razumtsev', Date: '14/06/1953', Comment: 'Papa', Hometown: 'Grafskaya', HometownId: 2 },
16
- { Id: 5, ParentId: [0], Name: 'Nina', SecondName: 'Razumtseva', Date: '17/06/1917', Comment: 'Babushka', Hometown: 'Ustyuzhna', HometownId: 9 },
17
- { Id: 6, ParentId: [3, 4], Name: 'Evgenia', SecondName: 'Batyreva', Date: '31/10/1974', Comment: 'Sister', Hometown: 'Voronezh', HometownId: 1 },
18
- { Id: 7, ParentId: [9, 10], Name: 'Ilia', SecondName: 'Razumtsev', Date: '16/09/1980', Comment: 'Brother 1', Hometown: 'Pskov', HometownId: 4 },
19
- { Id: 8, ParentId: [9, 10], Name: 'Mitka', SecondName: 'Razumtsev', Date: '04/07/1989', Comment: 'Brother 2', Hometown: 'Pskov', HometownId: 4 },
20
- { Id: 9, ParentId: [5, 22], Name: 'Kolya', SecondName: 'Razumtsev', Date: '02/11/1954', Comment: 'Dadya', Hometown: 'Grafskaya', HometownId: 2 },
21
- { Id: 10, ParentId: [11, 23], Name: 'Lara', SecondName: 'Razumtseva', Date: '31/01/1961', Comment: 'Tetya', Hometown: 'Elista', HometownId: 5 },
22
- { Id: 11, ParentId: [0], Name: 'Valya', SecondName: 'Mukhlynova', Date: '23/06/1933', Comment: 'Babushka', Hometown: 'Elista', HometownId: 5 },
23
- { Id: 12, ParentId: [6, 32], Name: 'Dashka', SecondName: 'Markelova', Date: '08/06/2000', Comment: 'Plemyannica 1', Hometown: 'Elista', HometownId: 5 },
24
- { Id: 13, ParentId: [6, 32], Name: 'Katka', SecondName: 'Markelova', Date: '27/05/2003', Comment: 'Plemyannica 2', Hometown: 'Elista', HometownId: 5 },
25
- { Id: 14, ParentId: [6, 31], Name: 'Tuyanka', SecondName: 'Batyreva', Date: '15/11/2010', Comment: 'Plemyannica 3', Hometown: 'Elista', HometownId: 5 },
26
- { Id: 15, ParentId: [0], Name: 'Shura', SecondName: 'Pelushskaya', Date: '22/04/1919', Comment: 'Dv. Babushka', Hometown: 'Ustyuzhna', HometownId: 9 },
27
- { Id: 16, ParentId: [15], Name: 'Ira', SecondName: 'Pelushskaya', Date: '11/06/1947', Comment: 'Dv. Tetya', Hometown: 'Pskov', HometownId: 4 },
28
- { Id: 17, ParentId: [11, 23], Name: 'Sveta', SecondName: 'Dolginova', Date: '10/11/1954', Comment: 'Tetya', Hometown: 'Novosibirsk', HometownId: 8 },
29
- { Id: 18, ParentId: [11, 23], Name: 'Rita', SecondName: 'Dolginova', Date: '23/10/1956', Comment: 'Tetya', Hometown: 'Novosibirsk', HometownId: 8 },
30
- { Id: 19, ParentId: [11, 23], Name: 'Nadya', SecondName: 'Shaula', Date: '11/11/1958', Comment: 'Tetya', Hometown: 'Novosibirsk', HometownId: 8 },
31
- { Id: 20, ParentId: [11, 23], Name: 'Vitia', SecondName: 'Dolginov', Date: '11/11/1958', Comment: 'Dadya', Hometown: 'Novosibirsk', HometownId: 8 },
32
- { Id: 21, ParentId: [11, 23], Name: 'Tanya', SecondName: 'Dolginova', Date: '07/01/1963', Comment: 'Tetya', Hometown: 'Elista', HometownId: 5 },
33
- { Id: 22, ParentId: [0], Name: 'Misha', SecondName: 'Razumtsev', Date: '05/11/1918', Comment: 'Ded', Hometown: 'Grafskaya', HometownId: 2 },
34
- { Id: 23, ParentId: [0], Name: 'Zambo', SecondName: 'Dolginov', Date: '24/04/1926', Comment: 'Ded 2', Hometown: 'Elista', HometownId: 5 },
35
-
36
- { Id: 24, ParentId: [18, 34], Name: 'Alina', SecondName: 'Ushakova', Date: '??/??/????', Comment: 'Dv. Sister', Hometown: 'Elista', HometownId: 5 },
37
- { Id: 25, ParentId: [19, 33], Name: 'Igor', SecondName: 'Shaula', Date: '??/??/????', Comment: 'Dv. Brother', Hometown: 'Energodar', HometownId: 14 },
38
- { Id: 26, ParentId: [19, 33], Name: 'Dima', SecondName: 'Shaula', Date: '??/??/????', Comment: 'Dv. Brother', Hometown: 'Energodar', HometownId: 14 },
39
- { Id: 27, ParentId: [20, 35], Name: 'Olga', SecondName: 'Dolginova', Date: '??/??/????', Comment: 'Dv. Sister', Hometown: 'Elista', HometownId: 5 },
40
- { Id: 28, ParentId: [20, 35], Name: 'Venia', SecondName: 'Dolginov', Date: '??/??/????', Comment: 'Dv. Brother', Hometown: 'Elista', HometownId: 5 },
41
- { Id: 29, ParentId: [20, 36], Name: 'Oleg', SecondName: 'Dolginov', Date: '10/11/????', Comment: 'Dv. Brother', Hometown: 'Elista', HometownId: 5 },
42
-
43
- { Id: 30, ParentId: [0], Name: 'Yura', SecondName: 'Pelushskiy', Date: '??/??/1921', Comment: 'Dv. Ded', Hometown: 'Ustyuzhna', HometownId: 9 },
44
- { Id: 31, ParentId: [0], Name: 'Sanal', SecondName: 'Batyrev', Date: '11/06/????', Comment: 'Muzh Sestry 3', Hometown: 'Elista', HometownId: 5 },
45
- { Id: 32, ParentId: [0], Name: 'Dima', SecondName: 'Markelov', Date: '??/??/????', Comment: 'Muzh Sestry 2', Hometown: 'Elista', HometownId: 5 },
46
- { Id: 33, ParentId: [0], Name: 'Slava', SecondName: 'Shaula', Date: '??/??/????', Comment: 'Muzh Teti', Hometown: 'Energodar', HometownId: 14 },
47
- { Id: 34, ParentId: [0], Name: 'Sasha', SecondName: 'Ushakov', Date: '??/??/????', Comment: 'Muzh Teti', Hometown: 'Elista', HometownId: 5 },
48
- { Id: 35, ParentId: [0], Name: 'Toma', SecondName: '???', Date: '??/??/????', Comment: 'Mat Olgi i Veni', Hometown: 'Elista', HometownId: 5 },
49
- { Id: 36, ParentId: [0], Name: 'Ira', SecondName: '???', Date: '??/??/????', Comment: 'Mat Olega', Hometown: 'Elista', HometownId: 5 },
50
- ];
51
-
52
- if (e.autocompleteColumn) {
53
- e.grid._autocomplDict = {};
54
- e.grid._autocomplCount = 0;
55
- }
56
-
57
- let rows = [];
58
-
59
- for (let row of family) {
60
- if (!this.passRow(e.grid, row, e.autocompleteColumn)) continue;
61
-
62
- if (e.autocompleteColumn) {
63
- e.grid._autocomplCount++;
64
- if (e.grid._autocomplCount > 10) break;
65
-
66
- let cellValue = row[e.autocompleteColumn.name];
67
- e.grid._autocomplDict[String(cellValue).toLowerCase()] = 1;
68
-
69
- rows.push(cellValue);
70
- }
71
- else {
72
- rows.push(row);
73
- }
74
- }
75
-
76
- if (!e.autocompleteColumn) {
77
- e.grid.totalRows = rows.length;
78
-
79
- if (e.grid.columns) {
80
- let sortCol = null;
81
- for (let col of e.grid.columns) {
82
- if (col.asc || col.desc) {
83
- sortCol = col;
84
- break;
85
- }
86
- }
87
-
88
- if (sortCol != null) {
89
- rows.sort(function (a, b) { return a[sortCol.name] > b[sortCol.name] ? (sortCol.asc ? 1 : -1) : (sortCol.asc ? -1 : 1); });
90
- }
91
- }
92
- }
93
-
94
- if (e.autocompleteColumn) {
95
- rows.sort(function (a, b) { return a > b ? 1 : -1; });
96
- }
97
- else {
98
- rows = e.grid.pageSize > 0 && e.grid.pageNumber > 0 ? rows.slice((e.grid.pageNumber - 1) * e.grid.pageSize, e.grid.pageNumber * e.grid.pageSize) : rows;
99
-
100
- e.grid.rows = rows;
101
- }
102
-
103
- return rows;
104
- }
105
-
106
- GetFamilyColumns() {
107
- return [
108
- { name: 'Id', sortable: true, filtrable: true },
109
- { name: 'Name', sortable: true, filtrable: true },
110
- { name: 'SecondName', sortable: true, filtrable: true },
111
- { name: 'Date', sortable: true, type: 'date' },
112
- { name: 'Comment', sortable: true, filtrable: true },
113
- {
114
- name: 'Hometown', sortable: true, filtrable: true, type: 'lookup', keyField: 'HometownId', refKeyField: 'Id', refNameField: 'City', getRows: (e) => {
115
- return new Promise(function (resolve, reject) {
116
-
117
- const rows = new TestData().getCity(e);
118
-
119
- if (rows != null) {
120
- resolve(rows);
121
- } else {
122
- reject(Error("Error getting rows"));
123
- }
124
- });
125
- }
126
- },
127
- ]
128
- }
129
-
130
- getCity(e) {
131
- const cities = [
132
- { Id: 1, City: 'Voronezh', ParentId: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] },
133
- { Id: 2, City: 'Grafskaya', ParentId: [1, 3, 4, 5, 6, 7, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23] },
134
- { Id: 3, City: 'Moskow', ParentId: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 23, 28, 29] },
135
- { Id: 4, City: 'Pskov', ParentId: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 30] },
136
- { Id: 5, City: 'Elista', ParentId: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29] },
137
- { Id: 6, City: 'Pyatigorsk', ParentId: [1, 3, 4, 6, 12, 13, 14] },
138
- { Id: 7, City: 'Piter', ParentId: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16] },
139
- { Id: 8, City: 'Novosibirsk', ParentId: [1, 3, 4, 11, 14, 17, 18, 19, 20, 23] },
140
- { Id: 9, City: 'Ustyuzhna', ParentId: [5, 15, 30] },
141
- { Id: 10, City: 'Army', ParentId: [1, 7, 8, 9, 20] },
142
- { Id: 11, City: 'Bali', ParentId: [2] },
143
- { Id: 12, City: 'Hanty-Mansiysk', ParentId: [2] },
144
- { Id: 13, City: 'Paris', ParentId: [21] },
145
- { Id: 14, City: 'Energodar', ParentId: [19, 25, 26] },
146
- ];
147
-
148
- if (e.autocompleteColumn) {
149
- e.grid._autocomplDict = {};
150
- e.grid._autocomplCount = 0;
151
- }
152
-
153
- let rows = [];
154
-
155
- for (let row of cities) {
156
- if (!this.passRow(e.grid, row, e.autocompleteColumn)) continue;
157
-
158
- if (e.filters && e.filters.length) {
159
- let filter = e.filters[0];
160
- filter = filter.filter ? filter.filter : filter;
161
- if (!row['ParentId'] || row['ParentId'].indexOf(+filter) < 0) continue;
162
- }
163
-
164
- if (e.autocompleteColumn) {
165
- e.grid._autocomplCount++;
166
- if (e.grid._autocomplCount > 10) break;
167
-
168
- let cellValue = row[e.autocompleteColumn.name];
169
- e.grid._autocomplDict[String(cellValue).toLowerCase()] = 1;
170
-
171
- rows.push(cellValue);
172
- }
173
- else {
174
- rows.push(row);
175
- }
176
- }
177
-
178
- if (!e.autocompleteColumn && e.grid) {
179
- e.grid.totalRows = rows.length;
180
-
181
- if (e.grid.columns) {
182
- let sortCol = null;
183
- for (let col of e.grid.columns) {
184
- if (col.asc || col.desc) {
185
- sortCol = col;
186
- break;
187
- }
188
- }
189
-
190
- if (sortCol != null) {
191
- rows.sort(function (a, b) { return a[sortCol.name] > b[sortCol.name] ? (sortCol.asc ? 1 : -1) : (sortCol.asc ? -1 : 1); });
192
- }
193
- }
194
- }
195
-
196
- if (e.autocompleteColumn) {
197
- rows.sort(function (a, b) { return a > b ? 1 : -1; });
198
- }
199
- else {
200
- rows = e.grid.pageSize > 0 && e.grid.pageNumber > 0 ? rows.slice((e.grid.pageNumber - 1) * e.grid.pageSize, e.grid.pageNumber * e.grid.pageSize) : rows;
201
-
202
- e.grid.rows = rows;
203
- }
204
-
205
- return rows;
206
- }
207
-
208
- GetCityColumns() {
209
- return [{ name: 'Id', sortable: true }, { name: 'City', sortable: true, filtrable: true }]
210
- }
211
-
212
- passRow(grid, row, autocompleteColumn) {
213
- if (!grid || !grid.columns) return true;
214
-
215
- for (let col of grid.columns) {
216
- if (!col.filtrable || (col.filter == null || col.filter == '') && !autocompleteColumn) continue;
217
-
218
- const cellValue = String(row[col.name]).toLowerCase();
219
- if (cellValue == '') return false;
220
-
221
- const filter = col.filter == null || col.filter == '' ? '' : col.filter.toLowerCase();
222
-
223
- if (filter != '') {
224
- if (autocompleteColumn) {
225
- if (autocompleteColumn == col && cellValue.indexOf(filter) != 0 || autocompleteColumn != col && cellValue != filter) return false;
226
-
227
- }
228
- else {
229
- if (cellValue != filter) return false;
230
- }
231
- }
232
-
233
- if (autocompleteColumn && grid._autocomplDict[cellValue]) return false;
234
- }
235
-
236
- return true;
237
- }
238
-
239
- GetCities = function (e) {
240
- return new Promise(function (resolve, reject) {
241
-
242
- const rows = new TestData().getCity(e);
243
-
244
- if (rows != null) {
245
- resolve(rows);
246
- } else {
247
- reject(Error("Error getting rows"));
248
- }
249
- });
250
- };
251
- }
@@ -1,36 +0,0 @@
1
- export class DefaultGridTheme {
2
-
3
- constructor() {
4
- this.pagerButtonsClass = 'grid-pager-button';
5
- this.toolbarClass = '';
6
- this.toolbarButtonsClass = 'grid-toolbar-button';
7
- this.pocketButtonsClass = 'grid-pocket-button';
8
-
9
- this.pagerClass = 'mb-1 grid-pager-default';
10
-
11
- this.gridClass = '';
12
- //this.headerDivClass = 'grid-header-div-default';
13
- this.headerDivClass = ' ';
14
- this.selectedRowClass = 'table-active';
15
- this.inputClass = 'input-default-class';
16
- this.inputClassLG = 'input-default-class-lg';
17
- this.selectClass = 'select-default-class';
18
-
19
- this.tabControlButtonClass = 'graph-tabcontrol-button';
20
-
21
- this.menuClass = '';
22
- this.menuItemClass = '';
23
- this.dropdownWndClass = 'none';
24
-
25
- this.filterButtonClass = 'graph-filter-button';
26
- this.clearButtonClass = '';
27
-
28
- this.modalBodyClass = 'modal-window-body';
29
- this.modalHeaderClass = 'modal-window-header';
30
- this.modalFooterClass = 'modal-window-footer';
31
- this.modalFooterButtonClass = 'modal-window-footer-button'
32
- this.modalTitleClass = 'modal-window-header-title';
33
- }
34
-
35
- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
36
- }