@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
60 lines (59 loc) • 2.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlertSelectQueryWizard = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const AdaptablePopover_1 = require("../../AdaptablePopover");
const WizardPanel_1 = tslib_1.__importDefault(require("../../../components/WizardPanel"));
const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
const CheckBox_1 = require("../../../components/CheckBox");
const rebass_1 = require("rebass");
const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
class AlertSelectQueryWizard extends React.Component {
constructor(props) {
super(props);
this.state = {
HasExpression: StringExtensions_1.default.IsNotNullOrEmpty(this.props.data.Rule.BooleanExpression),
};
}
render() {
return (React.createElement("div", { "data-name": 'alert-query' },
React.createElement(WizardPanel_1.default, null,
React.createElement(HelpBlock_1.default, null,
"A Query is used if the alert triggering is dependent on value in other columns in the row.",
React.createElement("br", null),
React.createElement("br", null),
"If so, then alert will only be triggered if the Query evaluates as true."),
React.createElement(rebass_1.Flex, { alignItems: "center", flexDirection: "row", marginTop: 2 },
React.createElement(CheckBox_1.CheckBox, { marginRight: 3, marginLeft: 2, onChange: (checked) => this.onOtherExpressionOptionChanged(checked), checked: this.state.HasExpression }, "Use Query"),
' ',
React.createElement(AdaptablePopover_1.AdaptablePopover, { headerText: 'Alert: Query', bodyText: [
'Create a query (in next step) which will stipulate other cell values required for the Alert to be triggered.',
] })))));
}
onOtherExpressionOptionChanged(checked) {
this.setState({ HasExpression: checked }, () => this.props.updateGoBackState());
}
canNext() {
return true;
}
canBack() {
return true;
}
next() {
// if we have an expression and its null then create an empty one
if (!this.state.HasExpression) {
this.props.data.Rule.BooleanExpression = undefined;
}
}
back() {
/* no implementation */
}
getIndexStepIncrement() {
return this.state.HasExpression ? 1 : 2;
}
getIndexStepDecrement() {
return 1;
}
}
exports.AlertSelectQueryWizard = AlertSelectQueryWizard;