@infinite-table/infinite-react 3.0.9 → 3.0.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/index.d.ts CHANGED
@@ -1924,6 +1924,7 @@ declare type DataSourceFilterOperator<T> = {
1924
1924
  Icon?: (props: any) => JSX.Element | null;
1925
1925
  };
1926
1926
  fn: DataSourceFilterOperatorFunction<T>;
1927
+ defaultFilterValue?: any;
1927
1928
  };
1928
1929
  declare type DataSourceFilterOperatorFunction<T> = (filterOperatorFunctionParam: DataSourceFilterOperatorFunctionParam<T>) => boolean;
1929
1930
  declare type DataSourceFilterOperatorFunctionParam<T> = {
package/index.dev.js CHANGED
@@ -15435,16 +15435,15 @@ var InfiniteTableApiImpl = class {
15435
15435
  };
15436
15436
  if (col.field || typeof col.groupByForColumn === "string") {
15437
15437
  filterValueForColumn.field = col.field || col.groupByForColumn;
15438
- } else {
15439
- filterValueForColumn.id = col.id;
15440
15438
  }
15441
15439
  newFilterValueForColumn = filterValueForColumn;
15442
15440
  }
15441
+ newFilterValueForColumn.id = col.id;
15443
15442
  newFilterValueForColumn.filter.value = filterValue;
15444
15443
  this.setFilterValueForColumn(columnId, newFilterValueForColumn);
15445
15444
  }
15446
15445
  setColumnFilterOperator(columnId, newOperator) {
15447
- var _a, _b;
15446
+ var _a;
15448
15447
  const col = this.getComputed().computedColumnsMap.get(columnId);
15449
15448
  if (!col) {
15450
15449
  return;
@@ -15452,29 +15451,34 @@ var InfiniteTableApiImpl = class {
15452
15451
  const dataSourceState = this.getDataSourceState();
15453
15452
  const { filterTypes } = dataSourceState;
15454
15453
  const filterType = col.computedFilterType;
15455
- const operator = (_b = (_a = filterTypes[filterType].operators.find((op) => op.name === newOperator)) == null ? void 0 : _a.name) != null ? _b : filterTypes[filterType].defaultOperator;
15454
+ const filterTypeOperators = filterTypes[filterType].operators;
15455
+ const operator = (_a = filterTypeOperators.find(
15456
+ (op) => op.name === newOperator
15457
+ )) != null ? _a : filterTypeOperators.find(
15458
+ (op) => op.name === filterTypes[filterType].defaultOperator
15459
+ );
15460
+ const operatorName = operator.name;
15456
15461
  let newFilterValueForColumn;
15457
15462
  if (col.computedFilterValue) {
15458
15463
  newFilterValueForColumn = __spreadProps(__spreadValues({}, col.computedFilterValue), {
15459
15464
  filter: __spreadProps(__spreadValues({}, col.computedFilterValue.filter), {
15460
- operator
15465
+ operator: operatorName
15461
15466
  })
15462
15467
  });
15463
15468
  } else {
15464
15469
  newFilterValueForColumn = {
15465
15470
  filter: {
15466
- operator,
15471
+ operator: operatorName,
15467
15472
  type: filterType,
15468
- value: [...filterTypes[filterType].emptyValues.values()][0]
15473
+ value: operator.defaultFilterValue !== void 0 ? operator.defaultFilterValue : [...filterTypes[filterType].emptyValues.values()][0]
15469
15474
  },
15470
15475
  valueGetter: col.valueGetter
15471
15476
  };
15472
15477
  if (col.field) {
15473
15478
  newFilterValueForColumn.field = col.field;
15474
- } else {
15475
- newFilterValueForColumn.id = col.id;
15476
15479
  }
15477
15480
  }
15481
+ newFilterValueForColumn.id = col.id;
15478
15482
  this.setFilterValueForColumn(columnId, newFilterValueForColumn);
15479
15483
  }
15480
15484
  setFilterValueForColumn(columnId, filterValue) {
@@ -17663,7 +17667,7 @@ var useLicense = (licenseKey = "") => {
17663
17667
  const valid = (0, import_react50.useMemo)(() => {
17664
17668
  let valid2 = isValidLicense(licenseKey, {
17665
17669
  publishedAt: 1624970570587,
17666
- version: "3.0.9"
17670
+ version: "3.0.10"
17667
17671
  });
17668
17672
  if (!licenseKey && !valid2 && isInsidePlayground) {
17669
17673
  return true;
package/index.dev.mjs CHANGED
@@ -15420,16 +15420,15 @@ var InfiniteTableApiImpl = class {
15420
15420
  };
15421
15421
  if (col.field || typeof col.groupByForColumn === "string") {
15422
15422
  filterValueForColumn.field = col.field || col.groupByForColumn;
15423
- } else {
15424
- filterValueForColumn.id = col.id;
15425
15423
  }
15426
15424
  newFilterValueForColumn = filterValueForColumn;
15427
15425
  }
15426
+ newFilterValueForColumn.id = col.id;
15428
15427
  newFilterValueForColumn.filter.value = filterValue;
15429
15428
  this.setFilterValueForColumn(columnId, newFilterValueForColumn);
15430
15429
  }
15431
15430
  setColumnFilterOperator(columnId, newOperator) {
15432
- var _a, _b;
15431
+ var _a;
15433
15432
  const col = this.getComputed().computedColumnsMap.get(columnId);
15434
15433
  if (!col) {
15435
15434
  return;
@@ -15437,29 +15436,34 @@ var InfiniteTableApiImpl = class {
15437
15436
  const dataSourceState = this.getDataSourceState();
15438
15437
  const { filterTypes } = dataSourceState;
15439
15438
  const filterType = col.computedFilterType;
15440
- const operator = (_b = (_a = filterTypes[filterType].operators.find((op) => op.name === newOperator)) == null ? void 0 : _a.name) != null ? _b : filterTypes[filterType].defaultOperator;
15439
+ const filterTypeOperators = filterTypes[filterType].operators;
15440
+ const operator = (_a = filterTypeOperators.find(
15441
+ (op) => op.name === newOperator
15442
+ )) != null ? _a : filterTypeOperators.find(
15443
+ (op) => op.name === filterTypes[filterType].defaultOperator
15444
+ );
15445
+ const operatorName = operator.name;
15441
15446
  let newFilterValueForColumn;
15442
15447
  if (col.computedFilterValue) {
15443
15448
  newFilterValueForColumn = __spreadProps(__spreadValues({}, col.computedFilterValue), {
15444
15449
  filter: __spreadProps(__spreadValues({}, col.computedFilterValue.filter), {
15445
- operator
15450
+ operator: operatorName
15446
15451
  })
15447
15452
  });
15448
15453
  } else {
15449
15454
  newFilterValueForColumn = {
15450
15455
  filter: {
15451
- operator,
15456
+ operator: operatorName,
15452
15457
  type: filterType,
15453
- value: [...filterTypes[filterType].emptyValues.values()][0]
15458
+ value: operator.defaultFilterValue !== void 0 ? operator.defaultFilterValue : [...filterTypes[filterType].emptyValues.values()][0]
15454
15459
  },
15455
15460
  valueGetter: col.valueGetter
15456
15461
  };
15457
15462
  if (col.field) {
15458
15463
  newFilterValueForColumn.field = col.field;
15459
- } else {
15460
- newFilterValueForColumn.id = col.id;
15461
15464
  }
15462
15465
  }
15466
+ newFilterValueForColumn.id = col.id;
15463
15467
  this.setFilterValueForColumn(columnId, newFilterValueForColumn);
15464
15468
  }
15465
15469
  setFilterValueForColumn(columnId, filterValue) {
@@ -17652,7 +17656,7 @@ var useLicense = (licenseKey = "") => {
17652
17656
  const valid = useMemo11(() => {
17653
17657
  let valid2 = isValidLicense(licenseKey, {
17654
17658
  publishedAt: 1624970570587,
17655
- version: "3.0.9"
17659
+ version: "3.0.10"
17656
17660
  });
17657
17661
  if (!licenseKey && !valid2 && isInsidePlayground) {
17658
17662
  return true;