react-autoql 3.5.0 → 3.5.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.
@@ -7,7 +7,7 @@ import utc from 'dayjs/plugin/utc';
7
7
  import timezone from 'dayjs/plugin/timezone';
8
8
  import axios from 'axios';
9
9
  import _$1 from 'lodash';
10
- import React, { Fragment, Component } from 'react';
10
+ import React, { Fragment, Component, createRef } from 'react';
11
11
  import _regeneratorRuntime from '@babel/runtime/regenerator';
12
12
  import PropTypes, { shape, string, number, bool, oneOf, arrayOf, func, instanceOf, oneOfType, array } from 'prop-types';
13
13
  import { BsArrowBarDown, BsArrowBarUp } from 'react-icons/bs';
@@ -48,7 +48,6 @@ import { symbol, symbolCircle, pie, arc } from 'd3-shape';
48
48
  import { entries } from 'd3-collection';
49
49
  import 'd3-transition';
50
50
  import Drawer from 'rc-drawer';
51
- import 'lodash.includes';
52
51
  import _has from 'lodash.has';
53
52
  import { Scrollbars } from 'react-custom-scrollbars';
54
53
  import LocalizedStrings from 'react-localization';
@@ -1721,8 +1720,9 @@ var lang = new LocalizedStrings({
1721
1720
  queryPrompt: 'Type your queries here ',
1722
1721
  seeMore: 'See more',
1723
1722
  dataMessengerOptions: 'Options menu',
1724
- openFilterLocking: 'Open filter locking menu',
1723
+ openFilterLocking: 'Manage Filters',
1725
1724
  closeFilterLocking: 'Close filter menu',
1725
+ filterLockingTitle: 'Filter Locking',
1726
1726
  noFiltersLocked: 'No Filters are locked yet',
1727
1727
  clearDataResponses: 'Clear all queries & responses',
1728
1728
  closeDataMessenger: 'Close Data Messenger',
@@ -1760,8 +1760,9 @@ var lang = new LocalizedStrings({
1760
1760
  queryPrompt: 'Escribe tus consultas aquí',
1761
1761
  seeMore: 'Ver más',
1762
1762
  dataMessengerOptions: 'Menú de opciones',
1763
- openFilterLocking: 'Abrir menú de filtrar',
1763
+ openFilterLocking: 'Administrar filtros',
1764
1764
  closeFilterLocking: 'Cerrar menú de filtrar',
1765
+ filterLockingTitle: 'Menú de Filtro',
1765
1766
  noFiltersLocked: 'Ningún filtro está bloqueado todavía',
1766
1767
  clearDataResponses: 'Borrar todas las consultas y respuestas',
1767
1768
  closeDataMessenger: 'Cerrar Data mesenger',
@@ -3097,9 +3098,10 @@ var fetchConditions = function fetchConditions() {
3097
3098
  token = _ref10.token,
3098
3099
  domain = _ref10.domain;
3099
3100
 
3100
- // if (!domain || !apiKey || !token) {
3101
- // return Promise.reject(new Error('Unauthenticated'))
3102
- // }
3101
+ if (!domain || !apiKey || !token) {
3102
+ return Promise.reject(new Error('Unauthenticated'));
3103
+ }
3104
+
3103
3105
  var url = "".concat(domain, "/autoql/api/v1/query/condition-locking?key=").concat(apiKey);
3104
3106
  var config = {
3105
3107
  headers: {
@@ -3452,6 +3454,12 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3452
3454
  if (!_isEqual(getThemeConfig(_this.props.themeConfig), getThemeConfig(prevProps.themeConfig))) {
3453
3455
  setCSSVars(getThemeConfig(_this.props.themeConfig));
3454
3456
  }
3457
+
3458
+ if (_this.props.inputValue && _this.props.inputValue !== prevProps.inputValue) {
3459
+ _this.setState({
3460
+ inputValue: _this.props.inputValue
3461
+ });
3462
+ }
3455
3463
  });
3456
3464
 
3457
3465
  _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
@@ -3735,6 +3743,12 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3735
3743
  queryText: _this.userSelectedValue
3736
3744
  });
3737
3745
  }
3746
+
3747
+ if (_this.props.isBackButtonClicked) {
3748
+ _this.setState({
3749
+ inputValue: ''
3750
+ });
3751
+ }
3738
3752
  });
3739
3753
 
3740
3754
  _defineProperty(_assertThisInitialized(_this), "moveCaretAtEnd", function (e) {
@@ -3772,7 +3786,9 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3772
3786
  onFocus: _this.moveCaretAtEnd,
3773
3787
  autoFocus: true
3774
3788
  }
3775
- }) // <QueryInputWithValidation
3789
+ }) :
3790
+ /*#__PURE__*/
3791
+ // <QueryInputWithValidation
3776
3792
  // authentication={getAuthentication(this.props.authentication)}
3777
3793
  // themeConfig={getThemeConfig(this.props.themeConfig)}
3778
3794
  // ref={(ref) => (this.queryValidationInputRef = ref)}
@@ -3789,7 +3805,7 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3789
3805
  // this.focus()
3790
3806
  // }}
3791
3807
  // />
3792
- : /*#__PURE__*/React.createElement("input", {
3808
+ React.createElement("input", {
3793
3809
  className: "react-autoql-chatbar-input".concat(_this.props.showChataIcon ? ' left-padding' : ''),
3794
3810
  placeholder: _this.props.placeholder || 'Type your queries here',
3795
3811
  value: _this.state.inputValue,
@@ -3846,7 +3862,8 @@ _defineProperty(QueryInput, "propTypes", {
3846
3862
  className: string,
3847
3863
  autoCompletePlacement: string,
3848
3864
  showLoadingDots: bool,
3849
- showChataIcon: bool
3865
+ showChataIcon: bool,
3866
+ inputValue: string
3850
3867
  });
3851
3868
 
3852
3869
  _defineProperty(QueryInput, "defaultProps", {
@@ -3860,6 +3877,8 @@ _defineProperty(QueryInput, "defaultProps", {
3860
3877
  className: null,
3861
3878
  showLoadingDots: true,
3862
3879
  showChataIcon: true,
3880
+ isBackButtonClicked: false,
3881
+ inputValue: undefined,
3863
3882
  source: [],
3864
3883
  onSubmit: function onSubmit() {},
3865
3884
  onResponseCallback: function onResponseCallback() {}
@@ -7957,6 +7976,10 @@ var ChataChart = /*#__PURE__*/function (_Component) {
7957
7976
  });
7958
7977
  var leftMargin = Math.ceil(maxYLabelWidth) + 55; // margin to include axis label
7959
7978
 
7979
+ if (isNaN(leftMargin)) {
7980
+ leftMargin = 96; // if there is no yAxisLabels, set leftMargin to default value as 96
7981
+ }
7982
+
7960
7983
  if (xAxisBBox.width > _this.props.width) {
7961
7984
  leftMargin += xAxisBBox.width - _this.props.width;
7962
7985
  }
@@ -8012,7 +8035,11 @@ var ChataChart = /*#__PURE__*/function (_Component) {
8012
8035
  var xAxis = select(_this.chartRef).select('.axis-Bottom').node();
8013
8036
  var xAxisBBox = xAxis ? xAxis.getBBox() : {};
8014
8037
  var bottomMargin = Math.ceil(xAxisBBox.height) + bottomLegendMargin + 40; // margin to include axis label
8015
- // only for bar charts (vertical grid lines mess with the axis size)
8038
+
8039
+ if (xAxisBBox.height === 0) {
8040
+ bottomMargin = 463; // if no xAxisBBox available, set bottomMarigin to default as 463
8041
+ } // only for bar charts (vertical grid lines mess with the axis size)
8042
+
8016
8043
 
8017
8044
  if (_this.props.type === 'bar' || _this.props.type === 'stacked_bar') {
8018
8045
  var innerTickSize = _this.props.height - _this.state.topMargin - _this.state.bottomMargin;
@@ -8273,7 +8300,8 @@ var ChataChart = /*#__PURE__*/function (_Component) {
8273
8300
 
8274
8301
  _defineProperty(_assertThisInitialized(_this), "renderStringColumnSelectorContent", function () {
8275
8302
  return /*#__PURE__*/React.createElement("div", {
8276
- className: "axis-selector-container"
8303
+ className: "axis-selector-container",
8304
+ id: "string-column-selector-content"
8277
8305
  }, /*#__PURE__*/React.createElement("ul", {
8278
8306
  className: "axis-selector-content"
8279
8307
  }, _this.props.dataConfig.stringColumnIndices.map(function (colIndex, i) {
@@ -8296,7 +8324,9 @@ var ChataChart = /*#__PURE__*/function (_Component) {
8296
8324
  currencySelectorState = _this$state2.currencySelectorState,
8297
8325
  quantitySelectorState = _this$state2.quantitySelectorState,
8298
8326
  ratioSelectorState = _this$state2.ratioSelectorState;
8299
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
8327
+ return /*#__PURE__*/React.createElement("div", {
8328
+ id: "chata-chart-popover"
8329
+ }, /*#__PURE__*/React.createElement("div", {
8300
8330
  className: "axis-selector-container"
8301
8331
  }, !!currencySelectorState.length && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
8302
8332
  className: "number-selector-header"
@@ -8439,7 +8469,8 @@ var ChataChart = /*#__PURE__*/function (_Component) {
8439
8469
  }
8440
8470
 
8441
8471
  return /*#__PURE__*/React.createElement("div", {
8442
- className: "axis-selector-container"
8472
+ className: "axis-selector-container",
8473
+ id: "legend-selector-content"
8443
8474
  }, /*#__PURE__*/React.createElement("ul", {
8444
8475
  className: "axis-selector-content"
8445
8476
  }, _this.props.dataConfig.stringColumnIndices.map(function (colIndex, i) {
@@ -10233,7 +10264,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10233
10264
  var formattedColumns = columns.map(function (col, i) {
10234
10265
  /**
10235
10266
  * EDIT:
10236
- * We no longer want to default to one over the other. Howeever,
10267
+ * We no longer want to default to one over the other. Howeever,
10237
10268
  * I would like to hang onto this code for now incase we do want to
10238
10269
  * include either/or in some cases in the future
10239
10270
  */
@@ -10973,9 +11004,9 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10973
11004
  var text = output.replace(/'/g, '');
10974
11005
 
10975
11006
  if (_get(queryResponse, 'data.data.persistent_locked_conditions').includes(text) || _get(queryResponse, 'data.data.session_locked_conditions').includes(text)) {
10976
- return "\n <a class=\"react-autoql-condition-link-filtered\">\n <span class=\"material-icons react-autoql-custom-icon\">lock</span>\n ".concat(' ', text, "\n </a>\n ");
11007
+ return "\n <a id=\"react-autoql-interpreted-value-label\" class=\"react-autoql-condition-link-filtered\">\n <span class=\"material-icons react-autoql-custom-icon\">lock</span>\n ".concat(' ', text, "\n </a>\n ");
10977
11008
  } else {
10978
- return "<a class=\"react-autoql-condition-link\">".concat(text, "</a>");
11009
+ return "<a id=\"react-autoql-interpreted-value-label\" class=\"react-autoql-condition-link\">".concat(text, "</a>");
10979
11010
  }
10980
11011
  }).replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/gi, function (output) {
10981
11012
  return moment.utc(output).format('ll').toString();
@@ -10983,19 +11014,19 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10983
11014
 
10984
11015
  return /*#__PURE__*/React.createElement("div", {
10985
11016
  id: id,
10986
- className: "condition-lock-reverse-translation"
11017
+ className: "react-autoql-condition-lock-reverse-translation"
10987
11018
  }, /*#__PURE__*/React.createElement("span", {
10988
11019
  style: {
10989
11020
  float: 'left',
10990
11021
  minHeight: 20
10991
11022
  } // onClick={() => {
10992
- // this.setState({
10993
- // isShowingInterpretation: !this.state.isShowingInterpretation
11023
+ // this.setState({
11024
+ // isShowingInterpretation: !this.state.isShowingInterpretation
10994
11025
  // })
10995
11026
  // }}
10996
11027
 
10997
- }, /*#__PURE__*/React.createElement(Icon // type={this.state.isShowingInterpretation ? 'caret-down' : 'caret-right' }
10998
- // data-tip={this.state.isShowingInterpretation ? "Hide query interpretation" : "Show query interpretation" }
11028
+ }, /*#__PURE__*/React.createElement(Icon // type={this.state.isShowingInterpretation ? 'caret-down' : 'caret-right' }
11029
+ // data-tip={this.state.isShowingInterpretation ? "Hide query interpretation" : "Show query interpretation" }
10999
11030
  , {
11000
11031
  type: "info" // data-for="react-autoql-interpretation"
11001
11032
 
@@ -11004,8 +11035,8 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
11004
11035
  isOpened: true // isOpened={this.state.isShowingInterpretation}
11005
11036
 
11006
11037
  }, /*#__PURE__*/React.createElement("strong", null, "Interpreted as:", ' '), /*#__PURE__*/React.createElement("span", {
11007
- onClick: function onClick() {
11008
- return _this.props.onConditionClickCallback();
11038
+ onClick: function onClick(e) {
11039
+ return _this.props.onConditionClickCallback(e);
11009
11040
  },
11010
11041
  dangerouslySetInnerHTML: {
11011
11042
  __html: "".concat(reverseTranslation)
@@ -11572,7 +11603,7 @@ var fetchNotificationCount = function fetchNotificationCount(_ref2) {
11572
11603
  Authorization: "Bearer ".concat(token)
11573
11604
  }
11574
11605
  });
11575
- var url = "".concat(domain, "/autoql/api/v1/data-alerts/notifications/summary/poll?key=").concat(apiKey, "&unacknowledged=").concat(unacknowledged);
11606
+ var url = "".concat(domain, "/autoql/api/v1/data-alerts/notifications/summary?key=").concat(apiKey, "&unacknowledged=").concat(unacknowledged);
11576
11607
  var config = {
11577
11608
  timeout: 180000
11578
11609
  };
@@ -12119,6 +12150,8 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12119
12150
  count: 0
12120
12151
  });
12121
12152
 
12153
+ _defineProperty(_assertThisInitialized(_this), "timerID", void 0);
12154
+
12122
12155
  _defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
12123
12156
  return _regeneratorRuntime.wrap(function _callee$(_context) {
12124
12157
  while (1) {
@@ -12148,6 +12181,7 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12148
12181
 
12149
12182
  _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
12150
12183
  _this._isMounted = false;
12184
+ clearInterval(_this.timerID);
12151
12185
  });
12152
12186
 
12153
12187
  _defineProperty(_assertThisInitialized(_this), "getNotificationCount", function (currentCount) {
@@ -12173,35 +12207,46 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12173
12207
 
12174
12208
  _defineProperty(_assertThisInitialized(_this), "subscribeToNotificationCount", function (count) {
12175
12209
  if (_this._isMounted) {
12176
- _this.getNotificationCount(count).then(function (newCount) {
12177
- // Got a new count, now we want to reconnect
12178
- _this.subscribeToNotificationCount(newCount);
12210
+ /**
12211
+ * For short polling notifications, we needed to set the interval on FE side.
12212
+ * Interval set to trigger every 90 seconds.
12213
+ */
12214
+ if (_this.timerID) {
12215
+ clearInterval(_this.timerID);
12216
+ }
12179
12217
 
12180
- _this.FAILED_POLL_ATTEMPTS = 0;
12181
- }).catch(function (error) {
12182
- if (_this.FAILED_POLL_ATTEMPTS === 5) {
12183
- var _error = new Error('There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.');
12218
+ _this.timerID = setInterval(function () {
12219
+ _this.getNotificationCount(count).then(function (newCount) {
12220
+ // Got a new count, now we want to reconnect
12221
+ _this.subscribeToNotificationCount(newCount);
12184
12222
 
12185
- console.error(_error);
12223
+ _this.FAILED_POLL_ATTEMPTS = 0;
12224
+ }).catch(function (error) {
12225
+ if (_this.FAILED_POLL_ATTEMPTS === 5) {
12226
+ var _error = new Error('There were 5 failed attempts to poll for notifications. Unsubscribing from notification count.');
12186
12227
 
12187
- _this.props.onErrorCallback(_error);
12228
+ console.error(_error);
12188
12229
 
12189
- return;
12190
- } else if (_get(error, 'response.status') == 504) {
12191
- // Timed out because there were no changes
12192
- // Let's connect again
12193
- _this.subscribeToNotificationCount();
12194
- } else {
12195
- // Something else went wrong, wait one second and reconnect
12196
- new Promise(function (resolve) {
12197
- return setTimeout(resolve, 1000);
12198
- }).then(function () {
12230
+ _this.props.onErrorCallback(_error);
12231
+
12232
+ clearInterval(_this.timerID);
12233
+ throw new Error(_error);
12234
+ } else if (_get(error, 'response.status') == 504) {
12235
+ // Timed out because there were no changes
12236
+ // Let's connect again
12199
12237
  _this.subscribeToNotificationCount();
12200
- });
12201
- }
12238
+ } else {
12239
+ // Something else went wrong, wait one second and reconnect
12240
+ new Promise(function (resolve) {
12241
+ return setTimeout(resolve, 1000);
12242
+ }).then(function () {
12243
+ _this.subscribeToNotificationCount();
12244
+ });
12245
+ }
12202
12246
 
12203
- _this.FAILED_POLL_ATTEMPTS += 1;
12204
- });
12247
+ _this.FAILED_POLL_ATTEMPTS += 1;
12248
+ });
12249
+ }, 90 * 1000);
12205
12250
  }
12206
12251
  });
12207
12252
 
@@ -13250,6 +13295,7 @@ var NotificationItem = /*#__PURE__*/function (_React$Component) {
13250
13295
  ref: function ref(r) {
13251
13296
  return _this.OUTPUT_REF = r;
13252
13297
  },
13298
+ isDashboardQuery: true,
13253
13299
  queryResponse: queryResponse,
13254
13300
  autoQLConfig: {
13255
13301
  enableDrilldowns: false
@@ -15065,6 +15111,8 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15065
15111
  }
15066
15112
  }
15067
15113
 
15114
+ _this.props.onSuccessAlert('Notification created!');
15115
+
15068
15116
  _this.setState({
15069
15117
  isEditModalVisible: false,
15070
15118
  customAlertsList: newDataAlertList
@@ -15253,7 +15301,7 @@ var DataAlerts = /*#__PURE__*/function (_React$Component) {
15253
15301
  className: "react-autoql-re-initialize-btn-text"
15254
15302
  }, /*#__PURE__*/React.createElement(Icon, {
15255
15303
  type: "warning-triangle"
15256
- }), ' ', " Resend")), /*#__PURE__*/React.createElement(Checkbox, {
15304
+ }), " Resend")), /*#__PURE__*/React.createElement(Checkbox, {
15257
15305
  themeConfig: getThemeConfig(_this.props.themeConfig),
15258
15306
  type: "switch",
15259
15307
  className: "react-autoql-notification-disable-checkbox"
@@ -15333,7 +15381,8 @@ _defineProperty(DataAlerts, "propTypes", {
15333
15381
  authentication: authenticationType,
15334
15382
  themeConfig: themeConfigType,
15335
15383
  onErrorCallback: PropTypes.func,
15336
- showCreateAlertBtn: PropTypes.bool
15384
+ showCreateAlertBtn: PropTypes.bool,
15385
+ onSuccessAlert: PropTypes.func
15337
15386
  });
15338
15387
 
15339
15388
  _defineProperty(DataAlerts, "defaultProps", {
@@ -15341,7 +15390,8 @@ _defineProperty(DataAlerts, "defaultProps", {
15341
15390
  themeConfig: themeConfigDefault,
15342
15391
  showCreateAlertBtn: false,
15343
15392
  onErrorCallback: function onErrorCallback() {},
15344
- onAlertInitializationCallback: function onAlertInitializationCallback() {}
15393
+ onAlertInitializationCallback: function onAlertInitializationCallback() {},
15394
+ onSuccessAlert: function onSuccessAlert() {}
15345
15395
  });
15346
15396
 
15347
15397
  var getInitialStateData$2 = function getInitialStateData(initialData) {
@@ -18288,8 +18338,8 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
18288
18338
  });
18289
18339
  }
18290
18340
  },
18291
- onConditionClickCallback: function onConditionClickCallback() {
18292
- _this.props.onConditionClickCallback();
18341
+ onConditionClickCallback: function onConditionClickCallback(e) {
18342
+ _this.props.onConditionClickCallback(e);
18293
18343
  }
18294
18344
  }));
18295
18345
  }
@@ -18309,7 +18359,7 @@ var ChatMessage = /*#__PURE__*/function (_React$Component) {
18309
18359
 
18310
18360
  _this.scrollIntoView();
18311
18361
  } else {
18312
- messageElement.style.maxHeight = '85%';
18362
+ messageElement.style.maxHeight = '90%';
18313
18363
  messageElement.style.height = "".concat(messageElement.offsetHeights, "px");
18314
18364
  }
18315
18365
  } catch (error) {
@@ -18824,6 +18874,24 @@ _defineProperty(Cascader, "defaultProps", {
18824
18874
  onSeeMoreClick: undefined
18825
18875
  });
18826
18876
 
18877
+ function accentColorAssist(col, amt) {
18878
+ var usePound = false;
18879
+
18880
+ if (col[0] == "#") {
18881
+ col = col.slice(1);
18882
+ usePound = true;
18883
+ }
18884
+
18885
+ var num = parseInt(col, 16);
18886
+ var r = (num >> 16) + amt;
18887
+ if (r > 255) r = 255;else if (r < 0) r = 0;
18888
+ var b = (num >> 8 & 0x00FF) + amt;
18889
+ if (b > 255) b = 255;else if (b < 0) b = 0;
18890
+ var g = (num & 0x0000FF) + amt;
18891
+ if (g > 255) g = 255;else if (g < 0) g = 0;
18892
+ return (usePound ? "#" : "") + (g | b << 8 | r << 16).toString(16);
18893
+ }
18894
+
18827
18895
  var autoCompleteArray$1 = [];
18828
18896
 
18829
18897
  var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
@@ -18844,6 +18912,10 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18844
18912
 
18845
18913
  _defineProperty(_assertThisInitialized(_this), "UNIQUE_ID", uuid.v4());
18846
18914
 
18915
+ _defineProperty(_assertThisInitialized(_this), "mouseInfoRef", /*#__PURE__*/createRef());
18916
+
18917
+ _defineProperty(_assertThisInitialized(_this), "mouseSettingRef", /*#__PURE__*/createRef());
18918
+
18847
18919
  _defineProperty(_assertThisInitialized(_this), "state", {
18848
18920
  inputValue: '',
18849
18921
  lastQuery: '',
@@ -18895,20 +18967,46 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18895
18967
  }
18896
18968
  }
18897
18969
 
18898
- _this.setState({
18899
- selectedConditions: array.sort(),
18900
- inputValue: '',
18901
- isFetchingConditions: false
18970
+ array.sort(function (a, b) {
18971
+ return a.keyword.toUpperCase() < b.keyword.toUpperCase() ? -1 : a.keyword > b.keyword ? 1 : 0;
18902
18972
  });
18973
+
18974
+ if (_this.props.initFilterText && _this.props.initFilterText !== '') {
18975
+ _this.setState({
18976
+ selectedConditions: array,
18977
+ isFetchingConditions: false
18978
+ });
18979
+
18980
+ for (var _i2 = 0; _i2 < array.length; _i2++) {
18981
+ if (array[_i2].keyword === _this.props.initFilterText) {
18982
+ _this.handleHighlightFilterRow(_i2);
18983
+
18984
+ return;
18985
+ }
18986
+ }
18987
+
18988
+ _this.animateInputTextAndSubmit(_this.props.initFilterText);
18989
+ } else {
18990
+ _this.setState({
18991
+ selectedConditions: array,
18992
+ inputValue: '',
18993
+ isFetchingConditions: false
18994
+ });
18995
+ }
18903
18996
  });
18904
18997
  } catch (error) {
18905
18998
  console.error(error);
18906
18999
  }
18907
19000
  });
18908
19001
 
19002
+ _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (prevProps, predState) {
19003
+ if (!_isEqual(getThemeConfig(_this.props.themeConfig), getThemeConfig(prevProps.themeConfig))) {
19004
+ setCSSVars(getThemeConfig(_this.props.themeConfig));
19005
+ }
19006
+ });
19007
+
18909
19008
  _defineProperty(_assertThisInitialized(_this), "getSuggestionValue", function (suggestion) {
18910
19009
  var array = _this.state.selectedConditions;
18911
- var tempId = uuid.v4();
18912
19010
 
18913
19011
  if (array.some(function (item) {
18914
19012
  return item.key === suggestion.name.canonical && item.value === suggestion.name.keyword;
@@ -18916,7 +19014,6 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18916
19014
  _this.handleShowMessage('warning', 'This condition has already been applied.');
18917
19015
  } else {
18918
19016
  array.push({
18919
- id: tempId,
18920
19017
  keyword: suggestion.name.keyword,
18921
19018
  value: suggestion.name.keyword,
18922
19019
  show_message: suggestion.name.show_message,
@@ -18926,13 +19023,16 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18926
19023
  });
18927
19024
 
18928
19025
  _this.setState({
18929
- selectedConditions: array,
18930
19026
  inputValue: ''
18931
19027
  });
18932
19028
 
18933
19029
  setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
18934
19030
  conditions: array
18935
- }));
19031
+ })).then(function () {
19032
+ _this.handleShowMessage('lock', "".concat(suggestion.name.keyword, " has been locked"));
19033
+
19034
+ _this.handleFetchFilteredList();
19035
+ });
18936
19036
  }
18937
19037
  });
18938
19038
 
@@ -18969,13 +19069,11 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18969
19069
  }
18970
19070
 
18971
19071
  var array = _this.state.selectedConditions;
18972
- array.splice(index, 1);
18973
-
18974
- _this.setState({
18975
- selectedConditions: array
18976
- });
19072
+ array.splice(index, 1); // this.setState({ selectedConditions: array })
18977
19073
 
18978
19074
  _this.handleShowMessage('unlock', 'Filter removed.');
19075
+
19076
+ ReactTooltip.hide();
18979
19077
  });
18980
19078
 
18981
19079
  _defineProperty(_assertThisInitialized(_this), "handlePersistConditionToggle", function (item) {
@@ -18991,7 +19089,9 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18991
19089
  }, function () {
18992
19090
  setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
18993
19091
  conditions: _this.state.selectedConditions
18994
- }));
19092
+ })).then(function () {
19093
+ _this.handleFetchFilteredList();
19094
+ });
18995
19095
 
18996
19096
  if (item.lock_flag === 0) {
18997
19097
  if (sessionConditions == null) sessionConditions = [];
@@ -19060,6 +19160,57 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19060
19160
  });
19061
19161
  });
19062
19162
 
19163
+ _defineProperty(_assertThisInitialized(_this), "timer", void 0);
19164
+
19165
+ _defineProperty(_assertThisInitialized(_this), "onEnterFilterHeaderInfo", function () {
19166
+ var el = document.getElementById('react-autoql-filter-description-id');
19167
+ _this.timer = setTimeout(function () {
19168
+ el.className = 'show';
19169
+ }, 500);
19170
+ });
19171
+
19172
+ _defineProperty(_assertThisInitialized(_this), "onLeaveFilterHeaderInfo", function () {
19173
+ var el = document.getElementById('react-autoql-filter-description-id');
19174
+ el.className = el.className.replace('show', '');
19175
+ clearTimeout(_this.timer);
19176
+ });
19177
+
19178
+ _defineProperty(_assertThisInitialized(_this), "onEnterFilterSettingInfo", function () {
19179
+ var el = document.getElementById('react-autoql-filter-setting-info-card');
19180
+ _this.timer = setTimeout(function () {
19181
+ el.className = 'show';
19182
+ }, 500);
19183
+ });
19184
+
19185
+ _defineProperty(_assertThisInitialized(_this), "onLeaveFilterSettingInfo", function () {
19186
+ var el = document.getElementById('react-autoql-filter-setting-info-card');
19187
+ el.className = el.className.replace('show', '');
19188
+ clearTimeout(_this.timer);
19189
+ });
19190
+
19191
+ _defineProperty(_assertThisInitialized(_this), "animateInputTextAndSubmit", function (text) {
19192
+ if (typeof text === 'string' && _get(text, 'length')) {
19193
+ var _loop = function _loop(i) {
19194
+ setTimeout(function () {
19195
+ _this.setState({
19196
+ inputValue: text.slice(0, i)
19197
+ });
19198
+
19199
+ if (i === text.length) {
19200
+ setTimeout(function () {
19201
+ var input = document.querySelector('#react-autoql-filter-menu-input');
19202
+ input.focus();
19203
+ }, 300);
19204
+ }
19205
+ }, i * 50);
19206
+ };
19207
+
19208
+ for (var i = 1; i <= text.length; i++) {
19209
+ _loop(i);
19210
+ }
19211
+ }
19212
+ });
19213
+
19063
19214
  _defineProperty(_assertThisInitialized(_this), "renderShowMessage", function () {
19064
19215
  return /*#__PURE__*/React.createElement("div", {
19065
19216
  id: "react-autoql-condition-show-message"
@@ -19068,29 +19219,6 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19068
19219
  }), " ", _this.state.showMessage.message);
19069
19220
  });
19070
19221
 
19071
- _defineProperty(_assertThisInitialized(_this), "renderAcceptConditionsButton", function () {
19072
- return /*#__PURE__*/React.createElement("div", {
19073
- key: "accept-conditions-btn",
19074
- className: "react-autoql-accept-conditions-button"
19075
- }, /*#__PURE__*/React.createElement("span", {
19076
- onClick: function onClick() {
19077
- setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
19078
- conditions: _this.state.selectedConditions
19079
- })).then(function () {
19080
- _this.props.onClose(true);
19081
- }).catch(function (e) {
19082
- //WIP showErrorMessage
19083
- console.error(e);
19084
- });
19085
- }
19086
- }, /*#__PURE__*/React.createElement(Icon, {
19087
- type: "lock",
19088
- style: {
19089
- verticalAlign: 'middle'
19090
- }
19091
- }), " Save"));
19092
- });
19093
-
19094
19222
  _defineProperty(_assertThisInitialized(_this), "render", function () {
19095
19223
  var containerWidth = _this.props.containerWidth;
19096
19224
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
@@ -19102,20 +19230,13 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19102
19230
  className: "react-autoql-condition-lock-header"
19103
19231
  }, /*#__PURE__*/React.createElement("div", {
19104
19232
  className: "react-autoql-filter-locking-title-container"
19105
- }, /*#__PURE__*/React.createElement("h3", null, "Filter Locking ", ' ', /*#__PURE__*/React.createElement(Icon, {
19233
+ }, /*#__PURE__*/React.createElement("h3", {
19234
+ className: "react-autoql-filter-locking-title"
19235
+ }, lang.filterLockingTitle, " ", ' ', /*#__PURE__*/React.createElement(Icon, {
19106
19236
  type: "info",
19107
- onMouseEnter: function onMouseEnter() {
19108
- return setTimeout(function () {
19109
- _this.setState({
19110
- isShowingInfo: true
19111
- });
19112
- }, 300);
19113
- },
19114
- onMouseLeave: function onMouseLeave() {
19115
- return _this.setState({
19116
- isShowingInfo: false
19117
- });
19118
- }
19237
+ ref: _this.mouseInfoRef,
19238
+ onMouseEnter: _this.onEnterFilterHeaderInfo,
19239
+ onMouseLeave: _this.onLeaveFilterHeaderInfo
19119
19240
  })), /*#__PURE__*/React.createElement("button", {
19120
19241
  onClick: function onClick() {
19121
19242
  _this.props.onClose();
@@ -19127,93 +19248,96 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19127
19248
  type: "close"
19128
19249
  }))), /*#__PURE__*/React.createElement("div", {
19129
19250
  className: "autoql-condition-locking-menu-container"
19130
- }, _this.state.isShowingInfo ? /*#__PURE__*/React.createElement("div", {
19131
- className: "react-autoql-filter-locking-empty-list"
19251
+ }, /*#__PURE__*/React.createElement("div", {
19252
+ id: "react-autoql-filter-description-id"
19132
19253
  }, /*#__PURE__*/React.createElement(Icon, {
19133
19254
  type: "info"
19134
- }), /*#__PURE__*/React.createElement("p", null, "Filters can be applied to narrow down your query results. Locking a filter ensures that only the specific data you wish to see is returned.")) : null, /*#__PURE__*/React.createElement(Autosuggest, {
19255
+ }), /*#__PURE__*/React.createElement("p", {
19256
+ className: "react-autoql-filter-info-text"
19257
+ }, "Filters can be applied to narrow down your query results. Locking a filter ensures that only the specific data you wish to see is returned.")), /*#__PURE__*/React.createElement(Autosuggest, {
19135
19258
  ref: function ref(_ref2) {
19136
19259
  _this.autoSuggest = _ref2;
19137
19260
  },
19261
+ id: "react-autoql-filter-menu-input",
19138
19262
  highlightFirstSuggestion: true,
19139
19263
  suggestions: _this.state.suggestions,
19140
19264
  onSuggestionsFetchRequested: _this.onSuggestionsFetchRequested,
19141
19265
  onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
19142
19266
  getSuggestionValue: _this.getSuggestionValue,
19143
19267
  renderSuggestion: function renderSuggestion(suggestion) {
19144
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("table", {
19145
- className: "autoql-condition-locking-menu-list"
19146
- }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
19147
- style: {
19148
- width: 300
19149
- }
19150
- }, suggestion.name.keyword), /*#__PURE__*/React.createElement("td", null, suggestion.name.show_message)))));
19268
+ console.log(suggestion);
19269
+
19270
+ if (!suggestion) {
19271
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("i", null, "No Suggestion Found"));
19272
+ } else {
19273
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
19274
+ id: "react-autoql-filter-table",
19275
+ className: "autoql-condition-locking-menu-list"
19276
+ }, /*#__PURE__*/React.createElement("tr", {
19277
+ id: "react-autoql-filter-table-row"
19278
+ }, /*#__PURE__*/React.createElement("td", {
19279
+ id: "react-autoql-filter-table-data",
19280
+ style: {
19281
+ width: 300
19282
+ }
19283
+ }, suggestion.name.keyword), /*#__PURE__*/React.createElement("td", {
19284
+ id: "react-autoql-filter-table-data"
19285
+ }, suggestion.name.show_message))));
19286
+ }
19151
19287
  },
19152
19288
  inputProps: {
19153
19289
  onChange: _this.onInputChange,
19154
19290
  value: _this.state.inputValue,
19155
19291
  disabled: _this.state.isFetchingConditions,
19156
19292
  placeholder: 'Search & select a filter',
19157
- className: 'react-autoql-condition-locking-input'
19293
+ className: 'react-autoql-condition-locking-input',
19294
+ id: 'react-autoql-filter-menu-input'
19158
19295
  }
19159
- }), _this.state.isShowingSettingInfo ? /*#__PURE__*/React.createElement("div", {
19160
- className: "react-autoql-filter-setting-info-card"
19161
- }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Icon, {
19296
+ }), /*#__PURE__*/React.createElement("div", {
19297
+ id: "react-autoql-filter-setting-info-card"
19298
+ }, /*#__PURE__*/React.createElement("p", {
19299
+ className: "react-autoql-filter-info-text"
19300
+ }, /*#__PURE__*/React.createElement(Icon, {
19162
19301
  type: "info"
19163
19302
  }), ' ', /*#__PURE__*/React.createElement("strong", null, "Persistent"), " filters remain locked at all times, unless the filter is removed.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Icon, {
19164
19303
  type: "info"
19165
- }), ' ', /*#__PURE__*/React.createElement("strong", null, "Session"), " filters remain locked until you end your browser session.")) : null)), _this.state.isFetchingConditions ? /*#__PURE__*/React.createElement("div", {
19166
- className: "condition-list-loading-container"
19304
+ }), ' ', /*#__PURE__*/React.createElement("strong", null, "Session"), " filters remain locked until you end your browser session.")))), _this.state.isFetchingConditions ? /*#__PURE__*/React.createElement("div", {
19305
+ className: "react-autoql-condition-list-loading-container"
19167
19306
  }, /*#__PURE__*/React.createElement(LoadingDots, null)) : /*#__PURE__*/React.createElement("div", {
19168
- className: "condition-list"
19307
+ className: "react-autoql-condition-list"
19169
19308
  }, _get(_this.state.selectedConditions, 'length') === 0 ? /*#__PURE__*/React.createElement("div", {
19170
- className: "empty-condition-list"
19171
- }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, lang.noFiltersLocked))) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
19172
- style: {
19173
- minHeight: 150
19174
- }
19175
- }, /*#__PURE__*/React.createElement("table", {
19176
- className: "condition-table"
19177
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("th", {
19178
- scope: "col"
19179
- }, "Filter"), /*#__PURE__*/React.createElement("th", {
19180
- scope: "col",
19309
+ className: "react-autoql-empty-condition-list"
19310
+ }, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, lang.noFiltersLocked))) : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("table", {
19311
+ className: "react-autoql-condition-table"
19312
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
19181
19313
  style: {
19182
- minWidth: 154
19314
+ width: '60%'
19183
19315
  }
19184
- }, "Settings", /*#__PURE__*/React.createElement(Icon, {
19316
+ }, "Filter"), /*#__PURE__*/React.createElement("th", null, "Settings", /*#__PURE__*/React.createElement(Icon, {
19185
19317
  type: "info",
19186
- onMouseEnter: function onMouseEnter() {
19187
- return setTimeout(function () {
19188
- _this.setState({
19189
- isShowingSettingInfo: true
19190
- });
19191
- }, 300);
19192
- },
19193
- onMouseLeave: function onMouseLeave() {
19194
- return _this.setState({
19195
- isShowingSettingInfo: false
19196
- });
19197
- }
19318
+ ref: _this.mouseSettingRef,
19319
+ onMouseEnter: _this.onEnterFilterSettingInfo,
19320
+ onMouseLeave: _this.onLeaveFilterSettingInfo
19198
19321
  })), /*#__PURE__*/React.createElement("th", {
19199
- scope: "col",
19200
19322
  style: {
19201
19323
  display: 'table-cell',
19202
19324
  verticalAlign: 'middle',
19203
- textAlign: 'right'
19325
+ textAlign: 'right',
19326
+ width: '35px'
19204
19327
  }
19205
- })), /*#__PURE__*/React.createElement("tbody", null, _this.state.selectedConditions.map(function (item, index) {
19328
+ }))), /*#__PURE__*/React.createElement("tbody", null, _this.state.selectedConditions.map(function (item, index) {
19206
19329
  return /*#__PURE__*/React.createElement("tr", {
19207
- key: index
19330
+ key: index,
19331
+ id: "react-autoql-condition-table-list-item-".concat(index)
19208
19332
  }, /*#__PURE__*/React.createElement("td", {
19209
- className: "condition-table-list-item"
19333
+ className: "react-autoql-condition-table-list-item"
19210
19334
  }, item.keyword, ' ', "(".concat(item.show_message, ")")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Switch, {
19211
19335
  onChange: function onChange() {
19212
19336
  return _this.handlePersistConditionToggle(item, index);
19213
19337
  },
19214
19338
  checked: item.lock_flag,
19215
- onColor: "#86d3ff",
19216
- onHandleColor: "#2693e6",
19339
+ onColor: accentColorAssist(getThemeConfig(_this.props.themeConfig).accentColor, 180),
19340
+ onHandleColor: getThemeConfig(getThemeConfig(_this.props.themeConfig)).accentColor,
19217
19341
  uncheckedIcon: false,
19218
19342
  checkedIcon: false,
19219
19343
  boxShadow: "0px 1px 5px rgba(0, 0, 0, 0.6)",
@@ -19222,10 +19346,12 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19222
19346
  height: 18,
19223
19347
  width: 34
19224
19348
  }), ' ', item.lock_flag ? 'Persistent' : 'Session')), /*#__PURE__*/React.createElement("td", {
19349
+ id: "react-autoql-remove-filter-container",
19225
19350
  style: {
19226
19351
  display: 'table-cell',
19227
19352
  verticalAlign: 'middle',
19228
- textAlign: 'right'
19353
+ textAlign: 'right',
19354
+ width: '35px'
19229
19355
  }
19230
19356
  }, /*#__PURE__*/React.createElement(ReactTooltip, {
19231
19357
  className: "react-autoql-chart-tooltip",
@@ -19233,9 +19359,11 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19233
19359
  effect: "solid",
19234
19360
  html: true
19235
19361
  }), /*#__PURE__*/React.createElement(Icon, {
19362
+ id: "react-autoql-remove-filtered-condition-icon",
19236
19363
  style: {
19237
19364
  paddingLeft: 5,
19238
- color: 'red'
19365
+ color: 'red',
19366
+ cursor: 'pointer'
19239
19367
  },
19240
19368
  "data-tip": "Remove filter",
19241
19369
  "data-for": "react-autoql-remove-condition",
@@ -19259,6 +19387,60 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19259
19387
  }
19260
19388
 
19261
19389
  _createClass(ConditionLockMenu, [{
19390
+ key: "handleFetchFilteredList",
19391
+ value: function handleFetchFilteredList() {
19392
+ var _this2 = this;
19393
+
19394
+ fetchConditions(_objectSpread2({}, getAuthentication(this.props.authentication))).then(function (response) {
19395
+ var conditions = _get(response, 'data.data.data');
19396
+
19397
+ var array = [];
19398
+
19399
+ for (var i = 0; i < conditions.length; i++) {
19400
+ array.push({
19401
+ id: conditions[i].id,
19402
+ keyword: conditions[i].value,
19403
+ value: conditions[i].value,
19404
+ show_message: conditions[i].show_message,
19405
+ key: conditions[i].key,
19406
+ lock_flag: conditions[i].lock_flag
19407
+ });
19408
+ }
19409
+
19410
+ if (JSON.parse(sessionStorage.getItem("conditions")) !== null) {
19411
+ var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
19412
+
19413
+ for (var _i3 = 0; _i3 < sessionConditions.length; _i3++) {
19414
+ array.push({
19415
+ id: sessionConditions[_i3].id,
19416
+ keyword: sessionConditions[_i3].value,
19417
+ value: sessionConditions[_i3].value,
19418
+ show_message: sessionConditions[_i3].show_message,
19419
+ key: sessionConditions[_i3].key,
19420
+ lock_flag: sessionConditions[_i3].lock_flag
19421
+ });
19422
+ }
19423
+ }
19424
+
19425
+ array.sort(function (a, b) {
19426
+ return a.keyword.toUpperCase() < b.keyword.toUpperCase() ? -1 : a.keyword > b.keyword ? 1 : 0;
19427
+ });
19428
+
19429
+ _this2.setState({
19430
+ selectedConditions: array,
19431
+ inputValue: '',
19432
+ isFetchingConditions: false
19433
+ });
19434
+ });
19435
+ }
19436
+ /**
19437
+ * When suggestion is clicked, Autosuggest populates the input
19438
+ * based on the clicked suggestion. Teach Autosuggest how to calculate the
19439
+ * input value for every given suggestion.
19440
+ * @param {*} suggestion
19441
+ */
19442
+
19443
+ }, {
19262
19444
  key: "handleShowMessage",
19263
19445
  value: function handleShowMessage(type, message) {
19264
19446
  var el = document.getElementById('react-autoql-condition-show-message');
@@ -19278,6 +19460,18 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19278
19460
  }
19279
19461
  });
19280
19462
  }
19463
+ }, {
19464
+ key: "handleHighlightFilterRow",
19465
+ value: function handleHighlightFilterRow(index) {
19466
+ var el = document.getElementById("react-autoql-condition-table-list-item-".concat(index));
19467
+
19468
+ if (el) {
19469
+ el.className = 'react-autoql-highlight-row';
19470
+ setTimeout(function () {
19471
+ el.className = el.className.replace('react-autoql-highlight-row', '');
19472
+ }, 1800);
19473
+ }
19474
+ }
19281
19475
  }]);
19282
19476
 
19283
19477
  return ConditionLockMenu;
@@ -19287,12 +19481,18 @@ _defineProperty(ConditionLockMenu, "propTypes", {
19287
19481
  containerWidth: PropTypes.number,
19288
19482
  isOpen: PropTypes.bool,
19289
19483
  onClose: PropTypes.func,
19290
- authentication: authenticationType
19484
+ authentication: authenticationType,
19485
+ initFilterText: PropTypes.string,
19486
+ themeConfig: themeConfigType
19291
19487
  });
19292
19488
 
19293
19489
  _defineProperty(ConditionLockMenu, "defaultProps", {
19294
19490
  containerWidth: undefined,
19295
- onClose: function onClose() {}
19491
+ onClose: function onClose() {},
19492
+ isOpen: false,
19493
+ authentication: undefined,
19494
+ initFilterText: undefined,
19495
+ themeConfig: themeConfigDefault
19296
19496
  });
19297
19497
 
19298
19498
  var DataMessenger = /*#__PURE__*/function (_React$Component) {
@@ -19319,7 +19519,8 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19319
19519
  isResizing: false,
19320
19520
  lastMessageId: undefined,
19321
19521
  isOptionsDropdownOpen: false,
19322
- isConditionLockingMenuOpen: false,
19522
+ isFilterLockingMenuOpen: false,
19523
+ selectedValueLabel: undefined,
19323
19524
  conditions: undefined,
19324
19525
  messages: [],
19325
19526
  queryTipsList: undefined,
@@ -19348,12 +19549,11 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19348
19549
  _this.setState({
19349
19550
  hasError: true
19350
19551
  });
19351
- } // WIP
19352
-
19552
+ }
19353
19553
 
19354
19554
  try {
19355
19555
  fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
19356
- var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
19556
+ var sessionConditions = JSON.parse(sessionStorage.getItem('conditions'));
19357
19557
 
19358
19558
  _this.setState({
19359
19559
  conditions: {
@@ -19395,9 +19595,9 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19395
19595
  setCSSVars(getThemeConfig(getThemeConfig(_this.props.themeConfig)));
19396
19596
  }
19397
19597
 
19398
- if (_this.state.isConditionLockingMenuOpen !== prevState.isConditionLockingMenuOpen) {
19598
+ if (_this.state.isFilterLockingMenuOpen !== prevState.isFilterLockingMenuOpen) {
19399
19599
  fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
19400
- var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
19600
+ var sessionConditions = JSON.parse(sessionStorage.getItem('conditions'));
19401
19601
 
19402
19602
  _this.setState({
19403
19603
  conditions: {
@@ -19410,7 +19610,8 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19410
19610
 
19411
19611
  if (_this.state.activePage !== prevState.activePage) {
19412
19612
  _this.setState({
19413
- isConditionLockingMenuOpen: false
19613
+ isFilterLockingMenuOpen: false,
19614
+ selectedValueLabel: undefined
19414
19615
  });
19415
19616
  }
19416
19617
  } catch (error) {
@@ -19531,7 +19732,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19531
19732
  messages: introMessages,
19532
19733
  lastMessageId: introMessages[introMessages.length - 1].id,
19533
19734
  isOptionsDropdownOpen: false,
19534
- isConditionLockingMenuOpen: false
19735
+ isFilterLockingMenuOpen: false
19535
19736
  });
19536
19737
  });
19537
19738
 
@@ -19593,11 +19794,10 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19593
19794
  }
19594
19795
 
19595
19796
  if (_this.props.onMaskClick) {
19596
- _this.props.onMaskClick();
19597
-
19598
19797
  _this.setState({
19599
- isConditionLockingMenuOpen: false
19600
- });
19798
+ isFilterLockingMenuOpen: false,
19799
+ selectedValueLabel: undefined
19800
+ }, _this.props.onMaskClick());
19601
19801
  }
19602
19802
 
19603
19803
  if (_this.props.onHandleClick) {
@@ -19877,7 +20077,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19877
20077
  }
19878
20078
  });
19879
20079
 
19880
- _defineProperty(_assertThisInitialized(_this), "getConditionMenuPosition", function () {
20080
+ _defineProperty(_assertThisInitialized(_this), "getFilterMenuPosition", function () {
19881
20081
  switch (_this.getPlacementProp()) {
19882
20082
  case 'right':
19883
20083
  return {
@@ -19986,24 +20186,24 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19986
20186
  _defineProperty(_assertThisInitialized(_this), "renderOptionsDropdown", function () {
19987
20187
  if (_this.state.activePage === 'data-messenger') {
19988
20188
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
19989
- id: "condition-dropdown",
20189
+ id: "react-autoql-filter-menu-dropdown",
19990
20190
  style: {
19991
20191
  justifyContent: 'left',
19992
20192
  position: 'absolute',
19993
20193
  right: 30
19994
20194
  }
19995
20195
  }, getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking ? /*#__PURE__*/React.createElement("button", {
19996
- id: "condition-dropdown",
20196
+ id: "react-autoql-filter-menu-dropdown-button",
19997
20197
  onClick: function onClick() {
19998
20198
  _this.setState({
19999
- isConditionLockingMenuOpen: !_this.state.isConditionLockingMenuOpen
20199
+ isFilterLockingMenuOpen: !_this.state.isFilterLockingMenuOpen
20000
20200
  });
20001
20201
  },
20002
20202
  className: "react-autoql-drawer-header-btn clear-all",
20003
20203
  "data-tip": lang.openFilterLocking,
20004
20204
  "data-for": "react-autoql-header-tooltip"
20005
20205
  }, /*#__PURE__*/React.createElement(Icon, {
20006
- type: _get(_this.state.conditions, 'persistent.length') > 0 || _get(_this.state.conditions, 'session.length') > 0 ? "lock" : "unlock"
20206
+ type: _get(_this.state.conditions, 'persistent.length') > 0 || _get(_this.state.conditions, 'session.length') > 0 ? 'lock' : 'unlock'
20007
20207
  })) : /*#__PURE__*/React.createElement("span", null)), /*#__PURE__*/React.createElement(Popover, {
20008
20208
  isOpen: _this.state.isOptionsDropdownOpen,
20009
20209
  onClickOutside: function onClickOutside() {
@@ -20084,10 +20284,6 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20084
20284
  className: "react-autoql-header-left-container"
20085
20285
  }, /*#__PURE__*/React.createElement("button", {
20086
20286
  onClick: function onClick() {
20087
- _this.setState({
20088
- isConditionLockingMenuOpen: false
20089
- });
20090
-
20091
20287
  _this.props.onHandleClick();
20092
20288
  },
20093
20289
  className: "react-autoql-drawer-header-btn close",
@@ -20095,11 +20291,25 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20095
20291
  "data-for": "react-autoql-header-tooltip"
20096
20292
  }, /*#__PURE__*/React.createElement(Icon, {
20097
20293
  type: "close"
20098
- }))), !getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking ? /*#__PURE__*/React.createElement("div", {
20294
+ }))), !getAutoQLConfig$1(getAutoQLConfig$1(_this.props.autoQLConfig)).enableFilterLocking && _this.state.isFilterLockingMenuOpen ? /*#__PURE__*/React.createElement("div", {
20099
20295
  className: "react-autoql-header-center-container"
20100
20296
  }, _this.renderHeaderTitle()) : /*#__PURE__*/React.createElement(Popover, {
20101
- containerStyle: _this.getConditionMenuPosition(),
20102
- isOpen: _this.state.isConditionLockingMenuOpen,
20297
+ containerStyle: _this.getFilterMenuPosition(),
20298
+ isOpen: _this.state.isFilterLockingMenuOpen,
20299
+ onClickOutside: function onClickOutside(e) {
20300
+ /**
20301
+ * Because the popover anchor is over the header title instead of the button,
20302
+ * the button is considered part of an "outside" event. This also includes
20303
+ * some elements inside of the popover as well for some reason.
20304
+ *
20305
+ * This is a hacky solution, but it works.
20306
+ */
20307
+ if (_get(e, 'target.id') !== 'react-autoql-interpreted-value-label' && _get(e, 'target.parentElement.parentElement.parentElement.id') !== 'react-autoql-filter-menu-dropdown-button' && _get(e, 'target.parentElement.parentElement.parentElement.id') !== 'react-autoql-filter-menu-dropdown' && _get(e, 'target.parentElement.id') !== 'react-autoql-filter-table-row' && _get(e, 'target.parentElement.id') !== 'react-autoql-remove-filtered-condition-icon' && _get(e, 'target.parentElement.parentElement.id') !== 'react-autoql-remove-filtered-condition-icon' && _get(e, 'target.parentElement.id') !== 'react-autoql-remove-filter-container' && !_get(e, 'target.classList.value').includes('react-autoql-drawer-resize-handle')) {
20308
+ _this.setState({
20309
+ isFilterLockingMenuOpen: false
20310
+ });
20311
+ }
20312
+ },
20103
20313
  position: "bottom",
20104
20314
  padding: 2,
20105
20315
  align: "center",
@@ -20111,10 +20321,13 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20111
20321
  }, /*#__PURE__*/React.createElement(ConditionLockMenu, {
20112
20322
  authentication: getAuthentication(getAuthentication(_this.props.authentication)),
20113
20323
  containerWidth: _this.getDrawerWidth(),
20114
- isOpen: _this.state.isConditionLockingMenuOpen,
20324
+ isOpen: _this.state.isFilterLockingMenuOpen,
20325
+ themeConfig: getThemeConfig(getThemeConfig(_this.props.themeConfig)),
20326
+ initFilterText: _this.state.selectedValueLabel,
20115
20327
  onClose: function onClose() {
20116
20328
  _this.setState({
20117
- isConditionLockingMenuOpen: false
20329
+ isFilterLockingMenuOpen: false,
20330
+ selectedValueLabel: undefined
20118
20331
  });
20119
20332
  }
20120
20333
  }))
@@ -20204,9 +20417,15 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20204
20417
  enableDynamicCharting: _this.props.enableDynamicCharting,
20205
20418
  onNoneOfTheseClick: _this.onNoneOfTheseClick,
20206
20419
  autoChartAggregations: _this.props.autoChartAggregations,
20207
- onConditionClickCallback: function onConditionClickCallback() {
20420
+ onConditionClickCallback: function onConditionClickCallback(e) {
20421
+ if (_get(e, 'target.classList.value').includes('react-autoql-condition-link')) {
20422
+ _this.setState({
20423
+ selectedValueLabel: _get(e, 'target.innerText').replace('lock ', '').trim()
20424
+ });
20425
+ }
20426
+
20208
20427
  _this.setState({
20209
- isConditionLockingMenuOpen: !_this.state.isConditionLockingMenuOpen
20428
+ isFilterLockingMenuOpen: true
20210
20429
  });
20211
20430
  }
20212
20431
  });
@@ -20554,7 +20773,12 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20554
20773
  width: _this.getDrawerWidth(),
20555
20774
  height: _this.getDrawerHeight(),
20556
20775
  onMaskClick: _this.handleMaskClick,
20557
- onHandleClick: _this.props.onHandleClick,
20776
+ onHandleClick: function onHandleClick() {
20777
+ _this.setState({
20778
+ isFilterLockingMenuOpen: false,
20779
+ selectedValueLabel: undefined
20780
+ }, _this.props.onHandleClick);
20781
+ },
20558
20782
  afterVisibleChange: _this.props.onVisibleChange,
20559
20783
  handler: _this.getHandlerProp(),
20560
20784
  level: _this.props.shiftScreen ? 'all' : null,
@@ -20615,12 +20839,12 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20615
20839
  value:
20616
20840
  /**
20617
20841
  * For some indiscernible reason, the Data Messenger drawer duplicates itself in the DOM.
20618
- * three times when first opened, then a number more times with each and every query
20842
+ * three times when first opened, then a number more times with each and every query
20619
20843
  * being made.
20620
- *
20844
+ *
20621
20845
  * This function removes unnecessary duplicate instances of the Data Messenger Drawer
20622
20846
  * and should help improve performance a bit by reducing the amount of renders.
20623
- *
20847
+ *
20624
20848
  * https://stackoverflow.com/questions/57946748/remove-duplicate-dom-element-javascript-not-jquery
20625
20849
  */
20626
20850
  function removeDuplicateMessengerInstance() {
@@ -21565,6 +21789,8 @@ var DashboardTile = /*#__PURE__*/function (_React$Component) {
21565
21789
  });
21566
21790
 
21567
21791
  _defineProperty(_assertThisInitialized(_this), "renderQueryOutput", function (_ref12) {
21792
+ var _extends2;
21793
+
21568
21794
  var _ref12$queryOutputPro = _ref12.queryOutputProps,
21569
21795
  queryOutputProps = _ref12$queryOutputPro === void 0 ? {} : _ref12$queryOutputPro,
21570
21796
  _ref12$vizToolbarProp = _ref12.vizToolbarProps,
@@ -21586,25 +21812,24 @@ var DashboardTile = /*#__PURE__*/function (_React$Component) {
21586
21812
  }, !queryOutputProps.queryResponse || isExecuting || _this.props.isUnExecuted ? _this.renderContentPlaceholder({
21587
21813
  isExecuting: isExecuting,
21588
21814
  isExecuted: isExecuted
21589
- }) : /*#__PURE__*/React.createElement(Fragment, null, _this.getIsSuggestionResponse(queryOutputProps.queryResponse) && _this.renderSuggestionMessage(customMessage), !customMessage && /*#__PURE__*/React.createElement(QueryOutput, _extends({
21815
+ }) : /*#__PURE__*/React.createElement(Fragment, null, _this.getIsSuggestionResponse(queryOutputProps.queryResponse) && _this.renderSuggestionMessage(customMessage), !customMessage && /*#__PURE__*/React.createElement(QueryOutput, _extends((_extends2 = {
21590
21816
  authentication: getAuthentication(_this.props.authentication),
21591
21817
  themeConfig: getThemeConfig(_this.props.themeConfig),
21592
21818
  autoQLConfig: getAutoQLConfig$1(_this.props.autoQLConfig),
21593
21819
  dataFormatting: getDataFormatting(_this.props.dataFormatting),
21594
21820
  renderTooltips: false,
21595
21821
  autoSelectQueryValidationSuggestion: false,
21822
+ isDashboardQuery: true,
21596
21823
  autoChartAggregations: _this.props.autoChartAggregations,
21597
21824
  renderSuggestionsAsDropdown: _this.props.tile.h < 4,
21598
21825
  enableDynamicCharting: _this.props.enableDynamicCharting,
21599
- backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary'),
21600
- isDashboardQuery: true,
21601
- onDisplayTypeUpdate: function onDisplayTypeUpdate() {
21602
- // This is necessary to update the toolbar with the newly rendered QueryOutput
21603
- setTimeout(function () {
21604
- _this.forceUpdate();
21605
- }, 0);
21606
- }
21607
- }, queryOutputProps)), _this.renderDataLimitWarning()), _this.props.isEditing && /*#__PURE__*/React.createElement("div", {
21826
+ backgroundColor: document.documentElement.style.getPropertyValue('--react-autoql-background-color-primary')
21827
+ }, _defineProperty(_extends2, "isDashboardQuery", true), _defineProperty(_extends2, "onDisplayTypeUpdate", function onDisplayTypeUpdate() {
21828
+ // This is necessary to update the toolbar with the newly rendered QueryOutput
21829
+ setTimeout(function () {
21830
+ _this.forceUpdate();
21831
+ }, 0);
21832
+ }), _extends2), queryOutputProps)), _this.renderDataLimitWarning()), _this.props.isEditing && /*#__PURE__*/React.createElement("div", {
21608
21833
  className: "dashboard-tile-viz-toolbar-container"
21609
21834
  }, _this.props.isEditing && showSplitViewBtn && _this.renderSplitViewBtn(), /*#__PURE__*/React.createElement(VizToolbar$1, _extends({
21610
21835
  themeConfig: getThemeConfig(_this.props.themeConfig)