@nebula.js/stardust 3.0.0-alpha1 → 3.0.0-alpha10

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v3.0.0-alpha1
2
+ * @nebula.js/stardust v3.0.0-alpha10
3
3
  * Copyright (c) 2022 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -16197,7 +16197,7 @@
16197
16197
  return cache[key];
16198
16198
  }
16199
16199
 
16200
- const NEBULA_VERSION_HASH = "4ced" ;
16200
+ const NEBULA_VERSION_HASH = "d97f" ;
16201
16201
  ClassNameGenerator.configure(componentName => {
16202
16202
 
16203
16203
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
@@ -16770,7 +16770,7 @@
16770
16770
  const appRef = React.createRef();
16771
16771
  const element = document.createElement('div');
16772
16772
  element.style.display = 'none';
16773
- element.setAttribute('data-nebulajs-version', "3.0.0-alpha1" );
16773
+ element.setAttribute('data-nebulajs-version', "3.0.0-alpha10" );
16774
16774
  element.setAttribute('data-app-id', app.id);
16775
16775
  document.body.appendChild(element);
16776
16776
  ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
@@ -31645,7 +31645,8 @@
31645
31645
  paddingRight: '8px'
31646
31646
  },
31647
31647
  ["&.".concat(classes$a.barContainer)]: {
31648
- position: 'relative'
31648
+ height: '100%',
31649
+ display: 'inline-block'
31649
31650
  },
31650
31651
  ["& .".concat(classes$a.bar)]: {
31651
31652
  border: "".concat(barBorderWidthPx, "px solid"),
@@ -31681,8 +31682,7 @@
31681
31682
  let {
31682
31683
  index,
31683
31684
  style,
31684
- data,
31685
- column = false
31685
+ data
31686
31686
  } = _ref3;
31687
31687
  const {
31688
31688
  onClick,
@@ -31691,6 +31691,7 @@
31691
31691
  onMouseEnter,
31692
31692
  pages,
31693
31693
  isLocked,
31694
+ column = false,
31694
31695
  checkboxes = false,
31695
31696
  dense = false,
31696
31697
  frequencyMode = 'N',
@@ -32105,7 +32106,7 @@
32105
32106
  if (typeof setCount === 'function' && layout) {
32106
32107
  setCount(layout.qListObject.qSize.qcy);
32107
32108
  }
32108
- }, [layout]);
32109
+ }, [layout, layout && layout.qListObject.qSize.qcy]);
32109
32110
  react.exports.useEffect(() => {
32110
32111
  if (!instantPages || isLoadingData) {
32111
32112
  return;
@@ -32127,7 +32128,12 @@
32127
32128
  }
32128
32129
 
32129
32130
  const isVertical = listLayout !== 'horizontal';
32130
- const count = layout.qListObject.qSize.qcy;
32131
+ let count = layout.qListObject.qSize.qcy; // Should not allow a count of zero since it will stop executing loadMoreItems
32132
+ // this could happen if a seach returns an empty result
32133
+
32134
+ if (count === 0) {
32135
+ count = 1;
32136
+ }
32131
32137
 
32132
32138
  const getCalculatedHeight = ps => {
32133
32139
  // If values have been filtered in the currently loaded page, we want to
@@ -32791,32 +32797,57 @@
32791
32797
  let {
32792
32798
  model,
32793
32799
  keyboard,
32794
- dense = false
32800
+ dense = false,
32801
+ visible = true
32795
32802
  } = _ref;
32796
32803
  const {
32797
32804
  translator
32798
32805
  } = react.exports.useContext(InstanceContext);
32799
32806
  const [value, setValue] = react.exports.useState('');
32807
+ const [isSearching, setIsSearching] = react.exports.useState(false);
32800
32808
  const theme = useTheme$1();
32801
32809
 
32810
+ const abortSearch = async () => {
32811
+ await model.abortListObjectSearch(TREE_PATH);
32812
+ setIsSearching(false);
32813
+ };
32814
+
32815
+ react.exports.useEffect(() => {
32816
+ if (!visible && isSearching) {
32817
+ abortSearch();
32818
+ }
32819
+ }, [visible]);
32820
+
32802
32821
  const onChange = e => {
32803
32822
  setValue(e.target.value);
32804
- model.searchListObjectFor(TREE_PATH, e.target.value);
32823
+
32824
+ if (e.target.value.length === 0) {
32825
+ abortSearch();
32826
+ } else {
32827
+ model.searchListObjectFor(TREE_PATH, e.target.value);
32828
+ setIsSearching(true);
32829
+ }
32805
32830
  };
32806
32831
 
32807
32832
  const onKeyDown = e => {
32808
32833
  switch (e.key) {
32809
32834
  case 'Enter':
32835
+ // Maybe we only want to accept if isSearching is true
32810
32836
  model.acceptListObjectSearch(TREE_PATH, true);
32811
32837
  setValue('');
32812
32838
  break;
32813
32839
 
32814
32840
  case 'Escape':
32815
- model.abortListObjectSearch(TREE_PATH);
32841
+ abortSearch();
32842
+ setValue('');
32816
32843
  break;
32817
32844
  }
32818
32845
  };
32819
32846
 
32847
+ if (!visible) {
32848
+ return null;
32849
+ }
32850
+
32820
32851
  return /*#__PURE__*/React.createElement(OutlinedInput, {
32821
32852
  startAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
32822
32853
  position: "start"
@@ -33212,7 +33243,8 @@
33212
33243
  }, /*#__PURE__*/React.createElement("div", {
33213
33244
  ref: moreAlignTo
33214
33245
  }), /*#__PURE__*/React.createElement(ListBoxSearch, {
33215
- model: model
33246
+ model: model,
33247
+ visible: true
33216
33248
  }), /*#__PURE__*/React.createElement(ListBox, {
33217
33249
  model: model,
33218
33250
  selections: selections,
@@ -34467,7 +34499,7 @@
34467
34499
  * user interact outside of passed element ref.
34468
34500
  */
34469
34501
 
34470
- function useConfirmUnfocus(ref, selections) {
34502
+ function useConfirmUnfocus(ref, selections, shouldConfirmOnBlur) {
34471
34503
  const [_isConfirmed, _setIsConfirmed] = react.exports.useState(false); // Wrap state in ref to use inside eventListener callback
34472
34504
 
34473
34505
  const isConfirmedRef = react.exports.useRef(_isConfirmed);
@@ -34479,6 +34511,8 @@
34479
34511
  };
34480
34512
 
34481
34513
  react.exports.useEffect(() => {
34514
+ if (!shouldConfirmOnBlur) return undefined;
34515
+
34482
34516
  const handleEvent = event => {
34483
34517
  const interactInside = ref.current && ref.current.contains(event.target);
34484
34518
  const isConfirmed = isConfirmedRef.current;
@@ -34497,7 +34531,7 @@
34497
34531
  document.removeEventListener('mousedown', handleEvent);
34498
34532
  document.removeEventListener('keydown', handleEvent);
34499
34533
  };
34500
- }, [ref, selections]);
34534
+ }, [ref, selections, shouldConfirmOnBlur]);
34501
34535
  }
34502
34536
 
34503
34537
  const PREFIX$4 = 'ListBoxInline';
@@ -34539,7 +34573,8 @@
34539
34573
  showGray = true,
34540
34574
  sortByState = 1,
34541
34575
  scrollState = undefined,
34542
- setCount = undefined
34576
+ setCount = undefined,
34577
+ shouldConfirmOnBlur = undefined
34543
34578
  } = options;
34544
34579
  let {
34545
34580
  frequencyMode,
@@ -34694,7 +34729,7 @@
34694
34729
  }
34695
34730
  }, [selections]);
34696
34731
  const listBoxRef = react.exports.useRef(null);
34697
- useConfirmUnfocus(listBoxRef, selections);
34732
+ useConfirmUnfocus(listBoxRef, selections, shouldConfirmOnBlur);
34698
34733
  react.exports.useEffect(() => {
34699
34734
  if (!searchContainer || !searchContainer.current) {
34700
34735
  return;
@@ -34720,7 +34755,9 @@
34720
34755
  const counts = layout.qListObject.qDimensionInfo.qStateCounts;
34721
34756
  const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
34722
34757
  const searchVisible = (search === true || search === 'toggle' && showSearch) && !selectDisabled();
34723
- const minHeight = 49 + (searchVisible ? 40 : 0) + 49;
34758
+ const searchHeight = dense ? 27 : 40;
34759
+ const extraheight = dense ? 39 : 49;
34760
+ const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
34724
34761
 
34725
34762
  const onShowSearch = () => {
34726
34763
  const newValue = !showSearch;
@@ -34795,13 +34832,14 @@
34795
34832
  onConfirm: () => {},
34796
34833
  onCancel: () => {}
34797
34834
  }
34798
- }))), searchVisible && /*#__PURE__*/React.createElement(Grid, {
34835
+ }))), /*#__PURE__*/React.createElement(Grid, {
34799
34836
  item: true,
34800
34837
  ref: searchContainerRef
34801
34838
  }, /*#__PURE__*/React.createElement(ListBoxSearch, {
34802
34839
  model: model,
34803
34840
  dense: dense,
34804
- keyboard: keyboard
34841
+ keyboard: keyboard,
34842
+ visible: searchVisible
34805
34843
  })), /*#__PURE__*/React.createElement(Grid, {
34806
34844
  item: true,
34807
34845
  xs: true
@@ -37213,7 +37251,7 @@
37213
37251
 
37214
37252
  load(layout.visualization, withVersion);
37215
37253
  return () => {};
37216
- }, [types, state.sn, model, layout, appLayout, language]); // Long running query
37254
+ }, [types, state.sn, model, selections, layout, appLayout, language]); // Long running query
37217
37255
 
37218
37256
  react.exports.useEffect(() => {
37219
37257
  if (!validating) {
@@ -42000,6 +42038,7 @@
42000
42038
  * @property {{setScrollPos:function(number):void, initScrollPos:number}} [options.scrollState=] Object including a setScrollPos function that sets current scroll position index. A initial scroll position index.
42001
42039
  * @property {number=} [options.sortByState=1] Sort by state, detault 1 = sort descending, 0 = no sorting, -1 sort ascending.
42002
42040
  * @property {function(number):void} [options.setCount=] A function that gets called with the length of the data in the Listbox.
42041
+ * @property {boolean} [options.shouldConfirmOnBlur=] A boolean that determines if the listbox should actively confirm selections on blur events.
42003
42042
  */
42004
42043
 
42005
42044
  /**
@@ -42425,7 +42464,7 @@
42425
42464
  var enigmaMocker_dev = {exports: {}};
42426
42465
 
42427
42466
  /*
42428
- * @nebula.js/enigma-mocker v3.0.0-alpha0
42467
+ * @nebula.js/enigma-mocker v3.0.0-alpha5
42429
42468
  * Copyright (c) 2022 QlikTech International AB
42430
42469
  * Released under the MIT license.
42431
42470
  */