@nebula.js/stardust 4.8.1 → 5.0.0-alpha.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,11 +1,11 @@
1
1
  /*
2
- * @nebula.js/stardust v4.8.1
2
+ * @nebula.js/stardust v5.0.0-alpha.0
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
7
  import * as React from 'react';
8
- import React__default, { useState as useState$1, useEffect as useEffect$1, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useReducer, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef, useContext, createElement, Component } from 'react';
8
+ import React__default, { useState as useState$1, useEffect as useEffect$1, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useContext, useReducer, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef, createElement, Component } from 'react';
9
9
  import ReactDOM from 'react-dom';
10
10
  import { CacheProvider, ThemeContext as ThemeContext$2 } from '@emotion/react';
11
11
  import { Checkbox, Radio, Typography, FormControlLabel, Box, Grid, Tooltip, Paper, IconButton, styled as styled$4, Popover, MenuList, MenuItem, ListItemIcon, Divider, OutlinedInput, InputAdornment, Badge, List, ListItem, Button, Icon, CircularProgress } from '@mui/material';
@@ -3184,15 +3184,14 @@ function theme$1(resolvedTheme) {
3184
3184
  },
3185
3185
  dataColors() {
3186
3186
  /** @interface Theme~DataColorSpecials */
3187
- return (/** @lends Theme~DataColorSpecials */{
3188
- /** @type {string} */
3189
- primary: resolvedTheme.dataColors.primaryColor,
3190
- /** @type {string} */
3191
- nil: resolvedTheme.dataColors.nullColor,
3192
- /** @type {string} */
3193
- others: resolvedTheme.dataColors.othersColor
3194
- }
3195
- );
3187
+ return /** @lends Theme~DataColorSpecials */{
3188
+ /** @type {string} */
3189
+ primary: resolvedTheme.dataColors.primaryColor,
3190
+ /** @type {string} */
3191
+ nil: resolvedTheme.dataColors.nullColor,
3192
+ /** @type {string} */
3193
+ others: resolvedTheme.dataColors.othersColor
3194
+ };
3196
3195
  },
3197
3196
  uiColor(c, shift) {
3198
3197
  // eslint-disable-next-line no-param-reassign
@@ -3518,7 +3517,6 @@ function resolveVariables(objTree, variables) {
3518
3517
  }
3519
3518
  });
3520
3519
  }
3521
-
3522
3520
  styleResolver.resolveRawTheme = raw => {
3523
3521
  // TODO - validate format
3524
3522
  const c = extend$2(true, {}, raw);
@@ -5670,7 +5668,7 @@ function StyledEngineProvider(props) {
5670
5668
  }
5671
5669
 
5672
5670
  /**
5673
- * @mui/styled-engine v5.14.18
5671
+ * @mui/styled-engine v5.14.19
5674
5672
  *
5675
5673
  * @license MIT
5676
5674
  * This source code is licensed under the MIT license found in the
@@ -6126,51 +6124,25 @@ function borderTransform(value) {
6126
6124
  }
6127
6125
  return `${value}px solid`;
6128
6126
  }
6129
- const border = style$1({
6130
- prop: 'border',
6131
- themeKey: 'borders',
6132
- transform: borderTransform
6133
- });
6134
- const borderTop = style$1({
6135
- prop: 'borderTop',
6136
- themeKey: 'borders',
6137
- transform: borderTransform
6138
- });
6139
- const borderRight = style$1({
6140
- prop: 'borderRight',
6141
- themeKey: 'borders',
6142
- transform: borderTransform
6143
- });
6144
- const borderBottom = style$1({
6145
- prop: 'borderBottom',
6146
- themeKey: 'borders',
6147
- transform: borderTransform
6148
- });
6149
- const borderLeft = style$1({
6150
- prop: 'borderLeft',
6151
- themeKey: 'borders',
6152
- transform: borderTransform
6153
- });
6154
- const borderColor = style$1({
6155
- prop: 'borderColor',
6156
- themeKey: 'palette'
6157
- });
6158
- const borderTopColor = style$1({
6159
- prop: 'borderTopColor',
6160
- themeKey: 'palette'
6161
- });
6162
- const borderRightColor = style$1({
6163
- prop: 'borderRightColor',
6164
- themeKey: 'palette'
6165
- });
6166
- const borderBottomColor = style$1({
6167
- prop: 'borderBottomColor',
6168
- themeKey: 'palette'
6169
- });
6170
- const borderLeftColor = style$1({
6171
- prop: 'borderLeftColor',
6172
- themeKey: 'palette'
6173
- });
6127
+ function createBorderStyle(prop, transform) {
6128
+ return style$1({
6129
+ prop,
6130
+ themeKey: 'borders',
6131
+ transform
6132
+ });
6133
+ }
6134
+ const border = createBorderStyle('border', borderTransform);
6135
+ const borderTop = createBorderStyle('borderTop', borderTransform);
6136
+ const borderRight = createBorderStyle('borderRight', borderTransform);
6137
+ const borderBottom = createBorderStyle('borderBottom', borderTransform);
6138
+ const borderLeft = createBorderStyle('borderLeft', borderTransform);
6139
+ const borderColor = createBorderStyle('borderColor');
6140
+ const borderTopColor = createBorderStyle('borderTopColor');
6141
+ const borderRightColor = createBorderStyle('borderRightColor');
6142
+ const borderBottomColor = createBorderStyle('borderBottomColor');
6143
+ const borderLeftColor = createBorderStyle('borderLeftColor');
6144
+ const outline = createBorderStyle('outline', borderTransform);
6145
+ const outlineColor = createBorderStyle('outlineColor');
6174
6146
 
6175
6147
  // false positive
6176
6148
  // eslint-disable-next-line react/function-component-definition
@@ -6186,7 +6158,7 @@ const borderRadius$1 = props => {
6186
6158
  };
6187
6159
  borderRadius$1.propTypes = {};
6188
6160
  borderRadius$1.filterProps = ['borderRadius'];
6189
- compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius$1);
6161
+ compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius$1, outline, outlineColor);
6190
6162
 
6191
6163
  // false positive
6192
6164
  // eslint-disable-next-line react/function-component-definition
@@ -6384,6 +6356,13 @@ const defaultSxConfig = {
6384
6356
  borderLeftColor: {
6385
6357
  themeKey: 'palette'
6386
6358
  },
6359
+ outline: {
6360
+ themeKey: 'borders',
6361
+ transform: borderTransform
6362
+ },
6363
+ outlineColor: {
6364
+ themeKey: 'palette'
6365
+ },
6387
6366
  borderRadius: {
6388
6367
  themeKey: 'shape.borderRadius',
6389
6368
  style: borderRadius$1
@@ -8551,7 +8530,7 @@ function create$3(definition) {
8551
8530
  return cache[key];
8552
8531
  }
8553
8532
 
8554
- const NEBULA_VERSION_HASH = "cca9" ;
8533
+ const NEBULA_VERSION_HASH = "117f" ;
8555
8534
  ClassNameGenerator$1.configure(componentName => {
8556
8535
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8557
8536
  });
@@ -8562,9 +8541,49 @@ var InstanceContext = React__default.createContext({
8562
8541
  translator: null,
8563
8542
  constraints: {},
8564
8543
  interactions: {},
8565
- themeApi: null
8544
+ themeApi: null,
8545
+ modelStore: {},
8546
+ selectionStore: {}
8566
8547
  });
8567
8548
 
8549
+ const DEFAULT_INTERACTIONS = {
8550
+ active: true,
8551
+ select: true,
8552
+ passive: true,
8553
+ edit: false
8554
+ };
8555
+ function pickConstraintsOrInteractions(context) {
8556
+ const {
8557
+ constraints = {},
8558
+ interactions = {}
8559
+ } = context;
8560
+ // If some interaction is defined, then we use that
8561
+ if (Object.keys(interactions).length > 0) {
8562
+ return interactions;
8563
+ }
8564
+ const ret = {};
8565
+ Object.keys(constraints).forEach(state => {
8566
+ ret[state] = !constraints[state];
8567
+ });
8568
+ return ret;
8569
+ }
8570
+ function unifyContraintsAndInteractions(context) {
8571
+ const interactions = {};
8572
+ const constraints = {};
8573
+ const definedSettings = pickConstraintsOrInteractions(context);
8574
+ Object.keys(DEFAULT_INTERACTIONS).forEach(state => {
8575
+ if (definedSettings[state] !== undefined) {
8576
+ interactions[state] = definedSettings[state];
8577
+ constraints[state] = !definedSettings[state];
8578
+ } else {
8579
+ interactions[state] = DEFAULT_INTERACTIONS[state];
8580
+ constraints[state] = !DEFAULT_INTERACTIONS[state];
8581
+ }
8582
+ });
8583
+ context.constraints = constraints;
8584
+ context.interactions = interactions;
8585
+ }
8586
+
8568
8587
  var createKeyStore = (function () {
8569
8588
  let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8570
8589
  let applyMiddleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
@@ -8607,169 +8626,97 @@ var createKeyStore = (function () {
8607
8626
  return [useKeyStore, store];
8608
8627
  });
8609
8628
 
8610
- const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
8611
- const [useAppModalStore, appModalStore] = createKeyStore({});
8612
- const [useModalObjectStore, modalObjectStore] = createKeyStore({});
8613
-
8614
- /* eslint no-underscore-dangle: 0 */
8615
- function createAppSelections(_ref) {
8616
- let {
8617
- app
8618
- } = _ref;
8619
- const key = "".concat(app.id);
8620
- const end = async function () {
8621
- let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8622
- const {
8623
- model,
8624
- objectSelections
8625
- } = modalObjectStore.get(key) || {};
8626
- if (model) {
8627
- await model.endSelections(accept);
8628
- modalObjectStore.clear(key);
8629
- objectSelections.emit('deactivated');
8630
- }
8631
- };
8632
- const begin = async _ref2 => {
8633
- var _modalObjectStore$get;
8629
+ function initializeStores$1(appId) {
8630
+ const [useRpcResultStore, rpcResultStore] = createKeyStore({});
8631
+ const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
8632
+ const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
8633
+ const [useRpcRequestModelStore, rpcRequestModelStore] = createKeyStore({});
8634
+ const [useModelChangedStore, modelChangedStore] = createKeyStore({});
8635
+ const [, modelInitializedStore] = createKeyStore({});
8636
+ const modelStoreMiddleware = _ref => {
8634
8637
  let {
8635
- model,
8636
- paths,
8637
- accept = true,
8638
- objectSelections
8639
- } = _ref2;
8640
- // Quick return if it's already in modal
8641
- if (objectSelections === ((_modalObjectStore$get = modalObjectStore.get(key)) === null || _modalObjectStore$get === void 0 ? void 0 : _modalObjectStore$get.objectSelections)) {
8642
- return;
8638
+ type,
8639
+ value: model
8640
+ } = _ref;
8641
+ const initialized = modelInitializedStore.get(model.id);
8642
+ modelInitializedStore.set(model.id, {});
8643
+ const onChanged = () => {
8644
+ rpcRequestStore.clear(model.id);
8645
+ modelChangedStore.set(model.id, {});
8646
+ modelChangedStore.dispatch(true); // Force new state to trigger hooks
8647
+ };
8648
+ const unsubscribe = () => {
8649
+ model.removeListener('changed', onChanged);
8650
+ rpcResultStore.clear(model.id);
8651
+ rpcRequestStore.clear(model.id);
8652
+ rpcRequestSessionModelStore.clear(model.id);
8653
+ rpcRequestModelStore.clear(model.id);
8654
+ modelChangedStore.clear(model.id);
8655
+ modelInitializedStore.clear(model.id);
8656
+ };
8657
+ switch (type) {
8658
+ case 'SET':
8659
+ if (!initialized) {
8660
+ model.on('changed', onChanged);
8661
+ model.once('closed', () => {
8662
+ unsubscribe();
8663
+ });
8664
+ }
8665
+ break;
8643
8666
  }
8644
-
8645
- // If other model is in modal state end it
8646
- end(accept);
8647
-
8648
- // Pending modal
8649
- modalObjectStore.set(key, {
8650
- model,
8651
- objectSelections
8667
+ return unsubscribe;
8668
+ };
8669
+ const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
8670
+ const subscribe = model => {
8671
+ const unsubscribe = modelStoreMiddleware({
8672
+ type: 'SET',
8673
+ value: model
8652
8674
  });
8653
- const p = Array.isArray(paths) ? paths : [paths];
8654
- const beginSelections = async skipRetry => {
8655
- try {
8656
- await model.beginSelections(p);
8657
- modalObjectStore.set(key, {
8658
- model,
8659
- objectSelections
8660
- }); // We have a modal
8661
- } catch (err) {
8662
- if (err.code === 6003 && !skipRetry) {
8663
- await app.abortModal(accept);
8664
- beginSelections(true);
8665
- } else {
8666
- modalObjectStore.clear(key); // No modal
8667
- }
8668
- }
8675
+ return () => {
8676
+ unsubscribe();
8677
+ modelStore.clear(model.id);
8669
8678
  };
8670
-
8671
- await beginSelections();
8672
8679
  };
8673
- const appModal = {
8674
- begin,
8675
- end
8676
- };
8677
- appModalStore.set(key, appModal);
8678
-
8679
- /**
8680
- * @class
8681
- * @alias AppSelections
8682
- */
8683
- const appSelections = {
8684
- model: app,
8685
- isInModal() {
8686
- return !!modalObjectStore.get(key);
8687
- },
8688
- isModal(objectSelections) {
8689
- var _modalObjectStore$get2;
8690
- // TODO check model state
8691
- return objectSelections ? ((_modalObjectStore$get2 = modalObjectStore.get(key)) === null || _modalObjectStore$get2 === void 0 ? void 0 : _modalObjectStore$get2.objectSelections) === objectSelections : !!modalObjectStore.get(key);
8692
- },
8693
- forward() {
8694
- return appModal.end().then(() => app.forward());
8695
- },
8696
- back() {
8697
- return appModal.end().then(() => app.back());
8698
- },
8699
- clear() {
8700
- return appModal.end().then(() => app.clearAll());
8701
- },
8702
- clearField(field) {
8703
- let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
8704
- return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
8705
- }
8680
+ return {
8681
+ subscribe,
8682
+ useModelStore,
8683
+ modelStore,
8684
+ useModelChangedStore,
8685
+ useRpcResultStore,
8686
+ rpcResultStore,
8687
+ useRpcRequestStore,
8688
+ rpcRequestStore,
8689
+ useRpcRequestModelStore,
8690
+ rpcRequestModelStore,
8691
+ useRpcRequestSessionModelStore,
8692
+ rpcRequestSessionModelStore,
8693
+ modelChangedStore,
8694
+ appId
8706
8695
  };
8707
- return appSelections;
8708
- }
8709
- function useAppSelections(app) {
8710
- if (!app.session) {
8711
- // assume the app is mocked if session is undefined
8712
- return [];
8713
- }
8714
- const [appSelectionsStore] = useAppSelectionsStore();
8715
- const key = app ? app.id : null;
8716
- let appSelections = appSelectionsStore.get(key);
8717
- useEffect$1(() => {
8718
- if (!app || appSelections) return;
8719
- appSelections = createAppSelections({
8720
- app
8721
- });
8722
- appSelectionsStore.set(key, appSelections);
8723
- appSelectionsStore.dispatch(true);
8724
- }, [app]);
8725
- return [appSelections];
8726
8696
  }
8727
8697
 
8728
- const DEFAULT_INTERACTIONS = {
8729
- active: true,
8730
- select: true,
8731
- passive: true,
8732
- edit: false
8733
- };
8734
- function pickConstraintsOrInteractions(context) {
8735
- const {
8736
- constraints = {},
8737
- interactions = {}
8738
- } = context;
8739
- // If some interaction is defined, then we use that
8740
- if (Object.keys(interactions).length > 0) {
8741
- return interactions;
8742
- }
8743
- const ret = {};
8744
- Object.keys(constraints).forEach(state => {
8745
- ret[state] = !constraints[state];
8746
- });
8747
- return ret;
8748
- }
8749
- function unifyContraintsAndInteractions(context) {
8750
- const interactions = {};
8751
- const constraints = {};
8752
- const definedSettings = pickConstraintsOrInteractions(context);
8753
- Object.keys(DEFAULT_INTERACTIONS).forEach(state => {
8754
- if (definedSettings[state] !== undefined) {
8755
- interactions[state] = definedSettings[state];
8756
- constraints[state] = !definedSettings[state];
8757
- } else {
8758
- interactions[state] = DEFAULT_INTERACTIONS[state];
8759
- constraints[state] = !DEFAULT_INTERACTIONS[state];
8760
- }
8761
- });
8762
- context.constraints = constraints;
8763
- context.interactions = interactions;
8698
+ function initializeStores(appId) {
8699
+ const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
8700
+ const [useAppModalStore, appModalStore] = createKeyStore({});
8701
+ const [useModalObjectStore, modalObjectStore] = createKeyStore({});
8702
+ return {
8703
+ useAppSelectionsStore,
8704
+ useAppModalStore,
8705
+ appSelectionsStore,
8706
+ appModalStore,
8707
+ useModalObjectStore,
8708
+ modalObjectStore,
8709
+ appId
8710
+ };
8764
8711
  }
8765
8712
 
8766
8713
  const NebulaApp = forwardRef((_ref, ref) => {
8767
8714
  let {
8768
8715
  initialContext,
8769
- app,
8770
- renderCallback
8716
+ renderCallback,
8717
+ modelStore,
8718
+ selectionStore
8771
8719
  } = _ref;
8772
- const [appSelections] = useAppSelections(app);
8773
8720
  const [context, setContext] = useState$1(initialContext);
8774
8721
  const [muiThemeName, setMuiThemeName] = useState$1();
8775
8722
  const {
@@ -8789,9 +8736,12 @@ const NebulaApp = forwardRef((_ref, ref) => {
8789
8736
  setComponents([...comps]);
8790
8737
  },
8791
8738
  setMuiThemeName,
8792
- setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext),
8793
- getAppSelections: () => appSelections
8739
+ setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext)
8794
8740
  }), []);
8741
+ if (context) {
8742
+ context.modelStore = modelStore;
8743
+ context.selectionStore = selectionStore;
8744
+ }
8795
8745
  return /*#__PURE__*/React__default.createElement(StyledEngineProvider, {
8796
8746
  injectFirst: true
8797
8747
  }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
@@ -8812,18 +8762,21 @@ function boot(_ref2) {
8812
8762
  const appRef = React__default.createRef();
8813
8763
  const element = document.createElement('div');
8814
8764
  element.style.display = 'none';
8815
- element.setAttribute('data-nebulajs-version', "4.8.1" );
8765
+ element.setAttribute('data-nebulajs-version', "5.0.0-alpha.0" );
8816
8766
  element.setAttribute('data-app-id', app.id);
8817
8767
  document.body.appendChild(element);
8818
8768
  if (context) {
8819
8769
  unifyContraintsAndInteractions(context);
8820
8770
  }
8771
+ const modelStore = initializeStores$1(app.id);
8772
+ const selectionStore = initializeStores(app.id);
8821
8773
  const root = client.createRoot(element);
8822
8774
  root.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
8823
8775
  ref: appRef,
8824
- app: app,
8825
8776
  initialContext: context,
8826
- renderCallback: resolveRender
8777
+ renderCallback: resolveRender,
8778
+ modelStore: modelStore,
8779
+ selectionStore: selectionStore
8827
8780
  }));
8828
8781
  const cells = {};
8829
8782
  const components = [];
@@ -8872,65 +8825,40 @@ function boot(_ref2) {
8872
8825
  }
8873
8826
  appRef.current.setContext(ctx);
8874
8827
  })();
8875
- },
8876
- getAppSelections: async () => {
8877
- await rendered;
8878
- return appRef.current.getAppSelections();
8879
8828
  }
8880
- }, appRef, rendered];
8829
+ }, modelStore, selectionStore, appRef, rendered];
8881
8830
  }
8882
8831
 
8883
- const [useRpcResultStore, rpcResultStore] = createKeyStore({});
8884
- const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
8885
- const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
8886
- const [useRpcRequestModelStore, rpcRequestModelStore] = createKeyStore({});
8887
- const [useModelChangedStore, modelChangedStore] = createKeyStore({});
8888
- const [, modelInitializedStore] = createKeyStore({});
8889
- const modelStoreMiddleware = _ref => {
8890
- let {
8891
- type,
8892
- value: model
8893
- } = _ref;
8894
- const initialized = modelInitializedStore.get(model.id);
8895
- modelInitializedStore.set(model.id, {});
8896
- const onChanged = () => {
8897
- rpcRequestStore.clear(model.id);
8898
- modelChangedStore.set(model.id, {});
8899
- modelChangedStore.dispatch(true); // Force new state to trigger hooks
8900
- };
8901
-
8902
- const unsubscribe = () => {
8903
- model.removeListener('changed', onChanged);
8904
- rpcResultStore.clear(model.id);
8905
- rpcRequestStore.clear(model.id);
8906
- rpcRequestSessionModelStore.clear(model.id);
8907
- rpcRequestModelStore.clear(model.id);
8908
- modelChangedStore.clear(model.id);
8909
- modelInitializedStore.clear(model.id);
8910
- };
8911
- switch (type) {
8912
- case 'SET':
8913
- if (!initialized) {
8914
- model.on('changed', onChanged);
8915
- model.once('closed', () => {
8916
- unsubscribe();
8917
- });
8918
- }
8919
- break;
8920
- }
8921
- return unsubscribe;
8922
- };
8923
- const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
8924
- const subscribe = model => {
8925
- const unsubscribe = modelStoreMiddleware({
8926
- type: 'SET',
8927
- value: model
8928
- });
8929
- return () => {
8930
- unsubscribe();
8931
- modelStore.clear(model.id);
8932
- };
8933
- };
8832
+ function useModelStore() {
8833
+ const {
8834
+ useModelStore: useFunc
8835
+ } = useContext(InstanceContext).modelStore;
8836
+ return useFunc();
8837
+ }
8838
+ function useModelChangedStore() {
8839
+ const {
8840
+ useModelChangedStore: useFunc
8841
+ } = useContext(InstanceContext).modelStore;
8842
+ return useFunc();
8843
+ }
8844
+ function useRpcResultStore() {
8845
+ const {
8846
+ useRpcResultStore: useFunc
8847
+ } = useContext(InstanceContext).modelStore;
8848
+ return useFunc();
8849
+ }
8850
+ function useRpcRequestStore() {
8851
+ const {
8852
+ useRpcRequestStore: useFunc
8853
+ } = useContext(InstanceContext).modelStore;
8854
+ return useFunc();
8855
+ }
8856
+ function useRpcRequestSessionModelStore() {
8857
+ const {
8858
+ useRpcRequestSessionModelStore: useFunc
8859
+ } = useContext(InstanceContext).modelStore;
8860
+ return useFunc();
8861
+ }
8934
8862
 
8935
8863
  function useSessionModel(definition, app) {
8936
8864
  const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
@@ -10058,7 +9986,6 @@ const getMaxFreqWidth = _ref2 => {
10058
9986
  if (frequencyMode === 'P') {
10059
9987
  return sizes.freqMinWidth; // because it will never grow beyond "100.0%"
10060
9988
  }
10061
-
10062
9989
  return sizes.freqMaxWidth;
10063
9990
  };
10064
9991
  const getSelectedStyle = _ref3 => {
@@ -11065,7 +10992,6 @@ function getRowsKeyboardNavigation(_ref) {
11065
10992
  } else {
11066
10993
  return; // propagate to other Esc handler
11067
10994
  }
11068
-
11069
10995
  break;
11070
10996
  case KEYS.HOME:
11071
10997
  focusListItems.setFirst(true);
@@ -11099,7 +11025,6 @@ function getRowsKeyboardNavigation(_ref) {
11099
11025
  return;
11100
11026
  // don't stop propagation since we want to outsource keydown to other handlers.
11101
11027
  }
11102
-
11103
11028
  if (elementToFocus) {
11104
11029
  elementToFocus.focus();
11105
11030
  }
@@ -11265,7 +11190,6 @@ function RowColumn(_ref) {
11265
11190
  if (!cell) {
11266
11191
  return null; // prevent rendering empty rows
11267
11192
  }
11268
-
11269
11193
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
11270
11194
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
11271
11195
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
@@ -14158,7 +14082,6 @@ function ListBox(_ref) {
14158
14082
  if (s.scrollPosition === 'overflowEnd') {
14159
14083
  return; // Do keyScroll.reset() in fetchData() to avoid scrolling to top.
14160
14084
  }
14161
-
14162
14085
  keyScroll.reset();
14163
14086
  }, [keyScroll.state.up, keyScroll.state.down, keyScroll.state.scrollPosition]);
14164
14087
  const {
@@ -15137,6 +15060,128 @@ function ListBoxSearch(_ref2) {
15137
15060
  });
15138
15061
  }
15139
15062
 
15063
+ /* eslint no-underscore-dangle: 0 */
15064
+ function createAppSelections(_ref) {
15065
+ let {
15066
+ app,
15067
+ selectionStore
15068
+ } = _ref;
15069
+ const key = "".concat(app.id);
15070
+ const {
15071
+ modalObjectStore,
15072
+ appModalStore
15073
+ } = selectionStore;
15074
+ const end = async function () {
15075
+ let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
15076
+ const {
15077
+ model,
15078
+ objectSelections
15079
+ } = modalObjectStore.get(key) || {};
15080
+ if (model) {
15081
+ await model.endSelections(accept);
15082
+ modalObjectStore.clear(key);
15083
+ objectSelections.emit('deactivated');
15084
+ }
15085
+ };
15086
+ const begin = async _ref2 => {
15087
+ var _modalObjectStore$get;
15088
+ let {
15089
+ model,
15090
+ paths,
15091
+ accept = true,
15092
+ objectSelections
15093
+ } = _ref2;
15094
+ // Quick return if it's already in modal
15095
+ if (objectSelections === ((_modalObjectStore$get = modalObjectStore.get(key)) === null || _modalObjectStore$get === void 0 ? void 0 : _modalObjectStore$get.objectSelections)) {
15096
+ return;
15097
+ }
15098
+
15099
+ // If other model is in modal state end it
15100
+ end(accept);
15101
+
15102
+ // Pending modal
15103
+ modalObjectStore.set(key, {
15104
+ model,
15105
+ objectSelections
15106
+ });
15107
+ const p = Array.isArray(paths) ? paths : [paths];
15108
+ const beginSelections = async skipRetry => {
15109
+ try {
15110
+ await model.beginSelections(p);
15111
+ modalObjectStore.set(key, {
15112
+ model,
15113
+ objectSelections
15114
+ }); // We have a modal
15115
+ } catch (err) {
15116
+ if (err.code === 6003 && !skipRetry) {
15117
+ await app.abortModal(accept);
15118
+ beginSelections(true);
15119
+ } else {
15120
+ modalObjectStore.clear(key); // No modal
15121
+ }
15122
+ }
15123
+ };
15124
+ await beginSelections();
15125
+ };
15126
+ const appModal = {
15127
+ begin,
15128
+ end
15129
+ };
15130
+ appModalStore.set(key, appModal);
15131
+
15132
+ /**
15133
+ * @class
15134
+ * @alias AppSelections
15135
+ */
15136
+ const appSelections = {
15137
+ model: app,
15138
+ isInModal() {
15139
+ return !!modalObjectStore.get(key);
15140
+ },
15141
+ isModal(objectSelections) {
15142
+ var _modalObjectStore$get2;
15143
+ // TODO check model state
15144
+ return objectSelections ? ((_modalObjectStore$get2 = modalObjectStore.get(key)) === null || _modalObjectStore$get2 === void 0 ? void 0 : _modalObjectStore$get2.objectSelections) === objectSelections : !!modalObjectStore.get(key);
15145
+ },
15146
+ forward() {
15147
+ return appModal.end().then(() => app.forward());
15148
+ },
15149
+ back() {
15150
+ return appModal.end().then(() => app.back());
15151
+ },
15152
+ clear() {
15153
+ return appModal.end().then(() => app.clearAll());
15154
+ },
15155
+ clearField(field) {
15156
+ let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
15157
+ return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
15158
+ }
15159
+ };
15160
+ return appSelections;
15161
+ }
15162
+ function useAppSelections(app) {
15163
+ if (!app.session) {
15164
+ // assume the app is mocked if session is undefined
15165
+ return [];
15166
+ }
15167
+ const {
15168
+ selectionStore
15169
+ } = useContext(InstanceContext);
15170
+ const [appSelectionsStore] = selectionStore.useAppSelectionsStore();
15171
+ const key = app ? app.id : null;
15172
+ let appSelections = appSelectionsStore.get(key);
15173
+ useEffect$1(() => {
15174
+ if (!app || appSelections) return;
15175
+ appSelections = createAppSelections({
15176
+ app,
15177
+ selectionStore
15178
+ });
15179
+ appSelectionsStore.set(key, appSelections);
15180
+ appSelectionsStore.dispatch(true);
15181
+ }, [app]);
15182
+ return [appSelections];
15183
+ }
15184
+
15140
15185
  function eventmixin (obj) {
15141
15186
  /* eslint no-param-reassign: 0 */
15142
15187
  Object.keys(EventEmitter$1.prototype).forEach(key => {
@@ -15380,7 +15425,9 @@ function useObjectSelections(app, model, elements, options) {
15380
15425
  const elementsArr = Array.isArray(elements) ? elements : [elements];
15381
15426
  const [appSelections] = useAppSelections(app);
15382
15427
  const [layout] = useLayout$1(model);
15383
- const [appModalStore] = useAppModalStore();
15428
+ const {
15429
+ appModalStore
15430
+ } = useContext(InstanceContext).selectionStore;
15384
15431
  const appModal = appModalStore.get(app.id);
15385
15432
  const [objectSelections, setObjectSelections] = useState$1();
15386
15433
  useEffect$1(() => {
@@ -16727,7 +16774,6 @@ class Color {
16727
16774
  this._lumi = 0.299 * this._r + 0.587 * this._g + 0.114 * this._b; // option 2
16728
16775
  // this._lumi = Math.sqrt( 0.241 * this._r * this._r + 0.691 * this._g * this._g + 0.068 * this._b * this._b ); // option 3
16729
16776
  }
16730
-
16731
16777
  return this._lumi;
16732
16778
  }
16733
16779
 
@@ -17780,7 +17826,6 @@ function OneField(_ref) {
17780
17826
  segments.forEach((s, i) => {
17781
17827
  s.offset = i ? segments[i - 1].offset + segments[i - 1].ratio : 0; // eslint-disable-line
17782
17828
  });
17783
-
17784
17829
  let Header = null;
17785
17830
  let Icon = null;
17786
17831
  let SegmentsIndicator = null;
@@ -18233,7 +18278,9 @@ function SelectedFields(_ref) {
18233
18278
  items: [],
18234
18279
  more: []
18235
18280
  });
18236
- const [modalObjectStore] = useModalObjectStore();
18281
+ const {
18282
+ modalObjectStore
18283
+ } = useContext(InstanceContext).selectionStore;
18237
18284
  const [containerRef, containerRect] = useRect$1();
18238
18285
  const [maxItems, setMaxItems] = useState$1(0);
18239
18286
  const isInListboxPopover = () => {
@@ -19011,7 +19058,6 @@ function getListboxContainerKeyboardNavigation(_ref) {
19011
19058
  if (!event.target.classList.contains('listbox-container')) {
19012
19059
  break; // don't mess with keydown handlers within the listbox (e.g. row seletion)
19013
19060
  }
19014
-
19015
19061
  keyboard.focus();
19016
19062
  prevent();
19017
19063
  break;
@@ -19196,7 +19242,6 @@ function getContainerPadding(_ref) {
19196
19242
  } else {
19197
19243
  containerPadding = undefined; // to prevent overriding any default padding
19198
19244
  }
19199
-
19200
19245
  return containerPadding;
19201
19246
  }
19202
19247
 
@@ -19268,7 +19313,6 @@ const Title = styled$1(Typography)(_ref3 => {
19268
19313
  paddingRight: '1px' // make place for italic font style
19269
19314
  });
19270
19315
  });
19271
-
19272
19316
  const isModal = _ref4 => {
19273
19317
  var _app$isInModalSelecti, _app$isInModalSelecti2;
19274
19318
  let {
@@ -20143,7 +20187,6 @@ function ListBoxWrapper(_ref) {
20143
20187
  frequencyMode: getFrequencyModeLetter(options.frequencyMode) // stick to letter option hereafter
20144
20188
  });
20145
20189
  }
20146
-
20147
20190
  const [changeCount, setChangeCount] = useState$1(0);
20148
20191
  useEffect$1(() => {
20149
20192
  if (changeCount) {
@@ -20545,7 +20588,6 @@ async function populateData(_ref, halo) {
20545
20588
  {
20546
20589
  console.warn('Attempting to add fields to an object without a specified data target'); // eslint-disable-line no-console
20547
20590
  }
20548
-
20549
20591
  return;
20550
20592
  }
20551
20593
  const {
@@ -20644,7 +20686,6 @@ const getValue = (data, reference, defaultValue) => {
20644
20686
  if (step === '') {
20645
20687
  continue; // eslint-disable-line no-continue
20646
20688
  }
20647
-
20648
20689
  if (dataContainer[step] === undefined || dataContainer[step] === null) {
20649
20690
  return defaultValue;
20650
20691
  }
@@ -20814,7 +20855,6 @@ function copyPropertyOrSetDefault(propertyName, source, target, defaultValue) {
20814
20855
  function getOthersLabel() {
20815
20856
  return 'Others'; // TODO: translator.get('properties.dimensionLimits.others')
20816
20857
  }
20817
-
20818
20858
  function createDefaultDimension(dimensionDef, dimensionProperties) {
20819
20859
  const def = extend$2(true, {}, dimensionProperties, dimensionDef);
20820
20860
  if (!utils.getValue(def, 'qOtherTotalSpec.qOtherCounted')) {
@@ -21340,7 +21380,6 @@ const getDefaultExportPropertiesFn = path => {
21340
21380
  }
21341
21381
  return undefined; // TODO: add listbox and other
21342
21382
  };
21343
-
21344
21383
  const getExportPropertiesFnc = qae => {
21345
21384
  if (qae.exportProperties) {
21346
21385
  return qae.exportProperties;
@@ -21355,7 +21394,6 @@ const getDefaultImportPropertiesFnc = path => {
21355
21394
  }
21356
21395
  return undefined; // TODO: add listbox and other
21357
21396
  };
21358
-
21359
21397
  const getImportPropertiesFnc = qae => {
21360
21398
  if (qae.importProperties) {
21361
21399
  return qae.importProperties;
@@ -21369,7 +21407,8 @@ const convertTo = async _ref2 => {
21369
21407
  model,
21370
21408
  cellRef,
21371
21409
  newType,
21372
- properties
21410
+ properties,
21411
+ viewDataMode = false
21373
21412
  } = _ref2;
21374
21413
  const propertyTree = properties ? {
21375
21414
  qProperty: properties
@@ -21390,7 +21429,8 @@ const convertTo = async _ref2 => {
21390
21429
  }
21391
21430
  const exportFormat = exportProperties({
21392
21431
  propertyTree,
21393
- hypercubePath: helpers.getHypercubePath(sourceQae)
21432
+ hypercubePath: helpers.getHypercubePath(sourceQae),
21433
+ viewDataMode
21394
21434
  });
21395
21435
  const initial = utils.getValue(targetQae, 'properties.initial', {});
21396
21436
  const initialProperties = _objectSpread2({
@@ -21403,7 +21443,8 @@ const convertTo = async _ref2 => {
21403
21443
  exportFormat,
21404
21444
  initialProperties,
21405
21445
  dataDefinition: utils.getValue(targetQae, 'data.targets.0.', {}),
21406
- hypercubePath: helpers.getHypercubePath(targetQae)
21446
+ hypercubePath: helpers.getHypercubePath(targetQae),
21447
+ viewDataMode
21407
21448
  });
21408
21449
  return newPropertyTree;
21409
21450
  };
@@ -22422,7 +22463,7 @@ const loadType = async _ref5 => {
22422
22463
  const Cell = forwardRef((_ref6, ref) => {
22423
22464
  let {
22424
22465
  halo,
22425
- model,
22466
+ model: inputModel,
22426
22467
  initialSnOptions,
22427
22468
  initialSnPlugins,
22428
22469
  initialError,
@@ -22447,6 +22488,7 @@ const Cell = forwardRef((_ref6, ref) => {
22447
22488
  const theme = useTheme$1();
22448
22489
  const [cellRef, cellRect, cellNode] = useRect$1();
22449
22490
  const [state, dispatch] = useReducer(contentReducer, initialState(initialError));
22491
+ const [model, setModel] = useState$1(inputModel);
22450
22492
  const [layout, {
22451
22493
  validating,
22452
22494
  canCancel,
@@ -22600,6 +22642,7 @@ const Cell = forwardRef((_ref6, ref) => {
22600
22642
  },
22601
22643
  setSnOptions,
22602
22644
  setSnPlugins,
22645
+ setModel,
22603
22646
  getImperativeHandle() {
22604
22647
  var _state$sn;
22605
22648
  if ((_state$sn = state.sn) !== null && _state$sn !== void 0 && _state$sn.component && typeof state.sn.component.getImperativeHandle === 'function') {
@@ -23388,7 +23431,6 @@ function flushMacro(hooks) {
23388
23431
  hooks.macro = null;
23389
23432
  maybeEndChain(hooks); // eslint-disable-line no-use-before-define
23390
23433
  }
23391
-
23392
23434
  function maybeEndChain(hooks) {
23393
23435
  if (hooks.pendingPromises.length || hooks.micro || hooks.macro) {
23394
23436
  return;
@@ -24925,7 +24967,6 @@ const resolveValue = (data, reference, defaultValue) => {
24925
24967
  if (steps[i] === '') {
24926
24968
  continue; // eslint-disable-line no-continue
24927
24969
  }
24928
-
24929
24970
  if (typeof dataContainer[steps[i]] === 'undefined') {
24930
24971
  return defaultValue;
24931
24972
  }
@@ -25085,6 +25126,7 @@ function viz() {
25085
25126
  let mountedReference = null;
25086
25127
  let onMount = null;
25087
25128
  let onRender = null;
25129
+ let viewDataObjectId;
25088
25130
  const mounted = new Promise(resolve => {
25089
25131
  onMount = resolve;
25090
25132
  });
@@ -25222,6 +25264,49 @@ function viz() {
25222
25264
  });
25223
25265
  return propertyTree;
25224
25266
  },
25267
+ /**
25268
+ * Toggles the chart to a data view of the chart.
25269
+ *
25270
+ * The chart will be toggled to the type defined in the nebula context (dataViewType).
25271
+ *
25272
+ * The default dataViewType for nebula is sn-table. The specified chart type needs to be registered as well, in order to make it possible to render the data view.
25273
+ *
25274
+ * @experimental
25275
+ * @since 4.9.0
25276
+ * @param {boolean=} showDataView - If included, forces the chart into a specific state. True will show data view, and false will show the original chart. If not included it will always toggle between the two views.
25277
+ */
25278
+ async toggleDataView(showDataView) {
25279
+ let newModel;
25280
+ if (!viewDataObjectId && showDataView !== false) {
25281
+ let newType = halo.config.context.dataViewType;
25282
+ const oldProperties = await model.getEffectiveProperties();
25283
+ // Check if dataViewType is registered. Otherwise potentially fallback to table
25284
+ if (!halo.types.getSupportedVersion(newType)) {
25285
+ if (halo.types.getSupportedVersion('table')) {
25286
+ newType = 'table';
25287
+ } else {
25288
+ throw new Error('No data view type registered');
25289
+ }
25290
+ }
25291
+ const propertyTree = await convertTo({
25292
+ halo,
25293
+ model,
25294
+ cellRef,
25295
+ newType,
25296
+ properties: oldProperties,
25297
+ viewDataMode: true
25298
+ });
25299
+ newModel = await halo.app.createSessionObject(propertyTree.qProperty);
25300
+ viewDataObjectId = newModel.id;
25301
+ } else if (viewDataObjectId && showDataView !== true) {
25302
+ newModel = model;
25303
+ await halo.app.destroySessionObject(viewDataObjectId);
25304
+ viewDataObjectId = undefined;
25305
+ }
25306
+ if (newModel) {
25307
+ cellRef.current.setModel(newModel);
25308
+ }
25309
+ },
25225
25310
  /**
25226
25311
  * Listens to custom events from inside the visualization. See useEmitter
25227
25312
  * @experimental
@@ -25356,9 +25441,7 @@ function viz() {
25356
25441
  // setOptions() {}, // applied soft patch
25357
25442
  // resize() {},
25358
25443
  // show() {},
25359
- // toggleDataView() {},
25360
25444
  };
25361
-
25362
25445
  return api;
25363
25446
  }
25364
25447
 
@@ -25420,7 +25503,7 @@ async function init(model, optional, halo, initialError) {
25420
25503
  * };
25421
25504
  * nebbie.render(createConfig);
25422
25505
  */
25423
- async function createSessionObject(_ref, halo) {
25506
+ async function createSessionObject(_ref, halo, store) {
25424
25507
  let {
25425
25508
  type,
25426
25509
  version,
@@ -25433,6 +25516,10 @@ async function createSessionObject(_ref, halo) {
25433
25516
  } = _ref;
25434
25517
  let mergedProps = {};
25435
25518
  const children = [];
25519
+ const {
25520
+ modelStore,
25521
+ subscribe
25522
+ } = store;
25436
25523
  let error;
25437
25524
  try {
25438
25525
  const t = halo.types.get({
@@ -25464,7 +25551,6 @@ async function createSessionObject(_ref, halo) {
25464
25551
  };
25465
25552
  // console.error(e); // eslint-disable-line
25466
25553
  }
25467
-
25468
25554
  const model = await halo.app.createSessionObject(mergedProps);
25469
25555
  if (children.length > 0) {
25470
25556
  await model.setFullPropertyTree({
@@ -25498,7 +25584,7 @@ async function createSessionObject(_ref, halo) {
25498
25584
  * @property {EngineAPI.IGenericObjectProperties=} properties
25499
25585
  */
25500
25586
 
25501
- async function createObject(_ref, halo, generateOnly) {
25587
+ async function createObject(_ref, halo, generateOnly, store) {
25502
25588
  let {
25503
25589
  type,
25504
25590
  version,
@@ -25508,6 +25594,9 @@ async function createObject(_ref, halo, generateOnly) {
25508
25594
  } = _ref;
25509
25595
  let mergedProps = {};
25510
25596
  const children = [];
25597
+ const {
25598
+ modelStore
25599
+ } = store;
25511
25600
  // let error;
25512
25601
  try {
25513
25602
  const t = halo.types.get({
@@ -25543,7 +25632,6 @@ async function createObject(_ref, halo, generateOnly) {
25543
25632
  }
25544
25633
  // console.error(e); // eslint-disable-line
25545
25634
  }
25546
-
25547
25635
  if (!generateOnly) {
25548
25636
  const model = await halo.app.createObject(mergedProps);
25549
25637
  if (children.length > 0) {
@@ -25558,13 +25646,17 @@ async function createObject(_ref, halo, generateOnly) {
25558
25646
  return mergedProps;
25559
25647
  }
25560
25648
 
25561
- async function getObject$1(_ref, halo) {
25649
+ async function getObject$1(_ref, halo, store) {
25562
25650
  let {
25563
25651
  id,
25564
25652
  options,
25565
25653
  plugins,
25566
25654
  element
25567
25655
  } = _ref;
25656
+ const {
25657
+ modelStore,
25658
+ rpcRequestModelStore
25659
+ } = store;
25568
25660
  const key = "".concat(id);
25569
25661
  let rpc = rpcRequestModelStore.get(key);
25570
25662
  if (!rpc) {
@@ -25641,7 +25733,8 @@ function Sheet(_ref) {
25641
25733
  } = halo;
25642
25734
  const [layout] = useLayout$1(model);
25643
25735
  const {
25644
- theme: themeName
25736
+ theme: themeName,
25737
+ modelStore
25645
25738
  } = useContext(InstanceContext);
25646
25739
  const [cells, setCells] = useState$1([]);
25647
25740
  const [bgColor, setBgColor] = useState$1(undefined);
@@ -25686,7 +25779,7 @@ function Sheet(_ref) {
25686
25779
  }
25687
25780
  const vs = await getObject$1({
25688
25781
  id: c.name
25689
- }, halo);
25782
+ }, halo, modelStore);
25690
25783
  return {
25691
25784
  model: vs.model,
25692
25785
  id: c.name,
@@ -25920,13 +26013,17 @@ async function initSheet(model, optional, halo, initialError) {
25920
26013
  return api;
25921
26014
  }
25922
26015
 
25923
- async function getObject(_ref, halo) {
26016
+ async function getObject(_ref, halo, store) {
25924
26017
  let {
25925
26018
  id,
25926
26019
  options,
25927
26020
  plugins,
25928
26021
  element
25929
26022
  } = _ref;
26023
+ const {
26024
+ modelStore,
26025
+ rpcRequestModelStore
26026
+ } = store;
25930
26027
  const key = "".concat(id);
25931
26028
  let rpc = rpcRequestModelStore.get(key);
25932
26029
  if (!rpc) {
@@ -25955,15 +26052,14 @@ function flagsFn () {
25955
26052
  * @interface Flags
25956
26053
  */
25957
26054
 
25958
- return (/** @lends Flags */{
25959
- /**
25960
- * Checks whether the specified flag is enabled.
25961
- * @param {string} flag - The value flag to check.
25962
- * @returns {boolean} True if the specified flag is enabled, false otherwise.
25963
- */
25964
- isEnabled: f => flags[f] === true
25965
- }
25966
- );
26055
+ return /** @lends Flags */{
26056
+ /**
26057
+ * Checks whether the specified flag is enabled.
26058
+ * @param {string} flag - The value flag to check.
26059
+ * @returns {boolean} True if the specified flag is enabled, false otherwise.
26060
+ */
26061
+ isEnabled: f => flags[f] === true
26062
+ };
25967
26063
  }
25968
26064
 
25969
26065
  var iterator;
@@ -26526,7 +26622,6 @@ class LRUCache {
26526
26622
  this[LRU_LIST] = new Yallist(); // list of items in order of use recency
26527
26623
  this[LENGTH] = 0; // length of items in the list
26528
26624
  }
26529
-
26530
26625
  dump() {
26531
26626
  return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {
26532
26627
  k: hit.key,
@@ -27885,7 +27980,6 @@ async function load(name, version, _ref, loader) {
27885
27980
  {
27886
27981
  console.warn(e); // eslint-disable-line no-console
27887
27982
  }
27888
-
27889
27983
  throw new Error("Failed to load visualization: '".concat(sKey, "'"));
27890
27984
  });
27891
27985
  }
@@ -28018,7 +28112,6 @@ function create(_ref) {
28018
28112
  {
28019
28113
  console.warn("Visualization ".concat(name, " is not registered. Adding it now.")); // eslint-disable-line no-console
28020
28114
  }
28021
-
28022
28115
  this.register({
28023
28116
  name,
28024
28117
  version
@@ -28029,7 +28122,6 @@ function create(_ref) {
28029
28122
  {
28030
28123
  console.warn("Version ".concat(version, " of ").concat(name, " is not registered. Falling back to version ").concat(versionToUse)); // eslint-disable-line no-console
28031
28124
  }
28032
-
28033
28125
  version = versionToUse;
28034
28126
  }
28035
28127
  return tc[name].get(version) || p.get(typeInfo);
@@ -28168,7 +28260,13 @@ const DEFAULT_CONTEXT = /** @lends Context */{
28168
28260
  /** @type {boolean=} */
28169
28261
  keyboardNavigation: false,
28170
28262
  /** @type {boolean=} */
28171
- disableCellPadding: false
28263
+ disableCellPadding: false,
28264
+ /**
28265
+ * Type used for toggling to the data view (toggleDataView)
28266
+ * This type need to be registered as well
28267
+ * @type {string=}
28268
+ * */
28269
+ dataViewType: 'sn-table'
28172
28270
  };
28173
28271
  DEFAULT_CONFIG.context = DEFAULT_CONTEXT;
28174
28272
 
@@ -28233,7 +28331,7 @@ function nuked() {
28233
28331
  let currentContext = _objectSpread2(_objectSpread2({}, configuration.context), {}, {
28234
28332
  translator: locale.translator
28235
28333
  });
28236
- const [root] = boot({
28334
+ const [root, modelStore] = boot({
28237
28335
  app,
28238
28336
  context: currentContext
28239
28337
  });
@@ -28259,7 +28357,6 @@ function nuked() {
28259
28357
  translator: locale.translator,
28260
28358
  nebbie: null // actual value is set further down
28261
28359
  };
28262
-
28263
28360
  const halo = {
28264
28361
  app,
28265
28362
  root,
@@ -28327,9 +28424,9 @@ function nuked() {
28327
28424
  render: async cfg => {
28328
28425
  await currentThemePromise;
28329
28426
  if (cfg.id) {
28330
- return getObject(cfg, halo);
28427
+ return getObject(cfg, halo, modelStore);
28331
28428
  }
28332
- return createSessionObject(cfg, halo);
28429
+ return createSessionObject(cfg, halo, modelStore);
28333
28430
  },
28334
28431
  /**
28335
28432
  * Creates a visualization model
@@ -28345,7 +28442,7 @@ function nuked() {
28345
28442
  * }
28346
28443
  * );
28347
28444
  */
28348
- create: async cfg => createObject(cfg, halo, false),
28445
+ create: async cfg => createObject(cfg, halo, false, modelStore),
28349
28446
  /**
28350
28447
  * Generates properties for a visualization object
28351
28448
  * @param {CreateConfig} cfg The create configuration.
@@ -28408,7 +28505,6 @@ function nuked() {
28408
28505
  */
28409
28506
  selections: async () => {
28410
28507
  if (!selectionsApi) {
28411
- // const appSelections = await root.getAppSelections(); // Don't expose this for now
28412
28508
  selectionsApi = /** @lends AppSelections# */{
28413
28509
  /**
28414
28510
  * Mounts the app selection UI into the provided HTMLElement.
@@ -28421,7 +28517,6 @@ function nuked() {
28421
28517
  {
28422
28518
  console.error('Already mounted'); // eslint-disable-line no-console
28423
28519
  }
28424
-
28425
28520
  return;
28426
28521
  }
28427
28522
  selectionsComponentReference = mount({