@adaptabletools/adaptable 18.0.17 → 18.1.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/agGrid.d.ts +4 -3
  2. package/agGrid.js +4 -3
  3. package/base.css +7 -2
  4. package/base.css.map +1 -1
  5. package/index.css +11 -2
  6. package/index.css.map +1 -1
  7. package/package.json +2 -2
  8. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -4
  9. package/src/AdaptableOptions/ActionColumnOptions.d.ts +1 -1
  10. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +52 -11
  11. package/src/AdaptableOptions/ExportOptions.d.ts +20 -7
  12. package/src/AdaptableOptions/ExpressionOptions.d.ts +12 -2
  13. package/src/AdaptableOptions/Fdc3Options.d.ts +48 -43
  14. package/src/Api/ColumnApi.d.ts +5 -0
  15. package/src/Api/Events/Fdc3MessageInfo.d.ts +5 -7
  16. package/src/Api/ExpressionApi.d.ts +2 -2
  17. package/src/Api/Fdc3Api.d.ts +14 -19
  18. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  20. package/src/Api/Implementation/ConfigApiImpl.js +3 -0
  21. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +14 -16
  22. package/src/Api/Implementation/Fdc3ApiImpl.js +36 -12
  23. package/src/Api/Internal/AlertInternalApi.d.ts +17 -2
  24. package/src/Api/Internal/AlertInternalApi.js +196 -25
  25. package/src/Api/Internal/ColumnFilterInternalApi.d.ts +2 -0
  26. package/src/Api/Internal/ColumnFilterInternalApi.js +20 -0
  27. package/src/Api/Internal/ExportInternalApi.d.ts +3 -3
  28. package/src/Api/Internal/ExportInternalApi.js +31 -17
  29. package/src/Api/Internal/ExpressionInternalApi.d.ts +5 -1
  30. package/src/Api/Internal/ExpressionInternalApi.js +79 -0
  31. package/src/Api/Internal/Fdc3InternalApi.d.ts +8 -10
  32. package/src/Api/Internal/Fdc3InternalApi.js +6 -10
  33. package/src/Api/Internal/GridInternalApi.d.ts +29 -13
  34. package/src/Api/Internal/GridInternalApi.js +129 -39
  35. package/src/PredefinedConfig/Common/AdaptableField.d.ts +18 -0
  36. package/src/PredefinedConfig/Common/AdaptableField.js +1 -0
  37. package/src/PredefinedConfig/Common/AdaptableIcon.d.ts +1 -1
  38. package/src/PredefinedConfig/Common/AdaptablePredicate.js +22 -1
  39. package/src/PredefinedConfig/Common/Fdc3Context.d.ts +7 -226
  40. package/src/PredefinedConfig/Common/Fdc3Context.js +43 -31
  41. package/src/PredefinedConfig/Common/Fdc3Intent.d.ts +6 -89
  42. package/src/PredefinedConfig/Common/Fdc3Intent.js +26 -73
  43. package/src/PredefinedConfig/Common/RowSummary.d.ts +2 -1
  44. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  45. package/src/Redux/ActionsReducers/FormatColumnRedux.js +0 -3
  46. package/src/Strategy/AdaptableModuleBase.js +1 -3
  47. package/src/Strategy/AlertModule.d.ts +1 -1
  48. package/src/Strategy/AlertModule.js +8 -8
  49. package/src/Utilities/Constants/DocumentationLinkConstants.js +4 -4
  50. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -1
  51. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
  52. package/src/Utilities/Services/Fdc3Service.d.ts +1 -1
  53. package/src/Utilities/Services/Fdc3Service.js +2 -2
  54. package/src/Utilities/Services/QueryLanguageService.d.ts +8 -4
  55. package/src/Utilities/Services/QueryLanguageService.js +105 -6
  56. package/src/Utilities/Services/ReportService.js +8 -5
  57. package/src/Utilities/Services/RowSummaryService.js +3 -1
  58. package/src/Utilities/divideBy100.d.ts +1 -0
  59. package/src/Utilities/divideBy100.js +30 -0
  60. package/src/Utilities/times100.d.ts +1 -0
  61. package/src/Utilities/times100.js +23 -0
  62. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +1 -1
  63. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +2 -2
  64. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -1
  65. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  66. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +5 -5
  67. package/src/View/Components/EntityRulesEditor/index.d.ts +1 -0
  68. package/src/View/Components/EntityRulesEditor/index.js +11 -7
  69. package/src/View/Components/ExpressionWizard.js +1 -1
  70. package/src/View/Components/FilterForm/FilterForm.js +2 -2
  71. package/src/View/Components/FilterForm/ListBoxFilterForm.js +2 -1
  72. package/src/View/Components/FilterForm/QuickFilterValues.d.ts +1 -1
  73. package/src/View/Components/FilterForm/QuickFilterValues.js +5 -5
  74. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +6 -2
  75. package/src/View/Components/Selectors/FieldSelector.d.ts +13 -0
  76. package/src/View/Components/Selectors/FieldSelector.js +21 -0
  77. package/src/View/Components/Selectors/PermittedValuesSelector.js +9 -5
  78. package/src/View/Export/Wizard/ReportRowsWizardSection.js +1 -1
  79. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  80. package/src/View/GridFilter/GridFilterExpressionEditor.js +1 -1
  81. package/src/View/Layout/Wizard/sections/GridFilterSection.js +4 -2
  82. package/src/View/Layout/Wizard/sections/RowSummarySection.js +7 -1
  83. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +1 -1
  84. package/src/View/Wizard/OnePageAdaptableWizard.js +3 -2
  85. package/src/agGrid/AdaptableAgGrid.d.ts +4 -6
  86. package/src/agGrid/AdaptableAgGrid.js +68 -49
  87. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -0
  88. package/src/agGrid/AgGridColumnAdapter.js +22 -0
  89. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  90. package/src/agGrid/FilterWrapper.js +12 -7
  91. package/src/agGrid/defaultAdaptableOptions.js +2 -2
  92. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.d.ts +0 -1
  93. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +0 -2
  94. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -16
  95. package/src/agGrid/editors/AdaptableDateEditor/index.js +5 -18
  96. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +6 -1
  97. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +4 -3
  98. package/src/agGrid/editors/AdaptableNumberEditor/index.js +5 -2
  99. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.d.ts +23 -0
  100. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +80 -0
  101. package/src/agGrid/editors/AdaptablePercentageEditor/index.d.ts +47 -0
  102. package/src/agGrid/editors/AdaptablePercentageEditor/index.js +148 -0
  103. package/src/components/Accordion.js +1 -1
  104. package/src/components/Datepicker/DatepickerContext.d.ts +0 -2
  105. package/src/components/Datepicker/index.js +3 -4
  106. package/src/components/ExpressionEditor/DataTableEditor.d.ts +17 -0
  107. package/src/components/ExpressionEditor/DataTableEditor.js +63 -0
  108. package/src/components/ExpressionEditor/EditorInput.js +22 -9
  109. package/src/components/ExpressionEditor/NamedQueryEditor.d.ts +5 -0
  110. package/src/components/ExpressionEditor/NamedQueryEditor.js +30 -0
  111. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +10 -0
  112. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +7 -4
  113. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +3 -2
  114. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +71 -13
  115. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +30 -22
  116. package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +9 -1
  117. package/src/components/ExpressionEditor/QueryBuilder/utils.js +41 -3
  118. package/src/components/ExpressionEditor/index.d.ts +3 -1
  119. package/src/components/ExpressionEditor/index.js +67 -94
  120. package/src/components/Input/NumberInput.d.ts +2 -1
  121. package/src/components/Input/NumberInput.js +7 -4
  122. package/src/components/OverlayTrigger/index.js +10 -6
  123. package/src/components/icons/column-outline.d.ts +3 -0
  124. package/src/components/icons/column-outline.js +4 -0
  125. package/src/components/icons/index.js +5 -1
  126. package/src/components/icons/sync.d.ts +3 -0
  127. package/src/components/icons/sync.js +4 -0
  128. package/src/env.js +2 -2
  129. package/src/metamodel/adaptable.metamodel.d.ts +121 -200
  130. package/src/metamodel/adaptable.metamodel.js +1 -1
  131. package/src/parser/src/predicate/mapExpressionToQlPredicate.d.ts +1 -0
  132. package/src/parser/src/predicate/mapExpressionToQlPredicate.js +12 -2
  133. package/src/parser/src/predicate/mapQlPredicateToExpression.js +4 -1
  134. package/src/parser/src/types.d.ts +101 -1
  135. package/src/types.d.ts +8 -6
  136. 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 PrimitiveColumnSelector = (props) => {
15
- return (React.createElement(Box, null,
16
- React.createElement(ColumnSelector, { value: props.columnId, type: props.type, onChange: (columnId) => {
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
- var _a, _b;
22
- const [type, setType] = React.useState(() => {
55
+ const adaptable = useAdaptable();
56
+ const hasFields = React.useMemo(() => {
23
57
  var _a;
24
- return 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('['))
25
- ? 'column-name'
26
- : 'input-value';
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(PrimitiveColumnSelector, { columnId: columnId, onChange: (col) => props.onChange(col), type: abColType }));
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, PrimitiveColumnSelector, PrimitiveMultiValueInput, } from './QueryBuilderInputs';
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: 'Add Column Condition', onClick: () => props.onNewPredicate('filter') },
22
- { label: 'Add AND / OR Group', onClick: () => props.onNewPredicate('group') },
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 [columnExpression, ...restOfArgs] = props.predicate.args;
100
- const col = columnExpression;
101
- let columnId = null;
102
- let columnDataType = null;
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 (col) {
109
- if (typeof col !== 'string' || !col.includes('[')) {
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
- columnId = col.replace(/[\[\]]/g, '');
113
- columnDataType = adaptable.api.columnApi.getColumnDataTypeForColumnId(columnId);
114
- columnInputDataType = mapColumnDataTypeToExpressionFunctionType(columnDataType);
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(PrimitiveColumnSelector, { onChange: (colId) => {
132
- props.onChange(Object.assign(Object.assign({}, props.predicate), { args: [colId], operator: null }));
133
- }, columnId: columnId })),
134
- columnId && columnDataType && (React.createElement(ExpressionSelector, { dataType: columnDataType, onExpressionChange: (operator) => {
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 (columnDataType === 'Boolean' && operator !== 'NOT') {
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: columnId,
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) => string;
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 { useState, useRef } from 'react';
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 { useNamedQueryContext } from './NamedQueryContext';
21
- import { NamedQueryModuleId } from '../../Utilities/Constants/ModuleConstants';
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: data, api: props.api })) : (
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: data, isFullExpression: props.isFullExpression, api: props.api }
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;
@@ -154,19 +87,59 @@ export function ExpressionEditor(props) {
154
87
  StringExtensions.IsNullOrEmpty(expressionText === null || expressionText === void 0 ? void 0 : expressionText.trim()) && renderQueryHints(type),
155
88
  showDocumentationLinks && (React.createElement(HelpBlock, { "data-name": "query-documentation", mt: 2, mb: 2, fontSize: 3 },
156
89
  React.createElement(ButtonInfo, { mr: 2, onClick: () => window.open(queryDocumentationLink, '_blank') }),
157
- "See ",
158
- StringExtensions.CapitaliseFirstLetter(type),
159
- " Query documentation for more details and examples")),
90
+ "See documentation for more details and examples")),
160
91
  React.createElement(Box, { flex: 1 }),
161
92
  showNamedQueryStuff && saveAsNamedQueryElement),
162
- React.createElement(Box, { className: `${baseClassName}__column-picker`, "data-name": "expression-column-picker", pb: 2, paddingLeft: 2, pr: 2 },
163
- ArrayExtensions.IsNotNullOrEmpty(props.namedQueries) && (React.createElement(Flex, { flexDirection: "row", alignItems: "start", p: 1, mt: 2, backgroundColor: "primarylight" },
164
- React.createElement(Radio, { checked: !showNamedQueries, onChange: (checked) => setShowNamedQueries(!checked), style: { marginRight: 10 } }, "Columns"),
165
- React.createElement(Radio, { checked: showNamedQueries, onChange: (checked) => setShowNamedQueries(checked), style: { marginLeft: 10, whiteSpace: 'nowrap' } }, "Named Queries"))),
166
- showNamedQueries ? React.createElement("div", null, namedQueries) : React.createElement("div", null, dataTableEditor))))));
93
+ React.createElement(Box, { className: `${baseClassName}__sidebar`, "data-name": "expression-sidebar", pb: 2, paddingLeft: 2, pr: 2 },
94
+ React.createElement(Panel, { bodyProps: { style: { height: '100%' } }, style: { height: '100%' } },
95
+ React.createElement(Tabs, { style: { height: '100%' }, variant: "" },
96
+ React.createElement(Tabs.Tab, { value: "column" }, "Columns"),
97
+ React.createElement(Tabs.Tab, { value: "field" }, "Fields"),
98
+ React.createElement(Tabs.Tab, { value: "named-query" }, "Named Queries"),
99
+ React.createElement(Tabs.Content, { flex: 1, style: { height: '100%' } },
100
+ React.createElement(DataTableEditor, { type: "column", dataFormatter: (value) => `[${value}]`, fields: queryableColumns.map((column) => ({
101
+ label: column.friendlyName,
102
+ value: column.columnId,
103
+ dataType: column.dataType,
104
+ readOnly: column.readOnly,
105
+ })), data: props.initialData })),
106
+ React.createElement(Tabs.Content, null, adaptableFields && adaptableFields.length > 0 ? (React.createElement(DataTableEditor, { type: "field", labels: {
107
+ showIds: 'Show Field path',
108
+ filterPlaceholder: 'Filter fields...',
109
+ }, dataFormatter: (value) => `FIELD("${value}")`, data: props.initialData, fields: adaptableFields === null || adaptableFields === void 0 ? void 0 : adaptableFields.map((field) => ({
110
+ label: field.label,
111
+ value: field.name,
112
+ dataType: field.dataType,
113
+ readOnly: true,
114
+ })) })) : (React.createElement(Text, { p: 2 }, "No Data Fields provided"))),
115
+ React.createElement(Tabs.Content, null, ArrayExtensions.IsNullOrEmpty(props.namedQueries) ? (React.createElement("div", null,
116
+ React.createElement(Text, { p: 2 }, "No Named Queries defined"),
117
+ React.createElement(Text, { fontSize: 2, padding: 2, p: 2 },
118
+ "Named Queries are saved Expressions which can be referenced in other Expressions using the ",
119
+ React.createElement("i", null, "QUERY"),
120
+ " keyword",
121
+ ' '))) : (React.createElement(NamedQueryEditor, { namedQueries: props.namedQueries }))))))))));
167
122
  const queryBuilderElement = (React.createElement(QueryBuilder, { module: module, query: expressionText, onChange: (query) => {
168
123
  setExpressionText(query);
169
124
  props.onChange(query);
125
+ }, getFields: (type) => {
126
+ return props.fields
127
+ .filter((field) => {
128
+ if (!type) {
129
+ return (field.dataType === 'String' ||
130
+ field.dataType === 'Number' ||
131
+ field.dataType === 'Boolean' ||
132
+ field.dataType === 'Date');
133
+ }
134
+ else {
135
+ return field.dataType === type;
136
+ }
137
+ })
138
+ .map((field) => ({
139
+ value: field.name,
140
+ label: field.label,
141
+ type: field.dataType,
142
+ }));
170
143
  }, getColumns: (type) => {
171
144
  return props.columns
172
145
  .filter((column) => {
@@ -198,7 +171,7 @@ export function ExpressionEditor(props) {
198
171
  } }, (() => {
199
172
  switch (true) {
200
173
  case showQueryBuilder && showExpressionEditor:
201
- return (React.createElement(Tabs, { mb: 2, p: 2, minHeight: 0, flex: 1 },
174
+ return (React.createElement(Tabs, { "data-name": "editor-selector-tabs", mb: 2, p: 2, minHeight: 0, flex: 1 },
202
175
  React.createElement(Tabs.Tab, { value: "editor" }, "Expression Editor"),
203
176
  React.createElement(Tabs.Tab, { value: "ui" }, "Query Builder"),
204
177
  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.FunctionComponent<NumberInputProps>;
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
- return React.createElement(Input, Object.assign({}, props, { value: value, onBlur: handleBlur, onChange: handleChange }));
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
+ });