@nebula.js/stardust 4.0.0-alpha.2 → 4.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/esm/dev.js +114 -36
- 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 +114 -36
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +3 -3
- package/dist/stardust.js.map +1 -1
- package/package.json +9 -9
- package/types/index.d.ts +9 -9
package/dist/stardust.dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v4.0.0-alpha.
|
|
2
|
+
* @nebula.js/stardust v4.0.0-alpha.3
|
|
3
3
|
* Copyright (c) 2023 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -15399,7 +15399,7 @@
|
|
|
15399
15399
|
return cache[key];
|
|
15400
15400
|
}
|
|
15401
15401
|
|
|
15402
|
-
const NEBULA_VERSION_HASH = "
|
|
15402
|
+
const NEBULA_VERSION_HASH = "ee80" ;
|
|
15403
15403
|
ClassNameGenerator$1.configure(componentName => {
|
|
15404
15404
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
15405
15405
|
});
|
|
@@ -15607,7 +15607,7 @@
|
|
|
15607
15607
|
const appRef = React.createRef();
|
|
15608
15608
|
const element = document.createElement('div');
|
|
15609
15609
|
element.style.display = 'none';
|
|
15610
|
-
element.setAttribute('data-nebulajs-version', "4.0.0-alpha.
|
|
15610
|
+
element.setAttribute('data-nebulajs-version', "4.0.0-alpha.3" );
|
|
15611
15611
|
element.setAttribute('data-app-id', app.id);
|
|
15612
15612
|
document.body.appendChild(element);
|
|
15613
15613
|
const root = client.createRoot(element);
|
|
@@ -21956,6 +21956,8 @@
|
|
|
21956
21956
|
function getFieldKeyboardNavigation(_ref) {
|
|
21957
21957
|
let {
|
|
21958
21958
|
select,
|
|
21959
|
+
selectAll,
|
|
21960
|
+
onCtrlF,
|
|
21959
21961
|
confirm,
|
|
21960
21962
|
cancel,
|
|
21961
21963
|
setScrollPosition,
|
|
@@ -21975,7 +21977,8 @@
|
|
|
21975
21977
|
const {
|
|
21976
21978
|
keyCode,
|
|
21977
21979
|
shiftKey = false,
|
|
21978
|
-
ctrlKey = false
|
|
21980
|
+
ctrlKey = false,
|
|
21981
|
+
metaKey = false
|
|
21979
21982
|
} = event.nativeEvent;
|
|
21980
21983
|
switch (keyCode) {
|
|
21981
21984
|
case KEYS.SHIFT:
|
|
@@ -22030,6 +22033,18 @@
|
|
|
22030
22033
|
}
|
|
22031
22034
|
setScrollPosition === null || setScrollPosition === void 0 ? void 0 : setScrollPosition('end');
|
|
22032
22035
|
break;
|
|
22036
|
+
case KEYS.A:
|
|
22037
|
+
if (ctrlKey || metaKey) {
|
|
22038
|
+
selectAll();
|
|
22039
|
+
break;
|
|
22040
|
+
}
|
|
22041
|
+
return;
|
|
22042
|
+
case KEYS.F:
|
|
22043
|
+
if (ctrlKey || metaKey) {
|
|
22044
|
+
onCtrlF();
|
|
22045
|
+
break;
|
|
22046
|
+
}
|
|
22047
|
+
return;
|
|
22033
22048
|
default:
|
|
22034
22049
|
return;
|
|
22035
22050
|
// don't stop propagation since we want to outsource keydown to other handlers.
|
|
@@ -22413,7 +22428,7 @@
|
|
|
22413
22428
|
["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
|
|
22414
22429
|
justifyContent: 'flex-end'
|
|
22415
22430
|
}, ellipsis), {}, {
|
|
22416
|
-
flex: "0 1 ".concat(frequencyWidth, "px"),
|
|
22431
|
+
flex: "0 1 ".concat(frequencyWidth + (showIcon || checkboxes ? 0 : iconWidth), "px"),
|
|
22417
22432
|
textAlign: 'right',
|
|
22418
22433
|
paddingLeft: '2px'
|
|
22419
22434
|
}),
|
|
@@ -24716,6 +24731,8 @@
|
|
|
24716
24731
|
histogram,
|
|
24717
24732
|
isSingleSelect,
|
|
24718
24733
|
select,
|
|
24734
|
+
selectAll,
|
|
24735
|
+
onCtrlF,
|
|
24719
24736
|
textAlign,
|
|
24720
24737
|
selections,
|
|
24721
24738
|
keyboard,
|
|
@@ -24773,7 +24790,9 @@
|
|
|
24773
24790
|
select,
|
|
24774
24791
|
confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
|
|
24775
24792
|
cancel: () => selections === null || selections === void 0 ? void 0 : selections.cancel.call(selections),
|
|
24776
|
-
setScrollPosition
|
|
24793
|
+
setScrollPosition,
|
|
24794
|
+
selectAll,
|
|
24795
|
+
onCtrlF
|
|
24777
24796
|
},
|
|
24778
24797
|
frequencyMax,
|
|
24779
24798
|
histogram,
|
|
@@ -25441,8 +25460,9 @@
|
|
|
25441
25460
|
};
|
|
25442
25461
|
|
|
25443
25462
|
const useFrequencyMax = (app, layout) => {
|
|
25444
|
-
const [frequencyMax, setFrequencyMax] = reactExports.useState();
|
|
25445
25463
|
const needFetch = needToFetchFrequencyMax(layout);
|
|
25464
|
+
const [frequencyMax, setFrequencyMax] = reactExports.useState();
|
|
25465
|
+
const [awaitingFrequencyMax, setAwaitingFrequencyMax] = reactExports.useState(needFetch);
|
|
25446
25466
|
reactExports.useEffect(() => {
|
|
25447
25467
|
if (!needFetch) {
|
|
25448
25468
|
return;
|
|
@@ -25450,10 +25470,14 @@
|
|
|
25450
25470
|
const fetch = async () => {
|
|
25451
25471
|
const newValue = await getFrequencyMax(layout, app);
|
|
25452
25472
|
setFrequencyMax(newValue);
|
|
25473
|
+
setAwaitingFrequencyMax(false);
|
|
25453
25474
|
};
|
|
25454
25475
|
fetch();
|
|
25455
25476
|
}, [needFetch && layout]);
|
|
25456
|
-
return
|
|
25477
|
+
return {
|
|
25478
|
+
frequencyMax: needFetch ? frequencyMax : layout === null || layout === void 0 ? void 0 : layout.frequencyMax,
|
|
25479
|
+
awaitingFrequencyMax
|
|
25480
|
+
};
|
|
25457
25481
|
};
|
|
25458
25482
|
|
|
25459
25483
|
const _excluded$4 = ["isLoadingData"];
|
|
@@ -25486,7 +25510,9 @@
|
|
|
25486
25510
|
},
|
|
25487
25511
|
currentScrollIndex = {
|
|
25488
25512
|
set: () => {}
|
|
25489
|
-
}
|
|
25513
|
+
},
|
|
25514
|
+
renderedCallback,
|
|
25515
|
+
onCtrlF
|
|
25490
25516
|
} = _ref;
|
|
25491
25517
|
const [initScrollPosIsSet, setInitScrollPosIsSet] = reactExports.useState(false);
|
|
25492
25518
|
const isSingleSelect = !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne);
|
|
@@ -25506,6 +25532,10 @@
|
|
|
25506
25532
|
|
|
25507
25533
|
// The time from scroll end until new data is being fetched, may be exposed in API later on.
|
|
25508
25534
|
const scrollTimeout = 0;
|
|
25535
|
+
const {
|
|
25536
|
+
frequencyMax,
|
|
25537
|
+
awaitingFrequencyMax
|
|
25538
|
+
} = useFrequencyMax(app, layout);
|
|
25509
25539
|
const _useItemsLoader = useItemsLoader({
|
|
25510
25540
|
local,
|
|
25511
25541
|
loaderRef,
|
|
@@ -25531,11 +25561,15 @@
|
|
|
25531
25561
|
if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
|
|
25532
25562
|
selectionState.update({
|
|
25533
25563
|
setPages,
|
|
25534
|
-
pages: itemsLoader
|
|
25564
|
+
pages: itemsLoader.pages,
|
|
25535
25565
|
isSingleSelect,
|
|
25536
25566
|
selectDisabled,
|
|
25537
25567
|
layout
|
|
25538
25568
|
});
|
|
25569
|
+
if (itemsLoader.pages.length && !awaitingFrequencyMax) {
|
|
25570
|
+
// All necessary data fetching done - signal rendering done!
|
|
25571
|
+
renderedCallback();
|
|
25572
|
+
}
|
|
25539
25573
|
}
|
|
25540
25574
|
const isItemLoaded = reactExports.useCallback(index => {
|
|
25541
25575
|
if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
|
|
@@ -25694,7 +25728,10 @@
|
|
|
25694
25728
|
last
|
|
25695
25729
|
}))
|
|
25696
25730
|
});
|
|
25697
|
-
const
|
|
25731
|
+
const selectAll = () => {
|
|
25732
|
+
selectionState.clearItemStates(false);
|
|
25733
|
+
model.selectListObjectAll('/qListObjectDef');
|
|
25734
|
+
};
|
|
25698
25735
|
const {
|
|
25699
25736
|
List,
|
|
25700
25737
|
Grid
|
|
@@ -25710,6 +25747,8 @@
|
|
|
25710
25747
|
showGray,
|
|
25711
25748
|
interactionEvents,
|
|
25712
25749
|
select,
|
|
25750
|
+
selectAll,
|
|
25751
|
+
onCtrlF,
|
|
25713
25752
|
textAlign,
|
|
25714
25753
|
isVertical,
|
|
25715
25754
|
pages,
|
|
@@ -26383,7 +26422,8 @@
|
|
|
26383
26422
|
autoFocus = true,
|
|
26384
26423
|
wildCardSearch = false,
|
|
26385
26424
|
searchEnabled,
|
|
26386
|
-
direction
|
|
26425
|
+
direction,
|
|
26426
|
+
hide
|
|
26387
26427
|
} = _ref3;
|
|
26388
26428
|
const {
|
|
26389
26429
|
translator
|
|
@@ -26469,6 +26509,16 @@
|
|
|
26469
26509
|
e.preventDefault();
|
|
26470
26510
|
e.stopPropagation();
|
|
26471
26511
|
break;
|
|
26512
|
+
case 'f':
|
|
26513
|
+
case 'F':
|
|
26514
|
+
if (e.ctrlKey || e.metaKey) {
|
|
26515
|
+
if (hide) {
|
|
26516
|
+
hide();
|
|
26517
|
+
}
|
|
26518
|
+
e.preventDefault();
|
|
26519
|
+
e.stopPropagation();
|
|
26520
|
+
}
|
|
26521
|
+
break;
|
|
26472
26522
|
}
|
|
26473
26523
|
return response;
|
|
26474
26524
|
};
|
|
@@ -26926,6 +26976,7 @@
|
|
|
26926
26976
|
const open = show && Boolean(alignTo.current);
|
|
26927
26977
|
const [listCount, setListCount] = reactExports.useState(0);
|
|
26928
26978
|
const theme = useTheme$1();
|
|
26979
|
+
const searchContainerRef = reactExports.useRef();
|
|
26929
26980
|
const [model] = useSessionModel({
|
|
26930
26981
|
qInfo: {
|
|
26931
26982
|
qType: 'njsListbox'
|
|
@@ -26987,6 +27038,10 @@
|
|
|
26987
27038
|
translator,
|
|
26988
27039
|
selectionState: selectionState$1
|
|
26989
27040
|
});
|
|
27041
|
+
const onCtrlF = () => {
|
|
27042
|
+
const input = searchContainerRef.current.querySelector('input');
|
|
27043
|
+
input === null || input === void 0 ? void 0 : input.focus();
|
|
27044
|
+
};
|
|
26990
27045
|
const hasSelections$1 = hasSelections(layout);
|
|
26991
27046
|
return /*#__PURE__*/React.createElement(Popover$1, {
|
|
26992
27047
|
open: open,
|
|
@@ -27053,7 +27108,10 @@
|
|
|
27053
27108
|
xs: true
|
|
27054
27109
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27055
27110
|
ref: moreAlignTo
|
|
27056
|
-
}), /*#__PURE__*/React.createElement(
|
|
27111
|
+
}), /*#__PURE__*/React.createElement(Grid$1, {
|
|
27112
|
+
item: true,
|
|
27113
|
+
ref: searchContainerRef
|
|
27114
|
+
}, /*#__PURE__*/React.createElement(ListBoxSearch, {
|
|
27057
27115
|
visible: true,
|
|
27058
27116
|
model: model,
|
|
27059
27117
|
listCount: listCount,
|
|
@@ -27063,14 +27121,15 @@
|
|
|
27063
27121
|
enabled: false
|
|
27064
27122
|
},
|
|
27065
27123
|
autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
|
|
27066
|
-
}), /*#__PURE__*/React.createElement(ListBox, {
|
|
27124
|
+
})), /*#__PURE__*/React.createElement(ListBox, {
|
|
27067
27125
|
model: model,
|
|
27068
27126
|
app: app,
|
|
27069
27127
|
layout: layout,
|
|
27070
27128
|
selections: selections,
|
|
27071
27129
|
selectionState: selectionState$1,
|
|
27072
27130
|
direction: "ltr",
|
|
27073
|
-
onSetListCount: c => setListCount(c)
|
|
27131
|
+
onSetListCount: c => setListCount(c),
|
|
27132
|
+
onCtrlF: onCtrlF
|
|
27074
27133
|
}))));
|
|
27075
27134
|
}
|
|
27076
27135
|
|
|
@@ -28439,7 +28498,7 @@
|
|
|
28439
28498
|
["& .".concat(classes$4.listboxWrapper)]: {
|
|
28440
28499
|
padding: containerPadding
|
|
28441
28500
|
},
|
|
28442
|
-
'&:focus': {
|
|
28501
|
+
'&:focus:not(:hover)': {
|
|
28443
28502
|
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
|
|
28444
28503
|
},
|
|
28445
28504
|
'&:focus-visible': {
|
|
@@ -28481,7 +28540,8 @@
|
|
|
28481
28540
|
postProcessPages = undefined,
|
|
28482
28541
|
calculatePagesHeight,
|
|
28483
28542
|
showGray = true,
|
|
28484
|
-
scrollState = undefined
|
|
28543
|
+
scrollState = undefined,
|
|
28544
|
+
renderedCallback
|
|
28485
28545
|
} = options;
|
|
28486
28546
|
let {
|
|
28487
28547
|
toolbar = true
|
|
@@ -28621,6 +28681,14 @@
|
|
|
28621
28681
|
const newValue = !showSearch;
|
|
28622
28682
|
setShowSearch(newValue);
|
|
28623
28683
|
};
|
|
28684
|
+
const onCtrlF = () => {
|
|
28685
|
+
if (search === 'toggle') {
|
|
28686
|
+
onShowSearch();
|
|
28687
|
+
} else {
|
|
28688
|
+
const input = searchContainer.current.querySelector('input');
|
|
28689
|
+
input === null || input === void 0 ? void 0 : input.focus();
|
|
28690
|
+
}
|
|
28691
|
+
};
|
|
28624
28692
|
const getActionToolbarProps = isPopover => getListboxActionProps({
|
|
28625
28693
|
isPopover,
|
|
28626
28694
|
showToolbar,
|
|
@@ -28763,10 +28831,10 @@
|
|
|
28763
28831
|
visible: searchVisible,
|
|
28764
28832
|
search: search,
|
|
28765
28833
|
autoFocus: shouldAutoFocus,
|
|
28766
|
-
searchContainerRef: searchContainerRef,
|
|
28767
28834
|
wildCardSearch: wildCardSearch,
|
|
28768
28835
|
searchEnabled: searchEnabled,
|
|
28769
|
-
direction: direction
|
|
28836
|
+
direction: direction,
|
|
28837
|
+
hide: showSearchIcon && onShowSearch
|
|
28770
28838
|
})), /*#__PURE__*/React.createElement(Grid$1, {
|
|
28771
28839
|
item: true,
|
|
28772
28840
|
xs: true,
|
|
@@ -28810,7 +28878,9 @@
|
|
|
28810
28878
|
currentScrollIndex: {
|
|
28811
28879
|
state: currentScrollIndex,
|
|
28812
28880
|
set: setCurrentScrollIndex
|
|
28813
|
-
}
|
|
28881
|
+
},
|
|
28882
|
+
renderedCallback: renderedCallback,
|
|
28883
|
+
onCtrlF: onCtrlF
|
|
28814
28884
|
});
|
|
28815
28885
|
})))));
|
|
28816
28886
|
}
|
|
@@ -29090,7 +29160,8 @@
|
|
|
29090
29160
|
qId,
|
|
29091
29161
|
stateName,
|
|
29092
29162
|
element,
|
|
29093
|
-
options
|
|
29163
|
+
options,
|
|
29164
|
+
renderedCallback
|
|
29094
29165
|
} = _ref;
|
|
29095
29166
|
const {
|
|
29096
29167
|
isExistingObject,
|
|
@@ -29121,7 +29192,8 @@
|
|
|
29121
29192
|
const opts = reactExports.useMemo(() => _objectSpread2(_objectSpread2({}, options), {}, {
|
|
29122
29193
|
selections,
|
|
29123
29194
|
model,
|
|
29124
|
-
app
|
|
29195
|
+
app,
|
|
29196
|
+
renderedCallback
|
|
29125
29197
|
}), [options, selections, model, app]);
|
|
29126
29198
|
if (!selections || !model) {
|
|
29127
29199
|
return null;
|
|
@@ -29137,7 +29209,8 @@
|
|
|
29137
29209
|
fieldIdentifier,
|
|
29138
29210
|
qId,
|
|
29139
29211
|
stateName = '$',
|
|
29140
|
-
options = {}
|
|
29212
|
+
options = {},
|
|
29213
|
+
renderedCallback
|
|
29141
29214
|
} = _ref2;
|
|
29142
29215
|
return ReactDOM.createPortal( /*#__PURE__*/React.createElement(ListBoxWrapper, {
|
|
29143
29216
|
app: app,
|
|
@@ -29145,7 +29218,8 @@
|
|
|
29145
29218
|
fieldIdentifier: fieldIdentifier,
|
|
29146
29219
|
qId: qId,
|
|
29147
29220
|
stateName: stateName,
|
|
29148
|
-
options: options
|
|
29221
|
+
options: options,
|
|
29222
|
+
renderedCallback: renderedCallback
|
|
29149
29223
|
}), element, uid());
|
|
29150
29224
|
}
|
|
29151
29225
|
|
|
@@ -36670,13 +36744,14 @@
|
|
|
36670
36744
|
* @param {boolean=} [options.dense=false] Reduces padding and text size (not applicable for existing objects)
|
|
36671
36745
|
* @param {string=} [options.stateName="$"] Sets the state to make selections in (not applicable for existing objects)
|
|
36672
36746
|
* @param {object=} [options.properties={}] Properties object to extend default properties with
|
|
36747
|
+
* @returns {Promise<void>} A promise that resolves when the data is fetched.
|
|
36673
36748
|
*
|
|
36674
36749
|
* @since 1.1.0
|
|
36675
36750
|
* @instance
|
|
36676
36751
|
* @example
|
|
36677
36752
|
* fieldInstance.mount(element);
|
|
36678
36753
|
*/
|
|
36679
|
-
mount(element) {
|
|
36754
|
+
async mount(element) {
|
|
36680
36755
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
36681
36756
|
if (!element) {
|
|
36682
36757
|
throw new Error("Element for ".concat(fieldName || qId, " not provided"));
|
|
@@ -36686,18 +36761,21 @@
|
|
|
36686
36761
|
}
|
|
36687
36762
|
const onSelectionActivated = () => fieldSels.emit('selectionActivated');
|
|
36688
36763
|
const onSelectionDeactivated = () => fieldSels.emit('selectionDeactivated');
|
|
36689
|
-
|
|
36690
|
-
|
|
36691
|
-
|
|
36692
|
-
|
|
36693
|
-
|
|
36694
|
-
|
|
36695
|
-
|
|
36696
|
-
|
|
36697
|
-
|
|
36698
|
-
|
|
36764
|
+
return new Promise(resolve => {
|
|
36765
|
+
this._instance = ListBoxPortal({
|
|
36766
|
+
element,
|
|
36767
|
+
app,
|
|
36768
|
+
fieldIdentifier,
|
|
36769
|
+
qId,
|
|
36770
|
+
options: getOptions$1(_objectSpread2({
|
|
36771
|
+
onSelectionActivated,
|
|
36772
|
+
onSelectionDeactivated
|
|
36773
|
+
}, options)),
|
|
36774
|
+
stateName: options.stateName || '$',
|
|
36775
|
+
renderedCallback: resolve
|
|
36776
|
+
});
|
|
36777
|
+
root.add(this._instance);
|
|
36699
36778
|
});
|
|
36700
|
-
root.add(this._instance);
|
|
36701
36779
|
},
|
|
36702
36780
|
/**
|
|
36703
36781
|
* Unmounts the field listbox from the DOM.
|