@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.
@@ -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
  */
@@ -9626,11 +9626,11 @@
9626
9626
  prop: 'borderColor',
9627
9627
  themeKey: 'palette'
9628
9628
  });
9629
- var borderRadius = style({
9629
+ var borderRadius$1 = style({
9630
9630
  prop: 'borderRadius',
9631
9631
  themeKey: 'shape'
9632
9632
  });
9633
- var borders = compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderRadius);
9633
+ var borders = compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderRadius$1);
9634
9634
  var borders$1 = borders;
9635
9635
 
9636
9636
  function omit(input, fields) {
@@ -11064,7 +11064,7 @@
11064
11064
  return [appSelections, navState];
11065
11065
  }
11066
11066
 
11067
- const NEBULA_VERSION_HASH = "0577" ;
11067
+ const NEBULA_VERSION_HASH = "0d6f" ;
11068
11068
  let counter = 0;
11069
11069
  const NebulaApp = react.exports.forwardRef((_ref, ref) => {
11070
11070
  let {
@@ -11124,7 +11124,7 @@
11124
11124
  const appRef = React.createRef();
11125
11125
  const element = document.createElement('div');
11126
11126
  element.style.display = 'none';
11127
- element.setAttribute('data-nebulajs-version', "2.8.0" );
11127
+ element.setAttribute('data-nebulajs-version', "2.9.0" );
11128
11128
  element.setAttribute('data-app-id', app.id);
11129
11129
  document.body.appendChild(element);
11130
11130
  ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
@@ -19178,11 +19178,12 @@
19178
19178
  checkboxes = false,
19179
19179
  selectDisabled,
19180
19180
  doc = document,
19181
- isSingleSelect = false
19181
+ isSingleSelect: singleSelect = false
19182
19182
  } = _ref;
19183
19183
  const [instantPages, setInstantPages] = react.exports.useState(pages);
19184
19184
  const [mouseDown, setMouseDown] = react.exports.useState(false);
19185
19185
  const [selectingValues, setSelectingValues] = react.exports.useState(false);
19186
+ const [isSingleSelect, setIsSingleSelect] = react.exports.useState(singleSelect);
19186
19187
  const [selected, setSelected] = react.exports.useState([]);
19187
19188
  const [isRangeSelection, setIsRangeSelection] = react.exports.useState(false);
19188
19189
  const [preSelected, setPreSelected] = react.exports.useState([]);
@@ -19204,6 +19205,7 @@
19204
19205
  isSingleSelect
19205
19206
  });
19206
19207
  setSelectingValues(false);
19208
+ setPreSelected([]);
19207
19209
  }; // Show estimated selection states instantly before applying the selections for real.
19208
19210
 
19209
19211
 
@@ -19234,6 +19236,15 @@
19234
19236
  return p;
19235
19237
  };
19236
19238
 
19239
+ const handleSingleSelectKey = event => {
19240
+ if (event.ctrlKey || event.metaKey) {
19241
+ setIsSingleSelect(true);
19242
+ event.currentTarget.focus(); // will not be focused otherwise
19243
+
19244
+ event.preventDefault();
19245
+ }
19246
+ };
19247
+
19237
19248
  const onClick = react.exports.useCallback(event => {
19238
19249
  if (selectingValues || selectDisabled()) {
19239
19250
  return;
@@ -19241,6 +19252,7 @@
19241
19252
 
19242
19253
  const elemNumber = +event.currentTarget.getAttribute('data-n');
19243
19254
  setPreSelected([elemNumber]);
19255
+ handleSingleSelectKey(event);
19244
19256
  }, [selectingValues, selectDisabled]);
19245
19257
  const onMouseDown = react.exports.useCallback(event => {
19246
19258
  if (selectingValues || selectDisabled()) {
@@ -19251,6 +19263,7 @@
19251
19263
  setMouseDown(true);
19252
19264
  const elemNumber = +event.currentTarget.getAttribute('data-n');
19253
19265
  setPreSelected([elemNumber]);
19266
+ handleSingleSelectKey(event);
19254
19267
  }, [selectingValues, selectDisabled]);
19255
19268
  const onMouseUp = react.exports.useCallback(event => {
19256
19269
  const elemNumber = +event.currentTarget.getAttribute('data-n');
@@ -19267,6 +19280,7 @@
19267
19280
  setMouseDown(false);
19268
19281
  setSelectingValues(false);
19269
19282
  setIsRangeSelection(false);
19283
+ setIsSingleSelect(singleSelect);
19270
19284
  }, []);
19271
19285
  const onMouseEnter = react.exports.useCallback(event => {
19272
19286
  if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
@@ -19352,17 +19366,21 @@
19352
19366
 
19353
19367
  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\")";
19354
19368
 
19369
+ const borderRadius = 2;
19355
19370
  const useStyles$d = makeStyles$1(theme => ({
19356
19371
  cbIcon: {
19357
- borderRadius: 3,
19372
+ borderRadius,
19358
19373
  width: 16,
19359
19374
  height: 16,
19360
19375
  boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
19361
19376
  backgroundColor: '#f5f8fa',
19362
- backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))'
19377
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
19378
+ display: 'flex',
19379
+ alignItems: 'center',
19380
+ justifyContent: 'center'
19363
19381
  },
19364
19382
  cbIconChecked: {
19365
- borderRadius: 3,
19383
+ borderRadius,
19366
19384
  backgroundColor: theme.palette.selected.main,
19367
19385
  backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
19368
19386
  '&:before': {
@@ -19373,6 +19391,18 @@
19373
19391
  content: '""'
19374
19392
  }
19375
19393
  },
19394
+ cbIconExcluded: {
19395
+ borderRadius,
19396
+ width: 12,
19397
+ height: 12,
19398
+ backgroundColor: theme.palette.selected.excluded
19399
+ },
19400
+ cbIconAlternative: {
19401
+ borderRadius,
19402
+ width: 12,
19403
+ height: 12,
19404
+ backgroundColor: theme.palette.selected.alternative
19405
+ },
19376
19406
  checkbox: {
19377
19407
  margin: 0,
19378
19408
  '&:hover': {
@@ -19383,11 +19413,24 @@
19383
19413
  padding: '4px 8px'
19384
19414
  }
19385
19415
  }));
19416
+
19417
+ const getIcon = function (styles) {
19418
+ let excluded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
19419
+ let alternative = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
19420
+ return /*#__PURE__*/React.createElement("span", {
19421
+ className: styles.cbIcon
19422
+ }, (excluded || alternative) && /*#__PURE__*/React.createElement("span", {
19423
+ className: [excluded && styles.cbIconExcluded, alternative && styles.cbIconAlternative].filter(Boolean).join(' ')
19424
+ }));
19425
+ };
19426
+
19386
19427
  function ListboxCheckbox(_ref) {
19387
19428
  let {
19388
19429
  checked,
19389
19430
  label,
19390
- dense
19431
+ dense,
19432
+ excluded,
19433
+ alternative
19391
19434
  } = _ref;
19392
19435
  const styles = useStyles$d();
19393
19436
  return /*#__PURE__*/React.createElement(Checkbox$1, {
@@ -19399,9 +19442,7 @@
19399
19442
  'aria-labelledby': label
19400
19443
  },
19401
19444
  name: label,
19402
- icon: /*#__PURE__*/React.createElement("span", {
19403
- className: styles.cbIcon
19404
- }),
19445
+ icon: getIcon(styles, excluded, alternative),
19405
19446
  checkedIcon: /*#__PURE__*/React.createElement("span", {
19406
19447
  className: styles.cbIconChecked
19407
19448
  })
@@ -19688,6 +19729,24 @@
19688
19729
  const barBorderWidthPx = 1;
19689
19730
  const barWithCheckboxLeftPadEm = 2;
19690
19731
  const frequencyTextNone = '0';
19732
+
19733
+ const getSelectedStyle = _ref => {
19734
+ let {
19735
+ theme
19736
+ } = _ref;
19737
+ return {
19738
+ background: theme.palette.selected.main,
19739
+ color: theme.palette.selected.mainContrastText,
19740
+ '&:focus': {
19741
+ boxShadow: "inset 0 0 0 2px rgba(0, 0, 0, 0.3)",
19742
+ outline: 'none'
19743
+ },
19744
+ '& $cell': {
19745
+ paddingRight: 0
19746
+ }
19747
+ };
19748
+ };
19749
+
19691
19750
  const useStyles$b = makeStyles$1(theme => ({
19692
19751
  row: {
19693
19752
  flexWrap: 'nowrap',
@@ -19714,8 +19773,8 @@
19714
19773
  minWidth: 0,
19715
19774
  flexGrow: 1,
19716
19775
  // Note that this padding is overridden when using checkboxes.
19717
- paddingLeft: '12px',
19718
- paddingRight: '12px'
19776
+ paddingLeft: '9px',
19777
+ paddingRight: '9px'
19719
19778
  },
19720
19779
  // The leaf node, containing the label text.
19721
19780
  labelText: _objectSpread2({
@@ -19742,34 +19801,39 @@
19742
19801
  margin: 0,
19743
19802
  width: '100%',
19744
19803
  height: '100%',
19745
- // For checkboxes the first child is the checkbox container, second is the label container.
19804
+ // The checkbox's span
19805
+ '& > span:nth-child(1)': {
19806
+ paddingRight: '7px'
19807
+ },
19808
+ // The checkbox's label container.
19746
19809
  '& > span:nth-child(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
19747
19810
  display: 'flex',
19748
19811
  alignItems: 'center',
19749
- paddingLeft: '8px'
19812
+ paddingLeft: 0
19750
19813
  })
19751
19814
  },
19752
19815
  // The icons container holding tick and lock, shown inside fields.
19753
19816
  icon: {
19754
19817
  display: 'flex',
19755
- padding: theme.spacing(1)
19756
- },
19757
- // Selection styles (S=Selected, A=Available, X=Excluded).
19758
- S: {
19759
- background: theme.palette.selected.main,
19760
- color: theme.palette.selected.mainContrastText,
19761
- '&:focus': {
19762
- boxShadow: "inset 0 0 0 2px rgba(0, 0, 0, 0.3)",
19763
- outline: 'none'
19764
- }
19818
+ padding: theme.spacing(1, 1, 1, 0)
19765
19819
  },
19820
+ // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
19821
+ S: _objectSpread2({}, getSelectedStyle({
19822
+ theme
19823
+ })),
19824
+ XS: _objectSpread2(_objectSpread2({}, getSelectedStyle({
19825
+ theme
19826
+ })), {}, {
19827
+ background: theme.palette.selected.excluded,
19828
+ color: theme.palette.selected.mainContrastText
19829
+ }),
19766
19830
  A: {
19767
19831
  background: theme.palette.selected.alternative,
19768
19832
  color: theme.palette.selected.alternativeContrastText
19769
19833
  },
19770
19834
  X: {
19771
19835
  background: theme.palette.selected.excluded,
19772
- color: theme.palette.selected.excludedContrastText
19836
+ color: theme.palette.selected.mainContrastText
19773
19837
  },
19774
19838
  frequencyCount: {
19775
19839
  paddingLeft: '8px',
@@ -19805,13 +19869,13 @@
19805
19869
  }
19806
19870
  }));
19807
19871
 
19808
- function RowColumn(_ref) {
19872
+ function RowColumn(_ref2) {
19809
19873
  let {
19810
19874
  index,
19811
19875
  style,
19812
19876
  data,
19813
19877
  column = false
19814
- } = _ref;
19878
+ } = _ref2;
19815
19879
  const {
19816
19880
  onClick,
19817
19881
  onMouseDown,
@@ -19866,7 +19930,9 @@
19866
19930
  const clazzArr = [column ? classes.column : classes.row];
19867
19931
 
19868
19932
  if (!checkboxes) {
19869
- if (cell.qState === 'S' || cell.qState === 'L') {
19933
+ if (cell.qState === 'XS') {
19934
+ clazzArr.push(classes.XS);
19935
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
19870
19936
  clazzArr.push(classes.S);
19871
19937
  } else if (isAlternative(cell)) {
19872
19938
  clazzArr.push(classes.A);
@@ -19880,20 +19946,20 @@
19880
19946
 
19881
19947
  const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
19882
19948
 
19883
- const hasGrayText = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes ? classes.excludedTextWithCheckbox : false;
19949
+ const excludedOrAlternative = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes;
19884
19950
 
19885
- const getValueField = _ref2 => {
19951
+ const getValueField = _ref3 => {
19886
19952
  let {
19887
19953
  lbl,
19888
19954
  ix,
19889
19955
  color,
19890
19956
  highlighted = false
19891
- } = _ref2;
19957
+ } = _ref3;
19892
19958
  return /*#__PURE__*/React.createElement(Typography$1, {
19893
19959
  component: "span",
19894
19960
  variant: "body2",
19895
19961
  key: ix,
19896
- className: joinClassNames([classes.labelText, highlighted && classes.highlighted, dense && classes.labelDense, hasGrayText()]),
19962
+ className: joinClassNames([classes.labelText, highlighted && classes.highlighted, dense && classes.labelDense, excludedOrAlternative() && classes.excludedTextWithCheckbox]),
19897
19963
  color: color
19898
19964
  }, /*#__PURE__*/React.createElement("span", {
19899
19965
  style: {
@@ -19902,16 +19968,27 @@
19902
19968
  }, lbl));
19903
19969
  };
19904
19970
 
19905
- const getCheckboxField = _ref3 => {
19971
+ const preventContextMenu = event => {
19972
+ if (checkboxes) {
19973
+ // Event will not propagate in the checkbox/radiobutton case
19974
+ onClick(event);
19975
+ }
19976
+
19977
+ event.preventDefault();
19978
+ };
19979
+
19980
+ const getCheckboxField = _ref4 => {
19906
19981
  let {
19907
19982
  lbl,
19908
19983
  color,
19909
19984
  qElemNumber
19910
- } = _ref3;
19985
+ } = _ref4;
19911
19986
  const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
19912
19987
  label: lbl,
19913
19988
  checked: isSelected,
19914
- dense: dense
19989
+ dense: dense,
19990
+ excluded: isExcluded(cell),
19991
+ alternative: isAlternative(cell)
19915
19992
  });
19916
19993
  const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
19917
19994
  label: lbl,
@@ -19947,12 +20024,12 @@
19947
20024
  const labels = getSegmentsFromRanges(label, ranges);
19948
20025
  const getField = checkboxes ? getCheckboxField : getValueField;
19949
20026
 
19950
- const getFieldWithRanges = _ref4 => {
20027
+ const getFieldWithRanges = _ref5 => {
19951
20028
  let {
19952
20029
  lbls
19953
- } = _ref4;
19954
- const labelsWithRanges = lbls.map((_ref5, ix) => {
19955
- let [lbl, highlighted] = _ref5;
20030
+ } = _ref5;
20031
+ const labelsWithRanges = lbls.map((_ref6, ix) => {
20032
+ let [lbl, highlighted] = _ref6;
19956
20033
  return getValueField({
19957
20034
  ix,
19958
20035
  highlighted,
@@ -20005,6 +20082,7 @@
20005
20082
  onMouseUp: onMouseUp,
20006
20083
  onMouseEnter: onMouseEnter,
20007
20084
  onKeyDown: handleKeyDownCallback,
20085
+ onContextMenu: preventContextMenu,
20008
20086
  role: column ? 'column' : 'row',
20009
20087
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
20010
20088
  "data-n": cell && cell.qElemNumber
@@ -20016,7 +20094,7 @@
20016
20094
  }), /*#__PURE__*/React.createElement(Grid$1, {
20017
20095
  item: true,
20018
20096
  style: cellStyle,
20019
- className: classes.cell,
20097
+ className: joinClassNames([classes.cell, classes.selectedCell]),
20020
20098
  title: "".concat(label)
20021
20099
  }, ranges.length === 0 ? getField({
20022
20100
  lbl: label,
@@ -20034,7 +20112,7 @@
20034
20112
  noWrap: true,
20035
20113
  color: "inherit",
20036
20114
  variant: "body2",
20037
- className: joinClassNames([dense && classes.labelDense, classes.labelText, hasGrayText()])
20115
+ className: joinClassNames([dense && classes.labelDense, classes.labelText, excludedOrAlternative() && classes.excludedTextWithCheckbox])
20038
20116
  }, getFrequencyText())), (showLock || showTick) && /*#__PURE__*/React.createElement(Grid$1, {
20039
20117
  item: true,
20040
20118
  className: classes.icon
@@ -22636,6 +22714,13 @@
22636
22714
  });
22637
22715
  }
22638
22716
  }
22717
+
22718
+ return () => {
22719
+ if (selections) {
22720
+ selections.off('deactivated');
22721
+ selections.off('activated');
22722
+ }
22723
+ };
22639
22724
  }, [selections]);
22640
22725
  react.exports.useEffect(() => {
22641
22726
  if (selections) {
@@ -24226,7 +24311,8 @@
24226
24311
  item: true
24227
24312
  }, /*#__PURE__*/React.createElement(Typography$1, {
24228
24313
  variant: "h6",
24229
- align: "center"
24314
+ align: "center",
24315
+ "data-tid": "update-active"
24230
24316
  }, translator.get('Object.Update.Active')))), /*#__PURE__*/React.createElement(Grid$1, _extends$a({
24231
24317
  item: true
24232
24318
  }, props), /*#__PURE__*/React.createElement(Button$1, {
@@ -24251,7 +24337,8 @@
24251
24337
  item: true
24252
24338
  }, /*#__PURE__*/React.createElement(Typography$1, {
24253
24339
  variant: "h6",
24254
- align: "center"
24340
+ align: "center",
24341
+ "data-tid": "update-cancelled"
24255
24342
  }, translator.get('Object.Update.Cancelled'))), /*#__PURE__*/React.createElement(Grid$1, {
24256
24343
  item: true
24257
24344
  }, /*#__PURE__*/React.createElement(Button$1, _extends$a({