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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v3.3.0
2
+ * @nebula.js/stardust v4.0.0-alpha.1
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++) {
@@ -15097,7 +15112,7 @@
15097
15112
  disabled: 'rgba(0, 0, 0, 0.3)'
15098
15113
  },
15099
15114
  action: {
15100
- active: colors.grey25,
15115
+ active: '#545454',
15101
15116
  // color for actionable things like icon buttons
15102
15117
  hover: 'rgba(0, 0, 0, 0.03)',
15103
15118
  // color for hoverable things like list items
@@ -15237,10 +15252,21 @@
15237
15252
  padding: 7,
15238
15253
  borderRadius: 2,
15239
15254
  border: '1px solid transparent',
15240
- // should ideally use $focusVisible, but that messes up focus in all other places where Iconbutton is used (Checkbox, Switch etc)
15241
- '&:focus': {
15255
+ '&:hover': {
15256
+ backgroundColor: theme.palette.btn.hover
15257
+ },
15258
+ '&:focus-visible': {
15242
15259
  borderColor: theme.palette.custom.focusBorder,
15243
15260
  boxShadow: "0 0 0 2px ".concat(theme.palette.custom.focusOutline)
15261
+ },
15262
+ '&:active': {
15263
+ borderColor: 'transparent',
15264
+ boxShadow: 'none',
15265
+ backgroundColor: theme.palette.btn.active
15266
+ },
15267
+ '&:not(:active):not(:focus-visible)': {
15268
+ borderColor: 'transparent',
15269
+ boxShadow: 'none'
15244
15270
  }
15245
15271
  }
15246
15272
  },
@@ -15328,7 +15354,7 @@
15328
15354
  return cache[key];
15329
15355
  }
15330
15356
 
15331
- const NEBULA_VERSION_HASH = "593e" ;
15357
+ const NEBULA_VERSION_HASH = "f871" ;
15332
15358
  ClassNameGenerator$1.configure(componentName => {
15333
15359
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15334
15360
  });
@@ -15490,7 +15516,8 @@
15490
15516
  const NebulaApp = reactExports.forwardRef((_ref, ref) => {
15491
15517
  let {
15492
15518
  initialContext,
15493
- app
15519
+ app,
15520
+ renderCallback
15494
15521
  } = _ref;
15495
15522
  const [appSelections] = useAppSelections(app);
15496
15523
  const [context, setContext] = reactExports.useState(initialContext);
@@ -15501,21 +15528,20 @@
15501
15528
  theme: create$3(muiThemeName)
15502
15529
  }), [muiThemeName]);
15503
15530
  const [components, setComponents] = reactExports.useState([]);
15531
+
15532
+ // Will be called directly after the first render pass
15533
+ // See: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
15534
+ reactExports.useEffect(() => {
15535
+ renderCallback && renderCallback();
15536
+ }, []);
15504
15537
  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
- }
15538
+ setComps(comps) {
15539
+ setComponents([...comps]);
15514
15540
  },
15515
15541
  setMuiThemeName,
15516
15542
  setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext),
15517
15543
  getAppSelections: () => appSelections
15518
- }));
15544
+ }), []);
15519
15545
  return /*#__PURE__*/React.createElement(StyledEngineProvider, {
15520
15546
  injectFirst: true
15521
15547
  }, /*#__PURE__*/React.createElement(ThemeProvider, {
@@ -15536,15 +15562,18 @@
15536
15562
  const appRef = React.createRef();
15537
15563
  const element = document.createElement('div');
15538
15564
  element.style.display = 'none';
15539
- element.setAttribute('data-nebulajs-version', "3.3.0" );
15565
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.1" );
15540
15566
  element.setAttribute('data-app-id', app.id);
15541
15567
  document.body.appendChild(element);
15542
- ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
15568
+ const root = client.createRoot(element);
15569
+ root.render( /*#__PURE__*/React.createElement(NebulaApp, {
15543
15570
  ref: appRef,
15544
15571
  app: app,
15545
- initialContext: context
15546
- }), element, resolveRender);
15572
+ initialContext: context,
15573
+ renderCallback: resolveRender
15574
+ }));
15547
15575
  const cells = {};
15576
+ const components = [];
15548
15577
  return [{
15549
15578
  toggleFocusOfCells(cellIdToFocus) {
15550
15579
  Object.keys(cells).forEach(i => {
@@ -15561,13 +15590,18 @@
15561
15590
  add(component) {
15562
15591
  (async () => {
15563
15592
  await rendered;
15564
- appRef.current.addComponent(component);
15593
+ components.push(component);
15594
+ appRef.current.setComps(components);
15565
15595
  })();
15566
15596
  },
15567
15597
  remove(component) {
15568
15598
  (async () => {
15569
15599
  await rendered;
15570
- appRef.current.removeComponent(component);
15600
+ const ix = components.indexOf(component);
15601
+ if (ix !== -1) {
15602
+ components.splice(ix, 1);
15603
+ }
15604
+ appRef.current.setComps(components);
15571
15605
  })();
15572
15606
  },
15573
15607
  setMuiThemeName(themeName) {
@@ -21495,9 +21529,6 @@
21495
21529
  function isStateSelected(qState) {
21496
21530
  return SELECTED_STATES.includes(qState);
21497
21531
  }
21498
- function getUniques(arr) {
21499
- return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
21500
- }
21501
21532
  function getSelectedValues(pages) {
21502
21533
  if (!pages || !pages.length) {
21503
21534
  return [];
@@ -21511,45 +21542,38 @@
21511
21542
  });
21512
21543
  return flatten(elementNbrs);
21513
21544
  }
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
21545
  async function selectValues(_ref) {
21538
21546
  let {
21539
21547
  selections,
21540
21548
  elemNumbers,
21541
- isSingleSelect = false
21549
+ toggle,
21550
+ isSingleSelect
21542
21551
  } = _ref;
21543
- let resolved = Promise.resolve(false);
21552
+ if (elemNumbers.length === 0) {
21553
+ return false;
21554
+ }
21544
21555
  const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
21556
+ let success = false;
21545
21557
  if (!hasNanValues) {
21546
21558
  const elemNumbersToSelect = elemNumbers;
21547
- resolved = selections.select({
21548
- method: 'selectListObjectValues',
21549
- params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
21550
- }).then(success => success !== false).catch(() => false);
21559
+ try {
21560
+ const response = await selections.select({
21561
+ method: 'selectListObjectValues',
21562
+ params: ['/qListObjectDef', elemNumbersToSelect, toggle]
21563
+ });
21564
+ success = response !== false;
21565
+ } catch (_unused) {
21566
+ success = false;
21567
+ }
21568
+ if (!success) {
21569
+ if (isSingleSelect) {
21570
+ selections.cancel(); // revert selection
21571
+ } else {
21572
+ selections.clear();
21573
+ }
21574
+ }
21551
21575
  }
21552
- return resolved;
21576
+ return success;
21553
21577
  }
21554
21578
  function getElemNumbersFromPages(pages) {
21555
21579
  if (!pages || !pages.length) {
@@ -21612,126 +21636,132 @@
21612
21636
  return elemNumbersOrdered.slice(min, max + 1);
21613
21637
  }
21614
21638
 
21639
+ const getKeyAsToggleSelected = event => !(event.metaKey || event.ctrlKey);
21615
21640
  function useSelectionsInteractions(_ref) {
21616
21641
  let {
21617
- layout,
21642
+ selectionState,
21618
21643
  selections,
21619
- pages = [],
21620
21644
  checkboxes = false,
21621
- selectDisabled,
21622
- doc = document,
21623
- isSingleSelect: singleSelect = false
21645
+ doc = document
21624
21646
  } = _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({
21647
+ const currentSelect = reactExports.useRef({
21648
+ startElemNumber: undefined,
21649
+ elemNumbers: [],
21650
+ isRange: false,
21651
+ toggle: false,
21652
+ active: false
21653
+ });
21654
+
21655
+ // eslint-disable-next-line arrow-body-style
21656
+ const doSelect = () => {
21657
+ selectionState.setSelectableValuesUpdating();
21658
+ return selectValues({
21647
21659
  selections,
21648
- elemNumbers: filtered,
21649
- isSingleSelect
21660
+ elemNumbers: currentSelect.current.elemNumbers,
21661
+ isSingleSelect: selectionState.isSingleSelect,
21662
+ toggle: currentSelect.current.toggle
21650
21663
  });
21651
- setSelectingValues(false);
21652
- setPreSelected([]);
21653
21664
  };
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()) {
21665
+ const addToRange = elemNumber => {
21666
+ const {
21667
+ startElemNumber
21668
+ } = currentSelect.current;
21669
+ if (startElemNumber === elemNumber) {
21659
21670
  return;
21660
21671
  }
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
- });
21672
+ const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
21673
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
21674
+ const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
21675
+ selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
21667
21676
  };
21668
21677
  const selectManually = function () {
21669
21678
  let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21670
21679
  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 => {
21680
+ const elemNumbers = [];
21681
+ selectionState.updateItems(elementIds, additive, elemNumbers);
21682
+ selectionState.setSelectableValuesUpdating();
21683
+ return selectValues({
21684
+ selections,
21685
+ elemNumbers: additive ? elemNumbers : elementIds,
21686
+ isSingleSelect: selectionState.isSingleSelect,
21687
+ toggle: !selectionState.isSingleSelect
21688
+ });
21689
+ };
21690
+ const handleSingleSelectKey = (event, target) => {
21679
21691
  if (event.ctrlKey || event.metaKey) {
21680
- setIsSingleSelect(true);
21681
- event.currentTarget.focus(); // will not be focused otherwise
21692
+ target.focus(); // will not be focused otherwise
21682
21693
  event.preventDefault();
21683
21694
  }
21684
21695
  };
21685
- const onClick = reactExports.useCallback(event => {
21686
- if (selectingValues || selectDisabled()) {
21696
+ const onChange = reactExports.useCallback(event => {
21697
+ if (selectionState.selectDisabled()) {
21687
21698
  return;
21688
21699
  }
21689
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21690
- setPreSelected([elemNumber]);
21691
- handleSingleSelectKey(event);
21692
- }, [selectingValues, selectDisabled]);
21700
+ const elemNumber = +event.target.getAttribute('data-n');
21701
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event.nativeEvent);
21702
+ currentSelect.current.elemNumbers = [elemNumber];
21703
+ currentSelect.current.toggle = toggle;
21704
+ if (!toggle) {
21705
+ selectionState.clearItemStates(true);
21706
+ }
21707
+ selectionState.updateItem(elemNumber);
21708
+ currentSelect.current.active = false;
21709
+ doSelect();
21710
+ }, []);
21693
21711
  const onMouseDown = reactExports.useCallback(event => {
21694
- if (selectingValues || selectDisabled()) {
21712
+ if (event.button !== 0 || selectionState.selectDisabled()) {
21695
21713
  return;
21696
21714
  }
21697
- setIsRangeSelection(false);
21698
- setMouseDown(true);
21699
21715
  const elemNumber = +event.currentTarget.getAttribute('data-n');
21700
- setPreSelected([elemNumber]);
21701
- handleSingleSelectKey(event);
21702
- }, [selectingValues, selectDisabled]);
21716
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event);
21717
+ currentSelect.current.isRange = false;
21718
+ currentSelect.current.startElemNumber = elemNumber;
21719
+ currentSelect.current.elemNumbers = [elemNumber];
21720
+ currentSelect.current.toggle = toggle;
21721
+ currentSelect.current.active = true;
21722
+ if (!toggle) {
21723
+ selectionState.clearItemStates(true);
21724
+ }
21725
+ selectionState.updateItem(elemNumber);
21726
+ if (selectionState.isSingleSelect) {
21727
+ currentSelect.current.active = false;
21728
+ doSelect();
21729
+ }
21730
+ handleSingleSelectKey(event, event.currentTarget);
21731
+ }, []);
21703
21732
  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
- ) {
21733
+ if (event.button !== 0 || !currentSelect.current.active) {
21707
21734
  return;
21708
21735
  }
21709
- preSelect([elemNumber]);
21710
- }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection, selectDisabled]);
21711
- const onMouseUpDoc = reactExports.useCallback(() => {
21736
+ currentSelect.current.active = false;
21737
+ if (currentSelect.current.isRange) {
21738
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
21739
+ addToRange(elemNumber);
21740
+ }
21741
+ doSelect();
21742
+ }, []);
21743
+ const onMouseUpDoc = reactExports.useCallback(event => {
21712
21744
  // 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()) {
21745
+ if (event.button !== 0 || !currentSelect.current.active) {
21720
21746
  return;
21721
21747
  }
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) {
21748
+ currentSelect.current.active = false;
21749
+ doSelect();
21750
+ }, []);
21751
+ const onMouseEnter = reactExports.useCallback(event => {
21752
+ if (!currentSelect.current.active) {
21731
21753
  return;
21732
21754
  }
21733
- select(preSelected, isRangeSelection);
21734
- }, [preSelected, mouseDown, selectDisabled()]);
21755
+ if (!currentSelect.current.isRange) {
21756
+ currentSelect.current.isRange = true;
21757
+ if (!selectionState.isSelected(currentSelect.current.startElemNumber)) {
21758
+ selectionState.updateItem(currentSelect.current.startElemNumber, true);
21759
+ currentSelect.current.elemNumbers = [];
21760
+ }
21761
+ }
21762
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
21763
+ addToRange(elemNumber);
21764
+ }, []);
21735
21765
  reactExports.useEffect(() => {
21736
21766
  doc.addEventListener('mouseup', onMouseUpDoc);
21737
21767
  return () => {
@@ -21739,25 +21769,26 @@
21739
21769
  };
21740
21770
  }, [onMouseUpDoc]);
21741
21771
  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]);
21772
+ const clearItemStates = () => {
21773
+ selectionState.clearItemStates(false);
21774
+ };
21775
+ const onCleared = () => {
21776
+ selectionState.clearItemStates(true);
21777
+ selectionState.triggerStateChanged();
21778
+ };
21779
+ selections.on('clearItemStates', clearItemStates);
21780
+ selections.on('deactivated', clearItemStates);
21781
+ selections.on('cleared', onCleared);
21782
+ return () => {
21783
+ selections.removeListener('clearItemStates', clearItemStates);
21784
+ selections.removeListener('deactivated', clearItemStates);
21785
+ selections.removeListener('cleared', onCleared);
21786
+ };
21787
+ }, [selections]);
21757
21788
  const interactionEvents = {};
21758
21789
  if (checkboxes) {
21759
21790
  Object.assign(interactionEvents, {
21760
- onClick
21791
+ onChange
21761
21792
  });
21762
21793
  } else {
21763
21794
  Object.assign(interactionEvents, {
@@ -21767,7 +21798,6 @@
21767
21798
  });
21768
21799
  }
21769
21800
  return {
21770
- instantPages,
21771
21801
  interactionEvents,
21772
21802
  select: selectManually // preselect and select without having to trigger an event
21773
21803
  };
@@ -22114,6 +22144,34 @@
22114
22144
  } = _ref;
22115
22145
  return (isAlternative(cell) || isExcluded(cell)) && checkboxes;
22116
22146
  };
22147
+ const getValueStateClasses = _ref2 => {
22148
+ let {
22149
+ column,
22150
+ histogram,
22151
+ checkboxes,
22152
+ cell,
22153
+ showGray
22154
+ } = _ref2;
22155
+ const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
22156
+ if (!histogram) {
22157
+ clazzArr.push(rowColClasses.rowBorderBottom);
22158
+ }
22159
+ if (!cell) {
22160
+ return [];
22161
+ }
22162
+ if (!checkboxes) {
22163
+ if (cell.qState === 'XS') {
22164
+ clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
22165
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
22166
+ clazzArr.push(rowColClasses.S);
22167
+ } else if (showGray && isAlternative(cell)) {
22168
+ clazzArr.push(rowColClasses.A);
22169
+ } else if (showGray && isExcluded(cell)) {
22170
+ clazzArr.push(rowColClasses.X);
22171
+ }
22172
+ }
22173
+ return clazzArr;
22174
+ };
22117
22175
 
22118
22176
  const frequencyTextNone = '-';
22119
22177
  const barPadPx = 4;
@@ -22144,6 +22202,11 @@
22144
22202
  return '';
22145
22203
  };
22146
22204
 
22205
+ const CELL_PADDING_LEFT = 9;
22206
+ const ICON_WIDTH = 12;
22207
+ const ICON_PADDING = 7;
22208
+ const BUTTON_ICON_WIDTH = ICON_WIDTH + (ICON_PADDING + 1) * 2; // 1 is border width
22209
+
22147
22210
  const getSelectedStyle = _ref => {
22148
22211
  let {
22149
22212
  theme
@@ -22163,10 +22226,11 @@
22163
22226
  const ellipsis = {
22164
22227
  width: '100%',
22165
22228
  overflow: 'hidden',
22166
- textOverflow: 'ellipsis'
22229
+ textOverflow: 'ellipsis',
22230
+ whiteSpace: 'nowrap'
22167
22231
  };
22168
22232
  const RowColRoot = styled$1('div', {
22169
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense'].includes(prop)
22233
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
22170
22234
  })(_ref2 => {
22171
22235
  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
22236
  let {
@@ -22174,7 +22238,8 @@
22174
22238
  flexBasisProp,
22175
22239
  isGridMode,
22176
22240
  isGridCol,
22177
- dense
22241
+ dense,
22242
+ frequencyWidth
22178
22243
  } = _ref2;
22179
22244
  return {
22180
22245
  '&:focus': {
@@ -22203,18 +22268,18 @@
22203
22268
  minWidth: 0,
22204
22269
  flexGrow: 1,
22205
22270
  // Note that this padding is overridden when using checkboxes.
22206
- paddingLeft: '9px',
22207
- paddingRight: '9px'
22271
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
22272
+ paddingRight: 0
22208
22273
  },
22209
22274
  // The leaf node, containing the label text.
22210
22275
  ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
22211
22276
  flexBasis: flexBasisProp,
22212
22277
  lineHeight: '16px',
22213
22278
  userSelect: 'none',
22279
+ paddingRight: '1px'
22280
+ }, ellipsis), {}, {
22214
22281
  whiteSpace: 'pre',
22215
22282
  // to keep white-space on highlight
22216
- paddingRight: '9px'
22217
- }, ellipsis), {}, {
22218
22283
  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
22284
  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
22285
  }),
@@ -22252,7 +22317,10 @@
22252
22317
  // The icons container holding tick and lock, shown inside fields.
22253
22318
  ["& .".concat(rowColClasses.icon)]: {
22254
22319
  display: 'flex',
22255
- padding: theme.spacing(1, 1, 1, 0)
22320
+ justifyContent: 'center',
22321
+ width: 24,
22322
+ minWidth: 24,
22323
+ maxWidth: 24
22256
22324
  },
22257
22325
  // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
22258
22326
  ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
@@ -22264,7 +22332,7 @@
22264
22332
  theme
22265
22333
  })), {}, {
22266
22334
  background: theme.palette.selected.excluded,
22267
- color: theme.palette.selected.mainContrastText,
22335
+ color: theme.palette.selected.excludedContrastText,
22268
22336
  border: isGridMode ? 'none' : undefined
22269
22337
  }),
22270
22338
  ["& .".concat(rowColClasses.A)]: {
@@ -22277,10 +22345,13 @@
22277
22345
  color: theme.palette.selected.excludedContrastText,
22278
22346
  border: isGridMode ? 'none' : undefined
22279
22347
  },
22280
- ["& .".concat(rowColClasses.frequencyCount)]: {
22281
- width: '66px',
22348
+ ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
22282
22349
  justifyContent: 'flex-end'
22283
- },
22350
+ }, ellipsis), {}, {
22351
+ flex: "0 1 ".concat(frequencyWidth, "px"),
22352
+ textAlign: 'right',
22353
+ paddingLeft: '2px'
22354
+ }),
22284
22355
  ["&.".concat(rowColClasses.barContainer)]: {
22285
22356
  height: '100%',
22286
22357
  display: 'flex',
@@ -22315,6 +22386,7 @@
22315
22386
  }
22316
22387
  };
22317
22388
  });
22389
+ var RowColRoot$1 = React.memo(RowColRoot);
22318
22390
 
22319
22391
  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
22392
 
@@ -22390,19 +22462,23 @@
22390
22462
  };
22391
22463
  function ListboxCheckbox(_ref2) {
22392
22464
  let {
22465
+ onChange,
22393
22466
  checked,
22394
22467
  label,
22395
22468
  dense,
22396
22469
  excluded,
22397
- showGray = true
22470
+ showGray = true,
22471
+ dataN
22398
22472
  } = _ref2;
22399
22473
  return /*#__PURE__*/React.createElement(StyledCheckbox, {
22400
22474
  edge: "start",
22475
+ onChange: onChange,
22401
22476
  checked: checked,
22402
22477
  disableRipple: true,
22403
22478
  className: [classes$b.checkbox, dense && classes$b.dense].filter(Boolean).join(' '),
22404
22479
  inputProps: {
22405
- 'aria-labelledby': label
22480
+ 'aria-labelledby': label,
22481
+ 'data-n': dataN
22406
22482
  },
22407
22483
  name: label,
22408
22484
  icon: getIcon(classes$b, showGray, excluded),
@@ -22431,15 +22507,21 @@
22431
22507
  });
22432
22508
  function ListBoxRadioButton(_ref2) {
22433
22509
  let {
22510
+ onChange,
22434
22511
  checked,
22435
22512
  label,
22436
- dense
22513
+ dense,
22514
+ dataN
22437
22515
  } = _ref2;
22438
22516
  return /*#__PURE__*/React.createElement(StyledRadio, {
22439
22517
  checked: checked,
22518
+ onChange: onChange,
22440
22519
  value: label,
22441
22520
  name: label,
22442
22521
  className: classes$a.radioButton,
22522
+ inputProps: {
22523
+ 'data-n': dataN
22524
+ },
22443
22525
  style: {
22444
22526
  backgroundColor: 'transparent'
22445
22527
  },
@@ -22470,7 +22552,7 @@
22470
22552
  checkboxes
22471
22553
  }) && rowColClasses.excludedTextWithCheckbox]),
22472
22554
  color: color,
22473
- justifyContent: valueTextAlign
22555
+ align: valueTextAlign
22474
22556
  }, /*#__PURE__*/React.createElement("span", {
22475
22557
  style: {
22476
22558
  whiteSpace: 'pre'
@@ -22506,6 +22588,7 @@
22506
22588
 
22507
22589
  function CheckboxField(_ref) {
22508
22590
  let {
22591
+ onChange,
22509
22592
  label,
22510
22593
  color,
22511
22594
  qElemNumber,
@@ -22520,17 +22603,21 @@
22520
22603
  valueTextAlign
22521
22604
  } = _ref;
22522
22605
  const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
22606
+ onChange: onChange,
22523
22607
  label: label,
22524
22608
  checked: isSelected,
22525
22609
  dense: dense,
22526
22610
  excluded: isExcluded(cell),
22527
22611
  isGridCol: isGridCol,
22528
- showGray: showGray
22612
+ showGray: showGray,
22613
+ dataN: qElemNumber
22529
22614
  });
22530
22615
  const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
22616
+ onChange: onChange,
22531
22617
  label: label,
22532
22618
  checked: isSelected,
22533
- dense: dense
22619
+ dense: dense,
22620
+ dataN: qElemNumber
22534
22621
  });
22535
22622
  return /*#__PURE__*/React.createElement(FormControlLabel$1, {
22536
22623
  color: color,
@@ -22557,11 +22644,12 @@
22557
22644
  showGray,
22558
22645
  checkboxes
22559
22646
  } = _ref;
22560
- return /*#__PURE__*/React.createElement(React.Fragment, null, labels.map(_ref2 => {
22647
+ return /*#__PURE__*/React.createElement(React.Fragment, null, labels.map((_ref2, index) => {
22561
22648
  let [label, highlighted] = _ref2;
22649
+ const key = "".concat(index);
22562
22650
  return /*#__PURE__*/React.createElement(ValueField, {
22563
22651
  label: label,
22564
- key: label,
22652
+ key: key,
22565
22653
  highlighted: highlighted,
22566
22654
  dense: dense,
22567
22655
  showGray: showGray,
@@ -22571,6 +22659,7 @@
22571
22659
  }
22572
22660
  function FieldWithRanges(_ref3) {
22573
22661
  let {
22662
+ onChange,
22574
22663
  labels,
22575
22664
  checkboxes,
22576
22665
  dense,
@@ -22590,6 +22679,7 @@
22590
22679
  checkboxes: checkboxes
22591
22680
  });
22592
22681
  return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22682
+ onChange: onChange,
22593
22683
  label: LWR,
22594
22684
  color: color,
22595
22685
  qElemNumber: qElemNumber,
@@ -22606,6 +22696,7 @@
22606
22696
 
22607
22697
  function Field(_ref) {
22608
22698
  let {
22699
+ onChange,
22609
22700
  label,
22610
22701
  color,
22611
22702
  qElemNumber,
@@ -22620,6 +22711,7 @@
22620
22711
  valueTextAlign
22621
22712
  } = _ref;
22622
22713
  return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22714
+ onChange: onChange,
22623
22715
  label: label,
22624
22716
  color: color,
22625
22717
  qElemNumber: qElemNumber,
@@ -22643,6 +22735,7 @@
22643
22735
  valueTextAlign: valueTextAlign
22644
22736
  });
22645
22737
  }
22738
+ var Field$1 = React.memo(Field);
22646
22739
 
22647
22740
  function Histogram(_ref) {
22648
22741
  let {
@@ -22715,12 +22808,16 @@
22715
22808
  case 'row':
22716
22809
  return {
22717
22810
  height: "calc(100% - ".concat(itemPadding, "px)"),
22718
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
22811
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22812
+ position: 'absolute',
22813
+ left: 4
22719
22814
  };
22720
22815
  case 'column':
22721
22816
  return {
22722
22817
  height: "calc(100% - ".concat(itemPadding, "px)"),
22723
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
22818
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22819
+ position: 'absolute',
22820
+ left: 4
22724
22821
  };
22725
22822
  default:
22726
22823
  return {};
@@ -22728,24 +22825,43 @@
22728
22825
  }
22729
22826
 
22730
22827
  const ItemGrid = styled$1(Grid$1, {
22731
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding'].includes(prop)
22828
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'checkboxes'].includes(prop)
22732
22829
  })(_ref => {
22733
22830
  let {
22734
22831
  dataLayout,
22735
22832
  layoutOrder,
22736
- itemPadding
22833
+ itemPadding,
22834
+ checkboxes
22737
22835
  } = _ref;
22738
22836
  return {
22739
- ["&.".concat(rowColClasses.fieldRoot)]: getGridItemSizes({
22837
+ ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
22740
22838
  dataLayout,
22741
22839
  layoutOrder,
22742
22840
  itemPadding
22841
+ })), {}, {
22842
+ paddingRight: checkboxes ? '8px' : undefined
22743
22843
  })
22744
22844
  };
22745
22845
  });
22746
22846
 
22847
+ function getCellFromPages(_ref) {
22848
+ let {
22849
+ pages,
22850
+ cellIndex
22851
+ } = _ref;
22852
+ let c;
22853
+ const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
22854
+ if (page) {
22855
+ const area = page.qArea;
22856
+ if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
22857
+ [c] = page.qMatrix[cellIndex - area.qTop];
22858
+ }
22859
+ }
22860
+ return c;
22861
+ }
22862
+
22747
22863
  function RowColumn(_ref) {
22748
- var _cell$qText;
22864
+ var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
22749
22865
  let {
22750
22866
  index,
22751
22867
  rowIndex,
@@ -22754,6 +22870,7 @@
22754
22870
  data
22755
22871
  } = _ref;
22756
22872
  const {
22873
+ onChange,
22757
22874
  onClick,
22758
22875
  onMouseDown,
22759
22876
  onMouseUp,
@@ -22777,7 +22894,8 @@
22777
22894
  dataOffset,
22778
22895
  focusListItems,
22779
22896
  listCount,
22780
- itemPadding
22897
+ itemPadding,
22898
+ frequencyWidth
22781
22899
  } = data;
22782
22900
  const {
22783
22901
  dense = false,
@@ -22829,44 +22947,21 @@
22829
22947
  const handleKeyDownCallback = reactExports.useCallback(getFieldKeyboardNavigation(_objectSpread2(_objectSpread2({}, actions), {}, {
22830
22948
  focusListItems
22831
22949
  })), [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;
22852
- }
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]);
22950
+ const cell = reactExports.useMemo(() => getCellFromPages({
22951
+ pages,
22952
+ cellIndex
22953
+ }), [pages, cellIndex]);
22954
+ 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' || (cell === null || cell === void 0 ? void 0 : cell.qState) === 'XL';
22955
+ const classArr = reactExports.useMemo(() => getValueStateClasses({
22956
+ column,
22957
+ histogram,
22958
+ checkboxes,
22959
+ cell,
22960
+ showGray
22961
+ }), [cell === null || cell === void 0 ? void 0 : cell.qState, histogram, dense, checkboxes]);
22962
+ const preventContextMenu = reactExports.useCallback(event => {
22963
+ event.preventDefault();
22964
+ }, [checkboxes]);
22870
22965
  if (!cell) {
22871
22966
  return null; // prevent rendering empty rows
22872
22967
  }
@@ -22883,19 +22978,16 @@
22883
22978
  } else {
22884
22979
  valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
22885
22980
  }
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
22981
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
22894
22982
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
22895
22983
 
22896
22984
  // 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);
22985
+
22986
+ let labels;
22987
+ if ((_cell$qHighlightRange = cell.qHighlightRanges) !== null && _cell$qHighlightRange !== void 0 && (_cell$qHighlightRange2 = _cell$qHighlightRange.qRanges) !== null && _cell$qHighlightRange2 !== void 0 && _cell$qHighlightRange2.length) {
22988
+ const ranges = cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
22989
+ labels = getSegmentsFromRanges(label, ranges);
22990
+ }
22899
22991
  const iconStyles = {
22900
22992
  alignItems: 'center',
22901
22993
  display: 'flex',
@@ -22908,22 +23000,24 @@
22908
23000
  alignItems: 'center',
22909
23001
  minWidth: 0,
22910
23002
  flexGrow: 1,
22911
- padding: checkboxes ? 0 : undefined,
23003
+ paddingLeft: checkboxes ? 0 : undefined,
22912
23004
  justifyContent: valueTextAlign
22913
23005
  };
22914
23006
  const isFirstElement = index === 0;
22915
23007
  const flexBasisVal = checkboxes ? 'auto' : 'max-content';
22916
- return /*#__PURE__*/React.createElement(RowColRoot, {
23008
+ return /*#__PURE__*/React.createElement(RowColRoot$1, {
22917
23009
  className: rowColClasses.barContainer,
22918
23010
  flexBasisProp: flexBasisVal,
22919
23011
  style: styles,
22920
23012
  isGridCol: isGridCol,
22921
23013
  isGridMode: dataLayout === 'grid',
22922
- dense: dense
23014
+ dense: dense,
23015
+ frequencyWidth: frequencyWidth
22923
23016
  }, /*#__PURE__*/React.createElement(ItemGrid, {
22924
23017
  ref: rowRef,
22925
23018
  container: true,
22926
23019
  dataLayout: dataLayout,
23020
+ checkboxes: checkboxes,
22927
23021
  layoutOrder: layoutOrder,
22928
23022
  itemPadding: itemPadding,
22929
23023
  gap: 0,
@@ -22939,7 +23033,7 @@
22939
23033
  onContextMenu: preventContextMenu,
22940
23034
  role: column ? 'column' : 'row',
22941
23035
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
22942
- "data-n": cell && cell.qElemNumber
23036
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
22943
23037
  }, /*#__PURE__*/React.createElement(Histogram, {
22944
23038
  cell: cell,
22945
23039
  histogram: histogram,
@@ -22951,18 +23045,8 @@
22951
23045
  style: cellStyle,
22952
23046
  className: joinClassNames([rowColClasses.cell, rowColClasses.selectedCell]),
22953
23047
  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, {
23048
+ }, labels ? /*#__PURE__*/React.createElement(FieldWithRanges, {
23049
+ onChange: onChange,
22966
23050
  labels: labels,
22967
23051
  checkboxes: checkboxes,
22968
23052
  dense: dense,
@@ -22975,6 +23059,19 @@
22975
23059
  isGridCol: isGridCol,
22976
23060
  isSingleSelect: isSingleSelect,
22977
23061
  valueTextAlign: valueTextAlign
23062
+ }) : /*#__PURE__*/React.createElement(Field$1, {
23063
+ onChange: onChange,
23064
+ label: label,
23065
+ color: "inherit",
23066
+ qElemNumber: cell.qElemNumber,
23067
+ isSelected: isSelected,
23068
+ dense: dense,
23069
+ cell: cell,
23070
+ isGridCol: isGridCol,
23071
+ showGray: showGray,
23072
+ isSingleSelect: isSingleSelect,
23073
+ checkboxes: checkboxes,
23074
+ valueTextAlign: valueTextAlign
22978
23075
  })), freqIsAllowed && /*#__PURE__*/React.createElement(Frequency, {
22979
23076
  cell: cell,
22980
23077
  checkboxes: checkboxes,
@@ -22996,21 +23093,6 @@
22996
23093
  }))));
22997
23094
  }
22998
23095
 
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
23096
  function deriveRenderOptions(options) {
23015
23097
  const {
23016
23098
  renderProps,
@@ -24457,8 +24539,9 @@
24457
24539
  styledScrollbars: "".concat(PREFIX$9, "-styledScrollbars")
24458
24540
  };
24459
24541
  function getStyledComponents() {
24460
- const scrollbarStyling = {
24542
+ const getScrollbarStyling = scrollDisabled => ({
24461
24543
  scrollbarColor: "".concat(scrollBarThumb, " ").concat(scrollBarBackground),
24544
+ overflow: scrollDisabled ? 'hidden !important' : undefined,
24462
24545
  '&::-webkit-scrollbar': {
24463
24546
  width: 10,
24464
24547
  height: 10
@@ -24473,42 +24556,27 @@
24473
24556
  '&::-webkit-scrollbar-thumb:hover': {
24474
24557
  backgroundColor: scrollBarThumbHover
24475
24558
  }
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
- }));
24559
+ });
24560
+ const StyledFixedSizeList = newStyled(FixedSizeList, {
24561
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
24562
+ })(_ref => {
24563
+ let {
24564
+ scrollDisabled
24565
+ } = _ref;
24566
+ return {
24567
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
24568
+ };
24569
+ });
24570
+ const StyledFixedSizeGrid = newStyled(FixedSizeGrid, {
24571
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
24572
+ })(_ref2 => {
24573
+ let {
24574
+ scrollDisabled
24575
+ } = _ref2;
24576
+ return {
24577
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
24578
+ };
24579
+ });
24512
24580
  return {
24513
24581
  StyledFixedSizeList,
24514
24582
  StyledFixedSizeGrid
@@ -24574,13 +24642,14 @@
24574
24642
  showGray,
24575
24643
  scrollState,
24576
24644
  direction,
24577
- listLayout,
24578
24645
  sizes,
24579
24646
  listCount,
24580
24647
  overflowDisclaimer,
24581
24648
  setScrollPosition,
24582
24649
  focusListItems,
24583
- setCurrentScrollIndex
24650
+ setCurrentScrollIndex,
24651
+ constraints,
24652
+ freqIsAllowed
24584
24653
  } = _ref;
24585
24654
  const {
24586
24655
  layoutOptions = {},
@@ -24591,7 +24660,8 @@
24591
24660
  listHeight,
24592
24661
  itemSize,
24593
24662
  rowCount,
24594
- columnCount
24663
+ columnCount,
24664
+ frequencyWidth
24595
24665
  } = sizes || {};
24596
24666
 
24597
24667
  // Options common for List and Grid.
@@ -24611,14 +24681,11 @@
24611
24681
  checkboxes,
24612
24682
  layoutOptions,
24613
24683
  frequencyMode,
24614
- freqIsAllowed: getFrequencyAllowed({
24615
- width,
24616
- layout,
24617
- frequencyMode
24618
- }),
24684
+ freqIsAllowed,
24619
24685
  isSingleSelect,
24620
24686
  textAlign,
24621
24687
  itemPadding,
24688
+ frequencyWidth,
24622
24689
  actions: {
24623
24690
  select,
24624
24691
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -24643,10 +24710,10 @@
24643
24710
  // eslint-disable-next-line react/jsx-props-no-spreading
24644
24711
  , _extends$8({}, commonComponentOptions, {
24645
24712
  dataTestid: "fixed-size-list",
24713
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
24646
24714
  height: listHeight,
24647
24715
  width: width,
24648
24716
  itemCount: listCount,
24649
- layout: listLayout,
24650
24717
  itemData: _objectSpread2(_objectSpread2({}, commonItemData), {}, {
24651
24718
  listCount
24652
24719
  }),
@@ -24721,6 +24788,7 @@
24721
24788
  // eslint-disable-next-line react/jsx-props-no-spreading
24722
24789
  , _extends$8({}, commonComponentOptions, {
24723
24790
  dataTestid: "fixed-size-grid",
24791
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
24724
24792
  height: gridHeight,
24725
24793
  width: width,
24726
24794
  columnCount: columnCount,
@@ -24745,6 +24813,9 @@
24745
24813
 
24746
24814
  const scrollBarWidth = 10; // TODO: ignore this - instead set the styling only show on hover...
24747
24815
 
24816
+ const ITEM_MIN_WIDTH = 56;
24817
+ const ITEM_MAX_WIDTH = 150;
24818
+ const FREQUENCY_WIDTH = 40;
24748
24819
  function getListSizes(_ref) {
24749
24820
  let {
24750
24821
  layout,
@@ -24752,7 +24823,8 @@
24752
24823
  height,
24753
24824
  listCount,
24754
24825
  count,
24755
- textWidth
24826
+ textWidth,
24827
+ freqIsAllowed
24756
24828
  } = _ref;
24757
24829
  const {
24758
24830
  layoutOptions = {}
@@ -24764,7 +24836,8 @@
24764
24836
  dense,
24765
24837
  dataLayout
24766
24838
  } = layoutOptions;
24767
- const columnAutoWidth = Math.min(150, textWidth + 18);
24839
+ const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
24840
+ const columnAutoWidth = Math.max(Math.min(ITEM_MAX_WIDTH, textWidth + 18 + frequencyAddWidth), ITEM_MIN_WIDTH + frequencyAddWidth);
24768
24841
  let overflowStyling;
24769
24842
  let columnCount;
24770
24843
  let columnWidth;
@@ -24781,18 +24854,21 @@
24781
24854
  }
24782
24855
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemSize;
24783
24856
  if (layoutOrder) {
24857
+ // Modify container width to achieve the exact design with 8px margins on each side (left and right).
24858
+ let containerWidth = width;
24784
24859
  if (layoutOrder === 'row') {
24860
+ containerWidth += itemPadding * 2;
24785
24861
  overflowStyling = {
24786
24862
  overflowX: 'hidden'
24787
24863
  };
24788
24864
  const maxColumns = (maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.maxColumns) || 3;
24789
24865
  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...??
24866
+ columnCount = Math.min(listCount, Math.ceil((containerWidth - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
24791
24867
  } else {
24792
24868
  columnCount = Math.min(listCount, maxColumns);
24793
24869
  }
24794
24870
  rowCount = Math.ceil(listCount / columnCount);
24795
- columnWidth = (width - scrollBarWidth) / columnCount;
24871
+ columnWidth = (containerWidth - scrollBarWidth) / columnCount;
24796
24872
  } else {
24797
24873
  overflowStyling = {
24798
24874
  overflowY: 'hidden'
@@ -24804,7 +24880,7 @@
24804
24880
  rowCount = Math.min(listCount, maxRows);
24805
24881
  }
24806
24882
  columnCount = Math.ceil(listCount / rowCount);
24807
- columnWidth = Math.max(columnAutoWidth, width / columnCount);
24883
+ columnWidth = Math.max(columnAutoWidth, containerWidth / columnCount);
24808
24884
  }
24809
24885
  }
24810
24886
  columnCount = (dataLayout === 'singleColumn' ? 1 : columnCount) || 1;
@@ -24830,7 +24906,8 @@
24830
24906
  row: maxRowCount,
24831
24907
  column: maxColumnCount
24832
24908
  },
24833
- itemPadding
24909
+ itemPadding,
24910
+ frequencyWidth: FREQUENCY_WIDTH
24834
24911
  };
24835
24912
  }
24836
24913
 
@@ -25180,19 +25257,35 @@
25180
25257
  };
25181
25258
  }
25182
25259
 
25260
+ const FREQUENCY_MIN_SHOW_WIDTH = 80;
25261
+ function getFrequencyAllowed(_ref) {
25262
+ let {
25263
+ itemWidth,
25264
+ layout,
25265
+ frequencyMode
25266
+ } = _ref;
25267
+ const widthPermitsFreq = itemWidth > FREQUENCY_MIN_SHOW_WIDTH;
25268
+ const {
25269
+ frequencyEnabled = false
25270
+ } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
25271
+ const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
25272
+ return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
25273
+ }
25274
+
25183
25275
  const _excluded$4 = ["isLoadingData"];
25184
25276
  const DEFAULT_MIN_BATCH_SIZE = 100;
25185
25277
  function ListBox(_ref) {
25186
25278
  var _layout$qListObject$q, _loaderRef$current, _loaderRef$current$_l, _loaderRef$current$_l2;
25187
25279
  let {
25188
25280
  model,
25281
+ constraints,
25189
25282
  layout,
25190
25283
  selections,
25284
+ selectionState,
25191
25285
  direction,
25192
25286
  checkboxes: checkboxOption,
25193
25287
  height,
25194
25288
  width,
25195
- listLayout = 'vertical',
25196
25289
  frequencyMode,
25197
25290
  update = undefined,
25198
25291
  fetchStart = undefined,
@@ -25237,11 +25330,7 @@
25237
25330
  postProcessPages,
25238
25331
  listData
25239
25332
  }),
25240
- {
25241
- isLoadingData
25242
- } = _useItemsLoader,
25243
25333
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
25244
- const [pages, setPages] = reactExports.useState([]);
25245
25334
  const {
25246
25335
  setStoreValue
25247
25336
  } = useDataStore(model);
@@ -25253,9 +25342,16 @@
25253
25342
  const showOverflowDisclaimer = show => setOverflowDisclaimer(state => _objectSpread2(_objectSpread2({}, state), {}, {
25254
25343
  show
25255
25344
  }));
25256
- reactExports.useEffect(() => {
25257
- setPages((itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages) || []);
25258
- }, [itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages]);
25345
+ const [pages, setPages] = reactExports.useState([]);
25346
+ if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
25347
+ selectionState.update({
25348
+ setPages,
25349
+ pages: itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages,
25350
+ isSingleSelect,
25351
+ selectDisabled,
25352
+ layout
25353
+ });
25354
+ }
25259
25355
  const isItemLoaded = reactExports.useCallback(index => {
25260
25356
  if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
25261
25357
  return false;
@@ -25266,17 +25362,13 @@
25266
25362
  return page && isLoaded(page);
25267
25363
  }, [layout, pages]);
25268
25364
  const {
25269
- instantPages = [],
25270
25365
  interactionEvents,
25271
25366
  select
25272
25367
  } = useSelectionsInteractions({
25273
- layout,
25368
+ selectionState,
25274
25369
  selections,
25275
- pages,
25276
25370
  checkboxes,
25277
- selectDisabled,
25278
- doc: document,
25279
- isSingleSelect
25371
+ doc: document
25280
25372
  });
25281
25373
  const {
25282
25374
  layoutOptions = {}
@@ -25316,12 +25408,6 @@
25316
25408
  // Hand over the update function for manual refresh from hosting application.
25317
25409
  update.call(null, fetchData);
25318
25410
  }
25319
- reactExports.useEffect(() => {
25320
- if (!instantPages || isLoadingData) {
25321
- return;
25322
- }
25323
- setPages(instantPages);
25324
- }, [instantPages]);
25325
25411
  reactExports.useEffect(() => {
25326
25412
  if (scrollState && !initScrollPosIsSet && loaderRef.current) {
25327
25413
  loaderRef.current._listRef.scrollToItem(scrollState.initScrollPos);
@@ -25336,7 +25422,7 @@
25336
25422
  font: '14px Source sans pro'
25337
25423
  });
25338
25424
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
25339
- const isVertical = layoutOptions.dataLayout ? layoutOptions.dataLayout === 'singleColumn' : listLayout !== 'horizontal';
25425
+ const isVertical = layoutOptions.dataLayout !== 'grid';
25340
25426
  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
25427
  const unlimitedListCount = getListCount({
25342
25428
  pages,
@@ -25346,14 +25432,28 @@
25346
25432
  layoutOptions,
25347
25433
  model
25348
25434
  });
25435
+ let freqIsAllowed = getFrequencyAllowed({
25436
+ itemWidth: width,
25437
+ layout,
25438
+ frequencyMode
25439
+ });
25349
25440
  const sizes = getListSizes({
25350
25441
  layout,
25351
25442
  width,
25352
25443
  height,
25353
25444
  listCount: unlimitedListCount,
25354
25445
  count,
25355
- textWidth
25446
+ textWidth,
25447
+ freqIsAllowed
25356
25448
  });
25449
+ if (sizes.columnWidth) {
25450
+ // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
25451
+ freqIsAllowed = getFrequencyAllowed({
25452
+ itemWidth: sizes.columnWidth,
25453
+ layout,
25454
+ frequencyMode
25455
+ });
25456
+ }
25357
25457
  const {
25358
25458
  listCount
25359
25459
  } = sizes;
@@ -25372,7 +25472,7 @@
25372
25472
  });
25373
25473
  local.current.dataOffset = offset;
25374
25474
  if (triggerRerender) {
25375
- setPages(currentPages => [...currentPages]);
25475
+ selectionState.triggerStateChanged();
25376
25476
  }
25377
25477
  scrollToIndex(scrollIndex);
25378
25478
  };
@@ -25439,7 +25539,9 @@
25439
25539
  },
25440
25540
  setScrollPosition,
25441
25541
  focusListItems: getFocusState(),
25442
- setCurrentScrollIndex: currentScrollIndex.set
25542
+ setCurrentScrollIndex: currentScrollIndex.set,
25543
+ constraints,
25544
+ freqIsAllowed
25443
25545
  });
25444
25546
  const {
25445
25547
  columnWidth,
@@ -25517,7 +25619,8 @@
25517
25619
  let {
25518
25620
  layout,
25519
25621
  model,
25520
- translator
25622
+ translator,
25623
+ selectionState
25521
25624
  } = _ref;
25522
25625
  if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
25523
25626
  return [];
@@ -25533,6 +25636,7 @@
25533
25636
  getSvgIconShape: selectAll,
25534
25637
  enabled: canSelectAll,
25535
25638
  action: () => {
25639
+ selectionState.clearItemStates(false);
25536
25640
  model.selectListObjectAll('/qListObjectDef');
25537
25641
  }
25538
25642
  }, {
@@ -25542,6 +25646,7 @@
25542
25646
  getSvgIconShape: selectPossible,
25543
25647
  enabled: canSelectPossible,
25544
25648
  action: () => {
25649
+ selectionState.clearItemStates(false);
25545
25650
  model.selectListObjectPossible('/qListObjectDef');
25546
25651
  }
25547
25652
  }, {
@@ -25551,6 +25656,7 @@
25551
25656
  getSvgIconShape: selectAlternative,
25552
25657
  enabled: canSelectAlternative,
25553
25658
  action: () => {
25659
+ selectionState.clearItemStates(false);
25554
25660
  model.selectListObjectAlternative('/qListObjectDef');
25555
25661
  }
25556
25662
  }, {
@@ -25560,6 +25666,7 @@
25560
25666
  getSvgIconShape: selectExcluded,
25561
25667
  enabled: canSelectExcluded,
25562
25668
  action: () => {
25669
+ selectionState.clearItemStates(false);
25563
25670
  model.selectListObjectExcluded('/qListObjectDef');
25564
25671
  }
25565
25672
  }];
@@ -25622,6 +25729,7 @@
25622
25729
  style: style,
25623
25730
  className: ActionElement.className,
25624
25731
  size: "large",
25732
+ disableRipple: true,
25625
25733
  "aria-expanded": ariaExpanded,
25626
25734
  "aria-controls": "moreMenuList"
25627
25735
  }, hasSvgIconShape && SvgIcon(item.getSvgIconShape()), addAnchor && /*#__PURE__*/React.createElement("div", {
@@ -26029,7 +26137,7 @@
26029
26137
  className: ActionToolbarElement.className,
26030
26138
  style: {
26031
26139
  pointerEvents: 'auto',
26032
- padding: theme.spacing(1, 1)
26140
+ padding: theme.spacing(0.8)
26033
26141
  }
26034
26142
  }
26035
26143
  }, Actions) : show && Actions;
@@ -26068,6 +26176,7 @@
26068
26176
  function ListBoxSearch(_ref3) {
26069
26177
  let {
26070
26178
  selections,
26179
+ selectionState,
26071
26180
  model,
26072
26181
  keyboard,
26073
26182
  dense = false,
@@ -26142,6 +26251,7 @@
26142
26251
  response = model.acceptListObjectSearch(TREE_PATH, true);
26143
26252
  // eslint-disable-next-line no-param-reassign
26144
26253
  selections.selectionsMade = true;
26254
+ selectionState.clearItemStates(false);
26145
26255
  setValue('');
26146
26256
  }
26147
26257
  return response;
@@ -26181,7 +26291,8 @@
26181
26291
  },
26182
26292
  '&:hover': {
26183
26293
  border: 'none'
26184
- }
26294
+ },
26295
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px")
26185
26296
  }, dense && {
26186
26297
  fontSize: 12,
26187
26298
  paddingLeft: theme.spacing(1),
@@ -26455,6 +26566,125 @@
26455
26566
  return [objectSelections];
26456
26567
  }
26457
26568
 
26569
+ function selectionState() {
26570
+ const state = {
26571
+ itemStates: {},
26572
+ ignoreSelectionState: false,
26573
+ selectedInEngine: [],
26574
+ enginePages: [],
26575
+ setPages: undefined,
26576
+ lastRowCount: undefined,
26577
+ lastApprMaxGlyphCount: undefined,
26578
+ update(_ref) {
26579
+ var _layout$qListObject$q, _layout$qListObject, _layout$qListObject$q2;
26580
+ let {
26581
+ setPages,
26582
+ pages,
26583
+ isSingleSelect,
26584
+ selectDisabled,
26585
+ layout
26586
+ } = _ref;
26587
+ this.setPages = setPages;
26588
+ const isSameRowCount = this.lastRowCount === layout.qListObject.qSize.qcy;
26589
+ const isSameMaxGlyphCnt = this.lastApprMaxGlyphCount === layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
26590
+ if (!isSameRowCount || !isSameMaxGlyphCnt) {
26591
+ this.lastRowCount = layout.qListObject.qSize.qcy;
26592
+ this.lastApprMaxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
26593
+
26594
+ // The field have probably changed (drill up/down)
26595
+ // need to clear the client side item states since the field values have changed
26596
+ this.clearItemStates(false);
26597
+ }
26598
+ if (state.enginePages !== pages && pages !== undefined) {
26599
+ state.enginePages = pages !== null && pages !== void 0 ? pages : [];
26600
+ state.selectedInEngine = getSelectedValues(pages);
26601
+ state.selectableValuesUpdating = false;
26602
+ state.triggerStateChanged();
26603
+ }
26604
+ state.isSingleSelect = isSingleSelect;
26605
+ state.selectDisabled = selectDisabled;
26606
+ 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;
26607
+ },
26608
+ allowedToSelect() {
26609
+ if (state.selectDisabled()) {
26610
+ return false;
26611
+ }
26612
+ // When a dim is calculated, the rows must be done updating after previeous selection
26613
+ return !(state.isDimCalculated && state.selectableValuesUpdating);
26614
+ },
26615
+ setSelectableValuesUpdating() {
26616
+ state.selectableValuesUpdating = true;
26617
+ },
26618
+ useClientItemState(elementNumber) {
26619
+ return state.ignoreSelectionState || elementNumber in state.itemStates;
26620
+ },
26621
+ isSelected(elementNumber) {
26622
+ if (state.useClientItemState(elementNumber)) {
26623
+ return !!state.itemStates[elementNumber];
26624
+ }
26625
+ return state.selectedInEngine.includes(elementNumber);
26626
+ },
26627
+ getState(item) {
26628
+ const {
26629
+ qElemNumber,
26630
+ qState
26631
+ } = item;
26632
+ if (!state.useClientItemState(qElemNumber)) {
26633
+ return qState;
26634
+ }
26635
+ if (state.itemStates[qElemNumber]) {
26636
+ return qState === 'XS' ? 'XS' : 'S';
26637
+ }
26638
+ return qState === 'S' || qState === 'XS' ? 'A' : qState;
26639
+ },
26640
+ updateItemNoEvents(elementNumber, additive, selectedValues) {
26641
+ const selected = state.isSelected(elementNumber);
26642
+ if (selected && !additive) {
26643
+ state.itemStates[elementNumber] = false;
26644
+ } else if (!selected) {
26645
+ selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.push(elementNumber);
26646
+ state.itemStates[elementNumber] = true;
26647
+ }
26648
+ },
26649
+ triggerStateChanged() {
26650
+ if (this.setPages) {
26651
+ const pages = state.applySelectionsOnPages(state.enginePages);
26652
+ this.setPages(pages);
26653
+ }
26654
+ },
26655
+ applySelectionsOnPages(pages) {
26656
+ const matrices = pages.map(page => {
26657
+ const qMatrix = page.qMatrix.map(p => {
26658
+ const [p0] = p;
26659
+ const qState = state.getState(p0);
26660
+ return [_objectSpread2(_objectSpread2({}, p0), {}, {
26661
+ qState
26662
+ }), ...p.slice(1)];
26663
+ });
26664
+ return _objectSpread2(_objectSpread2({}, page), {}, {
26665
+ qMatrix
26666
+ });
26667
+ });
26668
+ return matrices;
26669
+ },
26670
+ updateItem(elementNumber, additive, selectedValues) {
26671
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
26672
+ state.triggerStateChanged();
26673
+ },
26674
+ updateItems(elementNumbers, additive, selectedValues) {
26675
+ elementNumbers.forEach(elementNumber => {
26676
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
26677
+ });
26678
+ state.triggerStateChanged();
26679
+ },
26680
+ clearItemStates(ignoreSelectionState) {
26681
+ state.itemStates = {};
26682
+ state.ignoreSelectionState = ignoreSelectionState;
26683
+ }
26684
+ };
26685
+ return state;
26686
+ }
26687
+
26458
26688
  const getValue$1 = function (obj, prop) {
26459
26689
  var _obj$prop;
26460
26690
  let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
@@ -26526,6 +26756,7 @@
26526
26756
  const containerRef = reactExports.useRef();
26527
26757
  const [selections] = useObjectSelections(app, model, containerRef);
26528
26758
  const [layout] = useLayout$1(model);
26759
+ const [selectionState$1] = reactExports.useState(() => selectionState());
26529
26760
  reactExports.useEffect(() => {
26530
26761
  if (selections && open) {
26531
26762
  if (!selections.isModal(model)) {
@@ -26545,7 +26776,8 @@
26545
26776
  const listboxSelectionToolbarItems = createListboxSelectionToolbar({
26546
26777
  layout,
26547
26778
  model,
26548
- translator
26779
+ translator,
26780
+ selectionState: selectionState$1
26549
26781
  });
26550
26782
  const hasSelections$1 = hasSelections(layout);
26551
26783
  return /*#__PURE__*/React.createElement(Popover$1, {
@@ -26618,6 +26850,7 @@
26618
26850
  model: model,
26619
26851
  listCount: listCount,
26620
26852
  selections: selections,
26853
+ selectionState: selectionState$1,
26621
26854
  keyboard: {
26622
26855
  enabled: false
26623
26856
  },
@@ -26626,6 +26859,7 @@
26626
26859
  model: model,
26627
26860
  layout: layout,
26628
26861
  selections: selections,
26862
+ selectionState: selectionState$1,
26629
26863
  direction: "ltr",
26630
26864
  onSetListCount: c => setListCount(c)
26631
26865
  }))));
@@ -27885,6 +28119,16 @@
27885
28119
  style: {}
27886
28120
  };
27887
28121
 
28122
+ const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
28123
+ shapes: [{
28124
+ type: 'path',
28125
+ attrs: {
28126
+ 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'
28127
+ }
28128
+ }]
28129
+ });
28130
+ var DrillDownIcon = (props => SvgIcon(drillDown(props)));
28131
+
27888
28132
  const addListboxTheme = themeApi => {
27889
28133
  const getListboxStyle = prop => themeApi.getStyle('object', '', "listBox.".concat(prop));
27890
28134
  return {
@@ -27904,29 +28148,86 @@
27904
28148
  };
27905
28149
  };
27906
28150
 
28151
+ function showToolbarDetached(_ref) {
28152
+ var _containerRef$current, _containerRef$current2, _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
28153
+ let {
28154
+ containerRef,
28155
+ titleRef,
28156
+ iconsWidth
28157
+ } = _ref;
28158
+ const containerWidth = (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.clientWidth) !== null && _containerRef$current !== void 0 ? _containerRef$current : 0;
28159
+ const padding = 16;
28160
+ const contentWidth = ((_titleRef$current$cli = titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.clientWidth) !== null && _titleRef$current$cli !== void 0 ? _titleRef$current$cli : 0) + iconsWidth + padding;
28161
+ const actionToolbarWidth = 128;
28162
+ const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
28163
+ const isTruncated = (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth) > (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current3 = titleRef.current) === null || _titleRef$current3 === void 0 ? void 0 : _titleRef$current3.offsetWidth);
28164
+ return !!(notSufficientSpace | isTruncated);
28165
+ }
28166
+
28167
+ function getListboxActionProps(_ref) {
28168
+ let {
28169
+ isPopover,
28170
+ showToolbar,
28171
+ containerRef,
28172
+ isLocked,
28173
+ listboxSelectionToolbarItems,
28174
+ selections
28175
+ } = _ref;
28176
+ return {
28177
+ show: showToolbar && !isPopover,
28178
+ popover: {
28179
+ show: showToolbar && isPopover,
28180
+ anchorEl: containerRef.current
28181
+ },
28182
+ more: {
28183
+ enabled: !isLocked,
28184
+ actions: listboxSelectionToolbarItems,
28185
+ popoverProps: {
28186
+ elevation: 0
28187
+ },
28188
+ popoverPaperStyle: {
28189
+ boxShadow: '0 12px 8px -8px rgba(0, 0, 0, 0.2)',
28190
+ minWidth: '250px'
28191
+ }
28192
+ },
28193
+ selections: {
28194
+ show: showToolbar,
28195
+ api: selections,
28196
+ onConfirm: () => {},
28197
+ onCancel: () => {}
28198
+ }
28199
+ };
28200
+ }
28201
+
27907
28202
  const PREFIX$4 = 'ListBoxInline';
27908
- const searchIconWidth = 28;
27909
28203
  const classes$4 = {
27910
28204
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
27911
- screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
28205
+ screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly"),
28206
+ listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
27912
28207
  };
27913
- const StyledGrid$3 = styled$1(Grid$1)(_ref => {
28208
+ const StyledGrid$3 = styled$1(Grid$1, {
28209
+ shouldForwardProp: p => !['containerPadding'].includes(p)
28210
+ })(_ref => {
27914
28211
  var _theme$listBox$backgr, _theme$listBox;
27915
28212
  let {
27916
- theme
28213
+ theme,
28214
+ containerPadding
27917
28215
  } = _ref;
27918
28216
  return {
27919
28217
  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,
27920
28218
  ["& .".concat(classes$4.listBoxHeader)]: {
27921
28219
  alignSelf: 'center',
27922
28220
  display: 'inline-flex',
27923
- width: "calc(100% - ".concat(searchIconWidth, "px)")
28221
+ width: "calc(100% - ".concat(BUTTON_ICON_WIDTH, "px)")
27924
28222
  },
27925
28223
  ["& .".concat(classes$4.screenReaderOnly)]: {
27926
28224
  position: 'absolute',
27927
28225
  height: 0,
27928
28226
  width: 0,
27929
28227
  overflow: 'hidden'
28228
+ },
28229
+ ["& .".concat(classes$4.listboxWrapper)]: {
28230
+ padding: containerPadding
27930
28231
  }
27931
28232
  };
27932
28233
  });
@@ -27942,7 +28243,7 @@
27942
28243
  };
27943
28244
  });
27944
28245
  function ListBoxInline(_ref3) {
27945
- var _layout$layoutOptions, _layout$layoutOptions2;
28246
+ var _layoutOptions$dense;
27946
28247
  let {
27947
28248
  options,
27948
28249
  layout
@@ -27951,7 +28252,6 @@
27951
28252
  app,
27952
28253
  direction,
27953
28254
  frequencyMode,
27954
- listLayout,
27955
28255
  checkboxes,
27956
28256
  search = true,
27957
28257
  focusSearch = false,
@@ -27992,7 +28292,6 @@
27992
28292
  constraints
27993
28293
  } = reactExports.useContext(InstanceContext);
27994
28294
  theme.listBox = addListboxTheme(themeApi);
27995
- const moreAlignTo = reactExports.useRef();
27996
28295
  const containerRef = reactExports.useRef();
27997
28296
  const [searchContainer, searchContainerRef] = useRefWithCallback();
27998
28297
  const [showToolbar, setShowToolbar] = reactExports.useState(false);
@@ -28010,6 +28309,8 @@
28010
28309
  stop: 0
28011
28310
  });
28012
28311
  const [appSelections] = useAppSelections(app);
28312
+ const titleRef = reactExports.useRef(null);
28313
+ const [selectionState$1] = reactExports.useState(() => selectionState());
28013
28314
  const {
28014
28315
  handleKeyDown,
28015
28316
  handleOnMouseEnter,
@@ -28035,6 +28336,7 @@
28035
28336
  if ((layout === null || layout === void 0 ? void 0 : layout.toolbar) !== undefined) {
28036
28337
  toolbar = layout.toolbar;
28037
28338
  }
28339
+ const toolbarDetachedOnly = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) === '';
28038
28340
  toolbar = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '';
28039
28341
  reactExports.useEffect(() => {
28040
28342
  const show = () => {
@@ -28051,15 +28353,15 @@
28051
28353
  };
28052
28354
  if (selections) {
28053
28355
  if (!selections.isModal()) {
28054
- selections.on('deactivated', hide);
28055
28356
  selections.on('activated', show);
28357
+ selections.on('deactivated', hide);
28056
28358
  }
28057
28359
  setShowToolbar(selections.isActive());
28058
28360
  }
28059
28361
  return () => {
28060
28362
  if (selections && selections.removeListener) {
28061
- selections.removeListener('deactivated', show);
28062
- selections.removeListener('activated', hide);
28363
+ selections.removeListener('activated', show);
28364
+ selections.removeListener('deactivated', hide);
28063
28365
  }
28064
28366
  };
28065
28367
  }, [selections, toolbar]);
@@ -28077,17 +28379,23 @@
28077
28379
  return null;
28078
28380
  }
28079
28381
  const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
28080
- const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
28382
+ const isDrillDown = layout.qListObject.qDimensionInfo.qGrouping === 'H';
28383
+ const listboxSelectionToolbarItems = createListboxSelectionToolbar({
28081
28384
  layout,
28082
28385
  model,
28083
- translator
28084
- }) : [];
28386
+ translator,
28387
+ selectionState: selectionState$1
28388
+ });
28085
28389
  const showSearchToggle = search === 'toggle' && showSearch;
28086
28390
  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;
28391
+ const {
28392
+ layoutOptions = {}
28393
+ } = layout;
28394
+ const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
28088
28395
  const searchHeight = dense ? 27 : 40;
28089
28396
  const extraheight = dense ? 39 : 49;
28090
28397
  const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
28398
+ const headerHeight = 32;
28091
28399
  const {
28092
28400
  wildCardSearch,
28093
28401
  searchEnabled
@@ -28096,13 +28404,34 @@
28096
28404
  const newValue = !showSearch;
28097
28405
  setShowSearch(newValue);
28098
28406
  };
28407
+ const getActionToolbarProps = isPopover => getListboxActionProps({
28408
+ isPopover,
28409
+ showToolbar,
28410
+ containerRef,
28411
+ isLocked,
28412
+ listboxSelectionToolbarItems,
28413
+ selections
28414
+ });
28099
28415
  const shouldAutoFocus = searchVisible && search === 'toggle';
28100
- return /*#__PURE__*/React.createElement(StyledGrid$3, {
28416
+ const showSearchIcon = searchEnabled !== false && search === 'toggle' && !(constraints !== null && constraints !== void 0 && constraints.active);
28417
+ const showSearchOrLockIcon = isLocked || showSearchIcon;
28418
+ const showIcons = showSearchOrLockIcon || isDrillDown;
28419
+ const iconsWidth = (showSearchOrLockIcon ? BUTTON_ICON_WIDTH : 0) + (isDrillDown ? ICON_WIDTH + ICON_PADDING : 0); // Drill-down icon needs padding right so there is space between the icon and the title
28420
+ const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
28421
+
28422
+ // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
28423
+ const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
28424
+ let containerPadding;
28425
+ if (isGridMode) {
28426
+ containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
28427
+ }
28428
+ return /*#__PURE__*/React.createElement(React.Fragment, null, toolbarDetachedOnly && /*#__PURE__*/React.createElement(ActionsToolbar, getActionToolbarProps(true)), /*#__PURE__*/React.createElement(StyledGrid$3, {
28101
28429
  className: "listbox-container",
28102
28430
  container: true,
28103
28431
  tabIndex: keyboard.enabled && !keyboard.active ? 0 : -1,
28104
28432
  direction: "column",
28105
28433
  gap: 0,
28434
+ containerPadding: containerPadding,
28106
28435
  style: {
28107
28436
  height: '100%',
28108
28437
  minHeight: "".concat(minHeight, "px"),
@@ -28116,70 +28445,69 @@
28116
28445
  item: true,
28117
28446
  container: true,
28118
28447
  style: {
28119
- padding: theme.spacing(1)
28448
+ padding: theme.spacing(1),
28449
+ paddingLeft: "".concat(headerPaddingLeft, "px")
28120
28450
  },
28121
28451
  wrap: "nowrap"
28122
28452
  }, /*#__PURE__*/React.createElement(Grid$1, {
28123
28453
  item: true,
28124
28454
  container: true,
28455
+ height: headerHeight,
28125
28456
  wrap: "nowrap"
28126
- }, /*#__PURE__*/React.createElement(Grid$1, {
28457
+ }, showIcons && /*#__PURE__*/React.createElement(Grid$1, {
28127
28458
  item: true,
28128
28459
  sx: {
28129
28460
  display: 'flex',
28130
28461
  alignItems: 'center',
28131
- width: searchIconWidth
28462
+ width: iconsWidth
28132
28463
  }
28133
28464
  }, isLocked ? /*#__PURE__*/React.createElement(IconButton$1, {
28134
28465
  tabIndex: -1,
28135
28466
  onClick: unlock,
28136
- disabled: !isLocked,
28467
+ disabled: selectDisabled(),
28137
28468
  size: "large"
28138
28469
  }, /*#__PURE__*/React.createElement(Lock, {
28139
28470
  title: translator.get('Listbox.Unlock'),
28471
+ disableRipple: true,
28140
28472
  style: {
28141
28473
  fontSize: '12px'
28142
28474
  }
28143
- })) : searchEnabled !== false && /*#__PURE__*/React.createElement(IconButton$1, {
28475
+ })) : showSearchIcon && /*#__PURE__*/React.createElement(IconButton$1, {
28144
28476
  onClick: onShowSearch,
28145
28477
  tabIndex: -1,
28146
28478
  title: translator.get('Listbox.Search'),
28147
- size: "large"
28479
+ size: "large",
28480
+ disableRipple: true,
28481
+ "data-testid": "search-toggle-btn"
28148
28482
  }, /*#__PURE__*/React.createElement(SearchIcon, {
28149
28483
  style: {
28150
28484
  fontSize: '12px'
28151
28485
  }
28152
- }))), /*#__PURE__*/React.createElement(Grid$1, {
28486
+ })), isDrillDown && /*#__PURE__*/React.createElement(DrillDownIcon, {
28487
+ tabIndex: -1,
28488
+ title: translator.get('Listbox.DrillDown'),
28489
+ size: "large",
28490
+ style: {
28491
+ fontSize: '12px'
28492
+ }
28493
+ })), /*#__PURE__*/React.createElement(Grid$1, {
28153
28494
  item: true,
28154
28495
  className: classes$4.listBoxHeader
28155
28496
  }, /*#__PURE__*/React.createElement(Title, {
28156
28497
  variant: "h6",
28157
- noWrap: true
28498
+ noWrap: true,
28499
+ ref: titleRef,
28500
+ title: layout.title
28158
28501
  }, layout.title))), /*#__PURE__*/React.createElement(Grid$1, {
28159
28502
  item: true,
28160
28503
  xs: true
28161
28504
  }), /*#__PURE__*/React.createElement(Grid$1, {
28162
28505
  item: true
28163
- }, /*#__PURE__*/React.createElement(ActionsToolbar, {
28164
- more: {
28165
- enabled: !isLocked,
28166
- actions: listboxSelectionToolbarItems,
28167
- alignTo: moreAlignTo,
28168
- popoverProps: {
28169
- elevation: 0
28170
- },
28171
- popoverPaperStyle: {
28172
- boxShadow: '0 12px 8px -8px rgba(0, 0, 0, 0.2)',
28173
- minWidth: '250px'
28174
- }
28175
- },
28176
- selections: {
28177
- show: showToolbar,
28178
- api: selections,
28179
- onConfirm: () => {},
28180
- onCancel: () => {}
28181
- }
28182
- }))), /*#__PURE__*/React.createElement(Grid$1, {
28506
+ }, /*#__PURE__*/React.createElement(ActionsToolbar, getActionToolbarProps(showToolbarDetached({
28507
+ containerRef,
28508
+ titleRef,
28509
+ iconsWidth
28510
+ }))))), /*#__PURE__*/React.createElement(Grid$1, {
28183
28511
  item: true,
28184
28512
  container: true,
28185
28513
  direction: "column",
@@ -28189,15 +28517,14 @@
28189
28517
  },
28190
28518
  role: "region",
28191
28519
  "aria-label": translator.get('Listbox.ResultFilterLabel')
28192
- }, /*#__PURE__*/React.createElement("div", {
28193
- ref: moreAlignTo
28194
- }), /*#__PURE__*/React.createElement(Grid$1, {
28520
+ }, /*#__PURE__*/React.createElement(Grid$1, {
28195
28521
  item: true,
28196
28522
  ref: searchContainerRef
28197
28523
  }, /*#__PURE__*/React.createElement("div", {
28198
28524
  className: classes$4.screenReaderOnly
28199
28525
  }, translator.get('Listbox.Search.ScreenReaderInstructions')), /*#__PURE__*/React.createElement(ListBoxSearch, {
28200
28526
  selections: selections,
28527
+ selectionState: selectionState$1,
28201
28528
  model: model,
28202
28529
  dense: dense,
28203
28530
  keyboard: keyboard,
@@ -28209,7 +28536,8 @@
28209
28536
  searchEnabled: searchEnabled
28210
28537
  })), /*#__PURE__*/React.createElement(Grid$1, {
28211
28538
  item: true,
28212
- xs: true
28539
+ xs: true,
28540
+ className: classes$4.listboxWrapper
28213
28541
  }, /*#__PURE__*/React.createElement("div", {
28214
28542
  className: classes$4.screenReaderOnly
28215
28543
  }, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React.createElement(AutoSizer, null, _ref4 => {
@@ -28219,10 +28547,11 @@
28219
28547
  } = _ref4;
28220
28548
  return /*#__PURE__*/React.createElement(ListBox, {
28221
28549
  model: model,
28550
+ constraints: constraints,
28222
28551
  layout: layout,
28223
28552
  selections: selections,
28553
+ selectionState: selectionState$1,
28224
28554
  direction: direction,
28225
- listLayout: listLayout,
28226
28555
  frequencyMode: frequencyMode,
28227
28556
  rangeSelect: rangeSelect,
28228
28557
  checkboxes: checkboxes,
@@ -28249,7 +28578,7 @@
28249
28578
  set: setCurrentScrollIndex
28250
28579
  }
28251
28580
  });
28252
- }))));
28581
+ })))));
28253
28582
  }
28254
28583
  const ListBoxInlineMemoed = React.memo(ListBoxInline);
28255
28584
  function IsolateUseLayoutWrapper(_ref5) {
@@ -28291,6 +28620,9 @@
28291
28620
  } else {
28292
28621
  const m = await app.getObject(qId);
28293
28622
  modelStore.set(m.id, m);
28623
+ m.once('closed', () => {
28624
+ modelStore.clear(m.id);
28625
+ });
28294
28626
  setModel(m);
28295
28627
  }
28296
28628
  }
@@ -28344,6 +28676,7 @@
28344
28676
  const {
28345
28677
  dense,
28346
28678
  checkboxes,
28679
+ listLayout,
28347
28680
  properties = {}
28348
28681
  } = options;
28349
28682
  let {
@@ -28372,6 +28705,20 @@
28372
28705
  break;
28373
28706
  }
28374
28707
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
28708
+ const layoutOptions = {
28709
+ dense
28710
+ };
28711
+ if (listLayout === 'horizontal') {
28712
+ layoutOptions.dataLayout = 'grid';
28713
+ layoutOptions.layoutOrder = 'column';
28714
+ layoutOptions.maxVisibleColumns = {
28715
+ auto: true
28716
+ };
28717
+ layoutOptions.maxVisibleRows = {
28718
+ auto: false,
28719
+ maxRows: 1
28720
+ };
28721
+ }
28375
28722
  const id = reactExports.useRef();
28376
28723
  if (!id.current) {
28377
28724
  id.current = uid();
@@ -28384,6 +28731,7 @@
28384
28731
  qListObjectDef: {
28385
28732
  qStateName: stateName,
28386
28733
  qShowAlternatives: true,
28734
+ frequencyEnabled: false,
28387
28735
  qFrequencyMode: getListdefFrequencyMode(),
28388
28736
  qInitialDataFetch: [{
28389
28737
  qTop: 0,
@@ -28402,9 +28750,7 @@
28402
28750
  },
28403
28751
  histogram,
28404
28752
  checkboxes,
28405
- layoutOptions: {
28406
- dense
28407
- },
28753
+ layoutOptions,
28408
28754
  title
28409
28755
  };
28410
28756
  extend$1(true, listdef, properties);
@@ -28526,7 +28872,7 @@
28526
28872
  options
28527
28873
  });
28528
28874
  const elementRef = reactExports.useRef(element);
28529
- const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more'], options)[0];
28875
+ const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more', '.njs-action-toolbar-popover'], options)[0];
28530
28876
  const opts = reactExports.useMemo(() => _objectSpread2(_objectSpread2({}, options), {}, {
28531
28877
  selections,
28532
28878
  model,