@cdmx/wappler_ag_grid 0.4.4 → 0.4.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.
- package/app_connect/components.hjson +29 -4
- package/dmx-ag-grid.js +50 -4
- package/package.json +1 -1
|
@@ -650,13 +650,26 @@
|
|
|
650
650
|
"editable": {
|
|
651
651
|
"type": "text"
|
|
652
652
|
}
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"field": "area",
|
|
656
|
+
"caption": "Area",
|
|
657
|
+
"size": "5%",
|
|
658
|
+
"editable": {
|
|
659
|
+
"type": "list",
|
|
660
|
+
"items": [
|
|
661
|
+
{id: 'cell', text: 'cell'},
|
|
662
|
+
{id: 'tooltip', text: 'tooltip'}
|
|
663
|
+
]
|
|
664
|
+
}
|
|
653
665
|
}
|
|
654
666
|
],
|
|
655
667
|
"newRecord": {
|
|
656
668
|
"field": "",
|
|
657
669
|
"data_source": "",
|
|
658
670
|
"property": "",
|
|
659
|
-
"output": ""
|
|
671
|
+
"output": "",
|
|
672
|
+
"area": "cell"
|
|
660
673
|
}
|
|
661
674
|
}
|
|
662
675
|
]
|
|
@@ -712,13 +725,25 @@
|
|
|
712
725
|
editable: {
|
|
713
726
|
type: "text"
|
|
714
727
|
}
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"field": "area",
|
|
731
|
+
"caption": "Area",
|
|
732
|
+
"size": "5%",
|
|
733
|
+
"editable": {
|
|
734
|
+
"type": "list",
|
|
735
|
+
"items": [
|
|
736
|
+
{id: 'cell', text: 'cell'},
|
|
737
|
+
{id: 'tooltip', text: 'tooltip'}
|
|
738
|
+
]
|
|
739
|
+
}
|
|
715
740
|
}
|
|
716
741
|
],
|
|
717
742
|
"newRecord": {
|
|
718
|
-
"name": "",
|
|
719
|
-
"value": "",
|
|
720
743
|
"field": "",
|
|
721
|
-
"
|
|
744
|
+
"value": "",
|
|
745
|
+
"new_value": "",
|
|
746
|
+
"area": "cell"
|
|
722
747
|
}
|
|
723
748
|
}
|
|
724
749
|
]
|
package/dmx-ag-grid.js
CHANGED
|
@@ -388,11 +388,12 @@ dmx.Component('ag-grid', {
|
|
|
388
388
|
const data_source = change.data_source;
|
|
389
389
|
const property = change.property;
|
|
390
390
|
const output = change.output;
|
|
391
|
+
const area = change.area;
|
|
391
392
|
let dataArray;
|
|
392
393
|
this.$addBinding(data_source, (function (e) {
|
|
393
394
|
dataArray = e;
|
|
394
395
|
}));
|
|
395
|
-
keyLookup[change.field] = { dataArray, property, output };
|
|
396
|
+
keyLookup[change.field] = { dataArray, property, output, area };
|
|
396
397
|
}
|
|
397
398
|
});
|
|
398
399
|
|
|
@@ -401,17 +402,17 @@ dmx.Component('ag-grid', {
|
|
|
401
402
|
|
|
402
403
|
// Check if there's a matching change in dataChanges
|
|
403
404
|
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
404
|
-
if (matchingChange) {
|
|
405
|
+
if (matchingChange && matchingChange.area === 'tooltip' ) {
|
|
405
406
|
return matchingChange.new_value;
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
// Check if there's a matching change in dataBindedChanges
|
|
409
410
|
const matchingKeyData = keyLookup[key];
|
|
410
411
|
if (matchingKeyData) {
|
|
411
|
-
const { dataArray, property, output } = matchingKeyData;
|
|
412
|
+
const { dataArray, property, output, area } = matchingKeyData;
|
|
412
413
|
const matchingItem = dataArray.find(item => item[property] === value);
|
|
413
414
|
|
|
414
|
-
if (matchingItem) {
|
|
415
|
+
if (matchingItem && area === 'cell') {
|
|
415
416
|
return matchingItem[output];
|
|
416
417
|
}
|
|
417
418
|
}
|
|
@@ -420,6 +421,48 @@ dmx.Component('ag-grid', {
|
|
|
420
421
|
return value;
|
|
421
422
|
};
|
|
422
423
|
}
|
|
424
|
+
createCombinedTooltipValueGetter = (key, dataChanges, dataBindedChanges) => {
|
|
425
|
+
const keyLookup = {};
|
|
426
|
+
|
|
427
|
+
dataBindedChanges.forEach(change => {
|
|
428
|
+
if (!keyLookup[change.field]) {
|
|
429
|
+
const data_source = change.data_source;
|
|
430
|
+
const property = change.property;
|
|
431
|
+
const output = change.output;
|
|
432
|
+
const area = change.area;
|
|
433
|
+
let dataArray;
|
|
434
|
+
this.$addBinding(data_source, (function (e) {
|
|
435
|
+
dataArray = e;
|
|
436
|
+
}));
|
|
437
|
+
keyLookup[change.field] = { dataArray, property, output, area };
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
return function (params) {
|
|
442
|
+
const value = params.data[key];
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
// Check if there's a matching change in dataChanges
|
|
446
|
+
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
447
|
+
if (matchingChange && matchingChange.area === 'tooltip' ) {
|
|
448
|
+
return matchingChange.new_value;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Check if there's a matching change in dataBindedChanges
|
|
452
|
+
const matchingKeyData = keyLookup[key];
|
|
453
|
+
if (matchingKeyData) {
|
|
454
|
+
const { dataArray, property, output, area } = matchingKeyData;
|
|
455
|
+
const matchingItem = dataArray.find(item => item[property] === value);
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
if (matchingItem && area === 'tooltip') {
|
|
459
|
+
return matchingItem[output];
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// Return the original value if no matching changes were found
|
|
463
|
+
return undefined;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
423
466
|
createCombinedFilterValueGetter = (key, dataChanges, dataBindedChanges) => {
|
|
424
467
|
const keyLookup = {};
|
|
425
468
|
|
|
@@ -516,8 +559,10 @@ dmx.Component('ag-grid', {
|
|
|
516
559
|
else {
|
|
517
560
|
valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
518
561
|
filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
562
|
+
tooltipValueGetter = createCombinedTooltipValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
519
563
|
}
|
|
520
564
|
function extractConditionParts(condition) {
|
|
565
|
+
|
|
521
566
|
const operators = ['===', '==', '!=', '>', '<', '>=', '<='];
|
|
522
567
|
let operator;
|
|
523
568
|
let left;
|
|
@@ -634,6 +679,7 @@ dmx.Component('ag-grid', {
|
|
|
634
679
|
sortable: sortable,
|
|
635
680
|
filterValueGetter: filterValueGetter,
|
|
636
681
|
filterParams: filterParams,
|
|
682
|
+
tooltipValueGetter: tooltipValueGetter,
|
|
637
683
|
cellStyle: applyCellStyle,
|
|
638
684
|
...(cwidths.hasOwnProperty(key) && {
|
|
639
685
|
minWidth: parseInt(cwidths[key].min_width),
|