@cdmx/wappler_ag_grid 0.6.0 → 0.6.1
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 +1 -1
- package/app_connect/components.hjson +62 -0
- package/dmx-ag-grid.js +25 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -233,7 +233,7 @@ Specify the CSS class for styling the icon of the Delete Action button.
|
|
|
233
233
|
- Use Case: Used when you're awaiting the population of specific elements or data before loading the grid. It's also useful for refreshing the grid intentionally.
|
|
234
234
|
|
|
235
235
|
**Reload** (Beta)
|
|
236
|
-
- To be used in conjunction with "No Auto Load"
|
|
236
|
+
- To be used in conjunction with "No Auto Load" enabled
|
|
237
237
|
- This performs a transactional update of the client-side data in the grid after comparing the existing and updated datasets
|
|
238
238
|
- To use this: Enable "No Auto Load", On Edit or update actions, perform an SC load, On Success of SC load perform the AG Grid Module Reload Action.
|
|
239
239
|
|
|
@@ -1098,6 +1098,68 @@
|
|
|
1098
1098
|
}
|
|
1099
1099
|
]
|
|
1100
1100
|
},
|
|
1101
|
+
{
|
|
1102
|
+
"group": "📒 Column Groups",
|
|
1103
|
+
"variables": [
|
|
1104
|
+
{
|
|
1105
|
+
"name": "groupConfig",
|
|
1106
|
+
"title": "Configure Column Groups",
|
|
1107
|
+
"type": "boolean",
|
|
1108
|
+
"defaultValue": false,
|
|
1109
|
+
"display": "fieldset",
|
|
1110
|
+
"show": [
|
|
1111
|
+
"listGroupConfig",
|
|
1112
|
+
],
|
|
1113
|
+
"noChangeOnHide": true,
|
|
1114
|
+
"groupEnabler": true,
|
|
1115
|
+
"help": "Apply Column grouping"
|
|
1116
|
+
"children": [
|
|
1117
|
+
{
|
|
1118
|
+
"name": "listGroupConfig",
|
|
1119
|
+
"attribute": "dmx-bind:group_config",
|
|
1120
|
+
"title": "Group Config",
|
|
1121
|
+
"type": "grid",
|
|
1122
|
+
"dataBindings": true,
|
|
1123
|
+
"jsonFormat": true,
|
|
1124
|
+
"encloseBT": true,
|
|
1125
|
+
"jsonBT": true,
|
|
1126
|
+
"initDisplay": "none",
|
|
1127
|
+
"columns": [
|
|
1128
|
+
{
|
|
1129
|
+
"field": "name",
|
|
1130
|
+
"caption": "Group Name",
|
|
1131
|
+
"size": "25%",
|
|
1132
|
+
"editable": {
|
|
1133
|
+
"type": "text"
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
field: "start_field",
|
|
1138
|
+
caption: "Start Field",
|
|
1139
|
+
size: "25%",
|
|
1140
|
+
editable: {
|
|
1141
|
+
type: "text"
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
field: "end_field",
|
|
1146
|
+
caption: "Start Field",
|
|
1147
|
+
size: "25%",
|
|
1148
|
+
editable: {
|
|
1149
|
+
type: "text"
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
],
|
|
1153
|
+
"newRecord": {
|
|
1154
|
+
"name": "",
|
|
1155
|
+
"start_field": "",
|
|
1156
|
+
"end_field": ""
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
]
|
|
1160
|
+
}
|
|
1161
|
+
]
|
|
1162
|
+
},
|
|
1101
1163
|
{
|
|
1102
1164
|
"group": "📒 Configure Actions Column",
|
|
1103
1165
|
"variables": [
|
package/dmx-ag-grid.js
CHANGED
|
@@ -85,7 +85,8 @@ dmx.Component('ag-grid', {
|
|
|
85
85
|
hide_sort: {type: Array, default: [] },
|
|
86
86
|
compact_view: { type: Boolean, default: false },
|
|
87
87
|
compact_view_grid_size: { type: Number, default: 3 },
|
|
88
|
-
compact_view_item_height: { type: Number, default: 20 }
|
|
88
|
+
compact_view_item_height: { type: Number, default: 20 },
|
|
89
|
+
group_config: { type: Array, default: [] }
|
|
89
90
|
},
|
|
90
91
|
|
|
91
92
|
methods: {
|
|
@@ -149,6 +150,7 @@ dmx.Component('ag-grid', {
|
|
|
149
150
|
const enableCellClickEvent = this.props.row_click_event && (this.props.enable_actions || this.props.row_checkbox_event);
|
|
150
151
|
let localeText;
|
|
151
152
|
let columnDefs = [];
|
|
153
|
+
let groupedColumnDefs = [];
|
|
152
154
|
let exportToCSV = this.props.export_to_csv;
|
|
153
155
|
let gridInstance = null;
|
|
154
156
|
this.$node.innerHTML = `<div id=${options.id}-grid class="${options.grid_theme}"></div>`;
|
|
@@ -559,7 +561,6 @@ dmx.Component('ag-grid', {
|
|
|
559
561
|
columnDefs = this.props.column_defs;
|
|
560
562
|
} else {
|
|
561
563
|
const firstRow = rowData[0];
|
|
562
|
-
|
|
563
564
|
columnDefs = Object.keys(firstRow).map(key => {
|
|
564
565
|
// Assuming rowData is an array of objects
|
|
565
566
|
const values = rowData.map(row => row[key]);
|
|
@@ -726,7 +727,6 @@ dmx.Component('ag-grid', {
|
|
|
726
727
|
else {
|
|
727
728
|
hide = undefined;
|
|
728
729
|
}
|
|
729
|
-
|
|
730
730
|
return {
|
|
731
731
|
headerName: headerName,
|
|
732
732
|
field: key,
|
|
@@ -748,6 +748,27 @@ dmx.Component('ag-grid', {
|
|
|
748
748
|
cellRenderer: cellRenderer
|
|
749
749
|
};
|
|
750
750
|
});
|
|
751
|
+
if (options.group_config && options.group_config.length > 0) {
|
|
752
|
+
groupedColumnDefs = options.group_config.map(group => {
|
|
753
|
+
const startFieldIndex = columnDefs.findIndex(colDef => colDef.field === group.start_field);
|
|
754
|
+
const endFieldIndex = columnDefs.findIndex(colDef => colDef.field === group.end_field);
|
|
755
|
+
|
|
756
|
+
if (startFieldIndex === -1 || endFieldIndex === -1 || startFieldIndex > endFieldIndex) {
|
|
757
|
+
return null;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
const groupColumns = columnDefs.slice(startFieldIndex, endFieldIndex + 1)
|
|
761
|
+
.map(col => ({
|
|
762
|
+
...col,
|
|
763
|
+
columnGroupShow: 'open'
|
|
764
|
+
}));
|
|
765
|
+
|
|
766
|
+
return {
|
|
767
|
+
headerName: group.name,
|
|
768
|
+
children: groupColumns
|
|
769
|
+
};
|
|
770
|
+
}).filter(group => group !== null);
|
|
771
|
+
}
|
|
751
772
|
}
|
|
752
773
|
window.onRowClicked = (event) => {
|
|
753
774
|
const rowData = event.data;
|
|
@@ -834,7 +855,7 @@ dmx.Component('ag-grid', {
|
|
|
834
855
|
localeText = AG_GRID_LOCALE_HE
|
|
835
856
|
}
|
|
836
857
|
const gridOptions = {
|
|
837
|
-
columnDefs: columnDefs,
|
|
858
|
+
columnDefs: (groupedColumnDefs && groupedColumnDefs.length > 0) ? groupedColumnDefs : columnDefs,
|
|
838
859
|
localeText: localeText,
|
|
839
860
|
enableRtl: options.enable_rtl,
|
|
840
861
|
noRowsOverlayComponent: '<div>No Records Found.</div>',
|