react-autoql 3.5.3 → 3.5.4

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.
@@ -2803,7 +2803,7 @@ var runQueryOnly = function runQueryOnly() {
2803
2803
 
2804
2804
  var url = "".concat(domain, "/autoql/api/v1/query?key=").concat(apiKey);
2805
2805
  var finalUserSelection = transformUserSelection(userSelection);
2806
- var sessionConditions = JSON.parse(sessionStorage.getItem("conditions"));
2806
+ var sessionConditions = JSON.parse(sessionStorage.getItem('conditions'));
2807
2807
  var conditions = {};
2808
2808
 
2809
2809
  if (sessionConditions !== null) {
@@ -2915,9 +2915,6 @@ var runQuery = function runQuery() {
2915
2915
  source = _ref5.source,
2916
2916
  skipQueryValidation = _ref5.skipQueryValidation,
2917
2917
  AutoAEId = _ref5.AutoAEId;
2918
-
2919
- // Temp for demo: decode token to get project id
2920
- var id;
2921
2918
  var base64Url;
2922
2919
 
2923
2920
  if (token) {
@@ -2928,38 +2925,35 @@ var runQuery = function runQuery() {
2928
2925
  var buff = Buffer.from(base64, 'base64');
2929
2926
  var payloadinit = buff.toString('ascii');
2930
2927
  var payload = JSON.parse(payloadinit);
2931
- id = _get(payload, 'project_id');
2928
+ _get(payload, 'project_id');
2932
2929
  }
2933
- } // temp ignore validation for these projects
2930
+ }
2934
2931
 
2932
+ if (enableQueryValidation && !skipQueryValidation && !isQandA) {
2933
+ return runQueryValidation({
2934
+ text: query,
2935
+ domain: domain,
2936
+ apiKey: apiKey,
2937
+ token: token
2938
+ }).then(function (response) {
2939
+ if (failedValidation(response)) {
2940
+ return Promise.resolve(response);
2941
+ }
2935
2942
 
2936
- if (id !== 'accounting-demo' && id !== 'operational-demo' && id !== 'stockmarket-demo') {
2937
- if (enableQueryValidation && !skipQueryValidation && !isQandA) {
2938
- return runQueryValidation({
2939
- text: query,
2943
+ return runQueryOnly({
2944
+ query: query,
2945
+ userSelection: userSelection,
2946
+ debug: debug,
2947
+ test: test,
2940
2948
  domain: domain,
2941
2949
  apiKey: apiKey,
2942
- token: token
2943
- }).then(function (response) {
2944
- if (failedValidation(response)) {
2945
- return Promise.resolve(response);
2946
- }
2947
-
2948
- return runQueryOnly({
2949
- query: query,
2950
- userSelection: userSelection,
2951
- debug: debug,
2952
- test: test,
2953
- domain: domain,
2954
- apiKey: apiKey,
2955
- token: token,
2956
- source: source,
2957
- AutoAEId: AutoAEId
2958
- });
2959
- }).catch(function (error) {
2960
- return Promise.reject(error);
2950
+ token: token,
2951
+ source: source,
2952
+ AutoAEId: AutoAEId
2961
2953
  });
2962
- }
2954
+ }).catch(function (error) {
2955
+ return Promise.reject(error);
2956
+ });
2963
2957
  }
2964
2958
 
2965
2959
  return runQueryOnly({
@@ -3455,7 +3449,7 @@ var QueryInput = /*#__PURE__*/function (_React$Component) {
3455
3449
  setCSSVars(getThemeConfig(_this.props.themeConfig));
3456
3450
  }
3457
3451
 
3458
- if (_this.props.inputValue && _this.props.inputValue !== prevProps.inputValue) {
3452
+ if (_this.props.inputValue !== prevProps.inputValue) {
3459
3453
  _this.setState({
3460
3454
  inputValue: _this.props.inputValue
3461
3455
  });
@@ -4893,9 +4887,9 @@ var ChataColumnChart = /*#__PURE__*/function (_Component) {
4893
4887
  numberColumnIndices = _this$props.numberColumnIndices,
4894
4888
  stringColumnIndices = _this$props.stringColumnIndices,
4895
4889
  onLegendTitleClick = _this$props.onLegendTitleClick,
4896
- bottomLegendMargin = _this$props.bottomLegendMargin;
4897
- _this$props.stringColumnIndex;
4898
- var numberColumnIndex = _this$props.numberColumnIndex,
4890
+ bottomLegendMargin = _this$props.bottomLegendMargin,
4891
+ stringColumnIndex = _this$props.stringColumnIndex,
4892
+ numberColumnIndex = _this$props.numberColumnIndex,
4899
4893
  numberAxisTitle = _this$props.numberAxisTitle,
4900
4894
  stringAxisTitle = _this$props.stringAxisTitle,
4901
4895
  dataFormatting = _this$props.dataFormatting,
@@ -4945,7 +4939,7 @@ var ChataColumnChart = /*#__PURE__*/function (_Component) {
4945
4939
  xScale: xScale,
4946
4940
  yScale: yScale
4947
4941
  },
4948
- xCol: columns[0],
4942
+ xCol: columns[stringColumnIndex],
4949
4943
  yCol: columns[numberColumnIndex],
4950
4944
  margins: {
4951
4945
  left: leftMargin,
@@ -9459,6 +9453,20 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
9459
9453
 
9460
9454
 
9461
9455
  if (!aDate || !bDate) {
9456
+ //If one is a YYYY-WW
9457
+ if (a.includes('W')) {
9458
+ var aDateYear = a.substring(0, 4);
9459
+ var bDateYear = b.substring(0, 4);
9460
+
9461
+ if (aDateYear !== bDateYear) {
9462
+ return bDateYear - aDateYear;
9463
+ } else {
9464
+ var aDateWeek = a.substring(6, 8);
9465
+ var bDateWeek = b.substring(6, 8);
9466
+ return bDateWeek - aDateWeek;
9467
+ }
9468
+ }
9469
+
9462
9470
  return b - a;
9463
9471
  }
9464
9472
 
@@ -10308,8 +10316,8 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10308
10316
  // displayed differently than the data (ie. dates)
10309
10317
 
10310
10318
  col.headerFilterFunc = _this.setFilterFunction(col); // Allow proper chronological sorting for date strings
10311
-
10312
- col.sorter = _this.setSorterFunction(col); // Context menu when right clicking on column header
10319
+ // col.sorter = this.setSorterFunction(col)
10320
+ // Context menu when right clicking on column header
10313
10321
 
10314
10322
  col.headerContext = function (e, column) {
10315
10323
  // Do not show native context menu
@@ -10387,7 +10395,6 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10387
10395
  title: 'Month',
10388
10396
  name: 'Month',
10389
10397
  field: '0',
10390
- // sorter: 'date',
10391
10398
  frozen: true,
10392
10399
  visible: true
10393
10400
  }];
@@ -10704,13 +10711,11 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10704
10711
  });
10705
10712
 
10706
10713
  _defineProperty(_assertThisInitialized(_this), "renderChart", function (width, height, displayType) {
10707
- var _React$createElement;
10708
-
10709
10714
  if (!_this.chartData) {
10710
10715
  return 'Error: There was no data supplied for this chart';
10711
10716
  }
10712
10717
 
10713
- return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(ChataChart, (_React$createElement = {
10718
+ return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(ChataChart, {
10714
10719
  themeConfig: getThemeConfig(_this.props.themeConfig),
10715
10720
  ref: function ref(_ref8) {
10716
10721
  return _this.chartRef = _ref8;
@@ -10726,8 +10731,14 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
10726
10731
  backgroundColor: _this.props.backgroundColor,
10727
10732
  activeChartElementKey: _this.props.activeChartElementKey,
10728
10733
  onLegendClick: _this.onLegendClick,
10729
- dataConfig: _cloneDeep(_this.dataConfig)
10730
- }, _defineProperty(_React$createElement, "themeConfig", getThemeConfig(_this.props.themeConfig)), _defineProperty(_React$createElement, "changeStringColumnIndex", _this.onChangeStringColumnIndex), _defineProperty(_React$createElement, "changeLegendColumnIndex", _this.onChangeLegendColumnIndex), _defineProperty(_React$createElement, "changeNumberColumnIndices", _this.onChangeNumberColumnIndices), _defineProperty(_React$createElement, "onChartClick", _this.onChartClick), _defineProperty(_React$createElement, "isResizing", _this.props.isResizing), _defineProperty(_React$createElement, "enableDynamicCharting", _this.props.enableDynamicCharting), _React$createElement)));
10734
+ dataConfig: _cloneDeep(_this.dataConfig),
10735
+ changeStringColumnIndex: _this.onChangeStringColumnIndex,
10736
+ changeLegendColumnIndex: _this.onChangeLegendColumnIndex,
10737
+ changeNumberColumnIndices: _this.onChangeNumberColumnIndices,
10738
+ onChartClick: _this.onChartClick,
10739
+ isResizing: _this.props.isResizing,
10740
+ enableDynamicCharting: _this.props.enableDynamicCharting
10741
+ }));
10731
10742
  });
10732
10743
 
10733
10744
  _defineProperty(_assertThisInitialized(_this), "renderHelpResponse", function () {
@@ -11034,7 +11045,7 @@ var QueryOutput = /*#__PURE__*/function (_React$Component) {
11034
11045
  onRest: _this.handleShowHide,
11035
11046
  isOpened: true // isOpened={this.state.isShowingInterpretation}
11036
11047
 
11037
- }, /*#__PURE__*/React.createElement("strong", null, "Interpreted as:", ' '), /*#__PURE__*/React.createElement("span", {
11048
+ }, /*#__PURE__*/React.createElement("strong", null, "Interpreted as: "), /*#__PURE__*/React.createElement("span", {
11038
11049
  onClick: function onClick(e) {
11039
11050
  return _this.props.onConditionClickCallback(e);
11040
11051
  },
@@ -17395,7 +17406,8 @@ var Input = /*#__PURE__*/function (_React$Component) {
17395
17406
 
17396
17407
  _defineProperty(_assertThisInitialized(_this), "state", {
17397
17408
  isHideColumnsModalVisible: false,
17398
- isSettingColumnVisibility: false
17409
+ isSettingColumnVisibility: false,
17410
+ reportProblemMessage: undefined
17399
17411
  });
17400
17412
 
17401
17413
  _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
@@ -17726,23 +17738,29 @@ var Input = /*#__PURE__*/function (_React$Component) {
17726
17738
  isVisible: _this.state.activeMenu === 'other-problem',
17727
17739
  onClose: function onClose() {
17728
17740
  _this.setState({
17729
- activeMenu: undefined
17741
+ activeMenu: undefined,
17742
+ reportProblemMessage: undefined
17730
17743
  });
17731
17744
  },
17732
17745
  onConfirm: function onConfirm() {
17733
- _this.reportQueryProblem(_this.reportProblemMessage);
17746
+ _this.reportQueryProblem(_this.state.reportProblemMessage);
17734
17747
 
17735
- _this.reportProblemMessage = undefined;
17748
+ _this.setState({
17749
+ reportProblemMessage: undefined
17750
+ });
17736
17751
  },
17737
17752
  confirmLoading: _this.state.isReportingProblem,
17738
17753
  title: "Report a Problem",
17739
17754
  enableBodyScroll: true,
17740
17755
  width: "600px",
17741
- confirmText: "Report"
17756
+ confirmText: "Report",
17757
+ confirmDisabled: _this.state.reportProblemMessage ? false : true
17742
17758
  }, "Please tell us more about the problem you are experiencing:", /*#__PURE__*/React.createElement("textarea", {
17743
17759
  className: "report-problem-text-area",
17744
17760
  onChange: function onChange(e) {
17745
- return _this.reportProblemMessage = e.target.value;
17761
+ return _this.setState({
17762
+ reportProblemMessage: e.target.value
17763
+ });
17746
17764
  }
17747
17765
  })));
17748
17766
  });
@@ -18894,15 +18912,15 @@ function accentColorAssist(col, amt) {
18894
18912
 
18895
18913
  var autoCompleteArray$1 = [];
18896
18914
 
18897
- var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
18898
- _inherits(ConditionLockMenu, _React$Component);
18915
+ var FilterLockMenu = /*#__PURE__*/function (_React$Component) {
18916
+ _inherits(FilterLockMenu, _React$Component);
18899
18917
 
18900
- var _super = _createSuper(ConditionLockMenu);
18918
+ var _super = _createSuper(FilterLockMenu);
18901
18919
 
18902
- function ConditionLockMenu() {
18920
+ function FilterLockMenu() {
18903
18921
  var _this;
18904
18922
 
18905
- _classCallCheck(this, ConditionLockMenu);
18923
+ _classCallCheck(this, FilterLockMenu);
18906
18924
 
18907
18925
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18908
18926
  args[_key] = arguments[_key];
@@ -19222,6 +19240,7 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19222
19240
  _defineProperty(_assertThisInitialized(_this), "render", function () {
19223
19241
  var containerWidth = _this.props.containerWidth;
19224
19242
  return /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement("div", {
19243
+ "data-test": "react-autoql-filter-menu-container",
19225
19244
  className: "react-autoql-condition-lock-menu",
19226
19245
  style: {
19227
19246
  width: containerWidth
@@ -19265,25 +19284,19 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19265
19284
  onSuggestionsClearRequested: _this.onSuggestionsClearRequested,
19266
19285
  getSuggestionValue: _this.getSuggestionValue,
19267
19286
  renderSuggestion: function renderSuggestion(suggestion) {
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
- }
19287
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
19288
+ id: "react-autoql-filter-table",
19289
+ className: "autoql-condition-locking-menu-list"
19290
+ }, /*#__PURE__*/React.createElement("tr", {
19291
+ id: "react-autoql-filter-table-row"
19292
+ }, /*#__PURE__*/React.createElement("td", {
19293
+ id: "react-autoql-filter-table-data",
19294
+ style: {
19295
+ width: 300
19296
+ }
19297
+ }, suggestion.name.keyword), /*#__PURE__*/React.createElement("td", {
19298
+ id: "react-autoql-filter-table-data"
19299
+ }, suggestion.name.show_message))));
19287
19300
  },
19288
19301
  inputProps: {
19289
19302
  onChange: _this.onInputChange,
@@ -19386,7 +19399,7 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19386
19399
  return _this;
19387
19400
  }
19388
19401
 
19389
- _createClass(ConditionLockMenu, [{
19402
+ _createClass(FilterLockMenu, [{
19390
19403
  key: "handleFetchFilteredList",
19391
19404
  value: function handleFetchFilteredList() {
19392
19405
  var _this2 = this;
@@ -19474,11 +19487,11 @@ var ConditionLockMenu = /*#__PURE__*/function (_React$Component) {
19474
19487
  }
19475
19488
  }]);
19476
19489
 
19477
- return ConditionLockMenu;
19490
+ return FilterLockMenu;
19478
19491
  }(React.Component);
19479
19492
 
19480
- _defineProperty(ConditionLockMenu, "propTypes", {
19481
- containerWidth: PropTypes.number,
19493
+ _defineProperty(FilterLockMenu, "propTypes", {
19494
+ containerWidth: PropTypes.string,
19482
19495
  isOpen: PropTypes.bool,
19483
19496
  onClose: PropTypes.func,
19484
19497
  authentication: authenticationType,
@@ -19486,7 +19499,7 @@ _defineProperty(ConditionLockMenu, "propTypes", {
19486
19499
  themeConfig: themeConfigType
19487
19500
  });
19488
19501
 
19489
- _defineProperty(ConditionLockMenu, "defaultProps", {
19502
+ _defineProperty(FilterLockMenu, "defaultProps", {
19490
19503
  containerWidth: undefined,
19491
19504
  onClose: function onClose() {},
19492
19505
  isOpen: false,
@@ -20318,7 +20331,9 @@ var DataMessenger = /*#__PURE__*/function (_React$Component) {
20318
20331
  style: {
20319
20332
  display: 'block'
20320
20333
  }
20321
- }, /*#__PURE__*/React.createElement(ConditionLockMenu, {
20334
+ }, /*#__PURE__*/React.createElement(FilterLockMenu, {
20335
+ "data-test": "react-autoql-filter-menu",
20336
+ id: "react-autoql-filter-menu",
20322
20337
  authentication: getAuthentication(getAuthentication(_this.props.authentication)),
20323
20338
  containerWidth: _this.getDrawerWidth(),
20324
20339
  isOpen: _this.state.isFilterLockingMenuOpen,
@@ -20932,7 +20947,7 @@ _defineProperty(DataMessenger, "defaultProps", {
20932
20947
  maxMessages: undefined,
20933
20948
  introMessage: undefined,
20934
20949
  enableExploreQueriesTab: true,
20935
- enableNotificationsTab: true,
20950
+ enableNotificationsTab: false,
20936
20951
  resizable: true,
20937
20952
  inputPlaceholder: undefined,
20938
20953
  queryQuickStartTopics: undefined,
@@ -21903,6 +21918,11 @@ var DashboardTile = /*#__PURE__*/function (_React$Component) {
21903
21918
  _defineProperty(_assertThisInitialized(_this), "renderBottomResponse", function () {
21904
21919
  var queryResponse = _this.props.tile.secondQueryResponse || _this.props.queryResponse;
21905
21920
  var displayType = isDisplayTypeValid(queryResponse, _this.props.secondDisplayType) ? _this.props.secondDisplayType : getDefaultDisplayType(queryResponse, _this.props.autoChartAggregations);
21921
+
21922
+ _this.props.setParamsForTile({
21923
+ secondDisplayType: displayType
21924
+ }, _this.props.tile.i);
21925
+
21906
21926
  return _this.renderQueryOutput({
21907
21927
  queryOutputProps: {
21908
21928
  key: "dashboard-tile-query-bottom-".concat(_this.COMPONENT_KEY),
@@ -22978,4 +22998,4 @@ _defineProperty(SpeechToTextBtn, "defaultProps", {
22978
22998
  themeConfig: themeConfigDefault
22979
22999
  });
22980
23000
 
22981
- export { Dashboard, DashboardTile, DataAlertModal, DataAlerts, DataMessenger, ExpressionBuilder, ExpressionBuilderSimple, Icon, LoadingDots, NotificationFeed, NotificationIcon, NotificationItem, QueryInput, QueryOutput, ScheduleBuilder, SpeechToTextBtn as SpeechToTextButton, SpeechToTextButtonBrowser, executeDashboard, fetchQueryTips, getDefaultDisplayType, getSupportedDisplayTypes, isDisplayTypeValid, unExecuteDashboard };
23001
+ export { Dashboard, DashboardTile, DataAlertModal, DataAlerts, DataMessenger, ExpressionBuilder, ExpressionBuilderSimple, FilterLockMenu, Icon, LoadingDots, NotificationFeed, NotificationIcon, NotificationItem, QueryInput, QueryOutput, ScheduleBuilder, SpeechToTextBtn as SpeechToTextButton, SpeechToTextButtonBrowser, executeDashboard, fetchQueryTips, getDefaultDisplayType, getSupportedDisplayTypes, isDisplayTypeValid, unExecuteDashboard };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-autoql",
3
- "version": "3.5.3",
3
+ "version": "3.5.4",
4
4
  "description": "React Widget Library",
5
5
  "main": "dist/autoql.cjs.js",
6
6
  "module": "dist/autoql.esm.js",