@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/core/esm/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
|
*/
|
|
@@ -8043,7 +8043,7 @@ function create$3(definition) {
|
|
|
8043
8043
|
return cache[key];
|
|
8044
8044
|
}
|
|
8045
8045
|
|
|
8046
|
-
const NEBULA_VERSION_HASH = "
|
|
8046
|
+
const NEBULA_VERSION_HASH = "ee80" ;
|
|
8047
8047
|
ClassNameGenerator$1.configure(componentName => {
|
|
8048
8048
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
8049
8049
|
});
|
|
@@ -8251,7 +8251,7 @@ function boot(_ref2) {
|
|
|
8251
8251
|
const appRef = React__default.createRef();
|
|
8252
8252
|
const element = document.createElement('div');
|
|
8253
8253
|
element.style.display = 'none';
|
|
8254
|
-
element.setAttribute('data-nebulajs-version', "4.0.0-alpha.
|
|
8254
|
+
element.setAttribute('data-nebulajs-version', "4.0.0-alpha.3" );
|
|
8255
8255
|
element.setAttribute('data-app-id', app.id);
|
|
8256
8256
|
document.body.appendChild(element);
|
|
8257
8257
|
const root = client.createRoot(element);
|
|
@@ -9325,6 +9325,8 @@ const KEYS = Object.freeze({
|
|
|
9325
9325
|
function getFieldKeyboardNavigation(_ref) {
|
|
9326
9326
|
let {
|
|
9327
9327
|
select,
|
|
9328
|
+
selectAll,
|
|
9329
|
+
onCtrlF,
|
|
9328
9330
|
confirm,
|
|
9329
9331
|
cancel,
|
|
9330
9332
|
setScrollPosition,
|
|
@@ -9344,7 +9346,8 @@ function getFieldKeyboardNavigation(_ref) {
|
|
|
9344
9346
|
const {
|
|
9345
9347
|
keyCode,
|
|
9346
9348
|
shiftKey = false,
|
|
9347
|
-
ctrlKey = false
|
|
9349
|
+
ctrlKey = false,
|
|
9350
|
+
metaKey = false
|
|
9348
9351
|
} = event.nativeEvent;
|
|
9349
9352
|
switch (keyCode) {
|
|
9350
9353
|
case KEYS.SHIFT:
|
|
@@ -9399,6 +9402,18 @@ function getFieldKeyboardNavigation(_ref) {
|
|
|
9399
9402
|
}
|
|
9400
9403
|
setScrollPosition === null || setScrollPosition === void 0 ? void 0 : setScrollPosition('end');
|
|
9401
9404
|
break;
|
|
9405
|
+
case KEYS.A:
|
|
9406
|
+
if (ctrlKey || metaKey) {
|
|
9407
|
+
selectAll();
|
|
9408
|
+
break;
|
|
9409
|
+
}
|
|
9410
|
+
return;
|
|
9411
|
+
case KEYS.F:
|
|
9412
|
+
if (ctrlKey || metaKey) {
|
|
9413
|
+
onCtrlF();
|
|
9414
|
+
break;
|
|
9415
|
+
}
|
|
9416
|
+
return;
|
|
9402
9417
|
default:
|
|
9403
9418
|
return;
|
|
9404
9419
|
// don't stop propagation since we want to outsource keydown to other handlers.
|
|
@@ -9782,7 +9797,7 @@ const RowColRoot = styled$1('div', {
|
|
|
9782
9797
|
["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
|
|
9783
9798
|
justifyContent: 'flex-end'
|
|
9784
9799
|
}, ellipsis), {}, {
|
|
9785
|
-
flex: "0 1 ".concat(frequencyWidth, "px"),
|
|
9800
|
+
flex: "0 1 ".concat(frequencyWidth + (showIcon || checkboxes ? 0 : iconWidth), "px"),
|
|
9786
9801
|
textAlign: 'right',
|
|
9787
9802
|
paddingLeft: '2px'
|
|
9788
9803
|
}),
|
|
@@ -12085,6 +12100,8 @@ function getListBoxComponents(_ref) {
|
|
|
12085
12100
|
histogram,
|
|
12086
12101
|
isSingleSelect,
|
|
12087
12102
|
select,
|
|
12103
|
+
selectAll,
|
|
12104
|
+
onCtrlF,
|
|
12088
12105
|
textAlign,
|
|
12089
12106
|
selections,
|
|
12090
12107
|
keyboard,
|
|
@@ -12142,7 +12159,9 @@ function getListBoxComponents(_ref) {
|
|
|
12142
12159
|
select,
|
|
12143
12160
|
confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
|
|
12144
12161
|
cancel: () => selections === null || selections === void 0 ? void 0 : selections.cancel.call(selections),
|
|
12145
|
-
setScrollPosition
|
|
12162
|
+
setScrollPosition,
|
|
12163
|
+
selectAll,
|
|
12164
|
+
onCtrlF
|
|
12146
12165
|
},
|
|
12147
12166
|
frequencyMax,
|
|
12148
12167
|
histogram,
|
|
@@ -12956,8 +12975,9 @@ const getFrequencyMax = async (layout, app) => {
|
|
|
12956
12975
|
};
|
|
12957
12976
|
|
|
12958
12977
|
const useFrequencyMax = (app, layout) => {
|
|
12959
|
-
const [frequencyMax, setFrequencyMax] = useState$1();
|
|
12960
12978
|
const needFetch = needToFetchFrequencyMax(layout);
|
|
12979
|
+
const [frequencyMax, setFrequencyMax] = useState$1();
|
|
12980
|
+
const [awaitingFrequencyMax, setAwaitingFrequencyMax] = useState$1(needFetch);
|
|
12961
12981
|
useEffect$1(() => {
|
|
12962
12982
|
if (!needFetch) {
|
|
12963
12983
|
return;
|
|
@@ -12965,10 +12985,14 @@ const useFrequencyMax = (app, layout) => {
|
|
|
12965
12985
|
const fetch = async () => {
|
|
12966
12986
|
const newValue = await getFrequencyMax(layout, app);
|
|
12967
12987
|
setFrequencyMax(newValue);
|
|
12988
|
+
setAwaitingFrequencyMax(false);
|
|
12968
12989
|
};
|
|
12969
12990
|
fetch();
|
|
12970
12991
|
}, [needFetch && layout]);
|
|
12971
|
-
return
|
|
12992
|
+
return {
|
|
12993
|
+
frequencyMax: needFetch ? frequencyMax : layout === null || layout === void 0 ? void 0 : layout.frequencyMax,
|
|
12994
|
+
awaitingFrequencyMax
|
|
12995
|
+
};
|
|
12972
12996
|
};
|
|
12973
12997
|
|
|
12974
12998
|
const _excluded$4 = ["isLoadingData"];
|
|
@@ -13001,7 +13025,9 @@ function ListBox(_ref) {
|
|
|
13001
13025
|
},
|
|
13002
13026
|
currentScrollIndex = {
|
|
13003
13027
|
set: () => {}
|
|
13004
|
-
}
|
|
13028
|
+
},
|
|
13029
|
+
renderedCallback,
|
|
13030
|
+
onCtrlF
|
|
13005
13031
|
} = _ref;
|
|
13006
13032
|
const [initScrollPosIsSet, setInitScrollPosIsSet] = useState$1(false);
|
|
13007
13033
|
const isSingleSelect = !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne);
|
|
@@ -13021,6 +13047,10 @@ function ListBox(_ref) {
|
|
|
13021
13047
|
|
|
13022
13048
|
// The time from scroll end until new data is being fetched, may be exposed in API later on.
|
|
13023
13049
|
const scrollTimeout = 0;
|
|
13050
|
+
const {
|
|
13051
|
+
frequencyMax,
|
|
13052
|
+
awaitingFrequencyMax
|
|
13053
|
+
} = useFrequencyMax(app, layout);
|
|
13024
13054
|
const _useItemsLoader = useItemsLoader({
|
|
13025
13055
|
local,
|
|
13026
13056
|
loaderRef,
|
|
@@ -13046,11 +13076,15 @@ function ListBox(_ref) {
|
|
|
13046
13076
|
if (itemsLoader !== null && itemsLoader !== void 0 && itemsLoader.pages) {
|
|
13047
13077
|
selectionState.update({
|
|
13048
13078
|
setPages,
|
|
13049
|
-
pages: itemsLoader
|
|
13079
|
+
pages: itemsLoader.pages,
|
|
13050
13080
|
isSingleSelect,
|
|
13051
13081
|
selectDisabled,
|
|
13052
13082
|
layout
|
|
13053
13083
|
});
|
|
13084
|
+
if (itemsLoader.pages.length && !awaitingFrequencyMax) {
|
|
13085
|
+
// All necessary data fetching done - signal rendering done!
|
|
13086
|
+
renderedCallback();
|
|
13087
|
+
}
|
|
13054
13088
|
}
|
|
13055
13089
|
const isItemLoaded = useCallback(index => {
|
|
13056
13090
|
if (!(pages !== null && pages !== void 0 && pages.length) || !local.current.validPages) {
|
|
@@ -13209,7 +13243,10 @@ function ListBox(_ref) {
|
|
|
13209
13243
|
last
|
|
13210
13244
|
}))
|
|
13211
13245
|
});
|
|
13212
|
-
const
|
|
13246
|
+
const selectAll = () => {
|
|
13247
|
+
selectionState.clearItemStates(false);
|
|
13248
|
+
model.selectListObjectAll('/qListObjectDef');
|
|
13249
|
+
};
|
|
13213
13250
|
const {
|
|
13214
13251
|
List,
|
|
13215
13252
|
Grid
|
|
@@ -13225,6 +13262,8 @@ function ListBox(_ref) {
|
|
|
13225
13262
|
showGray,
|
|
13226
13263
|
interactionEvents,
|
|
13227
13264
|
select,
|
|
13265
|
+
selectAll,
|
|
13266
|
+
onCtrlF,
|
|
13228
13267
|
textAlign,
|
|
13229
13268
|
isVertical,
|
|
13230
13269
|
pages,
|
|
@@ -13898,7 +13937,8 @@ function ListBoxSearch(_ref3) {
|
|
|
13898
13937
|
autoFocus = true,
|
|
13899
13938
|
wildCardSearch = false,
|
|
13900
13939
|
searchEnabled,
|
|
13901
|
-
direction
|
|
13940
|
+
direction,
|
|
13941
|
+
hide
|
|
13902
13942
|
} = _ref3;
|
|
13903
13943
|
const {
|
|
13904
13944
|
translator
|
|
@@ -13984,6 +14024,16 @@ function ListBoxSearch(_ref3) {
|
|
|
13984
14024
|
e.preventDefault();
|
|
13985
14025
|
e.stopPropagation();
|
|
13986
14026
|
break;
|
|
14027
|
+
case 'f':
|
|
14028
|
+
case 'F':
|
|
14029
|
+
if (e.ctrlKey || e.metaKey) {
|
|
14030
|
+
if (hide) {
|
|
14031
|
+
hide();
|
|
14032
|
+
}
|
|
14033
|
+
e.preventDefault();
|
|
14034
|
+
e.stopPropagation();
|
|
14035
|
+
}
|
|
14036
|
+
break;
|
|
13987
14037
|
}
|
|
13988
14038
|
return response;
|
|
13989
14039
|
};
|
|
@@ -14441,6 +14491,7 @@ function ListBoxPopover(_ref) {
|
|
|
14441
14491
|
const open = show && Boolean(alignTo.current);
|
|
14442
14492
|
const [listCount, setListCount] = useState$1(0);
|
|
14443
14493
|
const theme = useTheme$1();
|
|
14494
|
+
const searchContainerRef = useRef();
|
|
14444
14495
|
const [model] = useSessionModel({
|
|
14445
14496
|
qInfo: {
|
|
14446
14497
|
qType: 'njsListbox'
|
|
@@ -14502,6 +14553,10 @@ function ListBoxPopover(_ref) {
|
|
|
14502
14553
|
translator,
|
|
14503
14554
|
selectionState: selectionState$1
|
|
14504
14555
|
});
|
|
14556
|
+
const onCtrlF = () => {
|
|
14557
|
+
const input = searchContainerRef.current.querySelector('input');
|
|
14558
|
+
input === null || input === void 0 ? void 0 : input.focus();
|
|
14559
|
+
};
|
|
14505
14560
|
const hasSelections$1 = hasSelections(layout);
|
|
14506
14561
|
return /*#__PURE__*/React__default.createElement(Popover, {
|
|
14507
14562
|
open: open,
|
|
@@ -14568,7 +14623,10 @@ function ListBoxPopover(_ref) {
|
|
|
14568
14623
|
xs: true
|
|
14569
14624
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
14570
14625
|
ref: moreAlignTo
|
|
14571
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
14626
|
+
}), /*#__PURE__*/React__default.createElement(Grid, {
|
|
14627
|
+
item: true,
|
|
14628
|
+
ref: searchContainerRef
|
|
14629
|
+
}, /*#__PURE__*/React__default.createElement(ListBoxSearch, {
|
|
14572
14630
|
visible: true,
|
|
14573
14631
|
model: model,
|
|
14574
14632
|
listCount: listCount,
|
|
@@ -14578,14 +14636,15 @@ function ListBoxPopover(_ref) {
|
|
|
14578
14636
|
enabled: false
|
|
14579
14637
|
},
|
|
14580
14638
|
autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
|
|
14581
|
-
}), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
14639
|
+
})), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
14582
14640
|
model: model,
|
|
14583
14641
|
app: app,
|
|
14584
14642
|
layout: layout,
|
|
14585
14643
|
selections: selections,
|
|
14586
14644
|
selectionState: selectionState$1,
|
|
14587
14645
|
direction: "ltr",
|
|
14588
|
-
onSetListCount: c => setListCount(c)
|
|
14646
|
+
onSetListCount: c => setListCount(c),
|
|
14647
|
+
onCtrlF: onCtrlF
|
|
14589
14648
|
}))));
|
|
14590
14649
|
}
|
|
14591
14650
|
|
|
@@ -15954,7 +16013,7 @@ const StyledGrid$3 = styled$1(Grid, {
|
|
|
15954
16013
|
["& .".concat(classes$4.listboxWrapper)]: {
|
|
15955
16014
|
padding: containerPadding
|
|
15956
16015
|
},
|
|
15957
|
-
'&:focus': {
|
|
16016
|
+
'&:focus:not(:hover)': {
|
|
15958
16017
|
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
|
|
15959
16018
|
},
|
|
15960
16019
|
'&:focus-visible': {
|
|
@@ -15996,7 +16055,8 @@ function ListBoxInline(_ref3) {
|
|
|
15996
16055
|
postProcessPages = undefined,
|
|
15997
16056
|
calculatePagesHeight,
|
|
15998
16057
|
showGray = true,
|
|
15999
|
-
scrollState = undefined
|
|
16058
|
+
scrollState = undefined,
|
|
16059
|
+
renderedCallback
|
|
16000
16060
|
} = options;
|
|
16001
16061
|
let {
|
|
16002
16062
|
toolbar = true
|
|
@@ -16136,6 +16196,14 @@ function ListBoxInline(_ref3) {
|
|
|
16136
16196
|
const newValue = !showSearch;
|
|
16137
16197
|
setShowSearch(newValue);
|
|
16138
16198
|
};
|
|
16199
|
+
const onCtrlF = () => {
|
|
16200
|
+
if (search === 'toggle') {
|
|
16201
|
+
onShowSearch();
|
|
16202
|
+
} else {
|
|
16203
|
+
const input = searchContainer.current.querySelector('input');
|
|
16204
|
+
input === null || input === void 0 ? void 0 : input.focus();
|
|
16205
|
+
}
|
|
16206
|
+
};
|
|
16139
16207
|
const getActionToolbarProps = isPopover => getListboxActionProps({
|
|
16140
16208
|
isPopover,
|
|
16141
16209
|
showToolbar,
|
|
@@ -16278,10 +16346,10 @@ function ListBoxInline(_ref3) {
|
|
|
16278
16346
|
visible: searchVisible,
|
|
16279
16347
|
search: search,
|
|
16280
16348
|
autoFocus: shouldAutoFocus,
|
|
16281
|
-
searchContainerRef: searchContainerRef,
|
|
16282
16349
|
wildCardSearch: wildCardSearch,
|
|
16283
16350
|
searchEnabled: searchEnabled,
|
|
16284
|
-
direction: direction
|
|
16351
|
+
direction: direction,
|
|
16352
|
+
hide: showSearchIcon && onShowSearch
|
|
16285
16353
|
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
16286
16354
|
item: true,
|
|
16287
16355
|
xs: true,
|
|
@@ -16325,7 +16393,9 @@ function ListBoxInline(_ref3) {
|
|
|
16325
16393
|
currentScrollIndex: {
|
|
16326
16394
|
state: currentScrollIndex,
|
|
16327
16395
|
set: setCurrentScrollIndex
|
|
16328
|
-
}
|
|
16396
|
+
},
|
|
16397
|
+
renderedCallback: renderedCallback,
|
|
16398
|
+
onCtrlF: onCtrlF
|
|
16329
16399
|
});
|
|
16330
16400
|
})))));
|
|
16331
16401
|
}
|
|
@@ -16605,7 +16675,8 @@ function ListBoxWrapper(_ref) {
|
|
|
16605
16675
|
qId,
|
|
16606
16676
|
stateName,
|
|
16607
16677
|
element,
|
|
16608
|
-
options
|
|
16678
|
+
options,
|
|
16679
|
+
renderedCallback
|
|
16609
16680
|
} = _ref;
|
|
16610
16681
|
const {
|
|
16611
16682
|
isExistingObject,
|
|
@@ -16636,7 +16707,8 @@ function ListBoxWrapper(_ref) {
|
|
|
16636
16707
|
const opts = useMemo$1(() => _objectSpread2(_objectSpread2({}, options), {}, {
|
|
16637
16708
|
selections,
|
|
16638
16709
|
model,
|
|
16639
|
-
app
|
|
16710
|
+
app,
|
|
16711
|
+
renderedCallback
|
|
16640
16712
|
}), [options, selections, model, app]);
|
|
16641
16713
|
if (!selections || !model) {
|
|
16642
16714
|
return null;
|
|
@@ -16652,7 +16724,8 @@ function ListBoxPortal(_ref2) {
|
|
|
16652
16724
|
fieldIdentifier,
|
|
16653
16725
|
qId,
|
|
16654
16726
|
stateName = '$',
|
|
16655
|
-
options = {}
|
|
16727
|
+
options = {},
|
|
16728
|
+
renderedCallback
|
|
16656
16729
|
} = _ref2;
|
|
16657
16730
|
return ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(ListBoxWrapper, {
|
|
16658
16731
|
app: app,
|
|
@@ -16660,7 +16733,8 @@ function ListBoxPortal(_ref2) {
|
|
|
16660
16733
|
fieldIdentifier: fieldIdentifier,
|
|
16661
16734
|
qId: qId,
|
|
16662
16735
|
stateName: stateName,
|
|
16663
|
-
options: options
|
|
16736
|
+
options: options,
|
|
16737
|
+
renderedCallback: renderedCallback
|
|
16664
16738
|
}), element, uid());
|
|
16665
16739
|
}
|
|
16666
16740
|
|
|
@@ -24185,13 +24259,14 @@ function nuked() {
|
|
|
24185
24259
|
* @param {boolean=} [options.dense=false] Reduces padding and text size (not applicable for existing objects)
|
|
24186
24260
|
* @param {string=} [options.stateName="$"] Sets the state to make selections in (not applicable for existing objects)
|
|
24187
24261
|
* @param {object=} [options.properties={}] Properties object to extend default properties with
|
|
24262
|
+
* @returns {Promise<void>} A promise that resolves when the data is fetched.
|
|
24188
24263
|
*
|
|
24189
24264
|
* @since 1.1.0
|
|
24190
24265
|
* @instance
|
|
24191
24266
|
* @example
|
|
24192
24267
|
* fieldInstance.mount(element);
|
|
24193
24268
|
*/
|
|
24194
|
-
mount(element) {
|
|
24269
|
+
async mount(element) {
|
|
24195
24270
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
24196
24271
|
if (!element) {
|
|
24197
24272
|
throw new Error("Element for ".concat(fieldName || qId, " not provided"));
|
|
@@ -24201,18 +24276,21 @@ function nuked() {
|
|
|
24201
24276
|
}
|
|
24202
24277
|
const onSelectionActivated = () => fieldSels.emit('selectionActivated');
|
|
24203
24278
|
const onSelectionDeactivated = () => fieldSels.emit('selectionDeactivated');
|
|
24204
|
-
|
|
24205
|
-
|
|
24206
|
-
|
|
24207
|
-
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
24211
|
-
|
|
24212
|
-
|
|
24213
|
-
|
|
24279
|
+
return new Promise(resolve => {
|
|
24280
|
+
this._instance = ListBoxPortal({
|
|
24281
|
+
element,
|
|
24282
|
+
app,
|
|
24283
|
+
fieldIdentifier,
|
|
24284
|
+
qId,
|
|
24285
|
+
options: getOptions$1(_objectSpread2({
|
|
24286
|
+
onSelectionActivated,
|
|
24287
|
+
onSelectionDeactivated
|
|
24288
|
+
}, options)),
|
|
24289
|
+
stateName: options.stateName || '$',
|
|
24290
|
+
renderedCallback: resolve
|
|
24291
|
+
});
|
|
24292
|
+
root.add(this._instance);
|
|
24214
24293
|
});
|
|
24215
|
-
root.add(this._instance);
|
|
24216
24294
|
},
|
|
24217
24295
|
/**
|
|
24218
24296
|
* Unmounts the field listbox from the DOM.
|