@cdmx/wappler_ag_grid 0.0.1 → 0.0.2
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/app_connect/components.hjson +193 -1
- package/dmx-ag-grid.js +32 -10
- package/package.json +1 -1
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"title": "Minimum Width",
|
|
92
92
|
"type": "number",
|
|
93
93
|
"defaultValue": 150,
|
|
94
|
-
"help": "The minimum width of the
|
|
94
|
+
"help": "The minimum width of the columns"
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
"name": "resizable",
|
|
@@ -165,6 +165,62 @@
|
|
|
165
165
|
"defaultValue": 20,
|
|
166
166
|
"help": "Number of rows to show per page"
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
"name": "timezone",
|
|
170
|
+
"attribute": "timezone",
|
|
171
|
+
"title": "Timezone",
|
|
172
|
+
"type": "droplist",
|
|
173
|
+
"defaultValue": '',
|
|
174
|
+
"values": [
|
|
175
|
+
{title: 'Local', value: ''},
|
|
176
|
+
{title: 'UTC - Coordinated Universal Time', value: 'UTC'},
|
|
177
|
+
{title: 'GMT - Greenwich Mean Time', value: 'GMT'},
|
|
178
|
+
{title: 'PST - Pacific Standard Time', value: 'PST'},
|
|
179
|
+
{title: 'PDT - Pacific Daylight Time', value: 'PDT'},
|
|
180
|
+
{title: 'EST - Eastern Standard Time', value: 'EST'},
|
|
181
|
+
{title: 'EDT - Eastern Daylight Time', value: 'EDT'},
|
|
182
|
+
{title: 'CST - Central Standard Time', value: 'CST'},
|
|
183
|
+
{title: 'CDT - Central Daylight Time', value: 'CDT'},
|
|
184
|
+
{title: 'MST - Mountain Standard Time', value: 'MST'},
|
|
185
|
+
{title: 'MDT - Mountain Daylight Time', value: 'MDT'},
|
|
186
|
+
{title: 'HST - Hawaii Standard Time', value: 'HST'},
|
|
187
|
+
{title: 'AKST - Alaska Standard Time', value: 'AKST'},
|
|
188
|
+
{title: 'AKDT - Alaska Daylight Time', value: 'AKDT'},
|
|
189
|
+
{title: 'AEST - Australian Eastern Standard Time', value: 'AEST'},
|
|
190
|
+
{title: 'AEDT - Australian Eastern Daylight Time', value: 'AEDT'},
|
|
191
|
+
{title: 'ACST - Australian Central Standard Time', value: 'ACST'},
|
|
192
|
+
{title: 'ACDT - Australian Central Daylight Time', value: 'ACDT'},
|
|
193
|
+
{title: 'AWST - Australian Western Standard Time', value: 'AWST'},
|
|
194
|
+
{title: 'BST - British Summer Time', value: 'BST'},
|
|
195
|
+
{title: 'IST - Indian Standard Time', value: 'IST'},
|
|
196
|
+
{title: 'JST - Japan Standard Time', value: 'JST'},
|
|
197
|
+
{title: 'CET - Central European Time', value: 'CET'},
|
|
198
|
+
{title: 'CEST - Central European Summer Time', value: 'CEST'},
|
|
199
|
+
{title: 'EET - Eastern European Time', value: 'EET'},
|
|
200
|
+
{title: 'EEST - Eastern European Summer Time', value: 'EEST'},
|
|
201
|
+
{title: 'MSK - Moscow Standard Time', value: 'MSK'},
|
|
202
|
+
{title: 'IST - Israel Standard Time', value: 'IST'},
|
|
203
|
+
{title: 'NZST - New Zealand Standard Time', value: 'NZST'},
|
|
204
|
+
{title: 'NZDT - New Zealand Daylight Time', value: 'NZDT'},
|
|
205
|
+
{title: 'NST - Newfoundland Standard Time', value: 'NST'},
|
|
206
|
+
{title: 'NDT - Newfoundland Daylight Time', value: 'NDT'},
|
|
207
|
+
{title: 'AST - Atlantic Standard Time', value: 'AST'},
|
|
208
|
+
{title: 'ADT - Atlantic Daylight Time', value: 'ADT'},
|
|
209
|
+
{title: 'GMT+1 - Central European Standard Time', value: 'GMT+1'},
|
|
210
|
+
{title: 'GMT+2 - Eastern European Standard Time', value: 'GMT+2'},
|
|
211
|
+
{title: 'GMT+3 - Moscow Standard Time', value: 'GMT+3'},
|
|
212
|
+
{title: 'GMT+4 - Gulf Standard Time', value: 'GMT+4'},
|
|
213
|
+
{title: 'GMT+5 - Pakistan Standard Time', value: 'GMT+5'},
|
|
214
|
+
{title: 'GMT+6 - Central Asia Standard Time', value: 'GMT+6'},
|
|
215
|
+
{title: 'GMT+7 - Southeast Asia Standard Time', value: 'GMT+7'},
|
|
216
|
+
{title: 'GMT+8 - China Standard Time', value: 'GMT+8'},
|
|
217
|
+
{title: 'GMT+9 - Japan Standard Time', value: 'GMT+9'},
|
|
218
|
+
{title: 'GMT+10 - Australian Eastern Standard Time', value: 'GMT+10'},
|
|
219
|
+
{title: 'GMT+11 - Solomon Islands Time', value: 'GMT+11'},
|
|
220
|
+
{title: 'GMT+12 - New Zealand Standard Time', value: 'GMT+12'}
|
|
221
|
+
],
|
|
222
|
+
"help": "Timezone for Date Fields"
|
|
223
|
+
},
|
|
168
224
|
{
|
|
169
225
|
"name": "fixedHeader",
|
|
170
226
|
"attribute": "fixedHeader",
|
|
@@ -386,7 +442,143 @@
|
|
|
386
442
|
]
|
|
387
443
|
}
|
|
388
444
|
]
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"group": "📒 Custom Headers",
|
|
448
|
+
"variables": [
|
|
449
|
+
{
|
|
450
|
+
"name": "cnames",
|
|
451
|
+
"attributeStartsWith": "dmx-bind",
|
|
452
|
+
"attribute": "cnames",
|
|
453
|
+
"title": "Configure Header Names",
|
|
454
|
+
"type": "boolean",
|
|
455
|
+
"display": "fieldset",
|
|
456
|
+
"show": [
|
|
457
|
+
"listCustomNames"
|
|
458
|
+
],
|
|
459
|
+
"noChangeOnHide": true,
|
|
460
|
+
"groupEnabler": true,
|
|
461
|
+
"help": "Add custom headers to column"
|
|
462
|
+
"children": [
|
|
463
|
+
{
|
|
464
|
+
"name": "help",
|
|
465
|
+
"type": "static",
|
|
466
|
+
"help": "Add custom headers to column"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "listCustomNames",
|
|
470
|
+
"attribute": "dmx-bind:cnames",
|
|
471
|
+
"title": "Header Names",
|
|
472
|
+
"type": "grid",
|
|
473
|
+
"dataBindings": true,
|
|
474
|
+
"key": "field",
|
|
475
|
+
"jsonFormat": true,
|
|
476
|
+
"encloseBT": true,
|
|
477
|
+
"jsonBT": true,
|
|
478
|
+
"initDisplay": "none",
|
|
479
|
+
"columns": [
|
|
480
|
+
{
|
|
481
|
+
"field": "field",
|
|
482
|
+
"caption": "Field",
|
|
483
|
+
"size": "20%",
|
|
484
|
+
"editable": {
|
|
485
|
+
"type": "text"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
field: "custom_name",
|
|
490
|
+
caption: "Name",
|
|
491
|
+
size: "20%",
|
|
492
|
+
editable: {
|
|
493
|
+
type: "text"
|
|
494
|
+
},
|
|
495
|
+
help: "Identity, Name,etc"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"newRecord": {
|
|
499
|
+
"name": "",
|
|
500
|
+
"value": "",
|
|
501
|
+
"field": "",
|
|
502
|
+
"custom_name": ""
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"group": "📒 Custom Widths",
|
|
511
|
+
"variables": [
|
|
512
|
+
{
|
|
513
|
+
"name": "cwidths",
|
|
514
|
+
"attributeStartsWith": "dmx-bind",
|
|
515
|
+
"attribute": "cwidths",
|
|
516
|
+
"title": "Configure Custom Widths",
|
|
517
|
+
"type": "boolean",
|
|
518
|
+
"display": "fieldset",
|
|
519
|
+
"show": [
|
|
520
|
+
"listCustomWidths",
|
|
521
|
+
],
|
|
522
|
+
"noChangeOnHide": true,
|
|
523
|
+
"groupEnabler": true,
|
|
524
|
+
"help": "Add custom widths for the field"
|
|
525
|
+
"children": [
|
|
526
|
+
{
|
|
527
|
+
"name": "help",
|
|
528
|
+
"type": "static",
|
|
529
|
+
"help": "Add custom widths for the field"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"name": "listCustomWidths",
|
|
533
|
+
"attribute": "dmx-bind:cwidths",
|
|
534
|
+
"title": "Column Name",
|
|
535
|
+
"type": "grid",
|
|
536
|
+
"dataBindings": true,
|
|
537
|
+
"key": "field",
|
|
538
|
+
"jsonFormat": true,
|
|
539
|
+
"encloseBT": true,
|
|
540
|
+
"jsonBT": true,
|
|
541
|
+
"initDisplay": "none",
|
|
542
|
+
"columns": [
|
|
543
|
+
{
|
|
544
|
+
"field": "field",
|
|
545
|
+
"caption": "Field",
|
|
546
|
+
"size": "20%",
|
|
547
|
+
"editable": {
|
|
548
|
+
"type": "text"
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
field: "min_width",
|
|
553
|
+
caption: "Min Width",
|
|
554
|
+
size: "20%",
|
|
555
|
+
editable: {
|
|
556
|
+
type: "text"
|
|
557
|
+
},
|
|
558
|
+
help: "Min Width",
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
field: "max_width",
|
|
562
|
+
caption: "Max Width",
|
|
563
|
+
size: "20%",
|
|
564
|
+
editable: {
|
|
565
|
+
type: "text"
|
|
566
|
+
},
|
|
567
|
+
help: "Max Width",
|
|
568
|
+
}
|
|
569
|
+
],
|
|
570
|
+
"newRecord": {
|
|
571
|
+
"name": "",
|
|
572
|
+
"value": "",
|
|
573
|
+
"field": "",
|
|
574
|
+
"custom_name": ""
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
]
|
|
389
580
|
}
|
|
581
|
+
|
|
390
582
|
],
|
|
391
583
|
"actionsScheme": [],
|
|
392
584
|
"children": [],
|
package/dmx-ag-grid.js
CHANGED
|
@@ -4,6 +4,8 @@ dmx.Component('ag-grid', {
|
|
|
4
4
|
rowData: [],
|
|
5
5
|
column_defs: [],
|
|
6
6
|
cstyles: null,
|
|
7
|
+
cnames: null,
|
|
8
|
+
cwidths: null,
|
|
7
9
|
gridInstance: null,
|
|
8
10
|
domLayout: 'autoHeight',
|
|
9
11
|
enableCellTextSelection: true,
|
|
@@ -34,7 +36,9 @@ dmx.Component('ag-grid', {
|
|
|
34
36
|
fixedHeader: false,
|
|
35
37
|
topbarClass: null,
|
|
36
38
|
fixedHeaderOffset: 100,
|
|
37
|
-
fixedTopOffset: 80
|
|
39
|
+
fixedTopOffset: 80,
|
|
40
|
+
fixedHorizonatalScroll: false,
|
|
41
|
+
timezone: null
|
|
38
42
|
},
|
|
39
43
|
|
|
40
44
|
attributes: {
|
|
@@ -53,6 +57,8 @@ dmx.Component('ag-grid', {
|
|
|
53
57
|
type: Object,
|
|
54
58
|
default: {}
|
|
55
59
|
},
|
|
60
|
+
cnames: { type: Object, default: {} },
|
|
61
|
+
cwidths: { type: Object, default: {} },
|
|
56
62
|
data: {
|
|
57
63
|
type: Array,
|
|
58
64
|
default: []
|
|
@@ -173,7 +179,9 @@ dmx.Component('ag-grid', {
|
|
|
173
179
|
fixedTopOffset: {
|
|
174
180
|
type: Number,
|
|
175
181
|
default: 80
|
|
176
|
-
}
|
|
182
|
+
},
|
|
183
|
+
fixedHorizonatalScroll: { type: Boolean, default: false },
|
|
184
|
+
timezone: {type: Text, default: '' }
|
|
177
185
|
},
|
|
178
186
|
|
|
179
187
|
methods: {
|
|
@@ -190,7 +198,8 @@ dmx.Component('ag-grid', {
|
|
|
190
198
|
const fixedHeader = this.props.fixedHeader;
|
|
191
199
|
const fixedHeaderOffset = this.props.fixedHeaderOffset;
|
|
192
200
|
const topbarClass = this.props.topbarClass;
|
|
193
|
-
const fixedTopOffset = this.props.fixedTopOffset
|
|
201
|
+
const fixedTopOffset = this.props.fixedTopOffset;
|
|
202
|
+
const timezone = this.props.timezone || false;
|
|
194
203
|
let columnDefs = [];
|
|
195
204
|
let exportToCSV = this.props.exportToCSV;
|
|
196
205
|
if (!rowData || rowData.length === 0) {
|
|
@@ -238,9 +247,9 @@ dmx.Component('ag-grid', {
|
|
|
238
247
|
hour: 'numeric',
|
|
239
248
|
minute: 'numeric',
|
|
240
249
|
hour12: true,
|
|
241
|
-
timeZone:
|
|
250
|
+
timeZone: timezone
|
|
242
251
|
};
|
|
243
|
-
return date.toLocaleString('en-
|
|
252
|
+
return date.toLocaleString('en-IN', options).toUpperCase();
|
|
244
253
|
} else {
|
|
245
254
|
const options = {
|
|
246
255
|
day: '2-digit',
|
|
@@ -250,7 +259,7 @@ dmx.Component('ag-grid', {
|
|
|
250
259
|
minute: 'numeric',
|
|
251
260
|
hour12: true
|
|
252
261
|
};
|
|
253
|
-
return date.toLocaleString('en-
|
|
262
|
+
return date.toLocaleString('en-IN', options).toUpperCase();
|
|
254
263
|
}
|
|
255
264
|
}
|
|
256
265
|
}
|
|
@@ -280,7 +289,6 @@ dmx.Component('ag-grid', {
|
|
|
280
289
|
return 'text';
|
|
281
290
|
}
|
|
282
291
|
}
|
|
283
|
-
console.log(this.props.cstyles)
|
|
284
292
|
if (Array.isArray(this.props.column_defs) && this.props.column_defs.length > 0) {
|
|
285
293
|
columnDefs = this.props.column_defs;
|
|
286
294
|
} else {
|
|
@@ -314,7 +322,7 @@ dmx.Component('ag-grid', {
|
|
|
314
322
|
}
|
|
315
323
|
} else if (dataType === 'date') {
|
|
316
324
|
filter = 'agDateColumnFilter';
|
|
317
|
-
valueFormatter = (params) => formatTime(params,
|
|
325
|
+
valueFormatter = (params) => formatTime(params, timezone);
|
|
318
326
|
} else {
|
|
319
327
|
filter = 'agTextColumnFilter';
|
|
320
328
|
valueFormatter = blankOrNullValueFormatter;
|
|
@@ -373,14 +381,28 @@ const cstyles = this.props.cstyles
|
|
|
373
381
|
}
|
|
374
382
|
return null;
|
|
375
383
|
}
|
|
384
|
+
cnames = this.props.cnames
|
|
385
|
+
cwidths = this.props.cwidths
|
|
386
|
+
if (cnames.hasOwnProperty(key)) {
|
|
387
|
+
console.log(key)
|
|
388
|
+
const cname = cnames[key]
|
|
389
|
+
headerName = cname ? cname.custom_name : humanize(key);
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
headerName = humanize(key);
|
|
393
|
+
}
|
|
376
394
|
return {
|
|
377
|
-
headerName:
|
|
395
|
+
headerName: headerName,
|
|
378
396
|
field: key,
|
|
379
397
|
filter: filter,
|
|
380
398
|
valueFormatter: valueFormatter,
|
|
381
399
|
valueGetter: valueGetter,
|
|
382
400
|
filterValueGetter: filterValueGetter,
|
|
383
|
-
cellStyle: applyCellStyle
|
|
401
|
+
cellStyle: applyCellStyle,
|
|
402
|
+
...(cwidths.hasOwnProperty(key) && {
|
|
403
|
+
minWidth: parseInt(cwidths[key].min_width),
|
|
404
|
+
maxWidth: parseInt(cwidths[key].max_width),
|
|
405
|
+
}),
|
|
384
406
|
};
|
|
385
407
|
});
|
|
386
408
|
}
|