@adaptabletools/adaptable 13.0.1 → 13.0.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 (43) hide show
  1. package/bundle.cjs.js +149 -143
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
  6. package/src/AdaptableOptions/ActionOptions.d.ts +15 -1
  7. package/src/AdaptableOptions/AdaptableOptions.d.ts +1 -0
  8. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +1 -0
  9. package/src/AdaptableOptions/FilterOptions.d.ts +6 -0
  10. package/src/AdaptableOptions/GeneralOptions.d.ts +2 -0
  11. package/src/AdaptableOptions/LayoutOptions.d.ts +1 -0
  12. package/src/AdaptableOptions/NotificationsOptions.d.ts +2 -1
  13. package/src/Api/EventApi.d.ts +13 -22
  14. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +1 -0
  15. package/src/Api/Implementation/StyledColumnApiImpl.js +17 -0
  16. package/src/Api/StyledColumnApi.d.ts +5 -0
  17. package/src/Strategy/FilterModule.js +1 -1
  18. package/src/Strategy/LayoutModule.js +7 -1
  19. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -0
  20. package/src/Utilities/Extensions/StringExtensions.d.ts +2 -0
  21. package/src/Utilities/Extensions/StringExtensions.js +21 -1
  22. package/src/Utilities/Services/CalculatedColumnExpressionService.js +1 -1
  23. package/src/Utilities/Services/Interface/IMetamodelService.d.ts +1 -0
  24. package/src/Utilities/Services/MetamodelService.js +6 -4
  25. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableOptionsForm.d.ts +3 -5
  26. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableOptionsForm.js +103 -92
  27. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.d.ts +2 -1
  28. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +2 -2
  29. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +4 -3
  30. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.js +8 -3
  31. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +7 -34
  32. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/FinanceForm/FinanceForm.js +7 -7
  33. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +2 -1
  34. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js +2 -1
  35. package/src/View/Components/FilterForm/QuickFilterForm.js +2 -2
  36. package/src/agGrid/ActionColumnRenderer.js +2 -0
  37. package/src/agGrid/Adaptable.d.ts +2 -0
  38. package/src/agGrid/Adaptable.js +76 -52
  39. package/src/metamodel/adaptable.metamodel.d.ts +87 -0
  40. package/src/metamodel/adaptable.metamodel.js +1 -1
  41. package/src/types.d.ts +2 -1
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "13.0.1",
3
+ "version": "13.0.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: 1665135058872;
1
+ declare const _default: 1665667712374;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1665135058872;
3
+ exports.default = 1665667712374;
@@ -129,6 +129,7 @@ export interface IAdaptable {
129
129
  redrawRow(rowNode: RowNode): void;
130
130
  redrawRows(rowNodes: RowNode[]): void;
131
131
  refreshCells(rowNodes: RowNode[], columns: (string | any)[], forceUpdate: boolean, suppressFlash?: boolean): void;
132
+ refreshColumns(columns: (string | Column)[], forceUpdate: boolean, suppressFlash?: boolean): void;
132
133
  setSelectedCells(): SelectedCellInfo | undefined;
133
134
  setSelectedRows(): SelectedRowInfo | undefined;
134
135
  jumpToRow(rowNode: RowNode): void;
@@ -13,7 +13,13 @@ export interface ActionOptions {
13
13
  *
14
14
  * @defaultValue undefined
15
15
  */
16
- actionRowButtons?: ('clone' | 'create' | 'edit' | 'delete')[];
16
+ actionRowButtons?: ActionRowButtonType[];
17
+ /**
18
+ * Optional custom configuration that, when specified, merges with the built-in action row button and overrides the default configuration
19
+ *
20
+ * @defaultValue undefined
21
+ */
22
+ actionRowButtonCustomConfiguration?: (context: ActionRowButtonCustomConfigurationContext) => Partial<AdaptableButton<ActionColumnContext>>;
17
23
  /**
18
24
  * Position of supplied Action Buttons
19
25
  *
@@ -84,6 +90,10 @@ export interface ActionColumnContext extends BaseContext {
84
90
  * Current AG Grid Row Node
85
91
  */
86
92
  rowNode: RowNode;
93
+ /**
94
+ * The row's data
95
+ */
96
+ data: any;
87
97
  }
88
98
  /**
89
99
  * Set of optional properties that define an Action Columns behaviour
@@ -179,3 +189,7 @@ export interface FormFieldLabelContext extends BaseContext {
179
189
  column: AdaptableColumn;
180
190
  rowNode?: RowNode;
181
191
  }
192
+ export declare type ActionRowButtonType = 'create' | 'clone' | 'edit' | 'delete';
193
+ export interface ActionRowButtonCustomConfigurationContext extends BaseContext {
194
+ actionRowButtonType: ActionRowButtonType;
195
+ }
@@ -32,6 +32,7 @@ export interface AdaptableOptions {
32
32
  *
33
33
  * @defaultValue 'adaptable_id'
34
34
  * @gridInfoItem
35
+ * @noCodeItem
35
36
  */
36
37
  adaptableId?: string;
37
38
  /**
@@ -17,6 +17,7 @@ export interface AdaptableQLOptions {
17
17
  *
18
18
  * @defaultValue false
19
19
  * @gridInfoItem
20
+ * @noCodeItem
20
21
  */
21
22
  caseSensitiveTextComparisons?: boolean;
22
23
  /**
@@ -23,6 +23,7 @@ export interface FilterOptions {
23
23
  *
24
24
  * @defaultValue 2,000
25
25
  * @gridInfoItem
26
+ * @noCodeItem
26
27
  */
27
28
  maxFilterValuesToDisplay?: number;
28
29
  /**
@@ -30,12 +31,14 @@ export interface FilterOptions {
30
31
  *
31
32
  * @defaultValue true
32
33
  * @gridInfoItem
34
+ * @noCodeItem
33
35
  */
34
36
  indicateFilteredColumns?: boolean;
35
37
  /**
36
38
  * Uses Adaptable's Filter Form in Column Menu for all columns if 'true' (the default) or those listed, in preference to AG Grid's Filter Form
37
39
  *
38
40
  * @defaultValue true
41
+ * @noCodeItem
39
42
  */
40
43
  useAdaptableFilterForm?: boolean | string[];
41
44
  /**
@@ -43,6 +46,7 @@ export interface FilterOptions {
43
46
  *
44
47
  * @defaultValue true
45
48
  * @gridInfoItem
49
+ * @noCodeItem
46
50
  */
47
51
  useAgGridFilterFormStyle?: boolean;
48
52
  /**
@@ -50,6 +54,7 @@ export interface FilterOptions {
50
54
  *
51
55
  * @defaultValue true
52
56
  * @gridInfoItem
57
+ * @noCodeItem
53
58
  */
54
59
  useAdaptableQuickFilter?: boolean | string[];
55
60
  /**
@@ -90,6 +95,7 @@ export interface FilterOptions {
90
95
  *
91
96
  * @defaultValue true
92
97
  * @gridInfoItem
98
+ * @noCodeItem
93
99
  */
94
100
  autoApplyFilter?: boolean;
95
101
  /**
@@ -13,6 +13,8 @@ export interface GeneralOptions {
13
13
  *
14
14
  * @defaultValue false
15
15
  * @gridInfoItem
16
+ * @noCodeItem
17
+ * @uiLabel Show Missing Primary Key Warning
16
18
  */
17
19
  showMissingPrimaryKeyAlert?: boolean;
18
20
  /**
@@ -34,6 +34,7 @@ export interface LayoutOptions {
34
34
  *
35
35
  * @defaultValue true
36
36
  * @gridInfoItem
37
+ * @noCodeItem
37
38
  */
38
39
  autoSaveLayouts?: boolean;
39
40
  /**
@@ -52,7 +52,7 @@ export interface NotificationsOptions {
52
52
  */
53
53
  isDraggable?: boolean;
54
54
  /**
55
- * How Notification will appear: 'Bounce', 'Slide', 'Zoom' or 'Flip'
55
+ * How Notification will appear: Bounce, Slide, Zoom or Flip
56
56
  *
57
57
  * @defaultValue 'Slide'
58
58
  * @gridInfoItem
@@ -70,6 +70,7 @@ export interface NotificationsOptions {
70
70
  *
71
71
  * @defaultValue 100
72
72
  * @gridInfoItem
73
+ * @transition
73
74
  */
74
75
  maxSystemMessagesInStore?: number;
75
76
  /**
@@ -1,25 +1,4 @@
1
- import { SelectionChangedInfo } from './Events/SelectionChanged';
2
- import { LiveDataChangedInfo } from './Events/LiveDataChanged';
3
- import { DashboardChangedInfo } from './Events/DashboardChanged';
4
- import { ThemeChangedInfo } from './Events/ThemeChanged';
5
- import { AlertFiredInfo } from './Events/AlertFired';
6
- import { LayoutChangedInfo } from './Events/LayoutChanged';
7
- import { SearchChangedInfo } from './Events/SearchChanged';
8
- import { AdaptableReadyInfo } from './Events/AdaptableReady';
9
- import { CustomToolbarConfiguredInfo } from './Events/CustomToolbarConfigured';
10
- import { CellChangedInfo } from './Events/CellChanged';
11
- import { SystemStatusMessageDisplayedInfo } from './Events/SystemStatusMessageDisplayed';
12
- import { CheckboxColumnClickedInfo } from './Events/ChexboxColumnClicked';
13
- import { AdaptableStateChangedInfo } from './Events/AdaptableStateChanged';
14
- import { FlashingCellDisplayedInfo } from './Events/FlashingCellDisplayed';
15
- import { GridDataChangedInfo } from './Events/GridDataChanged';
16
- import { TeamSharingEntityChangedInfo } from './Events/TeamSharingEntityChanged';
17
- import { ActionRowSubmittedInfo } from './Events/ActionRowSubmitted';
18
- import { DataSetSelectedInfo } from './Events/DataSetSelected';
19
- import { AdaptableStateReloadedInfo } from './Events/AdaptableStateReloaded';
20
- import { GridSortedInfo } from './Events/GridSorted';
21
- import { QueryRunInfo } from './Events/QueryRun';
22
- import { FilterAppliedInfo } from './Events/FilterApplied';
1
+ import { AdaptableFDC3EventInfo, SelectionChangedInfo, LiveDataChangedInfo, DashboardChangedInfo, ThemeChangedInfo, AlertFiredInfo, LayoutChangedInfo, SearchChangedInfo, AdaptableReadyInfo, CustomToolbarConfiguredInfo, CellChangedInfo, SystemStatusMessageDisplayedInfo, CheckboxColumnClickedInfo, AdaptableStateChangedInfo, FlashingCellDisplayedInfo, GridDataChangedInfo, TeamSharingEntityChangedInfo, ActionRowSubmittedInfo, DataSetSelectedInfo, AdaptableStateReloadedInfo, GridSortedInfo, QueryRunInfo, FilterAppliedInfo } from '../types';
23
2
  /**
24
3
  * Responsible for publishing the many Events that AdapTable fires
25
4
  */
@@ -298,6 +277,18 @@ export interface EventApi {
298
277
  * Unsubscribe from AdaptableReady
299
278
  */
300
279
  off(eventName: 'AdaptableReady', callback: (adaptableReadyInfo: AdaptableReadyInfo) => void): void;
280
+ /**
281
+ * Fired when an FDC3Message is sent
282
+ * @param eventName - FDC3MessageSent
283
+ * @param callback - A callback for listening to `FDC3MessageSent`
284
+ * @returns the unsubscribe function
285
+ *
286
+ */
287
+ on(eventName: 'FDC3MessageSent', callback: (eventInfo: AdaptableFDC3EventInfo) => void): VoidFunction;
288
+ /**
289
+ * Unsubscribe from FDC3MessageSent
290
+ */
291
+ off(eventName: 'FDC3MessageSent', callback: (eventInfo: AdaptableFDC3EventInfo) => void): void;
301
292
  emitSync(eventName: 'DashboardChanged', data?: any): any[];
302
293
  emitSync(eventName: 'FlashingCellDisplayed', data?: any): any[];
303
294
  emitSync(eventName: 'AdaptableDestroy'): any[];
@@ -17,6 +17,7 @@ export declare class StyledColumnApiImpl extends ApiBase implements StyledColumn
17
17
  getCellColorRangeMinValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
18
18
  getCellColorRangeMaxValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
19
19
  getColumnComparisonForStyledColumn(styledColumn: StyledColumn): ColumnComparison | undefined;
20
+ hasStyledColumnRelativeCellRange(styledColumn: StyledColumn): boolean;
20
21
  getColumnIdsFromColumnComparison(columnComparison: ColumnComparison): string[];
21
22
  getCheckBoxStyleStyledColumn(column: AdaptableColumn): StyledColumn | undefined;
22
23
  isCheckBoxStyleStyledColumn(column: AdaptableColumn): boolean;
@@ -146,6 +146,23 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
146
146
  }
147
147
  return undefined;
148
148
  }
149
+ hasStyledColumnRelativeCellRange(styledColumn) {
150
+ var _a, _b, _c;
151
+ let cellColorRange = null;
152
+ if (styledColumn.GradientStyle) {
153
+ if ((_a = styledColumn.GradientStyle) === null || _a === void 0 ? void 0 : _a.CellRanges) {
154
+ cellColorRange = styledColumn.GradientStyle.CellRanges;
155
+ }
156
+ }
157
+ if (styledColumn.PercentBarStyle) {
158
+ if ((_b = styledColumn.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.CellRanges) {
159
+ cellColorRange = styledColumn.PercentBarStyle.CellRanges;
160
+ }
161
+ }
162
+ return ((_c = cellColorRange === null || cellColorRange === void 0 ? void 0 : cellColorRange.some((cellColorRange) => {
163
+ return cellColorRange.Min == 'Col-Min' || cellColorRange.Max == 'Col-Max';
164
+ })) !== null && _c !== void 0 ? _c : false);
165
+ }
149
166
  getColumnIdsFromColumnComparison(columnComparison) {
150
167
  let returnValues = [];
151
168
  if (typeof columnComparison.MinValue === 'string') {
@@ -84,6 +84,11 @@ export interface StyledColumnApi {
84
84
  * @param columnComparision Column Comparison to check
85
85
  */
86
86
  getColumnIdsFromColumnComparison(columnComparision: ColumnComparison): string[];
87
+ /**
88
+ * Checks if the styled column has a range with a relative value
89
+ * @param styledColumn Styled Column to Add
90
+ */
91
+ hasStyledColumnRelativeCellRange(styledCOlumn: StyledColumn): boolean;
87
92
  /**
88
93
  * Returns first Styled Column that contains checkbox style
89
94
  * @param columnId column to check
@@ -58,7 +58,7 @@ class FilterModule extends AdaptableModuleBase_1.AdaptableModuleBase {
58
58
  if (column && this.api.gridApi.isQuickFilterAvailable()) {
59
59
  const isFilterVisible = this.api.filterApi.isQuickFilterVisible();
60
60
  if (this.isModuleEditable() && this.api.columnApi.usesAdaptableQuickFilter(column.columnId)) {
61
- baseMenuItems.push(this.createColumnMenuItemReduxAction(isFilterVisible ? 'Hide Quick Filter Bar' : 'Show Quick Filter Bar', isFilterVisible ? 'unchecked' : 'check', isFilterVisible
61
+ baseMenuItems.push(this.createColumnMenuItemReduxAction(isFilterVisible ? 'Hide Filter Bar' : 'Show Filter Bar', isFilterVisible ? 'unchecked' : 'check', isFilterVisible
62
62
  ? SystemRedux.SystemQuickFilterBarHide()
63
63
  : SystemRedux.SystemQuickFilterBarShow()));
64
64
  }
@@ -227,7 +227,13 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
227
227
  name: 'Layout Grid Type',
228
228
  values: [(layout === null || layout === void 0 ? void 0 : layout.EnablePivot) ? 'Pivot' : 'Table'],
229
229
  },
230
- {
230
+ /**
231
+ * Hide pivot columns.
232
+ *
233
+ * The generated pivot columns cannot be prevented from beeing on the layout object.
234
+ * When they are removed/not added, they no longer apear in the grid.
235
+ */
236
+ !layout.EnablePivot && {
231
237
  name: 'Columns',
232
238
  values: columns,
233
239
  },
@@ -94,6 +94,7 @@ exports.DefaultAdaptableOptions = {
94
94
  actionOptions: {
95
95
  actionColumns: undefined,
96
96
  actionRowButtons: undefined,
97
+ actionRowButtonCustomConfiguration: undefined,
97
98
  actionRowButtonsPosition: 'pinnedLeft',
98
99
  autoHandleActionRowButtons: false,
99
100
  setPrimaryKeyValue: undefined,
@@ -16,6 +16,7 @@ export declare function CapitaliseFirstLetter(str: string): string;
16
16
  export declare function Humanize(str: string): string;
17
17
  export declare function ReplaceEmptySpacesWithUnderscore(str?: string): string;
18
18
  export declare function IsNumeric(str: string): boolean;
19
+ export declare function UnescapeHtmlEntities(str: string): string;
19
20
  export declare const StringExtensions: {
20
21
  IsNull: typeof IsNull;
21
22
  IsNotNull: typeof IsNotNull;
@@ -35,5 +36,6 @@ export declare const StringExtensions: {
35
36
  Humanize: typeof Humanize;
36
37
  ReplaceEmptySpacesWithUnderscore: typeof ReplaceEmptySpacesWithUnderscore;
37
38
  IsNumeric: typeof IsNumeric;
39
+ UnescapeHtmlEntities: typeof UnescapeHtmlEntities;
38
40
  };
39
41
  export default StringExtensions;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringExtensions = exports.IsNumeric = exports.ReplaceEmptySpacesWithUnderscore = exports.Humanize = exports.CapitaliseFirstLetter = exports.AbbreviateString = exports.NotIncludes = exports.Includes = exports.ToLowerCase = exports.RemoveTrailingComma = exports.CamelCaseToHumanText = exports.IsNotNullOrEmptyOrWhiteSpace = exports.IsNullOrEmptyOrWhiteSpace = exports.IsNotNullOrEmpty = exports.IsNullOrEmpty = exports.IsNotEmpty = exports.IsEmpty = exports.IsNotNull = exports.IsNull = void 0;
3
+ exports.StringExtensions = exports.UnescapeHtmlEntities = exports.IsNumeric = exports.ReplaceEmptySpacesWithUnderscore = exports.Humanize = exports.CapitaliseFirstLetter = exports.AbbreviateString = exports.NotIncludes = exports.Includes = exports.ToLowerCase = exports.RemoveTrailingComma = exports.CamelCaseToHumanText = exports.IsNotNullOrEmptyOrWhiteSpace = exports.IsNullOrEmptyOrWhiteSpace = exports.IsNotNullOrEmpty = exports.IsNullOrEmpty = exports.IsNotEmpty = exports.IsEmpty = exports.IsNotNull = exports.IsNull = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const startCase_1 = tslib_1.__importDefault(require("lodash/startCase"));
6
6
  function IsNull(stringToCheck) {
@@ -88,6 +88,25 @@ function IsNumeric(str) {
88
88
  return !isNaN(parseFloat(str));
89
89
  }
90
90
  exports.IsNumeric = IsNumeric;
91
+ function UnescapeHtmlEntities(str) {
92
+ if (!str || typeof str !== 'string') {
93
+ return str;
94
+ }
95
+ let preparedStr = str;
96
+ const map = [
97
+ { target: /&apos;|&#39;/gi, replacement: "'" },
98
+ { target: /&quot;|&#34;/gi, replacement: '"' },
99
+ { target: /&amp;|&#38;/gi, replacement: '&' },
100
+ { target: /&lt;|&#60;/gi, replacement: '<' },
101
+ { target: /&gt;|&#62;/gi, replacement: '>' },
102
+ { target: /&nbsp;|&#160;/gi, replacement: ' ' },
103
+ ];
104
+ for (const transform of map) {
105
+ preparedStr = preparedStr.replace(transform.target, transform.replacement);
106
+ }
107
+ return preparedStr;
108
+ }
109
+ exports.UnescapeHtmlEntities = UnescapeHtmlEntities;
91
110
  exports.StringExtensions = {
92
111
  IsNull,
93
112
  IsNotNull,
@@ -107,5 +126,6 @@ exports.StringExtensions = {
107
126
  Humanize,
108
127
  ReplaceEmptySpacesWithUnderscore,
109
128
  IsNumeric,
129
+ UnescapeHtmlEntities,
110
130
  };
111
131
  exports.default = exports.StringExtensions;
@@ -133,7 +133,7 @@ class CalculatedColumnExpressionService {
133
133
  this.aggregatedScalarLiveValuesMap.set(calculatedColumn.Uuid, aggregatedScalarLiveValue);
134
134
  }
135
135
  catch (e) {
136
- (0, LoggingHelper_1.LogAdaptableError)(`Creating CalculatedColumn ('${(_c = calculatedColumn.Query) === null || _c === void 0 ? void 0 : _c.AggregatedScalarExpression}') failed!\n${e.message}`);
136
+ (0, LoggingHelper_1.LogAdaptableError)(`Creating CalculatedColumn ('${(_c = calculatedColumn.Query) === null || _c === void 0 ? void 0 : _c.AggregatedScalarExpression}') failed!`, e.message);
137
137
  }
138
138
  }
139
139
  }
@@ -11,6 +11,7 @@ export interface GridInfoOption {
11
11
  description: string;
12
12
  kind: MetamodelItemPropertyKind;
13
13
  defaultValue?: any;
14
+ uiLabel: string;
14
15
  }
15
16
  export interface IMetamodelService extends IAdaptableService {
16
17
  getAdaptableOptions: () => AdaptableOptions;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MetamodelService = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const adaptable_metamodel_1 = require("../../metamodel/adaptable.metamodel");
5
6
  const DefaultAdaptableOptions_1 = require("../Defaults/DefaultAdaptableOptions");
6
7
  const LoggingHelper_1 = require("../Helpers/LoggingHelper");
7
8
  const DocumentationLinkConstants_1 = require("../Constants/DocumentationLinkConstants");
9
+ const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/StringExtensions"));
8
10
  const supportedMetamodelTypes = [
9
11
  'string',
10
12
  'number',
@@ -99,7 +101,7 @@ class MetamodelService {
99
101
  return gridInfoOptions;
100
102
  }
101
103
  // root-level properties are grouped in a synthetic 'Base Options' container
102
- const baseOptionsItems = this.mapGridInfoContainerItems(adaptableOptionsMetamodel, adaptableOptionsValues, adaptableOptionsDefaultValues);
104
+ const baseOptionsItems = this.mapGridInfoContainerItems(adaptableOptionsMetamodel, adaptableOptionsValues, adaptableOptionsDefaultValues, filterItemProperty);
103
105
  gridInfoOptions.set('baseOptions', {
104
106
  containerLabel: 'Base Options',
105
107
  items: baseOptionsItems,
@@ -130,14 +132,14 @@ class MetamodelService {
130
132
  return gridInfoOptions;
131
133
  }
132
134
  mapGridInfoContainerItems(optionItemContainer, adaptableOptionsValues, defaultAdaptableOptionsValues, filter = (itemProperty) => itemProperty.gridInfo === 'item') {
133
- var _a;
134
- return (_a = optionItemContainer.properties) === null || _a === void 0 ? void 0 : _a.filter(filter).map((itemProperty) => {
135
+ return optionItemContainer.properties.filter(filter).map((itemProperty) => {
135
136
  return {
136
137
  name: itemProperty.name,
137
138
  value: adaptableOptionsValues === null || adaptableOptionsValues === void 0 ? void 0 : adaptableOptionsValues[itemProperty.name],
138
139
  defaultValue: defaultAdaptableOptionsValues[itemProperty.name],
139
140
  kind: itemProperty.kind,
140
- description: itemProperty.description,
141
+ description: StringExtensions_1.default.UnescapeHtmlEntities(itemProperty.description),
142
+ uiLabel: itemProperty.uiLabel,
141
143
  };
142
144
  });
143
145
  }
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { AdaptableOptions } from '../../../types';
3
- interface AdaptableOptionsFormOptions {
3
+ export declare const AdaptableOptionsForm: React.FunctionComponent<{
4
4
  adaptableOptions: AdaptableOptions;
5
5
  onChangeadAptableOptions: (adaptableOptions: AdaptableOptions) => void;
6
- }
7
- declare const AdaptableOptionsForm: (props: AdaptableOptionsFormOptions) => JSX.Element;
8
- export default AdaptableOptionsForm;
6
+ }>;
@@ -1,101 +1,112 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdaptableOptionsForm = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const React = tslib_1.__importStar(require("react"));
5
- const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
6
+ const rebass_1 = require("rebass");
6
7
  const CheckBox_1 = require("../../../components/CheckBox");
8
+ const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
7
9
  const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
8
10
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
9
- const rebass_1 = require("rebass");
10
- const DefaultAdaptableOptions_1 = require("../../../Utilities/Defaults/DefaultAdaptableOptions");
11
+ const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
12
+ const MetamodelService_1 = require("../../../Utilities/Services/MetamodelService");
13
+ const AdaptablePopover_1 = require("../../AdaptablePopover");
14
+ const LABEL_WIDTH = 250;
15
+ const SUPPORTED_PRIMITEVE_TYPES = ['string', 'number', 'boolean'];
16
+ const OptionInput = (props) => {
17
+ const { name, defaultValue, value, description, uiLabel } = props.option;
18
+ const label = uiLabel !== null && uiLabel !== void 0 ? uiLabel : StringExtensions_1.default.Humanize(name);
19
+ let input = React.createElement(React.Fragment, null);
20
+ const info = (React.createElement(rebass_1.Box, { ml: 2 },
21
+ React.createElement(AdaptablePopover_1.AdaptablePopover, { headerText: null, bodyText: [description] })));
22
+ const handleInputChange = (event) => props.onChange(Object.assign(Object.assign({}, props.option), { value: event.currentTarget.value }));
23
+ const handleCheckboxChange = (checked) => props.onChange(Object.assign(Object.assign({}, props.option), { value: checked }));
24
+ // option is mutated to acomodate complex types overrides
25
+ const option = Object.assign({}, props.option);
26
+ const isOptionNonHomogenusUnion = (option) => {
27
+ const isUnion = option.kind.includes('|');
28
+ return isUnion && option.kind.split('|').some((unionEl) => !/['"]/.test(unionEl));
29
+ };
30
+ if (isOptionNonHomogenusUnion(option)) {
31
+ // pick the first type
32
+ const newKind = option.kind
33
+ .split('|')
34
+ .find((unionEl) => SUPPORTED_PRIMITEVE_TYPES.includes(unionEl.trim()))
35
+ .trim();
36
+ if (newKind)
37
+ option.kind = newKind;
38
+ }
39
+ const inputProps = {
40
+ value: value !== null && value !== void 0 ? value : defaultValue,
41
+ minWidth: 200,
42
+ fontSize: 3,
43
+ mr: 2,
44
+ };
45
+ if (option.kind.includes('|')) {
46
+ const options = option.kind
47
+ .split('|')
48
+ .map((str) => str.trim().replace(/['"]/g, ''))
49
+ .map((str) => ({
50
+ label: StringExtensions_1.default.Humanize(str),
51
+ onClick: () => props.onChange(Object.assign(Object.assign({}, option), { value: str })),
52
+ }));
53
+ input = (React.createElement(DropdownButton_1.default, Object.assign({}, inputProps, { columns: ['label'], items: options }), StringExtensions_1.default.Humanize(value)));
54
+ }
55
+ else {
56
+ switch (option.kind) {
57
+ case 'number':
58
+ input = React.createElement(Input_1.default, Object.assign({ type: "number", onChange: handleInputChange }, inputProps));
59
+ break;
60
+ case 'string':
61
+ input = React.createElement(Input_1.default, Object.assign({ type: "text", onChange: handleInputChange }, inputProps));
62
+ break;
63
+ case 'boolean':
64
+ input = (React.createElement(CheckBox_1.CheckBox, { onChange: handleCheckboxChange, checked: Boolean(value), type: "date" }, label));
65
+ break;
66
+ }
67
+ }
68
+ let content = (React.createElement(React.Fragment, null,
69
+ React.createElement(rebass_1.Flex, { minWidth: LABEL_WIDTH, alignItems: "center" },
70
+ label,
71
+ " ",
72
+ info),
73
+ input));
74
+ if (option.kind === 'boolean') {
75
+ content = (React.createElement(rebass_1.Flex, { alignItems: "center" },
76
+ input,
77
+ " ",
78
+ info));
79
+ }
80
+ return (React.createElement(rebass_1.Flex, { mb: 2, pl: 1 }, content));
81
+ };
82
+ const OptionsSection = (props) => {
83
+ var _a;
84
+ if (!props.options.length) {
85
+ return React.createElement(React.Fragment, null);
86
+ }
87
+ return (React.createElement(rebass_1.Box, { mb: 2 },
88
+ React.createElement(HelpBlock_1.default, { mb: 2 }, (_a = props.name) !== null && _a !== void 0 ? _a : props.id),
89
+ props.options.map((option, index) => (React.createElement(OptionInput, { key: index, option: option, onChange: props.onChange })))));
90
+ };
11
91
  const AdaptableOptionsForm = (props) => {
12
- var _a, _b;
13
- let abOptions = props.adaptableOptions;
14
- const layoutOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.layoutOptions), abOptions.layoutOptions);
15
- const generalOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.generalOptions), abOptions.generalOptions);
16
- const adaptableQLOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.adaptableQLOptions), abOptions.adaptableQLOptions);
17
- const filterOptions = Object.assign(Object.assign({}, DefaultAdaptableOptions_1.DefaultAdaptableOptions.filterOptions), abOptions.filterOptions);
18
- return (React.createElement(React.Fragment, null,
19
- React.createElement(HelpBlock_1.default, null, "Base Options"),
20
- React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'label', style: { textAlign: 'start' } }, { name: 'children' }] },
21
- React.createElement(FormLayout_1.FormRow, { label: "Adaptable ID" },
22
- React.createElement(Input_1.default, { value: (_b = (_a = props === null || props === void 0 ? void 0 : props.adaptableOptions) === null || _a === void 0 ? void 0 : _a.adaptableId) !== null && _b !== void 0 ? _b : null, onChange: (event) => {
23
- var _a;
24
- props.onChangeadAptableOptions(Object.assign(Object.assign({}, abOptions), { adaptableId: (_a = event.target.value) !== null && _a !== void 0 ? _a : '' }));
25
- }, style: { minWidth: '20rem' } }))),
26
- React.createElement(HelpBlock_1.default, null, "General Options"),
27
- React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
28
- React.createElement(FormLayout_1.FormRow, { label: "Show Missing Primary Key Warning" },
29
- React.createElement(CheckBox_1.CheckBox, { checked: generalOptions.showMissingPrimaryKeyAlert, onChange: (showMissingPrimaryKeyWarning) => {
30
- abOptions = Object.assign({}, abOptions);
31
- abOptions.generalOptions = Object.assign({}, abOptions.generalOptions);
32
- abOptions.generalOptions.showMissingPrimaryKeyAlert = showMissingPrimaryKeyWarning;
33
- props.onChangeadAptableOptions(abOptions);
34
- } }))),
35
- React.createElement(HelpBlock_1.default, null, "Layout Options"),
36
- React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
37
- React.createElement(FormLayout_1.FormRow, { label: "Auto Save Layouts" },
38
- React.createElement(CheckBox_1.CheckBox, { checked: layoutOptions.autoSaveLayouts, onChange: (autoSaveLayouts) => {
39
- abOptions = Object.assign({}, abOptions);
40
- abOptions.layoutOptions = Object.assign({}, abOptions.layoutOptions);
41
- abOptions.layoutOptions.autoSaveLayouts = autoSaveLayouts;
42
- props.onChangeadAptableOptions(abOptions);
43
- } }))),
44
- React.createElement(HelpBlock_1.default, null, "Search Options"),
45
- React.createElement(FormLayout_1.default, { margin: 2, columns: [{ name: 'children' }, { name: 'label', style: { textAlign: 'start' } }] },
46
- React.createElement(FormLayout_1.FormRow, { label: "Case Sensitive Text Comparison" },
47
- React.createElement(CheckBox_1.CheckBox, { checked: adaptableQLOptions.caseSensitiveTextComparisons, onChange: (caseSensitiveTextComparisons) => {
48
- abOptions = Object.assign({}, abOptions);
49
- abOptions.adaptableQLOptions = Object.assign({}, abOptions.adaptableQLOptions);
50
- abOptions.adaptableQLOptions.caseSensitiveTextComparisons =
51
- caseSensitiveTextComparisons;
52
- props.onChangeadAptableOptions(abOptions);
53
- } })),
54
- React.createElement(FormLayout_1.FormRow, { label: "Use AG Grid Filter Form Style" },
55
- React.createElement(CheckBox_1.CheckBox, { checked: filterOptions.useAgGridFilterFormStyle, onChange: (useAgGridFilterFormStyle) => {
56
- abOptions = Object.assign({}, abOptions);
57
- abOptions.filterOptions = Object.assign({}, abOptions.filterOptions);
58
- abOptions.filterOptions.useAgGridFilterFormStyle = useAgGridFilterFormStyle;
59
- props.onChangeadAptableOptions(abOptions);
60
- } })),
61
- React.createElement(FormLayout_1.FormRow, { label: "Use Adaptable Quick Filter" },
62
- React.createElement(CheckBox_1.CheckBox, { checked: filterOptions.useAdaptableQuickFilter == true, onChange: (useAdaptableQuickFilter) => {
63
- abOptions = Object.assign({}, abOptions);
64
- abOptions.filterOptions = Object.assign({}, abOptions.filterOptions);
65
- abOptions.filterOptions.useAdaptableQuickFilter = useAdaptableQuickFilter;
66
- props.onChangeadAptableOptions(abOptions);
67
- } })),
68
- React.createElement(FormLayout_1.FormRow, { label: "Use Adaptable Filter Form" },
69
- React.createElement(CheckBox_1.CheckBox, { checked: filterOptions.useAdaptableFilterForm == true, onChange: (useAdaptableFilterForm) => {
70
- abOptions = Object.assign({}, abOptions);
71
- abOptions.filterOptions = Object.assign({}, abOptions.filterOptions);
72
- abOptions.filterOptions.useAdaptableFilterForm = useAdaptableFilterForm;
73
- props.onChangeadAptableOptions(abOptions);
74
- } })),
75
- React.createElement(FormLayout_1.FormRow, { label: "Indicate Filtered Columns" },
76
- React.createElement(CheckBox_1.CheckBox, { checked: filterOptions.indicateFilteredColumns, onChange: (indicateFilteredColumns) => {
77
- abOptions = Object.assign({}, abOptions);
78
- abOptions.filterOptions = Object.assign({}, abOptions.filterOptions);
79
- abOptions.filterOptions.indicateFilteredColumns = indicateFilteredColumns;
80
- props.onChangeadAptableOptions(abOptions);
81
- } })),
82
- React.createElement(FormLayout_1.FormRow, { label: "Auto Apply Filter" },
83
- React.createElement(CheckBox_1.CheckBox, { checked: filterOptions.autoApplyFilter, onChange: (autoApplyFilter) => {
84
- abOptions = Object.assign({}, abOptions);
85
- abOptions.filterOptions = Object.assign({}, abOptions.filterOptions);
86
- abOptions.filterOptions.autoApplyFilter = autoApplyFilter;
87
- props.onChangeadAptableOptions(abOptions);
88
- } }))),
89
- React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", margin: 2 },
90
- React.createElement(rebass_1.Text, { style: { flex: 3 }, marginRight: 2 }, "Max Column Value Items To Display"),
91
- React.createElement(rebass_1.Flex, { flex: 7, flexDirection: "row", alignItems: "center" },
92
- React.createElement(Input_1.default, { style: { flex: 1 }, type: "number", placeholder: "Enter Number", onChange: (event) => {
93
- let e = event.target;
94
- let maxColumnValueItemsDisplayed = parseInt(e.value);
95
- abOptions = Object.assign({}, abOptions);
96
- abOptions.filterOptions = Object.assign({}, abOptions.filterOptions);
97
- abOptions.filterOptions.maxFilterValuesToDisplay = maxColumnValueItemsDisplayed;
98
- props.onChangeadAptableOptions(abOptions);
99
- }, value: filterOptions.maxFilterValuesToDisplay, marginRight: 3 })))));
92
+ const nocodeOptions = React.useMemo(() => {
93
+ const metamodelService = new MetamodelService_1.MetamodelService(() => props.adaptableOptions);
94
+ return [...metamodelService.getGridInfoNoCodeOptions()];
95
+ }, [props.adaptableOptions]);
96
+ const handleOptionChange = (sectionName) => (option) => {
97
+ const adaptableOptions = Object.assign({}, props.adaptableOptions);
98
+ if (sectionName === 'baseOptions') {
99
+ // @ts-ignore
100
+ adaptableOptions[option.name] = option.value;
101
+ }
102
+ else {
103
+ // @ts-ignore
104
+ adaptableOptions[sectionName] = Object.assign(Object.assign({}, adaptableOptions[sectionName]), { [option.name]: option.value });
105
+ }
106
+ props.onChangeadAptableOptions(adaptableOptions);
107
+ };
108
+ return (React.createElement(rebass_1.Box, { p: 2 }, nocodeOptions.map(([sectionName, { containerLabel, items }]) => {
109
+ return (React.createElement(OptionsSection, { onChange: handleOptionChange(sectionName), key: sectionName, id: sectionName, name: containerLabel, options: items }));
110
+ })));
100
111
  };
101
- exports.default = AdaptableOptionsForm;
112
+ exports.AdaptableOptionsForm = AdaptableOptionsForm;