@adaptabletools/adaptable 23.0.5-canary.1 → 23.0.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/index.css +10 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +9 -0
- package/src/AdaptableOptions/DefaultAdaptableOptions.d.ts +17 -0
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +7 -46
- package/src/AdaptableOptions/EditOptions.d.ts +10 -2
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +3 -28
- package/src/AdaptableOptions/WizardOptions.d.ts +26 -0
- package/src/AdaptableOptions/WizardOptions.js +1 -0
- package/src/AdaptableState/Common/CustomWindowConfig.d.ts +2 -14
- package/src/AdaptableState/Common/Window.d.ts +33 -0
- package/src/AdaptableState/Common/Window.js +1 -0
- package/src/AdaptableState/InitialState.d.ts +2 -1
- package/src/AdaptableState/PlusMinusState.d.ts +12 -2
- package/src/Strategy/PlusMinusModule.js +5 -3
- package/src/Utilities/Extensions/ObjectExtensions.d.ts +16 -0
- package/src/Utilities/Extensions/ObjectExtensions.js +41 -0
- package/src/Utilities/Helpers/PlusMinusHelper.d.ts +62 -9
- package/src/Utilities/Helpers/PlusMinusHelper.js +180 -25
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +5 -1
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +7 -3
- package/src/View/Components/Popups/Utilities.d.ts +11 -0
- package/src/View/Components/Popups/Utilities.js +8 -0
- package/src/View/PlusMinus/Wizard/KeyComboCaptureInput.d.ts +30 -0
- package/src/View/PlusMinus/Wizard/KeyComboCaptureInput.js +161 -0
- package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +30 -60
- package/src/View/Wizard/OnePageWizards.js +27 -2
- package/src/agGrid/AdaptableAgGrid.js +2 -0
- package/src/env.js +2 -2
- package/src/migration/DeprecatedStateKeys.d.ts +37 -0
- package/src/migration/DeprecatedStateKeys.js +42 -0
- package/src/migration/VersionUpgrade23.d.ts +9 -0
- package/src/migration/VersionUpgrade23.js +1 -2
- package/src/types.d.ts +4 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.
|
|
1
|
+
/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties;
|
|
3
3
|
@layer adaptable.reset, adaptable.components, adaptable.utilities, adaptable.theming;
|
|
4
4
|
@property --tw-animation-delay {
|
|
@@ -1556,6 +1556,9 @@
|
|
|
1556
1556
|
.twa\:border-\[var\(--ab-cmp-wizard-type-selection-card__selected-border\)\] {
|
|
1557
1557
|
border-color: var(--ab-cmp-wizard-type-selection-card__selected-border);
|
|
1558
1558
|
}
|
|
1559
|
+
.twa\:border-accent {
|
|
1560
|
+
border-color: var(--ab-color-accent);
|
|
1561
|
+
}
|
|
1559
1562
|
.twa\:border-border {
|
|
1560
1563
|
border-color: var(--ab-color-border);
|
|
1561
1564
|
}
|
|
@@ -1567,6 +1570,9 @@
|
|
|
1567
1570
|
border-color: color-mix(in oklab, var(--ab-color-border) 60%, transparent);
|
|
1568
1571
|
}
|
|
1569
1572
|
}
|
|
1573
|
+
.twa\:border-destructive {
|
|
1574
|
+
border-color: var(--ab-color-destructive);
|
|
1575
|
+
}
|
|
1570
1576
|
.twa\:border-foreground\/10 {
|
|
1571
1577
|
border-color: var(--ab-color-foreground);
|
|
1572
1578
|
}
|
|
@@ -1864,6 +1870,9 @@
|
|
|
1864
1870
|
.twa\:py-3 {
|
|
1865
1871
|
padding-block: calc(var(--ab-base-space) * 3);
|
|
1866
1872
|
}
|
|
1873
|
+
.twa\:py-\[2px\] {
|
|
1874
|
+
padding-block: 2px;
|
|
1875
|
+
}
|
|
1867
1876
|
.twa\:\!pt-0 {
|
|
1868
1877
|
padding-top: 0 !important;
|
|
1869
1878
|
}
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import { DashboardOptions } from './DashboardOptions';
|
|
|
13
13
|
import { ToolPanelOptions } from './ToolPanelOptions';
|
|
14
14
|
import { DataChangeHistoryOptions } from './DataChangeHistoryOptions';
|
|
15
15
|
import { SettingsPanelOptions } from './SettingsPanelOptions';
|
|
16
|
+
import { WizardOptions } from './WizardOptions';
|
|
16
17
|
import { FlashingCellOptions } from './FlashingCellOptions';
|
|
17
18
|
import { AlertOptions } from './AlertOptions';
|
|
18
19
|
import { ExpressionOptions } from './ExpressionOptions';
|
|
@@ -228,6 +229,14 @@ export interface AdaptableOptions<TData = any, TContext = Record<string, any>> {
|
|
|
228
229
|
* @noCodeContainer
|
|
229
230
|
*/
|
|
230
231
|
settingsPanelOptions?: SettingsPanelOptions;
|
|
232
|
+
/**
|
|
233
|
+
* Options for managing Wizards (and other action popups such as Bulk Update,
|
|
234
|
+
* Smart Edit and Cell Summary) — controls their `popupType`, initial
|
|
235
|
+
* `position` and `size` independently of the Settings Panel.
|
|
236
|
+
*
|
|
237
|
+
* @noCodeContainer
|
|
238
|
+
*/
|
|
239
|
+
wizardOptions?: WizardOptions;
|
|
231
240
|
/**
|
|
232
241
|
* Options related to state hydration / dehydration - allows users to intercept state persistence and state loading and change default behaviour of saving to local storage
|
|
233
242
|
*/
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import { AdaptableOptions } from './AdaptableOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Merges the user-supplied `adaptableOptions` with `DefaultAdaptableOptions`,
|
|
4
|
+
* filling in any missing values at any nesting depth.
|
|
5
|
+
*
|
|
6
|
+
* Behaviour:
|
|
7
|
+
* - User-supplied leaf values always win.
|
|
8
|
+
* - Nested plain-object blocks (e.g. `editOptions.plusMinusOptions`,
|
|
9
|
+
* `fdc3Options.actionColumnDefaultConfiguration.rowScope`) are recursively
|
|
10
|
+
* merged so the user can override individual leaves without losing other
|
|
11
|
+
* default leaves in the same block.
|
|
12
|
+
* - Arrays, functions, primitives and class instances are NOT element-merged —
|
|
13
|
+
* the user's value replaces the default entirely.
|
|
14
|
+
* - The caller's input object is never mutated.
|
|
15
|
+
*
|
|
16
|
+
* Adding a new options block or nested sub-block only requires updating
|
|
17
|
+
* `DefaultAdaptableOptions` above — this function does not need to be touched.
|
|
18
|
+
*/
|
|
2
19
|
export declare function applyDefaultAdaptableOptions(adaptableOptions: AdaptableOptions): AdaptableOptions;
|
|
3
20
|
export declare const getDefaultAdaptableOptions: () => AdaptableOptions<any, Record<string, any>>;
|
|
@@ -4,6 +4,7 @@ import { ACCESS_LEVEL_FULL, EMPTY_STRING, EMPTY_ARRAY, DEFAULT_DATE_FORMAT_PATTE
|
|
|
4
4
|
import { SystemAlertPredicateIds, SystemBadgeStylePredicateIds, SystemFilterPredicateIds, SystemFlashingCellPredicateIds, SystemFormatColumnPredicateIds, } from '../AdaptableState/Common/AdaptablePredicate';
|
|
5
5
|
import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
|
|
6
6
|
import { addUuidsToInitialState } from '../Utilities/Helpers/AdaptableHelper';
|
|
7
|
+
import { defaultsDeep } from '../Utilities/Extensions/ObjectExtensions';
|
|
7
8
|
const DefaultAdaptableOptions = {
|
|
8
9
|
adaptableId: GeneralConstants.ADAPTABLE_ID,
|
|
9
10
|
adaptableStateKey: undefined,
|
|
@@ -275,6 +276,11 @@ const DefaultAdaptableOptions = {
|
|
|
275
276
|
customSettingsPanels: undefined,
|
|
276
277
|
gridInfoTabs: ['Grid Options', 'Grid Summary', 'Grid State'],
|
|
277
278
|
},
|
|
279
|
+
wizardOptions: {
|
|
280
|
+
popupType: undefined,
|
|
281
|
+
position: undefined,
|
|
282
|
+
size: undefined,
|
|
283
|
+
},
|
|
278
284
|
stateOptions: {
|
|
279
285
|
debounceStateDelay: 400,
|
|
280
286
|
applyState: (state) => state,
|
|
@@ -331,54 +337,9 @@ const DefaultAdaptableOptions = {
|
|
|
331
337
|
},
|
|
332
338
|
};
|
|
333
339
|
export function applyDefaultAdaptableOptions(adaptableOptions) {
|
|
334
|
-
const adaptableOptsWithDefaults =
|
|
340
|
+
const adaptableOptsWithDefaults = defaultsDeep({ ...adaptableOptions }, DefaultAdaptableOptions);
|
|
335
341
|
adaptableOptsWithDefaults.adaptableStateKey =
|
|
336
342
|
adaptableOptsWithDefaults.adaptableStateKey ?? adaptableOptsWithDefaults.adaptableId;
|
|
337
|
-
adaptableOptsWithDefaults.actionColumnOptions = Object.assign({}, DefaultAdaptableOptions.actionColumnOptions, adaptableOptions.actionColumnOptions);
|
|
338
|
-
adaptableOptsWithDefaults.rowFormOptions = Object.assign({}, DefaultAdaptableOptions.rowFormOptions, adaptableOptions.rowFormOptions);
|
|
339
|
-
adaptableOptsWithDefaults.alertOptions = Object.assign({}, DefaultAdaptableOptions.alertOptions, adaptableOptions.alertOptions);
|
|
340
|
-
adaptableOptsWithDefaults.calendarOptions = Object.assign({}, DefaultAdaptableOptions.calendarOptions, adaptableOptions.calendarOptions);
|
|
341
|
-
adaptableOptsWithDefaults.cellSummaryOptions = Object.assign({}, DefaultAdaptableOptions.cellSummaryOptions, adaptableOptions.cellSummaryOptions);
|
|
342
|
-
adaptableOptsWithDefaults.chartingOptions = Object.assign({}, DefaultAdaptableOptions.chartingOptions, adaptableOptions.chartingOptions);
|
|
343
|
-
adaptableOptsWithDefaults.chartingOptions.externalChartingOptions = Object.assign({}, DefaultAdaptableOptions.chartingOptions.externalChartingOptions, adaptableOptsWithDefaults.chartingOptions.externalChartingOptions);
|
|
344
|
-
adaptableOptsWithDefaults.columnOptions = Object.assign({}, DefaultAdaptableOptions.columnOptions, adaptableOptions.columnOptions);
|
|
345
|
-
adaptableOptsWithDefaults.filterOptions = Object.assign({}, DefaultAdaptableOptions.filterOptions, adaptableOptions.filterOptions);
|
|
346
|
-
adaptableOptsWithDefaults.filterOptions.columnFilterOptions = Object.assign({}, DefaultAdaptableOptions.filterOptions.columnFilterOptions, adaptableOptsWithDefaults.filterOptions.columnFilterOptions);
|
|
347
|
-
adaptableOptsWithDefaults.filterOptions.gridFilterOptions = Object.assign({}, DefaultAdaptableOptions.filterOptions.gridFilterOptions, adaptableOptsWithDefaults.filterOptions.gridFilterOptions);
|
|
348
|
-
adaptableOptsWithDefaults.columnMenuOptions = Object.assign({}, DefaultAdaptableOptions.columnMenuOptions, adaptableOptions.columnMenuOptions);
|
|
349
|
-
adaptableOptsWithDefaults.commentOptions = Object.assign({}, DefaultAdaptableOptions.commentOptions, adaptableOptions.commentOptions);
|
|
350
|
-
adaptableOptsWithDefaults.containerOptions = Object.assign({}, DefaultAdaptableOptions.containerOptions, adaptableOptions.containerOptions);
|
|
351
|
-
adaptableOptsWithDefaults.contextMenuOptions = Object.assign({}, DefaultAdaptableOptions.contextMenuOptions, adaptableOptions.contextMenuOptions);
|
|
352
|
-
adaptableOptsWithDefaults.customSortOptions = Object.assign({}, DefaultAdaptableOptions.customSortOptions, adaptableOptions.customSortOptions);
|
|
353
|
-
adaptableOptsWithDefaults.dashboardOptions = Object.assign({}, DefaultAdaptableOptions.dashboardOptions, adaptableOptions.dashboardOptions);
|
|
354
|
-
adaptableOptsWithDefaults.dataImportOptions = Object.assign({}, DefaultAdaptableOptions.dataImportOptions, adaptableOptions.dataImportOptions);
|
|
355
|
-
adaptableOptsWithDefaults.dataChangeHistoryOptions = Object.assign({}, DefaultAdaptableOptions.dataChangeHistoryOptions, adaptableOptions.dataChangeHistoryOptions);
|
|
356
|
-
adaptableOptsWithDefaults.dataSetOptions = Object.assign({}, DefaultAdaptableOptions.dataSetOptions, adaptableOptions.dataSetOptions);
|
|
357
|
-
adaptableOptsWithDefaults.editOptions = Object.assign({}, DefaultAdaptableOptions.editOptions, adaptableOptions.editOptions);
|
|
358
|
-
adaptableOptsWithDefaults.editOptions.plusMinusOptions = Object.assign({}, DefaultAdaptableOptions.editOptions.plusMinusOptions, adaptableOptsWithDefaults.editOptions.plusMinusOptions);
|
|
359
|
-
adaptableOptsWithDefaults.editOptions.smartEditOptions = Object.assign({}, DefaultAdaptableOptions.editOptions.smartEditOptions, adaptableOptsWithDefaults.editOptions.smartEditOptions);
|
|
360
|
-
adaptableOptsWithDefaults.entitlementOptions = Object.assign({}, DefaultAdaptableOptions.entitlementOptions, adaptableOptions.entitlementOptions);
|
|
361
|
-
adaptableOptsWithDefaults.exportOptions = Object.assign({}, DefaultAdaptableOptions.exportOptions, adaptableOptions.exportOptions);
|
|
362
|
-
adaptableOptsWithDefaults.expressionOptions = Object.assign({}, DefaultAdaptableOptions.expressionOptions, adaptableOptions.expressionOptions);
|
|
363
|
-
adaptableOptsWithDefaults.fdc3Options = Object.assign({}, DefaultAdaptableOptions.fdc3Options, adaptableOptions.fdc3Options);
|
|
364
|
-
adaptableOptsWithDefaults.fdc3Options.actionColumnDefaultConfiguration = Object.assign({}, DefaultAdaptableOptions.fdc3Options.actionColumnDefaultConfiguration, adaptableOptsWithDefaults.fdc3Options.actionColumnDefaultConfiguration);
|
|
365
|
-
adaptableOptsWithDefaults.fdc3Options.uiControlsDefaultConfiguration = Object.assign({}, DefaultAdaptableOptions.fdc3Options.uiControlsDefaultConfiguration, adaptableOptsWithDefaults.fdc3Options.uiControlsDefaultConfiguration);
|
|
366
|
-
adaptableOptsWithDefaults.flashingCellOptions = Object.assign({}, DefaultAdaptableOptions.flashingCellOptions, adaptableOptions.flashingCellOptions);
|
|
367
|
-
adaptableOptsWithDefaults.formatColumnOptions = Object.assign({}, DefaultAdaptableOptions.formatColumnOptions, adaptableOptions.formatColumnOptions);
|
|
368
|
-
adaptableOptsWithDefaults.layoutOptions = Object.assign({}, DefaultAdaptableOptions.layoutOptions, adaptableOptions.layoutOptions);
|
|
369
|
-
adaptableOptsWithDefaults.layoutOptions.layoutTagOptions = Object.assign({}, DefaultAdaptableOptions.layoutOptions.layoutTagOptions, adaptableOptsWithDefaults.layoutOptions.layoutTagOptions);
|
|
370
|
-
adaptableOptsWithDefaults.layoutOptions.layoutViewOptions = Object.assign({}, DefaultAdaptableOptions.layoutOptions.layoutViewOptions, adaptableOptsWithDefaults.layoutOptions.layoutViewOptions);
|
|
371
|
-
adaptableOptsWithDefaults.noteOptions = Object.assign({}, DefaultAdaptableOptions.noteOptions, adaptableOptions.noteOptions);
|
|
372
|
-
adaptableOptsWithDefaults.notificationsOptions = Object.assign({}, DefaultAdaptableOptions.notificationsOptions, adaptableOptions.notificationsOptions);
|
|
373
|
-
adaptableOptsWithDefaults.predicateOptions = Object.assign({}, DefaultAdaptableOptions.predicateOptions, adaptableOptsWithDefaults.predicateOptions);
|
|
374
|
-
adaptableOptsWithDefaults.quickSearchOptions = Object.assign({}, DefaultAdaptableOptions.quickSearchOptions, adaptableOptions.quickSearchOptions);
|
|
375
|
-
adaptableOptsWithDefaults.settingsPanelOptions = Object.assign({}, DefaultAdaptableOptions.settingsPanelOptions, adaptableOptions.settingsPanelOptions);
|
|
376
|
-
adaptableOptsWithDefaults.stateOptions = Object.assign({}, DefaultAdaptableOptions.stateOptions, adaptableOptions.stateOptions);
|
|
377
|
-
adaptableOptsWithDefaults.teamSharingOptions = Object.assign({}, DefaultAdaptableOptions.teamSharingOptions, adaptableOptions.teamSharingOptions);
|
|
378
|
-
adaptableOptsWithDefaults.toolPanelOptions = Object.assign({}, DefaultAdaptableOptions.toolPanelOptions, adaptableOptions.toolPanelOptions);
|
|
379
|
-
adaptableOptsWithDefaults.userInterfaceOptions = Object.assign({}, DefaultAdaptableOptions.userInterfaceOptions, adaptableOptions.userInterfaceOptions);
|
|
380
|
-
adaptableOptsWithDefaults.userInterfaceOptions.loadingScreenOptions = Object.assign({}, DefaultAdaptableOptions.userInterfaceOptions.loadingScreenOptions, adaptableOptsWithDefaults.userInterfaceOptions.loadingScreenOptions);
|
|
381
|
-
adaptableOptsWithDefaults.userInterfaceOptions.dateInputOptions = Object.assign({}, DefaultAdaptableOptions.userInterfaceOptions.dateInputOptions, adaptableOptsWithDefaults.userInterfaceOptions.dateInputOptions);
|
|
382
343
|
const { initialState } = adaptableOptsWithDefaults;
|
|
383
344
|
adaptableOptsWithDefaults.initialState = addUuidsToInitialState(initialState);
|
|
384
345
|
return adaptableOptsWithDefaults;
|
|
@@ -149,13 +149,21 @@ export interface CellEditableContext<TData = any> extends BaseContext {
|
|
|
149
149
|
*/
|
|
150
150
|
export interface PlusMinusOptions {
|
|
151
151
|
/**
|
|
152
|
-
* Key to increase cell value for nudges (if not overriden in Plus Minus Rule)
|
|
152
|
+
* Key to increase cell value for nudges (if not overriden in Plus Minus Rule/Nudge).
|
|
153
|
+
*
|
|
154
|
+
* Can be a single key (e.g. `'+'`) or a keyboard shortcut combination that uses
|
|
155
|
+
* `+` as the glue between parts (e.g. `'shift+Enter'`, `'ctrl+ArrowUp'`).
|
|
156
|
+
* Supported modifiers are `ctrl`, `cmd`, `alt` and `shift`.
|
|
153
157
|
*
|
|
154
158
|
* @defaultValue '+'
|
|
155
159
|
*/
|
|
156
160
|
incrementKey?: string;
|
|
157
161
|
/**
|
|
158
|
-
* Key to decrease cell value for nudges (if not overriden in Plus Minus Rule)
|
|
162
|
+
* Key to decrease cell value for nudges (if not overriden in Plus Minus Rule/Nudge).
|
|
163
|
+
*
|
|
164
|
+
* Can be a single key (e.g. `'-'`) or a keyboard shortcut combination that uses
|
|
165
|
+
* `+` as the glue between parts (e.g. `'shift+Backspace'`, `'ctrl+ArrowDown'`).
|
|
166
|
+
* Supported modifiers are `ctrl`, `cmd`, `alt` and `shift`.
|
|
159
167
|
*
|
|
160
168
|
* @defaultValue '-'
|
|
161
169
|
*/
|
|
@@ -2,6 +2,7 @@ import { AdaptableFrameworkComponent, AdaptableIcon } from '../../types';
|
|
|
2
2
|
import { AdaptableSettingsPanel } from '../AdaptableState/Common/Types';
|
|
3
3
|
import { BaseContext } from '../AdaptableState/Common/BaseContext';
|
|
4
4
|
import { CustomRenderContext } from '../agGrid/AdaptableFrameworkComponent';
|
|
5
|
+
import { WindowPosition, WindowSize } from '../AdaptableState/Common/Window';
|
|
5
6
|
/**
|
|
6
7
|
* Options for managing the AdapTable Settings Panel
|
|
7
8
|
*/
|
|
@@ -44,13 +45,13 @@ export interface SettingsPanelOptions {
|
|
|
44
45
|
*
|
|
45
46
|
* @defaultValue Middle of Screen
|
|
46
47
|
*/
|
|
47
|
-
position?:
|
|
48
|
+
position?: WindowPosition;
|
|
48
49
|
/**
|
|
49
50
|
* Initial size (in pixels) of Settings Panel (requires `popupType` to be `'window'`)
|
|
50
51
|
*
|
|
51
52
|
* @defaultValue Computed based on size of screen
|
|
52
53
|
*/
|
|
53
|
-
size?:
|
|
54
|
+
size?: WindowSize;
|
|
54
55
|
/**
|
|
55
56
|
* How the Settings Panel is rendered: `'modal'` (centred and unmovable and resizable) or `'window'` (supports size, position, drag and resize)
|
|
56
57
|
*
|
|
@@ -68,32 +69,6 @@ export interface SettingsPanelOptions {
|
|
|
68
69
|
*/
|
|
69
70
|
gridInfoTabs?: GridInfoTabs;
|
|
70
71
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Pixel offset of Settings Panel's top-left corner from top-left of the viewport
|
|
73
|
-
*/
|
|
74
|
-
export interface SettingsPanelPosition {
|
|
75
|
-
/**
|
|
76
|
-
* Distance from the left edge of the viewport, in pixels.
|
|
77
|
-
*/
|
|
78
|
-
x: number;
|
|
79
|
-
/**
|
|
80
|
-
* Distance from the top edge of the viewport, in pixels.
|
|
81
|
-
*/
|
|
82
|
-
y: number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Initial dimensions (in pixels) of the Settings Panel
|
|
86
|
-
*/
|
|
87
|
-
export interface SettingsPanelSize {
|
|
88
|
-
/**
|
|
89
|
-
* Width of the Settings Panel, in pixels.
|
|
90
|
-
*/
|
|
91
|
-
width: number;
|
|
92
|
-
/**
|
|
93
|
-
* Height of the Settings Panel, in pixels.
|
|
94
|
-
*/
|
|
95
|
-
height: number;
|
|
96
|
-
}
|
|
97
72
|
/**
|
|
98
73
|
* A labelled group of Settings Panel navigation entries.
|
|
99
74
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { WindowPosition, WindowSize } from '../AdaptableState/Common/Window';
|
|
2
|
+
import { PopupType } from './SettingsPanelOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for managing AdapTable Wizards
|
|
5
|
+
*/
|
|
6
|
+
export interface WizardOptions {
|
|
7
|
+
/**
|
|
8
|
+
* How wizards are rendered: `'modal'` (centred & unmovable) or `'window'` (supports size, position, drag, resize)
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue inherits from `settingsPanelOptions.popupType`
|
|
11
|
+
*/
|
|
12
|
+
popupType?: PopupType;
|
|
13
|
+
/**
|
|
14
|
+
* Initial position of wizard — pixel offset of top-left corner from top-left of viewport (requires `popupType`: `'window'`)
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue Middle of Screen
|
|
17
|
+
*/
|
|
18
|
+
position?: WindowPosition;
|
|
19
|
+
/**
|
|
20
|
+
* Initial size (in pixels) of wizard (requires `popupType`: `'window'`)
|
|
21
|
+
* `'window'`).
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue Computed default sized for wizards
|
|
24
|
+
*/
|
|
25
|
+
size?: WindowSize;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AdaptableSystemIconName } from '../../types';
|
|
2
2
|
import { CustomRenderContext, AdaptableFrameworkComponent } from '../../agGrid/AdaptableFrameworkComponent';
|
|
3
|
+
import { WindowPosition, WindowSize } from './Window';
|
|
3
4
|
/**
|
|
4
5
|
* Config used to open a Custom Window
|
|
5
6
|
*/
|
|
@@ -37,17 +38,4 @@ export interface CustomWindowConfig {
|
|
|
37
38
|
*/
|
|
38
39
|
position?: WindowPosition;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
* Defines size of a Custom Window
|
|
42
|
-
*/
|
|
43
|
-
export interface WindowSize {
|
|
44
|
-
width: number;
|
|
45
|
-
height: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Defines position of a Custom Window
|
|
49
|
-
*/
|
|
50
|
-
export interface WindowPosition {
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
}
|
|
41
|
+
export type { WindowPosition, WindowSize } from './Window';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic window-shaped types used wherever AdapTable needs a position and/or
|
|
3
|
+
* size in pixels (Settings Panel, Wizards, Custom Windows, etc.).
|
|
4
|
+
*
|
|
5
|
+
* Co-located in `AdaptableState/Common` so any options block can pull in the
|
|
6
|
+
* same shape without re-declaring it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Pixel offset of a window's top-left corner from the top-left of the viewport.
|
|
10
|
+
*/
|
|
11
|
+
export interface WindowPosition {
|
|
12
|
+
/**
|
|
13
|
+
* Distance from the left edge of the viewport, in pixels.
|
|
14
|
+
*/
|
|
15
|
+
x: number;
|
|
16
|
+
/**
|
|
17
|
+
* Distance from the top edge of the viewport, in pixels.
|
|
18
|
+
*/
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Initial dimensions (in pixels) of a window.
|
|
23
|
+
*/
|
|
24
|
+
export interface WindowSize {
|
|
25
|
+
/**
|
|
26
|
+
* Width of the window, in pixels.
|
|
27
|
+
*/
|
|
28
|
+
width: number;
|
|
29
|
+
/**
|
|
30
|
+
* Height of the window, in pixels.
|
|
31
|
+
*/
|
|
32
|
+
height: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -77,7 +77,8 @@ export interface InitialState {
|
|
|
77
77
|
Note?: NoteState;
|
|
78
78
|
/**
|
|
79
79
|
* Plus Minus module: nudge rules. Optional `IncrementKey` / `DecrementKey` on each nudge
|
|
80
|
-
*
|
|
80
|
+
* accept either a single key or a keyboard shortcut combination (e.g. `shift+Enter`); when
|
|
81
|
+
* omitted, `AdaptableOptions.plusMinusOptions` applies, then `+` / `-`.
|
|
81
82
|
*/
|
|
82
83
|
PlusMinus?: PlusMinusState;
|
|
83
84
|
/**
|
|
@@ -32,11 +32,21 @@ export interface PlusMinusNudge extends SuspendableObject {
|
|
|
32
32
|
*/
|
|
33
33
|
Rule?: AdaptableBooleanQuery;
|
|
34
34
|
/**
|
|
35
|
-
* Optional keyboard
|
|
35
|
+
* Optional keyboard key that increases cell values for this nudge only (overrides the
|
|
36
|
+
* global `incrementKey` in `plusMinusOptions`).
|
|
37
|
+
*
|
|
38
|
+
* Can be a single key (e.g. `'+'`) or a keyboard shortcut combination that uses `+` as the glue
|
|
39
|
+
* between parts (e.g. `'shift+Enter'`, `'ctrl+ArrowUp'`). Supported modifiers are `ctrl`, `cmd`,
|
|
40
|
+
* `alt` and `shift`.
|
|
36
41
|
*/
|
|
37
42
|
IncrementKey?: string;
|
|
38
43
|
/**
|
|
39
|
-
* Optional keyboard
|
|
44
|
+
* Optional keyboard key that decreases cell values for this nudge only (overrides the
|
|
45
|
+
* global `decrementKey` in `plusMinusOptions`).
|
|
46
|
+
*
|
|
47
|
+
* Can be a single key (e.g. `'-'`) or a keyboard shortcut combination that uses `+` as the glue
|
|
48
|
+
* between parts (e.g. `'shift+Backspace'`, `'ctrl+ArrowDown'`). Supported modifiers are `ctrl`,
|
|
49
|
+
* `cmd`, `alt` and `shift`.
|
|
40
50
|
*/
|
|
41
51
|
DecrementKey?: string;
|
|
42
52
|
}
|
|
@@ -11,7 +11,7 @@ import { MovePlusMinus } from '../View/PlusMinus/MovePlusMinus';
|
|
|
11
11
|
import { PlusMinusWizard } from '../View/PlusMinus/Wizard/PlusMinusWizard';
|
|
12
12
|
import { errorOnce } from '../agGrid/AdaptableLogger';
|
|
13
13
|
import NumberExtensions from '../Utilities/Extensions/NumberExtensions';
|
|
14
|
-
import { buildPlusMinusTriggerKeyLookup,
|
|
14
|
+
import { buildPlusMinusTriggerKeyLookup, plusMinusEventMatchesTrigger, plusMinusKeyCouldTrigger, resolvePlusMinusTriggerKeysForNudge, } from '../Utilities/Helpers/PlusMinusHelper';
|
|
15
15
|
export class PlusMinusModule extends AdaptableModuleBase {
|
|
16
16
|
shouldHandleKeyDown;
|
|
17
17
|
adaptable;
|
|
@@ -116,11 +116,11 @@ export class PlusMinusModule extends AdaptableModuleBase {
|
|
|
116
116
|
}
|
|
117
117
|
const decrementMatches = allActive.filter((nudge) => {
|
|
118
118
|
const { decrementKey } = resolvePlusMinusTriggerKeysForNudge(nudge, pmOpts);
|
|
119
|
-
return
|
|
119
|
+
return plusMinusEventMatchesTrigger(keyEvent, decrementKey);
|
|
120
120
|
});
|
|
121
121
|
const incrementMatches = allActive.filter((nudge) => {
|
|
122
122
|
const { incrementKey } = resolvePlusMinusTriggerKeysForNudge(nudge, pmOpts);
|
|
123
|
-
return
|
|
123
|
+
return plusMinusEventMatchesTrigger(keyEvent, incrementKey);
|
|
124
124
|
});
|
|
125
125
|
let side;
|
|
126
126
|
let plusMinusNudges;
|
|
@@ -138,6 +138,8 @@ export class PlusMinusModule extends AdaptableModuleBase {
|
|
|
138
138
|
const isPlusMinusApplicable = this.applyPlusMinus(plusMinusNudges, this.api.gridApi.getSelectedCellInfo().gridCells, side);
|
|
139
139
|
if (isPlusMinusApplicable) {
|
|
140
140
|
keyEvent.preventDefault();
|
|
141
|
+
keyEvent.stopImmediatePropagation?.();
|
|
142
|
+
keyEvent.stopPropagation?.();
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
applyPlusMinus(plusMinusNudges, cellsToUpdate, direction) {
|
|
@@ -56,4 +56,20 @@ export declare function merge(target: any, ...sources: any[]): any;
|
|
|
56
56
|
* Drop-in replacement for lodash/mergeWith.
|
|
57
57
|
*/
|
|
58
58
|
export declare function mergeWith<T extends object>(target: T, ...args: any[]): T;
|
|
59
|
+
/**
|
|
60
|
+
* Recursively fills in missing properties on `target` from one or more
|
|
61
|
+
* `sources` (defaults). For each key:
|
|
62
|
+
*
|
|
63
|
+
* - if the target value is `undefined`, it is replaced with a fresh clone of
|
|
64
|
+
* the source value;
|
|
65
|
+
* - if both the target and source values are plain objects, the merge recurses
|
|
66
|
+
* into them (the target's nested object is shallow-copied first, so the
|
|
67
|
+
* caller's input is never mutated);
|
|
68
|
+
* - otherwise the target value wins as-is (arrays, functions, primitives, class
|
|
69
|
+
* instances etc. are NOT element-merged — the user's value replaces the
|
|
70
|
+
* default entirely).
|
|
71
|
+
*
|
|
72
|
+
* Drop-in replacement for lodash/defaultsDeep.
|
|
73
|
+
*/
|
|
74
|
+
export declare function defaultsDeep<T extends object>(target: T, ...sources: any[]): T;
|
|
59
75
|
export {};
|
|
@@ -269,3 +269,44 @@ export function mergeWith(target, ...args) {
|
|
|
269
269
|
}
|
|
270
270
|
return target;
|
|
271
271
|
}
|
|
272
|
+
export function defaultsDeep(target, ...sources) {
|
|
273
|
+
for (const source of sources) {
|
|
274
|
+
_baseDefaultsDeep(target, source);
|
|
275
|
+
}
|
|
276
|
+
return target;
|
|
277
|
+
}
|
|
278
|
+
function _baseDefaultsDeep(target, defaults) {
|
|
279
|
+
if (defaults == null) {
|
|
280
|
+
return target;
|
|
281
|
+
}
|
|
282
|
+
const keys = Object.keys(defaults);
|
|
283
|
+
for (const key of keys) {
|
|
284
|
+
const defaultValue = defaults[key];
|
|
285
|
+
const targetValue = target[key];
|
|
286
|
+
if (targetValue === undefined) {
|
|
287
|
+
target[key] = _cloneDefaultValue(defaultValue);
|
|
288
|
+
}
|
|
289
|
+
else if (isPlainObject(defaultValue) && isPlainObject(targetValue)) {
|
|
290
|
+
const childCopy = { ...targetValue };
|
|
291
|
+
_baseDefaultsDeep(childCopy, defaultValue);
|
|
292
|
+
target[key] = childCopy;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return target;
|
|
296
|
+
}
|
|
297
|
+
function _cloneDefaultValue(value) {
|
|
298
|
+
if (value === null || typeof value !== 'object') {
|
|
299
|
+
return value;
|
|
300
|
+
}
|
|
301
|
+
if (Array.isArray(value)) {
|
|
302
|
+
return value.map(_cloneDefaultValue);
|
|
303
|
+
}
|
|
304
|
+
if (isPlainObject(value)) {
|
|
305
|
+
const out = {};
|
|
306
|
+
for (const k of Object.keys(value)) {
|
|
307
|
+
out[k] = _cloneDefaultValue(value[k]);
|
|
308
|
+
}
|
|
309
|
+
return out;
|
|
310
|
+
}
|
|
311
|
+
return value;
|
|
312
|
+
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { EditOptions, PlusMinusOptions } from '../../AdaptableOptions/EditOptions';
|
|
2
2
|
import type { PlusMinusNudge } from '../../AdaptableState/PlusMinusState';
|
|
3
|
+
/**
|
|
4
|
+
* Minimal shape required to match a key press against a Plus/Minus trigger.
|
|
5
|
+
* Compatible with the native `KeyboardEvent`.
|
|
6
|
+
*/
|
|
7
|
+
export type PlusMinusKeyEvent = {
|
|
8
|
+
key: string;
|
|
9
|
+
metaKey?: boolean;
|
|
10
|
+
altKey?: boolean;
|
|
11
|
+
ctrlKey?: boolean;
|
|
12
|
+
shiftKey?: boolean;
|
|
13
|
+
};
|
|
3
14
|
/**
|
|
4
15
|
* Resolve increment/decrement trigger strings for a single nudge.
|
|
5
16
|
* Per-nudge fields win; otherwise {@link PlusMinusOptions}; otherwise `+` / `-`.
|
|
@@ -11,26 +22,68 @@ export declare function resolvePlusMinusTriggerKeysForNudge(nudge: Pick<PlusMinu
|
|
|
11
22
|
/** True when resolved increment and decrement would match the same key press. */
|
|
12
23
|
export declare function plusMinusResolvedKeysConflict(nudge: Pick<PlusMinusNudge, 'IncrementKey' | 'DecrementKey'>, globalOptions: Readonly<EditOptions['plusMinusOptions']> | undefined): boolean;
|
|
13
24
|
/**
|
|
14
|
-
* Match a pressed key against a configured trigger.
|
|
15
|
-
*
|
|
25
|
+
* Match a pressed key (with its modifier state) against a configured trigger.
|
|
26
|
+
* Single-character triggers (including the defaults `+` / `-`) are compared
|
|
27
|
+
* case-insensitively against the pressed key. Multi-character triggers are
|
|
28
|
+
* parsed as keyboard shortcut combinations (e.g. `shift+Enter`) and delegated
|
|
29
|
+
* to {@link eventMatchesKeyboardShortcut}.
|
|
16
30
|
*/
|
|
17
|
-
export declare function
|
|
31
|
+
export declare function plusMinusEventMatchesTrigger(event: PlusMinusKeyEvent, configuredKey: string): boolean;
|
|
18
32
|
/** Increment key from `AdaptableOptions.plusMinusOptions` only, then built-in `+`. */
|
|
19
33
|
export declare function plusMinusIncrementKeyFromOptionsOnly(globalOptions: Readonly<PlusMinusOptions> | undefined): string;
|
|
20
34
|
/** Decrement key from `AdaptableOptions.plusMinusOptions` only, then built-in `-`. */
|
|
21
35
|
export declare function plusMinusDecrementKeyFromOptionsOnly(globalOptions: Readonly<PlusMinusOptions> | undefined): string;
|
|
22
36
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
37
|
+
* Canonical, comparable form of a trigger so equivalent descriptors compare
|
|
38
|
+
* equal regardless of case or modifier ordering (e.g. `Shift+Enter` and
|
|
39
|
+
* `shift+enter` normalise to the same value). Single characters are lowercased.
|
|
40
|
+
*/
|
|
41
|
+
export declare function normalizePlusMinusTrigger(trigger: string | undefined): string;
|
|
42
|
+
/**
|
|
43
|
+
* True when `candidate` is the same trigger as `baseline` for “no nudge override
|
|
44
|
+
* to persist” (normalised comparison, see {@link normalizePlusMinusTrigger}).
|
|
25
45
|
*/
|
|
26
46
|
export declare function plusMinusTriggerSameAsBaseline(candidate: string, baseline: string): boolean;
|
|
47
|
+
/** Result of interpreting a key press inside a "record shortcut" UI. */
|
|
48
|
+
export type PlusMinusCaptureResult = {
|
|
49
|
+
kind: 'pending';
|
|
50
|
+
modifiers: string[];
|
|
51
|
+
} | {
|
|
52
|
+
kind: 'invalid';
|
|
53
|
+
reason: string;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'captured';
|
|
56
|
+
trigger: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Interpret a key press (from a "record shortcut" UI, à la VS Code) into a
|
|
60
|
+
* Plus/Minus trigger:
|
|
61
|
+
* - `pending`: only modifier keys are held so far (waiting for a real key).
|
|
62
|
+
* - `captured`: a complete, representable trigger — a single literal character
|
|
63
|
+
* (such as the default `+`), a named key (e.g. `Enter`), or a modifier
|
|
64
|
+
* combination (e.g. `shift+Enter`).
|
|
65
|
+
* - `invalid`: the press cannot be represented as a trigger (e.g. a `+`
|
|
66
|
+
* character combined with modifiers, since `+` is the glue between parts).
|
|
67
|
+
*/
|
|
68
|
+
export declare function capturePlusMinusTriggerFromEvent(event: PlusMinusKeyEvent): PlusMinusCaptureResult;
|
|
69
|
+
/** Human-friendly label for a single trigger token (a modifier or a key). */
|
|
70
|
+
export declare function plusMinusKeyLabel(token: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Split a stored trigger into human-friendly key tokens for kbd-style display
|
|
73
|
+
* (e.g. `shift+Enter` -> `['Shift', 'Enter']`, `+` -> `['+']`).
|
|
74
|
+
*/
|
|
75
|
+
export declare function plusMinusTriggerDisplayParts(trigger: string): string[];
|
|
27
76
|
/**
|
|
28
|
-
* Precomputed keys for fast keydown filtering
|
|
29
|
-
*
|
|
77
|
+
* Precomputed keys for fast keydown filtering. Stores the lowercased
|
|
78
|
+
* non-modifier key of each trigger (the default `+` / `-`, a literal single
|
|
79
|
+
* char, or the key part of a combination such as `enter` for `shift+Enter`),
|
|
80
|
+
* so a pressed `event.key` can be cheaply rejected before running nudge rules.
|
|
30
81
|
*/
|
|
31
82
|
export type PlusMinusTriggerKeyLookup = {
|
|
32
|
-
|
|
33
|
-
|
|
83
|
+
/** Lowercased non-modifier keys that could trigger a nudge. */
|
|
84
|
+
effectiveKeysLower: Set<string>;
|
|
85
|
+
/** True when a trigger uses the `*` wildcard, so any key could match. */
|
|
86
|
+
matchAnyKey: boolean;
|
|
34
87
|
};
|
|
35
88
|
/** Build a lookup of all increment/decrement keys across active nudges (resolved). */
|
|
36
89
|
export declare function buildPlusMinusTriggerKeyLookup(nudges: PlusMinusNudge[], globalOptions: Readonly<PlusMinusOptions> | undefined): PlusMinusTriggerKeyLookup;
|