@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.
package/core/esm/dev.js CHANGED
@@ -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
  */
@@ -11424,7 +11424,7 @@ function create$3(definition) {
11424
11424
  return cache[key];
11425
11425
  }
11426
11426
 
11427
- const NEBULA_VERSION_HASH = "4ced" ;
11427
+ const NEBULA_VERSION_HASH = "d97f" ;
11428
11428
  ClassNameGenerator.configure(componentName => {
11429
11429
 
11430
11430
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
@@ -11997,7 +11997,7 @@ function boot(_ref2) {
11997
11997
  const appRef = React__default.createRef();
11998
11998
  const element = document.createElement('div');
11999
11999
  element.style.display = 'none';
12000
- element.setAttribute('data-nebulajs-version', "3.0.0-alpha1" );
12000
+ element.setAttribute('data-nebulajs-version', "3.0.0-alpha10" );
12001
12001
  element.setAttribute('data-app-id', app.id);
12002
12002
  document.body.appendChild(element);
12003
12003
  ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
@@ -13951,7 +13951,8 @@ const Root$1 = styled('div')(_ref2 => {
13951
13951
  paddingRight: '8px'
13952
13952
  },
13953
13953
  ["&.".concat(classes$a.barContainer)]: {
13954
- position: 'relative'
13954
+ height: '100%',
13955
+ display: 'inline-block'
13955
13956
  },
13956
13957
  ["& .".concat(classes$a.bar)]: {
13957
13958
  border: "".concat(barBorderWidthPx, "px solid"),
@@ -13987,8 +13988,7 @@ function RowColumn(_ref3) {
13987
13988
  let {
13988
13989
  index,
13989
13990
  style,
13990
- data,
13991
- column = false
13991
+ data
13992
13992
  } = _ref3;
13993
13993
  const {
13994
13994
  onClick,
@@ -13997,6 +13997,7 @@ function RowColumn(_ref3) {
13997
13997
  onMouseEnter,
13998
13998
  pages,
13999
13999
  isLocked,
14000
+ column = false,
14000
14001
  checkboxes = false,
14001
14002
  dense = false,
14002
14003
  frequencyMode = 'N',
@@ -14411,7 +14412,7 @@ function ListBox(_ref2) {
14411
14412
  if (typeof setCount === 'function' && layout) {
14412
14413
  setCount(layout.qListObject.qSize.qcy);
14413
14414
  }
14414
- }, [layout]);
14415
+ }, [layout, layout && layout.qListObject.qSize.qcy]);
14415
14416
  useEffect$1(() => {
14416
14417
  if (!instantPages || isLoadingData) {
14417
14418
  return;
@@ -14433,7 +14434,12 @@ function ListBox(_ref2) {
14433
14434
  }
14434
14435
 
14435
14436
  const isVertical = listLayout !== 'horizontal';
14436
- const count = layout.qListObject.qSize.qcy;
14437
+ let count = layout.qListObject.qSize.qcy; // Should not allow a count of zero since it will stop executing loadMoreItems
14438
+ // this could happen if a seach returns an empty result
14439
+
14440
+ if (count === 0) {
14441
+ count = 1;
14442
+ }
14437
14443
 
14438
14444
  const getCalculatedHeight = ps => {
14439
14445
  // If values have been filtered in the currently loaded page, we want to
@@ -15097,32 +15103,57 @@ function ListBoxSearch(_ref) {
15097
15103
  let {
15098
15104
  model,
15099
15105
  keyboard,
15100
- dense = false
15106
+ dense = false,
15107
+ visible = true
15101
15108
  } = _ref;
15102
15109
  const {
15103
15110
  translator
15104
15111
  } = useContext(InstanceContext);
15105
15112
  const [value, setValue] = useState$1('');
15113
+ const [isSearching, setIsSearching] = useState$1(false);
15106
15114
  const theme = useTheme$1();
15107
15115
 
15116
+ const abortSearch = async () => {
15117
+ await model.abortListObjectSearch(TREE_PATH);
15118
+ setIsSearching(false);
15119
+ };
15120
+
15121
+ useEffect$1(() => {
15122
+ if (!visible && isSearching) {
15123
+ abortSearch();
15124
+ }
15125
+ }, [visible]);
15126
+
15108
15127
  const onChange = e => {
15109
15128
  setValue(e.target.value);
15110
- model.searchListObjectFor(TREE_PATH, e.target.value);
15129
+
15130
+ if (e.target.value.length === 0) {
15131
+ abortSearch();
15132
+ } else {
15133
+ model.searchListObjectFor(TREE_PATH, e.target.value);
15134
+ setIsSearching(true);
15135
+ }
15111
15136
  };
15112
15137
 
15113
15138
  const onKeyDown = e => {
15114
15139
  switch (e.key) {
15115
15140
  case 'Enter':
15141
+ // Maybe we only want to accept if isSearching is true
15116
15142
  model.acceptListObjectSearch(TREE_PATH, true);
15117
15143
  setValue('');
15118
15144
  break;
15119
15145
 
15120
15146
  case 'Escape':
15121
- model.abortListObjectSearch(TREE_PATH);
15147
+ abortSearch();
15148
+ setValue('');
15122
15149
  break;
15123
15150
  }
15124
15151
  };
15125
15152
 
15153
+ if (!visible) {
15154
+ return null;
15155
+ }
15156
+
15126
15157
  return /*#__PURE__*/React__default.createElement(OutlinedInput, {
15127
15158
  startAdornment: /*#__PURE__*/React__default.createElement(InputAdornment, {
15128
15159
  position: "start"
@@ -15518,7 +15549,8 @@ function ListBoxPopover(_ref) {
15518
15549
  }, /*#__PURE__*/React__default.createElement("div", {
15519
15550
  ref: moreAlignTo
15520
15551
  }), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
15521
- model: model
15552
+ model: model,
15553
+ visible: true
15522
15554
  }), /*#__PURE__*/React__default.createElement(ListBox, {
15523
15555
  model: model,
15524
15556
  selections: selections,
@@ -16773,7 +16805,7 @@ AutoSizer.defaultProps = {
16773
16805
  * user interact outside of passed element ref.
16774
16806
  */
16775
16807
 
16776
- function useConfirmUnfocus(ref, selections) {
16808
+ function useConfirmUnfocus(ref, selections, shouldConfirmOnBlur) {
16777
16809
  const [_isConfirmed, _setIsConfirmed] = useState$1(false); // Wrap state in ref to use inside eventListener callback
16778
16810
 
16779
16811
  const isConfirmedRef = useRef(_isConfirmed);
@@ -16785,6 +16817,8 @@ function useConfirmUnfocus(ref, selections) {
16785
16817
  };
16786
16818
 
16787
16819
  useEffect$1(() => {
16820
+ if (!shouldConfirmOnBlur) return undefined;
16821
+
16788
16822
  const handleEvent = event => {
16789
16823
  const interactInside = ref.current && ref.current.contains(event.target);
16790
16824
  const isConfirmed = isConfirmedRef.current;
@@ -16803,7 +16837,7 @@ function useConfirmUnfocus(ref, selections) {
16803
16837
  document.removeEventListener('mousedown', handleEvent);
16804
16838
  document.removeEventListener('keydown', handleEvent);
16805
16839
  };
16806
- }, [ref, selections]);
16840
+ }, [ref, selections, shouldConfirmOnBlur]);
16807
16841
  }
16808
16842
 
16809
16843
  const PREFIX$4 = 'ListBoxInline';
@@ -16845,7 +16879,8 @@ function ListBoxInline(_ref) {
16845
16879
  showGray = true,
16846
16880
  sortByState = 1,
16847
16881
  scrollState = undefined,
16848
- setCount = undefined
16882
+ setCount = undefined,
16883
+ shouldConfirmOnBlur = undefined
16849
16884
  } = options;
16850
16885
  let {
16851
16886
  frequencyMode,
@@ -17000,7 +17035,7 @@ function ListBoxInline(_ref) {
17000
17035
  }
17001
17036
  }, [selections]);
17002
17037
  const listBoxRef = useRef(null);
17003
- useConfirmUnfocus(listBoxRef, selections);
17038
+ useConfirmUnfocus(listBoxRef, selections, shouldConfirmOnBlur);
17004
17039
  useEffect$1(() => {
17005
17040
  if (!searchContainer || !searchContainer.current) {
17006
17041
  return;
@@ -17026,7 +17061,9 @@ function ListBoxInline(_ref) {
17026
17061
  const counts = layout.qListObject.qDimensionInfo.qStateCounts;
17027
17062
  const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
17028
17063
  const searchVisible = (search === true || search === 'toggle' && showSearch) && !selectDisabled();
17029
- const minHeight = 49 + (searchVisible ? 40 : 0) + 49;
17064
+ const searchHeight = dense ? 27 : 40;
17065
+ const extraheight = dense ? 39 : 49;
17066
+ const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
17030
17067
 
17031
17068
  const onShowSearch = () => {
17032
17069
  const newValue = !showSearch;
@@ -17101,13 +17138,14 @@ function ListBoxInline(_ref) {
17101
17138
  onConfirm: () => {},
17102
17139
  onCancel: () => {}
17103
17140
  }
17104
- }))), searchVisible && /*#__PURE__*/React__default.createElement(Grid, {
17141
+ }))), /*#__PURE__*/React__default.createElement(Grid, {
17105
17142
  item: true,
17106
17143
  ref: searchContainerRef
17107
17144
  }, /*#__PURE__*/React__default.createElement(ListBoxSearch, {
17108
17145
  model: model,
17109
17146
  dense: dense,
17110
- keyboard: keyboard
17147
+ keyboard: keyboard,
17148
+ visible: searchVisible
17111
17149
  })), /*#__PURE__*/React__default.createElement(Grid, {
17112
17150
  item: true,
17113
17151
  xs: true
@@ -19519,7 +19557,7 @@ const Cell = forwardRef((_ref6, ref) => {
19519
19557
 
19520
19558
  load(layout.visualization, withVersion);
19521
19559
  return () => {};
19522
- }, [types, state.sn, model, layout, appLayout, language]); // Long running query
19560
+ }, [types, state.sn, model, selections, layout, appLayout, language]); // Long running query
19523
19561
 
19524
19562
  useEffect$1(() => {
19525
19563
  if (!validating) {
@@ -24306,6 +24344,7 @@ const mergeConfigs = (base, c) => ({
24306
24344
  * @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.
24307
24345
  * @property {number=} [options.sortByState=1] Sort by state, detault 1 = sort descending, 0 = no sorting, -1 sort ascending.
24308
24346
  * @property {function(number):void} [options.setCount=] A function that gets called with the length of the data in the Listbox.
24347
+ * @property {boolean} [options.shouldConfirmOnBlur=] A boolean that determines if the listbox should actively confirm selections on blur events.
24309
24348
  */
24310
24349
 
24311
24350
  /**
@@ -24731,7 +24770,7 @@ var enigmaMocker = {exports: {}};
24731
24770
  var enigmaMocker_dev = {exports: {}};
24732
24771
 
24733
24772
  /*
24734
- * @nebula.js/enigma-mocker v3.0.0-alpha0
24773
+ * @nebula.js/enigma-mocker v3.0.0-alpha5
24735
24774
  * Copyright (c) 2022 QlikTech International AB
24736
24775
  * Released under the MIT license.
24737
24776
  */