@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.
@@ -1,5 +1,5 @@
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
  */
@@ -1680,6 +1680,12 @@
1680
1680
  "zh-TW": "不符計算條件"
1681
1681
  }
1682
1682
  };
1683
+ var Listbox_DrillDown = {
1684
+ id: "Listbox.DrillDown",
1685
+ locale: {
1686
+ "en-US": "Drill-down dimension"
1687
+ }
1688
+ };
1683
1689
  var all = {
1684
1690
  Cancel: Cancel$1,
1685
1691
  CurrentSelections_All: CurrentSelections_All,
@@ -1716,7 +1722,8 @@
1716
1722
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1717
1723
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1718
1724
  Visualization_LayoutError: Visualization_LayoutError,
1719
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
1725
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
1726
+ Listbox_DrillDown: Listbox_DrillDown
1720
1727
  };
1721
1728
 
1722
1729
  function appLocaleFn(language) {
@@ -3505,6 +3512,8 @@
3505
3512
  return detectTouchscreen() ? 'touch' : 'desktop';
3506
3513
  }
3507
3514
 
3515
+ var client = {};
3516
+
3508
3517
  var reactDomExports = {};
3509
3518
  var reactDom = {
3510
3519
  get exports(){ return reactDomExports; },
@@ -3901,6 +3910,12 @@
3901
3910
 
3902
3911
  var ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDomExports);
3903
3912
 
3913
+ var m$2 = reactDomExports;
3914
+ {
3915
+ client.createRoot = m$2.createRoot;
3916
+ client.hydrateRoot = m$2.hydrateRoot;
3917
+ }
3918
+
3904
3919
  function _extends$7() {
3905
3920
  _extends$7 = Object.assign ? Object.assign.bind() : function (target) {
3906
3921
  for (var i = 1; i < arguments.length; i++) {
@@ -15328,7 +15343,7 @@
15328
15343
  return cache[key];
15329
15344
  }
15330
15345
 
15331
- const NEBULA_VERSION_HASH = "c721" ;
15346
+ const NEBULA_VERSION_HASH = "b1a6" ;
15332
15347
  ClassNameGenerator$1.configure(componentName => {
15333
15348
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15334
15349
  });
@@ -15383,395 +15398,87 @@
15383
15398
  return [useKeyStore, store];
15384
15399
  });
15385
15400
 
15386
- const [useRpcResultStore, rpcResultStore] = createKeyStore({});
15387
- const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
15388
- const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
15389
- const [useRpcRequestModelStore, rpcRequestModelStore] = createKeyStore({});
15390
- const [useModelChangedStore, modelChangedStore] = createKeyStore({});
15391
- const [, modelInitializedStore] = createKeyStore({});
15392
- const modelStoreMiddleware = _ref => {
15401
+ const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
15402
+ const [useAppModalStore, appModalStore] = createKeyStore({});
15403
+ const [useObjectSelectionsStore, objectSelectionsStore] = createKeyStore({});
15404
+ const [useModalObjectStore, modalObjectStore] = createKeyStore({});
15405
+
15406
+ /* eslint no-underscore-dangle: 0 */
15407
+ function createAppSelections(_ref) {
15393
15408
  let {
15394
- type,
15395
- value: model
15409
+ app
15396
15410
  } = _ref;
15397
- const initialized = modelInitializedStore.get(model.id);
15398
- modelInitializedStore.set(model.id, {});
15399
- const onChanged = () => {
15400
- rpcRequestStore.clear(model.id);
15401
- modelChangedStore.set(model.id, {});
15402
- modelChangedStore.dispatch(true); // Force new state to trigger hooks
15411
+ const key = "".concat(app.id);
15412
+ const end = async function () {
15413
+ let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
15414
+ const model = modalObjectStore.get(key);
15415
+ if (model) {
15416
+ await model.endSelections(accept);
15417
+ modalObjectStore.clear(key);
15418
+ const objectSelections = objectSelectionsStore.get(model.id);
15419
+ objectSelections.emit('deactivated');
15420
+ }
15403
15421
  };
15422
+ const begin = async function (model, path) {
15423
+ let accept = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
15424
+ // Quick return if it's already in modal
15425
+ if (model === modalObjectStore.get(key)) {
15426
+ return;
15427
+ }
15404
15428
 
15405
- const unsubscribe = () => {
15406
- model.removeListener('changed', onChanged);
15407
- rpcResultStore.clear(model.id);
15408
- rpcRequestStore.clear(model.id);
15409
- rpcRequestSessionModelStore.clear(model.id);
15410
- rpcRequestModelStore.clear(model.id);
15411
- modelChangedStore.clear(model.id);
15412
- modelInitializedStore.clear(model.id);
15413
- };
15414
- switch (type) {
15415
- case 'SET':
15416
- if (!initialized) {
15417
- model.on('changed', onChanged);
15418
- model.once('closed', () => {
15419
- unsubscribe();
15420
- });
15421
- }
15422
- break;
15423
- }
15424
- return unsubscribe;
15425
- };
15426
- const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
15427
- const subscribe = model => {
15428
- const unsubscribe = modelStoreMiddleware({
15429
- type: 'SET',
15430
- value: model
15431
- });
15432
- return () => {
15433
- unsubscribe();
15434
- modelStore.clear(model.id);
15435
- };
15436
- };
15429
+ // If other model is in modal state end it
15430
+ end(accept);
15437
15431
 
15438
- const rpcReducer = (state, action) => {
15439
- const {
15440
- rpcResultStore,
15441
- key,
15442
- method
15443
- } = action;
15444
- let newState;
15445
- switch (action.type) {
15446
- case 'INVALID':
15447
- {
15448
- newState = _objectSpread2(_objectSpread2({}, state), {}, {
15449
- valid: false,
15450
- invalid: true,
15451
- validating: true,
15452
- canCancel: true,
15453
- canRetry: false,
15454
- rpcRetry: false
15455
- });
15456
- break;
15457
- }
15458
- case 'VALID':
15459
- {
15460
- newState = {
15461
- result: _objectSpread2({}, action.result),
15462
- invalid: false,
15463
- valid: true,
15464
- validating: false,
15465
- canCancel: false,
15466
- canRetry: false,
15467
- rpcRetry: false
15468
- };
15469
- break;
15470
- }
15471
- case 'CANCELLED':
15472
- {
15473
- newState = _objectSpread2(_objectSpread2({}, state), {}, {
15474
- invalid: true,
15475
- valid: false,
15476
- validating: false,
15477
- canCancel: false,
15478
- canRetry: true,
15479
- rpcRetry: false
15480
- });
15481
- break;
15482
- }
15483
- default:
15484
- throw new Error('Undefined action');
15485
- }
15486
- let sharedState = rpcResultStore.get(key);
15487
- if (!sharedState) {
15488
- sharedState = {};
15489
- }
15490
- sharedState[method] = newState;
15491
- rpcResultStore.set(key, sharedState);
15492
- return newState;
15493
- };
15494
- function useRpc(model, method) {
15495
- const key = model ? "".concat(model.id) : null;
15496
- const [rpcResultStore] = useRpcResultStore();
15497
- const [state, dispatch] = reactExports.useReducer(rpcReducer, key ? rpcResultStore.get(key) : null);
15498
- const [modelChangedStore] = useModelChangedStore();
15499
- const [rpcRequestStore] = useRpcRequestStore();
15500
- let rpcShared;
15501
- if (key) {
15502
- rpcShared = rpcRequestStore.get(key);
15503
- if (!rpcShared) {
15504
- rpcShared = {};
15505
- rpcRequestStore.set(key, rpcShared);
15506
- }
15507
- }
15508
- const call = async skipRetry => {
15509
- let cache = rpcShared[method];
15510
- if (!cache || cache && cache.rpcRetry) {
15511
- const rpc = model[method]();
15512
- cache = {
15513
- rpc,
15514
- rpcRetry: false
15515
- };
15516
- rpcShared[method] = cache;
15517
- dispatch({
15518
- type: 'INVALID',
15519
- method,
15520
- key,
15521
- model,
15522
- rpcResultStore,
15523
- canCancel: true
15524
- });
15525
- }
15526
- try {
15527
- // await sleep(5000);
15528
- const result = await cache.rpc;
15529
- dispatch({
15530
- type: 'VALID',
15531
- result,
15532
- key,
15533
- method,
15534
- model,
15535
- rpcResultStore
15536
- });
15537
- } catch (err) {
15538
- if (err.code === 15 && !skipRetry) {
15539
- // Request aborted. This will be called multiple times by hooks only retry once
15540
- if (!cache.rpcRetry) {
15541
- cache.rpcRetry = true;
15432
+ // Pending modal
15433
+ modalObjectStore.set(key, model);
15434
+ const p = Array.isArray(path) ? path : [path];
15435
+ const beginSelections = async skipRetry => {
15436
+ try {
15437
+ await model.beginSelections(p);
15438
+ modalObjectStore.set(key, model); // We have a modal
15439
+ } catch (err) {
15440
+ if (err.code === 6003 && !skipRetry) {
15441
+ await app.abortModal(accept);
15442
+ beginSelections(true);
15443
+ } else {
15444
+ modalObjectStore.clear(key); // No modal
15542
15445
  }
15543
- call(true);
15544
15446
  }
15545
- }
15447
+ };
15448
+
15449
+ await beginSelections();
15546
15450
  };
15547
- const longrunning = {
15548
- cancel: async () => {
15549
- const global = model.session.getObjectApi({
15550
- handle: -1
15551
- });
15552
- await global.cancelRequest(rpcShared[method].rpc.requestId);
15553
- dispatch({
15554
- type: 'CANCELLED',
15555
- key,
15556
- method,
15557
- model,
15558
- rpcResultStore
15559
- });
15451
+ const appModal = {
15452
+ begin,
15453
+ end
15454
+ };
15455
+ appModalStore.set(key, appModal);
15456
+
15457
+ /**
15458
+ * @class
15459
+ * @alias AppSelections
15460
+ */
15461
+ const appSelections = {
15462
+ model: app,
15463
+ isInModal() {
15464
+ return !!modalObjectStore.get(key);
15560
15465
  },
15561
- retry: () => {
15562
- rpcShared[method].rpcRetry = true;
15563
- call();
15564
- }
15565
- };
15566
- reactExports.useEffect(() => {
15567
- if (!model) return undefined;
15568
- call();
15569
- return undefined;
15570
- }, [model, modelChangedStore.get(model && model.id), key, method]);
15571
- return [
15572
- // Result
15573
- state && state.result, {
15574
- validating: state && state.validating,
15575
- canCancel: state && state.canCancel,
15576
- canRetry: state && state.canRetry
15577
- },
15578
- // Long running api e.g cancel retry
15579
- longrunning];
15580
- }
15581
-
15582
- function useLayout$1(model) {
15583
- return useRpc(model, 'getLayout');
15584
- }
15585
- function useAppLayout$1(model) {
15586
- return useRpc(model, 'getAppLayout');
15587
- }
15588
-
15589
- function useSessionModel(definition, app) {
15590
- const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
15591
- const [modelStore] = useModelStore();
15592
- const [rpcRequestSessionModelStore] = useRpcRequestSessionModelStore();
15593
- const [model, setModel] = reactExports.useState();
15594
- let rpcShared;
15595
- if (key) {
15596
- rpcShared = rpcRequestSessionModelStore.get(key);
15597
- }
15598
- for (var _len = arguments.length, deps = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
15599
- deps[_key - 2] = arguments[_key];
15600
- }
15601
- reactExports.useEffect(() => {
15602
- if (!app) {
15603
- return;
15604
- }
15605
- // Create new session object
15606
- const create = async () => {
15607
- if (!rpcShared) {
15608
- const rpc = app.createSessionObject(definition);
15609
- rpcShared = rpc;
15610
- rpcRequestSessionModelStore.set(key, rpcShared);
15611
- }
15612
- const newModel = await rpcShared;
15613
- modelStore.set(key, newModel);
15614
- setModel(newModel);
15615
- };
15616
- create();
15617
- }, [app, ...deps]);
15618
- return [model];
15619
- }
15620
-
15621
- const definition = {
15622
- qInfo: {
15623
- qType: 'current-selections'
15624
- },
15625
- qSelectionObjectDef: {
15626
- qStateName: '$'
15627
- },
15628
- alternateStates: []
15629
- };
15630
- function useCurrentSelectionsModel(app) {
15631
- return useSessionModel(definition, app);
15632
- }
15633
-
15634
- const patchAlternateState = (currentSelectionsModel, currentSelectionsLayout, appLayout) => {
15635
- const states = [...(appLayout.qStateNames || [])].map(s => ({
15636
- stateName: s,
15637
- // need this as reference in selection toolbar since qSelectionObject.qStateName is not in the layout
15638
- qSelectionObjectDef: {
15639
- qStateName: s
15640
- }
15641
- }));
15642
- const existingStates = (currentSelectionsLayout && currentSelectionsLayout.alternateStates ? currentSelectionsLayout.alternateStates.map(s => s.stateName) : []).join('::');
15643
- const newStates = (appLayout.qStateNames || []).map(s => s).join('::');
15644
- if (existingStates !== newStates) {
15645
- currentSelectionsModel.applyPatches([{
15646
- qOp: 'replace',
15647
- qPath: '/alternateStates',
15648
- qValue: JSON.stringify(states)
15649
- }], true);
15650
- }
15651
- };
15652
- function useAppSelectionsNavigation(app) {
15653
- const [currentSelectionsModel] = useCurrentSelectionsModel(app);
15654
- const [currentSelectionsLayout] = useLayout$1(currentSelectionsModel);
15655
- const [appLayout] = useAppLayout$1(app);
15656
- const [navigationState, setNavigationState] = reactExports.useState(null);
15657
- reactExports.useEffect(() => {
15658
- if (!appLayout || !currentSelectionsModel || !currentSelectionsLayout) return;
15659
- patchAlternateState(currentSelectionsModel, currentSelectionsLayout, appLayout);
15660
- }, [appLayout, currentSelectionsModel, currentSelectionsLayout]);
15661
- reactExports.useEffect(() => {
15662
- if (!currentSelectionsLayout) return;
15663
- let canGoBack = false;
15664
- let canGoForward = false;
15665
- let canClear = false;
15666
- [currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach(state => {
15667
- canGoBack = canGoBack || state.qSelectionObject && state.qSelectionObject.qBackCount > 0;
15668
- canGoForward = canGoForward || state.qSelectionObject && state.qSelectionObject.qForwardCount > 0;
15669
- canClear = canClear || (state.qSelectionObject && state.qSelectionObject.qSelections || []).filter(s => s.qLocked !== true).length > 0;
15670
- });
15671
- setNavigationState({
15672
- canGoBack,
15673
- canGoForward,
15674
- canClear
15675
- });
15676
- }, [currentSelectionsLayout]);
15677
- return [navigationState, currentSelectionsModel, currentSelectionsLayout];
15678
- }
15679
-
15680
- const [useAppSelectionsStore, appSelectionsStore] = createKeyStore({});
15681
- const [useAppModalStore, appModalStore] = createKeyStore({});
15682
- const [useObjectSelectionsStore, objectSelectionsStore] = createKeyStore({});
15683
- const [useModalObjectStore, modalObjectStore] = createKeyStore({});
15684
-
15685
- /* eslint no-underscore-dangle: 0 */
15686
- function createAppSelections(_ref) {
15687
- let {
15688
- app,
15689
- currentSelectionsLayout,
15690
- navState
15691
- } = _ref;
15692
- const key = "".concat(app.id);
15693
- const end = async function () {
15694
- let accept = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
15695
- const model = modalObjectStore.get(key);
15696
- if (model) {
15697
- await model.endSelections(accept);
15698
- modalObjectStore.clear(key);
15699
- const objectSelections = objectSelectionsStore.get(model.id);
15700
- objectSelections.emit('deactivated');
15701
- }
15702
- };
15703
- const begin = async function (model, path) {
15704
- let accept = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
15705
- // Quick return if it's already in modal
15706
- if (model === modalObjectStore.get(key)) {
15707
- return;
15708
- }
15709
-
15710
- // If other model is in modal state end it
15711
- end(accept);
15712
-
15713
- // Pending modal
15714
- modalObjectStore.set(key, model);
15715
- const p = Array.isArray(path) ? path : [path];
15716
- const beginSelections = async skipRetry => {
15717
- try {
15718
- await model.beginSelections(p);
15719
- modalObjectStore.set(key, model); // We have a modal
15720
- } catch (err) {
15721
- if (err.code === 6003 && !skipRetry) {
15722
- await app.abortModal(accept);
15723
- beginSelections(true);
15724
- } else {
15725
- modalObjectStore.clear(key); // No modal
15726
- }
15727
- }
15728
- };
15729
-
15730
- await beginSelections();
15731
- };
15732
- const appModal = {
15733
- begin,
15734
- end
15735
- };
15736
- appModalStore.set(key, appModal);
15737
-
15738
- /**
15739
- * @class
15740
- * @alias AppSelections
15741
- */
15742
- const appSelections = {
15743
- model: app,
15744
- isInModal() {
15745
- return !!modalObjectStore.get(key);
15746
- },
15747
- isModal(object) {
15748
- // TODO check model state
15749
- return object ? modalObjectStore.get(key) === object : !!modalObjectStore.get(key);
15750
- },
15751
- canGoForward() {
15752
- return navState.canGoForward;
15753
- },
15754
- canGoBack() {
15755
- return navState.canGoBack;
15756
- },
15757
- canClear() {
15758
- return navState.canClear;
15759
- },
15760
- layout() {
15761
- return currentSelectionsLayout;
15762
- },
15763
- forward() {
15764
- return appModal.end().then(() => app.forward());
15765
- },
15766
- back() {
15767
- return appModal.end().then(() => app.back());
15768
- },
15769
- clear() {
15770
- return appModal.end().then(() => app.clearAll());
15771
- },
15772
- clearField(field) {
15773
- let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
15774
- return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
15466
+ isModal(object) {
15467
+ // TODO check model state
15468
+ return object ? modalObjectStore.get(key) === object : !!modalObjectStore.get(key);
15469
+ },
15470
+ forward() {
15471
+ return appModal.end().then(() => app.forward());
15472
+ },
15473
+ back() {
15474
+ return appModal.end().then(() => app.back());
15475
+ },
15476
+ clear() {
15477
+ return appModal.end().then(() => app.clearAll());
15478
+ },
15479
+ clearField(field) {
15480
+ let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$';
15481
+ return appModal.end().then(() => app.getField(field, state).then(f => f.clear()));
15775
15482
  }
15776
15483
  };
15777
15484
  return appSelections;
@@ -15781,27 +15488,25 @@
15781
15488
  // assume the app is mocked if session is undefined
15782
15489
  return [];
15783
15490
  }
15784
- const [navState, currentSelectionsModel, currentSelectionsLayout] = useAppSelectionsNavigation(app);
15785
15491
  const [appSelectionsStore] = useAppSelectionsStore();
15786
15492
  const key = app ? app.id : null;
15787
15493
  let appSelections = appSelectionsStore.get(key);
15788
15494
  reactExports.useEffect(() => {
15789
- if (!app || !currentSelectionsModel || !currentSelectionsLayout || !navState || appSelections) return;
15495
+ if (!app || appSelections) return;
15790
15496
  appSelections = createAppSelections({
15791
- app,
15792
- currentSelectionsLayout,
15793
- navState
15497
+ app
15794
15498
  });
15795
15499
  appSelectionsStore.set(key, appSelections);
15796
15500
  appSelectionsStore.dispatch(true);
15797
- }, [app, currentSelectionsModel, currentSelectionsLayout, navState]);
15798
- return [appSelections, navState];
15501
+ }, [app]);
15502
+ return [appSelections];
15799
15503
  }
15800
15504
 
15801
15505
  const NebulaApp = reactExports.forwardRef((_ref, ref) => {
15802
15506
  let {
15803
15507
  initialContext,
15804
- app
15508
+ app,
15509
+ renderCallback
15805
15510
  } = _ref;
15806
15511
  const [appSelections] = useAppSelections(app);
15807
15512
  const [context, setContext] = reactExports.useState(initialContext);
@@ -15812,21 +15517,20 @@
15812
15517
  theme: create$3(muiThemeName)
15813
15518
  }), [muiThemeName]);
15814
15519
  const [components, setComponents] = reactExports.useState([]);
15520
+
15521
+ // Will be called directly after the first render pass
15522
+ // See: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
15523
+ reactExports.useEffect(() => {
15524
+ renderCallback && renderCallback();
15525
+ }, []);
15815
15526
  reactExports.useImperativeHandle(ref, () => ({
15816
- addComponent(component) {
15817
- setComponents([...components, component]);
15818
- },
15819
- removeComponent(component) {
15820
- const ix = components.indexOf(component);
15821
- if (ix !== -1) {
15822
- components.splice(ix, 1);
15823
- setComponents([...components]);
15824
- }
15527
+ setComps(comps) {
15528
+ setComponents([...comps]);
15825
15529
  },
15826
15530
  setMuiThemeName,
15827
- setContext,
15531
+ setContext: ctx => setContext(oldContext => JSON.stringify(oldContext) !== JSON.stringify(ctx) ? ctx : oldContext),
15828
15532
  getAppSelections: () => appSelections
15829
- }));
15533
+ }), []);
15830
15534
  return /*#__PURE__*/React.createElement(StyledEngineProvider, {
15831
15535
  injectFirst: true
15832
15536
  }, /*#__PURE__*/React.createElement(ThemeProvider, {
@@ -15847,15 +15551,18 @@
15847
15551
  const appRef = React.createRef();
15848
15552
  const element = document.createElement('div');
15849
15553
  element.style.display = 'none';
15850
- element.setAttribute('data-nebulajs-version', "3.3.0-alpha.0" );
15554
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.0" );
15851
15555
  element.setAttribute('data-app-id', app.id);
15852
15556
  document.body.appendChild(element);
15853
- ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
15557
+ const root = client.createRoot(element);
15558
+ root.render( /*#__PURE__*/React.createElement(NebulaApp, {
15854
15559
  ref: appRef,
15855
15560
  app: app,
15856
- initialContext: context
15857
- }), element, resolveRender);
15561
+ initialContext: context,
15562
+ renderCallback: resolveRender
15563
+ }));
15858
15564
  const cells = {};
15565
+ const components = [];
15859
15566
  return [{
15860
15567
  toggleFocusOfCells(cellIdToFocus) {
15861
15568
  Object.keys(cells).forEach(i => {
@@ -15872,13 +15579,18 @@
15872
15579
  add(component) {
15873
15580
  (async () => {
15874
15581
  await rendered;
15875
- appRef.current.addComponent(component);
15582
+ components.push(component);
15583
+ appRef.current.setComps(components);
15876
15584
  })();
15877
15585
  },
15878
15586
  remove(component) {
15879
15587
  (async () => {
15880
15588
  await rendered;
15881
- appRef.current.removeComponent(component);
15589
+ const ix = components.indexOf(component);
15590
+ if (ix !== -1) {
15591
+ components.splice(ix, 1);
15592
+ }
15593
+ appRef.current.setComps(components);
15882
15594
  })();
15883
15595
  },
15884
15596
  setMuiThemeName(themeName) {
@@ -21175,267 +20887,515 @@
21175
20887
  });
21176
20888
  var Tooltip$1 = Tooltip;
21177
20889
 
21178
- function useRect$1() {
21179
- const [node, setNode] = reactExports.useState();
21180
- const [rect, setRect] = reactExports.useState();
21181
- const callbackRef = reactExports.useCallback(ref => {
21182
- if (!ref) {
21183
- return;
21184
- }
21185
- setNode(ref);
21186
- }, []);
21187
- const handleResize = () => {
21188
- const {
21189
- left,
21190
- top,
21191
- width,
21192
- height
21193
- } = node.getBoundingClientRect();
21194
- setRect({
21195
- left,
21196
- top,
21197
- width,
21198
- height
21199
- });
20890
+ const [useRpcResultStore, rpcResultStore] = createKeyStore({});
20891
+ const [useRpcRequestStore, rpcRequestStore] = createKeyStore({});
20892
+ const [useRpcRequestSessionModelStore, rpcRequestSessionModelStore] = createKeyStore({});
20893
+ const [useRpcRequestModelStore, rpcRequestModelStore] = createKeyStore({});
20894
+ const [useModelChangedStore, modelChangedStore] = createKeyStore({});
20895
+ const [, modelInitializedStore] = createKeyStore({});
20896
+ const modelStoreMiddleware = _ref => {
20897
+ let {
20898
+ type,
20899
+ value: model
20900
+ } = _ref;
20901
+ const initialized = modelInitializedStore.get(model.id);
20902
+ modelInitializedStore.set(model.id, {});
20903
+ const onChanged = () => {
20904
+ rpcRequestStore.clear(model.id);
20905
+ modelChangedStore.set(model.id, {});
20906
+ modelChangedStore.dispatch(true); // Force new state to trigger hooks
21200
20907
  };
21201
- reactExports.useLayoutEffect(() => {
21202
- if (!node) {
21203
- return undefined;
21204
- }
21205
- if (typeof ResizeObserver === 'function') {
21206
- let resizeObserver = new ResizeObserver(handleResize);
21207
- resizeObserver.observe(node);
21208
- return () => {
21209
- resizeObserver.unobserve(node);
21210
- resizeObserver.disconnect(node);
21211
- resizeObserver = null;
21212
- };
21213
- }
21214
- handleResize();
21215
- window.addEventListener('resize', handleResize);
21216
- return () => {
21217
- window.removeEventListener('resize', handleResize);
21218
- };
21219
- }, [node]);
21220
- return [callbackRef, rect, node];
21221
- }
21222
20908
 
21223
- function getFontSize(size) {
21224
- if (size === 'large') {
21225
- return '20px';
21226
- }
21227
- if (size === 'small') {
21228
- return '12px';
20909
+ const unsubscribe = () => {
20910
+ model.removeListener('changed', onChanged);
20911
+ rpcResultStore.clear(model.id);
20912
+ rpcRequestStore.clear(model.id);
20913
+ rpcRequestSessionModelStore.clear(model.id);
20914
+ rpcRequestModelStore.clear(model.id);
20915
+ modelChangedStore.clear(model.id);
20916
+ modelInitializedStore.clear(model.id);
20917
+ };
20918
+ switch (type) {
20919
+ case 'SET':
20920
+ if (!initialized) {
20921
+ model.on('changed', onChanged);
20922
+ model.once('closed', () => {
20923
+ unsubscribe();
20924
+ });
20925
+ }
20926
+ break;
21229
20927
  }
21230
- return '16px';
21231
- }
21232
- function SvgIcon(_ref) {
21233
- let {
21234
- size,
21235
- style = {},
21236
- viewBox = '0 0 16 16',
21237
- shapes = []
21238
- } = _ref;
21239
- const s = _objectSpread2({
21240
- fontSize: getFontSize(size),
21241
- display: 'inline-block',
21242
- fontStyle: 'normal',
21243
- lineHeight: '0',
21244
- textAlign: 'center',
21245
- textTransform: 'none',
21246
- verticalAlign: '-.125em',
21247
- textRendering: 'optimizeLegibility',
21248
- WebkitFontSmoothing: 'antialiased',
21249
- MozOsxFontSmoothing: 'grayscale'
21250
- }, style);
21251
- return /*#__PURE__*/React.createElement("i", {
21252
- style: s
21253
- }, /*#__PURE__*/React.createElement("svg", {
21254
- xmlns: "http://www.w3.org/2000/svg",
21255
- width: "1em",
21256
- height: "1em",
21257
- viewBox: viewBox,
21258
- fill: "currentColor"
21259
- }, shapes.map((_ref2, ix) => {
21260
- let {
21261
- type: Type,
21262
- attrs
21263
- } = _ref2;
21264
- return (
21265
- /*#__PURE__*/
21266
- // eslint-disable-next-line react/no-array-index-key
21267
- React.createElement(Type, _extends$8({
21268
- key: ix
21269
- }, attrs))
21270
- );
21271
- })));
21272
- }
21273
-
21274
- const remove = props => _objectSpread2(_objectSpread2({}, props), {}, {
21275
- shapes: [{
21276
- type: 'path',
21277
- attrs: {
21278
- 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'
21279
- }
21280
- }]
21281
- });
21282
- var Remove = (props => SvgIcon(remove(props)));
21283
-
21284
- const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
21285
- shapes: [{
21286
- type: 'path',
21287
- attrs: {
21288
- 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'
21289
- }
21290
- }]
21291
- });
21292
- var Lock = (props => SvgIcon(lock(props)));
20928
+ return unsubscribe;
20929
+ };
20930
+ const [useModelStore, modelStore] = createKeyStore({}, modelStoreMiddleware);
20931
+ const subscribe = model => {
20932
+ const unsubscribe = modelStoreMiddleware({
20933
+ type: 'SET',
20934
+ value: model
20935
+ });
20936
+ return () => {
20937
+ unsubscribe();
20938
+ modelStore.clear(model.id);
20939
+ };
20940
+ };
21293
20941
 
21294
- const unlock = props => _objectSpread2(_objectSpread2({}, props), {}, {
21295
- shapes: [{
21296
- type: 'path',
21297
- attrs: {
21298
- 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'
20942
+ function useSessionModel(definition, app) {
20943
+ const key = app ? "".concat(app.id, "/").concat(JSON.stringify(definition)) : null;
20944
+ const [modelStore] = useModelStore();
20945
+ const [rpcRequestSessionModelStore] = useRpcRequestSessionModelStore();
20946
+ const [model, setModel] = reactExports.useState();
20947
+ let rpcShared;
20948
+ if (key) {
20949
+ rpcShared = rpcRequestSessionModelStore.get(key);
20950
+ }
20951
+ for (var _len = arguments.length, deps = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
20952
+ deps[_key - 2] = arguments[_key];
20953
+ }
20954
+ reactExports.useEffect(() => {
20955
+ if (!app) {
20956
+ return;
21299
20957
  }
21300
- }]
21301
- });
21302
- var Unlock = (props => SvgIcon(unlock(props)));
21303
-
21304
- function isRangeVisible(_ref) {
21305
- var lastRenderedStartIndex = _ref.lastRenderedStartIndex,
21306
- lastRenderedStopIndex = _ref.lastRenderedStopIndex,
21307
- startIndex = _ref.startIndex,
21308
- stopIndex = _ref.stopIndex;
21309
-
21310
- return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
20958
+ // Create new session object
20959
+ const create = async () => {
20960
+ if (!rpcShared) {
20961
+ const rpc = app.createSessionObject(definition);
20962
+ rpcShared = rpc;
20963
+ rpcRequestSessionModelStore.set(key, rpcShared);
20964
+ }
20965
+ const newModel = await rpcShared;
20966
+ modelStore.set(key, newModel);
20967
+ setModel(newModel);
20968
+ };
20969
+ create();
20970
+ }, [app, ...deps]);
20971
+ return [model];
21311
20972
  }
21312
20973
 
21313
- function scanForUnloadedRanges(_ref) {
21314
- var isItemLoaded = _ref.isItemLoaded,
21315
- itemCount = _ref.itemCount,
21316
- minimumBatchSize = _ref.minimumBatchSize,
21317
- startIndex = _ref.startIndex,
21318
- stopIndex = _ref.stopIndex;
21319
-
21320
- var unloadedRanges = [];
21321
-
21322
- var rangeStartIndex = null;
21323
- var rangeStopIndex = null;
21324
-
21325
- for (var _index = startIndex; _index <= stopIndex; _index++) {
21326
- var loaded = isItemLoaded(_index);
20974
+ const definition = {
20975
+ qInfo: {
20976
+ qType: 'current-selections'
20977
+ },
20978
+ qSelectionObjectDef: {
20979
+ qStateName: '$'
20980
+ },
20981
+ alternateStates: []
20982
+ };
20983
+ function useCurrentSelectionsModel(app) {
20984
+ return useSessionModel(definition, app);
20985
+ }
21327
20986
 
21328
- if (!loaded) {
21329
- rangeStopIndex = _index;
21330
- if (rangeStartIndex === null) {
21331
- rangeStartIndex = _index;
20987
+ const rpcReducer = (state, action) => {
20988
+ const {
20989
+ rpcResultStore,
20990
+ key,
20991
+ method
20992
+ } = action;
20993
+ let newState;
20994
+ switch (action.type) {
20995
+ case 'INVALID':
20996
+ {
20997
+ newState = _objectSpread2(_objectSpread2({}, state), {}, {
20998
+ valid: false,
20999
+ invalid: true,
21000
+ validating: true,
21001
+ canCancel: true,
21002
+ canRetry: false,
21003
+ rpcRetry: false
21004
+ });
21005
+ break;
21332
21006
  }
21333
- } else if (rangeStopIndex !== null) {
21334
- unloadedRanges.push(rangeStartIndex, rangeStopIndex);
21335
-
21336
- rangeStartIndex = rangeStopIndex = null;
21337
- }
21338
- }
21339
-
21340
- // If :rangeStopIndex is not null it means we haven't ran out of unloaded rows.
21341
- // Scan forward to try filling our :minimumBatchSize.
21342
- if (rangeStopIndex !== null) {
21343
- var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), itemCount - 1);
21344
-
21345
- for (var _index2 = rangeStopIndex + 1; _index2 <= potentialStopIndex; _index2++) {
21346
- if (!isItemLoaded(_index2)) {
21347
- rangeStopIndex = _index2;
21348
- } else {
21007
+ case 'VALID':
21008
+ {
21009
+ newState = {
21010
+ result: _objectSpread2({}, action.result),
21011
+ invalid: false,
21012
+ valid: true,
21013
+ validating: false,
21014
+ canCancel: false,
21015
+ canRetry: false,
21016
+ rpcRetry: false
21017
+ };
21349
21018
  break;
21350
21019
  }
21351
- }
21352
-
21353
- unloadedRanges.push(rangeStartIndex, rangeStopIndex);
21354
- }
21355
-
21356
- // Check to see if our first range ended prematurely.
21357
- // In this case we should scan backwards to try filling our :minimumBatchSize.
21358
- if (unloadedRanges.length) {
21359
- while (unloadedRanges[1] - unloadedRanges[0] + 1 < minimumBatchSize && unloadedRanges[0] > 0) {
21360
- var _index3 = unloadedRanges[0] - 1;
21361
-
21362
- if (!isItemLoaded(_index3)) {
21363
- unloadedRanges[0] = _index3;
21364
- } else {
21020
+ case 'CANCELLED':
21021
+ {
21022
+ newState = _objectSpread2(_objectSpread2({}, state), {}, {
21023
+ invalid: true,
21024
+ valid: false,
21025
+ validating: false,
21026
+ canCancel: false,
21027
+ canRetry: true,
21028
+ rpcRetry: false
21029
+ });
21365
21030
  break;
21366
21031
  }
21367
- }
21368
- }
21369
-
21370
- return unloadedRanges;
21371
- }
21372
-
21373
- var classCallCheck$1 = function (instance, Constructor) {
21374
- if (!(instance instanceof Constructor)) {
21375
- throw new TypeError("Cannot call a class as a function");
21032
+ default:
21033
+ throw new Error('Undefined action');
21034
+ }
21035
+ let sharedState = rpcResultStore.get(key);
21036
+ if (!sharedState) {
21037
+ sharedState = {};
21376
21038
  }
21039
+ sharedState[method] = newState;
21040
+ rpcResultStore.set(key, sharedState);
21041
+ return newState;
21377
21042
  };
21378
-
21379
- var createClass$1 = function () {
21380
- function defineProperties(target, props) {
21381
- for (var i = 0; i < props.length; i++) {
21382
- var descriptor = props[i];
21383
- descriptor.enumerable = descriptor.enumerable || false;
21384
- descriptor.configurable = true;
21385
- if ("value" in descriptor) descriptor.writable = true;
21386
- Object.defineProperty(target, descriptor.key, descriptor);
21043
+ function useRpc(model, method) {
21044
+ const key = model ? "".concat(model.id) : null;
21045
+ const [rpcResultStore] = useRpcResultStore();
21046
+ const [state, dispatch] = reactExports.useReducer(rpcReducer, key ? rpcResultStore.get(key) : null);
21047
+ const [modelChangedStore] = useModelChangedStore();
21048
+ const [rpcRequestStore] = useRpcRequestStore();
21049
+ let rpcShared;
21050
+ if (key) {
21051
+ rpcShared = rpcRequestStore.get(key);
21052
+ if (!rpcShared) {
21053
+ rpcShared = {};
21054
+ rpcRequestStore.set(key, rpcShared);
21387
21055
  }
21388
21056
  }
21389
-
21390
- return function (Constructor, protoProps, staticProps) {
21391
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
21392
- if (staticProps) defineProperties(Constructor, staticProps);
21393
- return Constructor;
21057
+ const call = async skipRetry => {
21058
+ let cache = rpcShared[method];
21059
+ if (!cache || cache && cache.rpcRetry) {
21060
+ const rpc = model[method]();
21061
+ cache = {
21062
+ rpc,
21063
+ rpcRetry: false
21064
+ };
21065
+ rpcShared[method] = cache;
21066
+ dispatch({
21067
+ type: 'INVALID',
21068
+ method,
21069
+ key,
21070
+ model,
21071
+ rpcResultStore,
21072
+ canCancel: true
21073
+ });
21074
+ }
21075
+ try {
21076
+ // await sleep(5000);
21077
+ const result = await cache.rpc;
21078
+ dispatch({
21079
+ type: 'VALID',
21080
+ result,
21081
+ key,
21082
+ method,
21083
+ model,
21084
+ rpcResultStore
21085
+ });
21086
+ } catch (err) {
21087
+ if (err.code === 15 && !skipRetry) {
21088
+ // Request aborted. This will be called multiple times by hooks only retry once
21089
+ if (!cache.rpcRetry) {
21090
+ cache.rpcRetry = true;
21091
+ }
21092
+ call(true);
21093
+ }
21094
+ }
21394
21095
  };
21395
- }();
21096
+ const longrunning = {
21097
+ cancel: async () => {
21098
+ const global = model.session.getObjectApi({
21099
+ handle: -1
21100
+ });
21101
+ await global.cancelRequest(rpcShared[method].rpc.requestId);
21102
+ dispatch({
21103
+ type: 'CANCELLED',
21104
+ key,
21105
+ method,
21106
+ model,
21107
+ rpcResultStore
21108
+ });
21109
+ },
21110
+ retry: () => {
21111
+ rpcShared[method].rpcRetry = true;
21112
+ call();
21113
+ }
21114
+ };
21115
+ reactExports.useEffect(() => {
21116
+ if (!model) return undefined;
21117
+ call();
21118
+ return undefined;
21119
+ }, [model, modelChangedStore.get(model && model.id), key, method]);
21120
+ return [
21121
+ // Result
21122
+ state && state.result, {
21123
+ validating: state && state.validating,
21124
+ canCancel: state && state.canCancel,
21125
+ canRetry: state && state.canRetry
21126
+ },
21127
+ // Long running api e.g cancel retry
21128
+ longrunning];
21129
+ }
21396
21130
 
21397
- var inherits$1 = function (subClass, superClass) {
21398
- if (typeof superClass !== "function" && superClass !== null) {
21399
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
21400
- }
21131
+ function useLayout$1(model) {
21132
+ return useRpc(model, 'getLayout');
21133
+ }
21134
+ function useAppLayout$1(model) {
21135
+ return useRpc(model, 'getAppLayout');
21136
+ }
21401
21137
 
21402
- subClass.prototype = Object.create(superClass && superClass.prototype, {
21403
- constructor: {
21404
- value: subClass,
21405
- enumerable: false,
21406
- writable: true,
21407
- configurable: true
21138
+ function useRect$1() {
21139
+ const [node, setNode] = reactExports.useState();
21140
+ const [rect, setRect] = reactExports.useState();
21141
+ const callbackRef = reactExports.useCallback(ref => {
21142
+ if (!ref) {
21143
+ return;
21408
21144
  }
21409
- });
21410
- if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
21411
- };
21145
+ setNode(ref);
21146
+ }, []);
21147
+ const handleResize = () => {
21148
+ const {
21149
+ left,
21150
+ top,
21151
+ width,
21152
+ height
21153
+ } = node.getBoundingClientRect();
21154
+ setRect({
21155
+ left,
21156
+ top,
21157
+ width,
21158
+ height
21159
+ });
21160
+ };
21161
+ reactExports.useLayoutEffect(() => {
21162
+ if (!node) {
21163
+ return undefined;
21164
+ }
21165
+ if (typeof ResizeObserver === 'function') {
21166
+ let resizeObserver = new ResizeObserver(handleResize);
21167
+ resizeObserver.observe(node);
21168
+ return () => {
21169
+ resizeObserver.unobserve(node);
21170
+ resizeObserver.disconnect(node);
21171
+ resizeObserver = null;
21172
+ };
21173
+ }
21174
+ handleResize();
21175
+ window.addEventListener('resize', handleResize);
21176
+ return () => {
21177
+ window.removeEventListener('resize', handleResize);
21178
+ };
21179
+ }, [node]);
21180
+ return [callbackRef, rect, node];
21181
+ }
21412
21182
 
21413
- var possibleConstructorReturn$1 = function (self, call) {
21414
- if (!self) {
21415
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21183
+ function getFontSize(size) {
21184
+ if (size === 'large') {
21185
+ return '20px';
21416
21186
  }
21187
+ if (size === 'small') {
21188
+ return '12px';
21189
+ }
21190
+ return '16px';
21191
+ }
21192
+ function SvgIcon(_ref) {
21193
+ let {
21194
+ size,
21195
+ style = {},
21196
+ viewBox = '0 0 16 16',
21197
+ shapes = []
21198
+ } = _ref;
21199
+ const s = _objectSpread2({
21200
+ fontSize: getFontSize(size),
21201
+ display: 'inline-block',
21202
+ fontStyle: 'normal',
21203
+ lineHeight: '0',
21204
+ textAlign: 'center',
21205
+ textTransform: 'none',
21206
+ verticalAlign: '-.125em',
21207
+ textRendering: 'optimizeLegibility',
21208
+ WebkitFontSmoothing: 'antialiased',
21209
+ MozOsxFontSmoothing: 'grayscale'
21210
+ }, style);
21211
+ return /*#__PURE__*/React.createElement("i", {
21212
+ style: s
21213
+ }, /*#__PURE__*/React.createElement("svg", {
21214
+ xmlns: "http://www.w3.org/2000/svg",
21215
+ width: "1em",
21216
+ height: "1em",
21217
+ viewBox: viewBox,
21218
+ fill: "currentColor"
21219
+ }, shapes.map((_ref2, ix) => {
21220
+ let {
21221
+ type: Type,
21222
+ attrs
21223
+ } = _ref2;
21224
+ return (
21225
+ /*#__PURE__*/
21226
+ // eslint-disable-next-line react/no-array-index-key
21227
+ React.createElement(Type, _extends$8({
21228
+ key: ix
21229
+ }, attrs))
21230
+ );
21231
+ })));
21232
+ }
21417
21233
 
21418
- return call && (typeof call === "object" || typeof call === "function") ? call : self;
21419
- };
21420
-
21421
- var InfiniteLoader = function (_PureComponent) {
21422
- inherits$1(InfiniteLoader, _PureComponent);
21423
-
21424
- function InfiniteLoader() {
21425
- var _ref;
21426
-
21427
- var _temp, _this, _ret;
21428
-
21429
- classCallCheck$1(this, InfiniteLoader);
21430
-
21431
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
21432
- args[_key] = arguments[_key];
21234
+ const remove = props => _objectSpread2(_objectSpread2({}, props), {}, {
21235
+ shapes: [{
21236
+ type: 'path',
21237
+ attrs: {
21238
+ 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'
21433
21239
  }
21240
+ }]
21241
+ });
21242
+ var Remove = (props => SvgIcon(remove(props)));
21243
+
21244
+ const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
21245
+ shapes: [{
21246
+ type: 'path',
21247
+ attrs: {
21248
+ 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'
21249
+ }
21250
+ }]
21251
+ });
21252
+ var Lock = (props => SvgIcon(lock(props)));
21253
+
21254
+ const unlock = props => _objectSpread2(_objectSpread2({}, props), {}, {
21255
+ shapes: [{
21256
+ type: 'path',
21257
+ attrs: {
21258
+ 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'
21259
+ }
21260
+ }]
21261
+ });
21262
+ var Unlock = (props => SvgIcon(unlock(props)));
21263
+
21264
+ function isRangeVisible(_ref) {
21265
+ var lastRenderedStartIndex = _ref.lastRenderedStartIndex,
21266
+ lastRenderedStopIndex = _ref.lastRenderedStopIndex,
21267
+ startIndex = _ref.startIndex,
21268
+ stopIndex = _ref.stopIndex;
21269
+
21270
+ return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
21271
+ }
21272
+
21273
+ function scanForUnloadedRanges(_ref) {
21274
+ var isItemLoaded = _ref.isItemLoaded,
21275
+ itemCount = _ref.itemCount,
21276
+ minimumBatchSize = _ref.minimumBatchSize,
21277
+ startIndex = _ref.startIndex,
21278
+ stopIndex = _ref.stopIndex;
21279
+
21280
+ var unloadedRanges = [];
21281
+
21282
+ var rangeStartIndex = null;
21283
+ var rangeStopIndex = null;
21284
+
21285
+ for (var _index = startIndex; _index <= stopIndex; _index++) {
21286
+ var loaded = isItemLoaded(_index);
21287
+
21288
+ if (!loaded) {
21289
+ rangeStopIndex = _index;
21290
+ if (rangeStartIndex === null) {
21291
+ rangeStartIndex = _index;
21292
+ }
21293
+ } else if (rangeStopIndex !== null) {
21294
+ unloadedRanges.push(rangeStartIndex, rangeStopIndex);
21295
+
21296
+ rangeStartIndex = rangeStopIndex = null;
21297
+ }
21298
+ }
21299
+
21300
+ // If :rangeStopIndex is not null it means we haven't ran out of unloaded rows.
21301
+ // Scan forward to try filling our :minimumBatchSize.
21302
+ if (rangeStopIndex !== null) {
21303
+ var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), itemCount - 1);
21304
+
21305
+ for (var _index2 = rangeStopIndex + 1; _index2 <= potentialStopIndex; _index2++) {
21306
+ if (!isItemLoaded(_index2)) {
21307
+ rangeStopIndex = _index2;
21308
+ } else {
21309
+ break;
21310
+ }
21311
+ }
21312
+
21313
+ unloadedRanges.push(rangeStartIndex, rangeStopIndex);
21314
+ }
21315
+
21316
+ // Check to see if our first range ended prematurely.
21317
+ // In this case we should scan backwards to try filling our :minimumBatchSize.
21318
+ if (unloadedRanges.length) {
21319
+ while (unloadedRanges[1] - unloadedRanges[0] + 1 < minimumBatchSize && unloadedRanges[0] > 0) {
21320
+ var _index3 = unloadedRanges[0] - 1;
21321
+
21322
+ if (!isItemLoaded(_index3)) {
21323
+ unloadedRanges[0] = _index3;
21324
+ } else {
21325
+ break;
21326
+ }
21327
+ }
21328
+ }
21329
+
21330
+ return unloadedRanges;
21331
+ }
21332
+
21333
+ var classCallCheck$1 = function (instance, Constructor) {
21334
+ if (!(instance instanceof Constructor)) {
21335
+ throw new TypeError("Cannot call a class as a function");
21336
+ }
21337
+ };
21338
+
21339
+ var createClass$1 = function () {
21340
+ function defineProperties(target, props) {
21341
+ for (var i = 0; i < props.length; i++) {
21342
+ var descriptor = props[i];
21343
+ descriptor.enumerable = descriptor.enumerable || false;
21344
+ descriptor.configurable = true;
21345
+ if ("value" in descriptor) descriptor.writable = true;
21346
+ Object.defineProperty(target, descriptor.key, descriptor);
21347
+ }
21348
+ }
21349
+
21350
+ return function (Constructor, protoProps, staticProps) {
21351
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
21352
+ if (staticProps) defineProperties(Constructor, staticProps);
21353
+ return Constructor;
21354
+ };
21355
+ }();
21356
+
21357
+ var inherits$1 = function (subClass, superClass) {
21358
+ if (typeof superClass !== "function" && superClass !== null) {
21359
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
21360
+ }
21361
+
21362
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
21363
+ constructor: {
21364
+ value: subClass,
21365
+ enumerable: false,
21366
+ writable: true,
21367
+ configurable: true
21368
+ }
21369
+ });
21370
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
21371
+ };
21372
+
21373
+ var possibleConstructorReturn$1 = function (self, call) {
21374
+ if (!self) {
21375
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
21376
+ }
21377
+
21378
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
21379
+ };
21380
+
21381
+ var InfiniteLoader = function (_PureComponent) {
21382
+ inherits$1(InfiniteLoader, _PureComponent);
21383
+
21384
+ function InfiniteLoader() {
21385
+ var _ref;
21386
+
21387
+ var _temp, _this, _ret;
21388
+
21389
+ classCallCheck$1(this, InfiniteLoader);
21390
+
21391
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
21392
+ args[_key] = arguments[_key];
21393
+ }
21394
+
21395
+ return _ret = (_temp = (_this = possibleConstructorReturn$1(this, (_ref = InfiniteLoader.__proto__ || Object.getPrototypeOf(InfiniteLoader)).call.apply(_ref, [this].concat(args))), _this), _this._lastRenderedStartIndex = -1, _this._lastRenderedStopIndex = -1, _this._memoizedUnloadedRanges = [], _this._onItemsRendered = function (_ref2) {
21396
+ var visibleStartIndex = _ref2.visibleStartIndex,
21397
+ visibleStopIndex = _ref2.visibleStopIndex;
21434
21398
 
21435
- return _ret = (_temp = (_this = possibleConstructorReturn$1(this, (_ref = InfiniteLoader.__proto__ || Object.getPrototypeOf(InfiniteLoader)).call.apply(_ref, [this].concat(args))), _this), _this._lastRenderedStartIndex = -1, _this._lastRenderedStopIndex = -1, _this._memoizedUnloadedRanges = [], _this._onItemsRendered = function (_ref2) {
21436
- var visibleStartIndex = _ref2.visibleStartIndex,
21437
- visibleStopIndex = _ref2.visibleStopIndex;
21438
-
21439
21399
  _this._lastRenderedStartIndex = visibleStartIndex;
21440
21400
  _this._lastRenderedStopIndex = visibleStopIndex;
21441
21401
 
@@ -21558,9 +21518,6 @@
21558
21518
  function isStateSelected(qState) {
21559
21519
  return SELECTED_STATES.includes(qState);
21560
21520
  }
21561
- function getUniques(arr) {
21562
- return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
21563
- }
21564
21521
  function getSelectedValues(pages) {
21565
21522
  if (!pages || !pages.length) {
21566
21523
  return [];
@@ -21574,45 +21531,38 @@
21574
21531
  });
21575
21532
  return flatten(elementNbrs);
21576
21533
  }
21577
- function applySelectionsOnPages(pages, elmNumbers) {
21578
- let clearAllButElmNumbers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
21579
- const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
21580
- const matrices = pages.map(page => {
21581
- const qMatrix = page.qMatrix.map(p => {
21582
- const [p0] = p;
21583
- const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
21584
- let qState;
21585
- if (clearAllButElmNumbers) {
21586
- qState = selectionMatchesElement ? 'S' : 'A';
21587
- } else {
21588
- qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
21589
- }
21590
- return [_objectSpread2(_objectSpread2({}, p0), {}, {
21591
- qState
21592
- }), p.slice(1)];
21593
- });
21594
- return _objectSpread2(_objectSpread2({}, page), {}, {
21595
- qMatrix
21596
- });
21597
- });
21598
- return matrices;
21599
- }
21600
21534
  async function selectValues(_ref) {
21601
21535
  let {
21602
21536
  selections,
21603
21537
  elemNumbers,
21604
- isSingleSelect = false
21538
+ toggle,
21539
+ isSingleSelect
21605
21540
  } = _ref;
21606
- let resolved = Promise.resolve(false);
21541
+ if (elemNumbers.length === 0) {
21542
+ return false;
21543
+ }
21607
21544
  const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
21545
+ let success = false;
21608
21546
  if (!hasNanValues) {
21609
21547
  const elemNumbersToSelect = elemNumbers;
21610
- resolved = selections.select({
21611
- method: 'selectListObjectValues',
21612
- params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
21613
- }).then(success => success !== false).catch(() => false);
21548
+ try {
21549
+ const response = await selections.select({
21550
+ method: 'selectListObjectValues',
21551
+ params: ['/qListObjectDef', elemNumbersToSelect, toggle]
21552
+ });
21553
+ success = response !== false;
21554
+ } catch (_unused) {
21555
+ success = false;
21556
+ }
21557
+ if (!success) {
21558
+ if (isSingleSelect) {
21559
+ selections.cancel(); // revert selection
21560
+ } else {
21561
+ selections.clear();
21562
+ }
21563
+ }
21614
21564
  }
21615
- return resolved;
21565
+ return success;
21616
21566
  }
21617
21567
  function getElemNumbersFromPages(pages) {
21618
21568
  if (!pages || !pages.length) {
@@ -21675,126 +21625,132 @@
21675
21625
  return elemNumbersOrdered.slice(min, max + 1);
21676
21626
  }
21677
21627
 
21628
+ const getKeyAsToggleSelected = event => !(event.metaKey || event.ctrlKey);
21678
21629
  function useSelectionsInteractions(_ref) {
21679
21630
  let {
21680
- layout,
21631
+ selectionState,
21681
21632
  selections,
21682
- pages = [],
21683
21633
  checkboxes = false,
21684
- selectDisabled,
21685
- doc = document,
21686
- isSingleSelect: singleSelect = false
21634
+ doc = document
21687
21635
  } = _ref;
21688
- const [instantPages, setInstantPages] = reactExports.useState(pages);
21689
- const [mouseDown, setMouseDown] = reactExports.useState(false);
21690
- const [selectingValues, setSelectingValues] = reactExports.useState(false);
21691
- const [isSingleSelect, setIsSingleSelect] = reactExports.useState(singleSelect);
21692
- const [selected, setSelected] = reactExports.useState([]);
21693
- const [isRangeSelection, setIsRangeSelection] = reactExports.useState(false);
21694
- const [preSelected, setPreSelected] = reactExports.useState([]);
21695
- const elemNumbersOrdered = getElemNumbersFromPages(pages);
21696
- reactExports.useEffect(() => {
21697
- setIsSingleSelect(singleSelect);
21698
- }, [singleSelect]);
21699
-
21700
- // Select values for real, by calling the backend.
21701
- const select = async function () {
21702
- let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21703
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21704
- if (selectDisabled()) {
21705
- return;
21706
- }
21707
- setSelectingValues(true);
21708
- const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
21709
- await selectValues({
21636
+ const currentSelect = reactExports.useRef({
21637
+ startElemNumber: undefined,
21638
+ elemNumbers: [],
21639
+ isRange: false,
21640
+ toggle: false,
21641
+ active: false
21642
+ });
21643
+
21644
+ // eslint-disable-next-line arrow-body-style
21645
+ const doSelect = () => {
21646
+ selectionState.setSelectableValuesUpdating();
21647
+ return selectValues({
21710
21648
  selections,
21711
- elemNumbers: filtered,
21712
- isSingleSelect
21649
+ elemNumbers: currentSelect.current.elemNumbers,
21650
+ isSingleSelect: selectionState.isSingleSelect,
21651
+ toggle: currentSelect.current.toggle
21713
21652
  });
21714
- setSelectingValues(false);
21715
- setPreSelected([]);
21716
21653
  };
21717
-
21718
- // Show estimated selection states instantly before applying the selections for real.
21719
- const preSelect = function (elemNumbers) {
21720
- let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21721
- if (selectDisabled()) {
21654
+ const addToRange = elemNumber => {
21655
+ const {
21656
+ startElemNumber
21657
+ } = currentSelect.current;
21658
+ if (startElemNumber === elemNumber) {
21722
21659
  return;
21723
21660
  }
21724
- setPreSelected(existing => {
21725
- const uniques = getUniques([...existing, ...elemNumbers]);
21726
- const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
21727
- const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
21728
- return filled;
21729
- });
21661
+ const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
21662
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
21663
+ const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
21664
+ selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
21730
21665
  };
21731
21666
  const selectManually = function () {
21732
21667
  let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
21733
21668
  let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21734
- setIsRangeSelection(false); // range is not supported for manual select
21735
- setMouseDown(true);
21736
- preSelect(elementIds, additive || isRangeSelection);
21737
- const p = select(elementIds, additive || isRangeSelection);
21738
- setMouseDown(false);
21739
- return p;
21740
- };
21741
- const handleSingleSelectKey = event => {
21669
+ const elemNumbers = [];
21670
+ selectionState.updateItems(elementIds, additive, elemNumbers);
21671
+ selectionState.setSelectableValuesUpdating();
21672
+ return selectValues({
21673
+ selections,
21674
+ elemNumbers: additive ? elemNumbers : elementIds,
21675
+ isSingleSelect: selectionState.isSingleSelect,
21676
+ toggle: !selectionState.isSingleSelect
21677
+ });
21678
+ };
21679
+ const handleSingleSelectKey = (event, target) => {
21742
21680
  if (event.ctrlKey || event.metaKey) {
21743
- setIsSingleSelect(true);
21744
- event.currentTarget.focus(); // will not be focused otherwise
21681
+ target.focus(); // will not be focused otherwise
21745
21682
  event.preventDefault();
21746
21683
  }
21747
21684
  };
21748
- const onClick = reactExports.useCallback(event => {
21749
- if (selectingValues || selectDisabled()) {
21685
+ const onChange = reactExports.useCallback(event => {
21686
+ if (selectionState.selectDisabled()) {
21750
21687
  return;
21751
21688
  }
21752
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21753
- setPreSelected([elemNumber]);
21754
- handleSingleSelectKey(event);
21755
- }, [selectingValues, selectDisabled]);
21689
+ const elemNumber = +event.target.getAttribute('data-n');
21690
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event.nativeEvent);
21691
+ currentSelect.current.elemNumbers = [elemNumber];
21692
+ currentSelect.current.toggle = toggle;
21693
+ if (!toggle) {
21694
+ selectionState.clearItemStates(true);
21695
+ }
21696
+ selectionState.updateItem(elemNumber);
21697
+ currentSelect.current.active = false;
21698
+ doSelect();
21699
+ }, []);
21756
21700
  const onMouseDown = reactExports.useCallback(event => {
21757
- if (selectingValues || selectDisabled()) {
21701
+ if (selectionState.selectDisabled()) {
21758
21702
  return;
21759
21703
  }
21760
- setIsRangeSelection(false);
21761
- setMouseDown(true);
21762
21704
  const elemNumber = +event.currentTarget.getAttribute('data-n');
21763
- setPreSelected([elemNumber]);
21764
- handleSingleSelectKey(event);
21765
- }, [selectingValues, selectDisabled]);
21705
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event);
21706
+ currentSelect.current.isRange = false;
21707
+ currentSelect.current.startElemNumber = elemNumber;
21708
+ currentSelect.current.elemNumbers = [elemNumber];
21709
+ currentSelect.current.toggle = toggle;
21710
+ currentSelect.current.active = true;
21711
+ if (!toggle) {
21712
+ selectionState.clearItemStates(true);
21713
+ }
21714
+ selectionState.updateItem(elemNumber);
21715
+ if (selectionState.isSingleSelect) {
21716
+ currentSelect.current.active = false;
21717
+ doSelect();
21718
+ }
21719
+ handleSingleSelectKey(event, event.currentTarget);
21720
+ }, []);
21766
21721
  const onMouseUp = reactExports.useCallback(event => {
21767
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21768
- if (isSingleSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
21769
- ) {
21722
+ if (!currentSelect.current.active) {
21770
21723
  return;
21771
21724
  }
21772
- preSelect([elemNumber]);
21773
- }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection, selectDisabled]);
21725
+ currentSelect.current.active = false;
21726
+ if (currentSelect.current.isRange) {
21727
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
21728
+ addToRange(elemNumber);
21729
+ }
21730
+ doSelect();
21731
+ }, []);
21774
21732
  const onMouseUpDoc = reactExports.useCallback(() => {
21775
21733
  // Ensure we end interactions when mouseup happens outside the Listbox.
21776
- setMouseDown(false);
21777
- setSelectingValues(false);
21778
- setIsRangeSelection(false);
21779
- setIsSingleSelect(singleSelect);
21780
- }, [singleSelect]);
21781
- const onMouseEnter = reactExports.useCallback(event => {
21782
- if (isSingleSelect || !mouseDown || selectingValues || selectDisabled()) {
21734
+ if (!currentSelect.current.active) {
21783
21735
  return;
21784
21736
  }
21785
- setIsRangeSelection(true);
21786
- const elemNumber = +event.currentTarget.getAttribute('data-n');
21787
- preSelect([elemNumber], true);
21788
- }, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, selectDisabled, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
21789
- reactExports.useEffect(() => {
21790
- // Perform selections of pre-selected values. This can
21791
- // happen only when interactions have finished (mouseup).
21792
- const interactionIsFinished = !mouseDown;
21793
- if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
21737
+ currentSelect.current.active = false;
21738
+ doSelect();
21739
+ }, []);
21740
+ const onMouseEnter = reactExports.useCallback(event => {
21741
+ if (!currentSelect.current.active) {
21794
21742
  return;
21795
21743
  }
21796
- select(preSelected, isRangeSelection);
21797
- }, [preSelected, mouseDown, selectDisabled()]);
21744
+ if (!currentSelect.current.isRange) {
21745
+ currentSelect.current.isRange = true;
21746
+ if (!selectionState.isSelected(currentSelect.current.startElemNumber)) {
21747
+ selectionState.updateItem(currentSelect.current.startElemNumber, true);
21748
+ currentSelect.current.elemNumbers = [];
21749
+ }
21750
+ }
21751
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
21752
+ addToRange(elemNumber);
21753
+ }, []);
21798
21754
  reactExports.useEffect(() => {
21799
21755
  doc.addEventListener('mouseup', onMouseUpDoc);
21800
21756
  return () => {
@@ -21802,25 +21758,24 @@
21802
21758
  };
21803
21759
  }, [onMouseUpDoc]);
21804
21760
  reactExports.useEffect(() => {
21805
- if (selectingValues || mouseDown) {
21806
- return;
21807
- }
21808
- // Keep track of (truely) selected fields so we can prevent toggling them on range select.
21809
- const alreadySelected = getSelectedValues(pages);
21810
- setSelected(alreadySelected);
21811
- }, [pages]);
21812
- reactExports.useEffect(() => {
21813
- if (selectingValues || !pages || !checkboxes && !mouseDown) {
21814
- return;
21815
- }
21816
- // Render pre-selections before they have been selected in Engine.
21817
- const newPages = applySelectionsOnPages(pages, preSelected, isSingleSelect);
21818
- setInstantPages(newPages);
21819
- }, [preSelected]);
21761
+ const onDeactivated = () => {
21762
+ selectionState.clearItemStates(false);
21763
+ };
21764
+ const onCleared = () => {
21765
+ selectionState.clearItemStates(true);
21766
+ selectionState.triggerStateChanged();
21767
+ };
21768
+ selections.on('deactivated', onDeactivated);
21769
+ selections.on('cleared', onCleared);
21770
+ return () => {
21771
+ selections.removeListener('activated', onDeactivated);
21772
+ selections.removeListener('cleared', onCleared);
21773
+ };
21774
+ }, [selections]);
21820
21775
  const interactionEvents = {};
21821
21776
  if (checkboxes) {
21822
21777
  Object.assign(interactionEvents, {
21823
- onClick
21778
+ onChange
21824
21779
  });
21825
21780
  } else {
21826
21781
  Object.assign(interactionEvents, {
@@ -21830,7 +21785,6 @@
21830
21785
  });
21831
21786
  }
21832
21787
  return {
21833
- instantPages,
21834
21788
  interactionEvents,
21835
21789
  select: selectManually // preselect and select without having to trigger an event
21836
21790
  };
@@ -21846,108 +21800,12 @@
21846
21800
  });
21847
21801
  var Tick = (props => SvgIcon(tick(props)));
21848
21802
 
21849
- 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\")";
21850
-
21851
- const PREFIX$c = 'ListBoxCheckbox';
21852
- const borderRadius = 3;
21853
- const classes$c = {
21854
- cbIcon: "".concat(PREFIX$c, "-cbIcon"),
21855
- cbIconChecked: "".concat(PREFIX$c, "-cbIconChecked"),
21856
- cbIconExcluded: "".concat(PREFIX$c, "-cbIconExcluded"),
21857
- cbIconAlternative: "".concat(PREFIX$c, "-cbIconAlternative"),
21858
- checkbox: "".concat(PREFIX$c, "-checkbox"),
21859
- dense: "".concat(PREFIX$c, "-dense")
21860
- };
21861
- const StyledCheckbox = styled$1(Checkbox$1)(_ref => {
21862
- let {
21863
- theme
21864
- } = _ref;
21865
- return {
21866
- ["& .".concat(classes$c.cbIcon)]: {
21867
- borderRadius,
21868
- width: 16,
21869
- height: 16,
21870
- boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
21871
- backgroundColor: '#f5f8fa',
21872
- backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
21873
- display: 'flex',
21874
- alignItems: 'center',
21875
- justifyContent: 'center'
21876
- },
21877
- ["& .".concat(classes$c.cbIconChecked)]: {
21878
- borderRadius,
21879
- backgroundColor: theme.palette.selected.main,
21880
- backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
21881
- '&:before': {
21882
- display: 'block',
21883
- width: 16,
21884
- height: 16,
21885
- backgroundImage: CheckboxChecked,
21886
- content: '""'
21887
- }
21888
- },
21889
- ["& .".concat(classes$c.cbIconExcluded)]: {
21890
- borderRadius: borderRadius - 1,
21891
- width: 12,
21892
- height: 12,
21893
- backgroundColor: theme.palette.selected.excluded
21894
- },
21895
- ["& .".concat(classes$c.cbIconAlternative)]: {
21896
- borderRadius: borderRadius - 1,
21897
- width: 12,
21898
- height: 12,
21899
- backgroundColor: theme.palette.selected.alternative
21900
- },
21901
- ["&.".concat(classes$c.checkbox)]: {
21902
- margin: 0,
21903
- '&:hover': {
21904
- backgroundColor: 'inherit !important'
21905
- }
21906
- },
21907
- ["&.".concat(classes$c.dense)]: {
21908
- padding: '4px 8px'
21909
- }
21910
- };
21911
- });
21912
- const getIcon = function (cls) {
21913
- let showGray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
21914
- let excluded = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
21915
- return /*#__PURE__*/React.createElement("span", {
21916
- className: cls.cbIcon
21917
- }, excluded && /*#__PURE__*/React.createElement("span", {
21918
- className: showGray && excluded ? cls.cbIconExcluded : ''
21919
- }));
21920
- };
21921
- function ListboxCheckbox(_ref2) {
21922
- let {
21923
- checked,
21924
- label,
21925
- dense,
21926
- excluded,
21927
- showGray = true
21928
- } = _ref2;
21929
- return /*#__PURE__*/React.createElement(StyledCheckbox, {
21930
- edge: "start",
21931
- checked: checked,
21932
- disableRipple: true,
21933
- className: [classes$c.checkbox, dense && classes$c.dense].filter(Boolean).join(' '),
21934
- inputProps: {
21935
- 'aria-labelledby': label
21936
- },
21937
- name: label,
21938
- icon: getIcon(classes$c, showGray, excluded),
21939
- checkedIcon: /*#__PURE__*/React.createElement("span", {
21940
- className: classes$c.cbIconChecked
21941
- })
21942
- });
21943
- }
21944
-
21945
- /**
21946
- * @ignore
21947
- * @interface Range
21948
- * @property {number} qCharPos The (absolute) index where the highlighted range starts.
21949
- * @property {number} qCharCount The length of the sub-string (starting from qChartPos) that should be highlighted.
21950
- */
21803
+ /**
21804
+ * @ignore
21805
+ * @interface Range
21806
+ * @property {number} qCharPos The (absolute) index where the highlighted range starts.
21807
+ * @property {number} qCharCount The length of the sub-string (starting from qChartPos) that should be highlighted.
21808
+ */
21951
21809
 
21952
21810
  /**
21953
21811
  * @ignore
@@ -22006,45 +21864,6 @@
22006
21864
  return labels;
22007
21865
  }
22008
21866
 
22009
- const PREFIX$b = 'ListBoxRadioButton';
22010
- const classes$b = {
22011
- denseRadioButton: "".concat(PREFIX$b, "-denseRadioButton"),
22012
- radioButton: "".concat(PREFIX$b, "-radioButton")
22013
- };
22014
- const StyledRadio = styled$1(Radio$1)(_ref => {
22015
- let {
22016
- theme,
22017
- checked
22018
- } = _ref;
22019
- return {
22020
- ["&.".concat(classes$b.radioButton)]: {
22021
- right: '5px',
22022
- color: checked ? theme.palette.selected.main : theme.palette.main
22023
- }
22024
- };
22025
- });
22026
- function ListBoxRadioButton(_ref2) {
22027
- let {
22028
- checked,
22029
- label,
22030
- dense
22031
- } = _ref2;
22032
- return /*#__PURE__*/React.createElement(StyledRadio, {
22033
- checked: checked,
22034
- value: label,
22035
- name: label,
22036
- className: classes$b.radioButton,
22037
- style: {
22038
- backgroundColor: 'transparent'
22039
- },
22040
- disableRipple: true,
22041
- size: dense ? 'small' : 'medium',
22042
- sx: dense && {
22043
- padding: '0px 0px 0px 12px'
22044
- }
22045
- });
22046
- }
22047
-
22048
21867
  const KEYS = Object.freeze({
22049
21868
  ENTER: 13,
22050
21869
  ESCAPE: 27,
@@ -22270,12 +22089,691 @@
22270
22089
  setHovering(false);
22271
22090
  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);
22272
22091
  }
22273
- };
22274
- return {
22275
- handleKeyDown,
22276
- handleOnMouseEnter,
22277
- handleOnMouseLeave
22278
- };
22092
+ };
22093
+ return {
22094
+ handleKeyDown,
22095
+ handleOnMouseEnter,
22096
+ handleOnMouseLeave
22097
+ };
22098
+ }
22099
+
22100
+ const PREFIX$c = 'RowColumn';
22101
+ const rowColClasses = {
22102
+ row: "".concat(PREFIX$c, "-row"),
22103
+ rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
22104
+ column: "".concat(PREFIX$c, "-column"),
22105
+ fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
22106
+ cell: "".concat(PREFIX$c, "-cell"),
22107
+ labelText: "".concat(PREFIX$c, "-labelText"),
22108
+ labelDense: "".concat(PREFIX$c, "-labelDense"),
22109
+ highlighted: "".concat(PREFIX$c, "-highlighted"),
22110
+ checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
22111
+ icon: "".concat(PREFIX$c, "-icon"),
22112
+ S: "".concat(PREFIX$c, "-S"),
22113
+ XS: "".concat(PREFIX$c, "-XS"),
22114
+ A: "".concat(PREFIX$c, "-A"),
22115
+ X: "".concat(PREFIX$c, "-X"),
22116
+ frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
22117
+ barContainer: "".concat(PREFIX$c, "-barContainer"),
22118
+ bar: "".concat(PREFIX$c, "-bar"),
22119
+ barSelected: "".concat(PREFIX$c, "-barSelected"),
22120
+ barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
22121
+ barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
22122
+ excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
22123
+ };
22124
+
22125
+ const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
22126
+ const isAlternative = c => c ? c.qState === 'A' : null;
22127
+ const excludedOrAlternative = _ref => {
22128
+ let {
22129
+ cell,
22130
+ checkboxes
22131
+ } = _ref;
22132
+ return (isAlternative(cell) || isExcluded(cell)) && checkboxes;
22133
+ };
22134
+ const getValueStateClasses = _ref2 => {
22135
+ let {
22136
+ column,
22137
+ histogram,
22138
+ checkboxes,
22139
+ cell,
22140
+ showGray
22141
+ } = _ref2;
22142
+ const clazzArr = [column ? rowColClasses.column : rowColClasses.row];
22143
+ if (!histogram) {
22144
+ clazzArr.push(rowColClasses.rowBorderBottom);
22145
+ }
22146
+ if (!cell) {
22147
+ return [];
22148
+ }
22149
+ if (!checkboxes) {
22150
+ if (cell.qState === 'XS') {
22151
+ clazzArr.push(showGray ? rowColClasses.XS : rowColClasses.S);
22152
+ } else if (cell.qState === 'S' || cell.qState === 'L') {
22153
+ clazzArr.push(rowColClasses.S);
22154
+ } else if (showGray && isAlternative(cell)) {
22155
+ clazzArr.push(rowColClasses.A);
22156
+ } else if (showGray && isExcluded(cell)) {
22157
+ clazzArr.push(rowColClasses.X);
22158
+ }
22159
+ }
22160
+ return clazzArr;
22161
+ };
22162
+
22163
+ const frequencyTextNone = '-';
22164
+ const barPadPx = 4;
22165
+ const barBorderWidthPx = 1;
22166
+ const barWithCheckboxLeftPadPx = 29;
22167
+
22168
+ const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
22169
+ const getBarWidth = _ref => {
22170
+ let {
22171
+ qFrequency,
22172
+ checkboxes,
22173
+ frequencyMax
22174
+ } = _ref;
22175
+ const freqStr = String(qFrequency);
22176
+ const isPercent = freqStr.substring(freqStr.length - 1) === '%';
22177
+ const freq = parseFloat(isPercent ? freqStr : qFrequency);
22178
+ const rightSlice = checkboxes ? "(".concat(barWithCheckboxLeftPadPx, "px + ").concat(barPadPx + barBorderWidthPx * 2, "px)") : "".concat(barPadPx * 2 + barBorderWidthPx * 2, "px");
22179
+ const width = isPercent ? freq : freq / frequencyMax * 100;
22180
+ return "calc(".concat(width, "% - ").concat(rightSlice, ")");
22181
+ };
22182
+ const getFrequencyText = _ref2 => {
22183
+ let {
22184
+ cell
22185
+ } = _ref2;
22186
+ if (cell) {
22187
+ return cell.qFrequency ? cell.qFrequency : frequencyTextNone;
22188
+ }
22189
+ return '';
22190
+ };
22191
+
22192
+ const ICON_PADDING = 7;
22193
+ const CELL_PADDING_LEFT = 9;
22194
+
22195
+ const getSelectedStyle = _ref => {
22196
+ let {
22197
+ theme
22198
+ } = _ref;
22199
+ return {
22200
+ background: theme.palette.selected.main,
22201
+ color: theme.palette.selected.mainContrastText,
22202
+ '&:focus': {
22203
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder),
22204
+ outline: 'none'
22205
+ },
22206
+ '& $cell': {
22207
+ paddingRight: 0
22208
+ }
22209
+ };
22210
+ };
22211
+ const ellipsis = {
22212
+ width: '100%',
22213
+ overflow: 'hidden',
22214
+ textOverflow: 'ellipsis',
22215
+ whiteSpace: 'nowrap'
22216
+ };
22217
+ const RowColRoot = styled$1('div', {
22218
+ shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth'].includes(prop)
22219
+ })(_ref2 => {
22220
+ var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
22221
+ let {
22222
+ theme,
22223
+ flexBasisProp,
22224
+ isGridMode,
22225
+ isGridCol,
22226
+ dense,
22227
+ frequencyWidth
22228
+ } = _ref2;
22229
+ return {
22230
+ '&:focus': {
22231
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
22232
+ },
22233
+ '&:focus-visible': {
22234
+ outline: 'none'
22235
+ },
22236
+ ["& .".concat(rowColClasses.row)]: {
22237
+ flexWrap: 'nowrap',
22238
+ 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
22239
+ },
22240
+ ["& .".concat(rowColClasses.rowBorderBottom)]: {
22241
+ borderBottom: isGridCol ? 'none' : "1px solid ".concat(theme.palette.divider),
22242
+ borderLeft: isGridCol ? "1px solid ".concat(theme.palette.divider) : 'none'
22243
+ },
22244
+ ["& .".concat(rowColClasses.column)]: {
22245
+ flexWrap: 'nowrap',
22246
+ borderRight: "1px solid ".concat(theme.palette.divider),
22247
+ 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
22248
+ },
22249
+ // The interior wrapper for all field content.
22250
+ ["& .".concat(rowColClasses.cell)]: {
22251
+ display: 'flex',
22252
+ alignItems: 'center',
22253
+ minWidth: 0,
22254
+ flexGrow: 1,
22255
+ // Note that this padding is overridden when using checkboxes.
22256
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
22257
+ paddingRight: 0
22258
+ },
22259
+ // The leaf node, containing the label text.
22260
+ ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
22261
+ flexBasis: flexBasisProp,
22262
+ lineHeight: '16px',
22263
+ userSelect: 'none',
22264
+ paddingRight: '1px'
22265
+ }, ellipsis), {}, {
22266
+ whiteSpace: 'pre',
22267
+ // to keep white-space on highlight
22268
+ fontSize: (_theme$listBox3 = theme.listBox) === null || _theme$listBox3 === void 0 ? void 0 : (_theme$listBox3$conte = _theme$listBox3.content) === null || _theme$listBox3$conte === void 0 ? void 0 : _theme$listBox3$conte.fontSize,
22269
+ fontFamily: (_theme$listBox4 = theme.listBox) === null || _theme$listBox4 === void 0 ? void 0 : (_theme$listBox4$conte = _theme$listBox4.content) === null || _theme$listBox4$conte === void 0 ? void 0 : _theme$listBox4$conte.fontFamily
22270
+ }),
22271
+ ["& .".concat(rowColClasses.labelDense)]: {
22272
+ fontSize: 12
22273
+ },
22274
+ // Highlight is added to labelText spans, which are created as siblings to original labelText,
22275
+ // when a search string is matched.
22276
+ ["& .".concat(rowColClasses.highlighted)]: {
22277
+ overflow: 'visible',
22278
+ width: '100%',
22279
+ '& > span': {
22280
+ width: '100%',
22281
+ backgroundColor: '#FFC72A'
22282
+ }
22283
+ },
22284
+ // Checkbox and label container.
22285
+ ["& .".concat(rowColClasses.checkboxLabel)]: {
22286
+ margin: 0,
22287
+ width: '100%',
22288
+ height: '100%',
22289
+ overflow: 'hidden',
22290
+ // The checkbox's span
22291
+ '& > span:nth-of-type(1)': {
22292
+ paddingRight: '8px'
22293
+ },
22294
+ // The checkbox's label container.
22295
+ '& > span:nth-of-type(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
22296
+ display: 'flex',
22297
+ alignItems: 'center',
22298
+ paddingLeft: 0,
22299
+ paddingRight: '2px'
22300
+ })
22301
+ },
22302
+ // The icons container holding tick and lock, shown inside fields.
22303
+ ["& .".concat(rowColClasses.icon)]: {
22304
+ display: 'flex',
22305
+ justifyContent: 'center',
22306
+ width: 24,
22307
+ minWidth: 24,
22308
+ maxWidth: 24
22309
+ },
22310
+ // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
22311
+ ["& .".concat(rowColClasses.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22312
+ theme
22313
+ })), {}, {
22314
+ border: isGridMode ? 'none' : undefined
22315
+ }),
22316
+ ["& .".concat(rowColClasses.XS)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22317
+ theme
22318
+ })), {}, {
22319
+ background: theme.palette.selected.excluded,
22320
+ color: theme.palette.selected.mainContrastText,
22321
+ border: isGridMode ? 'none' : undefined
22322
+ }),
22323
+ ["& .".concat(rowColClasses.A)]: {
22324
+ background: theme.palette.selected.alternative,
22325
+ color: theme.palette.selected.alternativeContrastText,
22326
+ border: isGridMode ? 'none' : undefined
22327
+ },
22328
+ ["& .".concat(rowColClasses.X)]: {
22329
+ background: theme.palette.selected.excluded,
22330
+ color: theme.palette.selected.excludedContrastText,
22331
+ border: isGridMode ? 'none' : undefined
22332
+ },
22333
+ ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
22334
+ justifyContent: 'flex-end'
22335
+ }, ellipsis), {}, {
22336
+ flex: "0 1 ".concat(frequencyWidth, "px"),
22337
+ textAlign: 'right',
22338
+ paddingLeft: '2px'
22339
+ }),
22340
+ ["&.".concat(rowColClasses.barContainer)]: {
22341
+ height: '100%',
22342
+ display: 'flex',
22343
+ alignItems: 'center'
22344
+ },
22345
+ ["& .".concat(rowColClasses.bar)]: {
22346
+ border: "".concat(barBorderWidthPx, "px solid"),
22347
+ borderColor: '#D9D9D9',
22348
+ height: dense ? '16px' : '20px',
22349
+ position: 'absolute',
22350
+ zIndex: '-1',
22351
+ alignSelf: 'center',
22352
+ left: "".concat(barPadPx, "px"),
22353
+ transition: 'width 0.2s',
22354
+ backgroundColor: '#FAFAFA'
22355
+ },
22356
+ ["& .".concat(rowColClasses.barSelected)]: {
22357
+ opacity: '30%',
22358
+ zIndex: '0',
22359
+ background: theme.palette.background.lighter
22360
+ },
22361
+ ["& .".concat(rowColClasses.barWithCheckbox)]: {
22362
+ left: "".concat(barWithCheckboxLeftPadPx, "px")
22363
+ },
22364
+ ["& .".concat(rowColClasses.barSelectedWithCheckbox)]: {
22365
+ background: '#BFE5D0',
22366
+ borderColor: '#BFE5D0'
22367
+ },
22368
+ ["& .".concat(rowColClasses.excludedTextWithCheckbox)]: {
22369
+ color: '#828282',
22370
+ fontStyle: 'italic'
22371
+ }
22372
+ };
22373
+ });
22374
+ var RowColRoot$1 = React.memo(RowColRoot);
22375
+
22376
+ const CheckboxChecked = "url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath" + " fill-rule='evenodd' clip-rule='evenodd' d='M12 5c-.28 0-.53.11-.71.29L7 9.59l-2.29-2.3a1.003 " + "1.003 0 00-1.42 1.42l3 3c.18.18.43.29.71.29s.53-.11.71-.29l5-5A1.003 1.003 0 0012 5z' fill='%23fff'/%3E%3C/svg%3E\")";
22377
+
22378
+ const PREFIX$b = 'ListBoxCheckbox';
22379
+ const borderRadius = 3;
22380
+ const classes$b = {
22381
+ cbIcon: "".concat(PREFIX$b, "-cbIcon"),
22382
+ cbIconChecked: "".concat(PREFIX$b, "-cbIconChecked"),
22383
+ cbIconExcluded: "".concat(PREFIX$b, "-cbIconExcluded"),
22384
+ cbIconAlternative: "".concat(PREFIX$b, "-cbIconAlternative"),
22385
+ checkbox: "".concat(PREFIX$b, "-checkbox"),
22386
+ dense: "".concat(PREFIX$b, "-dense")
22387
+ };
22388
+ const StyledCheckbox = styled$1(Checkbox$1)(_ref => {
22389
+ let {
22390
+ theme
22391
+ } = _ref;
22392
+ return {
22393
+ ["& .".concat(classes$b.cbIcon)]: {
22394
+ borderRadius,
22395
+ width: 16,
22396
+ height: 16,
22397
+ boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
22398
+ backgroundColor: '#f5f8fa',
22399
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))',
22400
+ display: 'flex',
22401
+ alignItems: 'center',
22402
+ justifyContent: 'center'
22403
+ },
22404
+ ["& .".concat(classes$b.cbIconChecked)]: {
22405
+ borderRadius,
22406
+ backgroundColor: theme.palette.selected.main,
22407
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
22408
+ '&:before': {
22409
+ display: 'block',
22410
+ width: 16,
22411
+ height: 16,
22412
+ backgroundImage: CheckboxChecked,
22413
+ content: '""'
22414
+ }
22415
+ },
22416
+ ["& .".concat(classes$b.cbIconExcluded)]: {
22417
+ borderRadius: borderRadius - 1,
22418
+ width: 12,
22419
+ height: 12,
22420
+ backgroundColor: theme.palette.selected.excluded
22421
+ },
22422
+ ["& .".concat(classes$b.cbIconAlternative)]: {
22423
+ borderRadius: borderRadius - 1,
22424
+ width: 12,
22425
+ height: 12,
22426
+ backgroundColor: theme.palette.selected.alternative
22427
+ },
22428
+ ["&.".concat(classes$b.checkbox)]: {
22429
+ margin: 0,
22430
+ '&:hover': {
22431
+ backgroundColor: 'inherit !important'
22432
+ }
22433
+ },
22434
+ ["&.".concat(classes$b.dense)]: {
22435
+ padding: '4px 8px'
22436
+ }
22437
+ };
22438
+ });
22439
+ const getIcon = function (cls) {
22440
+ let showGray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22441
+ let excluded = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
22442
+ return /*#__PURE__*/React.createElement("span", {
22443
+ className: cls.cbIcon
22444
+ }, excluded && /*#__PURE__*/React.createElement("span", {
22445
+ className: showGray && excluded ? cls.cbIconExcluded : ''
22446
+ }));
22447
+ };
22448
+ function ListboxCheckbox(_ref2) {
22449
+ let {
22450
+ onChange,
22451
+ checked,
22452
+ label,
22453
+ dense,
22454
+ excluded,
22455
+ showGray = true,
22456
+ dataN
22457
+ } = _ref2;
22458
+ return /*#__PURE__*/React.createElement(StyledCheckbox, {
22459
+ edge: "start",
22460
+ onChange: onChange,
22461
+ checked: checked,
22462
+ disableRipple: true,
22463
+ className: [classes$b.checkbox, dense && classes$b.dense].filter(Boolean).join(' '),
22464
+ inputProps: {
22465
+ 'aria-labelledby': label,
22466
+ 'data-n': dataN
22467
+ },
22468
+ name: label,
22469
+ icon: getIcon(classes$b, showGray, excluded),
22470
+ checkedIcon: /*#__PURE__*/React.createElement("span", {
22471
+ className: classes$b.cbIconChecked
22472
+ })
22473
+ });
22474
+ }
22475
+
22476
+ const PREFIX$a = 'ListBoxRadioButton';
22477
+ const classes$a = {
22478
+ denseRadioButton: "".concat(PREFIX$a, "-denseRadioButton"),
22479
+ radioButton: "".concat(PREFIX$a, "-radioButton")
22480
+ };
22481
+ const StyledRadio = styled$1(Radio$1)(_ref => {
22482
+ let {
22483
+ theme,
22484
+ checked
22485
+ } = _ref;
22486
+ return {
22487
+ ["&.".concat(classes$a.radioButton)]: {
22488
+ right: '5px',
22489
+ color: checked ? theme.palette.selected.main : theme.palette.main
22490
+ }
22491
+ };
22492
+ });
22493
+ function ListBoxRadioButton(_ref2) {
22494
+ let {
22495
+ onChange,
22496
+ checked,
22497
+ label,
22498
+ dense,
22499
+ dataN
22500
+ } = _ref2;
22501
+ return /*#__PURE__*/React.createElement(StyledRadio, {
22502
+ checked: checked,
22503
+ onChange: onChange,
22504
+ value: label,
22505
+ name: label,
22506
+ className: classes$a.radioButton,
22507
+ inputProps: {
22508
+ 'data-n': dataN
22509
+ },
22510
+ style: {
22511
+ backgroundColor: 'transparent'
22512
+ },
22513
+ disableRipple: true,
22514
+ size: dense ? 'small' : 'medium',
22515
+ sx: dense && {
22516
+ padding: '0px 0px 0px 12px'
22517
+ }
22518
+ });
22519
+ }
22520
+
22521
+ function ValueField(_ref) {
22522
+ let {
22523
+ label,
22524
+ color,
22525
+ highlighted = false,
22526
+ dense,
22527
+ showGray = true,
22528
+ checkboxes,
22529
+ cell,
22530
+ valueTextAlign
22531
+ } = _ref;
22532
+ return /*#__PURE__*/React.createElement(Typography$1, {
22533
+ component: "span",
22534
+ variant: "body2",
22535
+ className: joinClassNames([rowColClasses.labelText, highlighted && rowColClasses.highlighted, dense && rowColClasses.labelDense, showGray && excludedOrAlternative({
22536
+ cell,
22537
+ checkboxes
22538
+ }) && rowColClasses.excludedTextWithCheckbox]),
22539
+ color: color,
22540
+ align: valueTextAlign
22541
+ }, /*#__PURE__*/React.createElement("span", {
22542
+ style: {
22543
+ whiteSpace: 'pre'
22544
+ }
22545
+ }, label));
22546
+ }
22547
+
22548
+ function LabelTag(_ref) {
22549
+ let {
22550
+ label,
22551
+ color,
22552
+ highlighted,
22553
+ dense,
22554
+ showGray,
22555
+ checkboxes,
22556
+ cell,
22557
+ valueTextAlign
22558
+ } = _ref;
22559
+ if (typeof label === 'string') {
22560
+ return /*#__PURE__*/React.createElement(ValueField, {
22561
+ label: label,
22562
+ color: color,
22563
+ highlighted: highlighted,
22564
+ dense: dense,
22565
+ showGray: showGray,
22566
+ checkboxes: checkboxes,
22567
+ cell: cell,
22568
+ valueTextAlign: valueTextAlign
22569
+ });
22570
+ }
22571
+ return label;
22572
+ }
22573
+
22574
+ function CheckboxField(_ref) {
22575
+ let {
22576
+ onChange,
22577
+ label,
22578
+ color,
22579
+ qElemNumber,
22580
+ isSelected,
22581
+ dense,
22582
+ cell,
22583
+ isGridCol,
22584
+ showGray,
22585
+ isSingleSelect,
22586
+ highlighted,
22587
+ checkboxes,
22588
+ valueTextAlign
22589
+ } = _ref;
22590
+ const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
22591
+ onChange: onChange,
22592
+ label: label,
22593
+ checked: isSelected,
22594
+ dense: dense,
22595
+ excluded: isExcluded(cell),
22596
+ isGridCol: isGridCol,
22597
+ showGray: showGray,
22598
+ dataN: qElemNumber
22599
+ });
22600
+ const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
22601
+ onChange: onChange,
22602
+ label: label,
22603
+ checked: isSelected,
22604
+ dense: dense,
22605
+ dataN: qElemNumber
22606
+ });
22607
+ return /*#__PURE__*/React.createElement(FormControlLabel$1, {
22608
+ color: color,
22609
+ control: isSingleSelect ? rb : cb,
22610
+ className: rowColClasses.checkboxLabel,
22611
+ label: /*#__PURE__*/React.createElement(LabelTag, {
22612
+ label: label,
22613
+ color: color,
22614
+ highlighted: highlighted,
22615
+ dense: dense,
22616
+ showGray: showGray,
22617
+ checkboxes: checkboxes,
22618
+ cell: cell,
22619
+ valueTextAlign: valueTextAlign
22620
+ }),
22621
+ key: qElemNumber
22622
+ });
22623
+ }
22624
+
22625
+ function LabelsWithRanges(_ref) {
22626
+ let {
22627
+ labels,
22628
+ dense,
22629
+ showGray,
22630
+ checkboxes
22631
+ } = _ref;
22632
+ return /*#__PURE__*/React.createElement(React.Fragment, null, labels.map((_ref2, index) => {
22633
+ let [label, highlighted] = _ref2;
22634
+ const key = "".concat(index);
22635
+ return /*#__PURE__*/React.createElement(ValueField, {
22636
+ label: label,
22637
+ key: key,
22638
+ highlighted: highlighted,
22639
+ dense: dense,
22640
+ showGray: showGray,
22641
+ checkboxes: checkboxes
22642
+ });
22643
+ }));
22644
+ }
22645
+ function FieldWithRanges(_ref3) {
22646
+ let {
22647
+ onChange,
22648
+ labels,
22649
+ checkboxes,
22650
+ dense,
22651
+ showGray,
22652
+ color,
22653
+ qElemNumber,
22654
+ isSelected,
22655
+ cell,
22656
+ isGridCol,
22657
+ isSingleSelect,
22658
+ valueTextAlign
22659
+ } = _ref3;
22660
+ const LWR = /*#__PURE__*/React.createElement(LabelsWithRanges, {
22661
+ labels: labels,
22662
+ dense: dense,
22663
+ showGray: showGray,
22664
+ checkboxes: checkboxes
22665
+ });
22666
+ return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22667
+ onChange: onChange,
22668
+ label: LWR,
22669
+ color: color,
22670
+ qElemNumber: qElemNumber,
22671
+ isSelected: isSelected,
22672
+ dense: dense,
22673
+ cell: cell,
22674
+ isGridCol: isGridCol,
22675
+ showGray: showGray,
22676
+ isSingleSelect: isSingleSelect,
22677
+ checkboxes: checkboxes,
22678
+ valueTextAlign: valueTextAlign
22679
+ }) : LWR;
22680
+ }
22681
+
22682
+ function Field(_ref) {
22683
+ let {
22684
+ onChange,
22685
+ label,
22686
+ color,
22687
+ qElemNumber,
22688
+ isSelected,
22689
+ dense,
22690
+ cell,
22691
+ isGridCol,
22692
+ showGray,
22693
+ isSingleSelect,
22694
+ highlighted,
22695
+ checkboxes,
22696
+ valueTextAlign
22697
+ } = _ref;
22698
+ return checkboxes ? /*#__PURE__*/React.createElement(CheckboxField, {
22699
+ onChange: onChange,
22700
+ label: label,
22701
+ color: color,
22702
+ qElemNumber: qElemNumber,
22703
+ isSelected: isSelected,
22704
+ dense: dense,
22705
+ cell: cell,
22706
+ isGridCol: isGridCol,
22707
+ showGray: showGray,
22708
+ isSingleSelect: isSingleSelect,
22709
+ highlighted: highlighted,
22710
+ checkboxes: checkboxes,
22711
+ valueTextAlign: valueTextAlign
22712
+ }) : /*#__PURE__*/React.createElement(ValueField, {
22713
+ label: label,
22714
+ color: color,
22715
+ highlighted: false,
22716
+ dense: dense,
22717
+ showGray: true,
22718
+ checkboxes: checkboxes,
22719
+ cell: cell,
22720
+ valueTextAlign: valueTextAlign
22721
+ });
22722
+ }
22723
+ var Field$1 = React.memo(Field);
22724
+
22725
+ function Histogram(_ref) {
22726
+ let {
22727
+ cell,
22728
+ histogram,
22729
+ checkboxes,
22730
+ isSelected,
22731
+ frequencyMax
22732
+ } = _ref;
22733
+ const hasHistogramBar = cell && histogram && getFrequencyText({
22734
+ cell
22735
+ }) !== frequencyTextNone;
22736
+ if (!hasHistogramBar) {
22737
+ return undefined;
22738
+ }
22739
+ const width = getBarWidth({
22740
+ qFrequency: cell.qFrequency,
22741
+ checkboxes,
22742
+ frequencyMax
22743
+ });
22744
+ return /*#__PURE__*/React.createElement("div", {
22745
+ className: joinClassNames([rowColClasses.bar, checkboxes && rowColClasses.barWithCheckbox, isSelected && (checkboxes ? rowColClasses.barSelectedWithCheckbox : rowColClasses.barSelected)]),
22746
+ style: {
22747
+ width
22748
+ }
22749
+ });
22750
+ }
22751
+
22752
+ function Frequency(_ref) {
22753
+ let {
22754
+ cell,
22755
+ checkboxes,
22756
+ dense,
22757
+ showGray
22758
+ } = _ref;
22759
+ return /*#__PURE__*/React.createElement(Grid$1, {
22760
+ item: true,
22761
+ style: {
22762
+ display: 'flex',
22763
+ alignItems: 'center'
22764
+ },
22765
+ className: rowColClasses.frequencyCount
22766
+ }, /*#__PURE__*/React.createElement(Typography$1, {
22767
+ noWrap: true,
22768
+ color: "inherit",
22769
+ variant: "body2",
22770
+ className: joinClassNames([dense && rowColClasses.labelDense, rowColClasses.labelText, showGray && excludedOrAlternative({
22771
+ cell,
22772
+ checkboxes
22773
+ }) && rowColClasses.excludedTextWithCheckbox])
22774
+ }, getFrequencyText({
22775
+ cell
22776
+ })));
22279
22777
  }
22280
22778
 
22281
22779
  function getGridItemSizes(_ref) {
@@ -22295,243 +22793,69 @@
22295
22793
  case 'row':
22296
22794
  return {
22297
22795
  height: "calc(100% - ".concat(itemPadding, "px)"),
22298
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
22796
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22797
+ position: 'absolute',
22798
+ left: 4
22299
22799
  };
22300
22800
  case 'column':
22301
22801
  return {
22302
22802
  height: "calc(100% - ".concat(itemPadding, "px)"),
22303
- width: "calc(100% - ".concat(2 * itemPadding, "px)")
22803
+ width: "calc(100% - ".concat(2 * itemPadding, "px)"),
22804
+ position: 'absolute',
22805
+ left: 4
22304
22806
  };
22305
22807
  default:
22306
22808
  return {};
22307
22809
  }
22308
22810
  }
22309
22811
 
22310
- const PREFIX$a = 'RowColumn';
22311
- const classes$a = {
22312
- row: "".concat(PREFIX$a, "-row"),
22313
- rowBorderBottom: "".concat(PREFIX$a, "-rowBorderBottom"),
22314
- column: "".concat(PREFIX$a, "-column"),
22315
- fieldRoot: "".concat(PREFIX$a, "-fieldRoot"),
22316
- cell: "".concat(PREFIX$a, "-cell"),
22317
- labelText: "".concat(PREFIX$a, "-labelText"),
22318
- labelDense: "".concat(PREFIX$a, "-labelDense"),
22319
- highlighted: "".concat(PREFIX$a, "-highlighted"),
22320
- checkboxLabel: "".concat(PREFIX$a, "-checkboxLabel"),
22321
- icon: "".concat(PREFIX$a, "-icon"),
22322
- S: "".concat(PREFIX$a, "-S"),
22323
- XS: "".concat(PREFIX$a, "-XS"),
22324
- A: "".concat(PREFIX$a, "-A"),
22325
- X: "".concat(PREFIX$a, "-X"),
22326
- frequencyCount: "".concat(PREFIX$a, "-frequencyCount"),
22327
- barContainer: "".concat(PREFIX$a, "-barContainer"),
22328
- bar: "".concat(PREFIX$a, "-bar"),
22329
- barSelected: "".concat(PREFIX$a, "-barSelected"),
22330
- barWithCheckbox: "".concat(PREFIX$a, "-barWithCheckbox"),
22331
- barSelectedWithCheckbox: "".concat(PREFIX$a, "-barSelectedWithCheckbox"),
22332
- excludedTextWithCheckbox: "".concat(PREFIX$a, "-excludedTextWithCheckbox")
22333
- };
22334
- const ellipsis = {
22335
- width: '100%',
22336
- overflow: 'hidden',
22337
- textOverflow: 'ellipsis'
22338
- };
22339
- const barPadPx = 4;
22340
- const barBorderWidthPx = 1;
22341
- const barWithCheckboxLeftPadPx = 29;
22342
- const frequencyTextNone = '-';
22343
- const getSelectedStyle = _ref => {
22344
- let {
22345
- theme
22346
- } = _ref;
22347
- return {
22348
- background: theme.palette.selected.main,
22349
- color: theme.palette.selected.mainContrastText,
22350
- '&:focus': {
22351
- boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder),
22352
- outline: 'none'
22353
- },
22354
- '& $cell': {
22355
- paddingRight: 0
22356
- }
22357
- };
22358
- };
22359
22812
  const ItemGrid = styled$1(Grid$1, {
22360
- shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding'].includes(prop)
22361
- })(_ref2 => {
22813
+ shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding', 'checkboxes'].includes(prop)
22814
+ })(_ref => {
22362
22815
  let {
22363
22816
  dataLayout,
22364
22817
  layoutOrder,
22365
- itemPadding
22366
- } = _ref2;
22818
+ itemPadding,
22819
+ checkboxes
22820
+ } = _ref;
22367
22821
  return {
22368
- ["&.".concat(classes$a.fieldRoot)]: getGridItemSizes({
22822
+ ["&.".concat(rowColClasses.fieldRoot)]: _objectSpread2(_objectSpread2({}, getGridItemSizes({
22369
22823
  dataLayout,
22370
22824
  layoutOrder,
22371
22825
  itemPadding
22826
+ })), {}, {
22827
+ paddingRight: checkboxes ? '8px' : undefined
22372
22828
  })
22373
22829
  };
22374
22830
  });
22375
- const Root$1 = styled$1('div', {
22376
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense'].includes(prop)
22377
- })(_ref3 => {
22378
- 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;
22831
+
22832
+ function getCellFromPages(_ref) {
22379
22833
  let {
22380
- theme,
22381
- flexBasisProp,
22382
- isGridMode,
22383
- isGridCol,
22384
- dense
22385
- } = _ref3;
22386
- return {
22387
- '&:focus': {
22388
- boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
22389
- },
22390
- '&:focus-visible': {
22391
- outline: 'none'
22392
- },
22393
- ["& .".concat(classes$a.row)]: {
22394
- flexWrap: 'nowrap',
22395
- 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
22396
- },
22397
- ["& .".concat(classes$a.rowBorderBottom)]: {
22398
- borderBottom: isGridCol ? 'none' : "1px solid ".concat(theme.palette.divider),
22399
- borderLeft: isGridCol ? "1px solid ".concat(theme.palette.divider) : 'none'
22400
- },
22401
- ["& .".concat(classes$a.column)]: {
22402
- flexWrap: 'nowrap',
22403
- borderRight: "1px solid ".concat(theme.palette.divider),
22404
- 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
22405
- },
22406
- // The interior wrapper for all field content.
22407
- ["& .".concat(classes$a.cell)]: {
22408
- display: 'flex',
22409
- alignItems: 'center',
22410
- minWidth: 0,
22411
- flexGrow: 1,
22412
- // Note that this padding is overridden when using checkboxes.
22413
- paddingLeft: '9px',
22414
- paddingRight: '9px'
22415
- },
22416
- // The leaf node, containing the label text.
22417
- ["& .".concat(classes$a.labelText)]: _objectSpread2(_objectSpread2({
22418
- flexBasis: flexBasisProp,
22419
- lineHeight: '16px',
22420
- userSelect: 'none',
22421
- whiteSpace: 'pre',
22422
- // to keep white-space on highlight
22423
- paddingRight: '9px'
22424
- }, ellipsis), {}, {
22425
- 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,
22426
- 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
22427
- }),
22428
- ["& .".concat(classes$a.labelDense)]: {
22429
- fontSize: 12
22430
- },
22431
- // Highlight is added to labelText spans, which are created as siblings to original labelText,
22432
- // when a search string is matched.
22433
- ["& .".concat(classes$a.highlighted)]: {
22434
- overflow: 'visible',
22435
- width: '100%',
22436
- '& > span': {
22437
- width: '100%',
22438
- backgroundColor: '#FFC72A'
22439
- }
22440
- },
22441
- // Checkbox and label container.
22442
- ["& .".concat(classes$a.checkboxLabel)]: {
22443
- margin: 0,
22444
- width: '100%',
22445
- height: '100%',
22446
- overflow: 'hidden',
22447
- // The checkbox's span
22448
- '& > span:nth-of-type(1)': {
22449
- paddingRight: '8px'
22450
- },
22451
- // The checkbox's label container.
22452
- '& > span:nth-of-type(2)': _objectSpread2(_objectSpread2({}, ellipsis), {}, {
22453
- display: 'flex',
22454
- alignItems: 'center',
22455
- paddingLeft: 0,
22456
- paddingRight: '2px'
22457
- })
22458
- },
22459
- // The icons container holding tick and lock, shown inside fields.
22460
- ["& .".concat(classes$a.icon)]: {
22461
- display: 'flex',
22462
- padding: theme.spacing(1, 1, 1, 0)
22463
- },
22464
- // Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
22465
- ["& .".concat(classes$a.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22466
- theme
22467
- })), {}, {
22468
- border: isGridMode ? 'none' : undefined
22469
- }),
22470
- ["& .".concat(classes$a.XS)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
22471
- theme
22472
- })), {}, {
22473
- background: theme.palette.selected.excluded,
22474
- color: theme.palette.selected.mainContrastText,
22475
- border: isGridMode ? 'none' : undefined
22476
- }),
22477
- ["& .".concat(classes$a.A)]: {
22478
- background: theme.palette.selected.alternative,
22479
- color: theme.palette.selected.alternativeContrastText,
22480
- border: isGridMode ? 'none' : undefined
22481
- },
22482
- ["& .".concat(classes$a.X)]: {
22483
- background: theme.palette.selected.excluded,
22484
- color: theme.palette.selected.excludedContrastText,
22485
- border: isGridMode ? 'none' : undefined
22486
- },
22487
- ["& .".concat(classes$a.frequencyCount)]: {
22488
- width: '66px',
22489
- justifyContent: 'flex-end'
22490
- },
22491
- ["&.".concat(classes$a.barContainer)]: {
22492
- height: '100%',
22493
- display: 'flex',
22494
- alignItems: 'center'
22495
- },
22496
- ["& .".concat(classes$a.bar)]: {
22497
- border: "".concat(barBorderWidthPx, "px solid"),
22498
- borderColor: '#D9D9D9',
22499
- height: dense ? '16px' : '20px',
22500
- position: 'absolute',
22501
- zIndex: '-1',
22502
- alignSelf: 'center',
22503
- left: "".concat(barPadPx, "px"),
22504
- transition: 'width 0.2s',
22505
- backgroundColor: '#FAFAFA'
22506
- },
22507
- ["& .".concat(classes$a.barSelected)]: {
22508
- opacity: '30%',
22509
- zIndex: '0',
22510
- background: theme.palette.background.lighter
22511
- },
22512
- ["& .".concat(classes$a.barWithCheckbox)]: {
22513
- left: "".concat(barWithCheckboxLeftPadPx, "px")
22514
- },
22515
- ["& .".concat(classes$a.barSelectedWithCheckbox)]: {
22516
- background: '#BFE5D0',
22517
- borderColor: '#BFE5D0'
22518
- },
22519
- ["& .".concat(classes$a.excludedTextWithCheckbox)]: {
22520
- color: '#828282',
22521
- fontStyle: 'italic'
22834
+ pages,
22835
+ cellIndex
22836
+ } = _ref;
22837
+ let c;
22838
+ const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
22839
+ if (page) {
22840
+ const area = page.qArea;
22841
+ if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
22842
+ [c] = page.qMatrix[cellIndex - area.qTop];
22522
22843
  }
22523
- };
22524
- });
22525
- function RowColumn(_ref4) {
22526
- var _cell$qText;
22844
+ }
22845
+ return c;
22846
+ }
22847
+
22848
+ function RowColumn(_ref) {
22849
+ var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
22527
22850
  let {
22528
22851
  index,
22529
22852
  rowIndex,
22530
22853
  columnIndex,
22531
22854
  style,
22532
22855
  data
22533
- } = _ref4;
22856
+ } = _ref;
22534
22857
  const {
22858
+ onChange,
22535
22859
  onClick,
22536
22860
  onMouseDown,
22537
22861
  onMouseUp,
@@ -22555,7 +22879,8 @@
22555
22879
  dataOffset,
22556
22880
  focusListItems,
22557
22881
  listCount,
22558
- itemPadding
22882
+ itemPadding,
22883
+ frequencyWidth
22559
22884
  } = data;
22560
22885
  const {
22561
22886
  dense = false,
@@ -22607,52 +22932,29 @@
22607
22932
  const handleKeyDownCallback = reactExports.useCallback(getFieldKeyboardNavigation(_objectSpread2(_objectSpread2({}, actions), {}, {
22608
22933
  focusListItems
22609
22934
  })), [actions]);
22610
- const [isSelected, setSelected] = reactExports.useState(false);
22611
- const [cell, setCell] = reactExports.useState();
22612
- const [classArr, setClassArr] = reactExports.useState([]);
22613
- reactExports.useEffect(() => {
22614
- if (!pages) {
22615
- return;
22616
- }
22617
- let c;
22618
- const page = pages.filter(p => p.qArea.qTop <= cellIndex && cellIndex < p.qArea.qTop + p.qArea.qHeight)[0];
22619
- if (page) {
22620
- const area = page.qArea;
22621
- if (cellIndex >= area.qTop && cellIndex < area.qTop + area.qHeight) {
22622
- [c] = page.qMatrix[cellIndex - area.qTop];
22623
- }
22624
- }
22625
- setCell(c);
22626
- }, [pages]);
22627
- const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
22628
- const isAlternative = c => c ? c.qState === 'A' : null;
22629
- reactExports.useEffect(() => {
22630
- if (!cell) {
22631
- return;
22935
+ const cell = reactExports.useMemo(() => getCellFromPages({
22936
+ pages,
22937
+ cellIndex
22938
+ }), [pages, cellIndex]);
22939
+ const isSelected = (cell === null || cell === void 0 ? void 0 : cell.qState) === 'S' || (cell === null || cell === void 0 ? void 0 : cell.qState) === 'XS' || (cell === null || cell === void 0 ? void 0 : cell.qState) === 'L';
22940
+ const classArr = reactExports.useMemo(() => getValueStateClasses({
22941
+ column,
22942
+ histogram,
22943
+ checkboxes,
22944
+ cell,
22945
+ showGray
22946
+ }), [cell === null || cell === void 0 ? void 0 : cell.qState, histogram, dense, checkboxes]);
22947
+ const preventContextMenu = reactExports.useCallback(event => {
22948
+ if (checkboxes) {
22949
+ // Event will not propagate in the checkbox/radiobutton case
22950
+ onClick(event);
22632
22951
  }
22633
- const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
22634
- setSelected(selected);
22635
- const clazzArr = [column ? classes$a.column : classes$a.row];
22636
- if (!(histogram && (dense || checkboxes))) clazzArr.push(classes$a.rowBorderBottom);
22637
- if (!checkboxes) {
22638
- if (cell.qState === 'XS') {
22639
- clazzArr.push(showGray ? classes$a.XS : classes$a.S);
22640
- } else if (cell.qState === 'S' || cell.qState === 'L') {
22641
- clazzArr.push(classes$a.S);
22642
- } else if (showGray && isAlternative(cell)) {
22643
- clazzArr.push(classes$a.A);
22644
- } else if (showGray && isExcluded(cell)) {
22645
- clazzArr.push(classes$a.X);
22646
- }
22647
- }
22648
- setClassArr(clazzArr);
22649
- }, [cell && cell.qState, histogram, dense, checkboxes]);
22952
+ event.preventDefault();
22953
+ }, [checkboxes]);
22650
22954
  if (!cell) {
22651
22955
  return null; // prevent rendering empty rows
22652
22956
  }
22653
22957
 
22654
- const joinClassNames = namesArray => namesArray.filter(c => !!c).join(' ').trim();
22655
- const excludedOrAlternative = () => (isAlternative(cell) || isExcluded(cell)) && checkboxes;
22656
22958
  const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
22657
22959
  let valueTextAlign;
22658
22960
  const isAutoTextAlign = !textAlign || textAlign.auto;
@@ -22665,94 +22967,16 @@
22665
22967
  } else {
22666
22968
  valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
22667
22969
  }
22668
- const getValueField = _ref5 => {
22669
- let {
22670
- lbl,
22671
- ix,
22672
- color,
22673
- highlighted = false
22674
- } = _ref5;
22675
- return /*#__PURE__*/React.createElement(Typography$1, {
22676
- component: "span",
22677
- variant: "body2",
22678
- key: ix,
22679
- className: joinClassNames([classes$a.labelText, highlighted && classes$a.highlighted, dense && classes$a.labelDense, showGray && excludedOrAlternative() && classes$a.excludedTextWithCheckbox]),
22680
- color: color,
22681
- justifyContent: valueTextAlign
22682
- }, /*#__PURE__*/React.createElement("span", {
22683
- style: {
22684
- whiteSpace: 'pre'
22685
- }
22686
- }, lbl));
22687
- };
22688
- const preventContextMenu = event => {
22689
- if (checkboxes) {
22690
- // Event will not propagate in the checkbox/radiobutton case
22691
- onClick(event);
22692
- }
22693
- event.preventDefault();
22694
- };
22695
22970
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
22696
- const getCheckboxField = _ref6 => {
22697
- let {
22698
- lbl,
22699
- color,
22700
- qElemNumber
22701
- } = _ref6;
22702
- const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
22703
- label: lbl,
22704
- checked: isSelected,
22705
- dense: dense,
22706
- excluded: isExcluded(cell),
22707
- isGridCol: isGridCol,
22708
- showGray: showGray
22709
- });
22710
- const rb = /*#__PURE__*/React.createElement(ListBoxRadioButton, {
22711
- label: lbl,
22712
- checked: isSelected,
22713
- dense: dense
22714
- });
22715
- const labelTag = typeof lbl === 'string' ? getValueField({
22716
- lbl,
22717
- color,
22718
- highlighted: false
22719
- }) : lbl;
22720
- return /*#__PURE__*/React.createElement(FormControlLabel$1, {
22721
- color: color,
22722
- control: isSingleSelect ? rb : cb,
22723
- className: classes$a.checkboxLabel,
22724
- label: labelTag,
22725
- key: qElemNumber
22726
- });
22727
- };
22728
22971
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
22729
- const getFrequencyText = () => {
22730
- if (cell) {
22731
- return cell.qFrequency ? cell.qFrequency : frequencyTextNone;
22732
- }
22733
- return '';
22734
- };
22735
22972
 
22736
22973
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
22737
- const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
22738
- const labels = getSegmentsFromRanges(label, ranges);
22739
- const getField = checkboxes ? getCheckboxField : getValueField;
22740
- const getFieldWithRanges = _ref7 => {
22741
- let {
22742
- lbls
22743
- } = _ref7;
22744
- const labelsWithRanges = lbls.map((_ref8, ix) => {
22745
- let [lbl, highlighted] = _ref8;
22746
- return getValueField({
22747
- ix,
22748
- highlighted,
22749
- lbl
22750
- });
22751
- });
22752
- return checkboxes ? getCheckboxField({
22753
- lbl: labelsWithRanges
22754
- }) : labelsWithRanges;
22755
- };
22974
+
22975
+ let labels;
22976
+ if ((_cell$qHighlightRange = cell.qHighlightRanges) !== null && _cell$qHighlightRange !== void 0 && (_cell$qHighlightRange2 = _cell$qHighlightRange.qRanges) !== null && _cell$qHighlightRange2 !== void 0 && _cell$qHighlightRange2.length) {
22977
+ const ranges = cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
22978
+ labels = getSegmentsFromRanges(label, ranges);
22979
+ }
22756
22980
  const iconStyles = {
22757
22981
  alignItems: 'center',
22758
22982
  display: 'flex',
@@ -22765,37 +22989,30 @@
22765
22989
  alignItems: 'center',
22766
22990
  minWidth: 0,
22767
22991
  flexGrow: 1,
22768
- padding: checkboxes ? 0 : undefined,
22992
+ paddingLeft: checkboxes ? 0 : undefined,
22769
22993
  justifyContent: valueTextAlign
22770
22994
  };
22771
- const hasHistogramBar = () => cell && histogram && getFrequencyText() !== frequencyTextNone;
22772
- const getBarWidth = qFrequency => {
22773
- const freqStr = String(qFrequency);
22774
- const isPercent = freqStr.substring(freqStr.length - 1) === '%';
22775
- const freq = parseFloat(isPercent ? freqStr : qFrequency);
22776
- const rightSlice = checkboxes ? "(".concat(barWithCheckboxLeftPadPx, "px + ").concat(barPadPx + barBorderWidthPx * 2, "px)") : "".concat(barPadPx * 2 + barBorderWidthPx * 2, "px");
22777
- const width = isPercent ? freq : freq / frequencyMax * 100;
22778
- return "calc(".concat(width, "% - ").concat(rightSlice, ")");
22779
- };
22780
22995
  const isFirstElement = index === 0;
22781
22996
  const flexBasisVal = checkboxes ? 'auto' : 'max-content';
22782
- return /*#__PURE__*/React.createElement(Root$1, {
22783
- className: classes$a.barContainer,
22997
+ return /*#__PURE__*/React.createElement(RowColRoot$1, {
22998
+ className: rowColClasses.barContainer,
22784
22999
  flexBasisProp: flexBasisVal,
22785
23000
  style: styles,
22786
23001
  isGridCol: isGridCol,
22787
23002
  isGridMode: dataLayout === 'grid',
22788
- dense: dense
23003
+ dense: dense,
23004
+ frequencyWidth: frequencyWidth
22789
23005
  }, /*#__PURE__*/React.createElement(ItemGrid, {
22790
23006
  ref: rowRef,
22791
23007
  container: true,
22792
23008
  dataLayout: dataLayout,
23009
+ checkboxes: checkboxes,
22793
23010
  layoutOrder: layoutOrder,
22794
23011
  itemPadding: itemPadding,
22795
23012
  gap: 0,
22796
23013
  className: joinClassNames(['value', ...classArr]),
22797
23014
  classes: {
22798
- root: classes$a.fieldRoot
23015
+ root: rowColClasses.fieldRoot
22799
23016
  },
22800
23017
  onClick: onClick,
22801
23018
  onMouseDown: onMouseDown,
@@ -22805,37 +23022,53 @@
22805
23022
  onContextMenu: preventContextMenu,
22806
23023
  role: column ? 'column' : 'row',
22807
23024
  tabIndex: isFirstElement && (!keyboard.enabled || keyboard.active) ? 0 : -1,
22808
- "data-n": cell && cell.qElemNumber
22809
- }, hasHistogramBar() && /*#__PURE__*/React.createElement("div", {
22810
- className: joinClassNames([classes$a.bar, checkboxes && classes$a.barWithCheckbox, isSelected && (checkboxes ? classes$a.barSelectedWithCheckbox : classes$a.barSelected)]),
22811
- style: {
22812
- width: getBarWidth(cell.qFrequency)
22813
- }
23025
+ "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
23026
+ }, /*#__PURE__*/React.createElement(Histogram, {
23027
+ cell: cell,
23028
+ histogram: histogram,
23029
+ checkboxes: checkboxes,
23030
+ isSelected: isSelected,
23031
+ frequencyMax: frequencyMax
22814
23032
  }), /*#__PURE__*/React.createElement(Grid$1, {
22815
23033
  item: true,
22816
23034
  style: cellStyle,
22817
- className: joinClassNames([classes$a.cell, classes$a.selectedCell]),
23035
+ className: joinClassNames([rowColClasses.cell, rowColClasses.selectedCell]),
22818
23036
  title: "".concat(label)
22819
- }, ranges.length === 0 ? getField({
22820
- lbl: label,
22821
- color: 'inherit'
22822
- }) : getFieldWithRanges({
22823
- lbls: labels
22824
- })), freqIsAllowed && /*#__PURE__*/React.createElement(Grid$1, {
22825
- item: true,
22826
- style: {
22827
- display: 'flex',
22828
- alignItems: 'center'
22829
- },
22830
- className: classes$a.frequencyCount
22831
- }, /*#__PURE__*/React.createElement(Typography$1, {
22832
- noWrap: true,
23037
+ }, labels ? /*#__PURE__*/React.createElement(FieldWithRanges, {
23038
+ onChange: onChange,
23039
+ labels: labels,
23040
+ checkboxes: checkboxes,
23041
+ dense: dense,
23042
+ showGray: showGray,
23043
+ color: "inherit" // TODO: Check this
23044
+ ,
23045
+ qElemNumber: cell.qElemNumber,
23046
+ isSelected: isSelected,
23047
+ cell: cell,
23048
+ isGridCol: isGridCol,
23049
+ isSingleSelect: isSingleSelect,
23050
+ valueTextAlign: valueTextAlign
23051
+ }) : /*#__PURE__*/React.createElement(Field$1, {
23052
+ onChange: onChange,
23053
+ label: label,
22833
23054
  color: "inherit",
22834
- variant: "body2",
22835
- className: joinClassNames([dense && classes$a.labelDense, classes$a.labelText, showGray && excludedOrAlternative() && classes$a.excludedTextWithCheckbox])
22836
- }, getFrequencyText())), !checkboxes && /*#__PURE__*/React.createElement(Grid$1, {
23055
+ qElemNumber: cell.qElemNumber,
23056
+ isSelected: isSelected,
23057
+ dense: dense,
23058
+ cell: cell,
23059
+ isGridCol: isGridCol,
23060
+ showGray: showGray,
23061
+ isSingleSelect: isSingleSelect,
23062
+ checkboxes: checkboxes,
23063
+ valueTextAlign: valueTextAlign
23064
+ })), freqIsAllowed && /*#__PURE__*/React.createElement(Frequency, {
23065
+ cell: cell,
23066
+ checkboxes: checkboxes,
23067
+ dense: dense,
23068
+ showGray: showGray
23069
+ }), !checkboxes && /*#__PURE__*/React.createElement(Grid$1, {
22837
23070
  item: true,
22838
- className: classes$a.icon
23071
+ className: rowColClasses.icon
22839
23072
  }, !showLock && !showTick && /*#__PURE__*/React.createElement("span", {
22840
23073
  style: {
22841
23074
  minWidth: '12px'
@@ -22849,21 +23082,6 @@
22849
23082
  }))));
22850
23083
  }
22851
23084
 
22852
- const FREQUENCY_MIN_SHOW_WIDTH = 80;
22853
- function getFrequencyAllowed(_ref) {
22854
- let {
22855
- width,
22856
- layout,
22857
- frequencyMode
22858
- } = _ref;
22859
- const widthPermitsFreq = width > FREQUENCY_MIN_SHOW_WIDTH;
22860
- const {
22861
- frequencyEnabled = false
22862
- } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
22863
- const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
22864
- return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
22865
- }
22866
-
22867
23085
  function deriveRenderOptions(options) {
22868
23086
  const {
22869
23087
  renderProps,
@@ -24310,8 +24528,9 @@
24310
24528
  styledScrollbars: "".concat(PREFIX$9, "-styledScrollbars")
24311
24529
  };
24312
24530
  function getStyledComponents() {
24313
- const scrollbarStyling = {
24531
+ const getScrollbarStyling = scrollDisabled => ({
24314
24532
  scrollbarColor: "".concat(scrollBarThumb, " ").concat(scrollBarBackground),
24533
+ overflow: scrollDisabled ? 'hidden !important' : undefined,
24315
24534
  '&::-webkit-scrollbar': {
24316
24535
  width: 10,
24317
24536
  height: 10
@@ -24326,42 +24545,27 @@
24326
24545
  '&::-webkit-scrollbar-thumb:hover': {
24327
24546
  backgroundColor: scrollBarThumbHover
24328
24547
  }
24329
- };
24330
- const StyledFixedSizeList = newStyled(FixedSizeList)(() => ({
24331
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
24332
- // TODO: Verify these props and make generic together with grid component.
24333
- '&::-webkit-scrollbar': {
24334
- width: 10,
24335
- height: 10
24336
- },
24337
- '&::-webkit-scrollbar-track': {
24338
- backgroundColor: scrollBarBackground
24339
- },
24340
- '&::-webkit-scrollbar-thumb': {
24341
- backgroundColor: scrollBarThumb,
24342
- borderRadius: '1rem'
24343
- },
24344
- '&::-webkit-scrollbar-thumb:hover': {
24345
- backgroundColor: scrollBarThumbHover
24346
- }
24347
- }));
24348
- const StyledFixedSizeGrid = newStyled(FixedSizeGrid)(() => ({
24349
- ["&.".concat(classes$9.styledScrollbars)]: scrollbarStyling,
24350
- '&::-webkit-scrollbar': {
24351
- width: 10,
24352
- height: 10
24353
- },
24354
- '&::-webkit-scrollbar-track': {
24355
- backgroundColor: scrollBarBackground
24356
- },
24357
- '&::-webkit-scrollbar-thumb': {
24358
- backgroundColor: scrollBarThumb,
24359
- borderRadius: '1rem'
24360
- },
24361
- '&::-webkit-scrollbar-thumb:hover': {
24362
- backgroundColor: scrollBarThumbHover
24363
- }
24364
- }));
24548
+ });
24549
+ const StyledFixedSizeList = newStyled(FixedSizeList, {
24550
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
24551
+ })(_ref => {
24552
+ let {
24553
+ scrollDisabled
24554
+ } = _ref;
24555
+ return {
24556
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
24557
+ };
24558
+ });
24559
+ const StyledFixedSizeGrid = newStyled(FixedSizeGrid, {
24560
+ shouldForwardProp: prop => prop !== 'scrollDisabled'
24561
+ })(_ref2 => {
24562
+ let {
24563
+ scrollDisabled
24564
+ } = _ref2;
24565
+ return {
24566
+ ["&.".concat(classes$9.styledScrollbars)]: getScrollbarStyling(scrollDisabled)
24567
+ };
24568
+ });
24365
24569
  return {
24366
24570
  StyledFixedSizeList,
24367
24571
  StyledFixedSizeGrid
@@ -24427,13 +24631,14 @@
24427
24631
  showGray,
24428
24632
  scrollState,
24429
24633
  direction,
24430
- listLayout,
24431
24634
  sizes,
24432
24635
  listCount,
24433
24636
  overflowDisclaimer,
24434
24637
  setScrollPosition,
24435
24638
  focusListItems,
24436
- setCurrentScrollIndex
24639
+ setCurrentScrollIndex,
24640
+ constraints,
24641
+ freqIsAllowed
24437
24642
  } = _ref;
24438
24643
  const {
24439
24644
  layoutOptions = {},
@@ -24444,7 +24649,8 @@
24444
24649
  listHeight,
24445
24650
  itemSize,
24446
24651
  rowCount,
24447
- columnCount
24652
+ columnCount,
24653
+ frequencyWidth
24448
24654
  } = sizes || {};
24449
24655
 
24450
24656
  // Options common for List and Grid.
@@ -24464,14 +24670,11 @@
24464
24670
  checkboxes,
24465
24671
  layoutOptions,
24466
24672
  frequencyMode,
24467
- freqIsAllowed: getFrequencyAllowed({
24468
- width,
24469
- layout,
24470
- frequencyMode
24471
- }),
24673
+ freqIsAllowed,
24472
24674
  isSingleSelect,
24473
24675
  textAlign,
24474
24676
  itemPadding,
24677
+ frequencyWidth,
24475
24678
  actions: {
24476
24679
  select,
24477
24680
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -24496,10 +24699,10 @@
24496
24699
  // eslint-disable-next-line react/jsx-props-no-spreading
24497
24700
  , _extends$8({}, commonComponentOptions, {
24498
24701
  dataTestid: "fixed-size-list",
24702
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
24499
24703
  height: listHeight,
24500
24704
  width: width,
24501
24705
  itemCount: listCount,
24502
- layout: listLayout,
24503
24706
  itemData: _objectSpread2(_objectSpread2({}, commonItemData), {}, {
24504
24707
  listCount
24505
24708
  }),
@@ -24574,6 +24777,7 @@
24574
24777
  // eslint-disable-next-line react/jsx-props-no-spreading
24575
24778
  , _extends$8({}, commonComponentOptions, {
24576
24779
  dataTestid: "fixed-size-grid",
24780
+ scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
24577
24781
  height: gridHeight,
24578
24782
  width: width,
24579
24783
  columnCount: columnCount,
@@ -24598,6 +24802,9 @@
24598
24802
 
24599
24803
  const scrollBarWidth = 10; // TODO: ignore this - instead set the styling only show on hover...
24600
24804
 
24805
+ const ITEM_MIN_WIDTH = 56;
24806
+ const ITEM_MAX_WIDTH = 150;
24807
+ const FREQUENCY_WIDTH = 40;
24601
24808
  function getListSizes(_ref) {
24602
24809
  let {
24603
24810
  layout,
@@ -24605,7 +24812,8 @@
24605
24812
  height,
24606
24813
  listCount,
24607
24814
  count,
24608
- textWidth
24815
+ textWidth,
24816
+ freqIsAllowed
24609
24817
  } = _ref;
24610
24818
  const {
24611
24819
  layoutOptions = {}
@@ -24617,7 +24825,8 @@
24617
24825
  dense,
24618
24826
  dataLayout
24619
24827
  } = layoutOptions;
24620
- const columnAutoWidth = Math.min(150, textWidth + 18);
24828
+ const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
24829
+ const columnAutoWidth = Math.max(Math.min(ITEM_MAX_WIDTH, textWidth + 18 + frequencyAddWidth), ITEM_MIN_WIDTH + frequencyAddWidth);
24621
24830
  let overflowStyling;
24622
24831
  let columnCount;
24623
24832
  let columnWidth;
@@ -24634,18 +24843,21 @@
24634
24843
  }
24635
24844
  const listHeight = height !== null && height !== void 0 ? height : 8 * itemSize;
24636
24845
  if (layoutOrder) {
24846
+ // Modify container width to achieve the exact design with 8px margins on each side (left and right).
24847
+ let containerWidth = width;
24637
24848
  if (layoutOrder === 'row') {
24849
+ containerWidth += itemPadding * 2;
24638
24850
  overflowStyling = {
24639
24851
  overflowX: 'hidden'
24640
24852
  };
24641
24853
  const maxColumns = (maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.maxColumns) || 3;
24642
24854
  if ((maxVisibleColumns === null || maxVisibleColumns === void 0 ? void 0 : maxVisibleColumns.auto) !== false) {
24643
- columnCount = Math.min(listCount, Math.ceil((width - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
24855
+ columnCount = Math.min(listCount, Math.ceil((containerWidth - scrollBarWidth) / columnAutoWidth)); // TODO: smarter sizing... based on glyph count + font size etc...??
24644
24856
  } else {
24645
24857
  columnCount = Math.min(listCount, maxColumns);
24646
24858
  }
24647
24859
  rowCount = Math.ceil(listCount / columnCount);
24648
- columnWidth = (width - scrollBarWidth) / columnCount;
24860
+ columnWidth = (containerWidth - scrollBarWidth) / columnCount;
24649
24861
  } else {
24650
24862
  overflowStyling = {
24651
24863
  overflowY: 'hidden'
@@ -24657,7 +24869,7 @@
24657
24869
  rowCount = Math.min(listCount, maxRows);
24658
24870
  }
24659
24871
  columnCount = Math.ceil(listCount / rowCount);
24660
- columnWidth = Math.max(columnAutoWidth, width / columnCount);
24872
+ columnWidth = Math.max(columnAutoWidth, containerWidth / columnCount);
24661
24873
  }
24662
24874
  }
24663
24875
  columnCount = (dataLayout === 'singleColumn' ? 1 : columnCount) || 1;
@@ -24683,7 +24895,8 @@
24683
24895
  row: maxRowCount,
24684
24896
  column: maxColumnCount
24685
24897
  },
24686
- itemPadding
24898
+ itemPadding,
24899
+ frequencyWidth: FREQUENCY_WIDTH
24687
24900
  };
24688
24901
  }
24689
24902
 
@@ -25033,18 +25246,35 @@
25033
25246
  };
25034
25247
  }
25035
25248
 
25249
+ const FREQUENCY_MIN_SHOW_WIDTH = 80;
25250
+ function getFrequencyAllowed(_ref) {
25251
+ let {
25252
+ itemWidth,
25253
+ layout,
25254
+ frequencyMode
25255
+ } = _ref;
25256
+ const widthPermitsFreq = itemWidth > FREQUENCY_MIN_SHOW_WIDTH;
25257
+ const {
25258
+ frequencyEnabled = false
25259
+ } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
25260
+ const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
25261
+ return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
25262
+ }
25263
+
25036
25264
  const _excluded$4 = ["isLoadingData"];
25037
25265
  const DEFAULT_MIN_BATCH_SIZE = 100;
25038
25266
  function ListBox(_ref) {
25039
25267
  var _layout$qListObject$q, _loaderRef$current, _loaderRef$current$_l, _loaderRef$current$_l2;
25040
25268
  let {
25041
25269
  model,
25270
+ constraints,
25271
+ layout,
25042
25272
  selections,
25273
+ selectionState,
25043
25274
  direction,
25044
25275
  checkboxes: checkboxOption,
25045
25276
  height,
25046
25277
  width,
25047
- listLayout = 'vertical',
25048
25278
  frequencyMode,
25049
25279
  update = undefined,
25050
25280
  fetchStart = undefined,
@@ -25063,7 +25293,6 @@
25063
25293
  }
25064
25294
  } = _ref;
25065
25295
  const [initScrollPosIsSet, setInitScrollPosIsSet] = reactExports.useState(false);
25066
- const [layout] = useLayout$1(model);
25067
25296
  const isSingleSelect = !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne);
25068
25297
  const {
25069
25298
  checkboxes = checkboxOption,
@@ -25090,11 +25319,7 @@
25090
25319
  postProcessPages,
25091
25320
  listData
25092
25321
  }),
25093
- {
25094
- isLoadingData
25095
- } = _useItemsLoader,
25096
25322
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
25097
- const [pages, setPages] = reactExports.useState([]);
25098
25323
  const {
25099
25324
  setStoreValue
25100
25325
  } = useDataStore(model);
@@ -25106,9 +25331,16 @@
25106
25331
  const showOverflowDisclaimer = show => setOverflowDisclaimer(state => _objectSpread2(_objectSpread2({}, state), {}, {
25107
25332
  show
25108
25333
  }));
25109
- reactExports.useEffect(() => {
25110
- setPages((itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages) || []);
25111
- }, [itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages]);
25334
+ const [pages, setPages] = reactExports.useState([]);
25335
+ if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
25336
+ selectionState.update({
25337
+ setPages,
25338
+ pages: itemsLoader === null || itemsLoader === void 0 ? void 0 : itemsLoader.pages,
25339
+ isSingleSelect,
25340
+ selectDisabled,
25341
+ layout
25342
+ });
25343
+ }
25112
25344
  const isItemLoaded = reactExports.useCallback(index => {
25113
25345
  if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
25114
25346
  return false;
@@ -25119,17 +25351,13 @@
25119
25351
  return page && isLoaded(page);
25120
25352
  }, [layout, pages]);
25121
25353
  const {
25122
- instantPages = [],
25123
25354
  interactionEvents,
25124
25355
  select
25125
25356
  } = useSelectionsInteractions({
25126
- layout,
25357
+ selectionState,
25127
25358
  selections,
25128
- pages,
25129
25359
  checkboxes,
25130
- selectDisabled,
25131
- doc: document,
25132
- isSingleSelect
25360
+ doc: document
25133
25361
  });
25134
25362
  const {
25135
25363
  layoutOptions = {}
@@ -25169,12 +25397,6 @@
25169
25397
  // Hand over the update function for manual refresh from hosting application.
25170
25398
  update.call(null, fetchData);
25171
25399
  }
25172
- reactExports.useEffect(() => {
25173
- if (!instantPages || isLoadingData) {
25174
- return;
25175
- }
25176
- setPages(instantPages);
25177
- }, [instantPages]);
25178
25400
  reactExports.useEffect(() => {
25179
25401
  if (scrollState && !initScrollPosIsSet && loaderRef.current) {
25180
25402
  loaderRef.current._listRef.scrollToItem(scrollState.initScrollPos);
@@ -25189,7 +25411,7 @@
25189
25411
  font: '14px Source sans pro'
25190
25412
  });
25191
25413
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
25192
- const isVertical = layoutOptions.dataLayout ? layoutOptions.dataLayout === 'singleColumn' : listLayout !== 'horizontal';
25414
+ const isVertical = layoutOptions.dataLayout !== 'grid';
25193
25415
  const count = layout === null || layout === void 0 ? void 0 : (_layout$qListObject$q = layout.qListObject.qSize) === null || _layout$qListObject$q === void 0 ? void 0 : _layout$qListObject$q.qcy;
25194
25416
  const unlimitedListCount = getListCount({
25195
25417
  pages,
@@ -25199,14 +25421,28 @@
25199
25421
  layoutOptions,
25200
25422
  model
25201
25423
  });
25424
+ let freqIsAllowed = getFrequencyAllowed({
25425
+ itemWidth: width,
25426
+ layout,
25427
+ frequencyMode
25428
+ });
25202
25429
  const sizes = getListSizes({
25203
25430
  layout,
25204
25431
  width,
25205
25432
  height,
25206
25433
  listCount: unlimitedListCount,
25207
25434
  count,
25208
- textWidth
25435
+ textWidth,
25436
+ freqIsAllowed
25209
25437
  });
25438
+ if (sizes.columnWidth) {
25439
+ // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
25440
+ freqIsAllowed = getFrequencyAllowed({
25441
+ itemWidth: sizes.columnWidth,
25442
+ layout,
25443
+ frequencyMode
25444
+ });
25445
+ }
25210
25446
  const {
25211
25447
  listCount
25212
25448
  } = sizes;
@@ -25225,7 +25461,7 @@
25225
25461
  });
25226
25462
  local.current.dataOffset = offset;
25227
25463
  if (triggerRerender) {
25228
- setPages(currentPages => [...currentPages]);
25464
+ selectionState.triggerStateChanged();
25229
25465
  }
25230
25466
  scrollToIndex(scrollIndex);
25231
25467
  };
@@ -25292,7 +25528,9 @@
25292
25528
  },
25293
25529
  setScrollPosition,
25294
25530
  focusListItems: getFocusState(),
25295
- setCurrentScrollIndex: currentScrollIndex.set
25531
+ setCurrentScrollIndex: currentScrollIndex.set,
25532
+ constraints,
25533
+ freqIsAllowed
25296
25534
  });
25297
25535
  const {
25298
25536
  columnWidth,
@@ -25370,7 +25608,8 @@
25370
25608
  let {
25371
25609
  layout,
25372
25610
  model,
25373
- translator
25611
+ translator,
25612
+ selectionState
25374
25613
  } = _ref;
25375
25614
  if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
25376
25615
  return [];
@@ -25386,6 +25625,7 @@
25386
25625
  getSvgIconShape: selectAll,
25387
25626
  enabled: canSelectAll,
25388
25627
  action: () => {
25628
+ selectionState.clearItemStates(false);
25389
25629
  model.selectListObjectAll('/qListObjectDef');
25390
25630
  }
25391
25631
  }, {
@@ -25395,6 +25635,7 @@
25395
25635
  getSvgIconShape: selectPossible,
25396
25636
  enabled: canSelectPossible,
25397
25637
  action: () => {
25638
+ selectionState.clearItemStates(false);
25398
25639
  model.selectListObjectPossible('/qListObjectDef');
25399
25640
  }
25400
25641
  }, {
@@ -25404,6 +25645,7 @@
25404
25645
  getSvgIconShape: selectAlternative,
25405
25646
  enabled: canSelectAlternative,
25406
25647
  action: () => {
25648
+ selectionState.clearItemStates(false);
25407
25649
  model.selectListObjectAlternative('/qListObjectDef');
25408
25650
  }
25409
25651
  }, {
@@ -25413,6 +25655,7 @@
25413
25655
  getSvgIconShape: selectExcluded,
25414
25656
  enabled: canSelectExcluded,
25415
25657
  action: () => {
25658
+ selectionState.clearItemStates(false);
25416
25659
  model.selectListObjectExcluded('/qListObjectDef');
25417
25660
  }
25418
25661
  }];
@@ -25921,6 +26164,7 @@
25921
26164
  function ListBoxSearch(_ref3) {
25922
26165
  let {
25923
26166
  selections,
26167
+ selectionState,
25924
26168
  model,
25925
26169
  keyboard,
25926
26170
  dense = false,
@@ -25995,6 +26239,7 @@
25995
26239
  response = model.acceptListObjectSearch(TREE_PATH, true);
25996
26240
  // eslint-disable-next-line no-param-reassign
25997
26241
  selections.selectionsMade = true;
26242
+ selectionState.clearItemStates(false);
25998
26243
  setValue('');
25999
26244
  }
26000
26245
  return response;
@@ -26034,7 +26279,8 @@
26034
26279
  },
26035
26280
  '&:hover': {
26036
26281
  border: 'none'
26037
- }
26282
+ },
26283
+ paddingLeft: "".concat(CELL_PADDING_LEFT, "px")
26038
26284
  }, dense && {
26039
26285
  fontSize: 12,
26040
26286
  paddingLeft: theme.spacing(1),
@@ -26308,6 +26554,125 @@
26308
26554
  return [objectSelections];
26309
26555
  }
26310
26556
 
26557
+ function selectionState() {
26558
+ const state = {
26559
+ itemStates: {},
26560
+ ignoreSelectionState: false,
26561
+ selectedInEngine: [],
26562
+ enginePages: [],
26563
+ setPages: undefined,
26564
+ lastRowCount: undefined,
26565
+ lastApprMaxGlyphCount: undefined,
26566
+ update(_ref) {
26567
+ var _layout$qListObject$q, _layout$qListObject, _layout$qListObject$q2;
26568
+ let {
26569
+ setPages,
26570
+ pages,
26571
+ isSingleSelect,
26572
+ selectDisabled,
26573
+ layout
26574
+ } = _ref;
26575
+ this.setPages = setPages;
26576
+ const isSameRowCount = this.lastRowCount === layout.qListObject.qSize.qcy;
26577
+ const isSameMaxGlyphCnt = this.lastApprMaxGlyphCount === layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
26578
+ if (!isSameRowCount || !isSameMaxGlyphCnt) {
26579
+ this.lastRowCount = layout.qListObject.qSize.qcy;
26580
+ this.lastApprMaxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
26581
+
26582
+ // The field have probably changed (drill up/down)
26583
+ // need to clear the client side item states since the field values have changed
26584
+ this.clearItemStates(false);
26585
+ }
26586
+ if (state.enginePages !== pages && pages !== undefined) {
26587
+ state.enginePages = pages !== null && pages !== void 0 ? pages : [];
26588
+ state.selectedInEngine = getSelectedValues(pages);
26589
+ state.selectableValuesUpdating = false;
26590
+ state.triggerStateChanged();
26591
+ }
26592
+ state.isSingleSelect = isSingleSelect;
26593
+ state.selectDisabled = selectDisabled;
26594
+ state.isDimCalculated = (_layout$qListObject$q = layout === null || layout === void 0 ? void 0 : (_layout$qListObject = layout.qListObject) === null || _layout$qListObject === void 0 ? void 0 : (_layout$qListObject$q2 = _layout$qListObject.qDimensionInfo) === null || _layout$qListObject$q2 === void 0 ? void 0 : _layout$qListObject$q2.qIsCalculated) !== null && _layout$qListObject$q !== void 0 ? _layout$qListObject$q : false;
26595
+ },
26596
+ allowedToSelect() {
26597
+ if (state.selectDisabled()) {
26598
+ return false;
26599
+ }
26600
+ // When a dim is calculated, the rows must be done updating after previeous selection
26601
+ return !(state.isDimCalculated && state.selectableValuesUpdating);
26602
+ },
26603
+ setSelectableValuesUpdating() {
26604
+ state.selectableValuesUpdating = true;
26605
+ },
26606
+ useClientItemState(elementNumber) {
26607
+ return state.ignoreSelectionState || elementNumber in state.itemStates;
26608
+ },
26609
+ isSelected(elementNumber) {
26610
+ if (state.useClientItemState(elementNumber)) {
26611
+ return !!state.itemStates[elementNumber];
26612
+ }
26613
+ return state.selectedInEngine.includes(elementNumber);
26614
+ },
26615
+ getState(item) {
26616
+ const {
26617
+ qElemNumber,
26618
+ qState
26619
+ } = item;
26620
+ if (!state.useClientItemState(qElemNumber)) {
26621
+ return qState;
26622
+ }
26623
+ if (state.itemStates[qElemNumber]) {
26624
+ return qState === 'XS' ? 'XS' : 'S';
26625
+ }
26626
+ return qState === 'S' || qState === 'XS' ? 'A' : qState;
26627
+ },
26628
+ updateItemNoEvents(elementNumber, additive, selectedValues) {
26629
+ const selected = state.isSelected(elementNumber);
26630
+ if (selected && !additive) {
26631
+ state.itemStates[elementNumber] = false;
26632
+ } else if (!selected) {
26633
+ selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.push(elementNumber);
26634
+ state.itemStates[elementNumber] = true;
26635
+ }
26636
+ },
26637
+ triggerStateChanged() {
26638
+ if (this.setPages) {
26639
+ const pages = state.applySelectionsOnPages(state.enginePages);
26640
+ this.setPages(pages);
26641
+ }
26642
+ },
26643
+ applySelectionsOnPages(pages) {
26644
+ const matrices = pages.map(page => {
26645
+ const qMatrix = page.qMatrix.map(p => {
26646
+ const [p0] = p;
26647
+ const qState = state.getState(p0);
26648
+ return [_objectSpread2(_objectSpread2({}, p0), {}, {
26649
+ qState
26650
+ }), ...p.slice(1)];
26651
+ });
26652
+ return _objectSpread2(_objectSpread2({}, page), {}, {
26653
+ qMatrix
26654
+ });
26655
+ });
26656
+ return matrices;
26657
+ },
26658
+ updateItem(elementNumber, additive, selectedValues) {
26659
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
26660
+ state.triggerStateChanged();
26661
+ },
26662
+ updateItems(elementNumbers, additive, selectedValues) {
26663
+ elementNumbers.forEach(elementNumber => {
26664
+ state.updateItemNoEvents(elementNumber, additive, selectedValues);
26665
+ });
26666
+ state.triggerStateChanged();
26667
+ },
26668
+ clearItemStates(ignoreSelectionState) {
26669
+ state.itemStates = {};
26670
+ state.ignoreSelectionState = ignoreSelectionState;
26671
+ }
26672
+ };
26673
+ return state;
26674
+ }
26675
+
26311
26676
  const getValue$1 = function (obj, prop) {
26312
26677
  var _obj$prop;
26313
26678
  let defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
@@ -26379,6 +26744,7 @@
26379
26744
  const containerRef = reactExports.useRef();
26380
26745
  const [selections] = useObjectSelections(app, model, containerRef);
26381
26746
  const [layout] = useLayout$1(model);
26747
+ const [selectionState$1] = reactExports.useState(() => selectionState());
26382
26748
  reactExports.useEffect(() => {
26383
26749
  if (selections && open) {
26384
26750
  if (!selections.isModal(model)) {
@@ -26398,7 +26764,8 @@
26398
26764
  const listboxSelectionToolbarItems = createListboxSelectionToolbar({
26399
26765
  layout,
26400
26766
  model,
26401
- translator
26767
+ translator,
26768
+ selectionState: selectionState$1
26402
26769
  });
26403
26770
  const hasSelections$1 = hasSelections(layout);
26404
26771
  return /*#__PURE__*/React.createElement(Popover$1, {
@@ -26471,13 +26838,16 @@
26471
26838
  model: model,
26472
26839
  listCount: listCount,
26473
26840
  selections: selections,
26841
+ selectionState: selectionState$1,
26474
26842
  keyboard: {
26475
26843
  enabled: false
26476
26844
  },
26477
26845
  autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
26478
26846
  }), /*#__PURE__*/React.createElement(ListBox, {
26479
26847
  model: model,
26848
+ layout: layout,
26480
26849
  selections: selections,
26850
+ selectionState: selectionState$1,
26481
26851
  direction: "ltr",
26482
26852
  onSetListCount: c => setListCount(c)
26483
26853
  }))));
@@ -27107,6 +27477,52 @@
27107
27477
  });
27108
27478
  var SelectionsForward = (props => SvgIcon(selectionsForward(props)));
27109
27479
 
27480
+ const patchAlternateState = (currentSelectionsModel, currentSelectionsLayout, appLayout) => {
27481
+ const states = [...(appLayout.qStateNames || [])].map(s => ({
27482
+ stateName: s,
27483
+ // need this as reference in selection toolbar since qSelectionObject.qStateName is not in the layout
27484
+ qSelectionObjectDef: {
27485
+ qStateName: s
27486
+ }
27487
+ }));
27488
+ const existingStates = (currentSelectionsLayout && currentSelectionsLayout.alternateStates ? currentSelectionsLayout.alternateStates.map(s => s.stateName) : []).join('::');
27489
+ const newStates = (appLayout.qStateNames || []).map(s => s).join('::');
27490
+ if (existingStates !== newStates) {
27491
+ currentSelectionsModel.applyPatches([{
27492
+ qOp: 'replace',
27493
+ qPath: '/alternateStates',
27494
+ qValue: JSON.stringify(states)
27495
+ }], true);
27496
+ }
27497
+ };
27498
+ function useAppSelectionsNavigation(app) {
27499
+ const [currentSelectionsModel] = useCurrentSelectionsModel(app);
27500
+ const [currentSelectionsLayout] = useLayout$1(currentSelectionsModel);
27501
+ const [appLayout] = useAppLayout$1(app);
27502
+ const [navigationState, setNavigationState] = reactExports.useState(null);
27503
+ reactExports.useEffect(() => {
27504
+ if (!appLayout || !currentSelectionsModel || !currentSelectionsLayout) return;
27505
+ patchAlternateState(currentSelectionsModel, currentSelectionsLayout, appLayout);
27506
+ }, [appLayout, currentSelectionsModel, currentSelectionsLayout]);
27507
+ reactExports.useEffect(() => {
27508
+ if (!currentSelectionsLayout) return;
27509
+ let canGoBack = false;
27510
+ let canGoForward = false;
27511
+ let canClear = false;
27512
+ [currentSelectionsLayout, ...(currentSelectionsLayout.alternateStates || [])].forEach(state => {
27513
+ canGoBack = canGoBack || state.qSelectionObject && state.qSelectionObject.qBackCount > 0;
27514
+ canGoForward = canGoForward || state.qSelectionObject && state.qSelectionObject.qForwardCount > 0;
27515
+ canClear = canClear || (state.qSelectionObject && state.qSelectionObject.qSelections || []).filter(s => s.qLocked !== true).length > 0;
27516
+ });
27517
+ setNavigationState({
27518
+ canGoBack,
27519
+ canGoForward,
27520
+ canClear
27521
+ });
27522
+ }, [currentSelectionsLayout]);
27523
+ return [navigationState, currentSelectionsModel, currentSelectionsLayout];
27524
+ }
27525
+
27110
27526
  function Nav(_ref) {
27111
27527
  let {
27112
27528
  api,
@@ -27691,6 +28107,16 @@
27691
28107
  style: {}
27692
28108
  };
27693
28109
 
28110
+ const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
28111
+ shapes: [{
28112
+ type: 'path',
28113
+ attrs: {
28114
+ d: 'M15.9993744,3 L15.9993744,5 L4.99937445,5 L4.99937445,3 L15.9993744,3 Z M8.99937445,7 L15.9993744,7 L15.9993744,9 L8.99937445,9 L8.99937445,7 Z M11.9993744,11 L15.9993744,11 L15.9993744,13 L11.9993744,13 L11.9993744,11 Z M2.2,11 L7,11 L7,9.00369263 C7,8.89323568 7.08954305,8.80369263 7.2,8.80369263 C7.2549016,8.80369263 7.30738916,8.82626165 7.34515712,8.86610844 L10.1852182,11.8624926 C10.2583124,11.93961 10.258346,12.0604218 10.1852948,12.13758 L7.34523376,15.1373102 C7.2692928,15.2175206 7.14270711,15.2209817 7.06249671,15.1450407 C7.02260076,15.1072683 7,15.0547472 7,14.9998069 L7,12.9043747 C4.79351111,12.9043747 2.8018683,12.9266213 1.02507156,12.9711145 L1.02507252,12.9711526 C0.472939773,12.9849787 0.014139487,12.5485949 0.000313396522,11.9964622 C0.000104473692,11.988119 -1.32268838e-12,11.9797736 -1.3231638e-12,11.9714278 L-1.83320026e-12,3 L2,3 L2,10.8 C2,10.9104569 2.08954305,11 2.2,11 Z'
28115
+ }
28116
+ }]
28117
+ });
28118
+ var DrillDownIcon = (props => SvgIcon(drillDown(props)));
28119
+
27694
28120
  const addListboxTheme = themeApi => {
27695
28121
  const getListboxStyle = prop => themeApi.getStyle('object', '', "listBox.".concat(prop));
27696
28122
  return {
@@ -27712,14 +28138,19 @@
27712
28138
 
27713
28139
  const PREFIX$4 = 'ListBoxInline';
27714
28140
  const searchIconWidth = 28;
28141
+ const drillDownIconWidth = 24;
27715
28142
  const classes$4 = {
27716
28143
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
27717
- screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
28144
+ screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly"),
28145
+ listboxWrapper: "".concat(PREFIX$4, "-listboxWrapper")
27718
28146
  };
27719
- const StyledGrid$3 = styled$1(Grid$1)(_ref => {
28147
+ const StyledGrid$3 = styled$1(Grid$1, {
28148
+ shouldForwardProp: p => !['containerPadding'].includes(p)
28149
+ })(_ref => {
27720
28150
  var _theme$listBox$backgr, _theme$listBox;
27721
28151
  let {
27722
- theme
28152
+ theme,
28153
+ containerPadding
27723
28154
  } = _ref;
27724
28155
  return {
27725
28156
  backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
@@ -27733,6 +28164,9 @@
27733
28164
  height: 0,
27734
28165
  width: 0,
27735
28166
  overflow: 'hidden'
28167
+ },
28168
+ ["& .".concat(classes$4.listboxWrapper)]: {
28169
+ padding: containerPadding
27736
28170
  }
27737
28171
  };
27738
28172
  });
@@ -27748,15 +28182,15 @@
27748
28182
  };
27749
28183
  });
27750
28184
  function ListBoxInline(_ref3) {
27751
- var _layout$layoutOptions, _layout$layoutOptions2;
28185
+ var _layoutOptions$dense;
27752
28186
  let {
27753
- options = {}
28187
+ options,
28188
+ layout
27754
28189
  } = _ref3;
27755
28190
  const {
27756
28191
  app,
27757
28192
  direction,
27758
28193
  frequencyMode,
27759
- listLayout,
27760
28194
  checkboxes,
27761
28195
  search = true,
27762
28196
  focusSearch = false,
@@ -27800,7 +28234,6 @@
27800
28234
  const moreAlignTo = reactExports.useRef();
27801
28235
  const containerRef = reactExports.useRef();
27802
28236
  const [searchContainer, searchContainerRef] = useRefWithCallback();
27803
- const [layout] = useLayout$1(model);
27804
28237
  const [showToolbar, setShowToolbar] = reactExports.useState(false);
27805
28238
  const [showSearch, setShowSearch] = reactExports.useState(false);
27806
28239
  const [keyboardActive, setKeyboardActive] = reactExports.useState(false);
@@ -27816,6 +28249,7 @@
27816
28249
  stop: 0
27817
28250
  });
27818
28251
  const [appSelections] = useAppSelections(app);
28252
+ const [selectionState$1] = reactExports.useState(() => selectionState());
27819
28253
  const {
27820
28254
  handleKeyDown,
27821
28255
  handleOnMouseEnter,
@@ -27883,17 +28317,23 @@
27883
28317
  return null;
27884
28318
  }
27885
28319
  const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
28320
+ const isDrillDown = layout.qListObject.qDimensionInfo.qGrouping === 'H';
27886
28321
  const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
27887
28322
  layout,
27888
28323
  model,
27889
- translator
28324
+ translator,
28325
+ selectionState: selectionState$1
27890
28326
  }) : [];
27891
28327
  const showSearchToggle = search === 'toggle' && showSearch;
27892
28328
  const searchVisible = (search === true || showSearchToggle) && !selectDisabled();
27893
- const dense = (_layout$layoutOptions = (_layout$layoutOptions2 = layout.layoutOptions) === null || _layout$layoutOptions2 === void 0 ? void 0 : _layout$layoutOptions2.dense) !== null && _layout$layoutOptions !== void 0 ? _layout$layoutOptions : false;
28329
+ const {
28330
+ layoutOptions = {}
28331
+ } = layout;
28332
+ const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
27894
28333
  const searchHeight = dense ? 27 : 40;
27895
28334
  const extraheight = dense ? 39 : 49;
27896
28335
  const minHeight = 49 + (searchVisible ? searchHeight : 0) + extraheight;
28336
+ const headerHeight = 32;
27897
28337
  const {
27898
28338
  wildCardSearch,
27899
28339
  searchEnabled
@@ -27903,12 +28343,26 @@
27903
28343
  setShowSearch(newValue);
27904
28344
  };
27905
28345
  const shouldAutoFocus = searchVisible && search === 'toggle';
28346
+ const showSearchIcon = searchEnabled !== false && search === 'toggle' && !(constraints !== null && constraints !== void 0 && constraints.active);
28347
+ const showSearchOrLockIcon = isLocked || showSearchIcon;
28348
+ const showIcons = showSearchOrLockIcon || isDrillDown;
28349
+ const iconsWidth = (showSearchOrLockIcon ? searchIconWidth : 0) + (isDrillDown ? drillDownIconWidth : 0);
28350
+ const drillDownPaddingLeft = showSearchOrLockIcon ? 0 : ICON_PADDING;
28351
+ const headerPaddingLeft = CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0);
28352
+
28353
+ // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
28354
+ const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
28355
+ let containerPadding;
28356
+ if (isGridMode) {
28357
+ containerPadding = layoutOptions.layoutOrder === 'row' ? '2px 4px' : '2px 6px 2px 4px';
28358
+ }
27906
28359
  return /*#__PURE__*/React.createElement(StyledGrid$3, {
27907
28360
  className: "listbox-container",
27908
28361
  container: true,
27909
28362
  tabIndex: keyboard.enabled && !keyboard.active ? 0 : -1,
27910
28363
  direction: "column",
27911
28364
  gap: 0,
28365
+ containerPadding: containerPadding,
27912
28366
  style: {
27913
28367
  height: '100%',
27914
28368
  minHeight: "".concat(minHeight, "px"),
@@ -27922,45 +28376,60 @@
27922
28376
  item: true,
27923
28377
  container: true,
27924
28378
  style: {
27925
- padding: theme.spacing(1)
28379
+ padding: theme.spacing(1),
28380
+ paddingLeft: "".concat(headerPaddingLeft, "px")
27926
28381
  },
27927
28382
  wrap: "nowrap"
27928
28383
  }, /*#__PURE__*/React.createElement(Grid$1, {
27929
28384
  item: true,
27930
28385
  container: true,
28386
+ height: headerHeight,
27931
28387
  wrap: "nowrap"
27932
- }, /*#__PURE__*/React.createElement(Grid$1, {
28388
+ }, showIcons && /*#__PURE__*/React.createElement(Grid$1, {
27933
28389
  item: true,
27934
28390
  sx: {
27935
28391
  display: 'flex',
27936
28392
  alignItems: 'center',
27937
- width: searchIconWidth
28393
+ width: iconsWidth
27938
28394
  }
27939
28395
  }, isLocked ? /*#__PURE__*/React.createElement(IconButton$1, {
27940
28396
  tabIndex: -1,
27941
28397
  onClick: unlock,
27942
- disabled: !isLocked,
28398
+ disabled: selectDisabled(),
27943
28399
  size: "large"
27944
28400
  }, /*#__PURE__*/React.createElement(Lock, {
27945
28401
  title: translator.get('Listbox.Unlock'),
27946
28402
  style: {
27947
28403
  fontSize: '12px'
27948
28404
  }
27949
- })) : searchEnabled !== false && /*#__PURE__*/React.createElement(IconButton$1, {
28405
+ })) : showSearchIcon && /*#__PURE__*/React.createElement(IconButton$1, {
27950
28406
  onClick: onShowSearch,
27951
28407
  tabIndex: -1,
27952
28408
  title: translator.get('Listbox.Search'),
27953
- size: "large"
28409
+ size: "large",
28410
+ "data-testid": "search-toggle-btn"
27954
28411
  }, /*#__PURE__*/React.createElement(SearchIcon, {
27955
28412
  style: {
27956
28413
  fontSize: '12px'
27957
28414
  }
28415
+ })), isDrillDown && /*#__PURE__*/React.createElement(IconButton$1, {
28416
+ tabIndex: -1,
28417
+ title: translator.get('Listbox.DrillDown'),
28418
+ size: "large",
28419
+ sx: {
28420
+ paddingLeft: "".concat(drillDownPaddingLeft, "px")
28421
+ }
28422
+ }, /*#__PURE__*/React.createElement(DrillDownIcon, {
28423
+ style: {
28424
+ fontSize: '12px'
28425
+ }
27958
28426
  }))), /*#__PURE__*/React.createElement(Grid$1, {
27959
28427
  item: true,
27960
28428
  className: classes$4.listBoxHeader
27961
28429
  }, /*#__PURE__*/React.createElement(Title, {
27962
28430
  variant: "h6",
27963
- noWrap: true
28431
+ noWrap: true,
28432
+ title: layout.title
27964
28433
  }, layout.title))), /*#__PURE__*/React.createElement(Grid$1, {
27965
28434
  item: true,
27966
28435
  xs: true
@@ -28004,6 +28473,7 @@
28004
28473
  className: classes$4.screenReaderOnly
28005
28474
  }, translator.get('Listbox.Search.ScreenReaderInstructions')), /*#__PURE__*/React.createElement(ListBoxSearch, {
28006
28475
  selections: selections,
28476
+ selectionState: selectionState$1,
28007
28477
  model: model,
28008
28478
  dense: dense,
28009
28479
  keyboard: keyboard,
@@ -28015,7 +28485,8 @@
28015
28485
  searchEnabled: searchEnabled
28016
28486
  })), /*#__PURE__*/React.createElement(Grid$1, {
28017
28487
  item: true,
28018
- xs: true
28488
+ xs: true,
28489
+ className: classes$4.listboxWrapper
28019
28490
  }, /*#__PURE__*/React.createElement("div", {
28020
28491
  className: classes$4.screenReaderOnly
28021
28492
  }, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React.createElement(AutoSizer, null, _ref4 => {
@@ -28025,9 +28496,11 @@
28025
28496
  } = _ref4;
28026
28497
  return /*#__PURE__*/React.createElement(ListBox, {
28027
28498
  model: model,
28499
+ constraints: constraints,
28500
+ layout: layout,
28028
28501
  selections: selections,
28502
+ selectionState: selectionState$1,
28029
28503
  direction: direction,
28030
- listLayout: listLayout,
28031
28504
  frequencyMode: frequencyMode,
28032
28505
  rangeSelect: rangeSelect,
28033
28506
  checkboxes: checkboxes,
@@ -28056,6 +28529,20 @@
28056
28529
  });
28057
28530
  }))));
28058
28531
  }
28532
+ const ListBoxInlineMemoed = React.memo(ListBoxInline);
28533
+ function IsolateUseLayoutWrapper(_ref5) {
28534
+ let {
28535
+ options = {}
28536
+ } = _ref5;
28537
+ const {
28538
+ model
28539
+ } = options;
28540
+ const [layout] = useLayout$1(model);
28541
+ return /*#__PURE__*/React.createElement(ListBoxInlineMemoed, {
28542
+ options: options,
28543
+ layout: layout
28544
+ });
28545
+ }
28059
28546
 
28060
28547
  function useExistingModel(_ref) {
28061
28548
  let {
@@ -28082,6 +28569,9 @@
28082
28569
  } else {
28083
28570
  const m = await app.getObject(qId);
28084
28571
  modelStore.set(m.id, m);
28572
+ m.once('closed', () => {
28573
+ modelStore.clear(m.id);
28574
+ });
28085
28575
  setModel(m);
28086
28576
  }
28087
28577
  }
@@ -28135,6 +28625,7 @@
28135
28625
  const {
28136
28626
  dense,
28137
28627
  checkboxes,
28628
+ listLayout,
28138
28629
  properties = {}
28139
28630
  } = options;
28140
28631
  let {
@@ -28163,6 +28654,20 @@
28163
28654
  break;
28164
28655
  }
28165
28656
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
28657
+ const layoutOptions = {
28658
+ dense
28659
+ };
28660
+ if (listLayout === 'horizontal') {
28661
+ layoutOptions.dataLayout = 'grid';
28662
+ layoutOptions.layoutOrder = 'column';
28663
+ layoutOptions.maxVisibleColumns = {
28664
+ auto: true
28665
+ };
28666
+ layoutOptions.maxVisibleRows = {
28667
+ auto: false,
28668
+ maxRows: 1
28669
+ };
28670
+ }
28166
28671
  const id = reactExports.useRef();
28167
28672
  if (!id.current) {
28168
28673
  id.current = uid();
@@ -28175,6 +28680,7 @@
28175
28680
  qListObjectDef: {
28176
28681
  qStateName: stateName,
28177
28682
  qShowAlternatives: true,
28683
+ frequencyEnabled: false,
28178
28684
  qFrequencyMode: getListdefFrequencyMode(),
28179
28685
  qInitialDataFetch: [{
28180
28686
  qTop: 0,
@@ -28193,9 +28699,7 @@
28193
28699
  },
28194
28700
  histogram,
28195
28701
  checkboxes,
28196
- layoutOptions: {
28197
- dense
28198
- },
28702
+ layoutOptions,
28199
28703
  title
28200
28704
  };
28201
28705
  extend$1(true, listdef, properties);
@@ -28318,15 +28822,15 @@
28318
28822
  });
28319
28823
  const elementRef = reactExports.useRef(element);
28320
28824
  const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more'], options)[0];
28321
- if (!selections || !model) {
28322
- return null;
28323
- }
28324
- const opts = _objectSpread2(_objectSpread2({}, options), {}, {
28825
+ const opts = reactExports.useMemo(() => _objectSpread2(_objectSpread2({}, options), {}, {
28325
28826
  selections,
28326
28827
  model,
28327
28828
  app
28328
- });
28329
- return /*#__PURE__*/React.createElement(ListBoxInline, {
28829
+ }), [options, selections, model, app]);
28830
+ if (!selections || !model) {
28831
+ return null;
28832
+ }
28833
+ return /*#__PURE__*/React.createElement(IsolateUseLayoutWrapper, {
28330
28834
  options: opts
28331
28835
  });
28332
28836
  }