(partialEx, groupIndex, index)
| 12674 | }); |
| 12675 | } |
| 12676 | updateExpression(partialEx, groupIndex, index) { |
| 12677 | const groups = [ |
| 12678 | ...this.state.groups |
| 12679 | ]; |
| 12680 | const group = groups[groupIndex]; |
| 12681 | const ex = (0, _sanddanceReact.SandDance).VegaDeckGl.util.clone(group.expressions[index]); |
| 12682 | if (ex.name !== partialEx.name) { |
| 12683 | //choose an appropriate operator when switching data type |
| 12684 | const oldColumn = getColumnWithName(ex.name, this.state.sortedColumns); |
| 12685 | const newColumn = getColumnWithName(partialEx.name, this.state.sortedColumns); |
| 12686 | const oldType = oldColumn && oldColumn.type; |
| 12687 | const newType = newColumn && newColumn.type; |
| 12688 | if (oldType !== newType) { |
| 12689 | const newOperators = (0, _searchTerm.getValidOperators)(newColumn).map((validOperator)=>validOperator[0]); |
| 12690 | //see if old operator is compatible |
| 12691 | if (newOperators.indexOf(ex.operator) < 0) //not compatible, so choose "equal" |
| 12692 | partialEx.operator = "=="; |
| 12693 | } |
| 12694 | } |
| 12695 | Object.assign(ex, partialEx); |
| 12696 | clearExpressionValidation(ex); |
| 12697 | group.expressions[index] = ex; |
| 12698 | this.setState({ |
| 12699 | groups |
| 12700 | }); |
| 12701 | } |
| 12702 | deleteExpression(groupIndex, index) { |
| 12703 | const groups = [ |
| 12704 | ...this.state.groups |
no test coverage detected