@adaptabletools/adaptable 20.2.8 → 20.2.9
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/base.css +54 -58
- package/base.css.map +1 -1
- package/index.css +54 -54
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/Api/Events/LayoutChanged.d.ts +5 -1
- package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -5
- package/src/Api/Implementation/LayoutApiImpl.js +25 -31
- package/src/Api/Internal/EventInternalApi.d.ts +2 -1
- package/src/Api/LayoutApi.d.ts +8 -29
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +1 -15
- package/src/Redux/ActionsReducers/LayoutRedux.js +1 -53
- package/src/Strategy/LayoutModule.d.ts +1 -0
- package/src/Strategy/LayoutModule.js +9 -2
- package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +38 -1
- package/src/components/ColorPicker/ColorPicker.js +15 -2
- package/src/env.js +2 -2
- package/src/types.d.ts +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -258,13 +258,6 @@ export class LayoutApiImpl extends ApiBase {
|
|
|
258
258
|
},
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
-
isCurrentLayoutReadOnly() {
|
|
262
|
-
const currentLayout = this.getCurrentLayout();
|
|
263
|
-
if (currentLayout) {
|
|
264
|
-
return currentLayout.IsReadOnly;
|
|
265
|
-
}
|
|
266
|
-
return true;
|
|
267
|
-
}
|
|
268
261
|
deleteLayout(layout) {
|
|
269
262
|
const layoutCount = this.getLayouts().length;
|
|
270
263
|
if (layoutCount === 1) {
|
|
@@ -282,38 +275,39 @@ export class LayoutApiImpl extends ApiBase {
|
|
|
282
275
|
return this.deleteLayout(layout);
|
|
283
276
|
}
|
|
284
277
|
removeColumnFromCurrentLayout(columnId) {
|
|
285
|
-
this.removeColumnFromLayout(columnId, this.getCurrentLayoutName());
|
|
286
|
-
}
|
|
287
|
-
removeColumnFromAllLayouts(columnId) {
|
|
288
|
-
this.getLayouts().forEach((layout) => {
|
|
289
|
-
this.removeColumnFromLayout(columnId, layout.Name);
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
removeColumnFromLayout(columnId, layoutName) {
|
|
293
278
|
const column = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
294
279
|
if (column) {
|
|
295
|
-
const layout = this.
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
280
|
+
const layout = this.getCurrentLayout();
|
|
281
|
+
if (!isPivotLayout(layout)) {
|
|
282
|
+
this.updateCurrentLayout((layout) => {
|
|
283
|
+
layout.TableColumns = layout.TableColumns.filter((c) => c !== columnId);
|
|
284
|
+
return layout;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
this.updateCurrentLayout((layout) => {
|
|
289
|
+
layout.PivotColumns = layout.PivotColumns.filter((c) => c !== columnId);
|
|
290
|
+
return layout;
|
|
291
|
+
});
|
|
301
292
|
}
|
|
302
293
|
}
|
|
303
294
|
}
|
|
304
|
-
|
|
295
|
+
addColumnToCurrentLayout(columnId) {
|
|
305
296
|
const column = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
306
297
|
if (column) {
|
|
307
|
-
const layout = this.
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
298
|
+
const layout = this.getCurrentLayout();
|
|
299
|
+
if (!isPivotLayout(layout)) {
|
|
300
|
+
this.updateCurrentLayout((layout) => {
|
|
301
|
+
layout.TableColumns.push(columnId);
|
|
302
|
+
return layout;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
this.updateCurrentLayout((layout) => {
|
|
307
|
+
layout.PivotColumns.push(columnId);
|
|
308
|
+
return layout;
|
|
309
|
+
});
|
|
313
310
|
}
|
|
314
311
|
}
|
|
315
312
|
}
|
|
316
|
-
addColumnToCurrentTableLayout(columnId) {
|
|
317
|
-
this.addColumnToTableLayout(columnId, this.getCurrentLayoutName());
|
|
318
|
-
}
|
|
319
313
|
}
|
|
@@ -4,6 +4,7 @@ import { CellDataChangedInfo } from '../../AdaptableState/Common/CellDataChanged
|
|
|
4
4
|
import { AdaptableAlert, AdaptableFlashingCell, AdaptablePersistentState, AdaptableSharedEntity, AdaptableState, AdaptableTheme, CalculatedColumn, CreatedRowInfo, DashboardState, DataImportedInfo, DataSet, DeletedRowInfo, EditedRowInfo, LayoutState, RowDataChangedInfo, SystemStatusMessageInfo } from '../../types';
|
|
5
5
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
6
6
|
import { BaseSchedule } from '../../AdaptableState/Common/Schedule';
|
|
7
|
+
import { LayoutChangedAction } from '../Events/LayoutChanged';
|
|
7
8
|
export declare class EventInternalApi extends ApiBase {
|
|
8
9
|
fireGridSortedEvent(): void;
|
|
9
10
|
fireCellChangedEvent(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
@@ -11,7 +12,7 @@ export declare class EventInternalApi extends ApiBase {
|
|
|
11
12
|
fireDashboardChangedEvent(trigger: string, oldDashboardState: DashboardState, newDashboardState: DashboardState): void;
|
|
12
13
|
fireAlertFiredEvent(alertToFire: AdaptableAlert): void;
|
|
13
14
|
fireThemeChangedEvent(theme: AdaptableTheme, trigger: 'ThemeSelected' | 'ThemeEdited'): void;
|
|
14
|
-
fireLayoutChangedEvent(trigger:
|
|
15
|
+
fireLayoutChangedEvent(trigger: LayoutChangedAction, oldState: LayoutState, newState: LayoutState): void;
|
|
15
16
|
fireScheduleTriggeredEvent(schedule: BaseSchedule): void;
|
|
16
17
|
fireDataSetSelectedEvent(dataSet: DataSet): void;
|
|
17
18
|
fireSystemStatusMessageDisplayedEvent(systemStatusMessageInfo: SystemStatusMessageInfo): void;
|
package/src/Api/LayoutApi.d.ts
CHANGED
|
@@ -88,26 +88,26 @@ export interface LayoutApi {
|
|
|
88
88
|
*/
|
|
89
89
|
updateCurrentLayout(updateFn: (layout: TableLayout | PivotLayout) => TableLayout | PivotLayout): void;
|
|
90
90
|
/**
|
|
91
|
-
* Creates new Layout
|
|
91
|
+
* Creates a new Layout
|
|
92
92
|
* @param layoutToCreate Layout to create
|
|
93
93
|
* @returns created Layout object or `false` if Layout with the same name/Uuid already exists
|
|
94
94
|
*/
|
|
95
95
|
createLayout(layoutToCreate: Layout): Layout | false;
|
|
96
96
|
/**
|
|
97
|
-
* Creates new Layout
|
|
97
|
+
* Creates new Layout and loads it into Grid
|
|
98
98
|
* @param layoutToCreate Layout to create
|
|
99
99
|
* @returns created Layout object or `false` if creation failed
|
|
100
100
|
*/
|
|
101
101
|
createAndSetLayout(layoutToCreate: Layout): Layout | false;
|
|
102
102
|
/**
|
|
103
|
-
* Creates new Layout
|
|
103
|
+
* Creates new Layout by cloning a given Layout
|
|
104
104
|
* @param layoutToClone Layout to clone
|
|
105
|
-
* @param layoutName name
|
|
105
|
+
* @param layoutName name of new Layout
|
|
106
106
|
* @returns created Layout object or `false` if creation failed
|
|
107
107
|
*/
|
|
108
108
|
cloneLayout(layoutToClone: Layout, layoutName: string): Layout | false;
|
|
109
109
|
/**
|
|
110
|
-
* Creates new Layout
|
|
110
|
+
* Creates new Layout by cloning a given Layout and then loads it into Grid
|
|
111
111
|
* @param layoutToClone Layout to clone
|
|
112
112
|
* @param layoutName name to use for new Layout
|
|
113
113
|
* @returns created Layout object or `false` if creation failed
|
|
@@ -148,40 +148,19 @@ export interface LayoutApi {
|
|
|
148
148
|
* @param layout Name of the Layout to delete
|
|
149
149
|
*/
|
|
150
150
|
deleteLayoutByName(layoutName: string): void;
|
|
151
|
-
/**
|
|
152
|
-
* Specifies where Current Layout is editable
|
|
153
|
-
*/
|
|
154
|
-
isCurrentLayoutReadOnly(): boolean;
|
|
155
151
|
/**
|
|
156
152
|
* Opens Change Column Caption popup
|
|
157
153
|
* @param column Column to open Popup for
|
|
158
154
|
*/
|
|
159
155
|
showChangeColumnCaption(column: AdaptableColumn): void;
|
|
160
156
|
/**
|
|
161
|
-
* Removes a Column from
|
|
157
|
+
* Removes a Column from Current Table or Pivot Layout
|
|
162
158
|
* @param columnId Column to remove
|
|
163
159
|
*/
|
|
164
160
|
removeColumnFromCurrentLayout(columnId: string): void;
|
|
165
161
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param columnId Column to remove
|
|
168
|
-
*/
|
|
169
|
-
removeColumnFromAllLayouts(columnId: string): void;
|
|
170
|
-
/**
|
|
171
|
-
* Removes a Column from a given Layout
|
|
172
|
-
* @param columnId Column to remove
|
|
173
|
-
* @param layoutName layout from which to remove Column
|
|
174
|
-
*/
|
|
175
|
-
removeColumnFromLayout(columnId: string, layoutName: string): void;
|
|
176
|
-
/**
|
|
177
|
-
* Adds a Column to a given Table Layout
|
|
178
|
-
* @param columnId Column to add
|
|
179
|
-
* @param layoutName layout to which to add Column
|
|
180
|
-
*/
|
|
181
|
-
addColumnToTableLayout(columnId: string, layoutName: string): void;
|
|
182
|
-
/**
|
|
183
|
-
* Adds a Column to Current (Table) Layout
|
|
162
|
+
* Adds a Column to Current Table or Pivot Layout
|
|
184
163
|
* @param columnId Column to add
|
|
185
164
|
*/
|
|
186
|
-
|
|
165
|
+
addColumnToCurrentLayout(columnId: string): void;
|
|
187
166
|
}
|
|
@@ -2,10 +2,6 @@ import * as Redux from 'redux';
|
|
|
2
2
|
import { AdaptableState } from '../../../types';
|
|
3
3
|
import { LayoutState, Layout } from '../../AdaptableState/LayoutState';
|
|
4
4
|
import { ColumnFilter } from '../../types';
|
|
5
|
-
/**
|
|
6
|
-
* @ReduxAction A new caption / header has been set for a Column in the Layout
|
|
7
|
-
*/
|
|
8
|
-
export declare const LAYOUT_COLUMN_SET_CAPTION = "LAYOUT_COLUMN_SET_CAPTION";
|
|
9
5
|
/**
|
|
10
6
|
* @ReduxAction Layout Module is ready
|
|
11
7
|
*/
|
|
@@ -30,14 +26,6 @@ export declare const LAYOUT_SELECT = "LAYOUT_SELECT";
|
|
|
30
26
|
* @ReduxAction A Layout has been (auto)saved
|
|
31
27
|
*/
|
|
32
28
|
export declare const LAYOUT_SAVE = "LAYOUT_SAVE";
|
|
33
|
-
/**
|
|
34
|
-
* @ReduxAction A Column has been added
|
|
35
|
-
*/
|
|
36
|
-
export declare const LAYOUT_COLUMN_ADD = "LAYOUT_COLUMN_ADD";
|
|
37
|
-
/**
|
|
38
|
-
* @ReduxAction A Column has been removed
|
|
39
|
-
*/
|
|
40
|
-
export declare const LAYOUT_COLUMN_REMOVE = "LAYOUT_COLUMN_REMOVE";
|
|
41
29
|
/**
|
|
42
30
|
* @ReduxAction A Column Filter has been added
|
|
43
31
|
*/
|
|
@@ -83,7 +71,7 @@ export declare const LAYOUT_GRID_FILTER_SUSPEND = "LAYOUT_GRID_FILTER_SUSPEND";
|
|
|
83
71
|
*/
|
|
84
72
|
export declare const LAYOUT_GRID_FILTER_UNSUSPEND = "LAYOUT_GRID_FILTER_UNSUSPEND";
|
|
85
73
|
/**
|
|
86
|
-
* @ReduxAction
|
|
74
|
+
* @ReduxAction The Grid Filter has been edited
|
|
87
75
|
*/
|
|
88
76
|
export declare const LAYOUT_GRID_FILTER_SET = "LAYOUT_GRID_FILTER_SET";
|
|
89
77
|
/**
|
|
@@ -171,8 +159,6 @@ export interface LayoutReadyAction extends Redux.Action {
|
|
|
171
159
|
export declare const LayoutAdd: (layout: Layout) => LayoutAddAction;
|
|
172
160
|
export declare const LayoutDelete: (layout: Layout) => LayoutDeleteAction;
|
|
173
161
|
export declare const LayoutSave: (layout: Layout) => LayoutSaveAction;
|
|
174
|
-
export declare const LayoutAddColumn: (layoutName: string, columnId: string) => LayoutAddColumnAction;
|
|
175
|
-
export declare const LayoutRemoveColumn: (layoutName: string, columnId: string) => LayoutRemoveColumnAction;
|
|
176
162
|
export declare const LayoutSelect: (layoutName: string) => LayoutSelectAction;
|
|
177
163
|
export declare const LayoutReady: (layoutState: LayoutState) => LayoutReadyAction;
|
|
178
164
|
export declare const getColumnFiltersSelector: (state: AdaptableState) => ColumnFilter[];
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { EMPTY_STRING } from '../../Utilities/Constants/GeneralConstants';
|
|
2
2
|
import AdaptableHelper from '../../Utilities/Helpers/AdaptableHelper';
|
|
3
3
|
import { normalizeLayout } from '../../Api/Implementation/LayoutHelpers';
|
|
4
|
-
/**
|
|
5
|
-
* @ReduxAction A new caption / header has been set for a Column in the Layout
|
|
6
|
-
*/
|
|
7
|
-
export const LAYOUT_COLUMN_SET_CAPTION = 'LAYOUT_COLUMN_SET_CAPTION';
|
|
8
4
|
/**
|
|
9
5
|
* @ReduxAction Layout Module is ready
|
|
10
6
|
*/
|
|
@@ -29,14 +25,6 @@ export const LAYOUT_SELECT = 'LAYOUT_SELECT';
|
|
|
29
25
|
* @ReduxAction A Layout has been (auto)saved
|
|
30
26
|
*/
|
|
31
27
|
export const LAYOUT_SAVE = 'LAYOUT_SAVE';
|
|
32
|
-
/**
|
|
33
|
-
* @ReduxAction A Column has been added
|
|
34
|
-
*/
|
|
35
|
-
export const LAYOUT_COLUMN_ADD = 'LAYOUT_COLUMN_ADD';
|
|
36
|
-
/**
|
|
37
|
-
* @ReduxAction A Column has been removed
|
|
38
|
-
*/
|
|
39
|
-
export const LAYOUT_COLUMN_REMOVE = 'LAYOUT_COLUMN_REMOVE';
|
|
40
28
|
/**
|
|
41
29
|
* @ReduxAction A Column Filter has been added
|
|
42
30
|
*/
|
|
@@ -82,7 +70,7 @@ export const LAYOUT_GRID_FILTER_SUSPEND = 'LAYOUT_GRID_FILTER_SUSPEND';
|
|
|
82
70
|
*/
|
|
83
71
|
export const LAYOUT_GRID_FILTER_UNSUSPEND = 'LAYOUT_GRID_FILTER_UNSUSPEND';
|
|
84
72
|
/**
|
|
85
|
-
* @ReduxAction
|
|
73
|
+
* @ReduxAction The Grid Filter has been edited
|
|
86
74
|
*/
|
|
87
75
|
export const LAYOUT_GRID_FILTER_SET = 'LAYOUT_GRID_FILTER_SET';
|
|
88
76
|
/**
|
|
@@ -148,16 +136,6 @@ export const LayoutSave = (layout) => ({
|
|
|
148
136
|
type: LAYOUT_SAVE,
|
|
149
137
|
layout: normalizeLayout(layout),
|
|
150
138
|
});
|
|
151
|
-
export const LayoutAddColumn = (layoutName, columnId) => ({
|
|
152
|
-
type: LAYOUT_COLUMN_ADD,
|
|
153
|
-
layoutName,
|
|
154
|
-
columnId,
|
|
155
|
-
});
|
|
156
|
-
export const LayoutRemoveColumn = (layoutName, columnId) => ({
|
|
157
|
-
type: LAYOUT_COLUMN_REMOVE,
|
|
158
|
-
layoutName,
|
|
159
|
-
columnId,
|
|
160
|
-
});
|
|
161
139
|
export const LayoutSelect = (layoutName) => ({
|
|
162
140
|
type: LAYOUT_SELECT,
|
|
163
141
|
layoutName,
|
|
@@ -237,36 +215,6 @@ export const LayoutReducer = (state = initialState, action) => {
|
|
|
237
215
|
Layouts: newLayouts,
|
|
238
216
|
};
|
|
239
217
|
}
|
|
240
|
-
case LAYOUT_COLUMN_ADD: {
|
|
241
|
-
const addColumnAction = action;
|
|
242
|
-
const layoutname = addColumnAction.layoutName;
|
|
243
|
-
const colToAdd = addColumnAction.columnId;
|
|
244
|
-
let layoutToUpdate = state.Layouts.find((l) => l.Name === layoutname);
|
|
245
|
-
if (layoutToUpdate) {
|
|
246
|
-
layoutToUpdate.TableColumns.push(colToAdd);
|
|
247
|
-
return {
|
|
248
|
-
...state,
|
|
249
|
-
Layouts: state.Layouts.map((abObject) => abObject.Uuid === layoutToUpdate.Uuid ? layoutToUpdate : abObject),
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
return state;
|
|
253
|
-
}
|
|
254
|
-
case LAYOUT_COLUMN_REMOVE: {
|
|
255
|
-
const removeColumnAction = action;
|
|
256
|
-
const layoutname = removeColumnAction.layoutName;
|
|
257
|
-
const colToRemove = removeColumnAction.columnId;
|
|
258
|
-
let layoutToUpdate = state.Layouts.find((l) => l.Name === layoutname);
|
|
259
|
-
if (layoutToUpdate) {
|
|
260
|
-
layoutToUpdate.TableColumns = layoutToUpdate.TableColumns.filter((col) => {
|
|
261
|
-
return col !== colToRemove;
|
|
262
|
-
});
|
|
263
|
-
return {
|
|
264
|
-
...state,
|
|
265
|
-
Layouts: state.Layouts.map((abObject) => abObject.Uuid === layoutToUpdate.Uuid ? layoutToUpdate : abObject),
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
return state;
|
|
269
|
-
}
|
|
270
218
|
case LAYOUT_COLUMN_FILTER_SET: {
|
|
271
219
|
let columnFilters = currentLayout.ColumnFilters ?? [];
|
|
272
220
|
const columnFilterAction = action.columnFilter;
|
|
@@ -125,7 +125,7 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
let returnColumnMenuItems = [];
|
|
128
|
-
const isReadOnlyLayout = this.
|
|
128
|
+
const isReadOnlyLayout = this.isCurrentLayoutReadOnly();
|
|
129
129
|
if (!isReadOnlyLayout) {
|
|
130
130
|
returnColumnMenuItems.push(this.createMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup, 'edit-table', {
|
|
131
131
|
action: 'Edit',
|
|
@@ -164,7 +164,7 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
164
164
|
}
|
|
165
165
|
createContextMenuItems(menuContext) {
|
|
166
166
|
let returnColumnMenuItems = [];
|
|
167
|
-
if (this.isModuleEditable() && !this.
|
|
167
|
+
if (this.isModuleEditable() && !this.isCurrentLayoutReadOnly()) {
|
|
168
168
|
returnColumnMenuItems.push(this.createMenuItemShowPopup('layout-edit', 'Edit Layout', this.moduleInfo.Popup, 'edit-table', {
|
|
169
169
|
action: 'Edit',
|
|
170
170
|
source: 'ColumnMenu',
|
|
@@ -450,4 +450,11 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
450
450
|
}
|
|
451
451
|
return this.api.namedQueryApi.internalApi.getReferencedNamedQueryNames(layout.GridFilter.Expression);
|
|
452
452
|
}
|
|
453
|
+
isCurrentLayoutReadOnly() {
|
|
454
|
+
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
455
|
+
if (currentLayout) {
|
|
456
|
+
return currentLayout.IsReadOnly;
|
|
457
|
+
}
|
|
458
|
+
return true;
|
|
459
|
+
}
|
|
453
460
|
}
|
|
@@ -75,7 +75,44 @@ export const FloatingFilterValues = (props) => {
|
|
|
75
75
|
columnId: props.columnId,
|
|
76
76
|
searchValueRef,
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
const valueRef = React.useRef(props.value);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
// we used to load values initially on mount, without any condition
|
|
81
|
+
const value = valueRef.current;
|
|
82
|
+
// but we now optimize it - if there are no values to show (for which we would need a label)
|
|
83
|
+
// then we skip it altogether, so we'll only load onMenuOpen
|
|
84
|
+
if (!value || !Array.isArray(value) || value.length === 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// however, if the `value` prop is a non-empty array, we need to load the values
|
|
88
|
+
// so we know which labels to show
|
|
89
|
+
triggerValuesLoad();
|
|
90
|
+
}, []);
|
|
91
|
+
const quickFilterValuesRef = React.useRef(quickFilterValues);
|
|
92
|
+
quickFilterValuesRef.current = quickFilterValues;
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
// since we did the optimization above,
|
|
95
|
+
// we now hit a scenario where the value is set via an API method
|
|
96
|
+
// so we also need to account for that - so whenever props.value changes, we need to check
|
|
97
|
+
// and if we previously didn't have a valid array
|
|
98
|
+
// and now we do, we need to load the values - if they are not already loaded
|
|
99
|
+
if (quickFilterValuesRef.current.values.length > 0 ||
|
|
100
|
+
quickFilterValuesRef.current.dataLoadIsComplete) {
|
|
101
|
+
// values have already been loaded, so we can skip
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const currentValue = props.value;
|
|
105
|
+
const prevValue = valueRef.current;
|
|
106
|
+
valueRef.current = currentValue;
|
|
107
|
+
const prevValid = Array.isArray(prevValue) && prevValue.length > 0;
|
|
108
|
+
const currentValid = Array.isArray(currentValue) && currentValue.length > 0;
|
|
109
|
+
if (!currentValid) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!prevValid && currentValid) {
|
|
113
|
+
triggerValuesLoad();
|
|
114
|
+
}
|
|
115
|
+
}, [props.value]);
|
|
79
116
|
const onMenuOpen = triggerValuesLoad;
|
|
80
117
|
const onInputChange = React.useCallback((value) => {
|
|
81
118
|
searchValueRef.current = value;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useCallback, useEffect } from 'react';
|
|
2
3
|
import { Box, Flex } from 'rebass';
|
|
4
|
+
import debounce from 'lodash/debounce';
|
|
3
5
|
import Input from '../Input';
|
|
4
6
|
import { getVariableColor } from '../../Utilities/Helpers/StyleHelper';
|
|
5
7
|
import tinycolor from 'tinycolor2';
|
|
6
8
|
export const ColorPicker = React.forwardRef((props, ref) => {
|
|
7
9
|
const ColorPalette = props.api.userInterfaceApi.getColorPalette();
|
|
8
10
|
let { api, value, includeAlpha = true, ...restProps } = props;
|
|
11
|
+
// Create a debounced version of onChange
|
|
12
|
+
// we need this because moving the mouse A LOT in the custom color picker can break the React rendering
|
|
13
|
+
const debouncedOnChange = useCallback(debounce((color) => {
|
|
14
|
+
props.onChange(color);
|
|
15
|
+
}, 30), [props.onChange]);
|
|
16
|
+
// Clean up the debounce on unmount
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
return () => {
|
|
19
|
+
debouncedOnChange.cancel();
|
|
20
|
+
};
|
|
21
|
+
}, [debouncedOnChange]);
|
|
9
22
|
const optionsMap = ColorPalette.reduce((acc, colorItem) => ({ ...acc, [getVariableColor(colorItem)]: colorItem }), {});
|
|
10
23
|
const ABcolorChoicesOptions = Object.keys(optionsMap).map((x) => {
|
|
11
24
|
return (React.createElement("option", { key: x, value: x }, x));
|
|
@@ -27,7 +40,7 @@ export const ColorPicker = React.forwardRef((props, ref) => {
|
|
|
27
40
|
* The value is not in the map when the color is not in the palette.
|
|
28
41
|
*/
|
|
29
42
|
const color = optionsMap[event.target.value] ?? event.target.value;
|
|
30
|
-
|
|
43
|
+
debouncedOnChange(color);
|
|
31
44
|
}, value: preparedValue, ref: ref, type: "color", style: {
|
|
32
45
|
width: 70,
|
|
33
46
|
padding: 0 /* we need this to be 0, since otherwise on Windows browsers, the chosen color cannot be seen */,
|
|
@@ -37,6 +50,6 @@ export const ColorPicker = React.forwardRef((props, ref) => {
|
|
|
37
50
|
React.createElement(Box, { mr: 1 }, "Opacity"),
|
|
38
51
|
React.createElement(Input, { disabled: props.disabled, className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
|
|
39
52
|
const color = tinycolor(value).setAlpha(event.target.value).toRgbString();
|
|
40
|
-
|
|
53
|
+
debouncedOnChange(color);
|
|
41
54
|
}, min: 0, max: 1, step: 0.01, type: "range" })))));
|
|
42
55
|
});
|
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: "20.2.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1752564875397 || Date.now(),
|
|
4
|
+
VERSION: "20.2.9" || '--current-version--',
|
|
5
5
|
};
|
package/src/types.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export type { SystemStatusMessageDisplayedInfo } from './Api/Events/SystemStatus
|
|
|
121
121
|
export type { CellChangedInfo } from './Api/Events/CellChanged';
|
|
122
122
|
export type { TeamSharingEntityChangedInfo } from './Api/Events/TeamSharingEntityChanged';
|
|
123
123
|
export type { RowChangedInfo } from './Api/Events/RowChanged';
|
|
124
|
-
export type { LayoutChangedInfo } from './Api/Events/LayoutChanged';
|
|
124
|
+
export type { LayoutChangedInfo, LayoutChangedAction } from './Api/Events/LayoutChanged';
|
|
125
125
|
export type { CalculatedColumnChangedInfo } from './Api/Events/CalculatedColumnChanged';
|
|
126
126
|
export type { CustomToolbarConfiguredInfo } from './Api/Events/CustomToolbarConfigured';
|
|
127
127
|
export type { LiveDataChangedInfo, LiveReport } from './Api/Events/LiveDataChanged';
|