@cdmx/wappler_ag_grid 0.2.4 → 0.2.5

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.
@@ -360,6 +360,14 @@
360
360
  "defaultValue": false,
361
361
  "help": "Disables checking for duplicate property names"
362
362
  },
363
+ {
364
+ "name": "hideIdField",
365
+ "attribute": "dmx-bind:hide_id_field",
366
+ "title": "Hide ID Field",
367
+ "type": "boolean",
368
+ "defaultValue": false,
369
+ "help": "Hides the ID Field in Grid"
370
+ },
363
371
  {
364
372
  "name": "localeText",
365
373
  "attribute": "localeText",
@@ -680,10 +688,12 @@
680
688
  "display": "fieldset",
681
689
  "show": [
682
690
  "enableActions",
691
+ "editActionBtn",
683
692
  "editActionTitle",
684
693
  "editActionTooltip",
685
694
  "editActionBtnClass",
686
695
  "editActionIconClass",
696
+ "viewActionBtn",
687
697
  "viewActionTitle",
688
698
  "viewActionTooltip",
689
699
  "viewActionBtnClass",
@@ -706,6 +716,13 @@
706
716
  "defaultValue": false,
707
717
  "help": "Enable Actions"
708
718
  },
719
+ {
720
+ "name": "editActionBtn",
721
+ "attribute": "dmx-bind:edit_action_btn",
722
+ "title": "Edit Action Button",
723
+ "type": "boolean",
724
+ "defaultValue": false
725
+ },
709
726
  {
710
727
  "name": "editActionTitle",
711
728
  "attribute": "edit_action_title",
@@ -734,6 +751,13 @@
734
751
  "type": "text",
735
752
  "defaultValue": 'fas fa-pencil-alt'
736
753
  },
754
+ {
755
+ "name": "viewActionBtn",
756
+ "attribute": "dmx-bind:view_action_btn",
757
+ "title": "View Action Button",
758
+ "type": "boolean",
759
+ "defaultValue": ''
760
+ },
737
761
  {
738
762
  "name": "viewActionTitle",
739
763
  "attribute": "view_action_title",
package/dmx-ag-grid.js CHANGED
@@ -33,6 +33,7 @@ dmx.Component('ag-grid', {
33
33
  suppressClipboardPaste: { type: Boolean, default: false },
34
34
  suppressScrollOnNewData: { type: Boolean, default: false },
35
35
  suppressPropertyNamesCheck: { type: Boolean, default: false },
36
+ hide_id_field: { type: Boolean, default: false },
36
37
  localeText: { default: null },
37
38
  minWidth: { type: Number, default: 150 },
38
39
  sortable: { type: Boolean, default: true },
@@ -53,8 +54,10 @@ dmx.Component('ag-grid', {
53
54
  row_status_event: {type: Boolean, default: false },
54
55
  enable_actions: {type: Boolean, default: false },
55
56
  pin_actions: {type: String, default: 'right' },
57
+ edit_action_btn: { type: Boolean, default: false },
56
58
  edit_action_title: {type: String, default: '' },
57
59
  edit_action_tooltip: {type: String, default: 'Edit' },
60
+ view_action_btn: { type: Boolean, default: false },
58
61
  view_action_title: {type: String, default: '' },
59
62
  view_action_tooltip: {type: String, default: 'View' },
60
63
  edit_action_icon_class: {type: String, default: 'fas fa-pencil-alt' },
@@ -72,6 +75,7 @@ dmx.Component('ag-grid', {
72
75
  },
73
76
  reloadGrid: function () {
74
77
  this.refreshGrid()
78
+ console.log('reloadGrid');
75
79
  }
76
80
  },
77
81
 
@@ -305,6 +309,7 @@ dmx.Component('ag-grid', {
305
309
  let valueFormatter;
306
310
  let filterParams;
307
311
  let minWidth;
312
+ let hide;
308
313
 
309
314
 
310
315
  if (dataType === 'number') {
@@ -407,6 +412,12 @@ dmx.Component('ag-grid', {
407
412
  else {
408
413
  cellRenderer = undefined;
409
414
  }
415
+ if (options.hide_id_field && key == 'id') {
416
+ hide = true;
417
+ }
418
+ else {
419
+ hide = undefined;
420
+ }
410
421
 
411
422
  return {
412
423
  headerName: headerName,
@@ -415,6 +426,7 @@ dmx.Component('ag-grid', {
415
426
  valueFormatter: valueFormatter,
416
427
  valueGetter: valueGetter,
417
428
  minWidth: minWidth,
429
+ hide: hide,
418
430
  filterValueGetter: filterValueGetter,
419
431
  filterParams: filterParams,
420
432
  cellStyle: applyCellStyle,
@@ -450,43 +462,47 @@ dmx.Component('ag-grid', {
450
462
  columnDefs.unshift(checkboxColumn);
451
463
  }
452
464
  if (options.enable_actions) {
453
- actionsColumn = {
454
- headerName: 'Actions',
455
- field: 'action',
456
- filter: null,
457
- cellRenderer: actionsRenderer,
458
- pinned: options.pin_actions,
459
- cellRendererParams: {
460
- // Custom button configurations
461
- buttons: [
462
- {
463
- action: options.edit_action_title,
464
- classNames: options.edit_action_btn_class,
465
- tooltip: options.edit_action_tooltip,
466
- icon: options.edit_action_icon_class,
467
- onClick: (rowData) => {
468
- this.set('data', rowData);
469
- this.set('id', rowData.id);
470
- this.dispatchEvent('row_action_edit');
471
- },
472
- },
473
- {
474
- action: options.view_action_title,
475
- classNames: options.view_action_btn_class,
476
- tooltip: options.view_action_tooltip,
477
- icon: options.view_action_icon_class,
478
- onClick: (rowData) => {
479
- this.set('data', rowData);
480
- this.set('id', rowData.id);
481
- this.dispatchEvent('row_action_view');
482
- },
483
- },
484
- // Add more custom buttons as needed
485
- ],
486
- },
487
- }
488
- columnDefs.push(actionsColumn);
465
+ actionsColumn = {
466
+ headerName: 'Actions',
467
+ field: 'action',
468
+ filter: null,
469
+ cellRenderer: actionsRenderer,
470
+ pinned: options.pin_actions,
471
+ cellRendererParams: {
472
+ buttons: [],
473
+ },
474
+ };
475
+
476
+ if (options.edit_action_btn) {
477
+ actionsColumn.cellRendererParams.buttons.push({
478
+ action: options.edit_action_title,
479
+ classNames: options.edit_action_btn_class,
480
+ tooltip: options.edit_action_tooltip,
481
+ icon: options.edit_action_icon_class,
482
+ onClick: (rowData) => {
483
+ this.set('data', rowData);
484
+ this.set('id', rowData.id);
485
+ this.dispatchEvent('row_action_edit');
486
+ },
487
+ });
489
488
  }
489
+
490
+ if (options.view_action_btn) {
491
+ actionsColumn.cellRendererParams.buttons.push({
492
+ action: options.view_action_title,
493
+ classNames: options.view_action_btn_class,
494
+ tooltip: options.view_action_tooltip,
495
+ icon: options.view_action_icon_class,
496
+ onClick: (rowData) => {
497
+ this.set('data', rowData);
498
+ this.set('id', rowData.id);
499
+ this.dispatchEvent('row_action_view');
500
+ },
501
+ });
502
+ }
503
+
504
+ columnDefs.push(actionsColumn);
505
+ }
490
506
 
491
507
  const gridOptions = {
492
508
  columnDefs: columnDefs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",