@nebula.js/stardust 3.0.0-alpha0 → 3.0.0-alpha11

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-alpha0
2
+ * @nebula.js/stardust v3.0.0-alpha11
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 = "30d9" ;
11427
+ const NEBULA_VERSION_HASH = "f812" ;
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-alpha0" );
12000
+ element.setAttribute('data-nebulajs-version', "3.0.0-alpha11" );
12001
12001
  element.setAttribute('data-app-id', app.id);
12002
12002
  document.body.appendChild(element);
12003
12003
  ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
@@ -13628,8 +13628,7 @@ function ListBoxRadioButton(_ref) {
13628
13628
  disableRipple: true,
13629
13629
  size: dense ? 'small' : 'medium',
13630
13630
  sx: dense && {
13631
- padding: '0px',
13632
- paddingLeft: '6px'
13631
+ padding: '0px 0px 0px 12px'
13633
13632
  }
13634
13633
  });
13635
13634
  }
@@ -13952,7 +13951,8 @@ const Root$1 = styled('div')(_ref2 => {
13952
13951
  paddingRight: '8px'
13953
13952
  },
13954
13953
  ["&.".concat(classes$a.barContainer)]: {
13955
- position: 'relative'
13954
+ height: '100%',
13955
+ display: 'inline-block'
13956
13956
  },
13957
13957
  ["& .".concat(classes$a.bar)]: {
13958
13958
  border: "".concat(barBorderWidthPx, "px solid"),
@@ -13978,7 +13978,8 @@ const Root$1 = styled('div')(_ref2 => {
13978
13978
  borderColor: '#BFE5D0'
13979
13979
  },
13980
13980
  ["& .".concat(classes$a.excludedTextWithCheckbox)]: {
13981
- color: '#828282'
13981
+ color: '#828282',
13982
+ fontStyle: 'italic'
13982
13983
  }
13983
13984
  };
13984
13985
  });
@@ -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',
@@ -14366,13 +14367,22 @@ function ListBox(_ref2) {
14366
14367
  setIsLoadingData(true);
14367
14368
  return new Promise(resolve => {
14368
14369
  local.current.timeout = setTimeout(() => {
14369
- const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
14370
- const reqPromise = model.getListObjectData('/qListObjectDef', sorted.map(s => ({
14371
- qTop: s.start,
14372
- qHeight: s.stop - s.start + 1,
14370
+ const lastItemInQueue = local.current.queue.slice(-1)[0];
14371
+ const reqPromise = model.getListObjectData('/qListObjectDef', // we need to ask for two payloads
14372
+ // 2nd one is our starting index + MINIMUM_BATCH_SIZE items
14373
+ // 1st one is 2nd ones starting index - MINIMUM_BATCH_SIZE items
14374
+ // we do this because we don't want to miss any items between fast scrolls
14375
+ [{
14376
+ qTop: lastItemInQueue.start > MINIMUM_BATCH_SIZE ? lastItemInQueue.start - MINIMUM_BATCH_SIZE : 0,
14377
+ qHeight: MINIMUM_BATCH_SIZE,
14373
14378
  qLeft: 0,
14374
14379
  qWidth: 1
14375
- }))).then(p => {
14380
+ }, {
14381
+ qTop: lastItemInQueue.start,
14382
+ qHeight: MINIMUM_BATCH_SIZE,
14383
+ qLeft: 0,
14384
+ qWidth: 1
14385
+ }]).then(p => {
14376
14386
  const processedPages = postProcessPages ? postProcessPages(p) : p;
14377
14387
  local.current.validPages = true;
14378
14388
  listData.current.pages = processedPages;
@@ -14411,7 +14421,7 @@ function ListBox(_ref2) {
14411
14421
  if (typeof setCount === 'function' && layout) {
14412
14422
  setCount(layout.qListObject.qSize.qcy);
14413
14423
  }
14414
- }, [layout]);
14424
+ }, [layout, layout && layout.qListObject.qSize.qcy]);
14415
14425
  useEffect$1(() => {
14416
14426
  if (!instantPages || isLoadingData) {
14417
14427
  return;
@@ -14433,7 +14443,12 @@ function ListBox(_ref2) {
14433
14443
  }
14434
14444
 
14435
14445
  const isVertical = listLayout !== 'horizontal';
14436
- const count = layout.qListObject.qSize.qcy;
14446
+ let count = layout.qListObject.qSize.qcy; // Should not allow a count of zero since it will stop executing loadMoreItems
14447
+ // this could happen if a seach returns an empty result
14448
+
14449
+ if (count === 0) {
14450
+ count = 1;
14451
+ }
14437
14452
 
14438
14453
  const getCalculatedHeight = ps => {
14439
14454
  // If values have been filtered in the currently loaded page, we want to
@@ -14460,7 +14475,7 @@ function ListBox(_ref2) {
14460
14475
  } = layout;
14461
14476
  return /*#__PURE__*/React__default.createElement(StyledInfiniteLoader, {
14462
14477
  isItemLoaded: isItemLoaded,
14463
- itemCount: count,
14478
+ itemCount: listCount,
14464
14479
  loadMoreItems: loadMoreItems,
14465
14480
  threshold: 0,
14466
14481
  minimumBatchSize: MINIMUM_BATCH_SIZE,
@@ -15097,32 +15112,57 @@ function ListBoxSearch(_ref) {
15097
15112
  let {
15098
15113
  model,
15099
15114
  keyboard,
15100
- dense = false
15115
+ dense = false,
15116
+ visible = true
15101
15117
  } = _ref;
15102
15118
  const {
15103
15119
  translator
15104
15120
  } = useContext(InstanceContext);
15105
15121
  const [value, setValue] = useState$1('');
15122
+ const [isSearching, setIsSearching] = useState$1(false);
15106
15123
  const theme = useTheme$1();
15107
15124
 
15125
+ const abortSearch = async () => {
15126
+ await model.abortListObjectSearch(TREE_PATH);
15127
+ setIsSearching(false);
15128
+ };
15129
+
15130
+ useEffect$1(() => {
15131
+ if (!visible && isSearching) {
15132
+ abortSearch();
15133
+ }
15134
+ }, [visible]);
15135
+
15108
15136
  const onChange = e => {
15109
15137
  setValue(e.target.value);
15110
- model.searchListObjectFor(TREE_PATH, e.target.value);
15138
+
15139
+ if (e.target.value.length === 0) {
15140
+ abortSearch();
15141
+ } else {
15142
+ model.searchListObjectFor(TREE_PATH, e.target.value);
15143
+ setIsSearching(true);
15144
+ }
15111
15145
  };
15112
15146
 
15113
15147
  const onKeyDown = e => {
15114
15148
  switch (e.key) {
15115
15149
  case 'Enter':
15150
+ // Maybe we only want to accept if isSearching is true
15116
15151
  model.acceptListObjectSearch(TREE_PATH, true);
15117
15152
  setValue('');
15118
15153
  break;
15119
15154
 
15120
15155
  case 'Escape':
15121
- model.abortListObjectSearch(TREE_PATH);
15156
+ abortSearch();
15157
+ setValue('');
15122
15158
  break;
15123
15159
  }
15124
15160
  };
15125
15161
 
15162
+ if (!visible) {
15163
+ return null;
15164
+ }
15165
+
15126
15166
  return /*#__PURE__*/React__default.createElement(OutlinedInput, {
15127
15167
  startAdornment: /*#__PURE__*/React__default.createElement(InputAdornment, {
15128
15168
  position: "start"
@@ -15518,7 +15558,8 @@ function ListBoxPopover(_ref) {
15518
15558
  }, /*#__PURE__*/React__default.createElement("div", {
15519
15559
  ref: moreAlignTo
15520
15560
  }), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
15521
- model: model
15561
+ model: model,
15562
+ visible: true
15522
15563
  }), /*#__PURE__*/React__default.createElement(ListBox, {
15523
15564
  model: model,
15524
15565
  selections: selections,
@@ -15716,15 +15757,14 @@ var DownArrow = (props => SvgIcon(downArrow(props)));
15716
15757
 
15717
15758
  const PREFIX$6 = 'MultiState';
15718
15759
  const classes$6 = {
15719
- item: "".concat(PREFIX$6, "-item"),
15720
- badge: "".concat(PREFIX$6, "-badge")
15760
+ item: "".concat(PREFIX$6, "-item")
15721
15761
  };
15722
- const StyledListBoxPopover = styled(ListBoxPopover)(_ref => {
15762
+ const StyledGrid$5 = styled(Grid)(_ref => {
15723
15763
  let {
15724
15764
  theme
15725
15765
  } = _ref;
15726
15766
  return {
15727
- ["& .".concat(classes$6.item)]: {
15767
+ ["&.".concat(classes$6.item)]: {
15728
15768
  backgroundColor: theme.palette.background.paper,
15729
15769
  position: 'relative',
15730
15770
  cursor: 'pointer',
@@ -15734,9 +15774,6 @@ const StyledListBoxPopover = styled(ListBoxPopover)(_ref => {
15734
15774
  },
15735
15775
  height: '100%',
15736
15776
  alignItems: 'center'
15737
- },
15738
- ["& .".concat(classes$6.badge)]: {
15739
- padding: theme.spacing(0, 1)
15740
15777
  }
15741
15778
  };
15742
15779
  });
@@ -15795,7 +15832,9 @@ function MultiState(_ref2) {
15795
15832
  xs: true,
15796
15833
  zeroMinWidth: true
15797
15834
  }, /*#__PURE__*/React__default.createElement(Badge, {
15798
- className: classes$6.badge,
15835
+ style: {
15836
+ padding: '0px 8px'
15837
+ },
15799
15838
  color: "secondary",
15800
15839
  badgeContent: field.states.length
15801
15840
  }, /*#__PURE__*/React__default.createElement(Typography, {
@@ -15865,12 +15904,12 @@ function MultiState(_ref2) {
15865
15904
  }
15866
15905
  }
15867
15906
  }, Fields);
15868
- const Component = moreAlignTo ? PopoverFields : /*#__PURE__*/React__default.createElement(Grid, {
15907
+ const Component = moreAlignTo ? PopoverFields : /*#__PURE__*/React__default.createElement(StyledGrid$5, {
15869
15908
  container: true,
15870
15909
  gap: 0,
15871
15910
  className: classes$6.item,
15872
15911
  onClick: handleShowFields
15873
- }, Header, showFields && PopoverFields, showStateIx > -1 && /*#__PURE__*/React__default.createElement(StyledListBoxPopover, {
15912
+ }, Header, showFields && PopoverFields, showStateIx > -1 && /*#__PURE__*/React__default.createElement(ListBoxPopover, {
15874
15913
  alignTo: alignTo,
15875
15914
  show: showStateIx > -1,
15876
15915
  close: handleCloseShowState,
@@ -15878,7 +15917,7 @@ function MultiState(_ref2) {
15878
15917
  fieldName: field.selections[showStateIx].qField,
15879
15918
  stateName: field.states[showStateIx]
15880
15919
  }));
15881
- return moreAlignTo && showStateIx > -1 ? /*#__PURE__*/React__default.createElement(StyledListBoxPopover, {
15920
+ return moreAlignTo && showStateIx > -1 ? /*#__PURE__*/React__default.createElement(ListBoxPopover, {
15882
15921
  alignTo: alignTo,
15883
15922
  show: showStateIx > -1,
15884
15923
  close: handleCloseShowState,
@@ -16775,7 +16814,7 @@ AutoSizer.defaultProps = {
16775
16814
  * user interact outside of passed element ref.
16776
16815
  */
16777
16816
 
16778
- function useConfirmUnfocus(ref, selections) {
16817
+ function useConfirmUnfocus(ref, selections, shouldConfirmOnBlur) {
16779
16818
  const [_isConfirmed, _setIsConfirmed] = useState$1(false); // Wrap state in ref to use inside eventListener callback
16780
16819
 
16781
16820
  const isConfirmedRef = useRef(_isConfirmed);
@@ -16787,6 +16826,8 @@ function useConfirmUnfocus(ref, selections) {
16787
16826
  };
16788
16827
 
16789
16828
  useEffect$1(() => {
16829
+ if (!shouldConfirmOnBlur) return undefined;
16830
+
16790
16831
  const handleEvent = event => {
16791
16832
  const interactInside = ref.current && ref.current.contains(event.target);
16792
16833
  const isConfirmed = isConfirmedRef.current;
@@ -16805,7 +16846,7 @@ function useConfirmUnfocus(ref, selections) {
16805
16846
  document.removeEventListener('mousedown', handleEvent);
16806
16847
  document.removeEventListener('keydown', handleEvent);
16807
16848
  };
16808
- }, [ref, selections]);
16849
+ }, [ref, selections, shouldConfirmOnBlur]);
16809
16850
  }
16810
16851
 
16811
16852
  const PREFIX$4 = 'ListBoxInline';
@@ -16847,7 +16888,8 @@ function ListBoxInline(_ref) {
16847
16888
  showGray = true,
16848
16889
  sortByState = 1,
16849
16890
  scrollState = undefined,
16850
- setCount = undefined
16891
+ setCount = undefined,
16892
+ shouldConfirmOnBlur = undefined
16851
16893
  } = options;
16852
16894
  let {
16853
16895
  frequencyMode,
@@ -17002,7 +17044,7 @@ function ListBoxInline(_ref) {
17002
17044
  }
17003
17045
  }, [selections]);
17004
17046
  const listBoxRef = useRef(null);
17005
- useConfirmUnfocus(listBoxRef, selections);
17047
+ useConfirmUnfocus(listBoxRef, selections, shouldConfirmOnBlur);
17006
17048
  useEffect$1(() => {
17007
17049
  if (!searchContainer || !searchContainer.current) {
17008
17050
  return;
@@ -17028,7 +17070,9 @@ function ListBoxInline(_ref) {
17028
17070
  const counts = layout.qListObject.qDimensionInfo.qStateCounts;
17029
17071
  const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
17030
17072
  const searchVisible = (search === true || search === 'toggle' && showSearch) && !selectDisabled();
17031
- const minHeight = 49 + (searchVisible ? 40 : 0) + 49;
17073
+ const searchHeight = dense ? 27 : 40;
17074
+ const extraheight = dense ? 39 : 49;
17075
+ const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
17032
17076
 
17033
17077
  const onShowSearch = () => {
17034
17078
  const newValue = !showSearch;
@@ -17103,13 +17147,14 @@ function ListBoxInline(_ref) {
17103
17147
  onConfirm: () => {},
17104
17148
  onCancel: () => {}
17105
17149
  }
17106
- }))), searchVisible && /*#__PURE__*/React__default.createElement(Grid, {
17150
+ }))), /*#__PURE__*/React__default.createElement(Grid, {
17107
17151
  item: true,
17108
17152
  ref: searchContainerRef
17109
17153
  }, /*#__PURE__*/React__default.createElement(ListBoxSearch, {
17110
17154
  model: model,
17111
17155
  dense: dense,
17112
- keyboard: keyboard
17156
+ keyboard: keyboard,
17157
+ visible: searchVisible
17113
17158
  })), /*#__PURE__*/React__default.createElement(Grid, {
17114
17159
  item: true,
17115
17160
  xs: true
@@ -19521,7 +19566,7 @@ const Cell = forwardRef((_ref6, ref) => {
19521
19566
 
19522
19567
  load(layout.visualization, withVersion);
19523
19568
  return () => {};
19524
- }, [types, state.sn, model, layout, appLayout, language]); // Long running query
19569
+ }, [types, state.sn, model, selections, layout, appLayout, language]); // Long running query
19525
19570
 
19526
19571
  useEffect$1(() => {
19527
19572
  if (!validating) {
@@ -24308,6 +24353,7 @@ const mergeConfigs = (base, c) => ({
24308
24353
  * @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.
24309
24354
  * @property {number=} [options.sortByState=1] Sort by state, detault 1 = sort descending, 0 = no sorting, -1 sort ascending.
24310
24355
  * @property {function(number):void} [options.setCount=] A function that gets called with the length of the data in the Listbox.
24356
+ * @property {boolean} [options.shouldConfirmOnBlur=] A boolean that determines if the listbox should actively confirm selections on blur events.
24311
24357
  */
24312
24358
 
24313
24359
  /**
@@ -24733,7 +24779,7 @@ var enigmaMocker = {exports: {}};
24733
24779
  var enigmaMocker_dev = {exports: {}};
24734
24780
 
24735
24781
  /*
24736
- * @nebula.js/enigma-mocker v2.11.0
24782
+ * @nebula.js/enigma-mocker v3.0.0-alpha10
24737
24783
  * Copyright (c) 2022 QlikTech International AB
24738
24784
  * Released under the MIT license.
24739
24785
  */