@nebula.js/stardust 5.10.1 → 5.11.0

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.10.1
2
+ * @nebula.js/stardust v5.11.0
3
3
  * Copyright (c) 2025 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -15297,7 +15297,7 @@
15297
15297
  return cache[key];
15298
15298
  }
15299
15299
 
15300
- const NEBULA_VERSION_HASH = "a207";
15300
+ const NEBULA_VERSION_HASH = "a481";
15301
15301
  ClassNameGenerator.configure(componentName => {
15302
15302
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15303
15303
  });
@@ -15529,7 +15529,7 @@
15529
15529
  const appRef = React.createRef();
15530
15530
  const element = document.createElement('div');
15531
15531
  element.style.display = 'none';
15532
- element.setAttribute('data-nebulajs-version', "5.10.1");
15532
+ element.setAttribute('data-nebulajs-version', "5.11.0");
15533
15533
  element.setAttribute('data-app-id', app.id);
15534
15534
  document.body.appendChild(element);
15535
15535
  if (context) {
@@ -39883,7 +39883,7 @@
39883
39883
  /** @type {'njs-sheet'} */
39884
39884
  className: 'njs-sheet'
39885
39885
  };
39886
- function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount, navigation) {
39886
+ function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount, navigation, onError) {
39887
39887
  const {
39888
39888
  x,
39889
39889
  y,
@@ -39908,7 +39908,8 @@
39908
39908
  initialSnPlugins: initialSnPlugins,
39909
39909
  initialError: initialError,
39910
39910
  onMount: onMount,
39911
- navigation: navigation
39911
+ navigation: navigation,
39912
+ onError: onError
39912
39913
  }));
39913
39914
  }
39914
39915
  function getBounds(pos, columns, rows) {
@@ -39932,7 +39933,8 @@
39932
39933
  initialError,
39933
39934
  onMount,
39934
39935
  unmount,
39935
- navigation
39936
+ navigation,
39937
+ onError
39936
39938
  } = _ref;
39937
39939
  const {
39938
39940
  root
@@ -39947,6 +39949,11 @@
39947
39949
  const [bgColor, setBgColor] = reactExports.useState(undefined);
39948
39950
  const [bgImage, setBgImage] = reactExports.useState(undefined);
39949
39951
  const [deepHash, setDeepHash] = reactExports.useState('');
39952
+ const renderState = reactExports.useRef({
39953
+ cellCount: 0,
39954
+ cellsRendered: 0,
39955
+ initialRender: false
39956
+ });
39950
39957
  navigation === null || navigation === void 0 || (_navigation$setCurren = navigation.setCurrentSheetId) === null || _navigation$setCurren === void 0 || _navigation$setCurren.call(navigation, model.id);
39951
39958
  /// For each object
39952
39959
  reactExports.useEffect(() => {
@@ -39967,6 +39974,15 @@
39967
39974
  root.removeCell(c.currentId);
39968
39975
  });
39969
39976
  const lCells = layout.cells;
39977
+ renderState.cellCount = lCells.length;
39978
+ renderState.cellsRendered = 0;
39979
+ const renderCallback = () => {
39980
+ renderState.cellsRendered++;
39981
+ if (renderState.cellsRendered === renderState.cellCount && !renderState.initialRender) {
39982
+ renderState.initialRender = true;
39983
+ initialSnOptions.onInitialRender();
39984
+ }
39985
+ };
39970
39986
  const {
39971
39987
  columns,
39972
39988
  rows
@@ -39994,7 +40010,10 @@
39994
40010
  cellRef: React.createRef(),
39995
40011
  currentId: uid(),
39996
40012
  mounted,
39997
- mountedPromise
40013
+ mountedPromise,
40014
+ options: _objectSpread2(_objectSpread2({}, initialSnOptions), {
40015
+ onInitialRender: renderCallback
40016
+ })
39998
40017
  };
39999
40018
  }));
40000
40019
  cs.forEach(c => root.addCell(c.currentId, c.cellRef));
@@ -40011,7 +40030,7 @@
40011
40030
  model.on('closed', onModelClose);
40012
40031
  return () => model.removeListener('closed', onModelClose);
40013
40032
  }, [model]);
40014
- const cellRenderers = reactExports.useMemo(() => cells ? cells.map(c => getCellRenderer(c, halo, initialSnOptions, initialSnPlugins, initialError, c.mounted, navigation)) : [], [cells]);
40033
+ const cellRenderers = reactExports.useMemo(() => cells ? cells.map(c => getCellRenderer(c, halo, c.options, initialSnPlugins, initialError, c.mounted, navigation, onError)) : [], [cells]);
40015
40034
  reactExports.useEffect(() => {
40016
40035
  const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
40017
40036
  setBgColor(resolveBgColor(bgComp, halo.public.theme));
@@ -40061,7 +40080,8 @@
40061
40080
  initialSnPlugins,
40062
40081
  onMount,
40063
40082
  initialError,
40064
- navigation
40083
+ navigation,
40084
+ onError
40065
40085
  } = _ref;
40066
40086
  const {
40067
40087
  root
@@ -40080,7 +40100,8 @@
40080
40100
  initialError: initialError,
40081
40101
  onMount: onMount,
40082
40102
  unmount: unmount,
40083
- navigation: navigation
40103
+ navigation: navigation,
40104
+ onError: onError
40084
40105
  }), element, model.id);
40085
40106
  navigation.setSheetRef(sheetRef);
40086
40107
  root.add(portal);
@@ -40094,26 +40115,42 @@
40094
40115
  halo,
40095
40116
  navigation,
40096
40117
  initialError,
40097
- onDestroy = async () => {}
40118
+ onDestroy = async () => {},
40119
+ onRender = () => {},
40120
+ onError = () => {}
40098
40121
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
40099
40122
  let unmountSheet = noopi;
40100
40123
  let sheetRef = null;
40101
40124
  let mountedReference = null;
40102
40125
  let onMount = null;
40126
+ let onRenderResolve = null;
40103
40127
  const mounted = new Promise(resolve => {
40104
40128
  onMount = resolve;
40105
40129
  });
40130
+ const rendered = new Promise(resolve => {
40131
+ onRenderResolve = resolve;
40132
+ });
40133
+ const createOnInitialRender = override => () => {
40134
+ override === null || override === void 0 || override(); // from options.onInitialRender
40135
+ onRenderResolve(); // internal promise in viz to wait for render
40136
+ onRender(); // from RenderConfig
40137
+ };
40106
40138
  let initialSnOptions = {};
40107
40139
  let initialSnPlugins = [];
40108
40140
  const setSnOptions = async opts => {
40141
+ const override = opts.onInitialRender;
40109
40142
  if (mountedReference) {
40110
40143
  (async () => {
40111
40144
  await mounted;
40112
- sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2({}, initialSnOptions), opts));
40145
+ sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
40146
+ onInitialRender: createOnInitialRender(override)
40147
+ }));
40113
40148
  })();
40114
40149
  } else {
40115
40150
  // Handle setting options before mount
40116
- initialSnOptions = _objectSpread2(_objectSpread2({}, initialSnOptions), opts);
40151
+ initialSnOptions = _objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
40152
+ onInitialRender: createOnInitialRender(override)
40153
+ });
40117
40154
  }
40118
40155
  };
40119
40156
  const setSnPlugins = async plugins => {
@@ -40160,6 +40197,15 @@
40160
40197
  * @type {Navigation}
40161
40198
  */
40162
40199
  navigation,
40200
+ /**
40201
+ * Gets the specific api that a Viz exposes.
40202
+ * @private currently empty and private
40203
+ * @returns {Promise<object>} object that contains the internal Viz api.
40204
+ */
40205
+ async getImperativeHandle() {
40206
+ await rendered;
40207
+ return sheetRef.current.getImperativeHandle();
40208
+ },
40163
40209
  /**
40164
40210
  * Destroys the sheet and removes it from the the DOM.
40165
40211
  * @example
@@ -40192,7 +40238,8 @@
40192
40238
  initialSnPlugins,
40193
40239
  initialError,
40194
40240
  onMount,
40195
- navigation
40241
+ navigation,
40242
+ onError
40196
40243
  });
40197
40244
  return mounted;
40198
40245
  },
@@ -40227,12 +40274,18 @@
40227
40274
  /* eslint no-underscore-dangle:0 */
40228
40275
  async function initSheet(model, optional, halo, navigation, initialError) {
40229
40276
  let onDestroy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : async () => {};
40277
+ const {
40278
+ onRender,
40279
+ onError
40280
+ } = optional;
40230
40281
  const api = sheet({
40231
40282
  model,
40232
40283
  halo,
40233
40284
  navigation,
40234
40285
  initialError,
40235
- onDestroy
40286
+ onDestroy,
40287
+ onRender,
40288
+ onError
40236
40289
  });
40237
40290
  if (optional.options) {
40238
40291
  api.__DO_NOT_USE__.options(optional.options);
@@ -40375,7 +40428,9 @@
40375
40428
  return initSheet(model, {
40376
40429
  options,
40377
40430
  plugins,
40378
- element
40431
+ element,
40432
+ onRender,
40433
+ onError
40379
40434
  }, halo, navigation);
40380
40435
  }
40381
40436
  return init(model, {