@cdmx/wappler_ag_grid 0.8.5 → 0.8.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.
@@ -1153,26 +1153,41 @@
1153
1153
  "display": "fieldset",
1154
1154
  "show": [
1155
1155
  "columnsToCount",
1156
- "columnValueMatchCount",
1157
1156
  "columnsToSum"
1158
1157
  ],
1159
1158
  "noChangeOnHide": true,
1160
1159
  "groupEnabler": true,
1161
1160
  "help": "Define the Columns to Count and Sum in the Footer row"
1162
1161
  "children": [
1163
- {
1164
- "name": "columnsToCount",
1165
- "attribute": "columns_to_count",
1166
- "title": "Columns To Count",
1167
- "type": "text",
1168
- "initDisplay": "none"
1169
- },
1170
- {
1171
- "name": "columnValueMatchCount",
1172
- "attribute": "column_value_match_count",
1173
- "title": "Unique Value To Count",
1174
- "type": "text",
1175
- "initDisplay": "none"
1162
+ {
1163
+ "name": "columnsToCount",
1164
+ "attribute": "columns_to_count",
1165
+ "title": "Columns to Count",
1166
+ "type": "grid",
1167
+ "jsonFormat": true,
1168
+ "encloseBT": true,
1169
+ "jsonBT": true,
1170
+ "initDisplay": "none",
1171
+ "columns": [
1172
+ {
1173
+ "field": "field",
1174
+ "caption": "Field",
1175
+ "editable": {
1176
+ "type": "text"
1177
+ }
1178
+ },
1179
+ {
1180
+ field: "unique_values",
1181
+ caption: "Unique Values",
1182
+ editable: {
1183
+ type: "text"
1184
+ }
1185
+ }
1186
+ ],
1187
+ "newRecord": {
1188
+ "field": "",
1189
+ "unique_values": ""
1190
+ }
1176
1191
  },
1177
1192
  {
1178
1193
  "name": "columnsToSum",
@@ -1266,14 +1281,14 @@
1266
1281
  "attribute": "edit_action_tooltip",
1267
1282
  "title": "Edit Action Button Tooltip",
1268
1283
  "type": "text",
1269
- "defaultValue": ''
1284
+ "defaultValue": 'Edit'
1270
1285
  },
1271
1286
  {
1272
1287
  "name": "editActionBtnClass",
1273
1288
  "attribute": "edit_action_btn_class",
1274
1289
  "title": "Edit Action Button Class",
1275
1290
  "type": "text",
1276
- "defaultValue": 'btn-primary btn-xs'
1291
+ "defaultValue": 'btn-primary btn-xs m-1'
1277
1292
  },
1278
1293
  {
1279
1294
  "name": "editActionIconClass",
@@ -1301,14 +1316,14 @@
1301
1316
  "attribute": "view_action_tooltip",
1302
1317
  "title": "View Action Button Tooltip",
1303
1318
  "type": "text",
1304
- "defaultValue": ''
1319
+ "defaultValue": 'View'
1305
1320
  },
1306
1321
  {
1307
1322
  "name": "viewActionBtnClass",
1308
1323
  "attribute": "view_action_btn_class",
1309
1324
  "title": "View Action Button Class",
1310
1325
  "type": "text",
1311
- "defaultValue": 'btn-info btn-xs'
1326
+ "defaultValue": 'btn-info btn-xs m-1'
1312
1327
  },
1313
1328
  {
1314
1329
  "name": "viewActionIconClass",
@@ -1336,14 +1351,14 @@
1336
1351
  "attribute": "delete_action_tooltip",
1337
1352
  "title": "Delete Action Button Tooltip",
1338
1353
  "type": "text",
1339
- "defaultValue": ''
1354
+ "defaultValue": 'Delete'
1340
1355
  },
1341
1356
  {
1342
1357
  "name": "deleteActionBtnClass",
1343
1358
  "attribute": "delete_action_btn_class",
1344
1359
  "title": "Delete Action Button Class",
1345
1360
  "type": "text",
1346
- "defaultValue": 'btn-danger btn-xs'
1361
+ "defaultValue": 'btn-danger btn-xs m-1'
1347
1362
  },
1348
1363
  {
1349
1364
  "name": "deleteActionIconClass",
@@ -1452,7 +1467,7 @@
1452
1467
  "attribute": "button1_action_btn_class",
1453
1468
  "title": "Button1 Class",
1454
1469
  "type": "text",
1455
- "defaultValue": "btn-primary btn-xs"
1470
+ "defaultValue": "btn-primary btn-xs m-1"
1456
1471
  },
1457
1472
  {
1458
1473
  "name": "button1ActionIconClass",
@@ -1487,7 +1502,7 @@
1487
1502
  "attribute": "button2_action_btn_class",
1488
1503
  "title": "Button2 Class",
1489
1504
  "type": "text",
1490
- "defaultValue": "btn-info btn-xs"
1505
+ "defaultValue": "btn-info btn-xs m-1"
1491
1506
  },
1492
1507
  {
1493
1508
  "name": "button2ActionIconClass",
@@ -1522,7 +1537,7 @@
1522
1537
  "attribute": "button3_action_btn_class",
1523
1538
  "title": "Button3 Class",
1524
1539
  "type": "text",
1525
- "defaultValue": "btn-success btn-xs"
1540
+ "defaultValue": "btn-success btn-xs m-1"
1526
1541
  },
1527
1542
  {
1528
1543
  "name": "button3ActionIconClass",
@@ -1557,7 +1572,7 @@
1557
1572
  "attribute": "button4_action_btn_class",
1558
1573
  "title": "Button4 Class",
1559
1574
  "type": "text",
1560
- "defaultValue": "btn-warning btn-xs"
1575
+ "defaultValue": "btn-warning btn-xs m-1"
1561
1576
  },
1562
1577
  {
1563
1578
  "name": "button4ActionIconClass",
@@ -1592,7 +1607,7 @@
1592
1607
  "attribute": "button5_action_btn_class",
1593
1608
  "title": "Button5 Class",
1594
1609
  "type": "text",
1595
- "defaultValue": "btn-danger btn-xs"
1610
+ "defaultValue": "btn-danger btn-xs m-1"
1596
1611
  },
1597
1612
  {
1598
1613
  "name": "button5ActionIconClass",
@@ -1627,7 +1642,7 @@
1627
1642
  "attribute": "button6_action_btn_class",
1628
1643
  "title": "Button6 Class",
1629
1644
  "type": "text",
1630
- "defaultValue": "btn-secondary btn-xs"
1645
+ "defaultValue": "btn-secondary btn-xs m-1"
1631
1646
  },
1632
1647
  {
1633
1648
  "name": "button6ActionIconClass",
@@ -1662,7 +1677,7 @@
1662
1677
  "attribute": "button7_action_btn_class",
1663
1678
  "title": "Button7 Class",
1664
1679
  "type": "text",
1665
- "defaultValue": "btn-primary btn-xs"
1680
+ "defaultValue": "btn-primary btn-xs m-1"
1666
1681
  },
1667
1682
  {
1668
1683
  "name": "button7ActionIconClass",
@@ -1697,7 +1712,7 @@
1697
1712
  "attribute": "button8_action_btn_class",
1698
1713
  "title": "Button8 Class",
1699
1714
  "type": "text",
1700
- "defaultValue": "btn-info btn-xs"
1715
+ "defaultValue": "btn-info btn-xs m-1"
1701
1716
  },
1702
1717
  {
1703
1718
  "name": "button8ActionIconClass",
@@ -1732,7 +1747,7 @@
1732
1747
  "attribute": "button9_action_btn_class",
1733
1748
  "title": "Button9 Class",
1734
1749
  "type": "text",
1735
- "defaultValue": "btn-success btn-xs"
1750
+ "defaultValue": "btn-success btn-xs m-1"
1736
1751
  },
1737
1752
  {
1738
1753
  "name": "button9ActionIconClass",
@@ -1767,7 +1782,7 @@
1767
1782
  "attribute": "button10_action_btn_class",
1768
1783
  "title": "Button10 Class",
1769
1784
  "type": "text",
1770
- "defaultValue": "btn-danger btn-xs"
1785
+ "defaultValue": "btn-danger btn-xs m-1"
1771
1786
  },
1772
1787
  {
1773
1788
  "name": "button10ActionIconClass",
package/dmx-ag-grid.js CHANGED
@@ -71,48 +71,48 @@ dmx.Component('ag-grid', {
71
71
  edit_action_title: {type: String, default: '' },
72
72
  edit_action_tooltip: {type: String, default: 'Edit' },
73
73
  edit_action_icon_class: {type: String, default: 'fas fa-pencil-alt' },
74
- edit_action_btn_class: {type: String, default: 'btn-primary btn-xs' },
74
+ edit_action_btn_class: {type: String, default: 'btn-primary btn-xs m-1' },
75
75
  view_action_btn: { type: Boolean, default: false },
76
76
  view_action_title: {type: String, default: '' },
77
77
  view_action_tooltip: {type: String, default: 'View' },
78
78
  view_action_icon_class: {type: String, default: 'fas fa-eye' },
79
- view_action_btn_class: {type: String, default: 'btn-info btn-xs' },
79
+ view_action_btn_class: {type: String, default: 'btn-info btn-xs m-1' },
80
80
  delete_action_btn: { type: Boolean, default: false },
81
81
  delete_action_title: {type: String, default: '' },
82
82
  delete_action_tooltip: {type: String, default: 'Delete' },
83
83
  delete_action_icon_class: {type: String, default: 'fas fa-trash' },
84
- delete_action_btn_class: {type: String, default: 'btn-danger btn-xs' },
84
+ delete_action_btn_class: {type: String, default: 'btn-danger btn-xs m-1' },
85
85
  enable_custom_action_btns: { type: Boolean, default: false },
86
86
  button1_action_btn: { type: "Boolean", default: false },
87
87
  button1_action_title: { type: "String", default: "" },
88
88
  button1_action_tooltip: { type: "String", default: "" },
89
89
  button1_action_icon_class: { type: "String", default: "fas fa-wrench" },
90
- button1_action_btn_class: { type: "String", default: "btn-primary btn-xs" },
90
+ button1_action_btn_class: { type: "String", default: "btn-primary btn-xs m-1" },
91
91
  button2_action_btn: { type: "Boolean", default: false },
92
92
  button2_action_title: { type: "String", default: "" },
93
93
  button2_action_tooltip: { type: "String", default: "" },
94
94
  button2_action_icon_class: { type: "String", default: "fas fa-search-plus" },
95
- button2_action_btn_class: { type: "String", default: "btn-info btn-xs" },
95
+ button2_action_btn_class: { type: "String", default: "btn-info btn-xs m-1" },
96
96
  button3_action_btn: { type: "Boolean", default: false },
97
97
  button3_action_title: { type: "String", default: "" },
98
98
  button3_action_tooltip: { type: "String", default: "" },
99
99
  button3_action_icon_class: { type: "String", default: "fas fa-check-circle" },
100
- button3_action_btn_class: { type: "String", default: "btn-success btn-xs" },
100
+ button3_action_btn_class: { type: "String", default: "btn-success btn-xs m-1" },
101
101
  button4_action_btn: { type: "Boolean", default: false },
102
102
  button4_action_title: { type: "String", default: "" },
103
103
  button4_action_tooltip: { type: "String", default: "" },
104
104
  button4_action_icon_class: { type: "String", default: "fas fa-exclamation-triangle" },
105
- button4_action_btn_class: { type: "String", default: "btn-warning btn-xs" },
105
+ button4_action_btn_class: { type: "String", default: "btn-warning btn-xs m-1" },
106
106
  button5_action_btn: { type: "Boolean", default: false },
107
107
  button5_action_title: { type: "String", default: "" },
108
108
  button5_action_tooltip: { type: "String", default: "Edit" },
109
109
  button5_action_icon_class: { type: "String", default: "fas fa-times-circle" },
110
- button5_action_btn_class: { type: "String", default: "btn-danger btn-xs" },
110
+ button5_action_btn_class: { type: "String", default: "btn-danger btn-xs m-1" },
111
111
  button6_action_btn: { type: "Boolean", default: false },
112
112
  button6_action_title: { type: "String", default: "" },
113
113
  button6_action_tooltip: { type: "String", default: "" },
114
114
  button6_action_icon_class: { type: "String", default: "fas fa-link" },
115
- button6_action_btn_class: { type: "String", default: "btn-secondary btn-xs" },
115
+ button6_action_btn_class: { type: "String", default: "btn-secondary btn-xs m-1" },
116
116
  button7_action_btn: { type: "Boolean", default: false },
117
117
  button7_action_title: { type: "String", default: "" },
118
118
  button7_action_tooltip: { type: "String", default: "" },
@@ -122,17 +122,17 @@ dmx.Component('ag-grid', {
122
122
  button8_action_title: { type: "String", default: "" },
123
123
  button8_action_tooltip: { type: "String", default: "" },
124
124
  button8_action_icon_class: { type: "String", default: "fas fa-file-pdf" },
125
- button8_action_btn_class: { type: "String", default: "btn-info btn-xs" },
125
+ button8_action_btn_class: { type: "String", default: "btn-info btn-xs m-1" },
126
126
  button9_action_btn: { type: "Boolean", default: false },
127
127
  button9_action_title: { type: "String", default: "" },
128
128
  button9_action_tooltip: { type: "String", default: "" },
129
129
  button9_action_icon_class: { type: "String", default: "fas fa-star" },
130
- button9_action_btn_class: { type: "String", default: "btn-success btn-xs" },
130
+ button9_action_btn_class: { type: "String", default: "btn-success btn-xs m-1" },
131
131
  button10_action_btn: { type: "Boolean", default: false },
132
132
  button10_action_title: { type: "String", default: "" },
133
133
  button10_action_tooltip: { type: "String", default: "" },
134
134
  button10_action_icon_class: { type: "String", default: "fas fa-trash-alt" },
135
- button10_action_btn_class: { type: "String", default: "btn-danger btn-xs" },
135
+ button10_action_btn_class: { type: "String", default: "btn-danger btn-xs m-1" },
136
136
  data_binded_changes: {type: Array, default: [] },
137
137
  hide_fields: {type: String, default: null },
138
138
  hide_filters: {type: String, default: null },
@@ -141,8 +141,7 @@ dmx.Component('ag-grid', {
141
141
  compact_view_grid_size: { type: Number, default: 3 },
142
142
  compact_view_item_height: { type: Number, default: 20 },
143
143
  group_config: { type: Array, default: [] },
144
- columns_to_count: { type: String, default: null },
145
- column_value_match_count: { type: String, default: null },
144
+ columns_to_count: { type: Array, default: [] },
146
145
  columns_to_sum: { type: String, default: null }
147
146
  },
148
147
 
@@ -1003,7 +1002,7 @@ dmx.Component('ag-grid', {
1003
1002
  actionsRenderer: actionsRenderer
1004
1003
  }
1005
1004
  };
1006
- const totalRow = function (api, columnsToSum, columnsToCount, columnValueMatchCount) {
1005
+ const totalRow = function (api, columnsToSum, columnsToCount) {
1007
1006
  if (!columnsToSum && !columnsToCount) {
1008
1007
  return;
1009
1008
  }
@@ -1026,38 +1025,26 @@ dmx.Component('ag-grid', {
1026
1025
  }
1027
1026
 
1028
1027
  if (columnsToCount) {
1029
- if (columnValueMatchCount) {
1030
- // Count unique entries for a specific column
1031
- columnsToCount.forEach(function (col) {
1032
- result[0][col] = 0;
1033
- rowData.forEach(function (line) {
1034
- if (line.index < rowData.length) {
1035
- const value = line.data[col];
1036
- if (value == columnValueMatchCount) {
1037
- result[0][col]++;
1038
- }
1039
- }
1040
- });
1041
- });
1042
- }
1043
- else {
1044
- // Initialize and calculate count columns
1045
- columnsToCount.forEach(function (col) {
1028
+ columnsToCount.forEach(function (colObj) {
1029
+ const col = colObj.field;
1030
+ const uniqueValuesToCount = colObj.unique_values.split(',');
1031
+
1046
1032
  result[0][col] = 0;
1047
1033
  let uniqueValues = new Set();
1034
+
1048
1035
  rowData.forEach(function (line) {
1049
1036
  if (line.index < rowData.length) {
1050
1037
  const value = line.data[col];
1051
- if (!uniqueValues.has(value)) {
1038
+ if (uniqueValuesToCount.includes(value) && !uniqueValues.has(value)) {
1052
1039
  uniqueValues.add(value);
1053
1040
  result[0][col]++;
1054
1041
  }
1055
1042
  }
1056
1043
  });
1044
+
1057
1045
  result[0][col + '_unique_count'] = uniqueValues.size;
1058
1046
  });
1059
1047
  }
1060
- }
1061
1048
  api.setPinnedBottomRowData(result);
1062
1049
  }
1063
1050
 
@@ -1079,19 +1066,18 @@ dmx.Component('ag-grid', {
1079
1066
  ...gridOptions
1080
1067
  };
1081
1068
  // Conditionally add event listeners based on whether columnsToSum or columnsToCount are defined
1082
- if ((options.columns_to_sum && options.columns_to_sum.split(',').length > 0) || (options.columns_to_count && options.columns_to_count.split(',').length > 0)) {
1069
+ if ((options.columns_to_sum && options.columns_to_sum.split(',').length > 0) || (options.columns_to_count.length > 0)) {
1083
1070
  let columnsToSum = options.columns_to_sum ? options.columns_to_sum.split(',') : [];
1084
- let columnsToCount = options.columns_to_count ? options.columns_to_count.split(',') : [];
1085
- let columnValueMatchCount = options.column_value_match_count
1071
+ let columnsToCount = options.columns_to_count;
1086
1072
 
1087
1073
  gridConfig.onFilterChanged = function (e) {
1088
- totalRow(e.api, columnsToSum, columnsToCount, columnValueMatchCount);
1074
+ totalRow(e.api, columnsToSum, columnsToCount);
1089
1075
  };
1090
1076
  gridConfig.onFirstDataRendered = function (e) {
1091
- totalRow(e.api, columnsToSum, columnsToCount, columnValueMatchCount);
1077
+ totalRow(e.api, columnsToSum, columnsToCount);
1092
1078
  };
1093
1079
  gridConfig.postSortRows = function (e) {
1094
- totalRow(e.api, columnsToSum, columnsToCount,columnValueMatchCount);
1080
+ totalRow(e.api, columnsToSum, columnsToCount);
1095
1081
  };
1096
1082
  }
1097
1083
  // Create ag-Grid instance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",