@nebula.js/stardust 5.0.0-alpha.2 → 5.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v5.0.0-alpha.2
2
+ * @nebula.js/stardust v5.0.0-alpha.3
3
3
  * Copyright (c) 2024 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -8,7 +8,7 @@ import * as React from 'react';
8
8
  import React__default, { useState as useState$1, useEffect as useEffect$1, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useContext, useReducer, useCallback, useLayoutEffect as useLayoutEffect$1, PureComponent, useRef, createElement, Component } from 'react';
9
9
  import ReactDOM from 'react-dom';
10
10
  import { CacheProvider, ThemeContext as ThemeContext$2 } from '@emotion/react';
11
- import { Checkbox, Radio, Typography, FormControlLabel, Box, Grid, Tooltip, Paper, IconButton, styled as styled$3, Popover, MenuList, MenuItem, ListItemIcon, Divider, OutlinedInput, InputAdornment, Badge, List, ListItem, Button, Icon, CircularProgress } from '@mui/material';
11
+ import { Checkbox, Radio, Typography, FormControlLabel, Box, Grid, Tooltip, Paper, IconButton, styled as styled$3, Popover, MenuList, MenuItem, ListItemIcon, Divider, OutlinedInput, InputAdornment, Badge, List, ListItem, Button, ButtonBase, CircularProgress, Icon } from '@mui/material';
12
12
  import styled$2 from '@emotion/styled';
13
13
 
14
14
  function getDefaultExportFromCjs (x) {
@@ -709,26 +709,40 @@ var runtime = {exports: {}};
709
709
  }
710
710
  })(runtime);
711
711
 
712
- function ownKeys(object, enumerableOnly) {
713
- var keys = Object.keys(object);
712
+ function ownKeys(e, r) {
713
+ var t = Object.keys(e);
714
714
  if (Object.getOwnPropertySymbols) {
715
- var symbols = Object.getOwnPropertySymbols(object);
716
- enumerableOnly && (symbols = symbols.filter(function (sym) {
717
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
718
- })), keys.push.apply(keys, symbols);
719
- }
720
- return keys;
721
- }
722
- function _objectSpread2(target) {
723
- for (var i = 1; i < arguments.length; i++) {
724
- var source = null != arguments[i] ? arguments[i] : {};
725
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
726
- _defineProperty(target, key, source[key]);
727
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
728
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
715
+ var o = Object.getOwnPropertySymbols(e);
716
+ r && (o = o.filter(function (r) {
717
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
718
+ })), t.push.apply(t, o);
719
+ }
720
+ return t;
721
+ }
722
+ function _objectSpread2(e) {
723
+ for (var r = 1; r < arguments.length; r++) {
724
+ var t = null != arguments[r] ? arguments[r] : {};
725
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
726
+ _defineProperty(e, r, t[r]);
727
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
728
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
729
729
  });
730
730
  }
731
- return target;
731
+ return e;
732
+ }
733
+ function _toPrimitive(t, r) {
734
+ if ("object" != typeof t || !t) return t;
735
+ var e = t[Symbol.toPrimitive];
736
+ if (void 0 !== e) {
737
+ var i = e.call(t, r || "default");
738
+ if ("object" != typeof i) return i;
739
+ throw new TypeError("@@toPrimitive must return a primitive value.");
740
+ }
741
+ return ("string" === r ? String : Number)(t);
742
+ }
743
+ function _toPropertyKey(t) {
744
+ var i = _toPrimitive(t, "string");
745
+ return "symbol" == typeof i ? i : String(i);
732
746
  }
733
747
  function _defineProperty(obj, key, value) {
734
748
  key = _toPropertyKey(key);
@@ -785,20 +799,6 @@ function _objectWithoutProperties(source, excluded) {
785
799
  }
786
800
  return target;
787
801
  }
788
- function _toPrimitive(input, hint) {
789
- if (typeof input !== "object" || input === null) return input;
790
- var prim = input[Symbol.toPrimitive];
791
- if (prim !== undefined) {
792
- var res = prim.call(input, hint || "default");
793
- if (typeof res !== "object") return res;
794
- throw new TypeError("@@toPrimitive must return a primitive value.");
795
- }
796
- return (hint === "string" ? String : Number)(input);
797
- }
798
- function _toPropertyKey(arg) {
799
- var key = _toPrimitive(arg, "string");
800
- return typeof key === "symbol" ? key : String(key);
801
- }
802
802
 
803
803
  const format = function () {
804
804
  let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
@@ -1932,6 +1932,26 @@ var Visualization_UnfulfilledCalculationCondition = {
1932
1932
  "zh-TW": "不符計算條件"
1933
1933
  }
1934
1934
  };
1935
+ var SelectionToolbar_ClickToLock = {
1936
+ id: "SelectionToolbar.ClickToLock",
1937
+ locale: {
1938
+ "de-DE": "Klicken zum Sperren",
1939
+ "en-US": "Click to lock",
1940
+ "es-ES": "Haga clic para bloquearla",
1941
+ "fr-FR": "Cliquez pour verrouiller",
1942
+ "it-IT": "Fare clic per bloccare",
1943
+ "ja-JP": "クリックしてロック",
1944
+ "ko-KR": "잠그려면 클릭하십시오.",
1945
+ "nl-NL": "Klik om te vergrendelen",
1946
+ "pl-PL": "Aby zablokować, kliknij",
1947
+ "pt-BR": "Clique para travar",
1948
+ "ru-RU": "Щелкните, чтобы заблокировать",
1949
+ "sv-SE": "Klicka för att låsa",
1950
+ "tr-TR": "Kilitlemek için tıklayın",
1951
+ "zh-CN": "单击以锁定",
1952
+ "zh-TW": "按一下鎖定"
1953
+ }
1954
+ };
1935
1955
  var all = {
1936
1956
  Cancel: Cancel$1,
1937
1957
  CurrentSelections_All: CurrentSelections_All,
@@ -1984,7 +2004,8 @@ var all = {
1984
2004
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1985
2005
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1986
2006
  Visualization_LayoutError: Visualization_LayoutError,
1987
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
2007
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
2008
+ SelectionToolbar_ClickToLock: SelectionToolbar_ClickToLock
1988
2009
  };
1989
2010
 
1990
2011
  function appLocaleFn(language) {
@@ -3063,10 +3084,27 @@ var _variables = {
3063
3084
  };
3064
3085
  var type = "dark";
3065
3086
  var color$1 = "@B98";
3087
+ var object$1 = {
3088
+ listBox: {
3089
+ backgroundColor: "@B20",
3090
+ title: {
3091
+ main: {
3092
+ color: "@B98",
3093
+ fontSize: "14px",
3094
+ fontWeight: "bold"
3095
+ }
3096
+ },
3097
+ content: {
3098
+ color: "#@B98",
3099
+ fontSize: "12px"
3100
+ }
3101
+ }
3102
+ };
3066
3103
  var darkRawJSON = {
3067
3104
  _variables: _variables,
3068
3105
  type: type,
3069
- color: color$1
3106
+ color: color$1,
3107
+ object: object$1
3070
3108
  };
3071
3109
 
3072
3110
  var object = {
@@ -3096,7 +3134,7 @@ function setTheme(t, resolve) {
3096
3134
  if (t._inherit === false || t._inherit === 'false') {
3097
3135
  baseInherit = {};
3098
3136
  }
3099
- const root = extend$2(true, {}, baseRawJSON, colorRawJSON, baseInherit);
3137
+ const root = extend$2(true, {}, baseRawJSON, baseInherit, colorRawJSON);
3100
3138
  // avoid merging known array objects as it could cause issues if they are of different types (pyramid vs class) or length
3101
3139
  const rawThemeJSON = extend$2(true, {}, root, {
3102
3140
  scales: null,
@@ -5160,7 +5198,7 @@ function StyledEngineProvider(props) {
5160
5198
  }
5161
5199
 
5162
5200
  /**
5163
- * @mui/styled-engine v5.15.2
5201
+ * @mui/styled-engine v5.15.7
5164
5202
  *
5165
5203
  * @license MIT
5166
5204
  * This source code is licensed under the MIT license found in the
@@ -5223,8 +5261,13 @@ function _extends$2() {
5223
5261
  return _extends$2.apply(this, arguments);
5224
5262
  }
5225
5263
 
5264
+ // https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
5226
5265
  function isPlainObject(item) {
5227
- return item !== null && typeof item === 'object' && item.constructor === Object;
5266
+ if (typeof item !== 'object' || item === null) {
5267
+ return false;
5268
+ }
5269
+ const prototype = Object.getPrototypeOf(item);
5270
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
5228
5271
  }
5229
5272
  function deepClone(source) {
5230
5273
  if (!isPlainObject(source)) {
@@ -5460,9 +5503,37 @@ function useForkRef(...refs) {
5460
5503
  }, refs);
5461
5504
  }
5462
5505
 
5506
+ class Timeout {
5507
+ constructor() {
5508
+ this.currentId = 0;
5509
+ this.clear = () => {
5510
+ if (this.currentId !== 0) {
5511
+ clearTimeout(this.currentId);
5512
+ this.currentId = 0;
5513
+ }
5514
+ };
5515
+ this.disposeEffect = () => {
5516
+ return this.clear;
5517
+ };
5518
+ }
5519
+ static create() {
5520
+ return new Timeout();
5521
+ }
5522
+ /**
5523
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
5524
+ */
5525
+ start(delay, fn) {
5526
+ this.clear();
5527
+ this.currentId = setTimeout(() => {
5528
+ this.currentId = 0;
5529
+ fn();
5530
+ }, delay);
5531
+ }
5532
+ }
5533
+
5463
5534
  let hadKeyboardEvent = true;
5464
5535
  let hadFocusVisibleRecently = false;
5465
- let hadFocusVisibleRecentlyTimeout;
5536
+ const hadFocusVisibleRecentlyTimeout = new Timeout();
5466
5537
  const inputTypesWhitelist = {
5467
5538
  text: true,
5468
5539
  search: true,
@@ -5585,10 +5656,9 @@ function useIsFocusVisible() {
5585
5656
  // If we don't see a visibility change within 100ms, it's probably a
5586
5657
  // regular focus change.
5587
5658
  hadFocusVisibleRecently = true;
5588
- window.clearTimeout(hadFocusVisibleRecentlyTimeout);
5589
- hadFocusVisibleRecentlyTimeout = window.setTimeout(() => {
5659
+ hadFocusVisibleRecentlyTimeout.start(100, () => {
5590
5660
  hadFocusVisibleRecently = false;
5591
- }, 100);
5661
+ });
5592
5662
  isFocusVisibleRef.current = false;
5593
5663
  return true;
5594
5664
  }
@@ -5686,10 +5756,7 @@ const createClassNameGenerator = () => {
5686
5756
  };
5687
5757
  const ClassNameGenerator = createClassNameGenerator();
5688
5758
 
5689
- // If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
5690
- // \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
5691
-
5692
- const globalStateClassesMapping = {
5759
+ const globalStateClasses = {
5693
5760
  active: 'active',
5694
5761
  checked: 'checked',
5695
5762
  completed: 'completed',
@@ -5704,7 +5771,7 @@ const globalStateClassesMapping = {
5704
5771
  selected: 'selected'
5705
5772
  };
5706
5773
  function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
5707
- const globalStateClass = globalStateClassesMapping[slot];
5774
+ const globalStateClass = globalStateClasses[slot];
5708
5775
  return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
5709
5776
  }
5710
5777
 
@@ -5716,6 +5783,10 @@ function generateUtilityClasses(componentName, slots, globalStatePrefix = 'Mui')
5716
5783
  return result;
5717
5784
  }
5718
5785
 
5786
+ function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
5787
+ return Math.max(min, Math.min(val, max));
5788
+ }
5789
+
5719
5790
  const _excluded$g = ["values", "unit", "step"];
5720
5791
  const sortBreakpointsValues = values => {
5721
5792
  const breakpointsAsArray = Object.keys(values).map(key => ({
@@ -6724,6 +6795,81 @@ function unstable_createStyleFunctionSx() {
6724
6795
  const styleFunctionSx = unstable_createStyleFunctionSx();
6725
6796
  styleFunctionSx.filterProps = ['sx'];
6726
6797
 
6798
+ /**
6799
+ * A universal utility to style components with multiple color modes. Always use it from the theme object.
6800
+ * It works with:
6801
+ * - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
6802
+ * - [CSS theme variables](https://mui.com/material-ui/experimental-api/css-theme-variables/overview/)
6803
+ * - Zero-runtime engine
6804
+ *
6805
+ * Tips: Use an array over object spread and place `theme.applyStyles()` last.
6806
+ *
6807
+ * ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
6808
+ *
6809
+ * 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
6810
+ *
6811
+ * @example
6812
+ * 1. using with `styled`:
6813
+ * ```jsx
6814
+ * const Component = styled('div')(({ theme }) => [
6815
+ * { background: '#e5e5e5' },
6816
+ * theme.applyStyles('dark', {
6817
+ * background: '#1c1c1c',
6818
+ * color: '#fff',
6819
+ * }),
6820
+ * ]);
6821
+ * ```
6822
+ *
6823
+ * @example
6824
+ * 2. using with `sx` prop:
6825
+ * ```jsx
6826
+ * <Box sx={theme => [
6827
+ * { background: '#e5e5e5' },
6828
+ * theme.applyStyles('dark', {
6829
+ * background: '#1c1c1c',
6830
+ * color: '#fff',
6831
+ * }),
6832
+ * ]}
6833
+ * />
6834
+ * ```
6835
+ *
6836
+ * @example
6837
+ * 3. theming a component:
6838
+ * ```jsx
6839
+ * extendTheme({
6840
+ * components: {
6841
+ * MuiButton: {
6842
+ * styleOverrides: {
6843
+ * root: ({ theme }) => [
6844
+ * { background: '#e5e5e5' },
6845
+ * theme.applyStyles('dark', {
6846
+ * background: '#1c1c1c',
6847
+ * color: '#fff',
6848
+ * }),
6849
+ * ],
6850
+ * },
6851
+ * }
6852
+ * }
6853
+ * })
6854
+ *```
6855
+ */
6856
+ function applyStyles(key, styles) {
6857
+ // @ts-expect-error this is 'any' type
6858
+ const theme = this;
6859
+ if (theme.vars && typeof theme.getColorSchemeSelector === 'function') {
6860
+ // If CssVarsProvider is used as a provider,
6861
+ // returns '* :where([data-mui-color-scheme="light|dark"]) &'
6862
+ const selector = theme.getColorSchemeSelector(key).replace(/(\[[^\]]+\])/, '*:where($1)');
6863
+ return {
6864
+ [selector]: styles
6865
+ };
6866
+ }
6867
+ if (theme.palette.mode === key) {
6868
+ return styles;
6869
+ }
6870
+ return {};
6871
+ }
6872
+
6727
6873
  const _excluded$f = ["breakpoints", "palette", "spacing", "shape"];
6728
6874
  function createTheme$1(options = {}, ...args) {
6729
6875
  const {
@@ -6746,6 +6892,7 @@ function createTheme$1(options = {}, ...args) {
6746
6892
  spacing,
6747
6893
  shape: _extends$3({}, shape$1, shapeInput)
6748
6894
  }, other);
6895
+ muiTheme.applyStyles = applyStyles;
6749
6896
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
6750
6897
  muiTheme.unstable_sxConfig = _extends$3({}, defaultSxConfig$1, other == null ? void 0 : other.unstable_sxConfig);
6751
6898
  muiTheme.unstable_sx = function sx(props) {
@@ -6770,7 +6917,7 @@ function useTheme$3(defaultTheme = systemDefaultTheme$1) {
6770
6917
  return useTheme$4(defaultTheme);
6771
6918
  }
6772
6919
 
6773
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
6920
+ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
6774
6921
 
6775
6922
  const _excluded$e = ["variant"];
6776
6923
  function isEmpty$2(string) {
@@ -7122,7 +7269,6 @@ function useThemeProps$1({
7122
7269
  return mergedProps;
7123
7270
  }
7124
7271
 
7125
- /* eslint-disable @typescript-eslint/naming-convention */
7126
7272
  /**
7127
7273
  * Returns a number whose value is limited to the given range.
7128
7274
  * @param {number} value The value to be clamped
@@ -7130,8 +7276,8 @@ function useThemeProps$1({
7130
7276
  * @param {number} max The upper boundary of the output range
7131
7277
  * @returns {number} A number in the range [min, max]
7132
7278
  */
7133
- function clamp(value, min = 0, max = 1) {
7134
- return Math.min(Math.max(min, value), max);
7279
+ function clampWrapper(value, min = 0, max = 1) {
7280
+ return clamp(value, min, max);
7135
7281
  }
7136
7282
 
7137
7283
  /**
@@ -7293,7 +7439,7 @@ function getContrastRatio(foreground, background) {
7293
7439
  */
7294
7440
  function darken(color, coefficient) {
7295
7441
  color = decomposeColor(color);
7296
- coefficient = clamp(coefficient);
7442
+ coefficient = clampWrapper(coefficient);
7297
7443
  if (color.type.indexOf('hsl') !== -1) {
7298
7444
  color.values[2] *= 1 - coefficient;
7299
7445
  } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {
@@ -7312,7 +7458,7 @@ function darken(color, coefficient) {
7312
7458
  */
7313
7459
  function lighten(color, coefficient) {
7314
7460
  color = decomposeColor(color);
7315
- coefficient = clamp(coefficient);
7461
+ coefficient = clampWrapper(coefficient);
7316
7462
  if (color.type.indexOf('hsl') !== -1) {
7317
7463
  color.values[2] += (100 - color.values[2]) * coefficient;
7318
7464
  } else if (color.type.indexOf('rgb') !== -1) {
@@ -8258,6 +8404,7 @@ const colors = {
8258
8404
  grey90: '#E6E6E6',
8259
8405
  grey85: '#D9D9D9',
8260
8406
  grey55: '#8C8C8C',
8407
+ grey45: '#737373',
8261
8408
  grey30: '#4D4D4D',
8262
8409
  grey25: '#404040',
8263
8410
  grey20: '#333333',
@@ -8312,7 +8459,9 @@ const light = {
8312
8459
  custom: {
8313
8460
  focusBorder: colors.blue,
8314
8461
  focusOutline: 'rgba(70, 157, 205, 0.3)',
8315
- inputBackground: 'rgba(255, 255, 255, 1)'
8462
+ inputBackground: 'rgba(255, 255, 255, 1)',
8463
+ disabledBackground: colors.grey45,
8464
+ disabledContrastText: colors.grey100
8316
8465
  },
8317
8466
  selected: {
8318
8467
  main: colors.green,
@@ -8380,7 +8529,9 @@ const dark = {
8380
8529
  custom: {
8381
8530
  focusBorder: colors.blue,
8382
8531
  focusOutline: 'rgba(70, 157, 205, 0.3)',
8383
- inputBackground: 'rgba(0, 0, 0, 0.2)'
8532
+ inputBackground: 'rgba(0, 0, 0, 0.2)',
8533
+ disabledBackground: colors.grey45,
8534
+ disabledContrastText: colors.grey100
8384
8535
  },
8385
8536
  selected: {
8386
8537
  main: colors.green,
@@ -8541,7 +8692,7 @@ function create$3(definition) {
8541
8692
  return cache[key];
8542
8693
  }
8543
8694
 
8544
- const NEBULA_VERSION_HASH = "b12a" ;
8695
+ const NEBULA_VERSION_HASH = "fc09" ;
8545
8696
  ClassNameGenerator.configure(componentName => {
8546
8697
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8547
8698
  });
@@ -8773,7 +8924,7 @@ function boot(_ref2) {
8773
8924
  const appRef = React__default.createRef();
8774
8925
  const element = document.createElement('div');
8775
8926
  element.style.display = 'none';
8776
- element.setAttribute('data-nebulajs-version', "5.0.0-alpha.2" );
8927
+ element.setAttribute('data-nebulajs-version', "5.0.0-alpha.3" );
8777
8928
  element.setAttribute('data-app-id', app.id);
8778
8929
  document.body.appendChild(element);
8779
8930
  if (context) {
@@ -9185,6 +9336,7 @@ const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
9185
9336
  var Lock = (props => SvgIcon$1(lock(props)));
9186
9337
 
9187
9338
  const unlock = props => _objectSpread2(_objectSpread2({}, props), {}, {
9339
+ viewBox: '0 0 12 16',
9188
9340
  shapes: [{
9189
9341
  type: 'path',
9190
9342
  attrs: {
@@ -11222,12 +11374,13 @@ function RowColumn(_ref) {
11222
11374
  flexGrow: 1,
11223
11375
  paddingLeft: isRtl ? 8 : checkboxes ? 0 : undefined,
11224
11376
  paddingRight: checkboxes ? 0 : isRtl ? 8 : 0,
11225
- justifyContent: valueTextAlign
11377
+ justifyContent: valueTextAlign,
11378
+ textAlign: valueTextAlign
11226
11379
  };
11227
11380
  const isFirstElement = index === 0;
11228
- const showLock = isSelected && isLocked;
11229
- const showTick = !checkboxes && isSelected && !isLocked;
11230
- const showIcon = !checkboxes && sizePermitsTickOrLock;
11381
+ const showLockIcon = isSelected && isLocked;
11382
+ const showTickIcon = !checkboxes && isSelected && !isLocked;
11383
+ const showAnyIcon = !checkboxes && sizePermitsTickOrLock;
11231
11384
  const cellPaddingRight = checkboxes || !sizePermitsTickOrLock;
11232
11385
  const ariaLabel = getValueLabel({
11233
11386
  translator,
@@ -11323,13 +11476,13 @@ function RowColumn(_ref) {
11323
11476
  checkboxes: checkboxes,
11324
11477
  dense: dense,
11325
11478
  showGray: showGray
11326
- }), showIcon && /*#__PURE__*/React__default.createElement(Grid, {
11479
+ }), showAnyIcon && /*#__PURE__*/React__default.createElement(Grid, {
11327
11480
  item: true,
11328
11481
  className: rowColClasses.icon
11329
- }, showLock && /*#__PURE__*/React__default.createElement(Lock, {
11482
+ }, showLockIcon && /*#__PURE__*/React__default.createElement(Lock, {
11330
11483
  style: iconStyles,
11331
11484
  size: "small"
11332
- }), showTick && /*#__PURE__*/React__default.createElement(Tick, {
11485
+ }), showTickIcon && /*#__PURE__*/React__default.createElement(Tick, {
11333
11486
  style: iconStyles,
11334
11487
  size: "small"
11335
11488
  }))));
@@ -13662,10 +13815,9 @@ Object.defineProperty(Close, "__esModule", {
13662
13815
  var default_1 = Close.default = void 0;
13663
13816
  var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
13664
13817
  var _jsxRuntime = jsxRuntimeExports;
13665
- var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
13818
+ default_1 = Close.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
13666
13819
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
13667
13820
  }), 'Close');
13668
- default_1 = Close.default = _default;
13669
13821
 
13670
13822
  const RootContainer = styled(Paper)(_ref => {
13671
13823
  let {
@@ -14393,6 +14545,7 @@ var ClearSelections = (props => SvgIcon$1(clearSelections(props)));
14393
14545
  function useDefaultSelectionActions(_ref) {
14394
14546
  let {
14395
14547
  api,
14548
+ layout,
14396
14549
  onConfirm = () => {},
14397
14550
  onCancel = () => {},
14398
14551
  onKeyDeactivate = () => {}
@@ -14404,14 +14557,14 @@ function useDefaultSelectionActions(_ref) {
14404
14557
  key: 'clear',
14405
14558
  type: 'icon-button',
14406
14559
  label: translator.get('Selection.Clear'),
14407
- enabled: () => api.canClear(),
14560
+ enabled: () => api.canClear(layout),
14408
14561
  action: () => api.clear(),
14409
14562
  getSvgIconShape: clearSelections
14410
14563
  }, {
14411
14564
  key: 'cancel',
14412
14565
  type: 'icon-button',
14413
14566
  label: translator.get('Selection.Cancel'),
14414
- enabled: () => api.canCancel(),
14567
+ enabled: () => api.canCancel(layout),
14415
14568
  action: () => {
14416
14569
  onCancel();
14417
14570
  api.cancel();
@@ -14426,7 +14579,7 @@ function useDefaultSelectionActions(_ref) {
14426
14579
  key: 'confirm',
14427
14580
  type: 'icon-button',
14428
14581
  label: translator.get('Selection.Confirm'),
14429
- enabled: () => api.canConfirm(),
14582
+ enabled: () => api.canConfirm(layout),
14430
14583
  action: () => {
14431
14584
  onConfirm();
14432
14585
  api.confirm();
@@ -14531,7 +14684,7 @@ const More$1 = React__default.forwardRef((_ref3, ref) => {
14531
14684
  }), /*#__PURE__*/React__default.createElement(MenuList, {
14532
14685
  id: "moreMenuList"
14533
14686
  }, actions.map((item, ix) =>
14534
-
14687
+ /*#__PURE__*/
14535
14688
  // eslint-disable-next-line react/no-array-index-key
14536
14689
  React__default.createElement(MoreItem, {
14537
14690
  key: ix,
@@ -14561,7 +14714,8 @@ function getActionsKeyDownHandler(_ref) {
14561
14714
  keyboardNavigation,
14562
14715
  focusHandler,
14563
14716
  getEnabledButton,
14564
- selections
14717
+ selections,
14718
+ isRtl
14565
14719
  } = _ref;
14566
14720
  const handleActionsKeyDown = evt => {
14567
14721
  const {
@@ -14580,7 +14734,8 @@ function getActionsKeyDownHandler(_ref) {
14580
14734
  const isActionButton = target.classList.contains('njs-cell-action');
14581
14735
  if (isActionButton) {
14582
14736
  const index = getActionButtonIndex(target);
14583
- const pressedLeft = [KEYS.ARROW_LEFT, KEYS.ARROW_DOWN].includes(keyCode);
14737
+ let pressedLeft = [KEYS.ARROW_LEFT, KEYS.ARROW_DOWN].includes(keyCode);
14738
+ pressedLeft = isRtl ? !pressedLeft : pressedLeft; // invert direction when using RTL
14584
14739
  focusButton(pressedLeft ? index - 1 : index + 1);
14585
14740
  }
14586
14741
  evt.stopPropagation();
@@ -14685,6 +14840,7 @@ function ActionsToolbar(_ref3) {
14685
14840
  onConfirm: () => {},
14686
14841
  onCancel: () => {}
14687
14842
  },
14843
+ extraItems,
14688
14844
  more: more$1 = {
14689
14845
  enabled: false,
14690
14846
  actions: [],
@@ -14699,10 +14855,13 @@ function ActionsToolbar(_ref3) {
14699
14855
  focusHandler = null,
14700
14856
  actionsRefMock = null,
14701
14857
  // for testing
14702
- direction = 'ltr',
14703
- autoConfirm = false
14858
+ isRtl,
14859
+ autoConfirm = false,
14860
+ layout
14704
14861
  } = _ref3;
14705
- const defaultSelectionActions = useDefaultSelectionActions(selections);
14862
+ const defaultSelectionActions = useDefaultSelectionActions(_objectSpread2(_objectSpread2({}, selections), {}, {
14863
+ layout
14864
+ }));
14706
14865
  const {
14707
14866
  translator,
14708
14867
  keyboardNavigation
@@ -14728,8 +14887,9 @@ function ActionsToolbar(_ref3) {
14728
14887
  keyboardNavigation,
14729
14888
  focusHandler,
14730
14889
  getEnabledButton,
14731
- selections
14732
- }), [keyboardNavigation, focusHandler, getEnabledButton, selections]);
14890
+ selections,
14891
+ isRtl
14892
+ }), [keyboardNavigation, focusHandler, getEnabledButton, selections, isRtl]);
14733
14893
  useEffect$1(() => () => {
14734
14894
  setShowMoreItems(false);
14735
14895
  }, [popover.show, show, selections.show]);
@@ -14737,11 +14897,11 @@ function ActionsToolbar(_ref3) {
14737
14897
  if (!focusHandler) return;
14738
14898
  const focusFirst = () => {
14739
14899
  const enabledButton = getEnabledButton(false);
14740
- enabledButton && enabledButton.focus();
14900
+ enabledButton === null || enabledButton === void 0 || enabledButton.focus();
14741
14901
  };
14742
14902
  const focusLast = () => {
14743
14903
  const enabledButton = getEnabledButton(true);
14744
- enabledButton && enabledButton.focus();
14904
+ enabledButton === null || enabledButton === void 0 || enabledButton.focus();
14745
14905
  };
14746
14906
  focusHandler.on('focus_toolbar_first', focusFirst);
14747
14907
  focusHandler.on('focus_toolbar_last', focusLast);
@@ -14775,7 +14935,6 @@ function ActionsToolbar(_ref3) {
14775
14935
  const showActions = newActions.length > 0;
14776
14936
  const showMore = moreActions.length > 0;
14777
14937
  const showDivider = showActions && selections.show || showMore && selections.show;
14778
- const isRtl = direction === 'rtl';
14779
14938
  const Actions = /*#__PURE__*/React__default.createElement(Grid, {
14780
14939
  ref: actionsRef,
14781
14940
  onKeyDown: handleActionsKeyDown,
@@ -14787,7 +14946,11 @@ function ActionsToolbar(_ref3) {
14787
14946
  sx: {
14788
14947
  flexDirection: isRtl ? 'row-reverse' : 'row'
14789
14948
  }
14790
- }, showActions && /*#__PURE__*/React__default.createElement(ActionsGroup, {
14949
+ }, (extraItems === null || extraItems === void 0 ? void 0 : extraItems.length) && /*#__PURE__*/React__default.createElement(ActionsGroup, {
14950
+ className: "actions-toolbar-extra-actions",
14951
+ actions: extraItems,
14952
+ isRtl: isRtl
14953
+ }), showActions && /*#__PURE__*/React__default.createElement(ActionsGroup, {
14791
14954
  actions: newActions
14792
14955
  }), showMore && /*#__PURE__*/React__default.createElement(ActionsGroup, {
14793
14956
  id: "actions-toolbar-show-more",
@@ -14989,7 +15152,7 @@ function ListBoxSearch(_ref2) {
14989
15152
  };
14990
15153
  function focusRow(container) {
14991
15154
  const row = (container === null || container === void 0 ? void 0 : container.querySelector('.last-focused')) || (container === null || container === void 0 ? void 0 : container.querySelector('[role="row"]:first-child'));
14992
- row.setAttribute('tabIndex', 0);
15155
+ row === null || row === void 0 || row.setAttribute('tabIndex', 0);
14993
15156
  row === null || row === void 0 || row.focus();
14994
15157
  }
14995
15158
  const onKeyDown = async e => {
@@ -17509,6 +17672,11 @@ function getSearchColor(getListboxStyle) {
17509
17672
  const color = getContrastingColor('#fff', desiredTextColor);
17510
17673
  return color;
17511
17674
  }
17675
+ function getSearchBGColor(bgCol, getListboxStyle) {
17676
+ const searchBgColorObj = new Color(getListboxStyle('', 'backgroundColor'));
17677
+ searchBgColorObj.setAlpha(0.7);
17678
+ return searchBgColorObj.isInvalid() ? bgCol : searchBgColorObj.toRGBA();
17679
+ }
17512
17680
  function getStyles(_ref3) {
17513
17681
  var _themeOverrides$heade, _themeOverrides$backg, _themeOverrides$heade2, _themeOverrides$conte, _themeOverrides$heade3, _themeOverrides$heade4, _themeOverrides$conte2, _themeOverrides$conte3;
17514
17682
  let {
@@ -17537,7 +17705,8 @@ function getStyles(_ref3) {
17537
17705
  const bgImage = (_themeOverrides$backg = themeOverrides.background) !== null && _themeOverrides$backg !== void 0 && _themeOverrides$backg.image ? resolveBgImage({
17538
17706
  bgImage: themeOverrides.background.image
17539
17707
  }, app) : undefined;
17540
- const searchBgColor = 'rgba(255, 255, 255, 0.7)';
17708
+ const bgColor = bgComponentColor || getListboxStyle('', 'backgroundColor') || theme.palette.background.default;
17709
+ const searchBgColor = getSearchBGColor(bgColor, getListboxStyle);
17541
17710
  const searchColor = getSearchColor(getListboxStyle);
17542
17711
  const headerFontStyle = ((_themeOverrides$heade2 = themeOverrides.header) === null || _themeOverrides$heade2 === void 0 ? void 0 : _themeOverrides$heade2.fontStyle) || {};
17543
17712
  const contentFontStyle = ((_themeOverrides$conte = themeOverrides.content) === null || _themeOverrides$conte === void 0 ? void 0 : _themeOverrides$conte.fontStyle) || {};
@@ -17546,7 +17715,7 @@ function getStyles(_ref3) {
17546
17715
  const getWithFallback = (value, trueValue, falseValue) => value === true && trueValue || value === false && falseValue || undefined;
17547
17716
  return {
17548
17717
  background: {
17549
- backgroundColor: bgComponentColor || getListboxStyle('', 'backgroundColor') || theme.palette.background.default,
17718
+ backgroundColor: bgColor,
17550
17719
  backgroundImage: bgImage !== null && bgImage !== void 0 && bgImage.url && !(bgImage !== null && bgImage !== void 0 && bgImage.url.startsWith('url(')) ? "url('".concat(bgImage.url, "')") : undefined,
17551
17720
  backgroundRepeat: 'no-repeat',
17552
17721
  backgroundSize: bgImage === null || bgImage === void 0 ? void 0 : bgImage.size,
@@ -17687,9 +17856,11 @@ function ListBoxPopover(_ref) {
17687
17856
  anchorEl: alignTo.current,
17688
17857
  anchorOrigin: anchorOrigin,
17689
17858
  transformOrigin: transformOrigin,
17690
- PaperProps: {
17691
- style: {
17692
- minWidth: '250px'
17859
+ slotProps: {
17860
+ paper: {
17861
+ style: {
17862
+ minWidth: '250px'
17863
+ }
17693
17864
  }
17694
17865
  }
17695
17866
  }, /*#__PURE__*/React__default.createElement(Grid, {
@@ -17723,6 +17894,7 @@ function ListBoxPopover(_ref) {
17723
17894
  }), /*#__PURE__*/React__default.createElement(Grid, {
17724
17895
  item: true
17725
17896
  }, /*#__PURE__*/React__default.createElement(ActionsToolbar, {
17897
+ layout: layout,
17726
17898
  more: {
17727
17899
  enabled: !isLocked,
17728
17900
  actions: listboxSelectionToolbarItems,
@@ -18052,7 +18224,7 @@ function MultiState(_ref2) {
18052
18224
  variant: "contained",
18053
18225
  fullWidth: true
18054
18226
  }, clearAllStates)), field.states.map((s, ix) =>
18055
-
18227
+ /*#__PURE__*/
18056
18228
  // eslint-disable-next-line react/no-array-index-key
18057
18229
  React__default.createElement(ListItem, {
18058
18230
  key: ix,
@@ -18230,7 +18402,7 @@ function More(_ref2) {
18230
18402
  }, /*#__PURE__*/React__default.createElement(List, {
18231
18403
  dense: true
18232
18404
  }, items.map((s, ix) =>
18233
-
18405
+ /*#__PURE__*/
18234
18406
  // eslint-disable-next-line react/no-array-index-key
18235
18407
  React__default.createElement(ListItem, {
18236
18408
  key: ix,
@@ -18784,16 +18956,15 @@ class AutoSizer extends Component {
18784
18956
  onResize
18785
18957
  } = this.props;
18786
18958
  if (this._parentNode) {
18787
- var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
18788
18959
  // Guard against AutoSizer component being removed from the DOM immediately after being added.
18789
18960
  // This can result in invalid style values which can result in NaN values if we don't handle them.
18790
18961
  // See issue #150 for more context.
18791
18962
 
18792
18963
  const style = window.getComputedStyle(this._parentNode) || {};
18793
- const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
18794
- const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
18795
- const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
18796
- const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
18964
+ const paddingLeft = parseFloat(style.paddingLeft || "0");
18965
+ const paddingRight = parseFloat(style.paddingRight || "0");
18966
+ const paddingTop = parseFloat(style.paddingTop || "0");
18967
+ const paddingBottom = parseFloat(style.paddingBottom || "0");
18797
18968
  const rect = this._parentNode.getBoundingClientRect();
18798
18969
  const scaledHeight = rect.height - paddingTop - paddingBottom;
18799
18970
  const scaledWidth = rect.width - paddingLeft - paddingRight;
@@ -18922,16 +19093,6 @@ class AutoSizer extends Component {
18922
19093
  }
18923
19094
  }
18924
19095
 
18925
- const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
18926
- shapes: [{
18927
- type: 'path',
18928
- attrs: {
18929
- 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'
18930
- }
18931
- }]
18932
- });
18933
- var DrillDownIcon = (props => SvgIcon$1(drillDown(props)));
18934
-
18935
19096
  function removeInnnerTabStops(container) {
18936
19097
  container === null || container === void 0 || container.querySelectorAll('[tabIndex="0"]').forEach(elm => {
18937
19098
  elm.setAttribute('tabIndex', -1);
@@ -18985,14 +19146,17 @@ function useTempKeyboard(_ref) {
18985
19146
  const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
18986
19147
  const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
18987
19148
  const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
18988
- const elementToFocus = searchField || lastSelectedRow || firstRowElement || confirmButton;
19149
+ const unlockCoverButton = c === null || c === void 0 ? void 0 : c.querySelector('#listbox-unlock-button');
19150
+ const elementToFocus = searchField || lastSelectedRow || firstRowElement || unlockCoverButton || confirmButton;
18989
19151
  elementToFocus === null || elementToFocus === void 0 || elementToFocus.setAttribute('tabIndex', 0);
18990
19152
  elementToFocus === null || elementToFocus === void 0 || elementToFocus.focus();
18991
19153
  },
18992
19154
  focusSelection() {
19155
+ const unlockCoverButton = document.querySelector('#listbox-unlock-button');
18993
19156
  const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
18994
- confirmButton === null || confirmButton === void 0 || confirmButton.setAttribute('tabIndex', 0);
18995
- confirmButton === null || confirmButton === void 0 || confirmButton.focus();
19157
+ const btnToFocus = unlockCoverButton || confirmButton;
19158
+ btnToFocus === null || btnToFocus === void 0 || btnToFocus.setAttribute('tabIndex', 0);
19159
+ btnToFocus === null || btnToFocus === void 0 || btnToFocus.focus();
18996
19160
  }
18997
19161
  };
18998
19162
  return keyboard;
@@ -19148,18 +19312,79 @@ function getListboxContainerKeyboardNavigation(_ref) {
19148
19312
  };
19149
19313
  }
19150
19314
 
19315
+ const StyledDiv = styled('div')(() => ({
19316
+ display: 'flex',
19317
+ width: '100%',
19318
+ height: '100%',
19319
+ alignItems: 'center',
19320
+ justifyContent: 'center'
19321
+ }));
19322
+ function ListBoxError(_ref) {
19323
+ let {
19324
+ text
19325
+ } = _ref;
19326
+ const {
19327
+ translator: translatorDynamic
19328
+ } = useContext(InstanceContext);
19329
+ return /*#__PURE__*/React__default.createElement(StyledDiv, null, translatorDynamic.get(text));
19330
+ }
19331
+
19332
+ function isDirectQueryEnabled(_ref) {
19333
+ let {
19334
+ appLayout
19335
+ } = _ref;
19336
+ const isDQ = !!(appLayout !== null && appLayout !== void 0 && appLayout.qIsDirectQueryMode);
19337
+ return isDQ;
19338
+ }
19339
+
19340
+ function getContainerPadding(_ref) {
19341
+ let {
19342
+ isGridMode,
19343
+ dense,
19344
+ height,
19345
+ layoutOrder
19346
+ } = _ref;
19347
+ let containerPadding;
19348
+ if (isGridMode) {
19349
+ const itemHeight = getItemHeight({
19350
+ isGridMode,
19351
+ dense
19352
+ });
19353
+ let paddingY;
19354
+ if (itemHeight > height) {
19355
+ paddingY = '0px';
19356
+ } else {
19357
+ paddingY = '2px';
19358
+ }
19359
+ containerPadding = layoutOrder === 'row' ? "".concat(paddingY, " 4px") : "".concat(paddingY, " 6px ").concat(paddingY, " 4px");
19360
+ } else {
19361
+ containerPadding = undefined;
19362
+ }
19363
+ return containerPadding;
19364
+ }
19365
+
19366
+ const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
19367
+ shapes: [{
19368
+ type: 'path',
19369
+ attrs: {
19370
+ 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'
19371
+ }
19372
+ }]
19373
+ });
19374
+ var DrillDownIcon = (props => SvgIcon$1(drillDown(props)));
19375
+
19151
19376
  function showToolbarDetached(_ref) {
19152
19377
  var _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
19153
19378
  let {
19154
19379
  containerRect,
19155
19380
  titleRef,
19156
19381
  iconsWidth,
19157
- headerPaddingLeft,
19158
- headerPaddingRight
19382
+ paddingLeft,
19383
+ paddingRight
19159
19384
  } = _ref;
19160
19385
  const containerWidth = containerRect.width;
19161
19386
  const preventTruncation = 2;
19162
- const padding = headerPaddingLeft + headerPaddingRight;
19387
+ const padding = paddingLeft + paddingRight;
19163
19388
  const contentWidth = ((_titleRef$current$cli = titleRef === null || titleRef === void 0 || (_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.clientWidth) !== null && _titleRef$current$cli !== void 0 ? _titleRef$current$cli : 0) + iconsWidth + padding + preventTruncation;
19164
19389
  const actionToolbarWidth = 128;
19165
19390
  const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
@@ -19175,15 +19400,18 @@ function getListboxActionProps(_ref) {
19175
19400
  containerRef,
19176
19401
  isLocked,
19177
19402
  listboxSelectionToolbarItems,
19403
+ extraItems,
19178
19404
  selections,
19179
19405
  keyboard
19180
19406
  } = _ref;
19181
19407
  return {
19408
+ isDetached,
19182
19409
  show: showToolbar && !isDetached,
19183
19410
  popover: {
19184
19411
  show: showToolbar && isDetached,
19185
19412
  anchorEl: containerRef.current
19186
19413
  },
19414
+ extraItems,
19187
19415
  more: {
19188
19416
  enabled: !isLocked,
19189
19417
  actions: listboxSelectionToolbarItems,
@@ -19208,55 +19436,293 @@ function getListboxActionProps(_ref) {
19208
19436
  };
19209
19437
  }
19210
19438
 
19211
- const StyledDiv = styled('div')(() => ({
19212
- display: 'flex',
19213
- width: '100%',
19214
- height: '100%',
19215
- alignItems: 'center',
19216
- justifyContent: 'center'
19217
- }));
19218
- function ListBoxError(_ref) {
19439
+ const iconStyle = {
19440
+ fontSize: '12px'
19441
+ };
19442
+ const UnlockButton = styled(ButtonBase)(_ref => {
19219
19443
  let {
19220
- text
19444
+ theme,
19445
+ isLoading
19221
19446
  } = _ref;
19222
- const {
19223
- translator: translatorDynamic
19224
- } = useContext(InstanceContext);
19225
- return /*#__PURE__*/React__default.createElement(StyledDiv, null, translatorDynamic.get(text));
19226
- }
19227
-
19228
- function isDirectQueryEnabled(_ref) {
19447
+ return {
19448
+ position: 'absolute',
19449
+ top: 0,
19450
+ left: 0,
19451
+ height: 48,
19452
+ zIndex: 2,
19453
+ // so it goes on top of action buttons
19454
+ background: theme.palette.custom.disabledBackground,
19455
+ opacity: 1,
19456
+ color: theme.palette.custom.disabledContrastText,
19457
+ width: '100%',
19458
+ display: 'flex',
19459
+ justifyContent: isLoading ? 'center' : 'flex-start',
19460
+ paddingLeft: 16,
19461
+ paddingRight: 16,
19462
+ borderRadius: 0,
19463
+ '& *, & p': {
19464
+ color: theme.palette.custom.disabledContrastText
19465
+ },
19466
+ '& i': {
19467
+ padding: "".concat(ICON_PADDING, "px")
19468
+ }
19469
+ };
19470
+ });
19471
+ const StyledGridHeader = styled(Grid, {
19472
+ shouldForwardProp: p => !['styles', 'isRtl'].includes(p)
19473
+ })(_ref2 => {
19229
19474
  let {
19230
- appLayout
19231
- } = _ref;
19232
- const isDQ = !!(appLayout !== null && appLayout !== void 0 && appLayout.qIsDirectQueryMode);
19233
- return isDQ;
19475
+ styles,
19476
+ isRtl
19477
+ } = _ref2;
19478
+ return _objectSpread2(_objectSpread2({
19479
+ flexDirection: isRtl ? 'row-reverse' : 'row',
19480
+ wrap: 'nowrap',
19481
+ minHeight: 32,
19482
+ alignContent: 'center'
19483
+ }, styles.header), {}, {
19484
+ '& *': {
19485
+ color: styles.header.color
19486
+ }
19487
+ });
19488
+ });
19489
+ const HeaderTitle = styled(Typography)(_ref3 => {
19490
+ let {
19491
+ styles
19492
+ } = _ref3;
19493
+ return _objectSpread2(_objectSpread2({}, styles.header), {}, {
19494
+ display: 'block',
19495
+ // needed for text-overflow to work
19496
+ alignItems: 'center',
19497
+ paddingRight: '1px' // make place for italic font style
19498
+ });
19499
+ });
19500
+ function UnlockCoverButton(_ref4) {
19501
+ let {
19502
+ translator,
19503
+ toggleLock,
19504
+ keyboard,
19505
+ isLoading
19506
+ } = _ref4;
19507
+ const fontSize = '14px';
19508
+ const unLockText = translator.get('SelectionToolbar.ClickToUnlock');
19509
+ const component = /*#__PURE__*/React__default.createElement(UnlockButton, {
19510
+ title: unLockText,
19511
+ tabIndex: keyboard.enabled ? 0 : -1,
19512
+ onClick: toggleLock,
19513
+ "data-testid": "listbox-unlock-button",
19514
+ id: "listbox-unlock-button",
19515
+ isLoading: isLoading
19516
+ }, isLoading ? /*#__PURE__*/React__default.createElement(CircularProgress, {
19517
+ size: 16,
19518
+ variant: "indeterminate",
19519
+ color: "primary"
19520
+ }) : /*#__PURE__*/React__default.createElement(Lock, {
19521
+ disableRipple: true,
19522
+ style: iconStyle
19523
+ }), !isLoading && /*#__PURE__*/React__default.createElement(Typography, {
19524
+ fontSize: fontSize
19525
+ }, unLockText));
19526
+ return component;
19234
19527
  }
19235
19528
 
19236
- function getContainerPadding(_ref) {
19529
+ // ms that needs to pass before the lock button can be toggled again
19530
+ const lockTimeFrameMs = 500;
19531
+ let lastTime = 0;
19532
+ function getToggleLock(_ref) {
19237
19533
  let {
19238
- isGridMode,
19239
- dense,
19240
- height,
19241
- layoutOrder
19534
+ isLocked,
19535
+ setLocked,
19536
+ settingLockedState,
19537
+ model,
19538
+ setSettingLockedState
19242
19539
  } = _ref;
19243
- let containerPadding;
19244
- if (isGridMode) {
19245
- const itemHeight = getItemHeight({
19246
- isGridMode,
19247
- dense
19540
+ return () => {
19541
+ const now = new Date();
19542
+ const curTime = now - lastTime;
19543
+ if (curTime < lockTimeFrameMs) {
19544
+ return Promise.resolve();
19545
+ }
19546
+ if (settingLockedState) {
19547
+ return () => {};
19548
+ }
19549
+ setSettingLockedState(true);
19550
+ lastTime = now;
19551
+ const func = isLocked ? model.unlock : model.lock;
19552
+ setLocked(!isLocked);
19553
+ return func.call(model, '/qListObjectDef').catch(() => {
19554
+ setLocked(isLocked); // revert to the layout value
19555
+ }).finally(() => {
19556
+ setTimeout(() => {
19557
+ setSettingLockedState(false);
19558
+ }, 0);
19248
19559
  });
19249
- let paddingY;
19250
- if (itemHeight > height) {
19251
- paddingY = '0px';
19252
- } else {
19253
- paddingY = '2px';
19560
+ };
19561
+ }
19562
+ function ListBoxHeader(_ref2) {
19563
+ var _layout$qListObject, _layout$qListObject3;
19564
+ let {
19565
+ layout,
19566
+ translator,
19567
+ styles,
19568
+ isRtl,
19569
+ showLock,
19570
+ selectDisabled,
19571
+ showSearchIcon,
19572
+ isDrillDown,
19573
+ constraints,
19574
+ onShowSearch,
19575
+ classes,
19576
+ containerRect,
19577
+ isPopover,
19578
+ showToolbar,
19579
+ showDetachedToolbarOnly,
19580
+ containerRef,
19581
+ model,
19582
+ selectionState,
19583
+ isDirectQuery,
19584
+ selections,
19585
+ keyboard,
19586
+ autoConfirm
19587
+ } = _ref2;
19588
+ const [isToolbarDetached, setIsToolbarDetached] = useState$1(showDetachedToolbarOnly);
19589
+ const [isLocked, setLocked] = useState$1(layout === null || layout === void 0 || (_layout$qListObject = layout.qListObject) === null || _layout$qListObject === void 0 || (_layout$qListObject = _layout$qListObject.qDimensionInfo) === null || _layout$qListObject === void 0 ? void 0 : _layout$qListObject.qLocked);
19590
+ const [settingLockedState, setSettingLockedState] = useState$1(false);
19591
+ useEffect$1(() => {
19592
+ var _layout$qListObject2;
19593
+ setLocked(layout === null || layout === void 0 || (_layout$qListObject2 = layout.qListObject) === null || _layout$qListObject2 === void 0 || (_layout$qListObject2 = _layout$qListObject2.qDimensionInfo) === null || _layout$qListObject2 === void 0 ? void 0 : _layout$qListObject2.qLocked);
19594
+ }, [layout === null || layout === void 0 || (_layout$qListObject3 = layout.qListObject) === null || _layout$qListObject3 === void 0 || (_layout$qListObject3 = _layout$qListObject3.qDimensionInfo) === null || _layout$qListObject3 === void 0 ? void 0 : _layout$qListObject3.qLocked]);
19595
+ const titleRef = useRef(null);
19596
+ const showUnlock = showLock && isLocked;
19597
+ const showLockIcon = !showLock && isLocked; // shows instead of the cover button when field/dim is locked.
19598
+ const showLeftIcon = showSearchIcon || showLockIcon || isDrillDown; // the left-most icon outside of the actions/selections toolbar.
19599
+
19600
+ const paddingLeft = CELL_PADDING_LEFT - (showLeftIcon ? ICON_PADDING : 0);
19601
+ const paddingRight = isRtl ? CELL_PADDING_LEFT - (showLeftIcon ? ICON_PADDING : 0) : HEADER_PADDING_RIGHT;
19602
+
19603
+ // Calculate explicit width for icons container. Search and lock cannot exist combined.
19604
+ const iconsWidth = (showSearchIcon ? BUTTON_ICON_WIDTH : 0) + (showLockIcon ? BUTTON_ICON_WIDTH : 0) + (isDrillDown ? BUTTON_ICON_WIDTH : 0);
19605
+ const toggleLock = getToggleLock({
19606
+ isLocked,
19607
+ setLocked,
19608
+ settingLockedState,
19609
+ setSettingLockedState,
19610
+ model
19611
+ });
19612
+ const listboxSelectionToolbarItems = createListboxSelectionToolbar({
19613
+ layout,
19614
+ model,
19615
+ translator,
19616
+ selectionState,
19617
+ isDirectQuery
19618
+ });
19619
+ const extraItems = isLocked || !showLock ? undefined : [{
19620
+ key: 'lock',
19621
+ type: undefined,
19622
+ label: translator.get('SelectionToolbar.ClickToLock'),
19623
+ getSvgIconShape: unlock,
19624
+ enabled: () => !settingLockedState && !selectDisabled() && hasSelections(layout),
19625
+ action: toggleLock
19626
+ }];
19627
+ const searchIconComp = constraints !== null && constraints !== void 0 && constraints.active ? /*#__PURE__*/React__default.createElement(SearchIcon, {
19628
+ title: translator.get('Listbox.Search'),
19629
+ size: "large",
19630
+ style: _objectSpread2(_objectSpread2({}, iconStyle), {}, {
19631
+ padding: "".concat(ICON_PADDING, "px")
19632
+ })
19633
+ }) : /*#__PURE__*/React__default.createElement(IconButton, {
19634
+ onClick: onShowSearch,
19635
+ tabIndex: -1,
19636
+ title: translator.get('Listbox.Search'),
19637
+ size: "large",
19638
+ disableRipple: true,
19639
+ "data-testid": "search-toggle-btn"
19640
+ }, /*#__PURE__*/React__default.createElement(SearchIcon, {
19641
+ style: iconStyle
19642
+ }));
19643
+ useEffect$1(() => {
19644
+ if (!titleRef.current || !containerRect) {
19645
+ return;
19254
19646
  }
19255
- containerPadding = layoutOrder === 'row' ? "".concat(paddingY, " 4px") : "".concat(paddingY, " 6px ").concat(paddingY, " 4px");
19256
- } else {
19257
- containerPadding = undefined;
19647
+ const mustShowDetached = showToolbarDetached({
19648
+ containerRect,
19649
+ titleRef,
19650
+ iconsWidth,
19651
+ paddingLeft,
19652
+ paddingRight
19653
+ });
19654
+ const isDetached = showDetachedToolbarOnly || mustShowDetached;
19655
+ setIsToolbarDetached(isDetached);
19656
+ }, [iconsWidth, paddingLeft, paddingRight, titleRef.current, showDetachedToolbarOnly, Object.entries(containerRect || {}).sort().join(',')]);
19657
+ const toolbarProps = getListboxActionProps({
19658
+ isDetached: isPopover ? false : isToolbarDetached,
19659
+ showToolbar,
19660
+ containerRef,
19661
+ isLocked,
19662
+ extraItems,
19663
+ listboxSelectionToolbarItems,
19664
+ selections,
19665
+ keyboard,
19666
+ autoConfirm
19667
+ });
19668
+ const actionsToolbar = /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$5({
19669
+ isRtl: isRtl,
19670
+ layout: layout
19671
+ }, toolbarProps));
19672
+ if (showDetachedToolbarOnly) {
19673
+ return actionsToolbar;
19258
19674
  }
19259
- return containerPadding;
19675
+
19676
+ // Always show a lock symbol when locked and showLock is false
19677
+ const lockedIconComp = showLockIcon ? /*#__PURE__*/React__default.createElement(Lock, {
19678
+ size: "large",
19679
+ style: _objectSpread2(_objectSpread2({}, iconStyle), {}, {
19680
+ padding: "".concat(ICON_PADDING, "px")
19681
+ })
19682
+ }) : undefined;
19683
+ return /*#__PURE__*/React__default.createElement(StyledGridHeader, {
19684
+ item: true,
19685
+ container: true,
19686
+ styles: styles,
19687
+ isRtl: isRtl,
19688
+ marginY: 1,
19689
+ paddingLeft: "".concat(paddingLeft, "px"),
19690
+ paddingRight: "".concat(paddingRight, "px"),
19691
+ className: "header-container"
19692
+ }, showUnlock && /*#__PURE__*/React__default.createElement(UnlockCoverButton, {
19693
+ isLoading: settingLockedState,
19694
+ translator: translator,
19695
+ toggleLock: toggleLock,
19696
+ keyboard: keyboard
19697
+ }), showLeftIcon && /*#__PURE__*/React__default.createElement(Grid, {
19698
+ item: true,
19699
+ container: true,
19700
+ alignItems: "center",
19701
+ width: iconsWidth,
19702
+ className: "header-action-container"
19703
+ }, lockedIconComp || showSearchIcon && searchIconComp, isDrillDown && /*#__PURE__*/React__default.createElement(DrillDownIcon, {
19704
+ tabIndex: -1,
19705
+ title: translator.get('Listbox.DrillDown'),
19706
+ style: _objectSpread2(_objectSpread2({}, iconStyle), {}, {
19707
+ padding: "".concat(ICON_PADDING, "px")
19708
+ })
19709
+ })), /*#__PURE__*/React__default.createElement(Grid, {
19710
+ item: true,
19711
+ xs: true,
19712
+ minWidth: 0 // needed to text-overflow see: https://css-tricks.com/flexbox-truncated-text/
19713
+ ,
19714
+ justifyContent: isRtl ? 'flex-end' : 'flex-start',
19715
+ className: classes.listBoxHeader
19716
+ }, /*#__PURE__*/React__default.createElement(HeaderTitle, {
19717
+ variant: "h6",
19718
+ noWrap: true,
19719
+ ref: titleRef,
19720
+ title: layout.title,
19721
+ styles: styles
19722
+ }, layout.title)), /*#__PURE__*/React__default.createElement(Grid, {
19723
+ item: true,
19724
+ display: "flex"
19725
+ }, actionsToolbar));
19260
19726
  }
19261
19727
 
19262
19728
  const PREFIX$4 = 'ListBoxInline';
@@ -19300,47 +19766,20 @@ const StyledGrid$3 = styled(Grid, {
19300
19766
  }
19301
19767
  });
19302
19768
  });
19303
- const StyledGridHeader = styled(Grid, {
19304
- shouldForwardProp: p => !['styles', 'isRtl'].includes(p)
19305
- })(_ref2 => {
19306
- let {
19307
- styles,
19308
- isRtl
19309
- } = _ref2;
19310
- return _objectSpread2(_objectSpread2({
19311
- flexDirection: isRtl ? 'row-reverse' : 'row',
19312
- wrap: 'nowrap',
19313
- minHeight: 32,
19314
- alignContent: 'center'
19315
- }, styles.header), {}, {
19316
- '& *': {
19317
- // Assign the styles color as defaul color for all elements in the header
19318
- color: styles.header.color
19319
- }
19320
- });
19321
- });
19322
- const Title = styled(Typography)(_ref3 => {
19323
- let {
19324
- styles
19325
- } = _ref3;
19326
- return _objectSpread2(_objectSpread2({}, styles.header), {}, {
19327
- paddingRight: '1px' // make place for italic font style
19328
- });
19329
- });
19330
- const isModal = _ref4 => {
19769
+ const isModal = _ref2 => {
19331
19770
  var _app$isInModalSelecti, _app$isInModalSelecti2;
19332
19771
  let {
19333
19772
  app,
19334
19773
  appSelections
19335
- } = _ref4;
19774
+ } = _ref2;
19336
19775
  return (_app$isInModalSelecti = (_app$isInModalSelecti2 = app.isInModalSelection) === null || _app$isInModalSelecti2 === void 0 ? void 0 : _app$isInModalSelecti2.call(app)) !== null && _app$isInModalSelecti !== void 0 ? _app$isInModalSelecti : appSelections.isInModal();
19337
19776
  };
19338
- function ListBoxInline(_ref5) {
19339
- var _layout$qListObject, _layout$qListObject2, _layoutOptions$dense, _containerRef$current;
19777
+ function ListBoxInline(_ref3) {
19778
+ var _layout$qListObject, _layout$qListObject2, _layout$title, _layoutOptions$dense, _containerRef$current;
19340
19779
  let {
19341
19780
  options,
19342
19781
  layout
19343
- } = _ref5;
19782
+ } = _ref3;
19344
19783
  const {
19345
19784
  app,
19346
19785
  direction,
@@ -19361,6 +19800,7 @@ function ListBoxInline(_ref5) {
19361
19800
  renderedCallback,
19362
19801
  toolbar = true,
19363
19802
  isPopover = false,
19803
+ showLock = false,
19364
19804
  components
19365
19805
  } = options;
19366
19806
 
@@ -19376,9 +19816,6 @@ function ListBoxInline(_ref5) {
19376
19816
  return [ref, setRef];
19377
19817
  };
19378
19818
  const theme = useTheme$1();
19379
- const unlock = useCallback(() => {
19380
- model.unlock('/qListObjectDef');
19381
- }, [model]);
19382
19819
  const {
19383
19820
  translator,
19384
19821
  keyboardNavigation,
@@ -19415,7 +19852,6 @@ function ListBoxInline(_ref5) {
19415
19852
  stop: 0
19416
19853
  });
19417
19854
  const [appSelections] = useAppSelections(app);
19418
- const titleRef = useRef(null);
19419
19855
  const [selectionState$1] = useState$1(() => selectionState());
19420
19856
  const keyboard = useTempKeyboard({
19421
19857
  containerRef,
@@ -19427,7 +19863,6 @@ function ListBoxInline(_ref5) {
19427
19863
  }), [app, appSelections]);
19428
19864
  const isInvalid = layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo.qError;
19429
19865
  const errorText = isInvalid && constraints.active ? 'Visualization.Invalid.Dimension' : 'Visualization.Incomplete';
19430
- const [isToolbarDetached, setIsToolbarDetached] = useState$1(false);
19431
19866
  const {
19432
19867
  handleKeyDown,
19433
19868
  handleOnMouseEnter,
@@ -19444,8 +19879,6 @@ function ListBoxInline(_ref5) {
19444
19879
  constraints,
19445
19880
  isModal: isModalMode
19446
19881
  }), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
19447
- const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false) && !isPopover;
19448
- const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false || isPopover;
19449
19882
  useEffect$1(() => {
19450
19883
  document.addEventListener('keydown', globalKeyDown);
19451
19884
  return () => {
@@ -19453,6 +19886,9 @@ function ListBoxInline(_ref5) {
19453
19886
  };
19454
19887
  }, [globalKeyDown]);
19455
19888
  useEffect$1(() => {
19889
+ if (search === true) {
19890
+ setShowSearch(true);
19891
+ }
19456
19892
  const show = () => {
19457
19893
  setShowToolbar(true);
19458
19894
  };
@@ -19463,6 +19899,7 @@ function ListBoxInline(_ref5) {
19463
19899
  }
19464
19900
  };
19465
19901
  if (isPopover) {
19902
+ // When isPopover, toolbar == false will be ignored.
19466
19903
  if (!selections.isActive()) {
19467
19904
  selections.begin('/qListObjectDef');
19468
19905
  selections.on('activated', show);
@@ -19470,7 +19907,7 @@ function ListBoxInline(_ref5) {
19470
19907
  }
19471
19908
  setShowToolbar(isPopover);
19472
19909
  }
19473
- if (selections) {
19910
+ if (toolbar && selections) {
19474
19911
  if (!selections.isModal()) {
19475
19912
  selections.on('activated', show);
19476
19913
  selections.on('deactivated', hide);
@@ -19483,7 +19920,7 @@ function ListBoxInline(_ref5) {
19483
19920
  selections.removeListener('deactivated', hide);
19484
19921
  }
19485
19922
  };
19486
- }, [selections, isPopover]);
19923
+ }, [toolbar, selections, isPopover]);
19487
19924
  useEffect$1(() => {
19488
19925
  if (!searchContainer || !searchContainer.current) {
19489
19926
  return;
@@ -19500,64 +19937,31 @@ function ListBoxInline(_ref5) {
19500
19937
  autoConfirm = false,
19501
19938
  layoutOptions = {}
19502
19939
  } = layout !== null && layout !== void 0 ? layout : {};
19503
- const showSearchIcon = searchEnabled !== false && search === 'toggle';
19504
- const isLocked = (layout === null || layout === void 0 || (_layout$qListObject = layout.qListObject) === null || _layout$qListObject === void 0 || (_layout$qListObject = _layout$qListObject.qDimensionInfo) === null || _layout$qListObject === void 0 ? void 0 : _layout$qListObject.qLocked) === true;
19505
- const showSearchOrLockIcon = isLocked || showSearchIcon;
19940
+ const isLocked = layout === null || layout === void 0 || (_layout$qListObject = layout.qListObject) === null || _layout$qListObject === void 0 || (_layout$qListObject = _layout$qListObject.qDimensionInfo) === null || _layout$qListObject === void 0 ? void 0 : _layout$qListObject.qLocked;
19941
+ const showSearchIcon = searchEnabled !== false && search === 'toggle' && !isLocked;
19506
19942
  const isDrillDown = (layout === null || layout === void 0 || (_layout$qListObject2 = layout.qListObject) === null || _layout$qListObject2 === void 0 || (_layout$qListObject2 = _layout$qListObject2.qDimensionInfo) === null || _layout$qListObject2 === void 0 ? void 0 : _layout$qListObject2.qGrouping) === 'H';
19507
- const showIcons = showSearchOrLockIcon || isDrillDown;
19508
- const iconsWidth = (showSearchOrLockIcon ? BUTTON_ICON_WIDTH : 0) + (isDrillDown ? ICON_WIDTH + ICON_PADDING : 0); // Drill-down icon needs padding right so there is space between the icon and the title
19943
+ const canShowTitle = (layout === null || layout === void 0 || (_layout$title = layout.title) === null || _layout$title === void 0 ? void 0 : _layout$title.length) && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false;
19944
+ const showDetachedToolbarOnly = toolbar && !canShowTitle && !isPopover;
19945
+ const showAttachedToolbar = toolbar && canShowTitle || isPopover;
19509
19946
  const isRtl = direction === 'rtl';
19510
- const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
19511
- const headerPaddingRight = isRtl ? CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0) : HEADER_PADDING_RIGHT;
19512
- useEffect$1(() => {
19513
- if (!titleRef.current || !containerRect) {
19514
- return;
19515
- }
19516
- const isDetached = showToolbarDetached({
19517
- containerRect,
19518
- titleRef,
19519
- iconsWidth,
19520
- headerPaddingLeft,
19521
- headerPaddingRight
19522
- });
19523
- setIsToolbarDetached(isDetached);
19524
- }, [titleRef.current, containerRect]);
19525
19947
  if (!model || !layout || !translator) {
19526
19948
  return null;
19527
19949
  }
19528
- const listboxSelectionToolbarItems = createListboxSelectionToolbar({
19529
- layout,
19530
- model,
19531
- translator,
19532
- selectionState: selectionState$1,
19533
- isDirectQuery
19534
- });
19535
19950
  const showSearchToggle = search === 'toggle' && showSearch;
19536
- const searchVisible = (search === true || showSearchToggle) && !selectDisabled() && searchEnabled !== false;
19951
+ const searchVisible = search === true || showSearchToggle && !selectDisabled() && searchEnabled !== false;
19537
19952
  const dense = (_layoutOptions$dense = layoutOptions.dense) !== null && _layoutOptions$dense !== void 0 ? _layoutOptions$dense : false;
19538
- const onShowSearch = () => {
19953
+ const handleShowSearch = () => {
19539
19954
  const newValue = !showSearch;
19540
19955
  setShowSearch(newValue);
19541
19956
  };
19542
19957
  const onCtrlF = () => {
19543
19958
  if (search === 'toggle') {
19544
- onShowSearch();
19959
+ handleShowSearch();
19545
19960
  } else {
19546
19961
  const input = searchContainer.current.querySelector('input');
19547
19962
  input === null || input === void 0 || input.focus();
19548
19963
  }
19549
19964
  };
19550
- const getActionToolbarProps = isDetached => _objectSpread2(_objectSpread2({}, getListboxActionProps({
19551
- isDetached: isPopover ? false : isDetached,
19552
- showToolbar,
19553
- containerRef,
19554
- isLocked,
19555
- listboxSelectionToolbarItems,
19556
- selections,
19557
- keyboard
19558
- })), {}, {
19559
- autoConfirm
19560
- });
19561
19965
  const shouldAutoFocus = searchVisible && search === 'toggle';
19562
19966
 
19563
19967
  // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
@@ -19568,49 +19972,35 @@ function ListBoxInline(_ref5) {
19568
19972
  height: (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.clientHeight,
19569
19973
  layoutOrder: layoutOptions.layoutOrder
19570
19974
  });
19571
- const searchIconComp = constraints !== null && constraints !== void 0 && constraints.active ? /*#__PURE__*/React__default.createElement(SearchIcon, {
19572
- title: translator.get('Listbox.Search'),
19573
- size: "large",
19574
- style: {
19575
- fontSize: '12px',
19576
- padding: '7px'
19577
- }
19578
- }) : /*#__PURE__*/React__default.createElement(IconButton, {
19579
- onClick: onShowSearch,
19580
- tabIndex: -1,
19581
- title: translator.get('Listbox.Search'),
19582
- size: "large",
19583
- disableRipple: true,
19584
- "data-testid": "search-toggle-btn"
19585
- }, /*#__PURE__*/React__default.createElement(SearchIcon, {
19586
- style: {
19587
- fontSize: '12px'
19588
- }
19589
- }));
19590
- const lockIconComp = selectDisabled() ? /*#__PURE__*/React__default.createElement(Lock, {
19591
- size: "large",
19592
- style: {
19593
- fontSize: '12px',
19594
- padding: '7px'
19595
- }
19596
- }) : /*#__PURE__*/React__default.createElement(IconButton, {
19597
- title: translator.get('SelectionToolbar.ClickToUnlock'),
19598
- tabIndex: -1,
19599
- onClick: unlock,
19600
- size: "large"
19601
- }, /*#__PURE__*/React__default.createElement(Lock, {
19602
- disableRipple: true,
19603
- style: {
19604
- fontSize: '12px'
19605
- }
19606
- }));
19607
19975
  if (isInvalid) {
19608
19976
  renderedCallback === null || renderedCallback === void 0 || renderedCallback();
19609
19977
  }
19610
- const listBoxMinHeight = showToolbarWithTitle ? DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH : 0;
19611
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showDetachedToolbarOnly && /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$5({
19612
- direction: direction
19613
- }, getActionToolbarProps(true))), /*#__PURE__*/React__default.createElement(StyledGrid$3, {
19978
+ const listBoxMinHeight = showAttachedToolbar ? DENSE_ROW_HEIGHT + SCROLL_BAR_WIDTH : 0;
19979
+ const listBoxHeader = /*#__PURE__*/React__default.createElement(ListBoxHeader, {
19980
+ selectDisabled: selectDisabled,
19981
+ showSearchIcon: showSearchIcon,
19982
+ isDrillDown: isDrillDown,
19983
+ onShowSearch: handleShowSearch,
19984
+ isPopover: isPopover,
19985
+ showToolbar: showToolbar,
19986
+ isDirectQuery: isDirectQuery,
19987
+ autoConfirm: autoConfirm,
19988
+ showDetachedToolbarOnly: showDetachedToolbarOnly,
19989
+ layout: layout,
19990
+ translator: translator,
19991
+ styles: styles,
19992
+ isRtl: isRtl,
19993
+ showLock: showLock,
19994
+ constraints: constraints,
19995
+ classes: classes$4,
19996
+ containerRect: containerRect,
19997
+ containerRef: containerRef,
19998
+ model: model,
19999
+ selectionState: selectionState$1,
20000
+ selections: selections,
20001
+ keyboard: keyboard
20002
+ });
20003
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showDetachedToolbarOnly && listBoxHeader, /*#__PURE__*/React__default.createElement(StyledGrid$3, {
19614
20004
  className: "listbox-container",
19615
20005
  container: true,
19616
20006
  tabIndex: keyboard.enabled ? -1 : undefined,
@@ -19631,45 +20021,7 @@ function ListBoxInline(_ref5) {
19631
20021
  },
19632
20022
  isGridMode: isGridMode,
19633
20023
  "aria-label": keyboard.active ? translator.get('Listbox.ScreenReaderInstructions') : ''
19634
- }, showToolbarWithTitle && /*#__PURE__*/React__default.createElement(StyledGridHeader, {
19635
- item: true,
19636
- container: true,
19637
- styles: styles,
19638
- isRtl: isRtl,
19639
- marginY: 1,
19640
- paddingLeft: "".concat(headerPaddingLeft, "px"),
19641
- paddingRight: "".concat(headerPaddingRight, "px")
19642
- }, showIcons && /*#__PURE__*/React__default.createElement(Grid, {
19643
- item: true,
19644
- container: true,
19645
- alignItems: "center",
19646
- width: iconsWidth
19647
- }, isLocked ? lockIconComp : showSearchIcon && searchIconComp, isDrillDown && /*#__PURE__*/React__default.createElement(DrillDownIcon, {
19648
- tabIndex: -1,
19649
- title: translator.get('Listbox.DrillDown'),
19650
- size: "large",
19651
- style: {
19652
- fontSize: '12px'
19653
- }
19654
- })), /*#__PURE__*/React__default.createElement(Grid, {
19655
- item: true,
19656
- xs: true,
19657
- minWidth: 0 // needed to text-overflow see: https://css-tricks.com/flexbox-truncated-text/
19658
- ,
19659
- justifyContent: isRtl ? 'flex-end' : 'flex-start',
19660
- className: classes$4.listBoxHeader
19661
- }, /*#__PURE__*/React__default.createElement(Title, {
19662
- variant: "h6",
19663
- noWrap: true,
19664
- ref: titleRef,
19665
- title: layout.title,
19666
- styles: styles
19667
- }, layout.title)), /*#__PURE__*/React__default.createElement(Grid, {
19668
- item: true,
19669
- display: "flex"
19670
- }, /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$5({
19671
- direction: direction
19672
- }, getActionToolbarProps(isToolbarDetached))))), /*#__PURE__*/React__default.createElement(Grid, {
20024
+ }, showAttachedToolbar && listBoxHeader, /*#__PURE__*/React__default.createElement(Grid, {
19673
20025
  item: true,
19674
20026
  container: true,
19675
20027
  direction: "column",
@@ -19692,7 +20044,7 @@ function ListBoxInline(_ref5) {
19692
20044
  wildCardSearch: wildCardSearch,
19693
20045
  searchEnabled: searchEnabled,
19694
20046
  direction: direction,
19695
- hide: showSearchIcon && onShowSearch,
20047
+ hide: showSearchIcon && handleShowSearch,
19696
20048
  styles: styles
19697
20049
  })), /*#__PURE__*/React__default.createElement(Grid, {
19698
20050
  item: true,
@@ -19700,11 +20052,11 @@ function ListBoxInline(_ref5) {
19700
20052
  className: classes$4.listboxWrapper
19701
20053
  }, isInvalid ? /*#__PURE__*/React__default.createElement(ListBoxError, {
19702
20054
  text: errorText
19703
- }) : /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref6 => {
20055
+ }) : /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
19704
20056
  let {
19705
20057
  height,
19706
20058
  width
19707
- } = _ref6;
20059
+ } = _ref4;
19708
20060
  return /*#__PURE__*/React__default.createElement(ListBox, {
19709
20061
  model: model,
19710
20062
  app: app,
@@ -19746,10 +20098,10 @@ function ListBoxInline(_ref5) {
19746
20098
  })))));
19747
20099
  }
19748
20100
  const ListBoxInlineMemoed = React__default.memo(ListBoxInline);
19749
- function IsolateUseLayoutWrapper(_ref7) {
20101
+ function IsolateUseLayoutWrapper(_ref5) {
19750
20102
  let {
19751
20103
  options = {}
19752
- } = _ref7;
20104
+ } = _ref5;
19753
20105
  const {
19754
20106
  model
19755
20107
  } = options;
@@ -19778,24 +20130,26 @@ function useExistingModel(_ref) {
19778
20130
  throw new Error("Option \"".concat(usedForbiddenOptions.join(', '), "\" is not applicable for existing objects."));
19779
20131
  }
19780
20132
  useEffect$1(() => {
19781
- async function fetchObject() {
19782
- const modelFromStore = modelStore.get(qId);
19783
- if (modelFromStore) {
19784
- setModel(modelFromStore);
19785
- } else {
19786
- const m = await app.getObject(qId);
19787
- modelStore.set(m.id, m);
19788
- m.once('closed', () => {
19789
- modelStore.clear(m.id);
19790
- });
19791
- setModel(m);
20133
+ function storeModel(m) {
20134
+ if (modelStore.get(m.id)) {
20135
+ return;
19792
20136
  }
20137
+ // Nebula gets the model from this store in some of its
20138
+ // core functions, so it must always be stored here.
20139
+ modelStore.set(m.id, m);
20140
+ m.once('closed', () => {
20141
+ modelStore.clear(m.id);
20142
+ });
19793
20143
  }
19794
- if (sessionModel) {
19795
- setModel(sessionModel);
19796
- } else {
19797
- fetchObject();
20144
+ async function fetchObject(modelId) {
20145
+ const m = modelStore.get(modelId) || (await app.getObject(modelId));
20146
+ return m;
19798
20147
  }
20148
+ const p = Promise.resolve(sessionModel || fetchObject(qId));
20149
+ p.then(m => {
20150
+ storeModel(m);
20151
+ setModel(m);
20152
+ });
19799
20153
  }, []);
19800
20154
  return model;
19801
20155
  }
@@ -21911,7 +22265,8 @@ function Header(_ref2) {
21911
22265
  show: showPopoverToolbar,
21912
22266
  anchorEl
21913
22267
  },
21914
- focusHandler: focusHandler
22268
+ focusHandler: focusHandler,
22269
+ layout: layout
21915
22270
  });
21916
22271
  return /*#__PURE__*/React__default.createElement(StyledGrid$1, {
21917
22272
  ref: containerRef,
@@ -23589,11 +23944,17 @@ function useState(initial) {
23589
23944
  }
23590
23945
 
23591
23946
  /**
23947
+ * Callback function that should return a function that in turns gets
23948
+ * called before the hook runs again or when the component is destroyed.
23949
+ * For example to remove any listeners added in the callback itself.
23592
23950
  * @typedef {function():(void | function():void)} EffectCallback
23593
23951
  */
23594
23952
 
23595
23953
  /**
23596
23954
  * Triggers a callback function when a dependent value changes.
23955
+ *
23956
+ * Omitting the dependency array will have the hook run on each update
23957
+ * and an empty dependency array runs only once.
23597
23958
  * @entry
23598
23959
  * @param {EffectCallback} effect - The callback.
23599
23960
  * @param {Array<any>=} deps - The dependencies that should trigger the callback.
@@ -23606,6 +23967,15 @@ function useState(initial) {
23606
23967
  * console.log('unmounted');
23607
23968
  * };
23608
23969
  * }, []);
23970
+ *
23971
+ * useEffect(() => {
23972
+ * const clickHandler = () => { console.log('click') };
23973
+ * const button = element.querySelector('.button');
23974
+ * button.addEventListener('click', clickHandler);
23975
+ * return () => {
23976
+ * button.removeEventListener('click', clickHandler);
23977
+ * };
23978
+ * }, []);
23609
23979
  */
23610
23980
  function useEffect(cb, deps) {
23611
23981
  {
@@ -23665,17 +24035,20 @@ function useMemo(fn, deps) {
23665
24035
 
23666
24036
  /**
23667
24037
  * Runs a callback function when a dependent changes.
24038
+ *
24039
+ * Useful for async operations that otherwise cause no side effects.
24040
+ * Do not add for example listeners withing the callback as there is no teardown function.
23668
24041
  * @entry
23669
24042
  * @template P
23670
24043
  * @param {function():Promise<P>} factory - The factory function that calls the promise.
23671
24044
  * @param {Array<any>=} deps - The dependencies.
23672
- * @returns {Array<P,Error>} The resolved value.
24045
+ * @returns {Array<P,Error>} The resolved value or rejected error
23673
24046
  * @example
23674
24047
  * import { usePromise } from '@nebula.js/stardust';
23675
24048
  * import { useModel } from '@nebula.js/stardust';
23676
24049
  * // ...
23677
24050
  * const model = useModel();
23678
- * const [resolved, rejected] = usePromise(() => model.getLayout(), []);
24051
+ * const [resolved, rejected] = usePromise(() => model.getLayout(), [model]);
23679
24052
  */
23680
24053
  function usePromise(p, deps) {
23681
24054
  const [obj, setObj] = useState(() => ({
@@ -28274,7 +28647,7 @@ const DEFAULT_SNAPSHOT_CONFIG = /** @lends SnapshotConfiguration */{
28274
28647
 
28275
28648
  /**
28276
28649
  * @interface Configuration
28277
- * @property {LoadType=} load Fallback load function for missing types
28650
+ * @property {Function(LoadType):Promise<Visualization>=} load Fallback load function for missing types
28278
28651
  * @property {Context=} context Settings for the rendering instance
28279
28652
  * @property {Array<TypeInfo>=} types Visualization types to register
28280
28653
  * @property {Array<ThemeInfo>=} themes Themes to register
@@ -28693,6 +29066,7 @@ function nuked() {
28693
29066
  * @param {FrequencyMode=} [options.frequencyMode=none] Show frequency none|value|percent|relative
28694
29067
  * @param {boolean=} [options.histogram=false] Show histogram bar (not applicable for existing objects)
28695
29068
  * @param {SearchMode=} [options.search=true] Show the search bar permanently, using the toggle button or when in selection: false|true|toggle
29069
+ * @param {boolean=} [options.showLock=false] Show the button for toggling locked state.
28696
29070
  * @param {boolean=} [options.toolbar=true] Show the toolbar
28697
29071
  * @param {boolean=} [options.checkboxes=false] Show values as checkboxes instead of as fields (not applicable for existing objects)
28698
29072
  * @param {boolean=} [options.dense=false] Reduces padding and text size (not applicable for existing objects)