@cdmx/wappler_ag_grid 0.4.6 → 0.4.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.
@@ -590,6 +590,72 @@
590
590
  }
591
591
  ]
592
592
  },
593
+ {
594
+ "group": "📒 Tooltip Settings",
595
+ "variables": [
596
+ {
597
+ "name": "customTooltip",
598
+ "attribute": "custom_tooltip",
599
+ "title": "Custom Tooltip Text",
600
+ "type": "text",
601
+ "help": "Specify custom tooltip text"
602
+ },
603
+ {
604
+ "name": "tooltipConfig",
605
+ "title": "Configure Field Tooltips",
606
+ "attributeStartsWith": "dmx-bind",
607
+ "attribute": "tooltip_config",
608
+ "type": "boolean",
609
+ "defaultValue": false,
610
+ "display": "fieldset",
611
+ "show": [
612
+ "tooltipConfig"
613
+ ],
614
+ "noChangeOnHide": true,
615
+ "groupEnabler": true,
616
+ "help": "Enable/Disable Tooltips for fields"
617
+ "children": [
618
+ {
619
+ "name": "tooltipConfig",
620
+ "attribute": "dmx-bind:tooltip_config",
621
+ "title": "Tooltip Configs",
622
+ "type": "grid",
623
+ "dataBindings": true,
624
+ "jsonFormat": true,
625
+ "encloseBT": true,
626
+ "jsonBT": true,
627
+ "initDisplay": "none",
628
+ "columns": [
629
+ {
630
+ "field": "field",
631
+ "caption": "Field",
632
+ "size": "20%",
633
+ "editable": {
634
+ "type": "text"
635
+ }
636
+ },
637
+ {
638
+ "field": "tooltip",
639
+ "caption": "Tooltip",
640
+ "size": "20%",
641
+ "editable": {
642
+ "type": "list",
643
+ "items": [
644
+ {id: 'yes', text: 'yes'},
645
+ {id: 'no', text: 'no'}
646
+ ]
647
+ }
648
+ }
649
+ ],
650
+ "newRecord": {
651
+ "field": "",
652
+ "tooltip": "no"
653
+ }
654
+ }
655
+ ]
656
+ }
657
+ ]
658
+ },
593
659
  {
594
660
  "group": "📒 Advanced Data Manipulation",
595
661
  "variables": [
package/dmx-ag-grid.js CHANGED
@@ -11,6 +11,8 @@ dmx.Component('ag-grid', {
11
11
  noload: { type: Boolean, default: false },
12
12
  grid_theme: { type: String, default: 'ag-theme-alpine' },
13
13
  column_defs: { type: Array, default: [] },
14
+ tooltip_config: { type: Array, default: [] },
15
+ custom_tooltip: { type: String, default: null },
14
16
  cstyles: { type: Array, default: [] },
15
17
  cnames: { type: Object, default: {} },
16
18
  cwidths: { type: Object, default: {} },
@@ -423,7 +425,6 @@ dmx.Component('ag-grid', {
423
425
  }
424
426
  createCombinedTooltipValueGetter = (key, dataChanges, dataBindedChanges) => {
425
427
  const keyLookup = {};
426
-
427
428
  dataBindedChanges.forEach(change => {
428
429
  if (!keyLookup[change.field]) {
429
430
  const data_source = change.data_source;
@@ -453,14 +454,23 @@ dmx.Component('ag-grid', {
453
454
  if (matchingKeyData) {
454
455
  const { dataArray, property, output, area } = matchingKeyData;
455
456
  const matchingItem = dataArray.find(item => item[property] === value);
456
-
457
-
458
457
  if (matchingItem && area === 'tooltip') {
459
458
  return matchingItem[output];
460
459
  }
461
460
  }
462
- // Return the original value if no matching changes were found
463
- return undefined;
461
+ if (options.custom_tooltip) {
462
+ return options.custom_tooltip;
463
+ }
464
+ else if (Array.isArray(options.tooltip_config)) {
465
+ for (const config of options.tooltip_config) {
466
+ if (config.field === key && config.tooltip === "yes") {
467
+ return value;
468
+ }
469
+ }
470
+ }
471
+ else {
472
+ return undefined;
473
+ }
464
474
  };
465
475
  }
466
476
  createCombinedFilterValueGetter = (key, dataChanges, dataBindedChanges) => {
@@ -560,6 +570,7 @@ dmx.Component('ag-grid', {
560
570
  valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes);
561
571
  filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes);
562
572
  tooltipValueGetter = createCombinedTooltipValueGetter(key, options.data_changes, options.data_binded_changes);
573
+
563
574
  }
564
575
  function extractConditionParts(condition) {
565
576
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",