@adaptabletools/adaptable 24.0.0-canary.5 → 24.0.0-canary.6
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/devtools.d.ts +182 -1
- package/index.css +271 -102
- package/package.json +2 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +4 -4
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +5 -5
- package/src/AdaptableOptions/FlashingCellOptions.d.ts +3 -3
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +6 -4
- package/src/AdaptableOptions/StateOptions.d.ts +37 -13
- package/src/AdaptableState/AdaptableState.d.ts +2 -0
- package/src/AdaptableState/QuickSearchState.d.ts +4 -0
- package/src/Api/Implementation/ColumnScopeApiImpl.js +3 -3
- package/src/Api/Implementation/StateApiImpl.d.ts +1 -1
- package/src/Api/Implementation/StateApiImpl.js +4 -3
- package/src/Api/Internal/CalculatedColumnInternalApi.js +1 -1
- package/src/Api/Internal/StateInternalApi.d.ts +1 -1
- package/src/Api/Internal/StateInternalApi.js +2 -2
- package/src/Api/StateApi.d.ts +2 -2
- package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +0 -4
- package/src/Redux/ActionsReducers/QuickSearchRedux.js +3 -7
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.d.ts +8 -0
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +12 -12
- package/src/Redux/Store/AdaptableStore.d.ts +8 -5
- package/src/Redux/Store/AdaptableStore.js +47 -19
- package/src/Redux/Store/Interface/IAdaptableStore.d.ts +5 -5
- package/src/Redux/Store/Interface/IStorageEngine.d.ts +4 -4
- package/src/Redux/Store/StateOptionsGuards.d.ts +58 -0
- package/src/Redux/Store/StateOptionsGuards.js +112 -0
- package/src/Redux/Store/isTransientReduxAction.d.ts +5 -0
- package/src/Redux/Store/isTransientReduxAction.js +19 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +1 -0
- package/src/Utilities/Constants/ReduxConstants.d.ts +2 -2
- package/src/Utilities/Constants/ReduxConstants.js +5 -5
- package/src/Utilities/Helpers/AlertTypeHelper.d.ts +1 -1
- package/src/Utilities/Helpers/SettingsPanelHelper.d.ts +14 -0
- package/src/Utilities/Helpers/SettingsPanelHelper.js +37 -1
- package/src/Utilities/Helpers/UIHelper.d.ts +6 -3
- package/src/Utilities/Helpers/UIHelper.js +8 -4
- package/src/Utilities/ObjectFactory.js +3 -3
- package/src/View/Dashboard/DashboardPopupSections.js +1 -1
- package/src/View/GridInfo/GridInfoPopup.js +62 -25
- package/src/View/StyledColumn/RangesComponent.js +6 -6
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +4 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardRangesSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +2 -2
- package/src/View/Wizard/CollapsibleWizardCard.d.ts +3 -1
- package/src/View/Wizard/CollapsibleWizardCard.js +17 -9
- package/src/agGrid/AdaptableAgGrid.d.ts +4 -4
- package/src/agGrid/AdaptableAgGrid.js +2 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
- package/src/agGrid/AgGridColumnAdapter.js +4 -4
- package/src/components/aql/QueryBuilder/QueryBuilderInputs.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/normalizeLayoutModel.d.ts +1 -1
- package/src/layout-manager/src/simplifyLayoutModel.d.ts +1 -1
- package/src/migration/AdaptableUpgradeHelper.d.ts +7 -2
- package/src/migration/VersionUpgrade17.js +13 -8
- package/src/setupDevTools.js +442 -103
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/components/Button/index.d.ts +1 -1
- package/vendor/components/Button/index.d.ts.map +1 -1
- package/vendor/components/Button/index.js.map +1 -1
- package/vendor/components/CheckBox/index.d.ts +1 -1
- package/vendor/components/CheckBox/index.d.ts.map +1 -1
- package/vendor/components/CheckBox/index.js.map +1 -1
- package/vendor/components/ColorPicker/colorPickerTab.d.ts +4 -0
- package/vendor/components/ColorPicker/colorPickerTab.d.ts.map +1 -0
- package/vendor/components/ColorPicker/colorPickerTab.js +50 -0
- package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -0
- package/vendor/components/ColorPicker/index.d.ts +31 -0
- package/vendor/components/ColorPicker/index.d.ts.map +1 -0
- package/vendor/components/ColorPicker/index.js +132 -0
- package/vendor/components/ColorPicker/index.js.map +1 -0
- package/vendor/components/ColorPicker/themeColors.d.ts +24 -0
- package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -0
- package/vendor/components/ColorPicker/themeColors.js +52 -0
- package/vendor/components/ColorPicker/themeColors.js.map +1 -0
- package/vendor/components/Combobox/VirtualizedList.d.ts +1 -1
- package/vendor/components/Combobox/VirtualizedList.d.ts.map +1 -1
- package/vendor/components/Combobox/VirtualizedList.js.map +1 -1
- package/vendor/components/Combobox/index.d.ts +1 -1
- package/vendor/components/Combobox/index.d.ts.map +1 -1
- package/vendor/components/Combobox/index.js.map +1 -1
- package/vendor/components/index.css +213 -0
- package/vendor/components/index.d.ts +2 -0
- package/vendor/components/index.d.ts.map +1 -1
- package/vendor/components/index.js +1 -0
- package/vendor/components/index.js.map +1 -1
- package/vendor/components/ui/combobox.d.ts.map +1 -1
- package/vendor/components/ui/combobox.js +1 -1
- package/vendor/components/ui/combobox.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "24.0.0-canary.
|
|
3
|
+
"version": "24.0.0-canary.6",
|
|
4
4
|
"description": "Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"normalize.css": "^8.0.1",
|
|
60
60
|
"re-resizable": "6.10.3",
|
|
61
61
|
"react": "^18.0.0 || ^19.0.0",
|
|
62
|
+
"react-colorful": "^5.8.1",
|
|
62
63
|
"react-day-picker": "^9.14.0",
|
|
63
64
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
64
65
|
"react-redux": "9.2.0",
|
|
@@ -9,7 +9,7 @@ import { SelectedCellInfo } from '../AdaptableState/Selection/SelectedCellInfo';
|
|
|
9
9
|
import { AdaptableTheme } from '../AdaptableState/ThemeState';
|
|
10
10
|
import { IAdaptableStore } from '../Redux/Store/Interface/IAdaptableStore';
|
|
11
11
|
import { IModuleCollection } from '../Strategy/Interface/IModule';
|
|
12
|
-
import { AdaptableMenuItem, AdaptableOptions,
|
|
12
|
+
import { AdaptableMenuItem, AdaptableOptions, AdaptablePersistentState, AdaptablePlugin, ChartDefinition, InFilterValueResult, SelectedRowInfo } from '../types';
|
|
13
13
|
import { ICalculatedColumnExpressionService } from '../Utilities/Services/Interface/ICalculatedColumnExpressionService';
|
|
14
14
|
import { IDataService } from '../Utilities/Services/Interface/IDataService';
|
|
15
15
|
import { CommentsService } from '../Utilities/Services/CommentsService';
|
|
@@ -326,17 +326,17 @@ export interface IAdaptable {
|
|
|
326
326
|
canExportToExcel(): boolean;
|
|
327
327
|
canExportToCsv(): boolean;
|
|
328
328
|
silentUpdateCurrentLayoutModel(layoutModel?: TableLayoutModel | PivotLayoutModel): void;
|
|
329
|
-
normalizeAdaptableState(state:
|
|
329
|
+
normalizeAdaptableState(state: Partial<AdaptablePersistentState>, options: NormalizeAdaptableStateOptions): Partial<AdaptablePersistentState>;
|
|
330
330
|
/**
|
|
331
331
|
* Runs the startup upgrade chain when `stateOptions.autoMigrateState` is on.
|
|
332
332
|
* A no-op when migration is disabled or the state is already current.
|
|
333
333
|
*/
|
|
334
|
-
migrateLoadedAdaptableState(state:
|
|
334
|
+
migrateLoadedAdaptableState<T extends Partial<AdaptablePersistentState>>(state: T): T;
|
|
335
335
|
/**
|
|
336
336
|
* `loadStore` hook used at startup and when the state key changes:
|
|
337
337
|
* migrate (when enabled), then normalise.
|
|
338
338
|
*/
|
|
339
|
-
buildPostLoadHook(gridOptions: NormalizeAdaptableStateOptions): (state:
|
|
339
|
+
buildPostLoadHook(gridOptions: NormalizeAdaptableStateOptions): (state: Partial<AdaptablePersistentState>) => Partial<AdaptablePersistentState>;
|
|
340
340
|
refreshLayout(): void;
|
|
341
341
|
}
|
|
342
342
|
export type NormalizeAdaptableStateOptions = Pick<GridOptions, 'rowModelType' | 'treeData' | 'columnDefs' | 'autoGroupColumnDef' | 'defaultColDef' | 'pivotMode'>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
|
|
2
|
-
import {
|
|
2
|
+
import { themeColorVar } from '../Utilities/Helpers/UIHelper';
|
|
3
3
|
import { ACCESS_LEVEL_FULL, EMPTY_STRING, EMPTY_ARRAY, DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME, SYSTEM_REPORT_NAMES, SYSTEM_REPORT_FORMATS, SYSTEM_EXPORT_DESTINATIONS, } from '../Utilities/Constants/GeneralConstants';
|
|
4
4
|
import { addUuidsToInitialState } from '../Utilities/Helpers/AdaptableHelper';
|
|
5
5
|
import { defaultsDeep } from '../Utilities/Extensions/ObjectExtensions';
|
|
@@ -200,13 +200,13 @@ const DefaultAdaptableOptions = {
|
|
|
200
200
|
defaultFlashDuration: 500,
|
|
201
201
|
defaultFlashTarget: 'cell',
|
|
202
202
|
defaultDownChangeStyle: {
|
|
203
|
-
BackColor:
|
|
203
|
+
BackColor: themeColorVar('flash-down'),
|
|
204
204
|
},
|
|
205
205
|
defaultUpChangeStyle: {
|
|
206
|
-
BackColor:
|
|
206
|
+
BackColor: themeColorVar('flash-up'),
|
|
207
207
|
},
|
|
208
208
|
defaultNeutralChangeStyle: {
|
|
209
|
-
BackColor:
|
|
209
|
+
BackColor: themeColorVar('flash-neutral'),
|
|
210
210
|
},
|
|
211
211
|
},
|
|
212
212
|
formatColumnOptions: {
|
|
@@ -279,7 +279,7 @@ const DefaultAdaptableOptions = {
|
|
|
279
279
|
position: undefined,
|
|
280
280
|
size: undefined,
|
|
281
281
|
customSettingsPanels: undefined,
|
|
282
|
-
gridInfoTabs: ['Grid
|
|
282
|
+
gridInfoTabs: ['Grid Summary', 'Layout', 'Grid State', 'Grid Options'],
|
|
283
283
|
},
|
|
284
284
|
wizardOptions: {
|
|
285
285
|
popupType: undefined,
|
|
@@ -10,17 +10,17 @@ export interface FlashingCellOptions {
|
|
|
10
10
|
defaultFlashTarget?: FlashTarget;
|
|
11
11
|
/**
|
|
12
12
|
* Style for 'Down' value changes
|
|
13
|
-
*
|
|
13
|
+
* @defaultValue BackColor of `var(--ab-color-flash-down)` (red in the shipped themes)
|
|
14
14
|
*/
|
|
15
15
|
defaultDownChangeStyle?: AdaptableStyle;
|
|
16
16
|
/**
|
|
17
17
|
* Style for 'Up' value changes
|
|
18
|
-
* @defaultValue
|
|
18
|
+
* @defaultValue BackColor of `var(--ab-color-flash-up)` (green in the shipped themes)
|
|
19
19
|
*/
|
|
20
20
|
defaultUpChangeStyle?: AdaptableStyle;
|
|
21
21
|
/**
|
|
22
22
|
* Style for 'Neutral' value changes
|
|
23
|
-
* @defaultValue
|
|
23
|
+
* @defaultValue BackColor of `var(--ab-color-flash-neutral)` (gray in the shipped themes)
|
|
24
24
|
*/
|
|
25
25
|
defaultNeutralChangeStyle?: AdaptableStyle;
|
|
26
26
|
/**
|
|
@@ -74,9 +74,11 @@ export interface SettingsPanelOptions {
|
|
|
74
74
|
*/
|
|
75
75
|
customSettingsPanels?: CustomSettingsPanel[];
|
|
76
76
|
/**
|
|
77
|
-
* Which Tabs
|
|
77
|
+
* Which Tabs to show in Grid Info: 'Grid Summary', 'Layout', 'Grid State' or 'Grid Options'
|
|
78
78
|
*
|
|
79
|
-
*
|
|
79
|
+
* Tab labels in the UI are Summary, Layout, State and Options
|
|
80
|
+
*
|
|
81
|
+
* @defaultValue ['Grid Summary', 'Layout', 'Grid State', 'Grid Options']
|
|
80
82
|
*/
|
|
81
83
|
gridInfoTabs?: GridInfoTabs;
|
|
82
84
|
}
|
|
@@ -182,6 +184,6 @@ export type PopupType = 'modal' | 'window';
|
|
|
182
184
|
*/
|
|
183
185
|
export type GridInfoTabs = GridInfoTab[];
|
|
184
186
|
/**
|
|
185
|
-
* Tab to use for Grid Info: 'Grid
|
|
187
|
+
* Tab to use for Grid Info: 'Grid Summary', 'Layout', 'Grid State' or 'Grid Options'
|
|
186
188
|
*/
|
|
187
|
-
export type GridInfoTab = 'Grid
|
|
189
|
+
export type GridInfoTab = 'Grid Summary' | 'Layout' | 'Grid State' | 'Grid Options';
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdaptablePersistentState } from '../AdaptableState/AdaptableState';
|
|
2
2
|
import { AdaptableApi } from '../Api/AdaptableApi';
|
|
3
3
|
/**
|
|
4
4
|
* Options related to Adaptable State hydration / dehydration; allows users to intercept state persistence and loading with custom functionality
|
|
5
|
+
*
|
|
6
|
+
* All functions deal with `AdaptablePersistentState` - the persisted subset of `AdaptableState`.
|
|
7
|
+
* Transient sections (`Internal`, `Popup`, `Comment`, `Plugins`) are never passed to, nor expected from, these functions.
|
|
8
|
+
*
|
|
9
|
+
* Hydration flow: `loadState()` -> (merge with `initialState`) -> `applyState()`
|
|
10
|
+
*
|
|
11
|
+
* Dehydration flow: `saveState()` -> `persistState()`
|
|
12
|
+
*
|
|
13
|
+
* To store Adaptable State in a custom format (e.g. wrapped in an envelope, compressed, encrypted) do the wrapping in `persistState()` and the unwrapping in `loadState()` - these are the only functions which own the storage format.
|
|
14
|
+
* `saveState()` and `applyState()` always operate on Adaptable State, as `loadState()`'s result is merged with `initialState` section by section before `applyState()` is called.
|
|
5
15
|
*/
|
|
6
16
|
export interface StateOptions {
|
|
7
17
|
/**
|
|
8
18
|
* Retrieves saved Adaptable State from storage or external source
|
|
9
|
-
* @returns Promise resolving to the retrieved state object
|
|
19
|
+
* @returns Promise resolving to the retrieved (possibly partial) state object, or to nothing if no state was persisted yet
|
|
10
20
|
*/
|
|
11
21
|
loadState?: AdaptableLoadStateFunction;
|
|
12
22
|
/**
|
|
@@ -15,7 +25,7 @@ export interface StateOptions {
|
|
|
15
25
|
*/
|
|
16
26
|
persistState?: AdaptablePersistStateFunction;
|
|
17
27
|
/**
|
|
18
|
-
* Transforms state before applying it to the application. Called after `loadState()` but before the state is used.
|
|
28
|
+
* Transforms state before applying it to the application. Called after `loadState()` (and after merging with `initialState`) but before the state is used.
|
|
19
29
|
* @returns The transformed state object
|
|
20
30
|
*/
|
|
21
31
|
applyState?: AdaptableApplyStateFunction;
|
|
@@ -74,63 +84,77 @@ export interface AdaptableStateFunctionConfig {
|
|
|
74
84
|
*/
|
|
75
85
|
actionName?: string;
|
|
76
86
|
/**
|
|
77
|
-
* Previous state before the action was applied.
|
|
87
|
+
* Previous (persistent) state before the action was applied.
|
|
78
88
|
* This is useful for comparing changes or reverting if necessary.
|
|
79
89
|
*/
|
|
80
|
-
previousState?:
|
|
90
|
+
previousState?: AdaptablePersistentState;
|
|
81
91
|
}
|
|
82
92
|
/**
|
|
83
93
|
* Function that handles persisting state to storage systems (localStorage, server, etc.).
|
|
84
94
|
* Called after `saveState()` to store the prepared state.
|
|
85
95
|
*
|
|
96
|
+
* This is the place to apply any custom storage format (envelope, compression, encryption, etc.); the matching `loadState()` is expected to undo it.
|
|
97
|
+
*
|
|
86
98
|
* @example
|
|
87
99
|
* ```
|
|
88
100
|
* persistState = (state, stateFunctionConfig) => {
|
|
89
|
-
* localStorage.setItem(stateFunctionConfig.adaptableStateKey, JSON.stringify(state))
|
|
101
|
+
* localStorage.setItem(stateFunctionConfig.adaptableStateKey, JSON.stringify(state));
|
|
102
|
+
* return Promise.resolve();
|
|
90
103
|
* }
|
|
91
104
|
* ```
|
|
92
105
|
*
|
|
93
106
|
* @param state The state to be persisted
|
|
94
107
|
* @param adaptableStateFunctionConfig Configuration details for the current Adaptable instance
|
|
95
|
-
* @returns Promise resolving once persistence is complete
|
|
108
|
+
* @returns Promise resolving once persistence is complete; the resolved value is ignored
|
|
96
109
|
*/
|
|
97
110
|
export interface AdaptablePersistStateFunction {
|
|
98
|
-
(state:
|
|
111
|
+
(state: AdaptablePersistentState, adaptableStateFunctionConfig: AdaptableStateFunctionConfig): Promise<unknown>;
|
|
99
112
|
}
|
|
100
113
|
/**
|
|
101
114
|
* Function that clears persisted state from the storage system.
|
|
102
115
|
* Only invoked during `StateApi.reloadInitialState()` operations.
|
|
116
|
+
*
|
|
117
|
+
* @returns Promise resolving once the persisted state is cleared; the resolved value is ignored
|
|
103
118
|
*/
|
|
104
119
|
export interface AdaptableClearStateFunction {
|
|
105
|
-
(adaptableStateFunctionConfig: AdaptableStateFunctionConfig): Promise<
|
|
120
|
+
(adaptableStateFunctionConfig: AdaptableStateFunctionConfig): Promise<unknown>;
|
|
106
121
|
}
|
|
107
122
|
/**
|
|
108
123
|
* Function that transforms state before persistence. Called first in the persistence flow, before `persistState()`.
|
|
109
124
|
*
|
|
125
|
+
* The received state is the full persistent state of the current Adaptable instance (transient sections are already stripped).
|
|
126
|
+
*
|
|
110
127
|
* @param state The Adaptable state to transform before saving
|
|
111
128
|
* @param adaptableStateFunctionConfig Configuration details for the current Adaptable instance
|
|
112
129
|
* @returns The modified state ready for persistence
|
|
113
130
|
*/
|
|
114
131
|
export interface AdaptableSaveStateFunction {
|
|
115
|
-
(state:
|
|
132
|
+
(state: AdaptablePersistentState, adaptableStateFunctionConfig: AdaptableStateFunctionConfig): AdaptablePersistentState;
|
|
116
133
|
}
|
|
117
134
|
/**
|
|
118
135
|
* Function that retrieves Adaptable state from storage or external source. Called during initialization to hydrate the application state.
|
|
119
136
|
*
|
|
137
|
+
* The result is merged with `AdaptableOptions.initialState` before being passed to `applyState()`, so it may be partial (only the sections which were persisted) or empty / nullish (nothing was persisted yet).
|
|
138
|
+
*
|
|
139
|
+
* This is the place to undo any custom storage format applied in `persistState()`.
|
|
140
|
+
*
|
|
120
141
|
* @param config Configuration details for the current Adaptable instance
|
|
121
142
|
* @returns Promise resolving to the retrieved state object
|
|
122
143
|
*/
|
|
123
144
|
export interface AdaptableLoadStateFunction {
|
|
124
|
-
(config: AdaptableStateFunctionConfig): Promise<
|
|
145
|
+
(config: AdaptableStateFunctionConfig): Promise<Partial<AdaptablePersistentState> | null | void>;
|
|
125
146
|
}
|
|
126
147
|
/**
|
|
127
|
-
* Function that applies the loaded state to the application. Called after `loadState()` but before the state is used.
|
|
148
|
+
* Function that applies the loaded state to the application. Called after `loadState()` (and after the result was merged with `initialState`) but before the state is used.
|
|
128
149
|
* This allows for any necessary transformations or adjustments before the state is applied.
|
|
150
|
+
*
|
|
151
|
+
* The state is partial, as only the sections present in either the persisted state or `initialState` are available at this point; missing sections are initialised with their defaults afterwards.
|
|
152
|
+
*
|
|
129
153
|
* @param state The loaded state to transform
|
|
130
154
|
* @param adaptableStateFunctionConfig Configuration details for the current Adaptable instance
|
|
131
155
|
*
|
|
132
156
|
* @returns The transformed state object
|
|
133
157
|
*/
|
|
134
158
|
export interface AdaptableApplyStateFunction {
|
|
135
|
-
(state:
|
|
159
|
+
(state: Partial<AdaptablePersistentState>, adaptableStateFunctionConfig: AdaptableStateFunctionConfig): Partial<AdaptablePersistentState>;
|
|
136
160
|
}
|
|
@@ -32,6 +32,8 @@ export interface AdaptableState extends AdaptablePersistentState, AdaptableTrans
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* The state object of Adaptable which is persisted
|
|
35
|
+
*
|
|
36
|
+
* This is the state shape handled by all `StateOptions` functions (`saveState`, `persistState`, `loadState`, `applyState`)
|
|
35
37
|
*/
|
|
36
38
|
export interface AdaptablePersistentState {
|
|
37
39
|
Application: ApplicationState;
|
|
@@ -14,10 +14,14 @@ export interface QuickSearchState extends BaseState {
|
|
|
14
14
|
CellMatchStyle?: Omit<AdaptableStyle, 'ClassName'>;
|
|
15
15
|
/**
|
|
16
16
|
* Style used to highlight matching text within a cell (not availale in SSRM)
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue `var(--ab-color-quick-search-match)` background and `var(--ab-color-quick-search-match-foreground)` text
|
|
17
19
|
*/
|
|
18
20
|
TextMatchStyle?: Omit<AdaptableStyle, 'ClassName'>;
|
|
19
21
|
/**
|
|
20
22
|
* Style used to highlight matching text within current match (not availale in SSRM)
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue `var(--ab-color-quick-search-current-match)` background, `var(--ab-color-quick-search-current-match-foreground)` text, bold
|
|
21
25
|
*/
|
|
22
26
|
CurrentTextMatchStyle?: Omit<AdaptableStyle, 'ClassName'>;
|
|
23
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiBase } from './ApiBase';
|
|
2
2
|
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaultRangeColor } from '../../Utilities/Helpers/UIHelper';
|
|
4
4
|
export class ColumnScopeApiImpl extends ApiBase {
|
|
5
5
|
isColumnInScope(column, scope) {
|
|
6
6
|
if (!column) {
|
|
@@ -238,7 +238,7 @@ export class ColumnScopeApiImpl extends ApiBase {
|
|
|
238
238
|
{
|
|
239
239
|
Min: 0,
|
|
240
240
|
Max: 0,
|
|
241
|
-
Color:
|
|
241
|
+
Color: getDefaultRangeColor(),
|
|
242
242
|
},
|
|
243
243
|
];
|
|
244
244
|
}
|
|
@@ -246,7 +246,7 @@ export class ColumnScopeApiImpl extends ApiBase {
|
|
|
246
246
|
{
|
|
247
247
|
Min: 'Col-Min',
|
|
248
248
|
Max: 'Col-Max',
|
|
249
|
-
Color:
|
|
249
|
+
Color: getDefaultRangeColor(),
|
|
250
250
|
},
|
|
251
251
|
];
|
|
252
252
|
}
|
|
@@ -43,7 +43,7 @@ export declare class StateApiImpl extends ApiBase implements StateApi {
|
|
|
43
43
|
flushCurrentState?: boolean;
|
|
44
44
|
progressIndicatorLabel?: string;
|
|
45
45
|
}): Promise<void>;
|
|
46
|
-
persistAdaptableState(): Promise<
|
|
46
|
+
persistAdaptableState(): Promise<AdaptablePersistentState>;
|
|
47
47
|
getDescriptionForModule(module: AdaptableModule): string;
|
|
48
48
|
getHelpPageForModule(module: AdaptableModule): string;
|
|
49
49
|
getUserStateByStateKey(stateKey: AdaptableStateKey, returnJson?: boolean): BaseState | string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { InitState } from '../../Redux/Store/AdaptableStore';
|
|
2
|
+
import { runAsyncStateFunction } from '../../Redux/Store/StateOptionsGuards';
|
|
3
|
+
import { loadState as defaultLoadState } from '../../Redux/Store/AdaptableReduxLocalStorageEngine';
|
|
2
4
|
import { ApiBase } from './ApiBase';
|
|
3
5
|
import Helper from '../../Utilities/Helpers/Helper';
|
|
4
6
|
import { addUuidsToInitialState } from '../../Utilities/Helpers/AdaptableHelper';
|
|
@@ -56,7 +58,7 @@ export class StateApiImpl extends ApiBase {
|
|
|
56
58
|
localStorage.removeItem(adaptableOptions.adaptableStateKey);
|
|
57
59
|
return Promise.resolve(true);
|
|
58
60
|
});
|
|
59
|
-
const clearStatePromise = clearStateFn
|
|
61
|
+
const clearStatePromise = runAsyncStateFunction('clearState', clearStateFn, [this.internalApi.buildAdaptableStateFunctionConfig()], this._adaptable.logger);
|
|
60
62
|
return clearStatePromise.then(() => {
|
|
61
63
|
this.setAdaptableStateKey(adaptableOptions.adaptableStateKey, {
|
|
62
64
|
initialState: newInitialState || adaptableOptions.initialState,
|
|
@@ -82,8 +84,7 @@ export class StateApiImpl extends ApiBase {
|
|
|
82
84
|
}
|
|
83
85
|
async remergePersistedState() {
|
|
84
86
|
const config = this.internalApi.buildAdaptableStateFunctionConfig();
|
|
85
|
-
const
|
|
86
|
-
const userState = await loadState(config);
|
|
87
|
+
const userState = await runAsyncStateFunction('loadState', this.getOptions().stateOptions.loadState || defaultLoadState, [config], this._adaptable.logger);
|
|
87
88
|
return this.internalApi.applyMergedInitialAndUserState(this.getInitialState(), userState);
|
|
88
89
|
}
|
|
89
90
|
getAllState() {
|
|
@@ -221,7 +221,7 @@ export class CalculatedColumnInternalApi extends ApiBase {
|
|
|
221
221
|
if (calculatedColumnSettings.ShowToolTip != null &&
|
|
222
222
|
calculatedColumnSettings.ShowToolTip == true) {
|
|
223
223
|
newColDef.tooltipComponent = TwoLineTooltip;
|
|
224
|
-
newColDef.
|
|
224
|
+
newColDef.tooltip = (params) => {
|
|
225
225
|
const formulaText = this.getAdaptableInternalApi().getAdaptableQueryExpressionText(calculatedColumn.Expression);
|
|
226
226
|
if (!isPerRowCalculatedColumnType(getCalculatedColumnType(calculatedColumn)) ||
|
|
227
227
|
!params?.node ||
|
|
@@ -7,7 +7,7 @@ export declare class StateInternalApi extends ApiBase {
|
|
|
7
7
|
* Startup-equivalent merge: Initial State + user state → store, layout/theme/cells, persist.
|
|
8
8
|
* Does not clear persistence and does not call `loadState` (caller supplies user state).
|
|
9
9
|
*/
|
|
10
|
-
applyMergedInitialAndUserState(initialState: InitialState, userState: AdaptablePersistentState
|
|
10
|
+
applyMergedInitialAndUserState(initialState: InitialState, userState: Partial<AdaptablePersistentState> | null | void): Promise<void>;
|
|
11
11
|
getAllStateForDevTools(): AdaptableState;
|
|
12
12
|
/**
|
|
13
13
|
* Replaces persisted Adaptable state with the supplied snapshot (e.g. from DevTools).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPersistableState, LoadState, InitState } from '../../Redux/Store/AdaptableStore';
|
|
2
2
|
import { MergeStateFunction } from '../../Redux/Store/AdaptableReduxMerger';
|
|
3
|
+
import { runSyncStateFunction } from '../../Redux/Store/StateOptionsGuards';
|
|
3
4
|
import { addUuidsToInitialState } from '../../Utilities/Helpers/AdaptableHelper';
|
|
4
5
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
5
6
|
function deepClone(value) {
|
|
@@ -23,8 +24,7 @@ export class StateInternalApi extends ApiBase {
|
|
|
23
24
|
const initialForMerge = addUuidsToInitialState(deepClone(initialState));
|
|
24
25
|
const userForMerge = deepClone(userState ?? {});
|
|
25
26
|
let merged = MergeStateFunction(initialForMerge, userForMerge);
|
|
26
|
-
|
|
27
|
-
merged = this.getOptions().stateOptions.applyState(merged, stateFunctionConfig);
|
|
27
|
+
merged = runSyncStateFunction('applyState', this.getOptions().stateOptions.applyState, merged, this.buildAdaptableStateFunctionConfig(), this._adaptable.logger);
|
|
28
28
|
merged = this._adaptable.migrateLoadedAdaptableState(merged);
|
|
29
29
|
const agGridOptions = {
|
|
30
30
|
columnDefs: this._adaptable.agGridAdapter.getGridOption('columnDefs'),
|
package/src/Api/StateApi.d.ts
CHANGED
|
@@ -224,7 +224,7 @@ export interface StateApi {
|
|
|
224
224
|
* This method first calls StateOption.saveState() to prepare the state
|
|
225
225
|
* and then StateOptions.persistState() to save it to the configured storage.
|
|
226
226
|
*
|
|
227
|
-
* @returns
|
|
227
|
+
* @returns A promise that resolves to the persisted state
|
|
228
228
|
*/
|
|
229
|
-
persistAdaptableState(): Promise<
|
|
229
|
+
persistAdaptableState(): Promise<AdaptablePersistentState>;
|
|
230
230
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as Redux from 'redux';
|
|
2
2
|
import { QuickSearchState } from '../../AdaptableState/QuickSearchState';
|
|
3
3
|
import { AdaptableStyle } from '../../AdaptableState/Common/AdaptableStyle';
|
|
4
|
-
export declare const QUICK_SEARCH_DEFAULT_CELL_MATCH_STYLE: {
|
|
5
|
-
BackColor: string;
|
|
6
|
-
ForeColor: string;
|
|
7
|
-
};
|
|
8
4
|
export declare const QUICK_SEARCH_DEFAULT_TEXT_MATCH_STYLE: {
|
|
9
5
|
BackColor: string;
|
|
10
6
|
ForeColor: string;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QUICK_SEARCH_DEFAULT_CURRENT_BACK_COLOR, QUICK_SEARCH_DEFAULT_CURRENT_FORE_COLOR, QUICK_SEARCH_DEFAULT_TEXT_BACK_COLOR, QUICK_SEARCH_DEFAULT_TEXT_FORE_COLOR, } from '../../Utilities/Constants/ReduxConstants';
|
|
2
2
|
import { EMPTY_STRING } from '../../Utilities/Constants/GeneralConstants';
|
|
3
|
-
export const QUICK_SEARCH_DEFAULT_CELL_MATCH_STYLE = {
|
|
4
|
-
BackColor: QUICK_SEARCH_DEFAULT_CELL_BACK_COLOR,
|
|
5
|
-
ForeColor: QUICK_SEARCH_DEFAULT_FORE_COLOR,
|
|
6
|
-
};
|
|
7
3
|
export const QUICK_SEARCH_DEFAULT_TEXT_MATCH_STYLE = {
|
|
8
4
|
BackColor: QUICK_SEARCH_DEFAULT_TEXT_BACK_COLOR,
|
|
9
|
-
ForeColor:
|
|
5
|
+
ForeColor: QUICK_SEARCH_DEFAULT_TEXT_FORE_COLOR,
|
|
10
6
|
};
|
|
11
7
|
export const QUICK_SEARCH_DEFAULT_CURRENT_TEXT_MATCH_STYLE = {
|
|
12
8
|
BackColor: QUICK_SEARCH_DEFAULT_CURRENT_BACK_COLOR,
|
|
13
|
-
ForeColor:
|
|
9
|
+
ForeColor: QUICK_SEARCH_DEFAULT_CURRENT_FORE_COLOR,
|
|
14
10
|
FontWeight: 'Bold',
|
|
15
11
|
};
|
|
16
12
|
export const QUICK_SEARCH_RUN = 'QUICK_SEARCH_RUN';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import IStorageEngine from './Interface/IStorageEngine';
|
|
2
2
|
import { InitialState } from '../../AdaptableState/InitialState';
|
|
3
3
|
import { AdaptableLoadStateFunction, AdaptablePersistStateFunction } from '../../AdaptableOptions/StateOptions';
|
|
4
|
+
/**
|
|
5
|
+
* Default `persistState` implementation - writes the state to localStorage under `adaptableStateKey`
|
|
6
|
+
*/
|
|
7
|
+
export declare const persistState: AdaptablePersistStateFunction;
|
|
8
|
+
/**
|
|
9
|
+
* Default `loadState` implementation - reads the state from localStorage under `adaptableStateKey`
|
|
10
|
+
*/
|
|
11
|
+
export declare const loadState: AdaptableLoadStateFunction;
|
|
4
12
|
export declare function createEngine(config: {
|
|
5
13
|
adaptableId: string;
|
|
6
14
|
adaptableStateKey: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { debounce } from '../../Utilities/Helpers/TimingHelper';
|
|
2
2
|
import { MergeStateFunction } from './AdaptableReduxMerger';
|
|
3
3
|
import { AdaptableLogger } from '../../agGrid/AdaptableLogger';
|
|
4
|
+
import { runAsyncStateFunction, runSyncStateFunction } from './StateOptionsGuards';
|
|
4
5
|
const checkStatus = (response) => {
|
|
5
6
|
const error = new Error(response.statusText);
|
|
6
7
|
if (response.status >= 200 && response.status < 300) {
|
|
@@ -8,7 +9,7 @@ const checkStatus = (response) => {
|
|
|
8
9
|
}
|
|
9
10
|
throw error;
|
|
10
11
|
};
|
|
11
|
-
const persistState = (state, config) => {
|
|
12
|
+
export const persistState = (state, config) => {
|
|
12
13
|
return new Promise((resolve, reject) => {
|
|
13
14
|
try {
|
|
14
15
|
localStorage.setItem(config.adaptableStateKey, JSON.stringify(state));
|
|
@@ -19,7 +20,7 @@ const persistState = (state, config) => {
|
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
};
|
|
22
|
-
const loadState = ({
|
|
23
|
+
export const loadState = ({ adaptableStateKey }) => {
|
|
23
24
|
const jsonState = localStorage.getItem(adaptableStateKey);
|
|
24
25
|
const parsedJsonState = JSON.parse(jsonState) || {};
|
|
25
26
|
return Promise.resolve(parsedJsonState);
|
|
@@ -49,7 +50,7 @@ class AdaptableReduxLocalStorageEngine {
|
|
|
49
50
|
this.adaptableStateKey = adaptableStateKey;
|
|
50
51
|
}
|
|
51
52
|
load(adaptableInstance, initialState = this.initialState) {
|
|
52
|
-
return (this.loadState || loadState
|
|
53
|
+
return runAsyncStateFunction('loadState', this.loadState || loadState, [adaptableInstance.api.stateApi.internalApi.buildAdaptableStateFunctionConfig()], adaptableInstance.logger).then((parsedJsonState) => {
|
|
53
54
|
return Promise.resolve(initialState)
|
|
54
55
|
.then((parsedInitialState) => {
|
|
55
56
|
return MergeStateFunction(parsedInitialState, parsedJsonState);
|
|
@@ -67,20 +68,19 @@ class AdaptableReduxLocalStorageEngine {
|
|
|
67
68
|
const config = adaptableInstance.api.stateApi.internalApi.buildAdaptableStateFunctionConfig();
|
|
68
69
|
config.actionName = actionName;
|
|
69
70
|
config.previousState = adaptableInstance.adaptableStore.getPreviousStorageState() || null;
|
|
70
|
-
let stateObject
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
stateObject = getTransformedState(stateObject, config);
|
|
71
|
+
let stateObject;
|
|
72
|
+
try {
|
|
73
|
+
stateObject = runSyncStateFunction('saveState', adaptableInstance.adaptableOptions.stateOptions.saveState, structuredClone(state), config, adaptableInstance.logger);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
catch (error) {
|
|
76
|
+
adaptableInstance.logger.consoleError('Adaptable State was NOT persisted:', error instanceof Error ? error.message : error);
|
|
77
|
+
return Promise.reject(error);
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return runAsyncStateFunction('persistState', this.persistState || persistState, [stateObject, config], adaptableInstance.logger).catch(rejectWithMessage);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
function rejectWithMessage(error) {
|
|
83
|
-
return Promise.reject(error
|
|
83
|
+
return Promise.reject(error?.message ?? error);
|
|
84
84
|
}
|
|
85
85
|
export function createEngine(config) {
|
|
86
86
|
return new AdaptableReduxLocalStorageEngine(config);
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as Redux from 'redux';
|
|
2
2
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
3
|
-
import { AdaptableState } from '../../AdaptableState/AdaptableState';
|
|
3
|
+
import { AdaptablePersistentState, AdaptableState } from '../../AdaptableState/AdaptableState';
|
|
4
4
|
import { BaseState } from '../../AdaptableState/BaseState';
|
|
5
5
|
import { IAdaptableStore, LoadStoreConfig } from './Interface/IAdaptableStore';
|
|
6
6
|
type EmitterCallback = (data?: any) => any;
|
|
7
7
|
type EmitterAnyCallback = (eventName: string, data?: any) => any;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Strips the transient (non-persisted) sections from the given state object - mutates and returns the same object.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getPersistableState: (state: AdaptableState) => AdaptablePersistentState;
|
|
9
12
|
export interface ResetUserDataAction extends Redux.Action {
|
|
10
13
|
}
|
|
11
14
|
export interface InitStateAction extends Redux.Action {
|
|
@@ -40,9 +43,9 @@ export declare class AdaptableStore implements IAdaptableStore {
|
|
|
40
43
|
*/
|
|
41
44
|
constructor(adaptable: IAdaptable);
|
|
42
45
|
destroy(): void;
|
|
43
|
-
getCurrentStorageState():
|
|
44
|
-
getPreviousStorageState():
|
|
45
|
-
saveStateNow(adaptable: IAdaptable, state?:
|
|
46
|
+
getCurrentStorageState(): AdaptablePersistentState;
|
|
47
|
+
getPreviousStorageState(): AdaptablePersistentState;
|
|
48
|
+
saveStateNow(adaptable: IAdaptable, state?: AdaptablePersistentState): Promise<any>;
|
|
46
49
|
loadStore: (config: LoadStoreConfig) => Promise<any>;
|
|
47
50
|
}
|
|
48
51
|
export {};
|