@infinite-table/infinite-react 2.0.0 → 2.0.2
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 +6 -5
- package/index.dev.js +19 -4
- package/index.dev.mjs +19 -4
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1537,7 +1537,7 @@ declare type DataSourceRawReducer<T, RESULT_TYPE> = {
|
|
|
1537
1537
|
declare type DataSourceAggregationReducer<T, AggregationResultType> = {
|
|
1538
1538
|
name?: string;
|
|
1539
1539
|
field?: keyof T;
|
|
1540
|
-
initialValue?: AggregationResultType;
|
|
1540
|
+
initialValue?: AggregationResultType | (() => any);
|
|
1541
1541
|
getter?: (data: T) => any;
|
|
1542
1542
|
reducer: string | ((accumulator: any, value: any, data: T, index: number, groupKeys: any[] | undefined) => AggregationResultType | any);
|
|
1543
1543
|
done?: (accumulatedValue: AggregationResultType | any, array: T[]) => AggregationResultType;
|
|
@@ -1890,6 +1890,7 @@ declare type InfiniteTable_HasGrouping_RowInfoNormal<T> = {
|
|
|
1890
1890
|
declare type InfiniteTable_HasGrouping_RowInfoGroup<T> = {
|
|
1891
1891
|
dataSourceHasGrouping: true;
|
|
1892
1892
|
data: Partial<T> | null;
|
|
1893
|
+
reducerData?: Partial<Record<keyof T, any>>;
|
|
1893
1894
|
isGroupRow: true;
|
|
1894
1895
|
/**
|
|
1895
1896
|
* This array contains all the (uncollapsed, so visible) row infos under this group, at any level of nesting,
|
|
@@ -2560,8 +2561,8 @@ declare type InfiniteTableRowInfoDataDiscriminatorWithColumnAndApis<T> = {
|
|
|
2560
2561
|
api: InfiniteTableApi<T>;
|
|
2561
2562
|
dataSourceApi: DataSourceApi<T>;
|
|
2562
2563
|
} & InfiniteTableRowInfoDataDiscriminatorWithColumn<T>;
|
|
2563
|
-
declare type
|
|
2564
|
-
declare type
|
|
2564
|
+
declare type InfiniteTablePropEditable<T> = InfiniteTableColumnEditableFn<T> | undefined;
|
|
2565
|
+
declare type InfiniteTablePropSortable<T> = InfiniteTableColumnSortable<T> | undefined;
|
|
2565
2566
|
declare type InfiniteTablePropOnEditAcceptedParams<T> = InfiniteTableRowInfoDataDiscriminatorWithColumnAndApis<T> & {
|
|
2566
2567
|
initialValue: any;
|
|
2567
2568
|
};
|
|
@@ -2593,11 +2594,11 @@ interface InfiniteTableProps<T> {
|
|
|
2593
2594
|
* This overrides both the global `columnDefaultSortable` prop and the column's own `defaultSortable` prop.
|
|
2594
2595
|
* When used, it's the ultimate source of truth for whether (and which) columns are sortable.
|
|
2595
2596
|
*/
|
|
2596
|
-
sortable?:
|
|
2597
|
+
sortable?: InfiniteTablePropSortable<T>;
|
|
2597
2598
|
/**
|
|
2598
2599
|
* This overrides both the global `columnDefaultEditable` prop and the column's own `defaultEditable` prop.
|
|
2599
2600
|
*/
|
|
2600
|
-
editable?:
|
|
2601
|
+
editable?: InfiniteTablePropEditable<T>;
|
|
2601
2602
|
pivotTotalColumnPosition?: InfiniteTablePropPivotTotalColumnPosition;
|
|
2602
2603
|
pivotGrandTotalColumnPosition?: InfiniteTablePropPivotGrandTotalColumnPosition;
|
|
2603
2604
|
groupColumn?: InfiniteTablePropGroupColumn<T>;
|
package/index.dev.js
CHANGED
|
@@ -8034,6 +8034,9 @@ function getRawValueForCell(column, rowInfo) {
|
|
|
8034
8034
|
let value = isGroupRow && groupBy && column.groupByForColumn && // if this is a multi-group column we're good
|
|
8035
8035
|
(Array.isArray(column.groupByForColumn) || // or it has to be a group column for the current group row
|
|
8036
8036
|
column.groupByForColumn === groupBy[groupBy.length - 1]) ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
8037
|
+
if (column.field && rowInfo.isGroupRow && rowInfo.reducerData && rowInfo.reducerData[column.field] != null) {
|
|
8038
|
+
value = rowInfo.reducerData[column.field];
|
|
8039
|
+
}
|
|
8037
8040
|
if (column.valueGetter) {
|
|
8038
8041
|
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
8039
8042
|
value = column.valueGetter({ data: rowInfo.data, field: column.field });
|
|
@@ -9070,11 +9073,14 @@ var columnZIndexAtIndex5 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
|
9070
9073
|
var spacer = /* @__PURE__ */ React42.createElement("div", { className: flex["1"] });
|
|
9071
9074
|
var InfiniteHeaderCellDataAttributes = keyMirror({
|
|
9072
9075
|
"data-name": ``,
|
|
9076
|
+
"data-field": ``,
|
|
9073
9077
|
"data-header-align": "",
|
|
9074
|
-
"data-column-id": ""
|
|
9078
|
+
"data-column-id": "",
|
|
9079
|
+
"data-sort": "",
|
|
9080
|
+
"data-sort-index": ""
|
|
9075
9081
|
});
|
|
9076
9082
|
function InfiniteTableHeaderCell(props) {
|
|
9077
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
9083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
9078
9084
|
const column = props.column;
|
|
9079
9085
|
const {
|
|
9080
9086
|
api,
|
|
@@ -9353,9 +9359,12 @@ function InfiniteTableHeaderCell(props) {
|
|
|
9353
9359
|
const zIndex2 = `var(${columnZIndexAtIndex5}-${column.computedVisibleIndex})`;
|
|
9354
9360
|
style2.zIndex = zIndex2;
|
|
9355
9361
|
const dataAttrs = {
|
|
9362
|
+
"data-field": `${column.field || ""}`,
|
|
9356
9363
|
"data-column-id": column.id,
|
|
9357
9364
|
"data-header-align": align2,
|
|
9358
|
-
"data-name": "HeaderCell"
|
|
9365
|
+
"data-name": "HeaderCell",
|
|
9366
|
+
"data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
|
|
9367
|
+
"data-sort-index": `${(_p = column.computedSortIndex) != null ? _p : -1}`
|
|
9359
9368
|
};
|
|
9360
9369
|
return /* @__PURE__ */ React42.createElement(ContextProvider, { value: renderParam }, /* @__PURE__ */ React42.createElement(
|
|
9361
9370
|
InfiniteTableCell,
|
|
@@ -10568,12 +10577,17 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
10568
10577
|
commonData
|
|
10569
10578
|
} = deepMapValue;
|
|
10570
10579
|
let data = commonData != null ? commonData : null;
|
|
10580
|
+
let reducerData;
|
|
10571
10581
|
if (Object.keys(reducerResults).length > 0) {
|
|
10572
10582
|
data = __spreadValues({}, commonData);
|
|
10583
|
+
reducerData = {};
|
|
10573
10584
|
for (const key in reducers)
|
|
10574
10585
|
if (reducers.hasOwnProperty(key)) {
|
|
10575
10586
|
const reducer = reducers[key];
|
|
10576
10587
|
const field = reducer.field;
|
|
10588
|
+
if (field) {
|
|
10589
|
+
reducerData[field] = reducerResults[key];
|
|
10590
|
+
}
|
|
10577
10591
|
if (field && data[field] == null) {
|
|
10578
10592
|
data[field] = reducerResults[key];
|
|
10579
10593
|
}
|
|
@@ -10598,6 +10612,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
10598
10612
|
}
|
|
10599
10613
|
const enhancedGroupData = {
|
|
10600
10614
|
data,
|
|
10615
|
+
reducerData,
|
|
10601
10616
|
groupCount: groupItems.length,
|
|
10602
10617
|
groupData: groupItems,
|
|
10603
10618
|
groupKeys,
|
|
@@ -16750,7 +16765,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16750
16765
|
const valid = (0, import_react49.useMemo)(() => {
|
|
16751
16766
|
let valid2 = isValidLicense(licenseKey, {
|
|
16752
16767
|
publishedAt: 1624970570587,
|
|
16753
|
-
version: "2.0.
|
|
16768
|
+
version: "2.0.2"
|
|
16754
16769
|
});
|
|
16755
16770
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16756
16771
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -8020,6 +8020,9 @@ function getRawValueForCell(column, rowInfo) {
|
|
|
8020
8020
|
let value = isGroupRow && groupBy && column.groupByForColumn && // if this is a multi-group column we're good
|
|
8021
8021
|
(Array.isArray(column.groupByForColumn) || // or it has to be a group column for the current group row
|
|
8022
8022
|
column.groupByForColumn === groupBy[groupBy.length - 1]) ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
8023
|
+
if (column.field && rowInfo.isGroupRow && rowInfo.reducerData && rowInfo.reducerData[column.field] != null) {
|
|
8024
|
+
value = rowInfo.reducerData[column.field];
|
|
8025
|
+
}
|
|
8023
8026
|
if (column.valueGetter) {
|
|
8024
8027
|
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
8025
8028
|
value = column.valueGetter({ data: rowInfo.data, field: column.field });
|
|
@@ -9056,11 +9059,14 @@ var columnZIndexAtIndex5 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
|
9056
9059
|
var spacer = /* @__PURE__ */ React42.createElement("div", { className: flex["1"] });
|
|
9057
9060
|
var InfiniteHeaderCellDataAttributes = keyMirror({
|
|
9058
9061
|
"data-name": ``,
|
|
9062
|
+
"data-field": ``,
|
|
9059
9063
|
"data-header-align": "",
|
|
9060
|
-
"data-column-id": ""
|
|
9064
|
+
"data-column-id": "",
|
|
9065
|
+
"data-sort": "",
|
|
9066
|
+
"data-sort-index": ""
|
|
9061
9067
|
});
|
|
9062
9068
|
function InfiniteTableHeaderCell(props) {
|
|
9063
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
9069
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
9064
9070
|
const column = props.column;
|
|
9065
9071
|
const {
|
|
9066
9072
|
api,
|
|
@@ -9339,9 +9345,12 @@ function InfiniteTableHeaderCell(props) {
|
|
|
9339
9345
|
const zIndex2 = `var(${columnZIndexAtIndex5}-${column.computedVisibleIndex})`;
|
|
9340
9346
|
style2.zIndex = zIndex2;
|
|
9341
9347
|
const dataAttrs = {
|
|
9348
|
+
"data-field": `${column.field || ""}`,
|
|
9342
9349
|
"data-column-id": column.id,
|
|
9343
9350
|
"data-header-align": align2,
|
|
9344
|
-
"data-name": "HeaderCell"
|
|
9351
|
+
"data-name": "HeaderCell",
|
|
9352
|
+
"data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
|
|
9353
|
+
"data-sort-index": `${(_p = column.computedSortIndex) != null ? _p : -1}`
|
|
9345
9354
|
};
|
|
9346
9355
|
return /* @__PURE__ */ React42.createElement(ContextProvider, { value: renderParam }, /* @__PURE__ */ React42.createElement(
|
|
9347
9356
|
InfiniteTableCell,
|
|
@@ -10554,12 +10563,17 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
10554
10563
|
commonData
|
|
10555
10564
|
} = deepMapValue;
|
|
10556
10565
|
let data = commonData != null ? commonData : null;
|
|
10566
|
+
let reducerData;
|
|
10557
10567
|
if (Object.keys(reducerResults).length > 0) {
|
|
10558
10568
|
data = __spreadValues({}, commonData);
|
|
10569
|
+
reducerData = {};
|
|
10559
10570
|
for (const key in reducers)
|
|
10560
10571
|
if (reducers.hasOwnProperty(key)) {
|
|
10561
10572
|
const reducer = reducers[key];
|
|
10562
10573
|
const field = reducer.field;
|
|
10574
|
+
if (field) {
|
|
10575
|
+
reducerData[field] = reducerResults[key];
|
|
10576
|
+
}
|
|
10563
10577
|
if (field && data[field] == null) {
|
|
10564
10578
|
data[field] = reducerResults[key];
|
|
10565
10579
|
}
|
|
@@ -10584,6 +10598,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
10584
10598
|
}
|
|
10585
10599
|
const enhancedGroupData = {
|
|
10586
10600
|
data,
|
|
10601
|
+
reducerData,
|
|
10587
10602
|
groupCount: groupItems.length,
|
|
10588
10603
|
groupData: groupItems,
|
|
10589
10604
|
groupKeys,
|
|
@@ -16740,7 +16755,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
16740
16755
|
const valid = useMemo11(() => {
|
|
16741
16756
|
let valid2 = isValidLicense(licenseKey, {
|
|
16742
16757
|
publishedAt: 1624970570587,
|
|
16743
|
-
version: "2.0.
|
|
16758
|
+
version: "2.0.2"
|
|
16744
16759
|
});
|
|
16745
16760
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
16746
16761
|
return true;
|