@cdmx/wappler_ag_grid 2.1.9 → 2.1.10

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/CHANGELOG.md CHANGED
@@ -9,9 +9,9 @@ value is a JSON array/object are matched against their JSON text. Fixes "contain
9
9
  columns (e.g. Monitoring Results / Screening Results) returning no rows.
10
10
 
11
11
  ### Changes Made
12
- 1. **`dmx-ag-grid.js`** - `js_data_changes` columns get a `filterValueGetter` that runs the render function
13
- and strips tags via `removeHtmlTags` (now a hoisted function declaration); the shared filter value getter
14
- stringifies object/array values.
12
+ 1. **`dmx-ag-grid.js`** - text-type `js_data_changes` columns get a `filterValueGetter` that runs the render
13
+ function and strips tags via `removeHtmlTags` (now a hoisted function declaration); number/date columns keep
14
+ the raw value for their comparison filters. The shared filter value getter stringifies object/array values.
15
15
  2. **`tests/13-flags-styles.html`**, **`tests/data/sample-data.js`** - `jsFilterGrid` scenario with a
16
16
  `transactions` fixture and page assertions for column + quick filters.
17
17
 
package/README.md CHANGED
@@ -408,7 +408,7 @@ ex: jsChanges.
408
408
  }
409
409
  </script>
410
410
  ```
411
- Column filters, the floating filter row and the quick filter match the text this function renders (HTML tags removed, `<br>` treated as a line break), so searching for a word that is visible in the cell finds the row. Columns whose raw value is a JSON array/object are matched against their JSON text.
411
+ Column filters, the floating filter row and the quick filter match the text this function renders (HTML tags removed, `<br>` treated as a line break), so searching for a word that is visible in the cell finds the row. This applies to text columns; number and date columns keep filtering on their raw value. Columns whose raw value is a JSON array/object are matched against their JSON text.
412
412
 
413
413
  ---
414
414
  # Custom Headers
package/dmx-ag-grid.js CHANGED
@@ -1542,14 +1542,18 @@ dmx.Component('ag-grid', {
1542
1542
  }
1543
1543
  // ponytail: filter on what the user sees - renderer output with tags stripped.
1544
1544
  // Covers column/floating filters, quick filter, applyFilters and cfilters (all read filterValueGetter).
1545
- const baseFilterValueGetter = filterValueGetter;
1546
- filterValueGetter = (params) => {
1547
- const fn = window[matchingJsChange.function];
1548
- if (typeof fn !== 'function' || !params.data) {
1549
- return baseFilterValueGetter ? baseFilterValueGetter(params) : undefined;
1550
- }
1551
- return removeHtmlTags(fn(params.data));
1552
- };
1545
+ // Text columns only: number/date filters compare the raw value, so they keep the base getter.
1546
+ if (dataType === 'text') {
1547
+ const baseFilterValueGetter = filterValueGetter;
1548
+ filterValueGetter = (params) => {
1549
+ const fn = window[matchingJsChange.function];
1550
+ const rendered = (typeof fn === 'function' && params.data) ? fn(params.data) : undefined;
1551
+ if (typeof rendered !== 'string') {
1552
+ return baseFilterValueGetter ? baseFilterValueGetter(params) : undefined;
1553
+ }
1554
+ return removeHtmlTags(rendered);
1555
+ };
1556
+ }
1553
1557
  }
1554
1558
  else {
1555
1559
  cellRenderer = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid v35 - Advanced data grid with enhanced editing, filtering, and tree data capabilities.",
6
6
  "license": "MIT",
@@ -29,3 +29,4 @@
29
29
  "publish-dry-run": "npm publish ./dist --access public --dry-run"
30
30
  }
31
31
  }
32
+
@@ -244,7 +244,8 @@
244
244
  <p class="desc">
245
245
  <code>monitoring_results</code> / <code>screening_results</code> are JSON lists rendered by
246
246
  <code>js_data_changes</code> functions (one entry per line via <code>&lt;br&gt;</code>). Since 2.1.9 the
247
- column filters, <code>applyFilters</code> and the quick filter match the rendered text, not the raw array.
247
+ column filters, <code>applyFilters</code> and the quick filter match the rendered text, not the raw array
248
+ (text columns only: <code>amount</code> also has a JS renderer and must keep its number filter).
248
249
  Try typing <code>PAYOUT</code> in a floating filter or the quick filter box.
249
250
  </p>
250
251
  <input type="search" id="jsqf" placeholder="Quick filter…" oninput="document.getElementById('jsFilterGrid').dmxComponent.get('gridInstance').setGridOption('quickFilterText', this.value)">
@@ -254,7 +255,7 @@
254
255
  dmx-bind:data="txns.value"
255
256
  grid_theme="ag-theme-alpine"
256
257
  quick_filter_field="jsqf"
257
- dmx-bind:js_data_changes="[{field:'monitoring_results', function:'renderMonitoring'},{field:'screening_results', function:'renderScreening'}]"
258
+ dmx-bind:js_data_changes="[{field:'monitoring_results', function:'renderMonitoring'},{field:'screening_results', function:'renderScreening'},{field:'amount', function:'renderAmount'}]"
258
259
  dmx-bind:pagination="false">
259
260
  </dmx-ag-grid>
260
261
  </div>
@@ -275,6 +276,8 @@
275
276
  // js_data_changes renderers for jsFilterGrid: JSON lists -> one entry per line.
276
277
  window.renderMonitoring = data => (data.monitoring_results || []).map(r => '<b>' + r.rule + '</b> (' + r.score + ')').join('<br>');
277
278
  window.renderScreening = data => (data.screening_results || []).map(r => r.list + ': ' + r.match).join('<br>');
279
+ // Number column with a JS renderer: its number filter must keep comparing the raw value.
280
+ window.renderAmount = data => '<span class="badge">' + Number(data.amount).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + '</span>';
278
281
 
279
282
  // Helpers: count rows in a grid's DOM with a given background colour. Multiple matches
280
283
  // are accepted (puppeteer normalises CSS to rgb()).
@@ -414,6 +417,8 @@
414
417
  checks.jsFilter_noMatch = { expect: 0, actual: visible() };
415
418
  await call('applyFilters', { id: { type: 'equals', filter: 9003 } });
416
419
  checks.jsFilter_plainColumn = { expect: 1, actual: visible() };
420
+ await call('applyFilters', { amount: { type: 'greaterThan', filter: 1000 } });
421
+ checks.jsFilter_numberWithRenderer = { expect: txns.filter(r => r.amount > 1000).length, actual: visible() };
417
422
  await call('clearFilters');
418
423
  gi.setGridOption('quickFilterText', 'payout');
419
424
  checks.jsFilter_quick = { expect: anyPayout, actual: visible() };
@@ -1,5 +1,5 @@
1
1
  {
2
- "startedAt": "2026-10-01T12:37:40.392Z",
2
+ "startedAt": "2026-10-01T12:45:25.153Z",
3
3
  "base": "http://localhost:8765/tests",
4
4
  "pages": [
5
5
  {
@@ -789,6 +789,10 @@
789
789
  "expect": 1,
790
790
  "actual": 1
791
791
  },
792
+ "jsFilter_numberWithRenderer": {
793
+ "expect": 3,
794
+ "actual": 3
795
+ },
792
796
  "jsFilter_quick": {
793
797
  "expect": 4,
794
798
  "actual": 4
@@ -924,5 +928,5 @@
924
928
  }
925
929
  }
926
930
  ],
927
- "finishedAt": "2026-10-01T12:38:05.318Z"
931
+ "finishedAt": "2026-10-01T12:45:49.727Z"
928
932
  }
package/tests/run-all.cjs CHANGED
@@ -25,7 +25,7 @@ const PAGES = [
25
25
  { file: '10-state-persistence.html',grids: ['stateGrid'] },
26
26
  { file: '11-layout.html', grids: ['autoH','fixedH','scrollH'] },
27
27
  { file: '12-methods.html', grids: ['m'] },
28
- { file: '13-flags-styles.html', grids: ['flagsGrid','stylesGrid','transformGrid','tipGrid','jsFilterGrid'] },
28
+ { file: '13-flags-styles.html', grids: ['flagsGrid','rsFn','rsOp','rsCompound','rsShort','rsFirst','rsLegacy','csCell','transformGrid','tipGrid','jsFilterGrid'] },
29
29
  { file: '14-compact-view.html', grids: ['compactGrid','extButtons','cellEvtGrid'] },
30
30
  { file: '15-csp.html', grids: ['cspGrid','statusGrid'] }
31
31
  ];