@cdmx/wappler_ag_grid 1.2.0 → 1.2.2
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 +20 -2
- package/app_connect/components.hjson +78 -4
- package/dmx-ag-grid.js +50 -7
- 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
|
|
|
@@ -135,9 +136,26 @@ This grid allows you to define custom data changes for specific fields. The grid
|
|
|
135
136
|
The Display Data Manipulation feature allows you to add custom text, Combine fields data.
|
|
136
137
|
The grid has the following settings:
|
|
137
138
|
|
|
139
|
+
**Using Field Data**
|
|
140
|
+
|
|
138
141
|
1. **Field**: The field name for which you want to apply the custom data changes.
|
|
139
142
|
2. **Data**: The value to be replaced in the field data ex: %first_name% %last_name%.
|
|
140
143
|
|
|
144
|
+
**Using JS Function**
|
|
145
|
+
|
|
146
|
+
1. **Field**: The field name for which you want to apply the custom data changes.
|
|
147
|
+
2. **Function**: Create a JavaScript function that defines the custom rendering logic. In your HTML or script section, define the JS function.
|
|
148
|
+
ex: jsChanges.
|
|
149
|
+
|
|
150
|
+
<script>
|
|
151
|
+
function jsChanges(data) {
|
|
152
|
+
const html = `
|
|
153
|
+
<div style="color: red; line-height: 2;">${data.code}</div>
|
|
154
|
+
<div style="color: green; line-height: 2;">This is a new line in green.</div>`;
|
|
155
|
+
return html;
|
|
156
|
+
}
|
|
157
|
+
</script>
|
|
158
|
+
|
|
141
159
|
---
|
|
142
160
|
# Custom Headers
|
|
143
161
|
|
|
@@ -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
|
},
|
|
@@ -904,6 +912,7 @@
|
|
|
904
912
|
"display": "fieldset",
|
|
905
913
|
"show": [
|
|
906
914
|
"displayDataChanges",
|
|
915
|
+
"jsDataChanges"
|
|
907
916
|
],
|
|
908
917
|
"noChangeOnHide": true,
|
|
909
918
|
"groupEnabler": true,
|
|
@@ -912,7 +921,7 @@
|
|
|
912
921
|
{
|
|
913
922
|
"name": "displayDataChanges",
|
|
914
923
|
"attribute": "dmx-bind:display_data_changes",
|
|
915
|
-
"title": "
|
|
924
|
+
"title": "Using Field Data",
|
|
916
925
|
"type": "grid",
|
|
917
926
|
"dataBindings": true,
|
|
918
927
|
"jsonFormat": true,
|
|
@@ -939,6 +948,37 @@
|
|
|
939
948
|
"field": "",
|
|
940
949
|
"data": ""
|
|
941
950
|
}
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
"name": "jsDataChanges",
|
|
954
|
+
"attribute": "dmx-bind:js_data_changes",
|
|
955
|
+
"title": "Using JS Function",
|
|
956
|
+
"type": "grid",
|
|
957
|
+
"dataBindings": true,
|
|
958
|
+
"jsonFormat": true,
|
|
959
|
+
"encloseBT": true,
|
|
960
|
+
"jsonBT": true,
|
|
961
|
+
"initDisplay": "none",
|
|
962
|
+
"columns": [
|
|
963
|
+
{
|
|
964
|
+
"field": "field",
|
|
965
|
+
"caption": "Field",
|
|
966
|
+
"editable": {
|
|
967
|
+
"type": "text"
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
field: "function",
|
|
972
|
+
caption: "Function",
|
|
973
|
+
editable: {
|
|
974
|
+
type: "text"
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
],
|
|
978
|
+
"newRecord": {
|
|
979
|
+
"field": "",
|
|
980
|
+
"function": ""
|
|
981
|
+
}
|
|
942
982
|
}
|
|
943
983
|
]
|
|
944
984
|
}
|
|
@@ -2575,6 +2615,40 @@
|
|
|
2575
2615
|
"dmx-ag-grid": true
|
|
2576
2616
|
}
|
|
2577
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
|
+
},
|
|
2578
2652
|
{
|
|
2579
2653
|
"name": "dmx-ag-grid-checkbox-checked",
|
|
2580
2654
|
"attributeStartsWith": "dmx-on",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -25,6 +25,7 @@ dmx.Component('ag-grid', {
|
|
|
25
25
|
wrap_text: { type: Boolean, default: false },
|
|
26
26
|
data_changes: { type: Array, default: [] },
|
|
27
27
|
display_data_changes: { type: Array, default: [] },
|
|
28
|
+
js_data_changes: { type: Array, default: [] },
|
|
28
29
|
data: { type: Array, default: [] },
|
|
29
30
|
dom_layout: { type: String, default: 'autoHeight' },
|
|
30
31
|
enable_cell_text_selection: { type: Boolean, default: true },
|
|
@@ -72,6 +73,7 @@ dmx.Component('ag-grid', {
|
|
|
72
73
|
timezone: {type: String, default: '' },
|
|
73
74
|
cell_click_event: {type: Boolean, default: false },
|
|
74
75
|
row_click_event: {type: Boolean, default: false },
|
|
76
|
+
row_double_click_event: {type: Boolean, default: false },
|
|
75
77
|
row_checkbox_event: {type: Boolean, default: false },
|
|
76
78
|
row_status_event: {type: Boolean, default: false },
|
|
77
79
|
enable_actions: {type: Boolean, default: false },
|
|
@@ -348,7 +350,9 @@ dmx.Component('ag-grid', {
|
|
|
348
350
|
const cwidths = this.props.cwidths
|
|
349
351
|
const ctypes = this.props.ctypes
|
|
350
352
|
const enableRowClickEvent = this.props.row_click_event && !this.props.enable_actions && !this.props.row_checkbox_event;
|
|
351
|
-
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);
|
|
352
356
|
let localeText;
|
|
353
357
|
let columnDefs = [];
|
|
354
358
|
let groupedColumnDefs = [];
|
|
@@ -396,6 +400,17 @@ dmx.Component('ag-grid', {
|
|
|
396
400
|
this.set('id', rowData.id);
|
|
397
401
|
this.dispatchEvent('row_clicked')
|
|
398
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
|
+
}
|
|
399
414
|
|
|
400
415
|
function checkboxCellRenderer(params) {
|
|
401
416
|
const idValue = params.data.id;
|
|
@@ -728,7 +743,7 @@ dmx.Component('ag-grid', {
|
|
|
728
743
|
return cellData;
|
|
729
744
|
}, value);
|
|
730
745
|
}
|
|
731
|
-
|
|
746
|
+
|
|
732
747
|
// Check if there's a matching change in dataChanges
|
|
733
748
|
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
734
749
|
if (matchingChange && matchingChange.area === 'cell' ) {
|
|
@@ -953,6 +968,27 @@ dmx.Component('ag-grid', {
|
|
|
953
968
|
else {
|
|
954
969
|
headerName = humanize(key);
|
|
955
970
|
}
|
|
971
|
+
|
|
972
|
+
if (options.js_data_changes.length > 0 && Array.isArray(options.js_data_changes)) {
|
|
973
|
+
// Check if there's a matching change in jsDataChanges
|
|
974
|
+
const matchingJsChange = options.js_data_changes.find(change => change.field === key);
|
|
975
|
+
if (matchingJsChange) {
|
|
976
|
+
cellRenderer = function (params) {
|
|
977
|
+
if (typeof window[matchingJsChange.function] === 'function') {
|
|
978
|
+
const cellValue = window[matchingJsChange.function](params.data);
|
|
979
|
+
return cellValue;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
cellRenderer = undefined;
|
|
985
|
+
colId = undefined;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
cellRenderer = undefined;
|
|
990
|
+
colId = undefined;
|
|
991
|
+
}
|
|
956
992
|
if (key =='status' && options.row_status_event) {
|
|
957
993
|
cellRenderer = 'checkboxCellRenderer';
|
|
958
994
|
colId = 'statusColumn';
|
|
@@ -965,10 +1001,8 @@ dmx.Component('ag-grid', {
|
|
|
965
1001
|
filter = null;
|
|
966
1002
|
}
|
|
967
1003
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
colId = undefined;
|
|
971
|
-
}
|
|
1004
|
+
|
|
1005
|
+
|
|
972
1006
|
if (options.hide_sort) {
|
|
973
1007
|
const hideSortArray = options.hide_sort.split(',');
|
|
974
1008
|
if (hideSortArray.includes(key)) {
|
|
@@ -1040,6 +1074,12 @@ dmx.Component('ag-grid', {
|
|
|
1040
1074
|
this.set('id', rowData.id);
|
|
1041
1075
|
this.dispatchEvent('row_clicked')
|
|
1042
1076
|
}
|
|
1077
|
+
window.onRowDoubleClicked = (event) => {
|
|
1078
|
+
const rowData = event.data;
|
|
1079
|
+
this.set('data', rowData);
|
|
1080
|
+
this.set('id', rowData.id);
|
|
1081
|
+
this.dispatchEvent('row_double_clicked')
|
|
1082
|
+
}
|
|
1043
1083
|
let checkboxColumn;
|
|
1044
1084
|
if (options.row_checkbox_event) {
|
|
1045
1085
|
checkboxColumn = {
|
|
@@ -1158,8 +1198,10 @@ dmx.Component('ag-grid', {
|
|
|
1158
1198
|
enableRtl: options.enable_rtl,
|
|
1159
1199
|
noRowsOverlayComponent: '<div>No Records Found.</div>',
|
|
1160
1200
|
onRowClicked: enableRowClickEvent ? onRowClicked : undefined,
|
|
1201
|
+
onRowDoubleClicked: enableRowDoubleClickEvent ? onRowDoubleClicked : undefined,
|
|
1161
1202
|
onCellClicked: enableCellClickEvent ? onCellClicked : undefined,
|
|
1162
|
-
|
|
1203
|
+
onCellDoubleClicked: enableCellDoubleClickEvent ? onCellDoubleClicked : undefined,
|
|
1204
|
+
rowStyle: enableRowClickEvent || enableCellClickEvent || enableRowDoubleClickEvent || enableCellDoubleClickEvent ? { cursor: 'pointer' } : undefined,
|
|
1163
1205
|
defaultColDef: {
|
|
1164
1206
|
flex: 1,
|
|
1165
1207
|
minWidth: options.min_width,
|
|
@@ -1547,6 +1589,7 @@ dmx.Component('ag-grid', {
|
|
|
1547
1589
|
|
|
1548
1590
|
events: {
|
|
1549
1591
|
row_clicked: Event,
|
|
1592
|
+
row_double_clicked: Event,
|
|
1550
1593
|
cell_clicked: Event,
|
|
1551
1594
|
row_checkbox_checked: Event,
|
|
1552
1595
|
row_checkbox_unchecked: Event,
|