versacall-dashboards-library-react 2.0.16 → 2.0.17

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.
@@ -11,8 +11,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _styles = require("@material-ui/core/styles");
13
13
 
14
- var _CardActionArea = _interopRequireDefault(require("@material-ui/core/CardActionArea"));
15
-
16
14
  var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
17
15
 
18
16
  var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
@@ -287,6 +285,23 @@ var reorder = (list, startIndex, endIndex) => {
287
285
  return result;
288
286
  };
289
287
 
288
+ var determineIfAdvanced = condition => {
289
+ // console.log('determinIfAdvanced', condition);
290
+ if (condition) {
291
+ var split = condition.split(/[ ,]+/);
292
+
293
+ if (split.length === 3) {
294
+ var operator = operatorOptions.find(x => x.value === split[1]);
295
+
296
+ if (operator) {
297
+ return false;
298
+ }
299
+ }
300
+ }
301
+
302
+ return true;
303
+ };
304
+
290
305
  class DashboardsCellGlobalConditions extends _react.Component {
291
306
  constructor(props) {
292
307
  super(props);
@@ -527,17 +542,19 @@ class DashboardsCellGlobalConditions extends _react.Component {
527
542
  }
528
543
 
529
544
  copyCondition(condition) {
530
- var conditions = JSON.parse(JSON.stringify(this.props.value));
545
+ var newValue = JSON.parse(JSON.stringify(this.props.value));
531
546
  var newCondition = JSON.parse(JSON.stringify(condition));
532
547
  delete newCondition.index;
533
- conditions[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].push(newCondition);
548
+ var conditions = newValue[this.state.tabIndex === 0 ? 'styleConditions' : 'contentConditions'];
549
+ conditions.push(newCondition);
550
+ var advanced = determineIfAdvanced(newCondition.condition);
534
551
  this.props.updateValue({
535
- styleConditions: conditions.styleConditions,
536
- contentConditions: conditions.contentConditions
552
+ styleConditions: newValue.styleConditions,
553
+ contentConditions: newValue.contentConditions
537
554
  });
538
555
  this.setState(prevState => ({
539
- conditionIndex: "".concat(conditions[prevState.tabIndex === 0 ? 'styleConditions' : 'contentConditions'].length),
540
- advanced: false
556
+ conditionIndex: conditions.length - 1,
557
+ advanced: advanced
541
558
  }));
542
559
  }
543
560
 
@@ -609,9 +626,14 @@ class DashboardsCellGlobalConditions extends _react.Component {
609
626
  }
610
627
 
611
628
  selectCondition(index) {
612
- // TODO - Determine advanced state
629
+ var value = this.props.value;
630
+ var tabIndex = this.state.tabIndex;
631
+ var conditions = tabIndex === 1 ? value.contentConditions : value.styleConditions;
632
+ var condition = conditions[index];
633
+ var advanced = determineIfAdvanced(condition.condition);
613
634
  this.setState({
614
- conditionIndex: index
635
+ conditionIndex: index,
636
+ advanced: advanced
615
637
  });
616
638
  }
617
639
 
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "versacall": {
3
3
  "title": "Versacall Dashboards Library React",
4
4
  "applicationType": "react-library",
5
- "build": 16
5
+ "build": 17
6
6
  },
7
7
  "name": "versacall-dashboards-library-react",
8
- "version": "2.0.16",
8
+ "version": "2.0.17",
9
9
  "description": "Versacall Dashboards Library",
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.js",