@cdmx/wappler_ag_grid 0.3.5 → 0.3.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.
@@ -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",
@@ -776,11 +839,6 @@
776
839
  "groupEnabler": true,
777
840
  "help": "Configure Actions for the buttons in Actions Column"
778
841
  "children": [
779
- {
780
- "name": "help",
781
- "type": "static",
782
- "help": "Configure Actions for the buttons"
783
- },
784
842
  {
785
843
  "name": "enableActions",
786
844
  "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' },
@@ -87,6 +88,7 @@ dmx.Component('ag-grid', {
87
88
  const timezone = this.props.timezone || false;
88
89
  const cnames = this.props.cnames
89
90
  const cwidths = this.props.cwidths
91
+ const ctypes = this.props.ctypes
90
92
  const enableRowClickEvent = this.props.row_click_event;
91
93
  const enableCellClickEvent = this.props.cell_click_event;
92
94
  let localeText;
@@ -263,6 +265,10 @@ dmx.Component('ag-grid', {
263
265
  browserDatePicker: true,
264
266
  }
265
267
  // Function to detect the data type based on the values
268
+ function getCustomDataTypes(key) {
269
+ const matchingType = ctypes.find((ct) => ct.field === key);
270
+ return matchingType ? matchingType.type : null;
271
+ }
266
272
  function detectDataType(values) {
267
273
  let hasDate = false;
268
274
  let hasNumber = false;
@@ -375,7 +381,7 @@ dmx.Component('ag-grid', {
375
381
  // Assuming rowData is an array of objects
376
382
  const values = rowData.map(row => row[key]);
377
383
  const nonNullValues = values.filter(value => value !== null);
378
- const dataType = detectDataType(nonNullValues);
384
+ const dataType = (ctypes.length>0 ? getCustomDataTypes(key) : detectDataType(nonNullValues));
379
385
  let filter;
380
386
  let valueGetter;
381
387
  let filterValueGetter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",