@cdmx/wappler_ag_grid 1.8.5 → 1.8.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/README.md CHANGED
@@ -402,7 +402,7 @@ Specify the condition to Show the Delete Action button, eg: code==TEST, or statu
402
402
 
403
403
  # Custom Action Buttons
404
404
 
405
- **Buttons 1-10**
405
+ **Buttons 1-20**
406
406
 
407
407
  **Button[i] Action Button**
408
408
  This will display the "Button[i] Action Button" options.
@@ -422,6 +422,10 @@ Specify the CSS class for styling the icon of the Button[i] Action button.
422
422
  **Button[i] Action Button Condition**
423
423
  Specify the condition to Show the Button[i] Action button, eg: code==TEST, or status==COMPLETED||status==FINISHED or status==COMPLETED&&user_status==true
424
424
 
425
+ # Button Class Toggles
426
+ The Button Class Toggles feature provides a way to define and manage classes for action buttons within a grid, based on certain data conditions. This can be useful for dynamically updating button styles based on the state of the row data.
427
+ Specify the condition to apply the defined class on the Action button, eg: code==TEST, or status==COMPLETED||status==FINISHED or status==COMPLETED&&user_status==true
428
+
425
429
  # Action Attributes
426
430
 
427
431
  **Load**
@@ -2928,7 +2928,83 @@
2928
2928
  "title": "Button20 Condition",
2929
2929
  "type": "text"
2930
2930
  }
2931
-
2931
+ ]
2932
+ },
2933
+ {
2934
+ "name": "btnClassToggles",
2935
+ "attribute": "button_class_toggles",
2936
+ "title": "Button Class Toggles",
2937
+ "type": "boolean",
2938
+ "defaultValue": false,
2939
+ "display": "fieldset",
2940
+ "show": ["actionBtnsClassToggles"],
2941
+ "noChangeOnHide": true,
2942
+ "groupEnabler": true,
2943
+ "children": [
2944
+ {
2945
+ "name": "actionBtnsClassToggles",
2946
+ "attribute": "dmx-bind:action_button_class_toggles",
2947
+ "title": "Buttons Classes",
2948
+ "type": "grid",
2949
+ "jsonFormat": true,
2950
+ "dataBindings": true,
2951
+ "encloseBT": true,
2952
+ "jsonBT": true,
2953
+ "initDisplay": "none",
2954
+ "columns": [
2955
+ {
2956
+ "field": "btn_id",
2957
+ "caption": "Button",
2958
+ "editable": {
2959
+ "type": "list",
2960
+ "items": [
2961
+ {"id": "edit", "text": "Edit"},
2962
+ {"id": "view", "text": "View"},
2963
+ {"id": "delete", "text": "Delete"},
2964
+ {"id": "button1", "text": "Button 1"},
2965
+ {"id": "button2", "text": "Button 2"},
2966
+ {"id": "button3", "text": "Button 3"},
2967
+ {"id": "button4", "text": "Button 4"},
2968
+ {"id": "button5", "text": "Button 5"},
2969
+ {"id": "button6", "text": "Button 6"},
2970
+ {"id": "button7", "text": "Button 7"},
2971
+ {"id": "button8", "text": "Button 8"},
2972
+ {"id": "button9", "text": "Button 9"},
2973
+ {"id": "button10", "text": "Button 10"},
2974
+ {"id": "button11", "text": "Button 11"},
2975
+ {"id": "button12", "text": "Button 12"},
2976
+ {"id": "button13", "text": "Button 13"},
2977
+ {"id": "button14", "text": "Button 14"},
2978
+ {"id": "button15", "text": "Button 15"},
2979
+ {"id": "button16", "text": "Button 16"},
2980
+ {"id": "button17", "text": "Button 17"},
2981
+ {"id": "button18", "text": "Button 18"},
2982
+ {"id": "button19", "text": "Button 19"},
2983
+ {"id": "button20", "text": "Button 20"}
2984
+ ]
2985
+ }
2986
+ },
2987
+ {
2988
+ "field": "class",
2989
+ "caption": "Class",
2990
+ "editable": {
2991
+ "type": "text"
2992
+ }
2993
+ },
2994
+ {
2995
+ "field": "condition",
2996
+ "caption": "Condition",
2997
+ "editable": {
2998
+ "type": "text"
2999
+ }
3000
+ }
3001
+ ],
3002
+ "newRecord": {
3003
+ "btn_id": "",
3004
+ "class": "",
3005
+ "condition": ""
3006
+ }
3007
+ }
2932
3008
  ]
2933
3009
  }
2934
3010
  ]
@@ -3429,6 +3505,40 @@
3429
3505
  "dmx-ag-grid": true
3430
3506
  }
3431
3507
  },
3508
+ {
3509
+ "name": "dmx-ag-grid-export-exclude-fields",
3510
+ "attributeStartsWith": "dmx-bind",
3511
+ "attribute": "export_exclude_fields",
3512
+ "title": "Export Exclude Fields",
3513
+ "type": "boolean",
3514
+ "display": "fieldset",
3515
+ "icon": "fa fa-lg fa-chevron-right",
3516
+ "groupTitle": "Grid Config",
3517
+ "groupIcon": "fa fa-lg fa-cubes",
3518
+ "defaultValue": false,
3519
+ "show": [
3520
+ "exportExcludeFields"
3521
+ ],
3522
+ "noChangeOnHide": true,
3523
+ "groupEnabler": true,
3524
+ "children": [
3525
+ {
3526
+ "name": "exportExcludeFields",
3527
+ "attributeStartsWith": "dmx-bind",
3528
+ "attribute": "export_exclude_fields",
3529
+ "isValue": true,
3530
+ "dataBindings": true,
3531
+ "title": "Exclude Fields",
3532
+ "type": "text",
3533
+ "help": "Export Exclude Fields.",
3534
+ "defaultValue": "",
3535
+ "initDisplay": "none"
3536
+ }
3537
+ ],
3538
+ "allowedOn": {
3539
+ "dmx-ag-grid": true
3540
+ }
3541
+ },
3432
3542
  {
3433
3543
  "name": "dmx-ag-grid-export-filename",
3434
3544
  "attributeStartsWith": "dmx-bind",
@@ -4226,6 +4336,326 @@
4226
4336
  "dmx-ag-grid": true
4227
4337
  }
4228
4338
  },
4339
+ {
4340
+ "name": "dmx-ag-grid-button11-clicked",
4341
+ "attributeStartsWith": "dmx-on",
4342
+ "attribute": "row_action_button11",
4343
+ "display": "fieldset",
4344
+ "title": "Button11 Clicked",
4345
+ "icon": "fa fa-lg fa-chevron-right",
4346
+ "groupTitle": "Custom Buttons",
4347
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4348
+ "defaultValue": false,
4349
+ "show": ["button11ActionEvent"],
4350
+ "noChangeOnHide": true,
4351
+ "type": "boolean",
4352
+ "groupEnabler": true,
4353
+ "children": [
4354
+ {
4355
+ "name": "button11ActionEvent",
4356
+ "attributeStartsWith": "dmx-on",
4357
+ "attribute": "row_action_button11",
4358
+ "isValue": true,
4359
+ "actionsPicker": true,
4360
+ "title": "Action:",
4361
+ "type": "text",
4362
+ "help": "Choose the action to execute.",
4363
+ "defaultValue": "",
4364
+ "initDisplay": "none"
4365
+ }
4366
+ ],
4367
+ "allowedOn": {
4368
+ "dmx-ag-grid": true
4369
+ }
4370
+ },
4371
+ {
4372
+ "name": "dmx-ag-grid-button12-clicked",
4373
+ "attributeStartsWith": "dmx-on",
4374
+ "attribute": "row_action_button12",
4375
+ "display": "fieldset",
4376
+ "title": "Button12 Clicked",
4377
+ "icon": "fa fa-lg fa-chevron-right",
4378
+ "groupTitle": "Custom Buttons",
4379
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4380
+ "defaultValue": false,
4381
+ "show": ["button12ActionEvent"],
4382
+ "noChangeOnHide": true,
4383
+ "type": "boolean",
4384
+ "groupEnabler": true,
4385
+ "children": [
4386
+ {
4387
+ "name": "button12ActionEvent",
4388
+ "attributeStartsWith": "dmx-on",
4389
+ "attribute": "row_action_button12",
4390
+ "isValue": true,
4391
+ "actionsPicker": true,
4392
+ "title": "Action:",
4393
+ "type": "text",
4394
+ "help": "Choose the action to execute.",
4395
+ "defaultValue": "",
4396
+ "initDisplay": "none"
4397
+ }
4398
+ ],
4399
+ "allowedOn": {
4400
+ "dmx-ag-grid": true
4401
+ }
4402
+ },
4403
+ {
4404
+ "name": "dmx-ag-grid-button13-clicked",
4405
+ "attributeStartsWith": "dmx-on",
4406
+ "attribute": "row_action_button13",
4407
+ "display": "fieldset",
4408
+ "title": "Button13 Clicked",
4409
+ "icon": "fa fa-lg fa-chevron-right",
4410
+ "groupTitle": "Custom Buttons",
4411
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4412
+ "defaultValue": false,
4413
+ "show": ["button13ActionEvent"],
4414
+ "noChangeOnHide": true,
4415
+ "type": "boolean",
4416
+ "groupEnabler": true,
4417
+ "children": [
4418
+ {
4419
+ "name": "button13ActionEvent",
4420
+ "attributeStartsWith": "dmx-on",
4421
+ "attribute": "row_action_button13",
4422
+ "isValue": true,
4423
+ "actionsPicker": true,
4424
+ "title": "Action:",
4425
+ "type": "text",
4426
+ "help": "Choose the action to execute.",
4427
+ "defaultValue": "",
4428
+ "initDisplay": "none"
4429
+ }
4430
+ ],
4431
+ "allowedOn": {
4432
+ "dmx-ag-grid": true
4433
+ }
4434
+ },
4435
+ {
4436
+ "name": "dmx-ag-grid-button14-clicked",
4437
+ "attributeStartsWith": "dmx-on",
4438
+ "attribute": "row_action_button14",
4439
+ "display": "fieldset",
4440
+ "title": "Button14 Clicked",
4441
+ "icon": "fa fa-lg fa-chevron-right",
4442
+ "groupTitle": "Custom Buttons",
4443
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4444
+ "defaultValue": false,
4445
+ "show": ["button14ActionEvent"],
4446
+ "noChangeOnHide": true,
4447
+ "type": "boolean",
4448
+ "groupEnabler": true,
4449
+ "children": [
4450
+ {
4451
+ "name": "button14ActionEvent",
4452
+ "attributeStartsWith": "dmx-on",
4453
+ "attribute": "row_action_button14",
4454
+ "isValue": true,
4455
+ "actionsPicker": true,
4456
+ "title": "Action:",
4457
+ "type": "text",
4458
+ "help": "Choose the action to execute.",
4459
+ "defaultValue": "",
4460
+ "initDisplay": "none"
4461
+ }
4462
+ ],
4463
+ "allowedOn": {
4464
+ "dmx-ag-grid": true
4465
+ }
4466
+ },
4467
+ {
4468
+ "name": "dmx-ag-grid-button15-clicked",
4469
+ "attributeStartsWith": "dmx-on",
4470
+ "attribute": "row_action_button15",
4471
+ "display": "fieldset",
4472
+ "title": "Button15 Clicked",
4473
+ "icon": "fa fa-lg fa-chevron-right",
4474
+ "groupTitle": "Custom Buttons",
4475
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4476
+ "defaultValue": false,
4477
+ "show": ["button15ActionEvent"],
4478
+ "noChangeOnHide": true,
4479
+ "type": "boolean",
4480
+ "groupEnabler": true,
4481
+ "children": [
4482
+ {
4483
+ "name": "button15ActionEvent",
4484
+ "attributeStartsWith": "dmx-on",
4485
+ "attribute": "row_action_button15",
4486
+ "isValue": true,
4487
+ "actionsPicker": true,
4488
+ "title": "Action:",
4489
+ "type": "text",
4490
+ "help": "Choose the action to execute.",
4491
+ "defaultValue": "",
4492
+ "initDisplay": "none"
4493
+ }
4494
+ ],
4495
+ "allowedOn": {
4496
+ "dmx-ag-grid": true
4497
+ }
4498
+ },
4499
+ {
4500
+ "name": "dmx-ag-grid-button16-clicked",
4501
+ "attributeStartsWith": "dmx-on",
4502
+ "attribute": "row_action_button16",
4503
+ "display": "fieldset",
4504
+ "title": "Button16 Clicked",
4505
+ "icon": "fa fa-lg fa-chevron-right",
4506
+ "groupTitle": "Custom Buttons",
4507
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4508
+ "defaultValue": false,
4509
+ "show": ["button16ActionEvent"],
4510
+ "noChangeOnHide": true,
4511
+ "type": "boolean",
4512
+ "groupEnabler": true,
4513
+ "children": [
4514
+ {
4515
+ "name": "button16ActionEvent",
4516
+ "attributeStartsWith": "dmx-on",
4517
+ "attribute": "row_action_button16",
4518
+ "isValue": true,
4519
+ "actionsPicker": true,
4520
+ "title": "Action:",
4521
+ "type": "text",
4522
+ "help": "Choose the action to execute.",
4523
+ "defaultValue": "",
4524
+ "initDisplay": "none"
4525
+ }
4526
+ ],
4527
+ "allowedOn": {
4528
+ "dmx-ag-grid": true
4529
+ }
4530
+ },
4531
+ {
4532
+ "name": "dmx-ag-grid-button17-clicked",
4533
+ "attributeStartsWith": "dmx-on",
4534
+ "attribute": "row_action_button17",
4535
+ "display": "fieldset",
4536
+ "title": "Button17 Clicked",
4537
+ "icon": "fa fa-lg fa-chevron-right",
4538
+ "groupTitle": "Custom Buttons",
4539
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4540
+ "defaultValue": false,
4541
+ "show": ["button17ActionEvent"],
4542
+ "noChangeOnHide": true,
4543
+ "type": "boolean",
4544
+ "groupEnabler": true,
4545
+ "children": [
4546
+ {
4547
+ "name": "button17ActionEvent",
4548
+ "attributeStartsWith": "dmx-on",
4549
+ "attribute": "row_action_button17",
4550
+ "isValue": true,
4551
+ "actionsPicker": true,
4552
+ "title": "Action:",
4553
+ "type": "text",
4554
+ "help": "Choose the action to execute.",
4555
+ "defaultValue": "",
4556
+ "initDisplay": "none"
4557
+ }
4558
+ ],
4559
+ "allowedOn": {
4560
+ "dmx-ag-grid": true
4561
+ }
4562
+ },
4563
+ {
4564
+ "name": "dmx-ag-grid-button18-clicked",
4565
+ "attributeStartsWith": "dmx-on",
4566
+ "attribute": "row_action_button18",
4567
+ "display": "fieldset",
4568
+ "title": "Button18 Clicked",
4569
+ "icon": "fa fa-lg fa-chevron-right",
4570
+ "groupTitle": "Custom Buttons",
4571
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4572
+ "defaultValue": false,
4573
+ "show": ["button18ActionEvent"],
4574
+ "noChangeOnHide": true,
4575
+ "type": "boolean",
4576
+ "groupEnabler": true,
4577
+ "children": [
4578
+ {
4579
+ "name": "button18ActionEvent",
4580
+ "attributeStartsWith": "dmx-on",
4581
+ "attribute": "row_action_button18",
4582
+ "isValue": true,
4583
+ "actionsPicker": true,
4584
+ "title": "Action:",
4585
+ "type": "text",
4586
+ "help": "Choose the action to execute.",
4587
+ "defaultValue": "",
4588
+ "initDisplay": "none"
4589
+ }
4590
+ ],
4591
+ "allowedOn": {
4592
+ "dmx-ag-grid": true
4593
+ }
4594
+ },
4595
+ {
4596
+ "name": "dmx-ag-grid-button19-clicked",
4597
+ "attributeStartsWith": "dmx-on",
4598
+ "attribute": "row_action_button19",
4599
+ "display": "fieldset",
4600
+ "title": "Button19 Clicked",
4601
+ "icon": "fa fa-lg fa-chevron-right",
4602
+ "groupTitle": "Custom Buttons",
4603
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4604
+ "defaultValue": false,
4605
+ "show": ["button19ActionEvent"],
4606
+ "noChangeOnHide": true,
4607
+ "type": "boolean",
4608
+ "groupEnabler": true,
4609
+ "children": [
4610
+ {
4611
+ "name": "button19ActionEvent",
4612
+ "attributeStartsWith": "dmx-on",
4613
+ "attribute": "row_action_button19",
4614
+ "isValue": true,
4615
+ "actionsPicker": true,
4616
+ "title": "Action:",
4617
+ "type": "text",
4618
+ "help": "Choose the action to execute.",
4619
+ "defaultValue": "",
4620
+ "initDisplay": "none"
4621
+ }
4622
+ ],
4623
+ "allowedOn": {
4624
+ "dmx-ag-grid": true
4625
+ }
4626
+ },
4627
+ {
4628
+ "name": "dmx-ag-grid-button20-clicked",
4629
+ "attributeStartsWith": "dmx-on",
4630
+ "attribute": "row_action_button20",
4631
+ "display": "fieldset",
4632
+ "title": "Button20 Clicked",
4633
+ "icon": "fa fa-lg fa-chevron-right",
4634
+ "groupTitle": "Custom Buttons",
4635
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4636
+ "defaultValue": false,
4637
+ "show": ["button20ActionEvent"],
4638
+ "noChangeOnHide": true,
4639
+ "type": "boolean",
4640
+ "groupEnabler": true,
4641
+ "children": [
4642
+ {
4643
+ "name": "button20ActionEvent",
4644
+ "attributeStartsWith": "dmx-on",
4645
+ "attribute": "row_action_button20",
4646
+ "isValue": true,
4647
+ "actionsPicker": true,
4648
+ "title": "Action:",
4649
+ "type": "text",
4650
+ "help": "Choose the action to execute.",
4651
+ "defaultValue": "",
4652
+ "initDisplay": "none"
4653
+ }
4654
+ ],
4655
+ "allowedOn": {
4656
+ "dmx-ag-grid": true
4657
+ }
4658
+ }
4229
4659
  ],
4230
4660
  "static_events": []
4231
4661
  }
package/dmx-ag-grid.js CHANGED
@@ -127,6 +127,7 @@ dmx.Component('ag-grid', {
127
127
  delete_action_btn_class: {type: String, default: 'btn-danger btn-xs m-1' },
128
128
  delete_action_btn_condition: {type: String, default: null },
129
129
  enable_custom_action_btns: { type: Boolean, default: false },
130
+ action_button_class_toggles: { type: Array, default: [] },
130
131
  button1_action_btn: { type: "Boolean", default: false },
131
132
  button1_action_title: { type: "String", default: "" },
132
133
  button1_action_tooltip: { type: "String", default: "" },
@@ -466,6 +467,7 @@ dmx.Component('ag-grid', {
466
467
  const enableRowDoubleClickEvent = this.props.row_double_click_event && !this.props.enable_actions && !this.props.row_checkbox_event;
467
468
  const enableCellClickEvent = this.props.row_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
468
469
  const enableCellDoubleClickEvent = this.props.row_double_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
470
+ const actionButtonClassToggles = options.action_button_class_toggles
469
471
  let localeText;
470
472
  let columnDefs = [];
471
473
  let groupedColumnDefs = [];
@@ -612,6 +614,12 @@ dmx.Component('ag-grid', {
612
614
  }
613
615
  button.innerHTML = `<i class="${buttonConfig.icon}"></i> ${buttonConfig.action}`;
614
616
  container.appendChild(button);
617
+ // Handle dynamic classes based on conditions and buttonConfig.id
618
+ actionButtonClassToggles.forEach((toggle) => {
619
+ if (toggle.btn_id === buttonConfig.id && evaluateConditions([toggle.condition], params)) {
620
+ button.classList.add(...toggle.class.split(' '));
621
+ }
622
+ });
615
623
  // Check if the button should be hidden based on the condition string and row data
616
624
  if (buttonConfig.condition) {
617
625
  const conditions = buttonConfig.condition.split(/(\|\||&&)/);
@@ -1443,6 +1451,7 @@ dmx.Component('ag-grid', {
1443
1451
 
1444
1452
  if (options.edit_action_btn) {
1445
1453
  actionsColumn.cellRendererParams.buttons.push({
1454
+ id: 'edit',
1446
1455
  action: options.edit_action_title,
1447
1456
  classNames: options.edit_action_btn_class,
1448
1457
  tooltip: options.edit_action_tooltip,
@@ -1458,6 +1467,7 @@ dmx.Component('ag-grid', {
1458
1467
 
1459
1468
  if (options.view_action_btn) {
1460
1469
  actionsColumn.cellRendererParams.buttons.push({
1470
+ id: 'view',
1461
1471
  action: options.view_action_title,
1462
1472
  classNames: options.view_action_btn_class,
1463
1473
  tooltip: options.view_action_tooltip,
@@ -1473,6 +1483,7 @@ dmx.Component('ag-grid', {
1473
1483
 
1474
1484
  if (options.delete_action_btn) {
1475
1485
  actionsColumn.cellRendererParams.buttons.push({
1486
+ id: 'delete',
1476
1487
  action: options.delete_action_title,
1477
1488
  classNames: options.delete_action_btn_class,
1478
1489
  tooltip: options.delete_action_tooltip,
@@ -1497,6 +1508,7 @@ dmx.Component('ag-grid', {
1497
1508
 
1498
1509
  if (options[buttonActionKey]) {
1499
1510
  actionsColumn.cellRendererParams.buttons.push({
1511
+ id: `button${i}`,
1500
1512
  action: options[buttonTitleKey],
1501
1513
  classNames: options[buttonClassKey],
1502
1514
  tooltip: options[buttonTooltipKey],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.8.5",
3
+ "version": "1.8.7",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "ag-grid"
15
15
  ],
16
16
  "dependencies": {
17
- "ag-grid-community": "~32.0.0",
17
+ "ag-grid-community": "~32.0.2",
18
18
  "exceljs": "4.4.x",
19
19
  "papaparse": "5.4.x"
20
20
  },