@nebula.js/stardust 5.10.0 → 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.
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v5.10.0
2
+ * @nebula.js/stardust v5.11.0
3
3
  * Copyright (c) 2025 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -10754,7 +10754,7 @@ function create$3(definition) {
10754
10754
  return cache[key];
10755
10755
  }
10756
10756
 
10757
- const NEBULA_VERSION_HASH = "0b93";
10757
+ const NEBULA_VERSION_HASH = "a481";
10758
10758
  ClassNameGenerator.configure(componentName => {
10759
10759
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
10760
10760
  });
@@ -10986,7 +10986,7 @@ function boot(_ref2) {
10986
10986
  const appRef = React__default.createRef();
10987
10987
  const element = document.createElement('div');
10988
10988
  element.style.display = 'none';
10989
- element.setAttribute('data-nebulajs-version', "5.10.0");
10989
+ element.setAttribute('data-nebulajs-version', "5.11.0");
10990
10990
  element.setAttribute('data-app-id', app.id);
10991
10991
  document.body.appendChild(element);
10992
10992
  if (context) {
@@ -27041,7 +27041,7 @@ const SheetElement = {
27041
27041
  /** @type {'njs-sheet'} */
27042
27042
  className: 'njs-sheet'
27043
27043
  };
27044
- function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount, navigation) {
27044
+ function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount, navigation, onError) {
27045
27045
  const {
27046
27046
  x,
27047
27047
  y,
@@ -27066,7 +27066,8 @@ function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initial
27066
27066
  initialSnPlugins: initialSnPlugins,
27067
27067
  initialError: initialError,
27068
27068
  onMount: onMount,
27069
- navigation: navigation
27069
+ navigation: navigation,
27070
+ onError: onError
27070
27071
  }));
27071
27072
  }
27072
27073
  function getBounds(pos, columns, rows) {
@@ -27090,7 +27091,8 @@ const Sheet = forwardRef((_ref, ref) => {
27090
27091
  initialError,
27091
27092
  onMount,
27092
27093
  unmount,
27093
- navigation
27094
+ navigation,
27095
+ onError
27094
27096
  } = _ref;
27095
27097
  const {
27096
27098
  root
@@ -27105,6 +27107,11 @@ const Sheet = forwardRef((_ref, ref) => {
27105
27107
  const [bgColor, setBgColor] = useState$1(undefined);
27106
27108
  const [bgImage, setBgImage] = useState$1(undefined);
27107
27109
  const [deepHash, setDeepHash] = useState$1('');
27110
+ const renderState = useRef$1({
27111
+ cellCount: 0,
27112
+ cellsRendered: 0,
27113
+ initialRender: false
27114
+ });
27108
27115
  navigation === null || navigation === void 0 || (_navigation$setCurren = navigation.setCurrentSheetId) === null || _navigation$setCurren === void 0 || _navigation$setCurren.call(navigation, model.id);
27109
27116
  /// For each object
27110
27117
  useEffect$1(() => {
@@ -27125,6 +27132,15 @@ const Sheet = forwardRef((_ref, ref) => {
27125
27132
  root.removeCell(c.currentId);
27126
27133
  });
27127
27134
  const lCells = layout.cells;
27135
+ renderState.cellCount = lCells.length;
27136
+ renderState.cellsRendered = 0;
27137
+ const renderCallback = () => {
27138
+ renderState.cellsRendered++;
27139
+ if (renderState.cellsRendered === renderState.cellCount && !renderState.initialRender) {
27140
+ renderState.initialRender = true;
27141
+ initialSnOptions.onInitialRender();
27142
+ }
27143
+ };
27128
27144
  const {
27129
27145
  columns,
27130
27146
  rows
@@ -27152,7 +27168,10 @@ const Sheet = forwardRef((_ref, ref) => {
27152
27168
  cellRef: React__default.createRef(),
27153
27169
  currentId: uid(),
27154
27170
  mounted,
27155
- mountedPromise
27171
+ mountedPromise,
27172
+ options: _objectSpread2(_objectSpread2({}, initialSnOptions), {
27173
+ onInitialRender: renderCallback
27174
+ })
27156
27175
  };
27157
27176
  }));
27158
27177
  cs.forEach(c => root.addCell(c.currentId, c.cellRef));
@@ -27169,7 +27188,7 @@ const Sheet = forwardRef((_ref, ref) => {
27169
27188
  model.on('closed', onModelClose);
27170
27189
  return () => model.removeListener('closed', onModelClose);
27171
27190
  }, [model]);
27172
- const cellRenderers = useMemo$1(() => cells ? cells.map(c => getCellRenderer(c, halo, initialSnOptions, initialSnPlugins, initialError, c.mounted, navigation)) : [], [cells]);
27191
+ const cellRenderers = useMemo$1(() => cells ? cells.map(c => getCellRenderer(c, halo, c.options, initialSnPlugins, initialError, c.mounted, navigation, onError)) : [], [cells]);
27173
27192
  useEffect$1(() => {
27174
27193
  const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
27175
27194
  setBgColor(resolveBgColor(bgComp, halo.public.theme));
@@ -27219,7 +27238,8 @@ function glue(_ref) {
27219
27238
  initialSnPlugins,
27220
27239
  onMount,
27221
27240
  initialError,
27222
- navigation
27241
+ navigation,
27242
+ onError
27223
27243
  } = _ref;
27224
27244
  const {
27225
27245
  root
@@ -27238,7 +27258,8 @@ function glue(_ref) {
27238
27258
  initialError: initialError,
27239
27259
  onMount: onMount,
27240
27260
  unmount: unmount,
27241
- navigation: navigation
27261
+ navigation: navigation,
27262
+ onError: onError
27242
27263
  }), element, model.id);
27243
27264
  navigation.setSheetRef(sheetRef);
27244
27265
  root.add(portal);
@@ -27252,26 +27273,42 @@ function sheet() {
27252
27273
  halo,
27253
27274
  navigation,
27254
27275
  initialError,
27255
- onDestroy = async () => {}
27276
+ onDestroy = async () => {},
27277
+ onRender = () => {},
27278
+ onError = () => {}
27256
27279
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27257
27280
  let unmountSheet = noopi;
27258
27281
  let sheetRef = null;
27259
27282
  let mountedReference = null;
27260
27283
  let onMount = null;
27284
+ let onRenderResolve = null;
27261
27285
  const mounted = new Promise(resolve => {
27262
27286
  onMount = resolve;
27263
27287
  });
27288
+ const rendered = new Promise(resolve => {
27289
+ onRenderResolve = resolve;
27290
+ });
27291
+ const createOnInitialRender = override => () => {
27292
+ override === null || override === void 0 || override(); // from options.onInitialRender
27293
+ onRenderResolve(); // internal promise in viz to wait for render
27294
+ onRender(); // from RenderConfig
27295
+ };
27264
27296
  let initialSnOptions = {};
27265
27297
  let initialSnPlugins = [];
27266
27298
  const setSnOptions = async opts => {
27299
+ const override = opts.onInitialRender;
27267
27300
  if (mountedReference) {
27268
27301
  (async () => {
27269
27302
  await mounted;
27270
- sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2({}, initialSnOptions), opts));
27303
+ sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
27304
+ onInitialRender: createOnInitialRender(override)
27305
+ }));
27271
27306
  })();
27272
27307
  } else {
27273
27308
  // Handle setting options before mount
27274
- initialSnOptions = _objectSpread2(_objectSpread2({}, initialSnOptions), opts);
27309
+ initialSnOptions = _objectSpread2(_objectSpread2(_objectSpread2({}, initialSnOptions), opts), {
27310
+ onInitialRender: createOnInitialRender(override)
27311
+ });
27275
27312
  }
27276
27313
  };
27277
27314
  const setSnPlugins = async plugins => {
@@ -27318,6 +27355,15 @@ function sheet() {
27318
27355
  * @type {Navigation}
27319
27356
  */
27320
27357
  navigation,
27358
+ /**
27359
+ * Gets the specific api that a Viz exposes.
27360
+ * @private currently empty and private
27361
+ * @returns {Promise<object>} object that contains the internal Viz api.
27362
+ */
27363
+ async getImperativeHandle() {
27364
+ await rendered;
27365
+ return sheetRef.current.getImperativeHandle();
27366
+ },
27321
27367
  /**
27322
27368
  * Destroys the sheet and removes it from the the DOM.
27323
27369
  * @example
@@ -27350,7 +27396,8 @@ function sheet() {
27350
27396
  initialSnPlugins,
27351
27397
  initialError,
27352
27398
  onMount,
27353
- navigation
27399
+ navigation,
27400
+ onError
27354
27401
  });
27355
27402
  return mounted;
27356
27403
  },
@@ -27385,12 +27432,18 @@ function sheet() {
27385
27432
  /* eslint no-underscore-dangle:0 */
27386
27433
  async function initSheet(model, optional, halo, navigation, initialError) {
27387
27434
  let onDestroy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : async () => {};
27435
+ const {
27436
+ onRender,
27437
+ onError
27438
+ } = optional;
27388
27439
  const api = sheet({
27389
27440
  model,
27390
27441
  halo,
27391
27442
  navigation,
27392
27443
  initialError,
27393
- onDestroy
27444
+ onDestroy,
27445
+ onRender,
27446
+ onError
27394
27447
  });
27395
27448
  if (optional.options) {
27396
27449
  api.__DO_NOT_USE__.options(optional.options);
@@ -27533,7 +27586,9 @@ async function getObject(_ref, halo, store) {
27533
27586
  return initSheet(model, {
27534
27587
  options,
27535
27588
  plugins,
27536
- element
27589
+ element,
27590
+ onRender,
27591
+ onError
27537
27592
  }, halo, navigation);
27538
27593
  }
27539
27594
  return init(model, {