@nebula.js/stardust 4.2.0 → 4.2.2
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 +628 -461
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +3 -3
- package/core/esm/index.js.map +1 -1
- package/core/package.json +2 -2
- package/dist/stardust.dev.js +691 -498
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +6 -6
- package/dist/stardust.js.map +1 -1
- package/package.json +12 -12
- package/types/index.d.ts +10 -10
package/core/esm/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v4.2.
|
|
2
|
+
* @nebula.js/stardust v4.2.2
|
|
3
3
|
* Copyright (c) 2023 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -1898,6 +1898,24 @@ var Visualization_UnfulfilledCalculationCondition = {
|
|
|
1898
1898
|
"zh-TW": "不符計算條件"
|
|
1899
1899
|
}
|
|
1900
1900
|
};
|
|
1901
|
+
var ScreenReader_OneSearchResult = {
|
|
1902
|
+
id: "ScreenReader.OneSearchResult",
|
|
1903
|
+
locale: {
|
|
1904
|
+
"en-US": "There is one available result"
|
|
1905
|
+
}
|
|
1906
|
+
};
|
|
1907
|
+
var ScreenReader_ManySearchResults = {
|
|
1908
|
+
id: "ScreenReader.ManySearchResults",
|
|
1909
|
+
locale: {
|
|
1910
|
+
"en-US": "There are {0} available results"
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
var ScreenReader_SearchFieldLabel = {
|
|
1914
|
+
id: "ScreenReader.SearchFieldLabel",
|
|
1915
|
+
locale: {
|
|
1916
|
+
"en-US": "Search Field"
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1901
1919
|
var all = {
|
|
1902
1920
|
Cancel: Cancel$1,
|
|
1903
1921
|
CurrentSelections_All: CurrentSelections_All,
|
|
@@ -1948,7 +1966,10 @@ var all = {
|
|
|
1948
1966
|
Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
|
|
1949
1967
|
Visualization_Invalid_Measure: Visualization_Invalid_Measure,
|
|
1950
1968
|
Visualization_LayoutError: Visualization_LayoutError,
|
|
1951
|
-
Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
|
|
1969
|
+
Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
|
|
1970
|
+
ScreenReader_OneSearchResult: ScreenReader_OneSearchResult,
|
|
1971
|
+
ScreenReader_ManySearchResults: ScreenReader_ManySearchResults,
|
|
1972
|
+
ScreenReader_SearchFieldLabel: ScreenReader_SearchFieldLabel
|
|
1952
1973
|
};
|
|
1953
1974
|
|
|
1954
1975
|
function appLocaleFn(language) {
|
|
@@ -8373,7 +8394,7 @@ function create$3(definition) {
|
|
|
8373
8394
|
return cache[key];
|
|
8374
8395
|
}
|
|
8375
8396
|
|
|
8376
|
-
const NEBULA_VERSION_HASH = "
|
|
8397
|
+
const NEBULA_VERSION_HASH = "7f71" ;
|
|
8377
8398
|
ClassNameGenerator$1.configure(componentName => {
|
|
8378
8399
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
8379
8400
|
});
|
|
@@ -8620,7 +8641,7 @@ function boot(_ref2) {
|
|
|
8620
8641
|
const appRef = React__default.createRef();
|
|
8621
8642
|
const element = document.createElement('div');
|
|
8622
8643
|
element.style.display = 'none';
|
|
8623
|
-
element.setAttribute('data-nebulajs-version', "4.2.
|
|
8644
|
+
element.setAttribute('data-nebulajs-version', "4.2.2" );
|
|
8624
8645
|
element.setAttribute('data-app-id', app.id);
|
|
8625
8646
|
document.body.appendChild(element);
|
|
8626
8647
|
if (context) {
|
|
@@ -9813,7 +9834,6 @@ const BUTTON_ICON_WIDTH = ICON_WIDTH + (ICON_PADDING + 1) * 2; // 1 is border wi
|
|
|
9813
9834
|
const REMOVE_TICK_LIMIT = 80; // an item width equal to or less than this, will hide the select tick
|
|
9814
9835
|
const SCROLL_BAR_WIDTH = 10; // TODO: ignore this - instead set the styling only show on hover...
|
|
9815
9836
|
const ITEM_MAX_WIDTH = 150;
|
|
9816
|
-
const FREQUENCY_WIDTH = 40;
|
|
9817
9837
|
const ITEM_MIN_WIDTH = 56;
|
|
9818
9838
|
const CHECKBOX_WIDTH = 20;
|
|
9819
9839
|
const frequencyTextNone = '-';
|
|
@@ -9835,10 +9855,39 @@ const getBarWidth = _ref => {
|
|
|
9835
9855
|
};
|
|
9836
9856
|
const getFrequencyText = qFrequency => qFrequency || frequencyTextNone;
|
|
9837
9857
|
|
|
9838
|
-
const
|
|
9858
|
+
const getFreqFlexBasis = _ref => {
|
|
9839
9859
|
let {
|
|
9840
|
-
|
|
9860
|
+
sizes,
|
|
9861
|
+
frequencyMode,
|
|
9862
|
+
isGridMode,
|
|
9863
|
+
freqHitsValue
|
|
9841
9864
|
} = _ref;
|
|
9865
|
+
if (frequencyMode === 'P') {
|
|
9866
|
+
return "".concat(sizes.freqMinWidth, "px");
|
|
9867
|
+
}
|
|
9868
|
+
const flexBasis = isGridMode && !freqHitsValue ? 'max-content' : '25%';
|
|
9869
|
+
return flexBasis;
|
|
9870
|
+
};
|
|
9871
|
+
const getMaxFreqWidth = _ref2 => {
|
|
9872
|
+
let {
|
|
9873
|
+
sizes,
|
|
9874
|
+
frequencyMode,
|
|
9875
|
+
isGridMode
|
|
9876
|
+
} = _ref2;
|
|
9877
|
+
if (isGridMode) {
|
|
9878
|
+
// This makes the neighbouring value stretch farther than when using a fixed freuency width.
|
|
9879
|
+
return 'max-content';
|
|
9880
|
+
}
|
|
9881
|
+
if (frequencyMode === 'P') {
|
|
9882
|
+
return sizes.freqMinWidth; // because it will never grow beyond "100.0%"
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9885
|
+
return sizes.freqMaxWidth;
|
|
9886
|
+
};
|
|
9887
|
+
const getSelectedStyle = _ref3 => {
|
|
9888
|
+
let {
|
|
9889
|
+
theme
|
|
9890
|
+
} = _ref3;
|
|
9842
9891
|
return {
|
|
9843
9892
|
background: theme.palette.selected.main,
|
|
9844
9893
|
color: theme.palette.selected.mainContrastText,
|
|
@@ -9860,18 +9909,20 @@ const ellipsis = {
|
|
|
9860
9909
|
const iconWidth = 24; // tick and lock icon width in px
|
|
9861
9910
|
|
|
9862
9911
|
const RowColRoot = styled$1('div', {
|
|
9863
|
-
shouldForwardProp: prop => !['
|
|
9864
|
-
})(
|
|
9912
|
+
shouldForwardProp: prop => !['checkboxes', 'isGridMode', 'isGridCol', 'dense', 'direction', 'sizes', 'frequencyMode', 'freqHitsValue'].includes(prop)
|
|
9913
|
+
})(_ref4 => {
|
|
9865
9914
|
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
9915
|
let {
|
|
9867
9916
|
theme,
|
|
9868
|
-
|
|
9917
|
+
checkboxes,
|
|
9869
9918
|
isGridMode,
|
|
9870
9919
|
isGridCol,
|
|
9871
9920
|
dense,
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9921
|
+
direction,
|
|
9922
|
+
sizes,
|
|
9923
|
+
frequencyMode,
|
|
9924
|
+
freqHitsValue
|
|
9925
|
+
} = _ref4;
|
|
9875
9926
|
return {
|
|
9876
9927
|
'&:focus': {
|
|
9877
9928
|
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
|
|
@@ -9904,15 +9955,16 @@ const RowColRoot = styled$1('div', {
|
|
|
9904
9955
|
["& .".concat(rowColClasses.cell)]: {
|
|
9905
9956
|
display: 'flex',
|
|
9906
9957
|
alignItems: 'center',
|
|
9907
|
-
minWidth: 0,
|
|
9908
9958
|
flexGrow: 1,
|
|
9959
|
+
minWidth: checkboxes ? '52px' : '26px',
|
|
9960
|
+
// these numbers are just enough to show one letter and ellipsis: A…
|
|
9961
|
+
flexBasis: checkboxes ? 'auto' : 'max-content',
|
|
9909
9962
|
// Note that this padding is overridden when using checkboxes.
|
|
9910
9963
|
paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
|
|
9911
9964
|
paddingRight: 0
|
|
9912
9965
|
},
|
|
9913
9966
|
// The leaf node, containing the label text.
|
|
9914
9967
|
["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
|
|
9915
|
-
flexBasis: flexBasisProp,
|
|
9916
9968
|
lineHeight: '16px',
|
|
9917
9969
|
userSelect: 'none',
|
|
9918
9970
|
paddingRight: '1px'
|
|
@@ -9980,9 +10032,22 @@ const RowColRoot = styled$1('div', {
|
|
|
9980
10032
|
["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
|
|
9981
10033
|
justifyContent: 'flex-end'
|
|
9982
10034
|
}, ellipsis), {}, {
|
|
9983
|
-
flex: "0
|
|
10035
|
+
flex: "0 0 ".concat(getFreqFlexBasis({
|
|
10036
|
+
sizes,
|
|
10037
|
+
frequencyMode,
|
|
10038
|
+
isGridMode,
|
|
10039
|
+
freqHitsValue
|
|
10040
|
+
})),
|
|
10041
|
+
minWidth: !isGridMode && frequencyMode !== 'P' && freqHitsValue ? sizes.freqMinWidth : 'max-content',
|
|
10042
|
+
maxWidth: getMaxFreqWidth({
|
|
10043
|
+
sizes,
|
|
10044
|
+
frequencyMode,
|
|
10045
|
+
isGridMode
|
|
10046
|
+
}),
|
|
9984
10047
|
textAlign: direction === 'rtl' ? 'left' : 'right',
|
|
9985
|
-
|
|
10048
|
+
// In RTL, we already get the 8px from the value element's padding and for
|
|
10049
|
+
// percent mode we have already adapted the width (fixed width) to the max number.
|
|
10050
|
+
paddingLeft: direction !== 'rtl' ? '8px' : 0
|
|
9986
10051
|
}),
|
|
9987
10052
|
["&.".concat(rowColClasses.barContainer)]: {
|
|
9988
10053
|
height: '100%',
|
|
@@ -10566,6 +10631,21 @@ function ScreenReaderForSelections(_ref2) {
|
|
|
10566
10631
|
"aria-live": "assertive"
|
|
10567
10632
|
}, text);
|
|
10568
10633
|
}
|
|
10634
|
+
function getScreenReaderSearchText(listCount) {
|
|
10635
|
+
let t;
|
|
10636
|
+
switch (listCount) {
|
|
10637
|
+
case 0:
|
|
10638
|
+
t = 'Listbox.NoMatchesForYourTerms';
|
|
10639
|
+
break;
|
|
10640
|
+
case 1:
|
|
10641
|
+
t = 'ScreenReader.OneSearchResult';
|
|
10642
|
+
break;
|
|
10643
|
+
default:
|
|
10644
|
+
t = 'ScreenReader.ManySearchResults';
|
|
10645
|
+
break;
|
|
10646
|
+
}
|
|
10647
|
+
return t;
|
|
10648
|
+
}
|
|
10569
10649
|
|
|
10570
10650
|
const KEYS = Object.freeze({
|
|
10571
10651
|
ENTER: 13,
|
|
@@ -10828,6 +10908,32 @@ function getRowsKeyboardNavigation(_ref) {
|
|
|
10828
10908
|
return handleKeyDown;
|
|
10829
10909
|
}
|
|
10830
10910
|
|
|
10911
|
+
function getValueTextAlign(_ref) {
|
|
10912
|
+
let {
|
|
10913
|
+
direction,
|
|
10914
|
+
cell,
|
|
10915
|
+
textAlign
|
|
10916
|
+
} = _ref;
|
|
10917
|
+
const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
|
|
10918
|
+
let valueTextAlign;
|
|
10919
|
+
const isAutoTextAlign = !textAlign || textAlign.auto;
|
|
10920
|
+
const dirToTextAlignMap = {
|
|
10921
|
+
rtl: 'right',
|
|
10922
|
+
ltr: 'left'
|
|
10923
|
+
};
|
|
10924
|
+
if (isAutoTextAlign) {
|
|
10925
|
+
if (!isNumeric) {
|
|
10926
|
+
valueTextAlign = dirToTextAlignMap[direction];
|
|
10927
|
+
} else {
|
|
10928
|
+
valueTextAlign = direction === 'rtl' ? 'left' : 'right';
|
|
10929
|
+
}
|
|
10930
|
+
} else {
|
|
10931
|
+
valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
|
|
10932
|
+
}
|
|
10933
|
+
const ALLOWED_OPTIONS = ['left', 'center', 'right'];
|
|
10934
|
+
return ALLOWED_OPTIONS.includes(valueTextAlign) ? valueTextAlign : 'left';
|
|
10935
|
+
}
|
|
10936
|
+
|
|
10831
10937
|
function RowColumn(_ref) {
|
|
10832
10938
|
var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
|
|
10833
10939
|
let {
|
|
@@ -10863,10 +10969,10 @@ function RowColumn(_ref) {
|
|
|
10863
10969
|
columnCount = 1,
|
|
10864
10970
|
rowCount = 1,
|
|
10865
10971
|
dataOffset,
|
|
10972
|
+
deducedFrequencyMode,
|
|
10866
10973
|
focusListItems,
|
|
10867
10974
|
listCount,
|
|
10868
|
-
|
|
10869
|
-
frequencyWidth,
|
|
10975
|
+
sizes,
|
|
10870
10976
|
translator,
|
|
10871
10977
|
showSearch,
|
|
10872
10978
|
isModal
|
|
@@ -10876,6 +10982,9 @@ function RowColumn(_ref) {
|
|
|
10876
10982
|
dataLayout = 'singleColumn',
|
|
10877
10983
|
layoutOrder
|
|
10878
10984
|
} = layoutOptions;
|
|
10985
|
+
const {
|
|
10986
|
+
itemPadding
|
|
10987
|
+
} = sizes;
|
|
10879
10988
|
let cellIndex;
|
|
10880
10989
|
let styles;
|
|
10881
10990
|
const count = {
|
|
@@ -10943,26 +11052,15 @@ function RowColumn(_ref) {
|
|
|
10943
11052
|
const preventContextMenu = useCallback(event => {
|
|
10944
11053
|
event.preventDefault();
|
|
10945
11054
|
}, [checkboxes]);
|
|
11055
|
+
const valueTextAlign = useMemo$1(() => cell && getValueTextAlign({
|
|
11056
|
+
direction,
|
|
11057
|
+
cell,
|
|
11058
|
+
textAlign
|
|
11059
|
+
}), [direction, cell, textAlign]);
|
|
10946
11060
|
if (!cell) {
|
|
10947
11061
|
return null; // prevent rendering empty rows
|
|
10948
11062
|
}
|
|
10949
11063
|
|
|
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
11064
|
const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
|
|
10967
11065
|
const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
|
|
10968
11066
|
// Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
|
|
@@ -10977,17 +11075,16 @@ function RowColumn(_ref) {
|
|
|
10977
11075
|
display: 'flex',
|
|
10978
11076
|
fontSize: '8px'
|
|
10979
11077
|
};
|
|
11078
|
+
const isRtl = direction === 'rtl';
|
|
10980
11079
|
const cellStyle = {
|
|
10981
11080
|
display: 'flex',
|
|
10982
11081
|
alignItems: 'center',
|
|
10983
|
-
minWidth: 0,
|
|
10984
11082
|
flexGrow: 1,
|
|
10985
|
-
paddingLeft:
|
|
10986
|
-
paddingRight: checkboxes ? 0 :
|
|
11083
|
+
paddingLeft: isRtl ? 8 : checkboxes ? 0 : undefined,
|
|
11084
|
+
paddingRight: checkboxes ? 0 : isRtl ? 8 : 0,
|
|
10987
11085
|
justifyContent: valueTextAlign
|
|
10988
11086
|
};
|
|
10989
11087
|
const isFirstElement = index === 0;
|
|
10990
|
-
const flexBasisVal = checkboxes ? 'auto' : 'max-content';
|
|
10991
11088
|
const showLock = isSelected && isLocked;
|
|
10992
11089
|
const showTick = !checkboxes && isSelected && !isLocked;
|
|
10993
11090
|
const showIcon = !checkboxes && sizePermitsTickOrLock;
|
|
@@ -11000,15 +11097,18 @@ function RowColumn(_ref) {
|
|
|
11000
11097
|
maxIndex: count.max,
|
|
11001
11098
|
showSearch
|
|
11002
11099
|
});
|
|
11100
|
+
const freqHitsValue = !isRtl && valueTextAlign === 'right' || isRtl && valueTextAlign === 'left';
|
|
11003
11101
|
return /*#__PURE__*/React__default.createElement(RowColRoot$1, {
|
|
11004
11102
|
className: rowColClasses.barContainer,
|
|
11005
|
-
|
|
11103
|
+
checkboxes: checkboxes,
|
|
11006
11104
|
style: styles,
|
|
11007
11105
|
isGridCol: isGridCol,
|
|
11008
11106
|
isGridMode: dataLayout === 'grid',
|
|
11009
11107
|
dense: dense,
|
|
11010
|
-
frequencyWidth: frequencyWidth,
|
|
11011
11108
|
direction: direction,
|
|
11109
|
+
sizes: sizes,
|
|
11110
|
+
frequencyMode: deducedFrequencyMode,
|
|
11111
|
+
freqHitsValue: freqHitsValue,
|
|
11012
11112
|
"data-testid": "listbox.item"
|
|
11013
11113
|
}, /*#__PURE__*/React__default.createElement(ItemGrid, {
|
|
11014
11114
|
role: "row",
|
|
@@ -12632,7 +12732,7 @@ function getListBoxComponents(_ref) {
|
|
|
12632
12732
|
pages,
|
|
12633
12733
|
selectDisabled,
|
|
12634
12734
|
interactionEvents,
|
|
12635
|
-
|
|
12735
|
+
deducedFrequencyMode,
|
|
12636
12736
|
histogram,
|
|
12637
12737
|
isSingleSelect,
|
|
12638
12738
|
select,
|
|
@@ -12662,12 +12762,10 @@ function getListBoxComponents(_ref) {
|
|
|
12662
12762
|
} = layout || {};
|
|
12663
12763
|
const {
|
|
12664
12764
|
columnWidth,
|
|
12665
|
-
itemPadding,
|
|
12666
12765
|
listHeight,
|
|
12667
12766
|
itemHeight,
|
|
12668
12767
|
rowCount,
|
|
12669
|
-
columnCount
|
|
12670
|
-
frequencyWidth
|
|
12768
|
+
columnCount
|
|
12671
12769
|
} = sizes || {};
|
|
12672
12770
|
const itemWidth = layoutOptions.dataLayout === 'grid' ? columnWidth : width;
|
|
12673
12771
|
const showTick = itemWidth > REMOVE_TICK_LIMIT;
|
|
@@ -12688,12 +12786,11 @@ function getListBoxComponents(_ref) {
|
|
|
12688
12786
|
}, isLocked || selectDisabled() ? {} : interactionEvents), {}, {
|
|
12689
12787
|
checkboxes,
|
|
12690
12788
|
layoutOptions,
|
|
12691
|
-
|
|
12789
|
+
deducedFrequencyMode,
|
|
12692
12790
|
freqIsAllowed,
|
|
12693
12791
|
isSingleSelect,
|
|
12694
12792
|
textAlign,
|
|
12695
|
-
|
|
12696
|
-
frequencyWidth,
|
|
12793
|
+
sizes,
|
|
12697
12794
|
actions: {
|
|
12698
12795
|
select,
|
|
12699
12796
|
confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
|
|
@@ -12878,16 +12975,46 @@ function calculateRowMode(_ref) {
|
|
|
12878
12975
|
};
|
|
12879
12976
|
}
|
|
12880
12977
|
|
|
12881
|
-
|
|
12978
|
+
const getContext = () => {
|
|
12979
|
+
const fragment = document.createDocumentFragment();
|
|
12980
|
+
const canvas = document.createElement('canvas');
|
|
12981
|
+
fragment.appendChild(canvas);
|
|
12982
|
+
return canvas.getContext('2d');
|
|
12983
|
+
};
|
|
12984
|
+
const getTextWidth = (currentText, font) => {
|
|
12985
|
+
const context = getContext();
|
|
12986
|
+
context.font = font;
|
|
12987
|
+
if (Array.isArray(currentText)) {
|
|
12988
|
+
return Math.max(...currentText.map(t => context.measureText(t).width));
|
|
12989
|
+
}
|
|
12990
|
+
const metrics = context.measureText(currentText);
|
|
12991
|
+
return Math.ceil(metrics.width || 0);
|
|
12992
|
+
};
|
|
12993
|
+
const useTextWidth = options => {
|
|
12994
|
+
const textOptions = useMemo$1(() => 'text' in options ? options : {}, [options]);
|
|
12995
|
+
return useMemo$1(() => getTextWidth(textOptions.text, textOptions.font || '12px Source Sans Pro'), [textOptions.text, textOptions.font]);
|
|
12996
|
+
};
|
|
12997
|
+
|
|
12998
|
+
function getMeasureText(layoutOrNumber) {
|
|
12999
|
+
if (!layoutOrNumber) {
|
|
13000
|
+
return '';
|
|
13001
|
+
}
|
|
13002
|
+
const maxGlyphCount = typeof layoutOrNumber === 'number' ? layoutOrNumber : layoutOrNumber.qListObject.qDimensionInfo.qApprMaxGlyphCount;
|
|
13003
|
+
const measureString = Array(maxGlyphCount).fill('M').join('');
|
|
13004
|
+
return measureString;
|
|
13005
|
+
}
|
|
13006
|
+
|
|
13007
|
+
function useListSizes(_ref) {
|
|
13008
|
+
var _theme$listBox;
|
|
12882
13009
|
let {
|
|
12883
13010
|
layout,
|
|
12884
13011
|
width,
|
|
12885
13012
|
height,
|
|
12886
13013
|
listCount,
|
|
12887
13014
|
count,
|
|
12888
|
-
textWidth,
|
|
12889
13015
|
freqIsAllowed,
|
|
12890
|
-
checkboxes
|
|
13016
|
+
checkboxes,
|
|
13017
|
+
theme
|
|
12891
13018
|
} = _ref;
|
|
12892
13019
|
const {
|
|
12893
13020
|
layoutOptions = {}
|
|
@@ -12899,7 +13026,24 @@ function getListSizes(_ref) {
|
|
|
12899
13026
|
dense,
|
|
12900
13027
|
dataLayout
|
|
12901
13028
|
} = layoutOptions;
|
|
12902
|
-
const
|
|
13029
|
+
const {
|
|
13030
|
+
fontSize = '12px',
|
|
13031
|
+
fontFamily = 'Source sans pro'
|
|
13032
|
+
} = ((_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
|
|
13033
|
+
const font = "".concat(fontSize, " ").concat(fontFamily); // font format as supported by HTML canvas
|
|
13034
|
+
const textWidth = useTextWidth({
|
|
13035
|
+
text: getMeasureText(layout),
|
|
13036
|
+
font
|
|
13037
|
+
});
|
|
13038
|
+
const freqMinWidth = useTextWidth({
|
|
13039
|
+
text: getMeasureText(5),
|
|
13040
|
+
font
|
|
13041
|
+
});
|
|
13042
|
+
const freqMaxWidth = useTextWidth({
|
|
13043
|
+
text: getMeasureText(8),
|
|
13044
|
+
font
|
|
13045
|
+
});
|
|
13046
|
+
const frequencyAddWidth = freqIsAllowed ? freqMinWidth : 0;
|
|
12903
13047
|
const checkboxAddWidth = checkboxes ? CHECKBOX_WIDTH : 0;
|
|
12904
13048
|
const tickIconWidth = CHECKBOX_WIDTH;
|
|
12905
13049
|
let dynamicItemMinWidth = ITEM_MIN_WIDTH + frequencyAddWidth + checkboxAddWidth;
|
|
@@ -12980,6 +13124,7 @@ function getListSizes(_ref) {
|
|
|
12980
13124
|
overflowStyling,
|
|
12981
13125
|
itemHeight,
|
|
12982
13126
|
listHeight,
|
|
13127
|
+
listWidth: width,
|
|
12983
13128
|
scrollBarWidth: SCROLL_BAR_WIDTH,
|
|
12984
13129
|
count,
|
|
12985
13130
|
listCount: limitedListCount,
|
|
@@ -12988,42 +13133,12 @@ function getListSizes(_ref) {
|
|
|
12988
13133
|
column: maxColumnCount
|
|
12989
13134
|
},
|
|
12990
13135
|
itemPadding,
|
|
12991
|
-
|
|
13136
|
+
textWidth,
|
|
13137
|
+
freqMinWidth,
|
|
13138
|
+
freqMaxWidth
|
|
12992
13139
|
};
|
|
12993
13140
|
}
|
|
12994
13141
|
|
|
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
13142
|
function getHorizontalMinBatchSize(_ref) {
|
|
13028
13143
|
let {
|
|
13029
13144
|
width,
|
|
@@ -13503,7 +13618,7 @@ function getFrequencyAllowed(_ref) {
|
|
|
13503
13618
|
const {
|
|
13504
13619
|
frequencyEnabled = false
|
|
13505
13620
|
} = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
|
|
13506
|
-
const hasValidFreqOption = !['
|
|
13621
|
+
const hasValidFreqOption = !['N', undefined].includes(frequencyMode);
|
|
13507
13622
|
return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
|
|
13508
13623
|
}
|
|
13509
13624
|
|
|
@@ -13550,6 +13665,21 @@ const useFrequencyMax = (app, layout) => {
|
|
|
13550
13665
|
};
|
|
13551
13666
|
};
|
|
13552
13667
|
|
|
13668
|
+
function deduceFrequencyMode(pages) {
|
|
13669
|
+
const hasPercentSign = pages.some(_ref => {
|
|
13670
|
+
let {
|
|
13671
|
+
qMatrix
|
|
13672
|
+
} = _ref;
|
|
13673
|
+
return qMatrix.some(_ref2 => {
|
|
13674
|
+
var _item$qFrequency;
|
|
13675
|
+
let [item] = _ref2;
|
|
13676
|
+
return !!((_item$qFrequency = item.qFrequency) !== null && _item$qFrequency !== void 0 && _item$qFrequency.match('%'));
|
|
13677
|
+
});
|
|
13678
|
+
});
|
|
13679
|
+
const OTHER = '-'; // treat all other as '-' (change later if we need to identify other modes)
|
|
13680
|
+
return hasPercentSign ? 'P' : OTHER;
|
|
13681
|
+
}
|
|
13682
|
+
|
|
13553
13683
|
const _excluded$4 = ["isLoadingData"];
|
|
13554
13684
|
const DEFAULT_MIN_BATCH_SIZE = 100;
|
|
13555
13685
|
const StyledWrapper = styled$4('div')(() => ({
|
|
@@ -13566,6 +13696,7 @@ function ListBox(_ref) {
|
|
|
13566
13696
|
model,
|
|
13567
13697
|
app,
|
|
13568
13698
|
constraints,
|
|
13699
|
+
theme,
|
|
13569
13700
|
layout,
|
|
13570
13701
|
selections,
|
|
13571
13702
|
selectionState,
|
|
@@ -13603,6 +13734,7 @@ function ListBox(_ref) {
|
|
|
13603
13734
|
checkboxes = checkboxOption,
|
|
13604
13735
|
histogram
|
|
13605
13736
|
} = layout !== null && layout !== void 0 ? layout : {};
|
|
13737
|
+
const [screenReaderText, setScreenReaderText] = useState$1('');
|
|
13606
13738
|
const loaderRef = useRef(null);
|
|
13607
13739
|
const local = useRef({
|
|
13608
13740
|
queue: [],
|
|
@@ -13630,6 +13762,7 @@ function ListBox(_ref) {
|
|
|
13630
13762
|
}),
|
|
13631
13763
|
itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
|
|
13632
13764
|
const {
|
|
13765
|
+
getStoreValue,
|
|
13633
13766
|
setStoreValue
|
|
13634
13767
|
} = useDataStore(model);
|
|
13635
13768
|
const loadMoreItems = useCallback(itemsLoader.loadMoreItems, [layout]);
|
|
@@ -13721,10 +13854,6 @@ function ListBox(_ref) {
|
|
|
13721
13854
|
useEffect$1(() => {
|
|
13722
13855
|
fetchData();
|
|
13723
13856
|
}, [layout, local.current.dataOffset]);
|
|
13724
|
-
const textWidth = useTextWidth({
|
|
13725
|
-
text: getMeasureText(layout),
|
|
13726
|
-
font: '14px Source sans pro'
|
|
13727
|
-
});
|
|
13728
13857
|
let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
|
|
13729
13858
|
const isVertical = layoutOptions.dataLayout !== 'grid';
|
|
13730
13859
|
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 +13870,16 @@ function ListBox(_ref) {
|
|
|
13741
13870
|
layout,
|
|
13742
13871
|
frequencyMode
|
|
13743
13872
|
});
|
|
13744
|
-
const
|
|
13873
|
+
const deducedFrequencyMode = deduceFrequencyMode(pages);
|
|
13874
|
+
const sizes = useListSizes({
|
|
13745
13875
|
layout,
|
|
13746
13876
|
width,
|
|
13747
13877
|
height,
|
|
13748
13878
|
listCount: unlimitedListCount,
|
|
13749
13879
|
count,
|
|
13750
|
-
textWidth,
|
|
13751
13880
|
freqIsAllowed,
|
|
13752
|
-
checkboxes
|
|
13881
|
+
checkboxes,
|
|
13882
|
+
theme
|
|
13753
13883
|
});
|
|
13754
13884
|
if (sizes.columnWidth) {
|
|
13755
13885
|
// In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
|
|
@@ -13763,6 +13893,14 @@ function ListBox(_ref) {
|
|
|
13763
13893
|
listCount
|
|
13764
13894
|
} = sizes;
|
|
13765
13895
|
setStoreValue('listCount', listCount);
|
|
13896
|
+
const inputText = getStoreValue('inputText');
|
|
13897
|
+
useEffect$1(() => {
|
|
13898
|
+
if (inputText) {
|
|
13899
|
+
const srText = getScreenReaderSearchText(listCount);
|
|
13900
|
+
const srFinalText = translator.get(srText, [listCount]);
|
|
13901
|
+
setScreenReaderText(srFinalText);
|
|
13902
|
+
}
|
|
13903
|
+
}, [inputText, listCount]);
|
|
13766
13904
|
const setScrollPosition = position => {
|
|
13767
13905
|
const {
|
|
13768
13906
|
scrollIndex,
|
|
@@ -13826,7 +13964,7 @@ function ListBox(_ref) {
|
|
|
13826
13964
|
height,
|
|
13827
13965
|
width,
|
|
13828
13966
|
checkboxes,
|
|
13829
|
-
|
|
13967
|
+
deducedFrequencyMode,
|
|
13830
13968
|
histogram,
|
|
13831
13969
|
keyboard,
|
|
13832
13970
|
showGray,
|
|
@@ -13874,7 +14012,10 @@ function ListBox(_ref) {
|
|
|
13874
14012
|
return /*#__PURE__*/React__default.createElement(StyledWrapper, null, /*#__PURE__*/React__default.createElement(ScreenReaderForSelections, {
|
|
13875
14013
|
className: "screenReaderOnly",
|
|
13876
14014
|
layout: layout
|
|
13877
|
-
}),
|
|
14015
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
14016
|
+
className: "screenReaderOnly",
|
|
14017
|
+
"aria-live": "assertive"
|
|
14018
|
+
}, screenReaderText), !listCount && cardinal > 0 && /*#__PURE__*/React__default.createElement(ListBoxDisclaimer, {
|
|
13878
14019
|
width: width,
|
|
13879
14020
|
text: "Listbox.NoMatchesForYourTerms"
|
|
13880
14021
|
}), /*#__PURE__*/React__default.createElement(InfiniteLoader, {
|
|
@@ -14583,7 +14724,8 @@ function ListBoxSearch(_ref3) {
|
|
|
14583
14724
|
const inputRef = useRef();
|
|
14584
14725
|
const theme = useTheme$1();
|
|
14585
14726
|
const {
|
|
14586
|
-
getStoreValue
|
|
14727
|
+
getStoreValue,
|
|
14728
|
+
setStoreValue
|
|
14587
14729
|
} = useDataStore(model);
|
|
14588
14730
|
const isRtl = direction === 'rtl';
|
|
14589
14731
|
const inpuTextAlign = isRtl ? 'right' : 'left';
|
|
@@ -14616,6 +14758,9 @@ function ListBoxSearch(_ref3) {
|
|
|
14616
14758
|
setWildcardOn(false);
|
|
14617
14759
|
}
|
|
14618
14760
|
}, [wildcardOn, inputRef.current]);
|
|
14761
|
+
useEffect$1(() => {
|
|
14762
|
+
setStoreValue('inputText', value);
|
|
14763
|
+
}, [value]);
|
|
14619
14764
|
const onChange = async e => {
|
|
14620
14765
|
setValue(e.target.value);
|
|
14621
14766
|
if (!e.target.value.length) {
|
|
@@ -14750,7 +14895,8 @@ function ListBoxSearch(_ref3) {
|
|
|
14750
14895
|
style: {
|
|
14751
14896
|
textAlign: "".concat(inpuTextAlign)
|
|
14752
14897
|
},
|
|
14753
|
-
'data-testid': 'search-input-field'
|
|
14898
|
+
'data-testid': 'search-input-field',
|
|
14899
|
+
'aria-label': translator.get('ScreenReader.SearchFieldLabel')
|
|
14754
14900
|
}
|
|
14755
14901
|
});
|
|
14756
14902
|
}
|
|
@@ -16113,21 +16259,6 @@ function mount(_ref2) {
|
|
|
16113
16259
|
}), element, uid());
|
|
16114
16260
|
}
|
|
16115
16261
|
|
|
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
16262
|
/**
|
|
16132
16263
|
* Detect Element Resize.
|
|
16133
16264
|
* https://github.com/sdecima/javascript-detect-element-resize
|
|
@@ -16138,346 +16269,371 @@ var $3e40d2fd7fdb47d2$exports = {};
|
|
|
16138
16269
|
* 2) Defer initialization code via a top-level function wrapper (to support SSR).
|
|
16139
16270
|
* 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
|
|
16140
16271
|
* 4) Add nonce for style element.
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
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
|
-
};
|
|
16272
|
+
* 5) Use 'export' statement over 'module.exports' assignment
|
|
16273
|
+
**/
|
|
16274
|
+
|
|
16275
|
+
// Check `document` and `window` in case of server-side rendering
|
|
16276
|
+
let windowObject;
|
|
16277
|
+
if (typeof window !== "undefined") {
|
|
16278
|
+
windowObject = window;
|
|
16279
|
+
|
|
16280
|
+
// eslint-disable-next-line no-restricted-globals
|
|
16281
|
+
} else if (typeof self !== "undefined") {
|
|
16282
|
+
// eslint-disable-next-line no-restricted-globals
|
|
16283
|
+
windowObject = self;
|
|
16161
16284
|
} else {
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16285
|
+
windowObject = global;
|
|
16286
|
+
}
|
|
16287
|
+
let cancelFrame = null;
|
|
16288
|
+
let requestFrame = null;
|
|
16289
|
+
const TIMEOUT_DURATION = 20;
|
|
16290
|
+
const clearTimeoutFn = windowObject.clearTimeout;
|
|
16291
|
+
const setTimeoutFn = windowObject.setTimeout;
|
|
16292
|
+
const cancelAnimationFrameFn = windowObject.cancelAnimationFrame || windowObject.mozCancelAnimationFrame || windowObject.webkitCancelAnimationFrame;
|
|
16293
|
+
const requestAnimationFrameFn = windowObject.requestAnimationFrame || windowObject.mozRequestAnimationFrame || windowObject.webkitRequestAnimationFrame;
|
|
16294
|
+
if (cancelAnimationFrameFn == null || requestAnimationFrameFn == null) {
|
|
16295
|
+
// For environments that don't support animation frame,
|
|
16296
|
+
// fallback to a setTimeout based approach.
|
|
16297
|
+
cancelFrame = clearTimeoutFn;
|
|
16298
|
+
requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
|
|
16299
|
+
return setTimeoutFn(callback, TIMEOUT_DURATION);
|
|
16300
|
+
};
|
|
16301
|
+
} else {
|
|
16302
|
+
// Counter intuitively, environments that support animation frames can be trickier.
|
|
16303
|
+
// Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
|
|
16304
|
+
// In this case, we should fallback to a setTimeout() implementation.
|
|
16305
|
+
cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
|
|
16306
|
+
cancelAnimationFrameFn(animationFrameID);
|
|
16307
|
+
clearTimeoutFn(timeoutID);
|
|
16308
|
+
};
|
|
16309
|
+
requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
|
|
16310
|
+
const animationFrameID = requestAnimationFrameFn(function animationFrameCallback() {
|
|
16311
|
+
clearTimeoutFn(timeoutID);
|
|
16312
|
+
callback();
|
|
16313
|
+
});
|
|
16314
|
+
const timeoutID = setTimeoutFn(function timeoutCallback() {
|
|
16315
|
+
cancelAnimationFrameFn(animationFrameID);
|
|
16316
|
+
callback();
|
|
16317
|
+
}, TIMEOUT_DURATION);
|
|
16318
|
+
return [animationFrameID, timeoutID];
|
|
16319
|
+
};
|
|
16183
16320
|
}
|
|
16184
|
-
function
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16204
|
-
|
|
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
|
-
}
|
|
16321
|
+
function createDetectElementResize(nonce) {
|
|
16322
|
+
let animationKeyframes;
|
|
16323
|
+
let animationName;
|
|
16324
|
+
let animationStartEvent;
|
|
16325
|
+
let animationStyle;
|
|
16326
|
+
let checkTriggers;
|
|
16327
|
+
let resetTriggers;
|
|
16328
|
+
let scrollListener;
|
|
16329
|
+
const attachEvent = typeof document !== "undefined" && document.attachEvent;
|
|
16330
|
+
if (!attachEvent) {
|
|
16331
|
+
resetTriggers = function (element) {
|
|
16332
|
+
const triggers = element.__resizeTriggers__,
|
|
16333
|
+
expand = triggers.firstElementChild,
|
|
16334
|
+
contract = triggers.lastElementChild,
|
|
16335
|
+
expandChild = expand.firstElementChild;
|
|
16336
|
+
contract.scrollLeft = contract.scrollWidth;
|
|
16337
|
+
contract.scrollTop = contract.scrollHeight;
|
|
16338
|
+
expandChild.style.width = expand.offsetWidth + 1 + "px";
|
|
16339
|
+
expandChild.style.height = expand.offsetHeight + 1 + "px";
|
|
16340
|
+
expand.scrollLeft = expand.scrollWidth;
|
|
16341
|
+
expand.scrollTop = expand.scrollHeight;
|
|
16256
16342
|
};
|
|
16257
|
-
|
|
16258
|
-
|
|
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
|
-
}
|
|
16343
|
+
checkTriggers = function (element) {
|
|
16344
|
+
return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
|
|
16287
16345
|
};
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
|
|
16292
|
-
|
|
16293
|
-
|
|
16294
|
-
|
|
16295
|
-
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16301
|
-
|
|
16302
|
-
|
|
16303
|
-
|
|
16346
|
+
scrollListener = function (e) {
|
|
16347
|
+
// Don't measure (which forces) reflow for scrolls that happen inside of children!
|
|
16348
|
+
if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) {
|
|
16349
|
+
return;
|
|
16350
|
+
}
|
|
16351
|
+
const element = this;
|
|
16352
|
+
resetTriggers(this);
|
|
16353
|
+
if (this.__resizeRAF__) {
|
|
16354
|
+
cancelFrame(this.__resizeRAF__);
|
|
16355
|
+
}
|
|
16356
|
+
this.__resizeRAF__ = requestFrame(function animationFrame() {
|
|
16357
|
+
if (checkTriggers(element)) {
|
|
16358
|
+
element.__resizeLast__.width = element.offsetWidth;
|
|
16359
|
+
element.__resizeLast__.height = element.offsetHeight;
|
|
16360
|
+
element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
|
|
16361
|
+
fn.call(element, e);
|
|
16362
|
+
});
|
|
16304
16363
|
}
|
|
16364
|
+
});
|
|
16305
16365
|
};
|
|
16306
|
-
return {
|
|
16307
|
-
addResizeListener: addResizeListener,
|
|
16308
|
-
removeResizeListener: removeResizeListener
|
|
16309
|
-
};
|
|
16310
|
-
}
|
|
16311
|
-
$3e40d2fd7fdb47d2$exports = {
|
|
16312
|
-
createDetectElementResize: $3e40d2fd7fdb47d2$var$createDetectElementResize
|
|
16313
|
-
};
|
|
16314
|
-
|
|
16315
16366
|
|
|
16316
|
-
|
|
16317
|
-
|
|
16318
|
-
|
|
16319
|
-
|
|
16320
|
-
|
|
16321
|
-
|
|
16322
|
-
|
|
16323
|
-
|
|
16324
|
-
|
|
16325
|
-
|
|
16326
|
-
|
|
16327
|
-
|
|
16328
|
-
|
|
16329
|
-
|
|
16330
|
-
|
|
16331
|
-
|
|
16332
|
-
|
|
16333
|
-
|
|
16334
|
-
|
|
16335
|
-
|
|
16336
|
-
|
|
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
|
-
}
|
|
16367
|
+
/* Detect CSS Animations support to detect element display/re-attach */
|
|
16368
|
+
let animation = false;
|
|
16369
|
+
let keyframeprefix = "";
|
|
16370
|
+
animationStartEvent = "animationstart";
|
|
16371
|
+
const domPrefixes = "Webkit Moz O ms".split(" ");
|
|
16372
|
+
let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
|
|
16373
|
+
let pfx = "";
|
|
16374
|
+
{
|
|
16375
|
+
const elm = document.createElement("fakeelement");
|
|
16376
|
+
if (elm.style.animationName !== undefined) {
|
|
16377
|
+
animation = true;
|
|
16378
|
+
}
|
|
16379
|
+
if (animation === false) {
|
|
16380
|
+
for (let i = 0; i < domPrefixes.length; i++) {
|
|
16381
|
+
if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
|
|
16382
|
+
pfx = domPrefixes[i];
|
|
16383
|
+
keyframeprefix = "-" + pfx.toLowerCase() + "-";
|
|
16384
|
+
animationStartEvent = startEvents[i];
|
|
16385
|
+
animation = true;
|
|
16386
|
+
break;
|
|
16387
|
+
}
|
|
16415
16388
|
}
|
|
16389
|
+
}
|
|
16416
16390
|
}
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16391
|
+
animationName = "resizeanim";
|
|
16392
|
+
animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
|
|
16393
|
+
animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
|
|
16394
|
+
}
|
|
16395
|
+
const createStyles = function (doc) {
|
|
16396
|
+
if (!doc.getElementById("detectElementResize")) {
|
|
16397
|
+
//opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
|
|
16398
|
+
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%; }',
|
|
16399
|
+
head = doc.head || doc.getElementsByTagName("head")[0],
|
|
16400
|
+
style = doc.createElement("style");
|
|
16401
|
+
style.id = "detectElementResize";
|
|
16402
|
+
style.type = "text/css";
|
|
16403
|
+
if (nonce != null) {
|
|
16404
|
+
style.setAttribute("nonce", nonce);
|
|
16405
|
+
}
|
|
16406
|
+
if (style.styleSheet) {
|
|
16407
|
+
style.styleSheet.cssText = css;
|
|
16408
|
+
} else {
|
|
16409
|
+
style.appendChild(doc.createTextNode(css));
|
|
16410
|
+
}
|
|
16411
|
+
head.appendChild(style);
|
|
16412
|
+
}
|
|
16413
|
+
};
|
|
16414
|
+
const addResizeListener = function (element, fn) {
|
|
16415
|
+
if (attachEvent) {
|
|
16416
|
+
element.attachEvent("onresize", fn);
|
|
16417
|
+
} else {
|
|
16418
|
+
if (!element.__resizeTriggers__) {
|
|
16419
|
+
const doc = element.ownerDocument;
|
|
16420
|
+
const elementStyle = windowObject.getComputedStyle(element);
|
|
16421
|
+
if (elementStyle && elementStyle.position === "static") {
|
|
16422
|
+
element.style.position = "relative";
|
|
16423
|
+
}
|
|
16424
|
+
createStyles(doc);
|
|
16425
|
+
element.__resizeLast__ = {};
|
|
16426
|
+
element.__resizeListeners__ = [];
|
|
16427
|
+
(element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
|
|
16428
|
+
const expandTrigger = doc.createElement("div");
|
|
16429
|
+
expandTrigger.className = "expand-trigger";
|
|
16430
|
+
expandTrigger.appendChild(doc.createElement("div"));
|
|
16431
|
+
const contractTrigger = doc.createElement("div");
|
|
16432
|
+
contractTrigger.className = "contract-trigger";
|
|
16433
|
+
element.__resizeTriggers__.appendChild(expandTrigger);
|
|
16434
|
+
element.__resizeTriggers__.appendChild(contractTrigger);
|
|
16435
|
+
element.appendChild(element.__resizeTriggers__);
|
|
16436
|
+
resetTriggers(element);
|
|
16437
|
+
element.addEventListener("scroll", scrollListener, true);
|
|
16438
|
+
|
|
16439
|
+
/* Listen for a css animation to detect element display/re-attach */
|
|
16440
|
+
if (animationStartEvent) {
|
|
16441
|
+
element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
|
|
16442
|
+
if (e.animationName === animationName) {
|
|
16443
|
+
resetTriggers(element);
|
|
16423
16444
|
}
|
|
16445
|
+
};
|
|
16446
|
+
element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
|
|
16424
16447
|
}
|
|
16448
|
+
}
|
|
16449
|
+
element.__resizeListeners__.push(fn);
|
|
16425
16450
|
}
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
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;
|
|
16451
|
+
};
|
|
16452
|
+
const removeResizeListener = function (element, fn) {
|
|
16453
|
+
if (attachEvent) {
|
|
16454
|
+
element.detachEvent("onresize", fn);
|
|
16455
|
+
} else {
|
|
16456
|
+
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
|
|
16457
|
+
if (!element.__resizeListeners__.length) {
|
|
16458
|
+
element.removeEventListener("scroll", scrollListener, true);
|
|
16459
|
+
if (element.__resizeTriggers__.__animationListener__) {
|
|
16460
|
+
element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
|
|
16461
|
+
element.__resizeTriggers__.__animationListener__ = null;
|
|
16444
16462
|
}
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
childParams.scaledWidth = scaledWidth;
|
|
16463
|
+
try {
|
|
16464
|
+
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
|
|
16465
|
+
} catch (e) {
|
|
16466
|
+
// Preact compat; see developit/preact-compat/issues/228
|
|
16450
16467
|
}
|
|
16451
|
-
|
|
16452
|
-
ref: this._setRef,
|
|
16453
|
-
style: {
|
|
16454
|
-
...outerStyle,
|
|
16455
|
-
...style
|
|
16456
|
-
},
|
|
16457
|
-
...rest
|
|
16458
|
-
}, !bailoutOnChildren && children(childParams));
|
|
16468
|
+
}
|
|
16459
16469
|
}
|
|
16470
|
+
};
|
|
16471
|
+
return {
|
|
16472
|
+
addResizeListener,
|
|
16473
|
+
removeResizeListener
|
|
16474
|
+
};
|
|
16460
16475
|
}
|
|
16461
16476
|
|
|
16477
|
+
class AutoSizer extends Component {
|
|
16478
|
+
constructor(...args) {
|
|
16479
|
+
super(...args);
|
|
16480
|
+
this.state = {
|
|
16481
|
+
height: this.props.defaultHeight || 0,
|
|
16482
|
+
scaledHeight: this.props.defaultHeight || 0,
|
|
16483
|
+
scaledWidth: this.props.defaultWidth || 0,
|
|
16484
|
+
width: this.props.defaultWidth || 0
|
|
16485
|
+
};
|
|
16486
|
+
this._autoSizer = null;
|
|
16487
|
+
this._detectElementResize = null;
|
|
16488
|
+
this._parentNode = null;
|
|
16489
|
+
this._resizeObserver = null;
|
|
16490
|
+
this._timeoutId = null;
|
|
16491
|
+
this._onResize = () => {
|
|
16492
|
+
this._timeoutId = null;
|
|
16493
|
+
const {
|
|
16494
|
+
disableHeight,
|
|
16495
|
+
disableWidth,
|
|
16496
|
+
onResize
|
|
16497
|
+
} = this.props;
|
|
16498
|
+
if (this._parentNode) {
|
|
16499
|
+
var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
|
|
16500
|
+
// Guard against AutoSizer component being removed from the DOM immediately after being added.
|
|
16501
|
+
// This can result in invalid style values which can result in NaN values if we don't handle them.
|
|
16502
|
+
// See issue #150 for more context.
|
|
16503
|
+
|
|
16504
|
+
const style = window.getComputedStyle(this._parentNode) || {};
|
|
16505
|
+
const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
|
|
16506
|
+
const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
|
|
16507
|
+
const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
|
|
16508
|
+
const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
|
|
16509
|
+
const rect = this._parentNode.getBoundingClientRect();
|
|
16510
|
+
const scaledHeight = rect.height - paddingTop - paddingBottom;
|
|
16511
|
+
const scaledWidth = rect.width - paddingLeft - paddingRight;
|
|
16512
|
+
const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
|
|
16513
|
+
const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
|
|
16514
|
+
if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
|
|
16515
|
+
this.setState({
|
|
16516
|
+
height,
|
|
16517
|
+
width,
|
|
16518
|
+
scaledHeight,
|
|
16519
|
+
scaledWidth
|
|
16520
|
+
});
|
|
16521
|
+
if (typeof onResize === "function") {
|
|
16522
|
+
onResize({
|
|
16523
|
+
height,
|
|
16524
|
+
scaledHeight,
|
|
16525
|
+
scaledWidth,
|
|
16526
|
+
width
|
|
16527
|
+
});
|
|
16528
|
+
}
|
|
16529
|
+
}
|
|
16530
|
+
}
|
|
16531
|
+
};
|
|
16532
|
+
this._setRef = autoSizer => {
|
|
16533
|
+
this._autoSizer = autoSizer;
|
|
16534
|
+
};
|
|
16535
|
+
}
|
|
16536
|
+
componentDidMount() {
|
|
16537
|
+
const {
|
|
16538
|
+
nonce
|
|
16539
|
+
} = this.props;
|
|
16540
|
+
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) {
|
|
16541
|
+
// Delay access of parentNode until mount.
|
|
16542
|
+
// This handles edge-cases where the component has already been unmounted before its ref has been set,
|
|
16543
|
+
// As well as libraries like react-lite which have a slightly different lifecycle.
|
|
16544
|
+
this._parentNode = this._autoSizer.parentNode;
|
|
16545
|
+
|
|
16546
|
+
// Defer requiring resize handler in order to support server-side rendering.
|
|
16547
|
+
// See issue #41
|
|
16548
|
+
if (this._parentNode != null) {
|
|
16549
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
16550
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
16551
|
+
// Guard against "ResizeObserver loop limit exceeded" error;
|
|
16552
|
+
// could be triggered if the state update causes the ResizeObserver handler to run long.
|
|
16553
|
+
// See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
|
|
16554
|
+
this._timeoutId = setTimeout(this._onResize, 0);
|
|
16555
|
+
});
|
|
16556
|
+
this._resizeObserver.observe(this._parentNode);
|
|
16557
|
+
} else {
|
|
16558
|
+
this._detectElementResize = createDetectElementResize(nonce);
|
|
16559
|
+
this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
|
|
16560
|
+
}
|
|
16561
|
+
this._onResize();
|
|
16562
|
+
}
|
|
16563
|
+
}
|
|
16564
|
+
}
|
|
16565
|
+
componentWillUnmount() {
|
|
16566
|
+
if (this._parentNode) {
|
|
16567
|
+
if (this._detectElementResize) {
|
|
16568
|
+
this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
|
|
16569
|
+
}
|
|
16570
|
+
if (this._timeoutId !== null) {
|
|
16571
|
+
clearTimeout(this._timeoutId);
|
|
16572
|
+
}
|
|
16573
|
+
if (this._resizeObserver) {
|
|
16574
|
+
this._resizeObserver.observe(this._parentNode);
|
|
16575
|
+
this._resizeObserver.disconnect();
|
|
16576
|
+
}
|
|
16577
|
+
}
|
|
16578
|
+
}
|
|
16579
|
+
render() {
|
|
16580
|
+
const {
|
|
16581
|
+
children,
|
|
16582
|
+
defaultHeight,
|
|
16583
|
+
defaultWidth,
|
|
16584
|
+
disableHeight = false,
|
|
16585
|
+
disableWidth = false,
|
|
16586
|
+
nonce,
|
|
16587
|
+
onResize,
|
|
16588
|
+
style = {},
|
|
16589
|
+
tagName = "div",
|
|
16590
|
+
...rest
|
|
16591
|
+
} = this.props;
|
|
16592
|
+
const {
|
|
16593
|
+
height,
|
|
16594
|
+
scaledHeight,
|
|
16595
|
+
scaledWidth,
|
|
16596
|
+
width
|
|
16597
|
+
} = this.state;
|
|
16462
16598
|
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16599
|
+
// Outer div should not force width/height since that may prevent containers from shrinking.
|
|
16600
|
+
// Inner component should overflow and use calculated width/height.
|
|
16601
|
+
// See issue #68 for more information.
|
|
16602
|
+
const outerStyle = {
|
|
16603
|
+
overflow: "visible"
|
|
16604
|
+
};
|
|
16605
|
+
const childParams = {};
|
|
16606
|
+
|
|
16607
|
+
// Avoid rendering children before the initial measurements have been collected.
|
|
16608
|
+
// At best this would just be wasting cycles.
|
|
16609
|
+
let bailoutOnChildren = false;
|
|
16610
|
+
if (!disableHeight) {
|
|
16611
|
+
if (height === 0) {
|
|
16612
|
+
bailoutOnChildren = true;
|
|
16613
|
+
}
|
|
16614
|
+
outerStyle.height = 0;
|
|
16615
|
+
childParams.height = height;
|
|
16616
|
+
childParams.scaledHeight = scaledHeight;
|
|
16617
|
+
}
|
|
16618
|
+
if (!disableWidth) {
|
|
16619
|
+
if (width === 0) {
|
|
16620
|
+
bailoutOnChildren = true;
|
|
16621
|
+
}
|
|
16622
|
+
outerStyle.width = 0;
|
|
16623
|
+
childParams.width = width;
|
|
16624
|
+
childParams.scaledWidth = scaledWidth;
|
|
16625
|
+
}
|
|
16626
|
+
return createElement(tagName, {
|
|
16627
|
+
ref: this._setRef,
|
|
16628
|
+
style: {
|
|
16629
|
+
...outerStyle,
|
|
16630
|
+
...style
|
|
16631
|
+
},
|
|
16632
|
+
...rest
|
|
16633
|
+
}, !bailoutOnChildren && children(childParams));
|
|
16634
|
+
}
|
|
16476
16635
|
}
|
|
16477
16636
|
|
|
16478
|
-
|
|
16479
|
-
var $149c1bd638913645$export$2e2bcd8739ae039 = ($6e2bb92d9db3b0c8$export$9d94f4ee1d930ff);
|
|
16480
|
-
|
|
16481
16637
|
const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
|
|
16482
16638
|
shapes: [{
|
|
16483
16639
|
type: 'path',
|
|
@@ -17228,7 +17384,7 @@ function ListBoxInline(_ref4) {
|
|
|
17228
17384
|
className: classes$4.screenReaderOnly
|
|
17229
17385
|
}, translator.get('Listbox.ScreenReaderInstructions')), isInvalid ? /*#__PURE__*/React__default.createElement(ListBoxError, {
|
|
17230
17386
|
text: errorText
|
|
17231
|
-
}) : /*#__PURE__*/React__default.createElement(
|
|
17387
|
+
}) : /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref5 => {
|
|
17232
17388
|
let {
|
|
17233
17389
|
height,
|
|
17234
17390
|
width
|
|
@@ -17236,6 +17392,7 @@ function ListBoxInline(_ref4) {
|
|
|
17236
17392
|
return /*#__PURE__*/React__default.createElement(ListBox, {
|
|
17237
17393
|
model: model,
|
|
17238
17394
|
app: app,
|
|
17395
|
+
theme: theme,
|
|
17239
17396
|
constraints: constraints,
|
|
17240
17397
|
layout: layout,
|
|
17241
17398
|
selections: selections,
|
|
@@ -17511,6 +17668,14 @@ function useOnTheFlyModel(_ref) {
|
|
|
17511
17668
|
const [model, setModel] = useState$1();
|
|
17512
17669
|
const [fallbackTitle, setFallbackTitle] = useState$1();
|
|
17513
17670
|
const title = (_options$title = options.title) !== null && _options$title !== void 0 ? _options$title : fallbackTitle;
|
|
17671
|
+
let {
|
|
17672
|
+
histogram = false,
|
|
17673
|
+
frequencyMode = 'N'
|
|
17674
|
+
} = options;
|
|
17675
|
+
if (fieldDef && fieldDef.failedToFetchFieldDef) {
|
|
17676
|
+
histogram = false;
|
|
17677
|
+
frequencyMode = 'N';
|
|
17678
|
+
}
|
|
17514
17679
|
useEffect$1(() => {
|
|
17515
17680
|
async function fetchMasterItem() {
|
|
17516
17681
|
try {
|
|
@@ -17533,7 +17698,7 @@ function useOnTheFlyModel(_ref) {
|
|
|
17533
17698
|
throw new Error("Disabling frequency count and histogram: ".concat(e && e.message));
|
|
17534
17699
|
}
|
|
17535
17700
|
}
|
|
17536
|
-
const isFrequencyMaxNeeded =
|
|
17701
|
+
const isFrequencyMaxNeeded = histogram || frequencyMode !== 'N';
|
|
17537
17702
|
const shouldFetchMasterItem = fieldIdentifier.qLibraryId && isFrequencyMaxNeeded;
|
|
17538
17703
|
if (shouldFetchMasterItem) {
|
|
17539
17704
|
fetchMasterItem();
|
|
@@ -17548,31 +17713,6 @@ function useOnTheFlyModel(_ref) {
|
|
|
17548
17713
|
listLayout,
|
|
17549
17714
|
properties = {}
|
|
17550
17715
|
} = 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
17716
|
const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
|
|
17577
17717
|
const layoutOptions = {
|
|
17578
17718
|
dense
|
|
@@ -17650,6 +17790,28 @@ function identify(_ref) {
|
|
|
17650
17790
|
};
|
|
17651
17791
|
}
|
|
17652
17792
|
|
|
17793
|
+
function getFrequencyModeLetter(frequencyMode) {
|
|
17794
|
+
let freqLetter;
|
|
17795
|
+
switch (true) {
|
|
17796
|
+
case ['none', 'N', 'NX_FREQUENCY_NONE'].includes(frequencyMode):
|
|
17797
|
+
freqLetter = 'N';
|
|
17798
|
+
break;
|
|
17799
|
+
case ['value', 'V', 'NX_FREQUENCY_VALUE', 'default'].includes(frequencyMode):
|
|
17800
|
+
freqLetter = 'V';
|
|
17801
|
+
break;
|
|
17802
|
+
case ['percent', 'P', 'NX_FREQUENCY_PERCENT'].includes(frequencyMode):
|
|
17803
|
+
freqLetter = 'P';
|
|
17804
|
+
break;
|
|
17805
|
+
case ['relative', 'R', 'NX_FREQUENCY_RELATIVE'].includes(frequencyMode):
|
|
17806
|
+
freqLetter = 'R';
|
|
17807
|
+
break;
|
|
17808
|
+
default:
|
|
17809
|
+
freqLetter = 'N';
|
|
17810
|
+
break;
|
|
17811
|
+
}
|
|
17812
|
+
return freqLetter;
|
|
17813
|
+
}
|
|
17814
|
+
|
|
17653
17815
|
const _excluded$3 = ["__DO_NOT_USE__"];
|
|
17654
17816
|
|
|
17655
17817
|
/**
|
|
@@ -17712,6 +17874,12 @@ function ListBoxWrapper(_ref) {
|
|
|
17712
17874
|
qId,
|
|
17713
17875
|
options
|
|
17714
17876
|
});
|
|
17877
|
+
if (!isExistingObject) {
|
|
17878
|
+
Object.assign(options, {
|
|
17879
|
+
frequencyMode: getFrequencyModeLetter(options.frequencyMode) // stick to letter option hereafter
|
|
17880
|
+
});
|
|
17881
|
+
}
|
|
17882
|
+
|
|
17715
17883
|
const [changeCount, setChangeCount] = useState$1(0);
|
|
17716
17884
|
useEffect$1(() => {
|
|
17717
17885
|
if (changeCount) {
|
|
@@ -25536,12 +25704,11 @@ function nuked() {
|
|
|
25536
25704
|
* @returns {Promise<object>} The objects properties
|
|
25537
25705
|
* @example
|
|
25538
25706
|
* // generate properties for a barchart
|
|
25539
|
-
* const properties = await n.
|
|
25707
|
+
* const properties = await n.generateProperties({
|
|
25540
25708
|
* type: 'barchart',
|
|
25541
25709
|
* fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
|
|
25542
25710
|
* properties: { showTitle: true }
|
|
25543
25711
|
* },
|
|
25544
|
-
* true
|
|
25545
25712
|
* );
|
|
25546
25713
|
*/
|
|
25547
25714
|
generateProperties: async cfg => createObject(cfg, halo, true),
|