@nebula.js/stardust 2.3.1 → 2.4.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.
- package/CHANGELOG.md +14 -0
- package/README.md +15 -0
- package/core/esm/dev.js +401 -64
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +3 -3
- package/core/esm/index.js.map +1 -1
- package/dist/stardust.dev.js +401 -64
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +7 -7
- package/dist/stardust.js.map +1 -1
- package/package.json +19 -10
- package/types/index.d.ts +698 -0
package/core/esm/dev.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v2.
|
|
3
|
-
* Copyright (c)
|
|
2
|
+
* @nebula.js/stardust v2.4.1
|
|
3
|
+
* Copyright (c) 2022 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -3209,8 +3209,8 @@ function theme() {
|
|
|
3209
3209
|
* @returns {string} The style value
|
|
3210
3210
|
*
|
|
3211
3211
|
* @example
|
|
3212
|
-
* theme.getStyle('object', 'title.main', 'fontSize')
|
|
3213
|
-
* theme.getStyle('', '', 'fontSize')
|
|
3212
|
+
* theme.getStyle('object', 'title.main', 'fontSize');
|
|
3213
|
+
* theme.getStyle('', '', 'fontSize');
|
|
3214
3214
|
*/
|
|
3215
3215
|
getStyle(basePath, path, attribute) {
|
|
3216
3216
|
if (!styleResolverInstanceCache[basePath]) {
|
|
@@ -5234,7 +5234,7 @@ function useAppSelections(app) {
|
|
|
5234
5234
|
return [appSelections, navState];
|
|
5235
5235
|
}
|
|
5236
5236
|
|
|
5237
|
-
const NEBULA_VERSION_HASH = "
|
|
5237
|
+
const NEBULA_VERSION_HASH = "12a4" ;
|
|
5238
5238
|
let counter = 0;
|
|
5239
5239
|
const NebulaApp = forwardRef((_ref, ref) => {
|
|
5240
5240
|
let {
|
|
@@ -5294,7 +5294,7 @@ function boot(_ref2) {
|
|
|
5294
5294
|
const appRef = React.createRef();
|
|
5295
5295
|
const element = document.createElement('div');
|
|
5296
5296
|
element.style.display = 'none';
|
|
5297
|
-
element.setAttribute('data-nebulajs-version', "2.
|
|
5297
|
+
element.setAttribute('data-nebulajs-version', "2.4.1" );
|
|
5298
5298
|
element.setAttribute('data-app-id', app.id);
|
|
5299
5299
|
document.body.appendChild(element);
|
|
5300
5300
|
ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
|
|
@@ -6435,6 +6435,256 @@ var InfiniteLoader = function (_PureComponent) {
|
|
|
6435
6435
|
return InfiniteLoader;
|
|
6436
6436
|
}(PureComponent);
|
|
6437
6437
|
|
|
6438
|
+
const SELECTED_STATES = ['S', 'XS'];
|
|
6439
|
+
|
|
6440
|
+
const flatten = arr => arr.reduce((prev, cur) => prev.concat(cur));
|
|
6441
|
+
|
|
6442
|
+
function isStateSelected(qState) {
|
|
6443
|
+
return SELECTED_STATES.includes(qState);
|
|
6444
|
+
}
|
|
6445
|
+
|
|
6446
|
+
function getUniques(arr) {
|
|
6447
|
+
return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
|
|
6448
|
+
}
|
|
6449
|
+
function getSelectedValues(pages) {
|
|
6450
|
+
if (!pages || !pages.length) {
|
|
6451
|
+
return [];
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6454
|
+
const elementNbrs = pages.map(page => {
|
|
6455
|
+
const elementNumbers = page.qMatrix.map(p => {
|
|
6456
|
+
const [p0] = p;
|
|
6457
|
+
return isStateSelected(p0.qState) ? p0.qElemNumber : false;
|
|
6458
|
+
});
|
|
6459
|
+
return elementNumbers.filter(n => n !== false);
|
|
6460
|
+
});
|
|
6461
|
+
return flatten(elementNbrs);
|
|
6462
|
+
}
|
|
6463
|
+
function applySelectionsOnPages(pages, elmNumbers) {
|
|
6464
|
+
const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
|
|
6465
|
+
|
|
6466
|
+
const matrices = pages.map(page => {
|
|
6467
|
+
const qMatrix = page.qMatrix.map(p => {
|
|
6468
|
+
const [p0] = p;
|
|
6469
|
+
const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
|
|
6470
|
+
const qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
|
|
6471
|
+
return [_objectSpread2(_objectSpread2({}, p0), {}, {
|
|
6472
|
+
qState
|
|
6473
|
+
}), p.slice(1)];
|
|
6474
|
+
});
|
|
6475
|
+
return _objectSpread2(_objectSpread2({}, page), {}, {
|
|
6476
|
+
qMatrix
|
|
6477
|
+
});
|
|
6478
|
+
});
|
|
6479
|
+
return matrices;
|
|
6480
|
+
}
|
|
6481
|
+
async function selectValues(_ref) {
|
|
6482
|
+
let {
|
|
6483
|
+
selections,
|
|
6484
|
+
elemNumbers,
|
|
6485
|
+
isSingleSelect = false
|
|
6486
|
+
} = _ref;
|
|
6487
|
+
let resolved = Promise.resolve(false);
|
|
6488
|
+
const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
|
|
6489
|
+
|
|
6490
|
+
if (!hasNanValues) {
|
|
6491
|
+
const elemNumbersToSelect = elemNumbers;
|
|
6492
|
+
resolved = selections.select({
|
|
6493
|
+
method: 'selectListObjectValues',
|
|
6494
|
+
params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
|
|
6495
|
+
}).then(success => success !== false).catch(() => false);
|
|
6496
|
+
}
|
|
6497
|
+
|
|
6498
|
+
return resolved;
|
|
6499
|
+
}
|
|
6500
|
+
function getElemNumbersFromPages(pages) {
|
|
6501
|
+
if (!pages || !pages.length) {
|
|
6502
|
+
return [];
|
|
6503
|
+
}
|
|
6504
|
+
|
|
6505
|
+
const elemNumbersArr = pages.map(page => {
|
|
6506
|
+
const qElemNumbers = page.qMatrix.map(p => {
|
|
6507
|
+
const [{
|
|
6508
|
+
qElemNumber
|
|
6509
|
+
}] = p;
|
|
6510
|
+
return qElemNumber;
|
|
6511
|
+
});
|
|
6512
|
+
return qElemNumbers;
|
|
6513
|
+
});
|
|
6514
|
+
const elemNumbers = flatten(elemNumbersArr);
|
|
6515
|
+
return elemNumbers;
|
|
6516
|
+
}
|
|
6517
|
+
/**
|
|
6518
|
+
* @typedef {object} MinMaxResult
|
|
6519
|
+
* @property {number} min
|
|
6520
|
+
* @property {number} max
|
|
6521
|
+
*/
|
|
6522
|
+
|
|
6523
|
+
/**
|
|
6524
|
+
* Returns the min and max indices of elemNumbersOrdered which contains
|
|
6525
|
+
* all numbers in elementNbrs.
|
|
6526
|
+
*
|
|
6527
|
+
* @param {number[]} elementNbrs
|
|
6528
|
+
* @param {number[]} elemNumbersOrdered
|
|
6529
|
+
* @returns {MinMaxResult}
|
|
6530
|
+
*/
|
|
6531
|
+
|
|
6532
|
+
function getMinMax(elementNbrs, elemNumbersOrdered) {
|
|
6533
|
+
let min = Infinity;
|
|
6534
|
+
let max = -Infinity;
|
|
6535
|
+
elementNbrs.forEach(nbr => {
|
|
6536
|
+
const index = elemNumbersOrdered.indexOf(nbr);
|
|
6537
|
+
min = index < min ? index : min;
|
|
6538
|
+
max = index > max ? index : max;
|
|
6539
|
+
});
|
|
6540
|
+
return {
|
|
6541
|
+
min,
|
|
6542
|
+
max
|
|
6543
|
+
};
|
|
6544
|
+
}
|
|
6545
|
+
|
|
6546
|
+
function fillRange(elementNbrs, elemNumbersOrdered) {
|
|
6547
|
+
if (!elementNbrs) {
|
|
6548
|
+
return [];
|
|
6549
|
+
}
|
|
6550
|
+
|
|
6551
|
+
if (elementNbrs.length <= 1) {
|
|
6552
|
+
return elementNbrs;
|
|
6553
|
+
} // Interpolate values algorithm
|
|
6554
|
+
|
|
6555
|
+
|
|
6556
|
+
const {
|
|
6557
|
+
min,
|
|
6558
|
+
max
|
|
6559
|
+
} = getMinMax(elementNbrs, elemNumbersOrdered);
|
|
6560
|
+
return elemNumbersOrdered.slice(min, max + 1);
|
|
6561
|
+
}
|
|
6562
|
+
|
|
6563
|
+
function useSelectionsInteractions(_ref) {
|
|
6564
|
+
let {
|
|
6565
|
+
layout,
|
|
6566
|
+
selections,
|
|
6567
|
+
pages = [],
|
|
6568
|
+
rangeSelect = true,
|
|
6569
|
+
doc = document
|
|
6570
|
+
} = _ref;
|
|
6571
|
+
const [instantPages, setInstantPages] = useState$1(pages);
|
|
6572
|
+
const [mouseDown, setMouseDown] = useState$1(false);
|
|
6573
|
+
const [selectingValues, setSelectingValues] = useState$1(false);
|
|
6574
|
+
const [selected, setSelected] = useState$1([]);
|
|
6575
|
+
const [isRangeSelection, setIsRangeSelection] = useState$1(false);
|
|
6576
|
+
const [preSelected, setPreSelected] = useState$1([]);
|
|
6577
|
+
const elemNumbersOrdered = getElemNumbersFromPages(pages);
|
|
6578
|
+
|
|
6579
|
+
const getIsSingleSelect = () => !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne); // Select values for real, by calling the backend.
|
|
6580
|
+
|
|
6581
|
+
|
|
6582
|
+
const select = async function () {
|
|
6583
|
+
let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6584
|
+
let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6585
|
+
setSelectingValues(true);
|
|
6586
|
+
const isSingleSelect = getIsSingleSelect();
|
|
6587
|
+
const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
|
|
6588
|
+
await selectValues({
|
|
6589
|
+
selections,
|
|
6590
|
+
elemNumbers: filtered,
|
|
6591
|
+
isSingleSelect
|
|
6592
|
+
});
|
|
6593
|
+
setSelectingValues(false);
|
|
6594
|
+
}; // Show estimated selection states instantly before applying the selections for real.
|
|
6595
|
+
|
|
6596
|
+
|
|
6597
|
+
const preSelect = function (elemNumbers) {
|
|
6598
|
+
let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6599
|
+
setPreSelected(existing => {
|
|
6600
|
+
const uniques = getUniques([...existing, ...elemNumbers]);
|
|
6601
|
+
const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
|
|
6602
|
+
const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
|
|
6603
|
+
return filled;
|
|
6604
|
+
});
|
|
6605
|
+
};
|
|
6606
|
+
|
|
6607
|
+
const onMouseDown = useCallback(event => {
|
|
6608
|
+
if (selectingValues) {
|
|
6609
|
+
return;
|
|
6610
|
+
}
|
|
6611
|
+
|
|
6612
|
+
setIsRangeSelection(false);
|
|
6613
|
+
setMouseDown(true);
|
|
6614
|
+
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
6615
|
+
setPreSelected([elemNumber]);
|
|
6616
|
+
}, [selectingValues]);
|
|
6617
|
+
const onMouseUp = useCallback(event => {
|
|
6618
|
+
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
6619
|
+
|
|
6620
|
+
if (getIsSingleSelect() || !rangeSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
|
|
6621
|
+
) {
|
|
6622
|
+
return;
|
|
6623
|
+
}
|
|
6624
|
+
|
|
6625
|
+
preSelect([elemNumber]);
|
|
6626
|
+
}, [mouseDown, selectingValues, preSelected, selected, isRangeSelection]);
|
|
6627
|
+
const onMouseUpDoc = useCallback(() => {
|
|
6628
|
+
// Ensure we end interactions when mouseup happens outside the Listbox.
|
|
6629
|
+
setMouseDown(false);
|
|
6630
|
+
setSelectingValues(false);
|
|
6631
|
+
}, []);
|
|
6632
|
+
const onMouseEnter = useCallback(event => {
|
|
6633
|
+
if (getIsSingleSelect() || !mouseDown || selectingValues) {
|
|
6634
|
+
return;
|
|
6635
|
+
}
|
|
6636
|
+
|
|
6637
|
+
setIsRangeSelection(true);
|
|
6638
|
+
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
6639
|
+
preSelect([elemNumber], true);
|
|
6640
|
+
}, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
|
|
6641
|
+
useEffect$1(() => {
|
|
6642
|
+
// Perform selections of pre-selected values. This can
|
|
6643
|
+
// happen only when interactions have finished (mouseup).
|
|
6644
|
+
const interactionIsFinished = !mouseDown;
|
|
6645
|
+
|
|
6646
|
+
if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
|
|
6647
|
+
return;
|
|
6648
|
+
}
|
|
6649
|
+
|
|
6650
|
+
select(preSelected, isRangeSelection);
|
|
6651
|
+
}, [preSelected, mouseDown]);
|
|
6652
|
+
useEffect$1(() => {
|
|
6653
|
+
doc.addEventListener('mouseup', onMouseUpDoc);
|
|
6654
|
+
return () => {
|
|
6655
|
+
doc.removeEventListener('mouseup', onMouseUpDoc);
|
|
6656
|
+
};
|
|
6657
|
+
}, []);
|
|
6658
|
+
useEffect$1(() => {
|
|
6659
|
+
if (selectingValues || mouseDown) {
|
|
6660
|
+
return;
|
|
6661
|
+
} // Keep track of (truely) selected fields so we can prevent toggling them on range select.
|
|
6662
|
+
|
|
6663
|
+
|
|
6664
|
+
const alreadySelected = getSelectedValues(pages);
|
|
6665
|
+
setSelected(alreadySelected);
|
|
6666
|
+
}, [pages]);
|
|
6667
|
+
useEffect$1(() => {
|
|
6668
|
+
if (selectingValues || !pages || !mouseDown) {
|
|
6669
|
+
return;
|
|
6670
|
+
} // Render pre-selections before they have been selected in Engine.
|
|
6671
|
+
|
|
6672
|
+
|
|
6673
|
+
const newPages = applySelectionsOnPages(pages, preSelected);
|
|
6674
|
+
setInstantPages(newPages);
|
|
6675
|
+
}, [preSelected]);
|
|
6676
|
+
const rangeSelectEvents = rangeSelect ? {
|
|
6677
|
+
onMouseUp,
|
|
6678
|
+
onMouseEnter
|
|
6679
|
+
} : {};
|
|
6680
|
+
return {
|
|
6681
|
+
instantPages,
|
|
6682
|
+
interactionEvents: _objectSpread2({
|
|
6683
|
+
onMouseDown
|
|
6684
|
+
}, rangeSelectEvents)
|
|
6685
|
+
};
|
|
6686
|
+
}
|
|
6687
|
+
|
|
6438
6688
|
const tick = props => _objectSpread2(_objectSpread2({}, props), {}, {
|
|
6439
6689
|
shapes: [{
|
|
6440
6690
|
type: 'path',
|
|
@@ -6460,7 +6710,8 @@ const useStyles$b = makeStyles(theme => ({
|
|
|
6460
6710
|
'& span': {
|
|
6461
6711
|
whiteSpace: 'nowrap',
|
|
6462
6712
|
fontSize: '12px',
|
|
6463
|
-
lineHeight: '16px'
|
|
6713
|
+
lineHeight: '16px',
|
|
6714
|
+
userSelect: 'none'
|
|
6464
6715
|
},
|
|
6465
6716
|
overflow: 'hidden',
|
|
6466
6717
|
textOverflow: 'ellipsis'
|
|
@@ -6498,7 +6749,9 @@ function Row(_ref) {
|
|
|
6498
6749
|
const classArr = [classes.row];
|
|
6499
6750
|
let label = '';
|
|
6500
6751
|
const {
|
|
6501
|
-
|
|
6752
|
+
onMouseDown,
|
|
6753
|
+
onMouseUp,
|
|
6754
|
+
onMouseEnter,
|
|
6502
6755
|
pages
|
|
6503
6756
|
} = data;
|
|
6504
6757
|
let cell;
|
|
@@ -6561,7 +6814,9 @@ function Row(_ref) {
|
|
|
6561
6814
|
spacing: 0,
|
|
6562
6815
|
className: classArr.join(' ').trim(),
|
|
6563
6816
|
style: style,
|
|
6564
|
-
|
|
6817
|
+
onMouseDown: onMouseDown,
|
|
6818
|
+
onMouseUp: onMouseUp,
|
|
6819
|
+
onMouseEnter: onMouseEnter,
|
|
6565
6820
|
role: "row",
|
|
6566
6821
|
tabIndex: 0,
|
|
6567
6822
|
"data-n": cell && cell.qElemNumber
|
|
@@ -6613,7 +6868,8 @@ const useStyles$a = makeStyles(theme => ({
|
|
|
6613
6868
|
'& span': {
|
|
6614
6869
|
whiteSpace: 'nowrap',
|
|
6615
6870
|
fontSize: '12px',
|
|
6616
|
-
lineHeight: '16px'
|
|
6871
|
+
lineHeight: '16px',
|
|
6872
|
+
userSelect: 'none'
|
|
6617
6873
|
},
|
|
6618
6874
|
overflow: 'hidden',
|
|
6619
6875
|
textOverflow: 'ellipsis'
|
|
@@ -6651,7 +6907,9 @@ function Column(_ref) {
|
|
|
6651
6907
|
const classArr = [classes.column];
|
|
6652
6908
|
let label = '';
|
|
6653
6909
|
const {
|
|
6654
|
-
|
|
6910
|
+
onMouseDown,
|
|
6911
|
+
onMouseUp,
|
|
6912
|
+
onMouseEnter,
|
|
6655
6913
|
pages
|
|
6656
6914
|
} = data;
|
|
6657
6915
|
let cell;
|
|
@@ -6714,8 +6972,10 @@ function Column(_ref) {
|
|
|
6714
6972
|
spacing: 0,
|
|
6715
6973
|
className: classArr.join(' ').trim(),
|
|
6716
6974
|
style: style,
|
|
6717
|
-
onClick: onClick,
|
|
6718
6975
|
alignItems: "center",
|
|
6976
|
+
onMouseDown: onMouseDown,
|
|
6977
|
+
onMouseUp: onMouseUp,
|
|
6978
|
+
onMouseEnter: onMouseEnter,
|
|
6719
6979
|
role: "row",
|
|
6720
6980
|
tabIndex: 0,
|
|
6721
6981
|
"data-n": cell && cell.qElemNumber
|
|
@@ -6753,7 +7013,6 @@ function Column(_ref) {
|
|
|
6753
7013
|
})));
|
|
6754
7014
|
}
|
|
6755
7015
|
|
|
6756
|
-
/* eslint no-underscore-dangle:0 */
|
|
6757
7016
|
function ListBox(_ref) {
|
|
6758
7017
|
let {
|
|
6759
7018
|
model,
|
|
@@ -6761,10 +7020,23 @@ function ListBox(_ref) {
|
|
|
6761
7020
|
direction,
|
|
6762
7021
|
height,
|
|
6763
7022
|
width,
|
|
6764
|
-
listLayout = 'vertical'
|
|
7023
|
+
listLayout = 'vertical',
|
|
7024
|
+
rangeSelect = true,
|
|
7025
|
+
update = undefined
|
|
6765
7026
|
} = _ref;
|
|
6766
7027
|
const [layout] = useLayout$1(model);
|
|
6767
7028
|
const [pages, setPages] = useState$1(null);
|
|
7029
|
+
const [isLoadingData, setIsLoadingData] = useState$1(false);
|
|
7030
|
+
const {
|
|
7031
|
+
instantPages = [],
|
|
7032
|
+
interactionEvents
|
|
7033
|
+
} = useSelectionsInteractions({
|
|
7034
|
+
layout,
|
|
7035
|
+
selections,
|
|
7036
|
+
pages,
|
|
7037
|
+
rangeSelect,
|
|
7038
|
+
doc: document
|
|
7039
|
+
});
|
|
6768
7040
|
const loaderRef = useRef(null);
|
|
6769
7041
|
const local = useRef({
|
|
6770
7042
|
queue: [],
|
|
@@ -6773,28 +7045,17 @@ function ListBox(_ref) {
|
|
|
6773
7045
|
const listData = useRef({
|
|
6774
7046
|
pages: []
|
|
6775
7047
|
});
|
|
6776
|
-
const onClick = useCallback(e => {
|
|
6777
|
-
if (layout && layout.qListObject.qDimensionInfo.qLocked) {
|
|
6778
|
-
return;
|
|
6779
|
-
}
|
|
6780
|
-
|
|
6781
|
-
const elemNumber = +e.currentTarget.getAttribute('data-n');
|
|
6782
|
-
|
|
6783
|
-
if (!Number.isNaN(elemNumber)) {
|
|
6784
|
-
selections.select({
|
|
6785
|
-
method: 'selectListObjectValues',
|
|
6786
|
-
params: ['/qListObjectDef', [elemNumber], !layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]
|
|
6787
|
-
});
|
|
6788
|
-
}
|
|
6789
|
-
}, [model, layout && !!layout.qListObject.qDimensionInfo.qLocked, layout && !!layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
|
|
6790
7048
|
const isItemLoaded = useCallback(index => {
|
|
6791
7049
|
if (!pages || !local.current.validPages) {
|
|
6792
7050
|
return false;
|
|
6793
7051
|
}
|
|
6794
7052
|
|
|
6795
7053
|
local.current.checkIdx = index;
|
|
6796
|
-
|
|
6797
|
-
|
|
7054
|
+
|
|
7055
|
+
const isLoaded = p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight;
|
|
7056
|
+
|
|
7057
|
+
const page = pages.filter(p => isLoaded(p))[0];
|
|
7058
|
+
return page && isLoaded(page);
|
|
6798
7059
|
}, [layout, pages]);
|
|
6799
7060
|
const loadMoreItems = useCallback((startIndex, stopIndex) => {
|
|
6800
7061
|
local.current.queue.push({
|
|
@@ -6808,6 +7069,7 @@ function ListBox(_ref) {
|
|
|
6808
7069
|
}
|
|
6809
7070
|
|
|
6810
7071
|
clearTimeout(local.current.timeout);
|
|
7072
|
+
setIsLoadingData(true);
|
|
6811
7073
|
return new Promise(resolve => {
|
|
6812
7074
|
local.current.timeout = setTimeout(() => {
|
|
6813
7075
|
const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
|
|
@@ -6820,12 +7082,14 @@ function ListBox(_ref) {
|
|
|
6820
7082
|
local.current.validPages = true;
|
|
6821
7083
|
listData.current.pages = p;
|
|
6822
7084
|
setPages(p);
|
|
7085
|
+
setIsLoadingData(false);
|
|
6823
7086
|
resolve();
|
|
6824
7087
|
});
|
|
6825
7088
|
}, isScrolling ? 500 : 0);
|
|
6826
7089
|
});
|
|
6827
7090
|
}, [layout]);
|
|
6828
|
-
|
|
7091
|
+
|
|
7092
|
+
const fetchData = () => {
|
|
6829
7093
|
local.current.queue = [];
|
|
6830
7094
|
local.current.validPages = false;
|
|
6831
7095
|
|
|
@@ -6838,7 +7102,23 @@ function ListBox(_ref) {
|
|
|
6838
7102
|
|
|
6839
7103
|
loaderRef.current._listRef.scrollToItem(0);
|
|
6840
7104
|
}
|
|
7105
|
+
};
|
|
7106
|
+
|
|
7107
|
+
if (update) {
|
|
7108
|
+
// Hand over the update function for manual refresh from hosting application.
|
|
7109
|
+
update.call(null, fetchData);
|
|
7110
|
+
}
|
|
7111
|
+
|
|
7112
|
+
useEffect$1(() => {
|
|
7113
|
+
fetchData();
|
|
6841
7114
|
}, [layout]);
|
|
7115
|
+
useEffect$1(() => {
|
|
7116
|
+
if (!instantPages || isLoadingData) {
|
|
7117
|
+
return;
|
|
7118
|
+
}
|
|
7119
|
+
|
|
7120
|
+
setPages(instantPages);
|
|
7121
|
+
}, [instantPages]);
|
|
6842
7122
|
|
|
6843
7123
|
if (!layout) {
|
|
6844
7124
|
return null;
|
|
@@ -6863,16 +7143,16 @@ function ListBox(_ref) {
|
|
|
6863
7143
|
local.current.listRef = ref;
|
|
6864
7144
|
return /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
6865
7145
|
direction: direction,
|
|
7146
|
+
"data-testid": "fixed-size-list",
|
|
6866
7147
|
useIsScrolling: true,
|
|
6867
7148
|
style: {},
|
|
6868
7149
|
height: listHeight,
|
|
6869
7150
|
width: width,
|
|
6870
7151
|
itemCount: count,
|
|
6871
7152
|
layout: listLayout,
|
|
6872
|
-
itemData: {
|
|
6873
|
-
onClick,
|
|
7153
|
+
itemData: _objectSpread2(_objectSpread2({}, interactionEvents), {}, {
|
|
6874
7154
|
pages
|
|
6875
|
-
},
|
|
7155
|
+
}),
|
|
6876
7156
|
itemSize: ITEM_SIZE,
|
|
6877
7157
|
onItemsRendered: onItemsRendered,
|
|
6878
7158
|
ref: ref
|
|
@@ -9098,7 +9378,12 @@ function ListBoxInline(_ref2) {
|
|
|
9098
9378
|
direction,
|
|
9099
9379
|
listLayout,
|
|
9100
9380
|
search = true,
|
|
9101
|
-
|
|
9381
|
+
toolbar = true,
|
|
9382
|
+
rangeSelect = true,
|
|
9383
|
+
properties = {},
|
|
9384
|
+
sessionModel = undefined,
|
|
9385
|
+
selectionsApi = undefined,
|
|
9386
|
+
update = undefined
|
|
9102
9387
|
} = options;
|
|
9103
9388
|
|
|
9104
9389
|
const listdef = _objectSpread2({
|
|
@@ -9124,9 +9409,10 @@ function ListBoxInline(_ref2) {
|
|
|
9124
9409
|
}
|
|
9125
9410
|
},
|
|
9126
9411
|
title
|
|
9127
|
-
}, properties);
|
|
9412
|
+
}, properties); // Something something lib dimension
|
|
9128
9413
|
|
|
9129
|
-
|
|
9414
|
+
|
|
9415
|
+
let fieldName;
|
|
9130
9416
|
|
|
9131
9417
|
if (fieldIdentifier.qLibraryId) {
|
|
9132
9418
|
listdef.qListObjectDef.qLibraryId = fieldIdentifier.qLibraryId;
|
|
@@ -9136,8 +9422,19 @@ function ListBoxInline(_ref2) {
|
|
|
9136
9422
|
fieldName = fieldIdentifier;
|
|
9137
9423
|
}
|
|
9138
9424
|
|
|
9425
|
+
let [model] = useSessionModel(listdef, sessionModel ? null : app, fieldName, stateName);
|
|
9426
|
+
|
|
9427
|
+
if (sessionModel) {
|
|
9428
|
+
model = sessionModel;
|
|
9429
|
+
}
|
|
9430
|
+
|
|
9431
|
+
let selections = useObjectSelections(selectionsApi ? {} : app, model)[0];
|
|
9432
|
+
|
|
9433
|
+
if (selectionsApi) {
|
|
9434
|
+
selections = selectionsApi;
|
|
9435
|
+
}
|
|
9436
|
+
|
|
9139
9437
|
const theme = useTheme$1();
|
|
9140
|
-
const [model] = useSessionModel(listdef, app, fieldName, stateName);
|
|
9141
9438
|
const lock = useCallback(() => {
|
|
9142
9439
|
model.lock('/qListObjectDef');
|
|
9143
9440
|
}, [model]);
|
|
@@ -9148,7 +9445,6 @@ function ListBoxInline(_ref2) {
|
|
|
9148
9445
|
translator
|
|
9149
9446
|
} = useContext(InstanceContext);
|
|
9150
9447
|
const moreAlignTo = useRef();
|
|
9151
|
-
const [selections] = useObjectSelections(app, model);
|
|
9152
9448
|
const [layout] = useLayout$1(model);
|
|
9153
9449
|
const [showToolbar, setShowToolbar] = useState$1(false);
|
|
9154
9450
|
useEffect$1(() => {
|
|
@@ -9174,11 +9470,11 @@ function ListBoxInline(_ref2) {
|
|
|
9174
9470
|
}
|
|
9175
9471
|
|
|
9176
9472
|
const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
|
|
9177
|
-
const listboxSelectionToolbarItems = createListboxSelectionToolbar({
|
|
9473
|
+
const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
|
|
9178
9474
|
layout,
|
|
9179
9475
|
model,
|
|
9180
9476
|
translator
|
|
9181
|
-
});
|
|
9477
|
+
}) : [];
|
|
9182
9478
|
const counts = layout.qListObject.qDimensionInfo.qStateCounts;
|
|
9183
9479
|
const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
|
|
9184
9480
|
const minHeight = 49 + (search ? 40 : 0) + 49;
|
|
@@ -9190,7 +9486,7 @@ function ListBoxInline(_ref2) {
|
|
|
9190
9486
|
height: '100%',
|
|
9191
9487
|
minHeight: "".concat(minHeight, "px")
|
|
9192
9488
|
}
|
|
9193
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
9489
|
+
}, toolbar && /*#__PURE__*/React.createElement(Grid, {
|
|
9194
9490
|
item: true,
|
|
9195
9491
|
container: true,
|
|
9196
9492
|
style: {
|
|
@@ -9254,8 +9550,10 @@ function ListBoxInline(_ref2) {
|
|
|
9254
9550
|
selections: selections,
|
|
9255
9551
|
direction: direction,
|
|
9256
9552
|
listLayout: listLayout,
|
|
9553
|
+
rangeSelect: rangeSelect,
|
|
9257
9554
|
height: height,
|
|
9258
|
-
width: width
|
|
9555
|
+
width: width,
|
|
9556
|
+
update: update
|
|
9259
9557
|
});
|
|
9260
9558
|
})));
|
|
9261
9559
|
}
|
|
@@ -9496,10 +9794,10 @@ function populateData(_ref) {
|
|
|
9496
9794
|
/**
|
|
9497
9795
|
* @since 1.1.0
|
|
9498
9796
|
* @interface ExportDataDef
|
|
9499
|
-
* @property {
|
|
9500
|
-
* @property {
|
|
9501
|
-
* @property {
|
|
9502
|
-
* @property {
|
|
9797
|
+
* @property {EngineAPI.INxDimension[]} dimensions
|
|
9798
|
+
* @property {EngineAPI.INxMeasure[]} measures
|
|
9799
|
+
* @property {EngineAPI.INxDimension[]} excludedDimensions
|
|
9800
|
+
* @property {EngineAPI.INxMeasure[]} excludedMeasures
|
|
9503
9801
|
* @property {number[]} interColumnSortOrder
|
|
9504
9802
|
*/
|
|
9505
9803
|
|
|
@@ -10943,10 +11241,16 @@ class RenderDebouncer {
|
|
|
10943
11241
|
|
|
10944
11242
|
}
|
|
10945
11243
|
|
|
11244
|
+
/**
|
|
11245
|
+
* @interface VizElementAttributes
|
|
11246
|
+
* @extends NamedNodeMap
|
|
11247
|
+
* @property {string} data-render-count
|
|
11248
|
+
*/
|
|
11249
|
+
|
|
10946
11250
|
/**
|
|
10947
11251
|
* @interface
|
|
10948
11252
|
* @extends HTMLElement
|
|
10949
|
-
* @property {
|
|
11253
|
+
* @property {VizElementAttributes} attributes
|
|
10950
11254
|
*/
|
|
10951
11255
|
|
|
10952
11256
|
const VizElement = {
|
|
@@ -11996,7 +12300,7 @@ async function init(model, optional, halo, initialError) {
|
|
|
11996
12300
|
}
|
|
11997
12301
|
|
|
11998
12302
|
/**
|
|
11999
|
-
* @typedef {string |
|
|
12303
|
+
* @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
|
|
12000
12304
|
*/
|
|
12001
12305
|
|
|
12002
12306
|
/**
|
|
@@ -12006,7 +12310,7 @@ async function init(model, optional, halo, initialError) {
|
|
|
12006
12310
|
* @property {string} type
|
|
12007
12311
|
* @property {string} version
|
|
12008
12312
|
* @property {(Field[])=} fields
|
|
12009
|
-
* @property {
|
|
12313
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
12010
12314
|
*/
|
|
12011
12315
|
|
|
12012
12316
|
async function createSessionObject(_ref, halo) {
|
|
@@ -13179,7 +13483,7 @@ function useRect() {
|
|
|
13179
13483
|
/**
|
|
13180
13484
|
* Gets the layout of the generic object associated with this visualization.
|
|
13181
13485
|
* @entry
|
|
13182
|
-
* @returns {
|
|
13486
|
+
* @returns {EngineAPI.IGenericObjectLayout}
|
|
13183
13487
|
* @example
|
|
13184
13488
|
* import { useLayout } from '@nebula.js/stardust';
|
|
13185
13489
|
* // ...
|
|
@@ -13199,7 +13503,7 @@ function useLayout() {
|
|
|
13199
13503
|
* The returned value from `useStaleLayout()` and `useLayout()` are identical when the object
|
|
13200
13504
|
* is not in a modal state.
|
|
13201
13505
|
* @entry
|
|
13202
|
-
* @returns {
|
|
13506
|
+
* @returns {EngineAPI.IGenericObjectLayout}
|
|
13203
13507
|
* @example
|
|
13204
13508
|
* import { useStaleLayout } from '@nebula.js/stardust';
|
|
13205
13509
|
* // ...
|
|
@@ -13222,7 +13526,7 @@ function useStaleLayout() {
|
|
|
13222
13526
|
/**
|
|
13223
13527
|
* Gets the layout of the app associated with this visualization.
|
|
13224
13528
|
* @entry
|
|
13225
|
-
* @returns {
|
|
13529
|
+
* @returns {EngineAPI.INxAppLayout} The app layout
|
|
13226
13530
|
* @example
|
|
13227
13531
|
* import { useAppLayout } from '@nebula.js/stardust';
|
|
13228
13532
|
* // ...
|
|
@@ -13236,7 +13540,7 @@ function useAppLayout() {
|
|
|
13236
13540
|
/**
|
|
13237
13541
|
* Gets the generic object API of the generic object connected to this visualization.
|
|
13238
13542
|
* @entry
|
|
13239
|
-
* @returns {
|
|
13543
|
+
* @returns {EngineAPI.IGenericObject|undefined}
|
|
13240
13544
|
* @example
|
|
13241
13545
|
* import { useModel } from '@nebula.js/stardust';
|
|
13242
13546
|
* // ...
|
|
@@ -13255,7 +13559,7 @@ function useModel() {
|
|
|
13255
13559
|
/**
|
|
13256
13560
|
* Gets the doc API.
|
|
13257
13561
|
* @entry
|
|
13258
|
-
* @returns {
|
|
13562
|
+
* @returns {EngineAPI.IApp|undefined} The doc API.
|
|
13259
13563
|
* @example
|
|
13260
13564
|
* import { useApp } from '@nebula.js/stardust';
|
|
13261
13565
|
* // ...
|
|
@@ -13274,7 +13578,7 @@ function useApp() {
|
|
|
13274
13578
|
/**
|
|
13275
13579
|
* Gets the global API.
|
|
13276
13580
|
* @entry
|
|
13277
|
-
* @returns {
|
|
13581
|
+
* @returns {EngineAPI.IGlobal|undefined} The global API.
|
|
13278
13582
|
* @example
|
|
13279
13583
|
* import { useGlobal } from '@nebula.js/stardust';
|
|
13280
13584
|
*
|
|
@@ -13599,7 +13903,7 @@ function useImperativeHandle(fn, deps) {
|
|
|
13599
13903
|
/**
|
|
13600
13904
|
* Registers a callback that is called when a snapshot is taken.
|
|
13601
13905
|
* @entry
|
|
13602
|
-
* @param {function(
|
|
13906
|
+
* @param {function(EngineAPI.IGenericObjectLayout): Promise<EngineAPI.IGenericObjectLayout>} snapshotCallback
|
|
13603
13907
|
* @example
|
|
13604
13908
|
* import { onTakeSnapshot } from '@nebula.js/stardust';
|
|
13605
13909
|
* import { useState } from '@nebula.js/stardust';
|
|
@@ -13625,13 +13929,19 @@ function onTakeSnapshot(cb) {
|
|
|
13625
13929
|
|
|
13626
13930
|
h.fn = cb;
|
|
13627
13931
|
}
|
|
13932
|
+
/**
|
|
13933
|
+
* @interface RenderState
|
|
13934
|
+
* @property {any} pending
|
|
13935
|
+
* @property {any} restore
|
|
13936
|
+
*/
|
|
13937
|
+
|
|
13628
13938
|
/**
|
|
13629
13939
|
* Gets render state instance.
|
|
13630
13940
|
*
|
|
13631
13941
|
* Used to update properties and get a new layout without triggering onInitialRender.
|
|
13632
13942
|
* @entry
|
|
13633
13943
|
* @experimental
|
|
13634
|
-
* @returns {
|
|
13944
|
+
* @returns {RenderState} The render state.
|
|
13635
13945
|
* @example
|
|
13636
13946
|
* import { useRenderState } from '@nebula.js/stardust';
|
|
13637
13947
|
*
|
|
@@ -14191,7 +14501,7 @@ const noop = () => {};
|
|
|
14191
14501
|
|
|
14192
14502
|
/**
|
|
14193
14503
|
* @interface QAEDefinition
|
|
14194
|
-
* @property {
|
|
14504
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
14195
14505
|
* @property {object=} data
|
|
14196
14506
|
* @property {DataTarget[]} data.targets
|
|
14197
14507
|
* @property {importProperties=} importProperties
|
|
@@ -14201,8 +14511,23 @@ const noop = () => {};
|
|
|
14201
14511
|
/**
|
|
14202
14512
|
* @interface DataTarget
|
|
14203
14513
|
* @property {string} path
|
|
14204
|
-
* @property {FieldTarget<
|
|
14205
|
-
* @property {FieldTarget<
|
|
14514
|
+
* @property {FieldTarget<EngineAPI.INxDimension>=} dimensions
|
|
14515
|
+
* @property {FieldTarget<EngineAPI.INxMeasure>=} measures
|
|
14516
|
+
*/
|
|
14517
|
+
|
|
14518
|
+
/**
|
|
14519
|
+
* @callback fieldTargetAddedCallback
|
|
14520
|
+
* @template T
|
|
14521
|
+
* @param {T} field
|
|
14522
|
+
* @param {EngineAPI.IGenericObjectProperties} properties
|
|
14523
|
+
*/
|
|
14524
|
+
|
|
14525
|
+
/**
|
|
14526
|
+
* @callback fieldTargetRemovedCallback
|
|
14527
|
+
* @template T
|
|
14528
|
+
* @param {T} field
|
|
14529
|
+
* @param {EngineAPI.IGenericObjectProperties} properties
|
|
14530
|
+
* @param {number} index
|
|
14206
14531
|
*/
|
|
14207
14532
|
|
|
14208
14533
|
/**
|
|
@@ -14210,8 +14535,8 @@ const noop = () => {};
|
|
|
14210
14535
|
* @template T
|
|
14211
14536
|
* @property {function():number} [min]
|
|
14212
14537
|
* @property {function():number} [max]
|
|
14213
|
-
* @property {
|
|
14214
|
-
* @property {
|
|
14538
|
+
* @property {fieldTargetAddedCallback<T>} [added]
|
|
14539
|
+
* @property {fieldTargetRemovedCallback<T>} [removed]
|
|
14215
14540
|
*/
|
|
14216
14541
|
|
|
14217
14542
|
|
|
@@ -16280,7 +16605,7 @@ function nuked() {
|
|
|
16280
16605
|
* Initiates a new `Embed` instance using the specified enigma `app`.
|
|
16281
16606
|
* @entry
|
|
16282
16607
|
* @function embed
|
|
16283
|
-
* @param {
|
|
16608
|
+
* @param {EngineAPI.IApp} app
|
|
16284
16609
|
* @param {Configuration=} instanceConfig
|
|
16285
16610
|
* @returns {Embed}
|
|
16286
16611
|
* @example
|
|
@@ -16499,6 +16824,10 @@ function nuked() {
|
|
|
16499
16824
|
if (!fieldName) {
|
|
16500
16825
|
throw new Error("Field identifier must be provided");
|
|
16501
16826
|
}
|
|
16827
|
+
/**
|
|
16828
|
+
* @typedef {function(function)} ReceiverFunction A callback function which receives another function as input.
|
|
16829
|
+
*/
|
|
16830
|
+
|
|
16502
16831
|
/**
|
|
16503
16832
|
* @class
|
|
16504
16833
|
* @alias FieldInstance
|
|
@@ -16517,8 +16846,12 @@ function nuked() {
|
|
|
16517
16846
|
* @param {string=} [options.direction=ltr] Direction setting ltr|rtl.
|
|
16518
16847
|
* @param {string=} [options.listLayout=vertical] Layout direction vertical|horizontal
|
|
16519
16848
|
* @param {boolean=} [options.search=true] To show the search bar
|
|
16849
|
+
* @param {boolean=} [options.toolbar=true] To show the toolbar
|
|
16520
16850
|
* @param {boolean=} [options.stateName="$"] Sets the state to make selections in
|
|
16521
16851
|
* @param {object=} [options.properties={}] Properties object to extend default properties with
|
|
16852
|
+
* @param {object} [options.sessionModel] Use a custom sessionModel.
|
|
16853
|
+
* @param {object} [options.selectionsApi] Use a custom selectionsApi to customize how values are selected.
|
|
16854
|
+
* @param {ReceiverFunction} [options.update] A function which receives an update function which upon call will trigger a data fetch.
|
|
16522
16855
|
* @since 1.1.0
|
|
16523
16856
|
* @example
|
|
16524
16857
|
* fieldInstance.mount(element);
|
|
@@ -16619,6 +16952,10 @@ function nuked() {
|
|
|
16619
16952
|
embed.config = configuration;
|
|
16620
16953
|
return embed;
|
|
16621
16954
|
}
|
|
16955
|
+
/**
|
|
16956
|
+
* @typedef {any} ThemeJSON
|
|
16957
|
+
*/
|
|
16958
|
+
|
|
16622
16959
|
/**
|
|
16623
16960
|
* @interface ThemeInfo
|
|
16624
16961
|
* @property {string} id Theme identifier
|