@quincarter/create-lit-app 1.1.4 → 1.1.5
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/create-app-shell.sh +55 -13
- package/package.json +1 -1
package/create-app-shell.sh
CHANGED
|
@@ -867,7 +867,7 @@ if [ "$ENABLE_ROUTER" = true ]; then
|
|
|
867
867
|
directory: \"todos-page\",
|
|
868
868
|
component: \"todos-page\",
|
|
869
869
|
filePath: \"../../views/todos-page/todos-page.ts\",
|
|
870
|
-
levelOfAccess: [\"
|
|
870
|
+
levelOfAccess: [\"private\"],
|
|
871
871
|
tagName: \"todos-page\",
|
|
872
872
|
isMfe: false,
|
|
873
873
|
}"
|
|
@@ -953,6 +953,11 @@ export const routesBuilt = (
|
|
|
953
953
|
icon: navItem.icon || ("" as IconType),
|
|
954
954
|
mfeComponent: getMfeComponent(navItem.tagName),
|
|
955
955
|
userHasPermission: getAccessPermissions(navItem, accesses),
|
|
956
|
+
children: navItem.children?.map((child: NavItem) => ({
|
|
957
|
+
...child,
|
|
958
|
+
icon: child.icon || ("" as IconType),
|
|
959
|
+
userHasPermission: getAccessPermissions(child, accesses),
|
|
960
|
+
})),
|
|
956
961
|
}));
|
|
957
962
|
};
|
|
958
963
|
EOF
|
|
@@ -1262,10 +1267,12 @@ export class AppShellHeader extends LitElement {
|
|
|
1262
1267
|
${
|
|
1263
1268
|
this.routes.length > 0
|
|
1264
1269
|
? html`<ul>
|
|
1265
|
-
${this.routes
|
|
1266
|
-
(route) =>
|
|
1267
|
-
|
|
1268
|
-
|
|
1270
|
+
${this.routes
|
|
1271
|
+
.filter((route) => route.userHasPermission !== false)
|
|
1272
|
+
.map(
|
|
1273
|
+
(route) =>
|
|
1274
|
+
html`<li><a href="${withBase(route.path)}">${route.name}</a></li>`,
|
|
1275
|
+
)}
|
|
1269
1276
|
</ul>`
|
|
1270
1277
|
: nothing
|
|
1271
1278
|
}
|
|
@@ -1623,7 +1630,7 @@ export const ViewMixin = <T extends Constructor<LitElement>>(superClass: T) => {
|
|
|
1623
1630
|
return this.renderUnderConstruction();
|
|
1624
1631
|
}
|
|
1625
1632
|
|
|
1626
|
-
if (customTemplate) return html`${customTemplate}`;
|
|
1633
|
+
if (customTemplate && this.featureIsEnabled) return html`${customTemplate}`;
|
|
1627
1634
|
|
|
1628
1635
|
return html`${
|
|
1629
1636
|
this.featureIsEnabled && this.isMfe
|
|
@@ -1792,7 +1799,10 @@ EOF
|
|
|
1792
1799
|
IMPORTS="import { type HTMLTemplateResult, html, LitElement } from 'lit';
|
|
1793
1800
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
1794
1801
|
import { AppShellStyles } from './app-shell.styles';
|
|
1795
|
-
import type { NavItem } from './shared/interfaces/navigation.interface';
|
|
1802
|
+
import type { NavItem } from './shared/interfaces/navigation.interface';
|
|
1803
|
+
import \"./shared/internal-views/404-not-found/page-not-found\";
|
|
1804
|
+
import \"./shared/internal-views/no-access/no-access\";
|
|
1805
|
+
import \"./shared/internal-views/under-construction/under-construction\";"
|
|
1796
1806
|
|
|
1797
1807
|
if [ "$ENABLE_CONTEXT" = true ]; then
|
|
1798
1808
|
IMPORTS="$IMPORTS
|
|
@@ -1814,9 +1824,10 @@ if [ "$ENABLE_ROUTER" = true ]; then
|
|
|
1814
1824
|
import { Router } from '@lit-labs/router';
|
|
1815
1825
|
import { html as staticHtml, unsafeStatic } from 'lit/static-html.js';
|
|
1816
1826
|
import 'urlpattern-polyfill';
|
|
1817
|
-
import { navigationRouting } from './shared/configuration/nav';
|
|
1827
|
+
import { navigationRouting, sidePages } from './shared/configuration/nav';
|
|
1818
1828
|
import { routesBuilt } from './shared/configuration/routes';
|
|
1819
|
-
import { withBase } from './shared/configuration/base-path';
|
|
1829
|
+
import { withBase } from './shared/configuration/base-path';
|
|
1830
|
+
import { AppRootUtilities } from './shared/utilities/app-root.utility';"
|
|
1820
1831
|
fi
|
|
1821
1832
|
|
|
1822
1833
|
if [ "$ENABLE_HEADER" = true ]; then
|
|
@@ -1847,6 +1858,24 @@ cat <<EOF >> src/app-shell.ts
|
|
|
1847
1858
|
@property({ type: Array })
|
|
1848
1859
|
accesses: string[] = ["public"];
|
|
1849
1860
|
EOF
|
|
1861
|
+
else
|
|
1862
|
+
cat <<EOF >> src/app-shell.ts
|
|
1863
|
+
@property({ type: Array })
|
|
1864
|
+
routing: NavItem[] = [];
|
|
1865
|
+
|
|
1866
|
+
@property({ type: Array })
|
|
1867
|
+
accesses: string[] = ["public"];
|
|
1868
|
+
EOF
|
|
1869
|
+
fi
|
|
1870
|
+
|
|
1871
|
+
if [ "$ENABLE_ROUTER" = true ]; then
|
|
1872
|
+
cat <<EOF >> src/app-shell.ts
|
|
1873
|
+
@state()
|
|
1874
|
+
navRoutes: NavItem[] = [] as NavItem[];
|
|
1875
|
+
|
|
1876
|
+
@state()
|
|
1877
|
+
notAllowedRouteList: NavItem[] = [];
|
|
1878
|
+
EOF
|
|
1850
1879
|
fi
|
|
1851
1880
|
|
|
1852
1881
|
# Provide the MFE loader independently of ENABLE_CONTEXT so that the MFE
|
|
@@ -1875,6 +1904,7 @@ EOF
|
|
|
1875
1904
|
|
|
1876
1905
|
if [ "$ENABLE_ROUTER" = true ]; then
|
|
1877
1906
|
cat <<EOF >> src/app-shell.ts
|
|
1907
|
+
this.navRoutes = this._buildNavBarRoutes(navigationRouting);
|
|
1878
1908
|
await this._setupRoutes();
|
|
1879
1909
|
EOF
|
|
1880
1910
|
fi
|
|
@@ -1894,8 +1924,20 @@ EOF
|
|
|
1894
1924
|
if [ "$ENABLE_ROUTER" = true ]; then
|
|
1895
1925
|
cat <<EOF >> src/app-shell.ts
|
|
1896
1926
|
|
|
1927
|
+
private _buildNavBarRoutes(navItems: NavItem[]): NavItem[] {
|
|
1928
|
+
const navi = routesBuilt(navItems, this.accesses);
|
|
1929
|
+
const { notAllowed, navItems: filtered } =
|
|
1930
|
+
AppRootUtilities.getNotAllowedRoutes(navi, this.notAllowedRouteList);
|
|
1931
|
+
this.notAllowedRouteList = notAllowed;
|
|
1932
|
+
return filtered;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1897
1935
|
private async _setupRoutes(): Promise<void> {
|
|
1898
|
-
|
|
1936
|
+
const detailRoutes = this._buildNavBarRoutes([...sidePages]);
|
|
1937
|
+
this.routing = routesBuilt(
|
|
1938
|
+
[...this.navRoutes, ...this.notAllowedRouteList, ...detailRoutes],
|
|
1939
|
+
this.accesses,
|
|
1940
|
+
);
|
|
1899
1941
|
const routeConfigs = this.routing.map((navItem) => ({
|
|
1900
1942
|
path: withBase(navItem.path),
|
|
1901
1943
|
enter: async () => {
|
|
@@ -1908,8 +1950,8 @@ cat <<EOF >> src/app-shell.ts
|
|
|
1908
1950
|
},
|
|
1909
1951
|
}));
|
|
1910
1952
|
|
|
1911
|
-
const firstPath =
|
|
1912
|
-
const firstItem =
|
|
1953
|
+
const firstPath = this.navRoutes[0]?.path || "/home";
|
|
1954
|
+
const firstItem = this.navRoutes[0];
|
|
1913
1955
|
|
|
1914
1956
|
this._router.routes = [
|
|
1915
1957
|
{
|
|
@@ -1943,7 +1985,7 @@ EOF
|
|
|
1943
1985
|
|
|
1944
1986
|
if [ "$ENABLE_HEADER" = true ]; then
|
|
1945
1987
|
cat <<EOF >> src/app-shell.ts
|
|
1946
|
-
<app-shell-header .routes="\${this.
|
|
1988
|
+
<app-shell-header .routes="\${this.navRoutes}" enable-theme-switcher>
|
|
1947
1989
|
<main>
|
|
1948
1990
|
EOF
|
|
1949
1991
|
else
|