@cdmx/wappler_ag_grid 1.2.1 → 1.2.3
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 +3 -2
- package/app_connect/components.hjson +45 -3
- package/dmx-ag-grid.js +51 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,8 +65,9 @@ To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-cus
|
|
|
65
65
|
31. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
|
|
66
66
|
33. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
|
|
67
67
|
34. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
|
|
68
|
-
35. **
|
|
69
|
-
36. **Enable Row
|
|
68
|
+
35. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
|
|
69
|
+
36. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
|
|
70
|
+
37. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
|
|
70
71
|
|
|
71
72
|
# Data Type Overrides
|
|
72
73
|
|
|
@@ -488,7 +488,15 @@
|
|
|
488
488
|
"title": "Row Click Events",
|
|
489
489
|
"type": "boolean",
|
|
490
490
|
"defaultValue": false,
|
|
491
|
-
"help": "This
|
|
491
|
+
"help": "This enables row click events which can then be used in Dynamic Events => Grid Events => Row Clicked"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"name": "rowDoubleClickEvent",
|
|
495
|
+
"attribute": "dmx-bind:row_double_click_event",
|
|
496
|
+
"title": "Row Double Click Events",
|
|
497
|
+
"type": "boolean",
|
|
498
|
+
"defaultValue": false,
|
|
499
|
+
"help": "This enables row double click events which can then be used in Dynamic Events => Grid Events => Row Double Clicked"
|
|
492
500
|
},
|
|
493
501
|
{
|
|
494
502
|
"name": "rowCheckboxEvent",
|
|
@@ -496,7 +504,7 @@
|
|
|
496
504
|
"title": "Enable Row Selection",
|
|
497
505
|
"type": "boolean",
|
|
498
506
|
"defaultValue": false,
|
|
499
|
-
"help": "This enables row selection which can then be used in Dynamic
|
|
507
|
+
"help": "This enables row selection which can then be used in Dynamic Events => Grid Events => Checkbox Checked || Checkbox Unchecked"
|
|
500
508
|
},
|
|
501
509
|
{
|
|
502
510
|
"name": "rowStatusEvent",
|
|
@@ -504,7 +512,7 @@
|
|
|
504
512
|
"title": "Enable Row Status Toggle",
|
|
505
513
|
"type": "boolean",
|
|
506
514
|
"defaultValue": false,
|
|
507
|
-
"help": "This
|
|
515
|
+
"help": "This enables row status events which can then be used in Dynamic Events => Grid Events => Checkbox Checked || Checkbox Unchecked"
|
|
508
516
|
}
|
|
509
517
|
]
|
|
510
518
|
},
|
|
@@ -2607,6 +2615,40 @@
|
|
|
2607
2615
|
"dmx-ag-grid": true
|
|
2608
2616
|
}
|
|
2609
2617
|
},
|
|
2618
|
+
{
|
|
2619
|
+
"name": "dmx-ag-grid-row-double-clicked",
|
|
2620
|
+
"attributeStartsWith": "dmx-on",
|
|
2621
|
+
"attribute": "row_double_clicked",
|
|
2622
|
+
"display": "fieldset",
|
|
2623
|
+
"title": "Row Double Clicked",
|
|
2624
|
+
"icon": "fa fa-lg fa-chevron-right",
|
|
2625
|
+
"groupTitle": "Grid Events",
|
|
2626
|
+
"groupIcon": "fa fa-lg fa-cubes",
|
|
2627
|
+
"defaultValue": false,
|
|
2628
|
+
"show": [
|
|
2629
|
+
"rowDoubleClicked"
|
|
2630
|
+
],
|
|
2631
|
+
"noChangeOnHide": true,
|
|
2632
|
+
"type": "boolean",
|
|
2633
|
+
"groupEnabler": true,
|
|
2634
|
+
"children": [
|
|
2635
|
+
{
|
|
2636
|
+
"name": "rowDoubleClicked",
|
|
2637
|
+
"attributeStartsWith": "dmx-on",
|
|
2638
|
+
"attribute": "row_double_clicked",
|
|
2639
|
+
"isValue": true,
|
|
2640
|
+
"actionsPicker": true,
|
|
2641
|
+
"title": "Action:",
|
|
2642
|
+
"type": "text",
|
|
2643
|
+
"help": "Choose the action to execute.",
|
|
2644
|
+
"defaultValue": "",
|
|
2645
|
+
"initDisplay": "none"
|
|
2646
|
+
}
|
|
2647
|
+
],
|
|
2648
|
+
"allowedOn": {
|
|
2649
|
+
"dmx-ag-grid": true
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2610
2652
|
{
|
|
2611
2653
|
"name": "dmx-ag-grid-checkbox-checked",
|
|
2612
2654
|
"attributeStartsWith": "dmx-on",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -73,6 +73,7 @@ dmx.Component('ag-grid', {
|
|
|
73
73
|
timezone: {type: String, default: '' },
|
|
74
74
|
cell_click_event: {type: Boolean, default: false },
|
|
75
75
|
row_click_event: {type: Boolean, default: false },
|
|
76
|
+
row_double_click_event: {type: Boolean, default: false },
|
|
76
77
|
row_checkbox_event: {type: Boolean, default: false },
|
|
77
78
|
row_status_event: {type: Boolean, default: false },
|
|
78
79
|
enable_actions: {type: Boolean, default: false },
|
|
@@ -349,7 +350,9 @@ dmx.Component('ag-grid', {
|
|
|
349
350
|
const cwidths = this.props.cwidths
|
|
350
351
|
const ctypes = this.props.ctypes
|
|
351
352
|
const enableRowClickEvent = this.props.row_click_event && !this.props.enable_actions && !this.props.row_checkbox_event;
|
|
352
|
-
const
|
|
353
|
+
const enableRowDoubleClickEvent = this.props.row_double_click_event && !this.props.enable_actions && !this.props.row_checkbox_event;
|
|
354
|
+
const enableCellClickEvent = this.props.row_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
|
|
355
|
+
const enableCellDoubleClickEvent = this.props.row_double_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
|
|
353
356
|
let localeText;
|
|
354
357
|
let columnDefs = [];
|
|
355
358
|
let groupedColumnDefs = [];
|
|
@@ -397,6 +400,17 @@ dmx.Component('ag-grid', {
|
|
|
397
400
|
this.set('id', rowData.id);
|
|
398
401
|
this.dispatchEvent('row_clicked')
|
|
399
402
|
}
|
|
403
|
+
onCellDoubleClicked = (event) => {
|
|
404
|
+
const rowData = event.data;
|
|
405
|
+
const columnId = event.column.colId
|
|
406
|
+
const excludedColIds = ['checkboxColumn', 'actionsColumn', 'statusColumn'];
|
|
407
|
+
if (excludedColIds.includes(columnId)) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
this.set('data', rowData);
|
|
411
|
+
this.set('id', rowData.id);
|
|
412
|
+
this.dispatchEvent('row_double_clicked')
|
|
413
|
+
}
|
|
400
414
|
|
|
401
415
|
function checkboxCellRenderer(params) {
|
|
402
416
|
const idValue = params.data.id;
|
|
@@ -462,9 +476,8 @@ dmx.Component('ag-grid', {
|
|
|
462
476
|
container.appendChild(button);
|
|
463
477
|
// Check if the button should be hidden based on the condition string and row data
|
|
464
478
|
if (buttonConfig.condition) {
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
const isConditionMet = params.data.hasOwnProperty(left) && evaluateCondition(params.data[left], operator, right);
|
|
479
|
+
const conditions = buttonConfig.condition.split(/(\|\||&&)/);
|
|
480
|
+
const isConditionMet = evaluateConditions(conditions, params);
|
|
468
481
|
if (!isConditionMet) {
|
|
469
482
|
button.style.setProperty('display', 'none', 'important');
|
|
470
483
|
}
|
|
@@ -541,6 +554,30 @@ dmx.Component('ag-grid', {
|
|
|
541
554
|
|
|
542
555
|
return [left, operator, right];
|
|
543
556
|
}
|
|
557
|
+
function evaluateConditions(conditions, params) {
|
|
558
|
+
let results = [];
|
|
559
|
+
let operators = [];
|
|
560
|
+
for (let i = 0; i < conditions.length; i++) {
|
|
561
|
+
const part = conditions[i].trim();
|
|
562
|
+
if (part === '||' || part === '&&') {
|
|
563
|
+
operators.push(part);
|
|
564
|
+
} else {
|
|
565
|
+
const [left, operator, right] = extractConditionParts(part);
|
|
566
|
+
const result = evaluateCondition(params.data[left], operator, right);
|
|
567
|
+
results.push(result);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
let finalResult = results[0];
|
|
571
|
+
|
|
572
|
+
for (let i = 0; i < operators.length; i++) {
|
|
573
|
+
if (operators[i] === '||') {
|
|
574
|
+
finalResult = finalResult || results[i + 1];
|
|
575
|
+
} else if (operators[i] === '&&') {
|
|
576
|
+
finalResult = finalResult && results[i + 1];
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
return finalResult;
|
|
580
|
+
}
|
|
544
581
|
|
|
545
582
|
function evaluateCondition(left, operator, right) {
|
|
546
583
|
switch (operator) {
|
|
@@ -1060,6 +1097,12 @@ dmx.Component('ag-grid', {
|
|
|
1060
1097
|
this.set('id', rowData.id);
|
|
1061
1098
|
this.dispatchEvent('row_clicked')
|
|
1062
1099
|
}
|
|
1100
|
+
window.onRowDoubleClicked = (event) => {
|
|
1101
|
+
const rowData = event.data;
|
|
1102
|
+
this.set('data', rowData);
|
|
1103
|
+
this.set('id', rowData.id);
|
|
1104
|
+
this.dispatchEvent('row_double_clicked')
|
|
1105
|
+
}
|
|
1063
1106
|
let checkboxColumn;
|
|
1064
1107
|
if (options.row_checkbox_event) {
|
|
1065
1108
|
checkboxColumn = {
|
|
@@ -1178,8 +1221,10 @@ dmx.Component('ag-grid', {
|
|
|
1178
1221
|
enableRtl: options.enable_rtl,
|
|
1179
1222
|
noRowsOverlayComponent: '<div>No Records Found.</div>',
|
|
1180
1223
|
onRowClicked: enableRowClickEvent ? onRowClicked : undefined,
|
|
1224
|
+
onRowDoubleClicked: enableRowDoubleClickEvent ? onRowDoubleClicked : undefined,
|
|
1181
1225
|
onCellClicked: enableCellClickEvent ? onCellClicked : undefined,
|
|
1182
|
-
|
|
1226
|
+
onCellDoubleClicked: enableCellDoubleClickEvent ? onCellDoubleClicked : undefined,
|
|
1227
|
+
rowStyle: enableRowClickEvent || enableCellClickEvent || enableRowDoubleClickEvent || enableCellDoubleClickEvent ? { cursor: 'pointer' } : undefined,
|
|
1183
1228
|
defaultColDef: {
|
|
1184
1229
|
flex: 1,
|
|
1185
1230
|
minWidth: options.min_width,
|
|
@@ -1567,6 +1612,7 @@ dmx.Component('ag-grid', {
|
|
|
1567
1612
|
|
|
1568
1613
|
events: {
|
|
1569
1614
|
row_clicked: Event,
|
|
1615
|
+
row_double_clicked: Event,
|
|
1570
1616
|
cell_clicked: Event,
|
|
1571
1617
|
row_checkbox_checked: Event,
|
|
1572
1618
|
row_checkbox_unchecked: Event,
|