@nebula.js/stardust 5.12.3 → 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.
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v5.12.3
2
+ * @nebula.js/stardust v5.12.4
3
3
  * Copyright (c) 2025 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -10768,7 +10768,7 @@ function create$3(definition) {
10768
10768
  return cache[key];
10769
10769
  }
10770
10770
 
10771
- const NEBULA_VERSION_HASH = "138a";
10771
+ const NEBULA_VERSION_HASH = "1a27";
10772
10772
  ClassNameGenerator.configure(componentName => {
10773
10773
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
10774
10774
  });
@@ -11009,7 +11009,7 @@ function boot(_ref2) {
11009
11009
  const appRef = React__default.createRef();
11010
11010
  const element = document.createElement('div');
11011
11011
  element.style.display = 'none';
11012
- element.setAttribute('data-nebulajs-version', "5.12.3");
11012
+ element.setAttribute('data-nebulajs-version', "5.12.4");
11013
11013
  element.setAttribute('data-app-id', app.id);
11014
11014
  document.body.appendChild(element);
11015
11015
  if (context) {
@@ -11026,7 +11026,7 @@ function boot(_ref2) {
11026
11026
  selectionStore: selectionStore
11027
11027
  }));
11028
11028
  const cells = {};
11029
- const cellsUnmount = {};
11029
+ const componentsUnmount = [];
11030
11030
  const components = [];
11031
11031
  return [{
11032
11032
  toggleFocusOfCells(cellIdToFocus) {
@@ -11035,30 +11035,31 @@ function boot(_ref2) {
11035
11035
  });
11036
11036
  },
11037
11037
  cells,
11038
- addCell(id, cell, unmount) {
11038
+ addCell(id, cell) {
11039
11039
  cells[id] = cell;
11040
- cellsUnmount[id] = unmount;
11041
11040
  },
11042
11041
  removeCell(id) {
11043
11042
  delete cells[id];
11044
- cellsUnmount[id]();
11045
- delete cellsUnmount[id];
11046
11043
  },
11047
- add(component) {
11044
+ add(component, unmount) {
11048
11045
  (async () => {
11049
11046
  await rendered;
11050
11047
  components.push(component);
11048
+ componentsUnmount.push(unmount);
11051
11049
  appRef.current.setComps(components);
11052
11050
  })();
11053
11051
  },
11054
11052
  remove(component) {
11055
- (async () => {
11053
+ (async _appRef$current => {
11056
11054
  await rendered;
11057
11055
  const ix = components.indexOf(component);
11058
11056
  if (ix !== -1) {
11057
+ var _componentsUnmount$ix;
11058
+ (_componentsUnmount$ix = componentsUnmount[ix]) === null || _componentsUnmount$ix === void 0 || _componentsUnmount$ix.call(componentsUnmount);
11059
11059
  components.splice(ix, 1);
11060
+ componentsUnmount.splice(ix, 1);
11060
11061
  }
11061
- appRef.current.setComps(components);
11062
+ appRef === null || appRef === void 0 || (_appRef$current = appRef.current) === null || _appRef$current === void 0 || _appRef$current.setComps(components);
11062
11063
  })();
11063
11064
  },
11064
11065
  setMuiThemeName(themeName) {
@@ -11078,10 +11079,11 @@ function boot(_ref2) {
11078
11079
  })();
11079
11080
  },
11080
11081
  destroy() {
11081
- Object.keys(cellsUnmount).forEach(c => {
11082
- cellsUnmount[c]();
11082
+ componentsUnmount.forEach(c => {
11083
+ c && c();
11083
11084
  });
11084
11085
  modelStore.destroy();
11086
+ root.unmount();
11085
11087
  }
11086
11088
  }, modelStore, selectionStore, appRef, rendered];
11087
11089
  }
@@ -18383,7 +18385,7 @@ function resolveTextStyle(textComp, target, theme, objectType) {
18383
18385
  return {
18384
18386
  fontFamily: textProps.fontFamily || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'fontFamily'),
18385
18387
  fontSize: textProps.fontSize || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'fontSize'),
18386
- color: textProps.color && textProps.color.color !== 'none' ? theme.getColorPickerColor(textProps.color) : theme.getStyle("object.".concat(objectType), target, 'color'),
18388
+ color: textProps.color && textProps.color.color !== 'none' ? theme.getColorPickerColor(textProps.color) : theme.getStyle("object.".concat(objectType), "title.".concat(target), 'color'),
18387
18389
  backgroundColor: textProps.backgroundColor || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'backgroundColor'),
18388
18390
  fontWeight: fontStyle.includes('bold') ? 'bold' : 'normal',
18389
18391
  fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',
@@ -19233,7 +19235,7 @@ function More(_ref2) {
19233
19235
  })))))), CurrentItem);
19234
19236
  }
19235
19237
 
19236
- const MIN_WIDTH$1 = 120;
19238
+ const MIN_WIDTH = 120;
19237
19239
  const MIN_WIDTH_MORE = 72;
19238
19240
  function getItems(layout) {
19239
19241
  if (!layout) {
@@ -19298,7 +19300,7 @@ function SelectedFields(_ref) {
19298
19300
  width
19299
19301
  } = containerRect;
19300
19302
  const maxWidth = Math.floor(width) - MIN_WIDTH_MORE;
19301
- const items = Math.floor(maxWidth / MIN_WIDTH$1);
19303
+ const items = Math.floor(maxWidth / MIN_WIDTH);
19302
19304
  setMaxItems(items);
19303
19305
  }, [containerRect]);
19304
19306
  useEffect$1(() => {
@@ -19344,7 +19346,7 @@ function SelectedFields(_ref) {
19344
19346
  style: {
19345
19347
  position: 'relative',
19346
19348
  maxWidth: '240px',
19347
- minWidth: "".concat(MIN_WIDTH$1, "px"),
19349
+ minWidth: "".concat(MIN_WIDTH, "px"),
19348
19350
  background: theme.palette.background.paper,
19349
19351
  borderRight: "1px solid ".concat(theme.palette.divider)
19350
19352
  }
@@ -19756,12 +19758,11 @@ class AutoSizer extends Component {
19756
19758
  super(...args);
19757
19759
  this.state = {
19758
19760
  height: this.props.defaultHeight || 0,
19759
- scaledHeight: this.props.defaultHeight || 0,
19760
- scaledWidth: this.props.defaultWidth || 0,
19761
19761
  width: this.props.defaultWidth || 0
19762
19762
  };
19763
19763
  this._autoSizer = null;
19764
19764
  this._detectElementResize = null;
19765
+ this._didLogDeprecationWarning = false;
19765
19766
  this._parentNode = null;
19766
19767
  this._resizeObserver = null;
19767
19768
  this._timeoutId = null;
@@ -19783,23 +19784,32 @@ class AutoSizer extends Component {
19783
19784
  const paddingTop = parseFloat(style.paddingTop || "0");
19784
19785
  const paddingBottom = parseFloat(style.paddingBottom || "0");
19785
19786
  const rect = this._parentNode.getBoundingClientRect();
19786
- const scaledHeight = rect.height - paddingTop - paddingBottom;
19787
- const scaledWidth = rect.width - paddingLeft - paddingRight;
19788
- const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
19789
- const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
19790
- if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
19787
+ const height = rect.height - paddingTop - paddingBottom;
19788
+ const width = rect.width - paddingLeft - paddingRight;
19789
+ if (!disableHeight && this.state.height !== height || !disableWidth && this.state.width !== width) {
19791
19790
  this.setState({
19792
19791
  height,
19793
- width,
19794
- scaledHeight,
19795
- scaledWidth
19792
+ width
19796
19793
  });
19794
+ const maybeLogDeprecationWarning = () => {
19795
+ if (!this._didLogDeprecationWarning) {
19796
+ this._didLogDeprecationWarning = true;
19797
+ console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead");
19798
+ }
19799
+ };
19797
19800
  if (typeof onResize === "function") {
19798
19801
  onResize({
19799
19802
  height,
19800
- scaledHeight,
19801
- scaledWidth,
19802
- width
19803
+ width,
19804
+ // TODO Remove these params in the next major release
19805
+ get scaledHeight() {
19806
+ maybeLogDeprecationWarning();
19807
+ return height;
19808
+ },
19809
+ get scaledWidth() {
19810
+ maybeLogDeprecationWarning();
19811
+ return width;
19812
+ }
19803
19813
  });
19804
19814
  }
19805
19815
  }
@@ -19869,8 +19879,6 @@ class AutoSizer extends Component {
19869
19879
  } = this.props;
19870
19880
  const {
19871
19881
  height,
19872
- scaledHeight,
19873
- scaledWidth,
19874
19882
  width
19875
19883
  } = this.state;
19876
19884
 
@@ -19891,7 +19899,9 @@ class AutoSizer extends Component {
19891
19899
  }
19892
19900
  outerStyle.height = 0;
19893
19901
  childParams.height = height;
19894
- childParams.scaledHeight = scaledHeight;
19902
+
19903
+ // TODO Remove this in the next major release
19904
+ childParams.scaledHeight = height;
19895
19905
  }
19896
19906
  if (!disableWidth) {
19897
19907
  if (width === 0) {
@@ -19899,7 +19909,9 @@ class AutoSizer extends Component {
19899
19909
  }
19900
19910
  outerStyle.width = 0;
19901
19911
  childParams.width = width;
19902
- childParams.scaledWidth = scaledWidth;
19912
+
19913
+ // TODO Remove this in the next major release
19914
+ childParams.scaledWidth = width;
19903
19915
  }
19904
19916
  if (doNotBailOutOnEmptyChildren) {
19905
19917
  bailoutOnChildren = false;
@@ -20995,26 +21007,34 @@ function useExistingModel(_ref) {
20995
21007
  throw new Error("Option \"".concat(usedForbiddenOptions.join(', '), "\" is not applicable for existing objects."));
20996
21008
  }
20997
21009
  useEffect$1(() => {
20998
- function storeModel(m) {
20999
- if (modelStore.get(m.id)) {
21000
- return;
21001
- }
21002
- // Nebula gets the model from this store in some of its
21003
- // core functions, so it must always be stored here.
21004
- modelStore.set(m.id, m);
21005
- m.once('closed', () => {
21006
- modelStore.clear(m.id);
21007
- });
21008
- }
21010
+ let isCleaned = false;
21011
+ let cleanupFn = () => {};
21009
21012
  async function fetchObject(modelId) {
21010
21013
  const m = modelStore.get(modelId) || (await app.getObject(modelId));
21011
21014
  return m;
21012
21015
  }
21013
- const p = Promise.resolve(sessionModel || fetchObject(qId));
21014
- p.then(m => {
21015
- storeModel(m);
21016
+ async function fetchModel() {
21017
+ const m = await Promise.resolve(sessionModel || fetchObject(qId));
21018
+ if (isCleaned) {
21019
+ return;
21020
+ }
21021
+ if (!modelStore.get(m.id)) {
21022
+ modelStore.set(m.id, m);
21023
+ const onClosed = () => {
21024
+ modelStore.clear(m.id);
21025
+ };
21026
+ m.once('closed', onClosed);
21027
+ cleanupFn = () => {
21028
+ m.removeListener('closed', onClosed);
21029
+ };
21030
+ }
21016
21031
  setModel(m);
21017
- });
21032
+ }
21033
+ fetchModel();
21034
+ return () => {
21035
+ isCleaned = true;
21036
+ cleanupFn();
21037
+ };
21018
21038
  }, []);
21019
21039
  return model;
21020
21040
  }
@@ -23068,11 +23088,6 @@ const StyledGrid$1 = styled(Grid)(_ref => {
23068
23088
  }
23069
23089
  };
23070
23090
  });
23071
- const ITEM_WIDTH = 32;
23072
- const ITEM_SPACING = 4;
23073
- const DIVIDER = 1;
23074
- const NUMBER_OF_ITEMS = 6;
23075
- const MIN_WIDTH = (ITEM_WIDTH + ITEM_SPACING) * NUMBER_OF_ITEMS + DIVIDER + ITEM_SPACING;
23076
23091
 
23077
23092
  /**
23078
23093
  * @interface
@@ -23106,8 +23121,6 @@ function Header(_ref2) {
23106
23121
  const showSubtitle = layout.showTitles && !!layout.subtitle;
23107
23122
  const showInSelectionActions = layout.qSelectionInfo && layout.qSelectionInfo.qInSelections;
23108
23123
  const [actions, setActions] = useState$1([]);
23109
- const [containerRef, containerRect] = useRect$1();
23110
- const [shouldShowPopoverToolbar, setShouldShowPopoverToolbar] = useState$1(false);
23111
23124
  useEffect$1(() => {
23112
23125
  if (!sn || !sn.component || !sn.component.isHooked) {
23113
23126
  return;
@@ -23116,19 +23129,11 @@ function Header(_ref2) {
23116
23129
  setActions([...a, ...(sn && sn.selectionToolbar && sn.selectionToolbar.items || [])]);
23117
23130
  });
23118
23131
  }, [sn]);
23119
- useEffect$1(() => {
23120
- if (!containerRect) return;
23121
- const {
23122
- width
23123
- } = containerRect;
23124
- setShouldShowPopoverToolbar(width < MIN_WIDTH);
23125
- }, [containerRect]);
23126
23132
  const showTitles = showTitle || showSubtitle;
23127
23133
  const cls = [classes$1.containerStyle, ...(showTitles ? [classes$1.containerTitleStyle] : [])];
23128
- const showPopoverToolbar = (hovering || showInSelectionActions) && (shouldShowPopoverToolbar || !showTitles);
23129
- const showToolbar = showTitles && !showPopoverToolbar && !shouldShowPopoverToolbar;
23134
+ const showPopoverToolbar = hovering || showInSelectionActions;
23130
23135
  const Toolbar = /*#__PURE__*/React__default.createElement(ActionsToolbar, {
23131
- show: showToolbar,
23136
+ show: false,
23132
23137
  selections: {
23133
23138
  show: showInSelectionActions,
23134
23139
  api: sn.component.selections,
@@ -23143,7 +23148,6 @@ function Header(_ref2) {
23143
23148
  layout: layout
23144
23149
  });
23145
23150
  return /*#__PURE__*/React__default.createElement(StyledGrid$1, {
23146
- ref: containerRef,
23147
23151
  item: true,
23148
23152
  container: true,
23149
23153
  wrap: "nowrap",
@@ -23397,20 +23401,46 @@ function Supernova(_ref) {
23397
23401
  }));
23398
23402
  }
23399
23403
 
23404
+ const THEME_OBJECT_TYPE_MAP = {
23405
+ linechart: 'lineChart',
23406
+ barchart: 'barChart',
23407
+ combochart: 'comboChart',
23408
+ scatterplot: 'scatterPlot',
23409
+ piechart: 'pieChart',
23410
+ straightable: 'straightTable',
23411
+ pivottable: 'pivotTable',
23412
+ table: 'straightTable',
23413
+ 'pivot-table': 'pivotTable',
23414
+ listbox: 'listBox',
23415
+ referenceline: 'referenceLine',
23416
+ datacolors: 'dataColors',
23417
+ 'text-image': 'textImage',
23418
+ boxplot: 'boxPlot',
23419
+ map: 'mapChart',
23420
+ mapchart: 'mapChart',
23421
+ bulletchart: 'bulletChart'
23422
+ };
23423
+ const getThemeObjectType = visualization => {
23424
+ if (THEME_OBJECT_TYPE_MAP[visualization.toLowerCase()]) {
23425
+ return THEME_OBJECT_TYPE_MAP[visualization.toLowerCase()];
23426
+ }
23427
+ return visualization;
23428
+ };
23400
23429
  const useStyling = (layout, theme, app, themeName) => {
23401
23430
  const styling = useMemo$1(() => {
23402
23431
  if (layout && theme) {
23403
23432
  const generalComp = layout.components ? layout.components.find(comp => comp.key === 'general') : null;
23433
+ const objectType = getThemeObjectType(layout.visualization);
23404
23434
  const titleStyles = {
23405
- main: resolveTextStyle(generalComp, 'main', theme, layout.visualization),
23406
- footer: resolveTextStyle(generalComp, 'footer', theme, layout.visualization),
23407
- subTitle: resolveTextStyle(generalComp, 'subTitle', theme, layout.visualization)
23435
+ main: resolveTextStyle(generalComp, 'main', theme, objectType),
23436
+ footer: resolveTextStyle(generalComp, 'footer', theme, objectType),
23437
+ subTitle: resolveTextStyle(generalComp, 'subTitle', theme, objectType)
23408
23438
  };
23409
- const bgColor = resolveBgColor(generalComp, theme, layout.visualization);
23439
+ const bgColor = resolveBgColor(generalComp, theme, objectType);
23410
23440
  const bgImage = resolveBgImage(generalComp, app);
23411
- const border = resolveBorder(generalComp, theme, layout.visualization);
23412
- const borderRadius = resolveBorderRadius(generalComp, theme, layout.visualization);
23413
- const boxShadow = resolveBoxShadow(generalComp, theme, layout.visualization);
23441
+ const border = resolveBorder(generalComp, theme, objectType);
23442
+ const borderRadius = resolveBorderRadius(generalComp, theme, objectType);
23443
+ const boxShadow = resolveBoxShadow(generalComp, theme, objectType);
23414
23444
  return {
23415
23445
  titleStyles,
23416
23446
  bgColor,
@@ -24173,9 +24203,9 @@ function glue$1(_ref) {
24173
24203
  model.removeListener('closed', unmount);
24174
24204
  };
24175
24205
  model.on('closed', unmount);
24176
- root.add(portal);
24206
+ root.add(portal, unmount);
24177
24207
  // Cannot use model.id as it is not unique in a given mashup
24178
- root.addCell(currentId, cellRef, unmount);
24208
+ root.addCell(currentId, cellRef);
24179
24209
  return [unmount, cellRef];
24180
24210
  }
24181
24211
 
@@ -27410,7 +27440,7 @@ function glue(_ref) {
27410
27440
  onError: onError
27411
27441
  }), element, model.id);
27412
27442
  navigation.setSheetRef(sheetRef);
27413
- root.add(portal);
27443
+ root.add(portal, unmount);
27414
27444
  return [unmount, sheetRef];
27415
27445
  }
27416
27446