@nebula.js/stardust 4.0.0-alpha.5 → 4.0.0-alpha.6

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 v4.0.0-alpha.5
2
+ * @nebula.js/stardust v4.0.0-alpha.6
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -1496,7 +1496,7 @@ var Selection_SelectPossible = {
1496
1496
  var SelectionToolbar_ClickToUnlock = {
1497
1497
  id: "SelectionToolbar.ClickToUnlock",
1498
1498
  locale: {
1499
- "de-DE": "Klicken zum Freigeben",
1499
+ "de-DE": "Zum Entsperren klicken",
1500
1500
  "en-US": "Click to unlock",
1501
1501
  "es-ES": "Haga clic para desbloquearla",
1502
1502
  "fr-FR": "Cliquez pour déverrouiller",
@@ -8064,7 +8064,7 @@ function create$3(definition) {
8064
8064
  return cache[key];
8065
8065
  }
8066
8066
 
8067
- const NEBULA_VERSION_HASH = "6643" ;
8067
+ const NEBULA_VERSION_HASH = "9917" ;
8068
8068
  ClassNameGenerator$1.configure(componentName => {
8069
8069
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8070
8070
  });
@@ -8272,7 +8272,7 @@ function boot(_ref2) {
8272
8272
  const appRef = React__default.createRef();
8273
8273
  const element = document.createElement('div');
8274
8274
  element.style.display = 'none';
8275
- element.setAttribute('data-nebulajs-version', "4.0.0-alpha.5" );
8275
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.6" );
8276
8276
  element.setAttribute('data-app-id', app.id);
8277
8277
  document.body.appendChild(element);
8278
8278
  const root = client.createRoot(element);
@@ -9071,7 +9071,7 @@ function fillRange(elementNbrs, elemNumbersOrdered) {
9071
9071
  return elemNumbersOrdered.slice(min, max + 1);
9072
9072
  }
9073
9073
 
9074
- const getKeyAsToggleSelected = event => !(event.metaKey || event.ctrlKey);
9074
+ const getKeyAsToggleSelected = event => !(event !== null && event !== void 0 && event.metaKey || event !== null && event !== void 0 && event.ctrlKey);
9075
9075
  function useSelectionsInteractions(_ref) {
9076
9076
  let {
9077
9077
  selectionState,
@@ -9112,6 +9112,11 @@ function useSelectionsInteractions(_ref) {
9112
9112
  const selectManually = function () {
9113
9113
  let elementIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9114
9114
  let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
9115
+ let event = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
9116
+ const toggle = !selectionState.isSingleSelect && getKeyAsToggleSelected(event === null || event === void 0 ? void 0 : event.nativeEvent);
9117
+ if (!toggle) {
9118
+ selectionState.clearItemStates(true);
9119
+ }
9115
9120
  const elemNumbers = [];
9116
9121
  selectionState.updateItems(elementIds, additive, elemNumbers);
9117
9122
  selectionState.setSelectableValuesUpdating();
@@ -9119,7 +9124,7 @@ function useSelectionsInteractions(_ref) {
9119
9124
  selections,
9120
9125
  elemNumbers: additive ? elemNumbers : elementIds,
9121
9126
  isSingleSelect: selectionState.isSingleSelect,
9122
- toggle: !selectionState.isSingleSelect
9127
+ toggle
9123
9128
  });
9124
9129
  };
9125
9130
  const handleSingleSelectKey = (event, target) => {
@@ -9376,7 +9381,7 @@ function getFieldKeyboardNavigation(_ref) {
9376
9381
  setStartedRange(true);
9377
9382
  break;
9378
9383
  case KEYS.SPACE:
9379
- select([+event.currentTarget.getAttribute('data-n')]);
9384
+ select([+event.currentTarget.getAttribute('data-n')], false, event);
9380
9385
  break;
9381
9386
  case KEYS.ARROW_DOWN:
9382
9387
  case KEYS.ARROW_RIGHT:
@@ -9759,15 +9764,10 @@ const RowColRoot = styled$1('div', {
9759
9764
  ["& .".concat(rowColClasses.labelDense)]: {
9760
9765
  fontSize: 12
9761
9766
  },
9762
- // Highlight is added to labelText spans, which are created as siblings to original labelText,
9767
+ // Highlight is added to labelText spans, which are created as children to original labelText,
9763
9768
  // when a search string is matched.
9764
9769
  ["& .".concat(rowColClasses.highlighted)]: {
9765
- overflow: 'visible',
9766
- width: '100%',
9767
- '& > span': {
9768
- width: '100%',
9769
- backgroundColor: '#FFC72A'
9770
- }
9770
+ backgroundColor: '#FFC72A'
9771
9771
  },
9772
9772
  // Checkbox and label container.
9773
9773
  ["& .".concat(rowColClasses.checkboxLabel)]: {
@@ -9787,12 +9787,6 @@ const RowColRoot = styled$1('div', {
9787
9787
  paddingRight: '2px'
9788
9788
  })
9789
9789
  },
9790
- ["& .".concat(rowColClasses.checkboxLabel, " .").concat(rowColClasses.labelText)]: {
9791
- width: 'auto'
9792
- },
9793
- ["& .".concat(rowColClasses.checkboxLabel, " .").concat(rowColClasses.labelText, ".").concat(rowColClasses.highlighted)]: {
9794
- width: 'auto'
9795
- },
9796
9790
  // The icons container holding tick and lock, shown inside fields.
9797
9791
  ["& .".concat(rowColClasses.icon)]: {
9798
9792
  display: 'flex',
@@ -10027,7 +10021,6 @@ function ValueField(_ref) {
10027
10021
  let {
10028
10022
  label,
10029
10023
  color,
10030
- highlighted = false,
10031
10024
  dense,
10032
10025
  showGray = true,
10033
10026
  checkboxes,
@@ -10037,14 +10030,14 @@ function ValueField(_ref) {
10037
10030
  return /*#__PURE__*/React__default.createElement(Typography, {
10038
10031
  component: "span",
10039
10032
  variant: "body2",
10040
- className: joinClassNames([rowColClasses.labelText, highlighted && rowColClasses.highlighted, dense && rowColClasses.labelDense, showGray && excludedOrAlternative({
10033
+ className: joinClassNames([rowColClasses.labelText, dense && rowColClasses.labelDense, showGray && excludedOrAlternative({
10041
10034
  cell,
10042
10035
  checkboxes
10043
10036
  }) && rowColClasses.excludedTextWithCheckbox]),
10044
10037
  color: color,
10045
- align: valueTextAlign
10038
+ align: valueTextAlign,
10039
+ dir: "auto"
10046
10040
  }, /*#__PURE__*/React__default.createElement("span", {
10047
- dir: "auto",
10048
10041
  style: {
10049
10042
  whiteSpace: 'pre'
10050
10043
  }
@@ -10055,7 +10048,6 @@ function LabelTag(_ref) {
10055
10048
  let {
10056
10049
  label,
10057
10050
  color,
10058
- highlighted,
10059
10051
  dense,
10060
10052
  showGray,
10061
10053
  checkboxes,
@@ -10066,7 +10058,6 @@ function LabelTag(_ref) {
10066
10058
  return /*#__PURE__*/React__default.createElement(ValueField, {
10067
10059
  label: label,
10068
10060
  color: color,
10069
- highlighted: highlighted,
10070
10061
  dense: dense,
10071
10062
  showGray: showGray,
10072
10063
  checkboxes: checkboxes,
@@ -10089,7 +10080,6 @@ function CheckboxField(_ref) {
10089
10080
  isGridCol,
10090
10081
  showGray,
10091
10082
  isSingleSelect,
10092
- highlighted,
10093
10083
  checkboxes,
10094
10084
  valueTextAlign
10095
10085
  } = _ref;
@@ -10117,7 +10107,6 @@ function CheckboxField(_ref) {
10117
10107
  label: /*#__PURE__*/React__default.createElement(LabelTag, {
10118
10108
  label: label,
10119
10109
  color: color,
10120
- highlighted: highlighted,
10121
10110
  dense: dense,
10122
10111
  showGray: showGray,
10123
10112
  checkboxes: checkboxes,
@@ -10133,23 +10122,21 @@ function LabelsWithRanges(_ref) {
10133
10122
  labels,
10134
10123
  dense,
10135
10124
  showGray,
10136
- checkboxes,
10137
- textDirection
10125
+ checkboxes
10138
10126
  } = _ref;
10139
- return /*#__PURE__*/React__default.createElement("div", {
10140
- dir: textDirection
10141
- }, labels.map((_ref2, index) => {
10127
+ const text = labels.map((_ref2, index) => {
10142
10128
  let [label, highlighted] = _ref2;
10143
- const key = "".concat(index);
10144
- return /*#__PURE__*/React__default.createElement(ValueField, {
10145
- label: label,
10146
- key: key,
10147
- highlighted: highlighted,
10148
- dense: dense,
10149
- showGray: showGray,
10150
- checkboxes: checkboxes
10151
- });
10152
- }));
10129
+ return /*#__PURE__*/React__default.createElement("span", {
10130
+ id: index,
10131
+ className: highlighted ? rowColClasses.highlighted : ''
10132
+ }, label);
10133
+ });
10134
+ return /*#__PURE__*/React__default.createElement(ValueField, {
10135
+ label: text,
10136
+ dense: dense,
10137
+ showGray: showGray,
10138
+ checkboxes: checkboxes
10139
+ });
10153
10140
  }
10154
10141
  function FieldWithRanges(_ref3) {
10155
10142
  let {
@@ -10164,15 +10151,13 @@ function FieldWithRanges(_ref3) {
10164
10151
  cell,
10165
10152
  isGridCol,
10166
10153
  isSingleSelect,
10167
- valueTextAlign,
10168
- textDirection
10154
+ valueTextAlign
10169
10155
  } = _ref3;
10170
10156
  const LWR = /*#__PURE__*/React__default.createElement(LabelsWithRanges, {
10171
10157
  labels: labels,
10172
10158
  dense: dense,
10173
10159
  showGray: showGray,
10174
- checkboxes: checkboxes,
10175
- textDirection: textDirection
10160
+ checkboxes: checkboxes
10176
10161
  });
10177
10162
  return checkboxes ? /*#__PURE__*/React__default.createElement(CheckboxField, {
10178
10163
  onChange: onChange,
@@ -10202,7 +10187,6 @@ function Field(_ref) {
10202
10187
  isGridCol,
10203
10188
  showGray,
10204
10189
  isSingleSelect,
10205
- highlighted,
10206
10190
  checkboxes,
10207
10191
  valueTextAlign
10208
10192
  } = _ref;
@@ -10217,13 +10201,11 @@ function Field(_ref) {
10217
10201
  isGridCol: isGridCol,
10218
10202
  showGray: showGray,
10219
10203
  isSingleSelect: isSingleSelect,
10220
- highlighted: highlighted,
10221
10204
  checkboxes: checkboxes,
10222
10205
  valueTextAlign: valueTextAlign
10223
10206
  }) : /*#__PURE__*/React__default.createElement(ValueField, {
10224
10207
  label: label,
10225
10208
  color: color,
10226
- highlighted: false,
10227
10209
  dense: dense,
10228
10210
  showGray: true,
10229
10211
  checkboxes: checkboxes,
@@ -10352,55 +10334,6 @@ function getCellFromPages(_ref) {
10352
10334
  return c;
10353
10335
  }
10354
10336
 
10355
- // Source: https://en.wikipedia.org/wiki/Bi-directional_text and http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt
10356
- // 3 types of strong direction characters: L (strong left-to-right), R(strong right-to-left, Hebrew) and AL(strong right-to-left, Arabic language)
10357
- const rangesOfLChars = '[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u02BB-\u02C1\u02D0-\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376-\u037D\u0386\u0388-\u03F5\u03F7-\u0482\u048A-\u0589\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u097F\u0982-\u09B9\u09BD-\u09C0\u09C7-\u09CC\u09CE-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u0A03-\u0A39\u0A3E-\u0A40\u0A59-\u0A6F\u0A72-\u0A74\u0A83-\u0AB9\u0ABD-\u0AC0\u0AC9-\u0ACC\u0AD0-\u0AE1\u0AE6-\u0AEF\u0B02-\u0B39\u0B3D-\u0B3E\u0B40\u0B47-\u0B4C\u0B57-\u0B61\u0B66-\u0B77\u0B83-\u0BBF\u0BC1-\u0BCC\u0BD0-\u0BF2\u0C01-\u0C3D\u0C41-\u0C44\u0C58-\u0C61\u0C66-\u0C6F\u0C7F-\u0CB9\u0CBD-\u0CCB\u0CD5-\u0CE1\u0CE6-\u0D40\u0D46-\u0D4C\u0D4E-\u0D61\u0D66-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E4F-\u0EB0\u0EB2-\u0EB3\u0EBD-\u0EC6\u0ED0-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u102C\u1031\u1038\u103B-\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083-\u1084\u1087-\u108C\u108E-\u109C\u109E-\u135A\u1360-\u138F\u13A0-\u13F4\u1401-\u167F\u1681-\u169A\u16A0-\u1711\u1720-\u1731\u1735-\u1751\u1760-\u1770\u1780-\u17B6\u17BE-\u17C5\u17C7-\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u18A8\u18AA-\u191C\u1923-\u1926\u1929-\u1931\u1933-\u1938\u1946-\u19DA\u1A00-\u1A16\u1A19-\u1A55\u1A57\u1A61\u1A63-\u1A64\u1A6D-\u1A72\u1A80-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B6A\u1B74-\u1B7C\u1B82-\u1BA1\u1BA6-\u1BA7\u1BAA-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1C2B\u1C34-\u1C35\u1C3B-\u1C7F\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1DBF\u1E00-\u1FBC\u1FBE\u1FC2-\u1FCC\u1FD0-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FFC\u200E\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E-\u214F\u2160-\u2188\u2336-\u237A\u2395\u249C-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2D00-\u2D70\u2D80-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u31BA\u31F0-\u321C\u3220-\u324F\u3260-\u327B\u327F-\u32B0\u32C0-\u32CB\u32D0-\u3376\u337B-\u33DD\u33E0-\u33FE\u3400-\u4DB5\u4E00-\uA48C\uA4D0-\uA60C\uA610-\uA66E\uA680-\uA6EF\uA6F2-\uA6F7\uA722-\uA787\uA789-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA824\uA827\uA830-\uA837\uA840-\uA873\uA880-\uA8C3\uA8CE-\uA8D9\uA8F2-\uA925\uA92E-\uA946\uA952-\uA97C\uA983-\uA9B2\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BD-\uAA28\uAA2F-\uAA30\uAA33-\uAA34\uAA40-\uAA42\uAA44-\uAA4B\uAA4D-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2-\uABE4\uABE6-\uABE7\uABE9-\uABEC\uABF0-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]';
10358
- const rangesOfRChars = '[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u07C0-\u07EA\u07F4-\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB4F]';
10359
- const rangesOfALChars = '[\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u070D\u0710\u0712-\u072F\u074D-\u07A5\u07B1\uFB50-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]';
10360
- const rangesOfNChars = '[\u0009-\u000D\u001C-\u0022\u0026-\u002A\u003B-\u0040\u005B-\u0060\u007B-\u007E\u0085\u00A1\u00A6-\u00A9\u00AB-\u00AC\u00AE-\u00AF\u00B4\u00B6-\u00B8\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u0374-\u0375\u037E-\u0385\u0387\u03F6\u058A\u0606-\u0607\u060E-\u060F\u06DE\u06E9\u07F6-\u07F9\u0BF3-\u0BF8\u0BFA\u0C78-\u0C7E\u0F3A-\u0F3D\u1390-\u1399\u1400\u1680\u169B-\u169C\u17F0-\u180A\u180E\u1940-\u1945\u19DE-\u19FF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD-\u200A\u2010-\u2029\u2035-\u2043\u2045-\u205F\u207C-\u207E\u208C-\u208E\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189-\u2211\u2214-\u2335\u237B-\u2394\u2396-\u2487\u24EA-\u26AB\u26AD-\u27FF\u2900-\u2B59\u2CE5-\u2CEA\u2CF9-\u2CFF\u2E00-\u3004\u3008-\u3020\u3030\u3036-\u3037\u303D-\u303F\u309B-\u309C\u30A0\u30FB\u31C0-\u31E3\u321D-\u321E\u3250-\u325F\u327C-\u327E\u32B1-\u32BF\u32CC-\u32CF\u3377-\u337A\u33DE-\u33DF\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA60D-\uA60F\uA673\uA67E-\uA67F\uA700-\uA721\uA788\uA828-\uA82B\uA874-\uA877\uFD3E-\uFD3F\uFDFD\uFE10-\uFE19\uFE30-\uFE4F\uFE51\uFE54\uFE56-\uFE5E\uFE60-\uFE61\uFE64-\uFE68\uFE6B\uFF01-\uFF02\uFF06-\uFF0A\uFF1B-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE2-\uFFE4\uFFE8-\uFFFD]';
10361
- // eslint-disable-next-line no-misleading-character-class
10362
- const rangesOfLRgExp = new RegExp(rangesOfLChars);
10363
- const rangesOfRRgExp = new RegExp(rangesOfRChars);
10364
- const rangesOfALRgExp = new RegExp(rangesOfALChars);
10365
- const rangesOfNRgExp = new RegExp(rangesOfNChars);
10366
- const
10367
- // left-to-right marker
10368
- lrm = String.fromCharCode(8206); // right-to-left marker
10369
-
10370
- const rlm = String.fromCharCode(8207);
10371
- function isLtrChar(c) {
10372
- return rangesOfLRgExp.test(c);
10373
- }
10374
- function isRtlChar(c) {
10375
- return rangesOfRRgExp.test(c) || rangesOfALRgExp.test(c);
10376
- }
10377
- function isNeutralChar(c) {
10378
- return rangesOfNRgExp.test(c);
10379
- }
10380
- function detectTextDirection(s) {
10381
- const n = s ? s.length : 0;
10382
- let i;
10383
- let c;
10384
- for (i = 0; i < n; i++) {
10385
- c = s[i];
10386
- if (isLtrChar(c)) {
10387
- return 'ltr';
10388
- }
10389
- if (isRtlChar(c)) {
10390
- return 'rtl';
10391
- }
10392
- }
10393
- return 'ltr';
10394
- }
10395
- var rtlUtil = {
10396
- detectTextDirection,
10397
- isLtrChar,
10398
- isRtlChar,
10399
- isNeutralChar,
10400
- lrm,
10401
- rlm
10402
- };
10403
-
10404
10337
  function RowColumn(_ref) {
10405
10338
  var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
10406
10339
  let {
@@ -10526,7 +10459,6 @@ function RowColumn(_ref) {
10526
10459
  }
10527
10460
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
10528
10461
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
10529
- const textDirection = rtlUtil.detectTextDirection(label);
10530
10462
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
10531
10463
 
10532
10464
  let labels;
@@ -10608,8 +10540,7 @@ function RowColumn(_ref) {
10608
10540
  cell: cell,
10609
10541
  isGridCol: isGridCol,
10610
10542
  isSingleSelect: isSingleSelect,
10611
- valueTextAlign: valueTextAlign,
10612
- textDirection: textDirection
10543
+ valueTextAlign: valueTextAlign
10613
10544
  }) : /*#__PURE__*/React__default.createElement(Field$1, {
10614
10545
  onChange: onChange,
10615
10546
  label: label,
@@ -16073,6 +16004,23 @@ function getListboxActionProps(_ref) {
16073
16004
  };
16074
16005
  }
16075
16006
 
16007
+ function ListBoxError(_ref) {
16008
+ let {
16009
+ text
16010
+ } = _ref;
16011
+ const {
16012
+ translator
16013
+ } = useContext(InstanceContext);
16014
+ const StyledDiv = styled$1('div')(() => ({
16015
+ display: 'flex',
16016
+ width: '100%',
16017
+ height: '100%',
16018
+ alignItems: 'center',
16019
+ justifyContent: 'center'
16020
+ }));
16021
+ return /*#__PURE__*/React__default.createElement(StyledDiv, null, translator.get(text));
16022
+ }
16023
+
16076
16024
  const PREFIX$4 = 'ListBoxInline';
16077
16025
  const classes$4 = {
16078
16026
  listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
@@ -16147,9 +16095,7 @@ function ListBoxInline(_ref3) {
16147
16095
  calculatePagesHeight,
16148
16096
  showGray = true,
16149
16097
  scrollState = undefined,
16150
- renderedCallback
16151
- } = options;
16152
- let {
16098
+ renderedCallback,
16153
16099
  toolbar = true
16154
16100
  } = options;
16155
16101
 
@@ -16194,6 +16140,8 @@ function ListBoxInline(_ref3) {
16194
16140
  const [appSelections] = useAppSelections(app);
16195
16141
  const titleRef = useRef(null);
16196
16142
  const [selectionState$1] = useState$1(() => selectionState());
16143
+ const isInvalid = layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo.qError;
16144
+ const errorText = isInvalid && constraints.active ? 'Visualization.Invalid.Dimension' : 'Visualization.Incomplete';
16197
16145
  const {
16198
16146
  handleKeyDown,
16199
16147
  handleOnMouseEnter,
@@ -16216,11 +16164,8 @@ function ListBoxInline(_ref3) {
16216
16164
  // this will be static until we can access the useKeyboard hook
16217
16165
  active: keyboardActive
16218
16166
  };
16219
- if ((layout === null || layout === void 0 ? void 0 : layout.toolbar) !== undefined) {
16220
- toolbar = layout.toolbar;
16221
- }
16222
- const toolbarDetachedOnly = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) === '';
16223
- toolbar = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '';
16167
+ const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false);
16168
+ const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false;
16224
16169
  useEffect$1(() => {
16225
16170
  const show = () => {
16226
16171
  setShowToolbar(true);
@@ -16244,7 +16189,7 @@ function ListBoxInline(_ref3) {
16244
16189
  selections.removeListener('deactivated', hide);
16245
16190
  }
16246
16191
  };
16247
- }, [selections, toolbar]);
16192
+ }, [selections]);
16248
16193
  useEffect$1(() => {
16249
16194
  if (!searchContainer || !searchContainer.current) {
16250
16195
  return;
@@ -16278,7 +16223,7 @@ function ListBoxInline(_ref3) {
16278
16223
  const searchHeight = dense ? 27 : 40;
16279
16224
  const extraheight = dense ? 39 : 49;
16280
16225
  const searchAddHeight = searchVisible ? searchHeight : 0;
16281
- const minHeight = toolbar ? 49 + searchAddHeight + extraheight : 0;
16226
+ const minHeight = showToolbarWithTitle ? 49 + searchAddHeight + extraheight : 0;
16282
16227
  const headerHeight = 32;
16283
16228
  const onShowSearch = () => {
16284
16229
  const newValue = !showSearch;
@@ -16350,7 +16295,7 @@ function ListBoxInline(_ref3) {
16350
16295
  fontSize: '12px'
16351
16296
  }
16352
16297
  }));
16353
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, toolbarDetachedOnly && /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$6({
16298
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showDetachedToolbarOnly && /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$6({
16354
16299
  direction: direction
16355
16300
  }, getActionToolbarProps(true))), /*#__PURE__*/React__default.createElement(StyledGrid$3, {
16356
16301
  className: "listbox-container",
@@ -16369,7 +16314,7 @@ function ListBoxInline(_ref3) {
16369
16314
  onMouseLeave: handleOnMouseLeave,
16370
16315
  ref: containerRef,
16371
16316
  hasIcon: showIcons
16372
- }, toolbar && /*#__PURE__*/React__default.createElement(Grid, {
16317
+ }, showToolbarWithTitle && /*#__PURE__*/React__default.createElement(Grid, {
16373
16318
  item: true,
16374
16319
  container: true,
16375
16320
  style: {
@@ -16459,7 +16404,9 @@ function ListBoxInline(_ref3) {
16459
16404
  className: classes$4.listboxWrapper
16460
16405
  }, /*#__PURE__*/React__default.createElement("div", {
16461
16406
  className: classes$4.screenReaderOnly
16462
- }, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
16407
+ }, translator.get('Listbox.ScreenReaderInstructions')), isInvalid ? /*#__PURE__*/React__default.createElement(ListBoxError, {
16408
+ text: errorText
16409
+ }) : /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
16463
16410
  let {
16464
16411
  height,
16465
16412
  width
@@ -16908,7 +16855,7 @@ function removeIndex(array, index) {
16908
16855
  array.splice(removeIdx, 1);
16909
16856
  return removeIdx;
16910
16857
  }
16911
- const nxDimension = f => ({
16858
+ const nxDimension$1 = f => ({
16912
16859
  qDef: {
16913
16860
  qFieldDefs: [f]
16914
16861
  }
@@ -16939,7 +16886,7 @@ function hcHandler(_ref) {
16939
16886
  return hc.qMeasures;
16940
16887
  },
16941
16888
  addDimension(d) {
16942
- const dimension = typeof d === 'string' ? nxDimension(d) : _objectSpread2(_objectSpread2({}, d), {}, {
16889
+ const dimension = typeof d === 'string' ? nxDimension$1(d) : _objectSpread2(_objectSpread2({}, d), {}, {
16943
16890
  qDef: d.qDef || {}
16944
16891
  });
16945
16892
  dimension.qDef.cId = dimension.qDef.cId || uid();
@@ -17022,6 +16969,69 @@ function hcHandler(_ref) {
17022
16969
  return handler;
17023
16970
  }
17024
16971
 
16972
+ const nxDimension = f => ({
16973
+ qDef: {
16974
+ qFieldDefs: [f]
16975
+ }
16976
+ });
16977
+ function loHandler(_ref) {
16978
+ let {
16979
+ dc: lo,
16980
+ def,
16981
+ properties
16982
+ } = _ref;
16983
+ lo.qInitialDataFetch = lo.qInitialDataFetch || [];
16984
+ const objectProperties = properties;
16985
+ const handler = {
16986
+ dimensions() {
16987
+ if (!lo.qLibraryId && (!lo.qDef || !lo.qDef.qFieldDefs || lo.qDef.qFieldDefs.length === 0)) return [];
16988
+ return [lo];
16989
+ },
16990
+ measures() {
16991
+ return [];
16992
+ },
16993
+ addDimension(d) {
16994
+ const dimension = typeof d === 'string' ? nxDimension(d) : _objectSpread2(_objectSpread2({}, d), {}, {
16995
+ qDef: d.qDef || {}
16996
+ });
16997
+ dimension.qDef.cId = dimension.qDef.cId || uid();
16998
+ dimension.qDef.qSortCriterias = lo.qDef.qSortCriterias || [{
16999
+ qSortByState: 1,
17000
+ qSortByLoadOrder: 1,
17001
+ qSortByNumeric: 1,
17002
+ qSortByAscii: 1
17003
+ }];
17004
+ Object.keys(dimension).forEach(k => {
17005
+ lo[k] = dimension[k];
17006
+ });
17007
+ def.dimensions.added(dimension, objectProperties);
17008
+ return dimension;
17009
+ },
17010
+ removeDimension(idx) {
17011
+ const dimension = lo;
17012
+ delete lo.qDef;
17013
+ delete lo.qLibraryId;
17014
+ def.dimensions.removed(dimension, objectProperties, idx);
17015
+ return dimension;
17016
+ },
17017
+ addMeasure() {},
17018
+ removeMeasure() {},
17019
+ maxDimensions() {
17020
+ return 1;
17021
+ },
17022
+ maxMeasures() {
17023
+ return 0;
17024
+ },
17025
+ canAddDimension() {
17026
+ return handler.dimensions().length === 0;
17027
+ },
17028
+ canAddMeasure() {
17029
+ return false;
17030
+ }
17031
+ };
17032
+ return handler;
17033
+ }
17034
+
17025
17035
  /**
17026
17036
  * @interface LibraryField
17027
17037
  * @property {string} qLibraryId
@@ -17066,7 +17076,8 @@ function populateData(_ref) {
17066
17076
  const s = parts[i];
17067
17077
  p = s ? p[s] : p;
17068
17078
  }
17069
- const hc = hcHandler({
17079
+ const createHandler = propertyPath.match('/qListObjectDef') ? loHandler : hcHandler;
17080
+ const handler = createHandler({
17070
17081
  dc: p,
17071
17082
  def: target,
17072
17083
  properties
@@ -17074,9 +17085,9 @@ function populateData(_ref) {
17074
17085
  fields.forEach(f => {
17075
17086
  const type = fieldType(f);
17076
17087
  if (type === 'measure') {
17077
- hc.addMeasure(f);
17088
+ handler.addMeasure(f);
17078
17089
  } else {
17079
- hc.addDimension(f);
17090
+ handler.addDimension(f);
17080
17091
  }
17081
17092
  });
17082
17093
  }
@@ -18307,7 +18318,8 @@ function Header(_ref2) {
18307
18318
  sn,
18308
18319
  anchorEl,
18309
18320
  hovering,
18310
- focusHandler
18321
+ focusHandler,
18322
+ titleStyles = {}
18311
18323
  } = _ref2;
18312
18324
  const showTitle = layout.showTitles && !!layout.title;
18313
18325
  const showSubtitle = layout.showTitles && !!layout.subtitle;
@@ -18365,11 +18377,13 @@ function Header(_ref2) {
18365
18377
  }, showTitle && /*#__PURE__*/React__default.createElement(Typography, {
18366
18378
  variant: "h6",
18367
18379
  noWrap: true,
18368
- className: CellTitle.className
18380
+ className: CellTitle.className,
18381
+ style: titleStyles.main
18369
18382
  }, layout.title), showSubtitle && /*#__PURE__*/React__default.createElement(Typography, {
18370
18383
  variant: "body2",
18371
18384
  noWrap: true,
18372
- className: CellSubTitle.className
18385
+ className: CellSubTitle.className,
18386
+ style: titleStyles.subTitle
18373
18387
  }, layout.subtitle))), /*#__PURE__*/React__default.createElement(Grid, {
18374
18388
  item: true
18375
18389
  }, Toolbar));
@@ -18402,7 +18416,8 @@ const CellFooter = {
18402
18416
  };
18403
18417
  function Footer(_ref2) {
18404
18418
  let {
18405
- layout
18419
+ layout,
18420
+ titleStyles = {}
18406
18421
  } = _ref2;
18407
18422
  return layout && layout.showTitles && layout.footnote ? /*#__PURE__*/React__default.createElement(StyledGrid, {
18408
18423
  container: true
@@ -18412,7 +18427,8 @@ function Footer(_ref2) {
18412
18427
  }, /*#__PURE__*/React__default.createElement(Typography, {
18413
18428
  noWrap: true,
18414
18429
  variant: "body2",
18415
- className: CellFooter.className
18430
+ className: CellFooter.className,
18431
+ style: titleStyles.footer
18416
18432
  }, layout.footnote))) : null;
18417
18433
  }
18418
18434
 
@@ -18642,7 +18658,7 @@ function getBackgroundSize(bgComp) {
18642
18658
  function resolveImageUrl(app, relativeUrl) {
18643
18659
  return relativeUrl ? getSenseServerUrl(app) + relativeUrl : undefined;
18644
18660
  }
18645
- const resolveBgImage = (bgComp, app) => {
18661
+ function resolveBgImage(bgComp, app) {
18646
18662
  const bgImageDef = bgComp === null || bgComp === void 0 ? void 0 : bgComp.bgImage;
18647
18663
  if (bgImageDef) {
18648
18664
  let url = '';
@@ -18663,8 +18679,8 @@ const resolveBgImage = (bgComp, app) => {
18663
18679
  } : undefined;
18664
18680
  }
18665
18681
  return undefined;
18666
- };
18667
- const resolveBgColor = (bgComp, theme) => {
18682
+ }
18683
+ function resolveBgColor(bgComp, theme, objectType) {
18668
18684
  const bgColor = bgComp === null || bgComp === void 0 ? void 0 : bgComp.bgColor;
18669
18685
  if (bgColor && theme) {
18670
18686
  if (bgColor.useExpression) {
@@ -18672,8 +18688,32 @@ const resolveBgColor = (bgComp, theme) => {
18672
18688
  }
18673
18689
  return bgColor.color && bgColor.color.color !== 'none' ? theme.getColorPickerColor(bgColor.color, true) : undefined;
18674
18690
  }
18691
+ if (theme && objectType) {
18692
+ return theme.getStyle("object.".concat(objectType), '', 'backgroundColor');
18693
+ }
18694
+ if (theme) {
18695
+ return theme.getStyle('', '', 'backgroundColor');
18696
+ }
18675
18697
  return undefined;
18676
- };
18698
+ }
18699
+ function unfurlFontStyle(fontStyle, target) {
18700
+ if (fontStyle && Array.isArray(fontStyle)) {
18701
+ return fontStyle;
18702
+ }
18703
+ return target === 'main' ? ['bold'] : [];
18704
+ }
18705
+ function resolveTextStyle(textComp, target, theme, objectType) {
18706
+ var _textComp$title;
18707
+ const textProps = (textComp === null || textComp === void 0 ? void 0 : (_textComp$title = textComp.title) === null || _textComp$title === void 0 ? void 0 : _textComp$title[target]) || {};
18708
+ const fontStyle = unfurlFontStyle(textProps.fontStyle, target);
18709
+ return {
18710
+ fontFamily: textProps.fontFamily || theme.getStyle("object.".concat(objectType), "title.".concat(target), 'fontFamily'),
18711
+ color: textProps.color && textProps.color.color !== 'none' ? theme.getColorPickerColor(textProps.color, true) : theme.getStyle("object.".concat(objectType), target, 'color'),
18712
+ fontWeight: fontStyle.includes('bold') ? 'bold' : 'normal',
18713
+ fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',
18714
+ textDecoration: fontStyle.includes('underline') ? 'underline' : 'initial'
18715
+ };
18716
+ }
18677
18717
 
18678
18718
  /**
18679
18719
  * @interface
@@ -18915,7 +18955,8 @@ const loadType = async _ref5 => {
18915
18955
  app,
18916
18956
  selections,
18917
18957
  nebbie,
18918
- focusHandler
18958
+ focusHandler,
18959
+ emitter
18919
18960
  } = _ref5;
18920
18961
  try {
18921
18962
  const snType = await getType({
@@ -18928,7 +18969,8 @@ const loadType = async _ref5 => {
18928
18969
  app,
18929
18970
  selections,
18930
18971
  nebbie,
18931
- focusHandler
18972
+ focusHandler,
18973
+ emitter
18932
18974
  });
18933
18975
  return sn;
18934
18976
  } catch (err) {
@@ -18958,7 +19000,8 @@ const Cell = forwardRef((_ref6, ref) => {
18958
19000
  initialSnPlugins,
18959
19001
  initialError,
18960
19002
  onMount,
18961
- currentId
19003
+ currentId,
19004
+ emitter
18962
19005
  } = _ref6;
18963
19006
  const {
18964
19007
  app,
@@ -18997,7 +19040,7 @@ const Cell = forwardRef((_ref6, ref) => {
18997
19040
  });
18998
19041
  const [bgColor, setBgColor] = useState$1(undefined);
18999
19042
  const [bgImage, setBgImage] = useState$1(undefined); // {url: "", size: "", pos: ""}
19000
-
19043
+ const [titleStyles, setTitleStyles] = useState$1(undefined);
19001
19044
  const focusHandler = useRef({
19002
19045
  focusToolbarButton(last) {
19003
19046
  // eslint-disable-next-line react/no-this-in-sfc
@@ -19008,9 +19051,16 @@ const Cell = forwardRef((_ref6, ref) => {
19008
19051
  eventmixin(focusHandler.current);
19009
19052
  }, []);
19010
19053
  useEffect$1(() => {
19011
- const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
19012
- setBgColor(resolveBgColor(bgComp, halo.public.theme));
19013
- setBgImage(resolveBgImage(bgComp, halo.app));
19054
+ if (layout && halo.public.theme) {
19055
+ const bgComp = layout.components ? layout.components.find(comp => comp.key === 'general') : null;
19056
+ setTitleStyles({
19057
+ main: resolveTextStyle(bgComp, 'main', halo.public.theme, layout.visualization),
19058
+ footer: resolveTextStyle(bgComp, 'footer', halo.public.theme, layout.visualization),
19059
+ subTitle: resolveTextStyle(bgComp, 'subTitle', halo.public.theme, layout.visualization)
19060
+ });
19061
+ setBgColor(resolveBgColor(bgComp, halo.public.theme, layout.visualization));
19062
+ setBgImage(resolveBgImage(bgComp, halo.app));
19063
+ }
19014
19064
  }, [layout, halo.public.theme, halo.app, themeName]);
19015
19065
  focusHandler.current.blurCallback = resetFocus => {
19016
19066
  halo.root.toggleFocusOfCells();
@@ -19082,7 +19132,8 @@ const Cell = forwardRef((_ref6, ref) => {
19082
19132
  app,
19083
19133
  selections,
19084
19134
  nebbie,
19085
- focusHandler: focusHandler.current
19135
+ focusHandler: focusHandler.current,
19136
+ emitter
19086
19137
  });
19087
19138
  if (sn) {
19088
19139
  dispatch({
@@ -19224,7 +19275,8 @@ const Cell = forwardRef((_ref6, ref) => {
19224
19275
  sn: state.sn,
19225
19276
  anchorEl: cellNode,
19226
19277
  hovering: hovering,
19227
- focusHandler: focusHandler.current
19278
+ focusHandler: focusHandler.current,
19279
+ titleStyles: titleStyles
19228
19280
  }, "\xA0"), /*#__PURE__*/React__default.createElement(Grid, {
19229
19281
  tabIndex: keyboardNavigation ? 0 : -1,
19230
19282
  onKeyDown: keyboardNavigation ? handleKeyDown : null,
@@ -19235,7 +19287,8 @@ const Cell = forwardRef((_ref6, ref) => {
19235
19287
  },
19236
19288
  ref: contentRef
19237
19289
  }, Content), /*#__PURE__*/React__default.createElement(Footer, {
19238
- layout: layout
19290
+ layout: layout,
19291
+ titleStyles: titleStyles
19239
19292
  })), state.longRunningQuery && /*#__PURE__*/React__default.createElement(LongRunningQuery, {
19240
19293
  canCancel: canCancel,
19241
19294
  canRetry: canRetry,
@@ -19251,6 +19304,7 @@ function glue$1(_ref) {
19251
19304
  initialSnOptions,
19252
19305
  initialSnPlugins,
19253
19306
  onMount,
19307
+ emitter,
19254
19308
  initialError
19255
19309
  } = _ref;
19256
19310
  const {
@@ -19266,7 +19320,8 @@ function glue$1(_ref) {
19266
19320
  initialSnOptions: initialSnOptions,
19267
19321
  initialSnPlugins: initialSnPlugins,
19268
19322
  initialError: initialError,
19269
- onMount: onMount
19323
+ onMount: onMount,
19324
+ emitter: emitter
19270
19325
  }), element, currentId);
19271
19326
  const unmount = () => {
19272
19327
  root.remove(portal);
@@ -19366,6 +19421,7 @@ function viz() {
19366
19421
  });
19367
19422
  let initialSnOptions = {};
19368
19423
  let initialSnPlugins = [];
19424
+ const emitter = new nodeEventEmitter();
19369
19425
  const setSnOptions = async opts => {
19370
19426
  if (mountedReference) {
19371
19427
  (async () => {
@@ -19456,6 +19512,24 @@ function viz() {
19456
19512
  }
19457
19513
  return propertyTree;
19458
19514
  },
19515
+ /**
19516
+ * Listens to custom events from inside the visualization. See useEmitter
19517
+ * @experimental
19518
+ * @param {string} eventName Event name to listen to
19519
+ * @param {Function} listener Callback function to invoke
19520
+ */
19521
+ on(eventName, listener) {
19522
+ emitter.on(eventName, listener);
19523
+ },
19524
+ /**
19525
+ * Removes a listener
19526
+ * @experimental
19527
+ * @param {string} eventName Event name to remove from
19528
+ * @param {Function} listener Callback function to remove
19529
+ */
19530
+ off(eventName, listener) {
19531
+ emitter.off(eventName, listener);
19532
+ },
19459
19533
  // ===== unexposed experimental API - use at own risk ======
19460
19534
  __DO_NOT_USE__: {
19461
19535
  mount(element) {
@@ -19470,7 +19544,8 @@ function viz() {
19470
19544
  initialSnOptions,
19471
19545
  initialSnPlugins,
19472
19546
  initialError,
19473
- onMount
19547
+ onMount,
19548
+ emitter
19474
19549
  });
19475
19550
  return mounted;
19476
19551
  },
@@ -21417,7 +21492,7 @@ function onTakeSnapshot(cb) {
21417
21492
  * @ignore
21418
21493
  * @example
21419
21494
  * import { onContextMenu } from '@nebula.js/stardust';
21420
-
21495
+
21421
21496
  * onContextMenu((menu, event) => {
21422
21497
  * menu.addItem(item, index);
21423
21498
  * });
@@ -21471,6 +21546,32 @@ function useRenderState() {
21471
21546
  };
21472
21547
  }
21473
21548
 
21549
+ /**
21550
+ * Gets an event emitter instance for the visualization.
21551
+ * @entry
21552
+ * @experimental
21553
+ * @returns {Emitter} The emitter instance.
21554
+ * @example
21555
+ * // In a Nebula visualization
21556
+ * import { useEmitter } from '@nebula.js/stardust';
21557
+ * useEffect(()=> {
21558
+ * // on some trigger
21559
+ * emitter.emit("trigger", params)
21560
+ * }, [...])
21561
+ *
21562
+ * // In a mashup
21563
+ * const viz = await n.render({
21564
+ * element: el,
21565
+ * id: 'abcdef'
21566
+ * });
21567
+ * viz.on("trigger", ()=> {
21568
+ * // do something
21569
+ * })
21570
+ */
21571
+ function useEmitter() {
21572
+ return useInternalContext('emitter');
21573
+ }
21574
+
21474
21575
  /**
21475
21576
  * @experimental
21476
21577
  * @interface Keyboard
@@ -21652,6 +21753,7 @@ function createWithHooks(generator, opts, galaxy) {
21652
21753
  nebbie: opts.nebbie,
21653
21754
  element: undefined,
21654
21755
  // set on mount
21756
+ emitter: opts.emitter,
21655
21757
  // ---- singletons ----
21656
21758
  deviceType: galaxy.deviceType,
21657
21759
  theme: undefined,
@@ -24841,5 +24943,5 @@ const __DO_NOT_USE__ = {
24841
24943
  locale
24842
24944
  };
24843
24945
 
24844
- export { mocker as EnigmaMocker, __DO_NOT_USE__, conversion, index as embed, onContextMenu, onTakeSnapshot, useAction, useApp, useAppLayout, useConstraints, useDeviceType, useEffect, useElement, useEmbed, useGlobal, useImperativeHandle, useKeyboard, useLayout, useMemo, useModel, useOptions, usePlugins, usePromise, useRect, useRenderState, useSelections, useStaleLayout, useState, useTheme, useTranslator };
24946
+ export { mocker as EnigmaMocker, __DO_NOT_USE__, conversion, index as embed, onContextMenu, onTakeSnapshot, useAction, useApp, useAppLayout, useConstraints, useDeviceType, useEffect, useElement, useEmbed, useEmitter, useGlobal, useImperativeHandle, useKeyboard, useLayout, useMemo, useModel, useOptions, usePlugins, usePromise, useRect, useRenderState, useSelections, useStaleLayout, useState, useTheme, useTranslator };
24845
24947
  //# sourceMappingURL=dev.js.map