@nebula.js/stardust 5.12.2 → 5.12.4

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 v5.12.2
2
+ * @nebula.js/stardust v5.12.4
3
3
  * Copyright (c) 2025 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -15311,7 +15311,7 @@
15311
15311
  return cache[key];
15312
15312
  }
15313
15313
 
15314
- const NEBULA_VERSION_HASH = "9841";
15314
+ const NEBULA_VERSION_HASH = "1a27";
15315
15315
  ClassNameGenerator.configure(componentName => {
15316
15316
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15317
15317
  });
@@ -15552,7 +15552,7 @@
15552
15552
  const appRef = React.createRef();
15553
15553
  const element = document.createElement('div');
15554
15554
  element.style.display = 'none';
15555
- element.setAttribute('data-nebulajs-version', "5.12.2");
15555
+ element.setAttribute('data-nebulajs-version', "5.12.4");
15556
15556
  element.setAttribute('data-app-id', app.id);
15557
15557
  document.body.appendChild(element);
15558
15558
  if (context) {
@@ -15569,7 +15569,7 @@
15569
15569
  selectionStore: selectionStore
15570
15570
  }));
15571
15571
  const cells = {};
15572
- const cellsUnmount = {};
15572
+ const componentsUnmount = [];
15573
15573
  const components = [];
15574
15574
  return [{
15575
15575
  toggleFocusOfCells(cellIdToFocus) {
@@ -15578,30 +15578,31 @@
15578
15578
  });
15579
15579
  },
15580
15580
  cells,
15581
- addCell(id, cell, unmount) {
15581
+ addCell(id, cell) {
15582
15582
  cells[id] = cell;
15583
- cellsUnmount[id] = unmount;
15584
15583
  },
15585
15584
  removeCell(id) {
15586
15585
  delete cells[id];
15587
- cellsUnmount[id]();
15588
- delete cellsUnmount[id];
15589
15586
  },
15590
- add(component) {
15587
+ add(component, unmount) {
15591
15588
  (async () => {
15592
15589
  await rendered;
15593
15590
  components.push(component);
15591
+ componentsUnmount.push(unmount);
15594
15592
  appRef.current.setComps(components);
15595
15593
  })();
15596
15594
  },
15597
15595
  remove(component) {
15598
- (async () => {
15596
+ (async _appRef$current => {
15599
15597
  await rendered;
15600
15598
  const ix = components.indexOf(component);
15601
15599
  if (ix !== -1) {
15600
+ var _componentsUnmount$ix;
15601
+ (_componentsUnmount$ix = componentsUnmount[ix]) === null || _componentsUnmount$ix === void 0 || _componentsUnmount$ix.call(componentsUnmount);
15602
15602
  components.splice(ix, 1);
15603
+ componentsUnmount.splice(ix, 1);
15603
15604
  }
15604
- appRef.current.setComps(components);
15605
+ appRef === null || appRef === void 0 || (_appRef$current = appRef.current) === null || _appRef$current === void 0 || _appRef$current.setComps(components);
15605
15606
  })();
15606
15607
  },
15607
15608
  setMuiThemeName(themeName) {
@@ -15621,10 +15622,11 @@
15621
15622
  })();
15622
15623
  },
15623
15624
  destroy() {
15624
- Object.keys(cellsUnmount).forEach(c => {
15625
- cellsUnmount[c]();
15625
+ componentsUnmount.forEach(c => {
15626
+ c && c();
15626
15627
  });
15627
15628
  modelStore.destroy();
15629
+ root.unmount();
15628
15630
  }
15629
15631
  }, modelStore, selectionStore, appRef, rendered];
15630
15632
  }
@@ -31252,7 +31254,7 @@
31252
31254
  return {
31253
31255
  fontFamily: textProps.fontFamily || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'fontFamily'),
31254
31256
  fontSize: textProps.fontSize || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'fontSize'),
31255
- color: textProps.color && textProps.color.color !== 'none' ? theme.getColorPickerColor(textProps.color) : theme.getStyle("object.".concat(objectType), target, 'color'),
31257
+ color: textProps.color && textProps.color.color !== 'none' ? theme.getColorPickerColor(textProps.color) : theme.getStyle("object.".concat(objectType), "title.".concat(target), 'color'),
31256
31258
  backgroundColor: textProps.backgroundColor || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'backgroundColor'),
31257
31259
  fontWeight: fontStyle.includes('bold') ? 'bold' : 'normal',
31258
31260
  fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',
@@ -32102,7 +32104,7 @@
32102
32104
  })))))), CurrentItem);
32103
32105
  }
32104
32106
 
32105
- const MIN_WIDTH$1 = 120;
32107
+ const MIN_WIDTH = 120;
32106
32108
  const MIN_WIDTH_MORE = 72;
32107
32109
  function getItems(layout) {
32108
32110
  if (!layout) {
@@ -32167,7 +32169,7 @@
32167
32169
  width
32168
32170
  } = containerRect;
32169
32171
  const maxWidth = Math.floor(width) - MIN_WIDTH_MORE;
32170
- const items = Math.floor(maxWidth / MIN_WIDTH$1);
32172
+ const items = Math.floor(maxWidth / MIN_WIDTH);
32171
32173
  setMaxItems(items);
32172
32174
  }, [containerRect]);
32173
32175
  reactExports.useEffect(() => {
@@ -32213,7 +32215,7 @@
32213
32215
  style: {
32214
32216
  position: 'relative',
32215
32217
  maxWidth: '240px',
32216
- minWidth: "".concat(MIN_WIDTH$1, "px"),
32218
+ minWidth: "".concat(MIN_WIDTH, "px"),
32217
32219
  background: theme.palette.background.paper,
32218
32220
  borderRight: "1px solid ".concat(theme.palette.divider)
32219
32221
  }
@@ -32625,12 +32627,11 @@
32625
32627
  super(...args);
32626
32628
  this.state = {
32627
32629
  height: this.props.defaultHeight || 0,
32628
- scaledHeight: this.props.defaultHeight || 0,
32629
- scaledWidth: this.props.defaultWidth || 0,
32630
32630
  width: this.props.defaultWidth || 0
32631
32631
  };
32632
32632
  this._autoSizer = null;
32633
32633
  this._detectElementResize = null;
32634
+ this._didLogDeprecationWarning = false;
32634
32635
  this._parentNode = null;
32635
32636
  this._resizeObserver = null;
32636
32637
  this._timeoutId = null;
@@ -32652,23 +32653,32 @@
32652
32653
  const paddingTop = parseFloat(style.paddingTop || "0");
32653
32654
  const paddingBottom = parseFloat(style.paddingBottom || "0");
32654
32655
  const rect = this._parentNode.getBoundingClientRect();
32655
- const scaledHeight = rect.height - paddingTop - paddingBottom;
32656
- const scaledWidth = rect.width - paddingLeft - paddingRight;
32657
- const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
32658
- const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
32659
- if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
32656
+ const height = rect.height - paddingTop - paddingBottom;
32657
+ const width = rect.width - paddingLeft - paddingRight;
32658
+ if (!disableHeight && this.state.height !== height || !disableWidth && this.state.width !== width) {
32660
32659
  this.setState({
32661
32660
  height,
32662
- width,
32663
- scaledHeight,
32664
- scaledWidth
32661
+ width
32665
32662
  });
32663
+ const maybeLogDeprecationWarning = () => {
32664
+ if (!this._didLogDeprecationWarning) {
32665
+ this._didLogDeprecationWarning = true;
32666
+ console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead");
32667
+ }
32668
+ };
32666
32669
  if (typeof onResize === "function") {
32667
32670
  onResize({
32668
32671
  height,
32669
- scaledHeight,
32670
- scaledWidth,
32671
- width
32672
+ width,
32673
+ // TODO Remove these params in the next major release
32674
+ get scaledHeight() {
32675
+ maybeLogDeprecationWarning();
32676
+ return height;
32677
+ },
32678
+ get scaledWidth() {
32679
+ maybeLogDeprecationWarning();
32680
+ return width;
32681
+ }
32672
32682
  });
32673
32683
  }
32674
32684
  }
@@ -32738,8 +32748,6 @@
32738
32748
  } = this.props;
32739
32749
  const {
32740
32750
  height,
32741
- scaledHeight,
32742
- scaledWidth,
32743
32751
  width
32744
32752
  } = this.state;
32745
32753
 
@@ -32760,7 +32768,9 @@
32760
32768
  }
32761
32769
  outerStyle.height = 0;
32762
32770
  childParams.height = height;
32763
- childParams.scaledHeight = scaledHeight;
32771
+
32772
+ // TODO Remove this in the next major release
32773
+ childParams.scaledHeight = height;
32764
32774
  }
32765
32775
  if (!disableWidth) {
32766
32776
  if (width === 0) {
@@ -32768,7 +32778,9 @@
32768
32778
  }
32769
32779
  outerStyle.width = 0;
32770
32780
  childParams.width = width;
32771
- childParams.scaledWidth = scaledWidth;
32781
+
32782
+ // TODO Remove this in the next major release
32783
+ childParams.scaledWidth = width;
32772
32784
  }
32773
32785
  if (doNotBailOutOnEmptyChildren) {
32774
32786
  bailoutOnChildren = false;
@@ -33864,26 +33876,34 @@
33864
33876
  throw new Error("Option \"".concat(usedForbiddenOptions.join(', '), "\" is not applicable for existing objects."));
33865
33877
  }
33866
33878
  reactExports.useEffect(() => {
33867
- function storeModel(m) {
33868
- if (modelStore.get(m.id)) {
33869
- return;
33870
- }
33871
- // Nebula gets the model from this store in some of its
33872
- // core functions, so it must always be stored here.
33873
- modelStore.set(m.id, m);
33874
- m.once('closed', () => {
33875
- modelStore.clear(m.id);
33876
- });
33877
- }
33879
+ let isCleaned = false;
33880
+ let cleanupFn = () => {};
33878
33881
  async function fetchObject(modelId) {
33879
33882
  const m = modelStore.get(modelId) || (await app.getObject(modelId));
33880
33883
  return m;
33881
33884
  }
33882
- const p = Promise.resolve(sessionModel || fetchObject(qId));
33883
- p.then(m => {
33884
- storeModel(m);
33885
+ async function fetchModel() {
33886
+ const m = await Promise.resolve(sessionModel || fetchObject(qId));
33887
+ if (isCleaned) {
33888
+ return;
33889
+ }
33890
+ if (!modelStore.get(m.id)) {
33891
+ modelStore.set(m.id, m);
33892
+ const onClosed = () => {
33893
+ modelStore.clear(m.id);
33894
+ };
33895
+ m.once('closed', onClosed);
33896
+ cleanupFn = () => {
33897
+ m.removeListener('closed', onClosed);
33898
+ };
33899
+ }
33885
33900
  setModel(m);
33886
- });
33901
+ }
33902
+ fetchModel();
33903
+ return () => {
33904
+ isCleaned = true;
33905
+ cleanupFn();
33906
+ };
33887
33907
  }, []);
33888
33908
  return model;
33889
33909
  }
@@ -35937,11 +35957,6 @@
35937
35957
  }
35938
35958
  };
35939
35959
  });
35940
- const ITEM_WIDTH = 32;
35941
- const ITEM_SPACING = 4;
35942
- const DIVIDER = 1;
35943
- const NUMBER_OF_ITEMS = 6;
35944
- const MIN_WIDTH = (ITEM_WIDTH + ITEM_SPACING) * NUMBER_OF_ITEMS + DIVIDER + ITEM_SPACING;
35945
35960
 
35946
35961
  /**
35947
35962
  * @interface
@@ -35975,8 +35990,6 @@
35975
35990
  const showSubtitle = layout.showTitles && !!layout.subtitle;
35976
35991
  const showInSelectionActions = layout.qSelectionInfo && layout.qSelectionInfo.qInSelections;
35977
35992
  const [actions, setActions] = reactExports.useState([]);
35978
- const [containerRef, containerRect] = useRect$1();
35979
- const [shouldShowPopoverToolbar, setShouldShowPopoverToolbar] = reactExports.useState(false);
35980
35993
  reactExports.useEffect(() => {
35981
35994
  if (!sn || !sn.component || !sn.component.isHooked) {
35982
35995
  return;
@@ -35985,19 +35998,11 @@
35985
35998
  setActions([...a, ...(sn && sn.selectionToolbar && sn.selectionToolbar.items || [])]);
35986
35999
  });
35987
36000
  }, [sn]);
35988
- reactExports.useEffect(() => {
35989
- if (!containerRect) return;
35990
- const {
35991
- width
35992
- } = containerRect;
35993
- setShouldShowPopoverToolbar(width < MIN_WIDTH);
35994
- }, [containerRect]);
35995
36001
  const showTitles = showTitle || showSubtitle;
35996
36002
  const cls = [classes$1.containerStyle, ...(showTitles ? [classes$1.containerTitleStyle] : [])];
35997
- const showPopoverToolbar = (hovering || showInSelectionActions) && (shouldShowPopoverToolbar || !showTitles);
35998
- const showToolbar = showTitles && !showPopoverToolbar && !shouldShowPopoverToolbar;
36003
+ const showPopoverToolbar = hovering || showInSelectionActions;
35999
36004
  const Toolbar = /*#__PURE__*/React.createElement(ActionsToolbar, {
36000
- show: showToolbar,
36005
+ show: false,
36001
36006
  selections: {
36002
36007
  show: showInSelectionActions,
36003
36008
  api: sn.component.selections,
@@ -36012,7 +36017,6 @@
36012
36017
  layout: layout
36013
36018
  });
36014
36019
  return /*#__PURE__*/React.createElement(StyledGrid$1, {
36015
- ref: containerRef,
36016
36020
  item: true,
36017
36021
  container: true,
36018
36022
  wrap: "nowrap",
@@ -36266,20 +36270,46 @@
36266
36270
  }));
36267
36271
  }
36268
36272
 
36273
+ const THEME_OBJECT_TYPE_MAP = {
36274
+ linechart: 'lineChart',
36275
+ barchart: 'barChart',
36276
+ combochart: 'comboChart',
36277
+ scatterplot: 'scatterPlot',
36278
+ piechart: 'pieChart',
36279
+ straightable: 'straightTable',
36280
+ pivottable: 'pivotTable',
36281
+ table: 'straightTable',
36282
+ 'pivot-table': 'pivotTable',
36283
+ listbox: 'listBox',
36284
+ referenceline: 'referenceLine',
36285
+ datacolors: 'dataColors',
36286
+ 'text-image': 'textImage',
36287
+ boxplot: 'boxPlot',
36288
+ map: 'mapChart',
36289
+ mapchart: 'mapChart',
36290
+ bulletchart: 'bulletChart'
36291
+ };
36292
+ const getThemeObjectType = visualization => {
36293
+ if (THEME_OBJECT_TYPE_MAP[visualization.toLowerCase()]) {
36294
+ return THEME_OBJECT_TYPE_MAP[visualization.toLowerCase()];
36295
+ }
36296
+ return visualization;
36297
+ };
36269
36298
  const useStyling = (layout, theme, app, themeName) => {
36270
36299
  const styling = reactExports.useMemo(() => {
36271
36300
  if (layout && theme) {
36272
36301
  const generalComp = layout.components ? layout.components.find(comp => comp.key === 'general') : null;
36302
+ const objectType = getThemeObjectType(layout.visualization);
36273
36303
  const titleStyles = {
36274
- main: resolveTextStyle(generalComp, 'main', theme, layout.visualization),
36275
- footer: resolveTextStyle(generalComp, 'footer', theme, layout.visualization),
36276
- subTitle: resolveTextStyle(generalComp, 'subTitle', theme, layout.visualization)
36304
+ main: resolveTextStyle(generalComp, 'main', theme, objectType),
36305
+ footer: resolveTextStyle(generalComp, 'footer', theme, objectType),
36306
+ subTitle: resolveTextStyle(generalComp, 'subTitle', theme, objectType)
36277
36307
  };
36278
- const bgColor = resolveBgColor(generalComp, theme, layout.visualization);
36308
+ const bgColor = resolveBgColor(generalComp, theme, objectType);
36279
36309
  const bgImage = resolveBgImage(generalComp, app);
36280
- const border = resolveBorder(generalComp, theme, layout.visualization);
36281
- const borderRadius = resolveBorderRadius(generalComp, theme, layout.visualization);
36282
- const boxShadow = resolveBoxShadow(generalComp, theme, layout.visualization);
36310
+ const border = resolveBorder(generalComp, theme, objectType);
36311
+ const borderRadius = resolveBorderRadius(generalComp, theme, objectType);
36312
+ const boxShadow = resolveBoxShadow(generalComp, theme, objectType);
36283
36313
  return {
36284
36314
  titleStyles,
36285
36315
  bgColor,
@@ -37042,9 +37072,9 @@
37042
37072
  model.removeListener('closed', unmount);
37043
37073
  };
37044
37074
  model.on('closed', unmount);
37045
- root.add(portal);
37075
+ root.add(portal, unmount);
37046
37076
  // Cannot use model.id as it is not unique in a given mashup
37047
- root.addCell(currentId, cellRef, unmount);
37077
+ root.addCell(currentId, cellRef);
37048
37078
  return [unmount, cellRef];
37049
37079
  }
37050
37080
 
@@ -39413,10 +39443,6 @@
39413
39443
  * @type {SnComponent}
39414
39444
  */
39415
39445
  component: sn.component || {},
39416
- /**
39417
- * @type {EXT}
39418
- */
39419
- ext: sn.ext,
39420
39446
  /**
39421
39447
  * @param {object} p
39422
39448
  * @param {EnigmaAppModel} p.app
@@ -40283,7 +40309,7 @@
40283
40309
  onError: onError
40284
40310
  }), element, model.id);
40285
40311
  navigation.setSheetRef(sheetRef);
40286
- root.add(portal);
40312
+ root.add(portal, unmount);
40287
40313
  return [unmount, sheetRef];
40288
40314
  }
40289
40315