@adaptabletools/adaptable 20.0.4 → 20.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "20.0.4",
3
+ "version": "20.0.5",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -100,15 +100,43 @@ export const ColumnFilterInput = ({ type, value, onChange: onChangeProp, onClear
100
100
  // autoFocus has to be FALSE because if the input receives focus in the init phase,
101
101
  // it may scroll the AG Grid header viewport into view and de-synchronize it (relative to the content viewport)
102
102
  autoFocus: false, value: liveValue ?? '', onKeyDown: onKeyDown, showClearButton: false, onChange: (e) => {
103
+ const prevValue = `${liveValue}`;
103
104
  const value = e.target.value;
104
105
  if (value) {
105
106
  if (type === 'number') {
106
107
  let numericValue = parseFloat(value);
108
+ let liveValue = numericValue;
107
109
  if (isNaN(numericValue)) {
108
110
  numericValue = null;
111
+ liveValue = null;
112
+ }
113
+ else {
114
+ const prevValueHasSeparator = prevValue.includes('.');
115
+ const newValueEndsWithSeparator = value.endsWith('.');
116
+ const newValueStartsWithSeparator = value.startsWith('.');
117
+ const newValueEndsWithZero = value.endsWith('0');
118
+ const separatorCount = (value.match(/[.,]/g) || []).length;
119
+ if (prevValueHasSeparator && separatorCount > 1) {
120
+ // not a valid number
121
+ return;
122
+ }
123
+ if (newValueEndsWithSeparator) {
124
+ const valueWithoutLastChar = value.slice(0, -1);
125
+ if (numericValue === parseFloat(valueWithoutLastChar)) {
126
+ liveValue = value;
127
+ }
128
+ }
129
+ if (newValueEndsWithZero) {
130
+ liveValue = value;
131
+ }
132
+ if (newValueStartsWithSeparator) {
133
+ if (numericValue === parseFloat('0' + value)) {
134
+ liveValue = value;
135
+ }
136
+ }
109
137
  }
110
138
  onChange(numericValue);
111
- setLiveValue(numericValue);
139
+ setLiveValue(liveValue);
112
140
  }
113
141
  else {
114
142
  onChange(value);
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { AdaptableColumnFilter } from '../View/Components/ColumnFilter/AdaptableColumnFilter';
3
3
  import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext';
4
+ import { getAgGridFilterNotifyModelFn } from './getAgGridFilterNotifyModelFn';
4
5
  export const FilterWrapperFactory = (adaptable) => {
5
6
  function isFilterActive(colId) {
6
7
  // we need this here
@@ -108,14 +109,15 @@ export const FilterWrapperFactory = (adaptable) => {
108
109
  this.unmountReactRoot?.();
109
110
  const columnId = this.column.getColId();
110
111
  let column = adaptable.api.columnApi.getColumnWithColumnId(columnId);
111
- // for whatever reason, it works without this
112
- // const notifyModel = getNotifyModel(colId, this.params.filterChangedCallback);
112
+ function getNotifyModel(colId, onModelChange) {
113
+ return getAgGridFilterNotifyModelFn(adaptable.api, colId, onModelChange);
114
+ }
115
+ const notifyModel = getNotifyModel(columnId, this.params.filterChangedCallback);
113
116
  if (column) {
114
117
  this.unmountReactRoot = adaptable.renderReactRoot(renderWithAdaptableContext(React.createElement(AdaptableColumnFilter, {
115
118
  columnId,
116
119
  wrapperProps: { p: 2 },
117
- // for whatever reason, it works without this
118
- // onChange: notifyModel,
120
+ onChange: notifyModel,
119
121
  }), adaptable),
120
122
  // AdaptableColumnFilter(filterProps),
121
123
  this.filterContainer);
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1744726345600 || Date.now(),
4
- VERSION: "20.0.4" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1744964803967 || Date.now(),
4
+ VERSION: "20.0.5" || '--current-version--',
5
5
  };