@infinite-table/infinite-react 3.0.10 → 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 +10 -0
- package/index.dev.js +65 -21
- package/index.dev.mjs +65 -21
- 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
|
};
|
|
@@ -2612,7 +2614,15 @@ interface InfiniteTableApi<T> {
|
|
|
2612
2614
|
toggleSortingForColumn: (columnId: string, options?: MultiSortBehaviorOptions) => void;
|
|
2613
2615
|
setColumnFilter: (columnId: string, filterValue: any) => void;
|
|
2614
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
|
+
*/
|
|
2615
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;
|
|
2616
2626
|
isColumnSortable: (columnId: string) => boolean;
|
|
2617
2627
|
setFilterValueForColumn: (columnId: string, filterValue: DataSourceFilterValueItem<T>) => void;
|
|
2618
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,
|
|
@@ -15465,6 +15465,9 @@ var InfiniteTableApiImpl = class {
|
|
|
15465
15465
|
operator: operatorName
|
|
15466
15466
|
})
|
|
15467
15467
|
});
|
|
15468
|
+
if (operator.defaultFilterValue !== void 0) {
|
|
15469
|
+
newFilterValueForColumn.filter.value = operator.defaultFilterValue;
|
|
15470
|
+
}
|
|
15468
15471
|
} else {
|
|
15469
15472
|
newFilterValueForColumn = {
|
|
15470
15473
|
filter: {
|
|
@@ -15502,7 +15505,7 @@ var InfiniteTableApiImpl = class {
|
|
|
15502
15505
|
}
|
|
15503
15506
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15504
15507
|
}
|
|
15505
|
-
|
|
15508
|
+
removeColumnFilter(columnId) {
|
|
15506
15509
|
var _a;
|
|
15507
15510
|
const column = this.getComputed().computedColumnsMap.get(columnId);
|
|
15508
15511
|
if (!column) {
|
|
@@ -15522,6 +15525,47 @@ var InfiniteTableApiImpl = class {
|
|
|
15522
15525
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15523
15526
|
}
|
|
15524
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
|
+
}
|
|
15525
15569
|
setVisibilityForColumn(columnId, visible) {
|
|
15526
15570
|
const columnVisibility = __spreadValues({}, this.getState().columnVisibility);
|
|
15527
15571
|
if (visible) {
|
|
@@ -17667,7 +17711,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17667
17711
|
const valid = (0, import_react50.useMemo)(() => {
|
|
17668
17712
|
let valid2 = isValidLicense(licenseKey, {
|
|
17669
17713
|
publishedAt: 1624970570587,
|
|
17670
|
-
version: "3.0.
|
|
17714
|
+
version: "3.0.11"
|
|
17671
17715
|
});
|
|
17672
17716
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17673
17717
|
return true;
|
|
@@ -20638,8 +20682,8 @@ function getFilterOperatorMenuForColumn(columnId, context, onHideIntent) {
|
|
|
20638
20682
|
}
|
|
20639
20683
|
},
|
|
20640
20684
|
{
|
|
20641
|
-
key: "
|
|
20642
|
-
label: "
|
|
20685
|
+
key: "reset",
|
|
20686
|
+
label: "Reset",
|
|
20643
20687
|
icon: /* @__PURE__ */ React62.createElement(ClearIcon, null),
|
|
20644
20688
|
disabled: !column.computedFiltered,
|
|
20645
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,
|
|
@@ -15450,6 +15450,9 @@ var InfiniteTableApiImpl = class {
|
|
|
15450
15450
|
operator: operatorName
|
|
15451
15451
|
})
|
|
15452
15452
|
});
|
|
15453
|
+
if (operator.defaultFilterValue !== void 0) {
|
|
15454
|
+
newFilterValueForColumn.filter.value = operator.defaultFilterValue;
|
|
15455
|
+
}
|
|
15453
15456
|
} else {
|
|
15454
15457
|
newFilterValueForColumn = {
|
|
15455
15458
|
filter: {
|
|
@@ -15487,7 +15490,7 @@ var InfiniteTableApiImpl = class {
|
|
|
15487
15490
|
}
|
|
15488
15491
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15489
15492
|
}
|
|
15490
|
-
|
|
15493
|
+
removeColumnFilter(columnId) {
|
|
15491
15494
|
var _a;
|
|
15492
15495
|
const column = this.getComputed().computedColumnsMap.get(columnId);
|
|
15493
15496
|
if (!column) {
|
|
@@ -15507,6 +15510,47 @@ var InfiniteTableApiImpl = class {
|
|
|
15507
15510
|
this.dataSourceActions.filterValue = newFilterValue;
|
|
15508
15511
|
}
|
|
15509
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
|
+
}
|
|
15510
15554
|
setVisibilityForColumn(columnId, visible) {
|
|
15511
15555
|
const columnVisibility = __spreadValues({}, this.getState().columnVisibility);
|
|
15512
15556
|
if (visible) {
|
|
@@ -17656,7 +17700,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17656
17700
|
const valid = useMemo11(() => {
|
|
17657
17701
|
let valid2 = isValidLicense(licenseKey, {
|
|
17658
17702
|
publishedAt: 1624970570587,
|
|
17659
|
-
version: "3.0.
|
|
17703
|
+
version: "3.0.11"
|
|
17660
17704
|
});
|
|
17661
17705
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17662
17706
|
return true;
|
|
@@ -20637,8 +20681,8 @@ function getFilterOperatorMenuForColumn(columnId, context, onHideIntent) {
|
|
|
20637
20681
|
}
|
|
20638
20682
|
},
|
|
20639
20683
|
{
|
|
20640
|
-
key: "
|
|
20641
|
-
label: "
|
|
20684
|
+
key: "reset",
|
|
20685
|
+
label: "Reset",
|
|
20642
20686
|
icon: /* @__PURE__ */ React62.createElement(ClearIcon, null),
|
|
20643
20687
|
disabled: !column.computedFiltered,
|
|
20644
20688
|
onAction: () => {
|