@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.
package/core/esm/dev.js CHANGED
@@ -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
  */
@@ -8551,7 +8551,7 @@ function create$3(definition) {
8551
8551
  return cache[key];
8552
8552
  }
8553
8553
 
8554
- const NEBULA_VERSION_HASH = "f910" ;
8554
+ const NEBULA_VERSION_HASH = "cca9" ;
8555
8555
  ClassNameGenerator$1.configure(componentName => {
8556
8556
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8557
8557
  });
@@ -8812,7 +8812,7 @@ function boot(_ref2) {
8812
8812
  const appRef = React__default.createRef();
8813
8813
  const element = document.createElement('div');
8814
8814
  element.style.display = 'none';
8815
- element.setAttribute('data-nebulajs-version', "4.8.0" );
8815
+ element.setAttribute('data-nebulajs-version', "4.8.1" );
8816
8816
  element.setAttribute('data-app-id', app.id);
8817
8817
  document.body.appendChild(element);
8818
8818
  if (context) {
@@ -10015,6 +10015,7 @@ const barWithCheckboxLeftPadPx = 29;
10015
10015
  const GRID_ROW_HEIGHT = 32;
10016
10016
  const LIST_ROW_HEIGHT = 29;
10017
10017
  const DENSE_ROW_HEIGHT = 20; // same for both list and grid in dense mode
10018
+ const GRID_ITEM_PADDING = 4;
10018
10019
 
10019
10020
  const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
10020
10021
  const getBarWidth = _ref => {
@@ -10689,7 +10690,8 @@ function getGridItemSizes(_ref) {
10689
10690
  let {
10690
10691
  dataLayout,
10691
10692
  layoutOrder,
10692
- itemPadding
10693
+ itemPadding,
10694
+ fillHeight
10693
10695
  } = _ref;
10694
10696
  // Simulate margin/padding by making the item smaller than its container.
10695
10697
  if (dataLayout === 'singleColumn') {
@@ -10701,14 +10703,14 @@ function getGridItemSizes(_ref) {
10701
10703
  switch (layoutOrder) {
10702
10704
  case 'row':
10703
10705
  return {
10704
- height: "calc(100% - ".concat(itemPadding, "px)"),
10706
+ height: fillHeight ? '100%' : "calc(100% - ".concat(itemPadding, "px)"),
10705
10707
  width: "calc(100% - ".concat(2 * itemPadding, "px)"),
10706
10708
  position: 'absolute',
10707
10709
  left: 4
10708
10710
  };
10709
10711
  case 'column':
10710
10712
  return {
10711
- height: "calc(100% - ".concat(itemPadding, "px)"),
10713
+ height: fillHeight ? '100%' : "calc(100% - ".concat(itemPadding, "px)"),
10712
10714
  width: "calc(100% - ".concat(2 * itemPadding, "px)"),
10713
10715
  position: 'absolute',
10714
10716
  left: 4
@@ -10719,21 +10721,23 @@ function getGridItemSizes(_ref) {
10719
10721
  }
10720
10722
 
10721
10723
  const ItemGrid = styled$1(Grid, {
10722
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction'].includes(prop)
10724
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'cellPaddingRight', 'direction', 'fillHeight'].includes(prop)
10723
10725
  })(_ref => {
10724
10726
  let {
10725
10727
  dataLayout,
10726
10728
  layoutOrder,
10727
10729
  itemPadding,
10728
10730
  cellPaddingRight,
10729
- direction
10731
+ direction,
10732
+ fillHeight
10730
10733
  } = _ref;
10731
10734
  const att = "padding".concat(direction === 'rtl' ? 'Left' : 'Right');
10732
10735
  return {
10733
10736
  ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
10734
10737
  dataLayout,
10735
10738
  layoutOrder,
10736
- itemPadding
10739
+ itemPadding,
10740
+ fillHeight
10737
10741
  })), {}, {
10738
10742
  [att]: cellPaddingRight ? '8px' : undefined
10739
10743
  })
@@ -11174,7 +11178,8 @@ function RowColumn(_ref) {
11174
11178
  showSearch,
11175
11179
  isModal,
11176
11180
  contentFontStyle,
11177
- styles
11181
+ styles,
11182
+ fillHeight
11178
11183
  } = data;
11179
11184
  const {
11180
11185
  dense = false,
@@ -11202,6 +11207,7 @@ function RowColumn(_ref) {
11202
11207
  }
11203
11208
  const padding = 0;
11204
11209
  styleOverrides = _objectSpread2(_objectSpread2({}, style), {}, {
11210
+ height: fillHeight ? '100%' : style.height,
11205
11211
  left: padding + (columnIndex === 0 ? style.left : Number(style.left) + columnIndex * padding),
11206
11212
  // right: columnIndex === columnCount ? style.right : Number(style.right) + columnIndex * padding,
11207
11213
  top: rowIndex === 0 ? style.top : Number(style.top) + rowIndex * padding
@@ -11338,7 +11344,8 @@ function RowColumn(_ref) {
11338
11344
  onContextMenu: preventContextMenu,
11339
11345
  tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
11340
11346
  "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber,
11341
- direction: direction
11347
+ direction: direction,
11348
+ fillHeight: fillHeight
11342
11349
  }, (cell === null || cell === void 0 ? void 0 : cell.qFrequency) && /*#__PURE__*/React__default.createElement(Histogram, {
11343
11350
  qFrequency: cell === null || cell === void 0 ? void 0 : cell.qFrequency,
11344
11351
  histogram: histogram,
@@ -12236,7 +12243,7 @@ function createListComponent(_ref) {
12236
12243
  scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
12237
12244
  return {
12238
12245
  isScrolling: true,
12239
- scrollDirection: prevState.scrollOffset < scrollLeft ? 'forward' : 'backward',
12246
+ scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
12240
12247
  scrollOffset: scrollOffset,
12241
12248
  scrollUpdateWasRequested: false
12242
12249
  };
@@ -12978,6 +12985,7 @@ function getListBoxComponents(_ref) {
12978
12985
  className: classes$9.styledScrollbars
12979
12986
  };
12980
12987
  const isLocked = layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo.qLocked;
12988
+ const fillHeight = listHeight <= itemHeight;
12981
12989
 
12982
12990
  // Item data common for List and Grid.
12983
12991
  const commonItemData = _objectSpread2(_objectSpread2({
@@ -13011,7 +13019,8 @@ function getListBoxComponents(_ref) {
13011
13019
  translator,
13012
13020
  showSearch,
13013
13021
  isModal,
13014
- styles
13022
+ styles,
13023
+ fillHeight
13015
13024
  });
13016
13025
  const List = _ref2 => {
13017
13026
  let {
@@ -13208,6 +13217,21 @@ function getMeasureText(layoutOrNumber) {
13208
13217
  return measureString;
13209
13218
  }
13210
13219
 
13220
+ function getItemHeight(_ref) {
13221
+ let {
13222
+ isGridMode,
13223
+ dense
13224
+ } = _ref;
13225
+ const normalItemHeight = isGridMode ? GRID_ROW_HEIGHT : LIST_ROW_HEIGHT;
13226
+ let itemHeight = dense ? DENSE_ROW_HEIGHT : normalItemHeight;
13227
+ if (isGridMode) {
13228
+ // Emulate a margin between items using padding, since the list library
13229
+ // needs an explicit row height and cannot handle margins.
13230
+ itemHeight += GRID_ITEM_PADDING;
13231
+ }
13232
+ return itemHeight;
13233
+ }
13234
+
13211
13235
  function useListSizes(_ref) {
13212
13236
  let {
13213
13237
  layout,
@@ -13263,14 +13287,10 @@ function useListSizes(_ref) {
13263
13287
  let columnWidth;
13264
13288
  let rowCount;
13265
13289
  const isGridMode = dataLayout === 'grid';
13266
- const itemPadding = 4;
13267
- const normalItemHeight = isGridMode ? GRID_ROW_HEIGHT : LIST_ROW_HEIGHT;
13268
- let itemHeight = dense ? DENSE_ROW_HEIGHT : normalItemHeight;
13269
- if (isGridMode) {
13270
- // Emulate a margin between items using padding, since the list library
13271
- // needs an explicit row height and cannot handle margins.
13272
- itemHeight += itemPadding;
13273
- }
13290
+ const itemHeight = getItemHeight({
13291
+ isGridMode,
13292
+ dense
13293
+ });
13274
13294
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemHeight;
13275
13295
  if (layoutOrder) {
13276
13296
  // Modify container width to achieve the exact design with 8px margins on each side (left and right).
@@ -13279,7 +13299,7 @@ function useListSizes(_ref) {
13279
13299
  overflowStyling = {
13280
13300
  overflowX: 'hidden'
13281
13301
  };
13282
- containerWidth += itemPadding * 2;
13302
+ containerWidth += GRID_ITEM_PADDING * 2;
13283
13303
  ({
13284
13304
  rowCount,
13285
13305
  columnWidth,
@@ -13334,7 +13354,7 @@ function useListSizes(_ref) {
13334
13354
  row: maxRowCount,
13335
13355
  column: maxColumnCount
13336
13356
  },
13337
- itemPadding,
13357
+ itemPadding: GRID_ITEM_PADDING,
13338
13358
  textWidth,
13339
13359
  freqMinWidth,
13340
13360
  freqMaxWidth
@@ -19153,6 +19173,33 @@ function isDirectQueryEnabled(_ref) {
19153
19173
  return isDQ;
19154
19174
  }
19155
19175
 
19176
+ function getContainerPadding(_ref) {
19177
+ let {
19178
+ isGridMode,
19179
+ dense,
19180
+ height,
19181
+ layoutOrder
19182
+ } = _ref;
19183
+ let containerPadding;
19184
+ if (isGridMode) {
19185
+ const itemHeight = getItemHeight({
19186
+ isGridMode,
19187
+ dense
19188
+ });
19189
+ let paddingY;
19190
+ if (itemHeight > height) {
19191
+ paddingY = '0px';
19192
+ } else {
19193
+ paddingY = '2px';
19194
+ }
19195
+ containerPadding = layoutOrder === 'row' ? "".concat(paddingY, " 4px") : "".concat(paddingY, " 6px ").concat(paddingY, " 4px");
19196
+ } else {
19197
+ containerPadding = undefined; // to prevent overriding any default padding
19198
+ }
19199
+
19200
+ return containerPadding;
19201
+ }
19202
+
19156
19203
  const PREFIX$4 = 'ListBoxInline';
19157
19204
  const classes$4 = {
19158
19205
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
@@ -19231,7 +19278,7 @@ const isModal = _ref4 => {
19231
19278
  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();
19232
19279
  };
19233
19280
  function ListBoxInline(_ref5) {
19234
- var _layout$qListObject, _layout$qListObject2, _layoutOptions$dense;
19281
+ var _layout$qListObject, _layout$qListObject2, _layoutOptions$dense, _containerRef$current;
19235
19282
  let {
19236
19283
  options,
19237
19284
  layout
@@ -19457,10 +19504,12 @@ function ListBoxInline(_ref5) {
19457
19504
 
19458
19505
  // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
19459
19506
  const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
19460
- let containerPadding;
19461
- if (isGridMode) {
19462
- containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
19463
- }
19507
+ const containerPadding = getContainerPadding({
19508
+ isGridMode,
19509
+ dense,
19510
+ height: (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight,
19511
+ layoutOrder: layoutOptions.layoutOrder
19512
+ });
19464
19513
  const searchIconComp = constraints !== null && constraints !== void 0 && constraints.active ? /*#__PURE__*/React__default.createElement(SearchIcon, {
19465
19514
  title: translator.get('Listbox.Search'),
19466
19515
  size: "large",
@@ -19500,6 +19549,7 @@ function ListBoxInline(_ref5) {
19500
19549
  if (isInvalid) {
19501
19550
  renderedCallback === null || renderedCallback === void 0 || renderedCallback();
19502
19551
  }
19552
+ const listBoxMinHeight = showToolbarWithTitle ? DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH : 0;
19503
19553
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showDetachedToolbarOnly && /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$5({
19504
19554
  direction: direction
19505
19555
  }, getActionToolbarProps(true))), /*#__PURE__*/React__default.createElement(StyledGrid$3, {
@@ -19565,10 +19615,8 @@ function ListBoxInline(_ref5) {
19565
19615
  item: true,
19566
19616
  container: true,
19567
19617
  direction: "column",
19568
- style: {
19569
- height: '100%',
19570
- minHeight: DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH
19571
- },
19618
+ height: "100%",
19619
+ minHeight: listBoxMinHeight,
19572
19620
  role: "region",
19573
19621
  "aria-label": translator.get('Listbox.ResultFilterLabel')
19574
19622
  }, /*#__PURE__*/React__default.createElement(Grid, {