@adaptabletools/adaptable 11.1.1 → 11.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/base.css +2 -0
  2. package/bundle.cjs.js +97 -97
  3. package/index.css +3 -0
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  8. package/src/AdaptableOptions/LayoutOptions.d.ts +11 -0
  9. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -1
  10. package/src/Api/Implementation/GridApiImpl.js +9 -10
  11. package/src/Api/Implementation/InternalApiImpl.js +1 -1
  12. package/src/Api/Implementation/LayoutApiImpl.js +7 -1
  13. package/src/Strategy/CalculatedColumnModule.js +5 -0
  14. package/src/Strategy/FreeTextColumnModule.js +1 -1
  15. package/src/Strategy/Interface/IModule.d.ts +2 -1
  16. package/src/Strategy/LayoutModule.d.ts +23 -0
  17. package/src/Strategy/LayoutModule.js +70 -0
  18. package/src/Strategy/Utilities/getFlashingCellStyleViewItems.d.ts +1 -0
  19. package/src/Strategy/Utilities/getFlashingCellStyleViewItems.js +2 -1
  20. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +3 -0
  21. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -1
  22. package/src/Utilities/Helpers/StyleHelper.d.ts +1 -0
  23. package/src/Utilities/Helpers/StyleHelper.js +13 -1
  24. package/src/View/AdaptableViewFactory.js +2 -4
  25. package/src/View/ColorPicker.d.ts +4 -2
  26. package/src/View/ColorPicker.js +16 -4
  27. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +24 -19
  28. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +3 -1
  29. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +23 -15
  30. package/src/View/Components/Popups/WindowPopups/WindowPopups.d.ts +2 -0
  31. package/src/View/Components/Popups/WindowPopups/WindowPopups.js +9 -5
  32. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +1 -0
  33. package/src/View/Components/Popups/WindowPopups/windowFactory.js +4 -1
  34. package/src/View/Components/RangesComponent.js +4 -6
  35. package/src/View/Components/StyleComponent.js +6 -9
  36. package/src/View/Components/ValueSelector/index.d.ts +1 -0
  37. package/src/View/Components/ValueSelector/index.js +1 -1
  38. package/src/View/Dashboard/CustomToolbarWrapper.js +9 -1
  39. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +2 -3
  40. package/src/View/GridInfo/AdaptableObjectsSummary.d.ts +2 -0
  41. package/src/View/GridInfo/AdaptableObjectsSummary.js +26 -0
  42. package/src/View/GridInfo/GridInfoPopup.js +11 -3
  43. package/src/View/Layout/LayoutEditorStandalonePopup.js +3 -4
  44. package/src/View/Layout/LayoutRadioSelector.d.ts +5 -0
  45. package/src/View/Layout/LayoutRadioSelector.js +18 -0
  46. package/src/View/Query/ExpandedQueryPopup.d.ts +2 -18
  47. package/src/View/Query/ExpandedQueryPopup.js +42 -57
  48. package/src/View/Query/QueryViewPanel.js +8 -5
  49. package/src/agGrid/Adaptable.d.ts +2 -1
  50. package/src/agGrid/Adaptable.js +16 -16
  51. package/src/components/ExpressionEditor/index.js +0 -1
  52. package/src/components/OverlayTrigger/index.js +1 -0
  53. package/src/components/Radio/index.d.ts +1 -1
  54. package/src/components/Radio/index.js +2 -2
  55. package/src/metamodel/adaptable.metamodel.js +7 -0
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
package/index.css CHANGED
@@ -3645,6 +3645,9 @@ html.ab--theme-dark .ab-ListBoxFilterForm--aggrid-style {
3645
3645
  max-height: 100%;
3646
3646
  box-shadow: var(--ab-cmp-adaptable-window-popup__box-shadow); }
3647
3647
 
3648
+ .ab-Window-Modal .ab-Dialog__close-button {
3649
+ top: 3px; }
3650
+
3648
3651
  .ab-Window-Modal .ab-Panel {
3649
3652
  max-height: initial; }
3650
3653
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "11.1.1",
3
+ "version": "11.1.2",
4
4
  "description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1648553646478;
1
+ declare const _default: 1648639602191;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1648553646478;
3
+ exports.default = 1648639602191;
@@ -164,7 +164,8 @@ export interface IAdaptable {
164
164
  lookupPlugins(propertyName: string, ...args: any): any;
165
165
  getPluginProperty(pluginId: string, propertyName: string, ...args: any): any;
166
166
  getPlugin(pluginId: string): AdaptablePlugin;
167
- setValue(cellDataChangedInfo: CellDataChangedInfo): void;
167
+ setDataValue(value: any, column: AdaptableColumn, primaryKeyValue: any, rowNode?: RowNode): void;
168
+ setCellValue(cellDataChangedInfo: CellDataChangedInfo): void;
168
169
  cancelEdit(): any;
169
170
  isCellEditable(rowNode: RowNode, column: Column): boolean;
170
171
  getFirstRowNode(): RowNode;
@@ -42,4 +42,15 @@ export interface LayoutOptions {
42
42
  * @gridInfoItem
43
43
  */
44
44
  createDefaultLayout?: boolean;
45
+ /**
46
+ * Options to customize how layout items are shown in Settings Panel
47
+ */
48
+ view?: {
49
+ /**
50
+ * How many columns to display in the inline layout preview
51
+ *
52
+ * @defaultValue 10
53
+ */
54
+ maxColumnsToDisplay?: number;
55
+ };
45
56
  }
@@ -244,4 +244,4 @@ export interface BulkUpdatePermittedValuesParams extends BaseParams {
244
244
  gridCells: GridCell[];
245
245
  }
246
246
  export declare type GridInfoSections = GridInfoSection[];
247
- export declare type GridInfoSection = 'GridSummary' | 'AdaptableOptions' | 'ColumnInfo';
247
+ export declare type GridInfoSection = 'GridSummary' | 'AdaptableOptions' | 'ColumnInfo' | 'AdaptableObjectsSummary';
@@ -6,6 +6,7 @@ const ApiBase_1 = require("./ApiBase");
6
6
  const GridRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/GridRedux"));
7
7
  const SystemRedux_1 = require("../../Redux/ActionsReducers/SystemRedux");
8
8
  const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
9
+ const LoggingHelper_1 = require("../../Utilities/Helpers/LoggingHelper");
9
10
  class GridApiImpl extends ApiBase_1.ApiBase {
10
11
  getGridState() {
11
12
  return this.getAdaptableState().Grid;
@@ -48,22 +49,20 @@ class GridApiImpl extends ApiBase_1.ApiBase {
48
49
  }
49
50
  setCellValue(columnId, newValue, primaryKeyValue) {
50
51
  const abColumn = this.adaptable.api.columnApi.getColumnFromId(columnId);
51
- if (!abColumn || abColumn.readOnly) {
52
+ if (!abColumn) {
53
+ LoggingHelper_1.LogAdaptableWarning(`setCellValue() - column not found for columnId: ${columnId}`);
52
54
  return;
53
55
  }
54
56
  const rowNode = this.getRowNodeForPrimaryKey(primaryKeyValue);
57
+ if (!rowNode) {
58
+ LoggingHelper_1.LogAdaptableWarning(`setCellValue() - rowNode not found for primaryKeyValue: ${primaryKeyValue}`);
59
+ return;
60
+ }
55
61
  if (!this.adaptable.isCellEditable(rowNode, this.adaptable.getAgGridColumnForColumnId(columnId))) {
62
+ LoggingHelper_1.LogAdaptableInfo(`setCellValue() - cell is not editable (primaryKeyValue: ${primaryKeyValue},columnId: ${columnId},value: ${newValue})`);
56
63
  return;
57
64
  }
58
- const gridCell = {
59
- primaryKeyValue: primaryKeyValue,
60
- rawValue: newValue,
61
- displayValue: newValue,
62
- normalisedValue: newValue,
63
- rowNode: rowNode,
64
- column: abColumn,
65
- };
66
- this.adaptable.api.internalApi.setGridCell(gridCell);
65
+ this.adaptable.setDataValue(newValue, abColumn, primaryKeyValue, rowNode);
67
66
  }
68
67
  setCellsValue(gridCells) {
69
68
  gridCells === null || gridCells === void 0 ? void 0 : gridCells.forEach((gridCell) => this.setCellValue(gridCell.columnId, gridCell.newValue, gridCell.primaryKeyValue));
@@ -198,7 +198,7 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
198
198
  }
199
199
  setGridCell(gridCell) {
200
200
  const cellDataChangedInfo = this.createDataChangedInfoFromGridCell(gridCell);
201
- this.adaptable.setValue(cellDataChangedInfo);
201
+ this.adaptable.setCellValue(cellDataChangedInfo);
202
202
  }
203
203
  buildDataChangedInfo(config) {
204
204
  var _a;
@@ -252,14 +252,20 @@ class LayoutApiImpl extends ApiBase_1.ApiBase {
252
252
  }
253
253
  showLayoutEditor(layoutName, action = 'Edit') {
254
254
  const layout = layoutName ? this.getLayoutByName(layoutName) : this.getCurrentLayout();
255
+ const moduleInfo = this.adaptable.ModuleService.getModuleInfoByModule(ModuleConstants.LayoutModuleId);
255
256
  let preparedAction = action;
256
257
  if (!['Edit', 'New', 'Clone'].includes(action)) {
257
258
  preparedAction = 'Edit';
258
259
  LoggingHelper_1.LogAdaptableError(`When opening the layout editor the action must be one of: New, Clone, Edit; given: ${action}`);
259
260
  }
261
+ let title = 'Layout Editor';
262
+ if (action === 'Edit') {
263
+ title = `Edit Layout${(layout === null || layout === void 0 ? void 0 : layout.Name) ? `: ${layout.Name}` : ''}`;
264
+ }
260
265
  this.dispatchAction(PopupRedux.PopupShowWindow({
261
266
  Id: windowFactory_1.WINDOW_LAYOUT_EDITOR,
262
- Title: `Edit Layout: ${layout.Name}`,
267
+ Title: title,
268
+ Icon: moduleInfo.Glyph,
263
269
  PopupProps: {
264
270
  action: preparedAction,
265
271
  layout,
@@ -71,6 +71,11 @@ class CalculatedColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
71
71
  label: 'Column Id',
72
72
  values: [calculateColumn.ColumnId],
73
73
  },
74
+ calculateColumn.FriendlyName && {
75
+ name: 'Settings',
76
+ label: 'Column Name',
77
+ values: [calculateColumn.FriendlyName],
78
+ },
74
79
  getExpressionViewItems_1.getExpressionViewItems(calculateColumn.Query),
75
80
  ];
76
81
  if (ArrayExtensions_1.default.IsNotNullOrEmpty(settingsTags)) {
@@ -75,7 +75,7 @@ class FreeTextColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
75
75
  label: 'Data Type',
76
76
  values: [(_a = freeTextColumn.DataType) !== null && _a !== void 0 ? _a : 'Not specified'],
77
77
  },
78
- freeTextColumn.DefaultValue !== undefined && {
78
+ Boolean(freeTextColumn.DefaultValue) && {
79
79
  name: 'Settings',
80
80
  label: 'Default Value',
81
81
  values: [freeTextColumn.DefaultValue],
@@ -74,11 +74,12 @@ export interface AdaptableObjectView {
74
74
  export interface AdaptableModuleView {
75
75
  /**
76
76
  * List of actions.
77
- * Allows to add custmo actions.
77
+ * Allows to add custom actions.
78
78
  */
79
79
  actions?: React.FunctionComponent<{
80
80
  data: AdaptableObject;
81
81
  }>[];
82
+ onOpenEditPopup?: (abObject?: AdaptableObject) => void;
82
83
  getDeleteAction?: (abObject: AdaptableObject) => Redux.Action;
83
84
  getSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
84
85
  getUnSuspendAction?: (abObject: AdaptableObject) => Redux.Action;
@@ -1,6 +1,8 @@
1
+ /// <reference types="react" />
1
2
  import { AdaptableModuleBase } from './AdaptableModuleBase';
2
3
  import { LayoutState, Layout } from '../PredefinedConfig/LayoutState';
3
4
  import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Common/Menu';
5
+ import * as LayoutRedux from '../Redux/ActionsReducers/LayoutRedux';
4
6
  import { TeamSharingImportInfo } from '../PredefinedConfig/TeamSharingState';
5
7
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
6
8
  import { AdaptableApi } from '../Api/AdaptableApi';
@@ -16,4 +18,25 @@ export declare class LayoutModule extends AdaptableModuleBase implements IModule
16
18
  addColumnMenuItems(column: AdaptableColumn): AdaptableMenuItem[] | undefined;
17
19
  addContextMenuItems(menuContext: ContextMenuContext): AdaptableMenuItem[] | undefined;
18
20
  getTeamSharingAction(): TeamSharingImportInfo<Layout>;
21
+ toViewAll(): {
22
+ items: {
23
+ name: string;
24
+ values: string[];
25
+ }[];
26
+ abObject: Layout;
27
+ }[];
28
+ toView(layout: Layout): {
29
+ items: {
30
+ name: string;
31
+ values: string[];
32
+ }[];
33
+ abObject: Layout;
34
+ };
35
+ getViewProperties(): {
36
+ actions: import("react").FunctionComponent<{
37
+ data: Layout;
38
+ }>[];
39
+ getDeleteAction: (layout: Layout) => LayoutRedux.LayoutDeleteAction;
40
+ onOpenEditPopup: (layout?: Layout) => void;
41
+ };
19
42
  }
@@ -6,6 +6,7 @@ const AdaptableModuleBase_1 = require("./AdaptableModuleBase");
6
6
  const ModuleConstants = tslib_1.__importStar(require("../Utilities/Constants/ModuleConstants"));
7
7
  const LayoutRedux = tslib_1.__importStar(require("../Redux/ActionsReducers/LayoutRedux"));
8
8
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/ArrayExtensions"));
9
+ const LayoutRadioSelector_1 = require("../View/Layout/LayoutRadioSelector");
9
10
  class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
10
11
  constructor(api) {
11
12
  super(ModuleConstants.LayoutModuleId, 'Layout', 'layout', 'LayoutPopup', 'Named sets of column visibility, order, groupings, aggregation, pivots etc.', api);
@@ -128,5 +129,74 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
128
129
  EditAction: LayoutRedux.LayoutSave,
129
130
  };
130
131
  }
132
+ toViewAll() {
133
+ return this.getModuleAdaptableObjects().map((layout) => this.toView(layout));
134
+ }
135
+ toView(layout) {
136
+ var _a, _b, _c, _d, _e, _f, _g;
137
+ const maxColumnsToDisplay = (_d = (_c = (_b = (_a = this.api.internalApi.getAdaptableOptions()) === null || _a === void 0 ? void 0 : _a.layoutOptions) === null || _b === void 0 ? void 0 : _b.view) === null || _c === void 0 ? void 0 : _c.maxColumnsToDisplay) !== null && _d !== void 0 ? _d : 10;
138
+ const columnIdToFriendlyName = (columnId) => {
139
+ return this.api.columnApi.getFriendlyNameFromColumnId(columnId);
140
+ };
141
+ let columns = layout.Columns;
142
+ if (columns.length >
143
+ maxColumnsToDisplay + 1 /* +1 is to show tag only beginning with 2, 'other 2' */) {
144
+ const extraColumns = columns.length - maxColumnsToDisplay;
145
+ const firstNColumns = columns
146
+ .slice(0, maxColumnsToDisplay)
147
+ .map((colId) => columnIdToFriendlyName(colId));
148
+ columns = [...firstNColumns, `and other ${extraColumns}`];
149
+ }
150
+ return {
151
+ items: [
152
+ {
153
+ name: 'Name',
154
+ values: [layout.Name],
155
+ },
156
+ {
157
+ name: 'Columns',
158
+ values: columns,
159
+ },
160
+ ((_e = layout.ColumnSorts) === null || _e === void 0 ? void 0 : _e.length) && {
161
+ name: 'Sort',
162
+ values: layout.ColumnSorts.map((customSort) => `[${columnIdToFriendlyName(customSort.ColumnId)}: ${customSort.SortOrder}]`),
163
+ },
164
+ ((_f = layout === null || layout === void 0 ? void 0 : layout.RowGroupedColumns) === null || _f === void 0 ? void 0 : _f.length) && {
165
+ name: 'Grouped Columns',
166
+ values: layout.RowGroupedColumns.map((colId) => columnIdToFriendlyName(colId)),
167
+ },
168
+ ((_g = layout === null || layout === void 0 ? void 0 : layout.PivotColumns) === null || _g === void 0 ? void 0 : _g.length) && {
169
+ name: 'Pivot Columns',
170
+ values: layout.PivotColumns.map((colId) => columnIdToFriendlyName(colId)),
171
+ },
172
+ (layout === null || layout === void 0 ? void 0 : layout.EnablePivot) && {
173
+ name: 'Pivot Enabled',
174
+ values: ['Yes'],
175
+ },
176
+ ].filter(Boolean),
177
+ abObject: layout,
178
+ };
179
+ }
180
+ getViewProperties() {
181
+ return {
182
+ actions: [LayoutRadioSelector_1.LayoutRadioSelector],
183
+ getDeleteAction: (layout) => {
184
+ // make sure we do not delete the last layout
185
+ if (this.getModuleAdaptableObjects().length === 1) {
186
+ return null;
187
+ }
188
+ return LayoutRedux.LayoutDelete(layout);
189
+ },
190
+ onOpenEditPopup: (layout) => {
191
+ if (!layout) {
192
+ // consider it is new
193
+ this.api.layoutApi.showLayoutEditor(null, 'New');
194
+ }
195
+ else {
196
+ this.api.layoutApi.showLayoutEditor(layout.Name);
197
+ }
198
+ },
199
+ };
200
+ }
131
201
  }
132
202
  exports.LayoutModule = LayoutModule;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const getFlashingCellStyleViewItems: () => {
3
3
  name: string;
4
+ label: string;
4
5
  view: import("react").FunctionComponent<import("../../View/FlashingCell/FlashingCellStyle").FlashingCellStyleProps>;
5
6
  };
@@ -4,7 +4,8 @@ exports.getFlashingCellStyleViewItems = void 0;
4
4
  const FlashingCellStyle_1 = require("../../View/FlashingCell/FlashingCellStyle");
5
5
  exports.getFlashingCellStyleViewItems = () => {
6
6
  return {
7
- name: 'Change Style',
7
+ name: 'Flash Styles',
8
+ label: 'Change Style',
8
9
  view: FlashingCellStyle_1.FlashingCellStyle,
9
10
  };
10
11
  };
@@ -131,6 +131,9 @@ exports.DefaultAdaptableOptions = {
131
131
  autoSizeColumnsInLayout: false,
132
132
  autoSizeColumnsInPivotLayout: false,
133
133
  createDefaultLayout: false,
134
+ view: {
135
+ maxColumnsToDisplay: 10,
136
+ },
134
137
  },
135
138
  menuOptions: {
136
139
  showAdaptableContextMenu: true,
@@ -10,6 +10,7 @@ exports.STANDALONE_MODULE_POPUPS = [
10
10
  * This constants determines the order and the items that appear in the navigation.
11
11
  */
12
12
  exports.DEFAULT_NAVIGATION_ITEMS = [
13
+ 'GridInfo',
13
14
  'Dashboard',
14
15
  'ToolPanel',
15
16
  'StateManagement',
@@ -31,7 +32,6 @@ exports.DEFAULT_NAVIGATION_ITEMS = [
31
32
  'Schedule',
32
33
  'Shortcut',
33
34
  '-',
34
- 'GridInfo',
35
35
  'SystemStatus',
36
36
  'DataChangeHistory',
37
37
  'TeamSharing',
@@ -7,3 +7,4 @@ export declare const toStyle: (style?: AdaptableStyle) => {
7
7
  borderWidth: number;
8
8
  borderStyle: string;
9
9
  };
10
+ export declare const getVariableColor: (variable: string) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toStyle = exports.convertCSSAbsoluteFontSizeToPt = exports.convertAdaptableStyleToCSS = void 0;
3
+ exports.getVariableColor = exports.toStyle = exports.convertCSSAbsoluteFontSizeToPt = exports.convertAdaptableStyleToCSS = void 0;
4
4
  const EnumExtensions_1 = require("../Extensions/EnumExtensions");
5
5
  exports.convertAdaptableStyleToCSS = (style) => {
6
6
  let result = {};
@@ -45,3 +45,15 @@ exports.convertCSSAbsoluteFontSizeToPt = (fontSize) => {
45
45
  exports.toStyle = (style) => {
46
46
  return Object.assign(Object.assign({}, exports.convertAdaptableStyleToCSS(style !== null && style !== void 0 ? style : {})), { borderWidth: (style === null || style === void 0 ? void 0 : style.BorderColor) ? 2 : 0, borderStyle: 'solid' });
47
47
  };
48
+ exports.getVariableColor = (variable) => {
49
+ var _a;
50
+ const isVariable = (_a = variable === null || variable === void 0 ? void 0 : variable.startsWith) === null || _a === void 0 ? void 0 : _a.call(variable, 'var(');
51
+ if (!isVariable) {
52
+ return variable;
53
+ }
54
+ const match = /\((.+)\)/.exec(variable);
55
+ if (!match) {
56
+ return variable;
57
+ }
58
+ return getComputedStyle(document.documentElement).getPropertyValue(match[1]).trim();
59
+ };
@@ -4,10 +4,8 @@ exports.AdaptableViewPanelFactory = exports.AdaptableViewFactory = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const SmartEditPopup_1 = require("./SmartEdit/SmartEditPopup");
6
6
  const QuickSearchPopup_1 = require("./QuickSearch/QuickSearchPopup");
7
- const ExpandedQueryPopup_1 = require("./Query/ExpandedQueryPopup");
8
7
  const ThemePopup_1 = require("./Theme/ThemePopup");
9
8
  const ToolPanelPopup_1 = require("./Components/ToolPanel/ToolPanelPopup");
10
- const LayoutPopup_1 = require("./Layout/LayoutPopup");
11
9
  const GridInfoPopup_1 = require("./GridInfo/GridInfoPopup");
12
10
  const TeamSharingPopup_1 = require("./TeamSharing/TeamSharingPopup");
13
11
  const DashboardPopup_1 = require("./Dashboard/DashboardPopup");
@@ -33,12 +31,12 @@ const DataChangeHistoryPopup_1 = require("./DataChangeHistory/DataChangeHistoryP
33
31
  const DataChangeHistoryViewPanel_1 = require("./DataChangeHistory/DataChangeHistoryViewPanel");
34
32
  const StateManagementViewPanel_1 = require("./StateManagement/StateManagementViewPanel");
35
33
  exports.AdaptableViewFactory = {
36
- ExpandedQueryPopup: ExpandedQueryPopup_1.ExpandedQueryPopup,
34
+ // ExpandedQueryPopup,
37
35
  BulkUpdatePopup: BulkUpdatePopup_1.BulkUpdatePopup,
38
36
  DashboardPopup: DashboardPopup_1.DashboardPopup,
39
37
  StateManagementPopup: StateManagementPopup_1.StateManagementPopup,
40
38
  GridInfoPopup: GridInfoPopup_1.GridInfoPopup,
41
- LayoutPopup: LayoutPopup_1.LayoutPopup,
39
+ // LayoutPopup,
42
40
  QuickSearchPopup: QuickSearchPopup_1.QuickSearchPopup,
43
41
  CellSummaryPopup: CellSummaryPopup_1.CellSummaryPopup,
44
42
  SmartEditPopup: SmartEditPopup_1.SmartEditPopup,
@@ -2,7 +2,9 @@ import * as React from 'react';
2
2
  import { HTMLProps } from 'react';
3
3
  import { BoxProps } from 'rebass';
4
4
  import { AdaptableApi } from '../Api/AdaptableApi';
5
- export declare type ColorPickerProps = HTMLProps<HTMLInputElement> & {
5
+ export declare type ColorPickerProps = Omit<HTMLProps<HTMLInputElement>, 'onChange'> & {
6
6
  api: AdaptableApi;
7
- } & BoxProps;
7
+ onChange: (color: string) => void;
8
+ value: string;
9
+ } & Omit<BoxProps, 'onChange'>;
8
10
  export declare const ColorPicker: React.ForwardRefExoticComponent<Pick<ColorPickerProps, "max" | "required" | "default" | "high" | "low" | "disabled" | "start" | "open" | "media" | "hidden" | "cite" | "data" | "dir" | "form" | "label" | "p" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "async" | "defer" | "manifest" | "m" | "color" | "content" | "size" | "flex" | "wrap" | "padding" | "multiple" | "alignSelf" | "backgroundColor" | "fontSize" | "height" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "opacity" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "translate" | "width" | "margin" | "children" | "key" | "list" | "step" | "contextMenu" | "api" | "type" | "min" | "rows" | "download" | "value" | "checked" | "onClick" | "name" | "colSpan" | "rowSpan" | "className" | "id" | "lang" | "method" | "target" | "role" | "tabIndex" | "crossOrigin" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "classID" | "useMap" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "as" | "hrefLang" | "integrity" | "rel" | "sizes" | "charSet" | "kind" | "src" | "srcLang" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dateTime" | "acceptCharset" | "action" | "autoComplete" | "encType" | "noValidate" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "srcSet" | "accept" | "capture" | "maxLength" | "minLength" | "readOnly" | "htmlFor" | "httpEquiv" | "optimum" | "reversed" | "selected" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "headers" | "scope" | "cols" | "poster" | "challenge" | "keyType" | "keyParams" | "mt" | "mb" | "ml" | "mr" | "my" | "marginY" | "mx" | "marginX" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "css" | "bg"> & React.RefAttributes<unknown>>;
@@ -4,17 +4,29 @@ exports.ColorPicker = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const Input_1 = tslib_1.__importDefault(require("../components/Input"));
7
+ const StyleHelper_1 = require("../Utilities/Helpers/StyleHelper");
7
8
  const tinycolor = require('tinycolor2');
8
9
  exports.ColorPicker = React.forwardRef((props, ref) => {
9
10
  const ColorPalette = props.api.userInterfaceApi.getColorPalette();
10
11
  let { api, value } = props, restProps = tslib_1.__rest(props, ["api", "value"]);
11
- const ABcolorChoicesOptions = ColorPalette.map((x) => (React.createElement("option", { key: x, value: x }, x)));
12
+ const optionsMap = ColorPalette.reduce((acc, colorItem) => (Object.assign(Object.assign({}, acc), { [StyleHelper_1.getVariableColor(colorItem)]: colorItem })), {});
13
+ const ABcolorChoicesOptions = Object.keys(optionsMap).map((x) => {
14
+ return (React.createElement("option", { key: x, value: x }, x));
15
+ });
12
16
  const ABcolorChoices = React.createElement("datalist", { id: 'ABcolorChoices' }, ABcolorChoicesOptions);
13
- value = React.useMemo(() => {
14
- return tinycolor(value).toHexString();
17
+ const preparedValue = React.useMemo(() => {
18
+ const color = StyleHelper_1.getVariableColor(value);
19
+ return tinycolor(color).toHexString();
15
20
  }, [value]);
16
21
  return (React.createElement("div", { className: 'ColorPicker' },
17
- React.createElement(Input_1.default, Object.assign({}, restProps, { value: value, ref: ref, type: "color", style: {
22
+ React.createElement(Input_1.default, Object.assign({}, restProps, { onChange: (event) => {
23
+ var _a;
24
+ /**
25
+ * The value is not in the map when the color is not in the palette.
26
+ */
27
+ const color = (_a = optionsMap[event.target.value]) !== null && _a !== void 0 ? _a : event.target.value;
28
+ props.onChange(color);
29
+ }, value: preparedValue, ref: ref, type: "color", style: {
18
30
  width: 70,
19
31
  padding: 0 /* we need this to be 0, since otherwise on Windows browsers, the chosen color cannot be seen */,
20
32
  }, list: "ABcolorChoices" })),
@@ -15,15 +15,16 @@ const ButtonEdit_1 = require("../Buttons/ButtonEdit");
15
15
  const ButtonShare_1 = require("../Buttons/ButtonShare");
16
16
  const SuspendToggleButton_1 = require("../Buttons/SuspendToggleButton/SuspendToggleButton");
17
17
  const ValueSelector_1 = require("../ValueSelector");
18
+ const ICON_SIZE = 26;
18
19
  exports.AdaptableObjectListItem = (props) => {
19
- var _a, _b, _c, _d, _e, _f;
20
+ var _a, _b, _c, _d, _e, _f, _g;
20
21
  const adaptable = AdaptableContext_1.useAdaptable();
21
22
  const dispatch = react_redux_1.useDispatch();
22
23
  const [isEditWizardVisible, setIsEditWizardVisible] = React.useState(false);
23
24
  const [wizardStepName, setWizardStepName] = React.useState(null);
24
- const viewOptions = (_a = props.module) === null || _a === void 0 ? void 0 : _a.getViewProperties();
25
- const EditWizard = (_b = viewOptions.getEditWizard) === null || _b === void 0 ? void 0 : _b.call(viewOptions, props.data.abObject);
26
- const deleteAction = (_c = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.getDeleteAction) === null || _c === void 0 ? void 0 : _c.call(viewOptions, props.data.abObject);
25
+ const viewOptions = (_b = (_a = props.module) === null || _a === void 0 ? void 0 : _a.getViewProperties) === null || _b === void 0 ? void 0 : _b.call(_a);
26
+ const EditWizard = (_c = viewOptions.getEditWizard) === null || _c === void 0 ? void 0 : _c.call(viewOptions, props.data.abObject);
27
+ const deleteAction = (_d = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.getDeleteAction) === null || _d === void 0 ? void 0 : _d.call(viewOptions, props.data.abObject);
27
28
  const teamSharingActivated = adaptable.api.teamSharingApi.isTeamSharingActivated() &&
28
29
  adaptable.api.teamSharingApi.hasTeamSharingFullRights();
29
30
  const entityType = props.module.moduleInfo.FriendlyName;
@@ -33,46 +34,50 @@ exports.AdaptableObjectListItem = (props) => {
33
34
  const accessLevel = AdaptableHelper_1.default.getAppropriateAccessLevel(props.data.abObject, moduleAccessLevel);
34
35
  const baseClassName = `${props.baseClassName}__Item`;
35
36
  const itemClassName = join_1.default(baseClassName, props.data.abObject.IsSuspended && `${baseClassName}--is-suspended`);
36
- const handleCloseWizard = () => {
37
+ const handleCloseWizard = React.useCallback(() => {
37
38
  setIsEditWizardVisible(false);
38
39
  setWizardStepName(null);
39
- };
40
- const handleOpenWizard = (sectionName) => {
41
- setIsEditWizardVisible(true);
42
- if (sectionName) {
43
- setWizardStepName(sectionName);
40
+ }, []);
41
+ const handleOnEdit = React.useCallback((sectionName) => {
42
+ var _a;
43
+ if (EditWizard) {
44
+ setIsEditWizardVisible(true);
45
+ if (sectionName) {
46
+ setWizardStepName(sectionName);
47
+ }
44
48
  }
45
- };
49
+ (_a = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.onOpenEditPopup) === null || _a === void 0 ? void 0 : _a.call(viewOptions, props.data.abObject);
50
+ }, []);
46
51
  const hasSuspend = Boolean(viewOptions.getSuspendAction);
47
- const actions = (_e = (_d = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.actions) === null || _d === void 0 ? void 0 : _d.map) === null || _e === void 0 ? void 0 : _e.call(_d, (component, index) => {
52
+ const actions = (_f = (_e = viewOptions === null || viewOptions === void 0 ? void 0 : viewOptions.actions) === null || _e === void 0 ? void 0 : _e.map) === null || _f === void 0 ? void 0 : _f.call(_e, (component, index) => {
48
53
  return React.createElement(component, {
49
54
  data: props.data.abObject,
50
55
  key: index,
51
56
  });
52
57
  });
53
- const iconSize = 26;
58
+ const isEditDisabled = !Boolean(EditWizard || viewOptions.onOpenEditPopup);
54
59
  return (React.createElement(rebass_1.Flex, { as: "li", mb: 3, className: itemClassName },
55
- React.createElement(rebass_1.Box, { flex: 1, className: `${baseClassName}__rows` }, (_f = props.data.items) === null || _f === void 0 ? void 0 : _f.map((tag, index) => {
60
+ React.createElement(rebass_1.Box, { flex: 1, className: `${baseClassName}__rows` }, (_g = props.data.items) === null || _g === void 0 ? void 0 : _g.map((tag, index) => {
56
61
  var _a;
57
62
  return (React.createElement(rebass_1.Flex, { "data-name": tag.name, key: index, mb: 2, className: `${baseClassName}__row` },
58
63
  React.createElement(rebass_1.Box, { className: `${baseClassName}__label`, mr: 3 },
59
64
  tag.label || tag.name,
60
65
  EditWizard && (React.createElement(SimpleButton_1.default, { accessLevel: accessLevel, className: `${baseClassName}__edit-property`, ml: 1, icon: "edit", tooltip: "edit", iconSize: 18, variant: "text", onClick: () => {
61
- handleOpenWizard(tag.name);
66
+ handleOnEdit(tag.name);
62
67
  } }))),
63
68
  React.createElement(rebass_1.Box, { flex: 1, className: `${baseClassName}__values` },
64
69
  tag.view &&
65
70
  React.createElement(tag.view, {
66
71
  data: props.data.abObject,
67
72
  }),
68
- Boolean((tag === null || tag === void 0 ? void 0 : tag.values) && ((_a = tag === null || tag === void 0 ? void 0 : tag.values) === null || _a === void 0 ? void 0 : _a.length)) && (React.createElement(ValueSelector_1.ValueOptionsTags, { readOnly: true, options: tag.values, value: tag.values, allowWrap: true, toIdentifier: (c) => c, toLabel: (c) => React.createElement(React.Fragment, null, c) })))));
73
+ Boolean((tag === null || tag === void 0 ? void 0 : tag.values) && ((_a = tag === null || tag === void 0 ? void 0 : tag.values) === null || _a === void 0 ? void 0 : _a.length)) && (React.createElement(ValueSelector_1.ValueOptionsTags, { style: { marginRight: 0 }, readOnly: true, options: tag.values, value: tag.values, allowWrap: true, toIdentifier: (c) => c, toLabel: (c) => React.createElement(React.Fragment, null, c) })))));
69
74
  })),
70
75
  React.createElement(rebass_1.Flex, { flexDirection: "column", className: `${baseClassName}__buttons` },
71
76
  React.createElement(rebass_1.Flex, { justifyContent: "end" },
72
77
  actions,
73
- teamSharingActivated && (React.createElement(ButtonShare_1.ButtonShare, { iconSize: iconSize, Header: `TeamSharing ${entityType}`, accessLevel: accessLevel, onShare: (config) => dispatch(TeamSharingRedux_1.TeamSharingShare(props.data.abObject, props.module.moduleInfo.ModuleName, config)) })),
74
- deleteAction && (React.createElement(ButtonDelete_1.ButtonDelete, { iconSize: iconSize, ConfirmationMsg: `Are you sure you want to delete this ${entityType}?`, ConfirmationTitle: `Delete ${entityType}`, ConfirmAction: deleteAction, accessLevel: accessLevel })),
75
- React.createElement(ButtonEdit_1.ButtonEdit, { iconSize: iconSize, disabled: !Boolean(EditWizard), accessLevel: accessLevel, onClick: () => handleOpenWizard() })),
78
+ teamSharingActivated && (React.createElement(ButtonShare_1.ButtonShare, { iconSize: ICON_SIZE, Header: `TeamSharing ${entityType}`, accessLevel: accessLevel, onShare: (config) => dispatch(TeamSharingRedux_1.TeamSharingShare(props.data.abObject, props.module.moduleInfo.ModuleName, config)) })),
79
+ deleteAction && (React.createElement(ButtonDelete_1.ButtonDelete, { iconSize: ICON_SIZE, ConfirmationMsg: `Are you sure you want to delete this ${entityType}?`, ConfirmationTitle: `Delete ${entityType}`, ConfirmAction: deleteAction, accessLevel: accessLevel })),
80
+ React.createElement(ButtonEdit_1.ButtonEdit, { iconSize: ICON_SIZE, disabled: isEditDisabled, accessLevel: accessLevel, onClick: () => handleOnEdit() })),
76
81
  React.createElement(rebass_1.Box, { flex: 1 }),
77
82
  hasSuspend && (React.createElement(rebass_1.Flex, { justifyContent: "end" },
78
83
  React.createElement(SuspendToggleButton_1.SuspendToggleButton, { onSuspend: () => dispatch(viewOptions.getSuspendAction(props.data.abObject)), onUnSuspend: () => dispatch(viewOptions.getUnSuspendAction(props.data.abObject)), suspendableObject: props.data.abObject, accessLevel: accessLevel })))),
@@ -31,5 +31,7 @@ exports.AdaptablePopupBody = (props) => {
31
31
  moduleInfo,
32
32
  };
33
33
  const BodyComponent = (AdaptableViewFactory_1.AdaptableViewFactory === null || AdaptableViewFactory_1.AdaptableViewFactory === void 0 ? void 0 : AdaptableViewFactory_1.AdaptableViewFactory[(_a = props === null || props === void 0 ? void 0 : props.componentName) !== null && _a !== void 0 ? _a : moduleInfo.Popup]) || AdaptablePopupModuleView_1.AdaptablePopupModuleView;
34
- return React.createElement(BodyComponent, Object.assign({ module: props.module }, moduleProps));
34
+ // key is to make sure state is reset between views
35
+ // most of the views use the `AdaptablePopupModuleView` component
36
+ return React.createElement(BodyComponent, Object.assign({ key: props === null || props === void 0 ? void 0 : props.componentName, module: props.module }, moduleProps));
35
37
  };