@nebula.js/stardust 2.8.0 → 2.9.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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.9.0](https://github.com/qlik-oss/nebula.js/compare/v2.8.0...v2.9.0) (2022-04-01)
7
+
8
+ **Note:** Version bump only for package @nebula.js/stardust
9
+
6
10
  # [2.8.0](https://github.com/qlik-oss/nebula.js/compare/v2.7.0...v2.8.0) (2022-03-25)
7
11
 
8
12
  **Note:** Version bump only for package @nebula.js/stardust
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v2.8.0
2
+ * @nebula.js/stardust v2.9.0
3
3
  * Copyright (c) 2022 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -5275,7 +5275,7 @@ function useAppSelections(app) {
5275
5275
  return [appSelections, navState];
5276
5276
  }
5277
5277
 
5278
- const NEBULA_VERSION_HASH = "0577" ;
5278
+ const NEBULA_VERSION_HASH = "0d6f" ;
5279
5279
  let counter = 0;
5280
5280
  const NebulaApp = forwardRef((_ref, ref) => {
5281
5281
  let {
@@ -5335,7 +5335,7 @@ function boot(_ref2) {
5335
5335
  const appRef = React.createRef();
5336
5336
  const element = document.createElement('div');
5337
5337
  element.style.display = 'none';
5338
- element.setAttribute('data-nebulajs-version', "2.8.0" );
5338
+ element.setAttribute('data-nebulajs-version', "2.9.0" );
5339
5339
  element.setAttribute('data-app-id', app.id);
5340
5340
  document.body.appendChild(element);
5341
5341
  ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
@@ -6621,11 +6621,12 @@ function useSelectionsInteractions(_ref) {
6621
6621
  checkboxes = false,
6622
6622
  selectDisabled,
6623
6623
  doc = document,
6624
- isSingleSelect = false
6624
+ isSingleSelect: singleSelect = false
6625
6625
  } = _ref;
6626
6626
  const [instantPages, setInstantPages] = useState$1(pages);
6627
6627
  const [mouseDown, setMouseDown] = useState$1(false);
6628
6628
  const [selectingValues, setSelectingValues] = useState$1(false);
6629
+ const [isSingleSelect, setIsSingleSelect] = useState$1(singleSelect);
6629
6630
  const [selected, setSelected] = useState$1([]);
6630
6631
  const [isRangeSelection, setIsRangeSelection] = useState$1(false);
6631
6632
  const [preSelected, setPreSelected] = useState$1([]);
@@ -6647,6 +6648,7 @@ function useSelectionsInteractions(_ref) {
6647
6648
  isSingleSelect
6648
6649
  });
6649
6650
  setSelectingValues(false);
6651
+ setPreSelected([]);
6650
6652
  }; // Show estimated selection states instantly before applying the selections for real.
6651
6653
 
6652
6654
 
@@ -6677,6 +6679,15 @@ function useSelectionsInteractions(_ref) {
6677
6679
  return p;
6678
6680
  };
6679
6681
 
6682
+ const handleSingleSelectKey = event => {
6683
+ if (event.ctrlKey || event.metaKey) {
6684
+ setIsSingleSelect(true);
6685
+ event.currentTarget.focus(); // will not be focused otherwise
6686
+
6687
+ event.preventDefault();
6688
+ }
6689
+ };
6690
+
6680
6691
  const onClick = useCallback(event => {
6681
6692
  if (selectingValues || selectDisabled()) {
6682
6693
  return;
@@ -6684,6 +6695,7 @@ function useSelectionsInteractions(_ref) {
6684
6695
 
6685
6696
  const elemNumber = +event.currentTarget.getAttribute('data-n');
6686
6697
  setPreSelected([elemNumber]);
6698
+ handleSingleSelectKey(event);
6687
6699
  }, [selectingValues, selectDisabled]);
6688
6700
  const onMouseDown = useCallback(event => {
6689
6701
  if (selectingValues || selectDisabled()) {
@@ -6694,6 +6706,7 @@ function useSelectionsInteractions(_ref) {
6694
6706
  setMouseDown(true);
6695
6707
  const elemNumber = +event.currentTarget.getAttribute('data-n');
6696
6708
  setPreSelected([elemNumber]);
6709
+ handleSingleSelectKey(event);
6697
6710
  }, [selectingValues, selectDisabled]);
6698
6711
  const onMouseUp = useCallback(event => {
6699
6712
  const elemNumber = +event.currentTarget.getAttribute('data-n');
@@ -6710,6 +6723,7 @@ function useSelectionsInteractions(_ref) {
6710
6723
  setMouseDown(false);
6711
6724
  setSelectingValues(false);
6712
6725
  setIsRangeSelection(false);
6726
+ setIsSingleSelect(singleSelect);
6713
6727
  }, []);
6714
6728
  const onMouseEnter = useCallback(event => {
6715
6729
  if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
@@ -6795,17 +6809,21 @@ var Tick = (props => SvgIcon(tick(props)));
6795
6809
 
6796
6810
  const CheckboxChecked = "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath" + " fill-rule='evenodd' clip-rule='evenodd' d='M12 5c-.28 0-.53.11-.71.29L7 9.59l-2.29-2.3a1.003 " + "1.003 0 00-1.42 1.42l3 3c.18.18.43.29.71.29s.53-.11.71-.29l5-5A1.003 1.003 0 0012 5z' fill='%23fff'/%3E%3C/svg%3E\")";
6797
6811
 
6812
+ const borderRadius = 2;
6798
6813
  const useStyles$d = makeStyles(theme => ({
6799
6814
  cbIcon: {
6800
- borderRadius: 3,
6815
+ borderRadius,
6801
6816
  width: 16,
6802
6817
  height: 16,
6803
6818
  boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
6804
6819
  backgroundColor: '#f5f8fa',
6805
- backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))'
6820
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
6821
+ display: 'flex',
6822
+ alignItems: 'center',
6823
+ justifyContent: 'center'
6806
6824
  },
6807
6825
  cbIconChecked: {
6808
- borderRadius: 3,
6826
+ borderRadius,
6809
6827
  backgroundColor: theme.palette.selected.main,
6810
6828
  backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
6811
6829
  '&:before': {
@@ -6816,6 +6834,18 @@ const useStyles$d = makeStyles(theme => ({
6816
6834
  content: '""'
6817
6835
  }
6818
6836
  },
6837
+ cbIconExcluded: {
6838
+ borderRadius,
6839
+ width: 12,
6840
+ height: 12,
6841
+ backgroundColor: theme.palette.selected.excluded
6842
+ },
6843
+ cbIconAlternative: {
6844
+ borderRadius,
6845
+ width: 12,
6846
+ height: 12,
6847
+ backgroundColor: theme.palette.selected.alternative
6848
+ },
6819
6849
  checkbox: {
6820
6850
  margin: 0,
6821
6851
  '&:hover': {
@@ -6826,11 +6856,24 @@ const useStyles$d = makeStyles(theme => ({
6826
6856
  padding: '4px 8px'
6827
6857
  }
6828
6858
  }));
6859
+
6860
+ const getIcon = function (styles) {
6861
+ let excluded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6862
+ let alternative = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6863
+ return /*#__PURE__*/React.createElement("span", {
6864
+ className: styles.cbIcon
6865
+ }, (excluded || alternative) && /*#__PURE__*/React.createElement("span", {
6866
+ className: [excluded && styles.cbIconExcluded, alternative && styles.cbIconAlternative].filter(Boolean).join(' ')
6867
+ }));
6868
+ };
6869
+
6829
6870
  function ListboxCheckbox(_ref) {
6830
6871
  let {
6831
6872
  checked,
6832
6873
  label,
6833
- dense
6874
+ dense,
6875
+ excluded,
6876
+ alternative
6834
6877
  } = _ref;
6835
6878
  const styles = useStyles$d();
6836
6879
  return /*#__PURE__*/React.createElement(Checkbox, {
@@ -6842,9 +6885,7 @@ function ListboxCheckbox(_ref) {
6842
6885
  'aria-labelledby': label
6843
6886
  },
6844
6887
  name: label,
6845
- icon: /*#__PURE__*/React.createElement("span", {
6846
- className: styles.cbIcon
6847
- }),
6888
+ icon: getIcon(styles, excluded, alternative),
6848
6889
  checkedIcon: /*#__PURE__*/React.createElement("span", {
6849
6890
  className: styles.cbIconChecked
6850
6891
  })
@@ -7131,6 +7172,24 @@ const barPadPx = 4;
7131
7172
  const barBorderWidthPx = 1;
7132
7173
  const barWithCheckboxLeftPadEm = 2;
7133
7174
  const frequencyTextNone = '0';
7175
+
7176
+ const getSelectedStyle = _ref => {
7177
+ let {
7178
+ theme
7179
+ } = _ref;
7180
+ return {
7181
+ background: theme.palette.selected.main,
7182
+ color: theme.palette.selected.mainContrastText,
7183
+ '&:focus': {
7184
+ boxShadow: "inset 0 0 0 2px rgba(0, 0, 0, 0.3)",
7185
+ outline: 'none'
7186
+ },
7187
+ '& $cell': {
7188
+ paddingRight: 0
7189
+ }
7190
+ };
7191
+ };
7192
+
7134
7193
  const useStyles$b = makeStyles(theme => ({
7135
7194
  row: {
7136
7195
  flexWrap: 'nowrap',
@@ -7157,8 +7216,8 @@ const useStyles$b = makeStyles(theme => ({
7157
7216
  minWidth: 0,
7158
7217
  flexGrow: 1,
7159
7218
  // Note that this padding is overridden when using checkboxes.
7160
- paddingLeft: '12px',
7161
- paddingRight: '12px'
7219
+ paddingLeft: '9px',
7220
+ paddingRight: '9px'
7162
7221
  },
7163
7222
  // The leaf node, containing the label text.
7164
7223
  labelText: _objectSpread2({
@@ -7185,34 +7244,39 @@ const useStyles$b = makeStyles(theme => ({
7185
7244
  margin: 0,
7186
7245
  width: '100%',
7187
7246
  height: '100%',
7188
- // For checkboxes the first child is the checkbox container, second is the label container.
7247
+ // The checkbox's span
7248
+ '& > span:nth-child(1)': {
7249
+ paddingRight: '7px'
7250
+ },
7251
+ // The checkbox's label container.
7189
7252
  '& > span:nth-child(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
7190
7253
  display: 'flex',
7191
7254
  alignItems: 'center',
7192
- paddingLeft: '8px'
7255
+ paddingLeft: 0
7193
7256
  })
7194
7257
  },
7195
7258
  // The icons container holding tick and lock, shown inside fields.
7196
7259
  icon: {
7197
7260
  display: 'flex',
7198
- padding: theme.spacing(1)
7199
- },
7200
- // Selection styles (S=Selected, A=Available, X=Excluded).
7201
- S: {
7202
- background: theme.palette.selected.main,
7203
- color: theme.palette.selected.mainContrastText,
7204
- '&:focus': {
7205
- boxShadow: "inset 0 0 0 2px rgba(0, 0, 0, 0.3)",
7206
- outline: 'none'
7207
- }
7261
+ padding: theme.spacing(1, 1, 1, 0)
7208
7262
  },
7263
+ // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
7264
+ S: _objectSpread2({}, getSelectedStyle({
7265
+ theme
7266
+ })),
7267
+ XS: _objectSpread2(_objectSpread2({}, getSelectedStyle({
7268
+ theme
7269
+ })), {}, {
7270
+ background: theme.palette.selected.excluded,
7271
+ color: theme.palette.selected.mainContrastText
7272
+ }),
7209
7273
  A: {
7210
7274
  background: theme.palette.selected.alternative,
7211
7275
  color: theme.palette.selected.alternativeContrastText
7212
7276
  },
7213
7277
  X: {
7214
7278
  background: theme.palette.selected.excluded,
7215
- color: theme.palette.selected.excludedContrastText
7279
+ color: theme.palette.selected.mainContrastText
7216
7280
  },
7217
7281
  frequencyCount: {
7218
7282
  paddingLeft: '8px',
@@ -7248,13 +7312,13 @@ const useStyles$b = makeStyles(theme => ({
7248
7312
  }
7249
7313
  }));
7250
7314
 
7251
- function RowColumn(_ref) {
7315
+ function RowColumn(_ref2) {
7252
7316
  let {
7253
7317
  index,
7254
7318
  style,
7255
7319
  data,
7256
7320
  column = false
7257
- } = _ref;
7321
+ } = _ref2;
7258
7322
  const {
7259
7323
  onClick,
7260
7324
  onMouseDown,
@@ -7309,7 +7373,9 @@ function RowColumn(_ref) {
7309
7373
  const clazzArr = [column ? classes.column : classes.row];
7310
7374
 
7311
7375
  if (!checkboxes) {
7312
- if (cell.qState === 'S' || cell.qState === 'L') {
7376
+ if (cell.qState === 'XS') {
7377
+ clazzArr.push(classes.XS);
7378
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
7313
7379
  clazzArr.push(classes.S);
7314
7380
  } else if (isAlternative(cell)) {
7315
7381
  clazzArr.push(classes.A);
@@ -7323,20 +7389,20 @@ function RowColumn(_ref) {
7323
7389
 
7324
7390
  const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
7325
7391
 
7326
- const hasGrayText = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes ? classes.excludedTextWithCheckbox : false;
7392
+ const excludedOrAlternative = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes;
7327
7393
 
7328
- const getValueField = _ref2 => {
7394
+ const getValueField = _ref3 => {
7329
7395
  let {
7330
7396
  lbl,
7331
7397
  ix,
7332
7398
  color,
7333
7399
  highlighted = false
7334
- } = _ref2;
7400
+ } = _ref3;
7335
7401
  return /*#__PURE__*/React.createElement(Typography, {
7336
7402
  component: "span",
7337
7403
  variant: "body2",
7338
7404
  key: ix,
7339
- className: joinClassNames([classes.labelText, highlighted && classes.highlighted, dense && classes.labelDense, hasGrayText()]),
7405
+ className: joinClassNames([classes.labelText, highlighted && classes.highlighted, dense && classes.labelDense, excludedOrAlternative() && classes.excludedTextWithCheckbox]),
7340
7406
  color: color
7341
7407
  }, /*#__PURE__*/React.createElement("span", {
7342
7408
  style: {
@@ -7345,16 +7411,27 @@ function RowColumn(_ref) {
7345
7411
  }, lbl));
7346
7412
  };
7347
7413
 
7348
- const getCheckboxField = _ref3 => {
7414
+ const preventContextMenu = event => {
7415
+ if (checkboxes) {
7416
+ // Event will not propagate in the checkbox/radiobutton case
7417
+ onClick(event);
7418
+ }
7419
+
7420
+ event.preventDefault();
7421
+ };
7422
+
7423
+ const getCheckboxField = _ref4 => {
7349
7424
  let {
7350
7425
  lbl,
7351
7426
  color,
7352
7427
  qElemNumber
7353
- } = _ref3;
7428
+ } = _ref4;
7354
7429
  const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
7355
7430
  label: lbl,
7356
7431
  checked: isSelected,
7357
- dense: dense
7432
+ dense: dense,
7433
+ excluded: isExcluded(cell),
7434
+ alternative: isAlternative(cell)
7358
7435
  });
7359
7436
  const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
7360
7437
  label: lbl,
@@ -7390,12 +7467,12 @@ function RowColumn(_ref) {
7390
7467
  const labels = getSegmentsFromRanges(label, ranges);
7391
7468
  const getField = checkboxes ? getCheckboxField : getValueField;
7392
7469
 
7393
- const getFieldWithRanges = _ref4 => {
7470
+ const getFieldWithRanges = _ref5 => {
7394
7471
  let {
7395
7472
  lbls
7396
- } = _ref4;
7397
- const labelsWithRanges = lbls.map((_ref5, ix) => {
7398
- let [lbl, highlighted] = _ref5;
7473
+ } = _ref5;
7474
+ const labelsWithRanges = lbls.map((_ref6, ix) => {
7475
+ let [lbl, highlighted] = _ref6;
7399
7476
  return getValueField({
7400
7477
  ix,
7401
7478
  highlighted,
@@ -7448,6 +7525,7 @@ function RowColumn(_ref) {
7448
7525
  onMouseUp: onMouseUp,
7449
7526
  onMouseEnter: onMouseEnter,
7450
7527
  onKeyDown: handleKeyDownCallback,
7528
+ onContextMenu: preventContextMenu,
7451
7529
  role: column ? 'column' : 'row',
7452
7530
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
7453
7531
  "data-n": cell && cell.qElemNumber
@@ -7459,7 +7537,7 @@ function RowColumn(_ref) {
7459
7537
  }), /*#__PURE__*/React.createElement(Grid, {
7460
7538
  item: true,
7461
7539
  style: cellStyle,
7462
- className: classes.cell,
7540
+ className: joinClassNames([classes.cell, classes.selectedCell]),
7463
7541
  title: "".concat(label)
7464
7542
  }, ranges.length === 0 ? getField({
7465
7543
  lbl: label,
@@ -7477,7 +7555,7 @@ function RowColumn(_ref) {
7477
7555
  noWrap: true,
7478
7556
  color: "inherit",
7479
7557
  variant: "body2",
7480
- className: joinClassNames([dense && classes.labelDense, classes.labelText, hasGrayText()])
7558
+ className: joinClassNames([dense && classes.labelDense, classes.labelText, excludedOrAlternative() && classes.excludedTextWithCheckbox])
7481
7559
  }, getFrequencyText())), (showLock || showTick) && /*#__PURE__*/React.createElement(Grid, {
7482
7560
  item: true,
7483
7561
  className: classes.icon
@@ -10079,6 +10157,13 @@ function ListBoxInline(_ref) {
10079
10157
  });
10080
10158
  }
10081
10159
  }
10160
+
10161
+ return () => {
10162
+ if (selections) {
10163
+ selections.off('deactivated');
10164
+ selections.off('activated');
10165
+ }
10166
+ };
10082
10167
  }, [selections]);
10083
10168
  useEffect$1(() => {
10084
10169
  if (selections) {
@@ -11669,7 +11754,8 @@ function Cancel(_ref) {
11669
11754
  item: true
11670
11755
  }, /*#__PURE__*/React.createElement(Typography, {
11671
11756
  variant: "h6",
11672
- align: "center"
11757
+ align: "center",
11758
+ "data-tid": "update-active"
11673
11759
  }, translator.get('Object.Update.Active')))), /*#__PURE__*/React.createElement(Grid, _extends$4({
11674
11760
  item: true
11675
11761
  }, props), /*#__PURE__*/React.createElement(Button, {
@@ -11694,7 +11780,8 @@ function Retry(_ref2) {
11694
11780
  item: true
11695
11781
  }, /*#__PURE__*/React.createElement(Typography, {
11696
11782
  variant: "h6",
11697
- align: "center"
11783
+ align: "center",
11784
+ "data-tid": "update-cancelled"
11698
11785
  }, translator.get('Object.Update.Cancelled'))), /*#__PURE__*/React.createElement(Grid, {
11699
11786
  item: true
11700
11787
  }, /*#__PURE__*/React.createElement(Button, _extends$4({