@lvce-editor/quick-pick-worker 4.20.2 → 4.21.0
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/dist/quickPickWorkerMain.js +42 -12
- package/package.json +1 -1
|
@@ -2904,6 +2904,11 @@ const invoke$2 = (method, ...args) => {
|
|
|
2904
2904
|
return state$1.rpc.invoke(method, ...args);
|
|
2905
2905
|
};
|
|
2906
2906
|
|
|
2907
|
+
const isTextInput = args => {
|
|
2908
|
+
const options = args.at(-1);
|
|
2909
|
+
return options?.type === 'text';
|
|
2910
|
+
};
|
|
2911
|
+
|
|
2907
2912
|
const toProtoVisibleItem$2 = item => {
|
|
2908
2913
|
const {
|
|
2909
2914
|
args,
|
|
@@ -2928,6 +2933,9 @@ const toProtoVisibleItem$2 = item => {
|
|
|
2928
2933
|
};
|
|
2929
2934
|
const getPicks$d = async (searchValue, args) => {
|
|
2930
2935
|
state$2.args = args;
|
|
2936
|
+
if (isTextInput(args)) {
|
|
2937
|
+
return [];
|
|
2938
|
+
}
|
|
2931
2939
|
const options = args.at(-1);
|
|
2932
2940
|
let items;
|
|
2933
2941
|
if (options?.mode === 'quickInput') {
|
|
@@ -3762,6 +3770,13 @@ const setValue = async (state, newValue) => {
|
|
|
3762
3770
|
if (value === newValue) {
|
|
3763
3771
|
return state;
|
|
3764
3772
|
}
|
|
3773
|
+
if (isTextInput(args)) {
|
|
3774
|
+
return {
|
|
3775
|
+
...state,
|
|
3776
|
+
inputSource: Script,
|
|
3777
|
+
value: newValue
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3765
3780
|
const prefix = getQuickPickPrefix(newValue);
|
|
3766
3781
|
const subId = getQuickPickSubProviderId(providerId, prefix);
|
|
3767
3782
|
const quickInput = isQuickInput(args);
|
|
@@ -4042,7 +4057,7 @@ const getLoadedState = async state => {
|
|
|
4042
4057
|
});
|
|
4043
4058
|
array(newPicks);
|
|
4044
4059
|
const filterValue = getFilterValue(id, subId, value);
|
|
4045
|
-
const items = filterQuickPickItems(newPicks, filterValue);
|
|
4060
|
+
const items = isTextInput(args) ? newPicks : filterQuickPickItems(newPicks, filterValue);
|
|
4046
4061
|
const minLineY = 0;
|
|
4047
4062
|
const maxLineY = Math.min(minLineY + maxVisibleItems, newPicks.length);
|
|
4048
4063
|
const sliced = newPicks.slice(minLineY, maxLineY);
|
|
@@ -4780,14 +4795,17 @@ const QuickPick$1 = 'QuickPick';
|
|
|
4780
4795
|
const QuickPickItems = 'QuickPickItems';
|
|
4781
4796
|
const QuickPickItemActive = 'QuickPickItemActive';
|
|
4782
4797
|
|
|
4783
|
-
const getQuickPickInputVirtualDom = (placeholder = '', ariaLabel = typeNameofCommandToRun()) => {
|
|
4798
|
+
const getQuickPickInputVirtualDom = (placeholder = '', ariaLabel = typeNameofCommandToRun(), textInput = false) => {
|
|
4784
4799
|
return [{
|
|
4785
4800
|
childCount: 1,
|
|
4786
4801
|
className: QuickPickInputWrapper,
|
|
4787
4802
|
type: Div
|
|
4788
4803
|
}, {
|
|
4789
|
-
|
|
4790
|
-
|
|
4804
|
+
...(!textInput && {
|
|
4805
|
+
ariaAutoComplete: 'list',
|
|
4806
|
+
ariaExpanded: true,
|
|
4807
|
+
role: ComboBox
|
|
4808
|
+
}),
|
|
4791
4809
|
ariaLabel: ariaLabel,
|
|
4792
4810
|
autocapitalize: 'off',
|
|
4793
4811
|
autocomplete: 'off',
|
|
@@ -4799,18 +4817,17 @@ const getQuickPickInputVirtualDom = (placeholder = '', ariaLabel = typeNameofCom
|
|
|
4799
4817
|
onFocus: HandleFocus,
|
|
4800
4818
|
onInput: HandleInput,
|
|
4801
4819
|
placeholder,
|
|
4802
|
-
role: ComboBox,
|
|
4803
4820
|
spellcheck: false,
|
|
4804
4821
|
type: Input
|
|
4805
4822
|
}];
|
|
4806
4823
|
};
|
|
4807
4824
|
|
|
4808
|
-
const getQuickPickHeaderVirtualDom = (placeholder = '', ariaLabel) => {
|
|
4825
|
+
const getQuickPickHeaderVirtualDom = (placeholder = '', ariaLabel, textInput = false) => {
|
|
4809
4826
|
return [{
|
|
4810
4827
|
childCount: 1,
|
|
4811
4828
|
className: QuickPickHeader,
|
|
4812
4829
|
type: Div
|
|
4813
|
-
}, ...getQuickPickInputVirtualDom(placeholder, ariaLabel)];
|
|
4830
|
+
}, ...getQuickPickInputVirtualDom(placeholder, ariaLabel, textInput)];
|
|
4814
4831
|
};
|
|
4815
4832
|
|
|
4816
4833
|
const getFileIconVirtualDom = icon => {
|
|
@@ -4955,8 +4972,17 @@ const getRootNodeCount = nodes => {
|
|
|
4955
4972
|
}
|
|
4956
4973
|
return count;
|
|
4957
4974
|
};
|
|
4958
|
-
const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, placeholder = '', inputAriaLabel) => {
|
|
4975
|
+
const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, placeholder = '', inputAriaLabel, textInput = false) => {
|
|
4959
4976
|
const quickOpen$1 = quickOpen();
|
|
4977
|
+
if (textInput) {
|
|
4978
|
+
return [{
|
|
4979
|
+
ariaLabel: quickOpen$1,
|
|
4980
|
+
childCount: 1,
|
|
4981
|
+
className: mergeClassNames(Viewlet, QuickPick$2),
|
|
4982
|
+
id: QuickPick$1,
|
|
4983
|
+
type: Div
|
|
4984
|
+
}, ...getQuickPickHeaderVirtualDom(placeholder, inputAriaLabel, true)];
|
|
4985
|
+
}
|
|
4960
4986
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
4961
4987
|
const quickPickItemsDom = getQuickPickItemsVirtualDom(visibleItems);
|
|
4962
4988
|
const listItemsChildCount = getRootNodeCount(quickPickItemsDom);
|
|
@@ -4993,7 +5019,7 @@ const renderItemsDom = state => {
|
|
|
4993
5019
|
visibleItems
|
|
4994
5020
|
} = viewModel;
|
|
4995
5021
|
const inputAriaLabel = getQuickPickInputAriaLabel(state.providerId, state.value, state.placeholder);
|
|
4996
|
-
return getQuickPickVirtualDom(visibleItems, scrollBarHeight, scrollBarTop, state.placeholder, inputAriaLabel);
|
|
5022
|
+
return getQuickPickVirtualDom(visibleItems, scrollBarHeight, scrollBarTop, state.placeholder, inputAriaLabel, isTextInput(state.args));
|
|
4997
5023
|
};
|
|
4998
5024
|
const renderItems = (_oldState, newState) => {
|
|
4999
5025
|
const dom = renderItemsDom(newState);
|
|
@@ -5167,6 +5193,7 @@ const showQuickInput = async ({
|
|
|
5167
5193
|
initialItems = [],
|
|
5168
5194
|
initialValue,
|
|
5169
5195
|
placeholder,
|
|
5196
|
+
type = id === undefined && initialItems.length === 0 ? 'text' : 'select',
|
|
5170
5197
|
waitUntil
|
|
5171
5198
|
}) => {
|
|
5172
5199
|
const customItemsId = add(initialItems);
|
|
@@ -5179,6 +5206,7 @@ const showQuickInput = async ({
|
|
|
5179
5206
|
mode: 'quickInput',
|
|
5180
5207
|
placeholder,
|
|
5181
5208
|
quickInputId: id,
|
|
5209
|
+
type,
|
|
5182
5210
|
waitUntil
|
|
5183
5211
|
});
|
|
5184
5212
|
return result ?? {
|
|
@@ -5197,20 +5225,22 @@ const showQuickPick = async ({
|
|
|
5197
5225
|
applicationId,
|
|
5198
5226
|
items,
|
|
5199
5227
|
placeholder = '',
|
|
5228
|
+
type = 'select',
|
|
5200
5229
|
waitUntil = 'selected'
|
|
5201
5230
|
}) => {
|
|
5202
|
-
const customItemsId = add(items);
|
|
5231
|
+
const customItemsId = add(type === 'text' ? [] : items);
|
|
5203
5232
|
const {
|
|
5204
5233
|
id,
|
|
5205
5234
|
promise
|
|
5206
5235
|
} = registerCallback();
|
|
5207
5236
|
try {
|
|
5208
5237
|
await invoke(applicationId, 'Viewlet.openWidget', QuickPick, 'custom', [], id, {
|
|
5209
|
-
acceptInput,
|
|
5238
|
+
acceptInput: type === 'text' || acceptInput,
|
|
5210
5239
|
callbackOwner: 'quickPickWorker',
|
|
5211
5240
|
customItemsId,
|
|
5212
5241
|
mode: 'quickPick',
|
|
5213
|
-
placeholder
|
|
5242
|
+
placeholder,
|
|
5243
|
+
type
|
|
5214
5244
|
});
|
|
5215
5245
|
if (waitUntil === 'visible') {
|
|
5216
5246
|
return undefined;
|