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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/esm/dev.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /*
2
- * @nebula.js/stardust v3.3.0-alpha.0
2
+ * @nebula.js/stardust v4.0.0-alpha.0
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
7
  import * as React from 'react';
8
- import React__default, { useState as useState$1, useEffect as useEffect$1, useReducer, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef, createElement, useContext } from 'react';
8
+ import React__default, { useState as useState$1, useEffect as useEffect$1, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useReducer, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef, createElement, useContext } from 'react';
9
9
  import ReactDOM from 'react-dom';
10
10
  import { CacheProvider, ThemeContext as ThemeContext$2 } from '@emotion/react';
11
- import { Checkbox, Radio, Grid, Typography, FormControlLabel, Tooltip, Paper, IconButton, Popover, MenuList, MenuItem, ListItemIcon, Divider, InputAdornment, OutlinedInput, Badge, List, ListItem, Button, Box, Icon, CircularProgress } from '@mui/material';
11
+ import { Checkbox, Radio, Typography, FormControlLabel, Grid, Tooltip, Paper, IconButton, Popover, MenuList, MenuItem, ListItemIcon, Divider, InputAdornment, OutlinedInput, Badge, List, ListItem, Button, Box, Icon, CircularProgress } from '@mui/material';
12
12
  import styled$3 from '@emotion/styled';
13
13
 
14
14
  function getAugmentedNamespace(n) {
@@ -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++) {
@@ -7972,7 +7987,7 @@ function create$3(definition) {
7972
7987
  return cache[key];
7973
7988
  }
7974
7989
 
7975
- const NEBULA_VERSION_HASH = "c721" ;
7990
+ const NEBULA_VERSION_HASH = "b1a6" ;
7976
7991
  ClassNameGenerator$1.configure(componentName => {
7977
7992
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
7978
7993
  });
@@ -8027,6 +8042,220 @@ var createKeyStore = (function () {
8027
8042
  return [useKeyStore, store];
8028
8043
  });
8029
8044
 
8045
+ const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
8046
+ const [useAppModalStore, appModalStore] = createKeyStore({});
8047
+ const [useObjectSelectionsStore, objectSelectionsStore] = createKeyStore({});
8048
+ const [useModalObjectStore, modalObjectStore] = createKeyStore({});
8049
+
8050
+ /* eslint no-underscore-dangle: 0 */
8051
+ function createAppSelections(_ref) {
8052
+ let {
8053
+ app
8054
+ } = _ref;
8055
+ const key = "".concat(app.id);
8056
+ const end = async function () {
8057
+ let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8058
+ const model = modalObjectStore.get(key);
8059
+ if (model) {
8060
+ await model.endSelections(accept);
8061
+ modalObjectStore.clear(key);
8062
+ const objectSelections = objectSelectionsStore.get(model.id);
8063
+ objectSelections.emit('deactivated');
8064
+ }
8065
+ };
8066
+ const begin = async function (model, path) {
8067
+ let accept = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
8068
+ // Quick return if it's already in modal
8069
+ if (model === modalObjectStore.get(key)) {
8070
+ return;
8071
+ }
8072
+
8073
+ // If other model is in modal state end it
8074
+ end(accept);
8075
+
8076
+ // Pending modal
8077
+ modalObjectStore.set(key, model);
8078
+ const p = Array.isArray(path) ? path : [path];
8079
+ const beginSelections = async skipRetry => {
8080
+ try {
8081
+ await model.beginSelections(p);
8082
+ modalObjectStore.set(key, model); // We have a modal
8083
+ } catch (err) {
8084
+ if (err.code === 6003 && !skipRetry) {
8085
+ await app.abortModal(accept);
8086
+ beginSelections(true);
8087
+ } else {
8088
+ modalObjectStore.clear(key); // No modal
8089
+ }
8090
+ }
8091
+ };
8092
+
8093
+ await beginSelections();
8094
+ };
8095
+ const appModal = {
8096
+ begin,
8097
+ end
8098
+ };
8099
+ appModalStore.set(key, appModal);
8100
+
8101
+ /**
8102
+ * @class
8103
+ * @alias AppSelections
8104
+ */
8105
+ const appSelections = {
8106
+ model: app,
8107
+ isInModal() {
8108
+ return !!modalObjectStore.get(key);
8109
+ },
8110
+ isModal(object) {
8111
+ // TODO check model state
8112
+ return object ? modalObjectStore.get(key) === object : !!modalObjectStore.get(key);
8113
+ },
8114
+ forward() {
8115
+ return appModal.end().then(() => app.forward());
8116
+ },
8117
+ back() {
8118
+ return appModal.end().then(() => app.back());
8119
+ },
8120
+ clear() {
8121
+ return appModal.end().then(() => app.clearAll());
8122
+ },
8123
+ clearField(field) {
8124
+ let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
8125
+ return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
8126
+ }
8127
+ };
8128
+ return appSelections;
8129
+ }
8130
+ function useAppSelections(app) {
8131
+ if (!app.session) {
8132
+ // assume the app is mocked if session is undefined
8133
+ return [];
8134
+ }
8135
+ const [appSelectionsStore] = useAppSelectionsStore();
8136
+ const key = app ? app.id : null;
8137
+ let appSelections = appSelectionsStore.get(key);
8138
+ useEffect$1(() => {
8139
+ if (!app || appSelections) return;
8140
+ appSelections = createAppSelections({
8141
+ app
8142
+ });
8143
+ appSelectionsStore.set(key, appSelections);
8144
+ appSelectionsStore.dispatch(true);
8145
+ }, [app]);
8146
+ return [appSelections];
8147
+ }
8148
+
8149
+ const NebulaApp = forwardRef((_ref, ref) => {
8150
+ let {
8151
+ initialContext,
8152
+ app,
8153
+ renderCallback
8154
+ } = _ref;
8155
+ const [appSelections] = useAppSelections(app);
8156
+ const [context, setContext] = useState$1(initialContext);
8157
+ const [muiThemeName, setMuiThemeName] = useState$1();
8158
+ const {
8159
+ theme
8160
+ } = useMemo$1(() => ({
8161
+ theme: create$3(muiThemeName)
8162
+ }), [muiThemeName]);
8163
+ const [components, setComponents] = useState$1([]);
8164
+
8165
+ // Will be called directly after the first render pass
8166
+ // See: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
8167
+ useEffect$1(() => {
8168
+ renderCallback && renderCallback();
8169
+ }, []);
8170
+ useImperativeHandle$1(ref, () => ({
8171
+ setComps(comps) {
8172
+ setComponents([...comps]);
8173
+ },
8174
+ setMuiThemeName,
8175
+ setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext),
8176
+ getAppSelections: () => appSelections
8177
+ }), []);
8178
+ return /*#__PURE__*/React__default.createElement(StyledEngineProvider, {
8179
+ injectFirst: true
8180
+ }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
8181
+ theme: theme
8182
+ }, /*#__PURE__*/React__default.createElement(InstanceContext.Provider, {
8183
+ value: context
8184
+ }, components)));
8185
+ });
8186
+ function boot(_ref2) {
8187
+ let {
8188
+ app,
8189
+ context
8190
+ } = _ref2;
8191
+ let resolveRender;
8192
+ const rendered = new Promise(resolve => {
8193
+ resolveRender = resolve;
8194
+ });
8195
+ const appRef = React__default.createRef();
8196
+ const element = document.createElement('div');
8197
+ element.style.display = 'none';
8198
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.0" );
8199
+ element.setAttribute('data-app-id', app.id);
8200
+ document.body.appendChild(element);
8201
+ const root = client.createRoot(element);
8202
+ root.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
8203
+ ref: appRef,
8204
+ app: app,
8205
+ initialContext: context,
8206
+ renderCallback: resolveRender
8207
+ }));
8208
+ const cells = {};
8209
+ const components = [];
8210
+ return [{
8211
+ toggleFocusOfCells(cellIdToFocus) {
8212
+ Object.keys(cells).forEach(i => {
8213
+ cells[i].current.toggleFocus(i === cellIdToFocus);
8214
+ });
8215
+ },
8216
+ cells,
8217
+ addCell(id, cell) {
8218
+ cells[id] = cell;
8219
+ },
8220
+ removeCell(id) {
8221
+ delete cells[id];
8222
+ },
8223
+ add(component) {
8224
+ (async () => {
8225
+ await rendered;
8226
+ components.push(component);
8227
+ appRef.current.setComps(components);
8228
+ })();
8229
+ },
8230
+ remove(component) {
8231
+ (async () => {
8232
+ await rendered;
8233
+ const ix = components.indexOf(component);
8234
+ if (ix !== -1) {
8235
+ components.splice(ix, 1);
8236
+ }
8237
+ appRef.current.setComps(components);
8238
+ })();
8239
+ },
8240
+ setMuiThemeName(themeName) {
8241
+ (async () => {
8242
+ await rendered;
8243
+ appRef.current.setMuiThemeName(themeName);
8244
+ })();
8245
+ },
8246
+ context(ctx) {
8247
+ (async () => {
8248
+ await rendered;
8249
+ appRef.current.setContext(ctx);
8250
+ })();
8251
+ },
8252
+ getAppSelections: async () => {
8253
+ await rendered;
8254
+ return appRef.current.getAppSelections();
8255
+ }
8256
+ }, appRef, rendered];
8257
+ }
8258
+
8030
8259
  const [useRpcResultStore, rpcResultStore] = createKeyStore({});
8031
8260
  const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
8032
8261
  const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
@@ -8079,6 +8308,51 @@ const subscribe = model => {
8079
8308
  };
8080
8309
  };
8081
8310
 
8311
+ function useSessionModel(definition, app) {
8312
+ const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
8313
+ const [modelStore] = useModelStore();
8314
+ const [rpcRequestSessionModelStore] = useRpcRequestSessionModelStore();
8315
+ const [model, setModel] = useState$1();
8316
+ let rpcShared;
8317
+ if (key) {
8318
+ rpcShared = rpcRequestSessionModelStore.get(key);
8319
+ }
8320
+ for (var _len = arguments.length, deps = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
8321
+ deps[_key - 2] = arguments[_key];
8322
+ }
8323
+ useEffect$1(() => {
8324
+ if (!app) {
8325
+ return;
8326
+ }
8327
+ // Create new session object
8328
+ const create = async () => {
8329
+ if (!rpcShared) {
8330
+ const rpc = app.createSessionObject(definition);
8331
+ rpcShared = rpc;
8332
+ rpcRequestSessionModelStore.set(key, rpcShared);
8333
+ }
8334
+ const newModel = await rpcShared;
8335
+ modelStore.set(key, newModel);
8336
+ setModel(newModel);
8337
+ };
8338
+ create();
8339
+ }, [app, ...deps]);
8340
+ return [model];
8341
+ }
8342
+
8343
+ const definition = {
8344
+ qInfo: {
8345
+ qType: 'current-selections'
8346
+ },
8347
+ qSelectionObjectDef: {
8348
+ qStateName: '$'
8349
+ },
8350
+ alternateStates: []
8351
+ };
8352
+ function useCurrentSelectionsModel(app) {
8353
+ return useSessionModel(definition, app);
8354
+ }
8355
+
8082
8356
  const rpcReducer = (state, action) => {
8083
8357
  const {
8084
8358
  rpcResultStore,
@@ -8230,454 +8504,140 @@ function useAppLayout$1(model) {
8230
8504
  return useRpc(model, 'getAppLayout');
8231
8505
  }
8232
8506
 
8233
- function useSessionModel(definition, app) {
8234
- const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
8235
- const [modelStore] = useModelStore();
8236
- const [rpcRequestSessionModelStore] = useRpcRequestSessionModelStore();
8237
- const [model, setModel] = useState$1();
8238
- let rpcShared;
8239
- if (key) {
8240
- rpcShared = rpcRequestSessionModelStore.get(key);
8241
- }
8242
- for (var _len = arguments.length, deps = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
8243
- deps[_key - 2] = arguments[_key];
8244
- }
8245
- useEffect$1(() => {
8246
- if (!app) {
8247
- return;
8507
+ function useRect$1() {
8508
+ const [node, setNode] = useState$1();
8509
+ const [rect, setRect] = useState$1();
8510
+ const callbackRef = useCallback(ref => {
8511
+ if (!ref) {
8512
+ return;
8248
8513
  }
8249
- // Create new session object
8250
- const create = async () => {
8251
- if (!rpcShared) {
8252
- const rpc = app.createSessionObject(definition);
8253
- rpcShared = rpc;
8254
- rpcRequestSessionModelStore.set(key, rpcShared);
8255
- }
8256
- const newModel = await rpcShared;
8257
- modelStore.set(key, newModel);
8258
- setModel(newModel);
8514
+ setNode(ref);
8515
+ }, []);
8516
+ const handleResize = () => {
8517
+ const {
8518
+ left,
8519
+ top,
8520
+ width,
8521
+ height
8522
+ } = node.getBoundingClientRect();
8523
+ setRect({
8524
+ left,
8525
+ top,
8526
+ width,
8527
+ height
8528
+ });
8529
+ };
8530
+ useLayoutEffect$1(() => {
8531
+ if (!node) {
8532
+ return undefined;
8533
+ }
8534
+ if (typeof ResizeObserver === 'function') {
8535
+ let resizeObserver = new ResizeObserver(handleResize);
8536
+ resizeObserver.observe(node);
8537
+ return () => {
8538
+ resizeObserver.unobserve(node);
8539
+ resizeObserver.disconnect(node);
8540
+ resizeObserver = null;
8541
+ };
8542
+ }
8543
+ handleResize();
8544
+ window.addEventListener('resize', handleResize);
8545
+ return () => {
8546
+ window.removeEventListener('resize', handleResize);
8259
8547
  };
8260
- create();
8261
- }, [app, ...deps]);
8262
- return [model];
8263
- }
8264
-
8265
- const definition = {
8266
- qInfo: {
8267
- qType: 'current-selections'
8268
- },
8269
- qSelectionObjectDef: {
8270
- qStateName: '$'
8271
- },
8272
- alternateStates: []
8273
- };
8274
- function useCurrentSelectionsModel(app) {
8275
- return useSessionModel(definition, app);
8548
+ }, [node]);
8549
+ return [callbackRef, rect, node];
8276
8550
  }
8277
8551
 
8278
- const patchAlternateState = (currentSelectionsModel, currentSelectionsLayout, appLayout) => {
8279
- const states = [...(appLayout.qStateNames || [])].map(s => ({
8280
- stateName: s,
8281
- // need this as reference in selection toolbar since qSelectionObject.qStateName is not in the layout
8282
- qSelectionObjectDef: {
8283
- qStateName: s
8284
- }
8285
- }));
8286
- const existingStates = (currentSelectionsLayout && currentSelectionsLayout.alternateStates ? currentSelectionsLayout.alternateStates.map(s => s.stateName) : []).join('::');
8287
- const newStates = (appLayout.qStateNames || []).map(s => s).join('::');
8288
- if (existingStates !== newStates) {
8289
- currentSelectionsModel.applyPatches([{
8290
- qOp: 'replace',
8291
- qPath: '/alternateStates',
8292
- qValue: JSON.stringify(states)
8293
- }], true);
8552
+ function getFontSize(size) {
8553
+ if (size === 'large') {
8554
+ return '20px';
8294
8555
  }
8295
- };
8296
- function useAppSelectionsNavigation(app) {
8297
- const [currentSelectionsModel] = useCurrentSelectionsModel(app);
8298
- const [currentSelectionsLayout] = useLayout$1(currentSelectionsModel);
8299
- const [appLayout] = useAppLayout$1(app);
8300
- const [navigationState, setNavigationState] = useState$1(null);
8301
- useEffect$1(() => {
8302
- if (!appLayout || !currentSelectionsModel || !currentSelectionsLayout) return;
8303
- patchAlternateState(currentSelectionsModel, currentSelectionsLayout, appLayout);
8304
- }, [appLayout, currentSelectionsModel, currentSelectionsLayout]);
8305
- useEffect$1(() => {
8306
- if (!currentSelectionsLayout) return;
8307
- let canGoBack = false;
8308
- let canGoForward = false;
8309
- let canClear = false;
8310
- [currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach(state => {
8311
- canGoBack = canGoBack || state.qSelectionObject && state.qSelectionObject.qBackCount > 0;
8312
- canGoForward = canGoForward || state.qSelectionObject && state.qSelectionObject.qForwardCount > 0;
8313
- canClear = canClear || (state.qSelectionObject && state.qSelectionObject.qSelections || []).filter(s => s.qLocked !== true).length > 0;
8314
- });
8315
- setNavigationState({
8316
- canGoBack,
8317
- canGoForward,
8318
- canClear
8319
- });
8320
- }, [currentSelectionsLayout]);
8321
- return [navigationState, currentSelectionsModel, currentSelectionsLayout];
8556
+ if (size === 'small') {
8557
+ return '12px';
8558
+ }
8559
+ return '16px';
8322
8560
  }
8323
-
8324
- const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
8325
- const [useAppModalStore, appModalStore] = createKeyStore({});
8326
- const [useObjectSelectionsStore, objectSelectionsStore] = createKeyStore({});
8327
- const [useModalObjectStore, modalObjectStore] = createKeyStore({});
8328
-
8329
- /* eslint no-underscore-dangle: 0 */
8330
- function createAppSelections(_ref) {
8561
+ function SvgIcon$2(_ref) {
8331
8562
  let {
8332
- app,
8333
- currentSelectionsLayout,
8334
- navState
8563
+ size,
8564
+ style = {},
8565
+ viewBox = '0 0 16 16',
8566
+ shapes = []
8335
8567
  } = _ref;
8336
- const key = "".concat(app.id);
8337
- const end = async function () {
8338
- let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8339
- const model = modalObjectStore.get(key);
8340
- if (model) {
8341
- await model.endSelections(accept);
8342
- modalObjectStore.clear(key);
8343
- const objectSelections = objectSelectionsStore.get(model.id);
8344
- objectSelections.emit('deactivated');
8568
+ const s = _objectSpread2({
8569
+ fontSize: getFontSize(size),
8570
+ display: 'inline-block',
8571
+ fontStyle: 'normal',
8572
+ lineHeight: '0',
8573
+ textAlign: 'center',
8574
+ textTransform: 'none',
8575
+ verticalAlign: '-.125em',
8576
+ textRendering: 'optimizeLegibility',
8577
+ WebkitFontSmoothing: 'antialiased',
8578
+ MozOsxFontSmoothing: 'grayscale'
8579
+ }, style);
8580
+ return /*#__PURE__*/React__default.createElement("i", {
8581
+ style: s
8582
+ }, /*#__PURE__*/React__default.createElement("svg", {
8583
+ xmlns: "http://www.w3.org/2000/svg",
8584
+ width: "1em",
8585
+ height: "1em",
8586
+ viewBox: viewBox,
8587
+ fill: "currentColor"
8588
+ }, shapes.map((_ref2, ix) => {
8589
+ let {
8590
+ type: Type,
8591
+ attrs
8592
+ } = _ref2;
8593
+ return (
8594
+ /*#__PURE__*/
8595
+ // eslint-disable-next-line react/no-array-index-key
8596
+ React__default.createElement(Type, _extends$6({
8597
+ key: ix
8598
+ }, attrs))
8599
+ );
8600
+ })));
8601
+ }
8602
+
8603
+ const remove = props => _objectSpread2(_objectSpread2({}, props), {}, {
8604
+ shapes: [{
8605
+ type: 'path',
8606
+ attrs: {
8607
+ d: 'M9.41421356,8 L11.8890873,5.52512627 C12.065864,5.34834957 12.0305087,4.95944084 11.8183766,4.74730881 L11.2526912,4.18162338 C11.0405592,3.96949135 10.6516504,3.93413601 10.4748737,4.1109127 L8,6.58578644 L5.52512627,4.1109127 C5.34834957,3.93413601 4.95944084,3.96949135 4.74730881,4.18162338 L4.25233406,4.67659813 C3.96949135,4.95944084 3.93413601,5.34834957 4.1109127,5.52512627 L6.58578644,8 L4.1109127,10.4748737 C3.93413601,10.6516504 3.96949135,11.0405592 4.18162338,11.2526912 L4.67659813,11.7476659 C4.95944084,12.0305087 5.34834957,12.065864 5.52512627,11.8890873 L8,9.41421356 L10.4748737,11.8890873 C10.6516504,12.065864 11.0405592,12.0305087 11.2526912,11.8183766 L11.8183766,11.2526912 C12.0305087,11.0405592 12.065864,10.6516504 11.8890873,10.4748737 L9.41421356,8 Z M8,0 C12.4,0 16,3.6 16,8 C16,12.4 12.4,16 8,16 C3.6,16 0,12.4 0,8 C0,3.6 3.6,0 8,0 Z'
8345
8608
  }
8346
- };
8347
- const begin = async function (model, path) {
8348
- let accept = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
8349
- // Quick return if it's already in modal
8350
- if (model === modalObjectStore.get(key)) {
8351
- return;
8609
+ }]
8610
+ });
8611
+ var Remove = (props => SvgIcon$2(remove(props)));
8612
+
8613
+ const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
8614
+ shapes: [{
8615
+ type: 'path',
8616
+ attrs: {
8617
+ d: 'M8 10a1 1 0 0 1 .5 1.866v.634a.5.5 0 0 1-1 0v-.634A1 1 0 0 1 8 10ZM3.625 7.035A2 2 0 0 0 2 9v5a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9a2 2 0 0 0-1.625-1.965V5.383a4.375 4.375 0 0 0-8.75 0v1.652ZM3 9a1 1 0 0 1 .931-.998h8.138A1 1 0 0 1 13 9v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9Zm8.375-3.617V7h-6.75V5.383a3.375 3.375 0 0 1 6.75 0Z'
8352
8618
  }
8619
+ }]
8620
+ });
8621
+ var Lock = (props => SvgIcon$2(lock(props)));
8353
8622
 
8354
- // If other model is in modal state end it
8355
- end(accept);
8623
+ const unlock = props => _objectSpread2(_objectSpread2({}, props), {}, {
8624
+ shapes: [{
8625
+ type: 'path',
8626
+ attrs: {
8627
+ d: 'M2.5,7 L11,7 C11.5522847,7 12,7.44771525 12,8 L12,15 C12,15.5522847 11.5522847,16 11,16 L1,16 C0.44771525,16 0,15.5522847 0,15 L0,8 C0,7.44771525 0.44771525,7 1,7 L1,4.98151367 C1,2.23029964 3.23857625,0 6,0 C8.4241995,0 10.4454541,1.71883353 10.9029715,4 L9.34209114,4 C8.9671727,2.54028848 7.9088888,1.5 6,1.5 C3.54860291,1.5 2.5,3.21561511 2.5,5.33193359 L2.5,7 Z'
8628
+ }
8629
+ }]
8630
+ });
8631
+ var Unlock = (props => SvgIcon$2(unlock(props)));
8356
8632
 
8357
- // Pending modal
8358
- modalObjectStore.set(key, model);
8359
- const p = Array.isArray(path) ? path : [path];
8360
- const beginSelections = async skipRetry => {
8361
- try {
8362
- await model.beginSelections(p);
8363
- modalObjectStore.set(key, model); // We have a modal
8364
- } catch (err) {
8365
- if (err.code === 6003 && !skipRetry) {
8366
- await app.abortModal(accept);
8367
- beginSelections(true);
8368
- } else {
8369
- modalObjectStore.clear(key); // No modal
8370
- }
8371
- }
8372
- };
8633
+ function isRangeVisible(_ref) {
8634
+ var lastRenderedStartIndex = _ref.lastRenderedStartIndex,
8635
+ lastRenderedStopIndex = _ref.lastRenderedStopIndex,
8636
+ startIndex = _ref.startIndex,
8637
+ stopIndex = _ref.stopIndex;
8373
8638
 
8374
- await beginSelections();
8375
- };
8376
- const appModal = {
8377
- begin,
8378
- end
8379
- };
8380
- appModalStore.set(key, appModal);
8381
-
8382
- /**
8383
- * @class
8384
- * @alias AppSelections
8385
- */
8386
- const appSelections = {
8387
- model: app,
8388
- isInModal() {
8389
- return !!modalObjectStore.get(key);
8390
- },
8391
- isModal(object) {
8392
- // TODO check model state
8393
- return object ? modalObjectStore.get(key) === object : !!modalObjectStore.get(key);
8394
- },
8395
- canGoForward() {
8396
- return navState.canGoForward;
8397
- },
8398
- canGoBack() {
8399
- return navState.canGoBack;
8400
- },
8401
- canClear() {
8402
- return navState.canClear;
8403
- },
8404
- layout() {
8405
- return currentSelectionsLayout;
8406
- },
8407
- forward() {
8408
- return appModal.end().then(() => app.forward());
8409
- },
8410
- back() {
8411
- return appModal.end().then(() => app.back());
8412
- },
8413
- clear() {
8414
- return appModal.end().then(() => app.clearAll());
8415
- },
8416
- clearField(field) {
8417
- let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
8418
- return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
8419
- }
8420
- };
8421
- return appSelections;
8422
- }
8423
- function useAppSelections(app) {
8424
- if (!app.session) {
8425
- // assume the app is mocked if session is undefined
8426
- return [];
8427
- }
8428
- const [navState, currentSelectionsModel, currentSelectionsLayout] = useAppSelectionsNavigation(app);
8429
- const [appSelectionsStore] = useAppSelectionsStore();
8430
- const key = app ? app.id : null;
8431
- let appSelections = appSelectionsStore.get(key);
8432
- useEffect$1(() => {
8433
- if (!app || !currentSelectionsModel || !currentSelectionsLayout || !navState || appSelections) return;
8434
- appSelections = createAppSelections({
8435
- app,
8436
- currentSelectionsLayout,
8437
- navState
8438
- });
8439
- appSelectionsStore.set(key, appSelections);
8440
- appSelectionsStore.dispatch(true);
8441
- }, [app, currentSelectionsModel, currentSelectionsLayout, navState]);
8442
- return [appSelections, navState];
8443
- }
8444
-
8445
- const NebulaApp = forwardRef((_ref, ref) => {
8446
- let {
8447
- initialContext,
8448
- app
8449
- } = _ref;
8450
- const [appSelections] = useAppSelections(app);
8451
- const [context, setContext] = useState$1(initialContext);
8452
- const [muiThemeName, setMuiThemeName] = useState$1();
8453
- const {
8454
- theme
8455
- } = useMemo$1(() => ({
8456
- theme: create$3(muiThemeName)
8457
- }), [muiThemeName]);
8458
- const [components, setComponents] = useState$1([]);
8459
- useImperativeHandle$1(ref, () => ({
8460
- addComponent(component) {
8461
- setComponents([...components, component]);
8462
- },
8463
- removeComponent(component) {
8464
- const ix = components.indexOf(component);
8465
- if (ix !== -1) {
8466
- components.splice(ix, 1);
8467
- setComponents([...components]);
8468
- }
8469
- },
8470
- setMuiThemeName,
8471
- setContext,
8472
- getAppSelections: () => appSelections
8473
- }));
8474
- return /*#__PURE__*/React__default.createElement(StyledEngineProvider, {
8475
- injectFirst: true
8476
- }, /*#__PURE__*/React__default.createElement(ThemeProvider, {
8477
- theme: theme
8478
- }, /*#__PURE__*/React__default.createElement(InstanceContext.Provider, {
8479
- value: context
8480
- }, components)));
8481
- });
8482
- function boot(_ref2) {
8483
- let {
8484
- app,
8485
- context
8486
- } = _ref2;
8487
- let resolveRender;
8488
- const rendered = new Promise(resolve => {
8489
- resolveRender = resolve;
8490
- });
8491
- const appRef = React__default.createRef();
8492
- const element = document.createElement('div');
8493
- element.style.display = 'none';
8494
- element.setAttribute('data-nebulajs-version', "3.3.0-alpha.0" );
8495
- element.setAttribute('data-app-id', app.id);
8496
- document.body.appendChild(element);
8497
- ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
8498
- ref: appRef,
8499
- app: app,
8500
- initialContext: context
8501
- }), element, resolveRender);
8502
- const cells = {};
8503
- return [{
8504
- toggleFocusOfCells(cellIdToFocus) {
8505
- Object.keys(cells).forEach(i => {
8506
- cells[i].current.toggleFocus(i === cellIdToFocus);
8507
- });
8508
- },
8509
- cells,
8510
- addCell(id, cell) {
8511
- cells[id] = cell;
8512
- },
8513
- removeCell(id) {
8514
- delete cells[id];
8515
- },
8516
- add(component) {
8517
- (async () => {
8518
- await rendered;
8519
- appRef.current.addComponent(component);
8520
- })();
8521
- },
8522
- remove(component) {
8523
- (async () => {
8524
- await rendered;
8525
- appRef.current.removeComponent(component);
8526
- })();
8527
- },
8528
- setMuiThemeName(themeName) {
8529
- (async () => {
8530
- await rendered;
8531
- appRef.current.setMuiThemeName(themeName);
8532
- })();
8533
- },
8534
- context(ctx) {
8535
- (async () => {
8536
- await rendered;
8537
- appRef.current.setContext(ctx);
8538
- })();
8539
- },
8540
- getAppSelections: async () => {
8541
- await rendered;
8542
- return appRef.current.getAppSelections();
8543
- }
8544
- }, appRef, rendered];
8545
- }
8546
-
8547
- function useRect$1() {
8548
- const [node, setNode] = useState$1();
8549
- const [rect, setRect] = useState$1();
8550
- const callbackRef = useCallback(ref => {
8551
- if (!ref) {
8552
- return;
8553
- }
8554
- setNode(ref);
8555
- }, []);
8556
- const handleResize = () => {
8557
- const {
8558
- left,
8559
- top,
8560
- width,
8561
- height
8562
- } = node.getBoundingClientRect();
8563
- setRect({
8564
- left,
8565
- top,
8566
- width,
8567
- height
8568
- });
8569
- };
8570
- useLayoutEffect$1(() => {
8571
- if (!node) {
8572
- return undefined;
8573
- }
8574
- if (typeof ResizeObserver === 'function') {
8575
- let resizeObserver = new ResizeObserver(handleResize);
8576
- resizeObserver.observe(node);
8577
- return () => {
8578
- resizeObserver.unobserve(node);
8579
- resizeObserver.disconnect(node);
8580
- resizeObserver = null;
8581
- };
8582
- }
8583
- handleResize();
8584
- window.addEventListener('resize', handleResize);
8585
- return () => {
8586
- window.removeEventListener('resize', handleResize);
8587
- };
8588
- }, [node]);
8589
- return [callbackRef, rect, node];
8590
- }
8591
-
8592
- function getFontSize(size) {
8593
- if (size === 'large') {
8594
- return '20px';
8595
- }
8596
- if (size === 'small') {
8597
- return '12px';
8598
- }
8599
- return '16px';
8600
- }
8601
- function SvgIcon$2(_ref) {
8602
- let {
8603
- size,
8604
- style = {},
8605
- viewBox = '0 0 16 16',
8606
- shapes = []
8607
- } = _ref;
8608
- const s = _objectSpread2({
8609
- fontSize: getFontSize(size),
8610
- display: 'inline-block',
8611
- fontStyle: 'normal',
8612
- lineHeight: '0',
8613
- textAlign: 'center',
8614
- textTransform: 'none',
8615
- verticalAlign: '-.125em',
8616
- textRendering: 'optimizeLegibility',
8617
- WebkitFontSmoothing: 'antialiased',
8618
- MozOsxFontSmoothing: 'grayscale'
8619
- }, style);
8620
- return /*#__PURE__*/React__default.createElement("i", {
8621
- style: s
8622
- }, /*#__PURE__*/React__default.createElement("svg", {
8623
- xmlns: "http://www.w3.org/2000/svg",
8624
- width: "1em",
8625
- height: "1em",
8626
- viewBox: viewBox,
8627
- fill: "currentColor"
8628
- }, shapes.map((_ref2, ix) => {
8629
- let {
8630
- type: Type,
8631
- attrs
8632
- } = _ref2;
8633
- return (
8634
- /*#__PURE__*/
8635
- // eslint-disable-next-line react/no-array-index-key
8636
- React__default.createElement(Type, _extends$6({
8637
- key: ix
8638
- }, attrs))
8639
- );
8640
- })));
8641
- }
8642
-
8643
- const remove = props => _objectSpread2(_objectSpread2({}, props), {}, {
8644
- shapes: [{
8645
- type: 'path',
8646
- attrs: {
8647
- d: 'M9.41421356,8 L11.8890873,5.52512627 C12.065864,5.34834957 12.0305087,4.95944084 11.8183766,4.74730881 L11.2526912,4.18162338 C11.0405592,3.96949135 10.6516504,3.93413601 10.4748737,4.1109127 L8,6.58578644 L5.52512627,4.1109127 C5.34834957,3.93413601 4.95944084,3.96949135 4.74730881,4.18162338 L4.25233406,4.67659813 C3.96949135,4.95944084 3.93413601,5.34834957 4.1109127,5.52512627 L6.58578644,8 L4.1109127,10.4748737 C3.93413601,10.6516504 3.96949135,11.0405592 4.18162338,11.2526912 L4.67659813,11.7476659 C4.95944084,12.0305087 5.34834957,12.065864 5.52512627,11.8890873 L8,9.41421356 L10.4748737,11.8890873 C10.6516504,12.065864 11.0405592,12.0305087 11.2526912,11.8183766 L11.8183766,11.2526912 C12.0305087,11.0405592 12.065864,10.6516504 11.8890873,10.4748737 L9.41421356,8 Z M8,0 C12.4,0 16,3.6 16,8 C16,12.4 12.4,16 8,16 C3.6,16 0,12.4 0,8 C0,3.6 3.6,0 8,0 Z'
8648
- }
8649
- }]
8650
- });
8651
- var Remove = (props => SvgIcon$2(remove(props)));
8652
-
8653
- const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
8654
- shapes: [{
8655
- type: 'path',
8656
- attrs: {
8657
- d: 'M8 10a1 1 0 0 1 .5 1.866v.634a.5.5 0 0 1-1 0v-.634A1 1 0 0 1 8 10ZM3.625 7.035A2 2 0 0 0 2 9v5a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9a2 2 0 0 0-1.625-1.965V5.383a4.375 4.375 0 0 0-8.75 0v1.652ZM3 9a1 1 0 0 1 .931-.998h8.138A1 1 0 0 1 13 9v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9Zm8.375-3.617V7h-6.75V5.383a3.375 3.375 0 0 1 6.75 0Z'
8658
- }
8659
- }]
8660
- });
8661
- var Lock = (props => SvgIcon$2(lock(props)));
8662
-
8663
- const unlock = props => _objectSpread2(_objectSpread2({}, props), {}, {
8664
- shapes: [{
8665
- type: 'path',
8666
- attrs: {
8667
- d: 'M2.5,7 L11,7 C11.5522847,7 12,7.44771525 12,8 L12,15 C12,15.5522847 11.5522847,16 11,16 L1,16 C0.44771525,16 0,15.5522847 0,15 L0,8 C0,7.44771525 0.44771525,7 1,7 L1,4.98151367 C1,2.23029964 3.23857625,0 6,0 C8.4241995,0 10.4454541,1.71883353 10.9029715,4 L9.34209114,4 C8.9671727,2.54028848 7.9088888,1.5 6,1.5 C3.54860291,1.5 2.5,3.21561511 2.5,5.33193359 L2.5,7 Z'
8668
- }
8669
- }]
8670
- });
8671
- var Unlock = (props => SvgIcon$2(unlock(props)));
8672
-
8673
- function isRangeVisible(_ref) {
8674
- var lastRenderedStartIndex = _ref.lastRenderedStartIndex,
8675
- lastRenderedStopIndex = _ref.lastRenderedStopIndex,
8676
- startIndex = _ref.startIndex,
8677
- stopIndex = _ref.stopIndex;
8678
-
8679
- return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
8680
- }
8639
+ return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
8640
+ }
8681
8641
 
8682
8642
  function scanForUnloadedRanges(_ref) {
8683
8643
  var isItemLoaded = _ref.isItemLoaded,
@@ -8927,9 +8887,6 @@ const flatten = arr => arr.reduce((prev, cur) => prev.concat(cur));
8927
8887
  function isStateSelected(qState) {
8928
8888
  return SELECTED_STATES.includes(qState);
8929
8889
  }
8930
- function getUniques(arr) {
8931
- return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
8932
- }
8933
8890
  function getSelectedValues(pages) {
8934
8891
  if (!pages || !pages.length) {
8935
8892
  return [];
@@ -8943,45 +8900,38 @@ function getSelectedValues(pages) {
8943
8900
  });
8944
8901
  return flatten(elementNbrs);
8945
8902
  }
8946
- function applySelectionsOnPages(pages, elmNumbers) {
8947
- let clearAllButElmNumbers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8948
- const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
8949
- const matrices = pages.map(page => {
8950
- const qMatrix = page.qMatrix.map(p => {
8951
- const [p0] = p;
8952
- const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
8953
- let qState;
8954
- if (clearAllButElmNumbers) {
8955
- qState = selectionMatchesElement ? 'S' : 'A';
8956
- } else {
8957
- qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
8958
- }
8959
- return [_objectSpread2(_objectSpread2({}, p0), {}, {
8960
- qState
8961
- }), p.slice(1)];
8962
- });
8963
- return _objectSpread2(_objectSpread2({}, page), {}, {
8964
- qMatrix
8965
- });
8966
- });
8967
- return matrices;
8968
- }
8969
8903
  async function selectValues(_ref) {
8970
8904
  let {
8971
8905
  selections,
8972
8906
  elemNumbers,
8973
- isSingleSelect = false
8907
+ toggle,
8908
+ isSingleSelect
8974
8909
  } = _ref;
8975
- let resolved = Promise.resolve(false);
8910
+ if (elemNumbers.length === 0) {
8911
+ return false;
8912
+ }
8976
8913
  const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
8914
+ let success = false;
8977
8915
  if (!hasNanValues) {
8978
8916
  const elemNumbersToSelect = elemNumbers;
8979
- resolved = selections.select({
8980
- method: 'selectListObjectValues',
8981
- params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
8982
- }).then(success => success !== false).catch(() => false);
8917
+ try {
8918
+ const response = await selections.select({
8919
+ method: 'selectListObjectValues',
8920
+ params: ['/qListObjectDef', elemNumbersToSelect, toggle]
8921
+ });
8922
+ success = response !== false;
8923
+ } catch (_unused) {
8924
+ success = false;
8925
+ }
8926
+ if (!success) {
8927
+ if (isSingleSelect) {
8928
+ selections.cancel(); // revert selection
8929
+ } else {
8930
+ selections.clear();
8931
+ }
8932
+ }
8983
8933
  }
8984
- return resolved;
8934
+ return success;
8985
8935
  }
8986
8936
  function getElemNumbersFromPages(pages) {
8987
8937
  if (!pages || !pages.length) {
@@ -9044,126 +8994,132 @@ function fillRange(elementNbrs, elemNumbersOrdered) {
9044
8994
  return elemNumbersOrdered.slice(min, max + 1);
9045
8995
  }
9046
8996
 
8997
+ const getKeyAsToggleSelected = event => !(event.metaKey || event.ctrlKey);
9047
8998
  function useSelectionsInteractions(_ref) {
9048
8999
  let {
9049
- layout,
9000
+ selectionState,
9050
9001
  selections,
9051
- pages = [],
9052
9002
  checkboxes = false,
9053
- selectDisabled,
9054
- doc = document,
9055
- isSingleSelect: singleSelect = false
9003
+ doc = document
9056
9004
  } = _ref;
9057
- const [instantPages, setInstantPages] = useState$1(pages);
9058
- const [mouseDown, setMouseDown] = useState$1(false);
9059
- const [selectingValues, setSelectingValues] = useState$1(false);
9060
- const [isSingleSelect, setIsSingleSelect] = useState$1(singleSelect);
9061
- const [selected, setSelected] = useState$1([]);
9062
- const [isRangeSelection, setIsRangeSelection] = useState$1(false);
9063
- const [preSelected, setPreSelected] = useState$1([]);
9064
- const elemNumbersOrdered = getElemNumbersFromPages(pages);
9065
- useEffect$1(() => {
9066
- setIsSingleSelect(singleSelect);
9067
- }, [singleSelect]);
9005
+ const currentSelect = useRef({
9006
+ startElemNumber: undefined,
9007
+ elemNumbers: [],
9008
+ isRange: false,
9009
+ toggle: false,
9010
+ active: false
9011
+ });
9068
9012
 
9069
- // Select values for real, by calling the backend.
9070
- const select = async function () {
9071
- let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9072
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9073
- if (selectDisabled()) {
9074
- return;
9075
- }
9076
- setSelectingValues(true);
9077
- const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
9078
- await selectValues({
9013
+ // eslint-disable-next-line arrow-body-style
9014
+ const doSelect = () => {
9015
+ selectionState.setSelectableValuesUpdating();
9016
+ return selectValues({
9079
9017
  selections,
9080
- elemNumbers: filtered,
9081
- isSingleSelect
9018
+ elemNumbers: currentSelect.current.elemNumbers,
9019
+ isSingleSelect: selectionState.isSingleSelect,
9020
+ toggle: currentSelect.current.toggle
9082
9021
  });
9083
- setSelectingValues(false);
9084
- setPreSelected([]);
9085
9022
  };
9086
-
9087
- // Show estimated selection states instantly before applying the selections for real.
9088
- const preSelect = function (elemNumbers) {
9089
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9090
- if (selectDisabled()) {
9023
+ const addToRange = elemNumber => {
9024
+ const {
9025
+ startElemNumber
9026
+ } = currentSelect.current;
9027
+ if (startElemNumber === elemNumber) {
9091
9028
  return;
9092
9029
  }
9093
- setPreSelected(existing => {
9094
- const uniques = getUniques([...existing, ...elemNumbers]);
9095
- const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
9096
- const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
9097
- return filled;
9098
- });
9030
+ const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
9031
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
9032
+ const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
9033
+ selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
9099
9034
  };
9100
9035
  const selectManually = function () {
9101
9036
  let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9102
9037
  let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9103
- setIsRangeSelection(false); // range is not supported for manual select
9104
- setMouseDown(true);
9105
- preSelect(elementIds, additive || isRangeSelection);
9106
- const p = select(elementIds, additive || isRangeSelection);
9107
- setMouseDown(false);
9108
- return p;
9038
+ const elemNumbers = [];
9039
+ selectionState.updateItems(elementIds, additive, elemNumbers);
9040
+ selectionState.setSelectableValuesUpdating();
9041
+ return selectValues({
9042
+ selections,
9043
+ elemNumbers: additive ? elemNumbers : elementIds,
9044
+ isSingleSelect: selectionState.isSingleSelect,
9045
+ toggle: !selectionState.isSingleSelect
9046
+ });
9109
9047
  };
9110
- const handleSingleSelectKey = event => {
9048
+ const handleSingleSelectKey = (event, target) => {
9111
9049
  if (event.ctrlKey || event.metaKey) {
9112
- setIsSingleSelect(true);
9113
- event.currentTarget.focus(); // will not be focused otherwise
9050
+ target.focus(); // will not be focused otherwise
9114
9051
  event.preventDefault();
9115
9052
  }
9116
9053
  };
9117
- const onClick = useCallback(event => {
9118
- if (selectingValues || selectDisabled()) {
9054
+ const onChange = useCallback(event => {
9055
+ if (selectionState.selectDisabled()) {
9119
9056
  return;
9120
9057
  }
9121
- const elemNumber = +event.currentTarget.getAttribute('data-n');
9122
- setPreSelected([elemNumber]);
9123
- handleSingleSelectKey(event);
9124
- }, [selectingValues, selectDisabled]);
9058
+ const elemNumber = +event.target.getAttribute('data-n');
9059
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event.nativeEvent);
9060
+ currentSelect.current.elemNumbers = [elemNumber];
9061
+ currentSelect.current.toggle = toggle;
9062
+ if (!toggle) {
9063
+ selectionState.clearItemStates(true);
9064
+ }
9065
+ selectionState.updateItem(elemNumber);
9066
+ currentSelect.current.active = false;
9067
+ doSelect();
9068
+ }, []);
9125
9069
  const onMouseDown = useCallback(event => {
9126
- if (selectingValues || selectDisabled()) {
9070
+ if (selectionState.selectDisabled()) {
9127
9071
  return;
9128
9072
  }
9129
- setIsRangeSelection(false);
9130
- setMouseDown(true);
9131
9073
  const elemNumber = +event.currentTarget.getAttribute('data-n');
9132
- setPreSelected([elemNumber]);
9133
- handleSingleSelectKey(event);
9134
- }, [selectingValues, selectDisabled]);
9074
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event);
9075
+ currentSelect.current.isRange = false;
9076
+ currentSelect.current.startElemNumber = elemNumber;
9077
+ currentSelect.current.elemNumbers = [elemNumber];
9078
+ currentSelect.current.toggle = toggle;
9079
+ currentSelect.current.active = true;
9080
+ if (!toggle) {
9081
+ selectionState.clearItemStates(true);
9082
+ }
9083
+ selectionState.updateItem(elemNumber);
9084
+ if (selectionState.isSingleSelect) {
9085
+ currentSelect.current.active = false;
9086
+ doSelect();
9087
+ }
9088
+ handleSingleSelectKey(event, event.currentTarget);
9089
+ }, []);
9135
9090
  const onMouseUp = useCallback(event => {
9136
- const elemNumber = +event.currentTarget.getAttribute('data-n');
9137
- if (isSingleSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
9138
- ) {
9091
+ if (!currentSelect.current.active) {
9139
9092
  return;
9140
9093
  }
9141
- preSelect([elemNumber]);
9142
- }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection, selectDisabled]);
9094
+ currentSelect.current.active = false;
9095
+ if (currentSelect.current.isRange) {
9096
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
9097
+ addToRange(elemNumber);
9098
+ }
9099
+ doSelect();
9100
+ }, []);
9143
9101
  const onMouseUpDoc = useCallback(() => {
9144
9102
  // Ensure we end interactions when mouseup happens outside the Listbox.
9145
- setMouseDown(false);
9146
- setSelectingValues(false);
9147
- setIsRangeSelection(false);
9148
- setIsSingleSelect(singleSelect);
9149
- }, [singleSelect]);
9150
- const onMouseEnter = useCallback(event => {
9151
- if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
9103
+ if (!currentSelect.current.active) {
9152
9104
  return;
9153
9105
  }
9154
- setIsRangeSelection(true);
9155
- const elemNumber = +event.currentTarget.getAttribute('data-n');
9156
- preSelect([elemNumber], true);
9157
- }, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, selectDisabled, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
9158
- useEffect$1(() => {
9159
- // Perform selections of pre-selected values. This can
9160
- // happen only when interactions have finished (mouseup).
9161
- const interactionIsFinished = !mouseDown;
9162
- if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
9106
+ currentSelect.current.active = false;
9107
+ doSelect();
9108
+ }, []);
9109
+ const onMouseEnter = useCallback(event => {
9110
+ if (!currentSelect.current.active) {
9163
9111
  return;
9164
9112
  }
9165
- select(preSelected, isRangeSelection);
9166
- }, [preSelected, mouseDown, selectDisabled()]);
9113
+ if (!currentSelect.current.isRange) {
9114
+ currentSelect.current.isRange = true;
9115
+ if (!selectionState.isSelected(currentSelect.current.startElemNumber)) {
9116
+ selectionState.updateItem(currentSelect.current.startElemNumber, true);
9117
+ currentSelect.current.elemNumbers = [];
9118
+ }
9119
+ }
9120
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
9121
+ addToRange(elemNumber);
9122
+ }, []);
9167
9123
  useEffect$1(() => {
9168
9124
  doc.addEventListener('mouseup', onMouseUpDoc);
9169
9125
  return () => {
@@ -9171,25 +9127,24 @@ function useSelectionsInteractions(_ref) {
9171
9127
  };
9172
9128
  }, [onMouseUpDoc]);
9173
9129
  useEffect$1(() => {
9174
- if (selectingValues || mouseDown) {
9175
- return;
9176
- }
9177
- // Keep track of (truely) selected fields so we can prevent toggling them on range select.
9178
- const alreadySelected = getSelectedValues(pages);
9179
- setSelected(alreadySelected);
9180
- }, [pages]);
9181
- useEffect$1(() => {
9182
- if (selectingValues || !pages || !checkboxes && !mouseDown) {
9183
- return;
9184
- }
9185
- // Render pre-selections before they have been selected in Engine.
9186
- const newPages = applySelectionsOnPages(pages, preSelected, isSingleSelect);
9187
- setInstantPages(newPages);
9188
- }, [preSelected]);
9130
+ const onDeactivated = () => {
9131
+ selectionState.clearItemStates(false);
9132
+ };
9133
+ const onCleared = () => {
9134
+ selectionState.clearItemStates(true);
9135
+ selectionState.triggerStateChanged();
9136
+ };
9137
+ selections.on('deactivated', onDeactivated);
9138
+ selections.on('cleared', onCleared);
9139
+ return () => {
9140
+ selections.removeListener('activated', onDeactivated);
9141
+ selections.removeListener('cleared', onCleared);
9142
+ };
9143
+ }, [selections]);
9189
9144
  const interactionEvents = {};
9190
9145
  if (checkboxes) {
9191
9146
  Object.assign(interactionEvents, {
9192
- onClick
9147
+ onChange
9193
9148
  });
9194
9149
  } else {
9195
9150
  Object.assign(interactionEvents, {
@@ -9199,7 +9154,6 @@ function useSelectionsInteractions(_ref) {
9199
9154
  });
9200
9155
  }
9201
9156
  return {
9202
- instantPages,
9203
9157
  interactionEvents,
9204
9158
  select: selectManually // preselect and select without having to trigger an event
9205
9159
  };
@@ -9215,102 +9169,6 @@ const tick = props => _objectSpread2(_objectSpread2({}, props), {}, {
9215
9169
  });
9216
9170
  var Tick = (props => SvgIcon$2(tick(props)));
9217
9171
 
9218
- 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\")";
9219
-
9220
- const PREFIX$c = 'ListBoxCheckbox';
9221
- const borderRadius = 3;
9222
- const classes$c = {
9223
- cbIcon: "".concat(PREFIX$c, "-cbIcon"),
9224
- cbIconChecked: "".concat(PREFIX$c, "-cbIconChecked"),
9225
- cbIconExcluded: "".concat(PREFIX$c, "-cbIconExcluded"),
9226
- cbIconAlternative: "".concat(PREFIX$c, "-cbIconAlternative"),
9227
- checkbox: "".concat(PREFIX$c, "-checkbox"),
9228
- dense: "".concat(PREFIX$c, "-dense")
9229
- };
9230
- const StyledCheckbox = styled$1(Checkbox)(_ref => {
9231
- let {
9232
- theme
9233
- } = _ref;
9234
- return {
9235
- ["& .".concat(classes$c.cbIcon)]: {
9236
- borderRadius,
9237
- width: 16,
9238
- height: 16,
9239
- boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
9240
- backgroundColor: '#f5f8fa',
9241
- backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
9242
- display: 'flex',
9243
- alignItems: 'center',
9244
- justifyContent: 'center'
9245
- },
9246
- ["& .".concat(classes$c.cbIconChecked)]: {
9247
- borderRadius,
9248
- backgroundColor: theme.palette.selected.main,
9249
- backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
9250
- '&:before': {
9251
- display: 'block',
9252
- width: 16,
9253
- height: 16,
9254
- backgroundImage: CheckboxChecked,
9255
- content: '""'
9256
- }
9257
- },
9258
- ["& .".concat(classes$c.cbIconExcluded)]: {
9259
- borderRadius: borderRadius - 1,
9260
- width: 12,
9261
- height: 12,
9262
- backgroundColor: theme.palette.selected.excluded
9263
- },
9264
- ["& .".concat(classes$c.cbIconAlternative)]: {
9265
- borderRadius: borderRadius - 1,
9266
- width: 12,
9267
- height: 12,
9268
- backgroundColor: theme.palette.selected.alternative
9269
- },
9270
- ["&.".concat(classes$c.checkbox)]: {
9271
- margin: 0,
9272
- '&:hover': {
9273
- backgroundColor: 'inherit !important'
9274
- }
9275
- },
9276
- ["&.".concat(classes$c.dense)]: {
9277
- padding: '4px 8px'
9278
- }
9279
- };
9280
- });
9281
- const getIcon = function (cls) {
9282
- let showGray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9283
- let excluded = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9284
- return /*#__PURE__*/React__default.createElement("span", {
9285
- className: cls.cbIcon
9286
- }, excluded && /*#__PURE__*/React__default.createElement("span", {
9287
- className: showGray && excluded ? cls.cbIconExcluded : ''
9288
- }));
9289
- };
9290
- function ListboxCheckbox(_ref2) {
9291
- let {
9292
- checked,
9293
- label,
9294
- dense,
9295
- excluded,
9296
- showGray = true
9297
- } = _ref2;
9298
- return /*#__PURE__*/React__default.createElement(StyledCheckbox, {
9299
- edge: "start",
9300
- checked: checked,
9301
- disableRipple: true,
9302
- className: [classes$c.checkbox, dense && classes$c.dense].filter(Boolean).join(' '),
9303
- inputProps: {
9304
- 'aria-labelledby': label
9305
- },
9306
- name: label,
9307
- icon: getIcon(classes$c, showGray, excluded),
9308
- checkedIcon: /*#__PURE__*/React__default.createElement("span", {
9309
- className: classes$c.cbIconChecked
9310
- })
9311
- });
9312
- }
9313
-
9314
9172
  /**
9315
9173
  * @ignore
9316
9174
  * @interface Range
@@ -9375,45 +9233,6 @@ function getSegmentsFromRanges(label, ranges) {
9375
9233
  return labels;
9376
9234
  }
9377
9235
 
9378
- const PREFIX$b = 'ListBoxRadioButton';
9379
- const classes$b = {
9380
- denseRadioButton: "".concat(PREFIX$b, "-denseRadioButton"),
9381
- radioButton: "".concat(PREFIX$b, "-radioButton")
9382
- };
9383
- const StyledRadio = styled$1(Radio)(_ref => {
9384
- let {
9385
- theme,
9386
- checked
9387
- } = _ref;
9388
- return {
9389
- ["&.".concat(classes$b.radioButton)]: {
9390
- right: '5px',
9391
- color: checked ? theme.palette.selected.main : theme.palette.main
9392
- }
9393
- };
9394
- });
9395
- function ListBoxRadioButton(_ref2) {
9396
- let {
9397
- checked,
9398
- label,
9399
- dense
9400
- } = _ref2;
9401
- return /*#__PURE__*/React__default.createElement(StyledRadio, {
9402
- checked: checked,
9403
- value: label,
9404
- name: label,
9405
- className: classes$b.radioButton,
9406
- style: {
9407
- backgroundColor: 'transparent'
9408
- },
9409
- disableRipple: true,
9410
- size: dense ? 'small' : 'medium',
9411
- sx: dense && {
9412
- padding: '0px 0px 0px 12px'
9413
- }
9414
- });
9415
- }
9416
-
9417
9236
  const KEYS = Object.freeze({
9418
9237
  ENTER: 13,
9419
9238
  ESCAPE: 27,
@@ -9639,12 +9458,691 @@ function getListboxInlineKeyboardNavigation(_ref2) {
9639
9458
  setHovering(false);
9640
9459
  containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : (_containerRef$current4 = _containerRef$current3.blur) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.call(_containerRef$current3);
9641
9460
  }
9642
- };
9643
- return {
9644
- handleKeyDown,
9645
- handleOnMouseEnter,
9646
- handleOnMouseLeave
9647
- };
9461
+ };
9462
+ return {
9463
+ handleKeyDown,
9464
+ handleOnMouseEnter,
9465
+ handleOnMouseLeave
9466
+ };
9467
+ }
9468
+
9469
+ const PREFIX$c = 'RowColumn';
9470
+ const rowColClasses = {
9471
+ row: "".concat(PREFIX$c, "-row"),
9472
+ rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
9473
+ column: "".concat(PREFIX$c, "-column"),
9474
+ fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
9475
+ cell: "".concat(PREFIX$c, "-cell"),
9476
+ labelText: "".concat(PREFIX$c, "-labelText"),
9477
+ labelDense: "".concat(PREFIX$c, "-labelDense"),
9478
+ highlighted: "".concat(PREFIX$c, "-highlighted"),
9479
+ checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
9480
+ icon: "".concat(PREFIX$c, "-icon"),
9481
+ S: "".concat(PREFIX$c, "-S"),
9482
+ XS: "".concat(PREFIX$c, "-XS"),
9483
+ A: "".concat(PREFIX$c, "-A"),
9484
+ X: "".concat(PREFIX$c, "-X"),
9485
+ frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
9486
+ barContainer: "".concat(PREFIX$c, "-barContainer"),
9487
+ bar: "".concat(PREFIX$c, "-bar"),
9488
+ barSelected: "".concat(PREFIX$c, "-barSelected"),
9489
+ barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
9490
+ barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
9491
+ excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
9492
+ };
9493
+
9494
+ const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
9495
+ const isAlternative = c => c ? c.qState === 'A' : null;
9496
+ const excludedOrAlternative = _ref => {
9497
+ let {
9498
+ cell,
9499
+ checkboxes
9500
+ } = _ref;
9501
+ return (isAlternative(cell) || isExcluded(cell)) && checkboxes;
9502
+ };
9503
+ const getValueStateClasses = _ref2 => {
9504
+ let {
9505
+ column,
9506
+ histogram,
9507
+ checkboxes,
9508
+ cell,
9509
+ showGray
9510
+ } = _ref2;
9511
+ const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
9512
+ if (!histogram) {
9513
+ clazzArr.push(rowColClasses.rowBorderBottom);
9514
+ }
9515
+ if (!cell) {
9516
+ return [];
9517
+ }
9518
+ if (!checkboxes) {
9519
+ if (cell.qState === 'XS') {
9520
+ clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
9521
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
9522
+ clazzArr.push(rowColClasses.S);
9523
+ } else if (showGray && isAlternative(cell)) {
9524
+ clazzArr.push(rowColClasses.A);
9525
+ } else if (showGray && isExcluded(cell)) {
9526
+ clazzArr.push(rowColClasses.X);
9527
+ }
9528
+ }
9529
+ return clazzArr;
9530
+ };
9531
+
9532
+ const frequencyTextNone = '-';
9533
+ const barPadPx = 4;
9534
+ const barBorderWidthPx = 1;
9535
+ const barWithCheckboxLeftPadPx = 29;
9536
+
9537
+ const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
9538
+ const getBarWidth = _ref => {
9539
+ let {
9540
+ qFrequency,
9541
+ checkboxes,
9542
+ frequencyMax
9543
+ } = _ref;
9544
+ const freqStr = String(qFrequency);
9545
+ const isPercent = freqStr.substring(freqStr.length - 1) === '%';
9546
+ const freq = parseFloat(isPercent ? freqStr : qFrequency);
9547
+ const rightSlice = checkboxes ? "(".concat(barWithCheckboxLeftPadPx, "px + ").concat(barPadPx + barBorderWidthPx * 2, "px)") : "".concat(barPadPx * 2 + barBorderWidthPx * 2, "px");
9548
+ const width = isPercent ? freq : freq / frequencyMax * 100;
9549
+ return "calc(".concat(width, "% - ").concat(rightSlice, ")");
9550
+ };
9551
+ const getFrequencyText = _ref2 => {
9552
+ let {
9553
+ cell
9554
+ } = _ref2;
9555
+ if (cell) {
9556
+ return cell.qFrequency ? cell.qFrequency : frequencyTextNone;
9557
+ }
9558
+ return '';
9559
+ };
9560
+
9561
+ const ICON_PADDING = 7;
9562
+ const CELL_PADDING_LEFT = 9;
9563
+
9564
+ const getSelectedStyle = _ref => {
9565
+ let {
9566
+ theme
9567
+ } = _ref;
9568
+ return {
9569
+ background: theme.palette.selected.main,
9570
+ color: theme.palette.selected.mainContrastText,
9571
+ '&:focus': {
9572
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder),
9573
+ outline: 'none'
9574
+ },
9575
+ '& $cell': {
9576
+ paddingRight: 0
9577
+ }
9578
+ };
9579
+ };
9580
+ const ellipsis = {
9581
+ width: '100%',
9582
+ overflow: 'hidden',
9583
+ textOverflow: 'ellipsis',
9584
+ whiteSpace: 'nowrap'
9585
+ };
9586
+ const RowColRoot = styled$1('div', {
9587
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
9588
+ })(_ref2 => {
9589
+ 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;
9590
+ let {
9591
+ theme,
9592
+ flexBasisProp,
9593
+ isGridMode,
9594
+ isGridCol,
9595
+ dense,
9596
+ frequencyWidth
9597
+ } = _ref2;
9598
+ return {
9599
+ '&:focus': {
9600
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
9601
+ },
9602
+ '&:focus-visible': {
9603
+ outline: 'none'
9604
+ },
9605
+ ["& .".concat(rowColClasses.row)]: {
9606
+ flexWrap: 'nowrap',
9607
+ color: (_theme$listBox$conten = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : (_theme$listBox$conten2 = _theme$listBox.content) === null || _theme$listBox$conten2 === void 0 ? void 0 : _theme$listBox$conten2.color) !== null && _theme$listBox$conten !== void 0 ? _theme$listBox$conten : theme.palette.text.primary
9608
+ },
9609
+ ["& .".concat(rowColClasses.rowBorderBottom)]: {
9610
+ borderBottom: isGridCol ? 'none' : "1px solid ".concat(theme.palette.divider),
9611
+ borderLeft: isGridCol ? "1px solid ".concat(theme.palette.divider) : 'none'
9612
+ },
9613
+ ["& .".concat(rowColClasses.column)]: {
9614
+ flexWrap: 'nowrap',
9615
+ borderRight: "1px solid ".concat(theme.palette.divider),
9616
+ color: (_theme$listBox$conten3 = (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 ? void 0 : (_theme$listBox2$conte = _theme$listBox2.content) === null || _theme$listBox2$conte === void 0 ? void 0 : _theme$listBox2$conte.color) !== null && _theme$listBox$conten3 !== void 0 ? _theme$listBox$conten3 : theme.palette.text.primary
9617
+ },
9618
+ // The interior wrapper for all field content.
9619
+ ["& .".concat(rowColClasses.cell)]: {
9620
+ display: 'flex',
9621
+ alignItems: 'center',
9622
+ minWidth: 0,
9623
+ flexGrow: 1,
9624
+ // Note that this padding is overridden when using checkboxes.
9625
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
9626
+ paddingRight: 0
9627
+ },
9628
+ // The leaf node, containing the label text.
9629
+ ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
9630
+ flexBasis: flexBasisProp,
9631
+ lineHeight: '16px',
9632
+ userSelect: 'none',
9633
+ paddingRight: '1px'
9634
+ }, ellipsis), {}, {
9635
+ whiteSpace: 'pre',
9636
+ // to keep white-space on highlight
9637
+ 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,
9638
+ 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
9639
+ }),
9640
+ ["& .".concat(rowColClasses.labelDense)]: {
9641
+ fontSize: 12
9642
+ },
9643
+ // Highlight is added to labelText spans, which are created as siblings to original labelText,
9644
+ // when a search string is matched.
9645
+ ["& .".concat(rowColClasses.highlighted)]: {
9646
+ overflow: 'visible',
9647
+ width: '100%',
9648
+ '& > span': {
9649
+ width: '100%',
9650
+ backgroundColor: '#FFC72A'
9651
+ }
9652
+ },
9653
+ // Checkbox and label container.
9654
+ ["& .".concat(rowColClasses.checkboxLabel)]: {
9655
+ margin: 0,
9656
+ width: '100%',
9657
+ height: '100%',
9658
+ overflow: 'hidden',
9659
+ // The checkbox's span
9660
+ '& > span:nth-of-type(1)': {
9661
+ paddingRight: '8px'
9662
+ },
9663
+ // The checkbox's label container.
9664
+ '& > span:nth-of-type(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
9665
+ display: 'flex',
9666
+ alignItems: 'center',
9667
+ paddingLeft: 0,
9668
+ paddingRight: '2px'
9669
+ })
9670
+ },
9671
+ // The icons container holding tick and lock, shown inside fields.
9672
+ ["& .".concat(rowColClasses.icon)]: {
9673
+ display: 'flex',
9674
+ justifyContent: 'center',
9675
+ width: 24,
9676
+ minWidth: 24,
9677
+ maxWidth: 24
9678
+ },
9679
+ // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
9680
+ ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
9681
+ theme
9682
+ })), {}, {
9683
+ border: isGridMode ? 'none' : undefined
9684
+ }),
9685
+ ["& .".concat(rowColClasses.XS)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
9686
+ theme
9687
+ })), {}, {
9688
+ background: theme.palette.selected.excluded,
9689
+ color: theme.palette.selected.mainContrastText,
9690
+ border: isGridMode ? 'none' : undefined
9691
+ }),
9692
+ ["& .".concat(rowColClasses.A)]: {
9693
+ background: theme.palette.selected.alternative,
9694
+ color: theme.palette.selected.alternativeContrastText,
9695
+ border: isGridMode ? 'none' : undefined
9696
+ },
9697
+ ["& .".concat(rowColClasses.X)]: {
9698
+ background: theme.palette.selected.excluded,
9699
+ color: theme.palette.selected.excludedContrastText,
9700
+ border: isGridMode ? 'none' : undefined
9701
+ },
9702
+ ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
9703
+ justifyContent: 'flex-end'
9704
+ }, ellipsis), {}, {
9705
+ flex: "0 1 ".concat(frequencyWidth, "px"),
9706
+ textAlign: 'right',
9707
+ paddingLeft: '2px'
9708
+ }),
9709
+ ["&.".concat(rowColClasses.barContainer)]: {
9710
+ height: '100%',
9711
+ display: 'flex',
9712
+ alignItems: 'center'
9713
+ },
9714
+ ["& .".concat(rowColClasses.bar)]: {
9715
+ border: "".concat(barBorderWidthPx, "px solid"),
9716
+ borderColor: '#D9D9D9',
9717
+ height: dense ? '16px' : '20px',
9718
+ position: 'absolute',
9719
+ zIndex: '-1',
9720
+ alignSelf: 'center',
9721
+ left: "".concat(barPadPx, "px"),
9722
+ transition: 'width 0.2s',
9723
+ backgroundColor: '#FAFAFA'
9724
+ },
9725
+ ["& .".concat(rowColClasses.barSelected)]: {
9726
+ opacity: '30%',
9727
+ zIndex: '0',
9728
+ background: theme.palette.background.lighter
9729
+ },
9730
+ ["& .".concat(rowColClasses.barWithCheckbox)]: {
9731
+ left: "".concat(barWithCheckboxLeftPadPx, "px")
9732
+ },
9733
+ ["& .".concat(rowColClasses.barSelectedWithCheckbox)]: {
9734
+ background: '#BFE5D0',
9735
+ borderColor: '#BFE5D0'
9736
+ },
9737
+ ["& .".concat(rowColClasses.excludedTextWithCheckbox)]: {
9738
+ color: '#828282',
9739
+ fontStyle: 'italic'
9740
+ }
9741
+ };
9742
+ });
9743
+ var RowColRoot$1 = React__default.memo(RowColRoot);
9744
+
9745
+ 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\")";
9746
+
9747
+ const PREFIX$b = 'ListBoxCheckbox';
9748
+ const borderRadius = 3;
9749
+ const classes$b = {
9750
+ cbIcon: "".concat(PREFIX$b, "-cbIcon"),
9751
+ cbIconChecked: "".concat(PREFIX$b, "-cbIconChecked"),
9752
+ cbIconExcluded: "".concat(PREFIX$b, "-cbIconExcluded"),
9753
+ cbIconAlternative: "".concat(PREFIX$b, "-cbIconAlternative"),
9754
+ checkbox: "".concat(PREFIX$b, "-checkbox"),
9755
+ dense: "".concat(PREFIX$b, "-dense")
9756
+ };
9757
+ const StyledCheckbox = styled$1(Checkbox)(_ref => {
9758
+ let {
9759
+ theme
9760
+ } = _ref;
9761
+ return {
9762
+ ["& .".concat(classes$b.cbIcon)]: {
9763
+ borderRadius,
9764
+ width: 16,
9765
+ height: 16,
9766
+ boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
9767
+ backgroundColor: '#f5f8fa',
9768
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
9769
+ display: 'flex',
9770
+ alignItems: 'center',
9771
+ justifyContent: 'center'
9772
+ },
9773
+ ["& .".concat(classes$b.cbIconChecked)]: {
9774
+ borderRadius,
9775
+ backgroundColor: theme.palette.selected.main,
9776
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
9777
+ '&:before': {
9778
+ display: 'block',
9779
+ width: 16,
9780
+ height: 16,
9781
+ backgroundImage: CheckboxChecked,
9782
+ content: '""'
9783
+ }
9784
+ },
9785
+ ["& .".concat(classes$b.cbIconExcluded)]: {
9786
+ borderRadius: borderRadius - 1,
9787
+ width: 12,
9788
+ height: 12,
9789
+ backgroundColor: theme.palette.selected.excluded
9790
+ },
9791
+ ["& .".concat(classes$b.cbIconAlternative)]: {
9792
+ borderRadius: borderRadius - 1,
9793
+ width: 12,
9794
+ height: 12,
9795
+ backgroundColor: theme.palette.selected.alternative
9796
+ },
9797
+ ["&.".concat(classes$b.checkbox)]: {
9798
+ margin: 0,
9799
+ '&:hover': {
9800
+ backgroundColor: 'inherit !important'
9801
+ }
9802
+ },
9803
+ ["&.".concat(classes$b.dense)]: {
9804
+ padding: '4px 8px'
9805
+ }
9806
+ };
9807
+ });
9808
+ const getIcon = function (cls) {
9809
+ let showGray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9810
+ let excluded = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9811
+ return /*#__PURE__*/React__default.createElement("span", {
9812
+ className: cls.cbIcon
9813
+ }, excluded && /*#__PURE__*/React__default.createElement("span", {
9814
+ className: showGray && excluded ? cls.cbIconExcluded : ''
9815
+ }));
9816
+ };
9817
+ function ListboxCheckbox(_ref2) {
9818
+ let {
9819
+ onChange,
9820
+ checked,
9821
+ label,
9822
+ dense,
9823
+ excluded,
9824
+ showGray = true,
9825
+ dataN
9826
+ } = _ref2;
9827
+ return /*#__PURE__*/React__default.createElement(StyledCheckbox, {
9828
+ edge: "start",
9829
+ onChange: onChange,
9830
+ checked: checked,
9831
+ disableRipple: true,
9832
+ className: [classes$b.checkbox, dense && classes$b.dense].filter(Boolean).join(' '),
9833
+ inputProps: {
9834
+ 'aria-labelledby': label,
9835
+ 'data-n': dataN
9836
+ },
9837
+ name: label,
9838
+ icon: getIcon(classes$b, showGray, excluded),
9839
+ checkedIcon: /*#__PURE__*/React__default.createElement("span", {
9840
+ className: classes$b.cbIconChecked
9841
+ })
9842
+ });
9843
+ }
9844
+
9845
+ const PREFIX$a = 'ListBoxRadioButton';
9846
+ const classes$a = {
9847
+ denseRadioButton: "".concat(PREFIX$a, "-denseRadioButton"),
9848
+ radioButton: "".concat(PREFIX$a, "-radioButton")
9849
+ };
9850
+ const StyledRadio = styled$1(Radio)(_ref => {
9851
+ let {
9852
+ theme,
9853
+ checked
9854
+ } = _ref;
9855
+ return {
9856
+ ["&.".concat(classes$a.radioButton)]: {
9857
+ right: '5px',
9858
+ color: checked ? theme.palette.selected.main : theme.palette.main
9859
+ }
9860
+ };
9861
+ });
9862
+ function ListBoxRadioButton(_ref2) {
9863
+ let {
9864
+ onChange,
9865
+ checked,
9866
+ label,
9867
+ dense,
9868
+ dataN
9869
+ } = _ref2;
9870
+ return /*#__PURE__*/React__default.createElement(StyledRadio, {
9871
+ checked: checked,
9872
+ onChange: onChange,
9873
+ value: label,
9874
+ name: label,
9875
+ className: classes$a.radioButton,
9876
+ inputProps: {
9877
+ 'data-n': dataN
9878
+ },
9879
+ style: {
9880
+ backgroundColor: 'transparent'
9881
+ },
9882
+ disableRipple: true,
9883
+ size: dense ? 'small' : 'medium',
9884
+ sx: dense && {
9885
+ padding: '0px 0px 0px 12px'
9886
+ }
9887
+ });
9888
+ }
9889
+
9890
+ function ValueField(_ref) {
9891
+ let {
9892
+ label,
9893
+ color,
9894
+ highlighted = false,
9895
+ dense,
9896
+ showGray = true,
9897
+ checkboxes,
9898
+ cell,
9899
+ valueTextAlign
9900
+ } = _ref;
9901
+ return /*#__PURE__*/React__default.createElement(Typography, {
9902
+ component: "span",
9903
+ variant: "body2",
9904
+ className: joinClassNames([rowColClasses.labelText, highlighted && rowColClasses.highlighted, dense && rowColClasses.labelDense, showGray && excludedOrAlternative({
9905
+ cell,
9906
+ checkboxes
9907
+ }) && rowColClasses.excludedTextWithCheckbox]),
9908
+ color: color,
9909
+ align: valueTextAlign
9910
+ }, /*#__PURE__*/React__default.createElement("span", {
9911
+ style: {
9912
+ whiteSpace: 'pre'
9913
+ }
9914
+ }, label));
9915
+ }
9916
+
9917
+ function LabelTag(_ref) {
9918
+ let {
9919
+ label,
9920
+ color,
9921
+ highlighted,
9922
+ dense,
9923
+ showGray,
9924
+ checkboxes,
9925
+ cell,
9926
+ valueTextAlign
9927
+ } = _ref;
9928
+ if (typeof label === 'string') {
9929
+ return /*#__PURE__*/React__default.createElement(ValueField, {
9930
+ label: label,
9931
+ color: color,
9932
+ highlighted: highlighted,
9933
+ dense: dense,
9934
+ showGray: showGray,
9935
+ checkboxes: checkboxes,
9936
+ cell: cell,
9937
+ valueTextAlign: valueTextAlign
9938
+ });
9939
+ }
9940
+ return label;
9941
+ }
9942
+
9943
+ function CheckboxField(_ref) {
9944
+ let {
9945
+ onChange,
9946
+ label,
9947
+ color,
9948
+ qElemNumber,
9949
+ isSelected,
9950
+ dense,
9951
+ cell,
9952
+ isGridCol,
9953
+ showGray,
9954
+ isSingleSelect,
9955
+ highlighted,
9956
+ checkboxes,
9957
+ valueTextAlign
9958
+ } = _ref;
9959
+ const cb = /*#__PURE__*/React__default.createElement(ListboxCheckbox, {
9960
+ onChange: onChange,
9961
+ label: label,
9962
+ checked: isSelected,
9963
+ dense: dense,
9964
+ excluded: isExcluded(cell),
9965
+ isGridCol: isGridCol,
9966
+ showGray: showGray,
9967
+ dataN: qElemNumber
9968
+ });
9969
+ const rb = /*#__PURE__*/React__default.createElement(ListBoxRadioButton, {
9970
+ onChange: onChange,
9971
+ label: label,
9972
+ checked: isSelected,
9973
+ dense: dense,
9974
+ dataN: qElemNumber
9975
+ });
9976
+ return /*#__PURE__*/React__default.createElement(FormControlLabel, {
9977
+ color: color,
9978
+ control: isSingleSelect ? rb : cb,
9979
+ className: rowColClasses.checkboxLabel,
9980
+ label: /*#__PURE__*/React__default.createElement(LabelTag, {
9981
+ label: label,
9982
+ color: color,
9983
+ highlighted: highlighted,
9984
+ dense: dense,
9985
+ showGray: showGray,
9986
+ checkboxes: checkboxes,
9987
+ cell: cell,
9988
+ valueTextAlign: valueTextAlign
9989
+ }),
9990
+ key: qElemNumber
9991
+ });
9992
+ }
9993
+
9994
+ function LabelsWithRanges(_ref) {
9995
+ let {
9996
+ labels,
9997
+ dense,
9998
+ showGray,
9999
+ checkboxes
10000
+ } = _ref;
10001
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, labels.map((_ref2, index) => {
10002
+ let [label, highlighted] = _ref2;
10003
+ const key = "".concat(index);
10004
+ return /*#__PURE__*/React__default.createElement(ValueField, {
10005
+ label: label,
10006
+ key: key,
10007
+ highlighted: highlighted,
10008
+ dense: dense,
10009
+ showGray: showGray,
10010
+ checkboxes: checkboxes
10011
+ });
10012
+ }));
10013
+ }
10014
+ function FieldWithRanges(_ref3) {
10015
+ let {
10016
+ onChange,
10017
+ labels,
10018
+ checkboxes,
10019
+ dense,
10020
+ showGray,
10021
+ color,
10022
+ qElemNumber,
10023
+ isSelected,
10024
+ cell,
10025
+ isGridCol,
10026
+ isSingleSelect,
10027
+ valueTextAlign
10028
+ } = _ref3;
10029
+ const LWR = /*#__PURE__*/React__default.createElement(LabelsWithRanges, {
10030
+ labels: labels,
10031
+ dense: dense,
10032
+ showGray: showGray,
10033
+ checkboxes: checkboxes
10034
+ });
10035
+ return checkboxes ? /*#__PURE__*/React__default.createElement(CheckboxField, {
10036
+ onChange: onChange,
10037
+ label: LWR,
10038
+ color: color,
10039
+ qElemNumber: qElemNumber,
10040
+ isSelected: isSelected,
10041
+ dense: dense,
10042
+ cell: cell,
10043
+ isGridCol: isGridCol,
10044
+ showGray: showGray,
10045
+ isSingleSelect: isSingleSelect,
10046
+ checkboxes: checkboxes,
10047
+ valueTextAlign: valueTextAlign
10048
+ }) : LWR;
10049
+ }
10050
+
10051
+ function Field(_ref) {
10052
+ let {
10053
+ onChange,
10054
+ label,
10055
+ color,
10056
+ qElemNumber,
10057
+ isSelected,
10058
+ dense,
10059
+ cell,
10060
+ isGridCol,
10061
+ showGray,
10062
+ isSingleSelect,
10063
+ highlighted,
10064
+ checkboxes,
10065
+ valueTextAlign
10066
+ } = _ref;
10067
+ return checkboxes ? /*#__PURE__*/React__default.createElement(CheckboxField, {
10068
+ onChange: onChange,
10069
+ label: label,
10070
+ color: color,
10071
+ qElemNumber: qElemNumber,
10072
+ isSelected: isSelected,
10073
+ dense: dense,
10074
+ cell: cell,
10075
+ isGridCol: isGridCol,
10076
+ showGray: showGray,
10077
+ isSingleSelect: isSingleSelect,
10078
+ highlighted: highlighted,
10079
+ checkboxes: checkboxes,
10080
+ valueTextAlign: valueTextAlign
10081
+ }) : /*#__PURE__*/React__default.createElement(ValueField, {
10082
+ label: label,
10083
+ color: color,
10084
+ highlighted: false,
10085
+ dense: dense,
10086
+ showGray: true,
10087
+ checkboxes: checkboxes,
10088
+ cell: cell,
10089
+ valueTextAlign: valueTextAlign
10090
+ });
10091
+ }
10092
+ var Field$1 = React__default.memo(Field);
10093
+
10094
+ function Histogram(_ref) {
10095
+ let {
10096
+ cell,
10097
+ histogram,
10098
+ checkboxes,
10099
+ isSelected,
10100
+ frequencyMax
10101
+ } = _ref;
10102
+ const hasHistogramBar = cell && histogram && getFrequencyText({
10103
+ cell
10104
+ }) !== frequencyTextNone;
10105
+ if (!hasHistogramBar) {
10106
+ return undefined;
10107
+ }
10108
+ const width = getBarWidth({
10109
+ qFrequency: cell.qFrequency,
10110
+ checkboxes,
10111
+ frequencyMax
10112
+ });
10113
+ return /*#__PURE__*/React__default.createElement("div", {
10114
+ className: joinClassNames([rowColClasses.bar, checkboxes && rowColClasses.barWithCheckbox, isSelected && (checkboxes ? rowColClasses.barSelectedWithCheckbox : rowColClasses.barSelected)]),
10115
+ style: {
10116
+ width
10117
+ }
10118
+ });
10119
+ }
10120
+
10121
+ function Frequency(_ref) {
10122
+ let {
10123
+ cell,
10124
+ checkboxes,
10125
+ dense,
10126
+ showGray
10127
+ } = _ref;
10128
+ return /*#__PURE__*/React__default.createElement(Grid, {
10129
+ item: true,
10130
+ style: {
10131
+ display: 'flex',
10132
+ alignItems: 'center'
10133
+ },
10134
+ className: rowColClasses.frequencyCount
10135
+ }, /*#__PURE__*/React__default.createElement(Typography, {
10136
+ noWrap: true,
10137
+ color: "inherit",
10138
+ variant: "body2",
10139
+ className: joinClassNames([dense && rowColClasses.labelDense, rowColClasses.labelText, showGray && excludedOrAlternative({
10140
+ cell,
10141
+ checkboxes
10142
+ }) && rowColClasses.excludedTextWithCheckbox])
10143
+ }, getFrequencyText({
10144
+ cell
10145
+ })));
9648
10146
  }
9649
10147
 
9650
10148
  function getGridItemSizes(_ref) {
@@ -9664,243 +10162,69 @@ function getGridItemSizes(_ref) {
9664
10162
  case 'row':
9665
10163
  return {
9666
10164
  height: "calc(100% - ".concat(itemPadding, "px)"),
9667
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
10165
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
10166
+ position: 'absolute',
10167
+ left: 4
9668
10168
  };
9669
10169
  case 'column':
9670
10170
  return {
9671
10171
  height: "calc(100% - ".concat(itemPadding, "px)"),
9672
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
10172
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
10173
+ position: 'absolute',
10174
+ left: 4
9673
10175
  };
9674
10176
  default:
9675
10177
  return {};
9676
10178
  }
9677
10179
  }
9678
10180
 
9679
- const PREFIX$a = 'RowColumn';
9680
- const classes$a = {
9681
- row: "".concat(PREFIX$a, "-row"),
9682
- rowBorderBottom: "".concat(PREFIX$a, "-rowBorderBottom"),
9683
- column: "".concat(PREFIX$a, "-column"),
9684
- fieldRoot: "".concat(PREFIX$a, "-fieldRoot"),
9685
- cell: "".concat(PREFIX$a, "-cell"),
9686
- labelText: "".concat(PREFIX$a, "-labelText"),
9687
- labelDense: "".concat(PREFIX$a, "-labelDense"),
9688
- highlighted: "".concat(PREFIX$a, "-highlighted"),
9689
- checkboxLabel: "".concat(PREFIX$a, "-checkboxLabel"),
9690
- icon: "".concat(PREFIX$a, "-icon"),
9691
- S: "".concat(PREFIX$a, "-S"),
9692
- XS: "".concat(PREFIX$a, "-XS"),
9693
- A: "".concat(PREFIX$a, "-A"),
9694
- X: "".concat(PREFIX$a, "-X"),
9695
- frequencyCount: "".concat(PREFIX$a, "-frequencyCount"),
9696
- barContainer: "".concat(PREFIX$a, "-barContainer"),
9697
- bar: "".concat(PREFIX$a, "-bar"),
9698
- barSelected: "".concat(PREFIX$a, "-barSelected"),
9699
- barWithCheckbox: "".concat(PREFIX$a, "-barWithCheckbox"),
9700
- barSelectedWithCheckbox: "".concat(PREFIX$a, "-barSelectedWithCheckbox"),
9701
- excludedTextWithCheckbox: "".concat(PREFIX$a, "-excludedTextWithCheckbox")
9702
- };
9703
- const ellipsis = {
9704
- width: '100%',
9705
- overflow: 'hidden',
9706
- textOverflow: 'ellipsis'
9707
- };
9708
- const barPadPx = 4;
9709
- const barBorderWidthPx = 1;
9710
- const barWithCheckboxLeftPadPx = 29;
9711
- const frequencyTextNone = '-';
9712
- const getSelectedStyle = _ref => {
9713
- let {
9714
- theme
9715
- } = _ref;
9716
- return {
9717
- background: theme.palette.selected.main,
9718
- color: theme.palette.selected.mainContrastText,
9719
- '&:focus': {
9720
- boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder),
9721
- outline: 'none'
9722
- },
9723
- '& $cell': {
9724
- paddingRight: 0
9725
- }
9726
- };
9727
- };
9728
10181
  const ItemGrid = styled$1(Grid, {
9729
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding'].includes(prop)
9730
- })(_ref2 => {
10182
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'checkboxes'].includes(prop)
10183
+ })(_ref => {
9731
10184
  let {
9732
10185
  dataLayout,
9733
10186
  layoutOrder,
9734
- itemPadding
9735
- } = _ref2;
10187
+ itemPadding,
10188
+ checkboxes
10189
+ } = _ref;
9736
10190
  return {
9737
- ["&.".concat(classes$a.fieldRoot)]: getGridItemSizes({
10191
+ ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
9738
10192
  dataLayout,
9739
10193
  layoutOrder,
9740
10194
  itemPadding
10195
+ })), {}, {
10196
+ paddingRight: checkboxes ? '8px' : undefined
9741
10197
  })
9742
10198
  };
9743
10199
  });
9744
- const Root$1 = styled$1('div', {
9745
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense'].includes(prop)
9746
- })(_ref3 => {
9747
- 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;
10200
+
10201
+ function getCellFromPages(_ref) {
9748
10202
  let {
9749
- theme,
9750
- flexBasisProp,
9751
- isGridMode,
9752
- isGridCol,
9753
- dense
9754
- } = _ref3;
9755
- return {
9756
- '&:focus': {
9757
- boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
9758
- },
9759
- '&:focus-visible': {
9760
- outline: 'none'
9761
- },
9762
- ["& .".concat(classes$a.row)]: {
9763
- flexWrap: 'nowrap',
9764
- color: (_theme$listBox$conten = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : (_theme$listBox$conten2 = _theme$listBox.content) === null || _theme$listBox$conten2 === void 0 ? void 0 : _theme$listBox$conten2.color) !== null && _theme$listBox$conten !== void 0 ? _theme$listBox$conten : theme.palette.text.primary
9765
- },
9766
- ["& .".concat(classes$a.rowBorderBottom)]: {
9767
- borderBottom: isGridCol ? 'none' : "1px solid ".concat(theme.palette.divider),
9768
- borderLeft: isGridCol ? "1px solid ".concat(theme.palette.divider) : 'none'
9769
- },
9770
- ["& .".concat(classes$a.column)]: {
9771
- flexWrap: 'nowrap',
9772
- borderRight: "1px solid ".concat(theme.palette.divider),
9773
- color: (_theme$listBox$conten3 = (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 ? void 0 : (_theme$listBox2$conte = _theme$listBox2.content) === null || _theme$listBox2$conte === void 0 ? void 0 : _theme$listBox2$conte.color) !== null && _theme$listBox$conten3 !== void 0 ? _theme$listBox$conten3 : theme.palette.text.primary
9774
- },
9775
- // The interior wrapper for all field content.
9776
- ["& .".concat(classes$a.cell)]: {
9777
- display: 'flex',
9778
- alignItems: 'center',
9779
- minWidth: 0,
9780
- flexGrow: 1,
9781
- // Note that this padding is overridden when using checkboxes.
9782
- paddingLeft: '9px',
9783
- paddingRight: '9px'
9784
- },
9785
- // The leaf node, containing the label text.
9786
- ["& .".concat(classes$a.labelText)]: _objectSpread2(_objectSpread2({
9787
- flexBasis: flexBasisProp,
9788
- lineHeight: '16px',
9789
- userSelect: 'none',
9790
- whiteSpace: 'pre',
9791
- // to keep white-space on highlight
9792
- paddingRight: '9px'
9793
- }, ellipsis), {}, {
9794
- 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,
9795
- 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
9796
- }),
9797
- ["& .".concat(classes$a.labelDense)]: {
9798
- fontSize: 12
9799
- },
9800
- // Highlight is added to labelText spans, which are created as siblings to original labelText,
9801
- // when a search string is matched.
9802
- ["& .".concat(classes$a.highlighted)]: {
9803
- overflow: 'visible',
9804
- width: '100%',
9805
- '& > span': {
9806
- width: '100%',
9807
- backgroundColor: '#FFC72A'
9808
- }
9809
- },
9810
- // Checkbox and label container.
9811
- ["& .".concat(classes$a.checkboxLabel)]: {
9812
- margin: 0,
9813
- width: '100%',
9814
- height: '100%',
9815
- overflow: 'hidden',
9816
- // The checkbox's span
9817
- '& > span:nth-of-type(1)': {
9818
- paddingRight: '8px'
9819
- },
9820
- // The checkbox's label container.
9821
- '& > span:nth-of-type(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
9822
- display: 'flex',
9823
- alignItems: 'center',
9824
- paddingLeft: 0,
9825
- paddingRight: '2px'
9826
- })
9827
- },
9828
- // The icons container holding tick and lock, shown inside fields.
9829
- ["& .".concat(classes$a.icon)]: {
9830
- display: 'flex',
9831
- padding: theme.spacing(1, 1, 1, 0)
9832
- },
9833
- // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
9834
- ["& .".concat(classes$a.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
9835
- theme
9836
- })), {}, {
9837
- border: isGridMode ? 'none' : undefined
9838
- }),
9839
- ["& .".concat(classes$a.XS)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
9840
- theme
9841
- })), {}, {
9842
- background: theme.palette.selected.excluded,
9843
- color: theme.palette.selected.mainContrastText,
9844
- border: isGridMode ? 'none' : undefined
9845
- }),
9846
- ["& .".concat(classes$a.A)]: {
9847
- background: theme.palette.selected.alternative,
9848
- color: theme.palette.selected.alternativeContrastText,
9849
- border: isGridMode ? 'none' : undefined
9850
- },
9851
- ["& .".concat(classes$a.X)]: {
9852
- background: theme.palette.selected.excluded,
9853
- color: theme.palette.selected.excludedContrastText,
9854
- border: isGridMode ? 'none' : undefined
9855
- },
9856
- ["& .".concat(classes$a.frequencyCount)]: {
9857
- width: '66px',
9858
- justifyContent: 'flex-end'
9859
- },
9860
- ["&.".concat(classes$a.barContainer)]: {
9861
- height: '100%',
9862
- display: 'flex',
9863
- alignItems: 'center'
9864
- },
9865
- ["& .".concat(classes$a.bar)]: {
9866
- border: "".concat(barBorderWidthPx, "px solid"),
9867
- borderColor: '#D9D9D9',
9868
- height: dense ? '16px' : '20px',
9869
- position: 'absolute',
9870
- zIndex: '-1',
9871
- alignSelf: 'center',
9872
- left: "".concat(barPadPx, "px"),
9873
- transition: 'width 0.2s',
9874
- backgroundColor: '#FAFAFA'
9875
- },
9876
- ["& .".concat(classes$a.barSelected)]: {
9877
- opacity: '30%',
9878
- zIndex: '0',
9879
- background: theme.palette.background.lighter
9880
- },
9881
- ["& .".concat(classes$a.barWithCheckbox)]: {
9882
- left: "".concat(barWithCheckboxLeftPadPx, "px")
9883
- },
9884
- ["& .".concat(classes$a.barSelectedWithCheckbox)]: {
9885
- background: '#BFE5D0',
9886
- borderColor: '#BFE5D0'
9887
- },
9888
- ["& .".concat(classes$a.excludedTextWithCheckbox)]: {
9889
- color: '#828282',
9890
- fontStyle: 'italic'
10203
+ pages,
10204
+ cellIndex
10205
+ } = _ref;
10206
+ let c;
10207
+ const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
10208
+ if (page) {
10209
+ const area = page.qArea;
10210
+ if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
10211
+ [c] = page.qMatrix[cellIndex - area.qTop];
9891
10212
  }
9892
- };
9893
- });
9894
- function RowColumn(_ref4) {
9895
- var _cell$qText;
10213
+ }
10214
+ return c;
10215
+ }
10216
+
10217
+ function RowColumn(_ref) {
10218
+ var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
9896
10219
  let {
9897
10220
  index,
9898
10221
  rowIndex,
9899
10222
  columnIndex,
9900
10223
  style,
9901
10224
  data
9902
- } = _ref4;
10225
+ } = _ref;
9903
10226
  const {
10227
+ onChange,
9904
10228
  onClick,
9905
10229
  onMouseDown,
9906
10230
  onMouseUp,
@@ -9924,7 +10248,8 @@ function RowColumn(_ref4) {
9924
10248
  dataOffset,
9925
10249
  focusListItems,
9926
10250
  listCount,
9927
- itemPadding
10251
+ itemPadding,
10252
+ frequencyWidth
9928
10253
  } = data;
9929
10254
  const {
9930
10255
  dense = false,
@@ -9976,52 +10301,29 @@ function RowColumn(_ref4) {
9976
10301
  const handleKeyDownCallback = useCallback(getFieldKeyboardNavigation(_objectSpread2(_objectSpread2({}, actions), {}, {
9977
10302
  focusListItems
9978
10303
  })), [actions]);
9979
- const [isSelected, setSelected] = useState$1(false);
9980
- const [cell, setCell] = useState$1();
9981
- const [classArr, setClassArr] = useState$1([]);
9982
- useEffect$1(() => {
9983
- if (!pages) {
9984
- return;
9985
- }
9986
- let c;
9987
- const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
9988
- if (page) {
9989
- const area = page.qArea;
9990
- if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
9991
- [c] = page.qMatrix[cellIndex - area.qTop];
9992
- }
9993
- }
9994
- setCell(c);
9995
- }, [pages]);
9996
- const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
9997
- const isAlternative = c => c ? c.qState === 'A' : null;
9998
- useEffect$1(() => {
9999
- if (!cell) {
10000
- return;
10001
- }
10002
- const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
10003
- setSelected(selected);
10004
- const clazzArr = [column ? classes$a.column : classes$a.row];
10005
- if (!(histogram && (dense || checkboxes))) clazzArr.push(classes$a.rowBorderBottom);
10006
- if (!checkboxes) {
10007
- if (cell.qState === 'XS') {
10008
- clazzArr.push(showGray ? classes$a.XS : classes$a.S);
10009
- } else if (cell.qState === 'S' || cell.qState === 'L') {
10010
- clazzArr.push(classes$a.S);
10011
- } else if (showGray && isAlternative(cell)) {
10012
- clazzArr.push(classes$a.A);
10013
- } else if (showGray && isExcluded(cell)) {
10014
- clazzArr.push(classes$a.X);
10015
- }
10304
+ const cell = useMemo$1(() => getCellFromPages({
10305
+ pages,
10306
+ cellIndex
10307
+ }), [pages, cellIndex]);
10308
+ 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';
10309
+ const classArr = useMemo$1(() => getValueStateClasses({
10310
+ column,
10311
+ histogram,
10312
+ checkboxes,
10313
+ cell,
10314
+ showGray
10315
+ }), [cell === null || cell === void 0 ? void 0 : cell.qState, histogram, dense, checkboxes]);
10316
+ const preventContextMenu = useCallback(event => {
10317
+ if (checkboxes) {
10318
+ // Event will not propagate in the checkbox/radiobutton case
10319
+ onClick(event);
10016
10320
  }
10017
- setClassArr(clazzArr);
10018
- }, [cell && cell.qState, histogram, dense, checkboxes]);
10321
+ event.preventDefault();
10322
+ }, [checkboxes]);
10019
10323
  if (!cell) {
10020
10324
  return null; // prevent rendering empty rows
10021
10325
  }
10022
10326
 
10023
- const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
10024
- const excludedOrAlternative = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes;
10025
10327
  const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
10026
10328
  let valueTextAlign;
10027
10329
  const isAutoTextAlign = !textAlign || textAlign.auto;
@@ -10034,94 +10336,16 @@ function RowColumn(_ref4) {
10034
10336
  } else {
10035
10337
  valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
10036
10338
  }
10037
- const getValueField = _ref5 => {
10038
- let {
10039
- lbl,
10040
- ix,
10041
- color,
10042
- highlighted = false
10043
- } = _ref5;
10044
- return /*#__PURE__*/React__default.createElement(Typography, {
10045
- component: "span",
10046
- variant: "body2",
10047
- key: ix,
10048
- className: joinClassNames([classes$a.labelText, highlighted && classes$a.highlighted, dense && classes$a.labelDense, showGray && excludedOrAlternative() && classes$a.excludedTextWithCheckbox]),
10049
- color: color,
10050
- justifyContent: valueTextAlign
10051
- }, /*#__PURE__*/React__default.createElement("span", {
10052
- style: {
10053
- whiteSpace: 'pre'
10054
- }
10055
- }, lbl));
10056
- };
10057
- const preventContextMenu = event => {
10058
- if (checkboxes) {
10059
- // Event will not propagate in the checkbox/radiobutton case
10060
- onClick(event);
10061
- }
10062
- event.preventDefault();
10063
- };
10064
10339
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
10065
- const getCheckboxField = _ref6 => {
10066
- let {
10067
- lbl,
10068
- color,
10069
- qElemNumber
10070
- } = _ref6;
10071
- const cb = /*#__PURE__*/React__default.createElement(ListboxCheckbox, {
10072
- label: lbl,
10073
- checked: isSelected,
10074
- dense: dense,
10075
- excluded: isExcluded(cell),
10076
- isGridCol: isGridCol,
10077
- showGray: showGray
10078
- });
10079
- const rb = /*#__PURE__*/React__default.createElement(ListBoxRadioButton, {
10080
- label: lbl,
10081
- checked: isSelected,
10082
- dense: dense
10083
- });
10084
- const labelTag = typeof lbl === 'string' ? getValueField({
10085
- lbl,
10086
- color,
10087
- highlighted: false
10088
- }) : lbl;
10089
- return /*#__PURE__*/React__default.createElement(FormControlLabel, {
10090
- color: color,
10091
- control: isSingleSelect ? rb : cb,
10092
- className: classes$a.checkboxLabel,
10093
- label: labelTag,
10094
- key: qElemNumber
10095
- });
10096
- };
10097
10340
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
10098
- const getFrequencyText = () => {
10099
- if (cell) {
10100
- return cell.qFrequency ? cell.qFrequency : frequencyTextNone;
10101
- }
10102
- return '';
10103
- };
10104
10341
 
10105
10342
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
10106
- const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
10107
- const labels = getSegmentsFromRanges(label, ranges);
10108
- const getField = checkboxes ? getCheckboxField : getValueField;
10109
- const getFieldWithRanges = _ref7 => {
10110
- let {
10111
- lbls
10112
- } = _ref7;
10113
- const labelsWithRanges = lbls.map((_ref8, ix) => {
10114
- let [lbl, highlighted] = _ref8;
10115
- return getValueField({
10116
- ix,
10117
- highlighted,
10118
- lbl
10119
- });
10120
- });
10121
- return checkboxes ? getCheckboxField({
10122
- lbl: labelsWithRanges
10123
- }) : labelsWithRanges;
10124
- };
10343
+
10344
+ let labels;
10345
+ if ((_cell$qHighlightRange = cell.qHighlightRanges) !== null && _cell$qHighlightRange !== void 0 && (_cell$qHighlightRange2 = _cell$qHighlightRange.qRanges) !== null && _cell$qHighlightRange2 !== void 0 && _cell$qHighlightRange2.length) {
10346
+ const ranges = cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
10347
+ labels = getSegmentsFromRanges(label, ranges);
10348
+ }
10125
10349
  const iconStyles = {
10126
10350
  alignItems: 'center',
10127
10351
  display: 'flex',
@@ -10134,37 +10358,30 @@ function RowColumn(_ref4) {
10134
10358
  alignItems: 'center',
10135
10359
  minWidth: 0,
10136
10360
  flexGrow: 1,
10137
- padding: checkboxes ? 0 : undefined,
10361
+ paddingLeft: checkboxes ? 0 : undefined,
10138
10362
  justifyContent: valueTextAlign
10139
10363
  };
10140
- const hasHistogramBar = () => cell && histogram && getFrequencyText() !== frequencyTextNone;
10141
- const getBarWidth = qFrequency => {
10142
- const freqStr = String(qFrequency);
10143
- const isPercent = freqStr.substring(freqStr.length - 1) === '%';
10144
- const freq = parseFloat(isPercent ? freqStr : qFrequency);
10145
- const rightSlice = checkboxes ? "(".concat(barWithCheckboxLeftPadPx, "px + ").concat(barPadPx + barBorderWidthPx * 2, "px)") : "".concat(barPadPx * 2 + barBorderWidthPx * 2, "px");
10146
- const width = isPercent ? freq : freq / frequencyMax * 100;
10147
- return "calc(".concat(width, "% - ").concat(rightSlice, ")");
10148
- };
10149
10364
  const isFirstElement = index === 0;
10150
10365
  const flexBasisVal = checkboxes ? 'auto' : 'max-content';
10151
- return /*#__PURE__*/React__default.createElement(Root$1, {
10152
- className: classes$a.barContainer,
10366
+ return /*#__PURE__*/React__default.createElement(RowColRoot$1, {
10367
+ className: rowColClasses.barContainer,
10153
10368
  flexBasisProp: flexBasisVal,
10154
10369
  style: styles,
10155
10370
  isGridCol: isGridCol,
10156
10371
  isGridMode: dataLayout === 'grid',
10157
- dense: dense
10372
+ dense: dense,
10373
+ frequencyWidth: frequencyWidth
10158
10374
  }, /*#__PURE__*/React__default.createElement(ItemGrid, {
10159
10375
  ref: rowRef,
10160
10376
  container: true,
10161
10377
  dataLayout: dataLayout,
10378
+ checkboxes: checkboxes,
10162
10379
  layoutOrder: layoutOrder,
10163
10380
  itemPadding: itemPadding,
10164
10381
  gap: 0,
10165
10382
  className: joinClassNames(['value', ...classArr]),
10166
10383
  classes: {
10167
- root: classes$a.fieldRoot
10384
+ root: rowColClasses.fieldRoot
10168
10385
  },
10169
10386
  onClick: onClick,
10170
10387
  onMouseDown: onMouseDown,
@@ -10174,37 +10391,53 @@ function RowColumn(_ref4) {
10174
10391
  onContextMenu: preventContextMenu,
10175
10392
  role: column ? 'column' : 'row',
10176
10393
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
10177
- "data-n": cell && cell.qElemNumber
10178
- }, hasHistogramBar() && /*#__PURE__*/React__default.createElement("div", {
10179
- className: joinClassNames([classes$a.bar, checkboxes && classes$a.barWithCheckbox, isSelected && (checkboxes ? classes$a.barSelectedWithCheckbox : classes$a.barSelected)]),
10180
- style: {
10181
- width: getBarWidth(cell.qFrequency)
10182
- }
10394
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
10395
+ }, /*#__PURE__*/React__default.createElement(Histogram, {
10396
+ cell: cell,
10397
+ histogram: histogram,
10398
+ checkboxes: checkboxes,
10399
+ isSelected: isSelected,
10400
+ frequencyMax: frequencyMax
10183
10401
  }), /*#__PURE__*/React__default.createElement(Grid, {
10184
10402
  item: true,
10185
10403
  style: cellStyle,
10186
- className: joinClassNames([classes$a.cell, classes$a.selectedCell]),
10404
+ className: joinClassNames([rowColClasses.cell, rowColClasses.selectedCell]),
10187
10405
  title: "".concat(label)
10188
- }, ranges.length === 0 ? getField({
10189
- lbl: label,
10190
- color: 'inherit'
10191
- }) : getFieldWithRanges({
10192
- lbls: labels
10193
- })), freqIsAllowed && /*#__PURE__*/React__default.createElement(Grid, {
10194
- item: true,
10195
- style: {
10196
- display: 'flex',
10197
- alignItems: 'center'
10198
- },
10199
- className: classes$a.frequencyCount
10200
- }, /*#__PURE__*/React__default.createElement(Typography, {
10201
- noWrap: true,
10406
+ }, labels ? /*#__PURE__*/React__default.createElement(FieldWithRanges, {
10407
+ onChange: onChange,
10408
+ labels: labels,
10409
+ checkboxes: checkboxes,
10410
+ dense: dense,
10411
+ showGray: showGray,
10412
+ color: "inherit" // TODO: Check this
10413
+ ,
10414
+ qElemNumber: cell.qElemNumber,
10415
+ isSelected: isSelected,
10416
+ cell: cell,
10417
+ isGridCol: isGridCol,
10418
+ isSingleSelect: isSingleSelect,
10419
+ valueTextAlign: valueTextAlign
10420
+ }) : /*#__PURE__*/React__default.createElement(Field$1, {
10421
+ onChange: onChange,
10422
+ label: label,
10202
10423
  color: "inherit",
10203
- variant: "body2",
10204
- className: joinClassNames([dense && classes$a.labelDense, classes$a.labelText, showGray && excludedOrAlternative() && classes$a.excludedTextWithCheckbox])
10205
- }, getFrequencyText())), !checkboxes && /*#__PURE__*/React__default.createElement(Grid, {
10424
+ qElemNumber: cell.qElemNumber,
10425
+ isSelected: isSelected,
10426
+ dense: dense,
10427
+ cell: cell,
10428
+ isGridCol: isGridCol,
10429
+ showGray: showGray,
10430
+ isSingleSelect: isSingleSelect,
10431
+ checkboxes: checkboxes,
10432
+ valueTextAlign: valueTextAlign
10433
+ })), freqIsAllowed && /*#__PURE__*/React__default.createElement(Frequency, {
10434
+ cell: cell,
10435
+ checkboxes: checkboxes,
10436
+ dense: dense,
10437
+ showGray: showGray
10438
+ }), !checkboxes && /*#__PURE__*/React__default.createElement(Grid, {
10206
10439
  item: true,
10207
- className: classes$a.icon
10440
+ className: rowColClasses.icon
10208
10441
  }, !showLock && !showTick && /*#__PURE__*/React__default.createElement("span", {
10209
10442
  style: {
10210
10443
  minWidth: '12px'
@@ -10218,21 +10451,6 @@ function RowColumn(_ref4) {
10218
10451
  }))));
10219
10452
  }
10220
10453
 
10221
- const FREQUENCY_MIN_SHOW_WIDTH = 80;
10222
- function getFrequencyAllowed(_ref) {
10223
- let {
10224
- width,
10225
- layout,
10226
- frequencyMode
10227
- } = _ref;
10228
- const widthPermitsFreq = width > FREQUENCY_MIN_SHOW_WIDTH;
10229
- const {
10230
- frequencyEnabled = false
10231
- } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
10232
- const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
10233
- return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
10234
- }
10235
-
10236
10454
  function deriveRenderOptions(options) {
10237
10455
  const {
10238
10456
  renderProps,
@@ -11679,8 +11897,9 @@ const classes$9 = {
11679
11897
  styledScrollbars: "".concat(PREFIX$9, "-styledScrollbars")
11680
11898
  };
11681
11899
  function getStyledComponents() {
11682
- const scrollbarStyling = {
11900
+ const getScrollbarStyling = scrollDisabled => ({
11683
11901
  scrollbarColor: "".concat(scrollBarThumb, " ").concat(scrollBarBackground),
11902
+ overflow: scrollDisabled ? 'hidden !important' : undefined,
11684
11903
  '&::-webkit-scrollbar': {
11685
11904
  width: 10,
11686
11905
  height: 10
@@ -11695,42 +11914,27 @@ function getStyledComponents() {
11695
11914
  '&::-webkit-scrollbar-thumb:hover': {
11696
11915
  backgroundColor: scrollBarThumbHover
11697
11916
  }
11698
- };
11699
- const StyledFixedSizeList = styled$3(FixedSizeList)(() => ({
11700
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
11701
- // TODO: Verify these props and make generic together with grid component.
11702
- '&::-webkit-scrollbar': {
11703
- width: 10,
11704
- height: 10
11705
- },
11706
- '&::-webkit-scrollbar-track': {
11707
- backgroundColor: scrollBarBackground
11708
- },
11709
- '&::-webkit-scrollbar-thumb': {
11710
- backgroundColor: scrollBarThumb,
11711
- borderRadius: '1rem'
11712
- },
11713
- '&::-webkit-scrollbar-thumb:hover': {
11714
- backgroundColor: scrollBarThumbHover
11715
- }
11716
- }));
11717
- const StyledFixedSizeGrid = styled$3(FixedSizeGrid)(() => ({
11718
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
11719
- '&::-webkit-scrollbar': {
11720
- width: 10,
11721
- height: 10
11722
- },
11723
- '&::-webkit-scrollbar-track': {
11724
- backgroundColor: scrollBarBackground
11725
- },
11726
- '&::-webkit-scrollbar-thumb': {
11727
- backgroundColor: scrollBarThumb,
11728
- borderRadius: '1rem'
11729
- },
11730
- '&::-webkit-scrollbar-thumb:hover': {
11731
- backgroundColor: scrollBarThumbHover
11732
- }
11733
- }));
11917
+ });
11918
+ const StyledFixedSizeList = styled$3(FixedSizeList, {
11919
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
11920
+ })(_ref => {
11921
+ let {
11922
+ scrollDisabled
11923
+ } = _ref;
11924
+ return {
11925
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
11926
+ };
11927
+ });
11928
+ const StyledFixedSizeGrid = styled$3(FixedSizeGrid, {
11929
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
11930
+ })(_ref2 => {
11931
+ let {
11932
+ scrollDisabled
11933
+ } = _ref2;
11934
+ return {
11935
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
11936
+ };
11937
+ });
11734
11938
  return {
11735
11939
  StyledFixedSizeList,
11736
11940
  StyledFixedSizeGrid
@@ -11796,13 +12000,14 @@ function getListBoxComponents(_ref) {
11796
12000
  showGray,
11797
12001
  scrollState,
11798
12002
  direction,
11799
- listLayout,
11800
12003
  sizes,
11801
12004
  listCount,
11802
12005
  overflowDisclaimer,
11803
12006
  setScrollPosition,
11804
12007
  focusListItems,
11805
- setCurrentScrollIndex
12008
+ setCurrentScrollIndex,
12009
+ constraints,
12010
+ freqIsAllowed
11806
12011
  } = _ref;
11807
12012
  const {
11808
12013
  layoutOptions = {},
@@ -11813,7 +12018,8 @@ function getListBoxComponents(_ref) {
11813
12018
  listHeight,
11814
12019
  itemSize,
11815
12020
  rowCount,
11816
- columnCount
12021
+ columnCount,
12022
+ frequencyWidth
11817
12023
  } = sizes || {};
11818
12024
 
11819
12025
  // Options common for List and Grid.
@@ -11833,14 +12039,11 @@ function getListBoxComponents(_ref) {
11833
12039
  checkboxes,
11834
12040
  layoutOptions,
11835
12041
  frequencyMode,
11836
- freqIsAllowed: getFrequencyAllowed({
11837
- width,
11838
- layout,
11839
- frequencyMode
11840
- }),
12042
+ freqIsAllowed,
11841
12043
  isSingleSelect,
11842
12044
  textAlign,
11843
12045
  itemPadding,
12046
+ frequencyWidth,
11844
12047
  actions: {
11845
12048
  select,
11846
12049
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -11865,10 +12068,10 @@ function getListBoxComponents(_ref) {
11865
12068
  // eslint-disable-next-line react/jsx-props-no-spreading
11866
12069
  , _extends$6({}, commonComponentOptions, {
11867
12070
  dataTestid: "fixed-size-list",
12071
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
11868
12072
  height: listHeight,
11869
12073
  width: width,
11870
12074
  itemCount: listCount,
11871
- layout: listLayout,
11872
12075
  itemData: _objectSpread2(_objectSpread2({}, commonItemData), {}, {
11873
12076
  listCount
11874
12077
  }),
@@ -11943,6 +12146,7 @@ function getListBoxComponents(_ref) {
11943
12146
  // eslint-disable-next-line react/jsx-props-no-spreading
11944
12147
  , _extends$6({}, commonComponentOptions, {
11945
12148
  dataTestid: "fixed-size-grid",
12149
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
11946
12150
  height: gridHeight,
11947
12151
  width: width,
11948
12152
  columnCount: columnCount,
@@ -11967,6 +12171,9 @@ function getListBoxComponents(_ref) {
11967
12171
 
11968
12172
  const scrollBarWidth = 10; // TODO: ignore this - instead set the styling only show on hover...
11969
12173
 
12174
+ const ITEM_MIN_WIDTH = 56;
12175
+ const ITEM_MAX_WIDTH = 150;
12176
+ const FREQUENCY_WIDTH = 40;
11970
12177
  function getListSizes(_ref) {
11971
12178
  let {
11972
12179
  layout,
@@ -11974,7 +12181,8 @@ function getListSizes(_ref) {
11974
12181
  height,
11975
12182
  listCount,
11976
12183
  count,
11977
- textWidth
12184
+ textWidth,
12185
+ freqIsAllowed
11978
12186
  } = _ref;
11979
12187
  const {
11980
12188
  layoutOptions = {}
@@ -11986,7 +12194,8 @@ function getListSizes(_ref) {
11986
12194
  dense,
11987
12195
  dataLayout
11988
12196
  } = layoutOptions;
11989
- const columnAutoWidth = Math.min(150, textWidth + 18);
12197
+ const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
12198
+ const columnAutoWidth = Math.max(Math.min(ITEM_MAX_WIDTH, textWidth + 18 + frequencyAddWidth), ITEM_MIN_WIDTH + frequencyAddWidth);
11990
12199
  let overflowStyling;
11991
12200
  let columnCount;
11992
12201
  let columnWidth;
@@ -12003,18 +12212,21 @@ function getListSizes(_ref) {
12003
12212
  }
12004
12213
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemSize;
12005
12214
  if (layoutOrder) {
12215
+ // Modify container width to achieve the exact design with 8px margins on each side (left and right).
12216
+ let containerWidth = width;
12006
12217
  if (layoutOrder === 'row') {
12218
+ containerWidth += itemPadding * 2;
12007
12219
  overflowStyling = {
12008
12220
  overflowX: 'hidden'
12009
12221
  };
12010
12222
  const maxColumns = (maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.maxColumns) || 3;
12011
12223
  if ((maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.auto) !== false) {
12012
- columnCount = Math.min(listCount, Math.ceil((width - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
12224
+ columnCount = Math.min(listCount, Math.ceil((containerWidth - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
12013
12225
  } else {
12014
12226
  columnCount = Math.min(listCount, maxColumns);
12015
12227
  }
12016
12228
  rowCount = Math.ceil(listCount / columnCount);
12017
- columnWidth = (width - scrollBarWidth) / columnCount;
12229
+ columnWidth = (containerWidth - scrollBarWidth) / columnCount;
12018
12230
  } else {
12019
12231
  overflowStyling = {
12020
12232
  overflowY: 'hidden'
@@ -12026,7 +12238,7 @@ function getListSizes(_ref) {
12026
12238
  rowCount = Math.min(listCount, maxRows);
12027
12239
  }
12028
12240
  columnCount = Math.ceil(listCount / rowCount);
12029
- columnWidth = Math.max(columnAutoWidth, width / columnCount);
12241
+ columnWidth = Math.max(columnAutoWidth, containerWidth / columnCount);
12030
12242
  }
12031
12243
  }
12032
12244
  columnCount = (dataLayout === 'singleColumn' ? 1 : columnCount) || 1;
@@ -12052,7 +12264,8 @@ function getListSizes(_ref) {
12052
12264
  row: maxRowCount,
12053
12265
  column: maxColumnCount
12054
12266
  },
12055
- itemPadding
12267
+ itemPadding,
12268
+ frequencyWidth: FREQUENCY_WIDTH
12056
12269
  };
12057
12270
  }
12058
12271
 
@@ -12548,18 +12761,35 @@ function getScrollIndex(_ref) {
12548
12761
  };
12549
12762
  }
12550
12763
 
12764
+ const FREQUENCY_MIN_SHOW_WIDTH = 80;
12765
+ function getFrequencyAllowed(_ref) {
12766
+ let {
12767
+ itemWidth,
12768
+ layout,
12769
+ frequencyMode
12770
+ } = _ref;
12771
+ const widthPermitsFreq = itemWidth > FREQUENCY_MIN_SHOW_WIDTH;
12772
+ const {
12773
+ frequencyEnabled = false
12774
+ } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
12775
+ const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
12776
+ return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
12777
+ }
12778
+
12551
12779
  const _excluded$4 = ["isLoadingData"];
12552
12780
  const DEFAULT_MIN_BATCH_SIZE = 100;
12553
12781
  function ListBox(_ref) {
12554
12782
  var _layout$qListObject$q, _loaderRef$current, _loaderRef$current$_l, _loaderRef$current$_l2;
12555
12783
  let {
12556
12784
  model,
12785
+ constraints,
12786
+ layout,
12557
12787
  selections,
12788
+ selectionState,
12558
12789
  direction,
12559
12790
  checkboxes: checkboxOption,
12560
12791
  height,
12561
12792
  width,
12562
- listLayout = 'vertical',
12563
12793
  frequencyMode,
12564
12794
  update = undefined,
12565
12795
  fetchStart = undefined,
@@ -12578,7 +12808,6 @@ function ListBox(_ref) {
12578
12808
  }
12579
12809
  } = _ref;
12580
12810
  const [initScrollPosIsSet, setInitScrollPosIsSet] = useState$1(false);
12581
- const [layout] = useLayout$1(model);
12582
12811
  const isSingleSelect = !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne);
12583
12812
  const {
12584
12813
  checkboxes = checkboxOption,
@@ -12605,11 +12834,7 @@ function ListBox(_ref) {
12605
12834
  postProcessPages,
12606
12835
  listData
12607
12836
  }),
12608
- {
12609
- isLoadingData
12610
- } = _useItemsLoader,
12611
12837
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
12612
- const [pages, setPages] = useState$1([]);
12613
12838
  const {
12614
12839
  setStoreValue
12615
12840
  } = useDataStore(model);
@@ -12621,9 +12846,16 @@ function ListBox(_ref) {
12621
12846
  const showOverflowDisclaimer = show => setOverflowDisclaimer(state => _objectSpread2(_objectSpread2({}, state), {}, {
12622
12847
  show
12623
12848
  }));
12624
- useEffect$1(() => {
12625
- setPages((itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages) || []);
12626
- }, [itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages]);
12849
+ const [pages, setPages] = useState$1([]);
12850
+ if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
12851
+ selectionState.update({
12852
+ setPages,
12853
+ pages: itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages,
12854
+ isSingleSelect,
12855
+ selectDisabled,
12856
+ layout
12857
+ });
12858
+ }
12627
12859
  const isItemLoaded = useCallback(index => {
12628
12860
  if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
12629
12861
  return false;
@@ -12634,17 +12866,13 @@ function ListBox(_ref) {
12634
12866
  return page && isLoaded(page);
12635
12867
  }, [layout, pages]);
12636
12868
  const {
12637
- instantPages = [],
12638
12869
  interactionEvents,
12639
12870
  select
12640
12871
  } = useSelectionsInteractions({
12641
- layout,
12872
+ selectionState,
12642
12873
  selections,
12643
- pages,
12644
12874
  checkboxes,
12645
- selectDisabled,
12646
- doc: document,
12647
- isSingleSelect
12875
+ doc: document
12648
12876
  });
12649
12877
  const {
12650
12878
  layoutOptions = {}
@@ -12684,12 +12912,6 @@ function ListBox(_ref) {
12684
12912
  // Hand over the update function for manual refresh from hosting application.
12685
12913
  update.call(null, fetchData);
12686
12914
  }
12687
- useEffect$1(() => {
12688
- if (!instantPages || isLoadingData) {
12689
- return;
12690
- }
12691
- setPages(instantPages);
12692
- }, [instantPages]);
12693
12915
  useEffect$1(() => {
12694
12916
  if (scrollState && !initScrollPosIsSet && loaderRef.current) {
12695
12917
  loaderRef.current._listRef.scrollToItem(scrollState.initScrollPos);
@@ -12704,7 +12926,7 @@ function ListBox(_ref) {
12704
12926
  font: '14px Source sans pro'
12705
12927
  });
12706
12928
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
12707
- const isVertical = layoutOptions.dataLayout ? layoutOptions.dataLayout === 'singleColumn' : listLayout !== 'horizontal';
12929
+ const isVertical = layoutOptions.dataLayout !== 'grid';
12708
12930
  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;
12709
12931
  const unlimitedListCount = getListCount({
12710
12932
  pages,
@@ -12714,14 +12936,28 @@ function ListBox(_ref) {
12714
12936
  layoutOptions,
12715
12937
  model
12716
12938
  });
12939
+ let freqIsAllowed = getFrequencyAllowed({
12940
+ itemWidth: width,
12941
+ layout,
12942
+ frequencyMode
12943
+ });
12717
12944
  const sizes = getListSizes({
12718
12945
  layout,
12719
12946
  width,
12720
12947
  height,
12721
12948
  listCount: unlimitedListCount,
12722
12949
  count,
12723
- textWidth
12950
+ textWidth,
12951
+ freqIsAllowed
12724
12952
  });
12953
+ if (sizes.columnWidth) {
12954
+ // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
12955
+ freqIsAllowed = getFrequencyAllowed({
12956
+ itemWidth: sizes.columnWidth,
12957
+ layout,
12958
+ frequencyMode
12959
+ });
12960
+ }
12725
12961
  const {
12726
12962
  listCount
12727
12963
  } = sizes;
@@ -12740,7 +12976,7 @@ function ListBox(_ref) {
12740
12976
  });
12741
12977
  local.current.dataOffset = offset;
12742
12978
  if (triggerRerender) {
12743
- setPages(currentPages => [...currentPages]);
12979
+ selectionState.triggerStateChanged();
12744
12980
  }
12745
12981
  scrollToIndex(scrollIndex);
12746
12982
  };
@@ -12807,7 +13043,9 @@ function ListBox(_ref) {
12807
13043
  },
12808
13044
  setScrollPosition,
12809
13045
  focusListItems: getFocusState(),
12810
- setCurrentScrollIndex: currentScrollIndex.set
13046
+ setCurrentScrollIndex: currentScrollIndex.set,
13047
+ constraints,
13048
+ freqIsAllowed
12811
13049
  });
12812
13050
  const {
12813
13051
  columnWidth,
@@ -12885,7 +13123,8 @@ var createListboxSelectionToolbar = (_ref => {
12885
13123
  let {
12886
13124
  layout,
12887
13125
  model,
12888
- translator
13126
+ translator,
13127
+ selectionState
12889
13128
  } = _ref;
12890
13129
  if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
12891
13130
  return [];
@@ -12901,6 +13140,7 @@ var createListboxSelectionToolbar = (_ref => {
12901
13140
  getSvgIconShape: selectAll,
12902
13141
  enabled: canSelectAll,
12903
13142
  action: () => {
13143
+ selectionState.clearItemStates(false);
12904
13144
  model.selectListObjectAll('/qListObjectDef');
12905
13145
  }
12906
13146
  }, {
@@ -12910,6 +13150,7 @@ var createListboxSelectionToolbar = (_ref => {
12910
13150
  getSvgIconShape: selectPossible,
12911
13151
  enabled: canSelectPossible,
12912
13152
  action: () => {
13153
+ selectionState.clearItemStates(false);
12913
13154
  model.selectListObjectPossible('/qListObjectDef');
12914
13155
  }
12915
13156
  }, {
@@ -12919,6 +13160,7 @@ var createListboxSelectionToolbar = (_ref => {
12919
13160
  getSvgIconShape: selectAlternative,
12920
13161
  enabled: canSelectAlternative,
12921
13162
  action: () => {
13163
+ selectionState.clearItemStates(false);
12922
13164
  model.selectListObjectAlternative('/qListObjectDef');
12923
13165
  }
12924
13166
  }, {
@@ -12928,6 +13170,7 @@ var createListboxSelectionToolbar = (_ref => {
12928
13170
  getSvgIconShape: selectExcluded,
12929
13171
  enabled: canSelectExcluded,
12930
13172
  action: () => {
13173
+ selectionState.clearItemStates(false);
12931
13174
  model.selectListObjectExcluded('/qListObjectDef');
12932
13175
  }
12933
13176
  }];
@@ -13436,6 +13679,7 @@ const StyledOutlinedInput = styled$1(OutlinedInput)(_ref2 => {
13436
13679
  function ListBoxSearch(_ref3) {
13437
13680
  let {
13438
13681
  selections,
13682
+ selectionState,
13439
13683
  model,
13440
13684
  keyboard,
13441
13685
  dense = false,
@@ -13510,6 +13754,7 @@ function ListBoxSearch(_ref3) {
13510
13754
  response = model.acceptListObjectSearch(TREE_PATH, true);
13511
13755
  // eslint-disable-next-line no-param-reassign
13512
13756
  selections.selectionsMade = true;
13757
+ selectionState.clearItemStates(false);
13513
13758
  setValue('');
13514
13759
  }
13515
13760
  return response;
@@ -13549,7 +13794,8 @@ function ListBoxSearch(_ref3) {
13549
13794
  },
13550
13795
  '&:hover': {
13551
13796
  border: 'none'
13552
- }
13797
+ },
13798
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px")
13553
13799
  }, dense && {
13554
13800
  fontSize: 12,
13555
13801
  paddingLeft: theme.spacing(1),
@@ -13823,6 +14069,125 @@ function useObjectSelections(app, model, elements, options) {
13823
14069
  return [objectSelections];
13824
14070
  }
13825
14071
 
14072
+ function selectionState() {
14073
+ const state = {
14074
+ itemStates: {},
14075
+ ignoreSelectionState: false,
14076
+ selectedInEngine: [],
14077
+ enginePages: [],
14078
+ setPages: undefined,
14079
+ lastRowCount: undefined,
14080
+ lastApprMaxGlyphCount: undefined,
14081
+ update(_ref) {
14082
+ var _layout$qListObject$q, _layout$qListObject, _layout$qListObject$q2;
14083
+ let {
14084
+ setPages,
14085
+ pages,
14086
+ isSingleSelect,
14087
+ selectDisabled,
14088
+ layout
14089
+ } = _ref;
14090
+ this.setPages = setPages;
14091
+ const isSameRowCount = this.lastRowCount === layout.qListObject.qSize.qcy;
14092
+ const isSameMaxGlyphCnt = this.lastApprMaxGlyphCount === layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
14093
+ if (!isSameRowCount || !isSameMaxGlyphCnt) {
14094
+ this.lastRowCount = layout.qListObject.qSize.qcy;
14095
+ this.lastApprMaxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
14096
+
14097
+ // The field have probably changed (drill up/down)
14098
+ // need to clear the client side item states since the field values have changed
14099
+ this.clearItemStates(false);
14100
+ }
14101
+ if (state.enginePages !== pages && pages !== undefined) {
14102
+ state.enginePages = pages !== null && pages !== void 0 ? pages : [];
14103
+ state.selectedInEngine = getSelectedValues(pages);
14104
+ state.selectableValuesUpdating = false;
14105
+ state.triggerStateChanged();
14106
+ }
14107
+ state.isSingleSelect = isSingleSelect;
14108
+ state.selectDisabled = selectDisabled;
14109
+ 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;
14110
+ },
14111
+ allowedToSelect() {
14112
+ if (state.selectDisabled()) {
14113
+ return false;
14114
+ }
14115
+ // When a dim is calculated, the rows must be done updating after previeous selection
14116
+ return !(state.isDimCalculated && state.selectableValuesUpdating);
14117
+ },
14118
+ setSelectableValuesUpdating() {
14119
+ state.selectableValuesUpdating = true;
14120
+ },
14121
+ useClientItemState(elementNumber) {
14122
+ return state.ignoreSelectionState || elementNumber in state.itemStates;
14123
+ },
14124
+ isSelected(elementNumber) {
14125
+ if (state.useClientItemState(elementNumber)) {
14126
+ return !!state.itemStates[elementNumber];
14127
+ }
14128
+ return state.selectedInEngine.includes(elementNumber);
14129
+ },
14130
+ getState(item) {
14131
+ const {
14132
+ qElemNumber,
14133
+ qState
14134
+ } = item;
14135
+ if (!state.useClientItemState(qElemNumber)) {
14136
+ return qState;
14137
+ }
14138
+ if (state.itemStates[qElemNumber]) {
14139
+ return qState === 'XS' ? 'XS' : 'S';
14140
+ }
14141
+ return qState === 'S' || qState === 'XS' ? 'A' : qState;
14142
+ },
14143
+ updateItemNoEvents(elementNumber, additive, selectedValues) {
14144
+ const selected = state.isSelected(elementNumber);
14145
+ if (selected && !additive) {
14146
+ state.itemStates[elementNumber] = false;
14147
+ } else if (!selected) {
14148
+ selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.push(elementNumber);
14149
+ state.itemStates[elementNumber] = true;
14150
+ }
14151
+ },
14152
+ triggerStateChanged() {
14153
+ if (this.setPages) {
14154
+ const pages = state.applySelectionsOnPages(state.enginePages);
14155
+ this.setPages(pages);
14156
+ }
14157
+ },
14158
+ applySelectionsOnPages(pages) {
14159
+ const matrices = pages.map(page => {
14160
+ const qMatrix = page.qMatrix.map(p => {
14161
+ const [p0] = p;
14162
+ const qState = state.getState(p0);
14163
+ return [_objectSpread2(_objectSpread2({}, p0), {}, {
14164
+ qState
14165
+ }), ...p.slice(1)];
14166
+ });
14167
+ return _objectSpread2(_objectSpread2({}, page), {}, {
14168
+ qMatrix
14169
+ });
14170
+ });
14171
+ return matrices;
14172
+ },
14173
+ updateItem(elementNumber, additive, selectedValues) {
14174
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
14175
+ state.triggerStateChanged();
14176
+ },
14177
+ updateItems(elementNumbers, additive, selectedValues) {
14178
+ elementNumbers.forEach(elementNumber => {
14179
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
14180
+ });
14181
+ state.triggerStateChanged();
14182
+ },
14183
+ clearItemStates(ignoreSelectionState) {
14184
+ state.itemStates = {};
14185
+ state.ignoreSelectionState = ignoreSelectionState;
14186
+ }
14187
+ };
14188
+ return state;
14189
+ }
14190
+
13826
14191
  const getValue$1 = function (obj, prop) {
13827
14192
  var _obj$prop;
13828
14193
  let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
@@ -13894,6 +14259,7 @@ function ListBoxPopover(_ref) {
13894
14259
  const containerRef = useRef();
13895
14260
  const [selections] = useObjectSelections(app, model, containerRef);
13896
14261
  const [layout] = useLayout$1(model);
14262
+ const [selectionState$1] = useState$1(() => selectionState());
13897
14263
  useEffect$1(() => {
13898
14264
  if (selections && open) {
13899
14265
  if (!selections.isModal(model)) {
@@ -13913,7 +14279,8 @@ function ListBoxPopover(_ref) {
13913
14279
  const listboxSelectionToolbarItems = createListboxSelectionToolbar({
13914
14280
  layout,
13915
14281
  model,
13916
- translator
14282
+ translator,
14283
+ selectionState: selectionState$1
13917
14284
  });
13918
14285
  const hasSelections$1 = hasSelections(layout);
13919
14286
  return /*#__PURE__*/React__default.createElement(Popover, {
@@ -13986,13 +14353,16 @@ function ListBoxPopover(_ref) {
13986
14353
  model: model,
13987
14354
  listCount: listCount,
13988
14355
  selections: selections,
14356
+ selectionState: selectionState$1,
13989
14357
  keyboard: {
13990
14358
  enabled: false
13991
14359
  },
13992
14360
  autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
13993
14361
  }), /*#__PURE__*/React__default.createElement(ListBox, {
13994
14362
  model: model,
14363
+ layout: layout,
13995
14364
  selections: selections,
14365
+ selectionState: selectionState$1,
13996
14366
  direction: "ltr",
13997
14367
  onSetListCount: c => setListCount(c)
13998
14368
  }))));
@@ -14622,6 +14992,52 @@ const selectionsForward = props => _objectSpread2(_objectSpread2({}, props), {},
14622
14992
  });
14623
14993
  var SelectionsForward = (props => SvgIcon$2(selectionsForward(props)));
14624
14994
 
14995
+ const patchAlternateState = (currentSelectionsModel, currentSelectionsLayout, appLayout) => {
14996
+ const states = [...(appLayout.qStateNames || [])].map(s => ({
14997
+ stateName: s,
14998
+ // need this as reference in selection toolbar since qSelectionObject.qStateName is not in the layout
14999
+ qSelectionObjectDef: {
15000
+ qStateName: s
15001
+ }
15002
+ }));
15003
+ const existingStates = (currentSelectionsLayout && currentSelectionsLayout.alternateStates ? currentSelectionsLayout.alternateStates.map(s => s.stateName) : []).join('::');
15004
+ const newStates = (appLayout.qStateNames || []).map(s => s).join('::');
15005
+ if (existingStates !== newStates) {
15006
+ currentSelectionsModel.applyPatches([{
15007
+ qOp: 'replace',
15008
+ qPath: '/alternateStates',
15009
+ qValue: JSON.stringify(states)
15010
+ }], true);
15011
+ }
15012
+ };
15013
+ function useAppSelectionsNavigation(app) {
15014
+ const [currentSelectionsModel] = useCurrentSelectionsModel(app);
15015
+ const [currentSelectionsLayout] = useLayout$1(currentSelectionsModel);
15016
+ const [appLayout] = useAppLayout$1(app);
15017
+ const [navigationState, setNavigationState] = useState$1(null);
15018
+ useEffect$1(() => {
15019
+ if (!appLayout || !currentSelectionsModel || !currentSelectionsLayout) return;
15020
+ patchAlternateState(currentSelectionsModel, currentSelectionsLayout, appLayout);
15021
+ }, [appLayout, currentSelectionsModel, currentSelectionsLayout]);
15022
+ useEffect$1(() => {
15023
+ if (!currentSelectionsLayout) return;
15024
+ let canGoBack = false;
15025
+ let canGoForward = false;
15026
+ let canClear = false;
15027
+ [currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach(state => {
15028
+ canGoBack = canGoBack || state.qSelectionObject && state.qSelectionObject.qBackCount > 0;
15029
+ canGoForward = canGoForward || state.qSelectionObject && state.qSelectionObject.qForwardCount > 0;
15030
+ canClear = canClear || (state.qSelectionObject && state.qSelectionObject.qSelections || []).filter(s => s.qLocked !== true).length > 0;
15031
+ });
15032
+ setNavigationState({
15033
+ canGoBack,
15034
+ canGoForward,
15035
+ canClear
15036
+ });
15037
+ }, [currentSelectionsLayout]);
15038
+ return [navigationState, currentSelectionsModel, currentSelectionsLayout];
15039
+ }
15040
+
14625
15041
  function Nav(_ref) {
14626
15042
  let {
14627
15043
  api,
@@ -15206,6 +15622,16 @@ AutoSizer.defaultProps = {
15206
15622
  style: {}
15207
15623
  };
15208
15624
 
15625
+ const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
15626
+ shapes: [{
15627
+ type: 'path',
15628
+ attrs: {
15629
+ 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'
15630
+ }
15631
+ }]
15632
+ });
15633
+ var DrillDownIcon = (props => SvgIcon$2(drillDown(props)));
15634
+
15209
15635
  const addListboxTheme = themeApi => {
15210
15636
  const getListboxStyle = prop => themeApi.getStyle('object', '', "listBox.".concat(prop));
15211
15637
  return {
@@ -15227,14 +15653,19 @@ const addListboxTheme = themeApi => {
15227
15653
 
15228
15654
  const PREFIX$4 = 'ListBoxInline';
15229
15655
  const searchIconWidth = 28;
15656
+ const drillDownIconWidth = 24;
15230
15657
  const classes$4 = {
15231
15658
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
15232
- screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
15659
+ screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly"),
15660
+ listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
15233
15661
  };
15234
- const StyledGrid$3 = styled$1(Grid)(_ref => {
15662
+ const StyledGrid$3 = styled$1(Grid, {
15663
+ shouldForwardProp: p => !['containerPadding'].includes(p)
15664
+ })(_ref => {
15235
15665
  var _theme$listBox$backgr, _theme$listBox;
15236
15666
  let {
15237
- theme
15667
+ theme,
15668
+ containerPadding
15238
15669
  } = _ref;
15239
15670
  return {
15240
15671
  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,
@@ -15248,6 +15679,9 @@ const StyledGrid$3 = styled$1(Grid)(_ref => {
15248
15679
  height: 0,
15249
15680
  width: 0,
15250
15681
  overflow: 'hidden'
15682
+ },
15683
+ ["& .".concat(classes$4.listboxWrapper)]: {
15684
+ padding: containerPadding
15251
15685
  }
15252
15686
  };
15253
15687
  });
@@ -15263,15 +15697,15 @@ const Title = styled$1(Typography)(_ref2 => {
15263
15697
  };
15264
15698
  });
15265
15699
  function ListBoxInline(_ref3) {
15266
- var _layout$layoutOptions, _layout$layoutOptions2;
15700
+ var _layoutOptions$dense;
15267
15701
  let {
15268
- options = {}
15702
+ options,
15703
+ layout
15269
15704
  } = _ref3;
15270
15705
  const {
15271
15706
  app,
15272
15707
  direction,
15273
15708
  frequencyMode,
15274
- listLayout,
15275
15709
  checkboxes,
15276
15710
  search = true,
15277
15711
  focusSearch = false,
@@ -15315,7 +15749,6 @@ function ListBoxInline(_ref3) {
15315
15749
  const moreAlignTo = useRef();
15316
15750
  const containerRef = useRef();
15317
15751
  const [searchContainer, searchContainerRef] = useRefWithCallback();
15318
- const [layout] = useLayout$1(model);
15319
15752
  const [showToolbar, setShowToolbar] = useState$1(false);
15320
15753
  const [showSearch, setShowSearch] = useState$1(false);
15321
15754
  const [keyboardActive, setKeyboardActive] = useState$1(false);
@@ -15331,6 +15764,7 @@ function ListBoxInline(_ref3) {
15331
15764
  stop: 0
15332
15765
  });
15333
15766
  const [appSelections] = useAppSelections(app);
15767
+ const [selectionState$1] = useState$1(() => selectionState());
15334
15768
  const {
15335
15769
  handleKeyDown,
15336
15770
  handleOnMouseEnter,
@@ -15398,17 +15832,23 @@ function ListBoxInline(_ref3) {
15398
15832
  return null;
15399
15833
  }
15400
15834
  const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
15835
+ const isDrillDown = layout.qListObject.qDimensionInfo.qGrouping === 'H';
15401
15836
  const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
15402
15837
  layout,
15403
15838
  model,
15404
- translator
15839
+ translator,
15840
+ selectionState: selectionState$1
15405
15841
  }) : [];
15406
15842
  const showSearchToggle = search === 'toggle' && showSearch;
15407
15843
  const searchVisible = (search === true || showSearchToggle) && !selectDisabled();
15408
- 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;
15844
+ const {
15845
+ layoutOptions = {}
15846
+ } = layout;
15847
+ const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
15409
15848
  const searchHeight = dense ? 27 : 40;
15410
15849
  const extraheight = dense ? 39 : 49;
15411
15850
  const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
15851
+ const headerHeight = 32;
15412
15852
  const {
15413
15853
  wildCardSearch,
15414
15854
  searchEnabled
@@ -15418,12 +15858,26 @@ function ListBoxInline(_ref3) {
15418
15858
  setShowSearch(newValue);
15419
15859
  };
15420
15860
  const shouldAutoFocus = searchVisible && search === 'toggle';
15861
+ const showSearchIcon = searchEnabled !== false && search === 'toggle' && !(constraints !== null && constraints !== void 0 && constraints.active);
15862
+ const showSearchOrLockIcon = isLocked || showSearchIcon;
15863
+ const showIcons = showSearchOrLockIcon || isDrillDown;
15864
+ const iconsWidth = (showSearchOrLockIcon ? searchIconWidth : 0) + (isDrillDown ? drillDownIconWidth : 0);
15865
+ const drillDownPaddingLeft = showSearchOrLockIcon ? 0 : ICON_PADDING;
15866
+ const headerPaddingLeft = CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0);
15867
+
15868
+ // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
15869
+ const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
15870
+ let containerPadding;
15871
+ if (isGridMode) {
15872
+ containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
15873
+ }
15421
15874
  return /*#__PURE__*/React__default.createElement(StyledGrid$3, {
15422
15875
  className: "listbox-container",
15423
15876
  container: true,
15424
15877
  tabIndex: keyboard.enabled && !keyboard.active ? 0 : -1,
15425
15878
  direction: "column",
15426
15879
  gap: 0,
15880
+ containerPadding: containerPadding,
15427
15881
  style: {
15428
15882
  height: '100%',
15429
15883
  minHeight: "".concat(minHeight, "px"),
@@ -15437,45 +15891,60 @@ function ListBoxInline(_ref3) {
15437
15891
  item: true,
15438
15892
  container: true,
15439
15893
  style: {
15440
- padding: theme.spacing(1)
15894
+ padding: theme.spacing(1),
15895
+ paddingLeft: "".concat(headerPaddingLeft, "px")
15441
15896
  },
15442
15897
  wrap: "nowrap"
15443
15898
  }, /*#__PURE__*/React__default.createElement(Grid, {
15444
15899
  item: true,
15445
15900
  container: true,
15901
+ height: headerHeight,
15446
15902
  wrap: "nowrap"
15447
- }, /*#__PURE__*/React__default.createElement(Grid, {
15903
+ }, showIcons && /*#__PURE__*/React__default.createElement(Grid, {
15448
15904
  item: true,
15449
15905
  sx: {
15450
15906
  display: 'flex',
15451
15907
  alignItems: 'center',
15452
- width: searchIconWidth
15908
+ width: iconsWidth
15453
15909
  }
15454
15910
  }, isLocked ? /*#__PURE__*/React__default.createElement(IconButton, {
15455
15911
  tabIndex: -1,
15456
15912
  onClick: unlock,
15457
- disabled: !isLocked,
15913
+ disabled: selectDisabled(),
15458
15914
  size: "large"
15459
15915
  }, /*#__PURE__*/React__default.createElement(Lock, {
15460
15916
  title: translator.get('Listbox.Unlock'),
15461
15917
  style: {
15462
15918
  fontSize: '12px'
15463
15919
  }
15464
- })) : searchEnabled !== false && /*#__PURE__*/React__default.createElement(IconButton, {
15920
+ })) : showSearchIcon && /*#__PURE__*/React__default.createElement(IconButton, {
15465
15921
  onClick: onShowSearch,
15466
15922
  tabIndex: -1,
15467
15923
  title: translator.get('Listbox.Search'),
15468
- size: "large"
15924
+ size: "large",
15925
+ "data-testid": "search-toggle-btn"
15469
15926
  }, /*#__PURE__*/React__default.createElement(SearchIcon, {
15470
15927
  style: {
15471
15928
  fontSize: '12px'
15472
15929
  }
15930
+ })), isDrillDown && /*#__PURE__*/React__default.createElement(IconButton, {
15931
+ tabIndex: -1,
15932
+ title: translator.get('Listbox.DrillDown'),
15933
+ size: "large",
15934
+ sx: {
15935
+ paddingLeft: "".concat(drillDownPaddingLeft, "px")
15936
+ }
15937
+ }, /*#__PURE__*/React__default.createElement(DrillDownIcon, {
15938
+ style: {
15939
+ fontSize: '12px'
15940
+ }
15473
15941
  }))), /*#__PURE__*/React__default.createElement(Grid, {
15474
15942
  item: true,
15475
15943
  className: classes$4.listBoxHeader
15476
15944
  }, /*#__PURE__*/React__default.createElement(Title, {
15477
15945
  variant: "h6",
15478
- noWrap: true
15946
+ noWrap: true,
15947
+ title: layout.title
15479
15948
  }, layout.title))), /*#__PURE__*/React__default.createElement(Grid, {
15480
15949
  item: true,
15481
15950
  xs: true
@@ -15519,6 +15988,7 @@ function ListBoxInline(_ref3) {
15519
15988
  className: classes$4.screenReaderOnly
15520
15989
  }, translator.get('Listbox.Search.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
15521
15990
  selections: selections,
15991
+ selectionState: selectionState$1,
15522
15992
  model: model,
15523
15993
  dense: dense,
15524
15994
  keyboard: keyboard,
@@ -15530,7 +16000,8 @@ function ListBoxInline(_ref3) {
15530
16000
  searchEnabled: searchEnabled
15531
16001
  })), /*#__PURE__*/React__default.createElement(Grid, {
15532
16002
  item: true,
15533
- xs: true
16003
+ xs: true,
16004
+ className: classes$4.listboxWrapper
15534
16005
  }, /*#__PURE__*/React__default.createElement("div", {
15535
16006
  className: classes$4.screenReaderOnly
15536
16007
  }, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
@@ -15540,9 +16011,11 @@ function ListBoxInline(_ref3) {
15540
16011
  } = _ref4;
15541
16012
  return /*#__PURE__*/React__default.createElement(ListBox, {
15542
16013
  model: model,
16014
+ constraints: constraints,
16015
+ layout: layout,
15543
16016
  selections: selections,
16017
+ selectionState: selectionState$1,
15544
16018
  direction: direction,
15545
- listLayout: listLayout,
15546
16019
  frequencyMode: frequencyMode,
15547
16020
  rangeSelect: rangeSelect,
15548
16021
  checkboxes: checkboxes,
@@ -15571,6 +16044,20 @@ function ListBoxInline(_ref3) {
15571
16044
  });
15572
16045
  }))));
15573
16046
  }
16047
+ const ListBoxInlineMemoed = React__default.memo(ListBoxInline);
16048
+ function IsolateUseLayoutWrapper(_ref5) {
16049
+ let {
16050
+ options = {}
16051
+ } = _ref5;
16052
+ const {
16053
+ model
16054
+ } = options;
16055
+ const [layout] = useLayout$1(model);
16056
+ return /*#__PURE__*/React__default.createElement(ListBoxInlineMemoed, {
16057
+ options: options,
16058
+ layout: layout
16059
+ });
16060
+ }
15574
16061
 
15575
16062
  function useExistingModel(_ref) {
15576
16063
  let {
@@ -15597,6 +16084,9 @@ function useExistingModel(_ref) {
15597
16084
  } else {
15598
16085
  const m = await app.getObject(qId);
15599
16086
  modelStore.set(m.id, m);
16087
+ m.once('closed', () => {
16088
+ modelStore.clear(m.id);
16089
+ });
15600
16090
  setModel(m);
15601
16091
  }
15602
16092
  }
@@ -15650,6 +16140,7 @@ function useOnTheFlyModel(_ref) {
15650
16140
  const {
15651
16141
  dense,
15652
16142
  checkboxes,
16143
+ listLayout,
15653
16144
  properties = {}
15654
16145
  } = options;
15655
16146
  let {
@@ -15678,6 +16169,20 @@ function useOnTheFlyModel(_ref) {
15678
16169
  break;
15679
16170
  }
15680
16171
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
16172
+ const layoutOptions = {
16173
+ dense
16174
+ };
16175
+ if (listLayout === 'horizontal') {
16176
+ layoutOptions.dataLayout = 'grid';
16177
+ layoutOptions.layoutOrder = 'column';
16178
+ layoutOptions.maxVisibleColumns = {
16179
+ auto: true
16180
+ };
16181
+ layoutOptions.maxVisibleRows = {
16182
+ auto: false,
16183
+ maxRows: 1
16184
+ };
16185
+ }
15681
16186
  const id = useRef();
15682
16187
  if (!id.current) {
15683
16188
  id.current = uid();
@@ -15690,6 +16195,7 @@ function useOnTheFlyModel(_ref) {
15690
16195
  qListObjectDef: {
15691
16196
  qStateName: stateName,
15692
16197
  qShowAlternatives: true,
16198
+ frequencyEnabled: false,
15693
16199
  qFrequencyMode: getListdefFrequencyMode(),
15694
16200
  qInitialDataFetch: [{
15695
16201
  qTop: 0,
@@ -15708,9 +16214,7 @@ function useOnTheFlyModel(_ref) {
15708
16214
  },
15709
16215
  histogram,
15710
16216
  checkboxes,
15711
- layoutOptions: {
15712
- dense
15713
- },
16217
+ layoutOptions,
15714
16218
  title
15715
16219
  };
15716
16220
  extend$1(true, listdef, properties);
@@ -15833,15 +16337,15 @@ function ListBoxWrapper(_ref) {
15833
16337
  });
15834
16338
  const elementRef = useRef(element);
15835
16339
  const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more'], options)[0];
15836
- if (!selections || !model) {
15837
- return null;
15838
- }
15839
- const opts = _objectSpread2(_objectSpread2({}, options), {}, {
16340
+ const opts = useMemo$1(() => _objectSpread2(_objectSpread2({}, options), {}, {
15840
16341
  selections,
15841
16342
  model,
15842
16343
  app
15843
- });
15844
- return /*#__PURE__*/React__default.createElement(ListBoxInline, {
16344
+ }), [options, selections, model, app]);
16345
+ if (!selections || !model) {
16346
+ return null;
16347
+ }
16348
+ return /*#__PURE__*/React__default.createElement(IsolateUseLayoutWrapper, {
15845
16349
  options: opts
15846
16350
  });
15847
16351
  }