@nebula.js/stardust 3.3.0 → 4.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v3.3.0
2
+ * @nebula.js/stardust v4.0.0-alpha.0
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -1680,6 +1680,12 @@
1680
1680
  "zh-TW": "不符計算條件"
1681
1681
  }
1682
1682
  };
1683
+ var Listbox_DrillDown = {
1684
+ id: "Listbox.DrillDown",
1685
+ locale: {
1686
+ "en-US": "Drill-down dimension"
1687
+ }
1688
+ };
1683
1689
  var all = {
1684
1690
  Cancel: Cancel$1,
1685
1691
  CurrentSelections_All: CurrentSelections_All,
@@ -1716,7 +1722,8 @@
1716
1722
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1717
1723
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1718
1724
  Visualization_LayoutError: Visualization_LayoutError,
1719
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
1725
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
1726
+ Listbox_DrillDown: Listbox_DrillDown
1720
1727
  };
1721
1728
 
1722
1729
  function appLocaleFn(language) {
@@ -3505,6 +3512,8 @@
3505
3512
  return detectTouchscreen() ? 'touch' : 'desktop';
3506
3513
  }
3507
3514
 
3515
+ var client = {};
3516
+
3508
3517
  var reactDomExports = {};
3509
3518
  var reactDom = {
3510
3519
  get exports(){ return reactDomExports; },
@@ -3901,6 +3910,12 @@
3901
3910
 
3902
3911
  var ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports);
3903
3912
 
3913
+ var m$2 = reactDomExports;
3914
+ {
3915
+ client.createRoot = m$2.createRoot;
3916
+ client.hydrateRoot = m$2.hydrateRoot;
3917
+ }
3918
+
3904
3919
  function _extends$7() {
3905
3920
  _extends$7 = Object.assign ? Object.assign.bind() : function (target) {
3906
3921
  for (var i = 1; i < arguments.length; i++) {
@@ -15328,7 +15343,7 @@
15328
15343
  return cache[key];
15329
15344
  }
15330
15345
 
15331
- const NEBULA_VERSION_HASH = "593e" ;
15346
+ const NEBULA_VERSION_HASH = "b1a6" ;
15332
15347
  ClassNameGenerator$1.configure(componentName => {
15333
15348
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15334
15349
  });
@@ -15490,7 +15505,8 @@
15490
15505
  const NebulaApp = reactExports.forwardRef((_ref, ref) => {
15491
15506
  let {
15492
15507
  initialContext,
15493
- app
15508
+ app,
15509
+ renderCallback
15494
15510
  } = _ref;
15495
15511
  const [appSelections] = useAppSelections(app);
15496
15512
  const [context, setContext] = reactExports.useState(initialContext);
@@ -15501,21 +15517,20 @@
15501
15517
  theme: create$3(muiThemeName)
15502
15518
  }), [muiThemeName]);
15503
15519
  const [components, setComponents] = reactExports.useState([]);
15520
+
15521
+ // Will be called directly after the first render pass
15522
+ // See: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
15523
+ reactExports.useEffect(() => {
15524
+ renderCallback && renderCallback();
15525
+ }, []);
15504
15526
  reactExports.useImperativeHandle(ref, () => ({
15505
- addComponent(component) {
15506
- setComponents([...components, component]);
15507
- },
15508
- removeComponent(component) {
15509
- const ix = components.indexOf(component);
15510
- if (ix !== -1) {
15511
- components.splice(ix, 1);
15512
- setComponents([...components]);
15513
- }
15527
+ setComps(comps) {
15528
+ setComponents([...comps]);
15514
15529
  },
15515
15530
  setMuiThemeName,
15516
15531
  setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext),
15517
15532
  getAppSelections: () => appSelections
15518
- }));
15533
+ }), []);
15519
15534
  return /*#__PURE__*/React.createElement(StyledEngineProvider, {
15520
15535
  injectFirst: true
15521
15536
  }, /*#__PURE__*/React.createElement(ThemeProvider, {
@@ -15536,15 +15551,18 @@
15536
15551
  const appRef = React.createRef();
15537
15552
  const element = document.createElement('div');
15538
15553
  element.style.display = 'none';
15539
- element.setAttribute('data-nebulajs-version', "3.3.0" );
15554
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.0" );
15540
15555
  element.setAttribute('data-app-id', app.id);
15541
15556
  document.body.appendChild(element);
15542
- ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
15557
+ const root = client.createRoot(element);
15558
+ root.render( /*#__PURE__*/React.createElement(NebulaApp, {
15543
15559
  ref: appRef,
15544
15560
  app: app,
15545
- initialContext: context
15546
- }), element, resolveRender);
15561
+ initialContext: context,
15562
+ renderCallback: resolveRender
15563
+ }));
15547
15564
  const cells = {};
15565
+ const components = [];
15548
15566
  return [{
15549
15567
  toggleFocusOfCells(cellIdToFocus) {
15550
15568
  Object.keys(cells).forEach(i => {
@@ -15561,13 +15579,18 @@
15561
15579
  add(component) {
15562
15580
  (async () => {
15563
15581
  await rendered;
15564
- appRef.current.addComponent(component);
15582
+ components.push(component);
15583
+ appRef.current.setComps(components);
15565
15584
  })();
15566
15585
  },
15567
15586
  remove(component) {
15568
15587
  (async () => {
15569
15588
  await rendered;
15570
- appRef.current.removeComponent(component);
15589
+ const ix = components.indexOf(component);
15590
+ if (ix !== -1) {
15591
+ components.splice(ix, 1);
15592
+ }
15593
+ appRef.current.setComps(components);
15571
15594
  })();
15572
15595
  },
15573
15596
  setMuiThemeName(themeName) {
@@ -21495,9 +21518,6 @@
21495
21518
  function isStateSelected(qState) {
21496
21519
  return SELECTED_STATES.includes(qState);
21497
21520
  }
21498
- function getUniques(arr) {
21499
- return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
21500
- }
21501
21521
  function getSelectedValues(pages) {
21502
21522
  if (!pages || !pages.length) {
21503
21523
  return [];
@@ -21511,45 +21531,38 @@
21511
21531
  });
21512
21532
  return flatten(elementNbrs);
21513
21533
  }
21514
- function applySelectionsOnPages(pages, elmNumbers) {
21515
- let clearAllButElmNumbers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
21516
- const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
21517
- const matrices = pages.map(page => {
21518
- const qMatrix = page.qMatrix.map(p => {
21519
- const [p0] = p;
21520
- const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
21521
- let qState;
21522
- if (clearAllButElmNumbers) {
21523
- qState = selectionMatchesElement ? 'S' : 'A';
21524
- } else {
21525
- qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
21526
- }
21527
- return [_objectSpread2(_objectSpread2({}, p0), {}, {
21528
- qState
21529
- }), p.slice(1)];
21530
- });
21531
- return _objectSpread2(_objectSpread2({}, page), {}, {
21532
- qMatrix
21533
- });
21534
- });
21535
- return matrices;
21536
- }
21537
21534
  async function selectValues(_ref) {
21538
21535
  let {
21539
21536
  selections,
21540
21537
  elemNumbers,
21541
- isSingleSelect = false
21538
+ toggle,
21539
+ isSingleSelect
21542
21540
  } = _ref;
21543
- let resolved = Promise.resolve(false);
21541
+ if (elemNumbers.length === 0) {
21542
+ return false;
21543
+ }
21544
21544
  const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
21545
+ let success = false;
21545
21546
  if (!hasNanValues) {
21546
21547
  const elemNumbersToSelect = elemNumbers;
21547
- resolved = selections.select({
21548
- method: 'selectListObjectValues',
21549
- params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
21550
- }).then(success => success !== false).catch(() => false);
21548
+ try {
21549
+ const response = await selections.select({
21550
+ method: 'selectListObjectValues',
21551
+ params: ['/qListObjectDef', elemNumbersToSelect, toggle]
21552
+ });
21553
+ success = response !== false;
21554
+ } catch (_unused) {
21555
+ success = false;
21556
+ }
21557
+ if (!success) {
21558
+ if (isSingleSelect) {
21559
+ selections.cancel(); // revert selection
21560
+ } else {
21561
+ selections.clear();
21562
+ }
21563
+ }
21551
21564
  }
21552
- return resolved;
21565
+ return success;
21553
21566
  }
21554
21567
  function getElemNumbersFromPages(pages) {
21555
21568
  if (!pages || !pages.length) {
@@ -21612,126 +21625,132 @@
21612
21625
  return elemNumbersOrdered.slice(min, max + 1);
21613
21626
  }
21614
21627
 
21628
+ const getKeyAsToggleSelected = event => !(event.metaKey || event.ctrlKey);
21615
21629
  function useSelectionsInteractions(_ref) {
21616
21630
  let {
21617
- layout,
21631
+ selectionState,
21618
21632
  selections,
21619
- pages = [],
21620
21633
  checkboxes = false,
21621
- selectDisabled,
21622
- doc = document,
21623
- isSingleSelect: singleSelect = false
21634
+ doc = document
21624
21635
  } = _ref;
21625
- const [instantPages, setInstantPages] = reactExports.useState(pages);
21626
- const [mouseDown, setMouseDown] = reactExports.useState(false);
21627
- const [selectingValues, setSelectingValues] = reactExports.useState(false);
21628
- const [isSingleSelect, setIsSingleSelect] = reactExports.useState(singleSelect);
21629
- const [selected, setSelected] = reactExports.useState([]);
21630
- const [isRangeSelection, setIsRangeSelection] = reactExports.useState(false);
21631
- const [preSelected, setPreSelected] = reactExports.useState([]);
21632
- const elemNumbersOrdered = getElemNumbersFromPages(pages);
21633
- reactExports.useEffect(() => {
21634
- setIsSingleSelect(singleSelect);
21635
- }, [singleSelect]);
21636
-
21637
- // Select values for real, by calling the backend.
21638
- const select = async function () {
21639
- let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21640
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21641
- if (selectDisabled()) {
21642
- return;
21643
- }
21644
- setSelectingValues(true);
21645
- const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
21646
- await selectValues({
21636
+ const currentSelect = reactExports.useRef({
21637
+ startElemNumber: undefined,
21638
+ elemNumbers: [],
21639
+ isRange: false,
21640
+ toggle: false,
21641
+ active: false
21642
+ });
21643
+
21644
+ // eslint-disable-next-line arrow-body-style
21645
+ const doSelect = () => {
21646
+ selectionState.setSelectableValuesUpdating();
21647
+ return selectValues({
21647
21648
  selections,
21648
- elemNumbers: filtered,
21649
- isSingleSelect
21649
+ elemNumbers: currentSelect.current.elemNumbers,
21650
+ isSingleSelect: selectionState.isSingleSelect,
21651
+ toggle: currentSelect.current.toggle
21650
21652
  });
21651
- setSelectingValues(false);
21652
- setPreSelected([]);
21653
21653
  };
21654
-
21655
- // Show estimated selection states instantly before applying the selections for real.
21656
- const preSelect = function (elemNumbers) {
21657
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21658
- if (selectDisabled()) {
21654
+ const addToRange = elemNumber => {
21655
+ const {
21656
+ startElemNumber
21657
+ } = currentSelect.current;
21658
+ if (startElemNumber === elemNumber) {
21659
21659
  return;
21660
21660
  }
21661
- setPreSelected(existing => {
21662
- const uniques = getUniques([...existing, ...elemNumbers]);
21663
- const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
21664
- const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
21665
- return filled;
21666
- });
21661
+ const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
21662
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
21663
+ const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
21664
+ selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
21667
21665
  };
21668
21666
  const selectManually = function () {
21669
21667
  let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21670
21668
  let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21671
- setIsRangeSelection(false); // range is not supported for manual select
21672
- setMouseDown(true);
21673
- preSelect(elementIds, additive || isRangeSelection);
21674
- const p = select(elementIds, additive || isRangeSelection);
21675
- setMouseDown(false);
21676
- return p;
21677
- };
21678
- const handleSingleSelectKey = event => {
21669
+ const elemNumbers = [];
21670
+ selectionState.updateItems(elementIds, additive, elemNumbers);
21671
+ selectionState.setSelectableValuesUpdating();
21672
+ return selectValues({
21673
+ selections,
21674
+ elemNumbers: additive ? elemNumbers : elementIds,
21675
+ isSingleSelect: selectionState.isSingleSelect,
21676
+ toggle: !selectionState.isSingleSelect
21677
+ });
21678
+ };
21679
+ const handleSingleSelectKey = (event, target) => {
21679
21680
  if (event.ctrlKey || event.metaKey) {
21680
- setIsSingleSelect(true);
21681
- event.currentTarget.focus(); // will not be focused otherwise
21681
+ target.focus(); // will not be focused otherwise
21682
21682
  event.preventDefault();
21683
21683
  }
21684
21684
  };
21685
- const onClick = reactExports.useCallback(event => {
21686
- if (selectingValues || selectDisabled()) {
21685
+ const onChange = reactExports.useCallback(event => {
21686
+ if (selectionState.selectDisabled()) {
21687
21687
  return;
21688
21688
  }
21689
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21690
- setPreSelected([elemNumber]);
21691
- handleSingleSelectKey(event);
21692
- }, [selectingValues, selectDisabled]);
21689
+ const elemNumber = +event.target.getAttribute('data-n');
21690
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event.nativeEvent);
21691
+ currentSelect.current.elemNumbers = [elemNumber];
21692
+ currentSelect.current.toggle = toggle;
21693
+ if (!toggle) {
21694
+ selectionState.clearItemStates(true);
21695
+ }
21696
+ selectionState.updateItem(elemNumber);
21697
+ currentSelect.current.active = false;
21698
+ doSelect();
21699
+ }, []);
21693
21700
  const onMouseDown = reactExports.useCallback(event => {
21694
- if (selectingValues || selectDisabled()) {
21701
+ if (selectionState.selectDisabled()) {
21695
21702
  return;
21696
21703
  }
21697
- setIsRangeSelection(false);
21698
- setMouseDown(true);
21699
21704
  const elemNumber = +event.currentTarget.getAttribute('data-n');
21700
- setPreSelected([elemNumber]);
21701
- handleSingleSelectKey(event);
21702
- }, [selectingValues, selectDisabled]);
21705
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event);
21706
+ currentSelect.current.isRange = false;
21707
+ currentSelect.current.startElemNumber = elemNumber;
21708
+ currentSelect.current.elemNumbers = [elemNumber];
21709
+ currentSelect.current.toggle = toggle;
21710
+ currentSelect.current.active = true;
21711
+ if (!toggle) {
21712
+ selectionState.clearItemStates(true);
21713
+ }
21714
+ selectionState.updateItem(elemNumber);
21715
+ if (selectionState.isSingleSelect) {
21716
+ currentSelect.current.active = false;
21717
+ doSelect();
21718
+ }
21719
+ handleSingleSelectKey(event, event.currentTarget);
21720
+ }, []);
21703
21721
  const onMouseUp = reactExports.useCallback(event => {
21704
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21705
- if (isSingleSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
21706
- ) {
21722
+ if (!currentSelect.current.active) {
21707
21723
  return;
21708
21724
  }
21709
- preSelect([elemNumber]);
21710
- }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection, selectDisabled]);
21725
+ currentSelect.current.active = false;
21726
+ if (currentSelect.current.isRange) {
21727
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
21728
+ addToRange(elemNumber);
21729
+ }
21730
+ doSelect();
21731
+ }, []);
21711
21732
  const onMouseUpDoc = reactExports.useCallback(() => {
21712
21733
  // Ensure we end interactions when mouseup happens outside the Listbox.
21713
- setMouseDown(false);
21714
- setSelectingValues(false);
21715
- setIsRangeSelection(false);
21716
- setIsSingleSelect(singleSelect);
21717
- }, [singleSelect]);
21718
- const onMouseEnter = reactExports.useCallback(event => {
21719
- if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
21734
+ if (!currentSelect.current.active) {
21720
21735
  return;
21721
21736
  }
21722
- setIsRangeSelection(true);
21723
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21724
- preSelect([elemNumber], true);
21725
- }, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, selectDisabled, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
21726
- reactExports.useEffect(() => {
21727
- // Perform selections of pre-selected values. This can
21728
- // happen only when interactions have finished (mouseup).
21729
- const interactionIsFinished = !mouseDown;
21730
- if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
21737
+ currentSelect.current.active = false;
21738
+ doSelect();
21739
+ }, []);
21740
+ const onMouseEnter = reactExports.useCallback(event => {
21741
+ if (!currentSelect.current.active) {
21731
21742
  return;
21732
21743
  }
21733
- select(preSelected, isRangeSelection);
21734
- }, [preSelected, mouseDown, selectDisabled()]);
21744
+ if (!currentSelect.current.isRange) {
21745
+ currentSelect.current.isRange = true;
21746
+ if (!selectionState.isSelected(currentSelect.current.startElemNumber)) {
21747
+ selectionState.updateItem(currentSelect.current.startElemNumber, true);
21748
+ currentSelect.current.elemNumbers = [];
21749
+ }
21750
+ }
21751
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
21752
+ addToRange(elemNumber);
21753
+ }, []);
21735
21754
  reactExports.useEffect(() => {
21736
21755
  doc.addEventListener('mouseup', onMouseUpDoc);
21737
21756
  return () => {
@@ -21739,25 +21758,24 @@
21739
21758
  };
21740
21759
  }, [onMouseUpDoc]);
21741
21760
  reactExports.useEffect(() => {
21742
- if (selectingValues || mouseDown) {
21743
- return;
21744
- }
21745
- // Keep track of (truely) selected fields so we can prevent toggling them on range select.
21746
- const alreadySelected = getSelectedValues(pages);
21747
- setSelected(alreadySelected);
21748
- }, [pages]);
21749
- reactExports.useEffect(() => {
21750
- if (selectingValues || !pages || !checkboxes && !mouseDown) {
21751
- return;
21752
- }
21753
- // Render pre-selections before they have been selected in Engine.
21754
- const newPages = applySelectionsOnPages(pages, preSelected, isSingleSelect);
21755
- setInstantPages(newPages);
21756
- }, [preSelected]);
21761
+ const onDeactivated = () => {
21762
+ selectionState.clearItemStates(false);
21763
+ };
21764
+ const onCleared = () => {
21765
+ selectionState.clearItemStates(true);
21766
+ selectionState.triggerStateChanged();
21767
+ };
21768
+ selections.on('deactivated', onDeactivated);
21769
+ selections.on('cleared', onCleared);
21770
+ return () => {
21771
+ selections.removeListener('activated', onDeactivated);
21772
+ selections.removeListener('cleared', onCleared);
21773
+ };
21774
+ }, [selections]);
21757
21775
  const interactionEvents = {};
21758
21776
  if (checkboxes) {
21759
21777
  Object.assign(interactionEvents, {
21760
- onClick
21778
+ onChange
21761
21779
  });
21762
21780
  } else {
21763
21781
  Object.assign(interactionEvents, {
@@ -21767,7 +21785,6 @@
21767
21785
  });
21768
21786
  }
21769
21787
  return {
21770
- instantPages,
21771
21788
  interactionEvents,
21772
21789
  select: selectManually // preselect and select without having to trigger an event
21773
21790
  };
@@ -22114,6 +22131,34 @@
22114
22131
  } = _ref;
22115
22132
  return (isAlternative(cell) || isExcluded(cell)) && checkboxes;
22116
22133
  };
22134
+ const getValueStateClasses = _ref2 => {
22135
+ let {
22136
+ column,
22137
+ histogram,
22138
+ checkboxes,
22139
+ cell,
22140
+ showGray
22141
+ } = _ref2;
22142
+ const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
22143
+ if (!histogram) {
22144
+ clazzArr.push(rowColClasses.rowBorderBottom);
22145
+ }
22146
+ if (!cell) {
22147
+ return [];
22148
+ }
22149
+ if (!checkboxes) {
22150
+ if (cell.qState === 'XS') {
22151
+ clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
22152
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
22153
+ clazzArr.push(rowColClasses.S);
22154
+ } else if (showGray && isAlternative(cell)) {
22155
+ clazzArr.push(rowColClasses.A);
22156
+ } else if (showGray && isExcluded(cell)) {
22157
+ clazzArr.push(rowColClasses.X);
22158
+ }
22159
+ }
22160
+ return clazzArr;
22161
+ };
22117
22162
 
22118
22163
  const frequencyTextNone = '-';
22119
22164
  const barPadPx = 4;
@@ -22144,6 +22189,9 @@
22144
22189
  return '';
22145
22190
  };
22146
22191
 
22192
+ const ICON_PADDING = 7;
22193
+ const CELL_PADDING_LEFT = 9;
22194
+
22147
22195
  const getSelectedStyle = _ref => {
22148
22196
  let {
22149
22197
  theme
@@ -22163,10 +22211,11 @@
22163
22211
  const ellipsis = {
22164
22212
  width: '100%',
22165
22213
  overflow: 'hidden',
22166
- textOverflow: 'ellipsis'
22214
+ textOverflow: 'ellipsis',
22215
+ whiteSpace: 'nowrap'
22167
22216
  };
22168
22217
  const RowColRoot = styled$1('div', {
22169
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense'].includes(prop)
22218
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
22170
22219
  })(_ref2 => {
22171
22220
  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;
22172
22221
  let {
@@ -22174,7 +22223,8 @@
22174
22223
  flexBasisProp,
22175
22224
  isGridMode,
22176
22225
  isGridCol,
22177
- dense
22226
+ dense,
22227
+ frequencyWidth
22178
22228
  } = _ref2;
22179
22229
  return {
22180
22230
  '&:focus': {
@@ -22203,18 +22253,18 @@
22203
22253
  minWidth: 0,
22204
22254
  flexGrow: 1,
22205
22255
  // Note that this padding is overridden when using checkboxes.
22206
- paddingLeft: '9px',
22207
- paddingRight: '9px'
22256
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
22257
+ paddingRight: 0
22208
22258
  },
22209
22259
  // The leaf node, containing the label text.
22210
22260
  ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
22211
22261
  flexBasis: flexBasisProp,
22212
22262
  lineHeight: '16px',
22213
22263
  userSelect: 'none',
22264
+ paddingRight: '1px'
22265
+ }, ellipsis), {}, {
22214
22266
  whiteSpace: 'pre',
22215
22267
  // to keep white-space on highlight
22216
- paddingRight: '9px'
22217
- }, ellipsis), {}, {
22218
22268
  fontSize: (_theme$listBox3 = theme.listBox) === null || _theme$listBox3 === void 0 ? void 0 : (_theme$listBox3$conte = _theme$listBox3.content) === null || _theme$listBox3$conte === void 0 ? void 0 : _theme$listBox3$conte.fontSize,
22219
22269
  fontFamily: (_theme$listBox4 = theme.listBox) === null || _theme$listBox4 === void 0 ? void 0 : (_theme$listBox4$conte = _theme$listBox4.content) === null || _theme$listBox4$conte === void 0 ? void 0 : _theme$listBox4$conte.fontFamily
22220
22270
  }),
@@ -22252,7 +22302,10 @@
22252
22302
  // The icons container holding tick and lock, shown inside fields.
22253
22303
  ["& .".concat(rowColClasses.icon)]: {
22254
22304
  display: 'flex',
22255
- padding: theme.spacing(1, 1, 1, 0)
22305
+ justifyContent: 'center',
22306
+ width: 24,
22307
+ minWidth: 24,
22308
+ maxWidth: 24
22256
22309
  },
22257
22310
  // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
22258
22311
  ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
@@ -22277,10 +22330,13 @@
22277
22330
  color: theme.palette.selected.excludedContrastText,
22278
22331
  border: isGridMode ? 'none' : undefined
22279
22332
  },
22280
- ["& .".concat(rowColClasses.frequencyCount)]: {
22281
- width: '66px',
22333
+ ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
22282
22334
  justifyContent: 'flex-end'
22283
- },
22335
+ }, ellipsis), {}, {
22336
+ flex: "0 1 ".concat(frequencyWidth, "px"),
22337
+ textAlign: 'right',
22338
+ paddingLeft: '2px'
22339
+ }),
22284
22340
  ["&.".concat(rowColClasses.barContainer)]: {
22285
22341
  height: '100%',
22286
22342
  display: 'flex',
@@ -22315,6 +22371,7 @@
22315
22371
  }
22316
22372
  };
22317
22373
  });
22374
+ var RowColRoot$1 = React.memo(RowColRoot);
22318
22375
 
22319
22376
  const CheckboxChecked = "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath" + " fill-rule='evenodd' clip-rule='evenodd' d='M12 5c-.28 0-.53.11-.71.29L7 9.59l-2.29-2.3a1.003 " + "1.003 0 00-1.42 1.42l3 3c.18.18.43.29.71.29s.53-.11.71-.29l5-5A1.003 1.003 0 0012 5z' fill='%23fff'/%3E%3C/svg%3E\")";
22320
22377
 
@@ -22390,19 +22447,23 @@
22390
22447
  };
22391
22448
  function ListboxCheckbox(_ref2) {
22392
22449
  let {
22450
+ onChange,
22393
22451
  checked,
22394
22452
  label,
22395
22453
  dense,
22396
22454
  excluded,
22397
- showGray = true
22455
+ showGray = true,
22456
+ dataN
22398
22457
  } = _ref2;
22399
22458
  return /*#__PURE__*/React.createElement(StyledCheckbox, {
22400
22459
  edge: "start",
22460
+ onChange: onChange,
22401
22461
  checked: checked,
22402
22462
  disableRipple: true,
22403
22463
  className: [classes$b.checkbox, dense && classes$b.dense].filter(Boolean).join(' '),
22404
22464
  inputProps: {
22405
- 'aria-labelledby': label
22465
+ 'aria-labelledby': label,
22466
+ 'data-n': dataN
22406
22467
  },
22407
22468
  name: label,
22408
22469
  icon: getIcon(classes$b, showGray, excluded),
@@ -22431,15 +22492,21 @@
22431
22492
  });
22432
22493
  function ListBoxRadioButton(_ref2) {
22433
22494
  let {
22495
+ onChange,
22434
22496
  checked,
22435
22497
  label,
22436
- dense
22498
+ dense,
22499
+ dataN
22437
22500
  } = _ref2;
22438
22501
  return /*#__PURE__*/React.createElement(StyledRadio, {
22439
22502
  checked: checked,
22503
+ onChange: onChange,
22440
22504
  value: label,
22441
22505
  name: label,
22442
22506
  className: classes$a.radioButton,
22507
+ inputProps: {
22508
+ 'data-n': dataN
22509
+ },
22443
22510
  style: {
22444
22511
  backgroundColor: 'transparent'
22445
22512
  },
@@ -22470,7 +22537,7 @@
22470
22537
  checkboxes
22471
22538
  }) && rowColClasses.excludedTextWithCheckbox]),
22472
22539
  color: color,
22473
- justifyContent: valueTextAlign
22540
+ align: valueTextAlign
22474
22541
  }, /*#__PURE__*/React.createElement("span", {
22475
22542
  style: {
22476
22543
  whiteSpace: 'pre'
@@ -22506,6 +22573,7 @@
22506
22573
 
22507
22574
  function CheckboxField(_ref) {
22508
22575
  let {
22576
+ onChange,
22509
22577
  label,
22510
22578
  color,
22511
22579
  qElemNumber,
@@ -22520,17 +22588,21 @@
22520
22588
  valueTextAlign
22521
22589
  } = _ref;
22522
22590
  const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
22591
+ onChange: onChange,
22523
22592
  label: label,
22524
22593
  checked: isSelected,
22525
22594
  dense: dense,
22526
22595
  excluded: isExcluded(cell),
22527
22596
  isGridCol: isGridCol,
22528
- showGray: showGray
22597
+ showGray: showGray,
22598
+ dataN: qElemNumber
22529
22599
  });
22530
22600
  const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
22601
+ onChange: onChange,
22531
22602
  label: label,
22532
22603
  checked: isSelected,
22533
- dense: dense
22604
+ dense: dense,
22605
+ dataN: qElemNumber
22534
22606
  });
22535
22607
  return /*#__PURE__*/React.createElement(FormControlLabel$1, {
22536
22608
  color: color,
@@ -22557,11 +22629,12 @@
22557
22629
  showGray,
22558
22630
  checkboxes
22559
22631
  } = _ref;
22560
- return /*#__PURE__*/React.createElement(React.Fragment, null, labels.map(_ref2 => {
22632
+ return /*#__PURE__*/React.createElement(React.Fragment, null, labels.map((_ref2, index) => {
22561
22633
  let [label, highlighted] = _ref2;
22634
+ const key = "".concat(index);
22562
22635
  return /*#__PURE__*/React.createElement(ValueField, {
22563
22636
  label: label,
22564
- key: label,
22637
+ key: key,
22565
22638
  highlighted: highlighted,
22566
22639
  dense: dense,
22567
22640
  showGray: showGray,
@@ -22571,6 +22644,7 @@
22571
22644
  }
22572
22645
  function FieldWithRanges(_ref3) {
22573
22646
  let {
22647
+ onChange,
22574
22648
  labels,
22575
22649
  checkboxes,
22576
22650
  dense,
@@ -22590,6 +22664,7 @@
22590
22664
  checkboxes: checkboxes
22591
22665
  });
22592
22666
  return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22667
+ onChange: onChange,
22593
22668
  label: LWR,
22594
22669
  color: color,
22595
22670
  qElemNumber: qElemNumber,
@@ -22606,6 +22681,7 @@
22606
22681
 
22607
22682
  function Field(_ref) {
22608
22683
  let {
22684
+ onChange,
22609
22685
  label,
22610
22686
  color,
22611
22687
  qElemNumber,
@@ -22620,6 +22696,7 @@
22620
22696
  valueTextAlign
22621
22697
  } = _ref;
22622
22698
  return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22699
+ onChange: onChange,
22623
22700
  label: label,
22624
22701
  color: color,
22625
22702
  qElemNumber: qElemNumber,
@@ -22643,6 +22720,7 @@
22643
22720
  valueTextAlign: valueTextAlign
22644
22721
  });
22645
22722
  }
22723
+ var Field$1 = React.memo(Field);
22646
22724
 
22647
22725
  function Histogram(_ref) {
22648
22726
  let {
@@ -22715,12 +22793,16 @@
22715
22793
  case 'row':
22716
22794
  return {
22717
22795
  height: "calc(100% - ".concat(itemPadding, "px)"),
22718
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
22796
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22797
+ position: 'absolute',
22798
+ left: 4
22719
22799
  };
22720
22800
  case 'column':
22721
22801
  return {
22722
22802
  height: "calc(100% - ".concat(itemPadding, "px)"),
22723
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
22803
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22804
+ position: 'absolute',
22805
+ left: 4
22724
22806
  };
22725
22807
  default:
22726
22808
  return {};
@@ -22728,24 +22810,43 @@
22728
22810
  }
22729
22811
 
22730
22812
  const ItemGrid = styled$1(Grid$1, {
22731
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding'].includes(prop)
22813
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'checkboxes'].includes(prop)
22732
22814
  })(_ref => {
22733
22815
  let {
22734
22816
  dataLayout,
22735
22817
  layoutOrder,
22736
- itemPadding
22818
+ itemPadding,
22819
+ checkboxes
22737
22820
  } = _ref;
22738
22821
  return {
22739
- ["&.".concat(rowColClasses.fieldRoot)]: getGridItemSizes({
22822
+ ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
22740
22823
  dataLayout,
22741
22824
  layoutOrder,
22742
22825
  itemPadding
22826
+ })), {}, {
22827
+ paddingRight: checkboxes ? '8px' : undefined
22743
22828
  })
22744
22829
  };
22745
22830
  });
22746
22831
 
22832
+ function getCellFromPages(_ref) {
22833
+ let {
22834
+ pages,
22835
+ cellIndex
22836
+ } = _ref;
22837
+ let c;
22838
+ const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
22839
+ if (page) {
22840
+ const area = page.qArea;
22841
+ if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
22842
+ [c] = page.qMatrix[cellIndex - area.qTop];
22843
+ }
22844
+ }
22845
+ return c;
22846
+ }
22847
+
22747
22848
  function RowColumn(_ref) {
22748
- var _cell$qText;
22849
+ var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
22749
22850
  let {
22750
22851
  index,
22751
22852
  rowIndex,
@@ -22754,6 +22855,7 @@
22754
22855
  data
22755
22856
  } = _ref;
22756
22857
  const {
22858
+ onChange,
22757
22859
  onClick,
22758
22860
  onMouseDown,
22759
22861
  onMouseUp,
@@ -22777,7 +22879,8 @@
22777
22879
  dataOffset,
22778
22880
  focusListItems,
22779
22881
  listCount,
22780
- itemPadding
22882
+ itemPadding,
22883
+ frequencyWidth
22781
22884
  } = data;
22782
22885
  const {
22783
22886
  dense = false,
@@ -22829,44 +22932,25 @@
22829
22932
  const handleKeyDownCallback = reactExports.useCallback(getFieldKeyboardNavigation(_objectSpread2(_objectSpread2({}, actions), {}, {
22830
22933
  focusListItems
22831
22934
  })), [actions]);
22832
- const [isSelected, setSelected] = reactExports.useState(false);
22833
- const [cell, setCell] = reactExports.useState();
22834
- const [classArr, setClassArr] = reactExports.useState([]);
22835
- reactExports.useEffect(() => {
22836
- if (!pages) {
22837
- return;
22838
- }
22839
- let c;
22840
- const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
22841
- if (page) {
22842
- const area = page.qArea;
22843
- if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
22844
- [c] = page.qMatrix[cellIndex - area.qTop];
22845
- }
22846
- }
22847
- setCell(c);
22848
- }, [pages]);
22849
- reactExports.useEffect(() => {
22850
- if (!cell) {
22851
- return;
22935
+ const cell = reactExports.useMemo(() => getCellFromPages({
22936
+ pages,
22937
+ cellIndex
22938
+ }), [pages, cellIndex]);
22939
+ const isSelected = (cell === null || cell === void 0 ? void 0 : cell.qState) === 'S' || (cell === null || cell === void 0 ? void 0 : cell.qState) === 'XS' || (cell === null || cell === void 0 ? void 0 : cell.qState) === 'L';
22940
+ const classArr = reactExports.useMemo(() => getValueStateClasses({
22941
+ column,
22942
+ histogram,
22943
+ checkboxes,
22944
+ cell,
22945
+ showGray
22946
+ }), [cell === null || cell === void 0 ? void 0 : cell.qState, histogram, dense, checkboxes]);
22947
+ const preventContextMenu = reactExports.useCallback(event => {
22948
+ if (checkboxes) {
22949
+ // Event will not propagate in the checkbox/radiobutton case
22950
+ onClick(event);
22852
22951
  }
22853
- const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
22854
- setSelected(selected);
22855
- const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
22856
- if (!(histogram && (dense || checkboxes))) clazzArr.push(rowColClasses.rowBorderBottom);
22857
- if (!checkboxes) {
22858
- if (cell.qState === 'XS') {
22859
- clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
22860
- } else if (cell.qState === 'S' || cell.qState === 'L') {
22861
- clazzArr.push(rowColClasses.S);
22862
- } else if (showGray && isAlternative(cell)) {
22863
- clazzArr.push(rowColClasses.A);
22864
- } else if (showGray && isExcluded(cell)) {
22865
- clazzArr.push(rowColClasses.X);
22866
- }
22867
- }
22868
- setClassArr(clazzArr);
22869
- }, [cell && cell.qState, histogram, dense, checkboxes]);
22952
+ event.preventDefault();
22953
+ }, [checkboxes]);
22870
22954
  if (!cell) {
22871
22955
  return null; // prevent rendering empty rows
22872
22956
  }
@@ -22883,19 +22967,16 @@
22883
22967
  } else {
22884
22968
  valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
22885
22969
  }
22886
- const preventContextMenu = event => {
22887
- if (checkboxes) {
22888
- // Event will not propagate in the checkbox/radiobutton case
22889
- onClick(event);
22890
- }
22891
- event.preventDefault();
22892
- };
22893
22970
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
22894
22971
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
22895
22972
 
22896
22973
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
22897
- const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
22898
- const labels = getSegmentsFromRanges(label, ranges);
22974
+
22975
+ let labels;
22976
+ if ((_cell$qHighlightRange = cell.qHighlightRanges) !== null && _cell$qHighlightRange !== void 0 && (_cell$qHighlightRange2 = _cell$qHighlightRange.qRanges) !== null && _cell$qHighlightRange2 !== void 0 && _cell$qHighlightRange2.length) {
22977
+ const ranges = cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
22978
+ labels = getSegmentsFromRanges(label, ranges);
22979
+ }
22899
22980
  const iconStyles = {
22900
22981
  alignItems: 'center',
22901
22982
  display: 'flex',
@@ -22908,22 +22989,24 @@
22908
22989
  alignItems: 'center',
22909
22990
  minWidth: 0,
22910
22991
  flexGrow: 1,
22911
- padding: checkboxes ? 0 : undefined,
22992
+ paddingLeft: checkboxes ? 0 : undefined,
22912
22993
  justifyContent: valueTextAlign
22913
22994
  };
22914
22995
  const isFirstElement = index === 0;
22915
22996
  const flexBasisVal = checkboxes ? 'auto' : 'max-content';
22916
- return /*#__PURE__*/React.createElement(RowColRoot, {
22997
+ return /*#__PURE__*/React.createElement(RowColRoot$1, {
22917
22998
  className: rowColClasses.barContainer,
22918
22999
  flexBasisProp: flexBasisVal,
22919
23000
  style: styles,
22920
23001
  isGridCol: isGridCol,
22921
23002
  isGridMode: dataLayout === 'grid',
22922
- dense: dense
23003
+ dense: dense,
23004
+ frequencyWidth: frequencyWidth
22923
23005
  }, /*#__PURE__*/React.createElement(ItemGrid, {
22924
23006
  ref: rowRef,
22925
23007
  container: true,
22926
23008
  dataLayout: dataLayout,
23009
+ checkboxes: checkboxes,
22927
23010
  layoutOrder: layoutOrder,
22928
23011
  itemPadding: itemPadding,
22929
23012
  gap: 0,
@@ -22939,7 +23022,7 @@
22939
23022
  onContextMenu: preventContextMenu,
22940
23023
  role: column ? 'column' : 'row',
22941
23024
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
22942
- "data-n": cell && cell.qElemNumber
23025
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
22943
23026
  }, /*#__PURE__*/React.createElement(Histogram, {
22944
23027
  cell: cell,
22945
23028
  histogram: histogram,
@@ -22951,18 +23034,8 @@
22951
23034
  style: cellStyle,
22952
23035
  className: joinClassNames([rowColClasses.cell, rowColClasses.selectedCell]),
22953
23036
  title: "".concat(label)
22954
- }, ranges.length === 0 ? /*#__PURE__*/React.createElement(Field, {
22955
- label: label,
22956
- color: "inherit",
22957
- qElemNumber: cell.qElemNumber,
22958
- isSelected: isSelected,
22959
- dense: dense,
22960
- cell: cell,
22961
- isGridCol: isGridCol,
22962
- showGray: showGray,
22963
- isSingleSelect: isSingleSelect,
22964
- checkboxes: checkboxes
22965
- }) : /*#__PURE__*/React.createElement(FieldWithRanges, {
23037
+ }, labels ? /*#__PURE__*/React.createElement(FieldWithRanges, {
23038
+ onChange: onChange,
22966
23039
  labels: labels,
22967
23040
  checkboxes: checkboxes,
22968
23041
  dense: dense,
@@ -22975,6 +23048,19 @@
22975
23048
  isGridCol: isGridCol,
22976
23049
  isSingleSelect: isSingleSelect,
22977
23050
  valueTextAlign: valueTextAlign
23051
+ }) : /*#__PURE__*/React.createElement(Field$1, {
23052
+ onChange: onChange,
23053
+ label: label,
23054
+ color: "inherit",
23055
+ qElemNumber: cell.qElemNumber,
23056
+ isSelected: isSelected,
23057
+ dense: dense,
23058
+ cell: cell,
23059
+ isGridCol: isGridCol,
23060
+ showGray: showGray,
23061
+ isSingleSelect: isSingleSelect,
23062
+ checkboxes: checkboxes,
23063
+ valueTextAlign: valueTextAlign
22978
23064
  })), freqIsAllowed && /*#__PURE__*/React.createElement(Frequency, {
22979
23065
  cell: cell,
22980
23066
  checkboxes: checkboxes,
@@ -22996,21 +23082,6 @@
22996
23082
  }))));
22997
23083
  }
22998
23084
 
22999
- const FREQUENCY_MIN_SHOW_WIDTH = 80;
23000
- function getFrequencyAllowed(_ref) {
23001
- let {
23002
- width,
23003
- layout,
23004
- frequencyMode
23005
- } = _ref;
23006
- const widthPermitsFreq = width > FREQUENCY_MIN_SHOW_WIDTH;
23007
- const {
23008
- frequencyEnabled = false
23009
- } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
23010
- const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
23011
- return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
23012
- }
23013
-
23014
23085
  function deriveRenderOptions(options) {
23015
23086
  const {
23016
23087
  renderProps,
@@ -24457,8 +24528,9 @@
24457
24528
  styledScrollbars: "".concat(PREFIX$9, "-styledScrollbars")
24458
24529
  };
24459
24530
  function getStyledComponents() {
24460
- const scrollbarStyling = {
24531
+ const getScrollbarStyling = scrollDisabled => ({
24461
24532
  scrollbarColor: "".concat(scrollBarThumb, " ").concat(scrollBarBackground),
24533
+ overflow: scrollDisabled ? 'hidden !important' : undefined,
24462
24534
  '&::-webkit-scrollbar': {
24463
24535
  width: 10,
24464
24536
  height: 10
@@ -24473,42 +24545,27 @@
24473
24545
  '&::-webkit-scrollbar-thumb:hover': {
24474
24546
  backgroundColor: scrollBarThumbHover
24475
24547
  }
24476
- };
24477
- const StyledFixedSizeList = newStyled(FixedSizeList)(() => ({
24478
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
24479
- // TODO: Verify these props and make generic together with grid component.
24480
- '&::-webkit-scrollbar': {
24481
- width: 10,
24482
- height: 10
24483
- },
24484
- '&::-webkit-scrollbar-track': {
24485
- backgroundColor: scrollBarBackground
24486
- },
24487
- '&::-webkit-scrollbar-thumb': {
24488
- backgroundColor: scrollBarThumb,
24489
- borderRadius: '1rem'
24490
- },
24491
- '&::-webkit-scrollbar-thumb:hover': {
24492
- backgroundColor: scrollBarThumbHover
24493
- }
24494
- }));
24495
- const StyledFixedSizeGrid = newStyled(FixedSizeGrid)(() => ({
24496
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
24497
- '&::-webkit-scrollbar': {
24498
- width: 10,
24499
- height: 10
24500
- },
24501
- '&::-webkit-scrollbar-track': {
24502
- backgroundColor: scrollBarBackground
24503
- },
24504
- '&::-webkit-scrollbar-thumb': {
24505
- backgroundColor: scrollBarThumb,
24506
- borderRadius: '1rem'
24507
- },
24508
- '&::-webkit-scrollbar-thumb:hover': {
24509
- backgroundColor: scrollBarThumbHover
24510
- }
24511
- }));
24548
+ });
24549
+ const StyledFixedSizeList = newStyled(FixedSizeList, {
24550
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
24551
+ })(_ref => {
24552
+ let {
24553
+ scrollDisabled
24554
+ } = _ref;
24555
+ return {
24556
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
24557
+ };
24558
+ });
24559
+ const StyledFixedSizeGrid = newStyled(FixedSizeGrid, {
24560
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
24561
+ })(_ref2 => {
24562
+ let {
24563
+ scrollDisabled
24564
+ } = _ref2;
24565
+ return {
24566
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
24567
+ };
24568
+ });
24512
24569
  return {
24513
24570
  StyledFixedSizeList,
24514
24571
  StyledFixedSizeGrid
@@ -24574,13 +24631,14 @@
24574
24631
  showGray,
24575
24632
  scrollState,
24576
24633
  direction,
24577
- listLayout,
24578
24634
  sizes,
24579
24635
  listCount,
24580
24636
  overflowDisclaimer,
24581
24637
  setScrollPosition,
24582
24638
  focusListItems,
24583
- setCurrentScrollIndex
24639
+ setCurrentScrollIndex,
24640
+ constraints,
24641
+ freqIsAllowed
24584
24642
  } = _ref;
24585
24643
  const {
24586
24644
  layoutOptions = {},
@@ -24591,7 +24649,8 @@
24591
24649
  listHeight,
24592
24650
  itemSize,
24593
24651
  rowCount,
24594
- columnCount
24652
+ columnCount,
24653
+ frequencyWidth
24595
24654
  } = sizes || {};
24596
24655
 
24597
24656
  // Options common for List and Grid.
@@ -24611,14 +24670,11 @@
24611
24670
  checkboxes,
24612
24671
  layoutOptions,
24613
24672
  frequencyMode,
24614
- freqIsAllowed: getFrequencyAllowed({
24615
- width,
24616
- layout,
24617
- frequencyMode
24618
- }),
24673
+ freqIsAllowed,
24619
24674
  isSingleSelect,
24620
24675
  textAlign,
24621
24676
  itemPadding,
24677
+ frequencyWidth,
24622
24678
  actions: {
24623
24679
  select,
24624
24680
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -24643,10 +24699,10 @@
24643
24699
  // eslint-disable-next-line react/jsx-props-no-spreading
24644
24700
  , _extends$8({}, commonComponentOptions, {
24645
24701
  dataTestid: "fixed-size-list",
24702
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
24646
24703
  height: listHeight,
24647
24704
  width: width,
24648
24705
  itemCount: listCount,
24649
- layout: listLayout,
24650
24706
  itemData: _objectSpread2(_objectSpread2({}, commonItemData), {}, {
24651
24707
  listCount
24652
24708
  }),
@@ -24721,6 +24777,7 @@
24721
24777
  // eslint-disable-next-line react/jsx-props-no-spreading
24722
24778
  , _extends$8({}, commonComponentOptions, {
24723
24779
  dataTestid: "fixed-size-grid",
24780
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
24724
24781
  height: gridHeight,
24725
24782
  width: width,
24726
24783
  columnCount: columnCount,
@@ -24745,6 +24802,9 @@
24745
24802
 
24746
24803
  const scrollBarWidth = 10; // TODO: ignore this - instead set the styling only show on hover...
24747
24804
 
24805
+ const ITEM_MIN_WIDTH = 56;
24806
+ const ITEM_MAX_WIDTH = 150;
24807
+ const FREQUENCY_WIDTH = 40;
24748
24808
  function getListSizes(_ref) {
24749
24809
  let {
24750
24810
  layout,
@@ -24752,7 +24812,8 @@
24752
24812
  height,
24753
24813
  listCount,
24754
24814
  count,
24755
- textWidth
24815
+ textWidth,
24816
+ freqIsAllowed
24756
24817
  } = _ref;
24757
24818
  const {
24758
24819
  layoutOptions = {}
@@ -24764,7 +24825,8 @@
24764
24825
  dense,
24765
24826
  dataLayout
24766
24827
  } = layoutOptions;
24767
- const columnAutoWidth = Math.min(150, textWidth + 18);
24828
+ const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
24829
+ const columnAutoWidth = Math.max(Math.min(ITEM_MAX_WIDTH, textWidth + 18 + frequencyAddWidth), ITEM_MIN_WIDTH + frequencyAddWidth);
24768
24830
  let overflowStyling;
24769
24831
  let columnCount;
24770
24832
  let columnWidth;
@@ -24781,18 +24843,21 @@
24781
24843
  }
24782
24844
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemSize;
24783
24845
  if (layoutOrder) {
24846
+ // Modify container width to achieve the exact design with 8px margins on each side (left and right).
24847
+ let containerWidth = width;
24784
24848
  if (layoutOrder === 'row') {
24849
+ containerWidth += itemPadding * 2;
24785
24850
  overflowStyling = {
24786
24851
  overflowX: 'hidden'
24787
24852
  };
24788
24853
  const maxColumns = (maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.maxColumns) || 3;
24789
24854
  if ((maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.auto) !== false) {
24790
- columnCount = Math.min(listCount, Math.ceil((width - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
24855
+ columnCount = Math.min(listCount, Math.ceil((containerWidth - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
24791
24856
  } else {
24792
24857
  columnCount = Math.min(listCount, maxColumns);
24793
24858
  }
24794
24859
  rowCount = Math.ceil(listCount / columnCount);
24795
- columnWidth = (width - scrollBarWidth) / columnCount;
24860
+ columnWidth = (containerWidth - scrollBarWidth) / columnCount;
24796
24861
  } else {
24797
24862
  overflowStyling = {
24798
24863
  overflowY: 'hidden'
@@ -24804,7 +24869,7 @@
24804
24869
  rowCount = Math.min(listCount, maxRows);
24805
24870
  }
24806
24871
  columnCount = Math.ceil(listCount / rowCount);
24807
- columnWidth = Math.max(columnAutoWidth, width / columnCount);
24872
+ columnWidth = Math.max(columnAutoWidth, containerWidth / columnCount);
24808
24873
  }
24809
24874
  }
24810
24875
  columnCount = (dataLayout === 'singleColumn' ? 1 : columnCount) || 1;
@@ -24830,7 +24895,8 @@
24830
24895
  row: maxRowCount,
24831
24896
  column: maxColumnCount
24832
24897
  },
24833
- itemPadding
24898
+ itemPadding,
24899
+ frequencyWidth: FREQUENCY_WIDTH
24834
24900
  };
24835
24901
  }
24836
24902
 
@@ -25180,19 +25246,35 @@
25180
25246
  };
25181
25247
  }
25182
25248
 
25249
+ const FREQUENCY_MIN_SHOW_WIDTH = 80;
25250
+ function getFrequencyAllowed(_ref) {
25251
+ let {
25252
+ itemWidth,
25253
+ layout,
25254
+ frequencyMode
25255
+ } = _ref;
25256
+ const widthPermitsFreq = itemWidth > FREQUENCY_MIN_SHOW_WIDTH;
25257
+ const {
25258
+ frequencyEnabled = false
25259
+ } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
25260
+ const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
25261
+ return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
25262
+ }
25263
+
25183
25264
  const _excluded$4 = ["isLoadingData"];
25184
25265
  const DEFAULT_MIN_BATCH_SIZE = 100;
25185
25266
  function ListBox(_ref) {
25186
25267
  var _layout$qListObject$q, _loaderRef$current, _loaderRef$current$_l, _loaderRef$current$_l2;
25187
25268
  let {
25188
25269
  model,
25270
+ constraints,
25189
25271
  layout,
25190
25272
  selections,
25273
+ selectionState,
25191
25274
  direction,
25192
25275
  checkboxes: checkboxOption,
25193
25276
  height,
25194
25277
  width,
25195
- listLayout = 'vertical',
25196
25278
  frequencyMode,
25197
25279
  update = undefined,
25198
25280
  fetchStart = undefined,
@@ -25237,11 +25319,7 @@
25237
25319
  postProcessPages,
25238
25320
  listData
25239
25321
  }),
25240
- {
25241
- isLoadingData
25242
- } = _useItemsLoader,
25243
25322
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
25244
- const [pages, setPages] = reactExports.useState([]);
25245
25323
  const {
25246
25324
  setStoreValue
25247
25325
  } = useDataStore(model);
@@ -25253,9 +25331,16 @@
25253
25331
  const showOverflowDisclaimer = show => setOverflowDisclaimer(state => _objectSpread2(_objectSpread2({}, state), {}, {
25254
25332
  show
25255
25333
  }));
25256
- reactExports.useEffect(() => {
25257
- setPages((itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages) || []);
25258
- }, [itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages]);
25334
+ const [pages, setPages] = reactExports.useState([]);
25335
+ if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
25336
+ selectionState.update({
25337
+ setPages,
25338
+ pages: itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages,
25339
+ isSingleSelect,
25340
+ selectDisabled,
25341
+ layout
25342
+ });
25343
+ }
25259
25344
  const isItemLoaded = reactExports.useCallback(index => {
25260
25345
  if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
25261
25346
  return false;
@@ -25266,17 +25351,13 @@
25266
25351
  return page && isLoaded(page);
25267
25352
  }, [layout, pages]);
25268
25353
  const {
25269
- instantPages = [],
25270
25354
  interactionEvents,
25271
25355
  select
25272
25356
  } = useSelectionsInteractions({
25273
- layout,
25357
+ selectionState,
25274
25358
  selections,
25275
- pages,
25276
25359
  checkboxes,
25277
- selectDisabled,
25278
- doc: document,
25279
- isSingleSelect
25360
+ doc: document
25280
25361
  });
25281
25362
  const {
25282
25363
  layoutOptions = {}
@@ -25316,12 +25397,6 @@
25316
25397
  // Hand over the update function for manual refresh from hosting application.
25317
25398
  update.call(null, fetchData);
25318
25399
  }
25319
- reactExports.useEffect(() => {
25320
- if (!instantPages || isLoadingData) {
25321
- return;
25322
- }
25323
- setPages(instantPages);
25324
- }, [instantPages]);
25325
25400
  reactExports.useEffect(() => {
25326
25401
  if (scrollState && !initScrollPosIsSet && loaderRef.current) {
25327
25402
  loaderRef.current._listRef.scrollToItem(scrollState.initScrollPos);
@@ -25336,7 +25411,7 @@
25336
25411
  font: '14px Source sans pro'
25337
25412
  });
25338
25413
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
25339
- const isVertical = layoutOptions.dataLayout ? layoutOptions.dataLayout === 'singleColumn' : listLayout !== 'horizontal';
25414
+ const isVertical = layoutOptions.dataLayout !== 'grid';
25340
25415
  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;
25341
25416
  const unlimitedListCount = getListCount({
25342
25417
  pages,
@@ -25346,14 +25421,28 @@
25346
25421
  layoutOptions,
25347
25422
  model
25348
25423
  });
25424
+ let freqIsAllowed = getFrequencyAllowed({
25425
+ itemWidth: width,
25426
+ layout,
25427
+ frequencyMode
25428
+ });
25349
25429
  const sizes = getListSizes({
25350
25430
  layout,
25351
25431
  width,
25352
25432
  height,
25353
25433
  listCount: unlimitedListCount,
25354
25434
  count,
25355
- textWidth
25435
+ textWidth,
25436
+ freqIsAllowed
25356
25437
  });
25438
+ if (sizes.columnWidth) {
25439
+ // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
25440
+ freqIsAllowed = getFrequencyAllowed({
25441
+ itemWidth: sizes.columnWidth,
25442
+ layout,
25443
+ frequencyMode
25444
+ });
25445
+ }
25357
25446
  const {
25358
25447
  listCount
25359
25448
  } = sizes;
@@ -25372,7 +25461,7 @@
25372
25461
  });
25373
25462
  local.current.dataOffset = offset;
25374
25463
  if (triggerRerender) {
25375
- setPages(currentPages => [...currentPages]);
25464
+ selectionState.triggerStateChanged();
25376
25465
  }
25377
25466
  scrollToIndex(scrollIndex);
25378
25467
  };
@@ -25439,7 +25528,9 @@
25439
25528
  },
25440
25529
  setScrollPosition,
25441
25530
  focusListItems: getFocusState(),
25442
- setCurrentScrollIndex: currentScrollIndex.set
25531
+ setCurrentScrollIndex: currentScrollIndex.set,
25532
+ constraints,
25533
+ freqIsAllowed
25443
25534
  });
25444
25535
  const {
25445
25536
  columnWidth,
@@ -25517,7 +25608,8 @@
25517
25608
  let {
25518
25609
  layout,
25519
25610
  model,
25520
- translator
25611
+ translator,
25612
+ selectionState
25521
25613
  } = _ref;
25522
25614
  if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
25523
25615
  return [];
@@ -25533,6 +25625,7 @@
25533
25625
  getSvgIconShape: selectAll,
25534
25626
  enabled: canSelectAll,
25535
25627
  action: () => {
25628
+ selectionState.clearItemStates(false);
25536
25629
  model.selectListObjectAll('/qListObjectDef');
25537
25630
  }
25538
25631
  }, {
@@ -25542,6 +25635,7 @@
25542
25635
  getSvgIconShape: selectPossible,
25543
25636
  enabled: canSelectPossible,
25544
25637
  action: () => {
25638
+ selectionState.clearItemStates(false);
25545
25639
  model.selectListObjectPossible('/qListObjectDef');
25546
25640
  }
25547
25641
  }, {
@@ -25551,6 +25645,7 @@
25551
25645
  getSvgIconShape: selectAlternative,
25552
25646
  enabled: canSelectAlternative,
25553
25647
  action: () => {
25648
+ selectionState.clearItemStates(false);
25554
25649
  model.selectListObjectAlternative('/qListObjectDef');
25555
25650
  }
25556
25651
  }, {
@@ -25560,6 +25655,7 @@
25560
25655
  getSvgIconShape: selectExcluded,
25561
25656
  enabled: canSelectExcluded,
25562
25657
  action: () => {
25658
+ selectionState.clearItemStates(false);
25563
25659
  model.selectListObjectExcluded('/qListObjectDef');
25564
25660
  }
25565
25661
  }];
@@ -26068,6 +26164,7 @@
26068
26164
  function ListBoxSearch(_ref3) {
26069
26165
  let {
26070
26166
  selections,
26167
+ selectionState,
26071
26168
  model,
26072
26169
  keyboard,
26073
26170
  dense = false,
@@ -26142,6 +26239,7 @@
26142
26239
  response = model.acceptListObjectSearch(TREE_PATH, true);
26143
26240
  // eslint-disable-next-line no-param-reassign
26144
26241
  selections.selectionsMade = true;
26242
+ selectionState.clearItemStates(false);
26145
26243
  setValue('');
26146
26244
  }
26147
26245
  return response;
@@ -26181,7 +26279,8 @@
26181
26279
  },
26182
26280
  '&:hover': {
26183
26281
  border: 'none'
26184
- }
26282
+ },
26283
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px")
26185
26284
  }, dense && {
26186
26285
  fontSize: 12,
26187
26286
  paddingLeft: theme.spacing(1),
@@ -26455,6 +26554,125 @@
26455
26554
  return [objectSelections];
26456
26555
  }
26457
26556
 
26557
+ function selectionState() {
26558
+ const state = {
26559
+ itemStates: {},
26560
+ ignoreSelectionState: false,
26561
+ selectedInEngine: [],
26562
+ enginePages: [],
26563
+ setPages: undefined,
26564
+ lastRowCount: undefined,
26565
+ lastApprMaxGlyphCount: undefined,
26566
+ update(_ref) {
26567
+ var _layout$qListObject$q, _layout$qListObject, _layout$qListObject$q2;
26568
+ let {
26569
+ setPages,
26570
+ pages,
26571
+ isSingleSelect,
26572
+ selectDisabled,
26573
+ layout
26574
+ } = _ref;
26575
+ this.setPages = setPages;
26576
+ const isSameRowCount = this.lastRowCount === layout.qListObject.qSize.qcy;
26577
+ const isSameMaxGlyphCnt = this.lastApprMaxGlyphCount === layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
26578
+ if (!isSameRowCount || !isSameMaxGlyphCnt) {
26579
+ this.lastRowCount = layout.qListObject.qSize.qcy;
26580
+ this.lastApprMaxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
26581
+
26582
+ // The field have probably changed (drill up/down)
26583
+ // need to clear the client side item states since the field values have changed
26584
+ this.clearItemStates(false);
26585
+ }
26586
+ if (state.enginePages !== pages && pages !== undefined) {
26587
+ state.enginePages = pages !== null && pages !== void 0 ? pages : [];
26588
+ state.selectedInEngine = getSelectedValues(pages);
26589
+ state.selectableValuesUpdating = false;
26590
+ state.triggerStateChanged();
26591
+ }
26592
+ state.isSingleSelect = isSingleSelect;
26593
+ state.selectDisabled = selectDisabled;
26594
+ state.isDimCalculated = (_layout$qListObject$q = layout === null || layout === void 0 ? void 0 : (_layout$qListObject = layout.qListObject) === null || _layout$qListObject === void 0 ? void 0 : (_layout$qListObject$q2 = _layout$qListObject.qDimensionInfo) === null || _layout$qListObject$q2 === void 0 ? void 0 : _layout$qListObject$q2.qIsCalculated) !== null && _layout$qListObject$q !== void 0 ? _layout$qListObject$q : false;
26595
+ },
26596
+ allowedToSelect() {
26597
+ if (state.selectDisabled()) {
26598
+ return false;
26599
+ }
26600
+ // When a dim is calculated, the rows must be done updating after previeous selection
26601
+ return !(state.isDimCalculated && state.selectableValuesUpdating);
26602
+ },
26603
+ setSelectableValuesUpdating() {
26604
+ state.selectableValuesUpdating = true;
26605
+ },
26606
+ useClientItemState(elementNumber) {
26607
+ return state.ignoreSelectionState || elementNumber in state.itemStates;
26608
+ },
26609
+ isSelected(elementNumber) {
26610
+ if (state.useClientItemState(elementNumber)) {
26611
+ return !!state.itemStates[elementNumber];
26612
+ }
26613
+ return state.selectedInEngine.includes(elementNumber);
26614
+ },
26615
+ getState(item) {
26616
+ const {
26617
+ qElemNumber,
26618
+ qState
26619
+ } = item;
26620
+ if (!state.useClientItemState(qElemNumber)) {
26621
+ return qState;
26622
+ }
26623
+ if (state.itemStates[qElemNumber]) {
26624
+ return qState === 'XS' ? 'XS' : 'S';
26625
+ }
26626
+ return qState === 'S' || qState === 'XS' ? 'A' : qState;
26627
+ },
26628
+ updateItemNoEvents(elementNumber, additive, selectedValues) {
26629
+ const selected = state.isSelected(elementNumber);
26630
+ if (selected && !additive) {
26631
+ state.itemStates[elementNumber] = false;
26632
+ } else if (!selected) {
26633
+ selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.push(elementNumber);
26634
+ state.itemStates[elementNumber] = true;
26635
+ }
26636
+ },
26637
+ triggerStateChanged() {
26638
+ if (this.setPages) {
26639
+ const pages = state.applySelectionsOnPages(state.enginePages);
26640
+ this.setPages(pages);
26641
+ }
26642
+ },
26643
+ applySelectionsOnPages(pages) {
26644
+ const matrices = pages.map(page => {
26645
+ const qMatrix = page.qMatrix.map(p => {
26646
+ const [p0] = p;
26647
+ const qState = state.getState(p0);
26648
+ return [_objectSpread2(_objectSpread2({}, p0), {}, {
26649
+ qState
26650
+ }), ...p.slice(1)];
26651
+ });
26652
+ return _objectSpread2(_objectSpread2({}, page), {}, {
26653
+ qMatrix
26654
+ });
26655
+ });
26656
+ return matrices;
26657
+ },
26658
+ updateItem(elementNumber, additive, selectedValues) {
26659
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
26660
+ state.triggerStateChanged();
26661
+ },
26662
+ updateItems(elementNumbers, additive, selectedValues) {
26663
+ elementNumbers.forEach(elementNumber => {
26664
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
26665
+ });
26666
+ state.triggerStateChanged();
26667
+ },
26668
+ clearItemStates(ignoreSelectionState) {
26669
+ state.itemStates = {};
26670
+ state.ignoreSelectionState = ignoreSelectionState;
26671
+ }
26672
+ };
26673
+ return state;
26674
+ }
26675
+
26458
26676
  const getValue$1 = function (obj, prop) {
26459
26677
  var _obj$prop;
26460
26678
  let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
@@ -26526,6 +26744,7 @@
26526
26744
  const containerRef = reactExports.useRef();
26527
26745
  const [selections] = useObjectSelections(app, model, containerRef);
26528
26746
  const [layout] = useLayout$1(model);
26747
+ const [selectionState$1] = reactExports.useState(() => selectionState());
26529
26748
  reactExports.useEffect(() => {
26530
26749
  if (selections && open) {
26531
26750
  if (!selections.isModal(model)) {
@@ -26545,7 +26764,8 @@
26545
26764
  const listboxSelectionToolbarItems = createListboxSelectionToolbar({
26546
26765
  layout,
26547
26766
  model,
26548
- translator
26767
+ translator,
26768
+ selectionState: selectionState$1
26549
26769
  });
26550
26770
  const hasSelections$1 = hasSelections(layout);
26551
26771
  return /*#__PURE__*/React.createElement(Popover$1, {
@@ -26618,6 +26838,7 @@
26618
26838
  model: model,
26619
26839
  listCount: listCount,
26620
26840
  selections: selections,
26841
+ selectionState: selectionState$1,
26621
26842
  keyboard: {
26622
26843
  enabled: false
26623
26844
  },
@@ -26626,6 +26847,7 @@
26626
26847
  model: model,
26627
26848
  layout: layout,
26628
26849
  selections: selections,
26850
+ selectionState: selectionState$1,
26629
26851
  direction: "ltr",
26630
26852
  onSetListCount: c => setListCount(c)
26631
26853
  }))));
@@ -27885,6 +28107,16 @@
27885
28107
  style: {}
27886
28108
  };
27887
28109
 
28110
+ const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
28111
+ shapes: [{
28112
+ type: 'path',
28113
+ attrs: {
28114
+ d: 'M15.9993744,3 L15.9993744,5 L4.99937445,5 L4.99937445,3 L15.9993744,3 Z M8.99937445,7 L15.9993744,7 L15.9993744,9 L8.99937445,9 L8.99937445,7 Z M11.9993744,11 L15.9993744,11 L15.9993744,13 L11.9993744,13 L11.9993744,11 Z M2.2,11 L7,11 L7,9.00369263 C7,8.89323568 7.08954305,8.80369263 7.2,8.80369263 C7.2549016,8.80369263 7.30738916,8.82626165 7.34515712,8.86610844 L10.1852182,11.8624926 C10.2583124,11.93961 10.258346,12.0604218 10.1852948,12.13758 L7.34523376,15.1373102 C7.2692928,15.2175206 7.14270711,15.2209817 7.06249671,15.1450407 C7.02260076,15.1072683 7,15.0547472 7,14.9998069 L7,12.9043747 C4.79351111,12.9043747 2.8018683,12.9266213 1.02507156,12.9711145 L1.02507252,12.9711526 C0.472939773,12.9849787 0.014139487,12.5485949 0.000313396522,11.9964622 C0.000104473692,11.988119 -1.32268838e-12,11.9797736 -1.3231638e-12,11.9714278 L-1.83320026e-12,3 L2,3 L2,10.8 C2,10.9104569 2.08954305,11 2.2,11 Z'
28115
+ }
28116
+ }]
28117
+ });
28118
+ var DrillDownIcon = (props => SvgIcon(drillDown(props)));
28119
+
27888
28120
  const addListboxTheme = themeApi => {
27889
28121
  const getListboxStyle = prop => themeApi.getStyle('object', '', "listBox.".concat(prop));
27890
28122
  return {
@@ -27906,14 +28138,19 @@
27906
28138
 
27907
28139
  const PREFIX$4 = 'ListBoxInline';
27908
28140
  const searchIconWidth = 28;
28141
+ const drillDownIconWidth = 24;
27909
28142
  const classes$4 = {
27910
28143
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
27911
- screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
28144
+ screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly"),
28145
+ listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
27912
28146
  };
27913
- const StyledGrid$3 = styled$1(Grid$1)(_ref => {
28147
+ const StyledGrid$3 = styled$1(Grid$1, {
28148
+ shouldForwardProp: p => !['containerPadding'].includes(p)
28149
+ })(_ref => {
27914
28150
  var _theme$listBox$backgr, _theme$listBox;
27915
28151
  let {
27916
- theme
28152
+ theme,
28153
+ containerPadding
27917
28154
  } = _ref;
27918
28155
  return {
27919
28156
  backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
@@ -27927,6 +28164,9 @@
27927
28164
  height: 0,
27928
28165
  width: 0,
27929
28166
  overflow: 'hidden'
28167
+ },
28168
+ ["& .".concat(classes$4.listboxWrapper)]: {
28169
+ padding: containerPadding
27930
28170
  }
27931
28171
  };
27932
28172
  });
@@ -27942,7 +28182,7 @@
27942
28182
  };
27943
28183
  });
27944
28184
  function ListBoxInline(_ref3) {
27945
- var _layout$layoutOptions, _layout$layoutOptions2;
28185
+ var _layoutOptions$dense;
27946
28186
  let {
27947
28187
  options,
27948
28188
  layout
@@ -27951,7 +28191,6 @@
27951
28191
  app,
27952
28192
  direction,
27953
28193
  frequencyMode,
27954
- listLayout,
27955
28194
  checkboxes,
27956
28195
  search = true,
27957
28196
  focusSearch = false,
@@ -28010,6 +28249,7 @@
28010
28249
  stop: 0
28011
28250
  });
28012
28251
  const [appSelections] = useAppSelections(app);
28252
+ const [selectionState$1] = reactExports.useState(() => selectionState());
28013
28253
  const {
28014
28254
  handleKeyDown,
28015
28255
  handleOnMouseEnter,
@@ -28077,17 +28317,23 @@
28077
28317
  return null;
28078
28318
  }
28079
28319
  const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
28320
+ const isDrillDown = layout.qListObject.qDimensionInfo.qGrouping === 'H';
28080
28321
  const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
28081
28322
  layout,
28082
28323
  model,
28083
- translator
28324
+ translator,
28325
+ selectionState: selectionState$1
28084
28326
  }) : [];
28085
28327
  const showSearchToggle = search === 'toggle' && showSearch;
28086
28328
  const searchVisible = (search === true || showSearchToggle) && !selectDisabled();
28087
- const dense = (_layout$layoutOptions = (_layout$layoutOptions2 = layout.layoutOptions) === null || _layout$layoutOptions2 === void 0 ? void 0 : _layout$layoutOptions2.dense) !== null && _layout$layoutOptions !== void 0 ? _layout$layoutOptions : false;
28329
+ const {
28330
+ layoutOptions = {}
28331
+ } = layout;
28332
+ const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
28088
28333
  const searchHeight = dense ? 27 : 40;
28089
28334
  const extraheight = dense ? 39 : 49;
28090
28335
  const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
28336
+ const headerHeight = 32;
28091
28337
  const {
28092
28338
  wildCardSearch,
28093
28339
  searchEnabled
@@ -28097,12 +28343,26 @@
28097
28343
  setShowSearch(newValue);
28098
28344
  };
28099
28345
  const shouldAutoFocus = searchVisible && search === 'toggle';
28346
+ const showSearchIcon = searchEnabled !== false && search === 'toggle' && !(constraints !== null && constraints !== void 0 && constraints.active);
28347
+ const showSearchOrLockIcon = isLocked || showSearchIcon;
28348
+ const showIcons = showSearchOrLockIcon || isDrillDown;
28349
+ const iconsWidth = (showSearchOrLockIcon ? searchIconWidth : 0) + (isDrillDown ? drillDownIconWidth : 0);
28350
+ const drillDownPaddingLeft = showSearchOrLockIcon ? 0 : ICON_PADDING;
28351
+ const headerPaddingLeft = CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0);
28352
+
28353
+ // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
28354
+ const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
28355
+ let containerPadding;
28356
+ if (isGridMode) {
28357
+ containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
28358
+ }
28100
28359
  return /*#__PURE__*/React.createElement(StyledGrid$3, {
28101
28360
  className: "listbox-container",
28102
28361
  container: true,
28103
28362
  tabIndex: keyboard.enabled && !keyboard.active ? 0 : -1,
28104
28363
  direction: "column",
28105
28364
  gap: 0,
28365
+ containerPadding: containerPadding,
28106
28366
  style: {
28107
28367
  height: '100%',
28108
28368
  minHeight: "".concat(minHeight, "px"),
@@ -28116,45 +28376,60 @@
28116
28376
  item: true,
28117
28377
  container: true,
28118
28378
  style: {
28119
- padding: theme.spacing(1)
28379
+ padding: theme.spacing(1),
28380
+ paddingLeft: "".concat(headerPaddingLeft, "px")
28120
28381
  },
28121
28382
  wrap: "nowrap"
28122
28383
  }, /*#__PURE__*/React.createElement(Grid$1, {
28123
28384
  item: true,
28124
28385
  container: true,
28386
+ height: headerHeight,
28125
28387
  wrap: "nowrap"
28126
- }, /*#__PURE__*/React.createElement(Grid$1, {
28388
+ }, showIcons && /*#__PURE__*/React.createElement(Grid$1, {
28127
28389
  item: true,
28128
28390
  sx: {
28129
28391
  display: 'flex',
28130
28392
  alignItems: 'center',
28131
- width: searchIconWidth
28393
+ width: iconsWidth
28132
28394
  }
28133
28395
  }, isLocked ? /*#__PURE__*/React.createElement(IconButton$1, {
28134
28396
  tabIndex: -1,
28135
28397
  onClick: unlock,
28136
- disabled: !isLocked,
28398
+ disabled: selectDisabled(),
28137
28399
  size: "large"
28138
28400
  }, /*#__PURE__*/React.createElement(Lock, {
28139
28401
  title: translator.get('Listbox.Unlock'),
28140
28402
  style: {
28141
28403
  fontSize: '12px'
28142
28404
  }
28143
- })) : searchEnabled !== false && /*#__PURE__*/React.createElement(IconButton$1, {
28405
+ })) : showSearchIcon && /*#__PURE__*/React.createElement(IconButton$1, {
28144
28406
  onClick: onShowSearch,
28145
28407
  tabIndex: -1,
28146
28408
  title: translator.get('Listbox.Search'),
28147
- size: "large"
28409
+ size: "large",
28410
+ "data-testid": "search-toggle-btn"
28148
28411
  }, /*#__PURE__*/React.createElement(SearchIcon, {
28149
28412
  style: {
28150
28413
  fontSize: '12px'
28151
28414
  }
28415
+ })), isDrillDown && /*#__PURE__*/React.createElement(IconButton$1, {
28416
+ tabIndex: -1,
28417
+ title: translator.get('Listbox.DrillDown'),
28418
+ size: "large",
28419
+ sx: {
28420
+ paddingLeft: "".concat(drillDownPaddingLeft, "px")
28421
+ }
28422
+ }, /*#__PURE__*/React.createElement(DrillDownIcon, {
28423
+ style: {
28424
+ fontSize: '12px'
28425
+ }
28152
28426
  }))), /*#__PURE__*/React.createElement(Grid$1, {
28153
28427
  item: true,
28154
28428
  className: classes$4.listBoxHeader
28155
28429
  }, /*#__PURE__*/React.createElement(Title, {
28156
28430
  variant: "h6",
28157
- noWrap: true
28431
+ noWrap: true,
28432
+ title: layout.title
28158
28433
  }, layout.title))), /*#__PURE__*/React.createElement(Grid$1, {
28159
28434
  item: true,
28160
28435
  xs: true
@@ -28198,6 +28473,7 @@
28198
28473
  className: classes$4.screenReaderOnly
28199
28474
  }, translator.get('Listbox.Search.ScreenReaderInstructions')), /*#__PURE__*/React.createElement(ListBoxSearch, {
28200
28475
  selections: selections,
28476
+ selectionState: selectionState$1,
28201
28477
  model: model,
28202
28478
  dense: dense,
28203
28479
  keyboard: keyboard,
@@ -28209,7 +28485,8 @@
28209
28485
  searchEnabled: searchEnabled
28210
28486
  })), /*#__PURE__*/React.createElement(Grid$1, {
28211
28487
  item: true,
28212
- xs: true
28488
+ xs: true,
28489
+ className: classes$4.listboxWrapper
28213
28490
  }, /*#__PURE__*/React.createElement("div", {
28214
28491
  className: classes$4.screenReaderOnly
28215
28492
  }, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React.createElement(AutoSizer, null, _ref4 => {
@@ -28219,10 +28496,11 @@
28219
28496
  } = _ref4;
28220
28497
  return /*#__PURE__*/React.createElement(ListBox, {
28221
28498
  model: model,
28499
+ constraints: constraints,
28222
28500
  layout: layout,
28223
28501
  selections: selections,
28502
+ selectionState: selectionState$1,
28224
28503
  direction: direction,
28225
- listLayout: listLayout,
28226
28504
  frequencyMode: frequencyMode,
28227
28505
  rangeSelect: rangeSelect,
28228
28506
  checkboxes: checkboxes,
@@ -28291,6 +28569,9 @@
28291
28569
  } else {
28292
28570
  const m = await app.getObject(qId);
28293
28571
  modelStore.set(m.id, m);
28572
+ m.once('closed', () => {
28573
+ modelStore.clear(m.id);
28574
+ });
28294
28575
  setModel(m);
28295
28576
  }
28296
28577
  }
@@ -28344,6 +28625,7 @@
28344
28625
  const {
28345
28626
  dense,
28346
28627
  checkboxes,
28628
+ listLayout,
28347
28629
  properties = {}
28348
28630
  } = options;
28349
28631
  let {
@@ -28372,6 +28654,20 @@
28372
28654
  break;
28373
28655
  }
28374
28656
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
28657
+ const layoutOptions = {
28658
+ dense
28659
+ };
28660
+ if (listLayout === 'horizontal') {
28661
+ layoutOptions.dataLayout = 'grid';
28662
+ layoutOptions.layoutOrder = 'column';
28663
+ layoutOptions.maxVisibleColumns = {
28664
+ auto: true
28665
+ };
28666
+ layoutOptions.maxVisibleRows = {
28667
+ auto: false,
28668
+ maxRows: 1
28669
+ };
28670
+ }
28375
28671
  const id = reactExports.useRef();
28376
28672
  if (!id.current) {
28377
28673
  id.current = uid();
@@ -28384,6 +28680,7 @@
28384
28680
  qListObjectDef: {
28385
28681
  qStateName: stateName,
28386
28682
  qShowAlternatives: true,
28683
+ frequencyEnabled: false,
28387
28684
  qFrequencyMode: getListdefFrequencyMode(),
28388
28685
  qInitialDataFetch: [{
28389
28686
  qTop: 0,
@@ -28402,9 +28699,7 @@
28402
28699
  },
28403
28700
  histogram,
28404
28701
  checkboxes,
28405
- layoutOptions: {
28406
- dense
28407
- },
28702
+ layoutOptions,
28408
28703
  title
28409
28704
  };
28410
28705
  extend$1(true, listdef, properties);