@adaptabletools/adaptable-cjs 17.0.0-canary.1 → 17.0.0-canary.3
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 +1 -1
- package/index.css +1 -1
- package/package.json +3 -4
- package/src/Redux/ActionsReducers/ExportRedux.js +0 -2
- package/src/Redux/Store/AdaptableStore.js +1 -1
- package/src/Strategy/LayoutModule.js +3 -7
- package/src/Strategy/ThemeModule.js +2 -10
- package/src/View/Alert/Utilities/getAlertType.d.ts +1 -0
- package/src/View/Alert/Utilities/getAlertType.js +9 -1
- package/src/View/Alert/Utilities/getAvailablePredicates.js +1 -1
- package/src/View/Alert/Utilities/getDefaultAlertDefinition.js +5 -0
- package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +2 -6
- package/src/View/Alert/Wizard/AlertRulesWizardSection.js +8 -5
- package/src/View/Alert/Wizard/AlertScopeWizardSection.js +1 -1
- package/src/View/Alert/Wizard/AlertTypeWizardSection.js +2 -1
- package/src/View/Alert/Wizard/AlertWizard.js +1 -1
- package/src/View/Charting/useChartingElements.js +8 -10
- package/src/View/Components/Selectors/ColumnSelector.js +1 -1
- package/src/View/Export/ExportSelector.js +15 -17
- package/src/View/Export/ExportViewPanel.d.ts +4 -4
- package/src/View/Export/ExportViewPanel.js +14 -19
- package/src/View/Layout/LayoutStatusBarSubPanelPopover.d.ts +1 -1
- package/src/View/Layout/LayoutStatusBarSubPanelPopover.js +14 -9
- package/src/View/Layout/LayoutViewPanel.d.ts +1 -1
- package/src/View/Layout/LayoutViewPanel.js +7 -7
- package/src/View/Theme/ThemePopup.js +3 -18
- package/src/View/Theme/ThemeSelector.d.ts +5 -0
- package/src/View/Theme/ThemeSelector.js +34 -0
- package/src/View/Theme/ThemeStatusbar.d.ts +2 -0
- package/src/View/Theme/ThemeStatusbar.js +14 -0
- package/src/View/Theme/ThemeViewPanel.d.ts +2 -13
- package/src/View/Theme/ThemeViewPanel.js +7 -53
- package/src/agGrid/Adaptable.js +4 -4
- package/src/agGrid/AdaptableLogger.js +4 -3
- package/src/agGrid/agGridHelper.js +6 -6
- package/src/components/ColorPicker/ColorPicker.js +5 -5
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +6 -5
- package/src/components/Select/Select.d.ts +1 -0
- package/src/components/Select/Select.js +12 -9
- package/src/metamodel/adaptable.metamodel.d.ts +1 -1
- package/src/metamodel/adaptable.metamodel.js +5 -5
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +3 -1
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +9 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/src/View/Theme/ThemeStatusPanelPopover.d.ts +0 -2
- package/src/View/Theme/ThemeStatusPanelPopover.js +0 -25
|
@@ -13,6 +13,7 @@ const rebass_1 = require("rebass");
|
|
|
13
13
|
const ObjectFactory_1 = tslib_1.__importDefault(require("../../Utilities/ObjectFactory"));
|
|
14
14
|
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
|
|
15
15
|
const icons_1 = require("../../components/icons");
|
|
16
|
+
const ThemeSelector_1 = require("./ThemeSelector");
|
|
16
17
|
class ThemePopupComponent extends React.Component {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
@@ -31,23 +32,6 @@ class ThemePopupComponent extends React.Component {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
render() {
|
|
34
|
-
const availableThemes = this.props.api.themeApi.getThemes();
|
|
35
|
-
const theme = this.props.api.themeApi.getCurrentThemeObject();
|
|
36
|
-
const currentThemeDescription = theme.Description || theme.Name;
|
|
37
|
-
const optionThemes = availableThemes.map((theme) => {
|
|
38
|
-
if (typeof theme === 'string') {
|
|
39
|
-
// protection against old state, which could be string
|
|
40
|
-
theme = {
|
|
41
|
-
Name: theme,
|
|
42
|
-
Description: theme,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
value: theme.Name,
|
|
47
|
-
label: theme.Description,
|
|
48
|
-
onClick: () => this.onChangeTheme(theme.Name),
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
35
|
const isCustomTheme = this.props.api.themeApi
|
|
52
36
|
.getUserThemes()
|
|
53
37
|
.some((theme) => theme.Name === this.props.CurrentTheme);
|
|
@@ -71,7 +55,8 @@ class ThemePopupComponent extends React.Component {
|
|
|
71
55
|
newButton) },
|
|
72
56
|
React.createElement(FormLayout_1.default, null,
|
|
73
57
|
React.createElement(FormLayout_1.FormRow, { label: "Current Theme:" },
|
|
74
|
-
React.createElement(
|
|
58
|
+
React.createElement(rebass_1.Box, { maxWidth: 150 },
|
|
59
|
+
React.createElement(ThemeSelector_1.ThemeSelector, null)))),
|
|
75
60
|
isCustomTheme && (React.createElement(rebass_1.Box, { mt: 3 },
|
|
76
61
|
React.createElement(ThemeEditor_1.ThemeEditor, { accessLevel: this.props.accessLevel, theme: this.props.CurrentTheme })))));
|
|
77
62
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeSelector = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_redux_1 = require("react-redux");
|
|
7
|
+
const Select_1 = require("../../components/Select");
|
|
8
|
+
const ThemeRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ThemeRedux"));
|
|
9
|
+
const ModuleConstants_1 = require("../../Utilities/Constants/ModuleConstants");
|
|
10
|
+
const AdaptableContext_1 = require("../AdaptableContext");
|
|
11
|
+
const ThemeSelector = (props) => {
|
|
12
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
13
|
+
const dispatch = (0, react_redux_1.useDispatch)();
|
|
14
|
+
const availableThemes = adaptable.api.themeApi.getThemes();
|
|
15
|
+
const disabled = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule(ModuleConstants_1.ThemeModuleId) === 'ReadOnly';
|
|
16
|
+
const optionThemes = availableThemes.map((theme) => {
|
|
17
|
+
if (typeof theme === 'string') {
|
|
18
|
+
// protection against old state, which could be string
|
|
19
|
+
theme = {
|
|
20
|
+
Name: theme,
|
|
21
|
+
Description: theme,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
value: theme.Name,
|
|
26
|
+
label: theme.Description,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const theme = adaptable.api.themeApi.getCurrentThemeObject();
|
|
30
|
+
return (React.createElement(Select_1.Select, { "data-name": "select-theme-dropdown", options: optionThemes, value: theme.Name, disabled: disabled, size: props.size, onChange: (themeName) => {
|
|
31
|
+
dispatch(ThemeRedux.ThemeSelect(themeName));
|
|
32
|
+
} }));
|
|
33
|
+
};
|
|
34
|
+
exports.ThemeSelector = ThemeSelector;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeStatusbar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const rebass_1 = require("rebass");
|
|
7
|
+
const ThemeSelector_1 = require("./ThemeSelector");
|
|
8
|
+
const ThemeStatusbar = () => {
|
|
9
|
+
return (react_1.default.createElement(rebass_1.Box, { onClick: (event) => {
|
|
10
|
+
event.stopPropagation();
|
|
11
|
+
} },
|
|
12
|
+
react_1.default.createElement(ThemeSelector_1.ThemeSelector, { size: "small" })));
|
|
13
|
+
};
|
|
14
|
+
exports.ThemeStatusbar = ThemeStatusbar;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ViewPanelProps } from '../Components/SharedProps/ViewPanelProps';
|
|
2
|
-
import * as ThemeRedux from '../../Redux/ActionsReducers/ThemeRedux';
|
|
3
|
-
import { AdaptableTheme } from '../../PredefinedConfig/ThemeState';
|
|
4
|
-
import * as React from 'react';
|
|
5
3
|
export interface ThemeViewPanelComponentProps extends ViewPanelProps {
|
|
6
|
-
onSelectTheme: (theme: string) => ThemeRedux.ThemeSelectAction;
|
|
7
|
-
SystemThemes: any[];
|
|
8
|
-
UserThemes: AdaptableTheme[];
|
|
9
|
-
CurrentTheme: string;
|
|
10
4
|
}
|
|
11
|
-
declare
|
|
12
|
-
render(): any;
|
|
13
|
-
private onSelectTheme;
|
|
14
|
-
}
|
|
15
|
-
export declare const ThemeViewPanelControl: import("react-redux").ConnectedComponent<typeof ThemeViewPanelComponent, any>;
|
|
16
|
-
export {};
|
|
5
|
+
export declare const ThemeViewPanelControl: (props: ThemeViewPanelComponentProps) => JSX.Element;
|
|
@@ -2,59 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThemeViewPanelControl = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const ThemeRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ThemeRedux"));
|
|
6
5
|
const React = tslib_1.__importStar(require("react"));
|
|
7
6
|
const join_1 = tslib_1.__importDefault(require("../../components/utils/join"));
|
|
8
7
|
const GeneralConstants = tslib_1.__importStar(require("../../Utilities/Constants/GeneralConstants"));
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (typeof theme === 'string') {
|
|
17
|
-
// protection against old state, which could be string
|
|
18
|
-
theme = {
|
|
19
|
-
Name: theme,
|
|
20
|
-
Description: theme,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
label: theme.Description,
|
|
25
|
-
value: theme.Name,
|
|
26
|
-
onClick: () => this.onSelectTheme(theme),
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
const currentThemeObj = allThemes.find((theme) => theme.Name === this.props.CurrentTheme);
|
|
30
|
-
const currentThemeDescription = (_d = currentThemeObj === null || currentThemeObj === void 0 ? void 0 : currentThemeObj.Description) !== null && _d !== void 0 ? _d : this.props.CurrentTheme;
|
|
31
|
-
const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
32
|
-
const dropDownStyle = this.props.viewType === 'Toolbar'
|
|
33
|
-
? {
|
|
34
|
-
maxWidth: '25rem',
|
|
35
|
-
whiteSpace: 'nowrap',
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
textOverflow: 'ellipsis',
|
|
38
|
-
fontSize: 'small',
|
|
39
|
-
}
|
|
40
|
-
: { minWidth: '100%', fontSize: 'small' };
|
|
41
|
-
return (React.createElement("div", { className: (0, join_1.default)(this.props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__Theme__wrap`) },
|
|
42
|
-
React.createElement(Select_1.Select, { className: `ab-${elementType}__Theme__select`, options: themes, value: currentThemeObj === null || currentThemeObj === void 0 ? void 0 : currentThemeObj.Name, onChange: (theme) => this.onSelectTheme({ Name: theme }) })));
|
|
43
|
-
}
|
|
44
|
-
onSelectTheme(theme) {
|
|
45
|
-
this.props.onSelectTheme(theme.Name);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function mapStateToProps(state, ownProps) {
|
|
49
|
-
return {
|
|
50
|
-
SystemThemes: state.Theme.SystemThemes,
|
|
51
|
-
CurrentTheme: state.Theme.CurrentTheme,
|
|
52
|
-
UserThemes: state.Theme.UserThemes,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function mapDispatchToProps(dispatch) {
|
|
56
|
-
return {
|
|
57
|
-
onSelectTheme: (theme) => dispatch(ThemeRedux.ThemeSelect(theme)),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
exports.ThemeViewPanelControl = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(ThemeViewPanelComponent);
|
|
8
|
+
const ThemeSelector_1 = require("./ThemeSelector");
|
|
9
|
+
const ThemeViewPanelControl = (props) => {
|
|
10
|
+
const elementType = props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
11
|
+
return (React.createElement("div", { className: (0, join_1.default)(props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__Theme__wrap`) },
|
|
12
|
+
React.createElement(ThemeSelector_1.ThemeSelector, null)));
|
|
13
|
+
};
|
|
14
|
+
exports.ThemeViewPanelControl = ThemeViewPanelControl;
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -68,7 +68,7 @@ const AdaptableLogger_1 = require("./AdaptableLogger");
|
|
|
68
68
|
const attachAddaptableColumnTypes_1 = require("./attachAddaptableColumnTypes");
|
|
69
69
|
const FormatHelper_1 = require("../Utilities/Helpers/FormatHelper");
|
|
70
70
|
const Fdc3Service_1 = require("../Utilities/Services/Fdc3Service");
|
|
71
|
-
const
|
|
71
|
+
const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
|
|
72
72
|
const GROUP_PATH_SEPARATOR = '/';
|
|
73
73
|
// IMPORTANT - we need colId to be set in order for safeSetColDefs to work correctly
|
|
74
74
|
const assignColId = (colDef, logger) => {
|
|
@@ -1041,7 +1041,7 @@ class Adaptable {
|
|
|
1041
1041
|
const preparedColor = (0, StyleHelper_1.getVariableColor)(cellBackColor);
|
|
1042
1042
|
// if no range match, do not apply color (black in this case)
|
|
1043
1043
|
if (cellBackColor) {
|
|
1044
|
-
style.backgroundColor =
|
|
1044
|
+
style.backgroundColor = (0, tinycolor2_1.default)(preparedColor).setAlpha(alpha).toRgbString();
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
1047
|
if (styledColumn.PercentBarStyle && styledColumn.PercentBarStyle.CellText) {
|
|
@@ -5004,9 +5004,9 @@ class Adaptable {
|
|
|
5004
5004
|
convertCSSToExcelStyle(style) {
|
|
5005
5005
|
const getHexColor = (color) => {
|
|
5006
5006
|
const preparedColor = (0, StyleHelper_1.getVariableColor)(color);
|
|
5007
|
-
const t =
|
|
5007
|
+
const t = (0, tinycolor2_1.default)(preparedColor);
|
|
5008
5008
|
const a = t.getAlpha();
|
|
5009
|
-
return
|
|
5009
|
+
return tinycolor2_1.default.mix((0, tinycolor2_1.default)('white'), t, a * 100).toHexString();
|
|
5010
5010
|
};
|
|
5011
5011
|
let result = {};
|
|
5012
5012
|
if (style.backgroundColor != null) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AdaptableLogger = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
5
6
|
function humanize(ms) {
|
|
6
7
|
return `${ms}ms`;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
debug_1.default.humanize = humanize;
|
|
9
10
|
const performanceTime = (previousTime) => {
|
|
10
11
|
const now = performance.now();
|
|
11
12
|
return previousTime ? now - previousTime : now;
|
|
@@ -38,7 +39,7 @@ class AdaptableLogger {
|
|
|
38
39
|
}
|
|
39
40
|
constructor(adaptableId) {
|
|
40
41
|
this.adaptableId = adaptableId;
|
|
41
|
-
this.debugger =
|
|
42
|
+
this.debugger = (0, debug_1.default)(`Adaptable:${adaptableId}`);
|
|
42
43
|
this.infoLogger = this.debugger.extend(`info`);
|
|
43
44
|
this.infoLogger.log = console.info.bind(console);
|
|
44
45
|
this.successLogger = this.debugger.extend(`success`);
|
|
@@ -47,7 +47,7 @@ const Helper_1 = require("../Utilities/Helpers/Helper");
|
|
|
47
47
|
const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
|
|
48
48
|
const BadgeRenderer_1 = require("./BadgeRenderer");
|
|
49
49
|
const PercentBarRenderer_1 = require("./PercentBarRenderer");
|
|
50
|
-
const
|
|
50
|
+
const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
|
|
51
51
|
/**
|
|
52
52
|
* Adaptable AG Grid implementation is getting really big and unwieldy
|
|
53
53
|
* So lets put some of the more obvious 'Helper' functions here
|
|
@@ -637,8 +637,8 @@ class agGridHelper {
|
|
|
637
637
|
};
|
|
638
638
|
return {
|
|
639
639
|
Header: {
|
|
640
|
-
headerColor:
|
|
641
|
-
headerBackColor:
|
|
640
|
+
headerColor: (0, tinycolor2_1.default)(headerColStyle.color).toHexString(),
|
|
641
|
+
headerBackColor: (0, tinycolor2_1.default)(headerColStyle.backgroundColor).toHexString(),
|
|
642
642
|
headerFontFamily: headerColStyle.fontFamily,
|
|
643
643
|
headerFontSize: headerColStyle.fontSize,
|
|
644
644
|
headerFontStyle: headerColStyle.fontStyle,
|
|
@@ -655,9 +655,9 @@ class agGridHelper {
|
|
|
655
655
|
}),
|
|
656
656
|
},
|
|
657
657
|
Row: {
|
|
658
|
-
color:
|
|
659
|
-
backColor:
|
|
660
|
-
altBackColor:
|
|
658
|
+
color: (0, tinycolor2_1.default)(firstRowStyle.color).toHexString(),
|
|
659
|
+
backColor: (0, tinycolor2_1.default)(firstRowStyle.backgroundColor).toHexString(),
|
|
660
|
+
altBackColor: (0, tinycolor2_1.default)(secondRowStyle.backgroundColor).toHexString(),
|
|
661
661
|
fontFamily: firstRowStyle.fontFamily,
|
|
662
662
|
fontSize: firstRowStyle.fontSize,
|
|
663
663
|
fontStyle: firstRowStyle.fontStyle,
|
|
@@ -6,7 +6,7 @@ const React = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const rebass_1 = require("rebass");
|
|
7
7
|
const Input_1 = tslib_1.__importDefault(require("../Input"));
|
|
8
8
|
const StyleHelper_1 = require("../../Utilities/Helpers/StyleHelper");
|
|
9
|
-
const
|
|
9
|
+
const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
|
|
10
10
|
exports.ColorPicker = React.forwardRef((props, ref) => {
|
|
11
11
|
const ColorPalette = props.api.userInterfaceApi.getColorPalette();
|
|
12
12
|
let { api, value, includeAlpha = true } = props, restProps = tslib_1.__rest(props, ["api", "value", "includeAlpha"]);
|
|
@@ -17,14 +17,14 @@ exports.ColorPicker = React.forwardRef((props, ref) => {
|
|
|
17
17
|
const ABcolorChoices = React.createElement("datalist", { id: 'ABcolorChoices' }, ABcolorChoicesOptions);
|
|
18
18
|
const preparedValue = React.useMemo(() => {
|
|
19
19
|
const color = (0, StyleHelper_1.getVariableColor)(value);
|
|
20
|
-
return
|
|
20
|
+
return (0, tinycolor2_1.default)(color).toHexString();
|
|
21
21
|
}, [value]);
|
|
22
22
|
const preparedAlphaColor = React.useMemo(() => {
|
|
23
23
|
const color = (0, StyleHelper_1.getVariableColor)(value);
|
|
24
|
-
return [
|
|
24
|
+
return [(0, tinycolor2_1.default)(color).setAlpha(0).toRgbString(), (0, tinycolor2_1.default)(color).setAlpha(1).toRgbString()];
|
|
25
25
|
}, [value]);
|
|
26
26
|
const rangeBackround = `linear-gradient(90deg, ${preparedAlphaColor[0]} 0%, ${preparedAlphaColor[1]} 100%)`;
|
|
27
|
-
const alpha =
|
|
27
|
+
const alpha = (0, tinycolor2_1.default)(value).getAlpha();
|
|
28
28
|
return (React.createElement(rebass_1.Flex, { className: 'ColorPicker' },
|
|
29
29
|
React.createElement(Input_1.default, Object.assign({}, restProps, { mr: 2, onChange: (event) => {
|
|
30
30
|
var _a;
|
|
@@ -41,7 +41,7 @@ exports.ColorPicker = React.forwardRef((props, ref) => {
|
|
|
41
41
|
includeAlpha && (React.createElement(rebass_1.Flex, { alignItems: "center" },
|
|
42
42
|
React.createElement(rebass_1.Box, { mr: 1 }, "Opacity"),
|
|
43
43
|
React.createElement(Input_1.default, { className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
|
|
44
|
-
const color =
|
|
44
|
+
const color = (0, tinycolor2_1.default)(value).setAlpha(event.target.value).toRgbString();
|
|
45
45
|
props.onChange(color);
|
|
46
46
|
}, min: 0, max: 1, step: 0.01, type: "range" })))));
|
|
47
47
|
});
|
|
@@ -15,9 +15,10 @@ const Select_1 = require("../../Select");
|
|
|
15
15
|
const QueryBuilder_1 = require("./QueryBuilder");
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
const PrimitiveColumnSelector = (props) => {
|
|
18
|
-
return (react_1.default.createElement(
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
return (react_1.default.createElement(rebass_1.Box, null,
|
|
19
|
+
react_1.default.createElement(ColumnSelector_1.ColumnSelector, { value: props.columnId, type: props.type, onChange: (columnId) => {
|
|
20
|
+
props.onChange(`[${columnId}]`);
|
|
21
|
+
} })));
|
|
21
22
|
};
|
|
22
23
|
exports.PrimitiveColumnSelector = PrimitiveColumnSelector;
|
|
23
24
|
const PrimiteValueInput = (props) => {
|
|
@@ -96,11 +97,11 @@ const PrimiteValueInput = (props) => {
|
|
|
96
97
|
];
|
|
97
98
|
const typeOption = options.find((option) => option.value === type);
|
|
98
99
|
return (react_1.default.createElement(rebass_1.Flex, { "data-id": "query-input-wrapper", mr: 2 },
|
|
99
|
-
editor,
|
|
100
100
|
react_1.default.createElement(rebass_1.Flex, null,
|
|
101
101
|
react_1.default.createElement(Select_1.Select, { rederSingleValue: (value) => {
|
|
102
102
|
return (react_1.default.createElement(react_1.default.Fragment, null, typeOption.value === 'column-name' ? react_1.default.createElement(icons_1.Icon, { name: "grid" }) : react_1.default.createElement(icons_1.Icon, { name: "edit" })));
|
|
103
|
-
}, variant: "raised", value: typeOption.value, options: options, onChange: (value) => handleTypeChange(value) }))
|
|
103
|
+
}, variant: "raised", value: typeOption.value, options: options, onChange: (value) => handleTypeChange(value) })),
|
|
104
|
+
editor));
|
|
104
105
|
};
|
|
105
106
|
exports.PrimiteValueInput = PrimiteValueInput;
|
|
106
107
|
const ExpressionSelector = (props) => {
|
|
@@ -25,6 +25,7 @@ export type SelectProps<SelectValue extends unknown, IsMulti extends boolean = f
|
|
|
25
25
|
style?: React.CSSProperties;
|
|
26
26
|
onInputChange?: (value: string) => void;
|
|
27
27
|
variant?: 'default' | 'raised';
|
|
28
|
+
size?: 'small' | 'normal';
|
|
28
29
|
isCreatable?: boolean;
|
|
29
30
|
};
|
|
30
31
|
export declare const Select: <SelectValue extends unknown, IsMulti extends boolean = false>(props: SelectProps<SelectValue, IsMulti>) => JSX.Element;
|
|
@@ -15,21 +15,21 @@ const commonStyles = ({ isFocused, isDisabled, }) => {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
const Select = function (props) {
|
|
18
|
-
var _a, _b, _c, _d;
|
|
19
|
-
let selectedOption = (_a = props.options.find((option) => {
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
19
|
+
let selectedOption = (_b = ((_a = props.options) !== null && _a !== void 0 ? _a : []).find((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
|
-
})) !== null &&
|
|
24
|
+
})) !== null && _b !== void 0 ? _b : null;
|
|
25
25
|
if (!selectedOption && props.value !== undefined && props.value !== null) {
|
|
26
26
|
selectedOption = {
|
|
27
27
|
value: props.value,
|
|
28
28
|
label: props.value,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
let disabled = (
|
|
32
|
-
const accessLevel = (
|
|
31
|
+
let disabled = (_c = props.disabled) !== null && _c !== void 0 ? _c : false;
|
|
32
|
+
const accessLevel = (_d = props.accessLevel) !== null && _d !== void 0 ? _d : 'Full';
|
|
33
33
|
if (accessLevel === 'Hidden') {
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
@@ -52,7 +52,7 @@ const Select = function (props) {
|
|
|
52
52
|
};
|
|
53
53
|
}, []);
|
|
54
54
|
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: (
|
|
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: (_e = props.menuPosition) !== null && _e !== void 0 ? _e : 'fixed', isClearable: props.isClearable, onChange: (option) => {
|
|
56
56
|
if (props.isMulti) {
|
|
57
57
|
props.onChange(option.map((x) => x === null || x === void 0 ? void 0 : x.value));
|
|
58
58
|
}
|
|
@@ -81,7 +81,7 @@ const Select = function (props) {
|
|
|
81
81
|
},
|
|
82
82
|
// @ts-ignorets-ignore when fixed
|
|
83
83
|
menuPortal: (baseStyle) => {
|
|
84
|
-
return Object.assign(Object.assign({}, baseStyle), { zIndex: 999999 });
|
|
84
|
+
return Object.assign(Object.assign({}, baseStyle), { zIndex: 999999, textAlign: 'left' });
|
|
85
85
|
},
|
|
86
86
|
// @ts-ignore
|
|
87
87
|
menu: (baseStyle, state) => {
|
|
@@ -103,7 +103,10 @@ const Select = function (props) {
|
|
|
103
103
|
},
|
|
104
104
|
// @ts-ignore
|
|
105
105
|
input: (baseStyle, state) => {
|
|
106
|
-
return Object.assign(Object.assign({}, baseStyle), { color: 'var(--ab-cmp-input__color)' });
|
|
106
|
+
return Object.assign(Object.assign({}, baseStyle), { padding: props.size === 'small' ? 0 : baseStyle.padding, color: 'var(--ab-cmp-input__color)' });
|
|
107
|
+
},
|
|
108
|
+
valueContainer: (baseStyle) => {
|
|
109
|
+
return Object.assign(Object.assign({}, baseStyle), { padding: props.size === 'small' ? `0 var(--ab-space-1)` : baseStyle.padding });
|
|
107
110
|
},
|
|
108
111
|
// @ts-ignore
|
|
109
112
|
singleValue: (baseStyle, state) => {
|
|
@@ -114,7 +117,7 @@ const Select = function (props) {
|
|
|
114
117
|
state;
|
|
115
118
|
return Object.assign(Object.assign(Object.assign({}, baseStyle), commonStyles(state)), {
|
|
116
119
|
// height: 30,
|
|
117
|
-
minHeight: 32, boxShadow: state.isFocused ? 'var(--ab-focus__box-shadow)' : 'none', outline: state.isFocused ? 'var(--ab-focus__outline)' : 'none', border: props.variant && props.variant === 'raised'
|
|
120
|
+
minHeight: props.size === 'small' ? 0 : 32, boxShadow: state.isFocused ? 'var(--ab-focus__box-shadow)' : 'none', outline: state.isFocused ? 'var(--ab-focus__outline)' : 'none', border: props.variant && props.variant === 'raised'
|
|
118
121
|
? '1px solid transparent'
|
|
119
122
|
: 'var(--ab-cmp-input__border)', '&:hover': {
|
|
120
123
|
border: 'var(--ab-cmp-input__border)',
|
|
@@ -4628,7 +4628,7 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
4628
4628
|
"name": "report",
|
|
4629
4629
|
"kind": "R",
|
|
4630
4630
|
"desc": "The exported report",
|
|
4631
|
-
"ref": "
|
|
4631
|
+
"ref": "Report"
|
|
4632
4632
|
},
|
|
4633
4633
|
{
|
|
4634
4634
|
"name": "reportData",
|
|
@@ -7567,7 +7567,7 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
7567
7567
|
"name": "report",
|
|
7568
7568
|
"kind": "R",
|
|
7569
7569
|
"desc": "Report being exported",
|
|
7570
|
-
"ref": "
|
|
7570
|
+
"ref": "Report"
|
|
7571
7571
|
}
|
|
7572
7572
|
]
|
|
7573
7573
|
},
|
|
@@ -7868,8 +7868,8 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
7868
7868
|
}
|
|
7869
7869
|
]
|
|
7870
7870
|
},
|
|
7871
|
-
"
|
|
7872
|
-
"name": "
|
|
7871
|
+
"Report": {
|
|
7872
|
+
"name": "Report",
|
|
7873
7873
|
"kind": "I",
|
|
7874
7874
|
"desc": "A Report which can export data from AdapTable",
|
|
7875
7875
|
"props": [
|
|
@@ -7920,7 +7920,7 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
7920
7920
|
"name": "report",
|
|
7921
7921
|
"kind": "R",
|
|
7922
7922
|
"desc": "Definition of Report being Run",
|
|
7923
|
-
"ref": "
|
|
7923
|
+
"ref": "Report"
|
|
7924
7924
|
},
|
|
7925
7925
|
{
|
|
7926
7926
|
"name": "reportData",
|
|
@@ -80,7 +80,9 @@ function mapExpressionToQlPredicate(expression) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
catch (err) {
|
|
83
|
-
return {
|
|
83
|
+
return {
|
|
84
|
+
errorMessage: `Query Builder does not support the expression: ${expression}`,
|
|
85
|
+
};
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
exports.mapExpressionToQlPredicate = mapExpressionToQlPredicate;
|
|
@@ -38,6 +38,9 @@ function mapQlPredicateToExpression(predicate) {
|
|
|
38
38
|
return `"${arg}"`;
|
|
39
39
|
}
|
|
40
40
|
if (typeof arg === 'object') {
|
|
41
|
+
if ((0, types_1.isQlLogicalOperator)(arg.operator)) {
|
|
42
|
+
return `(${mapQlPredicateToExpression(arg)})`;
|
|
43
|
+
}
|
|
41
44
|
return mapQlPredicateToExpression(arg);
|
|
42
45
|
}
|
|
43
46
|
if (typeof arg === 'boolean') {
|
|
@@ -48,6 +51,12 @@ function mapQlPredicateToExpression(predicate) {
|
|
|
48
51
|
if (typeof firstArg === 'object') {
|
|
49
52
|
firstArg = mapQlPredicateToExpression(firstArg);
|
|
50
53
|
}
|
|
54
|
+
if ((0, types_1.isQlLogicalOperator)(operator)) {
|
|
55
|
+
// need to compose with AND [] AND ...
|
|
56
|
+
return mappedArgs.length
|
|
57
|
+
? `${firstArg} ${operatorSymbol} ${mappedArgs.join(` ${operatorSymbol} `)}`
|
|
58
|
+
: `${firstArg}`;
|
|
59
|
+
}
|
|
51
60
|
if (predicateType === 'INFIX') {
|
|
52
61
|
if (operator === 'BETWEEN') {
|
|
53
62
|
return `${firstArg} ${operatorSymbol} (${mappedArgs})`;
|