@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.
package/core/esm/dev.js CHANGED
@@ -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
  */
@@ -1613,6 +1613,12 @@ var Visualization_UnfulfilledCalculationCondition = {
1613
1613
  "zh-TW": "不符計算條件"
1614
1614
  }
1615
1615
  };
1616
+ var Listbox_DrillDown = {
1617
+ id: "Listbox.DrillDown",
1618
+ locale: {
1619
+ "en-US": "Drill-down dimension"
1620
+ }
1621
+ };
1616
1622
  var all = {
1617
1623
  Cancel: Cancel$1,
1618
1624
  CurrentSelections_All: CurrentSelections_All,
@@ -1649,7 +1655,8 @@ var all = {
1649
1655
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1650
1656
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1651
1657
  Visualization_LayoutError: Visualization_LayoutError,
1652
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
1658
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
1659
+ Listbox_DrillDown: Listbox_DrillDown
1653
1660
  };
1654
1661
 
1655
1662
  function appLocaleFn(language) {
@@ -3438,6 +3445,14 @@ function deviceTypeFn(deviceType) {
3438
3445
  return detectTouchscreen() ? 'touch' : 'desktop';
3439
3446
  }
3440
3447
 
3448
+ var client = {};
3449
+
3450
+ var m = ReactDOM;
3451
+ {
3452
+ client.createRoot = m.createRoot;
3453
+ client.hydrateRoot = m.hydrateRoot;
3454
+ }
3455
+
3441
3456
  function _extends$5() {
3442
3457
  _extends$5 = Object.assign ? Object.assign.bind() : function (target) {
3443
3458
  for (var i = 1; i < arguments.length; i++) {
@@ -7741,7 +7756,7 @@ const light = {
7741
7756
  disabled: 'rgba(0, 0, 0, 0.3)'
7742
7757
  },
7743
7758
  action: {
7744
- active: colors.grey25,
7759
+ active: '#545454',
7745
7760
  // color for actionable things like icon buttons
7746
7761
  hover: 'rgba(0, 0, 0, 0.03)',
7747
7762
  // color for hoverable things like list items
@@ -7881,10 +7896,21 @@ const overrides = theme => ({
7881
7896
  padding: 7,
7882
7897
  borderRadius: 2,
7883
7898
  border: '1px solid transparent',
7884
- // should ideally use $focusVisible, but that messes up focus in all other places where Iconbutton is used (Checkbox, Switch etc)
7885
- '&:focus': {
7899
+ '&:hover': {
7900
+ backgroundColor: theme.palette.btn.hover
7901
+ },
7902
+ '&:focus-visible': {
7886
7903
  borderColor: theme.palette.custom.focusBorder,
7887
7904
  boxShadow: "0 0 0 2px ".concat(theme.palette.custom.focusOutline)
7905
+ },
7906
+ '&:active': {
7907
+ borderColor: 'transparent',
7908
+ boxShadow: 'none',
7909
+ backgroundColor: theme.palette.btn.active
7910
+ },
7911
+ '&:not(:active):not(:focus-visible)': {
7912
+ borderColor: 'transparent',
7913
+ boxShadow: 'none'
7888
7914
  }
7889
7915
  }
7890
7916
  },
@@ -7972,7 +7998,7 @@ function create$3(definition) {
7972
7998
  return cache[key];
7973
7999
  }
7974
8000
 
7975
- const NEBULA_VERSION_HASH = "593e" ;
8001
+ const NEBULA_VERSION_HASH = "f871" ;
7976
8002
  ClassNameGenerator$1.configure(componentName => {
7977
8003
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
7978
8004
  });
@@ -8134,7 +8160,8 @@ function useAppSelections(app) {
8134
8160
  const NebulaApp = forwardRef((_ref, ref) => {
8135
8161
  let {
8136
8162
  initialContext,
8137
- app
8163
+ app,
8164
+ renderCallback
8138
8165
  } = _ref;
8139
8166
  const [appSelections] = useAppSelections(app);
8140
8167
  const [context, setContext] = useState$1(initialContext);
@@ -8145,21 +8172,20 @@ const NebulaApp = forwardRef((_ref, ref) => {
8145
8172
  theme: create$3(muiThemeName)
8146
8173
  }), [muiThemeName]);
8147
8174
  const [components, setComponents] = useState$1([]);
8175
+
8176
+ // Will be called directly after the first render pass
8177
+ // See: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
8178
+ useEffect$1(() => {
8179
+ renderCallback && renderCallback();
8180
+ }, []);
8148
8181
  useImperativeHandle$1(ref, () => ({
8149
- addComponent(component) {
8150
- setComponents([...components, component]);
8151
- },
8152
- removeComponent(component) {
8153
- const ix = components.indexOf(component);
8154
- if (ix !== -1) {
8155
- components.splice(ix, 1);
8156
- setComponents([...components]);
8157
- }
8182
+ setComps(comps) {
8183
+ setComponents([...comps]);
8158
8184
  },
8159
8185
  setMuiThemeName,
8160
8186
  setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext),
8161
8187
  getAppSelections: () => appSelections
8162
- }));
8188
+ }), []);
8163
8189
  return /*#__PURE__*/React__default.createElement(StyledEngineProvider, {
8164
8190
  injectFirst: true
8165
8191
  }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
@@ -8180,15 +8206,18 @@ function boot(_ref2) {
8180
8206
  const appRef = React__default.createRef();
8181
8207
  const element = document.createElement('div');
8182
8208
  element.style.display = 'none';
8183
- element.setAttribute('data-nebulajs-version', "3.3.0" );
8209
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.1" );
8184
8210
  element.setAttribute('data-app-id', app.id);
8185
8211
  document.body.appendChild(element);
8186
- ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
8212
+ const root = client.createRoot(element);
8213
+ root.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
8187
8214
  ref: appRef,
8188
8215
  app: app,
8189
- initialContext: context
8190
- }), element, resolveRender);
8216
+ initialContext: context,
8217
+ renderCallback: resolveRender
8218
+ }));
8191
8219
  const cells = {};
8220
+ const components = [];
8192
8221
  return [{
8193
8222
  toggleFocusOfCells(cellIdToFocus) {
8194
8223
  Object.keys(cells).forEach(i => {
@@ -8205,13 +8234,18 @@ function boot(_ref2) {
8205
8234
  add(component) {
8206
8235
  (async () => {
8207
8236
  await rendered;
8208
- appRef.current.addComponent(component);
8237
+ components.push(component);
8238
+ appRef.current.setComps(components);
8209
8239
  })();
8210
8240
  },
8211
8241
  remove(component) {
8212
8242
  (async () => {
8213
8243
  await rendered;
8214
- appRef.current.removeComponent(component);
8244
+ const ix = components.indexOf(component);
8245
+ if (ix !== -1) {
8246
+ components.splice(ix, 1);
8247
+ }
8248
+ appRef.current.setComps(components);
8215
8249
  })();
8216
8250
  },
8217
8251
  setMuiThemeName(themeName) {
@@ -8864,9 +8898,6 @@ const flatten = arr => arr.reduce((prev, cur) => prev.concat(cur));
8864
8898
  function isStateSelected(qState) {
8865
8899
  return SELECTED_STATES.includes(qState);
8866
8900
  }
8867
- function getUniques(arr) {
8868
- return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
8869
- }
8870
8901
  function getSelectedValues(pages) {
8871
8902
  if (!pages || !pages.length) {
8872
8903
  return [];
@@ -8880,45 +8911,38 @@ function getSelectedValues(pages) {
8880
8911
  });
8881
8912
  return flatten(elementNbrs);
8882
8913
  }
8883
- function applySelectionsOnPages(pages, elmNumbers) {
8884
- let clearAllButElmNumbers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8885
- const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
8886
- const matrices = pages.map(page => {
8887
- const qMatrix = page.qMatrix.map(p => {
8888
- const [p0] = p;
8889
- const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
8890
- let qState;
8891
- if (clearAllButElmNumbers) {
8892
- qState = selectionMatchesElement ? 'S' : 'A';
8893
- } else {
8894
- qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
8895
- }
8896
- return [_objectSpread2(_objectSpread2({}, p0), {}, {
8897
- qState
8898
- }), p.slice(1)];
8899
- });
8900
- return _objectSpread2(_objectSpread2({}, page), {}, {
8901
- qMatrix
8902
- });
8903
- });
8904
- return matrices;
8905
- }
8906
8914
  async function selectValues(_ref) {
8907
8915
  let {
8908
8916
  selections,
8909
8917
  elemNumbers,
8910
- isSingleSelect = false
8918
+ toggle,
8919
+ isSingleSelect
8911
8920
  } = _ref;
8912
- let resolved = Promise.resolve(false);
8921
+ if (elemNumbers.length === 0) {
8922
+ return false;
8923
+ }
8913
8924
  const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
8925
+ let success = false;
8914
8926
  if (!hasNanValues) {
8915
8927
  const elemNumbersToSelect = elemNumbers;
8916
- resolved = selections.select({
8917
- method: 'selectListObjectValues',
8918
- params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
8919
- }).then(success => success !== false).catch(() => false);
8928
+ try {
8929
+ const response = await selections.select({
8930
+ method: 'selectListObjectValues',
8931
+ params: ['/qListObjectDef', elemNumbersToSelect, toggle]
8932
+ });
8933
+ success = response !== false;
8934
+ } catch (_unused) {
8935
+ success = false;
8936
+ }
8937
+ if (!success) {
8938
+ if (isSingleSelect) {
8939
+ selections.cancel(); // revert selection
8940
+ } else {
8941
+ selections.clear();
8942
+ }
8943
+ }
8920
8944
  }
8921
- return resolved;
8945
+ return success;
8922
8946
  }
8923
8947
  function getElemNumbersFromPages(pages) {
8924
8948
  if (!pages || !pages.length) {
@@ -8981,126 +9005,132 @@ function fillRange(elementNbrs, elemNumbersOrdered) {
8981
9005
  return elemNumbersOrdered.slice(min, max + 1);
8982
9006
  }
8983
9007
 
9008
+ const getKeyAsToggleSelected = event => !(event.metaKey || event.ctrlKey);
8984
9009
  function useSelectionsInteractions(_ref) {
8985
9010
  let {
8986
- layout,
9011
+ selectionState,
8987
9012
  selections,
8988
- pages = [],
8989
9013
  checkboxes = false,
8990
- selectDisabled,
8991
- doc = document,
8992
- isSingleSelect: singleSelect = false
9014
+ doc = document
8993
9015
  } = _ref;
8994
- const [instantPages, setInstantPages] = useState$1(pages);
8995
- const [mouseDown, setMouseDown] = useState$1(false);
8996
- const [selectingValues, setSelectingValues] = useState$1(false);
8997
- const [isSingleSelect, setIsSingleSelect] = useState$1(singleSelect);
8998
- const [selected, setSelected] = useState$1([]);
8999
- const [isRangeSelection, setIsRangeSelection] = useState$1(false);
9000
- const [preSelected, setPreSelected] = useState$1([]);
9001
- const elemNumbersOrdered = getElemNumbersFromPages(pages);
9002
- useEffect$1(() => {
9003
- setIsSingleSelect(singleSelect);
9004
- }, [singleSelect]);
9016
+ const currentSelect = useRef({
9017
+ startElemNumber: undefined,
9018
+ elemNumbers: [],
9019
+ isRange: false,
9020
+ toggle: false,
9021
+ active: false
9022
+ });
9005
9023
 
9006
- // Select values for real, by calling the backend.
9007
- const select = async function () {
9008
- let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9009
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9010
- if (selectDisabled()) {
9011
- return;
9012
- }
9013
- setSelectingValues(true);
9014
- const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
9015
- await selectValues({
9024
+ // eslint-disable-next-line arrow-body-style
9025
+ const doSelect = () => {
9026
+ selectionState.setSelectableValuesUpdating();
9027
+ return selectValues({
9016
9028
  selections,
9017
- elemNumbers: filtered,
9018
- isSingleSelect
9029
+ elemNumbers: currentSelect.current.elemNumbers,
9030
+ isSingleSelect: selectionState.isSingleSelect,
9031
+ toggle: currentSelect.current.toggle
9019
9032
  });
9020
- setSelectingValues(false);
9021
- setPreSelected([]);
9022
9033
  };
9023
-
9024
- // Show estimated selection states instantly before applying the selections for real.
9025
- const preSelect = function (elemNumbers) {
9026
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9027
- if (selectDisabled()) {
9034
+ const addToRange = elemNumber => {
9035
+ const {
9036
+ startElemNumber
9037
+ } = currentSelect.current;
9038
+ if (startElemNumber === elemNumber) {
9028
9039
  return;
9029
9040
  }
9030
- setPreSelected(existing => {
9031
- const uniques = getUniques([...existing, ...elemNumbers]);
9032
- const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
9033
- const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
9034
- return filled;
9035
- });
9041
+ const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
9042
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
9043
+ const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
9044
+ selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
9036
9045
  };
9037
9046
  const selectManually = function () {
9038
9047
  let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9039
9048
  let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9040
- setIsRangeSelection(false); // range is not supported for manual select
9041
- setMouseDown(true);
9042
- preSelect(elementIds, additive || isRangeSelection);
9043
- const p = select(elementIds, additive || isRangeSelection);
9044
- setMouseDown(false);
9045
- return p;
9049
+ const elemNumbers = [];
9050
+ selectionState.updateItems(elementIds, additive, elemNumbers);
9051
+ selectionState.setSelectableValuesUpdating();
9052
+ return selectValues({
9053
+ selections,
9054
+ elemNumbers: additive ? elemNumbers : elementIds,
9055
+ isSingleSelect: selectionState.isSingleSelect,
9056
+ toggle: !selectionState.isSingleSelect
9057
+ });
9046
9058
  };
9047
- const handleSingleSelectKey = event => {
9059
+ const handleSingleSelectKey = (event, target) => {
9048
9060
  if (event.ctrlKey || event.metaKey) {
9049
- setIsSingleSelect(true);
9050
- event.currentTarget.focus(); // will not be focused otherwise
9061
+ target.focus(); // will not be focused otherwise
9051
9062
  event.preventDefault();
9052
9063
  }
9053
9064
  };
9054
- const onClick = useCallback(event => {
9055
- if (selectingValues || selectDisabled()) {
9065
+ const onChange = useCallback(event => {
9066
+ if (selectionState.selectDisabled()) {
9056
9067
  return;
9057
9068
  }
9058
- const elemNumber = +event.currentTarget.getAttribute('data-n');
9059
- setPreSelected([elemNumber]);
9060
- handleSingleSelectKey(event);
9061
- }, [selectingValues, selectDisabled]);
9069
+ const elemNumber = +event.target.getAttribute('data-n');
9070
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event.nativeEvent);
9071
+ currentSelect.current.elemNumbers = [elemNumber];
9072
+ currentSelect.current.toggle = toggle;
9073
+ if (!toggle) {
9074
+ selectionState.clearItemStates(true);
9075
+ }
9076
+ selectionState.updateItem(elemNumber);
9077
+ currentSelect.current.active = false;
9078
+ doSelect();
9079
+ }, []);
9062
9080
  const onMouseDown = useCallback(event => {
9063
- if (selectingValues || selectDisabled()) {
9081
+ if (event.button !== 0 || selectionState.selectDisabled()) {
9064
9082
  return;
9065
9083
  }
9066
- setIsRangeSelection(false);
9067
- setMouseDown(true);
9068
9084
  const elemNumber = +event.currentTarget.getAttribute('data-n');
9069
- setPreSelected([elemNumber]);
9070
- handleSingleSelectKey(event);
9071
- }, [selectingValues, selectDisabled]);
9085
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event);
9086
+ currentSelect.current.isRange = false;
9087
+ currentSelect.current.startElemNumber = elemNumber;
9088
+ currentSelect.current.elemNumbers = [elemNumber];
9089
+ currentSelect.current.toggle = toggle;
9090
+ currentSelect.current.active = true;
9091
+ if (!toggle) {
9092
+ selectionState.clearItemStates(true);
9093
+ }
9094
+ selectionState.updateItem(elemNumber);
9095
+ if (selectionState.isSingleSelect) {
9096
+ currentSelect.current.active = false;
9097
+ doSelect();
9098
+ }
9099
+ handleSingleSelectKey(event, event.currentTarget);
9100
+ }, []);
9072
9101
  const onMouseUp = useCallback(event => {
9073
- const elemNumber = +event.currentTarget.getAttribute('data-n');
9074
- if (isSingleSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
9075
- ) {
9102
+ if (event.button !== 0 || !currentSelect.current.active) {
9076
9103
  return;
9077
9104
  }
9078
- preSelect([elemNumber]);
9079
- }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection, selectDisabled]);
9080
- const onMouseUpDoc = useCallback(() => {
9105
+ currentSelect.current.active = false;
9106
+ if (currentSelect.current.isRange) {
9107
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
9108
+ addToRange(elemNumber);
9109
+ }
9110
+ doSelect();
9111
+ }, []);
9112
+ const onMouseUpDoc = useCallback(event => {
9081
9113
  // Ensure we end interactions when mouseup happens outside the Listbox.
9082
- setMouseDown(false);
9083
- setSelectingValues(false);
9084
- setIsRangeSelection(false);
9085
- setIsSingleSelect(singleSelect);
9086
- }, [singleSelect]);
9087
- const onMouseEnter = useCallback(event => {
9088
- if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
9114
+ if (event.button !== 0 || !currentSelect.current.active) {
9089
9115
  return;
9090
9116
  }
9091
- setIsRangeSelection(true);
9092
- const elemNumber = +event.currentTarget.getAttribute('data-n');
9093
- preSelect([elemNumber], true);
9094
- }, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, selectDisabled, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
9095
- useEffect$1(() => {
9096
- // Perform selections of pre-selected values. This can
9097
- // happen only when interactions have finished (mouseup).
9098
- const interactionIsFinished = !mouseDown;
9099
- if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
9117
+ currentSelect.current.active = false;
9118
+ doSelect();
9119
+ }, []);
9120
+ const onMouseEnter = useCallback(event => {
9121
+ if (!currentSelect.current.active) {
9100
9122
  return;
9101
9123
  }
9102
- select(preSelected, isRangeSelection);
9103
- }, [preSelected, mouseDown, selectDisabled()]);
9124
+ if (!currentSelect.current.isRange) {
9125
+ currentSelect.current.isRange = true;
9126
+ if (!selectionState.isSelected(currentSelect.current.startElemNumber)) {
9127
+ selectionState.updateItem(currentSelect.current.startElemNumber, true);
9128
+ currentSelect.current.elemNumbers = [];
9129
+ }
9130
+ }
9131
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
9132
+ addToRange(elemNumber);
9133
+ }, []);
9104
9134
  useEffect$1(() => {
9105
9135
  doc.addEventListener('mouseup', onMouseUpDoc);
9106
9136
  return () => {
@@ -9108,25 +9138,26 @@ function useSelectionsInteractions(_ref) {
9108
9138
  };
9109
9139
  }, [onMouseUpDoc]);
9110
9140
  useEffect$1(() => {
9111
- if (selectingValues || mouseDown) {
9112
- return;
9113
- }
9114
- // Keep track of (truely) selected fields so we can prevent toggling them on range select.
9115
- const alreadySelected = getSelectedValues(pages);
9116
- setSelected(alreadySelected);
9117
- }, [pages]);
9118
- useEffect$1(() => {
9119
- if (selectingValues || !pages || !checkboxes && !mouseDown) {
9120
- return;
9121
- }
9122
- // Render pre-selections before they have been selected in Engine.
9123
- const newPages = applySelectionsOnPages(pages, preSelected, isSingleSelect);
9124
- setInstantPages(newPages);
9125
- }, [preSelected]);
9141
+ const clearItemStates = () => {
9142
+ selectionState.clearItemStates(false);
9143
+ };
9144
+ const onCleared = () => {
9145
+ selectionState.clearItemStates(true);
9146
+ selectionState.triggerStateChanged();
9147
+ };
9148
+ selections.on('clearItemStates', clearItemStates);
9149
+ selections.on('deactivated', clearItemStates);
9150
+ selections.on('cleared', onCleared);
9151
+ return () => {
9152
+ selections.removeListener('clearItemStates', clearItemStates);
9153
+ selections.removeListener('deactivated', clearItemStates);
9154
+ selections.removeListener('cleared', onCleared);
9155
+ };
9156
+ }, [selections]);
9126
9157
  const interactionEvents = {};
9127
9158
  if (checkboxes) {
9128
9159
  Object.assign(interactionEvents, {
9129
- onClick
9160
+ onChange
9130
9161
  });
9131
9162
  } else {
9132
9163
  Object.assign(interactionEvents, {
@@ -9136,7 +9167,6 @@ function useSelectionsInteractions(_ref) {
9136
9167
  });
9137
9168
  }
9138
9169
  return {
9139
- instantPages,
9140
9170
  interactionEvents,
9141
9171
  select: selectManually // preselect and select without having to trigger an event
9142
9172
  };
@@ -9483,6 +9513,34 @@ const excludedOrAlternative = _ref => {
9483
9513
  } = _ref;
9484
9514
  return (isAlternative(cell) || isExcluded(cell)) && checkboxes;
9485
9515
  };
9516
+ const getValueStateClasses = _ref2 => {
9517
+ let {
9518
+ column,
9519
+ histogram,
9520
+ checkboxes,
9521
+ cell,
9522
+ showGray
9523
+ } = _ref2;
9524
+ const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
9525
+ if (!histogram) {
9526
+ clazzArr.push(rowColClasses.rowBorderBottom);
9527
+ }
9528
+ if (!cell) {
9529
+ return [];
9530
+ }
9531
+ if (!checkboxes) {
9532
+ if (cell.qState === 'XS') {
9533
+ clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
9534
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
9535
+ clazzArr.push(rowColClasses.S);
9536
+ } else if (showGray && isAlternative(cell)) {
9537
+ clazzArr.push(rowColClasses.A);
9538
+ } else if (showGray && isExcluded(cell)) {
9539
+ clazzArr.push(rowColClasses.X);
9540
+ }
9541
+ }
9542
+ return clazzArr;
9543
+ };
9486
9544
 
9487
9545
  const frequencyTextNone = '-';
9488
9546
  const barPadPx = 4;
@@ -9513,6 +9571,11 @@ const getFrequencyText = _ref2 => {
9513
9571
  return '';
9514
9572
  };
9515
9573
 
9574
+ const CELL_PADDING_LEFT = 9;
9575
+ const ICON_WIDTH = 12;
9576
+ const ICON_PADDING = 7;
9577
+ const BUTTON_ICON_WIDTH = ICON_WIDTH + (ICON_PADDING + 1) * 2; // 1 is border width
9578
+
9516
9579
  const getSelectedStyle = _ref => {
9517
9580
  let {
9518
9581
  theme
@@ -9532,10 +9595,11 @@ const getSelectedStyle = _ref => {
9532
9595
  const ellipsis = {
9533
9596
  width: '100%',
9534
9597
  overflow: 'hidden',
9535
- textOverflow: 'ellipsis'
9598
+ textOverflow: 'ellipsis',
9599
+ whiteSpace: 'nowrap'
9536
9600
  };
9537
9601
  const RowColRoot = styled$1('div', {
9538
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense'].includes(prop)
9602
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
9539
9603
  })(_ref2 => {
9540
9604
  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;
9541
9605
  let {
@@ -9543,7 +9607,8 @@ const RowColRoot = styled$1('div', {
9543
9607
  flexBasisProp,
9544
9608
  isGridMode,
9545
9609
  isGridCol,
9546
- dense
9610
+ dense,
9611
+ frequencyWidth
9547
9612
  } = _ref2;
9548
9613
  return {
9549
9614
  '&:focus': {
@@ -9572,18 +9637,18 @@ const RowColRoot = styled$1('div', {
9572
9637
  minWidth: 0,
9573
9638
  flexGrow: 1,
9574
9639
  // Note that this padding is overridden when using checkboxes.
9575
- paddingLeft: '9px',
9576
- paddingRight: '9px'
9640
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
9641
+ paddingRight: 0
9577
9642
  },
9578
9643
  // The leaf node, containing the label text.
9579
9644
  ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
9580
9645
  flexBasis: flexBasisProp,
9581
9646
  lineHeight: '16px',
9582
9647
  userSelect: 'none',
9648
+ paddingRight: '1px'
9649
+ }, ellipsis), {}, {
9583
9650
  whiteSpace: 'pre',
9584
9651
  // to keep white-space on highlight
9585
- paddingRight: '9px'
9586
- }, ellipsis), {}, {
9587
9652
  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,
9588
9653
  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
9589
9654
  }),
@@ -9621,7 +9686,10 @@ const RowColRoot = styled$1('div', {
9621
9686
  // The icons container holding tick and lock, shown inside fields.
9622
9687
  ["& .".concat(rowColClasses.icon)]: {
9623
9688
  display: 'flex',
9624
- padding: theme.spacing(1, 1, 1, 0)
9689
+ justifyContent: 'center',
9690
+ width: 24,
9691
+ minWidth: 24,
9692
+ maxWidth: 24
9625
9693
  },
9626
9694
  // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
9627
9695
  ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
@@ -9633,7 +9701,7 @@ const RowColRoot = styled$1('div', {
9633
9701
  theme
9634
9702
  })), {}, {
9635
9703
  background: theme.palette.selected.excluded,
9636
- color: theme.palette.selected.mainContrastText,
9704
+ color: theme.palette.selected.excludedContrastText,
9637
9705
  border: isGridMode ? 'none' : undefined
9638
9706
  }),
9639
9707
  ["& .".concat(rowColClasses.A)]: {
@@ -9646,10 +9714,13 @@ const RowColRoot = styled$1('div', {
9646
9714
  color: theme.palette.selected.excludedContrastText,
9647
9715
  border: isGridMode ? 'none' : undefined
9648
9716
  },
9649
- ["& .".concat(rowColClasses.frequencyCount)]: {
9650
- width: '66px',
9717
+ ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
9651
9718
  justifyContent: 'flex-end'
9652
- },
9719
+ }, ellipsis), {}, {
9720
+ flex: "0 1 ".concat(frequencyWidth, "px"),
9721
+ textAlign: 'right',
9722
+ paddingLeft: '2px'
9723
+ }),
9653
9724
  ["&.".concat(rowColClasses.barContainer)]: {
9654
9725
  height: '100%',
9655
9726
  display: 'flex',
@@ -9684,6 +9755,7 @@ const RowColRoot = styled$1('div', {
9684
9755
  }
9685
9756
  };
9686
9757
  });
9758
+ var RowColRoot$1 = React__default.memo(RowColRoot);
9687
9759
 
9688
9760
  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\")";
9689
9761
 
@@ -9759,19 +9831,23 @@ const getIcon = function (cls) {
9759
9831
  };
9760
9832
  function ListboxCheckbox(_ref2) {
9761
9833
  let {
9834
+ onChange,
9762
9835
  checked,
9763
9836
  label,
9764
9837
  dense,
9765
9838
  excluded,
9766
- showGray = true
9839
+ showGray = true,
9840
+ dataN
9767
9841
  } = _ref2;
9768
9842
  return /*#__PURE__*/React__default.createElement(StyledCheckbox, {
9769
9843
  edge: "start",
9844
+ onChange: onChange,
9770
9845
  checked: checked,
9771
9846
  disableRipple: true,
9772
9847
  className: [classes$b.checkbox, dense && classes$b.dense].filter(Boolean).join(' '),
9773
9848
  inputProps: {
9774
- 'aria-labelledby': label
9849
+ 'aria-labelledby': label,
9850
+ 'data-n': dataN
9775
9851
  },
9776
9852
  name: label,
9777
9853
  icon: getIcon(classes$b, showGray, excluded),
@@ -9800,15 +9876,21 @@ const StyledRadio = styled$1(Radio)(_ref => {
9800
9876
  });
9801
9877
  function ListBoxRadioButton(_ref2) {
9802
9878
  let {
9879
+ onChange,
9803
9880
  checked,
9804
9881
  label,
9805
- dense
9882
+ dense,
9883
+ dataN
9806
9884
  } = _ref2;
9807
9885
  return /*#__PURE__*/React__default.createElement(StyledRadio, {
9808
9886
  checked: checked,
9887
+ onChange: onChange,
9809
9888
  value: label,
9810
9889
  name: label,
9811
9890
  className: classes$a.radioButton,
9891
+ inputProps: {
9892
+ 'data-n': dataN
9893
+ },
9812
9894
  style: {
9813
9895
  backgroundColor: 'transparent'
9814
9896
  },
@@ -9839,7 +9921,7 @@ function ValueField(_ref) {
9839
9921
  checkboxes
9840
9922
  }) && rowColClasses.excludedTextWithCheckbox]),
9841
9923
  color: color,
9842
- justifyContent: valueTextAlign
9924
+ align: valueTextAlign
9843
9925
  }, /*#__PURE__*/React__default.createElement("span", {
9844
9926
  style: {
9845
9927
  whiteSpace: 'pre'
@@ -9875,6 +9957,7 @@ function LabelTag(_ref) {
9875
9957
 
9876
9958
  function CheckboxField(_ref) {
9877
9959
  let {
9960
+ onChange,
9878
9961
  label,
9879
9962
  color,
9880
9963
  qElemNumber,
@@ -9889,17 +9972,21 @@ function CheckboxField(_ref) {
9889
9972
  valueTextAlign
9890
9973
  } = _ref;
9891
9974
  const cb = /*#__PURE__*/React__default.createElement(ListboxCheckbox, {
9975
+ onChange: onChange,
9892
9976
  label: label,
9893
9977
  checked: isSelected,
9894
9978
  dense: dense,
9895
9979
  excluded: isExcluded(cell),
9896
9980
  isGridCol: isGridCol,
9897
- showGray: showGray
9981
+ showGray: showGray,
9982
+ dataN: qElemNumber
9898
9983
  });
9899
9984
  const rb = /*#__PURE__*/React__default.createElement(ListBoxRadioButton, {
9985
+ onChange: onChange,
9900
9986
  label: label,
9901
9987
  checked: isSelected,
9902
- dense: dense
9988
+ dense: dense,
9989
+ dataN: qElemNumber
9903
9990
  });
9904
9991
  return /*#__PURE__*/React__default.createElement(FormControlLabel, {
9905
9992
  color: color,
@@ -9926,11 +10013,12 @@ function LabelsWithRanges(_ref) {
9926
10013
  showGray,
9927
10014
  checkboxes
9928
10015
  } = _ref;
9929
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, labels.map(_ref2 => {
10016
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, labels.map((_ref2, index) => {
9930
10017
  let [label, highlighted] = _ref2;
10018
+ const key = "".concat(index);
9931
10019
  return /*#__PURE__*/React__default.createElement(ValueField, {
9932
10020
  label: label,
9933
- key: label,
10021
+ key: key,
9934
10022
  highlighted: highlighted,
9935
10023
  dense: dense,
9936
10024
  showGray: showGray,
@@ -9940,6 +10028,7 @@ function LabelsWithRanges(_ref) {
9940
10028
  }
9941
10029
  function FieldWithRanges(_ref3) {
9942
10030
  let {
10031
+ onChange,
9943
10032
  labels,
9944
10033
  checkboxes,
9945
10034
  dense,
@@ -9959,6 +10048,7 @@ function FieldWithRanges(_ref3) {
9959
10048
  checkboxes: checkboxes
9960
10049
  });
9961
10050
  return checkboxes ? /*#__PURE__*/React__default.createElement(CheckboxField, {
10051
+ onChange: onChange,
9962
10052
  label: LWR,
9963
10053
  color: color,
9964
10054
  qElemNumber: qElemNumber,
@@ -9975,6 +10065,7 @@ function FieldWithRanges(_ref3) {
9975
10065
 
9976
10066
  function Field(_ref) {
9977
10067
  let {
10068
+ onChange,
9978
10069
  label,
9979
10070
  color,
9980
10071
  qElemNumber,
@@ -9989,6 +10080,7 @@ function Field(_ref) {
9989
10080
  valueTextAlign
9990
10081
  } = _ref;
9991
10082
  return checkboxes ? /*#__PURE__*/React__default.createElement(CheckboxField, {
10083
+ onChange: onChange,
9992
10084
  label: label,
9993
10085
  color: color,
9994
10086
  qElemNumber: qElemNumber,
@@ -10012,6 +10104,7 @@ function Field(_ref) {
10012
10104
  valueTextAlign: valueTextAlign
10013
10105
  });
10014
10106
  }
10107
+ var Field$1 = React__default.memo(Field);
10015
10108
 
10016
10109
  function Histogram(_ref) {
10017
10110
  let {
@@ -10084,12 +10177,16 @@ function getGridItemSizes(_ref) {
10084
10177
  case 'row':
10085
10178
  return {
10086
10179
  height: "calc(100% - ".concat(itemPadding, "px)"),
10087
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
10180
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
10181
+ position: 'absolute',
10182
+ left: 4
10088
10183
  };
10089
10184
  case 'column':
10090
10185
  return {
10091
10186
  height: "calc(100% - ".concat(itemPadding, "px)"),
10092
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
10187
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
10188
+ position: 'absolute',
10189
+ left: 4
10093
10190
  };
10094
10191
  default:
10095
10192
  return {};
@@ -10097,24 +10194,43 @@ function getGridItemSizes(_ref) {
10097
10194
  }
10098
10195
 
10099
10196
  const ItemGrid = styled$1(Grid, {
10100
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding'].includes(prop)
10197
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'checkboxes'].includes(prop)
10101
10198
  })(_ref => {
10102
10199
  let {
10103
10200
  dataLayout,
10104
10201
  layoutOrder,
10105
- itemPadding
10202
+ itemPadding,
10203
+ checkboxes
10106
10204
  } = _ref;
10107
10205
  return {
10108
- ["&.".concat(rowColClasses.fieldRoot)]: getGridItemSizes({
10206
+ ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
10109
10207
  dataLayout,
10110
10208
  layoutOrder,
10111
10209
  itemPadding
10210
+ })), {}, {
10211
+ paddingRight: checkboxes ? '8px' : undefined
10112
10212
  })
10113
10213
  };
10114
10214
  });
10115
10215
 
10216
+ function getCellFromPages(_ref) {
10217
+ let {
10218
+ pages,
10219
+ cellIndex
10220
+ } = _ref;
10221
+ let c;
10222
+ const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
10223
+ if (page) {
10224
+ const area = page.qArea;
10225
+ if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
10226
+ [c] = page.qMatrix[cellIndex - area.qTop];
10227
+ }
10228
+ }
10229
+ return c;
10230
+ }
10231
+
10116
10232
  function RowColumn(_ref) {
10117
- var _cell$qText;
10233
+ var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
10118
10234
  let {
10119
10235
  index,
10120
10236
  rowIndex,
@@ -10123,6 +10239,7 @@ function RowColumn(_ref) {
10123
10239
  data
10124
10240
  } = _ref;
10125
10241
  const {
10242
+ onChange,
10126
10243
  onClick,
10127
10244
  onMouseDown,
10128
10245
  onMouseUp,
@@ -10146,7 +10263,8 @@ function RowColumn(_ref) {
10146
10263
  dataOffset,
10147
10264
  focusListItems,
10148
10265
  listCount,
10149
- itemPadding
10266
+ itemPadding,
10267
+ frequencyWidth
10150
10268
  } = data;
10151
10269
  const {
10152
10270
  dense = false,
@@ -10198,44 +10316,21 @@ function RowColumn(_ref) {
10198
10316
  const handleKeyDownCallback = useCallback(getFieldKeyboardNavigation(_objectSpread2(_objectSpread2({}, actions), {}, {
10199
10317
  focusListItems
10200
10318
  })), [actions]);
10201
- const [isSelected, setSelected] = useState$1(false);
10202
- const [cell, setCell] = useState$1();
10203
- const [classArr, setClassArr] = useState$1([]);
10204
- useEffect$1(() => {
10205
- if (!pages) {
10206
- return;
10207
- }
10208
- let c;
10209
- const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
10210
- if (page) {
10211
- const area = page.qArea;
10212
- if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
10213
- [c] = page.qMatrix[cellIndex - area.qTop];
10214
- }
10215
- }
10216
- setCell(c);
10217
- }, [pages]);
10218
- useEffect$1(() => {
10219
- if (!cell) {
10220
- return;
10221
- }
10222
- const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
10223
- setSelected(selected);
10224
- const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
10225
- if (!(histogram && (dense || checkboxes))) clazzArr.push(rowColClasses.rowBorderBottom);
10226
- if (!checkboxes) {
10227
- if (cell.qState === 'XS') {
10228
- clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
10229
- } else if (cell.qState === 'S' || cell.qState === 'L') {
10230
- clazzArr.push(rowColClasses.S);
10231
- } else if (showGray && isAlternative(cell)) {
10232
- clazzArr.push(rowColClasses.A);
10233
- } else if (showGray && isExcluded(cell)) {
10234
- clazzArr.push(rowColClasses.X);
10235
- }
10236
- }
10237
- setClassArr(clazzArr);
10238
- }, [cell && cell.qState, histogram, dense, checkboxes]);
10319
+ const cell = useMemo$1(() => getCellFromPages({
10320
+ pages,
10321
+ cellIndex
10322
+ }), [pages, cellIndex]);
10323
+ 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';
10324
+ const classArr = useMemo$1(() => getValueStateClasses({
10325
+ column,
10326
+ histogram,
10327
+ checkboxes,
10328
+ cell,
10329
+ showGray
10330
+ }), [cell === null || cell === void 0 ? void 0 : cell.qState, histogram, dense, checkboxes]);
10331
+ const preventContextMenu = useCallback(event => {
10332
+ event.preventDefault();
10333
+ }, [checkboxes]);
10239
10334
  if (!cell) {
10240
10335
  return null; // prevent rendering empty rows
10241
10336
  }
@@ -10252,19 +10347,16 @@ function RowColumn(_ref) {
10252
10347
  } else {
10253
10348
  valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
10254
10349
  }
10255
- const preventContextMenu = event => {
10256
- if (checkboxes) {
10257
- // Event will not propagate in the checkbox/radiobutton case
10258
- onClick(event);
10259
- }
10260
- event.preventDefault();
10261
- };
10262
10350
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
10263
10351
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
10264
10352
 
10265
10353
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
10266
- const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
10267
- const labels = getSegmentsFromRanges(label, ranges);
10354
+
10355
+ let labels;
10356
+ if ((_cell$qHighlightRange = cell.qHighlightRanges) !== null && _cell$qHighlightRange !== void 0 && (_cell$qHighlightRange2 = _cell$qHighlightRange.qRanges) !== null && _cell$qHighlightRange2 !== void 0 && _cell$qHighlightRange2.length) {
10357
+ const ranges = cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
10358
+ labels = getSegmentsFromRanges(label, ranges);
10359
+ }
10268
10360
  const iconStyles = {
10269
10361
  alignItems: 'center',
10270
10362
  display: 'flex',
@@ -10277,22 +10369,24 @@ function RowColumn(_ref) {
10277
10369
  alignItems: 'center',
10278
10370
  minWidth: 0,
10279
10371
  flexGrow: 1,
10280
- padding: checkboxes ? 0 : undefined,
10372
+ paddingLeft: checkboxes ? 0 : undefined,
10281
10373
  justifyContent: valueTextAlign
10282
10374
  };
10283
10375
  const isFirstElement = index === 0;
10284
10376
  const flexBasisVal = checkboxes ? 'auto' : 'max-content';
10285
- return /*#__PURE__*/React__default.createElement(RowColRoot, {
10377
+ return /*#__PURE__*/React__default.createElement(RowColRoot$1, {
10286
10378
  className: rowColClasses.barContainer,
10287
10379
  flexBasisProp: flexBasisVal,
10288
10380
  style: styles,
10289
10381
  isGridCol: isGridCol,
10290
10382
  isGridMode: dataLayout === 'grid',
10291
- dense: dense
10383
+ dense: dense,
10384
+ frequencyWidth: frequencyWidth
10292
10385
  }, /*#__PURE__*/React__default.createElement(ItemGrid, {
10293
10386
  ref: rowRef,
10294
10387
  container: true,
10295
10388
  dataLayout: dataLayout,
10389
+ checkboxes: checkboxes,
10296
10390
  layoutOrder: layoutOrder,
10297
10391
  itemPadding: itemPadding,
10298
10392
  gap: 0,
@@ -10308,7 +10402,7 @@ function RowColumn(_ref) {
10308
10402
  onContextMenu: preventContextMenu,
10309
10403
  role: column ? 'column' : 'row',
10310
10404
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
10311
- "data-n": cell && cell.qElemNumber
10405
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
10312
10406
  }, /*#__PURE__*/React__default.createElement(Histogram, {
10313
10407
  cell: cell,
10314
10408
  histogram: histogram,
@@ -10320,18 +10414,8 @@ function RowColumn(_ref) {
10320
10414
  style: cellStyle,
10321
10415
  className: joinClassNames([rowColClasses.cell, rowColClasses.selectedCell]),
10322
10416
  title: "".concat(label)
10323
- }, ranges.length === 0 ? /*#__PURE__*/React__default.createElement(Field, {
10324
- label: label,
10325
- color: "inherit",
10326
- qElemNumber: cell.qElemNumber,
10327
- isSelected: isSelected,
10328
- dense: dense,
10329
- cell: cell,
10330
- isGridCol: isGridCol,
10331
- showGray: showGray,
10332
- isSingleSelect: isSingleSelect,
10333
- checkboxes: checkboxes
10334
- }) : /*#__PURE__*/React__default.createElement(FieldWithRanges, {
10417
+ }, labels ? /*#__PURE__*/React__default.createElement(FieldWithRanges, {
10418
+ onChange: onChange,
10335
10419
  labels: labels,
10336
10420
  checkboxes: checkboxes,
10337
10421
  dense: dense,
@@ -10344,6 +10428,19 @@ function RowColumn(_ref) {
10344
10428
  isGridCol: isGridCol,
10345
10429
  isSingleSelect: isSingleSelect,
10346
10430
  valueTextAlign: valueTextAlign
10431
+ }) : /*#__PURE__*/React__default.createElement(Field$1, {
10432
+ onChange: onChange,
10433
+ label: label,
10434
+ color: "inherit",
10435
+ qElemNumber: cell.qElemNumber,
10436
+ isSelected: isSelected,
10437
+ dense: dense,
10438
+ cell: cell,
10439
+ isGridCol: isGridCol,
10440
+ showGray: showGray,
10441
+ isSingleSelect: isSingleSelect,
10442
+ checkboxes: checkboxes,
10443
+ valueTextAlign: valueTextAlign
10347
10444
  })), freqIsAllowed && /*#__PURE__*/React__default.createElement(Frequency, {
10348
10445
  cell: cell,
10349
10446
  checkboxes: checkboxes,
@@ -10365,21 +10462,6 @@ function RowColumn(_ref) {
10365
10462
  }))));
10366
10463
  }
10367
10464
 
10368
- const FREQUENCY_MIN_SHOW_WIDTH = 80;
10369
- function getFrequencyAllowed(_ref) {
10370
- let {
10371
- width,
10372
- layout,
10373
- frequencyMode
10374
- } = _ref;
10375
- const widthPermitsFreq = width > FREQUENCY_MIN_SHOW_WIDTH;
10376
- const {
10377
- frequencyEnabled = false
10378
- } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
10379
- const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
10380
- return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
10381
- }
10382
-
10383
10465
  function deriveRenderOptions(options) {
10384
10466
  const {
10385
10467
  renderProps,
@@ -11826,8 +11908,9 @@ const classes$9 = {
11826
11908
  styledScrollbars: "".concat(PREFIX$9, "-styledScrollbars")
11827
11909
  };
11828
11910
  function getStyledComponents() {
11829
- const scrollbarStyling = {
11911
+ const getScrollbarStyling = scrollDisabled => ({
11830
11912
  scrollbarColor: "".concat(scrollBarThumb, " ").concat(scrollBarBackground),
11913
+ overflow: scrollDisabled ? 'hidden !important' : undefined,
11831
11914
  '&::-webkit-scrollbar': {
11832
11915
  width: 10,
11833
11916
  height: 10
@@ -11842,42 +11925,27 @@ function getStyledComponents() {
11842
11925
  '&::-webkit-scrollbar-thumb:hover': {
11843
11926
  backgroundColor: scrollBarThumbHover
11844
11927
  }
11845
- };
11846
- const StyledFixedSizeList = styled$3(FixedSizeList)(() => ({
11847
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
11848
- // TODO: Verify these props and make generic together with grid component.
11849
- '&::-webkit-scrollbar': {
11850
- width: 10,
11851
- height: 10
11852
- },
11853
- '&::-webkit-scrollbar-track': {
11854
- backgroundColor: scrollBarBackground
11855
- },
11856
- '&::-webkit-scrollbar-thumb': {
11857
- backgroundColor: scrollBarThumb,
11858
- borderRadius: '1rem'
11859
- },
11860
- '&::-webkit-scrollbar-thumb:hover': {
11861
- backgroundColor: scrollBarThumbHover
11862
- }
11863
- }));
11864
- const StyledFixedSizeGrid = styled$3(FixedSizeGrid)(() => ({
11865
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
11866
- '&::-webkit-scrollbar': {
11867
- width: 10,
11868
- height: 10
11869
- },
11870
- '&::-webkit-scrollbar-track': {
11871
- backgroundColor: scrollBarBackground
11872
- },
11873
- '&::-webkit-scrollbar-thumb': {
11874
- backgroundColor: scrollBarThumb,
11875
- borderRadius: '1rem'
11876
- },
11877
- '&::-webkit-scrollbar-thumb:hover': {
11878
- backgroundColor: scrollBarThumbHover
11879
- }
11880
- }));
11928
+ });
11929
+ const StyledFixedSizeList = styled$3(FixedSizeList, {
11930
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
11931
+ })(_ref => {
11932
+ let {
11933
+ scrollDisabled
11934
+ } = _ref;
11935
+ return {
11936
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
11937
+ };
11938
+ });
11939
+ const StyledFixedSizeGrid = styled$3(FixedSizeGrid, {
11940
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
11941
+ })(_ref2 => {
11942
+ let {
11943
+ scrollDisabled
11944
+ } = _ref2;
11945
+ return {
11946
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
11947
+ };
11948
+ });
11881
11949
  return {
11882
11950
  StyledFixedSizeList,
11883
11951
  StyledFixedSizeGrid
@@ -11943,13 +12011,14 @@ function getListBoxComponents(_ref) {
11943
12011
  showGray,
11944
12012
  scrollState,
11945
12013
  direction,
11946
- listLayout,
11947
12014
  sizes,
11948
12015
  listCount,
11949
12016
  overflowDisclaimer,
11950
12017
  setScrollPosition,
11951
12018
  focusListItems,
11952
- setCurrentScrollIndex
12019
+ setCurrentScrollIndex,
12020
+ constraints,
12021
+ freqIsAllowed
11953
12022
  } = _ref;
11954
12023
  const {
11955
12024
  layoutOptions = {},
@@ -11960,7 +12029,8 @@ function getListBoxComponents(_ref) {
11960
12029
  listHeight,
11961
12030
  itemSize,
11962
12031
  rowCount,
11963
- columnCount
12032
+ columnCount,
12033
+ frequencyWidth
11964
12034
  } = sizes || {};
11965
12035
 
11966
12036
  // Options common for List and Grid.
@@ -11980,14 +12050,11 @@ function getListBoxComponents(_ref) {
11980
12050
  checkboxes,
11981
12051
  layoutOptions,
11982
12052
  frequencyMode,
11983
- freqIsAllowed: getFrequencyAllowed({
11984
- width,
11985
- layout,
11986
- frequencyMode
11987
- }),
12053
+ freqIsAllowed,
11988
12054
  isSingleSelect,
11989
12055
  textAlign,
11990
12056
  itemPadding,
12057
+ frequencyWidth,
11991
12058
  actions: {
11992
12059
  select,
11993
12060
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -12012,10 +12079,10 @@ function getListBoxComponents(_ref) {
12012
12079
  // eslint-disable-next-line react/jsx-props-no-spreading
12013
12080
  , _extends$6({}, commonComponentOptions, {
12014
12081
  dataTestid: "fixed-size-list",
12082
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
12015
12083
  height: listHeight,
12016
12084
  width: width,
12017
12085
  itemCount: listCount,
12018
- layout: listLayout,
12019
12086
  itemData: _objectSpread2(_objectSpread2({}, commonItemData), {}, {
12020
12087
  listCount
12021
12088
  }),
@@ -12090,6 +12157,7 @@ function getListBoxComponents(_ref) {
12090
12157
  // eslint-disable-next-line react/jsx-props-no-spreading
12091
12158
  , _extends$6({}, commonComponentOptions, {
12092
12159
  dataTestid: "fixed-size-grid",
12160
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
12093
12161
  height: gridHeight,
12094
12162
  width: width,
12095
12163
  columnCount: columnCount,
@@ -12114,6 +12182,9 @@ function getListBoxComponents(_ref) {
12114
12182
 
12115
12183
  const scrollBarWidth = 10; // TODO: ignore this - instead set the styling only show on hover...
12116
12184
 
12185
+ const ITEM_MIN_WIDTH = 56;
12186
+ const ITEM_MAX_WIDTH = 150;
12187
+ const FREQUENCY_WIDTH = 40;
12117
12188
  function getListSizes(_ref) {
12118
12189
  let {
12119
12190
  layout,
@@ -12121,7 +12192,8 @@ function getListSizes(_ref) {
12121
12192
  height,
12122
12193
  listCount,
12123
12194
  count,
12124
- textWidth
12195
+ textWidth,
12196
+ freqIsAllowed
12125
12197
  } = _ref;
12126
12198
  const {
12127
12199
  layoutOptions = {}
@@ -12133,7 +12205,8 @@ function getListSizes(_ref) {
12133
12205
  dense,
12134
12206
  dataLayout
12135
12207
  } = layoutOptions;
12136
- const columnAutoWidth = Math.min(150, textWidth + 18);
12208
+ const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
12209
+ const columnAutoWidth = Math.max(Math.min(ITEM_MAX_WIDTH, textWidth + 18 + frequencyAddWidth), ITEM_MIN_WIDTH + frequencyAddWidth);
12137
12210
  let overflowStyling;
12138
12211
  let columnCount;
12139
12212
  let columnWidth;
@@ -12150,18 +12223,21 @@ function getListSizes(_ref) {
12150
12223
  }
12151
12224
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemSize;
12152
12225
  if (layoutOrder) {
12226
+ // Modify container width to achieve the exact design with 8px margins on each side (left and right).
12227
+ let containerWidth = width;
12153
12228
  if (layoutOrder === 'row') {
12229
+ containerWidth += itemPadding * 2;
12154
12230
  overflowStyling = {
12155
12231
  overflowX: 'hidden'
12156
12232
  };
12157
12233
  const maxColumns = (maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.maxColumns) || 3;
12158
12234
  if ((maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.auto) !== false) {
12159
- columnCount = Math.min(listCount, Math.ceil((width - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
12235
+ columnCount = Math.min(listCount, Math.ceil((containerWidth - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
12160
12236
  } else {
12161
12237
  columnCount = Math.min(listCount, maxColumns);
12162
12238
  }
12163
12239
  rowCount = Math.ceil(listCount / columnCount);
12164
- columnWidth = (width - scrollBarWidth) / columnCount;
12240
+ columnWidth = (containerWidth - scrollBarWidth) / columnCount;
12165
12241
  } else {
12166
12242
  overflowStyling = {
12167
12243
  overflowY: 'hidden'
@@ -12173,7 +12249,7 @@ function getListSizes(_ref) {
12173
12249
  rowCount = Math.min(listCount, maxRows);
12174
12250
  }
12175
12251
  columnCount = Math.ceil(listCount / rowCount);
12176
- columnWidth = Math.max(columnAutoWidth, width / columnCount);
12252
+ columnWidth = Math.max(columnAutoWidth, containerWidth / columnCount);
12177
12253
  }
12178
12254
  }
12179
12255
  columnCount = (dataLayout === 'singleColumn' ? 1 : columnCount) || 1;
@@ -12199,7 +12275,8 @@ function getListSizes(_ref) {
12199
12275
  row: maxRowCount,
12200
12276
  column: maxColumnCount
12201
12277
  },
12202
- itemPadding
12278
+ itemPadding,
12279
+ frequencyWidth: FREQUENCY_WIDTH
12203
12280
  };
12204
12281
  }
12205
12282
 
@@ -12695,19 +12772,35 @@ function getScrollIndex(_ref) {
12695
12772
  };
12696
12773
  }
12697
12774
 
12775
+ const FREQUENCY_MIN_SHOW_WIDTH = 80;
12776
+ function getFrequencyAllowed(_ref) {
12777
+ let {
12778
+ itemWidth,
12779
+ layout,
12780
+ frequencyMode
12781
+ } = _ref;
12782
+ const widthPermitsFreq = itemWidth > FREQUENCY_MIN_SHOW_WIDTH;
12783
+ const {
12784
+ frequencyEnabled = false
12785
+ } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
12786
+ const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
12787
+ return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
12788
+ }
12789
+
12698
12790
  const _excluded$4 = ["isLoadingData"];
12699
12791
  const DEFAULT_MIN_BATCH_SIZE = 100;
12700
12792
  function ListBox(_ref) {
12701
12793
  var _layout$qListObject$q, _loaderRef$current, _loaderRef$current$_l, _loaderRef$current$_l2;
12702
12794
  let {
12703
12795
  model,
12796
+ constraints,
12704
12797
  layout,
12705
12798
  selections,
12799
+ selectionState,
12706
12800
  direction,
12707
12801
  checkboxes: checkboxOption,
12708
12802
  height,
12709
12803
  width,
12710
- listLayout = 'vertical',
12711
12804
  frequencyMode,
12712
12805
  update = undefined,
12713
12806
  fetchStart = undefined,
@@ -12752,11 +12845,7 @@ function ListBox(_ref) {
12752
12845
  postProcessPages,
12753
12846
  listData
12754
12847
  }),
12755
- {
12756
- isLoadingData
12757
- } = _useItemsLoader,
12758
12848
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
12759
- const [pages, setPages] = useState$1([]);
12760
12849
  const {
12761
12850
  setStoreValue
12762
12851
  } = useDataStore(model);
@@ -12768,9 +12857,16 @@ function ListBox(_ref) {
12768
12857
  const showOverflowDisclaimer = show => setOverflowDisclaimer(state => _objectSpread2(_objectSpread2({}, state), {}, {
12769
12858
  show
12770
12859
  }));
12771
- useEffect$1(() => {
12772
- setPages((itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages) || []);
12773
- }, [itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages]);
12860
+ const [pages, setPages] = useState$1([]);
12861
+ if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
12862
+ selectionState.update({
12863
+ setPages,
12864
+ pages: itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages,
12865
+ isSingleSelect,
12866
+ selectDisabled,
12867
+ layout
12868
+ });
12869
+ }
12774
12870
  const isItemLoaded = useCallback(index => {
12775
12871
  if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
12776
12872
  return false;
@@ -12781,17 +12877,13 @@ function ListBox(_ref) {
12781
12877
  return page && isLoaded(page);
12782
12878
  }, [layout, pages]);
12783
12879
  const {
12784
- instantPages = [],
12785
12880
  interactionEvents,
12786
12881
  select
12787
12882
  } = useSelectionsInteractions({
12788
- layout,
12883
+ selectionState,
12789
12884
  selections,
12790
- pages,
12791
12885
  checkboxes,
12792
- selectDisabled,
12793
- doc: document,
12794
- isSingleSelect
12886
+ doc: document
12795
12887
  });
12796
12888
  const {
12797
12889
  layoutOptions = {}
@@ -12831,12 +12923,6 @@ function ListBox(_ref) {
12831
12923
  // Hand over the update function for manual refresh from hosting application.
12832
12924
  update.call(null, fetchData);
12833
12925
  }
12834
- useEffect$1(() => {
12835
- if (!instantPages || isLoadingData) {
12836
- return;
12837
- }
12838
- setPages(instantPages);
12839
- }, [instantPages]);
12840
12926
  useEffect$1(() => {
12841
12927
  if (scrollState && !initScrollPosIsSet && loaderRef.current) {
12842
12928
  loaderRef.current._listRef.scrollToItem(scrollState.initScrollPos);
@@ -12851,7 +12937,7 @@ function ListBox(_ref) {
12851
12937
  font: '14px Source sans pro'
12852
12938
  });
12853
12939
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
12854
- const isVertical = layoutOptions.dataLayout ? layoutOptions.dataLayout === 'singleColumn' : listLayout !== 'horizontal';
12940
+ const isVertical = layoutOptions.dataLayout !== 'grid';
12855
12941
  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;
12856
12942
  const unlimitedListCount = getListCount({
12857
12943
  pages,
@@ -12861,14 +12947,28 @@ function ListBox(_ref) {
12861
12947
  layoutOptions,
12862
12948
  model
12863
12949
  });
12950
+ let freqIsAllowed = getFrequencyAllowed({
12951
+ itemWidth: width,
12952
+ layout,
12953
+ frequencyMode
12954
+ });
12864
12955
  const sizes = getListSizes({
12865
12956
  layout,
12866
12957
  width,
12867
12958
  height,
12868
12959
  listCount: unlimitedListCount,
12869
12960
  count,
12870
- textWidth
12961
+ textWidth,
12962
+ freqIsAllowed
12871
12963
  });
12964
+ if (sizes.columnWidth) {
12965
+ // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
12966
+ freqIsAllowed = getFrequencyAllowed({
12967
+ itemWidth: sizes.columnWidth,
12968
+ layout,
12969
+ frequencyMode
12970
+ });
12971
+ }
12872
12972
  const {
12873
12973
  listCount
12874
12974
  } = sizes;
@@ -12887,7 +12987,7 @@ function ListBox(_ref) {
12887
12987
  });
12888
12988
  local.current.dataOffset = offset;
12889
12989
  if (triggerRerender) {
12890
- setPages(currentPages => [...currentPages]);
12990
+ selectionState.triggerStateChanged();
12891
12991
  }
12892
12992
  scrollToIndex(scrollIndex);
12893
12993
  };
@@ -12954,7 +13054,9 @@ function ListBox(_ref) {
12954
13054
  },
12955
13055
  setScrollPosition,
12956
13056
  focusListItems: getFocusState(),
12957
- setCurrentScrollIndex: currentScrollIndex.set
13057
+ setCurrentScrollIndex: currentScrollIndex.set,
13058
+ constraints,
13059
+ freqIsAllowed
12958
13060
  });
12959
13061
  const {
12960
13062
  columnWidth,
@@ -13032,7 +13134,8 @@ var createListboxSelectionToolbar = (_ref => {
13032
13134
  let {
13033
13135
  layout,
13034
13136
  model,
13035
- translator
13137
+ translator,
13138
+ selectionState
13036
13139
  } = _ref;
13037
13140
  if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
13038
13141
  return [];
@@ -13048,6 +13151,7 @@ var createListboxSelectionToolbar = (_ref => {
13048
13151
  getSvgIconShape: selectAll,
13049
13152
  enabled: canSelectAll,
13050
13153
  action: () => {
13154
+ selectionState.clearItemStates(false);
13051
13155
  model.selectListObjectAll('/qListObjectDef');
13052
13156
  }
13053
13157
  }, {
@@ -13057,6 +13161,7 @@ var createListboxSelectionToolbar = (_ref => {
13057
13161
  getSvgIconShape: selectPossible,
13058
13162
  enabled: canSelectPossible,
13059
13163
  action: () => {
13164
+ selectionState.clearItemStates(false);
13060
13165
  model.selectListObjectPossible('/qListObjectDef');
13061
13166
  }
13062
13167
  }, {
@@ -13066,6 +13171,7 @@ var createListboxSelectionToolbar = (_ref => {
13066
13171
  getSvgIconShape: selectAlternative,
13067
13172
  enabled: canSelectAlternative,
13068
13173
  action: () => {
13174
+ selectionState.clearItemStates(false);
13069
13175
  model.selectListObjectAlternative('/qListObjectDef');
13070
13176
  }
13071
13177
  }, {
@@ -13075,6 +13181,7 @@ var createListboxSelectionToolbar = (_ref => {
13075
13181
  getSvgIconShape: selectExcluded,
13076
13182
  enabled: canSelectExcluded,
13077
13183
  action: () => {
13184
+ selectionState.clearItemStates(false);
13078
13185
  model.selectListObjectExcluded('/qListObjectDef');
13079
13186
  }
13080
13187
  }];
@@ -13137,6 +13244,7 @@ const Item = React__default.forwardRef((_ref, ref) => {
13137
13244
  style: style,
13138
13245
  className: ActionElement.className,
13139
13246
  size: "large",
13247
+ disableRipple: true,
13140
13248
  "aria-expanded": ariaExpanded,
13141
13249
  "aria-controls": "moreMenuList"
13142
13250
  }, hasSvgIconShape && SvgIcon$2(item.getSvgIconShape()), addAnchor && /*#__PURE__*/React__default.createElement("div", {
@@ -13544,7 +13652,7 @@ function ActionsToolbar(_ref3) {
13544
13652
  className: ActionToolbarElement.className,
13545
13653
  style: {
13546
13654
  pointerEvents: 'auto',
13547
- padding: theme.spacing(1, 1)
13655
+ padding: theme.spacing(0.8)
13548
13656
  }
13549
13657
  }
13550
13658
  }, Actions) : show && Actions;
@@ -13583,6 +13691,7 @@ const StyledOutlinedInput = styled$1(OutlinedInput)(_ref2 => {
13583
13691
  function ListBoxSearch(_ref3) {
13584
13692
  let {
13585
13693
  selections,
13694
+ selectionState,
13586
13695
  model,
13587
13696
  keyboard,
13588
13697
  dense = false,
@@ -13657,6 +13766,7 @@ function ListBoxSearch(_ref3) {
13657
13766
  response = model.acceptListObjectSearch(TREE_PATH, true);
13658
13767
  // eslint-disable-next-line no-param-reassign
13659
13768
  selections.selectionsMade = true;
13769
+ selectionState.clearItemStates(false);
13660
13770
  setValue('');
13661
13771
  }
13662
13772
  return response;
@@ -13696,7 +13806,8 @@ function ListBoxSearch(_ref3) {
13696
13806
  },
13697
13807
  '&:hover': {
13698
13808
  border: 'none'
13699
- }
13809
+ },
13810
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px")
13700
13811
  }, dense && {
13701
13812
  fontSize: 12,
13702
13813
  paddingLeft: theme.spacing(1),
@@ -13970,6 +14081,125 @@ function useObjectSelections(app, model, elements, options) {
13970
14081
  return [objectSelections];
13971
14082
  }
13972
14083
 
14084
+ function selectionState() {
14085
+ const state = {
14086
+ itemStates: {},
14087
+ ignoreSelectionState: false,
14088
+ selectedInEngine: [],
14089
+ enginePages: [],
14090
+ setPages: undefined,
14091
+ lastRowCount: undefined,
14092
+ lastApprMaxGlyphCount: undefined,
14093
+ update(_ref) {
14094
+ var _layout$qListObject$q, _layout$qListObject, _layout$qListObject$q2;
14095
+ let {
14096
+ setPages,
14097
+ pages,
14098
+ isSingleSelect,
14099
+ selectDisabled,
14100
+ layout
14101
+ } = _ref;
14102
+ this.setPages = setPages;
14103
+ const isSameRowCount = this.lastRowCount === layout.qListObject.qSize.qcy;
14104
+ const isSameMaxGlyphCnt = this.lastApprMaxGlyphCount === layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
14105
+ if (!isSameRowCount || !isSameMaxGlyphCnt) {
14106
+ this.lastRowCount = layout.qListObject.qSize.qcy;
14107
+ this.lastApprMaxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
14108
+
14109
+ // The field have probably changed (drill up/down)
14110
+ // need to clear the client side item states since the field values have changed
14111
+ this.clearItemStates(false);
14112
+ }
14113
+ if (state.enginePages !== pages && pages !== undefined) {
14114
+ state.enginePages = pages !== null && pages !== void 0 ? pages : [];
14115
+ state.selectedInEngine = getSelectedValues(pages);
14116
+ state.selectableValuesUpdating = false;
14117
+ state.triggerStateChanged();
14118
+ }
14119
+ state.isSingleSelect = isSingleSelect;
14120
+ state.selectDisabled = selectDisabled;
14121
+ 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;
14122
+ },
14123
+ allowedToSelect() {
14124
+ if (state.selectDisabled()) {
14125
+ return false;
14126
+ }
14127
+ // When a dim is calculated, the rows must be done updating after previeous selection
14128
+ return !(state.isDimCalculated && state.selectableValuesUpdating);
14129
+ },
14130
+ setSelectableValuesUpdating() {
14131
+ state.selectableValuesUpdating = true;
14132
+ },
14133
+ useClientItemState(elementNumber) {
14134
+ return state.ignoreSelectionState || elementNumber in state.itemStates;
14135
+ },
14136
+ isSelected(elementNumber) {
14137
+ if (state.useClientItemState(elementNumber)) {
14138
+ return !!state.itemStates[elementNumber];
14139
+ }
14140
+ return state.selectedInEngine.includes(elementNumber);
14141
+ },
14142
+ getState(item) {
14143
+ const {
14144
+ qElemNumber,
14145
+ qState
14146
+ } = item;
14147
+ if (!state.useClientItemState(qElemNumber)) {
14148
+ return qState;
14149
+ }
14150
+ if (state.itemStates[qElemNumber]) {
14151
+ return qState === 'XS' ? 'XS' : 'S';
14152
+ }
14153
+ return qState === 'S' || qState === 'XS' ? 'A' : qState;
14154
+ },
14155
+ updateItemNoEvents(elementNumber, additive, selectedValues) {
14156
+ const selected = state.isSelected(elementNumber);
14157
+ if (selected && !additive) {
14158
+ state.itemStates[elementNumber] = false;
14159
+ } else if (!selected) {
14160
+ selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.push(elementNumber);
14161
+ state.itemStates[elementNumber] = true;
14162
+ }
14163
+ },
14164
+ triggerStateChanged() {
14165
+ if (this.setPages) {
14166
+ const pages = state.applySelectionsOnPages(state.enginePages);
14167
+ this.setPages(pages);
14168
+ }
14169
+ },
14170
+ applySelectionsOnPages(pages) {
14171
+ const matrices = pages.map(page => {
14172
+ const qMatrix = page.qMatrix.map(p => {
14173
+ const [p0] = p;
14174
+ const qState = state.getState(p0);
14175
+ return [_objectSpread2(_objectSpread2({}, p0), {}, {
14176
+ qState
14177
+ }), ...p.slice(1)];
14178
+ });
14179
+ return _objectSpread2(_objectSpread2({}, page), {}, {
14180
+ qMatrix
14181
+ });
14182
+ });
14183
+ return matrices;
14184
+ },
14185
+ updateItem(elementNumber, additive, selectedValues) {
14186
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
14187
+ state.triggerStateChanged();
14188
+ },
14189
+ updateItems(elementNumbers, additive, selectedValues) {
14190
+ elementNumbers.forEach(elementNumber => {
14191
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
14192
+ });
14193
+ state.triggerStateChanged();
14194
+ },
14195
+ clearItemStates(ignoreSelectionState) {
14196
+ state.itemStates = {};
14197
+ state.ignoreSelectionState = ignoreSelectionState;
14198
+ }
14199
+ };
14200
+ return state;
14201
+ }
14202
+
13973
14203
  const getValue$1 = function (obj, prop) {
13974
14204
  var _obj$prop;
13975
14205
  let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
@@ -14041,6 +14271,7 @@ function ListBoxPopover(_ref) {
14041
14271
  const containerRef = useRef();
14042
14272
  const [selections] = useObjectSelections(app, model, containerRef);
14043
14273
  const [layout] = useLayout$1(model);
14274
+ const [selectionState$1] = useState$1(() => selectionState());
14044
14275
  useEffect$1(() => {
14045
14276
  if (selections && open) {
14046
14277
  if (!selections.isModal(model)) {
@@ -14060,7 +14291,8 @@ function ListBoxPopover(_ref) {
14060
14291
  const listboxSelectionToolbarItems = createListboxSelectionToolbar({
14061
14292
  layout,
14062
14293
  model,
14063
- translator
14294
+ translator,
14295
+ selectionState: selectionState$1
14064
14296
  });
14065
14297
  const hasSelections$1 = hasSelections(layout);
14066
14298
  return /*#__PURE__*/React__default.createElement(Popover, {
@@ -14133,6 +14365,7 @@ function ListBoxPopover(_ref) {
14133
14365
  model: model,
14134
14366
  listCount: listCount,
14135
14367
  selections: selections,
14368
+ selectionState: selectionState$1,
14136
14369
  keyboard: {
14137
14370
  enabled: false
14138
14371
  },
@@ -14141,6 +14374,7 @@ function ListBoxPopover(_ref) {
14141
14374
  model: model,
14142
14375
  layout: layout,
14143
14376
  selections: selections,
14377
+ selectionState: selectionState$1,
14144
14378
  direction: "ltr",
14145
14379
  onSetListCount: c => setListCount(c)
14146
14380
  }))));
@@ -15400,6 +15634,16 @@ AutoSizer.defaultProps = {
15400
15634
  style: {}
15401
15635
  };
15402
15636
 
15637
+ const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
15638
+ shapes: [{
15639
+ type: 'path',
15640
+ attrs: {
15641
+ 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'
15642
+ }
15643
+ }]
15644
+ });
15645
+ var DrillDownIcon = (props => SvgIcon$2(drillDown(props)));
15646
+
15403
15647
  const addListboxTheme = themeApi => {
15404
15648
  const getListboxStyle = prop => themeApi.getStyle('object', '', "listBox.".concat(prop));
15405
15649
  return {
@@ -15419,29 +15663,86 @@ const addListboxTheme = themeApi => {
15419
15663
  };
15420
15664
  };
15421
15665
 
15666
+ function showToolbarDetached(_ref) {
15667
+ var _containerRef$current, _containerRef$current2, _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
15668
+ let {
15669
+ containerRef,
15670
+ titleRef,
15671
+ iconsWidth
15672
+ } = _ref;
15673
+ 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;
15674
+ const padding = 16;
15675
+ 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;
15676
+ const actionToolbarWidth = 128;
15677
+ const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
15678
+ 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);
15679
+ return !!(notSufficientSpace | isTruncated);
15680
+ }
15681
+
15682
+ function getListboxActionProps(_ref) {
15683
+ let {
15684
+ isPopover,
15685
+ showToolbar,
15686
+ containerRef,
15687
+ isLocked,
15688
+ listboxSelectionToolbarItems,
15689
+ selections
15690
+ } = _ref;
15691
+ return {
15692
+ show: showToolbar && !isPopover,
15693
+ popover: {
15694
+ show: showToolbar && isPopover,
15695
+ anchorEl: containerRef.current
15696
+ },
15697
+ more: {
15698
+ enabled: !isLocked,
15699
+ actions: listboxSelectionToolbarItems,
15700
+ popoverProps: {
15701
+ elevation: 0
15702
+ },
15703
+ popoverPaperStyle: {
15704
+ boxShadow: '0 12px 8px -8px rgba(0, 0, 0, 0.2)',
15705
+ minWidth: '250px'
15706
+ }
15707
+ },
15708
+ selections: {
15709
+ show: showToolbar,
15710
+ api: selections,
15711
+ onConfirm: () => {},
15712
+ onCancel: () => {}
15713
+ }
15714
+ };
15715
+ }
15716
+
15422
15717
  const PREFIX$4 = 'ListBoxInline';
15423
- const searchIconWidth = 28;
15424
15718
  const classes$4 = {
15425
15719
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
15426
- screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
15720
+ screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly"),
15721
+ listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
15427
15722
  };
15428
- const StyledGrid$3 = styled$1(Grid)(_ref => {
15723
+ const StyledGrid$3 = styled$1(Grid, {
15724
+ shouldForwardProp: p => !['containerPadding'].includes(p)
15725
+ })(_ref => {
15429
15726
  var _theme$listBox$backgr, _theme$listBox;
15430
15727
  let {
15431
- theme
15728
+ theme,
15729
+ containerPadding
15432
15730
  } = _ref;
15433
15731
  return {
15434
15732
  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,
15435
15733
  ["& .".concat(classes$4.listBoxHeader)]: {
15436
15734
  alignSelf: 'center',
15437
15735
  display: 'inline-flex',
15438
- width: "calc(100% - ".concat(searchIconWidth, "px)")
15736
+ width: "calc(100% - ".concat(BUTTON_ICON_WIDTH, "px)")
15439
15737
  },
15440
15738
  ["& .".concat(classes$4.screenReaderOnly)]: {
15441
15739
  position: 'absolute',
15442
15740
  height: 0,
15443
15741
  width: 0,
15444
15742
  overflow: 'hidden'
15743
+ },
15744
+ ["& .".concat(classes$4.listboxWrapper)]: {
15745
+ padding: containerPadding
15445
15746
  }
15446
15747
  };
15447
15748
  });
@@ -15457,7 +15758,7 @@ const Title = styled$1(Typography)(_ref2 => {
15457
15758
  };
15458
15759
  });
15459
15760
  function ListBoxInline(_ref3) {
15460
- var _layout$layoutOptions, _layout$layoutOptions2;
15761
+ var _layoutOptions$dense;
15461
15762
  let {
15462
15763
  options,
15463
15764
  layout
@@ -15466,7 +15767,6 @@ function ListBoxInline(_ref3) {
15466
15767
  app,
15467
15768
  direction,
15468
15769
  frequencyMode,
15469
- listLayout,
15470
15770
  checkboxes,
15471
15771
  search = true,
15472
15772
  focusSearch = false,
@@ -15507,7 +15807,6 @@ function ListBoxInline(_ref3) {
15507
15807
  constraints
15508
15808
  } = useContext(InstanceContext);
15509
15809
  theme.listBox = addListboxTheme(themeApi);
15510
- const moreAlignTo = useRef();
15511
15810
  const containerRef = useRef();
15512
15811
  const [searchContainer, searchContainerRef] = useRefWithCallback();
15513
15812
  const [showToolbar, setShowToolbar] = useState$1(false);
@@ -15525,6 +15824,8 @@ function ListBoxInline(_ref3) {
15525
15824
  stop: 0
15526
15825
  });
15527
15826
  const [appSelections] = useAppSelections(app);
15827
+ const titleRef = useRef(null);
15828
+ const [selectionState$1] = useState$1(() => selectionState());
15528
15829
  const {
15529
15830
  handleKeyDown,
15530
15831
  handleOnMouseEnter,
@@ -15550,6 +15851,7 @@ function ListBoxInline(_ref3) {
15550
15851
  if ((layout === null || layout === void 0 ? void 0 : layout.toolbar) !== undefined) {
15551
15852
  toolbar = layout.toolbar;
15552
15853
  }
15854
+ const toolbarDetachedOnly = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) === '';
15553
15855
  toolbar = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '';
15554
15856
  useEffect$1(() => {
15555
15857
  const show = () => {
@@ -15566,15 +15868,15 @@ function ListBoxInline(_ref3) {
15566
15868
  };
15567
15869
  if (selections) {
15568
15870
  if (!selections.isModal()) {
15569
- selections.on('deactivated', hide);
15570
15871
  selections.on('activated', show);
15872
+ selections.on('deactivated', hide);
15571
15873
  }
15572
15874
  setShowToolbar(selections.isActive());
15573
15875
  }
15574
15876
  return () => {
15575
15877
  if (selections && selections.removeListener) {
15576
- selections.removeListener('deactivated', show);
15577
- selections.removeListener('activated', hide);
15878
+ selections.removeListener('activated', show);
15879
+ selections.removeListener('deactivated', hide);
15578
15880
  }
15579
15881
  };
15580
15882
  }, [selections, toolbar]);
@@ -15592,17 +15894,23 @@ function ListBoxInline(_ref3) {
15592
15894
  return null;
15593
15895
  }
15594
15896
  const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
15595
- const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
15897
+ const isDrillDown = layout.qListObject.qDimensionInfo.qGrouping === 'H';
15898
+ const listboxSelectionToolbarItems = createListboxSelectionToolbar({
15596
15899
  layout,
15597
15900
  model,
15598
- translator
15599
- }) : [];
15901
+ translator,
15902
+ selectionState: selectionState$1
15903
+ });
15600
15904
  const showSearchToggle = search === 'toggle' && showSearch;
15601
15905
  const searchVisible = (search === true || showSearchToggle) && !selectDisabled();
15602
- 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;
15906
+ const {
15907
+ layoutOptions = {}
15908
+ } = layout;
15909
+ const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
15603
15910
  const searchHeight = dense ? 27 : 40;
15604
15911
  const extraheight = dense ? 39 : 49;
15605
15912
  const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
15913
+ const headerHeight = 32;
15606
15914
  const {
15607
15915
  wildCardSearch,
15608
15916
  searchEnabled
@@ -15611,13 +15919,34 @@ function ListBoxInline(_ref3) {
15611
15919
  const newValue = !showSearch;
15612
15920
  setShowSearch(newValue);
15613
15921
  };
15922
+ const getActionToolbarProps = isPopover => getListboxActionProps({
15923
+ isPopover,
15924
+ showToolbar,
15925
+ containerRef,
15926
+ isLocked,
15927
+ listboxSelectionToolbarItems,
15928
+ selections
15929
+ });
15614
15930
  const shouldAutoFocus = searchVisible && search === 'toggle';
15615
- return /*#__PURE__*/React__default.createElement(StyledGrid$3, {
15931
+ const showSearchIcon = searchEnabled !== false && search === 'toggle' && !(constraints !== null && constraints !== void 0 && constraints.active);
15932
+ const showSearchOrLockIcon = isLocked || showSearchIcon;
15933
+ const showIcons = showSearchOrLockIcon || isDrillDown;
15934
+ 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
15935
+ const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
15936
+
15937
+ // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
15938
+ const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
15939
+ let containerPadding;
15940
+ if (isGridMode) {
15941
+ containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
15942
+ }
15943
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, toolbarDetachedOnly && /*#__PURE__*/React__default.createElement(ActionsToolbar, getActionToolbarProps(true)), /*#__PURE__*/React__default.createElement(StyledGrid$3, {
15616
15944
  className: "listbox-container",
15617
15945
  container: true,
15618
15946
  tabIndex: keyboard.enabled && !keyboard.active ? 0 : -1,
15619
15947
  direction: "column",
15620
15948
  gap: 0,
15949
+ containerPadding: containerPadding,
15621
15950
  style: {
15622
15951
  height: '100%',
15623
15952
  minHeight: "".concat(minHeight, "px"),
@@ -15631,70 +15960,69 @@ function ListBoxInline(_ref3) {
15631
15960
  item: true,
15632
15961
  container: true,
15633
15962
  style: {
15634
- padding: theme.spacing(1)
15963
+ padding: theme.spacing(1),
15964
+ paddingLeft: "".concat(headerPaddingLeft, "px")
15635
15965
  },
15636
15966
  wrap: "nowrap"
15637
15967
  }, /*#__PURE__*/React__default.createElement(Grid, {
15638
15968
  item: true,
15639
15969
  container: true,
15970
+ height: headerHeight,
15640
15971
  wrap: "nowrap"
15641
- }, /*#__PURE__*/React__default.createElement(Grid, {
15972
+ }, showIcons && /*#__PURE__*/React__default.createElement(Grid, {
15642
15973
  item: true,
15643
15974
  sx: {
15644
15975
  display: 'flex',
15645
15976
  alignItems: 'center',
15646
- width: searchIconWidth
15977
+ width: iconsWidth
15647
15978
  }
15648
15979
  }, isLocked ? /*#__PURE__*/React__default.createElement(IconButton, {
15649
15980
  tabIndex: -1,
15650
15981
  onClick: unlock,
15651
- disabled: !isLocked,
15982
+ disabled: selectDisabled(),
15652
15983
  size: "large"
15653
15984
  }, /*#__PURE__*/React__default.createElement(Lock, {
15654
15985
  title: translator.get('Listbox.Unlock'),
15986
+ disableRipple: true,
15655
15987
  style: {
15656
15988
  fontSize: '12px'
15657
15989
  }
15658
- })) : searchEnabled !== false && /*#__PURE__*/React__default.createElement(IconButton, {
15990
+ })) : showSearchIcon && /*#__PURE__*/React__default.createElement(IconButton, {
15659
15991
  onClick: onShowSearch,
15660
15992
  tabIndex: -1,
15661
15993
  title: translator.get('Listbox.Search'),
15662
- size: "large"
15994
+ size: "large",
15995
+ disableRipple: true,
15996
+ "data-testid": "search-toggle-btn"
15663
15997
  }, /*#__PURE__*/React__default.createElement(SearchIcon, {
15664
15998
  style: {
15665
15999
  fontSize: '12px'
15666
16000
  }
15667
- }))), /*#__PURE__*/React__default.createElement(Grid, {
16001
+ })), isDrillDown && /*#__PURE__*/React__default.createElement(DrillDownIcon, {
16002
+ tabIndex: -1,
16003
+ title: translator.get('Listbox.DrillDown'),
16004
+ size: "large",
16005
+ style: {
16006
+ fontSize: '12px'
16007
+ }
16008
+ })), /*#__PURE__*/React__default.createElement(Grid, {
15668
16009
  item: true,
15669
16010
  className: classes$4.listBoxHeader
15670
16011
  }, /*#__PURE__*/React__default.createElement(Title, {
15671
16012
  variant: "h6",
15672
- noWrap: true
16013
+ noWrap: true,
16014
+ ref: titleRef,
16015
+ title: layout.title
15673
16016
  }, layout.title))), /*#__PURE__*/React__default.createElement(Grid, {
15674
16017
  item: true,
15675
16018
  xs: true
15676
16019
  }), /*#__PURE__*/React__default.createElement(Grid, {
15677
16020
  item: true
15678
- }, /*#__PURE__*/React__default.createElement(ActionsToolbar, {
15679
- more: {
15680
- enabled: !isLocked,
15681
- actions: listboxSelectionToolbarItems,
15682
- alignTo: moreAlignTo,
15683
- popoverProps: {
15684
- elevation: 0
15685
- },
15686
- popoverPaperStyle: {
15687
- boxShadow: '0 12px 8px -8px rgba(0, 0, 0, 0.2)',
15688
- minWidth: '250px'
15689
- }
15690
- },
15691
- selections: {
15692
- show: showToolbar,
15693
- api: selections,
15694
- onConfirm: () => {},
15695
- onCancel: () => {}
15696
- }
15697
- }))), /*#__PURE__*/React__default.createElement(Grid, {
16021
+ }, /*#__PURE__*/React__default.createElement(ActionsToolbar, getActionToolbarProps(showToolbarDetached({
16022
+ containerRef,
16023
+ titleRef,
16024
+ iconsWidth
16025
+ }))))), /*#__PURE__*/React__default.createElement(Grid, {
15698
16026
  item: true,
15699
16027
  container: true,
15700
16028
  direction: "column",
@@ -15704,15 +16032,14 @@ function ListBoxInline(_ref3) {
15704
16032
  },
15705
16033
  role: "region",
15706
16034
  "aria-label": translator.get('Listbox.ResultFilterLabel')
15707
- }, /*#__PURE__*/React__default.createElement("div", {
15708
- ref: moreAlignTo
15709
- }), /*#__PURE__*/React__default.createElement(Grid, {
16035
+ }, /*#__PURE__*/React__default.createElement(Grid, {
15710
16036
  item: true,
15711
16037
  ref: searchContainerRef
15712
16038
  }, /*#__PURE__*/React__default.createElement("div", {
15713
16039
  className: classes$4.screenReaderOnly
15714
16040
  }, translator.get('Listbox.Search.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
15715
16041
  selections: selections,
16042
+ selectionState: selectionState$1,
15716
16043
  model: model,
15717
16044
  dense: dense,
15718
16045
  keyboard: keyboard,
@@ -15724,7 +16051,8 @@ function ListBoxInline(_ref3) {
15724
16051
  searchEnabled: searchEnabled
15725
16052
  })), /*#__PURE__*/React__default.createElement(Grid, {
15726
16053
  item: true,
15727
- xs: true
16054
+ xs: true,
16055
+ className: classes$4.listboxWrapper
15728
16056
  }, /*#__PURE__*/React__default.createElement("div", {
15729
16057
  className: classes$4.screenReaderOnly
15730
16058
  }, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
@@ -15734,10 +16062,11 @@ function ListBoxInline(_ref3) {
15734
16062
  } = _ref4;
15735
16063
  return /*#__PURE__*/React__default.createElement(ListBox, {
15736
16064
  model: model,
16065
+ constraints: constraints,
15737
16066
  layout: layout,
15738
16067
  selections: selections,
16068
+ selectionState: selectionState$1,
15739
16069
  direction: direction,
15740
- listLayout: listLayout,
15741
16070
  frequencyMode: frequencyMode,
15742
16071
  rangeSelect: rangeSelect,
15743
16072
  checkboxes: checkboxes,
@@ -15764,7 +16093,7 @@ function ListBoxInline(_ref3) {
15764
16093
  set: setCurrentScrollIndex
15765
16094
  }
15766
16095
  });
15767
- }))));
16096
+ })))));
15768
16097
  }
15769
16098
  const ListBoxInlineMemoed = React__default.memo(ListBoxInline);
15770
16099
  function IsolateUseLayoutWrapper(_ref5) {
@@ -15806,6 +16135,9 @@ function useExistingModel(_ref) {
15806
16135
  } else {
15807
16136
  const m = await app.getObject(qId);
15808
16137
  modelStore.set(m.id, m);
16138
+ m.once('closed', () => {
16139
+ modelStore.clear(m.id);
16140
+ });
15809
16141
  setModel(m);
15810
16142
  }
15811
16143
  }
@@ -15859,6 +16191,7 @@ function useOnTheFlyModel(_ref) {
15859
16191
  const {
15860
16192
  dense,
15861
16193
  checkboxes,
16194
+ listLayout,
15862
16195
  properties = {}
15863
16196
  } = options;
15864
16197
  let {
@@ -15887,6 +16220,20 @@ function useOnTheFlyModel(_ref) {
15887
16220
  break;
15888
16221
  }
15889
16222
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
16223
+ const layoutOptions = {
16224
+ dense
16225
+ };
16226
+ if (listLayout === 'horizontal') {
16227
+ layoutOptions.dataLayout = 'grid';
16228
+ layoutOptions.layoutOrder = 'column';
16229
+ layoutOptions.maxVisibleColumns = {
16230
+ auto: true
16231
+ };
16232
+ layoutOptions.maxVisibleRows = {
16233
+ auto: false,
16234
+ maxRows: 1
16235
+ };
16236
+ }
15890
16237
  const id = useRef();
15891
16238
  if (!id.current) {
15892
16239
  id.current = uid();
@@ -15899,6 +16246,7 @@ function useOnTheFlyModel(_ref) {
15899
16246
  qListObjectDef: {
15900
16247
  qStateName: stateName,
15901
16248
  qShowAlternatives: true,
16249
+ frequencyEnabled: false,
15902
16250
  qFrequencyMode: getListdefFrequencyMode(),
15903
16251
  qInitialDataFetch: [{
15904
16252
  qTop: 0,
@@ -15917,9 +16265,7 @@ function useOnTheFlyModel(_ref) {
15917
16265
  },
15918
16266
  histogram,
15919
16267
  checkboxes,
15920
- layoutOptions: {
15921
- dense
15922
- },
16268
+ layoutOptions,
15923
16269
  title
15924
16270
  };
15925
16271
  extend$1(true, listdef, properties);
@@ -16041,7 +16387,7 @@ function ListBoxWrapper(_ref) {
16041
16387
  options
16042
16388
  });
16043
16389
  const elementRef = useRef(element);
16044
- const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more'], options)[0];
16390
+ const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more', '.njs-action-toolbar-popover'], options)[0];
16045
16391
  const opts = useMemo$1(() => _objectSpread2(_objectSpread2({}, options), {}, {
16046
16392
  selections,
16047
16393
  model,