-
Notifications
You must be signed in to change notification settings - Fork 134
/
ICGrid.cs
437 lines (341 loc) · 12.4 KB
/
ICGrid.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
using GridBlazor.Pagination;
using GridShared;
using GridShared.Columns;
using GridShared.Filtering;
using GridShared.Utility;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Primitives;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace GridBlazor
{
public interface ICGrid<T> : ICGrid, IGrid<T>
{
/// <summary>
/// Function to init values for columns in the Create form
/// </summary>
Func<T, Task> InitCreateValues { get; set; }
}
/// <summary>
/// Grid.Mvc interface
/// </summary>
public interface ICGrid : IGrid, IGridOptions
{
/// <summary>
/// Grid component options
/// </summary>
GridOptions ComponentOptions { get; }
/// <summary>
/// Pager for the grid
/// </summary>
IGridPager Pager { get; }
/// <summary>
/// Keys for subgrid
/// </summary>
(string, string)[] SubGridKeys { get; }
/// <summary>
/// Subgrid clients
/// </summary>
Func<object[], Task<ICGrid>> SubGrids { get; }
/// <summary>
/// Subgrids state
/// </summary>
bool SubGridsOpened { get; }
/// <summary>
/// Set or get default value of rearrange column
/// </summary>
public bool RearrangeColumnEnabled { get; set; }
Type Type { get; }
string Url { get; }
HttpClient HttpClient { get; }
/// <summary>
/// Get foreign key values for subgrid records
/// </summary>
QueryDictionary<object> GetSubGridKeyValues(object item);
/// <summary>
/// Get primary key values for CRUD
/// </summary>
object[] GetPrimaryKeyValues(object item);
/// <summary>
/// Get primary keys for CRUD
/// </summary>
string[] GetPrimaryKeys();
bool DataAnnotationsValidation { get; set; }
IGridSettingsProvider Settings { get; }
IEnumerable<object> SelectedItems { get; set; }
/// <summary>
/// Set items from the server api
/// </summary>
Task UpdateGrid();
void AddQueryParameter(string parameterName, StringValues parameterValue);
void RemoveQueryParameter(string parameterName);
void AddQueryString(string parameterName, string parameterValue);
void ChangeQueryString(string parameterName, string oldParameterValue, string newParameterValue);
void RemoveQueryString(string parameterName, string parameterValue);
void AddFilterParameter(IGridColumn column, FilterCollection filters);
void RemoveFilterParameter(IGridColumn column);
void RemoveAllFilters();
Task DownloadExcel(IJSRuntime js, string filename);
/// <summary>
/// Changes postion of instertingColumn to appear before targetColumn
/// </summary>
/// <param name="targetColumn">Column which will be moved</param>
/// <param name="insertingColumn">Column before which it will be inserted</param>
/// <returns>Retruns true if column was sucessfully inserted before target otherwise false</returns>
Task<bool> InsertColumn(IGridColumn targetColumn, IGridColumn insertingColumn);
/// <summary>
/// Get and set export to an Excel file
/// </summary>
bool ExcelExport { get; }
/// <summary>
/// Get and set export all rows to an Excel file
/// </summary>
bool ExcelExportAllRows { get; }
/// <summary>
/// Get and set Excel file name
/// </summary>
string ExcelExportFileName { get; }
/// <summary>
/// Get and set custom create component
/// </summary>
Type CreateComponent { get; }
/// <summary>
/// Get and set custom read component
/// </summary>
Type ReadComponent { get; }
/// <summary>
/// Get and set custom update component
/// </summary>
Type UpdateComponent { get; }
/// <summary>
/// Get and set custom Delete component
/// </summary>
Type DeleteComponent { get; }
/// <summary>
/// Get and set custom Button components dictionary
/// </summary>
QueryDictionary<(string Label, Nullable<MarkupString> Content, Type ComponentType, IList<Action<object>> Actions, IList<Func<object, Task>> Functions, object Object)> ButtonComponents { get; }
/// <summary>
/// Get and set custom create component actions
/// </summary>
IList<Action<object>> CreateActions { get; }
/// <summary>
/// Get and set custom create component functions
/// </summary>
IList<Func<object,Task>> CreateFunctions { get; }
/// <summary>
/// Get and set custom create component object
/// </summary>
object CreateObject { get; }
/// <summary>
/// Get and set custom read component actions
/// </summary>
IList<Action<object>> ReadActions { get; }
/// <summary>
/// Get and set custom read component functions
/// </summary>
IList<Func<object, Task>> ReadFunctions { get; }
/// <summary>
/// Get and set custom read component object
/// </summary>
object ReadObject { get; }
/// <summary>
/// Get and set custom update component actions
/// </summary>
IList<Action<object>> UpdateActions { get; }
/// <summary>
/// Get and set custom update component functions
/// </summary>
IList<Func<object, Task>> UpdateFunctions { get; }
/// <summary>
/// Get and set custom update component object
/// </summary>
object UpdateObject { get; }
/// <summary>
/// Get and set custom delete component actions
/// </summary>
IList<Action<object>> DeleteActions { get; }
/// <summary>
/// Get and set custom delete component functions
/// </summary>
IList<Func<object, Task>> DeleteFunctions { get; }
/// <summary>
/// Get and set custom delete component object
/// </summary>
object DeleteObject { get; }
/// <summary>
/// Get and set the modifier key
/// </summary>
ModifierKey ModifierKey { get; }
/// <summary>
/// Get and set the modifier selection key
/// </summary>
Nullable<ModifierKey> SelectionKey { get; }
/// <summary>
/// Get and set keyboard utilization
/// </summary>
bool Keyboard { get; }
/// <summary>
/// Get and set OData interface
/// </summary>
ServerAPI ServerAPI { get; }
/// <summary>
/// Fixed column values for the grid
/// </summary>
QueryDictionary<object> FixedValues { get; set; }
/// <summary>
/// Fixed column values for the OData url expand parameter
/// </summary>
IEnumerable<string> ODataExpandList { get; set; }
/// <summary>
/// Override OData url expand parameter with list
/// </summary>
bool ODataOverrideExpandList { get; set; }
/// <summary>
/// Get OData pre-processor parameters (expand and filter)
/// </summary>
string GetODataPreProcessorParameters();
/// <summary>
/// Get OData processor parameters (sorting and paging)
/// </summary>
string GetODataProcessorParameters();
/// <summary>
/// Get OData expand parameter
/// </summary>
string GetODataExpandParameters();
/// <summary>
/// Get OData filter parameter
/// </summary>
string GetODataFilterParameters();
/// <summary>
/// Get OData pager parameter
/// </summary>
string GetODataPagerParameters();
/// <summary>
/// Get OData sort parameter
/// </summary>
string GetODataSortParameters();
/// <summary>
/// Create button label
/// </summary>
string CreateLabel { get; set; }
/// <summary>
/// Read button label
/// </summary>
string ReadLabel { get; set; }
/// <summary>
/// Update button label
/// </summary>
string UpdateLabel { get; set; }
/// <summary>
/// Delete button label
/// </summary>
string DeleteLabel { get; set; }
/// <summary>
/// Create button tooltip
/// </summary>
string CreateTooltip { get; set; }
/// <summary>
/// Read button tooltip
/// </summary>
string ReadTooltip { get; set; }
/// <summary>
/// Update button tooltip
/// </summary>
string UpdateTooltip { get; set; }
/// <summary>
/// Delete button tooltip
/// </summary>
string DeleteTooltip { get; set; }
/// <summary>
/// Create form label
/// </summary>
public string CreateFormLabel { get; set; }
/// <summary>
/// Read form label
/// </summary>
public string ReadFormLabel { get; set; }
/// <summary>
/// Update form label
/// </summary>
public string UpdateFormLabel { get; set; }
/// <summary>
/// Delete form label
/// </summary>
public string DeleteFormLabel { get; set; }
/// <summary>
/// Create form button label
/// </summary>
public string CreateFormButtonLabel { get; set; }
/// <summary>
/// Update form button label
/// </summary>
public string UpdateFormButtonLabel { get; set; }
/// <summary>
/// Delete form button label
/// </summary>
public string DeleteFormButtonLabel { get; set; }
// <summary>
/// Create CRUD confirmation fields
/// </summary>
bool CreateConfirmation { get; set; }
int CreateConfirmationWidth { get; set; }
int CreateConfirmationLabelWidth { get; set; }
/// <summary>
/// Update CRUD confirmation fields
/// </summary>
bool UpdateConfirmation { get; set; }
int UpdateConfirmationWidth { get; set; }
int UpdateConfirmationLabelWidth { get; set; }
/// <summary>
/// Delete CRUD confirmation fields
/// </summary>
bool DeleteConfirmation { get; set; }
int DeleteConfirmationWidth { get; set; }
int DeleteConfirmationLabelWidth { get; set; }
/// <summary>
/// Header CRUD buttons
/// </summary>
bool HeaderCrudButtons { get; set; }
/// <summary>
/// Show errors on Grid when getting data
/// </summary>
bool ShowErrorsOnGrid { get; set; }
/// <summary>
/// Throw exceptions when getting data
/// </summary>
bool ThrowExceptions { get; set; }
/// <summary>
/// Error string to be shown on the view
/// </summary>
string Error { get; set; }
/// <summary>
/// Go to Edit form after insert row
/// </summary>
bool EditAfterInsert { get; set; }
/// <summary>
/// Get column values to display
/// </summary>
[Obsolete("This method is obsolete. Use the new async GetGroupValues() method.", true)]
IList<object> GetValuesToDisplay(string columnName, IEnumerable<object> items);
/// <summary>
/// Enable the change of the virtualized grid height
/// </summary>
bool ChangeVirtualizedHeight { get; set; }
/// <summary>
/// Enable modal CRUD forms
/// </summary>
bool ModalForms { get; set; }
/// <summary>
/// Get value for modal CRUD form width
/// </summary>
string ModalWidth { get; set; }
/// <summary>
/// Get value for modal CRUD form height
/// </summary>
string ModalHeight { get; set; }
}
}