@nebula.js/stardust 3.0.2-alpha.0 → 3.0.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 +101 -28
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +6 -6
- package/core/esm/index.js.map +1 -1
- package/dist/stardust.dev.js +101 -27
- 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/core/esm/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v3.0.
|
|
2
|
+
* @nebula.js/stardust v3.0.3
|
|
3
3
|
* Copyright (c) 2022 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -12326,7 +12326,7 @@ function create$3(definition) {
|
|
|
12326
12326
|
return cache[key];
|
|
12327
12327
|
}
|
|
12328
12328
|
|
|
12329
|
-
const NEBULA_VERSION_HASH = "
|
|
12329
|
+
const NEBULA_VERSION_HASH = "8956" ;
|
|
12330
12330
|
ClassNameGenerator.configure(componentName => {
|
|
12331
12331
|
|
|
12332
12332
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
@@ -12899,7 +12899,7 @@ function boot(_ref2) {
|
|
|
12899
12899
|
const appRef = React__default.createRef();
|
|
12900
12900
|
const element = document.createElement('div');
|
|
12901
12901
|
element.style.display = 'none';
|
|
12902
|
-
element.setAttribute('data-nebulajs-version', "3.0.
|
|
12902
|
+
element.setAttribute('data-nebulajs-version', "3.0.3" );
|
|
12903
12903
|
element.setAttribute('data-app-id', app.id);
|
|
12904
12904
|
document.body.appendChild(element);
|
|
12905
12905
|
ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
|
|
@@ -16009,6 +16009,7 @@ var SearchIcon = (props => SvgIcon(search(props)));
|
|
|
16009
16009
|
const TREE_PATH = '/qListObjectDef';
|
|
16010
16010
|
function ListBoxSearch(_ref) {
|
|
16011
16011
|
let {
|
|
16012
|
+
selections,
|
|
16012
16013
|
model,
|
|
16013
16014
|
keyboard,
|
|
16014
16015
|
dense = false,
|
|
@@ -16018,44 +16019,68 @@ function ListBoxSearch(_ref) {
|
|
|
16018
16019
|
translator
|
|
16019
16020
|
} = useContext(InstanceContext);
|
|
16020
16021
|
const [value, setValue] = useState$1('');
|
|
16021
|
-
const [isSearching, setIsSearching] = useState$1(false);
|
|
16022
16022
|
const theme = useTheme$1();
|
|
16023
16023
|
|
|
16024
|
+
const cancel = () => selections.isActive() && selections.cancel();
|
|
16025
|
+
|
|
16024
16026
|
const abortSearch = async () => {
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
+
if (!selections.isModal()) {
|
|
16028
|
+
return;
|
|
16029
|
+
}
|
|
16030
|
+
|
|
16031
|
+
try {
|
|
16032
|
+
await model.abortListObjectSearch(TREE_PATH);
|
|
16033
|
+
} finally {
|
|
16034
|
+
setValue('');
|
|
16035
|
+
}
|
|
16027
16036
|
};
|
|
16028
16037
|
|
|
16029
16038
|
useEffect$1(() => {
|
|
16030
|
-
if (!visible
|
|
16031
|
-
abortSearch();
|
|
16039
|
+
if (!visible) {
|
|
16040
|
+
abortSearch(); // abort when toggling off search
|
|
16032
16041
|
}
|
|
16033
16042
|
}, [visible]);
|
|
16043
|
+
useEffect$1(() => {
|
|
16044
|
+
selections.on('deactivated', abortSearch);
|
|
16045
|
+
return () => {
|
|
16046
|
+
selections.removeListener && selections.removeListener('deactivated', abortSearch);
|
|
16047
|
+
};
|
|
16048
|
+
}, []);
|
|
16034
16049
|
|
|
16035
|
-
const onChange = e => {
|
|
16050
|
+
const onChange = async e => {
|
|
16036
16051
|
setValue(e.target.value);
|
|
16037
16052
|
|
|
16038
|
-
if (e.target.value.length
|
|
16039
|
-
abortSearch();
|
|
16040
|
-
}
|
|
16041
|
-
|
|
16042
|
-
|
|
16053
|
+
if (!e.target.value.length) {
|
|
16054
|
+
return abortSearch();
|
|
16055
|
+
}
|
|
16056
|
+
|
|
16057
|
+
return model.searchListObjectFor(TREE_PATH, e.target.value);
|
|
16058
|
+
};
|
|
16059
|
+
|
|
16060
|
+
const handleFocus = () => {
|
|
16061
|
+
if (!selections.isModal()) {
|
|
16062
|
+
selections.begin(['/qListObjectDef']);
|
|
16043
16063
|
}
|
|
16044
16064
|
};
|
|
16045
16065
|
|
|
16046
16066
|
const onKeyDown = e => {
|
|
16067
|
+
let response;
|
|
16068
|
+
|
|
16047
16069
|
switch (e.key) {
|
|
16048
16070
|
case 'Enter':
|
|
16049
16071
|
// Maybe we only want to accept if isSearching is true
|
|
16050
|
-
model.acceptListObjectSearch(TREE_PATH, true);
|
|
16072
|
+
response = model.acceptListObjectSearch(TREE_PATH, true);
|
|
16051
16073
|
setValue('');
|
|
16052
16074
|
break;
|
|
16053
16075
|
|
|
16054
16076
|
case 'Escape':
|
|
16055
|
-
|
|
16056
|
-
|
|
16077
|
+
response = cancel();
|
|
16078
|
+
e.preventDefault();
|
|
16079
|
+
e.stopPropagation();
|
|
16057
16080
|
break;
|
|
16058
16081
|
}
|
|
16082
|
+
|
|
16083
|
+
return response;
|
|
16059
16084
|
};
|
|
16060
16085
|
|
|
16061
16086
|
if (!visible) {
|
|
@@ -16092,6 +16117,7 @@ function ListBoxSearch(_ref) {
|
|
|
16092
16117
|
fullWidth: true,
|
|
16093
16118
|
placeholder: translator.get('Listbox.Search'),
|
|
16094
16119
|
value: value,
|
|
16120
|
+
onFocus: handleFocus,
|
|
16095
16121
|
onChange: onChange,
|
|
16096
16122
|
onKeyDown: onKeyDown,
|
|
16097
16123
|
inputProps: {
|
|
@@ -16457,6 +16483,7 @@ function ListBoxPopover(_ref) {
|
|
|
16457
16483
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
16458
16484
|
ref: moreAlignTo
|
|
16459
16485
|
}), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
|
|
16486
|
+
selections: selections,
|
|
16460
16487
|
model: model,
|
|
16461
16488
|
visible: true
|
|
16462
16489
|
}), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
@@ -17919,15 +17946,25 @@ function ListBoxInline(_ref) {
|
|
|
17919
17946
|
active: keyboardActive
|
|
17920
17947
|
};
|
|
17921
17948
|
useEffect$1(() => {
|
|
17922
|
-
const show = () =>
|
|
17949
|
+
const show = () => {
|
|
17950
|
+
setShowToolbar(true);
|
|
17951
|
+
};
|
|
17923
17952
|
|
|
17924
|
-
const hide = () =>
|
|
17953
|
+
const hide = () => {
|
|
17954
|
+
setShowToolbar(false);
|
|
17955
|
+
|
|
17956
|
+
if (search === 'toggle') {
|
|
17957
|
+
setShowSearch(false);
|
|
17958
|
+
}
|
|
17959
|
+
};
|
|
17925
17960
|
|
|
17926
17961
|
if (selections) {
|
|
17927
|
-
if (!selections.isModal(
|
|
17962
|
+
if (!selections.isModal()) {
|
|
17928
17963
|
selections.on('deactivated', hide);
|
|
17929
17964
|
selections.on('activated', show);
|
|
17930
17965
|
}
|
|
17966
|
+
|
|
17967
|
+
setShowToolbar(selections.isActive());
|
|
17931
17968
|
}
|
|
17932
17969
|
|
|
17933
17970
|
return () => {
|
|
@@ -17937,11 +17974,6 @@ function ListBoxInline(_ref) {
|
|
|
17937
17974
|
}
|
|
17938
17975
|
};
|
|
17939
17976
|
}, [selections]);
|
|
17940
|
-
useEffect$1(() => {
|
|
17941
|
-
if (selections) {
|
|
17942
|
-
setShowToolbar(selections.isActive());
|
|
17943
|
-
}
|
|
17944
|
-
}, [selections]);
|
|
17945
17977
|
const listBoxRef = useRef(null);
|
|
17946
17978
|
useConfirmUnfocus(listBoxRef, selections, shouldConfirmOnBlur);
|
|
17947
17979
|
useEffect$1(() => {
|
|
@@ -18050,10 +18082,12 @@ function ListBoxInline(_ref) {
|
|
|
18050
18082
|
item: true,
|
|
18051
18083
|
ref: searchContainerRef
|
|
18052
18084
|
}, /*#__PURE__*/React__default.createElement(ListBoxSearch, {
|
|
18085
|
+
selections: selections,
|
|
18053
18086
|
model: model,
|
|
18054
18087
|
dense: dense,
|
|
18055
18088
|
keyboard: keyboard,
|
|
18056
|
-
visible: searchVisible
|
|
18089
|
+
visible: searchVisible,
|
|
18090
|
+
searchContainerRef: searchContainerRef
|
|
18057
18091
|
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
18058
18092
|
item: true,
|
|
18059
18093
|
xs: true
|
|
@@ -21570,6 +21604,7 @@ function initiate(component) {
|
|
|
21570
21604
|
},
|
|
21571
21605
|
list: [],
|
|
21572
21606
|
snaps: [],
|
|
21607
|
+
menus: [],
|
|
21573
21608
|
actions: {
|
|
21574
21609
|
list: []
|
|
21575
21610
|
},
|
|
@@ -21687,6 +21722,15 @@ function runSnaps(component, layout) {
|
|
|
21687
21722
|
|
|
21688
21723
|
return Promise.resolve();
|
|
21689
21724
|
}
|
|
21725
|
+
function runMenu(component, menu, event) {
|
|
21726
|
+
try {
|
|
21727
|
+
return Promise.all(component.__hooks.menus.map(h => Promise.resolve(h.fn(menu, event)))).then(menus => menus[menus.length - 1]);
|
|
21728
|
+
} catch (e) {
|
|
21729
|
+
console.error(e);
|
|
21730
|
+
}
|
|
21731
|
+
|
|
21732
|
+
return Promise.resolve();
|
|
21733
|
+
}
|
|
21690
21734
|
function getImperativeHandle(component) {
|
|
21691
21735
|
return component.__hooks.imperativeHandle;
|
|
21692
21736
|
}
|
|
@@ -21763,6 +21807,7 @@ function hook(cb) {
|
|
|
21763
21807
|
run,
|
|
21764
21808
|
teardown,
|
|
21765
21809
|
runSnaps,
|
|
21810
|
+
runMenu,
|
|
21766
21811
|
focus,
|
|
21767
21812
|
blur,
|
|
21768
21813
|
observeActions,
|
|
@@ -22556,6 +22601,30 @@ function onTakeSnapshot(cb) {
|
|
|
22556
22601
|
|
|
22557
22602
|
h.fn = cb;
|
|
22558
22603
|
}
|
|
22604
|
+
/**
|
|
22605
|
+
* Registers a callback that is called when the context menu opens
|
|
22606
|
+
* @entry
|
|
22607
|
+
* @param {function(menu, event): void} addItemCallback
|
|
22608
|
+
* @ignore
|
|
22609
|
+
* @example
|
|
22610
|
+
* import { onContextMenu } from '@nebula.js/stardust';
|
|
22611
|
+
|
|
22612
|
+
* onContextMenu((menu, event) => {
|
|
22613
|
+
* menu.addItem(item, index);
|
|
22614
|
+
* });
|
|
22615
|
+
*/
|
|
22616
|
+
|
|
22617
|
+
function onContextMenu(cb) {
|
|
22618
|
+
const h = getHook(++currentIndex);
|
|
22619
|
+
|
|
22620
|
+
if (!h.value) {
|
|
22621
|
+
h.value = 1;
|
|
22622
|
+
|
|
22623
|
+
currentComponent.__hooks.menus.push(h);
|
|
22624
|
+
}
|
|
22625
|
+
|
|
22626
|
+
h.fn = cb;
|
|
22627
|
+
}
|
|
22559
22628
|
/**
|
|
22560
22629
|
* @interface RenderState
|
|
22561
22630
|
* @property {any} pending
|
|
@@ -22946,6 +23015,10 @@ function createWithHooks(generator, opts, galaxy) {
|
|
|
22946
23015
|
return generator.component.runSnaps(this, layout);
|
|
22947
23016
|
},
|
|
22948
23017
|
|
|
23018
|
+
onContextMenu(menu, event) {
|
|
23019
|
+
return generator.component.runMenu(this, menu, event);
|
|
23020
|
+
},
|
|
23021
|
+
|
|
22949
23022
|
focus() {
|
|
22950
23023
|
generator.component.focus(this);
|
|
22951
23024
|
},
|
|
@@ -25677,7 +25750,7 @@ var enigmaMocker = {exports: {}};
|
|
|
25677
25750
|
var enigmaMocker_dev = {exports: {}};
|
|
25678
25751
|
|
|
25679
25752
|
/*
|
|
25680
|
-
* @nebula.js/enigma-mocker v3.0.
|
|
25753
|
+
* @nebula.js/enigma-mocker v3.0.2
|
|
25681
25754
|
* Copyright (c) 2022 QlikTech International AB
|
|
25682
25755
|
* Released under the MIT license.
|
|
25683
25756
|
*/
|
|
@@ -26246,5 +26319,5 @@ const __DO_NOT_USE__ = {
|
|
|
26246
26319
|
locale
|
|
26247
26320
|
};
|
|
26248
26321
|
|
|
26249
|
-
export { index as EnigmaMocker, __DO_NOT_USE__, conversion, index$1 as embed, onTakeSnapshot, useAction, useApp, useAppLayout, useConstraints, useDeviceType, useEffect, useElement, useEmbed, useGlobal, useImperativeHandle, useKeyboard, useLayout, useMemo, useModel, useOptions, usePlugins, usePromise, useRect, useRenderState, useSelections, useStaleLayout, useState, useTheme, useTranslator };
|
|
26322
|
+
export { index as EnigmaMocker, __DO_NOT_USE__, conversion, index$1 as embed, onContextMenu, onTakeSnapshot, useAction, useApp, useAppLayout, useConstraints, useDeviceType, useEffect, useElement, useEmbed, useGlobal, useImperativeHandle, useKeyboard, useLayout, useMemo, useModel, useOptions, usePlugins, usePromise, useRect, useRenderState, useSelections, useStaleLayout, useState, useTheme, useTranslator };
|
|
26250
26323
|
//# sourceMappingURL=dev.js.map
|