@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.
@@ -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
  */
@@ -16197,7 +16197,7 @@
16197
16197
  return cache[key];
16198
16198
  }
16199
16199
 
16200
- const NEBULA_VERSION_HASH = "30d9" ;
16200
+ const NEBULA_VERSION_HASH = "f812" ;
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-alpha0" );
16773
+ element.setAttribute('data-nebulajs-version', "3.0.0-alpha11" );
16774
16774
  element.setAttribute('data-app-id', app.id);
16775
16775
  document.body.appendChild(element);
16776
16776
  ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
@@ -31322,8 +31322,7 @@
31322
31322
  disableRipple: true,
31323
31323
  size: dense ? 'small' : 'medium',
31324
31324
  sx: dense && {
31325
- padding: '0px',
31326
- paddingLeft: '6px'
31325
+ padding: '0px 0px 0px 12px'
31327
31326
  }
31328
31327
  });
31329
31328
  }
@@ -31646,7 +31645,8 @@
31646
31645
  paddingRight: '8px'
31647
31646
  },
31648
31647
  ["&.".concat(classes$a.barContainer)]: {
31649
- position: 'relative'
31648
+ height: '100%',
31649
+ display: 'inline-block'
31650
31650
  },
31651
31651
  ["& .".concat(classes$a.bar)]: {
31652
31652
  border: "".concat(barBorderWidthPx, "px solid"),
@@ -31672,7 +31672,8 @@
31672
31672
  borderColor: '#BFE5D0'
31673
31673
  },
31674
31674
  ["& .".concat(classes$a.excludedTextWithCheckbox)]: {
31675
- color: '#828282'
31675
+ color: '#828282',
31676
+ fontStyle: 'italic'
31676
31677
  }
31677
31678
  };
31678
31679
  });
@@ -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',
@@ -32060,13 +32061,22 @@
32060
32061
  setIsLoadingData(true);
32061
32062
  return new Promise(resolve => {
32062
32063
  local.current.timeout = setTimeout(() => {
32063
- const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
32064
- const reqPromise = model.getListObjectData('/qListObjectDef', sorted.map(s => ({
32065
- qTop: s.start,
32066
- qHeight: s.stop - s.start + 1,
32064
+ const lastItemInQueue = local.current.queue.slice(-1)[0];
32065
+ const reqPromise = model.getListObjectData('/qListObjectDef', // we need to ask for two payloads
32066
+ // 2nd one is our starting index + MINIMUM_BATCH_SIZE items
32067
+ // 1st one is 2nd ones starting index - MINIMUM_BATCH_SIZE items
32068
+ // we do this because we don't want to miss any items between fast scrolls
32069
+ [{
32070
+ qTop: lastItemInQueue.start > MINIMUM_BATCH_SIZE ? lastItemInQueue.start - MINIMUM_BATCH_SIZE : 0,
32071
+ qHeight: MINIMUM_BATCH_SIZE,
32072
+ qLeft: 0,
32073
+ qWidth: 1
32074
+ }, {
32075
+ qTop: lastItemInQueue.start,
32076
+ qHeight: MINIMUM_BATCH_SIZE,
32067
32077
  qLeft: 0,
32068
32078
  qWidth: 1
32069
- }))).then(p => {
32079
+ }]).then(p => {
32070
32080
  const processedPages = postProcessPages ? postProcessPages(p) : p;
32071
32081
  local.current.validPages = true;
32072
32082
  listData.current.pages = processedPages;
@@ -32105,7 +32115,7 @@
32105
32115
  if (typeof setCount === 'function' && layout) {
32106
32116
  setCount(layout.qListObject.qSize.qcy);
32107
32117
  }
32108
- }, [layout]);
32118
+ }, [layout, layout && layout.qListObject.qSize.qcy]);
32109
32119
  react.exports.useEffect(() => {
32110
32120
  if (!instantPages || isLoadingData) {
32111
32121
  return;
@@ -32127,7 +32137,12 @@
32127
32137
  }
32128
32138
 
32129
32139
  const isVertical = listLayout !== 'horizontal';
32130
- const count = layout.qListObject.qSize.qcy;
32140
+ let count = layout.qListObject.qSize.qcy; // Should not allow a count of zero since it will stop executing loadMoreItems
32141
+ // this could happen if a seach returns an empty result
32142
+
32143
+ if (count === 0) {
32144
+ count = 1;
32145
+ }
32131
32146
 
32132
32147
  const getCalculatedHeight = ps => {
32133
32148
  // If values have been filtered in the currently loaded page, we want to
@@ -32154,7 +32169,7 @@
32154
32169
  } = layout;
32155
32170
  return /*#__PURE__*/React.createElement(StyledInfiniteLoader, {
32156
32171
  isItemLoaded: isItemLoaded,
32157
- itemCount: count,
32172
+ itemCount: listCount,
32158
32173
  loadMoreItems: loadMoreItems,
32159
32174
  threshold: 0,
32160
32175
  minimumBatchSize: MINIMUM_BATCH_SIZE,
@@ -32791,32 +32806,57 @@
32791
32806
  let {
32792
32807
  model,
32793
32808
  keyboard,
32794
- dense = false
32809
+ dense = false,
32810
+ visible = true
32795
32811
  } = _ref;
32796
32812
  const {
32797
32813
  translator
32798
32814
  } = react.exports.useContext(InstanceContext);
32799
32815
  const [value, setValue] = react.exports.useState('');
32816
+ const [isSearching, setIsSearching] = react.exports.useState(false);
32800
32817
  const theme = useTheme$1();
32801
32818
 
32819
+ const abortSearch = async () => {
32820
+ await model.abortListObjectSearch(TREE_PATH);
32821
+ setIsSearching(false);
32822
+ };
32823
+
32824
+ react.exports.useEffect(() => {
32825
+ if (!visible && isSearching) {
32826
+ abortSearch();
32827
+ }
32828
+ }, [visible]);
32829
+
32802
32830
  const onChange = e => {
32803
32831
  setValue(e.target.value);
32804
- model.searchListObjectFor(TREE_PATH, e.target.value);
32832
+
32833
+ if (e.target.value.length === 0) {
32834
+ abortSearch();
32835
+ } else {
32836
+ model.searchListObjectFor(TREE_PATH, e.target.value);
32837
+ setIsSearching(true);
32838
+ }
32805
32839
  };
32806
32840
 
32807
32841
  const onKeyDown = e => {
32808
32842
  switch (e.key) {
32809
32843
  case 'Enter':
32844
+ // Maybe we only want to accept if isSearching is true
32810
32845
  model.acceptListObjectSearch(TREE_PATH, true);
32811
32846
  setValue('');
32812
32847
  break;
32813
32848
 
32814
32849
  case 'Escape':
32815
- model.abortListObjectSearch(TREE_PATH);
32850
+ abortSearch();
32851
+ setValue('');
32816
32852
  break;
32817
32853
  }
32818
32854
  };
32819
32855
 
32856
+ if (!visible) {
32857
+ return null;
32858
+ }
32859
+
32820
32860
  return /*#__PURE__*/React.createElement(OutlinedInput, {
32821
32861
  startAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
32822
32862
  position: "start"
@@ -33212,7 +33252,8 @@
33212
33252
  }, /*#__PURE__*/React.createElement("div", {
33213
33253
  ref: moreAlignTo
33214
33254
  }), /*#__PURE__*/React.createElement(ListBoxSearch, {
33215
- model: model
33255
+ model: model,
33256
+ visible: true
33216
33257
  }), /*#__PURE__*/React.createElement(ListBox, {
33217
33258
  model: model,
33218
33259
  selections: selections,
@@ -33410,15 +33451,14 @@
33410
33451
 
33411
33452
  const PREFIX$6 = 'MultiState';
33412
33453
  const classes$6 = {
33413
- item: "".concat(PREFIX$6, "-item"),
33414
- badge: "".concat(PREFIX$6, "-badge")
33454
+ item: "".concat(PREFIX$6, "-item")
33415
33455
  };
33416
- const StyledListBoxPopover = styled(ListBoxPopover)(_ref => {
33456
+ const StyledGrid$5 = styled(Grid)(_ref => {
33417
33457
  let {
33418
33458
  theme
33419
33459
  } = _ref;
33420
33460
  return {
33421
- ["& .".concat(classes$6.item)]: {
33461
+ ["&.".concat(classes$6.item)]: {
33422
33462
  backgroundColor: theme.palette.background.paper,
33423
33463
  position: 'relative',
33424
33464
  cursor: 'pointer',
@@ -33428,9 +33468,6 @@
33428
33468
  },
33429
33469
  height: '100%',
33430
33470
  alignItems: 'center'
33431
- },
33432
- ["& .".concat(classes$6.badge)]: {
33433
- padding: theme.spacing(0, 1)
33434
33471
  }
33435
33472
  };
33436
33473
  });
@@ -33489,7 +33526,9 @@
33489
33526
  xs: true,
33490
33527
  zeroMinWidth: true
33491
33528
  }, /*#__PURE__*/React.createElement(Badge, {
33492
- className: classes$6.badge,
33529
+ style: {
33530
+ padding: '0px 8px'
33531
+ },
33493
33532
  color: "secondary",
33494
33533
  badgeContent: field.states.length
33495
33534
  }, /*#__PURE__*/React.createElement(Typography, {
@@ -33559,12 +33598,12 @@
33559
33598
  }
33560
33599
  }
33561
33600
  }, Fields);
33562
- const Component = moreAlignTo ? PopoverFields : /*#__PURE__*/React.createElement(Grid, {
33601
+ const Component = moreAlignTo ? PopoverFields : /*#__PURE__*/React.createElement(StyledGrid$5, {
33563
33602
  container: true,
33564
33603
  gap: 0,
33565
33604
  className: classes$6.item,
33566
33605
  onClick: handleShowFields
33567
- }, Header, showFields && PopoverFields, showStateIx > -1 && /*#__PURE__*/React.createElement(StyledListBoxPopover, {
33606
+ }, Header, showFields && PopoverFields, showStateIx > -1 && /*#__PURE__*/React.createElement(ListBoxPopover, {
33568
33607
  alignTo: alignTo,
33569
33608
  show: showStateIx > -1,
33570
33609
  close: handleCloseShowState,
@@ -33572,7 +33611,7 @@
33572
33611
  fieldName: field.selections[showStateIx].qField,
33573
33612
  stateName: field.states[showStateIx]
33574
33613
  }));
33575
- return moreAlignTo && showStateIx > -1 ? /*#__PURE__*/React.createElement(StyledListBoxPopover, {
33614
+ return moreAlignTo && showStateIx > -1 ? /*#__PURE__*/React.createElement(ListBoxPopover, {
33576
33615
  alignTo: alignTo,
33577
33616
  show: showStateIx > -1,
33578
33617
  close: handleCloseShowState,
@@ -34469,7 +34508,7 @@
34469
34508
  * user interact outside of passed element ref.
34470
34509
  */
34471
34510
 
34472
- function useConfirmUnfocus(ref, selections) {
34511
+ function useConfirmUnfocus(ref, selections, shouldConfirmOnBlur) {
34473
34512
  const [_isConfirmed, _setIsConfirmed] = react.exports.useState(false); // Wrap state in ref to use inside eventListener callback
34474
34513
 
34475
34514
  const isConfirmedRef = react.exports.useRef(_isConfirmed);
@@ -34481,6 +34520,8 @@
34481
34520
  };
34482
34521
 
34483
34522
  react.exports.useEffect(() => {
34523
+ if (!shouldConfirmOnBlur) return undefined;
34524
+
34484
34525
  const handleEvent = event => {
34485
34526
  const interactInside = ref.current && ref.current.contains(event.target);
34486
34527
  const isConfirmed = isConfirmedRef.current;
@@ -34499,7 +34540,7 @@
34499
34540
  document.removeEventListener('mousedown', handleEvent);
34500
34541
  document.removeEventListener('keydown', handleEvent);
34501
34542
  };
34502
- }, [ref, selections]);
34543
+ }, [ref, selections, shouldConfirmOnBlur]);
34503
34544
  }
34504
34545
 
34505
34546
  const PREFIX$4 = 'ListBoxInline';
@@ -34541,7 +34582,8 @@
34541
34582
  showGray = true,
34542
34583
  sortByState = 1,
34543
34584
  scrollState = undefined,
34544
- setCount = undefined
34585
+ setCount = undefined,
34586
+ shouldConfirmOnBlur = undefined
34545
34587
  } = options;
34546
34588
  let {
34547
34589
  frequencyMode,
@@ -34696,7 +34738,7 @@
34696
34738
  }
34697
34739
  }, [selections]);
34698
34740
  const listBoxRef = react.exports.useRef(null);
34699
- useConfirmUnfocus(listBoxRef, selections);
34741
+ useConfirmUnfocus(listBoxRef, selections, shouldConfirmOnBlur);
34700
34742
  react.exports.useEffect(() => {
34701
34743
  if (!searchContainer || !searchContainer.current) {
34702
34744
  return;
@@ -34722,7 +34764,9 @@
34722
34764
  const counts = layout.qListObject.qDimensionInfo.qStateCounts;
34723
34765
  const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
34724
34766
  const searchVisible = (search === true || search === 'toggle' && showSearch) && !selectDisabled();
34725
- const minHeight = 49 + (searchVisible ? 40 : 0) + 49;
34767
+ const searchHeight = dense ? 27 : 40;
34768
+ const extraheight = dense ? 39 : 49;
34769
+ const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
34726
34770
 
34727
34771
  const onShowSearch = () => {
34728
34772
  const newValue = !showSearch;
@@ -34797,13 +34841,14 @@
34797
34841
  onConfirm: () => {},
34798
34842
  onCancel: () => {}
34799
34843
  }
34800
- }))), searchVisible && /*#__PURE__*/React.createElement(Grid, {
34844
+ }))), /*#__PURE__*/React.createElement(Grid, {
34801
34845
  item: true,
34802
34846
  ref: searchContainerRef
34803
34847
  }, /*#__PURE__*/React.createElement(ListBoxSearch, {
34804
34848
  model: model,
34805
34849
  dense: dense,
34806
- keyboard: keyboard
34850
+ keyboard: keyboard,
34851
+ visible: searchVisible
34807
34852
  })), /*#__PURE__*/React.createElement(Grid, {
34808
34853
  item: true,
34809
34854
  xs: true
@@ -37215,7 +37260,7 @@
37215
37260
 
37216
37261
  load(layout.visualization, withVersion);
37217
37262
  return () => {};
37218
- }, [types, state.sn, model, layout, appLayout, language]); // Long running query
37263
+ }, [types, state.sn, model, selections, layout, appLayout, language]); // Long running query
37219
37264
 
37220
37265
  react.exports.useEffect(() => {
37221
37266
  if (!validating) {
@@ -42002,6 +42047,7 @@
42002
42047
  * @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.
42003
42048
  * @property {number=} [options.sortByState=1] Sort by state, detault 1 = sort descending, 0 = no sorting, -1 sort ascending.
42004
42049
  * @property {function(number):void} [options.setCount=] A function that gets called with the length of the data in the Listbox.
42050
+ * @property {boolean} [options.shouldConfirmOnBlur=] A boolean that determines if the listbox should actively confirm selections on blur events.
42005
42051
  */
42006
42052
 
42007
42053
  /**
@@ -42427,7 +42473,7 @@
42427
42473
  var enigmaMocker_dev = {exports: {}};
42428
42474
 
42429
42475
  /*
42430
- * @nebula.js/enigma-mocker v2.11.0
42476
+ * @nebula.js/enigma-mocker v3.0.0-alpha10
42431
42477
  * Copyright (c) 2022 QlikTech International AB
42432
42478
  * Released under the MIT license.
42433
42479
  */