@cdmx/wappler_ag_grid 0.2.5 → 0.2.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
@@ -15,4 +15,5 @@ This Custom Module provides the below features:
15
15
  12. Theme selection
16
16
  13. Row Click Event Handling
17
17
  14. Options to enable checkboxes for IDs for bulk select Operations
18
- 15. Options to enable Toggle Sliders for status fields
18
+ 15. Options to enable Toggle Sliders for status fields
19
+ 16. Added Action Buttons feature
@@ -407,8 +407,6 @@
407
407
  "variables": [
408
408
  {
409
409
  "name": "cstyles",
410
- "attributeStartsWith": "dmx-bind",
411
- "attribute": "cstyles",
412
410
  "title": "Configure Colors",
413
411
  "type": "boolean",
414
412
  "display": "fieldset",
@@ -430,7 +428,6 @@
430
428
  "title": "Colors",
431
429
  "type": "grid",
432
430
  "dataBindings": true,
433
- "key": "field",
434
431
  "jsonFormat": true,
435
432
  "encloseBT": true,
436
433
  "jsonBT": true,
@@ -479,8 +476,6 @@
479
476
  "variables": [
480
477
  {
481
478
  "name": "data_changes",
482
- "attributeStartsWith": "dmx-bind",
483
- "attribute": "data_changes",
484
479
  "title": "Configure Fields",
485
480
  "type": "boolean",
486
481
  "display": "fieldset",
@@ -502,7 +497,6 @@
502
497
  "title": "Fields Data",
503
498
  "type": "grid",
504
499
  "dataBindings": true,
505
- "key": "field",
506
500
  "jsonFormat": true,
507
501
  "encloseBT": true,
508
502
  "jsonBT": true,
@@ -546,8 +540,6 @@
546
540
  "variables": [
547
541
  {
548
542
  "name": "cnames",
549
- "attributeStartsWith": "dmx-bind",
550
- "attribute": "cnames",
551
543
  "title": "Configure Header Names",
552
544
  "type": "boolean",
553
545
  "display": "fieldset",
@@ -609,8 +601,6 @@
609
601
  "variables": [
610
602
  {
611
603
  "name": "cwidths",
612
- "attributeStartsWith": "dmx-bind",
613
- "attribute": "cwidths",
614
604
  "title": "Configure Custom Widths",
615
605
  "type": "boolean",
616
606
  "display": "fieldset",
package/dmx-ag-grid.js CHANGED
@@ -10,10 +10,10 @@ dmx.Component('ag-grid', {
10
10
  rowData: { type: Array, default: [] },
11
11
  grid_theme: { type: String, default: 'ag-theme-alpine' },
12
12
  column_defs: { type: Array, default: [] },
13
- cstyles: { type: Object, default: {} },
13
+ cstyles: { type: Array, default: [] },
14
14
  cnames: { type: Object, default: {} },
15
15
  cwidths: { type: Object, default: {} },
16
- data_changes: { type: Object, default: {} },
16
+ data_changes: { type: Array, default: [] },
17
17
  data: { type: Array, default: [] },
18
18
  domLayout: { default: 'autoHeight' },
19
19
  enableCellTextSelection: { type: Boolean, default: true },
@@ -284,11 +284,11 @@ dmx.Component('ag-grid', {
284
284
  }
285
285
  }
286
286
  function getValueGetter(key, dataChanges) {
287
- return function(params) {
288
- let value = params.data[key];
289
- if (dataChanges.hasOwnProperty(key)) {
290
- const change = dataChanges[key];
291
- value = change.new_value;
287
+ return function (params) {
288
+ const value = params.data[key];
289
+ const matchingChange = dataChanges.find((change) => change.field === key && change.value === String(value));
290
+ if (matchingChange) {
291
+ return matchingChange.new_value;
292
292
  }
293
293
  return value;
294
294
  };
@@ -383,16 +383,22 @@ dmx.Component('ag-grid', {
383
383
  const cstyles = this.props.cstyles
384
384
  // Check if custom color exists for the current field and condition
385
385
  function applyCellStyle(params) {
386
- const field = params.colDef.field.toString();
387
- if (cstyles.hasOwnProperty(field)) {
388
- const condition = cstyles[field].condition;
389
- const customColor = cstyles[field].customColor;
390
- const [left, operator, right] = extractConditionParts(condition);
391
- if (params.data.hasOwnProperty(field) && evaluateCondition(params.data[left], operator, right)) {
392
- return { color: customColor };
393
- }
386
+ const field = params.colDef.field.toString();
387
+ const styles = cstyles.filter((cs) => cs.field === field);
388
+
389
+ for (const style of styles) {
390
+ const condition = style.condition;
391
+ const customColor = style.customColor;
392
+ const [left, operator, right] = extractConditionParts(condition);
393
+ if (
394
+ params.data.hasOwnProperty(left) &&
395
+ evaluateCondition(params.data[left], operator, right)
396
+ ) {
397
+ return { color: customColor };
394
398
  }
395
- return null;
399
+ }
400
+
401
+ return null;
396
402
  }
397
403
  cnames = this.props.cnames
398
404
  cwidths = this.props.cwidths
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",