@adaptabletools/adaptable-cjs 18.0.11 → 18.1.0-canary.0

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 (126) hide show
  1. package/agGrid.d.ts +4 -3
  2. package/agGrid.js +6 -1
  3. package/base.css +7 -2
  4. package/base.css.map +1 -1
  5. package/index.css +11 -2
  6. package/index.css.map +1 -1
  7. package/package.json +2 -2
  8. package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
  9. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +27 -1
  10. package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
  11. package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
  12. package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
  13. package/src/Api/ColumnApi.d.ts +1 -1
  14. package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
  15. package/src/Api/ExpressionApi.d.ts +2 -2
  16. package/src/Api/Fdc3Api.d.ts +14 -19
  17. package/src/Api/Implementation/ConfigApiImpl.js +3 -0
  18. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
  19. package/src/Api/Implementation/Fdc3ApiImpl.js +35 -11
  20. package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
  21. package/src/Api/Internal/AlertInternalApi.js +196 -25
  22. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
  23. package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
  24. package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
  25. package/src/Api/Internal/ExportInternalApi.js +31 -17
  26. package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
  27. package/src/Api/Internal/ExpressionInternalApi.js +80 -0
  28. package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
  29. package/src/Api/Internal/Fdc3InternalApi.js +5 -9
  30. package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
  31. package/src/PredefinedConfig/Common/AdaptableField.js +2 -0
  32. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  33. package/src/PredefinedConfig/Common/AdaptablePredicate.js +18 -1
  34. package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
  35. package/src/PredefinedConfig/Common/Fdc3Context.js +44 -32
  36. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
  37. package/src/PredefinedConfig/Common/Fdc3Intent.js +27 -74
  38. package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
  39. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  40. package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
  41. package/src/Strategy/AdaptableModuleBase.js +1 -3
  42. package/src/Strategy/AlertModule.d.ts +1 -1
  43. package/src/Strategy/AlertModule.js +8 -8
  44. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
  45. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +14 -13
  46. package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
  47. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  48. package/src/Utilities/Services/QueryLanguageService.js +105 -6
  49. package/src/Utilities/Services/ReportService.js +8 -5
  50. package/src/Utilities/Services/RowSummaryService.js +3 -1
  51. package/src/Utilities/divideBy100.d.ts +1 -0
  52. package/src/Utilities/divideBy100.js +34 -0
  53. package/src/Utilities/times100.d.ts +1 -0
  54. package/src/Utilities/times100.js +27 -0
  55. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
  56. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
  57. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
  58. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  59. package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
  60. package/src/View/Components/EntityRulesEditor/index.js +11 -7
  61. package/src/View/Components/ExpressionWizard.js +1 -1
  62. package/src/View/Components/FilterForm/QuickFilterValues.js +28 -4
  63. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
  64. package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
  65. package/src/View/Components/Selectors/FieldSelector.js +26 -0
  66. package/src/View/Components/Selectors/PermittedValuesSelector.js +8 -4
  67. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  68. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  69. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  70. package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
  71. package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
  72. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  73. package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
  74. package/src/agGrid/AdaptableAgGrid.d.ts +1 -2
  75. package/src/agGrid/AdaptableAgGrid.js +65 -37
  76. package/src/agGrid/AgGridAdapter.d.ts +2 -0
  77. package/src/agGrid/AgGridAdapter.js +12 -2
  78. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
  79. package/src/agGrid/AgGridColumnAdapter.js +24 -1
  80. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  81. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
  82. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
  83. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
  84. package/src/agGrid/editors/AdaptableDateEditor/index.js +6 -19
  85. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
  86. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
  87. package/src/agGrid/editors/AdaptableNumberEditor/index.js +6 -2
  88. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
  89. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +84 -0
  90. package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
  91. package/src/agGrid/editors/AdaptablePercentageEditor/index.js +153 -0
  92. package/src/agGrid/weightedAverage.js +3 -2
  93. package/src/components/Accordion.js +1 -1
  94. package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
  95. package/src/components/Datepicker/index.js +3 -4
  96. package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
  97. package/src/components/ExpressionEditor/DataTableEditor.js +68 -0
  98. package/src/components/ExpressionEditor/EditorInput.js +21 -8
  99. package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
  100. package/src/components/ExpressionEditor/NamedQueryEditor.js +35 -0
  101. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
  102. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
  103. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
  104. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +72 -14
  105. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +27 -19
  106. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
  107. package/src/components/ExpressionEditor/QueryBuilder/utils.js +46 -4
  108. package/src/components/ExpressionEditor/index.d.ts +3 -1
  109. package/src/components/ExpressionEditor/index.js +67 -92
  110. package/src/components/Input/NumberInput.d.ts +2 -1
  111. package/src/components/Input/NumberInput.js +6 -5
  112. package/src/components/OverlayTrigger/index.js +10 -6
  113. package/src/components/icons/column-outline.d.ts +3 -0
  114. package/src/components/icons/column-outline.js +7 -0
  115. package/src/components/icons/index.js +5 -1
  116. package/src/components/icons/sync.d.ts +3 -0
  117. package/src/components/icons/sync.js +7 -0
  118. package/src/env.js +2 -2
  119. package/src/metamodel/adaptable.metamodel.d.ts +78 -200
  120. package/src/metamodel/adaptable.metamodel.js +1 -1
  121. package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
  122. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +13 -3
  123. package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
  124. package/src/parser/src/types.d.ts +101 -1
  125. package/src/types.d.ts +9 -7
  126. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InternalAdaptablePercentageEditor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const icons_1 = require("../../../components/icons");
7
+ const useProperty_1 = tslib_1.__importDefault(require("../../../components/utils/useProperty"));
8
+ const NumberInput_1 = require("../../../components/Input/NumberInput");
9
+ const fillStyle = {
10
+ position: 'absolute',
11
+ left: 0,
12
+ top: 0,
13
+ right: 0,
14
+ bottom: 0,
15
+ };
16
+ const hostStyle = Object.assign(Object.assign({}, fillStyle), { boxSizing: 'border-box', display: 'flex', flexDirection: 'row', alignItems: 'center' });
17
+ const inputStyle = {
18
+ position: 'relative',
19
+ background: 'transparent',
20
+ boxSizing: 'border-box',
21
+ color: 'currentcolor',
22
+ minWidth: 0,
23
+ outline: 'none',
24
+ textAlign: 'right',
25
+ width: '100%',
26
+ border: 'none',
27
+ boxShadow: 'none',
28
+ paddingRight: '3ch',
29
+ };
30
+ exports.InternalAdaptablePercentageEditor = React.forwardRef(function InternalAdaptablePercentageEditorFn(props, ref) {
31
+ var _a;
32
+ const inputRef = React.useRef(null);
33
+ const focus = () => {
34
+ var _a;
35
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
36
+ };
37
+ const [value, setValue] = (0, useProperty_1.default)(props, 'value', props.defaultValue, {
38
+ onChange: (value) => {
39
+ var _a;
40
+ if (value !== '' && value == Number(value)) {
41
+ value = Number(value);
42
+ }
43
+ (_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, value);
44
+ },
45
+ });
46
+ React.useImperativeHandle(ref, () => {
47
+ return {
48
+ focus,
49
+ setValue,
50
+ };
51
+ });
52
+ const showClear = props.showClearButton && props.emptyValue != null && value != props.emptyValue;
53
+ return (React.createElement("div", { style: hostStyle, className: "ab-PercentageEditor", onKeyDown: (e) => {
54
+ if (e.key === 'Tab' && showClear && document.activeElement === inputRef.current) {
55
+ e.stopPropagation();
56
+ }
57
+ } },
58
+ React.createElement(NumberInput_1.NumberInput, { type: (_a = props.type) !== null && _a !== void 0 ? _a : 'number', className: "ab-PercentageEditor-Input", value: value, noArrows: true, autoFocus: true, onChange: React.useCallback((value) => {
59
+ setValue(value);
60
+ }, []), style: inputStyle, ref: inputRef }),
61
+ showClear ? (React.createElement("div", { style: {
62
+ display: 'inline-block',
63
+ marginRight: 'var(--ab-space-1)',
64
+ marginLeft: 'var(--ab-space-1)',
65
+ }, onClick: (e) => {
66
+ if (props.emptyValue != null) {
67
+ setValue(props.emptyValue);
68
+ e.stopPropagation();
69
+ focus();
70
+ }
71
+ }, onKeyDown: (e) => {
72
+ if (props.emptyValue != null && e.key === 'Enter') {
73
+ setValue(props.emptyValue);
74
+ e.stopPropagation();
75
+ focus();
76
+ }
77
+ } },
78
+ React.createElement(icons_1.Icon, { size: 18, name: "close", tabIndex: 0 }))) : null,
79
+ React.createElement("div", { style: {
80
+ position: 'absolute',
81
+ right: showClear ? 20 : 0,
82
+ paddingInlineEnd: '0.5ch',
83
+ } }, "%")));
84
+ });
@@ -0,0 +1,47 @@
1
+ import * as React from 'react';
2
+ import { ICellEditorComp } from '@ag-grid-community/core';
3
+ import { AdaptableNumberCellEditorParams } from '../AdaptableNumberEditor';
4
+ /**
5
+ * Adaptable percentage editor parameters extending the number editor params.
6
+ */
7
+ export interface AdaptablePercentageCellEditorParams extends AdaptableNumberCellEditorParams {
8
+ }
9
+ export declare const AdaptableReactPercentageEditor: React.ForwardRefExoticComponent<AdaptablePercentageCellEditorParams & React.RefAttributes<unknown>>;
10
+ /**
11
+ * Used by default for all `abColDefNumber` columns.
12
+ *
13
+ * You can configure it by specifying `cellEditorParams` in the colDef:
14
+ *
15
+ * colDef {
16
+ * field: 'stars',
17
+ * type: 'abColDefNumber',
18
+ * cellEditorParams: {
19
+ * emptyValue: 5, // defaults to ''
20
+ * showClearButton: false
21
+ * }
22
+ * }
23
+ *
24
+ * For now, there are 2 editor params you can configure:
25
+ *
26
+ * cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button. If `true`, it works together with `cellEditorParams.emptyValue`
27
+ * cellEditorParams.emptyValue - defaults to `''` (empty string) - value to set for the cell, when the clear button is pressed.
28
+ *
29
+ * When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
30
+ */
31
+ export declare class AdaptablePercentageEditor implements ICellEditorComp {
32
+ private value;
33
+ private columnId;
34
+ private el;
35
+ private params;
36
+ private editor;
37
+ private valueParser;
38
+ private unmountReactRoot?;
39
+ init(params: AdaptablePercentageCellEditorParams): void;
40
+ getGui(): HTMLDivElement;
41
+ getValue(): any;
42
+ focusIn(): void;
43
+ focusOut(): void;
44
+ afterGuiAttached(): void;
45
+ destroy(): void;
46
+ private onValueChange;
47
+ }
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdaptablePercentageEditor = exports.AdaptableReactPercentageEditor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const renderWithAdaptableContext_1 = require("../../../View/renderWithAdaptableContext");
7
+ const InternalAdaptablePercentageEditor_1 = require("./InternalAdaptablePercentageEditor");
8
+ const react_1 = require("react");
9
+ const AdaptableNumberEditor_1 = require("../AdaptableNumberEditor");
10
+ const times100_1 = require("../../../Utilities/times100");
11
+ const divideBy100_1 = require("../../../Utilities/divideBy100");
12
+ const defaultValueParser = ({ newValue, oldValue: _ }) => {
13
+ return newValue;
14
+ };
15
+ const style = {
16
+ position: 'absolute',
17
+ top: '0px',
18
+ left: '0px',
19
+ right: '0px',
20
+ bottom: '0px',
21
+ };
22
+ exports.AdaptableReactPercentageEditor = (0, react_1.forwardRef)((props, ref) => {
23
+ var _a, _b;
24
+ const [initialValue] = (0, react_1.useState)(() => (0, times100_1.times100)((0, AdaptableNumberEditor_1.getStartValue)(props)));
25
+ const valueRef = (0, react_1.useRef)(initialValue);
26
+ const columnId = props.column.getColId();
27
+ const adaptable = props.context.__adaptable;
28
+ const colValueParser = props.column.getColDef().valueParser;
29
+ const valueParser = typeof colValueParser === 'function' ? colValueParser : defaultValueParser;
30
+ function onValueChange(value) {
31
+ var _a;
32
+ const newValue = valueParser
33
+ ? valueParser(Object.assign(Object.assign({}, props), { oldValue: props.value, newValue: value }))
34
+ : value;
35
+ valueRef.current = newValue;
36
+ (_a = props.onValueChange) === null || _a === void 0 ? void 0 : _a.call(props, (0, divideBy100_1.divideBy100)(newValue));
37
+ }
38
+ const editorRef = (0, react_1.useRef)(null);
39
+ (0, react_1.useImperativeHandle)(ref, () => {
40
+ return {
41
+ focusIn() {
42
+ var _a;
43
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
44
+ },
45
+ // the final value to send to the grid, on completion of editing
46
+ getValue() {
47
+ return (0, divideBy100_1.divideBy100)(valueRef.current);
48
+ },
49
+ };
50
+ });
51
+ const editorElement = (React.createElement(InternalAdaptablePercentageEditor_1.InternalAdaptablePercentageEditor, { defaultValue: initialValue, showClearButton: (_a = props.showClearButton) !== null && _a !== void 0 ? _a : true, emptyValue: (_b = props.emptyValue) !== null && _b !== void 0 ? _b : '', onValueChange: onValueChange, ref: (editor) => {
52
+ editorRef.current = editor;
53
+ editor === null || editor === void 0 ? void 0 : editor.focus();
54
+ } }));
55
+ function onKeyDown(keyDownEvent) {
56
+ adaptable._emit('CellEditorKeyDown', {
57
+ keyDownEvent,
58
+ cellValue: valueRef.current,
59
+ columnId,
60
+ updateValueCallback: (updatedValue) => {
61
+ editorRef.current.setValue(updatedValue);
62
+ },
63
+ });
64
+ }
65
+ return (React.createElement("div", { style: style, onKeyDown: onKeyDown }, (0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable)));
66
+ });
67
+ exports.AdaptableReactPercentageEditor.displayName = 'AdaptableReactPercentageEditor';
68
+ /**
69
+ * Used by default for all `abColDefNumber` columns.
70
+ *
71
+ * You can configure it by specifying `cellEditorParams` in the colDef:
72
+ *
73
+ * colDef {
74
+ * field: 'stars',
75
+ * type: 'abColDefNumber',
76
+ * cellEditorParams: {
77
+ * emptyValue: 5, // defaults to ''
78
+ * showClearButton: false
79
+ * }
80
+ * }
81
+ *
82
+ * For now, there are 2 editor params you can configure:
83
+ *
84
+ * cellEditorParams.showClearButton - defaults to `true` - whether to show the clear button. If `true`, it works together with `cellEditorParams.emptyValue`
85
+ * cellEditorParams.emptyValue - defaults to `''` (empty string) - value to set for the cell, when the clear button is pressed.
86
+ *
87
+ * When the colDef has a `valueParser` provided as a function, it will be used before setting the value for the cell.
88
+ */
89
+ class AdaptablePercentageEditor {
90
+ constructor() {
91
+ this.valueParser = defaultValueParser;
92
+ this.onValueChange = (value) => {
93
+ const newValue = this.valueParser
94
+ ? this.valueParser(Object.assign(Object.assign({}, this.params), { oldValue: this.params.value, newValue: value }))
95
+ : value;
96
+ this.value = (0, divideBy100_1.divideBy100)(newValue);
97
+ };
98
+ }
99
+ init(params) {
100
+ this.value = (0, AdaptableNumberEditor_1.getStartValue)(params);
101
+ this.params = params;
102
+ this.columnId = params.column.getColId();
103
+ const { valueParser } = params.column.getColDef();
104
+ if (typeof valueParser === 'function') {
105
+ this.valueParser = valueParser;
106
+ }
107
+ this.el = document.createElement('div');
108
+ Object.keys(style).forEach((key) => {
109
+ //@ts-ignore
110
+ this.el.style[key] = style[key];
111
+ });
112
+ }
113
+ /* Component Editor Lifecycle methods */
114
+ // gets called once when grid ready to insert the element
115
+ getGui() {
116
+ return this.el;
117
+ }
118
+ // the final value to send to the grid, on completion of editing
119
+ getValue() {
120
+ return this.value;
121
+ }
122
+ focusIn() {
123
+ var _a;
124
+ (_a = this.editor) === null || _a === void 0 ? void 0 : _a.focus();
125
+ }
126
+ focusOut() { }
127
+ // after this component has been created and inserted into the grid
128
+ afterGuiAttached() {
129
+ var _a, _b;
130
+ const adaptable = this.params.context.__adaptable;
131
+ const defaultValue = (0, times100_1.times100)(this.value);
132
+ const editorElement = (React.createElement(InternalAdaptablePercentageEditor_1.InternalAdaptablePercentageEditor, { defaultValue: defaultValue, showClearButton: (_a = this.params.showClearButton) !== null && _a !== void 0 ? _a : true, emptyValue: (_b = this.params.emptyValue) !== null && _b !== void 0 ? _b : '', onValueChange: this.onValueChange, ref: (editor) => {
133
+ this.editor = editor;
134
+ editor === null || editor === void 0 ? void 0 : editor.focus();
135
+ } }));
136
+ this.unmountReactRoot = adaptable.renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(editorElement, adaptable), this.el);
137
+ this.getGui().addEventListener('keydown', (keyDownEvent) => {
138
+ adaptable._emit('CellEditorKeyDown', {
139
+ keyDownEvent,
140
+ cellValue: this.value,
141
+ columnId: this.columnId,
142
+ updateValueCallback: (updatedValue) => {
143
+ this.editor.setValue(updatedValue);
144
+ },
145
+ });
146
+ });
147
+ }
148
+ destroy() {
149
+ var _a;
150
+ (_a = this.unmountReactRoot) === null || _a === void 0 ? void 0 : _a.call(this);
151
+ }
152
+ }
153
+ exports.AdaptablePercentageEditor = AdaptablePercentageEditor;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.weightedAverage = exports.getNumericValue = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const toNumber_1 = tslib_1.__importDefault(require("lodash/toNumber"));
6
+ const AgGridAdapter_1 = require("./AgGridAdapter");
6
7
  const getNumericValue = (input) => {
7
8
  if (typeof input === 'number') {
8
9
  return input;
@@ -18,9 +19,9 @@ const weightedAverage = (params, columnId, weightColumnId) => {
18
19
  // TODO AFL: improve performance by using the intermediary aggregated values (for nested groups)
19
20
  groupRowNode.allLeafChildren.forEach((rowNode) => {
20
21
  // when editing values might be converted to strings
21
- const rawColumnValue = gridApi.getValue(columnId, rowNode);
22
+ const rawColumnValue = (0, AgGridAdapter_1._agGridApi_getValue)(columnId, rowNode, gridApi);
22
23
  const columnValue = (0, exports.getNumericValue)(rawColumnValue);
23
- const rawWeightedColumnValue = gridApi.getValue(weightColumnId, rowNode);
24
+ const rawWeightedColumnValue = (0, AgGridAdapter_1._agGridApi_getValue)(weightColumnId, rowNode, gridApi);
24
25
  const weightedColumnValue = (0, exports.getNumericValue)(rawWeightedColumnValue);
25
26
  if (weightedColumnValue !== null) {
26
27
  weightedColumnValueSum += weightedColumnValue;
@@ -30,7 +30,7 @@ const Accordion = ({ title, children }) => {
30
30
  setIsOpen(!isOpen);
31
31
  };
32
32
  return (react_1.default.createElement(Panel_1.default, { className: "ab-Accordion" },
33
- react_1.default.createElement(SimpleButton_1.default, { iconPosition: 'end', icon: isOpen ? 'expand-all' : 'collapse-all', variant: "text", onClick: toggleAccordion, style: { width: '100%', textAlign: 'left' } }, title),
33
+ react_1.default.createElement(SimpleButton_1.default, { iconPosition: "end", icon: isOpen ? 'expand-all' : 'collapse-all', variant: "text", onClick: toggleAccordion, style: { width: '100%', textAlign: 'left' } }, title),
34
34
  react_1.default.createElement("div", { ref: content, style: {
35
35
  maxHeight: `${height}`,
36
36
  overflow: 'hidden',
@@ -2,10 +2,8 @@ import * as React from 'react';
2
2
  export declare const DatepickerContext: React.Context<{
3
3
  onHide?: (keyboardEventKey?: string) => void;
4
4
  onShow?: VoidFunction;
5
- showClearButton?: boolean;
6
5
  }>;
7
6
  export declare const useDatepickerContext: () => {
8
7
  onHide?: (keyboardEventKey?: string) => void;
9
8
  onShow?: VoidFunction;
10
- showClearButton?: boolean;
11
9
  };
@@ -37,9 +37,8 @@ const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, }) => {
37
37
  };
38
38
  exports.Datepicker = React.forwardRef((props, ref) => {
39
39
  var _a;
40
- const { dateProps, required, disabled, style, placeholder, showWeekNumber, showOutsideDays, value: _, defaultValue: __, onChange: ___, showClearButton: showClearButtonFromProps, datepickerButtons } = props, boxProps = tslib_1.__rest(props, ["dateProps", "required", "disabled", "style", "placeholder", "showWeekNumber", "showOutsideDays", "value", "defaultValue", "onChange", "showClearButton", "datepickerButtons"]);
40
+ const { dateProps, required, disabled, style, placeholder, showWeekNumber, showOutsideDays, value: _, defaultValue: __, onChange: ___, datepickerButtons } = props, boxProps = tslib_1.__rest(props, ["dateProps", "required", "disabled", "style", "placeholder", "showWeekNumber", "showOutsideDays", "value", "defaultValue", "onChange", "datepickerButtons"]);
41
41
  const datepickerContext = (0, DatepickerContext_1.useDatepickerContext)();
42
- const showClearButton = (showClearButtonFromProps !== null && showClearButtonFromProps !== void 0 ? showClearButtonFromProps : datepickerContext.showClearButton) === false ? false : true;
43
42
  let [value, setValue] = (0, useProperty_1.default)(props, 'value', undefined, {
44
43
  onChange: props.onChange,
45
44
  });
@@ -82,10 +81,10 @@ exports.Datepicker = React.forwardRef((props, ref) => {
82
81
  '|': React.createElement("hr", { style: { width: '100%', height: 0, margin: 0, border: 'none' } }),
83
82
  };
84
83
  const footerButtons = datepickerButtons.map((buttonKey, index) => React.cloneElement(footerButtonsMap[buttonKey], { key: index }));
85
- const clearButton = showClearButton ? (React.createElement(SimpleButton_1.default, { "data-name": "clear", variant: "text", tooltip: "Clear", iconSize: 20, padding: 0, icon: "close", onMouseDown: (e) => {
84
+ const clearButton = (React.createElement(SimpleButton_1.default, { "data-name": "clear", variant: "text", tooltip: "Clear", iconSize: 20, padding: 0, icon: "close", onMouseDown: (e) => {
86
85
  e.preventDefault();
87
86
  clearValue();
88
- }, accessLevel: 'Full' })) : null;
87
+ }, accessLevel: 'Full' }));
89
88
  const calendarButton = (React.createElement(SimpleButton_1.default, { disabled: disabled, variant: "text", icon: "calendar", tooltip: "Date", iconSize: 20, px: 0, py: 0, onClick: () => setVisible(true) }));
90
89
  return (React.createElement(rebass_1.Flex, null,
91
90
  React.createElement(OverlayTrigger_1.default, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { onMouseDown: props.onMouseDown, onHide: () => setVisible(false), onKeyDown: (e) => {
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { AdaptableColumnDataType } from '../../types';
3
+ export declare const DataTableEditor: ({ fields, dataFormatter, data: initialData, type, labels, }: {
4
+ fields: {
5
+ label: string;
6
+ value: string;
7
+ dataType: AdaptableColumnDataType;
8
+ readOnly?: boolean;
9
+ }[];
10
+ type: string;
11
+ dataFormatter: (field: string) => string;
12
+ data: any;
13
+ labels?: {
14
+ showIds?: string;
15
+ filterPlaceholder?: string;
16
+ };
17
+ }) => JSX.Element;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataTableEditor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const _1 = require(".");
8
+ const CheckBox_1 = require("../CheckBox");
9
+ const AdaptableFormControlTextClear_1 = require("../../View/Components/Forms/AdaptableFormControlTextClear");
10
+ const FormLayout_1 = tslib_1.__importStar(require("../FormLayout"));
11
+ const EditorButton_1 = tslib_1.__importDefault(require("./EditorButton"));
12
+ const Input_1 = tslib_1.__importDefault(require("../Input"));
13
+ const DateHelper_1 = require("../../Utilities/Helpers/DateHelper");
14
+ const AdaptableContext_1 = require("../../View/AdaptableContext");
15
+ const AdaptableInput_1 = tslib_1.__importDefault(require("../../View/Components/AdaptableInput"));
16
+ const DataTableEditor = ({ fields, dataFormatter, data: initialData, type = 'column', labels, }) => {
17
+ var _a, _b;
18
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
19
+ const [data, setData] = React.useState(initialData);
20
+ const [showColumnIds, setShowValues] = React.useState(false);
21
+ const [searchInputValue, setSearchInputValue] = React.useState('');
22
+ const getColValue = (fieldValue) => {
23
+ return adaptable.api.internalApi.getValueUsingField(data, fieldValue);
24
+ };
25
+ const updateColValue = (rowData, fielValue, newValue) => {
26
+ const updatedRowData = adaptable.api.internalApi.setValueUsingField(rowData, fielValue, newValue);
27
+ return Object.assign({}, updatedRowData);
28
+ };
29
+ const getColDateValue = (fieldValue) => {
30
+ const colValue = getColValue(fieldValue);
31
+ return colValue && (0, DateHelper_1.isValueValidDate)(colValue)
32
+ ? new Date(colValue).toISOString().substr(0, 10)
33
+ : '';
34
+ };
35
+ const hasFriendlyNames = React.useMemo(() => {
36
+ return fields.some((field) => field.label !== field.value);
37
+ }, []);
38
+ return (React.createElement(rebass_1.Flex, { flexDirection: "column", "data-name": `expression-${type}-picker`, style: { height: '100%' } },
39
+ React.createElement(rebass_1.Flex, { className: `${_1.baseClassName}__${type}-list`, flexDirection: "column", alignItems: "start", style: { marginTop: 2 }, mb: 2 },
40
+ hasFriendlyNames && (React.createElement(CheckBox_1.CheckBox, { checked: showColumnIds, onChange: (checked) => setShowValues(checked), style: {
41
+ float: 'right',
42
+ margin: 0,
43
+ paddingTop: 'var(--ab-space-1)',
44
+ paddingBottom: 'var(--ab-space-1)',
45
+ } }, (_a = labels === null || labels === void 0 ? void 0 : labels.showIds) !== null && _a !== void 0 ? _a : 'Show Column IDs')),
46
+ React.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { value: searchInputValue, OnTextChange: setSearchInputValue, placeholder: (_b = labels === null || labels === void 0 ? void 0 : labels.filterPlaceholder) !== null && _b !== void 0 ? _b : 'Filter columns...', style: { flex: 1, marginBottom: 3 } })),
47
+ React.createElement(FormLayout_1.default, { className: "ab-ExpressionEditor__columns", gridColumnGap: "var(--ab-space-1)", gridRowGap: "var(--ab-space-1)", sizes: ['auto', '1fr'], style: { alignItems: 'stretch', overflow: 'auto' } }, fields
48
+ .filter((field) => {
49
+ var _a, _b;
50
+ if (!searchInputValue) {
51
+ return true;
52
+ }
53
+ return (field.label.includes(searchInputValue) || ((_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, searchInputValue)));
54
+ })
55
+ .map((field) => {
56
+ var _a, _b, _c;
57
+ const label = showColumnIds ? `[${field.value}]` : field.label;
58
+ return (React.createElement(FormLayout_1.FormRow, { key: field.label, label: React.createElement(EditorButton_1.default, { width: "100%", height: "100%", style: {
59
+ background: 'var(--ab-color-primary)',
60
+ cursor: 'grab',
61
+ marginRight: 'var(--ab-space-1)',
62
+ }, data: dataFormatter(field.value), "data-name": type, "data-value": field.value, icon: "drag" },
63
+ React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start" }, label)) }, field.dataType === 'Number' ? (React.createElement(Input_1.default, { type: "number", "data-name": `${type}-input`, "data-value": field.value, value: (_a = getColValue(field.value)) !== null && _a !== void 0 ? _a : '', onChange: (e) => setData(updateColValue(data, field.value, Number(e.target.value))), width: "100%", disabled: field.readOnly })) : field.dataType === 'String' ? (React.createElement(Input_1.default, { type: "text", "data-name": `${type}-input`, "data-value": field.value, value: (_b = getColValue(field.value)) !== null && _b !== void 0 ? _b : '', onChange: (e) => setData(updateColValue(data, field.value, e.target.value)), width: "100%", disabled: field.readOnly })) : field.dataType === 'Date' ? (React.createElement(AdaptableInput_1.default, { type: "date", "data-name": `${type}-input`, "data-value": field.value, value: (_c = getColDateValue(field.value)) !== null && _c !== void 0 ? _c : '', onChange: (e) => {
64
+ setData(updateColValue(data, field.value, new Date(e.target.value)));
65
+ }, style: { width: '100%' }, disabled: field.readOnly })) : field.dataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": `${type}-input`, "data-value": field.value, checked: Boolean(getColValue(field.value)), onChange: (checked) => setData(updateColValue(data, field.value, checked)), disabled: field.readOnly })) : null));
66
+ }))));
67
+ };
68
+ exports.DataTableEditor = DataTableEditor;
@@ -16,14 +16,27 @@ function EditorInput(props) {
16
16
  .getQueryLanguageService()
17
17
  .getModuleExpressionFunctionsMap(props.module);
18
18
  const getFilteredAggregatedExpressionFunctions = (availableAggregatedExpressionFunctions, type) => {
19
- const sourceExpressionFunctions = type === 'cumulativeAggregatedScalar'
20
- ? aggregatedScalarExpressionFunctions_1.cumulativeAggregatedExpressionFunctions
21
- : type === 'quantileAggregatedScalar'
22
- ? aggregatedScalarExpressionFunctions_1.quantileAggregatedExpressionFunctions
23
- : aggregatedScalarExpressionFunctions_1.aggregatedExpressionFunctions;
24
- return Object.keys(availableAggregatedExpressionFunctions)
25
- .filter((key) => sourceExpressionFunctions.includes(key))
26
- .reduce((obj, key) => {
19
+ let filteredCollection = [];
20
+ if (type === 'aggregatedScalar') {
21
+ const excludeSet = new Set([
22
+ // we cannot have a hardcodede set of functions,
23
+ // we need to allow custom expresions
24
+ ...aggregatedScalarExpressionFunctions_1.cumulativeAggregatedExpressionFunctions,
25
+ ...aggregatedScalarExpressionFunctions_1.quantileAggregatedExpressionFunctions,
26
+ ]);
27
+ filteredCollection = Object.keys(availableAggregatedExpressionFunctions).filter((key) =>
28
+ // need to allow standard ones
29
+ aggregatedScalarExpressionFunctions_1.cumulativeAggregatedExpressionFunctions.includes(key) ||
30
+ // and anything else that is not cumul or quantile
31
+ !excludeSet.has(key));
32
+ }
33
+ else {
34
+ const includeExpressionFunctions = type === 'cumulativeAggregatedScalar'
35
+ ? aggregatedScalarExpressionFunctions_1.cumulativeAggregatedExpressionFunctions
36
+ : aggregatedScalarExpressionFunctions_1.quantileAggregatedExpressionFunctions;
37
+ filteredCollection = Object.keys(availableAggregatedExpressionFunctions).filter((key) => includeExpressionFunctions.includes(key));
38
+ }
39
+ return filteredCollection.reduce((obj, key) => {
27
40
  obj[key] = availableAggregatedExpressionFunctions[key];
28
41
  return obj;
29
42
  }, {});
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { NamedQuery } from '../../types';
3
+ export declare const NamedQueryEditor: (props: {
4
+ namedQueries: NamedQuery[];
5
+ }) => JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NamedQueryEditor = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const AdaptableContext_1 = require("../../View/AdaptableContext");
8
+ const CheckBox_1 = require("../CheckBox");
9
+ const EditorButton_1 = tslib_1.__importDefault(require("./EditorButton"));
10
+ const NamedQueryEditor = (props) => {
11
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
12
+ const [showColumnIds, setShowColumnIds] = React.useState(false);
13
+ const [inlineQuery, setInlineQuery] = React.useState(false);
14
+ return (React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start", style: { marginTop: 2 } },
15
+ React.createElement(CheckBox_1.CheckBox, { checked: showColumnIds, onChange: (checked) => setShowColumnIds(checked) }, "Show Column IDs"),
16
+ React.createElement(CheckBox_1.CheckBox, { checked: inlineQuery, onChange: (checked) => setInlineQuery(checked) }, "Inline Query"),
17
+ props.namedQueries.map((namedQuery) => (React.createElement(rebass_1.Flex, { key: namedQuery.Uuid, flexDirection: "column", alignItems: "start", style: {
18
+ padding: 3,
19
+ marginTop: 'var(--ab-space-2)',
20
+ marginBottom: 'var(--ab-space-2)',
21
+ width: '100%',
22
+ }, backgroundColor: "primarylight" },
23
+ ' ',
24
+ React.createElement(EditorButton_1.default, { width: "100%", height: "100%", style: {
25
+ background: 'var(--ab-color-primary)',
26
+ cursor: 'grab',
27
+ }, data: inlineQuery ? namedQuery.BooleanExpression : `QUERY("${namedQuery.Name}")`, "data-name": "column", icon: "drag" },
28
+ React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start" }, namedQuery.Name)),
29
+ React.createElement(rebass_1.Flex, { alignItems: "start", style: {
30
+ padding: 5,
31
+ } }, showColumnIds
32
+ ? namedQuery.BooleanExpression
33
+ : adaptable.api.expressionApi.getAdaptableQueryExpressionWithColumnFriendlyNames(namedQuery)))))));
34
+ };
35
+ exports.NamedQueryEditor = NamedQueryEditor;
@@ -7,10 +7,20 @@ interface QueryBuilderProps {
7
7
  value: string;
8
8
  type: AdaptableColumnDataType;
9
9
  }[];
10
+ getFields: (type?: AdaptableColumnDataType) => {
11
+ label?: string;
12
+ value: string;
13
+ type: AdaptableColumnDataType;
14
+ }[];
10
15
  onChange: (query: string) => void;
11
16
  module: AdaptableModule;
12
17
  }
13
18
  export declare function useQueryBuilderContext(): {
19
+ getColumns: (type?: AdaptableColumnDataType) => {
20
+ label?: string;
21
+ value: string;
22
+ type: AdaptableColumnDataType;
23
+ }[];
14
24
  getFields: (type?: AdaptableColumnDataType) => {
15
25
  label?: string;
16
26
  value: string;
@@ -59,7 +59,8 @@ const QueryBuilder = (props) => {
59
59
  }, []);
60
60
  const context = React.useMemo(() => {
61
61
  return {
62
- getFields: props.getColumns,
62
+ getColumns: props.getColumns,
63
+ getFields: props.getFields,
63
64
  getExpressions: (columnType) => {
64
65
  return booleanExpressions
65
66
  ? (0, utils_1.getFunctionsForColumnType)(columnType, Object.keys(booleanExpressions))
@@ -71,10 +72,12 @@ const QueryBuilder = (props) => {
71
72
  const clearExpressionButton = (React.createElement(SimpleButton_1.default, { onClick: () => {
72
73
  clearExpression();
73
74
  } }, "Clear Expression"));
74
- const unsupportedExpressionFunction = (0, utils_1.getUnsuportedExpressionFromQlPredicate)(qlPredicate);
75
+ const unsupportedExpressionFunction = (0, utils_1.getUnsuportedExpressionFromQlPredicate)(qlPredicate, {
76
+ supportedFields: props.getFields(),
77
+ });
75
78
  let errorOrEditor = null;
76
79
  if (qlPredicate && 'errorMessage' in qlPredicate) {
77
- errorOrEditor = ((_b = (_a = props.query) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, 'QUERY')) ? (React.createElement(WarningBox_1.WarningBox, null,
80
+ errorOrEditor = ((_b = (_a = props.query) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, 'QUERY')) ? (React.createElement(WarningBox_1.WarningBox, { "data-name": "unsupported-query-warning" },
78
81
  React.createElement(rebass_1.Flex, { alignItems: "center" },
79
82
  "Named Queries are not supported in the Query Builder",
80
83
  React.createElement(rebass_1.Box, { flex: 1 }),
@@ -85,7 +88,7 @@ const QueryBuilder = (props) => {
85
88
  clearExpressionButton)));
86
89
  }
87
90
  else if (unsupportedExpressionFunction) {
88
- errorOrEditor = React.createElement(WarningBox_1.WarningBox, null, unsupportedExpressionFunction);
91
+ errorOrEditor = (React.createElement(WarningBox_1.WarningBox, { "data-name": "unsupported-expression-warning" }, unsupportedExpressionFunction));
89
92
  }
90
93
  else if (qlPredicate && !('errorMessage' in qlPredicate)) {
91
94
  errorOrEditor = (React.createElement(QueryPredicateBuilder_1.QueryPredicateBuilder, { isRoot: true, index: 0, id: "0", predicate: qlPredicate, onNewPredicate: (type) => {
@@ -2,10 +2,11 @@
2
2
  import { QlLogicalOperator } from '../../../parser/src/predicate';
3
3
  import { ExpressionFunctionInputType } from '../../../parser/src/types';
4
4
  import { AdaptableColumn, AdaptableColumnDataType, BooleanFunctionName } from '../../../types';
5
- export declare const PrimitiveColumnSelector: (props: {
6
- columnId: string;
5
+ export declare const PrimitiveColumnOrFieldSelector: (props: {
6
+ fieldOrColumn: string;
7
7
  type?: AdaptableColumnDataType;
8
8
  onChange: (colId: string) => void;
9
+ hideFields?: boolean;
9
10
  }) => JSX.Element;
10
11
  export declare const PrimiteValueInput: (props: {
11
12
  inputType: ExpressionFunctionInputType;