@adaptabletools/adaptable 17.0.0-canary.7 → 17.0.0-canary.9
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/base.css +14 -0
- package/base.css.map +1 -1
- package/bundle.cjs.js +122 -122
- package/index.css +16 -0
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +8 -8
- package/src/Api/Internal/LayoutInternalApi.d.ts +2 -2
- package/src/Api/Internal/LayoutInternalApi.js +4 -4
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +1 -1
- package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +6 -0
- package/src/Utilities/Services/ModuleService.js +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +1 -1
- package/src/View/Components/FilterForm/FilterForm.js +9 -2
- package/src/View/Components/FilterForm/QuickFilterForm.js +4 -3
- package/src/View/Components/FilterForm/QuickFilterValues.d.ts +2 -2
- package/src/View/Components/FilterForm/QuickFilterValues.js +1 -1
- package/src/View/Components/Selectors/PermittedValuesSelector.d.ts +5 -4
- package/src/View/Components/Selectors/PermittedValuesSelector.js +25 -3
- package/src/View/GridFilter/GridFilterPopup.js +7 -5
- package/src/View/GridFilter/GridFilterViewPanel.js +1 -1
- package/src/View/GridFilter/useGridFilterExpressionEditor.d.ts +2 -0
- package/src/View/GridFilter/useGridFilterExpressionEditor.js +9 -1
- package/src/components/Datepicker/index.js +3 -3
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +2 -2
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +6 -0
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +7 -1
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +14 -2
- package/src/components/ExpressionEditor/QueryBuilder/booleanExpressions.js +1 -0
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +1 -1
- package/src/components/Select/Select.js +47 -20
- package/src/metamodel/adaptable.metamodel.d.ts +1 -1
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +5 -2
- package/src/parser/src/predicate/types.d.ts +1 -1
- package/src/parser/src/types.d.ts +1 -1
- package/src/renderReactRoot.js +16 -10
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -29,7 +29,7 @@ const QueryViewPanelComponent = (props) => {
|
|
|
29
29
|
runQuery();
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
const buttonExpand = (React.createElement(ButtonExpand_1.ButtonExpand, { disabled: isSuspended, accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", onClick: onExpand, tooltip: "
|
|
32
|
+
const buttonExpand = (React.createElement(ButtonExpand_1.ButtonExpand, { disabled: isSuspended, accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", onClick: onExpand, tooltip: "Edit the Expression in UI", marginLeft: 1 }));
|
|
33
33
|
const renderTextInput = () => {
|
|
34
34
|
return props.viewType === 'Toolbar' ? (React.createElement(FieldWrap_1.default, { marginRight: 1, width: 500 },
|
|
35
35
|
buttonExpand,
|
|
@@ -21,4 +21,6 @@ export declare const useGridFilterExpressionEditor: () => {
|
|
|
21
21
|
unSuspendGridFilter: () => void;
|
|
22
22
|
setGridFilterExpression: (expression: string) => void;
|
|
23
23
|
gridFilterAccessLevel: import("../../types").AccessLevel;
|
|
24
|
+
gridFilterHelpPage: string;
|
|
25
|
+
gridFilterLinkDisabled: boolean;
|
|
24
26
|
};
|
|
@@ -27,6 +27,8 @@ const useGridFilterExpressionEditor = () => {
|
|
|
27
27
|
const onAddCachedQuery = (cachedQuery) => {
|
|
28
28
|
dispatch(SystemRedux.SystemCachedQueryAdd(cachedQuery));
|
|
29
29
|
};
|
|
30
|
+
const gridFilterHelpPage = adaptable.ModuleService.getModuleById('GridFilter').moduleInfo.HelpPage;
|
|
31
|
+
const gridFilterLinkDisabled = !adaptable.api.internalApi.isDocumentationLinksDisplayed();
|
|
30
32
|
React.useEffect(() => {
|
|
31
33
|
adaptable.api.eventApi.on('AdaptableReady', () => {
|
|
32
34
|
setIsAdaptableReady(true);
|
|
@@ -45,7 +47,11 @@ const useGridFilterExpressionEditor = () => {
|
|
|
45
47
|
let availableColumns = adaptable.api.columnApi.getColumns().map((col) => {
|
|
46
48
|
return {
|
|
47
49
|
label: col.friendlyName,
|
|
48
|
-
onClick: () =>
|
|
50
|
+
onClick: () => {
|
|
51
|
+
// Bogdan - im sure there is a better way to do this check with fancy operators i dont know
|
|
52
|
+
const newExp = StringExtensions_1.default.IsNotNullOrEmpty(expression) ? expression : '';
|
|
53
|
+
setExpression(newExp + `[${col.columnId}]`);
|
|
54
|
+
},
|
|
49
55
|
};
|
|
50
56
|
});
|
|
51
57
|
const clearQuery = () => {
|
|
@@ -123,6 +129,8 @@ const useGridFilterExpressionEditor = () => {
|
|
|
123
129
|
adaptable.api.gridFilterApi.setGridFilterExpression(expression);
|
|
124
130
|
},
|
|
125
131
|
gridFilterAccessLevel,
|
|
132
|
+
gridFilterHelpPage,
|
|
133
|
+
gridFilterLinkDisabled,
|
|
126
134
|
};
|
|
127
135
|
};
|
|
128
136
|
exports.useGridFilterExpressionEditor = useGridFilterExpressionEditor;
|
|
@@ -17,13 +17,13 @@ const DatepickerContext_1 = require("./DatepickerContext");
|
|
|
17
17
|
const addDays_1 = tslib_1.__importDefault(require("date-fns/addDays"));
|
|
18
18
|
const addBusinessDays_1 = tslib_1.__importDefault(require("date-fns/addBusinessDays"));
|
|
19
19
|
const react_day_picker_1 = require("react-day-picker");
|
|
20
|
-
const DatepickerOverlay = ({ onHide, children, onKeyDown, }) => {
|
|
20
|
+
const DatepickerOverlay = ({ onHide, children, onKeyDown, onMouseDown, }) => {
|
|
21
21
|
const domRef = React.useRef(null);
|
|
22
22
|
React.useEffect(() => {
|
|
23
23
|
var _a;
|
|
24
24
|
(_a = domRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
25
25
|
}, []);
|
|
26
|
-
return (React.createElement("div", { className: "ab-Datepicker-Overlay", ref: domRef, tabIndex: -1, onKeyDown: onKeyDown, onBlur: (e) => {
|
|
26
|
+
return (React.createElement("div", { className: "ab-Datepicker-Overlay", ref: domRef, tabIndex: -1, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onBlur: (e) => {
|
|
27
27
|
var _a;
|
|
28
28
|
const { relatedTarget } = e;
|
|
29
29
|
const node = domRef.current;
|
|
@@ -87,7 +87,7 @@ exports.Datepicker = React.forwardRef((props, ref) => {
|
|
|
87
87
|
}, accessLevel: 'Full' })) : null;
|
|
88
88
|
const calendarButton = (React.createElement(SimpleButton_1.default, { disabled: disabled, variant: "text", icon: "calendar", tooltip: "Date", iconSize: 20, px: 0, py: 0, onClick: () => setVisible(true) }));
|
|
89
89
|
return (React.createElement(rebass_1.Flex, null,
|
|
90
|
-
React.createElement(OverlayTrigger_1.default, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { onHide: () => setVisible(false), onKeyDown: (e) => {
|
|
90
|
+
React.createElement(OverlayTrigger_1.default, { visible: visible, render: () => (React.createElement(DatepickerOverlay, { onMouseDown: props.onMouseDown, onHide: () => setVisible(false), onKeyDown: (e) => {
|
|
91
91
|
if (e.key === 'Escape' || e.key === 'Enter') {
|
|
92
92
|
setVisible(false, e.key);
|
|
93
93
|
}
|
|
@@ -110,9 +110,9 @@ const QueryBuilder = (props) => {
|
|
|
110
110
|
} },
|
|
111
111
|
React.createElement(QueryBuilderContext.Provider, { value: context },
|
|
112
112
|
React.createElement(rebass_1.Box, { className: QUERY_BUILDER_CLASSNAME },
|
|
113
|
-
React.createElement(HelpBlock_1.default, { mt: 2, mb: 2, p: 2, fontSize: 3 }, "Build the Grid Filter by adding Column Conditions and AND / OR Groups as required"),
|
|
113
|
+
React.createElement(HelpBlock_1.default, { "data-name": "query-builder-help", mt: 2, mb: 2, p: 2, fontSize: 3 }, "Build the Grid Filter by adding Column Conditions and AND / OR Groups as required"),
|
|
114
114
|
errorOrEditor,
|
|
115
|
-
React.createElement(Panel_1.default, { variant: "default", header: "AdapTableQL Expression", mt: 3 },
|
|
115
|
+
React.createElement(Panel_1.default, { "data-name": "query-builder-expression-preview", variant: "default", header: "AdapTableQL Expression", mt: 3 },
|
|
116
116
|
React.createElement(rebass_1.Box, { className: `${QUERY_BUILDER_CLASSNAME}__expression`, minHeight: 48, my: 2, p: 3 }, expressionStr || 'Outputted Expression will display here'))))));
|
|
117
117
|
};
|
|
118
118
|
exports.QueryBuilder = QueryBuilder;
|
|
@@ -17,6 +17,12 @@ export declare const PrimiteValueInput: (props: {
|
|
|
17
17
|
*/
|
|
18
18
|
lefthandColumnIdParam: string;
|
|
19
19
|
}) => JSX.Element;
|
|
20
|
+
export declare const PrimitiveMultiValueInput: (props: {
|
|
21
|
+
inputType: ExpressionFunctionInputType;
|
|
22
|
+
value: any[];
|
|
23
|
+
onChange(values: any[]): void;
|
|
24
|
+
lefthandColumnIdParam: string;
|
|
25
|
+
}) => JSX.Element;
|
|
20
26
|
export declare const ExpressionSelector: (props: {
|
|
21
27
|
value: BooleanFunctionName;
|
|
22
28
|
dataType: AdaptableColumn['dataType'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CombinatorSelector = exports.ExpressionSelector = exports.PrimiteValueInput = exports.PrimitiveColumnSelector = void 0;
|
|
3
|
+
exports.CombinatorSelector = exports.ExpressionSelector = exports.PrimitiveMultiValueInput = exports.PrimiteValueInput = exports.PrimitiveColumnSelector = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
@@ -104,6 +104,12 @@ const PrimiteValueInput = (props) => {
|
|
|
104
104
|
editor));
|
|
105
105
|
};
|
|
106
106
|
exports.PrimiteValueInput = PrimiteValueInput;
|
|
107
|
+
const PrimitiveMultiValueInput = (props) => {
|
|
108
|
+
return (react_1.default.createElement(PermittedValuesSelector_1.PermittedValuesSelector, { isMulti: true, allowNewValues: true, value: props.value, columnId: props.lefthandColumnIdParam, onChange: (value) => {
|
|
109
|
+
props.onChange(value);
|
|
110
|
+
} }));
|
|
111
|
+
};
|
|
112
|
+
exports.PrimitiveMultiValueInput = PrimitiveMultiValueInput;
|
|
107
113
|
const ExpressionSelector = (props) => {
|
|
108
114
|
var _a;
|
|
109
115
|
const { getExpressions } = (0, QueryBuilder_1.useQueryBuilderContext)();
|
|
@@ -145,12 +145,24 @@ const PrimitiveFunctionEditor = (props) => {
|
|
|
145
145
|
}, value: props.predicate.operator })),
|
|
146
146
|
react_1.default.createElement(rebass_1.Flex, { flex: 1, ml: 2 }, restOfFunctionInputDataTypes.map((type, index) => {
|
|
147
147
|
var _a;
|
|
148
|
-
|
|
148
|
+
let value = restOfArgs[index];
|
|
149
|
+
const commonProps = {
|
|
150
|
+
key: type + index,
|
|
151
|
+
lefthandColumnIdParam: columnId,
|
|
152
|
+
inputType: type,
|
|
153
|
+
};
|
|
154
|
+
if (type.includes('[]')) {
|
|
155
|
+
return (react_1.default.createElement(QueryBuilderInputs_1.PrimitiveMultiValueInput, Object.assign({}, commonProps, { value: restOfArgs, onChange: (values) => {
|
|
156
|
+
const args = [...props.predicate.args.slice(0, 1), ...values];
|
|
157
|
+
props.onChange(Object.assign(Object.assign({}, props.predicate), { args }));
|
|
158
|
+
} })));
|
|
159
|
+
}
|
|
160
|
+
return (react_1.default.createElement(QueryBuilderInputs_1.PrimiteValueInput, Object.assign({}, commonProps, { value: (_a = restOfArgs[index]) !== null && _a !== void 0 ? _a : null, onChange: (value) => {
|
|
149
161
|
const args = [...props.predicate.args];
|
|
150
162
|
// +1 because col is the first argument
|
|
151
163
|
args[index + 1] = value;
|
|
152
164
|
props.onChange(Object.assign(Object.assign({}, props.predicate), { args }));
|
|
153
|
-
} }));
|
|
165
|
+
} })));
|
|
154
166
|
}))),
|
|
155
167
|
react_1.default.createElement(rebass_1.Box, { flex: 1 }),
|
|
156
168
|
react_1.default.createElement(QueryPredicateButtons, Object.assign({}, props))));
|
|
@@ -80,7 +80,7 @@ const getFunctionsForColumnType = (dataType, availableBooleanFunctions) => {
|
|
|
80
80
|
const functionDef = booleanExpressionFunctions_1.booleanExpressionFunctions[boolFnName];
|
|
81
81
|
const inputs = functionDef.inputs;
|
|
82
82
|
let matchingInputTypes = [];
|
|
83
|
-
if (Array.isArray(inputs[0])) {
|
|
83
|
+
if (inputs && Array.isArray(inputs[0])) {
|
|
84
84
|
matchingInputTypes = inputs.find((input) => input[0] === columnType);
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
@@ -15,21 +15,40 @@ const commonStyles = ({ isFocused, isDisabled, }) => {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
const Select = function (props) {
|
|
18
|
-
var _a, _b, _c, _d, _e;
|
|
19
|
-
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
|
+
const doesOptionMatchValue = function (option) {
|
|
20
20
|
if (typeof option.value === 'object' && option.value instanceof Date) {
|
|
21
21
|
return (0, date_fns_1.isSameDay)(option.value, props.value);
|
|
22
22
|
}
|
|
23
23
|
return option.value === props.value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
};
|
|
25
|
+
let selectedOption = null;
|
|
26
|
+
if (props.isMulti) {
|
|
27
|
+
selectedOption =
|
|
28
|
+
(_b = ((_a = props.value) !== null && _a !== void 0 ? _a : []).map((value) => {
|
|
29
|
+
var _a;
|
|
30
|
+
// return (props.value as any[]).includes(option.value);
|
|
31
|
+
const option = ((_a = props.options) !== null && _a !== void 0 ? _a : []).find(doesOptionMatchValue);
|
|
32
|
+
if (!option) {
|
|
33
|
+
return {
|
|
34
|
+
value,
|
|
35
|
+
label: value,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return option;
|
|
39
|
+
})) !== null && _b !== void 0 ? _b : null;
|
|
30
40
|
}
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
else {
|
|
42
|
+
selectedOption = (_d = ((_c = props.options) !== null && _c !== void 0 ? _c : []).find(doesOptionMatchValue)) !== null && _d !== void 0 ? _d : null;
|
|
43
|
+
if (!selectedOption && props.value !== undefined && props.value !== null) {
|
|
44
|
+
selectedOption = {
|
|
45
|
+
value: props.value,
|
|
46
|
+
label: props.value,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
let disabled = (_e = props.disabled) !== null && _e !== void 0 ? _e : false;
|
|
51
|
+
const accessLevel = (_f = props.accessLevel) !== null && _f !== void 0 ? _f : 'Full';
|
|
33
52
|
if (accessLevel === 'Hidden') {
|
|
34
53
|
return null;
|
|
35
54
|
}
|
|
@@ -52,7 +71,9 @@ const Select = function (props) {
|
|
|
52
71
|
};
|
|
53
72
|
}, []);
|
|
54
73
|
const SelectComponent = props.isCreatable ? creatable_1.default : react_select_1.default;
|
|
55
|
-
return (React.createElement(SelectComponent, { onInputChange: props.onInputChange, onFocus: props.onFocus, isLoading: props.isLoding, options: props.options, className: props.className, isDisabled: disabled, isMulti: props.isMulti, value: selectedOption, menuPosition: (
|
|
74
|
+
return (React.createElement(SelectComponent, { onInputChange: props.onInputChange, onFocus: props.onFocus, isLoading: props.isLoding, options: props.options, className: props.className, isDisabled: disabled, isMulti: props.isMulti, value: selectedOption, menuPosition: (_g = props.menuPosition) !== null && _g !== void 0 ? _g : 'absolute',
|
|
75
|
+
// This needed so the menu is not clipped by overflow: hidden
|
|
76
|
+
menuPortalTarget: document.body, isClearable: props.isClearable, onChange: (option) => {
|
|
56
77
|
if (props.isMulti) {
|
|
57
78
|
props.onChange(option.map((x) => x === null || x === void 0 ? void 0 : x.value));
|
|
58
79
|
}
|
|
@@ -85,25 +106,25 @@ const Select = function (props) {
|
|
|
85
106
|
},
|
|
86
107
|
// @ts-ignore
|
|
87
108
|
menu: (baseStyle, state) => {
|
|
88
|
-
return Object.assign(Object.assign(Object.assign({}, baseStyle), { zIndex: 999999, boxShadow: 'var(--ab-cmp-
|
|
109
|
+
return Object.assign(Object.assign(Object.assign({}, baseStyle), { zIndex: 999999, boxShadow: 'var(--ab-cmp-select-menu__box-shadow)', minWidth: 160 }), commonStyles(state));
|
|
89
110
|
},
|
|
90
111
|
// @ts-ignore
|
|
91
112
|
option: (baseStyle, state) => {
|
|
92
113
|
const style = Object.assign(Object.assign(Object.assign({}, baseStyle), commonStyles(state)), { '&:active': {
|
|
93
|
-
background: 'var(--ab-cmp-
|
|
114
|
+
background: 'var(--ab-cmp-select-option-active__background)',
|
|
94
115
|
}, opacity: state.isDisabled ? 0.5 : 1 });
|
|
95
116
|
if (state.isSelected) {
|
|
96
|
-
style.background = 'var(--ab-cmp-
|
|
97
|
-
style.color = 'var(--ab-cmp-
|
|
117
|
+
style.background = 'var(--ab-cmp-select-option-active__background)';
|
|
118
|
+
style.color = 'var(--ab-cmp-select-option-active__color)';
|
|
98
119
|
}
|
|
99
120
|
if (state.isFocused) {
|
|
100
|
-
style.background = 'var(--ab-cmp-
|
|
121
|
+
style.background = 'var(--ab-cmp-select-option-focused__background)';
|
|
101
122
|
}
|
|
102
123
|
return style;
|
|
103
124
|
},
|
|
104
125
|
// @ts-ignore
|
|
105
126
|
input: (baseStyle, state) => {
|
|
106
|
-
return Object.assign(Object.assign({}, baseStyle), { padding: props.size === 'small' ? 0 : baseStyle.padding, color: 'var(--ab-cmp-
|
|
127
|
+
return Object.assign(Object.assign({}, baseStyle), { padding: props.size === 'small' ? 0 : baseStyle.padding, color: 'var(--ab-cmp-select__color)' });
|
|
107
128
|
},
|
|
108
129
|
valueContainer: (baseStyle) => {
|
|
109
130
|
return Object.assign(Object.assign({}, baseStyle), { padding: props.size === 'small' ? `0 var(--ab-space-1)` : baseStyle.padding });
|
|
@@ -117,10 +138,10 @@ const Select = function (props) {
|
|
|
117
138
|
state;
|
|
118
139
|
return Object.assign(Object.assign(Object.assign({}, baseStyle), commonStyles(state)), {
|
|
119
140
|
// height: 30,
|
|
120
|
-
minHeight: props.size === 'small' ? 0 : 32, boxShadow: state.isFocused ? 'var(--ab-
|
|
141
|
+
minHeight: props.size === 'small' ? 0 : 32, boxShadow: state.isFocused ? 'var(--ab-cmp-select-focused__box-shadow)' : 'none', outline: state.isFocused ? 'var(--ab-cmp-select-focused__outline)' : 'none', border: props.variant && props.variant === 'raised'
|
|
121
142
|
? '1px solid transparent'
|
|
122
|
-
: 'var(--ab-cmp-
|
|
123
|
-
border: 'var(--ab-cmp-
|
|
143
|
+
: 'var(--ab-cmp-select__border)', '&:hover': {
|
|
144
|
+
border: 'var(--ab-cmp-select__border)',
|
|
124
145
|
} });
|
|
125
146
|
},
|
|
126
147
|
// @ts-ignore
|
|
@@ -131,6 +152,12 @@ const Select = function (props) {
|
|
|
131
152
|
clearIndicator: (baseStyle) => {
|
|
132
153
|
return Object.assign(Object.assign({}, baseStyle), { padding: '2px 3px' });
|
|
133
154
|
},
|
|
155
|
+
multiValue: (baseStyle) => {
|
|
156
|
+
return Object.assign(Object.assign({}, baseStyle), { color: 'var(--ab-cmp-select__color)', background: 'var(--ab-cmp-select-multi-value__background)', border: 'var(--ab-cmp-select__border)' });
|
|
157
|
+
},
|
|
158
|
+
multiValueLabel: (baseStyle) => {
|
|
159
|
+
return Object.assign(Object.assign({}, baseStyle), { color: 'var(--ab-cmp-select__color)' });
|
|
160
|
+
},
|
|
134
161
|
} }));
|
|
135
162
|
};
|
|
136
163
|
exports.Select = Select;
|