@cdmx/wappler_ag_grid 0.2.8 → 0.3.0
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 +2 -1
- package/app_connect/components.hjson +75 -10
- package/dmx-ag-grid.js +35 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,4 +16,5 @@ This Custom Module provides the below features:
|
|
|
16
16
|
13. Row Click Event Handling
|
|
17
17
|
14. Options to enable checkboxes for IDs for bulk select Operations
|
|
18
18
|
15. Options to enable Toggle Sliders for status fields
|
|
19
|
-
16. Added Action Buttons feature
|
|
19
|
+
16. Added Action Buttons feature
|
|
20
|
+
17. Advanced Data Manipulation using Arrays and SC bindings
|
|
@@ -455,11 +455,11 @@
|
|
|
455
455
|
}
|
|
456
456
|
},
|
|
457
457
|
{
|
|
458
|
-
field: "customColor",
|
|
459
|
-
caption: "Color",
|
|
460
|
-
size: "20%",
|
|
461
|
-
editable: {
|
|
462
|
-
type: "text"
|
|
458
|
+
"field": "customColor",
|
|
459
|
+
"caption": "Color",
|
|
460
|
+
"size": "20%",
|
|
461
|
+
"editable": {
|
|
462
|
+
"type": "text"
|
|
463
463
|
},
|
|
464
464
|
help: "Example: '#FF0000' or 'red'"
|
|
465
465
|
}
|
|
@@ -476,6 +476,76 @@
|
|
|
476
476
|
}
|
|
477
477
|
]
|
|
478
478
|
},
|
|
479
|
+
{
|
|
480
|
+
"group": "📒 Data Advanced Manipulation",
|
|
481
|
+
"variables": [
|
|
482
|
+
{
|
|
483
|
+
"name": "data_binded_changes",
|
|
484
|
+
"title": "Configure Fields",
|
|
485
|
+
"type": "boolean",
|
|
486
|
+
"display": "fieldset",
|
|
487
|
+
"show": [
|
|
488
|
+
"dataBindedChanges"
|
|
489
|
+
],
|
|
490
|
+
"noChangeOnHide": true,
|
|
491
|
+
"groupEnabler": true,
|
|
492
|
+
"help": "Add custom values for the field data based on value, ex: field: status, value: false, new_value: Disabled"
|
|
493
|
+
"children": [
|
|
494
|
+
{
|
|
495
|
+
"name": "dataBindedChanges",
|
|
496
|
+
"attribute": "dmx-bind:data_binded_changes",
|
|
497
|
+
"title": "Fields Data",
|
|
498
|
+
"type": "grid",
|
|
499
|
+
"dataBindings": true,
|
|
500
|
+
"jsonFormat": true,
|
|
501
|
+
"encloseBT": true,
|
|
502
|
+
"jsonBT": true,
|
|
503
|
+
"initDisplay": "none",
|
|
504
|
+
"columns": [
|
|
505
|
+
{
|
|
506
|
+
"field": "field",
|
|
507
|
+
"caption": "Field",
|
|
508
|
+
"size": "5%",
|
|
509
|
+
"editable": {
|
|
510
|
+
"type": "text"
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"field": "data_source",
|
|
515
|
+
"caption": "Data",
|
|
516
|
+
"size": "5%",
|
|
517
|
+
"editable": {
|
|
518
|
+
"type": "datapicker"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"field": "property",
|
|
523
|
+
"caption": "Property",
|
|
524
|
+
"size": "5%",
|
|
525
|
+
"editable": {
|
|
526
|
+
"type": "text"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"field": "output",
|
|
531
|
+
"caption": "Output",
|
|
532
|
+
"size": "5%",
|
|
533
|
+
"editable": {
|
|
534
|
+
"type": "text"
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
],
|
|
538
|
+
"newRecord": {
|
|
539
|
+
"field": "",
|
|
540
|
+
"data_source": "",
|
|
541
|
+
"property": "",
|
|
542
|
+
"output": ""
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
]
|
|
546
|
+
}
|
|
547
|
+
]
|
|
548
|
+
},
|
|
479
549
|
{
|
|
480
550
|
"group": "📒 Data Manipulation",
|
|
481
551
|
"variables": [
|
|
@@ -491,11 +561,6 @@
|
|
|
491
561
|
"groupEnabler": true,
|
|
492
562
|
"help": "Add custom values for the field data based on value, ex: field: status, value: false, new_value: Disabled"
|
|
493
563
|
"children": [
|
|
494
|
-
{
|
|
495
|
-
"name": "help",
|
|
496
|
-
"type": "static",
|
|
497
|
-
"help": "Add custom values for the field data based on value, ex: field: status, value: false, new_value: Disabled"
|
|
498
|
-
},
|
|
499
564
|
{
|
|
500
565
|
"name": "dataChanges",
|
|
501
566
|
"attribute": "dmx-bind:data_changes",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -65,6 +65,7 @@ dmx.Component('ag-grid', {
|
|
|
65
65
|
edit_action_btn_class: {type: String, default: 'btn-primary btn-xs' },
|
|
66
66
|
view_action_icon_class: {type: String, default: 'fas fa-eye' },
|
|
67
67
|
view_action_btn_class: {type: String, default: 'btn-info btn-xs' },
|
|
68
|
+
data_binded_changes: {type: Array, default: [] }
|
|
68
69
|
|
|
69
70
|
},
|
|
70
71
|
|
|
@@ -84,7 +85,6 @@ dmx.Component('ag-grid', {
|
|
|
84
85
|
const options = this.props
|
|
85
86
|
const rowData = this.props.data;
|
|
86
87
|
const timezone = this.props.timezone || false;
|
|
87
|
-
const dataChanges = this.props.data_changes;
|
|
88
88
|
|
|
89
89
|
let columnDefs = [];
|
|
90
90
|
let exportToCSV = this.props.exportToCSV;
|
|
@@ -284,13 +284,43 @@ dmx.Component('ag-grid', {
|
|
|
284
284
|
return 'text';
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
|
|
287
|
+
createCombinedValueGetter = (key, dataChanges, dataBindedChanges) => {
|
|
288
|
+
const keyLookup = {};
|
|
289
|
+
|
|
290
|
+
dataBindedChanges.forEach(change => {
|
|
291
|
+
if (!keyLookup[change.field]) {
|
|
292
|
+
const data_source = change.data_source;
|
|
293
|
+
const property = change.property;
|
|
294
|
+
const output = change.output;
|
|
295
|
+
let dataArray;
|
|
296
|
+
this.$addBinding(data_source, (function (e) {
|
|
297
|
+
dataArray = e;
|
|
298
|
+
}));
|
|
299
|
+
keyLookup[change.field] = { dataArray, property, output };
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
288
303
|
return function (params) {
|
|
289
304
|
const value = params.data[key];
|
|
290
|
-
|
|
305
|
+
|
|
306
|
+
// Check if there's a matching change in dataChanges
|
|
307
|
+
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
291
308
|
if (matchingChange) {
|
|
292
309
|
return matchingChange.new_value;
|
|
293
310
|
}
|
|
311
|
+
|
|
312
|
+
// Check if there's a matching change in dataBindedChanges
|
|
313
|
+
const matchingKeyData = keyLookup[key];
|
|
314
|
+
if (matchingKeyData) {
|
|
315
|
+
const { dataArray, property, output } = matchingKeyData;
|
|
316
|
+
const matchingItem = dataArray.find(item => item[property] === value);
|
|
317
|
+
|
|
318
|
+
if (matchingItem) {
|
|
319
|
+
return matchingItem[output];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Return the original value if no matching changes were found
|
|
294
324
|
return value;
|
|
295
325
|
};
|
|
296
326
|
}
|
|
@@ -311,8 +341,6 @@ dmx.Component('ag-grid', {
|
|
|
311
341
|
let filterParams;
|
|
312
342
|
let minWidth;
|
|
313
343
|
let hide;
|
|
314
|
-
|
|
315
|
-
|
|
316
344
|
if (dataType === 'number') {
|
|
317
345
|
filter = 'agNumberColumnFilter';
|
|
318
346
|
if (/(amount|amt)$/.test(key)) {
|
|
@@ -350,7 +378,8 @@ dmx.Component('ag-grid', {
|
|
|
350
378
|
}
|
|
351
379
|
}
|
|
352
380
|
else {
|
|
353
|
-
valueGetter = getValueGetter(key, dataChanges);
|
|
381
|
+
// valueGetter = getValueGetter(key, dataChanges);
|
|
382
|
+
valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes);
|
|
354
383
|
}
|
|
355
384
|
function extractConditionParts(condition) {
|
|
356
385
|
const parts = condition.match(/(.+?)(===|==|!=|>|<|>=|<=)(.+)/);
|