@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/dist/stardust.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
|
|
|
@@ -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 = "
|
|
11026
|
+
const NEBULA_VERSION_HASH = "12a4" ;
|
|
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.
|
|
11086
|
+
element.setAttribute('data-nebulajs-version', "2.4.1" );
|
|
11087
11087
|
element.setAttribute('data-app-id', app.id);
|
|
11088
11088
|
document.body.appendChild(element);
|
|
11089
11089
|
ReactDOM.render( /*#__PURE__*/React.createElement(NebulaApp, {
|
|
@@ -18337,6 +18337,256 @@
|
|
|
18337
18337
|
return InfiniteLoader;
|
|
18338
18338
|
}(react.exports.PureComponent);
|
|
18339
18339
|
|
|
18340
|
+
const SELECTED_STATES = ['S', 'XS'];
|
|
18341
|
+
|
|
18342
|
+
const flatten = arr => arr.reduce((prev, cur) => prev.concat(cur));
|
|
18343
|
+
|
|
18344
|
+
function isStateSelected(qState) {
|
|
18345
|
+
return SELECTED_STATES.includes(qState);
|
|
18346
|
+
}
|
|
18347
|
+
|
|
18348
|
+
function getUniques(arr) {
|
|
18349
|
+
return Array.isArray(arr) ? Array.from(new Set(arr)) : undefined;
|
|
18350
|
+
}
|
|
18351
|
+
function getSelectedValues(pages) {
|
|
18352
|
+
if (!pages || !pages.length) {
|
|
18353
|
+
return [];
|
|
18354
|
+
}
|
|
18355
|
+
|
|
18356
|
+
const elementNbrs = pages.map(page => {
|
|
18357
|
+
const elementNumbers = page.qMatrix.map(p => {
|
|
18358
|
+
const [p0] = p;
|
|
18359
|
+
return isStateSelected(p0.qState) ? p0.qElemNumber : false;
|
|
18360
|
+
});
|
|
18361
|
+
return elementNumbers.filter(n => n !== false);
|
|
18362
|
+
});
|
|
18363
|
+
return flatten(elementNbrs);
|
|
18364
|
+
}
|
|
18365
|
+
function applySelectionsOnPages(pages, elmNumbers) {
|
|
18366
|
+
const getNewSelectionState = qState => elmNumbers.length <= 1 && isStateSelected(qState) ? 'A' : 'S';
|
|
18367
|
+
|
|
18368
|
+
const matrices = pages.map(page => {
|
|
18369
|
+
const qMatrix = page.qMatrix.map(p => {
|
|
18370
|
+
const [p0] = p;
|
|
18371
|
+
const selectionMatchesElement = elmNumbers.includes(p0.qElemNumber);
|
|
18372
|
+
const qState = selectionMatchesElement ? getNewSelectionState(p0.qState) : p0.qState;
|
|
18373
|
+
return [_objectSpread2(_objectSpread2({}, p0), {}, {
|
|
18374
|
+
qState
|
|
18375
|
+
}), p.slice(1)];
|
|
18376
|
+
});
|
|
18377
|
+
return _objectSpread2(_objectSpread2({}, page), {}, {
|
|
18378
|
+
qMatrix
|
|
18379
|
+
});
|
|
18380
|
+
});
|
|
18381
|
+
return matrices;
|
|
18382
|
+
}
|
|
18383
|
+
async function selectValues(_ref) {
|
|
18384
|
+
let {
|
|
18385
|
+
selections,
|
|
18386
|
+
elemNumbers,
|
|
18387
|
+
isSingleSelect = false
|
|
18388
|
+
} = _ref;
|
|
18389
|
+
let resolved = Promise.resolve(false);
|
|
18390
|
+
const hasNanValues = elemNumbers.some(elemNumber => Number.isNaN(elemNumber));
|
|
18391
|
+
|
|
18392
|
+
if (!hasNanValues) {
|
|
18393
|
+
const elemNumbersToSelect = elemNumbers;
|
|
18394
|
+
resolved = selections.select({
|
|
18395
|
+
method: 'selectListObjectValues',
|
|
18396
|
+
params: ['/qListObjectDef', elemNumbersToSelect, !isSingleSelect]
|
|
18397
|
+
}).then(success => success !== false).catch(() => false);
|
|
18398
|
+
}
|
|
18399
|
+
|
|
18400
|
+
return resolved;
|
|
18401
|
+
}
|
|
18402
|
+
function getElemNumbersFromPages(pages) {
|
|
18403
|
+
if (!pages || !pages.length) {
|
|
18404
|
+
return [];
|
|
18405
|
+
}
|
|
18406
|
+
|
|
18407
|
+
const elemNumbersArr = pages.map(page => {
|
|
18408
|
+
const qElemNumbers = page.qMatrix.map(p => {
|
|
18409
|
+
const [{
|
|
18410
|
+
qElemNumber
|
|
18411
|
+
}] = p;
|
|
18412
|
+
return qElemNumber;
|
|
18413
|
+
});
|
|
18414
|
+
return qElemNumbers;
|
|
18415
|
+
});
|
|
18416
|
+
const elemNumbers = flatten(elemNumbersArr);
|
|
18417
|
+
return elemNumbers;
|
|
18418
|
+
}
|
|
18419
|
+
/**
|
|
18420
|
+
* @typedef {object} MinMaxResult
|
|
18421
|
+
* @property {number} min
|
|
18422
|
+
* @property {number} max
|
|
18423
|
+
*/
|
|
18424
|
+
|
|
18425
|
+
/**
|
|
18426
|
+
* Returns the min and max indices of elemNumbersOrdered which contains
|
|
18427
|
+
* all numbers in elementNbrs.
|
|
18428
|
+
*
|
|
18429
|
+
* @param {number[]} elementNbrs
|
|
18430
|
+
* @param {number[]} elemNumbersOrdered
|
|
18431
|
+
* @returns {MinMaxResult}
|
|
18432
|
+
*/
|
|
18433
|
+
|
|
18434
|
+
function getMinMax(elementNbrs, elemNumbersOrdered) {
|
|
18435
|
+
let min = Infinity;
|
|
18436
|
+
let max = -Infinity;
|
|
18437
|
+
elementNbrs.forEach(nbr => {
|
|
18438
|
+
const index = elemNumbersOrdered.indexOf(nbr);
|
|
18439
|
+
min = index < min ? index : min;
|
|
18440
|
+
max = index > max ? index : max;
|
|
18441
|
+
});
|
|
18442
|
+
return {
|
|
18443
|
+
min,
|
|
18444
|
+
max
|
|
18445
|
+
};
|
|
18446
|
+
}
|
|
18447
|
+
|
|
18448
|
+
function fillRange(elementNbrs, elemNumbersOrdered) {
|
|
18449
|
+
if (!elementNbrs) {
|
|
18450
|
+
return [];
|
|
18451
|
+
}
|
|
18452
|
+
|
|
18453
|
+
if (elementNbrs.length <= 1) {
|
|
18454
|
+
return elementNbrs;
|
|
18455
|
+
} // Interpolate values algorithm
|
|
18456
|
+
|
|
18457
|
+
|
|
18458
|
+
const {
|
|
18459
|
+
min,
|
|
18460
|
+
max
|
|
18461
|
+
} = getMinMax(elementNbrs, elemNumbersOrdered);
|
|
18462
|
+
return elemNumbersOrdered.slice(min, max + 1);
|
|
18463
|
+
}
|
|
18464
|
+
|
|
18465
|
+
function useSelectionsInteractions(_ref) {
|
|
18466
|
+
let {
|
|
18467
|
+
layout,
|
|
18468
|
+
selections,
|
|
18469
|
+
pages = [],
|
|
18470
|
+
rangeSelect = true,
|
|
18471
|
+
doc = document
|
|
18472
|
+
} = _ref;
|
|
18473
|
+
const [instantPages, setInstantPages] = react.exports.useState(pages);
|
|
18474
|
+
const [mouseDown, setMouseDown] = react.exports.useState(false);
|
|
18475
|
+
const [selectingValues, setSelectingValues] = react.exports.useState(false);
|
|
18476
|
+
const [selected, setSelected] = react.exports.useState([]);
|
|
18477
|
+
const [isRangeSelection, setIsRangeSelection] = react.exports.useState(false);
|
|
18478
|
+
const [preSelected, setPreSelected] = react.exports.useState([]);
|
|
18479
|
+
const elemNumbersOrdered = getElemNumbersFromPages(pages);
|
|
18480
|
+
|
|
18481
|
+
const getIsSingleSelect = () => !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne); // Select values for real, by calling the backend.
|
|
18482
|
+
|
|
18483
|
+
|
|
18484
|
+
const select = async function () {
|
|
18485
|
+
let elemNumbers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
18486
|
+
let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18487
|
+
setSelectingValues(true);
|
|
18488
|
+
const isSingleSelect = getIsSingleSelect();
|
|
18489
|
+
const filtered = additive ? elemNumbers.filter(n => !selected.includes(n)) : elemNumbers;
|
|
18490
|
+
await selectValues({
|
|
18491
|
+
selections,
|
|
18492
|
+
elemNumbers: filtered,
|
|
18493
|
+
isSingleSelect
|
|
18494
|
+
});
|
|
18495
|
+
setSelectingValues(false);
|
|
18496
|
+
}; // Show estimated selection states instantly before applying the selections for real.
|
|
18497
|
+
|
|
18498
|
+
|
|
18499
|
+
const preSelect = function (elemNumbers) {
|
|
18500
|
+
let additive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18501
|
+
setPreSelected(existing => {
|
|
18502
|
+
const uniques = getUniques([...existing, ...elemNumbers]);
|
|
18503
|
+
const filtered = additive ? uniques.filter(n => !selected.includes(n)) : uniques;
|
|
18504
|
+
const filled = additive ? fillRange(uniques, elemNumbersOrdered) : filtered;
|
|
18505
|
+
return filled;
|
|
18506
|
+
});
|
|
18507
|
+
};
|
|
18508
|
+
|
|
18509
|
+
const onMouseDown = react.exports.useCallback(event => {
|
|
18510
|
+
if (selectingValues) {
|
|
18511
|
+
return;
|
|
18512
|
+
}
|
|
18513
|
+
|
|
18514
|
+
setIsRangeSelection(false);
|
|
18515
|
+
setMouseDown(true);
|
|
18516
|
+
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
18517
|
+
setPreSelected([elemNumber]);
|
|
18518
|
+
}, [selectingValues]);
|
|
18519
|
+
const onMouseUp = react.exports.useCallback(event => {
|
|
18520
|
+
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
18521
|
+
|
|
18522
|
+
if (getIsSingleSelect() || !rangeSelect || !mouseDown || selectingValues || preSelected.length === 1 && preSelected[0] === elemNumber // prevent toggling again on mouseup
|
|
18523
|
+
) {
|
|
18524
|
+
return;
|
|
18525
|
+
}
|
|
18526
|
+
|
|
18527
|
+
preSelect([elemNumber]);
|
|
18528
|
+
}, [mouseDown, selectingValues, preSelected, selected, isRangeSelection]);
|
|
18529
|
+
const onMouseUpDoc = react.exports.useCallback(() => {
|
|
18530
|
+
// Ensure we end interactions when mouseup happens outside the Listbox.
|
|
18531
|
+
setMouseDown(false);
|
|
18532
|
+
setSelectingValues(false);
|
|
18533
|
+
}, []);
|
|
18534
|
+
const onMouseEnter = react.exports.useCallback(event => {
|
|
18535
|
+
if (getIsSingleSelect() || !mouseDown || selectingValues) {
|
|
18536
|
+
return;
|
|
18537
|
+
}
|
|
18538
|
+
|
|
18539
|
+
setIsRangeSelection(true);
|
|
18540
|
+
const elemNumber = +event.currentTarget.getAttribute('data-n');
|
|
18541
|
+
preSelect([elemNumber], true);
|
|
18542
|
+
}, [mouseDown, selectingValues, isRangeSelection, preSelected, selected, layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne]);
|
|
18543
|
+
react.exports.useEffect(() => {
|
|
18544
|
+
// Perform selections of pre-selected values. This can
|
|
18545
|
+
// happen only when interactions have finished (mouseup).
|
|
18546
|
+
const interactionIsFinished = !mouseDown;
|
|
18547
|
+
|
|
18548
|
+
if (!preSelected || !preSelected.length || selectingValues || !interactionIsFinished || !layout) {
|
|
18549
|
+
return;
|
|
18550
|
+
}
|
|
18551
|
+
|
|
18552
|
+
select(preSelected, isRangeSelection);
|
|
18553
|
+
}, [preSelected, mouseDown]);
|
|
18554
|
+
react.exports.useEffect(() => {
|
|
18555
|
+
doc.addEventListener('mouseup', onMouseUpDoc);
|
|
18556
|
+
return () => {
|
|
18557
|
+
doc.removeEventListener('mouseup', onMouseUpDoc);
|
|
18558
|
+
};
|
|
18559
|
+
}, []);
|
|
18560
|
+
react.exports.useEffect(() => {
|
|
18561
|
+
if (selectingValues || mouseDown) {
|
|
18562
|
+
return;
|
|
18563
|
+
} // Keep track of (truely) selected fields so we can prevent toggling them on range select.
|
|
18564
|
+
|
|
18565
|
+
|
|
18566
|
+
const alreadySelected = getSelectedValues(pages);
|
|
18567
|
+
setSelected(alreadySelected);
|
|
18568
|
+
}, [pages]);
|
|
18569
|
+
react.exports.useEffect(() => {
|
|
18570
|
+
if (selectingValues || !pages || !mouseDown) {
|
|
18571
|
+
return;
|
|
18572
|
+
} // Render pre-selections before they have been selected in Engine.
|
|
18573
|
+
|
|
18574
|
+
|
|
18575
|
+
const newPages = applySelectionsOnPages(pages, preSelected);
|
|
18576
|
+
setInstantPages(newPages);
|
|
18577
|
+
}, [preSelected]);
|
|
18578
|
+
const rangeSelectEvents = rangeSelect ? {
|
|
18579
|
+
onMouseUp,
|
|
18580
|
+
onMouseEnter
|
|
18581
|
+
} : {};
|
|
18582
|
+
return {
|
|
18583
|
+
instantPages,
|
|
18584
|
+
interactionEvents: _objectSpread2({
|
|
18585
|
+
onMouseDown
|
|
18586
|
+
}, rangeSelectEvents)
|
|
18587
|
+
};
|
|
18588
|
+
}
|
|
18589
|
+
|
|
18340
18590
|
const tick = props => _objectSpread2(_objectSpread2({}, props), {}, {
|
|
18341
18591
|
shapes: [{
|
|
18342
18592
|
type: 'path',
|
|
@@ -18362,7 +18612,8 @@
|
|
|
18362
18612
|
'& span': {
|
|
18363
18613
|
whiteSpace: 'nowrap',
|
|
18364
18614
|
fontSize: '12px',
|
|
18365
|
-
lineHeight: '16px'
|
|
18615
|
+
lineHeight: '16px',
|
|
18616
|
+
userSelect: 'none'
|
|
18366
18617
|
},
|
|
18367
18618
|
overflow: 'hidden',
|
|
18368
18619
|
textOverflow: 'ellipsis'
|
|
@@ -18400,7 +18651,9 @@
|
|
|
18400
18651
|
const classArr = [classes.row];
|
|
18401
18652
|
let label = '';
|
|
18402
18653
|
const {
|
|
18403
|
-
|
|
18654
|
+
onMouseDown,
|
|
18655
|
+
onMouseUp,
|
|
18656
|
+
onMouseEnter,
|
|
18404
18657
|
pages
|
|
18405
18658
|
} = data;
|
|
18406
18659
|
let cell;
|
|
@@ -18463,7 +18716,9 @@
|
|
|
18463
18716
|
spacing: 0,
|
|
18464
18717
|
className: classArr.join(' ').trim(),
|
|
18465
18718
|
style: style,
|
|
18466
|
-
|
|
18719
|
+
onMouseDown: onMouseDown,
|
|
18720
|
+
onMouseUp: onMouseUp,
|
|
18721
|
+
onMouseEnter: onMouseEnter,
|
|
18467
18722
|
role: "row",
|
|
18468
18723
|
tabIndex: 0,
|
|
18469
18724
|
"data-n": cell && cell.qElemNumber
|
|
@@ -18515,7 +18770,8 @@
|
|
|
18515
18770
|
'& span': {
|
|
18516
18771
|
whiteSpace: 'nowrap',
|
|
18517
18772
|
fontSize: '12px',
|
|
18518
|
-
lineHeight: '16px'
|
|
18773
|
+
lineHeight: '16px',
|
|
18774
|
+
userSelect: 'none'
|
|
18519
18775
|
},
|
|
18520
18776
|
overflow: 'hidden',
|
|
18521
18777
|
textOverflow: 'ellipsis'
|
|
@@ -18553,7 +18809,9 @@
|
|
|
18553
18809
|
const classArr = [classes.column];
|
|
18554
18810
|
let label = '';
|
|
18555
18811
|
const {
|
|
18556
|
-
|
|
18812
|
+
onMouseDown,
|
|
18813
|
+
onMouseUp,
|
|
18814
|
+
onMouseEnter,
|
|
18557
18815
|
pages
|
|
18558
18816
|
} = data;
|
|
18559
18817
|
let cell;
|
|
@@ -18616,8 +18874,10 @@
|
|
|
18616
18874
|
spacing: 0,
|
|
18617
18875
|
className: classArr.join(' ').trim(),
|
|
18618
18876
|
style: style,
|
|
18619
|
-
onClick: onClick,
|
|
18620
18877
|
alignItems: "center",
|
|
18878
|
+
onMouseDown: onMouseDown,
|
|
18879
|
+
onMouseUp: onMouseUp,
|
|
18880
|
+
onMouseEnter: onMouseEnter,
|
|
18621
18881
|
role: "row",
|
|
18622
18882
|
tabIndex: 0,
|
|
18623
18883
|
"data-n": cell && cell.qElemNumber
|
|
@@ -18655,7 +18915,6 @@
|
|
|
18655
18915
|
})));
|
|
18656
18916
|
}
|
|
18657
18917
|
|
|
18658
|
-
/* eslint no-underscore-dangle:0 */
|
|
18659
18918
|
function ListBox(_ref) {
|
|
18660
18919
|
let {
|
|
18661
18920
|
model,
|
|
@@ -18663,10 +18922,23 @@
|
|
|
18663
18922
|
direction,
|
|
18664
18923
|
height,
|
|
18665
18924
|
width,
|
|
18666
|
-
listLayout = 'vertical'
|
|
18925
|
+
listLayout = 'vertical',
|
|
18926
|
+
rangeSelect = true,
|
|
18927
|
+
update = undefined
|
|
18667
18928
|
} = _ref;
|
|
18668
18929
|
const [layout] = useLayout$1(model);
|
|
18669
18930
|
const [pages, setPages] = react.exports.useState(null);
|
|
18931
|
+
const [isLoadingData, setIsLoadingData] = react.exports.useState(false);
|
|
18932
|
+
const {
|
|
18933
|
+
instantPages = [],
|
|
18934
|
+
interactionEvents
|
|
18935
|
+
} = useSelectionsInteractions({
|
|
18936
|
+
layout,
|
|
18937
|
+
selections,
|
|
18938
|
+
pages,
|
|
18939
|
+
rangeSelect,
|
|
18940
|
+
doc: document
|
|
18941
|
+
});
|
|
18670
18942
|
const loaderRef = react.exports.useRef(null);
|
|
18671
18943
|
const local = react.exports.useRef({
|
|
18672
18944
|
queue: [],
|
|
@@ -18675,28 +18947,17 @@
|
|
|
18675
18947
|
const listData = react.exports.useRef({
|
|
18676
18948
|
pages: []
|
|
18677
18949
|
});
|
|
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
18950
|
const isItemLoaded = react.exports.useCallback(index => {
|
|
18693
18951
|
if (!pages || !local.current.validPages) {
|
|
18694
18952
|
return false;
|
|
18695
18953
|
}
|
|
18696
18954
|
|
|
18697
18955
|
local.current.checkIdx = index;
|
|
18698
|
-
|
|
18699
|
-
|
|
18956
|
+
|
|
18957
|
+
const isLoaded = p => p.qArea.qTop <= index && index < p.qArea.qTop + p.qArea.qHeight;
|
|
18958
|
+
|
|
18959
|
+
const page = pages.filter(p => isLoaded(p))[0];
|
|
18960
|
+
return page && isLoaded(page);
|
|
18700
18961
|
}, [layout, pages]);
|
|
18701
18962
|
const loadMoreItems = react.exports.useCallback((startIndex, stopIndex) => {
|
|
18702
18963
|
local.current.queue.push({
|
|
@@ -18710,6 +18971,7 @@
|
|
|
18710
18971
|
}
|
|
18711
18972
|
|
|
18712
18973
|
clearTimeout(local.current.timeout);
|
|
18974
|
+
setIsLoadingData(true);
|
|
18713
18975
|
return new Promise(resolve => {
|
|
18714
18976
|
local.current.timeout = setTimeout(() => {
|
|
18715
18977
|
const sorted = local.current.queue.slice(-2).sort((a, b) => a.start - b.start);
|
|
@@ -18722,12 +18984,14 @@
|
|
|
18722
18984
|
local.current.validPages = true;
|
|
18723
18985
|
listData.current.pages = p;
|
|
18724
18986
|
setPages(p);
|
|
18987
|
+
setIsLoadingData(false);
|
|
18725
18988
|
resolve();
|
|
18726
18989
|
});
|
|
18727
18990
|
}, isScrolling ? 500 : 0);
|
|
18728
18991
|
});
|
|
18729
18992
|
}, [layout]);
|
|
18730
|
-
|
|
18993
|
+
|
|
18994
|
+
const fetchData = () => {
|
|
18731
18995
|
local.current.queue = [];
|
|
18732
18996
|
local.current.validPages = false;
|
|
18733
18997
|
|
|
@@ -18740,7 +19004,23 @@
|
|
|
18740
19004
|
|
|
18741
19005
|
loaderRef.current._listRef.scrollToItem(0);
|
|
18742
19006
|
}
|
|
19007
|
+
};
|
|
19008
|
+
|
|
19009
|
+
if (update) {
|
|
19010
|
+
// Hand over the update function for manual refresh from hosting application.
|
|
19011
|
+
update.call(null, fetchData);
|
|
19012
|
+
}
|
|
19013
|
+
|
|
19014
|
+
react.exports.useEffect(() => {
|
|
19015
|
+
fetchData();
|
|
18743
19016
|
}, [layout]);
|
|
19017
|
+
react.exports.useEffect(() => {
|
|
19018
|
+
if (!instantPages || isLoadingData) {
|
|
19019
|
+
return;
|
|
19020
|
+
}
|
|
19021
|
+
|
|
19022
|
+
setPages(instantPages);
|
|
19023
|
+
}, [instantPages]);
|
|
18744
19024
|
|
|
18745
19025
|
if (!layout) {
|
|
18746
19026
|
return null;
|
|
@@ -18765,16 +19045,16 @@
|
|
|
18765
19045
|
local.current.listRef = ref;
|
|
18766
19046
|
return /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
18767
19047
|
direction: direction,
|
|
19048
|
+
"data-testid": "fixed-size-list",
|
|
18768
19049
|
useIsScrolling: true,
|
|
18769
19050
|
style: {},
|
|
18770
19051
|
height: listHeight,
|
|
18771
19052
|
width: width,
|
|
18772
19053
|
itemCount: count,
|
|
18773
19054
|
layout: listLayout,
|
|
18774
|
-
itemData: {
|
|
18775
|
-
onClick,
|
|
19055
|
+
itemData: _objectSpread2(_objectSpread2({}, interactionEvents), {}, {
|
|
18776
19056
|
pages
|
|
18777
|
-
},
|
|
19057
|
+
}),
|
|
18778
19058
|
itemSize: ITEM_SIZE,
|
|
18779
19059
|
onItemsRendered: onItemsRendered,
|
|
18780
19060
|
ref: ref
|
|
@@ -21000,7 +21280,12 @@
|
|
|
21000
21280
|
direction,
|
|
21001
21281
|
listLayout,
|
|
21002
21282
|
search = true,
|
|
21003
|
-
|
|
21283
|
+
toolbar = true,
|
|
21284
|
+
rangeSelect = true,
|
|
21285
|
+
properties = {},
|
|
21286
|
+
sessionModel = undefined,
|
|
21287
|
+
selectionsApi = undefined,
|
|
21288
|
+
update = undefined
|
|
21004
21289
|
} = options;
|
|
21005
21290
|
|
|
21006
21291
|
const listdef = _objectSpread2({
|
|
@@ -21026,9 +21311,10 @@
|
|
|
21026
21311
|
}
|
|
21027
21312
|
},
|
|
21028
21313
|
title
|
|
21029
|
-
}, properties);
|
|
21314
|
+
}, properties); // Something something lib dimension
|
|
21315
|
+
|
|
21030
21316
|
|
|
21031
|
-
let fieldName;
|
|
21317
|
+
let fieldName;
|
|
21032
21318
|
|
|
21033
21319
|
if (fieldIdentifier.qLibraryId) {
|
|
21034
21320
|
listdef.qListObjectDef.qLibraryId = fieldIdentifier.qLibraryId;
|
|
@@ -21038,8 +21324,19 @@
|
|
|
21038
21324
|
fieldName = fieldIdentifier;
|
|
21039
21325
|
}
|
|
21040
21326
|
|
|
21327
|
+
let [model] = useSessionModel(listdef, sessionModel ? null : app, fieldName, stateName);
|
|
21328
|
+
|
|
21329
|
+
if (sessionModel) {
|
|
21330
|
+
model = sessionModel;
|
|
21331
|
+
}
|
|
21332
|
+
|
|
21333
|
+
let selections = useObjectSelections(selectionsApi ? {} : app, model)[0];
|
|
21334
|
+
|
|
21335
|
+
if (selectionsApi) {
|
|
21336
|
+
selections = selectionsApi;
|
|
21337
|
+
}
|
|
21338
|
+
|
|
21041
21339
|
const theme = useTheme$2();
|
|
21042
|
-
const [model] = useSessionModel(listdef, app, fieldName, stateName);
|
|
21043
21340
|
const lock = react.exports.useCallback(() => {
|
|
21044
21341
|
model.lock('/qListObjectDef');
|
|
21045
21342
|
}, [model]);
|
|
@@ -21050,7 +21347,6 @@
|
|
|
21050
21347
|
translator
|
|
21051
21348
|
} = react.exports.useContext(InstanceContext);
|
|
21052
21349
|
const moreAlignTo = react.exports.useRef();
|
|
21053
|
-
const [selections] = useObjectSelections(app, model);
|
|
21054
21350
|
const [layout] = useLayout$1(model);
|
|
21055
21351
|
const [showToolbar, setShowToolbar] = react.exports.useState(false);
|
|
21056
21352
|
react.exports.useEffect(() => {
|
|
@@ -21076,11 +21372,11 @@
|
|
|
21076
21372
|
}
|
|
21077
21373
|
|
|
21078
21374
|
const isLocked = layout.qListObject.qDimensionInfo.qLocked === true;
|
|
21079
|
-
const listboxSelectionToolbarItems = createListboxSelectionToolbar({
|
|
21375
|
+
const listboxSelectionToolbarItems = toolbar ? createListboxSelectionToolbar({
|
|
21080
21376
|
layout,
|
|
21081
21377
|
model,
|
|
21082
21378
|
translator
|
|
21083
|
-
});
|
|
21379
|
+
}) : [];
|
|
21084
21380
|
const counts = layout.qListObject.qDimensionInfo.qStateCounts;
|
|
21085
21381
|
const hasSelections = counts.qSelected + counts.qSelectedExcluded + counts.qLocked + counts.qLockedExcluded > 0;
|
|
21086
21382
|
const minHeight = 49 + (search ? 40 : 0) + 49;
|
|
@@ -21092,7 +21388,7 @@
|
|
|
21092
21388
|
height: '100%',
|
|
21093
21389
|
minHeight: "".concat(minHeight, "px")
|
|
21094
21390
|
}
|
|
21095
|
-
}, /*#__PURE__*/React.createElement(Grid$1, {
|
|
21391
|
+
}, toolbar && /*#__PURE__*/React.createElement(Grid$1, {
|
|
21096
21392
|
item: true,
|
|
21097
21393
|
container: true,
|
|
21098
21394
|
style: {
|
|
@@ -21156,8 +21452,10 @@
|
|
|
21156
21452
|
selections: selections,
|
|
21157
21453
|
direction: direction,
|
|
21158
21454
|
listLayout: listLayout,
|
|
21455
|
+
rangeSelect: rangeSelect,
|
|
21159
21456
|
height: height,
|
|
21160
|
-
width: width
|
|
21457
|
+
width: width,
|
|
21458
|
+
update: update
|
|
21161
21459
|
});
|
|
21162
21460
|
})));
|
|
21163
21461
|
}
|
|
@@ -21398,10 +21696,10 @@
|
|
|
21398
21696
|
/**
|
|
21399
21697
|
* @since 1.1.0
|
|
21400
21698
|
* @interface ExportDataDef
|
|
21401
|
-
* @property {
|
|
21402
|
-
* @property {
|
|
21403
|
-
* @property {
|
|
21404
|
-
* @property {
|
|
21699
|
+
* @property {EngineAPI.INxDimension[]} dimensions
|
|
21700
|
+
* @property {EngineAPI.INxMeasure[]} measures
|
|
21701
|
+
* @property {EngineAPI.INxDimension[]} excludedDimensions
|
|
21702
|
+
* @property {EngineAPI.INxMeasure[]} excludedMeasures
|
|
21405
21703
|
* @property {number[]} interColumnSortOrder
|
|
21406
21704
|
*/
|
|
21407
21705
|
|
|
@@ -22845,10 +23143,16 @@
|
|
|
22845
23143
|
|
|
22846
23144
|
}
|
|
22847
23145
|
|
|
23146
|
+
/**
|
|
23147
|
+
* @interface VizElementAttributes
|
|
23148
|
+
* @extends NamedNodeMap
|
|
23149
|
+
* @property {string} data-render-count
|
|
23150
|
+
*/
|
|
23151
|
+
|
|
22848
23152
|
/**
|
|
22849
23153
|
* @interface
|
|
22850
23154
|
* @extends HTMLElement
|
|
22851
|
-
* @property {
|
|
23155
|
+
* @property {VizElementAttributes} attributes
|
|
22852
23156
|
*/
|
|
22853
23157
|
|
|
22854
23158
|
const VizElement = {
|
|
@@ -23898,7 +24202,7 @@
|
|
|
23898
24202
|
}
|
|
23899
24203
|
|
|
23900
24204
|
/**
|
|
23901
|
-
* @typedef {string |
|
|
24205
|
+
* @typedef {string | EngineAPI.INxDimension | EngineAPI.INxMeasure | LibraryField} Field
|
|
23902
24206
|
*/
|
|
23903
24207
|
|
|
23904
24208
|
/**
|
|
@@ -23908,7 +24212,7 @@
|
|
|
23908
24212
|
* @property {string} type
|
|
23909
24213
|
* @property {string} version
|
|
23910
24214
|
* @property {(Field[])=} fields
|
|
23911
|
-
* @property {
|
|
24215
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
23912
24216
|
*/
|
|
23913
24217
|
|
|
23914
24218
|
async function createSessionObject(_ref, halo) {
|
|
@@ -25081,7 +25385,7 @@
|
|
|
25081
25385
|
/**
|
|
25082
25386
|
* Gets the layout of the generic object associated with this visualization.
|
|
25083
25387
|
* @entry
|
|
25084
|
-
* @returns {
|
|
25388
|
+
* @returns {EngineAPI.IGenericObjectLayout}
|
|
25085
25389
|
* @example
|
|
25086
25390
|
* import { useLayout } from '@nebula.js/stardust';
|
|
25087
25391
|
* // ...
|
|
@@ -25101,7 +25405,7 @@
|
|
|
25101
25405
|
* The returned value from `useStaleLayout()` and `useLayout()` are identical when the object
|
|
25102
25406
|
* is not in a modal state.
|
|
25103
25407
|
* @entry
|
|
25104
|
-
* @returns {
|
|
25408
|
+
* @returns {EngineAPI.IGenericObjectLayout}
|
|
25105
25409
|
* @example
|
|
25106
25410
|
* import { useStaleLayout } from '@nebula.js/stardust';
|
|
25107
25411
|
* // ...
|
|
@@ -25124,7 +25428,7 @@
|
|
|
25124
25428
|
/**
|
|
25125
25429
|
* Gets the layout of the app associated with this visualization.
|
|
25126
25430
|
* @entry
|
|
25127
|
-
* @returns {
|
|
25431
|
+
* @returns {EngineAPI.INxAppLayout} The app layout
|
|
25128
25432
|
* @example
|
|
25129
25433
|
* import { useAppLayout } from '@nebula.js/stardust';
|
|
25130
25434
|
* // ...
|
|
@@ -25138,7 +25442,7 @@
|
|
|
25138
25442
|
/**
|
|
25139
25443
|
* Gets the generic object API of the generic object connected to this visualization.
|
|
25140
25444
|
* @entry
|
|
25141
|
-
* @returns {
|
|
25445
|
+
* @returns {EngineAPI.IGenericObject|undefined}
|
|
25142
25446
|
* @example
|
|
25143
25447
|
* import { useModel } from '@nebula.js/stardust';
|
|
25144
25448
|
* // ...
|
|
@@ -25157,7 +25461,7 @@
|
|
|
25157
25461
|
/**
|
|
25158
25462
|
* Gets the doc API.
|
|
25159
25463
|
* @entry
|
|
25160
|
-
* @returns {
|
|
25464
|
+
* @returns {EngineAPI.IApp|undefined} The doc API.
|
|
25161
25465
|
* @example
|
|
25162
25466
|
* import { useApp } from '@nebula.js/stardust';
|
|
25163
25467
|
* // ...
|
|
@@ -25176,7 +25480,7 @@
|
|
|
25176
25480
|
/**
|
|
25177
25481
|
* Gets the global API.
|
|
25178
25482
|
* @entry
|
|
25179
|
-
* @returns {
|
|
25483
|
+
* @returns {EngineAPI.IGlobal|undefined} The global API.
|
|
25180
25484
|
* @example
|
|
25181
25485
|
* import { useGlobal } from '@nebula.js/stardust';
|
|
25182
25486
|
*
|
|
@@ -25501,7 +25805,7 @@
|
|
|
25501
25805
|
/**
|
|
25502
25806
|
* Registers a callback that is called when a snapshot is taken.
|
|
25503
25807
|
* @entry
|
|
25504
|
-
* @param {function(
|
|
25808
|
+
* @param {function(EngineAPI.IGenericObjectLayout): Promise<EngineAPI.IGenericObjectLayout>} snapshotCallback
|
|
25505
25809
|
* @example
|
|
25506
25810
|
* import { onTakeSnapshot } from '@nebula.js/stardust';
|
|
25507
25811
|
* import { useState } from '@nebula.js/stardust';
|
|
@@ -25527,13 +25831,19 @@
|
|
|
25527
25831
|
|
|
25528
25832
|
h.fn = cb;
|
|
25529
25833
|
}
|
|
25834
|
+
/**
|
|
25835
|
+
* @interface RenderState
|
|
25836
|
+
* @property {any} pending
|
|
25837
|
+
* @property {any} restore
|
|
25838
|
+
*/
|
|
25839
|
+
|
|
25530
25840
|
/**
|
|
25531
25841
|
* Gets render state instance.
|
|
25532
25842
|
*
|
|
25533
25843
|
* Used to update properties and get a new layout without triggering onInitialRender.
|
|
25534
25844
|
* @entry
|
|
25535
25845
|
* @experimental
|
|
25536
|
-
* @returns {
|
|
25846
|
+
* @returns {RenderState} The render state.
|
|
25537
25847
|
* @example
|
|
25538
25848
|
* import { useRenderState } from '@nebula.js/stardust';
|
|
25539
25849
|
*
|
|
@@ -26093,7 +26403,7 @@
|
|
|
26093
26403
|
|
|
26094
26404
|
/**
|
|
26095
26405
|
* @interface QAEDefinition
|
|
26096
|
-
* @property {
|
|
26406
|
+
* @property {EngineAPI.IGenericObjectProperties=} properties
|
|
26097
26407
|
* @property {object=} data
|
|
26098
26408
|
* @property {DataTarget[]} data.targets
|
|
26099
26409
|
* @property {importProperties=} importProperties
|
|
@@ -26103,8 +26413,23 @@
|
|
|
26103
26413
|
/**
|
|
26104
26414
|
* @interface DataTarget
|
|
26105
26415
|
* @property {string} path
|
|
26106
|
-
* @property {FieldTarget<
|
|
26107
|
-
* @property {FieldTarget<
|
|
26416
|
+
* @property {FieldTarget<EngineAPI.INxDimension>=} dimensions
|
|
26417
|
+
* @property {FieldTarget<EngineAPI.INxMeasure>=} measures
|
|
26418
|
+
*/
|
|
26419
|
+
|
|
26420
|
+
/**
|
|
26421
|
+
* @callback fieldTargetAddedCallback
|
|
26422
|
+
* @template T
|
|
26423
|
+
* @param {T} field
|
|
26424
|
+
* @param {EngineAPI.IGenericObjectProperties} properties
|
|
26425
|
+
*/
|
|
26426
|
+
|
|
26427
|
+
/**
|
|
26428
|
+
* @callback fieldTargetRemovedCallback
|
|
26429
|
+
* @template T
|
|
26430
|
+
* @param {T} field
|
|
26431
|
+
* @param {EngineAPI.IGenericObjectProperties} properties
|
|
26432
|
+
* @param {number} index
|
|
26108
26433
|
*/
|
|
26109
26434
|
|
|
26110
26435
|
/**
|
|
@@ -26112,8 +26437,8 @@
|
|
|
26112
26437
|
* @template T
|
|
26113
26438
|
* @property {function():number} [min]
|
|
26114
26439
|
* @property {function():number} [max]
|
|
26115
|
-
* @property {
|
|
26116
|
-
* @property {
|
|
26440
|
+
* @property {fieldTargetAddedCallback<T>} [added]
|
|
26441
|
+
* @property {fieldTargetRemovedCallback<T>} [removed]
|
|
26117
26442
|
*/
|
|
26118
26443
|
|
|
26119
26444
|
|
|
@@ -28182,7 +28507,7 @@
|
|
|
28182
28507
|
* Initiates a new `Embed` instance using the specified enigma `app`.
|
|
28183
28508
|
* @entry
|
|
28184
28509
|
* @function embed
|
|
28185
|
-
* @param {
|
|
28510
|
+
* @param {EngineAPI.IApp} app
|
|
28186
28511
|
* @param {Configuration=} instanceConfig
|
|
28187
28512
|
* @returns {Embed}
|
|
28188
28513
|
* @example
|
|
@@ -28401,6 +28726,10 @@
|
|
|
28401
28726
|
if (!fieldName) {
|
|
28402
28727
|
throw new Error("Field identifier must be provided");
|
|
28403
28728
|
}
|
|
28729
|
+
/**
|
|
28730
|
+
* @typedef {function(function)} ReceiverFunction A callback function which receives another function as input.
|
|
28731
|
+
*/
|
|
28732
|
+
|
|
28404
28733
|
/**
|
|
28405
28734
|
* @class
|
|
28406
28735
|
* @alias FieldInstance
|
|
@@ -28419,8 +28748,12 @@
|
|
|
28419
28748
|
* @param {string=} [options.direction=ltr] Direction setting ltr|rtl.
|
|
28420
28749
|
* @param {string=} [options.listLayout=vertical] Layout direction vertical|horizontal
|
|
28421
28750
|
* @param {boolean=} [options.search=true] To show the search bar
|
|
28751
|
+
* @param {boolean=} [options.toolbar=true] To show the toolbar
|
|
28422
28752
|
* @param {boolean=} [options.stateName="$"] Sets the state to make selections in
|
|
28423
28753
|
* @param {object=} [options.properties={}] Properties object to extend default properties with
|
|
28754
|
+
* @param {object} [options.sessionModel] Use a custom sessionModel.
|
|
28755
|
+
* @param {object} [options.selectionsApi] Use a custom selectionsApi to customize how values are selected.
|
|
28756
|
+
* @param {ReceiverFunction} [options.update] A function which receives an update function which upon call will trigger a data fetch.
|
|
28424
28757
|
* @since 1.1.0
|
|
28425
28758
|
* @example
|
|
28426
28759
|
* fieldInstance.mount(element);
|
|
@@ -28521,6 +28854,10 @@
|
|
|
28521
28854
|
embed.config = configuration;
|
|
28522
28855
|
return embed;
|
|
28523
28856
|
}
|
|
28857
|
+
/**
|
|
28858
|
+
* @typedef {any} ThemeJSON
|
|
28859
|
+
*/
|
|
28860
|
+
|
|
28524
28861
|
/**
|
|
28525
28862
|
* @interface ThemeInfo
|
|
28526
28863
|
* @property {string} id Theme identifier
|