@cdmx/wappler_ag_grid 0.3.5 → 0.3.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/app_connect/components.hjson +115 -20
- package/dmx-ag-grid.js +16 -2
- package/package.json +1 -1
|
@@ -419,13 +419,79 @@
|
|
|
419
419
|
}
|
|
420
420
|
]
|
|
421
421
|
},
|
|
422
|
+
{
|
|
423
|
+
"group": "📒 Data Type Overrides",
|
|
424
|
+
"variables": [
|
|
425
|
+
{
|
|
426
|
+
"name": "ctypes",
|
|
427
|
+
"title": "Configure Type Overrides",
|
|
428
|
+
"attributeStartsWith": "dmx-bind",
|
|
429
|
+
"attribute": "ctypes",
|
|
430
|
+
"type": "boolean",
|
|
431
|
+
"defaultValue": false,
|
|
432
|
+
"icon": "fa fa-lg fa-database",
|
|
433
|
+
"groupIcon": "fa fa-lg fa-exchange",
|
|
434
|
+
"display": "fieldset",
|
|
435
|
+
"show": [
|
|
436
|
+
"typeOverrides"
|
|
437
|
+
],
|
|
438
|
+
"noChangeOnHide": true,
|
|
439
|
+
"groupEnabler": true,
|
|
440
|
+
"help": "This allows you to override the auto-detected datatypes"
|
|
441
|
+
"children": [
|
|
442
|
+
{
|
|
443
|
+
"name": "typeOverrides",
|
|
444
|
+
"attribute": "dmx-bind:ctypes",
|
|
445
|
+
"title": "Type Overrides",
|
|
446
|
+
"type": "grid",
|
|
447
|
+
"jsonFormat": true,
|
|
448
|
+
"encloseBT": true,
|
|
449
|
+
"jsonBT": true,
|
|
450
|
+
"defaultValue": [],
|
|
451
|
+
"initDisplay": "none",
|
|
452
|
+
"columns": [
|
|
453
|
+
{
|
|
454
|
+
"field": "field",
|
|
455
|
+
"caption": "Field",
|
|
456
|
+
"size": "20%",
|
|
457
|
+
"editable": {
|
|
458
|
+
"type": "text"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"field": "type",
|
|
463
|
+
"caption": "Type",
|
|
464
|
+
"size": "35%",
|
|
465
|
+
"editable": {
|
|
466
|
+
"type": "list",
|
|
467
|
+
"items": [
|
|
468
|
+
{id: 'number', text: 'number'},
|
|
469
|
+
{id: 'text', text: 'text'},
|
|
470
|
+
{id: 'date', text: 'date'}
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
"newRecord": {
|
|
476
|
+
"name": "",
|
|
477
|
+
"field": "",
|
|
478
|
+
"type": ""
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
}
|
|
483
|
+
]
|
|
484
|
+
},
|
|
422
485
|
{
|
|
423
486
|
"group": "📒 Style Formatting",
|
|
424
487
|
"variables": [
|
|
425
488
|
{
|
|
426
489
|
"name": "cstyles",
|
|
427
490
|
"title": "Configure Colors",
|
|
491
|
+
"attributeStartsWith": "dmx-bind",
|
|
492
|
+
"attribute": "cstyles",
|
|
428
493
|
"type": "boolean",
|
|
494
|
+
"defaultValue": false,
|
|
429
495
|
"display": "fieldset",
|
|
430
496
|
"show": [
|
|
431
497
|
"listColors"
|
|
@@ -434,11 +500,6 @@
|
|
|
434
500
|
"groupEnabler": true,
|
|
435
501
|
"help": "Add custom colors to column data based on condition, ex: field: status, condition: status==false, Color: red"
|
|
436
502
|
"children": [
|
|
437
|
-
{
|
|
438
|
-
"name": "help",
|
|
439
|
-
"type": "static",
|
|
440
|
-
"help": "Add custom colors for the fields"
|
|
441
|
-
},
|
|
442
503
|
{
|
|
443
504
|
"name": "listColors",
|
|
444
505
|
"attribute": "dmx-bind:cstyles",
|
|
@@ -494,7 +555,10 @@
|
|
|
494
555
|
{
|
|
495
556
|
"name": "data_binded_changes",
|
|
496
557
|
"title": "Configure Fields",
|
|
558
|
+
"attributeStartsWith": "dmx-bind",
|
|
559
|
+
"attribute": "data_binded_changes",
|
|
497
560
|
"type": "boolean",
|
|
561
|
+
"defaultValue": false,
|
|
498
562
|
"display": "fieldset",
|
|
499
563
|
"show": [
|
|
500
564
|
"dataBindedChanges"
|
|
@@ -564,7 +628,10 @@
|
|
|
564
628
|
{
|
|
565
629
|
"name": "data_changes",
|
|
566
630
|
"title": "Configure Fields",
|
|
631
|
+
"attributeStartsWith": "dmx-bind",
|
|
632
|
+
"attribute": "data_changes",
|
|
567
633
|
"type": "boolean",
|
|
634
|
+
"defaultValue": false,
|
|
568
635
|
"display": "fieldset",
|
|
569
636
|
"show": [
|
|
570
637
|
"dataChanges"
|
|
@@ -623,7 +690,10 @@
|
|
|
623
690
|
{
|
|
624
691
|
"name": "cnames",
|
|
625
692
|
"title": "Configure Header Names",
|
|
693
|
+
"attributeStartsWith": "dmx-bind",
|
|
694
|
+
"attribute": "cnames",
|
|
626
695
|
"type": "boolean",
|
|
696
|
+
"defaultValue": false,
|
|
627
697
|
"display": "fieldset",
|
|
628
698
|
"show": [
|
|
629
699
|
"listCustomNames"
|
|
@@ -632,11 +702,6 @@
|
|
|
632
702
|
"groupEnabler": true,
|
|
633
703
|
"help": "Add custom headers to column"
|
|
634
704
|
"children": [
|
|
635
|
-
{
|
|
636
|
-
"name": "help",
|
|
637
|
-
"type": "static",
|
|
638
|
-
"help": "Add custom headers to column"
|
|
639
|
-
},
|
|
640
705
|
{
|
|
641
706
|
"name": "listCustomNames",
|
|
642
707
|
"attribute": "dmx-bind:cnames",
|
|
@@ -685,7 +750,10 @@
|
|
|
685
750
|
{
|
|
686
751
|
"name": "cwidths",
|
|
687
752
|
"title": "Configure Custom Widths",
|
|
753
|
+
"attributeStartsWith": "dmx-bind",
|
|
754
|
+
"attribute": "cwidths",
|
|
688
755
|
"type": "boolean",
|
|
756
|
+
"defaultValue": false,
|
|
689
757
|
"display": "fieldset",
|
|
690
758
|
"show": [
|
|
691
759
|
"listCustomWidths",
|
|
@@ -694,11 +762,6 @@
|
|
|
694
762
|
"groupEnabler": true,
|
|
695
763
|
"help": "Add custom widths for the field"
|
|
696
764
|
"children": [
|
|
697
|
-
{
|
|
698
|
-
"name": "help",
|
|
699
|
-
"type": "static",
|
|
700
|
-
"help": "Add custom widths for the field"
|
|
701
|
-
},
|
|
702
765
|
{
|
|
703
766
|
"name": "listCustomWidths",
|
|
704
767
|
"attribute": "dmx-bind:cwidths",
|
|
@@ -749,6 +812,43 @@
|
|
|
749
812
|
}
|
|
750
813
|
]
|
|
751
814
|
},
|
|
815
|
+
{
|
|
816
|
+
"group": "📒 Hide Fields and Filters",
|
|
817
|
+
"variables": [
|
|
818
|
+
{
|
|
819
|
+
"name": "hide_components",
|
|
820
|
+
"title": "Hide Components",
|
|
821
|
+
"attributeStartsWith": "dmx-bind",
|
|
822
|
+
"attribute": "cwidths",
|
|
823
|
+
"type": "boolean",
|
|
824
|
+
"defaultValue": false,
|
|
825
|
+
"display": "fieldset",
|
|
826
|
+
"show": [
|
|
827
|
+
"hideFields",
|
|
828
|
+
"hideFilters",
|
|
829
|
+
],
|
|
830
|
+
"noChangeOnHide": true,
|
|
831
|
+
"groupEnabler": true,
|
|
832
|
+
"help": "hide components such as filters and fields"
|
|
833
|
+
"children": [
|
|
834
|
+
{
|
|
835
|
+
"name": "hideFields",
|
|
836
|
+
"attribute": "hide_fields",
|
|
837
|
+
"title": "Hide Fields",
|
|
838
|
+
"type": "text",
|
|
839
|
+
"initDisplay": "none"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"name": "hideFilters",
|
|
843
|
+
"attribute": "hide_filters",
|
|
844
|
+
"title": "Hide Filters",
|
|
845
|
+
"type": "text",
|
|
846
|
+
"initDisplay": "none"
|
|
847
|
+
}
|
|
848
|
+
]
|
|
849
|
+
}
|
|
850
|
+
]
|
|
851
|
+
},
|
|
752
852
|
{
|
|
753
853
|
"group": "📒 Configure Actions Column",
|
|
754
854
|
"variables": [
|
|
@@ -776,11 +876,6 @@
|
|
|
776
876
|
"groupEnabler": true,
|
|
777
877
|
"help": "Configure Actions for the buttons in Actions Column"
|
|
778
878
|
"children": [
|
|
779
|
-
{
|
|
780
|
-
"name": "help",
|
|
781
|
-
"type": "static",
|
|
782
|
-
"help": "Configure Actions for the buttons"
|
|
783
|
-
},
|
|
784
879
|
{
|
|
785
880
|
"name": "enableActions",
|
|
786
881
|
"attribute": "dmx-bind:enable_actions",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -13,6 +13,7 @@ dmx.Component('ag-grid', {
|
|
|
13
13
|
cstyles: { type: Array, default: [] },
|
|
14
14
|
cnames: { type: Object, default: {} },
|
|
15
15
|
cwidths: { type: Object, default: {} },
|
|
16
|
+
ctypes: { type: Array, default: [] },
|
|
16
17
|
data_changes: { type: Array, default: [] },
|
|
17
18
|
data: { type: Array, default: [] },
|
|
18
19
|
dom_layout: { type: String, default: 'autoHeight' },
|
|
@@ -65,7 +66,9 @@ dmx.Component('ag-grid', {
|
|
|
65
66
|
edit_action_btn_class: {type: String, default: 'btn-primary btn-xs' },
|
|
66
67
|
view_action_icon_class: {type: String, default: 'fas fa-eye' },
|
|
67
68
|
view_action_btn_class: {type: String, default: 'btn-info btn-xs' },
|
|
68
|
-
data_binded_changes: {type: Array, default: [] }
|
|
69
|
+
data_binded_changes: {type: Array, default: [] },
|
|
70
|
+
hide_fields: {type: Array, default: [] },
|
|
71
|
+
hide_filters: {type: Array, default: [] }
|
|
69
72
|
},
|
|
70
73
|
|
|
71
74
|
methods: {
|
|
@@ -87,6 +90,7 @@ dmx.Component('ag-grid', {
|
|
|
87
90
|
const timezone = this.props.timezone || false;
|
|
88
91
|
const cnames = this.props.cnames
|
|
89
92
|
const cwidths = this.props.cwidths
|
|
93
|
+
const ctypes = this.props.ctypes
|
|
90
94
|
const enableRowClickEvent = this.props.row_click_event;
|
|
91
95
|
const enableCellClickEvent = this.props.cell_click_event;
|
|
92
96
|
let localeText;
|
|
@@ -263,6 +267,10 @@ dmx.Component('ag-grid', {
|
|
|
263
267
|
browserDatePicker: true,
|
|
264
268
|
}
|
|
265
269
|
// Function to detect the data type based on the values
|
|
270
|
+
function getCustomDataTypes(key) {
|
|
271
|
+
const matchingType = ctypes.find((ct) => ct.field === key);
|
|
272
|
+
return matchingType ? matchingType.type : null;
|
|
273
|
+
}
|
|
266
274
|
function detectDataType(values) {
|
|
267
275
|
let hasDate = false;
|
|
268
276
|
let hasNumber = false;
|
|
@@ -375,7 +383,7 @@ dmx.Component('ag-grid', {
|
|
|
375
383
|
// Assuming rowData is an array of objects
|
|
376
384
|
const values = rowData.map(row => row[key]);
|
|
377
385
|
const nonNullValues = values.filter(value => value !== null);
|
|
378
|
-
const dataType = detectDataType(nonNullValues);
|
|
386
|
+
const dataType = (ctypes.length>0 ? getCustomDataTypes(key) : detectDataType(nonNullValues));
|
|
379
387
|
let filter;
|
|
380
388
|
let valueGetter;
|
|
381
389
|
let filterValueGetter;
|
|
@@ -486,12 +494,18 @@ dmx.Component('ag-grid', {
|
|
|
486
494
|
cellRenderer = 'checkboxCellRenderer';
|
|
487
495
|
filter = null;
|
|
488
496
|
}
|
|
497
|
+
else if (options.hide_filters && options.hide_filters.includes(key)) {
|
|
498
|
+
filter = null;
|
|
499
|
+
}
|
|
489
500
|
else {
|
|
490
501
|
cellRenderer = undefined;
|
|
491
502
|
}
|
|
492
503
|
if (options.hide_id_field && key == 'id') {
|
|
493
504
|
hide = true;
|
|
494
505
|
}
|
|
506
|
+
else if (options.hide_fields && options.hide_fields.includes(key)) {
|
|
507
|
+
hide = true;
|
|
508
|
+
}
|
|
495
509
|
else {
|
|
496
510
|
hide = undefined;
|
|
497
511
|
}
|