@infinite-table/infinite-react 9.1.0 → 9.1.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.dev.js +189 -79
- package/index.dev.mjs +189 -79
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.js
CHANGED
|
@@ -2720,6 +2720,27 @@ function resizeClamp(value, min, max, direction) {
|
|
|
2720
2720
|
}
|
|
2721
2721
|
return { value, clamped: false, diff: 0 };
|
|
2722
2722
|
}
|
|
2723
|
+
function hasFlexDeficit(items, availableSize, reservedWidth) {
|
|
2724
|
+
let hasFlex = false;
|
|
2725
|
+
let totalWidth = 0;
|
|
2726
|
+
for (const item of items) {
|
|
2727
|
+
if (item.computedFlex) {
|
|
2728
|
+
hasFlex = true;
|
|
2729
|
+
}
|
|
2730
|
+
totalWidth += item.computedWidth;
|
|
2731
|
+
}
|
|
2732
|
+
return hasFlex && Math.round(totalWidth) > Math.round(availableSize - reservedWidth);
|
|
2733
|
+
}
|
|
2734
|
+
function getResizeSizingProperty(item, flexDeficit) {
|
|
2735
|
+
return item.computedFlex && !flexDeficit ? "flex" : "width";
|
|
2736
|
+
}
|
|
2737
|
+
function withResizedSize(entry, property, size) {
|
|
2738
|
+
if (property === "width") {
|
|
2739
|
+
const { flex: _flex, ...rest } = entry ?? {};
|
|
2740
|
+
return { ...rest, width: size };
|
|
2741
|
+
}
|
|
2742
|
+
return { ...entry, flex: size };
|
|
2743
|
+
}
|
|
2723
2744
|
var computeResize = (params) => {
|
|
2724
2745
|
const { availableSize, reservedWidth = 0 } = params;
|
|
2725
2746
|
const columnSizing = Object.keys(
|
|
@@ -2738,14 +2759,19 @@ var computeResize = (params) => {
|
|
|
2738
2759
|
const secondItem = params.items[secondIndex];
|
|
2739
2760
|
const firstId = firstItem.id;
|
|
2740
2761
|
const secondId = secondItem?.id;
|
|
2762
|
+
const flexDeficit = hasFlexDeficit(
|
|
2763
|
+
params.items,
|
|
2764
|
+
availableSize,
|
|
2765
|
+
reservedWidth
|
|
2766
|
+
);
|
|
2741
2767
|
const firstSize = firstItem.computedWidth;
|
|
2742
2768
|
const firstMinSize = firstItem.computedMinWidth;
|
|
2743
2769
|
const firstMaxSize = firstItem.computedMaxWidth;
|
|
2744
|
-
const firstPropertyToAdjust = firstItem
|
|
2770
|
+
const firstPropertyToAdjust = getResizeSizingProperty(firstItem, flexDeficit);
|
|
2745
2771
|
const secondSize = secondItem?.computedWidth;
|
|
2746
2772
|
const secondMinSize = secondItem?.computedMinWidth;
|
|
2747
2773
|
const secondMaxSize = secondItem?.computedMaxWidth;
|
|
2748
|
-
const secondPropertyToAdjust = secondItem
|
|
2774
|
+
const secondPropertyToAdjust = secondItem ? getResizeSizingProperty(secondItem, flexDeficit) : "width";
|
|
2749
2775
|
let maxReached = false;
|
|
2750
2776
|
let minReached = false;
|
|
2751
2777
|
const direction = dragHandleOffset > 0 ? 1 : -1;
|
|
@@ -2754,17 +2780,18 @@ var computeResize = (params) => {
|
|
|
2754
2780
|
clamped: firstClamped,
|
|
2755
2781
|
diff: firstDiff
|
|
2756
2782
|
} = resizeClamp(
|
|
2757
|
-
firstSize + dragHandleOffset,
|
|
2783
|
+
Math.round(firstSize + dragHandleOffset),
|
|
2758
2784
|
firstMinSize,
|
|
2759
2785
|
firstMaxSize,
|
|
2760
2786
|
direction
|
|
2761
2787
|
);
|
|
2762
2788
|
if (params.shareSpaceOnResize) {
|
|
2763
2789
|
if (secondItem == null) {
|
|
2764
|
-
columnSizing[firstId] =
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2790
|
+
columnSizing[firstId] = withResizedSize(
|
|
2791
|
+
columnSizing[firstId],
|
|
2792
|
+
firstPropertyToAdjust,
|
|
2793
|
+
firstAdjustedSize
|
|
2794
|
+
);
|
|
2768
2795
|
minReached = firstClamped === "min";
|
|
2769
2796
|
maxReached = firstClamped === "max";
|
|
2770
2797
|
const adjustedDiff2 = firstAdjustedSize - firstSize;
|
|
@@ -2782,7 +2809,7 @@ var computeResize = (params) => {
|
|
|
2782
2809
|
clamped: secondClamped,
|
|
2783
2810
|
diff: secondDiff
|
|
2784
2811
|
} = resizeClamp(
|
|
2785
|
-
secondSize - dragHandleOffset,
|
|
2812
|
+
Math.round(secondSize - dragHandleOffset),
|
|
2786
2813
|
secondMinSize,
|
|
2787
2814
|
secondMaxSize,
|
|
2788
2815
|
direction
|
|
@@ -2797,7 +2824,7 @@ var computeResize = (params) => {
|
|
|
2797
2824
|
if (!firstClamped && !secondClamped) {
|
|
2798
2825
|
} else if (firstClamped) {
|
|
2799
2826
|
const clampResultForSecond = resizeClamp(
|
|
2800
|
-
secondSize - dragHandleOffset - firstDiff,
|
|
2827
|
+
Math.round(secondSize - dragHandleOffset - firstDiff),
|
|
2801
2828
|
secondMinSize,
|
|
2802
2829
|
secondMaxSize,
|
|
2803
2830
|
direction
|
|
@@ -2807,7 +2834,7 @@ var computeResize = (params) => {
|
|
|
2807
2834
|
secondDiff = clampResultForSecond.diff;
|
|
2808
2835
|
} else if (secondClamped) {
|
|
2809
2836
|
const clampResultForFirst = resizeClamp(
|
|
2810
|
-
firstSize + dragHandleOffset + secondDiff,
|
|
2837
|
+
Math.round(firstSize + dragHandleOffset + secondDiff),
|
|
2811
2838
|
firstMinSize,
|
|
2812
2839
|
firstMaxSize,
|
|
2813
2840
|
direction
|
|
@@ -2816,28 +2843,31 @@ var computeResize = (params) => {
|
|
|
2816
2843
|
firstClamped = clampResultForFirst.clamped;
|
|
2817
2844
|
firstDiff = clampResultForFirst.diff;
|
|
2818
2845
|
}
|
|
2819
|
-
columnSizing[firstId] =
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
[
|
|
2826
|
-
|
|
2846
|
+
columnSizing[firstId] = withResizedSize(
|
|
2847
|
+
columnSizing[firstId],
|
|
2848
|
+
firstPropertyToAdjust,
|
|
2849
|
+
firstAdjustedSize
|
|
2850
|
+
);
|
|
2851
|
+
columnSizing[secondId] = withResizedSize(
|
|
2852
|
+
columnSizing[secondId],
|
|
2853
|
+
secondPropertyToAdjust,
|
|
2854
|
+
secondAdjustedSize
|
|
2855
|
+
);
|
|
2827
2856
|
minReached = firstClamped === "min" || secondClamped === "min";
|
|
2828
2857
|
maxReached = firstClamped === "max" || secondClamped === "max";
|
|
2829
2858
|
} else {
|
|
2830
|
-
columnSizing[firstId] =
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2859
|
+
columnSizing[firstId] = withResizedSize(
|
|
2860
|
+
columnSizing[firstId],
|
|
2861
|
+
firstPropertyToAdjust,
|
|
2862
|
+
firstAdjustedSize
|
|
2863
|
+
);
|
|
2834
2864
|
minReached = firstClamped === "min";
|
|
2835
2865
|
maxReached = firstClamped === "max";
|
|
2836
2866
|
}
|
|
2837
2867
|
const adjustedDiff = firstAdjustedSize - firstSize;
|
|
2838
2868
|
return {
|
|
2839
2869
|
adjustedDiff,
|
|
2840
|
-
reservedWidth: !params.shareSpaceOnResize ? reservedWidth - adjustedDiff : reservedWidth,
|
|
2870
|
+
reservedWidth: !params.shareSpaceOnResize ? Math.round(reservedWidth - adjustedDiff) : reservedWidth,
|
|
2841
2871
|
columnSizing,
|
|
2842
2872
|
minReached,
|
|
2843
2873
|
maxReached,
|
|
@@ -2871,8 +2901,13 @@ var computeGroupResize = (params) => {
|
|
|
2871
2901
|
const beforeIndexes = [...new Array(params.columnGroupSize)].map((_, index) => params.dragHandlePositionAfter - index).reverse();
|
|
2872
2902
|
const beforeItems = beforeIndexes.map((i) => params.items[i]);
|
|
2873
2903
|
const beforeSizes = beforeItems.map((item) => item.computedWidth);
|
|
2904
|
+
const flexDeficit = hasFlexDeficit(
|
|
2905
|
+
params.items,
|
|
2906
|
+
availableSize,
|
|
2907
|
+
reservedWidth
|
|
2908
|
+
);
|
|
2874
2909
|
const beforePropertiesToAdjust = beforeItems.map(
|
|
2875
|
-
(item) => item
|
|
2910
|
+
(item) => getResizeSizingProperty(item, flexDeficit)
|
|
2876
2911
|
);
|
|
2877
2912
|
let unresizableWidth = 0;
|
|
2878
2913
|
const { computedSizes } = computeFlex({
|
|
@@ -2921,10 +2956,11 @@ var computeGroupResize = (params) => {
|
|
|
2921
2956
|
columnSizing: currentColumnSizing
|
|
2922
2957
|
}
|
|
2923
2958
|
);
|
|
2924
|
-
columnSizing[item.id] =
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2959
|
+
columnSizing[item.id] = withResizedSize(
|
|
2960
|
+
currentColumnSizing[item.id],
|
|
2961
|
+
propertyToAdjust,
|
|
2962
|
+
Math.round(itemSize + adjustedDiff2)
|
|
2963
|
+
);
|
|
2928
2964
|
adjustedDiffs.push(adjustedDiff2);
|
|
2929
2965
|
if (!maxReached) {
|
|
2930
2966
|
groupMaxReached = false;
|
|
@@ -2944,7 +2980,7 @@ var computeGroupResize = (params) => {
|
|
|
2944
2980
|
adjustedDiffs,
|
|
2945
2981
|
adjustedDiff,
|
|
2946
2982
|
columnSizing,
|
|
2947
|
-
reservedWidth: reservedWidth - adjustedDiff
|
|
2983
|
+
reservedWidth: Math.round(reservedWidth - adjustedDiff)
|
|
2948
2984
|
};
|
|
2949
2985
|
};
|
|
2950
2986
|
|
|
@@ -3187,15 +3223,20 @@ var getComputedColumns = ({
|
|
|
3187
3223
|
width: colType?.defaultWidth,
|
|
3188
3224
|
flex: colType?.defaultFlex
|
|
3189
3225
|
};
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3226
|
+
const colDefaultSizing = {
|
|
3227
|
+
width: column?.defaultWidth,
|
|
3228
|
+
flex: column?.defaultFlex,
|
|
3229
|
+
minWidth: column?.minWidth,
|
|
3230
|
+
maxWidth: column?.maxWidth
|
|
3231
|
+
};
|
|
3232
|
+
const colSizingFromProp = columnSizing[colId];
|
|
3233
|
+
if (colSizingFromProp?.width != null && colSizingFromProp.flex == null) {
|
|
3234
|
+
delete colDefaultSizing.flex;
|
|
3235
|
+
}
|
|
3236
|
+
if (colSizingFromProp?.flex != null && colSizingFromProp.width == null) {
|
|
3237
|
+
delete colDefaultSizing.width;
|
|
3238
|
+
}
|
|
3239
|
+
let colSizing = assignNonNull(colDefaultSizing, colSizingFromProp);
|
|
3199
3240
|
if (colSizing.width != null) {
|
|
3200
3241
|
delete colTypeSizing.flex;
|
|
3201
3242
|
}
|
|
@@ -8111,6 +8152,9 @@ var React30 = __toESM(require("react"));
|
|
|
8111
8152
|
var import_react23 = require("react");
|
|
8112
8153
|
|
|
8113
8154
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizeShared.ts
|
|
8155
|
+
function getResizeAvailableSize(bodySize) {
|
|
8156
|
+
return Math.max(bodySize.width - getScrollbarWidth(), 0);
|
|
8157
|
+
}
|
|
8114
8158
|
function computeColumnResizeForDiff(options) {
|
|
8115
8159
|
const { context, column, diff, shareSpaceOnResize } = options;
|
|
8116
8160
|
const state = context.getState();
|
|
@@ -8133,7 +8177,7 @@ function computeColumnResizeForDiff(options) {
|
|
|
8133
8177
|
} : columnSizing;
|
|
8134
8178
|
return computeResize({
|
|
8135
8179
|
shareSpaceOnResize,
|
|
8136
|
-
availableSize: bodySize
|
|
8180
|
+
availableSize: getResizeAvailableSize(bodySize),
|
|
8137
8181
|
reservedWidth: viewportReservedWidth || 0,
|
|
8138
8182
|
dragHandleOffset: diff,
|
|
8139
8183
|
dragHandlePositionAfter: column.computedVisibleIndex,
|
|
@@ -8362,6 +8406,7 @@ function ResizeHandleFn(props) {
|
|
|
8362
8406
|
const diff = Math.round(e2.clientX - initialX);
|
|
8363
8407
|
const adjustedDiff = resizeDiff(diff, { done: true });
|
|
8364
8408
|
restoreRenderRange();
|
|
8409
|
+
resizer.resize(0);
|
|
8365
8410
|
props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
|
|
8366
8411
|
};
|
|
8367
8412
|
target.addEventListener("pointermove", onPointerMove);
|
|
@@ -13771,6 +13816,7 @@ function GroupResizeHandleFn(props) {
|
|
|
13771
13816
|
target.removeEventListener("pointerup", onPointerUp);
|
|
13772
13817
|
const diff = Math.round(e2.clientX - initialX);
|
|
13773
13818
|
const adjustedDiffs = resizeDiff(diff);
|
|
13819
|
+
resizer.resize(props.groupColumns.map(() => 0));
|
|
13774
13820
|
props.onResize(adjustedDiffs);
|
|
13775
13821
|
};
|
|
13776
13822
|
target.addEventListener("pointermove", onPointerMove);
|
|
@@ -13840,7 +13886,7 @@ function useColumnGroupResizeHandle(groupColumns, config) {
|
|
|
13840
13886
|
...columnSizingWithFlex
|
|
13841
13887
|
} : columnSizing;
|
|
13842
13888
|
const result = computeGroupResize({
|
|
13843
|
-
availableSize: bodySize
|
|
13889
|
+
availableSize: getResizeAvailableSize(bodySize),
|
|
13844
13890
|
reservedWidth: viewportReservedWidth || 0,
|
|
13845
13891
|
dragHandleOffset: diff,
|
|
13846
13892
|
dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
|
|
@@ -22491,6 +22537,40 @@ function lazyLoadRange(options, cache) {
|
|
|
22491
22537
|
}, initialPromise);
|
|
22492
22538
|
}
|
|
22493
22539
|
|
|
22540
|
+
// src/components/InfiniteTable/utils/getEditingCellContext.ts
|
|
22541
|
+
function resolveEditingCellRowIndex(context, editingCell) {
|
|
22542
|
+
const { rowIndex, primaryKey } = editingCell;
|
|
22543
|
+
const { dataArray } = context.getDataSourceState();
|
|
22544
|
+
if (primaryKey !== void 0) {
|
|
22545
|
+
const indexByKey = context.dataSourceApi.getIndexByPrimaryKey(primaryKey);
|
|
22546
|
+
if (indexByKey !== -1) {
|
|
22547
|
+
return indexByKey;
|
|
22548
|
+
}
|
|
22549
|
+
if (dataArray[rowIndex]?.id !== primaryKey) {
|
|
22550
|
+
return -1;
|
|
22551
|
+
}
|
|
22552
|
+
}
|
|
22553
|
+
return dataArray[rowIndex] ? rowIndex : -1;
|
|
22554
|
+
}
|
|
22555
|
+
function getEditingCellContext(context, editingCell) {
|
|
22556
|
+
const rowIndex = resolveEditingCellRowIndex(context, editingCell);
|
|
22557
|
+
if (rowIndex === -1) {
|
|
22558
|
+
return null;
|
|
22559
|
+
}
|
|
22560
|
+
return getCellContext({
|
|
22561
|
+
...context,
|
|
22562
|
+
rowIndex,
|
|
22563
|
+
columnId: editingCell.columnId
|
|
22564
|
+
});
|
|
22565
|
+
}
|
|
22566
|
+
function warnEditedRowGone(callbackName, editingCell) {
|
|
22567
|
+
console.warn(
|
|
22568
|
+
`Skipping "${callbackName}": the edited row (primaryKey: ${String(
|
|
22569
|
+
editingCell.primaryKey
|
|
22570
|
+
)}, rowIndex: ${editingCell.rowIndex}) is no longer in the data array.`
|
|
22571
|
+
);
|
|
22572
|
+
}
|
|
22573
|
+
|
|
22494
22574
|
// src/components/InfiniteTable/api/realignColumnContextMenu.ts
|
|
22495
22575
|
function realignColumnContextMenu(param) {
|
|
22496
22576
|
const { getComputed, getState, actions } = param;
|
|
@@ -23367,9 +23447,28 @@ var InfiniteTableApiImpl = class {
|
|
|
23367
23447
|
waiting: "persist"
|
|
23368
23448
|
};
|
|
23369
23449
|
}
|
|
23450
|
+
const rowIndex = resolveEditingCellRowIndex(
|
|
23451
|
+
{ ...this.context, api: this },
|
|
23452
|
+
editingCell
|
|
23453
|
+
);
|
|
23454
|
+
if (rowIndex === -1) {
|
|
23455
|
+
const error4 = new Error(
|
|
23456
|
+
`Cannot persist edit: the edited row (primaryKey: ${String(
|
|
23457
|
+
editingCell.primaryKey
|
|
23458
|
+
)}, rowIndex: ${editingCell.rowIndex}) is no longer in the data array.`
|
|
23459
|
+
);
|
|
23460
|
+
this.actions.editingCell = {
|
|
23461
|
+
...editingCell,
|
|
23462
|
+
active: false,
|
|
23463
|
+
accepted: false,
|
|
23464
|
+
waiting: false,
|
|
23465
|
+
persisted: error4
|
|
23466
|
+
};
|
|
23467
|
+
return Promise.resolve(error4);
|
|
23468
|
+
}
|
|
23370
23469
|
const params = {
|
|
23371
23470
|
...getCellContext({
|
|
23372
|
-
rowIndex
|
|
23471
|
+
rowIndex,
|
|
23373
23472
|
columnId: editingCell.columnId,
|
|
23374
23473
|
...this.context,
|
|
23375
23474
|
api: this
|
|
@@ -27758,7 +27857,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
27758
27857
|
}
|
|
27759
27858
|
let valid2 = isValidLicense(licenseKey, {
|
|
27760
27859
|
publishedAt: 1624970570587,
|
|
27761
|
-
version: "9.1.
|
|
27860
|
+
version: "9.1.2"
|
|
27762
27861
|
});
|
|
27763
27862
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
27764
27863
|
return true;
|
|
@@ -30403,15 +30502,19 @@ function useOnEditCancelled() {
|
|
|
30403
30502
|
const cancelled = editingCell && !editingCell.active ? editingCell.cancelled : void 0;
|
|
30404
30503
|
(0, import_react61.useEffect)(() => {
|
|
30405
30504
|
if (cancelled) {
|
|
30406
|
-
const { rowIndex, columnId, initialValue } = getState().editingCell;
|
|
30407
30505
|
const { onEditCancelled } = getState();
|
|
30408
|
-
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30414
|
-
|
|
30506
|
+
const editingCell2 = getState().editingCell;
|
|
30507
|
+
if (!onEditCancelled) {
|
|
30508
|
+
return;
|
|
30509
|
+
}
|
|
30510
|
+
const cellContext = getEditingCellContext(context, editingCell2);
|
|
30511
|
+
if (!cellContext) {
|
|
30512
|
+
warnEditedRowGone("onEditCancelled", editingCell2);
|
|
30513
|
+
return;
|
|
30514
|
+
}
|
|
30515
|
+
onEditCancelled({
|
|
30516
|
+
...cellContext,
|
|
30517
|
+
initialValue: editingCell2.initialValue
|
|
30415
30518
|
});
|
|
30416
30519
|
}
|
|
30417
30520
|
}, [cancelled]);
|
|
@@ -30427,17 +30530,21 @@ function useOnEditRejected() {
|
|
|
30427
30530
|
const rejected = editingCell && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0;
|
|
30428
30531
|
(0, import_react61.useEffect)(() => {
|
|
30429
30532
|
if (rejected) {
|
|
30430
|
-
const { rowIndex, columnId, value, initialValue } = getState().editingCell;
|
|
30431
30533
|
const { onEditRejected } = getState();
|
|
30432
|
-
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30534
|
+
const editingCell2 = getState().editingCell;
|
|
30535
|
+
if (!onEditRejected) {
|
|
30536
|
+
return;
|
|
30537
|
+
}
|
|
30538
|
+
const cellContext = getEditingCellContext(context, editingCell2);
|
|
30539
|
+
if (!cellContext) {
|
|
30540
|
+
warnEditedRowGone("onEditRejected", editingCell2);
|
|
30541
|
+
return;
|
|
30542
|
+
}
|
|
30543
|
+
onEditRejected({
|
|
30544
|
+
...cellContext,
|
|
30545
|
+
value: editingCell2.value,
|
|
30439
30546
|
error: rejected,
|
|
30440
|
-
initialValue
|
|
30547
|
+
initialValue: editingCell2.initialValue
|
|
30441
30548
|
});
|
|
30442
30549
|
}
|
|
30443
30550
|
}, [rejected]);
|
|
@@ -30468,18 +30575,17 @@ function useOnEditAccepted() {
|
|
|
30468
30575
|
const accepted = editingCell && !editingCell.active && !editingCell.cancelled && editingCell.accepted === true;
|
|
30469
30576
|
(0, import_react61.useEffect)(() => {
|
|
30470
30577
|
if (accepted) {
|
|
30471
|
-
const {
|
|
30472
|
-
const
|
|
30473
|
-
const
|
|
30474
|
-
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
...
|
|
30478
|
-
}
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
}
|
|
30482
|
-
getState().onEditAccepted?.(editParams);
|
|
30578
|
+
const { onEditAccepted } = getState();
|
|
30579
|
+
const editingCell2 = getState().editingCell;
|
|
30580
|
+
const { value, initialValue } = editingCell2;
|
|
30581
|
+
if (onEditAccepted) {
|
|
30582
|
+
const cellContext = getEditingCellContext(context, editingCell2);
|
|
30583
|
+
if (cellContext) {
|
|
30584
|
+
onEditAccepted({ ...cellContext, value, initialValue });
|
|
30585
|
+
} else {
|
|
30586
|
+
warnEditedRowGone("onEditAccepted", editingCell2);
|
|
30587
|
+
}
|
|
30588
|
+
}
|
|
30483
30589
|
context.api.persistEdit({ value });
|
|
30484
30590
|
}
|
|
30485
30591
|
}, [accepted]);
|
|
@@ -30499,15 +30605,19 @@ function useOnEditPersisted() {
|
|
|
30499
30605
|
if (!editingCell2) {
|
|
30500
30606
|
return;
|
|
30501
30607
|
}
|
|
30502
|
-
const
|
|
30608
|
+
const callbackName = persisted instanceof Error ? "onEditPersistError" : "onEditPersistSuccess";
|
|
30609
|
+
if (!getState()[callbackName]) {
|
|
30610
|
+
return;
|
|
30611
|
+
}
|
|
30612
|
+
const cellContext = getEditingCellContext(context, editingCell2);
|
|
30613
|
+
if (!cellContext) {
|
|
30614
|
+
warnEditedRowGone(callbackName, editingCell2);
|
|
30615
|
+
return;
|
|
30616
|
+
}
|
|
30503
30617
|
const params = {
|
|
30504
|
-
...
|
|
30505
|
-
|
|
30506
|
-
|
|
30507
|
-
...context
|
|
30508
|
-
}),
|
|
30509
|
-
value,
|
|
30510
|
-
initialValue
|
|
30618
|
+
...cellContext,
|
|
30619
|
+
value: editingCell2.value,
|
|
30620
|
+
initialValue: editingCell2.initialValue
|
|
30511
30621
|
};
|
|
30512
30622
|
if (persisted instanceof Error) {
|
|
30513
30623
|
onEditPersistError?.({ ...params, error: persisted });
|