From 3209694bcb668cb09a77abce79d38064450db9b3 Mon Sep 17 00:00:00 2001 From: Stanley Hsu Date: Thu, 13 Jan 2022 10:50:14 +0100 Subject: [PATCH] Convert .html files to .svelte files - by VS Code svelte formatter --- core/src/App.html | 4 +- core/src/TopNavDropDown.html | 2 +- ...{BadgeCounter.html => BadgeCounter.svelte} | 19 +- ...xtSwitcher.html => ContextSwitcher.svelte} | 256 ++--- core/src/navigation/ContextSwitcherNav.html | 123 --- core/src/navigation/ContextSwitcherNav.svelte | 132 +++ .../{GlobalNav.html => GlobalNav.svelte} | 182 ++-- core/src/navigation/LeftNav.html | 2 +- core/src/navigation/LogoTitle.html | 289 ------ core/src/navigation/LogoTitle.svelte | 320 +++++++ core/src/navigation/MobileTopNavDropDown.html | 2 +- core/src/navigation/ProductSwitcher.html | 220 ----- core/src/navigation/ProductSwitcher.svelte | 237 +++++ core/src/navigation/TopNav.html | 778 ---------------- core/src/navigation/TopNav.svelte | 872 ++++++++++++++++++ .../{TopNavNode.html => TopNavNode.svelte} | 33 +- 16 files changed, 1831 insertions(+), 1640 deletions(-) rename core/src/navigation/{BadgeCounter.html => BadgeCounter.svelte} (74%) rename core/src/navigation/{ContextSwitcher.html => ContextSwitcher.svelte} (62%) delete mode 100644 core/src/navigation/ContextSwitcherNav.html create mode 100644 core/src/navigation/ContextSwitcherNav.svelte rename core/src/navigation/{GlobalNav.html => GlobalNav.svelte} (56%) delete mode 100644 core/src/navigation/LogoTitle.html create mode 100644 core/src/navigation/LogoTitle.svelte delete mode 100644 core/src/navigation/ProductSwitcher.html create mode 100644 core/src/navigation/ProductSwitcher.svelte delete mode 100644 core/src/navigation/TopNav.html create mode 100644 core/src/navigation/TopNav.svelte rename core/src/navigation/{TopNavNode.html => TopNavNode.svelte} (60%) diff --git a/core/src/App.html b/core/src/App.html index 57d53d245c..8cec211bbe 100644 --- a/core/src/App.html +++ b/core/src/App.html @@ -134,9 +134,9 @@ import Backdrop from './Backdrop.html'; import SplitView from './SplitView.html'; import LeftNav from './navigation/LeftNav.html'; - import TopNav from './navigation/TopNav.html'; + import TopNav from './navigation/TopNav.svelte'; import TabNav from './navigation/TabNav.html'; - import GlobalNav from './navigation/GlobalNav.html'; + import GlobalNav from './navigation/GlobalNav.svelte'; import Breadcrumb from './navigation/Breadcrumb.html'; import { afterUpdate, diff --git a/core/src/TopNavDropDown.html b/core/src/TopNavDropDown.html index 70fe741e26..4b8ea702c9 100644 --- a/core/src/TopNavDropDown.html +++ b/core/src/TopNavDropDown.html @@ -45,7 +45,7 @@ /> {/if} +{#if node && node.badgeCounter} + {#await node.badgeCounter.count() then count} + {#if count > 0} + {count} + {/if} + {/await} +{/if} + diff --git a/core/src/navigation/ContextSwitcherNav.svelte b/core/src/navigation/ContextSwitcherNav.svelte new file mode 100644 index 0000000000..43dec220d8 --- /dev/null +++ b/core/src/navigation/ContextSwitcherNav.svelte @@ -0,0 +1,132 @@ + + + + + diff --git a/core/src/navigation/GlobalNav.html b/core/src/navigation/GlobalNav.svelte similarity index 56% rename from core/src/navigation/GlobalNav.html rename to core/src/navigation/GlobalNav.svelte index 6fcce53a39..40f1dde71b 100644 --- a/core/src/navigation/GlobalNav.html +++ b/core/src/navigation/GlobalNav.svelte @@ -1,91 +1,10 @@ - -{#if showGlobalNav} -
- -
-{/if} + +{#if showGlobalNav} +
+ +
+{/if} + diff --git a/core/src/navigation/LogoTitle.svelte b/core/src/navigation/LogoTitle.svelte new file mode 100644 index 0000000000..31a0d81986 --- /dev/null +++ b/core/src/navigation/LogoTitle.svelte @@ -0,0 +1,320 @@ + + +{#if addNavHrefForAnchor} + +{:else} + +{/if} +{#if title} + {#if !hasApps} + {#if addNavHrefForAnchor} + goTo('/')} + href="/" + > + {$getTranslation(title)} + + {:else} + goTo('/')} + > + {$getTranslation(title)} + + {/if}{:else} +
+
{}}> + {#if addNavHrefForAnchor} + {#if appSwitcherItems && appSwitcherItems.length > 0} + {#each appSwitcherItems as item} + {#if item === selectedItem && hasValidLink(item, pathParams)} + + toggleDropdownState('appSwitcherPopover')} + data-testid="app-switcher" + > + {$getTranslation(title)} + + + {/if} + {/each} + {/if} + {#if appSwitcherItems.length > 0 && !selectedItem} + + toggleDropdownState('appSwitcherPopover')} + data-testid="app-switcher" + > + {$getTranslation(title)} + + + {/if} + {:else} + + {/if} +
+
+ +
+
+ {/if} + {#if subTitle} +
{$getTranslation(subTitle)}
+ {/if}{/if} + + diff --git a/core/src/navigation/MobileTopNavDropDown.html b/core/src/navigation/MobileTopNavDropDown.html index 1b6abd01b6..1e991a1da9 100644 --- a/core/src/navigation/MobileTopNavDropDown.html +++ b/core/src/navigation/MobileTopNavDropDown.html @@ -64,7 +64,7 @@

- - diff --git a/core/src/navigation/ProductSwitcher.svelte b/core/src/navigation/ProductSwitcher.svelte new file mode 100644 index 0000000000..ade1ab17ac --- /dev/null +++ b/core/src/navigation/ProductSwitcher.svelte @@ -0,0 +1,237 @@ + + + +{#if productSwitcherItems && productSwitcherItems.length && Object.keys(productSwitcherItems[0]).length} + + {#if !isMobile} +
+
+
+
{}}> + +
+
+
+ +
+
+
+
+
+ {/if} + + {#if isMobile && dropDownStates.productSwitcherPopover} + + {/if} +{/if} + + diff --git a/core/src/navigation/TopNav.html b/core/src/navigation/TopNav.html deleted file mode 100644 index 3722dbe69f..0000000000 --- a/core/src/navigation/TopNav.html +++ /dev/null @@ -1,778 +0,0 @@ - -{#if showTopNav} -
-
- {#if responsiveNavSetting==="simple" || responsiveNavSetting==="simpleMobileOnly" || - responsiveNavSetting==="Fiori3"} - - {/if} - -
- {#if globalSearchConfig && isGlobalSearchCentered} - - {/if} -
- {#if !authorizationEnabled || isLoggedIn} {#if globalSearchConfig && - !isGlobalSearchCentered} - - {/if} - - {/if} {#if globalSearchConfig || (children && pathData.length > 0)} {#if (children && - pathData.length > 0)} {#each children as node, i} {#if !(node.hideFromNav || - (showGlobalNav && node.globalNav))} {#if node.isCat} -
-
-
- -
- -
-
- {:else} -
- {#if addNavHrefForAnchor} - - {:else} - - {/if} -
- {/if} {/if} {/each} {/if} - - - - {#if (visibleNodeCount - globalNavNodeCount > 0) || isProductSwitcherAvailable || - contextSwitcherConfig || globalSearchConfig } -
-
-
-
- -
-
- -
- {#if isProductSwitcherAvailable} - - {/if} {#if openMobileDropDown} - - {/if} {#if !authorizationEnabled || isLoggedIn} - - {/if} -
-
-
- {/if} {/if} - - {#if authorizationEnabled || profileItemsAvailable} -
- {#if profileTypeSettings === "Fiori3" && - GenericHelpers.requestExperimentalFeature('profileMenuFiori3', true) } -
-
- {#if userInfo.picture} - - {:else} - - {/if} -
-
- -
-
- {:else} -
-
-
-
- -
-
-
- -
-
-
- {/if} -
- {/if} {#if isProductSwitcherAvailable} - - {/if} -
-
-{:else} - -{/if} - - - diff --git a/core/src/navigation/TopNav.svelte b/core/src/navigation/TopNav.svelte new file mode 100644 index 0000000000..bdaf9a19be --- /dev/null +++ b/core/src/navigation/TopNav.svelte @@ -0,0 +1,872 @@ + + + +{#if showTopNav} +
+
+ {#if responsiveNavSetting === 'simple' || responsiveNavSetting === 'simpleMobileOnly' || responsiveNavSetting === 'Fiori3'} + + {/if} + +
+ {#if globalSearchConfig && isGlobalSearchCentered} + + {/if} +
+ {#if !authorizationEnabled || isLoggedIn} + {#if globalSearchConfig && !isGlobalSearchCentered} + + {/if} + + toggleDropdownState('contextSwitcherPopover')} + isMobile={false} + {addNavHrefForAnchor} + /> + {/if} + {#if globalSearchConfig || (children && pathData.length > 0)} + {#if children && pathData.length > 0} + {#each children as node, i} + {#if !(node.hideFromNav || (showGlobalNav && node.globalNav))} + {#if node.isCat} +
+
+
{}} + > + +
+ +
+
+ {:else} +
+ {#if addNavHrefForAnchor} + + {:else} + + {/if} +
+ {/if} + {/if} + {/each} + {/if} + + + + {#if visibleNodeCount - globalNavNodeCount > 0 || isProductSwitcherAvailable || contextSwitcherConfig || globalSearchConfig} +
+
+
+
{}} + > + +
+ + {#if isProductSwitcherAvailable} + + toggleDropdownState('productSwitcherPopover')} + isMobile={true} + /> + {/if} + {#if openMobileDropDown} + + {/if} + {#if !authorizationEnabled || isLoggedIn} + + toggleDropdownState('contextSwitcherPopover')} + isMobile={true} + {contextSwitcherToggle} + bind:selectedLabel + bind:defaultLabel={defaultLabelContextSwitcher} + /> + {/if} +
+
+
+ {/if} + {/if} + + {#if authorizationEnabled || profileItemsAvailable} +
+ {#if profileTypeSettings === 'Fiori3' && GenericHelpers.requestExperimentalFeature('profileMenuFiori3', true)} +
+
{}} + > + {#if userInfo.picture} + + {/if} +
+
+ + toggleDropdownState('profilePopover')} + on:userInfoUpdated={userInfoUpdate} + {addNavHrefForAnchor} + /> +
+
+ {:else} +
+
+
{}} + > +
+ +
+
+
+ + toggleDropdownState('profilePopover')} + on:userInfoUpdated={userInfoUpdate} + {addNavHrefForAnchor} + /> +
+
+
+ {/if} +
+ {/if} + {#if isProductSwitcherAvailable} + + toggleDropdownState('productSwitcherPopover')} + isMobile={false} + {addNavHrefForAnchor} + /> + {/if} +
+
+{:else} + toggleDropdownState('profilePopover')} + isHidden={true} + {addNavHrefForAnchor} + /> +{/if} + + diff --git a/core/src/navigation/TopNavNode.html b/core/src/navigation/TopNavNode.svelte similarity index 60% rename from core/src/navigation/TopNavNode.html rename to core/src/navigation/TopNavNode.svelte index 46a518c826..9ce007fbfc 100644 --- a/core/src/navigation/TopNavNode.html +++ b/core/src/navigation/TopNavNode.svelte @@ -1,19 +1,3 @@ -{#if node.icon} {#if hasOpenUIicon(node)} - -{:else} -{node.altText ? node.altText : ''} -{/if} - -{/if} - -{#if !node.icon || node.showLabel} -{getNodeLabel(node)} -{/if} - + +{#if node.icon} + {#if hasOpenUIicon(node)} + + {:else} + {node.altText + {/if} + +{/if} + +{#if !node.icon || node.showLabel} + {getNodeLabel(node)} +{/if}