@lvce-editor/extension-search-view 7.11.0 → 7.12.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.
@@ -4425,6 +4425,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4425
4425
  return dom;
4426
4426
  };
4427
4427
 
4428
+ const getCompletionVirtualDom = (completionItems, completionFocusedIndex, suggestOpen) => {
4429
+ if (!suggestOpen) {
4430
+ return [];
4431
+ }
4432
+ return getCompletionWidgetVirtualDom(completionItems, completionFocusedIndex);
4433
+ };
4428
4434
  const getExtensionHeaderVirtualDom = (placeholder, actions, completionItems = [], completionFocusedIndex = 0, suggestOpen = false) => {
4429
4435
  const inputProperties = suggestOpen ? {
4430
4436
  ariaActivedescendant: `ExtensionSearchCompletion-${completionFocusedIndex}`,
@@ -4437,12 +4443,13 @@ const getExtensionHeaderVirtualDom = (placeholder, actions, completionItems = []
4437
4443
  ariaExpanded: false,
4438
4444
  role: ComboBox
4439
4445
  };
4446
+ const completionDom = getCompletionVirtualDom(completionItems, completionFocusedIndex, suggestOpen);
4440
4447
  return [{
4441
4448
  childCount: suggestOpen ? 2 : 1,
4442
4449
  className: ExtensionHeader,
4443
4450
  onContextMenu: HandleHeaderContextMenu,
4444
4451
  type: Div
4445
- }, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [], HandleInputFocus, HandleInputBlur, inputProperties), ...(suggestOpen ? getCompletionWidgetVirtualDom(completionItems, completionFocusedIndex) : [])];
4452
+ }, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [], HandleInputFocus, HandleInputBlur, inputProperties), ...completionDom];
4446
4453
  };
4447
4454
 
4448
4455
  const renderHeader = newState => {
@@ -4551,10 +4558,12 @@ const listItemDescription = {
4551
4558
  className: ExtensionListItemDescription,
4552
4559
  type: Div
4553
4560
  };
4554
- const listItemFooter = {
4555
- childCount: 3,
4556
- className: ExtensionListItemFooter,
4557
- type: Div
4561
+ const getListItemFooter = hasStatistics => {
4562
+ return {
4563
+ childCount: hasStatistics ? 3 : 2,
4564
+ className: ExtensionListItemFooter,
4565
+ type: Div
4566
+ };
4558
4567
  };
4559
4568
  const listItemAuthorName = {
4560
4569
  childCount: 1,
@@ -4570,6 +4579,12 @@ const getId = focused => {
4570
4579
  }
4571
4580
  return undefined;
4572
4581
  };
4582
+ const getStatisticsVirtualDom = (hasStatistics, downloadCount, rating) => {
4583
+ if (!hasStatistics) {
4584
+ return [];
4585
+ }
4586
+ return getExtensionStatisticsVirtualDom(downloadCount, rating);
4587
+ };
4573
4588
  const getExtensionListItemVirtualDom = extension => {
4574
4589
  const {
4575
4590
  builtin = false,
@@ -4587,6 +4602,7 @@ const getExtensionListItemVirtualDom = extension => {
4587
4602
  status
4588
4603
  } = extension;
4589
4604
  const actionsDom = getExtensionActionsVirtualDom(id, builtin, disabled, status);
4605
+ const hasStatistics = !builtin;
4590
4606
  const dom = [{
4591
4607
  ariaPosInSet: posInSet,
4592
4608
  ariaRoleDescription: Extension,
@@ -4602,7 +4618,7 @@ const getExtensionListItemVirtualDom = extension => {
4602
4618
  role: None,
4603
4619
  src: icon,
4604
4620
  type: Img
4605
- }, listItemDetail, listItemName, text(name), listItemDescription, text(description), listItemFooter, listItemAuthorName, text(publisher), ...getExtensionStatisticsVirtualDom(downloadCount, rating), ...actionsDom];
4621
+ }, listItemDetail, listItemName, text(name), listItemDescription, text(description), getListItemFooter(hasStatistics), listItemAuthorName, text(publisher), ...getStatisticsVirtualDom(hasStatistics, downloadCount, rating), ...actionsDom];
4606
4622
  return dom;
4607
4623
  };
4608
4624
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",