@infinite-table/infinite-react 3.0.9 → 3.0.11
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 +11 -0
- package/index.dev.js +78 -30
- package/index.dev.mjs +78 -30
- package/index.js +4 -4
- package/index.mjs +4 -4
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -154,6 +154,8 @@ declare function useInfiniteColumnFilterEditor<T>(): {
|
|
|
154
154
|
filterTypeKey: string;
|
|
155
155
|
filtered: boolean;
|
|
156
156
|
setValue: (filterValue: any) => void;
|
|
157
|
+
clearValue: () => void;
|
|
158
|
+
removeColumnFilter: () => void;
|
|
157
159
|
ariaLabel: string;
|
|
158
160
|
className: string;
|
|
159
161
|
};
|
|
@@ -1924,6 +1926,7 @@ declare type DataSourceFilterOperator<T> = {
|
|
|
1924
1926
|
Icon?: (props: any) => JSX.Element | null;
|
|
1925
1927
|
};
|
|
1926
1928
|
fn: DataSourceFilterOperatorFunction<T>;
|
|
1929
|
+
defaultFilterValue?: any;
|
|
1927
1930
|
};
|
|
1928
1931
|
declare type DataSourceFilterOperatorFunction<T> = (filterOperatorFunctionParam: DataSourceFilterOperatorFunctionParam<T>) => boolean;
|
|
1929
1932
|
declare type DataSourceFilterOperatorFunctionParam<T> = {
|
|
@@ -2611,7 +2614,15 @@ interface InfiniteTableApi<T> {
|
|
|
2611
2614
|
toggleSortingForColumn: (columnId: string, options?: MultiSortBehaviorOptions) => void;
|
|
2612
2615
|
setColumnFilter: (columnId: string, filterValue: any) => void;
|
|
2613
2616
|
setColumnFilterOperator: (columnId: string, operator: string) => void;
|
|
2617
|
+
/**
|
|
2618
|
+
* Clears the filter for the given column to a default value. The column will still have a
|
|
2619
|
+
* corresponding filterValue, though set to the empty filter value, so it's not considered filtered.
|
|
2620
|
+
*/
|
|
2614
2621
|
clearColumnFilter: (columnId: string) => void;
|
|
2622
|
+
/**
|
|
2623
|
+
* Removes the filter for the column altogether. The column will no longer have a corresponding entry in the filterValue prop.
|
|
2624
|
+
*/
|
|
2625
|
+
removeColumnFilter: (columnId: string) => void;
|
|
2615
2626
|
isColumnSortable: (columnId: string) => boolean;
|
|
2616
2627
|
setFilterValueForColumn: (columnId: string, filterValue: DataSourceFilterValueItem<T>) => void;
|
|
2617
2628
|
setPinningForColumn: (columnId: string, pinning: InfiniteTableColumnPinnedValues) => void;
|
package/index.dev.js
CHANGED
|
@@ -6416,6 +6416,12 @@ function useInfiniteColumnFilterEditor() {
|
|
|
6416
6416
|
},
|
|
6417
6417
|
[filterContextValue.onChange]
|
|
6418
6418
|
);
|
|
6419
|
+
const clearValue = React28.useCallback(() => {
|
|
6420
|
+
context.api.clearColumnFilter(column.id);
|
|
6421
|
+
}, [column.id]);
|
|
6422
|
+
const removeColumnFilter = React28.useCallback(() => {
|
|
6423
|
+
context.api.removeColumnFilter(column.id);
|
|
6424
|
+
}, [column.id]);
|
|
6419
6425
|
(0, import_react20.useEffect)(() => {
|
|
6420
6426
|
if (columnFilterValue) {
|
|
6421
6427
|
if (theValue !== columnFilterValue.filter.value) {
|
|
@@ -6446,6 +6452,8 @@ function useInfiniteColumnFilterEditor() {
|
|
|
6446
6452
|
filterTypeKey: columnFilterType,
|
|
6447
6453
|
filtered: column.computedFiltered,
|
|
6448
6454
|
setValue: onInputChange,
|
|
6455
|
+
clearValue,
|
|
6456
|
+
removeColumnFilter,
|
|
6449
6457
|
ariaLabel: `Filter for ${columnLabel}`,
|
|
6450
6458
|
className: `${HeaderFilterEditorCls} ${InfiniteTableColumnHeaderFilterInputClassName}`
|
|
6451
6459
|
};
|
|
@@ -7668,27 +7676,20 @@ function getGroupColumnRender({
|
|
|
7668
7676
|
const { rowInfo, renderBag, column, align: align2 } = renderOptions;
|
|
7669
7677
|
let { value: valueToRender, groupIcon, selectionCheckBox } = renderBag;
|
|
7670
7678
|
const groupRowInfo = rowInfo;
|
|
7679
|
+
const className = join(
|
|
7680
|
+
display.flex,
|
|
7681
|
+
column.align === "end" ? flexFlow.rowReverse : flexFlow.row,
|
|
7682
|
+
alignItems.center,
|
|
7683
|
+
`${InfiniteTableColumnCellClassName}Expander`,
|
|
7684
|
+
groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && (!rowInfo.isGroupRow || selectionCheckBox) ? GroupRowExpanderCls({ align: align2 }) : null
|
|
7685
|
+
);
|
|
7671
7686
|
if (groupRenderStrategy === "multi-column") {
|
|
7672
7687
|
if (groupIndexForColumn + 1 !== groupRowInfo.groupNesting && groupRowInfo.isGroupRow) {
|
|
7673
|
-
return null;
|
|
7688
|
+
return selectionCheckBox ? /* @__PURE__ */ React32.createElement("div", { className }, selectionCheckBox) : null;
|
|
7674
7689
|
}
|
|
7675
7690
|
} else if (groupRenderStrategy === "single-column" && !groupRowInfo.isGroupRow) {
|
|
7676
7691
|
}
|
|
7677
|
-
return /* @__PURE__ */ React32.createElement(
|
|
7678
|
-
"div",
|
|
7679
|
-
{
|
|
7680
|
-
className: join(
|
|
7681
|
-
display.flex,
|
|
7682
|
-
column.align === "end" ? flexFlow.rowReverse : flexFlow.row,
|
|
7683
|
-
alignItems.center,
|
|
7684
|
-
`${InfiniteTableColumnCellClassName}Expander`,
|
|
7685
|
-
groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && !rowInfo.isGroupRow ? GroupRowExpanderCls({ align: align2 }) : null
|
|
7686
|
-
)
|
|
7687
|
-
},
|
|
7688
|
-
groupIcon,
|
|
7689
|
-
selectionCheckBox,
|
|
7690
|
-
/* @__PURE__ */ React32.createElement("div", { className: cssEllipsisClassName }, valueToRender != null ? valueToRender : null)
|
|
7691
|
-
);
|
|
7692
|
+
return /* @__PURE__ */ React32.createElement("div", { className }, groupIcon, selectionCheckBox, /* @__PURE__ */ React32.createElement("div", { className: cssEllipsisClassName }, valueToRender != null ? valueToRender : null));
|
|
7692
7693
|
};
|
|
7693
7694
|
}
|
|
7694
7695
|
function getGroupColumnRenderGroupIcon({
|
|
@@ -8310,7 +8311,6 @@ var defaultRenderSelectionCheckBox = (params) => {
|
|
|
8310
8311
|
column
|
|
8311
8312
|
} = params;
|
|
8312
8313
|
if (rowInfo.isGroupRow && !column.groupByForColumn) {
|
|
8313
|
-
return null;
|
|
8314
8314
|
}
|
|
8315
8315
|
return /* @__PURE__ */ React36.createElement(
|
|
8316
8316
|
InfiniteCheckBox,
|
|
@@ -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
|
|
15446
|
+
var _a;
|
|
15448
15447
|
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
15449
15448
|
if (!col) {
|
|
15450
15449
|
return;
|
|
@@ -15452,29 +15451,37 @@ var InfiniteTableApiImpl = class {
|
|
|
15452
15451
|
const dataSourceState = this.getDataSourceState();
|
|
15453
15452
|
const { filterTypes } = dataSourceState;
|
|
15454
15453
|
const filterType = col.computedFilterType;
|
|
15455
|
-
const
|
|
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
|
});
|
|
15468
|
+
if (operator.defaultFilterValue !== void 0) {
|
|
15469
|
+
newFilterValueForColumn.filter.value = operator.defaultFilterValue;
|
|
15470
|
+
}
|
|
15463
15471
|
} else {
|
|
15464
15472
|
newFilterValueForColumn = {
|
|
15465
15473
|
filter: {
|
|
15466
|
-
operator,
|
|
15474
|
+
operator: operatorName,
|
|
15467
15475
|
type: filterType,
|
|
15468
|
-
value: [...filterTypes[filterType].emptyValues.values()][0]
|
|
15476
|
+
value: operator.defaultFilterValue !== void 0 ? operator.defaultFilterValue : [...filterTypes[filterType].emptyValues.values()][0]
|
|
15469
15477
|
},
|
|
15470
15478
|
valueGetter: col.valueGetter
|
|
15471
15479
|
};
|
|
15472
15480
|
if (col.field) {
|
|
15473
15481
|
newFilterValueForColumn.field = col.field;
|
|
15474
|
-
} else {
|
|
15475
|
-
newFilterValueForColumn.id = col.id;
|
|
15476
15482
|
}
|
|
15477
15483
|
}
|
|
15484
|
+
newFilterValueForColumn.id = col.id;
|
|
15478
15485
|
this.setFilterValueForColumn(columnId, newFilterValueForColumn);
|
|
15479
15486
|
}
|
|
15480
15487
|
setFilterValueForColumn(columnId, filterValue) {
|
|
@@ -15498,7 +15505,7 @@ var InfiniteTableApiImpl = class {
|
|
|
15498
15505
|
}
|
|
15499
15506
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15500
15507
|
}
|
|
15501
|
-
|
|
15508
|
+
removeColumnFilter(columnId) {
|
|
15502
15509
|
var _a;
|
|
15503
15510
|
const column = this.getComputed().computedColumnsMap.get(columnId);
|
|
15504
15511
|
if (!column) {
|
|
@@ -15518,6 +15525,47 @@ var InfiniteTableApiImpl = class {
|
|
|
15518
15525
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15519
15526
|
}
|
|
15520
15527
|
}
|
|
15528
|
+
clearColumnFilter(columnId) {
|
|
15529
|
+
var _a;
|
|
15530
|
+
const column = this.getComputed().computedColumnsMap.get(columnId);
|
|
15531
|
+
if (!column) {
|
|
15532
|
+
return;
|
|
15533
|
+
}
|
|
15534
|
+
const state = this.getDataSourceState();
|
|
15535
|
+
let newFilterValue = (_a = state.filterValue) != null ? _a : [];
|
|
15536
|
+
let found = false;
|
|
15537
|
+
newFilterValue = newFilterValue.map((currentFilterValue) => {
|
|
15538
|
+
var _a2, _b, _c;
|
|
15539
|
+
if (currentFilterValue === column.computedFilterValue) {
|
|
15540
|
+
const filterTypeName = column.computedFilterValue.filter.type;
|
|
15541
|
+
const operators = state.operatorsByFilterType[filterTypeName];
|
|
15542
|
+
const filterType = state.filterTypes[filterTypeName];
|
|
15543
|
+
found = true;
|
|
15544
|
+
if (!filterType) {
|
|
15545
|
+
return null;
|
|
15546
|
+
}
|
|
15547
|
+
const operatorName = (_a2 = currentFilterValue.filter.operator) != null ? _a2 : filterType == null ? void 0 : filterType.defaultOperator;
|
|
15548
|
+
const operator = operators[operatorName];
|
|
15549
|
+
const value = (
|
|
15550
|
+
// first try the default value of the operator
|
|
15551
|
+
(_c = (_b = operator.defaultFilterValue) != null ? _b : (
|
|
15552
|
+
// then the first empty value
|
|
15553
|
+
(filterType.emptyValues || [])[0]
|
|
15554
|
+
)) != null ? _c : void 0
|
|
15555
|
+
);
|
|
15556
|
+
return __spreadProps(__spreadValues({}, currentFilterValue), {
|
|
15557
|
+
filter: __spreadProps(__spreadValues({}, currentFilterValue.filter), {
|
|
15558
|
+
operator: operatorName,
|
|
15559
|
+
value
|
|
15560
|
+
})
|
|
15561
|
+
});
|
|
15562
|
+
}
|
|
15563
|
+
return currentFilterValue;
|
|
15564
|
+
}).filter(notNullable);
|
|
15565
|
+
if (found) {
|
|
15566
|
+
this.dataSourceActions.filterValue = newFilterValue;
|
|
15567
|
+
}
|
|
15568
|
+
}
|
|
15521
15569
|
setVisibilityForColumn(columnId, visible) {
|
|
15522
15570
|
const columnVisibility = __spreadValues({}, this.getState().columnVisibility);
|
|
15523
15571
|
if (visible) {
|
|
@@ -17663,7 +17711,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17663
17711
|
const valid = (0, import_react50.useMemo)(() => {
|
|
17664
17712
|
let valid2 = isValidLicense(licenseKey, {
|
|
17665
17713
|
publishedAt: 1624970570587,
|
|
17666
|
-
version: "3.0.
|
|
17714
|
+
version: "3.0.11"
|
|
17667
17715
|
});
|
|
17668
17716
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17669
17717
|
return true;
|
|
@@ -20634,8 +20682,8 @@ function getFilterOperatorMenuForColumn(columnId, context, onHideIntent) {
|
|
|
20634
20682
|
}
|
|
20635
20683
|
},
|
|
20636
20684
|
{
|
|
20637
|
-
key: "
|
|
20638
|
-
label: "
|
|
20685
|
+
key: "reset",
|
|
20686
|
+
label: "Reset",
|
|
20639
20687
|
icon: /* @__PURE__ */ React62.createElement(ClearIcon, null),
|
|
20640
20688
|
disabled: !column.computedFiltered,
|
|
20641
20689
|
onAction: () => {
|
package/index.dev.mjs
CHANGED
|
@@ -6401,6 +6401,12 @@ function useInfiniteColumnFilterEditor() {
|
|
|
6401
6401
|
},
|
|
6402
6402
|
[filterContextValue.onChange]
|
|
6403
6403
|
);
|
|
6404
|
+
const clearValue = React28.useCallback(() => {
|
|
6405
|
+
context.api.clearColumnFilter(column.id);
|
|
6406
|
+
}, [column.id]);
|
|
6407
|
+
const removeColumnFilter = React28.useCallback(() => {
|
|
6408
|
+
context.api.removeColumnFilter(column.id);
|
|
6409
|
+
}, [column.id]);
|
|
6404
6410
|
useEffect11(() => {
|
|
6405
6411
|
if (columnFilterValue) {
|
|
6406
6412
|
if (theValue !== columnFilterValue.filter.value) {
|
|
@@ -6431,6 +6437,8 @@ function useInfiniteColumnFilterEditor() {
|
|
|
6431
6437
|
filterTypeKey: columnFilterType,
|
|
6432
6438
|
filtered: column.computedFiltered,
|
|
6433
6439
|
setValue: onInputChange,
|
|
6440
|
+
clearValue,
|
|
6441
|
+
removeColumnFilter,
|
|
6434
6442
|
ariaLabel: `Filter for ${columnLabel}`,
|
|
6435
6443
|
className: `${HeaderFilterEditorCls} ${InfiniteTableColumnHeaderFilterInputClassName}`
|
|
6436
6444
|
};
|
|
@@ -7653,27 +7661,20 @@ function getGroupColumnRender({
|
|
|
7653
7661
|
const { rowInfo, renderBag, column, align: align2 } = renderOptions;
|
|
7654
7662
|
let { value: valueToRender, groupIcon, selectionCheckBox } = renderBag;
|
|
7655
7663
|
const groupRowInfo = rowInfo;
|
|
7664
|
+
const className = join(
|
|
7665
|
+
display.flex,
|
|
7666
|
+
column.align === "end" ? flexFlow.rowReverse : flexFlow.row,
|
|
7667
|
+
alignItems.center,
|
|
7668
|
+
`${InfiniteTableColumnCellClassName}Expander`,
|
|
7669
|
+
groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && (!rowInfo.isGroupRow || selectionCheckBox) ? GroupRowExpanderCls({ align: align2 }) : null
|
|
7670
|
+
);
|
|
7656
7671
|
if (groupRenderStrategy === "multi-column") {
|
|
7657
7672
|
if (groupIndexForColumn + 1 !== groupRowInfo.groupNesting && groupRowInfo.isGroupRow) {
|
|
7658
|
-
return null;
|
|
7673
|
+
return selectionCheckBox ? /* @__PURE__ */ React32.createElement("div", { className }, selectionCheckBox) : null;
|
|
7659
7674
|
}
|
|
7660
7675
|
} else if (groupRenderStrategy === "single-column" && !groupRowInfo.isGroupRow) {
|
|
7661
7676
|
}
|
|
7662
|
-
return /* @__PURE__ */ React32.createElement(
|
|
7663
|
-
"div",
|
|
7664
|
-
{
|
|
7665
|
-
className: join(
|
|
7666
|
-
display.flex,
|
|
7667
|
-
column.align === "end" ? flexFlow.rowReverse : flexFlow.row,
|
|
7668
|
-
alignItems.center,
|
|
7669
|
-
`${InfiniteTableColumnCellClassName}Expander`,
|
|
7670
|
-
groupRenderStrategy === "single-column" || groupRenderStrategy === "multi-column" && !rowInfo.isGroupRow ? GroupRowExpanderCls({ align: align2 }) : null
|
|
7671
|
-
)
|
|
7672
|
-
},
|
|
7673
|
-
groupIcon,
|
|
7674
|
-
selectionCheckBox,
|
|
7675
|
-
/* @__PURE__ */ React32.createElement("div", { className: cssEllipsisClassName }, valueToRender != null ? valueToRender : null)
|
|
7676
|
-
);
|
|
7677
|
+
return /* @__PURE__ */ React32.createElement("div", { className }, groupIcon, selectionCheckBox, /* @__PURE__ */ React32.createElement("div", { className: cssEllipsisClassName }, valueToRender != null ? valueToRender : null));
|
|
7677
7678
|
};
|
|
7678
7679
|
}
|
|
7679
7680
|
function getGroupColumnRenderGroupIcon({
|
|
@@ -8295,7 +8296,6 @@ var defaultRenderSelectionCheckBox = (params) => {
|
|
|
8295
8296
|
column
|
|
8296
8297
|
} = params;
|
|
8297
8298
|
if (rowInfo.isGroupRow && !column.groupByForColumn) {
|
|
8298
|
-
return null;
|
|
8299
8299
|
}
|
|
8300
8300
|
return /* @__PURE__ */ React36.createElement(
|
|
8301
8301
|
InfiniteCheckBox,
|
|
@@ -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
|
|
15431
|
+
var _a;
|
|
15433
15432
|
const col = this.getComputed().computedColumnsMap.get(columnId);
|
|
15434
15433
|
if (!col) {
|
|
15435
15434
|
return;
|
|
@@ -15437,29 +15436,37 @@ var InfiniteTableApiImpl = class {
|
|
|
15437
15436
|
const dataSourceState = this.getDataSourceState();
|
|
15438
15437
|
const { filterTypes } = dataSourceState;
|
|
15439
15438
|
const filterType = col.computedFilterType;
|
|
15440
|
-
const
|
|
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
|
});
|
|
15453
|
+
if (operator.defaultFilterValue !== void 0) {
|
|
15454
|
+
newFilterValueForColumn.filter.value = operator.defaultFilterValue;
|
|
15455
|
+
}
|
|
15448
15456
|
} else {
|
|
15449
15457
|
newFilterValueForColumn = {
|
|
15450
15458
|
filter: {
|
|
15451
|
-
operator,
|
|
15459
|
+
operator: operatorName,
|
|
15452
15460
|
type: filterType,
|
|
15453
|
-
value: [...filterTypes[filterType].emptyValues.values()][0]
|
|
15461
|
+
value: operator.defaultFilterValue !== void 0 ? operator.defaultFilterValue : [...filterTypes[filterType].emptyValues.values()][0]
|
|
15454
15462
|
},
|
|
15455
15463
|
valueGetter: col.valueGetter
|
|
15456
15464
|
};
|
|
15457
15465
|
if (col.field) {
|
|
15458
15466
|
newFilterValueForColumn.field = col.field;
|
|
15459
|
-
} else {
|
|
15460
|
-
newFilterValueForColumn.id = col.id;
|
|
15461
15467
|
}
|
|
15462
15468
|
}
|
|
15469
|
+
newFilterValueForColumn.id = col.id;
|
|
15463
15470
|
this.setFilterValueForColumn(columnId, newFilterValueForColumn);
|
|
15464
15471
|
}
|
|
15465
15472
|
setFilterValueForColumn(columnId, filterValue) {
|
|
@@ -15483,7 +15490,7 @@ var InfiniteTableApiImpl = class {
|
|
|
15483
15490
|
}
|
|
15484
15491
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15485
15492
|
}
|
|
15486
|
-
|
|
15493
|
+
removeColumnFilter(columnId) {
|
|
15487
15494
|
var _a;
|
|
15488
15495
|
const column = this.getComputed().computedColumnsMap.get(columnId);
|
|
15489
15496
|
if (!column) {
|
|
@@ -15503,6 +15510,47 @@ var InfiniteTableApiImpl = class {
|
|
|
15503
15510
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15504
15511
|
}
|
|
15505
15512
|
}
|
|
15513
|
+
clearColumnFilter(columnId) {
|
|
15514
|
+
var _a;
|
|
15515
|
+
const column = this.getComputed().computedColumnsMap.get(columnId);
|
|
15516
|
+
if (!column) {
|
|
15517
|
+
return;
|
|
15518
|
+
}
|
|
15519
|
+
const state = this.getDataSourceState();
|
|
15520
|
+
let newFilterValue = (_a = state.filterValue) != null ? _a : [];
|
|
15521
|
+
let found = false;
|
|
15522
|
+
newFilterValue = newFilterValue.map((currentFilterValue) => {
|
|
15523
|
+
var _a2, _b, _c;
|
|
15524
|
+
if (currentFilterValue === column.computedFilterValue) {
|
|
15525
|
+
const filterTypeName = column.computedFilterValue.filter.type;
|
|
15526
|
+
const operators = state.operatorsByFilterType[filterTypeName];
|
|
15527
|
+
const filterType = state.filterTypes[filterTypeName];
|
|
15528
|
+
found = true;
|
|
15529
|
+
if (!filterType) {
|
|
15530
|
+
return null;
|
|
15531
|
+
}
|
|
15532
|
+
const operatorName = (_a2 = currentFilterValue.filter.operator) != null ? _a2 : filterType == null ? void 0 : filterType.defaultOperator;
|
|
15533
|
+
const operator = operators[operatorName];
|
|
15534
|
+
const value = (
|
|
15535
|
+
// first try the default value of the operator
|
|
15536
|
+
(_c = (_b = operator.defaultFilterValue) != null ? _b : (
|
|
15537
|
+
// then the first empty value
|
|
15538
|
+
(filterType.emptyValues || [])[0]
|
|
15539
|
+
)) != null ? _c : void 0
|
|
15540
|
+
);
|
|
15541
|
+
return __spreadProps(__spreadValues({}, currentFilterValue), {
|
|
15542
|
+
filter: __spreadProps(__spreadValues({}, currentFilterValue.filter), {
|
|
15543
|
+
operator: operatorName,
|
|
15544
|
+
value
|
|
15545
|
+
})
|
|
15546
|
+
});
|
|
15547
|
+
}
|
|
15548
|
+
return currentFilterValue;
|
|
15549
|
+
}).filter(notNullable);
|
|
15550
|
+
if (found) {
|
|
15551
|
+
this.dataSourceActions.filterValue = newFilterValue;
|
|
15552
|
+
}
|
|
15553
|
+
}
|
|
15506
15554
|
setVisibilityForColumn(columnId, visible) {
|
|
15507
15555
|
const columnVisibility = __spreadValues({}, this.getState().columnVisibility);
|
|
15508
15556
|
if (visible) {
|
|
@@ -17652,7 +17700,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17652
17700
|
const valid = useMemo11(() => {
|
|
17653
17701
|
let valid2 = isValidLicense(licenseKey, {
|
|
17654
17702
|
publishedAt: 1624970570587,
|
|
17655
|
-
version: "3.0.
|
|
17703
|
+
version: "3.0.11"
|
|
17656
17704
|
});
|
|
17657
17705
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17658
17706
|
return true;
|
|
@@ -20633,8 +20681,8 @@ function getFilterOperatorMenuForColumn(columnId, context, onHideIntent) {
|
|
|
20633
20681
|
}
|
|
20634
20682
|
},
|
|
20635
20683
|
{
|
|
20636
|
-
key: "
|
|
20637
|
-
label: "
|
|
20684
|
+
key: "reset",
|
|
20685
|
+
label: "Reset",
|
|
20638
20686
|
icon: /* @__PURE__ */ React62.createElement(ClearIcon, null),
|
|
20639
20687
|
disabled: !column.computedFiltered,
|
|
20640
20688
|
onAction: () => {
|