@cdmx/wappler_ag_grid 1.0.0 → 1.0.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 CHANGED
@@ -204,6 +204,19 @@ Configuration includes:
204
204
 
205
205
  ---
206
206
 
207
+ ### Set Filters
208
+
209
+ The "Set Filters" feature allows you to enable the setting of filters for columns in a user interface. This feature allows to preset filters when the grid is rendered.
210
+
211
+ Configuration includes:
212
+ - **Set Filters**: Toggle to enable or disable the feature. When enabled, users can set filters for columns. (Default: false)
213
+ - **Custom Filters**: A grid that allows you to define custom filters.
214
+ - **Field**: The column name to filter.
215
+ - **Filter Type**: The type of filter to apply, options available are: "Starts With," "Less Than," "Date From," "Greater Than," "Equals," and "Contains."
216
+ - **Filter Value**: The Value/Filter to be applied.
217
+
218
+ ---
219
+
207
220
  # Configure Actions Column
208
221
  The Configure Actions Column feature allows you to configure actions for the buttons in the Actions Column.
209
222
 
@@ -1231,6 +1231,74 @@
1231
1231
  }
1232
1232
  ]
1233
1233
  },
1234
+ {
1235
+ "group": "📒 Set Filters",
1236
+ "variables": [
1237
+ {
1238
+ "name": "setFilters",
1239
+ "title": "Set Filters",
1240
+ "attributeStartsWith": "dmx-bind",
1241
+ "attribute": "set_filters",
1242
+ "type": "boolean",
1243
+ "defaultValue": false,
1244
+ "display": "fieldset",
1245
+ "show": ["listCustomFilters"],
1246
+ "noChangeOnHide": true,
1247
+ "groupEnabler": true,
1248
+ "help": "Allows setting filters for columns",
1249
+ "children": [
1250
+ {
1251
+ "name": "listCustomFilters",
1252
+ "attribute": "dmx-bind:cfilters",
1253
+ "title": "Custom Filters",
1254
+ "type": "grid",
1255
+ "jsonFormat": true,
1256
+ "dataBindings": true,
1257
+ "encloseBT": true,
1258
+ "jsonBT": true,
1259
+ "initDisplay": "none",
1260
+ "columns": [
1261
+ {
1262
+ "field": "field",
1263
+ "caption": "Field",
1264
+ "editable": {
1265
+ "type": "text"
1266
+ }
1267
+ },
1268
+ {
1269
+ "field": "type",
1270
+ "caption": "Filter Type",
1271
+ "editable": {
1272
+ "type": "list",
1273
+ "items": [
1274
+ {"id": "startsWith", "text": "Starts With"},
1275
+ {"id": "lessThan", "text": "Less Than"},
1276
+ {"id": "dateFrom", "text": "Date From"},
1277
+ {"id": "greaterThan", "text": "Greater Than"},
1278
+ {"id": "equals", "text": "Equals"},
1279
+ {"id": "contains", "text": "Contains"}
1280
+ ]
1281
+ }
1282
+ "help": "Filter type: startsWith, lessThan, dateFrom, etc."
1283
+ },
1284
+ {
1285
+ "field": "filter",
1286
+ "caption": "Filter Value",
1287
+ "editable": {
1288
+ "type": "text"
1289
+ }
1290
+ }
1291
+ ],
1292
+ "newRecord": {
1293
+ "field": "",
1294
+ "type": "Contains",
1295
+ "filter": ""
1296
+ }
1297
+ }
1298
+ ]
1299
+ }
1300
+ ]
1301
+ },
1234
1302
  {
1235
1303
  "group": "📒 Configure Actions Column",
1236
1304
  "variables": [
@@ -2075,6 +2143,38 @@
2075
2143
  "dmx-ag-grid": true
2076
2144
  }
2077
2145
  },
2146
+ {
2147
+ "name": "dmx-ag-grid-cfilters",
2148
+ "attributeStartsWith": "dmx-bind",
2149
+ "attribute": "cfilters",
2150
+ "title": "Custom Filters",
2151
+ "type": "boolean",
2152
+ "display": "fieldset",
2153
+ "icon": "fa fa-lg fa-chevron-right",
2154
+ "groupTitle": "Grid Config",
2155
+ "groupIcon": "fa fa-lg fa-cubes",
2156
+ "defaultValue": false,
2157
+ "show": ["setCustomFilters"],
2158
+ "noChangeOnHide": true,
2159
+ "groupEnabler": true,
2160
+ "children": [
2161
+ {
2162
+ "name": "setCustomFilters",
2163
+ "attributeStartsWith": "dmx-bind",
2164
+ "attribute": "cfilters",
2165
+ "isValue": true,
2166
+ "dataBindings": true,
2167
+ "title": "Custom Filters:",
2168
+ "type": "text",
2169
+ "help": "Edit Custom Filters.",
2170
+ "defaultValue": "",
2171
+ "initDisplay": "none"
2172
+ }
2173
+ ],
2174
+ "allowedOn": {
2175
+ "dmx-ag-grid": true
2176
+ }
2177
+ },
2078
2178
  {
2079
2179
  "name": "dmx-ag-grid-pagination-page-size",
2080
2180
  "attributeStartsWith": "dmx-bind",
package/dmx-ag-grid.js CHANGED
@@ -19,6 +19,7 @@ dmx.Component('ag-grid', {
19
19
  cnames: { type: Object, default: {} },
20
20
  cwidths: { type: Object, default: {} },
21
21
  ctypes: { type: Array, default: [] },
22
+ cfilters: { type: Array, default: [] },
22
23
  data_changes: { type: Array, default: [] },
23
24
  data: { type: Array, default: [] },
24
25
  dom_layout: { type: String, default: 'autoHeight' },
@@ -1236,6 +1237,20 @@ dmx.Component('ag-grid', {
1236
1237
  }
1237
1238
  // Create ag-Grid instance
1238
1239
  gridInstance = new agGrid.Grid(gridDiv, gridConfig);
1240
+
1241
+ if (options.cfilters && options.cfilters.length > 0) {
1242
+ var filterModel = {};
1243
+ const customFilters = options.cfilters
1244
+ customFilters.forEach(function (customFilter) {
1245
+ filterModel[customFilter.field] = {
1246
+ type: customFilter.type,
1247
+ filter: customFilter.filter
1248
+ };
1249
+ });
1250
+ gridInstance.gridOptions.api.setFilterModel(filterModel);
1251
+ gridInstance.gridOptions.api.onFilterChanged();
1252
+ }
1253
+
1239
1254
  const gridElement = document.getElementById(options.id+'-grid');
1240
1255
  if (options.compact_view) {
1241
1256
  gridElement.style.setProperty('--ag-grid-size', `${options.compact_view_grid_size}`+'px');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",