@nebula.js/stardust 4.8.0 → 4.8.1

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 v4.8.0
2
+ * @nebula.js/stardust v4.8.1
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -11820,7 +11820,7 @@
11820
11820
  return cache[key];
11821
11821
  }
11822
11822
 
11823
- const NEBULA_VERSION_HASH = "f910" ;
11823
+ const NEBULA_VERSION_HASH = "cca9" ;
11824
11824
  ClassNameGenerator$1.configure(componentName => {
11825
11825
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
11826
11826
  });
@@ -12081,7 +12081,7 @@
12081
12081
  const appRef = React.createRef();
12082
12082
  const element = document.createElement('div');
12083
12083
  element.style.display = 'none';
12084
- element.setAttribute('data-nebulajs-version', "4.8.0" );
12084
+ element.setAttribute('data-nebulajs-version', "4.8.1" );
12085
12085
  element.setAttribute('data-app-id', app.id);
12086
12086
  document.body.appendChild(element);
12087
12087
  if (context) {
@@ -21984,6 +21984,7 @@
21984
21984
  const GRID_ROW_HEIGHT = 32;
21985
21985
  const LIST_ROW_HEIGHT = 29;
21986
21986
  const DENSE_ROW_HEIGHT = 20; // same for both list and grid in dense mode
21987
+ const GRID_ITEM_PADDING = 4;
21987
21988
 
21988
21989
  const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
21989
21990
  const getBarWidth = _ref => {
@@ -22658,7 +22659,8 @@
22658
22659
  let {
22659
22660
  dataLayout,
22660
22661
  layoutOrder,
22661
- itemPadding
22662
+ itemPadding,
22663
+ fillHeight
22662
22664
  } = _ref;
22663
22665
  // Simulate margin/padding by making the item smaller than its container.
22664
22666
  if (dataLayout === 'singleColumn') {
@@ -22670,14 +22672,14 @@
22670
22672
  switch (layoutOrder) {
22671
22673
  case 'row':
22672
22674
  return {
22673
- height: "calc(100% - ".concat(itemPadding, "px)"),
22675
+ height: fillHeight ? '100%' : "calc(100% - ".concat(itemPadding, "px)"),
22674
22676
  width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22675
22677
  position: 'absolute',
22676
22678
  left: 4
22677
22679
  };
22678
22680
  case 'column':
22679
22681
  return {
22680
- height: "calc(100% - ".concat(itemPadding, "px)"),
22682
+ height: fillHeight ? '100%' : "calc(100% - ".concat(itemPadding, "px)"),
22681
22683
  width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22682
22684
  position: 'absolute',
22683
22685
  left: 4
@@ -22688,21 +22690,23 @@
22688
22690
  }
22689
22691
 
22690
22692
  const ItemGrid = styled$1(Grid$1, {
22691
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction'].includes(prop)
22693
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction', 'fillHeight'].includes(prop)
22692
22694
  })(_ref => {
22693
22695
  let {
22694
22696
  dataLayout,
22695
22697
  layoutOrder,
22696
22698
  itemPadding,
22697
22699
  cellPaddingRight,
22698
- direction
22700
+ direction,
22701
+ fillHeight
22699
22702
  } = _ref;
22700
22703
  const att = "padding".concat(direction === 'rtl' ? 'Left' : 'Right');
22701
22704
  return {
22702
22705
  ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
22703
22706
  dataLayout,
22704
22707
  layoutOrder,
22705
- itemPadding
22708
+ itemPadding,
22709
+ fillHeight
22706
22710
  })), {}, {
22707
22711
  [att]: cellPaddingRight ? '8px' : undefined
22708
22712
  })
@@ -23143,7 +23147,8 @@
23143
23147
  showSearch,
23144
23148
  isModal,
23145
23149
  contentFontStyle,
23146
- styles
23150
+ styles,
23151
+ fillHeight
23147
23152
  } = data;
23148
23153
  const {
23149
23154
  dense = false,
@@ -23171,6 +23176,7 @@
23171
23176
  }
23172
23177
  const padding = 0;
23173
23178
  styleOverrides = _objectSpread2(_objectSpread2({}, style), {}, {
23179
+ height: fillHeight ? '100%' : style.height,
23174
23180
  left: padding + (columnIndex === 0 ? style.left : Number(style.left) + columnIndex * padding),
23175
23181
  // right: columnIndex === columnCount ? style.right : Number(style.right) + columnIndex * padding,
23176
23182
  top: rowIndex === 0 ? style.top : Number(style.top) + rowIndex * padding
@@ -23307,7 +23313,8 @@
23307
23313
  onContextMenu: preventContextMenu,
23308
23314
  tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
23309
23315
  "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber,
23310
- direction: direction
23316
+ direction: direction,
23317
+ fillHeight: fillHeight
23311
23318
  }, (cell === null || cell === void 0 ? void 0 : cell.qFrequency) && /*#__PURE__*/React.createElement(Histogram, {
23312
23319
  qFrequency: cell === null || cell === void 0 ? void 0 : cell.qFrequency,
23313
23320
  histogram: histogram,
@@ -24205,7 +24212,7 @@
24205
24212
  scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
24206
24213
  return {
24207
24214
  isScrolling: true,
24208
- scrollDirection: prevState.scrollOffset < scrollLeft ? 'forward' : 'backward',
24215
+ scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
24209
24216
  scrollOffset: scrollOffset,
24210
24217
  scrollUpdateWasRequested: false
24211
24218
  };
@@ -24947,6 +24954,7 @@
24947
24954
  className: classes$9.styledScrollbars
24948
24955
  };
24949
24956
  const isLocked = layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo.qLocked;
24957
+ const fillHeight = listHeight <= itemHeight;
24950
24958
 
24951
24959
  // Item data common for List and Grid.
24952
24960
  const commonItemData = _objectSpread2(_objectSpread2({
@@ -24980,7 +24988,8 @@
24980
24988
  translator,
24981
24989
  showSearch,
24982
24990
  isModal,
24983
- styles
24991
+ styles,
24992
+ fillHeight
24984
24993
  });
24985
24994
  const List = _ref2 => {
24986
24995
  let {
@@ -25177,6 +25186,21 @@
25177
25186
  return measureString;
25178
25187
  }
25179
25188
 
25189
+ function getItemHeight(_ref) {
25190
+ let {
25191
+ isGridMode,
25192
+ dense
25193
+ } = _ref;
25194
+ const normalItemHeight = isGridMode ? GRID_ROW_HEIGHT : LIST_ROW_HEIGHT;
25195
+ let itemHeight = dense ? DENSE_ROW_HEIGHT : normalItemHeight;
25196
+ if (isGridMode) {
25197
+ // Emulate a margin between items using padding, since the list library
25198
+ // needs an explicit row height and cannot handle margins.
25199
+ itemHeight += GRID_ITEM_PADDING;
25200
+ }
25201
+ return itemHeight;
25202
+ }
25203
+
25180
25204
  function useListSizes(_ref) {
25181
25205
  let {
25182
25206
  layout,
@@ -25232,14 +25256,10 @@
25232
25256
  let columnWidth;
25233
25257
  let rowCount;
25234
25258
  const isGridMode = dataLayout === 'grid';
25235
- const itemPadding = 4;
25236
- const normalItemHeight = isGridMode ? GRID_ROW_HEIGHT : LIST_ROW_HEIGHT;
25237
- let itemHeight = dense ? DENSE_ROW_HEIGHT : normalItemHeight;
25238
- if (isGridMode) {
25239
- // Emulate a margin between items using padding, since the list library
25240
- // needs an explicit row height and cannot handle margins.
25241
- itemHeight += itemPadding;
25242
- }
25259
+ const itemHeight = getItemHeight({
25260
+ isGridMode,
25261
+ dense
25262
+ });
25243
25263
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemHeight;
25244
25264
  if (layoutOrder) {
25245
25265
  // Modify container width to achieve the exact design with 8px margins on each side (left and right).
@@ -25248,7 +25268,7 @@
25248
25268
  overflowStyling = {
25249
25269
  overflowX: 'hidden'
25250
25270
  };
25251
- containerWidth += itemPadding * 2;
25271
+ containerWidth += GRID_ITEM_PADDING * 2;
25252
25272
  ({
25253
25273
  rowCount,
25254
25274
  columnWidth,
@@ -25303,7 +25323,7 @@
25303
25323
  row: maxRowCount,
25304
25324
  column: maxColumnCount
25305
25325
  },
25306
- itemPadding,
25326
+ itemPadding: GRID_ITEM_PADDING,
25307
25327
  textWidth,
25308
25328
  freqMinWidth,
25309
25329
  freqMaxWidth
@@ -30972,6 +30992,33 @@
30972
30992
  return isDQ;
30973
30993
  }
30974
30994
 
30995
+ function getContainerPadding(_ref) {
30996
+ let {
30997
+ isGridMode,
30998
+ dense,
30999
+ height,
31000
+ layoutOrder
31001
+ } = _ref;
31002
+ let containerPadding;
31003
+ if (isGridMode) {
31004
+ const itemHeight = getItemHeight({
31005
+ isGridMode,
31006
+ dense
31007
+ });
31008
+ let paddingY;
31009
+ if (itemHeight > height) {
31010
+ paddingY = '0px';
31011
+ } else {
31012
+ paddingY = '2px';
31013
+ }
31014
+ containerPadding = layoutOrder === 'row' ? "".concat(paddingY, " 4px") : "".concat(paddingY, " 6px ").concat(paddingY, " 4px");
31015
+ } else {
31016
+ containerPadding = undefined; // to prevent overriding any default padding
31017
+ }
31018
+
31019
+ return containerPadding;
31020
+ }
31021
+
30975
31022
  const PREFIX$4 = 'ListBoxInline';
30976
31023
  const classes$4 = {
30977
31024
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
@@ -31050,7 +31097,7 @@
31050
31097
  return (_app$isInModalSelecti = (_app$isInModalSelecti2 = app.isInModalSelection) === null || _app$isInModalSelecti2 === void 0 ? void 0 : _app$isInModalSelecti2.call(app)) !== null && _app$isInModalSelecti !== void 0 ? _app$isInModalSelecti : appSelections.isInModal();
31051
31098
  };
31052
31099
  function ListBoxInline(_ref5) {
31053
- var _layout$qListObject, _layout$qListObject2, _layoutOptions$dense;
31100
+ var _layout$qListObject, _layout$qListObject2, _layoutOptions$dense, _containerRef$current;
31054
31101
  let {
31055
31102
  options,
31056
31103
  layout
@@ -31276,10 +31323,12 @@
31276
31323
 
31277
31324
  // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
31278
31325
  const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
31279
- let containerPadding;
31280
- if (isGridMode) {
31281
- containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
31282
- }
31326
+ const containerPadding = getContainerPadding({
31327
+ isGridMode,
31328
+ dense,
31329
+ height: (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight,
31330
+ layoutOrder: layoutOptions.layoutOrder
31331
+ });
31283
31332
  const searchIconComp = constraints !== null && constraints !== void 0 && constraints.active ? /*#__PURE__*/React.createElement(SearchIcon, {
31284
31333
  title: translator.get('Listbox.Search'),
31285
31334
  size: "large",
@@ -31319,6 +31368,7 @@
31319
31368
  if (isInvalid) {
31320
31369
  renderedCallback === null || renderedCallback === void 0 || renderedCallback();
31321
31370
  }
31371
+ const listBoxMinHeight = showToolbarWithTitle ? DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH : 0;
31322
31372
  return /*#__PURE__*/React.createElement(React.Fragment, null, showDetachedToolbarOnly && /*#__PURE__*/React.createElement(ActionsToolbar, _extends$7({
31323
31373
  direction: direction
31324
31374
  }, getActionToolbarProps(true))), /*#__PURE__*/React.createElement(StyledGrid$3, {
@@ -31384,10 +31434,8 @@
31384
31434
  item: true,
31385
31435
  container: true,
31386
31436
  direction: "column",
31387
- style: {
31388
- height: '100%',
31389
- minHeight: DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH
31390
- },
31437
+ height: "100%",
31438
+ minHeight: listBoxMinHeight,
31391
31439
  role: "region",
31392
31440
  "aria-label": translator.get('Listbox.ResultFilterLabel')
31393
31441
  }, /*#__PURE__*/React.createElement(Grid$1, {