@cdmx/wappler_ag_grid 1.8.5 → 1.8.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.
@@ -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
+ "button": "",
3004
+ "class": "",
3005
+ "condition": ""
3006
+ }
3007
+ }
2932
3008
  ]
2933
3009
  }
2934
3010
  ]
@@ -4226,6 +4302,326 @@
4226
4302
  "dmx-ag-grid": true
4227
4303
  }
4228
4304
  },
4305
+ {
4306
+ "name": "dmx-ag-grid-button11-clicked",
4307
+ "attributeStartsWith": "dmx-on",
4308
+ "attribute": "row_action_button11",
4309
+ "display": "fieldset",
4310
+ "title": "Button11 Clicked",
4311
+ "icon": "fa fa-lg fa-chevron-right",
4312
+ "groupTitle": "Custom Buttons",
4313
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4314
+ "defaultValue": false,
4315
+ "show": ["button11ActionEvent"],
4316
+ "noChangeOnHide": true,
4317
+ "type": "boolean",
4318
+ "groupEnabler": true,
4319
+ "children": [
4320
+ {
4321
+ "name": "button11ActionEvent",
4322
+ "attributeStartsWith": "dmx-on",
4323
+ "attribute": "row_action_button11",
4324
+ "isValue": true,
4325
+ "actionsPicker": true,
4326
+ "title": "Action:",
4327
+ "type": "text",
4328
+ "help": "Choose the action to execute.",
4329
+ "defaultValue": "",
4330
+ "initDisplay": "none"
4331
+ }
4332
+ ],
4333
+ "allowedOn": {
4334
+ "dmx-ag-grid": true
4335
+ }
4336
+ },
4337
+ {
4338
+ "name": "dmx-ag-grid-button12-clicked",
4339
+ "attributeStartsWith": "dmx-on",
4340
+ "attribute": "row_action_button12",
4341
+ "display": "fieldset",
4342
+ "title": "Button12 Clicked",
4343
+ "icon": "fa fa-lg fa-chevron-right",
4344
+ "groupTitle": "Custom Buttons",
4345
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4346
+ "defaultValue": false,
4347
+ "show": ["button12ActionEvent"],
4348
+ "noChangeOnHide": true,
4349
+ "type": "boolean",
4350
+ "groupEnabler": true,
4351
+ "children": [
4352
+ {
4353
+ "name": "button12ActionEvent",
4354
+ "attributeStartsWith": "dmx-on",
4355
+ "attribute": "row_action_button12",
4356
+ "isValue": true,
4357
+ "actionsPicker": true,
4358
+ "title": "Action:",
4359
+ "type": "text",
4360
+ "help": "Choose the action to execute.",
4361
+ "defaultValue": "",
4362
+ "initDisplay": "none"
4363
+ }
4364
+ ],
4365
+ "allowedOn": {
4366
+ "dmx-ag-grid": true
4367
+ }
4368
+ },
4369
+ {
4370
+ "name": "dmx-ag-grid-button13-clicked",
4371
+ "attributeStartsWith": "dmx-on",
4372
+ "attribute": "row_action_button13",
4373
+ "display": "fieldset",
4374
+ "title": "Button13 Clicked",
4375
+ "icon": "fa fa-lg fa-chevron-right",
4376
+ "groupTitle": "Custom Buttons",
4377
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4378
+ "defaultValue": false,
4379
+ "show": ["button13ActionEvent"],
4380
+ "noChangeOnHide": true,
4381
+ "type": "boolean",
4382
+ "groupEnabler": true,
4383
+ "children": [
4384
+ {
4385
+ "name": "button13ActionEvent",
4386
+ "attributeStartsWith": "dmx-on",
4387
+ "attribute": "row_action_button13",
4388
+ "isValue": true,
4389
+ "actionsPicker": true,
4390
+ "title": "Action:",
4391
+ "type": "text",
4392
+ "help": "Choose the action to execute.",
4393
+ "defaultValue": "",
4394
+ "initDisplay": "none"
4395
+ }
4396
+ ],
4397
+ "allowedOn": {
4398
+ "dmx-ag-grid": true
4399
+ }
4400
+ },
4401
+ {
4402
+ "name": "dmx-ag-grid-button14-clicked",
4403
+ "attributeStartsWith": "dmx-on",
4404
+ "attribute": "row_action_button14",
4405
+ "display": "fieldset",
4406
+ "title": "Button14 Clicked",
4407
+ "icon": "fa fa-lg fa-chevron-right",
4408
+ "groupTitle": "Custom Buttons",
4409
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4410
+ "defaultValue": false,
4411
+ "show": ["button14ActionEvent"],
4412
+ "noChangeOnHide": true,
4413
+ "type": "boolean",
4414
+ "groupEnabler": true,
4415
+ "children": [
4416
+ {
4417
+ "name": "button14ActionEvent",
4418
+ "attributeStartsWith": "dmx-on",
4419
+ "attribute": "row_action_button14",
4420
+ "isValue": true,
4421
+ "actionsPicker": true,
4422
+ "title": "Action:",
4423
+ "type": "text",
4424
+ "help": "Choose the action to execute.",
4425
+ "defaultValue": "",
4426
+ "initDisplay": "none"
4427
+ }
4428
+ ],
4429
+ "allowedOn": {
4430
+ "dmx-ag-grid": true
4431
+ }
4432
+ },
4433
+ {
4434
+ "name": "dmx-ag-grid-button15-clicked",
4435
+ "attributeStartsWith": "dmx-on",
4436
+ "attribute": "row_action_button15",
4437
+ "display": "fieldset",
4438
+ "title": "Button15 Clicked",
4439
+ "icon": "fa fa-lg fa-chevron-right",
4440
+ "groupTitle": "Custom Buttons",
4441
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4442
+ "defaultValue": false,
4443
+ "show": ["button15ActionEvent"],
4444
+ "noChangeOnHide": true,
4445
+ "type": "boolean",
4446
+ "groupEnabler": true,
4447
+ "children": [
4448
+ {
4449
+ "name": "button15ActionEvent",
4450
+ "attributeStartsWith": "dmx-on",
4451
+ "attribute": "row_action_button15",
4452
+ "isValue": true,
4453
+ "actionsPicker": true,
4454
+ "title": "Action:",
4455
+ "type": "text",
4456
+ "help": "Choose the action to execute.",
4457
+ "defaultValue": "",
4458
+ "initDisplay": "none"
4459
+ }
4460
+ ],
4461
+ "allowedOn": {
4462
+ "dmx-ag-grid": true
4463
+ }
4464
+ },
4465
+ {
4466
+ "name": "dmx-ag-grid-button16-clicked",
4467
+ "attributeStartsWith": "dmx-on",
4468
+ "attribute": "row_action_button16",
4469
+ "display": "fieldset",
4470
+ "title": "Button16 Clicked",
4471
+ "icon": "fa fa-lg fa-chevron-right",
4472
+ "groupTitle": "Custom Buttons",
4473
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4474
+ "defaultValue": false,
4475
+ "show": ["button16ActionEvent"],
4476
+ "noChangeOnHide": true,
4477
+ "type": "boolean",
4478
+ "groupEnabler": true,
4479
+ "children": [
4480
+ {
4481
+ "name": "button16ActionEvent",
4482
+ "attributeStartsWith": "dmx-on",
4483
+ "attribute": "row_action_button16",
4484
+ "isValue": true,
4485
+ "actionsPicker": true,
4486
+ "title": "Action:",
4487
+ "type": "text",
4488
+ "help": "Choose the action to execute.",
4489
+ "defaultValue": "",
4490
+ "initDisplay": "none"
4491
+ }
4492
+ ],
4493
+ "allowedOn": {
4494
+ "dmx-ag-grid": true
4495
+ }
4496
+ },
4497
+ {
4498
+ "name": "dmx-ag-grid-button17-clicked",
4499
+ "attributeStartsWith": "dmx-on",
4500
+ "attribute": "row_action_button17",
4501
+ "display": "fieldset",
4502
+ "title": "Button17 Clicked",
4503
+ "icon": "fa fa-lg fa-chevron-right",
4504
+ "groupTitle": "Custom Buttons",
4505
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4506
+ "defaultValue": false,
4507
+ "show": ["button17ActionEvent"],
4508
+ "noChangeOnHide": true,
4509
+ "type": "boolean",
4510
+ "groupEnabler": true,
4511
+ "children": [
4512
+ {
4513
+ "name": "button17ActionEvent",
4514
+ "attributeStartsWith": "dmx-on",
4515
+ "attribute": "row_action_button17",
4516
+ "isValue": true,
4517
+ "actionsPicker": true,
4518
+ "title": "Action:",
4519
+ "type": "text",
4520
+ "help": "Choose the action to execute.",
4521
+ "defaultValue": "",
4522
+ "initDisplay": "none"
4523
+ }
4524
+ ],
4525
+ "allowedOn": {
4526
+ "dmx-ag-grid": true
4527
+ }
4528
+ },
4529
+ {
4530
+ "name": "dmx-ag-grid-button18-clicked",
4531
+ "attributeStartsWith": "dmx-on",
4532
+ "attribute": "row_action_button18",
4533
+ "display": "fieldset",
4534
+ "title": "Button18 Clicked",
4535
+ "icon": "fa fa-lg fa-chevron-right",
4536
+ "groupTitle": "Custom Buttons",
4537
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4538
+ "defaultValue": false,
4539
+ "show": ["button18ActionEvent"],
4540
+ "noChangeOnHide": true,
4541
+ "type": "boolean",
4542
+ "groupEnabler": true,
4543
+ "children": [
4544
+ {
4545
+ "name": "button18ActionEvent",
4546
+ "attributeStartsWith": "dmx-on",
4547
+ "attribute": "row_action_button18",
4548
+ "isValue": true,
4549
+ "actionsPicker": true,
4550
+ "title": "Action:",
4551
+ "type": "text",
4552
+ "help": "Choose the action to execute.",
4553
+ "defaultValue": "",
4554
+ "initDisplay": "none"
4555
+ }
4556
+ ],
4557
+ "allowedOn": {
4558
+ "dmx-ag-grid": true
4559
+ }
4560
+ },
4561
+ {
4562
+ "name": "dmx-ag-grid-button19-clicked",
4563
+ "attributeStartsWith": "dmx-on",
4564
+ "attribute": "row_action_button19",
4565
+ "display": "fieldset",
4566
+ "title": "Button19 Clicked",
4567
+ "icon": "fa fa-lg fa-chevron-right",
4568
+ "groupTitle": "Custom Buttons",
4569
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4570
+ "defaultValue": false,
4571
+ "show": ["button19ActionEvent"],
4572
+ "noChangeOnHide": true,
4573
+ "type": "boolean",
4574
+ "groupEnabler": true,
4575
+ "children": [
4576
+ {
4577
+ "name": "button19ActionEvent",
4578
+ "attributeStartsWith": "dmx-on",
4579
+ "attribute": "row_action_button19",
4580
+ "isValue": true,
4581
+ "actionsPicker": true,
4582
+ "title": "Action:",
4583
+ "type": "text",
4584
+ "help": "Choose the action to execute.",
4585
+ "defaultValue": "",
4586
+ "initDisplay": "none"
4587
+ }
4588
+ ],
4589
+ "allowedOn": {
4590
+ "dmx-ag-grid": true
4591
+ }
4592
+ },
4593
+ {
4594
+ "name": "dmx-ag-grid-button20-clicked",
4595
+ "attributeStartsWith": "dmx-on",
4596
+ "attribute": "row_action_button20",
4597
+ "display": "fieldset",
4598
+ "title": "Button20 Clicked",
4599
+ "icon": "fa fa-lg fa-chevron-right",
4600
+ "groupTitle": "Custom Buttons",
4601
+ "groupIcon": "fa fa-lg fa-hand-pointer",
4602
+ "defaultValue": false,
4603
+ "show": ["button20ActionEvent"],
4604
+ "noChangeOnHide": true,
4605
+ "type": "boolean",
4606
+ "groupEnabler": true,
4607
+ "children": [
4608
+ {
4609
+ "name": "button20ActionEvent",
4610
+ "attributeStartsWith": "dmx-on",
4611
+ "attribute": "row_action_button20",
4612
+ "isValue": true,
4613
+ "actionsPicker": true,
4614
+ "title": "Action:",
4615
+ "type": "text",
4616
+ "help": "Choose the action to execute.",
4617
+ "defaultValue": "",
4618
+ "initDisplay": "none"
4619
+ }
4620
+ ],
4621
+ "allowedOn": {
4622
+ "dmx-ag-grid": true
4623
+ }
4624
+ }
4229
4625
  ],
4230
4626
  "static_events": []
4231
4627
  }
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.6",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",