@adaptabletools/adaptable 14.0.0 → 14.0.1-canary.1

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 (83) hide show
  1. package/bundle.cjs.js +230 -225
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableOptions/ActionOptions.d.ts +5 -3
  6. package/src/AdaptableOptions/AdaptableFrameworkComponent.d.ts +14 -7
  7. package/src/AdaptableOptions/AdaptableOptions.d.ts +16 -2
  8. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +4 -5
  9. package/src/AdaptableOptions/AlertOptions.d.ts +1 -0
  10. package/src/AdaptableOptions/ChartingOptions.d.ts +1 -0
  11. package/src/AdaptableOptions/ColumnOptions.d.ts +3 -0
  12. package/src/AdaptableOptions/DashboardOptions.d.ts +3 -0
  13. package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +1 -0
  14. package/src/AdaptableOptions/ExpressionOptions.d.ts +15 -15
  15. package/src/AdaptableOptions/FilterOptions.d.ts +9 -8
  16. package/src/AdaptableOptions/FinancePluginOptions.d.ts +0 -11
  17. package/src/AdaptableOptions/GeneralOptions.d.ts +3 -9
  18. package/src/AdaptableOptions/LayoutOptions.d.ts +2 -7
  19. package/src/AdaptableOptions/MenuOptions.d.ts +1 -1
  20. package/src/AdaptableOptions/NotificationsOptions.d.ts +1 -0
  21. package/src/AdaptableOptions/SearchOptions.d.ts +1 -0
  22. package/src/AdaptableOptions/SettingsPanelOptions.d.ts +2 -0
  23. package/src/AdaptableOptions/StateOptions.d.ts +0 -4
  24. package/src/AdaptableOptions/ToolPanelOptions.d.ts +2 -1
  25. package/src/Api/AlertApi.d.ts +3 -3
  26. package/src/Api/GridApi.d.ts +5 -5
  27. package/src/Api/Implementation/AlertApiImpl.d.ts +1 -1
  28. package/src/Api/Implementation/AlertApiImpl.js +1 -1
  29. package/src/Api/Implementation/GridApiImpl.js +1 -1
  30. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +1 -0
  31. package/src/Api/Implementation/StyledColumnApiImpl.js +6 -0
  32. package/src/Api/Implementation/TeamSharingApiImpl.d.ts +2 -0
  33. package/src/Api/Implementation/TeamSharingApiImpl.js +7 -0
  34. package/src/Api/Internal/LayoutInternalApi.js +1 -2
  35. package/src/Api/Internal/PredicateInternalApi.js +0 -7
  36. package/src/Api/Internal/TeamSharingInternalApi.d.ts +0 -5
  37. package/src/Api/Internal/TeamSharingInternalApi.js +0 -9
  38. package/src/Api/StyledColumnApi.d.ts +7 -2
  39. package/src/Api/TeamSharingApi.d.ts +8 -0
  40. package/src/PredefinedConfig/AlertState.d.ts +1 -1
  41. package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -6
  42. package/src/PredefinedConfig/Common/Menu.d.ts +5 -5
  43. package/src/PredefinedConfig/Common/SpecialColumnSettings.d.ts +6 -2
  44. package/src/PredefinedConfig/FormatColumnState.d.ts +2 -3
  45. package/src/PredefinedConfig/FreeTextColumnState.d.ts +1 -6
  46. package/src/Strategy/CalculatedColumnModule.js +7 -0
  47. package/src/Strategy/ChartingModule.js +2 -4
  48. package/src/Strategy/FreeTextColumnModule.js +24 -5
  49. package/src/Strategy/StyledColumnModule.js +60 -28
  50. package/src/Strategy/TeamSharingModule.js +2 -2
  51. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -3
  52. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +1 -1
  53. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +11 -10
  54. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +11 -7
  55. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -1
  56. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +26 -52
  57. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +13 -13
  58. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
  59. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +101 -44
  60. package/src/Utilities/ObjectFactory.js +1 -1
  61. package/src/View/Components/Charting/ChartingStatusBarPopover.js +19 -14
  62. package/src/View/Components/Charting/ChartingViewPanel.js +2 -67
  63. package/src/View/Components/Charting/DeleteChartButton.d.ts +1 -0
  64. package/src/View/Components/Charting/DeleteChartButton.js +1 -1
  65. package/src/View/Components/Charting/EditChartButton.d.ts +1 -0
  66. package/src/View/Components/Charting/EditChartButton.js +1 -1
  67. package/src/View/Components/Charting/useChartingElements.d.ts +14 -0
  68. package/src/View/Components/Charting/useChartingElements.js +90 -0
  69. package/src/View/Components/Popups/AdaptablePopupConfirmation.js +1 -1
  70. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +18 -10
  71. package/src/View/TeamSharing/SharedEntityObjectView.js +5 -4
  72. package/src/agGrid/Adaptable.d.ts +0 -1
  73. package/src/agGrid/Adaptable.js +15 -24
  74. package/src/components/ExpressionEditor/BaseEditorInput.js +42 -7
  75. package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +5 -5
  76. package/src/components/ExpressionEditor/editorButtonsSearch.js +8 -12
  77. package/src/metamodel/adaptable.metamodel.d.ts +124 -58
  78. package/src/metamodel/adaptable.metamodel.js +1 -1
  79. package/src/parser/src/types.d.ts +5 -9
  80. package/src/parser/src/utils.js +6 -3
  81. package/src/types.d.ts +3 -3
  82. package/version.d.ts +1 -1
  83. package/version.js +1 -1
@@ -3,76 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChartingViewPanel = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
- const react_redux_1 = require("react-redux");
7
6
  const rebass_1 = require("rebass");
8
- const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
9
- const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
10
- const ChartingRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ChartingRedux"));
11
- const AdaptableHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/AdaptableHelper"));
12
- const AdaptableContext_1 = require("../../AdaptableContext");
13
- const useChartState_1 = require("./useChartState");
14
- const DeleteChartButton_1 = require("./DeleteChartButton");
15
- const EditChartButton_1 = require("./EditChartButton");
7
+ const useChartingElements_1 = require("./useChartingElements");
16
8
  const ChartingViewPanel = (props) => {
17
- var _a, _b, _c;
18
- const adaptable = (0, AdaptableContext_1.useAdaptable)();
19
- const chartDefinitions = (0, react_redux_1.useSelector)(ChartingRedux.ChartingGetChartModels);
20
- const chartContainers = (_b = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.chartingOptions) === null || _b === void 0 ? void 0 : _b.chartContainers;
21
- const [selectedChartId, setSelectedChartId] = React.useState(() => {
22
- // ID is kept in state becaus that does not change, the definition might change
23
- return chartDefinitions.length > 0 ? chartDefinitions[0].Uuid : null;
24
- });
25
- const selectedChart = chartDefinitions.find((chart) => chart.Uuid === selectedChartId);
26
- const accessLevel = AdaptableHelper_1.default.getAppropriateAccessLevel(selectedChart, props.accessLevel);
27
- const [selectedContainer, setSelectedContainer] = React.useState(null);
28
- const { isOpen, showChart, closeChart } = (0, useChartState_1.useChartState)(selectedChart);
29
- const options = chartDefinitions.map((chartDefinition) => ({
30
- label: chartDefinition.Name,
31
- value: chartDefinition.Uuid,
32
- onClick: () => {
33
- setSelectedChartId(chartDefinition.Uuid);
34
- },
35
- }));
36
- const hasCharts = options.length > 0;
37
- const isSelectedChart = hasCharts && selectedChart != null;
38
- let content = '';
39
- if (hasCharts && selectedChart) {
40
- content = (_c = chartDefinitions.find((chart) => chart.Uuid === selectedChart.Uuid)) === null || _c === void 0 ? void 0 : _c.Name;
41
- }
42
- else if (hasCharts) {
43
- content = 'Select Chart';
44
- }
45
- else {
46
- content = 'No Charts';
47
- }
48
9
  const elementType = props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
49
- React.useEffect(() => {
50
- // select first
51
- if (!selectedChart && chartDefinitions.length > 0) {
52
- setSelectedChartId(chartDefinitions[0].Uuid);
53
- }
54
- }, [chartDefinitions]);
55
- const containerOptions = [
56
- {
57
- label: 'Ag Grid Window',
58
- onClick: () => {
59
- setSelectedContainer(null);
60
- },
61
- },
62
- ...(chartContainers
63
- ? chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.map((contianerDef) => ({
64
- label: contianerDef.name,
65
- onClick: () => {
66
- setSelectedContainer(contianerDef);
67
- },
68
- }))
69
- : []),
70
- ];
71
- const chartSelector = (React.createElement(DropdownButton_1.default, { width: "100%", columns: ['label'], className: `ab-${elementType}__Chart__select`, items: options, disabled: !hasCharts }, content));
72
- const containerSelector = Boolean(chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.length) && (React.createElement(DropdownButton_1.default, { width: "100%", columns: ['label'], items: containerOptions, disabled: !isSelectedChart }, (selectedContainer === null || selectedContainer === void 0 ? void 0 : selectedContainer.name) || 'Ag Grid Window'));
73
- const chartButton = (React.createElement(SimpleButton_1.default, { mr: 1, onClick: () => (isOpen ? closeChart() : showChart(selectedContainer)), disabled: !Boolean(selectedChart), variant: 'outlined', tone: 'neutral' }, isOpen ? 'Close' : 'Open'));
74
- const deleteButton = React.createElement(DeleteChartButton_1.DeleteChartButton, { chart: selectedChart, accessLevel: accessLevel });
75
- const editButton = (React.createElement(EditChartButton_1.EditChartButton, { chart: selectedChart, accessLevel: accessLevel, isOpen: isOpen }));
10
+ const { chartSelector, containerSelector, chartButton, deleteButton, editButton } = (0, useChartingElements_1.useChartingElements)({ elementType, accessLevel: props.accessLevel });
76
11
  if (elementType === 'DashboardToolbar') {
77
12
  return (React.createElement(rebass_1.Flex, { width: "100%", alignItems: "center" },
78
13
  React.createElement(rebass_1.Box, null, chartSelector),
@@ -3,5 +3,6 @@ import { AccessLevel, ChartDefinition } from '../../../types';
3
3
  export interface ButtonDeleteProps {
4
4
  chart: ChartDefinition;
5
5
  accessLevel: AccessLevel;
6
+ iconSize?: number;
6
7
  }
7
8
  export declare const DeleteChartButton: React.FunctionComponent<ButtonDeleteProps>;
@@ -7,6 +7,6 @@ const ButtonDelete_1 = require("../Buttons/ButtonDelete");
7
7
  const ChartingRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ChartingRedux"));
8
8
  const DeleteChartButton = (props) => {
9
9
  var _a;
10
- return (React.createElement(ButtonDelete_1.ButtonDelete, { disabled: !props.chart, ConfirmAction: ChartingRedux.ChartingDeleteChart((_a = props.chart) === null || _a === void 0 ? void 0 : _a.Name), ConfirmationMsg: `Are you sure you want to delete this Charts?`, ConfirmationTitle: 'Delete Charts', accessLevel: props.accessLevel }));
10
+ return (React.createElement(ButtonDelete_1.ButtonDelete, { iconSize: props.iconSize, disabled: !props.chart, ConfirmAction: ChartingRedux.ChartingDeleteChart((_a = props.chart) === null || _a === void 0 ? void 0 : _a.Name), ConfirmationMsg: `Are you sure you want to delete this Charts?`, ConfirmationTitle: 'Delete Charts', accessLevel: props.accessLevel }));
11
11
  };
12
12
  exports.DeleteChartButton = DeleteChartButton;
@@ -4,5 +4,6 @@ export interface EditChartButtonProps {
4
4
  chart: ChartDefinition;
5
5
  accessLevel: AccessLevel;
6
6
  isOpen: boolean;
7
+ iconSize?: number;
7
8
  }
8
9
  export declare const EditChartButton: React.FunctionComponent<EditChartButtonProps>;
@@ -9,7 +9,7 @@ const ModuleConstants = tslib_1.__importStar(require("../../../Utilities/Constan
9
9
  const react_redux_1 = require("react-redux");
10
10
  const EditChartButton = (props) => {
11
11
  const dispatch = (0, react_redux_1.useDispatch)();
12
- return (React.createElement(ButtonEdit_1.ButtonEdit, { tooltip: "Edit Chart",
12
+ return (React.createElement(ButtonEdit_1.ButtonEdit, { iconSize: props.iconSize, tooltip: "Edit Chart",
13
13
  // It gets complicated when a chart is both open and opened in edit wizard
14
14
  // There an be conflicts between the two open charts (preview and main) and the changes to the active chart may not be syncronized correctly.
15
15
  disabled: !props.chart || props.isOpen, accessLevel: props.accessLevel, onClick: () => dispatch(PopupRedux.PopupShowScreen(ModuleConstants.ChartingModuleId, 'Chart', {
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { AccessLevel, ChartDefinition } from '../../../types';
3
+ export declare const useChartingElements: ({ elementType, accessLevel, size, }: {
4
+ elementType: string;
5
+ accessLevel: AccessLevel;
6
+ size?: 'small' | 'normal';
7
+ }) => {
8
+ chartSelector: JSX.Element;
9
+ containerSelector: JSX.Element;
10
+ chartButton: JSX.Element;
11
+ deleteButton: JSX.Element;
12
+ editButton: JSX.Element;
13
+ selectedChart: ChartDefinition;
14
+ };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useChartingElements = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_redux_1 = require("react-redux");
7
+ const AdaptableContext_1 = require("../../AdaptableContext");
8
+ const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
9
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
10
+ const ChartingRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ChartingRedux"));
11
+ const AdaptableHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/AdaptableHelper"));
12
+ const useChartState_1 = require("./useChartState");
13
+ const DeleteChartButton_1 = require("./DeleteChartButton");
14
+ const EditChartButton_1 = require("./EditChartButton");
15
+ const useChartingElements = ({ elementType, accessLevel, size = 'normal', }) => {
16
+ var _a, _b, _c;
17
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
18
+ const chartDefinitions = (0, react_redux_1.useSelector)(ChartingRedux.ChartingGetChartModels);
19
+ const chartContainers = (_b = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.chartingOptions) === null || _b === void 0 ? void 0 : _b.chartContainers;
20
+ const [selectedChartId, setSelectedChartId] = React.useState(() => {
21
+ // ID is kept in state becaus that does not change, the definition might change
22
+ return chartDefinitions.length > 0 ? chartDefinitions[0].Uuid : null;
23
+ });
24
+ const selectedChart = chartDefinitions.find((chart) => chart.Uuid === selectedChartId);
25
+ const chartAccessLevel = AdaptableHelper_1.default.getAppropriateAccessLevel(selectedChart, accessLevel);
26
+ const [selectedContainer, setSelectedContainer] = React.useState(null);
27
+ const { isOpen, showChart, closeChart } = (0, useChartState_1.useChartState)(selectedChart);
28
+ const options = chartDefinitions.map((chartDefinition) => ({
29
+ label: chartDefinition.Name,
30
+ value: chartDefinition.Uuid,
31
+ onClick: () => {
32
+ setSelectedChartId(chartDefinition.Uuid);
33
+ },
34
+ }));
35
+ const hasCharts = options.length > 0;
36
+ const isSelectedChart = hasCharts && selectedChart != null;
37
+ let content = '';
38
+ if (hasCharts && selectedChart) {
39
+ content = (_c = chartDefinitions.find((chart) => chart.Uuid === selectedChart.Uuid)) === null || _c === void 0 ? void 0 : _c.Name;
40
+ }
41
+ else if (hasCharts) {
42
+ content = 'Select Chart';
43
+ }
44
+ else {
45
+ content = 'No Charts';
46
+ }
47
+ React.useEffect(() => {
48
+ // select first
49
+ if (!selectedChart && chartDefinitions.length > 0) {
50
+ setSelectedChartId(chartDefinitions[0].Uuid);
51
+ }
52
+ }, [chartDefinitions]);
53
+ const containerOptions = [
54
+ {
55
+ label: 'Ag Grid Window',
56
+ onClick: () => {
57
+ setSelectedContainer(null);
58
+ },
59
+ },
60
+ ...(chartContainers
61
+ ? chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.map((contianerDef) => ({
62
+ label: contianerDef.name,
63
+ onClick: () => {
64
+ setSelectedContainer(contianerDef);
65
+ },
66
+ }))
67
+ : []),
68
+ ];
69
+ const style = {};
70
+ let iconSize;
71
+ if (size === 'small') {
72
+ style.padding = 2;
73
+ style.fontSize = 'small';
74
+ iconSize = 15;
75
+ }
76
+ const chartSelector = (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], className: `ab-${elementType}__Chart__select`, items: options, disabled: !hasCharts }, content));
77
+ const containerSelector = Boolean(chartContainers === null || chartContainers === void 0 ? void 0 : chartContainers.length) && (React.createElement(DropdownButton_1.default, { style: style, width: "100%", columns: ['label'], items: containerOptions, disabled: !isSelectedChart }, (selectedContainer === null || selectedContainer === void 0 ? void 0 : selectedContainer.name) || 'Ag Grid Window'));
78
+ const chartButton = (React.createElement(SimpleButton_1.default, { style: style, mr: 1, onClick: () => (isOpen ? closeChart() : showChart(selectedContainer)), disabled: !Boolean(selectedChart), variant: 'outlined', tone: 'neutral' }, isOpen ? 'Close' : 'Open'));
79
+ const deleteButton = (React.createElement(DeleteChartButton_1.DeleteChartButton, { iconSize: iconSize, chart: selectedChart, accessLevel: chartAccessLevel }));
80
+ const editButton = (React.createElement(EditChartButton_1.EditChartButton, { iconSize: iconSize, chart: selectedChart, accessLevel: chartAccessLevel, isOpen: isOpen }));
81
+ return {
82
+ chartSelector,
83
+ containerSelector,
84
+ chartButton,
85
+ deleteButton,
86
+ editButton,
87
+ selectedChart,
88
+ };
89
+ };
90
+ exports.useChartingElements = useChartingElements;
@@ -53,7 +53,7 @@ const AdaptablePopupConfirmation = (props) => {
53
53
  React.createElement(rebass_1.Box, { pl: 2 },
54
54
  React.createElement(CheckBox_1.CheckBox, { checked: disableDeleteConfirmation, onChange: () => {
55
55
  setDisableDeleteConfirmation(!disableDeleteConfirmation);
56
- } }, "Do not show this again.")),
56
+ } }, "Do not show this again")),
57
57
  props.showInputBox && (React.createElement(rebass_1.Box, { padding: 2, "data-name": "body" },
58
58
  React.createElement("p", null, "Please enter a comment to confirm"),
59
59
  React.createElement(Input_1.default, { marginTop: 2, width: '100%', value: promptText, type: "string", placeholder: "Enter text", onChange: (e) => changeContent(e) }))),
@@ -34,7 +34,7 @@ const renderFreeTextColumnSummary = (data) => {
34
34
  React.createElement(Tag_1.Tag, null, (_a = data.FriendlyName) !== null && _a !== void 0 ? _a : data.ColumnId))) : null,
35
35
  React.createElement(rebass_1.Box, { mt: 3 },
36
36
  "Data Type: ",
37
- React.createElement(Tag_1.Tag, null, data.DataType)),
37
+ React.createElement(Tag_1.Tag, null, data.FreeTextColumnSettings.DataType)),
38
38
  data.DefaultValue !== undefined ? (React.createElement(rebass_1.Box, { mt: 3 },
39
39
  "Default Value: ",
40
40
  React.createElement(Tag_1.Tag, null, data.DefaultValue))) : null,
@@ -53,7 +53,7 @@ const isValidFreeTextColumn = (data, api) => {
53
53
  if (hasAlreadyExistingId) {
54
54
  return 'A Column already exists with that id';
55
55
  }
56
- if (!data.DataType) {
56
+ if (!data.FreeTextColumnSettings.DataType) {
57
57
  return 'No data type specified for column';
58
58
  }
59
59
  return true;
@@ -93,14 +93,16 @@ const FreeTextColumnSettingsWizardSection = (props) => {
93
93
  const handleDefaultValueChange = (event) => {
94
94
  let e = event.target;
95
95
  let DefaultValue = e.value;
96
- if (data.DataType === 'Date') {
96
+ if (data.FreeTextColumnSettings.DataType === 'Date') {
97
97
  DefaultValue = (0, FormatHelper_1.DateFormatter)(DefaultValue, {
98
98
  Pattern,
99
99
  });
100
100
  }
101
101
  props.onChange(Object.assign(Object.assign({}, data), { DefaultValue }));
102
102
  };
103
- const handleSpecialColumnSettingsChange = (settings) => {
103
+ const handleSpecialColumnSettingsChange = (
104
+ // settings: SpecialColumnSettings
105
+ settings) => {
104
106
  props.onChange(Object.assign(Object.assign({}, data), { FreeTextColumnSettings: Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.FreeTextColumnSettings), settings) }));
105
107
  };
106
108
  return (React.createElement(React.Fragment, null,
@@ -119,22 +121,28 @@ const FreeTextColumnSettingsWizardSection = (props) => {
119
121
  whiteSpace: 'normal',
120
122
  overflow: 'hidden',
121
123
  maxWidth: 'inherit',
122
- }, placeholder: "Select Data Type", showClearButton: !!data.DataType, onClear: () => handleDataTypeChange(null), columns: ['label'], items: options.map((item) => ({
124
+ }, placeholder: "Select Data Type", showClearButton: !!data.FreeTextColumnSettings.DataType, onClear: () => handleDataTypeChange(null), columns: ['label'], items: options.map((item) => ({
123
125
  value: item.value,
124
126
  label: item.label,
125
127
  onClick: () => handleDataTypeChange(item.value),
126
- })) }, data.DataType ? data.DataType : 'Select Data Type')),
127
- React.createElement(FormLayout_1.FormRow, { label: "Default Value" }, data.DataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": "column-default-value-checkbox", checked: !!data.DefaultValue, onChange: (DefaultValue) => {
128
+ })) }, data.FreeTextColumnSettings.DataType
129
+ ? data.FreeTextColumnSettings.DataType
130
+ : 'Select Data Type')),
131
+ React.createElement(FormLayout_1.FormRow, { label: "Default Value" }, data.FreeTextColumnSettings.DataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": "column-default-value-checkbox", checked: !!data.DefaultValue, onChange: (DefaultValue) => {
128
132
  props.onChange(Object.assign(Object.assign({}, data), { DefaultValue }));
129
- } })) : (React.createElement(AdaptableInput_1.default, { "data-name": "column-default-value", value: data.DataType === 'Date' && data.DefaultValue
133
+ } })) : (React.createElement(AdaptableInput_1.default, { "data-name": "column-default-value", value: data.FreeTextColumnSettings.DataType === 'Date' && data.DefaultValue
130
134
  ? (0, DateHelper_1.parseToISO)(data.DefaultValue, Pattern) || ''
131
- : data.DefaultValue || '', style: { width: '100%', maxWidth: 500 }, type: data.DataType === 'Number' ? 'number' : data.DataType === 'Date' ? 'date' : 'text', placeholder: "Default Column Value (not required)", onChange: (e) => handleDefaultValueChange(e) }))),
135
+ : data.DefaultValue || '', style: { width: '100%', maxWidth: 500 }, type: data.FreeTextColumnSettings.DataType === 'Number'
136
+ ? 'number'
137
+ : data.FreeTextColumnSettings.DataType === 'Date'
138
+ ? 'date'
139
+ : 'text', placeholder: "Default Column Value (not required)", onChange: (e) => handleDefaultValueChange(e) }))),
132
140
  React.createElement(FormLayout_1.FormRow, { label: "Header Tooltip" },
133
141
  React.createElement(Input_1.default, { "data-name": "header-tooltip", type: "text", style: { width: '100%', maxWidth: 500 }, value: ((_a = data.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.HeaderToolTip) || '', onChange: (e) => handleSpecialColumnSettingsChange({
134
142
  HeaderToolTip: e.target.value,
135
143
  }) })),
136
144
  ' ',
137
- data.DataType == 'String' && (React.createElement(FormLayout_1.FormRow, { label: "Editor Type" },
145
+ data.FreeTextColumnSettings.DataType == 'String' && (React.createElement(FormLayout_1.FormRow, { label: "Editor Type" },
138
146
  React.createElement(Radio_1.default, { "data-name": "inline-editor", value: "Inline", checked: data.TextEditor == 'Inline', onChange: (_, e) => onDynamicSelectChanged(e), marginRight: 2 }, "Inline Editor"),
139
147
  React.createElement(Radio_1.default, { "data-name": "large-editor", value: "Large", checked: data.TextEditor == 'Large', onChange: (_, e) => onDynamicSelectChanged(e) }, "Large Editor")))),
140
148
  ErrorMessage ? (React.createElement(ErrorBox_1.default, { mt: 2, mb: 2 }, ErrorMessage)) : null,
@@ -54,14 +54,15 @@ const getSharedEntityActiveStatusObjectView = (isDependency) => (props) => {
54
54
  if (isStaleAndActive) {
55
55
  statusInfo = (React.createElement(rebass_1.Box, { ml: 1, style: { color: 'var(--ab-color-warn)' } }, ` (Rev. ${newRevision} available)`));
56
56
  }
57
- activeInfo = (React.createElement(React.Fragment, null,
58
- `Imported Rev. ${activeRevision} ${isStaleAndActive ? 'is stale' : ''} `,
59
- " ",
57
+ activeInfo = activeRevision && (React.createElement(React.Fragment, null,
58
+ activeRevision &&
59
+ `Imported Rev. ${activeRevision} ${isStaleAndActive ? 'is stale' : ''} `,
60
+ ' ',
60
61
  statusInfo));
61
62
  }
62
63
  else {
63
64
  // snapshot
64
- activeInfo = React.createElement(React.Fragment, null, `Imported Rev. ${activeRevision}`);
65
+ activeInfo = activeRevision && React.createElement(React.Fragment, null, `Imported Rev. ${activeRevision}`);
65
66
  }
66
67
  }
67
68
  const sharedValue = `by ${sharedEntity.UserName} at ${new Date(sharedEntity.Timestamp).toLocaleString()}`;
@@ -250,7 +250,6 @@ export declare class Adaptable implements IAdaptable {
250
250
  private getColDefsForSpecialColumns;
251
251
  getColDefsForFreeTextColumns(): ColDef<any>[];
252
252
  setupColumnValueGetter({ col }: ColumnSetupInfo): void;
253
- setupColumnAggFunc({ col }: ColumnSetupInfo): void;
254
253
  private getColDefsForRowEditColumns;
255
254
  getColDefsForActionColumns(): ColDef<any>[];
256
255
  updateColDefsForSpecialColumns(): void;
@@ -351,7 +351,7 @@ class Adaptable {
351
351
  // the 'old' constructor which takes an Adaptable adaptable object
352
352
  // this is still used internally but should not be used externally as a preference
353
353
  async init(adaptableOptions, runtimeConfig, _staticInit) {
354
- var _a, _b, _c, _d, _e, _f, _g;
354
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
355
355
  if (runtimeConfig) {
356
356
  this.supressReact18RenderWarning = !!runtimeConfig.supressReact18RenderWarning;
357
357
  if (runtimeConfig.renderReactRoot) {
@@ -459,6 +459,8 @@ class Adaptable {
459
459
  abColDefObject: (_e = this.gridOptions.columnTypes.abColDefObject) !== null && _e !== void 0 ? _e : {},
460
460
  abColDefCustom: (_f = this.gridOptions.columnTypes.abColDefCustom) !== null && _f !== void 0 ? _f : {},
461
461
  abColDefNumberArray: (_g = this.gridOptions.columnTypes.abColDefNumberArray) !== null && _g !== void 0 ? _g : {},
462
+ abColDefTupleNumberArray: (_h = this.gridOptions.columnTypes.abColDefTupleNumberArray) !== null && _h !== void 0 ? _h : {},
463
+ abColDefObjectNumberArray: (_j = this.gridOptions.columnTypes.abColDefObjectNumberArray) !== null && _j !== void 0 ? _j : {},
462
464
  });
463
465
  if (this.gridOptions.columnTypes.abColDefNumber.cellEditor === undefined) {
464
466
  this.gridOptions.columnTypes.abColDefNumber.cellEditor =
@@ -603,7 +605,6 @@ class Adaptable {
603
605
  }
604
606
  }
605
607
  initializeAgGrid() {
606
- var _a;
607
608
  (0, LoggingHelper_1.LogAdaptableInfo)(`Initializing AG Grid...`);
608
609
  // set up whether we use the getRowNode method or loop when finding a rowNode (former is preferable)
609
610
  // can only do that here as the gridOptions not yet set up
@@ -611,9 +612,6 @@ class Adaptable {
611
612
  if (Array.isArray(this.gridOptions.columnDefs)) {
612
613
  this.gridOptions.columnDefs.forEach(assignColId);
613
614
  }
614
- if ((_a = this.adaptableOptions.generalOptions) === null || _a === void 0 ? void 0 : _a.hideEmptyGroupRows) {
615
- (0, LoggingHelper_1.ConsoleLogWarning)(`DEPRECATED: 'GeneralOptions.hideEmptyGroupRows' is deprecated and will no longer be evaluated!`);
616
- }
617
615
  const adaptableSideBarDef = this.createAdaptableSideBarDef();
618
616
  if (!!adaptableSideBarDef) {
619
617
  this.gridOptions.components = this.gridOptions.components || {};
@@ -1446,9 +1444,12 @@ class Adaptable {
1446
1444
  shouldUpdateHeaders = this.setupColumnHeader(colSetupInfo) || shouldUpdateHeaders;
1447
1445
  });
1448
1446
  isChanged = isChanged || shouldUpdateHeaders;
1449
- if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(layout.ColumnFilters)) {
1450
- this.gridOptions.api.onFilterChanged();
1451
- }
1447
+ // this is NOT really needed?!
1448
+ // without it everything seem to still work as expected
1449
+ // and the setLayout() execution time is shorter, so a double win
1450
+ // if (ArrayExtensions.IsNotNullOrEmpty(layout.ColumnFilters)) {
1451
+ // this.gridOptions.api!.onFilterChanged();
1452
+ // }
1452
1453
  if (isChanged) {
1453
1454
  // it's important we set pivot mode
1454
1455
  // before we set column state
@@ -2191,14 +2192,14 @@ class Adaptable {
2191
2192
  return this.api.freeTextColumnApi.getFreeTextColumns().map((freeTextColumn) => {
2192
2193
  var _a;
2193
2194
  const freeTextColumnSettings = Object.assign(Object.assign({}, defaultFreeTextColumnSettings), freeTextColumn.FreeTextColumnSettings);
2194
- const dataTypeEditor = freeTextColumn.DataType === 'Number'
2195
+ const dataTypeEditor = freeTextColumnSettings.DataType === 'Number'
2195
2196
  ? AdaptableNumberEditor_1.AdaptableNumberEditor
2196
- : freeTextColumn.DataType === 'Date'
2197
+ : freeTextColumnSettings.DataType === 'Date'
2197
2198
  ? AdaptableDateEditor_1.AdaptableDateEditor
2198
2199
  : null;
2199
2200
  const columnTypes = [
2200
2201
  GeneralConstants_1.AB_SPECIAL_COLUMN,
2201
- this.agGridHelper.getAgGridDataType(freeTextColumn.DataType),
2202
+ this.agGridHelper.getAgGridDataType(freeTextColumnSettings.DataType),
2202
2203
  ];
2203
2204
  if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty((_a = freeTextColumn === null || freeTextColumn === void 0 ? void 0 : freeTextColumn.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.ColumnTypes)) {
2204
2205
  columnTypes.push(...freeTextColumn.FreeTextColumnSettings.ColumnTypes);
@@ -2225,7 +2226,7 @@ class Adaptable {
2225
2226
  valueSetter: (params) => {
2226
2227
  return (params.data[freeTextColumn.ColumnId] = params.newValue);
2227
2228
  },
2228
- cellRenderer: freeTextColumn.DataType && freeTextColumn.DataType == 'Boolean'
2229
+ cellRenderer: freeTextColumnSettings.DataType && freeTextColumnSettings.DataType == 'Boolean'
2229
2230
  ? this.agGridHelper.createCheckboxRendererComp(freeTextColumn.ColumnId, false)
2230
2231
  : undefined,
2231
2232
  valueGetter: (params) => this.api.freeTextColumnApi.getFreeTextColumnValueForRowNode(freeTextColumn, params.node),
@@ -2243,16 +2244,6 @@ class Adaptable {
2243
2244
  return userValue;
2244
2245
  });
2245
2246
  }
2246
- setupColumnAggFunc({ col }) {
2247
- // need this here if we want plugins to intercept
2248
- const financeApi = this.api.pluginsApi.getFinancePluginApi();
2249
- // the 'aggFunc' slows significantly the init process, so we evaluate it only if it is really necessary: iff we have a weighted average defined
2250
- if (financeApi && !!financeApi.getPluginOptions().weightedAverageColumns) {
2251
- this.setColDefProperty(col, 'aggFunc', (userValue) => {
2252
- return userValue;
2253
- });
2254
- }
2255
- }
2256
2247
  getColDefsForRowEditColumns() {
2257
2248
  const actionRowButtons = this.api.actionApi.getActionRowButtons();
2258
2249
  if (!(actionRowButtons === null || actionRowButtons === void 0 ? void 0 : actionRowButtons.length)) {
@@ -3098,7 +3089,6 @@ class Adaptable {
3098
3089
  this.setupColumnCellClass(colSetupInfo);
3099
3090
  this.setupColumnTooltipValueGetter(colSetupInfo);
3100
3091
  this.setupColumnValueGetter(colSetupInfo);
3101
- this.setupColumnAggFunc(colSetupInfo);
3102
3092
  this.setupColumnFilter(colSetupInfo);
3103
3093
  this.setupColumnFloatingFilter(colSetupInfo);
3104
3094
  this.setupColumnValueFormatter(colSetupInfo);
@@ -4749,7 +4739,8 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4749
4739
  let rawValue = rowNode.key;
4750
4740
  if (this.api.columnApi.getColumnDataTypeForColumnId(columnId) === 'Date' &&
4751
4741
  typeof rawValue === 'string' &&
4752
- !Number.isNaN(rawValue)) {
4742
+ // rawValue is composed only of digits
4743
+ /^\d+$/.test(rawValue)) {
4753
4744
  // AG-Grid converts the value to string, we have to reconvert it back
4754
4745
  const dateRawValue = parseInt(rawValue);
4755
4746
  if (dateRawValue != undefined) {
@@ -24,6 +24,28 @@ const ExpressionFunctionDocumentation_1 = require("./ExpressionFunctionDocumenta
24
24
  const Tag_1 = require("../Tag");
25
25
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
26
26
  const Radio_1 = tslib_1.__importDefault(require("../Radio"));
27
+ const filterableCategories = [
28
+ 'dates',
29
+ 'logical',
30
+ 'maths',
31
+ 'strings',
32
+ 'comparison',
33
+ 'observable',
34
+ 'aggregation',
35
+ 'cumulative',
36
+ ];
37
+ const getCategoryOrder = (category) => {
38
+ const predefinedOrder = {
39
+ special: 1,
40
+ conditional: 2,
41
+ logical: 3,
42
+ comparison: 4,
43
+ strings: 5,
44
+ maths: 6,
45
+ dates: 7,
46
+ };
47
+ return predefinedOrder[category] || 0;
48
+ };
27
49
  const VarEditorButton = () => {
28
50
  var _a, _b;
29
51
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
@@ -59,18 +81,23 @@ const FunctionsDropdown = ({ expressionFunctions, baseClassName }) => {
59
81
  return acc;
60
82
  }, { noCategory: {} });
61
83
  }, [currentFunctionCategory]);
84
+ const orderedGroupNames = React.useMemo(() => {
85
+ return Object.keys(groupedFunctions).sort((first, second) => getCategoryOrder(first) - getCategoryOrder(second));
86
+ }, [groupedFunctions]);
62
87
  const handleFunctionCategoryChange = React.useCallback((type) => (event) => {
63
88
  setCurrentFunctionCategory(type);
64
89
  }, [currentFunctionCategory]);
65
90
  const categoryOptions = React.useMemo(() => {
66
91
  const categoryOptions = Object.keys(expressionFunctions)
67
92
  .reduce((acc, functionName) => {
68
- const funcitonExpression = expressionFunctions[functionName];
69
- if (!acc.includes(funcitonExpression.category)) {
70
- acc.push(funcitonExpression.category);
93
+ const functionExpression = expressionFunctions[functionName];
94
+ if (!acc.includes(functionExpression.category)) {
95
+ acc.push(functionExpression.category);
71
96
  }
72
97
  return acc;
73
98
  }, [])
99
+ .filter((category) => filterableCategories.includes(category))
100
+ .sort((first, second) => getCategoryOrder(first) - getCategoryOrder(second))
74
101
  .map((category) => ({
75
102
  label: StringExtensions_1.default.Humanize(category),
76
103
  value: category,
@@ -87,23 +114,31 @@ const FunctionsDropdown = ({ expressionFunctions, baseClassName }) => {
87
114
  * - a function is inserted
88
115
  */
89
116
  return (React.createElement(OverlayTrigger_1.default, { ref: dropdownRef, showEvent: "mouseenter", hideEvent: "mouseleave", targetOffset: 5, render: () => (React.createElement(rebass_1.Flex, { className: `${baseClassName}__dropdown-functions-list-wrapper`, flexDirection: "column", onMouseLeave: () => hidePopup() },
90
- React.createElement(rebass_1.Flex, { pl: 2, style: { gap: 10 } }, categoryOptions.map((option) => {
91
- return (React.createElement(Radio_1.default, { onFocus: (event) => {
117
+ React.createElement(rebass_1.Flex, { pl: 2, style: { gap: 10 } }, categoryOptions.map((option, index) => {
118
+ return (React.createElement(Radio_1.default, { key: option.value, onFocus: (event) => {
92
119
  event.preventDefault();
93
120
  event.stopPropagation();
94
121
  }, onClick: handleFunctionCategoryChange(option.value), checked: currentFunctionCategory === option.value }, option.label));
95
122
  })),
96
123
  React.createElement(rebass_1.Flex, null,
97
- React.createElement(rebass_1.Flex, { className: `${baseClassName}__dropdown-functions-list`, "data-name": "expression-dropdown-fuctions-list", flexDirection: "column", p: 2, maxHeight: '50vh' }, Object.keys(groupedFunctions).map((groupName) => {
124
+ React.createElement(rebass_1.Flex, { className: `${baseClassName}__dropdown-functions-list`, "data-name": "expression-dropdown-fuctions-list", flexDirection: "column", p: 2, maxHeight: '50vh' }, orderedGroupNames
125
+ .filter((groupName) => !!groupedFunctions[groupName])
126
+ .map((groupName) => {
98
127
  const functionsInGroup = Object.keys(groupedFunctions[groupName]);
99
128
  if (functionsInGroup.length === 0) {
100
- return React.createElement(React.Fragment, null);
129
+ return React.createElement(React.Fragment, { key: groupName });
101
130
  }
102
131
  const getEditorButtonData = (functionName) => {
103
132
  // handle special cases
104
133
  if (functionName === 'CASE') {
105
134
  return `CASE <caseValue> WHEN <whenValue> THEN <thenValue> ELSE <defaultValue> END`;
106
135
  }
136
+ if (functionName === 'TRUE' || functionName === 'FALSE') {
137
+ return functionName;
138
+ }
139
+ if (functionName === 'IF') {
140
+ return `<condition_expr> ? <consequent_expr> : <alternative_expr>`;
141
+ }
107
142
  return `${functionName}()`;
108
143
  };
109
144
  return (React.createElement(rebass_1.Box, { mb: 2, key: groupName },
@@ -7,6 +7,11 @@ exports.editorButtonsCumulativeAggregatedScalar = [
7
7
  data: 'CUMUL()',
8
8
  text: 'Cumulate',
9
9
  },
10
+ {
11
+ functionName: 'OVER',
12
+ data: 'OVER()',
13
+ text: 'Over',
14
+ },
10
15
  {
11
16
  functionName: 'SUM',
12
17
  data: 'SUM()',
@@ -32,11 +37,6 @@ exports.editorButtonsCumulativeAggregatedScalar = [
32
37
  data: 'MAX()',
33
38
  text: 'Max',
34
39
  },
35
- {
36
- functionName: 'OVER',
37
- data: 'OVER()',
38
- text: 'Over',
39
- },
40
40
  {
41
41
  functionName: 'WEIGHT',
42
42
  data: 'WEIGHT()',
@@ -2,6 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.editorButtonsSearch = void 0;
4
4
  exports.editorButtonsSearch = [
5
+ {
6
+ functionName: 'AND',
7
+ data: 'AND',
8
+ },
9
+ {
10
+ functionName: 'OR',
11
+ data: 'OR',
12
+ },
5
13
  {
6
14
  functionName: 'ADD',
7
15
  data: '+',
@@ -62,16 +70,4 @@ exports.editorButtonsSearch = [
62
70
  data: '>=',
63
71
  icon: 'greater-than-or-equal',
64
72
  },
65
- {
66
- functionName: 'AND',
67
- data: 'AND',
68
- },
69
- {
70
- functionName: 'OR',
71
- data: 'OR',
72
- },
73
- {
74
- functionName: 'IN',
75
- data: 'IN',
76
- },
77
73
  ];