react-autoql 3.5.2 → 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.
@@ -8300,7 +8300,8 @@ var ChataChart = /*#__PURE__*/function (_Component) {
8300
8300
 
8301
8301
  _defineProperty(_assertThisInitialized(_this), "renderStringColumnSelectorContent", function () {
8302
8302
  return /*#__PURE__*/React.createElement("div", {
8303
- className: "axis-selector-container"
8303
+ className: "axis-selector-container",
8304
+ id: "string-column-selector-content"
8304
8305
  }, /*#__PURE__*/React.createElement("ul", {
8305
8306
  className: "axis-selector-content"
8306
8307
  }, _this.props.dataConfig.stringColumnIndices.map(function (colIndex, i) {
@@ -8468,7 +8469,8 @@ var ChataChart = /*#__PURE__*/function (_Component) {
8468
8469
  }
8469
8470
 
8470
8471
  return /*#__PURE__*/React.createElement("div", {
8471
- className: "axis-selector-container"
8472
+ className: "axis-selector-container",
8473
+ id: "legend-selector-content"
8472
8474
  }, /*#__PURE__*/React.createElement("ul", {
8473
8475
  className: "axis-selector-content"
8474
8476
  }, _this.props.dataConfig.stringColumnIndices.map(function (colIndex, i) {
@@ -11601,7 +11603,7 @@ var fetchNotificationCount = function fetchNotificationCount(_ref2) {
11601
11603
  Authorization: "Bearer ".concat(token)
11602
11604
  }
11603
11605
  });
11604
- 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);
11605
11607
  var config = {
11606
11608
  timeout: 180000
11607
11609
  };
@@ -12148,6 +12150,8 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12148
12150
  count: 0
12149
12151
  });
12150
12152
 
12153
+ _defineProperty(_assertThisInitialized(_this), "timerID", void 0);
12154
+
12151
12155
  _defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
12152
12156
  return _regeneratorRuntime.wrap(function _callee$(_context) {
12153
12157
  while (1) {
@@ -12177,6 +12181,7 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12177
12181
 
12178
12182
  _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
12179
12183
  _this._isMounted = false;
12184
+ clearInterval(_this.timerID);
12180
12185
  });
12181
12186
 
12182
12187
  _defineProperty(_assertThisInitialized(_this), "getNotificationCount", function (currentCount) {
@@ -12202,35 +12207,46 @@ var NotificationIcon = /*#__PURE__*/function (_React$Component) {
12202
12207
 
12203
12208
  _defineProperty(_assertThisInitialized(_this), "subscribeToNotificationCount", function (count) {
12204
12209
  if (_this._isMounted) {
12205
- _this.getNotificationCount(count).then(function (newCount) {
12206
- // Got a new count, now we want to reconnect
12207
- _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
+ }
12208
12217
 
12209
- _this.FAILED_POLL_ATTEMPTS = 0;
12210
- }).catch(function (error) {
12211
- if (_this.FAILED_POLL_ATTEMPTS === 5) {
12212
- 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);
12213
12222
 
12214
- 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.');
12215
12227
 
12216
- _this.props.onErrorCallback(_error);
12228
+ console.error(_error);
12217
12229
 
12218
- return;
12219
- } else if (_get(error, 'response.status') == 504) {
12220
- // Timed out because there were no changes
12221
- // Let's connect again
12222
- _this.subscribeToNotificationCount();
12223
- } else {
12224
- // Something else went wrong, wait one second and reconnect
12225
- new Promise(function (resolve) {
12226
- return setTimeout(resolve, 1000);
12227
- }).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
12228
12237
  _this.subscribeToNotificationCount();
12229
- });
12230
- }
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
+ }
12231
12246
 
12232
- _this.FAILED_POLL_ATTEMPTS += 1;
12233
- });
12247
+ _this.FAILED_POLL_ATTEMPTS += 1;
12248
+ });
12249
+ }, 90 * 1000);
12234
12250
  }
12235
12251
  });
12236
12252
 
@@ -18858,6 +18874,24 @@ _defineProperty(Cascader, "defaultProps", {
18858
18874
  onSeeMoreClick: undefined
18859
18875
  });
18860
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
+
18861
18895
  var autoCompleteArray$1 = [];
18862
18896
 
18863
18897
  var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
@@ -18933,9 +18967,13 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18933
18967
  }
18934
18968
  }
18935
18969
 
18970
+ array.sort(function (a, b) {
18971
+ return a.keyword.toUpperCase() < b.keyword.toUpperCase() ? -1 : a.keyword > b.keyword ? 1 : 0;
18972
+ });
18973
+
18936
18974
  if (_this.props.initFilterText && _this.props.initFilterText !== '') {
18937
18975
  _this.setState({
18938
- selectedConditions: array.sort(),
18976
+ selectedConditions: array,
18939
18977
  isFetchingConditions: false
18940
18978
  });
18941
18979
 
@@ -18950,7 +18988,7 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18950
18988
  _this.animateInputTextAndSubmit(_this.props.initFilterText);
18951
18989
  } else {
18952
18990
  _this.setState({
18953
- selectedConditions: array.sort(),
18991
+ selectedConditions: array,
18954
18992
  inputValue: '',
18955
18993
  isFetchingConditions: false
18956
18994
  });
@@ -18961,9 +18999,14 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18961
18999
  }
18962
19000
  });
18963
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
+
18964
19008
  _defineProperty(_assertThisInitialized(_this), "getSuggestionValue", function (suggestion) {
18965
19009
  var array = _this.state.selectedConditions;
18966
- var tempId = uuid.v4();
18967
19010
 
18968
19011
  if (array.some(function (item) {
18969
19012
  return item.key === suggestion.name.canonical && item.value === suggestion.name.keyword;
@@ -18971,7 +19014,6 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18971
19014
  _this.handleShowMessage('warning', 'This condition has already been applied.');
18972
19015
  } else {
18973
19016
  array.push({
18974
- id: tempId,
18975
19017
  keyword: suggestion.name.keyword,
18976
19018
  value: suggestion.name.keyword,
18977
19019
  show_message: suggestion.name.show_message,
@@ -18981,7 +19023,6 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18981
19023
  });
18982
19024
 
18983
19025
  _this.setState({
18984
- selectedConditions: array,
18985
19026
  inputValue: ''
18986
19027
  });
18987
19028
 
@@ -18989,6 +19030,8 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18989
19030
  conditions: array
18990
19031
  })).then(function () {
18991
19032
  _this.handleShowMessage('lock', "".concat(suggestion.name.keyword, " has been locked"));
19033
+
19034
+ _this.handleFetchFilteredList();
18992
19035
  });
18993
19036
  }
18994
19037
  });
@@ -19026,11 +19069,7 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19026
19069
  }
19027
19070
 
19028
19071
  var array = _this.state.selectedConditions;
19029
- array.splice(index, 1);
19030
-
19031
- _this.setState({
19032
- selectedConditions: array
19033
- });
19072
+ array.splice(index, 1); // this.setState({ selectedConditions: array })
19034
19073
 
19035
19074
  _this.handleShowMessage('unlock', 'Filter removed.');
19036
19075
 
@@ -19050,7 +19089,9 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19050
19089
  }, function () {
19051
19090
  setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
19052
19091
  conditions: _this.state.selectedConditions
19053
- }));
19092
+ })).then(function () {
19093
+ _this.handleFetchFilteredList();
19094
+ });
19054
19095
 
19055
19096
  if (item.lock_flag === 0) {
19056
19097
  if (sessionConditions == null) sessionConditions = [];
@@ -19178,29 +19219,6 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19178
19219
  }), " ", _this.state.showMessage.message);
19179
19220
  });
19180
19221
 
19181
- _defineProperty(_assertThisInitialized(_this), "renderAcceptConditionsButton", function () {
19182
- return /*#__PURE__*/React.createElement("div", {
19183
- key: "accept-conditions-btn",
19184
- className: "react-autoql-accept-conditions-button"
19185
- }, /*#__PURE__*/React.createElement("span", {
19186
- onClick: function onClick() {
19187
- setConditions(_objectSpread2(_objectSpread2({}, getAuthentication(_this.props.authentication)), {}, {
19188
- conditions: _this.state.selectedConditions
19189
- })).then(function () {
19190
- _this.props.onClose(true);
19191
- }).catch(function (e) {
19192
- //WIP showErrorMessage
19193
- console.error(e);
19194
- });
19195
- }
19196
- }, /*#__PURE__*/React.createElement(Icon, {
19197
- type: "lock",
19198
- style: {
19199
- verticalAlign: 'middle'
19200
- }
19201
- }), " Save"));
19202
- });
19203
-
19204
19222
  _defineProperty(_assertThisInitialized(_this), "render", function () {
19205
19223
  var containerWidth = _this.props.containerWidth;
19206
19224
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
@@ -19247,19 +19265,25 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19247
19265
  onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
19248
19266
  getSuggestionValue: _this.getSuggestionValue,
19249
19267
  renderSuggestion: function renderSuggestion(suggestion) {
19250
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
19251
- id: "react-autoql-filter-table",
19252
- className: "autoql-condition-locking-menu-list"
19253
- }, /*#__PURE__*/React.createElement("tr", {
19254
- id: "react-autoql-filter-table-row"
19255
- }, /*#__PURE__*/React.createElement("td", {
19256
- id: "react-autoql-filter-table-data",
19257
- style: {
19258
- width: 300
19259
- }
19260
- }, suggestion.name.keyword), /*#__PURE__*/React.createElement("td", {
19261
- id: "react-autoql-filter-table-data"
19262
- }, 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
+ }
19263
19287
  },
19264
19288
  inputProps: {
19265
19289
  onChange: _this.onInputChange,
@@ -19312,8 +19336,8 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19312
19336
  return _this.handlePersistConditionToggle(item, index);
19313
19337
  },
19314
19338
  checked: item.lock_flag,
19315
- onColor: "#86d3ff",
19316
- onHandleColor: "#2693e6",
19339
+ onColor: accentColorAssist(getThemeConfig(_this.props.themeConfig).accentColor, 180),
19340
+ onHandleColor: getThemeConfig(getThemeConfig(_this.props.themeConfig)).accentColor,
19317
19341
  uncheckedIcon: false,
19318
19342
  checkedIcon: false,
19319
19343
  boxShadow: "0px 1px 5px rgba(0, 0, 0, 0.6)",
@@ -19363,6 +19387,60 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19363
19387
  }
19364
19388
 
19365
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
+ }, {
19366
19444
  key: "handleShowMessage",
19367
19445
  value: function handleShowMessage(type, message) {
19368
19446
  var el = document.getElementById('react-autoql-condition-show-message');
@@ -19404,7 +19482,8 @@ _defineProperty(ConditionLockMenu, "propTypes", {
19404
19482
  isOpen: PropTypes.bool,
19405
19483
  onClose: PropTypes.func,
19406
19484
  authentication: authenticationType,
19407
- initFilterText: PropTypes.string
19485
+ initFilterText: PropTypes.string,
19486
+ themeConfig: themeConfigType
19408
19487
  });
19409
19488
 
19410
19489
  _defineProperty(ConditionLockMenu, "defaultProps", {
@@ -19412,7 +19491,8 @@ _defineProperty(ConditionLockMenu, "defaultProps", {
19412
19491
  onClose: function onClose() {},
19413
19492
  isOpen: false,
19414
19493
  authentication: undefined,
19415
- initFilterText: undefined
19494
+ initFilterText: undefined,
19495
+ themeConfig: themeConfigDefault
19416
19496
  });
19417
19497
 
19418
19498
  var DataMessenger = /*#__PURE__*/function (_React$Component) {
@@ -19469,8 +19549,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
19469
19549
  _this.setState({
19470
19550
  hasError: true
19471
19551
  });
19472
- } // WIP
19473
-
19552
+ }
19474
19553
 
19475
19554
  try {
19476
19555
  fetchConditions(_objectSpread2({}, getAuthentication(_this.props.authentication))).then(function (response) {
@@ -20243,6 +20322,7 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20243
20322
  authentication: getAuthentication(getAuthentication(_this.props.authentication)),
20244
20323
  containerWidth: _this.getDrawerWidth(),
20245
20324
  isOpen: _this.state.isFilterLockingMenuOpen,
20325
+ themeConfig: getThemeConfig(getThemeConfig(_this.props.themeConfig)),
20246
20326
  initFilterText: _this.state.selectedValueLabel,
20247
20327
  onClose: function onClose() {
20248
20328
  _this.setState({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-autoql",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "React Widget Library",
5
5
  "main": "dist/autoql.cjs.js",
6
6
  "module": "dist/autoql.esm.js",