@adaptabletools/adaptable 23.0.6 → 23.0.7
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/package.json +1 -1
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +7 -0
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +1 -0
- package/src/AdaptableOptions/WizardOptions.d.ts +0 -1
- package/src/Api/Implementation/DataChangeHistoryApiImpl.js +10 -9
- package/src/Redux/ActionsReducers/InternalRedux.d.ts +2 -1
- package/src/Redux/ActionsReducers/InternalRedux.js +25 -27
- package/src/Strategy/DataChangeHistoryModule.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +3 -4
- package/src/View/DataChangeHistory/dataChangeHistoryHelpers.js +1 -1
- package/src/components/ui/input-group.js +0 -1
- package/src/env.js +2 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -28,6 +28,13 @@ export interface DataChangeHistoryOptions<TData = any> {
|
|
|
28
28
|
* @defaultValue true
|
|
29
29
|
*/
|
|
30
30
|
showLastDataChangeOnly?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* How many data changes are held in State at any one time; when the limit is breached, the oldest change(s) are evicted from memory
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue undefined (all data changes are logged)
|
|
35
|
+
* @noCodeItem
|
|
36
|
+
*/
|
|
37
|
+
maxDataChangesInStore?: number;
|
|
31
38
|
}
|
|
32
39
|
/**
|
|
33
40
|
* Built in `undo` or `clear` data change action
|
|
@@ -10,16 +10,16 @@ export class DataChangeHistoryApiImpl extends ApiBase {
|
|
|
10
10
|
if (currentMode === 'ACTIVE' && !forceReset) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
if (
|
|
14
|
-
this.dispatchAction(DataChangeHistoryEnable());
|
|
15
|
-
}
|
|
16
|
-
else if (currentMode === 'SUSPENDED') {
|
|
13
|
+
if (currentMode === 'SUSPENDED' && !forceReset) {
|
|
17
14
|
this.dispatchAction(DataChangeHistoryResume());
|
|
18
15
|
}
|
|
16
|
+
else {
|
|
17
|
+
this.dispatchAction(DataChangeHistoryEnable());
|
|
18
|
+
}
|
|
19
19
|
}
|
|
20
20
|
deactivateDataChangeHistory() {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const currentMode = this.getDataChangeHistoryMode();
|
|
22
|
+
if (currentMode !== 'INACTIVE') {
|
|
23
23
|
this.dispatchAction(DataChangeHistoryDisable());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -39,7 +39,8 @@ export class DataChangeHistoryApiImpl extends ApiBase {
|
|
|
39
39
|
}
|
|
40
40
|
addDataChangeHistoryEntry(dataChangeInfo) {
|
|
41
41
|
const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
|
|
42
|
-
this.
|
|
42
|
+
const maxDataChangesInStore = this.getDataChangeHistoryOptions().maxDataChangesInStore;
|
|
43
|
+
this.dispatchAction(DataChangeHistoryAdd(dataChangeInfo, uniqueKey, maxDataChangesInStore));
|
|
43
44
|
}
|
|
44
45
|
undoDataChangeHistoryEntry(dataChangeInfo) {
|
|
45
46
|
const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
|
|
@@ -65,10 +66,10 @@ export class DataChangeHistoryApiImpl extends ApiBase {
|
|
|
65
66
|
const changedAt = dataChangeInfo.changedAt;
|
|
66
67
|
const showLastDataChangeOnly = this.getDataChangeHistoryOptions().showLastDataChangeOnly;
|
|
67
68
|
if (showLastDataChangeOnly) {
|
|
68
|
-
return
|
|
69
|
+
return `${columnId}\u0000${primaryKeyValue}`;
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
|
-
return
|
|
72
|
+
return `${columnId}\u0000${primaryKeyValue}\u0000${changedAt}`;
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
}
|
|
@@ -247,6 +247,7 @@ export interface DataChangeHistoryAction extends Redux.Action {
|
|
|
247
247
|
uniqueKey: string;
|
|
248
248
|
}
|
|
249
249
|
export interface DataChangeHistoryAddAction extends DataChangeHistoryAction {
|
|
250
|
+
maxDataChanges?: number;
|
|
250
251
|
}
|
|
251
252
|
export interface DataChangeHistoryUndoAction extends DataChangeHistoryAction {
|
|
252
253
|
}
|
|
@@ -324,7 +325,7 @@ export declare const CachedQueryAdd: (cachedQuery: CachedQuery) => CachedQueryAd
|
|
|
324
325
|
export declare const CellSummaryChangeOperation: (cellSummaryOperation: SummaryOperation | string) => CellSummaryChangeOperationAction;
|
|
325
326
|
export declare const LicenseShowWatermark: (text: string) => LicenseShowWatermarkAction;
|
|
326
327
|
export declare const LicenseDisablePersistence: () => LicenseDisablePersistenceAction;
|
|
327
|
-
export declare const DataChangeHistoryAdd: (changeInfo: CellDataChangedInfo, uniqueKey: string) => DataChangeHistoryAddAction;
|
|
328
|
+
export declare const DataChangeHistoryAdd: (changeInfo: CellDataChangedInfo, uniqueKey: string, maxDataChanges?: number) => DataChangeHistoryAddAction;
|
|
328
329
|
export declare const DataChangeHistoryUndo: (changeInfo: CellDataChangedInfo, uniqueKey: string) => DataChangeHistoryUndoAction;
|
|
329
330
|
export declare const DataChangeHistoryClearRow: (changeInfo: CellDataChangedInfo, uniqueKey: string) => DataChangeHistoryClearRowAction;
|
|
330
331
|
export declare const DataChangeHistoryEnable: () => DataChangeHistoryEnableAction;
|
|
@@ -213,10 +213,11 @@ export const LicenseShowWatermark = (text) => ({
|
|
|
213
213
|
export const LicenseDisablePersistence = () => ({
|
|
214
214
|
type: LICENSE_DISABLE_PERSISTENCE,
|
|
215
215
|
});
|
|
216
|
-
export const DataChangeHistoryAdd = (changeInfo, uniqueKey) => ({
|
|
216
|
+
export const DataChangeHistoryAdd = (changeInfo, uniqueKey, maxDataChanges) => ({
|
|
217
217
|
type: DATA_CHANGE_HISTORY_ADD,
|
|
218
218
|
changeInfo,
|
|
219
219
|
uniqueKey,
|
|
220
|
+
maxDataChanges,
|
|
220
221
|
});
|
|
221
222
|
export const DataChangeHistoryUndo = (changeInfo, uniqueKey) => ({
|
|
222
223
|
type: DATA_CHANGE_HISTORY_UNDO,
|
|
@@ -372,6 +373,17 @@ const initialState = {
|
|
|
372
373
|
inProgress: null,
|
|
373
374
|
},
|
|
374
375
|
};
|
|
376
|
+
const removeDataChangeHistoryLog = (state, uniqueKey) => {
|
|
377
|
+
const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
|
|
378
|
+
delete updatedDataChangeHistoryLogs[uniqueKey];
|
|
379
|
+
return {
|
|
380
|
+
...state,
|
|
381
|
+
DataChangeHistory: {
|
|
382
|
+
...state.DataChangeHistory,
|
|
383
|
+
logs: updatedDataChangeHistoryLogs,
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
};
|
|
375
387
|
export const InternalReducer = (state = initialState, action) => {
|
|
376
388
|
let alerts;
|
|
377
389
|
let systemStatusMessages;
|
|
@@ -673,21 +685,16 @@ export const InternalReducer = (state = initialState, action) => {
|
|
|
673
685
|
const cellDataChangedInfo = actionTypedAdd.changeInfo;
|
|
674
686
|
const uniqueKey = actionTypedAdd.uniqueKey;
|
|
675
687
|
const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
|
|
676
|
-
updatedDataChangeHistoryLogs[uniqueKey] = cellDataChangedInfo;
|
|
677
|
-
return {
|
|
678
|
-
...state,
|
|
679
|
-
DataChangeHistory: {
|
|
680
|
-
...state.DataChangeHistory,
|
|
681
|
-
logs: updatedDataChangeHistoryLogs,
|
|
682
|
-
},
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
case DATA_CHANGE_HISTORY_UNDO: {
|
|
686
|
-
const actionTypedUndo = action;
|
|
687
|
-
const cellDataChangedInfo = actionTypedUndo.changeInfo;
|
|
688
|
-
const uniqueKey = actionTypedUndo.uniqueKey;
|
|
689
|
-
const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
|
|
690
688
|
delete updatedDataChangeHistoryLogs[uniqueKey];
|
|
689
|
+
updatedDataChangeHistoryLogs[uniqueKey] = cellDataChangedInfo;
|
|
690
|
+
const maxDataChanges = actionTypedAdd.maxDataChanges;
|
|
691
|
+
if (maxDataChanges != null && maxDataChanges >= 0) {
|
|
692
|
+
const keys = Object.keys(updatedDataChangeHistoryLogs);
|
|
693
|
+
const overflow = keys.length - maxDataChanges;
|
|
694
|
+
for (let i = 0; i < overflow; i++) {
|
|
695
|
+
delete updatedDataChangeHistoryLogs[keys[i]];
|
|
696
|
+
}
|
|
697
|
+
}
|
|
691
698
|
return {
|
|
692
699
|
...state,
|
|
693
700
|
DataChangeHistory: {
|
|
@@ -696,19 +703,10 @@ export const InternalReducer = (state = initialState, action) => {
|
|
|
696
703
|
},
|
|
697
704
|
};
|
|
698
705
|
}
|
|
706
|
+
case DATA_CHANGE_HISTORY_UNDO:
|
|
699
707
|
case DATA_CHANGE_HISTORY_CLEAR_ROW: {
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
const uniqueKey = actionTypedClearRow.uniqueKey;
|
|
703
|
-
const updatedDataChangeHistoryLogs = { ...state.DataChangeHistory.logs };
|
|
704
|
-
delete updatedDataChangeHistoryLogs[uniqueKey];
|
|
705
|
-
return {
|
|
706
|
-
...state,
|
|
707
|
-
DataChangeHistory: {
|
|
708
|
-
...state.DataChangeHistory,
|
|
709
|
-
logs: updatedDataChangeHistoryLogs,
|
|
710
|
-
},
|
|
711
|
-
};
|
|
708
|
+
const { uniqueKey } = action;
|
|
709
|
+
return removeDataChangeHistoryLog(state, uniqueKey);
|
|
712
710
|
}
|
|
713
711
|
case DATA_CHANGE_HISTORY_ENABLE: {
|
|
714
712
|
return {
|
|
@@ -29,7 +29,7 @@ export class DataChangeHistoryModule extends AdaptableModuleBase {
|
|
|
29
29
|
this.api.internalApi
|
|
30
30
|
.getDataService()
|
|
31
31
|
.on('CellDataChanged', (cellDataChangedInfo) => {
|
|
32
|
-
if (this.
|
|
32
|
+
if (this.shouldListenToDataChanges() &&
|
|
33
33
|
this.isDataChangeLoggable(cellDataChangedInfo) &&
|
|
34
34
|
!cellDataChangedInfo.preventEdit) {
|
|
35
35
|
this.api.dataChangeHistoryApi.addDataChangeHistoryEntry(cellDataChangedInfo);
|
|
@@ -21,10 +21,9 @@ export const DataChangeHistoryViewPanelControl = (props) => {
|
|
|
21
21
|
const handleOpenPopup = React.useCallback(() => {
|
|
22
22
|
adaptable.api.settingsPanelApi.openSettingsPanel('DataChangeHistory');
|
|
23
23
|
}, []);
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const suspensionTime = dataChangeHistoryState.suspendTime;
|
|
24
|
+
const changeHistoryMode = useSelector((state) => state.Internal.DataChangeHistory.currentMode);
|
|
25
|
+
const activationTime = useSelector((state) => state.Internal.DataChangeHistory.enableTime);
|
|
26
|
+
const suspensionTime = useSelector((state) => state.Internal.DataChangeHistory.suspendTime);
|
|
28
27
|
const enabled = changeHistoryMode === 'ACTIVE';
|
|
29
28
|
const disabled = changeHistoryMode === 'INACTIVE';
|
|
30
29
|
const suspended = changeHistoryMode === 'SUSPENDED';
|
|
@@ -21,7 +21,7 @@ export const mapChangeHistoryRowData = (changeHistoryLog = {}, mainAdaptableInst
|
|
|
21
21
|
changedColumnLabel: getColumnHeaderLabel(changeInfo.column.columnId, mainAdaptableInstance),
|
|
22
22
|
changeInfo,
|
|
23
23
|
}))
|
|
24
|
-
.
|
|
24
|
+
.reverse();
|
|
25
25
|
};
|
|
26
26
|
export const getChangeHistoryRowChangeInfo = (rowData) => {
|
|
27
27
|
if (!isValidChangeHistoryLogEntry(rowData?.changeInfo)) {
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "23.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1782993623253 || Date.now(),
|
|
4
|
+
VERSION: "23.0.7" || '--current-version--',
|
|
5
5
|
};
|