@adaptabletools/adaptable 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.
- package/agGrid.d.ts +4 -3
- package/agGrid.js +4 -3
- 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 +36 -12
- 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 +79 -0
- package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
- package/src/Api/Internal/Fdc3InternalApi.js +6 -10
- package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
- package/src/PredefinedConfig/Common/AdaptableField.js +1 -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 +43 -31
- package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
- package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
- 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 +1 -1
- package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
- package/src/Utilities/Services/Fdc3Service.js +2 -2
- 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 +30 -0
- package/src/Utilities/times100.d.ts +1 -0
- package/src/Utilities/times100.js +23 -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 +21 -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 +66 -38
- package/src/agGrid/AgGridAdapter.d.ts +2 -0
- package/src/agGrid/AgGridAdapter.js +10 -1
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
- package/src/agGrid/AgGridColumnAdapter.js +22 -0
- 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 +5 -18
- 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 +5 -2
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
- package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -0
- package/src/agGrid/weightedAverage.js +3 -2
- 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 +63 -0
- package/src/components/ExpressionEditor/EditorInput.js +22 -9
- package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
- package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -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 +71 -13
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
- package/src/components/ExpressionEditor/index.d.ts +3 -1
- package/src/components/ExpressionEditor/index.js +66 -91
- package/src/components/Input/NumberInput.d.ts +2 -1
- package/src/components/Input/NumberInput.js +7 -4
- 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 +4 -0
- package/src/components/icons/index.js +5 -1
- package/src/components/icons/sync.d.ts +3 -0
- package/src/components/icons/sync.js +4 -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 +11 -2
- 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.esm.tsbuildinfo +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Flex, Text } from 'rebass';
|
|
3
3
|
import { getQlPredicateSymbol } from '../../../parser/src/predicate/mapQlPredicateToExpression';
|
|
4
|
+
import { useAdaptable } from '../../../View/AdaptableContext';
|
|
4
5
|
import AdaptableInput from '../../../View/Components/AdaptableInput';
|
|
5
6
|
import { ColumnSelector } from '../../../View/Components/Selectors/ColumnSelector';
|
|
7
|
+
import { FieldSelector } from '../../../View/Components/Selectors/FieldSelector';
|
|
6
8
|
import { PermittedValuesSelector } from '../../../View/Components/Selectors/PermittedValuesSelector';
|
|
7
9
|
import { CheckBox } from '../../CheckBox';
|
|
8
10
|
import DropdownButton from '../../DropdownButton';
|
|
@@ -10,20 +12,61 @@ import { Icon } from '../../icons';
|
|
|
10
12
|
import { InputGroup } from '../../InputGroup';
|
|
11
13
|
import { Select } from '../../Select';
|
|
12
14
|
import { useQueryBuilderContext } from './QueryBuilder';
|
|
13
|
-
import { mapExpressionFunctionTypeToColumnDataType } from './utils';
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import { isFieldValue, mapColumnExpressionToColumnId, mapExpressionFunctionTypeToColumnDataType, mapExpressionToFieldValue, mapFieldValueToExpression, } from './utils';
|
|
16
|
+
export const PrimitiveColumnOrFieldSelector = (props) => {
|
|
17
|
+
const adaptable = useAdaptable();
|
|
18
|
+
const [type, setType] = React.useState(() => {
|
|
19
|
+
return (
|
|
20
|
+
// default to column
|
|
21
|
+
(!props.fieldOrColumn || props.fieldOrColumn.includes('[') ? 'column' : 'field')
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
const hasFields = React.useMemo(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
return ((_a = adaptable.api.expressionApi.internalApi.getAvailableFields()) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
27
|
+
}, []);
|
|
28
|
+
const hasFieldsOrValueIsField = hasFields || isFieldValue(props.fieldOrColumn);
|
|
29
|
+
let input = null;
|
|
30
|
+
if (type === 'column') {
|
|
31
|
+
const columnId = mapColumnExpressionToColumnId(props.fieldOrColumn);
|
|
32
|
+
input = (React.createElement(ColumnSelector, { value: columnId, type: props.type, onChange: (columnId) => {
|
|
17
33
|
props.onChange(`[${columnId}]`);
|
|
18
|
-
} }))
|
|
34
|
+
} }));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
input = (React.createElement(FieldSelector, { value: mapExpressionToFieldValue(props.fieldOrColumn), type: props.type, onChange: (fieldValue) => {
|
|
38
|
+
props.onChange(mapFieldValueToExpression(fieldValue));
|
|
39
|
+
} }));
|
|
40
|
+
}
|
|
41
|
+
const typeOptions = [
|
|
42
|
+
{ label: 'Column', value: 'column', icon: 'grid' },
|
|
43
|
+
{ label: 'Field', value: 'field', icon: 'column-outline' },
|
|
44
|
+
];
|
|
45
|
+
return !hasFieldsOrValueIsField || props.hideFields ? (React.createElement(Box, null, input)) : (React.createElement(InputGroup, { Component: Flex, "data-id": "query-first-arg-wrapper" },
|
|
46
|
+
React.createElement(Select, { renderSingleValue: (value) => {
|
|
47
|
+
return React.createElement(React.Fragment, null, type === 'column' ? React.createElement(Icon, { name: "grid" }) : React.createElement(Icon, { name: "column-outline" }));
|
|
48
|
+
}, value: type, options: typeOptions, onChange: (value) => {
|
|
49
|
+
props.onChange(null);
|
|
50
|
+
setType(value);
|
|
51
|
+
} }),
|
|
52
|
+
input));
|
|
19
53
|
};
|
|
20
54
|
export const PrimiteValueInput = (props) => {
|
|
21
|
-
|
|
22
|
-
const
|
|
55
|
+
const adaptable = useAdaptable();
|
|
56
|
+
const hasFields = React.useMemo(() => {
|
|
23
57
|
var _a;
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
58
|
+
return ((_a = adaptable.api.expressionApi.internalApi.getAvailableFields()) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
59
|
+
}, []);
|
|
60
|
+
const hasFieldsOrValueIsField = hasFields || isFieldValue(props.value);
|
|
61
|
+
const [type, setType] = React.useState(() => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
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('['))) {
|
|
64
|
+
return 'column-name';
|
|
65
|
+
}
|
|
66
|
+
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'))) {
|
|
67
|
+
return 'field';
|
|
68
|
+
}
|
|
69
|
+
return 'input-value';
|
|
27
70
|
});
|
|
28
71
|
const handleTypeChange = (newType) => {
|
|
29
72
|
if (type !== newType) {
|
|
@@ -67,12 +110,18 @@ export const PrimiteValueInput = (props) => {
|
|
|
67
110
|
};
|
|
68
111
|
let editor = null;
|
|
69
112
|
if (type === 'column-name') {
|
|
70
|
-
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;
|
|
71
113
|
const abColType = mapExpressionFunctionTypeToColumnDataType(props.inputType);
|
|
72
|
-
editor = (React.createElement(
|
|
114
|
+
editor = (React.createElement(PrimitiveColumnOrFieldSelector, { hideFields: true, fieldOrColumn: props.value, type: abColType, onChange: (columnId) => {
|
|
115
|
+
props.onChange(columnId);
|
|
116
|
+
} }));
|
|
117
|
+
}
|
|
118
|
+
else if (type === 'field') {
|
|
119
|
+
editor = (React.createElement(FieldSelector, { value: mapExpressionToFieldValue(props.value), onChange: (fieldValue) => {
|
|
120
|
+
props.onChange(mapFieldValueToExpression(fieldValue));
|
|
121
|
+
} }));
|
|
73
122
|
}
|
|
74
123
|
else if (!['date', 'boolean'].includes(props.inputType)) {
|
|
75
|
-
editor = (React.createElement(PermittedValuesSelector, { allowNewValues: true, value: props.value, columnId: props.lefthandColumnIdParam, onChange: (value) => {
|
|
124
|
+
editor = (React.createElement(PermittedValuesSelector, { allowNewValues: true, value: props.value, columnId: mapColumnExpressionToColumnId(props.lefthandColumnIdParam), onChange: (value) => {
|
|
76
125
|
props.onChange(value);
|
|
77
126
|
} }));
|
|
78
127
|
}
|
|
@@ -95,6 +144,15 @@ export const PrimiteValueInput = (props) => {
|
|
|
95
144
|
value: 'input-value',
|
|
96
145
|
},
|
|
97
146
|
];
|
|
147
|
+
if (hasFieldsOrValueIsField || type === 'field') {
|
|
148
|
+
options.push({
|
|
149
|
+
label: (React.createElement(Flex, null,
|
|
150
|
+
React.createElement(Icon, { name: "column-outline" }),
|
|
151
|
+
React.createElement(Text, { ml: 2 }, "Field"))),
|
|
152
|
+
icon: 'column-outline',
|
|
153
|
+
value: 'field',
|
|
154
|
+
});
|
|
155
|
+
}
|
|
98
156
|
const typeOption = options.find((option) => option.value === type);
|
|
99
157
|
return (React.createElement(InputGroup, { Component: Flex, "data-id": "query-input-wrapper", mr: 2 },
|
|
100
158
|
React.createElement(Select, { renderSingleValue: (value) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Draggable, Droppable } from 'react-beautiful-dnd';
|
|
3
3
|
import { Box, Flex } from 'rebass';
|
|
4
|
-
import { isQlLogicalOperator } from '../../../parser/src/predicate';
|
|
4
|
+
import { isArgumentColumnOrField, isQlLogicalOperator, } from '../../../parser/src/predicate';
|
|
5
5
|
import { mapColumnDataTypeToExpressionFunctionType } from '../../../Utilities/adaptableQlUtils';
|
|
6
6
|
import { booleanExpressionFunctions } from '../../../Utilities/ExpressionFunctions/booleanExpressionFunctions';
|
|
7
7
|
import { useAdaptable } from '../../../View/AdaptableContext';
|
|
@@ -9,8 +9,8 @@ import DropdownButton from '../../DropdownButton';
|
|
|
9
9
|
import ErrorBox from '../../ErrorBox';
|
|
10
10
|
import { Icon } from '../../icons';
|
|
11
11
|
import SimpleButton from '../../SimpleButton';
|
|
12
|
-
import { CombinatorSelector, ExpressionSelector, PrimiteValueInput,
|
|
13
|
-
import { getOperatorMatchingInputs as getFunctionMatchingInputTypes } from './utils';
|
|
12
|
+
import { CombinatorSelector, ExpressionSelector, PrimiteValueInput, PrimitiveColumnOrFieldSelector, PrimitiveMultiValueInput, } from './QueryBuilderInputs';
|
|
13
|
+
import { getOperatorMatchingInputs as getFunctionMatchingInputTypes, mapExpressionToFieldValue, } from './utils';
|
|
14
14
|
const ITEM_HEIGHT = 40;
|
|
15
15
|
const BASE_CLASS_NAME = 'ab-QueryBuilder-predicate-editor';
|
|
16
16
|
const Handle = (props) => (React.createElement(Flex, Object.assign({ className: `${BASE_CLASS_NAME}__handle`, height: ITEM_HEIGHT, alignItems: "center", mr: 1 }, props),
|
|
@@ -18,8 +18,8 @@ const Handle = (props) => (React.createElement(Flex, Object.assign({ className:
|
|
|
18
18
|
const QueryPredicateButtons = (props) => {
|
|
19
19
|
return (React.createElement(React.Fragment, null,
|
|
20
20
|
!props.hideAdd && (React.createElement(DropdownButton, { listMinWidth: 150, columns: ['label'], items: [
|
|
21
|
-
{ label: '
|
|
22
|
-
{ label: '
|
|
21
|
+
{ label: 'Condition', onClick: () => props.onNewPredicate('filter') },
|
|
22
|
+
{ label: 'AND / OR Group', onClick: () => props.onNewPredicate('group') },
|
|
23
23
|
], variant: "text" },
|
|
24
24
|
React.createElement(Icon, { name: "plus" }))),
|
|
25
25
|
!props.hideDelete && (React.createElement(SimpleButton, { icon: "delete", variant: "text", onClick: () => {
|
|
@@ -96,22 +96,31 @@ const PrimitiveFunctionEditor = (props) => {
|
|
|
96
96
|
var _a;
|
|
97
97
|
// [handle] [column] [operator-dropdown] [...args] [delete-button] [plus-button]
|
|
98
98
|
const adaptable = useAdaptable();
|
|
99
|
-
const [
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
let
|
|
99
|
+
const [columnOrFieldExpression, ...restOfArgs] = props.predicate.args;
|
|
100
|
+
const columnOrField = columnOrFieldExpression;
|
|
101
|
+
let columnOrFieldId = null;
|
|
102
|
+
let columnOrFieldDataType = null;
|
|
103
103
|
let columnInputDataType = null;
|
|
104
104
|
let functionInputInputDataTypes = null;
|
|
105
105
|
// Thsese are the type of inputs ommiting the column
|
|
106
106
|
// [[column-data-type], number, number]
|
|
107
107
|
let restOfFunctionInputDataTypes = [];
|
|
108
|
-
if (
|
|
109
|
-
if (
|
|
110
|
-
return React.createElement(ErrorBox, null, "Expression must start with a column!");
|
|
108
|
+
if (columnOrField) {
|
|
109
|
+
if (!isArgumentColumnOrField(columnOrField)) {
|
|
110
|
+
return React.createElement(ErrorBox, null, "Expression must start with a column or a filed!");
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
if (columnOrField.includes('FIELD')) {
|
|
113
|
+
// we let the full expression so we can difirienciate between column and field
|
|
114
|
+
columnOrFieldId = columnOrField;
|
|
115
|
+
const fieldValue = mapExpressionToFieldValue(columnOrField);
|
|
116
|
+
columnOrFieldDataType = adaptable.api.expressionApi.internalApi.getFieldType(fieldValue);
|
|
117
|
+
}
|
|
118
|
+
else if (columnOrField.includes('[')) {
|
|
119
|
+
columnOrFieldId = columnOrField;
|
|
120
|
+
const columnId = columnOrField.replace(/[\[\]]/g, '');
|
|
121
|
+
columnOrFieldDataType = adaptable.api.columnApi.getColumnDataTypeForColumnId(columnId);
|
|
122
|
+
}
|
|
123
|
+
columnInputDataType = mapColumnDataTypeToExpressionFunctionType(columnOrFieldDataType);
|
|
115
124
|
functionInputInputDataTypes = (_a = booleanExpressionFunctions[props.predicate.operator]) === null || _a === void 0 ? void 0 : _a.inputs;
|
|
116
125
|
restOfFunctionInputDataTypes = functionInputInputDataTypes
|
|
117
126
|
? getFunctionMatchingInputTypes(columnInputDataType, functionInputInputDataTypes)
|
|
@@ -128,12 +137,12 @@ const PrimitiveFunctionEditor = (props) => {
|
|
|
128
137
|
React.createElement(Handle, Object.assign({}, provided.dragHandleProps)),
|
|
129
138
|
React.createElement(Flex, { alignItems: "center", height: ITEM_HEIGHT },
|
|
130
139
|
React.createElement(Box, { mr: 2 },
|
|
131
|
-
React.createElement(
|
|
132
|
-
props.onChange(Object.assign(Object.assign({}, props.predicate), { args: [
|
|
133
|
-
},
|
|
134
|
-
|
|
140
|
+
React.createElement(PrimitiveColumnOrFieldSelector, { onChange: (colOrField) => {
|
|
141
|
+
props.onChange(Object.assign(Object.assign({}, props.predicate), { args: [colOrField], operator: null }));
|
|
142
|
+
}, fieldOrColumn: columnOrFieldId })),
|
|
143
|
+
columnOrFieldId && columnOrFieldDataType && (React.createElement(ExpressionSelector, { dataType: columnOrFieldDataType, onExpressionChange: (operator) => {
|
|
135
144
|
let args = [props.predicate.args[0]];
|
|
136
|
-
if (
|
|
145
|
+
if (columnOrFieldDataType === 'Boolean' && operator !== 'NOT') {
|
|
137
146
|
args = [props.predicate.args[0], 'TRUE'];
|
|
138
147
|
}
|
|
139
148
|
props.onChange(Object.assign(Object.assign({}, props.predicate), { operator,
|
|
@@ -142,10 +151,9 @@ const PrimitiveFunctionEditor = (props) => {
|
|
|
142
151
|
}, value: props.predicate.operator })),
|
|
143
152
|
React.createElement(Flex, { flex: 1, ml: 2 }, restOfFunctionInputDataTypes.map((type, index) => {
|
|
144
153
|
var _a;
|
|
145
|
-
let value = restOfArgs[index];
|
|
146
154
|
const commonProps = {
|
|
147
155
|
key: type + index,
|
|
148
|
-
lefthandColumnIdParam:
|
|
156
|
+
lefthandColumnIdParam: columnOrFieldId,
|
|
149
157
|
inputType: type,
|
|
150
158
|
};
|
|
151
159
|
if (type.includes('[]')) {
|
|
@@ -5,4 +5,12 @@ export declare const reorder: (predicate: QlPredicate, from: string, to: string)
|
|
|
5
5
|
export declare const mapExpressionFunctionTypeToColumnDataType: (type: ExpressionFunctionInputType) => AdaptableColumnDataType;
|
|
6
6
|
export declare const getOperatorMatchingInputs: (columnType: ExpressionFunctionInputType, inputs: ExpressionFunctionInputType[] | Array<ExpressionFunctionInputType>[]) => ExpressionFunctionInputType[];
|
|
7
7
|
export declare const getFunctionsForColumnType: (dataType: AdaptableColumnDataType, availableBooleanFunctions: BooleanFunctionName[]) => BooleanFunctionName[];
|
|
8
|
-
export declare const getUnsuportedExpressionFromQlPredicate: (predicate: QlPredicate | QlPredicateError
|
|
8
|
+
export declare const getUnsuportedExpressionFromQlPredicate: (predicate: QlPredicate | QlPredicateError, context: {
|
|
9
|
+
supportedFields: {
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
}) => string;
|
|
13
|
+
export declare const mapFieldValueToExpression: (field: string) => string;
|
|
14
|
+
export declare const mapExpressionToFieldValue: (expression: string) => string;
|
|
15
|
+
export declare const mapColumnExpressionToColumnId: (expression: string) => string;
|
|
16
|
+
export declare const isFieldValue: (expression: string) => boolean;
|
|
@@ -45,7 +45,7 @@ export const mapExpressionFunctionTypeToColumnDataType = (type) => {
|
|
|
45
45
|
export const getOperatorMatchingInputs = (columnType, inputs) => {
|
|
46
46
|
if (Array.isArray(inputs[0])) {
|
|
47
47
|
const matchingInput = inputs.find((input) => input[0] === columnType);
|
|
48
|
-
const [_, ...restOfArgs] = matchingInput;
|
|
48
|
+
const [_, ...restOfArgs] = matchingInput !== null && matchingInput !== void 0 ? matchingInput : [];
|
|
49
49
|
return restOfArgs;
|
|
50
50
|
}
|
|
51
51
|
const [_, ...restOfArgs] = inputs;
|
|
@@ -69,10 +69,20 @@ export const getFunctionsForColumnType = (dataType, availableBooleanFunctions) =
|
|
|
69
69
|
return (matchingInputTypes === null || matchingInputTypes === void 0 ? void 0 : matchingInputTypes[0]) === columnType;
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
-
export const getUnsuportedExpressionFromQlPredicate = (predicate) => {
|
|
72
|
+
export const getUnsuportedExpressionFromQlPredicate = (predicate, context) => {
|
|
73
|
+
var _a;
|
|
73
74
|
if (!predicate) {
|
|
74
75
|
return null;
|
|
75
76
|
}
|
|
77
|
+
if (typeof predicate === 'string' && isFieldValue(predicate)) {
|
|
78
|
+
const field = mapExpressionToFieldValue(predicate);
|
|
79
|
+
if (!((_a = context.supportedFields) === null || _a === void 0 ? void 0 : _a.some((field) => (field === null || field === void 0 ? void 0 : field.value) === mapExpressionToFieldValue(predicate)))) {
|
|
80
|
+
return `Expression uses an unregistered field: "${field}"`;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
76
86
|
if (typeof predicate === 'object' && 'errorMessage' in predicate) {
|
|
77
87
|
return null;
|
|
78
88
|
}
|
|
@@ -88,7 +98,7 @@ export const getUnsuportedExpressionFromQlPredicate = (predicate) => {
|
|
|
88
98
|
}
|
|
89
99
|
let firstInvalidArg = null;
|
|
90
100
|
for (let arg of predicate.args) {
|
|
91
|
-
firstInvalidArg = getUnsuportedExpressionFromQlPredicate(arg);
|
|
101
|
+
firstInvalidArg = getUnsuportedExpressionFromQlPredicate(arg, context);
|
|
92
102
|
if (firstInvalidArg) {
|
|
93
103
|
break;
|
|
94
104
|
}
|
|
@@ -98,3 +108,31 @@ export const getUnsuportedExpressionFromQlPredicate = (predicate) => {
|
|
|
98
108
|
}
|
|
99
109
|
return null;
|
|
100
110
|
};
|
|
111
|
+
export const mapFieldValueToExpression = (field) => `FIELD('${field}')`;
|
|
112
|
+
export const mapExpressionToFieldValue = (expression) => {
|
|
113
|
+
var _a;
|
|
114
|
+
if (!expression) {
|
|
115
|
+
return '';
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
return (_a = expression.match(/FIELD\(['"](.+)['"]\)/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
export const mapColumnExpressionToColumnId = (expression) => {
|
|
125
|
+
var _a;
|
|
126
|
+
if (!expression) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
return (_a = expression.match(/\[(.+)\]/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
return expression;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export const isFieldValue = (expression) => {
|
|
137
|
+
return typeof expression === 'string' && expression.includes('FIELD');
|
|
138
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { AdaptableApi, AdaptableColumn, AdaptableModule, NamedQuery } from '../../types';
|
|
2
|
+
import { AdaptableApi, AdaptableColumn, AdaptableField, AdaptableModule, NamedQuery } from '../../types';
|
|
3
3
|
export type ExpressionEditorType = 'boolean' | 'scalar' | 'observable' | 'aggregatedBoolean' | 'aggregatedScalar' | 'cumulativeAggregatedScalar' | 'quantileAggregatedScalar';
|
|
4
4
|
interface ExpressionEditorProps {
|
|
5
5
|
value: string;
|
|
@@ -10,6 +10,7 @@ interface ExpressionEditorProps {
|
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
};
|
|
12
12
|
columns: AdaptableColumn[];
|
|
13
|
+
fields?: AdaptableField[];
|
|
13
14
|
namedQueries: NamedQuery[];
|
|
14
15
|
allowSaveNamedQuery?: boolean;
|
|
15
16
|
style?: React.CSSProperties;
|
|
@@ -18,5 +19,6 @@ interface ExpressionEditorProps {
|
|
|
18
19
|
showQueryBuilder?: boolean;
|
|
19
20
|
showExpressionEditor?: boolean;
|
|
20
21
|
}
|
|
22
|
+
export declare const baseClassName = "ab-ExpressionEditor";
|
|
21
23
|
export declare function ExpressionEditor(props: ExpressionEditorProps): JSX.Element;
|
|
22
24
|
export {};
|
|
@@ -1,36 +1,29 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
3
|
import { Box, Flex, Text } from 'rebass';
|
|
4
|
-
import { CheckBox } from '../CheckBox';
|
|
5
|
-
import FormLayout, { FormRow } from '../FormLayout';
|
|
6
|
-
import HelpBlock from '../HelpBlock';
|
|
7
|
-
import Input from '../Input';
|
|
8
|
-
import EditorButton from './EditorButton';
|
|
9
|
-
import AdaptableInput from '../../View/Components/AdaptableInput';
|
|
10
|
-
import Radio from '../Radio';
|
|
11
|
-
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
12
|
-
import EditorInputWithWhereClause from './EditorInputWithWhereClause';
|
|
13
|
-
import EditorInput from './EditorInput';
|
|
14
|
-
import { ExpressionEditorContext } from './EditorContext';
|
|
15
|
-
import { ExpressionFunctionDocumentation } from './ExpressionFunctionDocumentation';
|
|
16
4
|
import { AggregatedBooleanQueryDocsLink, AggregatedScalarQueryDocsLink, BooleanQueryDocsLink, CumulativeAggregatedScalarQueryDocsLink, ObservableQueryDocsLink, QuantileAggregatedScalarQueryDocsLink, ScalarQueryDocsLink, } from '../../Utilities/Constants/DocumentationLinkConstants';
|
|
5
|
+
import { NamedQueryModuleId } from '../../Utilities/Constants/ModuleConstants';
|
|
6
|
+
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
17
7
|
import StringExtensions from '../../Utilities/Extensions/StringExtensions';
|
|
8
|
+
import AdaptableInput from '../../View/Components/AdaptableInput';
|
|
18
9
|
import { ButtonInfo } from '../../View/Components/Buttons/ButtonInfo';
|
|
10
|
+
import { CheckBox } from '../CheckBox';
|
|
19
11
|
import { CodeBlock } from '../CodeBlock';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { isValueValidDate } from '../../Utilities/Helpers/DateHelper';
|
|
23
|
-
import { AdaptableFormControlTextClear } from '../../View/Components/Forms/AdaptableFormControlTextClear';
|
|
12
|
+
import HelpBlock from '../HelpBlock';
|
|
13
|
+
import Panel from '../Panel';
|
|
24
14
|
import { Tabs } from '../Tabs';
|
|
15
|
+
import { DataTableEditor } from './DataTableEditor';
|
|
16
|
+
import { ExpressionEditorContext } from './EditorContext';
|
|
17
|
+
import EditorInput from './EditorInput';
|
|
18
|
+
import EditorInputWithWhereClause from './EditorInputWithWhereClause';
|
|
19
|
+
import { ExpressionFunctionDocumentation } from './ExpressionFunctionDocumentation';
|
|
20
|
+
import { useNamedQueryContext } from './NamedQueryContext';
|
|
21
|
+
import { NamedQueryEditor } from './NamedQueryEditor';
|
|
25
22
|
import { QueryBuilder } from './QueryBuilder';
|
|
23
|
+
export const baseClassName = `ab-ExpressionEditor`;
|
|
26
24
|
export function ExpressionEditor(props) {
|
|
27
25
|
var _a, _b, _c;
|
|
28
26
|
const { type, module } = props;
|
|
29
|
-
const [data, setData] = useState(props.initialData);
|
|
30
|
-
const [showColumnIds, setShowColumnIds] = useState(false);
|
|
31
|
-
const [inlineQuery, setInlineQuery] = useState(false);
|
|
32
|
-
const [showNamedQueries, setShowNamedQueries] = useState(false);
|
|
33
|
-
const baseClassName = `ab-ExpressionEditor`;
|
|
34
27
|
const [selectedFunction, setSelectedFunction] = useState(null);
|
|
35
28
|
const [expressionText, setExpressionText] = useState(props.value);
|
|
36
29
|
const { namedQuery, setNamedQuery } = useNamedQueryContext();
|
|
@@ -39,80 +32,20 @@ export function ExpressionEditor(props) {
|
|
|
39
32
|
const editorInput = type === 'observable' || type === 'aggregatedBoolean' ? (React.createElement(EditorInputWithWhereClause, { type: type, module: module, value: props.value, onChange: (value) => {
|
|
40
33
|
setExpressionText(value);
|
|
41
34
|
props.onChange(value);
|
|
42
|
-
}, testData:
|
|
35
|
+
}, testData: props.initialData, api: props.api })) : (
|
|
43
36
|
// 'boolean','scalar','aggregatedScalar'/'cumulativeAggregatedScalar'/'quantileAggregatedScalar'
|
|
44
37
|
(React.createElement(
|
|
45
38
|
EditorInput,
|
|
46
39
|
{ type: type, module: module, value: props.value, onChange: (value) => {
|
|
47
40
|
setExpressionText(value);
|
|
48
41
|
props.onChange(value);
|
|
49
|
-
}, testData:
|
|
42
|
+
}, testData: props.initialData, isFullExpression: props.isFullExpression, api: props.api }
|
|
50
43
|
)));
|
|
44
|
+
const adaptableFields = props.api.expressionApi.internalApi.getAvailableFields();
|
|
51
45
|
// currently only boolean and scalar expressions support nested calculated columns (calc cols which reference other calc cols)
|
|
52
46
|
const queryableColumns = type === 'scalar' || type === 'boolean' || type === 'aggregatedScalar'
|
|
53
47
|
? props.columns
|
|
54
48
|
: props.columns.filter((c) => !props.api.columnApi.isCalculatedColumn(c.columnId));
|
|
55
|
-
const getColValue = (column) => {
|
|
56
|
-
var _a;
|
|
57
|
-
return props.api.internalApi.getValueUsingField(data, (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId);
|
|
58
|
-
};
|
|
59
|
-
const updateColValue = (rowData, column, newValue) => {
|
|
60
|
-
var _a;
|
|
61
|
-
const updatedRowData = props.api.internalApi.setValueUsingField(rowData, (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId, newValue);
|
|
62
|
-
return Object.assign({}, updatedRowData);
|
|
63
|
-
};
|
|
64
|
-
const getColDateValue = (column) => {
|
|
65
|
-
const colValue = getColValue(column);
|
|
66
|
-
return colValue && isValueValidDate(colValue)
|
|
67
|
-
? new Date(colValue).toISOString().substr(0, 10)
|
|
68
|
-
: '';
|
|
69
|
-
};
|
|
70
|
-
const [searchInputValue, setSearchInputValue] = React.useState('');
|
|
71
|
-
const dataTableEditor = (React.createElement(React.Fragment, null,
|
|
72
|
-
React.createElement(Flex, { className: `${baseClassName}__columns-list`, flexDirection: "column", alignItems: "start", style: { marginTop: 2 } },
|
|
73
|
-
React.createElement(CheckBox, { checked: showColumnIds, onChange: (checked) => setShowColumnIds(checked), style: {
|
|
74
|
-
float: 'right',
|
|
75
|
-
margin: 0,
|
|
76
|
-
paddingTop: 'var(--ab-space-1)',
|
|
77
|
-
paddingBottom: 'var(--ab-space-1)',
|
|
78
|
-
} }, 'Show Column IDs'),
|
|
79
|
-
React.createElement(AdaptableFormControlTextClear, { value: searchInputValue, OnTextChange: setSearchInputValue, placeholder: "Filter columns...", style: { flex: 1, marginBottom: 3 } })),
|
|
80
|
-
React.createElement(FormLayout, { className: "ab-ExpressionEditor__columns", gridColumnGap: "var(--ab-space-1)", gridRowGap: "var(--ab-space-1)", sizes: ['auto', '100px'], style: { alignItems: 'stretch' } }, queryableColumns
|
|
81
|
-
.filter((column) => {
|
|
82
|
-
if (!searchInputValue) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
return (column.columnId.includes(searchInputValue) ||
|
|
86
|
-
column.friendlyName.includes(searchInputValue));
|
|
87
|
-
})
|
|
88
|
-
.map((column) => (React.createElement(FormRow, { key: column.columnId, label: React.createElement(EditorButton, { width: "100%", height: "100%", style: {
|
|
89
|
-
background: 'var(--ab-color-primary)',
|
|
90
|
-
cursor: 'grab',
|
|
91
|
-
marginRight: 'var(--ab-space-1)',
|
|
92
|
-
}, data: `[${column.columnId}]`, "data-name": "column", icon: "drag" },
|
|
93
|
-
React.createElement(Flex, { flexDirection: "column", alignItems: "start" }, showColumnIds ? `[${column.columnId}]` : column.friendlyName)) }, column.dataType === 'Number' ? (React.createElement(Input, { type: "number", "data-name": "column-input", "data-value": column.columnId, value: getColValue(column), onChange: (e) => setData(updateColValue(data, column, Number(e.target.value))), width: "100%", disabled: column.readOnly })) : column.dataType === 'String' ? (React.createElement(Input, { type: "text", "data-name": "column-input", "data-value": column.columnId, value: getColValue(column), onChange: (e) => setData(updateColValue(data, column, e.target.value)), width: "100%", disabled: column.readOnly })) : column.dataType === 'Date' ? (React.createElement(AdaptableInput, { type: "date", "data-name": "column-input", "data-value": column.columnId, value: getColDateValue(column), onChange: (e) => {
|
|
94
|
-
setData(updateColValue(data, column, new Date(e.target.value)));
|
|
95
|
-
}, style: { width: '100%' }, disabled: column.readOnly })) : column.dataType === 'Boolean' ? (React.createElement(CheckBox, { "data-name": "column-input", "data-value": column.columnId, checked: getColValue(column), onChange: (checked) => setData(updateColValue(data, column, checked)), disabled: column.readOnly })) : null))))));
|
|
96
|
-
const namedQueries = (React.createElement(Flex, { flexDirection: "column", alignItems: "start", style: { marginTop: 2 } },
|
|
97
|
-
React.createElement(CheckBox, { checked: showColumnIds, onChange: (checked) => setShowColumnIds(checked) }, "Show Column IDs"),
|
|
98
|
-
React.createElement(CheckBox, { checked: inlineQuery, onChange: (checked) => setInlineQuery(checked) }, "Inline Query"),
|
|
99
|
-
props.namedQueries.map((namedQuery) => (React.createElement(Flex, { key: namedQuery.Uuid, flexDirection: "column", alignItems: "start", style: {
|
|
100
|
-
padding: 3,
|
|
101
|
-
marginTop: 'var(--ab-space-2)',
|
|
102
|
-
marginBottom: 'var(--ab-space-2)',
|
|
103
|
-
width: '100%',
|
|
104
|
-
}, backgroundColor: "primarylight" },
|
|
105
|
-
' ',
|
|
106
|
-
React.createElement(EditorButton, { width: "100%", height: "100%", style: {
|
|
107
|
-
background: 'var(--ab-color-primary)',
|
|
108
|
-
cursor: 'grab',
|
|
109
|
-
}, data: inlineQuery ? namedQuery.BooleanExpression : `QUERY("${namedQuery.Name}")`, "data-name": "column", icon: "drag" },
|
|
110
|
-
React.createElement(Flex, { flexDirection: "column", alignItems: "start" }, namedQuery.Name)),
|
|
111
|
-
React.createElement(Flex, { alignItems: "start", style: {
|
|
112
|
-
padding: 5,
|
|
113
|
-
} }, showColumnIds
|
|
114
|
-
? namedQuery.BooleanExpression
|
|
115
|
-
: props.api.expressionApi.getAdaptableQueryExpressionWithColumnFriendlyNames(namedQuery)))))));
|
|
116
49
|
const showDocumentationLinks = props.api.internalApi.isDocumentationLinksDisplayed();
|
|
117
50
|
// @Bogdan i did this to be sure but i think we can get rid of this as the button does the same (and better IMO)
|
|
118
51
|
const showNamedQueryStuff = false;
|
|
@@ -159,14 +92,56 @@ export function ExpressionEditor(props) {
|
|
|
159
92
|
" Query documentation for more details and examples")),
|
|
160
93
|
React.createElement(Box, { flex: 1 }),
|
|
161
94
|
showNamedQueryStuff && saveAsNamedQueryElement),
|
|
162
|
-
React.createElement(Box, { className: `${baseClassName}
|
|
163
|
-
|
|
164
|
-
React.createElement(
|
|
165
|
-
|
|
166
|
-
|
|
95
|
+
React.createElement(Box, { className: `${baseClassName}__sidebar`, "data-name": "expression-sidebar", pb: 2, paddingLeft: 2, pr: 2 },
|
|
96
|
+
React.createElement(Panel, { bodyProps: { style: { height: '100%' } }, style: { height: '100%' } },
|
|
97
|
+
React.createElement(Tabs, { style: { height: '100%' }, variant: "" },
|
|
98
|
+
React.createElement(Tabs.Tab, { value: "column" }, "Columns"),
|
|
99
|
+
React.createElement(Tabs.Tab, { value: "field" }, "Fields"),
|
|
100
|
+
React.createElement(Tabs.Tab, { value: "named-query" }, "Named Queries"),
|
|
101
|
+
React.createElement(Tabs.Content, { flex: 1, style: { height: '100%' } },
|
|
102
|
+
React.createElement(DataTableEditor, { type: "column", dataFormatter: (value) => `[${value}]`, fields: queryableColumns.map((column) => ({
|
|
103
|
+
label: column.friendlyName,
|
|
104
|
+
value: column.columnId,
|
|
105
|
+
dataType: column.dataType,
|
|
106
|
+
readOnly: column.readOnly,
|
|
107
|
+
})), data: props.initialData })),
|
|
108
|
+
React.createElement(Tabs.Content, null, adaptableFields && adaptableFields.length > 0 ? (React.createElement(DataTableEditor, { type: "field", labels: {
|
|
109
|
+
showIds: 'Show Field path',
|
|
110
|
+
filterPlaceholder: 'Filter fields...',
|
|
111
|
+
}, dataFormatter: (value) => `FIELD("${value}")`, data: props.initialData, fields: adaptableFields === null || adaptableFields === void 0 ? void 0 : adaptableFields.map((field) => ({
|
|
112
|
+
label: field.label,
|
|
113
|
+
value: field.name,
|
|
114
|
+
dataType: field.dataType,
|
|
115
|
+
readOnly: true,
|
|
116
|
+
})) })) : (React.createElement(Text, { p: 2 }, "No Data Fields provided"))),
|
|
117
|
+
React.createElement(Tabs.Content, null, ArrayExtensions.IsNullOrEmpty(props.namedQueries) ? (React.createElement("div", null,
|
|
118
|
+
React.createElement(Text, { p: 2 }, "No Named Queries defined"),
|
|
119
|
+
React.createElement(Text, { fontSize: 2, padding: 2, p: 2 },
|
|
120
|
+
"Named Queries are saved Expressions which can be referenced in other Expressions using the ",
|
|
121
|
+
React.createElement("i", null, "QUERY"),
|
|
122
|
+
" keyword",
|
|
123
|
+
' '))) : (React.createElement(NamedQueryEditor, { namedQueries: props.namedQueries }))))))))));
|
|
167
124
|
const queryBuilderElement = (React.createElement(QueryBuilder, { module: module, query: expressionText, onChange: (query) => {
|
|
168
125
|
setExpressionText(query);
|
|
169
126
|
props.onChange(query);
|
|
127
|
+
}, getFields: (type) => {
|
|
128
|
+
return props.fields
|
|
129
|
+
.filter((field) => {
|
|
130
|
+
if (!type) {
|
|
131
|
+
return (field.dataType === 'String' ||
|
|
132
|
+
field.dataType === 'Number' ||
|
|
133
|
+
field.dataType === 'Boolean' ||
|
|
134
|
+
field.dataType === 'Date');
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return field.dataType === type;
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
.map((field) => ({
|
|
141
|
+
value: field.name,
|
|
142
|
+
label: field.label,
|
|
143
|
+
type: field.dataType,
|
|
144
|
+
}));
|
|
170
145
|
}, getColumns: (type) => {
|
|
171
146
|
return props.columns
|
|
172
147
|
.filter((column) => {
|
|
@@ -198,7 +173,7 @@ export function ExpressionEditor(props) {
|
|
|
198
173
|
} }, (() => {
|
|
199
174
|
switch (true) {
|
|
200
175
|
case showQueryBuilder && showExpressionEditor:
|
|
201
|
-
return (React.createElement(Tabs, { mb: 2, p: 2, minHeight: 0, flex: 1 },
|
|
176
|
+
return (React.createElement(Tabs, { "data-name": "editor-selector-tabs", mb: 2, p: 2, minHeight: 0, flex: 1 },
|
|
202
177
|
React.createElement(Tabs.Tab, { value: "editor" }, "Expression Editor"),
|
|
203
178
|
React.createElement(Tabs.Tab, { value: "ui" }, "Query Builder"),
|
|
204
179
|
React.createElement(Tabs.Content, null, editorElement),
|
|
@@ -2,9 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { InputProps } from './index';
|
|
3
3
|
export type NumberInputProps = {
|
|
4
4
|
onChange: (value: number) => void;
|
|
5
|
+
noArrows?: boolean;
|
|
5
6
|
} & Omit<InputProps, 'onChange'>;
|
|
6
7
|
/**
|
|
7
8
|
* This component allows - and empty values as intermediery values
|
|
8
9
|
* it calls change only with valid numeric values
|
|
9
10
|
*/
|
|
10
|
-
export declare const NumberInput: React.
|
|
11
|
+
export declare const NumberInput: React.ForwardRefExoticComponent<Pick<NumberInputProps, "children" | "size" | "name" | "tabIndex" | "color" | "style" | "cite" | "data" | "form" | "label" | "p" | "slot" | "span" | "summary" | "title" | "pattern" | "start" | "hidden" | "content" | "default" | "flex" | "wrap" | "open" | "padding" | "multiple" | "disabled" | "checked" | "download" | "list" | "order" | "target" | "rows" | "src" | "className" | "onTransitionEnd" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEndCapture" | "opacity" | "value" | "step" | "sizes" | "variant" | "tx" | "as" | "css" | "key" | "m" | "margin" | "mt" | "marginTop" | "mr" | "marginRight" | "mb" | "marginBottom" | "ml" | "marginLeft" | "mx" | "marginX" | "my" | "marginY" | "pt" | "paddingTop" | "pr" | "paddingRight" | "pb" | "paddingBottom" | "pl" | "paddingLeft" | "px" | "paddingX" | "py" | "paddingY" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "display" | "verticalAlign" | "overflow" | "overflowX" | "overflowY" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "fontStyle" | "textAlign" | "bg" | "backgroundColor" | "alignItems" | "alignContent" | "justifyItems" | "justifyContent" | "flexWrap" | "flexDirection" | "flexGrow" | "flexShrink" | "flexBasis" | "justifySelf" | "alignSelf" | "sx" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "noValidate" | "optimum" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "srcDoc" | "srcLang" | "srcSet" | "type" | "useMap" | "wmode" | "noArrows"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import Input from './index';
|
|
3
|
+
import Input, { baseClassName } from './index';
|
|
4
|
+
import join from '../utils/join';
|
|
3
5
|
/**
|
|
4
6
|
* This component allows - and empty values as intermediery values
|
|
5
7
|
* it calls change only with valid numeric values
|
|
6
8
|
*/
|
|
7
|
-
export const NumberInput = (props) => {
|
|
9
|
+
export const NumberInput = React.forwardRef((props, ref) => {
|
|
8
10
|
const [value, setValue] = React.useState(() => {
|
|
9
11
|
var _a;
|
|
10
12
|
// awlays controlled
|
|
@@ -37,5 +39,6 @@ export const NumberInput = (props) => {
|
|
|
37
39
|
setValue(props.value);
|
|
38
40
|
}
|
|
39
41
|
}, [props.value, value]);
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
+
const { noArrows } = props, restOfProps = __rest(props, ["noArrows"]);
|
|
43
|
+
return (React.createElement(Input, Object.assign({}, restOfProps, { ref: ref, className: join(noArrows ? `${baseClassName}--no-arrows` : '', props.className), value: value, onBlur: handleBlur, onChange: handleChange })));
|
|
44
|
+
});
|