@nebula.js/stardust 2.3.1 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @nebula.js/stardust v2.3.1
3
- * Copyright (c) 2021 QlikTech International AB
2
+ * @nebula.js/stardust v2.6.1
3
+ * Copyright (c) 2022 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
@@ -3210,8 +3210,8 @@
3210
3210
  * @returns {string} The style value
3211
3211
  *
3212
3212
  * @example
3213
- * theme.getStyle('object', 'title.main', 'fontSize'));
3214
- * theme.getStyle('', '', 'fontSize'));
3213
+ * theme.getStyle('object', 'title.main', 'fontSize');
3214
+ * theme.getStyle('', '', 'fontSize');
3215
3215
  */
3216
3216
  getStyle(basePath, path, attribute) {
3217
3217
  if (!styleResolverInstanceCache[basePath]) {
@@ -11023,7 +11023,7 @@
11023
11023
  return [appSelections, navState];
11024
11024
  }
11025
11025
 
11026
- const NEBULA_VERSION_HASH = "03e4" ;
11026
+ const NEBULA_VERSION_HASH = "375a" ;
11027
11027
  let counter = 0;
11028
11028
  const NebulaApp = react.exports.forwardRef((_ref, ref) => {
11029
11029
  let {
@@ -11083,7 +11083,7 @@
11083
11083
  const appRef = React.createRef();
11084
11084
  const element = document.createElement('div');
11085
11085
  element.style.display = 'none';
11086
- element.setAttribute('data-nebulajs-version', "2.3.1" );
11086
+ element.setAttribute('data-nebulajs-version', "2.6.1" );
11087
11087
  element.setAttribute('data-app-id', app.id);
11088
11088
  document.body.appendChild(element);
11089
11089
  ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
@@ -11182,6 +11182,109 @@
11182
11182
  }, function () {});
11183
11183
  }
11184
11184
 
11185
+ var styles$r = function styles(theme) {
11186
+ return {
11187
+ /* Styles applied to the root element. */
11188
+ root: {
11189
+ userSelect: 'none',
11190
+ width: '1em',
11191
+ height: '1em',
11192
+ display: 'inline-block',
11193
+ fill: 'currentColor',
11194
+ flexShrink: 0,
11195
+ fontSize: theme.typography.pxToRem(24),
11196
+ transition: theme.transitions.create('fill', {
11197
+ duration: theme.transitions.duration.shorter
11198
+ })
11199
+ },
11200
+
11201
+ /* Styles applied to the root element if `color="primary"`. */
11202
+ colorPrimary: {
11203
+ color: theme.palette.primary.main
11204
+ },
11205
+
11206
+ /* Styles applied to the root element if `color="secondary"`. */
11207
+ colorSecondary: {
11208
+ color: theme.palette.secondary.main
11209
+ },
11210
+
11211
+ /* Styles applied to the root element if `color="action"`. */
11212
+ colorAction: {
11213
+ color: theme.palette.action.active
11214
+ },
11215
+
11216
+ /* Styles applied to the root element if `color="error"`. */
11217
+ colorError: {
11218
+ color: theme.palette.error.main
11219
+ },
11220
+
11221
+ /* Styles applied to the root element if `color="disabled"`. */
11222
+ colorDisabled: {
11223
+ color: theme.palette.action.disabled
11224
+ },
11225
+
11226
+ /* Styles applied to the root element if `fontSize="inherit"`. */
11227
+ fontSizeInherit: {
11228
+ fontSize: 'inherit'
11229
+ },
11230
+
11231
+ /* Styles applied to the root element if `fontSize="small"`. */
11232
+ fontSizeSmall: {
11233
+ fontSize: theme.typography.pxToRem(20)
11234
+ },
11235
+
11236
+ /* Styles applied to the root element if `fontSize="large"`. */
11237
+ fontSizeLarge: {
11238
+ fontSize: theme.typography.pxToRem(35)
11239
+ }
11240
+ };
11241
+ };
11242
+ var SvgIcon$1 = /*#__PURE__*/react.exports.forwardRef(function SvgIcon(props, ref) {
11243
+ var children = props.children,
11244
+ classes = props.classes,
11245
+ className = props.className,
11246
+ _props$color = props.color,
11247
+ color = _props$color === void 0 ? 'inherit' : _props$color,
11248
+ _props$component = props.component,
11249
+ Component = _props$component === void 0 ? 'svg' : _props$component,
11250
+ _props$fontSize = props.fontSize,
11251
+ fontSize = _props$fontSize === void 0 ? 'medium' : _props$fontSize,
11252
+ htmlColor = props.htmlColor,
11253
+ titleAccess = props.titleAccess,
11254
+ _props$viewBox = props.viewBox,
11255
+ viewBox = _props$viewBox === void 0 ? '0 0 24 24' : _props$viewBox,
11256
+ other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"]);
11257
+
11258
+ return /*#__PURE__*/react.exports.createElement(Component, _extends$4({
11259
+ className: clsx(classes.root, className, color !== 'inherit' && classes["color".concat(capitalize(color))], fontSize !== 'default' && fontSize !== 'medium' && classes["fontSize".concat(capitalize(fontSize))]),
11260
+ focusable: "false",
11261
+ viewBox: viewBox,
11262
+ color: htmlColor,
11263
+ "aria-hidden": titleAccess ? undefined : true,
11264
+ role: titleAccess ? 'img' : undefined,
11265
+ ref: ref
11266
+ }, other), children, titleAccess ? /*#__PURE__*/react.exports.createElement("title", null, titleAccess) : null);
11267
+ });
11268
+ SvgIcon$1.muiName = 'SvgIcon';
11269
+ var SvgIcon$2 = withStyles(styles$r, {
11270
+ name: 'MuiSvgIcon'
11271
+ })(SvgIcon$1);
11272
+
11273
+ /**
11274
+ * Private module reserved for @material-ui/x packages.
11275
+ */
11276
+
11277
+ function createSvgIcon(path, displayName) {
11278
+ var Component = function Component(props, ref) {
11279
+ return /*#__PURE__*/React.createElement(SvgIcon$2, _extends$4({
11280
+ ref: ref
11281
+ }, props), path);
11282
+ };
11283
+
11284
+ Component.muiName = SvgIcon$2.muiName;
11285
+ return /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Component));
11286
+ }
11287
+
11185
11288
  // Corresponds to 10 frames at 60 Hz.
11186
11289
  // A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
11187
11290
  function debounce(func) {
@@ -11233,6 +11336,30 @@
11233
11336
  }
11234
11337
  }
11235
11338
 
11339
+ /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
11340
+ function useControlled(_ref) {
11341
+ var controlled = _ref.controlled,
11342
+ defaultProp = _ref.default;
11343
+ _ref.name;
11344
+ _ref.state;
11345
+
11346
+ var _React$useRef = react.exports.useRef(controlled !== undefined),
11347
+ isControlled = _React$useRef.current;
11348
+
11349
+ var _React$useState = react.exports.useState(defaultProp),
11350
+ valueState = _React$useState[0],
11351
+ setValue = _React$useState[1];
11352
+
11353
+ var value = isControlled ? controlled : valueState;
11354
+
11355
+ var setValueIfUncontrolled = react.exports.useCallback(function (newValue) {
11356
+ if (!isControlled) {
11357
+ setValue(newValue);
11358
+ }
11359
+ }, []);
11360
+ return [value, setValueIfUncontrolled];
11361
+ }
11362
+
11236
11363
  var useEnhancedEffect$6 = typeof window !== 'undefined' ? react.exports.useLayoutEffect : react.exports.useEffect;
11237
11364
  /**
11238
11365
  * https://github.com/facebook/react/issues/14099#issuecomment-440013892
@@ -12205,7 +12332,7 @@
12205
12332
  };
12206
12333
  }
12207
12334
 
12208
- var styles$n = function styles(theme) {
12335
+ var styles$q = function styles(theme) {
12209
12336
  var elevations = {};
12210
12337
  theme.shadows.forEach(function (shadow, index) {
12211
12338
  elevations["elevation".concat(index)] = {
@@ -12249,7 +12376,7 @@
12249
12376
  ref: ref
12250
12377
  }, other));
12251
12378
  });
12252
- var Paper$1 = withStyles(styles$n, {
12379
+ var Paper$1 = withStyles(styles$q, {
12253
12380
  name: 'MuiPaper'
12254
12381
  })(Paper);
12255
12382
 
@@ -12325,7 +12452,7 @@
12325
12452
 
12326
12453
  var DURATION = 550;
12327
12454
  var DELAY_RIPPLE = 80;
12328
- var styles$m = function styles(theme) {
12455
+ var styles$p = function styles(theme) {
12329
12456
  return {
12330
12457
  /* Styles applied to the root element. */
12331
12458
  root: {
@@ -12605,12 +12732,12 @@
12605
12732
  exit: true
12606
12733
  }, ripples));
12607
12734
  });
12608
- var TouchRipple$1 = withStyles(styles$m, {
12735
+ var TouchRipple$1 = withStyles(styles$p, {
12609
12736
  flip: false,
12610
12737
  name: 'MuiTouchRipple'
12611
12738
  })( /*#__PURE__*/react.exports.memo(TouchRipple));
12612
12739
 
12613
- var styles$l = {
12740
+ var styles$o = {
12614
12741
  /* Styles applied to the root element. */
12615
12742
  root: {
12616
12743
  display: 'inline-flex',
@@ -12914,11 +13041,11 @@
12914
13041
  center: centerRipple
12915
13042
  }, TouchRippleProps)) : null);
12916
13043
  });
12917
- var ButtonBase$1 = withStyles(styles$l, {
13044
+ var ButtonBase$1 = withStyles(styles$o, {
12918
13045
  name: 'MuiButtonBase'
12919
13046
  })(ButtonBase);
12920
13047
 
12921
- var styles$k = function styles(theme) {
13048
+ var styles$n = function styles(theme) {
12922
13049
  return {
12923
13050
  /* Styles applied to the root element. */
12924
13051
  root: {
@@ -13043,13 +13170,13 @@
13043
13170
  className: classes.label
13044
13171
  }, children));
13045
13172
  });
13046
- var IconButton$1 = withStyles(styles$k, {
13173
+ var IconButton$1 = withStyles(styles$n, {
13047
13174
  name: 'MuiIconButton'
13048
13175
  })(IconButton);
13049
13176
 
13050
13177
  var RADIUS_STANDARD = 10;
13051
13178
  var RADIUS_DOT = 4;
13052
- var styles$j = function styles(theme) {
13179
+ var styles$m = function styles(theme) {
13053
13180
  return {
13054
13181
  /* Styles applied to the root element. */
13055
13182
  root: {
@@ -13341,7 +13468,7 @@
13341
13468
  className: clsx(classes.badge, classes["".concat(anchorOrigin.horizontal).concat(capitalize(anchorOrigin.vertical), "}")], classes["anchorOrigin".concat(capitalize(anchorOrigin.vertical)).concat(capitalize(anchorOrigin.horizontal)).concat(capitalize(overlap))], color !== 'default' && classes["color".concat(capitalize(color))], invisible && classes.invisible, variant === 'dot' && classes.dot)
13342
13469
  }, displayValue));
13343
13470
  });
13344
- var Badge$1 = withStyles(styles$j, {
13471
+ var Badge$1 = withStyles(styles$m, {
13345
13472
  name: 'MuiBadge'
13346
13473
  })(Badge);
13347
13474
 
@@ -13355,7 +13482,7 @@
13355
13482
  });
13356
13483
  var Box$1 = Box;
13357
13484
 
13358
- var styles$i = function styles(theme) {
13485
+ var styles$l = function styles(theme) {
13359
13486
  return {
13360
13487
  /* Styles applied to the root element. */
13361
13488
  root: {
@@ -13527,11 +13654,11 @@
13527
13654
  ref: ref
13528
13655
  }, other));
13529
13656
  });
13530
- var Typography$1 = withStyles(styles$i, {
13657
+ var Typography$1 = withStyles(styles$l, {
13531
13658
  name: 'MuiTypography'
13532
13659
  })(Typography);
13533
13660
 
13534
- var styles$h = function styles(theme) {
13661
+ var styles$k = function styles(theme) {
13535
13662
  return {
13536
13663
  /* Styles applied to the root element. */
13537
13664
  root: _extends$4({}, theme.typography.button, {
@@ -13856,7 +13983,7 @@
13856
13983
  className: classes.label
13857
13984
  }, startIcon, children, endIcon));
13858
13985
  });
13859
- var Button$1 = withStyles(styles$h, {
13986
+ var Button$1 = withStyles(styles$k, {
13860
13987
  name: 'MuiButton'
13861
13988
  })(Button);
13862
13989
 
@@ -13866,13 +13993,265 @@
13866
13993
 
13867
13994
  var FormControlContext = react.exports.createContext();
13868
13995
 
13869
- function useFormControl() {
13996
+ function useFormControl$1() {
13870
13997
  return react.exports.useContext(FormControlContext);
13871
13998
  }
13872
13999
  var FormControlContext$1 = FormControlContext;
13873
14000
 
14001
+ function useFormControl() {
14002
+ return react.exports.useContext(FormControlContext$1);
14003
+ }
14004
+
14005
+ var styles$j = {
14006
+ root: {
14007
+ padding: 9
14008
+ },
14009
+ checked: {},
14010
+ disabled: {},
14011
+ input: {
14012
+ cursor: 'inherit',
14013
+ position: 'absolute',
14014
+ opacity: 0,
14015
+ width: '100%',
14016
+ height: '100%',
14017
+ top: 0,
14018
+ left: 0,
14019
+ margin: 0,
14020
+ padding: 0,
14021
+ zIndex: 1
14022
+ }
14023
+ };
14024
+ /**
14025
+ * @ignore - internal component.
14026
+ */
14027
+
14028
+ var SwitchBase = /*#__PURE__*/react.exports.forwardRef(function SwitchBase(props, ref) {
14029
+ var autoFocus = props.autoFocus,
14030
+ checkedProp = props.checked,
14031
+ checkedIcon = props.checkedIcon,
14032
+ classes = props.classes,
14033
+ className = props.className,
14034
+ defaultChecked = props.defaultChecked,
14035
+ disabledProp = props.disabled,
14036
+ icon = props.icon,
14037
+ id = props.id,
14038
+ inputProps = props.inputProps,
14039
+ inputRef = props.inputRef,
14040
+ name = props.name,
14041
+ onBlur = props.onBlur,
14042
+ onChange = props.onChange,
14043
+ onFocus = props.onFocus,
14044
+ readOnly = props.readOnly,
14045
+ required = props.required,
14046
+ tabIndex = props.tabIndex,
14047
+ type = props.type,
14048
+ value = props.value,
14049
+ other = _objectWithoutProperties(props, ["autoFocus", "checked", "checkedIcon", "classes", "className", "defaultChecked", "disabled", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"]);
14050
+
14051
+ var _useControlled = useControlled({
14052
+ controlled: checkedProp,
14053
+ default: Boolean(defaultChecked),
14054
+ name: 'SwitchBase',
14055
+ state: 'checked'
14056
+ }),
14057
+ _useControlled2 = _slicedToArray(_useControlled, 2),
14058
+ checked = _useControlled2[0],
14059
+ setCheckedState = _useControlled2[1];
14060
+
14061
+ var muiFormControl = useFormControl();
14062
+
14063
+ var handleFocus = function handleFocus(event) {
14064
+ if (onFocus) {
14065
+ onFocus(event);
14066
+ }
14067
+
14068
+ if (muiFormControl && muiFormControl.onFocus) {
14069
+ muiFormControl.onFocus(event);
14070
+ }
14071
+ };
14072
+
14073
+ var handleBlur = function handleBlur(event) {
14074
+ if (onBlur) {
14075
+ onBlur(event);
14076
+ }
14077
+
14078
+ if (muiFormControl && muiFormControl.onBlur) {
14079
+ muiFormControl.onBlur(event);
14080
+ }
14081
+ };
14082
+
14083
+ var handleInputChange = function handleInputChange(event) {
14084
+ var newChecked = event.target.checked;
14085
+ setCheckedState(newChecked);
14086
+
14087
+ if (onChange) {
14088
+ // TODO v5: remove the second argument.
14089
+ onChange(event, newChecked);
14090
+ }
14091
+ };
14092
+
14093
+ var disabled = disabledProp;
14094
+
14095
+ if (muiFormControl) {
14096
+ if (typeof disabled === 'undefined') {
14097
+ disabled = muiFormControl.disabled;
14098
+ }
14099
+ }
14100
+
14101
+ var hasLabelFor = type === 'checkbox' || type === 'radio';
14102
+ return /*#__PURE__*/react.exports.createElement(IconButton$1, _extends$4({
14103
+ component: "span",
14104
+ className: clsx(classes.root, className, checked && classes.checked, disabled && classes.disabled),
14105
+ disabled: disabled,
14106
+ tabIndex: null,
14107
+ role: undefined,
14108
+ onFocus: handleFocus,
14109
+ onBlur: handleBlur,
14110
+ ref: ref
14111
+ }, other), /*#__PURE__*/react.exports.createElement("input", _extends$4({
14112
+ autoFocus: autoFocus,
14113
+ checked: checkedProp,
14114
+ defaultChecked: defaultChecked,
14115
+ className: classes.input,
14116
+ disabled: disabled,
14117
+ id: hasLabelFor && id,
14118
+ name: name,
14119
+ onChange: handleInputChange,
14120
+ readOnly: readOnly,
14121
+ ref: inputRef,
14122
+ required: required,
14123
+ tabIndex: tabIndex,
14124
+ type: type,
14125
+ value: value
14126
+ }, inputProps)), checked ? checkedIcon : icon);
14127
+ }); // NB: If changed, please update Checkbox, Switch and Radio
14128
+ var SwitchBase$1 = withStyles(styles$j, {
14129
+ name: 'PrivateSwitchBase'
14130
+ })(SwitchBase);
14131
+
14132
+ /**
14133
+ * @ignore - internal component.
14134
+ */
14135
+
14136
+ var CheckBoxOutlineBlankIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
14137
+ d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
14138
+ }));
14139
+
14140
+ /**
14141
+ * @ignore - internal component.
14142
+ */
14143
+
14144
+ var CheckBoxIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
14145
+ d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
14146
+ }));
14147
+
14148
+ /**
14149
+ * @ignore - internal component.
14150
+ */
14151
+
14152
+ var IndeterminateCheckBoxIcon = createSvgIcon( /*#__PURE__*/react.exports.createElement("path", {
14153
+ d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
14154
+ }));
14155
+
14156
+ var styles$i = function styles(theme) {
14157
+ return {
14158
+ /* Styles applied to the root element. */
14159
+ root: {
14160
+ color: theme.palette.text.secondary
14161
+ },
14162
+
14163
+ /* Pseudo-class applied to the root element if `checked={true}`. */
14164
+ checked: {},
14165
+
14166
+ /* Pseudo-class applied to the root element if `disabled={true}`. */
14167
+ disabled: {},
14168
+
14169
+ /* Pseudo-class applied to the root element if `indeterminate={true}`. */
14170
+ indeterminate: {},
14171
+
14172
+ /* Styles applied to the root element if `color="primary"`. */
14173
+ colorPrimary: {
14174
+ '&$checked': {
14175
+ color: theme.palette.primary.main,
14176
+ '&:hover': {
14177
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity),
14178
+ // Reset on touch devices, it doesn't add specificity
14179
+ '@media (hover: none)': {
14180
+ backgroundColor: 'transparent'
14181
+ }
14182
+ }
14183
+ },
14184
+ '&$disabled': {
14185
+ color: theme.palette.action.disabled
14186
+ }
14187
+ },
14188
+
14189
+ /* Styles applied to the root element if `color="secondary"`. */
14190
+ colorSecondary: {
14191
+ '&$checked': {
14192
+ color: theme.palette.secondary.main,
14193
+ '&:hover': {
14194
+ backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity),
14195
+ // Reset on touch devices, it doesn't add specificity
14196
+ '@media (hover: none)': {
14197
+ backgroundColor: 'transparent'
14198
+ }
14199
+ }
14200
+ },
14201
+ '&$disabled': {
14202
+ color: theme.palette.action.disabled
14203
+ }
14204
+ }
14205
+ };
14206
+ };
14207
+ var defaultCheckedIcon = /*#__PURE__*/react.exports.createElement(CheckBoxIcon, null);
14208
+ var defaultIcon = /*#__PURE__*/react.exports.createElement(CheckBoxOutlineBlankIcon, null);
14209
+ var defaultIndeterminateIcon = /*#__PURE__*/react.exports.createElement(IndeterminateCheckBoxIcon, null);
14210
+ var Checkbox = /*#__PURE__*/react.exports.forwardRef(function Checkbox(props, ref) {
14211
+ var _props$checkedIcon = props.checkedIcon,
14212
+ checkedIcon = _props$checkedIcon === void 0 ? defaultCheckedIcon : _props$checkedIcon,
14213
+ classes = props.classes,
14214
+ _props$color = props.color,
14215
+ color = _props$color === void 0 ? 'secondary' : _props$color,
14216
+ _props$icon = props.icon,
14217
+ iconProp = _props$icon === void 0 ? defaultIcon : _props$icon,
14218
+ _props$indeterminate = props.indeterminate,
14219
+ indeterminate = _props$indeterminate === void 0 ? false : _props$indeterminate,
14220
+ _props$indeterminateI = props.indeterminateIcon,
14221
+ indeterminateIconProp = _props$indeterminateI === void 0 ? defaultIndeterminateIcon : _props$indeterminateI,
14222
+ inputProps = props.inputProps,
14223
+ _props$size = props.size,
14224
+ size = _props$size === void 0 ? 'medium' : _props$size,
14225
+ other = _objectWithoutProperties(props, ["checkedIcon", "classes", "color", "icon", "indeterminate", "indeterminateIcon", "inputProps", "size"]);
14226
+
14227
+ var icon = indeterminate ? indeterminateIconProp : iconProp;
14228
+ var indeterminateIcon = indeterminate ? indeterminateIconProp : checkedIcon;
14229
+ return /*#__PURE__*/react.exports.createElement(SwitchBase$1, _extends$4({
14230
+ type: "checkbox",
14231
+ classes: {
14232
+ root: clsx(classes.root, classes["color".concat(capitalize(color))], indeterminate && classes.indeterminate),
14233
+ checked: classes.checked,
14234
+ disabled: classes.disabled
14235
+ },
14236
+ color: color,
14237
+ inputProps: _extends$4({
14238
+ 'data-indeterminate': indeterminate
14239
+ }, inputProps),
14240
+ icon: /*#__PURE__*/react.exports.cloneElement(icon, {
14241
+ fontSize: icon.props.fontSize === undefined && size === "small" ? size : icon.props.fontSize
14242
+ }),
14243
+ checkedIcon: /*#__PURE__*/react.exports.cloneElement(indeterminateIcon, {
14244
+ fontSize: indeterminateIcon.props.fontSize === undefined && size === "small" ? size : indeterminateIcon.props.fontSize
14245
+ }),
14246
+ ref: ref
14247
+ }, other));
14248
+ });
14249
+ var Checkbox$1 = withStyles(styles$i, {
14250
+ name: 'MuiCheckbox'
14251
+ })(Checkbox);
14252
+
13874
14253
  var SIZE = 44;
13875
- var styles$g = function styles(theme) {
14254
+ var styles$h = function styles(theme) {
13876
14255
  return {
13877
14256
  /* Styles applied to the root element. */
13878
14257
  root: {
@@ -14032,7 +14411,7 @@
14032
14411
  strokeWidth: thickness
14033
14412
  })));
14034
14413
  });
14035
- var CircularProgress$1 = withStyles(styles$g, {
14414
+ var CircularProgress$1 = withStyles(styles$h, {
14036
14415
  name: 'MuiCircularProgress',
14037
14416
  flip: false
14038
14417
  })(CircularProgress);
@@ -14517,7 +14896,7 @@
14517
14896
  }));
14518
14897
  }
14519
14898
 
14520
- var styles$f = {
14899
+ var styles$g = {
14521
14900
  /* Styles applied to the root element. */
14522
14901
  root: {
14523
14902
  zIndex: -1,
@@ -14549,7 +14928,7 @@
14549
14928
  "aria-hidden": true,
14550
14929
  ref: ref
14551
14930
  }, other, {
14552
- style: _extends$4({}, styles$f.root, invisible ? styles$f.invisible : {}, other.style)
14931
+ style: _extends$4({}, styles$g.root, invisible ? styles$g.invisible : {}, other.style)
14553
14932
  })) : null;
14554
14933
  });
14555
14934
  var SimpleBackdrop$1 = SimpleBackdrop;
@@ -14566,7 +14945,7 @@
14566
14945
 
14567
14946
 
14568
14947
  var defaultManager = new ModalManager();
14569
- var styles$e = function styles(theme) {
14948
+ var styles$f = function styles(theme) {
14570
14949
  return {
14571
14950
  /* Styles applied to the root element. */
14572
14951
  root: {
@@ -14767,7 +15146,7 @@
14767
15146
  }
14768
15147
  };
14769
15148
 
14770
- var inlineStyle = styles$e(theme || {
15149
+ var inlineStyle = styles$f(theme || {
14771
15150
  zIndex: zIndex$1
14772
15151
  });
14773
15152
  var childProps = {};
@@ -14806,7 +15185,7 @@
14806
15185
  });
14807
15186
  var Modal$1 = Modal;
14808
15187
 
14809
- var styles$d = function styles(theme) {
15188
+ var styles$e = function styles(theme) {
14810
15189
  return {
14811
15190
  /* Styles applied to the root element. */
14812
15191
  root: {
@@ -14880,7 +15259,7 @@
14880
15259
  ref: ref
14881
15260
  }, other));
14882
15261
  });
14883
- var Divider$1 = withStyles(styles$d, {
15262
+ var Divider$1 = withStyles(styles$e, {
14884
15263
  name: 'MuiDivider'
14885
15264
  })(Divider);
14886
15265
 
@@ -14906,7 +15285,7 @@
14906
15285
  }
14907
15286
 
14908
15287
  var useEnhancedEffect$3 = typeof window !== 'undefined' ? react.exports.useLayoutEffect : react.exports.useEffect;
14909
- var styles$c = {
15288
+ var styles$d = {
14910
15289
  /* Styles applied to the shadow textarea element. */
14911
15290
  shadow: {
14912
15291
  // Visibility needed to hide the extra text area on iPads
@@ -15048,7 +15427,7 @@
15048
15427
  readOnly: true,
15049
15428
  ref: shadowRef,
15050
15429
  tabIndex: -1,
15051
- style: _extends$4({}, styles$c.shadow, style)
15430
+ style: _extends$4({}, styles$d.shadow, style)
15052
15431
  }));
15053
15432
  });
15054
15433
  var TextareaAutosize$1 = TextareaAutosize;
@@ -15074,7 +15453,7 @@
15074
15453
  return obj && (hasValue(obj.value) && obj.value !== '' || SSR && hasValue(obj.defaultValue) && obj.defaultValue !== '');
15075
15454
  } // Determine if an Input is adorned on start.
15076
15455
 
15077
- var styles$b = function styles(theme) {
15456
+ var styles$c = function styles(theme) {
15078
15457
  var light = theme.palette.type === 'light';
15079
15458
  var placeholder = {
15080
15459
  color: 'currentColor',
@@ -15310,7 +15689,7 @@
15310
15689
  focused = _React$useState[0],
15311
15690
  setFocused = _React$useState[1];
15312
15691
 
15313
- var muiFormControl = useFormControl();
15692
+ var muiFormControl = useFormControl$1();
15314
15693
 
15315
15694
  var fcs = formControlState({
15316
15695
  props: props,
@@ -15506,10 +15885,110 @@
15506
15885
  startAdornment: startAdornment
15507
15886
  })) : null);
15508
15887
  });
15509
- var InputBase$1 = withStyles(styles$b, {
15888
+ var InputBase$1 = withStyles(styles$c, {
15510
15889
  name: 'MuiInputBase'
15511
15890
  })(InputBase);
15512
15891
 
15892
+ var styles$b = function styles(theme) {
15893
+ return {
15894
+ /* Styles applied to the root element. */
15895
+ root: {
15896
+ display: 'inline-flex',
15897
+ alignItems: 'center',
15898
+ cursor: 'pointer',
15899
+ // For correct alignment with the text.
15900
+ verticalAlign: 'middle',
15901
+ WebkitTapHighlightColor: 'transparent',
15902
+ marginLeft: -11,
15903
+ marginRight: 16,
15904
+ // used for row presentation of radio/checkbox
15905
+ '&$disabled': {
15906
+ cursor: 'default'
15907
+ }
15908
+ },
15909
+
15910
+ /* Styles applied to the root element if `labelPlacement="start"`. */
15911
+ labelPlacementStart: {
15912
+ flexDirection: 'row-reverse',
15913
+ marginLeft: 16,
15914
+ // used for row presentation of radio/checkbox
15915
+ marginRight: -11
15916
+ },
15917
+
15918
+ /* Styles applied to the root element if `labelPlacement="top"`. */
15919
+ labelPlacementTop: {
15920
+ flexDirection: 'column-reverse',
15921
+ marginLeft: 16
15922
+ },
15923
+
15924
+ /* Styles applied to the root element if `labelPlacement="bottom"`. */
15925
+ labelPlacementBottom: {
15926
+ flexDirection: 'column',
15927
+ marginLeft: 16
15928
+ },
15929
+
15930
+ /* Pseudo-class applied to the root element if `disabled={true}`. */
15931
+ disabled: {},
15932
+
15933
+ /* Styles applied to the label's Typography component. */
15934
+ label: {
15935
+ '&$disabled': {
15936
+ color: theme.palette.text.disabled
15937
+ }
15938
+ }
15939
+ };
15940
+ };
15941
+ /**
15942
+ * Drop in replacement of the `Radio`, `Switch` and `Checkbox` component.
15943
+ * Use this component if you want to display an extra label.
15944
+ */
15945
+
15946
+ var FormControlLabel = /*#__PURE__*/react.exports.forwardRef(function FormControlLabel(props, ref) {
15947
+ props.checked;
15948
+ var classes = props.classes,
15949
+ className = props.className,
15950
+ control = props.control,
15951
+ disabledProp = props.disabled;
15952
+ props.inputRef;
15953
+ var label = props.label,
15954
+ _props$labelPlacement = props.labelPlacement,
15955
+ labelPlacement = _props$labelPlacement === void 0 ? 'end' : _props$labelPlacement;
15956
+ props.name;
15957
+ props.onChange;
15958
+ props.value;
15959
+ var other = _objectWithoutProperties(props, ["checked", "classes", "className", "control", "disabled", "inputRef", "label", "labelPlacement", "name", "onChange", "value"]);
15960
+
15961
+ var muiFormControl = useFormControl();
15962
+ var disabled = disabledProp;
15963
+
15964
+ if (typeof disabled === 'undefined' && typeof control.props.disabled !== 'undefined') {
15965
+ disabled = control.props.disabled;
15966
+ }
15967
+
15968
+ if (typeof disabled === 'undefined' && muiFormControl) {
15969
+ disabled = muiFormControl.disabled;
15970
+ }
15971
+
15972
+ var controlProps = {
15973
+ disabled: disabled
15974
+ };
15975
+ ['checked', 'name', 'onChange', 'value', 'inputRef'].forEach(function (key) {
15976
+ if (typeof control.props[key] === 'undefined' && typeof props[key] !== 'undefined') {
15977
+ controlProps[key] = props[key];
15978
+ }
15979
+ });
15980
+ return /*#__PURE__*/react.exports.createElement("label", _extends$4({
15981
+ className: clsx(classes.root, className, labelPlacement !== 'end' && classes["labelPlacement".concat(capitalize(labelPlacement))], disabled && classes.disabled),
15982
+ ref: ref
15983
+ }, other), /*#__PURE__*/react.exports.cloneElement(control, controlProps), /*#__PURE__*/react.exports.createElement(Typography$1, {
15984
+ component: "span",
15985
+ className: clsx(classes.label, disabled && classes.disabled)
15986
+ }, label));
15987
+ });
15988
+ var FormControlLabel$1 = withStyles(styles$b, {
15989
+ name: 'MuiFormControlLabel'
15990
+ })(FormControlLabel);
15991
+
15513
15992
  var SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
15514
15993
  var GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
15515
15994
 
@@ -16064,7 +16543,7 @@
16064
16543
  variantProp = props.variant,
16065
16544
  other = _objectWithoutProperties(props, ["children", "classes", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"]);
16066
16545
 
16067
- var muiFormControl = useFormControl() || {};
16546
+ var muiFormControl = useFormControl$1() || {};
16068
16547
  var variant = variantProp;
16069
16548
 
16070
16549
  if (variantProp && muiFormControl.variant) ;
@@ -18337,192 +18816,479 @@
18337
18816
  return InfiniteLoader;
18338
18817
  }(react.exports.PureComponent);
18339
18818
 
18340
- const tick = props => _objectSpread2(_objectSpread2({}, props), {}, {
18341
- shapes: [{
18342
- type: 'path',
18343
- attrs: {
18344
- d: 'M6,10 L13,3 L15,5 L8,12 L6,14 L1,9 L3,7 L6,10 Z'
18819
+ const SELECTED_STATES = ['S', 'XS'];
18820
+
18821
+ const flatten = arr => arr.reduce((prev, cur) => prev.concat(cur));
18822
+
18823
+ function isStateSelected(qState) {
18824
+ return SELECTED_STATES.includes(qState);
18825
+ }
18826
+
18827
+ function getUniques(arr) {
18828
+ return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
18829
+ }
18830
+ function getSelectedValues(pages) {
18831
+ if (!pages || !pages.length) {
18832
+ return [];
18833
+ }
18834
+
18835
+ const elementNbrs = pages.map(page => {
18836
+ const elementNumbers = page.qMatrix.map(p => {
18837
+ const [p0] = p;
18838
+ return isStateSelected(p0.qState) ? p0.qElemNumber : false;
18839
+ });
18840
+ return elementNumbers.filter(n => n !== false);
18841
+ });
18842
+ return flatten(elementNbrs);
18843
+ }
18844
+ function applySelectionsOnPages(pages, elmNumbers) {
18845
+ const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
18846
+
18847
+ const matrices = pages.map(page => {
18848
+ const qMatrix = page.qMatrix.map(p => {
18849
+ const [p0] = p;
18850
+ const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
18851
+ const qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
18852
+ return [_objectSpread2(_objectSpread2({}, p0), {}, {
18853
+ qState
18854
+ }), p.slice(1)];
18855
+ });
18856
+ return _objectSpread2(_objectSpread2({}, page), {}, {
18857
+ qMatrix
18858
+ });
18859
+ });
18860
+ return matrices;
18861
+ }
18862
+ async function selectValues(_ref) {
18863
+ let {
18864
+ selections,
18865
+ elemNumbers,
18866
+ isSingleSelect = false
18867
+ } = _ref;
18868
+ let resolved = Promise.resolve(false);
18869
+ const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
18870
+
18871
+ if (!hasNanValues) {
18872
+ const elemNumbersToSelect = elemNumbers;
18873
+ resolved = selections.select({
18874
+ method: 'selectListObjectValues',
18875
+ params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
18876
+ }).then(success => success !== false).catch(() => false);
18877
+ }
18878
+
18879
+ return resolved;
18880
+ }
18881
+ function getElemNumbersFromPages(pages) {
18882
+ if (!pages || !pages.length) {
18883
+ return [];
18884
+ }
18885
+
18886
+ const elemNumbersArr = pages.map(page => {
18887
+ const qElemNumbers = page.qMatrix.map(p => {
18888
+ const [{
18889
+ qElemNumber
18890
+ }] = p;
18891
+ return qElemNumber;
18892
+ });
18893
+ return qElemNumbers;
18894
+ });
18895
+ const elemNumbers = flatten(elemNumbersArr);
18896
+ return elemNumbers;
18897
+ }
18898
+ /**
18899
+ * @typedef {object} MinMaxResult
18900
+ * @property {number} min
18901
+ * @property {number} max
18902
+ */
18903
+
18904
+ /**
18905
+ * Returns the min and max indices of elemNumbersOrdered which contains
18906
+ * all numbers in elementNbrs.
18907
+ *
18908
+ * @param {number[]} elementNbrs
18909
+ * @param {number[]} elemNumbersOrdered
18910
+ * @returns {MinMaxResult}
18911
+ */
18912
+
18913
+ function getMinMax(elementNbrs, elemNumbersOrdered) {
18914
+ let min = Infinity;
18915
+ let max = -Infinity;
18916
+ elementNbrs.forEach(nbr => {
18917
+ const index = elemNumbersOrdered.indexOf(nbr);
18918
+ min = index < min ? index : min;
18919
+ max = index > max ? index : max;
18920
+ });
18921
+ return {
18922
+ min,
18923
+ max
18924
+ };
18925
+ }
18926
+
18927
+ function fillRange(elementNbrs, elemNumbersOrdered) {
18928
+ if (!elementNbrs) {
18929
+ return [];
18930
+ }
18931
+
18932
+ if (elementNbrs.length <= 1) {
18933
+ return elementNbrs;
18934
+ } // Interpolate values algorithm
18935
+
18936
+
18937
+ const {
18938
+ min,
18939
+ max
18940
+ } = getMinMax(elementNbrs, elemNumbersOrdered);
18941
+ return elemNumbersOrdered.slice(min, max + 1);
18942
+ }
18943
+
18944
+ function useSelectionsInteractions(_ref) {
18945
+ let {
18946
+ layout,
18947
+ selections,
18948
+ pages = [],
18949
+ rangeSelect = true,
18950
+ checkboxes = false,
18951
+ doc = document
18952
+ } = _ref;
18953
+ const [instantPages, setInstantPages] = react.exports.useState(pages);
18954
+ const [mouseDown, setMouseDown] = react.exports.useState(false);
18955
+ const [selectingValues, setSelectingValues] = react.exports.useState(false);
18956
+ const [selected, setSelected] = react.exports.useState([]);
18957
+ const [isRangeSelection, setIsRangeSelection] = react.exports.useState(false);
18958
+ const [preSelected, setPreSelected] = react.exports.useState([]);
18959
+ const elemNumbersOrdered = getElemNumbersFromPages(pages);
18960
+
18961
+ const getIsSingleSelect = () => !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne); // Select values for real, by calling the backend.
18962
+
18963
+
18964
+ const select = async function () {
18965
+ let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18966
+ let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
18967
+ setSelectingValues(true);
18968
+ const isSingleSelect = getIsSingleSelect();
18969
+ const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
18970
+ await selectValues({
18971
+ selections,
18972
+ elemNumbers: filtered,
18973
+ isSingleSelect
18974
+ });
18975
+ setSelectingValues(false);
18976
+ }; // Show estimated selection states instantly before applying the selections for real.
18977
+
18978
+
18979
+ const preSelect = function (elemNumbers) {
18980
+ let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
18981
+ setPreSelected(existing => {
18982
+ const uniques = getUniques([...existing, ...elemNumbers]);
18983
+ const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
18984
+ const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
18985
+ return filled;
18986
+ });
18987
+ };
18988
+
18989
+ const onClick = react.exports.useCallback(event => {
18990
+ if (selectingValues) {
18991
+ return;
18345
18992
  }
18346
- }]
18347
- });
18348
18993
 
18349
- var Tick = (props => SvgIcon(tick(props)));
18994
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
18995
+ setPreSelected([elemNumber]);
18996
+ }, [selectingValues]);
18997
+ const onMouseDown = react.exports.useCallback(event => {
18998
+ if (selectingValues) {
18999
+ return;
19000
+ }
18350
19001
 
18351
- const useStyles$b = makeStyles$1(theme => ({
18352
- row: {
18353
- flexWrap: 'nowrap',
18354
- borderBottom: "1px solid ".concat(theme.palette.divider),
18355
- '&:focus': {
18356
- boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusOutline),
18357
- outline: 'none'
19002
+ setIsRangeSelection(false);
19003
+ setMouseDown(true);
19004
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
19005
+ setPreSelected([elemNumber]);
19006
+ }, [selectingValues]);
19007
+ const onMouseUp = react.exports.useCallback(event => {
19008
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
19009
+
19010
+ if (getIsSingleSelect() || !rangeSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
19011
+ ) {
19012
+ return;
18358
19013
  }
18359
- },
18360
- cell: {
18361
- padding: '8px',
18362
- '& span': {
18363
- whiteSpace: 'nowrap',
18364
- fontSize: '12px',
18365
- lineHeight: '16px'
18366
- },
18367
- overflow: 'hidden',
18368
- textOverflow: 'ellipsis'
18369
- },
18370
- icon: {
18371
- padding: theme.spacing(1)
18372
- },
18373
- S: {
18374
- background: theme.palette.selected.main,
18375
- color: theme.palette.selected.mainContrastText,
18376
- '&:focus': {
18377
- boxShadow: "inset 0 0 0 2px rgba(0, 0, 0, 0.3)",
18378
- outline: 'none'
19014
+
19015
+ preSelect([elemNumber]);
19016
+ }, [mouseDown, selectingValues, preSelected, selected, isRangeSelection]);
19017
+ const onMouseUpDoc = react.exports.useCallback(() => {
19018
+ // Ensure we end interactions when mouseup happens outside the Listbox.
19019
+ setMouseDown(false);
19020
+ setSelectingValues(false);
19021
+ }, []);
19022
+ const onMouseEnter = react.exports.useCallback(event => {
19023
+ if (getIsSingleSelect() || !mouseDown || selectingValues) {
19024
+ return;
19025
+ }
19026
+
19027
+ setIsRangeSelection(true);
19028
+ const elemNumber = +event.currentTarget.getAttribute('data-n');
19029
+ preSelect([elemNumber], true);
19030
+ }, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
19031
+ react.exports.useEffect(() => {
19032
+ // Perform selections of pre-selected values. This can
19033
+ // happen only when interactions have finished (mouseup).
19034
+ const interactionIsFinished = !mouseDown;
19035
+
19036
+ if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
19037
+ return;
19038
+ }
19039
+
19040
+ select(preSelected, isRangeSelection);
19041
+ }, [preSelected, mouseDown]);
19042
+ react.exports.useEffect(() => {
19043
+ doc.addEventListener('mouseup', onMouseUpDoc);
19044
+ return () => {
19045
+ doc.removeEventListener('mouseup', onMouseUpDoc);
19046
+ };
19047
+ }, []);
19048
+ react.exports.useEffect(() => {
19049
+ if (selectingValues || mouseDown) {
19050
+ return;
19051
+ } // Keep track of (truely) selected fields so we can prevent toggling them on range select.
19052
+
19053
+
19054
+ const alreadySelected = getSelectedValues(pages);
19055
+ setSelected(alreadySelected);
19056
+ }, [pages]);
19057
+ react.exports.useEffect(() => {
19058
+ if (selectingValues || !pages || !checkboxes && !mouseDown) {
19059
+ return;
19060
+ } // Render pre-selections before they have been selected in Engine.
19061
+
19062
+
19063
+ const newPages = applySelectionsOnPages(pages, preSelected);
19064
+ setInstantPages(newPages);
19065
+ }, [preSelected]);
19066
+ const interactionEvents = {};
19067
+
19068
+ if (checkboxes) {
19069
+ Object.assign(interactionEvents, {
19070
+ onClick
19071
+ });
19072
+ } else if (rangeSelect) {
19073
+ Object.assign(interactionEvents, {
19074
+ onMouseUp,
19075
+ onMouseDown,
19076
+ onMouseEnter
19077
+ });
19078
+ } else {
19079
+ Object.assign(interactionEvents, {
19080
+ onMouseUp,
19081
+ onMouseDown
19082
+ });
19083
+ }
19084
+
19085
+ return {
19086
+ instantPages,
19087
+ interactionEvents
19088
+ };
19089
+ }
19090
+
19091
+ const tick = props => _objectSpread2(_objectSpread2({}, props), {}, {
19092
+ shapes: [{
19093
+ type: 'path',
19094
+ attrs: {
19095
+ d: 'M6,10 L13,3 L15,5 L8,12 L6,14 L1,9 L3,7 L6,10 Z'
18379
19096
  }
19097
+ }]
19098
+ });
19099
+
19100
+ var Tick = (props => SvgIcon(tick(props)));
19101
+
19102
+ 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\")";
19103
+
19104
+ const useStyles$b = makeStyles$1(theme => ({
19105
+ cbIcon: {
19106
+ borderRadius: 3,
19107
+ width: 16,
19108
+ height: 16,
19109
+ boxShadow: 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)',
19110
+ backgroundColor: '#f5f8fa',
19111
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))'
18380
19112
  },
18381
- A: {
18382
- background: theme.palette.selected.alternative,
18383
- color: theme.palette.selected.alternativeContrastText
19113
+ cbIconChecked: {
19114
+ borderRadius: 3,
19115
+ backgroundColor: theme.palette.selected.main,
19116
+ backgroundImage: 'linear-gradient(180deg,hsla(0,0%,100%,.1),hsla(0,0%,100%,0))',
19117
+ '&:before': {
19118
+ display: 'block',
19119
+ width: 16,
19120
+ height: 16,
19121
+ backgroundImage: CheckboxChecked,
19122
+ content: '""'
19123
+ }
18384
19124
  },
18385
- X: {
18386
- background: theme.palette.selected.excluded,
18387
- color: theme.palette.selected.excludedContrastText
19125
+ checkbox: {
19126
+ margin: 0,
19127
+ '&:hover': {
19128
+ backgroundColor: 'inherit !important'
19129
+ }
18388
19130
  },
18389
- highlighted: {
18390
- backgroundColor: '#FFC72A'
19131
+ dense: {
19132
+ padding: '4px 8px'
18391
19133
  }
18392
19134
  }));
18393
- function Row(_ref) {
19135
+ function ListboxCheckbox(_ref) {
18394
19136
  let {
18395
- index,
18396
- style,
18397
- data
19137
+ checked,
19138
+ label,
19139
+ dense
18398
19140
  } = _ref;
18399
- const classes = useStyles$b();
18400
- const classArr = [classes.row];
18401
- let label = '';
18402
- const {
18403
- onClick,
18404
- pages
18405
- } = data;
18406
- let cell;
18407
-
18408
- if (pages) {
18409
- const page = pages.filter(p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
18410
-
18411
- if (page) {
18412
- const area = page.qArea;
18413
-
18414
- if (index >= area.qTop && index < area.qTop + area.qHeight) {
18415
- [cell] = page.qMatrix[index - area.qTop];
18416
- }
18417
- }
18418
- }
19141
+ const styles = useStyles$b();
19142
+ return /*#__PURE__*/React.createElement(Checkbox$1, {
19143
+ edge: "start",
19144
+ checked: checked,
19145
+ tabIndex: -1,
19146
+ disableRipple: true,
19147
+ className: [styles.checkbox, dense && styles.dense].filter(Boolean).join(' '),
19148
+ inputProps: {
19149
+ 'aria-labelledby': label
19150
+ },
19151
+ name: label,
19152
+ icon: /*#__PURE__*/React.createElement("span", {
19153
+ className: styles.cbIcon
19154
+ }),
19155
+ checkedIcon: /*#__PURE__*/React.createElement("span", {
19156
+ className: styles.cbIconChecked
19157
+ })
19158
+ });
19159
+ }
18419
19160
 
18420
- let locked = false;
18421
- let selected = false;
19161
+ /**
19162
+ * @typedef {object} Range
19163
+ * @property {number} qCharPos The (absolute) index where the highlighted range starts.
19164
+ * @property {number} qCharCount The length of the sub-string (starting from qChartPos) that should be highlighted.
19165
+ */
18422
19166
 
18423
- if (cell) {
18424
- label = cell.qText;
18425
- locked = cell.qState === 'L' || cell.qState === 'XL';
18426
- selected = cell.qState === 'S' || cell.qState === 'XS';
19167
+ /**
19168
+ * @typedef {object} Segment
19169
+ * @property {string} segment The sub-string/segment cut out from the original label.
19170
+ * @property {boolean} highlighted A flag which tells whether the segment should be highlighted or not.
19171
+ */
18427
19172
 
18428
- if (cell.qState === 'S' || cell.qState === 'L') {
18429
- classArr.push(classes.S);
18430
- } else if (cell.qState === 'A') {
18431
- classArr.push(classes.A);
18432
- } else if (cell.qState === 'X' || cell.qState === 'XS' || cell.qState === 'XL') {
18433
- classArr.push(classes.X);
18434
- }
18435
- } // Handle search highlights
19173
+ /**
19174
+ * @param {string} label The label we want to create segments out of.
19175
+ * @param {Range} range The indexes which define how to create the segments.
19176
+ * @param {number=} [startIndex] An optional index which tells where we want to start the first segment from
19177
+ * (only relevant for creating the first unhighlighted segment of a string/sub-string).
19178
+ * @returns {Segment[]} An array of segments.
19179
+ */
19180
+ function getSegmentsFromRange(label, range) {
19181
+ let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
19182
+ const {
19183
+ qCharPos,
19184
+ qCharCount
19185
+ } = range;
19186
+ const segments = [];
18436
19187
 
19188
+ if (qCharPos > startIndex) {
19189
+ // Create a non-highlighted section before the highighted section.
19190
+ segments.push([label.slice(startIndex, qCharPos), false]);
19191
+ } // Highlighted segment.
18437
19192
 
18438
- const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
18439
- const labels = ranges.reduce((acc, curr, ix) => {
18440
- // First non highlighted segment
18441
- if (curr.qCharPos > 0 && ix === 0) {
18442
- acc.push([label.slice(0, curr.qCharPos)]);
18443
- } // Previous non highlighted segment
18444
19193
 
19194
+ segments.push([label.slice(qCharPos, qCharPos + qCharCount), true]);
19195
+ return segments;
19196
+ }
19197
+ /**
19198
+ * @param {string} label The label we want to create segments out of.
19199
+ * @param {Range[]} ranges The ranges defining indices for cutting the string into segments.
19200
+ * @returns {Segment[]} An array of segments, covering the entire string label.
19201
+ */
18445
19202
 
18446
- const prev = ranges[ix - 1];
18447
19203
 
18448
- if (prev) {
18449
- acc.push([label.slice(prev.qCharPos + prev.qCharPos + 1, curr.qCharPos)]);
18450
- } // Highlighted segment
19204
+ function getSegmentsFromRanges(label, ranges) {
19205
+ if (!ranges.length) {
19206
+ return [];
19207
+ }
18451
19208
 
19209
+ const labels = ranges.reduce((acc, curr, ix) => {
19210
+ const startIndex = ix === 0 ? 0 : ranges[ix - 1].qCharPos + ranges[ix - 1].qCharCount;
19211
+ acc.push(...getSegmentsFromRange(label, curr, startIndex)); // Last non highlighted segment
18452
19212
 
18453
- acc.push([label.slice(curr.qCharPos, curr.qCharPos + curr.qCharCount), classes.highlighted]); // Last non highlighted segment
19213
+ const isLastRange = ix === ranges.length - 1;
19214
+ const endIndex = ranges[ix].qCharPos + ranges[ix].qCharCount;
18454
19215
 
18455
- if (ix === ranges.length - 1 && curr.qCharPos + curr.qCharCount < label.length) {
18456
- acc.push([label.slice(curr.qCharPos + curr.qCharCount)]);
19216
+ if (isLastRange && endIndex < label.length) {
19217
+ acc.push([label.slice(endIndex), false]);
18457
19218
  }
18458
19219
 
18459
19220
  return acc;
18460
19221
  }, []);
18461
- return /*#__PURE__*/React.createElement(Grid$1, {
18462
- container: true,
18463
- spacing: 0,
18464
- className: classArr.join(' ').trim(),
18465
- style: style,
18466
- onClick: onClick,
18467
- role: "row",
18468
- tabIndex: 0,
18469
- "data-n": cell && cell.qElemNumber
18470
- }, /*#__PURE__*/React.createElement(Grid$1, {
18471
- item: true,
18472
- style: {
18473
- minWidth: 0,
18474
- flexGrow: 1
18475
- },
18476
- className: classes.cell,
18477
- title: "".concat(label)
18478
- }, ranges.length === 0 ? /*#__PURE__*/React.createElement(Typography$1, {
18479
- component: "span",
18480
- noWrap: true,
18481
- color: "inherit"
18482
- }, "".concat(label)) : labels.map((_ref2, ix) => {
18483
- let [l, highlighted] = _ref2;
18484
- return (
18485
- /*#__PURE__*/
18486
- // eslint-disable-next-line react/no-array-index-key
18487
- React.createElement(Typography$1, {
18488
- component: "span",
18489
- key: ix,
18490
- className: highlighted,
18491
- noWrap: true
18492
- }, l)
18493
- );
18494
- })), /*#__PURE__*/React.createElement(Grid$1, {
18495
- item: true,
18496
- className: classes.icon
18497
- }, locked && /*#__PURE__*/React.createElement(Lock, {
18498
- size: "small"
18499
- }), selected && /*#__PURE__*/React.createElement(Tick, {
18500
- size: "small"
18501
- })));
19222
+ return labels;
18502
19223
  }
18503
19224
 
19225
+ const ellipsis = {
19226
+ width: '100%',
19227
+ overflow: 'hidden',
19228
+ textOverflow: 'ellipsis'
19229
+ };
18504
19230
  const useStyles$a = makeStyles$1(theme => ({
19231
+ row: {
19232
+ flexWrap: 'nowrap',
19233
+ borderBottom: "1px solid ".concat(theme.palette.divider),
19234
+ color: theme.palette.text.primary,
19235
+ '&:focus': {
19236
+ boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusOutline),
19237
+ outline: 'none'
19238
+ }
19239
+ },
18505
19240
  column: {
18506
19241
  flexWrap: 'nowrap',
18507
19242
  borderRight: "1px solid ".concat(theme.palette.divider),
19243
+ color: theme.palette.text.primary,
18508
19244
  '&:focus': {
18509
19245
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusOutline),
18510
19246
  outline: 'none'
18511
19247
  }
18512
19248
  },
19249
+ // The interior wrapper for all field content.
18513
19250
  cell: {
18514
- padding: '8px',
18515
- '& span': {
18516
- whiteSpace: 'nowrap',
18517
- fontSize: '12px',
18518
- lineHeight: '16px'
18519
- },
18520
- overflow: 'hidden',
18521
- textOverflow: 'ellipsis'
19251
+ display: 'flex',
19252
+ alignItems: 'center',
19253
+ minWidth: 0,
19254
+ flexGrow: 1,
19255
+ // Note that this padding is overridden when using checkboxes.
19256
+ paddingLeft: '12px',
19257
+ paddingRight: '12px'
19258
+ },
19259
+ // The leaf node, containing the label text.
19260
+ labelText: _objectSpread2({
19261
+ flexBasis: 'max-content',
19262
+ lineHeight: '16px',
19263
+ userSelect: 'none',
19264
+ whiteSpace: 'pre'
19265
+ }, ellipsis),
19266
+ labelDense: {
19267
+ fontSize: 12
19268
+ },
19269
+ // Highlight is added to labelText spans, which are created as siblings to original labelText,
19270
+ // when a search string is matched.
19271
+ highlighted: {
19272
+ overflow: 'visible',
19273
+ width: '100%',
19274
+ '& > span': {
19275
+ width: '100%',
19276
+ backgroundColor: '#FFC72A'
19277
+ }
19278
+ },
19279
+ // Checkbox and label container.
19280
+ checkboxLabel: {
19281
+ margin: 0,
19282
+ width: '100%',
19283
+ // For checkboxes the first child is the checkbox container, second is the label container.
19284
+ '& > span:nth-child(2)': _objectSpread2({}, ellipsis)
18522
19285
  },
19286
+ // The icons container holding tick and lock, shown inside fields.
18523
19287
  icon: {
19288
+ display: 'flex',
18524
19289
  padding: theme.spacing(1)
18525
19290
  },
19291
+ // Selection styles (S=Selected, A=Available, X=Excluded).
18526
19292
  S: {
18527
19293
  background: theme.palette.selected.main,
18528
19294
  color: theme.palette.selected.mainContrastText,
@@ -18538,135 +19304,232 @@
18538
19304
  X: {
18539
19305
  background: theme.palette.selected.excluded,
18540
19306
  color: theme.palette.selected.excludedContrastText
18541
- },
18542
- highlighted: {
18543
- backgroundColor: '#FFC72A'
18544
19307
  }
18545
19308
  }));
18546
- function Column(_ref) {
19309
+ function RowColumn(_ref) {
18547
19310
  let {
18548
19311
  index,
18549
19312
  style,
18550
- data
19313
+ data,
19314
+ column = false
18551
19315
  } = _ref;
18552
- const classes = useStyles$a();
18553
- const classArr = [classes.column];
18554
- let label = '';
18555
19316
  const {
18556
19317
  onClick,
18557
- pages
19318
+ onMouseDown,
19319
+ onMouseUp,
19320
+ onMouseEnter,
19321
+ pages,
19322
+ isLocked,
19323
+ checkboxes = false,
19324
+ dense = false
18558
19325
  } = data;
18559
- let cell;
19326
+ const [isSelected, setSelected] = react.exports.useState(false);
19327
+ const [cell, setCell] = react.exports.useState();
19328
+ const classes = useStyles$a();
19329
+ const [classArr, setClassArr] = react.exports.useState([]);
19330
+ react.exports.useEffect(() => {
19331
+ if (!pages) {
19332
+ return;
19333
+ }
18560
19334
 
18561
- if (pages) {
19335
+ let c;
18562
19336
  const page = pages.filter(p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
18563
19337
 
18564
19338
  if (page) {
18565
19339
  const area = page.qArea;
18566
19340
 
18567
19341
  if (index >= area.qTop && index < area.qTop + area.qHeight) {
18568
- [cell] = page.qMatrix[index - area.qTop];
19342
+ [c] = page.qMatrix[index - area.qTop];
18569
19343
  }
18570
19344
  }
18571
- }
18572
-
18573
- let locked = false;
18574
- let selected = false;
18575
19345
 
18576
- if (cell) {
18577
- label = cell.qText;
18578
- locked = cell.qState === 'L' || cell.qState === 'XL';
18579
- selected = cell.qState === 'S' || cell.qState === 'XS';
18580
-
18581
- if (cell.qState === 'S' || cell.qState === 'L') {
18582
- classArr.push(classes.S);
18583
- } else if (cell.qState === 'A') {
18584
- classArr.push(classes.A);
18585
- } else if (cell.qState === 'X' || cell.qState === 'XS' || cell.qState === 'XL') {
18586
- classArr.push(classes.X);
19346
+ setCell(c);
19347
+ }, [pages]);
19348
+ react.exports.useEffect(() => {
19349
+ if (!cell) {
19350
+ return;
18587
19351
  }
18588
- } // Handle search highlights
18589
19352
 
19353
+ const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
19354
+ setSelected(selected);
19355
+ const clazzArr = [column ? classes.column : classes.row];
18590
19356
 
18591
- const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
18592
- const labels = ranges.reduce((acc, curr, ix) => {
18593
- // First non highlighted segment
18594
- if (curr.qCharPos > 0 && ix === 0) {
18595
- acc.push([label.slice(0, curr.qCharPos)]);
18596
- } // Previous non highlighted segment
19357
+ if (!checkboxes) {
19358
+ if (cell.qState === 'S' || cell.qState === 'L') {
19359
+ clazzArr.push(classes.S);
19360
+ } else if (cell.qState === 'A') {
19361
+ clazzArr.push(classes.A);
19362
+ } else if (cell.qState === 'X' || cell.qState === 'XS' || cell.qState === 'XL') {
19363
+ clazzArr.push(classes.X);
19364
+ }
19365
+ }
18597
19366
 
19367
+ setClassArr(clazzArr);
19368
+ }, [cell && cell.qState]);
18598
19369
 
18599
- const prev = ranges[ix - 1];
19370
+ const getValueField = _ref2 => {
19371
+ let {
19372
+ lbl,
19373
+ ix,
19374
+ color,
19375
+ highlighted = false
19376
+ } = _ref2;
19377
+ return /*#__PURE__*/React.createElement(Typography$1, {
19378
+ component: "span",
19379
+ variant: "body2",
19380
+ key: ix,
19381
+ className: [classes.labelText, highlighted && classes.highlighted, dense && classes.labelDense].filter(c => !!c).join(' ').trim(),
19382
+ color: color
19383
+ }, /*#__PURE__*/React.createElement("span", {
19384
+ style: {
19385
+ whiteSpace: 'pre'
19386
+ }
19387
+ }, lbl));
19388
+ };
18600
19389
 
18601
- if (prev) {
18602
- acc.push([label.slice(prev.qCharPos + prev.qCharPos + 1, curr.qCharPos)]);
18603
- } // Highlighted segment
19390
+ const getCheckboxField = _ref3 => {
19391
+ let {
19392
+ lbl,
19393
+ color,
19394
+ qElemNumber
19395
+ } = _ref3;
19396
+ const cb = /*#__PURE__*/React.createElement(ListboxCheckbox, {
19397
+ label: lbl,
19398
+ checked: isSelected,
19399
+ dense: dense
19400
+ });
19401
+ const labelTag = typeof lbl === 'string' ? getValueField({
19402
+ lbl,
19403
+ color,
19404
+ highlighted: false
19405
+ }) : lbl;
19406
+ return /*#__PURE__*/React.createElement(FormControlLabel$1, {
19407
+ color: color,
19408
+ control: cb,
19409
+ className: classes.checkboxLabel,
19410
+ label: labelTag,
19411
+ key: qElemNumber
19412
+ });
19413
+ };
18604
19414
 
19415
+ const label = cell ? cell.qText : ''; // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
18605
19416
 
18606
- acc.push([label.slice(curr.qCharPos, curr.qCharPos + curr.qCharCount), classes.highlighted]); // Last non highlighted segment
19417
+ const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
19418
+ const labels = getSegmentsFromRanges(label, ranges);
19419
+ const getField = checkboxes ? getCheckboxField : getValueField;
18607
19420
 
18608
- if (ix === ranges.length - 1 && curr.qCharPos + curr.qCharCount < label.length) {
18609
- acc.push([label.slice(curr.qCharPos + curr.qCharCount)]);
18610
- }
19421
+ const getFieldWithRanges = _ref4 => {
19422
+ let {
19423
+ lbls
19424
+ } = _ref4;
19425
+ const labelsWithRanges = lbls.map((_ref5, ix) => {
19426
+ let [lbl, highlighted] = _ref5;
19427
+ return getValueField({
19428
+ ix,
19429
+ highlighted,
19430
+ lbl
19431
+ });
19432
+ });
19433
+ return checkboxes ? getCheckboxField({
19434
+ lbl: labelsWithRanges
19435
+ }) : labelsWithRanges;
19436
+ };
18611
19437
 
18612
- return acc;
18613
- }, []);
19438
+ const iconStyles = {
19439
+ alignItems: 'center',
19440
+ display: 'flex'
19441
+ };
19442
+ const showLock = isSelected && isLocked;
19443
+ const showTick = !checkboxes && isSelected && !isLocked;
19444
+ const cellStyle = {
19445
+ display: 'flex',
19446
+ alignItems: 'center',
19447
+ minWidth: 0,
19448
+ flexGrow: 1,
19449
+ padding: checkboxes ? 0 : undefined
19450
+ };
18614
19451
  return /*#__PURE__*/React.createElement(Grid$1, {
18615
19452
  container: true,
18616
19453
  spacing: 0,
18617
- className: classArr.join(' ').trim(),
19454
+ className: ['value', ...classArr].join(' ').trim(),
18618
19455
  style: style,
18619
19456
  onClick: onClick,
18620
- alignItems: "center",
18621
- role: "row",
19457
+ onMouseDown: onMouseDown,
19458
+ onMouseUp: onMouseUp,
19459
+ onMouseEnter: onMouseEnter,
19460
+ role: column ? 'column' : 'row',
18622
19461
  tabIndex: 0,
18623
19462
  "data-n": cell && cell.qElemNumber
18624
19463
  }, /*#__PURE__*/React.createElement(Grid$1, {
18625
19464
  item: true,
18626
- style: {
18627
- minWidth: 0,
18628
- flexGrow: 1
18629
- },
19465
+ style: cellStyle,
18630
19466
  className: classes.cell,
18631
19467
  title: "".concat(label)
18632
- }, ranges.length === 0 ? /*#__PURE__*/React.createElement(Typography$1, {
18633
- component: "span",
18634
- noWrap: true,
18635
- color: "inherit"
18636
- }, "".concat(label)) : labels.map((_ref2, ix) => {
18637
- let [l, highlighted] = _ref2;
18638
- return (
18639
- /*#__PURE__*/
18640
- // eslint-disable-next-line react/no-array-index-key
18641
- React.createElement(Typography$1, {
18642
- component: "span",
18643
- key: ix,
18644
- className: highlighted,
18645
- noWrap: true
18646
- }, l)
18647
- );
18648
- })), /*#__PURE__*/React.createElement(Grid$1, {
19468
+ }, ranges.length === 0 ? getField({
19469
+ lbl: label,
19470
+ color: 'inherit'
19471
+ }) : getFieldWithRanges({
19472
+ lbls: labels
19473
+ })), (showLock || showTick) && /*#__PURE__*/React.createElement(Grid$1, {
18649
19474
  item: true,
18650
19475
  className: classes.icon
18651
- }, locked && /*#__PURE__*/React.createElement(Lock, {
19476
+ }, showLock && /*#__PURE__*/React.createElement(Lock, {
19477
+ style: iconStyles,
18652
19478
  size: "small"
18653
- }), selected && /*#__PURE__*/React.createElement(Tick, {
19479
+ }), showTick && /*#__PURE__*/React.createElement(Tick, {
19480
+ style: iconStyles,
18654
19481
  size: "small"
18655
19482
  })));
18656
19483
  }
18657
19484
 
18658
- /* eslint no-underscore-dangle:0 */
18659
- function ListBox(_ref) {
19485
+ function getSizeInfo(_ref) {
19486
+ let {
19487
+ isVertical,
19488
+ checkboxes,
19489
+ dense,
19490
+ height
19491
+ } = _ref;
19492
+ let sizeVertical = checkboxes ? 40 : 33;
19493
+
19494
+ if (dense) {
19495
+ sizeVertical = 24;
19496
+ }
19497
+
19498
+ const itemSize = isVertical ? sizeVertical : 200;
19499
+ const listHeight = height || 8 * itemSize;
19500
+ return {
19501
+ itemSize,
19502
+ listHeight
19503
+ };
19504
+ }
19505
+
19506
+ function ListBox(_ref2) {
18660
19507
  let {
18661
19508
  model,
18662
19509
  selections,
18663
19510
  direction,
18664
19511
  height,
18665
19512
  width,
18666
- listLayout = 'vertical'
18667
- } = _ref;
19513
+ listLayout = 'vertical',
19514
+ rangeSelect = true,
19515
+ checkboxes = false,
19516
+ update = undefined,
19517
+ dense = false
19518
+ } = _ref2;
18668
19519
  const [layout] = useLayout$1(model);
18669
19520
  const [pages, setPages] = react.exports.useState(null);
19521
+ const [isLoadingData, setIsLoadingData] = react.exports.useState(false);
19522
+ const {
19523
+ instantPages = [],
19524
+ interactionEvents
19525
+ } = useSelectionsInteractions({
19526
+ layout,
19527
+ selections,
19528
+ pages,
19529
+ rangeSelect,
19530
+ checkboxes,
19531
+ doc: document
19532
+ });
18670
19533
  const loaderRef = react.exports.useRef(null);
18671
19534
  const local = react.exports.useRef({
18672
19535
  queue: [],
@@ -18675,28 +19538,17 @@
18675
19538
  const listData = react.exports.useRef({
18676
19539
  pages: []
18677
19540
  });
18678
- const onClick = react.exports.useCallback(e => {
18679
- if (layout && layout.qListObject.qDimensionInfo.qLocked) {
18680
- return;
18681
- }
18682
-
18683
- const elemNumber = +e.currentTarget.getAttribute('data-n');
18684
-
18685
- if (!Number.isNaN(elemNumber)) {
18686
- selections.select({
18687
- method: 'selectListObjectValues',
18688
- params: ['/qListObjectDef', [elemNumber], !layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]
18689
- });
18690
- }
18691
- }, [model, layout && !!layout.qListObject.qDimensionInfo.qLocked, layout && !!layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
18692
19541
  const isItemLoaded = react.exports.useCallback(index => {
18693
19542
  if (!pages || !local.current.validPages) {
18694
19543
  return false;
18695
19544
  }
18696
19545
 
18697
19546
  local.current.checkIdx = index;
18698
- const page = pages.filter(p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight)[0];
18699
- return page && page.qArea.qTop <= index && index < page.qArea.qTop + page.qArea.qHeight;
19547
+
19548
+ const isLoaded = p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight;
19549
+
19550
+ const page = pages.filter(p => isLoaded(p))[0];
19551
+ return page && isLoaded(page);
18700
19552
  }, [layout, pages]);
18701
19553
  const loadMoreItems = react.exports.useCallback((startIndex, stopIndex) => {
18702
19554
  local.current.queue.push({
@@ -18710,6 +19562,7 @@
18710
19562
  }
18711
19563
 
18712
19564
  clearTimeout(local.current.timeout);
19565
+ setIsLoadingData(true);
18713
19566
  return new Promise(resolve => {
18714
19567
  local.current.timeout = setTimeout(() => {
18715
19568
  const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
@@ -18722,12 +19575,14 @@
18722
19575
  local.current.validPages = true;
18723
19576
  listData.current.pages = p;
18724
19577
  setPages(p);
19578
+ setIsLoadingData(false);
18725
19579
  resolve();
18726
19580
  });
18727
19581
  }, isScrolling ? 500 : 0);
18728
19582
  });
18729
19583
  }, [layout]);
18730
- react.exports.useEffect(() => {
19584
+
19585
+ const fetchData = () => {
18731
19586
  local.current.queue = [];
18732
19587
  local.current.validPages = false;
18733
19588
 
@@ -18740,7 +19595,23 @@
18740
19595
 
18741
19596
  loaderRef.current._listRef.scrollToItem(0);
18742
19597
  }
19598
+ };
19599
+
19600
+ if (update) {
19601
+ // Hand over the update function for manual refresh from hosting application.
19602
+ update.call(null, fetchData);
19603
+ }
19604
+
19605
+ react.exports.useEffect(() => {
19606
+ fetchData();
18743
19607
  }, [layout]);
19608
+ react.exports.useEffect(() => {
19609
+ if (!instantPages || isLoadingData) {
19610
+ return;
19611
+ }
19612
+
19613
+ setPages(instantPages);
19614
+ }, [instantPages]);
18744
19615
 
18745
19616
  if (!layout) {
18746
19617
  return null;
@@ -18748,8 +19619,16 @@
18748
19619
 
18749
19620
  const isVertical = listLayout !== 'horizontal';
18750
19621
  const count = layout.qListObject.qSize.qcy;
18751
- const ITEM_SIZE = isVertical ? 33 : 200;
18752
- const listHeight = height || 8 * ITEM_SIZE;
19622
+ const {
19623
+ itemSize,
19624
+ listHeight
19625
+ } = getSizeInfo({
19626
+ isVertical,
19627
+ checkboxes,
19628
+ dense,
19629
+ height
19630
+ });
19631
+ const isLocked = layout && layout.qListObject.qDimensionInfo.qLocked;
18753
19632
  return /*#__PURE__*/React.createElement(InfiniteLoader, {
18754
19633
  isItemLoaded: isItemLoaded,
18755
19634
  itemCount: count,
@@ -18757,28 +19636,33 @@
18757
19636
  threshold: 0,
18758
19637
  minimumBatchSize: 100,
18759
19638
  ref: loaderRef
18760
- }, _ref2 => {
19639
+ }, _ref3 => {
18761
19640
  let {
18762
19641
  onItemsRendered,
18763
19642
  ref
18764
- } = _ref2;
19643
+ } = _ref3;
18765
19644
  local.current.listRef = ref;
18766
19645
  return /*#__PURE__*/React.createElement(FixedSizeList, {
18767
19646
  direction: direction,
19647
+ "data-testid": "fixed-size-list",
18768
19648
  useIsScrolling: true,
18769
19649
  style: {},
18770
19650
  height: listHeight,
18771
19651
  width: width,
18772
19652
  itemCount: count,
18773
19653
  layout: listLayout,
18774
- itemData: {
18775
- onClick,
19654
+ itemData: _objectSpread2(_objectSpread2({
19655
+ isLocked,
19656
+ column: !isVertical,
18776
19657
  pages
18777
- },
18778
- itemSize: ITEM_SIZE,
19658
+ }, isLocked ? {} : interactionEvents), {}, {
19659
+ checkboxes,
19660
+ dense
19661
+ }),
19662
+ itemSize: itemSize,
18779
19663
  onItemsRendered: onItemsRendered,
18780
19664
  ref: ref
18781
- }, isVertical ? Row : Column);
19665
+ }, RowColumn);
18782
19666
  });
18783
19667
  }
18784
19668
 
@@ -19353,13 +20237,22 @@
19353
20237
  borderRadius: 0,
19354
20238
  borderColor: "".concat(theme.palette.divider, " transparent")
19355
20239
  }
20240
+ },
20241
+ dense: {
20242
+ fontSize: 12,
20243
+ paddingLeft: theme.spacing(1),
20244
+ '& input': {
20245
+ paddingTop: '5px',
20246
+ paddingBottom: '5px'
20247
+ }
19356
20248
  }
19357
20249
  }));
19358
20250
  const TREE_PATH = '/qListObjectDef';
19359
20251
  function ListBoxSearch(_ref) {
19360
20252
  let {
19361
20253
  model,
19362
- autoFocus = true
20254
+ autoFocus = true,
20255
+ dense = false
19363
20256
  } = _ref;
19364
20257
  const {
19365
20258
  translator
@@ -19388,8 +20281,10 @@
19388
20281
  return /*#__PURE__*/React.createElement(OutlinedInput$1, {
19389
20282
  startAdornment: /*#__PURE__*/React.createElement(InputAdornment$1, {
19390
20283
  position: "start"
19391
- }, /*#__PURE__*/React.createElement(Search, null)),
19392
- className: [classes.root].join(' '),
20284
+ }, /*#__PURE__*/React.createElement(Search, {
20285
+ size: dense ? 'small' : 'normal'
20286
+ })),
20287
+ className: ['search', classes.root, dense && classes.dense].filter(Boolean).join(' '),
19393
20288
  autoFocus: autoFocus,
19394
20289
  margin: "dense",
19395
20290
  fullWidth: true,
@@ -21000,7 +21895,14 @@
21000
21895
  direction,
21001
21896
  listLayout,
21002
21897
  search = true,
21003
- properties = {}
21898
+ toolbar = true,
21899
+ rangeSelect = true,
21900
+ checkboxes = false,
21901
+ properties = {},
21902
+ sessionModel = undefined,
21903
+ selectionsApi = undefined,
21904
+ update = undefined,
21905
+ dense = false
21004
21906
  } = options;
21005
21907
 
21006
21908
  const listdef = _objectSpread2({
@@ -21026,9 +21928,10 @@
21026
21928
  }
21027
21929
  },
21028
21930
  title
21029
- }, properties);
21931
+ }, properties); // Something something lib dimension
21932
+
21030
21933
 
21031
- let fieldName; // Something something lib dimension
21934
+ let fieldName;
21032
21935
 
21033
21936
  if (fieldIdentifier.qLibraryId) {
21034
21937
  listdef.qListObjectDef.qLibraryId = fieldIdentifier.qLibraryId;
@@ -21038,8 +21941,19 @@
21038
21941
  fieldName = fieldIdentifier;
21039
21942
  }
21040
21943
 
21944
+ let [model] = useSessionModel(listdef, sessionModel ? null : app, fieldName, stateName);
21945
+
21946
+ if (sessionModel) {
21947
+ model = sessionModel;
21948
+ }
21949
+
21950
+ let selections = useObjectSelections(selectionsApi ? {} : app, model)[0];
21951
+
21952
+ if (selectionsApi) {
21953
+ selections = selectionsApi;
21954
+ }
21955
+
21041
21956
  const theme = useTheme$2();
21042
- const [model] = useSessionModel(listdef, app, fieldName, stateName);
21043
21957
  const lock = react.exports.useCallback(() => {
21044
21958
  model.lock('/qListObjectDef');
21045
21959
  }, [model]);
@@ -21050,7 +21964,6 @@
21050
21964
  translator
21051
21965
  } = react.exports.useContext(InstanceContext);
21052
21966
  const moreAlignTo = react.exports.useRef();
21053
- const [selections] = useObjectSelections(app, model);
21054
21967
  const [layout] = useLayout$1(model);
21055
21968
  const [showToolbar, setShowToolbar] = react.exports.useState(false);
21056
21969
  react.exports.useEffect(() => {
@@ -21076,11 +21989,11 @@
21076
21989
  }
21077
21990
 
21078
21991
  const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
21079
- const listboxSelectionToolbarItems = createListboxSelectionToolbar({
21992
+ const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
21080
21993
  layout,
21081
21994
  model,
21082
21995
  translator
21083
- });
21996
+ }) : [];
21084
21997
  const counts = layout.qListObject.qDimensionInfo.qStateCounts;
21085
21998
  const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
21086
21999
  const minHeight = 49 + (search ? 40 : 0) + 49;
@@ -21092,7 +22005,7 @@
21092
22005
  height: '100%',
21093
22006
  minHeight: "".concat(minHeight, "px")
21094
22007
  }
21095
- }, /*#__PURE__*/React.createElement(Grid$1, {
22008
+ }, toolbar && /*#__PURE__*/React.createElement(Grid$1, {
21096
22009
  item: true,
21097
22010
  container: true,
21098
22011
  style: {
@@ -21140,7 +22053,8 @@
21140
22053
  item: true
21141
22054
  }, /*#__PURE__*/React.createElement(ListBoxSearch, {
21142
22055
  model: model,
21143
- autoFocus: false
22056
+ autoFocus: false,
22057
+ dense: dense
21144
22058
  })) : '', /*#__PURE__*/React.createElement(Grid$1, {
21145
22059
  item: true,
21146
22060
  xs: true
@@ -21156,8 +22070,12 @@
21156
22070
  selections: selections,
21157
22071
  direction: direction,
21158
22072
  listLayout: listLayout,
22073
+ rangeSelect: rangeSelect,
22074
+ checkboxes: checkboxes,
21159
22075
  height: height,
21160
- width: width
22076
+ width: width,
22077
+ update: update,
22078
+ dense: dense
21161
22079
  });
21162
22080
  })));
21163
22081
  }
@@ -21398,10 +22316,10 @@
21398
22316
  /**
21399
22317
  * @since 1.1.0
21400
22318
  * @interface ExportDataDef
21401
- * @property {qae.NxDimension[]} dimensions
21402
- * @property {qae.NxMeasure[]} measures
21403
- * @property {qae.NxDimension[]} excludedDimensions
21404
- * @property {qae.NxMeasure[]} excludedMeasures
22319
+ * @property {EngineAPI.INxDimension[]} dimensions
22320
+ * @property {EngineAPI.INxMeasure[]} measures
22321
+ * @property {EngineAPI.INxDimension[]} excludedDimensions
22322
+ * @property {EngineAPI.INxMeasure[]} excludedMeasures
21405
22323
  * @property {number[]} interColumnSortOrder
21406
22324
  */
21407
22325
 
@@ -22845,10 +23763,16 @@
22845
23763
 
22846
23764
  }
22847
23765
 
23766
+ /**
23767
+ * @interface VizElementAttributes
23768
+ * @extends NamedNodeMap
23769
+ * @property {string} data-render-count
23770
+ */
23771
+
22848
23772
  /**
22849
23773
  * @interface
22850
23774
  * @extends HTMLElement
22851
- * @property {string} attributes.data-render-count
23775
+ * @property {VizElementAttributes} attributes
22852
23776
  */
22853
23777
 
22854
23778
  const VizElement = {
@@ -23292,6 +24216,9 @@
23292
24216
  const {
23293
24217
  nebbie
23294
24218
  } = halo.public;
24219
+ const {
24220
+ disableCellPadding = false
24221
+ } = halo.context || {};
23295
24222
  const {
23296
24223
  translator,
23297
24224
  language,
@@ -23551,12 +24478,13 @@
23551
24478
  container: true,
23552
24479
  direction: "column",
23553
24480
  spacing: 0,
23554
- style: _objectSpread2({
24481
+ style: _objectSpread2(_objectSpread2({
23555
24482
  position: 'relative',
23556
24483
  width: '100%',
23557
- height: '100%',
24484
+ height: '100%'
24485
+ }, !disableCellPadding ? {
23558
24486
  padding: theme.spacing(1)
23559
- }, state.longRunningQuery ? {
24487
+ } : {}), state.longRunningQuery ? {
23560
24488
  opacity: '0.3'
23561
24489
  } : {})
23562
24490
  }, cellNode && layout && state.sn && /*#__PURE__*/React.createElement(Header, {
@@ -23898,7 +24826,7 @@
23898
24826
  }
23899
24827
 
23900
24828
  /**
23901
- * @typedef {string | qae.NxDimension | qae.NxMeasure | LibraryField} Field
24829
+ * @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
23902
24830
  */
23903
24831
 
23904
24832
  /**
@@ -23906,9 +24834,9 @@
23906
24834
  * @description Rendering configuration for creating and rendering a new object
23907
24835
  * @extends BaseConfig
23908
24836
  * @property {string} type
23909
- * @property {string} version
24837
+ * @property {string=} version
23910
24838
  * @property {(Field[])=} fields
23911
- * @property {qae.GenericObjectProperties=} properties
24839
+ * @property {EngineAPI.IGenericObjectProperties=} properties
23912
24840
  */
23913
24841
 
23914
24842
  async function createSessionObject(_ref, halo) {
@@ -25081,7 +26009,7 @@
25081
26009
  /**
25082
26010
  * Gets the layout of the generic object associated with this visualization.
25083
26011
  * @entry
25084
- * @returns {qae.GenericObjectLayout}
26012
+ * @returns {EngineAPI.IGenericObjectLayout}
25085
26013
  * @example
25086
26014
  * import { useLayout } from '@nebula.js/stardust';
25087
26015
  * // ...
@@ -25101,7 +26029,7 @@
25101
26029
  * The returned value from `useStaleLayout()` and `useLayout()` are identical when the object
25102
26030
  * is not in a modal state.
25103
26031
  * @entry
25104
- * @returns {qae.GenericObjectLayout}
26032
+ * @returns {EngineAPI.IGenericObjectLayout}
25105
26033
  * @example
25106
26034
  * import { useStaleLayout } from '@nebula.js/stardust';
25107
26035
  * // ...
@@ -25124,7 +26052,7 @@
25124
26052
  /**
25125
26053
  * Gets the layout of the app associated with this visualization.
25126
26054
  * @entry
25127
- * @returns {qae.NxAppLayout} The app layout
26055
+ * @returns {EngineAPI.INxAppLayout} The app layout
25128
26056
  * @example
25129
26057
  * import { useAppLayout } from '@nebula.js/stardust';
25130
26058
  * // ...
@@ -25138,7 +26066,7 @@
25138
26066
  /**
25139
26067
  * Gets the generic object API of the generic object connected to this visualization.
25140
26068
  * @entry
25141
- * @returns {enigma.GenericObject|undefined}
26069
+ * @returns {EngineAPI.IGenericObject|undefined}
25142
26070
  * @example
25143
26071
  * import { useModel } from '@nebula.js/stardust';
25144
26072
  * // ...
@@ -25157,7 +26085,7 @@
25157
26085
  /**
25158
26086
  * Gets the doc API.
25159
26087
  * @entry
25160
- * @returns {enigma.Doc|undefined} The doc API.
26088
+ * @returns {EngineAPI.IApp|undefined} The doc API.
25161
26089
  * @example
25162
26090
  * import { useApp } from '@nebula.js/stardust';
25163
26091
  * // ...
@@ -25176,7 +26104,7 @@
25176
26104
  /**
25177
26105
  * Gets the global API.
25178
26106
  * @entry
25179
- * @returns {enigma.Global|undefined} The global API.
26107
+ * @returns {EngineAPI.IGlobal|undefined} The global API.
25180
26108
  * @example
25181
26109
  * import { useGlobal } from '@nebula.js/stardust';
25182
26110
  *
@@ -25381,9 +26309,11 @@
25381
26309
  * @example
25382
26310
  * // configure embed to disallow active interactions when rendering
25383
26311
  * embed(app, {
25384
- * constraints: {
25385
- * active: true, // do not allow interactions
25386
- * }
26312
+ * context: {
26313
+ * constraints: {
26314
+ * active: true, // do not allow interactions
26315
+ * }
26316
+ * }
25387
26317
  * }).render({ element, id: 'sdfsdf' });
25388
26318
  *
25389
26319
  * @example
@@ -25501,7 +26431,7 @@
25501
26431
  /**
25502
26432
  * Registers a callback that is called when a snapshot is taken.
25503
26433
  * @entry
25504
- * @param {function(qae.GenericObjectLayout): Promise<qae.GenericObjectLayout>} snapshotCallback
26434
+ * @param {function(EngineAPI.IGenericObjectLayout): Promise<EngineAPI.IGenericObjectLayout>} snapshotCallback
25505
26435
  * @example
25506
26436
  * import { onTakeSnapshot } from '@nebula.js/stardust';
25507
26437
  * import { useState } from '@nebula.js/stardust';
@@ -25527,13 +26457,19 @@
25527
26457
 
25528
26458
  h.fn = cb;
25529
26459
  }
26460
+ /**
26461
+ * @interface RenderState
26462
+ * @property {any} pending
26463
+ * @property {any} restore
26464
+ */
26465
+
25530
26466
  /**
25531
26467
  * Gets render state instance.
25532
26468
  *
25533
26469
  * Used to update properties and get a new layout without triggering onInitialRender.
25534
26470
  * @entry
25535
26471
  * @experimental
25536
- * @returns {{ pending, restore }} The render state.
26472
+ * @returns {RenderState} The render state.
25537
26473
  * @example
25538
26474
  * import { useRenderState } from '@nebula.js/stardust';
25539
26475
  *
@@ -26093,7 +27029,7 @@
26093
27029
 
26094
27030
  /**
26095
27031
  * @interface QAEDefinition
26096
- * @property {qae.GenericObjectProperties=} properties
27032
+ * @property {EngineAPI.IGenericObjectProperties=} properties
26097
27033
  * @property {object=} data
26098
27034
  * @property {DataTarget[]} data.targets
26099
27035
  * @property {importProperties=} importProperties
@@ -26103,8 +27039,23 @@
26103
27039
  /**
26104
27040
  * @interface DataTarget
26105
27041
  * @property {string} path
26106
- * @property {FieldTarget<qae.NxDimension>=} dimensions
26107
- * @property {FieldTarget<qae.NxMeasure>=} measures
27042
+ * @property {FieldTarget<EngineAPI.INxDimension>=} dimensions
27043
+ * @property {FieldTarget<EngineAPI.INxMeasure>=} measures
27044
+ */
27045
+
27046
+ /**
27047
+ * @callback fieldTargetAddedCallback
27048
+ * @template T
27049
+ * @param {T} field
27050
+ * @param {EngineAPI.IGenericObjectProperties} properties
27051
+ */
27052
+
27053
+ /**
27054
+ * @callback fieldTargetRemovedCallback
27055
+ * @template T
27056
+ * @param {T} field
27057
+ * @param {EngineAPI.IGenericObjectProperties} properties
27058
+ * @param {number} index
26108
27059
  */
26109
27060
 
26110
27061
  /**
@@ -26112,8 +27063,8 @@
26112
27063
  * @template T
26113
27064
  * @property {function():number} [min]
26114
27065
  * @property {function():number} [max]
26115
- * @property {function(T, qae.GenericObjectProperties)} [added]
26116
- * @property {function(T, qae.GenericObjectProperties, number)} [removed]
27066
+ * @property {fieldTargetAddedCallback<T>} [added]
27067
+ * @property {fieldTargetRemovedCallback<T>} [removed]
26117
27068
  */
26118
27069
 
26119
27070
 
@@ -27901,7 +28852,7 @@
27901
28852
  /**
27902
28853
  * @interface TypeInfo
27903
28854
  * @property {string} name
27904
- * @property {string} version
28855
+ * @property {string=} version
27905
28856
  * @property {LoadType} load
27906
28857
  * @property {object=} meta
27907
28858
  */
@@ -28061,6 +29012,7 @@
28061
29012
 
28062
29013
  /**
28063
29014
  * @interface Context
29015
+ * @property {boolean=} disableCellPadding
28064
29016
  * @property {boolean=} keyboardNavigation
28065
29017
  * @property {object=} constraints
28066
29018
  * @property {boolean=} constraints.active
@@ -28080,7 +29032,8 @@
28080
29032
  /** @type {string=} */
28081
29033
  deviceType: 'auto',
28082
29034
  constraints: {},
28083
- keyboardNavigation: false
29035
+ keyboardNavigation: false,
29036
+ disableCellPadding: false
28084
29037
  };
28085
29038
  /**
28086
29039
  * @interface SnapshotConfiguration
@@ -28182,7 +29135,7 @@
28182
29135
  * Initiates a new `Embed` instance using the specified enigma `app`.
28183
29136
  * @entry
28184
29137
  * @function embed
28185
- * @param {enigma.Doc} app
29138
+ * @param {EngineAPI.IApp} app
28186
29139
  * @param {Configuration=} instanceConfig
28187
29140
  * @returns {Embed}
28188
29141
  * @example
@@ -28401,6 +29354,10 @@
28401
29354
  if (!fieldName) {
28402
29355
  throw new Error("Field identifier must be provided");
28403
29356
  }
29357
+ /**
29358
+ * @typedef {function(function)} ReceiverFunction A callback function which receives another function as input.
29359
+ */
29360
+
28404
29361
  /**
28405
29362
  * @class
28406
29363
  * @alias FieldInstance
@@ -28418,10 +29375,18 @@
28418
29375
  * @param {string=} options.title Custom title, defaults to fieldname
28419
29376
  * @param {string=} [options.direction=ltr] Direction setting ltr|rtl.
28420
29377
  * @param {string=} [options.listLayout=vertical] Layout direction vertical|horizontal
28421
- * @param {boolean=} [options.search=true] To show the search bar
29378
+ * @param {boolean=} [options.search=true] Show the search bar
29379
+ * @param {boolean=} [options.toolbar=true] Show the toolbar
29380
+ * @param {boolean=} [options.checkboxes=false] Show values as checkboxes instead of as fields
29381
+ * @param {boolean=} [options.rangeSelect=true] Enable range selection
29382
+ * @param {boolean=} [options.dense=false] Reduces padding and text size
28422
29383
  * @param {boolean=} [options.stateName="$"] Sets the state to make selections in
28423
29384
  * @param {object=} [options.properties={}] Properties object to extend default properties with
29385
+ * @param {object} [options.sessionModel] Use a custom sessionModel.
29386
+ * @param {object} [options.selectionsApi] Use a custom selectionsApi to customize how values are selected.
29387
+ * @param {ReceiverFunction} [options.update] A function which receives an update function which upon call will trigger a data fetch.
28424
29388
  * @since 1.1.0
29389
+ * @instance
28425
29390
  * @example
28426
29391
  * fieldInstance.mount(element);
28427
29392
  */
@@ -28449,6 +29414,7 @@
28449
29414
  /**
28450
29415
  * Unmounts the field listbox from the DOM.
28451
29416
  * @since 1.1.0
29417
+ * @instance
28452
29418
  * @example
28453
29419
  * listbox.unmount();
28454
29420
  */
@@ -28507,7 +29473,9 @@
28507
29473
  * // create an alternate config with dark theme
28508
29474
  * // and inherit the config from the previous
28509
29475
  * const d = m.createConfiguration({
28510
- * theme: 'dark'
29476
+ * context: {
29477
+ * theme: 'dark'
29478
+ * }
28511
29479
  * });
28512
29480
  *
28513
29481
  * m(app).render({ type: 'mekko' }); // will render the object with default theme
@@ -28521,6 +29489,10 @@
28521
29489
  embed.config = configuration;
28522
29490
  return embed;
28523
29491
  }
29492
+ /**
29493
+ * @typedef {any} ThemeJSON
29494
+ */
29495
+
28524
29496
  /**
28525
29497
  * @interface ThemeInfo
28526
29498
  * @property {string} id Theme identifier