@nebula.js/stardust 4.2.0 → 4.2.1

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 v4.2.0
2
+ * @nebula.js/stardust v4.2.1
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -8373,7 +8373,7 @@ function create$3(definition) {
8373
8373
  return cache[key];
8374
8374
  }
8375
8375
 
8376
- const NEBULA_VERSION_HASH = "28e4" ;
8376
+ const NEBULA_VERSION_HASH = "65bf" ;
8377
8377
  ClassNameGenerator$1.configure(componentName => {
8378
8378
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8379
8379
  });
@@ -8620,7 +8620,7 @@ function boot(_ref2) {
8620
8620
  const appRef = React__default.createRef();
8621
8621
  const element = document.createElement('div');
8622
8622
  element.style.display = 'none';
8623
- element.setAttribute('data-nebulajs-version', "4.2.0" );
8623
+ element.setAttribute('data-nebulajs-version', "4.2.1" );
8624
8624
  element.setAttribute('data-app-id', app.id);
8625
8625
  document.body.appendChild(element);
8626
8626
  if (context) {
@@ -9813,7 +9813,6 @@ const BUTTON_ICON_WIDTH = ICON_WIDTH + (ICON_PADDING + 1) * 2; // 1 is border wi
9813
9813
  const REMOVE_TICK_LIMIT = 80; // an item width equal to or less than this, will hide the select tick
9814
9814
  const SCROLL_BAR_WIDTH = 10; // TODO: ignore this - instead set the styling only show on hover...
9815
9815
  const ITEM_MAX_WIDTH = 150;
9816
- const FREQUENCY_WIDTH = 40;
9817
9816
  const ITEM_MIN_WIDTH = 56;
9818
9817
  const CHECKBOX_WIDTH = 20;
9819
9818
  const frequencyTextNone = '-';
@@ -9835,10 +9834,39 @@ const getBarWidth = _ref => {
9835
9834
  };
9836
9835
  const getFrequencyText = qFrequency => qFrequency || frequencyTextNone;
9837
9836
 
9838
- const getSelectedStyle = _ref => {
9837
+ const getFreqFlexBasis = _ref => {
9839
9838
  let {
9840
- theme
9839
+ sizes,
9840
+ frequencyMode,
9841
+ isGridMode,
9842
+ freqHitsValue
9841
9843
  } = _ref;
9844
+ if (frequencyMode === 'P') {
9845
+ return "".concat(sizes.freqMinWidth, "px");
9846
+ }
9847
+ const flexBasis = isGridMode && !freqHitsValue ? 'max-content' : '25%';
9848
+ return flexBasis;
9849
+ };
9850
+ const getMaxFreqWidth = _ref2 => {
9851
+ let {
9852
+ sizes,
9853
+ frequencyMode,
9854
+ isGridMode
9855
+ } = _ref2;
9856
+ if (isGridMode) {
9857
+ // This makes the neighbouring value stretch farther than when using a fixed freuency width.
9858
+ return 'max-content';
9859
+ }
9860
+ if (frequencyMode === 'P') {
9861
+ return sizes.freqMinWidth; // because it will never grow beyond "100.0%"
9862
+ }
9863
+
9864
+ return sizes.freqMaxWidth;
9865
+ };
9866
+ const getSelectedStyle = _ref3 => {
9867
+ let {
9868
+ theme
9869
+ } = _ref3;
9842
9870
  return {
9843
9871
  background: theme.palette.selected.main,
9844
9872
  color: theme.palette.selected.mainContrastText,
@@ -9860,18 +9888,20 @@ const ellipsis = {
9860
9888
  const iconWidth = 24; // tick and lock icon width in px
9861
9889
 
9862
9890
  const RowColRoot = styled$1('div', {
9863
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth', 'direction'].includes(prop)
9864
- })(_ref2 => {
9891
+ shouldForwardProp: prop => !['checkboxes', 'isGridMode', 'isGridCol', 'dense', 'direction', 'sizes', 'frequencyMode', 'freqHitsValue'].includes(prop)
9892
+ })(_ref4 => {
9865
9893
  var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
9866
9894
  let {
9867
9895
  theme,
9868
- flexBasisProp,
9896
+ checkboxes,
9869
9897
  isGridMode,
9870
9898
  isGridCol,
9871
9899
  dense,
9872
- frequencyWidth,
9873
- direction
9874
- } = _ref2;
9900
+ direction,
9901
+ sizes,
9902
+ frequencyMode,
9903
+ freqHitsValue
9904
+ } = _ref4;
9875
9905
  return {
9876
9906
  '&:focus': {
9877
9907
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
@@ -9904,15 +9934,16 @@ const RowColRoot = styled$1('div', {
9904
9934
  ["& .".concat(rowColClasses.cell)]: {
9905
9935
  display: 'flex',
9906
9936
  alignItems: 'center',
9907
- minWidth: 0,
9908
9937
  flexGrow: 1,
9938
+ minWidth: checkboxes ? '52px' : '26px',
9939
+ // these numbers are just enough to show one letter and ellipsis: A…
9940
+ flexBasis: checkboxes ? 'auto' : 'max-content',
9909
9941
  // Note that this padding is overridden when using checkboxes.
9910
9942
  paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
9911
9943
  paddingRight: 0
9912
9944
  },
9913
9945
  // The leaf node, containing the label text.
9914
9946
  ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
9915
- flexBasis: flexBasisProp,
9916
9947
  lineHeight: '16px',
9917
9948
  userSelect: 'none',
9918
9949
  paddingRight: '1px'
@@ -9980,9 +10011,22 @@ const RowColRoot = styled$1('div', {
9980
10011
  ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
9981
10012
  justifyContent: 'flex-end'
9982
10013
  }, ellipsis), {}, {
9983
- flex: "0 1 ".concat(frequencyWidth, "px"),
10014
+ flex: "0 0 ".concat(getFreqFlexBasis({
10015
+ sizes,
10016
+ frequencyMode,
10017
+ isGridMode,
10018
+ freqHitsValue
10019
+ })),
10020
+ minWidth: !isGridMode && frequencyMode !== 'P' && freqHitsValue ? sizes.freqMinWidth : 'max-content',
10021
+ maxWidth: getMaxFreqWidth({
10022
+ sizes,
10023
+ frequencyMode,
10024
+ isGridMode
10025
+ }),
9984
10026
  textAlign: direction === 'rtl' ? 'left' : 'right',
9985
- paddingLeft: '2px'
10027
+ // In RTL, we already get the 8px from the value element's padding and for
10028
+ // percent mode we have already adapted the width (fixed width) to the max number.
10029
+ paddingLeft: direction !== 'rtl' ? '8px' : 0
9986
10030
  }),
9987
10031
  ["&.".concat(rowColClasses.barContainer)]: {
9988
10032
  height: '100%',
@@ -10828,6 +10872,32 @@ function getRowsKeyboardNavigation(_ref) {
10828
10872
  return handleKeyDown;
10829
10873
  }
10830
10874
 
10875
+ function getValueTextAlign(_ref) {
10876
+ let {
10877
+ direction,
10878
+ cell,
10879
+ textAlign
10880
+ } = _ref;
10881
+ const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
10882
+ let valueTextAlign;
10883
+ const isAutoTextAlign = !textAlign || textAlign.auto;
10884
+ const dirToTextAlignMap = {
10885
+ rtl: 'right',
10886
+ ltr: 'left'
10887
+ };
10888
+ if (isAutoTextAlign) {
10889
+ if (!isNumeric) {
10890
+ valueTextAlign = dirToTextAlignMap[direction];
10891
+ } else {
10892
+ valueTextAlign = direction === 'rtl' ? 'left' : 'right';
10893
+ }
10894
+ } else {
10895
+ valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
10896
+ }
10897
+ const ALLOWED_OPTIONS = ['left', 'center', 'right'];
10898
+ return ALLOWED_OPTIONS.includes(valueTextAlign) ? valueTextAlign : 'left';
10899
+ }
10900
+
10831
10901
  function RowColumn(_ref) {
10832
10902
  var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
10833
10903
  let {
@@ -10863,10 +10933,10 @@ function RowColumn(_ref) {
10863
10933
  columnCount = 1,
10864
10934
  rowCount = 1,
10865
10935
  dataOffset,
10936
+ deducedFrequencyMode,
10866
10937
  focusListItems,
10867
10938
  listCount,
10868
- itemPadding,
10869
- frequencyWidth,
10939
+ sizes,
10870
10940
  translator,
10871
10941
  showSearch,
10872
10942
  isModal
@@ -10876,6 +10946,9 @@ function RowColumn(_ref) {
10876
10946
  dataLayout = 'singleColumn',
10877
10947
  layoutOrder
10878
10948
  } = layoutOptions;
10949
+ const {
10950
+ itemPadding
10951
+ } = sizes;
10879
10952
  let cellIndex;
10880
10953
  let styles;
10881
10954
  const count = {
@@ -10943,26 +11016,15 @@ function RowColumn(_ref) {
10943
11016
  const preventContextMenu = useCallback(event => {
10944
11017
  event.preventDefault();
10945
11018
  }, [checkboxes]);
11019
+ const valueTextAlign = useMemo$1(() => cell && getValueTextAlign({
11020
+ direction,
11021
+ cell,
11022
+ textAlign
11023
+ }), [direction, cell, textAlign]);
10946
11024
  if (!cell) {
10947
11025
  return null; // prevent rendering empty rows
10948
11026
  }
10949
11027
 
10950
- const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
10951
- let valueTextAlign;
10952
- const isAutoTextAlign = !textAlign || textAlign.auto;
10953
- const dirToTextAlignMap = {
10954
- rtl: 'right',
10955
- ltr: 'left'
10956
- };
10957
- if (isAutoTextAlign) {
10958
- if (!isNumeric) {
10959
- valueTextAlign = dirToTextAlignMap[direction];
10960
- } else {
10961
- valueTextAlign = direction === 'rtl' ? 'left' : 'right';
10962
- }
10963
- } else {
10964
- valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
10965
- }
10966
11028
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
10967
11029
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
10968
11030
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
@@ -10977,17 +11039,16 @@ function RowColumn(_ref) {
10977
11039
  display: 'flex',
10978
11040
  fontSize: '8px'
10979
11041
  };
11042
+ const isRtl = direction === 'rtl';
10980
11043
  const cellStyle = {
10981
11044
  display: 'flex',
10982
11045
  alignItems: 'center',
10983
- minWidth: 0,
10984
11046
  flexGrow: 1,
10985
- paddingLeft: direction === 'rtl' ? 8 : checkboxes ? 0 : undefined,
10986
- paddingRight: checkboxes ? 0 : direction === 'rtl' ? 8 : 0,
11047
+ paddingLeft: isRtl ? 8 : checkboxes ? 0 : undefined,
11048
+ paddingRight: checkboxes ? 0 : isRtl ? 8 : 0,
10987
11049
  justifyContent: valueTextAlign
10988
11050
  };
10989
11051
  const isFirstElement = index === 0;
10990
- const flexBasisVal = checkboxes ? 'auto' : 'max-content';
10991
11052
  const showLock = isSelected && isLocked;
10992
11053
  const showTick = !checkboxes && isSelected && !isLocked;
10993
11054
  const showIcon = !checkboxes && sizePermitsTickOrLock;
@@ -11000,15 +11061,18 @@ function RowColumn(_ref) {
11000
11061
  maxIndex: count.max,
11001
11062
  showSearch
11002
11063
  });
11064
+ const freqHitsValue = !isRtl && valueTextAlign === 'right' || isRtl && valueTextAlign === 'left';
11003
11065
  return /*#__PURE__*/React__default.createElement(RowColRoot$1, {
11004
11066
  className: rowColClasses.barContainer,
11005
- flexBasisProp: flexBasisVal,
11067
+ checkboxes: checkboxes,
11006
11068
  style: styles,
11007
11069
  isGridCol: isGridCol,
11008
11070
  isGridMode: dataLayout === 'grid',
11009
11071
  dense: dense,
11010
- frequencyWidth: frequencyWidth,
11011
11072
  direction: direction,
11073
+ sizes: sizes,
11074
+ frequencyMode: deducedFrequencyMode,
11075
+ freqHitsValue: freqHitsValue,
11012
11076
  "data-testid": "listbox.item"
11013
11077
  }, /*#__PURE__*/React__default.createElement(ItemGrid, {
11014
11078
  role: "row",
@@ -12632,7 +12696,7 @@ function getListBoxComponents(_ref) {
12632
12696
  pages,
12633
12697
  selectDisabled,
12634
12698
  interactionEvents,
12635
- frequencyMode,
12699
+ deducedFrequencyMode,
12636
12700
  histogram,
12637
12701
  isSingleSelect,
12638
12702
  select,
@@ -12662,12 +12726,10 @@ function getListBoxComponents(_ref) {
12662
12726
  } = layout || {};
12663
12727
  const {
12664
12728
  columnWidth,
12665
- itemPadding,
12666
12729
  listHeight,
12667
12730
  itemHeight,
12668
12731
  rowCount,
12669
- columnCount,
12670
- frequencyWidth
12732
+ columnCount
12671
12733
  } = sizes || {};
12672
12734
  const itemWidth = layoutOptions.dataLayout === 'grid' ? columnWidth : width;
12673
12735
  const showTick = itemWidth > REMOVE_TICK_LIMIT;
@@ -12688,12 +12750,11 @@ function getListBoxComponents(_ref) {
12688
12750
  }, isLocked || selectDisabled() ? {} : interactionEvents), {}, {
12689
12751
  checkboxes,
12690
12752
  layoutOptions,
12691
- frequencyMode,
12753
+ deducedFrequencyMode,
12692
12754
  freqIsAllowed,
12693
12755
  isSingleSelect,
12694
12756
  textAlign,
12695
- itemPadding,
12696
- frequencyWidth,
12757
+ sizes,
12697
12758
  actions: {
12698
12759
  select,
12699
12760
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -12878,16 +12939,46 @@ function calculateRowMode(_ref) {
12878
12939
  };
12879
12940
  }
12880
12941
 
12881
- function getListSizes(_ref) {
12942
+ const getContext = () => {
12943
+ const fragment = document.createDocumentFragment();
12944
+ const canvas = document.createElement('canvas');
12945
+ fragment.appendChild(canvas);
12946
+ return canvas.getContext('2d');
12947
+ };
12948
+ const getTextWidth = (currentText, font) => {
12949
+ const context = getContext();
12950
+ context.font = font;
12951
+ if (Array.isArray(currentText)) {
12952
+ return Math.max(...currentText.map(t => context.measureText(t).width));
12953
+ }
12954
+ const metrics = context.measureText(currentText);
12955
+ return Math.ceil(metrics.width || 0);
12956
+ };
12957
+ const useTextWidth = options => {
12958
+ const textOptions = useMemo$1(() => 'text' in options ? options : {}, [options]);
12959
+ return useMemo$1(() => getTextWidth(textOptions.text, textOptions.font || '12px Source Sans Pro'), [textOptions.text, textOptions.font]);
12960
+ };
12961
+
12962
+ function getMeasureText(layoutOrNumber) {
12963
+ if (!layoutOrNumber) {
12964
+ return '';
12965
+ }
12966
+ const maxGlyphCount = typeof layoutOrNumber === 'number' ? layoutOrNumber : layoutOrNumber.qListObject.qDimensionInfo.qApprMaxGlyphCount;
12967
+ const measureString = Array(maxGlyphCount).fill('M').join('');
12968
+ return measureString;
12969
+ }
12970
+
12971
+ function useListSizes(_ref) {
12972
+ var _theme$listBox;
12882
12973
  let {
12883
12974
  layout,
12884
12975
  width,
12885
12976
  height,
12886
12977
  listCount,
12887
12978
  count,
12888
- textWidth,
12889
12979
  freqIsAllowed,
12890
- checkboxes
12980
+ checkboxes,
12981
+ theme
12891
12982
  } = _ref;
12892
12983
  const {
12893
12984
  layoutOptions = {}
@@ -12899,7 +12990,24 @@ function getListSizes(_ref) {
12899
12990
  dense,
12900
12991
  dataLayout
12901
12992
  } = layoutOptions;
12902
- const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
12993
+ const {
12994
+ fontSize = '12px',
12995
+ fontFamily = 'Source sans pro'
12996
+ } = ((_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
12997
+ const font = "".concat(fontSize, " ").concat(fontFamily); // font format as supported by HTML canvas
12998
+ const textWidth = useTextWidth({
12999
+ text: getMeasureText(layout),
13000
+ font
13001
+ });
13002
+ const freqMinWidth = useTextWidth({
13003
+ text: getMeasureText(5),
13004
+ font
13005
+ });
13006
+ const freqMaxWidth = useTextWidth({
13007
+ text: getMeasureText(8),
13008
+ font
13009
+ });
13010
+ const frequencyAddWidth = freqIsAllowed ? freqMinWidth : 0;
12903
13011
  const checkboxAddWidth = checkboxes ? CHECKBOX_WIDTH : 0;
12904
13012
  const tickIconWidth = CHECKBOX_WIDTH;
12905
13013
  let dynamicItemMinWidth = ITEM_MIN_WIDTH + frequencyAddWidth + checkboxAddWidth;
@@ -12980,6 +13088,7 @@ function getListSizes(_ref) {
12980
13088
  overflowStyling,
12981
13089
  itemHeight,
12982
13090
  listHeight,
13091
+ listWidth: width,
12983
13092
  scrollBarWidth: SCROLL_BAR_WIDTH,
12984
13093
  count,
12985
13094
  listCount: limitedListCount,
@@ -12988,42 +13097,12 @@ function getListSizes(_ref) {
12988
13097
  column: maxColumnCount
12989
13098
  },
12990
13099
  itemPadding,
12991
- frequencyWidth: FREQUENCY_WIDTH
13100
+ textWidth,
13101
+ freqMinWidth,
13102
+ freqMaxWidth
12992
13103
  };
12993
13104
  }
12994
13105
 
12995
- const getContext = () => {
12996
- const fragment = document.createDocumentFragment();
12997
- const canvas = document.createElement('canvas');
12998
- fragment.appendChild(canvas);
12999
- return canvas.getContext('2d');
13000
- };
13001
- const getTextWidth = (currentText, font) => {
13002
- const context = getContext();
13003
- context.font = font;
13004
- if (Array.isArray(currentText)) {
13005
- return Math.max(...currentText.map(t => context.measureText(t).width));
13006
- }
13007
- const metrics = context.measureText(currentText);
13008
- return metrics.width;
13009
- };
13010
- const useTextWidth = options => {
13011
- const textOptions = useMemo$1(() => 'text' in options ? options : {}, [options]);
13012
- return useMemo$1(() => getTextWidth(textOptions.text, textOptions.font || '14px Source Sans Pro'), [textOptions.text, textOptions.font]);
13013
- };
13014
-
13015
- function getMeasureText(layout) {
13016
- if (!layout) {
13017
- return '';
13018
- }
13019
- const maxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
13020
- let measureString = '';
13021
- for (let i = 0; i < maxGlyphCount; i++) {
13022
- measureString += 'M';
13023
- }
13024
- return measureString;
13025
- }
13026
-
13027
13106
  function getHorizontalMinBatchSize(_ref) {
13028
13107
  let {
13029
13108
  width,
@@ -13503,7 +13582,7 @@ function getFrequencyAllowed(_ref) {
13503
13582
  const {
13504
13583
  frequencyEnabled = false
13505
13584
  } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
13506
- const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
13585
+ const hasValidFreqOption = !['N', undefined].includes(frequencyMode);
13507
13586
  return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
13508
13587
  }
13509
13588
 
@@ -13550,6 +13629,21 @@ const useFrequencyMax = (app, layout) => {
13550
13629
  };
13551
13630
  };
13552
13631
 
13632
+ function deduceFrequencyMode(pages) {
13633
+ const hasPercentSign = pages.some(_ref => {
13634
+ let {
13635
+ qMatrix
13636
+ } = _ref;
13637
+ return qMatrix.some(_ref2 => {
13638
+ var _item$qFrequency;
13639
+ let [item] = _ref2;
13640
+ return !!((_item$qFrequency = item.qFrequency) !== null && _item$qFrequency !== void 0 && _item$qFrequency.match('%'));
13641
+ });
13642
+ });
13643
+ const OTHER = '-'; // treat all other as '-' (change later if we need to identify other modes)
13644
+ return hasPercentSign ? 'P' : OTHER;
13645
+ }
13646
+
13553
13647
  const _excluded$4 = ["isLoadingData"];
13554
13648
  const DEFAULT_MIN_BATCH_SIZE = 100;
13555
13649
  const StyledWrapper = styled$4('div')(() => ({
@@ -13566,6 +13660,7 @@ function ListBox(_ref) {
13566
13660
  model,
13567
13661
  app,
13568
13662
  constraints,
13663
+ theme,
13569
13664
  layout,
13570
13665
  selections,
13571
13666
  selectionState,
@@ -13721,10 +13816,6 @@ function ListBox(_ref) {
13721
13816
  useEffect$1(() => {
13722
13817
  fetchData();
13723
13818
  }, [layout, local.current.dataOffset]);
13724
- const textWidth = useTextWidth({
13725
- text: getMeasureText(layout),
13726
- font: '14px Source sans pro'
13727
- });
13728
13819
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
13729
13820
  const isVertical = layoutOptions.dataLayout !== 'grid';
13730
13821
  const count = layout === null || layout === void 0 ? void 0 : (_layout$qListObject$q = layout.qListObject.qSize) === null || _layout$qListObject$q === void 0 ? void 0 : _layout$qListObject$q.qcy;
@@ -13741,15 +13832,16 @@ function ListBox(_ref) {
13741
13832
  layout,
13742
13833
  frequencyMode
13743
13834
  });
13744
- const sizes = getListSizes({
13835
+ const deducedFrequencyMode = deduceFrequencyMode(pages);
13836
+ const sizes = useListSizes({
13745
13837
  layout,
13746
13838
  width,
13747
13839
  height,
13748
13840
  listCount: unlimitedListCount,
13749
13841
  count,
13750
- textWidth,
13751
13842
  freqIsAllowed,
13752
- checkboxes
13843
+ checkboxes,
13844
+ theme
13753
13845
  });
13754
13846
  if (sizes.columnWidth) {
13755
13847
  // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
@@ -13826,7 +13918,7 @@ function ListBox(_ref) {
13826
13918
  height,
13827
13919
  width,
13828
13920
  checkboxes,
13829
- frequencyMode,
13921
+ deducedFrequencyMode,
13830
13922
  histogram,
13831
13923
  keyboard,
13832
13924
  showGray,
@@ -16113,21 +16205,6 @@ function mount(_ref2) {
16113
16205
  }), element, uid());
16114
16206
  }
16115
16207
 
16116
- var $parcel$global =
16117
- typeof globalThis !== 'undefined'
16118
- ? globalThis
16119
- : typeof self !== 'undefined'
16120
- ? self
16121
- : typeof window !== 'undefined'
16122
- ? window
16123
- : typeof global !== 'undefined'
16124
- ? global
16125
- : {};
16126
- function $parcel$export(e, n, v, s) {
16127
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16128
- }
16129
-
16130
- var $3e40d2fd7fdb47d2$exports = {};
16131
16208
  /**
16132
16209
  * Detect Element Resize.
16133
16210
  * https://github.com/sdecima/javascript-detect-element-resize
@@ -16138,346 +16215,371 @@ var $3e40d2fd7fdb47d2$exports = {};
16138
16215
  * 2) Defer initialization code via a top-level function wrapper (to support SSR).
16139
16216
  * 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
16140
16217
  * 4) Add nonce for style element.
16141
- **/ // Check `document` and `window` in case of server-side rendering
16142
- let $3e40d2fd7fdb47d2$var$windowObject;
16143
- if (typeof window !== "undefined") $3e40d2fd7fdb47d2$var$windowObject = window;
16144
- else if (typeof self !== "undefined") // eslint-disable-next-line no-restricted-globals
16145
- $3e40d2fd7fdb47d2$var$windowObject = self;
16146
- else $3e40d2fd7fdb47d2$var$windowObject = $parcel$global;
16147
- let $3e40d2fd7fdb47d2$var$cancelFrame = null;
16148
- let $3e40d2fd7fdb47d2$var$requestFrame = null;
16149
- const $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION = 20;
16150
- const $3e40d2fd7fdb47d2$var$clearTimeoutFn = $3e40d2fd7fdb47d2$var$windowObject.clearTimeout;
16151
- const $3e40d2fd7fdb47d2$var$setTimeoutFn = $3e40d2fd7fdb47d2$var$windowObject.setTimeout;
16152
- const $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn = $3e40d2fd7fdb47d2$var$windowObject.cancelAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.mozCancelAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.webkitCancelAnimationFrame;
16153
- const $3e40d2fd7fdb47d2$var$requestAnimationFrameFn = $3e40d2fd7fdb47d2$var$windowObject.requestAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.mozRequestAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.webkitRequestAnimationFrame;
16154
- if ($3e40d2fd7fdb47d2$var$cancelAnimationFrameFn == null || $3e40d2fd7fdb47d2$var$requestAnimationFrameFn == null) {
16155
- // For environments that don't support animation frame,
16156
- // fallback to a setTimeout based approach.
16157
- $3e40d2fd7fdb47d2$var$cancelFrame = $3e40d2fd7fdb47d2$var$clearTimeoutFn;
16158
- $3e40d2fd7fdb47d2$var$requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
16159
- return $3e40d2fd7fdb47d2$var$setTimeoutFn(callback, $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION);
16160
- };
16218
+ * 5) Use 'export' statement over 'module.exports' assignment
16219
+ **/
16220
+
16221
+ // Check `document` and `window` in case of server-side rendering
16222
+ let windowObject;
16223
+ if (typeof window !== "undefined") {
16224
+ windowObject = window;
16225
+
16226
+ // eslint-disable-next-line no-restricted-globals
16227
+ } else if (typeof self !== "undefined") {
16228
+ // eslint-disable-next-line no-restricted-globals
16229
+ windowObject = self;
16161
16230
  } else {
16162
- // Counter intuitively, environments that support animation frames can be trickier.
16163
- // Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
16164
- // In this case, we should fallback to a setTimeout() implementation.
16165
- $3e40d2fd7fdb47d2$var$cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
16166
- $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn(animationFrameID);
16167
- $3e40d2fd7fdb47d2$var$clearTimeoutFn(timeoutID);
16168
- };
16169
- $3e40d2fd7fdb47d2$var$requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
16170
- const animationFrameID = $3e40d2fd7fdb47d2$var$requestAnimationFrameFn(function animationFrameCallback() {
16171
- $3e40d2fd7fdb47d2$var$clearTimeoutFn(timeoutID);
16172
- callback();
16173
- });
16174
- const timeoutID = $3e40d2fd7fdb47d2$var$setTimeoutFn(function timeoutCallback() {
16175
- $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn(animationFrameID);
16176
- callback();
16177
- }, $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION);
16178
- return [
16179
- animationFrameID,
16180
- timeoutID
16181
- ];
16182
- };
16231
+ windowObject = global;
16232
+ }
16233
+ let cancelFrame = null;
16234
+ let requestFrame = null;
16235
+ const TIMEOUT_DURATION = 20;
16236
+ const clearTimeoutFn = windowObject.clearTimeout;
16237
+ const setTimeoutFn = windowObject.setTimeout;
16238
+ const cancelAnimationFrameFn = windowObject.cancelAnimationFrame || windowObject.mozCancelAnimationFrame || windowObject.webkitCancelAnimationFrame;
16239
+ const requestAnimationFrameFn = windowObject.requestAnimationFrame || windowObject.mozRequestAnimationFrame || windowObject.webkitRequestAnimationFrame;
16240
+ if (cancelAnimationFrameFn == null || requestAnimationFrameFn == null) {
16241
+ // For environments that don't support animation frame,
16242
+ // fallback to a setTimeout based approach.
16243
+ cancelFrame = clearTimeoutFn;
16244
+ requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
16245
+ return setTimeoutFn(callback, TIMEOUT_DURATION);
16246
+ };
16247
+ } else {
16248
+ // Counter intuitively, environments that support animation frames can be trickier.
16249
+ // Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
16250
+ // In this case, we should fallback to a setTimeout() implementation.
16251
+ cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
16252
+ cancelAnimationFrameFn(animationFrameID);
16253
+ clearTimeoutFn(timeoutID);
16254
+ };
16255
+ requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
16256
+ const animationFrameID = requestAnimationFrameFn(function animationFrameCallback() {
16257
+ clearTimeoutFn(timeoutID);
16258
+ callback();
16259
+ });
16260
+ const timeoutID = setTimeoutFn(function timeoutCallback() {
16261
+ cancelAnimationFrameFn(animationFrameID);
16262
+ callback();
16263
+ }, TIMEOUT_DURATION);
16264
+ return [animationFrameID, timeoutID];
16265
+ };
16183
16266
  }
16184
- function $3e40d2fd7fdb47d2$var$createDetectElementResize(nonce) {
16185
- let animationKeyframes;
16186
- let animationName;
16187
- let animationStartEvent;
16188
- let animationStyle;
16189
- let checkTriggers;
16190
- let resetTriggers;
16191
- let scrollListener;
16192
- const attachEvent = typeof document !== "undefined" && document.attachEvent;
16193
- if (!attachEvent) {
16194
- resetTriggers = function(element) {
16195
- const triggers = element.__resizeTriggers__, expand = triggers.firstElementChild, contract = triggers.lastElementChild, expandChild = expand.firstElementChild;
16196
- contract.scrollLeft = contract.scrollWidth;
16197
- contract.scrollTop = contract.scrollHeight;
16198
- expandChild.style.width = expand.offsetWidth + 1 + "px";
16199
- expandChild.style.height = expand.offsetHeight + 1 + "px";
16200
- expand.scrollLeft = expand.scrollWidth;
16201
- expand.scrollTop = expand.scrollHeight;
16202
- };
16203
- checkTriggers = function(element) {
16204
- return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
16205
- };
16206
- scrollListener = function(e) {
16207
- // Don't measure (which forces) reflow for scrolls that happen inside of children!
16208
- if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) return;
16209
- const element = this;
16210
- resetTriggers(this);
16211
- if (this.__resizeRAF__) $3e40d2fd7fdb47d2$var$cancelFrame(this.__resizeRAF__);
16212
- this.__resizeRAF__ = $3e40d2fd7fdb47d2$var$requestFrame(function animationFrame() {
16213
- if (checkTriggers(element)) {
16214
- element.__resizeLast__.width = element.offsetWidth;
16215
- element.__resizeLast__.height = element.offsetHeight;
16216
- element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
16217
- fn.call(element, e);
16218
- });
16219
- }
16220
- });
16221
- };
16222
- /* Detect CSS Animations support to detect element display/re-attach */ let animation = false;
16223
- let keyframeprefix = "";
16224
- animationStartEvent = "animationstart";
16225
- const domPrefixes = "Webkit Moz O ms".split(" ");
16226
- let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
16227
- let pfx = "";
16228
- {
16229
- const elm = document.createElement("fakeelement");
16230
- if (elm.style.animationName !== undefined) animation = true;
16231
- if (animation === false) {
16232
- for(let i = 0; i < domPrefixes.length; i++)if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
16233
- pfx = domPrefixes[i];
16234
- keyframeprefix = "-" + pfx.toLowerCase() + "-";
16235
- animationStartEvent = startEvents[i];
16236
- animation = true;
16237
- break;
16238
- }
16239
- }
16240
- }
16241
- animationName = "resizeanim";
16242
- animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
16243
- animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
16244
- }
16245
- const createStyles = function(doc) {
16246
- if (!doc.getElementById("detectElementResize")) {
16247
- //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
16248
- const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', head = doc.head || doc.getElementsByTagName("head")[0], style = doc.createElement("style");
16249
- style.id = "detectElementResize";
16250
- style.type = "text/css";
16251
- if (nonce != null) style.setAttribute("nonce", nonce);
16252
- if (style.styleSheet) style.styleSheet.cssText = css;
16253
- else style.appendChild(doc.createTextNode(css));
16254
- head.appendChild(style);
16255
- }
16267
+ function createDetectElementResize(nonce) {
16268
+ let animationKeyframes;
16269
+ let animationName;
16270
+ let animationStartEvent;
16271
+ let animationStyle;
16272
+ let checkTriggers;
16273
+ let resetTriggers;
16274
+ let scrollListener;
16275
+ const attachEvent = typeof document !== "undefined" && document.attachEvent;
16276
+ if (!attachEvent) {
16277
+ resetTriggers = function (element) {
16278
+ const triggers = element.__resizeTriggers__,
16279
+ expand = triggers.firstElementChild,
16280
+ contract = triggers.lastElementChild,
16281
+ expandChild = expand.firstElementChild;
16282
+ contract.scrollLeft = contract.scrollWidth;
16283
+ contract.scrollTop = contract.scrollHeight;
16284
+ expandChild.style.width = expand.offsetWidth + 1 + "px";
16285
+ expandChild.style.height = expand.offsetHeight + 1 + "px";
16286
+ expand.scrollLeft = expand.scrollWidth;
16287
+ expand.scrollTop = expand.scrollHeight;
16256
16288
  };
16257
- const addResizeListener = function(element, fn) {
16258
- if (attachEvent) element.attachEvent("onresize", fn);
16259
- else {
16260
- if (!element.__resizeTriggers__) {
16261
- const doc = element.ownerDocument;
16262
- const elementStyle = $3e40d2fd7fdb47d2$var$windowObject.getComputedStyle(element);
16263
- if (elementStyle && elementStyle.position === "static") element.style.position = "relative";
16264
- createStyles(doc);
16265
- element.__resizeLast__ = {};
16266
- element.__resizeListeners__ = [];
16267
- (element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
16268
- const expandTrigger = doc.createElement("div");
16269
- expandTrigger.className = "expand-trigger";
16270
- expandTrigger.appendChild(doc.createElement("div"));
16271
- const contractTrigger = doc.createElement("div");
16272
- contractTrigger.className = "contract-trigger";
16273
- element.__resizeTriggers__.appendChild(expandTrigger);
16274
- element.__resizeTriggers__.appendChild(contractTrigger);
16275
- element.appendChild(element.__resizeTriggers__);
16276
- resetTriggers(element);
16277
- element.addEventListener("scroll", scrollListener, true);
16278
- /* Listen for a css animation to detect element display/re-attach */ if (animationStartEvent) {
16279
- element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
16280
- if (e.animationName === animationName) resetTriggers(element);
16281
- };
16282
- element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
16283
- }
16284
- }
16285
- element.__resizeListeners__.push(fn);
16286
- }
16289
+ checkTriggers = function (element) {
16290
+ return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
16287
16291
  };
16288
- const removeResizeListener = function(element, fn) {
16289
- if (attachEvent) element.detachEvent("onresize", fn);
16290
- else {
16291
- element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
16292
- if (!element.__resizeListeners__.length) {
16293
- element.removeEventListener("scroll", scrollListener, true);
16294
- if (element.__resizeTriggers__.__animationListener__) {
16295
- element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
16296
- element.__resizeTriggers__.__animationListener__ = null;
16297
- }
16298
- try {
16299
- element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
16300
- } catch (e) {
16301
- // Preact compat; see developit/preact-compat/issues/228
16302
- }
16303
- }
16292
+ scrollListener = function (e) {
16293
+ // Don't measure (which forces) reflow for scrolls that happen inside of children!
16294
+ if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) {
16295
+ return;
16296
+ }
16297
+ const element = this;
16298
+ resetTriggers(this);
16299
+ if (this.__resizeRAF__) {
16300
+ cancelFrame(this.__resizeRAF__);
16301
+ }
16302
+ this.__resizeRAF__ = requestFrame(function animationFrame() {
16303
+ if (checkTriggers(element)) {
16304
+ element.__resizeLast__.width = element.offsetWidth;
16305
+ element.__resizeLast__.height = element.offsetHeight;
16306
+ element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
16307
+ fn.call(element, e);
16308
+ });
16304
16309
  }
16310
+ });
16305
16311
  };
16306
- return {
16307
- addResizeListener: addResizeListener,
16308
- removeResizeListener: removeResizeListener
16309
- };
16310
- }
16311
- $3e40d2fd7fdb47d2$exports = {
16312
- createDetectElementResize: $3e40d2fd7fdb47d2$var$createDetectElementResize
16313
- };
16314
16312
 
16315
-
16316
- function $6e2bb92d9db3b0c8$var$_defineProperty(obj, key, value) {
16317
- key = $6e2bb92d9db3b0c8$var$_toPropertyKey(key);
16318
- if (key in obj) Object.defineProperty(obj, key, {
16319
- value: value,
16320
- enumerable: true,
16321
- configurable: true,
16322
- writable: true
16323
- });
16324
- else obj[key] = value;
16325
- return obj;
16326
- }
16327
- function $6e2bb92d9db3b0c8$var$_toPropertyKey(arg) {
16328
- var key = $6e2bb92d9db3b0c8$var$_toPrimitive(arg, "string");
16329
- return typeof key === "symbol" ? key : String(key);
16330
- }
16331
- function $6e2bb92d9db3b0c8$var$_toPrimitive(input, hint) {
16332
- if (typeof input !== "object" || input === null) return input;
16333
- var prim = input[Symbol.toPrimitive];
16334
- if (prim !== undefined) {
16335
- var res = prim.call(input, hint || "default");
16336
- if (typeof res !== "object") return res;
16337
- throw new TypeError("@@toPrimitive must return a primitive value.");
16338
- }
16339
- return (hint === "string" ? String : Number)(input);
16340
- }
16341
- class $6e2bb92d9db3b0c8$export$9d94f4ee1d930ff extends (Component) {
16342
- constructor(...args){
16343
- super(...args);
16344
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "state", {
16345
- height: this.props.defaultHeight || 0,
16346
- scaledHeight: this.props.defaultHeight || 0,
16347
- scaledWidth: this.props.defaultWidth || 0,
16348
- width: this.props.defaultWidth || 0
16349
- });
16350
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_autoSizer", null);
16351
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_detectElementResize", null);
16352
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_parentNode", null);
16353
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_resizeObserver", null);
16354
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_onResize", ()=>{
16355
- const { disableHeight: disableHeight , disableWidth: disableWidth , onResize: onResize } = this.props;
16356
- if (this._parentNode) {
16357
- var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
16358
- // Guard against AutoSizer component being removed from the DOM immediately after being added.
16359
- // This can result in invalid style values which can result in NaN values if we don't handle them.
16360
- // See issue #150 for more context.
16361
- const style = window.getComputedStyle(this._parentNode) || {};
16362
- const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
16363
- const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
16364
- const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
16365
- const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
16366
- const rect = this._parentNode.getBoundingClientRect();
16367
- const scaledHeight = rect.height - paddingTop - paddingBottom;
16368
- const scaledWidth = rect.width - paddingLeft - paddingRight;
16369
- const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
16370
- const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
16371
- if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
16372
- this.setState({
16373
- height: height,
16374
- width: width,
16375
- scaledHeight: scaledHeight,
16376
- scaledWidth: scaledWidth
16377
- });
16378
- if (typeof onResize === "function") onResize({
16379
- height: height,
16380
- scaledHeight: scaledHeight,
16381
- scaledWidth: scaledWidth,
16382
- width: width
16383
- });
16384
- }
16385
- }
16386
- });
16387
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_setRef", (autoSizer)=>{
16388
- this._autoSizer = autoSizer;
16389
- });
16390
- }
16391
- componentDidMount() {
16392
- const { nonce: nonce } = this.props;
16393
- if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
16394
- // Delay access of parentNode until mount.
16395
- // This handles edge-cases where the component has already been unmounted before its ref has been set,
16396
- // As well as libraries like react-lite which have a slightly different lifecycle.
16397
- this._parentNode = this._autoSizer.parentNode;
16398
- // Defer requiring resize handler in order to support server-side rendering.
16399
- // See issue #41
16400
- if (this._parentNode != null) {
16401
- if (typeof ResizeObserver !== "undefined") {
16402
- this._resizeObserver = new ResizeObserver(()=>{
16403
- // Guard against "ResizeObserver loop limit exceeded" error;
16404
- // could be triggered if the state update causes the ResizeObserver handler to run long.
16405
- // See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
16406
- setTimeout(this._onResize, 0);
16407
- });
16408
- this._resizeObserver.observe(this._parentNode);
16409
- } else {
16410
- this._detectElementResize = (0, $3e40d2fd7fdb47d2$exports.createDetectElementResize)(nonce);
16411
- this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
16412
- }
16413
- this._onResize();
16414
- }
16313
+ /* Detect CSS Animations support to detect element display/re-attach */
16314
+ let animation = false;
16315
+ let keyframeprefix = "";
16316
+ animationStartEvent = "animationstart";
16317
+ const domPrefixes = "Webkit Moz O ms".split(" ");
16318
+ let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
16319
+ let pfx = "";
16320
+ {
16321
+ const elm = document.createElement("fakeelement");
16322
+ if (elm.style.animationName !== undefined) {
16323
+ animation = true;
16324
+ }
16325
+ if (animation === false) {
16326
+ for (let i = 0; i < domPrefixes.length; i++) {
16327
+ if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
16328
+ pfx = domPrefixes[i];
16329
+ keyframeprefix = "-" + pfx.toLowerCase() + "-";
16330
+ animationStartEvent = startEvents[i];
16331
+ animation = true;
16332
+ break;
16333
+ }
16415
16334
  }
16335
+ }
16416
16336
  }
16417
- componentWillUnmount() {
16418
- if (this._parentNode) {
16419
- if (this._detectElementResize) this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
16420
- if (this._resizeObserver) {
16421
- this._resizeObserver.observe(this._parentNode);
16422
- this._resizeObserver.disconnect();
16337
+ animationName = "resizeanim";
16338
+ animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
16339
+ animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
16340
+ }
16341
+ const createStyles = function (doc) {
16342
+ if (!doc.getElementById("detectElementResize")) {
16343
+ //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
16344
+ const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
16345
+ head = doc.head || doc.getElementsByTagName("head")[0],
16346
+ style = doc.createElement("style");
16347
+ style.id = "detectElementResize";
16348
+ style.type = "text/css";
16349
+ if (nonce != null) {
16350
+ style.setAttribute("nonce", nonce);
16351
+ }
16352
+ if (style.styleSheet) {
16353
+ style.styleSheet.cssText = css;
16354
+ } else {
16355
+ style.appendChild(doc.createTextNode(css));
16356
+ }
16357
+ head.appendChild(style);
16358
+ }
16359
+ };
16360
+ const addResizeListener = function (element, fn) {
16361
+ if (attachEvent) {
16362
+ element.attachEvent("onresize", fn);
16363
+ } else {
16364
+ if (!element.__resizeTriggers__) {
16365
+ const doc = element.ownerDocument;
16366
+ const elementStyle = windowObject.getComputedStyle(element);
16367
+ if (elementStyle && elementStyle.position === "static") {
16368
+ element.style.position = "relative";
16369
+ }
16370
+ createStyles(doc);
16371
+ element.__resizeLast__ = {};
16372
+ element.__resizeListeners__ = [];
16373
+ (element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
16374
+ const expandTrigger = doc.createElement("div");
16375
+ expandTrigger.className = "expand-trigger";
16376
+ expandTrigger.appendChild(doc.createElement("div"));
16377
+ const contractTrigger = doc.createElement("div");
16378
+ contractTrigger.className = "contract-trigger";
16379
+ element.__resizeTriggers__.appendChild(expandTrigger);
16380
+ element.__resizeTriggers__.appendChild(contractTrigger);
16381
+ element.appendChild(element.__resizeTriggers__);
16382
+ resetTriggers(element);
16383
+ element.addEventListener("scroll", scrollListener, true);
16384
+
16385
+ /* Listen for a css animation to detect element display/re-attach */
16386
+ if (animationStartEvent) {
16387
+ element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
16388
+ if (e.animationName === animationName) {
16389
+ resetTriggers(element);
16423
16390
  }
16391
+ };
16392
+ element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
16424
16393
  }
16394
+ }
16395
+ element.__resizeListeners__.push(fn);
16425
16396
  }
16426
- render() {
16427
- const { children: children , defaultHeight: defaultHeight , defaultWidth: defaultWidth , disableHeight: disableHeight = false , disableWidth: disableWidth = false , nonce: nonce , onResize: onResize , style: style = {} , tagName: tagName = "div" , ...rest } = this.props;
16428
- const { height: height , scaledHeight: scaledHeight , scaledWidth: scaledWidth , width: width } = this.state;
16429
- // Outer div should not force width/height since that may prevent containers from shrinking.
16430
- // Inner component should overflow and use calculated width/height.
16431
- // See issue #68 for more information.
16432
- const outerStyle = {
16433
- overflow: "visible"
16434
- };
16435
- const childParams = {};
16436
- // Avoid rendering children before the initial measurements have been collected.
16437
- // At best this would just be wasting cycles.
16438
- let bailoutOnChildren = false;
16439
- if (!disableHeight) {
16440
- if (height === 0) bailoutOnChildren = true;
16441
- outerStyle.height = 0;
16442
- childParams.height = height;
16443
- childParams.scaledHeight = scaledHeight;
16397
+ };
16398
+ const removeResizeListener = function (element, fn) {
16399
+ if (attachEvent) {
16400
+ element.detachEvent("onresize", fn);
16401
+ } else {
16402
+ element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
16403
+ if (!element.__resizeListeners__.length) {
16404
+ element.removeEventListener("scroll", scrollListener, true);
16405
+ if (element.__resizeTriggers__.__animationListener__) {
16406
+ element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
16407
+ element.__resizeTriggers__.__animationListener__ = null;
16444
16408
  }
16445
- if (!disableWidth) {
16446
- if (width === 0) bailoutOnChildren = true;
16447
- outerStyle.width = 0;
16448
- childParams.width = width;
16449
- childParams.scaledWidth = scaledWidth;
16409
+ try {
16410
+ element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
16411
+ } catch (e) {
16412
+ // Preact compat; see developit/preact-compat/issues/228
16450
16413
  }
16451
- return (createElement)(tagName, {
16452
- ref: this._setRef,
16453
- style: {
16454
- ...outerStyle,
16455
- ...style
16456
- },
16457
- ...rest
16458
- }, !bailoutOnChildren && children(childParams));
16414
+ }
16459
16415
  }
16416
+ };
16417
+ return {
16418
+ addResizeListener,
16419
+ removeResizeListener
16420
+ };
16460
16421
  }
16461
16422
 
16423
+ class AutoSizer extends Component {
16424
+ constructor(...args) {
16425
+ super(...args);
16426
+ this.state = {
16427
+ height: this.props.defaultHeight || 0,
16428
+ scaledHeight: this.props.defaultHeight || 0,
16429
+ scaledWidth: this.props.defaultWidth || 0,
16430
+ width: this.props.defaultWidth || 0
16431
+ };
16432
+ this._autoSizer = null;
16433
+ this._detectElementResize = null;
16434
+ this._parentNode = null;
16435
+ this._resizeObserver = null;
16436
+ this._timeoutId = null;
16437
+ this._onResize = () => {
16438
+ this._timeoutId = null;
16439
+ const {
16440
+ disableHeight,
16441
+ disableWidth,
16442
+ onResize
16443
+ } = this.props;
16444
+ if (this._parentNode) {
16445
+ var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
16446
+ // Guard against AutoSizer component being removed from the DOM immediately after being added.
16447
+ // This can result in invalid style values which can result in NaN values if we don't handle them.
16448
+ // See issue #150 for more context.
16449
+
16450
+ const style = window.getComputedStyle(this._parentNode) || {};
16451
+ const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
16452
+ const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
16453
+ const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
16454
+ const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
16455
+ const rect = this._parentNode.getBoundingClientRect();
16456
+ const scaledHeight = rect.height - paddingTop - paddingBottom;
16457
+ const scaledWidth = rect.width - paddingLeft - paddingRight;
16458
+ const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
16459
+ const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
16460
+ if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
16461
+ this.setState({
16462
+ height,
16463
+ width,
16464
+ scaledHeight,
16465
+ scaledWidth
16466
+ });
16467
+ if (typeof onResize === "function") {
16468
+ onResize({
16469
+ height,
16470
+ scaledHeight,
16471
+ scaledWidth,
16472
+ width
16473
+ });
16474
+ }
16475
+ }
16476
+ }
16477
+ };
16478
+ this._setRef = autoSizer => {
16479
+ this._autoSizer = autoSizer;
16480
+ };
16481
+ }
16482
+ componentDidMount() {
16483
+ const {
16484
+ nonce
16485
+ } = this.props;
16486
+ if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
16487
+ // Delay access of parentNode until mount.
16488
+ // This handles edge-cases where the component has already been unmounted before its ref has been set,
16489
+ // As well as libraries like react-lite which have a slightly different lifecycle.
16490
+ this._parentNode = this._autoSizer.parentNode;
16491
+
16492
+ // Defer requiring resize handler in order to support server-side rendering.
16493
+ // See issue #41
16494
+ if (this._parentNode != null) {
16495
+ if (typeof ResizeObserver !== "undefined") {
16496
+ this._resizeObserver = new ResizeObserver(() => {
16497
+ // Guard against "ResizeObserver loop limit exceeded" error;
16498
+ // could be triggered if the state update causes the ResizeObserver handler to run long.
16499
+ // See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
16500
+ this._timeoutId = setTimeout(this._onResize, 0);
16501
+ });
16502
+ this._resizeObserver.observe(this._parentNode);
16503
+ } else {
16504
+ this._detectElementResize = createDetectElementResize(nonce);
16505
+ this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
16506
+ }
16507
+ this._onResize();
16508
+ }
16509
+ }
16510
+ }
16511
+ componentWillUnmount() {
16512
+ if (this._parentNode) {
16513
+ if (this._detectElementResize) {
16514
+ this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
16515
+ }
16516
+ if (this._timeoutId !== null) {
16517
+ clearTimeout(this._timeoutId);
16518
+ }
16519
+ if (this._resizeObserver) {
16520
+ this._resizeObserver.observe(this._parentNode);
16521
+ this._resizeObserver.disconnect();
16522
+ }
16523
+ }
16524
+ }
16525
+ render() {
16526
+ const {
16527
+ children,
16528
+ defaultHeight,
16529
+ defaultWidth,
16530
+ disableHeight = false,
16531
+ disableWidth = false,
16532
+ nonce,
16533
+ onResize,
16534
+ style = {},
16535
+ tagName = "div",
16536
+ ...rest
16537
+ } = this.props;
16538
+ const {
16539
+ height,
16540
+ scaledHeight,
16541
+ scaledWidth,
16542
+ width
16543
+ } = this.state;
16462
16544
 
16463
- var $81c1b644006d48ec$exports = {};
16464
-
16465
- $parcel$export($81c1b644006d48ec$exports, "isHeightAndWidthProps", () => $81c1b644006d48ec$export$6a9e233b3261c1f);
16466
- $parcel$export($81c1b644006d48ec$exports, "isHeightOnlyProps", () => $81c1b644006d48ec$export$232069b3e05ce32a);
16467
- $parcel$export($81c1b644006d48ec$exports, "isWidthOnlyProps", () => $81c1b644006d48ec$export$10ec32941a097f36);
16468
- function $81c1b644006d48ec$export$6a9e233b3261c1f(props) {
16469
- return props && props.disableHeight !== true && props.disableWidth !== true;
16470
- }
16471
- function $81c1b644006d48ec$export$232069b3e05ce32a(props) {
16472
- return props && props.disableHeight !== true && props.disableWidth === true;
16473
- }
16474
- function $81c1b644006d48ec$export$10ec32941a097f36(props) {
16475
- return props && props.disableHeight === true && props.disableWidth !== true;
16545
+ // Outer div should not force width/height since that may prevent containers from shrinking.
16546
+ // Inner component should overflow and use calculated width/height.
16547
+ // See issue #68 for more information.
16548
+ const outerStyle = {
16549
+ overflow: "visible"
16550
+ };
16551
+ const childParams = {};
16552
+
16553
+ // Avoid rendering children before the initial measurements have been collected.
16554
+ // At best this would just be wasting cycles.
16555
+ let bailoutOnChildren = false;
16556
+ if (!disableHeight) {
16557
+ if (height === 0) {
16558
+ bailoutOnChildren = true;
16559
+ }
16560
+ outerStyle.height = 0;
16561
+ childParams.height = height;
16562
+ childParams.scaledHeight = scaledHeight;
16563
+ }
16564
+ if (!disableWidth) {
16565
+ if (width === 0) {
16566
+ bailoutOnChildren = true;
16567
+ }
16568
+ outerStyle.width = 0;
16569
+ childParams.width = width;
16570
+ childParams.scaledWidth = scaledWidth;
16571
+ }
16572
+ return createElement(tagName, {
16573
+ ref: this._setRef,
16574
+ style: {
16575
+ ...outerStyle,
16576
+ ...style
16577
+ },
16578
+ ...rest
16579
+ }, !bailoutOnChildren && children(childParams));
16580
+ }
16476
16581
  }
16477
16582
 
16478
-
16479
- var $149c1bd638913645$export$2e2bcd8739ae039 = ($6e2bb92d9db3b0c8$export$9d94f4ee1d930ff);
16480
-
16481
16583
  const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
16482
16584
  shapes: [{
16483
16585
  type: 'path',
@@ -17228,7 +17330,7 @@ function ListBoxInline(_ref4) {
17228
17330
  className: classes$4.screenReaderOnly
17229
17331
  }, translator.get('Listbox.ScreenReaderInstructions')), isInvalid ? /*#__PURE__*/React__default.createElement(ListBoxError, {
17230
17332
  text: errorText
17231
- }) : /*#__PURE__*/React__default.createElement($149c1bd638913645$export$2e2bcd8739ae039, null, _ref5 => {
17333
+ }) : /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref5 => {
17232
17334
  let {
17233
17335
  height,
17234
17336
  width
@@ -17236,6 +17338,7 @@ function ListBoxInline(_ref4) {
17236
17338
  return /*#__PURE__*/React__default.createElement(ListBox, {
17237
17339
  model: model,
17238
17340
  app: app,
17341
+ theme: theme,
17239
17342
  constraints: constraints,
17240
17343
  layout: layout,
17241
17344
  selections: selections,
@@ -17511,6 +17614,14 @@ function useOnTheFlyModel(_ref) {
17511
17614
  const [model, setModel] = useState$1();
17512
17615
  const [fallbackTitle, setFallbackTitle] = useState$1();
17513
17616
  const title = (_options$title = options.title) !== null && _options$title !== void 0 ? _options$title : fallbackTitle;
17617
+ let {
17618
+ histogram = false,
17619
+ frequencyMode = 'N'
17620
+ } = options;
17621
+ if (fieldDef && fieldDef.failedToFetchFieldDef) {
17622
+ histogram = false;
17623
+ frequencyMode = 'N';
17624
+ }
17514
17625
  useEffect$1(() => {
17515
17626
  async function fetchMasterItem() {
17516
17627
  try {
@@ -17533,7 +17644,7 @@ function useOnTheFlyModel(_ref) {
17533
17644
  throw new Error("Disabling frequency count and histogram: ".concat(e && e.message));
17534
17645
  }
17535
17646
  }
17536
- const isFrequencyMaxNeeded = options.histogram || options.frequencyMode !== 'N';
17647
+ const isFrequencyMaxNeeded = histogram || frequencyMode !== 'N';
17537
17648
  const shouldFetchMasterItem = fieldIdentifier.qLibraryId && isFrequencyMaxNeeded;
17538
17649
  if (shouldFetchMasterItem) {
17539
17650
  fetchMasterItem();
@@ -17548,31 +17659,6 @@ function useOnTheFlyModel(_ref) {
17548
17659
  listLayout,
17549
17660
  properties = {}
17550
17661
  } = options;
17551
- let {
17552
- frequencyMode,
17553
- histogram = false
17554
- } = options;
17555
- if (fieldDef && fieldDef.failedToFetchFieldDef) {
17556
- histogram = false;
17557
- frequencyMode = 'N';
17558
- }
17559
- switch (true) {
17560
- case ['none', 'N', 'NX_FREQUENCY_NONE'].includes(frequencyMode):
17561
- frequencyMode = 'N';
17562
- break;
17563
- case ['value', 'V', 'NX_FREQUENCY_VALUE', 'default'].includes(frequencyMode):
17564
- frequencyMode = 'V';
17565
- break;
17566
- case ['percent', 'P', 'NX_FREQUENCY_PERCENT'].includes(frequencyMode):
17567
- frequencyMode = 'P';
17568
- break;
17569
- case ['relative', 'R', 'NX_FREQUENCY_RELATIVE'].includes(frequencyMode):
17570
- frequencyMode = 'R';
17571
- break;
17572
- default:
17573
- frequencyMode = 'N';
17574
- break;
17575
- }
17576
17662
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
17577
17663
  const layoutOptions = {
17578
17664
  dense
@@ -17650,6 +17736,28 @@ function identify(_ref) {
17650
17736
  };
17651
17737
  }
17652
17738
 
17739
+ function getFrequencyModeLetter(frequencyMode) {
17740
+ let freqLetter;
17741
+ switch (true) {
17742
+ case ['none', 'N', 'NX_FREQUENCY_NONE'].includes(frequencyMode):
17743
+ freqLetter = 'N';
17744
+ break;
17745
+ case ['value', 'V', 'NX_FREQUENCY_VALUE', 'default'].includes(frequencyMode):
17746
+ freqLetter = 'V';
17747
+ break;
17748
+ case ['percent', 'P', 'NX_FREQUENCY_PERCENT'].includes(frequencyMode):
17749
+ freqLetter = 'P';
17750
+ break;
17751
+ case ['relative', 'R', 'NX_FREQUENCY_RELATIVE'].includes(frequencyMode):
17752
+ freqLetter = 'R';
17753
+ break;
17754
+ default:
17755
+ freqLetter = 'N';
17756
+ break;
17757
+ }
17758
+ return freqLetter;
17759
+ }
17760
+
17653
17761
  const _excluded$3 = ["__DO_NOT_USE__"];
17654
17762
 
17655
17763
  /**
@@ -17712,6 +17820,12 @@ function ListBoxWrapper(_ref) {
17712
17820
  qId,
17713
17821
  options
17714
17822
  });
17823
+ if (!isExistingObject) {
17824
+ Object.assign(options, {
17825
+ frequencyMode: getFrequencyModeLetter(options.frequencyMode) // stick to letter option hereafter
17826
+ });
17827
+ }
17828
+
17715
17829
  const [changeCount, setChangeCount] = useState$1(0);
17716
17830
  useEffect$1(() => {
17717
17831
  if (changeCount) {
@@ -25536,12 +25650,11 @@ function nuked() {
25536
25650
  * @returns {Promise<object>} The objects properties
25537
25651
  * @example
25538
25652
  * // generate properties for a barchart
25539
- * const properties = await n.create({
25653
+ * const properties = await n.generateProperties({
25540
25654
  * type: 'barchart',
25541
25655
  * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
25542
25656
  * properties: { showTitle: true }
25543
25657
  * },
25544
- * true
25545
25658
  * );
25546
25659
  */
25547
25660
  generateProperties: async cfg => createObject(cfg, halo, true),