@cdmx/wappler_ag_grid 1.6.3 → 1.6.4

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
@@ -33,54 +33,52 @@ To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-cus
33
33
  4. **Case-Insensitive Sort**: Specifies if the columns are sorted in case-insensitive manner. (Default: false)
34
34
  5. **Filter**: Specifies if the column has a filter. (Default: true)
35
35
  6. **Floating Filter**: Specifies if the column has a floating filter. (Default: true)
36
- 7. **Editiable Cells**: Makes cells editable. (Default: false)
37
- 8. **Editiable Rows**: Makes row data editable. (Default: false)
38
- 9. **Exclude Hidden Fields**: Specifies if Hidden fields are to be excluded in CSV export. (Default: false)
39
- 10. **CSV Export**: Specifies if Export to CSV is enabled. (Default: true)
40
- 11. **Enable RTL**: Enabled Right to Left, used for Hebrew and Arabic. (Default: false)
41
- 12. **Column Hover Highlight**: Specifies column hover highlighting. (Default: true)
42
- 13. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
43
- 14. **Pagination**: Enables pagination. (Default: true)
44
- 15. **Auto Pagination**: Enables automatic pagination. (Default: false)
45
- 16. **Page Limit Selectors**: Allowed selectors for for page size. Set to false to hide the page size selector. (Default: [20,50,100] ).
46
- 17. **Page Limit**: Number of rows to show per page. (Default: 20)
47
- 18. **Row Selection**: Row Selection (single or multiple).
36
+ 7. **Exclude Hidden Fields**: Specifies if Hidden fields are to be excluded in CSV export. (Default: false)
37
+ 8. **CSV Export**: Specifies if Export to CSV is enabled. (Default: true)
38
+ 9. **Enable RTL**: Enabled Right to Left, used for Hebrew and Arabic. (Default: false)
39
+ 10. **Column Hover Highlight**: Specifies column hover highlighting. (Default: true)
40
+ 11. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
41
+ 12. **Pagination**: Enables pagination. (Default: true)
42
+ 13. **Auto Pagination**: Enables automatic pagination. (Default: false)
43
+ 14. **Page Limit Selectors**: Allowed selectors for for page size. Set to false to hide the page size selector. (Default: [20,50,100] ).
44
+ 15. **Page Limit**: Number of rows to show per page. (Default: 20)
45
+ 16. **Row Selection**: Row Selection (single or multiple).
48
46
  - "Single"
49
47
  - "Multiple" (Default)
50
- 19. **Timezone**: Timezone for Date Fields. Select the appropriate timezone from the dropdown list. (Default: Local)
51
- 20. **Date Format**: Date Format for displaying date values. (Default: "dd/MM/yyyy hh:mm A")
52
- 21. **Filter Field ID**: Specifies the field ID of the search field when using grid quick filter. Applicable when using Quick Filter feature of AG Grid, called from Dynamic Events on change event on the field. (Default: search_field)
53
- 22. **Loading Overlay**: This enables loading overlay. (Default: false)
54
- 23. **Loading Overlay Duration**: This sets loading overlay duration in ms. (Default: 500)
55
- 24. **Sticky Header and Horizontal Scrollbar**: Optionally specify the header offset and topbar class.
48
+ 17. **Timezone**: Timezone for Date Fields. Select the appropriate timezone from the dropdown list. (Default: Local)
49
+ 18. **Date Format**: Date Format for displaying date values. (Default: "dd/MM/yyyy hh:mm A")
50
+ 19. **Filter Field ID**: Specifies the field ID of the search field when using grid quick filter. Applicable when using Quick Filter feature of AG Grid, called from Dynamic Events on change event on the field. (Default: search_field)
51
+ 20. **Loading Overlay**: This enables loading overlay. (Default: false)
52
+ 21. **Loading Overlay Duration**: This sets loading overlay duration in ms. (Default: 500)
53
+ 22. **Sticky Header and Horizontal Scrollbar**: Optionally specify the header offset and topbar class.
56
54
  - Fixed Header: Enables sticky header. (Default: false)
57
55
  - Header Offset: Specifies offset from the top of the viewport area (Optional). (Default: 100)
58
56
  - Topbar Class: Specify class, e.g., "topbar", to measure the offset from (Optional). (Default: "topbar")
59
57
  - Topbar Offset: Specify topbar offset (Default: 80)
60
58
  - Fixed Horizontal Scroll: Enables Hovering horizontal scrollbar which stays at the bottom all the time. (Default: false)
61
59
  - Fixed Horizontal Scroll Width: Fixed horizontal scroll width percentage. (Default: 80%)
62
- 25. **Row Height**: Height of each row in pixels. (Default: Auto)
63
- 26. **Header Height**: Height of the header row in pixels. (Default: Auto)
64
- 27. **Wrap Header Text**: This will cause long headers to wrap. (Default: true)
65
- 28. **Auto Header Height**: The header height is automatically set based on the content of the header. (Default: true)
66
- 29. **Auto Height**: The height is automatically set based on the content of the cells. (Default: false)
67
- 30. **Wrap Text**: This will cause long texts to wrap in the cells. (Default: false)
68
- 31. **Center Align (V)**: Specifies if the cell data should be vertically centered. (Default: false)
69
- 32. **Suppress Row Click Selection**: Disables row selection on row click. (Default: false)
70
- 33. **Suppress Menu Hide**: Prevents hiding the column menu. (Default: false)
71
- 34. **Suppress Movable Columns**: Disables moving columns. (Default: false)
72
- 35. **Enable Cell Expressions**: Enables expressions in cell values. (Default: false)
73
- 36. **Animate Rows**: Enables row animation on data changes. (Default: false)
74
- 37. **Suppress Aggregation Function in Header**: Hides the aggregation function in column headers. (Default: false)
75
- 38. **Suppress Clipboard Paste**: Disables pasting data from the clipboard. (Default: false)
76
- 39. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
77
- 40. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
78
- 41. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
79
- 42. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
80
- 43. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
81
- 44. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
82
- 45. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
83
- 46. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
60
+ 23. **Row Height**: Height of each row in pixels. (Default: Auto)
61
+ 24. **Header Height**: Height of the header row in pixels. (Default: Auto)
62
+ 25. **Wrap Header Text**: This will cause long headers to wrap. (Default: true)
63
+ 26. **Auto Header Height**: The header height is automatically set based on the content of the header. (Default: true)
64
+ 27. **Auto Height**: The height is automatically set based on the content of the cells. (Default: false)
65
+ 28. **Wrap Text**: This will cause long texts to wrap in the cells. (Default: false)
66
+ 29. **Center Align (V)**: Specifies if the cell data should be vertically centered. (Default: false)
67
+ 30. **Suppress Row Click Selection**: Disables row selection on row click. (Default: false)
68
+ 31. **Suppress Menu Hide**: Prevents hiding the column menu. (Default: false)
69
+ 32. **Suppress Movable Columns**: Disables moving columns. (Default: false)
70
+ 33. **Enable Cell Expressions**: Enables expressions in cell values. (Default: false)
71
+ 34. **Animate Rows**: Enables row animation on data changes. (Default: false)
72
+ 35. **Suppress Aggregation Function in Header**: Hides the aggregation function in column headers. (Default: false)
73
+ 36. **Suppress Clipboard Paste**: Disables pasting data from the clipboard. (Default: false)
74
+ 37. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
75
+ 38. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
76
+ 39. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
77
+ 40. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
78
+ 41. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
79
+ 42. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
80
+ 43. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
81
+ 44. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
84
82
 
85
83
  # Data Type Overrides
86
84
 
@@ -217,6 +215,28 @@ This grid allows you to define custom column widths for specific columns. The gr
217
215
  2. **Min Width**: The minimum width for the column.
218
216
  3. **Max Width**: The maximum width for the column.
219
217
 
218
+ # Inline Editing
219
+
220
+ **Editable Fields**
221
+ Makes specific cells editable. Values should be comma-separated fields.
222
+
223
+ **Editable Cells**
224
+ Makes All cells editable. (Default: false)
225
+
226
+ **Editable Rows**
227
+ Makes Entire rows editable. (Default: false)
228
+
229
+ **Configure Selector Editors**
230
+ This enables Static and Dynamic Field selector options.
231
+
232
+ **Static Selectors**
233
+ 1. **Field**: The field name for which you want to apply selector/dropdown for.
234
+ 2. **Options**: JSON input of options for the select dropdown. e.g. {"1": "Angie", "2": "Radar"}
235
+
236
+ **Dynamic Selectors**
237
+ 1. **Field**: The field name for which you want to apply selector/dropdown for.
238
+ 2. **Options Field**: The field name which contains the options for the field data. e.g. {"1": "Angie", "2": "Radar"} supplied in a seperate field. This allows different options for every field.
239
+
220
240
  # Hide Fields and Filters
221
241
 
222
242
  The Hide Fields and Filters feature allows you to hide components such as filters and fields.
@@ -176,22 +176,6 @@
176
176
  "defaultValue": true,
177
177
  "help": "Specifies if the column has a floating filter"
178
178
  },
179
- {
180
- "name": "cellEditable",
181
- "attribute": "dmx-bind:cell_editable",
182
- "title": "Editable Cells",
183
- "type": "boolean",
184
- "defaultValue": false,
185
- "help": "Makes cells editable."
186
- },
187
- {
188
- "name": "rowEditable",
189
- "attribute": "dmx-bind:row_editable",
190
- "title": "Row Editable",
191
- "type": "boolean",
192
- "defaultValue": false,
193
- "help": "Makes entire row editable."
194
- },
195
179
  {
196
180
  "name": "exportExcludeHidden",
197
181
  "attribute": "dmx-bind:export_exclude_hidden_fields",
@@ -340,7 +324,7 @@
340
324
  "defaultValue": "dd/MM/yyyy hh:mm A",
341
325
  "help": "Date Format"
342
326
  },
343
- {
327
+ {
344
328
  "name": "quickFilterField",
345
329
  "attribute": "quick_filter_field",
346
330
  "title": "Filter Field ID",
@@ -475,7 +459,7 @@
475
459
  "defaultValue": false,
476
460
  "help": "This will cause long texts to wrap in the cells."
477
461
  },
478
- {
462
+ {
479
463
  "name": "vCenterCellData",
480
464
  "attribute": "dmx-bind:vert_center_cell_data",
481
465
  "title": "Center Align (V)",
@@ -1278,6 +1262,123 @@
1278
1262
  }
1279
1263
  ]
1280
1264
  },
1265
+ {
1266
+ "group": "📒 Inling Editing",
1267
+ "variables": [
1268
+ {
1269
+ "name": "cellsEditable",
1270
+ "attribute": "editable_fields",
1271
+ "title": "Editable Cells",
1272
+ "type": "text",
1273
+ "defaultValue": "",
1274
+ "help": "Makes Specific cells editable. Values should be comma separated fields."
1275
+ },
1276
+ {
1277
+ "name": "allCellsEditable",
1278
+ "attribute": "dmx-bind:cell_editable",
1279
+ "title": "Editable Cells",
1280
+ "type": "boolean",
1281
+ "defaultValue": false,
1282
+ "help": "Makes All cells editable."
1283
+ },
1284
+ {
1285
+ "name": "rowEditable",
1286
+ "attribute": "dmx-bind:row_editable",
1287
+ "title": "Row Editable",
1288
+ "type": "boolean",
1289
+ "defaultValue": false,
1290
+ "help": "Makes entire row editable."
1291
+ },
1292
+ {
1293
+ "name": "inlineEditorOptions",
1294
+ "title": "Configure Selector Editors",
1295
+ "attribute": "selector_options",
1296
+ "type": "boolean",
1297
+ "defaultValue": false,
1298
+ "display": "fieldset",
1299
+ "show": [
1300
+ "StaticSelectorEditors",
1301
+ "DynamicSelectorEditors"
1302
+ ],
1303
+ "noChangeOnHide": true,
1304
+ "groupEnabler": true,
1305
+ "help": "Enables Dropdown Selectors"
1306
+ "children": [
1307
+ {
1308
+ "name": "StaticSelectorEditors",
1309
+ "attribute": "dmx-bind:cstatic_select_editors",
1310
+ "title": "Static Selectors",
1311
+ "type": "grid",
1312
+ "key": "field",
1313
+ "jsonFormat": true,
1314
+ "dataBindings": true,
1315
+ "encloseBT": true,
1316
+ "jsonBT": true,
1317
+ "initDisplay": "none",
1318
+ "columns": [
1319
+ {
1320
+ "field": "field",
1321
+ "caption": "Field",
1322
+ "size": "20%",
1323
+ "editable": {
1324
+ "type": "text"
1325
+ }
1326
+ },
1327
+ {
1328
+ field: "options",
1329
+ caption: "Options",
1330
+ size: "20%",
1331
+ dataBindings: true,
1332
+ editable: {
1333
+ type: "datapicker"
1334
+ },
1335
+ help: "Static Options."
1336
+ }
1337
+ ],
1338
+ "newRecord": {
1339
+ "field": "",
1340
+ "options": ""
1341
+ }
1342
+ },
1343
+ {
1344
+ "name": "DynamicSelectorEditors",
1345
+ "attribute": "dmx-bind:cdynamic_select_editors",
1346
+ "title": "Dynamic Selectors",
1347
+ "type": "grid",
1348
+ "key": "field",
1349
+ "jsonFormat": true,
1350
+ "dataBindings": true,
1351
+ "encloseBT": true,
1352
+ "jsonBT": true,
1353
+ "initDisplay": "none",
1354
+ "columns": [
1355
+ {
1356
+ "field": "field",
1357
+ "caption": "Field",
1358
+ "size": "20%",
1359
+ "editable": {
1360
+ "type": "text"
1361
+ }
1362
+ },
1363
+ {
1364
+ field: "options_field",
1365
+ caption: "Options Field",
1366
+ size: "20%",
1367
+ "editable": {
1368
+ "type": "text"
1369
+ }
1370
+ help: "Dynamic Options using field data."
1371
+ }
1372
+ ],
1373
+ "newRecord": {
1374
+ "field": "",
1375
+ "options_field": ""
1376
+ }
1377
+ }
1378
+ ]
1379
+ }
1380
+ ]
1381
+ },
1281
1382
  {
1282
1383
  "group": "📒 Hide Fields and Filters",
1283
1384
  "variables": [
@@ -1450,7 +1551,7 @@
1450
1551
  "columnsToSum",
1451
1552
  "enableFixedFooter",
1452
1553
  "fixedFooterBottomPadding",
1453
- "columnsToCountNonUnique"
1554
+ "columnsToCountNonUnique"
1454
1555
  ],
1455
1556
  "noChangeOnHide": true,
1456
1557
  "groupEnabler": true,
@@ -1486,7 +1587,7 @@
1486
1587
  "unique_values": ""
1487
1588
  }
1488
1589
  },
1489
- {
1590
+ {
1490
1591
  "name": "columnsToCountNonUnique",
1491
1592
  "attribute": "dmx-bind:columns_to_count_nonunique",
1492
1593
  "title": "Count Non-Unique",
@@ -2422,7 +2523,7 @@
2422
2523
  state: 'opened',
2423
2524
  help: 'Get Selected Rows',
2424
2525
  properties: []
2425
- },
2526
+ },
2426
2527
  {
2427
2528
  addTitle: 'quickFilter',
2428
2529
  title: 'Quick Filter',
@@ -2886,7 +2987,7 @@
2886
2987
  "dmx-ag-grid": true
2887
2988
  }
2888
2989
  },
2889
- {
2990
+ {
2890
2991
  "name": "dmx-ag-grid-cell-edited",
2891
2992
  "attributeStartsWith": "dmx-on",
2892
2993
  "attribute": "cell_data_edited",
package/dmx-ag-grid.js CHANGED
@@ -27,6 +27,9 @@ dmx.Component('ag-grid', {
27
27
  cwidths: { type: Object, default: {} },
28
28
  ctypes: { type: Array, default: [] },
29
29
  cfilters: { type: Array, default: [] },
30
+ cstatic_select_editors: { type: Object, default: {} },
31
+ cdynamic_select_editors: { type: Object, default: {} },
32
+ cselect_placeholder: { type: String, default: "-" },
30
33
  wrap_header_text: { type: Boolean, default: true },
31
34
  auto_header_height: { type: Boolean, default: true },
32
35
  wrap_text: { type: Boolean, default: false },
@@ -70,6 +73,7 @@ dmx.Component('ag-grid', {
70
73
  min_width: { type: Number, default: 150 },
71
74
  sortable: { type: Boolean, default: true },
72
75
  cell_editable: { type: Boolean, default: false },
76
+ editable_fields: { type: String, default: null },
73
77
  row_editable: { type: Boolean, default: false },
74
78
  ci_sort: { type: Boolean, default: false },
75
79
  resizable: { type: Boolean, default: true },
@@ -999,8 +1003,11 @@ dmx.Component('ag-grid', {
999
1003
  let minWidth;
1000
1004
  let hide;
1001
1005
  let type;
1002
- let colId;
1003
1006
  let sortable;
1007
+ let cellEditor;
1008
+ let cellEditorParams;
1009
+ let valueParser;
1010
+ let editable;
1004
1011
 
1005
1012
  if (dataType === 'number') {
1006
1013
  filter = 'agNumberColumnFilter';
@@ -1166,6 +1173,59 @@ dmx.Component('ag-grid', {
1166
1173
  else {
1167
1174
  hide = undefined;
1168
1175
  }
1176
+ if (options.editable_fields) {
1177
+ const editableCellsArray = options.editable_fields.split(',');
1178
+ if (editableCellsArray.includes(key)) {
1179
+ editable = true;
1180
+ }
1181
+ }
1182
+ function lookupKey(mappings, name) {
1183
+ const keys = Object.keys(mappings);
1184
+ for (let i = 0; i < keys.length; i++) {
1185
+ const key = keys[i];
1186
+ if (mappings[key] === name) {
1187
+ return key;
1188
+ }
1189
+ }
1190
+ }
1191
+ function lookupValue(mappings, key) {
1192
+ if (key==''||key === undefined){
1193
+ return options.cselect_placeholder
1194
+ }
1195
+ return mappings[key];
1196
+ }
1197
+ if (options.cdynamic_select_editors.hasOwnProperty(key) || options.cstatic_select_editors.hasOwnProperty(key)) {
1198
+ editable = true;
1199
+ cellEditor = 'agSelectCellEditor';
1200
+ valueFormatter = (params) => {
1201
+ const selectedNode = params.api.getSelectedNodes()[0];
1202
+ const dynamicOptions = options.cdynamic_select_editors[key];
1203
+ const staticOptions = options.cstatic_select_editors[key];
1204
+ let selectOptions;
1205
+ if (dynamicOptions && params.data) {
1206
+ selectOptions = params.data[dynamicOptions.options_field];
1207
+ } else if (staticOptions) {
1208
+ if (!staticOptions.parsedOptions) {
1209
+ staticOptions.parsedOptions = JSON.parse(staticOptions.options);
1210
+ }
1211
+ selectOptions = staticOptions.parsedOptions;
1212
+ } else {
1213
+ selectOptions = selectedNode?.data[dynamicOptions.options_field];
1214
+ }
1215
+ return lookupValue(selectOptions, params.value);
1216
+ };
1217
+ valueParser = (params) => {
1218
+ return lookupKey(selectOptions, params.newValue);
1219
+ }
1220
+ cellEditorParams = (params) => {
1221
+ const editorOptions = options.cdynamic_select_editors[key] ?
1222
+ params.data[options.cdynamic_select_editors[key].options_field] :
1223
+ JSON.parse(options.cstatic_select_editors[key].options);
1224
+ return {
1225
+ values: Object.keys(editorOptions)
1226
+ };
1227
+ };
1228
+ }
1169
1229
  return {
1170
1230
  headerName: headerName,
1171
1231
  field: key,
@@ -1175,6 +1235,7 @@ dmx.Component('ag-grid', {
1175
1235
  minWidth: minWidth,
1176
1236
  hide: hide,
1177
1237
  type: type,
1238
+ editable: editable,
1178
1239
  sortable: sortable,
1179
1240
  filterValueGetter: filterValueGetter,
1180
1241
  filterParams: filterParams,
@@ -1185,7 +1246,10 @@ dmx.Component('ag-grid', {
1185
1246
  minWidth: parseInt(cwidths[key].min_width),
1186
1247
  maxWidth: parseInt(cwidths[key].max_width),
1187
1248
  }),
1188
- cellRenderer: cellRenderer
1249
+ cellRenderer: cellRenderer,
1250
+ cellEditor: cellEditor,
1251
+ cellEditorParams: cellEditorParams,
1252
+ valueParser: valueParser
1189
1253
  };
1190
1254
  });
1191
1255
  if (options.group_config && options.group_config.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",