@adaptabletools/adaptable-cjs 18.0.12 → 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.
- package/agGrid.d.ts +4 -3
- package/agGrid.js +6 -1
- package/base.css +7 -2
- package/base.css.map +1 -1
- package/index.css +11 -2
- package/index.css.map +1 -1
- package/package.json +2 -2
- package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +27 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
- package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
- package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
- package/src/Api/ColumnApi.d.ts +1 -1
- package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
- package/src/Api/ExpressionApi.d.ts +2 -2
- package/src/Api/Fdc3Api.d.ts +14 -19
- package/src/Api/Implementation/ConfigApiImpl.js +3 -0
- package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
- package/src/Api/Implementation/Fdc3ApiImpl.js +35 -11
- package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
- package/src/Api/Internal/AlertInternalApi.js +196 -25
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
- package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
- package/src/Api/Internal/ExportInternalApi.js +31 -17
- package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
- package/src/Api/Internal/ExpressionInternalApi.js +80 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +5 -9
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
- package/src/PredefinedConfig/Common/AdaptableField.js +2 -0
- package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +18 -1
- package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
- package/src/PredefinedConfig/Common/Fdc3Context.js +44 -32
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +27 -74
- package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
- package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
- package/src/Strategy/AdaptableModuleBase.js +1 -3
- package/src/Strategy/AlertModule.d.ts +1 -1
- package/src/Strategy/AlertModule.js +8 -8
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +14 -13
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
- package/src/Utilities/Services/QueryLanguageService.js +105 -6
- package/src/Utilities/Services/ReportService.js +8 -5
- package/src/Utilities/Services/RowSummaryService.js +3 -1
- package/src/Utilities/divideBy100.d.ts +1 -0
- package/src/Utilities/divideBy100.js +34 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +27 -0
- package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
- package/src/View/Components/EntityRulesEditor/index.js +11 -7
- package/src/View/Components/ExpressionWizard.js +1 -1
- package/src/View/Components/FilterForm/QuickFilterValues.js +28 -4
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
- package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
- package/src/View/Components/Selectors/FieldSelector.js +26 -0
- package/src/View/Components/Selectors/PermittedValuesSelector.js +8 -4
- package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
- package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
- package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
- package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -2
- package/src/agGrid/AdaptableAgGrid.js +63 -32
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +24 -1
- package/src/agGrid/AgGridMenuAdapter.js +1 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
- package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
- package/src/agGrid/editors/AdaptableDateEditor/index.js +6 -19
- package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +6 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +84 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +153 -0
- package/src/components/Accordion.js +1 -1
- package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
- package/src/components/Datepicker/index.js +3 -4
- package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
- package/src/components/ExpressionEditor/DataTableEditor.js +68 -0
- package/src/components/ExpressionEditor/EditorInput.js +21 -8
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +35 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +72 -14
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +27 -19
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +46 -4
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +67 -92
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +6 -5
- package/src/components/OverlayTrigger/index.js +10 -6
- package/src/components/icons/column-outline.d.ts +3 -0
- package/src/components/icons/column-outline.js +7 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +7 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +78 -200
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +13 -3
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
- package/src/parser/src/types.d.ts +101 -1
- package/src/types.d.ts +9 -7
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -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;
|
|
@@ -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:
|
|
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: ___,
|
|
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 =
|
|
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' }))
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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,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
|
-
|
|
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,
|
|
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,
|
|
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
|
|
6
|
-
|
|
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;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CombinatorSelector = exports.ExpressionSelector = exports.PrimitiveMultiValueInput = exports.PrimiteValueInput = exports.
|
|
3
|
+
exports.CombinatorSelector = exports.ExpressionSelector = exports.PrimitiveMultiValueInput = exports.PrimiteValueInput = exports.PrimitiveColumnOrFieldSelector = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
7
7
|
const mapQlPredicateToExpression_1 = require("../../../parser/src/predicate/mapQlPredicateToExpression");
|
|
8
|
+
const AdaptableContext_1 = require("../../../View/AdaptableContext");
|
|
8
9
|
const AdaptableInput_1 = tslib_1.__importDefault(require("../../../View/Components/AdaptableInput"));
|
|
9
10
|
const ColumnSelector_1 = require("../../../View/Components/Selectors/ColumnSelector");
|
|
11
|
+
const FieldSelector_1 = require("../../../View/Components/Selectors/FieldSelector");
|
|
10
12
|
const PermittedValuesSelector_1 = require("../../../View/Components/Selectors/PermittedValuesSelector");
|
|
11
13
|
const CheckBox_1 = require("../../CheckBox");
|
|
12
14
|
const DropdownButton_1 = tslib_1.__importDefault(require("../../DropdownButton"));
|
|
@@ -15,20 +17,61 @@ const InputGroup_1 = require("../../InputGroup");
|
|
|
15
17
|
const Select_1 = require("../../Select");
|
|
16
18
|
const QueryBuilder_1 = require("./QueryBuilder");
|
|
17
19
|
const utils_1 = require("./utils");
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const PrimitiveColumnOrFieldSelector = (props) => {
|
|
21
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
22
|
+
const [type, setType] = react_1.default.useState(() => {
|
|
23
|
+
return (
|
|
24
|
+
// default to column
|
|
25
|
+
(!props.fieldOrColumn || props.fieldOrColumn.includes('[') ? 'column' : 'field')
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
const hasFields = react_1.default.useMemo(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
return ((_a = adaptable.api.expressionApi.internalApi.getAvailableFields()) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
31
|
+
}, []);
|
|
32
|
+
const hasFieldsOrValueIsField = hasFields || (0, utils_1.isFieldValue)(props.fieldOrColumn);
|
|
33
|
+
let input = null;
|
|
34
|
+
if (type === 'column') {
|
|
35
|
+
const columnId = (0, utils_1.mapColumnExpressionToColumnId)(props.fieldOrColumn);
|
|
36
|
+
input = (react_1.default.createElement(ColumnSelector_1.ColumnSelector, { value: columnId, type: props.type, onChange: (columnId) => {
|
|
21
37
|
props.onChange(`[${columnId}]`);
|
|
22
|
-
} }))
|
|
38
|
+
} }));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
input = (react_1.default.createElement(FieldSelector_1.FieldSelector, { value: (0, utils_1.mapExpressionToFieldValue)(props.fieldOrColumn), type: props.type, onChange: (fieldValue) => {
|
|
42
|
+
props.onChange((0, utils_1.mapFieldValueToExpression)(fieldValue));
|
|
43
|
+
} }));
|
|
44
|
+
}
|
|
45
|
+
const typeOptions = [
|
|
46
|
+
{ label: 'Column', value: 'column', icon: 'grid' },
|
|
47
|
+
{ label: 'Field', value: 'field', icon: 'column-outline' },
|
|
48
|
+
];
|
|
49
|
+
return !hasFieldsOrValueIsField || props.hideFields ? (react_1.default.createElement(rebass_1.Box, null, input)) : (react_1.default.createElement(InputGroup_1.InputGroup, { Component: rebass_1.Flex, "data-id": "query-first-arg-wrapper" },
|
|
50
|
+
react_1.default.createElement(Select_1.Select, { renderSingleValue: (value) => {
|
|
51
|
+
return react_1.default.createElement(react_1.default.Fragment, null, type === 'column' ? react_1.default.createElement(icons_1.Icon, { name: "grid" }) : react_1.default.createElement(icons_1.Icon, { name: "column-outline" }));
|
|
52
|
+
}, value: type, options: typeOptions, onChange: (value) => {
|
|
53
|
+
props.onChange(null);
|
|
54
|
+
setType(value);
|
|
55
|
+
} }),
|
|
56
|
+
input));
|
|
23
57
|
};
|
|
24
|
-
exports.
|
|
58
|
+
exports.PrimitiveColumnOrFieldSelector = PrimitiveColumnOrFieldSelector;
|
|
25
59
|
const PrimiteValueInput = (props) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
60
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
61
|
+
const hasFields = react_1.default.useMemo(() => {
|
|
28
62
|
var _a;
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
63
|
+
return ((_a = adaptable.api.expressionApi.internalApi.getAvailableFields()) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
64
|
+
}, []);
|
|
65
|
+
const hasFieldsOrValueIsField = hasFields || (0, utils_1.isFieldValue)(props.value);
|
|
66
|
+
const [type, setType] = react_1.default.useState(() => {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.value) === 'string' && ((_a = props === null || props === void 0 ? void 0 : props.value) === null || _a === void 0 ? void 0 : _a.includes('['))) {
|
|
69
|
+
return 'column-name';
|
|
70
|
+
}
|
|
71
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.value) === 'string' && ((_b = props === null || props === void 0 ? void 0 : props.value) === null || _b === void 0 ? void 0 : _b.includes('FIELD'))) {
|
|
72
|
+
return 'field';
|
|
73
|
+
}
|
|
74
|
+
return 'input-value';
|
|
32
75
|
});
|
|
33
76
|
const handleTypeChange = (newType) => {
|
|
34
77
|
if (type !== newType) {
|
|
@@ -72,12 +115,18 @@ const PrimiteValueInput = (props) => {
|
|
|
72
115
|
};
|
|
73
116
|
let editor = null;
|
|
74
117
|
if (type === 'column-name') {
|
|
75
|
-
const columnId = props.value ? (_b = (_a = props === null || props === void 0 ? void 0 : props.value) === null || _a === void 0 ? void 0 : _a.replace) === null || _b === void 0 ? void 0 : _b.call(_a, '[', '').replace(']', '') : undefined;
|
|
76
118
|
const abColType = (0, utils_1.mapExpressionFunctionTypeToColumnDataType)(props.inputType);
|
|
77
|
-
editor = (react_1.default.createElement(exports.
|
|
119
|
+
editor = (react_1.default.createElement(exports.PrimitiveColumnOrFieldSelector, { hideFields: true, fieldOrColumn: props.value, type: abColType, onChange: (columnId) => {
|
|
120
|
+
props.onChange(columnId);
|
|
121
|
+
} }));
|
|
122
|
+
}
|
|
123
|
+
else if (type === 'field') {
|
|
124
|
+
editor = (react_1.default.createElement(FieldSelector_1.FieldSelector, { value: (0, utils_1.mapExpressionToFieldValue)(props.value), onChange: (fieldValue) => {
|
|
125
|
+
props.onChange((0, utils_1.mapFieldValueToExpression)(fieldValue));
|
|
126
|
+
} }));
|
|
78
127
|
}
|
|
79
128
|
else if (!['date', 'boolean'].includes(props.inputType)) {
|
|
80
|
-
editor = (react_1.default.createElement(PermittedValuesSelector_1.PermittedValuesSelector, { allowNewValues: true, value: props.value, columnId: props.lefthandColumnIdParam, onChange: (value) => {
|
|
129
|
+
editor = (react_1.default.createElement(PermittedValuesSelector_1.PermittedValuesSelector, { allowNewValues: true, value: props.value, columnId: (0, utils_1.mapColumnExpressionToColumnId)(props.lefthandColumnIdParam), onChange: (value) => {
|
|
81
130
|
props.onChange(value);
|
|
82
131
|
} }));
|
|
83
132
|
}
|
|
@@ -100,6 +149,15 @@ const PrimiteValueInput = (props) => {
|
|
|
100
149
|
value: 'input-value',
|
|
101
150
|
},
|
|
102
151
|
];
|
|
152
|
+
if (hasFieldsOrValueIsField || type === 'field') {
|
|
153
|
+
options.push({
|
|
154
|
+
label: (react_1.default.createElement(rebass_1.Flex, null,
|
|
155
|
+
react_1.default.createElement(icons_1.Icon, { name: "column-outline" }),
|
|
156
|
+
react_1.default.createElement(rebass_1.Text, { ml: 2 }, "Field"))),
|
|
157
|
+
icon: 'column-outline',
|
|
158
|
+
value: 'field',
|
|
159
|
+
});
|
|
160
|
+
}
|
|
103
161
|
const typeOption = options.find((option) => option.value === type);
|
|
104
162
|
return (react_1.default.createElement(InputGroup_1.InputGroup, { Component: rebass_1.Flex, "data-id": "query-input-wrapper", mr: 2 },
|
|
105
163
|
react_1.default.createElement(Select_1.Select, { renderSingleValue: (value) => {
|