@cdmx/wappler_ag_grid 1.0.0 → 1.0.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 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": [
@@ -1972,6 +2040,10 @@
1972
2040
  "src": "../../../node_modules/ag-grid-community/styles/ag-theme-material.css",
1973
2041
  "dst": "css/ag-theme-material.css"
1974
2042
  },
2043
+ {
2044
+ "src": "../../../node_modules/moment/min/moment.min.js",
2045
+ "dst": "js/moment.min.js"
2046
+ },
1975
2047
  {
1976
2048
  "src": "ag-theme-custom.css",
1977
2049
  "dst": "css/ag-theme-custom.css"
@@ -2010,6 +2082,11 @@
2010
2082
  "type": "js",
2011
2083
  "defer": true
2012
2084
  },
2085
+ {
2086
+ "src": "js/moment.min.js",
2087
+ "type": "js",
2088
+ "defer": true
2089
+ },
2013
2090
  {
2014
2091
  "src": "js/locale/he.js",
2015
2092
  "type": "js",
@@ -2075,6 +2152,38 @@
2075
2152
  "dmx-ag-grid": true
2076
2153
  }
2077
2154
  },
2155
+ {
2156
+ "name": "dmx-ag-grid-cfilters",
2157
+ "attributeStartsWith": "dmx-bind",
2158
+ "attribute": "cfilters",
2159
+ "title": "Custom Filters",
2160
+ "type": "boolean",
2161
+ "display": "fieldset",
2162
+ "icon": "fa fa-lg fa-chevron-right",
2163
+ "groupTitle": "Grid Config",
2164
+ "groupIcon": "fa fa-lg fa-cubes",
2165
+ "defaultValue": false,
2166
+ "show": ["setCustomFilters"],
2167
+ "noChangeOnHide": true,
2168
+ "groupEnabler": true,
2169
+ "children": [
2170
+ {
2171
+ "name": "setCustomFilters",
2172
+ "attributeStartsWith": "dmx-bind",
2173
+ "attribute": "cfilters",
2174
+ "isValue": true,
2175
+ "dataBindings": true,
2176
+ "title": "Custom Filters:",
2177
+ "type": "text",
2178
+ "help": "Edit Custom Filters.",
2179
+ "defaultValue": "",
2180
+ "initDisplay": "none"
2181
+ }
2182
+ ],
2183
+ "allowedOn": {
2184
+ "dmx-ag-grid": true
2185
+ }
2186
+ },
2078
2187
  {
2079
2188
  "name": "dmx-ag-grid-pagination-page-size",
2080
2189
  "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.2",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",
@@ -16,6 +16,7 @@
16
16
  "dependencies": {
17
17
  "ag-grid-community": "30.1.x",
18
18
  "exceljs": "4.3.x",
19
+ "moment": "2.29.x",
19
20
  "papaparse": "5.4.x"
20
21
  },
21
22
  "scripts": {